From 7b234ad41fc7f30ddb2b5183ee51c40dd93d51a8 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 6 Oct 2017 17:11:06 +0200 Subject: [PATCH] * moved .htaccess rules to plain php (index.php) Its a salut to nginx and other web server nutzer (not apache), as they can now simply redirect all requests with simple rule to index.php, and php will take care of all redirects. .htaccess just now redirects everything to index.php with simple 3 lines. * change accountmanagement links to use friendly_urls * fixed creating new forum thread * some fixes in account changecomment action * show info when account name/number or password is empty on login * fixed showing account login errors * added new twig function getLink that convert link taking into account config.friendly_urls * internalLayoutLink -> getLink --- .htaccess.dist | 28 +---- index.php | 77 +++++++++++- system/functions.php | 57 ++------- system/init.php | 9 ++ system/login.php | 3 + system/pages/accountmanagement.php | 82 ++++++------ system/pages/admin/pages.php | 4 +- system/pages/characters.php | 10 +- system/pages/commands.php | 2 +- system/pages/forum.php | 12 +- system/pages/guilds.php | 6 +- system/pages/highscores.php | 42 +++---- system/pages/news.php | 16 +-- system/pages/screenshots.php | 2 +- system/pages/serverinfo.php | 8 +- system/template.php | 16 +-- .../account.change_comment.html.twig | 4 +- .../templates/account.change_info.html.twig | 4 +- .../templates/account.change_mail.html.twig | 4 +- .../templates/account.change_name.html.twig | 4 +- .../account.change_password.html.twig | 4 +- system/templates/account.change_sex.html.twig | 4 +- system/templates/account.create.html.twig | 8 +- .../account.create_character.html.twig | 4 +- .../account.delete_character.html.twig | 4 +- ...ccount.generate_new_recovery_key.html.twig | 112 ++++++++--------- .../account.generate_recovery_key.html.twig | 4 +- system/templates/account.login.html.twig | 4 +- system/templates/account.logout.html.twig | 2 +- .../templates/account.lost.noaction.html.twig | 2 +- system/templates/account.management.html.twig | 26 ++-- system/templates/account.redirect.html.twig | 10 +- system/templates/forum.new_thread.html.twig | 2 +- system/templates/success.html.twig | 2 +- .../kathrine/account.change_name.html.twig | 4 +- templates/kathrine/success.html.twig | 2 +- templates/kathrine/template.php | 62 ++++----- templates/tibiacom/index.php | 118 ++++++++---------- tools/signature/index.php | 6 +- 39 files changed, 390 insertions(+), 380 deletions(-) diff --git a/.htaccess.dist b/.htaccess.dist index faeae507..c932ecdc 100644 --- a/.htaccess.dist +++ b/.htaccess.dist @@ -1,33 +1,7 @@ Options -Indexes -MultiViews RewriteEngine On -#RewriteBase / -# Page parser RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^([A-Za-z0-9-_+']+)\.png/?$ tools/signature/index.php?name=$1 [L] -RewriteRule ^characters/([A-Za-z0-9-_+']+)$ index.php?subtopic=characters&name=$1 -RewriteRule ^guilds/([A-Za-z0-9-_+']+)$ index.php?subtopic=guilds&action=show&guild=$1 -RewriteRule ^forum/board/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1 -RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1&page=$2 -RewriteRule ^forum/thread/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1 -RewriteRule ^forum/thread/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2 -RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2 -RewriteRule ^account/manage$ index.php?subtopic=accountmanagement -RewriteRule ^account/create$ index.php?subtopic=createaccount -RewriteRule ^account/lost$ index.php?subtopic=lostaccount -RewriteRule ^account/logout$ index.php?subtopic=accountmanagement&action=logout -RewriteRule ^news/archive/([0-9]+)$ index.php?subtopic=newsarchive&id=$1 -RewriteRule ^news/archive$ index.php?subtopic=newsarchive -RewriteRule ^highscores/([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?subtopic=highscores&list=$1&vocation=$2 -RewriteRule ^highscores/([A-Za-z0-9-_']+)$ index.php?subtopic=highscores&list=$1 -RewriteRule ^polls/([0-9]+)$ index.php?subtopic=polls&id=$1 -RewriteRule ^admin/$ admin/index.php -RewriteRule ^install/$ install/index.php - -# temp solution >.> -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^([A-Za-z0-9-_]+)/?$ index.php?p=$1 [L] -RewriteRule ^([A-Za-z0-9-_]+)/([A-Za-z0-9-_]+)?$ index.php?p=$1&action=$2 [L] \ No newline at end of file +RewriteRule ^.*$ index.php [L] \ No newline at end of file diff --git a/index.php b/index.php index 8e70e347..7aab0826 100644 --- a/index.php +++ b/index.php @@ -39,8 +39,81 @@ if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['i die('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!'); } +$uri = str_replace(BASE_DIR . '/', '', $_SERVER['REQUEST_URI']); +$uri = str_replace('index.php/', '', $uri); +$uri = str_replace('?', '', $uri); + +if(empty($uri)) { + $_REQUEST['p'] = 'news'; +} +else if(file_exists(SYSTEM . 'pages/' . $uri . '.php')) { + $_REQUEST['p'] = $uri; +} +else { + $rules = array( + '/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'), + '/^account\/create\/?$/' => array('subtopic' => 'createaccount'), + '/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'), + '/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'), + '/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changepassword'), + '/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'registeraccount'), + '/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'registernew'), + '/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changeemail'), + '/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changeinfo'), + '/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'createcharacter'), + '/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changename'), + '/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changesex'), + '/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'deletecharacter'), + '/^account\/character\/comment\/[A-Za-z]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changecomment', 'name' => '$3'), + '/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'changecomment'), + '/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'), + '/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'), + '/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'), + '/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'), + '/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'), + '/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'), + '/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'), + '/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'), + '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), + '/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'), + '/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'), + '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1') + ); + + if (preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) { + $tmp = explode('.', $uri); + $_REQUEST['name'] = urldecode($tmp[0]); + + chdir(TOOLS . 'signature'); + include('index.php'); + exit(); + } + + $found = false; + foreach($rules as $rule => $redirect) { + if (preg_match($rule, $uri)) { + $tmp = explode('/', $uri); + foreach($redirect as $key => $value) { + if(strpos($value, '$') !== false) { + $value = str_replace('$' . $value[1], $tmp[$value[1]], $value); + } + + $_REQUEST[$key] = $value; + $_GET[$key] = $value; + } + + $found = true; + break; + } + } + + if(!$found) { + $_REQUEST['p'] = '404'; + } +} + // define page visited, so it can be used within events system -$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_GET['p']) ? $_GET['p'] : ''); +$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : ''); if(empty($page) || preg_match('/[^A-z0-9_\-]/', $page)) $page = 'news'; @@ -156,7 +229,7 @@ if($config['backward_support']) { $config['site']['screenshot_page'] = true; if($config['forum'] != '') - $config['forum_link'] = (strtolower($config['forum']) == 'site' ? internalLayoutLink('forum') : $config['forum']); + $config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']); foreach($status as $key => $value) $config['status']['serverStatus_' . $key] = $value; diff --git a/system/functions.php b/system/functions.php index 915e55fd..3b3a920c 100644 --- a/system/functions.php +++ b/system/functions.php @@ -38,46 +38,27 @@ function generateLink($url, $name, $blank = false) { return '' . $name . ''; } -function getLink($page, $name, $blank = false) { - return generateLink(getPageLink($page), $name, $blank); +function getFullLink($page, $name, $blank = false) { + return generateLink(getLink($page), $name, $blank); } -function getPageLink($page, $action = null) +function getLink($page, $action = null) { global $config; - - // TODO: tibiacom template is not working correctly with this - if($config['friendly_urls']) - return BASE_URL . $page . ($action ? '/' . $action : ''); - - return BASE_URL . '?subtopic=' . $page . ($action ? '&action=' . $action : ''); + return BASE_URL . ($config['friendly_urls'] ? '' : '?') . $page . ($action ? '/' . $action : ''); } -function internalLayoutLink($page, $action = null) {return getPageLink($page, $action);} +function internalLayoutLink($page, $action = null) {return getLink($page, $action);} function getForumThreadLink($thread_id, $page = NULL) { global $config; - - $url = ''; - if($config['friendly_urls']) - $url = BASE_URL . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : ''); - else - $url = BASE_URL . '?subtopic=forum&action=show_thread&id=' . (int)$thread_id . (isset($page) ? '&page=' . $page : ''); - - return $url; + return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/thread/' . (int)$thread_id . (isset($page) ? '/' . $page : ''); } function getForumBoardLink($board_id, $page = NULL) { global $config; - - $url = ''; - if($config['friendly_urls']) - $url = BASE_URL . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : ''); - else - $url = BASE_URL . '?subtopic=forum&action=show_board&id=' . (int)$board_id . (isset($page) ? '&page=' . $page : ''); - - return $url; + return BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'forum/board/' . (int)$board_id . (isset($page) ? '/' . $page : ''); } function getPlayerLink($name, $generate = true) @@ -91,12 +72,8 @@ function getPlayerLink($name, $generate = true) if($player->isLoaded()) $name = $player->getName(); } - - $url = ''; - if($config['friendly_urls']) - $url = BASE_URL . 'characters/' . urlencode($name); - else - $url = BASE_URL . '?subtopic=characters&name=' . urlencode($name); + + $url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'characters/' . urlencode($name); if(!$generate) return $url; return generateLink($url, $name); @@ -115,13 +92,9 @@ function getHouseLink($name, $generate = true) if($house->rowCount() > 0) $name = $house->fetchColumn(); } - - $url = ''; - if($config['friendly_urls']) - $url = BASE_URL . 'houses/' . urlencode($name); - else - $url = BASE_URL . '?subtopic=houses&page=view&house=' . urlencode($name); - + + $url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'houses/' . urlencode($name); + if(!$generate) return $url; return generateLink($url, $name); } @@ -138,11 +111,7 @@ function getGuildLink($name, $generate = true) $name = $guild->fetchColumn(); } - $url = ''; - if($config['friendly_urls']) - $url = BASE_URL . 'guilds/' . urlencode($name); - else - $url = BASE_URL . '?subtopic=guilds&action=show&guild=' . urlencode($name); + $url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'guilds/' . urlencode($name); if(!$generate) return $url; return generateLink($url, $name); diff --git a/system/init.php b/system/init.php index 8f15c91f..14db405f 100644 --- a/system/init.php +++ b/system/init.php @@ -42,6 +42,15 @@ $function = new Twig_SimpleFunction('getStyle', function ($i) { }); $twig->addFunction($function); +$function = new Twig_SimpleFunction('getLink', function ($s) { + global $config; + if($config['friendly_urls']) + return $s; + + return '?' . $s; +}); +$twig->addFunction($function); + // trim values we receive if(isset($_POST)) { diff --git a/system/login.php b/system/login.php index b3d28540..d5375e6b 100644 --- a/system/login.php +++ b/system/login.php @@ -113,6 +113,9 @@ else } } } + else { + $errors[] = 'Please enter your account ' . (USE_ACCOUNT_NAME ? 'name' : 'password') . ' and password.'; + } } // stay-logged with sessions diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index a795b0d8..8511d4c4 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -17,7 +17,6 @@ if($config['account_country']) $groups = new OTS_Groups_List(); -$errors = array(); $show_form = true; $config_salt_enabled = fieldExist('salt', 'accounts'); if(!$logged) @@ -29,7 +28,7 @@ if(!$logged) { if(!empty($errors)) echo $twig->render('error_box.html.twig', array('errors' => $errors)); - + echo $twig->render('account.login.html.twig', array( 'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : null, 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number', @@ -39,6 +38,8 @@ if(!$logged) } } +$errors = array(); + if(isset($_REQUEST['redirect'])) { $redirect = urldecode($_REQUEST['redirect']); @@ -63,7 +64,7 @@ if(!$logged) else { if($config['generate_new_reckey'] && $config['mail_enabled']) - $account_registered = 'Yes ( Buy new Recovery Key )'; + $account_registered = 'Yes ( Buy new Recovery Key )'; else $account_registered = 'Yes'; } @@ -477,7 +478,7 @@ if($action == "changeemail") { } //############## GENERATE NEW RECOVERY KEY ########### - if($action == "newreckey") + if($action == "registernew") { if(isset($_POST['reg_password'])) $reg_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $_POST['reg_password']); @@ -542,45 +543,52 @@ if($action == "changeemail") { //###### CHANGE CHARACTER COMMENT ###### if($action == "changecomment") { - $player_name = stripslashes($_REQUEST['name']); + $player_name = isset($_REQUEST['name']) ? stripslashes($_REQUEST['name']) : null; $new_comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'],0,2000))) : NULL; $new_hideacc = isset($_POST['accountvisible']) ? (int)$_POST['accountvisible'] : NULL; - if(check_name($player_name)) { - $player = $ots->createObject('Player'); - $player->find($player_name); - if($player->isLoaded()) { - $player_account = $player->getAccount(); - if($account_logged->getId() == $player_account->getId()) { - if(isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) { - $player->setCustomField("hidden", $new_hideacc); - $player->setCustomField("comment", $new_comment); - $account_logged->logAction('Changed comment for character ' . $player->getName() . '.'); - echo $twig->render('success.html.twig', array( - 'title' => 'Character Information Changed', - 'description' => 'The character information has been changed.' - )); - } - else - { - echo $twig->render('account.change_comment.html.twig', array( - 'player' => $player, - 'player_name' => $player_name - )); + + if($player_name != null) { + if (check_name($player_name)) { + $player = $ots->createObject('Player'); + $player->find($player_name); + if ($player->isLoaded()) { + $player_account = $player->getAccount(); + if ($account_logged->getId() == $player_account->getId()) { + if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) { + $player->setCustomField("hidden", $new_hideacc); + $player->setCustomField("comment", $new_comment); + $account_logged->logAction('Changed comment for character ' . $player->getName() . '.'); + echo $twig->render('success.html.twig', array( + 'title' => 'Character Information Changed', + 'description' => 'The character information has been changed.' + )); + $show_form = false; + } + } else { + $errors[] = 'Error. Character ' . $player_name . ' is not on your account.'; } + } else { + $errors[] = "Error. Character with this name doesn't exist."; } - else - { - echo "Error. Character ".$player_name." is not on your account."; - } - } - else - { - echo "Error. Character with this name doesn't exist."; + } else { + $errors[] = 'Error. Name contain illegal characters.'; } } - else - { - echo "Error. Name contain illegal characters."; + else { + $errors[] = 'Please enter character name.'; + } + + if($show_form) { + if(!empty($errors)) { + echo $twig->render('error_box.html.twig', array('errors' => $errors)); + } + + if(isset($player)) { + echo $twig->render('account.change_comment.html.twig', array( + 'player' => $player, + 'player_name' => $player_name + )); + } } } diff --git a/system/pages/admin/pages.php b/system/pages/admin/pages.php index 4d29408f..c41c62a6 100644 --- a/system/pages/admin/pages.php +++ b/system/pages/admin/pages.php @@ -181,7 +181,7 @@ if(!empty($action)) - + @@ -203,7 +203,7 @@ $pages = $i = 0; foreach($pages as $_page): ?> - + diff --git a/system/pages/characters.php b/system/pages/characters.php index edf4d98a..4b0cd14b 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -18,7 +18,7 @@ function generate_search_form($autofocus = false) { global $config, $twig; return $twig->render('characters.form.html.twig', array( - 'link' => getPageLink('characters'), + 'link' => getLink('characters'), 'autofocus' => $autofocus )); } @@ -42,7 +42,7 @@ function retrieve_former_name($name) $name = ''; if(isset($_REQUEST['name'])) - $name = stripslashes(ucwords(strtolower(trim($_REQUEST['name'])))); + $name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name'])))); if(empty($name)) { @@ -370,9 +370,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil // signature if($config['signature_enabled']) { - $signature_url = BASE_URL . 'tools/signature/?name=' . urlencode($player->getName()); - if($config['friendly_urls']) - $signature_url = BASE_URL . urlencode($player->getName()) . '.png'; + $signature_url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . urlencode($player->getName()) . '.png'; } $hidden = $player->getCustomField('hidden'); @@ -431,7 +429,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil 'player_link' => getPlayerLink($player->getName(), false), 'hidden' => $hidden, 'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null, - 'characters_link' => internalLayoutLink('characters'), + 'characters_link' => getLink('characters'), 'account_players' => isset($account_players) ? $account_players : null, 'search_form' => generate_search_form() )); diff --git a/system/pages/commands.php b/system/pages/commands.php index ab3675e2..b7334188 100644 --- a/system/pages/commands.php +++ b/system/pages/commands.php @@ -73,7 +73,7 @@ if($canEdit) } echo $twig->render('commands.form.html.twig', array( - 'link' => getPageLink('commands', ($action == 'edit' ? 'edit' : 'add')), + 'link' => getLink('commands/' . ($action == 'edit' ? 'edit' : 'add')), 'action' => $action, 'id' => isset($id) ? $id : null, 'words' => isset($words) ? $words : null, diff --git a/system/pages/forum.php b/system/pages/forum.php index 757a6e3a..da1e59e0 100644 --- a/system/pages/forum.php +++ b/system/pages/forum.php @@ -174,7 +174,7 @@ if($canEdit) if(empty($action) || $action == 'edit_board') { echo $twig->render('forum.add_board.html.twig', array( - 'link' => getPageLink('forum', ($action == 'edit_board' ? 'edit_board' : 'add_board')), + 'link' => getLink('forum', ($action == 'edit_board' ? 'edit_board' : 'add_board')), 'action' => $action, 'id' => isset($id) ? $id : null, 'name' => isset($name) ? $name : null, @@ -253,7 +253,7 @@ if($action == 'show_board') else $links_to_pages .= ''.($i + 1).' '; } - echo 'Boards >> '.$sections[$section_id]['name'].''; + echo 'Boards >> '.$sections[$section_id]['name'].''; if(!$sections[$section_id]['closed'] || Forum::isModerator()) { echo '

@@ -324,7 +324,7 @@ if($action == 'show_thread') $threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll(); if(isset($threads[0]['name'])) $db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id); - echo 'Boards >> '.$sections[$threads[0]['section']]['name'].' >> '.$thread_name['post_topic'].''; + echo 'Boards >> '.$sections[$threads[0]['section']]['name'].' >> '.$thread_name['post_topic'].''; echo '



Page: '.$links_to_pages.'
'; $player = $ots->createObject('Player'); foreach($threads as $thread) @@ -421,7 +421,7 @@ if($action == 'new_post') $players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll(); $thread_id = (int) $_REQUEST['thread_id']; $thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch(); - echo 'Boards >> '.$sections[$thread['section']]['name'].' >> '.$thread['post_topic'].' >> Post new reply

'.$thread['post_topic'].'

'; + echo 'Boards >> '.$sections[$thread['section']]['name'].' >> '.$thread['post_topic'].' >> Post new reply

'.$thread['post_topic'].'

'; if(isset($thread['id'])) { $quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL; @@ -537,7 +537,7 @@ if($action == 'edit_post') if(isset($thread['id'])) { $first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch(); - echo 'Boards >> '.$sections[$thread['section']]['name'].' >> '.$first_post['post_topic'].' >> Edit post'; + echo 'Boards >> '.$sections[$thread['section']]['name'].' >> '.$first_post['post_topic'].' >> Edit post'; if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator()) { $players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll(); @@ -634,7 +634,7 @@ if($action == 'new_thread') $players_from_account = $db->query('SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = '.(int) $account_logged->getId())->fetchAll(); $section_id = isset($_REQUEST['section_id']) ? $_REQUEST['section_id'] : null; if($section_id !== null) { - echo 'Boards >> ' . $sections[$section_id]['name'] . ' >> Post new thread
'; + echo 'Boards >> ' . $sections[$section_id]['name'] . ' >> Post new thread
'; if (isset($sections[$section_id]['name'])) { if ($sections[$section_id]['closed'] && !Forum::isModerator()) $errors[] = 'You cannot create topic on this board.'; diff --git a/system/pages/guilds.php b/system/pages/guilds.php index 9f023037..67b2a85c 100644 --- a/system/pages/guilds.php +++ b/system/pages/guilds.php @@ -104,6 +104,8 @@ if($action == '') { foreach($guilds_list as $guild) { + $link = ($config['friendly_urls'] ? '' : '?') . 'guilds/' . $guild->getName(); + $guild_logo = $guild->getCustomField('logo_name'); if(empty($guild_logo) || !file_exists('images/guilds/' . $guild_logo)) $guild_logo = "default.gif"; @@ -117,7 +119,7 @@ if($action == '') diff --git a/system/pages/news.php b/system/pages/news.php index 2479dcd5..ca2eed01 100644 --- a/system/pages/news.php +++ b/system/pages/news.php @@ -66,11 +66,9 @@ if(isset($_GET['archive'])) } else echo "This news doesn't exist or is hidden.
"; - - //echo '
Back to Archive'; ?>
-
'.htmlspecialchars($thread_name['post_topic']).'
by ' . getPlayerLink($thread_name['name']) . '
Author 
'.$guild->getName().'
'.$description.''; if(admin()) echo '
Delete this guild (for ADMIN only!)'; - echo '
'; @@ -145,7 +147,7 @@ if($action == '')
Cleanup players - can\'t join guild/be invited? Can\'t create guild? Try cleanup players.
Cleanup guilds - made guild, you are a leader, but you are not on players list? Cleanup guilds!'; else - echo 'Before you can create guild you must login.
+ echo '
+ +
- -
+ echo 'Before you can create guild you must login.
'; } diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 20f57f25..9580ab17 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -289,42 +289,32 @@ echo ' ); foreach($types as $link => $name) { - if($config['friendly_urls']) - echo '' . $name . '
'; - else - echo '' . $name . '
'; + echo '' . $name . '
'; } if($config['highscores_frags']) - if($config['friendly_urls']) - echo 'Frags
'; - else - echo 'Frags
'; - -echo '

'; + echo 'Frags
'; +echo '

'; if($config['highscores_vocation_box']) { echo - ' - - - - - + +
Choose a vocation
- [ALL]
'; + ' + + + + + - -
Choose a vocation
+ [ALL]
'; for($i = 1; $i < count($config_vocations) / 2; $i++) { - if($config['friendly_urls']) - echo '' . $config_vocations[$i] . '
'; - else - echo '' . $config_vocations[$i] . '
'; + echo '' . $config_vocations[$i] . '
'; } echo ' -
'; +
'; } ?>
+
@@ -85,14 +83,8 @@ if(isset($_GET['archive'])) $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'); - if($config['friendly_urls']) - $link .= '/archive/' . $news['id']; - else - $link .= 'archive&id=' . $news['id']; - $newses[] = array( - 'link' => $link, + 'link' => ($config['friendly_urls']) . getLink('news') . '/archive/' . $news['id'], 'icon_id' => $categories[$news['category']]['icon_id'], 'title' => stripslashes($news['title']), 'date' => $news['date'] @@ -283,8 +275,8 @@ if(!$news_cached) echo $twig->render('news.add.html.twig', array( 'action' => $action, - 'news_link' => getPageLink(PAGE), - 'news_link_form' => getPageLink('news', ($action == 'edit' ? 'edit' : 'add')), + 'news_link' => getLink(PAGE), + 'news_link_form' => getLink('news/' . ($action == 'edit' ? 'edit' : 'add')), 'news_id' => isset($id) ? $id : null, 'title' => isset($p_title) ? $p_title : '', 'body' => isset($body) ? $body : '', diff --git a/system/pages/screenshots.php b/system/pages/screenshots.php index 53915602..0a2b2b40 100644 --- a/system/pages/screenshots.php +++ b/system/pages/screenshots.php @@ -57,7 +57,7 @@ if($canEdit) { } echo $twig->render('screenshots.form.html.twig', array( - 'link' => getPageLink('screenshots', ($action == 'edit' ? 'edit' : 'add')), + 'link' => getLink('screenshots/' . ($action == 'edit' ? 'edit' : 'add')), 'action' => $action, 'id' => isset($id) ? $id : null, 'comment' => isset($comment) ? $comment : null, diff --git a/system/pages/serverinfo.php b/system/pages/serverinfo.php index fdfe442b..64cde270 100644 --- a/system/pages/serverinfo.php +++ b/system/pages/serverinfo.php @@ -20,10 +20,10 @@ if(isset($config['lua']['experience_stages']))

- Experience stages: Look here
+ Experience stages: Look here
- Commands: Look here
- Team: Look here
+ Commands: Look here
+ Team: Look here

@@ -184,6 +184,6 @@ if(isset($config['lua']['experience_stages']))

Other

-
  • Respect our rules.
  • +
  • Respect our rules.
  • Please report rule violations (Botters, players breaking rules etc) with CTRL + R.
  • diff --git a/system/template.php b/system/template.php index eba618f8..d641794e 100644 --- a/system/template.php +++ b/system/template.php @@ -72,23 +72,23 @@ else if(file_exists($template_path . '/config.php')) require($template_path . '/config.php'); $template = array(); -$template['link_account_manage'] = internalLayoutLink('account' . ($config['friendly_urls'] ? '/manage' : 'management')); -$template['link_account_create'] = internalLayoutLink(($config['friendly_urls'] ? 'account/create' : 'createaccount')); -$template['link_account_lost'] = internalLayoutLink(($config['friendly_urls'] ? 'account/lost' : 'lostaccount')); -$template['link_account_logout'] = internalLayoutLink(($config['friendly_urls'] ? 'account' : 'accountmanagement'), 'logout'); +$template['link_account_manage'] = getLink('account/manage'); +$template['link_account_create'] = getLink('account/create'); +$template['link_account_lost'] = getLink('account/lost'); +$template['link_account_logout'] = getLink('account/logout'); -$template['link_news_archive'] = internalLayoutLink('news' . ($config['friendly_urls'] ? '/' : '') . 'archive'); +$template['link_news_archive'] = getLink('news/archive'); $links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures', 'spells', 'commands', 'experienceStages', 'freeHouses', 'screenshots', 'movies', 'serverInfo', 'experienceTable', 'faq', 'points', 'gifts', 'bugtracker'); foreach($links as $link) { - $template['link_' . $link] = internalLayoutLink($link); + $template['link_' . $link] = getLink($link); } -$template['link_gifts_history'] = internalLayoutLink('gifts', 'show_history'); +$template['link_gifts_history'] = getLink('gifts', 'show_history'); if($config['forum'] != '') { if(strtolower($config['forum']) == 'site') - $template['link_forum'] = ""; + $template['link_forum'] = ""; else $template['link_forum'] = ""; } diff --git a/system/templates/account.change_comment.html.twig b/system/templates/account.change_comment.html.twig index dde79b80..93eb837e 100644 --- a/system/templates/account.change_comment.html.twig +++ b/system/templates/account.change_comment.html.twig @@ -1,6 +1,6 @@ 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.

    -
    +
    @@ -99,7 +99,7 @@ If you do not want to specify a certain field, just leave it blank.

    - +
    diff --git a/system/templates/account.change_info.html.twig b/system/templates/account.change_info.html.twig index e4301ff2..49679a3c 100644 --- a/system/templates/account.change_info.html.twig +++ b/system/templates/account.change_info.html.twig @@ -1,5 +1,5 @@ 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.

    - +
    @@ -89,7 +89,7 @@ Here you can tell other players about yourself. This information will be display
    - +
    diff --git a/system/templates/account.change_mail.html.twig b/system/templates/account.change_mail.html.twig index 3bece4d2..cbfd1467 100644 --- a/system/templates/account.change_mail.html.twig +++ b/system/templates/account.change_mail.html.twig @@ -1,5 +1,5 @@ Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. For security reasons, the actual change will be finalised after a waiting period of {{ config.account_mail_change }} days.

    - +
    @@ -58,7 +58,7 @@ Please enter your password and the new email address. Make sure that you enter a
    - +
    diff --git a/system/templates/account.change_name.html.twig b/system/templates/account.change_name.html.twig index f0affbce..ccf5fad1 100644 --- a/system/templates/account.change_name.html.twig +++ b/system/templates/account.change_name.html.twig @@ -1,6 +1,6 @@ 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.

    - +
    @@ -62,7 +62,7 @@ To change a name of character select player and choose a new name.
    - +
    diff --git a/system/templates/account.change_password.html.twig b/system/templates/account.change_password.html.twig index 53c917ad..f92f0665 100644 --- a/system/templates/account.change_password.html.twig +++ b/system/templates/account.change_password.html.twig @@ -1,6 +1,6 @@ Please enter your current password and a new password. For your security, please enter the new password twice.

    - +
    @@ -66,7 +66,7 @@ Please enter your current password and a new password. For your security, please
    - +
    diff --git a/system/templates/account.change_sex.html.twig b/system/templates/account.change_sex.html.twig index 4feb7540..da0d25b4 100644 --- a/system/templates/account.change_sex.html.twig +++ b/system/templates/account.change_sex.html.twig @@ -1,6 +1,6 @@ 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.

    - +
    @@ -64,7 +64,7 @@ To change a sex of character select player and choose a new sex.

    + + +
    - +
    diff --git a/system/templates/account.create.html.twig b/system/templates/account.create.html.twig index 7a340b3e..6ce4ab96 100644 --- a/system/templates/account.create.html.twig +++ b/system/templates/account.create.html.twig @@ -1,7 +1,7 @@ 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.

    - +
    @@ -139,7 +139,11 @@ Also you have to agree to the terms presented below. If you have done so, your a {% endif %}
    -
    +
    +
    diff --git a/system/templates/account.create_character.html.twig b/system/templates/account.create_character.html.twig index d138f511..2d93515d 100644 --- a/system/templates/account.create_character.html.twig +++ b/system/templates/account.create_character.html.twig @@ -6,7 +6,7 @@ In any case the name must not violate the naming conventions stated in the You have maximum number of characters per account on your account. Delete one before you make new. {% endif %}

    - +
    @@ -134,7 +134,7 @@ In any case the name must not violate the naming conventions stated in the
    - +
    diff --git a/system/templates/account.delete_character.html.twig b/system/templates/account.delete_character.html.twig index 6bf677f0..31ba9129 100644 --- a/system/templates/account.delete_character.html.twig +++ b/system/templates/account.delete_character.html.twig @@ -1,5 +1,5 @@ To delete a character enter the name of the character and your password.

    - +
    @@ -54,7 +54,7 @@ To delete a character enter the name of the character and your password.

    - + + + +
    diff --git a/system/templates/account.generate_new_recovery_key.html.twig b/system/templates/account.generate_new_recovery_key.html.twig index b65f0eb3..19e86b56 100644 --- a/system/templates/account.generate_new_recovery_key.html.twig +++ b/system/templates/account.generate_new_recovery_key.html.twig @@ -1,61 +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:
    -
    -
    -
    -
    - - -
    - - - - +
    -
    -
    -
    +
    +
    + + + + +
    Generate recovery key
    + + + + +
    +
    + + + +
    +
    + + + + + +
    Password:
    +
    +
    + +
    + + + - - -
    + + + + -
    +
    +
    +
    -
    - - - - - - -
    -
    -
    -
    -
    \ No newline at end of file +
    +
    + + + + + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/system/templates/account.generate_recovery_key.html.twig b/system/templates/account.generate_recovery_key.html.twig index 94e1e59e..81b52163 100644 --- a/system/templates/account.generate_recovery_key.html.twig +++ b/system/templates/account.generate_recovery_key.html.twig @@ -1,5 +1,5 @@ To generate recovery key for your account please enter your password.

    -
    +
    @@ -50,7 +50,7 @@ To generate recovery key for your account please enter your password.

    - +
    diff --git a/system/templates/account.login.html.twig b/system/templates/account.login.html.twig index f845a7e8..630eb07c 100644 --- a/system/templates/account.login.html.twig +++ b/system/templates/account.login.html.twig @@ -1,5 +1,5 @@ Please enter your account {{ account|lower }} and your password.
    Create an account if you do not have one yet.

    - + {% if redirect is not null %} {% endif %} @@ -66,7 +66,7 @@ Please enter your account {{ account|lower }} and your password.
    - +
    diff --git a/system/templates/account.logout.html.twig b/system/templates/account.logout.html.twig index 9bacfed9..f74c9ffd 100644 --- a/system/templates/account.logout.html.twig +++ b/system/templates/account.logout.html.twig @@ -18,7 +18,7 @@
    - +
    You have logged out of your {{ config.serverName }} account. In order to view your account you need to log in again.You have logged out of your {{ config.serverName }} account. In order to view your account you need to log in again.
    diff --git a/system/templates/account.lost.noaction.html.twig b/system/templates/account.lost.noaction.html.twig index bfec0d31..61a494f7 100644 --- a/system/templates/account.lost.noaction.html.twig +++ b/system/templates/account.lost.noaction.html.twig @@ -2,7 +2,7 @@ Please select action.
    diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig index 4ff0a4f8..070b385f 100644 --- a/system/templates/account.management.html.twig +++ b/system/templates/account.management.html.twig @@ -11,7 +11,7 @@
    - + back - +
    @@ -61,7 +61,7 @@
    - +
    @@ -93,12 +93,12 @@ - +
    Note:A request has beefffn submitted to change the email address of this account to {{ email_new }}. After {{ email_new_time|date("j F Y, G:i:s") }} you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!A request has been submitted to change the email address of this account to {{ email_new }}. After {{ email_new_time|date("j F Y, G:i:s") }} you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!
    - +
    @@ -194,7 +194,7 @@
    - +
    @@ -206,7 +206,7 @@
    - +
    @@ -223,7 +223,7 @@ {% if recovery_key is empty %} - +
    @@ -295,7 +295,7 @@
    - + {% endif %} - + {% endfor %}
    @@ -450,7 +450,7 @@ {% else %}
    Offline[Edit][Edit]
    @@ -469,7 +469,7 @@
    - +
    @@ -482,7 +482,7 @@ {% if config.account_change_character_name %}
    - +
    @@ -495,7 +495,7 @@ {% if config.account_change_character_sex %}
    - +
    @@ -508,7 +508,7 @@
    - +
    diff --git a/system/templates/account.redirect.html.twig b/system/templates/account.redirect.html.twig index daf830c2..ac439308 100644 --- a/system/templates/account.redirect.html.twig +++ b/system/templates/account.redirect.html.twig @@ -28,9 +28,9 @@
    \ No newline at end of file diff --git a/system/templates/forum.new_thread.html.twig b/system/templates/forum.new_thread.html.twig index 7c31b2d1..39af3fdd 100644 --- a/system/templates/forum.new_thread.html.twig +++ b/system/templates/forum.new_thread.html.twig @@ -1,5 +1,5 @@ - + diff --git a/system/templates/success.html.twig b/system/templates/success.html.twig index 7dcfca7f..287b09da 100644 --- a/system/templates/success.html.twig +++ b/system/templates/success.html.twig @@ -32,7 +32,7 @@ {% else %}
    - +
    diff --git a/templates/kathrine/account.change_name.html.twig b/templates/kathrine/account.change_name.html.twig index 704a0f0e..9af283e3 100644 --- a/templates/kathrine/account.change_name.html.twig +++ b/templates/kathrine/account.change_name.html.twig @@ -1,6 +1,6 @@ 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

    @@ -33,7 +33,7 @@ To change a name of character select player and choose a new name.

    - +
    diff --git a/templates/kathrine/success.html.twig b/templates/kathrine/success.html.twig index bfa1cb1e..acc034e7 100644 --- a/templates/kathrine/success.html.twig +++ b/templates/kathrine/success.html.twig @@ -5,7 +5,7 @@ {% else %}
    - +
    diff --git a/templates/kathrine/template.php b/templates/kathrine/template.php index e5c3d975..aded1e73 100644 --- a/templates/kathrine/template.php +++ b/templates/kathrine/template.php @@ -53,9 +53,9 @@ defined('MYAAC') or die('Direct access not allowed!'); '; } ?> @@ -159,7 +159,7 @@ defined('MYAAC') or die('Direct access not allowed!');
    - +
    » » "; + window.location = ""; } else { - window.location = ""; + window.location = ""; } } function LoginstatusTextAction(source) { if(loginStatus == "false") { - window.location = ""; + window.location = ""; } else { - window.location = ""; + window.location = ""; } } @@ -199,7 +199,7 @@ if(isset($config['boxes']))