*
* @see Widget
*/
-
class AccountSettingsAction extends SettingsAction
{
/**
*
* @return void
*/
-
function showLocalNav()
{
$menu = new AccountSettingsNav($this);
*
* @see HTMLOutputter
*/
-
class AccountSettingsNav extends Widget
{
var $action = null;
*
* @param Action $action current action, used for output
*/
-
function __construct($action=null)
{
parent::__construct($action);
*
* @return void
*/
-
function show()
{
$action_name = $this->action->trimmed('action');
*
* @return nothing
*/
-
function showFeeds()
{
$feeds = $this->getFeeds();
*
* @return nothing
*/
-
function showAside()
{
$this->elementStart('div', array('id' => 'aside_primary',
*
* @return void
*/
-
function showExportData()
{
$feeds = $this->getFeeds();
// TRANS: Secondary navigation menu option leading to contact information on the StatusNet site.
_('Contact'));
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
+ // TRANS: Secondary navigation menu option.
_('Badge'));
Event::handle('EndSecondaryNav', array($this));
}
*
* @return boolean is read only action?
*/
-
function isReadOnly($args)
{
return false;
*
* @return boolean is read only action?
*/
-
function isCacheable()
{
return true;
*
* @return boolean
*/
-
function _hasEtag($etag, $if_none_match)
{
$etags = explode(',', $if_none_match);
*
* @return integer integer value
*/
-
function int($key, $defValue=null, $maxValue=null, $minValue=null)
{
$arg = strtolower($this->trimmed($key));
*
* @return nothing
*/
-
function serverError($msg, $code=500)
{
$action = $this->trimmed('action');
*
* @return nothing
*/
-
function clientError($msg, $code=400)
{
$action = $this->trimmed('action');
*
* @return string current URL
*/
-
function selfUrl()
{
list($action, $args) = $this->returnToArgs();
*
* @return array two elements: action, other args
*/
-
function returnToArgs()
{
$action = $this->trimmed('action');
*
* @return array Feed object to show in head and links
*/
-
function getFeeds()
{
return null;
*
* @return Design a design object to use
*/
-
function getDesign()
{
return Design::siteDesign();
*
* @return void
*/
-
// XXX: Finding this type of check with the same message about 50 times.
// Possible to refactor?
function checkSessionToken()
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class Activity
{
const SPEC = 'http://activitystrea.ms/spec/1.0/';
* @param DOMElement $entry Atom entry to poke at
* @param DOMElement $feed Atom feed, for context
*/
-
function __construct($entry = null, $feed = null)
{
if (is_null($entry)) {
$entry->localName == 'item') {
$this->_fromRssItem($entry, $feed);
} else {
+ // Low level exception. No need for i18n.
throw new Exception("Unknown DOM element: {$entry->namespaceURI} {$entry->localName}");
}
}
*
* @return DOMElement Atom entry
*/
-
function toAtomEntry()
{
return null;
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
* @link http://status.net/
*/
-
class ActivityObject
{
const ARTICLE = 'http://activitystrea.ms/schema/1.0/article';
*
* @param DOMElement $element DOM thing to turn into an Activity thing
*/
-
function __construct($element = null)
{
if (empty($element)) {
}
}
- // @fixme rationalize with Activity::_fromRssItem()
-
+ // @todo FIXME: rationalize with Activity::_fromRssItem()
private function _fromRssItem($item)
{
$this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, Activity::RSS);
$els = $element->childNodes;
foreach ($els as $link) {
-
if (!($link instanceof DOMElement)) {
continue;
}
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
-
$linkRel = $link->getAttribute(self::REL);
$linkType = $link->getAttribute(self::TYPE);
foreach ($els as $link) {
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
-
$linkRel = $link->getAttribute(self::REL);
$linkType = $link->getAttribute(self::TYPE);
$entry = array();
if (Event::handle('StartRssEntryArray', array($notice, &$entry))) {
-
$profile = $notice->getProfile();
// We trim() to avoid extraneous whitespace in the output
$notifications = false;
if ($source->isSubscribed($target)) {
-
$sub = Subscription::pkeyGet(array('subscriber' =>
$source->id, 'subscribed' => $target->id));
function showXmlTimeline($notice)
{
-
$this->initDocument('xml');
$this->elementStart('statuses', array('type' => 'array',
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
function showRssTimeline($notice, $title, $link, $subtitle, $suplink = null, $logo = null, $self = null)
{
-
$this->initDocument('rss');
$this->element('title', null, $title);
function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null, $logo=null)
{
-
$this->initDocument('atom');
$this->element('title', null, $title);
function showRssGroups($group, $title, $link, $subtitle)
{
-
$this->initDocument('rss');
$this->element('title', null, $title);
function getTargetUser($id)
{
if (empty($id)) {
-
// Twitter supports these other ways of passing the user ID
if (is_numeric($this->arg('id'))) {
return User::staticGet($this->arg('id'));
*/
class ApiBareAuthAction extends ApiAuthAction
{
-
/**
* Take arguments for running
*
// Okay, good
return new OAuthToken($at->tok, $at->secret);
}
-
} else {
return null;
}
$rt->tok = $token_key;
$rt->type = $type;
$rt->state = 0;
+
if (!$rt->find(true)) {
// TRANS: Exception thrown when an attempt is made to revoke an unknown token.
throw new Exception(_('Tried to revoke unknown token.'));
}
+
if (!$rt->delete()) {
// TRANS: Exception thrown when an attempt is made to remove a revoked token.
throw new Exception(_('Failed to delete revoked token.'));
$maxDesc = Oauth_application::maxDesc();
if ($maxDesc > 0) {
// TRANS: Form input field instructions.
- $descInstr = sprintf(_('Describe your application in %d characters'),
+ // TRANS: %d is the number of available characters for the description.
+ $descInstr = sprintf(ngettext('Describe your application in %d character','Describe your application in %d characters',$maxDesc),
$maxDesc);
} else {
// TRANS: Form input field instructions.
<?php
-
/**
* StatusNet, the distributed open-source microblogging tool
*
$access = ($this->application->access_type & Oauth_application::$writeAccess)
? $readWriteText : $readOnlyText;
$modifiedDate = common_date_string($appUser->modified);
- // TRANS: Used in application list. %1$s is a modified date, %2$s is access type (read-write or read-only)
+ // TRANS: Used in application list. %1$s is a modified date, %2$s is access type ("read-write" or "read-only")
$txt = sprintf(_('Approved %1$s - "%2$s" access.'),$modifiedDate,$access);
$this->out->raw($txt);
$xs->element('name', null, $name);
} else {
throw new Atom10FeedException(
- 'author element must contain a name element.'
+ _('author element must contain a name element.')
);
}
array_push($this->links, $attrs);
}
-
}
*
* @return void
*/
-
function __construct($user, $cur = null, $indent = true) {
parent::__construct($cur, $indent);
$this->user = $user;
* @see NoticeListItem
* @see ProfileNoticeList
*/
-
class AttachmentList extends Widget
{
/** the current stream of notices being displayed. */
*
* @param Notice $notice stream of notices from DB_DataObject
*/
-
function __construct($notice, $out=null)
{
parent::__construct($out);
*
* @return int count of notices listed.
*/
-
function show()
{
$atts = new File;
*
* @return NoticeListItem a list item for displaying the notice
*/
-
function newListItem($attachment)
{
return new AttachmentListItem($attachment, $this->out);
* @see NoticeList
* @see ProfileNoticeListItem
*/
-
class AttachmentListItem extends Widget
{
/** The attachment this item will show. */
*
* @param Notice $notice The notice we'll display
*/
-
function __construct($attachment, $out=null)
{
parent::__construct($out);
*
* @return void
*/
-
function show()
{
$this->showStart();
*
* @return void
*/
-
function showStart()
{
// XXX: RDFa
*
* @return void
*/
-
function showEnd()
{
$this->out->elementEnd('li');
$this->out->elementEnd('div');
if (!empty($this->oembed->author_name) || !empty($this->oembed->provider)) {
- $this->out->elementStart('div', array('id' => 'oembed_info',
+ $this->out->elementStart('div', array('id' => 'oembed_info',
'class' => 'entry-content'));
if (!empty($this->oembed->author_name)) {
$this->out->elementStart('dl', 'vcard author');
$this->out->raw('<script>window.location = ' . json_encode($this->attachment->url) . ';</script>');
}
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class AttachmentNoticeSection extends NoticeSection
{
function showContent() {
$notice->orderBy('created desc');
$notice->selectAdd('post_id as id');
$notice->find();
- return $notice;
+ return $notice;
}
function title()
return 'popular_notices';
}
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class AttachmentTagCloudSection extends TagCloudSection
{
function title()
return $notice_tag;
}
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
abstract class AuthenticationPlugin extends Plugin
{
//is this plugin authoritative for authentication?
public $authoritative = false;
-
+
//should accounts be automatically created after a successful login attempt?
public $autoregistration = false;
//stop handling of other handlers, because what was requested was done
return false;
}else{
- throw new Exception(_('Password changing failed'));
+ // TRANS: Exception thrown when a password change fails.
+ throw new Exception(_('Password changing failed.'));
}
}else{
if($this->authoritative){
//since we're authoritative, no other plugin could do this
- throw new Exception(_('Password changing failed'));
+ // TRANS: Exception thrown when a password change fails.
+ throw new Exception(_('Password changing failed.'));
}else{
//let another handler try
return null;
}else{
if($this->authoritative){
//since we're authoritative, no other plugin could do this
- throw new Exception(_('Password changing is not allowed'));
+ // TRANS: Exception thrown when a password change attempt fails because it is not allowed.
+ throw new Exception(_('Password changing is not allowed.'));
}
}
}
return true;
}
}
-
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
abstract class AuthorizationPlugin extends Plugin
{
//is this plugin authoritative for authorization?
}
}
}
-
*
* @see UnblockForm
*/
-
class BlockForm extends ProfileActionForm
{
/**
*
* @return string Title of the form, internationalized
*/
-
function title()
{
// TRANS: Title for the form to block a user.
*
* @return string description of the form, internationalized
*/
-
function description()
{
// TRANS: Description of the form to block a user.
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class Cache
{
var $_items = array();
*
* @return Cache cache object
*/
-
static function instance()
{
if (is_null(self::$_inst)) {
*
* @return string full key
*/
-
static function key($extra)
{
$base_key = common_config('cache', 'base');
*
* @return string keyized string
*/
-
static function keyize($str)
{
$str = strtolower($str);
*
* @return string retrieved value or null if unfound
*/
-
function get($key)
{
$value = false;
*
* @return boolean success flag
*/
-
function set($key, $value, $flag=null, $expiry=null)
{
$success = false;
*
* @return boolean success flag
*/
-
function delete($key)
{
$success = false;
*
* @return boolean success flag
*/
-
function reconnect()
{
$success = false;
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+/**
+ * @todo Needs documentation.
+ */
class Channel
{
function on($user)
class XMPPChannel extends Channel
{
-
var $conn = null;
function source()
# depending on what command was run
$this->out->startHTML();
$this->out->elementStart('head');
+ // TRANS: Title for command results.
$this->out->element('title', null, _('Command results'));
$this->out->elementEnd('head');
$this->out->elementStart('body');
{
$this->out->startHTML('text/xml;charset=utf-8');
$this->out->elementStart('head');
+ // TRANS: Title for command results.
$this->out->element('title', null, _('Command results'));
$this->out->elementEnd('head');
$this->out->elementStart('body');
{
$this->out->startHTML('text/xml;charset=utf-8');
$this->out->elementStart('head');
- $this->out->element('title', null, _('Ajax Error'));
+ // TRANS: Title for command results.
+ $this->out->element('title', null, _('AJAX error'));
$this->out->elementEnd('head');
$this->out->elementStart('body');
$this->out->element('p', array('id' => 'error'), $text);
class MailChannel extends Channel
{
-
var $addr = null;
function source()
function output($user, $text)
{
-
$headers['From'] = $user->incomingemail;
$headers['To'] = $this->addr;
+ // TRANS: E-mail subject when a command has completed.
$headers['Subject'] = _('Command complete');
return mail_send(array($this->addr), $headers, $text);
function error($user, $text)
{
-
$headers['From'] = $user->incomingemail;
$headers['To'] = $this->addr;
+ // TRANS: E-mail subject when a command has failed.
$headers['Subject'] = _('Command failed');
return mail_send(array($this->addr), $headers, $text);
<?php
-
/**
* Client error action.
*
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ClientException extends Exception
{
public function __construct($message = null, $code = 400) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
-
class ColumnDef
{
/** name of the column. */
* @param value $extra unused
* @param boolean $auto_increment
*/
-
function __construct($name=null, $type=null, $size=null,
$nullable=true, $key=null, $default=null,
$extra=null, $auto_increment=false)
*
* @return boolean true if equivalent, otherwise false.
*/
-
function equals($other)
{
return ($this->name == $other->name &&
*
* @return boolean true if they're about equivalent
*/
-
private function _typeMatch($other)
{
switch ($this->type) {
*
* @return boolean true if defaults are effectively the same.
*/
-
private function _defaultMatch($other)
{
return ((is_null($this->default) && is_null($other->default)) ||
*
* @return boolean true if these columns 'null' the same.
*/
-
private function _nullMatch($other)
{
return ((!is_null($this->default) && !is_null($other->default) &&
class Command
{
-
var $user = null;
function __construct($user=null)
}
}
-
/**
* Override this with the meat!
*
// TRANS: Text shown when a notice has been marked as favourite successfully.
$channel->output($this->user, _('Notice marked as fave.'));
}
-
}
class JoinCommand extends Command
$cur->nickname,
$group->nickname));
}
-
}
+
class DropCommand extends Command
{
var $other = null;
$cur->nickname,
$group->nickname));
}
-
}
class WhoisCommand extends Command
throw $e;
}
// TRANS: Command exception text shown when trying to send a direct message to a remote user (a user not registered at the current server).
+ // TRANS: %s is a remote profile.
throw new CommandException(sprintf(_('%s is a remote profile; you can only send direct messages to users on the same server.'), $this->other));
}
class GetCommand extends Command
{
-
var $other = null;
function __construct($user, $other)
class SubCommand extends Command
{
-
var $other = null;
function __construct($user, $other)
class UnsubCommand extends Command
{
-
var $other = null;
function __construct($user, $other)
class OffCommand extends Command
{
var $other = null;
+
function __construct($user, $other=null)
{
parent::__construct($user);
return false;
}
}
-
+
/**
* Split arguments without triggering a PHP notice warning
*/
return $pieces;
}
}
-
} catch (NoConfigException $e) {
// XXX: Throw a conniption if database not installed
// XXX: Find a way to use htmlwriter for this instead of handcoded markup
+ // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
echo '<p>'. _('No configuration file found. ') .'</p>';
- echo '<p>'. _('I looked for configuration files in the following places: ') .'<br/> ';
- echo implode($e->configFiles, '<br/>');
+ // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
+ // TRANS: Is followed by a list of directories (separated by HTML breaks).
+ echo '<p>'. _('I looked for configuration files in the following places: ') .'<br /> ';
+ echo implode($e->configFiles, '<br />');
+ // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
echo '<p>'. _('You may wish to run the installer to fix this.') .'</p>';
+ // @todo FIXME Link should be in a para?
+ // TRANS: Error message displayed when no configuration file was found for a StatusNet installation.
+ // TRANS: The text is link text that leads to the installer page.
echo '<a href="install.php">'. _('Go to the installer.') .'</a>';
exit;
}
-
*
* @see Widget
*/
-
class ConnectSettingsAction extends SettingsAction
{
/**
*
* @return void
*/
-
function showLocalNav()
{
$menu = new ConnectSettingsNav($this);
*
* @see HTMLOutputter
*/
-
class ConnectSettingsNav extends Widget
{
var $action = null;
*
* @param Action $action current action, used for output
*/
-
function __construct($action=null)
{
parent::__construct($action);
*
* @return void
*/
-
function show()
{
$action_name = $this->action->trimmed('action');
$menu = array();
if (common_config('xmpp', 'enabled')) {
$menu['imsettings'] =
- array(_('IM'),
+ // TRANS: Menu item for Instant Messaging settings.
+ array(_m('MENU','IM'),
+ // TRANS: Tooltip for Instant Messaging menu item.
_('Updates by instant messenger (IM)'));
}
if (common_config('sms', 'enabled')) {
$menu['smssettings'] =
- array(_('SMS'),
+ // TRANS: Menu item for Short Message Service settings.
+ array(_m('MENU','SMS'),
+ // TRANS: Tooltip for Short Message Service menu item.
_('Updates by SMS'));
}
-
+
$menu['oauthconnectionssettings'] = array(
- _('Connections'),
+ // TRANS: Menu item for OAth connection settings.
+ _m('MENU','Connections'),
+ // TRANS: Tooltip for connected applications (Connections through OAth) menu item.
_('Authorized connected applications')
);
$this->action->elementEnd('ul');
}
-
}
-
* @link http://status.net/
*
*/
-
class CurrentUserDesignAction extends Action
{
/**
*
* @return Design a design object to use
*/
-
function getDesign()
{
$cur = common_current_user();