diff options
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/bc.php | 2 | ||||
-rw-r--r-- | program/include/iniset.php | 4 | ||||
-rw-r--r-- | program/include/rcmail.php | 104 | ||||
-rw-r--r-- | program/include/rcmail_html_page.php | 2 | ||||
-rw-r--r-- | program/include/rcmail_output.php | 2 | ||||
-rw-r--r-- | program/include/rcmail_output_html.php | 14 | ||||
-rw-r--r-- | program/include/rcmail_output_json.php | 2 | ||||
-rw-r--r-- | program/include/rcmail_string_replacer.php | 2 |
8 files changed, 70 insertions, 62 deletions
diff --git a/program/include/bc.php b/program/include/bc.php index a7d7b5ac1..2cb151798 100644 --- a/program/include/bc.php +++ b/program/include/bc.php @@ -22,7 +22,7 @@ /** * Roundcube Webmail deprecated functions * - * @package Core + * @package Webmail * @subpackage Legacy * @author Thomas Bruederli <roundcube@gmail.com> */ diff --git a/program/include/iniset.php b/program/include/iniset.php index f6ad466da..cb72ae15b 100644 --- a/program/include/iniset.php +++ b/program/include/iniset.php @@ -5,7 +5,7 @@ | program/include/iniset.php | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2008-2013, The Roundcube Dev Team | + | Copyright (C) 2008-2014, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -21,7 +21,7 @@ */ // application constants -define('RCMAIL_VERSION', '1.0-git'); +define('RCMAIL_VERSION', '1.1-git'); define('RCMAIL_START', microtime(true)); if (!defined('INSTALL_PATH')) { diff --git a/program/include/rcmail.php b/program/include/rcmail.php index a927b7946..7a6fb89ec 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -5,8 +5,8 @@ | program/include/rcmail.php | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2008-2013, The Roundcube Dev Team | - | Copyright (C) 2011-2013, Kolab Systems AG | + | Copyright (C) 2008-2014, The Roundcube Dev Team | + | Copyright (C) 2011-2014, Kolab Systems AG | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -25,7 +25,7 @@ * Application class of Roundcube Webmail * implemented as singleton * - * @package Core + * @package Webmail */ class rcmail extends rcube { @@ -157,12 +157,7 @@ class rcmail extends rcube */ public function set_user($user) { - if (is_object($user)) { - $this->user = $user; - - // overwrite config with user preferences - $this->config->set_user_prefs((array)$this->user->get_prefs()); - } + parent::set_user($user); $lang = $this->language_prop($this->config->get('language', $_SESSION['language'])); $_SESSION['language'] = $this->user->language = $lang; @@ -431,7 +426,7 @@ class rcmail extends rcube } // add some basic labels to client - $this->output->add_label('loading', 'servererror', 'requesttimedout', 'refreshing'); + $this->output->add_label('loading', 'servererror', 'connerror', 'requesttimedout', 'refreshing'); return $this->output; } @@ -492,17 +487,20 @@ class rcmail extends rcube return false; } - $config = $this->config->all(); + $default_host = $this->config->get('default_host'); + $default_port = $this->config->get('default_port'); + $username_domain = $this->config->get('username_domain'); + $login_lc = $this->config->get('login_lc', 2); if (!$host) { - $host = $config['default_host']; + $host = $default_host; } // Validate that selected host is in the list of configured hosts - if (is_array($config['default_host'])) { + if (is_array($default_host)) { $allowed = false; - foreach ($config['default_host'] as $key => $host_allowed) { + foreach ($default_host as $key => $host_allowed) { if (!is_numeric($key)) { $host_allowed = $key; } @@ -516,7 +514,7 @@ class rcmail extends rcube $host = null; } } - else if (!empty($config['default_host']) && $host != rcube_utils::parse_host($config['default_host'])) { + else if (!empty($default_host) && $host != rcube_utils::parse_host($default_host)) { $host = null; } @@ -533,23 +531,23 @@ class rcmail extends rcube if (!empty($a_host['port'])) $port = $a_host['port']; - else if ($ssl && $ssl != 'tls' && (!$config['default_port'] || $config['default_port'] == 143)) + else if ($ssl && $ssl != 'tls' && (!$default_port || $default_port == 143)) $port = 993; } if (!$port) { - $port = $config['default_port']; + $port = $default_port; } // Check if we need to add/force domain to username - if (!empty($config['username_domain'])) { - $domain = is_array($config['username_domain']) ? $config['username_domain'][$host] : $config['username_domain']; + if (!empty($username_domain)) { + $domain = is_array($username_domain) ? $username_domain[$host] : $username_domain; if ($domain = rcube_utils::parse_host((string)$domain, $host)) { $pos = strpos($username, '@'); // force configured domains - if (!empty($config['username_domain_forced']) && $pos !== false) { + if ($pos !== false && $this->config->get('username_domain_forced')) { $username = substr($username, 0, $pos) . '@' . $domain; } // just add domain if not specified @@ -559,14 +557,10 @@ class rcmail extends rcube } } - if (!isset($config['login_lc'])) { - $config['login_lc'] = 2; // default - } - // Convert username to lowercase. If storage backend // is case-insensitive we need to store always the same username (#1487113) - if ($config['login_lc']) { - if ($config['login_lc'] == 2 || $config['login_lc'] === true) { + if ($login_lc) { + if ($login_lc == 2 || $login_lc === true) { $username = mb_strtolower($username); } else if (strpos($username, '@')) { @@ -604,7 +598,7 @@ class rcmail extends rcube $user->touch(); } // create new system user - else if ($config['auto_create_user']) { + else if ($this->config->get('auto_create_user')) { if ($created = rcube_user::create($username, $host)) { $user = $created; } @@ -634,14 +628,6 @@ class rcmail extends rcube $this->set_user($user); $this->set_storage_prop(); - // fix some old settings according to namespace prefix - $this->fix_namespace_settings($user); - - // create default folders on first login - if ($config['create_default_folders'] && (!empty($created) || empty($user->data['last_login']))) { - $storage->create_default_folders(); - } - // set session vars $_SESSION['user_id'] = $user->ID; $_SESSION['username'] = $user->data['username']; @@ -655,7 +641,13 @@ class rcmail extends rcube $_SESSION['timezone'] = rcube_utils::get_input_value('_timezone', rcube_utils::INPUT_GPC); } - // force reloading complete list of subscribed mailboxes + // fix some old settings according to namespace prefix + $this->fix_namespace_settings($user); + + // set/create special folders + $this->set_special_folders(); + + // clear all mailboxes related cache(s) $storage->clear_cache('mailboxes', true); return true; @@ -933,14 +925,6 @@ class rcmail extends rcube } } - if (!empty($prefs['default_folders'])) { - foreach ($prefs['default_folders'] as $idx => $name) { - if ($name != 'INBOX' && !preg_match($regexp, $name)) { - $prefs['default_folders'][$idx] = $prefix.$name; - } - } - } - if (!empty($prefs['search_mods'])) { $folders = array(); foreach ($prefs['search_mods'] as $idx => $value) { @@ -1168,11 +1152,11 @@ class rcmail extends rcube $week_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']); $pretty_date = $this->config->get('prettydate'); - if ($pretty_date && $timestamp > $today_limit && $timestamp < $now) { + if ($pretty_date && $timestamp > $today_limit && $timestamp <= $now) { $format = $this->config->get('date_today', $this->config->get('time_format', 'H:i')); $today = true; } - else if ($pretty_date && $timestamp > $week_limit && $timestamp < $now) { + else if ($pretty_date && $timestamp > $week_limit && $timestamp <= $now) { $format = $this->config->get('date_short', 'D H:i'); } else { @@ -1361,12 +1345,31 @@ class rcmail extends rcube $delimiter = $storage->get_hierarchy_delimiter(); - foreach ($list as $folder) { - if (empty($p['exceptions']) || !in_array($folder, $p['exceptions'])) { - $this->build_folder_tree($a_mailboxes, $folder, $delimiter); + if (!empty($p['exceptions'])) { + $list = array_diff($list, (array) $p['exceptions']); + } + + if (!empty($p['additional'])) { + foreach ($p['additional'] as $add_folder) { + $add_items = explode($delimiter, $add_folder); + $folder = ''; + while (count($add_items)) { + $folder .= array_shift($add_items); + + // @TODO: sorting + if (!in_array($folder, $list)) { + $list[] = $folder; + } + + $folder .= $delimiter; + } } } + foreach ($list as $folder) { + $this->build_folder_tree($a_mailboxes, $folder, $delimiter); + } + $select = new html_select($p); if ($p['noselection']) { @@ -1633,14 +1636,13 @@ class rcmail extends rcube public function localize_folderpath($path) { $protect_folders = $this->config->get('protect_default_folders'); - $default_folders = (array) $this->config->get('default_folders'); $delimiter = $this->storage->get_hierarchy_delimiter(); $path = explode($delimiter, $path); $result = array(); foreach ($path as $idx => $dir) { $directory = implode($delimiter, array_slice($path, 0, $idx+1)); - if ($protect_folders && in_array($directory, $default_folders)) { + if ($protect_folders && $this->storage->is_special_folder($directory)) { unset($result); $result[] = $this->localize_foldername($directory); } diff --git a/program/include/rcmail_html_page.php b/program/include/rcmail_html_page.php index d5610ab47..604d756e7 100644 --- a/program/include/rcmail_html_page.php +++ b/program/include/rcmail_html_page.php @@ -23,7 +23,7 @@ /** * Class to create an empty HTML page with some default styles * - * @package Core + * @package Webmail * @subpackage View */ class rcmail_html_page extends rcmail_output_html diff --git a/program/include/rcmail_output.php b/program/include/rcmail_output.php index 36512ad48..0f7aaf966 100644 --- a/program/include/rcmail_output.php +++ b/program/include/rcmail_output.php @@ -22,7 +22,7 @@ /** * Class for output generation * - * @package Core + * @package Webmail * @subpackage View */ abstract class rcmail_output extends rcube_output diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index 4df755985..a23b8405e 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -23,7 +23,7 @@ /** * Class to create HTML page output using a skin template * - * @package Core + * @package Webmail * @subpackage View */ class rcmail_output_html extends rcmail_output @@ -1216,7 +1216,7 @@ class rcmail_output_html extends rcmail_output // generate html code for button if ($btn_content) { - $attrib_str = html::attrib_string($attrib, $link_attrib); + $attrib_str = html::attrib_string($attrib, array_merge($link_attrib, array('data-*'))); $out = sprintf('<a%s>%s</a>', $attrib_str, $btn_content); } @@ -1629,6 +1629,12 @@ class rcmail_output_html extends rcmail_output $out .= $input_host->show(); } + if (rcube_utils::get_boolean($attrib['submit'])) { + $submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit', + 'class' => 'button mainaction', 'value' => $this->app->gettext('login'))); + $out .= html::p('formbuttons', $submit->show()); + } + // surround html output with a form tag if (empty($attrib['form'])) { $out = $this->form_tag(array('name' => $form_name, 'method' => 'post'), $out); @@ -1691,9 +1697,9 @@ class rcmail_output_html extends rcmail_output // add form tag around text field if (empty($attrib['form'])) { $out = $this->form_tag(array( - 'name' => "rcmqsearchform", + 'name' => "rcmqsearchform", 'onsubmit' => self::JS_OBJECT_NAME . ".command('search'); return false", - 'style' => "display:inline"), + 'style' => "display:inline"), $out); } diff --git a/program/include/rcmail_output_json.php b/program/include/rcmail_output_json.php index d0e1eec64..fa35824db 100644 --- a/program/include/rcmail_output_json.php +++ b/program/include/rcmail_output_json.php @@ -23,7 +23,7 @@ /** * View class to produce JSON responses * - * @package Core + * @package Webmail * @subpackage View */ class rcmail_output_json extends rcmail_output diff --git a/program/include/rcmail_string_replacer.php b/program/include/rcmail_string_replacer.php index 6771375e1..d3fdc3e7f 100644 --- a/program/include/rcmail_string_replacer.php +++ b/program/include/rcmail_string_replacer.php @@ -23,7 +23,7 @@ * Helper class for turning URLs and email addresses in plaintext content * into clickable links. * - * @package Core + * @package Webmail * @subpackage Utils */ class rcmail_string_replacer extends rcube_string_replacer |