aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/main.php
diff options
context:
space:
mode:
Diffstat (limited to 'ratatoeskr/main.php')
-rw-r--r--ratatoeskr/main.php55
1 files changed, 26 insertions, 29 deletions
diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php
index cbeeb29..7599231 100644
--- a/ratatoeskr/main.php
+++ b/ratatoeskr/main.php
@@ -10,8 +10,9 @@
*/
require_once(dirname(__FILE__) . "/config.php");
-if(!CONFIG_FILLED_OUT)
+if (!CONFIG_FILLED_OUT) {
die("Config file not filled out!");
+}
require_once(dirname(__FILE__) . "/sys/db.php");
require_once(dirname(__FILE__) . "/sys/models.php");
@@ -22,21 +23,19 @@ require_once(dirname(__FILE__) . "/sys/plugin_api.php");
require_once(dirname(__FILE__) . "/frontend.php");
require_once(dirname(__FILE__) . "/backend.php");
-$plugin_objs = array();
+$plugin_objs = [];
function ratatoeskr()
{
global $ste;
- try
- {
+ try {
_ratatoeskr();
- }
- catch(Exception $e)
- {
+ } catch (Exception $e) {
header("HTTP/1.1 500 Internal Server Error");
$ste->vars["title"] = "500 Internal Server Error";
- if(__DEBUG__)
+ if (__DEBUG__) {
$ste->vars["details"] = $e->__toString();
+ }
echo $ste->exectemplate("/systemtemplates/error.html");
}
}
@@ -45,33 +44,32 @@ function _ratatoeskr()
{
global $backend_subactions, $ste, $url_handlers, $ratatoeskr_settings, $plugin_objs, $api_compat;
- $ts_start = microtime(True);
+ $ts_start = microtime(true);
session_start();
db_connect();
clean_database();
- if(isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"])
- define("__DEBUG__", True);
+ if (isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"]) {
+ define("__DEBUG__", true);
+ }
- if(PLUGINS_ENABLED)
- {
- $activeplugins = array_filter(Plugin::all(), function($plugin) { return $plugin->active; });
- foreach($activeplugins as $plugin)
- {
- if(!in_array($plugin->api, $api_compat))
- {
- $plugin->active = False;
+ if (PLUGINS_ENABLED) {
+ $activeplugins = array_filter(Plugin::all(), function ($plugin) {
+ return $plugin->active;
+ });
+ foreach ($activeplugins as $plugin) {
+ if (!in_array($plugin->api, $api_compat)) {
+ $plugin->active = false;
$plugin->save();
continue;
}
eval($plugin->code);
$plugin_obj = new $plugin->classname($plugin->get_id());
- if($plugin->update)
- {
+ if ($plugin->update) {
$plugin_obj->update();
- $plugin->update = False;
+ $plugin->update = false;
$plugin->save();
}
$plugin_obj->init();
@@ -85,8 +83,7 @@ function _ratatoeskr()
register_url_handler("_index", "frontend_url_handler");
register_url_handler("index", "frontend_url_handler");
register_url_handler("backend", $backend_subactions);
- register_url_handler("_notfound", url_action_simple(function($data)
- {
+ register_url_handler("_notfound", url_action_simple(function ($data) {
global $ste;
header("HTTP/1.1 404 Not Found");
$ste->vars["title"] = "404 Not Found";
@@ -95,17 +92,17 @@ function _ratatoeskr()
}));
$urlpath = explode("/", @$_GET["action"]);
- $rel_path_to_root = implode("/", array_merge(array("."), array_repeat("..", count($urlpath) - 1)));
+ $rel_path_to_root = implode("/", array_merge(["."], array_repeat("..", count($urlpath) - 1)));
$GLOBALS["rel_path_to_root"] = $rel_path_to_root;
- $data = array("rel_path_to_root" => $rel_path_to_root);
+ $data = ["rel_path_to_root" => $rel_path_to_root];
$ste->vars["rel_path_to_root"] = $rel_path_to_root;
url_process($urlpath, $url_handlers, $data);
- if(PLUGINS_ENABLED)
- {
- foreach($plugin_objs as $plugin_obj)
+ if (PLUGINS_ENABLED) {
+ foreach ($plugin_objs as $plugin_obj) {
$plugin_obj->atexit();
+ }
}
$ratatoeskr_settings->save();
}