]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Merge branch 'nightly' of gitorious.org:social/mainline into nightly
[quix0rs-gnu-social.git] / lib / action.php
index c019b65dc92f40e38f2acfe74991cbc5149d8bb4..82dd34020440e42ddda3da6452f0060592ee15d6 100644 (file)
@@ -118,16 +118,18 @@ class Action extends HTMLOutputter // lawsuit
             common_config_set('db', 'database', $mirror);
         }
 
-        $status = $this->prepare($args);
-        if ($status) {
-            $this->handle($args);
-        } else {
-            common_debug('Prepare failed for Action.');
+        if (Event::handle('StartActionExecute', array($this, &$args))) {
+            $prepared = $this->prepare($args);
+            if ($prepared) {
+                $this->handle($args);
+            } else {
+                common_debug('Prepare failed for Action.');
+            }
         }
 
         $this->flush();
 
-        Event::handle('EndActionExecute', array($status, $this));
+        Event::handle('EndActionExecute', array($this));
     }
 
     /**
@@ -156,8 +158,8 @@ class Action extends HTMLOutputter // lawsuit
         $this->action = strtolower($this->trimmed('action'));
 
         if ($this->ajax || $this->boolean('ajax')) {
-            // check with StatusNet::isAjax()
-            StatusNet::setAjax(true);
+            // check with GNUsocial::isAjax()
+            GNUsocial::setAjax(true);
         }
 
         if ($this->needLogin) {
@@ -206,7 +208,7 @@ class Action extends HTMLOutputter // lawsuit
      */
     function showPage()
     {
-        if (StatusNet::isAjax()) {
+        if (GNUsocial::isAjax()) {
             self::showAjax();
             return;
         }
@@ -326,7 +328,7 @@ class Action extends HTMLOutputter // lawsuit
         } else {
             // favicon.ico should be HTTPS if the rest of the page is
             $this->element('link', array('rel' => 'shortcut icon',
-                                         'href' => common_path('favicon.ico', StatusNet::isHTTPS())));
+                                         'href' => common_path('favicon.ico', GNUsocial::isHTTPS())));
         }
 
         if (common_config('site', 'mobile')) {
@@ -415,7 +417,7 @@ class Action extends HTMLOutputter // lawsuit
                 $this->script('extlib/jquery.form.js');
                 $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', StatusNet::isHTTPS()).'"); }');
+                $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));
@@ -638,7 +640,7 @@ class Action extends HTMLOutputter // lawsuit
             $this->elementStart('a', array('class' => 'home bookmark',
                                            'href' => $url));
 
-            if (StatusNet::isHTTPS()) {
+            if (GNUsocial::isHTTPS()) {
                 $logoUrl = common_config('site', 'ssllogo');
                 if (empty($logoUrl)) {
                     // if logo is an uploaded file, try to fall back to HTTPS file URL
@@ -1144,7 +1146,7 @@ class Action extends HTMLOutputter // lawsuit
                 $image    = common_config('license', 'image');
                 $sslimage = common_config('license', 'sslimage');
 
-                if (StatusNet::isHTTPS()) {
+                if (GNUsocial::isHTTPS()) {
                     if (!empty($sslimage)) {
                         $url = $sslimage;
                     } else if (preg_match('#^http://i.creativecommons.org/#', $image)) {
@@ -1354,6 +1356,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
      *