Aleksander Machniak
2013-04-16 1352d8ddb022e972ab9ef0e4e75e1b7b642865df
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                     |
18e23a 8  | Copyright (C) 2008-2013, 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
bb080a 24 define('RCMAIL_VERSION', '1.0-git');
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
f707fe 57 // include Roundcube Framework
ba6f21 58 require_once 'Roundcube/bootstrap.php';
AM 59
60226a 60 // register autoloader for rcmail app classes
TB 61 spl_autoload_register('rcmail_autoload');
47124c 62
0c2596 63 // backward compatybility (to be removed)
15cf4f 64 require_once INSTALL_PATH . 'program/include/bc.php';
60226a 65
TB 66
67 /**
68  * PHP5 autoloader routine for dynamic class loading
69  */
70 function rcmail_autoload($classname)
71 {
72     if (strpos($classname, 'rcmail') === 0) {
73         $filepath = INSTALL_PATH . "program/include/$classname.php";
74         if (is_readable($filepath)) {
75             include_once $filepath;
76             return true;
77         }
78     }
79
80     return false;
81 }
82