From 37502c5562e674ba776e1c43364f90ca20379ba2 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 31 Aug 2017 17:01:17 +0200 Subject: [PATCH] * moved more templates to Twig * now you can replace template in your main template, example is templates/kathrine/templates/success.html * removed output_errors, replace with template * some grammar fixes * moved some forum code to Twig templates * added movies link to tibiacom template --- system/functions.php | 22 -- system/init.php | 6 +- system/pages/accountmanagement.php | 300 +++++++----------- system/pages/admin/pages.php | 2 +- system/pages/characters.php | 4 +- system/pages/commands.php | 2 +- system/pages/createaccount.php | 21 +- system/pages/forum.php | 228 ++++++------- system/pages/movies.php | 6 +- system/pages/news.php | 2 +- system/pages/screenshots.php | 2 +- system/template.php | 2 + system/templates/account.change_info.html | 83 +++++ ...angemail.html => account.change_mail.html} | 0 ...word.html => account.change_password.html} | 0 system/templates/account.change_sex.html | 78 +++++ .../templates/account.delete_character.html | 68 ++++ system/templates/account.login.html | 18 +- system/templates/account.management.html | 6 +- ...{account.error_box.html => error_box.html} | 2 +- system/templates/forum.boards.html | 35 ++ system/templates/forum.move_thread.html | 34 ++ system/templates/forum.new_thread.html | 39 +++ ...angepassword.success.html => success.html} | 14 +- templates/kathrine/templates/success.html | 13 + templates/tibiacom/index.php | 9 +- 26 files changed, 631 insertions(+), 365 deletions(-) create mode 100644 system/templates/account.change_info.html rename system/templates/{account.changemail.html => account.change_mail.html} (100%) rename system/templates/{account.changepassword.html => account.change_password.html} (100%) create mode 100644 system/templates/account.change_sex.html create mode 100644 system/templates/account.delete_character.html rename system/templates/{account.error_box.html => error_box.html} (97%) create mode 100644 system/templates/forum.boards.html create mode 100644 system/templates/forum.move_thread.html create mode 100644 system/templates/forum.new_thread.html rename system/templates/{account.changepassword.success.html => success.html} (72%) create mode 100644 templates/kathrine/templates/success.html diff --git a/system/functions.php b/system/functions.php index c3e5f91a..98e18313 100644 --- a/system/functions.php +++ b/system/functions.php @@ -751,28 +751,6 @@ function news_place() return $news; } -function output_errors($errors) -{ - global $template_path; -?> -
-
-
-
-
-
-
-
-
-
-
The Following Errors Have Occurred:
- $message) - echo $message . '
'; - - echo '

'; -} - /** * Template place holder * diff --git a/system/init.php b/system/init.php index bc72299c..3911d59d 100644 --- a/system/init.php +++ b/system/init.php @@ -30,9 +30,9 @@ $cache = Cache::getInstance($config['cache_engine'], $config['cache_prefix']); require_once LIBS . 'Twig/Autoloader.php'; Twig_Autoloader::register(); -$loader = new Twig_Loader_Filesystem(SYSTEM . 'templates'); -$twig = new Twig_Environment($loader, array( - 'cache' => CACHE . 'twig/', +$twig_loader = new Twig_Loader_Filesystem(SYSTEM . 'templates'); +$twig = new Twig_Environment($twig_loader, array( + 'cache' => CACHE . 'twig/' )); $function = new Twig_SimpleFunction('getStyle', function ($i) { diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index 8c2a11ca..502e531b 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -27,7 +27,7 @@ if(!$logged) else { if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); echo $twig->render('account.login.html', array( 'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null, @@ -141,7 +141,7 @@ if(!$logged) $new_password2 = isset($_POST['newpassword2']) ? $_POST['newpassword2'] : NULL; $old_password = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : NULL; if(empty($new_password) && empty($new_password2) && empty($old_password)) { - echo $twig->render('account.changepassword.html'); + echo $twig->render('account.change_password.html'); } else { @@ -177,7 +177,7 @@ if(!$logged) echo '

'; //show form - echo $twig->render('account.changepassword.html'); + echo $twig->render('account.change_password.html'); } else { @@ -209,8 +209,9 @@ if(!$logged) $message = '

An error occorred while sending email with password:
' . $mailer->ErrorInfo . '

'; } - echo $twig->render('account.changepassword.success.html', array( - 'message' => $message + echo $twig->render('success.html', array( + 'title' => 'Password Changed', + 'description' => 'Your password has been changed.' . $message )); $_SESSION['password'] = $new_password; } @@ -226,25 +227,25 @@ if(!$logged) $email_new = $_POST['new_email']; $post_password = $_POST['password']; if(empty($email_new)) { - $change_email_errors[] = "Please enter your new email address."; + $errors[] = "Please enter your new email address."; } else { if(!check_mail($email_new)) { - $change_email_errors[] = "E-mail address is not correct."; + $errors[] = "E-mail address is not correct."; } } if(empty($post_password)) { - $change_email_errors[] = "Please enter password to your account."; + $errors[] = "Please enter password to your account."; } else { $post_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $post_password); if($post_password != $account_logged->getPassword()) { - $change_email_errors[] = "Wrong password to account."; + $errors[] = "Wrong password to account."; } } - if(empty($change_email_errors)) { + if(empty($errors)) { $email_new_time = time() + $config['account_mail_change'] * 24 * 3600; $account_logged->setCustomField("email_new", $email_new); $account_logged->setCustomField("email_new_time", $email_new_time); @@ -253,17 +254,17 @@ if(!$logged) else { //show errors - echo $twig->render('account.error_box.html', array('errors' => $change_email_errors)); + echo $twig->render('error_box.html', array('errors' => $errors)); //show form - echo $twig->render('account.changemail.html', array( + echo $twig->render('account.change_mail.html', array( 'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null )); } } else { - echo $twig->render('account.changemail.html', array( + echo $twig->render('account.change_mail.html', array( 'new_email' => isset($_POST['new_email']) ? $_POST['new_email'] : null )); } @@ -277,7 +278,11 @@ if(!$logged) $account_logged->setEmail($email_new); $account_logged->save(); $account_logged->logAction('Account email changed to ' . $email_new . ''); - echo '
Email Address Change Accepted
You have accepted '.$account_logged->getEmail().' as your new email adress.

'; + + echo $twig->render('success.html', array( + 'title' => 'Email Address Change Accepted', + 'description' => 'You have accepted ' . $account_logged->getEmail() . ' as your new email adress.' + )); } else { @@ -298,114 +303,55 @@ if(!$logged) //########### CHANGE PUBLIC INFORMATION (about account owner) ###################### if($action == "changeinfo") { + $show_form = true; $new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : NULL; $new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : NULL; $new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : NULL; if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) { - //save data from form - $account_logged->setCustomField("rlname", $new_rlname); - $account_logged->setCustomField("location", $new_location); - $account_logged->setCustomField("country", $new_country); - $account_logged->logAction('Changed Real Name to ' . $new_rlname . ', Location to ' . $new_location . ' and Country to ' . $config['countries'][$new_country] . '.'); - echo '
Public Information Changed
Your public information has been changed.

'; + $errors = array(); + + if(!isset($config['countries'][$new_country])) + $errors[] = 'Country is not correct.'; + + if(empty($errors)) { + //save data from form + $account_logged->setCustomField("rlname", $new_rlname); + $account_logged->setCustomField("location", $new_location); + $account_logged->setCustomField("country", $new_country); + $account_logged->logAction('Changed Real Name to ' . $new_rlname . ', Location to ' . $new_location . ' and Country to ' . $config['countries'][$new_country] . '.'); + echo $twig->render('success.html', array( + 'title' => 'Public Information Changed', + 'description' => 'Your public information has been changed.' + )); + $show_form = false; + } + else { + echo $twig->render('error_box.html', array('errors' => $errors)); + } } - else - { + //show form + if($show_form) { $account_rlname = $account_logged->getCustomField("rlname"); $account_location = $account_logged->getCustomField("location"); - if($config['account_country']) + if ($config['account_country']) $account_country = $account_logged->getCustomField("country"); - ?> - Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.

-
-
- -
-
- - - - -
Change Public Information
- - - - -
-
- -
-
- - - - - - - - - - - - - - - -
Real Name: - -
Location: - -
Country: - - - -
-

- -
-
- -
-
-
-
-
- -
-
-
-
- $country) + $countries[$code] = $country; + + echo $twig->render('account.change_info.html', array( + 'countries' => $countries, + 'account_rlname' => $account_rlname, + 'account_location' => $account_location, + 'account_country' => $account_country + )); } } @@ -448,7 +394,7 @@ if(!$logged) if(!empty($reg_errors)) { //show errors - echo $twig->render('account.error_box.html', array('errors' => $reg_errors)); + echo $twig->render('error_box.html', array('errors' => $reg_errors)); } //show form @@ -628,11 +574,7 @@ if(!$logged) if(!$name_changed) { if(!empty($errors)) { - echo '
The Following Errors Have Occurred:
'; - foreach($errors as $errors) { - echo '
  • '.$errors; - } - echo '

  • '; + echo $twig->render('error_box.html', 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.

    Change Name

    @@ -673,16 +615,19 @@ if(!$logged) $points = $account_logged->getCustomField('premium_points'); if(isset($_POST['changesexsave']) && $_POST['changesexsave'] == 1) { if($points < $config['account_change_character_sex_points']) - $errors[] = 'You need ' . $config['account_change_character_sex_points'] . ' premium points to change sex. You have '.$points.' premium points.'; + $errors[] = 'You need ' . $config['account_change_character_sex_points'] . ' premium points to change sex. You have '.$points.' premium points.'; - if(empty($errors) && $new_sex != 0 && $new_sex != 1) + if(empty($errors) && !isset($config['genders'][$new_sex])) { $errors[] = 'This sex is invalid.'; + } if(empty($errors)) { - $player = $ots->createObject('Player'); + $player = new OTS_Player(); $player->load($player_id); + if($player->isLoaded()) { $player_account = $player->getAccount(); + if($account_logged->getId() == $player_account->getId()) { if($player->isOnline()) { $errors[] = 'This character is online.'; @@ -707,55 +652,32 @@ if(!$logged) $player->save(); $account_logged->setCustomField("premium_points", $points - $config['account_change_character_name_points']); $account_logged->logAction('Changed sex on character ' . $player->getName() . ' from ' . $old_sex_str . ' to ' . $new_sex_str . '.'); - echo '
    Character Sex Changed
    The character '.$player->getName().' sex has been changed to ' . $sexes[$new_sex] . '.
    '; + echo $twig->render('success.html', array( + 'title' => 'Character Sex Changed', + 'description' => 'The character ' . $player->getName() . ' sex has been changed to ' . $new_sex_str . '.' + )); } } - else - { + else { $errors[] = 'Character '.$player_name.' is not on your account.'; } } - else - { - $errors[] = 'Character with this name doesn\'t exist.'; + else { + $errors[] = "Character with this name doesn't exist."; } } } if(!$sex_changed) { if(!empty($errors)) { - echo '
    The Following Errors Have Occurred:
    '; - foreach($errors as $errors) { - echo '
  • '.$errors; - } - echo '

  • '; + echo $twig->render('error_box.html', array('errors' => $errors)); } - echo 'To change a sex of character select player and choose a new sex.
    - Change sex cost ' . $config['account_change_character_sex_points'] . ' premium points. You have ' . $points . ' premium points.

    Change sex
    - - - - - - - - - -
    Character: - -
    New Sex: - -

    '; + echo $twig->render('account.change_sex.html', array( + 'config' => $config, + 'players' => $account_logged->getPlayersList(), + 'player_sex' => isset($player) ? $player->getSex() : -1, + 'points' => $points + )); } } } @@ -767,7 +689,7 @@ if(!$logged) if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) { if(!empty($player_name) && !empty($password_verify)) { if(check_name($player_name)) { - $player = $ots->createObject('Player'); + $player = new OTS_Player(); $player->find($player_name); if($player->isLoaded()) { $player_account = $player->getAccount(); @@ -783,45 +705,39 @@ if(!$logged) else $player->setCustomField('deleted', 1); $account_logged->logAction('Deleted character ' . $player->getName() . '.'); - echo '
    Character Deleted
    The character '.$player_name.' has been deleted.

    '; + echo $twig->render('success.html', array( + 'title' => 'Character Deleted', + 'description' => 'The character ' . $player_name . ' has been deleted.' + )); } else - $delete_errors[] = 'This character is online.'; + $errors[] = 'This character is online.'; } - else - { - $delete_errors[] = 'Wrong password to account.'; + else { + $errors[] = 'Wrong password to account.'; } } - else - { - $delete_errors[] = 'Character '.$player_name.' is not on your account.'; + else { + $errors[] = 'Character '.$player_name.' is not on your account.'; } } - else - { - $delete_errors[] = 'Character with this name doesn\'t exist.'; + else { + $errors[] = 'Character with this name doesn\'t exist.'; } } - else - { - $delete_errors[] = 'Name contain illegal characters.'; + else { + $errors[] = 'Name contain illegal characters.'; } } - else - { - $delete_errors[] = 'Character name or/and password is empty. Please fill in form.'; + else { + $errors[] = 'Character name or/and password is empty. Please fill in form.'; } } if(!$dontshowtableagain) { - if(!empty($delete_errors)) { - echo '
    The Following Errors Have Occurred:
    '; - foreach($delete_errors as $delete_error) { - echo '
  • '.$delete_error; - } - echo '

  • '; + if(!empty($errors)) { + echo $twig->render('error_box.html', array('errors' => $errors)); } - echo 'To delete a character enter the name of the character and your password.

    Delete Character
    Character Name:
    Password:

    '; + echo $twig->render('account.delete_character.html'); } } @@ -974,7 +890,7 @@ if(!$logged) $newchar_created = true; $account_logged->logAction('Created character ' . $player->getName() . '.'); unset($player); - $player = $ots->createObject('Player'); + $player = new OTS_Player(); $player->find($newchar_name); if($player->isLoaded()) { @@ -992,7 +908,13 @@ if(!$logged) $loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId().""); foreach($loaded_items_to_copy as $save_item) $db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');"); - echo '
    Character Created
    The character '.$newchar_name.' has been created.
    Please select the outfit when you log in for the first time.

    See you on '.$config['lua']['serverName'].'!

    '; + + echo $twig->render('success.html', array( + 'title' => 'Character Created', + 'description' => 'The character ' . $newchar_name . ' has been created.
    + Please select the outfit when you log in for the first time.

    + See you on ' . $config['lua']['serverName'] . '!' + )); } else { @@ -1003,11 +925,7 @@ if(!$logged) } if(count($newchar_errors) > 0) { - echo '
    '; - echo 'The Following Errors Have Occurred:
    '; - foreach($newchar_errors as $newchar_error) - echo '
  • '.$newchar_error . '
  • '; - echo '

    '; + echo $twig->render('error_box.html', array('errors' => $newchar_errors)); } if(!$newchar_created) { diff --git a/system/pages/admin/pages.php b/system/pages/admin/pages.php index 556697cd..66547906 100644 --- a/system/pages/admin/pages.php +++ b/system/pages/admin/pages.php @@ -81,7 +81,7 @@ if(!empty($action)) } if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); } ?> ' . $name . ' does not exist or has been deleted.'; - output_errors($search_errors); + echo $twig->render('error_box.html', array('errors' => $search_errors)); $search_errors = array(); $promotion = ''; @@ -706,4 +706,4 @@ else } if(!empty($search_errors)) - output_errors($search_errors); + echo $twig->render('error_box.html', array('errors' => $search_errors)); \ No newline at end of file diff --git a/system/pages/commands.php b/system/pages/commands.php index 4a22d34d..dc9154f6 100644 --- a/system/pages/commands.php +++ b/system/pages/commands.php @@ -69,7 +69,7 @@ if($canEdit) } if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); } echo $twig->render('commands.form.html', array( diff --git a/system/pages/createaccount.php b/system/pages/createaccount.php index 06063a4c..cde51437 100644 --- a/system/pages/createaccount.php +++ b/system/pages/createaccount.php @@ -37,24 +37,23 @@ if($step == 'save') // account if(isset($account_id)) { - if(!check_number($account_id)) + if(empty($account_id)) + $errors['account'] = 'Please enter your account number!'; + else if(!check_number($account_id)) $errors['account'] = 'Invalid account number format. Please use only numbers 0-9.'; } else { if(empty($account_name)) $errors['account'] = 'Please enter your account name!'; - elseif(!check_account_name($account_name_up)) + else if(!check_account_name($account_name_up)) $errors['account'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.'; } // email if(empty($email)) $errors['email'] = 'Please enter your email address!'; - else - { - if(!check_mail($email)) - $errors['email'] = 'E-mail address is not correct.'; - } + else if(!check_mail($email)) + $errors['email'] = 'Email address is not correct.'; // country $country = ''; @@ -62,7 +61,7 @@ if($step == 'save') { $country = $_POST['country']; if(!isset($country)) - $errors['country'] = 'Country is not set'; + $errors['country'] = 'Country is not set.'; elseif(!isset($config['countries'][$country])) $errors['country'] = 'Country is invalid.'; } @@ -74,10 +73,10 @@ if($step == 'save') $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$config['recaptcha_secret_key'].'&response='.$_POST['g-recaptcha-response']); $responseData = json_decode($verifyResponse); if(!$responseData->success) - $errors['verification'] = 'Please confirm that your not a robot.'; + $errors['verification'] = "Please confirm that you're not a robot."; } else - $errors['verification'] = 'Please confirm that your not a robot.'; + $errors['verification'] = "Please confirm that you're not a robot."; } // password @@ -393,7 +392,7 @@ function validate_form(thisform) } if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', 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 $section['id'], 'name' => $section['name'], 'description' => $section['description'], 'closed' => $section['closed'] == '1' @@ -130,22 +131,33 @@ if(!$logged) $number_of_rows = 0; if(empty($action)) { - echo 'Boards'; - echo ''; $info = $db->query("SELECT `section`, COUNT(`id`) AS 'threads', SUM(`replies`) AS 'replies' FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = `id` GROUP BY `section`")->fetchAll(); + + $boards = array(); foreach($info as $data) $counters[$data['section']] = array('threads' => $data['threads'], 'posts' => $data['replies'] + $data['threads']); foreach($sections as $id => $section) { $last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`section` = ".(int) $id." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch(); - echo ''; + $boards[] = array( + 'link' => getForumBoardLink($id), + 'name' => $section['name'], + 'description' => $section['description'], + 'posts' => isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0, + 'threads' => isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0, + 'last_post' => array( + 'name' => isset($last_post['name']) ? $last_post['name'] : null, + 'date' => isset($last_post['post_date']) ? $last_post['post_date'] : null, + 'player_link' => isset($last_post['name']) ? getPlayerLink($last_post['name']) : null, + ) + ); } - echo '
    BoardPostsThreadsLast Post
    '.$section['name'].'
    '.$section['description'].'
    '.(int) (isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0).''.(int) (isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0).''; - if(isset($last_post['name'])) - echo date('d.m.y H:i:s', $last_post['post_date']).'
    by ' . getPlayerLink($last_post['name']); - else - echo 'No posts'; - echo '
    '; + + echo $twig->render('forum.boards.html', array( + 'boards' => $boards, + 'config' => $config + )); + return; } @@ -166,7 +178,7 @@ if($action == 'show_board') if(!$sections[$section_id]['closed'] || Forum::isModerator()) { echo '

    - '; + '; } echo '

    Page: '.$links_to_pages.'
    '; @@ -175,7 +187,7 @@ if($action == 'show_board') { echo ''; - $player = $ots->createObject('Player'); + $player = new OTS_Player(); foreach($last_threads as $thread) { echo '
    ThreadThread StarterRepliesViewsLast Post
    '; @@ -209,7 +221,7 @@ if($action == 'show_board') } echo '
    '; if(!$sections[$section_id]['closed'] || Forum::isModerator()) - echo '
    '; + echo '
    '; } else echo '

    No threads in this board.

    '; @@ -318,7 +330,7 @@ if($action == 'remove_post') } } else - echo 'Post with ID '.$id.' does not exist.'; + echo 'Post with ID ' . $id . ' does not exist.'; } else echo 'You are not logged in or you are not moderator.'; @@ -392,7 +404,7 @@ if($action == 'new_post') if(!$saved) { if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); echo '
    @@ -508,7 +520,7 @@ if($action == 'edit_post') if(!$saved) { if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); echo '
    Edit Post
    Character: - -
    Post New Reply
    Character:
    Topic: (Optional)
    Message:
    You can use:
    [player]Nick[/player]
    [url]http://address.com/[/url]
    [img]http://images.com/images3.gif[/img]
    [code]Code[/code]
    [b]Text[/b]
    [i]Text[/i]
    [u]Text[/u]
    and smileys:
    ;) , :) , :D , :( , :rolleyes:
    :cool: , :eek: , :o , :p

    (Max. 15,000 letters)
    Options:
    '; - } + else + echo 'Board with ID ' . $board_id . ' doesn\'t exist.'; } else - echo 'Board with ID '.$board_id.' doesn\'t exist.'; + echo 'Please enter section_id.'; } else echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.'; @@ -645,6 +652,17 @@ if($action == 'move_thread') { if($post['id'] == $post['first_post']) { + echo $twig->render('forum.move_thread.html', array( + 'thread' => $post['post_topic'], + 'author' => $name[0], + 'board' => $sections[$post['section']]['name'], + 'post_id' => $post['id'], + 'sections' => $sections, + 'section_link' => getForumBoardLink($post['section']), + 'config' => $config + )); + + /* echo '
    Move thread to another board
    @@ -656,11 +674,11 @@ if($action == 'move_thread') THREAD: '.$post['post_topic'].'
    AUTHOR: '.$name[0].'
    BOARD: '.$sections[$post['section']]['name'].'
    -
    Select the new board: '; foreach($sections as $id => $section) { echo ''; } echo ' -
    '; +
    ';*/ } } else @@ -675,7 +693,7 @@ if($action == 'moved_thread') if(Forum::isModerator()) { $id = (int) $_REQUEST['id']; - $board = (int) $_REQUEST['sektion']; + $board = (int) $_REQUEST['section']; $post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch(); if($post['id'] == $id) { @@ -687,7 +705,7 @@ if($action == 'moved_thread') } } else - echo 'Post with ID '.$id.' does not exist.'; + echo 'Post with ID ' . $id . ' does not exist.'; } else echo 'You are not logged in or you are not moderator.'; @@ -707,10 +725,8 @@ class Forum return $db->query( - 'SELECT ' . $db->fieldName('id') . - ' FROM ' . $db->tableName('players') . - ' WHERE ' . $db->fieldName('account_id') . ' = ' . $db->quote($account->getId()) . - ' AND ' . $db->fieldName('level') . ' >= ' . $db->quote($config['forum_level_required']) . + 'SELECT `id` FROM `players` WHERE `account_id` = ' . $db->quote($account->getId()) . + ' AND `level` >= ' . $db->quote($config['forum_level_required']) . ' LIMIT 1')->rowCount() > 0; } diff --git a/system/pages/movies.php b/system/pages/movies.php index 8e4e2a0c..e69068d6 100644 --- a/system/pages/movies.php +++ b/system/pages/movies.php @@ -11,7 +11,7 @@ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Movies'; -$movies = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'movies') . ' ORDER BY ' . $db->fieldName('ordering')); +$movies = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'movies` ORDER BY `ordering`;'); if(!$movies->rowCount()) { ?> @@ -22,10 +22,10 @@ There are no movies added yet. return; } ?> -
    +

    Author:


    -
    +
    diff --git a/system/pages/news.php b/system/pages/news.php index 8ed4f104..97133b51 100644 --- a/system/pages/news.php +++ b/system/pages/news.php @@ -151,7 +151,7 @@ if($canEdit) } if(!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); if($cache->enabled()) { diff --git a/system/pages/screenshots.php b/system/pages/screenshots.php index d11f6a1c..b71d234f 100644 --- a/system/pages/screenshots.php +++ b/system/pages/screenshots.php @@ -53,7 +53,7 @@ if($canEdit) { } if (!empty($errors)) - output_errors($errors); + echo $twig->render('error_box.html', array('errors' => $errors)); } echo $twig->render('screenshots.form.html', array( diff --git a/system/template.php b/system/template.php index 26b7c23e..d61ae2aa 100644 --- a/system/template.php +++ b/system/template.php @@ -94,4 +94,6 @@ if($config['forum'] != '') } $twig->addGlobal('template_path', $template_path); +if($twig_loader && file_exists(BASE . $template_path . '/templates')) + $twig_loader->prependPath(BASE . $template_path . '/templates'); ?> diff --git a/system/templates/account.change_info.html b/system/templates/account.change_info.html new file mode 100644 index 00000000..b8470f6f --- /dev/null +++ b/system/templates/account.change_info.html @@ -0,0 +1,83 @@ +Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.

    +
    +
    + +
    +
    + + + + +
    Change Public Information
    + + + + +
    +
    + +
    {{ config.darkborder }} +
    + + + + + + + + + + {% if config.account_country %} + + + + + {% endif %} +
    Real Name: + +
    Location: + +
    Country: + + + +
    +

    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    \ No newline at end of file diff --git a/system/templates/account.changemail.html b/system/templates/account.change_mail.html similarity index 100% rename from system/templates/account.changemail.html rename to system/templates/account.change_mail.html diff --git a/system/templates/account.changepassword.html b/system/templates/account.change_password.html similarity index 100% rename from system/templates/account.changepassword.html rename to system/templates/account.change_password.html diff --git a/system/templates/account.change_sex.html b/system/templates/account.change_sex.html new file mode 100644 index 00000000..4feb7540 --- /dev/null +++ b/system/templates/account.change_sex.html @@ -0,0 +1,78 @@ +To change a sex of character select player and choose a new sex.
    +Change sex cost {{ config.account_change_character_sex_points }} premium points. You have {{ points }} premium points.

    +
    + +
    + +
    +
    + + + + +
    Change sex
    + + + + +
    +
    + + + +
    +
    + + + + + + + + + +
    Character: + +
    New Sex: + +
    +
    +
    +
    +
    + + + + + +
    + + + + + + +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/system/templates/account.delete_character.html b/system/templates/account.delete_character.html new file mode 100644 index 00000000..6bf677f0 --- /dev/null +++ b/system/templates/account.delete_character.html @@ -0,0 +1,68 @@ +To delete a character enter the name of the character and your password.

    +
    + +
    + +
    +
    + + + + +
    Delete Character
    + + + + +
    +
    + + + +
    +
    + + + + + + + + + +
    Character Name: + +
    Password: + +
    +
    +
    +
    +
    + + + + + +
    + + + + + +
    +
    +
    +
    +
    + + + + + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/system/templates/account.login.html b/system/templates/account.login.html index 0cdcf850..f845a7e8 100644 --- a/system/templates/account.login.html +++ b/system/templates/account.login.html @@ -1,4 +1,4 @@ -Please enter your account name and your password.
    Create an account if you do not have one yet.

    +Please enter your account {{ account|lower }} and your password.
    Create an account if you do not have one yet.

    {% if redirect is not null %} @@ -7,15 +7,15 @@ Please enter your account name and your password.
    - - - - + + + +
    Account Login
    - - - - + + + +
    diff --git a/system/templates/account.management.html b/system/templates/account.management.html index 9eb3939a..f3962e01 100644 --- a/system/templates/account.management.html +++ b/system/templates/account.management.html @@ -484,8 +484,7 @@ - @@ -498,8 +497,7 @@
    -
    +
    - diff --git a/system/templates/account.error_box.html b/system/templates/error_box.html similarity index 97% rename from system/templates/account.error_box.html rename to system/templates/error_box.html index 0f841eee..f06c1d73 100644 --- a/system/templates/account.error_box.html +++ b/system/templates/error_box.html @@ -9,7 +9,7 @@
    The Following Errors Have Occurred:
    {% for error in errors %} -
  • {{ error }}
  • +
  • {{ error|raw }}
  • {% endfor %}
    diff --git a/system/templates/forum.boards.html b/system/templates/forum.boards.html new file mode 100644 index 00000000..5685493a --- /dev/null +++ b/system/templates/forum.boards.html @@ -0,0 +1,35 @@ +Boards +
    -
    +
    + + + + + + + {% set i = 0 %} + {% for board in boards %} + {% set i = i + 1 %} + + + + + + + {% endfor %} +
    + Board + + Posts + + Threads + + Last Post +
    + {{ board.name }}
    {{ board.description }} +
    {{ board.posts }}{{ board.threads }} + {% if board.last_post.name is not null %} + {{ board.last_post.date|date("d.m.y H:i:s") }}
    by {{ board.last_post.player_link|raw }} + {% else %} + No posts + {% endif %} +
    \ No newline at end of file diff --git a/system/templates/forum.move_thread.html b/system/templates/forum.move_thread.html new file mode 100644 index 00000000..12ece24c --- /dev/null +++ b/system/templates/forum.move_thread.html @@ -0,0 +1,34 @@ +
    + + + + + + + +
    Move thread to another board
    + + + + +
    + + + + + THREAD: {{ thread }}
    + AUTHOR: {{ author }}
    + BOARD: {{ board }}

    + Select the new board:  + + + +
    + +
    +
    +
    \ No newline at end of file diff --git a/system/templates/forum.new_thread.html b/system/templates/forum.new_thread.html new file mode 100644 index 00000000..7c31b2d1 --- /dev/null +++ b/system/templates/forum.new_thread.html @@ -0,0 +1,39 @@ +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + Post New Reply +
    Character: + +
    Topic: (Optional)
    Message:
    You can use:
    [player]Nick[/player]
    [url]http://address.com/[/url]
    [img]http://images.com/images3.gif[/img]
    [code]Code[/code]
    [b]Text[/b]
    [i]Text[/i]
    [u]Text[/u]
    and smileys:
    ;) , :) , :D , :( , :rolleyes:
    :cool: , :eek: , :o , :p

    (Max. 15,000 letters)
    Options:
    +
    + +
    +
    \ No newline at end of file diff --git a/system/templates/account.changepassword.success.html b/system/templates/success.html similarity index 72% rename from system/templates/account.changepassword.success.html rename to system/templates/success.html index 7f775a80..c5b94bb0 100644 --- a/system/templates/account.changepassword.success.html +++ b/system/templates/success.html @@ -6,7 +6,7 @@ -
    Password Changed
    +
    {{ title }}
    @@ -16,9 +16,9 @@
    - +
    - +
    Your password has been changed.{{ message|raw }}{{ description|raw }}
    @@ -29,15 +29,13 @@
    - +
    -
    -
    -
    +
    -
    \ No newline at end of file + diff --git a/templates/kathrine/templates/success.html b/templates/kathrine/templates/success.html new file mode 100644 index 00000000..10fca7d7 --- /dev/null +++ b/templates/kathrine/templates/success.html @@ -0,0 +1,13 @@ +

    {{ title }}


    +{{ description|raw }} +
    + + + + + + +
    + +
    +
    \ No newline at end of file diff --git a/templates/tibiacom/index.php b/templates/tibiacom/index.php index eb926a5b..15b72882 100644 --- a/templates/tibiacom/index.php +++ b/templates/tibiacom/index.php @@ -568,7 +568,14 @@ endif;
    - + + + echo "'>