From a36e46d44db24622eeed4438342dfdbd98a28727 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sat, 21 Jan 2012 22:00:33 +0100 Subject: Setup script and clean config file. --- ratatoeskr/cms_style/images/R7r.png | Bin 0 -> 17440 bytes ratatoeskr/cms_style/images/R7r.svg | 6727 ++++++++++++++++++++ ratatoeskr/cms_style/images/r7rlogo_dropshadow.png | Bin 0 -> 14007 bytes ratatoeskr/cms_style/images/setup_topgrad.png | Bin 0 -> 409 bytes ratatoeskr/cms_style/setup.css | 49 + ratatoeskr/config.php | 13 +- ratatoeskr/main.php | 4 + ratatoeskr/setup/create_tables.php | 86 +- ratatoeskr/setup/setup.php | 245 + ratatoeskr/sys/db.php | 14 +- ratatoeskr/sys/translation.php | 18 +- .../src/systemtemplates/setup_dbsetup.html | 41 + .../templates/src/systemtemplates/setup_done.html | 14 + .../src/systemtemplates/setup_master.html | 14 + .../src/systemtemplates/setup_select_lang.html | 11 + ratatoeskr/templates/src/usertemplates/master.html | 43 + .../templates/src/usertemplates/some_useful_tags | 20 + .../templates/src/usertemplates/standard.html | 72 + ratatoeskr/translations/de.php | 13 + ratatoeskr/translations/en.php | 13 + setup.php | 204 + 21 files changed, 7550 insertions(+), 51 deletions(-) create mode 100644 ratatoeskr/cms_style/images/R7r.png create mode 100644 ratatoeskr/cms_style/images/R7r.svg create mode 100644 ratatoeskr/cms_style/images/r7rlogo_dropshadow.png create mode 100644 ratatoeskr/cms_style/images/setup_topgrad.png create mode 100644 ratatoeskr/cms_style/setup.css create mode 100644 ratatoeskr/setup/setup.php create mode 100644 ratatoeskr/templates/src/systemtemplates/setup_dbsetup.html create mode 100644 ratatoeskr/templates/src/systemtemplates/setup_done.html create mode 100644 ratatoeskr/templates/src/systemtemplates/setup_master.html create mode 100644 ratatoeskr/templates/src/systemtemplates/setup_select_lang.html create mode 100644 ratatoeskr/templates/src/usertemplates/master.html create mode 100644 ratatoeskr/templates/src/usertemplates/some_useful_tags create mode 100644 ratatoeskr/templates/src/usertemplates/standard.html create mode 100644 setup.php diff --git a/ratatoeskr/cms_style/images/R7r.png b/ratatoeskr/cms_style/images/R7r.png new file mode 100644 index 0000000..d853c0f Binary files /dev/null and b/ratatoeskr/cms_style/images/R7r.png differ diff --git a/ratatoeskr/cms_style/images/R7r.svg b/ratatoeskr/cms_style/images/R7r.svg new file mode 100644 index 0000000..4fa2d9f --- /dev/null +++ b/ratatoeskr/cms_style/images/R7r.svg @@ -0,0 +1,6727 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ratatoeskr/cms_style/images/r7rlogo_dropshadow.png b/ratatoeskr/cms_style/images/r7rlogo_dropshadow.png new file mode 100644 index 0000000..41d2b2a Binary files /dev/null and b/ratatoeskr/cms_style/images/r7rlogo_dropshadow.png differ diff --git a/ratatoeskr/cms_style/images/setup_topgrad.png b/ratatoeskr/cms_style/images/setup_topgrad.png new file mode 100644 index 0000000..f49eb7f Binary files /dev/null and b/ratatoeskr/cms_style/images/setup_topgrad.png differ diff --git a/ratatoeskr/cms_style/setup.css b/ratatoeskr/cms_style/setup.css new file mode 100644 index 0000000..57e9155 --- /dev/null +++ b/ratatoeskr/cms_style/setup.css @@ -0,0 +1,49 @@ +* { + font-family: sans-serif; + font-size: 10pt; +} + +body, html { + padding: 0px; + margin:0px; +} + +body { + background: #f2f2f2 url(images/setup_topgrad.png) top left repeat-x; +} + +h1 { + margin: 17px auto 5mm; + padding: 0px; + text-align: center; + top: 0px; + left: 0px; +} + +h2 { + font-size: 12pt; + font-weight: bold; + padding:0px; + margin: 5mm auto 2mm; +} + +h1 img { + margin: 0px auto 0px; + padding: 0px; +} + +#content { + width: 80%; + margin: 0px auto 10mm; + text-align: center; +} + +div.error { + border: 1px solid #8d8d8d; + background: #ddd url(images/error.png) no-repeat top left; + min-height: 40px; + color: #222; + padding: 1em; + margin: 3mm 0mm 3mm; + text-align: center; +} diff --git a/ratatoeskr/config.php b/ratatoeskr/config.php index ae48950..2b58921 100644 --- a/ratatoeskr/config.php +++ b/ratatoeskr/config.php @@ -1,12 +1,13 @@ diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php index 1e5445a..9e4f08a 100644 --- a/ratatoeskr/main.php +++ b/ratatoeskr/main.php @@ -9,6 +9,10 @@ * See "ratatoeskr/licenses/ratatoeskr" for more information. */ +require_once(dirname(__FILE__) . "/config.php"); +if(!CONFIG_FILLED_OUT) + die("Config file not filled out!"); + require_once(dirname(__FILE__) . "/sys/db.php"); require_once(dirname(__FILE__) . "/sys/models.php"); require_once(dirname(__FILE__) . "/sys/init_ste.php"); diff --git a/ratatoeskr/setup/create_tables.php b/ratatoeskr/setup/create_tables.php index 0f2f6b5..1c9e67b 100644 --- a/ratatoeskr/setup/create_tables.php +++ b/ratatoeskr/setup/create_tables.php @@ -1,10 +1,12 @@ diff --git a/ratatoeskr/setup/setup.php b/ratatoeskr/setup/setup.php new file mode 100644 index 0000000..0eb6d83 --- /dev/null +++ b/ratatoeskr/setup/setup.php @@ -0,0 +1,245 @@ +vars["rel_path_to_root"] = $rel_path_to_root; + +$ste->vars["translations"] = array(); +foreach($languages as $langcode => $langinfo) +{ + if($langinfo["translation_exist"]) + $ste->vars["translations"][$langcode] = $langinfo["language"]; +} + +if(isset($_GET["lang"]) and (@$languages[$_GET["lang"]]["translation_exist"])) +{ + load_language($_GET["lang"]); + $lang = $_GET["lang"]; + $ste->vars["lang"] = $_GET["lang"]; +} +else + die($ste->exectemplate("/systemtemplates/setup_select_lang.html")); + +if(isset($_POST["apply_setup"])) +{ + if(empty($_POST["admin_username"]) or empty($_POST["admin_init_password"])) + $ste->vars["error"] = $translation["admin_data_must_be_filled_out"]; + else + { + $config["mysql"]["server"] = $_POST["mysql_host"]; + $config["mysql"]["db"] = $_POST["mysql_database"]; + $config["mysql"]["user"] = $_POST["mysql_user"]; + $config["mysql"]["passwd"] = $_POST["mysql_password"]; + $config["mysql"]["prefix"] = $_POST["table_prefix"]; + + try + { + db_connect(); + create_mysql_tables(); + + /* Writing some demo data to database */ + require_once(dirname(__FILE__) . "/../sys/models.php"); + + $ratatoeskr_settings["default_language"] = $lang; + $ratatoeskr_settings["comment_visible_defaut"] = True; + $ratatoeskr_settings["allow_comments_default"] = True; + $ratatoeskr_settings["comment_textprocessor"] = "Markdown"; + $ratatoeskr_settings["languages"] = $lang == "en" ? array("en") : array($lang, "en"); + $ratatoeskr_settings["last_db_cleanup"] = time(); + + $style = Style::create("default"); + $style->code = <<