From 559918826a714c1ee2ecdc49dcfc2b67451a9864 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 9 Oct 2009 17:11:40 -0700 Subject: [PATCH] Remove more redundant $formats --- actions/apigroupismember.php | 2 -- actions/apigroupjoin.php | 3 --- actions/apigroupleave.php | 3 --- actions/apigrouplist.php | 2 -- actions/apigrouplistall.php | 2 -- actions/apigroupmembership.php | 2 -- actions/apistatusesdestroy.php | 2 -- actions/apistatusesshow.php | 2 -- actions/apistatusesupdate.php | 3 --- actions/apisubscriptions.php | 2 -- actions/apitimelinefavorites.php | 2 -- actions/apitimelinefriends.php | 2 -- actions/apitimelinegroup.php | 1 - actions/apitimelinementions.php | 4 ++-- actions/apitimelinepublic.php | 2 +- actions/apitimelinetag.php | 1 - actions/apitimelineuser.php | 4 ++-- lib/apiauth.php | 4 ++-- 18 files changed, 7 insertions(+), 36 deletions(-) diff --git a/actions/apigroupismember.php b/actions/apigroupismember.php index 02079b6ffe..359b7ca4fa 100644 --- a/actions/apigroupismember.php +++ b/actions/apigroupismember.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; class ApiGroupIsMemberAction extends ApiBareAuthAction { - var $format = null; var $user = null; var $group = null; @@ -64,7 +63,6 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction $this->user = $this->getTargetUser(null); $this->group = $this->getTargetGroup(null); - $this->format = $this->arg('format'); return true; } diff --git a/actions/apigroupjoin.php b/actions/apigroupjoin.php index 7ab1b72723..e51842bcb6 100644 --- a/actions/apigroupjoin.php +++ b/actions/apigroupjoin.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; class ApiGroupJoinAction extends ApiAuthAction { - var $format = null; var $user = null; var $group = null; @@ -65,8 +64,6 @@ class ApiGroupJoinAction extends ApiAuthAction $this->user = $this->auth_user; $this->group = $this->getTargetGroup($this->arg('id')); - $this->format = $this->arg('format'); - return true; } diff --git a/actions/apigroupleave.php b/actions/apigroupleave.php index 86b56f5af0..332bd7b7b2 100644 --- a/actions/apigroupleave.php +++ b/actions/apigroupleave.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/apiauth.php'; class ApiGroupLeaveAction extends ApiAuthAction { - var $format = null; var $user = null; var $group = null; @@ -65,8 +64,6 @@ class ApiGroupLeaveAction extends ApiAuthAction $this->user = $this->auth_user; $this->group = $this->getTargetGroup($this->arg('id')); - $this->format = $this->arg('format'); - return true; } diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php index 69c347de12..00ceeed760 100644 --- a/actions/apigrouplist.php +++ b/actions/apigrouplist.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; class ApiGroupListAction extends ApiBareAuthAction { - var $format = null; var $user = null; var $page = null; var $count = null; @@ -74,7 +73,6 @@ class ApiGroupListAction extends ApiBareAuthAction $this->since = $this->arg('since'); $this->user = $this->getTargetUser($id); - $this->format = $this->arg('format'); $this->groups = $this->getGroups(); return true; diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php index 80dcad9dcd..a0f04ed760 100644 --- a/actions/apigrouplistall.php +++ b/actions/apigrouplistall.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/api.php'; class ApiGroupListAllAction extends TwitterApiAction { - var $format = null; var $page = null; var $count = null; var $max_id = null; @@ -73,7 +72,6 @@ class ApiGroupListAllAction extends TwitterApiAction $this->since = $this->arg('since'); $this->user = $this->getTargetUser($id); - $this->format = $this->arg('format'); $this->groups = $this->getGroups(); return true; diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index 872ee45eee..da510ff26b 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -45,7 +45,6 @@ require_once INSTALLDIR . '/lib/api.php'; class ApiGroupMembershipAction extends TwitterApiAction { - var $format = null; var $page = null; var $count = null; var $max_id = null; @@ -73,7 +72,6 @@ class ApiGroupMembershipAction extends TwitterApiAction $this->since_id = (int)$this->arg('since_id', 0); $this->since = $this->arg('since'); - $this->format = $this->arg('format'); $this->group = $this->getTargetGroup($this->arg('id')); $this->profiles = $this->getProfiles(); diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 16a7cc376e..7680f96dcf 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -48,7 +48,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction var $user = null; var $status = null; - var $format = null; /** * Take arguments for running @@ -70,7 +69,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction $this->notice_id = (int)$this->arg('id'); } - $this->format = $this->arg('format'); $this->notice = Notice::staticGet((int)$this->notice_id); return true; diff --git a/actions/apistatusesshow.php b/actions/apistatusesshow.php index 9e28fe2ab6..0096cfe6b9 100644 --- a/actions/apistatusesshow.php +++ b/actions/apistatusesshow.php @@ -48,7 +48,6 @@ class ApiStatusesShowAction extends ApiAction var $notice_id = null; var $notice = null; - var $format = null; /** * Take arguments for running @@ -74,7 +73,6 @@ class ApiStatusesShowAction extends ApiAction $this->notice_id = (int)$this->arg('id'); } - $this->format = $this->arg('format'); $this->notice = Notice::staticGet((int)$this->notice_id); return true; diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index ab33d8a3e9..7d6a574ef0 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -50,7 +50,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction var $source = null; var $status = null; var $in_reply_to_status_id = null; - var $format = null; static $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api'); @@ -92,8 +91,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction $this->source = 'api'; } - $this->format = $this->arg('format'); - $this->in_reply_to_status_id = intval($this->trimmed('in_reply_to_status_id')); diff --git a/actions/apisubscriptions.php b/actions/apisubscriptions.php index bdaa0ea39a..9dbddbd9bd 100644 --- a/actions/apisubscriptions.php +++ b/actions/apisubscriptions.php @@ -52,7 +52,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction var $count = null; var $user = null; var $profiles = null; - var $format = null; var $tag = null; var $lite = null; var $ids_only = null; @@ -72,7 +71,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction $this->page = (int)$this->arg('page', 1); $this->tag = $this->arg('tag'); - $this->format = $this->arg('format'); // Note: Twitter no longer supports 'lite' $this->lite = $this->arg('lite'); diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php index 35a996c9cb..231f2ae49c 100644 --- a/actions/apitimelinefavorites.php +++ b/actions/apitimelinefavorites.php @@ -49,7 +49,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction var $user = null; var $notices = null; - var $format = null; var $page = null; var $count = null; var $max_id = null; @@ -74,7 +73,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction $this->max_id = (int)$this->arg('max_id', 0); $this->since_id = (int)$this->arg('since_id', 0); $this->since = $this->arg('since'); - $this->format = $this->arg('format'); $this->user = $this->getTargetUser($this->arg('id')); diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php index 92a8852936..02e3525695 100644 --- a/actions/apitimelinefriends.php +++ b/actions/apitimelinefriends.php @@ -53,7 +53,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction var $max_id = null; var $since_id = null; var $since = null; - var $format = null; /** * Take arguments for running @@ -73,7 +72,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction $this->max_id = (int)$this->arg('max_id', 0); $this->since_id = (int)$this->arg('since_id', 0); $this->since = $this->arg('since'); - $this->format = $this->arg('format'); $this->user = $this->getTargetUser($this->arg('id')); diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php index 9d6ac6ad18..abe7f0c5d8 100644 --- a/actions/apitimelinegroup.php +++ b/actions/apitimelinegroup.php @@ -70,7 +70,6 @@ class ApiTimelineGroupAction extends ApiAction $this->group = $this->getTargetGroup($this->arg('id')); - $this->format = $this->arg('format'); $this->notices = $this->getNotices(); return true; diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php index ecead98cce..7549b4722d 100644 --- a/actions/apitimelinementions.php +++ b/actions/apitimelinementions.php @@ -71,7 +71,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { - $this->clientError(_('No such user!'), 404, $this->arg('format')); + $this->clientError(_('No such user!'), 404, $this->format); return; } @@ -122,7 +122,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction $sitename, $this->user->nickname, $profile->getBestName() ); - switch($this->arg('format')) { + switch($this->format) { case 'xml': $this->show_xml_timeline($this->notices); break; diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php index 2638dd2926..a635ddc91e 100644 --- a/actions/apitimelinepublic.php +++ b/actions/apitimelinepublic.php @@ -103,7 +103,7 @@ class ApiTimelinePublicAction extends ApiAction $link = common_root_url(); $subtitle = sprintf(_("%s updates from everyone!"), $sitename); - switch($this->arg('format')) { + switch($this->format) { case 'xml': $this->show_xml_timeline($this->notices); break; diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php index 0efe8d2449..8211b01226 100644 --- a/actions/apitimelinetag.php +++ b/actions/apitimelinetag.php @@ -64,7 +64,6 @@ class ApiTimelineTagAction extends ApiAction $this->page = (int)$this->arg('page', 1); $this->count = (int)$this->arg('count', 20); $this->tag = $this->arg('tag'); - $this->format = $this->arg('format'); $this->notices = $this->getNotices(); diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index d50648d7c9..81e23116b7 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -73,7 +73,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $this->user = $this->getTargetUser($this->arg('id')); if (empty($this->user)) { - $this->clientError(_('No such user!'), 404, $this->arg('format')); + $this->clientError(_('No such user!'), 404, $this->format); return; } @@ -127,7 +127,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction $suplink = common_local_url('sup', null, null, $this->user->id); header('X-SUP-ID: ' . $suplink); - switch($this->arg('format')) { + switch($this->format) { case 'xml': $this->show_xml_timeline($this->notices); break; diff --git a/lib/apiauth.php b/lib/apiauth.php index 9fc0e57124..25bbae24e5 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -172,7 +172,7 @@ class ApiAuthAction extends ApiAction header('HTTP/1.1 401 Unauthorized'); $msg = 'Could not authenticate you.'; - if ($this->arg('format') == 'xml') { + if ($this->format == 'xml') { header('Content-Type: application/xml; charset=utf-8'); $this->startXML(); $this->elementStart('hash'); @@ -180,7 +180,7 @@ class ApiAuthAction extends ApiAction $this->element('request', null, $_SERVER['REQUEST_URI']); $this->elementEnd('hash'); $this->endXML(); - } elseif ($this->arg('format') == 'json') { + } elseif ($this->format == 'json') { header('Content-Type: application/json; charset=utf-8'); $error_array = array('error' => $msg, 'request' => $_SERVER['REQUEST_URI']);