alecpl
2012-02-20 a3ed96344e15e7c1c238015911f9dd2d398f7da1
commit | author | age
fee8c6 1 <?php
df3c35 2 /*
T 3  +-------------------------------------------------------------------------+
7fe381 4  | Roundcube Webmail installer utilities                                   |
df3c35 5  |                                                                         |
434869 6  | Copyright (C) 2005-2011, The Roundcube Dev Team                         |
df3c35 7  |                                                                         |
7fe381 8  | Licensed under the GNU General Public License version 3 or              |
T 9  | any later version with exceptions for skins & plugins.                  |
10  | See the README file for a full license statement.                       |
df3c35 11  |                                                                         |
T 12  +-------------------------------------------------------------------------+
13  | Author: Thomas Bruederli <roundcube@gmail.com>                          |
14  +-------------------------------------------------------------------------+
fee8c6 15
df3c35 16  $Id: index.php 2696 2009-07-02 06:38:26Z thomasb $
T 17
18 */
fee8c6 19
T 20 /**
21  * Use PHP5 autoload for dynamic class loading
2c3d81 22  * (copy from program/include/iniset.php)
fee8c6 23  */
T 24 function __autoload($classname)
25 {
7479c1 26     $filename = preg_replace(
A 27         array(
28             '/MDB2_(.+)/',
29             '/Mail_(.+)/',
30             '/Net_(.+)/',
31             '/Auth_(.+)/',
32             '/^html_.+/',
33             '/^utf8$/'
34         ),
35         array(
36             'MDB2/\\1',
37             'Mail/\\1',
38             'Net/\\1',
39             'Auth/\\1',
40             'html',
41             'utf8.class'
42         ),
43         $classname
44     );
45     include_once $filename. '.php';
fee8c6 46 }
T 47
48
49 /**
df3c35 50  * Fake internal error handler to catch errors
fee8c6 51  */
T 52 function raise_error($p)
53 {
7479c1 54     $rci = rcube_install::get_instance();
A 55     $rci->raise_error($p);
fee8c6 56 }
434869 57
T 58 /**
59  * Local callback function for PEAR errors
60  */
61 function rcube_pear_error($err)
62 {
63     raise_error(array(
64         'code' => $err->getCode(),
65         'message' => $err->getMessage(),
66     ));
67 }
68
69 // set PEAR error handling (will also load the PEAR main class)
70 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');