diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 8d0fc1c11..1122152b5 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -50,6 +50,8 @@ class rcmail extends rcube public $action = ''; public $comm_path = './'; public $filename = ''; + public $default_skin; + public $login_error; private $address_books = array(); private $action_map = array(); @@ -207,10 +209,12 @@ class rcmail extends rcube { $contacts = null; $ldap_config = (array)$this->config->get('ldap_public'); + $default = false; // 'sql' is the alias for '0' used by autocomplete - if ($id == 'sql') + if ($id == 'sql') { $id = '0'; + } else if ($id == -1) { $id = $this->config->get('default_addressbook'); $default = true; @@ -559,17 +563,20 @@ class rcmail extends rcube // parse $host URL $a_host = parse_url($host); - if ($a_host['host']) { + $ssl = false; + if (!empty($a_host['host'])) { $host = $a_host['host']; $ssl = (isset($a_host['scheme']) && in_array($a_host['scheme'], array('ssl','imaps','tls'))) ? $a_host['scheme'] : null; - if (!empty($a_host['port'])) + if (!empty($a_host['port'])) { $port = $a_host['port']; - else if ($ssl && $ssl != 'tls' && (!$default_port || $default_port == 143)) + } + else if ($ssl && $ssl != 'tls' && (!$default_port || $default_port == 143)) { $port = 993; + } } - if (!$port) { + if (empty($port)) { $port = $default_port; } @@ -941,12 +948,13 @@ class rcmail extends rcube if (function_exists('memory_get_usage')) { $mem = round(memory_get_usage() / 1024 /1024, 1); - } - if (function_exists('memory_get_peak_usage')) { - $mem .= '/'. round(memory_get_peak_usage() / 1024 / 1024, 1); + + if (function_exists('memory_get_peak_usage')) { + $mem .= '/'. round(memory_get_peak_usage() / 1024 / 1024, 1); + } } - $log = $this->task . ($this->action ? '/'.$this->action : '') . ($mem ? " [$mem]" : ''); + $log = $this->task . ($this->action ? '/'.$this->action : '') . (isset($mem) ? " [$mem]" : ''); if (defined('RCMAIL_START')) { self::print_timer(RCMAIL_START, $log); @@ -1336,10 +1344,12 @@ class rcmail extends rcube // strftime() format if (preg_match('/%[a-z]+/i', $format)) { $format = strftime($format, $timestamp); - if ($stz) { + + if (isset($stz)) { date_default_timezone_set($stz); } - return $today ? ($this->gettext('today') . ' ' . $format) : $format; + + return !empty($today) ? ($this->gettext('today') . ' ' . $format) : $format; } // parse format string manually in order to provide localized weekday and month names @@ -1378,7 +1388,7 @@ class rcmail extends rcube } } - if ($today) { + if (!empty($today)) { $label = $this->gettext('today'); // replcae $ character with "Today" label (#1486120) if (strpos($out, '$') !== false) { @@ -1389,7 +1399,7 @@ class rcmail extends rcube } } - if ($stz) { + if (isset($stz)) { date_default_timezone_set($stz); } @@ -1423,13 +1433,13 @@ class rcmail extends rcube // get current folder $storage = $this->get_storage(); $mbox_name = $storage->get_folder(); + $delimiter = $storage->get_hierarchy_delimiter(); // build the folders tree if (empty($a_mailboxes)) { // get mailbox list $a_folders = $storage->list_folders_subscribed( '', $attrib['folder_name'], $attrib['folder_filter']); - $delimiter = $storage->get_hierarchy_delimiter(); $a_mailboxes = array(); foreach ($a_folders as $folder) { @@ -1461,6 +1471,7 @@ class rcmail extends rcube $out = $select->show($attrib['default']); } else { + $out = ''; $js_mailboxlist = array(); $tree = $this->render_folder_tree_html($a_mailboxes, $mbox_name, $js_mailboxlist, $attrib); @@ -2028,7 +2039,7 @@ class rcmail extends rcube $params['prefix'] = false; } - if ($error) { + if (!empty($error)) { if ($suffix && $this->text_exists($error . $suffix)) { $error .= $suffix; } @@ -2296,7 +2307,7 @@ class rcmail extends rcube if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) { $mimetype = 'image/' . $imgtype; - if ($orig_name) { + if (!empty($orig_name)) { unlink($orig_name); } } diff --git a/program/include/rcmail_install.php b/program/include/rcmail_install.php index ebd23417d..8d80fb113 100644 --- a/program/include/rcmail_install.php +++ b/program/include/rcmail_install.php @@ -31,6 +31,8 @@ class rcmail_install public $is_post = false; public $failures = 0; public $config = array(); + public $defaults = array(); + public $comments = array(); public $configured = false; public $legacy_config = false; public $email_pattern = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9])'; @@ -133,6 +135,9 @@ class rcmail_install return; } + $config = array(); + $rcmail_config = array(); // deprecated var name + include $file; // read comments from config file @@ -158,12 +163,7 @@ class rcmail_install } } - // deprecated name of config variable - if (is_array($rcmail_config)) { - return $rcmail_config; - } - - return $config; + return array_merge(array(), (array) $rcmail_config, (array) $config); } /** @@ -507,9 +507,10 @@ class rcmail_install */ private function db_read_schema($schemafile, &$version = null) { - $lines = file($schemafile); - $schema = array(); - $keywords = array('PRIMARY','KEY','INDEX','UNIQUE','CONSTRAINT','REFERENCES','FOREIGN'); + $lines = file($schemafile); + $schema = array(); + $keywords = array('PRIMARY','KEY','INDEX','UNIQUE','CONSTRAINT','REFERENCES','FOREIGN'); + $table_name = null; foreach ($lines as $line) { if (preg_match('/^\s*create table ([\S]+)/i', $line, $m)) { diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 2a820e42e..4c995dc6f 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -694,6 +694,7 @@ EOF; { $plugin = false; $realname = $name; + $skin_dir = ''; $plugin_skin_paths = array(); $this->template_name = $realname; @@ -804,6 +805,7 @@ EOF; { $out = ''; $parent_commands = 0; + $parent_prefix = ''; $top_commands = array(); // these should be always on top, @@ -1439,7 +1441,7 @@ EOF; $key = 'name'; $param = 'content'; } - else if ($object == 'links') { + else { $source = 'link_tags'; $tag = 'link'; $key = 'rel'; @@ -1719,6 +1721,8 @@ EOF; } $out = ''; + $btn_content = null; + $link_attrib = array(); // generate image tag if ($attrib['type'] == 'image') { @@ -1776,7 +1780,7 @@ EOF; $out = html::tag($attrib['wrapper'], null, $out); } - if ($menuitem) { + if (!empty($menuitem)) { $class = $attrib['menuitem-class'] ? ' class="' . $attrib['menuitem-class'] . '"' : ''; $out = '
  • ' . $out . '
  • '; } @@ -1967,7 +1971,7 @@ EOF; } // add css files in head, before scripts, for speed up with parallel downloads - if (!empty($this->css_files) && !$is_empty + if (!empty($this->css_files) && empty($is_empty) && (($pos = stripos($output, '