diff options
Diffstat (limited to 'ratatoeskr')
-rw-r--r-- | ratatoeskr/backend.php | 16 | ||||
-rw-r--r-- | ratatoeskr/frontend.php | 20 | ||||
-rw-r--r-- | ratatoeskr/main.php | 3 | ||||
-rw-r--r-- | ratatoeskr/setup/setup.php | 13 | ||||
-rw-r--r-- | ratatoeskr/sys/init_ste.php | 2 | ||||
-rw-r--r-- | ratatoeskr/sys/plugin_api.php | 2 | ||||
-rwxr-xr-x | ratatoeskr/templates/src/systemtemplates/backend_login.html | 2 | ||||
-rwxr-xr-x | ratatoeskr/templates/src/systemtemplates/master.html | 2 | ||||
-rw-r--r-- | ratatoeskr/templates/src/systemtemplates/settings.html | 4 | ||||
-rw-r--r-- | ratatoeskr/translations/de.php | 6 | ||||
-rw-r--r-- | ratatoeskr/translations/en.php | 6 |
11 files changed, 62 insertions, 14 deletions
diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index bf7bb44..6cf00cb 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -1276,6 +1276,21 @@ $backend_subactions = url_action_subactions(array( if($properties[1]) $ste->vars["textprocessors"][] = $txtproc; + /* Toggle debugmode value? */ + if(isset($_POST["toggle_debugmode"])) + { + if(isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"]) + { + $ratatoeskr_settings["debugmode"] = False; + $ste->vars["success"] = $translation["debugmode_now_disabled"]; + } + else + { + $ratatoeskr_settings["debugmode"] = True; + $ste->vars["success"] = $translation["debugmode_now_enabled"]; + } + } + /* Save comment settings? */ if(isset($_POST["save_comment_settings"])) { @@ -1328,6 +1343,7 @@ $backend_subactions = url_action_subactions(array( } } + $ste->vars["debugmode_enabled"] = (isset($ratatoeskr_settings["debugmode"]) and $ratatoeskr_settings["debugmode"]); $ste->vars["comment_auto_visible"] = $ratatoeskr_settings["comment_visible_default"]; $ste->vars["comment_textprocessor"] = $ratatoeskr_settings["comment_textprocessor"]; $ste->vars["used_langs"] = array_map(function ($l) use ($ratatoeskr_settings, $languages) { return array( diff --git a/ratatoeskr/frontend.php b/ratatoeskr/frontend.php index 57ada3f..7198c09 100644 --- a/ratatoeskr/frontend.php +++ b/ratatoeskr/frontend.php @@ -172,7 +172,7 @@ $ste->register_tag("articles_get", function($ste, $params, $sub) $lang = $ste->vars["language"]; if(!isset($params["var"])) - throw new Exception("Parameter var is needed in article_get!"); + throw new \ste\RuntimeError("Parameter var is needed in article_get!"); if(isset($params["section"])) { try @@ -253,7 +253,7 @@ $ste->register_tag("section_list", function($ste, $params, $sub) $default_section = $ratatoeskr_settings["default_section"]; if(!isset($params["var"])) - throw new Exception("Parameter var is needed in article_get!"); + throw new \ste\RuntimeException("Parameter var is needed in article_get!"); $result = Section::all(); @@ -295,7 +295,7 @@ $ste->register_tag("section_list", function($ste, $params, $sub) $ste->register_tag("article_comments_count", function($ste, $params, $sub) { if(!isset($params["article"])) - throw new Exception("Need parameter 'article' in ste:article_comments_count."); + throw new \ste\RuntimeException("Need parameter 'article' in ste:article_comments_count."); $tpl_article = $ste->get_var_reference($params["article"], False); $lang = $ste->vars["language"]; @@ -336,9 +336,9 @@ $ste->register_tag("article_comments_count", function($ste, $params, $sub) $ste->register_tag("article_comments", function($ste, $params, $sub) { if(!isset($params["var"])) - throw new Exception("Need parameter 'var' in ste:article_comments."); + throw new \ste\RuntimeException("Need parameter 'var' in ste:article_comments."); if(!isset($params["article"])) - throw new Exception("Need parameter 'article' in ste:article_comments."); + throw new \ste\RuntimeException("Need parameter 'article' in ste:article_comments."); $tpl_article = $ste->get_var_reference($params["article"], False); $lang = $ste->vars["language"]; @@ -410,7 +410,7 @@ $ste->register_tag("comment_form", function($ste, $params, $sub) { global $translation; if(!isset($params["article"])) - throw new Exception("Need parameter 'article' in ste:comment_form."); + throw new \ste\RuntimeException("Need parameter 'article' in ste:comment_form."); $tpl_article = $ste->get_var_reference($params["article"], False); if(isset($tpl_article["__obj"])) @@ -478,9 +478,9 @@ $ste->register_tag("page_prev", function($ste, $params, $sub) { global $translation; if(!isset($params["current"])) - throw new Exception("Need parameter 'current' in ste:page_prev."); + throw new \ste\RuntimeException("Need parameter 'current' in ste:page_prev."); if(!isset($params["maxpage"])) - throw new Exception("Need parameter 'maxpage' in ste:page_prev."); + throw new \ste\RuntimeException("Need parameter 'maxpage' in ste:page_prev."); if($params["current"] == 1) return ""; @@ -495,9 +495,9 @@ $ste->register_tag("page_next", function($ste, $params, $sub) { global $translation; if(!isset($params["current"])) - throw new Exception("Need parameter 'current' in ste:page_next."); + throw new \ste\RuntimeException("Need parameter 'current' in ste:page_next."); if(!isset($params["maxpage"])) - throw new Exception("Need parameter 'maxpage' in ste:page_next."); + throw new \ste\RuntimeException("Need parameter 'maxpage' in ste:page_next."); if($params["current"] == $params["maxpage"]) return ""; diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php index 2a424e7..f1a641f 100644 --- a/ratatoeskr/main.php +++ b/ratatoeskr/main.php @@ -51,6 +51,9 @@ function _ratatoeskr() db_connect(); clean_database(); + 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; }); diff --git a/ratatoeskr/setup/setup.php b/ratatoeskr/setup/setup.php index 0eb6d83..86478ed 100644 --- a/ratatoeskr/setup/setup.php +++ b/ratatoeskr/setup/setup.php @@ -54,6 +54,7 @@ if(isset($_POST["apply_setup"])) $ratatoeskr_settings["comment_textprocessor"] = "Markdown"; $ratatoeskr_settings["languages"] = $lang == "en" ? array("en") : array($lang, "en"); $ratatoeskr_settings["last_db_cleanup"] = time(); + $ratatoeskr_settings["debugmode"] = False; $style = Style::create("default"); $style->code = <<<STYLE @@ -227,6 +228,16 @@ STYLE; $article->allow_comments = True; $article->set_section($section); $article->save(); + + try + { + Repository::create("http://repo-community.ratatoeskr-cms.net/"); + Repository::create("http://repo-official.ratatoeskr-cms.net/"); + } + catch(RepositoryUnreachableOrInvalid $e) + { + $ste->vars["notice"] = $translation["could_not_initialize_repos"]; + } /* Almost done. Give the user the config file. */ $config = "<?php\n\ndefine(\"__DEBUG__\", False);\ndefine(\"CONFIG_FILLED_OUT\", True);\ndefine(\"PLUGINS_ENABLED\", True);\n\n\$config[\"mysql\"][\"server\"] = '" . addcslashes($config["mysql"]["server"], "'") . "';\n\$config[\"mysql\"][\"db\"] = '" . addcslashes($config["mysql"]["db"], "'") . "';\n\$config[\"mysql\"][\"user\"] = '" . addcslashes($config["mysql"]["user"], "'") . "';\n\$config[\"mysql\"][\"passwd\"] = '" . addcslashes($config["mysql"]["passwd"], "'") . "';\n\$config[\"mysql\"][\"prefix\"] = '" . addcslashes($config["mysql"]["prefix"], "'") . "';\n\n?>"; @@ -242,4 +253,4 @@ STYLE; echo $ste->exectemplate("/systemtemplates/setup_dbsetup.html"); -?> +?>
\ No newline at end of file diff --git a/ratatoeskr/sys/init_ste.php b/ratatoeskr/sys/init_ste.php index f13eeb8..ae5cb95 100644 --- a/ratatoeskr/sys/init_ste.php +++ b/ratatoeskr/sys/init_ste.php @@ -23,6 +23,8 @@ if(!isset($ste)) * The global STECore (Stupid Template Engine) instance. */ $ste = new \ste\STECore(new \ste\FilesystemStorageAccess("$tpl_basedir/src", "$tpl_basedir/transc")); + if(__DEBUG__) + $ste->mute_runtime_errors = False; } $ste->register_tag( diff --git a/ratatoeskr/sys/plugin_api.php b/ratatoeskr/sys/plugin_api.php index c592db3..f6d1c2d 100644 --- a/ratatoeskr/sys/plugin_api.php +++ b/ratatoeskr/sys/plugin_api.php @@ -167,7 +167,7 @@ abstract class RatatoeskrPlugin * * Parameters: * $label - The label for the page. - * $fx - A function for <urlprocess>. + * $fx - A function for <url_process>. * * Your $fx should output output the result of a STE template, which should load "/systemtemplates/master.html" and overwrite the "content" section. * diff --git a/ratatoeskr/templates/src/systemtemplates/backend_login.html b/ratatoeskr/templates/src/systemtemplates/backend_login.html index bf7c1fc..4e38704 100755 --- a/ratatoeskr/templates/src/systemtemplates/backend_login.html +++ b/ratatoeskr/templates/src/systemtemplates/backend_login.html @@ -9,7 +9,7 @@ <body> <img id="background_image" src="$rel_path_to_root/ratatoeskr/cms_style/images/login_bg.jpg" alt="" /> <div id="main"> - <div id="bar_top"><strong>Ratatöskr</strong>::Noctilucent clouds (v. 0.1 β 2)</div> + <div id="bar_top"><strong>Ratatöskr</strong>::Noctilucent clouds (v. 0.1 β 3)</div> <div class="vcenter_outer"><div class="vcenter_inner"> <div id="login_box"> <h1><ste:get_translation for="login_form_header" /></h1> diff --git a/ratatoeskr/templates/src/systemtemplates/master.html b/ratatoeskr/templates/src/systemtemplates/master.html index 793803e..23905e8 100755 --- a/ratatoeskr/templates/src/systemtemplates/master.html +++ b/ratatoeskr/templates/src/systemtemplates/master.html @@ -31,7 +31,7 @@ </head> <body> <div id="bar_top"> - <span class="branding"><strong>Ratatöskr</strong>::Noctilucent clouds (v. 0.1 β 2)</span> + <span class="branding"><strong>Ratatöskr</strong>::Noctilucent clouds (v. 0.1 β 3)</span> <span class="user"> <a href="$rel_path_to_root/backend/admin/users/u/$user[id]">$user[name]</a> | <a href="$rel_path_to_root/backend/logout"><ste:get_translation for="logout" /></a> </span> diff --git a/ratatoeskr/templates/src/systemtemplates/settings.html b/ratatoeskr/templates/src/systemtemplates/settings.html index 63bb0cb..b7fee48 100644 --- a/ratatoeskr/templates/src/systemtemplates/settings.html +++ b/ratatoeskr/templates/src/systemtemplates/settings.html @@ -5,6 +5,10 @@ <ste:default_success /> <form action="$rel_path_to_root/backend/admin/settings" method="post" accept-charset="UTF-8"> + <ste:get_translation for="debugmode" />: <input type="submit" name="toggle_debugmode" value="?{$debugmode_enabled|<ste:get_translation for='enabled' />|<ste:get_translation for='disabled' />}" /> <ste:get_translation for="debugmode_might_get_overwritten_by_config_file" /> + </form> + + <form action="$rel_path_to_root/backend/admin/settings" method="post" accept-charset="UTF-8"> <h2><ste:get_translation for="comment_settings" /></h2> <strong><ste:get_translation for="comment_textprocessor" />:</strong> <ste:instant_select name="comment_textprocessor" array="textprocessors" selected="$comment_textprocessor" /><br /> <strong><ste:get_translation for="comment_auto_visible" />:</strong> <input type="checkbox" name="comment_auto_visible" value="yes"?{$comment_auto_visible| checked="checked"|} /><br /> diff --git a/ratatoeskr/translations/de.php b/ratatoeskr/translations/de.php index bc18a03..66c68d8 100644 --- a/ratatoeskr/translations/de.php +++ b/ratatoeskr/translations/de.php @@ -262,6 +262,12 @@ $translation = array( "could_not_activate_plugin_api_incompat" => "Konnte diese Plugins nicht aktivieren, da sie nicht (mehr) mit deiner Ratatöskr-Installation kompatibel sind: [[PLUGINS]]", "plugins_incompat" => "Diese Plugins sind nicht (mehr) mit deiner Ratatöskr-Installation kompatibel: [[PLUGINS]]", "could_not_initialize_repos" => "Setup ist abgeschlossen, allerdings konnten die Standard-Repositories nicht initalisiert werden.", + "debugmode" => "Debug-Modus", + "enabled" => "Aktiviert", + "disabled" => "Deaktiviert", + "debugmode_might_get_overwritten_by_config_file" => "(dies kann durch config.php überschrieben werden)", + "debugmode_now_enabled" => "Debug-Modus ist nun aktiviert", + "debugmode_now_disabled" => "Debug-Modus ist nun deaktiviert", /* Very long texts here */ "linking_back_hint" => <<<LINKINGBACK <h2>Verlinken auf die Seitenwurzel</h2> diff --git a/ratatoeskr/translations/en.php b/ratatoeskr/translations/en.php index 2d61ad7..27374c6 100644 --- a/ratatoeskr/translations/en.php +++ b/ratatoeskr/translations/en.php @@ -262,6 +262,12 @@ $translation = array( "could_not_activate_plugin_api_incompat" => "Could not activate these plugins, because they are not / no longer compatible with your Ratatöskr-installation: [[PLUGINS]]", "plugins_incompat" => "These plugins are not / no longer compatible with your Ratatöskr -installation: [[PLUGINS]]", "could_not_initialize_repos" => "Setup is completed, but the default repositories could not be initalized.", + "debugmode" => "Debugmode", + "enabled" => "Enabled", + "disabled" => "Disabled", + "debugmode_might_get_overwritten_by_config_file" => "(this can be overwritten by config.php)", + "debugmode_now_enabled" => "Debugmode now enabled", + "debugmode_now_disabled" => "Debugmode now disabled", /* Very long texts here */ "linking_back_hint" => <<<LINKINGBACK <h2>Linking back</h2> |