mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
* remove whitespaces
This commit is contained in:
parent
42d23e9b37
commit
bf361238cb
26
index.php
26
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 . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
|
||||
}
|
||||
|
||||
|
||||
if($config['database_log']) {
|
||||
echo PHP_EOL . '<!-- Database Queries Done by MyAAC:' . PHP_EOL . $db->getLog() . '-->';
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||
$allow = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!$allow)
|
||||
{
|
||||
$content = warning('In file <b>install/ip.txt</b> must be your IP!<br/>
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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$', '<b>' . BASE . 'config.local.php</b>', $locale['step_database_error_file']);
|
||||
warning($locale['step_database_error_file'] . '<br/>
|
||||
<textarea cols="70" rows="10">' . $content . '</textarea>');
|
||||
|
@ -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']
|
||||
|
@ -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...');
|
||||
|
@ -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']);
|
||||
|
@ -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.';
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ function message($message, $type, $return)
|
||||
{
|
||||
if($return)
|
||||
return '<div class="' . $type . '">' . $message . '</div>';
|
||||
|
||||
|
||||
echo '<div class="' . $type . '">' . $message . '</div>';
|
||||
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 '<img src="images/flags/' . $country . '.gif" title="' . $config['countries'][$country]. '"/>';
|
||||
}
|
||||
|
||||
@ -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.</div>
|
||||
</noscript>
|
||||
';
|
||||
|
||||
|
||||
if($config['recaptcha_enabled'])
|
||||
$ret .= "<script src='https://www.google.com/recaptcha/api.js'></script>";
|
||||
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';
|
||||
?>
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -14,18 +14,18 @@
|
||||
|
||||
/**
|
||||
* Base class for all database drivers.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* It defines additional rotines required by database driver for POT using default SQL standard-compliant method.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
|
@ -14,11 +14,11 @@
|
||||
|
||||
/**
|
||||
* MySQL connection interface.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* At all everything that you really need to read from this class documentation is list of parameters for driver's constructor.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Connects to MySQL database on given arguments.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* List of parameters for this drivers:
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <ul>
|
||||
* <li><var>host</var> - database server.</li>
|
||||
* <li><var>port</var> - port (optional, also it is possible to use host:port in <var>host</var> parameter).</li>
|
||||
@ -44,7 +44,7 @@ class OTS_DB_MySQL extends OTS_Base_DB
|
||||
* <li><var>user</var> - user login.</li>
|
||||
* <li><var>password</var> - user password.</li>
|
||||
* </ul>
|
||||
*
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
@ -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 = '<b><font color="red">Free Account</font></b>';
|
||||
else
|
||||
$account_status = '<b><font color="green">Premium Account, ' . ($freePremium ? 'Unlimited' : $account_logged->getPremDays() . ' days left') . '</font></b>';
|
||||
|
||||
|
||||
if(empty($recovery_key))
|
||||
$account_registered = '<b><font color="red">No</font></b>';
|
||||
else
|
||||
@ -91,7 +91,7 @@ $errors = array();
|
||||
$welcome_message = '<font color="red">Your account is banished FOREVER!</font>';
|
||||
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');
|
||||
|
@ -21,7 +21,7 @@ if($reload) {
|
||||
success('Successfully loaded items.');
|
||||
else
|
||||
error(Items::getError());
|
||||
|
||||
|
||||
if(Weapons::loadFromXML(true))
|
||||
success('Successfully loaded weapons.');
|
||||
else
|
||||
|
@ -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.<br/>This template doesn't support dynamic menus.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
echo 'Hint: You can drag menu items.<br/>
|
||||
Hint: Add links to external sites using: <b>http://</b> prefix.<br/>
|
||||
Not all templates support blank and colorful links.<br/>
|
||||
@ -88,19 +88,19 @@ if(isset($_REQUEST['template'])) {
|
||||
<input class="color-picker" type="text" name="menu_color[' . $id . '][]" value="#' . $menu['color'] . '" />
|
||||
|
||||
<a class="remove-button" id="remove-button-' . $id . '-' . $i . '"><img src="' . BASE_URL . 'images/del.png"/></a></li>';
|
||||
|
||||
|
||||
$i++;
|
||||
$last_id[$id] = $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
|
||||
echo '<input type="submit" class="button" value="Update">';
|
||||
echo '<input type="button" class="button" value="Cancel" onclick="window.location = \'' . ADMIN_URL . '?p=menus&template=' . $template . '\';">';
|
||||
echo '</form>';
|
||||
|
||||
|
||||
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
|
||||
));
|
||||
|
@ -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']) ? '<strong>' . $info['name'] . '</strong> 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
|
||||
|
@ -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] = '<img src="images/items/' . $equipment[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $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 .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
|
||||
}
|
||||
|
||||
|
||||
$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 .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
|
||||
}
|
||||
@ -318,12 +318,12 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
|
||||
else {
|
||||
$description .= " <b>(soloed)</b>";
|
||||
}
|
||||
|
||||
|
||||
$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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 '
|
||||
<td>' . ($offset + $i) . '.</td>';
|
||||
if($config['highscores_outfit'])
|
||||
echo '<td><img style="position:absolute;margin-top:' . (in_array($player['looktype'], array(75, 266, 302)) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $config['outfit_images_url'] . '?id=' . $player['looktype'] . ($outfit_addons ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'] . '" alt="" /></td>';
|
||||
|
||||
|
||||
echo '
|
||||
<td>
|
||||
<a href="' . getPlayerLink($player['name'], false) . '">
|
||||
@ -319,7 +319,7 @@ echo '
|
||||
'fist' => 'Fist',
|
||||
'fishing' => 'Fishing',
|
||||
);
|
||||
|
||||
|
||||
if($config['highscores_frags']) {
|
||||
$types['frags'] = 'Frags';
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$newses = array();
|
||||
@ -86,11 +86,11 @@ if(isset($_GET['archive']))
|
||||
'date' => $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') . '
|
||||
</a>';
|
||||
}
|
||||
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
@ -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']))))
|
||||
{
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user