/** * Rehash the cache and the configuration * * @param string $fName The config to use */ protected function rehash($fName) { App::f3()->config($fName); $scaffold = App::get("scaffold"); $mtime = App::f3()->hash(filemtime($fName) . "models"); $rtime = App::f3()->hash(filemtime($fName) . "routes"); foreach ($scaffold as $className => &$config) { if (!is_array($config)) { $config = []; } $generate = $config["def"] ?: ["route", "model"]; $generate = is_array($generate) ? $generate : [$generate]; if (in_array("model", $generate)) { $config["modelfile"] = empty($config["modelfile"]) ? FALSE : ($this->getFileName("SCAFFOLDMODEL", $config["modelfile"]) ?: FALSE); $config["modeltime"] = $config["modelfile"] ? filemtime($config["modelfile"]) : 0; $config["json"] = empty($config["json"]) ? FALSE : (is_array($config["json"]) ? $config["json"] : [$config["json"]]); $config["model"] = TRUE; $mtime .= App::f3()->hash($config["modeltime"]); } if (in_array("route", $generate)) { $config["routefile"] = empty($config["routefile"]) ? FALSE : ($this->getFileName("SCAFFOLDROUTE", $config["routefile"]) ?: FALSE); $config["routetime"] = $config["routefile"] ? filemtime($config["routefile"]) : 0; $config["route"] = TRUE; $rtime .= App::f3()->hash($config["routetime"]); } } unset($config); App::set("scaffold", $scaffold); $this->_cacheFileModel = $this->_base . App::f3()->hash($mtime) . ".php"; $this->_cacheFileRoute = $this->_base . App::f3()->hash($rtime) . ".php"; }
public function cache() { \App::f3()->clear('CACHE'); }
App::set("ipaccess.allowedips", [App::get("ipaccess.allowedips")]); } //! Prepare the compression for CSS files $css = []; foreach (App::get("INCLUDECSS") as $file => $media) { if (!isset($css[$media])) { $css[$media] = []; } $css[$media][] = "{$file}.css"; } foreach ($css as $key => &$value) { $value = implode(",", $value); } App::set("INCLUDEJS", implode(".js,", App::get("INCLUDEJS")) . ".js"); App::set("INCLUDECSS", $css); App::f3()->route('GET /minify/@type', function ($f3, $args) { App::log(App::SEVERITY_TRACE, "Serve minified files [" . $args['type'] . "](" . filter_input(INPUT_GET, "files") . ")"); $path = $f3->get('UI') . $args['type'] . '/'; $files = str_replace('../', '', filter_input(INPUT_GET, "files")); echo Web::instance()->minify($files, null, true, $path); }, App::get("STYLECACHE")); /** * Decide the HTML client language * * Only available languages are accepted * The first client accepted language will be the desired language if available * In all other cases it fallback to the configured fallback language */ $lang = explode(",", App::get('LANGUAGE'))[0]; if (!is_array(App::get("LANGAVAILABLE")) || !in_array($lang, App::get("LANGAVAILABLE"))) { $lang = App::get("FALLBACK");
<?php /* Request the main core code to run application */ require "core/class/app.php"; require "core/script/bootstrap.php"; /* Run preconfigured application */ App::f3()->run(); /* Log end of command chain */ App::log(App::SEVERITY_TRACE, "End of Request => Success\n");
/** * index action * * Send status "400 Bad Request!" */ public function index() { \App::log(\App::SEVERITY_NOTICE, "Access to Home/index action"); \App::f3()->error(400); }