forked from GNUsocial/gnu-social
Merge branch 'nightly', beginning of 1.2.x
Conflicts: plugins/APC/locale/APC.pot plugins/APC/locale/ast/LC_MESSAGES/APC.po plugins/APC/locale/be-tarask/LC_MESSAGES/APC.po plugins/APC/locale/br/LC_MESSAGES/APC.po plugins/APC/locale/de/LC_MESSAGES/APC.po plugins/APC/locale/es/LC_MESSAGES/APC.po plugins/APC/locale/eu/LC_MESSAGES/APC.po plugins/APC/locale/fr/LC_MESSAGES/APC.po plugins/APC/locale/gl/LC_MESSAGES/APC.po plugins/APC/locale/he/LC_MESSAGES/APC.po plugins/APC/locale/ia/LC_MESSAGES/APC.po plugins/APC/locale/id/LC_MESSAGES/APC.po plugins/APC/locale/it/LC_MESSAGES/APC.po plugins/APC/locale/mk/LC_MESSAGES/APC.po plugins/APC/locale/ms/LC_MESSAGES/APC.po plugins/APC/locale/nb/LC_MESSAGES/APC.po plugins/APC/locale/nl/LC_MESSAGES/APC.po plugins/APC/locale/pl/LC_MESSAGES/APC.po plugins/APC/locale/pt/LC_MESSAGES/APC.po plugins/APC/locale/pt_BR/LC_MESSAGES/APC.po plugins/APC/locale/ru/LC_MESSAGES/APC.po plugins/APC/locale/tl/LC_MESSAGES/APC.po plugins/APC/locale/uk/LC_MESSAGES/APC.po plugins/APC/locale/zh_CN/LC_MESSAGES/APC.po plugins/Adsense/locale/Adsense.pot plugins/Adsense/locale/be-tarask/LC_MESSAGES/Adsense.po plugins/Adsense/locale/br/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ca/LC_MESSAGES/Adsense.po plugins/Adsense/locale/de/LC_MESSAGES/Adsense.po plugins/Adsense/locale/es/LC_MESSAGES/Adsense.po plugins/Adsense/locale/eu/LC_MESSAGES/Adsense.po plugins/Adsense/locale/fr/LC_MESSAGES/Adsense.po plugins/Adsense/locale/gl/LC_MESSAGES/Adsense.po plugins/Adsense/locale/he/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ia/LC_MESSAGES/Adsense.po plugins/Adsense/locale/it/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ja/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ka/LC_MESSAGES/Adsense.po plugins/Adsense/locale/lb/LC_MESSAGES/Adsense.po plugins/Adsense/locale/lt/LC_MESSAGES/Adsense.po plugins/Adsense/locale/mk/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ms/LC_MESSAGES/Adsense.po plugins/Adsense/locale/nb/LC_MESSAGES/Adsense.po plugins/Adsense/locale/nl/LC_MESSAGES/Adsense.po plugins/Adsense/locale/pl/LC_MESSAGES/Adsense.po plugins/Adsense/locale/pt/LC_MESSAGES/Adsense.po plugins/Adsense/locale/pt_BR/LC_MESSAGES/Adsense.po plugins/Adsense/locale/ru/LC_MESSAGES/Adsense.po plugins/Adsense/locale/sv/LC_MESSAGES/Adsense.po plugins/Adsense/locale/tl/LC_MESSAGES/Adsense.po plugins/Adsense/locale/tr/LC_MESSAGES/Adsense.po plugins/Adsense/locale/uk/LC_MESSAGES/Adsense.po plugins/Adsense/locale/zh_CN/LC_MESSAGES/Adsense.po plugins/Aim/locale/Aim.pot plugins/Aim/locale/af/LC_MESSAGES/Aim.po plugins/Aim/locale/ca/LC_MESSAGES/Aim.po plugins/Aim/locale/de/LC_MESSAGES/Aim.po plugins/Aim/locale/es/LC_MESSAGES/Aim.po plugins/Aim/locale/eu/LC_MESSAGES/Aim.po plugins/Aim/locale/fi/LC_MESSAGES/Aim.po plugins/Aim/locale/fr/LC_MESSAGES/Aim.po plugins/Aim/locale/gl/LC_MESSAGES/Aim.po plugins/Aim/locale/ia/LC_MESSAGES/Aim.po plugins/Aim/locale/it/LC_MESSAGES/Aim.po plugins/Aim/locale/mk/LC_MESSAGES/Aim.po plugins/Aim/locale/ms/LC_MESSAGES/Aim.po plugins/Aim/locale/nl/LC_MESSAGES/Aim.po plugins/Aim/locale/pl/LC_MESSAGES/Aim.po plugins/Aim/locale/pt/LC_MESSAGES/Aim.po plugins/Aim/locale/sv/LC_MESSAGES/Aim.po plugins/Aim/locale/tl/LC_MESSAGES/Aim.po plugins/Aim/locale/uk/LC_MESSAGES/Aim.po plugins/Blog/locale/Blog.pot plugins/Blog/locale/ar/LC_MESSAGES/Blog.po plugins/Blog/locale/br/LC_MESSAGES/Blog.po plugins/Blog/locale/ca/LC_MESSAGES/Blog.po plugins/Blog/locale/de/LC_MESSAGES/Blog.po plugins/Blog/locale/es/LC_MESSAGES/Blog.po plugins/Blog/locale/eu/LC_MESSAGES/Blog.po plugins/Blog/locale/fr/LC_MESSAGES/Blog.po plugins/Blog/locale/gl/LC_MESSAGES/Blog.po plugins/Blog/locale/ia/LC_MESSAGES/Blog.po plugins/Blog/locale/it/LC_MESSAGES/Blog.po plugins/Blog/locale/lt/LC_MESSAGES/Blog.po plugins/Blog/locale/mk/LC_MESSAGES/Blog.po plugins/Blog/locale/nl/LC_MESSAGES/Blog.po plugins/Blog/locale/tl/LC_MESSAGES/Blog.po plugins/Blog/locale/tr/LC_MESSAGES/Blog.po plugins/Irc/locale/Irc.pot plugins/Irc/locale/ca/LC_MESSAGES/Irc.po plugins/Irc/locale/de/LC_MESSAGES/Irc.po plugins/Irc/locale/es/LC_MESSAGES/Irc.po plugins/Irc/locale/eu/LC_MESSAGES/Irc.po plugins/Irc/locale/fi/LC_MESSAGES/Irc.po plugins/Irc/locale/fr/LC_MESSAGES/Irc.po plugins/Irc/locale/gl/LC_MESSAGES/Irc.po plugins/Irc/locale/ia/LC_MESSAGES/Irc.po plugins/Irc/locale/it/LC_MESSAGES/Irc.po plugins/Irc/locale/ja/LC_MESSAGES/Irc.po plugins/Irc/locale/mk/LC_MESSAGES/Irc.po plugins/Irc/locale/nl/LC_MESSAGES/Irc.po plugins/Irc/locale/sv/LC_MESSAGES/Irc.po plugins/Irc/locale/tl/LC_MESSAGES/Irc.po plugins/Irc/locale/tr/LC_MESSAGES/Irc.po plugins/Irc/locale/uk/LC_MESSAGES/Irc.po plugins/Spotify/locale/Spotify.pot plugins/Spotify/locale/de/LC_MESSAGES/Spotify.po plugins/Spotify/locale/es/LC_MESSAGES/Spotify.po plugins/Spotify/locale/fr/LC_MESSAGES/Spotify.po plugins/Spotify/locale/gl/LC_MESSAGES/Spotify.po plugins/Spotify/locale/he/LC_MESSAGES/Spotify.po plugins/Spotify/locale/ia/LC_MESSAGES/Spotify.po plugins/Spotify/locale/mk/LC_MESSAGES/Spotify.po plugins/Spotify/locale/nl/LC_MESSAGES/Spotify.po plugins/Spotify/locale/sv/LC_MESSAGES/Spotify.po plugins/Spotify/locale/tl/LC_MESSAGES/Spotify.po plugins/TinyMCE/locale/TinyMCE.pot plugins/TinyMCE/locale/ca/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/de/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/eo/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/es/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/fr/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/gl/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/he/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/ia/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/id/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/ja/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/mk/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/ms/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/nb/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/nl/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/pt/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/pt_BR/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/ru/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/tl/LC_MESSAGES/TinyMCE.po plugins/TinyMCE/locale/uk/LC_MESSAGES/TinyMCE.po plugins/XCache/locale/XCache.pot plugins/XCache/locale/ast/LC_MESSAGES/XCache.po plugins/XCache/locale/br/LC_MESSAGES/XCache.po plugins/XCache/locale/de/LC_MESSAGES/XCache.po plugins/XCache/locale/es/LC_MESSAGES/XCache.po plugins/XCache/locale/eu/LC_MESSAGES/XCache.po plugins/XCache/locale/fi/LC_MESSAGES/XCache.po plugins/XCache/locale/fr/LC_MESSAGES/XCache.po plugins/XCache/locale/gl/LC_MESSAGES/XCache.po plugins/XCache/locale/he/LC_MESSAGES/XCache.po plugins/XCache/locale/ia/LC_MESSAGES/XCache.po plugins/XCache/locale/id/LC_MESSAGES/XCache.po plugins/XCache/locale/mk/LC_MESSAGES/XCache.po plugins/XCache/locale/ms/LC_MESSAGES/XCache.po plugins/XCache/locale/nb/LC_MESSAGES/XCache.po plugins/XCache/locale/nl/LC_MESSAGES/XCache.po plugins/XCache/locale/pl/LC_MESSAGES/XCache.po plugins/XCache/locale/pt/LC_MESSAGES/XCache.po plugins/XCache/locale/pt_BR/LC_MESSAGES/XCache.po plugins/XCache/locale/ru/LC_MESSAGES/XCache.po plugins/XCache/locale/tl/LC_MESSAGES/XCache.po plugins/XCache/locale/tr/LC_MESSAGES/XCache.po plugins/XCache/locale/uk/LC_MESSAGES/XCache.po plugins/YammerImport/locale/YammerImport.pot plugins/YammerImport/locale/br/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/de/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/es/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/eu/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/fr/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/gl/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/ia/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/mk/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/ms/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/nl/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/pl/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/ru/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/tl/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/tr/LC_MESSAGES/YammerImport.po plugins/YammerImport/locale/uk/LC_MESSAGES/YammerImport.po
This commit is contained in:
@@ -30,9 +30,7 @@
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Action for posting new direct messages
|
||||
@@ -52,7 +50,7 @@ class NewmessageAction extends FormAction
|
||||
var $to = null;
|
||||
var $other = null;
|
||||
|
||||
protected $form = 'message'; // will become MessageForm later
|
||||
protected $form = 'Message'; // will become MessageForm later
|
||||
|
||||
/**
|
||||
* Title of the page
|
||||
@@ -68,18 +66,8 @@ class NewmessageAction extends FormAction
|
||||
return _('New message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle input, produce output
|
||||
*
|
||||
* @param array $args $_REQUEST contents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected function prepare(array $args=array())
|
||||
protected function doPreparation()
|
||||
{
|
||||
parent::prepare($args);
|
||||
|
||||
$this->content = $this->trimmed('content');
|
||||
$this->to = $this->trimmed('to');
|
||||
|
||||
@@ -107,29 +95,27 @@ class NewmessageAction extends FormAction
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function handlePost()
|
||||
protected function doPost()
|
||||
{
|
||||
parent::handlePost();
|
||||
|
||||
assert($this->scoped instanceof Profile); // XXX: maybe an error instead...
|
||||
|
||||
if (!$this->content) {
|
||||
if (empty($this->content)) {
|
||||
// TRANS: Form validator error displayed trying to send a direct message without content.
|
||||
$this->clientError(_('No content!'));
|
||||
} else {
|
||||
$content_shortened = $this->scoped->shortenLinks($this->content);
|
||||
|
||||
if (Message::contentTooLong($content_shortened)) {
|
||||
// TRANS: Form validation error displayed when message content is too long.
|
||||
// TRANS: %d is the maximum number of characters for a message.
|
||||
$this->clientError(sprintf(_m('That\'s too long. Maximum message size is %d character.',
|
||||
'That\'s too long. Maximum message size is %d characters.',
|
||||
Message::maxContent()),
|
||||
Message::maxContent()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->other) {
|
||||
$content_shortened = $this->scoped->shortenLinks($this->content);
|
||||
|
||||
if (Message::contentTooLong($content_shortened)) {
|
||||
// TRANS: Form validation error displayed when message content is too long.
|
||||
// TRANS: %d is the maximum number of characters for a message.
|
||||
$this->clientError(sprintf(_m('That\'s too long. Maximum message size is %d character.',
|
||||
'That\'s too long. Maximum message size is %d characters.',
|
||||
Message::maxContent()),
|
||||
Message::maxContent()));
|
||||
}
|
||||
|
||||
if (!$this->other instanceof Profile) {
|
||||
// TRANS: Form validation error displayed trying to send a direct message without specifying a recipient.
|
||||
$this->clientError(_('No recipient specified.'));
|
||||
} else if (!$this->scoped->mutuallySubscribed($this->other)) {
|
||||
@@ -145,86 +131,18 @@ class NewmessageAction extends FormAction
|
||||
$message = Message::saveNew($this->scoped->id, $this->other->id, $this->content, 'web');
|
||||
$message->notify();
|
||||
|
||||
if ($this->boolean('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after sending a direct message.
|
||||
$this->element('title', null, _('Message sent'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
$this->element('p', array('id' => 'command_result'),
|
||||
// TRANS: Confirmation text after sending a direct message.
|
||||
// TRANS: %s is the direct message recipient.
|
||||
sprintf(_('Direct message to %s sent.'),
|
||||
$this->other->nickname));
|
||||
$this->elementEnd('body');
|
||||
$this->endHTML();
|
||||
} else {
|
||||
$url = common_local_url('outbox',
|
||||
array('nickname' => $this->scoped->nickname));
|
||||
common_redirect($url, 303);
|
||||
if (GNUsocial::isAjax()) {
|
||||
// TRANS: Confirmation text after sending a direct message.
|
||||
// TRANS: %s is the direct message recipient.
|
||||
return sprintf(_('Direct message to %s sent.'), $this->other->getNickname());
|
||||
}
|
||||
|
||||
$url = common_local_url('outbox', array('nickname' => $this->scoped->getNickname()));
|
||||
common_redirect($url, 303);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show an Ajax-y error message
|
||||
*
|
||||
* Goes back to the browser, where it's shown in a popup.
|
||||
*
|
||||
* @param string $msg Message to show
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function ajaxErrorMsg($msg)
|
||||
{
|
||||
$this->startHTML('text/xml;charset=utf-8', true);
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title after an AJAX error occurred on the "send direct message" page.
|
||||
$this->element('title', null, _('Ajax Error'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
$this->element('p', array('id' => 'error'), $msg);
|
||||
$this->elementEnd('body');
|
||||
$this->endHTML();
|
||||
}
|
||||
|
||||
function showForm($msg = null)
|
||||
{
|
||||
if ($msg && $this->boolean('ajax')) {
|
||||
$this->ajaxErrorMsg($msg);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->msg = $msg;
|
||||
if ($this->trimmed('ajax')) {
|
||||
$this->startHTML('text/xml;charset=utf-8');
|
||||
$this->elementStart('head');
|
||||
// TRANS: Page title on page for sending a direct message.
|
||||
$this->element('title', null, _('New message'));
|
||||
$this->elementEnd('head');
|
||||
$this->elementStart('body');
|
||||
$this->showNoticeForm();
|
||||
$this->elementEnd('body');
|
||||
$this->endHTML();
|
||||
}
|
||||
else {
|
||||
$this->showPage();
|
||||
}
|
||||
}
|
||||
|
||||
function showPageNotice()
|
||||
{
|
||||
if ($this->msg) {
|
||||
$this->element('p', 'error', $this->msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Do nothing (override)
|
||||
|
||||
function showNoticeForm()
|
||||
{
|
||||
$message_form = new MessageForm($this, $this->other, $this->content);
|
||||
$message_form->show();
|
||||
// Just don't show a NoticeForm
|
||||
}
|
||||
}
|
||||
|
@@ -13,12 +13,12 @@ class Message extends Managed_DataObject
|
||||
|
||||
public $__table = 'message'; // table name
|
||||
public $id; // int(4) primary_key not_null
|
||||
public $uri; // varchar(255) unique_key
|
||||
public $uri; // varchar(191) unique_key not 255 because utf8mb4 takes more space
|
||||
public $from_profile; // int(4) not_null
|
||||
public $to_profile; // int(4) not_null
|
||||
public $content; // text()
|
||||
public $rendered; // text()
|
||||
public $url; // varchar(255)
|
||||
public $url; // varchar(191) not 255 because utf8mb4 takes more space
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
public $source; // varchar(32)
|
||||
@@ -31,12 +31,12 @@ class Message extends Managed_DataObject
|
||||
return array(
|
||||
'fields' => array(
|
||||
'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier'),
|
||||
'uri' => array('type' => 'varchar', 'length' => 191, 'description' => 'universally unique identifier'),
|
||||
'from_profile' => array('type' => 'int', 'not null' => true, 'description' => 'who the message is from'),
|
||||
'to_profile' => array('type' => 'int', 'not null' => true, 'description' => 'who the message is to'),
|
||||
'content' => array('type' => 'text', 'description' => 'message content'),
|
||||
'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'),
|
||||
'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'),
|
||||
'url' => array('type' => 'varchar', 'length' => 191, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'),
|
||||
'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'),
|
||||
'modified' => array('type' => 'timestamp', 'not null' => true, 'description' => 'date this record was modified'),
|
||||
'source' => array('type' => 'varchar', 'length' => 32, 'description' => 'source of comment, like "web", "im", or "clientname"'),
|
||||
|
Reference in New Issue
Block a user