summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-05-07 16:32:24 -0700
committerZach Copley <zach@status.net>2010-05-08 00:07:42 +0000
commitfba140f4e0246a244664f0c0fb2361b027508d35 (patch)
tree072e877e529eb05687300efc724d8fe44cc42ac4 /lib
parent79153869505c9bfb41b7e49b757f233dc19530bb (diff)
Fix for repeats from the API having null source attribution
Diffstat (limited to 'lib')
-rw-r--r--lib/apiaction.php9
-rw-r--r--lib/apiauth.php3
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 59dc47c23..f87b04611 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -63,9 +63,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.
*
@@ -89,6 +92,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 e78de618e..95acbbd7b 100644
--- a/lib/apiauth.php
+++ b/lib/apiauth.php
@@ -54,7 +54,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,
@@ -162,7 +161,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);