Changeset 2537 in subversion


Ignore:
Timestamp:
May 26, 2009 3:01:55 AM (4 years ago)
Author:
alec
Message:
  • Support initial identity name from virtuser_query (#1484003)
Location:
trunk/roundcubemail
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r2523 r2537  
    22=========================== 
    33 
     4- Support initial identity name from virtuser_query (#1484003) 
    45- Added message menu, removed Print and Source buttons 
    56- Added possibility to save message as .eml file (#1485861) 
  • trunk/roundcubemail/config/main.inc.php.dist

    r2530 r2537  
    8888// Query to resolve user names and e-mail addresses from the database 
    8989// %u will be replaced with the current username for login. 
    90 // The query should select the user's e-mail address as first col 
     90// The query should select the user's e-mail address as first column 
     91// and optional identity name as second column 
    9192$rcmail_config['virtuser_query'] = ''; 
    9293 
  • trunk/roundcubemail/program/include/rcube_user.php

    r2508 r2537  
    367367    // try to resolve user in virtuser table and file 
    368368    if ($user_email != '' && !strpos($user, '@')) { 
    369       if ($email_list = self::user2email($user, false)) 
    370         $user_email = $email_list[0]; 
     369      if ($email_list = self::user2email($user, false, true)) 
     370        $user_email = is_array($email_list[0]) ? $email_list[0][0] : $email_list[0]; 
    371371    } 
    372372 
     
    400400      // create new identities records 
    401401      $standard = 1; 
    402       foreach ($email_list as $email) { 
     402      foreach ($email_list as $row) { 
     403 
     404        if (is_array($row)) { 
     405          $email = $row[0]; 
     406          $name = $row[1] ? $row[1] : $user_name; 
     407        } else { 
     408          $email = $row; 
     409          $name = $user_name; 
     410        } 
     411         
    403412        $plugin = $rcmail->plugins->exec_hook('create_identity', array('record' => array( 
    404413          'login' => true, 
    405414          'user_id' => $user_id, 
    406           'name' => strip_newlines($user_name), 
     415          'name' => strip_newlines($name), 
    407416          'email' => $email, 
    408417          'standard' => $standard))); 
     
    462471   * @param string User name 
    463472   * @param boolean If true returns first found entry 
     473   * @param boolean If true returns email as array (email and name for identity) 
    464474   * @return mixed Resolved e-mail address string or array of strings 
    465475   */ 
    466   static function user2email($user, $first=true) 
     476  static function user2email($user, $first=true, $extended=false) 
    467477  { 
    468478    $result = array(); 
     
    475485      while ($sql_arr = $dbh->fetch_array($sql_result)) 
    476486        if (strpos($sql_arr[0], '@')) { 
    477           $result[] = $sql_arr[0]; 
     487          $result[] = ($extended && count($sql_arr) > 1) ? $sql_arr : $sql_arr[0]; 
    478488          if ($first) 
    479489            return $result[0]; 
Note: See TracChangeset for help on using the changeset viewer.