forked from codepo8/firehose-research
/
lookup.php
executable file
·47 lines (42 loc) · 1.31 KB
/
lookup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
Yahoo Firehose research interface
YQL lookup and results list module
Homepage: http://github.com/codepo8/firehose-research
Copyright (c)2010 Christian Heilmann
Code licensed under the BSD License:
http://wait-till-i.com/license.txt
*/
if(isset($_POST['sent']) || isset($_POST['moar'])){
if(isset($_POST['sent'])){
$offset = 0;
}
$howmany = 20;
$firehose = 'select * from social.updates.search('.$offset.','.$howmany.
') where query="'.$_POST['s'].'" and source in '.
' ("'.join('","',$_POST['sources']).'")';
echo "<!-- $firehose -->";
$data = $oauthapp->yql($firehose);
if($data->query->results !== null){
echo '<h2><span>3</span> Your search results</h2>';
echo '<ul id="results">';
if(sizeof($data->query->results->update) == 1){
echo render($data->query->results->update);
} else {
foreach($data->query->results->update as $u){
echo render($u);
}
}
echo '</ul>';
$offset += $howmany;
echo "<input type=\"hidden\" name=\"offset\" value=\"$offset\">
<div class=\"more\">
<input type=\"submit\" name=\"moar\" value=\"see more results\">
</div>";
} else {
echo "<p class=\"error\">
Sorry, but we couldn't find anything for these settings.
</p>";
}
}
?>