Brian Ronald
2012-05-09 552cdea1cf99f3a962e242fe49a70a6de41397c2
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                     |
7fe381 8  | Copyright (C) 2008-2012, The Roundcube Dev Team                       |
T 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.                     |
47124c 13  |                                                                       |
T 14  | PURPOSE:                                                              |
15  |   Setup the application envoronment required to process               |
16  |   any request.                                                        |
17  +-----------------------------------------------------------------------+
18  | Author: Till Klampaeckel <till@php.net>                               |
19  |         Thomas Bruederli <roundcube@gmail.com>                        |
20  +-----------------------------------------------------------------------+
21
af58c3 22  $Id$
47124c 23
T 24 */
25
cd96fd 26 // Some users are not using Installer, so we'll check some
A 27 // critical PHP settings here. Only these, which doesn't provide
28 // an error/warning in the logs later. See (#1486307).
29 $crit_opts = array(
30     'mbstring.func_overload' => 0,
31     'suhosin.session.encrypt' => 0,
32     'session.auto_start' => 0,
33     'file_uploads' => 1,
140abb 34     'magic_quotes_runtime' => 0,
cd96fd 35 );
A 36 foreach ($crit_opts as $optname => $optval) {
37     if ($optval != ini_get($optname)) {
38         die("ERROR: Wrong '$optname' option value. Read REQUIREMENTS section in INSTALL file or use Roundcube Installer, please!");
39     }
40 }
47124c 41
T 42 // application constants
552cde 43 define('RCMAIL_VERSION', '0.9-git');
47124c 44 define('RCMAIL_CHARSET', 'UTF-8');
2b35c5 45 define('RCMAIL_START', microtime(true));
47124c 46
T 47 if (!defined('INSTALL_PATH')) {
2eb794 48     define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
47124c 49 }
T 50
4859fe 51 if (!defined('RCMAIL_CONFIG_DIR')) {
T 52     define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
47124c 53 }
T 54
55 // RC include folders MUST be included FIRST to avoid other
56 // possible not compatible libraries (i.e PEAR) to be included
57 // instead the ones provided by RC
926948 58 $include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
47124c 59 $include_path.= ini_get('include_path');
T 60
61 if (set_include_path($include_path) === false) {
e93c72 62     die("Fatal error: ini_set/set_include_path does not work.");
47124c 63 }
T 64
66d215 65 ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
47124c 66
T 67 // increase maximum execution time for php scripts
68 // (does not work in safe mode)
6d479a 69 @set_time_limit(120);
47124c 70
d99b93 71 // set internal encoding for mbstring extension
5c4c06 72 if (extension_loaded('mbstring')) {
2eb794 73     mb_internal_encoding(RCMAIL_CHARSET);
5c4c06 74     @mb_regex_encoding(RCMAIL_CHARSET);
A 75 }
d99b93 76
0c2596 77 // include global functions
A 78 require_once INSTALL_PATH . 'program/include/rcube_shared.inc';
965ed0 79
0c2596 80 // Register autoloader
588135 81 spl_autoload_register('rcube_autoload');
2eb794 82
A 83 // set PEAR error handling (will also load the PEAR main class)
84 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
47124c 85
0c2596 86 // backward compatybility (to be removed)
1aceb9 87 require_once INSTALL_PATH . 'program/include/rcube_bc.inc';