You have requested to change your email address to '.$email_new.'. The actual change will take place after '.date("j F Y, G:i:s", $email_new_time).', during which you can cancel the request at any time.
Do you accept '.$email_new.' as your new email adress?
';
+ $custom_buttons = '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+ echo $twig->render('success.html.twig', array(
+ 'title' => 'Email Address Change Accepted',
+ 'description' => 'Do you accept '.$email_new.' as your new email adress?',
+ 'custom_buttons' => $custom_buttons
+ ));
}
}
else
{
- echo '
Change of Email Address
A request has been submitted to change the email address of this account to '.$email_new.'. The actual change will take place on '.date("j F Y, G:i:s", $email_new_time).'. If you do not want to change your email address, please click on "Cancel".
';
+ $custom_buttons = '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+ echo $twig->render('success.html.twig', array(
+ 'title' => 'Change of Email Address',
+ 'description' => 'A request has been submitted to change the email address of this account to '.$email_new.'. The actual change will take place on '.date("j F Y, G:i:s", $email_new_time).'. If you do not want to change your email address, please click on "Cancel".',
+ 'custom_buttons' => $custom_buttons
+ ));
}
}
if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) {
$account_logged->setCustomField("email_new", "");
$account_logged->setCustomField("email_new_time", 0);
- echo '
Email Address Change Cancelled
Your request to change the email address of your account has been cancelled. The email address will not be changed.
';
- if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - recovery key", $mailBody))
- echo ' Your recovery key were send on email address '.$account_logged->getEMail().'.';
+ $mailBody = $twig->render('mail.account.register.html.twig', array(
+ 'recovery_key' => $new_rec_key
+ ));
+ if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - Recovery Key", $mailBody))
+ $message = ' Your recovery key were send on email address '.$account_logged->getEMail().'.';
else
- echo '
An error occorred while sending email with recovery key! You will not receive e-mail with this key. Error: ' . $mailer->ErrorInfo . '
';
+ $message = '
An error occorred while sending email with recovery key! You will not receive e-mail with this key. Error: ' . $mailer->ErrorInfo . '
';
}
- echo '
';
+ echo $twig->render('success.html.twig', array(
+ 'title' => 'Account Registered',
+ 'description' => 'Thank you for registering your account! You can now recover your account if you have lost access to the assigned email address by using the following
'
+ ));
}
else
- $reg_errors[] = 'You need '.$config['generate_new_reckey_price'].' premium points to generate new recovery key. You have '.$points.' premium points.';
+ $errors[] = 'You need '.$config['generate_new_reckey_price'].' premium points to generate new recovery key. You have '.$points.' premium points.';
}
else
- $reg_errors[] = 'Wrong password to account.';
+ $errors[] = 'Wrong password to account.';
}
- if(!$dontshowtableagain)
+
+ //show errors if not empty
+ if(!empty($errors)) {
+ echo $twig->render('error_box.html.twig', array('errors' => $errors));
+ }
+
+ if($show_form)
{
- //show errors if not empty
- if(!empty($reg_errors)) {
- echo $twig->render('error_box.html.twig', array('errors' => $reg_errors));
- }
//show form
- echo 'To generate NEW recovery key for your account please enter your password. New recovery key cost '.$config['generate_new_reckey_price'].' Premium Points. You have '.$points.' premium points. You will receive e-mail with this recovery key.
Edit Character Information
Name:
'.$player_name.'
Hide Account:
-
-
- getCustomField("hidden") == 1 ? ' checked="checked"' : '') . '>
- ';
- if((int)$player->getCustomField('group_id') > 1)
- echo ' (you will be also hidden on the Team page!)';
-
- echo '
Comment:
[max. length: 2000 chars, 50 lines (ENTERs)]
';
+ echo $twig->render('account.change_comment.html.twig', array(
+ 'player' => $player,
+ 'player_name' => $player_name
+ ));
}
}
else
@@ -503,11 +587,10 @@ if(!$logged)
if($action == "changename") {
echo '';
- $name_changed = false;
$player_id = isset($_POST['player_id']) ? (int)$_POST['player_id'] : NULL;
$name = isset($_POST['name']) ? stripslashes(ucwords(strtolower($_POST['name']))) : NULL;
if((!$config['account_change_character_name']))
- echo 'You cant change your character name';
+ echo 'Changing character name for premium points is disabled on this server.';
else
{
$points = $account_logged->getCustomField('premium_points');
@@ -516,12 +599,18 @@ if(!$logged)
$errors[] = 'You need ' . $config['account_change_character_name_points'] . ' premium points to change name. You have '.$points.' premium points.';
if(empty($errors) && empty($name))
- $errors[] = 'Please enter a name for your character!';
-
- if(empty($errors) && strlen($name) > 25)
+ $errors[] = 'Please enter a new name for your character!';
+ else if(strlen($name) > 25)
$errors[] = 'Name is too long. Max. lenght 25 letters.';
- else if(empty($errors) && strlen($name) < 3)
- $errors[] = 'Name is too short. Min. lenght 25 letters.';
+ else if(strlen($name) < 3)
+ $errors[] = 'Name is too short. Min. lenght 3 letters.';
+ else {
+ $exist = new OTS_Player();
+ $exist->find($name);
+ if($exist->isLoaded()) {
+ $errors[] = 'Character with this name already exist.';
+ }
+ }
if(empty($errors))
{
@@ -531,7 +620,7 @@ if(!$logged)
}
if(empty($errors)) {
- $player = $ots->createObject('Player');
+ $player = new OTS_Player();
$player->load($player_id);
if($player->isLoaded()) {
$player_account = $player->getAccount();
@@ -541,7 +630,7 @@ if(!$logged)
}
if(empty($errors)) {
- $name_changed = true;
+ $show_form = false;
$old_name = $player->getName();
$player->setName($name);
$player->save();
@@ -563,34 +652,15 @@ if(!$logged)
}
}
- if(!$name_changed) {
+ if($show_form) {
if(!empty($errors)) {
echo $twig->render('error_box.html.twig', array('errors' => $errors));
}
- echo 'To change a name of character select player and choose a new name.
- Change name cost ' . $config['account_change_character_name_points'] . ' premium points. You have ' . $points . ' premium points.
-
-
-
- THREAD: '.$post['post_topic'].'
- AUTHOR: '.$name[0].'
- BOARD: '.$sections[$post['section']]['name'].'
- Select the new board:
-
-
-
';*/
}
}
else
@@ -732,4 +793,98 @@ class Forum
static public function isModerator() {
return hasFlag(FLAG_CONTENT_FORUM) || admin();
}
+
+ static public function add_board($name, $description, &$errors)
+ {
+ global $db;
+ if(isset($name[0]) && isset($description[0]))
+ {
+ $query = $db->select(TABLE_PREFIX . 'forum_boards', array('name' => $name));
+
+ if($query === false)
+ {
+ $query =
+ $db->query(
+ 'SELECT ' . $db->fieldName('ordering') .
+ ' FROM ' . $db->tableName(TABLE_PREFIX . 'forum_boards') .
+ ' ORDER BY ' . $db->fieldName('ordering') . ' DESC LIMIT 1'
+ );
+
+ $ordering = 0;
+ if($query->rowCount() > 0) {
+ $query = $query->fetch();
+ $ordering = $query['ordering'] + 1;
+ }
+ $db->insert(TABLE_PREFIX . 'forum_boards', array('name' => $name, 'description' => $description, 'ordering' => $ordering));
+ }
+ else
+ $errors[] = 'Forum board with this name already exists.';
+ }
+ else
+ $errors[] = 'Please fill all inputs.';
+
+ return !count($errors);
+ }
+
+ static public function get_board($id) {
+ global $db;
+ return $db->select(TABLE_PREFIX . 'forum_boards', array('id' => $id));
+ }
+
+ static public function update_board($id, $name, $description) {
+ global $db;
+ $db->update(TABLE_PREFIX . 'forum_boards', array('name' => $name, 'description' => $description), array('id' => $id));
+ }
+
+ static public function delete_board($id, &$errors)
+ {
+ global $db;
+ if(isset($id))
+ {
+ if(self::get_board($id) !== false)
+ $db->delete(TABLE_PREFIX . 'forum_boards', array('id' => $id));
+ else
+ $errors[] = 'Forum board with id ' . $id . ' does not exists.';
+ }
+ else
+ $errors[] = 'id not set';
+
+ return !count($errors);
+ }
+
+ static public function toggleHidden_board($id, &$errors)
+ {
+ global $db;
+ if(isset($id))
+ {
+ $query = self::get_board($id);
+ if($query !== false)
+ $db->update(TABLE_PREFIX . 'forum_boards', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
+ else
+ $errors[] = 'Forum board with id ' . $id . ' does not exists.';
+ }
+ else
+ $errors[] = 'id not set';
+
+ return !count($errors);
+ }
+
+ static public function move_board($id, $i, &$errors)
+ {
+ global $db;
+ $query = self::get_board($id);
+ if($query !== false)
+ {
+ $ordering = $query['ordering'] + $i;
+ $old_record = $db->select(TABLE_PREFIX . 'forum_boards', array('ordering' => $ordering));
+ if($old_record !== false)
+ $db->update(TABLE_PREFIX . 'forum_boards', array('ordering' => $query['ordering']), array('ordering' => $ordering));
+
+ $db->update(TABLE_PREFIX . 'forum_boards', array('ordering' => $ordering), array('id' => $id));
+ }
+ else
+ $errors[] = 'Forum board with id ' . $id . ' does not exists.';
+
+ return !count($errors);
+ }
}
diff --git a/system/pages/news.php b/system/pages/news.php
index d37c2fe6..0bb32135 100644
--- a/system/pages/news.php
+++ b/system/pages/news.php
@@ -292,7 +292,7 @@ if(!$news_cached)
'account_players' => $account_players,
'category' => isset($category) ? $category : 0,
'categories' => $categories,
- 'forum_sections' => getForumSections(),
+ 'forum_boards' => getForumBoards(),
'forum_section' => isset($forum_section) ? $forum_section : null
));
}
diff --git a/system/templates/account.change_comment.html.twig b/system/templates/account.change_comment.html.twig
new file mode 100644
index 00000000..dde79b80
--- /dev/null
+++ b/system/templates/account.change_comment.html.twig
@@ -0,0 +1,113 @@
+Here you can see and edit the information about your character.
+If you do not want to specify a certain field, just leave it blank.
+
+
+
+
+
+
+
+
+
+
Edit Character Information
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Name:
+
{{ player_name }}
+
+
+
Hide Account:
+
+
+
+
+ {% if player.getCustomField('group_id') > 1 %} (you will be also hidden on the Team page!){% endif %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Comment:
+
[max. length: 2000 chars, 50 lines (ENTERs)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/system/templates/account.change_name.html.twig b/system/templates/account.change_name.html.twig
new file mode 100644
index 00000000..f0affbce
--- /dev/null
+++ b/system/templates/account.change_name.html.twig
@@ -0,0 +1,76 @@
+To change a name of character select player and choose a new name.
+Change name cost {{ config.account_change_character_name_points }} premium points. You have {{ points }} premium points.
+
+
+
+
+
+
+
+
+
+
+
Change Name
+
+
+
+
+
+
+
+
+
+
+
+
Character:
+
+
+
+
+
+
New Name:
+
+
+
+
Please enter your character name.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/system/templates/account.generate_new_recovery_key.html.twig b/system/templates/account.generate_new_recovery_key.html.twig
new file mode 100644
index 00000000..b65f0eb3
--- /dev/null
+++ b/system/templates/account.generate_new_recovery_key.html.twig
@@ -0,0 +1,61 @@
+To generate new recovery key for your account please enter your password.
+New recovery key cost {{ config.generate_new_reckey_price }} Premium Points. You have {{ points }} premium points. You will receive e-mail with this recovery key.
+
+
+
+
+
+
+
+
+
+
+
Generate recovery key
+
+
+
+
+
+
+
+
+
+
+
+
Password:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/system/templates/account.register.html.twig b/system/templates/account.generate_recovery_key.html.twig
similarity index 100%
rename from system/templates/account.register.html.twig
rename to system/templates/account.generate_recovery_key.html.twig
diff --git a/system/templates/commands.form.html.twig b/system/templates/commands.form.html.twig
index f6ba72be..6a7ded15 100644
--- a/system/templates/commands.form.html.twig
+++ b/system/templates/commands.form.html.twig
@@ -4,10 +4,10 @@
{% endif %}
\ No newline at end of file
diff --git a/system/templates/forum.boards.html.twig b/system/templates/forum.boards.html.twig
index 5685493a..532918b0 100644
--- a/system/templates/forum.boards.html.twig
+++ b/system/templates/forum.boards.html.twig
@@ -13,6 +13,11 @@
Last Post
+ {% if canEdit %}
+
+ Options
+
+ {% endif %}
{% set i = 0 %}
{% for board in boards %}
@@ -30,6 +35,29 @@
No posts
{% endif %}
+ {% if canEdit %}
+
\ No newline at end of file
diff --git a/system/templates/mail.account.register.html.twig b/system/templates/mail.account.register.html.twig
new file mode 100644
index 00000000..0b684b54
--- /dev/null
+++ b/system/templates/mail.account.register.html.twig
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/system/templates/news.add.html.twig b/system/templates/news.add.html.twig
index 54a48138..ac6f532d 100644
--- a/system/templates/news.add.html.twig
+++ b/system/templates/news.add.html.twig
@@ -96,7 +96,7 @@
+{% if custom_buttons is defined %}
+{{ custom_buttons|raw }}
+{% else %}
@@ -39,3 +42,4 @@
+{% endif %}
diff --git a/templates/kathrine/account.change_name.html.twig b/templates/kathrine/account.change_name.html.twig
new file mode 100644
index 00000000..704a0f0e
--- /dev/null
+++ b/templates/kathrine/account.change_name.html.twig
@@ -0,0 +1,44 @@
+To change a name of character select player and choose a new name.
+Change name cost {{ config.account_change_character_name_points }} premium points. You have {{ points }} premium points.