summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-05-07 16:32:24 -0700
committerZach Copley <zach@status.net>2010-05-07 16:32:24 -0700
commit3c9686e80f50f24f302abf5dd27b74a44fa4ae56 (patch)
tree72b1a7e0c9a817b80110e49b99c79ed615f911ca
parentd57e1deaec7406c63f70b8a5664746d18c1125ff (diff)
Fix for repeats from the API having null source attribution
-rw-r--r--actions/apidirectmessagenew.php8
-rw-r--r--actions/apistatusesretweet.php2
-rw-r--r--actions/apistatusesupdate.php12
-rw-r--r--lib/apiaction.php9
-rw-r--r--lib/apiauth.php3
5 files changed, 11 insertions, 23 deletions
diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php
index b9ac92d77..65d065648 100644
--- a/actions/apidirectmessagenew.php
+++ b/actions/apidirectmessagenew.php
@@ -52,7 +52,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
class ApiDirectMessageNewAction extends ApiAuthAction
{
- var $source = null;
var $other = null;
var $content = null;
@@ -76,13 +75,6 @@ class ApiDirectMessageNewAction extends ApiAuthAction
return;
}
- $this->source = $this->trimmed('source'); // Not supported by Twitter.
-
- $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api');
- if (empty($this->source) || in_array($this->source, $reserved_sources)) {
- $source = 'api';
- }
-
$this->content = $this->trimmed('text');
$this->user = $this->auth_user;
diff --git a/actions/apistatusesretweet.php b/actions/apistatusesretweet.php
index 128c881e2..9aa337485 100644
--- a/actions/apistatusesretweet.php
+++ b/actions/apistatusesretweet.php
@@ -79,7 +79,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
$this->user = $this->auth_user;
- if ($this->user->id == $notice->profile_id) {
+ if ($this->user->id == $this->original->profile_id) {
$this->clientError(_('Cannot repeat your own notice.'),
400, $this->format);
return false;
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index 5f3a447c2..a0a81f336 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -155,8 +155,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
var $lat = null;
var $lon = null;
- static $reserved_sources = array('web', 'omb', 'mail', 'xmpp', 'api');
-
/**
* Take arguments for running
*
@@ -171,19 +169,9 @@ class ApiStatusesUpdateAction extends ApiAuthAction
parent::prepare($args);
$this->status = $this->trimmed('status');
- $this->source = $this->trimmed('source');
$this->lat = $this->trimmed('lat');
$this->lon = $this->trimmed('long');
- // try to set the source attr from OAuth app
- if (empty($this->source)) {
- $this->source = $this->oauth_source;
- }
-
- if (empty($this->source) || in_array($this->source, self::$reserved_sources)) {
- $this->source = 'api';
- }
-
$this->in_reply_to_status_id
= intval($this->trimmed('in_reply_to_status_id'));
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);