source: github/program/include/iniset.php @ bfdbcf5

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since bfdbcf5 was bfdbcf5, checked in by alecpl <alec@…>, 5 years ago

#1485505: PHP bug (?) workaround for html2text class autoloading

  • Property mode set to 100755
File size: 3.4 KB
Line 
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, RoundCube Dev, - Switzerland                      |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Setup the application envoronment required to process               |
13 |   any request.                                                        |
14 +-----------------------------------------------------------------------+
15 | Author: Till Klampaeckel <till@php.net>                               |
16 |         Thomas Bruederli <roundcube@gmail.com>                        |
17 +-----------------------------------------------------------------------+
18
19 $Id: cache.inc 88 2005-12-03 16:54:12Z roundcube $
20
21*/
22
23
24// application constants
25define('RCMAIL_VERSION', '0.2-trunk');
26define('RCMAIL_CHARSET', 'UTF-8');
27define('JS_OBJECT_NAME', 'rcmail');
28
29if (!defined('INSTALL_PATH')) {
30  define('INSTALL_PATH', dirname($_SERVER['SCRIPT_FILENAME']).'/');
31}
32
33define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
34
35// make sure path_separator is defined
36if (!defined('PATH_SEPARATOR')) {
37  define('PATH_SEPARATOR', (eregi('win', PHP_OS) ? ';' : ':'));
38}
39
40// RC include folders MUST be included FIRST to avoid other
41// possible not compatible libraries (i.e PEAR) to be included
42// instead the ones provided by RC
43$include_path = INSTALL_PATH . PATH_SEPARATOR;
44$include_path.= INSTALL_PATH . 'program' . PATH_SEPARATOR;
45$include_path.= INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
46$include_path.= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
47$include_path.= ini_get('include_path');
48
49if (set_include_path($include_path) === false) {
50  die('Fatal error: ini_set/set_include_path does not work.');
51}
52
53ini_set('session.name', 'roundcube_sessid');
54ini_set('session.use_cookies', 1);
55ini_set('session.only_use_cookies', 1);
56ini_set('error_reporting', E_ALL&~E_NOTICE);
57set_magic_quotes_runtime(0);
58
59// increase maximum execution time for php scripts
60// (does not work in safe mode)
61if (!ini_get('safe_mode')) {
62  set_time_limit(120);
63}
64
65// set internal encoding for mbstring extension
66if(extension_loaded('mbstring'))
67  mb_internal_encoding(RCMAIL_CHARSET);
68             
69
70/**
71 * Use PHP5 autoload for dynamic class loading
72 *
73 * @todo Make Zend, PEAR etc play with this
74 */
75function __autoload($classname)
76{
77  $filename = preg_replace(
78      array('/MDB2_(.+)/',
79            '/Mail_(.+)/',
80            '/^html_.+/',
81            '/^utf8$/',
82            '/html2text/'
83        ),
84      array('MDB2/\\1',
85            'Mail/\\1',
86            'html',
87            'utf8.class',
88            'lib/html2text'     // see #1485505
89        ),
90      $classname
91  );
92  include_once $filename. '.php';
93}
94
95/**
96 * Local callback function for PEAR errors
97 */
98function rcube_pear_error($err)
99{
100  error_log(sprintf("%s (%s): %s",
101    $err->getMessage(),
102    $err->getCode(),
103    $err->getUserinfo()), 0);
104}
105
106// include global functions
107require_once 'include/bugs.inc';
108require_once 'include/main.inc';
109require_once 'include/rcube_shared.inc';
110
111
112// set PEAR error handling (will also load the PEAR main class)
113PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');
114
Note: See TracBrowser for help on using the repository browser.