#30 adminpanel mail logs

This commit is contained in:
Ulrich Block 2014-09-21 14:55:29 +02:00
parent a05c99b73b
commit 0e7b99d0f2
7 changed files with 123 additions and 147 deletions

View File

@ -81,6 +81,11 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
require_once(EASYWIDIR . '/stuff/ajax/datatable_userlog.php');
// Mail log
} else if ($ui->smallletters('d', 7, 'get') =='maillog' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['jobs']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_maillog.php');
// Job log
} else if ($ui->smallletters('d', 6, 'get') =='joblog' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['jobs']) {

View File

@ -6,10 +6,10 @@
<gserver_tag_removed>Gameserver mit entferntem Servertag</gserver_tag_removed>
<host_crashed>Abgestürzte Hosts</host_crashed>
<master_crashed>Abgestürzte Masterserver</master_crashed>
<master_installed_db>Installierte Datenbanken</master_installed_db>
<master_installed_server>Installierte Server</master_installed_server>
<master_installed_slots>Installierte Slots</master_installed_slots>
<master_installed_space>Vergebener Speicherplatz</master_installed_space>
<master_installed_db>Installierte DBs</master_installed_db>
<master_installed_server>Server</master_installed_server>
<master_installed_slots>Slots</master_installed_slots>
<master_installed_space>Speicherplatz</master_installed_space>
<master_installed_vhosts>Installierte Vhosts</master_installed_vhosts>
<rulebreak>Vertragsverletzungen</rulebreak>
<tickets>Tickets</tickets>

View File

@ -6,10 +6,10 @@
<gserver_tag_removed>game server with removed server tag</gserver_tag_removed>
<host_crashed>crashed hosts</host_crashed>
<master_crashed>crashed master server</master_crashed>
<master_installed_db>Installed databases</master_installed_db>
<master_installed_db>Installed DBs</master_installed_db>
<master_installed_server>Installed servers</master_installed_server>
<master_installed_slots>Installed slots</master_installed_slots>
<master_installed_space>Installed space</master_installed_space>
<master_installed_space>Space</master_installed_space>
<master_installed_vhosts>Installed vhosts</master_installed_vhosts>
<rulebreak>Broken contract conditions</rulebreak>
<tickets>tickets</tickets>

View File

@ -39,111 +39,9 @@ if ((!isset($admin_id) or $main != 1) or (isset($admin_id) and !$pa['log'])) {
header('Location: admin.php');
die('No acces');
}
$sprache = getlanguagefile('logs',$user_language,$reseller_id);
$gssprache = getlanguagefile('gserver',$user_language,$reseller_id);
if ($ui->w('action', 4, 'post') == 'dl' and $ui->id('id',30, 'post')) {
$i = 0;
if ($ui->id('id',30, 'post')) {
$delete = $sql->prepare("DELETE FROM `mail_log` WHERE `id`=? LIMIT 1");
foreach ($ui->id('id',30, 'post') as $id) {
$delete->execute(array($id));
$i++;
}
}
$template_file = $i." logs deleted";
} else {
$table = array();
$o = $ui->st('o', 'get');
if ($ui->st('o', 'get') == 'du') {
$orderby = 'u.`cname` DESC';
} else if ($ui->st('o', 'get') == 'au') {
$orderby = 'u.`cname` ASC';
} else if ($ui->st('o', 'get') == 'dt') {
$orderby = 'l.`topic` DESC';
} else if ($ui->st('o', 'get') == 'at') {
$orderby = 'l.`topic` ASC';
} else if ($ui->st('o', 'get') == 'ad') {
$orderby = 'l.`id` ASC';
} else {
$o = 'dd';
$orderby = 'l.`id` DESC';
}
if ($reseller_id == 0) {
$pselect = $sql->prepare("SELECT l.`id`,l.`uid`,l.`topic`,l.`date`,u.`cname`,u.`accounttype`,u.`mail` FROM `mail_log` l LEFT JOIN `userdata` u ON l.`uid`=u.`id` ORDER BY $orderby LIMIT $start,$amount");
} else if ($reseller_id != 0 and $admin_id != $reseller_id) {
$pselect = $sql->prepare("SELECT l.`id`,l.`uid`,l.`topic`,l.`date`,u.`cname`,u.`accounttype`,u.`mail` FROM `mail_log` l LEFT JOIN `userdata` u ON l.`uid`=u.`id` WHERE l.`resellerid`=? ORDER BY $orderby LIMIT $start,$amount");
} else {
$pselect = $sql->prepare("SELECT l.`id`,l.`uid`,l.`topic`,l.`date`,u.`cname`,u.`accounttype`,u.`mail` FROM `userdata` u LEFT JOIN `mail_log` l ON u.`id`=l.`resellerid` OR u.`resellerid`=l.`resellerid` WHERE u.`resellerid`=? GROUP BY l.`date` ORDER BY $orderby LIMIT $start,$amount");
}
if ($reseller_id == 0) {
$pselect->execute();
} else {
if ($reseller_id != 0 and $admin_id != $reseller_id) {
$reseller_id = $admin_id;
}
$pselect->execute(array($reseller_id));
}
foreach ($pselect->fetchall() as $row) {
$userid = $row['uid'];
if ($userid != $admin_id) {
$username='<a href="switch.php?id='.$userid.'">'.$row['cname'].'</a> ('.$row['mail'].')';
} else {
$username = $row['cname'].' ('.$row['mail'].')';
}
$logdate=explode(' ', $row['date']);
if (isset($row['id']) and isid($row['id'], '30') and isset($logdate[1])) {
$table[] = array('id' => $row['id'], 'logday' => $logdate[0], 'loghour' => $logdate[1], 'username' => $username,'topic' => $row['topic']);
}
}
$next = $start+$amount;
if ($reseller_id == 0) {
$countp = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `mail_log`");
$countp->execute();
} else {
if ($reseller_id != 0 and $admin_id != $reseller_id) {
$countp = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `mail_log` WHERE `resellerid`=?");
} else {
$countp = $sql->prepare("SELECT COUNT(l.`id`) AS `amount` FROM `userdata` u LEFT JOIN `mail_log` l ON u.`id`=l.`resellerid` OR u.`resellerid`=l.`resellerid` WHERE u.`resellerid`=? GROUP BY l.`date`");
}
$countp->execute(array($reseller_id));
}
foreach ($countp->fetchAll(PDO::FETCH_ASSOC) as $row) {
$colcount = $row['amount'];
}
if ($colcount>$next) {
$vor = $start+$amount;
} else {
$vor = $start;
}
$back = $start - $amount;
if ($back>=0){
$zur = $start - $amount;
} else {
$zur = $start;
}
$pageamount = ceil($colcount / $amount);
$link='<a href="admin.php?w=ml&amp;d='.$d.'&amp;a=';
if (!isset($amount)) {
$link .="20";
} else {
$link .= $amount;
}
if ($start==0) {
$link .= '&amp;p=0" class="bold">1</a>';
} else {
$link .= '&amp;p=0">1</a>';
}
$pages[] = $link;
$i = 2;
while ($i<=$pageamount) {
$selectpage = ($i - 1) * $amount;
if ($start==$selectpage) {
$pages[] = '<a href="admin.php?w=ml&amp;d='.$d.'&amp;a=' . $amount . '&amp;p=' . $selectpage . '" class="bold">' . $i . '</a>';
} else {
$pages[] = '<a href="admin.php?w=ml&amp;d='.$d.'&amp;a=' . $amount . '&amp;p=' . $selectpage . '">' . $i . '</a>';
}
$i++;
}
$pages=implode(', ',$pages);
$template_file = "admin_logs_mail.tpl";
}
$sprache = getlanguagefile('logs', $user_language, $reseller_id);
configureDateTables('', '0, "desc"', 'ajax.php?w=datatable&d=maillog');
$template_file = 'admin_logs_mail.tpl';

View File

@ -0,0 +1,82 @@
<?php
/**
* File: datatable_maillog.php.
* Author: Ulrich Block
* Date: 21.09.14
* Contact: <ulrich.block@easy-wi.com>
*
* This file is part of Easy-WI.
*
* Easy-WI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy-WI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy-WI. If not, see <http://www.gnu.org/licenses/>.
*
* Diese Datei ist Teil von Easy-WI.
*
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
*
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License fuer weitere Details.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*/
if (!defined('AJAXINCLUDED')) {
die('Do not access directly!');
}
$sprache = getlanguagefile('logs', $user_language, $reseller_id);
$gssprache = getlanguagefile('gserver', $user_language, $reseller_id);
$query = $sql->prepare("SELECT COUNT(1) AS `mail_log` FROM `mail_log` AS l WHERE `resellerid`=?");
$query->execute(array($resellerLockupID));
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `mail_log` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`uid` WHERE l.`resellerid`=:resellerid AND (l.`date` LIKE :search OR l.`topic` LIKE :search OR s.`cname` LIKE :search OR s.`mail` LIKE :search)");
$query->execute(array(':search' => '%' . $sSearch . '%', ':resellerid' => $resellerLockupID));
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => 'l.`date`', 1 => 's.`cname`', 2 => 'l.`topic`');
if (isset($orderFields[$iSortCol]) and is_array($orderFields[$iSortCol])) {
$orderBy = implode(' ' . $sSortDir . ', ', $orderFields[$iSortCol]) . ' ' . $sSortDir;
} else if (isset($orderFields[$iSortCol]) and !is_array($orderFields[$iSortCol])) {
$orderBy = $orderFields[$iSortCol] . ' ' . $sSortDir;
} else {
$orderBy = '`logdate` DESC';
}
if ($sSearch) {
$query = $sql->prepare("SELECT l.`date`,l.`topic`,s.`cname`,s.`mail` FROM `mail_log` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`uid` WHERE l.`resellerid`=:resellerid AND (l.`date` LIKE :search OR l.`topic` LIKE :search OR s.`cname` LIKE :search OR s.`mail` LIKE :search) ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%', ':resellerid' => $resellerLockupID));
} else {
$query = $sql->prepare("SELECT l.`date`,l.`topic`,s.`cname`,s.`mail` FROM `mail_log` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`uid` WHERE l.`resellerid`=? ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array($resellerLockupID));
}
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$array['aaData'][] = array($row['date'], $row['cname'] . '(' . $row['mail'] . ')', $row['topic']);
}

View File

@ -18,7 +18,7 @@
<?php echo $gsprache->appRoot;?>
</h3>
<p>
<?php echo $statsArray['gameMasterCrashed'].'/'.$statsArray['gameMasterActive'];?> <?php echo $sprache_bad->master_crashed;?><br>
<?php echo $statsArray['gameMasterCrashed'].'/'.$statsArray['gameMasterActive'];?> <?php echo $sprache_bad->crashed;?><br>
<?php echo $statsArray['gameserverActive'].'/'.$statsArray['gameMasterServerAvailable'];?> <?php echo $sprache_bad->master_installed_server;?><br>
<?php echo $statsArray['gameserverSlotsInstalled'].'/'.$statsArray['gameMasterSlotsAvailable'];?> <?php echo $sprache_bad->master_installed_slots;?>
</p>
@ -64,7 +64,7 @@
<?php echo $gsprache->master;?>
</h3>
<p>
<?php echo $statsArray['voiceMasterCrashed'].'/'.$statsArray['voiceMasterActive'];?> <?php echo $sprache_bad->ts3master_crashed;?><br>
<?php echo $statsArray['voiceMasterCrashed'].'/'.$statsArray['voiceMasterActive'];?> <?php echo $sprache_bad->crashed;?><br>
<?php echo $statsArray['voiceserverActive'].'/'.$statsArray['voiceMasterServerAvailable'];?> <?php echo $sprache_bad->master_installed_server;?><br>
<?php echo $statsArray['voiceserverSlotsInstalled'].'/'.$statsArray['voiceMasterSlotsAvailable'];?> <?php echo $sprache_bad->master_installed_slots;?>
</p>

View File

@ -6,38 +6,29 @@
</ol>
</section>
<!-- Main Content -->
<section class="content">
<div class="box-footer clearfix">
<ul class="pagination pagination-sm no-margin pull-right">
<li><a href="admin.php?w=ml&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $zur; ?>"><i class="fa fa-step-backward"></i></a></li>
<li><a href="admin.php?w=ml&amp;a=20&amp;p=<?php echo $start; ?>">20</a></li>
<li><a href="admin.php?w=ml&amp;a=50&amp;p=<?php echo $start; ?>">50</a></li>
<li><a href="admin.php?w=ml&amp;a=100&amp;p=<?php echo $start; ?>">100</a></li>
<li><a href="admin.php?w=ml&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $vor; ?>"><i class="fa fa-step-forward"></i></a></li>
</ul>
</div>
<br/>
<div class="box box-info">
<div class="box-body table-responsive no-padding">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th data-class="expand"><a href="admin.php?w=ml&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='dd') { echo 'ad'; } else { echo 'dd'; } ?>"><?php echo $sprache->date;?></a></th>
<th data-hide="phone"><a href="admin.php?w=ml&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='au') { echo 'du'; } else { echo 'au'; } ?>"><?php echo $sprache->account;?></a></th>
<th><a href="admin.php?w=ml&amp;a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&amp;p=<?php echo $start;?>&amp;o=<?php if ($o=='at') { echo 'dt'; } else { echo 'at'; } ?>"><?php echo $sprache->topic;?></a></th>
</tr>
</thead>
<tbody>
<?php foreach ($table as $table_row) { ?>
<tr>
<td><?php echo $table_row['logday']." ".$table_row['loghour']; ?></td>
<td><?php echo $table_row['username']; ?></td>
<td><?php echo $table_row['topic']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="row">
<div class="col-md-11">
<div class="box box-info">
<div class="box-body table-responsive">
<table id="dataTable" class="table table-bordered table-hover">
<thead>
<tr>
<th><?php echo $sprache->date;?></th>
<th><?php echo $sprache->account;?></th>
<th><?php echo $sprache->topic;?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo $sprache->date;?></th>
<th><?php echo $sprache->account;?></th>
<th><?php echo $sprache->topic;?></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>