Esempio n. 1
0
function __autoload($class_name)
{
    if (class_exists($class_name)) {
        return true;
    }
    $file = ENGINE_PATH . "classes/" . $class_name . ".class.php";
    if (file_exists($file)) {
        require_once $file;
    } elseif (isset($_GET['module']) && file_exists(ROOT_PATH . "/apps/" . $_GET['module'] . "/models/" . $class_name . ".class.php")) {
        require_once ROOT_PATH . "/apps/" . $_GET['module'] . "/models/" . $class_name . ".class.php";
    } elseif (isset($_GET['module']) && isAdministration($_GET['module']) && isset($_GET['m']) && file_exists(ROOT_PATH . "/apps/" . $_GET['m'] . "/models/" . $class_name . ".class.php")) {
        //自动包含administration
        require_once ROOT_PATH . "/apps/" . $_GET['m'] . "/models/" . $class_name . ".class.php";
    } elseif (isset($_GET['module']) && isAdministration($_GET['module']) && isset($_GET['m']) && file_exists(ROOT_PATH . "/apps/" . $_GET['m'] . "/models/" . $class_name . ".class.php")) {
        require_once ROOT_PATH . "/apps/" . $_GET['m'] . "/models/" . $class_name . ".class.php";
    }
    /*else {
    				require_once ROOT_PATH . "classes/" . $class_name . ".class.php";
    	}*/
    return true;
}
Esempio n. 2
0
    }
    if (file_exists(inc)) {
        include_once inc;
    } else {
        //加载index.php
        define("inc2", ROOT_PATH . '/apps/' . $_GET['module'] . '/controllers/index.php');
        if (file_exists(inc2)) {
            include_once inc2;
        } else {
            header("HTTP/1.0 404 Not Found");
            header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
        }
    }
} elseif (isset($_GET['module'])) {
    //加载administration
    if (isAdministration($_GET['module'])) {
        define("inc", ENGINE_PATH . '/administration/controllers/index.php');
    } else {
        define("inc", ROOT_PATH . '/apps/' . $_GET['module'] . '/controllers/index.php');
    }
    if (file_exists(inc)) {
        include_once inc;
    } else {
        /**
         * 重定向到404页面
         */
        header("HTTP/1.0 404 Not Found");
        header("Location: http://" . DOMAIN . "/" . $languageURL . "error");
    }
} else {
    $_GET['module'] = 'index';