]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/designadminpanel.php
Merge branch 'master' of gitorious.org:statusnet/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / designadminpanel.php
index 4285f7d7310b9a0c8b0454231bbe6be1472dc6f4..321a8ee5ebcfad1dcb65e52b59acbaa915851944 100644 (file)
@@ -120,8 +120,11 @@ class DesignadminpanelAction extends AdminPanelAction
             && empty($_POST)
             && ($_SERVER['CONTENT_LENGTH'] > 0)
         ) {
-            $msg = _('The server was unable to handle that much POST ' .
-                'data (%s bytes) due to its current configuration.');
+            // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
+            // TRANS: %s is the number of bytes of the CONTENT_LENGTH.
+            $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
+                      'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
+                      intval($_SERVER['CONTENT_LENGTH']));
             $this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
             return;
         }
@@ -140,7 +143,7 @@ class DesignadminpanelAction extends AdminPanelAction
             $themeChanged = ($this->trimmed('theme') != $oldtheme);
         }
 
-        static $settings = array('theme', 'logo');
+        static $settings = array('theme', 'logo', 'ssllogo');
 
         $values = array();
 
@@ -230,6 +233,7 @@ class DesignadminpanelAction extends AdminPanelAction
     function restoreDefaults()
     {
         $this->deleteSetting('site', 'logo');
+        $this->deleteSetting('site', 'ssllogo');
         $this->deleteSetting('site', 'theme');
 
         $settings = array(
@@ -257,8 +261,8 @@ class DesignadminpanelAction extends AdminPanelAction
     function saveBackgroundImage()
     {
         $filename = null;
-
-        if ($_FILES['design_background-image_file']['error'] ==
+        if (isset($_FILES['design_background-image_file']['error']) &&
+            $_FILES['design_background-image_file']['error'] ==
             UPLOAD_ERR_OK) {
 
             $filepath = null;
@@ -293,7 +297,7 @@ class DesignadminpanelAction extends AdminPanelAction
 
     /**
      * Save the custom theme if the user uploaded one.
-     * 
+     *
      * @return mixed custom theme name, if succesful, or null if no theme upload.
      * @throws ClientException for invalid theme archives
      * @throws ServerException if trouble saving the theme files
@@ -331,6 +335,11 @@ class DesignadminpanelAction extends AdminPanelAction
             $this->clientError(_('Invalid logo URL.'));
         }
 
+        if (!empty($values['ssllogo']) &&
+            !Validate::uri($values['ssllogo'], array('allowed_schemes' => array('https')))) {
+            $this->clientError(_('Invalid SSL logo URL.'));
+        }
+
         if (!in_array($values['theme'], Theme::listAvailable())) {
             $this->clientError(sprintf(_("Theme not available: %s."), $values['theme']));
         }
@@ -444,6 +453,10 @@ class DesignAdminPanelForm extends AdminForm
         $this->input('logo', _('Site logo'), 'Logo for the site (full URL)');
         $this->unli();
 
+        $this->li();
+        $this->input('ssllogo', _('SSL logo'), 'Logo to show on SSL pages');
+        $this->unli();
+
         $this->out->elementEnd('ul');
 
         $this->out->elementEnd('fieldset');