diff --git a/admin/index.php b/admin/index.php
index 35f4d536..fecc26c1 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -25,6 +25,8 @@ require(SYSTEM . 'status.php');
require(SYSTEM . 'login.php');
require(ADMIN . 'includes/functions.php');
+$twig->addGlobal('config', $config);
+
// if we're not logged in - show login box
if(!$logged || !admin()) {
$page = 'login';
diff --git a/config.php b/config.php
index e239407b..79eafde6 100644
--- a/config.php
+++ b/config.php
@@ -45,7 +45,7 @@ $config = array(
// footer
'footer' => ''/*'
Your Server © 2016. All rights reserved.'*/,
- 'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & load time, 6 - queries & memory usage, 7 - all
+ 'debug_level' => 0, // 0 - disabled, 1 - show load time, 2 - show db query counter, 3 - both, 4 - memory usage, 5 - load time & memory usage, 6 - queries & memory usage, 7 - all
'language' => 'en', // default language (currently only 'en' available)
'language_allow_change' => false,
diff --git a/index.php b/index.php
index 33305ed5..c6a05105 100644
--- a/index.php
+++ b/index.php
@@ -55,6 +55,8 @@ require_once(SYSTEM . 'login.php');
require_once(SYSTEM . 'status.php');
require_once(SYSTEM . 'template.php');
+$twig->addGlobal('config', $config);
+
// database migrations
$tmp = '';
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
diff --git a/system/functions.php b/system/functions.php
index 6f77edb7..de2bcf56 100644
--- a/system/functions.php
+++ b/system/functions.php
@@ -601,7 +601,7 @@ function check_name_new_char($name, &$error = '')
$player = new OTS_Player();
$player->find($name);
if($player->isLoaded()) {
- $error = 'Player with this name already exist.';
+ $error = 'Character with this name already exist.';
return false;
}
@@ -614,28 +614,19 @@ function check_name_new_char($name, &$error = '')
}
}
- $monsters = $db->query(
- 'SELECT ' . $db->fieldName('name') .
- ' FROM ' . $db->tableName(TABLE_PREFIX . 'monsters') .
- ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
+ $monsters = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'monsters` WHERE `name` LIKE ' . $db->quote($name_lower));
if($monsters->rowCount() > 0) {
$error = 'Your name cannot contains monster name.';
return false;
}
- $spells_name = $db->query(
- 'SELECT ' . $db->fieldName('name') .
- ' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
- ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($name_lower));
+ $spells_name = $db->query('SELECT `name` FROM `' . TABLE_PREFIX . 'spells` WHERE `name` LIKE ' . $db->quote($name_lower));
if($spells_name->rowCount() > 0) {
$error = 'Your name cannot contains spell name.';
return false;
}
- $spells_words = $db->query(
- 'SELECT ' . $db->fieldName('words') .
- ' FROM ' . $db->tableName(TABLE_PREFIX . 'spells') .
- ' WHERE ' . $db->fieldName('words') . ' = ' . $db->quote($name_lower));
+ $spells_words = $db->query('SELECT `words` FROM `' . TABLE_PREFIX . 'spells` WHERE `words` = ' . $db->quote($name_lower));
if($spells_words->rowCount() > 0) {
$error = 'Your name cannot contains spell name.';
return false;
diff --git a/system/init.php b/system/init.php
index 3911d59d..29abf443 100644
--- a/system/init.php
+++ b/system/init.php
@@ -39,7 +39,6 @@ $function = new Twig_SimpleFunction('getStyle', function ($i) {
return getStyle($i);
});
$twig->addFunction($function);
-$twig->addGlobal('config', $config);
// trim values we receive
if(isset($_POST))
diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php
index 0231d5b6..a1d16c20 100644
--- a/system/pages/accountmanagement.php
+++ b/system/pages/accountmanagement.php
@@ -130,7 +130,6 @@ if(!$logged)
'account_registered' => $account_registered,
'account_rlname' => $account_rlname,
'account_location' => $account_location,
- 'config' => $config,
'actions' => $actions,
'players' => $players
));
@@ -195,7 +194,6 @@ if(!$logged)
if($config['mail_enabled'] && $config['send_mail_when_change_password'])
{
$mailBody = $twig->render('mail.password_changed.html.twig', array(
- 'config' => $config,
'new_password' => $org_pass
));
@@ -314,7 +312,7 @@ if(!$logged)
$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] . '.');
+ $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.twig', array(
'title' => 'Public Information Changed',
'description' => 'Your public information has been changed.'
@@ -380,7 +378,7 @@ if(!$logged)
echo '
';
}
else
- $reg_errors[] = 'Your account is already registred.';
+ $reg_errors[] = 'Your account is already registered.';
}
else
$reg_errors[] = 'Wrong password to account.';
@@ -666,7 +664,6 @@ if(!$logged)
echo $twig->render('error_box.html.twig', array('errors' => $errors));
}
echo $twig->render('account.change_sex.html.twig', array(
- 'config' => $config,
'players' => $account_logged->getPlayersList(),
'player_sex' => isset($player) ? $player->getSex() : -1,
'points' => $points
@@ -747,12 +744,18 @@ if(!$logged)
if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) {
if(empty($newchar_name))
$errors[] = 'Please enter a name for your character!';
-
- if(strlen($newchar_name) > 25)
+ else if(strlen($newchar_name) > 25)
$errors[] = 'Name is too long. Max. lenght 25 letters.';
else if(strlen($newchar_name) < 3)
- $errors[] = 'Name is too short. Min. lenght 25 letters.';
-
+ $errors[] = 'Name is too short. Min. lenght 3 letters.';
+ else {
+ $exist = new OTS_Player();
+ $exist->find($newchar_name);
+ if($exist->isLoaded()) {
+ $errors[] = 'Character with this name already exist.';
+ }
+ }
+
if(empty($newchar_sex) && $newchar_sex != "0")
$errors[] = 'Please select the sex for your character!';
@@ -772,12 +775,6 @@ if(!$logged)
$newchar_town = $config['character_towns'][0];
}
- $exist = new OTS_Player();
- $exist->find($newchar_name);
- if($exist->isLoaded()) {
- $errors[] .= 'Character with this name already exist.';
- }
-
if(empty($errors)) {
$error = '';
if(!admin() && !check_name_new_char($newchar_name, $error)) {
@@ -923,39 +920,11 @@ if(!$logged)
if(!$newchar_created) {
echo $twig->render('account.create_character.html.twig', array(
- 'config' => $config,
- 'newchar_name' => $newchar_name
-
+ 'name' => $newchar_name,
+ 'sex' => $newchar_sex,
+ 'vocation' => $newchar_vocation,
+ 'town' => $newchar_town
));
-
- echo ' ';
- if(count($config['character_samples']) > 1)
- {
- echo '';
- }
- if(count($config['character_towns']) > 1)
- {
- echo ' | |
';
- }
- else
- echo '';
- echo '
';
}
}
?>
diff --git a/system/pages/characters.php b/system/pages/characters.php
index 27d27872..4bee5e82 100644
--- a/system/pages/characters.php
+++ b/system/pages/characters.php
@@ -80,7 +80,8 @@ if($player->isLoaded() && !$player->isDeleted())
$account = $player->getAccount();
$rows = 0;
- $outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . (fieldExist('lookaddons', 'players') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
+ if($config['characters']['outfit'])
+ $outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . (fieldExist('lookaddons', 'players') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet();
$flag = '';
if($config['account_country'])
@@ -396,10 +397,9 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
}
echo $twig->render('characters.html.twig', array(
- 'outfit' => $outfit,
+ 'outfit' => isset($outfit) ? $outfit : null,
'player' => $player,
'account' => $account,
- 'config' => $config,
'flag' => $flag,
'oldName' => $oldName,
'sex' => $player_sex,
diff --git a/system/pages/forum.php b/system/pages/forum.php
index fb8b82d8..1d35e82c 100644
--- a/system/pages/forum.php
+++ b/system/pages/forum.php
@@ -621,7 +621,6 @@ if($action == 'new_thread')
echo $twig->render('forum.new_thread.html.twig', array(
'section_id' => $section_id,
- 'config' => $config,
'players' => $players_from_account,
'post_player_id' => $char_id,
'post_thread' => $post_topic,
diff --git a/system/pages/news.php b/system/pages/news.php
index 72c2377a..d37c2fe6 100644
--- a/system/pages/news.php
+++ b/system/pages/news.php
@@ -280,7 +280,6 @@ if(!$news_cached)
$account_players->orderBy('group_id', POT::ORDER_DESC);
echo $twig->render('news.add.html.twig', array(
- 'config' => $config,
'action' => $action,
'news_link' => getPageLink(PAGE),
'news_link_form' => getPageLink('news', ($action == 'edit' ? 'edit' : 'add')),
diff --git a/system/templates/account.change_info.html.twig b/system/templates/account.change_info.html.twig
index af9511f4..e4301ff2 100644
--- a/system/templates/account.change_info.html.twig
+++ b/system/templates/account.change_info.html.twig
@@ -16,7 +16,7 @@ Here you can tell other players about yourself. This information will be display
- {{ config.darkborder }}
+ |
\ No newline at end of file
+
+
+
+
+ {% if config.character_samples|length > 1 %}
+
+
+
+ Select your vocation: |
+
+
+ |
+
+
+ {% endif %}
+ {% if config.character_towns|length > 1 %}
+ |
+
+
+ Select your city: |
+
+
+ |
+
+
+ |
+ {% endif %}
+
+
+
+ |
+
+
+
+
+
\ No newline at end of file
diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig
index f3962e01..4ff0a4f8 100644
--- a/system/templates/account.management.html.twig
+++ b/system/templates/account.management.html.twig
@@ -174,7 +174,7 @@
{{ account_status }} |
- Registred: |
+ Registered: |
{{ account_registered }} |
{% endautoescape %}
diff --git a/templates/kathrine/template.php b/templates/kathrine/template.php
index 84a9567f..04183f79 100644
--- a/templates/kathrine/template.php
+++ b/templates/kathrine/template.php
@@ -90,31 +90,28 @@ defined('MYAAC') or die('Direct access not allowed!');
Characters
Guilds
-
Wars
- ';
- ?>
+ if(isset($config['wars'])): ?>
+
+ Wars
+
+
Highscores
Last Deaths
Houses
-
-
-
+
+
Bans
-
-
-
- ';
- ?>
+
+
+ Forum
+
+
Team