We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 31c11779 authored by Shashi Gowda's avatar Shashi Gowda

Merge branch '1.0.x' into people_tags_rebase

Conflicts:
	EVENTS.txt
	actions/peopletag.php
	actions/tagother.php
	classes/Notice.php
	js/util.js
	js/util.min.js
	lib/accountprofileblock.php
	lib/action.php
	lib/activityobject.php
	lib/command.php
	lib/personalgroupnav.php
	plugins/OStatus/OStatusPlugin.php
parents 894d4ba1 0a71622a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -1265,3 +1265,27 @@ StartProfileListItemTags: when showing people tags in a profile list item widget
EndProfileListItemTags: after showing people tags in a profile list item widget
- $widget: ProfileListItem widget
StartActivityObjectOutputAtom: Called at start of Atom XML output generation for ActivityObject chunks, just inside the <activity:object>. Cancel the event to take over its output completely (you're responsible for calling the matching End event if so)
- $obj: ActivityObject
- $out: XMLOutputter to append custom output
EndActivityObjectOutputAtom: Called at end of Atom XML output generation for ActivityObject chunks, just inside the </activity:object>
- $obj: ActivityObject
- $out: XMLOutputter to append custom output
StartActivityObjectOutputJson: Called at start of JSON output generation for ActivityObject chunks: the array has not yet been filled out. Cancel the event to take over its output completely (you're responsible for calling the matching End event if so)
- $obj ActivityObject
- &$out: array to be serialized; you're free to modify it
EndActivityObjectOutputJson: Called at end of JSON output generation for ActivityObject chunks: the array has not yet been filled out.
- $obj ActivityObject
- &$out: array to be serialized; you're free to modify it
StartNoticeWhoGets: Called at start of inbox delivery prep; plugins can schedule notices to go to particular profiles that would otherwise not have reached them. Canceling will take over the entire addressing operation. Be aware that output can be cached or used several times, so should remain idempotent.
- $notice Notice
- &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc
EndNoticeWhoGets: Called at end of inbox delivery prep; plugins can filter out profiles from receiving inbox delivery here. Be aware that output can be cached or used several times, so should remain idempotent.
- $notice Notice
- &$ni: in/out array mapping profile IDs to constants: NOTICE_INBOX_SOURCE_SUB etc
......@@ -127,12 +127,6 @@ class AllAction extends ProfileAction
);
}
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
$nav->show();
}
function showEmptyListMessage()
{
// TRANS: Empty list message. %s is a user nickname.
......
......@@ -100,7 +100,7 @@ class ApiGroupListAction extends ApiBareAuthAction
);
$subtitle = sprintf(
// TRANS: Used as subtitle in check for group membership. %1$s is a user name, %2$s is the site name.
// TRANS: Used as subtitle in check for group membership. %1$s is the site name, %2$s is a user name.
_('%1$s groups %2$s is a member of.'),
$sitename,
$this->user->nickname
......
......@@ -42,10 +42,8 @@ require_once INSTALLDIR . '/lib/apiauth.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ApiGroupProfileUpdateAction extends ApiAuthAction
{
/**
* Take arguments for running
*
......@@ -54,7 +52,6 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
......@@ -82,7 +79,6 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
......@@ -97,6 +93,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(
// TRANS: Client error displayed when using an unsupported API format.
_('API method not found.'),
404,
$this->format
......@@ -105,16 +102,19 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
}
if (empty($this->user)) {
// TRANS: Client error displayed when not providing a user or an invalid user.
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
if (empty($this->group)) {
// TRANS: Client error displayed when not providing a group or an invalid group.
$this->clientError(_('Group not found.'), 404, $this->format);
return false;
}
if (!$this->user->isAdmin($this->group)) {
// TRANS: Client error displayed when trying to edit a group without being an admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
......@@ -168,15 +168,15 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
if (!$result) {
common_log_db_error($this->group, 'UPDATE', __FILE__);
// TRANS: Server error displayed when group update fails.
$this->serverError(_('Could not update group.'));
}
$aliases = array();
try {
if (!empty($this->aliasstring)) {
$aliases = $this->validateAliases();
if (!empty($this->aliasstring)) {
$aliases = $this->validateAliases();
}
} catch (ApiValidationException $ave) {
......@@ -191,6 +191,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
$result = $this->group->setAliases($aliases);
if (!$result) {
// TRANS: Server error displayed when adding group aliases fails.
$this->serverError(_('Could not create aliases.'));
}
......@@ -210,6 +211,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
$this->showSingleJsonGroup($this->group);
break;
default:
// TRANS: Client error displayed when using an unsupported API format.
$this->clientError(_('API method not found.'), 404, $this->format);
break;
}
......@@ -245,17 +247,17 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
)
) {
throw new ApiValidationException(
_(
'Nickname must have only lowercase letters ' .
'and numbers and no spaces.'
)
// TRANS: API validation exception thrown when nickname does not validate.
_('Nickname must have only lowercase letters and numbers and no spaces.')
);
} else if ($this->nicknameExists($this->nickname)) {
throw new ApiValidationException(
// TRANS: API validation exception thrown when nickname is already used.
_('Nickname already in use. Try another one.')
);
} else if (!User_group::allowedNickname($this->nickname)) {
throw new ApiValidationException(
// TRANS: API validation exception thrown when nickname does not validate.
_('Not a valid nickname.')
);
}
......@@ -274,6 +276,7 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
)
) {
throw new ApiValidationException(
// TRANS: API validation exception thrown when homepage URL does not validate.
_('Homepage is not a valid URL.')
);
}
......@@ -283,7 +286,8 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
{
if (!is_null($this->fullname) && mb_strlen($this->fullname) > 255) {
throw new ApiValidationException(
_('Full name is too long (max 255 chars).')
// TRANS: API validation exception thrown when full name does not validate.
_('Full name is too long (maximum 255 characters).')
);
}
}
......@@ -291,12 +295,12 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
function validateDescription()
{
if (User_group::descriptionTooLong($this->description)) {
throw new ApiValidationException(
sprintf(
_('description is too long (max %d chars).'),
User_group::maxDescription()
)
);
// TRANS: API validation exception thrown when description does not validate.
// TRANS: %d is the maximum description length and used for plural.
throw new ApiValidationException(sprintf(_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
User_group::maxDescription()),
User_group::maxDescription()));
}
}
......@@ -304,7 +308,8 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
{
if (!is_null($this->location) && mb_strlen($this->location) > 255) {
throw new ApiValidationException(
_('Location is too long (max 255 chars).')
// TRANS: API validation exception thrown when location does not validate.
_('Location is too long (maximum 255 characters).')
);
}
}
......@@ -321,12 +326,12 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
);
if (count($aliases) > common_config('group', 'maxaliases')) {
throw new ApiValidationException(
sprintf(
_('Too many aliases! Maximum %d.'),
common_config('group', 'maxaliases')
)
);
// TRANS: API validation exception thrown when aliases do not validate.
// TRANS: %d is the maximum number of aliases and used for plural.
throw new ApiValidationException(sprintf(_m('Too many aliases! Maximum %d allowed.',
'Too many aliases! Maximum %d allowed.',
common_config('group', 'maxaliases')),
common_config('group', 'maxaliases')));
}
foreach ($aliases as $alias) {
......@@ -339,7 +344,9 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
) {
throw new ApiValidationException(
sprintf(
_('Invalid alias: "%s"'),
// TRANS: API validation exception thrown when aliases does not validate.
// TRANS: %s is the invalid alias.
_('Invalid alias: "%s".'),
$alias
)
);
......@@ -348,6 +355,8 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
if ($this->nicknameExists($alias)) {
throw new ApiValidationException(
sprintf(
// TRANS: API validation exception thrown when aliases is already used.
// TRANS: %s is the already used alias.
_('Alias "%s" already in use. Try another one.'),
$alias)
);
......@@ -356,12 +365,12 @@ class ApiGroupProfileUpdateAction extends ApiAuthAction
// XXX assumes alphanum nicknames
if (strcmp($alias, $this->nickname) == 0) {
throw new ApiValidationException(
_('Alias can\'t be the same as nickname.')
// TRANS: API validation exception thrown when alias is the same as nickname.
_('Alias cannot be the same as nickname.')
);
}
}
return $aliases;
}
}
\ No newline at end of file
}
......@@ -95,6 +95,9 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
$subtitle = sprintf(
// @todo FIXME: $profile is not defined.
// TRANS: Subtitle for API action that shows most recent notices that are repeats in user's inbox.
// TRANS: %1$s is the sitename, %2$s is a user nickname, %3$s is a user profile name.
_('%1$s notices that were to repeated to %2$s / %3$s.'),
$sitename, $this->user->nickname, $profile->getBestName()
);
......
......@@ -322,8 +322,11 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$this->clientError(_('Atom post must not be empty.'));
}
$dom = DOMDocument::loadXML($xml);
if (!$dom) {
$old = error_reporting(error_reporting() & ~(E_WARNING | E_NOTICE));
$dom = new DOMDocument();
$ok = $dom->loadXML($xml);
error_reporting($old);
if (!$ok) {
// TRANS: Client error displayed attempting to post an API that is not well-formed XML.
$this->clientError(_('Atom post must be well-formed XML.'));
}
......
......@@ -256,7 +256,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
if (empty($notice)) {
// XXX: import from listed URL or something
// TRANS: Client exception thrown when trying favorite a notice without content.
throw new ClientException(_('Unknown note.'));
throw new ClientException(_('Unknown notice.'));
}
$old = Fave::pkeyGet(array('user_id' => $this->auth_user->id,
......
......@@ -122,7 +122,7 @@ class BlockedfromgroupAction extends GroupDesignAction
_('A list of the users blocked from joining this group.'));
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
......
......@@ -99,7 +99,7 @@ class ConfirmaddressAction extends Action
if (in_array($type, array('email', 'sms')))
{
if ($cur->$type == $confirm->address) {
// TRANS: Client error for an already confirmed email/jabber/sms address.
// TRANS: Client error for an already confirmed email/jabber/sms address.
$this->clientError(_('That address has already been confirmed.'));
return;
}
......@@ -118,7 +118,8 @@ class ConfirmaddressAction extends Action
if (!$result) {
common_log_db_error($cur, 'UPDATE', __FILE__);
$this->serverError(_('Couldn\'t update user.'));
// TRANS: Server error displayed when confirming an e-mail address or IM address fails.
$this->serverError(_('Could not update user.'));
return;
}
......@@ -133,6 +134,7 @@ class ConfirmaddressAction extends Action
$user_im_prefs->user_id = $cur->id;
if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
if($user_im_prefs->screenname == $confirm->address){
// TRANS: Client error for an already confirmed IM address.
$this->clientError(_('That address has already been confirmed.'));
return;
}
......@@ -141,7 +143,8 @@ class ConfirmaddressAction extends Action
if (!$result) {
common_log_db_error($user_im_prefs, 'UPDATE', __FILE__);
$this->serverError(_('Couldn\'t update user im preferences.'));
// TRANS: Server error displayed when updating IM preferences fails.
$this->serverError(_('Could not update user IM preferences.'));
return;
}
}else{
......@@ -153,7 +156,8 @@ class ConfirmaddressAction extends Action
if (!$result) {
common_log_db_error($user_im_prefs, 'INSERT', __FILE__);
$this->serverError(_('Couldn\'t insert user im preferences.'));
// TRANS: Server error displayed when adding IM preferences fails.
$this->serverError(_('Could not insert user IM preferences.'));
return;
}
}
......
<?php
/**
* Display a conversation in the browser
*
* PHP version 5
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2009, StatusNet, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
// XXX: not sure how to do paging yet,
// so set a 60-notice limit
require_once INSTALLDIR.'/lib/noticelist.php';
/**
* Conversation tree in the browser
*
* @category Action
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class ConversationRepliesAction extends ConversationAction
{
function handle($args)
{
if ($this->boolean('ajax')) {
$this->showAjax();
} else {
parent::handle($args);
}
}
/**
* Show content.
*
* Display a hierarchical unordered list in the content area.
* Uses ConversationTree to do most of the heavy lifting.
*
* @return void
*/
function showContent()
{
$notices = Notice::conversationStream($this->id, null, null);
$ct = new FullThreadedNoticeList($notices, $this);
$cnt = $ct->show();
}
function showAjax()
{
header('Content-Type: text/xml;charset=utf-8');
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Title for conversation page.
$this->element('title', null, _m('TITLE','Notice'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showContent();
$this->elementEnd('body');
$this->elementEnd('html');
}
}
class FullThreadedNoticeList extends ThreadedNoticeList
{
function newListItem($notice)
{
return new FullThreadedNoticeListItem($notice, $this->out);
}
}
class FullThreadedNoticeListItem extends ThreadedNoticeListItem
{
function initialItems()
{
return 1000; // @fixme
}
}
......@@ -139,7 +139,7 @@ class EditgroupAction extends GroupDesignAction
$this->showPage();
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
......
......@@ -163,19 +163,6 @@ class FavoritedAction extends Action
$this->elementEnd('div');
}
/**
* Local navigation
*
* This page is part of the public group, so show that.
*
* @return void
*/
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
/**
* Content area
*
......
......@@ -90,12 +90,6 @@ class FeaturedAction extends Action
$this->elementEnd('div');
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function getInstructions()
{
// TRANS: Description on page displaying featured users.
......
......@@ -163,12 +163,22 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return nothing
*/
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
}
/**
* Override to show default nav stuff
*
* @return nothing
*/
function showLocalNav()
{
Action::showLocalNav();
}
/**
* Get the design we want to edit
*
......
......@@ -458,7 +458,7 @@ class GrouplogoAction extends GroupDesignAction
$this->autofocus('avatarfile');
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
......
......@@ -125,7 +125,7 @@ class GroupmembersAction extends GroupDesignAction
_('A list of the users in this group.'));
}
function showLocalNav()
function showObjectNav()
{
$nav = new GroupNav($this, $this->group);
$nav->show();
......
......@@ -80,12 +80,6 @@ class GroupsAction extends Action
$this->showPage();
}
function showLocalNav()
{
$nav = new PublicGroupNav($this);
$nav->show();
}
function showPageNotice()
{
$notice =
......
......@@ -111,8 +111,8 @@ class ImsettingsAction extends SettingsAction
if ($user_im_prefs = User_im_prefs::pkeyGet( array('transport' => $transport, 'user_id' => $user->id) )) {
$user_im_prefs_by_transport[$transport] = $user_im_prefs;
$this->element('p', 'form_confirmed', $user_im_prefs->screenname);
// TRANS: Form note in IM settings form.
$this->element('p', 'form_note',
// TRANS: Form note in IM settings form. %s is the type of IM address that was confirmed.
sprintf(_('Current confirmed %s address.'),$transport_info['display']));
$this->hidden('screenname', $user_im_prefs->screenname);
// TRANS: Button label to remove a confirmed IM address.
......@@ -124,11 +124,11 @@ class ImsettingsAction extends SettingsAction
// TRANS: Form note in IM settings form.
$this->element('p', 'form_note',
// TRANS: Form note in IM settings form.
// TRANS: %s is the IM address set for the site.
// TRANS: %s is the IM service name, %2$s is the IM address set.
sprintf(_('Awaiting confirmation on this address. '.
'Check your %s account for a '.
'Check your %1$s account for a '.
'message with further instructions. '.
'(Did you add %s to your buddy list?)'),
'(Did you add %2$s to your buddy list?)'),
$transport_info['display'],
$transport_info['daemonScreenname']));
$this->hidden('screenname', $confirm->address);
......@@ -137,8 +137,10 @@ class ImsettingsAction extends SettingsAction
} else {
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
// TRANS: Field label for IM address.
$this->input('screenname', _('IM address'),
($this->arg('screenname')) ? $this->arg('screenname') : null,
// TRANS: Field title for IM address. %s is the IM service name.
sprintf(_('%s screenname.'),
$transport_info['display']));
$this->elementEnd('li');
......@@ -288,7 +290,7 @@ class ImsettingsAction extends SettingsAction
if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__);