* Updates

+Added missing images
+Added report viewer as requested by icekis
-Code cleanup

if strict db, need to set spell to null run

ALTER TABLE `myaac_spells` CHANGE `spell` `spell` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;
This commit is contained in:
Lee
2018-12-12 19:44:29 +00:00
committed by slawkens
parent 876b1b988a
commit 1b539f82ac
14 changed files with 456 additions and 260 deletions

View File

@@ -16,77 +16,68 @@ $title = 'Logs viewer';
<h3 class="box-title">Logs:</h3>
</div>
<div class="box-body">
<div id="logs_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table id="logs" class="table table-bordered table-striped dataTable" role="grid"
aria-describedby="logs_info">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
aria-sort="ascending" aria-label="Log name: activate to sort column descending"
style="width: 297px;">Log name
</th>
<th class="sorting" tabindex="0" aria-controls="logs" rowspan="1" colspan="1"
aria-label="Last updated: activate to sort column ascending" style="width: 361px;">Last
updated
</th>
</tr>
</thead>
<tbody>
<?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['server_path'] . 'logs/';
if (!file_exists($server_path_logs)) {
$server_path_logs = $config['data_path'] . 'logs/';
}
if (file_exists($server_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
}
?>
</tbody>
<tfoot>
<div class="row">
<div class="col-sm-6">
<table id="tb_logs">
<thead>
<tr>
<th>Log name</th>
<th>Last updated</th>
</tfoot>
</table>
</div>
</tr>
</thead>
<tbody>
<?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['server_path'] . 'logs/';
if (!file_exists($server_path_logs)) {
$server_path_logs = $config['data_path'] . 'logs/';
}
if (file_exists($server_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
}
?>
</tbody>
<tfoot>
<th>Log name</th>
<th>Last updated</th>
</tfoot>
</table>
</div>
</div>
</div>
@@ -119,6 +110,6 @@ if (!empty($file)) {
?>
<script>
$(function () {
$('#logs').DataTable()
$('#tb_logs').DataTable()
})
</script>

View File

@@ -0,0 +1,91 @@
<?php
/**
* Reports
*
* @package MyAAC
* @author Lee
* @copyright 2018 MyAAC
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Report viewer';
?>
<div class="box">
<div class="box-header">
<h3 class="box-title">Reports:</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<table id="tb_reports">
<thead>
<tr>
<th>Report name</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
<?php
$files = array();
$server_path_reports = $config['data_path'] . 'reports/';
if (file_exists($server_path_reports)) {
foreach (scandir($server_path_reports) as $f) {
if ($f[0] == '.' || $f == '..')
continue;
if (is_dir($server_path_reports . $f)) {
foreach (scandir($server_path_reports . $f) as $f2) {
if ($f2[0] == '.' || $f2 == '..')
continue;
$files[] = array($f . '/' . $f2, $server_path_reports);
}
continue;
}
$files[] = array($f, $server_path_reports);
}
}
$i = 0;
foreach ($files as $f) {
?>
<tr>
<td>
<a href="<?php echo ADMIN_URL . '?p=reports&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
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
$file = isset($_GET['file']) ? $_GET['file'] : NULL;
if (!empty($file)) {
if (!preg_match('/[^A-z0-9\' _\/\-\.]/', $file)) {
if (file_exists($server_path_reports . $file)) {
echo '<div class="box"><div class="box-header"><h3 class="box-title"><b>' . $file . '</b></h3></div><div class="box-body">';
echo nl2br(file_get_contents($server_path_reports . $file));
echo '</div></div>';
} else
echo 'Specified file does not exist.';
} else
echo 'Invalid file name specified.';
}
?>
<script>
$(document).ready(function () {
$('#tb_reports').DataTable();
});
</script>

View File

@@ -41,8 +41,9 @@ else {
}
}
$order = 'name';
$spells = array();
$spells_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'spells` WHERE `hidden` != 1 AND `type` < 3 ORDER BY name, level');
$spells_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'spells` WHERE `hidden` != 1 AND `type` < 4 AND `level` > 0 ORDER BY ' . $order . '');
if((string)$vocation_id != 'all') {
foreach($spells_db->fetchAll() as $spell) {
@@ -77,12 +78,16 @@ $twig->display('spells.html.twig', array(
'post_vocation_id' => $vocation_id,
'post_vocation' => $vocation,
'spells' => $spells,
'item_path' => $config['item_images_url'],
));
?>
<script>
$(document).ready( function () {
$('#spellstb').DataTable();
$("#tb_instantSpells").DataTable();
$("#tb_conjureSpells").DataTable();
$("#tb_runeSpells").DataTable();
} );
</script>