<?php
/**
 * Copyright (C) [LJCMS] All rights reserved.
 * <E-Mail：aspcms@qq.com>
 * Url http://www.liangjing.org
 *     http://www.8CMS.com
 * Update 2016.03.21
 */
require_once('source/core/run.php');
$c = XRequest::getGpc('c');
$a = XRequest::getGpc('a');
$c = empty($c) ? 'Index' : $c;
$a = empty($a) ? 'run' : $a;
if (!in_array($c, array("login"))) {
	X::importPlugin();
}
define("GB_LJCMS_C", $c);
define("GB_LJCMS_A", $a);

if (in_array($c, $open_oa_control)) {
    $control_base = BASE_ROOT.'source/control/oabase.php';
    $hoook_base = BASE_ROOT.'source/control/apphook.php';
    $control_path = BASE_ROOT.'source/control/oa/'.$c.'.php';
    if (!file_exists($control_path)) {
        XHandle::error('Controller file:[' . $c . '] is not found!');
    }
    else {
        require_once ($control_base);
        require_once ($hoook_base);
        require_once ($control_path);
        $control = new control();
        $method = 'action_' . $a;
        if (method_exists($control, $method) && $a{0} != '_') {
            $control->$method();
        }
        else{
            XHandle::error('Controller Action [' . $a . '] not found!');
        }
    }
}
else {
    XHandle::error('Controller [' . $c . '] is forbiden!');
}
?>