]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapisearchjson.php
change Laconica and Control Yourself to StatusNet in PHP files
[quix0rs-gnu-social.git] / actions / twitapisearchjson.php
index b50aa86b7ac119a2200d0522671660fc4f50cabe..57a5fb0ca17fd0189819397494444b54ca0a139e 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
- * List of replies
+ * Action for showing Twitter-like JSON search results
  *
  * PHP version 5
  *
@@ -20,9 +20,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Search
- * @package   Laconica
+ * @package   StatusNet
  * @author    Zach Copley <zach@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @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/
  */
@@ -38,7 +38,7 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
  * Action handler for Twitter-compatible API search
  *
  * @category Search
- * @package  Laconica
+ * @package  StatusNet
  * @author   Zach Copley <zach@controlyourself.ca>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://laconi.ca/
@@ -114,7 +114,7 @@ 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();
 
@@ -124,8 +124,11 @@ 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
 
@@ -137,13 +140,13 @@ class TwitapisearchjsonAction extends TwitterapiAction
     }
 
     /**
-     * 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
+}