4 +-----------------------------------------------------------------------+
5 | program/include/iniset.php |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2008-2009, Roundcube Dev, - Switzerland |
9 | Licensed under the GNU GPL |
12 | Setup the application envoronment required to process |
14 +-----------------------------------------------------------------------+
15 | Author: Till Klampaeckel <till@php.net> |
16 | Thomas Bruederli <roundcube@gmail.com> |
17 +-----------------------------------------------------------------------+
19 $Id: iniset.php 4831 2011-06-02 13:36:57Z thomasb $
23 // Some users are not using Installer, so we'll check some
24 // critical PHP settings here. Only these, which doesn't provide
25 // an error/warning in the logs later. See (#1486307).
27 'mbstring.func_overload' => 0,
28 'suhosin.session.encrypt' => 0,
29 'session.auto_start' => 0,
32 foreach ($crit_opts as $optname => $optval) {
33 if ($optval != ini_get($optname)) {
34 die("ERROR: Wrong '$optname' option value. Read REQUIREMENTS section in INSTALL file or use Roundcube Installer, please!");
38 // application constants
39 define('RCMAIL_VERSION', '0.5.3');
40 define('RCMAIL_CHARSET', 'UTF-8');
41 define('JS_OBJECT_NAME', 'rcmail');
42 define('RCMAIL_START', microtime(true));
44 if (!defined('INSTALL_PATH')) {
45 define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
48 if (!defined('RCMAIL_CONFIG_DIR')) {
49 define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
52 // make sure path_separator is defined
53 if (!defined('PATH_SEPARATOR')) {
54 define('PATH_SEPARATOR', (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') ? ';' : ':');
57 // RC include folders MUST be included FIRST to avoid other
58 // possible not compatible libraries (i.e PEAR) to be included
59 // instead the ones provided by RC
60 $include_path = INSTALL_PATH . PATH_SEPARATOR;
61 $include_path.= INSTALL_PATH . 'program' . PATH_SEPARATOR;
62 $include_path.= INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
63 $include_path.= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
64 $include_path.= ini_get('include_path');
66 if (set_include_path($include_path) === false) {
67 die("Fatal error: ini_set/set_include_path does not work.");
70 ini_set('error_reporting', E_ALL&~E_NOTICE);
72 // increase maximum execution time for php scripts
73 // (does not work in safe mode)
76 // set internal encoding for mbstring extension
77 if(extension_loaded('mbstring'))
78 mb_internal_encoding(RCMAIL_CHARSET);
82 * Use PHP5 autoload for dynamic class loading
84 * @todo Make Zend, PEAR etc play with this
85 * @todo Make our classes conform to a more straight forward CS.
87 function rcube_autoload($classname)
89 $filename = preg_replace(
109 if ($fp = @fopen("$filename.php", 'r', true)) {
111 include_once("$filename.php");
118 spl_autoload_register('rcube_autoload');
121 * Local callback function for PEAR errors
123 function rcube_pear_error($err)
125 error_log(sprintf("%s (%s): %s",
128 $err->getUserinfo()), 0);
131 // set PEAR error handling (will also load the PEAR main class)
132 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
134 // include global functions
135 require_once 'include/main.inc';
136 require_once 'include/rcube_shared.inc';