From bf361238cb9d82d0b2508de632bdd8d07d964a85 Mon Sep 17 00:00:00 2001 From: slawkens Date: Tue, 29 May 2018 21:06:15 +0200 Subject: [PATCH] * remove whitespaces --- index.php | 26 ++++++------ install/index.php | 2 +- install/steps/1-welcome.php | 2 +- install/steps/5-database.php | 8 ++-- install/steps/7-finish.php | 16 +++---- install/tools/5-database.php | 4 +- install/tools/7-finish.php | 4 +- system/bin/install_plugin.php | 2 +- system/functions.php | 61 +++++++++++++-------------- system/hooks.php | 4 +- system/libs/plugins.php | 24 +++++------ system/libs/pot/OTS_Base_DB.php | 12 +++--- system/libs/pot/OTS_DB_MySQL.php | 24 +++++------ system/pages/accountmanagement.php | 12 +++--- system/pages/admin/items.php | 2 +- system/pages/admin/menus.php | 24 +++++------ system/pages/admin/plugins.php | 6 +-- system/pages/characters.php | 68 +++++++++++++++--------------- system/pages/createaccount.php | 8 ++-- system/pages/forum.php | 28 ++++++------ system/pages/highscores.php | 8 ++-- system/pages/news.php | 42 +++++++++--------- system/pages/online.php | 6 +-- tools/news_preview.php | 8 ++-- tools/signature/index.php | 8 ++-- tools/signature/mango.php | 4 +- tools/validate.php | 8 ++-- 27 files changed, 210 insertions(+), 211 deletions(-) diff --git a/index.php b/index.php index 4390e8f8..416be941 100644 --- a/index.php +++ b/index.php @@ -46,7 +46,7 @@ define('URI', $uri); if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) { $tmp = explode('.', $uri); $_REQUEST['name'] = urldecode($tmp[0]); - + chdir(TOOLS . 'signature'); include TOOLS . 'signature/index.php'; exit(); @@ -122,20 +122,20 @@ else { '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'), '/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2') ); - + 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; } @@ -204,7 +204,7 @@ $hooks->trigger(HOOK_STARTUP); if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) { $report_time = 30 * 24 * 60 * 60; // report one time per 30 days $should_report = true; - + $value = ''; if($cache->enabled() && $cache->fetch('last_usage_report', $value)) { $should_report = time() > (int)$value + $report_time; @@ -222,11 +222,11 @@ if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_stat $should_report = false; } } - + if($should_report) { - require_once(LIBS . 'usage_statistics.php'); + require_once LIBS . 'usage_statistics.php'; Usage_Statistics::report(); - + updateDatabaseConfig('last_usage_report', time()); if($cache->enabled()) { $cache->set('last_usage_report', time()); @@ -282,7 +282,7 @@ if($config['backward_support']) { $tickers_content = ''; $subtopic = PAGE; $main_content = ''; - + $config['access_admin_panel'] = 2; $group_id_of_acc_logged = 0; if($logged && $account_logged) @@ -302,7 +302,7 @@ if($config['backward_support']) { $config['site']['download_page'] = true; $config['site']['serverinfo_page'] = true; $config['site']['screenshot_page'] = true; - + if($config['forum'] != '') $config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']); @@ -367,7 +367,7 @@ if($load_it) } else $content .= $query['body']; // plain html - + if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) { $content = $twig->render('admin.pages.links.html.twig', array( 'page' => array('id' => $query['id'], 'hidden' => $query['hidden']) @@ -428,7 +428,7 @@ if(superAdmin()) { if(function_exists('memory_get_peak_usage')) { echo PHP_EOL . ''; } - + if($config['database_log']) { echo PHP_EOL . ''; } diff --git a/install/index.php b/install/index.php index f40ca5cd..28d772d2 100644 --- a/install/index.php +++ b/install/index.php @@ -170,7 +170,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) { $allow = true; } } - + if(!$allow) { $content = warning('In file install/ip.txt must be your IP!
diff --git a/install/steps/1-welcome.php b/install/steps/1-welcome.php index 6080aef6..c50d00e9 100644 --- a/install/steps/1-welcome.php +++ b/install/steps/1-welcome.php @@ -5,7 +5,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save } else { unset($_SESSION['saved']); - + $locales = array(); foreach(get_locales() as $tmp_locale) { diff --git a/install/steps/5-database.php b/install/steps/5-database.php index c4512731..790e23ea 100644 --- a/install/steps/5-database.php +++ b/install/steps/5-database.php @@ -55,7 +55,7 @@ if(!$error) { 'url' => 'tools/5-database.php', 'message' => $locale['loading_spinner'] )); - + if(!$error) { if(!Validator::email($_SESSION['var_mail_admin'])) { error($locale['step_config_mail_admin_error']); @@ -65,7 +65,7 @@ if(!$error) { error($locale['step_config_mail_address_error']); $error = true; } - + $content .= '$config[\'client_download\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/exe/windows\';'; $content .= PHP_EOL; $content .= '$config[\'client_download_linux\'] = \'http://tibia-clients.com/clients/download/\'. $config[\'client\'] . \'/tar/linux\';'; @@ -78,7 +78,7 @@ if(!$error) { if(!$error) { $saved = file_put_contents(BASE . 'config.local.php', $content); } - + if($saved) { if(!$error) { $_SESSION['saved'] = true; @@ -87,7 +87,7 @@ if(!$error) { else { $_SESSION['config_content'] = $content; unset($_SESSION['saved']); - + $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.local.php', $locale['step_database_error_file']); warning($locale['step_database_error_file'] . '
'); diff --git a/install/steps/7-finish.php b/install/steps/7-finish.php index dac94bfa..96b42e68 100644 --- a/install/steps/7-finish.php +++ b/install/steps/7-finish.php @@ -14,7 +14,7 @@ else { $account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : null; $password = $_SESSION['var_password']; - + $config_salt_enabled = $db->hasColumn('accounts', 'salt'); if($config_salt_enabled) { @@ -35,7 +35,7 @@ else { { $player = new OTS_Player(); $player->setName('Admin'); - + $player_used = &$player; } else { @@ -48,7 +48,7 @@ else { $account_db->setPassword(encrypt($password)); $account_db->setEMail($_SESSION['var_mail_admin']); $account_db->save(); - + $account_used = &$account_db; } else { @@ -59,16 +59,16 @@ else { else { $new_account->create(null, $account_id); } - + $new_account->setPassword(encrypt($password)); $new_account->setEMail($_SESSION['var_mail_admin']); - + $new_account->unblock(); $new_account->save(); - + $new_account->setCustomField('created', time()); $new_account->logAction('Account created.'); - + $account_used = &$new_account; } @@ -114,7 +114,7 @@ else { success($locale['step_database_created_news']); } } - + echo $twig->render('install.installer.html.twig', array( 'url' => 'tools/7-finish.php', 'message' => $locale['importing_spinner'] diff --git a/install/tools/5-database.php b/install/tools/5-database.php index 19ba1090..9e96fd70 100644 --- a/install/tools/5-database.php +++ b/install/tools/5-database.php @@ -46,7 +46,7 @@ else { // import schema try { $db->query(file_get_contents(BASE . 'install/includes/schema.sql')); - + registerDatabaseConfig('database_version', DATABASE_VERSION); $locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']); success($locale['step_database_success_schema']); @@ -201,7 +201,7 @@ if(!$db->hasColumn('players', 'comment')) { if($db->hasColumn('players', 'rank_id')) { if(query("ALTER TABLE players MODIFY `rank_id` INT(11) NOT NULL DEFAULT 0;")) success($locale['step_database_modifying_field'] . ' players.rank_id...'); - + if($db->hasColumn('players', 'guildnick')) { if(query("ALTER TABLE players MODIFY `guildnick` VARCHAR(255) NOT NULL DEFAULT '';")) { success($locale['step_database_modifying_field'] . ' players.guildnick...'); diff --git a/install/tools/7-finish.php b/install/tools/7-finish.php index 908dc132..9b2603e3 100644 --- a/install/tools/7-finish.php +++ b/install/tools/7-finish.php @@ -23,7 +23,7 @@ if($db->hasColumn('players', 'deletion')) $time = time(); function insert_sample_if_not_exist($p) { global $db, $success, $deleted, $time; - + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($p['name'])); if($query->rowCount() == 0) { if(!query("INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hidden`, `comment`) VALUES (null, " . $db->quote($p['name']) . ", 1, " . getSession('account') . ", " . $p['level'] . ", " . $p['vocation_id'] . ", " . $p['health'] . ", " . $p['healthmax'] . ", " . $p['experience'] . ", 118, 114, 38, 57, " . $p['looktype'] . ", 0, " . $p['mana'] . ", " . $p['manamax'] . ", 0, " . $p['soul'] . ", 1, 1000, 1000, 7, '', " . $p['cap'] . ", 1, " . $time . ", 2130706433, 1, " . $time . ", 0, 0, " . $time . ", 1, '');")) @@ -57,7 +57,7 @@ else require LIBS . 'creatures.php'; if(Creatures::loadFromXML()) { success($locale['step_database_loaded_monsters']); - + if(Creatures::getMonstersList()->hasErrors()) { $locale['step_database_error_monsters'] = str_replace('$LOG$', 'system/logs/error.log', $locale['step_database_error_monsters']); warning($locale['step_database_error_monsters']); diff --git a/system/bin/install_plugin.php b/system/bin/install_plugin.php index 21c267b6..0fb7f5f6 100644 --- a/system/bin/install_plugin.php +++ b/system/bin/install_plugin.php @@ -28,7 +28,7 @@ if(Plugins::install($path_to_file)) { foreach(Plugins::getWarnings() as $warning) { echo 'WARNING: ' . $warning; } - + $info = Plugins::getPlugin(); echo (isset($info['name']) ? $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.'; } diff --git a/system/functions.php b/system/functions.php index adcf1bc9..198d851d 100644 --- a/system/functions.php +++ b/system/functions.php @@ -13,7 +13,7 @@ function message($message, $type, $return) { if($return) return '
' . $message . '
'; - + echo '
' . $message . '
'; return true; } @@ -74,7 +74,7 @@ function getPlayerLink($name, $generate = true) if($player->isLoaded()) $name = $player->getName(); } - + $url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'characters/' . urlencode($name); if(!$generate) return $url; @@ -92,9 +92,9 @@ function getHouseLink($name, $generate = true) if($house->rowCount() > 0) $name = $house->fetchColumn(); } - + $url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . 'houses/' . urlencode($name); - + if(!$generate) return $url; return generateLink($url, $name); } @@ -124,14 +124,14 @@ function getItemNameById($id) { $item = $query->fetch(); return $item['name']; } - + return ''; } function getItemImage($id, $count = 1) { $tooltip = ''; - + $name = getItemNameById($id); if(!empty($name)) { $tooltip = ' class="tooltip" title="' . $name . '"'; @@ -157,7 +157,7 @@ function getFlagImage($country) if(!isset($config['countries'][$country])) { return ''; } - + return ''; } @@ -227,7 +227,7 @@ function getForumBoards() ' ORDER BY `ordering`;'); if($sections) return $sections->fetchAll(); - + return array(); } @@ -350,7 +350,7 @@ function delete_player($name) $player->delete(); return true; } - + return false; } @@ -365,7 +365,7 @@ function delete_guild($id) $rank_list = $guild->getGuildRanksList(); if(count($rank_list) > 0) { $rank_list->orderBy('level'); - + global $db, $ots; foreach($rank_list as $rank_in_guild) { if($db->hasTable('guild_members')) @@ -382,7 +382,7 @@ function delete_guild($id) $player->load($result['id']); if(!$player->isLoaded()) continue; - + $player->setRank(); $player->save(); } @@ -408,7 +408,7 @@ function short_text($text, $limit) function tickers() { global $tickers_content, $featured_article; - + if(PAGE === 'news') { if(isset($tickers_content)) return $tickers_content . $featured_article; @@ -467,7 +467,7 @@ function template_header($is_admin = false) Please turn it on, or be aware that some features on this website will not work correctly. '; - + if($config['recaptcha_enabled']) $ret .= ""; return $ret; @@ -508,7 +508,7 @@ function template_ga_code() global $config, $twig; if(!isset($config['google_analytics_id'][0])) return ''; - + return $twig->render('google_analytics.html.twig'); } @@ -552,7 +552,7 @@ function getCreatureName($killer, $showStatus = false, $extendedInfo = false) global $vowels, $ots, $config; $str = ""; $players_rows = ''; - + if(is_numeric($killer)) { $player = new OTS_Player(); @@ -762,17 +762,17 @@ function get_templates() function get_plugins() { $ret = array(); - + $path = PLUGINS; foreach(scandir($path) as $file) { $file_ext = pathinfo($file, PATHINFO_EXTENSION); $file_name = pathinfo($file, PATHINFO_FILENAME); if ($file === '.' || $file === '..' || $file === 'disabled' || $file === 'example.json' || $file_ext !== 'json' || is_dir($path . $file)) continue; - + $ret[] = str_replace('.json', '', $file_name); } - + return $ret; } function getWorldName($id) @@ -780,7 +780,7 @@ function getWorldName($id) global $config; if(isset($config['worlds'][$id])) return $config['worlds'][$id]; - + return $config['lua']['serverName']; } @@ -864,7 +864,7 @@ function log_append($file, $str) function load_config_lua($filename) { global $config; - + $config_file = $filename; if(!@file_exists($config_file)) { @@ -884,7 +884,7 @@ function load_config_lua($filename) $delimiter = '"'; if(strpos($line, $delimiter) === false) $delimiter = "'"; - + $tmp = explode($delimiter, $line); $result = array_merge($result, load_config_lua($config['server_path'] . $tmp[1])); } @@ -897,7 +897,7 @@ function load_config_lua($filename) if(strpos($value, '--') !== false) {// found some deep comment $value = preg_replace('/--.*$/i', '', $value); } - + if(is_numeric($value)) $result[$key] = (float) $value; elseif(in_array(substr($value, 0 , 1), array("'", '"')) && in_array(substr($value, -1 , 1), array("'", '"'))) @@ -933,7 +933,7 @@ function str_replace_first($search, $replace, $subject) { if ($pos !== false) { return substr_replace($subject, $replace, $pos, strlen($search)); } - + return $subject; } @@ -960,7 +960,7 @@ function unsetSession($key) { function getTopPlayers($limit = 5) { global $cache, $config, $db; - + $fetch_from_db = true; if($cache->enabled()) { @@ -971,7 +971,7 @@ function getTopPlayers($limit = 5) { $fetch_from_db = false; } } - + if($fetch_from_db) { $deleted = 'deleted'; @@ -994,11 +994,11 @@ function getTopPlayers($limit = 5) { $player['rank'] = ++$i; } unset($player); - + if($cache->enabled()) $cache->set('top_' . $limit . '_level', serialize($players), 120); } - + return $players; } @@ -1006,7 +1006,7 @@ function deleteDirectory($dir) { if(!file_exists($dir)) { return true; } - + if(!is_dir($dir)) { return unlink($dir); } @@ -1015,12 +1015,12 @@ function deleteDirectory($dir) { if($item === '.' || $item === '..') { continue; } - + if(!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) { return false; } } - + return rmdir($dir); } @@ -1036,4 +1036,3 @@ function config($key) { // validator functions require_once LIBS . 'validator.php'; require_once SYSTEM . 'compat.php'; -?> diff --git a/system/hooks.php b/system/hooks.php index 0f3c565f..f4b36205 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -44,7 +44,7 @@ class Hook $tmp = $this->_callback; $ret = $tmp($params); }*/ - + global $db, $config, $template_path, $ots, $content, $twig; if(file_exists(BASE . $this->_file)) { $ret = require BASE . $this->_file; @@ -85,7 +85,7 @@ class Hooks public function exist($type) { return isset(self::$_hooks[$type]); } - + public function load() { global $db; diff --git a/system/libs/plugins.php b/system/libs/plugins.php index 78bb56ff..8a6f6598 100644 --- a/system/libs/plugins.php +++ b/system/libs/plugins.php @@ -39,30 +39,30 @@ spl_autoload_register(function ($class) { }); function is_sub_dir($path = NULL, $parent_folder = SITE_PATH) { - + //Get directory path minus last folder $dir = dirname($path); $folder = substr($path, strlen($dir)); - + //Check the the base dir is valid $dir = realpath($dir); - + //Only allow valid filename characters $folder = preg_replace('/[^a-z0-9\.\-_]/i', '', $folder); - + //If this is a bad path or a bad end folder name if( !$dir OR !$folder OR $folder === '.') { return FALSE; } - + //Rebuild path $path = $dir. '/' . $folder; - + //If this path is higher than the parent folder if( strcasecmp($path, $parent_folder) > 0 ) { return $path; } - + return FALSE; } @@ -311,7 +311,7 @@ class Plugins { self::$error = "You cannot use absolute paths (starting with slash - '/'): " . $file; break; } - + $file = str_replace('\\', '/', BASE . $file); $realpath = str_replace('\\', '/', realpath(dirname($file))); if(!is_sub_dir($file, BASE) || $realpath != dirname($file)) { @@ -320,7 +320,7 @@ class Plugins { break; } } - + if($success) { foreach($plugin_info['uninstall'] as $file) { if(!deleteDirectory(BASE . $file)) { @@ -328,7 +328,7 @@ class Plugins { } } } - + if (isset($plugin_info['hooks'])) { foreach ($plugin_info['hooks'] as $_name => $info) { if (defined('HOOK_'. $info['type'])) { @@ -387,7 +387,7 @@ class Plugins { public static function getPlugin() { return self::$plugin; } - + public static function removeComments($string) { $string = preg_replace('!/\*.*?\*/!s', '', $string); $string = preg_replace('/\n\s*\n/', "\n", $string); @@ -400,7 +400,7 @@ class Plugins { // Strip blank lines $string = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $string); - + return $string; } } \ No newline at end of file diff --git a/system/libs/pot/OTS_Base_DB.php b/system/libs/pot/OTS_Base_DB.php index 8cb16549..d9645304 100644 --- a/system/libs/pot/OTS_Base_DB.php +++ b/system/libs/pot/OTS_Base_DB.php @@ -14,18 +14,18 @@ /** * Base class for all database drivers. - * + * *

* It defines additional rotines required by database driver for POT using default SQL standard-compliant method. *

- * + * * @package POT */ abstract class OTS_Base_DB extends PDO implements IOTS_DB { /** * Tables prefix. - * + * * @var string */ protected $prefix = ''; @@ -42,7 +42,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB /** * Query-quoted field name. - * + * * @param string $name Field name. * @return string Quoted name. */ @@ -67,7 +67,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB /** * Query-quoted table name. - * + * * @param string $name Table name. * @return string Quoted name. */ @@ -242,7 +242,7 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB public function queries() { return $this->queries; } - + public function getLog() { return $this->log; } diff --git a/system/libs/pot/OTS_DB_MySQL.php b/system/libs/pot/OTS_DB_MySQL.php index 85656c65..2441d1f9 100644 --- a/system/libs/pot/OTS_DB_MySQL.php +++ b/system/libs/pot/OTS_DB_MySQL.php @@ -14,11 +14,11 @@ /** * MySQL connection interface. - * + * *

* At all everything that you really need to read from this class documentation is list of parameters for driver's constructor. *

- * + * * @package POT * @version 0.1.3 */ @@ -28,15 +28,15 @@ class OTS_DB_MySQL extends OTS_Base_DB private $has_column_cache = array(); /** * Creates database connection. - * + * *

* Connects to MySQL database on given arguments. *

- * + * *

* List of parameters for this drivers: *

- * + * * - * + * * @version 0.0.6 * @param array $params Connection parameters. * @throws PDOException On PDO operation error. @@ -138,7 +138,7 @@ class OTS_DB_MySQL extends OTS_Base_DB /** * Query-quoted field name. - * + * * @param string $name Field name. * @return string Quoted name. */ @@ -149,7 +149,7 @@ class OTS_DB_MySQL extends OTS_Base_DB /** * LIMIT/OFFSET clause for queries. - * + * * @param int|bool $limit Limit of rows to be affected by query (false if no limit). * @param int|bool $offset Number of rows to be skipped before applying query effects (false if no offset). * @return string LIMIT/OFFSET SQL clause for query. @@ -182,20 +182,20 @@ class OTS_DB_MySQL extends OTS_Base_DB return $this->hasTableInternal($name); } - + private function hasTableInternal($name) { global $config; return ($this->has_table_cache[$name] = $this->query("SELECT `TABLE_NAME` FROM `information_schema`.`tables` WHERE `TABLE_SCHEMA` = " . $this->quote($config['database_name']) . " AND `TABLE_NAME` = " . $this->quote($name) . " LIMIT 1;")->rowCount() > 0); } - + public function hasColumn($table, $column) { if(isset($this->has_column_cache[$table . '.' . $column])) { return $this->has_column_cache[$table . '.' . $column]; } - + return $this->hasColumnInternal($table, $column); } - + private function hasColumnInternal($table, $column) { return $this->hasTable($table) && ($this->has_column_cache[$table . '.' . $column] = count($this->query("SHOW COLUMNS FROM `" . $table . "` LIKE '" . $column . "'")->fetchAll()) > 0); } diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index e653b6b3..3fd4c94c 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -33,10 +33,10 @@ if(!$logged) require PAGES . 'account/' . ACTION . '.php'; return; } - + 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', @@ -66,7 +66,7 @@ $errors = array(); $account_status = 'Free Account'; else $account_status = 'Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . ''; - + if(empty($recovery_key)) $account_registered = 'No'; else @@ -91,7 +91,7 @@ $errors = array(); $welcome_message = 'Your account is banished FOREVER!'; else $welcome_message = 'Welcome to your account!'; - + $email_change = ''; $email_request = false; if($email_new_time > 1) @@ -104,12 +104,12 @@ $errors = array(); $email_request = true; } } - + $actions = array(); foreach($account_logged->getActionsLog(0, 1000) as $action) { $actions[] = array('action' => $action['action'], 'date' => $action['date'], 'ip' => $action['ip'] != 0 ? long2ip($action['ip']) : inet_ntop($action['ipv6'])); } - + $players = array(); $account_players = $account_logged->getPlayersList(); $account_players->orderBy('id'); diff --git a/system/pages/admin/items.php b/system/pages/admin/items.php index fa88e132..9c2c1b7b 100644 --- a/system/pages/admin/items.php +++ b/system/pages/admin/items.php @@ -21,7 +21,7 @@ if($reload) { success('Successfully loaded items.'); else error(Items::getError()); - + if(Weapons::loadFromXML(true)) success('Successfully loaded weapons.'); else diff --git a/system/pages/admin/menus.php b/system/pages/admin/menus.php index d176c215..6b9209d0 100644 --- a/system/pages/admin/menus.php +++ b/system/pages/admin/menus.php @@ -18,7 +18,7 @@ if(!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin()) if(isset($_REQUEST['template'])) { $template = $_REQUEST['template']; - + if(isset($_REQUEST['menu'])) { $post_menu = $_REQUEST['menu']; $post_menu_link = $_REQUEST['menu_link']; @@ -28,13 +28,13 @@ if(isset($_REQUEST['template'])) { echo 'Menu count is not equal menu links. Something went wrong when sending form.'; return; } - + $db->query('DELETE FROM `' . TABLE_PREFIX . 'menu` WHERE `template` = ' . $db->quote($template)); foreach($post_menu as $category => $menus) { foreach($menus as $i => $menu) { if(empty($menu)) // don't save empty menu item continue; - + try { $db->insert(TABLE_PREFIX . 'menu', array('template' => $template, 'name' => $menu, 'link' => $post_menu_link[$category][$i], 'blank' => $post_menu_blank[$category][$i] == 'on' ? 1 : 0, 'color' => str_replace('#', '', $post_menu_color[$category][$i]), 'category' => $category, 'ordering' => $i)); } @@ -43,10 +43,10 @@ if(isset($_REQUEST['template'])) { } } } - + success('Saved at ' . date('H:i')); } - + $file = TEMPLATES . $template . '/config.php'; if(file_exists($file)) { require_once $file; @@ -55,12 +55,12 @@ if(isset($_REQUEST['template'])) { echo 'Cannot find template config.php file.'; return; } - + if(!isset($config['menu_categories'])) { echo "No menu categories set in template config.php.
This template doesn't support dynamic menus."; return; } - + echo 'Hint: You can drag menu items.
Hint: Add links to external sites using: http:// prefix.
Not all templates support blank and colorful links.
@@ -88,19 +88,19 @@ if(isset($_REQUEST['template'])) { '; - + $i++; $last_id[$id] = $i; } } - + echo ''; } - + echo ''; echo ''; echo ''; - + echo $twig->render('admin.menus.js.html.twig', array( 'menus' => $menus, 'last_id' => $last_id @@ -114,7 +114,7 @@ else { unset($templates[$key]); } } - + echo $twig->render('admin.menus.form.html.twig', array( 'templates' => $templates )); diff --git a/system/pages/admin/plugins.php b/system/pages/admin/plugins.php index 7db83cc5..2422ab3e 100644 --- a/system/pages/admin/plugins.php +++ b/system/pages/admin/plugins.php @@ -16,7 +16,7 @@ echo $twig->render('admin.plugins.form.html.twig'); if(isset($_REQUEST['uninstall'])){ $uninstall = $_REQUEST['uninstall']; - + if(Plugins::uninstall($uninstall)) { success('Successfully uninstalled plugin ' . $uninstall); } @@ -72,7 +72,7 @@ else if(isset($_FILES["plugin"]["name"])) foreach(Plugins::getWarnings() as $warning) { warning($warning); } - + $info = Plugins::getPlugin(); success((isset($info['name']) ? '' . $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.'); } @@ -80,7 +80,7 @@ else if(isset($_FILES["plugin"]["name"])) $error = Plugins::getError(); error(!empty($error) ? $error : 'Unexpected error happened while installing plugin. Please try again later.'); } - + unlink($targetzip); // delete the Zipped file } else diff --git a/system/pages/characters.php b/system/pages/characters.php index ef4f6201..8e462f65 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -80,15 +80,15 @@ if($player->isLoaded() && !$player->isDeleted()) if($config['characters']['outfit']) $outfit = $config['outfit_images_url'] . '?id=' . $player->getLookType() . ($db->hasColumn('players', 'lookaddons') ? '&addons=' . $player->getLookAddons() : '') . '&head=' . $player->getLookHead() . '&body=' . $player->getLookBody() . '&legs=' . $player->getLookLegs() . '&feet=' . $player->getLookFeet(); - + $flag = ''; if($config['account_country']) $flag = getFlagImage($account->getCountry()); - + $player_sex = 'Unknown'; if(isset($config['genders'][$player->getSex()])) $player_sex = strtolower($config['genders'][$player->getSex()]); - + $marital_status = 'single'; $marriage_id = $player->getMarriage(); if($marriage_id > 0) { @@ -108,14 +108,14 @@ if($player->isLoaded() && !$player->isDeleted()) 'WHERE `player_id` = ' .$player->getId() . ' ' . 'GROUP BY `player_id`' . 'ORDER BY COUNT(`player_id`) DESC'); - + if($query->rowCount() > 0) { $query = $query->fetch(); $frags_count = $query['frags']; } } - + $town_field = 'town'; if($db->hasColumn('houses', 'town_id')) $town_field = 'town_id'; @@ -123,7 +123,7 @@ if($player->isLoaded() && !$player->isDeleted()) $town_field = 'townid'; else if(!$db->hasColumn('houses', 'town')) $town_field = false; - + if($db->hasColumn('houses', 'name')) { $house = $db->query('SELECT `id`, `paid`, `name`' . ($town_field != false ? ', `' . $town_field . '` as `town`' : '') . ' FROM `houses` WHERE `owner` = '.$player->getId())->fetch(); if(isset($house['id'])) @@ -133,7 +133,7 @@ if($player->isLoaded() && !$player->isDeleted()) $add = ' is paid until '.date("M d Y", $house['paid']); } } - + $rank_of_player = $player->getRank(); if($rank_of_player->isLoaded()) { $guild = $rank_of_player->getGuild(); @@ -141,14 +141,14 @@ if($player->isLoaded() && !$player->isDeleted()) $guild_name = $guild->getName(); } } - + $comment = $player->getComment(); - + if($config['characters']['skills']) { if($db->hasColumn('players', 'skill_fist')) {// tfs 1.0+ $skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch(); - + $skill_ids = array( POT::SKILL_FIST => 'skill_fist', POT::SKILL_CLUB => 'skill_club', @@ -158,7 +158,7 @@ if($player->isLoaded() && !$player->isDeleted()) POT::SKILL_SHIELD => 'skill_shielding', POT::SKILL_FISH => 'skill_fishing', ); - + $skills = array(); foreach($skill_ids as $skillid => $field_name) { $skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]); @@ -168,12 +168,12 @@ if($player->isLoaded() && !$player->isDeleted()) $skills_db = $db->query('SELECT `skillid`, `value` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' LIMIT 7'); $skills = $skills_db->fetchAll(); } - + foreach($skills as &$skill) { $skill['name'] = getSkillName($skill['skillid']); } } - + $quests_enabled = $config['characters']['quests'] && !empty($config['quests']); if($quests_enabled) { @@ -184,21 +184,21 @@ if($player->isLoaded() && !$player->isDeleted()) { if($i != 0) $sql_query_in .= ', '; - + $sql_query_in .= $quest_storage; $i++; } - + $storage_sql = $db->query('SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = '.$player->getId().' AND `key` IN (' . $sql_query_in . ')'); $player_storage = array(); foreach($storage_sql as $storage) $player_storage[$storage['key']] = $storage['value']; - + foreach($quests as &$storage) { $storage = isset($player_storage[$storage]) && $player_storage[$storage] > 0; } } - + if($config['characters']['equipment']) { global $db; @@ -206,14 +206,14 @@ if($player->isLoaded() && !$player->isDeleted()) $equipment = array(); foreach($eq_sql as $eq) $equipment[$eq['pid']] = $eq['itemtype']; - + $empty_slots = array("", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo"); for($i = 0; $i <= 10; $i++) { if(!isset($equipment[$i]) || $equipment[$i] == 0) $equipment[$i] = $empty_slots[$i]; } - + for($i = 1; $i < 11; $i++) { if(Validator::number($equipment[$i])) @@ -221,7 +221,7 @@ if($player->isLoaded() && !$player->isDeleted()) else $equipment[$i] = ' ' . $equipment[$i] . ''; } - + $skulls = array( 1 => 'yellow_skull', 2 => 'green_skull', @@ -243,7 +243,7 @@ if($player->isLoaded() && !$player->isDeleted()) $killers = $db->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll(); - + $description = ''; $i = 0; $count = count($killers); @@ -258,11 +258,11 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil $description .= " and"; else $description .= ","; - + $description .= " by "; if($killer['monster_name'] != "") $description .= $killer['monster_name']." summoned by "; - + if($killer['player_exists'] == 0) $description .= getPlayerLink($killer['player_name']); else @@ -276,11 +276,11 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil $description .= " and"; else $description .= ","; - + $description .= " by ".$killer['monster_name']; } } - + $deaths[] = array('time' => $death['date'], 'description' => $description . '.'); } } @@ -293,7 +293,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil `player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . ' FROM `player_deaths` WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;')->fetchAll(); - + if(count($deaths_db)) { $number_of_rows = 0; @@ -304,13 +304,13 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil if($death['unjustified']) { $description .= " (unjustified)"; } - + $mostdmg = ($death['mostdamage_by'] !== $death['killed_by']) ? true : false; if($mostdmg) { $mostdmg = ($death['mostdamage_is_player']) ? getPlayerLink($death['mostdamage_by']) : $death['mostdamage_by']; $description .= ' and by ' . $mostdmg; - + if ($death['mostdamage_unjustified']) { $description .= " (unjustified)"; } @@ -318,12 +318,12 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil else { $description .= " (soloed)"; } - + $deaths[] = array('time' => $death['time'], 'description' => $description); } } } - + $frags = array(); $frag_add_content = ''; if($config['characters']['frags']) @@ -342,12 +342,12 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil } } } - + // signature if($config['signature_enabled']) { $signature_url = BASE_URL . ($config['friendly_urls'] ? '' : '?') . urlencode($player->getName()) . '.png'; } - + $hidden = $player->isHidden(); if(!$hidden) { // check if account has been banned @@ -364,7 +364,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil foreach($banned as $ban) { $bannedUntil = $ban['expires']; } - + $account_players = array(); $query = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $account->getId() . ' ORDER BY `name`')->fetchAll(); foreach($query as $p) { @@ -376,7 +376,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil } } } - + echo $twig->render('characters.html.twig', array( 'outfit' => isset($outfit) ? $outfit : null, 'player' => $player, diff --git a/system/pages/createaccount.php b/system/pages/createaccount.php index ccdba296..4f5d320e 100644 --- a/system/pages/createaccount.php +++ b/system/pages/createaccount.php @@ -132,7 +132,7 @@ if($save) $new_account->setEMail($email); $new_account->unblock(); $new_account->save(); - + if($config_salt_enabled) $new_account->setCustomField('salt', $salt); @@ -156,7 +156,7 @@ if($save) if($config['account_premium_points']) { $new_account->setCustomField('premium_points', $config['account_premium_points']); } - + $tmp_account = (USE_ACCOUNT_NAME ? $account_name : $account_id); if($config['mail_enabled'] && $config['account_mail_verify']) { @@ -187,7 +187,7 @@ if($save) echo $twig->render('account.created.html.twig', array( 'account' => $tmp_account )); - + if($config['mail_enabled'] && $config['account_welcome_mail']) { $mailBody = $twig->render('account.welcome_mail.html.twig', array( @@ -229,7 +229,7 @@ if($config['account_country']) { $countries = array(); foreach (array('pl', 'se', 'br', 'us', 'gb') as $c) $countries[$c] = $config['countries'][$c]; - + $countries['--'] = '----------'; foreach ($config['countries'] as $code => $c) $countries[$code] = $c; diff --git a/system/pages/forum.php b/system/pages/forum.php index 8f0771de..e1e6e62e 100644 --- a/system/pages/forum.php +++ b/system/pages/forum.php @@ -32,26 +32,26 @@ $canEdit = Forum::isModerator(); if($canEdit) { $groups = new OTS_Groups_List(); - + if(!empty($action)) { if($action == 'delete_board' || $action == 'edit_board' || $action == 'hide_board' || $action == 'moveup_board' || $action == 'movedown_board') $id = $_REQUEST['id']; - + if(isset($_REQUEST['access'])) $access = $_REQUEST['access']; - + if(isset($_REQUEST['guild'])) $guild = $_REQUEST['guild']; - + if(isset($_REQUEST['name'])) $name = $_REQUEST['name']; - + if(isset($_REQUEST['description'])) $description = stripslashes($_REQUEST['description']); - + $errors = array(); - + if($action == 'add_board') { if(Forum::add_board($name, $description, $access, $guild, $errors)) $action = $name = $description = ''; @@ -87,13 +87,13 @@ if($canEdit) Forum::move_board($id, 1, $errors); $action = ''; } - + if(!empty($errors)) { echo $twig->render('error_box.html.twig', array('errors' => $errors)); $action = ''; } } - + if(empty($action) || $action == 'edit_board') { $guilds = $db->query('SELECT `id`, `name` FROM `guilds`')->fetchAll(); echo $twig->render('forum.add_board.html.twig', array( @@ -107,7 +107,7 @@ if($canEdit) 'groups' => $groups, 'guilds' => $guilds )); - + if($action == 'edit_board') $action = ''; } @@ -124,7 +124,7 @@ foreach(getForumBoards() as $section) 'guild' => $section['guild'], 'access' => $section['access'] ); - + if($canEdit) { $sections[$section['id']]['hidden'] = $section['hidden']; } @@ -137,7 +137,7 @@ $number_of_rows = 0; if(empty($action)) { $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']); @@ -162,13 +162,13 @@ if(empty($action)) ); } } - + echo $twig->render('forum.boards.html.twig', array( 'boards' => $boards, 'canEdit' => $canEdit, 'last' => count($sections) )); - + return; } diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 77538c51..42b0556c 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -25,13 +25,13 @@ if($config['highscores_vocation_box'] && isset($vocation)) foreach($config['vocations'] as $id => $name) { if(strtolower($name) == $vocation) { $add_vocs = array($id); - + $i = $id + $config['vocations_amount']; while(isset($config['vocations'][$i])) { $add_vocs[] = $i; $i += $config['vocations_amount']; } - + $add_sql = 'AND `vocation` IN (' . implode(', ', $add_vocs) . ')'; break; } @@ -226,7 +226,7 @@ echo ' ' . ($offset + $i) . '.'; if($config['highscores_outfit']) echo ''; - + echo ' @@ -319,7 +319,7 @@ echo ' 'fist' => 'Fist', 'fishing' => 'Fishing', ); - + if($config['highscores_frags']) { $types['frags'] = 'Frags'; } diff --git a/system/pages/news.php b/system/pages/news.php index c746adc8..4ce20fb1 100644 --- a/system/pages/news.php +++ b/system/pages/news.php @@ -43,7 +43,7 @@ if(isset($_GET['archive'])) $query = $query->fetch(); $author = $query['name']; } - + $content_ = $news['body']; $firstLetter = ''; if($content_[0] != '<') @@ -54,7 +54,7 @@ if(isset($_GET['archive'])) $content_ = $firstLetter . substr($content_, 1); } } - + echo $twig->render('news.html.twig', array( 'title' => stripslashes($news['title']), 'content' => $content_, @@ -72,7 +72,7 @@ if(isset($_GET['archive'])) return; } ?> - + $news['date'] ); } - + echo $twig->render('news.archive.html.twig', array( 'newses' => $newses )); - + return; } @@ -125,7 +125,7 @@ if($canEdit) if(isset($forum_section) && $forum_section != '-1') { $forum_add = Forum::add_thread($p_title, $body, $forum_section, $player_id, $account_logged->getId(), $errors); } - + if(News::add($p_title, $body, $type, $category, $player_id, isset($forum_add) && $forum_add != 0 ? $forum_add : 0, $article_text, $article_image, $errors)) { $p_title = $body = $comments = $article_text = $article_image = ''; $type = $category = $player_id = 0; @@ -153,7 +153,7 @@ if($canEdit) if(isset($forum_section) && Validator::number($forum_section)) { $db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $player_id.", `post_text` = ".$db->quote($body).", `post_topic` = ".$db->quote($p_title).", `edit_date` = " . time() . " WHERE `id` = " . $db->quote($forum_section)); } - + $action = $p_title = $body = $comments = $article_text = $article_image = ''; $type = $category = $player_id = 0; } @@ -193,7 +193,7 @@ if(!$news_cached) 'SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER . ($canEdit ? '' : ' AND `hidden` != 1') . ' ORDER BY `date` DESC LIMIT ' . $config['news_ticker_limit']); - + $tickers_content = ''; if($tickers_db->rowCount() > 0) { @@ -202,26 +202,26 @@ if(!$news_cached) $ticker['icon'] = $categories[$ticker['category']]['icon_id']; $ticker['body_short'] = short_text(strip_tags($ticker['body']), 100); } - + $tickers_content = $twig->render('news.tickers.html.twig', array( 'tickers' => $tickers, 'canEdit' => $canEdit )); } - + if($cache->enabled() && !$canEdit) $cache->set('news_' . $template_name . '_' . TICKER, $tickers_content, 120); - + $featured_article_db = $db->query( 'SELECT `id`, `title`, `article_text`, `article_image`, `hidden` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ($canEdit ? '' : ' AND `hidden` != 1') . ' ORDER BY `date` DESC LIMIT 1'); - + $article = ''; if($featured_article_db->rowCount() > 0) { $article = $featured_article_db->fetch(); - + $featured_article = ''; if($twig->getLoader()->exists('news.featured_article.html.twig')) { $featured_article = $twig->render('news.featured_article.html.twig', array( @@ -236,7 +236,7 @@ if(!$news_cached) 'canEdit' => $canEdit )); } - + if($cache->enabled() && !$canEdit) $cache->set('news_' . $template_name . '_' . ARTICLE, $featured_article, 120); } @@ -255,7 +255,7 @@ if(!$news_cached) $player = new OTS_Player(); $player->load($player_id); } - + $account_players = $account_logged->getPlayersList(); $account_players->orderBy('group_id', POT::ORDER_DESC); @@ -312,7 +312,7 @@ if(!$news_cached) ' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . ' '; } - + $content_ = $news['body']; $firstLetter = ''; if($content_[0] != '<') @@ -323,7 +323,7 @@ if(!$news_cached) $content_ = $firstLetter . substr($content_, 1); } } - + echo $twig->render('news.html.twig', array( 'id' => $news['id'], 'title' => stripslashes($news['title']), @@ -362,22 +362,22 @@ class News $errors[] = 'News title cannot be longer than ' . TITLE_LIMIT . ' characters.'; return false; } - + if(strlen($body) > BODY_LIMIT) { $errors[] = 'News content cannot be longer than ' . BODY_LIMIT . ' characters.'; return false; } - + if(strlen($article_text) > ARTICLE_TEXT_LIMIT) { $errors[] = 'Article text cannot be longer than ' . ARTICLE_TEXT_LIMIT . ' characters.'; return false; } - + if(strlen($article_image) > ARTICLE_IMAGE_LIMIT) { $errors[] = 'Article image cannot be longer than ' . ARTICLE_IMAGE_LIMIT . ' characters.'; return false; } - + return true; } diff --git a/system/pages/online.php b/system/pages/online.php index 286fe046..d76a0b2c 100644 --- a/system/pages/online.php +++ b/system/pages/online.php @@ -79,7 +79,7 @@ foreach($playersOnline as $player) if((int)$player['promotion'] > 0) $player['vocation'] += ($player['promotion'] * $config['vocations_amount']); } - + $players_data[] = array( 'name' => getPlayerLink($player['name']), 'player' => $player, @@ -88,7 +88,7 @@ foreach($playersOnline as $player) 'country_image' => $config['account_country'] ? getFlagImage($player['country']) : null, 'outfit' => $config['online_outfit'] ? $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] : null ); - + if($config['online_vocations']) $vocs[($player['vocation'] > $config['vocations_amount'] ? $player['vocation'] - $config['vocations_amount'] : $player['vocation'])]++; } @@ -111,7 +111,7 @@ if($players > 0) } else $query = NULL; - + if(isset($query) && $query->rowCount() > 0) { $result = $query->fetch(); diff --git a/tools/news_preview.php b/tools/news_preview.php index 4de1f6a9..63842416 100644 --- a/tools/news_preview.php +++ b/tools/news_preview.php @@ -32,7 +32,7 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $ $player = new OTS_Player(); $player->load($_GET['player_id']); - + $author = ''; if($player->isLoaded()) { $author = $player->getName(); @@ -42,7 +42,7 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $ if(!isset($_GET['article_text'], $_GET['article_image'])) { error_('Error: please fill all inputs.'); } - + $featured_article = ''; if($twig->getLoader()->exists('news.featured_article.html.twig')) { $featured_article = $twig->render('news.featured_article.html.twig', array( @@ -69,13 +69,13 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $ $ticker['icon'] = $categories[$ticker['category']]['icon_id']; $ticker['body_short'] = short_text(strip_tags($ticker['body']), 100); } - + $tickers_content = $twig->render('news.tickers.html.twig', array( 'tickers' => $tickers, 'canEdit' => false, 'i' => -1 )); - + success_($tickers_content); } else { diff --git a/tools/signature/index.php b/tools/signature/index.php index 334c5fd7..e3e33303 100644 --- a/tools/signature/index.php +++ b/tools/signature/index.php @@ -32,25 +32,25 @@ if(!isset($_REQUEST['name'])) die('Please enter name as get or post parameter.'); - + $name = stripslashes(ucwords(strtolower(trim($_REQUEST['name'])))); $player = new OTS_Player(); $player->find($name); - + if(!$player->isLoaded()) { header('Content-type: image/png'); readfile(SIGNATURES_IMAGES.'nocharacter.png'); exit; } - + if(!function_exists( 'imagecreatefrompng')) { header('Content-type: image/png'); readfile(SIGNATURES_IMAGES.'nogd.png'); exit; } - + $cached = SIGNATURES_CACHE.$player->getId() . '.png'; if(file_exists($cached) && (time() < (filemtime($cached) + (60 * $config['signature_cache_time'])))) { diff --git a/tools/signature/mango.php b/tools/signature/mango.php index d298d643..acdf37b3 100644 --- a/tools/signature/mango.php +++ b/tools/signature/mango.php @@ -47,7 +47,7 @@ $vocation = 'Unknown'; if(isset($config['vocations'][$player->getVocation()])) $vocation = $config['vocations'][$player->getVocation()]; - + $MadGD->addText( 'Profession:', $MadGD->textBold )->setPosition( 10, $i * $eachRow ); $MadGD->addText( $vocation )->setPosition( ); $i++; /** LEVEL **/ @@ -69,7 +69,7 @@ $town = 'town_id'; else if($db->hasColumn('houses', 'townid')) $town = 'townid'; - + $house = $db->query( 'SELECT `houses`.`name`, `houses`.`' . $town . '` as town FROM `houses` WHERE `houses`.`owner` = '.$player->getId().';' )->fetchAll(); if ( count( $house ) != 0 ) { diff --git a/tools/validate.php b/tools/validate.php index d1bbcee7..d43f76ef 100644 --- a/tools/validate.php +++ b/tools/validate.php @@ -66,17 +66,17 @@ else if(isset($_GET['name'])) else if(isset($_GET['password']) && isset($_GET['password2'])) { $password = $_GET['password']; $password2 = $_GET['password2']; - + if(!isset($password[0])) { error_('Please enter the password for your new account.'); } - + if(!Validator::password($password)) error_(Validator::getLastError()); - + if($password != $password2) error_('Passwords are not the same.'); - + success_(1); } else