public static function Redirection_Monitor()
    {
        //--
        if (!defined('SMART_FRAMEWORK_VERSION')) {
            die('Smart Runtime // Redirection Monitor :: Requires SmartFramework to be loaded ...');
        }
        //end if
        //--
        if (self::$RedirectionMonitorStarted !== false) {
            return;
            // avoid run after it was used by runtime
        }
        //end if
        self::$RedirectionMonitorStarted = true;
        //--
        $url_redirect = '';
        //--
        $the_current_url = SmartUtils::get_server_current_url();
        $the_current_script = SmartUtils::get_server_current_script();
        //--
        if (SMART_SOFTWARE_FRONTEND_ENABLED === false and SMART_SOFTWARE_BACKEND_ENABLED === false) {
            // both frontend and backend are disabled
            die('FATAL ERROR: The FRONTEND but also the BACKEND of this application are DISABLED ! ...');
        }
        //end if
        if (SMART_SOFTWARE_FRONTEND_ENABLED === false and (string) $the_current_script == 'index.php') {
            $url_redirect = $the_current_url . 'admin.php';
        }
        //end if
        if (SMART_SOFTWARE_BACKEND_ENABLED === false and (string) $the_current_script == 'admin.php') {
            $url_redirect = $the_current_url . 'index.php';
        }
        //end if
        //--
        if ((string) $url_redirect == '' and isset($_SERVER['PATH_INFO'])) {
            //--
            if (strlen($_SERVER['PATH_INFO']) > 0) {
                //--
                if ((string) $the_current_script == 'index.php') {
                    $the_current_script = '';
                }
                //end if
                $url_redirect = $the_current_url . $the_current_script . '?' . $_SERVER['PATH_INFO'];
                //--
            }
            //end if
            //--
        }
        //end if
        //--
        $gopage = '
		<!DOCTYPE html>
		<!-- template :: RUNTIME REDIRECTION / PATH SUFFIX -->
		<html>
			<head>
				<meta charset="UTF-8">
				<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
				<meta http-equiv="refresh" content="3;URL=' . Smart::escape_html($url_redirect) . '">
			</head>
			<body>
				<h1>Redirecting to a valid URL ... wait ...</h1><br>
				<script type="text/javascript">setTimeout("self.location=\'' . Smart::escape_js($url_redirect) . '\'",1500);</script>
			</body>
		</html>
	';
        //--
        if (strlen($url_redirect) > 0) {
            @header('Location: ' . $url_redirect);
            die($gopage);
        }
        //end if
        //--
    }
Esempio n. 2
0
//end if
//-----------------------------------------------------
// @ignore		THIS FILE IS FOR INTERNAL USE ONLY BY SMART-FRAMEWORK.RUNTIME !!!
//======================================================
// Smart-Framework - App Request Handler
// DEPENDS: SmartFramework, SmartFrameworkRuntime
//======================================================
// This file can be customized per App ...
// DO NOT MODIFY ! IT IS CUSTOMIZED FOR: Smart.Framework
//======================================================
//##### WARNING: #####
// Changing the code below is on your own risk and may lead to severe disrupts in the execution of this software !
// This part registers the request variables in the right order (according with security standards: G=Get/P=Post from GPCS ; the C=Cookie or S=Server will not be processed here and must be used from PHP super-globals: $_COOKIE and $_SERVER)
//####################
//-- EXTRACT, FILTER AND REGISTER INPUT VARIABLES (GET, POST, COOKIE, SERVER)
if (!defined('SMART_FRAMEWORK_SEMANTIC_URL_DISABLE')) {
    SmartFrameworkRuntime::Parse_Semantic_URL();
}
//end if
//--
SmartFrameworkRuntime::Extract_Filtered_Request_Get_Post_Vars((array) $_GET, 'GET');
// extract and filter $_GET
SmartFrameworkRuntime::Extract_Filtered_Request_Get_Post_Vars((array) $_POST, 'POST');
// extract and filter $_POST
SmartFrameworkRuntime::Lock_Request_Processing();
// prevent re-processing Request variables after they were processed 1st time (this is mandatory from security point of view)
//--
// $_COOKIE will not be processed, use $_COOKIE['cookie_name'] for any purpose
// $_SERVER will not be processed, use $_SERVER['some-key'] for any purpose
//--
// end of php code