]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
TinyMCE: core tweak; switching order of input processing so length limit is applied...
authorBrion Vibber <brion@pobox.com>
Wed, 11 Aug 2010 21:39:39 +0000 (14:39 -0700)
committerBrion Vibber <brion@pobox.com>
Wed, 11 Aug 2010 21:41:31 +0000 (14:41 -0700)
actions/newnotice.php
plugins/TinyMCE/TinyMCEPlugin.php

index 5e682ffd0577908c0f4e57bb70a7be0d420a4898..8263198f7383c1b38f10c3361a31d423257bb164 100644 (file)
@@ -131,6 +131,8 @@ class NewnoticeAction extends Action
         $user = common_current_user();
         assert($user); // XXX: maybe an error instead...
         $content = $this->trimmed('status_textarea');
+        $options = array();
+        Event::handle('StartSaveNewNoticeWeb', array($this, $user, &$content, &$options));
 
         if (!$content) {
             $this->clientError(_('No content!'));
@@ -157,11 +159,9 @@ class NewnoticeAction extends Action
                                        Notice::maxContent()));
         }
 
-        $replyto = $this->trimmed('inreplyto');
-        #If an ID of 0 is wrongly passed here, it will cause a database error,
-        #so override it...
-        if ($replyto == 0) {
-            $replyto = 'false';
+        $replyto = intval($this->trimmed('inreplyto'));
+        if ($replyto) {
+            $options['replyto'] = $replyto;
         }
 
         $upload = null;
@@ -182,8 +182,6 @@ class NewnoticeAction extends Action
             }
         }
 
-        $options = array('reply_to' => ($replyto == 'false') ? null : $replyto);
-
         if ($user->shareLocation()) {
             // use browser data if checked; otherwise profile data
             if ($this->arg('notice_data-geo')) {
@@ -203,12 +201,12 @@ class NewnoticeAction extends Action
             $options = array_merge($options, $locOptions);
         }
 
-        Event::handle('SaveNewNoticeWeb', array($this, $user, &$content_shortened, &$options));
         $notice = Notice::saveNew($user->id, $content_shortened, 'web', $options);
 
         if (isset($upload)) {
             $upload->attachToNotice($notice);
         }
+        Event::handle('EndSaveNewNoticeWeb', array($this, $user, &$content_shortened, &$options));
 
         if ($this->boolean('ajax')) {
             header('Content-Type: text/xml;charset=utf-8');
index 9408e20c957b2d4498350645932f47d8b5371cbc..d9e1893759ca3e64048ac7d2db615d413156d233 100644 (file)
@@ -115,7 +115,7 @@ class TinyMCEPlugin extends Plugin
      * @param array $options
      * @return boolean hook return
      */
-    function onSaveNewNoticeWeb($action, $user, &$content, &$options)
+    function onStartSaveNewNoticeWeb($action, $user, &$content, &$options)
     {
         $html = $this->sanitizeHtml($action->arg('status_textarea'));
         $options['rendered'] = $html;