X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapidirectmessage.php;h=e971a7d4eed9953434481dc2f324aa8def2694d1;hb=f110fc5c9a61ac666d88714b170b12f99d911b11;hp=7a0f46274cbde24478e222da8bdcbbce2bd50f1a;hpb=28fe1c2f3c814ec6a578b0e49acaa27e9cf88a19;p=quix0rs-gnu-social.git diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php index 7a0f46274c..e971a7d4ee 100644 --- a/actions/apidirectmessage.php +++ b/actions/apidirectmessage.php @@ -34,8 +34,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Show a list of direct messages from or to the authenticating user * @@ -48,7 +46,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 * @link http://status.net/ */ - class ApiDirectMessageAction extends ApiAuthAction { var $messages = null; @@ -64,9 +61,7 @@ class ApiDirectMessageAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); @@ -74,8 +69,8 @@ class ApiDirectMessageAction extends ApiAuthAction $this->user = $this->auth_user; if (empty($this->user)) { - $this->clientError(_('No such user.'), 404, $this->format); - return; + // TRANS: Client error given when a user was not found (404). + $this->clientError(_('No such user.'), 404); } $server = common_root_url(); @@ -86,10 +81,12 @@ class ApiDirectMessageAction extends ApiAuthAction // Action was called by /api/direct_messages/sent.format $this->title = sprintf( + // TRANS: Title. %s is a user nickname. _("Direct messages from %s"), $this->user->nickname ); $this->subtitle = sprintf( + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent from %s"), $this->user->nickname ); @@ -98,10 +95,12 @@ class ApiDirectMessageAction extends ApiAuthAction $this->id = "tag:$taguribase:SentDirectMessages:" . $this->user->id; } else { $this->title = sprintf( + // TRANS: Title. %s is a user nickname. _("Direct messages to %s"), $this->user->nickname ); $this->subtitle = sprintf( + // TRANS: Subtitle. %s is a user nickname. _("All the direct messages sent to %s"), $this->user->nickname ); @@ -124,7 +123,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -136,7 +134,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showMessages() { switch($this->format) { @@ -153,6 +150,7 @@ class ApiDirectMessageAction extends ApiAuthAction $this->showJsonDirectMessages(); break; default: + // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), $code = 404); break; } @@ -163,7 +161,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return array notices */ - function getMessages() { $message = new Message(); @@ -202,7 +199,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -213,7 +209,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->messages)) { @@ -228,7 +223,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showXmlDirectMessages() { $this->initDocument('xml'); @@ -249,7 +243,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showJsonDirectMessages() { $this->initDocument('json'); @@ -270,7 +263,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showRssDirectMessages() { $this->initDocument('rss'); @@ -305,7 +297,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return void */ - function showAtomDirectMessages() { $this->initDocument('atom'); @@ -347,7 +338,6 @@ class ApiDirectMessageAction extends ApiAuthAction * * @return string etag */ - function etag() { if (!empty($this->messages)) { @@ -357,6 +347,7 @@ class ApiDirectMessageAction extends ApiAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), strtotime($this->messages[0]->created), strtotime($this->messages[$last]->created) @@ -367,5 +358,4 @@ class ApiDirectMessageAction extends ApiAuthAction return null; } - }