Changeset 5402 in subversion


Ignore:
Timestamp:
Nov 9, 2011 5:03:54 AM (19 months ago)
Author:
alec
Message:
  • Apply fixes from trunk up to r5401
Location:
branches/release-0.7
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • branches/release-0.7/CHANGELOG

    r5374 r5402  
    22=========================== 
    33 
     4- Make email recipients separator configurable 
     5- Fix so folders with \Noinferiors attribute aren't listed in parent selector 
     6- Fix handling of curly brackets in URLs (#1488168) 
     7- Fix handling of dates (birthday/anniversary) in contact data (#1488147) 
     8- Fix error on opening searched LDAP contact (#1488144) 
     9- Fix redundant line break in flowed format (#1488146) 
    410- Fix IDN address validation issue (#1488137) 
    511- Fix JS error when dst_active checkbox doesn't exist (#1488133) 
  • branches/release-0.7/config/main.inc.php.dist

    r5393 r5402  
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
    8  | Copyright (C) 2005-2010, The Roundcube Dev Team                       | 
     8 | Copyright (C) 2005-2011, The Roundcube Dev Team                       | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    460460// Makes that words with symbols will be ignored (e.g. g@@gle) 
    461461$rcmail_config['spellcheck_ignore_syms'] = false; 
     462 
     463// Use this char/string to separate recipients when composing a new message 
     464$rcmail_config['recipients_separator'] = ','; 
    462465 
    463466// don't let users set pagesize to more than this value if set 
  • branches/release-0.7/program/include/main.inc

    r5342 r5402  
    10191019 * This uses the date formatting properties from config 
    10201020 * 
    1021  * @param mixed Date representation (string or timestamp) 
     1021 * @param mixed  Date representation (string or timestamp) 
    10221022 * @param string Date format to use 
     1023 * @param bool   Enables date convertion according to user timezone 
     1024 * 
    10231025 * @return string Formatted date string 
    10241026 */ 
    1025 function format_date($date, $format=NULL) 
     1027function format_date($date, $format=NULL, $convert=true) 
    10261028{ 
    10271029  global $RCMAIL, $CONFIG; 
    1028    
    1029   $ts = NULL; 
    10301030 
    10311031  if (!empty($date)) 
     
    10351035    return ''; 
    10361036 
    1037   // get user's timezone offset 
    1038   $tz = $RCMAIL->config->get_timezone(); 
    1039  
    1040   // convert time to user's timezone 
    1041   $timestamp = $ts - date('Z', $ts) + ($tz * 3600); 
    1042  
    1043   // get current timestamp in user's timezone 
    1044   $now = time();  // local time 
    1045   $now -= (int)date('Z'); // make GMT time 
    1046   $now += ($tz * 3600); // user's time 
    1047   $now_date = getdate($now); 
    1048  
    1049   $today_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday'], $now_date['year']); 
    1050   $week_limit  = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']); 
     1037  if ($convert) { 
     1038    // get user's timezone offset 
     1039    $tz = $RCMAIL->config->get_timezone(); 
     1040 
     1041    // convert time to user's timezone 
     1042    $timestamp = $ts - date('Z', $ts) + ($tz * 3600); 
     1043 
     1044    // get current timestamp in user's timezone 
     1045    $now = time();  // local time 
     1046    $now -= (int)date('Z'); // make GMT time 
     1047    $now += ($tz * 3600); // user's time 
     1048  } 
     1049  else { 
     1050    $now       = time(); 
     1051    $timestamp = $ts; 
     1052  } 
    10511053 
    10521054  // define date format depending on current time 
    10531055  if (!$format) { 
     1056    $now_date    = getdate($now); 
     1057    $today_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday'], $now_date['year']); 
     1058    $week_limit  = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']); 
     1059 
    10541060    if ($CONFIG['prettydate'] && $timestamp > $today_limit && $timestamp < $now) { 
    10551061      $format = $RCMAIL->config->get('date_today', $RCMAIL->config->get('time_format', 'H:i')); 
     
    12271233    $select->add($p['noselection'], ''); 
    12281234 
    1229   rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p['exceptions']); 
     1235  rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames'], 0, $p); 
    12301236 
    12311237  return $select; 
     
    12761282 
    12771283  if (!isset($arrFolders[$currentFolder])) { 
    1278     // Check \Noselect option (if options are in cache) 
    1279     if (!$virtual && ($opts = $RCMAIL->imap->mailbox_options($path))) { 
    1280       $virtual = in_array('\\Noselect', $opts); 
     1284    // Check \Noselect attribute (if attributes are in cache) 
     1285    if (!$virtual && ($attrs = $RCMAIL->imap->mailbox_attributes($path))) { 
     1286      $virtual = in_array('\\Noselect', $attrs); 
    12811287    } 
    12821288 
     
    13971403 * @return string 
    13981404 */ 
    1399 function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0, $exceptions=array()) 
    1400 { 
     1405function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0, $opts=array()) 
     1406{ 
     1407  global $RCMAIL; 
     1408 
    14011409  $out = ''; 
    14021410 
    14031411  foreach ($arrFolders as $key => $folder) { 
    1404     if (empty($exceptions) || !in_array($folder['id'], $exceptions)) { 
    1405       if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) 
    1406         $foldername = rcube_label($folder_class); 
    1407       else { 
    1408         $foldername = $folder['name']; 
    1409  
    1410         // shorten the folder name to a given length 
    1411         if ($maxlength && $maxlength>1) 
    1412           $foldername = abbreviate_string($foldername, $maxlength); 
    1413       } 
    1414  
    1415       $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']); 
    1416     } 
    1417     else if ($nestLevel) 
     1412    // skip exceptions (and its subfolders) 
     1413    if (!empty($opts['exceptions']) && in_array($folder['id'], $opts['exceptions'])) { 
    14181414      continue; 
     1415    } 
     1416 
     1417    // skip folders in which it isn't possible to create subfolders 
     1418    if (!empty($opts['skip_noinferiors']) && ($attrs = $RCMAIL->imap->mailbox_attributes($folder['id'])) 
     1419        && in_array('\\Noinferiors', $attrs) 
     1420    ) { 
     1421      continue; 
     1422    } 
     1423 
     1424    if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id']))) 
     1425      $foldername = rcube_label($folder_class); 
     1426    else { 
     1427      $foldername = $folder['name']; 
     1428 
     1429      // shorten the folder name to a given length 
     1430      if ($maxlength && $maxlength>1) 
     1431        $foldername = abbreviate_string($foldername, $maxlength); 
     1432    } 
     1433 
     1434    $select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']); 
    14191435 
    14201436    if (!empty($folder['folders'])) 
    14211437      $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, 
    1422         $select, $realnames, $nestLevel+1, $exceptions); 
     1438        $select, $realnames, $nestLevel+1, $opts); 
    14231439  } 
    14241440 
  • branches/release-0.7/program/include/rcmail.php

    r5376 r5402  
    595595 
    596596    $this->imap = new rcube_imap(); 
    597     $this->imap->debug_level = $this->config->get('debug_level'); 
    598597    $this->imap->skip_deleted = $this->config->get('skip_deleted'); 
    599598 
  • branches/release-0.7/program/include/rcube_contacts.php

    r5328 r5402  
    4242    private $filter = null; 
    4343    private $result = null; 
    44     private $name; 
    4544    private $cache; 
    4645    private $table_cols = array('name', 'email', 'firstname', 'surname'); 
     
    5150    // public properties 
    5251    public $primary_key = 'contact_id'; 
     52    public $name; 
    5353    public $readonly = false; 
    5454    public $groups = true; 
  • branches/release-0.7/program/include/rcube_imap.php

    r5366 r5402  
    3333class rcube_imap 
    3434{ 
    35     public $debug_level = 1; 
    3635    public $skip_deleted = false; 
    3736    public $page_size = 10; 
     
    319318 
    320319    /** 
     320     * Activate/deactivate debug mode 
     321     * 
     322     * @param boolean $dbg True if IMAP conversation should be logged 
     323     * @access public 
     324     */ 
     325    function set_debug($dbg = true) 
     326    { 
     327        $this->options['debug'] = $dbg; 
     328        $this->conn->setDebug($dbg, array($this, 'debug_handler')); 
     329    } 
     330 
     331 
     332    /** 
    321333     * Set default message charset 
    322334     * 
     
    30763088    function list_unsubscribed($root='', $name='*', $filter=null, $rights=null, $skip_sort=false) 
    30773089    { 
    3078         // @TODO: caching 
     3090        $cache_key = $root.':'.$name; 
     3091        if (!empty($filter)) { 
     3092            $cache_key .= ':'.(is_string($filter) ? $filter : serialize($filter)); 
     3093        } 
     3094        $cache_key .= ':'.$rights; 
     3095        $cache_key = 'mailboxes.list.'.md5($cache_key); 
     3096 
     3097        // get cached folder list 
     3098        $a_mboxes = $this->get_cache($cache_key); 
     3099        if (is_array($a_mboxes)) { 
     3100            return $a_mboxes; 
     3101        } 
     3102 
    30793103        // Give plugins a chance to provide a list of mailboxes 
    30803104        $data = rcmail::get_instance()->plugins->exec_hook('mailboxes_list', 
     
    30983122        } 
    30993123 
     3124        // cache folder attributes 
     3125        if ($root == '' && $name == '*' && empty($filter)) { 
     3126            $this->update_cache('mailboxes.attributes', $this->conn->data['LIST']); 
     3127        } 
     3128 
    31003129        // filter folders list according to rights requirements 
    31013130        if ($rights && $this->get_capability('ACL')) { 
     
    31073136            $a_mboxes = $this->_sort_mailbox_list($a_mboxes); 
    31083137        } 
     3138 
     3139        // write mailboxlist to cache 
     3140        $this->update_cache($cache_key, $a_mboxes); 
    31093141 
    31103142        return $a_mboxes; 
     
    34393471 
    34403472    /** 
    3441      * Gets folder options from LIST response, e.g. \Noselect, \Noinferiors 
     3473     * Gets folder attributes from LIST response, e.g. \Noselect, \Noinferiors 
    34423474     * 
    34433475     * @param string $mailbox Folder name 
    3444      * @param bool   $force   Set to True if options should be refreshed 
    3445      *                        Options are available after LIST command only 
     3476     * @param bool   $force   Set to True if attributes should be refreshed 
    34463477     * 
    34473478     * @return array Options list 
    34483479     */ 
    3449     function mailbox_options($mailbox, $force=false) 
    3450     { 
    3451         if ($mailbox == 'INBOX') { 
    3452             return array(); 
    3453         } 
    3454  
    3455         if (!is_array($this->conn->data['LIST']) || !is_array($this->conn->data['LIST'][$mailbox])) { 
    3456             if ($force) { 
    3457                 $this->conn->listMailboxes('', $mailbox); 
    3458             } 
    3459             else { 
    3460                 return array(); 
    3461             } 
    3462         } 
    3463  
    3464         $opts = $this->conn->data['LIST'][$mailbox]; 
     3480    function mailbox_attributes($mailbox, $force=false) 
     3481    { 
     3482        // get attributes directly from LIST command 
     3483        if (!empty($this->conn->data['LIST']) && is_array($this->conn->data['LIST'][$mailbox])) { 
     3484            $opts = $this->conn->data['LIST'][$mailbox]; 
     3485        } 
     3486        // get cached folder attributes 
     3487        else if (!$force) { 
     3488            $opts = $this->get_cache('mailboxes.attributes'); 
     3489            $opts = $opts[$mailbox]; 
     3490        } 
     3491 
     3492        if (!is_array($opts)) { 
     3493            $this->conn->listMailboxes('', $mailbox); 
     3494            $opts = $this->conn->data['LIST'][$mailbox]; 
     3495        } 
    34653496 
    34663497        return is_array($opts) ? $opts : array(); 
     
    35453576        } 
    35463577 
    3547         $options['name']      = $mailbox; 
    3548         $options['options']   = $this->mailbox_options($mailbox, true); 
    3549         $options['namespace'] = $this->mailbox_namespace($mailbox); 
    3550         $options['rights']    = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); 
    3551         $options['special']   = in_array($mailbox, $this->default_folders); 
     3578        $options['name']       = $mailbox; 
     3579        $options['attributes'] = $this->mailbox_attributes($mailbox, true); 
     3580        $options['namespace']  = $this->mailbox_namespace($mailbox); 
     3581        $options['rights']     = $acl && !$options['is_root'] ? (array)$this->my_rights($mailbox) : array(); 
     3582        $options['special']    = in_array($mailbox, $this->default_folders); 
    35523583 
    35533584        // Set 'noselect' and 'norename' flags 
    3554         if (is_array($options['options'])) { 
    3555             foreach ($options['options'] as $opt) { 
    3556                 $opt = strtolower($opt); 
    3557                 if ($opt == '\noselect' || $opt == '\nonexistent') { 
     3585        if (is_array($options['attributes'])) { 
     3586            foreach ($options['attributes'] as $attrib) { 
     3587                $attrib = strtolower($attrib); 
     3588                if ($attrib == '\noselect' || $attrib == '\nonexistent') { 
    35583589                    $options['noselect'] = true; 
    35593590                } 
  • branches/release-0.7/program/include/rcube_imap_generic.php

    r5366 r5402  
    22432243 
    22442244        if ($code == self::ERROR_OK) { 
    2245             $folders = array(); 
    2246             while ($this->tokenizeResponse($response, 1) == '*') { 
    2247                 $cmd = strtoupper($this->tokenizeResponse($response, 1)); 
     2245            $folders  = array(); 
     2246            $last     = 0; 
     2247            $pos      = 0; 
     2248            $response .= "\r\n"; 
     2249 
     2250            while ($pos = strpos($response, "\r\n", $pos+1)) { 
     2251                // literal string, not real end-of-command-line 
     2252                if ($response[$pos-1] == '}') { 
     2253                    continue; 
     2254                } 
     2255 
     2256                $line = substr($response, $last, $pos - $last); 
     2257                $last = $pos + 2; 
     2258 
     2259                if (!preg_match('/^\* (LIST|LSUB|STATUS) /i', $line, $m)) { 
     2260                    continue; 
     2261                } 
     2262                $cmd  = strtoupper($m[1]); 
     2263                $line = substr($line, strlen($m[0])); 
     2264 
    22482265                // * LIST (<options>) <delimiter> <mailbox> 
    22492266                if ($cmd == 'LIST' || $cmd == 'LSUB') { 
    2250                     list($opts, $delim, $mailbox) = $this->tokenizeResponse($response, 3); 
     2267                    list($opts, $delim, $mailbox) = $this->tokenizeResponse($line, 3); 
    22512268 
    22522269                    // Add to result array 
     
    22592276 
    22602277                    // Add to options array 
    2261                     if (!empty($opts)) { 
    2262                         if (empty($this->data['LIST'][$mailbox])) 
    2263                             $this->data['LIST'][$mailbox] = $opts; 
    2264                         else 
    2265                             $this->data['LIST'][$mailbox] = array_unique(array_merge( 
    2266                                 $this->data['LIST'][$mailbox], $opts)); 
    2267                     } 
     2278                    if (empty($this->data['LIST'][$mailbox])) 
     2279                        $this->data['LIST'][$mailbox] = $opts; 
     2280                    else if (!empty($opts)) 
     2281                        $this->data['LIST'][$mailbox] = array_unique(array_merge( 
     2282                            $this->data['LIST'][$mailbox], $opts)); 
    22682283                } 
    22692284                // * STATUS <mailbox> (<result>) 
    22702285                else if ($cmd == 'STATUS') { 
    2271                     list($mailbox, $status) = $this->tokenizeResponse($response, 2); 
     2286                    list($mailbox, $status) = $this->tokenizeResponse($line, 2); 
    22722287 
    22732288                    for ($i=0, $len=count($status); $i<$len; $i += 2) { 
     
    22752290                        $folders[$mailbox][$name] = $value; 
    22762291                    } 
    2277                 } 
    2278                 // other untagged response line, skip it 
    2279                 else { 
    2280                     $response = ltrim($response); 
    2281                     if (($position = strpos($response, "\n")) !== false) 
    2282                         $response = substr($response, $position+1); 
    2283                     else 
    2284                         $response = ''; 
    22852292                } 
    22862293            } 
     
    33933400            // String atom, number, NIL, *, % 
    33943401            default: 
    3395                 // empty or one character 
    3396                 if ($str === '') { 
     3402                // empty string 
     3403                if ($str === '' || $str === null) { 
    33973404                    break 2; 
    3398                 } 
    3399                 if (strlen($str) < 2) { 
    3400                     $result[] = $str; 
    3401                     $str = ''; 
    3402                     break; 
    34033405                } 
    34043406 
  • branches/release-0.7/program/include/rcube_ldap.php

    r5393 r5402  
    13431343 
    13441344    /** 
     1345     * Activate/deactivate debug mode 
     1346     * 
     1347     * @param boolean $dbg True if LDAP commands should be logged 
     1348     * @access public 
     1349     */ 
     1350    function set_debug($dbg = true) 
     1351    { 
     1352        $this->debug = $dbg; 
     1353    } 
     1354 
     1355 
     1356    /** 
    13451357     * Quotes attribute value string 
    13461358     * 
  • branches/release-0.7/program/include/rcube_mdb2.php

    r4810 r5402  
    3636class rcube_mdb2 
    3737{ 
    38     var $db_dsnw;               // DSN for write operations 
    39     var $db_dsnr;               // DSN for read operations 
    40     var $db_connected = false;  // Already connected ? 
    41     var $db_mode = '';          // Connection mode 
    42     var $db_handle = 0;         // Connection handle 
    43     var $db_error = false; 
    44     var $db_error_msg = ''; 
     38    public $db_dsnw;               // DSN for write operations 
     39    public $db_dsnr;               // DSN for read operations 
     40    public $db_connected = false;  // Already connected ? 
     41    public $db_mode = '';          // Connection mode 
     42    public $db_handle = 0;         // Connection handle 
     43    public $db_error = false; 
     44    public $db_error_msg = ''; 
    4545 
    4646    private $debug_mode = false; 
    47     private $write_failure = false; 
     47    private $conn_failure = false; 
    4848    private $a_query_results = array('dummy'); 
    4949    private $last_res_id = 0; 
     
    5959    function __construct($db_dsnw, $db_dsnr='', $pconn=false) 
    6060    { 
    61         if ($db_dsnr == '') 
     61        if (empty($db_dsnr)) 
    6262            $db_dsnr = $db_dsnw; 
    6363 
     
    123123    function db_connect($mode) 
    124124    { 
     125        // previous connection failed, don't attempt to connect again 
     126        if ($this->conn_failure) { 
     127            return; 
     128        } 
     129 
     130        // no replication 
     131        if ($this->db_dsnw == $this->db_dsnr) { 
     132            $mode = 'w'; 
     133        } 
     134 
    125135        // Already connected 
    126136        if ($this->db_connected) { 
    127             // connected to read-write db, current connection is ok 
    128             if ($this->db_mode == 'w' && !$this->write_failure) 
    129                 return; 
    130  
    131             // no replication, current connection is ok for read and write 
    132             if (empty($this->db_dsnr) || $this->db_dsnw == $this->db_dsnr) { 
    133                 $this->db_mode = 'w'; 
     137            // connected to db with the same or "higher" mode 
     138            if ($this->db_mode == 'w' || $this->db_mode == $mode) { 
    134139                return; 
    135140            } 
    136  
    137             // Same mode, current connection is ok 
    138             if ($this->db_mode == $mode) 
    139                 return; 
    140141        } 
    141142 
    142143        $dsn = ($mode == 'r') ? $this->db_dsnr : $this->db_dsnw; 
    143144 
    144         $this->db_handle = $this->dsn_connect($dsn); 
     145        $this->db_handle    = $this->dsn_connect($dsn); 
    145146        $this->db_connected = !PEAR::isError($this->db_handle); 
    146147 
    147148        if ($this->db_connected) 
    148           $this->db_mode = $mode; 
     149            $this->db_mode = $mode; 
     150        else 
     151            $this->conn_failure = true; 
    149152    } 
    150153 
     
    256259        // Read or write ? 
    257260        $mode = (strtolower(substr(trim($query),0,6)) == 'select') ? 'r' : 'w'; 
    258  
    259         // don't event attempt to connect if previous write-operation failed 
    260         if ($this->write_failure && $mode == 'w') 
    261             return false; 
    262261 
    263262        $this->db_connect($mode); 
     
    285284                    'line' => __LINE__, 'file' => __FILE__, 
    286285                    'message' => $this->db_error_msg), true, false); 
    287                  
     286 
    288287                $result = false; 
    289288            } 
     
    293292            } 
    294293        } 
    295  
    296         // remember that write-operation failed 
    297         if ($mode == 'w' && ($result === false || PEAR::isError($result))) 
    298             $this->write_failure = true; 
    299294 
    300295        // add result, even if it's an error 
     
    448443            return $result; 
    449444        } 
    450          
     445 
    451446        return null; 
    452447    } 
     
    531526    function now() 
    532527    { 
    533         switch($this->db_provider) { 
     528        switch ($this->db_provider) { 
    534529            case 'mssql': 
    535530            case 'sqlsrv': 
  • branches/release-0.7/program/include/rcube_string_replacer.php

    r5198 r5402  
    4040    $utf_domain = '[^?&@"\'\\/()\s\r\t\n]+\\.([^\\x00-\\x2f\\x3b-\\x40\\x5b-\\x60\\x7b-\\x7f]{2,}|xn--[a-z0-9]{2,})'; 
    4141    $url1 = '.:;,'; 
    42     $url2 = 'a-z0-9%=#@+?&\\/_~\\[\\]-'; 
     42    $url2 = 'a-z0-9%=#@+?&\\/_~\\[\\]{}-'; 
    4343 
    4444    $this->link_pattern = "/([\w]+:\/\/|\Wwww\.)($utf_domain([$url1]?[$url2]+)*)/i"; 
  • branches/release-0.7/program/js/app.js

    r5343 r5402  
    2121function rcube_webmail() 
    2222{ 
    23   this.env = {}; 
     23  this.env = { recipients_separator:',', recipients_delimiter:', ' }; 
    2424  this.labels = {}; 
    2525  this.buttons = {}; 
     
    29272927  this.init_address_input_events = function(obj, props) 
    29282928  { 
     2929    this.env.recipients_delimiter = this.env.recipients_separator + ' '; 
     2930 
    29292931    obj[bw.ie || bw.safari || bw.chrome ? 'keydown' : 'keypress'](function(e) { return ref.ksearch_keydown(e, this, props); }) 
    29302932      .attr('autocomplete', 'off'); 
     
    35913593    // insert all members of a group 
    35923594    if (typeof this.env.contacts[id] === 'object' && this.env.contacts[id].id) { 
    3593       insert += this.env.contacts[id].name + ', '; 
     3595      insert += this.env.contacts[id].name + this.env.recipients_delimiter; 
    35943596      this.group2expand = $.extend({}, this.env.contacts[id]); 
    35953597      this.group2expand.input = this.ksearch_input; 
     
    35973599    } 
    35983600    else if (typeof this.env.contacts[id] === 'string') { 
    3599       insert = this.env.contacts[id] + ', '; 
     3601      insert = this.env.contacts[id] + this.env.recipients_delimiter; 
    36003602      trigger = true; 
    36013603    } 
     
    36343636    // get string from current cursor pos to last comma 
    36353637    var cpos = this.get_caret_pos(this.ksearch_input), 
    3636       p = inp_value.lastIndexOf(',', cpos-1), 
     3638      p = inp_value.lastIndexOf(this.env.recipients_separator, cpos-1), 
    36373639      q = inp_value.substring(p+1, cpos), 
    36383640      min = this.env.autocomplete_min_length, 
  • branches/release-0.7/program/steps/addressbook/func.inc

    r5350 r5402  
    620620                            } 
    621621                            $colprop['class'] .= ($colprop['class'] ? ' ' : '') . 'datepicker'; 
    622                             $val = format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d')); 
     622                            $val = format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false); 
    623623                        } 
    624624 
     
    729729{ 
    730730    global $RCMAIL; 
    731     return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d')); 
     731    return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false); 
    732732} 
    733733 
     
    759759        // if _source is not specified we'll find it from decoded ID 
    760760        if (!$got_source) { 
    761             list ($c, $s) = explode('-', $id, 2); 
    762             if (strlen($s)) { 
    763                 $result[(string)$s][] = $c; 
     761            if ($sep = strrpos($id, '-')) { 
     762                $contact_id = substr($id, 0, $sep); 
     763                $source_id  = substr($id, $sep+1); 
     764                if (strlen($source_id)) { 
     765                    $result[(string)$source_id][] = $contact_id; 
     766                } 
    764767            } 
    765768        } 
  • branches/release-0.7/program/steps/mail/autocomplete.inc

    r5328 r5402  
    3333    } 
    3434 
    35     $OUTPUT->command('replace_group_recipients', $gid, join(', ', $members)); 
     35    $separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' '; 
     36    $OUTPUT->command('replace_group_recipients', $gid, join($separator, array_unique($members))); 
    3637  } 
    3738 
     
    7172            continue; 
    7273          } 
    73           // when we've got more than one book, we need to skip duplicates 
    74           if ($books_num == 1 || !in_array($contact, $contacts)) { 
     74          // skip duplicates 
     75          if (!in_array($contact, $contacts)) { 
    7576            $contacts[] = $contact; 
    7677            if (count($contacts) >= $MAXNUM) 
  • branches/release-0.7/program/steps/mail/compose.inc

    r5297 r5402  
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
    8  | Copyright (C) 2005-2009, The Roundcube Dev Team                       | 
     8 | Copyright (C) 2005-2011, The Roundcube Dev Team                       | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    123123// set current mailbox in client environment 
    124124$OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); 
    125 $OUTPUT->set_env('sig_above', $CONFIG['sig_above']); 
    126 $OUTPUT->set_env('top_posting', $CONFIG['top_posting']); 
     125$OUTPUT->set_env('sig_above', $RCMAIL->config->get('sig_above', false)); 
     126$OUTPUT->set_env('top_posting', $RCMAIL->config->get('top_posting', false)); 
     127$OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); 
    127128 
    128129// get reference message and set compose mode 
     
    325326$a_recipients = array(); 
    326327$parts        = array('to', 'cc', 'bcc', 'replyto', 'followupto'); 
     328$separator    = trim($RCMAIL->config->get('recipients_separator', ',')) . ' '; 
    327329 
    328330foreach ($parts as $header) { 
     
    368370        $fvalue .= $v; 
    369371      if ($v = $MESSAGE->headers->cc) 
    370         $fvalue .= (!empty($fvalue) ? ', ' : '') . $v; 
     372        $fvalue .= (!empty($fvalue) ? $separator : '') . $v; 
    371373    } 
    372374  } 
     
    411413    } 
    412414 
    413     $fvalue = implode(', ', $fvalue); 
     415    $fvalue = implode($separator, $fvalue); 
    414416  } 
    415417 
  • branches/release-0.7/program/steps/mail/func.inc

    r5374 r5402  
    767767          // previous line is flowed? 
    768768          if (isset($body[$last]) && $body[$n] 
    769             && $last != $last_sig 
     769            && $last !== $last_sig 
    770770            && $body[$last][strlen($body[$last])-1] == ' ' 
    771771          ) { 
  • branches/release-0.7/program/steps/mail/sendmail.inc

    r5374 r5402  
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
    8  | Copyright (C) 2005-2010, The Roundcube Dev Team                       | 
     8 | Copyright (C) 2005-2011, The Roundcube Dev Team                       | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    139139} 
    140140 
    141 // parse email address input (and count addresses) 
     141/** 
     142 * Parse and cleanup email address input (and count addresses) 
     143 * 
     144 * @param string  Address input 
     145 * @param boolean Do count recipients (saved in global $RECIPIENT_COUNT) 
     146 * @param boolean Validate addresses (errors saved in global $EMAIL_FORMAT_ERROR) 
     147 * @return string Canonical recipients string separated by comma 
     148 */ 
    142149function rcmail_email_input_format($mailto, $count=false, $check=true) 
    143150{ 
    144   global $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT; 
     151  global $RCMAIL, $EMAIL_FORMAT_ERROR, $RECIPIENT_COUNT; 
    145152 
    146153  // simplified email regexp, supporting quoted local part 
    147154  $email_regexp = '(\S+|("[^"]+"))@\S+'; 
    148155 
    149   $regexp  = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m', '/;/', '/(\S{1})(<'.$email_regexp.'>)/U'); 
    150   $replace = array(', ', ', ', '', ',', '\\1 \\2'); 
     156  $delim = trim($RCMAIL->config->get('recipients_separator', ',')); 
     157  $regexp  = array("/[,;$delim]\s*[\r\n]+/", '/[\r\n]+/', "/[,;$delim]\s*\$/m", '/;/', '/(\S{1})(<'.$email_regexp.'>)/U'); 
     158  $replace = array($delim.' ', ', ', '', $delim, '\\1 \\2'); 
    151159 
    152160  // replace new lines and strip ending ', ', make address input more valid 
     
    154162 
    155163  $result = array(); 
    156   $items = rcube_explode_quoted_string(',', $mailto); 
     164  $items = rcube_explode_quoted_string($delim, $mailto); 
    157165 
    158166  foreach($items as $item) { 
     
    169177    } else if (preg_match('/<*'.$email_regexp.'>*$/', $item, $matches)) { 
    170178      $address = $matches[0]; 
    171       $name = str_replace($address, '', $item); 
    172       $name = trim($name); 
    173       if ($name && ($name[0] != '"' || $name[strlen($name)-1] != '"') 
    174           && preg_match('/[\(\)\<\>\\\.\[\]@,;:"]/', $name)) { 
    175             $name = '"'.addcslashes($name, '"').'"'; 
    176       } 
     179      $name = trim(str_replace($address, '', $item), '" '); 
    177180      $address = rcube_idn_to_ascii(trim($address, '<>')); 
    178       $address = '<' . $address . '>'; 
    179  
    180       $result[] = $name.' '.$address; 
     181      $result[] = format_email_recipient($address, $name); 
    181182      $item = $address; 
    182183    } else if (trim($item)) { 
  • branches/release-0.7/program/steps/settings/edit_folder.inc

    r5306 r5402  
    120120            'maxlength'   => 150, 
    121121            'unsubscribed' => true, 
    122             'exceptions' => array($mbox_imap), 
     122            'skip_noinferiors' => true, 
     123            'exceptions'  => array($mbox_imap), 
    123124        )); 
    124125 
  • branches/release-0.7/program/steps/settings/folders.inc

    r5309 r5402  
    284284 
    285285        if (!$protected) { 
    286             $opts = $IMAP->mailbox_options($folder['id']); 
    287             $noselect = in_array('\\Noselect', $opts); 
     286            $attrs = $IMAP->mailbox_attributes($folder['id']); 
     287            $noselect = in_array('\\Noselect', $attrs); 
    288288        } 
    289289 
Note: See TracChangeset for help on using the changeset viewer.