Mercurial > hg > rc2
comparison program/include/iniset.php @ 0:4681f974d28b
vanilla 1.3.3 distro, I hope
| author | Charlie Root |
|---|---|
| date | Thu, 04 Jan 2018 15:52:31 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4681f974d28b |
|---|---|
| 1 <?php | |
| 2 | |
| 3 /** | |
| 4 +-----------------------------------------------------------------------+ | |
| 5 | program/include/iniset.php | | |
| 6 | | | |
| 7 | This file is part of the Roundcube Webmail client | | |
| 8 | Copyright (C) 2008-2017, The Roundcube Dev Team | | |
| 9 | | | |
| 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. | | |
| 13 | | | |
| 14 | PURPOSE: | | |
| 15 | Setup the application environment required to process | | |
| 16 | any request. | | |
| 17 +-----------------------------------------------------------------------+ | |
| 18 | Author: Till Klampaeckel <till@php.net> | | |
| 19 | Thomas Bruederli <roundcube@gmail.com> | | |
| 20 +-----------------------------------------------------------------------+ | |
| 21 */ | |
| 22 | |
| 23 // application constants | |
| 24 define('RCMAIL_VERSION', '1.3.3'); | |
| 25 define('RCMAIL_START', microtime(true)); | |
| 26 | |
| 27 if (!defined('INSTALL_PATH')) { | |
| 28 define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/'); | |
| 29 } | |
| 30 | |
| 31 if (!defined('RCMAIL_CONFIG_DIR')) { | |
| 32 define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config'); | |
| 33 } | |
| 34 | |
| 35 if (!defined('RCUBE_LOCALIZATION_DIR')) { | |
| 36 define('RCUBE_LOCALIZATION_DIR', INSTALL_PATH . 'program/localization/'); | |
| 37 } | |
| 38 | |
| 39 define('RCUBE_INSTALL_PATH', INSTALL_PATH); | |
| 40 define('RCUBE_CONFIG_DIR', RCMAIL_CONFIG_DIR.'/'); | |
| 41 | |
| 42 | |
| 43 // RC include folders MUST be included FIRST to avoid other | |
| 44 // possible not compatible libraries (i.e PEAR) to be included | |
| 45 // instead the ones provided by RC | |
| 46 $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; | |
| 47 $include_path.= ini_get('include_path'); | |
| 48 | |
| 49 if (set_include_path($include_path) === false) { | |
| 50 die("Fatal error: ini_set/set_include_path does not work."); | |
| 51 } | |
| 52 | |
| 53 // increase maximum execution time for php scripts | |
| 54 // (does not work in safe mode) | |
| 55 @set_time_limit(120); | |
| 56 | |
| 57 // include composer autoloader (if available) | |
| 58 if (@file_exists(INSTALL_PATH . 'vendor/autoload.php')) { | |
| 59 require INSTALL_PATH . 'vendor/autoload.php'; | |
| 60 } | |
| 61 | |
| 62 // include Roundcube Framework | |
| 63 require_once 'Roundcube/bootstrap.php'; | |
| 64 | |
| 65 // register autoloader for rcmail app classes | |
| 66 spl_autoload_register('rcmail_autoload'); | |
| 67 | |
| 68 /** | |
| 69 * PHP5 autoloader routine for dynamic class loading | |
| 70 */ | |
| 71 function rcmail_autoload($classname) | |
| 72 { | |
| 73 if (strpos($classname, 'rcmail') === 0) { | |
| 74 $filepath = INSTALL_PATH . "program/include/$classname.php"; | |
| 75 if (is_readable($filepath)) { | |
| 76 include_once $filepath; | |
| 77 return true; | |
| 78 } | |
| 79 } | |
| 80 | |
| 81 return false; | |
| 82 } |
