Thomas Bruederli
2016-04-17 25bc871ee79a6d469822d999b09c9b5d73fccf1f
commit | author | age
47124c 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
197601 5  | program/include/iniset.php                                            |
47124c 6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
2f8b10 8  | Copyright (C) 2008-2015, The Roundcube Dev Team                       |
7fe381 9  |                                                                       |
T 10  | Licensed under the GNU General Public License version 3 or            |
11  | any later version with exceptions for skins & plugins.                |
12  | See the README file for a full license statement.                     |
47124c 13  |                                                                       |
T 14  | PURPOSE:                                                              |
f707fe 15  |   Setup the application environment required to process               |
47124c 16  |   any request.                                                        |
T 17  +-----------------------------------------------------------------------+
18  | Author: Till Klampaeckel <till@php.net>                               |
19  |         Thomas Bruederli <roundcube@gmail.com>                        |
20  +-----------------------------------------------------------------------+
21 */
22
fdbe5a 23 // application constants
25bc87 24 define('RCMAIL_VERSION', '1.1.5');
fdbe5a 25 define('RCMAIL_START', microtime(true));
TB 26
47124c 27 if (!defined('INSTALL_PATH')) {
2eb794 28     define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
47124c 29 }
T 30
4859fe 31 if (!defined('RCMAIL_CONFIG_DIR')) {
T 32     define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
47124c 33 }
T 34
9be2f4 35 if (!defined('RCUBE_LOCALIZATION_DIR')) {
TB 36     define('RCUBE_LOCALIZATION_DIR', INSTALL_PATH . 'program/localization/');
37 }
38
39 define('RCUBE_INSTALL_PATH', INSTALL_PATH);
592668 40 define('RCUBE_CONFIG_DIR',  RCMAIL_CONFIG_DIR.'/');
9be2f4 41
TB 42
47124c 43 // RC include folders MUST be included FIRST to avoid other
T 44 // possible not compatible libraries (i.e PEAR) to be included
45 // instead the ones provided by RC
926948 46 $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
47124c 47 $include_path.= ini_get('include_path');
T 48
49 if (set_include_path($include_path) === false) {
e93c72 50     die("Fatal error: ini_set/set_include_path does not work.");
47124c 51 }
T 52
53 // increase maximum execution time for php scripts
54 // (does not work in safe mode)
6d479a 55 @set_time_limit(120);
47124c 56
a98a4f 57 // include composer autoloader (if available)
fec4f2 58 if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) {
AM 59     require INSTALL_PATH . 'vendor/autoload.php';
a98a4f 60 }
TB 61
f707fe 62 // include Roundcube Framework
ba6f21 63 require_once 'Roundcube/bootstrap.php';
AM 64
60226a 65 // register autoloader for rcmail app classes
TB 66 spl_autoload_register('rcmail_autoload');
47124c 67
0c2596 68 // backward compatybility (to be removed)
15cf4f 69 require_once INSTALL_PATH . 'program/include/bc.php';
60226a 70
9e147a 71 // load the UTF-8 portability layers from Patchwork
AM 72 // don't load mbstring layer as it conflicts with Roundcube Framework (#1490280)
73 if (!function_exists('iconv')) {
74     \Patchwork\Utf8\Bootup::initIconv();
a98a4f 75 }
9e147a 76 if (!function_exists('utf8_encode')) {
AM 77     \Patchwork\Utf8\Bootup::initUtf8Encode();
78 }
60226a 79
TB 80 /**
81  * PHP5 autoloader routine for dynamic class loading
82  */
83 function rcmail_autoload($classname)
84 {
85     if (strpos($classname, 'rcmail') === 0) {
86         $filepath = INSTALL_PATH . "program/include/$classname.php";
87         if (is_readable($filepath)) {
88             include_once $filepath;
89             return true;
90         }
91     }
92
93     return false;
94 }