#17 partial + #30 Ajax with jQuery

This commit is contained in:
Ulrich Block 2014-09-27 16:58:58 +02:00
parent 7082db6bc6
commit 20f4c9dc9a
6 changed files with 27 additions and 74 deletions

View File

@ -335,67 +335,7 @@ if ($die == true) {
} }
require_once IncludeTemplate($template_to_use,'ajax_admin_voiceserver_usage.tpl', 'ajax'); require_once IncludeTemplate($template_to_use,'ajax_admin_voiceserver_usage.tpl', 'ajax');
} }
} else if ($pa['gserver'] and $ui->st('d', 'get')!="vs" and $ui->st('d', 'get')!="vo" and ($ui->id('id',19, 'get') or $ui->ip('ip', 'get'))) {
$sprache = getlanguagefile('gserver', $user_language, $reseller_id);
if ($reseller_id != 0 and $admin_id != $reseller_id) {
$reseller_id = $admin_id;
}
if ($ui->id('id',19, 'get') and $ui->st('d', 'get')!="vs") {
$used = 0;
$max = 0;
$installedserver = 0;
$maxserver = 0;
$maxslots = 0;
$query = $sql->prepare("SELECT `maxslots`,`maxserver` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($ui->id('id',19, 'get'), $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$maxslots = $row['maxslots'];
$maxserver = $row['maxserver'];
}
$query = $sql->prepare("SELECT `slots`,`queryNumplayers` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? AND `active`='Y'");
$query->execute(array($ui->id('id',19, 'get'), $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$used+=$row['queryNumplayers'];
$max+=$row['slots'];
$installedserver++;
}
require_once IncludeTemplate($template_to_use,'ajax_admin_gserver_usage.tpl', 'ajax');
} else if ($ui->ip('ip', 'get') and $ui->st('d', 'get')!="vs") {
$query = $sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? AND `resellerid`=? ORDER BY `port`");
$query->execute(array($ui->ip('ip', 'get'), $reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (port($row['port'])){
$ports[] = $row['port'];
}
if (port($row['port2'])){
$ports[] = $row['port2'];
}
if (port($row['port3'])){
$ports[] = $row['port3'];
}
if (port($row['port4'])){
$ports[] = $row['port4'];
}
if (port($row['port5'])){
$ports[] = $row['port5'];
}
}
$query = $sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
$query->execute(array($ui->ip('ip', 'get')));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (port($row['port'])){
$ports[] = $row['port'];
}
}
if (isset($ports)) {
$ports=array_unique($ports);
asort($ports);
$ports=implode(", ", $ports);
} else {
$ports = '';
}
require_once IncludeTemplate($template_to_use,'ajax_admin_gserver_ports.tpl', 'ajax');
}
} else if (($pa['usertickets'] or $pa['usertickets']) and $ui->port('po', 'get') and ($ui->st('d', 'get') == 'ut' or $ui->st('d', 'get') == 'rt')) { } else if (($pa['usertickets'] or $pa['usertickets']) and $ui->port('po', 'get') and ($ui->st('d', 'get') == 'ut' or $ui->st('d', 'get') == 'rt')) {
if ($reseller_id != 0 and $admin_id==$reseller_id and $ui->st('d', 'get') == 'rt') { if ($reseller_id != 0 and $admin_id==$reseller_id and $ui->st('d', 'get') == 'rt') {
$resellerid = 0; $resellerid = 0;

View File

@ -168,7 +168,6 @@ if (!isset($success['false']) and array_value_exists('action', 'add', $data) and
if (!isset($typeIDs[$singleShorten])) { if (!isset($typeIDs[$singleShorten])) {
$success['false'][] = 'image with the shorten ' . $singleShorten . ' does not exists'; $success['false'][] = 'image with the shorten ' . $singleShorten . ' does not exists';
} }
} }
if (!isset($success['false']) and !in_array($externalServerID, $bad)) { if (!isset($success['false']) and !in_array($externalServerID, $bad)) {
@ -268,7 +267,7 @@ if (!isset($success['false']) and array_value_exists('action', 'add', $data) and
$calculatedCores = implode(',', $calculatedCores); $calculatedCores = implode(',', $calculatedCores);
} }
foreach (preg_split('/\r\n/', -1, PREG_SPLIT_NO_EMPTY) as $ip) { foreach (preg_split('/\r\n/', $row['altips'], -1, PREG_SPLIT_NO_EMPTY) as $ip) {
$ips[] = $ip; $ips[] = $ip;
} }
@ -363,7 +362,6 @@ if (!isset($success['false']) and array_value_exists('action', 'add', $data) and
$port4 += $portStep; $port4 += $portStep;
$port5 += $portStep; $port5 += $portStep;
} }
} }
$initialpassword = (isset($data['initialpassword']) and wpreg_check($data['initialpassword'], 50) and strlen($data['initialpassword']) > 1) ? $data['initialpassword'] : passwordgenerate(10); $initialpassword = (isset($data['initialpassword']) and wpreg_check($data['initialpassword'], 50) and strlen($data['initialpassword']) > 1) ? $data['initialpassword'] : passwordgenerate(10);

View File

@ -1068,12 +1068,14 @@ if (!function_exists('passwordgenerate')) {
} }
} }
$ports=array_unique($ports); $ports = array_unique($ports);
asort($ports); asort($ports);
$portsArray[count($ports)] = array('ip' => $serverIP, 'ports' => $ports); $portsArray[count($ports)] = array('ip' => $serverIP, 'ports' => $ports);
} }
$bestIP=current($portsArray);
$bestIP = current($portsArray);
return array('ip' => $bestIP['ip'], 'ports' => $bestIP['ports']); return array('ip' => $bestIP['ip'], 'ports' => $bestIP['ports']);
} }

View File

@ -24,12 +24,13 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="panel box <?php if($table_row['img']=='16_bad') echo 'box-warning'; else if($table_row['img']=='16_error') echo 'box-danger'; else echo 'box-success';?>"> <div class="panel box <?php if($table_row['img']=='16_bad') echo 'box-warning'; else if($table_row['img']=='16_error') echo 'box-danger'; else echo 'box-success';?>">
<h4><img src="images/games/icons/<?php echo $table_row['gameShorten'];?>.png" alt="<?php echo $table_row['gameShorten'];?>" width="14" /> <a href="hlsw://<?php echo $table_row['server'];?>"><?php echo $table_row['server'].' '.$table_row['name'];?></a></h4> <div class="box-header">
<h3 class="box-title"><img src="images/games/icons/<?php echo $table_row['gameShorten'];?>.png" alt="<?php echo $table_row['gameShorten'];?>" width="18"> <a href="hlsw://<?php echo $table_row['server'];?>"><?php echo $table_row['server'].' '.$table_row['name'];?></a></h3>
<?php if(!empty($table_row['premoved'])){ ?><div class="alert alert-warning alert-dismissable"><i class="fa fa-warning"></i> <?php echo $table_row['premoved'];?></div><?php } ?> </div>
<?php if(!empty($table_row['nameremoved'])){ ?><div class="alert alert-warning alert-dismissable"><i class="fa fa-warning"></i> <?php echo $table_row['nameremoved'];?></div><?php } ?>
<div class="box-body"> <div class="box-body">
<?php if(!empty($table_row['premoved'])){ ?><div class="alert alert-danger alert-dismissable"><i class="fa fa-warning"></i> <?php echo $table_row['premoved'];?></div><?php } ?>
<?php if(!empty($table_row['nameremoved'])){ ?><div class="alert alert-danger alert-dismissable"><i class="fa fa-warning"></i> <?php echo $table_row['nameremoved'];?></div><?php } ?>
<div class="form-group"> <div class="form-group">
<a href="userpanel.php?w=gs&amp;d=rs&amp;id=<?php echo $table_row['id'];?>&amp;r=gs" onclick="return confirm('<?php echo $table_row['server'];?>: <?php echo $sprache->confirm_restart;?>');"><button class="btn btn-sm btn-success inline"><i class="icon-white icon-play"></i> <?php echo $sprache->restarts;?></button></a> <a href="userpanel.php?w=gs&amp;d=rs&amp;id=<?php echo $table_row['id'];?>&amp;r=gs" onclick="return confirm('<?php echo $table_row['server'];?>: <?php echo $sprache->confirm_restart;?>');"><button class="btn btn-sm btn-success inline"><i class="icon-white icon-play"></i> <?php echo $sprache->restarts;?></button></a>
<?php if($table_row['stopped']=='N'){ ?><a href="userpanel.php?w=gs&amp;d=st&amp;id=<?php echo $table_row['id'];?>&amp;r=gs" onclick="return confirm('<?php echo $table_row['server'];?>: <?php echo $sprache->confirm_stop;?>');"><button class="btn btn-sm btn-danger"><i class="fa fa-power-off"></i> <?php echo $sprache->stop;?></button></a><?php } ?> <?php if($table_row['stopped']=='N'){ ?><a href="userpanel.php?w=gs&amp;d=st&amp;id=<?php echo $table_row['id'];?>&amp;r=gs" onclick="return confirm('<?php echo $table_row['server'];?>: <?php echo $sprache->confirm_stop;?>');"><button class="btn btn-sm btn-danger"><i class="fa fa-power-off"></i> <?php echo $sprache->stop;?></button></a><?php } ?>

View File

@ -32,7 +32,7 @@
<div class="form-group"> <div class="form-group">
<label for="topic_maintopic"><?php echo $sprache->topic_name;?></label> <label for="topic_maintopic"><?php echo $sprache->topic_name;?></label>
<select class="form-control" id="topic_maintopic" name="maintopic" onchange="getdetails('ajax.php?d=userTicketCategories&amp;topicName=', this.value, 'topic_name_sub')" required="required"> <select class="form-control" id="topic_maintopic" name="maintopic" required="required">
<option></option> <option></option>
<?php foreach ($table as $table_row){ ?> <?php foreach ($table as $table_row){ ?>
<option value="<?php echo $table_row['id'];?>" ><?php echo $table_row['topic'];?></option> <option value="<?php echo $table_row['id'];?>" ><?php echo $table_row['topic'];?></option>
@ -63,4 +63,10 @@
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript">
$('#topic_maintopic').on('change', function() {
$('#topic_name_sub').load('ajax.php?d=userTicketCategories&topicName=' + $("#topic_maintopic").val());
});
</script>

View File

@ -38,7 +38,7 @@
<div class="form-group"> <div class="form-group">
<label for="inputKind"><?php echo $gsprache->stats;?></label> <label for="inputKind"><?php echo $gsprache->stats;?></label>
<select class="form-control" id="inputKind" name="kind" onchange="getdetails('ajax.php?d=uservoicestats&amp;w=',this.value, 'serverSelect')"> <select class="form-control" id="inputKind" name="kind">
<option value="al"><?php echo $sprache->all;?></option> <option value="al"><?php echo $sprache->all;?></option>
<option value="se" <?php if ($kind=='se') echo 'selected="selected"'?>><?php echo $sprache->server;?></option> <option value="se" <?php if ($kind=='se') echo 'selected="selected"'?>><?php echo $sprache->server;?></option>
</select> </select>
@ -96,4 +96,10 @@
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<script type="text/javascript">
$('#inputKind').on('change', function() {
$('#serverSelect').load('ajax.php?d=uservoicestats&w=' + $("#inputKind").val());
});
</script>