Changeset 5f25a1a in github


Ignore:
Timestamp:
Dec 30, 2008 7:26:13 AM (4 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
64db7e1
Parents:
89f0042
Message:

Merge ldap_public with autocomplete_addressbooks settings + fix config file creation

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • config/main.inc.php.dist

    r230f944 r5f25a1a  
    237237// In order to enable public ldap search, configure an array like the Verisign 
    238238// example further below. if you would like to test, simply uncomment the example. 
     239$rcmail_config['ldap_public'] = array(); 
     240 
    239241// 
    240242// If you are going to use LDAP for individual address books, you will need to  
  • installer/rcube_install.php

    r2a41355 r5f25a1a  
    4444  var $optional_config = array( 
    4545    'log_driver', 'syslog_id', 'syslog_facility', 'imap_auth_type', 
    46     'smtp_helo_host', 'sendmail_delay', 'double_auth', 'language', 
    47     'mail_header_delimiter', 'create_default_folders', 
     46    'smtp_helo_host', 'smtp_auth_type', 'sendmail_delay', 'double_auth', 
     47    'language', 'mail_header_delimiter', 'create_default_folders', 
    4848    'quota_zero_as_unlimited', 'spellcheck_uri', 'spellcheck_languages', 
    4949    'http_received_header', 'session_domain', 'mime_magic', 'log_logins', 
    50     'enable_installer', 'skin_include_php'); 
     50    'enable_installer', 'skin_include_php', 'imap_root', 'imap_delimiter', 
     51    'virtuser_file', 'virtuser_query', 'dont_override'); 
    5152   
    5253  /** 
     
    193194      $out = preg_replace( 
    194195        '/(\$rcmail_config\[\''.preg_quote($prop).'\'\])\s+=\s+(.+);/Uie', 
    195         "'\\1 = ' . var_export(\$value, true) . ';'", 
     196        "'\\1 = ' . rcube_install::_dump_var(\$value) . ';'", 
    196197        $out); 
    197198    } 
     
    259260          'explain' => 'Using <tt>syslog</tt> for logging requires a syslog ID to be configured'); 
    260261      } 
    261        
     262    } 
     263     
     264    // check ldap_public sources having global_search enabled 
     265    if (is_array($this->config['ldap_public']) && !is_array($this->config['autocomplete_addressbooks'])) { 
     266      foreach ($this->config['ldap_public'] as $ldap_public) { 
     267        if ($ldap_public['global_search']) { 
     268          $out['replaced'][] = array('prop' => 'ldap_public::global_search', 'replacement' => 'autocomplete_addressbooks'); 
     269          break; 
     270        } 
     271      } 
    262272    } 
    263273     
     
    292302    } 
    293303     
    294     $this->config  = array_merge($current, $this->config); 
     304    // add all ldap_public sources having global_search enabled to autocomplete_addressbooks 
     305    if (is_array($current['ldap_public'])) { 
     306      foreach ($current['ldap_public'] as $key => $ldap_public) { 
     307        if ($ldap_public['global_search']) { 
     308          $this->config['autocomplete_addressbooks'][] = $key; 
     309          unset($current['ldap_public'][$key]['global_search']); 
     310        } 
     311      } 
     312    } 
     313     
     314    $this->config  = array_merge($this->config, $current); 
     315     
     316    foreach ((array)$current['ldap_public'] as $key => $values) { 
     317      $this->config['ldap_public'][$key] = $current['ldap_public'][$key]; 
     318    } 
    295319  } 
    296320   
     
    458482   
    459483   
    460   function _clean_array($arr) 
     484  static function _clean_array($arr) 
    461485  { 
    462486    $out = array(); 
    463487     
    464     foreach (array_unique($arr) as $i => $val) 
    465       if (!empty($val)) 
    466         $out[] = $val; 
     488    foreach (array_unique($arr) as $k => $val) { 
     489      if (!empty($val)) { 
     490        if (is_numeric($k)) 
     491          $out[] = $val; 
     492        else 
     493          $out[$k] = $val; 
     494      } 
     495    } 
    467496     
    468497    return $out; 
     498  } 
     499   
     500   
     501  static function _dump_var($var) { 
     502    if (is_array($var)) { 
     503      if (empty($var)) { 
     504        return 'array()'; 
     505      } 
     506      else {  // check if all keys are numeric 
     507        $isnum = true; 
     508        foreach ($var as $key => $value) { 
     509          if (!is_numeric($key)) { 
     510            $isnum = false; 
     511            break; 
     512          } 
     513        } 
     514         
     515        if ($isnum) 
     516          return 'array(' . join(', ', array_map(array('rcube_install', '_dump_var'), $var)) . ')'; 
     517      } 
     518    } 
     519     
     520    return var_export($var, true); 
    469521  } 
    470522   
Note: See TracChangeset for help on using the changeset viewer.