Fix for repeats from the API having null source attribution

This commit is contained in:
Zach Copley
2010-05-07 16:32:24 -07:00
parent d57e1deaec
commit 3c9686e80f
5 changed files with 11 additions and 23 deletions

View File

@@ -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;
}