* update/add translator documentation
* remove superfluous whitespace
This commit is contained in:
parent
d6be5be548
commit
8c94ebf537
|
@ -840,6 +840,9 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$this->elementStart('dd', null);
|
$this->elementStart('dd', null);
|
||||||
if (common_config('site', 'broughtby')) {
|
if (common_config('site', 'broughtby')) {
|
||||||
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set.
|
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set.
|
||||||
|
// TRANS: Text between [] is a link description, text between () is the link itself.
|
||||||
|
// TRANS: Make sure there is no whitespace between "]" and "(".
|
||||||
|
// TRANS: "%%site.broughtby%%" is the value of the variable site.broughtby
|
||||||
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).');
|
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).');
|
||||||
} else {
|
} else {
|
||||||
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set.
|
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set.
|
||||||
|
@ -847,6 +850,9 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
}
|
}
|
||||||
$instr .= ' ';
|
$instr .= ' ';
|
||||||
// TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license.
|
// TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license.
|
||||||
|
// TRANS: Make sure there is no whitespace between "]" and "(".
|
||||||
|
// TRANS: Text between [] is a link description, text between () is the link itself.
|
||||||
|
// TRANS: %s is the version of StatusNet that is being used.
|
||||||
$instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
|
$instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
|
||||||
$output = common_markup_to_html($instr);
|
$output = common_markup_to_html($instr);
|
||||||
$this->raw($output);
|
$this->raw($output);
|
||||||
|
@ -893,7 +899,8 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
'width' => '80',
|
'width' => '80',
|
||||||
'height' => '15'));
|
'height' => '15'));
|
||||||
$this->text(' ');
|
$this->text(' ');
|
||||||
// TRANS: license message in footer. %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
|
// TRANS: license message in footer.
|
||||||
|
// TRANS: %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
|
||||||
$notice = _('All %1$s content and data are available under the %2$s license.');
|
$notice = _('All %1$s content and data are available under the %2$s license.');
|
||||||
$link = "<a class=\"license\" rel=\"external license\" href=\"" .
|
$link = "<a class=\"license\" rel=\"external license\" href=\"" .
|
||||||
htmlspecialchars(common_config('license', 'url')) .
|
htmlspecialchars(common_config('license', 'url')) .
|
||||||
|
@ -1304,6 +1311,7 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
// CSRF protection
|
// CSRF protection
|
||||||
$token = $this->trimmed('token');
|
$token = $this->trimmed('token');
|
||||||
if (empty($token) || $token != common_session_token()) {
|
if (empty($token) || $token != common_session_token()) {
|
||||||
|
// TRANS: Client error text when there is a problem with the session token.
|
||||||
$this->clientError(_('There was a problem with your session token.'));
|
$this->clientError(_('There was a problem with your session token.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,4 +387,3 @@ class Activity
|
||||||
return ActivityUtils::child($element, $tag, $namespace);
|
return ActivityUtils::child($element, $tag, $namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ class ActivityContext
|
||||||
|
|
||||||
$attention = array();
|
$attention = array();
|
||||||
for ($i = 0; $i < $links->length; $i++) {
|
for ($i = 0; $i < $links->length; $i++) {
|
||||||
|
|
||||||
$link = $links->item($i);
|
$link = $links->item($i);
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(ActivityUtils::REL);
|
$linkRel = $link->getAttribute(ActivityUtils::REL);
|
||||||
|
|
|
@ -168,7 +168,6 @@ class ActivityObject
|
||||||
ActivityObject::MEDIA_DESCRIPTION,
|
ActivityObject::MEDIA_DESCRIPTION,
|
||||||
Activity::MEDIA
|
Activity::MEDIA
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +417,6 @@ class ActivityObject
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($sizes as $size) {
|
foreach ($sizes as $size) {
|
||||||
|
|
||||||
$alink = null;
|
$alink = null;
|
||||||
$avatar = $profile->getAvatar($size);
|
$avatar = $profile->getAvatar($size);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ActivityUtils
|
class ActivityUtils
|
||||||
{
|
{
|
||||||
const ATOM = 'http://www.w3.org/2005/Atom';
|
const ATOM = 'http://www.w3.org/2005/Atom';
|
||||||
|
@ -66,7 +65,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string related link, if any
|
* @return string related link, if any
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getPermalink($element)
|
static function getPermalink($element)
|
||||||
{
|
{
|
||||||
return self::getLink($element, 'alternate', 'text/html');
|
return self::getLink($element, 'alternate', 'text/html');
|
||||||
|
@ -79,7 +77,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string related link, if any
|
* @return string related link, if any
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getLink(DOMNode $element, $rel, $type=null)
|
static function getLink(DOMNode $element, $rel, $type=null)
|
||||||
{
|
{
|
||||||
$els = $element->childNodes;
|
$els = $element->childNodes;
|
||||||
|
@ -135,7 +132,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return DOMElement found element or null
|
* @return DOMElement found element or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function child(DOMNode $element, $tag, $namespace=self::ATOM)
|
static function child(DOMNode $element, $tag, $namespace=self::ATOM)
|
||||||
{
|
{
|
||||||
$els = $element->childNodes;
|
$els = $element->childNodes;
|
||||||
|
@ -160,7 +156,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string content of the child
|
* @return string content of the child
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function childContent(DOMNode $element, $tag, $namespace=self::ATOM)
|
static function childContent(DOMNode $element, $tag, $namespace=self::ATOM)
|
||||||
{
|
{
|
||||||
$el = self::child($element, $tag, $namespace);
|
$el = self::child($element, $tag, $namespace);
|
||||||
|
@ -194,7 +189,6 @@ class ActivityUtils
|
||||||
* @todo handle embedded XML mime types
|
* @todo handle embedded XML mime types
|
||||||
* @todo handle base64-encoded non-XML and non-text mime types
|
* @todo handle base64-encoded non-XML and non-text mime types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getContent($element)
|
static function getContent($element)
|
||||||
{
|
{
|
||||||
return self::childHtmlContent($element, self::CONTENT, self::ATOM);
|
return self::childHtmlContent($element, self::CONTENT, self::ATOM);
|
||||||
|
@ -205,6 +199,7 @@ class ActivityUtils
|
||||||
$src = $el->getAttribute(self::SRC);
|
$src = $el->getAttribute(self::SRC);
|
||||||
|
|
||||||
if (!empty($src)) {
|
if (!empty($src)) {
|
||||||
|
// TRANS: Client exception thrown when there is no source attribute.
|
||||||
throw new ClientException(_("Can't handle remote content yet."));
|
throw new ClientException(_("Can't handle remote content yet."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +236,12 @@ class ActivityUtils
|
||||||
return trim($text);
|
return trim($text);
|
||||||
} else if (in_array($type, array('text/xml', 'application/xml')) ||
|
} else if (in_array($type, array('text/xml', 'application/xml')) ||
|
||||||
preg_match('#(+|/)xml$#', $type)) {
|
preg_match('#(+|/)xml$#', $type)) {
|
||||||
|
// TRANS: Client exception thrown when there embedded XML content is found that cannot be processed yet.
|
||||||
throw new ClientException(_("Can't handle embedded XML content yet."));
|
throw new ClientException(_("Can't handle embedded XML content yet."));
|
||||||
} else if (strncasecmp($type, 'text/', 5)) {
|
} else if (strncasecmp($type, 'text/', 5)) {
|
||||||
return $el->textContent;
|
return $el->textContent;
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Client exception thrown when base64 encoded content is found that cannot be processed yet.
|
||||||
throw new ClientException(_("Can't handle embedded Base64 content yet."));
|
throw new ClientException(_("Can't handle embedded Base64 content yet."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ActivityVerb
|
class ActivityVerb
|
||||||
{
|
{
|
||||||
const POST = 'http://activitystrea.ms/schema/1.0/post';
|
const POST = 'http://activitystrea.ms/schema/1.0/post';
|
||||||
|
|
|
@ -45,7 +45,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
*
|
*
|
||||||
* @see Form
|
* @see Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminForm extends Form
|
class AdminForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +58,6 @@ class AdminForm extends Form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function input($setting, $title, $instructions, $section='site')
|
function input($setting, $title, $instructions, $section='site')
|
||||||
{
|
{
|
||||||
$this->out->input($setting, $title, $this->value($setting, $section), $instructions);
|
$this->out->input($setting, $title, $this->value($setting, $section), $instructions);
|
||||||
|
@ -73,7 +71,6 @@ class AdminForm extends Form
|
||||||
*
|
*
|
||||||
* @return string param value if posted, or current config value
|
* @return string param value if posted, or current config value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function value($setting, $main='site')
|
function value($setting, $main='site')
|
||||||
{
|
{
|
||||||
$value = $this->out->trimmed($setting);
|
$value = $this->out->trimmed($setting);
|
||||||
|
|
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @todo Find some commonalities with SettingsAction and combine
|
* @todo Find some commonalities with SettingsAction and combine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminPanelAction extends Action
|
class AdminPanelAction extends Action
|
||||||
{
|
{
|
||||||
var $success = true;
|
var $success = true;
|
||||||
|
@ -61,7 +60,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -124,7 +122,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
@ -155,7 +152,6 @@ class AdminPanelAction extends Action
|
||||||
* @return void
|
* @return void
|
||||||
* @see AdminPanelNav
|
* @see AdminPanelNav
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$nav = new AdminPanelNav($this);
|
$nav = new AdminPanelNav($this);
|
||||||
|
@ -169,7 +165,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void.
|
* @return void.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
$this->showForm();
|
$this->showForm();
|
||||||
|
@ -199,7 +194,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showPageNotice()
|
function showPageNotice()
|
||||||
{
|
{
|
||||||
if ($this->msg) {
|
if ($this->msg) {
|
||||||
|
@ -222,7 +216,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showForm()
|
function showForm()
|
||||||
{
|
{
|
||||||
// TRANS: Client error message.
|
// TRANS: Client error message.
|
||||||
|
@ -239,7 +232,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
|
@ -252,7 +244,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
// TRANS: Client error message
|
// TRANS: Client error message
|
||||||
|
@ -267,7 +258,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return mixed $result false if something didn't work
|
* @return mixed $result false if something didn't work
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteSetting($section, $setting)
|
function deleteSetting($section, $setting)
|
||||||
{
|
{
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
@ -314,7 +304,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @see Widget
|
* @see Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminPanelNav extends Widget
|
class AdminPanelNav extends Widget
|
||||||
{
|
{
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
@ -324,7 +313,6 @@ class AdminPanelNav extends Widget
|
||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($action=null)
|
function __construct($action=null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
parent::__construct($action);
|
||||||
|
@ -336,7 +324,6 @@ class AdminPanelNav extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$action_name = $this->action->trimmed('action');
|
$action_name = $this->action->trimmed('action');
|
||||||
|
@ -413,5 +400,4 @@ class AdminPanelNav extends Widget
|
||||||
}
|
}
|
||||||
$this->action->elementEnd('ul');
|
$this->action->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAction extends Action
|
class ApiAction extends Action
|
||||||
{
|
{
|
||||||
const READ_ONLY = 1;
|
const READ_ONLY = 1;
|
||||||
|
@ -139,7 +138,6 @@ class ApiAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean false if user doesn't exist
|
* @return boolean false if user doesn't exist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
StatusNet::setApi(true); // reduce exception reports to aid in debugging
|
StatusNet::setApi(true); // reduce exception reports to aid in debugging
|
||||||
|
@ -172,7 +170,6 @@ class ApiAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
@ -862,7 +859,6 @@ class ApiAction extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->endDocument('atom');
|
$this->endDocument('atom');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRssGroups($group, $title, $link, $subtitle)
|
function showRssGroups($group, $title, $link, $subtitle)
|
||||||
|
@ -1015,7 +1011,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showAtomGroups($group, $title, $id, $link, $subtitle=null, $selfuri=null)
|
function showAtomGroups($group, $title, $id, $link, $subtitle=null, $selfuri=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('atom');
|
$this->initDocument('atom');
|
||||||
|
|
||||||
$this->element('title', null, common_xml_safe_str($title));
|
$this->element('title', null, common_xml_safe_str($title));
|
||||||
|
@ -1046,7 +1041,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonTimeline($notice)
|
function showJsonTimeline($notice)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$statuses = array();
|
$statuses = array();
|
||||||
|
@ -1072,7 +1066,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonGroups($group)
|
function showJsonGroups($group)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
@ -1118,7 +1111,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showTwitterXmlUsers($user)
|
function showTwitterXmlUsers($user)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('xml');
|
$this->initDocument('xml');
|
||||||
$this->elementStart('users', array('type' => 'array',
|
$this->elementStart('users', array('type' => 'array',
|
||||||
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
||||||
|
@ -1141,7 +1133,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonUsers($user)
|
function showJsonUsers($user)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$users = array();
|
$users = array();
|
||||||
|
@ -1226,7 +1217,6 @@ class ApiAction extends Action
|
||||||
$this->endXML();
|
$this->endXML();
|
||||||
break;
|
break;
|
||||||
case 'json':
|
case 'json':
|
||||||
|
|
||||||
// Check for JSONP callback
|
// Check for JSONP callback
|
||||||
if (isset($this->callback)) {
|
if (isset($this->callback)) {
|
||||||
print ')';
|
print ')';
|
||||||
|
@ -1483,7 +1473,6 @@ class ApiAction extends Action
|
||||||
*/
|
*/
|
||||||
function arg($key, $def=null)
|
function arg($key, $def=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// XXX: Do even more input validation/scrubbing?
|
// XXX: Do even more input validation/scrubbing?
|
||||||
|
|
||||||
if (array_key_exists($key, $this->args)) {
|
if (array_key_exists($key, $this->args)) {
|
||||||
|
@ -1550,5 +1539,4 @@ class ApiAction extends Action
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,6 @@ require_once INSTALLDIR . '/lib/apioauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAuthAction extends ApiAction
|
class ApiAuthAction extends ApiAction
|
||||||
{
|
{
|
||||||
var $auth_user_nickname = null;
|
var $auth_user_nickname = null;
|
||||||
|
@ -83,7 +82,6 @@ class ApiAuthAction extends ApiAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -126,7 +124,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return mixed the OAuthRequest or false
|
* @return mixed the OAuthRequest or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getOAuthRequest()
|
function getOAuthRequest()
|
||||||
{
|
{
|
||||||
ApiOauthAction::cleanRequest();
|
ApiOauthAction::cleanRequest();
|
||||||
|
@ -154,7 +151,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkOAuthRequest($request)
|
function checkOAuthRequest($request)
|
||||||
{
|
{
|
||||||
$datastore = new ApiStatusNetOAuthDataStore();
|
$datastore = new ApiStatusNetOAuthDataStore();
|
||||||
|
@ -164,7 +160,6 @@ class ApiAuthAction extends ApiAction
|
||||||
$server->add_signature_method($hmac_method);
|
$server->add_signature_method($hmac_method);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$server->verify_request($request);
|
$server->verify_request($request);
|
||||||
|
|
||||||
$consumer = $request->get_parameter('oauth_consumer_key');
|
$consumer = $request->get_parameter('oauth_consumer_key');
|
||||||
|
@ -176,7 +171,8 @@ class ApiAuthAction extends ApiAction
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
'Couldn\'t find the OAuth app for consumer key: ' .
|
'Couldn\'t find the OAuth app for consumer key: ' .
|
||||||
$consumer);
|
$consumer);
|
||||||
throw new OAuthException('No application for that consumer key.');
|
// TRANS: OAuth exception thrown when no application is found for a given consumer key.
|
||||||
|
throw new OAuthException(_('No application for that consumer key.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the source attr
|
// set the source attr
|
||||||
|
@ -186,19 +182,15 @@ class ApiAuthAction extends ApiAction
|
||||||
$appUser = Oauth_application_user::staticGet('token', $access_token);
|
$appUser = Oauth_application_user::staticGet('token', $access_token);
|
||||||
|
|
||||||
if (!empty($appUser)) {
|
if (!empty($appUser)) {
|
||||||
|
|
||||||
// If access_type == 0 we have either a request token
|
// If access_type == 0 we have either a request token
|
||||||
// or a bad / revoked access token
|
// or a bad / revoked access token
|
||||||
|
|
||||||
if ($appUser->access_type != 0) {
|
if ($appUser->access_type != 0) {
|
||||||
|
|
||||||
// Set the access level for the api call
|
// Set the access level for the api call
|
||||||
|
|
||||||
$this->access = ($appUser->access_type & Oauth_application::$writeAccess)
|
$this->access = ($appUser->access_type & Oauth_application::$writeAccess)
|
||||||
? self::READ_WRITE : self::READ_ONLY;
|
? self::READ_WRITE : self::READ_ONLY;
|
||||||
|
|
||||||
// Set the auth user
|
// Set the auth user
|
||||||
|
|
||||||
if (Event::handle('StartSetApiUser', array(&$user))) {
|
if (Event::handle('StartSetApiUser', array(&$user))) {
|
||||||
$this->auth_user = User::staticGet('id', $appUser->profile_id);
|
$this->auth_user = User::staticGet('id', $appUser->profile_id);
|
||||||
Event::handle('EndSetApiUser', array($user));
|
Event::handle('EndSetApiUser', array($user));
|
||||||
|
@ -216,13 +208,13 @@ class ApiAuthAction extends ApiAction
|
||||||
'read-write' : 'read-only'
|
'read-write' : 'read-only'
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
throw new OAuthException('Bad access token.');
|
// TRANS: OAuth exception given when an incorrect access token was given for a user.
|
||||||
|
throw new OAuthException(_('Bad access token.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Also should not happen
|
// Also should not happen
|
||||||
|
// TRANS: OAuth exception given when no user was found for a given token (no token was found).
|
||||||
throw new OAuthException('No user for that token.');
|
throw new OAuthException(_('No user for that token.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (OAuthException $e) {
|
} catch (OAuthException $e) {
|
||||||
|
@ -237,7 +229,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresAuth()
|
function requiresAuth()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,7 +240,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkBasicAuthUser($required = true)
|
function checkBasicAuthUser($required = true)
|
||||||
{
|
{
|
||||||
$this->basicAuthProcessHeader();
|
$this->basicAuthProcessHeader();
|
||||||
|
@ -264,8 +254,8 @@ class ApiAuthAction extends ApiAction
|
||||||
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
||||||
|
|
||||||
// show error if the user clicks 'cancel'
|
// show error if the user clicks 'cancel'
|
||||||
|
// TRANS: Client error thrown when authentication fails becaus a user clicked "Cancel".
|
||||||
$this->clientError("Could not authenticate you.", 401, $this->format);
|
$this->clientError(_("Could not authenticate you."), 401, $this->format);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -283,13 +273,11 @@ class ApiAuthAction extends ApiAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, basic auth users have rw access
|
// By default, basic auth users have rw access
|
||||||
|
|
||||||
$this->access = self::READ_WRITE;
|
$this->access = self::READ_WRITE;
|
||||||
|
|
||||||
if (empty($this->auth_user) && ($required || isset($_SERVER['PHP_AUTH_USER']))) {
|
if (empty($this->auth_user) && ($required || isset($_SERVER['PHP_AUTH_USER']))) {
|
||||||
|
|
||||||
// basic authentication failed
|
// basic authentication failed
|
||||||
|
|
||||||
list($proxy, $ip) = common_client_ip();
|
list($proxy, $ip) = common_client_ip();
|
||||||
|
|
||||||
$msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' .
|
$msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' .
|
||||||
|
@ -298,7 +286,8 @@ class ApiAuthAction extends ApiAction
|
||||||
$proxy,
|
$proxy,
|
||||||
$ip);
|
$ip);
|
||||||
common_log(LOG_WARNING, $msg);
|
common_log(LOG_WARNING, $msg);
|
||||||
$this->clientError("Could not authenticate you.", 401, $this->format);
|
// TRANS: Client error thrown when authentication fails.
|
||||||
|
$this->clientError(_("Could not authenticate you."), 401, $this->format);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,7 +299,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function basicAuthProcessHeader()
|
function basicAuthProcessHeader()
|
||||||
{
|
{
|
||||||
$authHeaders = array('AUTHORIZATION',
|
$authHeaders = array('AUTHORIZATION',
|
||||||
|
@ -332,7 +320,6 @@ class ApiAuthAction extends ApiAction
|
||||||
|
|
||||||
// Decode the HTTP_AUTHORIZATION header on php-cgi server self
|
// Decode the HTTP_AUTHORIZATION header on php-cgi server self
|
||||||
// on fcgid server the header name is AUTHORIZATION
|
// on fcgid server the header name is AUTHORIZATION
|
||||||
|
|
||||||
$auth_hash = base64_decode(substr($authorization_header, 6));
|
$auth_hash = base64_decode(substr($authorization_header, 6));
|
||||||
list($this->auth_user_nickname,
|
list($this->auth_user_nickname,
|
||||||
$this->auth_user_password) = explode(':', $auth_hash);
|
$this->auth_user_password) = explode(':', $auth_hash);
|
||||||
|
|
|
@ -64,6 +64,7 @@ class AttachmentNoticeSection extends NoticeSection
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title.
|
||||||
return _('Notices where this attachment appears');
|
return _('Notices where this attachment appears');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ class AttachmentTagCloudSection extends TagCloudSection
|
||||||
{
|
{
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title.
|
||||||
return _('Tags for this attachment');
|
return _('Tags for this attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user