Aleksander Machniak
2016-04-30 0eece8222babd9ea87fbb39ea1a594a7ae979b73
Fix autoloading of 'html' class and improve autoloader performance
2 files modified
37 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/bootstrap.php 36 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -5,6 +5,7 @@
- Fix message list multi-select/deselect issue (#5219)
- Fix bug where getting HTML editor content could steal focus from other form controls (#5223)
- Fix bug where contact search menu fields where always unchecked in Larry skin
- Fix autoloading of 'html' class
RELEASE 1.2-rc
--------------
program/lib/Roundcube/bootstrap.php
@@ -428,27 +428,25 @@
 */
function rcube_autoload($classname)
{
    $filename = preg_replace(
        array(
            '/Mail_(.+)/',
            '/Net_(.+)/',
            '/Auth_(.+)/',
            '/^html_.+/',
            '/^rcube(.*)/'
        ),
        array(
            'Mail/\\1',
            'Net/\\1',
            'Auth/\\1',
            'Roundcube/html',
            'Roundcube/rcube\\1'
        ),
        $classname
    );
    if (strpos($classname, 'rcube') === 0) {
        $classname = 'Roundcube/' . $classname;
    }
    else if (strpos($classname, 'html_') === 0 || $classname === 'html') {
        $classname = 'Roundcube/html';
    }
    else if (strpos($classname, 'Mail_') === 0) {
        $classname = 'Mail/' . substr($classname, 5);
    }
    else if (strpos($classname, 'Net_') === 0) {
        $classname = 'Net/' . substr($classname, 4);
    }
    else if (strpos($classname, 'Auth_') === 0) {
        $classname = 'Auth/' . substr($classname, 5);
    }
    if ($fp = @fopen("$filename.php", 'r', true)) {
    if ($fp = @fopen("$classname.php", 'r', true)) {
        fclose($fp);
        include_once "$filename.php";
        include_once "$classname.php";
        return true;
    }