Backport changes from trunk up to r5164
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Fallback to mail_domain in LDAP variable replacements; add 'host' to 'user_create' hook arguments (#1488024) |
| | | - Fixed wrong vCard type parameter mobile (#1488067) |
| | | - Fixed vCard WORKFAX issue (#1488046) |
| | | - Add vCard's Profile URL support (#1488062) |
| | | - Fix imap_cache setting to values other than 'db' (#1488060) |
| | | - Fix handling of attachments inside message/rfc822 parts (#1488026) |
| | | - Make list of mimetypes that open in preview window configurable (#1487625) |
| | |
| | | // check referer of incoming requests |
| | | $rcmail_config['referer_check'] = false; |
| | | |
| | | // X-Frame-Options HTTP header value sent to prevent from Clickjacking. |
| | | // Possible values: sameorigin|deny. Set to false in order to disable sending them |
| | | $rcmail_confoig['x_frame_options'] = 'sameorigin'; |
| | | |
| | | // this key is used to encrypt the users imap password which is stored |
| | | // in the session record (and the client cookie if remember password is enabled). |
| | | // please provide a string of exactly 24 chars. |
| | |
| | | <?php |
| | | |
| | | /* |
| | | +-------------------------------------------------------------------------+ |
| | | | Roundcube Webmail setup tool | |
| | | | Version 0.6 | |
| | | | | |
| | | | Copyright (C) 2009-2011, The Roundcube Dev Team | |
| | | | | |
| | | | This program is free software; you can redistribute it and/or modify | |
| | | | it under the terms of the GNU General Public License version 2 | |
| | | | as published by the Free Software Foundation. | |
| | | | | |
| | | | This program is distributed in the hope that it will be useful, | |
| | | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| | | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| | | | GNU General Public License for more details. | |
| | | | | |
| | | | You should have received a copy of the GNU General Public License along | |
| | | | with this program; if not, write to the Free Software Foundation, Inc., | |
| | | | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
| | | | | |
| | | +-------------------------------------------------------------------------+ |
| | | | Author: Thomas Bruederli <roundcube@gmail.com> | |
| | | +-------------------------------------------------------------------------+ |
| | | |
| | | $Id$ |
| | | |
| | | */ |
| | | |
| | | ini_set('error_reporting', E_ALL&~E_NOTICE); |
| | | ini_set('display_errors', 1); |
| | | |
| | |
| | | | rcube_install.php | |
| | | | | |
| | | | This file is part of the Roundcube Webmail package | |
| | | | Copyright (C) 2008-2009, The Roundcube Dev Team | |
| | | | Copyright (C) 2008-2011, The Roundcube Dev Team | |
| | | | Licensed under the GNU Public License | |
| | | +-----------------------------------------------------------------------+ |
| | | |
| | |
| | | */ |
| | | function _load_config($suffix) |
| | | { |
| | | @include RCMAIL_CONFIG_DIR . '/main.inc' . $suffix; |
| | | if (is_array($rcmail_config)) { |
| | | $this->config += $rcmail_config; |
| | | if (is_readable($main_inc = RCMAIL_CONFIG_DIR . '/main.inc' . $suffix)) { |
| | | include($main_inc); |
| | | if (is_array($rcmail_config)) |
| | | $this->config += $rcmail_config; |
| | | } |
| | | |
| | | @include RCMAIL_CONFIG_DIR . '/db.inc'. $suffix; |
| | | if (is_array($rcmail_config)) { |
| | | $this->config += $rcmail_config; |
| | | if (is_readable($db_inc = RCMAIL_CONFIG_DIR . '/db.inc'. $suffix)) { |
| | | include($db_inc); |
| | | if (is_array($rcmail_config)) |
| | | $this->config += $rcmail_config; |
| | | } |
| | | } |
| | | |
| | |
| | | /* |
| | | +-------------------------------------------------------------------------+ |
| | | | Roundcube Webmail IMAP Client | |
| | | | Version 0.3-20090702 | |
| | | | Version 0.6 | |
| | | | | |
| | | | Copyright (C) 2005-2009, The Roundcube Dev Team | |
| | | | Copyright (C) 2005-2011, The Roundcube Dev Team | |
| | | | | |
| | | | This program is free software; you can redistribute it and/or modify | |
| | | | it under the terms of the GNU General Public License version 2 | |
| | |
| | | $rci = rcube_install::get_instance(); |
| | | $rci->raise_error($p); |
| | | } |
| | | |
| | | /** |
| | | * Local callback function for PEAR errors |
| | | */ |
| | | function rcube_pear_error($err) |
| | | { |
| | | raise_error(array( |
| | | 'code' => $err->getCode(), |
| | | 'message' => $err->getMessage(), |
| | | )); |
| | | } |
| | | |
| | | // set PEAR error handling (will also load the PEAR main class) |
| | | PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error'); |
| | |
| | | * |
| | | * This plugin requires that a working public_ldap directory be configured. |
| | | * |
| | | * @version 1.02 |
| | | * @version 1.05 |
| | | * @author Kris Steinhoff |
| | | * |
| | | * Example configuration: |
| | |
| | | { |
| | | $rcmail = rcmail::get_instance(); |
| | | |
| | | if ($this->init_ldap()) { |
| | | if ($this->init_ldap($args['host'])) { |
| | | $results = $this->ldap->search('*', $args['user'], TRUE); |
| | | if (count($results->records) == 1) { |
| | | $args['user_name'] = $results->records[0]['name']; |
| | |
| | | return $args; |
| | | } |
| | | |
| | | private function init_ldap() |
| | | private function init_ldap($host) |
| | | { |
| | | if ($this->ldap) |
| | | return $this->ldap->ready; |
| | |
| | | $this->ldap = new new_user_identity_ldap_backend( |
| | | $ldap_config[$addressbook], |
| | | $rcmail->config->get('ldap_debug'), |
| | | $rcmail->config->mail_domain($_SESSION['imap_host']), |
| | | $rcmail->config->mail_domain($host), |
| | | $match); |
| | | |
| | | return $this->ldap->ready; |
| | |
| | | |
| | | class new_user_identity_ldap_backend extends rcube_ldap |
| | | { |
| | | function __construct($p, $debug=false, $mail_domain=NULL, $search=null) |
| | | function __construct($p, $debug, $mail_domain, $search) |
| | | { |
| | | parent::__construct($p, $debug, $mail_domain); |
| | | $this->prop['search_fields'] = (array)$search; |
| | |
| | | } |
| | | |
| | | // Get the pieces needed for variable replacement. |
| | | $fu = $RCMAIL->user->get_username(); |
| | | list($u, $d) = explode('@', $fu); |
| | | if ($fu = $RCMAIL->user->get_username()) |
| | | list($u, $d) = explode('@', $fu); |
| | | else |
| | | $d = $this->mail_domain; |
| | | |
| | | $dc = 'dc='.strtr($d, array('.' => ',dc=')); // hierarchal domain string |
| | | |
| | | $replaces = array('%dc' => $dc, '%d' => $d, '%fu' => $fu, '%u' => $u); |
| | |
| | | // make sure all <form> tags have a valid request token |
| | | $template = preg_replace_callback('/<form\s+([^>]+)>/Ui', array($this, 'alter_form_tag'), $template); |
| | | $this->footer = preg_replace_callback('/<form\s+([^>]+)>/Ui', array($this, 'alter_form_tag'), $this->footer); |
| | | |
| | | // send clickjacking protection headers |
| | | $iframe = $this->framed || !empty($_REQUEST['_framed']); |
| | | if (!headers_sent() && ($xframe = $this->app->config->get('x_frame_options', 'sameorigin'))) |
| | | header('X-Frame-Options: ' . ($iframe && $xframe == 'deny' ? 'sameorigin' : $xframe)); |
| | | |
| | | // call super method |
| | | parent::write($template, $this->config['skin_path']); |
| | |
| | | } |
| | | |
| | | $data = $rcmail->plugins->exec_hook('user_create', |
| | | array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email)); |
| | | array('user'=>$user, 'user_name'=>$user_name, 'user_email'=>$user_email, 'host'=>$host)); |
| | | |
| | | // plugin aborted this operation |
| | | if ($data['abort']) |
| | |
| | | 'spouse' => 'X-SPOUSE', |
| | | 'edit' => 'X-AB-EDIT', |
| | | ); |
| | | private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile'); |
| | | private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORKFAX'); |
| | | private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile', 'WORK,FAX' => 'workfax'); |
| | | private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORK,FAX'); |
| | | private $addresstypemap = array('BUSINESS' => 'WORK'); |
| | | private $immap = array('X-JABBER' => 'jabber', 'X-ICQ' => 'icq', 'X-MSN' => 'msn', 'X-AIM' => 'aim', 'X-YAHOO' => 'yahoo', 'X-SKYPE' => 'skype', 'X-SKYPE-USERNAME' => 'skype'); |
| | | |
| | |
| | | $subtype = ''; |
| | | |
| | | if (!empty($raw['type'])) { |
| | | $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]); |
| | | $combined = join(',', self::array_filter((array)$raw['type'], 'internet,pref', true)); |
| | | $subtype = $typemap[$combined] ? $typemap[$combined] : ($typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k])); |
| | | while ($k < count($raw['type']) && ($subtype == 'internet' || $subtype == 'pref')) |
| | | $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]); |
| | | } |
| | |
| | | public function set($field, $value, $type = 'HOME') |
| | | { |
| | | $field = strtolower($field); |
| | | $type = strtoupper($type); |
| | | $type_uc = strtoupper($type); |
| | | $typemap = array_flip($this->typemap); |
| | | |
| | | switch ($field) { |
| | |
| | | break; |
| | | |
| | | case 'email': |
| | | $this->raw['EMAIL'][] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type))); |
| | | $this->raw['EMAIL'][] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type_uc))); |
| | | $this->email[] = $value; |
| | | break; |
| | | |
| | |
| | | break; |
| | | |
| | | case 'address': |
| | | if ($this->addresstypemap[$type]) |
| | | $type = $this->addresstypemap[$type]; |
| | | if ($this->addresstypemap[$type_uc]) |
| | | $type = $this->addresstypemap[$type_uc]; |
| | | |
| | | $value = $value[0] ? $value : array('', '', $value['street'], $value['locality'], $value['region'], $value['zipcode'], $value['country']); |
| | | |
| | |
| | | break; |
| | | |
| | | default: |
| | | if ($field == 'phone' && $this->phonetypemap[$type]) |
| | | $type = $this->phonetypemap[$type]; |
| | | if ($field == 'phone' && $this->phonetypemap[$type_uc]) |
| | | $type = $this->phonetypemap[$type_uc]; |
| | | |
| | | if (($tag = self::$fieldmap[$field]) && (is_array($value) || strlen($value))) { |
| | | $index = count($this->raw[$tag]); |
| | | $this->raw[$tag][$index] = (array)$value; |
| | | if ($type) |
| | | $this->raw[$tag][$index]['type'] = array(($typemap[$type] ? $typemap[$type] : $type)); |
| | | $this->raw[$tag][$index]['type'] = explode(',', ($typemap[$type] ? $typemap[$type] : $type)); |
| | | } |
| | | break; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Extract array values by a filter |
| | | * |
| | | * @param array Array to filter |
| | | * @param keys Array or comma separated list of values to keep |
| | | * @param boolean Invert key selection: remove the listed values |
| | | * @return array The filtered array |
| | | */ |
| | | private static function array_filter($arr, $values, $inverse = false) |
| | | { |
| | | if (!is_array($values)) |
| | | $values = explode(',', $values); |
| | | |
| | | $result = array(); |
| | | $keep = array_flip((array)$values); |
| | | foreach ($arr as $key => $val) |
| | | if ($inverse != isset($keep[strtolower($val)])) |
| | | $result[$key] = $val; |
| | | |
| | | return $result; |
| | | } |
| | | |
| | | /** |
| | | * Returns UNICODE type based on BOM (Byte Order Mark) |
| | |
| | | // reset quicksearch |
| | | case 'reset-search': |
| | | var n, s = this.env.search_request || this.env.qsearch; |
| | | |
| | | this.reset_qsearch(); |
| | | this.select_all_mode = false; |
| | | |
| | | if (s && this.env.mailbox) |
| | | this.list_mailbox(this.env.mailbox); |
| | |
| | | this.drag_menu = function(e, target) |
| | | { |
| | | var modkey = rcube_event.get_modifier(e), |
| | | menu = $('#'+this.gui_objects.message_dragmenu); |
| | | menu = this.gui_objects.message_dragmenu; |
| | | |
| | | if (menu && modkey == SHIFT_KEY && this.commands['copy']) { |
| | | var pos = rcube_event.get_mouse_pos(e); |
| | | this.env.drag_target = target; |
| | | menu.css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'}).show(); |
| | | $(menu).css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'}).show(); |
| | | return true; |
| | | } |
| | | |
| | |
| | | |
| | | this.drag_menu_action = function(action) |
| | | { |
| | | var menu = $('#'+this.gui_objects.message_dragmenu); |
| | | var menu = this.gui_objects.message_dragmenu; |
| | | if (menu) { |
| | | menu.hide(); |
| | | $(menu).hide(); |
| | | } |
| | | this.command(action, this.env.drag_target); |
| | | this.env.drag_target = null; |
| | |
| | | $labels['typevideo'] = 'Video'; |
| | | $labels['typeassistant'] = 'Assistant'; |
| | | $labels['typehomepage'] = 'Home Page'; |
| | | $labels['typeblog'] = 'Blog'; |
| | | $labels['typeprofile'] = 'Profile'; |
| | | |
| | | $labels['addfield'] = 'Add field...'; |
| | | $labels['addcontact'] = 'Add new contact'; |
| | |
| | | $labels['typevideo'] = 'Wideo'; |
| | | $labels['typeassistant'] = 'Asystent'; |
| | | $labels['typehomepage'] = 'Strona domowa'; |
| | | $labels['typeblog'] = 'Blog'; |
| | | $labels['typeprofile'] = 'Profil'; |
| | | $labels['addfield'] = 'Dodaj pole...'; |
| | | $labels['personalinfo'] = 'Informacje osobiste'; |
| | | $labels['addphoto'] = 'Dodaj'; |
| | |
| | | ), 'category' => 'main'), |
| | | 'birthday' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => rcube_label('birthday'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), |
| | | 'anniversary' => array('type' => 'date', 'size' => 12, 'maxlength' => 16, 'label' => rcube_label('anniversary'), 'limit' => 1, 'render_func' => 'rcmail_format_date_col', 'category' => 'personal'), |
| | | 'website' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('website'), 'subtypes' => array('homepage','work','blog','other'), 'category' => 'main'), |
| | | 'website' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('website'), 'subtypes' => array('homepage','work','blog','profile','other'), 'category' => 'main'), |
| | | 'im' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'label' => rcube_label('instantmessenger'), 'subtypes' => array('aim','icq','msn','yahoo','jabber','skype','other'), 'category' => 'main'), |
| | | 'notes' => array('type' => 'textarea', 'size' => 40, 'rows' => 15, 'maxlength' => 500, 'label' => rcube_label('notes'), 'limit' => 1), |
| | | 'photo' => array('type' => 'image', 'limit' => 1, 'category' => 'main'), |