First public release of MyAAC

This commit is contained in:
slawkens1
2017-05-01 20:02:45 +02:00
parent 31172b4883
commit b5362d0654
2016 changed files with 114481 additions and 0 deletions

1
system/pages/.htaccess Normal file
View File

@@ -0,0 +1 @@
deny from all

17
system/pages/404.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
/**
* 404 error page
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = '404 Not Found';
header('HTTP/1.0 404 Not Found');
?>
<h1>Not Found</h1>
<p>The requested URL <?php echo $_SERVER['REQUEST_URI']; ?> was not found on this server.</p>

25
system/pages/account.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
/**
* Account confirm mail
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Account';
if($action == 'confirm_email')
{
$res = $db->query('SELECT email_hash FROM accounts WHERE email_hash = ' . $db->quote($_GET['v']));
if(!$res->rowCount())
echo '<div class="note">Your email couldn\'t be verified. Please contact staff to do it manually.</div>';
else
{
$db->update('accounts', array('email_verified' => '1'), array('email_hash' => $_GET['v']));
echo '<div class="success">You have now verified your e-mail, this will increase the security of your account. Thank you for doing this.</div>';
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
deny from all

View File

@@ -0,0 +1,27 @@
<?php
/**
* Changelog
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'MyAAC - CHANGELOG';
$data = file_get_contents(SYSTEM . 'docs/CHANGELOG');
// replace special characters with HTML entities
// replace line breaks with <br />
$data = nl2br(htmlspecialchars($data));
// replace multiple spaces with single spaces
$data = preg_replace('/\s\s+/', ' ', $data);
// replace URLs with <a href...> elements
$data = preg_replace('/\s(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_blank">\\1\\2</a>', $data);
echo '<div>' . $data . '</div>';
?>

View File

@@ -0,0 +1,64 @@
<?php
/**
* Dashboard
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Dashboard';
?>
<div>
<?php if($status['online']): ?>
<p class="success" style="width: 150px; text-align: center;">Status: Online<br/>
<?php echo $status['uptimeReadable'] . ', ' . $status['players'] . '/' . $status['playersMax']; ?><br/>
<?php echo $config['lua']['ip'] . ' : ' . $config['lua']['loginPort']; ?>
<br/><br/><u><a id="more-button" href="#"></a></u>
<span id="status-more">
<br/>
<b>Server</b>:<br/> <?php echo $status['server'] . ' ' . $status['serverVersion']; ?><br/>
<b>Version</b>: <?php echo $status['clientVersion']; ?><br/><br/>
<b>Monsters</b>: <?php echo $status['monsters']; ?><br/>
<b>Map</b>: <?php echo $status['mapName']; ?>, <b>author</b>: <?php echo $status['mapAuthor']; ?>, <b>size</b>: <?php echo $status['mapWidth'] . ' x ' . $status['mapHeight']; ?><br/>
<b>MOTD</b>:<br/> <?php echo $status['motd']; ?><br/><br/>
<b>Last updated</b>: <?php echo date("H:i:s", $status['lastCheck']); ?>
</span>
</p>
<?php else: ?>
<p class="error" style="width: 120px; text-align: center;">Status: Offline</p>
<?php endif; ?>
</div>
<!--div>
Version: <?php echo MYAAC_VERSION; ?> (<a id="update" href="#">Check for updates</a>)
</div-->
<?php if($status['online']): ?>
<script type="text/javascript">
var hidden = false;
$(document).ready(function() {
$("#status-more").hide();
$("#more-button").text("More");
hidden = true;
});
$("#more-button").click(function() {
if(hidden) {
$("#more-button").text("Hide");
$("#status-more").show();
hidden = false;
}
else {
$("#more-button").text("More");
$("#status-more").hide();
hidden = true;
}
return false;
});
</script>
<?php endif; ?>

View File

@@ -0,0 +1,32 @@
<?php
/**
* Login
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Login';
if($action == 'logout')
echo 'You have been logout.<br/>';
if(isset($errors)) {
foreach($errors as $error) {
error($error);
}
}
?>
Please login.
<form method="post">
<input type="password" name="account_login" id="account-name-input" size="30" maxlength="30" autofocus/><br/>
<input type="password" name="password_login" size="30" maxlength="29"/><br/>
<input type="checkbox" id="remember_me" name="remember_me" value="true"/>
<label for="remember_me"> Remember me</label><br/>
<input type="hidden" name="admin" value="1"/>
<input type="submit" class="button" value="Login"/>
</form>

View File

@@ -0,0 +1,78 @@
<?php
/**
* Logs
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Logs viewer';
?>
<table class="table" width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<th><b>Log name</b></td>
<th><b>Last updated</b></td>
</tr>
<?php
$files = array();
$aac_path_logs = BASE . 'system/logs/';
foreach(scandir($aac_path_logs) as $f) {
if($f[0] == '.' || $f == '..' || is_dir($aac_path_logs . $f))
continue;
$files[] = array($f, $aac_path_logs);
}
$server_path_logs = $config['data_path'] . 'logs/';
foreach(scandir($server_path_logs) as $f) {
if($f[0] == '.' || $f == '..')
continue;
if(is_dir($server_path_logs . $f)) {
foreach(scandir($server_path_logs . $f) as $f2) {
if($f2[0] == '.' || $f2 == '..')
continue;
$files[] = array($f . '/' . $f2, $server_path_logs);
}
continue;
}
$files[] = array($f, $server_path_logs);
}
$i = 0;
foreach($files as $f) {
?>
<tr>
<td><a href="<?php echo ADMIN_URL . '?p=logs&file=' . $f[0]; ?>"><?php echo $f[0]; ?></a></td>
<td><?php echo date("Y-m-d H:i:s", filemtime($f[1] . $f[0])); ?></td>
</tr>
<?php
}
?>
</table>
<?php
$file = isset($_GET['file']) ? $_GET['file'] : NULL;
if(!empty($file))
{
if(!preg_match('/[^A-z0-9\' _\/\-\.]/', $file))
{
if(file_exists($aac_path_logs . $file))
echo str_repeat('<br/>', 3) . '<b>' . $file . ':</b><br/><br/>' . nl2br(file_get_contents($aac_path_logs . $file));
else if(file_exists($server_path_logs . $file))
echo str_repeat('<br/>', 3) . '<b>' . $file . ':</b><br/><br/>' . nl2br(file_get_contents($server_path_logs . $file));
else
echo 'Specified file does not exist.';
}
else
echo 'Invalid file name specified.';
}
?>

View File

@@ -0,0 +1,111 @@
<?php
/**
* Mailer
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Mailer';
if(!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin())
{
echo 'Access denied.';
return;
}
if(!$config['mail_enabled'])
{
echo 'Mail support disabled.';
return;
}
$mail_content = isset($_POST['mail_content']) ? stripslashes($_POST['mail_content']) : NULL;
$mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subject']) : NULL;
$preview = isset($_REQUEST['preview']);
$preview_done = false;
if($preview) {
if(!empty($mail_content) && !empty($mail_subject))
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
if(!$preview_done)
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
}
?>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
relative_urls : false,
remove_script_host : false,
document_base_url : "<?php echo BASE_URL; ?>",
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
</script>
<table width="800" cellspacing="1" cellpadding="2" border="0" align="center">
<form method="post">
<tr>
<td colspan="2" align="center">
<p class="note note-image" style="width: 80%;">Sending mails may take some time if there are much users in db.</p>
</td>
</tr>
<tr>
<td align="right">
<label for="mail_subject">Subject:</label>
</td>
<td align="left">
<input type="text" id="mail_subject" name="mail_subject" value="<?php echo $mail_subject; ?>" size="30" maxlength="30" />
</td>
</tr>
<tr>
<td colspan="2">
<textarea id="mail_content" name="mail_content" style="width: 100%" class="tinymce"><?php echo $mail_content; ?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="checkbox" name="preview" id="preview" value="1"/><label for="preview">Just send test email to me (preview)</label><?php echo ($preview_done ? ' - <b>Done.</b>' : ''); ?><br/><input type="submit" name="submit" value="Send" />
</td>
</tr>
</form>
</table>
<?php
if(empty($mail_content) || empty($mail_subject) || $preview)
return;
$success = 0;
$failed = 0;
$add = '';
if($config['account_mail_verify'])
$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))
$success++;
else
{
$failed++;
echo '<br />';
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. Error: ' . $mailer->ErrorInfo);
}
}
?>
Mailing finished.<br/>
<p class="success"><?php echo $success; ?> emails delivered.</p><br/>
<p class="warning"><?php echo $failed; ?> emails failed.</p></br>

View File

@@ -0,0 +1,108 @@
<?php
/**
* Notepad
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Notepad';
$notepad_content = Notepad::get($account_logged->getId());
if(isset($_POST['content']))
{
$_content = html_entity_decode(stripslashes($_POST['content']));
if(!$notepad_content)
Notepad::create($account_logged->getId(), $_content);
else
Notepad::update($account_logged->getId(), $_content);
echo '<div class="success" style="text-align: center;">Saved at ' . date('g:i A') . '</div>';
}
else
{
if($notepad_content !== false)
$_content = $notepad_content;
}
?>
<table width="700" cellspacing="1" cellpadding="2" border="0" align="center">
<form method="post">
<tr>
<td align="center">
<p>This is your personal notepad. Be sure to save it each time you modify something.</p>
</td>
</tr>
<tr>
<td align="center">
<textarea style="text-align: left;" name="content" cols="50" rows="15" onchange="notepad_onchange(this);"><?php echo isset($_content) ? htmlentities($_content, ENT_COMPAT, 'UTF-8') : ''; ?></textarea>
</td>
</tr>
<tr>
<td align="center">
<input type="submit" name="submit" onclick="notepad_save(this);" value="Save" />
</td>
</tr>
</form>
</table>
<?php
// confirm leaving current page if content of the notepad has been modified
?>
<script type="text/javascript">
var original_value = document.getElementsByName("content")[0].value;
function confirm_exit(e) {
var e = e || window.event;
var message = 'Are you sure you want to quit? Remaining changes will be unsaved.';
// for IE and Firefox prior to version 4
if (e) {
e.returnValue = message;
}
// for Safari
return message;
};
function notepad_onchange(e) {
if(original_value != e.value) {
window.onbeforeunload = confirm_exit;
}
return true;
};
function notepad_save(e) {
window.onbeforeunload = function(e) {};
return true;
};
</script>
<?php
class Notepad
{
static public function get($account_id)
{
global $db;
$query = $db->select(TABLE_PREFIX . 'notepad', array('account_id' => $account_id));
if($query !== false)
return $query['content'];
return false;
}
static public function create($account_id, $content = '')
{
global $db;
$db->insert(TABLE_PREFIX . 'notepad', array('account_id' => $account_id, 'content' => $content));
}
static public function update($account_id, $content = '')
{
global $db;
$db->update(TABLE_PREFIX . 'notepad', array('content' => $content), array('account_id' => $account_id));
}
}

View File

@@ -0,0 +1,294 @@
<?php
/**
* Pages
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Pages';
if(!hasFlag(FLAG_CONTENT_PAGES) && !superAdmin())
{
echo 'Access denied.';
return;
}
$name = $p_title = '';
$groups = new OTS_Groups_List();
$php = false;
$access = 0;
if(!empty($action))
{
if($action == 'delete' || $action == 'edit' || $action == 'hide')
$id = $_REQUEST['id'];
if(isset($_REQUEST['name']))
$name = $_REQUEST['name'];
if(isset($_REQUEST['title']))
$p_title = $_REQUEST['title'];
$php = isset($_REQUEST['php']);
//if($php)
// $body = $_REQUEST['body'];
//else
if(isset($_REQUEST['body']))
$body = html_entity_decode(stripslashes($_REQUEST['body']));
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))
{
$name = $p_title = $body = '';
$player_id = $access = 0;
$php = false;
}
}
else if($action == 'delete') {
Pages::delete($id, $errors);
}
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 {
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') {
Pages::toggleHidden($id, $errors);
}
if(!empty($errors))
output_errors($errors);
}
?>
<?php
$use_tinymce = false;
//if($action != 'edit' || !$php)
// $use_tinymce = true;
if($use_tinymce): ?>
<script type="text/javascript" src="tools/tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
$(function() {
$('#news-body').tinymce({
script_url : 'tools/tiny_mce/tiny_mce.js',
forced_root_block : false,
theme : "advanced",
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
<?php /*if($action != 'edit'): ?>
$("#page-edit-table").hide();
$("#page-button").click(function() {
$("#page-edit-table").toggle();
return false;
});
<?php endif; */ ?>
});
</script>
<!--script type="text/javascript">
tinyMCE.init({
forced_root_block : false,
mode : "textareas",
theme : "advanced",
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
</script-->
<?php endif; ?>
<form method="post" action="?p=pages&action=<?php echo ($action == 'edit' ? 'edit' : 'add'); ?>">
<?php if($action == 'edit'): ?>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<?php endif; ?>
<table class="table" id="page-edit-table" width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<th><b><?php echo ($action == 'edit' ? 'Edit' : 'Add'); ?> page</b></th>
</tr>
<tr>
<td>
<table border="0" cellpadding="1">
<tr>
<td>Link/name:</td>
<td><input name="name" value="<?php echo $name; ?>" size="29" maxlength="29"/></td>
</tr>
<tr>
<td>Title:</td>
<td><input name="title" value="<?php echo $p_title; ?>" size="29" maxlength="29"/></td>
</tr>
<tr>
<td>PHP:</td>
<td><input type="checkbox" id="news-checkbox" name="php" title="Check if page should be executed as PHP" value="1" <?php if($php) echo 'checked="true"'; ?>/></td>
</tr>
<tr>
<td>Content:</td>
<td>
<textarea id="news-body" name="body" maxlength="65000" <?php /*if($use_tinymce) echo 'class="tinymce"';*/ ?> cols="50" rows="5"><?php echo htmlentities(isset($body) ? $body : '', ENT_COMPAT, 'UTF-8'); ?></textarea>
<?php if($use_tinymce): ?>
<br/>
<a href="javascript:;" onmousedown="$('#news-body').tinymce().hide();">[Hide]</a>
<a href="javascript:;" onmousedown="$('#news-body').tinymce().show();">[Show]</a>
<?php endif; ?>
</td>
<tr/>
<tr>
<td>Access:</td>
<td>
<select name="access">
<?php foreach($groups->getGroups() as $id => $group): ?>
<option value="<?php echo $group->getAccess(); ?>" <?php echo ($access == $group->getAccess() ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<td align="right"><input type="submit" class="button" value="Save"/></td>
<td align="left">
<input type="button" onclick="window.location = '<?php echo getPageLink(PAGE) . ($config['friendly_urls'] ? '?' : '&'); ?>p=pages';" class="button" value="Cancel"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<table class="table" width="100%" cellspacing="1" cellpadding="4">
<tr>
<th><b>Name</b></th>
<th><b>Title</b></th>
<th><b>Options</b></th>
</tr>
<?php
$pages =
$db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'pages'));
$i = 0;
foreach($pages as $_page): ?>
<tr>
<td><?php echo getLink($_page['name'], $_page['name']); ?></td>
<td><i><?php echo substr($_page['title'], 0, 20); ?></i></td>
<td>
<a href="?p=pages&action=edit&id=<?php echo $_page['id']; ?>" class="ico" title="Edit">
<img src="<?php echo BASE_URL; ?>images/edit.png"/>
Edit
</a>
<a href="<?php echo ADMIN_URL; ?>?p=pages&action=delete&id=<?php echo $_page['id']; ?>" class="ico" onclick="return confirm('Are you sure?');" title="Delete">
<img src="<?php echo BASE_URL; ?>images/del.png"/>
Delete
</a>
<a href="?p=pages&action=hide&id=<?php echo $_page['id']; ?>" class="ico" title="<?php echo ($_page['hidden'] != 1 ? 'Hide' : 'Show'); ?>">
<img src="<?php echo BASE_URL; ?>images/<?php echo ($_page['hidden'] != 1 ? 'success' : 'error'); ?>.png"/>
<?php echo ($_page['hidden'] != 1 ? 'Hide' : 'Show'); ?>
</a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php
class Pages
{
static public function get($id)
{
global $db;
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
if($query !== false)
return $query;
return false;
}
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)
{
$query = $db->select(TABLE_PREFIX . 'pages', array('name' => $name));
if($query === false)
$db->insert(TABLE_PREFIX . 'pages', array('name' => $name, 'title' => $title, 'body' => $body, 'player_id' => $player_id, 'php' => $php, 'access' => $access));
else
$errors[] = 'Page with this words already exists.';
}
else
$errors[] = 'Please fill all inputs.';
return !count($errors);
}
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));
}
static public function delete($id, &$errors)
{
global $db;
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
$errors[] = 'id not set';
return !count($errors);
}
static public function toggleHidden($id, &$errors)
{
global $db;
if(isset($id))
{
$query = $db->select(TABLE_PREFIX . 'pages', array('id' => $id));
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
$errors[] = 'id not set';
return !count($errors);
}
}
?>

View File

@@ -0,0 +1,20 @@
<?php
/**
* PHP Info
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'PHP Info';
if(!function_exists('phpinfo')) { ?>
<b>phpinfo()</b> function is disabled in your webserver config.<br/>
You can enable it by editing <b>php.ini</b> file.
<?php return;
}
?>
<iframe src="<?php echo BASE_URL; ?>admin/tools/phpinfo.php" width="1024" height="550" />

View File

@@ -0,0 +1,568 @@
<?php
/**
* Players editor
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Player editor';
$base = BASE_URL . 'admin/?p=players';
function echo_success($message) {
echo '<p class="success">' . $message . '</p>';
}
function echo_error($message) {
global $error;
echo '<p class="error">' . $message . '</p>';
$error = true;
}
function verify_number($number, $name, $max_length) {
if(!check_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.');
}
$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')
);
?>
<link rel="stylesheet" type="text/css" href="<?php echo BASE_URL; ?>tools/jquery.datetimepicker.css"/ >
<script src="<?php echo BASE_URL; ?>tools/jquery.datetimepicker.js"></script>
<?php
$id = 0;
if(isset($_REQUEST['id']))
$id = (int)$_REQUEST['id'];
else if(isset($_REQUEST['search_name'])) {
if(strlen($_REQUEST['search_name']) < 3 && !check_number($_REQUEST['search_name'])) {
echo 'Player name is too short.';
}
else {
if(check_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?<ul>';
foreach($query as $row)
echo '<li><a href="' . $base . '&id=' . $row['id'] . '">' . $row['name'] . '</a></li>';
echo '</ul>';
}
else if($query->rowCount() > 10)
echo 'Specified name resulted with too many players.';
}
}
}
}
$groups = new OTS_Groups_List();
if($id > 0) {
$player = $ots->createObject('Player');
$player->load($id);
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.');
$name = $_POST['name'];
$_error = '';
if(!check_name($name, $_error))
echo_error($_error);
//if(!check_name_new_char($name))
// echo_error('This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.');
$player_db = $ots->createObject('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_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');
$level = $_POST['level'];
verify_number($level, 'Level', 11);
$experience = $_POST['experience'];
verify_number($experience, 'Experience', 20);
$vocation = $_POST['vocation'];
verify_number($vocation, 'Vocation id', 1);
// 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);
// 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);
$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);
$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);
$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);
if(fieldExist('loss_experience', 'players')) {
$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);
}
$blessings = $_POST['blessings'];
verify_number($blessings, 'Blessings', 2);
$balance = $_POST['balance'];
verify_number($balance, 'Balance', 20);
$stamina = $_POST['stamina'];
verify_number($stamina, 'Stamina', 20);
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true');
$created = $_POST['created'];
verify_number($created, 'Created', 11);
$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);
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);
$player->setLookAddons($look_addons);
$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(fieldExist('loss_experience', 'players')) {
$player->setLossExperience($loss_experience);
$player->setLossMana($loss_mana);
$player->setLossSkills($loss_skills);
$player->setLossContainers($loss_containers);
$player->setLossItems($loss_items);
}
$player->setBlessings($blessings);
$player->setBalance($balance);
$player->setStamina($stamina);
if(fieldExist('deletion', 'players'))
$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'));
}
}
}
$search_name = '';
if(isset($_REQUEST['search_name']))
$search_name = $_REQUEST['search_name'];
else if($id > 0 && isset($player) && $player->isLoaded())
$search_name = $player->getName();
?>
<form action="<?php echo $base; ?>" method="post">
<input type="text" name="search_name" value="<?php echo $search_name; ?>" maxlength="32" size="32" />
<input type="submit" class="button" value="Search" />
</form>
<?php
if(!isset($player) || !$player->isLoaded())
return;
$account = $player->getAccount();
?>
<br/><br/>
<form action="<?php echo $base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<table class="table" cellspacing="1" cellpadding="4">
<tr><th colspan="2">Edit player</th></tr>
<tr>
<td>Name: </td>
<td><input type="text" name="name" value="<?php echo $player->getName(); ?>" /></td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Account id: </td>
<td><input type="text" name="account_id" size="8" maxlength="11" value="<?php echo $account->getId(); ?>" /></td>
<td>Group: </td>
<td>
<select name="group">
<?php foreach($groups->getGroups() as $id => $group): ?>
<option value="<?php echo $id; ?>" <?php echo ($player->getGroup()->getId() == $id ? 'selected' : ''); ?>><?php echo $group->getName(); ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Level: </td>
<td><input type="text" name="level" size="8" maxlength="11" value="<?php echo $player->getLevel(); ?>" /></td>
<td>Experience: </td>
<td><input type="text" name="experience" size="19" maxlength="20" value="<?php echo $player->getExperience(); ?>" /></td>
<td>Health:</td>
<td><input type="text" name="health" size="5" maxlength="11" value="<?php echo $player->getHealth(); ?>" /></td>
<td>Health max:</td>
<td><input type="text" name="health_max" size="5" maxlength="11" value="<?php echo $player->getHealthMax(); ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Vocation: </td>
<td>
<select name="vocation">
<?php
$i = 0;
foreach($config['vocations'] as $voc)
{
echo '<option value=' . $i;
if($i == $player->getVocation())
echo ' selected="selected"';
echo '>' . $voc . '</option>';
$i++;
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Magic level:</td>
<td><input type="text" name="magic_level" size="8" maxlength="11" value="<?php echo $player->getMagLevel(); ?>" /></td>
<td>Mana:</td>
<td><input type="text" name="mana" size="3" maxlength="11" value="<?php echo $player->getMana(); ?>" /></td>
<td>Mana max:</td>
<td><input type="text" name="mana_max" size="3" maxlength="11" value="<?php echo $player->getManaMax(); ?>" /></td>
<td>Mana spent:</td>
<td><input type="text" name="mana_spent" size="3" maxlength="11" value="<?php echo $player->getManaSpent(); ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Look: </td>
<td>
Body:<input type="text" name="look_body" size="2" maxlength="11" value="<?php echo $player->getLookBody(); ?>" />
Feet:<input type="text" name="look_feet" size="2" maxlength="11" value="<?php echo $player->getLookFeet(); ?>" />
Head:<input type="text" name="look_head" size="2" maxlength="11" value="<?php echo $player->getLookHead(); ?>" />
Legs:<input type="text" name="look_legs" size="2" maxlength="11" value="<?php echo $player->getLookLegs(); ?>" />
Type:<input type="text" name="look_type" size="2" maxlength="11" value="<?php echo $player->getLookType(); ?>" />
Addons:<input type="text" name="look_addons" size="2" maxlength="11" value="<?php echo $player->getLookAddons(); ?>" />
</td>
</tr>
<tr>
<td>Position: </td>
<td>
X: <input type="text" name="pos_x" size="8" maxlength="11" value="<?php echo $player->getPosX(); ?>" />
Y: <input type="text" name="pos_y" size="8" maxlength="11" value="<?php echo $player->getPosY(); ?>" />
Z: <input type="text" name="pos_z" size="8" maxlength="11" value="<?php echo $player->getPosZ(); ?>" />
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Soul:</td>
<td><input type="text" name="soul" size="8" maxlength="10" value="<?php echo $player->getSoul(); ?>" /></td>
<td>Town:</td>
<td>
<select name="town">
<?php foreach($config['towns'] as $id => $town): ?>
<option value="<?php echo $id; ?>" <?php echo ($player->getTownId() == $id ? 'selected' : ''); ?>><?php echo $town; ?></option>
<?php endforeach; ?>
</select>
</td>
<td>Capacity:</td>
<td><input type="text" name="capacity" size="8" maxlength="11" value="<?php echo $player->getCap(); ?>" /></td>
<td>Sex:</td>
<td>
<select name="sex">
<?php foreach(array('female', 'male') as $id => $sex): ?>
<option value="<?php echo $id; ?>" <?php echo ($player->getSex() == $id ? 'selected' : ''); ?>><?php echo $sex; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Last login:</td>
<td><input type="text" name="lastlogin" id="lastlogin" size="16" maxlength="20" value="<?php echo $player->getLastLogin(); ?>" /></td>
<td>Last logout:</td>
<td><input type="text" name="lastlogout" id="lastlogout" size="16" maxlength="20" value="<?php echo $player->getLastLogout(); ?>" /></td>
<td>Last IP:</td>
<td><input type="text" name="lastip" size="8" maxlength="10" value="<?php echo longToIp($player->getLastIP()); ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Skull:</td>
<td><input type="text" name="skull" size="1" maxlength="1" value="<?php echo $player->getSkull(); ?>" /></td>
<td>Skull time:</td>
<td><input type="text" name="skull_time" size="8" maxlength="11" value="<?php echo $player->getSkullTime(); ?>" /></td>
</tr>
</table>
</td>
</tr>
<?php if(fieldExist('loss_experience', 'players')): ?>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Loss experience:</td>
<td><input type="text" name="lost_experience" size="8" maxlength="11" value="<?php echo $player->getLossExperience(); ?>" /></td>
<td>Loss mana:</td>
<td><input type="text" name="lost_mana" size="8" maxlength="11" value="<?php echo $player->getLossMana(); ?>" /></td>
<td>Loss skills:</td>
<td><input type="text" name="lost_skills" size="8" maxlength="11" value="<?php echo $player->getLossSkills(); ?>" /></td>
<td>Loss containers:</td>
<td><input type="text" name="lost_containers" size="8" maxlength="11" value="<?php echo $player->getLossContainers(); ?>" /></td>
<td>Loss items:</td>
<td><input type="text" name="lost_items" size="8" maxlength="11" value="<?php echo $player->getLossItems(); ?>" /></td>
</tr>
</table>
</td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td>Blessings:</td>
<td><input type="text" name="blessings" size="2" maxlength="2" value="<?php echo $player->getBlessings(); ?>" /></td>
<td>Balance:</td>
<td><input type="text" name="balance" size="16" maxlength="20" value="<?php echo $player->getBalance(); ?>" /></td>
<td>Stamina:</td>
<td><input type="text" name="stamina" size="16" maxlength="20" value="<?php echo $player->getStamina(); ?>" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr style="background-color: transparent;">
<td><label for="deleted">Deleted:</label></td>
<td><input type="checkbox" name="deleted" id="deleted" value="true" <?php echo ($player->getCustomField(fieldExist('deletion', 'players') ? 'deletion' : 'deleted') == '1' ? ' checked' : ''); ?>/></td>
<td><label for="hidden">Hidden:</label></td>
<td><input type="checkbox" name="hidden" id="hidden" value="true" <?php echo ($player->getCustomField('hidden') == 1 ? ' checked' : ''); ?>/></td>
<td>Created:</td>
<td><input type="text" name="created" id="created" value="<?php echo $player->getCustomField('created'); ?>"/></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Comment: </td>
<td>
<textarea name="comment" rows="10" cols="50" wrap="virtual" ><?php echo $player->getCustomField("comment"); ?></textarea><br>[max. length: 2000 chars, 50 lines (ENTERs)]
</td>
</tr>
<tr>
<td colspan="2">
<table>
<?php
$i = 0;
foreach($skills as $id => $info) {
if($i == 0 || $i++ == 2) {
echo '<tr style="background-color: transparent;">';
$i = 0;
}
echo '
<td>' . $info[0] . '</td>
<td><input type="text" name="skills[' . $id . ']" size="8" maxlength="10" value="' . $player->getSkill($id) . '" /></td>
<td>' . $info[0] . ' tries</td>
<td><input type="text" name="skills_tries[' . $id . ']" size="8" maxlength="10" value="' . $player->getSkill($id) . '" /></td>';
if($i == 0)
echo '</tr>';
}
?>
</table>
</td>
</tr>
<input type="hidden" name="save" value="yes" />
<tr>
<td><input type="submit" class="button" value="Save" /></td>
<td><input type="cancel" onclick="window.location = '<?php echo ADMIN_URL; ?>&p=players';" class="button" value="Cancel" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
$('#lastlogin').datetimepicker({
format:'unixtime'
});
$('#lastlogout').datetimepicker({
format:'unixtime'
});
$('#created').datetimepicker({
format:'unixtime'
});
</script>

View File

@@ -0,0 +1,101 @@
<?php
/**
* Plugins
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Plugin manager';
?>
<form enctype="multipart/form-data" method="post">
<input type="hidden" name="upload_plugin" />
<table cellspacing="3" border="0">
<tr>
<td colspan="2">Install plugin:</td>
</tr>
<tr>
<td>
<input type="file" name="plugin" />
</td>
<td>
<input type="submit" value="Upload" />
</td>
</tr>
</table>
</form>
<br/><br/>
<?php
$message = '';
if(isset($_FILES["plugin"]["name"]))
{
$file = $_FILES["plugin"];
$filename = $file["name"];
$tmp_name = $file["tmp_name"];
$type = $file["type"];
$name = explode(".", $filename);
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
if(in_array($type, $accepted_types) && strtolower($name[1]) == 'zip') // check if it is zipped/compressed file
{
$targetdir = BASE;
$targetzip = BASE . 'plugins/' . $name[0] . '.zip';
if(move_uploaded_file($tmp_name, $targetzip)) { // move uploaded file
$zip = new ZipArchive();
$x = $zip->open($targetzip); // open the zip file to extract
if ($x === true) {
$zip->extractTo($targetdir); // place in the directory with same name
$zip->close();
unlink($targetzip); // delete the Zipped file
$string = file_get_contents(BASE . 'plugins/' . $name[0] . '.json');
$plugin_info = json_decode($string, true);
$message = '<p class="success"><strong>' . $plugin_info['name'] . '</strong> plugin has been successfully installed.</p>';
}
}
else
$message = '<p class="error">There was a problem with the upload. Please try again.</p>';
}
else
$message = '<p class="error">The file you are trying to upload is not a .zip file. Please try again.</p>';
}
echo $message;
?>
<b>Installed plugins:</b>
<table class="table" border="0" align="center">
<tr>
<th>Plugin name (Description on hover)</th>
<th>Filename</th>
<th>Version</th>
<th>Author</th>
<th>Contact</th>
<?php
$plugins = array();
$path = PLUGINS;
foreach(scandir($path) as $file)
{
$file_info = explode('.', $file);
if($file == '.' || $file == '..' || $file == 'disabled' || is_dir($file) || !$file_info[1] || $file_info[1] != 'json')
continue;
$string = file_get_contents(BASE . 'plugins/' . $file_info[0] . '.json');
$plugin_info = json_decode($string, true);
echo '<tr>
<td><div title="' . $plugin_info['description'] . '">' . $plugin_info['name'] . '</div></td>
<td>' . $file . '</td>
<td>' . $plugin_info['version'] . '</td>
<td>' . $plugin_info['author'] . '</td>
<td>' . $plugin_info['contact'] . '</td>
</tr>';
}
?>
</table>

View File

@@ -0,0 +1,60 @@
<?php
/**
* Statistics
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Statistics';
?>
<table>
<tr>
<td>
<table class="table">
<tr><th colspan="2">Statistics</th></tr>
<tr><td>Total accounts:</td>
<?php
$query = $db->query('SELECT count(*) as `how_much` FROM `accounts`;');
$query = $query->fetch();
echo '<td>' . $query['how_much'] . '</td></tr>';
?>
<tr><td>Total players:</td>
<?php
$query = $db->query('SELECT count(*) as `how_much` FROM `players`;');
$query = $query->fetch();
echo '<td>' . $query['how_much'] . '</td></tr>';
?>
<tr><td>Total guilds:</td>
<?php
$query = $db->query('SELECT count(*) as `how_much` FROM `guilds`;');
$query = $query->fetch();
echo '<td>' . $query['how_much'] . '</td></tr>';
?>
<tr><td>Total houses:</td>
<?php
$query = $db->query('SELECT count(*) as `how_much` FROM `houses`;');
$query = $query->fetch();
echo '<td>' . $query['how_much'] . '</td></tr>';
?>
</table>
</td>
<td>
<table class="table">
<tr><th colspan="3">TOP 10 - Most wealth accounts</th></tr>
<tr><th>#</th><th>Account name</th><th>Premium points</th></tr>
<?php
$query = $db->query('SELECT premium_points, name FROM accounts ORDER BY premium_points DESC LIMIT 10;');
$i = 0;
foreach($query as $result)
{
echo '<tr><td>' . ++$i . '.</td><td>' . $result['name'] . '</td><td>' . $result['premium_points'] . '</td></tr>';
}
?>
</table>
</td>
</tr>
</table>

View File

@@ -0,0 +1,30 @@
<?php
/**
* Tools
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Tools';
$tool = $_GET['tool'];
if(!isset($tool))
{
echo 'Tool not set.';
return;
}
if(preg_match("/[^A-z0-9_\-]/", $tool))
{
echo 'Invalid tool.';
return;
}
$file = BASE . 'admin/pages/tools/' . $tool . '.php';
if(!@file_exists($file))
require($file);
?>

View File

@@ -0,0 +1 @@
deny from all

View File

@@ -0,0 +1,40 @@
<?php
/**
* Version check
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Version check';
// fetch version
//$file = @fopen('http://my-aac.org/VERSION', 'r') or die('Error while fetching version.');
//$myaac_version = fgets($file);
$myaac_version = file_get_contents('http://my-aac.org/VERSION');
// compare them
if(version_compare($myaac_version, MYAAC_VERSION) <= 0)
echo '<p class="success">MyAAC latest version is ' . $myaac_version . '. You\'re using the latest version.</p>';
else
echo '<p class="warning">You\'re using outdated version.<br/>
Your version: <b>' . MYAAC_VERSION . '</b><br/>
Latest version: <b>' . $myaac_version . '</b><br/>
Download available at: <a href="http://my-aac.org" target="_blank">www.my-aac.org</a></p>';
/*
function version_revert($version)
{
$major = floor($version / 10000);
$version -= $major * 10000;
$minor = floor($version / 100);
$version -= $minor * 100;
$release = $version;
return $major . '.' . $minor . '.' . $release;
}*/
?>

View File

@@ -0,0 +1,53 @@
<?php
/**
* Visitors viewer
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Visitors';
if(!$config['visitors_counter']): ?>
Visitors counter is disabled.<br/>
You can enable it by editing this configurable in <b>config.local.php</b> file:<br/>
<p style="margin-left: 3em;"><b>$config['visitors_counter'] = true;</b></p>
<?php
return;
endif;
require(SYSTEM . 'libs/visitors.php');
$visitors = new Visitors($config['visitors_counter_ttl']);
?>
Users being active within last <?php echo $config['visitors_counter_ttl']; ?> minutes.<br/><br/>
<table class="table" width="100%" border="0">
<tr>
<th><b>IP</b></th>
<th><b>Last visit</b></th>
<th><b>Page</b></th>
</tr>
<?php
function compare($a, $b) {
return $a['lastvisit'] > $b['lastvisit'] ? -1 : 1;
}
$tmp = $visitors->getVisitors();
usort($tmp, 'compare');
$i = 0;
foreach($tmp as $visitor)
{
?>
<tr>
<td><?php echo $visitor['ip']; ?></td>
<td><?php echo date("H:i:s", $visitor['lastvisit']); ?></td>
<td><a href="<?php echo $visitor['page']; ?>"><?php echo substr($visitor['page'], 0, 50); ?></a></td>
</tr>
<?php
}
?>
</table>

206
system/pages/bans.php Normal file
View File

@@ -0,0 +1,206 @@
<?php
/**
* Bans
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Bans list';
if($config['otserv_version'] == TFS_02)
{
echo 'Bans page doesnt work on TFS 0.2/1.0.';
return;
}
if(!$config['bans_display_all'])
echo 'Last ' . $config['bans_limit'] . ' banishments.<br/><br/>';
if($config['bans_display_all'])
{
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
$offset = $_page * $config['bans_limit'] + 1;
}
$bans = $db->query('SELECT * FROM ' . $db->tableName('bans') . ' WHERE ' . $db->fieldName('active') . ' = 1 ORDER BY ' . $db->fieldName('added') . ' DESC LIMIT ' . ($config['bans_limit'] + 1) . (isset($offset) ? ' OFFSET ' . $offset : ''));
if(!$bans->rowCount())
{
?>
There are no banishments yet.
<?php
return;
}
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr align="center" bgcolor="<?php echo $config['vdarkborder']; ?>" class="white">
<td><font color="white"><b>Nick</b></font></td>
<td><font color="white"><b>Type</b></font></td>
<td><font color="white"><b>Expires</b></font></td>
<td><font color="white"><b>Reason</b></font></td>
<td><font color="white"><b>Comment</b></font></td>
<td><font color="white"><b>Added by:</b></font></td>
</tr>
<?php
foreach($bans as $ban)
{
if($i++ > 100)
{
$next_page = true;
break;
}
?>
<tr align="center" bgcolor="<?php echo getStyle($i); ?>">
<td height="50" width="140"><?php echo getPlayerLink(getPlayerNameByAccount($ban['value'])); ?></td>
<td><?php echo getBanType($ban['type']); ?></td>
<td>
<?php
if($ban['expires'] == "-1")
echo 'Never';
else
echo date("H:i:s", $ban['expires']) . '<br/>' . date("d M Y", $ban['expires']);
?>
</td>
<td><?php echo getBanReason($ban['reason']); ?></td>
<td><?php echo $ban['comment']; ?></td>
<td>
<?php
if($ban['admin_id'] == "0")
echo 'Autoban';
else
echo getPlayerLink(getPlayerNameByAccount($ban['admin_id']));
echo '<br/>' . date("d.m.Y", $ban['added']);
?>
</td>
</tr>
<?php
}
?>
</table>
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<?php
if($_page > 0)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=bans&page=' . ($_page - 1) . '" class="size_xxs">Previous Page</a></td></tr>';
if($next_page)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=bans&page=' . ($_page + 1) . '" class="size_xxs">Next Page</a></td></tr>';
?>
</table>
<?php
function getBanReason($reasonId)
{
switch($reasonId)
{
case 0:
return "Offensive Name";
case 1:
return "Invalid Name Format";
case 2:
return "Unsuitable Name";
case 3:
return "Name Inciting Rule Violation";
case 4:
return "Offensive Statement";
case 5:
return "Spamming";
case 6:
return "Illegal Advertising";
case 7:
return "Off-Topic Public Statement";
case 8:
return "Non-English Public Statement";
case 9:
return "Inciting Rule Violation";
case 10:
return "Bug Abuse";
case 11:
return "Game Weakness Abuse";
case 12:
return "Using Unofficial Software to Play";
case 13:
return "Hacking";
case 14:
return "Multi-Clienting";
case 15:
return "Account Trading or Sharing";
case 16:
return "Threatening Gamemaster";
case 17:
return "Pretending to Have Influence on Rule Enforcement";
case 18:
return "False Report to Gamemaster";
case 19:
return "Destructive Behaviour";
case 20:
return "Excessive Unjustified Player Killing";
case 21:
return "Invalid Payment";
case 22:
return "Spoiling Auction";
}
return "Unknown Reason";
}
function getBanType($typeId)
{
switch($reasonId)
{
case 1:
return "IP Banishment";
case 2:
return "Namelock";
case 3:
return "Banishment";
case 4:
return "Notation";
case 5:
return "Deletion";
}
return "Unknown Type";
}
function getPlayerNameByAccount($id)
{
global $vowels, $ots, $db;
if(is_numeric($id))
{
$player = $ots->createObject('Player');
$player->load($id);
if($player->isLoaded())
return $player->getName();
else
{
$playerQuery = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $id . ' ORDER BY `lastlogin` DESC LIMIT 1;')->fetch();
$tmp = "*Error*";
/*
$acco = new OTS_Account();
$acco->load($id);
if(!$acco->isLoaded())
return "Unknown name";
foreach($acco->getPlayersList() as $p)
{
$player= new OTS_Player();
$player->find($p);*/
$player->load($playerQuery['id']);
//echo 'id gracza = ' . $p . '<br/>';
if($player->isLoaded())
$tmp = $player->getName();
// break;
//}
return $tmp;
}
}
return '';
}
?>

343
system/pages/bugtracker.php Normal file
View File

@@ -0,0 +1,343 @@
<?php
/**
* Bug tracker
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Bug tracker';
if($logged)
{
// type (1 = question; 2 = answer)
// status (1 = open; 2 = new message; 3 = closed;)
$dark = $config['darkborder'];
$light = $config['lightborder'];
$tags = array(1 => "[MAP]", "[WEBSITE]", "[CLIENT]", "[MONSTER]", "[NPC]", "[OTHER]");
if(admin() and $_REQUEST['control'] == "true")
{
if(empty($_REQUEST['id']) and empty($_REQUEST['acc']) or !is_numeric($_REQUEST['acc']) or !is_numeric($_REQUEST['id']) )
$bug[1] = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `type` = 1 order by `uid` desc');
if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id']) and !empty($_REQUEST['acc']) and is_numeric($_REQUEST['acc']))
$bug[2] = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 1')->fetch();
if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id']) and !empty($_REQUEST['acc']) and is_numeric($_REQUEST['acc']))
{
if(!empty($_REQUEST['reply']))
$reply=true;
$account = $ots->createObject('Account');
$account->load($_REQUEST['acc']);
$account->isLoaded();
$players = $account->getPlayersList();
if(!$reply)
{
if($bug[2]['status'] == 2)
$value = "<font color=green>[OPEN]</font>";
elseif($bug[2]['status'] == 3)
$value = "<font color=red>[CLOSED]</font>";
elseif($bug[2]['status'] == 1)
$value = "<font color=blue>[NEW ANSWER]</font>";
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td><i><b>Posted by</b></i></td><td>';
foreach($players as $player)
{
echo ''.$player->getName().'<br>';
}
echo '</td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>';
echo '</TABLE>';
$answers = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply`');
foreach($answers as $answer)
{
if($answer['who'] == 1)
$who = "<font color=red>[ADMIN]</font>";
else
$who = "<font color=green>[PLAYER]</font>";
echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.$answer['reply'].'</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>';
echo '</TABLE>';
}
if($bug[2]['status'] != 3)
echo '<br><a href="index.php?subtopic=bugtracker&control=true&id='.$_REQUEST['id'].'&acc='.$_REQUEST['acc'].'&reply=true"><b>[REPLY]</b></a>';
}
else
{
if($bug[2]['status'] != 3)
{
$reply = $db->query('SELECT MAX(reply) FROM `' . TABLE_PREFIX . 'bugtracker` where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2')->fetch();
$reply = $reply[0] + 1;
$iswho = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'bugtracker` where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].' and `type` = 2 order by `reply` desc limit 1')->fetch();
if(isset($_POST['finish']))
{
if(empty($_POST['text']))
$error[] = "<font color=black><b>Description cannot be empty.</b></font>";
if($iswho['who'] == 1)
$error[] = "<font color=black><b>You must wait for User answer.</b></font>";
if(empty($_POST['status']))
$error[] = "<font color=black><b>Status cannot be empty.</b></font>";
if(!empty($error))
{
foreach($error as $errors)
echo ''.$errors.'<br>';
}
else
{
$type = 2;
$INSERT = $db->query('INSERT INTO `' . TABLE_PREFIX . 'bugtracker` (`account`,`id`,`text`,`reply`,`type`, `who`) VALUES ('.$db->quote($_REQUEST['acc']).','.$db->quote($_REQUEST['id']).','.$db->quote($_POST['text']).','.$db->quote($reply).','.$db->quote($type).','.$db->quote(1).')');
$UPDATE = $db->query('UPDATE `' . TABLE_PREFIX . 'bugtracker` SET `status` = '.$_POST['status'].' where `account` = '.$_REQUEST['acc'].' and `id` = '.$_REQUEST['id'].'');
header('Location: index.php?subtopic=bugtracker&control=true&id='.$_REQUEST['id'].'&acc='.$_REQUEST['acc'].'');
}
}
echo '<br><form method="post" action=""><table><tr><td><i>Description</i></td><td><textarea name="text" rows="15" cols="35"></textarea></td></tr><tr><td>Status[OPEN]</td><td><input type=radio name=status value=2></td></tr><tr><td>Status[CLOSED]</td><td><input type=radio name=status value=3></td></tr></table><br><input type="submit" name="finish" value="Submit" class="input2"/></form>';
}
else
{
echo "<br><font color=black><b>You can't add answer to closed bug thread.</b></font>";
}
}
$post=true;
}
if(!$post)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD colspan=2 CLASS=white><B>Bug Tracker Admin</B></TD></TR>';
$i=1;
foreach($bug[1] as $report)
{
if($report['status'] == 2)
$value = "<font color=green>[OPEN]</font>";
elseif($report['status'] == 3)
$value = "<font color=red>[CLOSED]</font>";
elseif($report['status'] == 1)
$value = "<font color=blue>[NEW ANSWER]</font>";
echo '<TR BGCOLOR="' . getStyle($i) . '"><td width=75%><a href="index.php?subtopic=bugtracker&control=true&id='.$report['id'].'&acc='.$report['account'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>';
$showed=true;
$i++;
}
echo '</TABLE>';
}
}
else
{
$acc = $account_logged->getId();
$account_players = $account_logged->getPlayersList();
foreach($account_players as $player)
{
$allow=true;
}
if(!empty($_REQUEST['id']))
$id = addslashes(htmlspecialchars(trim($_REQUEST['id'])));
if(empty($_REQUEST['id']))
$bug[1] = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$account_logged->getId().' and `type` = 1 order by `id` desc');
if(!empty($_REQUEST['id']) and is_numeric($_REQUEST['id']))
$bug[2] = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'bugtracker').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 1')->fetch();
else
$bug[2] = NULL;
if(!empty($_REQUEST['id']) and $bug[2] != NULL)
{
if(!empty($_REQUEST['reply']))
$reply=true;
if(!$reply)
{
if($bug[2]['status'] == 1)
$value = "<font color=green>[OPEN]</font>";
elseif($bug[2]['status'] == 2)
$value = "<font color=blue>[NEW ANSWER]</font>";
elseif($bug[2]['status'] == 3)
$value = "<font color=red>[CLOSED]</font>";
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Bug Tracker</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=40%><i><b>Subject</b></i></td><td>'.$tags[$bug[2]['tag']].' '.$bug[2]['subject'].' '.$value.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($bug[2]['text']).'</td></tr>';
echo '</TABLE>';
$answers = $db->query('SELECT * FROM '.$db->tableName('wodzaac_bugtracker').' where `account` = '.$account_logged->getId().' and `id` = '.$id.' and `type` = 2 order by `reply`');
foreach($answers as $answer)
{
if($answer['who'] == 1)
$who = "<font color=red>[ADMIN]</font>";
else
$who = "<font color=green>[YOU]</font>";
echo '<br><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Answer #'.$answer['reply'].'</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td width=70%><i><b>Posted by</b></i></td><td>'.$who.'</td></tr>';
echo '<TR BGCOLOR="'.$light.'"><td colspan=2><i><b>Description</b></i></td></tr>';
echo '<TR BGCOLOR="'.$dark.'"><td colspan=2>'.nl2br($answer['text']).'</td></tr>';
echo '</TABLE>';
}
if($bug[2]['status'] != 3)
echo '<br><a href="index.php?subtopic=bugtracker&id='.$id.'&reply=true"><b>[REPLY]</b></a>';
}
else
{
if($bug[2]['status'] != 3)
{
$reply = $db->query('SELECT MAX(reply) FROM `' . TABLE_PREFIX . 'bugtracker` where `account` = '.$acc.' and `id` = '.$id.' and `type` = 2')->fetch();
$reply = $reply[0] + 1;
$iswho = $db->query('SELECT * FROM `wodzaac_bugtracker` where `account` = '.$acc.' and `id` = '.$id.' and `type` = 2 order by `reply` desc limit 1')->fetch();
if(isset($_POST['finish']))
{
if(empty($_POST['text']))
$error[] = "<font color=black><b>Description cannot be empty.</b></font>";
if($iswho['who'] == 0)
$error[] = "<font color=black><b>You must wait for Administrator answer.</b></font>";
if(!$allow)
$error[] = "<font color=black><b>You haven't any characters on account.</b></font>";
if(!empty($error))
{
foreach($error as $errors)
echo ''.$errors.'<br>';
}
else
{
$type = 2;
$INSERT = $db->query('INSERT INTO `wodzaac_bugtracker` (`account`,`id`,`text`,`reply`,`type`) VALUES ('.$db->quote($acc).','.$db->quote($id).','.$db->quote($_POST['text']).','.$db->quote($reply).','.$db->quote($type).')');
$UPDATE = $db->query('UPDATE `wodzaac_bugtracker` SET `status` = 1 where `account` = '.$acc.' and `id` = '.$id.'');
header('Location: index.php?subtopic=bugtracker&id='.$id.'');
}
}
echo '<br><form method="post" action=""><table><tr><td><i>Description</i></td><td><textarea name="text" rows="15" cols="35"></textarea></td></tr></table><br><input type="submit" name="finish" value="Submit" class="input2"/></form>';
}
else
{
echo "<br><font color=black><b>You can't add answer to closed bug thread.</b></font>";
}
}
$post=true;
}
elseif(!empty($_REQUEST['id']) and $bug[2] == NULL)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD CLASS=white><B>Bug Tracker</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td><i>Bug doesn\'t exist.</i></td></tr>';
echo '</TABLE>';
$post=true;
}
if(!$post)
{
if($_REQUEST['add'] != TRUE)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD colspan=2 CLASS=white><B>Bug Tracker</B></TD></TR>';
foreach($bug[1] as $report)
{
if($report['status'] == 1)
$value = "<font color=green>[OPEN]</font>";
elseif($report['status'] == 2)
$value = "<font color=blue>[NEW ANSWER]</font>";
elseif($report['status'] == 3)
$value = "<font color=red>[CLOSED]</font>";
if(is_int($report['id'] / 2))
{
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<TR BGCOLOR="'.$bgcolor.'"><td width=75%><a href="index.php?subtopic=bugtracker&id='.$report['id'].'">'.$tags[$report['tag']].' '.$report['subject'].'</a></td><td>'.$value.'</td></tr>';
$showed=true;
}
if(!$showed)
{
echo '<TR BGCOLOR="'.$dark.'"><td><i>You don\'t have reported any bugs.</i></td></tr>';
}
echo '</TABLE>';
echo '<br><a href="index.php?subtopic=bugtracker&add=true"><b>[ADD REPORT]</b></a>';
}
elseif($_REQUEST['add'] == TRUE)
{
$thread = $db->query('SELECT * FROM `' TABLE_PREFIX . 'bugtracker` where `account` = '.$acc.' and `type` = 1 order by `id` desc')->fetch();
$id_next = $db->query('SELECT MAX(id) FROM `' . TABLE_PREFIX . 'bugtracker` where `account` = '.$acc.' and `type` = 1')->fetch();
$id_next = $id_next[0] + 1;
if(empty($thread))
$thread['status'] = 3;
if(isset($_POST['submit']))
{
if($thread['status'] != 3)
$error[] = "<font color=black><b>Can be only 1 open bug thread.</b></font>";
if(empty($_POST['subject']))
$error[] = "<font color=black><b>Subject cannot be empty.</b></font>";
if(empty($_POST['text']))
$error[] = "<font color=black><b>Description cannot be empty.</b></font>";
if(!$allow)
$error[] = "<font color=black><b>You haven't any characters on account.</b></font>";
if(empty($_POST['tags']))
$error[] = "<font color=black><b>Tag cannot be empty.</b></font>";
if(!empty($error))
{
foreach($error as $errors)
echo ''.$errors.'<br>';
}
else
{
$type = 1;
$status = 1;
$INSERT = $db->query('INSERT INTO `' . TABLE_PREFIX . 'bugtracker` (`account`,`id`,`text`,`type`,`subject`,`status`,`tag`) VALUES ('.$db->quote($acc).','.$db->quote($id_next).','.$db->quote($_POST['text']).','.$db->quote($type).','.$db->quote($_POST['subject']).','.$db->quote($status).','.$db->quote($_POST['tags']).')');
header('Location: index.php?subtopic=bugtracker&id='.$id_next.'');
}
}
echo '<br><form method="post" action=""><table><tr><td><i>Subject</i></td><td><input type=text name="subject"/></td></tr><tr><td><i>Description</i></td><td><textarea name="text" rows="15" cols="35"></textarea></td></tr><tr><td>TAG</td><td><select name="tags"><option value="">SELECT</option>';
for($i = 1; $i <= count($tags); $i++)
{
echo '<option value="' . $i . '">' . $tags[$i] . '</option>';
}
echo '</select></tr></tr></table><br><input type="submit" name="submit" value="Submit" class="input2"/></form>';
}
}
}
if(admin() and empty($_REQUEST['control']))
{
echo '<br><br><a href="index.php?subtopic=bugtracker&control=true">[ADMIN PANEL]</a>';
}
}
else
{
echo 'Please enter your account name and your password.<br/><a href="?subtopic=createaccount" >Create an account</a> if you do not have one yet.<br/><br/><form action="?subtopic=bugtracker" method="post" ><div class="TableContainer" > <table class="Table1" cellpadding="0" cellspacing="0" > <div class="CaptionContainer" > <div class="CaptionInnerContainer" > <span class="CaptionEdgeLeftTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightTop" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionBorderTop" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionVerticalLeft" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <div class="Text" >Account Login</div> <span class="CaptionVerticalRight" style="background-image:url('.$template_path.'/images/content/box-frame-vertical.gif);" /></span> <span class="CaptionBorderBottom" style="background-image:url('.$template_path.'/images/content/table-headline-border.gif);" ></span> <span class="CaptionEdgeLeftBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> <span class="CaptionEdgeRightBottom" style="background-image:url('.$template_path.'/images/content/box-frame-edge.gif);" /></span> </div> </div> <tr> <td> <div class="InnerTableContainer" > <table style="width:100%;" ><tr><td class="LabelV" ><span >Account Name:</span></td><td style="width:100%;" ><input type="password" name="account_login" SIZE="10" maxlength="10" ></td></tr><tr><td class="LabelV" ><span >Password:</span></td><td><input type="password" name="password_login" size="30" maxlength="29" ></td></tr> </table> </div> </table></div></td></tr><br/><table width="100%" ><tr align="center" ><td><table border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$template_path.'/images/buttons/_sbutton_submit.gif" ></div></div></td><tr></form></table></td><td><table border="0" cellspacing="0" cellpadding="0" ><form action="?subtopic=lostaccount" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Account lost?" alt="Account lost?" src="'.$template_path.'/images/buttons/_sbutton_accountlost.gif" ></div></div></td></tr></form></table></td></tr></table>';
}
?>

105
system/pages/changelog.php Normal file
View File

@@ -0,0 +1,105 @@
<?php
/**
* Changelog
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Changelog';
$_page = $_GET['page'];
$id = $_GET['id'];
$limit = 30;
$offset = $_page * $limit;
?>
<br/>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td width="22"><font class="white"><b>Type</b></font></td>
<td width="22"><font class="white"><b>Where</b></font></td>
<td width="50"><font class="white"><b>Date</b></font></td>
<td><font class="white"><b>Description</b></font></td>
</tr>
<?php
$changelogs = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'changelog') . ' ORDER BY ' . $db->fieldName('id') . ' DESC LIMIT ' . $limit . ' OFFSET ' . $offset);
if(!$changelogs->rowCount())
{
?>
<tr>
<td bgcolor="<?php echo $config['lightborder']; ?>">There are no change logs for the moment.</td>
</tr>
<?php
return;
}
else
{
$i = 0;
foreach($changelogs as $log)
{
$type = getChangelogType($log['type']);
$where = getChangelogWhere($log['where']);
?>
<tr bgcolor="<?php echo getStyle($i++); ?>">
<td align="center">
<img src="images/changelog/<?php echo $type; ?>.png" title="<?php echo ucfirst($type); ?>"/>
</td>
<td align="center">
<img src="images/changelog/<?php echo $where; ?>.png" title="<?php echo ucfirst($where); ?>"/>
</td>
<td><?php echo date("j.m.Y", $log['date']); ?></td>
<td><?php echo $log['body']; ?></td>
</tr>
<?php
if ($i >= $limit)
$next_page = true;
}
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<?
if($_page > 0)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=changelog&page=' . ($_page - 1) . '" class="size_xxs">Previous Page</a></td></tr>';
if($next_page)
echo '<tr><td width="100%" align="right" valign="bottom"><a href="?subtopic=changelog&page=' . ($_page + 1) . '" class="size_xxs">Next Page</a></td></tr>';
?>
</table>
<?php
}
?>
</table>
<?php
function getChangelogType($v)
{
switch($v) {
case 1:
return 'added';
case 2:
return 'removed';
case 3:
return 'changed';
case 4:
return 'fixed';
}
return 'Unknown type';
}
function getChangelogWhere($v)
{
switch($v) {
case 1:
return 'server';
case 2:
return 'website';
}
return 'Unknown where';
}
?>

696
system/pages/characters.php Normal file
View File

@@ -0,0 +1,696 @@
<?php
/**
* Characters
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Characters';
require(SYSTEM . 'item.php');
$groups = new OTS_Groups_List();
function generate_search_table($script = false)
{
global $config, $template_path;
$ret = '
<form action="' . getPageLink('characters') . '" method="post">
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Search Character</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
<TABLE BORDER=0 CELLPADDING=1>
<TR>
<TD>Name:</TD><TD><INPUT ID="name-input" NAME="name" VALUE="" SIZE=29 MAXLENGTH=29></TD>
<TD>
<INPUT TYPE=image NAME="Submit" SRC="' . $template_path . '/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD>
</TR>
</TABLE>
</TD></TR>
</TABLE>
</FORM>';
if($script)
$ret .= '
<script type="text/javascript">
$(function() {
$(\'#name-input\').focus();
});
</script>';
return $ret;
}
function generate_player_lookup($player)
{
global $db;
$eq_sql = $db->query('SELECT `pid`, `itemtype` FROM player_items WHERE player_id = '.$player->getId().' AND (`pid` >= 1 and `pid` <= 10)');
$player_eq = array();
foreach($eq_sql as $eq)
$player_eq[$eq['pid']] = $eq['itemtype'];
$empty_slots = array("", "no_helmet", "no_necklace", "no_backpack", "no_armor", "no_handleft", "no_handright", "no_legs", "no_boots", "no_ring", "no_ammo");
for($i = 0; $i <= 10; $i++)
{
if(!isset($player_eq[$i]) || $player_eq[$i] == 0)
$player_eq[$i] = $empty_slots[$i];
}
//for($i = 1; $i < 11; $i++)
//{
//if(!itemImageExists($player_eq[$i]))
// Items::generate($player_eq[$i]);
//}
return '<table width="100" align="center" cellspacing="0" cellpadding="0" style="background: #808080; border:1px solid #808080;">
<tr>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[2]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[6]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[9]).'</td></tr>
<tr height="11px"><td>'.($player->getSkull() > 0 ? '<img src="images/red_skull.gif">' : '').'</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[1]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[4]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[7]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[8]).'</td></tr>
</table>
</td>
<td>
<table cellspacing="0" style="background: #292929;">
<tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[3]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[5]).'</td></tr><tr><td style="border:1px solid #808080;">'.getItemImage($player_eq[10]).'</td></tr>
</table>
</td>
</tr>
</table>';
}
function retrieve_former_name($name)
{
global $oldName, $db;
if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) {
$newNameSql = $db->query('SELECT `name`, `new_name` FROM `player_namelocks` WHERE `name` = ' . $db->quote($name));
if($newNameSql->rowCount() > 0) // namelocked
{
$newNameSql = $newNameSql->fetch();
$oldName = ' (<small><b>Former name:</b> ' . $newNameSql['name'] . '</small>)';
return $newNameSql['new_name'];
}
}
return "";
}
$name = '';
if(isset($_REQUEST['name']))
$name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
if(empty($name))
{
$tmp_link = getPlayerLink($name);
echo 'Here you can get detailed information about a certain player on '.$config['lua']['serverName'].'.<BR>';
echo generate_search_table(true);
return;
}
$name = str_replace('/', '', $name);
if(check_name($name))
{
$oldName = '';
$player = $ots->createObject('Player');
$player->find($name);
if(!$player->isLoaded())
{
$tmp_zmienna = "";
$tmp_name = retrieve_former_name($name);
while(!empty($tmp_name))
{
$tmp_zmienna = $tmp_name;
$tmp_name = retrieve_former_name($tmp_zmienna);
}
if(!empty($tmp_zmienna))
$player->find($tmp_zmienna);
}
if($player->isLoaded() && !$player->isDeleted())
{
$title = $player->getName() . ' - ' . $title;
$account = $player->getAccount();
$rows = 0;
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td colspan="2" class="white"><b>Character Information</b></td>
</tr>
<?php
$flag = '';
if($config['account_country'])
$flag = getFlagImage($account->getCustomField('country'));
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '">'.
'<TD WIDTH=20%>Name:</TD>
<TD>' . $flag . ' <font color="'.($player->isOnline() ? 'green' : 'red').'"><b>'.$player->getName().'</b></font>'.$oldName.
'</TD></TR>';
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Sex:</TD><TD>'.
($player->getSex() == 0 ? 'female' : 'male').
'</TD></TR>';
if($config['characters']['marriage_info'] && fieldExist('marriage', 'players'))
{
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Marital status:</TD><TD>';
$marriage = new OTS_Player();
$marriage->load($player->getMarriage());
if($marriage->isLoaded())
echo 'married to ' . getPlayerLink($marriage->getName());
else
echo 'single';
echo
'</TD></TR>';
}
echo
'<TR BGCOLOR="' . getStyle(++$rows). '">'.
'<TD>Profession:</TD><TD>' . $config['vocations'][$player->getVocation()] . '</TD>'.
'</TR>';
if($config['characters']['level'])
echo '<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Level:</TD><TD>'.$player->getLevel().'</TD></TR>';
if($config['characters']['experience'])
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Experience:</TD><TD>'.$player->getExperience().'</TD></TR>';
if($config['characters']['magic_level'])
echo'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Magic Level:</TD><TD>'.$player->getMagLevel().'</TD></TR>';
//frags
if(tableExist('player_killers') && $config['characters']['frags']) {
$frags_count = 0;
$frags_query = $db->query(
'SELECT COUNT(`player_id`) as `frags`' .
'FROM `player_killers`' .
'WHERE `player_id` = ' .$player->getId() . ' ' .
'GROUP BY `player_id`' .
'ORDER BY COUNT(`player_id`) DESC');
if($frags_query->rowCount() > 0)
{
$frags_query = $frags_query->fetch();
$frags_count = $frags_query['frags'];
}
echo
'<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Frags:</TD><TD>' . $frags_count . '</TD></TR>';
}
if(!empty($config['towns'][$player->getTownId()]))
echo '<TR BGCOLOR="' . getStyle(++$rows) . '"><TD>Residence:</TD><TD>' . $config['towns'][$player->getTownId()] . '</TD></TR>';
if($config['characters']['balance'])
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Balance:</TD><TD>'.$player->getBalance().' Gold Coins.</TD></TR>';
$town_field = 'town';
if(fieldExist('town_id', 'houses'))
$town_field = 'town_id';
$house = $db->query('SELECT `id`, `paid`, `name`, `' . $town_field . '` FROM `houses` WHERE `owner` = '.$player->getId())->fetch();
if(isset($house['id']))
{
if($house['paid'] > 0)
$add = ' is paid until '.date("M d Y", $house['paid']);
echo
'<TR BGCOLOR="'.getStyle(++$rows).'">
<TD>House:</TD>
<TD>
<TABLE BORDER=0><TR>
<TD>'.$house['name'].' ('.$config['towns'][$house[$town_field]].')'.$add.'</TD>
<TD>
<FORM ACTION="?subtopic=houses&page=view" METHOD=post>
<INPUT TYPE=hidden NAME=house VALUE="'.$house['name'].'">
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120>
</FORM>
</TD>
</TR></TABLE>
</TD>
</TR>';
}
$rank_of_player = $player->getRank();
if($rank_of_player->isLoaded())
{
$guild_name = $rank_of_player->getGuild()->getName();
echo
'<TR BGCOLOR="'.getStyle(++$rows).'">'.
'<TD>Guild membership:</TD><TD>'.$rank_of_player->getName().' of the ' . getGuildLink($guild_name) . '</TD>'.
'</TR>';
}
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Last login:</TD><TD>';
$lastlogin = $player->getLastLogin();
if(empty($lastlogin))
echo'Never logged in.';
else
echo date("M d Y, H:i:s", $lastlogin).' CEST';
echo '</TD></TR>';
if($config['characters']['creation_date'])
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Created:</TD><TD>'.date("M d Y, H:i:s", $player->getCreated()).' CEST</TD></TR>';
$comment = $player->getComment();/*
$newlines = array("\r\n", "\n", "\r");
$comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
if($count < 50)
$comment = $comment_with_lines;*/
if(!empty($comment))
echo '<TR BGCOLOR="'.getStyle(++$rows).'"><TD VALIGN=top>Comment:</TD><TD>' . wordwrap(nl2br($comment), 60, "<br />", true) . '</TD></TR>';
echo
'<TR BGCOLOR="'.getStyle(++$rows).'"><TD>Account Status:</TD><TD>' . (($account->isPremium()) ? 'Premium Account' : 'Free Account') . '</TD></TR>'.
'</TABLE>';
echo '<br>'.
'<TABLE BORDER=0 WIDTH=100%><TR>';
if($config['characters']['skills'])
{
if(fieldExist('skill_fist', 'players')) {// tfs 1.0+
$skills_db = $db->query('SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing` FROM `players` WHERE `id` = ' . $player->getId())->fetch();
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
$skills = array();
foreach($skill_ids as $skillid => $field_name) {
$skills[] = array('skillid' => $skillid, 'value' => $skills_db[$field_name]);
}
}
else
$skills = $db->query('SELECT `skillid`, `value` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' LIMIT 7');
echo '
<TD WIDTH=30% VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Skills</B></TD>
</TR>';
$i = 0;
foreach($skills as $skill)
{
echo
'<TR BGCOLOR=' . getStyle(++$i) . '>
<TD VALIGN=top>' . getSkillName($skill['skillid']) . '</TD>
<TD>' . $skill['value'] . '</TD>
</TR>';
}
echo
'</TABLE>
</TD>';
}
if($config['characters']['quests'] && !empty($config['quests']))
{
$quests = $config['quests'];
$sql_query_in = '';
$i = 0;
foreach($quests as $quest_name => $quest_storage)
{
if($i != 0)
$sql_query_in .= ', ';
$sql_query_in .= $quest_storage;
$i++;
}
$storage_sql = $db->query('SELECT `key`, `value` FROM `player_storage` WHERE `player_id` = '.$player->getId().' AND `key` IN (' . $sql_query_in . ')');
$player_storage = array();
foreach($storage_sql as $storage)
$player_storage[$storage['key']] = $storage['value'];
echo '
<TD WIDTH=40% VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Quests</B></TD>
</TR>';
//for($i=0; $i < count($quests); $i++)
$i = 0;
foreach($quests as $name => $storage)
{
$i++;
echo
'<TR BGCOLOR='.getStyle($i - 1).'>
<TD VALIGN=top>'.$name.'</TD>
<TD><img src="images/'.($player_storage[$storage] ? 'true' : 'false').'.png" border="0"/></TD>
</TR>';
}
echo
'</TABLE>
</TD>';
}
if($config['characters']['equipment'])
{
echo '
<TD WIDTH=100 VALIGN="TOP">'.
'<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.
'<TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Equipment</B></TD></TR>'.
'<TR BGCOLOR='.getStyle(1).'><TD>'.generate_player_lookup($player).'</TD></TR>
</TABLE>
</TD>';
}
echo '</TR></TABLE>';
if(tableExist('killers')) {
$player_deaths = $db->query('SELECT `id`, `date`, `level` FROM `player_deaths` WHERE `player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,10;');
if(count($player_deaths))
{
$dead_add_content = '<br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Character Deaths</B></TD></TR>';
$number_of_rows = 0;
foreach($player_deaths as $death)
{
$dead_add_content .= "<tr bgcolor=\"".getStyle($number_of_rows++)."\">
<td width=\"20%\" align=\"center\">".date("j M Y, H:i", $death['date'])."</td>
<td> ";
$killers = $db->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();
$i = 0;
$count = count($killers);
foreach($killers as $killer)
{
$i++;
if($killer['player_name'] != "")
{
if($i == 1)
$dead_add_content .= "Killed at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ";
if($killer['monster_name'] != "")
$dead_add_content .= $killer['monster_name']." summoned by ";
if($killer['player_exists'] == 0)
$dead_add_content .= getPlayerLink($killer['player_name']);
else
$dead_add_content .= $killer['player_name'];
}
else
{
if($i == 1)
$dead_add_content .= "Died at level <b>".$death['level']."</b>";
else if($i == $count)
$dead_add_content .= " and";
else
$dead_add_content .= ",";
$dead_add_content .= " by ".$killer['monster_name'];
}
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
echo $dead_add_content . '</TABLE>';
}
}
else {
$deaths = $db->query('SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`,
`mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`
FROM `player_deaths`
WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;');
if(count($deaths))
{
$dead_add_content = '<br/><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Character Deaths</B></TD></TR>';
$number_of_rows = 0;
foreach($deaths as $death)
{
$dead_add_content .= "<tr bgcolor=\"".getStyle($number_of_rows++)."\">
<td width=\"20%\" align=\"center\">".date("j M Y, H:i", $death['time'])."</td>
<td> ";
$lasthit = ($death['is_player']) ? getPlayerLink($death['killed_by']) : $death['killed_by'];
$dead_add_content .= 'Killed at level ' . $death['level'] . ' by ' . $lasthit;
if($death['unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
$mostdmg = ($death['mostdamage_by'] !== $death['killed_by']) ? true : false;
if($mostdmg)
{
$mostdmg = ($death['mostdamage_is_player']) ? getPlayerLink($death['mostdamage_by']) : $death['mostdamage_by'];
$dead_add_content .= '<br>and by ' . $mostdmg;
if ($death['mostdamage_unjustified']) {
$dead_add_content .= " <font color='red' style='font-style: italic;'>(unjustified)</font>";
}
}
else {
$dead_add_content .= " <b>(soloed)</b>";
}
$dead_add_content .= ".</td></tr>";
}
if($number_of_rows > 0)
echo $dead_add_content . '</TABLE>';
}
}
if($config['characters']['frags'])
{
//frags list by Xampy
$i = 0;
$frags_limit = 10; // frags limit to show? // default: 10
$player_frags = $db->query('SELECT `player_deaths`.*, `players`.`name`, `killers`.`unjustified` FROM `player_deaths` LEFT JOIN `killers` ON `killers`.`death_id` = `player_deaths`.`id` LEFT JOIN `player_killers` ON `player_killers`.`kill_id` = `killers`.`id` LEFT JOIN `players` ON `players`.`id` = `player_deaths`.`player_id` WHERE `player_killers`.`player_id` = '.$player->getId().' ORDER BY `date` DESC LIMIT 0,'.$frags_limit.';');
if(count($player_frags))
{
$frags = 0;
$frag_add_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><br><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 CLASS=white><B>Victims</B></TD></TR>';
foreach($player_frags as $frag)
{
$frags++;
$frag_add_content .= '<tr bgcolor="' . getStyle($frags) . '">
<td width="20%" align="center">' . date("j M Y, H:i", $frag['date']) . '</td>
<td>Fragged <a href="' . getPlayerLink($frag[name], false) . '">' . $frag[name] . '</a> at level ' . $frag[level];
$frag_add_content .= ". (".(($frag['unjustified'] == 0) ? "<font size=\"1\" color=\"green\">Justified</font>" : "<font size=\"1\" color=\"red\">Unjustified</font>").")</td></tr>";
}
if($frags > 0)
echo $frag_add_content . '</TABLE>';
}
}
//Signature
//Js
if($config['signature_enabled'])
{
echo '<script type="text/javascript">
function showSignLinks()
{
if(document.getElementById(\'signLinks\').style.display == "none")
{
document.getElementById(\'signLinks\').style.display = "inline";
document.getElementById(\'signText\').innerHTML = "Hide links";
}
else
{
document.getElementById(\'signLinks\').style.display = "none";
document.getElementById(\'signText\').innerHTML = "Show links";
}
}
</script>';
echo '<br>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class="white"><B>Signature</B></TD></TR>
<TR BGCOLOR='.$config['lightborder'].'><TD align="center" VALIGN=top>';
$signature_url = BASE_URL . 'tools/signature/?name=' . urlencode($player->getName());
if($config['friendly_urls'])
$signature_url = BASE_URL . urlencode($player->getName()) . '.png';
echo '
<img src="' . $signature_url . '" alt="Signature for player '.$player->getName().'">
<br/>
<b><a href="#" onclick="showSignLinks(); return false;" id="signText">Show links</a></b>
<br>
<table id="signLinks" style="display: none;">
<tr>
<td>Website:</td>
<td><input type="text" value="<a href=&quot;' . getPlayerLink($player->getName(), false) . '&quot;><img src=&quot;' . $signature_url . '&quot;></a>" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Forum::</td>
<td><input type="text" value="[URL=' . getPlayerLink($player->getName(), false) . '][IMG]' . $signature_url . '[/IMG][/URL]" style="width: 400px;" onclick="this.select()"></td>
</tr>
<tr>
<td>Direct link::</td>
<td><input type="text" value="' . $signature_url . '" style="width: 400px;" onclick="this.select()"></td>
</tr>
</table>
</TD></TR>
</TABLE>';
}
if($player->getCustomField('hidden') != 1)
{
$rows = 0;
echo '<br/><br/>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=2 class="white"><B>Account Information</B></TD>
</TR>';
$realName = $account->getCustomField('rlname');
if(!empty($realName))
{
echo '
<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Real name:</TD>
<TD>'.$realName.'</TD>
</TR>';
}
$group = $player->getGroup();
if($group->isLoaded() && $group->getId() != 1)
{
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD>Position:</TD>
<TD>' . ucfirst($group->getName()) . '</TD>
</TR>';
}
$realLocation = $account->getCustomField('location');
if(isset($realLocation[0]))
{
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Location:</TD>
<TD>'.$realLocation.'</TD>
</TR>';
}
echo
'<TR BGCOLOR='.getStyle(++$rows).'>
<TD WIDTH=20%>Created:</TD>';
$bannedUntil = '';
if(tableExist('account_bans'))
$banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = '.$account->getId().' and `expires_at` > ' . time());
else
$banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time());
foreach($banned as $ban)
{
if($ban['type'] != 2 and $ban['type'] != 4)
$bannedUntil = ' <font color="red">[Banished '.($ban['expires'] == "-1" ? 'forever' : 'until '.date("d F Y, h:s", $ban['expires'])).']</font>';
}
echo '<TD>'.date("j F Y, g:i a", $account->getCustomField("created")).$bannedUntil.'</TD>
</TR>
</TABLE>';
echo '<br/><br/>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=4 class="white"><B>Characters</B></TD>
</TR>
<TR BGCOLOR='.$config['darkborder'].'>
<TD WIDTH=62%><B>Name</B></TD>
<TD WIDTH=30%><B>Level</B></TD>
<TD WIDTH=8%><b>Status</b></TD>
<TD><B>&#160;</B></TD>
</TR>';
$account_players = $account->getPlayersList();
$account_players->orderBy('name');
$player_number = 0;
foreach($account_players as $player_list)
{
$player_list_status = '';
if($player_list->isHidden())
continue;
$player_number++;
if($player_list->isOnline())
$player_list_status = '<b><font color="green">Online</font></b>';
echo '<TR BGCOLOR="'.getStyle($player_number).'"><TD><NOBR>'.$player_number.'.&#160;'.$player_list->getName();
echo ($player_list->isDeleted()) ? '<font color="red"> [DELETED]</font>' : '';
echo '</NOBR></TD><TD>'.$player_list->getLevel().' '.$config['vocations'][$player_list->getVocation()].'</TD><TD>' . $player_list_status . '</TD><TD><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><FORM ACTION="' . internalLayoutLink('characters') . '" METHOD=post><TR><TD><INPUT TYPE=hidden NAME=name VALUE="'.$player_list->getName().'"><INPUT TYPE=image NAME="View '.$player_list->getName().'" ALT="View '.$player_list->getName().'" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></FORM></TABLE></TD></TR>';
}
echo '</TABLE></TD><TD><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD></TR></TABLE>';
}
echo '<br/><br/>' . generate_search_table();
echo '</TABLE>';
}
else
{
$search_errors[] = 'Character <b>' . $name . '</b> does not exist or has been deleted.';
output_errors($search_errors);
$search_errors = array();
$promotion = '';
if(fieldExist('promotion', 'players'))
$promotion = ', `promotion`';
$deleted = 'deleted';
if(fieldExist('deletion', 'players'))
$deleted = 'deletion';
$query = $db->query('SELECT `name`, `level`, `vocation`' . $promotion . ' FROM `players` WHERE `name` LIKE ' . $db->quote('%' . $name . '%') . ' AND ' . $deleted . ' != 1;');
if($query->rowCount() > 0)
{
echo 'Did you mean:<ul>';
foreach($query as $player) {
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
}
echo '<li>' . getPlayerLink($player['name']) . ' (<small><strong>level ' . $player['level'] . ', ' . $config['vocations'][$player['vocation']] . '</strong></small>)</li>';
}
echo '</ul>';
}
echo generate_search_table(true);
}
}
else
$search_errors[] = 'This name contains invalid letters. Please use only A-Z, a-z and space. Minimum length is 3 characters.';
if(!empty($search_errors))
output_errors($search_errors);

252
system/pages/commands.php Normal file
View File

@@ -0,0 +1,252 @@
<?php
/**
* Commands
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Commands';
if($config['otserv_version'] == TFS_03):
?>
List of all your commands, you can check in game, by writing - <b>/commands</b>.<br/><br/>
<?php
endif;
?>
<!--
To get info ingame about specified command, you can write - <b>/man commandName</b> or <b>commandName man</b>. Example: <b>/man serverinfo</b>, <b>/man !sellhouse</b>, <b>!deathlist man</b>, <b>!buypremium man</b>.
<br/><br/>
-->
<?php
$canEdit = hasFlag(FLAG_CONTENT_COMMANDS) || superAdmin();
if($canEdit)
{
if(!empty($action))
{
if($action == 'delete' || $action == 'edit' || $action == 'hide' || $action == 'moveup' || $action == 'movedown')
$id = $_REQUEST['id'];
if(isset($_REQUEST['words']))
$words = $_REQUEST['words'];
if(isset($_REQUEST['description']))
$description = stripslashes($_REQUEST['description']);
$errors = array();
if($action == 'add') {
if(Commands::add($words, $description, $errors))
$words = $description = '';
}
else if($action == 'delete') {
Commands::delete($id, $errors);
}
else if($action == 'edit')
{
if(isset($id) && !isset($words)) {
$command = Commands::get($id);
$words = $command['words'];
$description = $command['description'];
}
else {
Commands::update($id, $words, $description);
$action = $words = $description = '';
}
}
else if($action == 'hide') {
Commands::toggleHidden($id, $errors);
}
else if($action == 'moveup') {
Commands::move($id, -1, $errors);
}
else if($action == 'movedown') {
Commands::move($id, 1, $errors);
}
if(!empty($errors))
output_errors($errors);
}
?>
<form method="post" action="<?php echo getPageLink('commands', ($action == 'edit' ? 'edit' : 'add')); ?>">
<?php if($action == 'edit'): ?>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<?php endif; ?>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b><?php echo ($action == 'edit' ? 'Edit' : 'Add'); ?> command</b></td>
</tr>
<tr>
<td bgcolor="<?php echo $config['darkborder']; ?>">
<table border="0" cellpadding="1">
<tr>
<td>Words:</td>
<td><input name="words" value="<?php echo (isset($words) ? $words : ''); ?>" size="29" maxlength="29"/></td>
<tr>
<td>Description:</td>
<td><textarea name="description" maxlength="300" cols="50" rows="5"><?php echo (isset($description) ? $description : ''); ?></textarea></td>
<tr/>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit"/>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white" width="150"><b>Words</b></td>
<td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Description</b></td>
<?php if($canEdit): ?>
<td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Options</b></td>
<?php endif; ?>
</tr>
<?php
$commands =
$db->query('SELECT ' . $db->fieldName('id') . ', ' . $db->fieldName('words') . ', ' . $db->fieldName('description') .
($canEdit ? ', ' . $db->fieldName('hidden') . ', ' . $db->fieldName('ordering') : '') .
' FROM ' . $db->tableName(TABLE_PREFIX . 'commands') .
(!$canEdit ? ' WHERE ' . $db->fieldName('hidden') . ' != 1' : '') .
' ORDER BY ' . $db->fieldName('ordering'));
$last = $commands->rowCount();
$i = 0;
foreach($commands as $command): ?>
<tr bgcolor="<?php echo getStyle(++$i); ?>">
<td><?php echo $command['words']; ?></td>
<td><i><?php echo $command['description']; ?></i></td>
<?php if($canEdit): ?>
<td>
<a href="?subtopic=commands&action=edit&id=<?php echo $command['id']; ?>" title="Edit">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" href="<?php echo BASE_URL; ?>?subtopic=commands&action=delete&id=<?php echo $command['id']; ?>" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete
</a>
<a href="?subtopic=commands&action=hide&id=<?php echo $command['id']; ?>" title="<?php echo ($command['hidden'] != 1 ? 'Hide' : 'Show'); ?>">
<img src="images/<?php echo ($command['hidden'] != 1 ? 'success' : 'error'); ?>.png"/><?php echo ($command['hidden'] != 1 ? 'Hide' : 'Show'); ?>
</a>
<?php if($i != 1): ?>
<a href="?subtopic=commands&action=moveup&id=<?php echo $command['id']; ?>" title="Move up">
<img src="images/icons/arrow_up.gif"/>Move up
</a>
<?php endif; ?>
<?php if($i != $last): ?>
<a href="?subtopic=commands&action=movedown&id=<?php echo $command['id']; ?>" title="Move down">
<img src="images/icons/arrow_down.gif"/>Move down
</a>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>
<?php
class Commands
{
static public function add($words, $description, &$errors)
{
global $db;
if(isset($words[0]) && isset($description[0]))
{
$query = $db->select(TABLE_PREFIX . 'commands', array('words' => $words));
if($query === false)
{
$query =
$db->query(
'SELECT ' . $db->fieldName('ordering') .
' FROM ' . $db->tableName(TABLE_PREFIX . 'commands') .
' ORDER BY ' . $db->fieldName('ordering') . ' DESC LIMIT 1'
);
$ordering = 0;
if($query->rowCount() > 0) {
$query = $query->fetch();
$ordering = $query['ordering'] + 1;
}
$db->insert(TABLE_PREFIX . 'commands', array('words' => $words, 'description' => $description, 'ordering' => $ordering));
}
else
$errors[] = 'Command with this words already exists.';
}
else
$errors[] = 'Please fill all inputs.';
return !count($errors);
}
static public function get($id) {
global $db;
return $db->select(TABLE_PREFIX . 'commands', array('id' => $id));
}
static public function update($id, $words, $description) {
global $db;
$db->update(TABLE_PREFIX . 'commands', array('words' => $words, 'description' => $description), array('id' => $id));
}
static public function delete($id, &$errors)
{
global $db;
if(isset($id))
{
if($db->select(TABLE_PREFIX . 'commands', array('id' => $id)) !== false)
$db->delete(TABLE_PREFIX . 'commands', array('id' => $id));
else
$errors[] = 'Command with id ' . $id . ' does not exists.';
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function toggleHidden($id, &$errors)
{
global $db;
if(isset($id))
{
$query = $db->select(TABLE_PREFIX . 'commands', array('id' => $id));
if($query !== false)
$db->update(TABLE_PREFIX . 'commands', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
else
$errors[] = 'Command with id ' . $id . ' does not exists.';
}
else
$errors[] = 'id not set';
return !count($errors);
}
static public function move($id, $i, &$errors)
{
global $db;
$query = $db->select(TABLE_PREFIX . 'commands', array('id' => $id));
if($query !== false)
{
$ordering = $query['ordering'] + $i;
$old_record = $db->select(TABLE_PREFIX . 'commands', array('ordering' => $ordering));
if($old_record !== false)
$db->update(TABLE_PREFIX . 'commands', array('ordering' => $query['ordering']), array('ordering' => $ordering));
$db->update(TABLE_PREFIX . 'commands', array('ordering' => $ordering), array('id' => $id));
}
else
$errors[] = 'Command with id ' . $id . ' does not exists.';
return !count($errors);
}
}
?>

View File

@@ -0,0 +1,536 @@
<?php
/**
* Create account
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Create Account';
if($config['account_country'])
require(SYSTEM . 'countries.conf.php');
if($logged)
{
echo 'Please logout before attempting to create a new account.';
return;
}
$step = isset($_POST['step']) ? $_POST['step'] : '';
if($step == 'save')
{
$account_name = $_POST['account_name'];
$account_name_up = strtoupper($account_name);
$email = $_POST['email'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
// account
if(empty($account_name))
$errors['account_name'] = 'Please enter your account name!';
elseif(!check_account_name($account_name_up))
$errors['account_name'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
// email
if(empty($email))
$errors['email'] = 'Please enter your email address!';
else
{
if(!check_mail($email))
$errors['email'] = 'E-mail address is not correct.';
}
// country
$country = '';
if($config['account_country'])
{
$country = $_POST['country'];
if(!isset($country))
$errors['country'] = 'Country is not set';
elseif(!$config['countries'][$country])
$errors['country'] = 'Country is invalid.';
}
if($config['recaptcha_enabled'])
{
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))
{
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$config['recaptcha_secret_key'].'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if(!$responseData->success)
$errors['verification'] = 'Please confirm that your not a robot.';
}
else
$errors['verification'] = 'Please confirm that your not a robot.';
}
// password
if(empty($password))
$errors['password'] = 'Please enter the password for your new account.';
elseif($password != $password2)
$errors['password'] = 'Passwords are not the same.';
else
{
if(!check_password($password))
$errors['password'] = 'Password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32.';
}
// check if account name is not equal to password
if($account_name_up == strtoupper($password))
{
$errors['password'] = 'Password may not be the same as account name.';
}
if(empty($errors))
{
if($config['account_mail_unique'])
{
$test_email_account = $ots->createObject('Account');
$test_email_account->findByEmail($email);
if($test_email_account->isLoaded())
$errors['email'] = 'Account with this e-mail address already exist.';
}
$account_db = new OTS_Account();
$account_db->find($account_name);
if($account_db->isLoaded())
$errors['account_name'] = 'Account with this name already exist.';
}
if(!isset($_POST['accept_rules']) || $_POST['accept_rules'] != 'true')
$errors['accept_rules'] = 'You have to agree to the ' . $config['lua']['serverName'] . ' Rules in order to create an account!';
if(empty($errors))
{
$new_account = $ots->createObject('Account');
$new_account->create($account_name);
$config_salt_enabled = fieldExist('salt', 'accounts');
if($config_salt_enabled)
{
$salt = generateRandomString(10, false, true, true);
$password = $salt . $password;
$new_account->setSalt($salt);
}
$new_account->setPassword(encrypt($password));
$new_account->setEMail($email);
$new_account->unblock();
$new_account->save();
$new_account->setCustomField("created", time());
$new_account->logAction('Account created.');
if($config['account_country']) {
$new_account->setCustomField('country', $country);
}
if($config['account_premium_days'] && $config['account_premium_days'] > 0) {
$new_account->setCustomField('premdays', $config['account_premium_days']);
$new_account->setCustomField('lastday', time());
}
if($config['account_premium_points']) {
$new_account->setCustomField('premium_points', $config['account_premium_points']);
}
if($config['mail_enabled'] && $config['account_mail_verify'])
{
$hash = md5(generateRandomString(16, true, true) . $email);
$new_account->setCustomField('email_hash', $hash);
$verify_url = BASE_URL . '?p=account&action=confirm_email&v=' . $hash;
$server_name = $config['lua']['serverName'];
$body_plain = "Hello!
Thank you for registering on $server_name!
Here are the details of your account:
Name: $account_name
Password: ************ (hidden for security reasons)
To verify your email address please click the link below:
$verify_url
If you haven't registered on $server_name please ignore this email.";
$body_html = 'Hello!<br/>
<br/>
Thank you for registering on ' . $config['lua']['serverName'] . '!<br/>
<br/>
Here are the details of your account:<br/>
Name: ' . $account_name . '<br/>
Password: ************ (hidden for security reasons)<br/>
<br/>
To verify your email address please click the link below:<br/>
' . generateLink($verify_url, $verify_url, true) . '<br/>
If you haven\'t registered on ' . $config['lua']['serverName'] . ' please ignore this email.';
if(_mail($email, 'New account on ' . $config['lua']['serverName'], $body_html, $body_plain))
{
?>
Your account has been created.<br/><br/>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr><td bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b>Account Created</b></td></tr>
<tr><td bgcolor="<?php echo $config['darkborder']; ?>'">
<table border="0" cellpadding="1"><tr><td>
<br/>Your account name is <b><?php echo $account_name; ?></b>.
You will need the account name and your password to play on <?php echo $config['lua']['serverName']; ?>.
Please keep your account name and password in a safe place and
never give your account name or password to anybody.<br/><br/>
<?php
}
else
{
echo '<br /><p class="error">An error occorred while sending email! Account not created. Try again. Error:<br/>' . $mailer->ErrorInfo . '</p>';
$new_account->delete();
}
}
else
{
echo 'Your account has been created. Now you can login and create your first character. See you in Tibia!<br/><br/>';
echo '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Account Created</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
<TABLE BORDER=0 CELLPADDING=1><TR><TD>
<br/>Your account name is <b>'.$account_name.'</b><br/>You will need the account name and your password to play on '.$config['lua']['serverName'].'.
Please keep your account name and password in a safe place and
never give your account name or password to anybody.<br/><br/>';
if($config['mail_enabled'] && $config['account_welcome_mail'])
{
$mailBody = '
<h3>Dear player,</h3>
<p>Thanks for your registration at <a href=" ' . BASE_URL . '"><b>'.$config['lua']['serverName'].'</b></a></p>
<br/><br/>
Your login details:
<p>Account name: <b>' . $account_name . '</b></p>
<p>Password: <b>' . str_repeat('*', strlen(trim($password))) . '</b> (hidden for security reasons)</p>
<p>Kind Regards,</p>';
if(_mail($email, 'Your account on ' . $config['lua']['serverName'], $mailBody))
echo '<br /><small>These informations were send on email address <b>'.$email.'</b>.';
else
echo '<br /><p class="error">An error occorred while sending email (<b>' . $email . '</b>)! Error:<br/>' . $mailer->ErrorInfo . '</p>';
}
}
echo '</TD></TR></TABLE></TD></TR></TABLE><br/><br/>';
return;
}
}
?>
<script type="text/javascript">
eventId = 0;
lastSend = 0;
$('#createaccount').submit(function(){
return validate_form(this);
});
function checkAccount()
{
if(eventId != 0)
{
clearInterval(eventId);
eventId = 0;
}
if(document.getElementById("account_name").value == "")
{
document.getElementById("acc_name_check").innerHTML = '<b><font color="red">Please enter account name.</font></b>';
return;
}
// anti flood
date = new Date;
timeNow = parseInt(date.getTime());
if(lastSend != 0)
{
if(timeNow - lastSend < 1100)
{
eventId = setInterval('checkAccount()', 1100)
return;
}
}
account = document.getElementById("account_name").value;
$.get("tools/validate.php", { account: account, uid: Math.random() },
function(data){
document.getElementById("acc_name_check").innerHTML = data;
lastSend = timeNow;
});
}
function checkEmail()
{
if(eventId != 0)
{
clearInterval(eventId)
eventId = 0;
}
if(document.getElementById("email").value == "")
{
document.getElementById("email_check").innerHTML = '<b><font color="red">Please enter e-mail.</font></b>';
return;
}
//anti flood
date = new Date;
timeNow = parseInt(date.getTime());
if(lastSend != 0)
{
if(timeNow - lastSend < 1100)
{
eventId = setInterval('checkEmail()', 1100)
return;
}
}
email = document.getElementById("email").value;
account = document.getElementById("account_name").value;
$.get("tools/validate.php", { email: email, uid: Math.random() },
function(data){
document.getElementById("email_check").innerHTML = data;
lastSend = timeNow;
});
}
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null || value=="" || value==" ")
{
alert(alerttxt);
return false;
}
else
return true
}
}
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1 || dotpos-apos<2)
{
alert(alerttxt);
return false;
}
else
return true;
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(account_name,"Please enter name of new account!")==false)
{account_name.focus();return false;}
if (validate_required(email,"Please enter your e-mail!")==false)
{email.focus();return false;}
if (validate_email(email,"Invalid e-mail format!")==false)
{email.focus();return false;}
<?php if(!$config['account_mail_verify']): ?>
if (validate_required(passor,"Please enter password!")==false)
{passor.focus();return false;}
if (validate_required(passor2,"Please repeat password!")==false)
{passor2.focus();return false;}
if (passor2.value!=passor.value)
{alert('Repeated password is not equal to password!');return false;}
<?php endif; ?>
if(accept_rules.checked==false)
{alert('To create account you must accept server rules!');return false;}
}
}
</script>
<?php
if(!empty($errors))
output_errors($errors);
?>
To play on <?php echo $config['lua']['serverName']; ?> you need an account.
All you have to do to create your new account is to enter an account name, password<?php
if($config['recaptcha_enabled']) echo ', confirm reCAPTCHA';
if($config['account_country']) echo ', country';
?> and your email address.
Also you have to agree to the terms presented below. If you have done so, your account name will be shown on the following page and your account password will be sent to your email address along with further instructions. If you do not receive the email with your password, please check your spam filter.<br/><br/>
<form action="?subtopic=createaccount" method="post" >
<div class="TableContainer" >
<table class="Table1" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" >
<div class="CaptionInnerContainer" >
<span class="CaptionEdgeLeftTop" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionEdgeRightTop" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionBorderTop" style="background-image:url(<?php echo $template_path; ?>/images/content/table-headline-border.gif);" ></span>
<span class="CaptionVerticalLeft" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-vertical.gif);" /></span>
<div class="Text" >Create <?php echo $config['lua']['serverName']; ?> Account</div>
<span class="CaptionVerticalRight" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-vertical.gif);" /></span>
<span class="CaptionBorderBottom" style="background-image:url(<?php echo $template_path; ?>/images/content/table-headline-border.gif);" ></span>
<span class="CaptionEdgeLeftBottom" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionEdgeRightBottom" style="background-image:url(<?php echo $template_path; ?>/images/content/box-frame-edge.gif);" /></span>
</div>
</div>
<tr>
<td>
<div class="InnerTableContainer" >
<table style="width:100%;" >
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['account_name'][0]) ? ' class="red"' : ''); ?>>Account Name:</span>
</td>
<td>
<input type="text" name="account_name" id="account_name" onkeyup="checkAccount();" id="account-name-input" size="30" maxlength="30" value="<?php echo (isset($_POST['account_name']) ? $_POST['account_name'] : ''); ?>" />
<small id="acc_name_check"></small>
</td>
</tr>
<?php write_if_error('account_name'); ?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['email'][0]) ? ' class="red"' : ''); ?>>Email Address:</span>
</td>
<td style="width:100%;" >
<input type="text" name="email" id="email" onkeyup="checkEmail();" size="30" maxlength="50" value="<?php echo (isset($_POST['email']) ? $_POST['email'] : ''); ?>" />
<small id="email_check"></small>
</td>
</tr>
<?php write_if_error('email'); ?>
<?php if($config['account_country']): ?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['country'][0]) ? ' class="red"' : ''); ?>>Country:</span>
</td>
<td>
<select name="country" id="account_country">
<?php
foreach(array('pl', 'se', 'br', 'us', 'gb', ) as $c)
echo '<option value="' . $c . '">' . $config['countries'][$c] . '</option>';
echo '<option value="">----------</option>';
foreach($config['countries'] as $code => $c)
echo '<option value="' . $code . '"' . ((isset($country) && $country == $code) ? ' selected' : '') . '>' . $c . '</option>';
?>
</select>
<img src="" id="account_country_img"/>
<script>
function updateFlag()
{
var img = $('#account_country_img');
var country = $('#account_country :selected').val();
if(country.length) {
img.attr('src', 'images/flags/' + country + '.gif');
img.show();
}
else {
img.hide();
}
}
$(function() {
updateFlag();
$('#account_country').change(function() {
updateFlag();
});
});
</script>
</td>
</tr>
<?php write_if_error('country'); ?>
<?php endif; ?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['password'][0]) ? ' class="red"' : ''); ?>>Password:</span>
</td>
<td>
<input type="password" name="password" value="" size="30" maxlength="50" />
</td>
</tr>
<?php write_if_error('password'); ?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['password'][0]) ? ' class="red"' : ''); ?>>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" value="" size="30" maxlength="50" />
</td>
</tr>
<?php write_if_error('password');
if($config['recaptcha_enabled']):
?>
<tr>
<td class="LabelV" >
<span<?php echo (isset($errors['verification'][0]) ? ' class="red"' : ''); ?>>Verification:</span>
</td>
<td>
<div class="g-recaptcha" data-sitekey="<?php echo $config['recaptcha_site_key']; ?>" data-theme="<?php echo $config['recaptcha_theme']; ?>"></div>
</td>
</tr>
<?php write_if_error('verification'); ?>
<?php endif; ?>
<tr>
<td><br/></td>
</tr>
<tr>
<td colspan="2" ><b>Please select all of the following check boxes:</b></td>
</tr>
<tr>
<td colspan="2" >
<span><input type="checkbox" id="accept_rules" name="accept_rules" value="true"<?php echo (isset($_POST['accept_rules']) ? ' checked' : ''); ?>/> <label for="accept_rules">I agree to the <a href="?subtopic=rules" target="_blank"><?php echo $config['lua']['serverName']; ?> Rules</a>.</label></span>
</td>
</tr>
<?php if(isset($errors['accept_rules'][0])): ?>
<tr>
<td colspan="2">
<span class="FormFieldError"><?php echo $errors['accept_rules']; ?></span>
</td>
</tr>
<?php endif; ?>
</table>
</div>
</table></div></td></tr><br/>
<table width="100%">
<tr align="center">
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td style="border:0px;" >
<input type="hidden" name="step" value="save" >
<div class="BigButton" style="background-image:url(<?php echo $template_path; ?>/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url(<?php echo $template_path; ?>/images/buttons/sbutton_over.gif);" ></div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="<?php echo $template_path; ?>/images/buttons/_sbutton_submit.gif" >
</div>
</div>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
$(function() {
$('#account-name-input').focus();
});
</script>
<?php
function write_if_error($field)
{
global $errors;
if(isset($errors[$field][0]))
echo '<tr><td></td><td><span class="FormFieldError">' . $errors[$field] . '</span></td></tr>';
}
?>

322
system/pages/creatures.php Normal file
View File

@@ -0,0 +1,322 @@
<?php
/**
* Creatures
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = "Creatures";
$rarity = array(
'Not Rare' => 7,
'Semi Rare' => 2,
'Rare' => 0.5,
'Very Rare' => 0
);
function addLoot($loot, $level=1)
{
foreach($loot as $test) {
$chance = $test['chance'];
if(!$chance)
$chance = $test['chance1'];
printLoot($level, $test['id'], $test['countmax'], $chance);
foreach($test as $k => $v)
addLoot($v->item, $level + 1);
}
}
$i = 0;
function printLoot($level, $itemid, $count, $chance)
{
global $itemList, $rarity, $i;
$chance /= 1000;
if(isset($_GET['lootrate'])) {
global $lootRate;
$chance *= $lootRate;
}
foreach($rarity as $lootRarity => $percent){
if($chance >= $percent)
{
//echo str_repeat("... ", $level) . '<u>' . ($count ? $count : 1) . '</u> <span style="color: #7878FF; font-weight: bold;">' . $itemList[(int)$itemid] . '</span> ' . $itemid . ' <span style="color: #C45; font-weight: bold;">' . $lootRarity . '</span> (<span style="color: #FF9A9A;">' . $chance . '%</span>)<br />';
if($i % 6 == 0)
{
if($i != 0)
echo '</td></tr>';
echo '<tr BGCOLOR="'.getStyle(0).'"><td width="100">';
}
echo getItemImage($itemid);
$i++;
break;
}
}
}
$canEdit = hasFlag(FLAG_CONTENT_MONSTERS) || admin();
if(isset($_POST['reload_monsters']) && $canEdit)
{
try { $db->query("DELETE FROM myaac_monsters WHERE 1 = 1"); } catch(PDOException $error) {}
echo '<h2>Reload monsters.</h2>';
echo '<h2>All records deleted from table \'myaac_monsters\' in database.</h2>';
$allmonsters = new OTS_MonstersList($config['data_path'].'monster/');
//$names_added must be an array
$names_added[] = '';
//add monsters
foreach($allmonsters as $lol) {
$monster = $allmonsters->current();
//load monster mana needed to summon/convince
$mana = $monster->getManaCost();
//load monster experience
$exp = $monster->getExperience();
//load monster name
$name = $monster->getName();
//load monster health
$health = $monster->getHealth();
//load monster speed and calculate "speed level"
$speed_ini = $monster->getSpeed();
if($speed_ini <= 220) {
$speed_lvl = 1;
} else {
$speed_lvl = ($speed_ini - 220) / 2;
}
//check "is monster use haste spell"
$defenses = $monster->getDefenses();
$use_haste = 0;
foreach($defenses as $defense) {
if($defense == 'speed') {
$use_haste = 1;
}
}
//load monster flags
$flags = $monster->getFlags();
//create string with immunities
$immunities = $monster->getImmunities();
$imu_nr = 0;
$imu_count = count($immunities);
$immunities_string = '';
foreach($immunities as $immunitie) {
$immunities_string .= $immunitie;
$imu_nr++;
if($imu_count != $imu_nr) {
$immunities_string .= ", ";
}
}
//create string with voices
$voices = $monster->getVoices();
$voice_nr = 0;
$voice_count = count($voices);
$voices_string = '';
foreach($voices as $voice) {
$voices_string .= '"'.$voice.'"';
$voice_nr++;
if($voice_count != $voice_nr) {
$voices_string .= ", ";
}
}
//load race
$race = $monster->getRace();
//create monster gfx name
//$gfx_name = str_replace(" ", "", trim(mb_strtolower($name))).".gif";
$gfx_name = trim(mb_strtolower($name)).".gif";
//don't add 2 monsters with same name, like Butterfly
if(!isset($flags['summonable']))
$flags['summonable'] = '0';
if(!isset($flags['convinceable']))
$flags['convinceable'] = '0';
if(!in_array($name, $names_added)) {
try { $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, '".$name."', '".$mana."', '".$exp."', '".$health."', '".$speed_lvl."', '".$use_haste."', '".$voices_string."', '".$immunities_string."', '".$flags['summonable']."', '".$flags['convinceable']."', '".$race."', '".$gfx_name."', '" . $allmonsters->currentFile() . "')"); } catch(PDOException $error) {}
$names_added[] = $name;
echo "Added: ".$name."<br/>";
}
}
}
if($canEdit)
{
?>
<form method="post" action="index.php?subtopic=creatures">
<input type="hidden" name="reload_monsters" value="yes"/>
<input type="submit" value="(admin) Reload monsters"/>
</form>
<?php
}
if(empty($_REQUEST['creature']))
{
$allowed_order_by = array('name', 'exp', 'health', 'summonable', 'convinceable', 'race');
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : 'name';
//generate sql query
$desc = '';
if(isset($_REQUEST['desc']) && $_REQUEST['desc'] == 1) {
$desc = " DESC";
}
if($order == 'name') {
$whereandorder = ' ORDER BY name'.$desc;
}
elseif($order == 'exp') {
$whereandorder = ' ORDER BY exp'.$desc.', name';
}
elseif($order == 'health') {
$whereandorder = ' ORDER BY health'.$desc.', name';
}
elseif($order == 'summonable') {
$whereandorder = ' AND summonable = 1 ORDER BY mana'.$desc;
}
elseif($order == 'convinceable') {
$whereandorder = ' AND convinceable = 1 ORDER BY mana'.$desc;
}
elseif($order == 'race') {
$whereandorder = ' ORDER BY race'.$desc.', name';
}
else {
$whereandorder = ' ORDER BY name';
}
//send query to database
$monsters = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'monsters').' WHERE hide_creature != 1'.$whereandorder);
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'>';
if($order == 'name' && !isset($_REQUEST['desc'])) {
echo '<TD class="white" width="200"><B><a href="?subtopic=creatures&order=name&desc=1"><font class="white">Name DESC</a></B></TD>';
} else {
echo '<TD class="white" width="200"><B><a href="?subtopic=creatures&order=name"><font class="white">Name</a></B></TD>';
}
if($order == 'health' && !isset($_REQUEST['desc'])) {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=health&desc=1"><font class="white">Health<br/>DESC</a></B></TD>';
} else {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=health"><font class="white">Health</a></B></TD>';
}
if($order == 'exp' && !isset($_REQUEST['desc'])) {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=exp&desc=1"><font class="white">Experience<br/>DESC</a></B></TD>';
} else {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=exp"><font class="white">Experience</a></B></TD>';
}
if($order == 'summonable' && !isset($_REQUEST['desc'])) {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=summonable&desc=1"><font class="white">Summonable<br/>Mana DESC</a></B></TD>';
} else {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=summonable"><font class="white">Summonable<br/>Mana</a></B></TD>';
}
if($order == 'convinceable' && !isset($_REQUEST['desc'])) {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=convinceable&desc=1"><font class="white">Convinceable<br/>Mana DESC</a></B></TD>';
} else {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=convinceable"><font class="white">Convinceable<br/>Mana</a></B></TD>';
}
if($order == 'race' && !isset($_REQUEST['desc'])) {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=race&desc=1"><font class="white">Race<br/>DESC</a></B></TD></TR>';
} else {
echo '<TD class="white"><B><a href="?subtopic=creatures&order=race"><font class="white">Race</a></B></TD></TR>';
}
$number_of_rows = 0;
foreach($monsters as $monster) {
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><TD><a href="?subtopic=creatures&creature='.urlencode($monster['name']).'">'.$monster['name'].'</a></TD><TD>'.$monster['health'].'</TD><TD>'.$monster['exp'].'</TD>';
if($monster['summonable']) {
echo '<TD>'.$monster['mana'].'</TD>';
}
else {
echo '<TD>---</TD>';
}
if($monster['convinceable']) {
echo '<TD>'.$monster['mana'].'</TD>';
}
else {
echo '<TD>---</TD>';
}
echo '<TD>'.ucwords($monster['race']).'</TD></TR>';
}
echo '</TABLE>';
return;
}
$monster_name = stripslashes(trim(ucwords($_REQUEST['creature'])));
$monster = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'monsters').' WHERE '.$db->fieldName('hide_creature').' != 1 AND '.$db->fieldName('name').' = '.$db->quote($monster_name).';')->fetch();
if(isset($monster['name']))
{
$title = $monster['name'] . " - Creatures";
echo '<center><h2>'.$monster['name'].'</h2></center>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=60%>';
$number_of_rows = 0;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Health: </b></td><td>'.$monster['health'].'</td></tr>';
$number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Experience: </b></td><td>'.$monster['exp'].'</td></tr>';
$number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Speed like: </b></td><td>'.$monster['speed_lvl'].' level';
$number_of_rows++;
if($monster['use_haste'])
echo ' (Can use haste)';
echo '</td></tr>';
$number_of_rows++;
if($monster['summonable'] == 1)
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Summon: </b></td><td>'.$monster['mana'].' mana</td></tr>';
else {
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Summon: </b></td><td>Impossible</td></tr>';
}
$number_of_rows++;
if($monster['convinceable'] == 1)
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Convince: </b></td><td>'.$monster['mana'].' mana</td></tr>';
else
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Convince: </b></td><td>Impossible</td></tr>';
echo '</TABLE></td><td align=left>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%>
<tr><td align=left>';
if(!file_exists('images/monsters/'.$monster['gfx_name'])) {
$gfx_name = str_replace(" ", "", $monster['gfx_name']);
if(file_exists('images/monsters/' . $gfx_name))
echo '<img src="images/monsters/'.$gfx_name.'" height="128" width="128">';
else
echo '<img src="images/monsters/nophoto.png" height="128" width="128">';
}
else
echo '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">';
echo '</td></tr>
</TABLE></td></tr><tr><td>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
if(!empty($monster['immunities']))
{
$number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Immunities: </b></td><td width="100%">'.$monster['immunities'].'</td></tr>';
}
if(!empty($monster['voices']))
{
$number_of_rows++;
echo '<tr BGCOLOR="'.getStyle($number_of_rows).'"><td width="100"><b>Voices: </b></td><td width="100%">'.$monster['voices'].'</td></tr>';
}
echo '</TABLE></td></tr>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
$loot = simplexml_load_file($config['server_path'] . 'data/monster/' . $monster['file_path']);
if($loot)
{
if($item = $loot->loot->item)
addLoot($item);
}
echo '</TABLE></td></tr>';
echo '</TABLE>';
}
else
{
echo 'Monster with name <b>'.$monster_name.'</b> doesn\'t exist.';
}
//back button
echo '<br/></br><center><form action="?subtopic=creatures" METHOD=post><div class="BigButton" style="background-image:url('.$template_path.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$template_path.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$template_path.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
?>

28
system/pages/custom.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/**
* Custom pages loader
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$query = $db->query('SELECT `title`, `body`, `php` FROM `' . TABLE_PREFIX . 'pages` WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1');
if($query->rowCount() > 0) // found page
{
$query = $query->fetch();
$title = $query['title'];
if($query['php'] == '1') // execute it as php code
eval($query['body']);
else
echo $query['body']; // plain html
return true;
}
return false;
?>

View File

@@ -0,0 +1,23 @@
<?php
/**
* Downloads
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
$title = 'Downloads';
?>
<br/><br/>
<center>
We're using official Tibia Client <strong><?php echo $config['client'] / 100; ?></strong><br/>
<p>Download Tibia client <?php echo ($config['client'] / 100); ?> for windows <a href="<?php echo $config['client_download']; ?>">HERE</a>.</p>
<p>Download Tibia client <?php echo ($config['client'] / 100); ?> for linux <a href="<?php echo $config['client_download_linux']; ?>">HERE</a>.</p>
<h2>IP Changer:</h2>
<a href="https://static.otland.net/ipchanger.exe" target="_blank">HERE</a>
</center>

View File

@@ -0,0 +1,70 @@
<?php
/**
* Experience stages
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Experience Stages';
if(!isset($config['lua']['experienceStages']) || !getBoolean($config['lua']['experienceStages']))
{
$enabled = false;
$stages = new DOMDocument();
$stages->load($config['data_path'] . 'XML/stages.xml');
foreach($stages->getElementsByTagName('config') as $node) {
if($node->getAttribute('enabled'))
$enabled = true;
}
if(!$enabled) {
$rate_exp = 'not set';
if(isset($config['lua']['rateExperience']))
$rate_exp = $config['lua']['rateExperience'];
else if(isset($config['lua']['rateExp']))
$rate_exp = $config['lua']['rateExp'];
else if(isset($config['lua']['rate_exp']))
$rate_exp = $config['lua']['rate_exp'];
$content .= 'Server is not configured to use experience stages.<br/>Current experience rate is: <b>x' . $rate_exp . '</b>';
return;
}
}
if(!isset($stages)) {
$stages = new DOMDocument();
$stages->load($config['data_path'] . 'XML/stages.xml');
}
if(!$stages)
{
echo 'Error: cannot load <b>stages.xml</b>!';
return;
}
$content .= '<center><h3>Experience stages</h3></center>
<table bgcolor="'.$config['darkborder'].'" border="0" cellpadding="4" cellspacing="1" width="100%"><tbody>
<tr bgcolor="'.$config['vdarkborder'].'">
<td class="white" colspan="5"><b>Stages table</b></td>
</tr>
<tr><td>
<table border="0" cellpadding="2" cellspacing="1" width="100%"><tbody>
<tr bgcolor="'.$config['lightborder'].'"><td><b>Level</b></td><td><b>Stage</b></td></tr>';
foreach($stages->getElementsByTagName('stage') as $stage)
{
$maxlevel = $stage->getAttribute('maxlevel');
$content .= '<tr bgcolor="'.$config['lightborder'].'">
<td>'.$stage->getAttribute('minlevel') . '-'. (isset($maxlevel[0]) ? $maxlevel : '*') . '</td><td>x'.$stage->getAttribute('multiplier').'</td>
</tr>';
}
$content .= '
</tbody></table>
</td></tr>
</tbody></table>';
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* Experience table
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Experience Table';
?>
This is a list of the experience points that are required to advance to the various levels.
Remember you can also check the respective skill bar in your skill window of the client to check your progress towards the next level.<br/><br/>
<table bgcolor="<?php echo $config['darkborder']; ?>" border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" colspan="5"><b>Experience Table</b></td>
</tr>
<tr>
<?php
$columns = $config['experiencetable_columns'];
for($i = 0; $i < $columns; $i++)
{
?>
<td>
<table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td><b>Level</b></td>
<td><b>Experience</b></td>
</tr>
<?php
for($level = $i * 100 + 1; $level < $i * 100 + 101; $level++)
{
?>
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td><?php echo $level; ?></td>
<td><?php echo OTS_Toolbox::experienceForLevel($level); ?></td>
</tr>
<?php
}
?>
</table>
</td>
<?php
}
?>
</tr>
</table>

66
system/pages/faq.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
/**
* FAQ
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Frequently Asked Questions';
$faqs = $db->query('SELECT ' . $db->fieldName('question') . ', ' . $db->fieldName('answer') .
' FROM ' . $db->tableName(TABLE_PREFIX . 'faq') . ' ORDER BY ' . $db->fieldName('ordering'));
if(!$faqs->rowCount())
{
?>
There are no questions added yet.
<?php
if(admin())
echo ' You can add new faq questions in phpmyadmin under ' . TABLE_PREFIX . 'faq table.';
}
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white">
<b>FAQ</b>
</td>
<td align="right">
<a href="#" onclick="toggleAll(); return false;">Toggle all</a>
</td>
</tr>
<?php
$i = 0;
foreach($faqs as $faq): ?>
<tr bgcolor="<?php echo getStyle(++$i); ?>">
<td colspan="2" style="cursor: pointer;" onclick="toggleVisibility('faq_<?php echo $i; ?>'); return false;">
<b><?php echo $faq['question']; ?></b>
<div id="faq_<?php echo $i; ?>" style="display: none;"><?php echo $faq['answer']; ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<script type="text/javascript">
var expanded = false;
function toggleVisibility(id)
{
var tmp = document.getElementById(id);
if(tmp)
tmp.style.display = tmp.style.display == 'none' ? '' : 'none';
}
function toggleAll()
{
for(i = 1; i < <?php echo $i + 1; ?>; i++)
{
document.getElementById('faq_' + i).style.display = expanded ? 'none' : '';
}
expanded = !expanded;
}
</script>

709
system/pages/forum.php Normal file
View File

@@ -0,0 +1,709 @@
<?php
/**
* Forum
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Forum';
if(strtolower($config['forum']) != 'site')
{
if($config['forum'] != '')
{
header('Location: ' . $config['forum']);
exit;
}
echo 'Forum is disabled on this site.';
return;
}
$sections = array();
foreach(getForumSections() as $section)
{
$sections[$section['id']] = array(
'name' => $section['name'],
'description' => $section['description'],
'closed' => $section['closed'] == '1'
);
}
function parseSmiles($text)
{
$smileys = array(
';D' => 1,
':D' => 1,
':cool:' => 2,
';cool;' => 2,
':ekk:' => 3,
';ekk;' => 3,
';o' => 4,
';O' => 4,
':o' => 4,
':O' => 4,
':(' => 5,
';(' => 5,
':mad:' => 6,
';mad;' => 6,
';rolleyes;' => 7,
':rolleyes:' => 7,
':)' => 8,
';d' => 9,
':d' => 9,
';)' => 10
);
foreach($smileys as $search => $replace)
$text = str_replace($search, '<img src="images/forum/smile/'.$replace.'.gif" alt="'. $search .'" title="' . $search . '" />', $text);
return $text;
}
function parseBBCode($text, $smiles)
{
$rows = 0;
while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false )
{
$code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6);
if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
$text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
{
$quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7);
if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
$text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text);
}
$rows = 0;
while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
{
$url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
$text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text);
}
$xhtml = false;
$tags = array(
'#\[b\](.*?)\[/b\]#si' => ($xhtml ? '<strong>\\1</strong>' : '<b>\\1</b>'),
'#\[i\](.*?)\[/i\]#si' => ($xhtml ? '<em>\\1</em>' : '<i>\\1</i>'),
'#\[u\](.*?)\[/u\]#si' => ($xhtml ? '<span style="text-decoration: underline;">\\1</span>' : '<u>\\1</u>'),
'#\[s\](.*?)\[/s\]#si' => ($xhtml ? '<strike>\\1</strike>' : '<s>\\1</s>'),
'#\[guild\](.*?)\[/guild\]#si' => urldecode(generateLink(getGuildLink('$1', false), '$1', true)),
'#\[house\](.*?)\[/house\]#si' => urldecode(generateLink(getHouseLink('$1', false), '$1', true)),
'#\[player\](.*?)\[/player\]#si' => urldecode(generateLink(getPlayerLink('$1', false), '$1', true)),
// TODO: [poll] tag
'#\[color=(.*?)\](.*?)\[/color\]#si' => ($xhtml ? '<span style="color: \\1;">\\2</span>' : '<font color="\\1">\\2</font>'),
'#\[img\](.*?)\[/img\]#si' => ($xhtml ? '<img src="\\1" border="0" alt="" />' : '<img src="\\1" border="0" alt="">'),
'#\[url=(.*?)\](.*?)\[/url\]#si' => '<a href="\\1" title="\\2">\\2</a>',
// '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1" title="Email \\1">\\1</a>',
'#\[code\](.*?)\[/code\]#si' => '<code>\\1</code>',
// '#\[align=(.*?)\](.*?)\[/align\]#si' => ($xhtml ? '<div style="text-align: \\1;">\\2</div>' : '<div align="\\1">\\2</div>'),
// '#\[br\]#si' => ($xhtml ? '<br style="clear: both;" />' : '<br>'),
);
foreach($tags as $search => $replace)
$text = preg_replace($search, $replace, $text);
return ($smiles == 0 ? parseSmiles($text) : $text);
}
function showPost($topic, $text, $smiles)
{
$text = nl2br($text);
$post = '';
if(!empty($topic))
$post .= '<b>'.($smiles == 0 ? parseSmiles($topic) : $topic).'</b><hr />';
$post .= parseBBCode($text, $smiles);
return $post;
}
if(!$logged)
echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum') . '">Log in</a> to post on the forum.<br /><br />';
$number_of_rows = 0;
if(empty($action))
{
echo '<b>Boards</b>';
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td><font color="white" size="1"><b>Board</b></font></td><td><font color="white" size="1"><b>Posts</b></font></td><td><font color="white" size="1"><b>Threads</b></font></td><td align="center"><font color="white" size="1"><b>Last Post</b></font></td></tr>';
$info = $db->query("SELECT `section`, COUNT(`id`) AS 'threads', SUM(`replies`) AS 'replies' FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = `id` GROUP BY `section`")->fetchAll();
foreach($info as $data)
$counters[$data['section']] = array('threads' => $data['threads'], 'posts' => $data['replies'] + $data['threads']);
foreach($sections as $id => $section)
{
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`section` = ".(int) $id." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
echo '<tr bgcolor="'.getStyle(++$number_of_rows).'"><td><a href="?subtopic=forum&action=show_board&id='.$id.'">'.$section['name'].'</a><br /><small>'.$section['description'].'</small></td><td>'.(int) (isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0).'</td><td>'.(int) (isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0).'</td><td>';
if(isset($last_post['name']))
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
else
echo 'No posts';
echo '</td></tr>';
}
echo '</table>';
return;
}
$links_to_pages = '';
if($action == 'show_board')
{
$section_id = (int) $_REQUEST['id'];
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
$threads_count = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS threads_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id`")->fetch();
for($i = 0; $i < $threads_count['threads_count'] / $config['forum_threads_per_page']; $i++)
{
if($i != $_page)
$links_to_pages .= '<a href="?subtopic=forum&action=show_board&id='.$section_id.'&page='.$i.'">'.($i + 1).'</a> ';
else
$links_to_pages .= '<b>'.($i + 1).' </b>';
}
echo '<a href="?subtopic=forum">Boards</a> >> <b>'.$sections[$section_id]['name'].'</b>';
if(!$sections[$section_id]['closed'] || Forum::isModerator())
{
echo '<br /><br />
<a href="?subtopic=forum&action=new_topic&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
}
echo '<br /><br />Page: '.$links_to_pages.'<br />';
$last_threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`last_post`, `" . TABLE_PREFIX . "forum`.`replies`, `" . TABLE_PREFIX . "forum`.`views`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`section` = ".(int) $section_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = `" . TABLE_PREFIX . "forum`.`id` ORDER BY `" . TABLE_PREFIX . "forum`.`last_post` DESC LIMIT ".$config['forum_threads_per_page']." OFFSET ".($_page * $config['forum_threads_per_page']))->fetchAll();
if(isset($last_threads[0]))
{
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>';
foreach($last_threads as $thread)
{
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>';
if(Forum::isModerator())
{
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">[REMOVE]</font></a> ';
}
echo '<a href="?subtopic=forum&action=show_thread&id='.$thread['id'].'">'.htmlspecialchars($thread['post_topic']).'</a><br /><small>'.htmlspecialchars(substr($thread['post_text'], 0, 50)).'...</small></td><td>' . getPlayerLink($thread['name']) . '</td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>';
if($thread['last_post'] > 0)
{
$last_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id']." AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` ORDER BY `post_date` DESC LIMIT 1")->fetch();
if(isset($last_post['name']))
echo date('d.m.y H:i:s', $last_post['post_date']).'<br />by ' . getPlayerLink($last_post['name']);
else
echo 'No posts.';
}
else
echo date('d.m.y H:i:s', $thread['post_date']).'<br />by ' . getPlayerLink($thread['name']);
echo '</td></tr>';
}
echo '</table>';
if(!$sections[$section_id]['closed'] || Forum::isModerator())
echo '<br /><a href="?subtopic=forum&action=new_topic&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>';
}
else
echo '<h3>No threads in this board.</h3>';
return;
}
if($action == 'show_thread')
{
$thread_id = (int) $_REQUEST['id'];
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
$thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch();
if(!empty($thread_name['name']))
{
$posts_count = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id)->fetch();
for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']; $i++)
{
if($i != $_page)
$links_to_pages .= '<a href="?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$i.'">'.($i + 1).'</a> ';
else
$links_to_pages .= '<b>'.($i + 1).' </b>';
}
$threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll();
if(isset($threads[0]['name']))
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id);
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$threads[0]['section'].'">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>';
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td>&nbsp;</td></tr>';
$player = $ots->createObject('Player');
foreach($threads as $thread)
{
if(isset($thread['promotion'])) {
if((int)$thread['promotion'] > 0)
$thread['vocation'] + ($thread['promotion'] * 4);
}
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td valign="top">' . getPlayerLink($thread['name']) . '<br /><br /><font size="1">Profession: '.$config['vocations'][$thread['vocation']].'<br />Level: '.$thread['level'].'<br />';
$player->load($thread['player_id']);
if(!$player->isLoaded()) {
error('Player not loaded');
die();
}
$rank = $player->getRank();
if($rank->isLoaded())
{
$guild = $rank->getGuild();
if($guild->isLoaded())
echo $rank->getName().' of <a href="'.getGuildLink($guild->getName(), false).'">'.$guild->getName().'</a><br />';
}
$posts = $db->query("SELECT COUNT(`id`) AS 'posts' FROM `" . TABLE_PREFIX . "forum` WHERE `author_aid`=".(int) $thread['account_id'])->fetch();
echo '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(htmlspecialchars($thread['post_topic']), htmlspecialchars($thread['post_text']), $thread['post_smile']).'</td></tr>
<tr bgcolor="'.getStyle($number_of_rows++).'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']);
if($thread['edit_date'] > 0)
{
if($thread['last_edit_aid'] != $thread['author_aid'])
echo '<br />Edited by moderator';
else
echo '<br />Edited by '.$thread['name'];
echo '<br />on '.date('d.m.y H:i:s', $thread['edit_date']);
}
echo '</font></td><td>';
if(Forum::isModerator())
if($thread['first_post'] != $thread['id'])
echo '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove post of '.$thread['name'].'?\')"><font color="red">REMOVE POST</font></a>';
else
{
echo '<a href="?subtopic=forum&action=move_thread&id='.$thread['id'].'"\')"><span style="color:darkgreen">[MOVE]</span></a>';
echo '<br/><a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.$thread['post_topic'].' <?\')"><font color="red">REMOVE THREAD</font></a>';
}
if($logged && ($thread['account_id'] == $account_logged->getId() || Forum::isModerator()))
echo '<br/><a href="?subtopic=forum&action=edit_post&id='.$thread['id'].'">EDIT POST</a>';
if($logged)
echo '<br/><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'&quote='.$thread['id'].'">Quote</a>';
echo '</td></tr>';
}
echo '</table><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a>';
}
else
echo 'Thread with this ID does not exits.';
return;
}
if(!$logged)
{
header('Location: ' . BASE_URL . '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum'));
return;
}
if($action == 'remove_post')
{
if(Forum::isModerator())
{
$id = (int) $_REQUEST['id'];
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
if($post['id'] == $id)
{
if($post['id'] == $post['first_post'])
{
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `first_post` = ".$post['id']);
header('Location: ?subtopic=forum&action=show_board&id='.$post['section']);
}
else
{
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` < ".$id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $post['first_post'])->fetch();
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
$db->query("DELETE FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$post['id']);
header('Location: ?subtopic=forum&action=show_thread&id='.$post['first_post'].'&page='.(int) $_page);
}
}
else
echo 'Post with ID '.$id.' does not exist.';
}
else
echo 'You are not logged in or you are not moderator.';
}
if($action == 'new_post')
{
if(Forum::canPost($account_logged))
{
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
$thread_id = (int) $_REQUEST['thread_id'];
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." LIMIT 1")->fetch();
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']]['name'].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">'.$thread['post_topic'].'</a> >> <b>Post new reply</b><br /><h3>'.$thread['post_topic'].'</h3>';
if(isset($thread['id']))
{
$quote = isset($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : NULL;
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : NULL;
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
$smile = (int) (isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
$saved = false;
if(isset($_REQUEST['quote']))
{
$quoted_post = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`id` = ".(int) $quote)->fetchAll();
if(isset($quoted_post[0]['name']))
$text = '[i]Originally posted by '.$quoted_post[0]['name'].' on '.date('d.m.y H:i:s', $quoted_post[0]['post_date']).':[/i][quote]'.$quoted_post[0]['post_text'].'[/quote]';
}
elseif(isset($_REQUEST['save']))
{
$lenght = 0;
for($i = 0; $i < strlen($text); $i++)
{
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++;
}
if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0)
$errors[] = 'Please select a character.';
$player_on_account = false;
if(count($errors) == 0)
{
foreach($players_from_account as $player)
if($char_id == $player['id'])
$player_on_account = true;
if(!$player_on_account)
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
}
if(count($errors) == 0)
{
$last_post = 0;
$query = $db->query('SELECT post_date FROM ' . TABLE_PREFIX . 'forum ORDER BY post_date DESC LIMIT 1');
if($query->rowCount() > 0)
{
$query = $query->fetch();
$last_post = $query['post_date'];
}
if($last_post+$config['forum_post_interval']-time() > 0 && !Forum::isModerator())
$errors[] = 'You can post one time per '.$config['forum_post_interval'].' seconds. Next post after '.($last_post+$config['forum_post_interval']-time()).' second(s).';
}
if(count($errors) == 0)
{
$saved = true;
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('null', '".$thread['id']."', '0', '".$thread['section']."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `replies`=`replies`+1, `last_post`=".time()." WHERE `id` = ".(int) $thread_id);
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".time()." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['id'])->fetch();
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$_page);
echo '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>';
}
}
if(!$saved)
{
if(!empty($errors))
output_errors($errors);
echo '<form action="?" method="POST">
<input type="hidden" name="action" value="new_post" />
<input type="hidden" name="thread_id" value="'.$thread_id.'" />
<input type="hidden" name="subtopic" value="forum" />
<input type="hidden" name="save" value="save" />
<table width="100%">
<tr bgcolor="'.$config['vdarkborder'].'">
<td colspan="2"><font color="white"><b>Post New Reply</b></font></td>
</tr>
<tr bgcolor="'.$config['darkborder'].'">
<td width="180"><b>Character:</b></td>
<td>
<select name="char_id">
<option value="0">(Choose character)</option>';
foreach($players_from_account as $player)
{
echo '<option value="'.$player['id'].'"';
if($player['id'] == $char_id)
echo ' selected="selected"';
echo '>'.$player['name'].'</option>';
}
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr>
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
if($smile == 1)
echo ' checked="checked"';
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Reply" /></center></form>';
$threads = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_smile` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` DESC LIMIT 10")->fetchAll();
echo '<table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Last 5 posts from thread: '.$thread['post_topic'].'</b></font></td></tr>';
foreach($threads as $thread)
{
echo '<tr bgcolor="' . getStyle($number_of_rows++) . '"><td>'.$thread['name'].'</td><td>'.showPost($thread['post_topic'], $thread['post_text'], $thread['post_smile']).'</td></tr>';
}
echo '</table>';
}
}
else
echo 'Thread with ID '.$thread_id.' doesn\'t exist.';
}
else
echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
}
if($action == 'edit_post')
{
if(Forum::canPost($account_logged))
{
$post_id = (int) $_REQUEST['id'];
$thread = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $post_id." LIMIT 1")->fetch();
if(isset($thread['id']))
{
$first_post = $db->query("SELECT `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`id`, `" . TABLE_PREFIX . "forum`.`section` FROM `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']]['name'].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">'.$first_post['post_topic'].'</a> >> <b>Edit post</b>';
if($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())
{
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
$saved = false;
if(isset($_REQUEST['save']))
{
$text = stripslashes(trim($_REQUEST['text']));
$char_id = (int) $_REQUEST['char_id'];
$post_topic = stripslashes(trim($_REQUEST['topic']));
$smile = (int) $_REQUEST['smile'];
$lenght = 0;
for($i = 0; $i <= strlen($post_topic); $i++)
{
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
$lenght++;
}
if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post'])
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
$lenght = 0;
for($i = 0; $i <= strlen($text); $i++)
{
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++;
}
if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0)
$errors[] = 'Please select a character.';
if(empty($post_topic) && $thread['id'] == $thread['first_post'])
$errors[] = 'Thread topic can\'t be empty.';
$player_on_account == false;
if(count($errors) == 0)
{
foreach($players_from_account as $player)
if($char_id == $player['id'])
$player_on_account = true;
if(!$player_on_account)
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
}
if(count($errors) == 0)
{
$saved = true;
if($account_logged->getId() != $thread['author_aid'])
$char_id = $thread['author_guid'];
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `author_guid` = ".(int) $char_id.", `post_text` = ".$db->quote($text).", `post_topic` = ".$db->quote($post_topic).", `post_smile` = ".(int) $smile.", `last_edit_aid` = ".(int) $account_logged->getId().",`edit_date` = ".time()." WHERE `id` = ".(int) $thread['id']);
$post_page = $db->query("SELECT COUNT(`" . TABLE_PREFIX . "forum`.`id`) AS posts_count FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`post_date` <= ".$thread['post_date']." AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread['first_post'])->fetch();
$_page = (int) ceil($post_page['posts_count'] / $config['forum_threads_per_page']) - 1;
header('Location: ?subtopic=forum&action=show_thread&id='.$thread['first_post'].'&page='.$_page);
echo '<br />Thank you for editing post.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">GO BACK TO LAST THREAD</a>';
}
}
else
{
$text = $thread['post_text'];
$char_id = (int) $thread['author_guid'];
$post_topic = $thread['post_topic'];
$smile = (int) $thread['post_smile'];
}
if(!$saved)
{
if(!empty($errors))
output_errors($errors);
echo '<br /><form action="?" method="POST"><input type="hidden" name="action" value="edit_post" /><input type="hidden" name="id" value="'.$post_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Edit Post</b></font></td></tr><tr bgcolor="'.$config['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>';
foreach($players_from_account as $player)
{
echo '<option value="'.$player['id'].'"';
if($player['id'] == $char_id)
echo ' selected="selected"';
echo '>'.$player['name'].'</option>';
}
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" value="'.htmlspecialchars($post_topic).'" name="topic" size="40" maxlength="60" /> (Optional)</td></tr>
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
if($smile == 1)
echo ' checked="checked"';
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Save Post" /></center></form>';
}
}
else
echo '<br />You are not an author of this post.';
}
else
echo '<br />Post with ID '.$post_id.' doesn\'t exist.';
}
else
echo '<br />Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
}
if($action == 'new_topic')
{
if(Forum::canPost($account_logged))
{
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
$section_id = (int) $_REQUEST['section_id'];
echo '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$section_id.'">'.$sections[$section_id]['name'].'</a> >> <b>Post new thread</b><br />';
if(isset($sections[$section_id]['name']))
{
if($sections[$section_id]['closed'] && !Forum::isModerator())
$errors[] = 'You cannot create topic on this board.';
$quote = (int) (isset($_REQUEST['quote']) ? $_REQUEST['quote'] : 0);
$text = isset($_REQUEST['text']) ? stripslashes(trim($_REQUEST['text'])) : '';
$char_id = (int) (isset($_REQUEST['char_id']) ? $_REQUEST['char_id'] : 0);
$post_topic = isset($_REQUEST['topic']) ? stripslashes(trim($_REQUEST['topic'])) : '';
$smile = (int) (isset($_REQUEST['smile']) ? $_REQUEST['smile'] : 0);
$saved = false;
if(isset($_REQUEST['save']))
{
$lenght = 0;
for($i = 0; $i < strlen($post_topic); $i++)
{
if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126)
$lenght++;
}
if($lenght < 1 || strlen($post_topic) > 60)
$errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.';
$lenght = 0;
for($i = 0; $i < strlen($text); $i++)
{
if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126)
$lenght++;
}
if($lenght < 1 || strlen($text) > 15000)
$errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.';
if($char_id == 0)
$errors[] = 'Please select a character.';
$player_on_account = false;
if(count($errors) == 0)
{
foreach($players_from_account as $player)
if($char_id == $player['id'])
$player_on_account = true;
if(!$player_on_account)
$errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account';
}
if(count($errors) == 0)
{
$last_post = 0;
$query = $db->query('SELECT post_date FROM ' . TABLE_PREFIX . 'forum ORDER BY post_date DESC LIMIT 1');
if($query->rowCount() > 0)
{
$query = $query->fetch();
$last_post = $query['post_date'];
}
if($last_post+$config['forum_post_interval']-time() > 0 && !Forum::isModerator())
$errors[] = 'You can post one time per '.$config['forum_post_interval'].' seconds. Next post after '.($last_post+$config['forum_post_interval']-time()).' second(s).';
}
if(count($errors) == 0)
{
$saved = true;
$db->query("INSERT INTO `" . TABLE_PREFIX . "forum` (`id` ,`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('null', '0', '".time()."', '".(int) $section_id."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$db->quote($text).", ".$db->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')");
$thread_id = $db->lastInsertId();
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id);
echo '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>';
}
}
if(!$saved)
{
if(!empty($errors))
output_errors($errors);
echo '<form action="?" method="POST"><input type="hidden" name="action" value="new_topic" /><input type="hidden" name="section_id" value="'.$section_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['vdarkborder'].'"><td colspan="2"><font color="white"><b>Post New Reply</b></font></td></tr><tr bgcolor="'.$config['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>';
foreach($players_from_account as $player)
{
echo '<option value="'.$player['id'].'"';
if($player['id'] == $char_id)
echo ' selected="selected"';
echo '>'.$player['name'].'</option>';
}
echo '</select></td></tr><tr bgcolor="'.$config['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr>
<tr bgcolor="'.$config['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url]http://address.com/[/url]<br />[img]http://images.com/images3.gif[/img]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr>
<tr bgcolor="'.$config['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"';
if($smile == 1)
echo ' checked="checked"';
echo '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Thread" /></center></form>';
}
}
else
echo 'Board with ID '.$board_id.' doesn\'t exist.';
}
else
echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
}
//Board Change Function. Scripted by Cybermaster and Absolute Mango
if($action == 'move_thread')
{
if(Forum::isModerator())
{
$id = (int) $_REQUEST['id'];
$post = $db->query("SELECT `id`, `section`, `first_post`, `post_topic`, `author_guid` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
$name= $db->query("SELECT `name` FROM `players` WHERE `id` = ".$post['author_guid']." ")->fetch();
if($post['id'] == $id)
{
if($post['id'] == $post['first_post'])
{
echo '<br/><table bgcolor='.$config['vdarkborder'].' border=0 cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor='.$config['vdarkborder'].'><td class=white colspan=5><B>Move thread to another board</B></td></tr>
<tr><td><table border=0 cellpadding=3 cellspacing=1 width=100%>
<tr bgcolor='.$config['lightborder'].'><td>
<FORM ACTION="" METHOD="GET">
<input type="hidden" name="subtopic" value="forum" />
<input type="hidden" name="action" value="moved_thread" />
<input type="hidden" name="id" value="'.$post['id'].'" />
<strong>THREAD:</strong> '.$post['post_topic'].'
<br/><strong>AUTHOR:</strong> '.$name[0].'
<br/><strong>BOARD:</strong> '.$sections[$post['section']]['name'].'<br/>
<br/><strong>Select the new board:&nbsp;</strong><SELECT NAME=sektion>';
foreach($sections as $id => $section) { echo '<OPTION value="'.$id.'">'.$section['name'].'</OPTION>'; } echo '</SELECT>
<INPUT TYPE="submit" VALUE="Move Thread"></FORM>
<form action="?subtopic=forum&action=show_board&id='.$post['section'].'" method="POST">
<input type="submit" value="Cancel"></form></td></tr></table></td></tr></table>';
}
}
else
echo 'Post with ID '.$id.' does not exist.';
}
else
echo 'You are not logged in or you are not moderator.';
}
if($action == 'moved_thread')
{
if(Forum::isModerator())
{
$id = (int) $_REQUEST['id'];
$board = (int) $_REQUEST['sektion'];
$post = $db->query("SELECT `id`, `first_post`, `section` FROM `" . TABLE_PREFIX . "forum` WHERE `id` = ".$id." LIMIT 1")->fetch();
if($post['id'] == $id)
{
if($post['id'] == $post['first_post'])
{
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `section` = ".$board." WHERE `id` = ".$post['id']."") or die(mysql_error());
$nPost = $db->query( 'SELECT `section` FROM `' . TABLE_PREFIX . 'forum` WHERE `id` = \''.$id.'\' LIMIT 1;' )->fetch();
header('Location: ?subtopic=forum&action=show_board&id='.$nPost['section']);
}
}
else
echo 'Post with ID '.$id.' does not exist.';
}
else
echo 'You are not logged in or you are not moderator.';
}
class Forum
{
static public function canPost($account)
{
global $db, $config;
if(!$account->isLoaded() || $account->isBanned())
return false;
if(self::isModerator())
return true;
return
$db->query(
'SELECT ' . $db->fieldName('id') .
' FROM ' . $db->tableName('players') .
' WHERE ' . $db->fieldName('account_id') . ' = ' . $db->quote($account->getId()) .
' AND ' . $db->fieldName('level') . ' >= ' . $db->quote($config['forum_level_required']) .
' LIMIT 1')->rowCount() > 0;
}
static public function isModerator() {
return hasFlag(FLAG_CONTENT_FORUM) || admin();
}
}

2359
system/pages/guilds.php Normal file

File diff suppressed because it is too large Load Diff

317
system/pages/highscores.php Normal file
View File

@@ -0,0 +1,317 @@
<?php
/**
* Highscores
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Highscores';
if($config['account_country'] && $config['highscores_country_box'])
require(SYSTEM . 'countries.conf.php');
$list = isset($_GET['list']) ? $_GET['list'] : '';
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : NULL;
$add_sql = '';
$config_vocations = $config['vocations'];
if($config['highscores_vocation_box'] && isset($vocation))
{
for($i = 1; $i < count($config_vocations) / 2; $i++)
{
if(strtolower($config_vocations[$i]) == $vocation)
{
$add_sql = 'AND ' . $db->fieldName('vocation') . ' = ' . $db->quote($i);
break;
}
}
}
$skill = POT::SKILL__LEVEL;
if(is_numeric($list))
{
$list = intval($list);
if($list >= POT::SKILL_FIRST && $list <= SKILL__LAST)
$skill = $list;
}
else
{
switch($list)
{
case 'fist':
$skill = POT::SKILL_FIST;
break;
case 'club':
$skill = POT::SKILL_CLUB;
break;
case 'sword':
$skill = POT::SKILL_SWORD;
break;
case 'axe':
$skill = POT::SKILL_AXE;
break;
case 'distance':
$skill = POT::SKILL_DIST;
break;
case 'shield':
$skill = POT::SKILL_SHIELD;
break;
case 'fishing':
$skill = POT::SKILL_FISH;
break;
case 'level':
$skill = POT::SKILL_LEVEL;
break;
case 'magic':
$skill = POT::SKILL__MAGLEVEL;
break;
case 'frags':
if($config['highscores_frags'] && $config['otserv_version'] == TFS_03)
$skill = 666;
break;
}
}
$promotion = '';
if(fieldExist('promotion', 'players'))
$promotion = ',promotion';
$online = '';
if(fieldExist('online', 'players'))
$online = ',online';
$deleted = 'deleted';
if(fieldExist('deletion', 'players'))
$deleted = 'deletion';
$offset = $_page * 100;
if($skill <= POT::SKILL_LAST) { // skills
if(fieldExist('skill_fist', 'players')) {// tfs 1.0
$skill_ids = array(
POT::SKILL_FIST => 'skill_fist',
POT::SKILL_CLUB => 'skill_club',
POT::SKILL_SWORD => 'skill_sword',
POT::SKILL_AXE => 'skill_axe',
POT::SKILL_DIST => 'skill_dist',
POT::SKILL_SHIELD => 'skill_shielding',
POT::SKILL_FISH => 'skill_fishing',
);
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ', ' . $skill_ids[$skill] . ' as value FROM accounts,players WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND accounts.id = players.account_id ORDER BY ' . $skill_ids[$skill] . ' DESC LIMIT 101 OFFSET '.$offset);
}
else
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',value,level,vocation' . $promotion . ' FROM accounts,players,player_skills WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id > 6 AND players.id = player_skills.player_id AND player_skills.skillid = '.$skill.' AND accounts.id = players.account_id ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
}
else if($skill == 666 && $config['otserv_version'] == TFS_03) // frags
{
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,vocation' . $promotion . ',COUNT(`player_killers`.`player_id`) as value' .
' FROM `accounts`, `players`, `player_killers` ' .
' WHERE players.' . $deleted . ' = 0 AND players.group_id < '.$config['highscores_groups_hidden'].' '.$add_sql.' AND players.id = player_killers.player_id AND accounts.id = players.account_id' .
' GROUP BY `player_id`' .
' ORDER BY value DESC' .
' LIMIT 101 OFFSET '.$offset);
}
else
{
if($skill == POT::SKILL__MAGLEVEL) {
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',maglevel,level,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
}
else { // level
$skills = $db->query('SELECT accounts.country, players.id,players.name' . $online . ',level,experience,vocation' . $promotion . ' FROM accounts, players WHERE players.' . $deleted . ' = 0 '.$add_sql.' AND players.group_id < '.$config['highscores_groups_hidden'].' AND players.id > 6 AND accounts.id = players.account_id ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
$list = 'experience';
}
}
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<center><h2>Ranking for <?php echo ($skill == 666 ? 'Frags' : getSkillName($skill)); if(isset($vocation)) echo ' (' . $vocation . ')';?> on <?php echo $config['lua']['serverName']; ?></h2></center><br/>
<table border="0" cellpadding="4" cellspacing="1" width="100%"></table>
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<?php if($config['account_country']): ?>
<td width="11px" class="white">#</td>
<?php endif; ?>
<td width="10%" class="white"><b>Rank</b></td>
<td width="75%" class="white"><b>Name</b></td>
<td width="15%" class="white"><b><?php echo ($skill != 666 ? 'Level' : 'Frags'); ?></b></td>
<?php if($skill == POT::SKILL__LEVEL): ?>
<td class="white"><b>Points</b></td>
<?php endif; ?>
</tr>
<tr>
<?php
$show_link_to_next_page = false;
$i = 0;
$online_exist = false;
if(fieldExist('online', 'players'))
$online_exist = true;
foreach($skills as $player)
{
if(!$online_exist) {
$query = $db->query('SELECT `player_id` FROM `players_online` WHERE `player_id` = ' . $player['id']);
$player['online'] = $query->rowCount() > 0;
}
if(++$i <= 100)
{
if($skill == POT::SKILL__MAGIC)
$player['value'] = $player['maglevel'];
if($skill == POT::SKILL__LEVEL)
$player['value'] = $player['level'];
echo '
<tr bgcolor="' . getStyle($i) . '">';
if($config['account_country'])
echo '<td>' . getFlagImage($player['country']) . '</td>';
echo '
<td>' . ($offset + $i) . '.</td>
<td>
<a href="' . getPlayerLink($player['name'], false) . '">
<font color="' . ($player['online'] > 0 ? 'green' : 'red') . '">' . $player['name'] . '</font>
</a>';
if($config['highscores_vocation']) {
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
}
echo '<br/><small>' . $config['vocations'][$player['vocation']] . '</small>';
}
echo '
</td>
<td>
<center>'.$player['value'].'</center>
</td>';
if($skill == POT::SKILL__LEVEL)
echo '<td><center>' . $player['experience'] . '</center></td>';
echo '</tr>';
}
else
$show_link_to_next_page = true;
}
if(!$i)
echo '<tr bgcolor="' . $config['darkborder'] . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 : 4) . '">No records yet.</td></tr>';
?>
</table>
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<?php
//link to previous page if actual page is not first
if($_page > 0)
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($_page - 1).'" CLASS="size_xxs">Previous Page</A></TD></TR>';
//link to next page if any result will be on next page
if($show_link_to_next_page)
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($_page + 1).'" CLASS="size_xxs">Next Page</A></TD></TR>';
//end of page
echo '</TABLE>
</TD>
<TD WIDTH=5%>
<IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=1 HEIGHT=1 BORDER=0></TD>
<TD WIDTH=15% VALIGN=top ALIGN=right>';
/*
if($config['highscores_country_box'])
{
echo
'<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="' . $config['vdarkborder'] . '">
<TD CLASS=whites><B>Choose a country</B></TD>
</TR>
<TR BGCOLOR="'.$config['lightborder'].'">
<TD>
<A HREF="?subtopic=highscores&list=' . $list . '" CLASS="size_xs">[ALL]</A><BR>';
for($i = 1; $i < count($config_vocations); $i++)
echo '<A HREF="?subtopic=highscores&list=' . $list . '&vocation=' . strtolower($config_vocations[$i]) . '" CLASS="size_xs">' . $config_vocations[$i] . '</A><BR>';
echo '
</TD>
</TR>
</TABLE>';
}*/
echo '
<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="'.$config['vdarkborder'].'">
<TD CLASS=whites><B>Choose a skill</B></TD>
</TR>
<TR BGCOLOR="'.$config['lightborder'].'">
<TD>';
$types = array(
'experience' => 'Experience',
'magic' => 'Magic',
'shield' => 'Shielding',
'distance' => 'Distance',
'club' => 'Club',
'sword' => 'Sword',
'axe' => 'Axe',
'fist' => 'Fist',
'fishing' => 'Fishing',
);
foreach($types as $link => $name) {
if($config['friendly_urls'])
echo '<A HREF="' . getPageLink('highscores') . '/' . $link . (isset($vocation) ? '/' . $vocation : '') . '" CLASS="size_xs">' . $name . '</A><BR>';
else
echo '<A HREF="' . getPageLink('highscores') . '&list=' . $link . (isset($vocation) ? '&vocation=' . $vocation : '') . '" CLASS="size_xs">' . $name . '</A><BR>';
}
if($config['highscores_frags'])
if($config['friendly_urls'])
echo '<A HREF="' . getPageLink('highscores') . '/frags" CLASS="size_xs">Frags</A><BR>';
else
echo '<A HREF="' . getPageLink('highscores') . '&list=frags' . (isset($vocation) ? '&vocation=' . $vocation : '') . '" CLASS="size_xs">Frags</A><BR>';
echo '</TD>
</TR>
</TABLE><BR>';
if($config['highscores_vocation_box'])
{
echo
'<TABLE BORDER=0 width="100%" CELLPADDING=4 CELLSPACING=1>
<TR BGCOLOR="' . $config['vdarkborder'] . '">
<TD CLASS=whites><B>Choose a vocation</B></TD>
</TR>
<TR BGCOLOR="'.$config['lightborder'].'">
<TD>
<A HREF="' . getPageLink('highscores') . ($config['friendly_urls'] ? '/' : '&list=') . $list . '" CLASS="size_xs">[ALL]</A><BR>';
for($i = 1; $i < count($config_vocations) / 2; $i++) {
if($config['friendly_urls'])
echo '<A HREF="' . getPageLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" CLASS="size_xs">' . $config_vocations[$i] . '</A><BR>';
else
echo '<A HREF="' . getPageLink('highscores') . '&list=' . $list . '&vocation=' . strtolower($config_vocations[$i]) . '" CLASS="size_xs">' . $config_vocations[$i] . '</A><BR>';
}
echo '
</TD>
</TR>
</TABLE>';
}
?>
</td>
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
</tr>
</table>

306
system/pages/houses.php Normal file
View File

@@ -0,0 +1,306 @@
<?php
/**
* Houses
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Houses';
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
$rent = 'never';
$state = '';
$order = '';
$type = '';
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><img src="<?php echo $template_path; ?>/images/general/blank.gif" width="10" height="1" border="0"></td>
<td>
<?php
if(isset($_GET['page']) && $_GET['page'] == 'view' && isset($_REQUEST['house']))
{
$beds = array("", "one", "two", "three", "fourth", "fifth");
$houseName = $_REQUEST['house'];
$house = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName));
if($house->rowCount() > 0)
{
$house = $house->fetch();
$houseId = $house['id'];
$title = $house['name'] . ' - ' . $title;
echo '
<table border="0" cellspacing="1" cellpadding="4">
<tr><td valign="top">';
$img_path = 'images/houses/' . $houseId . '.gif';
if(file_exists($img_path))
echo '<img src="' . $img_path . '">';
else
echo '<img src="images/houses/default.jpg">';
echo '
</td>
<td valign="top"><B>' . $house['name'] . '</b><br>This house ';
$houseBeds = $house['beds'];
if($houseBeds > 0)
echo 'has ' . (isset($beds[$houseBeds]) ? $beds[$houseBeds] : $houseBeds) . ' bed' . ($houseBeds > 1 ? 's' : '');
else
echo 'dont have any beds';
echo '.<br/><br/>The house has a size of <b>' . $house['size'] . ' square meters</b>.';
if($rent != 'never')
echo ' The ' . $rent . ' rent is <b>' . $house['rent'] . ' gold</b> and will be debited to the bank account on <b>' . $config['lua']['serverName'] . '</b>.';
$houseOwner = $house['owner'];
if($houseOwner > 0)
{
echo '<br/><br/>The house has been rented by ';
if($house['guild'] == 1)
{
$guild = new OTS_Guild();
$guild->load($houseOwner);
echo getGuildLink($guild->getName());
}
else
echo getCreatureName($houseOwner) . '.';
if($rent != 'never' && $house['paid'] > 0)
{
$who = '';
if($guild)
$who = $guild->getName();
else
{
$player = $ots->createObject('Player');
$player->load($houseOwner);
if($player->isLoaded())
{
$sexs = array('She', 'He');
$who = $sexs[$player->getSex()];
}
}
echo ' ' . $who . ' has paid the rent until <b>' . date("M d Y, H:i:s", $house['paid']) . ' CEST</b>.';
}
}
echo '</TD></TR></TABLE>';
}
else
echo 'House with name ' . $houseName . ' does not exists.';
}
else
{
echo '
Here you can see the list of all available houses, flats' . (tableExist('guild', 'houses') ? ' or guildhall' : '') . '.
Click on any view button to get more information about a house or adjust
the search criteria and start a new search.<br/><br/>';
if(isset($config['lua']['houseCleanOld'])) {
$cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
if($cleanOld > 0 || $rent != 'never')
{
echo '<b>Every morning during global server save there is automatic house cleaning. Server delete house owners who have not logged in last ' . $cleanOld . ' days';
if($rent != 'never')
{
echo ' or have not paid ' . $rent . ' house rent. Remember to leave money for a rent in ';
$bank = getBoolean($config['lua']['bankSystem']);
if($bank)
echo 'your house bank account or ';
echo 'depo in same city where you have house!';
}
else
echo '.';
echo '</b><br/><br/>';
}
}
echo '<br/>';
if(isset($_POST['town']) && isset($_POST['state']) && isset($_POST['order'])
&& (isset($_POST['type']) || !tableExist('guild', 'houses')))
{
$order = $_POST['order'];
$orderby = '`name`';
if(!empty($order))
{
if($order == 'size')
$orderby = '`size`';
else if($order == 'rent')
$orderby = '`rent`';
}
$town = 'town';
if(fieldExist('town_id', 'houses'))
$town = 'town_id';
else if(fieldExist('townid', 'houses'))
$town = 'townid';
$whereby = '`' . $town . '` = ' .(int)$_POST['town'];
$state = $_POST['state'];
if(!empty($state))
$whereby .= ' AND `owner` ' . ($state == 'free' ? '' : '!'). '= 0';
$type = isset($_POST['type']) ? $_POST['type'] : NULL;
if($type == 'guildhalls' && !fieldExist('guild', 'houses'))
$type = 'all';
if(!empty($type) && $type != 'all')
$whereby .= ' AND `guild` ' . ($type == 'guildhalls' ? '!' : '') . '= 0';
$houses_info = $db->query('SELECT * FROM `houses` WHERE ' . $whereby. ' ORDER BY ' . $orderby);
echo '
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['vdarkborder'].'>
<TD COLSPAN=6 class="white"><B>Available ' . ($type == 'guildhalls' ? 'Guildhalls' : 'Houses and Flats').' in '.$config['towns'][$_POST['town']].' on <b>'.$config['lua']['serverName'].'</b></B></TD>
</TR>
<TR BGCOLOR='.$config['darkborder'].'>';
if($houses_info->rowCount() > 0)
{
echo '
<TD WIDTH=40%><B>Name</B></TD>
<TD WIDTH=10%><B>Size</B></TD>
<TD WIDTH=10%><B>Rent</B></TD>
<TD WIDTH=40%><B>Status</B></TD>
<TD>&#160;</TD>';
}
else
echo '<TD>No ' . ($type == 'guildhalls' ? 'guildhalls' : 'houses') . ' with specified criterias.</TD>';
echo '</TR>';
$players_info = $db->query("SELECT `houses`.`id` AS `houseid` , `players`.`name` AS `ownername` , `accounts`.`premdays` AS `premdays` , `accounts`.`lastday` AS `lastlogin` FROM `houses` , `players` , `accounts` WHERE `players`.`id` = `houses`.`owner` AND `accounts`.`id` = `players`.`account_id`");
$players = array();
foreach($players_info->fetchAll() as $player)
$players[$player['houseid']] = array('name' => $player['ownername']);
$rows = 1;
foreach($houses_info->fetchAll() as $house)
{
$owner = isset($players[$house['id']]) ? $players[$house['id']] : array();
echo
'<TR BGCOLOR="'.getStyle($rows).'">
<TD WIDTH="40%"><NOBR>'.$house['name'].'</TD>
<TD WIDTH="10%"><NOBR>'.$house['size'].' sqm</TD>
<TD WIDTH="10%"><NOBR>'.$house['rent'].' gold</TD>
<TD WIDTH="40%"><NOBR>';
if(fieldExist('guild', 'houses') && $house['guild'] == 1 && $house['owner'] != 0)
{
$guild = new OTS_Guild();
$guild->load($house['owner']);
echo 'Rented by ' . getGuildLink($guild->getName());
}
else
{
if(!empty($owner['name']))
echo 'Rented by ' . getPlayerLink($owner['name']);
else
echo
'Free';
}
echo '
</TD>
<TD>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<FORM ACTION=?subtopic=houses&page=view METHOD=post>
<TR><TD>
<INPUT TYPE=hidden NAME=house VALUE="'.$house['name'].'">
<INPUT TYPE=image NAME="View" ALT="View" SRC="'.$template_path.'/images/buttons/sbutton_view.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR>
</FORM>
</TABLE>
</TD>
</TR>';
$rows++;
}
echo
'</TABLE>'.
'<br/><br/>';
}
echo '
<form method="post">
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR=' . $config['vdarkborder'] . '>
<TD COLSPAN=4 class="white"><B>House Search</B></TD>
</TR>
<TR BGCOLOR=' . $config['darkborder'] . '>
<TD WIDTH=25%><B>Town</B></TD>
<TD WIDTH=25%><B>Status</B></TD>
<TD WIDTH=25%><B>Order</B></TD>
</TR>
<TR BGCOLOR=' . $config['darkborder'] . '>
<TD VALIGN=top ROWSPAN=2>';
$townId = isset($_POST['town']) ? $_POST['town'] : '';
$i = 0;
$checked = false;
foreach($config['towns'] as $id => $name)
{
if($id == 0)
continue;
$i++;
if(((empty($townId) && !empty($name)) || $id == $townId) && !$checked)
{
$add = 'CHECKED';
$checked = true;
}
else
$add = '';
if(!empty($name))
echo '<INPUT TYPE=radio NAME="town" id="town_' . $id . '" VALUE="'.$id.'" '.$add.'><label for="town_' . $id . '"> '.$name.'</label><BR>';
}
echo '
</TD>
<TD VALIGN=top>
<INPUT TYPE=radio NAME="state" id="state_all" VALUE="" '.(empty($state) ? 'CHECKED' : '').'><label for="state_all"> all states</label><br/>
<INPUT TYPE=radio NAME="state" id="state_free" VALUE="free" '.($state == 'free' ? 'CHECKED' : '').'><label for="state_free"> free</label><br/>
<INPUT TYPE=radio NAME="state" id="state_rented" VALUE="rented" '.($state == 'rented' ? 'CHECKED' : '').'><label for="state_rented"> rented</label><br/>
</TD>
<TD VALIGN=top ROWSPAN=2>
<INPUT TYPE=radio NAME="order" id="order_name" VALUE="" '.(empty($order) ? 'CHECKED' : '').'><label for="order_name"> by name</label><br/>
<INPUT TYPE=radio NAME="order" id="order_size" VALUE="size" '.($order == 'size' ? 'CHECKED' : '').'><label for="order_size"> by size</label><br/>
<INPUT TYPE=radio NAME="order" id="order_rent" VALUE="rent" '.($order == 'rent' ? 'CHECKED' : '').'><label for="order_rent"> by rent</label><br/>
</TD>
</TR>';
if(fieldExist('guild', 'houses')) {
echo '
<TR BGCOLOR='.$config['darkborder'].'>
<TD VALIGN=top>
<INPUT TYPE=radio NAME="type" VALUE="" '.(empty($type) ? 'CHECKED' : '').'> all<BR>
<INPUT TYPE=radio NAME="type" VALUE="houses" '.($type == 'houses' ? 'CHECKED' : '').'> houses and flats<BR>
<INPUT TYPE=radio NAME="type" VALUE="guildhalls" '.($type == 'guildhalls' ? 'CHECKED' : '').'> guildhalls<BR>
</TD>
</TR>';
}
echo '
</TABLE>
<BR>
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18>
</TD></TR></FORM></TABLE>
</CENTER>';
}
echo '
</TD>
<TD><IMG SRC="'.$template_path.'/images/general/blank.gif" WIDTH=10 HEIGHT=1 BORDER=0></TD>
</TR>
</TABLE>
';
?>

109
system/pages/lastkills.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
/**
* Last kills
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Last Kills';
$players_deaths_count = 0;
$players_rows = '';
if(tableExist('player_killers')) // tfs 0.3
{
$players_deaths = $db->query('SELECT `player_deaths`.`id`, `player_deaths`.`date`, `player_deaths`.`level`, `players`.`name`, `players`.`world_id` FROM `player_deaths` LEFT JOIN `players` ON `player_deaths`.`player_id` = `players`.`id` ORDER BY `date` DESC LIMIT 0, ' . $config['last_kills_limit']);
if(!empty($players_deaths))
{
foreach($players_deaths as $death)
{
$players_rows .= '<TR BGCOLOR="' . getStyle($players_deaths_count++) . '"><TD WIDTH="30"><center>'.$players_deaths_count.'.</center></TD><TD WIDTH="125"><small>'.date("j.m.Y, G:i:s",$death['date']).'</small></TD><TD>' . getPlayerLink($death['name']). ' ';
$killers = $db->query("SELECT environment_killers.name AS monster_name, players.name AS player_name, players.deleted AS player_exists
FROM killers LEFT JOIN environment_killers ON killers.id = environment_killers.kill_id
LEFT JOIN player_killers ON killers.id = player_killers.kill_id LEFT JOIN players ON players.id = player_killers.player_id
WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, killers.id ASC")->fetchAll();
$i = 0;
$count = count($killers);
foreach($killers as $killer)
{
$i++;
if($killer['player_name'] != "")
{
if($i == 1)
{
if($count <= 4)
$players_rows .= 'killed';
elseif($count > 4 and $count < 10)
$players_rows .= 'slain';
elseif($count > 9 and $count < 15)
$players_rows .= 'crushed';
elseif($count > 14 and $count < 20)
$players_rows .= 'eliminated';
elseif($count > 19)
$players_rows .= 'annihilated';
$players_rows .= 'at level <b>' . $death['level'] . '</b> by ';
}
else if($i == $count)
$players_rows .= ' and';
else
$players_rows .= ',';
$players_rows .= ' by ';
if($killer['monster_name'] != '')
$players_rows .= $killer['monster_name'] . ' summoned by ';
if($killer['player_exists'] == 0)
$players_rows .= getPlayerLink($killer['player_name']);
}
else
{
if($i == 1)
$players_rows .= 'died at level <b>' . $death['level'] . '</b>';
else if($i == $count)
$players_rows .= ' and';
else
$players_rows .= ',';
$players_rows .= ' by ' . $killer['monster_name'];
}
}
$players_rows .= '.</TD>';
if($config['multiworld'])
$player_rows .= '<TD>'.$config['worlds'][(int)$death['world_id']].'</TD>';
$players_rows .= '</TR>';
}
}
}
else {
//$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `player_deaths`.`killed_by` as `killed_by`, `player_deaths`.`time` as `time`, `player_deaths`.`is_player` as `is_player`, `player_deaths`.`level` as `level` FROM `player_deaths`, `players` as `d` INNER JOIN `players` as `p` ON player_deaths.player_id = p.id WHERE player_deaths.`is_player`='1' ORDER BY `time` DESC LIMIT " . $config['last_kills_limit'] . ";");
$players_deaths = $db->query("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time`, `d`.`level`, `d`.`is_player` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id ORDER BY `time` DESC LIMIT 20;");
if(!empty($players_deaths))
{
foreach($players_deaths as $death)
{
$players_rows .= '<TR BGCOLOR="' . getStyle($players_deaths_count++) . '"><TD WIDTH="30"><center>'.$players_deaths_count.'.</center></TD><TD WIDTH="125"><small>'.date("j.m.Y, G:i:s",$death['time']).'</small></TD><TD>' . getPlayerLink($death['victim']). ' died at level ' . $death['level'] . ' by ';
if($death['is_player'] == '1')
$players_rows .= getPlayerLink($death['killed_by']);
else
$players_rows .= $death['killed_by'];
$players_rows .= '.</TR>';
}
}
}
if($players_deaths_count == 0)
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['vdarkborder'].'"><TD class="white"><B>Last Deaths</B></TD></TR><TR BGCOLOR='.$config['darkborder'].'><TD><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1><TR><TD>No one died on '.$config['lua']['serverName'].'.</TD></TR></TABLE></TD></TR></TABLE><BR>';
else
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR="'.$config['vdarkborder'].'"><TD class="white"><B>Last Deaths</B></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>'.$players_rows.'</TABLE>';
?>

View File

@@ -0,0 +1,570 @@
<?php
/**
* Lost account
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Lost Account Interface';
$config_salt_enabled = fieldExist('salt', 'accounts');
if($config['mail_enabled'])
{
if($action == '')
{
echo 'The Lost Account Interface can help you to get back your account name and password. Please enter your character name and select what you want to do.<BR>
<FORM ACTION="?subtopic=lostaccount&action=step1" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter your character name</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
<INPUT TYPE=text NAME="nick" id="name-input" VALUE="" SIZE="40"><BR>
</TD></TR>
</TABLE>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>What do you want?</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
<INPUT TYPE=radio NAME="action_type" id="action_type_email" VALUE="email"><label for="action_type_email"> Send me new password and my account name to account e-mail adress.</label><BR>
<INPUT TYPE=radio NAME="action_type" id="action_type_key" VALUE="reckey"><label for="action_type_key"> I got <b>recovery key</b> and want set new password and e-mail adress to my account.</label><BR>
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
?>
<script type="text/javascript">
$(function() {
$('#name-input').focus();
});
</script>
<?php
}
elseif($action == 'step1' && $_REQUEST['action_type'] == '')
echo 'Please select action.
<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
elseif($action == 'step1' && $_REQUEST['action_type'] == 'email')
{
$nick = stripslashes($_REQUEST['nick']);
if(check_name($nick))
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_next') < time())
echo 'Please enter e-mail to account with this character.<BR>
<FORM ACTION="?subtopic=lostaccount&action=sendcode" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter e-mail to account</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Character: <INPUT TYPE=text NAME="nick" VALUE="'.$nick.'" SIZE="40" readonly="readonly"><BR>
E-mail to account:<INPUT TYPE=text NAME="email" VALUE="" SIZE="40"><BR>
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
else
{
$insec = $account->getCustomField('email_next') - time();
$minutesleft = floor($insec / 60);
$secondsleft = $insec - ($minutesleft * 60);
$timeleft = $minutesleft.' minutes '.$secondsleft.' seconds';
echo 'Account of selected character (<b>'.$nick.'</b>) received e-mail in last '.ceil($config['email_lai_sec_interval'] / 60).' minutes. You must wait '.$timeleft.' before you can use Lost Account Interface again.';
}
}
else
echo 'Player or account of player <b>'.$nick.'</b> doesn\'t exist.';
}
else
echo 'Invalid player name format. If you have other characters on account try with other name.';
echo '<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'sendcode')
{
$email = $_REQUEST['email'];
$nick = stripslashes($_REQUEST['nick']);
if(check_name($nick))
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_next') < time())
{
if($account->getEMail() == $email)
{
$newcode = generateRandomString(30, true, false, true);
$mailBody = '
You asked to reset your ' . $config['lua']['serverName'] . ' password.<br/>
<p>Account name: '.$account->getName().'</p>
<br />
To do so, please click this link:
<p><a href="' . BASE_URL . '/?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'">'.BASE_URL.'/?subtopic=lostaccount&action=checkcode&code='.$newcode.'&character='.urlencode($nick).'</a></p>
<p>or open page: <i>' . BASE_URL . '/?subtopic=lostaccount&action=checkcode</i> and in field "code" write <b>'.$newcode.'</b></p>
<br/>
<p>If you did not request a password change, you may ignore this message and your password will remain unchanged.';
$account_mail = $account->getCustomField('email');
if(_mail($account_mail, $config['lua']['serverName'].' - Recover your account', $mailBody))
{
$account->setCustomField('email_code', $newcode);
$account->setCustomField('email_next', (time() + $config['email_lai_sec_interval']));
echo '<br />Details about steps required to recover your account has been sent to <b>' . $account_mail . '</b>. You should receive this email within 15 minutes. Please check your inbox/spam directory.';
}
else
{
$account->setCustomField('email_next', (time() + 60));
echo '<br /><p class="error">An error occorred while sending email! Try again or contact with admin. Error:<br/>' . $mailer->ErrorInfo . '</p>';
}
}
else
echo 'Invalid e-mail to account of character <b>'.$nick.'</b>. Try again.';
}
else
{
$insec = $account->getCustomField('email_next') - time();
$minutesleft = floor($insec / 60);
$secondsleft = $insec - ($minutesleft * 60);
$timeleft = $minutesleft.' minutes '.$secondsleft.' seconds';
echo 'Account of selected character (<b>'.$nick.'</b>) received e-mail in last '.ceil($config['email_lai_sec_interval'] / 60).' minutes. You must wait '.$timeleft.' before you can use Lost Account Interface again.';
}
}
else
echo 'Player or account of player <b>'.$nick.'</b> doesn\'t exist.';
}
else
echo 'Invalid player name format. If you have other characters on account try with other name.';
echo '<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount&action=step1&action_type=email&nick='.urlencode($nick).'" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'step1' && $_REQUEST['action_type'] == 'reckey')
{
$nick = stripslashes($_REQUEST['nick']);
if(check_name($nick))
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
$account_key = $account->getCustomField('key');
if(!empty($account_key))
{
echo 'If you enter right recovery key you will see form to set new e-mail and password to account. To this e-mail will be send your new password and account name.<BR>
<FORM ACTION="?subtopic=lostaccount&action=step2" METHOD=post>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter your recovery key</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Character name:&nbsp;<INPUT TYPE=text NAME="nick" VALUE="'.$nick.'" SIZE="40" readonly="readonly"><BR />
Recovery key:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=text NAME="key" VALUE="" SIZE="40"><BR>
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
else
echo 'Account of this character has no recovery key!';
}
else
echo 'Player or account of player <b>'.$nick.'</b> doesn\'t exist.';
}
else
echo 'Invalid player name format. If you have other characters on account try with other name.';
echo '<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'step2')
{
$rec_key = trim($_REQUEST['key']);
$nick = stripslashes($_REQUEST['nick']);
if(check_name($nick))
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
$account_key = $account->getCustomField('key');
if(!empty($account_key))
{
if($account_key == $rec_key)
{
echo '<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value==""||value==" ")
{alert(alerttxt);return false;}
else {return true}
}
}
function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2)
{alert(alerttxt);return false;}
else {return true;}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(email,"Please enter your e-mail!")==false)
{email.focus();return false;}
if (validate_email(email,"Invalid e-mail format!")==false)
{email.focus();return false;}
if (validate_required(passor,"Please enter password!")==false)
{passor.focus();return false;}
if (validate_required(passor2,"Please repeat password!")==false)
{passor2.focus();return false;}
if (passor2.value!=passor.value)
{alert(\'Repeated password is not equal to password!\');return false;}
}
}
</script>';
echo 'Set new password and e-mail to your account.<BR>
<FORM ACTION="?subtopic=lostaccount&action=step3" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Please enter new password and e-mail</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Account of character:&nbsp;&nbsp;<INPUT TYPE=text NAME="nick" VALUE="'.$nick.'" SIZE="40" readonly="readonly"><BR />
New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT id="passor" TYPE=password NAME="passor" VALUE="" SIZE="40"><BR>
Repeat new password:&nbsp;&nbsp;<INPUT id="passor2" TYPE=password NAME="passor" VALUE="" SIZE="40"><BR>
New e-mail address:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT id="email" TYPE=text NAME="email" VALUE="" SIZE="40"><BR>
<INPUT TYPE=hidden NAME="key" VALUE="'.$rec_key.'">
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
else
echo 'Wrong recovery key!';
}
else
echo 'Account of this character has no recovery key!';
}
else
echo 'Player or account of player <b>'.$nick.'</b> doesn\'t exist.';
}
else
echo 'Invalid player name format. If you have other characters on account try with other name.';
echo '<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount&action=step1&action_type=reckey&nick='.urlencode($nick).'" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'step3')
{
$rec_key = trim($_REQUEST['key']);
$nick = stripslashes($_REQUEST['nick']);
$new_pass = trim($_REQUEST['passor']);
$new_email = trim($_REQUEST['email']);
if(check_name($nick))
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($nick);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
$account_key = $account->getCustomField('key');
if(!empty($account_key))
{
if($account_key == $rec_key)
{
if(check_password($new_pass))
{
if(check_mail($new_email))
{
$account->setEMail($new_email);
if($config_salt_enabled)
{
$salt = generateRandomString(10, false, true, true);
$new_pass_with_salt = $salt . $new_pass;
$account->setSalt($salt);
}
$account->setPassword(encrypt($new_pass_with_salt));
$account->save();
echo 'Your account name, new password and new e-mail.<BR>
<FORM ACTION="?subtopic=accountmanagement" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Your account name, new password and new e-mail</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Account name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$account->getName().'</b><BR>
New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>'.$new_pass.'</b><BR>
New e-mail address:&nbsp;<b>'.$new_email.'</b><BR>';
if($account->getCustomField('email_next') < time())
{
$mailBody = '
<h3>Your account name and new password!</h3>
<p>Changed password and e-mail to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p>
<p>Account name: <b>'.$account->getName().'</b></p>
<p>New password: <b>'.$new_pass.'</b></p>
<p>E-mail: <b>'.$new_email.'</b> (this e-mail)</p>
<br />
<p><u>It\'s automatic e-mail from OTS Lost Account System. Do not reply!</u></p>';
if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - New password to your account", $mailBody))
{
echo '<br /><small>Sent e-mail with your account name and password to new e-mail. You should receive this e-mail in 15 minutes. You can login now with new password!</small>';
}
else
{
echo '<br /><p class="error">An error occorred while sending email! You will not receive e-mail with this informations. Error:<br/>' . $mailer->ErrorInfo . '</p>';
}
}
else
{
echo '<br /><small>You will not receive e-mail with this informations.</small>';
}
echo '<INPUT TYPE=hidden NAME="account_login" VALUE="'.$account->getId().'">
<INPUT TYPE=hidden NAME="password_login" VALUE="'.$new_pass.'">
</TD></TR></TABLE><BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
else
echo 'Wrong e-mail format.';
}
else
echo 'Wrong password format. Use only a-Z, A-Z, 0-9. Minimum password length is 7 characters and maximum 32.';
}
else
echo 'Wrong recovery key!';
}
else
echo 'Account of this character has no recovery key!';
}
else
echo 'Player or account of player <b>'.$nick.'</b> doesn\'t exist.';
}
else
echo 'Invalid player name format. If you have other characters on account try with other name.';
echo '<BR /><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<a href="?subtopic=lostaccount&action=step1&action_type=reckey&nick='.urlencode($nick).'" border="0"><IMG SRC="'.$template_path.'/images/buttons/sbutton_back.gif" NAME="Back" ALT="Back" BORDER=0 WIDTH=120 HEIGHT=18></a></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'checkcode')
{
$code = trim($_REQUEST['code']);
$character = stripslashes(trim($_REQUEST['character']));
if(empty($code) || empty($character))
echo 'Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
<FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & character name</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Your code:&nbsp;<INPUT TYPE=text NAME="code" VALUE="" SIZE="40")><BR />
Character:&nbsp;<INPUT TYPE=text NAME="character" VALUE="" SIZE="40")><BR />
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
else
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($character);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_code') == $code)
{
echo '<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value==""||value==" ")
{alert(alerttxt);return false;}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(passor,"Please enter password!")==false)
{passor.focus();return false;}
if (validate_required(passor2,"Please repeat password!")==false)
{passor2.focus();return false;}
if (passor2.value!=passor.value)
{alert(\'Repeated password is not equal to password!\');return false;}
}
}
</script>
Please enter new password to your account and repeat to make sure you remember password.<BR>
<FORM ACTION="?subtopic=lostaccount&action=setnewpassword" onsubmit="return validate_form(this)" METHOD=post>
<INPUT TYPE=hidden NAME="character" VALUE="'.$character.'">
<INPUT TYPE=hidden NAME="code" VALUE="'.$code.'">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & account name</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
New password:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=password ID="passor" NAME="passor" VALUE="" SIZE="40")><BR />
Repeat new password:&nbsp;<INPUT TYPE=password ID="passor2" NAME="passor2" VALUE="" SIZE="40")><BR />
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
else
$error= 'Wrong code to change password.';
}
else
$error = 'Account of this character or this character doesn\'t exist.';
}
if(!empty($error))
echo '<font color="red"><b>'.$error.'</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
<FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & character name</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Your code:&nbsp;<INPUT TYPE=text NAME="code" VALUE="" SIZE="40")><BR />
Character:&nbsp;<INPUT TYPE=text NAME="character" VALUE="" SIZE="40")><BR />
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
elseif($action == 'setnewpassword')
{
$newpassword = $_REQUEST['passor'];
$code = $_REQUEST['code'];
$character = stripslashes($_REQUEST['character']);
echo '';
if(empty($code) || empty($character) || empty($newpassword))
echo '<font color="red"><b>Error. Try again.</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
<BR><FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Back" ALT="Back" SRC="'.$template_path.'/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
else
{
$player = new OTS_Player();
$account = new OTS_Account();
$player->find($character);
if($player->isLoaded())
$account = $player->getAccount();
if($account->isLoaded())
{
if($account->getCustomField('email_code') == $code)
{
if(check_password($newpassword))
{
if($config_salt_enabled)
{
$salt = generateRandomString(10, false, true, true);
$newpassword_with_salt = $salt . $newpassword;
$account->setSalt($salt);
}
$account->setPassword(encrypt($newpassword_with_salt));
$account->save();
$account->setCustomField('email_code', '');
echo 'New password to your account is below. Now you can login.<BR>
<INPUT TYPE=hidden NAME="character" VALUE="'.$character.'">
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Changed password</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
New password:&nbsp;<b>'.$newpassword.'</b><BR />
Account name:&nbsp;&nbsp;&nbsp;<i>(Already on your e-mail)</i><BR />';
$mailBody = '
<h3>Your account name and password!</h3>
<p>Changed password to your account in Lost Account Interface on server <a href="'.BASE_URL.'"><b>'.$config['lua']['serverName'].'</b></a></p>
<p>Account name: <b>'.$account->getName().'</b></p>
<p>New password: <b>'.$newpassword.'</b></p>
<br />
<p><u>It\'s automatic e-mail from OTS Lost Account System. Do not reply!</u></p>';
if(_mail($account->getCustomField('email'), $config['lua']['serverName']." - Your new password", $mailBody))
{
echo '<br /><small>New password work! Sent e-mail with your password and account name. You should receive this e-mail in 15 minutes. You can login now with new password!';
}
else
{
echo '<br /><p class="error">New password work! An error occorred while sending email! You will not receive e-mail with new password. Error:<br/>' . $mailer->ErrorInfo . '</p>';
}
echo '</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<FORM ACTION="?subtopic=accountmanagement" METHOD=post>
<INPUT TYPE=image NAME="Login" ALT="Login" SRC="'.$template_path.'/images/buttons/sbutton_login.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
else
$error= 'Wrong password format. Use only a-z, A-Z, 0-9. Minimum password length is 7 characters and maximum 32.';
}
else
$error= 'Wrong code to change password.';
}
else
$error = 'Account of this character or this character doesn\'t exist.';
}
if(!empty($error))
echo '<font color="red"><b>'.$error.'</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
<FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Code & character name</B></TD></TR>
<TR><TD BGCOLOR="'.$config['darkborder'].'">
Your code:&nbsp;<INPUT TYPE=text NAME="code" VALUE="" SIZE="40")><BR />
Character:&nbsp;<INPUT TYPE=text NAME="character" VALUE="" SIZE="40")><BR />
</TD></TR>
</TABLE>
<BR>
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
</TD></TR></FORM></TABLE></TABLE>';
}
}
else
echo '<b>Account maker is not configured to send e-mails, you can\'t use Lost Account Interface. Contact with admin to get help.</b>';
?>

35
system/pages/movies.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
/**
* Movies
*
* @package MyAAC
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Movies';
$movies = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'movies') . ' ORDER BY ' . $db->fieldName('ordering'));
if(!$movies->rowCount())
{
?>
There are no movies added yet.
<?php
if(admin())
echo ' You can add new movies in phpmyadmin under ' . TABLE_PREFIX . 'movies table.';
return;
}
?>
<center>
<?php foreach($movies as $movie): ?>
<?php echo $movie['title']; ?><br/>
Author: <?php echo $movie['author']; ?><br/>
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/<?php echo $movie['youtube_id']; ?>&hl=pl&fs=1&color1=0x3a3a3a&color2=0x999999"></param>
<param name="allowFullScreen" value="true"></param>
<embed src="http://www.youtube.com/v/<?php echo $movie['youtube_id']; ?>&hl=pl&fs=1&color1=0x3a3a3a&color2=0x999999" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed>
</object><br/><br/>';
<?php endforeach; ?>
</center>

553
system/pages/news.php Normal file
View File

@@ -0,0 +1,553 @@
<?php
/**
* News
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
if(isset($_GET['archive']))
{
$title = 'News Archive';
$categories = array();
foreach($db->query(
'SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hidden != 1') as $cat)
{
$categories[$cat['id']] = array(
'name' => $cat['name'],
'icon_id' => $cat['icon_id']
);
}
// display big news by id
if(isset($_GET['id']))
{
$field_name = 'date';
if($_REQUEST['id'] < 100000)
$field_name = 'id';
$news = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE type = 1 AND hidden != 1 and `' . $field_name . '` = ' . (int)$_REQUEST['id'] . '');
if($news->rowCount() == 1)
{
if(@file_exists($template_path . '/news.php'))
require($template_path . '/news.php');
else
require(SYSTEM . 'templates/news.php');
$news = $news->fetch();
$author = '';
$query = $db->query('SELECT name FROM players WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1'));
if($query->rowCount() > 0) {
$query = $query->fetch();
$author = $query['name'];
}
echo news_parse($news['title'], $news['body'], $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments']);
}
else
echo 'This news doesn\'t exist or is hidden.<br>';
//echo '<br /><a href="' . internalLayoutLink('news') . ($config['friendly_urls'] ? '/' : '') . 'archive' . '"><font size="2"><b>Back to Archive</b></font></a>';
?>
<center>
<table cellspacing="0" cellpadding="0" border="0"><form method="post" action="<?php echo internalLayoutLink('news') . ($config['friendly_urls'] ? '' : '') . 'archive'; ?>"><tbody><tr><td>
<input width="120" height="18" border="0" type="image" src="<?php echo $template_path; ?>/images/buttons/sbutton_back.gif" alt="Back" name="Back">
</form></td></tr></tbody></table>
</center>
<?php
return;
}
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td colspan="3" class="white"><b>News archives</b></td>
</tr>
<?php
$i = 0;
$news_DB = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE type = 1 AND hidden != 1 ORDER BY date DESC');
foreach($news_DB as $news)
{
$link = internalLayoutLink('news');
if($config['friendly_urls'])
$link .= '/archive/' . $news['id'];
else
$link .= 'archive&id=' . $news['id'];
echo '<tr BGCOLOR='. getStyle($i) .'><td width=4%><center><img src="'.$template_path.'/images/news/icon_' . $categories[$news['category']]['icon_id'] . '_small.gif"></center></td><td>'.date("j.n.Y", $news['date']).'</td><td><b><a href="' . $link.'">'.stripslashes($news['title']).'</a></b></td></tr>';
$i++;
}
echo '</table>';
return;
}
$title = 'Latest News';
$news_cached = false;
// some constants, used mainly by database (cannot by modified without schema changes)
define('NEWS', 1);
define('TICKET', 2);
define('ARTICLE', 3);
define('BODY_LIMIT', 10000); // maximum news body length
$canEdit = hasFlag(FLAG_CONTENT_NEWS) || superAdmin();
if($canEdit)
{
if(!empty($action))
{
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : NULL;
$p_title = isset($_REQUEST['title']) ? $_REQUEST['title'] : NULL;
$body = isset($_REQUEST['body']) ? stripslashes($_REQUEST['body']) : NULL;
$comments = isset($_REQUEST['comments']) ? $_REQUEST['comments'] : NULL;
$type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : NULL;
$category = isset($_REQUEST['category']) ? (int)$_REQUEST['category'] : NULL;
$player_id = isset($_REQUEST['player_id']) ? (int)$_REQUEST['player_id'] : NULL;
$forum_section = isset($_REQUEST['forum_section']) ? $_REQUEST['forum_section'] : NULL;
$errors = array();
if($action == 'add') {
if(isset($forum_section) && $forum_section != '-1') {
$forum_add = Forum::add($p_title, $body, $forum_section, $player_id, $account_logged->getId(), $errors);
}
if(News::add($p_title, $body, $type, $category, $player_id, isset($forum_add) && $forum_add != 0 ? $forum_add : 0, $errors)) {
$p_title = $body = $comments = '';
$type = $category = $player_id = 0;
}
}
else if($action == 'delete') {
News::delete($id, $errors);
}
else if($action == 'edit')
{
if(isset($id) && !isset($p_title)) {
$news = News::get($id);
$p_title = $news['title'];
$body = $news['body'];
$comments = $news['comments'];
$type = $news['type'];
$category = $news['category'];
$player_id = $news['player_id'];
}
else {
News::update($id, $p_title, $body, $type, $category, $player_id, $comments);
$action = $p_title = $body = $comments = '';
$type = $category = $player_id = 0;
}
}
else if($action == 'hide') {
News::toggleHidden($id, $errors);
}
if(!empty($errors))
output_errors($errors);
if($cache->enabled())
{
$cache->set('news_' . $template_name . '_' . NEWS, '', 120);
$cache->set('news_' . $template_name . '_' . TICKET, '', 120);
}
}
}
else if($cache->enabled())
$news_cached = News::getCached(NEWS);
if(!$news_cached)
{
$categories = array();
foreach($db->query(
'SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hidden != 1') as $cat)
{
$categories[$cat['id']] = array(
'name' => $cat['name'],
'icon_id' => $cat['icon_id']
);
}
$tickers =
$db->query(
'SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE ' . $db->fieldName('type') . ' = ' . TICKET .
($canEdit ? '' : ' AND ' . $db->fieldName('hidden') . ' != 1') .
' ORDER BY ' . $db->fieldName('date') . ' DESC' .
' LIMIT ' . $config['news_ticker_limit']);
if($tickers->rowCount() > 0)
{
$rows = 0;
$tickers_to_add = '';
foreach($tickers as $news)
{
$admin_options = '';
if($canEdit)
{
$admin_options = '<a href="?subtopic=news&action=edit&id=' . $news['id'] . '" title="Edit">
<img src="images/edit.png"/>
Edit
</a>
<a id="delete" href="' . BASE_URL . '?subtopic=news&action=delete&id=' . $news['id'] . '" onclick="return confirm(\'Are you sure?\');" title="Delete">
<img src="images/del.png"/>
Delete
</a>
<a href="?subtopic=news&action=hide&id=' . $news['id'] . '" title="' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '">
<img src="images/' . ($news['hidden'] != 1 ? 'success' : 'error') . '.png"/>
' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '
</a>';
}
$tickers_to_add .= '<div id="TickerEntry-'.$rows.'" class="Row" onclick=\'TickerAction("TickerEntry-'.$rows.'")\'>
<div class="' . (is_int($rows / 2) ? "Odd" : "Even") . '">
<div class="NewsTickerIcon" style="background-image: url('.$template_path.'/images/news/icon_'.$categories[$news['category']]['icon_id'].'_small.gif);"></div>
<div id="TickerEntry-'.$rows.'-Button" class="NewsTickerExtend" style="background-image: url('.$template_path.'/images/general/plus.gif);"></div>
<div class="NewsTickerText">
<span class="NewsTickerDate">'.date("j M Y", $news['date']).' -</span>
<div id="TickerEntry-'.$rows.'-ShortText" class="NewsTickerShortText">';
//if admin show button to delete (hide) ticker
$tickers_to_add .= short_text($news['body'], 60).'</div>
<div id="TickerEntry-'.$rows.'-FullText" class="NewsTickerFullText">';
//if admin show button to delete (hide) ticker
$tickers_to_add .= $news['body'] . $admin_options . '</div>
</div>
</div>
</div>';
$rows++;
}
}
}
else
$tickers_to_add = News::getCached(TICKET);
if(isset($tickers_to_add[0]))
{
//show table with tickers
$news_content = '<div id="newsticker" class="Box">
<div class="Corner-tl" style="background-image: url('.$template_path.'/images/content/corner-tl.gif);"></div>
<div class="Corner-tr" style="background-image: url('.$template_path.'/images/content/corner-tr.gif);"></div>
<div class="Border_1" style="background-image: url('.$template_path.'/images/content/border-1.gif);"></div>
<div class="BorderTitleText" style="background-image: url('.$template_path.'/images/content/title-background-green.gif);"></div>
<img class="Title" src="'.$template_path.'/images/header/headline-newsticker.gif" alt="Contentbox headline">
<div class="Border_2">
<div class="Border_3">
<div class="BoxContent" style="background-image: url('.$template_path.'/images/content/scroll.gif);">';
//add tickers list
$news_content .= $tickers_to_add;
//koniec
$news_content .= '</div>
</div>
</div>
<div class="Border_1" style="background-image: url('.$template_path.'/images/content/border-1.gif);"></div>
<div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$template_path.'/images/content/corner-bl.gif);"></div></div>
<div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$template_path.'/images/content/corner-br.gif);"></div></div>
</div>';
if($cache->enabled() && !$news_cached && !$canEdit)
$cache->set('news_' . $template_name . '_' . TICKET, $tickers_to_add, 120);
}
if(!$news_cached)
{
ob_start();
// newses
if(@file_exists($template_path . '/news.php'))
require($template_path . '/news.php');
else
require(SYSTEM . 'templates/news.php');
if($canEdit)
{
?>
<script type="text/javascript">
tinyMCE.init({
forced_root_block : false,
mode : "textareas",
theme : "advanced",
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
</script>
<?php if($action != 'edit'): ?>
<a id="news-button" href="#">Add news</a>
<?php endif; ?>
<form method="post" action="<?php echo getPageLink('news', ($action == 'edit' ? 'edit' : 'add')); ?>">
<?php if($action == 'edit'): ?>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<?php endif; ?>
<table id="news-edit" width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td colspan="2" bgcolor="<?php echo $config['vdarkborder']; ?>" class="white"><b><?php echo ($action == 'edit' ? 'Edit' : 'Add'); ?> news</b></td>
</tr>
<?php $rows = 0; ?>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Title:</b></td>
<td><input name="title" value="<?php echo (isset($p_title) ? $p_title : ''); ?>" size="50" maxlength="50"/></td>
</tr>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<!--td>Description:</td-->
<td colspan="2"><textarea name="body" maxlength="<?php echo BODY_LIMIT; ?>" class="tinymce"><?php echo (isset($body) ? $body : ''); ?></textarea></td>
<tr/>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Type:</b></td>
<td>
<select name="type">
<option value="<?php echo NEWS; ?>" <?php echo (isset($type) && $type == NEWS ? 'selected="yes"' : ''); ?>>News</option>
<option value="<?php echo TICKET; ?>" <?php echo (isset($type) && $type == TICKET ? 'selected="yes"' : ''); ?>>Ticket</option>
<!--option value="<?php echo ARTICLE; ?>">Article</option-->
</select>
</td>
</tr>
<?php
if($action == 'edit')
{
$player = $ots->createObject('Player');
$player->load($player_id);
if($player->isLoaded())
{
?>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td width="180"><b>Author:</b></td>
<td>
<select name="original_id" disabled="disabled">
<?php
echo '<option value="' . $player->getId() . '">' . $player->getName() . '</option>';
?>
</select>
</td>
</tr>
<?php
}
}
?>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td width="180"><b><?php echo ($action == 'edit' ? 'Modified by' : 'Author'); ?>:</b></td>
<td>
<select name="player_id">
<?php
$account_players = $account_logged->getPlayersList();
$account_players->orderBy('group_id', POT::ORDER_DESC);
$player_number = 0;
foreach($account_players as $player)
{
echo '<option value="' . $player->getId() . '"';
if(isset($player_id) && $player->getId() == $player_id)
echo ' selected="selected"';
echo '>' . $player->getName() . '</option>';
}
?>
</select>
</td>
</tr>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Category:</b></td>
<td>
<?php
if(!isset($category))
$category = 0;
foreach($categories as $id => $cat): ?>
<input type="radio" name="category" value="<?php echo $id; ?>" <?php echo (((isset($category) && $category == 0 && $id == 1) || (isset($category) && $category == $id)) ? 'checked="yes"' : ''); ?>/> <img src="images/news/icon_<?php echo $cat['icon_id']; ?>_small.gif" />
<?php endforeach; ?>
</td>
</tr>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td><b>Create forum thread in section:</b></td>
<td>
<select name="forum_section">
<option value="-1">None</option>
<?php
foreach(getForumSections() as $section): ?>
<option value="<?php echo $section['id']; ?>" <?php echo (isset($forum_section) && $forum_section == $section['id']) ? 'checked="yes"' : ''; ?>/><?php echo $section['name']; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr bgcolor="<?php echo getStyle($rows++); ?>">
<td align="right">
<input type="submit" value="Submit"/>
</td>
<td align="left">
<input type="button" onclick="window.location = '<?php echo getPageLink(PAGE); ?>';" value="Cancel"/>
</td>
</tr>
</table>
</form>
<?php if($action != 'edit'): ?>
<script type="text/javascript">
$(document).ready(function() {
$("#news-edit").hide();
});
$("#news-button").click(function() {
$("#news-edit").toggle();
return false;
});
</script>
<?php endif; ?>
<?php
}
$newses =
$db->query(
'SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').
' WHERE type = ' . NEWS .
($canEdit ? '' : ' AND hidden != 1') .
' ORDER BY date' .
' DESC LIMIT ' . $config['news_limit']);
if($newses->rowCount() > 0)
{
foreach($newses as $news)
{
$author = '';
$query = $db->query('SELECT name FROM players WHERE id = ' . $db->quote($news['player_id'] . ' LIMIT 1'));
if($query->rowCount() > 0) {
$query = $query->fetch();
$author = $query['name'];
}
$admin_options = '';
if($canEdit)
{
$admin_options = '<br/><br/><a href="?subtopic=news&action=edit&id=' . $news['id'] . '" title="Edit">
<img src="images/edit.png"/>Edit
</a>
<a id="delete" href="' . BASE_URL . '?subtopic=news&action=delete&id=' . $news['id'] . '" onclick="return confirm(\'Are you sure?\');" title="Delete">
<img src="images/del.png"/>Delete
</a>
<a href="?subtopic=news&action=hide&id=' . $news['id'] . '" title="' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '">
<img src="images/' . ($news['hidden'] != 1 ? 'success' : 'error') . '.png"/>
' . ($news['hidden'] != 1 ? 'Hide' : 'Show') . '
</a>';
}
echo news_parse($news['title'], $news['body'] . $admin_options, $news['date'], $categories[$news['category']]['icon_id'], $config['news_author'] ? $author : '', $news['comments']);
}
}
$tmp_content = ob_get_contents();
ob_end_clean();
if($cache->enabled() && !$canEdit)
$cache->set('news_' . $template_name . '_' . NEWS, $tmp_content, 120);
echo $tmp_content;
}
else
echo $news_cached;
class News
{
static public function add($title, $body, $type, $category, $player_id, $comments, &$errors)
{
global $db;
if(strlen($body) <= BODY_LIMIT)
{
if(isset($title[0]) && isset($body[0])) {
$db->insert(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'date' => time(), 'category' => $category, 'player_id' => isset($player_id) ? $player_id : 0, 'comments' => $comments));
}
else
$errors[] = 'Please fill all inputs.';
}
else
$errors[] = 'News content cannot be longer than ' . BODY_LIMIT . ' characters.';
return !count($errors);
}
static public function get($id) {
global $db;
return $db->select(TABLE_PREFIX . 'news', array('id' => $id));
}
static public function update($id, $title, $body, $type, $category, $player_id, $comments) {
global $db;
$db->update(TABLE_PREFIX . 'news', array('title' => $title, 'body' => $body, 'type' => $type, 'category' => $category, 'last_modified_by' => isset($player_id) ? $player_id : 0, 'last_modified_date' => time(), 'comments' => $comments), array('id' => $id));
}
static public function delete($id, &$errors)
{
global $db;
if(isset($id))
{
if($db->select(TABLE_PREFIX . 'news', array('id' => $id)) !== false)
$db->delete(TABLE_PREFIX . 'news', array('id' => $id));
else
$errors[] = 'News with id ' . $id . ' does not exists.';
}
else
$errors[] = 'News id not set.';
return !count($errors);
}
static public function toggleHidden($id, &$errors)
{
global $db;
if(isset($id))
{
$query = $db->select(TABLE_PREFIX . 'news', array('id' => $id));
if($query !== false)
$db->update(TABLE_PREFIX . 'news', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id));
else
$errors[] = 'News with id ' . $id . ' does not exists.';
}
else
$errors[] = 'News id not set.';
return !count($errors);
}
static public function getCached($type)
{
global $cache, $config, $template_name;
if($cache->enabled())
{
$tmp = '';
if($cache->fetch('news_' . $template_name . '_' . $type, $tmp) && isset($tmp[0])) {
return $tmp;
}
}
return false;
}
}
class Forum
{
static public function add($title, $body, $section_id, $player_id, $account_id, &$errors)
{
global $db;
$thread_id = 0;
if($db->insert(TABLE_PREFIX . 'forum', array('id' => 'null', 'first_post' => 0, 'last_post' => time(), 'section' => $section_id, 'replies' => 0, 'views' => 0, 'author_aid' => isset($account_id) ? $account_id : 0, 'author_guid' => isset($player_id) ? $player_id : 0, 'post_text' => $body, 'post_topic' => $title, 'post_smile' => 0, 'post_date' => time(), 'last_edit_aid' => 0, 'edit_date' => 0, 'post_ip' => $_SERVER['REMOTE_ADDR']))) {
$thread_id = $db->lastInsertId();
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
}
return $thread_id;
}
}
?>

View File

@@ -0,0 +1,14 @@
<?php
/**
* News archive
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
$_GET['archive'] = true;
require('news.php');
?>

220
system/pages/online.php Normal file
View File

@@ -0,0 +1,220 @@
<?php
/**
* Online
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Who is online?';
if($config['account_country'])
require(SYSTEM . 'countries.conf.php');
?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white"><b>Server Status</b></td>
</tr>
<?php
$order = isset($_GET['order']) ? $_GET['order'] : 'name';
if(!in_array($order, array('country', 'name', 'level', 'vocation')))
$order = $db->fieldName('name');
else if($order == 'country')
$order = $db->tableName('accounts') . '.' . $db->fieldName('country');
else if($order == 'vocation')
$order = 'promotion, vocation ASC';
$skull_type = 'skull';
if(fieldExist('skull_type', 'players')) {
$skull_type = 'skull_type';
}
$skull_time = 'skulltime';
if(fieldExist('skull_time', 'players')) {
$skull_time = 'skull_time';
}
$vocs = array(0, 0, 0, 0, 0);
if(tableExist('players_online')) // tfs 1.0
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
else
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `level`, `vocation`, `promotion`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
$players = 0;
$data = '';
foreach($playersOnline as $player)
{
$skull = '';
if($config['online_skulls'])
{
if($player['skulltime'] > 0 && $player['skull'] == 3)
$skull = ' <img style="border: 0;" src="images/whiteskull.gif"/>';
elseif($player['skulltime'] > 0 && $player['skull'] == 4)
$skull = ' <img style="border: 0;" src="images/redskull.gif"/>';
elseif($player['skulltime'] > 0 && $player['skull'] == 5)
$skull = ' <img style="border: 0;" src="images/blackskull.gif"/>';
}
if(isset($player['promotion'])) {
if((int)$player['promotion'] > 0)
$player['vocation'] + ($player['promotion'] * 4);
}
$data .= '<tr bgcolor="' . getStyle(++$players) . '">';
if($config['account_country'])
$data .= '<td>' . getFlagImage($player['country']) . '</td>';
$data .= '<td>' . getPlayerLink($player['name']) . $skull . '</td>
<td>'.$player['level'].'</td>
<td>'.$config['vocations'][$player['vocation']].'</td>
</tr>';
$vocs[$player['vocation']]++;
}
if(!$players): ?>
<tr bgcolor="<?php echo $config['darkborder']; ?>"><td>Currently no one is playing on <?php echo $config['lua']['serverName']; ?>.</td></tr></table>
<?php else:
?>
<tr bgcolor="<?php echo $config['darkborder']; ?>">
<td>
<?php
if(!$status['online'])
echo 'Server is offline.<br/>';
else
{
if($config['online_afk'])
{
$afk = $players - $status['players'];
if($afk < 0) {
$players += abs($afk);
$afk = 0;
}
?>
Currently there are <b><?php echo $status['players']; ?></b> active and <b><?php echo $afk ?></b> AFK players.<br/>
Total number of players: <b><?php echo $players; ?></b>.<br/>
<?php
}
else
echo 'Currently ' . $players . ' players are online.<br/>';
}
if($config['online_record'])
{
$timestamp = false;
if(tableExist('server_record')) {
$query =
$db->query(
'SELECT ' . $db->fieldName('record') . ', ' . $db->fieldName('timestamp') .
' FROM ' . $db->tableName('server_record') .
' WHERE ' . $db->fieldName('world_id') . ' = ' . (int)$config['lua']['worldId'] .
' ORDER BY ' . $db->fieldName('record') . ' DESC LIMIT 1');
$timestamp = true;
}
else{ // tfs 1.0
$query = $db->query('SELECT `value` as `record` FROM `server_config` WHERE `config` = ' . $db->quote('players_record'));
}
if($query->rowCount() > 0)
{
$result = $query->fetch();
echo 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
}
}
?>
</td>
</tr>
</table>
<?php
// vocation statistics
if($config['online_vocations']): ?>
<br/>
<?php if($config['online_vocations_images']): ?>
<table width="200" cellspacing="1" cellpadding="0" border="0" align="center">
<tr bgcolor="<?php echo $config['darkborder']; ?>">
<td><img src="images/sorcerer.png" /></td>
<td><img src="images/druid.png" /></td>
<td><img src="images/palladin.png" /></td>
<td><img src="images/knight.png" /></td>
</tr>
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" style="text-align: center;"><strong>Sorcerers<br /></strong></td>
<td class="white" style="text-align: center;"><strong>Druids</strong></td>
<td class="white" style="text-align: center;"><strong>Paladins</strong></td>
<td class="white" style="text-align: center;"><strong>Knights</strong></td>
</tr>
<tr bgcolor="<?php echo $config['lightborder']; ?>">
<td style="text-align: center;"><?php echo $vocs[1]; ?></td>
<td style="text-align: center;"><?php echo $vocs[2]; ?></td>
<td style="text-align: center;"><?php echo $vocs[3]; ?></td>
<td style="text-align: center;"><?php echo $vocs[4]; ?></td>
</tr>
</table>
<div style="text-align: center;">&nbsp;</div>
<?php else: ?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white" colspan="2"><b>Vocation statistics</b></td>
</tr>
<?php
for($i = 1; $i < 5; $i++)
echo '<tr bgcolor="' . getStyle($i) . '">
<td width="25%">' . $config['vocations'][0][$i] . '</td>
<td width="75%">' . $vocs[$i] . '</td>
</tr>';
?>
</table><br/>
<?php endif;
endif;
// frags counter
if($config['online_skulls']): ?>
<table width="100%" cellspacing="1">
<tr>
<td style="background: <?php echo $config['darkborder']; ?>;" align="center">
<img src="images/whiteskull.gif"/> - 1 - 6 Frags<br/>
<img src="images/redskull.gif"/> - 6+ Frags or Red Skull<br/>
<img src="images/blackskull.gif"/> - 10+ Frags or Black Skull
</td>
</tr>
</table>
<?php endif; ?>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<?php if($config['account_country']): ?>
<td width="11px"><a href="?subtopic=online&order=country" class="white">#</A></td>
<?php endif; ?>
<td width="60%"><a href="?subtopic=online&order=name" class="white">Name</A></td>
<td width="20%"><a href="?subtopic=online&order=level" class="white">Level</A></td>
<td width="20%"><a href="?subtopic=online&order=vocation" class="white">Vocation</td>
</tr>
<?php echo $data; ?>
</table>
<?php
endif;
//search bar
echo '<BR><FORM ACTION="?subtopic=characters" METHOD=post> <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['vdarkborder'].'" class="white"><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$template_path.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
/* temporary disable it - shows server offline
// update online players counter
if($players > 0)
{
$status['players'] = $players;
if($cache->enabled())
$cache->set('status', serialize($status));
else
{
foreach($status as $key => $value)
updateDatabaseConfig('serverStatus_' . $key, $value);
}
}*/
?>

376
system/pages/polls.php Normal file
View File

@@ -0,0 +1,376 @@
<?php
/**
* Polls
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Polls';
/* Polls System By Averatec from pervera.pl & otland.net
CREATE TABLE `z_polls` (
`id` int(11) NOT NULL auto_increment,
`question` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`end` int(11) NOT NULL,
`start` int(11) NOT NULL,
`answers` int(11) NOT NULL,
`votes_all` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE `z_polls_answers` (
`poll_id` int(11) NOT NULL,
`answer_id` int(11) NOT NULL,
`answer` varchar(255) NOT NULL,
`votes` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `accounts` ADD `vote` INT( 11 ) NOT NULL ;
*/
function getColorByPercent($percent)
{
if($percent < 15)
return 'red';
else if($percent < 35)
return 'orange';
else if($percent < 50)
return 'yellow';
return '';
}
$link = "polls"; // your link to polls in index.php
$dark = $config['darkborder'];
$light = $config['lightborder'];
$time = time();
$POLLS = $db->query('SELECT * FROM '.$db->tableName('z_polls').'');
$level = 20; // need level to vote
if(empty($_REQUEST['id']) and $_REQUEST['control'] != "true") // list of polls
{
$active = $db->query('SELECT * FROM `z_polls` where `end` > '.$time.''); // active polls
$closed = $db->query('SELECT * FROM `z_polls` where `end` < '.$time.' order by `end` desc'); // closed polls
/* Active Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Active Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
$bgcolor = getStyle($number_of_rows++);
foreach($active as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
<td>
<a href="';
if($logged)
echo '?subtopic='.$link.'&id='.$poll['id'];
else
echo '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic='.$link.'&id='.$poll['id']);
echo '">'.$poll['question'] . '</a>
</td>
<td>'.date("M j Y", $poll['end']).'</td>
</tr>';
$empty_active = true;
}
if(!$empty_active)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><center><i>There are no active polls.</i></center></td></tr>';
}
echo "</table><br><br>";
/* Closed Polls */
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Closed Polls</B></TD></TR>';
echo '<TR BGCOLOR="' . getStyle($number_of_rows++) . '"><td width=75%><b>Topic</b></td><td><b>End</b></td></tr>';
$bgcolor = getStyle($number_of_rows++);
foreach($closed as $poll)
{
echo '
<tr BGCOLOR="'.$bgcolor.'">
<td>
<a href="';
if($logged)
echo '?subtopic='.$link.'&id='.$poll['id'];
else
echo '?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic='.$link.'&id='.$poll['id']);
echo '">'.$poll['question'] . '</a>
</td>
<td>'.date("M j Y", $poll['end']).'</td>
</tr>';
$empty_closed = true;
}
if(!$empty_closed)
{
echo '<tr BGCOLOR="'.$bgcolor.'"><td colspan=2><center><i>There are no closed polls.</i></center></td></tr>';
}
echo "</table>";
$showed=true;
}
if(!$logged)
{
echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=polls') . '">Log in</a> to vote in polls.<br /><br />';
return;
}
/* Checking Account */
$account_players = $account_logged->getPlayers();
foreach($account_players as $player)
{
$player = $player->getLevel();
if($player >= $level)
$allow=true;
}
if(!empty($_REQUEST['id']) and $_REQUEST['control'] != "true")
{
foreach($POLLS as $POLL)
{
if($_REQUEST['id'] == $POLL['id'])
{
$ANSWERS = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).' order by `answer_id`');
$votes_all = $POLL['votes_all'];
if($votes_all == 0)
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = 0;
$i++;
}
}
else
{
$i=1;
foreach($ANSWERS as $answer)
{
$percent[$i] = round(((100*$answer['votes'])/$votes_all),2);
$i++;
}
}
?>
<style type="text/css" media="screen">
div.progress-container {
border: 1px solid #ccc;
width: 100px;
margin: 2px 5px 2px 0;
padding: 1px;
float: left;
background: white;
}
div.progress-container > div {
background-color: #ACE97C;
height: 12px
}
</style>
<?php
function slaw_getPercentBar($percent)
{
$color = getColorByPercent($percent);
return '<div class="progress-container" style="width: 100px">
<div style="width: ' . $percent . '%; ' . ($color != "" ? 'background: ' . $color : '') . '"></div>
</div>';
}
if($POLL['end'] > $time) // active poll
{
if($_REQUEST['vote'] == true and $allow == true)
{
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and !empty($_POST['answer']))
{
if(isset($_POST['continue']))
{
$vote = addslashes(htmlspecialchars(trim($_REQUEST['id'])));
$account_logged->setCustomField("vote", $vote);
$UPDATE_poll = $db->query('UPDATE `z_polls` SET `votes_all` = `votes_all` + 1 where `id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
$UPDATE_answer = $db->query('UPDATE `z_polls_answers` SET `votes` = `votes` + 1 where `answer_id` = '.addslashes(htmlspecialchars($_POST['answer'])).' and`poll_id` = '.addslashes(htmlspecialchars(trim($_REQUEST['id']))).'');
header('Location: ?subtopic='.$link.'&id='.$_REQUEST['id'].'');
}
}
else
{
header('Location: ?subtopic='.$link.'&id='.$_REQUEST['id'].'');
}
}
if($account_logged->getCustomField('vote') < $_REQUEST['id'] and $allow == true)
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=2 class=white><B>Vote</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=2><b>'.$POLL['question'].'</b><br/>' . $POLL['description'] . '</td></tr>
<form action="?subtopic='.$link.'&id='.$_REQUEST['id'].'&vote=true" method="POST"> ';
$ANSWERS_input = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_input as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<tr BGCOLOR="'.$bgcolor.'"><td><input type=radio name=answer value="'.$i.'">'.$answer['answer'].'</td></tr>';
$i++;
}
echo '</table><input type="submit" name="continue" value="Submit" class="input2" /></form><br><br>';
}
elseif($account_logged->getCustomField('vote') >= $_REQUEST['id'])
{
$result[] = '<br><b>You have already voted.</b><br>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=3 class=white><B>Results</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=3><b>'.$POLL['question'].'</b><br/>' . $POLL['description'] . '</td></tr>';
$ANSWERS_show = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_show as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
$x=0;
echo '<TR BGCOLOR="'.$bgcolor.'">
<td width=60%>'.$answer['answer'].'</td>
<td width=20%>
' . slaw_getPercentBar($percent[$i]) . '
</td>
<td>' . $answer['votes'] . '(<font color=' . getColorByPercent($percent[$i]) . '><b>' . $percent[$i] . '%</b></font>)</td>
</tr>';
$i++;
}
echo '</table>';
}
$result[] = '<br>All players with a character of at least level ' . $level . ' may vote.<br>';
foreach($result as $error)
{
echo $error;
}
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll will end at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
}
else // closed poll
{
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['vdarkborder'].'><TD COLSPAN=3 class=white><B>Results</B></TD></TR>';
echo '<TR BGCOLOR="'.$dark.'"><td COLSPAN=3><b>'.$POLL['question'].'</b></td></tr>';
$ANSWERS_show = $db->query('SELECT * FROM '.$db->tableName('z_polls_answers').' where `poll_id` = '.$_REQUEST['id'].' order by `answer_id`');
$i=1;
foreach($ANSWERS_show as $answer)
{
if(is_int($i / 2)) {
$bgcolor = $dark;
}
else
{
$bgcolor = $light;
}
echo '<TR BGCOLOR="'.$bgcolor.'">
<td width=60%>'.$answer['answer'].'</td>
<td width=20%>
' . slaw_getPercentBar($percent[$i]) . '
</td>
<td>' . $answer['votes'] . '(<font color=' . getColorByPercent($percent[$i]) . '><b>' . $percent[$i] . '%</b></font>)</td>
</tr>';
$i++;
}
echo '</table><br><br>';
echo '<br>The poll started at '.date("M j Y", $POLL['start']).'<br>';
echo 'The poll ended at '.date("M j Y", $POLL['end']).'<br>';
echo '<br>Total votes <b>'.$POLL['votes_all'].'</b><br>';
}
$showed=true;
echo '<div class=\'hr1\'></div><a href="?subtopic='.$link.'"><font size="2"><b>Go to list of polls</b></font></a>';
}
}
}
if(admin() and $_REQUEST['control'] != "true")
{
echo '<br><a href="?subtopic='.$link.'&control=true"><b>Panel Control</b></a><br><br>';
}
/* Control Panel - Only Add Poll Function */
if(admin() and $_REQUEST['control'] == "true")
{
if(isset($_POST['submit']))
{
$_SESSION['answers'] = $_POST['answers'];
echo '<form method="post" action=""><b><font size=3>Adding Poll</font></b><br><br>
<input type=text name=question value="" /> Question<br>
<input type=text name=description value="" /> Description<br>
<input type=text name=end value="" /> Time to end, in days<br>';
for( $x = 1; $x <= $_SESSION['answers']; $x++ )
{
echo '<input type=text name='.$x.' value="" /> Answer no. '.$x.'<br>';
}
echo '<input type="submit" name="finish" value="Submit" class="input2"/></form><br><br>';
$show=true;
}
if(isset($_POST['finish']))
{
$id = $db->query('SELECT MAX(id) FROM `z_polls`')->fetch();
$id_next = $id[0] + 1;
for( $x = 1; $x <= $_SESSION['answers']; $x++ )
{
$INSERT_answer = $db->query('INSERT INTO `z_polls_answers` (`poll_id`,`answer_id`,`answer`) VALUES ('.$db->quote($id_next).','.$db->quote($x).','.$db->quote($_POST[$x]).')');
}
$end = $time+24*60*60*$_POST['end'];
$INSERT_poll = $db->query('INSERT INTO `z_polls` (`id`,`question`, `description`,`end`,`answers`,`start`) VALUES ('.$db->quote($id_next).','.$db->quote($_POST['question']).','.$db->quote($_POST['description']).','.$db->quote($end).','.$db->quote($_SESSION['answers']).','.$db->quote($time).')');
}
$POLLS_check = $db->query('SELECT MAX(end) FROM '.$db->tableName('z_polls').'');
foreach($POLLS_check as $checked)
{
if($checked[0] > $time)
$check=true;
else
$check=false;
}
if(!$show)
{
if(!$check)
{
echo '<form method="post" action=""><b><font size=3>Adding Poll</font></b><br><br>
<input type=text name=answers value="" /> Number of Answers<br>
<input type="submit" name="submit" value="Submit" class="input2"/></form><br><br>';
}
else
{
echo '<b><font size=3><br>Cannot be two and more active polls.<br><br></font></b>';
}
}
$showed=true;
echo '<br><div class=\'hr1\'></div><a href="?subtopic='.$link.'"><font size="2"><b>Go to list of polls</b></font></a>';
}
if(!$showed)
{
echo 'This poll doesn\'t exist.<br>';
echo '<div class=\'hr1\'></div><a href="?subtopic='.$link.'"><font size="2"><b>Go to list of polls</b></font></a>';
}
?>

35
system/pages/records.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
/**
* Records
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = "Players Online Records";
echo '
<b><center>Players online records on '.$config['lua']['serverName'].'</center></b>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR="'.$config['vdarkborder'].'">
<TD class="white"><b><center>Players</center></b></TD>
<TD class="white"><b><center>Date</center></b></TD>
</TR>';
$i = 0;
$records_query = $db->query('SELECT * FROM `server_record` ORDER BY `record` DESC LIMIT 50;');
foreach($records_query as $data)
{
echo '<TR BGCOLOR=' . getStyle(++$i) . '>
<TD><center>' . $data['record'] . '</center></TD>
<TD><center>' . date("d/m/Y, G:i:s", $data['timestamp']) . '</center></TD>
</TR>';
}
echo '</TABLE>';
?>

47
system/pages/rules.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
/**
* Rules
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Server Rules';
if(PAGE == 'rules'): ?>
<b><?php echo $config['lua']['serverName']; ?> Rules</b><br/>
<textarea rows="25" wrap="physical" cols="70" readonly="true">
<?php endif; ?>
1. Names
a) Names which contain insulting (e.g. "Bastard"), racist (e.g. "Nigger"), extremely right-wing (e.g. "Hitler"), sexist (e.g. "Bitch") or offensive (e.g. "Copkiller") language.
b) Names containing parts of sentences (e.g. "Mike returns"), nonsensical combinations of letters (e.g. "Fgfshdsfg") or invalid formattings (e.g. "Thegreatknight").
c) Names that obviously do not describe a person (e.g. "Christmastree", "Matrix"), names of real life celebrities (e.g. "Britney Spears"), names that refer to real countries (e.g. "Swedish Druid"), names which were created to fake other players' identities (e.g. "Arieswer" instead of "Arieswar") or official positions (e.g. "System Admin").
2. Cheating
a) Exploiting obvious errors of the game ("bugs"), for instance to duplicate items. If you find an error you must report it to CipSoft immediately.
b) Intentional abuse of weaknesses in the gameplay, for example arranging objects or players in a way that other players cannot move them.
c) Using tools to automatically perform or repeat certain actions without any interaction by the player ("macros").
d) Manipulating the client program or using additional software to play the game.
e) Trying to steal other players' account data ("hacking").
f) Playing on more than one account at the same time ("multi-clienting").
g) Offering account data to other players or accepting other players' account data ("account-trading/sharing").
3. Gamemasters
a) Threatening a gamemaster because of his or her actions or position as a gamemaster.
b) Pretending to be a gamemaster or to have influence on the decisions of a gamemaster.
c) Intentionally giving wrong or misleading information to a gamemaster concerning his or her investigations or making false reports about rule violations.
4. Player Killing
a) Excessive killing of characters who are not marked with a "skull" on worlds which are not PvP-enforced. Please note that killing marked characters is not a reason for a banishment.
A violation of the Tibia Rules may lead to temporary banishment of characters and accounts. In severe cases removal or modification of character skills, attributes and belongings, as well as the permanent removal of accounts without any compensation may be considered. The sanction is based on the seriousness of the rule violation and the previous record of the player. It is determined by the gamemaster imposing the banishment.
These rules may be changed at any time. All changes will be announced on the official website.
<?php
if(PAGE == 'rules'): ?>
</textarea>
<?php endif;?>

View File

@@ -0,0 +1,88 @@
<?php
/**
* Screenshots
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Screenshots';
if(isset($_GET['screenshot']))
{
$screenshot = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'screenshots') . ' WHERE ' . $db->fieldName('name') . ' = ' . $db->quote($_GET['screenshot']) . ' ORDER by ordering LIMIT 1;');
if($screenshot->rowCount() == 1)
$screenshot = $screenshot->fetch();
else
{
echo 'Screenshot with this name does not exists.';
return;
}
$previous_screenshot = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'screenshots') . ' WHERE `id` = ' . $db->quote($screenshot['id'] - 1) . ' ORDER by ordering;');
if($previous_screenshot->rowCount() == 1)
$previous_screenshot = $previous_screenshot->fetch();
else
$previous_screenshot = NULL;
$next_screenshot = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'screenshots') . ' WHERE `id` = ' . $db->quote($screenshot['id'] + 1) . ' ORDER by ordering;');
if($next_screenshot->rowCount() == 1)
$next_screenshot = $next_screenshot->fetch();
else
$next_screenshot = NULL;
?>
<div style="position: relative; height: 15px; width: 100%;">
<?php if($next_screenshot): ?>
<a style="float: right;" href="?subtopic=screenshots&screenshot=<?php echo $next_screenshot['name']; ?>" >next <img src="images/arrow_right.gif" width=15 height=11 border=0 ></a>
<?php endif;
if($previous_screenshot): ?>
<a style="position: absolute;" href="?subtopic=screenshots&screenshot=<?php echo $previous_screenshot['name']; ?>"><img src="images/arrow_left.gif" width=15 height=11 border=0 > previous</a>
<?php endif; ?>
<div style="position: absolute; width: 80%; margin-left: 10%; margin-right: 10%; text-align: center;">
<a href="?subtopic=screenshots" ><img src="images/arrow_up.gif" width=11 height=15 border=0 > back</a>
</div>
</div>
<div style="position: relative; text-align: center; top: 20px; ">
<img src="<?php echo $screenshot['image']; ?>" />
<div style="margin-top: 15px; margin-bottom: 35px; "><?php echo $screenshot['comment']; ?></div>
</div>
<?php
return;
}
$screenshots = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'screenshots') . ' ORDER BY ' . $db->fieldName('ordering'));
if(!$screenshots->rowCount())
{
?>
There are no screenshots added to gallery yet.
<?php
if(admin())
echo ' You can add new screenshots in phpmyadmin under ' . TABLE_PREFIX . 'screenshots table.';
return;
}
?>
Click on the image to enlarge.<br/><br/>
<?php foreach($screenshots as $screenshot): ?>
<table>
<tr>
<td style="height: 120px;" >
<a href="?subtopic=screenshots&screenshot=<?php echo $screenshot['name']; ?>" >
<img src="<?php echo $screenshot['thumb']; ?>" border="0" />
</a>
</td>
<td><?php echo $screenshot['comment']; ?></td>
</tr>
</table>
<?php endforeach;
class Screenshots
{
}
?>

153
system/pages/serverinfo.php Normal file
View File

@@ -0,0 +1,153 @@
<?php
/**
* Server info
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Server info';
?>
<center>
<h1><?php echo $config['lua']['serverName']; ?></h1>
<h3>
Experience stages: <a href="<?php echo getPageLink('experienceStages'); ?>">Look here</a><br/>
Commands: <a href="<?php echo getPageLink('commands'); ?>">Look here</a><br/>
Team: <a href="<?php echo getPageLink('team'); ?>">Look here</a><br/>
</h3>
</center>
<ul>
<h2>Server Info:</h2>
<li>IP: <b><?php echo str_replace('/', '', str_replace('http://', '', $config['lua']['url'])); ?></b> (Port: <b><?php echo $config['lua']['loginPort']; ?></b>)</li>
<?php
if($status['online'])
echo '<li>Client: <b>' . $status['clientVersion'] . '</b></li>';
?>
<li>Online: <b>24/7</b></li>
<?php
if(isset($config['lua']['globalSaveEnabled']) && getBoolean($config['lua']['globalSaveEnabled']))
echo '<li>Global save: <b>' . $config['lua']['globalSaveHour'] . ':00</b></li>';
?>
<li>World type: <b>PVP <i>(Protection level: ><?php echo $config['lua']['protectionLevel']; ?>)</i></b></li>
<?php
$rent = trim(strtolower($config['lua']['houseRentPeriod']));
if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily')
$rent = 'never';
echo '<li>House rent: ' . ($rent == 'never' ? 'disabled' : $rent) . '.</li>';
if(isset($config['lua']['houseCleanOld'])) {
$cleanOld = (int)(eval('return ' . $config['lua']['houseCleanOld'] . ';') / (24 * 60 * 60));
if($cleanOld > 0)
echo '<li>Houses with inactive owners are cleaned after 30 days.</li>';
}
?>
<br/>
<h2>Rates</h2>
<li>Magic Level: <b>x<?php echo $config['lua']['rateMagic']; ?></b></li>
<li>Skills: <b>x<?php echo $config['lua']['rateSkill']; ?></b></li>
<li>Loot: <b>x<?php echo $config['lua']['rateLoot']; ?></b></li>
<li>Spawn: <b>x<?php echo $config['lua']['rateSpawn']; ?></b></li>
<?php
$house_level = NULL;
if(isset($config['lua']['levelToBuyHouse']))
$house_level = $config['lua']['levelToBuyHouse'];
else if(isset($config['lua']['house_level']))
$house_level = $config['lua']['house_level'];
if(isset($house_level)):
?>
<li>Houses: <b><?php echo $config['lua']['levelToBuyHouse']; ?> level</b></li>
<?php endif; ?>
<li>Guilds: <b><?php echo $config['guild_need_level']; ?> level</b> (Create via website)</li>
<br>
<?php
$pzLocked = eval('return ' . $config['lua']['pzLocked'] . ';');
$whiteSkullTime = isset($config['lua']['whiteSkullTime']) ? $config['lua']['whiteSkullTime'] : NULL;
if(!isset($whiteSkullTime) && isset($config['lua']['unjust_skull_duration']))
$whiteSkullTime = $config['lua']['unjust_skull_duration'];
if(isset($whiteSkullTime))
$whiteSkullTime = eval('return ' . $whiteSkullTime . ';');
$redSkullLength = isset($config['lua']['redSkullLength']) ? $config['lua']['redSkullLength'] : NULL;
if(!isset($redSkullLength) && isset($config['lua']['red_skull_duration']))
$redSkullLength = $config['lua']['red_skull_duration'];
if(isset($redSkullLength))
$redSkullLength = eval('return ' . $redSkullLength . ';');
$blackSkull = false;
$blackSkullLength = NULL;
if(isset($config['lua']['useBlackSkull']) && getBoolean($config['lua']['useBlackSkull']))
{
$blackSkullLength = $config['lua']['blackSkullLength'];
$blackSkull = true;
}
else if(isset($config['lua']['black_skull_duration'])) {
$blackSkullLength = eval('return ' . $config['lua']['blackSkullLength'] . ';');
$blackSkull = true;
}
?>
<h2>Frags & Skull system</h2>
<li>PZ Lock: <b><?php echo ($pzLocked / (60 * 1000)); ?> min</b></li>
<?php if(isset($whiteSkullTime)):?>
<li>White Skull Time: <b><?php echo ($whiteSkullTime / (60 * 1000)); ?> min</b></li>
<?php endif; ?>
<li>Red skull length: <b><?php echo ($redSkullLength / (24 * 60 * 60)); ?> days</b></li>
<?php if($blackSkull): ?>
<li>Black skull length: <b><?php echo ($blackSkullLength / (24 * 60 * 60)); ?> days</b></li>
<?php endif;
if(isset($config['killsToRedSkull'])): ?>
<li>Kills to red skull: <b><?php echo $config['lua']['killsToRedSkull']; ?></b></li>
<?php elseif(isset($config['lua']['dailyFragsToRedSkull']) || isset($config['lua']['kills_per_day_red_skull'])): ?>
<li>
<h3>Red skull</h3>
<ul>
<li><?php echo (isset($config['lua']['dailyFragsToRedSkull']) ? $config['lua']['dailyFragsToRedSkull'] : $config['lua']['kills_per_day_red_skull']); ?> frags daily</li>
<li><?php echo (isset($config['lua']['weeklyFragsToRedSkull']) ? $config['lua']['weeklyFragsToRedSkull'] : $config['lua']['kills_per_week_red_skull']); ?> frags weekly</li>
<li><?php echo (isset($config['lua']['monthlyFragsToRedSkull']) ? $config['lua']['monthlyFragsToRedSkull'] : $config['lua']['kills_per_month_red_skull']); ?> frags monthly</li>
</ul>
<?php if($blackSkull && (isset($config['lua']['dailyFragsToBlackSkull']) || isset($config['lua']['kills_per_day_black_skull']))): ?>
<h3>Black skull</h3>
<ul>
<li><?php echo (isset($config['lua']['dailyFragsToBlackSkull']) ? $config['lua']['dailyFragsToBlackSkull'] : $config['lua']['kills_per_day_black_skull']); ?> frags daily</li>
<li><?php echo (isset($config['lua']['weeklyFragsToBlackSkull']) ? $config['lua']['weeklyFragsToBlackSkull'] : $config['lua']['kills_per_week_black_skull']); ?> frags weekly</li>
<li><?php echo (isset($config['lua']['monthlyFragsToBlackSkull']) ? $config['lua']['monthlyFragsToBlackSkull'] : $config['lua']['kills_per_month_black_skull']); ?> frags monthly</li>
</ul>
<?php else:
if(isset($config['lua']['dailyFragsToBanishment'])): ?>
<h3>Banishment</h3>
<ul>
<li><?php echo $config['lua']['dailyFragsToBanishment']; ?> frags daily</li>
<li><?php echo $config['lua']['weeklyFragsToBanishment']; ?> frags weekly</li>
<li><?php echo $config['lua']['monthlyFragsToBanishment']; ?> frags monthly</li>
</ul>
<?php endif;
endif; ?>
</li>
<?php
endif;
if(isset($config['lua']['banishment_length'])): ?>
<li>Banishment length: <b><?php echo eval('return ' . $config['lua']['banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['final_banishment_length'])): ?>
<li>Final banishment length: <b><?php echo eval('return ' . $config['lua']['final_banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<?php endif;
if(isset($config['lua']['ip_banishment_length'])): ?>
<li>IP banishment length: <b><?php echo eval('return ' . $config['lua']['ip_banishment_length'] / (24 * 60 * 60) . ';'); ?> days</b></li>
<?php endif; ?>
<br/>
<h2>Other</h2>
<li>Respect our <a href="<?php echo getPageLink('rules'); ?>">rules</a>.</li>
<li>Please report rule violations (Botters, players breaking rules etc) with <b>CTRL + R</b>.</li>
</ul>

247
system/pages/spells.php Normal file
View File

@@ -0,0 +1,247 @@
<?php
/**
* Spells
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Spells';
$config_vocations = $config['vocations'];
$canEdit = hasFlag(FLAG_CONTENT_SPELLS) || admin();
if(isset($_POST['reload_spells']) && $canEdit)
{
try { $db->query('DELETE FROM ' . TABLE_PREFIX . 'spells WHERE 1 = 1'); } catch(PDOException $error) {}
echo '<h2>Reload spells.</h2>';
echo '<h2>All records deleted from table <b>' . TABLE_PREFIX . 'spells</b> in database.</h2>';
foreach($config_vocations as $voc_id => $voc_name) {
$vocations_ids[$voc_name] = $voc_id;
}
$allspells = new OTS_SpellsList($config['data_path'].'spells/spells.xml');
//add conjure spells
$conjurelist = $allspells->getConjuresList();
echo "<h3>Conjure:</h3>";
foreach($conjurelist as $spellname) {
$spell = $allspells->getConjure($spellname);
$lvl = $spell->getLevel();
$mlvl = $spell->getMagicLevel();
$mana = $spell->getMana();
$name = $spell->getName();
$soul = $spell->getSoul();
$spell_txt = $spell->getWords();
$vocations = $spell->getVocations();
$nr_of_vocations = count($vocations);
$vocations_to_db = "";
$voc_nr = 0;
foreach($vocations as $vocation_to_add) {
if(check_number($vocation_to_add)) {
$vocations_to_db .= $vocation_to_add;
}
else
$vocations_to_db .= $vocations_ids[$vocation_to_add];
$voc_nr++;
if($voc_nr != $nr_of_vocations) {
$vocations_to_db .= ',';
}
}
$enabled = $spell->isEnabled();
if($enabled) {
$hide_spell = 0;
}
else {
$hide_spell = 1;
}
$pacc = $spell->isPremium();
if($pacc) {
$pacc = '1';
}
else {
$pacc = '0';
}
$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."')"); } catch(PDOException $error) {}
echo "Added: ".$name."<br>";
}
//add instant spells
$instantlist = $allspells->getInstantsList();
echo "<h3>Instant:</h3>";
foreach($instantlist as $spellname) {
$spell = $allspells->getInstant($spellname);
$lvl = $spell->getLevel();
$mlvl = $spell->getMagicLevel();
$mana = $spell->getMana();
$name = $spell->getName();
$soul = $spell->getSoul();
$spell_txt = $spell->getWords();
if(strpos($spell_txt, '###') !== false)
continue;
$vocations = $spell->getVocations();
$nr_of_vocations = count($vocations);
$vocations_to_db = "";
$voc_nr = 0;
foreach($vocations as $vocation_to_add_name) {
$vocations_to_db .= $vocation_to_add_name;
$voc_nr++;
if($voc_nr != $nr_of_vocations) {
$vocations_to_db .= ',';
}
}
$enabled = $spell->isEnabled();
if($enabled) {
$hide_spell = 0;
}
else {
$hide_spell = 1;
}
$pacc = $spell->isPremium();
if($pacc) {
$pacc = '1';
}
else {
$pacc = '0';
}
$type = 1;
$count = 0;
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."')"); } catch(PDOException $error) {}
echo "Added: ".$name."<br/>";
}
}
if($canEdit)
{
?>
<form method="post" action="index.php?subtopic=spells">
<input type="hidden" name="reload_spells" value="yes"/>
<input type="submit" value="(admin) Reload spells"/>
</form>
<?php
}
$vocation_id = (int) (isset($_REQUEST['vocation_id']) ? $_REQUEST['vocation_id'] : 'All');
$order = 'spell';
if(isset($_GET['order']))
$order = $_GET['order'];
if(!in_array($order, array('spell', 'words', 'type', 'mana', 'level', 'maglevel', 'soul')))
$order = 'level';
?>
<form action="?subtopic=spells" method="post">
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white"><b>Spell Search</b></td>
</tr>
<tr bgcolor="<?php echo $config['darkborder']; ?>">
<td>Only for vocation: <select name="vocation_id">
<option value="All" <?php
if('All' == $vocation_id)
echo 'SELECTED';
echo '>All';
foreach($config_vocations as $id => $vocation)
{
echo '<option value="' . $id . '" ';
if($id == $vocation_id && $vocation_id != "All" && $vocation_id != '')
echo 'SELECTED';
echo '>' . $vocation;
}
?>
</select>
<input type="hidden" name="order" value="<?php echo $order; ?>">&nbsp;&nbsp;&nbsp;<input type="image" name="Submit" alt="Submit" src="<?php echo $template_path; ?>/images/buttons/sbutton_submit.gif" border="0" width="120" height="18">
</td>
</tr>
</table>
</form>
<table border="0" cellspacing="1" cellpadding="4" width="100%">
<tr bgcolor="<?php echo $config['vdarkborder']; ?>">
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=spell"><font class="white">Name</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=words"><font class="white">Words</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=type"><font class="white">Type<br/>(count)</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=mana"><font class="white">Mana</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=level"><font class="white">Level</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=maglevel"><font class="white">Magic<br/>Level</font></a></b>
</td>
<td class="white">
<b><a href="?subtopic=spells&vocation_id=<?php echo $vocation_id; ?>&order=soul"><font class="white">Soul</font></a></b>
</td>
<td class="white">
<b>Premium</b>
</td>
<td class="white">
<b>Vocations:</b>
</td>
</tr>
<?php
$i = 0;
$spells = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'spells') . ' WHERE ' . $db->fieldName('hidden') . ' != 1 ORDER BY ' . $order . ', level');
if(isset($vocation_id) && $vocation_id != 'All' && $vocation_id != '')
{
foreach($spells as $spell)
{
$spell_vocations = explode(",", $spell['vocations']);
if(in_array($vocation_id, $spell_vocations) || empty($spell['vocations']))
{
echo '<TR BGCOLOR="' . getStyle(++$i) . '"><TD>' . $spell['name'] . '</TD><TD>' . $spell['words'] . '</TD>';
if($spell['type'] == 2)
echo '<TD>Conjure ('.$spell['conjure_count'].')</TD>';
else
echo '<TD>Instant</TD>';
echo '<TD>' . $spell['mana'] . '</TD><TD>' . $spell['level'] . '</TD><TD>' . $spell['maglevel'] . '</TD><TD>' . $spell['soul'] . '</TD><TD>' . ($spell ['premium'] == 1 ? 'yes' : 'no') . '</TD><TD>' . $config_vocations[$vocation_id] . '</TD></TR>';
}
}
}
else
{
foreach($spells as $spell)
{
$spell_vocations = explode(",", $spell['vocations']);
echo '<TR BGCOLOR="' . getStyle(++$i) . '"><TD>' .$spell['name'] . '</TD><TD>' . $spell['words'] . '</TD>';
if($spell['type'] == 1)
echo '<TD>Instant</TD>';
else
echo '<TD>Conjure ('.$spell['conjure_count'].')</TD>';
echo '<TD>' . $spell['mana'] . '</TD><TD>' . $spell['level'] . '</TD><TD>' . $spell['maglevel'] . '</TD><TD>' . $spell['soul'] . '</TD><TD>'. ($spell ['premium'] == 1 ? 'yes' : 'no') .'</TD><TD><font size="1">';
$showed_vocations = 0;
foreach($spell_vocations as $spell_vocation)
{
echo $config_vocations[$spell_vocation];
$showed_vocations++;
if($showed_vocations != count($spell_vocations))
echo '<br/>';
}
echo '</font></TD></TR>';
}
}
?>
</table>

127
system/pages/team.php Normal file
View File

@@ -0,0 +1,127 @@
<?php
/**
* Team
*
* @package MyAAC
* @author Gesior <jerzyskalski@wp.pl>
* @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC
* @version 0.0.1
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Gamemasters List';
if($config['account_country'])
require(SYSTEM . 'countries.conf.php');
$groups = new OTS_Groups_List();
if(!$groups->count())
{
echo 'Error while reading groups.xml';
return;
}
$newStyle = ($config['team_style'] == 2);
if(!$newStyle)
{
echo '<center><h2>Support in game</h2></center>
<table border="0" cellspacing="1" cellpadding="4" width="100%">' . getGroupHeader();
}
$group_tmp = array();
$i = 0;
$groupList = $groups->getGroups();
foreach($groupList as $id => $group)
{
if($id <= 1)
continue;
$group_members = $group->getPlayersList();
if(!count($group_members))
continue;
$members_count = 0;
$groupNames = array();
foreach($group_members as $member)
{
if(!admin() && $member->getCustomField('hidden') > 0)
continue;
$members_count++;
$flag = '';
if($config['account_country'])
$flag = getFlagImage($member->getAccount()->getCustomField('country'));
$tmp = '<tr bgcolor="' . getStyle($i++) . '">';
if(!$newStyle)
$tmp .= '<td>' . ucfirst($group->getName()) . '</td>';
$tmp .= '<td>' . $flag . ' ' . getPlayerLink($member->getName()) . '</td>';
if($config['team_display_status'])
$tmp .= '<td>' . ($member->isOnline() > 0 ? '<font color="green"><b>Online</b></font>' : '<font color="red"><b>Offline</b></font>') . '</td>';
if($config['multiworld'] || $config['team_display_world'])
$tmp .= '<td><font class="white"><b>' . getWorldName($member->getWorldId()) . '</b></font></td>';
$lastLogin = '';
if($config['team_display_lastlogin'])
{
$lastLogin = 'Never.';
if($member->getLastLogin() > 0)
$lastLogin = date("j F Y, g:i a", $member->getLastLogin());
}
$tmp .= '<td>' . $lastLogin . '</td></tr>';
if($newStyle)
{
if(isset($groupNames[$group->getName()]))
$groupNames[$group->getName()] .= $tmp;
else
$groupNames[$group->getName()] = $tmp;
}
else
echo $tmp;
}
if($newStyle && $members_count > 0)
{
$group_tmp[$id] = '<center><h2>' . ucfirst($group->getName()) . 's</h2></center>
<table border="0" cellspacing="1" cellpadding="4" width="100%">' . getGroupHeader(false) . $groupNames[$group->getName()] . '</table>';
}
}
if($newStyle)
{
for($i = $id; $i >= 0; $i--)
{
if(isset($group_tmp[$i]))
echo $group_tmp[$i];
}
}
else
echo '</table>';
function getGroupHeader($groupField = true)
{
global $config;
$ret = '<tr bgcolor="' . $config['vdarkborder'] . '">';
if($groupField)
$ret .= '<td width="20%"><font class="white"><b>Group</b></font></td>';
$ret .= '<td width="40%"><font class="white"><b>Name</b></font></td>';
if($config['team_display_status'])
$ret .= '<td width="20%"><font class="white"><b>Status</b></font></td>';
if($config['multiworld'] || $config['team_display_world'])
$ret .= '<td><font class="white"><b>World</b></font></td>';
if($config['team_display_lastlogin'])
$ret .= '<td width="20%"><font class="white"><b>Last login</b></font></td>';
$ret .= '</tr>';
return $ret;
}
?>