X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ftwitapisearchjson.php;h=741ed78d6388cc19ccfa98979cc5d6a9e601341e;hb=198c046c896c2a1c4dc9037fa538c14179e827ce;hp=b50aa86b7ac119a2200d0522671660fc4f50cabe;hpb=bab3e1b8586f42bc1f0a5f96b6990d67c6b74446;p=quix0rs-gnu-social.git diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php index b50aa86b7a..741ed78d63 100644 --- a/actions/twitapisearchjson.php +++ b/actions/twitapisearchjson.php @@ -1,8 +1,8 @@ . * * @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; @@ -114,36 +114,39 @@ class TwitapisearchjsonAction extends TwitterapiAction function showResults() { - // TODO: Support search operators like from: and to: + // TODO: Support search operators like from: and to:, boolean, etc. $notice = new Notice(); // lcase it for comparison $q = strtolower($this->query); - $search_engine = $notice->getSearchEngine('identica_notices'); + $search_engine = $notice->getSearchEngine('notice'); $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'); } /** - * This is a read-only action + * Do we need to write to the database? * * @return boolean true */ - function isReadOnly() + function isReadOnly($args) { return true; } -} \ No newline at end of file +}