diff --git a/.htaccess b/.htaccess
index 274c5988..95afe203 100644
--- a/.htaccess
+++ b/.htaccess
@@ -13,6 +13,7 @@ RewriteRule ^guilds/([A-Za-z0-9-_+']+)$ index.php?subtopic=guilds&action=show&gu
RewriteRule ^forum/board/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_board&id=$1&page=$2
RewriteRule ^forum/thread/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1
+RewriteRule ^forum/thread/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
RewriteRule ^forum/board/([0-9]+)/([0-9]+)$ index.php?subtopic=forum&action=show_thread&id=$1&page=$2
RewriteRule ^account/manage$ index.php?subtopic=accountmanagement
RewriteRule ^account/create$ index.php?subtopic=createaccount
diff --git a/admin/templates/clean/template.php b/admin/templates/clean/template.php
index dfc6e5c7..0c61e95f 100644
--- a/admin/templates/clean/template.php
+++ b/admin/templates/clean/template.php
@@ -22,7 +22,7 @@
Site is under maintenance (closed mode). Only privileged users can see it.
';
if($config['backward_support'])
require(SYSTEM . 'compat_pages.php');
$ignore = false;
$file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file))
{
$logged_access = 0;
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}
$query =
$db->query(
'SELECT `title`, `body`, `php`' .
' FROM `' . TABLE_PREFIX . 'pages`' .
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
if($query->rowCount() > 0) // found page
{
$ignore = true;
$query = $query->fetch();
$title = $query['title'];
if($query['php'] == '1') // execute it as php code
{
$tmp = substr($query['body'], 0, 10);
if(($pos = strpos($tmp, ' $errno, 'errstr' => $errstr);
}
set_error_handler('error_handler');
ob_start();
eval($tmp);
$content .= ob_get_contents();
ob_end_clean();
restore_error_handler();
if(isset($php_errors[0]) && superAdmin()) {
var_dump($php_errors);
}
}
else
$content .= $query['body']; // plain html
}
else
{
$page = '404';
$file = SYSTEM . 'pages/404.php';
}
}
ob_start();
if($events->trigger('BEFORE_PAGE'))
{
if(!$ignore)
require($file);
}
if($config['backward_support'] && isset($main_content))
$content .= $main_content;
$content .= ob_get_contents();
ob_end_clean();
$events->trigger('AFTER_PAGE');
}
if($config['backward_support']) {
$main_content = $content;
}
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
if(file_exists($template_path . '/index.php'))
require($template_path . '/index.php');
else if(file_exists($template_path . '/template.php')) // deprecated
require($template_path . '/template.php');
else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
{
require($template_path . '/layout.php');
}
else
{
// TODO: save more info to log file
die('ERROR: Cannot load template.');
}
echo '' . "\n";
if(($config['debug_level'] & 1) == 1)
echo '';
if(($config['debug_level'] & 2) == 2)
echo "\n" . '';
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '';
$events->trigger('FINISH');
?>
\ No newline at end of file
+
* @copyright 2017 MyAAC
* @version 0.0.2
* @link http://my-aac.org
*/
require_once('common.php');
require_once(BASE . 'config.local.php');
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
{
header('Location: ' . BASE_DIR . '/install/');
die('Setup detected that Site is under maintenance (closed mode). Only privileged users can see it.
';
if($config['backward_support'])
require(SYSTEM . 'compat_pages.php');
$ignore = false;
$file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file))
{
$logged_access = 0;
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}
$query =
$db->query(
'SELECT `title`, `body`, `php`' .
' FROM `' . TABLE_PREFIX . 'pages`' .
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
if($query->rowCount() > 0) // found page
{
$ignore = true;
$query = $query->fetch();
$title = $query['title'];
if($query['php'] == '1') // execute it as php code
{
$tmp = substr($query['body'], 0, 10);
if(($pos = strpos($tmp, ' $errno, 'errstr' => $errstr);
}
set_error_handler('error_handler');
ob_start();
eval($tmp);
$content .= ob_get_contents();
ob_end_clean();
restore_error_handler();
if(isset($php_errors[0]) && superAdmin()) {
var_dump($php_errors);
}
}
else
$content .= $query['body']; // plain html
}
else
{
$page = '404';
$file = SYSTEM . 'pages/404.php';
}
}
ob_start();
if($events->trigger('BEFORE_PAGE'))
{
if(!$ignore)
require($file);
}
if($config['backward_support'] && isset($main_content))
$content .= $main_content;
$content .= ob_get_contents();
ob_end_clean();
$events->trigger('AFTER_PAGE');
}
if($config['backward_support']) {
$main_content = $content;
if(!isset($title))
$title = ucfirst($page);
}
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
if(file_exists($template_path . '/index.php'))
require($template_path . '/index.php');
else if(file_exists($template_path . '/template.php')) // deprecated
require($template_path . '/template.php');
else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
{
require($template_path . '/layout.php');
}
else
{
// TODO: save more info to log file
die('ERROR: Cannot load template.');
}
echo '' . "\n";
if(($config['debug_level'] & 1) == 1)
echo '';
if(($config['debug_level'] & 2) == 2)
echo "\n" . '';
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '';
$events->trigger('FINISH');
?>
\ No newline at end of file
diff --git a/install/includes/config.php b/install/includes/config.php
new file mode 100644
index 00000000..d2928c93
--- /dev/null
+++ b/install/includes/config.php
@@ -0,0 +1,36 @@
+' . $config['database_type'] . '', $locale['step_database_error_only_mysql']);
+ error($locale['step_database_error_only_mysql']);
+ $error = true;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/install/includes/database.php b/install/includes/database.php
index 22563323..82a178c7 100644
--- a/install/includes/database.php
+++ b/install/includes/database.php
@@ -1,5 +1,12 @@
\ No newline at end of file
diff --git a/install/includes/functions.php b/install/includes/functions.php
index edc40ff0..1e289630 100644
--- a/install/includes/functions.php
+++ b/install/includes/functions.php
@@ -1,4 +1,5 @@
'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'finish');
+$steps = array(1 => 'welcome', 2 => 'license', 3 => 'requirements', 4 => 'config', 5 => 'database', 6 => 'admin', 7 => 'finish');
if(!in_array($step, $steps)) // check if step is valid
die('ERROR: Unknown step.');
@@ -33,6 +33,8 @@ if($step == 'database')
}
}
+$error = false;
+
// step include
ob_start();
require('steps/' . $step . '.php');
diff --git a/install/steps/admin.php b/install/steps/admin.php
new file mode 100644
index 00000000..ccb02539
--- /dev/null
+++ b/install/steps/admin.php
@@ -0,0 +1,32 @@
+
+
diff --git a/install/steps/database.php b/install/steps/database.php
index 756f61cf..87dc7f55 100644
--- a/install/steps/database.php
+++ b/install/steps/database.php
@@ -1,5 +1,7 @@
' . $config['database_type'] . '', $locale['step_database_error_only_mysql']);
- error($locale['step_database_error_only_mysql']);
+ if(!$error) {
+ success($locale['step_database_importing']);
+ require(BASE . 'install/includes/database.php');
+
+ if(!tableExist('accounts')) {
+ $locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
+ error($locale['step_database_error_table']);
$error = true;
}
- else {
- success($locale['step_database_importing']);
- require(BASE . 'install/includes/database.php');
-
- if(!tableExist('accounts')) {
- $locale['step_database_error_table'] = str_replace('$TABLE$', 'accounts', $locale['step_database_error_table']);
- error($locale['step_database_error_table']);
+ else if(!tableExist('players')) {
+ $locale['step_database_error_table'] = str_replace('$TABLE$', 'players', $locale['step_database_error_table']);
+ error($locale['step_database_error_table']);
+ $error = true;
+ }
+ else if(!tableExist('guilds')) {
+ $locale['step_database_error_table'] = str_replace('$TABLE$', 'guilds', $locale['step_database_error_table']);
+ error($locale['step_database_error_table']);
+ $error = true;
+ }
+
+ if(tableExist(TABLE_PREFIX . 'account_actions')) {
+ $locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
+ warning($locale['step_database_error_table_exist']);
+ }
+ else if(!$error) {
+ // import schema
+ try {
+ $db->query(file_get_contents(BASE . 'install/includes/schema.sql'));
+ }
+ catch(PDOException $error_) {
+ error($locale['step_database_error_schema'] . ' ' . $error_);
$error = true;
}
-
- if(tableExist(TABLE_PREFIX . 'account_actions')) {
- $locale['step_database_error_table_exist'] = str_replace('$TABLE$', TABLE_PREFIX . 'account_actions', $locale['step_database_error_table_exist']);
- warning($locale['step_database_error_table_exist']);
- }
- else if(!$error) {
- // import schema
- try {
- $db->query(file_get_contents(BASE . 'install/includes/schema.sql'));
- }
- catch(PDOException $error_) {
- error($locale['step_database_error_schema'] . ' ' . $error_);
- $error = true;
- }
-
- if(!$error) {
- $locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
- success($locale['step_database_success_schema']);
- }
- }
+ if(!$error) {
+ $locale['step_database_success_schema'] = str_replace('$PREFIX$', TABLE_PREFIX, $locale['step_database_success_schema']);
+ success($locale['step_database_success_schema']);
+ }
+ }
+
+ if(!$error) {
if(fieldExist('key', 'accounts')) {
if(query("ALTER TABLE `accounts` MODIFY `key` VARCHAR(64) NOT NULL DEFAULT '';"))
success($locale['step_database_modifying_field'] . ' accounts.key...');
@@ -127,12 +115,12 @@ if(!$error) {
}
else if(!fieldExist('web_lastlogin', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `web_lastlogin` INT(11) NOT NULL DEFAULT 0 AFTER `country`;"))
- success($locale['step_database_adding_field'] . ' accounts.created...');
+ success($locale['step_database_adding_field'] . ' accounts.web_lastlogin...');
}
if(!fieldExist('web_flags', 'accounts')) {
if(query("ALTER TABLE `accounts` ADD `web_flags` INT(11) NOT NULL DEFAULT 0 AFTER `web_lastlogin`;"))
- success($locale['step_database_adding_field'] . ' accounts.country...');
+ success($locale['step_database_adding_field'] . ' accounts.web_flags...');
}
if(!fieldExist('email_hash', 'accounts')) {
@@ -176,7 +164,7 @@ if(!$error) {
if(query("ALTER TABLE `accounts` ADD `premium_points` INT(11) NOT NULL DEFAULT 0 AFTER `email_next`;"))
success($locale['step_database_adding_field'] . ' accounts.premium_points...');
}
-
+
if(!fieldExist('description', 'guilds')) {
if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL DEFAULT '';"))
success($locale['step_database_adding_field'] . ' guilds.description...');
@@ -193,12 +181,17 @@ if(!$error) {
if(query("ALTER TABLE `guilds` ADD `logo_name` VARCHAR( 255 ) NOT NULL DEFAULT 'default.gif';"))
success($locale['step_database_adding_field'] . ' guilds.logo_name...');
}
-
+
if(!fieldExist('created', 'players')) {
if(query("ALTER TABLE `players` ADD `created` INT(11) NOT NULL DEFAULT 0;"))
success($locale['step_database_adding_field'] . ' players.created...');
}
+ if(!fieldExist('deleted', 'players') && !fieldExist('deletion', 'players')) {
+ if(query("ALTER TABLE `players` ADD `deleted` TINYINT(1) NOT NULL DEFAULT 0;"))
+ success($locale['step_database_adding_field'] . ' players.comment...');
+ }
+
if(fieldExist('hide_char', 'players')) {
if(query("ALTER TABLE `players` CHANGE `hide_char` `hidden` TINYINT(1) NOT NULL DEFAULT 0;")) {
$tmp = str_replace('$FIELD$', 'players.hide_char', $locale['step_database_changing_field']);
@@ -207,7 +200,7 @@ if(!$error) {
}
}
else if(!fieldExist('hidden', 'players')) {
- if(query("ALTER TABLE `players` ADD `hidden` VARCHAR( 255 ) TINYINT(1) NOT NULL DEFAULT 0;"))
+ if(query("ALTER TABLE `players` ADD `hidden` TINYINT(1) NOT NULL DEFAULT 0;"))
success($locale['step_database_adding_field'] . ' players.hidden...');
}
@@ -215,120 +208,45 @@ if(!$error) {
if(query("ALTER TABLE `players` ADD `comment` TEXT NOT NULL DEFAULT '';"))
success($locale['step_database_adding_field'] . ' players.comment...');
}
-
- $account = $_SESSION['var_account'];
- $password = $_SESSION['var_password'];
-
- $config_salt_enabled = fieldExist('salt', 'accounts');
- if($config_salt_enabled)
- {
- $salt = generateRandomString(10, false, true, true);
- $password = $salt . $password;
+ }
+
+ 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;
}
-
- $account_db = new OTS_Account();
- $account_db->load(1);
- if($account_db->isLoaded()) {
- $account_db->setName('dummy_account');
- $account_db->setPassword('for sample characters. ' . generateRandomString(10));
- $account_db->save();
+
+ $content .= '$config[\'mail_enabled\'] = true;';
+ $content .= PHP_EOL;
+ if(!check_mail($_SESSION['var_mail_admin'])) {
+ error($locale['step_config_mail_admin_error']);
+ $error = true;
+ }
+ if(!check_mail($_SESSION['var_mail_address'])) {
+ error($locale['step_config_mail_address_error']);
+ $error = true;
+ }
+
+ $content .= '$config[\'client_download\'] = \'http://clients.halfaway.net/windows.php?tibia=\'. $config[\'client\'];';
+ $content .= PHP_EOL;
+ $content .= '$config[\'client_download_linux\'] = \'http://clients.halfaway.net/linux.php?tibia=\'. $config[\'client\'];';
+ $content .= PHP_EOL;
+ $content .= '// place for your configuration directives, so you can later easily update myaac';
+ $content .= PHP_EOL;
+ $content .= "?>";
+ $file = fopen(BASE . 'config.local.php', 'a+');
+ if($file) {
+ if(!$error) {
+ fwrite($file, $content);
+ $_SESSION['saved'] = true;
+ }
}
else {
- $new_account = new OTS_Account();
- $new_account->create('dummy_account', 1);
- $account_db->setPassword('for sample characters. ' . generateRandomString(10));
- }
-
-
- $account_db = new OTS_Account();
- $account_db->find($account);
- if($account_db->isLoaded()) {
- if($config_salt_enabled)
- $account_db->setSalt($salt);
-
- $account_db->setPassword(encrypt($password));
- $account_db->setEMail($_SESSION['var_mail_admin']);
- $account_db->save();
- $account_db->setCustomField('web_flags', 3);
- $account_db->setCustomField('country', 'us');
-
- $_SESSION['account'] = $account_db->getId();
- }
- else {
- $new_account = $ots->createObject('Account');
- $new_account->create($account);
-
- if($config_salt_enabled)
- $new_account->setSalt($salt);
-
- $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->setCustomField('web_flags', 3);
- $new_account->setCustomField('country', 'us');
- $new_account->logAction('Account created.');
-
- $_SESSION['account'] = $new_account->getId();
- }
-
- success($locale['step_database_created_account']);
- $_SESSION['password'] = encrypt($password);
- $_SESSION['remember_me'] = true;
-
- $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'));
- 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`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `lastlogout`, `blessings`, `balance`, `stamina`, `$deleted`, `created`, `hidden`, `comment`) VALUES
- (null, 'Rook Sample', 1, 1, 8, 0, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179613, 2453925456, 1, 0, 0, 1255179614, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
- (null, 'Sorcerer Sample', 1, 1, 8, 1, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179571, 2453925456, 1, 0, 0, 1255179612, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
- (null, 'Druid Sample', 1, 1, 8, 2, 185, 185, 4200, 118, 114, 38, 57, 130, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179655, 2453925456, 1, 0, 0, 1255179658, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
- (null, 'Paladin Sample', 1, 1, 8, 3, 185, 185, 4200, 118, 114, 38, 57, 129, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179854, 2453925456, 1, 0, 0, 1255179858, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, ''),
- (null, 'Knight Sample', 1, 1, 8, 4, 185, 185, 4200, 118, 114, 38, 57, 131, 0, 0, 35, 35, 0, 100, 11, 2200, 1298, 7, '', 470, 1, 1255179620, 2453925456, 1, 0, 0, 1255179654, 0, 0, 151200000, 1, UNIX_TIMESTAMP(), 1, '');"))
- success($locale['step_database_imported_players']);
- }
-
- 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;
- if(!check_mail($_SESSION['var_mail_admin'])) {
- error($locale['step_config_mail_admin_error']);
- $error = true;
- }
- if(!check_mail($_SESSION['var_mail_address'])) {
- error($locale['step_config_mail_address_error']);
- $error = true;
- }
-
- $content .= '$config[\'client_download\'] = \'http://clients.halfaway.net/windows.php?tibia=\'. $config[\'client\'];';
- $content .= PHP_EOL;
- $content .= '$config[\'client_download_linux\'] = \'http://clients.halfaway.net/linux.php?tibia=\'. $config[\'client\'];';
- $content .= PHP_EOL;
-
- $content .= "?>";
- $file = fopen(BASE . 'config.local.php', 'a+');
- if($file) {
- if(!$error) {
- fwrite($file, $content);
- $_SESSION['saved'] = true;
- }
- }
- else {
- $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.local.php', $locale['step_database_error_file']);
- warning($locale['step_database_error_file'] . '
- ');
- }
+ $locale['step_database_error_file'] = str_replace('$FILE$', '' . BASE . 'config.local.php', $locale['step_database_error_file']);
+ warning($locale['step_database_error_file'] . '
+ ');
}
}
}
@@ -336,7 +254,7 @@ if(!$error) {
?>
\ No newline at end of file
diff --git a/install/steps/finish.php b/install/steps/finish.php
index 01b82686..12ee5fd1 100644
--- a/install/steps/finish.php
+++ b/install/steps/finish.php
@@ -1,20 +1,152 @@
-
+defined('MYAAC') or die('Direct access not allowed!');
-' . $locale['already_installed'] . '';
}
+else {
+ require(SYSTEM . 'init.php');
+ //require(BASE . 'install/includes/config.php');
+ if(!$error) {
+ //require(BASE . 'install/includes/database.php');
-foreach($_SESSION as $key => $value) {
- if(strpos($key, 'var_') !== false)
- unset($_SESSION[$key]);
+ if(USE_ACCOUNT_NAME)
+ $account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : NULL;
+ else
+ $account_id = isset($_SESSION['var_account_id']) ? $_SESSION['var_account_id'] : NULL;
+
+ $password = $_SESSION['var_password'];
+
+ $config_salt_enabled = fieldExist('salt', 'accounts');
+ if($config_salt_enabled)
+ {
+ $salt = generateRandomString(10, false, true, true);
+ $password = $salt . $password;
+ }
+
+ $account_db = new OTS_Account();
+ $account_db->load(1);
+ if($account_db->isLoaded()) {
+ if(USE_ACCOUNT_NAME)
+ $account_db->setName('dummy_account');
+
+ $account_db->setPassword('for sample characters. ' . generateRandomString(10));
+ $account_db->save();
+ }
+ else {
+ $new_account = new OTS_Account();
+ if(USE_ACCOUNT_NAME)
+ $new_account->create('dummy_account', 1);
+ else
+ $new_account->create(NULL, 1);
+
+ $new_account->setPassword('for sample characters. ' . generateRandomString(10));
+ $new_account->save();
+ }
+
+ $account_db = new OTS_Account();
+ if(isset($account))
+ $account_db->find($account);
+ else
+ $account_db->load($account_id);
+
+ $player_db = $ots->createObject('Player');
+ $player_db->find('Admin');
+ $groups = new OTS_Groups_List();
+ if(!$player_db->isLoaded())
+ {
+ $player = $ots->createObject('Player');
+ $player->setName('Admin');
+
+ $player->setGroupId($groups->getHighestId());
+ }
+
+ if($account_db->isLoaded()) {
+ if($config_salt_enabled)
+ $account_db->setSalt($salt);
+
+ $account_db->setPassword(encrypt($password));
+ $account_db->setEMail($_SESSION['var_mail_admin']);
+ $account_db->save();
+ $account_db->setCustomField('web_flags', 3);
+ $account_db->setCustomField('country', 'us');
+ if(fieldExist('group_id', 'accounts'))
+ $account_db->setCustomField('group_id', $groups->getHighestId());
+
+ if(!$player_db->isLoaded())
+ $player->setAccountId($account_db->getId());
+ else
+ $player_db->setAccountId($account_db->getId());
+
+ $_SESSION['account'] = $account_db->getId();
+ }
+ else {
+ $new_account = $ots->createObject('Account');
+ $new_account->create($account);
+
+ if($config_salt_enabled)
+ $new_account->setSalt($salt);
+
+ $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->setCustomField('web_flags', 3);
+ $new_account->setCustomField('country', 'us');
+ if(fieldExist('group_id', 'accounts'))
+ $new_account->setCustomField('group_id', $groups->getHighestId());
+ $new_account->logAction('Account created.');
+
+ if(!$player_db->isLoaded())
+ $player->setAccountId($new_account->getId());
+ else
+ $player_db->setAccountId($new_account->getId());
+
+ $_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;
+
+ $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'));
+ 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']);
+ }
+
+ $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']);
+ ?>
+
+ $value) {
+ if(strpos($key, 'var_') !== false)
+ unset($_SESSION[$key]);
+ }
+ unset($_SESSION['saved']);
+ }
}
-unset($_SESSION['saved']);
?>
\ No newline at end of file
diff --git a/install/steps/license.php b/install/steps/license.php
index 6a970fec..0874b89a 100644
--- a/install/steps/license.php
+++ b/install/steps/license.php
@@ -1,3 +1,6 @@
+
|