diff options
author | Zach Copley <zach@status.net> | 2009-10-09 17:32:53 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2009-10-09 17:32:53 -0700 |
commit | b08d16ef2bf5995ca2feee2d2688e0080eaf5124 (patch) | |
tree | ec4f7e232f8508c160ae3599f6ca880a731bd255 | |
parent | 57dfad64beae100187dcaf3c205645e89611e115 (diff) |
These same params are used in most API actions; moved to base API class
-rw-r--r-- | actions/apidirectmessage.php | 11 | ||||
-rw-r--r-- | actions/apigrouplist.php | 12 | ||||
-rw-r--r-- | actions/apigrouplistall.php | 11 | ||||
-rw-r--r-- | actions/apigroupmembership.php | 14 | ||||
-rw-r--r-- | actions/apisubscriptions.php | 5 | ||||
-rw-r--r-- | actions/apitimelinefavorites.php | 13 | ||||
-rw-r--r-- | actions/apitimelinefriends.php | 12 | ||||
-rw-r--r-- | actions/apitimelinegroup.php | 9 | ||||
-rw-r--r-- | actions/apitimelinementions.php | 6 | ||||
-rw-r--r-- | actions/apitimelinepublic.php | 6 | ||||
-rw-r--r-- | actions/apitimelinetag.php | 5 | ||||
-rw-r--r-- | actions/apitimelineuser.php | 6 | ||||
-rw-r--r-- | lib/api.php | 17 |
13 files changed, 18 insertions, 109 deletions
diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index cede4c072..f0013c54c 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -46,11 +46,6 @@ require_once INSTALLDIR.'/lib/apiauth.php'; class ApiDirectMessageAction extends ApiAuthAction { var $messages = null; - var $page = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; var $title = null; var $subtitle = null; var $link = null; @@ -77,12 +72,6 @@ class ApiDirectMessageAction extends ApiAuthAction return; } - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $server = common_root_url(); $taguribase = common_config('integration', 'taguri'); diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 00ceeed76..7a5aab72e 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -45,12 +45,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; class ApiGroupListAction extends ApiBareAuthAction { - var $user = null; - var $page = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; var $groups = null; /** @@ -65,12 +59,6 @@ class ApiGroupListAction extends ApiBareAuthAction function prepare($args) { parent::prepare($args); - - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); $this->user = $this->getTargetUser($id); $this->groups = $this->getGroups(); diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index 070927b1e..3e236816a 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -45,11 +45,6 @@ require_once INSTALLDIR . '/lib/api.php'; class ApiGroupListAllAction extends ApiAction { - var $page = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; var $groups = null; /** @@ -65,12 +60,6 @@ class ApiGroupListAllAction extends ApiAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->user = $this->getTargetUser($id); $this->groups = $this->getGroups(); diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index 0e9510d71..0bc846d60 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -45,11 +45,6 @@ require_once INSTALLDIR . '/lib/api.php'; class ApiGroupMembershipAction extends ApiAction { - var $page = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; var $group = null; var $profiles = null; @@ -66,14 +61,7 @@ class ApiGroupMembershipAction extends ApiAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - - $this->group = $this->getTargetGroup($this->arg('id')); - + $this->group = $this->getTargetGroup($this->arg('id')); $this->profiles = $this->getProfiles(); return true; diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index 9dbddbd9b..1332fd71c 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -47,10 +47,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; class ApiSubscriptionsAction extends ApiBareAuthAction { - - var $page = null; - var $count = null; - var $user = null; var $profiles = null; var $tag = null; var $lite = null; @@ -69,7 +65,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); $this->tag = $this->arg('tag'); // Note: Twitter no longer supports 'lite' diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index 231f2ae49..d35e05183 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -46,14 +46,7 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; class ApiTimelineFavoritesAction extends ApiBareAuthAction { - - var $user = null; var $notices = null; - var $page = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; /** * Take arguments for running @@ -68,12 +61,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index 02e352569..544824078 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -46,13 +46,7 @@ require_once INSTALLDIR.'/lib/apibareauth.php'; class ApiTimelineFriendsAction extends ApiBareAuthAction { - - var $user = null; var $notices = null; - var $count = null; - var $max_id = null; - var $since_id = null; - var $since = null; /** * Take arguments for running @@ -67,12 +61,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index abe7f0c5d..6f2043fb6 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -62,14 +62,7 @@ class ApiTimelineGroupAction extends ApiAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - - $this->group = $this->getTargetGroup($this->arg('id')); - + $this->group = $this->getTargetGroup($this->arg('id')); $this->notices = $this->getNotices(); return true; diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index 7549b4722..60669d9ba 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -62,12 +62,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index a635ddc91..b992136d1 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -61,12 +61,6 @@ class ApiTimelinePublicAction extends ApiAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->notices = $this->getNotices(); return true; diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index 8211b0122..53e79e4b9 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -61,10 +61,7 @@ class ApiTimelineTagAction extends ApiAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->tag = $this->arg('tag'); - + $this->tag = $this->arg('tag'); $this->notices = $this->getNotices(); return true; diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index 81e23116b..652a1b0d9 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -64,12 +64,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction { parent::prepare($args); - $this->page = (int)$this->arg('page', 1); - $this->count = (int)$this->arg('count', 20); - $this->max_id = (int)$this->arg('max_id', 0); - $this->since_id = (int)$this->arg('since_id', 0); - $this->since = $this->arg('since'); - $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { diff --git a/lib/api.php b/lib/api.php index 3afb20612..95a0779ad 100644 --- a/lib/api.php +++ b/lib/api.php @@ -43,8 +43,14 @@ if (!defined('STATUSNET')) { class ApiAction extends Action { - var $format = null; - + var $format = null; + var $user = null; + var $page = null; + var $count = null; + var $max_id = null; + var $since_id = null; + var $since = null; + /** * Initialization. * @@ -56,7 +62,14 @@ class ApiAction extends Action function prepare($args) { parent::prepare($args); + $this->format = $this->arg('format'); + $this->page = (int)$this->arg('page', 1); + $this->count = (int)$this->arg('count', 20); + $this->max_id = (int)$this->arg('max_id', 0); + $this->since_id = (int)$this->arg('since_id', 0); + $this->since = $this->arg('since'); + return true; } |