Merge branch '0.9.x' into 1.0.x
This commit is contained in:
commit
b26eccf33c
2
README
2
README
|
@ -3,7 +3,7 @@ README
|
||||||
------
|
------
|
||||||
|
|
||||||
StatusNet 0.9.6 "Man on the Moon"
|
StatusNet 0.9.6 "Man on the Moon"
|
||||||
19 October 2010
|
25 October 2010 - RELEASE CANDIDATE
|
||||||
|
|
||||||
This is the README file for StatusNet, the Open Source microblogging
|
This is the README file for StatusNet, the Open Source microblogging
|
||||||
platform. It includes installation instructions, descriptions of
|
platform. It includes installation instructions, descriptions of
|
||||||
|
|
|
@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AccessadminpanelAction extends AdminPanelAction
|
class AccessadminpanelAction extends AdminPanelAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -48,10 +47,9 @@ class AccessadminpanelAction extends AdminPanelAction
|
||||||
*
|
*
|
||||||
* @return string page title
|
* @return string page title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
// TRANS: Page title
|
// TRANS: Page title for Access admin panel that allows configuring site access.
|
||||||
return _('Access');
|
return _('Access');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +58,9 @@ class AccessadminpanelAction extends AdminPanelAction
|
||||||
*
|
*
|
||||||
* @return string instructions
|
* @return string instructions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
// TRANS: Page notice
|
// TRANS: Page notice.
|
||||||
return _('Site access settings');
|
return _('Site access settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +69,6 @@ class AccessadminpanelAction extends AdminPanelAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showForm()
|
function showForm()
|
||||||
{
|
{
|
||||||
$form = new AccessAdminPanelForm($this);
|
$form = new AccessAdminPanelForm($this);
|
||||||
|
@ -85,7 +81,6 @@ class AccessadminpanelAction extends AdminPanelAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
static $booleans = array('site' => array('private', 'inviteonly', 'closed'));
|
static $booleans = array('site' => array('private', 'inviteonly', 'closed'));
|
||||||
|
@ -110,7 +105,6 @@ class AccessadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AccessAdminPanelForm extends AdminForm
|
class AccessAdminPanelForm extends AdminForm
|
||||||
|
@ -120,7 +114,6 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
*
|
*
|
||||||
* @return int ID of the form
|
* @return int ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'form_site_admin_panel';
|
return 'form_site_admin_panel';
|
||||||
|
@ -131,7 +124,6 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
*
|
*
|
||||||
* @return string class of the form
|
* @return string class of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
|
@ -142,7 +134,6 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('accessadminpanel');
|
return common_local_url('accessadminpanel');
|
||||||
|
@ -153,7 +144,6 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->elementStart('fieldset', array('id' => 'settings_admin_access'));
|
$this->out->elementStart('fieldset', array('id' => 'settings_admin_access'));
|
||||||
|
@ -161,7 +151,7 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
$this->out->element('legend', null, _('Registration'));
|
$this->out->element('legend', null, _('Registration'));
|
||||||
$this->out->elementStart('ul', 'form_data');
|
$this->out->elementStart('ul', 'form_data');
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox instructions for admin setting "Private"
|
// TRANS: Checkbox instructions for admin setting "Private".
|
||||||
$instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
|
$instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
|
||||||
// TRANS: Checkbox label for prohibiting anonymous users from viewing site.
|
// TRANS: Checkbox label for prohibiting anonymous users from viewing site.
|
||||||
$this->out->checkbox('private', _m('LABEL', 'Private'),
|
$this->out->checkbox('private', _m('LABEL', 'Private'),
|
||||||
|
@ -170,7 +160,7 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox instructions for admin setting "Invite only"
|
// TRANS: Checkbox instructions for admin setting "Invite only".
|
||||||
$instructions = _('Make registration invitation only.');
|
$instructions = _('Make registration invitation only.');
|
||||||
// TRANS: Checkbox label for configuring site as invite only.
|
// TRANS: Checkbox label for configuring site as invite only.
|
||||||
$this->out->checkbox('inviteonly', _('Invite only'),
|
$this->out->checkbox('inviteonly', _('Invite only'),
|
||||||
|
@ -179,7 +169,7 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
$this->unli();
|
$this->unli();
|
||||||
|
|
||||||
$this->li();
|
$this->li();
|
||||||
// TRANS: Checkbox instructions for admin setting "Closed" (no new registrations)
|
// TRANS: Checkbox instructions for admin setting "Closed" (no new registrations).
|
||||||
$instructions = _('Disable new registrations.');
|
$instructions = _('Disable new registrations.');
|
||||||
// TRANS: Checkbox label for disabling new user registrations.
|
// TRANS: Checkbox label for disabling new user registrations.
|
||||||
$this->out->checkbox('closed', _('Closed'),
|
$this->out->checkbox('closed', _('Closed'),
|
||||||
|
@ -195,12 +185,11 @@ class AccessAdminPanelForm extends AdminForm
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Title / tooltip for button to save access settings in site admin panel
|
// TRANS: Title for button to save access settings in site admin panel.
|
||||||
$title = _('Save access settings');
|
$title = _('Save access settings');
|
||||||
|
// TRANS: Tooltip for button to save access settings in site admin panel.
|
||||||
$this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title);
|
$this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,4 +67,3 @@ class AccesstokenAction extends Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ class AllAction extends ProfileAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->page > 1 && $this->notice->N == 0) {
|
if ($this->page > 1 && $this->notice->N == 0) {
|
||||||
// TRANS: Server error when page not found (404)
|
// TRANS: Server error when page not found (404).
|
||||||
$this->serverError(_('No such page.'), $code = 404);
|
$this->serverError(_('No such page.'), $code = 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ class AllAction extends ProfileAction
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!$this->user) {
|
if (!$this->user) {
|
||||||
|
// TRANS: Client error when user not found for an action.
|
||||||
$this->clientError(_('No such user.'));
|
$this->clientError(_('No such user.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,7 @@ class AllAction extends ProfileAction
|
||||||
'nickname' =>
|
'nickname' =>
|
||||||
$this->user->nickname)
|
$this->user->nickname)
|
||||||
),
|
),
|
||||||
// TRANS: %s is user nickname
|
// TRANS: %s is user nickname.
|
||||||
sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
|
sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
|
||||||
new Feed(Feed::RSS2,
|
new Feed(Feed::RSS2,
|
||||||
common_local_url(
|
common_local_url(
|
||||||
|
@ -112,7 +113,7 @@ class AllAction extends ProfileAction
|
||||||
'id' => $this->user->nickname
|
'id' => $this->user->nickname
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// TRANS: %s is user nickname
|
// TRANS: %s is user nickname.
|
||||||
sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
|
sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
|
||||||
new Feed(Feed::ATOM,
|
new Feed(Feed::ATOM,
|
||||||
common_local_url(
|
common_local_url(
|
||||||
|
@ -121,7 +122,7 @@ class AllAction extends ProfileAction
|
||||||
'id' => $this->user->nickname
|
'id' => $this->user->nickname
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
// TRANS: %s is user nickname
|
// TRANS: %s is user nickname.
|
||||||
sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
|
sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +135,7 @@ class AllAction extends ProfileAction
|
||||||
|
|
||||||
function showEmptyListMessage()
|
function showEmptyListMessage()
|
||||||
{
|
{
|
||||||
// TRANS: %s is user nickname
|
// TRANS: Empty list message. %s is a user nickname.
|
||||||
$message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
|
$message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
|
||||||
|
|
||||||
if (common_logged_in()) {
|
if (common_logged_in()) {
|
||||||
|
@ -144,7 +145,7 @@ class AllAction extends ProfileAction
|
||||||
// TRANS: This message contains Markdown links. Keep "](" together.
|
// TRANS: This message contains Markdown links. Keep "](" together.
|
||||||
$message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
|
$message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
|
||||||
} else {
|
} else {
|
||||||
// TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@"
|
// TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@".
|
||||||
// TRANS: This message contains Markdown links. Keep "](" together.
|
// TRANS: This message contains Markdown links. Keep "](" together.
|
||||||
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
|
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from their profile or [post something to them](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
|
||||||
}
|
}
|
||||||
|
@ -183,10 +184,10 @@ class AllAction extends ProfileAction
|
||||||
{
|
{
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
if ($user && ($user->id == $this->user->id)) {
|
if ($user && ($user->id == $this->user->id)) {
|
||||||
// TRANS: H1 text
|
// TRANS: H1 text for page when viewing a list for self.
|
||||||
$this->element('h1', null, _("You and friends"));
|
$this->element('h1', null, _("You and friends"));
|
||||||
} else {
|
} else {
|
||||||
// TRANS: H1 text. %s is a user nickname
|
// TRANS: H1 text for page. %s is a user nickname.
|
||||||
$this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
|
$this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RSS feed for user and friends timeline action class.
|
* RSS feed for user and friends timeline action class.
|
||||||
*
|
*
|
||||||
|
@ -57,7 +56,6 @@ class AllrssAction extends Rss10Action
|
||||||
* @param array $args Web and URL arguments
|
* @param array $args Web and URL arguments
|
||||||
*
|
*
|
||||||
* @return boolean false if user doesn't exist
|
* @return boolean false if user doesn't exist
|
||||||
*/
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -65,6 +63,7 @@ class AllrssAction extends Rss10Action
|
||||||
$this->user = User::staticGet('nickname', $nickname);
|
$this->user = User::staticGet('nickname', $nickname);
|
||||||
|
|
||||||
if (!$this->user) {
|
if (!$this->user) {
|
||||||
|
// TRANS: Client error when user not found for an rss related action.
|
||||||
$this->clientError(_('No such user.'));
|
$this->clientError(_('No such user.'));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,4 +138,3 @@ class AllrssAction extends Rss10Action
|
||||||
return $avatar ? $avatar->url : null;
|
return $avatar ? $avatar->url : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
|
class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the request
|
* Handle the request
|
||||||
*
|
*
|
||||||
|
@ -62,7 +60,6 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -119,11 +116,8 @@ class ApiAccountRateLimitStatusAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,6 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,6 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +90,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -114,6 +114,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error when user not found updating a profile background image.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $profile_background_color = null;
|
var $profile_background_color = null;
|
||||||
var $profile_text_color = null;
|
var $profile_text_color = null;
|
||||||
var $profile_link_color = null;
|
var $profile_link_color = null;
|
||||||
|
@ -59,9 +57,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -100,7 +96,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -116,6 +111,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method updating profile colours.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -126,7 +122,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
$design = $this->user->getDesign();
|
$design = $this->user->getDesign();
|
||||||
|
|
||||||
if (!empty($design)) {
|
if (!empty($design)) {
|
||||||
|
|
||||||
$original = clone($design);
|
$original = clone($design);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -140,12 +135,11 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
common_log_db_error($design, 'UPDATE', __FILE__);
|
common_log_db_error($design, 'UPDATE', __FILE__);
|
||||||
|
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||||
$this->clientError(_('Could not update your design.'));
|
$this->clientError(_('Could not update your design.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$this->user->query('BEGIN');
|
$this->user->query('BEGIN');
|
||||||
|
|
||||||
// save new design
|
// save new design
|
||||||
|
@ -162,6 +156,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
common_log_db_error($id, 'INSERT', __FILE__);
|
common_log_db_error($id, 'INSERT', __FILE__);
|
||||||
|
// TRANS: Client error displayed when a database error occurs inserting profile colours.
|
||||||
$this->clientError(_('Unable to save your design settings.'));
|
$this->clientError(_('Unable to save your design settings.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -172,6 +167,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
common_log_db_error($original, 'UPDATE', __FILE__);
|
common_log_db_error($original, 'UPDATE', __FILE__);
|
||||||
|
// TRANS: Client error displayed when a database error occurs updating profile colours.
|
||||||
$this->clientError(_('Unable to save your design settings.'));
|
$this->clientError(_('Unable to save your design settings.'));
|
||||||
$this->user->query('ROLLBACK');
|
$this->user->query('ROLLBACK');
|
||||||
return;
|
return;
|
||||||
|
@ -183,6 +179,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
|
// TRANS: Client error displayed a user has no profile updating profile colours.
|
||||||
$this->clientError(_('User has no profile.'));
|
$this->clientError(_('User has no profile.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +204,6 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function setColors($design)
|
function setColors($design)
|
||||||
{
|
{
|
||||||
$bgcolor = empty($this->profile_background_color) ?
|
$bgcolor = empty($this->profile_background_color) ?
|
||||||
|
@ -243,5 +239,4 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,19 +43,15 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take arguments for running
|
* Take arguments for running
|
||||||
*
|
*
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -74,7 +70,6 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -105,6 +100,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed updating profile image without having a user object.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -130,6 +126,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
|
// TRANS: Client error displayed if a user profile could not be found updating a profile image.
|
||||||
$this->clientError(_('User has no profile.'));
|
$this->clientError(_('User has no profile.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -150,5 +147,4 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
$this->endDocument('json');
|
$this->endDocument('json');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAccountVerifyCredentialsAction extends ApiAuthAction
|
class ApiAccountVerifyCredentialsAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the request
|
* Handle the request
|
||||||
*
|
*
|
||||||
|
@ -61,12 +59,12 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method verifying user credentials.
|
||||||
$this->clientError(_('API method not found.'), $code = 404);
|
$this->clientError(_('API method not found.'), $code = 404);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -91,12 +89,9 @@ class ApiAccountVerifyCredentialsAction extends ApiAuthAction
|
||||||
* @param array $args other arguments
|
* @param array $args other arguments
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*
|
*/
|
||||||
**/
|
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ class ApiBlockDestroyAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +90,7 @@ class ApiBlockDestroyAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user) || empty($this->other)) {
|
if (empty($this->user) || empty($this->other)) {
|
||||||
|
// TRANS: Client error when user not found for an API action to remove a block for a user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiDirectMessageAction extends ApiAuthAction
|
class ApiDirectMessageAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $messages = null;
|
var $messages = null;
|
||||||
|
@ -64,9 +63,7 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -87,12 +84,12 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
// Action was called by /api/direct_messages/sent.format
|
// Action was called by /api/direct_messages/sent.format
|
||||||
|
|
||||||
$this->title = sprintf(
|
$this->title = sprintf(
|
||||||
// TRANS: %s is a user nickname.
|
// TRANS: Title. %s is a user nickname.
|
||||||
_("Direct messages from %s"),
|
_("Direct messages from %s"),
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
);
|
);
|
||||||
$this->subtitle = sprintf(
|
$this->subtitle = sprintf(
|
||||||
// TRANS: %s is a user nickname.
|
// TRANS: Subtitle. %s is a user nickname.
|
||||||
_("All the direct messages sent from %s"),
|
_("All the direct messages sent from %s"),
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
);
|
);
|
||||||
|
@ -101,12 +98,12 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
$this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id;
|
$this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id;
|
||||||
} else {
|
} else {
|
||||||
$this->title = sprintf(
|
$this->title = sprintf(
|
||||||
// TRANS: %s is a user nickname.
|
// TRANS: Title. %s is a user nickname.
|
||||||
_("Direct messages to %s"),
|
_("Direct messages to %s"),
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
);
|
);
|
||||||
$this->subtitle = sprintf(
|
$this->subtitle = sprintf(
|
||||||
// TRANS: %s is a user nickname.
|
// TRANS: Subtitle. %s is a user nickname.
|
||||||
_("All the direct messages sent to %s"),
|
_("All the direct messages sent to %s"),
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
);
|
);
|
||||||
|
@ -129,7 +126,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -141,7 +137,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showMessages()
|
function showMessages()
|
||||||
{
|
{
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
|
@ -169,7 +164,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getMessages()
|
function getMessages()
|
||||||
{
|
{
|
||||||
$message = new Message();
|
$message = new Message();
|
||||||
|
@ -208,7 +202,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -219,7 +212,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->messages)) {
|
if (!empty($this->messages)) {
|
||||||
|
@ -234,7 +226,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showXmlDirectMessages()
|
function showXmlDirectMessages()
|
||||||
{
|
{
|
||||||
$this->initDocument('xml');
|
$this->initDocument('xml');
|
||||||
|
@ -255,7 +246,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showJsonDirectMessages()
|
function showJsonDirectMessages()
|
||||||
{
|
{
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
@ -276,7 +266,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showRssDirectMessages()
|
function showRssDirectMessages()
|
||||||
{
|
{
|
||||||
$this->initDocument('rss');
|
$this->initDocument('rss');
|
||||||
|
@ -311,7 +300,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showAtomDirectMessages()
|
function showAtomDirectMessages()
|
||||||
{
|
{
|
||||||
$this->initDocument('atom');
|
$this->initDocument('atom');
|
||||||
|
@ -353,7 +341,6 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->messages)) {
|
if (!empty($this->messages)) {
|
||||||
|
@ -374,5 +361,4 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ class ApiDirectMessageNewAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +68,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
|
||||||
$this->user = $this->auth_user;
|
$this->user = $this->auth_user;
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error when user not found for an API direct message action.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($this->content)) {
|
if (empty($this->content)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
// TRANS: Client error (406).
|
// TRANS: Client error displayed when no message text was submitted (406).
|
||||||
_('No message text!'),
|
_('No message text!'),
|
||||||
406,
|
406,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -58,7 +58,6 @@ class ApiFavoriteCreateAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
@ -95,6 +94,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -48,10 +48,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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiFavoriteDestroyAction extends ApiAuthAction
|
class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notice = null;
|
var $notice = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,9 +58,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -82,7 +78,6 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -99,6 +94,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -108,6 +104,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($this->notice)) {
|
if (empty($this->notice)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to remove a favourite with an invalid ID.
|
||||||
_('No status found with that ID.'),
|
_('No status found with that ID.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -121,6 +118,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!$fave->find(true)) {
|
if (!$fave->find(true)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to remove a favourite that was not a favourite.
|
||||||
_('That status is not a favorite.'),
|
_('That status is not a favorite.'),
|
||||||
403,
|
403,
|
||||||
$this->favorite
|
$this->favorite
|
||||||
|
@ -133,6 +131,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
common_log_db_error($fave, 'DELETE', __FILE__);
|
common_log_db_error($fave, 'DELETE', __FILE__);
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when removing a favourite has failed.
|
||||||
_('Could not delete favorite.'),
|
_('Could not delete favorite.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -148,5 +147,4 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
$this->show_single_json_status($this->notice);
|
$this->show_single_json_status($this->notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiFriendshipsCreateAction extends ApiAuthAction
|
class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $other = null;
|
var $other = null;
|
||||||
|
@ -61,7 +60,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -81,7 +79,6 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -98,6 +95,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -107,6 +105,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($this->other)) {
|
if (empty($this->other)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying follow who's profile could not be found.
|
||||||
_('Could not follow user: profile not found.'),
|
_('Could not follow user: profile not found.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -116,6 +115,8 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($this->user->isSubscribed($this->other)) {
|
if ($this->user->isSubscribed($this->other)) {
|
||||||
$errmsg = sprintf(
|
$errmsg = sprintf(
|
||||||
|
// TRANS: Client error displayed when trying to follow a user that's already being followed.
|
||||||
|
// TRANS: %s is the nickname of the user that is already being followed.
|
||||||
_('Could not follow user: %s is already on your list.'),
|
_('Could not follow user: %s is already on your list.'),
|
||||||
$this->other->nickname
|
$this->other->nickname
|
||||||
);
|
);
|
||||||
|
@ -134,5 +135,4 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
$this->showProfile($this->other, $this->format);
|
$this->showProfile($this->other, $this->format);
|
||||||
$this->endDocument($this->format);
|
$this->endDocument($this->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiFriendshipsDestroyAction extends ApiAuthAction
|
class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $other = null;
|
var $other = null;
|
||||||
|
@ -61,7 +60,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -81,7 +79,6 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -98,6 +95,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -107,6 +105,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($this->other)) {
|
if (empty($this->other)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to unfollow a user that cannot be found.
|
||||||
_('Could not unfollow user: User not found.'),
|
_('Could not unfollow user: User not found.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -118,6 +117,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($this->user->id == $this->other->id) {
|
if ($this->user->id == $this->other->id) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to unfollow self.
|
||||||
_("You cannot unfollow yourself."),
|
_("You cannot unfollow yourself."),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -132,5 +132,4 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
$this->showProfile($this->other, $this->format);
|
$this->showProfile($this->other, $this->format);
|
||||||
$this->endDocument($this->format);
|
$this->endDocument($this->format);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
var $profile_a = null;
|
var $profile_a = null;
|
||||||
|
@ -59,9 +58,7 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -81,13 +78,13 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->profile_a) || empty($this->profile_b)) {
|
if (empty($this->profile_a) || empty($this->profile_b)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when supplying invalid parameters to an API call checking if a friendship exists.
|
||||||
_('Two valid IDs or screen_names must be supplied.'),
|
_('Two valid IDs or screen_names must be supplied.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -122,10 +119,8 @@ class ApiFriendshipsExistsAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiFriendshipsShowAction extends ApiBareAuthAction
|
class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $source = null;
|
var $source = null;
|
||||||
|
@ -58,9 +57,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -93,7 +90,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresAuth()
|
function requiresAuth()
|
||||||
{
|
{
|
||||||
if (common_config('site', 'private')) {
|
if (common_config('site', 'private')) {
|
||||||
|
@ -119,18 +115,19 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method showing friendship.
|
||||||
$this->clientError(_('API method not found.'), 404);
|
$this->clientError(_('API method not found.'), 404);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->source)) {
|
if (empty($this->source)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when a source user could not be determined showing friendship.
|
||||||
_('Could not determine source user.'),
|
_('Could not determine source user.'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
@ -139,6 +136,7 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
|
|
||||||
if (empty($this->target)) {
|
if (empty($this->target)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when a target user could not be determined showing friendship.
|
||||||
_('Could not find target user.'),
|
_('Could not find target user.'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
@ -161,7 +159,6 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,5 +175,4 @@ class ApiFriendshipsShowAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,9 +66,7 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -150,7 +148,6 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function validateParams()
|
function validateParams()
|
||||||
{
|
{
|
||||||
$valid = Validate::string(
|
$valid = Validate::string(
|
||||||
|
@ -218,7 +215,11 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
} elseif (User_group::descriptionTooLong($this->description)) {
|
} elseif (User_group::descriptionTooLong($this->description)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
sprintf(
|
sprintf(
|
||||||
_('Description is too long (max %d chars).'),
|
// TRANS: Client error shown when providing too long a description during group creation.
|
||||||
|
// TRANS: %d is the maximum number of allowed characters.
|
||||||
|
_m('Description is too long (maximum %d character).',
|
||||||
|
'Description is too long (maximum %d characters).',
|
||||||
|
User_group::maxDescription()),
|
||||||
User_group::maxDescription()
|
User_group::maxDescription()
|
||||||
),
|
),
|
||||||
403,
|
403,
|
||||||
|
@ -229,6 +230,7 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
!is_null($this->location)
|
!is_null($this->location)
|
||||||
&& mb_strlen($this->location) > 255) {
|
&& mb_strlen($this->location) > 255) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error shown when providing too long a location during group creation.
|
||||||
_('Location is too long (maximum 255 characters).'),
|
_('Location is too long (maximum 255 characters).'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -248,7 +250,11 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
if (count($this->aliases) > common_config('group', 'maxaliases')) {
|
if (count($this->aliases) > common_config('group', 'maxaliases')) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
sprintf(
|
sprintf(
|
||||||
_('Too many aliases! Maximum %d.'),
|
// TRANS: Client error shown when providing too many aliases during group creation.
|
||||||
|
// TRANS: %d is the maximum number of allowed aliases.
|
||||||
|
_m('Too many aliases! Maximum %d allowed.',
|
||||||
|
'Too many aliases! Maximum %d allowed.',
|
||||||
|
common_config('group', 'maxaliases')),
|
||||||
common_config('group', 'maxaliases')
|
common_config('group', 'maxaliases')
|
||||||
),
|
),
|
||||||
403,
|
403,
|
||||||
|
@ -269,6 +275,8 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!$valid) {
|
if (!$valid) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error shown when providing an invalid alias during group creation.
|
||||||
|
// TRANS: %s is the invalid alias.
|
||||||
sprintf(_('Invalid alias: "%s".'), $alias),
|
sprintf(_('Invalid alias: "%s".'), $alias),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -278,6 +286,8 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
if ($this->groupNicknameExists($alias)) {
|
if ($this->groupNicknameExists($alias)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
sprintf(
|
sprintf(
|
||||||
|
// TRANS: Client error displayed when trying to use an alias during group creation that is already in use.
|
||||||
|
// TRANS: %s is the alias that is already in use.
|
||||||
_('Alias "%s" already in use. Try another one.'),
|
_('Alias "%s" already in use. Try another one.'),
|
||||||
$alias
|
$alias
|
||||||
),
|
),
|
||||||
|
@ -291,6 +301,7 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (strcmp($alias, $this->nickname) == 0) {
|
if (strcmp($alias, $this->nickname) == 0) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to use an alias during group creation that is the same as the group's nickname.
|
||||||
_('Alias can\'t be the same as nickname.'),
|
_('Alias can\'t be the same as nickname.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -299,7 +310,7 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Evarything looks OK
|
// Everything looks OK
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +322,6 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function groupNicknameExists($nickname)
|
function groupNicknameExists($nickname)
|
||||||
{
|
{
|
||||||
$local = Local_group::staticGet('nickname', $nickname);
|
$local = Local_group::staticGet('nickname', $nickname);
|
||||||
|
@ -328,5 +338,4 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupIsMemberAction extends ApiBareAuthAction
|
class ApiGroupIsMemberAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
@ -60,7 +59,6 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
|
@ -82,17 +80,18 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when checking group membership for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client error displayed when checking group membership for a non-existing group.
|
||||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -112,6 +111,7 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method showing group membership.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -129,10 +129,8 @@ class ApiGroupIsMemberAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupJoinAction extends ApiAuthAction
|
class ApiGroupJoinAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
@ -60,9 +59,7 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -82,7 +79,6 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -98,17 +94,20 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when trying to have a non-existing user join a group.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client error displayed when trying to join a group that does not exist.
|
||||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->user->isMember($this->group)) {
|
if ($this->user->isMember($this->group)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Server error displayed when trying to join a group the user is already a member of.
|
||||||
_('You are already a member of that group.'),
|
_('You are already a member of that group.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -118,6 +117,7 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
|
|
||||||
if (Group_block::isBlocked($this->group, $this->user->getProfile())) {
|
if (Group_block::isBlocked($this->group, $this->user->getProfile())) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Server error displayed when trying to join a group the user is blocked from joining.
|
||||||
_('You have been blocked from that group by the admin.'),
|
_('You have been blocked from that group by the admin.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -137,6 +137,8 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
common_log_db_error($member, 'INSERT', __FILE__);
|
common_log_db_error($member, 'INSERT', __FILE__);
|
||||||
$this->serverError(
|
$this->serverError(
|
||||||
sprintf(
|
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.'),
|
_('Could not join user %1$s to group %2$s.'),
|
||||||
$this->user->nickname,
|
$this->user->nickname,
|
||||||
$this->group->nickname
|
$this->group->nickname
|
||||||
|
@ -154,6 +156,7 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method joining a group.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -161,5 +164,4 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupLeaveAction extends ApiAuthAction
|
class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
@ -60,9 +59,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -82,7 +79,6 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -98,11 +94,13 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when trying to have a non-existing user leave a group.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client error displayed when trying to leave a group that does not exist.
|
||||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +111,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
$member->profile_id = $this->auth_user->id;
|
$member->profile_id = $this->auth_user->id;
|
||||||
|
|
||||||
if (!$member->find(true)) {
|
if (!$member->find(true)) {
|
||||||
|
// TRANS: Server error displayed when trying to leave a group the user is not a member of.
|
||||||
$this->serverError(_('You are not a member of this group.'));
|
$this->serverError(_('You are not a member of this group.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +122,8 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
common_log_db_error($member, 'DELETE', __FILE__);
|
common_log_db_error($member, 'DELETE', __FILE__);
|
||||||
$this->serverError(
|
$this->serverError(
|
||||||
sprintf(
|
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.'),
|
_('Could not remove user %1$s from group %2$s.'),
|
||||||
$this->user->nickname,
|
$this->user->nickname,
|
||||||
$this->group->nickname
|
$this->group->nickname
|
||||||
|
@ -140,6 +141,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method leaving a group.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -147,5 +149,4 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupListAction extends ApiBareAuthAction
|
class ApiGroupListAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $groups = null;
|
var $groups = null;
|
||||||
|
@ -60,9 +59,7 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -88,13 +85,12 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
// TRANS: %s is a user name
|
// TRANS: Used as title in check for group membership. %s is a user name.
|
||||||
$title = sprintf(_("%s's groups"), $this->user->nickname);
|
$title = sprintf(_("%s's groups"), $this->user->nickname);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:Groups";
|
$id = "tag:$taguribase:Groups";
|
||||||
|
@ -104,8 +100,8 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
);
|
);
|
||||||
|
|
||||||
$subtitle = sprintf(
|
$subtitle = sprintf(
|
||||||
// TRANS: Meant to convey the user %2$s is a member of each of the groups listed on site %1$s
|
// TRANS: Used as subtitle in check for group membership. %1$s is a user name, %2$s is the site name.
|
||||||
_("%1\$s groups %2\$s is a member of."),
|
_('%1$s groups %2$s is a member of.'),
|
||||||
$sitename,
|
$sitename,
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
);
|
);
|
||||||
|
@ -134,13 +130,13 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method checking group membership.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +144,6 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array groups
|
* @return array groups
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getGroups()
|
function getGroups()
|
||||||
{
|
{
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
@ -174,7 +169,6 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -203,7 +197,6 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
||||||
|
@ -224,5 +217,4 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupListAllAction extends ApiPrivateAuthAction
|
class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
var $groups = null;
|
var $groups = null;
|
||||||
|
@ -60,9 +59,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -82,17 +79,17 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
// TRANS: Message is used as a title. %s is a site name.
|
// TRANS: Message is used as a title when listing the lastest 20 groups. %s is a site name.
|
||||||
$title = sprintf(_("%s groups"), $sitename);
|
$title = sprintf(_("%s groups"), $sitename);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:Groups";
|
$id = "tag:$taguribase:Groups";
|
||||||
$link = common_local_url('groups');
|
$link = common_local_url('groups');
|
||||||
|
// TRANS: Message is used as a subtitle when listing the lastest 20 groups. %s is a site name.
|
||||||
$subtitle = sprintf(_("groups on %s"), $sitename);
|
$subtitle = sprintf(_("groups on %s"), $sitename);
|
||||||
|
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
|
@ -119,13 +116,13 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method listing the latest 20 groups.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +130,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array groups
|
* @return array groups
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getGroups()
|
function getGroups()
|
||||||
{
|
{
|
||||||
$qry = 'SELECT user_group.* '.
|
$qry = 'SELECT user_group.* '.
|
||||||
|
@ -165,7 +161,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -176,7 +171,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the site's latest group
|
* @return string datestamp of the site's latest group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
||||||
|
@ -194,7 +188,6 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
if (!empty($this->groups) && (count($this->groups) > 0)) {
|
||||||
|
@ -214,5 +207,4 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
@ -61,9 +60,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -83,12 +80,12 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
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);
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +101,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method showing group membership.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -117,7 +115,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array $profiles list of profiles
|
* @return array $profiles list of profiles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getProfiles()
|
function getProfiles()
|
||||||
{
|
{
|
||||||
$profiles = array();
|
$profiles = array();
|
||||||
|
@ -143,7 +140,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -154,7 +150,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the lastest profile in the group
|
* @return string datestamp of the lastest profile in the group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
||||||
|
@ -173,7 +168,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
||||||
|
@ -194,5 +188,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiGroupShowAction extends ApiPrivateAuthAction
|
class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
var $group = null;
|
var $group = null;
|
||||||
|
@ -61,9 +60,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -80,6 +77,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
common_redirect(common_local_url('ApiGroupShow', $args), 301);
|
common_redirect(common_local_url('ApiGroupShow', $args), 301);
|
||||||
} else {
|
} else {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to show a group that could not be found.
|
||||||
_('Group not found.'),
|
_('Group not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -100,7 +98,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -113,6 +110,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
$this->showSingleJsonGroup($this->group);
|
$this->showSingleJsonGroup($this->group);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method showing a group.
|
||||||
$this->clientError(_('API method not found.'), 404, $this->format);
|
$this->clientError(_('API method not found.'), 404, $this->format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +121,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->group)) {
|
if (!empty($this->group)) {
|
||||||
|
@ -141,7 +138,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->group)) {
|
if (!empty($this->group)) {
|
||||||
|
@ -169,10 +165,8 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,19 +44,15 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiHelpTestAction extends ApiPrivateAuthAction
|
class ApiHelpTestAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take arguments for running
|
* Take arguments for running
|
||||||
*
|
*
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -70,7 +66,6 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -85,6 +80,7 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
|
||||||
$this->endDocument('json');
|
$this->endDocument('json');
|
||||||
} else {
|
} else {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method testing API connectivity.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -101,11 +97,8 @@ class ApiHelpTestAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiMediaUploadAction extends ApiAuthAction
|
class ApiMediaUploadAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +56,6 @@ class ApiMediaUploadAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -99,6 +97,7 @@ class ApiMediaUploadAction extends ApiAuthAction
|
||||||
if (isset($upload)) {
|
if (isset($upload)) {
|
||||||
$this->showResponse($upload);
|
$this->showResponse($upload);
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Client error displayed when uploading a media file has failed.
|
||||||
$this->clientError(_('Upload failed.'));
|
$this->clientError(_('Upload failed.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +125,6 @@ class ApiMediaUploadAction extends ApiAuthAction
|
||||||
* Overrided clientError to show a more Twitpic-like error
|
* Overrided clientError to show a more Twitpic-like error
|
||||||
*
|
*
|
||||||
* @param String $msg an error message
|
* @param String $msg an error message
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function clientError($msg)
|
function clientError($msg)
|
||||||
{
|
{
|
||||||
|
@ -140,5 +138,4 @@ class ApiMediaUploadAction extends ApiAuthAction
|
||||||
$this->elementEnd('rsp');
|
$this->elementEnd('rsp');
|
||||||
$this->endDocument();
|
$this->endDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||||
|
|
||||||
$app = $datastore->getAppByRequestToken($this->reqToken);
|
$app = $datastore->getAppByRequestToken($this->reqToken);
|
||||||
$atok = $server->fetch_access_token($req);
|
$atok = $server->fetch_access_token($req);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
|
common_log(LOG_WARNING, 'API OAuthException - ' . $e->getMessage());
|
||||||
common_debug(var_export($req, true));
|
common_debug(var_export($req, true));
|
||||||
|
@ -88,7 +87,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($atok)) {
|
if (empty($atok)) {
|
||||||
|
|
||||||
// Token exchange failed -- log it
|
// Token exchange failed -- log it
|
||||||
|
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
|
@ -101,7 +99,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||||
common_log(LOG_WARNING, $msg);
|
common_log(LOG_WARNING, $msg);
|
||||||
// TRANS: Client error given from the OAuth API when the request token or verifier is invalid.
|
// 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 {
|
} else {
|
||||||
common_log(
|
common_log(
|
||||||
LOG_INFO,
|
LOG_INFO,
|
||||||
|
@ -121,7 +118,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction
|
||||||
*
|
*
|
||||||
* @param OAuthToken token the access token
|
* @param OAuthToken token the access token
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showAccessToken($token)
|
function showAccessToken($token)
|
||||||
{
|
{
|
||||||
header('Content-Type: application/x-www-form-urlencoded');
|
header('Content-Type: application/x-www-form-urlencoded');
|
||||||
|
|
|
@ -58,7 +58,6 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean false
|
* @return boolean false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -144,6 +143,7 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
|
|
||||||
if (!$token || $token != common_session_token()) {
|
if (!$token || $token != common_session_token()) {
|
||||||
$this->showForm(
|
$this->showForm(
|
||||||
|
// TRANS: Form validation error in API OAuth authorisation because of an invalid session token.
|
||||||
_('There was a problem with your session token. Try again, please.'));
|
_('There was a problem with your session token. Try again, please.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,6 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
assert(!empty($this->reqToken));
|
assert(!empty($this->reqToken));
|
||||||
|
|
||||||
if ($this->arg('allow')) {
|
if ($this->arg('allow')) {
|
||||||
|
|
||||||
// mark the req token as authorized
|
// mark the req token as authorized
|
||||||
try {
|
try {
|
||||||
$this->store->authorize_token($this->oauthTokenParam);
|
$this->store->authorize_token($this->oauthTokenParam);
|
||||||
|
@ -250,9 +249,7 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
|
|
||||||
// Otherwise, inform the user that the rt was authorized
|
// Otherwise, inform the user that the rt was authorized
|
||||||
$this->showAuthorized();
|
$this->showAuthorized();
|
||||||
|
|
||||||
} else if ($this->arg('cancel')) {
|
} else if ($this->arg('cancel')) {
|
||||||
|
|
||||||
common_log(
|
common_log(
|
||||||
LOG_INFO,
|
LOG_INFO,
|
||||||
sprintf(
|
sprintf(
|
||||||
|
@ -421,16 +418,18 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
$access = ($this->app->access_type & Oauth_application::$writeAccess) ?
|
$access = ($this->app->access_type & Oauth_application::$writeAccess) ?
|
||||||
'access and update' : 'access';
|
'access and update' : 'access';
|
||||||
|
|
||||||
// TRANS: User notification of external application requesting account access.
|
|
||||||
// TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application,
|
|
||||||
// TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename.
|
|
||||||
if ($this->app->name == 'anonymous') {
|
if ($this->app->name == 'anonymous') {
|
||||||
// Special message for the anonymous app and consumer
|
// Special message for the anonymous app and consumer.
|
||||||
|
// TRANS: User notification of external application requesting account access.
|
||||||
|
// TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename.
|
||||||
$msg = _('An application would like the ability ' .
|
$msg = _('An application would like the ability ' .
|
||||||
'to <strong>%3$s</strong> your %4$s account data. ' .
|
'to <strong>%3$s</strong> your %4$s account data. ' .
|
||||||
'You should only give access to your %4$s account ' .
|
'You should only give access to your %4$s account ' .
|
||||||
'to third parties you trust.');
|
'to third parties you trust.');
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: User notification of external application requesting account access.
|
||||||
|
// TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application,
|
||||||
|
// TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename.
|
||||||
$msg = _('The application <strong>%1$s</strong> by ' .
|
$msg = _('The application <strong>%1$s</strong> by ' .
|
||||||
'<strong>%2$s</strong> would like the ability ' .
|
'<strong>%2$s</strong> would like the ability ' .
|
||||||
'to <strong>%3$s</strong> your %4$s account data. ' .
|
'to <strong>%3$s</strong> your %4$s account data. ' .
|
||||||
|
@ -612,20 +611,37 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
*/
|
*/
|
||||||
function showAuthorized()
|
function showAuthorized()
|
||||||
{
|
{
|
||||||
|
$title = null;
|
||||||
|
$msg = null;
|
||||||
|
|
||||||
|
if ($this->app->name == 'anonymous') {
|
||||||
|
|
||||||
|
$title =
|
||||||
|
// TRANS: Title of the page notifying the user that an anonymous client application was successfully authorized to access the user's account with OAuth.
|
||||||
|
_('You have successfully authorized the application');
|
||||||
|
|
||||||
|
$msg =
|
||||||
|
// TRANS: Message notifying the user that an anonymous client application was successfully authorized to access the user's account with OAuth.
|
||||||
|
_('Please return to the application and enter the following security code to complete the process.');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
$title = sprintf(
|
$title = sprintf(
|
||||||
// TRANS: Header of user notification after authorising an application access to a profile.
|
// TRANS: Title of the page notifying the user that the client application was successfully authorized to access the user's account with OAuth.
|
||||||
// TRANS: %s is the authorised application name.
|
// TRANS: %s is the authorised application name.
|
||||||
_('You have successfully authorized %s.'),
|
_('You have successfully authorized %s'),
|
||||||
($this->app->name == 'anonymous') ? 'the application' : $this->app->name
|
$this->app->name
|
||||||
);
|
);
|
||||||
|
|
||||||
$msg = sprintf(
|
$msg = sprintf(
|
||||||
// TRANS: Uer notification after authorising an application access to a profile.
|
// TRANS: Message notifying the user that the client application was successfully authorized to access the user's account with OAuth.
|
||||||
// TRANS: %s is the authorised application name.
|
// TRANS: %s is the authorised application name.
|
||||||
_('Please return to %s and enter the following security code to complete the process.'),
|
_('Please return to %s and enter the following security code to complete the process.'),
|
||||||
($this->app->name == 'anonymous') ? 'the application' : $this->app->name
|
$this->app->name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->reqToken->verified_callback == 'oob') {
|
if ($this->reqToken->verified_callback == 'oob') {
|
||||||
$pin = new ApiOauthPinAction(
|
$pin = new ApiOauthPinAction(
|
||||||
$title,
|
$title,
|
||||||
|
@ -635,7 +651,6 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
);
|
);
|
||||||
$pin->showPage();
|
$pin->showPage();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// NOTE: This would only happen if an application registered as
|
// NOTE: This would only happen if an application registered as
|
||||||
// a web application but sent in 'oob' for the oauth_callback
|
// a web application but sent in 'oob' for the oauth_callback
|
||||||
// parameter. Usually web apps will send in a callback and
|
// parameter. Usually web apps will send in a callback and
|
||||||
|
@ -676,7 +691,6 @@ class ApiOauthAuthorizeAction extends Action
|
||||||
|
|
||||||
$callback = $this->app->callback_url;
|
$callback = $this->app->callback_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $callback;
|
return $callback;
|
||||||
|
|
|
@ -42,7 +42,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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiOauthPinAction extends InfoAction
|
class ApiOauthPinAction extends InfoAction
|
||||||
{
|
{
|
||||||
function __construct($title, $message, $verifier, $desktopMode = false)
|
function __construct($title, $message, $verifier, $desktopMode = false)
|
||||||
|
@ -96,6 +95,70 @@ class ApiOauthPinAction extends InfoAction
|
||||||
$this->elementEnd('body');
|
$this->elementEnd('body');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A local menu
|
||||||
|
*
|
||||||
|
* Shows different login/register actions.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showLocalNav()
|
||||||
|
{
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override - suppress output in "desktop" mode
|
||||||
|
*/
|
||||||
|
function showHeader()
|
||||||
|
{
|
||||||
|
if ($this->desktopMode == false) {
|
||||||
|
parent::showHeader();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override - suppress output in "desktop" mode
|
||||||
|
*/
|
||||||
|
function showAside()
|
||||||
|
{
|
||||||
|
if ($this->desktopMode == false) {
|
||||||
|
parent::showAside();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override - suppress output in "desktop" mode
|
||||||
|
*/
|
||||||
|
function showFooter()
|
||||||
|
{
|
||||||
|
if ($this->desktopMode == false) {
|
||||||
|
parent::showFooter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show site notice.
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
function showSiteNotice()
|
||||||
|
{
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show notice form.
|
||||||
|
*
|
||||||
|
* Show the form for posting a new notice
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
function showNoticeForm()
|
||||||
|
{
|
||||||
|
// NOP
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display content.
|
* Display content.
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,7 +42,6 @@ require_once INSTALLDIR . '/lib/apioauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiOauthRequestTokenAction extends ApiOauthAction
|
class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -51,9 +50,7 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -74,7 +71,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -127,7 +123,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
/*
|
/*
|
||||||
* Display temporary OAuth credentials
|
* Display temporary OAuth credentials
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showRequestToken($token)
|
function showRequestToken($token)
|
||||||
{
|
{
|
||||||
header('Content-Type: application/x-www-form-urlencoded');
|
header('Content-Type: application/x-www-form-urlencoded');
|
||||||
|
@ -142,7 +137,6 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function verifyCallback($callback)
|
function verifyCallback($callback)
|
||||||
{
|
{
|
||||||
if ($callback == "oob") {
|
if ($callback == "oob") {
|
||||||
|
@ -157,5 +151,4 @@ class ApiOauthRequestTokenAction extends ApiOauthAction
|
||||||
return Validate::uri($callback);
|
return Validate::uri($callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php';
|
||||||
*
|
*
|
||||||
* @see ApiPrivateAuthAction
|
* @see ApiPrivateAuthAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiSearchAtomAction extends ApiPrivateAuthAction
|
class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $cnt;
|
var $cnt;
|
||||||
var $query;
|
var $query;
|
||||||
var $lang;
|
var $lang;
|
||||||
|
@ -70,7 +68,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @see Action::__construct
|
* @see Action::__construct
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($output='php://output', $indent=null)
|
function __construct($output='php://output', $indent=null)
|
||||||
{
|
{
|
||||||
parent::__construct($output, $indent);
|
parent::__construct($output, $indent);
|
||||||
|
@ -81,7 +78,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadonly()
|
function isReadonly()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -93,16 +89,13 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
* @param array $args Arguments from $_REQUEST
|
* @param array $args Arguments from $_REQUEST
|
||||||
*
|
*
|
||||||
* @return boolean success
|
* @return boolean success
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
common_debug("in apisearchatom prepare()");
|
common_debug("in apisearchatom prepare()");
|
||||||
|
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
|
|
||||||
$this->query = $this->trimmed('q');
|
$this->query = $this->trimmed('q');
|
||||||
$this->lang = $this->trimmed('lang');
|
$this->lang = $this->trimmed('lang');
|
||||||
$this->rpp = $this->trimmed('rpp');
|
$this->rpp = $this->trimmed('rpp');
|
||||||
|
@ -139,7 +132,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -154,7 +146,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array an array of Notice objects sorted in reverse chron
|
* @return array an array of Notice objects sorted in reverse chron
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
// TODO: Support search operators like from: and to:, boolean, etc.
|
// TODO: Support search operators like from: and to:, boolean, etc.
|
||||||
|
@ -180,7 +171,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
if ($this->cnt > 0) {
|
if ($this->cnt > 0) {
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
|
|
||||||
++$cnt;
|
++$cnt;
|
||||||
|
|
||||||
if (!$this->max_id) {
|
if (!$this->max_id) {
|
||||||
|
@ -203,7 +193,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showAtom()
|
function showAtom()
|
||||||
{
|
{
|
||||||
$notices = $this->getNotices();
|
$notices = $this->getNotices();
|
||||||
|
@ -212,7 +201,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
$this->showFeed();
|
$this->showFeed();
|
||||||
|
|
||||||
foreach ($notices as $n) {
|
foreach ($notices as $n) {
|
||||||
|
|
||||||
$profile = $n->getProfile();
|
$profile = $n->getProfile();
|
||||||
|
|
||||||
// Don't show notices from deleted users
|
// Don't show notices from deleted users
|
||||||
|
@ -230,7 +218,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showFeed()
|
function showFeed()
|
||||||
{
|
{
|
||||||
// TODO: A9 OpenSearch stuff like search.twitter.com?
|
// TODO: A9 OpenSearch stuff like search.twitter.com?
|
||||||
|
@ -278,6 +265,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
'rel' => 'self',
|
'rel' => 'self',
|
||||||
'href' => $self_uri));
|
'href' => $self_uri));
|
||||||
|
|
||||||
|
// @todo Needs i18n?
|
||||||
$this->element('title', null, "$this->query - $sitename Search");
|
$this->element('title', null, "$this->query - $sitename Search");
|
||||||
$this->element('updated', null, common_date_iso8601('now'));
|
$this->element('updated', null, common_date_iso8601('now'));
|
||||||
|
|
||||||
|
@ -313,7 +301,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
'rel' => 'previous',
|
'rel' => 'previous',
|
||||||
'href' => $previous_uri));
|
'href' => $previous_uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,7 +311,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showEntry($notice)
|
function showEntry($notice)
|
||||||
{
|
{
|
||||||
$server = common_config('site', 'server');
|
$server = common_config('site', 'server');
|
||||||
|
@ -372,6 +358,7 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
$name = $profile->nickname;
|
$name = $profile->nickname;
|
||||||
|
|
||||||
if ($profile->fullname) {
|
if ($profile->fullname) {
|
||||||
|
// @todo Needs proper i18n?
|
||||||
$name .= ' (' . $profile->fullname . ')';
|
$name .= ' (' . $profile->fullname . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +374,6 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function initAtom()
|
function initAtom()
|
||||||
{
|
{
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
@ -399,10 +385,8 @@ class ApiSearchAtomAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function endAtom()
|
function endAtom()
|
||||||
{
|
{
|
||||||
$this->elementEnd('feed');
|
$this->elementEnd('feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
* @see ApiAction
|
* @see ApiAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiSearchJSONAction extends ApiPrivateAuthAction
|
class ApiSearchJSONAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
var $query;
|
var $query;
|
||||||
|
@ -62,7 +61,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true if nothing goes wrong
|
* @return boolean true if nothing goes wrong
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
common_debug("apisearchjson prepare()");
|
common_debug("apisearchjson prepare()");
|
||||||
|
@ -100,7 +98,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -112,10 +109,8 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showResults()
|
function showResults()
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO: Support search operators like from: and to:, boolean, etc.
|
// TODO: Support search operators like from: and to:, boolean, etc.
|
||||||
|
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
|
@ -146,7 +141,6 @@ class ApiSearchJSONAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -55,7 +55,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusesDestroyAction extends ApiAuthAction
|
class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $status = null;
|
var $status = null;
|
||||||
|
@ -66,9 +65,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -94,13 +91,13 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to execute an unknown API method deleting a status.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
@ -109,6 +106,8 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
|
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to delete a status not using POST or DELETE.
|
||||||
|
// TRANS: POST and DELETE should not be translated.
|
||||||
_('This method requires a POST or DELETE.'),
|
_('This method requires a POST or DELETE.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -118,6 +117,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if (empty($this->notice)) {
|
if (empty($this->notice)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to delete a status with an invalid ID.
|
||||||
_('No status found with that ID.'),
|
_('No status found with that ID.'),
|
||||||
404, $this->format
|
404, $this->format
|
||||||
);
|
);
|
||||||
|
@ -132,6 +132,7 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
$this->showNotice();
|
$this->showNotice();
|
||||||
} else {
|
} else {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed trying to delete a status of another user.
|
||||||
_('You may not delete another user\'s status.'),
|
_('You may not delete another user\'s status.'),
|
||||||
403,
|
403,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -144,7 +145,6 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showNotice()
|
function showNotice()
|
||||||
{
|
{
|
||||||
if (!empty($this->notice)) {
|
if (!empty($this->notice)) {
|
||||||
|
@ -155,5 +155,4 @@ class ApiStatusesDestroyAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusesRetweetAction extends ApiAuthAction
|
class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
var $original = null;
|
var $original = null;
|
||||||
|
@ -54,9 +53,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -73,6 +70,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
$this->original = Notice::staticGet('id', $id);
|
$this->original = Notice::staticGet('id', $id);
|
||||||
|
|
||||||
if (empty($this->original)) {
|
if (empty($this->original)) {
|
||||||
|
// TRANS: Client error displayed trying to repeat a non-existing notice through the API.
|
||||||
$this->clientError(_('No such notice.'),
|
$this->clientError(_('No such notice.'),
|
||||||
400, $this->format);
|
400, $this->format);
|
||||||
return false;
|
return false;
|
||||||
|
@ -81,6 +79,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
$this->user = $this->auth_user;
|
$this->user = $this->auth_user;
|
||||||
|
|
||||||
if ($this->user->id == $this->original->profile_id) {
|
if ($this->user->id == $this->original->profile_id) {
|
||||||
|
// TRANS: Client error displayed trying to repeat an own notice through the API.
|
||||||
$this->clientError(_('Cannot repeat your own notice.'),
|
$this->clientError(_('Cannot repeat your own notice.'),
|
||||||
400, $this->format);
|
400, $this->format);
|
||||||
return false;
|
return false;
|
||||||
|
@ -89,6 +88,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
if ($profile->hasRepeated($id)) {
|
if ($profile->hasRepeated($id)) {
|
||||||
|
// TRANS: Client error displayed trying to re-repeat a notice through the API.
|
||||||
$this->clientError(_('Already repeated that notice.'),
|
$this->clientError(_('Already repeated that notice.'),
|
||||||
400, $this->format);
|
400, $this->format);
|
||||||
return false;
|
return false;
|
||||||
|
@ -106,15 +106,12 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
$repeat = $this->original->repeat($this->user->id, $this->source);
|
$repeat = $this->original->repeat($this->user->id, $this->source);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->showNotice($repeat);
|
$this->showNotice($repeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +120,6 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showNotice($notice)
|
function showNotice($notice)
|
||||||
{
|
{
|
||||||
if (!empty($notice)) {
|
if (!empty($notice)) {
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusesRetweetsAction extends ApiAuthAction
|
class ApiStatusesRetweetsAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
const MAXCOUNT = 100;
|
const MAXCOUNT = 100;
|
||||||
|
@ -57,9 +56,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -69,6 +66,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
|
||||||
$this->original = Notice::staticGet('id', $id);
|
$this->original = Notice::staticGet('id', $id);
|
||||||
|
|
||||||
if (empty($this->original)) {
|
if (empty($this->original)) {
|
||||||
|
// TRANS: Client error displayed trying to display redents of a non-exiting notice.
|
||||||
$this->clientError(_('No such notice.'),
|
$this->clientError(_('No such notice.'),
|
||||||
400, $this->format);
|
400, $this->format);
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,7 +92,6 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -109,6 +106,7 @@ class ApiStatusesRetweetsAction extends ApiAuthAction
|
||||||
$this->showJsonTimeline($strm);
|
$this->showJsonTimeline($strm);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusesShowAction extends ApiPrivateAuthAction
|
class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notice_id = null;
|
var $notice_id = null;
|
||||||
var $notice = null;
|
var $notice = null;
|
||||||
|
|
||||||
|
@ -68,9 +66,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -100,12 +96,12 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
|
// 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.'), $code = 404);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +114,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showNotice()
|
function showNotice()
|
||||||
{
|
{
|
||||||
if (!empty($this->notice)) {
|
if (!empty($this->notice)) {
|
||||||
|
@ -128,7 +123,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
$this->show_single_json_status($this->notice);
|
$this->show_single_json_status($this->notice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// XXX: Twitter just sets a 404 header and doens't bother
|
// XXX: Twitter just sets a 404 header and doens't bother
|
||||||
// to return an err msg
|
// to return an err msg
|
||||||
|
|
||||||
|
@ -136,12 +130,14 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
if (!empty($deleted)) {
|
if (!empty($deleted)) {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed requesting a deleted status.
|
||||||
_('Status deleted.'),
|
_('Status deleted.'),
|
||||||
410,
|
410,
|
||||||
$this->format
|
$this->format
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed requesting a status with an invalid ID.
|
||||||
_('No status with that ID found.'),
|
_('No status with that ID found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -157,7 +153,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -168,7 +163,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notice)) {
|
if (!empty($this->notice)) {
|
||||||
|
@ -186,7 +180,6 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notice)) {
|
if (!empty($this->notice)) {
|
||||||
|
@ -204,5 +197,4 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
|
@ -227,6 +226,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->auth_user)) {
|
if (empty($this->auth_user)) {
|
||||||
|
// TRANS: Client error displayed when updating a status for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||||
$status_shortened = common_shorten_links($this->status);
|
$status_shortened = common_shorten_links($this->status);
|
||||||
|
|
||||||
if (Notice::contentTooLong($status_shortened)) {
|
if (Notice::contentTooLong($status_shortened)) {
|
||||||
|
|
||||||
// Note: Twitter truncates anything over 140, flags the status
|
// Note: Twitter truncates anything over 140, flags the status
|
||||||
// as "truncated."
|
// as "truncated."
|
||||||
|
|
||||||
|
@ -304,6 +303,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||||
|
|
||||||
if (Notice::contentTooLong($status_shortened)) {
|
if (Notice::contentTooLong($status_shortened)) {
|
||||||
$upload->delete();
|
$upload->delete();
|
||||||
|
// TRANS: Client error displayed exceeding the maximum notice length.
|
||||||
|
// TRANS: %d is the maximum lenth for a notice.
|
||||||
$msg = _m('Maximum notice size is %d character, including attachment URL.',
|
$msg = _m('Maximum notice size is %d character, including attachment URL.',
|
||||||
'Maximum notice size is %d characters, including attachment URL.',
|
'Maximum notice size is %d characters, including attachment URL.',
|
||||||
Notice::maxContent());
|
Notice::maxContent());
|
||||||
|
|
|
@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusnetConfigAction extends ApiAction
|
class ApiStatusnetConfigAction extends ApiAction
|
||||||
{
|
{
|
||||||
var $keys = array(
|
var $keys = array(
|
||||||
|
@ -69,9 +68,7 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -85,7 +82,6 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -138,6 +134,7 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -155,11 +152,8 @@ class ApiStatusnetConfigAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +57,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -72,7 +70,6 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -90,6 +87,7 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -107,11 +105,8 @@ class ApiStatusnetVersionAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiSubscriptionsAction extends ApiBareAuthAction
|
class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $profiles = null;
|
var $profiles = null;
|
||||||
|
@ -62,9 +61,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -84,6 +81,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when requesting a list of followers for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,12 +100,12 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
|
// 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.'), $code = 404);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +126,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array Profiles
|
* @return array Profiles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getProfiles()
|
function getProfiles()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -140,7 +137,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,7 +147,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest profile in the stream
|
* @return string datestamp of the latest profile in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
||||||
|
@ -171,7 +166,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
if (!empty($this->profiles) && (count($this->profiles) > 0)) {
|
||||||
|
@ -184,6 +178,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
common_user_cache_hash($this->auth_user),
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
|
// Caching tags.
|
||||||
isset($this->ids_only) ? 'IDs' : 'Profiles',
|
isset($this->ids_only) ? 'IDs' : 'Profiles',
|
||||||
strtotime($this->profiles[0]->created),
|
strtotime($this->profiles[0]->created),
|
||||||
strtotime($this->profiles[$last]->created))
|
strtotime($this->profiles[$last]->created))
|
||||||
|
@ -202,7 +197,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showProfiles($include_statuses = true)
|
function showProfiles($include_statuses = true)
|
||||||
{
|
{
|
||||||
switch ($this->format) {
|
switch ($this->format) {
|
||||||
|
@ -230,6 +224,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
print json_encode($arrays);
|
print json_encode($arrays);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Client error displayed when requesting profiles of followers in an unsupported format.
|
||||||
$this->clientError(_('Unsupported format.'));
|
$this->clientError(_('Unsupported format.'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +236,6 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showIds()
|
function showIds()
|
||||||
{
|
{
|
||||||
switch ($this->format) {
|
switch ($this->format) {
|
||||||
|
@ -260,9 +254,9 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
print json_encode($ids);
|
print json_encode($ids);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// TRANS: Client error displayed when requesting IDs of followers in an unsupported format.
|
||||||
$this->clientError(_('Unsupported format.'));
|
$this->clientError(_('Unsupported format.'));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
@ -59,9 +58,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -69,6 +66,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when requesting most recent favourite notices by a user for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +85,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -99,7 +96,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
@ -107,6 +103,8 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
|
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
$title = sprintf(
|
$title = sprintf(
|
||||||
|
// TRANS: Title for timeline of most recent favourite notices by a user.
|
||||||
|
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
|
||||||
_('%1$s / Favorites from %2$s'),
|
_('%1$s / Favorites from %2$s'),
|
||||||
$sitename,
|
$sitename,
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
|
@ -116,7 +114,10 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
$id = "tag:$taguribase:Favorites:" . $this->user->id;
|
$id = "tag:$taguribase:Favorites:" . $this->user->id;
|
||||||
|
|
||||||
$subtitle = sprintf(
|
$subtitle = sprintf(
|
||||||
_('%1$s updates favorited by %2$s / %2$s.'),
|
// TRANS: Subtitle for timeline of most recent favourite notices by a user.
|
||||||
|
// TRANS: %1$s is the StatusNet sitename, %2$s is a user's full name,
|
||||||
|
// TRANS: %3$s is a user nickname.
|
||||||
|
_('%1$s updates favorited by %2$s / %3$s.'),
|
||||||
$sitename,
|
$sitename,
|
||||||
$profile->getBestName(),
|
$profile->getBestName(),
|
||||||
$this->user->nickname
|
$this->user->nickname
|
||||||
|
@ -148,7 +149,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom = new AtomNoticeFeed($this->auth_user);
|
$atom = new AtomNoticeFeed($this->auth_user);
|
||||||
|
@ -165,12 +165,12 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
$atom->addEntryFromNotices($this->notices);
|
$atom->addEntryFromNotices($this->notices);
|
||||||
|
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'json':
|
case 'json':
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -220,7 +219,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -231,7 +229,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -249,7 +246,6 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -270,5 +266,4 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineFriendsAction extends ApiBareAuthAction
|
class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
@ -164,13 +163,13 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when requesting dents of a user and friends for a user that does not exist.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +188,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -201,7 +199,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
@ -246,7 +243,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom = new AtomNoticeFeed($this->auth_user);
|
$atom = new AtomNoticeFeed($this->auth_user);
|
||||||
|
@ -268,6 +264,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +275,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -307,7 +303,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -318,7 +313,6 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -336,11 +330,9 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
|
||||||
$last = count($this->notices) - 1;
|
$last = count($this->notices) - 1;
|
||||||
|
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
|
@ -357,5 +349,4 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $group = null;
|
var $group = null;
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
|
||||||
|
@ -64,7 +62,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -83,12 +80,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->group)) {
|
if (empty($this->group)) {
|
||||||
|
// TRANS: Client error displayed requesting most recent notices to a group for a non-existing group.
|
||||||
$this->clientError(_('Group not found.'), 404, $this->format);
|
$this->clientError(_('Group not found.'), 404, $this->format);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +99,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
// We'll pull common formatting out of this for other formats
|
// We'll pull common formatting out of this for other formats
|
||||||
|
@ -126,7 +122,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -138,19 +133,21 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
} catch (Atom10FeedException $e) {
|
} catch (Atom10FeedException $e) {
|
||||||
$this->serverError(
|
$this->serverError(
|
||||||
'Could not generate feed for group - ' . $e->getMessage(),
|
// 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,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'json':
|
case 'json':
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error displayed when trying to handle an unknown API method.
|
||||||
_('API method not found.'),
|
_('API method not found.'),
|
||||||
404,
|
404,
|
||||||
$this->format
|
$this->format
|
||||||
|
@ -164,7 +161,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -190,7 +186,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -201,7 +196,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -219,7 +213,6 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -240,5 +233,4 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineHomeAction extends ApiBareAuthAction
|
class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
@ -67,9 +66,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -77,6 +74,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when requesting most recent dents by user and friends for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +93,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -107,12 +104,12 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
|
// TRANS: Timeline title for user and friends. %s is a user nickname.
|
||||||
$title = sprintf(_("%s and friends"), $this->user->nickname);
|
$title = sprintf(_("%s and friends"), $this->user->nickname);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:HomeTimeline:" . $this->user->id;
|
$id = "tag:$taguribase:HomeTimeline:" . $this->user->id;
|
||||||
|
@ -172,6 +169,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +180,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -215,7 +212,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -226,7 +222,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -244,7 +239,6 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -265,5 +259,4 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,10 +55,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineMentionsAction extends ApiBareAuthAction
|
class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +65,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -77,6 +73,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed when requesting most recent mentions for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +92,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -107,7 +103,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
@ -115,6 +110,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
|
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
$title = sprintf(
|
$title = sprintf(
|
||||||
|
// TRANS: Title for timeline of most recent mentions of a user.
|
||||||
|
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname.
|
||||||
_('%1$s / Updates mentioning %2$s'),
|
_('%1$s / Updates mentioning %2$s'),
|
||||||
$sitename, $this->user->nickname
|
$sitename, $this->user->nickname
|
||||||
);
|
);
|
||||||
|
@ -128,6 +125,9 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
$self = $this->getSelfUri();
|
$self = $this->getSelfUri();
|
||||||
|
|
||||||
$subtitle = sprintf(
|
$subtitle = sprintf(
|
||||||
|
// TRANS: Subtitle for timeline of most recent mentions of a user.
|
||||||
|
// TRANS: %1$s is the StatusNet sitename, %2$s is a user nickname,
|
||||||
|
// TRANS: %3$s is a user's full name.
|
||||||
_('%1$s updates that reply to updates from %2$s / %3$s.'),
|
_('%1$s updates that reply to updates from %2$s / %3$s.'),
|
||||||
$sitename, $this->user->nickname, $profile->getBestName()
|
$sitename, $this->user->nickname, $profile->getBestName()
|
||||||
);
|
);
|
||||||
|
@ -149,7 +149,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom = new AtomNoticeFeed($this->auth_user);
|
$atom = new AtomNoticeFeed($this->auth_user);
|
||||||
|
@ -171,6 +170,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -205,7 +204,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -216,7 +214,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -234,7 +231,6 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -255,5 +251,4 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,10 +144,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
</statuses>
|
</statuses>
|
||||||
@endverbatim
|
@endverbatim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,7 +156,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -177,7 +174,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -189,16 +185,17 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
|
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
|
||||||
|
// TRANS: Title for site timeline. %s is the StatusNet sitename.
|
||||||
$title = sprintf(_("%s public timeline"), $sitename);
|
$title = sprintf(_("%s public timeline"), $sitename);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:PublicTimeline";
|
$id = "tag:$taguribase:PublicTimeline";
|
||||||
$link = common_local_url('public');
|
$link = common_local_url('public');
|
||||||
$self = $this->getSelfUri();
|
$self = $this->getSelfUri();
|
||||||
|
// TRANS: Subtitle for site timeline. %s is the StatusNet sitename.
|
||||||
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
|
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
|
||||||
|
|
||||||
switch($this->format) {
|
switch($this->format) {
|
||||||
|
@ -238,6 +235,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +246,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -272,7 +269,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -283,7 +279,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -301,7 +296,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -321,5 +315,4 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineRetweetedByMeAction extends ApiAuthAction
|
class ApiTimelineRetweetedByMeAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
const DEFAULTCOUNT = 20;
|
const DEFAULTCOUNT = 20;
|
||||||
|
@ -64,12 +63,12 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
$this->serverError('Unimplemented.', 503);
|
// TRANS: Server error displayed calling unimplemented API method for 'retweeted by me'.
|
||||||
|
$this->serverError(_('Unimplemented.'), 503);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +80,6 @@ class ApiTimelineRetweetedByMeAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,7 +42,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
const DEFAULTCOUNT = 20;
|
const DEFAULTCOUNT = 20;
|
||||||
|
@ -61,9 +60,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -88,7 +85,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -108,6 +104,7 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
case 'atom':
|
case 'atom':
|
||||||
$profile = $this->auth_user->getProfile();
|
$profile = $this->auth_user->getProfile();
|
||||||
|
|
||||||
|
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
|
||||||
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
|
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
|
$id = "tag:$taguribase:RepeatedToMe:" . $this->auth_user->id;
|
||||||
|
@ -116,8 +113,8 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
|
|
||||||
$this->showAtomTimeline($strm, $title, $id, $link);
|
$this->showAtomTimeline($strm, $title, $id, $link);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -132,7 +129,6 @@ class ApiTimelineRetweetedToMeAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -43,7 +43,6 @@ 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
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
const DEFAULTCOUNT = 20;
|
const DEFAULTCOUNT = 20;
|
||||||
|
@ -62,9 +61,7 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -89,7 +86,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -111,6 +107,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
case 'atom':
|
case 'atom':
|
||||||
$profile = $this->auth_user->getProfile();
|
$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);
|
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
|
||||||
$taguribase = TagURI::base();
|
$taguribase = TagURI::base();
|
||||||
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
|
$id = "tag:$taguribase:RepeatsOfMe:" . $this->auth_user->id;
|
||||||
|
@ -147,8 +145,8 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
$this->raw($atom->getString());
|
$this->raw($atom->getString());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +161,6 @@ class ApiTimelineRetweetsOfMeAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -49,10 +49,8 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineTagAction extends ApiPrivateAuthAction
|
class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,9 +59,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -85,7 +81,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -97,13 +92,16 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$sitename = common_config('site', 'name');
|
$sitename = common_config('site', 'name');
|
||||||
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
|
$sitelogo = (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png');
|
||||||
|
// TRANS: Title for timeline with lastest notices with a given tag.
|
||||||
|
// TRANS: %s is the tag.
|
||||||
$title = sprintf(_("Notices tagged with %s"), $this->tag);
|
$title = sprintf(_("Notices tagged with %s"), $this->tag);
|
||||||
$subtitle = sprintf(
|
$subtitle = sprintf(
|
||||||
|
// TRANS: Subtitle for timeline with lastest notices with a given tag.
|
||||||
|
// TRANS: %1$s is the tag, $2$s is the StatusNet sitename.
|
||||||
_('Updates tagged with %1$s on %2$s!'),
|
_('Updates tagged with %1$s on %2$s!'),
|
||||||
$this->tag,
|
$this->tag,
|
||||||
$sitename
|
$sitename
|
||||||
|
@ -136,7 +134,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom = new AtomNoticeFeed($this->auth_user);
|
$atom = new AtomNoticeFeed($this->auth_user);
|
||||||
|
@ -158,6 +155,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -168,7 +166,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -193,7 +190,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -204,7 +200,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -222,7 +217,6 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -243,5 +237,4 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,8 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTimelineUserAction extends ApiBareAuthAction
|
class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $notices = null;
|
var $notices = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,9 +67,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
* @param array $args $_REQUEST args
|
* @param array $args $_REQUEST args
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -79,6 +75,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
$this->user = $this->getTargetUser($this->arg('id'));
|
$this->user = $this->getTargetUser($this->arg('id'));
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
|
// TRANS: Client error displayed requesting most recent notices for a non-existing user.
|
||||||
$this->clientError(_('No such user.'), 404, $this->format);
|
$this->clientError(_('No such user.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +94,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -109,7 +105,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showTimeline()
|
function showTimeline()
|
||||||
{
|
{
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
@ -147,7 +142,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'atom':
|
case 'atom':
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
|
|
||||||
$atom->setId($self);
|
$atom->setId($self);
|
||||||
|
@ -160,10 +154,10 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
$this->showJsonTimeline($this->notices);
|
$this->showJsonTimeline($this->notices);
|
||||||
break;
|
break;
|
||||||
default:
|
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.'), $code = 404);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,7 +165,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return array notices
|
* @return array notices
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
@ -195,7 +188,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -206,7 +198,6 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string datestamp of the latest notice in the stream
|
* @return string datestamp of the latest notice in the stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function lastModified()
|
function lastModified()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
@ -224,11 +215,9 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
*
|
*
|
||||||
* @return string etag
|
* @return string etag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function etag()
|
function etag()
|
||||||
{
|
{
|
||||||
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
if (!empty($this->notices) && (count($this->notices) > 0)) {
|
||||||
|
|
||||||
$last = count($this->notices) - 1;
|
$last = count($this->notices) - 1;
|
||||||
|
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
|
@ -245,5 +234,4 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,8 @@ require_once INSTALLDIR.'/lib/apiprivateauth.php';
|
||||||
*
|
*
|
||||||
* @see ApiAction
|
* @see ApiAction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiTrendsAction extends ApiPrivateAuthAction
|
class ApiTrendsAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
var $callback;
|
var $callback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +68,6 @@ class ApiTrendsAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -84,7 +81,7 @@ class ApiTrendsAction extends ApiPrivateAuthAction
|
||||||
*/
|
*/
|
||||||
function showTrends()
|
function showTrends()
|
||||||
{
|
{
|
||||||
|
// TRANS: Server error for unfinished API method showTrends.
|
||||||
$this->serverError(_('API method under construction.'), 501);
|
$this->serverError(_('API method under construction.'), 501);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiUserFollowersAction extends ApiSubscriptionsAction
|
class ApiUserFollowersAction extends ApiSubscriptionsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +55,6 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction
|
||||||
*
|
*
|
||||||
* @return array Profiles
|
* @return array Profiles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getProfiles()
|
function getProfiles()
|
||||||
{
|
{
|
||||||
$offset = ($this->page - 1) * $this->count;
|
$offset = ($this->page - 1) * $this->count;
|
||||||
|
@ -85,5 +83,4 @@ class ApiUserFollowersAction extends ApiSubscriptionsAction
|
||||||
|
|
||||||
return $profiles;
|
return $profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiUserFriendsAction extends ApiSubscriptionsAction
|
class ApiUserFriendsAction extends ApiSubscriptionsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +55,6 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
|
||||||
*
|
*
|
||||||
* @return array Profiles
|
* @return array Profiles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getProfiles()
|
function getProfiles()
|
||||||
{
|
{
|
||||||
$offset = ($this->page - 1) * $this->count;
|
$offset = ($this->page - 1) * $this->count;
|
||||||
|
@ -85,5 +83,4 @@ class ApiUserFriendsAction extends ApiSubscriptionsAction
|
||||||
|
|
||||||
return $profiles;
|
return $profiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiUserShowAction extends ApiPrivateAuthAction
|
class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +59,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -87,17 +85,18 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if (empty($this->user)) {
|
if (empty($this->user)) {
|
||||||
$this->clientError(_('Not found.'), 404, $this->format);
|
// TRANS: Client error displayed when requesting user information for a non-existing user.
|
||||||
|
$this->clientError(_('User not found.'), 404, $this->format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($this->format, array('xml', 'json'))) {
|
if (!in_array($this->format, array('xml', 'json'))) {
|
||||||
|
// 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.'), $code = 404);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -105,6 +104,7 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
$profile = $this->user->getProfile();
|
$profile = $this->user->getProfile();
|
||||||
|
|
||||||
if (empty($profile)) {
|
if (empty($profile)) {
|
||||||
|
// TRANS: Client error displayed when requesting user information for a user without a profile.
|
||||||
$this->clientError(_('User has no profile.'));
|
$this->clientError(_('User has no profile.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,6 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
$this->showJsonObjects($twitter_user);
|
$this->showJsonObjects($twitter_user);
|
||||||
$this->endDocument('json');
|
$this->endDocument('json');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,10 +131,8 @@ class ApiUserShowAction extends ApiPrivateAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,12 @@ class NewgroupAction extends Action
|
||||||
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
$this->showForm(_('Full name is too long (maximum 255 characters).'));
|
||||||
return;
|
return;
|
||||||
} else if (User_group::descriptionTooLong($description)) {
|
} else if (User_group::descriptionTooLong($description)) {
|
||||||
$this->showForm(sprintf(_('description is too long (max %d chars).'), User_group::maxDescription()));
|
// TRANS: Form validation error creating a new group because the description is too long.
|
||||||
|
// 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;
|
return;
|
||||||
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
} else if (!is_null($location) && mb_strlen($location) > 255) {
|
||||||
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
$this->showForm(_('Location is too long (maximum 255 characters).'));
|
||||||
|
@ -156,7 +161,11 @@ class NewgroupAction extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($aliases) > common_config('group', 'maxaliases')) {
|
if (count($aliases) > common_config('group', 'maxaliases')) {
|
||||||
$this->showForm(sprintf(_('Too many aliases! Maximum %d.'),
|
// TRANS: Client error shown when providing too many aliases during group creation.
|
||||||
|
// 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')));
|
common_config('group', 'maxaliases')));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,12 +298,12 @@ class ShowgroupAction extends GroupDesignAction
|
||||||
|
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
|
$cur = common_current_user();
|
||||||
$this->elementStart('div', 'entity_actions');
|
$this->elementStart('div', 'entity_actions');
|
||||||
$this->element('h2', null, _('Group actions'));
|
$this->element('h2', null, _('Group actions'));
|
||||||
$this->elementStart('ul');
|
$this->elementStart('ul');
|
||||||
$this->elementStart('li', 'entity_subscribe');
|
$this->elementStart('li', 'entity_subscribe');
|
||||||
if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
|
if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
|
||||||
$cur = common_current_user();
|
|
||||||
if ($cur) {
|
if ($cur) {
|
||||||
if ($cur->isMember($this->group)) {
|
if ($cur->isMember($this->group)) {
|
||||||
$lf = new LeaveForm($this, $this->group);
|
$lf = new LeaveForm($this, $this->group);
|
||||||
|
@ -316,7 +316,7 @@ class ShowgroupAction extends GroupDesignAction
|
||||||
Event::handle('EndGroupSubscribe', array($this, $this->group));
|
Event::handle('EndGroupSubscribe', array($this, $this->group));
|
||||||
}
|
}
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
if ($cur->hasRight(Right::DELETEGROUP)) {
|
if ($cur && $cur->hasRight(Right::DELETEGROUP)) {
|
||||||
$this->elementStart('li', 'entity_delete');
|
$this->elementStart('li', 'entity_delete');
|
||||||
$df = new DeleteGroupForm($this, $this->group);
|
$df = new DeleteGroupForm($this, $this->group);
|
||||||
$df->show();
|
$df->show();
|
||||||
|
|
|
@ -884,13 +884,23 @@ class User extends Memcached_DataObject
|
||||||
static function singleUser()
|
static function singleUser()
|
||||||
{
|
{
|
||||||
if (common_config('singleuser', 'enabled')) {
|
if (common_config('singleuser', 'enabled')) {
|
||||||
|
|
||||||
|
$user = null;
|
||||||
|
|
||||||
$nickname = common_config('singleuser', 'nickname');
|
$nickname = common_config('singleuser', 'nickname');
|
||||||
if ($nickname) {
|
|
||||||
|
if (!empty($nickname)) {
|
||||||
$user = User::staticGet('nickname', $nickname);
|
$user = User::staticGet('nickname', $nickname);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
// if there was no nickname or no user by that nickname,
|
||||||
|
// try the site owner.
|
||||||
|
|
||||||
|
if (empty($user)) {
|
||||||
$user = User::siteOwner();
|
$user = User::siteOwner();
|
||||||
}
|
}
|
||||||
if ($user) {
|
|
||||||
|
if (!empty($user)) {
|
||||||
return $user;
|
return $user;
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Server exception.
|
// TRANS: Server exception.
|
||||||
|
|
|
@ -34,7 +34,7 @@ VALUES
|
||||||
('mbpidgin','mbpidgin','http://code.google.com/p/microblog-purple/', now()),
|
('mbpidgin','mbpidgin','http://code.google.com/p/microblog-purple/', now()),
|
||||||
('Mobidentica', 'Mobidentica', 'http://www.substanceofcode.com/software/mobidentica/', now()),
|
('Mobidentica', 'Mobidentica', 'http://www.substanceofcode.com/software/mobidentica/', now()),
|
||||||
('moconica','Moconica','http://moconica.com/', now()),
|
('moconica','Moconica','http://moconica.com/', now()),
|
||||||
('mustard', 'MuSTArDroid', 'https://launchpad.net/mustardroid', now()),
|
('mustard', 'mustard', 'http://mustard.macno.org', now()),
|
||||||
('nambu','Nambu','http://www.nambu.com/', now()),
|
('nambu','Nambu','http://www.nambu.com/', now()),
|
||||||
('peoplebrowsr', 'PeopleBrowsr', 'http://www.peoplebrowsr.com/', now()),
|
('peoplebrowsr', 'PeopleBrowsr', 'http://www.peoplebrowsr.com/', now()),
|
||||||
('Pikchur','Pikchur','http://www.pikchur.com/', now()),
|
('Pikchur','Pikchur','http://www.pikchur.com/', now()),
|
||||||
|
|
|
@ -27,7 +27,14 @@ function ping_broadcast_notice($notice) {
|
||||||
|
|
||||||
# Array of servers, URL => type
|
# Array of servers, URL => type
|
||||||
$notify = common_config('ping', 'notify');
|
$notify = common_config('ping', 'notify');
|
||||||
|
try {
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// @todo: distinguish the 'broken notice/profile' case from more general
|
||||||
|
// transitory errors.
|
||||||
|
common_log(LOG_ERR, "Exception getting notice profile: " . $e->getMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
$tags = ping_notice_tags($notice);
|
$tags = ping_notice_tags($notice);
|
||||||
|
|
||||||
foreach ($notify as $notify_url => $type) {
|
foreach ($notify as $notify_url => $type) {
|
||||||
|
|
|
@ -342,7 +342,8 @@ function common_set_cookie($key, $value, $expiration=0)
|
||||||
$value,
|
$value,
|
||||||
$expiration,
|
$expiration,
|
||||||
$cookiepath,
|
$cookiepath,
|
||||||
$server);
|
$server,
|
||||||
|
common_config('site', 'ssl')=='always');
|
||||||
}
|
}
|
||||||
|
|
||||||
define('REMEMBERME', 'rememberme');
|
define('REMEMBERME', 'rememberme');
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user