From c965c8abe1aa55a70844e2c95de9bb8d8293e9eb Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 14 Aug 2012 09:10:50 -0400
Subject: [PATCH] Merge branch 'master' of github.com:roundcube/roundcubemail

---
 program/include/rcube_output_html.php |   84 +++++++++++++++++++++++++++++------------
 1 files changed, 59 insertions(+), 25 deletions(-)

diff --git a/program/include/rcube_output_html.php b/program/include/rcube_output_html.php
index 237bc81..0a8f0e3 100644
--- a/program/include/rcube_output_html.php
+++ b/program/include/rcube_output_html.php
@@ -17,10 +17,7 @@
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
-
- $Id$
-
- */
+*/
 
 
 /**
@@ -71,7 +68,9 @@
         $this->set_env('x_frame_options', $this->config->get('x_frame_options', 'sameorigin'));
 
         // load the correct skin (in case user-defined)
-        $this->set_skin($this->config->get('skin'));
+        $skin = $this->config->get('skin');
+        $this->set_skin($skin);
+        $this->set_env('skin', $skin);
 
         // add common javascripts
         $this->add_script('var '.rcmail::JS_OBJECT_NAME.' = new rcube_webmail();', 'head_top');
@@ -150,7 +149,7 @@
         else {
             $skin_path = $this->config->get('skin_path');
             if (!$skin_path) {
-                $skin_path = 'skins/default';
+                $skin_path = 'skins/' . rcube_config::DEFAULT_SKIN;
             }
             $valid = !$skin;
         }
@@ -697,10 +696,31 @@
             // show a label
             case 'label':
                 if ($attrib['name'] || $attrib['command']) {
+                    // @FIXME: 'noshow' is useless, remove?
+                    if ($attrib['noshow']) {
+                        return '';
+                    }
+
                     $vars = $attrib + array('product' => $this->config->get('product_name'));
                     unset($vars['name'], $vars['command']);
-                    $label = $this->app->gettext($attrib + array('vars' => $vars));
-                    return !$attrib['noshow'] ? (get_boolean((string)$attrib['html']) ? $label : html::quote($label)) : '';
+
+                    $label   = $this->app->gettext($attrib + array('vars' => $vars));
+                    $quoting = !empty($attrib['quoting']) ? strtolower($attrib['quoting']) : (get_boolean((string)$attrib['html']) ? 'no' : '');
+
+                    switch ($quoting) {
+                        case 'no':
+                        case 'raw':
+                            break;
+                        case 'javascript':
+                        case 'js':
+                            $label = rcmail::JQ($label);
+                            break;
+                        default:
+                            $label = html::quote($label);
+                            break;
+                    }
+
+                    return $label;
                 }
                 break;
 
@@ -769,6 +789,13 @@
                     if (is_file(INSTALL_PATH . '.svn/entries')) {
                         if (preg_match('/Revision:\s(\d+)/', @shell_exec('svn info'), $regs))
                           $ver .= ' [SVN r'.$regs[1].']';
+                    }
+                    else if (is_file(INSTALL_PATH . '.git/index')) {
+                        if (preg_match('/Date:\s+([^\n]+)/', @shell_exec('git log -1'), $regs)) {
+                            if ($date = date('Ymd.Hi', strtotime($regs[1]))) {
+                                $ver .= ' [GIT '.$date.']';
+                            }
+                        }
                     }
                     $content = html::quote($ver);
                 }
@@ -929,7 +956,7 @@
             // make valid href to specific buttons
             if (in_array($attrib['command'], rcmail::$main_tasks)) {
                 $attrib['href']    = $this->app->url(array('task' => $attrib['command']));
-                $attrib['onclick'] = sprintf("%s.command('switch-task','%s');return false", rcmail::JS_OBJECT_NAME, $attrib['command']);
+                $attrib['onclick'] = sprintf("%s.command('switch-task','%s',null,event); return false", rcmail::JS_OBJECT_NAME, $attrib['command']);
             }
             else if ($attrib['task'] && in_array($attrib['task'], rcmail::$main_tasks)) {
                 $attrib['href'] = $this->app->url(array('action' => $attrib['command'], 'task' => $attrib['task']));
@@ -952,7 +979,7 @@
         }
         else if ($command && !$attrib['onclick']) {
             $attrib['onclick'] = sprintf(
-                "return %s.command('%s','%s',this)",
+                "return %s.command('%s','%s',this,event)",
                 rcmail::JS_OBJECT_NAME,
                 $command,
                 $attrib['prop']
@@ -1225,21 +1252,21 @@
      */
     protected function file_callback($matches)
     {
-	    $file = $matches[3];
+        $file = $matches[3];
 
         // correct absolute paths
-	    if ($file[0] == '/') {
-	        $file = $this->base_path . $file;
+        if ($file[0] == '/') {
+            $file = $this->base_path . $file;
         }
 
         // add file modification timestamp
-	    if (preg_match('/\.(js|css)$/', $file)) {
+        if (preg_match('/\.(js|css)$/', $file)) {
             if ($fs = @filemtime($file)) {
                 $file .= '?s=' . $fs;
             }
         }
 
-	    return $matches[1] . '=' . $matches[2] . $file . $matches[4];
+        return $matches[1] . '=' . $matches[2] . $file . $matches[4];
     }
 
 
@@ -1350,6 +1377,9 @@
         $url = rcube_utils::get_input_value('_url', rcube_utils::INPUT_POST);
         if (empty($url) && !preg_match('/_(task|action)=logout/', $_SERVER['QUERY_STRING']))
             $url = $_SERVER['QUERY_STRING'];
+
+        // Disable autocapitalization on iPad/iPhone (#1488609)
+        $attrib['autocapitalize'] = 'off';
 
         // set atocomplete attribute
         $user_attrib = $autocomplete > 0 ? array() : array('autocomplete' => 'off');
@@ -1481,7 +1511,7 @@
         if (empty($attrib['form'])) {
             $out = $this->form_tag(array(
                 'name' => "rcmqsearchform",
-                'onsubmit' => rcmail::JS_OBJECT_NAME . ".command('search');return false;",
+                'onsubmit' => rcmail::JS_OBJECT_NAME . ".command('search'); return false",
                 'style' => "display:inline"),
                 $out);
         }
@@ -1560,16 +1590,20 @@
             'GB2312'       => 'GB2312 ('.$this->app->gettext('chinese').')',
         );
 
-        if (!empty($_POST['_charset']))
-	        $set = $_POST['_charset'];
-	    else if (!empty($attrib['selected']))
-	        $set = $attrib['selected'];
-	    else
-	        $set = $this->get_charset();
+        if (!empty($_POST['_charset'])) {
+            $set = $_POST['_charset'];
+        }
+        else if (!empty($attrib['selected'])) {
+            $set = $attrib['selected'];
+        }
+        else {
+            $set = $this->get_charset();
+        }
 
-	    $set = strtoupper($set);
-	    if (!isset($charsets[$set]))
-	        $charsets[$set] = $set;
+        $set = strtoupper($set);
+        if (!isset($charsets[$set])) {
+            $charsets[$set] = $set;
+        }
 
         $select = new html_select($field_attrib);
         $select->add(array_values($charsets), array_keys($charsets));

--
Gitblit v1.9.1