Merge branch '1.0.x' of git://gitorious.org/statusnet/mainline
Conflicts: actions/public.php
This commit is contained in:
commit
27ef3b1d90
114
EVENTS.txt
114
EVENTS.txt
@ -987,9 +987,12 @@ EndRevokeRole: when a role has been revoked
|
||||
|
||||
StartAtomPubNewActivity: When a new activity comes in through Atom Pub API
|
||||
- &$activity: received activity
|
||||
- $user: user publishing the entry
|
||||
- &$notice: notice created; initially null, can be set
|
||||
|
||||
EndAtomPubNewActivity: When a new activity comes in through Atom Pub API
|
||||
- $activity: received activity
|
||||
- $user: user publishing the entry
|
||||
- $notice: notice that was created
|
||||
|
||||
StartXrdActionAliases: About to set aliases for the XRD object for a user
|
||||
@ -1017,3 +1020,114 @@ StartAdminPanelNav: Before displaying the first item in the list of admin panels
|
||||
|
||||
EndAdminPanelNav: After displaying the last item in the list of admin panels
|
||||
- $nav The AdminPanelNav widget
|
||||
|
||||
StartActivityObjectFromNotice: When converting a notice to an activity:object
|
||||
- $notice: The notice being converted
|
||||
- &$object: The resulting object. Fill this and return false to override defaults.
|
||||
|
||||
EndActivityObjectFromNotice: After converting a notice to an activity:object
|
||||
- $notice: The notice being converted
|
||||
- &$object: The resulting object. Can be edited
|
||||
|
||||
StartActivityObjectFromProfile: When converting a profile to an activity:object
|
||||
- $profile: The profile being converted
|
||||
- &$object: The (empty) object. Fill it up and return false to override defaults.
|
||||
|
||||
EndActivityObjectFromProfile: After converting a profile to an activity:object
|
||||
- $profile: The profile being converted
|
||||
- &$object: The finished object. Can be tweaked
|
||||
|
||||
StartActivityObjectFromGroup: When converting a group to an activity:object
|
||||
- $group: The group being converted
|
||||
- &$object: The (empty) object. Fill and return false to override.
|
||||
|
||||
EndActivityObjectFromGroup: After converting a group to an activity:object
|
||||
- $group: The group being converted
|
||||
- &$object: The finished object. Tweak as needed.
|
||||
|
||||
StartImportActivity: when we start to import an activity
|
||||
- $user: User to make the author import
|
||||
- $author: Author of the feed; good for comparisons
|
||||
- $activity: The current activity
|
||||
- $trusted: How "trusted" the process is
|
||||
- &$done: Return value; whether to continue
|
||||
|
||||
EndImportActivity: when we finish importing an activity
|
||||
- $user: User to make the author import
|
||||
- $author: Author of the feed; good for comparisons
|
||||
- $activity: The current activity
|
||||
- $trusted: How "trusted" the process is
|
||||
|
||||
StartProfileSettingsActions: when we're showing account-management action list
|
||||
- $action: Action being shown (use for output)
|
||||
|
||||
EndProfileSettingsActions: when we're showing account-management action list
|
||||
- $action: Action being shown (use for output)
|
||||
|
||||
StartOpenNoticeListItemElement: Before the opening <li> of a notice list element
|
||||
- $nli: The notice list item being shown
|
||||
|
||||
EndOpenNoticeListItemElement: After the opening <li> of a notice list element
|
||||
- $nli: The notice list item being shown
|
||||
|
||||
StartCloseNoticeListItemElement: Before the closing </li> of a notice list element
|
||||
- $nli: The notice list item being shown
|
||||
|
||||
EndCloseNoticeListItemElement: After the closing </li> of a notice list element
|
||||
- $nli: The notice list item being shown
|
||||
|
||||
StartGroupEditFormData: Beginning the group edit form entries
|
||||
- $form: The form widget being shown
|
||||
|
||||
EndGroupEditFormData: Ending the group edit form entries
|
||||
- $form: The form widget being shown
|
||||
|
||||
StartGroupSave: After initializing but before saving a group
|
||||
- &$group: group about to be saved
|
||||
|
||||
EndGroupSave: After saving a group, aliases, and first member
|
||||
- $group: group that was saved
|
||||
|
||||
StartInterpretCommand: Before running a command
|
||||
- $cmd: First word in the string, 'foo' in 'foo argument'
|
||||
- $arg: Argument, if any, like 'argument' in 'foo argument'
|
||||
- $user: User who issued the command
|
||||
- &$result: Resulting command; you can set this!
|
||||
|
||||
EndInterpretCommand: Before running a command
|
||||
- $cmd: First word in the string, 'foo' in 'foo argument'
|
||||
- $arg: Argument, if any, like 'argument' in 'foo argument'
|
||||
- $user: User who issued the command
|
||||
- $result: Resulting command
|
||||
|
||||
StartGroupActionsList: Start the list of actions on a group profile page (after <ul>, before first <li>)
|
||||
- $action: action being executed (for output and params)
|
||||
- $group: group for the page
|
||||
|
||||
EndGroupActionsList: End the list of actions on a group profile page (before </ul>, after last </li>)
|
||||
- $action: action being executed (for output and params)
|
||||
- $group: group for the page
|
||||
|
||||
StartGroupProfileElements: Start showing stuff about the group on its profile page
|
||||
- $action: action being executed (for output and params)
|
||||
- $group: group for the page
|
||||
|
||||
EndGroupProfileElements: Start showing stuff about the group on its profile page
|
||||
- $action: action being executed (for output and params)
|
||||
- $group: group for the page
|
||||
|
||||
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
|
||||
|
45
README
45
README
@ -737,6 +737,12 @@ statusnet.ini (since this is the recommended database name). If you
|
||||
have a line in your config.php pointing to the old name, you'll need
|
||||
to update it.
|
||||
|
||||
NOTE: the 1.0.0 version of StatusNet changed the URLs for all admin
|
||||
panels from /admin/* to /panel/*. This now allows the (popular)
|
||||
username 'admin', but blocks the considerably less popular username
|
||||
'panel'. If you have an existing user named 'panel', you should rename
|
||||
them before upgrading.
|
||||
|
||||
Notice inboxes
|
||||
--------------
|
||||
|
||||
@ -1274,6 +1280,12 @@ Profile management.
|
||||
|
||||
biolimit: max character length of bio; 0 means no limit; null means to use
|
||||
the site text limit default.
|
||||
backup: whether users can backup their own profiles. Defaults to true.
|
||||
restore: whether users can restore their profiles from backup files. Defaults
|
||||
to true.
|
||||
delete: whether users can delete their own accounts. Defaults to false.
|
||||
move: whether users can move their accounts to another server. Defaults
|
||||
to true.
|
||||
|
||||
newuser
|
||||
-------
|
||||
@ -1564,6 +1576,39 @@ cache: whether to cache the router in memcache (or another caching
|
||||
router cached) or others who see strange behavior. You're unlikely
|
||||
to need this unless you're a developer.
|
||||
|
||||
http
|
||||
----
|
||||
|
||||
Settings for the HTTP client.
|
||||
|
||||
ssl_cafile: location of the CA file for SSL. If not set, won't verify
|
||||
SSL peers. Default unset.
|
||||
curl: Use cURL <http://curl.haxx.se/> for doing HTTP calls. You must
|
||||
have the PHP curl extension installed for this to work.
|
||||
proxy_host: Host to use for proxying HTTP requests. If unset, doesn't
|
||||
do any HTTP proxy stuff. Default unset.
|
||||
proxy_port: Port to use to connect to HTTP proxy host. Default null.
|
||||
proxy_user: Username to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_password: Password to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_auth_scheme: Scheme to use for authenticating to the HTTP proxy. Default null.
|
||||
|
||||
plugins
|
||||
-------
|
||||
|
||||
default: associative array mapping plugin name to array of arguments. To disable
|
||||
a default plugin, unset its value in this array.
|
||||
locale_path: path for finding plugin locale files. In the plugin's directory
|
||||
by default.
|
||||
server: Server to find static files for a plugin when the page is plain old HTTP.
|
||||
Defaults to site/server (same as pages). Use this to move plugin CSS and
|
||||
JS files to a CDN.
|
||||
sslserver: Server to find static files for a plugin when the page is HTTPS. Defaults
|
||||
to site/server (same as pages). Use this to move plugin CSS and JS files
|
||||
to a CDN.
|
||||
path: Path to the plugin files. defaults to site/path + '/plugins/'. Expects that
|
||||
each plugin will have a subdirectory at plugins/NameOfPlugin. Change this
|
||||
if you're using a CDN.
|
||||
sslpath: Path to use on the SSL server. Same as plugins/path.
|
||||
|
||||
Plugins
|
||||
=======
|
||||
|
@ -58,9 +58,9 @@ class AllAction extends ProfileAction
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!empty($cur) && $cur->id == $this->user->id) {
|
||||
$this->notice = $this->user->noticeInbox(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
$this->notice = $this->user->noticeInboxThreaded(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
} else {
|
||||
$this->notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
$this->notice = $this->user->noticesWithFriendsThreaded(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
|
||||
}
|
||||
|
||||
if ($this->page > 1 && $this->notice->N == 0) {
|
||||
@ -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.
|
||||
@ -163,7 +157,7 @@ class AllAction extends ProfileAction
|
||||
function showContent()
|
||||
{
|
||||
if (Event::handle('StartShowAllContent', array($this))) {
|
||||
$nl = new NoticeList($this->notice, $this);
|
||||
$nl = new ThreadedNoticeList($this->notice, $this);
|
||||
|
||||
$cnt = $nl->show();
|
||||
|
||||
|
@ -149,7 +149,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user);
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
|
@ -154,7 +154,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user);
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
|
@ -204,7 +204,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user);
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
|
@ -188,7 +188,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user);
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
|
@ -112,16 +112,17 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $imagefile->preferredType();
|
||||
$filename = Avatar::filename(
|
||||
$user->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
image_type_to_extension($type),
|
||||
null,
|
||||
'tmp'.common_timestamp()
|
||||
);
|
||||
|
||||
$filepath = Avatar::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
$imagefile->copyTo($filepath);
|
||||
|
||||
$profile = $this->user->getProfile();
|
||||
|
||||
@ -139,7 +140,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||
|
||||
if ($this->format == 'xml') {
|
||||
$this->initDocument('xml');
|
||||
$this->showTwitterXmlUser($twitter_user);
|
||||
$this->showTwitterXmlUser($twitter_user, 'user', true);
|
||||
$this->endDocument('xml');
|
||||
} elseif ($this->format == 'json') {
|
||||
$this->initDocument('json');
|
||||
|
@ -39,7 +39,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
{
|
||||
/**
|
||||
@ -50,13 +49,13 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
* @return boolean success flag
|
||||
*
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
$this->user = $this->getTargetUser($this->arg('id'));
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client error displayed when making an Atom API request for an unknown user.
|
||||
$this->clientError(_('No such user.'), 404, $this->format);
|
||||
return;
|
||||
}
|
||||
@ -71,7 +70,6 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -83,13 +81,15 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
'xmlns:atom' => 'http://www.w3.org/2005/Atom',
|
||||
'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/'));
|
||||
$this->elementStart('workspace');
|
||||
$this->element('atom:title', null, _('Main'));
|
||||
// TRANS: Title for Atom feed.
|
||||
$this->element('atom:title', null, _m('ATOM','Main'));
|
||||
$this->elementStart('collection',
|
||||
array('href' => common_local_url('ApiTimelineUser',
|
||||
array('id' => $this->user->id,
|
||||
'format' => 'atom'))));
|
||||
$this->element('atom:title',
|
||||
null,
|
||||
// TRANS: Title for Atom feed. %s is a user nickname.
|
||||
sprintf(_("%s timeline"),
|
||||
$this->user->nickname));
|
||||
$this->element('accept', null, 'application/atom+xml;type=entry');
|
||||
@ -100,6 +100,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
array('subscriber' => $this->user->id))));
|
||||
$this->element('atom:title',
|
||||
null,
|
||||
// TRANS: Title for Atom feed with a user's subscriptions. %s is a user nickname.
|
||||
sprintf(_("%s subscriptions"),
|
||||
$this->user->nickname));
|
||||
$this->element('accept', null, 'application/atom+xml;type=entry');
|
||||
@ -110,6 +111,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
array('profile' => $this->user->id))));
|
||||
$this->element('atom:title',
|
||||
null,
|
||||
// TRANS: Title for Atom feed with a user's favorite notices. %s is a user nickname.
|
||||
sprintf(_("%s favorites"),
|
||||
$this->user->nickname));
|
||||
$this->element('accept', null, 'application/atom+xml;type=entry');
|
||||
@ -120,6 +122,7 @@ class ApiAtomServiceAction extends ApiBareAuthAction
|
||||
array('profile' => $this->user->id))));
|
||||
$this->element('atom:title',
|
||||
null,
|
||||
// TRANS: Title for Atom feed with a user's memberships. %s is a user nickname.
|
||||
sprintf(_("%s memberships"),
|
||||
$this->user->nickname));
|
||||
$this->element('accept', null, 'application/atom+xml;type=entry');
|
||||
|
@ -92,6 +92,7 @@ class ApiBlockCreateAction extends ApiAuthAction
|
||||
}
|
||||
|
||||
if (empty($this->user) || empty($this->other)) {
|
||||
// TRANS: Client error displayed when trying to block a non-existing user or a user from another site.
|
||||
$this->clientError(_('No such user.'), 404, $this->format);
|
||||
return;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
|
||||
} else if (!$this->user->mutuallySubscribed($this->other)) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed trying to direct message another user who's not a friend (403).
|
||||
_('Can\'t send direct messages to users who aren\'t your friend.'),
|
||||
_('Cannot send direct messages to users who aren\'t your friend.'),
|
||||
403,
|
||||
$this->format
|
||||
);
|
||||
|
@ -125,26 +125,17 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||
return;
|
||||
}
|
||||
|
||||
$member = new Group_member();
|
||||
|
||||
$member->group_id = $this->group->id;
|
||||
$member->profile_id = $this->user->id;
|
||||
$member->created = common_sql_now();
|
||||
|
||||
$result = $member->insert();
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($member, 'INSERT', __FILE__);
|
||||
$this->serverError(
|
||||
sprintf(
|
||||
// TRANS: Server error displayed when joining a group fails.
|
||||
// TRANS: %1$s is a user nickname, $2$s is a group nickname.
|
||||
_('Could not join user %1$s to group %2$s.'),
|
||||
$this->user->nickname,
|
||||
$this->group->nickname
|
||||
)
|
||||
);
|
||||
return;
|
||||
try {
|
||||
if (Event::handle('StartJoinGroup', array($this->group, $this->user))) {
|
||||
Group_member::join($this->group->id, $this->user->id);
|
||||
Event::handle('EndJoinGroup', array($this->group, $this->user));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// TRANS: Server error displayed when joining a group failed in the database.
|
||||
// TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
|
||||
$this->serverError(sprintf(_('Could not join user %1$s to group %2$s.'),
|
||||
$cur->nickname, $this->group->nickname));
|
||||
return;
|
||||
}
|
||||
|
||||
switch($this->format) {
|
||||
|
@ -116,22 +116,18 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||
return;
|
||||
}
|
||||
|
||||
$result = $member->delete();
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($member, 'DELETE', __FILE__);
|
||||
$this->serverError(
|
||||
sprintf(
|
||||
// TRANS: Server error displayed when leaving a group fails.
|
||||
// TRANS: %1$s is a user nickname, $2$s is a group nickname.
|
||||
_('Could not remove user %1$s from group %2$s.'),
|
||||
$this->user->nickname,
|
||||
$this->group->nickname
|
||||
)
|
||||
);
|
||||
try {
|
||||
if (Event::handle('StartLeaveGroup', array($this->group,$this->user))) {
|
||||
Group_member::leave($this->group->id, $this->user->id);
|
||||
Event::handle('EndLeaveGroup', array($this->group, $this->user));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// TRANS: Server error displayed when leaving a group failed in the database.
|
||||
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
|
||||
$this->serverError(sprintf(_('Could not remove user %1$s from group %2$s.'),
|
||||
$cur->nickname, $this->group->nickname));
|
||||
return;
|
||||
}
|
||||
|
||||
switch($this->format) {
|
||||
case 'xml':
|
||||
$this->showSingleXmlGroup($this->group);
|
||||
|
@ -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
|
||||
|
@ -66,6 +66,12 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||
parent::prepare($args);
|
||||
|
||||
$this->group = $this->getTargetGroup($this->arg('id'));
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client error displayed trying to show group membership on a non-existing group.
|
||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->profiles = $this->getProfiles();
|
||||
|
||||
return true;
|
||||
@ -84,12 +90,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client error displayed trying to show group membership on a non-existing group.
|
||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||
return false;
|
||||
}
|
||||
|
||||
// XXX: RSS and Atom
|
||||
|
||||
switch($this->format) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||
common_debug(var_export($req, true));
|
||||
$code = $e->getCode();
|
||||
$this->clientError($e->getMessage(), empty($code) ? 401 : $code, 'text');
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($atok)) {
|
||||
@ -98,7 +99,7 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||
|
||||
common_log(LOG_WARNING, $msg);
|
||||
// TRANS: Client error given from the OAuth API when the request token or verifier is invalid.
|
||||
$this->clientError(_("Invalid request token or verifier.", 400, 'text'));
|
||||
$this->clientError(_('Invalid request token or verifier.'), 400, 'text');
|
||||
} else {
|
||||
common_log(
|
||||
LOG_INFO,
|
||||
|
@ -114,6 +114,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||
$this->deleteNotice();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed calling an unsupported HTTP error in API status show.
|
||||
$this->clientError(_('HTTP method not supported.'), 405);
|
||||
return;
|
||||
}
|
||||
@ -138,7 +139,9 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||
$this->showSingleAtomStatus($this->notice);
|
||||
break;
|
||||
default:
|
||||
throw new Exception(sprintf(_("Unsupported format: %s"), $this->format));
|
||||
// TRANS: Exception thrown requesting an unsupported notice output format.
|
||||
// TRANS: %s is the requested output format.
|
||||
throw new Exception(sprintf(_("Unsupported format: %s."), $this->format));
|
||||
}
|
||||
} else {
|
||||
// XXX: Twitter just sets a 404 header and doens't bother
|
||||
@ -171,7 +174,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
|
||||
@ -220,14 +223,16 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||
function deleteNotice()
|
||||
{
|
||||
if ($this->format != 'atom') {
|
||||
$this->clientError(_("Can only delete using the Atom format."));
|
||||
// TRANS: Client error displayed when trying to delete a notice not using the Atom format.
|
||||
$this->clientError(_('Can only delete using the Atom format.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->auth_user) ||
|
||||
($this->notice->profile_id != $this->auth_user->id &&
|
||||
!$this->auth_user->hasRight(Right::DELETEOTHERSNOTICE))) {
|
||||
$this->clientError(_('Can\'t delete this notice.'), 403);
|
||||
// TRANS: Client error displayed when a user has no rights to delete notices of other users.
|
||||
$this->clientError(_('Cannot delete this notice.'), 403);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -240,6 +245,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||
|
||||
header('HTTP/1.1 200 OK');
|
||||
header('Content-Type: text/plain');
|
||||
// TRANS: Confirmation of notice deletion in API. %d is the ID (number) of the deleted notice.
|
||||
print(sprintf(_('Deleted notice %d'), $this->notice->id));
|
||||
print("\n");
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||
function supported($cmd)
|
||||
{
|
||||
static $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand',
|
||||
'FavCommand', 'OnCommand', 'OffCommand');
|
||||
'FavCommand', 'OnCommand', 'OffCommand', 'JoinCommand', 'LeaveCommand');
|
||||
|
||||
if (in_array(get_class($cmd), $cmdlist)) {
|
||||
return true;
|
||||
|
@ -59,7 +59,8 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||
'notice' => array('contentlimit'),
|
||||
'throttle' => array('enabled', 'count', 'timespan'),
|
||||
'xmpp' => array('enabled', 'server', 'port', 'user'),
|
||||
'integration' => array('source')
|
||||
'integration' => array('source'),
|
||||
'attachments' => array('uploads', 'file_quota')
|
||||
);
|
||||
|
||||
/**
|
||||
@ -96,7 +97,7 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||
foreach ($this->keys as $section => $settings) {
|
||||
$this->elementStart($section);
|
||||
foreach ($settings as $setting) {
|
||||
$value = common_config($section, $setting);
|
||||
$value = $this->setting($section, $setting);
|
||||
if (is_array($value)) {
|
||||
$value = implode(',', $value);
|
||||
} else if ($value === false || $value == '0') {
|
||||
@ -125,7 +126,7 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||
$result[$section] = array();
|
||||
foreach ($settings as $setting) {
|
||||
$result[$section][$setting]
|
||||
= common_config($section, $setting);
|
||||
= $this->setting($section, $setting);
|
||||
}
|
||||
}
|
||||
$this->initDocument('json');
|
||||
@ -143,6 +144,20 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||
}
|
||||
}
|
||||
|
||||
function setting($section, $key) {
|
||||
$result = common_config($section, $key);
|
||||
if ($key == 'file_quota') {
|
||||
// hack: adjust for the live upload limit
|
||||
if (common_config($section, 'uploads')) {
|
||||
$max = ImageFile::maxFileSizeInt();
|
||||
} else {
|
||||
$max = 0;
|
||||
}
|
||||
return min($result, $max);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if read only.
|
||||
*
|
||||
|
@ -169,6 +169,14 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link,'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -263,6 +263,14 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link,'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -106,6 +106,11 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||
|
||||
$self = $this->getSelfUri();
|
||||
|
||||
$link = common_local_url(
|
||||
'ApiTimelineGroup',
|
||||
array('nickname' => $this->group->nickname)
|
||||
);
|
||||
|
||||
switch($this->format) {
|
||||
case 'xml':
|
||||
$this->showXmlTimeline($this->notices);
|
||||
@ -123,28 +128,20 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||
break;
|
||||
case 'atom':
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
try {
|
||||
$atom->addAuthorRaw($this->group->asAtomAuthor());
|
||||
$atom->setActivitySubject($this->group->asActivitySubject());
|
||||
$atom->setId($self);
|
||||
$atom->setSelfLink($self);
|
||||
$atom->addEntryFromNotices($this->notices);
|
||||
$this->raw($atom->getString());
|
||||
} catch (Atom10FeedException $e) {
|
||||
$this->serverError(
|
||||
// TRANS: Server error displayed when generating an Atom feed fails.
|
||||
// TRANS: %s is the error.
|
||||
sprintf(_('Could not generate feed for group - %s'),$e->getMessage()),
|
||||
400,
|
||||
$this->format
|
||||
);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($atom->title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
|
@ -168,6 +168,14 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -169,6 +169,14 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -234,6 +234,14 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -92,6 +92,20 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||
$offset = ($this->page-1) * $this->cnt;
|
||||
$limit = $this->cnt;
|
||||
|
||||
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
|
||||
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
|
||||
$subtitle = sprintf(
|
||||
_('%1$s notices that were to repeated to %2$s / %3$s.'),
|
||||
$sitename, $this->user->nickname, $profile->getBestName()
|
||||
);
|
||||
$taguribase = TagURI::base();
|
||||
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
|
||||
|
||||
$link = common_local_url(
|
||||
'all',
|
||||
array('nickname' => $this->auth_user->nickname)
|
||||
);
|
||||
|
||||
$strm = $this->auth_user->repeatedToMe($offset, $limit, $this->since_id, $this->max_id);
|
||||
|
||||
switch ($this->format) {
|
||||
@ -102,16 +116,31 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||
$this->showJsonTimeline($strm);
|
||||
break;
|
||||
case 'atom':
|
||||
$profile = $this->auth_user->getProfile();
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
|
||||
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
|
||||
$taguribase = TagURI::base();
|
||||
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
|
||||
$link = common_local_url('all',
|
||||
array('nickname' => $this->auth_user->nickname));
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$this->showAtomTimeline($strm, $title, $id, $link);
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
$atom->setSubtitle($subtitle);
|
||||
$atom->setUpdated('now');
|
||||
$atom->addLink($link);
|
||||
|
||||
$id = $this->arg('id');
|
||||
|
||||
$atom->setSelfLink($self);
|
||||
$atom->addEntryFromNotices($strm);
|
||||
|
||||
$this->raw($atom->getString());
|
||||
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($strm);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
|
@ -93,9 +93,27 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||
$offset = ($this->page-1) * $this->cnt;
|
||||
$limit = $this->cnt;
|
||||
|
||||
$strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
|
||||
// TRANS: Title of list of repeated notices of the logged in user.
|
||||
// TRANS: %s is the nickname of the logged in user.
|
||||
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
|
||||
$sitename = common_config('site', 'name');
|
||||
|
||||
common_debug(var_export($strm, true));
|
||||
$profile = $this->auth_user->getProfile();
|
||||
|
||||
$subtitle = sprintf(
|
||||
_('%1$s notices that %2$s / %3$s has repeated.'),
|
||||
$sitename, $this->auth_user->nickname, $profile->getBestName()
|
||||
);
|
||||
|
||||
$taguribase = TagURI::base();
|
||||
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
|
||||
|
||||
$link = common_local_url(
|
||||
'all',
|
||||
array('nickname' => $this->auth_user->nickname)
|
||||
);
|
||||
|
||||
$strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
|
||||
|
||||
switch ($this->format) {
|
||||
case 'xml':
|
||||
@ -105,49 +123,28 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||
$this->showJsonTimeline($strm);
|
||||
break;
|
||||
case 'atom':
|
||||
$profile = $this->auth_user->getProfile();
|
||||
|
||||
// TRANS: Title of list of repeated notices of the logged in user.
|
||||
// TRANS: %s is the nickname of the logged in user.
|
||||
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
|
||||
$taguribase = TagURI::base();
|
||||
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
|
||||
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
$atom = new AtomNoticeFeed($this->auth_user);
|
||||
|
||||
$atom->setId($id);
|
||||
$atom->setTitle($title);
|
||||
$atom->setSubtitle($subtitle);
|
||||
$atom->setUpdated('now');
|
||||
|
||||
$atom->addLink(
|
||||
common_local_url(
|
||||
'showstream',
|
||||
array('nickname' => $this->auth_user->nickname)
|
||||
)
|
||||
);
|
||||
|
||||
$id = $this->arg('id');
|
||||
$aargs = array('format' => 'atom');
|
||||
if (!empty($id)) {
|
||||
$aargs['id'] = $id;
|
||||
}
|
||||
|
||||
$atom->addLink(
|
||||
$this->getSelfUri('ApiTimelineRetweetsOfMe', $aargs),
|
||||
array('rel' => 'self', 'type' => 'application/atom+xml')
|
||||
);
|
||||
|
||||
$atom->addLink($link);
|
||||
$atom->setSelfLink($this->getSelfUri());
|
||||
$atom->addEntryFromNotices($strm);
|
||||
|
||||
$this->raw($atom->getString());
|
||||
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($strm);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
$this->clientError(_('API method not found.'), 404);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||
$sitename
|
||||
);
|
||||
$taguribase = TagURI::base();
|
||||
$id = "tag:$taguribase:TagTimeline:".$tag;
|
||||
$id = "tag:$taguribase:TagTimeline:".$this->tag;
|
||||
|
||||
$link = common_local_url(
|
||||
'tag',
|
||||
@ -116,8 +116,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||
|
||||
$self = $this->getSelfUri();
|
||||
|
||||
common_debug("self link is: $self");
|
||||
|
||||
switch($this->format) {
|
||||
case 'xml':
|
||||
$this->showXmlTimeline($this->notices);
|
||||
@ -154,6 +152,14 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
|
@ -201,6 +201,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
case 'json':
|
||||
$this->showJsonTimeline($this->notices);
|
||||
break;
|
||||
case 'as':
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
$doc = new ActivityStreamJSONDocument($this->auth_user);
|
||||
$doc->setTitle($atom->title);
|
||||
$doc->addLink($link, 'alternate', 'text/html');
|
||||
$doc->addItemsFromNotices($this->notices);
|
||||
|
||||
// XXX: Add paging extension?
|
||||
|
||||
$this->raw($doc->asString());
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||
$this->clientError(_('API method not found.'), $code = 404);
|
||||
@ -241,7 +252,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return ($_SERVER['REQUEST_METHOD'] == 'GET' || $_SERVER['REQUEST_METHOD'] == 'HEAD');
|
||||
@ -307,11 +318,13 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
|
||||
$xml = trim(file_get_contents('php://input'));
|
||||
if (empty($xml)) {
|
||||
// TRANS: Client error displayed attempting to post an empty API notice.
|
||||
$this->clientError(_('Atom post must not be empty.'));
|
||||
}
|
||||
|
||||
$dom = DOMDocument::loadXML($xml);
|
||||
if (!$dom) {
|
||||
// TRANS: Client error displayed attempting to post an API that is not well-formed XML.
|
||||
$this->clientError(_('Atom post must be well-formed XML.'));
|
||||
}
|
||||
|
||||
@ -324,11 +337,11 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
|
||||
$activity = new Activity($dom->documentElement);
|
||||
|
||||
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
|
||||
$saved = null;
|
||||
|
||||
if (Event::handle('StartAtomPubNewActivity', array(&$activity, $this->user, &$saved))) {
|
||||
if ($activity->verb != ActivityVerb::POST) {
|
||||
// TRANS: Client error displayed when not using the POST verb.
|
||||
// TRANS: Do not translate POST.
|
||||
// TRANS: Client error displayed when not using the POST verb. Do not translate POST.
|
||||
$this->clientError(_('Can only handle POST activities.'));
|
||||
return;
|
||||
}
|
||||
@ -347,7 +360,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
|
||||
$saved = $this->postNote($activity);
|
||||
|
||||
Event::handle('EndAtomPubNewActivity', array($activity, $saved));
|
||||
Event::handle('EndAtomPubNewActivity', array($activity, $this->user, $saved));
|
||||
}
|
||||
|
||||
if (!empty($saved)) {
|
||||
@ -373,6 +386,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
} else {
|
||||
// @fixme fetch from $sourceUrl?
|
||||
// TRANS: Client error displayed when posting a notice without content through the API.
|
||||
// TRANS: %d is the notice ID (number).
|
||||
$this->clientError(sprintf(_('No content for notice %d.'),
|
||||
$note->id));
|
||||
return;
|
||||
@ -401,6 +415,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
|
||||
if (!empty($notice)) {
|
||||
// TRANS: Client error displayed when using another format than AtomPub.
|
||||
// TRANS: %s is the notice URI.
|
||||
$this->clientError(sprintf(_('Notice with URI "%s" already exists.'),
|
||||
$note->id));
|
||||
return;
|
||||
@ -425,14 +440,14 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||
$profile = Profile::fromURI($uri);
|
||||
|
||||
if (!empty($profile)) {
|
||||
$options['replies'] = $uri;
|
||||
$options['replies'][] = $uri;
|
||||
} else {
|
||||
$group = User_group::staticGet('uri', $uri);
|
||||
if (!empty($group)) {
|
||||
$options['groups'] = $uri;
|
||||
$options['groups'][] = $uri;
|
||||
} else {
|
||||
// @fixme: hook for discovery here
|
||||
common_log(LOG_WARNING, sprintf(_('AtomPub post with unknown attention URI %s'), $uri));
|
||||
common_log(LOG_WARNING, sprintf('AtomPub post with unknown attention URI %s', $uri));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Feed of ActivityStreams 'favorite' actions
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
{
|
||||
private $_profile = null;
|
||||
@ -59,7 +58,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
@ -67,7 +65,8 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
$this->_profile = Profile::staticGet('id', $this->trimmed('profile'));
|
||||
|
||||
if (empty($this->_profile)) {
|
||||
throw new ClientException(_('No such profile'), 404);
|
||||
// TRANS: Client exception thrown when requesting a favorite feed for a non-existing profile.
|
||||
throw new ClientException(_('No such profile.'), 404);
|
||||
}
|
||||
|
||||
$offset = ($this->page-1) * $this->count;
|
||||
@ -76,7 +75,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
$this->_faves = Fave::byProfile($this->_profile->id,
|
||||
$offset,
|
||||
$limit);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -87,7 +86,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
@ -101,6 +99,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
$this->addFavorite();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client exception thrown when using an unsupported HTTP method.
|
||||
throw new ClientException(_('HTTP method not supported.'), 405);
|
||||
return;
|
||||
}
|
||||
@ -113,7 +112,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showFeed()
|
||||
{
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
@ -139,21 +137,25 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
$feed->addAuthor($this->_profile->getBestName(),
|
||||
$this->_profile->getURI());
|
||||
|
||||
// TRANS: Title for Atom favorites feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
$feed->setTitle(sprintf(_("%s favorites"),
|
||||
$this->_profile->getBestName()));
|
||||
|
||||
$feed->setSubtitle(sprintf(_("Notices %s has favorited to on %s"),
|
||||
// TRANS: Subtitle for Atom favorites feed.
|
||||
// TRANS: %1$s is a user nickname, %2$s is the StatusNet sitename.
|
||||
$feed->setSubtitle(sprintf(_('Notices %1$s has favorited on %2$s'),
|
||||
$this->_profile->getBestName(),
|
||||
common_config('site', 'name')));
|
||||
|
||||
$feed->addLink(common_local_url('showfavorites',
|
||||
array('nickname' =>
|
||||
array('nickname' =>
|
||||
$this->_profile->nickname)));
|
||||
|
||||
$feed->addLink($url,
|
||||
array('rel' => 'self',
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
|
||||
// If there's more...
|
||||
|
||||
if ($this->page > 1) {
|
||||
@ -162,9 +164,9 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
$feed->addLink(common_local_url('AtomPubFavoriteFeed',
|
||||
array('profile' =>
|
||||
array('profile' =>
|
||||
$this->_profile->id),
|
||||
array('page' =>
|
||||
array('page' =>
|
||||
$this->page - 1)),
|
||||
array('rel' => 'prev',
|
||||
'type' => 'application/atom+xml'));
|
||||
@ -205,17 +207,17 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function addFavorite()
|
||||
{
|
||||
// XXX: Refactor this; all the same for atompub
|
||||
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_profile->id) {
|
||||
throw new ClientException(_("Can't add someone else's".
|
||||
" subscription"), 403);
|
||||
// TRANS: Client exception thrown when trying to set a favorite for another user.
|
||||
throw new ClientException(_("Cannot add someone else's".
|
||||
" subscription."), 403);
|
||||
}
|
||||
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
|
||||
$dom = DOMDocument::loadXML($xml);
|
||||
@ -234,9 +236,8 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
|
||||
|
||||
if ($activity->verb != ActivityVerb::FAVORITE) {
|
||||
// TRANS: Client error displayed when not using the POST verb.
|
||||
// TRANS: Do not translate POST.
|
||||
throw new ClientException(_('Can only handle Favorite activities.'));
|
||||
// TRANS: Client exception thrown when trying use an incorrect activity verb for the Atom pub method.
|
||||
throw new ClientException(_('Can only handle favorite activities.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -245,6 +246,7 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
if (!in_array($note->type, array(ActivityObject::NOTE,
|
||||
ActivityObject::BLOGENTRY,
|
||||
ActivityObject::STATUS))) {
|
||||
// TRANS: Client exception thrown when trying favorite an object that is not a notice.
|
||||
throw new ClientException(_('Can only fave notices.'));
|
||||
return;
|
||||
}
|
||||
@ -253,13 +255,15 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
|
||||
if (empty($notice)) {
|
||||
// XXX: import from listed URL or something
|
||||
throw new ClientException(_('Unknown note.'));
|
||||
// TRANS: Client exception thrown when trying favorite a notice without content.
|
||||
throw new ClientException(_('Unknown notice.'));
|
||||
}
|
||||
|
||||
$old = Fave::pkeyGet(array('user_id' => $this->auth_user->id,
|
||||
'notice_id' => $notice->id));
|
||||
|
||||
if (!empty($old)) {
|
||||
// TRANS: Client exception thrown when trying favorite an already favorited notice.
|
||||
throw new ClientException(_('Already a favorite.'));
|
||||
}
|
||||
|
||||
@ -296,7 +300,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
@ -328,7 +331,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
@ -339,7 +341,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
@ -359,7 +360,6 @@ class AtompubfavoritefeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function notify($fave, $notice, $user)
|
||||
{
|
||||
$other = User::staticGet('id', $notice->profile_id);
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Feed of group memberships for a user, in ActivityStreams format
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
{
|
||||
private $_profile = null;
|
||||
@ -59,7 +58,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
@ -67,8 +65,9 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
$profileId = $this->trimmed('profile');
|
||||
|
||||
$this->_profile = Profile::staticGet('id', $profileId);
|
||||
|
||||
|
||||
if (empty($this->_profile)) {
|
||||
// TRANS: Client exception.
|
||||
throw new ClientException(_('No such profile.'), 404);
|
||||
}
|
||||
|
||||
@ -78,7 +77,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
$this->_memberships = Group_member::byMember($this->_profile->id,
|
||||
$offset,
|
||||
$limit);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -89,7 +88,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
@ -103,6 +101,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
$this->addMembership();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client exception thrown when using an unsupported HTTP method.
|
||||
throw new ClientException(_('HTTP method not supported.'), 405);
|
||||
return;
|
||||
}
|
||||
@ -115,7 +114,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showFeed()
|
||||
{
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
@ -141,21 +139,25 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
$feed->addAuthor($this->_profile->getBestName(),
|
||||
$this->_profile->getURI());
|
||||
|
||||
// TRANS: Title for group membership feed.
|
||||
// TRANS: %s is a username.
|
||||
$feed->setTitle(sprintf(_("%s group memberships"),
|
||||
$this->_profile->getBestName()));
|
||||
|
||||
$feed->setSubtitle(sprintf(_("Groups %s is a member of on %s"),
|
||||
// TRANS: Subtitle for group membership feed.
|
||||
// TRANS: %1$s is a username, %2$s is the StatusNet sitename.
|
||||
$feed->setSubtitle(sprintf(_('Groups %1$s is a member of on %2$s'),
|
||||
$this->_profile->getBestName(),
|
||||
common_config('site', 'name')));
|
||||
|
||||
$feed->addLink(common_local_url('usergroups',
|
||||
array('nickname' =>
|
||||
array('nickname' =>
|
||||
$this->_profile->nickname)));
|
||||
|
||||
$feed->addLink($url,
|
||||
array('rel' => 'self',
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
|
||||
// If there's more...
|
||||
|
||||
if ($this->page > 1) {
|
||||
@ -164,9 +166,9 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
$feed->addLink(common_local_url('AtomPubMembershipFeed',
|
||||
array('profile' =>
|
||||
array('profile' =>
|
||||
$this->_profile->id),
|
||||
array('page' =>
|
||||
array('page' =>
|
||||
$this->page - 1)),
|
||||
array('rel' => 'prev',
|
||||
'type' => 'application/atom+xml'));
|
||||
@ -207,17 +209,17 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function addMembership()
|
||||
{
|
||||
// XXX: Refactor this; all the same for atompub
|
||||
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_profile->id) {
|
||||
throw new ClientException(_("Can't add someone else's".
|
||||
" membership"), 403);
|
||||
// TRANS: Client exception thrown when trying subscribe someone else to a group.
|
||||
throw new ClientException(_("Cannot add someone else's".
|
||||
" membership."), 403);
|
||||
}
|
||||
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
|
||||
$dom = DOMDocument::loadXML($xml);
|
||||
@ -234,25 +236,26 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
$membership = null;
|
||||
|
||||
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
|
||||
|
||||
if ($activity->verb != ActivityVerb::JOIN) {
|
||||
// TRANS: Client error displayed when not using the POST verb.
|
||||
// TRANS: Do not translate POST.
|
||||
throw new ClientException(_('Can only handle Join activities.'));
|
||||
throw new ClientException(_('Can only handle join activities.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$groupObj = $activity->objects[0];
|
||||
|
||||
if ($groupObj->type != ActivityObject::GROUP) {
|
||||
// TRANS: Client exception thrown when trying favorite an object that is not a notice.
|
||||
throw new ClientException(_('Can only fave notices.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$group = User_group::staticGet('uri', $groupObj->id);
|
||||
|
||||
|
||||
if (empty($group)) {
|
||||
// XXX: import from listed URL or something
|
||||
// TRANS: Client exception thrown when trying to subscribe to a non-existing group.
|
||||
throw new ClientException(_('Unknown group.'));
|
||||
}
|
||||
|
||||
@ -260,6 +263,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
'group_id' => $group->id));
|
||||
|
||||
if (!empty($old)) {
|
||||
// TRANS: Client exception thrown when trying to subscribe to an already subscribed group.
|
||||
throw new ClientException(_('Already a member.'));
|
||||
}
|
||||
|
||||
@ -267,6 +271,7 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
|
||||
if (Group_block::isBlocked($group, $profile)) {
|
||||
// XXX: import from listed URL or something
|
||||
// TRANS: Client exception thrown when trying to subscribe to group while blocked from that group.
|
||||
throw new ClientException(_('Blocked by admin.'));
|
||||
}
|
||||
|
||||
@ -299,7 +304,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
@ -331,7 +335,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
@ -342,7 +345,6 @@ class AtompubmembershipfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Show a single favorite in Atom Activity Streams format
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
{
|
||||
private $_profile = null;
|
||||
@ -62,7 +61,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
@ -73,12 +71,14 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
$this->_profile = Profile::staticGet('id', $profileId);
|
||||
|
||||
if (empty($this->_profile)) {
|
||||
// TRANS: Client exception.
|
||||
throw new ClientException(_('No such profile.'), 404);
|
||||
}
|
||||
|
||||
$this->_notice = Notice::staticGet('id', $noticeId);
|
||||
|
||||
if (empty($this->_notice)) {
|
||||
// TRANS: Client exception thrown when referencing a non-existing notice.
|
||||
throw new ClientException(_('No such notice.'), 404);
|
||||
}
|
||||
|
||||
@ -86,6 +86,7 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
'notice_id' => $noticeId));
|
||||
|
||||
if (empty($this->_fave)) {
|
||||
// TRANS: Client exception thrown when referencing a non-existing favorite.
|
||||
throw new ClientException(_('No such favorite.'), 404);
|
||||
}
|
||||
|
||||
@ -99,7 +100,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
@ -113,6 +113,7 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
$this->deleteFave();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client exception thrown using an unsupported HTTP method.
|
||||
throw new ClientException(_('HTTP method not supported.'),
|
||||
405);
|
||||
}
|
||||
@ -121,10 +122,9 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
|
||||
/**
|
||||
* Show a single favorite, in ActivityStreams format
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showFave()
|
||||
{
|
||||
$activity = $this->_fave->asActivity();
|
||||
@ -140,16 +140,16 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
|
||||
/**
|
||||
* Delete the favorite
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function deleteFave()
|
||||
{
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_profile->id) {
|
||||
throw new ClientException(_("Can't delete someone else's".
|
||||
" favorite"), 403);
|
||||
// TRANS: Client exception thrown when trying to remove a favorite notice of another user.
|
||||
throw new ClientException(_("Cannot delete someone else's".
|
||||
" favorite."), 403);
|
||||
}
|
||||
|
||||
$this->_fave->delete();
|
||||
@ -166,7 +166,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
@ -184,7 +183,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
|
||||
function lastModified()
|
||||
{
|
||||
return max(strtotime($this->_profile->modified),
|
||||
@ -199,7 +197,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
$mtime = strtotime($this->_fave->modified);
|
||||
@ -215,7 +212,6 @@ class AtompubshowfavoriteAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Show a single membership as an Activity Streams entry
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubshowmembershipAction extends ApiAuthAction
|
||||
{
|
||||
private $_profile = null;
|
||||
@ -60,7 +59,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
@ -68,8 +66,9 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
$profileId = $this->trimmed('profile');
|
||||
|
||||
$this->_profile = Profile::staticGet('id', $profileId);
|
||||
|
||||
|
||||
if (empty($this->_profile)) {
|
||||
// TRANS: Client exception.
|
||||
throw new ClientException(_('No such profile.'), 404);
|
||||
}
|
||||
|
||||
@ -78,7 +77,8 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
$this->_group = User_group::staticGet('id', $groupId);
|
||||
|
||||
if (empty($this->_group)) {
|
||||
throw new ClientException(_('No such group'), 404);
|
||||
// TRANS: Client exception thrown when referencing a non-existing group.
|
||||
throw new ClientException(_('No such group.'), 404);
|
||||
}
|
||||
|
||||
$kv = array('group_id' => $groupId,
|
||||
@ -87,7 +87,8 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
$this->_membership = Group_member::pkeyGet($kv);
|
||||
|
||||
if (empty($this->_membership)) {
|
||||
throw new ClientException(_('Not a member'), 404);
|
||||
// TRANS: Client exception thrown when trying to show membership of a non-subscribed group
|
||||
throw new ClientException(_('Not a member.'), 404);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -100,7 +101,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
@ -112,7 +112,8 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
$this->deleteMembership();
|
||||
break;
|
||||
default:
|
||||
throw new ClientException(_('Method not supported'), 405);
|
||||
// TRANS: Client exception thrown when using an unsupported HTTP method.
|
||||
throw new ClientException(_('HTTP method not supported.'), 405);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
@ -123,7 +124,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showMembership()
|
||||
{
|
||||
$activity = $this->_membership->asActivity();
|
||||
@ -142,13 +142,13 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function deleteMembership()
|
||||
{
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_profile->id) {
|
||||
throw new ClientException(_("Can't delete someone else's".
|
||||
" membership"), 403);
|
||||
// TRANS: Client exception thrown when deleting someone else's membership.
|
||||
throw new ClientException(_("Cannot delete someone else's".
|
||||
" membership."), 403);
|
||||
}
|
||||
|
||||
if (Event::handle('StartLeaveGroup', array($this->_group, $this->auth_user))) {
|
||||
@ -168,7 +168,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
@ -203,7 +202,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
$ctime = strtotime($this->_membership->created);
|
||||
@ -222,7 +220,6 @@ class AtompubshowmembershipAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET' ||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Single subscription
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -46,21 +46,19 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
{
|
||||
private $_subscriber = null;
|
||||
private $_subscribed = null;
|
||||
private $_subscription = null;
|
||||
|
||||
/**
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
@ -69,7 +67,9 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
$this->_subscriber = Profile::staticGet('id', $subscriberId);
|
||||
|
||||
if (empty($this->_subscriber)) {
|
||||
throw new ClientException(sprintf(_('No such profile id: %d'),
|
||||
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
|
||||
// TRANS: %d is the non-existing profile ID number.
|
||||
throw new ClientException(sprintf(_('No such profile id: %d.'),
|
||||
$subscriberId), 404);
|
||||
}
|
||||
|
||||
@ -78,16 +78,20 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
$this->_subscribed = Profile::staticGet('id', $subscribedId);
|
||||
|
||||
if (empty($this->_subscribed)) {
|
||||
throw new ClientException(sprintf(_('No such profile id: %d'),
|
||||
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
|
||||
// TRANS: %d is the non-existing profile ID number.
|
||||
throw new ClientException(sprintf(_('No such profile id: %d.'),
|
||||
$subscribedId), 404);
|
||||
}
|
||||
|
||||
$this->_subscription =
|
||||
$this->_subscription =
|
||||
Subscription::pkeyGet(array('subscriber' => $subscriberId,
|
||||
'subscribed' => $subscribedId));
|
||||
|
||||
if (empty($this->_subscription)) {
|
||||
$msg = sprintf(_('Profile %d not subscribed to profile %d'),
|
||||
// TRANS: Client exception thrown when trying to display a subscription for a non-subscribed profile ID.
|
||||
// TRANS: %1$d is the non-existing subscriber ID number, $2$d is the ID of the profile that was not subscribed to.
|
||||
$msg = sprintf(_('Profile %1$d not subscribed to profile %2$d.'),
|
||||
$subscriberId, $subscribedId);
|
||||
throw new ClientException($msg, 404);
|
||||
}
|
||||
@ -102,7 +106,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
@ -115,6 +118,7 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
$this->deleteSubscription();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client error shown when using a non-supported HTTP method.
|
||||
$this->clientError(_('HTTP method not supported.'), 405);
|
||||
return;
|
||||
}
|
||||
@ -127,7 +131,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showSubscription()
|
||||
{
|
||||
$activity = $this->_subscription->asActivity();
|
||||
@ -146,13 +149,13 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function deleteSubscription()
|
||||
{
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_subscriber->id) {
|
||||
throw new ClientException(_("Can't delete someone else's".
|
||||
" subscription"), 403);
|
||||
// TRANS: Client exception thrown when trying to delete a subscription of another user.
|
||||
throw new ClientException(_("Cannot delete someone else's ".
|
||||
"subscription."), 403);
|
||||
}
|
||||
|
||||
Subscription::cancel($this->_subscriber,
|
||||
@ -168,7 +171,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
|
||||
@ -183,7 +185,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
|
||||
function lastModified()
|
||||
{
|
||||
return max(strtotime($this->_subscriber->modified),
|
||||
@ -196,7 +197,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
$mtime = strtotime($this->_subscription->modified);
|
||||
@ -212,7 +212,6 @@ class AtompubshowsubscriptionAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'DELETE') {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* AtomPub subscription feed
|
||||
*
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -40,7 +40,7 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* Subscription feed class for AtomPub
|
||||
*
|
||||
* Generates a list of the user's subscriptions
|
||||
*
|
||||
*
|
||||
* @category AtomPub
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apiauth.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
{
|
||||
private $_profile = null;
|
||||
@ -61,17 +60,18 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
|
||||
|
||||
$subscriber = $this->trimmed('subscriber');
|
||||
|
||||
$this->_profile = Profile::staticGet('id', $subscriber);
|
||||
|
||||
if (empty($this->_profile)) {
|
||||
throw new ClientException(sprintf(_('No such profile id: %d'),
|
||||
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
|
||||
// TRANS: %d is the non-existing profile ID number.
|
||||
throw new ClientException(sprintf(_('No such profile id: %d.'),
|
||||
$subscriber), 404);
|
||||
}
|
||||
|
||||
@ -93,7 +93,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
@ -106,6 +105,7 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
$this->addSubscription();
|
||||
break;
|
||||
default:
|
||||
// TRANS: Client exception thrown when using an unsupported HTTP method.
|
||||
$this->clientError(_('HTTP method not supported.'), 405);
|
||||
return;
|
||||
}
|
||||
@ -118,7 +118,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showFeed()
|
||||
{
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
@ -144,21 +143,25 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
$feed->addAuthor($this->_profile->getBestName(),
|
||||
$this->_profile->getURI());
|
||||
|
||||
// TRANS: Title for Atom subscription feed.
|
||||
// TRANS: %s is a user nickname.
|
||||
$feed->setTitle(sprintf(_("%s subscriptions"),
|
||||
$this->_profile->getBestName()));
|
||||
|
||||
$feed->setSubtitle(sprintf(_("People %s has subscribed to on %s"),
|
||||
// TRANS: Subtitle for Atom subscription feed.
|
||||
// TRANS: %1$s is a user nickname, %s$s is the StatusNet sitename.
|
||||
$feed->setSubtitle(sprintf(_("People %1\$s has subscribed to on %2\$s"),
|
||||
$this->_profile->getBestName(),
|
||||
common_config('site', 'name')));
|
||||
|
||||
$feed->addLink(common_local_url('subscriptions',
|
||||
array('nickname' =>
|
||||
array('nickname' =>
|
||||
$this->_profile->nickname)));
|
||||
|
||||
$feed->addLink($url,
|
||||
array('rel' => 'self',
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
|
||||
// If there's more...
|
||||
|
||||
if ($this->page > 1) {
|
||||
@ -167,9 +170,9 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
'type' => 'application/atom+xml'));
|
||||
|
||||
$feed->addLink(common_local_url('AtomPubSubscriptionFeed',
|
||||
array('subscriber' =>
|
||||
array('subscriber' =>
|
||||
$this->_profile->id),
|
||||
array('page' =>
|
||||
array('page' =>
|
||||
$this->page - 1)),
|
||||
array('rel' => 'prev',
|
||||
'type' => 'application/atom+xml'));
|
||||
@ -214,15 +217,15 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function addSubscription()
|
||||
{
|
||||
if (empty($this->auth_user) ||
|
||||
$this->auth_user->id != $this->_profile->id) {
|
||||
throw new ClientException(_("Can't add someone else's".
|
||||
" subscription"), 403);
|
||||
// TRANS: Client exception thrown when trying to subscribe another user.
|
||||
throw new ClientException(_("Cannot add someone else's".
|
||||
" subscription."), 403);
|
||||
}
|
||||
|
||||
|
||||
$xml = file_get_contents('php://input');
|
||||
|
||||
$dom = DOMDocument::loadXML($xml);
|
||||
@ -241,8 +244,7 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
if (Event::handle('StartAtomPubNewActivity', array(&$activity))) {
|
||||
|
||||
if ($activity->verb != ActivityVerb::FOLLOW) {
|
||||
// TRANS: Client error displayed when not using the POST verb.
|
||||
// TRANS: Do not translate POST.
|
||||
// TRANS: Client error displayed when not using the follow verb.
|
||||
$this->clientError(_('Can only handle Follow activities.'));
|
||||
return;
|
||||
}
|
||||
@ -250,6 +252,7 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
$person = $activity->objects[0];
|
||||
|
||||
if ($person->type != ActivityObject::PERSON) {
|
||||
// TRANS: Client exception thrown when subscribing to an object that is not a person.
|
||||
$this->clientError(_('Can only follow people.'));
|
||||
return;
|
||||
}
|
||||
@ -259,7 +262,19 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
$profile = Profile::fromURI($person->id);
|
||||
|
||||
if (empty($profile)) {
|
||||
$this->clientError(sprintf(_('Unknown profile %s'), $person->id));
|
||||
// TRANS: Client exception thrown when subscribing to a non-existing profile.
|
||||
// TRANS: %s is the unknown profile ID.
|
||||
$this->clientError(sprintf(_('Unknown profile %s.'), $person->id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Subscription::exists($this->_profile, $profile)) {
|
||||
// 409 Conflict
|
||||
// TRANS: Client error displayed trying to subscribe to an already subscribed profile.
|
||||
// TRANS: %s is the profile the user already has a subscription on.
|
||||
$this->clientError(sprintf(_('Already subscribed to %s.'),
|
||||
$person->id),
|
||||
409);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -290,7 +305,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return $_SERVER['REQUEST_METHOD'] != 'POST';
|
||||
@ -301,7 +315,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
|
||||
function lastModified()
|
||||
{
|
||||
return null;
|
||||
@ -312,7 +325,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
@ -323,7 +335,6 @@ class AtompubsubscriptionfeedAction extends ApiAuthAction
|
||||
*
|
||||
* @return boolean true if delete, else false
|
||||
*/
|
||||
|
||||
function requiresAuth()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
|
||||
|
||||
define('MAX_ORIGINAL', 480);
|
||||
|
||||
@ -49,7 +49,7 @@ define('MAX_ORIGINAL', 480);
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class AvatarsettingsAction extends AccountSettingsAction
|
||||
class AvatarsettingsAction extends SettingsAction
|
||||
{
|
||||
var $mode = null;
|
||||
var $imagefile = null;
|
||||
@ -157,13 +157,13 @@ class AvatarsettingsAction extends AccountSettingsAction
|
||||
}
|
||||
|
||||
$this->elementStart('li', array ('id' => 'settings_attach'));
|
||||
$this->element('input', array('name' => 'avatarfile',
|
||||
'type' => 'file',
|
||||
'id' => 'avatarfile'));
|
||||
$this->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->element('input', array('name' => 'avatarfile',
|
||||
'type' => 'file',
|
||||
'id' => 'avatarfile'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
||||
@ -211,7 +211,7 @@ class AvatarsettingsAction extends AccountSettingsAction
|
||||
array('id' => 'avatar_original',
|
||||
'class' => 'avatar_view'));
|
||||
// TRANS: Header on avatar upload crop form for thumbnail of originally uploaded avatar (h2).
|
||||
$this->element('h2', null, _("Original"));
|
||||
$this->element('h2', null, _('Original'));
|
||||
$this->elementStart('div', array('id'=>'avatar_original_view'));
|
||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||
'width' => $this->filedata['width'],
|
||||
@ -224,7 +224,7 @@ class AvatarsettingsAction extends AccountSettingsAction
|
||||
array('id' => 'avatar_preview',
|
||||
'class' => 'avatar_view'));
|
||||
// TRANS: Header on avatar upload crop form for thumbnail of to be used rendition of uploaded avatar (h2).
|
||||
$this->element('h2', null, _("Preview"));
|
||||
$this->element('h2', null, _('Preview'));
|
||||
$this->elementStart('div', array('id'=>'avatar_preview_view'));
|
||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||
'width' => AVATAR_PROFILE_SIZE,
|
||||
@ -320,21 +320,20 @@ class AvatarsettingsAction extends AccountSettingsAction
|
||||
}
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
$type = $imagefile->preferredType();
|
||||
$filename = Avatar::filename($cur->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
image_type_to_extension($type),
|
||||
null,
|
||||
'tmp'.common_timestamp());
|
||||
|
||||
$filepath = Avatar::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
$imagefile->copyTo($filepath);
|
||||
|
||||
$filedata = array('filename' => $filename,
|
||||
'filepath' => $filepath,
|
||||
'width' => $imagefile->width,
|
||||
'height' => $imagefile->height,
|
||||
'type' => $imagefile->type);
|
||||
'type' => $type);
|
||||
|
||||
$_SESSION['FILEDATA'] = $filedata;
|
||||
|
||||
@ -342,8 +341,8 @@ class AvatarsettingsAction extends AccountSettingsAction
|
||||
|
||||
$this->mode = 'crop';
|
||||
|
||||
// TRANS: Avatar upload form unstruction after uploading a file.
|
||||
$this->showForm(_('Pick a square area of the image to be your avatar'),
|
||||
// TRANS: Avatar upload form instruction after uploading a file.
|
||||
$this->showForm(_('Pick a square area of the image to be your avatar.'),
|
||||
true);
|
||||
}
|
||||
|
||||
|
256
actions/backupaccount.php
Normal file
256
actions/backupaccount.php
Normal file
@ -0,0 +1,256 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Download a backup of your own account to the browser
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a backup of your own account to the browser
|
||||
*
|
||||
* We go through some hoops to make this only respond to POST, since
|
||||
* it's kind of expensive and there's probably some downside to having
|
||||
* your account in all kinds of search engines.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class BackupaccountAction extends Action
|
||||
{
|
||||
/**
|
||||
* Returns the title of the page
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for backup account page.
|
||||
return _('Backup account');
|
||||
}
|
||||
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
if (empty($cur)) {
|
||||
// TRANS: Client exception thrown when trying to backup an account while not logged in.
|
||||
throw new ClientException(_('Only logged-in users can backup their account.'), 403);
|
||||
}
|
||||
|
||||
if (!$cur->hasRight(Right::BACKUPACCOUNT)) {
|
||||
// TRANS: Client exception thrown when trying to backup an account without having backup rights.
|
||||
throw new ClientException(_('You may not backup your account.'), 403);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
|
||||
if ($this->isPost()) {
|
||||
$this->sendFeed();
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a feed of the user's activities to the browser
|
||||
*
|
||||
* Uses the UserActivityStream class; may take a long time!
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function sendFeed()
|
||||
{
|
||||
$cur = common_current_user();
|
||||
|
||||
$stream = new UserActivityStream($cur, true, UserActivityStream::OUTPUT_RAW);
|
||||
|
||||
header('Content-Disposition: attachment; filename='.$cur->nickname.'.atom');
|
||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||
|
||||
// @fixme atom feed logic is in getString...
|
||||
// but we just want it to output to the outputter.
|
||||
$this->raw($stream->getString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a little form so that the person can request a backup.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$form = new BackupAccountForm($this);
|
||||
$form->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if read only.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @param array $args other arguments
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last modified, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
function lastModified()
|
||||
{
|
||||
// For comparison with If-Last-Modified
|
||||
// If not applicable, return null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return etag, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A form for backing up the account.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class BackupAccountForm extends Form
|
||||
{
|
||||
/**
|
||||
* Class of the form.
|
||||
*
|
||||
* @return string the form's class
|
||||
*/
|
||||
function formClass()
|
||||
{
|
||||
return 'form_profile_backup';
|
||||
}
|
||||
|
||||
/**
|
||||
* URL the form posts to
|
||||
*
|
||||
* @return string the form's action URL
|
||||
*/
|
||||
function action()
|
||||
{
|
||||
return common_local_url('backupaccount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Output form data
|
||||
*
|
||||
* Really, just instructions for doing a backup.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
{
|
||||
$msg =
|
||||
// TRANS: Information displayed on the backup account page.
|
||||
_('You can backup your account data in '.
|
||||
'<a href="http://activitystrea.ms/">Activity Streams</a> '.
|
||||
'format. This is an experimental feature and provides an '.
|
||||
'incomplete backup; private account '.
|
||||
'information like email and IM addresses is not backed up. '.
|
||||
'Additionally, uploaded files and direct messages are not '.
|
||||
'backed up.');
|
||||
$this->out->elementStart('p');
|
||||
$this->out->raw($msg);
|
||||
$this->out->elementEnd('p');
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons for the form
|
||||
*
|
||||
* In this case, a single submit button
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit('submit',
|
||||
// TRANS: Submit button to backup an account on the backup account page.
|
||||
_m('BUTTON', 'Backup'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Title for submit button to backup an account on the backup account page.
|
||||
_('Backup your account.'));
|
||||
}
|
||||
}
|
@ -155,14 +155,14 @@ class BlockAction extends ProfileFormAction
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when blocking a user.
|
||||
_('Do not block this user'));
|
||||
_('Do not block this user.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the user block form.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'yes',
|
||||
// TRANS: Submit button title for 'Yes' when blocking a user.
|
||||
_('Block this user'));
|
||||
_('Block this user.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
@ -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();
|
||||
|
325
actions/deleteaccount.php
Normal file
325
actions/deleteaccount.php
Normal file
@ -0,0 +1,325 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Delete your own account
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to delete your own account
|
||||
*
|
||||
* Note that this is distinct from DeleteuserAction, which see. I thought
|
||||
* that making that action do both things (delete another user and delete the
|
||||
* current user) would open a lot of holes. I'm open to refactoring, however.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class DeleteaccountAction extends Action
|
||||
{
|
||||
private $_complete = false;
|
||||
private $_error = null;
|
||||
|
||||
/**
|
||||
* For initializing members of the class.
|
||||
*
|
||||
* @param array $argarray misc. arguments
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
if (empty($cur)) {
|
||||
// TRANS: Client exception displayed trying to delete a user account while not logged in.
|
||||
throw new ClientException(_("Only logged-in users ".
|
||||
"can delete their account."), 403);
|
||||
}
|
||||
|
||||
if (!$cur->hasRight(Right::DELETEACCOUNT)) {
|
||||
// TRANS: Client exception displayed trying to delete a user account without have the rights to do that.
|
||||
throw new ClientException(_("You cannot delete your account."), 403);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler method
|
||||
*
|
||||
* @param array $argarray is ignored since it's now passed in in prepare()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
|
||||
if ($this->isPost()) {
|
||||
$this->deleteAccount();
|
||||
} else {
|
||||
$this->showPage();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if read only.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @param array $args other arguments
|
||||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last modified, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
function lastModified()
|
||||
{
|
||||
// For comparison with If-Last-Modified
|
||||
// If not applicable, return null
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return etag, if applicable.
|
||||
*
|
||||
* MAY override
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the current user's account
|
||||
*
|
||||
* Checks for the "I am sure." string to make sure the user really
|
||||
* wants to delete their account.
|
||||
*
|
||||
* Then, marks the account as deleted and begins the deletion process
|
||||
* (actually done by a back-end handler).
|
||||
*
|
||||
* If successful it logs the user out, and shows a brief completion message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function deleteAccount()
|
||||
{
|
||||
$this->checkSessionToken();
|
||||
// !!! If this string is changed, it also needs to be changed in DeleteAccountForm::formData()
|
||||
// TRANS: Confirmation text for user deletion. The user has to type this exactly the same, including punctuation.
|
||||
$iamsure = _('I am sure.');
|
||||
if ($this->trimmed('iamsure') != $iamsure ) {
|
||||
// TRANS: Notification for user about the text that must be input to be able to delete a user account.
|
||||
// TRANS: %s is the text that needs to be input.
|
||||
$this->_error = sprintf(_('You must write "%s" exactly in the box.'), $iamsure);
|
||||
$this->showPage();
|
||||
return;
|
||||
}
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
// Mark the account as deleted and shove low-level deletion tasks
|
||||
// to background queues. Removing a lot of posts can take a while...
|
||||
|
||||
if (!$cur->hasRole(Profile_role::DELETED)) {
|
||||
$cur->grantRole(Profile_role::DELETED);
|
||||
}
|
||||
|
||||
$qm = QueueManager::get();
|
||||
$qm->enqueue($cur, 'deluser');
|
||||
|
||||
// The user is really-truly logged out
|
||||
|
||||
common_set_user(null);
|
||||
common_real_login(false); // not logged in
|
||||
common_forgetme(); // don't log back in!
|
||||
|
||||
$this->_complete = true;
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the page content.
|
||||
*
|
||||
* If the deletion is complete, just shows a completion message.
|
||||
*
|
||||
* Otherwise, shows the deletion form.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
function showContent()
|
||||
{
|
||||
if ($this->_complete) {
|
||||
$this->element('p', 'confirmation',
|
||||
// TRANS: Confirmation that a user account has been deleted.
|
||||
_('Account deleted.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($this->_error)) {
|
||||
$this->element('p', 'error', $this->_error);
|
||||
$this->_error = null;
|
||||
}
|
||||
|
||||
$form = new DeleteAccountForm($this);
|
||||
$form->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the title of the page
|
||||
*
|
||||
* @return string title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for page on which a user account can be deleted.
|
||||
return _('Delete account');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Form for deleting your account
|
||||
*
|
||||
* Note that this mostly is here to keep you from accidentally deleting your
|
||||
* account.
|
||||
*
|
||||
* @category Account
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
class DeleteAccountForm extends Form
|
||||
{
|
||||
/**
|
||||
* Class of the form.
|
||||
*
|
||||
* @return string the form's class
|
||||
*/
|
||||
function formClass()
|
||||
{
|
||||
return 'form_profile_delete';
|
||||
}
|
||||
|
||||
/**
|
||||
* URL the form posts to
|
||||
*
|
||||
* @return string the form's action URL
|
||||
*/
|
||||
function action()
|
||||
{
|
||||
return common_local_url('deleteaccount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Output form data
|
||||
*
|
||||
* Instructions plus an 'i am sure' entry box.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formData()
|
||||
{
|
||||
$cur = common_current_user();
|
||||
|
||||
// TRANS: Form text for user deletion form.
|
||||
$msg = '<p>' . _('This will <strong>permanently delete</strong> '.
|
||||
'your account data from this server.') . '</p>';
|
||||
|
||||
if ($cur->hasRight(Right::BACKUPACCOUNT)) {
|
||||
// TRANS: Additional form text for user deletion form shown if a user has account backup rights.
|
||||
// TRANS: %s is a URL to the backup page.
|
||||
$msg .= '<p>' . sprintf(_('You are strongly advised to '.
|
||||
'<a href="%s">back up your data</a>'.
|
||||
' before deletion.'),
|
||||
common_local_url('backupaccount')) . '</p>';
|
||||
}
|
||||
|
||||
$this->out->elementStart('p');
|
||||
$this->out->raw($msg);
|
||||
$this->out->elementEnd('p');
|
||||
|
||||
// !!! If this string is changed, it also needs to be changed in class DeleteaccountAction.
|
||||
// TRANS: Confirmation text for user deletion. The user has to type this exactly the same, including punctuation.
|
||||
$iamsure = _("I am sure.");
|
||||
$this->out->input('iamsure',
|
||||
// TRANS: Field label for delete account confirmation entry.
|
||||
_('Confirm'),
|
||||
null,
|
||||
// TRANS: Input title for the delete account field.
|
||||
// TRANS: %s is the text that needs to be input.
|
||||
sprintf(_('Enter "%s" to confirm that '.
|
||||
'you want to delete your account.'),$iamsure ));
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons for the form
|
||||
*
|
||||
* In this case, a single submit button
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit('submit',
|
||||
// TRANS: Button text for user account deletion.
|
||||
_m('BUTTON', 'Delete'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Button title for user account deletion.
|
||||
_('Permanently delete your account'));
|
||||
}
|
||||
}
|
@ -158,13 +158,13 @@ class DeleteapplicationAction extends Action
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when deleting an application.
|
||||
_('Do not delete this application'));
|
||||
_('Do not delete this application.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the delete application form.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
// TRANS: Submit button title for 'Yes' when deleting an application.
|
||||
'yes', _('Delete this application'));
|
||||
'yes', _('Delete this application.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
@ -221,14 +221,14 @@ class DeletegroupAction extends RedirectingAction
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when deleting a group.
|
||||
_('Do not delete this group'));
|
||||
_('Do not delete this group.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the delete group form.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'yes',
|
||||
// TRANS: Submit button title for 'Yes' when deleting a group.
|
||||
_('Delete this group'));
|
||||
_('Delete this group.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class DeletenoticeAction extends Action
|
||||
if ($this->notice->profile_id != $this->user_profile->id &&
|
||||
!$this->user->hasRight(Right::DELETEOTHERSNOTICE)) {
|
||||
// TRANS: Error message displayed trying to delete a notice that was not made by the current user.
|
||||
common_user_error(_('Can\'t delete this notice.'));
|
||||
common_user_error(_('Cannot delete this notice.'));
|
||||
exit;
|
||||
}
|
||||
// XXX: Ajax!
|
||||
@ -156,14 +156,14 @@ class DeletenoticeAction extends Action
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when deleting a notice.
|
||||
_("Do not delete this notice"));
|
||||
_('Do not delete this notice.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the delete notice form.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'yes',
|
||||
// TRANS: Submit button title for 'Yes' when deleting a notice.
|
||||
_('Delete this notice'));
|
||||
_('Delete this notice.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class DeleteuserAction extends ProfileFormAction
|
||||
{
|
||||
var $user = null;
|
||||
@ -52,7 +51,6 @@ class DeleteuserAction extends ProfileFormAction
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
if (!parent::prepare($args)) {
|
||||
@ -64,6 +62,7 @@ class DeleteuserAction extends ProfileFormAction
|
||||
assert(!empty($cur)); // checked by parent
|
||||
|
||||
if (!$cur->hasRight(Right::DELETEUSER)) {
|
||||
// TRANS: Client error displayed when trying to delete a user without having the right to delete users.
|
||||
$this->clientError(_('You cannot delete users.'));
|
||||
return false;
|
||||
}
|
||||
@ -71,6 +70,7 @@ class DeleteuserAction extends ProfileFormAction
|
||||
$this->user = User::staticGet('id', $this->profile->id);
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client error displayed when trying to delete a non-local user.
|
||||
$this->clientError(_('You can only delete local users.'));
|
||||
return false;
|
||||
}
|
||||
@ -87,7 +87,6 @@ class DeleteuserAction extends ProfileFormAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
@ -107,7 +106,8 @@ class DeleteuserAction extends ProfileFormAction
|
||||
}
|
||||
|
||||
function title() {
|
||||
return _('Delete user');
|
||||
// TRANS: Title of delete user page.
|
||||
return _m('TITLE','Delete user');
|
||||
}
|
||||
|
||||
function showNoticeForm() {
|
||||
@ -130,9 +130,11 @@ class DeleteuserAction extends ProfileFormAction
|
||||
'action' => common_local_url('deleteuser')));
|
||||
$this->elementStart('fieldset');
|
||||
$this->hidden('token', common_session_token());
|
||||
// TRANS: Fieldset legend on delete user page.
|
||||
$this->element('legend', _('Delete user'));
|
||||
if (Event::handle('StartDeleteUserForm', array($this, $this->user))) {
|
||||
$this->element('p', null,
|
||||
// TRANS: Information text to request if a user is certain that the described action has to be performed.
|
||||
_('Are you sure you want to delete this user? '.
|
||||
'This will clear all data about the user from the '.
|
||||
'database, without a backup.'));
|
||||
@ -153,14 +155,14 @@ class DeleteuserAction extends ProfileFormAction
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when deleting a user.
|
||||
_('Do not block this user'));
|
||||
_('Do not delete this user.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the delete user form.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'yes',
|
||||
// TRANS: Submit button title for 'Yes' when deleting a user.
|
||||
_('Delete this user'));
|
||||
_('Delete this user.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
@ -170,7 +172,6 @@ class DeleteuserAction extends ProfileFormAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
if (Event::handle('StartDeleteUser', array($this, $this->user))) {
|
||||
|
@ -44,10 +44,8 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class DesignadminpanelAction extends AdminPanelAction
|
||||
{
|
||||
|
||||
/* The default site design */
|
||||
var $design = null;
|
||||
|
||||
@ -56,7 +54,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Message used as title for design settings for the site.
|
||||
@ -68,9 +65,9 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return string instructions
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for design adminsitration panel.
|
||||
return _('Design settings for this StatusNet site');
|
||||
}
|
||||
|
||||
@ -79,7 +76,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showForm()
|
||||
{
|
||||
$this->design = Design::siteDesign();
|
||||
@ -93,7 +89,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveSettings()
|
||||
{
|
||||
if ($this->arg('save')) {
|
||||
@ -101,6 +96,7 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
} else if ($this->arg('defaults')) {
|
||||
$this->restoreDefaults();
|
||||
} else {
|
||||
// TRANS: Client error displayed when the submitted form contains unexpected data.
|
||||
$this->clientError(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
@ -110,7 +106,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveDesignSettings()
|
||||
{
|
||||
// Workaround for PHP returning empty $_POST and $_FILES when POST
|
||||
@ -225,11 +220,10 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the default design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
* Restore the default design
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function restoreDefaults()
|
||||
{
|
||||
$this->deleteSetting('site', 'logo');
|
||||
@ -257,7 +251,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return string $filename the filename of the image
|
||||
*/
|
||||
|
||||
function saveBackgroundImage()
|
||||
{
|
||||
$filename = null;
|
||||
@ -302,7 +295,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
* @throws ClientException for invalid theme archives
|
||||
* @throws ServerException if trouble saving the theme files
|
||||
*/
|
||||
|
||||
function saveCustomTheme()
|
||||
{
|
||||
if (common_config('theme_upload', 'enabled') &&
|
||||
@ -327,21 +319,24 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function validate(&$values)
|
||||
{
|
||||
if (!empty($values['logo']) &&
|
||||
!Validate::uri($values['logo'], array('allowed_schemes' => array('http', 'https')))) {
|
||||
// TRANS: Client error displayed when a logo URL does is not valid.
|
||||
$this->clientError(_('Invalid logo URL.'));
|
||||
}
|
||||
|
||||
if (!empty($values['ssllogo']) &&
|
||||
!Validate::uri($values['ssllogo'], array('allowed_schemes' => array('https')))) {
|
||||
// TRANS: Client error displayed when an SSL logo URL is invalid.
|
||||
$this->clientError(_('Invalid SSL logo URL.'));
|
||||
}
|
||||
|
||||
if (!in_array($values['theme'], Theme::listAvailable())) {
|
||||
$this->clientError(sprintf(_("Theme not available: %s."), $values['theme']));
|
||||
// TRANS: Client error displayed when a theme is submitted through the form that is not in the theme list.
|
||||
// TRANS: %s is the chosen unavailable theme.
|
||||
$this->clientError(sprintf(_('Theme not available: %s.'), $values['theme']));
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +345,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showStylesheets()
|
||||
{
|
||||
parent::showStylesheets();
|
||||
@ -362,7 +356,6 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
@ -383,7 +376,6 @@ class DesignAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
|
||||
function id()
|
||||
{
|
||||
return 'form_design_admin_panel';
|
||||
@ -394,7 +386,6 @@ class DesignAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
@ -408,7 +399,6 @@ class DesignAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return string the method to use for submitting
|
||||
*/
|
||||
|
||||
function method()
|
||||
{
|
||||
$this->enctype = 'multipart/form-data';
|
||||
@ -421,7 +411,6 @@ class DesignAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
|
||||
function action()
|
||||
{
|
||||
return common_local_url('designadminpanel');
|
||||
@ -432,7 +421,6 @@ class DesignAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$this->showLogo();
|
||||
@ -445,16 +433,25 @@ class DesignAdminPanelForm extends AdminForm
|
||||
function showLogo()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_logo'));
|
||||
// TRANS: Fieldset legend for form to change logo.
|
||||
$this->out->element('legend', null, _('Change logo'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input('logo', _('Site logo'), 'Logo for the site (full URL)');
|
||||
$this->input('logo',
|
||||
// TRANS: Field label for StatusNet site logo.
|
||||
_('Site logo'),
|
||||
// TRANS: Title for field label for StatusNet site logo.
|
||||
'Logo for the site (full URL).');
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->input('ssllogo', _('SSL logo'), 'Logo to show on SSL pages');
|
||||
$this->input('ssllogo',
|
||||
// TRANS: Field label for SSL StatusNet site logo.
|
||||
_('SSL logo'),
|
||||
// TRANS: Title for field label for SSL StatusNet site logo.
|
||||
'Logo to show on SSL pages.');
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
@ -466,6 +463,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
function showTheme()
|
||||
{
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_theme'));
|
||||
// TRANS: Fieldset legend for form change StatusNet site's theme.
|
||||
$this->out->element('legend', null, _('Change theme'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
@ -483,17 +481,21 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$themes = array_combine($themes, $themes);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for dropdown to choose site theme.
|
||||
$this->out->dropdown('theme', _('Site theme'),
|
||||
// TRANS: Title for field label for dropdown to choose site theme.
|
||||
$themes, _('Theme for the site.'),
|
||||
false, $this->value('theme'));
|
||||
$this->unli();
|
||||
|
||||
if (common_config('theme_upload', 'enabled')) {
|
||||
$this->li();
|
||||
// TRANS: Field label for uploading a cutom theme.
|
||||
$this->out->element('label', array('for' => 'design_upload_theme'), _('Custom theme'));
|
||||
$this->out->element('input', array('id' => 'design_upload_theme',
|
||||
'name' => 'design_upload_theme',
|
||||
'type' => 'file'));
|
||||
// TRANS: Form instructions for uploading a cutom StatusNet theme.
|
||||
$this->out->element('p', 'form_guide', _('You can upload a custom StatusNet theme as a .ZIP archive.'));
|
||||
$this->unli();
|
||||
}
|
||||
@ -509,22 +511,25 @@ class DesignAdminPanelForm extends AdminForm
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' =>
|
||||
'settings_design_background-image'));
|
||||
// TRANS: Fieldset legend for theme background image.
|
||||
$this->out->element('legend', null, _('Change background image'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->out->element('label', array('for' => 'design_background-image_file'),
|
||||
// TRANS: Field label for background image on theme designer page.
|
||||
_('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background-image_file',
|
||||
'type' => 'file',
|
||||
'id' => 'design_background-image_file'));
|
||||
$this->out->element('p', 'form_guide',
|
||||
// TRANS: Form guide for background image upload form on theme designer page.
|
||||
sprintf(_('You can upload a background image for the site. ' .
|
||||
'The maximum file size is %1$s.'), ImageFile::maxFileSize()));
|
||||
$this->out->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->unli();
|
||||
|
||||
if (!empty($design->backgroundimage)) {
|
||||
@ -568,11 +573,13 @@ class DesignAdminPanelForm extends AdminForm
|
||||
'class' => 'radio'),
|
||||
// TRANS: Used as radio button label to not add a background image.
|
||||
_('Off'));
|
||||
// TRANS: Form guide for turning background image on or off on theme designer page.
|
||||
$this->out->element('p', 'form_guide', _('Turn background image on or off.'));
|
||||
$this->unli();
|
||||
|
||||
$this->li();
|
||||
$this->out->checkbox('design_background-image_repeat',
|
||||
// TRANS: Checkbox label to title background image on theme designer page.
|
||||
_('Tile background image'),
|
||||
($design->disposition & BACKGROUND_TILE) ? true : false);
|
||||
$this->unli();
|
||||
@ -587,7 +594,8 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$design = $this->out->design;
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_color'));
|
||||
$this->out->element('legend', null, _('Change colours'));
|
||||
// TRANS: Fieldset legend for theme colors.
|
||||
$this->out->element('legend', null, _('Change colors'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
@ -597,6 +605,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$bgcolor = new WebColor($design->backgroundcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for background color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-1'), _('Background'));
|
||||
$this->out->element('input', array('name' => 'design_background',
|
||||
'type' => 'text',
|
||||
@ -610,6 +619,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$ccolor = new WebColor($design->contentcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for content color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-2'), _('Content'));
|
||||
$this->out->element('input', array('name' => 'design_content',
|
||||
'type' => 'text',
|
||||
@ -623,6 +633,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$sbcolor = new WebColor($design->sidebarcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for sidebar color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-3'), _('Sidebar'));
|
||||
$this->out->element('input', array('name' => 'design_sidebar',
|
||||
'type' => 'text',
|
||||
@ -636,6 +647,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$tcolor = new WebColor($design->textcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for text color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-4'), _('Text'));
|
||||
$this->out->element('input', array('name' => 'design_text',
|
||||
'type' => 'text',
|
||||
@ -649,6 +661,7 @@ class DesignAdminPanelForm extends AdminForm
|
||||
$lcolor = new WebColor($design->linkcolor);
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for link color selector.
|
||||
$this->out->element('label', array('for' => 'swatch-5'), _('Links'));
|
||||
$this->out->element('input', array('name' => 'design_links',
|
||||
'type' => 'text',
|
||||
@ -674,10 +687,12 @@ class DesignAdminPanelForm extends AdminForm
|
||||
{
|
||||
if (common_config('custom_css', 'enabled')) {
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_design_advanced'));
|
||||
// TRANS: Fieldset legend for advanced theme design settings.
|
||||
$this->out->element('legend', null, _('Advanced'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
// TRANS: Field label for custom CSS.
|
||||
$this->out->element('label', array('for' => 'css'), _('Custom CSS'));
|
||||
$this->out->element('textarea', array('name' => 'css',
|
||||
'id' => 'css',
|
||||
@ -699,17 +714,25 @@ class DesignAdminPanelForm extends AdminForm
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit('defaults', _('Use defaults'), 'submit form_action-default',
|
||||
'defaults', _('Restore default designs'));
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
$this->out->submit('defaults', _m('BUTTON','Use defaults'), 'submit form_action-default',
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'defaults', _('Restore default designs.'));
|
||||
|
||||
$this->out->element('input', array('id' => 'settings_design_reset',
|
||||
'type' => 'reset',
|
||||
// TRANS: Button text for resetting theme settings.
|
||||
'value' => 'Reset',
|
||||
'class' => 'submit form_action-primary',
|
||||
'title' => _('Reset back to default')));
|
||||
// TRANS: Title for button for resetting theme settings.
|
||||
'title' => _('Reset back to default.')));
|
||||
|
||||
$this->out->submit('save', _('Save'), 'submit form_action-secondary',
|
||||
'save', _('Save design'));
|
||||
$this->out->submit('save',
|
||||
// TRANS: Button text for saving theme settings.
|
||||
_m('BUTTON','Save'),
|
||||
'submit form_action-secondary',
|
||||
'save',
|
||||
// TRANS: Title for button for saving theme settings.
|
||||
_('Save design.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Disfavor action.
|
||||
*
|
||||
@ -58,6 +57,7 @@ class DisfavorAction extends Action
|
||||
{
|
||||
parent::handle($args);
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to remove a favorite while not logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
return;
|
||||
}
|
||||
@ -71,6 +71,7 @@ class DisfavorAction extends Action
|
||||
$notice = Notice::staticGet($id);
|
||||
$token = $this->trimmed('token-'.$notice->id);
|
||||
if (!$token || $token != common_session_token()) {
|
||||
// TRANS: Client error displayed when the session token does not match or is not given.
|
||||
$this->clientError(_('There was a problem with your session token. Try again, please.'));
|
||||
return;
|
||||
}
|
||||
@ -78,12 +79,14 @@ class DisfavorAction extends Action
|
||||
$fave->user_id = $user->id;
|
||||
$fave->notice_id = $notice->id;
|
||||
if (!$fave->find(true)) {
|
||||
// TRANS: Client error displayed when trying to remove favorite status for a notice that is not a favorite.
|
||||
$this->clientError(_('This notice is not a favorite!'));
|
||||
return;
|
||||
}
|
||||
$result = $fave->delete();
|
||||
if (!$result) {
|
||||
common_log_db_error($fave, 'DELETE', __FILE__);
|
||||
// TRANS: Server error displayed when removing a favorite from the database fails.
|
||||
$this->serverError(_('Could not delete favorite.'));
|
||||
return;
|
||||
}
|
||||
@ -91,6 +94,7 @@ class DisfavorAction extends Action
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Title for page on which favorites can be added.
|
||||
$this->element('title', null, _('Add to favorites'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
@ -105,4 +109,3 @@ class DisfavorAction extends Action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Documentation action.
|
||||
*
|
||||
@ -83,7 +82,6 @@ class DocAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showPageTitle()
|
||||
{
|
||||
$this->element('h1', array('class' => 'entry-title'), $this->title());
|
||||
@ -96,7 +94,6 @@ class DocAction extends Action
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
|
||||
function showContentBlock()
|
||||
{
|
||||
$this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
|
||||
@ -117,7 +114,6 @@ class DocAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$this->raw($this->output);
|
||||
@ -142,7 +138,6 @@ class DocAction extends Action
|
||||
*
|
||||
* @return boolean read-only flag (false)
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
@ -155,7 +150,9 @@ class DocAction extends Action
|
||||
$this->filename = $this->getFilename();
|
||||
|
||||
if (empty($this->filename)) {
|
||||
throw new ClientException(sprintf(_('No such document "%s"'), $this->title), 404);
|
||||
// TRANS: Client exception thrown when requesting a document from the documentation that does not exist.
|
||||
// TRANS: %s is the non-existing document.
|
||||
throw new ClientException(sprintf(_('No such document "%s".'), $this->title), 404);
|
||||
}
|
||||
|
||||
$c = file_get_contents($this->filename);
|
||||
|
@ -198,6 +198,7 @@ class EditApplicationAction extends OwnerDesignAction
|
||||
} elseif (Oauth_application::descriptionTooLong($description)) {
|
||||
$this->showForm(sprintf(
|
||||
// TRANS: Validation error shown when providing too long a description in the "Edit application" form.
|
||||
// TRANS: %d is the maximum number of allowed characters.
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
Oauth_application::maxDesc()),
|
||||
@ -223,6 +224,7 @@ class EditApplicationAction extends OwnerDesignAction
|
||||
$this->showForm(_('Organization is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} elseif (empty($homepage)) {
|
||||
// TRANS: Form validation error show when an organisation name has not been provided in the edit application form.
|
||||
$this->showForm(_('Organization homepage is required.'));
|
||||
return;
|
||||
} elseif ((mb_strlen($homepage) > 0)
|
||||
|
@ -139,7 +139,7 @@ class EditgroupAction extends GroupDesignAction
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
@ -177,116 +177,121 @@ class EditgroupAction extends GroupDesignAction
|
||||
return;
|
||||
}
|
||||
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
$location = $this->trimmed('location');
|
||||
$aliasstring = $this->trimmed('aliases');
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
|
||||
if ($this->nicknameExists($nickname)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Nickname already in use. Try another one.'));
|
||||
return;
|
||||
} else if (!User_group::allowedNickname($nickname)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Not a valid nickname.'));
|
||||
return;
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
|
||||
!Validate::uri($homepage,
|
||||
array('allowed_schemes' =>
|
||||
array('http', 'https')))) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
return;
|
||||
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} else if (User_group::descriptionTooLong($description)) {
|
||||
$this->showForm(sprintf(
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
$location = $this->trimmed('location');
|
||||
$aliasstring = $this->trimmed('aliases');
|
||||
|
||||
if ($this->nicknameExists($nickname)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
$this->showForm(_('Nickname already in use. Try another one.'));
|
||||
return;
|
||||
} else if (!User_group::allowedNickname($nickname)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Not a valid nickname.'));
|
||||
return;
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
|
||||
!Validate::uri($homepage,
|
||||
array('allowed_schemes' =>
|
||||
array('http', 'https')))) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
return;
|
||||
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} else if (User_group::descriptionTooLong($description)) {
|
||||
$this->showForm(sprintf(
|
||||
// TRANS: Group edit form validation error.
|
||||
_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
User_group::maxDescription()));
|
||||
return;
|
||||
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($aliasstring)) {
|
||||
$aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\s,]+/', $aliasstring)));
|
||||
} else {
|
||||
$aliases = array();
|
||||
}
|
||||
|
||||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||
// TRANS: Group edit form validation error.
|
||||
// TRANS: %d is the maximum number of allowed aliases.
|
||||
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
if (!Nickname::isValid($alias)) {
|
||||
return;
|
||||
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
|
||||
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
||||
return;
|
||||
}
|
||||
if ($this->nicknameExists($alias)) {
|
||||
|
||||
if (!empty($aliasstring)) {
|
||||
$aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\s,]+/', $aliasstring)));
|
||||
} else {
|
||||
$aliases = array();
|
||||
}
|
||||
|
||||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
|
||||
$alias));
|
||||
// TRANS: %d is the maximum number of allowed aliases.
|
||||
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')));
|
||||
return;
|
||||
}
|
||||
// XXX assumes alphanum nicknames
|
||||
if (strcmp($alias, $nickname) == 0) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Alias can\'t be the same as nickname.'));
|
||||
return;
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
if (!Nickname::isValid($alias)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
|
||||
return;
|
||||
}
|
||||
if ($this->nicknameExists($alias)) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
|
||||
$alias));
|
||||
return;
|
||||
}
|
||||
// XXX assumes alphanum nicknames
|
||||
if (strcmp($alias, $nickname) == 0) {
|
||||
// TRANS: Group edit form validation error.
|
||||
$this->showForm(_('Alias can\'t be the same as nickname.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->group->query('BEGIN');
|
||||
|
||||
$orig = clone($this->group);
|
||||
|
||||
$this->group->nickname = $nickname;
|
||||
$this->group->fullname = $fullname;
|
||||
$this->group->homepage = $homepage;
|
||||
$this->group->description = $description;
|
||||
$this->group->location = $location;
|
||||
$this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
|
||||
|
||||
$result = $this->group->update($orig);
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($this->group, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when editing a group fails.
|
||||
$this->serverError(_('Could not update group.'));
|
||||
}
|
||||
|
||||
$result = $this->group->setAliases($aliases);
|
||||
|
||||
if (!$result) {
|
||||
// TRANS: Server error displayed when group aliases could not be added.
|
||||
$this->serverError(_('Could not create aliases.'));
|
||||
}
|
||||
|
||||
if ($nickname != $orig->nickname) {
|
||||
common_log(LOG_INFO, "Saving local group info.");
|
||||
$local = Local_group::staticGet('group_id', $this->group->id);
|
||||
$local->setNickname($nickname);
|
||||
}
|
||||
|
||||
$this->group->query('COMMIT');
|
||||
|
||||
Event::handle('EndGroupSaveForm', array($this));
|
||||
}
|
||||
|
||||
$this->group->query('BEGIN');
|
||||
|
||||
$orig = clone($this->group);
|
||||
|
||||
$this->group->nickname = $nickname;
|
||||
$this->group->fullname = $fullname;
|
||||
$this->group->homepage = $homepage;
|
||||
$this->group->description = $description;
|
||||
$this->group->location = $location;
|
||||
$this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
|
||||
|
||||
$result = $this->group->update($orig);
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($this->group, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when editing a group fails.
|
||||
$this->serverError(_('Could not update group.'));
|
||||
}
|
||||
|
||||
$result = $this->group->setAliases($aliases);
|
||||
|
||||
if (!$result) {
|
||||
// TRANS: Server error displayed when group aliases could not be added.
|
||||
$this->serverError(_('Could not create aliases.'));
|
||||
}
|
||||
|
||||
if ($nickname != $orig->nickname) {
|
||||
common_log(LOG_INFO, "Saving local group info.");
|
||||
$local = Local_group::staticGet('group_id', $this->group->id);
|
||||
$local->setNickname($nickname);
|
||||
}
|
||||
|
||||
$this->group->query('COMMIT');
|
||||
|
||||
if ($this->group->nickname != $orig->nickname) {
|
||||
common_redirect(common_local_url('editgroup',
|
||||
array('nickname' => $nickname)),
|
||||
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
|
||||
|
||||
/**
|
||||
* Settings for email
|
||||
@ -47,14 +47,13 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
* @see Widget
|
||||
*/
|
||||
|
||||
class EmailsettingsAction extends AccountSettingsAction
|
||||
class EmailsettingsAction extends SettingsAction
|
||||
{
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for e-mail settings.
|
||||
@ -66,7 +65,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// XXX: For consistency of parameters in messages, this should be a
|
||||
@ -91,7 +89,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -118,8 +115,8 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
$confirm = $this->getConfirmation();
|
||||
if ($confirm) {
|
||||
$this->element('p', array('id' => 'form_unconfirmed'), $confirm->address);
|
||||
// TRANS: Form note in e-mail settings form.
|
||||
$this->element('p', array('class' => 'form_note'),
|
||||
// TRANS: Form note in e-mail settings form.
|
||||
_('Awaiting confirmation on this address. '.
|
||||
'Check your inbox (and spam box!) for a message '.
|
||||
'with further instructions.'));
|
||||
@ -173,7 +170,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if ($user->incomingemail) {
|
||||
$this->elementStart('p');
|
||||
$this->element('span', 'address', $user->incomingemail);
|
||||
// XXX: Looks a little awkward in the UI.
|
||||
// @todo XXX: Looks a little awkward in the UI.
|
||||
// Something like "xxxx@identi.ca Send email ..". Needs improvement.
|
||||
$this->element('span', 'input_instructions',
|
||||
// TRANS: Form instructions for incoming e-mail form in e-mail settings.
|
||||
@ -208,7 +205,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
$this->element('legend', null, _('Email preferences'));
|
||||
|
||||
$this->elementStart('ul', 'form_data');
|
||||
|
||||
|
||||
if (Event::handle('StartEmailFormData', array($this))) {
|
||||
$this->elementStart('li');
|
||||
$this->checkbox('emailnotifysub',
|
||||
@ -262,7 +259,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return Confirm_address Email address confirmation for user, or null
|
||||
*/
|
||||
|
||||
function getConfirmation()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -288,7 +284,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
// CSRF protection
|
||||
@ -322,13 +317,12 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function savePreferences()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
|
||||
if (Event::handle('StartEmailSaveForm', array($this, &$user))) {
|
||||
|
||||
|
||||
$emailnotifysub = $this->boolean('emailnotifysub');
|
||||
$emailnotifyfav = $this->boolean('emailnotifyfav');
|
||||
$emailnotifymsg = $this->boolean('emailnotifymsg');
|
||||
@ -336,13 +330,13 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
$emailnotifyattn = $this->boolean('emailnotifyattn');
|
||||
$emailmicroid = $this->boolean('emailmicroid');
|
||||
$emailpost = $this->boolean('emailpost');
|
||||
|
||||
|
||||
assert(!is_null($user)); // should already be checked
|
||||
|
||||
|
||||
$user->query('BEGIN');
|
||||
|
||||
|
||||
$original = clone($user);
|
||||
|
||||
|
||||
$user->emailnotifysub = $emailnotifysub;
|
||||
$user->emailnotifyfav = $emailnotifyfav;
|
||||
$user->emailnotifymsg = $emailnotifymsg;
|
||||
@ -350,20 +344,20 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
$user->emailnotifyattn = $emailnotifyattn;
|
||||
$user->emailmicroid = $emailmicroid;
|
||||
$user->emailpost = $emailpost;
|
||||
|
||||
|
||||
$result = $user->update($original);
|
||||
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error updating e-mail preferences.
|
||||
$this->serverError(_('Couldn\'t update user.'));
|
||||
$this->serverError(_('Could not update user.'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$user->query('COMMIT');
|
||||
|
||||
|
||||
Event::handle('EndEmailSaveForm', array($this));
|
||||
|
||||
|
||||
// TRANS: Confirmation message for successful e-mail preferences save.
|
||||
$this->showForm(_('Email preferences saved.'), true);
|
||||
}
|
||||
@ -374,7 +368,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function addAddress()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -393,7 +386,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
|
||||
if (!$email) {
|
||||
// TRANS: Message given saving e-mail address that cannot be normalised.
|
||||
$this->showForm(_('Cannot normalize that email address'));
|
||||
$this->showForm(_('Cannot normalize that email address.'));
|
||||
return;
|
||||
}
|
||||
if (!Validate::email($email, common_config('email', 'check_domain'))) {
|
||||
@ -423,7 +416,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if ($result === false) {
|
||||
common_log_db_error($confirm, 'INSERT', __FILE__);
|
||||
// TRANS: Server error thrown on database error adding e-mail confirmation code.
|
||||
$this->serverError(_('Couldn\'t insert confirmation code.'));
|
||||
$this->serverError(_('Could not insert confirmation code.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -442,7 +435,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function cancelConfirmation()
|
||||
{
|
||||
$email = $this->arg('email');
|
||||
@ -465,7 +457,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if (!$result) {
|
||||
common_log_db_error($confirm, 'DELETE', __FILE__);
|
||||
// TRANS: Server error thrown on database error canceling e-mail address confirmation.
|
||||
$this->serverError(_('Couldn\'t delete email confirmation.'));
|
||||
$this->serverError(_('Could not delete email confirmation.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -478,7 +470,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function removeAddress()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -505,7 +496,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if (!$result) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error removing a registered e-mail address.
|
||||
$this->serverError(_('Couldn\'t update user.'));
|
||||
$this->serverError(_('Could not update user.'));
|
||||
return;
|
||||
}
|
||||
$user->query('COMMIT');
|
||||
@ -519,12 +510,12 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function removeIncoming()
|
||||
{
|
||||
$user = common_current_user();
|
||||
|
||||
if (!$user->incomingemail) {
|
||||
// TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
|
||||
$this->showForm(_('No incoming email address.'));
|
||||
return;
|
||||
}
|
||||
@ -537,7 +528,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if (!$user->updateKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error removing incoming e-mail address.
|
||||
$this->serverError(_("Couldn't update user record."));
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
}
|
||||
|
||||
// TRANS: Message given after successfully removing an incoming e-mail address.
|
||||
@ -549,7 +540,6 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function newIncoming()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -562,7 +552,7 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||
if (!$user->updateKeys($orig)) {
|
||||
common_log_db_error($user, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error thrown on database error adding incoming e-mail address.
|
||||
$this->serverError(_("Couldn't update user record."));
|
||||
$this->serverError(_('Could not update user record.'));
|
||||
}
|
||||
|
||||
// TRANS: Message given after successfully adding an incoming e-mail address.
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Favor action.
|
||||
*
|
||||
@ -59,6 +58,7 @@ class FavorAction extends Action
|
||||
{
|
||||
parent::handle($args);
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to mark a notice as favorite without being logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
return;
|
||||
}
|
||||
@ -76,11 +76,13 @@ class FavorAction extends Action
|
||||
return;
|
||||
}
|
||||
if ($user->hasFave($notice)) {
|
||||
// TRANS: Client error displayed when trying to mark a notice as favorite that already is a favorite.
|
||||
$this->clientError(_('This notice is already a favorite!'));
|
||||
return;
|
||||
}
|
||||
$fave = Fave::addNew($user->getProfile(), $notice);
|
||||
if (!$fave) {
|
||||
// TRANS: Server error displayed when trying to mark a notice as favorite fails in the database.
|
||||
$this->serverError(_('Could not create favorite.'));
|
||||
return;
|
||||
}
|
||||
@ -89,7 +91,8 @@ class FavorAction extends Action
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
$this->element('title', null, _('Disfavor favorite'));
|
||||
// TRANS: Page title for page on which favorite notices can be unfavourited.
|
||||
$this->element('title', null, _('Disfavor favorite.'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
$disfavor = new DisFavorForm($this, $notice);
|
||||
@ -123,4 +126,3 @@ class FavorAction extends Action
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/noticelist.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 FavoritedAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
@ -62,8 +61,11 @@ class FavoritedAction extends Action
|
||||
function title()
|
||||
{
|
||||
if ($this->page == 1) {
|
||||
// TRANS: Page title for first page of favorited notices.
|
||||
return _('Popular notices');
|
||||
} else {
|
||||
// TRANS: Page title for all but first page of favorited notices.
|
||||
// TRANS: %d is the page number being displayed.
|
||||
return sprintf(_('Popular notices, page %d'), $this->page);
|
||||
}
|
||||
}
|
||||
@ -73,9 +75,9 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Description on page displaying favorited notices.
|
||||
return _('The most popular notices on the site right now.');
|
||||
}
|
||||
|
||||
@ -84,7 +86,6 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
@ -99,7 +100,6 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @todo move queries from showContent() to here
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -119,7 +119,6 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -134,7 +133,6 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
$instr = $this->getInstructions();
|
||||
@ -147,12 +145,16 @@ class FavoritedAction extends Action
|
||||
|
||||
function showEmptyList()
|
||||
{
|
||||
// TRANS: Text displayed instead of a list when a site does not yet have any favourited notices.
|
||||
$message = _('Favorite notices appear on this page but no one has favorited one yet.') . ' ';
|
||||
|
||||
if (common_logged_in()) {
|
||||
// TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for logged in users.
|
||||
$message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
|
||||
}
|
||||
else {
|
||||
// TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for not logged in users.
|
||||
// TRANS: %%action.register%% is a registration link. "[link text](link)" is Mark Down. Do not change the formatting.
|
||||
$message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
|
||||
}
|
||||
|
||||
@ -161,20 +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
|
||||
*
|
||||
@ -182,7 +170,6 @@ class FavoritedAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$pop = new Popularity();
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* RSS feed for user favorites action class.
|
||||
*
|
||||
@ -50,7 +49,6 @@ require_once INSTALLDIR.'/lib/rssaction.php';
|
||||
*/
|
||||
class FavoritesrssAction extends Rss10Action
|
||||
{
|
||||
|
||||
/** The user whose favorites to display */
|
||||
|
||||
var $user = null;
|
||||
@ -62,7 +60,6 @@ class FavoritesrssAction extends Rss10Action
|
||||
*
|
||||
* @return boolean success
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -71,6 +68,7 @@ class FavoritesrssAction extends Rss10Action
|
||||
$this->user = User::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$this->user) {
|
||||
// TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist.
|
||||
$this->clientError(_('No such user.'));
|
||||
return false;
|
||||
} else {
|
||||
@ -108,10 +106,14 @@ class FavoritesrssAction extends Rss10Action
|
||||
$c = array('url' => common_local_url('favoritesrss',
|
||||
array('nickname' =>
|
||||
$user->nickname)),
|
||||
// TRANS: Title of RSS feed with favourite notices of a user.
|
||||
// TRANS: %s is a user's nickname.
|
||||
'title' => sprintf(_("%s's favorite notices"), $user->nickname),
|
||||
'link' => common_local_url('showfavorites',
|
||||
array('nickname' =>
|
||||
$user->nickname)),
|
||||
// TRANS: Desciption of RSS feed with favourite notices of a user.
|
||||
// TRANS: %1$s is a user's nickname, %2$s is the name of the StatusNet site.
|
||||
'description' => sprintf(_('Updates favored by %1$s on %2$s!'),
|
||||
$user->nickname, common_config('site', 'name')));
|
||||
return $c;
|
||||
|
@ -45,7 +45,6 @@ require_once INSTALLDIR.'/lib/publicgroupnav.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 FeaturedAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
@ -66,8 +65,11 @@ class FeaturedAction extends Action
|
||||
function title()
|
||||
{
|
||||
if ($this->page == 1) {
|
||||
// TRANS: Page title for first page of featured users.
|
||||
return _('Featured users');
|
||||
} else {
|
||||
// TRANS: Page title for all but first page of featured users.
|
||||
// TRANS: %d is the page number being displayed.
|
||||
return sprintf(_('Featured users, page %d'), $this->page);
|
||||
}
|
||||
}
|
||||
@ -88,15 +90,10 @@ class FeaturedAction extends Action
|
||||
$this->elementEnd('div');
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
{
|
||||
$nav = new PublicGroupNav($this);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
return sprintf(_('A selection of some great users on %s'),
|
||||
// TRANS: Description on page displaying featured users.
|
||||
return sprintf(_('A selection of some great users on %s.'),
|
||||
common_config('site', 'name'));
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
require_once(INSTALLDIR.'/actions/shownotice.php');
|
||||
|
||||
// @todo FIXME: Add documentation.
|
||||
class FileAction extends Action
|
||||
{
|
||||
var $id = null;
|
||||
@ -31,14 +32,17 @@ class FileAction extends Action
|
||||
parent::prepare($args);
|
||||
$this->id = $this->trimmed('notice');
|
||||
if (empty($this->id)) {
|
||||
// TRANS: Client error displayed when no notice ID was given trying do display a file.
|
||||
$this->clientError(_('No notice ID.'));
|
||||
}
|
||||
$notice = Notice::staticGet('id', $this->id);
|
||||
if (empty($notice)) {
|
||||
// TRANS: Client error displayed when an invalid notice ID was given trying do display a file.
|
||||
$this->clientError(_('No notice.'));
|
||||
}
|
||||
$atts = $notice->attachments();
|
||||
if (empty($atts)) {
|
||||
// TRANS: Client error displayed when trying do display a file for a notice without a file attachement.
|
||||
$this->clientError(_('No attachments.'));
|
||||
}
|
||||
foreach ($atts as $att) {
|
||||
@ -48,6 +52,9 @@ class FileAction extends Action
|
||||
}
|
||||
}
|
||||
if (empty($this->filerec)) {
|
||||
// XXX: Is this translation hint correct? If yes, please remove comment, if no, please correct and remove comment.
|
||||
// TRANS: Client error displayed when trying do display a file for a notice with file attachements
|
||||
// TRANS: that could not be found.
|
||||
$this->clientError(_('No uploaded attachments.'));
|
||||
}
|
||||
return true;
|
||||
@ -62,11 +69,8 @@ class FileAction extends Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/omb.php';
|
||||
*/
|
||||
class FinishremotesubscribeAction extends Action
|
||||
{
|
||||
|
||||
/**
|
||||
* Class handler.
|
||||
*
|
||||
@ -56,7 +55,7 @@ class FinishremotesubscribeAction extends Action
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
**/
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -66,6 +65,7 @@ class FinishremotesubscribeAction extends Action
|
||||
$service = unserialize($_SESSION['oauth_authorization_request']);
|
||||
|
||||
if (!$service) {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile and an unexpected response is received.
|
||||
$this->clientError(_('Not expecting this response!'));
|
||||
return;
|
||||
}
|
||||
@ -77,6 +77,7 @@ class FinishremotesubscribeAction extends Action
|
||||
$user = User::staticGet('uri', $service->getListeneeURI());
|
||||
|
||||
if (!$user) {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile that does not exist.
|
||||
$this->clientError(_('User being listened to does not exist.'));
|
||||
return;
|
||||
}
|
||||
@ -84,6 +85,7 @@ class FinishremotesubscribeAction extends Action
|
||||
$other = User::staticGet('uri', $service->getListenerURI());
|
||||
|
||||
if ($other) {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile that is a local profile.
|
||||
$this->clientError(_('You can use the local subscription!'));
|
||||
return;
|
||||
}
|
||||
@ -96,6 +98,7 @@ class FinishremotesubscribeAction extends Action
|
||||
$profile = Profile::staticGet($remote->id);
|
||||
|
||||
if ($user->hasBlocked($profile)) {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile that is blocked form subscribing to.
|
||||
$this->clientError(_('That user has blocked you from subscribing.'));
|
||||
return;
|
||||
}
|
||||
@ -107,14 +110,17 @@ class FinishremotesubscribeAction extends Action
|
||||
} catch (OAuthException $e) {
|
||||
if ($e->getMessage() == 'The authorized token does not equal the ' .
|
||||
'submitted token.') {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile without providing an authorised token.
|
||||
$this->clientError(_('You are not authorized.'));
|
||||
return;
|
||||
} else {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile and conversion of the request token to access token fails.
|
||||
$this->clientError(_('Could not convert request token to ' .
|
||||
'access token.'));
|
||||
return;
|
||||
}
|
||||
} catch (OMB_RemoteServiceException $e) {
|
||||
// TRANS: Client error displayed when subscribing to a remote profile fails because of an unsupported version of the OMB protocol.
|
||||
$this->clientError(_('Remote service uses unknown version of ' .
|
||||
'OMB protocol.'));
|
||||
return;
|
||||
@ -135,6 +141,7 @@ class FinishremotesubscribeAction extends Action
|
||||
$service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE);
|
||||
|
||||
if (!$remote->update($orig_remote)) {
|
||||
// TRANS: Server error displayed when subscribing to a remote profile fails because the remote profile could not be updated.
|
||||
$this->serverError(_('Error updating remote profile.'));
|
||||
return;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ define('LISTENER', 1);
|
||||
define('LISTENEE', -1);
|
||||
define('BOTH', 0);
|
||||
|
||||
// @todo XXX: Documentation missing.
|
||||
class FoafAction extends Action
|
||||
{
|
||||
function isReadOnly($args)
|
||||
@ -37,6 +38,7 @@ class FoafAction extends Action
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
|
||||
if (empty($nickname_arg)) {
|
||||
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a user nickname.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -55,6 +57,7 @@ class FoafAction extends Action
|
||||
$this->user = User::staticGet('nickname', $this->nickname);
|
||||
|
||||
if (!$this->user) {
|
||||
// TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -62,6 +65,7 @@ class FoafAction extends Action
|
||||
$this->profile = $this->user->getProfile();
|
||||
|
||||
if (!$this->profile) {
|
||||
// TRANS: Server error displayed when requesting Friends of a Friend feed for a user for which the profile could not be found.
|
||||
$this->serverError(_('User has no profile.'), 500);
|
||||
return false;
|
||||
}
|
||||
@ -110,7 +114,7 @@ class FoafAction extends Action
|
||||
if ($this->profile->bio) {
|
||||
$this->element('bio:olb', null, $this->profile->bio);
|
||||
}
|
||||
|
||||
|
||||
$location = $this->profile->getLocation();
|
||||
if ($location) {
|
||||
$attr = array();
|
||||
@ -118,7 +122,7 @@ class FoafAction extends Action
|
||||
$attr['rdf:about'] = $location->getRdfURL();
|
||||
}
|
||||
$location_name = $location->getName();
|
||||
|
||||
|
||||
$this->elementStart('based_near');
|
||||
$this->elementStart('geo:SpatialThing', $attr);
|
||||
if ($location_name) {
|
||||
@ -193,7 +197,7 @@ class FoafAction extends Action
|
||||
$this->element('knows', array('rdf:resource' => $uri));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->elementEnd('Agent');
|
||||
|
||||
|
||||
@ -239,18 +243,17 @@ class FoafAction extends Action
|
||||
|
||||
/**
|
||||
* Output FOAF <account> bit for the given profile.
|
||||
*
|
||||
*
|
||||
* @param Profile $profile
|
||||
* @param mixed $service Root URL of this StatusNet instance for a local
|
||||
* user, otherwise null.
|
||||
* @param mixed $useruri URI string for the referenced profile..
|
||||
* @param boolean $fetchSubscriptions Should we load and list all their subscriptions?
|
||||
* @param boolean $isSubscriber if not fetching subs, we can still mark the user as following the current page.
|
||||
*
|
||||
*
|
||||
* @return array if $fetchSubscribers is set, return a list of info on those
|
||||
* subscriptions.
|
||||
*/
|
||||
|
||||
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
|
||||
{
|
||||
$attr = array();
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
// @todo XXX: Documentation missing.
|
||||
class FoafGroupAction extends Action
|
||||
{
|
||||
function isReadOnly($args)
|
||||
@ -41,6 +42,7 @@ class FoafGroupAction extends Action
|
||||
$nickname_arg = $this->arg('nickname');
|
||||
|
||||
if (empty($nickname_arg)) {
|
||||
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a group nickname.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -59,6 +61,7 @@ class FoafGroupAction extends Action
|
||||
$local = Local_group::staticGet('nickname', $this->nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -66,6 +69,7 @@ class FoafGroupAction extends Action
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class GeocodeAction extends Action
|
||||
*
|
||||
* @return nothing
|
||||
*
|
||||
**/
|
||||
*/
|
||||
function handle($args)
|
||||
{
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
@ -89,7 +89,6 @@ class GeocodeAction extends Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
|
@ -47,13 +47,11 @@ require_once 'MIME/Type.php';
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class GetfileAction extends Action
|
||||
{
|
||||
/**
|
||||
* Path of file to return
|
||||
*/
|
||||
|
||||
var $path = null;
|
||||
|
||||
/**
|
||||
@ -63,7 +61,6 @@ class GetfileAction extends Action
|
||||
*
|
||||
* @return success flag
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -76,10 +73,12 @@ class GetfileAction extends Action
|
||||
}
|
||||
|
||||
if (empty($path) or !file_exists($path)) {
|
||||
// TRANS: Client error displayed when requesting a non-existent file.
|
||||
$this->clientError(_('No such file.'), 404);
|
||||
return false;
|
||||
}
|
||||
if (!is_readable($path)) {
|
||||
// TRANS: Client error displayed when requesting a file without having read access to it.
|
||||
$this->clientError(_('Cannot read file.'), 403);
|
||||
return false;
|
||||
}
|
||||
@ -93,7 +92,6 @@ class GetfileAction extends Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
@ -104,7 +102,6 @@ class GetfileAction extends Action
|
||||
*
|
||||
* @return int last-modified date as unix timestamp
|
||||
*/
|
||||
|
||||
function lastModified()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
@ -122,7 +119,6 @@ class GetfileAction extends Action
|
||||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
if (common_config('site', 'use_x_sendfile')) {
|
||||
@ -151,7 +147,6 @@ class GetfileAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
// undo headers set by PHP sessions
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Action class to sandbox an abusive user
|
||||
* Action class to grant user roles.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -32,7 +32,7 @@ if (!defined('STATUSNET')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sandbox a user.
|
||||
* Assign role to user.
|
||||
*
|
||||
* @category Action
|
||||
* @package StatusNet
|
||||
@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class GrantRoleAction extends ProfileFormAction
|
||||
{
|
||||
/**
|
||||
@ -50,19 +49,20 @@ class GrantRoleAction extends ProfileFormAction
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
if (!parent::prepare($args)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$this->role = $this->arg('role');
|
||||
if (!Profile_role::isValid($this->role)) {
|
||||
// TRANS: Client error displayed when trying to assign an invalid role to a user.
|
||||
$this->clientError(_('Invalid role.'));
|
||||
return false;
|
||||
}
|
||||
if (!Profile_role::isSettable($this->role)) {
|
||||
// TRANS: Client error displayed when trying to assign an reserved role to a user.
|
||||
$this->clientError(_('This role is reserved and cannot be set.'));
|
||||
return false;
|
||||
}
|
||||
@ -72,6 +72,7 @@ class GrantRoleAction extends ProfileFormAction
|
||||
assert(!empty($cur)); // checked by parent
|
||||
|
||||
if (!$cur->hasRight(Right::GRANTROLE)) {
|
||||
// TRANS: Client error displayed when trying to assign a role to a user while not being allowed to set roles.
|
||||
$this->clientError(_('You cannot grant user roles on this site.'));
|
||||
return false;
|
||||
}
|
||||
@ -79,6 +80,7 @@ class GrantRoleAction extends ProfileFormAction
|
||||
assert(!empty($this->profile)); // checked by parent
|
||||
|
||||
if ($this->profile->hasRole($this->role)) {
|
||||
// TRANS: Client error displayed when trying to assign a role to a user that already has that role.
|
||||
$this->clientError(_('User already has this role.'));
|
||||
return false;
|
||||
}
|
||||
@ -91,7 +93,6 @@ class GrantRoleAction extends ProfileFormAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
$this->profile->grantRole($this->role);
|
||||
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class GroupblockAction extends RedirectingAction
|
||||
{
|
||||
var $profile = null;
|
||||
@ -53,11 +52,11 @@ class GroupblockAction extends RedirectingAction
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while not logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
return false;
|
||||
}
|
||||
@ -68,35 +67,42 @@ class GroupblockAction extends RedirectingAction
|
||||
}
|
||||
$id = $this->trimmed('blockto');
|
||||
if (empty($id)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while not specifying a to be blocked user profile.
|
||||
$this->clientError(_('No profile specified.'));
|
||||
return false;
|
||||
}
|
||||
$this->profile = Profile::staticGet('id', $id);
|
||||
if (empty($this->profile)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
|
||||
$this->clientError(_('No profile with that ID.'));
|
||||
return false;
|
||||
}
|
||||
$group_id = $this->trimmed('blockgroup');
|
||||
if (empty($group_id)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while not specifying a group to block a profile from.
|
||||
$this->clientError(_('No group specified.'));
|
||||
return false;
|
||||
}
|
||||
$this->group = User_group::staticGet('id', $group_id);
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
|
||||
$this->clientError(_('No such group.'));
|
||||
return false;
|
||||
}
|
||||
$user = common_current_user();
|
||||
if (!$user->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while not being an admin user.
|
||||
$this->clientError(_('Only an admin can block group members.'), 401);
|
||||
return false;
|
||||
}
|
||||
if (Group_block::isBlocked($this->group, $this->profile)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while user is already blocked from the given group.
|
||||
$this->clientError(_('User is already blocked from group.'));
|
||||
return false;
|
||||
}
|
||||
// XXX: could have proactive blocks, but we don't have UI for it.
|
||||
if (!$this->profile->isMember($this->group)) {
|
||||
// TRANS: Client error displayed trying to block a user from a group while user is not a member of given group.
|
||||
$this->clientError(_('User is not a member of group.'));
|
||||
return false;
|
||||
}
|
||||
@ -131,6 +137,7 @@ class GroupblockAction extends RedirectingAction
|
||||
}
|
||||
|
||||
function title() {
|
||||
// TRANS: Title for block user from group page.
|
||||
return _('Block user from group');
|
||||
}
|
||||
|
||||
@ -145,7 +152,6 @@ class GroupblockAction extends RedirectingAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function areYouSureForm()
|
||||
{
|
||||
$id = $this->profile->id;
|
||||
@ -155,8 +161,11 @@ class GroupblockAction extends RedirectingAction
|
||||
'action' => common_local_url('groupblock')));
|
||||
$this->elementStart('fieldset');
|
||||
$this->hidden('token', common_session_token());
|
||||
// TRANS: Fieldset legend for block user from group form.
|
||||
$this->element('legend', _('Block user'));
|
||||
$this->element('p', null,
|
||||
// TRANS: Explanatory text for block user from group form before setting the block.
|
||||
// TRANS: %1$s is that to be blocked user, %2$s is the group the user will be blocked from.
|
||||
sprintf(_('Are you sure you want to block user "%1$s" from the group "%2$s"? '.
|
||||
'They will be removed from the group, unable to post, and '.
|
||||
'unable to subscribe to the group in the future.'),
|
||||
@ -179,14 +188,14 @@ class GroupblockAction extends RedirectingAction
|
||||
'submit form_action-primary',
|
||||
'no',
|
||||
// TRANS: Submit button title for 'No' when blocking a user from a group.
|
||||
_('Do not block this user from this group'));
|
||||
_('Do not block this user from this group.'));
|
||||
$this->submit('form_action-yes',
|
||||
// TRANS: Button label on the form to block a user from a group.
|
||||
_m('BUTTON','Yes'),
|
||||
'submit form_action-secondary',
|
||||
'yes',
|
||||
// TRANS: Submit button title for 'Yes' when blocking a user from a group.
|
||||
_('Block this user from this group'));
|
||||
_('Block this user from this group.'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
}
|
||||
@ -196,24 +205,24 @@ class GroupblockAction extends RedirectingAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function blockProfile()
|
||||
{
|
||||
$block = Group_block::blockProfile($this->group, $this->profile,
|
||||
common_current_user());
|
||||
|
||||
if (empty($block)) {
|
||||
// TRANS: Server error displayed when trying to block a user from a group fails because of an application error.
|
||||
$this->serverError(_("Database error blocking user from group."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$this->returnToPrevious();
|
||||
}
|
||||
|
||||
/**
|
||||
* If we reached this form without returnto arguments, default to
|
||||
* the top of the group's member list.
|
||||
*
|
||||
*
|
||||
* @return string URL
|
||||
*/
|
||||
function defaultReturnTo()
|
||||
@ -227,6 +236,4 @@ class GroupblockAction extends RedirectingAction
|
||||
parent::showScripts();
|
||||
$this->autofocus('form_action-yes');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,6 @@ require_once INSTALLDIR.'/lib/feedlist.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 GroupbyidAction extends Action
|
||||
{
|
||||
/** group we're viewing. */
|
||||
@ -58,7 +57,6 @@ class GroupbyidAction extends Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
@ -71,6 +69,7 @@ class GroupbyidAction extends Action
|
||||
$id = $this->arg('id');
|
||||
|
||||
if (!$id) {
|
||||
// TRANS: Client error displayed referring to a group's permalink without providing a group ID.
|
||||
$this->clientError(_('No ID.'));
|
||||
return false;
|
||||
}
|
||||
@ -80,6 +79,7 @@ class GroupbyidAction extends Action
|
||||
$this->group = User_group::staticGet('id', $id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -95,9 +95,8 @@ class GroupbyidAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
common_redirect($this->group->homeUrl(), 303);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* StatusNet, the distributed open-source microblogging tool
|
||||
*
|
||||
* Change user password
|
||||
* Saves a design for a given group.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/designsettings.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 GroupDesignSettingsAction extends DesignSettingsAction
|
||||
{
|
||||
var $group = null;
|
||||
@ -59,12 +58,12 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to change group design settings while not logged in.
|
||||
$this->clientError(_('You must be logged in to edit a group.'));
|
||||
return false;
|
||||
}
|
||||
@ -81,6 +80,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed trying to change group design settings without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -97,6 +97,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -104,6 +105,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$cur->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed trying to change group design settings without being a (group) admin.
|
||||
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||
return false;
|
||||
}
|
||||
@ -122,7 +124,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
*
|
||||
* @return Design a design object to use
|
||||
*/
|
||||
|
||||
function getDesign()
|
||||
{
|
||||
|
||||
@ -141,6 +142,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title group design settings page.
|
||||
return _('Group design');
|
||||
}
|
||||
|
||||
@ -149,9 +151,9 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for group design settings page.
|
||||
return _('Customize the way your group looks ' .
|
||||
'with a background image and a colour palette of your choice.');
|
||||
}
|
||||
@ -161,19 +163,27 @@ 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
|
||||
*
|
||||
* @return Design
|
||||
*/
|
||||
|
||||
function getWorkingDesign()
|
||||
{
|
||||
$design = null;
|
||||
@ -192,7 +202,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$design = $this->getWorkingDesign();
|
||||
@ -209,17 +218,14 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveDesign()
|
||||
{
|
||||
try {
|
||||
|
||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
|
||||
$tcolor = new WebColor($this->trimmed('design_text'));
|
||||
$lcolor = new WebColor($this->trimmed('design_links'));
|
||||
|
||||
} catch (WebColorException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
return;
|
||||
@ -246,7 +252,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
$design = $this->group->getDesign();
|
||||
|
||||
if (!empty($design)) {
|
||||
|
||||
// update design
|
||||
|
||||
$original = clone($design);
|
||||
@ -263,12 +268,11 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||
$this->showForm(_('Couldn\'t update your design.'));
|
||||
// TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
|
||||
$this->showForm(_('Unable to update your design settings.'));
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->group->query('BEGIN');
|
||||
|
||||
// save new design
|
||||
@ -287,6 +291,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
|
||||
if (empty($id)) {
|
||||
common_log_db_error($id, 'INSERT', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
return;
|
||||
}
|
||||
@ -297,18 +302,18 @@ class GroupDesignSettingsAction extends DesignSettingsAction
|
||||
|
||||
if (empty($result)) {
|
||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
|
||||
$this->showForm(_('Unable to save your design settings.'));
|
||||
$this->group->query('ROLLBACK');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->group->query('COMMIT');
|
||||
|
||||
}
|
||||
|
||||
$this->saveBackgroundImage($design);
|
||||
|
||||
// TRANS: Form text to confirm saved group design settings.
|
||||
$this->showForm(_('Design preferences saved.'), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
|
||||
|
||||
define('MAX_ORIGINAL', 480);
|
||||
|
||||
@ -49,7 +49,6 @@ define('MAX_ORIGINAL', 480);
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class GrouplogoAction extends GroupDesignAction
|
||||
{
|
||||
var $mode = null;
|
||||
@ -61,12 +60,12 @@ class GrouplogoAction extends GroupDesignAction
|
||||
/**
|
||||
* Prepare to run
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to create a group while not logged in.
|
||||
$this->clientError(_('You must be logged in to create a group.'));
|
||||
return false;
|
||||
}
|
||||
@ -83,6 +82,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed when trying to change group logo settings without providing a nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -99,6 +99,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when trying to update logo settings for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -106,6 +107,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$cur->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed when trying to change group logo settings while not being a group admin.
|
||||
$this->clientError(_('You must be an admin to edit the group.'), 403);
|
||||
return false;
|
||||
}
|
||||
@ -136,9 +138,9 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for group logo settings page.
|
||||
return _('Group logo');
|
||||
}
|
||||
|
||||
@ -147,9 +149,10 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for group logo page.
|
||||
// TRANS: %s is the maximum file size for that site.
|
||||
return sprintf(_('You can upload a logo image for your group. The maximum file size is %s.'), ImageFile::maxFileSize());
|
||||
}
|
||||
|
||||
@ -160,7 +163,6 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
if ($this->mode == 'crop') {
|
||||
@ -178,6 +180,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
|
||||
if (!$profile) {
|
||||
common_log_db_error($user, 'SELECT', __FILE__);
|
||||
// TRANS: Server error displayed coming across a request from a user without a profile.
|
||||
$this->serverError(_('User without matching profile.'));
|
||||
return;
|
||||
}
|
||||
@ -192,6 +195,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
common_local_url('grouplogo',
|
||||
array('nickname' => $this->group->nickname))));
|
||||
$this->elementStart('fieldset');
|
||||
// TRANS: Group logo form legend.
|
||||
$this->element('legend', null, _('Group logo'));
|
||||
$this->hidden('token', common_session_token());
|
||||
|
||||
@ -199,7 +203,8 @@ class GrouplogoAction extends GroupDesignAction
|
||||
if ($original) {
|
||||
$this->elementStart('li', array('id' => 'avatar_original',
|
||||
'class' => 'avatar_view'));
|
||||
$this->element('h2', null, _("Original"));
|
||||
// TRANS: Uploaded original file in group logo form.
|
||||
$this->element('h2', null, _('Original'));
|
||||
$this->elementStart('div', array('id'=>'avatar_original_view'));
|
||||
$this->element('img', array('src' => $this->group->original_logo,
|
||||
'alt' => $this->group->nickname));
|
||||
@ -210,7 +215,8 @@ class GrouplogoAction extends GroupDesignAction
|
||||
if ($this->group->homepage_logo) {
|
||||
$this->elementStart('li', array('id' => 'avatar_preview',
|
||||
'class' => 'avatar_view'));
|
||||
$this->element('h2', null, _("Preview"));
|
||||
// TRANS: Header for preview of to be displayed group logo.
|
||||
$this->element('h2', null, _('Preview'));
|
||||
$this->elementStart('div', array('id'=>'avatar_preview_view'));
|
||||
$this->element('img', array('src' => $this->group->homepage_logo,
|
||||
'width' => AVATAR_PROFILE_SIZE,
|
||||
@ -221,25 +227,25 @@ class GrouplogoAction extends GroupDesignAction
|
||||
}
|
||||
|
||||
$this->elementStart('li', array ('id' => 'settings_attach'));
|
||||
$this->element('input', array('name' => 'avatarfile',
|
||||
'type' => 'file',
|
||||
'id' => 'avatarfile'));
|
||||
$this->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||
'type' => 'hidden',
|
||||
'id' => 'MAX_FILE_SIZE',
|
||||
'value' => ImageFile::maxFileSizeInt()));
|
||||
$this->element('input', array('name' => 'avatarfile',
|
||||
'type' => 'file',
|
||||
'id' => 'avatarfile'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
||||
$this->elementStart('ul', 'form_actions');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Submit button for uploading a group logo.
|
||||
$this->submit('upload', _('Upload'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
|
||||
}
|
||||
|
||||
function showCropForm()
|
||||
@ -251,6 +257,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
common_local_url('grouplogo',
|
||||
array('nickname' => $this->group->nickname))));
|
||||
$this->elementStart('fieldset');
|
||||
// TRANS: Legend for group logo settings fieldset.
|
||||
$this->element('legend', null, _('Avatar settings'));
|
||||
$this->hidden('token', common_session_token());
|
||||
|
||||
@ -259,7 +266,8 @@ class GrouplogoAction extends GroupDesignAction
|
||||
$this->elementStart('li',
|
||||
array('id' => 'avatar_original',
|
||||
'class' => 'avatar_view'));
|
||||
$this->element('h2', null, _("Original"));
|
||||
// TRANS: Header for originally uploaded file before a crop on the group logo page.
|
||||
$this->element('h2', null, _('Original'));
|
||||
$this->elementStart('div', array('id'=>'avatar_original_view'));
|
||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||
'width' => $this->filedata['width'],
|
||||
@ -271,7 +279,8 @@ class GrouplogoAction extends GroupDesignAction
|
||||
$this->elementStart('li',
|
||||
array('id' => 'avatar_preview',
|
||||
'class' => 'avatar_view'));
|
||||
$this->element('h2', null, _("Preview"));
|
||||
// TRANS: Header for the cropped group logo on the group logo page.
|
||||
$this->element('h2', null, _('Preview'));
|
||||
$this->elementStart('div', array('id'=>'avatar_preview_view'));
|
||||
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
|
||||
'width' => AVATAR_PROFILE_SIZE,
|
||||
@ -286,13 +295,13 @@ class GrouplogoAction extends GroupDesignAction
|
||||
'id' => $crop_info));
|
||||
}
|
||||
|
||||
// TRANS: Button text for cropping an uploaded group logo.
|
||||
$this->submit('crop', _('Crop'));
|
||||
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -302,13 +311,13 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
// CSRF protection
|
||||
|
||||
$token = $this->trimmed('token');
|
||||
if (!$token || $token != common_session_token()) {
|
||||
// TRANS: Form validation error message.
|
||||
$this->show_form(_('There was a problem with your session token. '.
|
||||
'Try again, please.'));
|
||||
return;
|
||||
@ -319,6 +328,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
} else if ($this->arg('crop')) {
|
||||
$this->cropLogo();
|
||||
} else {
|
||||
// TRANS: Form validation error message when an unsupported argument is used.
|
||||
$this->showForm(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
@ -331,7 +341,6 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function uploadLogo()
|
||||
{
|
||||
try {
|
||||
@ -341,20 +350,21 @@ class GrouplogoAction extends GroupDesignAction
|
||||
return;
|
||||
}
|
||||
|
||||
$type = $imagefile->preferredType();
|
||||
$filename = Avatar::filename($this->group->id,
|
||||
image_type_to_extension($imagefile->type),
|
||||
image_type_to_extension($type),
|
||||
null,
|
||||
'group-temp-'.common_timestamp());
|
||||
|
||||
$filepath = Avatar::path($filename);
|
||||
|
||||
move_uploaded_file($imagefile->filepath, $filepath);
|
||||
$imagefile->copyTo($filepath);
|
||||
|
||||
$filedata = array('filename' => $filename,
|
||||
'filepath' => $filepath,
|
||||
'width' => $imagefile->width,
|
||||
'height' => $imagefile->height,
|
||||
'type' => $imagefile->type);
|
||||
'type' => $type);
|
||||
|
||||
$_SESSION['FILEDATA'] = $filedata;
|
||||
|
||||
@ -362,6 +372,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
|
||||
$this->mode = 'crop';
|
||||
|
||||
// TRANS: Form instructions on the group logo page.
|
||||
$this->showForm(_('Pick a square area of the image to be the logo.'),
|
||||
true);
|
||||
}
|
||||
@ -371,12 +382,12 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function cropLogo()
|
||||
{
|
||||
$filedata = $_SESSION['FILEDATA'];
|
||||
|
||||
if (!$filedata) {
|
||||
// TRANS: Server error displayed trying to crop an uploaded group logo that is no longer present.
|
||||
$this->serverError(_('Lost our file data.'));
|
||||
return;
|
||||
}
|
||||
@ -396,8 +407,10 @@ class GrouplogoAction extends GroupDesignAction
|
||||
@unlink($filedata['filepath']);
|
||||
unset($_SESSION['FILEDATA']);
|
||||
$this->mode = 'upload';
|
||||
// TRANS: Form success message after updating a group logo.
|
||||
$this->showForm(_('Logo updated.'), true);
|
||||
} else {
|
||||
// TRANS: Form failure message after failing to update a group logo.
|
||||
$this->showForm(_('Failed updating logo.'));
|
||||
}
|
||||
}
|
||||
@ -422,7 +435,6 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showStylesheets()
|
||||
{
|
||||
parent::showStylesheets();
|
||||
@ -434,7 +446,6 @@ class GrouplogoAction extends GroupDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showScripts()
|
||||
{
|
||||
parent::showScripts();
|
||||
@ -447,7 +458,7 @@ class GrouplogoAction extends GroupDesignAction
|
||||
$this->autofocus('avatarfile');
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
|
@ -43,7 +43,6 @@ require_once INSTALLDIR.'/lib/publicgroupnav.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 GroupmembersAction extends GroupDesignAction
|
||||
{
|
||||
var $page = null;
|
||||
@ -73,6 +72,7 @@ class GroupmembersAction extends GroupDesignAction
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed when trying to view group members without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -80,6 +80,7 @@ class GroupmembersAction extends GroupDesignAction
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when trying to view group members for a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -87,6 +88,7 @@ class GroupmembersAction extends GroupDesignAction
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when trying to view group members for an object that is not a group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -119,10 +121,11 @@ class GroupmembersAction extends GroupDesignAction
|
||||
function showPageNotice()
|
||||
{
|
||||
$this->element('p', 'instructions',
|
||||
// TRANS: Page notice for group members page.
|
||||
_('A list of the users in this group.'));
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new GroupNav($this, $this->group);
|
||||
$nav->show();
|
||||
@ -182,7 +185,8 @@ class GroupMemberListItem extends ProfileListItem
|
||||
{
|
||||
parent::showFullName();
|
||||
if ($this->profile->isAdmin($this->group)) {
|
||||
$this->out->text(' ');
|
||||
$this->out->text(' '); // for separating the classes.
|
||||
// TRANS: Indicator in group members list that this user is a group administrator.
|
||||
$this->out->element('span', 'role', _('Admin'));
|
||||
}
|
||||
}
|
||||
@ -254,7 +258,7 @@ class GroupMemberListItem extends ProfileListItem
|
||||
/**
|
||||
* Fetch necessary return-to arguments for the profile forms
|
||||
* to return to this list when they're done.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function returnToArgs()
|
||||
@ -281,7 +285,6 @@ class GroupMemberListItem extends ProfileListItem
|
||||
*
|
||||
* @see BlockForm
|
||||
*/
|
||||
|
||||
class GroupBlockForm extends Form
|
||||
{
|
||||
/**
|
||||
@ -310,7 +313,6 @@ class GroupBlockForm extends Form
|
||||
* @param User_group $group group to block user from
|
||||
* @param array $args return-to args
|
||||
*/
|
||||
|
||||
function __construct($out=null, $profile=null, $group=null, $args=null)
|
||||
{
|
||||
parent::__construct($out);
|
||||
@ -325,7 +327,6 @@ class GroupBlockForm extends Form
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
|
||||
function id()
|
||||
{
|
||||
// This should be unique for the page.
|
||||
@ -337,7 +338,6 @@ class GroupBlockForm extends Form
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_group_block';
|
||||
@ -348,7 +348,6 @@ class GroupBlockForm extends Form
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
|
||||
function action()
|
||||
{
|
||||
return common_local_url('groupblock');
|
||||
@ -361,6 +360,7 @@ class GroupBlockForm extends Form
|
||||
*/
|
||||
function formLegend()
|
||||
{
|
||||
// TRANS: Form legend for form to block user from a group.
|
||||
$this->out->element('legend', null, _('Block user from group'));
|
||||
}
|
||||
|
||||
@ -369,7 +369,6 @@ class GroupBlockForm extends Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$this->out->hidden('blockto-' . $this->profile->id,
|
||||
@ -390,7 +389,6 @@ class GroupBlockForm extends Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit(
|
||||
@ -414,25 +412,21 @@ class GroupBlockForm extends Form
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class MakeAdminForm extends Form
|
||||
{
|
||||
/**
|
||||
* Profile of user to block
|
||||
*/
|
||||
|
||||
var $profile = null;
|
||||
|
||||
/**
|
||||
* Group to block the user from
|
||||
*/
|
||||
|
||||
var $group = null;
|
||||
|
||||
/**
|
||||
* Return-to args
|
||||
*/
|
||||
|
||||
var $args = null;
|
||||
|
||||
/**
|
||||
@ -443,7 +437,6 @@ class MakeAdminForm extends Form
|
||||
* @param User_group $group group to block user from
|
||||
* @param array $args return-to args
|
||||
*/
|
||||
|
||||
function __construct($out=null, $profile=null, $group=null, $args=null)
|
||||
{
|
||||
parent::__construct($out);
|
||||
@ -458,7 +451,6 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
|
||||
function id()
|
||||
{
|
||||
// This should be unique for the page.
|
||||
@ -470,7 +462,6 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_make_admin';
|
||||
@ -481,7 +472,6 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return string URL of the action
|
||||
*/
|
||||
|
||||
function action()
|
||||
{
|
||||
return common_local_url('makeadmin', array('nickname' => $this->group->nickname));
|
||||
@ -492,9 +482,9 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formLegend()
|
||||
{
|
||||
// TRANS: Form legend for form to make a user a group admin.
|
||||
$this->out->element('legend', null, _('Make user an admin of the group'));
|
||||
}
|
||||
|
||||
@ -503,7 +493,6 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$this->out->hidden('profileid-' . $this->profile->id,
|
||||
@ -524,7 +513,6 @@ class MakeAdminForm extends Form
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit(
|
||||
|
@ -45,7 +45,6 @@ define('MEMBERS_PER_SECTION', 27);
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class groupRssAction extends Rss10Action
|
||||
{
|
||||
/** group we're viewing. */
|
||||
@ -56,7 +55,6 @@ class groupRssAction extends Rss10Action
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return true;
|
||||
@ -71,7 +69,6 @@ class groupRssAction extends Rss10Action
|
||||
*
|
||||
* @return boolean success flag
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -88,6 +85,7 @@ class groupRssAction extends Rss10Action
|
||||
}
|
||||
|
||||
if (!$nickname) {
|
||||
// TRANS: Client error displayed when requesting a group RSS feed without providing a group nickname.
|
||||
$this->clientError(_('No nickname.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -95,6 +93,7 @@ class groupRssAction extends Rss10Action
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when requesting a group RSS feed for group that does not exist.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -102,6 +101,7 @@ class groupRssAction extends Rss10Action
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when requesting a group RSS feed for an object that is not a group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -112,7 +112,6 @@ class groupRssAction extends Rss10Action
|
||||
|
||||
function getNotices($limit=0)
|
||||
{
|
||||
|
||||
$group = $this->group;
|
||||
|
||||
if (is_null($group)) {
|
||||
|
@ -45,7 +45,6 @@ require_once INSTALLDIR.'/lib/grouplist.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 GroupsAction extends Action
|
||||
{
|
||||
var $page = null;
|
||||
@ -59,9 +58,12 @@ class GroupsAction extends Action
|
||||
function title()
|
||||
{
|
||||
if ($this->page == 1) {
|
||||
return _("Groups");
|
||||
// TRANS: Title for first page of the groups list.
|
||||
return _m('TITLE',"Groups");
|
||||
} else {
|
||||
return sprintf(_("Groups, page %d"), $this->page);
|
||||
// TRANS: Title for all but the first page of the groups list.
|
||||
// TRANS: %d is the page number.
|
||||
return sprintf(_m('TITLE',"Groups, page %d"), $this->page);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,21 +80,18 @@ class GroupsAction extends Action
|
||||
$this->showPage();
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
{
|
||||
$nav = new PublicGroupNav($this);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
$notice =
|
||||
// TRANS: Page notice of group list. %%%%site.name%%%% is the StatusNet site name,
|
||||
// TRANS: %%%%action.groupsearch%%%% and %%%%action.newgroup%%%% are URLs. Do not change them.
|
||||
// TRANS: This message contains Markdown links in the form [link text](link).
|
||||
sprintf(_('%%%%site.name%%%% groups let you find and talk with ' .
|
||||
'people of similar interests. After you join a group ' .
|
||||
'you can send messages to all other members using the ' .
|
||||
'syntax "!groupname". Don\'t see a group you like? Try ' .
|
||||
'[searching for one](%%%%action.groupsearch%%%%) or ' .
|
||||
'[start your own!](%%%%action.newgroup%%%%)'));
|
||||
'[start your own](%%%%action.newgroup%%%%)!'));
|
||||
$this->elementStart('div', 'instructions');
|
||||
$this->raw(common_markup_to_html($notice));
|
||||
$this->elementEnd('div');
|
||||
@ -104,6 +103,7 @@ class GroupsAction extends Action
|
||||
$this->elementStart('p', array('id' => 'new_group'));
|
||||
$this->element('a', array('href' => common_local_url('newgroup'),
|
||||
'class' => 'more'),
|
||||
// TRANS: Link to create a new group on the group list page.
|
||||
_('Create a new group'));
|
||||
$this->elementEnd('p');
|
||||
}
|
||||
|
@ -49,12 +49,14 @@ class GroupsearchAction extends SearchAction
|
||||
{
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for page where groups can be searched. %%site.name%% is the name of the StatusNet site.
|
||||
return _('Search for groups on %%site.name%% by their name, location, or description. ' .
|
||||
'Separate the terms by spaces; they must be 3 characters or more.');
|
||||
}
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for page where groups can be searched.
|
||||
return _('Group search');
|
||||
}
|
||||
|
||||
@ -76,12 +78,17 @@ class GroupsearchAction extends SearchAction
|
||||
$this->pagination($page > 1, $cnt > GROUPS_PER_PAGE,
|
||||
$page, 'groupsearch', array('q' => $q));
|
||||
} else {
|
||||
// TRANS: Text on page where groups can be searched if no results were found for a query.
|
||||
$this->element('p', 'error', _('No results.'));
|
||||
$this->searchSuggestions($q);
|
||||
if (common_logged_in()) {
|
||||
$message = _('If you can\'t find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.');
|
||||
// TRANS: Additional text on page where groups can be searched if no results were found for a query for a logged in user.
|
||||
// TRANS: This message contains Markdown links in the form [link text](link).
|
||||
$message = _('If you cannot find the group you\'re looking for, you can [create it](%%action.newgroup%%) yourself.');
|
||||
}
|
||||
else {
|
||||
// TRANS: Additional text on page where groups can be searched if no results were found for a query for a not logged in user.
|
||||
// TRANS: This message contains Markdown links in the form [link text](link).
|
||||
$message = _('Why not [register an account](%%action.register%%) and [create the group](%%action.newgroup%%) yourself!');
|
||||
}
|
||||
$this->elementStart('div', 'guide');
|
||||
@ -116,4 +123,3 @@ class GroupSearchResults extends GroupList
|
||||
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,7 @@ class GroupunblockAction extends Action
|
||||
}
|
||||
$group_id = $this->trimmed('unblockgroup');
|
||||
if (empty($group_id)) {
|
||||
// TRANS: Client error displayed when trying to unblock a user from a group without providing a group.
|
||||
$this->clientError(_('No group specified.'));
|
||||
return false;
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class HcardAction extends Action
|
||||
{
|
||||
var $user;
|
||||
@ -64,6 +63,7 @@ class HcardAction extends Action
|
||||
$this->user = User::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$this->user) {
|
||||
// TRANS: Client error displayed when trying to get a user hCard for a non-existing user.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -71,6 +71,7 @@ class HcardAction extends Action
|
||||
$this->profile = $this->user->getProfile();
|
||||
|
||||
if (!$this->profile) {
|
||||
// TRANS: Server error displayed when trying to get a user hCard for a user without a profile.
|
||||
$this->serverError(_('User has no profile.'));
|
||||
return false;
|
||||
}
|
||||
@ -117,4 +118,4 @@ class ShortUserProfile extends UserProfile
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// @todo XXX: Add documentation.
|
||||
class HostMetaAction extends Action
|
||||
{
|
||||
|
||||
/**
|
||||
* Is read only?
|
||||
*
|
||||
|
@ -43,17 +43,16 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @see SettingsAction
|
||||
*/
|
||||
|
||||
class ImsettingsAction extends ConnectSettingsAction
|
||||
class ImsettingsAction extends SettingsAction
|
||||
{
|
||||
/**
|
||||
* Title of the page
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for instance messaging settings.
|
||||
// TRANS: Title for Instant Messaging settings.
|
||||
return _('IM settings');
|
||||
}
|
||||
|
||||
@ -62,7 +61,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instant messaging settings page instructions.
|
||||
@ -82,7 +80,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$transports = array();
|
||||
@ -210,7 +207,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return Confirm_address address object for this user
|
||||
*/
|
||||
|
||||
function getConfirmation($transport)
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -237,7 +233,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
// CSRF protection
|
||||
@ -257,7 +252,7 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
} else if ($this->arg('remove')) {
|
||||
$this->removeAddress();
|
||||
} else {
|
||||
// TRANS: Message given submitting a form with an unknown action in IM settings.
|
||||
// TRANS: Message given submitting a form with an unknown action in Instant Messaging settings.
|
||||
$this->showForm(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
@ -270,7 +265,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function savePreferences()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -312,7 +306,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function addAddress()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -365,8 +358,8 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
|
||||
if ($result === false) {
|
||||
common_log_db_error($confirm, 'INSERT', __FILE__);
|
||||
// TRANS: Server error thrown on database error adding IM confirmation code.
|
||||
$this->serverError(_('Couldn\'t insert confirmation code.'));
|
||||
// TRANS: Server error thrown on database error adding Instant Messaging confirmation code.
|
||||
$this->serverError(_('Could not insert confirmation code.'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -386,7 +379,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function cancelConfirmation()
|
||||
{
|
||||
$screenname = $this->trimmed('screenname');
|
||||
@ -395,7 +387,7 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
$confirm = $this->getConfirmation($transport);
|
||||
|
||||
if (!$confirm) {
|
||||
// TRANS: Message given canceling IM address confirmation that is not pending.
|
||||
// TRANS: Message given canceling Instant Messaging address confirmation that is not pending.
|
||||
$this->showForm(_('No pending confirmation to cancel.'));
|
||||
return;
|
||||
}
|
||||
@ -425,7 +417,6 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function removeAddress()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -456,7 +447,7 @@ class ImsettingsAction extends ConnectSettingsAction
|
||||
|
||||
// XXX: unsubscribe to the old address
|
||||
|
||||
// TRANS: Message given after successfully removing a registered IM address.
|
||||
// TRANS: Message given after successfully removing a registered Instant Messaging address.
|
||||
$this->showForm(_('The IM address was removed.'), true);
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ require_once INSTALLDIR.'/lib/mailbox.php';
|
||||
* @link http://status.net/
|
||||
* @see MailboxAction
|
||||
*/
|
||||
|
||||
class InboxAction extends MailboxAction
|
||||
{
|
||||
|
||||
@ -52,13 +51,16 @@ class InboxAction extends MailboxAction
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
if ($this->page > 1) {
|
||||
// TRANS: Title for all but the first page of the inbox page.
|
||||
// TRANS: %1$s is the user's nickname, %2$s is the page number.
|
||||
return sprintf(_('Inbox for %1$s - page %2$d'), $this->user->nickname,
|
||||
$this->page);
|
||||
} else {
|
||||
// TRANS: Title for the first page of the inbox page.
|
||||
// TRANS: %s is the user's nickname.
|
||||
return sprintf(_('Inbox for %s'), $this->user->nickname);
|
||||
}
|
||||
}
|
||||
@ -72,7 +74,6 @@ class InboxAction extends MailboxAction
|
||||
*
|
||||
* @see MailboxAction::getMessages()
|
||||
*/
|
||||
|
||||
function getMessages()
|
||||
{
|
||||
$message = new Message();
|
||||
@ -89,19 +90,9 @@ class InboxAction extends MailboxAction
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the profile we want to show with the message
|
||||
*
|
||||
* For inboxes, we show the sender; for outboxes, the recipient.
|
||||
*
|
||||
* @param Message $message The message to get the profile for
|
||||
*
|
||||
* @return Profile The profile that matches the message
|
||||
*/
|
||||
|
||||
function getMessageProfile($message)
|
||||
function getMessageList($message)
|
||||
{
|
||||
return $message->getFrom();
|
||||
return new InboxMessageList($this, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,9 +100,30 @@ class InboxAction extends MailboxAction
|
||||
*
|
||||
* @return string localised instructions for using the page
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for user inbox page.
|
||||
return _('This is your inbox, which lists your incoming private messages.');
|
||||
}
|
||||
}
|
||||
|
||||
class InboxMessageList extends MessageList
|
||||
{
|
||||
function newItem($message)
|
||||
{
|
||||
return new InboxMessageListItem($this->out, $message);
|
||||
}
|
||||
}
|
||||
|
||||
class InboxMessageListItem extends MessageListItem
|
||||
{
|
||||
/**
|
||||
* Returns the profile we want to show with the message
|
||||
*
|
||||
* @return Profile The profile that matches the message
|
||||
*/
|
||||
function getMessageProfile()
|
||||
{
|
||||
return $this->message->getFrom();
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||
|
||||
// @todo XXX: Add documentation.
|
||||
class InviteAction extends CurrentUserDesignAction
|
||||
{
|
||||
var $mode = null;
|
||||
@ -217,7 +218,7 @@ class InviteAction extends CurrentUserDesignAction
|
||||
$this->textarea('addresses', _('Email addresses'),
|
||||
$this->trimmed('addresses'),
|
||||
// TRANS: Tooltip for field label for a list of e-mail addresses.
|
||||
_('Addresses of friends to invite (one per line)'));
|
||||
_('Addresses of friends to invite (one per line).'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label for a personal message to send to invitees.
|
||||
@ -288,7 +289,7 @@ class InviteAction extends CurrentUserDesignAction
|
||||
mail_send($recipients, $headers, $body);
|
||||
}
|
||||
|
||||
function showLocalNav()
|
||||
function showObjectNav()
|
||||
{
|
||||
$nav = new SubGroupNav($this, common_current_user());
|
||||
$nav->show();
|
||||
|
@ -43,7 +43,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class JoingroupAction extends Action
|
||||
{
|
||||
var $group = null;
|
||||
@ -51,12 +50,12 @@ class JoingroupAction extends Action
|
||||
/**
|
||||
* Prepare to run
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to join a group while not logged in.
|
||||
$this->clientError(_('You must be logged in to join a group.'));
|
||||
return false;
|
||||
}
|
||||
@ -79,17 +78,20 @@ class JoingroupAction extends Action
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when trying to join a non-local group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
} else {
|
||||
// TRANS: Client error displayed when trying to join a group without providing a group name or group ID.
|
||||
$this->clientError(_('No nickname or ID.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when trying to join a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -97,11 +99,13 @@ class JoingroupAction extends Action
|
||||
$cur = common_current_user();
|
||||
|
||||
if ($cur->isMember($this->group)) {
|
||||
// TRANS: Client error displayed when trying to join a group while already a member.
|
||||
$this->clientError(_('You are already a member of that group.'), 403);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Group_block::isBlocked($this->group, $cur->getProfile())) {
|
||||
// TRANS: Client error displayed when trying to join a group while being blocked form joining it.
|
||||
$this->clientError(_('You have been blocked from that group by the admin.'), 403);
|
||||
return false;
|
||||
}
|
||||
@ -118,7 +122,6 @@ class JoingroupAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -131,14 +134,18 @@ class JoingroupAction extends Action
|
||||
Event::handle('EndJoinGroup', array($this->group, $cur));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// TRANS: Server error displayed when joining a group failed in the database.
|
||||
// TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.
|
||||
$this->serverError(sprintf(_('Could not join user %1$s to group %2$s.'),
|
||||
$cur->nickname, $this->group->nickname));
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
$this->element('title', null, sprintf(_('%1$s joined group %2$s'),
|
||||
// TRANS: Title for join group page after joining.
|
||||
$this->element('title', null, sprintf(_m('TITLE','%1$s joined group %2$s'),
|
||||
$cur->nickname,
|
||||
$this->group->nickname));
|
||||
$this->elementEnd('head');
|
||||
@ -153,4 +160,4 @@ class JoingroupAction extends Action
|
||||
303);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class LeavegroupAction extends Action
|
||||
{
|
||||
var $group = null;
|
||||
@ -51,12 +50,12 @@ class LeavegroupAction extends Action
|
||||
/**
|
||||
* Prepare to run
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to leave a group while not logged in.
|
||||
$this->clientError(_('You must be logged in to leave a group.'));
|
||||
return false;
|
||||
}
|
||||
@ -79,17 +78,20 @@ class LeavegroupAction extends Action
|
||||
$local = Local_group::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$local) {
|
||||
// TRANS: Client error displayed when trying to leave a non-local group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->group = User_group::staticGet('id', $local->group_id);
|
||||
} else {
|
||||
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
|
||||
$this->clientError(_('No nickname or ID.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->group) {
|
||||
// TRANS: Client error displayed when trying to leave a non-existing group.
|
||||
$this->clientError(_('No such group.'), 404);
|
||||
return false;
|
||||
}
|
||||
@ -97,6 +99,7 @@ class LeavegroupAction extends Action
|
||||
$cur = common_current_user();
|
||||
|
||||
if (!$cur->isMember($this->group)) {
|
||||
// TRANS: Client error displayed when trying to join a group while already a member.
|
||||
$this->clientError(_('You are not a member of that group.'), 403);
|
||||
return false;
|
||||
}
|
||||
@ -113,7 +116,6 @@ class LeavegroupAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -126,6 +128,8 @@ class LeavegroupAction extends Action
|
||||
Event::handle('EndLeaveGroup', array($this->group, $cur));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// TRANS: Server error displayed when leaving a group failed in the database.
|
||||
// TRANS: %1$s is the leaving user's nickname, $2$s is the group nickname for which the leave failed.
|
||||
$this->serverError(sprintf(_('Could not remove user %1$s from group %2$s.'),
|
||||
$cur->nickname, $this->group->nickname));
|
||||
return;
|
||||
@ -134,7 +138,8 @@ class LeavegroupAction extends Action
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
$this->element('title', null, sprintf(_('%1$s left group %2$s'),
|
||||
// TRANS: Title for leave group page after leaving.
|
||||
$this->element('title', null, sprintf(_m('TITLE','%1$s left group %2$s'),
|
||||
$cur->nickname,
|
||||
$this->group->nickname));
|
||||
$this->elementEnd('head');
|
||||
|
@ -40,10 +40,8 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class LicenseadminpanelAction extends AdminPanelAction
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns the page title
|
||||
*
|
||||
@ -61,9 +59,9 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return string instructions
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Form instructions for the site license admin panel.
|
||||
return _('License for this StatusNet site');
|
||||
}
|
||||
|
||||
@ -72,7 +70,6 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showForm()
|
||||
{
|
||||
$form = new LicenseAdminPanelForm($this);
|
||||
@ -85,7 +82,6 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveSettings()
|
||||
{
|
||||
static $settings = array(
|
||||
@ -128,7 +124,6 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
*
|
||||
* @return nothing
|
||||
*/
|
||||
|
||||
function validate(&$values)
|
||||
{
|
||||
// Validate license type (shouldn't have to do it, but just in case)
|
||||
@ -136,7 +131,8 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
$types = array('private', 'allrightsreserved', 'cc');
|
||||
|
||||
if (!in_array($values['license']['type'], $types)) {
|
||||
$this->clientError(_("Invalid license selection."));
|
||||
// TRANS: Client error displayed selecting an invalid license in the license admin panel.
|
||||
$this->clientError(_('Invalid license selection.'));
|
||||
}
|
||||
|
||||
// Make sure the user has set an owner if the site has a private
|
||||
@ -146,13 +142,15 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
&& empty($values['license']['owner'])
|
||||
) {
|
||||
$this->clientError(
|
||||
_("You must specify the owner of the content when using the All Rights Reserved license.")
|
||||
// TRANS: Client error displayed when not specifying an owner for the all rights reserved license in the license admin panel.
|
||||
_('You must specify the owner of the content when using the All Rights Reserved license.')
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure the license title is not too long
|
||||
if (mb_strlen($values['license']['type']) > 255) {
|
||||
$this->clientError(
|
||||
// TRANS: Client error displayed selecting a too long license title in the license admin panel.
|
||||
_('Invalid license title. Maximum length is 255 characters.')
|
||||
);
|
||||
}
|
||||
@ -165,10 +163,12 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
|
||||
if ($values['license']['type'] == 'cc') {
|
||||
if (!Validate::uri($values['license']['url'], $options)) {
|
||||
$this->clientError(_("Invalid license URL."));
|
||||
// TRANS: Client error displayed specifying an invalid license URL in the license admin panel.
|
||||
$this->clientError(_('Invalid license URL.'));
|
||||
}
|
||||
if (!Validate::uri($values['license']['image'], $options)) {
|
||||
$this->clientError(_("Invalid license image URL."));
|
||||
// TRANS: Client error displayed specifying an invalid license image URL in the license admin panel.
|
||||
$this->clientError(_('Invalid license image URL.'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,7 +176,8 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
|
||||
if (!empty($values['license']['url'])) {
|
||||
if (!Validate::uri($values['license']['url'], $options)) {
|
||||
$this->clientError(_("License URL must be blank or a valid URL."));
|
||||
// TRANS: Client error displayed specifying an invalid license URL in the license admin panel.
|
||||
$this->clientError(_('License URL must be blank or a valid URL.'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +185,8 @@ class LicenseadminpanelAction extends AdminPanelAction
|
||||
|
||||
if (!empty($values['license']['image'])) {
|
||||
if (!Validate::uri($values['license']['image'], $options)) {
|
||||
$this->clientError(_("License image must be blank or valid URL."));
|
||||
// TRANS: Client error displayed specifying an invalid license image URL in the license admin panel.
|
||||
$this->clientError(_('License image must be blank or valid URL.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,7 +199,6 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return int ID of the form
|
||||
*/
|
||||
|
||||
function id()
|
||||
{
|
||||
return 'licenseadminpanel';
|
||||
@ -208,7 +209,6 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return string class of the form
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_settings';
|
||||
@ -236,22 +236,28 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
$this->out->elementStart(
|
||||
'fieldset', array('id' => 'settings_license-selection')
|
||||
);
|
||||
// TRANS: Form legend in the license admin panel.
|
||||
$this->out->element('legend', null, _('License selection'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
|
||||
$types = array(
|
||||
// TRANS: License option in the license admin panel.
|
||||
'private' => _('Private'),
|
||||
// TRANS: License option in the license admin panel.
|
||||
'allrightsreserved' => _('All Rights Reserved'),
|
||||
// TRANS: License option in the license admin panel.
|
||||
'cc' => _('Creative Commons')
|
||||
);
|
||||
|
||||
$this->out->dropdown(
|
||||
'type',
|
||||
// TRANS: Dropdown field label in the license admin panel.
|
||||
_('Type'),
|
||||
$types,
|
||||
_('Select license'),
|
||||
// TRANS: Dropdown field instructions in the license admin panel.
|
||||
_('Select a license.'),
|
||||
false,
|
||||
$this->value('type', 'license')
|
||||
);
|
||||
@ -265,13 +271,16 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
'fieldset',
|
||||
array('id' => 'settings_license-details')
|
||||
);
|
||||
// TRANS: Form legend in the license admin panel.
|
||||
$this->out->element('legend', null, _('License details'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
$this->li();
|
||||
$this->input(
|
||||
'owner',
|
||||
// TRANS: Field label in the license admin panel.
|
||||
_('Owner'),
|
||||
// TRANS: Field title in the license admin panel.
|
||||
_('Name of the owner of the site\'s content (if applicable).'),
|
||||
'license'
|
||||
);
|
||||
@ -280,7 +289,9 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
$this->li();
|
||||
$this->input(
|
||||
'title',
|
||||
// TRANS: Field label in the license admin panel.
|
||||
_('License Title'),
|
||||
// TRANS: Field title in the license admin panel.
|
||||
_('The title of the license.'),
|
||||
'license'
|
||||
);
|
||||
@ -289,7 +300,9 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
$this->li();
|
||||
$this->input(
|
||||
'url',
|
||||
// TRANS: Field label in the license admin panel.
|
||||
_('License URL'),
|
||||
// TRANS: Field title in the license admin panel.
|
||||
_('URL for more information about the license.'),
|
||||
'license'
|
||||
);
|
||||
@ -297,7 +310,9 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
|
||||
$this->li();
|
||||
$this->input(
|
||||
// TRANS: Field label in the license admin panel.
|
||||
'image', _('License Image URL'),
|
||||
// TRANS: Field title in the license admin panel.
|
||||
_('URL for an image to display with the license.'),
|
||||
'license'
|
||||
);
|
||||
@ -312,11 +327,16 @@ class LicenseAdminPanelForm extends AdminForm
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit(
|
||||
'submit', _('Save'), 'submit', null, _('Save license settings')
|
||||
'submit',
|
||||
// TRANS: Button text in the license admin panel.
|
||||
_m('BUTTON','Save'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Button title in the license admin panel.
|
||||
_('Save license settings.')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -42,13 +42,11 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class LoginAction extends Action
|
||||
{
|
||||
/**
|
||||
* Has there been an error?
|
||||
*/
|
||||
|
||||
var $error = null;
|
||||
|
||||
/**
|
||||
@ -56,12 +54,32 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return boolean false
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare page to run
|
||||
*
|
||||
*
|
||||
* @param $args
|
||||
* @return string title
|
||||
*/
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
// @todo this check should really be in index.php for all sensitive actions
|
||||
$ssl = common_config('site', 'ssl');
|
||||
if (empty($_SERVER['HTTPS']) && ($ssl == 'always' || $ssl == 'sometimes')) {
|
||||
common_redirect(common_local_url('login'));
|
||||
// exit
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle input, produce output
|
||||
*
|
||||
@ -71,12 +89,12 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
if (common_is_real_login()) {
|
||||
// TRANS: Client error displayed when trying to log in while already logged in.
|
||||
$this->clientError(_('Already logged in.'));
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->checkLogin();
|
||||
@ -95,8 +113,7 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function checkLogin($user_id=null)
|
||||
function checkLogin($user_id=null, $token=null)
|
||||
{
|
||||
// XXX: login throttle
|
||||
|
||||
@ -106,12 +123,14 @@ class LoginAction extends Action
|
||||
$user = common_check_user($nickname, $password);
|
||||
|
||||
if (!$user) {
|
||||
// TRANS: Form validation error displayed when trying to log in with incorrect credentials.
|
||||
$this->showForm(_('Incorrect username or password.'));
|
||||
return;
|
||||
}
|
||||
|
||||
// success!
|
||||
if (!common_set_user($user)) {
|
||||
// TRANS: Server error displayed when during login a server error occurs.
|
||||
$this->serverError(_('Error setting user. You are probably not authorized.'));
|
||||
return;
|
||||
}
|
||||
@ -147,7 +166,6 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showForm($error=null)
|
||||
{
|
||||
$this->error = $error;
|
||||
@ -165,9 +183,9 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return string title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for login page.
|
||||
return _('Login');
|
||||
}
|
||||
|
||||
@ -179,7 +197,6 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
if ($this->error) {
|
||||
@ -199,7 +216,6 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
$this->elementStart('form', array('method' => 'post',
|
||||
@ -207,25 +223,32 @@ class LoginAction extends Action
|
||||
'class' => 'form_settings',
|
||||
'action' => common_local_url('login')));
|
||||
$this->elementStart('fieldset');
|
||||
// TRANS: Form legend on login page.
|
||||
$this->element('legend', null, _('Login to site'));
|
||||
$this->elementStart('ul', 'form_data');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label on login page.
|
||||
$this->input('nickname', _('Nickname'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label on login page.
|
||||
$this->password('password', _('Password'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
// TRANS: Checkbox label label on login page.
|
||||
$this->checkbox('rememberme', _('Remember me'), false,
|
||||
// TRANS: Checkbox title on login page.
|
||||
_('Automatically login in the future; ' .
|
||||
'not for shared computers!'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
$this->submit('submit', _('Login'));
|
||||
// TRANS: Button text for log in on login page.
|
||||
$this->submit('submit', _m('BUTTON','Login'));
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
$this->elementStart('p');
|
||||
$this->element('a', array('href' => common_local_url('recoverpassword')),
|
||||
// TRANS: Link text for link to "reset password" on login page.
|
||||
_('Lost or forgotten password?'));
|
||||
$this->elementEnd('p');
|
||||
}
|
||||
@ -238,20 +261,23 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
if (common_logged_in() && !common_is_real_login() &&
|
||||
common_get_returnto()) {
|
||||
// rememberme logins have to reauthenticate before
|
||||
// changing any profile settings (cookie-stealing protection)
|
||||
// TRANS: Form instructions on login page before being able to change user settings.
|
||||
return _('For security reasons, please re-enter your ' .
|
||||
'user name and password ' .
|
||||
'before changing your settings.');
|
||||
} else {
|
||||
// TRANS: Form instructions on login page.
|
||||
$prompt = _('Login with your username and password.');
|
||||
if (!common_config('site', 'closed') && !common_config('site', 'inviteonly')) {
|
||||
$prompt .= ' ';
|
||||
// TRANS: Form instructions on login page. This message contains Markdown links in the form [Link text](Link).
|
||||
// TRANS: %%action.register%% is a link to the registration page.
|
||||
$prompt .= _('Don\'t have a username yet? ' .
|
||||
'[Register](%%action.register%%) a new account.');
|
||||
}
|
||||
@ -266,10 +292,13 @@ class LoginAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showLocalNav()
|
||||
{
|
||||
$nav = new LoginGroupNav($this);
|
||||
$nav->show();
|
||||
}
|
||||
|
||||
function showNoticeForm()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
*/
|
||||
class LogoutAction extends Action
|
||||
{
|
||||
|
||||
/**
|
||||
* This is read only.
|
||||
*
|
||||
@ -66,6 +65,7 @@ class LogoutAction extends Action
|
||||
{
|
||||
parent::handle($args);
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to log out when not logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
} else {
|
||||
if (Event::handle('StartLogout', array($this))) {
|
||||
@ -83,5 +83,4 @@ class LogoutAction extends Action
|
||||
common_real_login(false); // not logged in
|
||||
common_forgetme(); // don't log back in!
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ class MakeadminAction extends RedirectingAction
|
||||
{
|
||||
parent::prepare($args);
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed when trying to access the "make admin" page while not logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
return false;
|
||||
}
|
||||
@ -68,31 +69,38 @@ class MakeadminAction extends RedirectingAction
|
||||
}
|
||||
$id = $this->trimmed('profileid');
|
||||
if (empty($id)) {
|
||||
// TRANS: Client error displayed when not providing a profile ID on the Make Admin page.
|
||||
$this->clientError(_('No profile specified.'));
|
||||
return false;
|
||||
}
|
||||
$this->profile = Profile::staticGet('id', $id);
|
||||
if (empty($this->profile)) {
|
||||
// TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page.
|
||||
$this->clientError(_('No profile with that ID.'));
|
||||
return false;
|
||||
}
|
||||
$group_id = $this->trimmed('groupid');
|
||||
if (empty($group_id)) {
|
||||
// TRANS: Client error displayed when not providing a group ID on the Make Admin page.
|
||||
$this->clientError(_('No group specified.'));
|
||||
return false;
|
||||
}
|
||||
$this->group = User_group::staticGet('id', $group_id);
|
||||
if (empty($this->group)) {
|
||||
// TRANS: Client error displayed when providing an invalid group ID on the Make Admin page.
|
||||
$this->clientError(_('No such group.'));
|
||||
return false;
|
||||
}
|
||||
$user = common_current_user();
|
||||
if (!$user->isAdmin($this->group) &&
|
||||
!$user->hasRight(Right::MAKEGROUPADMIN)) {
|
||||
// TRANS: Client error displayed when trying to make another user admin on the Make Admin page while not an admin.
|
||||
$this->clientError(_('Only an admin can make another user an admin.'), 401);
|
||||
return false;
|
||||
}
|
||||
if ($this->profile->isAdmin($this->group)) {
|
||||
// TRANS: Client error displayed when trying to make another user admin on the Make Admin page who already is admin.
|
||||
// TRANS: %1$s is the user that is already admin, %2$s is the group user is already admin for.
|
||||
$this->clientError(sprintf(_('%1$s is already an admin for group "%2$s".'),
|
||||
$this->profile->getBestName(),
|
||||
$this->group->getBestName()),
|
||||
@ -130,6 +138,9 @@ class MakeadminAction extends RedirectingAction
|
||||
'profile_id' => $this->profile->id));
|
||||
|
||||
if (empty($member)) {
|
||||
// TRANS: Server error displayed when trying to make another user admin on the Make Admin page fails
|
||||
// TRANS: because the group membership record could not be gotten.
|
||||
// TRANS: %1$s is the to be admin user, %2$s is the group user should be admin for.
|
||||
$this->serverError(_('Can\'t get membership record for %1$s in group %2$s.'),
|
||||
$this->profile->getBestName(),
|
||||
$this->group->getBestName());
|
||||
@ -143,6 +154,9 @@ class MakeadminAction extends RedirectingAction
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($member, 'UPDATE', __FILE__);
|
||||
// TRANS: Server error displayed when trying to make another user admin on the Make Admin page fails
|
||||
// TRANS: because the group adminship record coud not be saved properly.
|
||||
// TRANS: %1$s is the to be admin user, %2$s is the group user is already admin for.
|
||||
$this->serverError(_('Can\'t make %1$s an admin for group %2$s.'),
|
||||
$this->profile->getBestName(),
|
||||
$this->group->getBestName());
|
||||
|
@ -46,7 +46,7 @@ class MicrosummaryAction extends Action
|
||||
{
|
||||
/**
|
||||
* Class handler.
|
||||
*
|
||||
*
|
||||
* @param array $args array of arguments
|
||||
*
|
||||
* @return nothing
|
||||
@ -59,18 +59,20 @@ class MicrosummaryAction extends Action
|
||||
$user = User::staticGet('nickname', $nickname);
|
||||
|
||||
if (!$user) {
|
||||
// TRANS: Client error displayed trying to make a micro summary without providing a valid user.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$notice = $user->getCurrentNotice();
|
||||
|
||||
|
||||
if (!$notice) {
|
||||
// TRANS: Client error displayed trying to make a micro summary without providing a status.
|
||||
$this->clientError(_('No current status.'), 404);
|
||||
}
|
||||
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
|
||||
print $user->nickname . ': ' . $notice->content;
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
* @category Applications
|
||||
* @package StatusNet
|
||||
* @author Zach Copley <zach@status.net>
|
||||
* @copyright 2008-2009 StatusNet, Inc.
|
||||
* @copyright 2008-2011 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
@ -55,7 +55,6 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
/**
|
||||
* Prepare to run
|
||||
*/
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -78,7 +77,6 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
@ -122,6 +120,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
} elseif ($this->arg('save')) {
|
||||
$this->trySave();
|
||||
} else {
|
||||
// TRANS: Client error displayed when encountering an unexpected action on form submission.
|
||||
$this->clientError(_('Unexpected form submission.'));
|
||||
}
|
||||
}
|
||||
@ -144,6 +143,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
$this->element('p', 'error', $this->msg);
|
||||
} else {
|
||||
$this->element('p', 'instructions',
|
||||
// TRANS: Form instructions for registering a new application.
|
||||
_('Use this form to register a new application.'));
|
||||
}
|
||||
}
|
||||
@ -160,15 +160,19 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
$access_type = $this->arg('default_access_type');
|
||||
|
||||
if (empty($name)) {
|
||||
// TRANS: Validation error shown when not providing a name in the "New application" form.
|
||||
$this->showForm(_('Name is required.'));
|
||||
return;
|
||||
} else if ($this->nameExists($name)) {
|
||||
// TRANS: Validation error shown when providing a name for an application that already exists in the "New application" form.
|
||||
$this->showForm(_('Name already in use. Try another one.'));
|
||||
return;
|
||||
} elseif (mb_strlen($name) > 255) {
|
||||
// TRANS: Validation error shown when providing too long a name in the "New application" form.
|
||||
$this->showForm(_('Name is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} elseif (empty($description)) {
|
||||
// TRANS: Validation error shown when not providing a description in the "New application" form.
|
||||
$this->showForm(_('Description is required.'));
|
||||
return;
|
||||
} elseif (Oauth_application::descriptionTooLong($description)) {
|
||||
@ -181,6 +185,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
Oauth_application::maxDesc()));
|
||||
return;
|
||||
} elseif (empty($source_url)) {
|
||||
// TRANS: Validation error shown when not providing a source URL in the "New application" form.
|
||||
$this->showForm(_('Source URL is required.'));
|
||||
return;
|
||||
} elseif ((strlen($source_url) > 0)
|
||||
@ -190,15 +195,19 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
)
|
||||
)
|
||||
{
|
||||
// TRANS: Validation error shown when providing an invalid source URL in the "New application" form.
|
||||
$this->showForm(_('Source URL is not valid.'));
|
||||
return;
|
||||
} elseif (empty($organization)) {
|
||||
// TRANS: Validation error shown when not providing an organisation in the "New application" form.
|
||||
$this->showForm(_('Organization is required.'));
|
||||
return;
|
||||
} elseif (mb_strlen($organization) > 255) {
|
||||
// TRANS: Validation error shown when providing too long an arganisation name in the "Edit application" form.
|
||||
$this->showForm(_('Organization is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} elseif (empty($homepage)) {
|
||||
// TRANS: Form validation error show when an organisation name has not been provided in the new application form.
|
||||
$this->showForm(_('Organization homepage is required.'));
|
||||
return;
|
||||
} elseif ((strlen($homepage) > 0)
|
||||
@ -208,9 +217,11 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
)
|
||||
)
|
||||
{
|
||||
// TRANS: Validation error shown when providing an invalid homepage URL in the "New application" form.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
return;
|
||||
} elseif (mb_strlen($callback_url) > 255) {
|
||||
// TRANS: Validation error shown when providing too long a callback URL in the "New application" form.
|
||||
$this->showForm(_('Callback is too long.'));
|
||||
return;
|
||||
} elseif (strlen($callback_url) > 0
|
||||
@ -220,6 +231,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
)
|
||||
)
|
||||
{
|
||||
// TRANS: Validation error shown when providing an invalid callback URL in the "New application" form.
|
||||
$this->showForm(_('Callback URL is not valid.'));
|
||||
return;
|
||||
}
|
||||
@ -263,6 +275,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
|
||||
if (!$result) {
|
||||
common_log_db_error($consumer, 'INSERT', __FILE__);
|
||||
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
|
||||
$this->serverError(_('Could not create application.'));
|
||||
}
|
||||
|
||||
@ -272,16 +285,22 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
|
||||
if (!$this->app_id) {
|
||||
common_log_db_error($app, 'INSERT', __FILE__);
|
||||
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
|
||||
$this->serverError(_('Could not create application.'));
|
||||
$app->query('ROLLBACK');
|
||||
}
|
||||
|
||||
$app->uploadLogo();
|
||||
try {
|
||||
$app->uploadLogo();
|
||||
} catch (Exception $e) {
|
||||
$app->query('ROLLBACK');
|
||||
$this->showForm(_('Invalid image.'));
|
||||
return;
|
||||
}
|
||||
|
||||
$app->query('COMMIT');
|
||||
|
||||
common_redirect(common_local_url('oauthappssettings'), 303);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,12 +313,9 @@ class NewApplicationAction extends OwnerDesignAction
|
||||
*
|
||||
* @return boolean true if the name already exists
|
||||
*/
|
||||
|
||||
function nameExists($name)
|
||||
{
|
||||
$app = Oauth_application::staticGet('name', $name);
|
||||
return !empty($app);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,13 @@ class NewgroupAction extends Action
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = common_current_user();
|
||||
$profile = $user->getProfile();
|
||||
if (!$profile->hasRight(Right::CREATEGROUP)) {
|
||||
// TRANS: Client exception thrown when a user tries to create a group while banned.
|
||||
throw new ClientException(_('You are not allowed to create groups on this site.'), 403);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -113,105 +120,109 @@ class NewgroupAction extends Action
|
||||
|
||||
function trySave()
|
||||
{
|
||||
try {
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
} catch (NicknameException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
}
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
$location = $this->trimmed('location');
|
||||
$aliasstring = $this->trimmed('aliases');
|
||||
if (Event::handle('StartGroupSaveForm', array($this))) {
|
||||
try {
|
||||
$nickname = Nickname::normalize($this->trimmed('nickname'));
|
||||
} catch (NicknameException $e) {
|
||||
$this->showForm($e->getMessage());
|
||||
}
|
||||
$fullname = $this->trimmed('fullname');
|
||||
$homepage = $this->trimmed('homepage');
|
||||
$description = $this->trimmed('description');
|
||||
$location = $this->trimmed('location');
|
||||
$aliasstring = $this->trimmed('aliases');
|
||||
|
||||
if ($this->nicknameExists($nickname)) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Nickname already in use. Try another one.'));
|
||||
return;
|
||||
} else if (!User_group::allowedNickname($nickname)) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Not a valid nickname.'));
|
||||
return;
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
|
||||
!Validate::uri($homepage,
|
||||
array('allowed_schemes' =>
|
||||
array('http', 'https')))) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
return;
|
||||
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} else if (User_group::descriptionTooLong($description)) {
|
||||
// TRANS: Group create form validation error.
|
||||
// TRANS: %d is the maximum number of allowed characters.
|
||||
$this->showForm(sprintf(_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
User_group::maxDescription()));
|
||||
return;
|
||||
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($aliasstring)) {
|
||||
$aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\s,]+/', $aliasstring)));
|
||||
} else {
|
||||
$aliases = array();
|
||||
}
|
||||
|
||||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||
// TRANS: Group create form validation error.
|
||||
// TRANS: %d is the maximum number of allowed aliases.
|
||||
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')));
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
if (!Nickname::isValid($alias)) {
|
||||
if ($this->nicknameExists($nickname)) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
|
||||
$this->showForm(_('Nickname already in use. Try another one.'));
|
||||
return;
|
||||
} else if (!User_group::allowedNickname($nickname)) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Not a valid nickname.'));
|
||||
return;
|
||||
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
|
||||
!Validate::uri($homepage,
|
||||
array('allowed_schemes' =>
|
||||
array('http', 'https')))) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Homepage is not a valid URL.'));
|
||||
return;
|
||||
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
||||
return;
|
||||
} else if (User_group::descriptionTooLong($description)) {
|
||||
// TRANS: Group create form validation error.
|
||||
// TRANS: %d is the maximum number of allowed characters.
|
||||
$this->showForm(sprintf(_m('Description is too long (maximum %d character).',
|
||||
'Description is too long (maximum %d characters).',
|
||||
User_group::maxDescription()),
|
||||
User_group::maxDescription()));
|
||||
return;
|
||||
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
||||
return;
|
||||
}
|
||||
if ($this->nicknameExists($alias)) {
|
||||
|
||||
if (!empty($aliasstring)) {
|
||||
$aliases = array_map('common_canonical_nickname', array_unique(preg_split('/[\s,]+/', $aliasstring)));
|
||||
} else {
|
||||
$aliases = array();
|
||||
}
|
||||
|
||||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
|
||||
$alias));
|
||||
// TRANS: %d is the maximum number of allowed aliases.
|
||||
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
|
||||
'Too many aliases! Maximum %d allowed.',
|
||||
common_config('group', 'maxaliases')),
|
||||
common_config('group', 'maxaliases')));
|
||||
return;
|
||||
}
|
||||
// XXX assumes alphanum nicknames
|
||||
if (strcmp($alias, $nickname) == 0) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Alias can\'t be the same as nickname.'));
|
||||
return;
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
if (!Nickname::isValid($alias)) {
|
||||
// TRANS: Group create form validation error.
|
||||
// TRANS: %s is the invalid alias.
|
||||
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
|
||||
return;
|
||||
}
|
||||
if ($this->nicknameExists($alias)) {
|
||||
// TRANS: Group create form validation error. %s is the already used alias.
|
||||
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
|
||||
$alias));
|
||||
return;
|
||||
}
|
||||
// XXX assumes alphanum nicknames
|
||||
if (strcmp($alias, $nickname) == 0) {
|
||||
// TRANS: Group create form validation error.
|
||||
$this->showForm(_('Alias cannot be the same as nickname.'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
// Checked in prepare() above
|
||||
|
||||
assert(!is_null($cur));
|
||||
|
||||
$group = User_group::register(array('nickname' => $nickname,
|
||||
'fullname' => $fullname,
|
||||
'homepage' => $homepage,
|
||||
'description' => $description,
|
||||
'location' => $location,
|
||||
'aliases' => $aliases,
|
||||
'userid' => $cur->id,
|
||||
'local' => true));
|
||||
|
||||
$this->group = $group;
|
||||
|
||||
Event::handle('EndGroupSaveForm', array($this));
|
||||
|
||||
common_redirect($group->homeUrl(), 303);
|
||||
}
|
||||
|
||||
$mainpage = common_local_url('showgroup', array('nickname' => $nickname));
|
||||
|
||||
$cur = common_current_user();
|
||||
|
||||
// Checked in prepare() above
|
||||
|
||||
assert(!is_null($cur));
|
||||
|
||||
$group = User_group::register(array('nickname' => $nickname,
|
||||
'fullname' => $fullname,
|
||||
'homepage' => $homepage,
|
||||
'description' => $description,
|
||||
'location' => $location,
|
||||
'aliases' => $aliases,
|
||||
'userid' => $cur->id,
|
||||
'mainpage' => $mainpage,
|
||||
'local' => true));
|
||||
|
||||
common_redirect($group->homeUrl(), 303);
|
||||
}
|
||||
|
||||
function nicknameExists($nickname)
|
||||
|
@ -68,6 +68,7 @@ class NewmessageAction extends Action
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for new direct message page.
|
||||
return _('New message');
|
||||
}
|
||||
|
||||
@ -84,6 +85,7 @@ class NewmessageAction extends Action
|
||||
parent::handle($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to create a new direct message while not logged in.
|
||||
$this->clientError(_('Not logged in.'), 403);
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$this->saveNewMessage();
|
||||
@ -113,12 +115,15 @@ class NewmessageAction extends Action
|
||||
$this->other = User::staticGet('id', $this->to);
|
||||
|
||||
if (!$this->other) {
|
||||
// TRANS: Client error displayed trying to send a direct message to a non-existing user.
|
||||
$this->clientError(_('No such user.'), 404);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$user->mutuallySubscribed($this->other)) {
|
||||
$this->clientError(_('You can\'t send a message to this user.'), 404);
|
||||
// TRANS: Client error displayed trying to send a direct message to a user while sender and
|
||||
// TRANS: receiver are not subscribed to each other.
|
||||
$this->clientError(_('You cannot send a message to this user.'), 404);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -141,6 +146,7 @@ class NewmessageAction extends Action
|
||||
assert($user); // XXX: maybe an error instead...
|
||||
|
||||
if (!$this->content) {
|
||||
// TRANS: Form validator error displayed trying to send a direct message without content.
|
||||
$this->showForm(_('No content!'));
|
||||
return;
|
||||
} else {
|
||||
@ -158,12 +164,16 @@ class NewmessageAction extends Action
|
||||
}
|
||||
|
||||
if (!$this->other) {
|
||||
// TRANS: Form validation error displayed trying to send a direct message without specifying a recipient.
|
||||
$this->showForm(_('No recipient specified.'));
|
||||
return;
|
||||
} else if (!$user->mutuallySubscribed($this->other)) {
|
||||
$this->clientError(_('You can\'t send a message to this user.'), 404);
|
||||
// TRANS: Client error displayed trying to send a direct message to a user while sender and
|
||||
// TRANS: receiver are not subscribed to each other.
|
||||
$this->clientError(_('You cannot send a message to this user.'), 404);
|
||||
return;
|
||||
} else if ($user->id == $this->other->id) {
|
||||
// TRANS: Client error displayed trying to send a direct message to self.
|
||||
$this->clientError(_('Don\'t send a message to yourself; ' .
|
||||
'just say it to yourself quietly instead.'), 403);
|
||||
return;
|
||||
@ -181,10 +191,13 @@ class NewmessageAction extends Action
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after sending a direct message.
|
||||
$this->element('title', null, _('Message sent'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
$this->element('p', array('id' => 'command_result'),
|
||||
// TRANS: Confirmation text after sending a direct message.
|
||||
// TRANS: %s is the direct message recipient.
|
||||
sprintf(_('Direct message to %s sent.'),
|
||||
$this->other->nickname));
|
||||
$this->elementEnd('body');
|
||||
@ -210,6 +223,7 @@ class NewmessageAction extends Action
|
||||
{
|
||||
$this->startHTML('text/xml;charset=utf-8', true);
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after an AJAX error occurred on the "send direct message" page.
|
||||
$this->element('title', null, _('Ajax Error'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
@ -231,6 +245,7 @@ class NewmessageAction extends Action
|
||||
$this->xw->startDocument('1.0', 'UTF-8');
|
||||
$this->elementStart('html');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title on page for sending a direct message.
|
||||
$this->element('title', null, _('New message'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
|
@ -47,13 +47,11 @@ require_once INSTALLDIR . '/lib/mediafile.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 NewnoticeAction extends Action
|
||||
{
|
||||
/**
|
||||
* Error message, if any
|
||||
*/
|
||||
|
||||
var $msg = null;
|
||||
|
||||
/**
|
||||
@ -63,9 +61,9 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for sending a new notice.
|
||||
return _('New notice');
|
||||
}
|
||||
|
||||
@ -85,6 +83,7 @@ class NewnoticeAction extends Action
|
||||
function handle($args)
|
||||
{
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to send a notice while not logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
} else if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
// check for this before token since all POST and FILES data
|
||||
@ -127,7 +126,6 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function saveNewNotice()
|
||||
{
|
||||
$user = common_current_user();
|
||||
@ -137,6 +135,7 @@ class NewnoticeAction extends Action
|
||||
Event::handle('StartSaveNewNoticeWeb', array($this, $user, &$content, &$options));
|
||||
|
||||
if (!$content) {
|
||||
// TRANS: Client error displayed trying to send a notice without content.
|
||||
$this->clientError(_('No content!'));
|
||||
return;
|
||||
}
|
||||
@ -227,6 +226,7 @@ class NewnoticeAction extends Action
|
||||
$this->xw->startDocument('1.0', 'UTF-8');
|
||||
$this->elementStart('html');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after sending a notice.
|
||||
$this->element('title', null, _('Notice posted'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
@ -256,11 +256,11 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function ajaxErrorMsg($msg)
|
||||
{
|
||||
$this->startHTML('text/xml;charset=utf-8', true);
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after an AJAX error occurs on the send notice page.
|
||||
$this->element('title', null, _('Ajax Error'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
@ -269,6 +269,30 @@ class NewnoticeAction extends Action
|
||||
$this->elementEnd('html');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an Ajax-y notice form
|
||||
*
|
||||
* Goes back to the browser, where it's shown in a popup.
|
||||
*
|
||||
* @param string $msg Message to show
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function ajaxShowForm()
|
||||
{
|
||||
$this->startHTML('text/xml;charset=utf-8', true);
|
||||
$this->elementStart('head');
|
||||
$this->element('title', null, _('New notice'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
|
||||
$form = new NoticeForm($this);
|
||||
$form->show();
|
||||
|
||||
$this->elementEnd('body');
|
||||
$this->elementEnd('html');
|
||||
}
|
||||
|
||||
/**
|
||||
* Formerly page output
|
||||
*
|
||||
@ -283,11 +307,14 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showForm($msg=null)
|
||||
{
|
||||
if ($msg && $this->boolean('ajax')) {
|
||||
$this->ajaxErrorMsg($msg);
|
||||
if ($this->boolean('ajax')) {
|
||||
if ($msg) {
|
||||
$this->ajaxErrorMsg($msg);
|
||||
} else {
|
||||
$this->ajaxShowForm();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -302,7 +329,6 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showNoticeForm()
|
||||
{
|
||||
$content = $this->trimmed('status_textarea');
|
||||
@ -331,7 +357,6 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @todo maybe show some instructions?
|
||||
*/
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
if ($this->msg) {
|
||||
@ -348,7 +373,6 @@ class NewnoticeAction extends Action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showNotice($notice)
|
||||
{
|
||||
$nli = new NoticeListItem($notice, $this);
|
||||
|
@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/searchaction.php';
|
||||
*/
|
||||
class NoticesearchAction extends SearchAction
|
||||
{
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -65,6 +64,8 @@ class NoticesearchAction extends SearchAction
|
||||
*/
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for Notice search page.
|
||||
// TRANS: %%site.name%% is the name of the StatusNet site.
|
||||
return _('Search for notices on %%site.name%% by their contents. Separate search terms by spaces; they must be 3 characters or more.');
|
||||
}
|
||||
|
||||
@ -75,6 +76,7 @@ class NoticesearchAction extends SearchAction
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title of the page where users can search for notices.
|
||||
return _('Text search');
|
||||
}
|
||||
|
||||
@ -88,6 +90,8 @@ class NoticesearchAction extends SearchAction
|
||||
|
||||
return array(new Feed(Feed::RSS1, common_local_url('noticesearchrss',
|
||||
array('q' => $q)),
|
||||
// TRANS: Test in RSS notice search.
|
||||
// TRANS: %1$s is the query, %2$s is the StatusNet site name.
|
||||
sprintf(_('Search results for "%1$s" on %2$s'),
|
||||
$q, common_config('site', 'name'))));
|
||||
}
|
||||
@ -114,13 +118,18 @@ class NoticesearchAction extends SearchAction
|
||||
$cnt = $notice->find();
|
||||
}
|
||||
if ($cnt === 0) {
|
||||
// TRANS: Text for notice search results is the query had no results.
|
||||
$this->element('p', 'error', _('No results.'));
|
||||
|
||||
$this->searchSuggestions($q);
|
||||
if (common_logged_in()) {
|
||||
// TRANS: Text for logged in users making a query for notices without results.
|
||||
// TRANS: This message contains a Markdown link.
|
||||
$message = sprintf(_('Be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
|
||||
}
|
||||
else {
|
||||
// TRANS: Text for not logged in users making a query for notices without results.
|
||||
// TRANS: This message contains Markdown links.
|
||||
$message = sprintf(_('Why not [register an account](%%%%action.register%%%%) and be the first to [post on this topic](%%%%action.newnotice%%%%?status_textarea=%s)!'), urlencode($q));
|
||||
}
|
||||
|
||||
@ -193,14 +202,20 @@ class SearchNoticeListItem extends NoticeListItem {
|
||||
$options = implode('|', array_map('preg_quote', array_map('htmlspecialchars', $terms),
|
||||
array_fill(0, sizeof($terms), '/')));
|
||||
$pattern = "/($options)/i";
|
||||
$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
|
||||
$result = '';
|
||||
|
||||
/* Divide up into text (highlight me) and tags (don't touch) */
|
||||
$chunks = preg_split('/(<[^>]+>)/', $text, 0, PREG_SPLIT_DELIM_CAPTURE);
|
||||
foreach ($chunks as $i => $chunk) {
|
||||
if ($i % 2 == 1) {
|
||||
// odd: delimiter (tag)
|
||||
$result .= $chunk;
|
||||
} else {
|
||||
// even: freetext between tags
|
||||
$result .= preg_replace($pattern, '<strong>\\1</strong>', $chunk);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove highlighting from inside links, loop incase multiple highlights in links */
|
||||
$pattern = '/(\w+="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
|
||||
do {
|
||||
$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
|
||||
} while ($count);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,12 +48,11 @@ require_once INSTALLDIR.'/lib/rssaction.php';
|
||||
*/
|
||||
class NoticesearchrssAction extends Rss10Action
|
||||
{
|
||||
|
||||
function init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function prepare($args)
|
||||
{
|
||||
parent::prepare($args);
|
||||
@ -63,7 +62,6 @@ class NoticesearchrssAction extends Rss10Action
|
||||
|
||||
function getNotices($limit=0)
|
||||
{
|
||||
|
||||
$q = $this->trimmed('q');
|
||||
$notices = array();
|
||||
|
||||
@ -93,9 +91,12 @@ class NoticesearchrssAction extends Rss10Action
|
||||
{
|
||||
$q = $this->trimmed('q');
|
||||
$c = array('url' => common_local_url('noticesearchrss', array('q' => $q)),
|
||||
// TRANS: RSS notice search feed title. %s is the query.
|
||||
'title' => sprintf(_('Updates with "%s"'), $q),
|
||||
'link' => common_local_url('noticesearch', array('q' => $q)),
|
||||
'description' => sprintf(_('Updates matching search term "%1$s" on %2$s!'),
|
||||
// TRANS: RSS notice search feed description.
|
||||
// TRANS: %1$s is the query, %2$s is the StatusNet site name.
|
||||
'description' => sprintf(_('Updates matching search term "%1$s" on %2$s.'),
|
||||
$q, common_config('site', 'name')));
|
||||
return $c;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class NudgeAction extends Action
|
||||
parent::handle($args);
|
||||
|
||||
if (!common_logged_in()) {
|
||||
// TRANS: Client error displayed trying to nudge a user without being logged in.
|
||||
$this->clientError(_('Not logged in.'));
|
||||
return;
|
||||
}
|
||||
@ -82,6 +83,7 @@ class NudgeAction extends Action
|
||||
}
|
||||
|
||||
if (!$other->email || !$other->emailnotifynudge) {
|
||||
// TRANS: Client error displayed trying to nudge a user that cannot be nudged.
|
||||
$this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set their email address yet.'));
|
||||
return;
|
||||
}
|
||||
@ -91,9 +93,11 @@ class NudgeAction extends Action
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after sending a nudge.
|
||||
$this->element('title', null, _('Nudge sent'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
// TRANS: Confirmation text after sending a nudge.
|
||||
$this->element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
|
||||
$this->elementEnd('body');
|
||||
$this->elementEnd('html');
|
||||
@ -129,4 +133,3 @@ class NudgeAction extends Action
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/settingsaction.php';
|
||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
||||
|
||||
/**
|
||||
* Show a user's registered OAuth applications
|
||||
*
|
||||
@ -166,6 +163,5 @@ class OauthappssettingsAction extends SettingsAction
|
||||
'Try again, please.'));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR . '/lib/connectsettingsaction.php';
|
||||
require_once INSTALLDIR . '/lib/applicationlist.php';
|
||||
require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||
|
||||
@ -46,7 +45,7 @@ require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||
*
|
||||
* @see SettingsAction
|
||||
*/
|
||||
class OauthconnectionssettingsAction extends ConnectSettingsAction
|
||||
class OauthconnectionssettingsAction extends SettingsAction
|
||||
{
|
||||
var $page = null;
|
||||
var $oauth_token = null;
|
||||
@ -64,7 +63,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return string Title of the page
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for OAuth connection settings.
|
||||
@ -76,7 +74,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
|
||||
*
|
||||
* @return instructions for use
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for OAuth connection settings.
|
||||
|
@ -61,7 +61,9 @@ class OembedAction extends Action
|
||||
$proxy_args = $r->map($path);
|
||||
|
||||
if (!$proxy_args) {
|
||||
$this->serverError(_("$path not found."), 404);
|
||||
// TRANS: Server error displayed in oEmbed action when path not found.
|
||||
// TRANS: %s is a path.
|
||||
$this->serverError(sprintf(_('"%s" not found.'),$path), 404);
|
||||
}
|
||||
$oembed=array();
|
||||
$oembed['version']='1.0';
|
||||
@ -73,13 +75,17 @@ class OembedAction extends Action
|
||||
$id = $proxy_args['notice'];
|
||||
$notice = Notice::staticGet($id);
|
||||
if(empty($notice)){
|
||||
$this->serverError(_("Notice $id not found."), 404);
|
||||
// TRANS: Server error displayed in oEmbed action when notice not found.
|
||||
// TRANS: %s is a notice.
|
||||
$this->serverError(sprintf(_("Notice %s not found."),$id), 404);
|
||||
}
|
||||
$profile = $notice->getProfile();
|
||||
if (empty($profile)) {
|
||||
// TRANS: Server error displayed in oEmbed action when notice has not profile.
|
||||
$this->serverError(_('Notice has no profile.'), 500);
|
||||
}
|
||||
$authorname = $profile->getFancyName();
|
||||
// TRANS: oEmbed title. %1$s is the author name, %2$s is the creation date.
|
||||
$oembed['title'] = sprintf(_('%1$s\'s status on %2$s'),
|
||||
$authorname,
|
||||
common_exact_date($notice->created));
|
||||
@ -92,7 +98,9 @@ class OembedAction extends Action
|
||||
$id = $proxy_args['attachment'];
|
||||
$attachment = File::staticGet($id);
|
||||
if(empty($attachment)){
|
||||
$this->serverError(_("Attachment $id not found."), 404);
|
||||
// TRANS: Server error displayed in oEmbed action when attachment not found.
|
||||
// TRANS: %d is an attachment ID.
|
||||
$this->serverError(sprintf(_('Attachment %s not found.'),$id), 404);
|
||||
}
|
||||
if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){
|
||||
// Proxy the existing oembed information
|
||||
@ -133,7 +141,9 @@ class OembedAction extends Action
|
||||
if($attachment->title) $oembed['title']=$attachment->title;
|
||||
break;
|
||||
default:
|
||||
$this->serverError(_("$path not supported for oembed requests."), 501);
|
||||
// TRANS: Server error displayed in oEmbed request when a path is not supported.
|
||||
// TRANS: %s is a path.
|
||||
$this->serverError(sprintf(_('"%s" not supported for oembed requests.'),$path), 501);
|
||||
}
|
||||
switch($args['format']){
|
||||
case 'xml':
|
||||
@ -190,6 +200,7 @@ class OembedAction extends Action
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TRANS: Server error displayed in oEmbed action when request specifies an unsupported data format.
|
||||
$this->serverError(_('Not a supported data format.'), 501);
|
||||
break;
|
||||
}
|
||||
@ -209,6 +220,7 @@ class OembedAction extends Action
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TRANS: Server error displayed in oEmbed action when request specifies an unsupported data format.
|
||||
$this->serverError(_('Not a supported data format.'), 501);
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Opensearch action class.
|
||||
*
|
||||
@ -51,7 +50,7 @@ class OpensearchAction extends Action
|
||||
* Class handler.
|
||||
*
|
||||
* @param array $args query arguments
|
||||
*
|
||||
*
|
||||
* @return boolean false if user doesn't exist
|
||||
*/
|
||||
function handle($args)
|
||||
@ -61,9 +60,11 @@ class OpensearchAction extends Action
|
||||
$short_name = '';
|
||||
if ($type == 'people') {
|
||||
$type = 'peoplesearch';
|
||||
// TRANS: ShortName in the OpenSearch interface when trying to find users.
|
||||
$short_name = _('People Search');
|
||||
} else {
|
||||
$type = 'noticesearch';
|
||||
// TRANS: ShortName in the OpenSearch interface when trying to find notices.
|
||||
$short_name = _('Notice Search');
|
||||
}
|
||||
header('Content-Type: application/opensearchdescription+xml');
|
||||
@ -89,4 +90,3 @@ class OpensearchAction extends Action
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ if (!defined('STATUSNET')) {
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class OtpAction extends Action
|
||||
{
|
||||
var $user;
|
||||
@ -59,6 +58,7 @@ class OtpAction extends Action
|
||||
parent::prepare($args);
|
||||
|
||||
if (common_is_real_login()) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" when already logged in.
|
||||
$this->clientError(_('Already logged in.'));
|
||||
return false;
|
||||
}
|
||||
@ -66,6 +66,7 @@ class OtpAction extends Action
|
||||
$id = $this->trimmed('user_id');
|
||||
|
||||
if (empty($id)) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" without specifying a user.
|
||||
$this->clientError(_('No user ID specified.'));
|
||||
return false;
|
||||
}
|
||||
@ -73,6 +74,7 @@ class OtpAction extends Action
|
||||
$this->user = User::staticGet('id', $id);
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" without using an existing user.
|
||||
$this->clientError(_('No such user.'));
|
||||
return false;
|
||||
}
|
||||
@ -80,6 +82,7 @@ class OtpAction extends Action
|
||||
$this->token = $this->trimmed('token');
|
||||
|
||||
if (empty($this->token)) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" without specifying a login token.
|
||||
$this->clientError(_('No login token specified.'));
|
||||
return false;
|
||||
}
|
||||
@ -87,11 +90,13 @@ class OtpAction extends Action
|
||||
$this->lt = Login_token::staticGet('user_id', $id);
|
||||
|
||||
if (empty($this->lt)) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" without requesting a login token.
|
||||
$this->clientError(_('No login token requested.'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->lt->token != $this->token) {
|
||||
// TRANS: Client error displayed trying to use "one time password login" while specifying an invalid login token.
|
||||
$this->clientError(_('Invalid login token specified.'));
|
||||
return false;
|
||||
}
|
||||
@ -101,6 +106,7 @@ class OtpAction extends Action
|
||||
//delete the token as it is useless
|
||||
$this->lt->delete();
|
||||
$this->lt = null;
|
||||
// TRANS: Client error displayed trying to use "one time password login" while specifying an expired login token.
|
||||
$this->clientError(_('Login token expired.'));
|
||||
return false;
|
||||
}
|
||||
@ -111,12 +117,13 @@ class OtpAction extends Action
|
||||
return true;
|
||||
}
|
||||
|
||||
function handle($args)
|
||||
function handle($args)
|
||||
{
|
||||
parent::handle($args);
|
||||
|
||||
// success!
|
||||
if (!common_set_user($this->user)) {
|
||||
// TRANS: Server error displayed when a user object could not be created trying to login using "one time password login".
|
||||
$this->serverError(_('Error setting user. You are probably not authorized.'));
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
@ -43,7 +42,6 @@ require_once INSTALLDIR.'/lib/mailbox.php';
|
||||
* @link http://status.net/
|
||||
* @see MailboxAction
|
||||
*/
|
||||
|
||||
class OutboxAction extends MailboxAction
|
||||
{
|
||||
/**
|
||||
@ -51,13 +49,15 @@ class OutboxAction extends MailboxAction
|
||||
*
|
||||
* @return string page title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
if ($this->page > 1) {
|
||||
// TRANS: Title for outbox for any but the fist page.
|
||||
// TRANS: %1$s is the user nickname, %2$d is the page number.
|
||||
return sprintf(_('Outbox for %1$s - page %2$d'),
|
||||
$this->user->nickname, $page);
|
||||
} else {
|
||||
// TRANS: Title for first page of outbox.
|
||||
return sprintf(_('Outbox for %s'), $this->user->nickname);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,6 @@ class OutboxAction extends MailboxAction
|
||||
*
|
||||
* @see MailboxAction::getMessages()
|
||||
*/
|
||||
|
||||
function getMessages()
|
||||
{
|
||||
$message = new Message();
|
||||
@ -88,21 +87,9 @@ class OutboxAction extends MailboxAction
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the profile we want to show with the message
|
||||
*
|
||||
* For outboxes, we show the recipient.
|
||||
*
|
||||
* @param Message $message The message to get the profile for
|
||||
*
|
||||
* @return Profile The profile of the message recipient
|
||||
*
|
||||
* @see MailboxAction::getMessageProfile()
|
||||
*/
|
||||
|
||||
function getMessageProfile($message)
|
||||
function getMessageList($message)
|
||||
{
|
||||
return $message->getTo();
|
||||
return new OutboxMessageList($this, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,9 +97,30 @@ class OutboxAction extends MailboxAction
|
||||
*
|
||||
* @return string localised instructions for using the page
|
||||
*/
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for outbox.
|
||||
return _('This is your outbox, which lists private messages you have sent.');
|
||||
}
|
||||
}
|
||||
|
||||
class OutboxMessageList extends MessageList
|
||||
{
|
||||
function newItem($message)
|
||||
{
|
||||
return new OutboxMessageListItem($this->out, $message);
|
||||
}
|
||||
}
|
||||
|
||||
class OutboxMessageListItem extends MessageListItem
|
||||
{
|
||||
/**
|
||||
* Returns the profile we want to show with the message
|
||||
*
|
||||
* @return Profile The profile that matches the message
|
||||
*/
|
||||
function getMessageProfile()
|
||||
{
|
||||
return $this->message->getTo();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
|
||||
|
||||
/**
|
||||
* Change password
|
||||
@ -45,7 +45,7 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class PasswordsettingsAction extends AccountSettingsAction
|
||||
class PasswordsettingsAction extends SettingsAction
|
||||
{
|
||||
/**
|
||||
* Title of the page
|
||||
@ -55,7 +55,8 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
|
||||
function title()
|
||||
{
|
||||
return _('Change password');
|
||||
// TRANS: Title for page where to change password.
|
||||
return _m('TITLE','Change password');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,6 +67,7 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for page where to change password.
|
||||
return _('Change your password.');
|
||||
}
|
||||
|
||||
@ -93,6 +95,7 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
'action' =>
|
||||
common_local_url('passwordsettings')));
|
||||
$this->elementStart('fieldset');
|
||||
// TRANS: Fieldset legend on page where to change password.
|
||||
$this->element('legend', null, _('Password change'));
|
||||
$this->hidden('token', common_session_token());
|
||||
|
||||
@ -101,20 +104,26 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
// Users who logged in with OpenID won't have a pwd
|
||||
if ($user->password) {
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label on page where to change password.
|
||||
$this->password('oldpassword', _('Old password'));
|
||||
$this->elementEnd('li');
|
||||
}
|
||||
$this->elementStart('li');
|
||||
// TRANS: Field label on page where to change password.
|
||||
$this->password('newpassword', _('New password'),
|
||||
_('6 or more characters'));
|
||||
// TRANS: Field title on page where to change password.
|
||||
_('6 or more characters.'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementStart('li');
|
||||
$this->password('confirm', _('Confirm'),
|
||||
_('Same as password above'));
|
||||
// TRANS: Field label on page where to change password. In this field the new password should be typed a second time.
|
||||
$this->password('confirm', _m('LABEL','Confirm'),
|
||||
// TRANS: Field title on page where to change password.
|
||||
_('Same as password above.'));
|
||||
$this->elementEnd('li');
|
||||
$this->elementEnd('ul');
|
||||
|
||||
$this->submit('changepass', _('Change'));
|
||||
// TRANS: Button text on page where to change password.
|
||||
$this->submit('changepass', _m('BUTTON','Change'));
|
||||
|
||||
$this->elementEnd('fieldset');
|
||||
$this->elementEnd('form');
|
||||
@ -128,7 +137,6 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handlePost()
|
||||
{
|
||||
// CSRF protection
|
||||
@ -151,6 +159,7 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
# Some validation
|
||||
|
||||
if (strlen($newpassword) < 6) {
|
||||
// TRANS: Form validation error on page where to change password.
|
||||
$this->showForm(_('Password must be 6 or more characters.'));
|
||||
return;
|
||||
} else if (0 != strcmp($newpassword, $confirm)) {
|
||||
@ -162,7 +171,8 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
$oldpassword = $this->arg('oldpassword');
|
||||
|
||||
if (!common_check_user($user->nickname, $oldpassword)) {
|
||||
$this->showForm(_('Incorrect old password'));
|
||||
// TRANS: Form validation error on page where to change password.
|
||||
$this->showForm(_('Incorrect old password.'));
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
@ -178,17 +188,21 @@ class PasswordsettingsAction extends AccountSettingsAction
|
||||
|
||||
$val = $user->validate();
|
||||
if ($val !== true) {
|
||||
// TRANS: Form validation error on page where to change password.
|
||||
$this->showForm(_('Error saving user; invalid.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$user->update($original)) {
|
||||
$this->serverError(_('Can\'t save new password.'));
|
||||
// TRANS: Server error displayed on page where to change password when password change
|
||||
// TRANS: could not be made because of a server error.
|
||||
$this->serverError(_('Cannot save new password.'));
|
||||
return;
|
||||
}
|
||||
Event::handle('EndChangePassword', array($user));
|
||||
}
|
||||
|
||||
// TRANS: Form validation notice on page where to change password.
|
||||
$this->showForm(_('Password saved.'), true);
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
||||
if (!empty($values['theme']['dir']) && !is_readable($values['theme']['dir'])) {
|
||||
// TRANS: Client error in Paths admin panel.
|
||||
// TRANS: %s is the directory that could not be read from.
|
||||
$this->clientError(sprintf(_("Theme directory not readable: %s."), $values['theme']['dir']));
|
||||
$this->clientError(sprintf(_('Theme directory not readable: %s.'), $values['theme']['dir']));
|
||||
}
|
||||
|
||||
// Validate avatar dir
|
||||
@ -160,7 +160,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
||||
if (empty($values['avatar']['dir']) || !is_writable($values['avatar']['dir'])) {
|
||||
// TRANS: Client error in Paths admin panel.
|
||||
// TRANS: %s is the avatar directory that could not be written to.
|
||||
$this->clientError(sprintf(_("Avatar directory not writable: %s."), $values['avatar']['dir']));
|
||||
$this->clientError(sprintf(_('Avatar directory not writable: %s.'), $values['avatar']['dir']));
|
||||
}
|
||||
|
||||
// Validate background dir
|
||||
@ -168,7 +168,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
||||
if (empty($values['background']['dir']) || !is_writable($values['background']['dir'])) {
|
||||
// TRANS: Client error in Paths admin panel.
|
||||
// TRANS: %s is the background directory that could not be written to.
|
||||
$this->clientError(sprintf(_("Background directory not writable: %s."), $values['background']['dir']));
|
||||
$this->clientError(sprintf(_('Background directory not writable: %s.'), $values['background']['dir']));
|
||||
}
|
||||
|
||||
// Validate locales dir
|
||||
@ -178,7 +178,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
||||
if (!empty($values['site']['locale_path']) && !is_readable($values['site']['locale_path'])) {
|
||||
// TRANS: Client error in Paths admin panel.
|
||||
// TRANS: %s is the locales directory that could not be read from.
|
||||
$this->clientError(sprintf(_("Locales directory not readable: %s."), $values['site']['locale_path']));
|
||||
$this->clientError(sprintf(_('Locales directory not readable: %s.'), $values['site']['locale_path']));
|
||||
}
|
||||
|
||||
// Validate SSL setup
|
||||
@ -239,6 +239,7 @@ class PathsAdminPanelForm extends AdminForm
|
||||
$this->input('server',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Server'),
|
||||
// TRANS: Field title in Paths admin panel.
|
||||
_('Site\'s server hostname.'));
|
||||
$this->unli();
|
||||
|
||||
@ -246,6 +247,7 @@ class PathsAdminPanelForm extends AdminForm
|
||||
$this->input('path',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Path'),
|
||||
// TRANS: Field title in Paths admin panel.
|
||||
_('Site path.'));
|
||||
$this->unli();
|
||||
|
||||
@ -253,6 +255,7 @@ class PathsAdminPanelForm extends AdminForm
|
||||
$this->input('locale_path',
|
||||
// TRANS: Field label in Paths admin panel.
|
||||
_('Locale directory'),
|
||||
// TRANS: Field title in Paths admin panel.
|
||||
_('Directory path to locales.'),
|
||||
'site');
|
||||
$this->unli();
|
||||
@ -262,14 +265,16 @@ class PathsAdminPanelForm extends AdminForm
|
||||
// TRANS: Checkbox label in Paths admin panel.
|
||||
_('Fancy URLs'),
|
||||
(bool) $this->value('fancy'),
|
||||
_('Use fancy (more readable and memorable) URLs?'));
|
||||
// TRANS: Field title in Paths admin panel.
|
||||
_('Use fancy URLs (more readable and memorable)?'));
|
||||
$this->unli();
|
||||
|
||||
$this->out->elementEnd('ul');
|
||||
$this->out->elementEnd('fieldset');
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_paths_theme'));
|
||||
$this->out->element('legend', null, _('Theme'));
|
||||
// TRANS: Fieldset legend in Paths admin panel.
|
||||
$this->out->element('legend', null, _m('LEGEND','Theme'));
|
||||
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
|
||||
@ -469,7 +474,7 @@ class PathsAdminPanelForm extends AdminForm
|
||||
|
||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_ssl'));
|
||||
// TRANS: Fieldset legend in Paths admin panel.
|
||||
$this->out->element('legend', null, _('SSL'));
|
||||
$this->out->element('legend', null, _m('LEGEND','SSL'));
|
||||
$this->out->elementStart('ul', 'form_data');
|
||||
$this->li();
|
||||
|
||||
|
@ -49,12 +49,15 @@ class PeoplesearchAction extends SearchAction
|
||||
{
|
||||
function getInstructions()
|
||||
{
|
||||
// TRANS: Instructions for the "People search" page.
|
||||
// TRANS: %%site.name%% is the name of the StatusNet site.
|
||||
return _('Search for people on %%site.name%% by their name, location, or interests. ' .
|
||||
'Separate the terms by spaces; they must be 3 characters or more.');
|
||||
}
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title of a page where users can search for other users.
|
||||
return _('People search');
|
||||
}
|
||||
|
||||
@ -80,6 +83,7 @@ class PeoplesearchAction extends SearchAction
|
||||
$page, 'peoplesearch', array('q' => $q));
|
||||
|
||||
} else {
|
||||
// TRANS: Message on the "People search" page where a query has no results.
|
||||
$this->element('p', 'error', _('No results.'));
|
||||
$this->searchSuggestions($q);
|
||||
$profile->free();
|
||||
@ -136,4 +140,3 @@ class PeopleSearchResultItem extends ProfileListItem
|
||||
return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||
*
|
||||
* @see Action
|
||||
*/
|
||||
|
||||
class PeopletagAction extends Action
|
||||
{
|
||||
|
||||
@ -65,6 +64,8 @@ class PeopletagAction extends Action
|
||||
$this->tag = $this->trimmed('tag');
|
||||
|
||||
if (!common_valid_profile_tag($this->tag)) {
|
||||
// TRANS: Client error displayed when trying to tag a profile with an invalid tag.
|
||||
// TRANS: %s is the invalid tag.
|
||||
$this->clientError(sprintf(_('Not a valid people tag: %s.'),
|
||||
$this->tag));
|
||||
return;
|
||||
@ -139,10 +140,11 @@ class PeopletagAction extends Action
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for users with a certain self-tag.
|
||||
// TRANS: %1$s is the tag, %2$s is the page number.
|
||||
return sprintf(_('Users self-tagged with %1$s - page %2$d'),
|
||||
$this->tag, $this->page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PeopleTagList extends ProfileList
|
||||
@ -177,4 +179,3 @@ class PeopleTagListItem extends ProfileListItem
|
||||
return $aAttrs;
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user