Changeset bb8721aa in github


Ignore:
Timestamp:
Jun 3, 2010 4:02:12 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
058eb6c
Parents:
05a631a
Message:
  • Support dynamic hostname (%d/%n) variables in configuration options (#1485438)
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r5bde172 rbb8721aa  
    22=========================== 
    33 
     4- Support dynamic hostname (%d/%n) variables in configuration options (#1485438) 
    45- Add 'messages_list' hook (#1486266) 
    56- Add request* event triggers in http_post/http_request (#1486054) 
  • config/main.inc.php.dist

    rac8edbe rbb8721aa  
    6262// to display a pulldown menu or set one host as string. 
    6363// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls:// 
     64// Supported replacement variables: 
     65// %n - http hostname ($_SERVER['SERVER_NAME']) 
     66// %d - domain (http hostname without the first part) 
     67// For example %n = mail.domain.tld, %d = domain.tld 
    6468$rcmail_config['default_host'] = ''; 
    6569 
     
    9195// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls:// 
    9296// If left blank, the PHP mail() function is used 
    93 // Use %h variable as replacement for user's IMAP hostname 
     97// Supported replacement variables: 
     98// %h - user's IMAP hostname 
     99// %n - http hostname ($_SERVER['SERVER_NAME']) 
     100// %d - domain (http hostname without the first part) 
     101// For example %n = mail.domain.tld, %d = domain.tld 
    94102$rcmail_config['smtp_server'] = ''; 
    95103 
     
    177185// This domain will be used to form e-mail addresses of new users 
    178186// Specify an array with 'host' => 'domain' values to support multiple hosts 
     187// Supported replacement variables: 
     188// %h - user's IMAP hostname 
     189// %n - http hostname ($_SERVER['SERVER_NAME']) 
     190// %d - domain (http hostname without the first part) 
     191// For example %n = mail.domain.tld, %d = domain.tld 
    179192$rcmail_config['mail_domain'] = ''; 
    180193 
     
    375388$rcmail_config['ldap_public']['Verisign'] = array( 
    376389  'name'          => 'Verisign.com', 
     390  // Replacement variables supported in host names: 
     391  // %h - user's IMAP hostname 
     392  // %n - http hostname ($_SERVER['SERVER_NAME']) 
     393  // %d - domain (http hostname without the first part) 
     394  // For example %n = mail.domain.tld, %d = domain.tld 
    377395  'hosts'         => array('directory.verisign.com'), 
    378396  'port'          => 389, 
  • program/include/main.inc

    r874ff4d rbb8721aa  
    15331533} 
    15341534 
     1535 
    15351536// for backward compatibility 
    15361537function rcube_sess_unset($var_name=null) 
     
    15391540 
    15401541  $RCMAIL->session->remove($var_name); 
     1542} 
     1543 
     1544 
     1545// Replaces hostname variables 
     1546function rcube_parse_host($name) 
     1547{ 
     1548  // %n - host 
     1549  $n = preg_replace('/:\d+$/', '', $_SERVER['SERVER_NAME']); 
     1550  // %d - domain name without first part, e.g. %d=mail.domain.tld, %m=domain.tld 
     1551  $d = preg_replace('/^[^\.]+\./', '', $n); 
     1552  // %h - IMAP host 
     1553  $h = $_SESSION['imap_host']; 
     1554 
     1555  $name = str_replace(array('%n', '%d', '%h'), array($n, $d, $h), $name); 
     1556  return $name; 
    15411557} 
    15421558 
  • program/include/rcmail.php

    rf07d238 rbb8721aa  
    576576        return false; 
    577577      } 
    578     else if (!empty($config['default_host']) && $host != $config['default_host']) 
     578    else if (!empty($config['default_host']) && $host != rcube_parse_host($config['default_host'])) 
    579579      return false; 
    580580 
     
    744744    } 
    745745    else 
    746       $host = $default_host; 
     746      $host = rcube_parse_host($default_host); 
    747747 
    748748    return $host; 
  • program/include/rcube_config.php

    r2eb7943 rbb8721aa  
    278278        } 
    279279        else if (!empty($this->prop['mail_domain'])) 
    280             $domain = $this->prop['mail_domain']; 
    281      
     280            $domain = rcube_parse_host($this->prop['mail_domain']); 
     281 
    282282        return $domain; 
    283283    } 
    284    
    285    
     284 
     285 
    286286    /** 
    287287     * Getter for error state 
  • program/include/rcube_ldap.php

    r25fdec5 rbb8721aa  
    100100    foreach ($this->prop['hosts'] as $host) 
    101101    { 
     102      $host = rcube_parse_host($host); 
    102103      $this->_debug("C: Connect [$host".($this->prop['port'] ? ':'.$this->prop['port'] : '')."]"); 
    103104 
  • program/include/rcube_smtp.php

    r14a4ac5 rbb8721aa  
    7474    )); 
    7575 
    76     $smtp_host = str_replace('%h', $_SESSION['imap_host'], $CONFIG['smtp_server']); 
     76    $smtp_host = rcube_parse_host($CONFIG['smtp_server']); 
    7777    // when called from Installer it's possible to have empty $smtp_host here 
    7878    if (!$smtp_host) $smtp_host = 'localhost'; 
Note: See TracChangeset for help on using the changeset viewer.