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