]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Same as last commit, don't give ID if it's not for a File object
[quix0rs-gnu-social.git] / lib / action.php
index d8b691093cc58a4489afdf213891513cb32cac03..5627b73b6cd7da6484ecdc0fe5dd67f784f0756c 100644 (file)
@@ -418,7 +418,6 @@ class Action extends HTMLOutputter // lawsuit
                 $this->script('extlib/jquery-ui/jquery-ui.js');
                 $this->script('extlib/jquery.cookie.js');
                 $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/extlib/json2.js', GNUsocial::isHTTPS()).'"); }');
-                $this->script('extlib/jquery.infieldlabel.js');
 
                 Event::handle('EndShowJQueryScripts', array($this));
             }
@@ -432,6 +431,7 @@ class Action extends HTMLOutputter // lawsuit
                 $this->inlineScript('var _peopletagAC = "' .
                                     common_local_url('peopletagautocomplete') . '";');
                 $this->showScriptMessages();
+                $this->showScriptVariables();
                 // Anti-framing code to avoid clickjacking attacks in older browsers.
                 // This will show a blank page if the page is being framed, which is
                 // consistent with the behavior of the 'X-Frame-Options: SAMEORIGIN'
@@ -462,12 +462,6 @@ class Action extends HTMLOutputter // lawsuit
             // TRANS: Localized tooltip for '...' expansion button on overlong remote messages.
             $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more');
 
-            // TRANS: Inline reply form submit button: submits a reply comment.
-            $messages['reply_submit'] = _m('BUTTON', 'Reply');
-
-            // TRANS: Placeholder text for inline reply form. Clicking in this box will turn it into a mini notice form.
-            $messages['reply_placeholder'] = _m('Write a reply...');
-
             $messages = array_merge($messages, $this->getScriptMessages());
 
             Event::handle('EndScriptMessages', array($this, &$messages));
@@ -480,6 +474,19 @@ class Action extends HTMLOutputter // lawsuit
         return $messages;
     }
 
+    protected function showScriptVariables()
+    {
+        $vars = array();
+
+        if (Event::handle('StartScriptVariables', array($this, &$vars))) {
+            $vars['urlNewNotice'] = common_local_url('newnotice');
+        }
+        if (!empty($vars)) {
+            $this->inlineScript('SN.V = ' . json_encode($vars));
+        }
+        return $vars;
+    }
+
     /**
      * If the action will need localizable text strings, export them here like so:
      *
@@ -1356,6 +1363,19 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
+    /**
+     * This is a cheap hack to avoid a bug in DB_DataObject
+     * where '' is non-type-aware compared to 0, which means it
+     * will always be true for values like false and 0 too...
+     *
+     * Upstream bug is::
+     * https://pear.php.net/bugs/bug.php?id=20291
+     */
+    function booleanintstring($key, $def)
+    {
+        return $this->boolean($key, $def) ? '1' : '0';
+    }
+
     /**
      * Integer value of an argument
      *