From 3c9686e80f50f24f302abf5dd27b74a44fa4ae56 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 7 May 2010 16:32:24 -0700 Subject: Fix for repeats from the API having null source attribution --- lib/apiaction.php | 9 +++++++++ lib/apiauth.php | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/apiaction.php b/lib/apiaction.php index 42aa08ef7..80a8a08d1 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -124,9 +124,12 @@ class ApiAction extends Action var $count = null; var $max_id = null; var $since_id = null; + var $source = null; var $access = self::READ_ONLY; // read (default) or read-write + static $reserved_sources = array('web', 'omb', 'ostatus', 'mail', 'xmpp', 'api'); + /** * Initialization. * @@ -150,6 +153,12 @@ class ApiAction extends Action header('X-StatusNet-Warning: since parameter is disabled; use since_id'); } + $this->source = $this->trimmed('source'); + + if (empty($this->source) || in_array($this->source, self::$reserved_sources)) { + $this->source = 'api'; + } + return true; } diff --git a/lib/apiauth.php b/lib/apiauth.php index 8c3998888..9c68e2771 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -72,7 +72,6 @@ class ApiAuthAction extends ApiAction { var $auth_user_nickname = null; var $auth_user_password = null; - var $oauth_source = null; /** * Take arguments for running, looks for an OAuth request, @@ -181,7 +180,7 @@ class ApiAuthAction extends ApiAction // set the source attr - $this->oauth_source = $app->name; + $this->source = $app->name; $appUser = Oauth_application_user::staticGet('token', $access_token); -- cgit v1.2.3-54-g00ecf