]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / lib / action.php
index 14d0fe80579f70eab7915ce7ff31635b93736d66..8c0e11d1d50aa392ce9c3bac06e14171742ed51d 100644 (file)
@@ -125,11 +125,10 @@ class Action extends HTMLOutputter // lawsuit
             } else {
                 common_debug('Prepare failed for Action.');
             }
-        }
-
-        $this->flush();
 
-        Event::handle('EndActionExecute', array($this));
+            $this->flush();
+            Event::handle('EndActionExecute', array($this));
+        }
     }
 
     /**
@@ -431,6 +430,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'
@@ -473,6 +473,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:
      *
@@ -521,15 +534,11 @@ class Action extends HTMLOutputter // lawsuit
      */
     function showFeeds()
     {
-        $feeds = $this->getFeeds();
-
-        if ($feeds) {
-            foreach ($feeds as $feed) {
-                $this->element('link', array('rel' => $feed->rel(),
-                                             'href' => $feed->url,
-                                             'type' => $feed->mimeType(),
-                                             'title' => $feed->title));
-            }
+        foreach ($this->getFeeds() as $feed) {
+            $this->element('link', array('rel' => $feed->rel(),
+                                         'href' => $feed->url,
+                                         'type' => $feed->mimeType(),
+                                         'title' => $feed->title));
         }
     }
 
@@ -1022,9 +1031,9 @@ class Action extends HTMLOutputter // lawsuit
     function showExportData()
     {
         $feeds = $this->getFeeds();
-        if ($feeds) {
-            $fl = new FeedList($this);
-            $fl->show($feeds);
+        if (!empty($feeds)) {
+            $fl = new FeedList($this, $feeds);
+            $fl->show();
         }
     }
 
@@ -1211,7 +1220,7 @@ class Action extends HTMLOutputter // lawsuit
      *
      * @return boolean is read only action?
      */
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         return false;
     }
@@ -1357,7 +1366,7 @@ class Action extends HTMLOutputter // lawsuit
      * Upstream bug is::
      * https://pear.php.net/bugs/bug.php?id=20291
      */
-    function booleanintstring($key, $def)
+    function booleanintstring($key, $def=false)
     {
         return $this->boolean($key, $def) ? '1' : '0';
     }
@@ -1645,7 +1654,7 @@ class Action extends HTMLOutputter // lawsuit
      */
     function getFeeds()
     {
-        return null;
+        return array();
     }
 
     /**