Thomas Bruederli
2016-05-15 d2e2a8f32e72971e63f40fe070477e2c3b5cc6bd
commit | author | age
47124c 1 <?php
T 2
a95874 3 /**
47124c 4  +-----------------------------------------------------------------------+
197601 5  | program/include/iniset.php                                            |
47124c 6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
d2e2a8 8  | Copyright (C) 2008-2016, 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
d2e2a8 24 define('RCMAIL_VERSION', '1.2.0');
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
458a6b 68 // backward compatybility (to be removed in version 1.2.0)
TB 69 require_once INSTALL_PATH . 'program/include/bc.php';
70
60226a 71 /**
TB 72  * PHP5 autoloader routine for dynamic class loading
73  */
74 function rcmail_autoload($classname)
75 {
76     if (strpos($classname, 'rcmail') === 0) {
77         $filepath = INSTALL_PATH . "program/include/$classname.php";
78         if (is_readable($filepath)) {
79             include_once $filepath;
80             return true;
81         }
82     }
83
84     return false;
85 }