#30 new bootstrap 3 theme

This commit is contained in:
Ulrich Block 2014-09-14 12:43:40 +02:00
parent 90f49e4688
commit f8fd3f7c7b
11 changed files with 581 additions and 315 deletions

View File

@ -40,6 +40,8 @@
define('EASYWIDIR', dirname(__FILE__));
define('AJAXINCLUDED', true);
if (is_dir(EASYWIDIR . '/install')) {
die('Please remove the "install" folder');
}
@ -74,118 +76,17 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
if ($ui->smallletters('d', 7, 'get') == 'userlog' and isset($user_id) and $pa['log']) {
$sprache = getlanguagefile('logs', $user_language, $reseller_id);
$gssprache = getlanguagefile('gserver', $user_language, $reseller_id);
$placeholders = array('%%', '%ad%', '%add%', '%dl%', '%del%', '%md%', '%mod%', '%start%', '%restart%', '%stop%', '%upd%', '%fail%', '%ok%', '%psw%', '%cfg%', '%import%', '%reinstall%', '%backup%', '%use%');
$replace = array('', $gsprache->add, $gsprache->add, $gsprache->del, $gsprache->del, $gsprache->mod, $gsprache->mod, $gsprache->start, $gsprache->start, $gsprache->stop, $gsprache->update,'','', $gssprache->password, $gssprache->config, $gsprache->import, $gssprache->reinstall, $gsprache->backup, $gsprache->use);
$placeholders2 = array('%voserver%', '%gserver%', '%user%', '%fastdl%', '%master%', '%user%', '%root%', '%addon%', '%settings%', '%vserver%', '%ticket_subject%', '%reseller%', '%virtual%', '%eac%', '%resync%', '%virtualimage%', '%template%', '%voserver%', '%emailsettings%', '%dns%', '%tsdns%', '%pmode%', '%file%');
$replace2 = array($gsprache->voiceserver, $gsprache->gameserver, $gsprache->user, $gsprache->fastdownload, $gsprache->master, $gsprache->user, $gsprache->root, $gsprache->addon2, $gsprache->settings, $gsprache->virtual, $gsprache->support, $gsprache->reseller, $gsprache->hostsystem,'Easy Anti Cheat', $gssprache->resync, $gsprache->virtual . ' ' . $gsprache->template, $gsprache->template, $gsprache->voiceserver,'E-Mail '.$gsprache->settings, 'TSDNS', 'TSDNS', $gssprache->protect, $gsprache->file);
if ($sSearch) {
$sSearch = str_replace($replace, $placeholders, str_replace($replace2, $placeholders2, $sSearch));
}
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `userlog` WHERE `usertype`='user' AND `userid`=? AND `resellerid`=?");
$query->execute(array($user_id, $reseller_id));
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype`='user' AND l.`userid`=:userid AND l.`resellerid`=:resellerid AND (`username` LIKE :search OR `cname` LIKE :search OR `ip` LIKE :search OR `logdate` LIKE :search OR `useraction` LIKE :search)");
$query->execute(array(':search' => '%' . $sSearch . '%', ':userid' => $user_id, ':resellerid' => $reseller_id));
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => '`logdate`', 1 => array('`username`', '`cname`'), 2 => '`useraction`', 3 => '`ip`');
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 `subuser`,`username`,`useraction`,`ip`,`logdate`,`cname` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype` IN ('user','cron') AND l.`userid`=:userid AND l.`resellerid`=:resellerid AND (`username` LIKE :search OR `cname` LIKE :search OR `ip` LIKE :search OR `logdate` LIKE :search OR `useraction` LIKE :search) ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%', ':userid' => $user_id, ':resellerid' => $reseller_id));
} else {
$query = $sql->prepare("SELECT `subuser`,`username`,`useraction`,`ip`,`logdate`,`cname` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype` IN ('user','cron') AND l.`userid`=? AND l.`resellerid`=? ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array($user_id, $reseller_id));
}
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if ($row['subuser'] == 0) {
$username = $row['username'];
$ip = $row['ip'];
} else {
$username = $row['cname'];
$ip = (isanyadmin($row['subuser'])) ? 'admin' : $row['ip'];
}
$array['aaData'][] = array($row['logdate'], $username, str_replace($placeholders2, $replace2, str_replace($placeholders, $replace, $row['useraction'])), $ip);
}
require_once(EASYWIDIR . '/stuff/ajax/datatable_userlog.php');
// App server
} else if ($ui->smallletters('d', 9, 'get') =='appserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['roots']) {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata`");
$query->execute();
} else {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` AS r WHERE `resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)");
$query->execute(array(':reseller_id' => $resellerLockupID));
}
require_once(EASYWIDIR . '/stuff/ajax/datatable_appserver.php');
$array['iTotalRecords'] = $query->fetchColumn();
// App (GS + Tools) masterserver
} else if ($ui->smallletters('d', 15, 'get') =='appmasterserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['masterServer']) {
if ($sSearch) {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` WHERE `id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search");
$query->execute(array(':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` AS r WHERE (`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) AND (`id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search)");
$query->execute(array(':search' => '%' . $sSearch . '%',':reseller_id' => $resellerLockupID));
}
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => 'r.`ip`', 1 => 'r.`id`', 2 => 'r.`active`', 3 => 'r.`os`', 4 => '`gameserver_amount`', 5 => '`gameserver_ram`', 6 => 'r.`description`');
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 = '`id` ASC';
}
if ($sSearch) {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE r.`id` LIKE :search OR r.`ip` LIKE :search OR r.`description` LIKE :search ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE (r.`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) AND (r.`id` LIKE :search OR r.`ip` LIKE :search OR r.`description` LIKE :search) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%', ':reseller_id' => $resellerLockupID));
}
} else {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute();
} else {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE r.`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':reseller_id' => $resellerLockupID));
}
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$array['aaData'][] = array($row['ip'], $row['id'], ($row['active'] == 'Y') ? (string) $gsprache->yes : (string) $gsprache->no, ($row['os'] == 'L') ? 'Linux' : 'Windows', (int) $row['gameserver_amount'] . '/' . (int) $row['maxserver'], (int) $row['gameserver_ram'] . '/' . (int) $row['ram'], $row['description'], returnButton($template_to_use, 'ajax_admin_buttons_ri.tpl', 'ro', 'ri', $row['id'], $gsprache->reinstall) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'ro', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_md.tpl', 'ro', 'md', $row['id'], $gsprache->mod));
}
require_once(EASYWIDIR . '/stuff/ajax/datatable_appmasterserver.php');
// Code wise it seems odd, but this way we can get plausible userIDs for following queries up front
} else {
@ -210,7 +111,7 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
$ipsAvailable = array();
}
require_once IncludeTemplate($template_to_use,'ajax_admin_roots_ips.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_admin_roots_ips.tpl', 'ajax');
die;
@ -239,7 +140,7 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
$dns = $row['defaultdns'];
}
require_once IncludeTemplate($template_to_use,'ajax_admin_web_master.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_admin_web_master.tpl', 'ajax');
die;
@ -272,7 +173,7 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
}
require_once IncludeTemplate($template_to_use,'ajax_admin_voice_stats.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_admin_voice_stats.tpl', 'ajax');
die;
@ -288,7 +189,7 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
}
}
require_once IncludeTemplate($template_to_use,'ajax_userpanel_voice_stats.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_userpanel_voice_stats.tpl', 'ajax');
die;
@ -318,48 +219,13 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
$table[$row['id']] = $topic;
}
require_once IncludeTemplate($template_to_use,'ajax_userpanel_ticket_category.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_userpanel_ticket_category.tpl', 'ajax');
die;
} else if (isset($user_id) and $pa['voiceserverStats'] and $ui->w('d', 14, 'get') == 'voiceUserStats') {
$usageArray = array();
$dateRange = ($ui->escaped('dateRange', 'get')) ? $ui->escaped('dateRange', 'get') : date('m/d/Y', strtotime("-6 days")) . ' - ' . date('m/d/Y');
$accuracy = (in_array($ui->st('accuracy', 'get'), array('da', 'mo'))) ? $ui->st('accuracy', 'get') : 'da';
@list($startDate, $endDate) = explode('-', str_replace(' ', '', $dateRange));
@list($startMonth, $startDay, $startYear) = explode('/', $startDate);
@list($endMonth, $endDay, $endYear) = explode('/', $endDate);
if ($endYear > 2000 and $startYear > 2000) {
$menuStart = round((strtotime("{$endYear}-{$endMonth}-{$endDay}") - strtotime("{$startYear}-{$startMonth}-{$startDay}")) / 86400);
$extractOrNormal = ($accuracy == 'mo') ? "CONCAT(EXTRACT(YEAR FROM `date`),'-',EXTRACT(MONTH FROM `date`))" : '`date`';
$startDateFormatted = date('Y-m-d', strtotime($startYear . '-' . $startMonth . '-' . $startDay));
$endDateFormatted = date('Y-m-d', strtotime($endYear . '-' . $endMonth . '-' . $endDay));
if ($ui->id('serverID', 10, 'get')) {
$query = $sql->prepare("SELECT $extractOrNormal AS `groupedDate`,SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`traffic`)/1024 as `fileTrafficMB` FROM `voice_server_stats` WHERE `sid`=? AND `uid`=? AND `resellerid`=? AND `date` BETWEEN ? AND ? GROUP BY `groupedDate` ORDER BY `groupedDate`");
$query->execute(array($ui->id('serverID', 10, 'get'), $user_id, $reseller_id, $startDateFormatted, $endDateFormatted));
} else {
$query = $sql->prepare("SELECT $extractOrNormal AS `groupedDate`,SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`traffic`)/1024 as `fileTrafficMB` FROM `voice_server_stats` WHERE `uid`=? AND `resellerid`=? AND `date` BETWEEN ? AND ? GROUP BY `groupedDate` ORDER BY `groupedDate`");
$query->execute(array($user_id, $reseller_id, $startDateFormatted, $endDateFormatted));
}
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
$usageArray[] = array('y' => $row['groupedDate'], 'slots' => ceil($row['averageused']), 'traffic' => ceil($row['fileTrafficMB']));
}
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 1 Jan 1900 00:00:00 GMT');
header('Content-type: application/json');
die(json_encode($usageArray));
require_once(EASYWIDIR . '/stuff/ajax/stats_voicestats.php');
} else if (isset($user_id) and ($pa['gserver'] or $pa['restart']) and $ui->username('mapgroup', 50, 'get')) {
@ -370,10 +236,10 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
$mapGroup = $query->fetchColumn();
if ($mapGroup != null) {
require_once IncludeTemplate($template_to_use,'ajax_userpanel_mapgroup.tpl', 'ajax');
require_once IncludeTemplate($template_to_use, 'ajax_userpanel_mapgroup.tpl', 'ajax');
}
die;
}
die('No Access:'.$ui->smallletters('d', 200, 'get'));
die('No Access:' . $ui->smallletters('d', 200, 'get'));

View File

@ -115,25 +115,20 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$table = array();
$query = $sql->prepare("SELECT `ip`,`os` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query = $sql->prepare("SELECT `ip`,`os`,`description` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$ip = $row['ip'];
$os = $row['os'];
$description = $row['description'];
}
if (isset($ip) and isset($os)) {
$query = $sql->prepare("SELECT `id`,`shorten`,`steamgame`,`description` FROM `servertypes` WHERE `resellerid`=? AND (`os`='B' OR `os`=?) ORDER BY `description`");
$query2 = $sql->prepare("SELECT r.`id` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? AND s.`shorten`=?");
$query->execute(array($resellerLockupID, $os));
$query = $sql->prepare("SELECT `id`,`shorten`,`steamgame`,`description` FROM `servertypes` AS t WHERE `resellerid`=? AND (`os`='B' OR `os`=?) AND NOT EXISTS (SELECT 1 FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND s.`shorten`=t.`shorten`) ORDER BY `description`");
$query->execute(array($resellerLockupID, $os, $id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query2->execute(array($id, $resellerLockupID, $row['shorten']));
if ($query2->rowCount() < 1) {
$table[] = array('id' => $row['id'], 'shorten' => $row['shorten'], 'description' => $row['description']);
}
$table[] = array('id' => $row['id'], 'shorten' => $row['shorten'], 'description' => $row['description']);
}
$template_file = 'admin_master_add.tpl';
@ -145,11 +140,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id',19, 'get')) {
if ($ui->smallletters('action',2, 'post') == 'dl') {
if ($ui->smallletters('action', 2, 'post') == 'dl') {
$serverid = $ui->id('id',19, 'get');
$serverid = $ui->id('id', 19, 'get');
$rdata = serverdata('root',$serverid,$aeskey);
$rdata = serverdata('root', $serverid, $aeskey);
$sship = $rdata['ip'];
if ($ui->id('id', 10, 'post')) {
@ -190,9 +185,12 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$id = $ui->id('id',19, 'get');
$query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id,$resellerLockupID));
$ip = $query->fetchColumn();
$query = $sql->prepare("SELECT `ip`,`description` FROM `rserverdata` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$ip = $row['ip'];
$description = $row['description'];
}
$query = $sql->prepare("SELECT r.`id`,s.`shorten`,s.`description` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? ORDER BY `description`");
$query->execute(array($id,$resellerLockupID));
@ -200,161 +198,14 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$table[] = array('id' => $row['id'], 'shorten' => $row['shorten'], 'description' => $row['description']);
}
$template_file = (count($table) > 0) ? 'admin_master_dl.tpl' : 'Error: No such ID!';
$template_file = (isset($ip) and strlen($ip) > 0) ? 'admin_master_dl.tpl' : 'Error: No such ID!';
}
} else if ($ui->st('d', 'get') == 'md') {
$table = array();
configureDateTables('-1', '1, "asc"', 'ajax.php?w=datatable&d=appmasterserver');
$o = $ui->st('o', 'get');
if ($ui->st('o', 'get') == 'ar') {
$orderby = '`resellerid` ASC';
} else if ($ui->st('o', 'get') == 'dr') {
$orderby = '`resellerid` DESC';
} else if ($ui->st('o', 'get') == 'ap') {
$orderby = '`ip` ASC';
} else if ($ui->st('o', 'get') == 'dp') {
$orderby = '`ip` DESC';
} else if ($ui->st('o', 'get') == 'as') {
$orderby = '`active` ASC';
} else if ($ui->st('o', 'get') == 'ds') {
$orderby = '`active` DESC';
} else if ($ui->st('o', 'get') == 'ad') {
$orderby = '`description` ASC';
} else if ($ui->st('o', 'get') == 'dd') {
$orderby = '`description` DESC';
} else if ($ui->st('o', 'get') == 'di') {
$orderby = '`id` DESC';
} else {
$orderby = '`id` ASC';
$o = 'ai';
}
$query = $sql->prepare("SELECT `id`,`ip`,`os`,`bitversion`,`description`,`active` FROM `rserverdata` WHERE `active`='Y' AND `resellerid`=? ORDER BY " . $orderby . " LIMIT " . $start . "," . $amount);
$query2 = $sql->prepare("SELECT s.`shorten`,r.`installing`,r.`updating`,r.`installstarted` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? GROUP BY s.`shorten`");
$query3 = $sql->prepare("SELECT r.`id`,s.`steamgame`,s.`updates`,d.`updates` AS `rupdates` FROM `rservermasterg` r INNER JOIN `rserverdata` d ON r.`serverid`=d.`id` INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`shorten`=? AND r.`resellerid`=? AND d.`ip`=? LIMIT 1");
$query4 = $sql->prepare("UPDATE `rservermasterg` SET `installing`='N',`updating`='N' WHERE `id`=?");
$query->execute(array($resellerLockupID));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$statusList = array();
$sshcheck = array();
$id = $row['id'];
$description = $row['description'];
if ($row['active'] == 'Y') {
$imgName = '16_ok';
$imgAlt = 'Active';
} else {
$imgName = '16_bad';
$imgAlt = 'Inactive';
}
$query2->execute(array($id,$resellerLockupID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$shorten = $row2['shorten'];
if ($row['active'] == 'N' or ($row2['installing'] == 'N' and $row2['updating'] == 'N')) {
$statusList[$row2['shorten']] = '16_ok';
} else {
$toolong = date($row2['installstarted'], strtotime("+15 minutes"));
if (strtotime($logdate) > strtotime($toolong) or $row2['updating'] == 'Y') {
$sshcheck[] = $row2['shorten'];
} else {
$statusList[$row2['shorten']] = '16_installing';
}
}
}
if (count($sshcheck) > 0) {
$serverdata = serverdata('root', $id, $aeskey);
$ip = $serverdata['ip'];
$check = ssh2_execute('gs', $id, './control.sh updatestatus "' . implode(' ', $sshcheck) . '"');
if ($check === false) {
$description = 'The login data does not work';
} else if (preg_match('/^[\w\:\-\=]+$/', $check)) {
$games = array();
foreach (preg_split('/\:/',$check,-1,PREG_SPLIT_NO_EMPTY) as $status) {
$ex = explode('=', $status);
if (isset($ex[1])) {
$games[$ex[0]] = $ex[1];
}
}
foreach ($games as $k => $v) {
if (!in_array($k, array('steamcmd', 'sync'))) {
$query3->execute(array($k, $resellerLockupID, $ip));
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row2) {
if (($v == 0 and $row2['rupdates'] != 4 and $row2['updates'] != 4 and $row2['steamgame'] != 'S') or ($row2['steamgame'] == 'S' and (!isset($games['steamcmd']) or $games['steamcmd'] == 0)) or (($row2['rupdates'] == 4 or $row2['updates'] == 4) and (!isset($games['sync']) or $games['sync'] == 0))) {
$statusList[$k] = '16_ok';
$query4->execute(array($row2['id']));
unset($sshcheck[array_search($k, $sshcheck)]);
}
}
}
}
}
foreach ($sshcheck as $shorten) {
$statusList[$shorten] = '16_installing';
}
}
$table[] = array('id' => $row['id'], 'img' => $imgName, 'alt' => $imgAlt, 'ip' => $row['ip'], 'os' => $row['os'], 'bit' => $row['bitversion'], 'description' => $description, 'statusList' => $statusList, 'active' => $row['active']);
}
$next = $start + $amount;
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` WHERE `resellerid`=?");
$query->execute(array($resellerLockupID));
$colcount = $query->fetchColumn();
$vor = ($colcount > $next) ? $start + $amount : $start;
$back = $start - $amount;
$zur = ($back >= 0) ? $start - $amount : $start;
$pageamount = ceil($colcount / $amount);
$link = '<a href="admin.php?w=ma&amp;d=md&amp;a=';
$link .= (!isset($amount)) ? 20 : $amount;
$link .= ($start == 0) ? '&p=0" class="bold">1</a>' : '&p=0">1</a>';
$pages[] = $link;
$i = 2;
while ($i <= $pageamount) {
$selectpage = ($i - 1) * $amount;
if ($start == $selectpage) {
$pages[] = '<a href="admin.php?w=ma&amp;d=md&amp;a=' . $amount . '&p=' . $selectpage . '" class="bold">' . $i . '</a>';
} else {
$pages[] = '<a href="admin.php?w=ma&amp;d=md&amp;a=' . $amount . '&p=' . $selectpage . '">' . $i . '</a>';
}
$i++;
}
$pages = implode(', ',$pages);
$template_file = 'admin_master_list.tpl';
} else if ($ui->st('d', 'get') == 'ud' and $ui->smallletters('action', 2, 'post') == 'ud') {
@ -369,7 +220,6 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
}
}
if ((isset($ips))) {
$query = $sql->prepare("SELECT s.`shorten` FROM `rservermasterg` r LEFT JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`description`=? AND r.`serverid`=? AND r.`installing`='N' AND r.`resellerid`=?");

View File

@ -0,0 +1,154 @@
<?php
/**
* File: datatable_appmasterserver.php.
* Author: Ulrich Block
* Date: 14.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!');
}
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` WHERE `resellerid`=?");
$query->execute(array($resellerLockupID));
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
$query = $sql->prepare("SELECT COUNT(r.`id`) AS `amount` FROM `rserverdata` AS r WHERE r.`active`='Y' AND r.`resellerid`=:resellerID AND (r.`id` LIKE :search OR r.`ip` LIKE :search OR r.`description` LIKE :search OR EXISTS(SELECT 1 FROM `rservermasterg` AS m INNER JOIN `servertypes` s ON s.`id`=m.`servertypeid` WHERE m.`serverid`=r.`id` AND s.`shorten` LIKE :search))");
$query->execute(array(':resellerID' => $resellerLockupID, ':search' => '%' . $sSearch . '%'));
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => '`ip`', 1 => '`id`', 2 => '`description`');
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 = '`id` ASC';
}
$query2 = $sql->prepare("SELECT s.`shorten`,r.`installing`,r.`updating`,r.`installstarted` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`serverid`=? AND r.`resellerid`=? GROUP BY s.`shorten`");
$query3 = $sql->prepare("SELECT r.`id`,s.`steamgame`,s.`updates`,d.`updates` AS `rupdates` FROM `rservermasterg` r INNER JOIN `rserverdata` d ON r.`serverid`=d.`id` INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE s.`shorten`=? AND r.`resellerid`=? AND d.`ip`=? LIMIT 1");
$query4 = $sql->prepare("UPDATE `rservermasterg` SET `installing`='N',`updating`='N' WHERE `id`=? LIMIT 1");
if ($sSearch) {
$query = $sql->prepare("SELECT `id`,`ip`,`description` FROM `rserverdata` AS r WHERE `active`='Y' AND `resellerid`=:resellerID AND (`id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search OR EXISTS(SELECT 1 FROM `rservermasterg` AS m INNER JOIN `servertypes` s ON s.`id`=m.`servertypeid` WHERE m.`serverid`=r.`id` AND s.`shorten` LIKE :search)) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':resellerID' => $resellerLockupID, ':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT `id`,`ip`,`description` FROM `rserverdata` WHERE `active`='Y' AND `resellerid`=? ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array($resellerLockupID));
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$statusList = array();
$sshcheck = array();
$description = $row['description'];
$query2->execute(array($row['id'], $resellerLockupID));
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
$shorten = $row2['shorten'];
if ($row2['installing'] == 'N' and $row2['updating'] == 'N') {
$statusList[$row2['shorten']] = true;
} else {
$toolong = date($row2['installstarted'], strtotime("+15 minutes"));
if (strtotime($logdate) > strtotime($toolong) or $row2['updating'] == 'Y') {
$sshcheck[] = $row2['shorten'];
} else {
$statusList[$row2['shorten']] = false;
}
}
}
if (count($sshcheck) > 0) {
$serverdata = serverdata('root', $row['id'], $aeskey);
$ip = $serverdata['ip'];
$check = ssh2_execute('gs', $row['id'], './control.sh updatestatus "' . implode(' ', $sshcheck) . '"');
if ($check === false) {
$description = 'The login data does not work';
} else if (preg_match('/^[\w\:\-\=]+$/', $check)) {
$games = array();
foreach (preg_split('/\:/',$check,-1,PREG_SPLIT_NO_EMPTY) as $status) {
$ex = explode('=', $status);
if (isset($ex[1])) {
$games[$ex[0]] = $ex[1];
}
}
foreach ($games as $k => $v) {
if (!in_array($k, array('steamcmd', 'sync'))) {
$query3->execute(array($k, $resellerLockupID, $ip));
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row2) {
if (($v == 0 and $row2['rupdates'] != 4 and $row2['updates'] != 4 and $row2['steamgame'] != 'S') or ($row2['steamgame'] == 'S' and (!isset($games['steamcmd']) or $games['steamcmd'] == 0)) or (($row2['rupdates'] == 4 or $row2['updates'] == 4) and (!isset($games['sync']) or $games['sync'] == 0))) {
$statusList[$k] = true;
$query4->execute(array($row2['id']));
unset($sshcheck[array_search($k, $sshcheck)]);
}
}
}
}
}
foreach ($sshcheck as $shorten) {
$statusList[$shorten] = false;
}
}
$array['aaData'][] = array($row['ip'], $row['id'], $description, returnButton($template_to_use, 'ajax_admin_master_list.tpl', $statusList, '', '', ''), returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'ma', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_add.tpl', 'ma', 'ad', $row['id'], $gsprache->add));
}

View File

@ -0,0 +1,97 @@
<?php
/**
* File: datatable_appserver.php.
* Author: Ulrich Block
* Date: 14.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!');
}
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata`");
$query->execute();
} else {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` AS r WHERE `resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)");
$query->execute(array(':reseller_id' => $resellerLockupID));
}
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` WHERE `id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search");
$query->execute(array(':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` AS r WHERE (`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) AND (`id` LIKE :search OR `ip` LIKE :search OR `description` LIKE :search)");
$query->execute(array(':search' => '%' . $sSearch . '%',':reseller_id' => $resellerLockupID));
}
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => 'r.`ip`', 1 => 'r.`id`', 2 => 'r.`active`', 3 => 'r.`os`', 4 => '`gameserver_amount`', 5 => '`gameserver_ram`', 6 => 'r.`description`');
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 = '`id` ASC';
}
if ($sSearch) {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE r.`id` LIKE :search OR r.`ip` LIKE :search OR r.`description` LIKE :search ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE (r.`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`)) AND (r.`id` LIKE :search OR r.`ip` LIKE :search OR r.`description` LIKE :search) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%', ':reseller_id' => $resellerLockupID));
}
} else {
if ($reseller_id == 0) {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute();
} else {
$query = $sql->prepare("SELECT r.`id`,r.`ip`,r.`active`,r.`description`,r.`maxserver`,r.`ram`,r.`os`,(SELECT COUNT(1) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_amount`,(SELECT SUM(`maxram`) AS `amount` FROM `gsswitch` g WHERE g.`rootID`=r.`id`) AS `gameserver_ram` FROM `rserverdata` r WHERE r.`resellerid`=:reseller_id OR EXISTS (SELECT 1 FROM `userdata` WHERE `resellerid`=:reseller_id AND `id`=r.`resellerid`) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':reseller_id' => $resellerLockupID));
}
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$array['aaData'][] = array($row['ip'], $row['id'], ($row['active'] == 'Y') ? (string) $gsprache->yes : (string) $gsprache->no, ($row['os'] == 'L') ? 'Linux' : 'Windows', (int) $row['gameserver_amount'] . '/' . (int) $row['maxserver'], (int) $row['gameserver_ram'] . '/' . (int) $row['ram'], $row['description'], returnButton($template_to_use, 'ajax_admin_buttons_ri.tpl', 'ro', 'ri', $row['id'], $gsprache->reinstall) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'ro', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_md.tpl', 'ro', 'md', $row['id'], $gsprache->mod));
}

View File

@ -0,0 +1,97 @@
<?php
/**
* File: datatable_userlog.php.
* Author: Ulrich Block
* Date: 14.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);
$placeholders = array('%%', '%ad%', '%add%', '%dl%', '%del%', '%md%', '%mod%', '%start%', '%restart%', '%stop%', '%upd%', '%fail%', '%ok%', '%psw%', '%cfg%', '%import%', '%reinstall%', '%backup%', '%use%');
$replace = array('', $gsprache->add, $gsprache->add, $gsprache->del, $gsprache->del, $gsprache->mod, $gsprache->mod, $gsprache->start, $gsprache->start, $gsprache->stop, $gsprache->update,'','', $gssprache->password, $gssprache->config, $gsprache->import, $gssprache->reinstall, $gsprache->backup, $gsprache->use);
$placeholders2 = array('%voserver%', '%gserver%', '%user%', '%fastdl%', '%master%', '%user%', '%root%', '%addon%', '%settings%', '%vserver%', '%ticket_subject%', '%reseller%', '%virtual%', '%eac%', '%resync%', '%virtualimage%', '%template%', '%voserver%', '%emailsettings%', '%dns%', '%tsdns%', '%pmode%', '%file%');
$replace2 = array($gsprache->voiceserver, $gsprache->gameserver, $gsprache->user, $gsprache->fastdownload, $gsprache->master, $gsprache->user, $gsprache->root, $gsprache->addon2, $gsprache->settings, $gsprache->virtual, $gsprache->support, $gsprache->reseller, $gsprache->hostsystem,'Easy Anti Cheat', $gssprache->resync, $gsprache->virtual . ' ' . $gsprache->template, $gsprache->template, $gsprache->voiceserver,'E-Mail '.$gsprache->settings, 'TSDNS', 'TSDNS', $gssprache->protect, $gsprache->file);
if ($sSearch) {
$sSearch = str_replace($replace, $placeholders, str_replace($replace2, $placeholders2, $sSearch));
}
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `userlog` WHERE `usertype`='user' AND `userid`=? AND `resellerid`=?");
$query->execute(array($user_id, $reseller_id));
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype`='user' AND l.`userid`=:userid AND l.`resellerid`=:resellerid AND (`username` LIKE :search OR `cname` LIKE :search OR `ip` LIKE :search OR `logdate` LIKE :search OR `useraction` LIKE :search)");
$query->execute(array(':search' => '%' . $sSearch . '%', ':userid' => $user_id, ':resellerid' => $reseller_id));
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => '`logdate`', 1 => array('`username`', '`cname`'), 2 => '`useraction`', 3 => '`ip`');
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 `subuser`,`username`,`useraction`,`ip`,`logdate`,`cname` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype` IN ('user','cron') AND l.`userid`=:userid AND l.`resellerid`=:resellerid AND (`username` LIKE :search OR `cname` LIKE :search OR `ip` LIKE :search OR `logdate` LIKE :search OR `useraction` LIKE :search) ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':search' => '%' . $sSearch . '%', ':userid' => $user_id, ':resellerid' => $reseller_id));
} else {
$query = $sql->prepare("SELECT `subuser`,`username`,`useraction`,`ip`,`logdate`,`cname` FROM `userlog` AS l LEFT JOIN `userdata` AS s ON s.`id`=l.`subuser` AND l.`subuser`!=0 WHERE l.`usertype` IN ('user','cron') AND l.`userid`=? AND l.`resellerid`=? ORDER BY {$orderBy} LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array($user_id, $reseller_id));
}
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if ($row['subuser'] == 0) {
$username = $row['username'];
$ip = $row['ip'];
} else {
$username = $row['cname'];
$ip = (isanyadmin($row['subuser'])) ? 'admin' : $row['ip'];
}
$array['aaData'][] = array($row['logdate'], $username, str_replace($placeholders2, $replace2, str_replace($placeholders, $replace, $row['useraction'])), $ip);
}

View File

@ -0,0 +1,79 @@
<?php
/**
* File: stats_voicestats.php.
* Author: Ulrich Block
* Date: 14.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!');
}
$usageArray = array();
$dateRange = ($ui->escaped('dateRange', 'get')) ? $ui->escaped('dateRange', 'get') : date('m/d/Y', strtotime("-6 days")) . ' - ' . date('m/d/Y');
$accuracy = (in_array($ui->st('accuracy', 'get'), array('da', 'mo'))) ? $ui->st('accuracy', 'get') : 'da';
@list($startDate, $endDate) = explode('-', str_replace(' ', '', $dateRange));
@list($startMonth, $startDay, $startYear) = explode('/', $startDate);
@list($endMonth, $endDay, $endYear) = explode('/', $endDate);
if ($endYear > 2000 and $startYear > 2000) {
$menuStart = round((strtotime("{$endYear}-{$endMonth}-{$endDay}") - strtotime("{$startYear}-{$startMonth}-{$startDay}")) / 86400);
$extractOrNormal = ($accuracy == 'mo') ? "CONCAT(EXTRACT(YEAR FROM `date`),'-',EXTRACT(MONTH FROM `date`))" : '`date`';
$startDateFormatted = date('Y-m-d', strtotime($startYear . '-' . $startMonth . '-' . $startDay));
$endDateFormatted = date('Y-m-d', strtotime($endYear . '-' . $endMonth . '-' . $endDay));
if ($ui->id('serverID', 10, 'get')) {
$query = $sql->prepare("SELECT $extractOrNormal AS `groupedDate`,SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`traffic`)/1024 as `fileTrafficMB` FROM `voice_server_stats` WHERE `sid`=? AND `uid`=? AND `resellerid`=? AND `date` BETWEEN ? AND ? GROUP BY `groupedDate` ORDER BY `groupedDate`");
$query->execute(array($ui->id('serverID', 10, 'get'), $user_id, $reseller_id, $startDateFormatted, $endDateFormatted));
} else {
$query = $sql->prepare("SELECT $extractOrNormal AS `groupedDate`,SUM(`used`)/COUNT(`sid`) AS `averageused`,SUM(`traffic`)/1024 as `fileTrafficMB` FROM `voice_server_stats` WHERE `uid`=? AND `resellerid`=? AND `date` BETWEEN ? AND ? GROUP BY `groupedDate` ORDER BY `groupedDate`");
$query->execute(array($user_id, $reseller_id, $startDateFormatted, $endDateFormatted));
}
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
$usageArray[] = array('y' => $row['groupedDate'], 'slots' => ceil($row['averageused']), 'traffic' => ceil($row['fileTrafficMB']));
}
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 1 Jan 1900 00:00:00 GMT');
header('Content-type: application/json');
die(json_encode($usageArray));

View File

@ -0,0 +1,41 @@
<section class="content-header">
<h1><?php echo $gsprache->appRoot;?></h1>
<ol class="breadcrumb">
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
<li><?php echo $gsprache->master;?></li>
<li><?php echo $gsprache->add;?></li>
<li class="active"><?php echo $ip;?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-info">
<form role="form" action="admin.php?w=ma&amp;d=ad&amp;id=<?php echo $id;?>&amp;r=ma" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post" >
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="ad">
<div class="box-header">
<h3 class="box-title"><?php echo $ip.' '.$description;?></h3>
</div>
<div class="box-body">
<?php foreach ($table as $table_row){ ?>
<div class="form-group">
<input id="input<?php echo $table_row['shorten'];?>" type="checkbox" name="id[]" value="<?php echo $table_row['id'];?>">
<label for="input<?php echo $table_row['shorten'];?>"><?php echo '<img src="images/games/icons/'.$table_row['shorten'].'.png" alt="'.$table_row['shorten'].'" width="16" /> '.$table_row['description'];?></label>
</div>
<?php } ?>
</div>
<div class="box-footer">
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="fa fa-plus-circle">&nbsp;<?php echo $gsprache->add;?></i></button>
</div>
</form>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,41 @@
<section class="content-header">
<h1><?php echo $gsprache->appRoot;?></h1>
<ol class="breadcrumb">
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
<li><?php echo $gsprache->master;?></li>
<li><?php echo $gsprache->del;?></li>
<li class="active"><?php echo $ip;?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-danger">
<form role="form" action="admin.php?w=ma&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=ma" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post" >
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
<div class="box-header">
<h3 class="box-title"><?php echo $ip.' '.$description;?></h3>
</div>
<div class="box-body">
<?php foreach ($table as $table_row){ ?>
<div class="form-group">
<input id="input<?php echo $table_row['shorten'];?>" type="checkbox" name="id[]" value="<?php echo $table_row['id'];?>">
<label for="input<?php echo $table_row['shorten'];?>"><?php echo '<img src="images/games/icons/'.$table_row['shorten'].'.png" alt="'.$table_row['shorten'].'" width="16" /> '.$table_row['description'];?></label>
</div>
<?php } ?>
</div>
<div class="box-footer">
<button class="btn btn-danger" id="inputEdit" type="submit"><i class="fa fa-trash">&nbsp;<?php echo $gsprache->del;?></i></button>
</div>
</form>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,39 @@
<section class="content-header">
<h1><?php echo $gsprache->appRoot;?></h1>
<ol class="breadcrumb">
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
<li><?php echo $gsprache->master;?></li>
<li class="active"><?php echo $gsprache->overview;?></li>
</ol>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<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->haupt_ip;?></a></th>
<th>ID</a></th>
<th><?php echo $sprache->desc;?></a></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo $sprache->haupt_ip;?></a></th>
<th>ID</a></th>
<th><?php echo $sprache->desc;?></a></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1 @@
<a href="admin.php?w=<?php echo $what;?>&amp;d=<?php echo $do;?>&amp;id=<?php echo $id;?>"><span class="btn btn-primary btn-sm"><i class="fa fa-plus-circle"></i> <?php echo $description;?></span></a>

View File

@ -0,0 +1 @@
<?php foreach($what as $k=>$v){ echo ($v==false) ? '<i class="fa fa-spinner fa-spin"></i>'.$k.' ' : '<i class="fa fa-check"></i>'.$k.' '; };?>