Thomas Bruederli
2016-04-17 cde7a9eb74b6fd6315885c30c0763e0ee5332499
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                     |
e4d87a 8  | Copyright (C) 2008-2014, 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
cde7a9 24 define('RCMAIL_VERSION', '1.0.9');
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
cbac33 57 // include composer autoloader (if available)
AM 58 if (@file_exists('vendor/autoload.php')) {
59     require 'vendor/autoload.php';
60 }
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');
b4d50c 67
0c2596 68 // backward compatybility (to be removed)
15cf4f 69 require_once INSTALL_PATH . 'program/include/bc.php';
60226a 70
TB 71
72 /**
73  * PHP5 autoloader routine for dynamic class loading
74  */
75 function rcmail_autoload($classname)
76 {
77     if (strpos($classname, 'rcmail') === 0) {
78         $filepath = INSTALL_PATH . "program/include/$classname.php";
79         if (is_readable($filepath)) {
80             include_once $filepath;
81             return true;
82         }
83     }
84
85     return false;
86 }