X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapisearchjson.php;h=c7fa741a069477e797a89c55fb539f829c6b290f;hb=1e6aff69d69e09495638b60831c0548aae0b9773;hp=b0e3be687c1118da16e0f88584911b6a7b786c2e;hpb=6848e93cd526ebafa0c6001f51197357d1cfb4e2;p=quix0rs-gnu-social.git diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index b0e3be687c..c7fa741a06 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -1,6 +1,6 @@ . * * @category Search - * @package Laconica - * @author Zach Copley - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Zach Copley + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -require_once INSTALLDIR.'/lib/twitterapi.php'; +require_once INSTALLDIR.'/lib/api.php'; require_once INSTALLDIR.'/lib/jsonsearchresultslist.php'; /** * Action handler for Twitter-compatible API search * * @category Search - * @package Laconica - * @author Zach Copley + * @package StatusNet + * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ - * @see TwitterapiAction + * @link http://status.net/ + * @see ApiAction */ -class TwitapisearchjsonAction extends TwitterapiAction +class TwitapisearchjsonAction extends ApiAction { var $query; var $lang; @@ -124,16 +124,19 @@ class TwitapisearchjsonAction extends TwitterapiAction $search_engine = $notice->getSearchEngine('identica_notices'); $search_engine->set_sort_mode('chron'); $search_engine->limit(($this->page - 1) * $this->rpp, $this->rpp + 1, true); - $search_engine->query($q); - $cnt = $notice->find(); + if (false === $search_engine->query($q)) { + $cnt = 0; + } else { + $cnt = $notice->find(); + } // TODO: since_id, lang, geocode $results = new JSONSearchResultsList($notice, $q, $this->rpp, $this->page); - $this->init_document('json'); + $this->initDocument('json'); $results->show(); - $this->end_document('json'); + $this->endDocument('json'); } /** @@ -146,4 +149,4 @@ class TwitapisearchjsonAction extends TwitterapiAction { return true; } -} \ No newline at end of file +}