isMobile()) { define('IS_MOBILE', true); } else { define('IS_MOBILE', false); } $skip_page = false; if(IS_ADMIN): ob_start(); admin::render(); if (!IS_AJAX) die(); ob_end_clean(); endif; if (IS_AJAX) APP::render_ajax(); if (substr($path_sys, -1)=="/") $path_sys = substr($path_sys, 0, -1); if (substr($path_app, -1)=="/") $path_app = substr($path_app, 0, -1); if (APP::route(0)=="class" || APP::route(0)=="templates" || (APP::route(0)=="system" && APP::route(1)=="admin") || (APP::route(0)=="application" && APP::route(1)=="templates")) { $file_app_found = false; $file_found = false; $skip_page = true; } ob_start(); if (!$skip_page): if (is_file(DIR_ROOT.$path_app)) { $file_found = true; include DIR_ROOT.$path_app; } else if (is_file(DIR_ROOT.$path_app.".php")) { $file_found = true; include DIR_ROOT.$path_app.".php"; } else if (is_file(DIR_APP.APP::route(0))) { $file_found = true; include DIR_APP.APP::route(0); } else if (is_file(DIR_APP.APP::route(0).".php")) { $file_found = true; include DIR_APP.APP::route(0).".php"; } else { $file_found = false; } if (!$file_found) { if (is_file(DIR_ROOT.$path_sys)) { $file_app_found = true; include DIR_ROOT.$path_sys; } else if (is_file(DIR_ROOT.$path_sys.".php")) { $file_app_found = true; include DIR_ROOT.$path_sys.".php"; } else if (is_file(DIR_APP.APP::route(0))) { $file_found = true; include DIR_APP.APP::route(0); } else if (is_file(DIR_APP.APP::route(0).".php")) { $file_found = true; include DIR_APP.APP::route(0).".php"; } else { $file_app_found = false; } } endif; if (!$file_found && !$file_app_found) { include DIR_ROOT."application/index.php"; } $page_content = ob_get_contents(); ob_get_clean(); // output page APP::render_page($page_content); // end output } static function use_cache_css($group_name) { jscss_cache::add_group_css($group_name); jscss_cache::$cache_used_css = $group_name; } static function use_cache_js($group_name) { jscss_cache::add_group_js($group_name); jscss_cache::$cache_used_js = $group_name; } public static function render_ajax() { if (isset($_GET['ajax_func'])) { while (ob_get_level()) { ob_end_clean(); } $p = $_GET['ajax_func']; $full_name = "ajax_".$p; if (function_exists($full_name)) { $full_name($_POST); } else { js::exec("alert('Function ".$full_name." not existing!');"); } js::show(); die(); } } public static function minify_html() { self::$compress_html = true; } public static function redirect($url) { header("Location: $url"); } public static function pass_crypt($string) { return openssl_digest($string, 'sha512'); } public static function use_class($class_name) { if (is_file(DIR_APP."class/".$class_name.".php")) { require_once DIR_APP."class/".$class_name.".php"; } else if (is_file(DIR_SYS."class/".$class_name.".php")) { require_once DIR_SYS."class/".$class_name.".php"; } else { echo "CLASS $class_name NOT FOUND!"; } } public static function set_layout($layout_name) { self::$layout_name = $layout_name; } public static function render_page($content) { if (settings::add("app.minify_html", "Y") == "Y") APP::minify_html(); $content = template::get("page_layout.".self::$layout_name, array('page_content' => $content)); if (self::$compress_html) $content = Minify_HTML::minify($content); print $content; } public static function route($index) { $route_call = self::$route_call; $route_exp = explode("/", $route_call); if (isset($route_exp[$index])) { return $route_exp[$index]; } else { return ""; } } } APP::init(); ?>