| | |
| | | | 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. | |
| | |
| | | * Application class of Roundcube Webmail |
| | | * implemented as singleton |
| | | * |
| | | * @package Core |
| | | * @package Webmail |
| | | */ |
| | | 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; |
| | |
| | | // fix some old settings according to namespace prefix |
| | | $this->fix_namespace_settings($user); |
| | | |
| | | // create default folders on login |
| | | if ($this->config->get('create_default_folders')) { |
| | | $storage->create_default_folders(); |
| | | } |
| | | // set/create special folders |
| | | $this->set_special_folders(); |
| | | |
| | | // clear all mailboxes related cache(s) |
| | | $storage->clear_cache('mailboxes', true); |
| | |
| | | } |
| | | } |
| | | |
| | | 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) { |
| | |
| | | $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 { |
| | |
| | | |
| | | $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); |
| | |
| | | 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); |
| | | } |