summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-06-24 18:11:50 -0700
committerZach Copley <zach@status.net>2010-06-24 18:11:50 -0700
commit9eb5a976b03fae6bd1e1fce6abfe4a6c7964d1ae (patch)
treeba170c56b1b870c380c7699049fdc1f5063bc30e
parenta6408be566dc9877eb67c86d4283dd57b2255d8b (diff)
Have API methods for search subclass ApiPrivateAuthAction
-rw-r--r--actions/apisearchatom.php (renamed from actions/twitapisearchatom.php)12
-rw-r--r--actions/apisearchjson.php (renamed from actions/twitapisearchjson.php)7
-rw-r--r--actions/apitrends.php (renamed from actions/twitapitrends.php)8
-rw-r--r--lib/router.php6
4 files changed, 22 insertions, 11 deletions
diff --git a/actions/twitapisearchatom.php b/actions/apisearchatom.php
index 51e8a8881..60bb8b040 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/apisearchatom.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -31,6 +31,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
+
/**
* Action for outputting search results in Twitter compatible Atom
* format.
@@ -44,10 +46,10 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*
- * @see ApiAction
+ * @see ApiPrivateAuthAction
*/
-class TwitapisearchatomAction extends ApiAction
+class ApiSearchAtomAction extends ApiPrivateAuthAction
{
var $cnt;
@@ -96,8 +98,11 @@ class TwitapisearchatomAction extends ApiAction
function prepare($args)
{
+ common_debug("in apisearchatom prepare()");
+
parent::prepare($args);
+
$this->query = $this->trimmed('q');
$this->lang = $this->trimmed('lang');
$this->rpp = $this->trimmed('rpp');
@@ -138,6 +143,7 @@ class TwitapisearchatomAction extends ApiAction
function handle($args)
{
parent::handle($args);
+ common_debug("In apisearchatom handle()");
$this->showAtom();
}
diff --git a/actions/twitapisearchjson.php b/actions/apisearchjson.php
index b5c006aa7..e44634684 100644
--- a/actions/twitapisearchjson.php
+++ b/actions/apisearchjson.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -31,6 +31,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
/**
@@ -44,7 +45,7 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
* @see ApiAction
*/
-class TwitapisearchjsonAction extends ApiAction
+class ApiSearchJSONAction extends ApiPrivateAuthAction
{
var $query;
var $lang;
@@ -64,6 +65,8 @@ class TwitapisearchjsonAction extends ApiAction
function prepare($args)
{
+ common_debug("apisearchjson prepare()");
+
parent::prepare($args);
$this->query = $this->trimmed('q');
diff --git a/actions/twitapitrends.php b/actions/apitrends.php
index 5a04569a2..5b74636c6 100644
--- a/actions/twitapitrends.php
+++ b/actions/apitrends.php
@@ -22,7 +22,7 @@
* @category Search
* @package StatusNet
* @author Zach Copley <zach@status.net>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-2010 StatusNet, Inc.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -31,6 +31,8 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
+require_once INSTALLDIR.'/lib/apiprivateauth.php';
+
/**
* Returns the top ten queries that are currently trending
*
@@ -43,7 +45,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @see ApiAction
*/
-class TwitapitrendsAction extends ApiAction
+class ApiTrendsAction extends ApiPrivateAuthAction
{
var $callback;
@@ -82,7 +84,7 @@ class TwitapitrendsAction extends ApiAction
*/
function showTrends()
{
- $this->serverError(_('API method under construction.'), $code = 501);
+ $this->serverError(_('API method under construction.'), 501);
}
} \ No newline at end of file
diff --git a/lib/router.php b/lib/router.php
index fec229c9b..7e1e6a2a4 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -667,9 +667,9 @@ class Router
);
// search
- $m->connect('api/search.atom', array('action' => 'twitapisearchatom'));
- $m->connect('api/search.json', array('action' => 'twitapisearchjson'));
- $m->connect('api/trends.json', array('action' => 'twitapitrends'));
+ $m->connect('api/search.atom', array('action' => 'ApiSearchAtom'));
+ $m->connect('api/search.json', array('action' => 'ApiSearchJSON'));
+ $m->connect('api/trends.json', array('action' => 'ApiTrends'));
$m->connect('api/oauth/request_token',
array('action' => 'apioauthrequesttoken'));