mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-16 10:44:55 +02:00
First public release of MyAAC
This commit is contained in:
1
system/pages/admin/.htaccess
Normal file
1
system/pages/admin/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
deny from all
|
27
system/pages/admin/changelog.php
Normal file
27
system/pages/admin/changelog.php
Normal 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>';
|
||||
?>
|
64
system/pages/admin/dashboard.php
Normal file
64
system/pages/admin/dashboard.php
Normal 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; ?>
|
32
system/pages/admin/login.php
Normal file
32
system/pages/admin/login.php
Normal 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>
|
78
system/pages/admin/logs.php
Normal file
78
system/pages/admin/logs.php
Normal 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.';
|
||||
}
|
||||
?>
|
111
system/pages/admin/mailer.php
Normal file
111
system/pages/admin/mailer.php
Normal 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>
|
108
system/pages/admin/notepad.php
Normal file
108
system/pages/admin/notepad.php
Normal 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));
|
||||
}
|
||||
}
|
294
system/pages/admin/pages.php
Normal file
294
system/pages/admin/pages.php
Normal 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);
|
||||
}
|
||||
}
|
||||
?>
|
20
system/pages/admin/phpinfo.php
Normal file
20
system/pages/admin/phpinfo.php
Normal 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" />
|
568
system/pages/admin/players.php
Normal file
568
system/pages/admin/players.php
Normal 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>
|
101
system/pages/admin/plugins.php
Normal file
101
system/pages/admin/plugins.php
Normal 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>
|
60
system/pages/admin/statistics.php
Normal file
60
system/pages/admin/statistics.php
Normal 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>
|
30
system/pages/admin/tools.php
Normal file
30
system/pages/admin/tools.php
Normal 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);
|
||||
?>
|
1
system/pages/admin/tools/.htaccess
Normal file
1
system/pages/admin/tools/.htaccess
Normal file
@@ -0,0 +1 @@
|
||||
deny from all
|
40
system/pages/admin/version.php
Normal file
40
system/pages/admin/version.php
Normal 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;
|
||||
}*/
|
||||
?>
|
53
system/pages/admin/visitors.php
Normal file
53
system/pages/admin/visitors.php
Normal 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>
|
Reference in New Issue
Block a user