X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnewmessage.php;h=095a7d1d34bed2685ebff113064a2decf5853020;hb=b62e47308754374bd4ca8c7366dc46eebff7cf81;hp=ca9d3703a245844271aa9c19b34c0829b834de7e;hpb=d35b2d3f3c2128b147a6fa897032262c1f632262;p=quix0rs-gnu-social.git diff --git a/actions/newmessage.php b/actions/newmessage.php index ca9d3703a2..095a7d1d34 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -21,15 +21,15 @@ * * @category Personal * @package StatusNet - * @author Evan Prodromou - * @author Zach Copley - * @author Sarven Capadisli + * @author Evan Prodromou + * @author Zach Copley + * @author Sarven Capadisli * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,9 +38,9 @@ if (!defined('LACONICA')) { * * @category Personal * @package StatusNet - * @author Evan Prodromou - * @author Zach Copley - * @author Sarven Capadisli + * @author Evan Prodromou + * @author Zach Copley + * @author Sarven Capadisli * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -99,7 +99,9 @@ class NewmessageAction extends Action $user = common_current_user(); if (!$user) { - $this->clientError(_('Only logged-in users can send direct messages.'), 403); + /* Go log in, and then come back. */ + common_set_returnto($_SERVER['REQUEST_URI']); + common_redirect(common_local_url('login')); return false; } @@ -144,9 +146,10 @@ class NewmessageAction extends Action } else { $content_shortened = common_shorten_links($this->content); - if (mb_strlen($content_shortened) > 140) { - $this->showForm(_('That\'s too long. ' . - 'Max message size is 140 chars.')); + if (Message::contentTooLong($content_shortened)) { + $this->showForm(sprintf(_('That\'s too long. ' . + 'Max message size is %d chars.'), + Message::maxContent())); return; } } @@ -220,7 +223,21 @@ class NewmessageAction extends Action } $this->msg = $msg; - $this->showPage(); + if ($this->trimmed('ajax')) { + header('Content-Type: text/xml;charset=utf-8'); + $this->xw->startDocument('1.0', 'UTF-8'); + $this->elementStart('html'); + $this->elementStart('head'); + $this->element('title', null, _('New message')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showNoticeForm(); + $this->elementEnd('body'); + $this->endHTML(); + } + else { + $this->showPage(); + } } function showPageNotice()