]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Merge commit 'mainline/0.9.x' into 0.9.x
[quix0rs-gnu-social.git] / lib / action.php
index b5cf3240c69a39efe131f27dfdad5e4fb6f1606e..6efa9163dc65550239db89c52d439f00e7af194b 100644 (file)
@@ -68,7 +68,7 @@ class Action extends HTMLOutputter // lawsuit
      * @see XMLOutputter::__construct
      * @see HTMLOutputter::__construct
      */
-    function __construct($output='php://output', $indent=true)
+    function __construct($output='php://output', $indent=null)
     {
         parent::__construct($output, $indent);
     }
@@ -141,7 +141,7 @@ class Action extends HTMLOutputter // lawsuit
     function showTitle()
     {
         $this->element('title', null,
-                       sprintf(_("%s - %s"),
+                       sprintf(_("%1$s - %2$s"),
                                $this->title(),
                                common_config('site', 'name')));
     }
@@ -252,6 +252,8 @@ class Action extends HTMLOutputter // lawsuit
             if (Event::handle('StartShowJQueryScripts', array($this))) {
                 $this->script('js/jquery.min.js');
                 $this->script('js/jquery.form.js');
+                $this->script('js/jquery.cookie.js');
+                $this->script('js/json2.js');
                 $this->script('js/jquery.joverlay.min.js');
                 Event::handle('EndShowJQueryScripts', array($this));
             }
@@ -259,6 +261,7 @@ class Action extends HTMLOutputter // lawsuit
                 Event::handle('StartShowLaconicaScripts', array($this))) {
                 $this->script('js/xbImportNode.js');
                 $this->script('js/util.js');
+                $this->script('js/geometa.js');
                 // Frame-busting code to avoid clickjacking attacks.
                 $this->element('script', array('type' => 'text/javascript'),
                                'if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
@@ -434,6 +437,10 @@ class Action extends HTMLOutputter // lawsuit
                     $this->menuItem(common_local_url($connect),
                                     _('Connect'), _('Connect to services'), false, 'nav_connect');
                 }
+                if ($user->hasRight(Right::CONFIGURESITE)) {
+                    $this->menuItem(common_local_url('siteadminpanel'),
+                                    _('Admin'), _('Change site configuration'), false, 'nav_admin');
+                }
                 if (common_config('invite', 'enabled')) {
                     $this->menuItem(common_local_url('invite'),
                                     _('Invite'),
@@ -730,6 +737,8 @@ class Action extends HTMLOutputter // lawsuit
                             _('Privacy'));
             $this->menuItem(common_local_url('doc', array('title' => 'source')),
                             _('Source'));
+            $this->menuItem(common_local_url('version'),
+                            _('Version'));
             $this->menuItem(common_local_url('doc', array('title' => 'contact')),
                             _('Contact'));
             $this->menuItem(common_local_url('doc', array('title' => 'badge')),
@@ -946,6 +955,36 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
+    /**
+     * Integer value of an argument
+     *
+     * @param string $key      query key we're interested in
+     * @param string $defValue optional default value (default null)
+     * @param string $maxValue optional max value (default null)
+     * @param string $minValue optional min value (default null)
+     *
+     * @return integer integer value
+     */
+
+    function int($key, $defValue=null, $maxValue=null, $minValue=null)
+    {
+        $arg = strtolower($this->trimmed($key));
+
+        if (is_null($arg) || !is_integer($arg)) {
+            return $defValue;
+        }
+
+        if (!is_null($maxValue)) {
+            $arg = min($arg, $maxValue);
+        }
+
+        if (!is_null($minValue)) {
+            $arg = max($arg, $minValue);
+        }
+
+        return $arg;
+    }
+
     /**
      * Server error
      *
@@ -985,6 +1024,18 @@ class Action extends HTMLOutputter // lawsuit
      */
 
     function selfUrl()
+    {
+        list($action, $args) = $this->returnToArgs();
+        return common_local_url($action, $args);
+    }
+
+    /**
+     * Returns arguments sufficient for re-constructing URL
+     *
+     * @return array two elements: action, other args
+     */
+
+    function returnToArgs()
     {
         $action = $this->trimmed('action');
         $args   = $this->args;
@@ -998,8 +1049,7 @@ class Action extends HTMLOutputter // lawsuit
         foreach (array_keys($_COOKIE) as $cookie) {
             unset($args[$cookie]);
         }
-
-        return common_local_url($action, $args);
+        return array($action, $args);
     }
 
     /**