From 3a6aab67d5d6c61604792534ad0d638a7cd3f369 Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 13 Sep 2017 14:32:50 +0200 Subject: [PATCH] * moved account.create and news.archive to twig * added new configurable date_timezone --- config.php | 3 +- system/init.php | 1 + system/pages/createaccount.php | 323 ++----------------- system/pages/news.php | 28 +- system/templates/account.create.html.twig | 162 ++++++++++ system/templates/account.create.js.html.twig | 131 ++++++++ system/templates/news.archive.html.twig | 21 ++ 7 files changed, 351 insertions(+), 318 deletions(-) create mode 100644 system/templates/account.create.html.twig create mode 100644 system/templates/account.create.js.html.twig create mode 100644 system/templates/news.archive.html.twig diff --git a/config.php b/config.php index 79eafde6..ba12e164 100644 --- a/config.php +++ b/config.php @@ -231,7 +231,8 @@ $config = array( 'google_analytics_id' => '', // e.g.: UA-XXXXXXX-X 'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level) 'experiencetable_rows' => 100, // till how many levels in one column - + 'date_timezone' => 'Europe/Berlin', + 'monsters' => array(), 'npc' => array() ); diff --git a/system/init.php b/system/init.php index 29abf443..d41315ba 100644 --- a/system/init.php +++ b/system/init.php @@ -14,6 +14,7 @@ require_once(BASE . 'config.php'); if(file_exists(BASE . 'config.local.php')) // user customizations require(BASE . 'config.local.php'); +date_default_timezone_set($config['date_timezone']); // take care of trailing slash at the end if($config['server_path'][strlen($config['server_path']) - 1] != '/') $config['server_path'] .= '/'; diff --git a/system/pages/createaccount.php b/system/pages/createaccount.php index 9a7d34b2..710b46dc 100644 --- a/system/pages/createaccount.php +++ b/system/pages/createaccount.php @@ -21,6 +21,7 @@ if($logged) return; } +$errors = array(); $step = isset($_POST['step']) ? $_POST['step'] : ''; if($step == 'save') { @@ -250,139 +251,6 @@ If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore } } -?> - -render('error_box.html.twig', array('errors' => $errors)); -?> -To play on you need an account. -All you have to do to create your new account is to enter an account , password and your email address. -Also you have to agree to the terms presented below. If you have done so, your account will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.

-
-
- -
-
- - - - -
Create Account
- - - - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- >Account : - - - -
- >Email Address: - - - -
- >Country: - - - - -
- >Password: - - -
- >Repeat password: - - -
- >Verification: - -
-

Please select all of the following check boxes:
- /> -
- -
-
-

- - - - -
- - - - - -
- -
-
-
- -
-
-
-
- -' . $errors[$field] . ''; -} + echo $twig->render('account.create.js.html.twig'); + echo $twig->render('account.create.html.twig', array( + 'account' => isset($_POST['account']) ? $_POST['account'] : '', + 'email' => isset($_POST['email']) ? $_POST['email'] : '', + 'countries' => isset($countries) ? $countries : null, + 'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false, + 'country_recognized' => $country_recognized, + 'errors' => $errors + )); ?> \ No newline at end of file diff --git a/system/pages/news.php b/system/pages/news.php index 0bb32135..b213f2e0 100644 --- a/system/pages/news.php +++ b/system/pages/news.php @@ -78,15 +78,11 @@ if(isset($_GET['archive'])) return; } ?> - - - - - + query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE type = 1 AND hidden != 1 ORDER BY date DESC'); + $newses = array(); + $news_DB = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE `type` = 1 AND `hidden` != 1 ORDER BY `date` DESC'); foreach($news_DB as $news) { $link = internalLayoutLink('news'); @@ -94,13 +90,19 @@ if(isset($_GET['archive'])) $link .= '/archive/' . $news['id']; else $link .= 'archive&id=' . $news['id']; - - echo ''; - - $i++; + + $newses[] = array( + 'link' => $link, + 'icon_id' => $categories[$news['category']]['icon_id'], + 'title' => stripslashes($news['title']), + 'date' => $news['date'] + ); } - - echo '
News archives
'.date("j.n.Y", $news['date']).''.stripslashes($news['title']).'
'; + + echo $twig->render('news.archive.html.twig', array( + 'newses' => $newses + )); + return; } diff --git a/system/templates/account.create.html.twig b/system/templates/account.create.html.twig new file mode 100644 index 00000000..6c62fcea --- /dev/null +++ b/system/templates/account.create.html.twig @@ -0,0 +1,162 @@ +To play on {{ config.lua.serverName }} you need an account. +All you have to do to create your new account is to enter an account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %}, password{% if config.recaptcha_enabled %}, confirm reCAPTCHA{% endif %}{% if config.account_country %}, country{% endif %} and your email address. +Also you have to agree to the terms presented below. If you have done so, your account {% if constant('USE_ACCOUNT_NAME') %}name{% else %}number{% endif %} will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.

+
+
+ +
+
+ + + + +
Create Account
+ + + + +
+
+ +
+
+ + + + + + {% if errors.account is defined %} + + {% endif %} + + + + + {% if errors.email is defined %} + + {% endif %} + {% if config.account_country %} + + + + + {% if errors.country is defined %} + + {% endif %} + {% endif %} + + + + + {% if errors.password is defined %} + + {% endif %} + + + + + {% if errors.password is defined %} + + {% endif %} + {% if config.recaptcha_enabled %} + + + + + {% if errors.verification is defined %} + + {% endif %} + {% endif %} + + + + + + + + + + {% if errors.accept_rules is defined %} + + + + {% endif %} +
+ Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}: + + + +
{{ errors.account }}
+ Email Address: + + + +
{{ errors.email }}
+ Country: + + + + +
{{ errors.country }}
+ Password: + + +
{{ errors.password }}
+ Repeat password: + + +
{{ errors.password }}
+ Verification: + +
+
{{ errors.verification }}

Please select all of the following check boxes:
+ +
+ {{ errors.accept_rules }} +
+
+

+ + + + +
+ + + + +
+ +
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/system/templates/account.create.js.html.twig b/system/templates/account.create.js.html.twig new file mode 100644 index 00000000..00927194 --- /dev/null +++ b/system/templates/account.create.js.html.twig @@ -0,0 +1,131 @@ + \ No newline at end of file diff --git a/system/templates/news.archive.html.twig b/system/templates/news.archive.html.twig new file mode 100644 index 00000000..fbb73c16 --- /dev/null +++ b/system/templates/news.archive.html.twig @@ -0,0 +1,21 @@ + + + + + + {% set i = 0 %} + {% for news in newses %} + {% set i = i + 1 %} + + + + + + {% endfor %} +
News archive
+
+ +
+
{{ news.date|date('j.n.Y') }} + {{ news.title }} +
\ No newline at end of file