| | |
| | | } |
| | | |
| | | // 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; |
| | | } |
| | |
| | | // 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); |
| | | } |