-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
-
\ No newline at end of file
diff --git a/system/pages/admin/changelog.php b/system/pages/admin/changelog.php
index 53c07d65..e0120cad 100644
--- a/system/pages/admin/changelog.php
+++ b/system/pages/admin/changelog.php
@@ -10,7 +10,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'MyAAC Changelog';
-if(!file_exists(BASE . 'CHANGELOG')) {
+if (!file_exists(BASE . 'CHANGELOG')) {
echo 'File CHANGELOG doesn\'t exist.';
return;
}
diff --git a/system/pages/admin/dashboard.php b/system/pages/admin/dashboard.php
index 49fe4efb..10e8dbe8 100644
--- a/system/pages/admin/dashboard.php
+++ b/system/pages/admin/dashboard.php
@@ -12,39 +12,39 @@ $title = 'Dashboard';
$cache = Cache::getInstance();
if ($cache->enabled()) {
- if (isset($_GET['clear_cache'])) {
- if (clearCache())
- success('Cache cleared.');
- else
- error('Error while clearing cache.');
- }
+ if (isset($_GET['clear_cache'])) {
+ if (clearCache())
+ success('Cache cleared.');
+ else
+ error('Error while clearing cache.');
+ }
}
if (isset($_GET['maintenance'])) {
- $_status = (int)$_POST['status'];
- $message = $_POST['message'];
- if (empty($message)) {
- error('Message cannot be empty.');
- } else if (strlen($message) > 255) {
- error('Message is too long. Maximum length allowed is 255 chars.');
- } else {
- $tmp = '';
- if (fetchDatabaseConfig('site_closed', $tmp))
- updateDatabaseConfig('site_closed', $_status);
- else
- registerDatabaseConfig('site_closed', $_status);
+ $_status = (int)$_POST['status'];
+ $message = $_POST['message'];
+ if (empty($message)) {
+ error('Message cannot be empty.');
+ } else if (strlen($message) > 255) {
+ error('Message is too long. Maximum length allowed is 255 chars.');
+ } else {
+ $tmp = '';
+ if (fetchDatabaseConfig('site_closed', $tmp))
+ updateDatabaseConfig('site_closed', $_status);
+ else
+ registerDatabaseConfig('site_closed', $_status);
- if (fetchDatabaseConfig('site_closed_message', $tmp))
- updateDatabaseConfig('site_closed_message', $message);
- else
- registerDatabaseConfig('site_closed_message', $message);
- }
+ if (fetchDatabaseConfig('site_closed_message', $tmp))
+ updateDatabaseConfig('site_closed_message', $message);
+ else
+ registerDatabaseConfig('site_closed_message', $message);
+ }
}
$is_closed = getDatabaseConfig('site_closed') == '1';
$closed_message = 'Server is under maintenance, please visit later.';
$tmp = '';
if (fetchDatabaseConfig('site_closed_message', $tmp))
- $closed_message = $tmp;
+ $closed_message = $tmp;
$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;');
$query = $query->fetch();
@@ -63,73 +63,73 @@ $query = $query->fetch();
$total_houses = $query['how_much'];
if ($db->hasColumn('accounts', 'premium_points')) {
- $points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
+ $points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
} else {
- $points = 0;
+ $points = 0;
}
if ($db->hasColumn('accounts', 'coins')) {
- $coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
+ $coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
} else {
- $coins = 0;
+ $coins = 0;
}
$twig->display('admin.statistics.html.twig', array(
- 'total_accounts' => $total_accounts,
- 'total_players' => $total_players,
- 'total_guilds' => $total_guilds,
- 'total_houses' => $total_houses
+ 'total_accounts' => $total_accounts,
+ 'total_players' => $total_players,
+ 'total_guilds' => $total_guilds,
+ 'total_houses' => $total_houses
));
$twig->display('admin.dashboard.html.twig', array(
- 'is_closed' => $is_closed,
- 'closed_message' => $closed_message,
- 'status' => $status,
- 'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
- 'points' => $points,
- 'coins' => $coins,
+ 'is_closed' => $is_closed,
+ 'closed_message' => $closed_message,
+ 'status' => $status,
+ 'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
+ 'points' => $points,
+ 'coins' => $coins,
));
function clearCache()
{
- global $template_name;
- $cache = Cache::getInstance();
+ global $template_name;
+ $cache = Cache::getInstance();
- $tmp = '';
- if ($cache->fetch('status', $tmp))
- $cache->delete('status');
+ $tmp = '';
+ if ($cache->fetch('status', $tmp))
+ $cache->delete('status');
- if ($cache->fetch('templates', $tmp))
- $cache->delete('templates');
+ if ($cache->fetch('templates', $tmp))
+ $cache->delete('templates');
- if ($cache->fetch('config_lua', $tmp))
- $cache->delete('config_lua');
+ if ($cache->fetch('config_lua', $tmp))
+ $cache->delete('config_lua');
- if ($cache->fetch('vocations', $tmp))
- $cache->delete('vocations');
+ if ($cache->fetch('vocations', $tmp))
+ $cache->delete('vocations');
- if ($cache->fetch('towns', $tmp))
- $cache->delete('towns');
+ if ($cache->fetch('towns', $tmp))
+ $cache->delete('towns');
- if ($cache->fetch('groups', $tmp))
- $cache->delete('groups');
+ if ($cache->fetch('groups', $tmp))
+ $cache->delete('groups');
- if ($cache->fetch('visitors', $tmp))
- $cache->delete('visitors');
+ if ($cache->fetch('visitors', $tmp))
+ $cache->delete('visitors');
- if ($cache->fetch('views_counter', $tmp))
- $cache->delete('views_counter');
+ if ($cache->fetch('views_counter', $tmp))
+ $cache->delete('views_counter');
- if ($cache->fetch('failed_logins', $tmp))
- $cache->delete('failed_logins');
+ if ($cache->fetch('failed_logins', $tmp))
+ $cache->delete('failed_logins');
- if ($cache->fetch('news' . $template_name . '_' . NEWS, $tmp))
- $cache->delete('news' . $template_name . '_' . NEWS);
+ if ($cache->fetch('news' . $template_name . '_' . NEWS, $tmp))
+ $cache->delete('news' . $template_name . '_' . NEWS);
- if ($cache->fetch('news' . $template_name . '_' . TICKER, $tmp))
- $cache->delete('news' . $template_name . '_' . TICKER);
+ if ($cache->fetch('news' . $template_name . '_' . TICKER, $tmp))
+ $cache->delete('news' . $template_name . '_' . TICKER);
- if ($cache->fetch('template_ini' . $template_name, $tmp))
- $cache->delete('template_ini' . $template_name);
+ if ($cache->fetch('template_ini' . $template_name, $tmp))
+ $cache->delete('template_ini' . $template_name);
- return true;
+ return true;
}
\ No newline at end of file
diff --git a/system/pages/admin/items.php b/system/pages/admin/items.php
index 906ee60e..1accd7cf 100644
--- a/system/pages/admin/items.php
+++ b/system/pages/admin/items.php
@@ -16,13 +16,13 @@ require LIBS . 'weapons.php';
$twig->display('admin.items.html.twig');
$reload = isset($_REQUEST['reload']) && (int)$_REQUEST['reload'] == 1;
-if($reload) {
- if(Items::loadFromXML(true))
+if ($reload) {
+ if (Items::loadFromXML(true))
success('Successfully loaded items.');
else
error(Items::getError());
- if(Weapons::loadFromXML(true))
+ if (Weapons::loadFromXML(true))
success('Successfully loaded weapons.');
else
error(Weapons::getError());
diff --git a/system/pages/admin/login.php b/system/pages/admin/login.php
index 3bc8a8e5..e0c95e02 100644
--- a/system/pages/admin/login.php
+++ b/system/pages/admin/login.php
@@ -10,23 +10,23 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Login';
$logout = '';
-if($action == 'logout') {
- $logout = "You have been logged out!";
+if ($action == 'logout') {
+ $logout = "You have been logged out!";
}
$search_errors[] = 'Character
does not exist or has been deleted.';
-if(isset($errors)) {
- foreach($errors as $error) {
+if (isset($errors)) {
+ foreach ($errors as $error) {
error($error);
- $twig->display('admin.error.html.twig', array('errors' => $error));
+ $twig->display('admin.error.html.twig', array('errors' => $error));
}
}
$twig->display('admin.login.html.twig', array(
- 'errors' => $search_errors,
- 'logout' => $logout,
- 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
- ));
\ No newline at end of file
+ 'errors' => $search_errors,
+ 'logout' => $logout,
+ 'account' => USE_ACCOUNT_NAME ? 'Name' : 'Number',
+));
\ No newline at end of file
diff --git a/system/pages/admin/logs.php b/system/pages/admin/logs.php
index d90997fa..0fea9301 100644
--- a/system/pages/admin/logs.php
+++ b/system/pages/admin/logs.php
@@ -12,113 +12,113 @@ $title = 'Logs viewer';
?>
';
- echo nl2br(file_get_contents($aac_path_logs . $file));
- echo '
+ echo nl2br(file_get_contents($aac_path_logs . $file));
+ echo '
';
- } else if (file_exists($server_path_logs . $file)) {
- echo '
';
- echo nl2br(file_get_contents($server_path_logs . $file));
- echo '
';
- } else
- echo 'Specified file does not exist.';
- } else
- echo 'Invalid file name specified.';
+ } else if (file_exists($server_path_logs . $file)) {
+ echo '
';
+ echo nl2br(file_get_contents($server_path_logs . $file));
+ echo '
';
+ } else
+ echo 'Specified file does not exist.';
+ } else
+ echo 'Invalid file name specified.';
}
?>
\ No newline at end of file
diff --git a/system/pages/admin/mailer.php b/system/pages/admin/mailer.php
index 31cd6587..d380e05c 100644
--- a/system/pages/admin/mailer.php
+++ b/system/pages/admin/mailer.php
@@ -10,14 +10,12 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Mailer';
-if(!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin())
-{
+if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
echo 'Access denied.';
return;
}
-if(!$config['mail_enabled'])
-{
+if (!$config['mail_enabled']) {
echo 'Mail support disabled.';
return;
}
@@ -27,11 +25,11 @@ $mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subjec
$preview = isset($_REQUEST['preview']);
$preview_done = false;
-if($preview) {
- if(!empty($mail_content) && !empty($mail_subject)) {
+if ($preview) {
+ if (!empty($mail_content) && !empty($mail_subject)) {
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
- if(!$preview_done)
+ if (!$preview_done)
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
}
}
@@ -43,31 +41,29 @@ $twig->display('admin.mailer.html.twig', array(
'preview_done' => $preview_done
));
-if(empty($mail_content) || empty($mail_subject) || $preview)
+if (empty($mail_content) || empty($mail_subject) || $preview)
return;
$success = 0;
$failed = 0;
$add = '';
-if($config['account_mail_verify']) {
+if ($config['account_mail_verify']) {
note('Note: Sending only to users with verified E-Mail.');
$add = ' AND ' . $db->fieldName('email_verified') . ' = 1';
}
$query = $db->query('SELECT ' . $db->fieldName('email') . ' FROM ' . $db->tableName('accounts') . ' WHERE ' . $db->fieldName('email') . ' != ""' . $add);
-foreach($query as $email)
-{
- if(_mail($email['email'], $mail_subject, $mail_content))
+foreach ($query as $email) {
+ if (_mail($email['email'], $mail_subject, $mail_content))
$success++;
- else
- {
+ else {
$failed++;
echo '
';
error('An error occorred while sending email to
' . $email['email'] . '. Error: ' . $mailer->ErrorInfo);
}
}
- success('Mailing finished.');
- success("$success emails delivered.");
- warning("$failed emails failed.");
+success('Mailing finished.');
+success("$success emails delivered.");
+warning("$failed emails failed.");
diff --git a/system/pages/admin/menus.php b/system/pages/admin/menus.php
index d50ee760..910e3ab6 100644
--- a/system/pages/admin/menus.php
+++ b/system/pages/admin/menus.php
@@ -10,84 +10,81 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Menus';
-if(!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin())
-{
- echo 'Access denied.';
- return;
+if (!hasFlag(FLAG_CONTENT_MENUS) && !superAdmin()) {
+ echo 'Access denied.';
+ return;
}
-if(isset($_REQUEST['template'])) {
- $template = $_REQUEST['template'];
+if (isset($_REQUEST['template'])) {
+ $template = $_REQUEST['template'];
- if(isset($_REQUEST['menu'])) {
- $post_menu = $_REQUEST['menu'];
- $post_menu_link = $_REQUEST['menu_link'];
- $post_menu_blank = $_REQUEST['menu_blank'];
- $post_menu_color = $_REQUEST['menu_color'];
- if(count($post_menu) != count($post_menu_link)) {
- echo 'Menu count is not equal menu links. Something went wrong when sending form.';
- return;
- }
+ if (isset($_REQUEST['menu'])) {
+ $post_menu = $_REQUEST['menu'];
+ $post_menu_link = $_REQUEST['menu_link'];
+ $post_menu_blank = $_REQUEST['menu_blank'];
+ $post_menu_color = $_REQUEST['menu_color'];
+ if (count($post_menu) != count($post_menu_link)) {
+ 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;
+ $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));
- }
- catch(PDOException $error) {
- warning('Error while adding menu item (' . $menu . '): ' . $error->getMessage());
- }
- }
- }
+ 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));
+ } catch (PDOException $error) {
+ warning('Error while adding menu item (' . $menu . '): ' . $error->getMessage());
+ }
+ }
+ }
- success('Saved at ' . date('H:i'));
- }
+ success('Saved at ' . date('H:i'));
+ }
- $file = TEMPLATES . $template . '/config.php';
- if(file_exists($file)) {
- require_once $file;
- }
- else {
- echo 'Cannot find template config.php file.';
- return;
- }
+ $file = TEMPLATES . $template . '/config.php';
+ if (file_exists($file)) {
+ require_once $file;
+ } else {
+ echo 'Cannot find template config.php file.';
+ return;
+ }
- if(!isset($config['menu_categories'])) {
- echo "No menu categories set in template config.php.
This template doesn't support dynamic menus.";
- return;
- }
+ if (!isset($config['menu_categories'])) {
+ echo "No menu categories set in template config.php.
This template doesn't support dynamic menus.";
+ return;
+ }
- echo 'Hint: You can drag menu items.
+ echo 'Hint: You can drag menu items.
Hint: Add links to external sites using:
http:// prefix.
Not all templates support blank and colorful links.
';
- $menus = array();
- $menus_db = $db->query('SELECT `name`, `link`, `blank`, `color`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll();
- foreach($menus_db as $menu) {
- $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'blank' => $menu['blank'], 'color' => $menu['color'], 'ordering' => $menu['ordering']);
- }
+ $menus = array();
+ $menus_db = $db->query('SELECT `name`, `link`, `blank`, `color`, `category`, `ordering` FROM `' . TABLE_PREFIX . 'menu` WHERE `enabled` = 1 AND `template` = ' . $db->quote($template) . ' ORDER BY `ordering` ASC;')->fetchAll();
+ foreach ($menus_db as $menu) {
+ $menus[$menu['category']][] = array('name' => $menu['name'], 'link' => $menu['link'], 'blank' => $menu['blank'], 'color' => $menu['color'], 'ordering' => $menu['ordering']);
+ }
- $last_id = array();
- echo '
';
- echo '';
+ }
+ echo '
';
+ echo '';
- $twig->display('admin.menus.js.html.twig', array(
- 'menus' => $menus,
- 'last_id' => $last_id
- ));
- ?>
+ $twig->display('admin.menus.js.html.twig', array(
+ 'menus' => $menus,
+ 'last_id' => $last_id
+ ));
+ ?>
- query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll();
- foreach($templates as $key => $value) {
- $file = TEMPLATES . $value['template'] . '/config.php';
- if(!file_exists($file)) {
- unset($templates[$key]);
- }
- }
+ query('SELECT `template` FROM `' . TABLE_PREFIX . 'menu` GROUP BY `template`;')->fetchAll();
+ foreach ($templates as $key => $value) {
+ $file = TEMPLATES . $value['template'] . '/config.php';
+ if (!file_exists($file)) {
+ unset($templates[$key]);
+ }
+ }
- $twig->display('admin.menus.form.html.twig', array(
- 'templates' => $templates
- ));
+ $twig->display('admin.menus.form.html.twig', array(
+ 'templates' => $templates
+ ));
}
\ No newline at end of file
diff --git a/system/pages/admin/notepad.php b/system/pages/admin/notepad.php
index e99d617e..99f3224e 100644
--- a/system/pages/admin/notepad.php
+++ b/system/pages/admin/notepad.php
@@ -11,19 +11,16 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Notepad';
$notepad_content = Notepad::get($account_logged->getId());
-if(isset($_POST['content']))
-{
+if (isset($_POST['content'])) {
$_content = html_entity_decode(stripslashes($_POST['content']));
- if(!$notepad_content)
+ if (!$notepad_content)
Notepad::create($account_logged->getId(), $_content);
else
Notepad::update($account_logged->getId(), $_content);
echo '
Saved at ' . date('H:i') . '
';
-}
-else
-{
- if($notepad_content !== false)
+} else {
+ if ($notepad_content !== false)
$_content = $notepad_content;
}
@@ -35,7 +32,7 @@ class Notepad
{
global $db;
$query = $db->select(TABLE_PREFIX . 'notepad', array('account_id' => $account_id));
- if($query !== false)
+ if ($query !== false)
return $query['content'];
return false;
diff --git a/system/pages/admin/pages.php b/system/pages/admin/pages.php
index 514beaef..954faa68 100644
--- a/system/pages/admin/pages.php
+++ b/system/pages/admin/pages.php
@@ -10,8 +10,7 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Pages';
-if(!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin())
-{
+if (!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin()) {
echo 'Access denied.';
return;
}
@@ -24,66 +23,59 @@ $groups = new OTS_Groups_List();
$php = false;
$access = 0;
-if(!empty($action))
-{
- if($action == 'delete' || $action == 'edit' || $action == 'hide')
+if (!empty($action)) {
+ if ($action == 'delete' || $action == 'edit' || $action == 'hide')
$id = $_REQUEST['id'];
- if(isset($_REQUEST['name']))
+ if (isset($_REQUEST['name']))
$name = $_REQUEST['name'];
- if(isset($_REQUEST['title']))
+ if (isset($_REQUEST['title']))
$p_title = $_REQUEST['title'];
$php = isset($_REQUEST['php']) && $_REQUEST['php'] == 1;
- if($php)
+ if ($php)
$body = $_REQUEST['body'];
- else if(isset($_REQUEST['body'])) {
+ else if (isset($_REQUEST['body'])) {
//$body = $_REQUEST['body'];
$body = html_entity_decode(stripslashes($_REQUEST['body']));
}
- if(isset($_REQUEST['access']))
+ if (isset($_REQUEST['access']))
$access = $_REQUEST['access'];
$errors = array();
$player_id = 1;
- if($action == 'add') {
- if(Pages::add($name, $p_title, $body, $player_id, $php, $access, $errors))
- {
+ if ($action == 'add') {
+ if (Pages::add($name, $p_title, $body, $player_id, $php, $access, $errors)) {
$name = $p_title = $body = '';
$player_id = $access = 0;
$php = false;
}
- }
- else if($action == 'delete') {
- if(Pages::delete($id, $errors))
+ } else if ($action == 'delete') {
+ if (Pages::delete($id, $errors))
success('Page with id ' . $id . ' has been deleted');
- }
- else if($action == 'edit')
- {
- if(isset($id) && !isset($_REQUEST['name'])) {
+ } else if ($action == 'edit') {
+ if (isset($id) && !isset($_REQUEST['name'])) {
$_page = Pages::get($id);
$name = $_page['name'];
$p_title = $_page['title'];
$body = $_page['body'];
$php = $_page['php'] == '1';
$access = $_page['access'];
- }
- else {
+ } else {
Pages::update($id, $name, $p_title, $body, $player_id, $php, $access);
$action = $name = $p_title = $body = '';
$player_id = 1;
$access = 0;
$php = false;
}
- }
- else if($action == 'hide') {
+ } else if ($action == 'hide') {
Pages::toggleHidden($id, $errors);
}
- if(!empty($errors))
+ if (!empty($errors))
$twig->display('admin.error.html.twig', array('errors' => $errors));
}
@@ -91,7 +83,7 @@ $query =
$db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'pages'));
$pages = array();
-foreach($query as $_page) {
+foreach ($query as $_page) {
$pages[] = array(
'link' => getFullLink($_page['name'], $_page['name'], true),
'title' => substr($_page['title'], 0, 20),
@@ -121,7 +113,7 @@ class Pages
{
global $db;
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
- if($query !== false)
+ if ($query !== false)
return $query;
return false;
@@ -130,21 +122,20 @@ class Pages
static public function add($name, $title, $body, $player_id, $php, $access, &$errors)
{
global $db;
- if(isset($name[0]) && isset($title[0]) && isset($body[0]) && $player_id != 0)
- {
+ if (isset($name[0]) && isset($title[0]) && isset($body[0]) && $player_id != 0) {
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
- if($query === false)
+ if ($query === false)
$db->insert(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php ? '1' : '0', 'access' => $access));
else
$errors[] = 'Page with this link already exists.';
- }
- else
+ } else
$errors[] = 'Please fill all inputs.';
return !count($errors);
}
- static public function update($id, $name, $title, $body, $player_id, $php, $access) {
+ static public function update($id, $name, $title, $body, $player_id, $php, $access)
+ {
global $db;
$db->update(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php ? '1' : '0', 'access' => $access), array('id' => $id));
}
@@ -152,14 +143,12 @@ class Pages
static public function delete($id, &$errors)
{
global $db;
- if(isset($id))
- {
- if($db->select(TABLE_PREFIX . 'pages', array('id' => $id)) !== false)
+ if (isset($id)) {
+ if ($db->select(TABLE_PREFIX . 'pages', array('id' => $id)) !== false)
$db->delete(TABLE_PREFIX . 'pages', array('id' => $id));
else
$errors[] = 'Page with id ' . $id . ' does not exists.';
- }
- else
+ } else
$errors[] = 'id not set';
return !count($errors);
@@ -168,18 +157,17 @@ class Pages
static public function toggleHidden($id, &$errors)
{
global $db;
- if(isset($id))
- {
+ if (isset($id)) {
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
- if($query !== false)
+ if ($query !== false)
$db->update(TABLE_PREFIX . 'pages', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
else
$errors[] = 'Page with id ' . $id . ' does not exists.';
- }
- else
+ } else
$errors[] = 'id not set';
return !count($errors);
}
}
+
?>
\ No newline at end of file
diff --git a/system/pages/admin/phpinfo.php b/system/pages/admin/phpinfo.php
index 5f322597..3c557aa8 100644
--- a/system/pages/admin/phpinfo.php
+++ b/system/pages/admin/phpinfo.php
@@ -10,10 +10,10 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'PHP Info';
-if(!function_exists('phpinfo')) { ?>
-
phpinfo() function is disabled in your webserver config.
-You can enable it by editing
php.ini file.
-
+
phpinfo() function is disabled in your webserver config.
+ You can enable it by editing
php.ini file.
+
-
+
diff --git a/system/pages/admin/players.php b/system/pages/admin/players.php
index 217f79e6..715486ab 100644
--- a/system/pages/admin/players.php
+++ b/system/pages/admin/players.php
@@ -14,34 +14,34 @@ $base = BASE_URL . 'admin/?p=players';
function echo_success($message)
{
- echo '
' . $message . '
';
+ echo '
' . $message . '
';
}
function echo_error($message)
{
- global $error;
- echo '
' . $message . '
';
- $error = true;
+ global $error;
+ echo '
' . $message . '
';
+ $error = true;
}
function verify_number($number, $name, $max_length)
{
- if (!Validator::number($number))
- echo_error($name . ' can contain only numbers.');
+ if (!Validator::number($number))
+ echo_error($name . ' can contain only numbers.');
- $number_length = strlen($number);
- if ($number_length <= 0 || $number_length > $max_length)
- echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
+ $number_length = strlen($number);
+ if ($number_length <= 0 || $number_length > $max_length)
+ echo_error($name . ' cannot be longer than ' . $max_length . ' digits.');
}
$skills = array(
- POT::SKILL_FIST => array('Fist fighting', 'fist'),
- POT::SKILL_CLUB => array('Club fighting', 'club'),
- POT::SKILL_SWORD => array('Sword fighting', 'sword'),
- POT::SKILL_AXE => array('Axe fighting', 'axe'),
- POT::SKILL_DIST => array('Distance fighting', 'dist'),
- POT::SKILL_SHIELD => array('Shielding', 'shield'),
- POT::SKILL_FISH => array('Fishing', 'fish')
+ POT::SKILL_FIST => array('Fist fighting', 'fist'),
+ POT::SKILL_CLUB => array('Club fighting', 'club'),
+ POT::SKILL_SWORD => array('Sword fighting', 'sword'),
+ POT::SKILL_AXE => array('Axe fighting', 'axe'),
+ POT::SKILL_DIST => array('Distance fighting', 'dist'),
+ POT::SKILL_SHIELD => array('Shielding', 'shield'),
+ POT::SKILL_FISH => array('Fishing', 'fish')
);
?>
@@ -51,509 +51,511 @@ $skills = array(
query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
- if ($query->rowCount() == 1) {
- $query = $query->fetch();
- $id = $query['id'];
- } else {
- $query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%'));
- if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
- echo 'Do you mean?
';
- } else if ($query->rowCount() > 10)
- echo 'Specified name resulted with too many players.';
- }
- }
- }
+ if (strlen($_REQUEST['search_name']) < 3 && !Validator::number($_REQUEST['search_name'])) {
+ echo 'Player name is too short.';
+ } else {
+ if (Validator::number($_REQUEST['search_name']))
+ $id = $_REQUEST['search_name'];
+ else {
+ $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
+ if ($query->rowCount() == 1) {
+ $query = $query->fetch();
+ $id = $query['id'];
+ } else {
+ $query = $db->query('SELECT `id`, `name` FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $_REQUEST['search_name'] . '%'));
+ if ($query->rowCount() > 0 && $query->rowCount() <= 10) {
+ echo 'Do you mean?
';
+ } else if ($query->rowCount() > 10)
+ echo 'Specified name resulted with too many players.';
+ }
+ }
+ }
}
$groups = new OTS_Groups_List();
if ($id > 0) {
- $player = new OTS_Player();
- $player->load($id);
+ $player = new OTS_Player();
+ $player->load($id);
- if (isset($player) && $player->isLoaded() && isset($_POST['save'])) {// we want to save
- $error = false;
+ if (isset($player) && $player->isLoaded() && isset($_POST['save'])) {// we want to save
+ $error = false;
- if ($player->isOnline())
- echo_error('This player is actually online. You can\'t edit online players.');
+ if ($player->isOnline())
+ echo_error('This player is actually online. You can\'t edit online players.');
- $name = $_POST['name'];
- $_error = '';
- if (!Validator::characterName($name))
- echo_error(Validator::getLastError());
+ $name = $_POST['name'];
+ $_error = '';
+ if (!Validator::characterName($name))
+ echo_error(Validator::getLastError());
- //if(!Validator::newCharacterName($name)
- // echo_error(Validator::getLastError());
+ //if(!Validator::newCharacterName($name)
+ // echo_error(Validator::getLastError());
- $player_db = new OTS_Player();
- $player_db->find($name);
- if ($player_db->isLoaded() && $player->getName() != $name)
- echo_error('This name is already used. Please choose another name!');
+ $player_db = new OTS_Player();
+ $player_db->find($name);
+ if ($player_db->isLoaded() && $player->getName() != $name)
+ echo_error('This name is already used. Please choose another name!');
- $account_id = $_POST['account_id'];
- verify_number($account_id, 'Account id', 11);
+ $account_id = $_POST['account_id'];
+ verify_number($account_id, 'Account id', 11);
- $account_db = new OTS_Account();
- $account_db->load($account_id);
- if (!$account_db->isLoaded())
- echo_error('Account with this id doesn\'t exist.');
+ $account_db = new OTS_Account();
+ $account_db->load($account_id);
+ if (!$account_db->isLoaded())
+ echo_error('Account with this id doesn\'t exist.');
- $group = $_POST['group'];
- if ($groups->getGroup($group) == false)
- echo_error('Group with this id doesn\'t exist');
+ $group = $_POST['group'];
+ if ($groups->getGroup($group) == false)
+ echo_error('Group with this id doesn\'t exist');
- $level = $_POST['level'];
- verify_number($level, 'Level', 11);
+ $level = $_POST['level'];
+ verify_number($level, 'Level', 11);
- $experience = $_POST['experience'];
- verify_number($experience, 'Experience', 20);
+ $experience = $_POST['experience'];
+ verify_number($experience, 'Experience', 20);
- $vocation = $_POST['vocation'];
- verify_number($vocation, 'Vocation id', 11);
+ $vocation = $_POST['vocation'];
+ verify_number($vocation, 'Vocation id', 11);
- if (!isset($config['vocations'][$vocation])) {
- echo_error("Vocation with this id doesn't exist.");
- }
+ if (!isset($config['vocations'][$vocation])) {
+ echo_error("Vocation with this id doesn't exist.");
+ }
- // health
- $health = $_POST['health'];
- verify_number($health, 'Health', 11);
- $health_max = $_POST['health_max'];
- verify_number($health_max, 'Health max', 11);
+ // health
+ $health = $_POST['health'];
+ verify_number($health, 'Health', 11);
+ $health_max = $_POST['health_max'];
+ verify_number($health_max, 'Health max', 11);
- // mana
- $magic_level = $_POST['magic_level'];
- verify_number($magic_level, 'Magic_level', 11);
- $mana = $_POST['mana'];
- verify_number($mana, 'Mana', 11);
- $mana_max = $_POST['mana_max'];
- verify_number($mana_max, 'Mana max', 11);
- $mana_spent = $_POST['mana_spent'];
- verify_number($mana_spent, 'Mana spent', 11);
+ // mana
+ $magic_level = $_POST['magic_level'];
+ verify_number($magic_level, 'Magic_level', 11);
+ $mana = $_POST['mana'];
+ verify_number($mana, 'Mana', 11);
+ $mana_max = $_POST['mana_max'];
+ verify_number($mana_max, 'Mana max', 11);
+ $mana_spent = $_POST['mana_spent'];
+ verify_number($mana_spent, 'Mana spent', 11);
- // look
- $look_body = $_POST['look_body'];
- verify_number($look_body, 'Look body', 11);
- $look_feet = $_POST['look_feet'];
- verify_number($look_feet, 'Look feet', 11);
- $look_head = $_POST['look_head'];
- verify_number($look_head, 'Look head', 11);
- $look_legs = $_POST['look_legs'];
- verify_number($look_legs, 'Look legs', 11);
- $look_type = $_POST['look_type'];
- verify_number($look_type, 'Look type', 11);
- if ($db->hasColumn('players', 'lookaddons')) {
- $look_addons = $_POST['look_addons'];
- verify_number($look_addons, 'Look addons', 11);
- }
+ // look
+ $look_body = $_POST['look_body'];
+ verify_number($look_body, 'Look body', 11);
+ $look_feet = $_POST['look_feet'];
+ verify_number($look_feet, 'Look feet', 11);
+ $look_head = $_POST['look_head'];
+ verify_number($look_head, 'Look head', 11);
+ $look_legs = $_POST['look_legs'];
+ verify_number($look_legs, 'Look legs', 11);
+ $look_type = $_POST['look_type'];
+ verify_number($look_type, 'Look type', 11);
+ if ($db->hasColumn('players', 'lookaddons')) {
+ $look_addons = $_POST['look_addons'];
+ verify_number($look_addons, 'Look addons', 11);
+ }
- // pos
- $pos_x = $_POST['pos_x'];
- verify_number($pos_x, 'Position x', 11);
- $pos_y = $_POST['pos_y'];
- verify_number($pos_y, 'Position y', 11);
- $pos_z = $_POST['pos_z'];
- verify_number($pos_z, 'Position z', 11);
+ // pos
+ $pos_x = $_POST['pos_x'];
+ verify_number($pos_x, 'Position x', 11);
+ $pos_y = $_POST['pos_y'];
+ verify_number($pos_y, 'Position y', 11);
+ $pos_z = $_POST['pos_z'];
+ verify_number($pos_z, 'Position z', 11);
- $soul = $_POST['soul'];
- verify_number($soul, 'Soul', 10);
- $town = $_POST['town'];
- verify_number($town, 'Town', 11);
+ $soul = $_POST['soul'];
+ verify_number($soul, 'Soul', 10);
+ $town = $_POST['town'];
+ verify_number($town, 'Town', 11);
- $capacity = $_POST['capacity'];
- verify_number($capacity, 'Capacity', 11);
- $sex = $_POST['sex'];
- verify_number($sex, 'Sex', 1);
+ $capacity = $_POST['capacity'];
+ verify_number($capacity, 'Capacity', 11);
+ $sex = $_POST['sex'];
+ verify_number($sex, 'Sex', 1);
- $lastlogin = $_POST['lastlogin'];
- verify_number($lastlogin, 'Last login', 20);
- $lastlogout = $_POST['lastlogout'];
- verify_number($lastlogout, 'Last logout', 20);
- /* $lastip = $_POST['lastip'];
- $exp = explode(".", $lastip);
- $lastip = $exp[3] . '.' . $exp[2] . '.' . $exp[1] . '.' . $exp[0];
- $lastip_length = strlen($lastip);
- if ($lastip_length <= 0 || $lastip_length > 15)
- echo_error('IP cannot be longer than 15 digits.');
- */
+ $lastlogin = $_POST['lastlogin'];
+ verify_number($lastlogin, 'Last login', 20);
+ $lastlogout = $_POST['lastlogout'];
+ verify_number($lastlogout, 'Last logout', 20);
+ /* $lastip = $_POST['lastip'];
+ $exp = explode(".", $lastip);
+ $lastip = $exp[3] . '.' . $exp[2] . '.' . $exp[1] . '.' . $exp[0];
+ $lastip_length = strlen($lastip);
+ if ($lastip_length <= 0 || $lastip_length > 15)
+ echo_error('IP cannot be longer than 15 digits.');
+ */
- $skull = $_POST['skull'];
- verify_number($skull, 'Skull', 1);
- $skull_time = $_POST['skull_time'];
- verify_number($skull_time, 'Skull time', 11);
+ $skull = $_POST['skull'];
+ verify_number($skull, 'Skull', 1);
+ $skull_time = $_POST['skull_time'];
+ verify_number($skull_time, 'Skull time', 11);
- if ($db->hasColumn('players', 'loss_experience')) {
- $loss_experience = $_POST['loss_experience'];
- verify_number($loss_experience, 'Loss experience', 11);
- $loss_mana = $_POST['loss_mana'];
- verify_number($loss_mana, 'Loss mana', 11);
- $loss_skills = $_POST['loss_skills'];
- verify_number($loss_skills, 'Loss skills', 11);
- $loss_containers = $_POST['loss_containers'];
- verify_number($loss_containers, 'Loss loss_containers', 11);
- $loss_items = $_POST['loss_items'];
- verify_number($loss_items, 'Loss items', 11);
- }
- if ($db->hasColumn('players', 'offlinetraining_time')) {
- $offlinetraining = $_POST['offlinetraining'];
- verify_number($offlinetraining, 'Offline Training time', 11);
- }
+ if ($db->hasColumn('players', 'loss_experience')) {
+ $loss_experience = $_POST['loss_experience'];
+ verify_number($loss_experience, 'Loss experience', 11);
+ $loss_mana = $_POST['loss_mana'];
+ verify_number($loss_mana, 'Loss mana', 11);
+ $loss_skills = $_POST['loss_skills'];
+ verify_number($loss_skills, 'Loss skills', 11);
+ $loss_containers = $_POST['loss_containers'];
+ verify_number($loss_containers, 'Loss loss_containers', 11);
+ $loss_items = $_POST['loss_items'];
+ verify_number($loss_items, 'Loss items', 11);
+ }
+ if ($db->hasColumn('players', 'offlinetraining_time')) {
+ $offlinetraining = $_POST['offlinetraining'];
+ verify_number($offlinetraining, 'Offline Training time', 11);
+ }
- if ($db->hasColumn('players', 'blessings')) {
- $blessings = $_POST['blessings'];
- verify_number($blessings, 'Blessings', 2);
- }
- $balance = $_POST['balance'];
- verify_number($balance, 'Balance', 20);
- if ($db->hasColumn('players', 'stamina')) {
- $stamina = $_POST['stamina'];
- verify_number($stamina, 'Stamina', 20);
- }
+ if ($db->hasColumn('players', 'blessings')) {
+ $blessings = $_POST['blessings'];
+ verify_number($blessings, 'Blessings', 2);
+ }
+ $balance = $_POST['balance'];
+ verify_number($balance, 'Balance', 20);
+ if ($db->hasColumn('players', 'stamina')) {
+ $stamina = $_POST['stamina'];
+ verify_number($stamina, 'Stamina', 20);
+ }
- $deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
- $hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
+ $deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
+ $hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
- $created = $_POST['created'];
- verify_number($created, 'Created', 11);
+ $created = $_POST['created'];
+ verify_number($created, 'Created', 11);
- $comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL;
+ $comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'], 0, 2000))) : NULL;
- foreach ($_POST['skills'] as $skill => $value)
- verify_number($value, $skills[$skill][0], 10);
- foreach ($_POST['skills_tries'] as $skill => $value)
- verify_number($value, $skills[$skill][0] . ' tries', 10);
+ foreach ($_POST['skills'] as $skill => $value)
+ verify_number($value, $skills[$skill][0], 10);
+ foreach ($_POST['skills_tries'] as $skill => $value)
+ verify_number($value, $skills[$skill][0] . ' tries', 10);
- if (!$error) {
- $player->setName($name);
- $player->setAccount($account_db);
- $player->setGroup($groups->getGroup($group));
- $player->setLevel($level);
- $player->setExperience($experience);
- $player->setVocation($vocation);
- $player->setHealth($health);
- $player->setHealthMax($health_max);
- $player->setMagLevel($magic_level);
- $player->setMana($mana);
- $player->setManaMax($mana_max);
- $player->setManaSpent($mana_spent);
- $player->setLookBody($look_body);
- $player->setLookFeet($look_feet);
- $player->setLookHead($look_head);
- $player->setLookLegs($look_legs);
- $player->setLookType($look_type);
- if ($db->hasColumn('players', 'lookaddons'))
- $player->setLookAddons($look_addons);
- if ($db->hasColumn('players', 'offlinetraining_time'))
- $player->setCustomField('offlinetraining_time', $offlinetraining);
- $player->setPosX($pos_x);
- $player->setPosY($pos_y);
- $player->setPosZ($pos_z);
- $player->setSoul($soul);
- $player->setTownId($town);
- $player->setCap($capacity);
- $player->setSex($sex);
- $player->setLastLogin($lastlogin);
- $player->setLastLogout($lastlogout);
- //$player->setLastIP(ip2long($lastip));
- $player->setSkull($skull);
- $player->setSkullTime($skull_time);
- if ($db->hasColumn('players', 'loss_experience')) {
- $player->setLossExperience($loss_experience);
- $player->setLossMana($loss_mana);
- $player->setLossSkills($loss_skills);
- $player->setLossContainers($loss_containers);
- $player->setLossItems($loss_items);
- }
- if ($db->hasColumn('players', 'blessings'))
- $player->setBlessings($blessings);
- $player->setBalance($balance);
- if ($db->hasColumn('players', 'stamina'))
- $player->setStamina($stamina);
- if ($db->hasColumn('players', 'deletion'))
- $player->setCustomField('deletion', $deleted ? '1' : '0');
- else
- $player->setCustomField('deleted', $deleted ? '1' : '0');
- $player->setCustomField('hidden', $hidden ? '1' : '0');
- $player->setCustomField('created', $created);
- if (isset($comment))
- $player->setCustomField('comment', $comment);
+ if (!$error) {
+ $player->setName($name);
+ $player->setAccount($account_db);
+ $player->setGroup($groups->getGroup($group));
+ $player->setLevel($level);
+ $player->setExperience($experience);
+ $player->setVocation($vocation);
+ $player->setHealth($health);
+ $player->setHealthMax($health_max);
+ $player->setMagLevel($magic_level);
+ $player->setMana($mana);
+ $player->setManaMax($mana_max);
+ $player->setManaSpent($mana_spent);
+ $player->setLookBody($look_body);
+ $player->setLookFeet($look_feet);
+ $player->setLookHead($look_head);
+ $player->setLookLegs($look_legs);
+ $player->setLookType($look_type);
+ if ($db->hasColumn('players', 'lookaddons'))
+ $player->setLookAddons($look_addons);
+ if ($db->hasColumn('players', 'offlinetraining_time'))
+ $player->setCustomField('offlinetraining_time', $offlinetraining);
+ $player->setPosX($pos_x);
+ $player->setPosY($pos_y);
+ $player->setPosZ($pos_z);
+ $player->setSoul($soul);
+ $player->setTownId($town);
+ $player->setCap($capacity);
+ $player->setSex($sex);
+ $player->setLastLogin($lastlogin);
+ $player->setLastLogout($lastlogout);
+ //$player->setLastIP(ip2long($lastip));
+ $player->setSkull($skull);
+ $player->setSkullTime($skull_time);
+ if ($db->hasColumn('players', 'loss_experience')) {
+ $player->setLossExperience($loss_experience);
+ $player->setLossMana($loss_mana);
+ $player->setLossSkills($loss_skills);
+ $player->setLossContainers($loss_containers);
+ $player->setLossItems($loss_items);
+ }
+ if ($db->hasColumn('players', 'blessings'))
+ $player->setBlessings($blessings);
+ $player->setBalance($balance);
+ if ($db->hasColumn('players', 'stamina'))
+ $player->setStamina($stamina);
+ if ($db->hasColumn('players', 'deletion'))
+ $player->setCustomField('deletion', $deleted ? '1' : '0');
+ else
+ $player->setCustomField('deleted', $deleted ? '1' : '0');
+ $player->setCustomField('hidden', $hidden ? '1' : '0');
+ $player->setCustomField('created', $created);
+ if (isset($comment))
+ $player->setCustomField('comment', $comment);
- foreach ($_POST['skills'] as $skill => $value) {
- $player->setSkill($skill, $value);
- }
- foreach ($_POST['skills_tries'] as $skill => $value) {
- $player->setSkillTries($skill, $value);
- }
- $player->save();
- echo_success('Player saved at: ' . date('G:i'));
- }
- }
+ foreach ($_POST['skills'] as $skill => $value) {
+ $player->setSkill($skill, $value);
+ }
+ foreach ($_POST['skills_tries'] as $skill => $value) {
+ $player->setSkillTries($skill, $value);
+ }
+ $player->save();
+ echo_success('Player saved at: ' . date('G:i'));
+ }
+ }
}
$search_name = '';
if (isset($_REQUEST['search_name']))
- $search_name = $_REQUEST['search_name'];
+ $search_name = $_REQUEST['search_name'];
else if ($id > 0 && isset($player) && $player->isLoaded())
- $search_name = $player->getName();
+ $search_name = $player->getName();
?>
- isLoaded()) {
- $account = $player->getAccount();
- ?>
+ isLoaded()) {
+ $account = $player->getAccount();
+ ?>
-