alecpl
2011-09-06 66df084203a217ab74a416064c459cc3420a648c
commit | author | age
fee8c6 1 <?php
df3c35 2 /*
T 3  +-------------------------------------------------------------------------+
e019f2 4  | Roundcube Webmail IMAP Client                                           |
434869 5  | Version 0.6                                                             |
df3c35 6  |                                                                         |
434869 7  | Copyright (C) 2005-2011, The Roundcube Dev Team                         |
df3c35 8  |                                                                         |
T 9  | This program is free software; you can redistribute it and/or modify    |
10  | it under the terms of the GNU General Public License version 2          |
11  | as published by the Free Software Foundation.                           |
12  |                                                                         |
13  | This program is distributed in the hope that it will be useful,         |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
16  | GNU General Public License for more details.                            |
17  |                                                                         |
18  | You should have received a copy of the GNU General Public License along |
19  | with this program; if not, write to the Free Software Foundation, Inc., |
20  | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.             |
21  |                                                                         |
22  +-------------------------------------------------------------------------+
23  | Author: Thomas Bruederli <roundcube@gmail.com>                          |
24  +-------------------------------------------------------------------------+
fee8c6 25
df3c35 26  $Id: index.php 2696 2009-07-02 06:38:26Z thomasb $
T 27
28 */
fee8c6 29
T 30 /**
31  * Use PHP5 autoload for dynamic class loading
2c3d81 32  * (copy from program/include/iniset.php)
fee8c6 33  */
T 34 function __autoload($classname)
35 {
7479c1 36     $filename = preg_replace(
A 37         array(
38             '/MDB2_(.+)/',
39             '/Mail_(.+)/',
40             '/Net_(.+)/',
41             '/Auth_(.+)/',
42             '/^html_.+/',
43             '/^utf8$/'
44         ),
45         array(
46             'MDB2/\\1',
47             'Mail/\\1',
48             'Net/\\1',
49             'Auth/\\1',
50             'html',
51             'utf8.class'
52         ),
53         $classname
54     );
55     include_once $filename. '.php';
fee8c6 56 }
T 57
58
59 /**
df3c35 60  * Fake internal error handler to catch errors
fee8c6 61  */
T 62 function raise_error($p)
63 {
7479c1 64     $rci = rcube_install::get_instance();
A 65     $rci->raise_error($p);
fee8c6 66 }
434869 67
T 68 /**
69  * Local callback function for PEAR errors
70  */
71 function rcube_pear_error($err)
72 {
73     raise_error(array(
74         'code' => $err->getCode(),
75         'message' => $err->getMessage(),
76     ));
77 }
78
79 // set PEAR error handling (will also load the PEAR main class)
80 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'rcube_pear_error');