diff --git a/common.php b/common.php index a19fcbd7..eed3cb89 100644 --- a/common.php +++ b/common.php @@ -28,7 +28,7 @@ session_start(); define('MYAAC', true); define('MYAAC_VERSION', '0.2.4'); -define('DATABASE_VERSION', 4); +define('DATABASE_VERSION', 5); define('TABLE_PREFIX', 'myaac_'); define('START_TIME', microtime(true)); define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX')); @@ -59,6 +59,7 @@ define('LIBS', SYSTEM . 'libs/'); define('LOGS', SYSTEM . 'logs/'); define('PLUGINS', BASE . 'plugins/'); define('TEMPLATES', BASE . 'templates/'); +define('TOOLS', BASE . 'tools/'); // otserv versions define('OTSERV', 1); diff --git a/index.php b/index.php index 74a5cb7e..a3811559 100644 --- a/index.php +++ b/index.php @@ -61,7 +61,10 @@ if(fetchDatabaseConfig('database_version', $tmp)) { // we got version $tmp = (int)$tmp; if($tmp < DATABASE_VERSION) { // import if older for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) { - require(SYSTEM . 'migrations/' . $i . '.php'); + $file = SYSTEM . 'migrations/' . $i . '.php'; + if(file_exists($file)) { + require($file); + } } updateDatabaseConfig('database_version', DATABASE_VERSION); diff --git a/install/includes/functions.php b/install/includes/functions.php index 1e289630..75cd7cf4 100644 --- a/install/includes/functions.php +++ b/install/includes/functions.php @@ -28,17 +28,17 @@ function ini_get_bool($a) switch (strtolower($b)) { - case 'on': - case 'yes': - case 'true': - return 'assert.active' !== $a; + case 'on': + case 'yes': + case 'true': + return 'assert.active' !== $a; - case 'stdout': - case 'stderr': - return 'display_errors' === $a; + case 'stdout': + case 'stderr': + return 'display_errors' === $a; - default: - return (bool) (int) $b; + default: + return (bool) (int) $b; } } diff --git a/install/includes/schema.sql b/install/includes/schema.sql index b79805dd..f7a0e38f 100644 --- a/install/includes/schema.sql +++ b/install/includes/schema.sql @@ -176,15 +176,13 @@ INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 1); INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 2); INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 3); INSERT INTO `myaac_news_categories` (`id`, `icon_id`) VALUES (NULL, 4); -INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', 'slawkens', 'http://my-aac.org', '0'); -INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'http://my-aac.org', 'slawkens', '', '0'); CREATE TABLE `myaac_notepad` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `account_id` INT(11) NOT NULL, /*`name` VARCHAR(30) NOT NULL,*/ - `content` TEXT NOT NULL DEFAULT '', + `content` TEXT NOT NULL, /*`public` TINYINT(1) NOT NULL DEFAULT 0*/ PRIMARY KEY (`id`) ) ENGINE = MyISAM; @@ -233,7 +231,6 @@ CREATE TABLE `myaac_spells` `conjure_count` TINYINT(3) NOT NULL DEFAULT 0, `premium` TINYINT(1) NOT NULL DEFAULT 0, `vocations` VARCHAR(32) NOT NULL, - `cities` VARCHAR(32) NOT NULL, `hidden` TINYINT(1) NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE (`spell`) @@ -245,4 +242,4 @@ CREATE TABLE `myaac_visitors` `lastvisit` INT(11) NOT NULL DEFAULT 0, `page` VARCHAR(100) NOT NULL, UNIQUE (`ip`) -) ENGINE = MyISAM; \ No newline at end of file +) ENGINE = MyISAM; diff --git a/install/steps/database.php b/install/steps/database.php index c6f98d82..034a8dce 100644 --- a/install/steps/database.php +++ b/install/steps/database.php @@ -169,7 +169,7 @@ if(!$error) { } if(!fieldExist('description', 'guilds')) { - if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL DEFAULT '';")) + if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL;")) success($locale['step_database_adding_field'] . ' guilds.description...'); } @@ -210,7 +210,7 @@ if(!$error) { } if(!fieldExist('comment', 'players')) { - if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL DEFAULT '';")) + if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL;")) success($locale['step_database_adding_field'] . ' players.comment...'); } } @@ -218,10 +218,6 @@ if(!$error) { if(!$error && (!isset($_SESSION['saved']))) { $content .= '$config[\'installed\'] = true;'; $content .= PHP_EOL; - // if(strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) { - // $content .= '$config[\'friendly_urls\'] = true;'; - // $content .= PHP_EOL; - // } $content .= '$config[\'mail_enabled\'] = true;'; $content .= PHP_EOL; diff --git a/install/steps/finish.php b/install/steps/finish.php index 86e5031d..4d20ab65 100644 --- a/install/steps/finish.php +++ b/install/steps/finish.php @@ -2,7 +2,7 @@ defined('MYAAC') or die('Direct access not allowed!'); if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['saved'])) { - echo '

' . $locale['already_installed'] . '

'; + warning($locale['already_installed']); } else { require(SYSTEM . 'init.php'); @@ -50,12 +50,12 @@ else { else $account_db->load($account_id); - $player_db = $ots->createObject('Player'); + $player_db = new OTS_Player(); $player_db->find('Admin'); $groups = new OTS_Groups_List(); if(!$player_db->isLoaded()) { - $player = $ots->createObject('Player'); + $player = new OTS_Player(); $player->setName('Admin'); $player->setGroupId($groups->getHighestId()); @@ -84,7 +84,7 @@ else { $_SESSION['account'] = $account_db->getId(); } else { - $new_account = $ots->createObject('Account'); + $new_account = new OTS_Account(); $new_account->create($account); $new_account->setPassword(encrypt($password)); @@ -114,36 +114,75 @@ else { $_SESSION['account'] = $new_account->getId(); } - if($player_db->isLoaded()) - $player_db->save(); - else - $player->save(); - success($locale['step_database_created_account']); $_SESSION['password'] = encrypt($password); $_SESSION['remember_me'] = true; + if($player_db->isLoaded()) { + $player_db->save(); + } + else { + $player->save(); + } + + $player_id = 0; + $query = $db->query("SELECT `id` FROM `players` WHERE `name` = " . $db->quote('Admin') . ";"); + if($query->rowCount() == 1) { + $query = $query->fetch(); + $player_id = $query['id']; + } + + if(query("INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', " . $player_id . ", 'http://my-aac.org', '0'); +INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'http://my-aac.org', " . $player_id . ", '', '0');")) { + success($locale['step_database_created_news']); + } + $deleted = 'deleted'; if(fieldExist('deletion', 'players')) $deleted = 'deletion'; - $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample') . ' OR `name` = ' . $db->quote('Sorcerer Sample') . ' OR `name` = ' . $db->quote('Druid Sample') . ' OR `name` = ' . $db->quote('Paladin Sample') . ' OR `name` = ' . $db->quote('Knight Sample')); + $insert_into_players = "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 "; + $success = true; + + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Rook Sample')); 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, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 1255179614, 0, 1, UNIX_TIMESTAMP(), 1, ''), - (null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 1, UNIX_TIMESTAMP(), 1, ''), - (null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 1, UNIX_TIMESTAMP(), 1, ''), - (null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 1, UNIX_TIMESTAMP(), 1, ''), - (null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 1, UNIX_TIMESTAMP(), 1, '');")) - success($locale['step_database_imported_players']); + if(!query($insert_into_players . "(null, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 1255179614, 0, 1, UNIX_TIMESTAMP(), 1, '');")) + $success = false; } - + + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Sorcerer Sample')); + if($query->rowCount() == 0) { + if(!query($insert_into_players . "(null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 1255179612, 0, 1, UNIX_TIMESTAMP(), 1, '');")) + $success = false; + } + + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Druid Sample')); + if($query->rowCount() == 0) { + if(!query($insert_into_players . "(null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 1255179658, 0, 1, UNIX_TIMESTAMP(), 1, '');")) + $success = false; + } + + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Paladin Sample')); + if($query->rowCount() == 0) { + if(!query($insert_into_players . "(null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 1255179858, 0, 1, UNIX_TIMESTAMP(), 1, '');")) + $success = false; + } + + $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote('Knight Sample')); + if($query->rowCount() == 0) { + if(!query($insert_into_players . "(null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 1255179654, 0, 1, UNIX_TIMESTAMP(), 1, '');")) + $success = false; + } + + if($success) { + success($locale['step_database_imported_players']); + } + $locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(ADMIN_URL, $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']); $locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(BASE_URL, $locale['step_finish_homepage'], true), $locale['step_finish_desc']); $locale['step_finish_desc'] = str_replace('$LINK$', generateLink('http://my-aac.org', 'http://my-aac.org', true), $locale['step_finish_desc']); - ?> -

- db->query('UPDATE `accounts` SET ' . (fieldExist('name', 'accounts') ? '`name` = ' . $this->db->quote($this->data['name']) . ',' : '') . '`password` = ' . $this->db->quote($this->data['password']) . ', `email` = ' . $this->db->quote($this->data['email']) . ', `blocked` = ' . (int) $this->data['blocked'] . ', `rlname` = ' . $this->db->quote($this->data['rlname']) . ', `location` = ' . $this->db->quote($this->data['location']) . ', `web_flags` = ' . (int) $this->data['web_flags'] . ', ' . (fieldExist('premdays', 'accounts') ? '`premdays` = ' . (int) $this->data['premdays'] . ',' : '') . '`' . $lastday . '` = ' . (int) $this->data['lastday'] . ' WHERE `id` = ' . $this->data['id']); } @@ -316,7 +316,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable return ($this->data['web_flags'] & $flag) == $flag; } - + public function isAdmin() { return $this->hasFlag(FLAG_ADMIN) || $this->isSuperAdmin(); @@ -766,7 +766,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable { throw new E_OTS_NotLoaded(); } - + if(tableExist('account_bans')) { $ban = $this->db->query('SELECT `expires_at` FROM `account_bans` WHERE `account_id` = ' . $this->data['id'] . ' AND (`expires_at` > ' . time() .' OR `expires_at` = -1) ORDER BY `expires_at` DESC')->fetch(); $this->data['banned'] = isset($ban['expires_at']); @@ -859,11 +859,11 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable if(isset($query['group_id'])) return $query['group_id']; } - + $db->query('SELECT `group_id` FROM `players` WHERE `account_id` = ' . $this->getId() . ' ORDER BY `group_id` DESC LIMIT 1')->fetch(); if(isset($query['group_id'])) return $query['group_id']; - + return 0; } @@ -903,7 +903,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $ip = $_SERVER['HTTP_CLIENT_IP']; else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; - + if(strpos($ip, ":") === false) { $ipv6 = '0'; } @@ -912,7 +912,7 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $ip = ''; } - return $this->db->query('INSERT INTO `' . TABLE_PREFIX . 'account_actions` (`account_id`, `ip`, `ipv6`, `date`, `action`) VALUES (' . $this->db->quote($this->getId()).', (' . $this->db->quote(ip2long($ip)) . '), (' . ($ipv6 == '0' ? $this->db->quote('') : $this->db->quote(inet_pton($ipv6))) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); + return $this->db->query('INSERT INTO `' . TABLE_PREFIX . 'account_actions` (`account_id`, `ip`, `ipv6`, `date`, `action`) VALUES (' . $this->db->quote($this->getId()).', ' . ($ip == '' ? '0' : $this->db->quote(ip2long($ip))) . ', (' . ($ipv6 == '0' ? $this->db->quote('') : $this->db->quote(inet_pton($ipv6))) . '), UNIX_TIMESTAMP(NOW()), ' . $this->db->quote($action).')'); } public function getActionsLog($limit1, $limit2) diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php index 7803a552..b5985770 100644 --- a/system/libs/pot/OTS_Player.php +++ b/system/libs/pot/OTS_Player.php @@ -447,7 +447,7 @@ class OTS_Player extends OTS_Row_DAO } // INSERT query on database - $this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . $lookaddons . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', `lastlogin`, `lastlogout`, ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', ' . $this->db->fieldName('town_id') . $loss . $loss_items . ', `balance`' . $blessings . $stamina . $direction . ', ' . $this->db->fieldName('created') . $promotion . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . $lookaddons_data . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . $loss_items_data . ', ' . $this->data['balance'] . $blessings_data . $stamina_data . $direction_data . ', ' . time() . $promotion_data . ')'); + $this->db->query('INSERT INTO `players` (`name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . $lookaddons . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', `town_id`' . $loss . $loss_items . ', `balance`' . $blessings . $stamina . $direction . ', `created`' . $promotion . ', `comment`) VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . $lookaddons_data . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . $loss_items_data . ', ' . $this->data['balance'] . $blessings_data . $stamina_data . $direction_data . ', ' . time() . $promotion_data . ', "")'); // ID of new group $this->data['id'] = $this->db->lastInsertId(); } @@ -2320,8 +2320,8 @@ class OTS_Player extends OTS_Row_DAO { $value = $this->db->quote($value); } - - $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName($field) . ' = ' . $value . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); + + $this->db->query('UPDATE `players` SET `' . $field . '` = ' . $value . ' WHERE `id` = ' . $this->data['id']); } /** diff --git a/system/libs/twig/Autoloader.php b/system/libs/twig/Autoloader.php new file mode 100644 index 00000000..be622337 --- /dev/null +++ b/system/libs/twig/Autoloader.php @@ -0,0 +1,39 @@ + + */ +class Twig_Autoloader +{ + /** + * Registers Twig_Autoloader as an SPL autoloader. + */ + public static function register() + { + ini_set('unserialize_callback_func', 'spl_autoload_call'); + spl_autoload_register(array(new self, 'autoload')); + } + /** + * Handles autoloading of classes. + * + * @param string $class A class name. + */ + public static function autoload($class) + { + if (0 !== strpos($class, 'Twig')) { + return; + } + if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { + require $file; + } + } +} \ No newline at end of file diff --git a/system/libs/twig/Cache/CacheInterface.php b/system/libs/twig/Cache/CacheInterface.php new file mode 100755 index 00000000..2e35e3ba --- /dev/null +++ b/system/libs/twig/Cache/CacheInterface.php @@ -0,0 +1,11 @@ +query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP COLUMN cities;"); +?> \ No newline at end of file diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index ac363ab4..4eccaade 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -710,16 +710,11 @@ Please enter your account name and your password.
Edit Character Information
Name:'.$player_name.'
Hide Account:'; - if($player->getCustomField("hidden") == 1) { - echo ''; - } - else - { - echo ''; - } - - echo ''; + echo 'Here you can see and edit the information about your character.
If you do not want to specify a certain field, just leave it blank.

Edit Character Information
'; } else { - echo ''; + echo ''; } if($order == 'summonable' && !isset($_REQUEST['desc'])) { echo ''; @@ -329,4 +330,4 @@ else } //back button echo '

'; -?> \ No newline at end of file +?> diff --git a/system/pages/spells.php b/system/pages/spells.php index 3a27267e..b58711a6 100644 --- a/system/pages/spells.php +++ b/system/pages/spells.php @@ -69,8 +69,8 @@ if(isset($_POST['reload_spells']) && $canEdit) $type = 2; $count = $spell->getConjureCount(); try { - $db->query("INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES ('".$spell_txt."', '".$name."', '".$spell_txt."', '".$type."', '".$mana."', '".$lvl."', '".$mlvl."', '".$soul."', '".$pacc."', '".$vocations_to_db."', '".$count."', '".$hide_spell."')"); - success("Added: ".$name."
"); + $db->query('INSERT INTO myaac_spells (spell, name, words, type, mana, level, maglevel, soul, premium, vocations, conjure_count, hidden) VALUES (' . $db->quote($spell_txt) . ', ' . $db-quote($name) . ', ' . $db->quote($spell_txt) , ', ' . $db->quote($type) . ', ' . $db->quote($mana) . ', ' . $db->quote($lvl) . ', ' . $db->quote($mlvl) . ', ' . $db->quote($soul) . ', ' . $db>quote($pacc) . ', ' . $db->quote($vocations_to_db) . ', ' . $db->quote($count) . ', ' . $db->quote($hide_spell) . ')'); + success("Added: " . $name . "
"); } catch(PDOException $error) { warning('Error while adding spell (' . $name . '): ' . $error->getMessage()); diff --git a/system/template.php b/system/template.php index 4a6796d4..d3bdc56d 100644 --- a/system/template.php +++ b/system/template.php @@ -77,34 +77,13 @@ $template['link_account_create'] = internalLayoutLink(($config['friendly_urls'] $template['link_account_lost'] = internalLayoutLink(($config['friendly_urls'] ? 'account/lost' : 'lostaccount')); $template['link_account_logout'] = internalLayoutLink(($config['friendly_urls'] ? 'account' : 'accountmanagement'), 'logout'); -$template['link_news'] = internalLayoutLink('news'); $template['link_news_archive'] = internalLayoutLink('news' . ($config['friendly_urls'] ? '/' : '') . 'archive'); -$template['link_changelog'] = internalLayoutLink('changelog'); -$template['link_rules'] = internalLayoutLink('rules'); -$template['link_downloads'] = internalLayoutLink('downloads'); -$template['link_characters'] = internalLayoutLink('characters'); -$template['link_online'] = internalLayoutLink('online'); -$template['link_highscores'] = internalLayoutLink('highscores'); -$template['link_powergamers'] = internalLayoutLink('powergamers'); -$template['link_lastkills'] = internalLayoutLink('lastkills'); -$template['link_houses'] = internalLayoutLink('houses'); -$template['link_guilds'] = internalLayoutLink('guilds'); -$template['link_wars'] = internalLayoutLink('wars'); -$template['link_polls'] = internalLayoutLink('polls'); -$template['link_bans'] = internalLayoutLink('bans'); -$template['link_team'] = internalLayoutLink('team'); -$template['link_creatures'] = internalLayoutLink('creatures'); -$template['link_spells'] = internalLayoutLink('spells'); -$template['link_commands'] = internalLayoutLink('commands'); -$template['link_experienceStages'] = internalLayoutLink('experienceStages'); -$template['link_freeHouses'] = internalLayoutLink('freeHouses'); -$template['link_screenshots'] = internalLayoutLink('screenshots'); -$template['link_movies'] = internalLayoutLink('movies'); -$template['link_serverInfo'] = internalLayoutLink('serverInfo'); -$template['link_experienceTable'] = internalLayoutLink('experienceTable'); -$template['link_faq'] = internalLayoutLink('faq'); -$template['link_points'] = internalLayoutLink('points'); -$template['link_gifts'] = internalLayoutLink('gifts'); + +$links = array('news', 'changelog', 'rules', 'downloads', 'characters', 'online', 'highscores', 'powergamers', 'lastkills', 'houses', 'guilds', 'wars', 'polls', 'bans', 'team', 'creatures', 'spells', 'commands', 'experienceStages', 'freeHouses', 'screenshots', 'movies', 'serverInfo', 'experienceTable', 'faq', 'points', 'gifts'); +foreach($links as $link) { + $template['link_' . $link] = internalLayoutLink($link); +} + $template['link_gifts_history'] = internalLayoutLink('gifts', 'show_history'); if($config['forum'] != '') { diff --git a/tools/signature/tibian.php b/tools/signature/tibian.php index 52f16854..e408c29b 100644 --- a/tools/signature/tibian.php +++ b/tools/signature/tibian.php @@ -1,8 +1,8 @@
Name:'.$player_name.'
Hide Account: + + + getCustomField("hidden") == 1 ? ' checked="checked"' : '') . '> + '; if((int)$player->getCustomField('group_id') > 1) echo ' (you will be also hidden on the Team page!)'; @@ -1023,19 +1018,25 @@ Please enter your account name and your password.
setLookType(136); $player = $ots->createObject('Player'); - $player->setName($newchar_name); - $player->setAccount($account_logged); - //$player->setGroupId($char_to_copy->getGroup()->getId()); + $player->setName($newchar_name); + $player->setAccount($account_logged); + //$player->setGroupId($char_to_copy->getGroup()->getId()); $player->setGroupId(1); - $player->setSex($newchar_sex); - $player->setVocation($char_to_copy->getVocation()); + $player->setSex($newchar_sex); + $player->setVocation($char_to_copy->getVocation()); if(fieldExist('promotion', 'players')) $player->setPromotion($char_to_copy->getPromotion()); if(fieldExist('direction', 'players')) $player->setDirection($char_to_copy->getDirection()); - $player->setConditions($char_to_copy->getConditions()); + $player->setConditions($char_to_copy->getConditions()); $rank = $char_to_copy->getRank(); if($rank->isLoaded()) { $player->setRank($char_to_copy->getRank()); @@ -1095,26 +1096,26 @@ Please enter your account name and your password.
quote($name).", '".$mana."', '".$exp."', '".$health."', '".$speed_lvl."', '".$use_haste."', ".$db->quote($voices_string).", ".$db->quote($immunities_string).", '".$flags['summonable']."', '".$flags['convinceable']."', '".$race."', ".$db->quote($gfx_name).", " . $db->quote($allmonsters->currentFile()) . ")"); + $db->query("INSERT INTO `myaac_monsters` (`hide_creature`, `name`, `mana`, `exp`, `health`, `speed_lvl`, `use_haste`, `voices`, `immunities`, `summonable`, `convinceable`, `race`, `gfx_name`, `file_path`) VALUES (0, " . $db->quote($name) . ", " . $db->quote(empty($mana) ? 0 : $mana) . ", " . $db->quote($exp) . ", " . $db->quote($health) . ", " . $db->quote($speed_lvl) . ", " . $db->quote($use_haste) . ", " . $db->quote($voices_string) . ", " . $db->quote($immunities_string) . ", " . $db->quote($flags['summonable'] > 0 ? 1 : 0) . ", " . $db->quote($flags['convinceable'] > 0 ? 1 : 0) . ", ".$db->quote($race).", ".$db->quote($gfx_name).", " . $db->quote($allmonsters->currentFile()) . ")"); + success("Added: ".$name."
"); } catch(PDOException $error) { @@ -172,25 +173,25 @@ if(empty($_REQUEST['creature'])) $desc = " DESC"; } if($order == 'name') { - $whereandorder = ' ORDER BY name'.$desc; + $whereandorder = ' ORDER BY name'.$desc; } elseif($order == 'exp') { - $whereandorder = ' ORDER BY exp'.$desc.', name'; + $whereandorder = ' ORDER BY exp'.$desc.', name'; } elseif($order == 'health') { - $whereandorder = ' ORDER BY health'.$desc.', name'; + $whereandorder = ' ORDER BY health'.$desc.', name'; } elseif($order == 'summonable') { - $whereandorder = ' AND summonable = 1 ORDER BY mana'.$desc; + $whereandorder = ' AND summonable = 1 ORDER BY mana'.$desc; } elseif($order == 'convinceable') { - $whereandorder = ' AND convinceable = 1 ORDER BY mana'.$desc; + $whereandorder = ' AND convinceable = 1 ORDER BY mana'.$desc; } elseif($order == 'race') { - $whereandorder = ' ORDER BY race'.$desc.', name'; + $whereandorder = ' ORDER BY race'.$desc.', name'; } else { - $whereandorder = ' ORDER BY name'; + $whereandorder = ' ORDER BY name'; } //send query to database $monsters = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'monsters').' WHERE hide_creature != 1'.$whereandorder); @@ -208,7 +209,7 @@ if(empty($_REQUEST['creature'])) if($order == 'exp' && !isset($_REQUEST['desc'])) { echo '
Experience
DESC
ExperienceExperienceSummonable
Mana DESC