From: Zach Copley Date: Sat, 10 Oct 2009 00:32:53 +0000 (-0700) Subject: These same params are used in most API actions; moved to base API class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b08d16ef2bf5995ca2feee2d2688e0080eaf5124;p=quix0rs-gnu-social.git These same params are used in most API actions; moved to base API class --- diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index cede4c0721..f0013c54c5 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 00ceeed760..7a5aab72eb 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 070927b1ea..3e236816ab 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 0e9510d713..0bc846d604 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 9dbddbd9bd..1332fd71c6 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 231f2ae49c..d35e051835 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 02e3525695..544824078e 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 abe7f0c5d8..6f2043fb65 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 7549b4722d..60669d9ba3 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 a635ddc91e..b992136d1f 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 8211b01226..53e79e4b9e 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 81e23116b7..652a1b0d95 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 3afb20612d..95a0779add 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; }