From 0e7b99d0f209f30686d4fb05465d56479ad23f49 Mon Sep 17 00:00:00 2001 From: Ulrich Block Date: Sun, 21 Sep 2014 14:55:29 +0200 Subject: [PATCH] #30 adminpanel mail logs --- web/ajax.php | 5 + web/languages/default/de/home.xml | 8 +- web/languages/default/uk/home.xml | 4 +- web/stuff/admin/maillog.php | 114 +----------------- web/stuff/ajax/datatable_maillog.php | 82 +++++++++++++ web/template/adminlte/admin/admin_home.tpl | 4 +- .../adminlte/admin/admin_logs_mail.tpl | 53 ++++---- 7 files changed, 123 insertions(+), 147 deletions(-) create mode 100644 web/stuff/ajax/datatable_maillog.php diff --git a/web/ajax.php b/web/ajax.php index 926c6ad0..c2600aff 100644 --- a/web/ajax.php +++ b/web/ajax.php @@ -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']) { diff --git a/web/languages/default/de/home.xml b/web/languages/default/de/home.xml index 696d9c1b..0510b29b 100644 --- a/web/languages/default/de/home.xml +++ b/web/languages/default/de/home.xml @@ -6,10 +6,10 @@ Gameserver mit entferntem Servertag Abgestürzte Hosts Abgestürzte Masterserver - Installierte Datenbanken - Installierte Server - Installierte Slots - Vergebener Speicherplatz + Installierte DBs + Server + Slots + Speicherplatz Installierte Vhosts Vertragsverletzungen Tickets diff --git a/web/languages/default/uk/home.xml b/web/languages/default/uk/home.xml index ad9fc9f5..650d00d3 100644 --- a/web/languages/default/uk/home.xml +++ b/web/languages/default/uk/home.xml @@ -6,10 +6,10 @@ game server with removed server tag crashed hosts crashed master server - Installed databases + Installed DBs Installed servers Installed slots - Installed space + Space Installed vhosts Broken contract conditions tickets diff --git a/web/stuff/admin/maillog.php b/web/stuff/admin/maillog.php index 26e7cd62..d07f44b2 100644 --- a/web/stuff/admin/maillog.php +++ b/web/stuff/admin/maillog.php @@ -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=''.$row['cname'].' ('.$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='' . $i . ''; - } else { - $pages[] = '' . $i . ''; - } - $i++; - } - $pages=implode(', ',$pages); - $template_file = "admin_logs_mail.tpl"; -} \ No newline at end of file + +$sprache = getlanguagefile('logs', $user_language, $reseller_id); + +configureDateTables('', '0, "desc"', 'ajax.php?w=datatable&d=maillog'); + +$template_file = 'admin_logs_mail.tpl'; \ No newline at end of file diff --git a/web/stuff/ajax/datatable_maillog.php b/web/stuff/ajax/datatable_maillog.php new file mode 100644 index 00000000..375db3d0 --- /dev/null +++ b/web/stuff/ajax/datatable_maillog.php @@ -0,0 +1,82 @@ + + * + * 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 . + * + * 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 . + */ + +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']); +} diff --git a/web/template/adminlte/admin/admin_home.tpl b/web/template/adminlte/admin/admin_home.tpl index a167ab1e..89ea73fe 100644 --- a/web/template/adminlte/admin/admin_home.tpl +++ b/web/template/adminlte/admin/admin_home.tpl @@ -18,7 +18,7 @@ appRoot;?>

- master_crashed;?>
+ crashed;?>
master_installed_server;?>
master_installed_slots;?>

@@ -64,7 +64,7 @@ master;?>

- ts3master_crashed;?>
+ crashed;?>
master_installed_server;?>
master_installed_slots;?>

diff --git a/web/template/adminlte/admin/admin_logs_mail.tpl b/web/template/adminlte/admin/admin_logs_mail.tpl index 960dd467..418fffdf 100644 --- a/web/template/adminlte/admin/admin_logs_mail.tpl +++ b/web/template/adminlte/admin/admin_logs_mail.tpl @@ -6,38 +6,29 @@ -
- -
-
-
- - - - - - - - - - - - - - - - - -
&p=&o=">date;?>&p=&o=">account;?>&p=&o=">topic;?>
+
+
+
+
+ + + + + + + + + + + + + + + +
date;?>account;?>topic;?>
date;?>account;?>topic;?>
+
+
\ No newline at end of file