コード例 #1
0
ファイル: system.php プロジェクト: rtoi/WebFramework
/**
 * Executes the current request.
 * 
 * This is the second of two essential functions.
 * It runs the actual execution. If fact it is the only place where you will
 * find an `echo` in the ScavixWDF code.
 * @return void
 */
function system_execute()
{
    session_sanitize();
    execute_hooks(HOOK_POST_INITSESSION);
    // respond to PING requests that are sended to keep the session alive
    if (Args::request('ping', false)) {
        session_keep_alive();
        execute_hooks(HOOK_PING_RECIEVED);
        die("PONG");
    }
    // respond to DEBUG requests
    if ($GLOBALS['CONFIG']['system']['ajax_debug_argument']) {
        $data = Args::request($GLOBALS['CONFIG']['system']['ajax_debug_argument'], false);
        if ($data) {
            logging_add_category("JS");
            $data = json_decode($data, true);
            if (is_array($data) && count($data) > 0) {
                log_write(Args::request('sev', ''), array_shift($data), $data);
            } else {
                log_write(Args::request('sev', ''), $data);
            }
            die('"OK"');
        }
    }
    Args::strip_tags();
    global $current_controller, $current_event;
    list($current_controller, $current_event) = system_parse_request_path();
    $current_controller = system_instanciate_controller($current_controller);
    if (!(system_method_exists($current_controller, $current_event) || system_method_exists($current_controller, '__method_exists') && $current_controller->__method_exists($current_event))) {
        $current_event = cfg_get('system', 'default_event');
    }
    if (!isset($GLOBALS['wdf_route'])) {
        $GLOBALS['wdf_route'] = array($current_controller, $current_event);
    }
    if (system_method_exists($current_controller, $current_event) || system_method_exists($current_controller, '__method_exists') && $current_controller->__method_exists($current_event)) {
        $content = system_invoke_request($current_controller, $current_event, HOOK_PRE_EXECUTE);
    } else {
        $content = '';
    }
    execute_hooks(HOOK_POST_EXECUTE);
    @set_time_limit(ini_get('max_execution_time'));
    system_exit($content, false);
}
コード例 #2
0
 /**
  * Checks if the user has seen and accepted a confirmation.
  * 
  * See <AjaxAction::Confirm>
  * @param string $text_base Text base the user confirmed
  * @return boolean True if user clicked OK
  */
 public static function IsConfirmed($text_base)
 {
     if (isset($_SESSION['ajax_confirm'][$text_base]) && $_SESSION['ajax_confirm'][$text_base] == Args::request('confirmed', false)) {
         return true;
     }
     return false;
 }