forked from GNUsocial/gnu-social
TinyMCE: core tweak; switching order of input processing so length limit is applied to stripped version of the text
This commit is contained in:
parent
c19696afec
commit
527561cd93
@ -131,6 +131,8 @@ class NewnoticeAction extends Action
|
|||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
assert($user); // XXX: maybe an error instead...
|
assert($user); // XXX: maybe an error instead...
|
||||||
$content = $this->trimmed('status_textarea');
|
$content = $this->trimmed('status_textarea');
|
||||||
|
$options = array();
|
||||||
|
Event::handle('StartSaveNewNoticeWeb', array($this, $user, &$content, &$options));
|
||||||
|
|
||||||
if (!$content) {
|
if (!$content) {
|
||||||
$this->clientError(_('No content!'));
|
$this->clientError(_('No content!'));
|
||||||
@ -157,11 +159,9 @@ class NewnoticeAction extends Action
|
|||||||
Notice::maxContent()));
|
Notice::maxContent()));
|
||||||
}
|
}
|
||||||
|
|
||||||
$replyto = $this->trimmed('inreplyto');
|
$replyto = intval($this->trimmed('inreplyto'));
|
||||||
#If an ID of 0 is wrongly passed here, it will cause a database error,
|
if ($replyto) {
|
||||||
#so override it...
|
$options['replyto'] = $replyto;
|
||||||
if ($replyto == 0) {
|
|
||||||
$replyto = 'false';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$upload = null;
|
$upload = null;
|
||||||
@ -182,8 +182,6 @@ class NewnoticeAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
|
|
||||||
|
|
||||||
if ($user->shareLocation()) {
|
if ($user->shareLocation()) {
|
||||||
// use browser data if checked; otherwise profile data
|
// use browser data if checked; otherwise profile data
|
||||||
if ($this->arg('notice_data-geo')) {
|
if ($this->arg('notice_data-geo')) {
|
||||||
@ -203,12 +201,12 @@ class NewnoticeAction extends Action
|
|||||||
$options = array_merge($options, $locOptions);
|
$options = array_merge($options, $locOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::handle('SaveNewNoticeWeb', array($this, $user, &$content_shortened, &$options));
|
|
||||||
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
|
$notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
|
||||||
|
|
||||||
if (isset($upload)) {
|
if (isset($upload)) {
|
||||||
$upload->attachToNotice($notice);
|
$upload->attachToNotice($notice);
|
||||||
}
|
}
|
||||||
|
Event::handle('EndSaveNewNoticeWeb', array($this, $user, &$content_shortened, &$options));
|
||||||
|
|
||||||
if ($this->boolean('ajax')) {
|
if ($this->boolean('ajax')) {
|
||||||
header('Content-Type: text/xml;charset=utf-8');
|
header('Content-Type: text/xml;charset=utf-8');
|
||||||
|
@ -115,7 +115,7 @@ class TinyMCEPlugin extends Plugin
|
|||||||
* @param array $options
|
* @param array $options
|
||||||
* @return boolean hook return
|
* @return boolean hook return
|
||||||
*/
|
*/
|
||||||
function onSaveNewNoticeWeb($action, $user, &$content, &$options)
|
function onStartSaveNewNoticeWeb($action, $user, &$content, &$options)
|
||||||
{
|
{
|
||||||
$html = $this->sanitizeHtml($action->arg('status_textarea'));
|
$html = $this->sanitizeHtml($action->arg('status_textarea'));
|
||||||
$options['rendered'] = $html;
|
$options['rendered'] = $html;
|
||||||
|
Loading…
Reference in New Issue
Block a user