예제 #1
0
 /**
 Redirects to the given request and Adds an information message to the global array of information $__info.
 @param arg_arr_request the array that contains the request parameteres (Controller, action ...).
 @param arg_str_info_msg [Optional] the message that is shown to the user.
 @param arg_arr_info_params [Optional] any extra parameters added to the info message if the message text has placeholders (Like %s or %d).
 @param arg_type [Optional] The type of the message that can be ("info" or "warning") which decides the style of the information shown.
 @return the output of the new request.
 */
 public static function redirect($arg_arr_request, $arg_str_info_msg = "", array $arg_arr_info_params = array(), $arg_type = "info")
 {
     global $__in;
     if (!is_array($arg_arr_request)) {
         $arr_req = split("/", $arg_arr_request);
         $arg_arr_request = array();
         if (count($arr_req) == 1) {
             $arg_arr_request['action'] = $arr_req[0];
         } else {
             if (count($arr_req) == 2) {
                 $arg_arr_request['controller'] = $arr_req[0];
                 $arg_arr_request['action'] = $arr_req[1];
             }
         }
     }
     if ($arg_str_info_msg) {
         add_info($arg_str_info_msg, $arg_arr_info_params, $arg_type);
     }
     if (!$arg_arr_request['controller']) {
         $arg_arr_request['controller'] = $__in['controller'];
     }
     $_SESSION['__GET_REPITITION_STOPPER_OLD'] = $__in;
     $_SESSION['__GET_REPITITION_STOPPER_NEW'] = $arg_arr_request;
     $__in = $arg_arr_request;
     return dispatcher::request();
 }
예제 #2
0
//ini_set('display_errors', 1);
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
require_once "config.php";
/**< include the site configuration that is edited by the coder. */
require_once "config/configuration/config.php";
/**< include the site configuration that is edited by the site admin by the configuration module. */
require_once "lib/inc.php";
set_error_handler('error_handler');
/**< set the custom error handler function the function is in inc.php */
require_once "lib/" . SESSION_METHOD . ".php";
require_once "lib/router.php";
require_once "lib/dispatcher.php";
$__out['lang'] = dispatcher::set_language();
require_once "config/translation/" . $__out['lang'] . ".php";
try {
    dispatcher::request();
    // handle request
} catch (PermissionDeniedException $ex) {
    if ($_SESSION['group_id'] == 0) {
        // visitor
        dispatcher::redirect(array("controller" => "user", "action" => "login"), "please_login_first");
    } else {
        dispatcher::redirect(array("controller" => "errors", "action" => "permission_denied"));
    }
} catch (PageNotFoundException $ex) {
    if (DEBUG) {
        exception_handler($ex);
    } else {
        dispatcher::redirect(array("controller" => "errors", "action" => "page_not_found"));
    }
} catch (Exception $ex) {