mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
17 + 90 + 91: MC + CraftBukkit Updater
https://github.com/easy-wi/developer/issues/17 https://github.com/easy-wi/developer/issues/90 https://github.com/easy-wi/developer/issues/91
This commit is contained in:
parent
019c0bc904
commit
715c1e60d7
@ -53,7 +53,7 @@ if ($ui->ip4('REMOTE_ADDR','server') and $ui->names('user',255,'post')) {
|
||||
$pwd=$row['pwd'];
|
||||
$salt=$row['salt'];
|
||||
if ($row['active'] == 'Y' and passwordhash($ui->password('pwd',255,'post'),$salt)==$pwd and $ui->names('user',255,'post')==$row['user']) {
|
||||
$resellerIDs[]=$row['resellerID'];
|
||||
$resellerIDs[] = $row['resellerID'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -95,7 +95,7 @@ if (isset($resellerIDs) and count($resellerIDs)==1 and passwordhash($ui->passwor
|
||||
if (is_object($value)) {
|
||||
$tempArray[$key]=null;
|
||||
} else {
|
||||
$tempArray[$key]=$value;
|
||||
$tempArray[$key] = $value;
|
||||
}
|
||||
}
|
||||
$data=$tempArray;
|
||||
|
@ -48,7 +48,7 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$timelimit=600;
|
||||
}
|
||||
set_time_limit($timelimit);
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
function printText ($text) {
|
||||
echo $text."\r\n";
|
||||
@ -108,10 +108,10 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
unset($lastID);
|
||||
foreach ($decoded->users as $value) {
|
||||
if (isset($value->externalID)) {
|
||||
$query4->execute(array(json_encode(array('I'=>$row['importID'])),$value->externalID));
|
||||
$query4->execute(array(json_encode(array('I' => $row['importID'])),$value->externalID));
|
||||
$checkAmount=$query4->fetchColumn();
|
||||
if($checkAmount>0 and $row['fetchUpdates'] == 'Y') {
|
||||
$query2->execute(array(getParam('salutation'),strtolower(getParam('email')),getParam('loginName'),getParam('firstName'),getParam('lastName'),getParam('birthday'),getParam('country'),getParam('phone'),getParam('fax'),getParam('handy'),getParam('city'),getParam('cityn'),getParam('street'),getParam('streetn'),json_encode(array('I'=>$row['importID'])),getParam('externalID'), $row['resellerID']));
|
||||
$query2->execute(array(getParam('salutation'),strtolower(getParam('email')),getParam('loginName'),getParam('firstName'),getParam('lastName'),getParam('birthday'),getParam('country'),getParam('phone'),getParam('fax'),getParam('handy'),getParam('city'),getParam('cityn'),getParam('street'),getParam('streetn'),json_encode(array('I' => $row['importID'])),getParam('externalID'), $row['resellerID']));
|
||||
printText('User updated. Loginname: '.$value->loginName.' e-mail: '.strtolower($value->email));
|
||||
} else if ($checkAmount>0) {
|
||||
printText('User update skipped. Loginname: '.$value->loginName.' e-mail: '.strtolower($value->email));
|
||||
@ -124,7 +124,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
printText('User update skipped because source system differ. Loginname: '.$value->loginName.' e-mail: '.strtolower($value->email));
|
||||
} else {
|
||||
printText('Import user. Loginname: '.$value->loginName.' e-mail: '.strtolower($value->email));
|
||||
$query3->execute(array(getParam('salutation'),strtolower(getParam('email')),getParam('loginName'),getParam('firstName'),getParam('lastName'),getParam('birthday'),getParam('country'),getParam('phone'),getParam('fax'),getParam('handy'),getParam('city'),getParam('cityn'),getParam('street'),getParam('streetn'), $row['groupID'],json_encode(array('I'=>$row['importID'])),getParam('externalID'), $row['resellerID']));
|
||||
$query3->execute(array(getParam('salutation'),strtolower(getParam('email')),getParam('loginName'),getParam('firstName'),getParam('lastName'),getParam('birthday'),getParam('country'),getParam('phone'),getParam('fax'),getParam('handy'),getParam('city'),getParam('cityn'),getParam('street'),getParam('streetn'), $row['groupID'],json_encode(array('I' => $row['importID'])),getParam('externalID'), $row['resellerID']));
|
||||
}
|
||||
}
|
||||
if (getParam('updatetime') != '' and (isset($lastCheck) and strtotime(getParam('updatetime'))>strtotime($lastCheck)) or !isset($lastCheck)) {
|
||||
|
@ -51,7 +51,7 @@ if (isset($argv)) {
|
||||
else if (is_numeric($a)) $sleep=$a;
|
||||
else {
|
||||
$e=explode(':',$a);
|
||||
if (isset($e[1])) $args[$e[0]]=$e[1];
|
||||
if (isset($e[1])) $args[$e[0]] = $e[1];
|
||||
}
|
||||
}
|
||||
if(!isset($deamon)) {
|
||||
@ -63,7 +63,7 @@ if (isset($argv)) {
|
||||
}
|
||||
if(!isset($sleep)) $sleep=60;
|
||||
}
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/functions.php');
|
||||
|
62
web/lend.php
62
web/lend.php
@ -60,7 +60,7 @@ if ($ui->ip4('REMOTE_ADDR','server') and $ui->names('user',255,'post') and !isse
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$pwd=$row['pwd'];
|
||||
$salt=$row['salt'];
|
||||
if ($row['active'] == 'Y' and passwordhash($ui->password('pwd',255,'post'),$salt)==$pwd and $ui->names('user',255,'post')==$row['user']) $resellerIDs[]=$row['resellerID'];
|
||||
if ($row['active'] == 'Y' and passwordhash($ui->password('pwd',255,'post'),$salt)==$pwd and $ui->names('user',255,'post')==$row['user']) $resellerIDs[] = $row['resellerID'];
|
||||
if (isset($resellerIDs) and count($resellerIDs)==1 and passwordhash($ui->password('pwd',255,'post'),$salt)==$pwd) {
|
||||
$reseller_id=$resellerIDs[0];
|
||||
$validacces = true;
|
||||
@ -142,32 +142,32 @@ foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$lendaccess=$row['lendaccess'];
|
||||
$lastcheck=$row['lastcheck'];
|
||||
$timebetweenchecks=(strtotime($lastcheck)-strtotime($row['oldcheck']))/60;
|
||||
$timebetweenlastandnow=(strtotime("now")-strtotime($lastcheck))/60;
|
||||
$timebetweenlastandnow=(strtotime('now')-strtotime($lastcheck))/60;
|
||||
$nextcheck=ceil($timebetweenchecks-$timebetweenlastandnow);
|
||||
if ($nextcheck<0) $nextcheck=$nextcheck*(-1);
|
||||
if($time>0 and $maxtime>0) {
|
||||
while ($time<=$maxtime) {
|
||||
$timeselect[]=$time;
|
||||
$timeselect[] = $time;
|
||||
$time=$time+$timesteps;
|
||||
}
|
||||
}
|
||||
$gsstart=$minplayer;
|
||||
if($player>0 and $gsstart>0) {
|
||||
while ($gsstart<=$player) {
|
||||
$slotselect[]=$gsstart;
|
||||
$slotselect[] = $gsstart;
|
||||
$gsstart=$gsstart+$playersteps;
|
||||
}
|
||||
}
|
||||
if($votime>0 and $vomaxtime>0) {
|
||||
while ($votime<=$vomaxtime) {
|
||||
$votimeselect[]=$votime;
|
||||
$votimeselect[] = $votime;
|
||||
$votime=$votime+$votimesteps;
|
||||
}
|
||||
}
|
||||
$vstart=$vominplayer;
|
||||
if($voplayer>0 and $vstart>0) {
|
||||
while ($vstart<=$voplayer) {
|
||||
$voslotselect[]=$vstart;
|
||||
$voslotselect[] = $vstart;
|
||||
$vstart=$vstart+$voplayersteps;
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ if(isset($servertype)) {
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$serverid=$row['serverid'];
|
||||
$lendtime=$row['lendtime'];
|
||||
$timeleft=round($lendtime-(strtotime("now")-strtotime($row['started']))/60);
|
||||
$timeleft=round($lendtime-(strtotime('now')-strtotime($row['started']))/60);
|
||||
if ($timeleft<=0) {
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
if ($servertype == 'g') {
|
||||
@ -357,16 +357,16 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$free='16_ok.png';
|
||||
$query2->execute(array($row['id']));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$installedShorten[$row2['shorten']]=$row2['description'];
|
||||
$installedShorten[$row2['shorten']] = $row2['description'];
|
||||
if ($row2['slots'] != null) {
|
||||
$runningGame=$row2['shorten'];
|
||||
$slots=$row2['slots'];
|
||||
$timeleft=round($row2['lendtime']-(strtotime("now")-strtotime($row2['started']))/60);
|
||||
$timeleft=round($row2['lendtime']-(strtotime('now')-strtotime($row2['started']))/60);
|
||||
if ($timeleft<0) $timeleft = 0;
|
||||
$free='16_bad.png';
|
||||
}
|
||||
}
|
||||
$lendGameServers[]=array('ip'=>$row['serverip'],'port'=>(int)$row['port'],'queryName'=>htmlentities($row['queryName'],ENT_QUOTES,'UTF-8'),'queryMap'=>htmlentities($row['queryMap'],ENT_QUOTES,'UTF-8'),'runningGame'=>$runningGame,'games'=>$installedShorten,'slots'=>(int)$slots,'usedslots'=>(int)$row['queryNumplayers'],'timeleft'=>(int)$timeleft,'free'=>$free);
|
||||
$lendGameServers[]=array('ip' => $row['serverip'],'port'=>(int)$row['port'],'queryName'=>htmlentities($row['queryName'],ENT_QUOTES,'UTF-8'),'queryMap'=>htmlentities($row['queryMap'],ENT_QUOTES,'UTF-8'),'runningGame' => $runningGame,'games' => $installedShorten,'slots'=>(int)$slots,'usedslots'=>(int)$row['queryNumplayers'],'timeleft'=>(int)$timeleft,'free' => $free);
|
||||
}
|
||||
$query = $sql->prepare("SELECT v.`ip`,v.`port`,v.`queryName`,v.`dns`,v.`usedslots`,v.`slots` AS `availableSlots`,l.`slots`,l.`started`,l.`lendtime` FROM `voice_server` v LEFT JOIN `lendedserver` l ON v.`id`=l.`serverid` AND l.`servertype`='v' WHERE v.`lendserver`='Y' AND v.`active`='Y' AND v.`resellerid`=0");
|
||||
$query->execute(array($reseller_id));
|
||||
@ -375,12 +375,12 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$slots=$row['availableSlots'];
|
||||
$free='16_ok.png';
|
||||
if ($row['slots'] != null) {
|
||||
$timeleft=round($row['lendtime']-(strtotime("now")-strtotime($row['started']))/60);
|
||||
$timeleft=round($row['lendtime']-(strtotime('now')-strtotime($row['started']))/60);
|
||||
if ($timeleft<0) $timeleft = 0;
|
||||
$free='16_bad.png';
|
||||
$slots=$row['slots'];
|
||||
}
|
||||
$lendVoiceServers[]=array('ip'=>$row['ip'],'port'=>(int)$row['port'],'queryName'=>htmlentities($row['queryName'],ENT_QUOTES,'UTF-8'),'connect'=>$row['dns'],'slots'=>(int)$slots,'usedslots'=>(int)$row['usedslots'],'timeleft'=>(int)$timeleft,'free'=>$free);
|
||||
$lendVoiceServers[]=array('ip' => $row['ip'],'port'=>(int)$row['port'],'queryName'=>htmlentities($row['queryName'],ENT_QUOTES,'UTF-8'),'connect' => $row['dns'],'slots'=>(int)$slots,'usedslots'=>(int)$row['usedslots'],'timeleft'=>(int)$timeleft,'free' => $free);
|
||||
}
|
||||
if ($ui->id('xml',1,'post')==1) {
|
||||
header("Content-type: text/xml; charset=UTF-8");
|
||||
@ -438,14 +438,14 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$shorten=$row2['shorten'];
|
||||
$serverids[$shorten][]=$row2['id'];
|
||||
$serverids[$shorten][] = $row2['id'];
|
||||
if (isset($gscounts[$shorten])) {
|
||||
$gscounts[$shorten]++;
|
||||
} else {
|
||||
$gscounts[$shorten] = 1;
|
||||
$gsused[$shorten] = 0;
|
||||
}
|
||||
$shortens[]=$shorten;
|
||||
$shortens[] = $shorten;
|
||||
}
|
||||
$shortenlist=implode('|',$shortens);
|
||||
foreach ($shortens as $shorten) {
|
||||
@ -456,7 +456,7 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$switchcount[$shortenlist][$shorten]['used'] = 0;
|
||||
}
|
||||
foreach ($serverids[$shorten] as $id) {
|
||||
$switchcount[$shortenlist][$shorten]['freeids'][]=$id;
|
||||
$switchcount[$shortenlist][$shorten]['freeids'][] = $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -466,7 +466,7 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$lendtime=$row['lendtime'];
|
||||
$timeleft=round($lendtime-(strtotime("now")-strtotime($row['started']))/60);
|
||||
$timeleft=round($lendtime-(strtotime('now')-strtotime($row['started']))/60);
|
||||
if (!isset($nextfree) or $timeleft<$nextfree) $nextfree=$timeleft;
|
||||
$gscount--;
|
||||
$rcon=$row['rcon'];
|
||||
@ -482,8 +482,8 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
foreach ($query3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$shorten=$row3['shorten'];
|
||||
$gsused[$shorten]++;
|
||||
$shortens[]=$shorten;
|
||||
$serverids[$shorten][]=$row3['id'];
|
||||
$shortens[] = $shorten;
|
||||
$serverids[$shorten][] = $row3['id'];
|
||||
}
|
||||
$shortenlist=implode('|',$shortens);
|
||||
foreach ($shortens as $shorten) {
|
||||
@ -510,13 +510,13 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
$switchcount[$shortenlist][$shorten];
|
||||
if ($amount>0) {
|
||||
$serveravailable = true;
|
||||
$gameselect[$key]=$description;
|
||||
$gameselect[$key] = $description;
|
||||
$text=$sprache->available;
|
||||
} else {
|
||||
$gscount = 0;
|
||||
$text=$sprache->used;
|
||||
}
|
||||
$status[$description]=array('text'=>$text,'amount'=>$amount,'total'=>$value);
|
||||
$status[$description]=array('text' => $text,'amount' => $amount,'total' => $value);
|
||||
}
|
||||
if ((!isset($nextfree) and $gscount>0) or (isset($nextfree) and $gscount>0)){
|
||||
$nextfree = 0;
|
||||
@ -604,18 +604,18 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
if ($leftkey != $key) {
|
||||
foreach ($leftarrays as $gametype => $values) {
|
||||
if (isset($leftservers[$gametype])) {
|
||||
$leftservers[$key][$gametype]=$leftservers[$gametype]+($values['exist']-$values['used']);
|
||||
$leftservers[$key][$gametype] = $leftservers[$gametype]+($values['exist']-$values['used']);
|
||||
} else {
|
||||
$leftservers[$key][$gametype]=$values['exist']-$values['used'];
|
||||
$leftservers[$key][$gametype] = $values['exist']-$values['used'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($arrays as $gametype => $values) {
|
||||
if (isset($leftservers[$gametype])) {
|
||||
$leftservers[$key][$gametype]=$leftservers[$gametype]+($values['exist']-$values['used']-1);
|
||||
$leftservers[$key][$gametype] = $leftservers[$gametype]+($values['exist']-$values['used']-1);
|
||||
} else {
|
||||
$leftservers[$key][$gametype]=$values['exist']-$values['used']-1;
|
||||
$leftservers[$key][$gametype] = $values['exist']-$values['used']-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -625,7 +625,7 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
foreach ($arrays as $key=>$count) {
|
||||
$percent=$percent+((100/$switchcount[$keys][$key]['exist'])*($count));
|
||||
}
|
||||
$mostleft[$keys]=$percent;
|
||||
$mostleft[$keys] = $percent;
|
||||
}
|
||||
arsort($mostleft);
|
||||
$bestmultigame=key($mostleft);
|
||||
@ -634,7 +634,7 @@ if((!isset($servertype) and isset($page_include) and $ui->id('xml',1,'post')!=1)
|
||||
}
|
||||
$timeleft=$lendtime;
|
||||
if (!$ui->id('xml',1,'post')==1) {
|
||||
$_SESSION['lend']['gs']=$serverid;
|
||||
$_SESSION['lend']['gs'] = $serverid;
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `lendedserver` (`serverid`,`servertype`,`rcon`,`password`,`slots`,`started`,`lendtime`,`lenderip`,`ftpuploadpath`,`resellerid`) VALUES (?,?,?,?,?,NOW(),?,?,AES_ENCRYPT(?,?),?)");
|
||||
$query->execute(array($serverid,'g',$rcon,$password,$slots,$lendtime,$loguserip,$ftpuploadpath,$aeskey,$reseller_id));
|
||||
@ -773,7 +773,7 @@ XML;
|
||||
$select3->execute(array($row2['id'],$reseller_id));
|
||||
foreach ($select3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$lendtime=$row3['lendtime'];
|
||||
$timeleft=round($lendtime-(strtotime("now")-strtotime($row3['started']))/60);
|
||||
$timeleft=round($lendtime-(strtotime('now')-strtotime($row3['started']))/60);
|
||||
if (!isset($nextfree) or $timeleft<$nextfree) {
|
||||
$nextfree=$timeleft;
|
||||
}
|
||||
@ -782,7 +782,7 @@ XML;
|
||||
$lendable = false;
|
||||
}
|
||||
if ($lendable==true) {
|
||||
$mastervoiceids[$masterid][]=$row2['id'];
|
||||
$mastervoiceids[$masterid][] = $row2['id'];
|
||||
}
|
||||
$slots=$slots+$row2['slots'];
|
||||
$vomacount++;
|
||||
@ -792,7 +792,7 @@ XML;
|
||||
$nextfree = 0;
|
||||
}
|
||||
if ($vomacount>0) {
|
||||
$masterservers[$masterid]=$serverpercent=(100/$vomacount)*$usedvoice;
|
||||
$masterservers[$masterid] = $serverpercent=(100/$vomacount)*$usedvoice;
|
||||
}
|
||||
}
|
||||
asort($masterservers);
|
||||
@ -830,7 +830,7 @@ XML;
|
||||
if ($fail==0 and $freevoice>0) {
|
||||
$timeleft=$lendtime;
|
||||
$vselect=$sql->prepare("SELECT `bitversion`,`type`,`queryport`,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,`rootid`,`addedby`,`publickey`,`ssh2ip`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password`,`serverdir`,`keyname`,`notified`,`defaultname`,`defaultwelcome`,`defaulthostbanner_url`,`defaulthostbanner_gfx_url`,`defaulthostbutton_tooltip`,`defaulthostbutton_url`,`defaulthostbutton_gfx_url`,`usedns` FROM `voice_masterserver` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$vselect->execute(array(':aeskey'=>$aeskey,':id'=>$bestmaster,':reseller_id'=>$reseller_id));
|
||||
$vselect->execute(array(':aeskey' => $aeskey,':id' => $bestmaster,':reseller_id' => $reseller_id));
|
||||
foreach ($vselect->fetchall(PDO::FETCH_ASSOC) as $vrow) {
|
||||
$addedby=$vrow['addedby'];
|
||||
$queryport=$vrow['queryport'];
|
||||
@ -887,7 +887,7 @@ XML;
|
||||
$connection->CloseConnection();
|
||||
$rcon=$reply[0]['token'];
|
||||
if (!$ui->id('xml',1,'post')) {
|
||||
$_SESSION['lend']['vs']=$tousevoiceid;
|
||||
$_SESSION['lend']['vs'] = $tousevoiceid;
|
||||
}
|
||||
$insert=$sql->prepare("INSERT INTO `lendedserver` (`serverid`,`servertype`,`rcon`,`password`,`slots`,`started`,`lendtime`,`lenderip`,`resellerid`) VALUES (?,?,?,?,?,NOW(),?,?,?)");
|
||||
$insert->execute(array($tousevoiceid,'v',$rcon,$password,$slots,$lendtime,$loguserip,$reseller_id));
|
||||
|
@ -75,11 +75,11 @@ if ($w == 'lo') {
|
||||
$referrer[0]="login.php";
|
||||
}
|
||||
if (isset($_SESSION['resellerid']) and isset($_SESSION['adminid']) and isset($_SESSION['oldid']) and isset($_SESSION['oldresellerid']) and !isset($_SESSION['userid']) and $_SESSION['resellerid'] != 0 and $referrer[0] == 'admin.php') {
|
||||
$_SESSION['adminid']=$_SESSION['oldid'];
|
||||
$_SESSION['resellerid']=$_SESSION['oldresellerid'];
|
||||
if ($_SESSION['oldresellerid'] != 0 and $_SESSION['oldid']==$_SESSION['oldresellerid']) {
|
||||
$_SESSION['adminid'] = $_SESSION['oldid'];
|
||||
$_SESSION['resellerid'] = $_SESSION['oldresellerid'];
|
||||
if ($_SESSION['oldresellerid'] != 0 and $_SESSION['oldid'] == $_SESSION['oldresellerid']) {
|
||||
$_SESSION['oldresellerid'] = 0;
|
||||
$_SESSION['oldid']=$_SESSION['oldadminid'];
|
||||
$_SESSION['oldid'] = $_SESSION['oldadminid'];
|
||||
unset($_SESSION['oldadminid']);
|
||||
}
|
||||
redirect('admin.php');
|
||||
@ -168,12 +168,12 @@ if ($w == 'lo') {
|
||||
$md5=md5($row['userid'].$row['logintime'].$row['cname'].$row['lastlogin'].mt_rand());
|
||||
foreach (explode('|', $row['security']) as $user) {
|
||||
$ex=explode(':',str_replace(array("\r","\n"),"",$user));
|
||||
if (isset($ex[1])) $ts3userlist[$ex[0]]=$ex[1];
|
||||
if (isset($ex[1])) $ts3userlist[$ex[0]] = $ex[1];
|
||||
}
|
||||
}
|
||||
$text=$sprache->nouser;
|
||||
$dbid=$ui->id('dbid',255,'post');
|
||||
if (isset($ts3userlist[$dbid]) and isset($md5) and $ts3userlist[$dbid]==$ui->id('dbid',255,'post')) {
|
||||
if (isset($ts3userlist[$dbid]) and isset($md5) and $ts3userlist[$dbid] == $ui->id('dbid',255,'post')) {
|
||||
$text=$sprache->send;
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `token`=?,`mail`=? WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($md5,$ui->ismail('mail','post'), $row['userid']));
|
||||
@ -296,7 +296,7 @@ XML;
|
||||
$postXML=urlencode(base64_encode($XML));
|
||||
}
|
||||
if (isset($activeAuth) and $activeAuth== 'Y') {
|
||||
$reply=webhostRequest($domainAuth,$ui->escaped('HTTP_HOST','server'),$fileAuth, array('authPWD'=>$pwdAuth,'userAuth'=>$userAuth,'postXML'=>$postXML),$portAuth);
|
||||
$reply=webhostRequest($domainAuth,$ui->escaped('HTTP_HOST','server'),$fileAuth, array('authPWD' => $pwdAuth,'userAuth' => $userAuth,'postXML' => $postXML),$portAuth);
|
||||
$xmlReply= @simplexml_load_string($reply);
|
||||
if ($xmlReply and isset($xmlReply->success) and $xmlReply->success==1 and $xmlReply->user==$username) {
|
||||
$externalOK = 1;
|
||||
@ -321,7 +321,7 @@ XML;
|
||||
$query->execute(array($sID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$logintime=$row['logintime'];
|
||||
$_SESSION['language']=$row['language'];
|
||||
$_SESSION['language'] = $row['language'];
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `userdata_substitutes` SET `lastlogin`=?,`logintime`=? WHERE `sID`=? LIMIT 1");
|
||||
$query->execute(array($logintime,$logdate,$sID));
|
||||
@ -330,21 +330,21 @@ XML;
|
||||
$query->execute(array($id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$logintime=$row['logintime'];
|
||||
$_SESSION['language']=$row['language'];
|
||||
$_SESSION['language'] = $row['language'];
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `lastlogin`=?,`logintime`=? WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($logintime,$logdate,$id));
|
||||
}
|
||||
$_SESSION['resellerid']=$resellerid;
|
||||
$_SESSION['resellerid'] = $resellerid;
|
||||
$query = $sql->prepare("DELETE FROM `badips` WHERE `badip`=?");
|
||||
$query->execute(array($loguserip));
|
||||
if(isanyadmin($id) or rsellerpermisions($id)) {
|
||||
$_SESSION['adminid']=$id;
|
||||
$_SESSION['adminid'] = $id;
|
||||
if(isset($_SESSION['adminid']) and is_numeric($_SESSION['adminid'])) $admin_id=$_SESSION['adminid'];
|
||||
} else if (isanyuser($id)) {
|
||||
$_SESSION['userid']=$id;
|
||||
$_SESSION['userid'] = $id;
|
||||
if(isset($_SESSION['userid']) and is_numeric($_SESSION['userid'])) $user_id=$_SESSION['userid'];
|
||||
if(isset($sID)) $_SESSION['sID']=$sID;
|
||||
if(isset($sID)) $_SESSION['sID'] = $sID;
|
||||
}
|
||||
$ref = '';
|
||||
if ($ui->url('HTTP_REFERER','server')) {
|
||||
|
395
web/reboot.php
395
web/reboot.php
@ -37,19 +37,17 @@
|
||||
|
||||
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$ip=$_SERVER['REMOTE_ADDR'];
|
||||
if (isset($_GET['timeout']) and is_numeric($_GET['timeout'])) {
|
||||
$timelimit=$_GET['timeout'];
|
||||
} else {
|
||||
$timelimit=ini_get('max_execution_time')-10;
|
||||
}
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$timelimit = (isset($_GET['timeout']) and is_numeric($_GET['timeout'])) ? $_GET['timeout'] : ini_get('max_execution_time') - 10;
|
||||
|
||||
} else {
|
||||
$timelimit=600;
|
||||
}
|
||||
|
||||
set_time_limit($timelimit);
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
echo "Reboot and Updater started\r\n";
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
include(EASYWIDIR . '/stuff/functions.php');
|
||||
@ -57,70 +55,107 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
include(EASYWIDIR . '/stuff/ssh_exec.php');
|
||||
include(EASYWIDIR . '/stuff/class_masterserver.php');
|
||||
include(EASYWIDIR . '/stuff/class_voice.php');
|
||||
if (version_compare(PHP_VERSION,'5.3.0')>=0){
|
||||
$currentTime=new DateTime(date('Y-m-d H:i:s'));
|
||||
include(EASYWIDIR . '/stuff/queries_updates.php');
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
|
||||
echo "Reboot and Updater started\r\n";
|
||||
|
||||
if (version_compare(PHP_VERSION,'5.3.0') >= 0){
|
||||
$currentTime = new DateTime(date('Y-m-d H:i:s'));
|
||||
} else {
|
||||
$currentDay=date('j');
|
||||
$currentDays=date('t');
|
||||
$currentHour=date('G');
|
||||
$currentDay = date('j');
|
||||
$currentDays = date('t');
|
||||
$currentHour = date('G');
|
||||
}
|
||||
$now=date('Y-m-d',strtotime("now"));
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
$sprache = getlanguagefile('gserver','uk',0);
|
||||
$now = date('Y-m-d', strtotime('now'));
|
||||
$sprache = getlanguagefile('gserver', 'uk', 0);
|
||||
|
||||
echo "Fetch version for Minecraft and Bukkit Server\r\n";
|
||||
|
||||
$query = $sql->prepare("SELECT t.`shorten` FROM `servertypes` t LEFT JOIN `rservermasterg` r ON t.`id`=r.`servertypeid` WHERE r.`id` IS NOT NULL AND t.`qstat`='minecraft' GROUP BY t.`shorten` ORDER BY t.`shorten`");
|
||||
$query2 = $sql->prepare("UPDATE `servertypes` SET `steamVersion`=?,`downloadPath`=? WHERE `shorten`=?");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
echo 'Retrieving Version for ' . $row['shorten'] . "\r\n";
|
||||
$reply = ($row['shorten'] == 'bukkit') ? getCraftBukkitVersion ('http://dl.bukkit.org/latest-rb/craftbukkit.jar', false) : getMinecraftVersion();
|
||||
|
||||
if (is_array($reply)) {
|
||||
echo 'Version for ' . $row['shorten'] . ' is: ' . $reply['version'] . "\r\n";
|
||||
|
||||
if (strlen($reply['version']) > 1) {
|
||||
$query2->execute(array($reply['version'], $reply['downloadPath'], $row['shorten']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "Fetch version for valves appIDs\r\n";
|
||||
|
||||
$query = $sql->prepare("SELECT t.`appID`,t.`shorten` FROM `servertypes` t LEFT JOIN `rservermasterg` r ON t.`id`=r.`servertypeid` WHERE r.`id` IS NOT NULL AND t.`appID` IS NOT NULL AND t.`steamgame`!='N' GROUP BY t.`appID` ORDER BY t.`appID`");
|
||||
$query2 = $sql->prepare("UPDATE `servertypes` SET `steamVersion`=? WHERE `appID`=?");
|
||||
$query->execute();
|
||||
$steamVersion = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
|
||||
if (!in_array($row['appID'], array(null,'', false))) {
|
||||
$lookUpAppID=workAroundForValveChaos($row['appID'], $row['shorten']);
|
||||
$json=webhostRequest('api.steampowered.com','easy-wi.com','/ISteamApps/UpToDateCheck/v0001/?appid='.$lookUpAppID.'&version=0.0.0.0&format=json');
|
||||
$decoded=@json_decode($json);
|
||||
|
||||
$lookUpAppID = workAroundForValveChaos($row['appID'], $row['shorten']);
|
||||
$json = webhostRequest('api.steampowered.com', 'easy-wi.com', '/ISteamApps/UpToDateCheck/v0001/?appid=' . $lookUpAppID . '&version=0.0.0.0&format=json');
|
||||
$decoded = @json_decode($json);
|
||||
|
||||
if ($decoded and !isset($decoded->response->error) and isset($decoded->response->required_version)) {
|
||||
$query2->execute(array($decoded->response->required_version, $row['appID']));
|
||||
echo "Version for appID ".$row['appID']." is: ".$decoded->response->required_version."\r\n";
|
||||
echo 'Version for appID ' . $row['appID'] . ' is: ' . $decoded->response->required_version . "\r\n";
|
||||
|
||||
} else if (isset($decoded->response->error)) {
|
||||
echo "Error for appID ".$row['appID']." is: ".$decoded->response->error."\r\n";
|
||||
echo 'Error for appID ' . $row['appID'] . ' is: ' . $decoded->response->error . "\r\n";
|
||||
|
||||
} else {
|
||||
echo "Error for appID ".$row['appID']." is: Could not retrieve JSON string\r\n";
|
||||
echo 'Error for appID ' . $row['appID'] . ' is: Could not retrieve JSON string' . "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$webhostdomain=webhostdomain(0);
|
||||
|
||||
$webhostdomain = webhostdomain(0);
|
||||
$query = $sql->prepare("SELECT `timezone`,`voice_autobackup`,`voice_autobackup_intervall`,`voice_maxbackup`,`down_checks`,`resellerid` FROM `settings`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$resellerstimezone=$row['timezone'];
|
||||
$resellerid=$row['resellerid'];
|
||||
$voice_autobackup=$row['voice_autobackup'];
|
||||
$voice_autobackup_intervall=$row['voice_autobackup_intervall'];
|
||||
$voice_maxbackup=$row['voice_maxbackup'];
|
||||
$down_checks=$row['down_checks'];
|
||||
$stunde=date('G',strtotime("$resellerstimezone hour"));
|
||||
$next=date('Y-m-d',strtotime("-$voice_autobackup_intervall day"));
|
||||
$resellerstimezone = $row['timezone'];
|
||||
$resellerid = $row['resellerid'];
|
||||
$voice_autobackup = $row['voice_autobackup'];
|
||||
$voice_autobackup_intervall = $row['voice_autobackup_intervall'];
|
||||
$voice_maxbackup = $row['voice_maxbackup'];
|
||||
$down_checks = $row['down_checks'];
|
||||
$stunde = date('G', strtotime($resellerstimezone . ' hour'));
|
||||
$next = date('Y-m-d', strtotime('-' . $voice_autobackup_intervall .' day'));
|
||||
|
||||
$query2 = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `active`='Y' AND `resellerid`=:reseller_id");
|
||||
$query2->execute(array(':aeskey'=>$aeskey,':reseller_id'=>$resellerid));
|
||||
$query2->execute(array(':aeskey' => $aeskey, ':reseller_id' => $resellerid));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$ts3masterid=$row2['id'];
|
||||
$ts3masterid = $row2['id'];
|
||||
|
||||
$query3 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `masterserver`=? LIMIT 1");
|
||||
$query3->execute(array($ts3masterid));
|
||||
|
||||
if ($query3->rowcount()>0) {
|
||||
unset($connect_ssh2,$ssh2,$badLogin);
|
||||
$ts3masternotified=$row2['notified'];
|
||||
$addedby=$row2['addedby'];
|
||||
$queryport=$row2['queryport'];
|
||||
$querypassword=$row2['decryptedquerypassword'];
|
||||
$resellerid=$row2['resellerid'];
|
||||
$autorestart=$row2['autorestart'];
|
||||
unset($connect_ssh2, $ssh2, $badLogin);
|
||||
$ts3masternotified = $row2['notified'];
|
||||
$addedby = $row2['addedby'];
|
||||
$queryport = $row2['queryport'];
|
||||
$querypassword = $row2['decryptedquerypassword'];
|
||||
$resellerid = $row2['resellerid'];
|
||||
$autorestart = $row2['autorestart'];
|
||||
|
||||
if ($addedby == '2') {
|
||||
$queryip=$row2['ssh2ip'];
|
||||
$queryip = $row2['ssh2ip'];
|
||||
|
||||
} else if ($addedby == '1') {
|
||||
$query3 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['rootid'],$resellerid));
|
||||
$query3->execute(array($row2['rootid'], $resellerid));
|
||||
$queryip=$query3->fetchColumn();
|
||||
}
|
||||
|
||||
$tsdnsExternalActive = false;
|
||||
|
||||
if (isid($row2['tsdnsServerID'],19)) {
|
||||
$query3 = $sql->prepare("SELECT `id` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=? LIMIT 1");
|
||||
$query3->execute(array($row2['tsdnsServerID']));
|
||||
@ -137,27 +172,28 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($queryip, $row2['decryptedssh2port'], array('hostkey'=>'ssh-rsa'));
|
||||
$ssh2= @ssh2_connect($queryip, $row2['decryptedssh2port'], array('hostkey' => 'ssh-rsa'));
|
||||
}
|
||||
|
||||
} else {
|
||||
$ssh2= @ssh2_connect($queryip, $row2['decryptedssh2port']);
|
||||
}
|
||||
|
||||
if ($ssh2) {
|
||||
$connect_ssh2=($row2['publickey'] == 'Y') ? @ssh2_auth_pubkey_file($ssh2, $row2['decryptedssh2user'],$pubkey,$key) : @ssh2_auth_password($ssh2, $row2['decryptedssh2user'], $row2['decryptedssh2password']);
|
||||
$connect_ssh2=($row2['publickey'] == 'Y') ? @ssh2_auth_pubkey_file($ssh2, $row2['decryptedssh2user'], $pubkey, $key) : @ssh2_auth_password($ssh2, $row2['decryptedssh2user'], $row2['decryptedssh2password']);
|
||||
|
||||
if ($connect_ssh2) {
|
||||
$split_config=preg_split('/\//', $row2['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
||||
$folderfilecount=count($split_config)-1;
|
||||
$i = 0;
|
||||
$folders= (substr($row2['serverdir'],0,1) == '/') ? 'cd /' : 'cd ';
|
||||
|
||||
while ($i<=$folderfilecount) {
|
||||
$folders=$folders.$split_config[$i]."/";
|
||||
$i++;
|
||||
}
|
||||
if ($folders == 'cd ') {
|
||||
$folders = '';
|
||||
} else {
|
||||
$folders=$folders.' && ';
|
||||
}
|
||||
|
||||
$folders = ($folders == 'cd ') ? '' : $folders . ' && ';
|
||||
} else {
|
||||
$badLogin = true;
|
||||
print "Error: Bad logindata\r\n";
|
||||
@ -166,77 +202,99 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$badLogin = true;
|
||||
print "Error: Can not connect via ssh2\r\n";
|
||||
}
|
||||
|
||||
if (!isset($badLogin) and isset($connect_ssh2) and $connect_ssh2) {
|
||||
|
||||
$tsdown = false;
|
||||
$tsdnsdown = false;
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport, 'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$connection->CloseConnection();
|
||||
unset($connection);
|
||||
sleep(1);
|
||||
$connection=new TS3($queryip,$queryport,'serveradmin',$querypassword);
|
||||
$connection=new TS3($queryip, $queryport, 'serveradmin', $querypassword);
|
||||
$errorcode=$connection->errorcode;
|
||||
}
|
||||
|
||||
if (strpos($errorcode,'error id=0') === false) {
|
||||
$connection->CloseConnection();
|
||||
unset($connection);
|
||||
$tsdown = true;
|
||||
; print "TS3 Query Error: ".$errorcode."\r\n";
|
||||
print "TS3 Query Error: ".$errorcode."\r\n";
|
||||
$restartreturn="TS3";
|
||||
}
|
||||
|
||||
if ($row2['usedns'] == 'Y' and $tsdnsExternalActive==false) {
|
||||
$tsdnscheck=@fsockopen ($queryip,41144,$errno,$errstr,5);
|
||||
$tsdnscheck=@fsockopen ($queryip,41144, $errno, $errstr,5);
|
||||
|
||||
if (!is_resource($tsdnscheck)) {
|
||||
sleep(1);
|
||||
$tsdnscheck=@fsockopen ($queryip,41144,$errno,$errstr,5);
|
||||
$tsdnscheck=@fsockopen ($queryip,41144, $errno, $errstr,5);
|
||||
}
|
||||
|
||||
if (!is_resource($tsdnscheck)) {
|
||||
print "TSDNS Error: ".$errno.' ('.$errstr.")\r\n";
|
||||
$tsdnsdown = true;
|
||||
|
||||
if (isset($restartreturn)) {
|
||||
$restartreturn .=" and internal TSDNS";
|
||||
} else {
|
||||
$restartreturn="internal TSDNS";
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($row2['usedns'] == 'Y' and $tsdnsExternalActive==true) {
|
||||
print "Skip TSDNS since external is used\r\n";
|
||||
}
|
||||
|
||||
if ($tsdown==true or $tsdnsdown==true) {
|
||||
$ts3masternotified++;
|
||||
|
||||
if ($ts3masternotified==$down_checks) {
|
||||
|
||||
if ($resellerid==0) {
|
||||
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `accounttype`='a' AND `resellerid`=0");
|
||||
$query3->execute();
|
||||
|
||||
} else {
|
||||
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||
$query3->execute(array($resellerid));
|
||||
}
|
||||
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
if ($row3['mail_serverdown'] == 'Y') {
|
||||
sendmail('emaildownrestart', $row3['id'],$queryip.' ('.$restartreturn.')','');
|
||||
sendmail('emaildownrestart', $row3['id'], $queryip.' ('.$restartreturn.')','');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query3 = $sql->prepare("UPDATE `voice_masterserver` SET `notified`=? WHERE `id`=? LIMIT 1");
|
||||
$query3->execute(array($ts3masternotified,$ts3masterid));
|
||||
$query3->execute(array($ts3masternotified, $ts3masterid));
|
||||
|
||||
if ($autorestart == 'Y' and $ts3masternotified>=$down_checks) {
|
||||
|
||||
if ($row2['bitversion'] == '32') {
|
||||
$tsbin='ts3server_linux_x86';
|
||||
$tsdnsbin='tsdnsserver_linux_x86';
|
||||
|
||||
} else {
|
||||
$tsbin='ts3server_linux_amd64';
|
||||
$tsdnsbin='tsdnsserver_linux_amd64';
|
||||
}
|
||||
|
||||
$ssh2cmd=$folders.'function restart1 () { if [ "`ps fx | grep '.$tsbin.' | grep -v grep`" == "" ]; then ./ts3server_startscript.sh start > /dev/null & else ./ts3server_startscript.sh restart > /dev/null & fi }; restart1& ';
|
||||
|
||||
if ($tsdown==true) {
|
||||
echo ssh2_exec($ssh2,$ssh2cmd);
|
||||
echo ssh2_exec($ssh2, $ssh2cmd);
|
||||
}
|
||||
|
||||
if ($row2['usedns'] == 'Y') {
|
||||
|
||||
if ($tsdnsdown==true) {
|
||||
$ssh2cmd2=$folders.'cd tsdns && function restart2 () { if [ "`ps fx | grep '.$tsdnsbin.' | grep -v grep`" == "" ]; then ./'.$tsdnsbin.' > /dev/null & else ./'.$tsdnsbin.' --update > /dev/null & fi }; restart2& ';
|
||||
echo ssh2_exec($ssh2,$ssh2cmd2);
|
||||
echo ssh2_exec($ssh2, $ssh2cmd2);
|
||||
}
|
||||
}
|
||||
print "Restarting: $restartreturn\r\n";
|
||||
@ -247,12 +305,12 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$query3->execute(array($ts3masterid));
|
||||
}
|
||||
$query3 = $sql->prepare("SELECT `active`,`backup`,`id`,`ip`,`port`,`slots`,`userid`,`localserverid`,`max_download_total_bandwidth`,`max_upload_total_bandwidth`,`serverCreated` FROM `voice_server` WHERE `masterserver`=? AND `resellerid`=?");
|
||||
$query3->execute(array($ts3masterid,$resellerid));
|
||||
$query3->execute(array($ts3masterid, $resellerid));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$ts3id=$row3['id'];
|
||||
$serverCreated=$row3['serverCreated'];
|
||||
$ts3userid=$row3['userid'];
|
||||
$localserverid=$row3['localserverid'];
|
||||
$ts3id = $row3['id'];
|
||||
$serverCreated = $row3['serverCreated'];
|
||||
$ts3userid = $row3['userid'];
|
||||
$localserverid = $row3['localserverid'];
|
||||
if ($stunde == '00' or $serverCreated==null) {
|
||||
$resetTraffic = false;
|
||||
if (version_compare(PHP_VERSION,'5.3.0')>=0){
|
||||
@ -271,11 +329,11 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
if ($resetTraffic==true and $serverCreated != null) {
|
||||
$query4 = $sql->prepare("UPDATE `voice_server` SET `filetraffic`=0,`lastfiletraffic`=0 WHERE `id`=? LIMIT 1");
|
||||
$query4->execute(array($ts3id));
|
||||
$connection->ImportModServer($localserverid, $row3['slots'], $row3['ip'], $row3['port'], array('virtualserver_max_download_total_bandwidth'=>$row3['max_download_total_bandwidth'],'virtualserver_max_upload_total_bandwidth'=>$row3['max_upload_total_bandwidth']));
|
||||
$connection->ImportModServer($localserverid, $row3['slots'], $row3['ip'], $row3['port'], array('virtualserver_max_download_total_bandwidth' => $row3['max_download_total_bandwidth'],'virtualserver_max_upload_total_bandwidth' => $row3['max_upload_total_bandwidth']));
|
||||
} else if ($serverCreated==null) {
|
||||
$query4 = $sql->prepare("UPDATE `voice_server` SET `filetraffic`=0,`lastfiletraffic`=0,`serverCreated`=NOW() WHERE `id`=? LIMIT 1");
|
||||
$query4->execute(array($ts3id));
|
||||
$connection->ImportModServer($localserverid, $row3['slots'], $row3['ip'], $row3['port'], array('virtualserver_max_download_total_bandwidth'=>$row3['max_download_total_bandwidth'],'virtualserver_max_upload_total_bandwidth'=>$row3['max_upload_total_bandwidth']));
|
||||
$connection->ImportModServer($localserverid, $row3['slots'], $row3['ip'], $row3['port'], array('virtualserver_max_download_total_bandwidth' => $row3['max_download_total_bandwidth'],'virtualserver_max_upload_total_bandwidth' => $row3['max_upload_total_bandwidth']));
|
||||
}
|
||||
}
|
||||
if ($voice_autobackup == 'Y' and $stunde == '5' and $row3['active'] == 'Y' and $row3['backup'] == 'Y') {
|
||||
@ -283,10 +341,10 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$backupcount = 0;
|
||||
unset($last);
|
||||
$query4 = $sql->prepare("SELECT `id`,`date`,`name` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` ASC");
|
||||
$query4->execute(array($ts3id,$ts3userid,$resellerid));
|
||||
$query4->execute(array($ts3id, $ts3userid, $resellerid));
|
||||
foreach ($query4->fetchAll(PDO::FETCH_ASSOC) as $row4) {
|
||||
$backupcount++;
|
||||
$date=$row4['date'];
|
||||
$date = $row4['date'];
|
||||
if ($row4['name'] == 'Autobackup') {
|
||||
$last=date('Y-m-d',strtotime($date));
|
||||
}
|
||||
@ -296,26 +354,26 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$toomuch=$backupcount+1-$voice_maxbackup;
|
||||
if ($toomuch>0) {
|
||||
$query4 = $sql->prepare("SELECT `id` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` ASC LIMIT $toomuch");
|
||||
$query4->execute(array($ts3id,$ts3userid,$resellerid));
|
||||
$query4->execute(array($ts3id, $ts3userid, $resellerid));
|
||||
foreach ($query4->fetchAll(PDO::FETCH_ASSOC) as $row4) {
|
||||
$query5 = $sql->prepare("DELETE FROM `voice_server_backup` WHERE `id`=? AND `uid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query5->execute(array($row4['id'],$ts3userid,$resellerid));
|
||||
$query5->execute(array($row4['id'], $ts3userid, $resellerid));
|
||||
$backupfolder='backups/virtualserver_'.$localserverid.'/';
|
||||
$delcmd='cd '.$folders.' && function backup () { nice -n +19 rm -f '.$backupfolder.$row4['id'].'.tar.bz2; }; backup& ';
|
||||
$shell=ssh2_exec($ssh2,$delcmd);
|
||||
$shell=ssh2_exec($ssh2, $delcmd);
|
||||
}
|
||||
}
|
||||
$rawsnapshot=$connection->Snapshotcreate($localserverid);
|
||||
$snapshot=gzcompress($rawsnapshot,9);
|
||||
$query4 = $sql->prepare("INSERT INTO `voice_server_backup` (`sid`,`uid`,`name`,`snapshot`,`date`,`resellerid`) VALUES(?,?,?,?,NOW(),?)");
|
||||
$query4->execute(array($ts3id,$ts3userid,$name,$snapshot,$resellerid));
|
||||
$query4->execute(array($ts3id, $ts3userid, $name, $snapshot, $resellerid));
|
||||
$query4 = $sql->prepare("SELECT `id` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `id` DESC LIMIT 1");
|
||||
$query4->execute(array($ts3id,$ts3userid,$resellerid));
|
||||
$query4->execute(array($ts3id, $ts3userid, $resellerid));
|
||||
foreach ($query4->fetchAll(PDO::FETCH_ASSOC) as $row4) {
|
||||
$filefolder='files/virtualserver_'.$localserverid.'/';
|
||||
$backupfolder='backups/virtualserver_'.$localserverid.'/';
|
||||
$createcmd='cd '.$folders.' && function backup () { mkdir -p '.$backupfolder.' && nice -n +19 tar cfj '.$backupfolder.$row4['id'].'.tar.bz2 '.$filefolder.'; }; backup& ';
|
||||
$shell=ssh2_exec($ssh2,$createcmd);
|
||||
$shell=ssh2_exec($ssh2, $createcmd);
|
||||
print "Creating backup for ts3 server: ".$row3['ip'] . ':' . $row3['port']."\r\n";
|
||||
usleep(500000);
|
||||
}
|
||||
@ -335,73 +393,73 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$query1=$sql->prepare("SELECT `id` FROM `rserverdata` WHERE `active`='Y'");
|
||||
$query1->execute();
|
||||
foreach($query1->fetchAll(PDO::FETCH_ASSOC) as $row1) {
|
||||
$rootID=$row1['id'];
|
||||
$rootID = $row1['id'];
|
||||
$cmds = array();
|
||||
$query2 = $sql->prepare("SELECT *,AES_DECRYPT(`ftppassword`,?) AS `decryptedftppass`,AES_DECRYPT(`ppassword`,?) AS `decryptedppassword` FROM `gsswitch` WHERE `rootID`=? AND `resellerid`=? AND `active`='Y' AND `lendserver`='N' ORDER BY `userid`,`serverid`");
|
||||
$query2->execute(array($aeskey,$aeskey,$rootID,$resellerid));
|
||||
$query2->execute(array($aeskey, $aeskey, $rootID, $resellerid));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
unset($restart);
|
||||
$serverip=$row2['serverip'];
|
||||
$gsport=$row2['port'];
|
||||
$gsswitchID=$row2['id'];
|
||||
$useridID=$row2['userid'];
|
||||
$newlayout=$row2['newlayout'];
|
||||
$serverip = $row2['serverip'];
|
||||
$gsport = $row2['port'];
|
||||
$gsswitchID = $row2['id'];
|
||||
$useridID = $row2['userid'];
|
||||
$newlayout = $row2['newlayout'];
|
||||
$gsfolder=$serverip . '_' . $gsport;
|
||||
$ftppass=$row2['decryptedftppass'];
|
||||
$decryptedftppass=$row2['decryptedppassword'];
|
||||
$protected_old=$row2['protected'];
|
||||
$ftppass = $row2['decryptedftppass'];
|
||||
$decryptedftppass = $row2['decryptedppassword'];
|
||||
$protected_old = $row2['protected'];
|
||||
if ($row2['serverid'] == null) {
|
||||
$query3 = $sql->prepare("SELECT `id` FROM `serverlist` WHERE `switchID`=? LIMIT 1");
|
||||
$query3->execute(array($gsswitchID));
|
||||
$runID_old=$query3->fetchColumn();
|
||||
$query3 = $sql->prepare("UPDATE `gsswitch` SET `serverid`=? WHERE `id`=? LIMIT 1");
|
||||
$query3->execute(array($runID_old,$gsswitchID));
|
||||
$query3->execute(array($runID_old, $gsswitchID));
|
||||
} else {
|
||||
$runID_old=$row2['serverid'];
|
||||
$runID_old = $row2['serverid'];
|
||||
}
|
||||
$server=$serverip . ':' . $gsport;
|
||||
$query3 = $sql->prepare("SELECT * FROM `gserver_restarts` WHERE `switchID`=? AND `restarttime`=? LIMIT 1");
|
||||
$query3->execute(array($gsswitchID,$currenttime));
|
||||
$query3->execute(array($gsswitchID, $currenttime));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$template=$row3['template'];
|
||||
$anticheat=$row3['anticheat'];
|
||||
$shorten=$row3['gsswitch'];
|
||||
$map=$row3['map'];
|
||||
$mapGroup=$row3['mapGroup'];
|
||||
$protected=$row3['protected'];
|
||||
$restart=$row3['restart'];
|
||||
$backup=$row3['backup'];
|
||||
$worldsafe=$row3['worldsafe'];
|
||||
$upload=$row3['upload'];
|
||||
$template = $row3['template'];
|
||||
$anticheat = $row3['anticheat'];
|
||||
$shorten = $row3['gsswitch'];
|
||||
$map = $row3['map'];
|
||||
$mapGroup = $row3['mapGroup'];
|
||||
$protected = $row3['protected'];
|
||||
$restart = $row3['restart'];
|
||||
$backup = $row3['backup'];
|
||||
$worldsafe = $row3['worldsafe'];
|
||||
$upload = $row3['upload'];
|
||||
}
|
||||
$query3 = $sql->prepare("SELECT `active`,`cname` FROM `userdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['userid'],$resellerid));
|
||||
$query3->execute(array($row2['userid'], $resellerid));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$user_active=$row3['active'];
|
||||
$SSH2customer=$row3['cname'];
|
||||
$user_active = $row3['active'];
|
||||
$SSH2customer = $row3['cname'];
|
||||
}
|
||||
if ($newlayout == 'Y') $SSH2customer=$SSH2customer . '-' . $gsswitchID;
|
||||
if (isset($restart) and $user_active == 'Y') {
|
||||
$query3 = $sql->prepare("SELECT s.`id`,s.`upload`,s.`map`,s.`servertemplate`,s.`mapGroup`,t.`qstat` FROM `serverlist` s LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE t.`shorten`=? AND s.`switchID`=? LIMIT 1");
|
||||
$query3->execute(array($shorten,$gsswitchID));
|
||||
$query3->execute(array($shorten, $gsswitchID));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$runID=$row3['id'];
|
||||
$qstat=$row3['qstat'];
|
||||
$runID = $row3['id'];
|
||||
$qstat = $row3['qstat'];
|
||||
$query3 = $sql->prepare("UPDATE `gsswitch` SET `serverid`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($runID,$gsswitchID,$resellerid));
|
||||
$query3->execute(array($runID, $gsswitchID, $resellerid));
|
||||
$query3 = $sql->prepare("UPDATE `serverlist` SET `anticheat`=?,`map`=?,`mapGroup`=?,`servertemplate`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($anticheat,$map,$mapGroup,$template,$runID,$resellerid));
|
||||
$query3->execute(array($anticheat, $map, $mapGroup, $template, $runID, $resellerid));
|
||||
$shortens = '';
|
||||
if ($restart == 'Y') {
|
||||
unset($newProtected);
|
||||
if ($protected== 'Y' and $protected_old== 'N') {
|
||||
$tmp=gsrestart($gsswitchID,'so',$aeskey,$resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
$tmp=gsrestart($gsswitchID,'so', $aeskey, $resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
echo "Stopping unprotected server: $server\r\n";
|
||||
$gamestring='1_'.$shorten;
|
||||
$randompass=passwordgenerate(20);
|
||||
$query3 = $sql->prepare("UPDATE `gsswitch` SET `ppassword`=AES_ENCRYPT(?,?) WHERE `id`=? LIMIT 1");
|
||||
$query3->execute(array($randompass,$aeskey,$gsswitchID));
|
||||
$query3->execute(array($randompass, $aeskey, $gsswitchID));
|
||||
$cmds[] = './control.sh mod '.$SSH2customer . ' ' . $ftppass . ' ' . $randompass;
|
||||
$SSH2customer=$SSH2customer.'-p';
|
||||
$cmds[]="sudo -u ${SSH2customer} ./control.sh reinstserver ${SSH2customer} ${gamestring} ${gsfolder} protected";
|
||||
@ -409,30 +467,30 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
$newProtected = true;
|
||||
}
|
||||
$query3 = $sql->prepare("UPDATE `gsswitch` SET `serverid`=?,`stopped`='N',`protected`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($runID,$protected,$gsswitchID,$resellerid));
|
||||
$query3->execute(array($runID, $protected, $gsswitchID, $resellerid));
|
||||
if (!isset($newProtected)) {
|
||||
echo 'Restarting server: '.$server."\r\n";
|
||||
$tmp=gsrestart($gsswitchID,'re',$aeskey,$resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
$tmp=gsrestart($gsswitchID,'re', $aeskey, $resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
}
|
||||
} else if ($restart == 'N' and $qstat == 'minecraft' and $worldsafe == 'Y') {
|
||||
$cmds[]="sudo -u ${SSH2customer} ./control.sh mc_ws $gsfolder";
|
||||
echo "Minecraft worlsafe: $server\r\n";
|
||||
} else if ($restart == 'N' and $qstat == 'a2s' and ($uploadtype == '2' or $uploadtype == '3') and $upload== 'Y') {
|
||||
$tmp=gsrestart($gsswitchID,'du',$aeskey,$resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
$tmp=gsrestart($gsswitchID,'du', $aeskey, $resellerid);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
}
|
||||
if ($backup == 'Y') {
|
||||
$query3 = $sql->prepare("SELECT AES_DECRYPT(`ftpbackup`,?) AS `backup` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||
$query3->execute(array($aeskey,$useridID));
|
||||
$query3->execute(array($aeskey, $useridID));
|
||||
$ftpbackup=$query3->fetchColumn();
|
||||
$shortens = array();
|
||||
$query3 = $sql->prepare("SELECT DISTINCT(t.`shorten`) FROM `serverlist` s LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=?");
|
||||
$query3->execute(array($gsswitchID));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$shortens[]=$row3['shorten'];
|
||||
$shortens[] = $row3['shorten'];
|
||||
}
|
||||
$cmds[]="sudo -u ${SSH2customer} ./control.sh backup ${gsfolder} \"".implode(' ',$shortens)."\" \"${webhostdomain}\" \"${ftpbackup}\"";
|
||||
$cmds[]="sudo -u ${SSH2customer} ./control.sh backup ${gsfolder} \"".implode(' ', $shortens)."\" \"${webhostdomain}\" \"${ftpbackup}\"";
|
||||
echo "Backup started for $server\r\n";
|
||||
}
|
||||
}
|
||||
@ -440,18 +498,18 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
echo "$currenttime Not the restart time for $server\r\n";
|
||||
}
|
||||
}
|
||||
if (count($cmds)>0) ssh2_execute('gs',$rootID,$cmds);
|
||||
if (count($cmds)>0) ssh2_execute('gs', $rootID, $cmds);
|
||||
}
|
||||
echo "Executing Updates if neccessary\r\n";
|
||||
$query2 = $sql->prepare("SELECT `id` FROM `rserverdata` WHERE `resellerid`=? AND `updates`!=3 AND (`updateMinute`=0 OR `updateMinute` IS NULL)");
|
||||
$query2->execute(array($resellerid));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$rootServer=new masterServer($row2['id'],$aeskey);
|
||||
$rootServer=new masterServer($row2['id'], $aeskey);
|
||||
$rootServer->collectData();
|
||||
$sshcmd=(4==$stunde) ? $rootServer->returnCmds('update','all') : $rootServer->returnCmds();
|
||||
if ($rootServer->sshcmd!==null) {
|
||||
echo "Starting updates for ".$rootServer->sship."\r\n";
|
||||
if (ssh2_execute('gs', $row2['id'],$rootServer->sshcmd)!==false) {
|
||||
if (ssh2_execute('gs', $row2['id'], $rootServer->sshcmd)!==false) {
|
||||
$rootServer->setUpdating();
|
||||
echo "Updater started for ".$rootServer->sship."\r\n";
|
||||
} else {
|
||||
@ -461,118 +519,31 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
unset($rootServer);
|
||||
}
|
||||
}
|
||||
|
||||
$newsInclude = true;
|
||||
$printToConsole = true;
|
||||
print "Check for new news feeds\r\n";
|
||||
include(EASYWIDIR . '/stuff/feeds_function.php');
|
||||
if (isset($template_file)) print $template_file."\r\n";
|
||||
$chunkSize=(isset($argv[1]) and is_numeric($argv[1])) ? $argv[1] : 500;
|
||||
print "Cleaning Up hourly data. Chunksize is ${chunkSize}\r\n";
|
||||
$query = $sql->prepare("DELETE FROM `voice_server_stats` WHERE `date` IS NULL OR `date`='0000-00-00 00:00:00'");
|
||||
$query->execute();
|
||||
$query = $sql->prepare("DELETE FROM `voice_server_stats_hours` WHERE `date` IS NULL OR `date`='0000-00-00 00:00:00'");
|
||||
$query->execute();
|
||||
$Count=$sql->prepare("SELECT COUNT(`sid`) AS `amount` FROM `voice_server_stats_hours` WHERE `date` NOT LIKE '%00:00:00'");
|
||||
$query = $sql->prepare("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
|
||||
$query2 = $sql->prepare("SELECT * FROM `voice_server_stats_hours` WHERE `date` NOT LIKE '%00:00:00' LIMIT $chunkSize");
|
||||
$query3 = $sql->prepare("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ");
|
||||
$query4 = $sql->prepare("DELETE FROM `voice_server_stats_hours` WHERE `date` NOT LIKE '%00:00:00' LIMIT $chunkSize");
|
||||
$query5 = $sql->prepare("INSERT INTO `voice_server_stats` (`sid`,`mid`,`installed`,`used`,`date`,`uid`,`resellerid`) VALUES (?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE `used`=(`used`*(`count`/(`count`+1))+(VALUES(`used`)*(1/(`count`+1)))),`installed`=(`installed`*(`count`/(`count`+1))+(VALUES(`installed`)*(1/(`count`+1)))),`count`=`count`+1");
|
||||
function compressVoiceData ($Count,$query2,$query4) {
|
||||
$Count->execute();
|
||||
$theCount=$Count->fetchColumn();
|
||||
global $query,$query3,$query5;
|
||||
$pass = 1;
|
||||
if ($theCount<1) {
|
||||
print "Found ${theCount} voice server stat entries; Entries to less to compress data\r\n";
|
||||
} else {
|
||||
print "Found ${theCount} voice server stat entries; starting to compress data\r\n";
|
||||
}
|
||||
while ($theCount>1 and $pass<11) {
|
||||
$query->execute();
|
||||
$query2->execute();
|
||||
$query3->execute();
|
||||
$currentCount=$theCount;
|
||||
$Count->execute();
|
||||
$theCount=$Count->fetchColumn();
|
||||
print "Run: ${pass}; Found ${currentCount} voice server stat entries; Entries left after Run: ${theCount}\r\n";
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$queryDayAndZeroHour=date('Y-m-d',strtotime($row['date'])).' 00:00:00';
|
||||
print "Calc: ${queryDayAndZeroHour}; Table ${row['date']}\r\n";
|
||||
$query5->execute(array($row['sid'], $row['mid'], $row['installed'], $row['used'],$queryDayAndZeroHour, $row['uid'], $row['resellerid']));
|
||||
}
|
||||
$query4->execute();
|
||||
$pass++;
|
||||
}
|
||||
if (isset($template_file)) {
|
||||
print $template_file."\r\n";
|
||||
}
|
||||
compressVoiceData($Count,$query2,$query4);
|
||||
$Count=$sql->prepare("SELECT COUNT(`sid`) AS `amount` FROM `voice_server_stats` WHERE `date` NOT LIKE '%00:00:00'");
|
||||
$query2 = $sql->prepare("SELECT * FROM `voice_server_stats` WHERE `date` NOT LIKE '%00:00:00' LIMIT $chunkSize");
|
||||
$query4 = $sql->prepare("DELETE FROM `voice_server_stats` WHERE `date` NOT LIKE '%00:00:00' LIMIT $chunkSize");
|
||||
compressVoiceData($Count,$query2,$query4);
|
||||
print "Voice server stat entries compression completed\r\n";
|
||||
$day=date('Y-m-d');
|
||||
$Count=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `traffic_data` WHERE `day` NOT LIKE ?");
|
||||
$Count->execute(array($day."%"));
|
||||
$theCount=$Count->fetchColumn();
|
||||
if ($theCount<=10) {
|
||||
print "Found ${theCount} traffic entries; Entries to less to compress data\r\n";
|
||||
} else {
|
||||
print "Found ${theCount} traffic entries; starting to compress data\r\n";
|
||||
}
|
||||
$query = $sql->prepare("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
|
||||
$query2 = $sql->prepare("SELECT * FROM `traffic_data` WHERE `day` NOT LIKE ? LIMIT $chunkSize");
|
||||
$query3 = $sql->prepare("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ");
|
||||
$query4 = $sql->prepare("DELETE FROM `traffic_data` WHERE `day` NOT LIKE ? LIMIT $chunkSize");
|
||||
$query5 = $sql->prepare("SELECT `id` FROM `traffic_data_day` WHERE `ip`=? AND `day`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query6 = $sql->prepare("UPDATE `traffic_data_day` SET `in`=`in`+?,`out`=`out`+?,`serverid`=? WHERE `id`=? LIMIT 1");
|
||||
$query7 = $sql->prepare("INSERT INTO `traffic_data_day` (`serverid`,`in`,`out`,`ip`,`day`,`userid`,`resellerid`) VALUES (?,?,?,?,?,?,?)");
|
||||
$pass = 1;
|
||||
while ($theCount>10) {
|
||||
$exists = array();
|
||||
$query->execute();
|
||||
$query2->execute(array($day."%"));
|
||||
$trafficData=$query2->fetchAll(PDO::FETCH_ASSOC);
|
||||
$query3->execute();
|
||||
$query4->execute(array($day."%"));
|
||||
$currentCount=$theCount;
|
||||
$Count->execute(array($day."%"));
|
||||
$theCount=$Count->fetchColumn();
|
||||
print "Run: $pass; Found $currentCount traffic entries; Entries left after Run: $theCount\r\n";
|
||||
$pass++;
|
||||
foreach ($trafficData as $id => $row) {
|
||||
unset($trafficData[$id],$serverID);
|
||||
list($data_day)=explode(' ', $row['day']);
|
||||
print "$data_day: ".$row['ip']." in: ".$row['in']." out: ".$row['out']."\r\n";
|
||||
if (array_search($row['ip'].','.$data_day.','.$row['userid'].','.$row['resellerid'],$exists)) {
|
||||
$serverID=array_search($row['ip'].','.$data_day.','.$row['userid'].','.$row['resellerid'],$exists);
|
||||
} else {
|
||||
$query5->execute(array($row['ip'],$data_day, $row['userid'], $row['resellerid']));
|
||||
foreach ($query5->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$serverID=$row2['id'];
|
||||
}
|
||||
}
|
||||
if (isset($serverID)) {
|
||||
$query6->execute(array($row['in'], $row['out'],$serverID,$id));
|
||||
} else {
|
||||
$query7->execute(array($row['serverid'], $row['in'], $row['out'], $row['ip'],$data_day, $row['userid'], $row['resellerid']));
|
||||
}
|
||||
}
|
||||
}
|
||||
print "Traffic entries compression completed\r\n";
|
||||
|
||||
print "Cleaning Logs\r\n";
|
||||
$query = $sql->prepare("DELETE FROM `userlog` WHERE DATEDIFF(NOW(),`logdate`)>31");
|
||||
$query->execute();
|
||||
$query = $sql->prepare("DELETE FROM `mail_log` WHERE DATEDIFF(NOW(),`date`)>31");
|
||||
$query->execute();
|
||||
|
||||
print "Reparing tables\r\n";
|
||||
$query = $sql->prepare("REPAIR TABLE `addons`,`addons_installed`,`api_external_auth`,`api_ips`,`api_settings`,`badips`,`dhcpdata`,`eac`,`easywi_version`,`gserver_restarts`,`gsstatus`,`gsswitch`,`imprints`,`jobs`,`lendedserver`,`lendsettings`,`lendstats`,`mail_log`,`mysql_external_dbs`,`mysql_external_servers`,`page_pages`,`page_pages_text`,`page_settings`,`page_terms`,`page_terms_used`,`qstatshorten`,`resellerdata`,`resellerimages`,`rserverdata`,`rservermasterg`,`serverlist`,`servertypes`,`settings`,`test`,`tickets`,`ticket_topics`,`traffic_data`,`traffic_data_day`,`traffic_settings`,`userdata`,`usergroups`,`userlog`,`userpermissions`,`virtualcontainer`,`virtualhosts`,`voice_masterserver`,`voice_server`,`voice_server_backup`,`voice_server_stats`,`voice_server_stats_hours`,`voice_stats_settings`");
|
||||
$query->execute();
|
||||
|
||||
print "Optimizing tables\r\n";
|
||||
$query = $sql->prepare("OPTIMIZE TABLE `addons`,`addons_installed`,`api_external_auth`,`api_ips`,`api_settings`,`badips`,`dhcpdata`,`eac`,`easywi_version`,`gserver_restarts`,`gsstatus`,`gsswitch`,`imprints`,`jobs`,`lendedserver`,`lendsettings`,`lendstats`,`mail_log`,`mysql_external_dbs`,`mysql_external_servers`,`page_pages`,`page_pages_text`,`page_settings`,`page_terms`,`page_terms_used`,`qstatshorten`,`resellerdata`,`resellerimages`,`rserverdata`,`rservermasterg`,`serverlist`,`servertypes`,`settings`,`test`,`tickets`,`ticket_topics`,`traffic_data`,`traffic_data_day`,`traffic_settings`,`userdata`,`usergroups`,`userlog`,`userpermissions`,`virtualcontainer`,`virtualhosts`,`voice_masterserver`,`voice_server`,`voice_server_backup`,`voice_server_stats`,`voice_server_stats_hours`,`voice_stats_settings`");
|
||||
$query->execute();
|
||||
$query = $sql->prepare("UPDATE `settings` SET `lastCronReboot`=UNIX_TIMESTAMP() WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
|
||||
} else {
|
||||
header('Location: login.php');
|
||||
die('Statuscheck can only be run via console and or a cronjob');
|
||||
|
@ -103,14 +103,14 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1])) {
|
||||
$mountpoint=$data_explode[0];
|
||||
$mountsize[$mountpoint]=$data_explode[1];
|
||||
$mountsize[$mountpoint] = $data_explode[1];
|
||||
$mountunused[$mountpoint] = 0;
|
||||
$hdd[]=$mountpoint;
|
||||
$hdd[] = $mountpoint;
|
||||
}
|
||||
}
|
||||
$i = 1;
|
||||
while ($i<=$cores) {
|
||||
$core[]=$i;
|
||||
$core[] = $i;
|
||||
$cpucore[$i] = 0;
|
||||
$i++;
|
||||
}
|
||||
@ -121,7 +121,7 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$maxcore=$cores;
|
||||
}
|
||||
while ($i<=$cores and $i<=$maxcore) {
|
||||
$add_core[]=$i;
|
||||
$add_core[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$query2->execute(array($id));
|
||||
@ -129,23 +129,23 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$mountpoint=$row2['mountpoint'];
|
||||
$addstracthdd=$mountunused[$mountpoint]+($row2['hddsize']*($percent/100));
|
||||
$mountunused[$mountpoint]=$addstracthdd;
|
||||
$mountunused[$mountpoint] = $addstracthdd;
|
||||
$addstractram=$ramused+$row2['minram'];
|
||||
$ramused=$addstractram;
|
||||
$cpuhz=$row2['cores']*$row2['minmhz'];
|
||||
$addcpu=$cpucore[1]+$cpuhz;
|
||||
if ($addcpu<=$mhz) {
|
||||
$cpucore[1]=$addcpu;
|
||||
$cpucore[1] = $addcpu;
|
||||
} else {
|
||||
$cpucore[1]=$mhz;
|
||||
$cpucore[1] = $mhz;
|
||||
$nextcore = 2;
|
||||
while ($nextcore<=$cores) {
|
||||
$extra=$addcpu-$mhz;
|
||||
$addcpu=$cpucore[$nextcore]+$extra;
|
||||
if ($addcpu<=$mhz and $addcpu>=0) {
|
||||
$cpucore[$nextcore]=$addcpu;
|
||||
$cpucore[$nextcore] = $addcpu;
|
||||
} else if ($addcpu>=0) {
|
||||
$cpucore[$nextcore]=$mhz;
|
||||
$cpucore[$nextcore] = $mhz;
|
||||
}
|
||||
$nextcore++;
|
||||
}
|
||||
@ -153,12 +153,12 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$i2++;
|
||||
}
|
||||
foreach ($hdd as $mountpoint) {
|
||||
$freespace[$mountpoint]=$mountsize[$mountpoint]-($mountunused[$mountpoint]*($percent/100));
|
||||
$freespace[$mountpoint] = $mountsize[$mountpoint]-($mountunused[$mountpoint]*($percent/100));
|
||||
}
|
||||
natsort($freespace);
|
||||
$freespace=array_reverse($freespace);
|
||||
foreach ($freespace as $mountpoint => $free) {
|
||||
$best_hdd[]=$mountpoint;
|
||||
$best_hdd[] = $mountpoint;
|
||||
}
|
||||
}
|
||||
require_once IncludeTemplate($template_to_use,'ajax_admin_vserver_allocation.tpl');
|
||||
@ -195,7 +195,7 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$userips=ipstoarray($row['ips']);
|
||||
foreach ($userips as $ip) {
|
||||
$ip_ex=explode(".", $ip);
|
||||
$ips[]=$ip_ex[0] . '.' . $ip_ex[1] . '.' . $ip_ex[2].".";
|
||||
$ips[] = $ip_ex[0] . '.' . $ip_ex[1] . '.' . $ip_ex[2].".";
|
||||
}
|
||||
}
|
||||
$subnets=array_unique($ips);
|
||||
@ -246,7 +246,7 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
}
|
||||
$ips = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
foreach (ipstoarray($row['ips']) as $userip) $userips[]=$userip;
|
||||
foreach (ipstoarray($row['ips']) as $userip) $userips[] = $userip;
|
||||
}
|
||||
$ips=array_unique($userips);
|
||||
natsort($ips);
|
||||
@ -276,12 +276,12 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$pselect->execute(array($ui->id('id',19,'get'), $ui->username('distro','50','get')));
|
||||
$usedpxeautorun = array();
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$usedpxeautorun[]=$row['pxeautorun'];
|
||||
$usedpxeautorun[] = $row['pxeautorun'];
|
||||
}
|
||||
$i = 0;
|
||||
while ($i<="9") {
|
||||
if (!in_array($i, $usedpxeautorun)){
|
||||
$pxeautorun[]=$i;
|
||||
$pxeautorun[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -353,7 +353,7 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$count=count($games);
|
||||
while ($i<$count) {
|
||||
if ($games[$i] != '' and !in_array($games[$i], $gamelist)) {
|
||||
$gamelist[]=$games[$i];
|
||||
$gamelist[] = $games[$i];
|
||||
$query = $sql->prepare("SELECT `id` FROM `servertypes` WHERE `shorten`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($games[$i], $reseller_id));
|
||||
$typeID=$query->fetchColumn();
|
||||
@ -424,26 +424,26 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$query->execute(array($ui->ip('ip','get'), $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (port($row['port'])){
|
||||
$ports[]=$row['port'];
|
||||
$ports[] = $row['port'];
|
||||
}
|
||||
if (port($row['port2'])){
|
||||
$ports[]=$row['port2'];
|
||||
$ports[] = $row['port2'];
|
||||
}
|
||||
if (port($row['port3'])){
|
||||
$ports[]=$row['port3'];
|
||||
$ports[] = $row['port3'];
|
||||
}
|
||||
if (port($row['port4'])){
|
||||
$ports[]=$row['port4'];
|
||||
$ports[] = $row['port4'];
|
||||
}
|
||||
if (port($row['port5'])){
|
||||
$ports[]=$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'];
|
||||
$ports[] = $row['port'];
|
||||
}
|
||||
}
|
||||
if (isset($ports)) {
|
||||
@ -480,7 +480,7 @@ if ($ui->smallletters('w',5,'get') == 'check') {
|
||||
$topic=$pselect3->fetchColumn();
|
||||
}
|
||||
if (empty($topic)) $topic=$row['topic'];
|
||||
$table[]=array('id'=>$row['id'],'topic'=>$topic);
|
||||
$table[]=array('id' => $row['id'],'topic' => $topic);
|
||||
}
|
||||
$ticketTemplate=($ui->id('r',1,'get')!=1) ? 'ajax_userpanel_ticket_category.tpl' : 'ajax_admin_reseller_ticket_category.tpl';
|
||||
require_once IncludeTemplate($template_to_use, $ticketTemplate);
|
||||
|
@ -102,7 +102,7 @@ if ($ui->id('id', 10, 'get')) {
|
||||
#echo "ftp://$username:$ftppass@$ip:$ftpport/$pserver".$serverip . '_' . "$port/$shorten/$binarydir/screenlog.0";
|
||||
$fp=@fopen('ftp://' . $username . ':' . $ftppass . '@' . $ip . ':' . $ftpport . '/' . $pserver . $serverip . '_' . $port . '/' . $shorten . '/' . $binarydir . '/screenlog.0','r');
|
||||
$screenlog = '';
|
||||
if ($fp == false) {
|
||||
if ($fp == false) {
|
||||
echo 'No Logdata!';
|
||||
} else {
|
||||
stream_set_timeout($fp,5);
|
||||
|
@ -47,7 +47,7 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$timelimit=600;
|
||||
}
|
||||
set_time_limit($timelimit);
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR']==$ip) {
|
||||
if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
echo "Start Syncs and Updates loading...\r\n";
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
|
@ -196,7 +196,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$query = $sql->prepare("SELECT `started`,`lendtime` FROM `lendedserver` WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($lid));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$timeleft=round($row['lendtime']-(strtotime("now")-strtotime($row['started']))/60);
|
||||
$timeleft=round($row['lendtime']-(strtotime('now')-strtotime($row['started']))/60);
|
||||
if ($timeleft>=$shutdownemptytime) {
|
||||
$query = $sql->prepare("DELETE FROM `lendedserver` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($lid, $resellerid));
|
||||
@ -322,9 +322,9 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$qstat = $query->fetchColumn();
|
||||
if ($xml2['status'] == 'DOWN' or $xml2['status'] == 'TIMEOUT') {
|
||||
if (isset($badquery)) {
|
||||
$badquery .=" -$qstat $address";
|
||||
$badquery .= ' -' . $qstat . ' ' . $address;
|
||||
} else {
|
||||
$badquery="-$qstat $address";
|
||||
$badquery = ' -' . $qstat . ' ' . $address;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -337,25 +337,27 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
ob_end_clean();
|
||||
$badxml=simplexml_load_string($badquerystring);
|
||||
foreach ($badxml as $badxml2) {
|
||||
$address = $badxml2['address'];
|
||||
$status = $badxml2['status'];
|
||||
$badstatus[$address] = array('status' => $status);
|
||||
if ($badxml2['status'] == 'UP') {
|
||||
if ($badxml2['type'] != 'A2S') {
|
||||
$gametype = $badxml2->gametype;
|
||||
}
|
||||
foreach ($badxml2->rules->rule as $rule) {
|
||||
switch((string) $rule['name']) {
|
||||
case 'gamename':
|
||||
$gametype = $rule;
|
||||
break;
|
||||
if (isset($badxml2['address']) and isip($badxml2['address'],'ipx')) {
|
||||
$address = $badxml2['address'];
|
||||
$status = $badxml2['status'];
|
||||
$badstatus[$address] = array('status' => $status);
|
||||
if ($badxml2['status'] == 'UP') {
|
||||
if ($badxml2['type'] != 'A2S') {
|
||||
$gametype = $badxml2->gametype;
|
||||
}
|
||||
foreach ($badxml2->rules->rule as $rule) {
|
||||
switch((string) $rule['name']) {
|
||||
case 'gamename':
|
||||
$gametype = $rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$name = $badxml2->name;
|
||||
$numplayers = $badxml2->numplayers;
|
||||
$maxplayers = $badxml2->maxplayers;
|
||||
$map = $badxml2->map;
|
||||
$badstatus[$address] = array('gametype' => $gametype,'name' => $name,'numplayers' => $numplayers,'maxplayers' => $maxplayers,'map' => $map,'rules' => $badxml2->rules->rule);
|
||||
}
|
||||
$name = $badxml2->name;
|
||||
$numplayers = $badxml2->numplayers;
|
||||
$maxplayers = $badxml2->maxplayers;
|
||||
$map = $badxml2->map;
|
||||
$badstatus[$address] = array('gametype' => $gametype,'name' => $name,'numplayers' => $numplayers,'maxplayers' => $maxplayers,'map' => $map,'rules' => $badxml2->rules->rule);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -392,7 +394,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$query2->execute(array($serverid));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$lid = $row2['id'];
|
||||
$elapsed=round((strtotime("now")-strtotime($row2['started']))/60);
|
||||
$elapsed=round((strtotime('now')-strtotime($row2['started']))/60);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -403,7 +405,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$passparams = explode(':', $qstatpassparam);
|
||||
}
|
||||
unset($password, $rulebreak, $maxplayers, $name);
|
||||
if (($xml2['status'] == 'DOWN' or $xml2['status'] == 'TIMEOUT') and (!isset($badstatus[$address]['status']) or $badstatus[$address]['status'] == 'DOWN' or $badstatus[$address]['status'] == 'TIMEOUT')) {
|
||||
if ((!isset($xml2['status']) or $xml2['status'] == 'DOWN' or $xml2['status'] == 'TIMEOUT') and (!isset($badstatus[$address]['status']) or $badstatus[$address]['status'] == 'DOWN' or $badstatus[$address]['status'] == 'TIMEOUT')) {
|
||||
$status='DOWN';
|
||||
$name = '';
|
||||
$numplayers = 0;
|
||||
@ -411,7 +413,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$map = '';
|
||||
$gametype = '';
|
||||
print "recheck status for $address is still: $status\r\n";
|
||||
} else if (($xml2['status'] == 'DOWN' or $xml2['status'] == 'TIMEOUT') and isset($badstatus[$address]['status']) and $badstatus[$address]['status'] == 'UP') {
|
||||
} else if ((!$xml2['status'] or $xml2['status'] == 'DOWN' or $xml2['status'] == 'TIMEOUT') and isset($badstatus[$address]['status']) and $badstatus[$address]['status'] == 'UP') {
|
||||
$status = 'UP';
|
||||
foreach ($badstatus[$address]['rules'] as $rule) {
|
||||
switch((string) $rule['name']) {
|
||||
@ -976,7 +978,7 @@ if (!isset($ip) or $_SERVER['SERVER_ADDR'] == $ip) {
|
||||
$dataloss = false;
|
||||
$lid = $erow['id'];
|
||||
$runtime = $erow['lendtime'];
|
||||
$elapsed=round((strtotime("now")-strtotime($erow['started']))/60);
|
||||
$elapsed=round((strtotime('now')-strtotime($erow['started']))/60);
|
||||
if ($elapsed>$shutdownemptytime and $usedslots == '0') {
|
||||
print "Will stop server $address before time is up, because it is empty\r\n";
|
||||
$stop = true;
|
||||
|
@ -182,7 +182,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `shorten`,`description` FROM `servertypes` WHERE `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('shorten'=>$row['shorten'],'description'=>$row['description']);
|
||||
$table[]=array('shorten' => $row['shorten'],'description' => $row['description']);
|
||||
}
|
||||
$query = $sql->prepare("SELECT `qstat`,`description` FROM `qstatshorten`");
|
||||
$query->execute();
|
||||
@ -192,7 +192,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2 = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `servertypes` WHERE `qstat`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($exist,$reseller_id));
|
||||
if ($query2->fetchColumn()>0) {
|
||||
$table2[]=array('qstat'=>$row['qstat'],'description'=>$row['description']);
|
||||
$table2[]=array('qstat' => $row['qstat'],'description' => $row['description']);
|
||||
}
|
||||
}
|
||||
$foundlanguages = array();
|
||||
@ -207,7 +207,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$displayNone='display_none';
|
||||
$checkbox='<input type="checkbox" name="language[]" value="'.$row.'" onclick="textdrop('."'".$row."'".');" /> ';
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'lang'=>$row,'checkbox'=>$checkbox,'display'=>$displayNone);
|
||||
$foundlanguages[]=array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'display' => $displayNone);
|
||||
}
|
||||
}
|
||||
$dependings = array();
|
||||
@ -287,7 +287,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `shorten`,`description` FROM `servertypes` WHERE `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('shorten'=>$row['shorten'],'description'=>$row['description']);
|
||||
$table[]=array('shorten' => $row['shorten'],'description' => $row['description']);
|
||||
}
|
||||
$query = $sql->prepare("SELECT `qstat`,`description` FROM `qstatshorten`");
|
||||
$countp=$sql->prepare("SELECT `id` FROM `servertypes` WHERE `qstat`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -297,7 +297,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$countp->execute(array($exist,$reseller_id));
|
||||
$exnum=$countp->rowCount();
|
||||
if ($exnum>=1) {
|
||||
$table2[]=array('qstat'=>$row['qstat'],'description'=>$row['description']);
|
||||
$table2[]=array('qstat' => $row['qstat'],'description' => $row['description']);
|
||||
}
|
||||
}
|
||||
$query = $sql->prepare("SELECT * FROM `addons` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -336,7 +336,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$style="style=\"display: none;\"";
|
||||
$checkbox="<input type=\"checkbox\" name=\"language[]\" value=\"$row\" onclick=\"textdrop('$row');\" /> ";
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'lang'=>$row,'checkbox'=>$checkbox,'description'=>$description,'display'=>$displayNone);
|
||||
$foundlanguages[]=array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'description' => $description,'display' => $displayNone);
|
||||
}
|
||||
}
|
||||
$dependings = array();
|
||||
@ -442,7 +442,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
$table = array();
|
||||
$pselect=$sql->prepare("SELECT `id`,`menudescription`,`shorten`,`active`,`type` FROM `addons` $where ORDER BY $orderby LIMIT $start,$amount");
|
||||
$pselect->execute(array(':reseller_id'=>$reseller_id));
|
||||
$pselect->execute(array(':reseller_id' => $reseller_id));
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$atype = '';
|
||||
$gtype = '';
|
||||
@ -469,17 +469,17 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$type=$sprache->tool;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'active'=>$row['active'],'img'=>$imgName,'alt'=>$imgAlt,'gametype'=>"${gtype} (${atype})",'description'=>$row['menudescription'],'type'=>$type);
|
||||
$table[]=array('id' => $row['id'],'active' => $row['active'],'img' => $imgName,'alt' => $imgAlt,'gametype'=>"${gtype} (${atype})",'description' => $row['menudescription'],'type' => $type);
|
||||
}
|
||||
$table2 = array();
|
||||
$pselect2=$sql->prepare("SELECT DISTINCT(`shorten`) FROM `addons` WHERE `resellerid`=:reseller_id");
|
||||
$pselect2->execute(array(':reseller_id'=>$reseller_id));
|
||||
$pselect2->execute(array(':reseller_id' => $reseller_id));
|
||||
foreach ($pselect2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$atype = '';
|
||||
$gtype = '';
|
||||
$shorten=$row2['shorten'];
|
||||
$pselect3=$sql->prepare("SELECT `description` FROM `qstatshorten` WHERE `qstat`=:shorten LIMIT 1");
|
||||
$pselect3->execute(array(':shorten'=>$shorten));
|
||||
$pselect3->execute(array(':shorten' => $shorten));
|
||||
foreach ($pselect3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$atype=$sprache->multi;
|
||||
$gtype=$row3['description'];
|
||||
@ -489,11 +489,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$gtype=$shorten;
|
||||
}
|
||||
$gametype="$gtype ($atype)";
|
||||
$table2[]=array('shorten'=>$shorten,'description'=>$gametype);
|
||||
$table2[]=array('shorten' => $shorten,'description' => $gametype);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `addons` $where");
|
||||
$countp->execute(array(':reseller_id'=>$reseller_id));
|
||||
$countp->execute(array(':reseller_id' => $reseller_id));
|
||||
foreach ($countp->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$colcount=$row['amount'];
|
||||
}
|
||||
@ -524,7 +524,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$link .='&p=0&t='.$list_type.'&g='.$list_gtype.'">1</a>';
|
||||
}
|
||||
$i = 2;
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
if ($start==$selectpage) {
|
||||
|
@ -86,21 +86,21 @@ if (isset($ui->get['q'])) {
|
||||
foreach(preg_split("/\s/",$ui->get['q'],-1,PREG_SPLIT_NO_EMPTY) as $s) {
|
||||
switch($s) {
|
||||
case(isid($s,19)):
|
||||
$ids[]=$s;
|
||||
$q[]=$s;
|
||||
if (port($s)) $ports[]=$s;
|
||||
$ids[] = $s;
|
||||
$q[] = $s;
|
||||
if (port($s)) $ports[] = $s;
|
||||
break;
|
||||
case(isip($s,'all')):
|
||||
$ips[]=$s;
|
||||
$q[]=$s;
|
||||
$ips[] = $s;
|
||||
$q[] = $s;
|
||||
break;
|
||||
case(ipport($s)):
|
||||
$addresses[]=$s;
|
||||
$q[]=$s;
|
||||
$addresses[] = $s;
|
||||
$q[] = $s;
|
||||
break;
|
||||
case(names($s,strlen($s))):
|
||||
$words[]=strtolower($s);
|
||||
$q[]=$s;
|
||||
$q[] = $s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -113,16 +113,16 @@ if (isset($ui->get['q'])) {
|
||||
$query = $sql->prepare("SELECT `menudescription` FROM `addons` WHERE `id`=? AND `resellerid`=? ".notIN($adIDs,'`id`'));
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$adIDs[]=$id;
|
||||
$results["ad-${id}"]=array('type'=>$gsprache->addon,'id'=>$id,'name'=>$row['menudescription'],'owner'=>'','edit'=>'?w=ad&d=md&id='.$id,'delete'=>'?w=ad&d=dl&id='.$id);
|
||||
$adIDs[] = $id;
|
||||
$results["ad-${id}"]=array('type' => $gsprache->addon,'id' => $id,'name' => $row['menudescription'],'owner' => '','edit' => '?w=ad&d=md&id='.$id,'delete' => '?w=ad&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($im==true) {
|
||||
$query = $sql->prepare("SELECT `description` FROM `servertypes` WHERE `id`=? AND `resellerid`=? ".notIN($imIDs,'`id`'));
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$imIDs[]=$id;
|
||||
$results["im-${id}"]=array('type'=>$gsprache->gameserver . ' ' . $gsprache->templates,'id'=>$id,'name'=>$row['description'],'owner'=>'','edit'=>'?w=im&d=md&id='.$id,'delete'=>'?w=im&d=dl&id='.$id);
|
||||
$imIDs[] = $id;
|
||||
$results["im-${id}"]=array('type' => $gsprache->gameserver . ' ' . $gsprache->templates,'id' => $id,'name' => $row['description'],'owner' => '','edit' => '?w=im&d=md&id='.$id,'delete' => '?w=im&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($us==true) {
|
||||
@ -138,24 +138,24 @@ if (isset($ui->get['q'])) {
|
||||
}
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$usIDs[]=$id;
|
||||
$results["us-${id}"]=array('type'=>$gsprache->gameserver,'id'=>$id,'name'=>theName($row['username'], $row['cname']),'owner'=>'','edit'=>'?w=us&d=md&id='.$id,'delete'=>'?w=us&d=dl&id='.$id);
|
||||
$usIDs[] = $id;
|
||||
$results["us-${id}"]=array('type' => $gsprache->gameserver,'id' => $id,'name'=>theName($row['username'], $row['cname']),'owner' => '','edit' => '?w=us&d=md&id='.$id,'delete' => '?w=us&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($gs==true) {
|
||||
$query = $sql->prepare("SELECT g.`serverip`,g.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE (g.`id`=? OR g.`externalID`=?) AND g.`resellerid`=? ".notIN($gsIDs,'g.`id`'));
|
||||
$query->execute(array($id,$id,$reseller_id));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$gsIDs[]=$id;
|
||||
$results["gs-${id}"]=array('type'=>$gsprache->gameserver,'id'=>$id,'name'=>$row['serverip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=gs&d=md&id='.$id,'delete'=>'?w=gs&d=dl&id='.$id);
|
||||
$gsIDs[] = $id;
|
||||
$results["gs-${id}"]=array('type' => $gsprache->gameserver,'id' => $id,'name' => $row['serverip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=gs&d=md&id='.$id,'delete' => '?w=gs&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($vo==true) {
|
||||
$query = $sql->prepare("SELECT v.`ip`,v.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `voice_server` v INNER JOIN `userdata` u ON v.`userid`=u.`id` WHERE (v.`id`=? OR v.`externalID`=?) AND v.`resellerid`=? ".notIN($voIDs,'v.`id`'));
|
||||
$query->execute(array($id,$id,$reseller_id));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$voIDs[]=$id;
|
||||
$results["vo-${id}"]=array('type'=>$gsprache->voiceserver,'id'=>$id,'name'=>$row['ip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=vo&d=md&id='.$id,'delete'=>'?w=vo&d=dl&id='.$id);
|
||||
$voIDs[] = $id;
|
||||
$results["vo-${id}"]=array('type' => $gsprache->voiceserver,'id' => $id,'name' => $row['ip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=vo&d=md&id='.$id,'delete' => '?w=vo&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($ro==true) {
|
||||
@ -168,8 +168,8 @@ if (isset($ui->get['q'])) {
|
||||
$query->execute(array($id,$id,$reseller_id));
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$roIDs[]=$id;
|
||||
$results["ro-${id}"]=array('type'=>$gsprache->root,'id'=>$id,'name'=>$row['ip'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=ro&d=md&id='.$id,'delete'=>'?w=ro&d=dl&id='.$id);
|
||||
$roIDs[] = $id;
|
||||
$results["ro-${id}"]=array('type' => $gsprache->root,'id' => $id,'name' => $row['ip'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=ro&d=md&id='.$id,'delete' => '?w=ro&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
if ($vs==true) {
|
||||
@ -185,8 +185,8 @@ if (isset($ui->get['q'])) {
|
||||
$query->execute(array($id,$id,$admin_id,$reseller_id));
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$vsIDs[]=$id;
|
||||
$results["vs-${id}"]=array('type'=>$gsprache->virtual,'id'=>$id,'name'=>$row['id'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=ro&d=md&id='.$id,'delete'=>'?w=ro&d=dl&id='.$id);
|
||||
$vsIDs[] = $id;
|
||||
$results["vs-${id}"]=array('type' => $gsprache->virtual,'id' => $id,'name' => $row['id'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=ro&d=md&id='.$id,'delete' => '?w=ro&d=dl&id='.$id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,16 +195,16 @@ if (isset($ui->get['q'])) {
|
||||
$query = $sql->prepare("SELECT g.`id`,g.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`resellerid`=? ".notIN($gsIDs,' g.`id`')." AND g.`serverip`=?");
|
||||
$query->execute(array($reseller_id,$ip));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$gsIDs[]=$row['id'];
|
||||
$results["gs-${row['id']}"]=array('type'=>$gsprache->gameserver,'id'=>$row['id'],'name'=>$ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=gs&d=md&id='.$row['id'],'delete'=>'?w=gs&d=dl&id='.$row['id']);
|
||||
$gsIDs[] = $row['id'];
|
||||
$results["gs-${row['id']}"]=array('type' => $gsprache->gameserver,'id' => $row['id'],'name' => $ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=gs&d=md&id='.$row['id'],'delete' => '?w=gs&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($vo==true) {
|
||||
$query = $sql->prepare("SELECT v.`id`,v.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `voice_server` v INNER JOIN `userdata` u ON v.`userid`=u.`id` WHERE v.`resellerid`=? ".notIN($voIDs,'v.`id`')." AND v.`ip`=?");
|
||||
$query->execute(array($reseller_id,$ip));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$voIDs[]=$row['id'];
|
||||
$results["vo-${row['id']}"]=array('type'=>$gsprache->voiceserver,'id'=>$row['id'],'name'=>$ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=vo&d=md&id='.$row['id'],'delete'=>'?w=vo&d=dl&id='.$row['id']);
|
||||
$voIDs[] = $row['id'];
|
||||
$results["vo-${row['id']}"]=array('type' => $gsprache->voiceserver,'id' => $row['id'],'name' => $ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=vo&d=md&id='.$row['id'],'delete' => '?w=vo&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($ro==true) {
|
||||
@ -217,8 +217,8 @@ if (isset($ui->get['q'])) {
|
||||
$query->execute(array($reseller_id,$ip));
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$roIDs[]=$row['id'];
|
||||
$results["ro-${row['id']}"]=array('type'=>$gsprache->root,'id'=>$row['id'],'name'=>$ip,'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=ro&d=md&id='.$row['id'],'delete'=>'?w=ro&d=dl&id='.$row['id']);
|
||||
$roIDs[] = $row['id'];
|
||||
$results["ro-${row['id']}"]=array('type' => $gsprache->root,'id' => $row['id'],'name' => $ip,'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=ro&d=md&id='.$row['id'],'delete' => '?w=ro&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($vs==true) {
|
||||
@ -234,26 +234,26 @@ if (isset($ui->get['q'])) {
|
||||
$query->execute(array($admin_id,$reseller_id,$ip));
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$vsIDs[]=$row['id'];
|
||||
$results["ro-${row['id']}"]=array('type'=>$gsprache->virtual,'id'=>$row['id'],'name'=>$ip,'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=ro&d=md&id='.$row['id'],'delete'=>'?w=ro&d=dl&id='.$row['id']);
|
||||
$vsIDs[] = $row['id'];
|
||||
$results["ro-${row['id']}"]=array('type' => $gsprache->virtual,'id' => $row['id'],'name' => $ip,'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=ro&d=md&id='.$row['id'],'delete' => '?w=ro&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($ports as $port) {
|
||||
if ($gs==true) {
|
||||
$query = $sql->prepare("SELECT g.`id`,g.`serverip`,g.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`resellerid`=:id ".notIN($gsIDs,'g.`id`')." AND (g.`port`=:port OR g.`port2`=:port OR g.`port3`=:port OR g.`port4`=:port OR g.`port5`=:port)");
|
||||
$query->execute(array(':id'=>$reseller_id,':port'=>$port));
|
||||
$query->execute(array(':id' => $reseller_id,':port' => $port));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$gsIDs[]=$row['id'];
|
||||
$results["gs-${row['id']}"]=array('type'=>$gsprache->gameserver,'id'=>$row['id'],'name'=>$row['serverip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=gs&d=md&id='.$row['id'],'delete'=>'?w=gs&d=dl&id='.$row['id']);
|
||||
$gsIDs[] = $row['id'];
|
||||
$results["gs-${row['id']}"]=array('type' => $gsprache->gameserver,'id' => $row['id'],'name' => $row['serverip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=gs&d=md&id='.$row['id'],'delete' => '?w=gs&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($vo==true) {
|
||||
$query = $sql->prepare("SELECT v.`id`,v.`ip`,v.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `voice_server` v INNER JOIN `userdata` u ON v.`userid`=u.`id` WHERE v.`resellerid`=? ".notIN($voIDs,'v.`id`')." AND v.`port`=?");
|
||||
$query->execute(array($reseller_id,$port));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$voIDs[]=$row['id'];
|
||||
$results["vo-${row['id']}"]=array('type'=>$gsprache->voiceserver,'id'=>$row['id'],'name'=>$row['ip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=vo&d=md&id='.$row['id'],'delete'=>'?w=vo&d=dl&id='.$row['id']);
|
||||
$voIDs[] = $row['id'];
|
||||
$results["vo-${row['id']}"]=array('type' => $gsprache->voiceserver,'id' => $row['id'],'name' => $row['ip'] . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=vo&d=md&id='.$row['id'],'delete' => '?w=vo&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,16 +263,16 @@ if (isset($ui->get['q'])) {
|
||||
$query = $sql->prepare("SELECT g.`id`,g.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `gsswitch` g INNER JOIN `userdata` u ON g.`userid`=u.`id` WHERE g.`resellerid`=? ".notIN($gsIDs,'g.`id`')." AND g.`serverip`=? AND g.`port`=?");
|
||||
$query->execute(array($reseller_id,$ip,$port));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$gsIDs[]=$row['id'];
|
||||
$results["gs-${row['id']}"]=array('type'=>$gsprache->gameserver,'id'=>$row['id'],'name'=>$ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=gs&d=md&id='.$row['id'],'delete'=>'?w=gs&d=dl&id='.$row['id']);
|
||||
$gsIDs[] = $row['id'];
|
||||
$results["gs-${row['id']}"]=array('type' => $gsprache->gameserver,'id' => $row['id'],'name' => $ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=gs&d=md&id='.$row['id'],'delete' => '?w=gs&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($vo==true) {
|
||||
$query = $sql->prepare("SELECT v.`id`,v.`port`,u.`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `voice_server` v INNER JOIN `userdata` u ON v.`userid`=u.`id` WHERE v.`resellerid`=? ".notIN($voIDs,'v.`id`')." AND v.`ip`=? AND v.`port`=?");
|
||||
$query->execute(array($reseller_id,$ip,$port));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$voIDs[]=$row['id'];
|
||||
$results["vo-${row['id']}"]=array('type'=>$gsprache->voiceserver,'id'=>$row['id'],'name'=>$ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit'=>'?w=vo&d=md&id='.$row['id'],'delete'=>'?w=vo&d=dl&id='.$row['id']);
|
||||
$voIDs[] = $row['id'];
|
||||
$results["vo-${row['id']}"]=array('type' => $gsprache->voiceserver,'id' => $row['id'],'name' => $ip . ':' . $row['port'],'owner'=>theName($row['username'], $row['cname']),'edit' => '?w=vo&d=md&id='.$row['id'],'delete' => '?w=vo&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,34 +282,34 @@ if (isset($ui->get['q'])) {
|
||||
$query = $sql->prepare("SELECT `id`,`menudescription` FROM `addons` WHERE `resellerid`=? ".notIN($adIDs,'`id`')." AND (LOWER(`menudescription`) LIKE ? OR LOWER(`shorten`) LIKE ?)");
|
||||
$query->execute(array($reseller_id,$word,$word));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$adIDs[]=$row['id'];
|
||||
$results["ad-${row['id']}"]=array('type'=>$gsprache->addon,'id'=>$row['id'],'name'=>$row['menudescription'],'owner'=>'','edit'=>'?w=ad&d=md&id='.$row['id'],'delete'=>'?w=ad&d=dl&id='.$row['id']);
|
||||
$adIDs[] = $row['id'];
|
||||
$results["ad-${row['id']}"]=array('type' => $gsprache->addon,'id' => $row['id'],'name' => $row['menudescription'],'owner' => '','edit' => '?w=ad&d=md&id='.$row['id'],'delete' => '?w=ad&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($im==true) {
|
||||
$query = $sql->prepare("SELECT `id`,`description` FROM `servertypes` WHERE `resellerid`=? ".notIN($imIDs,'`id`')." AND (LOWER(`description`) LIKE ? OR `shorten` LIKE ?)");
|
||||
$query->execute(array($reseller_id,$word,$word));
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$imIDs[]=$row['id'];
|
||||
$results["im-${row['id']}"]=array('type'=>$gsprache->gameserver . ' ' . $gsprache->templates,'id'=>$row['id'],'name'=>$row['description'],'owner'=>'','edit'=>'?w=im&d=md&id='.$row['id'],'delete'=>'?w=im&d=dl&id='.$row['id']);
|
||||
$imIDs[] = $row['id'];
|
||||
$results["im-${row['id']}"]=array('type' => $gsprache->gameserver . ' ' . $gsprache->templates,'id' => $row['id'],'name' => $row['description'],'owner' => '','edit' => '?w=im&d=md&id='.$row['id'],'delete' => '?w=im&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
if ($us==true) {
|
||||
if($reseller_id==0) {
|
||||
$notIN=(count($usIDs)>0) ? '`id` NOT IN('.implode(',',$usIDs).') AND ' : '';
|
||||
$query = $sql->prepare("SELECT `id`,`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `userdata` WHERE $notIN (`cname` LIKE :word OR vname LIKE :word OR name LIKE :word)");
|
||||
$query->execute(array(':word'=>$word));
|
||||
$query->execute(array(':word' => $word));
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT `id`,`cname`,CONCAT(`vname`,' ',`name`) AS `username` FROM `userdata` WHERE `resellerid`=? ".notIN($usIDs,'`id`')." AND (`cname` LIKE :word OR vname LIKE :word OR name LIKE :word)");
|
||||
if ($admin_id==$reseller_id) {
|
||||
$query->execute(array(':resellerID'=>$reseller_id,':word'=>$word));
|
||||
$query->execute(array(':resellerID' => $reseller_id,':word' => $word));
|
||||
} else {
|
||||
$query->execute(array(':resellerID'=>$admin_id,':word'=>$word));
|
||||
$query->execute(array(':resellerID' => $admin_id,':word' => $word));
|
||||
}
|
||||
}
|
||||
foreach($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$usIDs[]=$row['id'];
|
||||
$results["us-${row['id']}"]=array('type'=>$gsprache->user,'id'=>$row['id'],'name'=>theName($row['username'], $row['cname']),'owner'=>'','edit'=>'?w=us&d=md&id='.$row['id'],'delete'=>'?w=us&d=dl&id='.$row['id']);
|
||||
$usIDs[] = $row['id'];
|
||||
$results["us-${row['id']}"]=array('type' => $gsprache->user,'id' => $row['id'],'name'=>theName($row['username'], $row['cname']),'owner' => '','edit' => '?w=us&d=md&id='.$row['id'],'delete' => '?w=us&d=dl&id='.$row['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],19);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('user_localid'=>'id','username'=>'cname','user_externalid'=>'externalID','email'=>'mail');
|
||||
$from=array('user_localid' => 'id','username' => 'cname','user_externalid' => 'externalID','email' => 'mail');
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `".$from[$data['identify_user_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_user_by']],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -129,9 +129,9 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$port4=$row['portFour'];
|
||||
$port5=$row['portFive'];
|
||||
}
|
||||
$typeIDList[]=$row['id'];
|
||||
$shortenToID[$row['id']]=$singleShorten;
|
||||
$typeIDs[$singleShorten]=array('id'=>$row['id'],'map'=>$row['map'],'mapGroup'=>$row['mapGroup'],'tic'=>$row['tic'],'cmd'=>$row['cmd'],'gamemod'=>$row['gamemod'],'gamemod2'=>$row['gamemod2']);
|
||||
$typeIDList[] = $row['id'];
|
||||
$shortenToID[$row['id']] = $singleShorten;
|
||||
$typeIDs[$singleShorten]=array('id' => $row['id'],'map' => $row['map'],'mapGroup' => $row['mapGroup'],'tic' => $row['tic'],'cmd' => $row['cmd'],'gamemod' => $row['gamemod'],'gamemod2' => $row['gamemod2']);
|
||||
}
|
||||
if (!isset($typeIDs[$singleShorten])) {
|
||||
$success['false'][] = 'image with the shorten '.$singleShorten.' does not exists';
|
||||
@ -164,9 +164,9 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$hostID=$row['id'];
|
||||
$hostExternalID=$row['externalID'];
|
||||
$ips[]=$row['ip'];
|
||||
$ips[] = $row['ip'];
|
||||
foreach (preg_split('/\r\n/', $row['altips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
|
||||
$ips[]=$ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
}
|
||||
if (isset($ips)) {
|
||||
@ -179,7 +179,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
foreach ($typeIDList as $ID) {
|
||||
$query->execute(array($data['master_server_id'],$resellerID,$ID));
|
||||
if ($query->rowCount()==0) {
|
||||
$missing[]=$shortenToID[$ID];
|
||||
$missing[] = $shortenToID[$ID];
|
||||
}
|
||||
}
|
||||
} else if (isset($data['master_server_external_id']) and wpreg_check($data['master_server_external_id'],255)) {
|
||||
@ -188,7 +188,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
foreach ($typeIDList as $ID) {
|
||||
$query->execute(array($data['master_server_external_id'],$resellerID,$ID));
|
||||
if ($query->rowCount()==0) {
|
||||
$missing[]=$shortenToID[$ID];
|
||||
$missing[] = $shortenToID[$ID];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -278,7 +278,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
if (isset($data['installGames']) and wpreg_check($data['installGames'],1)) {
|
||||
$installGames=$data['installGames'];
|
||||
}
|
||||
$json=json_encode(array('installGames'=>$installGames));
|
||||
$json=json_encode(array('installGames' => $installGames));
|
||||
$query = $sql->prepare("INSERT INTO `gsswitch` (`active`,`taskset`,`cores`,`userid`,`pallowed`,`eacallowed`,`serverip`,`rootID`,`tvenable`,`port`,`port2`,`port3`,`port4`,`port5`,`minram`,`maxram`,`slots`,`war`,`brandname`,`autoRestart`,`ftppassword`,`resellerid`,`externalID`,`serverid`,`stopped`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,AES_ENCRYPT(?,?),?,?,1,'Y')");
|
||||
$query->execute(array($active,$taskset,$cores,$localUserLookupID,$pallowed,$eacallowed,$ip,$hostID,$tvenable,$port,$port2,$port3,$port4,$port5,$minram,$maxram,$slots,$private,$brandname,$autoRestart,$initialpassword,$aeskey,$resellerID,$externalServerID));
|
||||
$localServerID=$sql->lastInsertId();
|
||||
@ -335,7 +335,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$shorten=$data['shorten'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
$initialpassword = '';
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT r.`externalID`,g.`id`,g.`serverip`,g.`port`,g.`userid`,g.`active`,g.`slots`,g.`rootID`,g.`war` FROM `gsswitch` g LEFT JOIN `rserverdata` r ON g.`rootID`=r.`id` WHERE g.`".$from[$data['identify_server_by']]."`=? AND g.`resellerid`=? LIMIT 1");
|
||||
@ -358,82 +358,82 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$updateArray = array();
|
||||
$eventualUpdate = '';
|
||||
if (isset($data['private']) and active_check($data['private'])) {
|
||||
$updateArray[]=$data['private'];
|
||||
$updateArray[] = $data['private'];
|
||||
$eventualUpdate.=',`war`=?';
|
||||
$private=$data['private'];
|
||||
}
|
||||
if (isset($data['slots']) and isid($data['slots'],11)) {
|
||||
$updateArray[]=$data['slots'];
|
||||
$updateArray[] = $data['slots'];
|
||||
$eventualUpdate.=',`slots`=?';
|
||||
$slots=$data['slots'];
|
||||
}
|
||||
if (isset($data['taskset']) and active_check($data['taskset'])) {
|
||||
$updateArray[]=$data['taskset'];
|
||||
$updateArray[] = $data['taskset'];
|
||||
$eventualUpdate.=',`taskset`=?';
|
||||
$taskset=$data['taskset'];
|
||||
}
|
||||
if (isset($data['eacallowed']) and active_check($data['eacallowed'])) {
|
||||
$updateArray[]=$data['eacallowed'];
|
||||
$updateArray[] = $data['eacallowed'];
|
||||
$eventualUpdate.=',`eacallowed`=?';
|
||||
$eacallowed=$data['eacallowed'];
|
||||
}
|
||||
if (isset($data['brandname']) and active_check($data['brandname'])) {
|
||||
$updateArray[]=$data['brandname'];
|
||||
$updateArray[] = $data['brandname'];
|
||||
$eventualUpdate.=',`brandname`=?';
|
||||
$brandname=$data['brandname'];
|
||||
}
|
||||
if (isset($data['tvenable']) and active_check($data['tvenable'])) {
|
||||
$updateArray[]=$data['tvenable'];
|
||||
$updateArray[] = $data['tvenable'];
|
||||
$eventualUpdate.=',`tvenable`=?';
|
||||
$tvenable=$data['tvenable'];
|
||||
}
|
||||
if (isset($data['pallowed']) and active_check($data['pallowed'])) {
|
||||
$updateArray[]=$data['pallowed'];
|
||||
$updateArray[] = $data['pallowed'];
|
||||
$eventualUpdate.=',`pallowed`=?';
|
||||
$pallowed=$data['pallowed'];
|
||||
}
|
||||
if (isset($data['autoRestart']) and active_check($data['autoRestart'])) {
|
||||
$updateArray[]=$data['autoRestart'];
|
||||
$updateArray[] = $data['autoRestart'];
|
||||
$eventualUpdate.=',`autoRestart`=?';
|
||||
$autoRestart=$data['autoRestart'];
|
||||
}
|
||||
if (isset($data['minram']) and isid($data['minram'],10)) {
|
||||
$updateArray[]=$data['minram'];
|
||||
$updateArray[] = $data['minram'];
|
||||
$eventualUpdate.=',`minram`=?';
|
||||
$minram=$data['minram'];
|
||||
}
|
||||
if (isset($data['maxram']) and isid($data['maxram'],10)) {
|
||||
$updateArray[]=$data['maxram'];
|
||||
$updateArray[] = $data['maxram'];
|
||||
$eventualUpdate.=',`maxram`=?';
|
||||
$maxram=$data['maxram'];
|
||||
}
|
||||
if (isset($data['cores']) and cores($data['cores'])) {
|
||||
$updateArray[]=$data['cores'];
|
||||
$updateArray[] = $data['cores'];
|
||||
$eventualUpdate.=',`cores`=?';
|
||||
$cores=$data['cores'];
|
||||
}
|
||||
if (isset($data['port']) and port($data['port']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port'];
|
||||
$updateArray[] = $data['port'];
|
||||
$eventualUpdate.=',`port`=?';
|
||||
$port=$data['port'];
|
||||
}
|
||||
if (isset($data['port2']) and port($data['port2']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port2'];
|
||||
$updateArray[] = $data['port2'];
|
||||
$eventualUpdate.=',`port2`=?';
|
||||
$port2=$data['port2'];
|
||||
}
|
||||
if (isset($data['port3']) and port($data['port3']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port3'];
|
||||
$updateArray[] = $data['port3'];
|
||||
$eventualUpdate.=',`port3`=?';
|
||||
$port3=$data['port3'];
|
||||
}
|
||||
if (isset($data['port4']) and port($data['port4']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port4'];
|
||||
$updateArray[] = $data['port4'];
|
||||
$eventualUpdate.=',`port4`=?';
|
||||
$port4=$data['port4'];
|
||||
}
|
||||
if (isset($data['port5']) and port($data['port5']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port5'];
|
||||
$updateArray[] = $data['port5'];
|
||||
$eventualUpdate.=',`port5`=?';
|
||||
$port5=$data['port5'];
|
||||
}
|
||||
@ -442,8 +442,8 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$eventualUpdate = trim($eventualUpdate,',');
|
||||
$eventualUpdate .=',';
|
||||
}
|
||||
$updateArray[]=$localID;
|
||||
$updateArray[]=$resellerID;
|
||||
$updateArray[] = $localID;
|
||||
$updateArray[] = $resellerID;
|
||||
$query = $sql->prepare("UPDATE `gsswitch` SET $eventualUpdate`jobPending`='Y' WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute($updateArray);
|
||||
customColumns('G',$localID,'save',$data);
|
||||
@ -452,7 +452,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$update=$sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='gs' AND (`status` IS NULL OR `status`='1') AND `action`!='ad' AND `affectedID`=? and `resellerID`=?");
|
||||
$update->execute(array($localID,$resellerID));
|
||||
$insert=$sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerID`) VALUES ('A','gs',?,?,?,?,?,NULL,NOW(),'md',?,?)");
|
||||
$insert->execute(array($hostID,$resellerID,$localID,$userID,$name,json_encode(array('newActive'=>$active,'newPort'=>$port)),$resellerID));
|
||||
$insert->execute(array($hostID,$resellerID,$localID,$userID,$name,json_encode(array('newActive' => $active,'newPort' => $port)),$resellerID));
|
||||
}
|
||||
}
|
||||
if(!isset($oldSlots)) {
|
||||
@ -465,7 +465,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT r.`externalID`,g.`id`,g.`serverip`,g.`port`,g.`userid`,g.`rootID` FROM `gsswitch` g LEFT JOIN `rserverdata` r ON g.`rootID`=r.`id` WHERE g.`".$from[$data['identify_server_by']]."`=? AND g.`resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -526,7 +526,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and 1
|
||||
$externalServerID=$data['server_external_id'];
|
||||
if (isset($data['restart']) and ($data['restart'] == 're' or $data['restart'] == 'st')) {
|
||||
$gsRestart=$data['restart'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`userid`,`rootID`,`serverip`,`port` FROM `gsswitch` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -616,7 +616,7 @@ XML;
|
||||
print $reply;
|
||||
} else if ($apiType == 'json' and !isset($list)) {
|
||||
header("Content-type: application/json; charset=UTF-8");
|
||||
echo json_encode(array('action'=>$action,'private'=>$private,'active'=>$active,'identify_server_by'=>$identifyServerBy,'shorten'=>$shorten,'slots'=>$slots,'server_external_id'=>$externalServerID,'server_local_id'=>$localServerID,'identify_user_by'=>$identifyUserBy,'user_localid'=>$localUserID,'user_externalid'=>$externalUserID,'username'=>$username,'errors'=>$errors));
|
||||
echo json_encode(array('action' => $action,'private' => $private,'active' => $active,'identify_server_by' => $identifyServerBy,'shorten' => $shorten,'slots' => $slots,'server_external_id' => $externalServerID,'server_local_id' => $localServerID,'identify_user_by' => $identifyUserBy,'user_localid' => $localUserID,'user_externalid' => $externalUserID,'username' => $username,'errors' => $errors));
|
||||
} else if (!isset($list)) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die('403 Forbidden');
|
||||
|
@ -74,7 +74,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`name` FROM `usergroups` WHERE `active`='Y' AND `grouptype`='u' AND `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$groupIDS[$row['id']]=$row['name'];
|
||||
$groupIDS[$row['id']] = $row['name'];
|
||||
}
|
||||
$query = $sql->prepare("SELECT * FROM `api_import` WHERE `importID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
@ -100,7 +100,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`name` FROM `usergroups` WHERE `active`='Y' AND `grouptype`='u' AND `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$groupIDS[$row['id']]=$row['name'];
|
||||
$groupIDS[$row['id']] = $row['name'];
|
||||
}
|
||||
$template_file = 'admin_api_import_users_add.tpl';
|
||||
} else if (in_array($ui->smallletters('action',2,'post'), array('md','ad'))) {
|
||||
@ -260,7 +260,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$ssl='http://';
|
||||
}
|
||||
$table[]=array('id'=>$row['importID'],'img'=>$imgName,'alt'=>$imgAlt,'domain'=>$ssl.$row['domain']. '/' . $row['file'],'lastID'=>$row['lastID'],'lastCheck'=>$row['lastCheck'],'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['importID'],'img' => $imgName,'alt' => $imgAlt,'domain' => $ssl.$row['domain']. '/' . $row['file'],'lastID' => $row['lastID'],'lastCheck' => $row['lastCheck'],'active' => $row['active']);
|
||||
}
|
||||
$pageamount = ceil($colcount / $amount);
|
||||
$link='<a href="admin.php?w=ui&o='.$o.'&a=';
|
||||
@ -274,7 +274,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -53,7 +53,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data)) {
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('user_localid'=>'id','username'=>'cname','user_externalid'=>'externalID','email'=>'mail');
|
||||
$from=array('user_localid' => 'id','username' => 'cname','user_externalid' => 'externalID','email' => 'mail');
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `".$from[$data['identify_user_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_user_by']],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -137,7 +137,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data)) {
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`uid`,`active`,`sid`,`dbname` FROM `mysql_external_dbs` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -178,7 +178,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data)) {
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`uid`,`sid`,`dbname` FROM `mysql_external_dbs` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -241,7 +241,7 @@ XML;
|
||||
print $reply;
|
||||
} else if ($apiType == 'json') {
|
||||
header("Content-type: application/json; charset=UTF-8");
|
||||
echo json_encode(array('action'=>$action,'active'=>$active,'identify_server_by'=>$identifyServerBy,'server_external_id'=>$externalServerID,'server_local_id'=>$localServerID,'identify_user_by'=>$identifyUserBy,'user_localid'=>$localUserID,'user_externalid'=>$externalUserID,'username'=>$username,'errors'=>$errors));
|
||||
echo json_encode(array('action' => $action,'active' => $active,'identify_server_by' => $identifyServerBy,'server_external_id' => $externalServerID,'server_local_id' => $localServerID,'identify_user_by' => $identifyUserBy,'user_localid' => $localUserID,'user_externalid' => $externalUserID,'username' => $username,'errors' => $errors));
|
||||
} else {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die('403 Forbidden');
|
||||
|
@ -82,7 +82,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$delete=$sql->prepare("DELETE FROM `api_ips` WHERE `ip`=? AND `resellerID`=?");
|
||||
$delete->execute(array($row['ip'],$lookupID));
|
||||
} else {
|
||||
$ips[]=$row['ip'];
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
}
|
||||
foreach ($postIPs as $ip) {
|
||||
@ -102,7 +102,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `ip` FROM `api_ips` WHERE `resellerID`=?");
|
||||
$query->execute(array($lookupID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$ips[]=$row['ip'];
|
||||
$ips[] = $row['ip'];
|
||||
}
|
||||
$query = $sql->prepare("SELECT `active`,`user` FROM `api_settings` WHERE `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($lookupID));
|
||||
|
@ -111,12 +111,12 @@ if (array_value_exists('action','add',$data)) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
||||
if (isset($data['groupID']) and isid($data['groupID'],19)) {
|
||||
$query->execute(array($data['groupID'],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[]=$row['id'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[] = $row['id'];
|
||||
} else if (isset($data['groupID']) and (is_array($data['groupID'])) or is_object($data['groupID'])) {
|
||||
foreach ($data['groupID'] as $groupID) {
|
||||
if (isid($groupID,19)) {
|
||||
$query->execute(array($groupID,$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[]=$row['id'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[] = $row['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,13 +124,13 @@ if (array_value_exists('action','add',$data)) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `grouptype`='u' AND `active`='Y' AND `defaultgroup`='Y' AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$userGroupIDs[]=$row['id'];
|
||||
$userGroupIDs[] = $row['id'];
|
||||
}
|
||||
if (count($userGroupIDs)==0) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `grouptype`='u' AND `active`='Y' AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$userGroupIDs[]=$row['id'];
|
||||
$userGroupIDs[] = $row['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -155,7 +155,7 @@ if (array_value_exists('action','add',$data)) {
|
||||
$mail_vserver=(isset($data['mail_vserver']) and active_check($data['mail_vserver'])) ? $data['mail_vserver'] : 'Y';
|
||||
if (!isset($success['false']) and count($userGroupIDs)>0) {
|
||||
$query = $sql->prepare("INSERT INTO `userdata` (`creationTime`,`updateTime`,`accounttype`,`active`,`cname`,`vname`,`name`,`mail`,`salt`,`phone`,`handy`,`fax`,`city`,`cityn`,`street`,`streetn`,`salutation`,`birthday`,`country`,`fdlpath`,`mail_backup`,`mail_gsupdate`,`mail_securitybreach`,`mail_serverdown`,`mail_ticket`,`mail_vserver`,`externalID`,`sourceSystemID`,`resellerid`) VALUES (NOW(),NOW(),'u',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
$query->execute(array($active,$tmpName,$vname,$name,$email,$salt,$phone,$handy,$fax,$city,$cityn,$street,$streetn,$salutation,$birthday,$country,$fdlpath,$mail_backup,$mail_gsupdate,$mail_securitybreach,$mail_serverdown,$mail_ticket,$mail_vserver,$externalID,json_encode(array('A'=>$apiIP)),$resellerID));
|
||||
$query->execute(array($active,$tmpName,$vname,$name,$email,$salt,$phone,$handy,$fax,$city,$cityn,$street,$streetn,$salutation,$birthday,$country,$fdlpath,$mail_backup,$mail_gsupdate,$mail_securitybreach,$mail_serverdown,$mail_ticket,$mail_vserver,$externalID,json_encode(array('A' => $apiIP)),$resellerID));
|
||||
$insert = true;
|
||||
} else if (!isset($success['false'])) {
|
||||
$success['false'][] = 'No usergroup available';
|
||||
@ -187,7 +187,7 @@ if (array_value_exists('action','add',$data)) {
|
||||
$externalID=$data['external_id'];
|
||||
$active=active_check($data['active']);
|
||||
$localID=$data['localid'];
|
||||
$from=array('localid'=>'id','username'=>'cname','external_id'=>'externalID','email'=>'mail');
|
||||
$from=array('localid' => 'id','username' => 'cname','external_id' => 'externalID','email' => 'mail');
|
||||
if (dataExist('identify_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`cname`,`active` FROM `userdata` WHERE `".$from[$data['identify_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_by']],$resellerID));
|
||||
@ -202,11 +202,11 @@ if (array_value_exists('action','add',$data)) {
|
||||
$password=$data['password'];
|
||||
$salt=md5(mt_rand().date('Y-m-d H:i:s:u'));
|
||||
$security=createHash($name,$data['password'],$salt,$aeskey);
|
||||
$what['security']=$security;
|
||||
$what['salt']=$salt;
|
||||
$what['security'] = $security;
|
||||
$what['salt'] = $salt;
|
||||
}
|
||||
if (isset($data['email']) and ismail($data['email'])) {
|
||||
$what['mail']=$data['email'];
|
||||
$what['mail'] = $data['email'];
|
||||
$mail=$what['mail'];
|
||||
}
|
||||
if (isset($data['name']) and names($data['name'],255)) {
|
||||
@ -258,47 +258,47 @@ if (array_value_exists('action','add',$data)) {
|
||||
$country=$what['country'];
|
||||
}
|
||||
if (isset($data['mail_backup']) and active_check($data['mail_backup'])) {
|
||||
$what['mail_backup']=$data['mail_backup'];
|
||||
$what['mail_backup'] = $data['mail_backup'];
|
||||
$mail_backup=$what['mail_backup'];
|
||||
}
|
||||
if (isset($data['mail_gsupdate']) and active_check($data['mail_gsupdate'])) {
|
||||
$what['mail_gsupdate']=$data['mail_gsupdate'];
|
||||
$what['mail_gsupdate'] = $data['mail_gsupdate'];
|
||||
$mail_gsupdate=$what['mail_gsupdate'];
|
||||
}
|
||||
if (isset($data['mail_securitybreach']) and active_check($data['mail_securitybreach'])) {
|
||||
$what['mail_securitybreach']=$data['mail_securitybreach'];
|
||||
$what['mail_securitybreach'] = $data['mail_securitybreach'];
|
||||
$mail_securitybreach=$what['mail_securitybreach'];
|
||||
}
|
||||
if (isset($data['mail_serverdown']) and active_check($data['mail_serverdown'])) {
|
||||
$what['mail_serverdown']=$data['mail_serverdown'];
|
||||
$what['mail_serverdown'] = $data['mail_serverdown'];
|
||||
$mail_serverdown=$what['mail_serverdown'];
|
||||
}
|
||||
if (isset($data['mail_ticket']) and active_check($data['mail_ticket'])) {
|
||||
$what['mail_ticket']=$data['mail_ticket'];
|
||||
$what['mail_ticket'] = $data['mail_ticket'];
|
||||
$mail_ticket=$what['mail_ticket'];
|
||||
}
|
||||
if (isset($data['mail_vserver']) and active_check($data['mail_vserver'])) {
|
||||
$what['mail_vserver']=$data['mail_vserver'];
|
||||
$what['mail_vserver'] = $data['mail_vserver'];
|
||||
$mail_vserver=$what['mail_vserver'];
|
||||
}
|
||||
if (isset($data['fdlpath']) and isurl($data['fdlpath'])) {
|
||||
$what['fdlpath']=$data['fdlpath'];
|
||||
$what['fdlpath'] = $data['fdlpath'];
|
||||
$fdlpath=$what['fdlpath'];
|
||||
}
|
||||
$foundGroupIDs = array();
|
||||
$userGroupIDs = array();
|
||||
$query = $sql->prepare("SELECT `groupID` FROM `userdata_groups` WHERE `userID`=? AND `resellerID`=?");
|
||||
$query->execute(array($localID,$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $foundGroupIDs[]=$row['id'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $foundGroupIDs[] = $row['id'];
|
||||
$query = $sql->prepare("SELECT `id` FROM `usergroups` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
||||
if (isset($data['groupID']) and isid($data['groupID'],19)) {
|
||||
$query->execute(array($data['groupID'],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[]=$row['id'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[] = $row['id'];
|
||||
} else if (isset($data['groupID']) and (is_array($data['groupID'])) or is_object($data['groupID'])) {
|
||||
foreach ($data['groupID'] as $groupID) {
|
||||
if (isid($groupID,19)) {
|
||||
$query->execute(array($groupID,$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[]=$row['id'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $userGroupIDs[] = $row['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,7 +316,7 @@ if (array_value_exists('action','add',$data)) {
|
||||
$update=$sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='us' AND (`status` IS NULL OR `status`='1') AND `userID`=? and `resellerID`=?");
|
||||
$update->execute(array($localID,$resellerID));
|
||||
$insert=$sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('A','us',?,?,?,?,NULL,NOW(),'md',?)");
|
||||
$insert->execute(array($resellerID,$localID,$localID,$name,json_encode(array('newActive'=>$useractive)),$resellerID));
|
||||
$insert->execute(array($resellerID,$localID,$localID,$name,json_encode(array('newActive' => $useractive)),$resellerID));
|
||||
updateJobs($localID,$resellerID);
|
||||
}
|
||||
} else {
|
||||
@ -333,7 +333,7 @@ if (array_value_exists('action','add',$data)) {
|
||||
$externalID=$data['external_id'];
|
||||
$active=active_check($data['active']);
|
||||
$localID=$data['localid'];
|
||||
$from=array('localid'=>'id','username'=>'cname','external_id'=>'externalID','email'=>'mail');
|
||||
$from=array('localid' => 'id','username' => 'cname','external_id' => 'externalID','email' => 'mail');
|
||||
if (dataExist('identify_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `".$from[$data['identify_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_by']],$resellerID));
|
||||
@ -364,12 +364,12 @@ if (array_value_exists('action','add',$data)) {
|
||||
$externalID=$data['external_id'];
|
||||
$active=active_check($data['active']);
|
||||
$localID=$data['localid'];
|
||||
$from=array('localid'=>'id','username'=>'cname','external_id'=>'externalID','email'=>'mail','mysql'=>array());
|
||||
$from=array('localid' => 'id','username' => 'cname','external_id' => 'externalID','email' => 'mail','mysql'=>array());
|
||||
if (dataExist('identify_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`active`,`cname`,`name`,`vname`,`mail`,`phone`,`handy`,`city`,`cityn`,`street`,`streetn`,`usergroup`,`externalID`,`jobPending` FROM `userdata` WHERE `".$from[$data['identify_by']]."`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($data[$data['identify_by']],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$userArray['userdetails']=$row;
|
||||
$userArray['userdetails'] = $row;
|
||||
}
|
||||
if($query->rowCount()>0) {
|
||||
$list = true;
|
||||
@ -381,26 +381,26 @@ if (array_value_exists('action','add',$data)) {
|
||||
$query2->execute(array($row['id'],$resellerID));
|
||||
$shorten = array();
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$shorten[]=$row2['shorten'];
|
||||
$shorten[] = $row2['shorten'];
|
||||
}
|
||||
$row['shorten']=implode(',',$shorten);
|
||||
$tempArray[]=$row;
|
||||
$tempArray[] = $row;
|
||||
}
|
||||
$userArray['gserver']=$tempArray;
|
||||
$userArray['gserver'] = $tempArray;
|
||||
$tempArray = array();
|
||||
$query = $sql->prepare("SELECT * FROM `voice_server` WHERE `userid`=? AND `resellerid`=?");
|
||||
$query->execute(array($userArray['userdetails']['id'],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$tempArray[]=$row;
|
||||
$tempArray[] = $row;
|
||||
}
|
||||
$userArray['voice']=$tempArray;
|
||||
$userArray['voice'] = $tempArray;
|
||||
$tempArray = array();
|
||||
$query = $sql->prepare("SELECT `active`,`sid`,`gsid`,`dbname`,`ips`,`max_databases`,`max_queries_per_hour`,`max_updates_per_hour`,`max_connections_per_hour`,`max_userconnections_per_hour`,`externalID`,`jobPending` FROM `mysql_external_dbs` WHERE `uid`=? AND `resellerid`=?");
|
||||
$query->execute(array($userArray['userdetails']['id'],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$tempArray[]=$row;
|
||||
$tempArray[] = $row;
|
||||
}
|
||||
$userArray['mysql']=$tempArray;
|
||||
$userArray['mysql'] = $tempArray;
|
||||
if ($apiType == 'xml') {
|
||||
header("Content-type: text/xml; charset=UTF-8");
|
||||
echo array2xml($userArray,new SimpleXMLElement('<user/>'));
|
||||
@ -463,7 +463,7 @@ XML;
|
||||
print $reply;
|
||||
} else if ($apiType == 'json' and !isset($list)) {
|
||||
header("Content-type: application/json; charset=UTF-8");
|
||||
echo json_encode(array('action'=>$action,'username'=>$username,'external_id'=>$externalID,'email'=>$email,'errors'=>$errors,'password'=>$password,'active'=>$active,'localid'=>$localID));
|
||||
echo json_encode(array('action' => $action,'username' => $username,'external_id' => $externalID,'email' => $email,'errors' => $errors,'password' => $password,'active' => $active,'localid' => $localID));
|
||||
} else if (!isset($list)) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die('403 Forbidden');
|
||||
|
@ -89,7 +89,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('user_localid'=>'id','username'=>'cname','user_externalid'=>'externalID','email'=>'mail');
|
||||
$from=array('user_localid' => 'id','username' => 'cname','user_externalid' => 'externalID','email' => 'mail');
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `".$from[$data['identify_user_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_user_by']],$resellerID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -141,17 +141,17 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$defaultdns=$query2->fetchColumn();
|
||||
}
|
||||
if ($row['addedby'] == '2') {
|
||||
$ips[]=$row['ssh2ip'];
|
||||
$ips[] = $row['ssh2ip'];
|
||||
foreach (preg_split('/\r\n/', $row['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
|
||||
$ips[]=$ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
} else if ($row['addedby'] == '1') {
|
||||
$query2 = $sql->prepare("SELECT `ip`,`altips` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($row['rootid'],$resellerID));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$ips[]=$row2['ip'];
|
||||
$ips[] = $row2['ip'];
|
||||
foreach (preg_split('/\r\n/', $row2['altips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
|
||||
$ips[]=$ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -207,7 +207,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
if (isdomain($data['dns'])) {
|
||||
$dns=$data['dns'];
|
||||
} else {
|
||||
$dns=strtolower($localID.'.'.$defaultdns);
|
||||
$dns=strtolower($localID . '.' . $defaultdns);
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `voice_server` SET `dns`=? WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($dns,$localID));
|
||||
@ -250,7 +250,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT * FROM `voice_server` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -273,82 +273,82 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$updateArray = array();
|
||||
$eventualUpdate = '';
|
||||
if (isset($data['private']) and active_check($data['private'])) {
|
||||
$updateArray[]=$data['private'];
|
||||
$updateArray[] = $data['private'];
|
||||
$eventualUpdate.=',`password`=?';
|
||||
$private=$data['private'];
|
||||
}
|
||||
if (isset($data['port']) and port($data['port']) and !in_array($data['port'],$usedPorts)) {
|
||||
$updateArray[]=$data['port'];
|
||||
$updateArray[] = $data['port'];
|
||||
$eventualUpdate.=',`port`=?';
|
||||
$port=$data['port'];
|
||||
}
|
||||
if (isset($data['active']) and active_check($data['active'])) {
|
||||
$updateArray[]=$data['active'];
|
||||
$updateArray[] = $data['active'];
|
||||
$eventualUpdate.=',`active`=?';
|
||||
$active=$data['active'];
|
||||
}
|
||||
if (isset($data['slots']) and isid($data['slots'],11)) {
|
||||
$updateArray[]=$data['slots'];
|
||||
$updateArray[] = $data['slots'];
|
||||
$eventualUpdate.=',`slots`=?';
|
||||
$slots=$data['slots'];
|
||||
}
|
||||
if (isset($data['max_download_total_bandwidth']) and isid($data['max_download_total_bandwidth'],255)) {
|
||||
$updateArray[]=$data['max_download_total_bandwidth'];
|
||||
$updateArray[] = $data['max_download_total_bandwidth'];
|
||||
$eventualUpdate .=',`max_download_total_bandwidth`=?';
|
||||
$max_download_total_bandwidth=$data['max_download_total_bandwidth'];
|
||||
}
|
||||
if (isset($data['max_upload_total_bandwidth']) and isid($data['max_upload_total_bandwidth'],255)) {
|
||||
$updateArray[]=$data['max_upload_total_bandwidth'];
|
||||
$updateArray[] = $data['max_upload_total_bandwidth'];
|
||||
$eventualUpdate .=',`max_upload_total_bandwidth`=?';
|
||||
$max_upload_total_bandwidth=$data['max_upload_total_bandwidth'];
|
||||
}
|
||||
if (isset($data['maxtraffic']) and ($data['maxtraffic']==0 or $data['maxtraffic'] == '-1' or isid($data['maxtraffic'],255))) {
|
||||
$updateArray[]=$data['maxtraffic'];
|
||||
$updateArray[] = $data['maxtraffic'];
|
||||
$eventualUpdate .=',`maxtraffic`=?';
|
||||
$maxtraffic=$data['maxtraffic'];
|
||||
}
|
||||
if(isset($data['forcebanner']) and active_check($data['forcebanner'])) {
|
||||
$updateArray[]=$data['forcebanner'];
|
||||
$updateArray[] = $data['forcebanner'];
|
||||
$eventualUpdate .=',`forcebanner`=?';
|
||||
$forcebanner=$data['forcebanner'];
|
||||
}
|
||||
if(isset($data['forcebutton']) and active_check($data['forcebutton'])) {
|
||||
$updateArray[]=$data['forcebutton'];
|
||||
$updateArray[] = $data['forcebutton'];
|
||||
$eventualUpdate .=',`forcebutton`=?';
|
||||
$forcebutton=$data['forcebutton'];
|
||||
}
|
||||
if(isset($data['forceservertag']) and active_check($data['forceservertag'])) {
|
||||
$updateArray[]=$data['forceservertag'];
|
||||
$updateArray[] = $data['forceservertag'];
|
||||
$eventualUpdate .=',`forceservertag`=?';
|
||||
$forceservertag=$data['forceservertag'];
|
||||
}
|
||||
if(isset($data['forcewelcome']) and active_check($data['forcewelcome'])) {
|
||||
$updateArray[]=$data['forcewelcome'];
|
||||
$updateArray[] = $data['forcewelcome'];
|
||||
$eventualUpdate .=',`forcewelcome`=?';
|
||||
$forcewelcome=$data['forcewelcome'];
|
||||
}
|
||||
if(isset($data['lendserver']) and active_check($data['lendserver'])) {
|
||||
$updateArray[]=$data['lendserver'];
|
||||
$updateArray[] = $data['lendserver'];
|
||||
$eventualUpdate .=',`lendserver`=?';
|
||||
$lendserver=$data['lendserver'];
|
||||
}
|
||||
if(isset($data['backup']) and active_check($data['backup'])) {
|
||||
$updateArray[]=$data['backup'];
|
||||
$updateArray[] = $data['backup'];
|
||||
$eventualUpdate .=',`backup`=?';
|
||||
$backup=$data['backup'];
|
||||
}
|
||||
if(isset($data['flexSlots']) and active_check($data['flexSlots'])) {
|
||||
$updateArray[]=$data['flexSlots'];
|
||||
$updateArray[] = $data['flexSlots'];
|
||||
$eventualUpdate .=',`flexSlots`=?';
|
||||
$flexSlots=$data['flexSlots'];
|
||||
}
|
||||
if(isset($data['flexSlotsFree']) and isid($data['flexSlotsFree'],11)) {
|
||||
$updateArray[]=$data['flexSlotsFree'];
|
||||
$updateArray[] = $data['flexSlotsFree'];
|
||||
$eventualUpdate .=',`flexSlotsFree`=?';
|
||||
$flexSlotsFree=$data['flexSlotsFree'];
|
||||
}
|
||||
if(isset($data['flexSlotsPercent']) and isid($data['flexSlotsPercent'],3)) {
|
||||
$updateArray[]=$data['flexSlotsPercent'];
|
||||
$updateArray[] = $data['flexSlotsPercent'];
|
||||
$eventualUpdate .=',`flexSlotsPercent`=?';
|
||||
$flexSlotsPercent=$data['flexSlotsPercent'];
|
||||
}
|
||||
@ -356,12 +356,12 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$tsdns=$data['tsdns'];
|
||||
}
|
||||
if(isset($data['dns']) and $tsdns == 'Y' and isdomain($data['dns'])) {
|
||||
$updateArray[]=$data['dns'];
|
||||
$updateArray[] = $data['dns'];
|
||||
$eventualUpdate .=',`dns`=?';
|
||||
$dns=$data['dns'];
|
||||
}
|
||||
if(isset($data['autoRestart']) and active_check($data['autoRestart'])) {
|
||||
$updateArray[]=$data['autoRestart'];
|
||||
$updateArray[] = $data['autoRestart'];
|
||||
$eventualUpdate .=',`autoRestart`=?';
|
||||
$flexSlots=$data['autoRestart'];
|
||||
}
|
||||
@ -369,8 +369,8 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$eventualUpdate = trim($eventualUpdate,',');
|
||||
$eventualUpdate .=',';
|
||||
}
|
||||
$updateArray[]=$localID;
|
||||
$updateArray[]=$resellerID;
|
||||
$updateArray[] = $localID;
|
||||
$updateArray[] = $resellerID;
|
||||
$query = $sql->prepare("UPDATE `voice_server` SET $eventualUpdate `jobPending`='Y' WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute($updateArray);
|
||||
if (!in_array($active,$bad) and !in_array($slots,$bad) and ($active != $oldActive or $slots != $oldSlots)) {
|
||||
@ -390,7 +390,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$query = $sql->prepare("SELECT `id`,`ip`,`port`,`userid`,`masterserver` AS `hostID` FROM `voice_server` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=?");
|
||||
$query->execute(array($data[$data['identify_server_by']],$resellerID));
|
||||
@ -417,7 +417,7 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
|
||||
$identifyServerBy=$data['identify_server_by'];
|
||||
$localServerID=isid($data['server_local_id'],21);
|
||||
$externalServerID=$data['server_external_id'];
|
||||
$from=array('server_local_id'=>'id','server_external_id'=>'externalID');
|
||||
$from=array('server_local_id' => 'id','server_external_id' => 'externalID');
|
||||
if (dataExist('identify_server_by',$data)) {
|
||||
$list = true;
|
||||
$query = $sql->prepare("SELECT * FROM `voice_server` WHERE `".$from[$data['identify_server_by']]."`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -534,7 +534,7 @@ XML;
|
||||
print $reply;
|
||||
} else if ($apiType == 'json' and !isset($list)) {
|
||||
header("Content-type: application/json; charset=UTF-8");
|
||||
echo json_encode(array('action'=>$action,'private'=>$private,'active'=>$active,'identify_server_by'=>$identifyServerBy,'shorten'=>$shorten,'slots'=>$slots,'server_external_id'=>$externalServerID,'server_local_id'=>$localServerID,'identify_user_by'=>$identifyUserBy,'user_localid'=>$localUserID,'user_externalid'=>$externalUserID,'username'=>$username,'errors'=>$errors));
|
||||
echo json_encode(array('action' => $action,'private' => $private,'active' => $active,'identify_server_by' => $identifyServerBy,'shorten' => $shorten,'slots' => $slots,'server_external_id' => $externalServerID,'server_local_id' => $localServerID,'identify_user_by' => $identifyUserBy,'user_localid' => $localUserID,'user_externalid' => $externalUserID,'username' => $username,'errors' => $errors));
|
||||
} else if (!isset($list)) {
|
||||
header('HTTP/1.1 403 Forbidden');
|
||||
die('403 Forbidden');
|
||||
|
@ -40,16 +40,19 @@
|
||||
class masterServer {
|
||||
|
||||
// General Data
|
||||
private $imageserver,$resellerID,$webhost,$rootOK;
|
||||
private $imageserver, $resellerID, $webhost, $rootOK;
|
||||
|
||||
// root data
|
||||
private $rootID,$steamAccount,$steamPassword;
|
||||
public $sship,$sshport,$sshuser,$sshpass,$publickey,$keyname;
|
||||
private $rootID, $steamAccount, $steamPassword;
|
||||
public $sship, $sshport, $sshuser, $sshpass, $publickey, $keyname;
|
||||
|
||||
// master gamedata
|
||||
private $updateIDs=array(),$syncList=array(),$steamCmdTotal=array('sync'=>array(),'nosync'=>array()),$steamCmdOutdated=array('sync'=>array(),'nosync'=>array()),$hldsTotal=array('sync'=>array(),'nosync'=>array()),$hldsOutdated=array('sync'=>array(),'nosync'=>array()),$noSteam=array('sync'=>array(),'nosync'=>array()),$maps=array(),$addons=array(),$aeskey;
|
||||
private $updateIDs = array(), $syncList = array(), $steamCmdTotal = array('sync' => array(), 'nosync' => array()), $steamCmdOutdated = array('sync' => array(),'nosync' => array()), $hldsTotal = array('sync' => array(),'nosync' => array()), $hldsOutdated = array('sync' => array(),'nosync' => array()), $mcTotal = array('sync' => array(),'nosync' => array()), $mcOutdated = array('sync' => array(),'nosync' => array()), $noSteam = array('sync' => array(),'nosync' => array()), $maps = array(), $addons = array(), $aeskey;
|
||||
|
||||
//ssh command
|
||||
public $sshcmd;
|
||||
|
||||
function __construct($rootID,$aeskey) {
|
||||
function __construct($rootID, $aeskey) {
|
||||
|
||||
// fetch global PDO object
|
||||
global $sql;
|
||||
@ -60,7 +63,7 @@ class masterServer {
|
||||
$query = $sql->prepare("SELECT `paneldomain` FROM `settings` WHERE `resellerid`='0' LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$this->webhost=$row['paneldomain'];
|
||||
$this->webhost = $row['paneldomain'];
|
||||
}
|
||||
|
||||
// store the rootserverID
|
||||
@ -68,69 +71,71 @@ class masterServer {
|
||||
|
||||
// fetch rootserverdata
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass`,AES_DECRYPT(`steamAccount`,:aeskey) AS `steamAcc`,AES_DECRYPT(`steamPassword`,:aeskey) AS `steamPwd` FROM `rserverdata` WHERE `id`=:id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$rootID));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $rootID));
|
||||
foreach ($query->fetchAll() as $row) {
|
||||
$active=$row['active'];
|
||||
$this->sship=$row['ip'];
|
||||
$this->sshport=$row['dport'];
|
||||
$this->sshuser=$row['duser'];
|
||||
$this->sshpass=$row['dpass'];
|
||||
$this->publickey=$row['publickey'];
|
||||
$this->keyname=$row['keyname'];
|
||||
$this->steamAccount=$row['steamAcc'];
|
||||
$this->steamPassword=$row['steamPwd'];
|
||||
$this->resellerID=$row['resellerid'];
|
||||
$active = $row['active'];
|
||||
$this->sship = $row['ip'];
|
||||
$this->sshport = $row['dport'];
|
||||
$this->sshuser = $row['duser'];
|
||||
$this->sshpass = $row['dpass'];
|
||||
$this->publickey = $row['publickey'];
|
||||
$this->keyname = $row['keyname'];
|
||||
$this->steamAccount = $row['steamAcc'];
|
||||
$this->steamPassword = $row['steamPwd'];
|
||||
$this->resellerID = $row['resellerid'];
|
||||
|
||||
// Get the imageserver if possible and use Easy-WI server as fallback
|
||||
$mainip=explode('.',$this->sship);
|
||||
$mainsubnet=$mainip[0].'.'.$mainip[1].'.'.$mainip[2];
|
||||
$mainip=explode('.', $this->sship);
|
||||
$mainsubnet=$mainip[0] . '.' . $mainip[1] . '.' . $mainip[2];
|
||||
$query = $sql->prepare("SELECT AES_DECRYPT(`imageserver`,?) AS `decryptedimageserver` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($aeskey,$this->resellerID));
|
||||
$splitImageservers=preg_split('/\r\n/',$query->fetchColumn(),-1,PREG_SPLIT_NO_EMPTY);
|
||||
$query->execute(array($aeskey, $this->resellerID));
|
||||
$splitImageservers=preg_split('/\r\n/', $query->fetchColumn(), -1, PREG_SPLIT_NO_EMPTY);
|
||||
$imageservers = array();
|
||||
foreach ($splitImageservers as $server) {
|
||||
$split2 = array();
|
||||
|
||||
if (isurl($server)) {
|
||||
$imageservers[]=$server;
|
||||
$split1=preg_split('/\//',$server,-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($split1[1])) {
|
||||
$split2=preg_split('/\@/',$split1[1],-1,PREG_SPLIT_NO_EMPTY);
|
||||
} else {
|
||||
$split2=preg_split('/\@/',$split1[0],-1,PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
$imageservers[] = $server;
|
||||
$split1 = preg_split('/\//', $server, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$split2 = (isset($split1[1])) ? preg_split('/\@/', $split1[1], -1, PREG_SPLIT_NO_EMPTY) : preg_split('/\@/', $split1[0], -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
} else if (isRsync($server)) {
|
||||
$imageservers[]=$server;
|
||||
$split1=preg_split('/\//',$server,-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($split1[1])) {
|
||||
$split2=preg_split('/\:/',$split1[1],-1,PREG_SPLIT_NO_EMPTY);
|
||||
} else {
|
||||
$split2=preg_split('/\:/',$split1[0],-1,PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
$imageservers[] = $server;
|
||||
$split1 = preg_split('/\//', $server, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$split2 = (isset($split1[1])) ? preg_split('/\:/', $split1[1], -1, PREG_SPLIT_NO_EMPTY) : preg_split('/\:/', $split1[0], -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
foreach ($split2 as $splitip) {
|
||||
if ($splitip==$this->sship) {
|
||||
|
||||
if ($splitip == $this->sship) {
|
||||
$noSync = true;
|
||||
|
||||
} else if (isip($splitip,'all')) {
|
||||
$ipparts=explode('.',$splitip);
|
||||
$subnet=$ipparts[0].'.'.$ipparts[1].'.'.$ipparts[2];
|
||||
if ($mainsubnet==$subnet) {
|
||||
$ipparts=explode('.', $splitip);
|
||||
$subnet=$ipparts[0] . '.' . $ipparts[1] . '.' . $ipparts[2];
|
||||
|
||||
if ($mainsubnet == $subnet) {
|
||||
$imageserver=$server;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($imageserver) and count($imageservers)>0) {
|
||||
$imageserver_count=count($imageservers)-1;
|
||||
$arrayentry=rand(0,$imageserver_count);
|
||||
$imageserver=$imageservers[$arrayentry];
|
||||
|
||||
if (!isset($imageserver) and count($imageservers) > 0) {
|
||||
$imageserver_count = count($imageservers) - 1;
|
||||
$arrayentry = rand(0, $imageserver_count);
|
||||
$imageserver = $imageservers[$arrayentry];
|
||||
}
|
||||
|
||||
if (!isset($imageserver)) {
|
||||
$imageserver='easywi';
|
||||
$imageserver = 'easywi';
|
||||
}
|
||||
if (isset($noSync) or $row['updates']==2) {
|
||||
$imageserver='none';
|
||||
|
||||
if (isset($noSync) or $row['updates'] == 2) {
|
||||
$imageserver = 'none';
|
||||
}
|
||||
$this->imageserver=$imageserver;
|
||||
|
||||
$this->imageserver = $imageserver;
|
||||
}
|
||||
|
||||
// In case the rootserver could be found and it is active return true
|
||||
@ -142,7 +147,8 @@ class masterServer {
|
||||
}
|
||||
|
||||
// collect data regarding installed games
|
||||
public function collectData ($all=true,$force=false) {
|
||||
public function collectData ($all = true, $force = false) {
|
||||
|
||||
if ($this->rootOK != true) {
|
||||
return null;
|
||||
}
|
||||
@ -150,7 +156,7 @@ class masterServer {
|
||||
// fetch global PDO object
|
||||
global $sql;
|
||||
|
||||
if ($force==true) {
|
||||
if ($force == true) {
|
||||
$extraSQL = '';
|
||||
} else {
|
||||
$extraSQL = 'AND t.`updates`!=3 AND s.`updates`!=3';
|
||||
@ -158,246 +164,356 @@ class masterServer {
|
||||
|
||||
// if an ID is given collect only data for this ID, else collect all game data for this rootserver
|
||||
if ($all === true) {
|
||||
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,r.`localVersion`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? ${extraSQL}");
|
||||
|
||||
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? ${extraSQL}");
|
||||
$query->execute(array($this->rootID));
|
||||
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,r.`localVersion`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? AND r.`servertypeid`=? ${extraSQL} LIMIT 1");
|
||||
$query->execute(array($this->rootID,$all));
|
||||
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat`,t.`steamgame`,t.`appID`,t.`steamVersion`,t.`updates`,t.`downloadPath`,t.`gamebinary`,r.`localVersion`,s.`updates` AS `supdates` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` INNER JOIN `rserverdata` s ON r.`serverid`=s.`id` WHERE r.`serverid`=? AND r.`servertypeid`=? ${extraSQL} LIMIT 1");
|
||||
$query->execute(array($this->rootID, $all));
|
||||
}
|
||||
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
// 3 = no Update; 1 = Vendor + Sync; 2 = Vendor; 4 = Sync
|
||||
|
||||
// Defined as Sync Only
|
||||
if (($row['supdates']==4 and $row['updates']==1) or (($row['supdates']==1 or $row['supdates']==4) and $row['updates']==4)) {
|
||||
$this->syncList[]=$row['shorten'];
|
||||
if (($row['supdates'] == 4 and $row['updates'] == 1) or (($row['supdates'] == 1 or $row['supdates'] == 4) and $row['updates'] == 4)) {
|
||||
$this->syncList[] = $row['shorten'];
|
||||
|
||||
// Games defined to sync with 2 or 1
|
||||
} else if (($row['supdates']==1 or $row['supdates']==2) and ($row['updates']==1 or $row['updates']==2)) {
|
||||
} else if (($row['supdates'] == 1 or $row['supdates'] == 2) and ($row['updates'] == 1 or $row['updates'] == 2)) {
|
||||
|
||||
// as rootserver and templates settings can be different, go with the least root settings
|
||||
$updateType = 0;
|
||||
if ($row['supdates']==1 and $row['updates']==1) {
|
||||
|
||||
if ($row['supdates'] == 1 and $row['updates'] == 1) {
|
||||
$updateType = 1;
|
||||
} else if ($row['supdates']==1 and $row['updates']==2) {
|
||||
|
||||
} else if ($row['supdates'] == 1 and $row['updates'] == 2) {
|
||||
$updateType = 2;
|
||||
} else if ($row['supdates']==2) {
|
||||
|
||||
} else if ($row['supdates'] == 2) {
|
||||
$updateType = 2;
|
||||
}
|
||||
|
||||
// steamCmd installations
|
||||
if ($row['steamgame'] == 'S') {
|
||||
$lookUpAppID=($row['appID']==90) ? $row['appID'] . '-' . $row['shorten'] : $row['appID'];
|
||||
if ($row['localVersion'] == null or ($row['localVersion'] != null and $row['localVersion']<$row['steamVersion'])) {
|
||||
if ($updateType==1) {
|
||||
$this->steamCmdOutdated['sync'][$lookUpAppID]=$row['shorten'];
|
||||
} else if ($updateType==2) {
|
||||
$this->steamCmdOutdated['nosync'][$lookUpAppID]=$row['shorten'];
|
||||
|
||||
$lookUpAppID=($row['appID'] == 90) ? $row['appID'] . '-' . $row['shorten'] : $row['appID'];
|
||||
|
||||
if ($row['localVersion'] == null or ($row['localVersion'] != null and $row['localVersion'] < $row['steamVersion'])) {
|
||||
if ($updateType == 1) {
|
||||
$this->steamCmdOutdated['sync'][$lookUpAppID] = $row['shorten'];
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->steamCmdOutdated['nosync'][$lookUpAppID] = $row['shorten'];
|
||||
}
|
||||
} else if ($updateType==1) {
|
||||
$this->syncList[]=$row['shorten'];
|
||||
|
||||
} else if ($updateType == 1) {
|
||||
$this->syncList[] = $row['shorten'];
|
||||
}
|
||||
if ($updateType==1) {
|
||||
$this->steamCmdTotal['sync'][$lookUpAppID]=$row['shorten'];
|
||||
} else if($updateType==2) {
|
||||
$this->steamCmdTotal['nosync'][$lookUpAppID]=$row['shorten'];
|
||||
|
||||
if ($updateType == 1) {
|
||||
$this->steamCmdTotal['sync'][$lookUpAppID] = $row['shorten'];
|
||||
|
||||
} else if($updateType == 2) {
|
||||
$this->steamCmdTotal['nosync'][$lookUpAppID] = $row['shorten'];
|
||||
}
|
||||
|
||||
// hlds installations
|
||||
} else if ($row['steamgame'] == 'Y') {
|
||||
if ($row['localVersion'] == null or ($row['localVersion'] != null and $row['localVersion']<$row['steamVersion'])) {
|
||||
if ($updateType==1) {
|
||||
$this->hldsOutdated['sync'][]=$row['shorten'];
|
||||
} else if ($updateType==2) {
|
||||
$this->hldsOutdated['nosync'][]=$row['shorten'];
|
||||
|
||||
if ($row['localVersion'] == null or ($row['localVersion'] != null and $row['localVersion'] < $row['steamVersion'])) {
|
||||
if ($updateType == 1) {
|
||||
$this->hldsOutdated['sync'][] = $row['shorten'];
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->hldsOutdated['nosync'][] = $row['shorten'];
|
||||
}
|
||||
} else if ($updateType==1) {
|
||||
$this->syncList[]=$row['shorten'];
|
||||
}
|
||||
if ($updateType==1) {
|
||||
$this->hldsTotal['sync'][]=$row['shorten'];
|
||||
} else if ($updateType==2) {
|
||||
$this->hldsTotal['nosync'][]=$row['shorten'];
|
||||
|
||||
} else if ($updateType == 1) {
|
||||
$this->syncList[] = $row['shorten'];
|
||||
}
|
||||
|
||||
// not shipped by valve tools
|
||||
if ($updateType == 1) {
|
||||
$this->hldsTotal['sync'][] = $row['shorten'];
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->hldsTotal['nosync'][] = $row['shorten'];
|
||||
}
|
||||
|
||||
|
||||
// Minecraft and Craftbukkit autoupdater
|
||||
// https://github.com/easy-wi/developer/issues/90 https://github.com/easy-wi/developer/issues/91
|
||||
} else if ($row['steamgame'] == 'N' and ($row['shorten'] == 'mc' or $row['shorten'] == 'bukkit')) {
|
||||
|
||||
|
||||
if ($row['localVersion'] == null or ($row['localVersion'] != null and $row['localVersion'] != $row['steamVersion'])) {
|
||||
if ($updateType == 1) {
|
||||
$this->mcOutdated['sync'][] = array('shorten' => $row['shorten'], 'url' => $row['downloadPath'], 'gamebinary' => $row['gamebinary']);
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->mcOutdated['nosync'][] = array('shorten' => $row['shorten'], 'url' => $row['downloadPath'], 'gamebinary' => $row['gamebinary']);
|
||||
}
|
||||
|
||||
} else if ($updateType == 1) {
|
||||
$this->syncList[] = $row['shorten'];
|
||||
}
|
||||
|
||||
if ($updateType == 1) {
|
||||
$this->mcTotal['sync'][] = array('shorten' => $row['shorten'], 'url' => $row['downloadPath'], 'gamebinary' => $row['gamebinary']);
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->mcTotal['nosync'][] = array('shorten' => $row['shorten'], 'url' => $row['downloadPath'], 'gamebinary' => $row['gamebinary']);
|
||||
}
|
||||
|
||||
// the rest
|
||||
} else if ($row['steamgame'] == 'N') {
|
||||
if ($row['updates']==1) {
|
||||
$this->noSteam['sync'][]=$row['shorten'];
|
||||
} else if ($updateType==2) {
|
||||
$this->noSteam['nosync'][]=$row['shorten'];
|
||||
|
||||
if ($row['updates'] == 1) {
|
||||
$this->noSteam['sync'][] = $row['shorten'];
|
||||
|
||||
} else if ($updateType == 2) {
|
||||
$this->noSteam['nosync'][] = $row['shorten'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (($row['supdates']==1 or $row['supdates']==4) and ($row['updates']==1 or $row['updates']==4)) {
|
||||
if (($row['supdates'] == 1 or $row['supdates'] == 4) and ($row['updates'] == 1 or $row['updates'] == 4)) {
|
||||
// collect maps
|
||||
$query2 = $sql->prepare("SELECT `addon` FROM `addons` WHERE `type`='map' AND `shorten`=? AND `resellerid`=?");
|
||||
$query2->execute(array($row['shorten'],$this->resellerID));
|
||||
$query2->execute(array($row['shorten'], $this->resellerID));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$this->maps[]=$row2['addon'];
|
||||
$this->maps[] = $row2['addon'];
|
||||
}
|
||||
|
||||
// collect addons
|
||||
$query2 = $sql->prepare("SELECT `addon` FROM `addons` WHERE `type`='tool' AND (`shorten`=? OR `shorten`=?) AND `resellerid`=?");
|
||||
$query2->execute(array($row['shorten'], $row['qstat'],$this->resellerID));
|
||||
$query2->execute(array($row['shorten'], $row['qstat'], $this->resellerID));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$this->addons[]=$row2['addon'];
|
||||
$this->addons[] = $row2['addon'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->addons=array_unique($this->addons);
|
||||
$this->maps=array_unique($this->maps);
|
||||
$this->addons = array_unique($this->addons);
|
||||
$this->maps = array_unique($this->maps);
|
||||
}
|
||||
|
||||
// return command only for outdated servers
|
||||
public function returnCmds ($install='update',$update=true) {
|
||||
public function returnCmds ($install = 'update', $update = true) {
|
||||
|
||||
global $sql;
|
||||
|
||||
if ($this->rootOK != true) {
|
||||
$this->sshcmd=null;
|
||||
$this->sshcmd = null;
|
||||
}
|
||||
|
||||
// Update if needed
|
||||
if ($update === true) {
|
||||
$steamCmdCount=count($this->steamCmdOutdated['sync'])+count($this->steamCmdOutdated['nosync']);
|
||||
$hldsCount=count($this->hldsOutdated['sync'])+count($this->hldsOutdated['nosync']);
|
||||
$steam='steamCmdOutdated';
|
||||
$hlds='hldsOutdated';
|
||||
$steamCmdCount = count($this->steamCmdOutdated['sync']) + count($this->steamCmdOutdated['nosync']);
|
||||
$hldsCount = count($this->hldsOutdated['sync']) + count($this->hldsOutdated['nosync']);
|
||||
$mcCount = count($this->mcOutdated['sync']) + count($this->mcOutdated['nosync']);
|
||||
$steam = 'steamCmdOutdated';
|
||||
$hlds = 'hldsOutdated';
|
||||
$mc = 'mcOutdated';
|
||||
|
||||
// Update in any case
|
||||
} else {
|
||||
$steamCmdCount=count($this->steamCmdTotal['sync'])+count($this->steamCmdTotal['nosync']);
|
||||
$hldsCount=count($this->hldsTotal['sync'])+count($this->hldsTotal['nosync']);
|
||||
$steam='steamCmdTotal';
|
||||
$hlds='hldsTotal';
|
||||
foreach (array_unique(array_merge($this->steamCmdTotal['sync'],$this->steamCmdTotal['nosync'],$this->hldsTotal['sync'],$this->hldsTotal['nosync'],$this->noSteam['sync'],$this->noSteam['nosync'])) as $shorten) {
|
||||
if(in_array($shorten,$this->syncList)) {
|
||||
unset($this->syncList[array_search($shorten,$this->syncList)]);
|
||||
$steamCmdCount = count($this->steamCmdTotal['sync']) + count($this->steamCmdTotal['nosync']);
|
||||
$hldsCount = count($this->hldsTotal['sync']) + count($this->hldsTotal['nosync']);
|
||||
$mcCount = count($this->mcTotal['sync']) + count($this->mcTotal['nosync']);
|
||||
$steam = 'steamCmdTotal';
|
||||
$hlds = 'hldsTotal';
|
||||
$mc = 'mcTotal';
|
||||
|
||||
foreach (array_unique(array_merge($this->steamCmdTotal['sync'], $this->steamCmdTotal['nosync'], $this->hldsTotal['sync'], $this->hldsTotal['nosync'], $this->noSteam['sync'], $this->noSteam['nosync'])) as $shorten) {
|
||||
if(in_array($shorten, $this->syncList)) {
|
||||
unset($this->syncList[array_search($shorten, $this->syncList)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$syncCount=count($this->syncList);
|
||||
$noSteamCount=count($this->noSteam['sync'])+count($this->noSteam['nosync']);
|
||||
$addonCount=count($this->maps)+count($this->addons);
|
||||
|
||||
|
||||
$syncCount = count($this->syncList);
|
||||
$noSteamCount = count($this->noSteam['sync']) + count($this->noSteam['nosync']);
|
||||
$addonCount = count($this->maps) + count($this->addons);
|
||||
|
||||
$query = $sql->prepare("SELECT r.`id` FROM `rservermasterg` r INNER JOIN `servertypes` t ON r.`servertypeid`=t.`id` WHERE r.`serverid`=? AND t.`shorten`=? LIMIT 1");
|
||||
|
||||
// Nothing to update
|
||||
if ($syncCount==0 and $noSteamCount==0 and $steamCmdCount==0 and $hldsCount==0) {
|
||||
if ($syncCount == 0 and $noSteamCount == 0 and $steamCmdCount == 0 and $hldsCount == 0 and $mcCount == 0) {
|
||||
$this->sshcmd=null;
|
||||
|
||||
} else {
|
||||
|
||||
$tempCmd = array();
|
||||
|
||||
// Sync games
|
||||
if ($syncCount>0 and $this->imageserver!='none') {
|
||||
foreach ($this->syncList as $k) {
|
||||
$query->execute(array($this->rootID,$k));
|
||||
$this->updateIDs[]=$query->fetchColumn();
|
||||
$query->execute(array($this->rootID, $k));
|
||||
$this->updateIDs[] = $query->fetchColumn();
|
||||
}
|
||||
$sshcmd='./control.sh syncserver '.$this->imageserver.' "'.implode(' ',$this->syncList).'" '.$this->webhost;
|
||||
|
||||
$tempCmd[] = './control.sh syncserver '.$this->imageserver . ' "' . implode(' ', $this->syncList) . '" ' . $this->webhost;
|
||||
}
|
||||
|
||||
// No Steam games
|
||||
if ($noSteamCount>0) {
|
||||
foreach (array_unique(array_merge($this->noSteam['sync'],$this->noSteam['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID,$k));
|
||||
$this->updateIDs[]=$query->fetchColumn();
|
||||
foreach (array_unique(array_merge($this->noSteam['sync'], $this->noSteam['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID, $k));
|
||||
$this->updateIDs[] = $query->fetchColumn();
|
||||
}
|
||||
if ($this->imageserver== 'none') {
|
||||
$cmd='./control.sh noSteamCmd '.$install.' "'.implode(' ', array_unique(array_merge($this->noSteam['sync'],$this->noSteam['nosync']))).'" '.$this->webhost . ' ' . $this->imageserver;
|
||||
} else if (count($this->noSteam['sync'])>0 and count($this->noSteam['nosync'])>0) {
|
||||
$cmd='./control.sh noSteamCmd '.$install.' "'.implode(' ',$this->noSteam['sync']).'" '.$this->webhost . ' ' . $this->imageserver.' && ./control.sh noSteamCmd '.$install.' "'.implode(' ',$this->noSteam['nosync']).'" '.$this->webhost.' none';
|
||||
} else if (count($this->noSteam['sync'])>0 and count($this->noSteam['nosync'])==0) {
|
||||
$cmd='./control.sh noSteamCmd '.$install.' "'.implode(' ',$this->noSteam['sync']).'" '.$this->webhost . ' ' . $this->imageserver;
|
||||
} else if (count($this->noSteam['sync'])==0 and count($this->noSteam['nosync'])>0) {
|
||||
$cmd='./control.sh noSteamCmd '.$install.' "'.implode(' ',$this->noSteam['nosync']).'" '.$this->webhost.' none';
|
||||
if ($this->imageserver == 'none') {
|
||||
$tempCmd[] = './control.sh noSteamCmd '.$install . ' "' . implode(' ', array_unique(array_merge($this->noSteam['sync'], $this->noSteam['nosync']))) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($this->noSteam['sync']) > 0 and count($this->noSteam['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh noSteamCmd '.$install . ' "' . implode(' ', $this->noSteam['sync']) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
$tempCmd[] = './control.sh noSteamCmd '.$install . ' "' . implode(' ', $this->noSteam['nosync']) . '" ' . $this->webhost.' none';
|
||||
|
||||
} else if (count($this->noSteam['sync']) > 0 and count($this->noSteam['nosync']) == 0) {
|
||||
$tempCmd[] = './control.sh noSteamCmd '.$install . ' "' . implode(' ', $this->noSteam['sync']) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($this->noSteam['sync']) == 0 and count($this->noSteam['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh noSteamCmd '.$install . ' "' . implode(' ', $this->noSteam['nosync']) . '" ' . $this->webhost.' none';
|
||||
}
|
||||
if (isset($sshcmd) and isset($cmd)) {
|
||||
$sshcmd.=' && '.$cmd;
|
||||
} else if (isset($cmd)) {
|
||||
$sshcmd=$cmd;
|
||||
}
|
||||
|
||||
// Minecraft Updates
|
||||
if ($mcCount>0) {
|
||||
|
||||
$goFor = $this->$mc;
|
||||
|
||||
$setToUpdate = array();
|
||||
$gameCommandListSync = array();
|
||||
$gameCommandListNoSync = array();
|
||||
|
||||
foreach ($goFor['sync'] as $k) {
|
||||
$setToUpdate[] = $k['shorten'];
|
||||
$gameCommandListSync[] = $k['shorten'] . ';' . $k['gamebinary'] . ';' . $k['url'];
|
||||
}
|
||||
|
||||
foreach ($goFor['nosync'] as $k) {
|
||||
$setToUpdate[] = $k['shorten'];
|
||||
$gameCommandListNoSync[] = $k['shorten'] . ';' . $k['gamebinary'] . ';' . $k['url'];
|
||||
}
|
||||
|
||||
foreach (array_unique($setToUpdate) as $k) {
|
||||
$query->execute(array($this->rootID, $k));
|
||||
$this->updateIDs[] = $query->fetchColumn();
|
||||
}
|
||||
|
||||
if ($this->imageserver == 'none') {
|
||||
$tempCmd[] = './control.sh mcUpdate '.$install . ' "' . implode(' ', array_unique(array_merge($gameCommandListSync, $gameCommandListNoSync))) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh mcUpdate '.$install . ' "' . implode(' ', $gameCommandListSync) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
$tempCmd[] = './control.sh mcUpdate '.$install . ' "' . implode(' ', $gameCommandListNoSync) . '" ' . $this->webhost.' none';
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) == 0) {
|
||||
$tempCmd[] = './control.sh mcUpdate '.$install . ' "' . implode(' ', $gameCommandListSync) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($goFor['sync']) == 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh mcUpdate '.$install . ' "' . implode(' ', $gameCommandListNoSync) . '" ' . $this->webhost.' none';
|
||||
}
|
||||
}
|
||||
|
||||
// steamCmd updates
|
||||
if ($steamCmdCount>0) {
|
||||
if (isset($cmd)) unset($cmd);
|
||||
$goFor=$this->$steam;
|
||||
foreach (array_unique(array_merge($goFor['sync'],$goFor['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID,$k));
|
||||
$this->updateIDs[]=$query->fetchColumn();
|
||||
|
||||
$goFor = $this->$steam;
|
||||
|
||||
foreach (array_unique(array_merge($goFor['sync'], $goFor['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID, $k));
|
||||
$this->updateIDs[] = $query->fetchColumn();
|
||||
}
|
||||
if ($this->imageserver== 'none') {
|
||||
|
||||
if ($this->imageserver == 'none') {
|
||||
$combined = array();
|
||||
foreach ($goFor['sync'] as $k=>$v) $combined[$k]=$v;
|
||||
foreach ($goFor['nosync'] as $k=>$v) $combined[$k]=$v;
|
||||
$cmd='./control.sh steamCmd '.$install.' "'.trim($this->makeSteamCmd($combined)).'" '.$this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword;
|
||||
} else if (count($goFor['sync'])>0 and count($goFor['nosync'])>0) {
|
||||
$cmd='./control.sh steamCmd '.$install.' "'.trim($this->makeSteamCmd($goFor['sync'])).'" '.$this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword.' && ./control.sh steamCmd '.$install.' "'.trim($this->makeSteamCmd($goFor['nosync'])).'" '.$this->webhost.' none '.$this->steamAccount . ' ' . $this->steamPassword;
|
||||
} else if (count($goFor['sync'])>0 and count($goFor['nosync'])==0) {
|
||||
$cmd='./control.sh steamCmd '.$install.' "'.trim($this->makeSteamCmd($goFor['sync'])).'" '.$this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword;
|
||||
} else if (count($goFor['sync'])==0 and count($goFor['nosync'])>0) {
|
||||
$cmd='./control.sh steamCmd '.$install.' "'.trim($this->makeSteamCmd($goFor['nosync'])).'" '.$this->webhost.' none '.$this->steamAccount . ' ' . $this->steamPassword;
|
||||
}
|
||||
if (isset($sshcmd) and isset($cmd)) {
|
||||
$sshcmd.=' && '.$cmd;
|
||||
} else if (isset($cmd)) {
|
||||
$sshcmd=$cmd;
|
||||
|
||||
foreach ($goFor['sync'] as $k=>$v) {
|
||||
$combined[$k] = $v;
|
||||
}
|
||||
|
||||
foreach ($goFor['nosync'] as $k=>$v) {
|
||||
$combined[$k] = $v;
|
||||
}
|
||||
|
||||
$tempCmd[] = './control.sh steamCmd '.$install . ' "' . trim($this->makeSteamCmd($combined)) . '" ' . $this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword;
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh steamCmd '.$install . ' "' . trim($this->makeSteamCmd($goFor['sync'])) . '" ' . $this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword;
|
||||
$tempCmd[] = './control.sh steamCmd '.$install . ' "' . trim($this->makeSteamCmd($goFor['nosync'])) . '" ' . $this->webhost.' none '.$this->steamAccount . ' ' . $this->steamPassword;
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) == 0) {
|
||||
$tempCmd[] = './control.sh steamCmd '.$install . ' "' . trim($this->makeSteamCmd($goFor['sync'])) . '" ' . $this->webhost . ' ' . $this->imageserver . ' ' . $this->steamAccount . ' ' . $this->steamPassword;
|
||||
|
||||
} else if (count($goFor['sync']) == 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh steamCmd '.$install . ' "' . trim($this->makeSteamCmd($goFor['nosync'])) . '" ' . $this->webhost.' none '.$this->steamAccount . ' ' . $this->steamPassword;
|
||||
}
|
||||
}
|
||||
|
||||
// hlds Updates
|
||||
if ($hldsCount>0) {
|
||||
if (isset($cmd)) unset($cmd);
|
||||
$goFor=$this->$hlds;
|
||||
foreach (array_unique(array_merge($goFor['sync'],$goFor['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID,$k));
|
||||
$this->updateIDs[]=$query->fetchColumn();
|
||||
|
||||
$goFor = $this->$hlds;
|
||||
|
||||
foreach (array_unique(array_merge($goFor['sync'], $goFor['nosync'])) as $k) {
|
||||
$query->execute(array($this->rootID, $k));
|
||||
$this->updateIDs[] = $query->fetchColumn();
|
||||
}
|
||||
if ($this->imageserver== 'none') {
|
||||
$cmd='./control.sh hldsCmd '.$install.' "'.implode(' ', array_unique(array_merge($goFor['sync'],$goFor['nosync']))).'" '.$this->webhost . ' ' . $this->imageserver;
|
||||
} else if (count($goFor['sync'])>0 and count($goFor['nosync'])>0) {
|
||||
$cmd='./control.sh hldsCmd '.$install.' "'.implode(' ',$goFor['sync']).'" '.$this->webhost . ' ' . $this->imageserver.' && ./control.sh hldsCmd '.$install.' "'.implode(' ',$goFor['nosync']).'" '.$this->webhost.' none';
|
||||
} else if (count($goFor['sync'])>0 and count($goFor['nosync'])==0) {
|
||||
$cmd='./control.sh hldsCmd '.$install.' "'.implode(' ',$goFor['sync']).'" '.$this->webhost . ' ' . $this->imageserver;
|
||||
} else if (count($goFor['sync'])==0 and count($goFor['nosync'])>0) {
|
||||
$cmd='./control.sh hldsCmd '.$install.' "'.implode(' ',$goFor['nosync']).'" '.$this->webhost.' none';
|
||||
}
|
||||
if (isset($sshcmd) and isset($cmd)) {
|
||||
$sshcmd.=' && '.$cmd;
|
||||
} else if (isset($cmd)) {
|
||||
$sshcmd=$cmd;
|
||||
|
||||
if ($this->imageserver == 'none') {
|
||||
$tempCmd[] = './control.sh hldsCmd '.$install . ' "' . implode(' ', array_unique(array_merge($goFor['sync'], $goFor['nosync']))) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh hldsCmd '.$install . ' "' . implode(' ', $goFor['sync']) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
$tempCmd[] = './control.sh hldsCmd '.$install . ' "' . implode(' ', $goFor['nosync']) . '" ' . $this->webhost.' none';
|
||||
|
||||
} else if (count($goFor['sync']) > 0 and count($goFor['nosync']) == 0) {
|
||||
$tempCmd[] = './control.sh hldsCmd '.$install . ' "' . implode(' ', $goFor['sync']) . '" ' . $this->webhost . ' ' . $this->imageserver;
|
||||
|
||||
} else if (count($goFor['sync']) == 0 and count($goFor['nosync']) > 0) {
|
||||
$tempCmd[] = './control.sh hldsCmd '.$install . ' "' . implode(' ', $goFor['nosync']) . '" ' . $this->webhost.' none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// sync maps and addons
|
||||
if (isset($sshcmd) and $addonCount>0) {
|
||||
$sshcmd.=' && ./control.sh syncaddons '.$this->imageserver.' "'.implode(' ',$this->maps).'" "'.implode(' ',$this->addons).'"';
|
||||
}
|
||||
if (isset($sshcmd)) {
|
||||
$this->sshcmd=$sshcmd;
|
||||
$tempCmd[] = './control.sh syncaddons '.$this->imageserver . ' "' . implode(' ', $this->maps).'" "'.implode(' ', $this->addons).'"';
|
||||
}
|
||||
|
||||
$this->sshcmd = $tempCmd;
|
||||
}
|
||||
#die ('Command: ' . $this->sshcmd);
|
||||
#print_r($this->sshcmd);
|
||||
return $this->sshcmd;
|
||||
}
|
||||
public function setUpdating () {
|
||||
|
||||
global $sql;
|
||||
|
||||
$query = $sql->prepare("UPDATE `rservermasterg` SET `updating`='Y' WHERE `id`=? LIMIT 1");
|
||||
foreach ($this->updateIDs as $id) {
|
||||
$query->execute(array($id));
|
||||
}
|
||||
}
|
||||
private function makeSteamCmd ($array) {
|
||||
|
||||
$steamCmd = '';
|
||||
|
||||
foreach ($array as $key=>$val) {
|
||||
|
||||
if (is_numeric($key)) {
|
||||
$steamCmd.=$val . ' ' . workAroundForValveChaos($key,$val, false).' ';
|
||||
$steamCmd .= $val . ' ' . workAroundForValveChaos($key, $val, false) . ' ';
|
||||
|
||||
} else {
|
||||
list($appID)=explode('-',$key);
|
||||
$steamCmd.=$val . ' ' . workAroundForValveChaos($appID,$val, false).' ';
|
||||
list($appID)=explode('-', $key);
|
||||
$steamCmd .= $val . ' ' . workAroundForValveChaos($appID, $val, false) . ' ';
|
||||
}
|
||||
}
|
||||
return $steamCmd;
|
||||
}
|
||||
function __destruct() {
|
||||
unset($this->updateIDs,$this->aeskey,$this->imageserver,$this->resellerID,$this->webhost,$this->rootID,$this->steamAccount,$this->steamPassword,$this->sship,$this->sshport,$this->sshuser,$this->sshpass,$this->publickey,$this->keyname,$this->syncList,$this->steamCmdTotal,$this->steamCmdOutdated,$this->hldsTotal,$this->hldsOutdated,$this->noSteam,$this->maps,$this->addons,$this->sshcmd);
|
||||
unset($this->updateIDs, $this->aeskey, $this->imageserver, $this->resellerID, $this->webhost, $this->rootID, $this->steamAccount, $this->steamPassword, $this->sship, $this->sshport, $this->sshuser, $this->sshpass, $this->publickey, $this->keyname, $this->syncList, $this->steamCmdTotal, $this->steamCmdOutdated, $this->hldsTotal, $this->hldsOutdated, $this->noSteam, $this->maps, $this->addons, $this->sshcmd);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ class PageSettings {
|
||||
$this->canurl=$this->pageurl.'/';
|
||||
}
|
||||
private function NameToLink ($value) {
|
||||
$szrm=array('ä'=>'ae','ö'=>'oe','ü'=>'ue','Ä'=>'Ae','Ö'=>'Oe','Ü'=>'Ue','ß'=>'ss','á'=>'a','à'=>'a','Á'=>'A','À'=>'A','é'=>'e','è'=>'e','É'=>'E','È'=>'E','ó'=>'o','ò'=>'o','Ó'=>'O','Ò'=>'O','ú'=>'u','ù'=>'u','Ú'=>'U','Ù'=>'U');
|
||||
$szrm=array('ä' => 'ae','ö' => 'oe','ü' => 'ue','Ä' => 'Ae','Ö' => 'Oe','Ü' => 'Ue','ß' => 'ss','á' => 'a','à' => 'a','Á' => 'A','À' => 'A','é' => 'e','è' => 'e','É' => 'E','È' => 'E','ó' => 'o','ò' => 'o','Ó' => 'O','Ò' => 'O','ú' => 'u','ù' => 'u','Ú' => 'U','Ù' => 'U');
|
||||
return strtolower(preg_replace('/[^a-zA-Z0-9]{1}/','-',strtr($value,$szrm)));
|
||||
}
|
||||
function SetData ($var,$value) {
|
||||
@ -66,7 +66,7 @@ class PageSettings {
|
||||
$i++;
|
||||
$value=$value . '-' . $i;
|
||||
}
|
||||
$this->pages_array[$type][$pageid]=$value;
|
||||
$this->pages_array[$type][$pageid] = $value;
|
||||
return $value;
|
||||
}
|
||||
function SetMenu ($linkname,$request,$subid,$id=false,$listPage=true) {
|
||||
@ -81,7 +81,7 @@ class PageSettings {
|
||||
} else {
|
||||
$link = '/'. $this->AddPageToArray('pages',$id,$this->NameToLink($request));
|
||||
}
|
||||
$subdata['link']=$this->pageurl. '/' . $this->language.$link.'/';
|
||||
$subdata['link'] = $this->pageurl. '/' . $this->language.$link.'/';
|
||||
} else {
|
||||
if (is_array($request)) {
|
||||
$getparams = '';
|
||||
@ -95,22 +95,22 @@ class PageSettings {
|
||||
} else {
|
||||
$getparams='?site='.$request;
|
||||
}
|
||||
$subdata['link']=$this->pageurl.'/index.php'.$getparams;
|
||||
$subdata['link'] = $this->pageurl.'/index.php'.$getparams;
|
||||
}
|
||||
$subdata['href'] = '<a href="'.$subdata['link'].'" title="'.$linkname.'">'.$linkname.'</a>';
|
||||
$subdata['linkname']=$linkname;
|
||||
$subdata['linkname'] = $linkname;
|
||||
if ($id==false and $listPage==true) {
|
||||
$this->pages[$subid]=$subdata;
|
||||
$this->pages[$subid] = $subdata;
|
||||
} else if ($listPage==true) {
|
||||
$this->pages[$subid][$id]=$subdata;
|
||||
$this->pages[$subid][$id] = $subdata;
|
||||
} else if ($id==false and $listPage==false) {
|
||||
$this->hiddenPages[$subid]=$subdata;
|
||||
$this->hiddenPages[$subid] = $subdata;
|
||||
} else if ($listPage==false) {
|
||||
$this->hiddenPages[$subid][$id]=$subdata;
|
||||
$this->hiddenPages[$subid][$id] = $subdata;
|
||||
}
|
||||
}
|
||||
function SetNewsPost ($id,$title,$text,$cutOff) {
|
||||
$this->last_news[$id]['title']=$title;
|
||||
$this->last_news[$id]['title'] = $title;
|
||||
$this->last_news[$id]['text']=(strlen($text)<=$cutOff) ? $text : substr($text,0,$cutOff).' ...';
|
||||
$this->last_news[$id]['link']=($this->seo== 'Y') ? $this->pages['news']['link'].$this->NameToLink($title).'/' : $this->pages['news']['link'].'&id='.$id;
|
||||
$this->last_news[$id]['href'] = '<a href="'.$this->last_news[$id]['link'].'" title="'.$title.'">'.$title.'</a>';
|
||||
@ -124,7 +124,7 @@ class PageSettings {
|
||||
} else {
|
||||
$link = '/'. $this->AddPageToArray($var,$id,$this->NameToLink($request));
|
||||
}
|
||||
$subdata[$id]['link']=$this->pageurl. '/' . $this->language.$link.'/';
|
||||
$subdata[$id]['link'] = $this->pageurl. '/' . $this->language.$link.'/';
|
||||
} else {
|
||||
if (is_array($request)) {
|
||||
$getparams = '';
|
||||
@ -136,10 +136,10 @@ class PageSettings {
|
||||
} else {
|
||||
$getparams='?site='.$request;
|
||||
}
|
||||
$subdata[$id]['link']=$this->pageurl.'/index.php'.$getparams;
|
||||
$subdata[$id]['link'] = $this->pageurl.'/index.php'.$getparams;
|
||||
}
|
||||
$subdata[$id]['href'] = '<a href="'.$subdata[$id]['link'].'" title="'.$linkname.'">'.$linkname.'</a>';
|
||||
$subdata[$id]['linkname']=$linkname;
|
||||
$subdata[$id]['linkname'] = $linkname;
|
||||
$this->$var=$subdata;
|
||||
}
|
||||
function setCanonicalUrl($s=null,$ID=null) {
|
||||
@ -225,7 +225,7 @@ function checkForSpam ($checkURL=null) {
|
||||
$hostByIp = '';
|
||||
if ($ui->ip4('REMOTE_ADDR','server')) {
|
||||
$hostByIp=gethostbyaddr($ui->ip4('REMOTE_ADDR','server'));
|
||||
$ips[]=$hostByIp;
|
||||
$ips[] = $hostByIp;
|
||||
}
|
||||
$query = $sql->prepare("SELECT COUNT(`commentID`) AS `amount` FROM `page_comments` WHERE `markedSpam`='Y' AND (`ip`=? OR `dns`=?) AND `resellerid`=0 LIMIT 1");
|
||||
$query->execute(array($ui->ip('REMOTE_ADDR','server'),$hostByIp));
|
||||
@ -275,7 +275,7 @@ function checkForSpam ($checkURL=null) {
|
||||
$ipRevers=implode('.', array_reverse(explode('.',$ip)));
|
||||
if (count($spamReason)==0 and $tornevall== 'Y' and (bool)checkdnsrr($ipRevers.'.opm.tornevall.org.','A')) $spamReason[] = 'IP is listed at dnsbl.tornevall.org';
|
||||
if (count($spamReason)==0 and $honeyPotKey != null and $honeyPotKey != '') {
|
||||
$ex=explode('.',gethostbyname($honeyPotKey.'.'.$ipRevers.'.dnsbl.httpbl.org'));
|
||||
$ex=explode('.',gethostbyname($honeyPotKey . '.' . $ipRevers.'.dnsbl.httpbl.org'));
|
||||
if ($ex[0]==127){
|
||||
$types=array(1=>'Suspicious',2=>'Harvester',3=>'Suspicious & Harvester',4=>'Comment Spammer',5=>'Suspicious & Comment Spammer',6=>'Harvester & Comment Spammer',7=>'Suspicious & Harvester & Comment Spammer');
|
||||
if ($ex[3] != 0) $spamReason[] = 'IP seems to be a '.$types[$ex[3]].'. It was last seen '.$ex[1].' day(s) ago and has a threat score of '.$ex[2];
|
||||
|
@ -159,8 +159,8 @@ class easyWiRest {
|
||||
private function execCurl($type,$send) {
|
||||
|
||||
// Setting up POST data and add it to the opts
|
||||
$postArray['type']=$type;
|
||||
$postArray['xmlstring']=$send;
|
||||
$postArray['type'] = $type;
|
||||
$postArray['xmlstring'] = $send;
|
||||
curl_setopt($this->handle,CURLOPT_POSTFIELDS,$postArray);
|
||||
|
||||
// Execute request, get the response and return it.
|
||||
|
@ -64,7 +64,7 @@ class rootServer {
|
||||
public function rootServer ($ID,$action,$type='dedicated',$extraData=null) {
|
||||
$this->tempID=$ID;
|
||||
$this->ID[$type][$ID] = array();
|
||||
$this->ID[$type][$ID]['action']=$action;
|
||||
$this->ID[$type][$ID]['action'] = $action;
|
||||
$this->type=$type;
|
||||
$this->extraData=$extraData;
|
||||
$imageID=(isset($extraData['imageID'])) ? $extraData['imageID'] : 0;
|
||||
@ -84,18 +84,18 @@ class rootServer {
|
||||
$query=$this->sql->prepare("SELECT d.*,u.`cname` FROM `rootsDedicated` d LEFT JOIN `userdata` u ON d.`userID`=u.`id` WHERE d.`dedicatedID`=? LIMIT 1");
|
||||
$query->execute(array($this->tempID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$this->ID[$type][$ID]['useDHCP']=$row['useDHCP'];
|
||||
$this->ID[$type][$ID]['useDHCP'] = $row['useDHCP'];
|
||||
$this->ID[$type][$ID]['hostname'] = 'dedi-'.$ID;
|
||||
$this->ID[$type][$ID]['usePXE']=$row['usePXE'];
|
||||
$this->ID[$type][$ID]['pxeID']=$row['pxeID'];
|
||||
$this->ID[$type][$ID]['mac']=$row['mac'];
|
||||
$this->ID[$type][$ID]['ip']=$row['ip'];
|
||||
$this->ID[$type][$ID]['restart']=$row['restart'];
|
||||
$this->ID[$type][$ID]['apiRequestType']=$row['apiRequestType'];
|
||||
$this->ID[$type][$ID]['apiRequestRestart']=$row['apiRequestRestart'];
|
||||
$this->ID[$type][$ID]['apiRequestStop']=$row['apiRequestStop'];
|
||||
$this->ID[$type][$ID]['https']=$row['https'];
|
||||
$this->ID[$type][$ID]['apiURL']=$row['apiURL'];
|
||||
$this->ID[$type][$ID]['usePXE'] = $row['usePXE'];
|
||||
$this->ID[$type][$ID]['pxeID'] = $row['pxeID'];
|
||||
$this->ID[$type][$ID]['mac'] = $row['mac'];
|
||||
$this->ID[$type][$ID]['ip'] = $row['ip'];
|
||||
$this->ID[$type][$ID]['restart'] = $row['restart'];
|
||||
$this->ID[$type][$ID]['apiRequestType'] = $row['apiRequestType'];
|
||||
$this->ID[$type][$ID]['apiRequestRestart'] = $row['apiRequestRestart'];
|
||||
$this->ID[$type][$ID]['apiRequestStop'] = $row['apiRequestStop'];
|
||||
$this->ID[$type][$ID]['https'] = $row['https'];
|
||||
$this->ID[$type][$ID]['apiURL'] = $row['apiURL'];
|
||||
$userID=$row['userID'];
|
||||
$resellerID=$row['resellerID'];
|
||||
}
|
||||
@ -103,30 +103,30 @@ class rootServer {
|
||||
// Get VMware Data
|
||||
} else if ($this->type == 'vmware') {
|
||||
$query=$this->sql->prepare("SELECT c.*,u.`id` AS `userID`,u.`cname`,h.`cores` AS `hcore`,h.`esxi`,h.`id` AS `hostID`,h.`ip` AS `hip`,AES_DECRYPT(h.`port`,:aeskey) AS `dport`,AES_DECRYPT(h.`user`,:aeskey) AS `duser`,AES_DECRYPT(h.`pass`,:aeskey) AS `dpass`,h.`publickey`,h.`keyname` FROM `virtualcontainer` c INNER JOIN `userdata` u ON c.`userid`=u.`id` INNER JOIN `virtualhosts` h ON c.`hostid`=h.`id` WHERE c.`id`=:vmID LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$this->aeskey,':vmID'=>$this->tempID));
|
||||
$query->execute(array(':aeskey' => $this->aeskey,':vmID' => $this->tempID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!isset($this->vmwareHosts[$row['hostID']])) {
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['ip']=$row['hip'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['dport']=$row['dport'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['duser']=$row['duser'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['dpass']=$row['dpass'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['publickey']=$row['publickey'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['keyname']=$row['keyname'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['ip'] = $row['hip'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['dport'] = $row['dport'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['duser'] = $row['duser'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['dpass'] = $row['dpass'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['publickey'] = $row['publickey'];
|
||||
$this->vmwareHosts[$row['hostID']]['vmIDs']['keyname'] = $row['keyname'];
|
||||
}
|
||||
$this->ID[$type][$ID]['cores']=$row['cores'];
|
||||
$this->ID[$type][$ID]['mountpoint']=$row['mountpoint'];
|
||||
$this->ID[$type][$ID]['hostname']=$row['cname'] . '-' . $this->tempID;
|
||||
$this->ID[$type][$ID]['cores'] = $row['cores'];
|
||||
$this->ID[$type][$ID]['mountpoint'] = $row['mountpoint'];
|
||||
$this->ID[$type][$ID]['hostname'] = $row['cname'] . '-' . $this->tempID;
|
||||
$this->ID[$type][$ID]['ram']=1024*$row['ram'];
|
||||
$this->ID[$type][$ID]['minram']=1024*$row['minram'];
|
||||
$this->ID[$type][$ID]['maxram']=1024*$row['maxram'];
|
||||
$this->ID[$type][$ID]['minmhz']=$row['cores']*$row['minmhz'];
|
||||
$this->ID[$type][$ID]['maxmhz']=$row['cores']*$row['maxmhz'];
|
||||
$this->ID[$type][$ID]['hddsize']=$row['hddsize'].'GB';
|
||||
$this->ID[$type][$ID]['mac']=$row['mac'];
|
||||
$this->ID[$type][$ID]['pxeID']=$row['pxeID'];
|
||||
$this->ID[$type][$ID]['minmhz'] = $row['cores']*$row['minmhz'];
|
||||
$this->ID[$type][$ID]['maxmhz'] = $row['cores']*$row['maxmhz'];
|
||||
$this->ID[$type][$ID]['hddsize'] = $row['hddsize'].'GB';
|
||||
$this->ID[$type][$ID]['mac'] = $row['mac'];
|
||||
$this->ID[$type][$ID]['pxeID'] = $row['pxeID'];
|
||||
$this->ID[$type][$ID]['hostname'] = 'vmware-'.$ID;
|
||||
$this->ID[$type][$ID]['mac']=$row['mac'];
|
||||
$this->ID[$type][$ID]['ip']=$row['ip'];
|
||||
$this->ID[$type][$ID]['mac'] = $row['mac'];
|
||||
$this->ID[$type][$ID]['ip'] = $row['ip'];
|
||||
$this->ID[$type][$ID]['usePXE'] = 'Y';
|
||||
$this->ID[$type][$ID]['restart'] = 'Y';
|
||||
$this->ID[$type][$ID]['distro']=(isset($distro)) ? $distro : '';
|
||||
@ -134,7 +134,7 @@ class rootServer {
|
||||
$hostID=$row['hostid'];
|
||||
$userID=$row['userid'];
|
||||
$resellerID=$row['resellerid'];
|
||||
$this->vmwareHosts[$row['hostID']]['actions'][]=array('action'=>$action,'id'=>$ID);
|
||||
$this->vmwareHosts[$row['hostID']]['actions'][]=array('action' => $action,'id' => $ID);
|
||||
}
|
||||
}
|
||||
if (!isset($row['ip'])) return 'Database Error: Could not find VM or ESX(i) host for ID: '.$this->tempID;
|
||||
@ -148,50 +148,50 @@ class rootServer {
|
||||
// get DHCP Data from DB
|
||||
if ($this->type == 'vmware' or ($this->type == 'dedicated' and $this->ID[$type][$ID]['useDHCP'] == 'Y')) {
|
||||
$ex=explode('.',$this->ID[$type][$ID]['ip']);
|
||||
$subnet=$ex[0].'.'.$ex[1].'.'.$ex[2].'.0';
|
||||
$this->ID[$type][$ID]['subnet']=$subnet;
|
||||
$searchFor=$ex[0].'.'.$ex[1].'.'.$ex[2].'.';
|
||||
$subnet=$ex[0] . '.' . $ex[1] . '.' . $ex[2].'.0';
|
||||
$this->ID[$type][$ID]['subnet'] = $subnet;
|
||||
$searchFor=$ex[0] . '.' . $ex[1] . '.' . $ex[2].'.';
|
||||
$query=$this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsDHCP` WHERE `active`='Y' AND (`ips` LIKE :ip OR `ips` LIKE :subnet)");
|
||||
$query->execute(array(':aeskey'=>$this->aeskey,':ip'=>'%'.$this->ID[$type][$ID]['ip'].'%',':subnet'=>'%'.$searchFor.'%'));
|
||||
$query->execute(array(':aeskey' => $this->aeskey,':ip' => '%'.$this->ID[$type][$ID]['ip'].'%',':subnet' => '%'.$searchFor.'%'));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!isset($foundDHCP) and in_array($this->ID[$type][$ID]['ip'],ipstoarray($row['ips']))) {
|
||||
$foundDHCP = true;
|
||||
if (!isset($this->dhcpData[$row['id']])) {
|
||||
$this->dhcpData[$row['id']]['ip']=$row['ip'];
|
||||
$this->dhcpData[$row['id']]['port']=$row['dport'];
|
||||
$this->dhcpData[$row['id']]['user']=$row['duser'];
|
||||
$this->dhcpData[$row['id']]['pass']=$row['dpass'];
|
||||
$this->dhcpData[$row['id']]['publickey']=$row['publickey'];
|
||||
$this->dhcpData[$row['id']]['keyname']=$row['keyname'];
|
||||
$this->dhcpData[$row['id']]['netmask']=$row['netmask'];
|
||||
$this->dhcpData[$row['id']]['startCmd']=$row['startCmd'];
|
||||
$this->dhcpData[$row['id']]['dhcpFile']=$row['dhcpFile'];
|
||||
$this->dhcpData[$row['id']]['subnetOptions']=$row['subnetOptions'];
|
||||
$this->dhcpData[$row['id']]['ip'] = $row['ip'];
|
||||
$this->dhcpData[$row['id']]['port'] = $row['dport'];
|
||||
$this->dhcpData[$row['id']]['user'] = $row['duser'];
|
||||
$this->dhcpData[$row['id']]['pass'] = $row['dpass'];
|
||||
$this->dhcpData[$row['id']]['publickey'] = $row['publickey'];
|
||||
$this->dhcpData[$row['id']]['keyname'] = $row['keyname'];
|
||||
$this->dhcpData[$row['id']]['netmask'] = $row['netmask'];
|
||||
$this->dhcpData[$row['id']]['startCmd'] = $row['startCmd'];
|
||||
$this->dhcpData[$row['id']]['dhcpFile'] = $row['dhcpFile'];
|
||||
$this->dhcpData[$row['id']]['subnetOptions'] = $row['subnetOptions'];
|
||||
}
|
||||
$this->dhcpData[$row['id']]['actions'][]=array('action'=>$action,'id'=>$ID,'type'=>$type,'imageID'=>$imageID,'hostID'=>$hostID,'userID'=>$userID,'resellerID'=>$resellerID);
|
||||
$this->dhcpData[$row['id']]['actions'][]=array('action' => $action,'id' => $ID,'type' => $type,'imageID' => $imageID,'hostID' => $hostID,'userID' => $userID,'resellerID' => $resellerID);
|
||||
$modID=$row['id'];
|
||||
}
|
||||
}
|
||||
if (isset($foundDHCP) and $action == 'md' and isset($this->extraData['oldip']) and $this->extraData['oldip'] != $this->ID[$type][$ID]['ip']) {
|
||||
$ex=explode('.',$this->extraData['oldip']);
|
||||
$searchForOld=$ex[0].'.'.$ex[1].'.'.$ex[2].'.';
|
||||
$searchForOld=$ex[0] . '.' . $ex[1] . '.' . $ex[2].'.';
|
||||
$query=$this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsDHCP` WHERE `active`='Y' AND (`ips` LIKE :ip OR `ips` LIKE :subnet)");
|
||||
$query->execute(array(':aeskey'=>$this->aeskey,':ip'=>'%'.$this->extraData['oldip'].'%',':subnet'=>'%'.$searchForOld.'%'));
|
||||
$query->execute(array(':aeskey' => $this->aeskey,':ip' => '%'.$this->extraData['oldip'].'%',':subnet' => '%'.$searchForOld.'%'));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (in_array($this->extraData['oldip'],ipstoarray($row['ips']))) {
|
||||
if (!isset($this->dhcpData[$row['id']])) {
|
||||
$this->dhcpData[$row['id']]['ip']=$row['ip'];
|
||||
$this->dhcpData[$row['id']]['port']=$row['dport'];
|
||||
$this->dhcpData[$row['id']]['user']=$row['duser'];
|
||||
$this->dhcpData[$row['id']]['pass']=$row['dpass'];
|
||||
$this->dhcpData[$row['id']]['publickey']=$row['publickey'];
|
||||
$this->dhcpData[$row['id']]['keyname']=$row['keyname'];
|
||||
$this->dhcpData[$row['id']]['netmask']=$row['netmask'];
|
||||
$this->dhcpData[$row['id']]['startCmd']=$row['startCmd'];
|
||||
$this->dhcpData[$row['id']]['dhcpFile']=$row['dhcpFile'];
|
||||
$this->dhcpData[$row['id']]['subnetOptions']=$row['subnetOptions'];
|
||||
$this->dhcpData[$row['id']]['ip'] = $row['ip'];
|
||||
$this->dhcpData[$row['id']]['port'] = $row['dport'];
|
||||
$this->dhcpData[$row['id']]['user'] = $row['duser'];
|
||||
$this->dhcpData[$row['id']]['pass'] = $row['dpass'];
|
||||
$this->dhcpData[$row['id']]['publickey'] = $row['publickey'];
|
||||
$this->dhcpData[$row['id']]['keyname'] = $row['keyname'];
|
||||
$this->dhcpData[$row['id']]['netmask'] = $row['netmask'];
|
||||
$this->dhcpData[$row['id']]['startCmd'] = $row['startCmd'];
|
||||
$this->dhcpData[$row['id']]['dhcpFile'] = $row['dhcpFile'];
|
||||
$this->dhcpData[$row['id']]['subnetOptions'] = $row['subnetOptions'];
|
||||
}
|
||||
if (isset($modID) and $modID != $row['id']) $this->dhcpData[$row['id']]['actions'][]=array('action'=>'del','id'=>$ID,'type'=>$type,'imageID'=>$imageID,'hostID'=>$hostID,'userID'=>$userID,'resellerID'=>$resellerID);
|
||||
if (isset($modID) and $modID != $row['id']) $this->dhcpData[$row['id']]['actions'][]=array('action' => 'del','id' => $ID,'type' => $type,'imageID' => $imageID,'hostID' => $hostID,'userID' => $userID,'resellerID' => $resellerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,40 +204,40 @@ class rootServer {
|
||||
if (!in_array($action, array('md','ad','rp')) and ($this->type == 'vmware' or ($this->type == 'dedicated' and $this->ID[$type][$ID]['usePXE'] == 'Y')) and isid($imageID,10)) {
|
||||
if (isid($this->ID[$type][$ID]['pxeID'],10)) {
|
||||
$query=$this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsPXE` WHERE `active`='Y' AND `id`=:pxeID LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$this->aeskey,':pxeID'=>$this->ID[$type][$ID]['pxeID']));
|
||||
$query->execute(array(':aeskey' => $this->aeskey,':pxeID' => $this->ID[$type][$ID]['pxeID']));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if(!isset($this->PXEData[$row['id']])){
|
||||
$this->PXEData[$row['id']]['ip']=$row['ip'];
|
||||
$this->PXEData[$row['id']]['port']=$row['dport'];
|
||||
$this->PXEData[$row['id']]['user']=$row['duser'];
|
||||
$this->PXEData[$row['id']]['pass']=$row['dpass'];
|
||||
$this->PXEData[$row['id']]['publickey']=$row['publickey'];
|
||||
$this->PXEData[$row['id']]['keyname']=$row['keyname'];
|
||||
$this->PXEData[$row['id']]['PXEFolder']=$row['PXEFolder'];
|
||||
$this->PXEData[$row['id']]['ip'] = $row['ip'];
|
||||
$this->PXEData[$row['id']]['port'] = $row['dport'];
|
||||
$this->PXEData[$row['id']]['user'] = $row['duser'];
|
||||
$this->PXEData[$row['id']]['pass'] = $row['dpass'];
|
||||
$this->PXEData[$row['id']]['publickey'] = $row['publickey'];
|
||||
$this->PXEData[$row['id']]['keyname'] = $row['keyname'];
|
||||
$this->PXEData[$row['id']]['PXEFolder'] = $row['PXEFolder'];
|
||||
}
|
||||
$foundPXE = true;
|
||||
$this->PXEData[$row['id']]['actions'][]=array('action'=>$action,'id'=>$ID,'type'=>$type,'imageID'=>$imageID);
|
||||
$this->ID[$type][$ID]['pxeIP']=$row['ip'];
|
||||
$this->ID[$type][$ID]['pxeID']=$row['id'];
|
||||
$this->PXEData[$row['id']]['actions'][]=array('action' => $action,'id' => $ID,'type' => $type,'imageID' => $imageID);
|
||||
$this->ID[$type][$ID]['pxeIP'] = $row['ip'];
|
||||
$this->ID[$type][$ID]['pxeID'] = $row['id'];
|
||||
}
|
||||
}
|
||||
if (!isset($foundPXE) and $action!='dl') {
|
||||
$query=$this->sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass` FROM `rootsPXE` WHERE `active`='Y' ORDER BY RAND() LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$this->aeskey));
|
||||
$query->execute(array(':aeskey' => $this->aeskey));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if(!isset($this->PXEData[$row['id']])){
|
||||
$this->PXEData[$row['id']]['ip']=$row['ip'];
|
||||
$this->PXEData[$row['id']]['port']=$row['dport'];
|
||||
$this->PXEData[$row['id']]['user']=$row['duser'];
|
||||
$this->PXEData[$row['id']]['pass']=$row['dpass'];
|
||||
$this->PXEData[$row['id']]['publickey']=$row['publickey'];
|
||||
$this->PXEData[$row['id']]['keyname']=$row['keyname'];
|
||||
$this->PXEData[$row['id']]['PXEFolder']=$row['PXEFolder'];
|
||||
$this->PXEData[$row['id']]['ip'] = $row['ip'];
|
||||
$this->PXEData[$row['id']]['port'] = $row['dport'];
|
||||
$this->PXEData[$row['id']]['user'] = $row['duser'];
|
||||
$this->PXEData[$row['id']]['pass'] = $row['dpass'];
|
||||
$this->PXEData[$row['id']]['publickey'] = $row['publickey'];
|
||||
$this->PXEData[$row['id']]['keyname'] = $row['keyname'];
|
||||
$this->PXEData[$row['id']]['PXEFolder'] = $row['PXEFolder'];
|
||||
}
|
||||
$foundPXE = true;
|
||||
$this->PXEData[$row['id']]['actions'][]=array('action'=>$action,'id'=>$ID,'type'=>$type,'imageID'=>$imageID);
|
||||
$this->ID[$type][$ID]['pxeIP']=$row['ip'];
|
||||
$this->ID[$type][$ID]['pxeID']=$row['id'];
|
||||
$this->PXEData[$row['id']]['actions'][]=array('action' => $action,'id' => $ID,'type' => $type,'imageID' => $imageID);
|
||||
$this->ID[$type][$ID]['pxeIP'] = $row['ip'];
|
||||
$this->ID[$type][$ID]['pxeID'] = $row['id'];
|
||||
}
|
||||
}
|
||||
if (!isset($foundPXE) and $action!='dl') {
|
||||
@ -246,7 +246,7 @@ class rootServer {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->ID[$type][$ID]['restart'] == 'A' and $this->type == 'dedicated' and $action!='rp') $this->startStop[]=array('action'=>((isset($this->extraData['oldactive']) and $this->extraData['oldactive'] == 'Y') or in_array($action, array('ad','st','dl'))) ? 'st' : 're','id'=>$ID and $action!='rp');
|
||||
if ($this->ID[$type][$ID]['restart'] == 'A' and $this->type == 'dedicated' and $action!='rp') $this->startStop[]=array('action'=>((isset($this->extraData['oldactive']) and $this->extraData['oldactive'] == 'Y') or in_array($action, array('ad','st','dl'))) ? 'st' : 're','id' => $ID and $action!='rp');
|
||||
else if ($this->type == 'dedicated' and $action!='rp') return 'Restart not allowed for Server with ID: '.$this->tempID;
|
||||
return true;
|
||||
}
|
||||
@ -262,7 +262,7 @@ class rootServer {
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'], array('hostkey'=>'ssh-rsa')) : false;
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'], array('hostkey' => 'ssh-rsa')) : false;
|
||||
} else {
|
||||
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
||||
}
|
||||
@ -284,12 +284,12 @@ class rootServer {
|
||||
if ($a['action'] == 'del' and isset($config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']])) {
|
||||
unset($config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]);
|
||||
} else if (isset($this->ID[$a['type']][$a['id']])) {
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['hardware ethernet']=$this->ID[$a['type']][$a['id']]['mac'].';';
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['fixed-address']=$this->ID[$a['type']][$a['id']]['ip'].';';
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['hardware ethernet'] = $this->ID[$a['type']][$a['id']]['mac'].';';
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['fixed-address'] = $this->ID[$a['type']][$a['id']]['ip'].';';
|
||||
if ($this->ID[$a['type']][$a['id']]['usePXE'] == 'Y' and (in_array($a['action'], array('ad','ri','rc')))) {
|
||||
$removeArray[]=array('type'=>($a['type'] == 'dedicated') ? 'de' : 'vs','affectedID'=>$a['id'],'name'=>$this->ID[$a['type']][$a['id']]['ip'],'imageID'=>$a['imageID'],'hostID'=>$a['hostID'],'userID'=>$a['userID'],'resellerID'=>$a['resellerID'],'extraData'=>array('runAt'=>strtotime("+5 minutes")));
|
||||
$removeArray[]=array('type'=>($a['type'] == 'dedicated') ? 'de' : 'vs','affectedID' => $a['id'],'name' => $this->ID[$a['type']][$a['id']]['ip'],'imageID' => $a['imageID'],'hostID' => $a['hostID'],'userID' => $a['userID'],'resellerID' => $a['resellerID'],'extraData'=>array('runAt' => strtotime("+5 minutes")));
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['filename'] = 'pxelinux.0;';
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['next-server']=$this->ID[$a['type']][$a['id']]['pxeIP'].';';
|
||||
$config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['next-server'] = $this->ID[$a['type']][$a['id']]['pxeIP'].';';
|
||||
} else {
|
||||
unset($config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['filename']);
|
||||
unset($config['subnet'][$this->ID[$a['type']][$a['id']]['subnet']][$this->ID[$a['type']][$a['id']]['hostname']]['next-server']);
|
||||
@ -324,7 +324,7 @@ class rootServer {
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'], array('hostkey'=>'ssh-rsa')) : false;
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($v['ip'],$v['port'], array('hostkey' => 'ssh-rsa')) : false;
|
||||
} else {
|
||||
$ssh2= @ssh2_connect($v['ip'],$v['port']);
|
||||
}
|
||||
@ -386,7 +386,7 @@ class rootServer {
|
||||
} else {
|
||||
foreach (explode('&',str_replace(array('&','?'), array('&',''),$requestString)) as $param) {
|
||||
$ex=explode('=',$param);
|
||||
if (isset($ex[1])) $postParams[$ex[0]]=$ex[1];
|
||||
if (isset($ex[1])) $postParams[$ex[0]] = $ex[1];
|
||||
}
|
||||
}
|
||||
webhostRequest($ex[0],'easy-wi.com',$file,$postParams,($this->ID['dedicated'][$a['id']]['https'] == 'Y') ? 443 : 80);
|
||||
@ -405,13 +405,13 @@ class rootServer {
|
||||
} else {
|
||||
$cleanedLine=preg_replace('/^[\s+]{1,}(.*?)$/','$1',preg_replace('/\s+/',' ',$split));
|
||||
if (strpos($split,'#')!==false) {
|
||||
$config[$subnet][$host]['comment'][]=$cleanedLine;
|
||||
$config[$subnet][$host]['comment'][] = $cleanedLine;
|
||||
} else {
|
||||
$ex=explode(' ',$cleanedLine);
|
||||
$v=$ex[count($ex)-1];
|
||||
unset($ex[count($ex)-1]);
|
||||
$k=implode(' ',$ex);
|
||||
$config[$subnet][$host][$k]=$v;
|
||||
$config[$subnet][$host][$k] = $v;
|
||||
}
|
||||
}
|
||||
} else if (preg_match('/^(\s+|)host[\s+]{1,}[\w\-\_]{1,}[\s+]{1,}[\{]$/',$split)) {
|
||||
@ -425,10 +425,10 @@ class rootServer {
|
||||
$subnetStart = true;
|
||||
$subnet=preg_replace('/^[\s+]{0,}subnet[\s+]{1,}(.*)[\s+]{1,}netmask[\s+]{1,}[\d]{1,3}.[\d]{1,3}.[\d]{1,3}\.[0][\s+]{0,}[\{]$/','\1',$split);
|
||||
} else {
|
||||
$doNotTouch[]=$split;
|
||||
$doNotTouch[] = $split;
|
||||
}
|
||||
}
|
||||
return array('raw'=>$doNotTouch,'subnet'=>$config);
|
||||
return array('raw' => $doNotTouch,'subnet' => $config);
|
||||
}
|
||||
private function assembleDhcpConfig ($array,$id) {
|
||||
$config = '';
|
||||
@ -458,7 +458,7 @@ class rootServer {
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport'], array('hostkey'=>'ssh-rsa')) : false;
|
||||
$ssh2=(file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport'], array('hostkey' => 'ssh-rsa')) : false;
|
||||
} else {
|
||||
$ssh2=@ssh2_connect($this->vmwareHosts[$hID]['vmIDs']['ip'],$this->vmwareHosts[$hID]['vmIDs']['dport']);
|
||||
}
|
||||
|
@ -73,13 +73,13 @@ class TS3 {
|
||||
$buffered .=$splitted[$i];
|
||||
$i++;
|
||||
}
|
||||
$splitted[1]=$buffered;
|
||||
$splitted[1] = $buffered;
|
||||
}
|
||||
if (!isset($splitted[1])) $splitted[1] = '';
|
||||
$index = trim(preg_replace('/\s+/','',$splitted[0]));
|
||||
if ($index!='error') $cvars[$index]=(isinteger(trim($splitted[1]))) ? (int)trim($splitted[1]) : trim($splitted[1]);
|
||||
}
|
||||
$return[]=$cvars;
|
||||
$return[] = $cvars;
|
||||
}
|
||||
} else {
|
||||
$return=$databody;
|
||||
@ -244,7 +244,7 @@ class TS3 {
|
||||
$permissioncount=$newcount;
|
||||
} else if ($newcount==$permissioncount) {
|
||||
if (isset($admingroupid) and is_array($admingroupid)) {
|
||||
$admingroupid[]=$servegroups['sgid'];
|
||||
$admingroupid[] = $servegroups['sgid'];
|
||||
} else {
|
||||
if (isset($admingroupid)) $admingroupid=array($admingroupid,$servegroups['sgid']);
|
||||
}
|
||||
@ -292,37 +292,37 @@ class TS3 {
|
||||
//https://github.com/easy-wi/developer/issues/74 check if array keys exists
|
||||
if (isset($serverdetails_query[0]) and ($serverdetails_query[0]['virtualserver_maxclients'])) {
|
||||
$serverdetails[$virtualserver_id]=array(
|
||||
'virtualserver_ip'=>$virtualserver_ip,
|
||||
'virtualserver_maxclients'=>$serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_port'=>$server['virtualserver_port'],
|
||||
'virtualserver_dns'=>$virtualserver_dns,
|
||||
'virtualserver_name'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_name']),
|
||||
'virtualserver_welcomemessage'=>$serverdetails_query[0]['virtualserver_welcomemessage'],
|
||||
'virtualserver_flag_password'=>$serverdetails_query[0]['virtualserver_flag_password'],
|
||||
'virtualserver_max_download_total_bandwidth'=>$serverdetails_query[0]['virtualserver_max_download_total_bandwidth'],
|
||||
'virtualserver_max_upload_total_bandwidth'=>$serverdetails_query[0]['virtualserver_max_upload_total_bandwidth'],
|
||||
'virtualserver_hostbanner_url'=>$serverdetails_query[0]['virtualserver_hostbanner_url'],
|
||||
'virtualserver_hostbanner_gfx_url'=>$serverdetails_query[0]['virtualserver_hostbanner_gfx_url'],
|
||||
'virtualserver_hostbutton_tooltip'=>$serverdetails_query[0]['virtualserver_hostbutton_tooltip'],
|
||||
'virtualserver_hostbutton_url'=>$serverdetails_query[0]['virtualserver_hostbutton_url'],
|
||||
'virtualserver_hostbutton_gfx_url'=>$serverdetails_query[0]['virtualserver_hostbutton_gfx_url']
|
||||
'virtualserver_ip' => $virtualserver_ip,
|
||||
'virtualserver_maxclients' => $serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_port' => $server['virtualserver_port'],
|
||||
'virtualserver_dns' => $virtualserver_dns,
|
||||
'virtualserver_name' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_name']),
|
||||
'virtualserver_welcomemessage' => $serverdetails_query[0]['virtualserver_welcomemessage'],
|
||||
'virtualserver_flag_password' => $serverdetails_query[0]['virtualserver_flag_password'],
|
||||
'virtualserver_max_download_total_bandwidth' => $serverdetails_query[0]['virtualserver_max_download_total_bandwidth'],
|
||||
'virtualserver_max_upload_total_bandwidth' => $serverdetails_query[0]['virtualserver_max_upload_total_bandwidth'],
|
||||
'virtualserver_hostbanner_url' => $serverdetails_query[0]['virtualserver_hostbanner_url'],
|
||||
'virtualserver_hostbanner_gfx_url' => $serverdetails_query[0]['virtualserver_hostbanner_gfx_url'],
|
||||
'virtualserver_hostbutton_tooltip' => $serverdetails_query[0]['virtualserver_hostbutton_tooltip'],
|
||||
'virtualserver_hostbutton_url' => $serverdetails_query[0]['virtualserver_hostbutton_url'],
|
||||
'virtualserver_hostbutton_gfx_url' => $serverdetails_query[0]['virtualserver_hostbutton_gfx_url']
|
||||
);
|
||||
} else {
|
||||
$serverdetails[$virtualserver_id]=array(
|
||||
'virtualserver_ip'=>$virtualserver_ip,
|
||||
'virtualserver_maxclients'=>$serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_port'=>$server['virtualserver_port'],
|
||||
'virtualserver_dns'=>$virtualserver_dns,
|
||||
'virtualserver_name'=>'',
|
||||
'virtualserver_welcomemessage'=>'',
|
||||
'virtualserver_flag_password'=>'',
|
||||
'virtualserver_max_download_total_bandwidth'=>'',
|
||||
'virtualserver_max_upload_total_bandwidth'=>'',
|
||||
'virtualserver_hostbanner_url'=>'',
|
||||
'virtualserver_hostbanner_gfx_url'=>'',
|
||||
'virtualserver_hostbutton_tooltip'=>'',
|
||||
'virtualserver_hostbutton_url'=>'',
|
||||
'virtualserver_hostbutton_gfx_url'=>''
|
||||
'virtualserver_ip' => $virtualserver_ip,
|
||||
'virtualserver_maxclients' => $serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_port' => $server['virtualserver_port'],
|
||||
'virtualserver_dns' => $virtualserver_dns,
|
||||
'virtualserver_name' => '',
|
||||
'virtualserver_welcomemessage' => '',
|
||||
'virtualserver_flag_password' => '',
|
||||
'virtualserver_max_download_total_bandwidth' => '',
|
||||
'virtualserver_max_upload_total_bandwidth' => '',
|
||||
'virtualserver_hostbanner_url' => '',
|
||||
'virtualserver_hostbanner_gfx_url' => '',
|
||||
'virtualserver_hostbutton_tooltip' => '',
|
||||
'virtualserver_hostbutton_url' => '',
|
||||
'virtualserver_hostbutton_gfx_url' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -333,20 +333,20 @@ class TS3 {
|
||||
$virtualserver_ip=(isset($virtualserver_ip)) ? $virtualserver_ip :'';
|
||||
$virtualserver_dns=(isset($virtualserver_dns)) ? $virtualserver_dns :'';
|
||||
$serverdetails[$virtualserver_id]=array(
|
||||
'virtualserver_ip'=>$virtualserver_ip,
|
||||
'virtualserver_maxclients'=>$server['virtualserver_maxclients'],
|
||||
'virtualserver_port'=>$server['virtualserver_port'],
|
||||
'virtualserver_dns'=>$virtualserver_dns,
|
||||
'virtualserver_name'=>'',
|
||||
'virtualserver_welcomemessage'=>'',
|
||||
'virtualserver_flag_password'=>'',
|
||||
'virtualserver_max_download_total_bandwidth'=>'',
|
||||
'virtualserver_max_upload_total_bandwidth'=>'',
|
||||
'virtualserver_hostbanner_url'=>'',
|
||||
'virtualserver_hostbanner_gfx_url'=>'',
|
||||
'virtualserver_hostbutton_tooltip'=>'',
|
||||
'virtualserver_hostbutton_url'=>'',
|
||||
'virtualserver_hostbutton_gfx_url'=>''
|
||||
'virtualserver_ip' => $virtualserver_ip,
|
||||
'virtualserver_maxclients' => $server['virtualserver_maxclients'],
|
||||
'virtualserver_port' => $server['virtualserver_port'],
|
||||
'virtualserver_dns' => $virtualserver_dns,
|
||||
'virtualserver_name' => '',
|
||||
'virtualserver_welcomemessage' => '',
|
||||
'virtualserver_flag_password' => '',
|
||||
'virtualserver_max_download_total_bandwidth' => '',
|
||||
'virtualserver_max_upload_total_bandwidth' => '',
|
||||
'virtualserver_hostbanner_url' => '',
|
||||
'virtualserver_hostbanner_gfx_url' => '',
|
||||
'virtualserver_hostbutton_tooltip' => '',
|
||||
'virtualserver_hostbutton_url' => '',
|
||||
'virtualserver_hostbutton_gfx_url' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -356,7 +356,7 @@ class TS3 {
|
||||
public function ServerList () {
|
||||
$serverdetails = array();
|
||||
$array=$this->SendCommand('serverlist');
|
||||
if (is_array($array) or is_object($array)) foreach ($array as $k=>$v) $serverdetails[$k]=$this->ReplaceFromTS3($v);
|
||||
if (is_array($array) or is_object($array)) foreach ($array as $k=>$v) $serverdetails[$k] = $this->ReplaceFromTS3($v);
|
||||
if ($this->debug==true){
|
||||
print "ServerList:";
|
||||
print_r($serverdetails);
|
||||
@ -365,39 +365,39 @@ class TS3 {
|
||||
return $serverdetails;
|
||||
}
|
||||
public function ServerDetails ($virtualserver_id) {
|
||||
$serverdetails=array('virtualserver_name'=>'','virtualserver_welcomemessage'=>'','virtualserver_hostbanner_url'=>'','virtualserver_hostbanner_gfx_url'=>'','virtualserver_hostbutton_tooltip'=>'','virtualserver_hostbutton_url'=>'','virtualserver_hostbutton_gfx_url'=>'','virtualserver_maxclients'=>'','virtualserver_flag_password'=>'','virtualserver_max_download_total_bandwidth'=>'','virtualserver_max_upload_total_bandwidth'=>'','virtualserver_clientsonline'=>0,'virtualserver_queryclientsonline'=>0,'virtualserver_uptime'=>20,'virtualserver_status'=>'','connection_filetransfer_bytes_sent_total'=>'','connection_filetransfer_bytes_received_total'=>'','connection_bytes_sent_total'=>'','connection_bytes_received_total'=>'');
|
||||
$serverdetails=array('virtualserver_name' => '','virtualserver_welcomemessage' => '','virtualserver_hostbanner_url' => '','virtualserver_hostbanner_gfx_url' => '','virtualserver_hostbutton_tooltip' => '','virtualserver_hostbutton_url' => '','virtualserver_hostbutton_gfx_url' => '','virtualserver_maxclients' => '','virtualserver_flag_password' => '','virtualserver_max_download_total_bandwidth' => '','virtualserver_max_upload_total_bandwidth' => '','virtualserver_clientsonline'=>0,'virtualserver_queryclientsonline'=>0,'virtualserver_uptime'=>20,'virtualserver_status' => '','connection_filetransfer_bytes_sent_total' => '','connection_filetransfer_bytes_received_total' => '','connection_bytes_sent_total' => '','connection_bytes_received_total' => '');
|
||||
$useserver=$this->UseServer($virtualserver_id);
|
||||
if (isset($useserver[0]['msg']) and strtolower($useserver[0]['msg'])==strtolower('ok')) {
|
||||
$serverdetails_query=$this->SendCommand('serverinfo');
|
||||
$serverdetails=array(
|
||||
'virtualserver_name'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_name']),
|
||||
'virtualserver_welcomemessage'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_welcomemessage']),
|
||||
'virtualserver_hostbanner_url'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbanner_url']),
|
||||
'virtualserver_hostbanner_gfx_url'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbanner_gfx_url']),
|
||||
'virtualserver_hostbutton_tooltip'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_tooltip']),
|
||||
'virtualserver_hostbutton_url'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_url']),
|
||||
'virtualserver_hostbutton_gfx_url'=>$this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_gfx_url']),
|
||||
'virtualserver_maxclients'=>$serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_flag_password'=>$serverdetails_query[0]['virtualserver_flag_password'],
|
||||
'virtualserver_max_download_total_bandwidth'=>$serverdetails_query[0]['virtualserver_max_download_total_bandwidth'],
|
||||
'virtualserver_max_upload_total_bandwidth'=>$serverdetails_query[0]['virtualserver_max_upload_total_bandwidth'],
|
||||
'virtualserver_clientsonline'=>$serverdetails_query[0]['virtualserver_clientsonline'],
|
||||
'virtualserver_queryclientsonline'=>$serverdetails_query[0]['virtualserver_queryclientsonline'],
|
||||
'virtualserver_uptime'=>$serverdetails_query[0]['virtualserver_uptime'],
|
||||
'virtualserver_status'=>$serverdetails_query[0]['virtualserver_status'],
|
||||
'connection_filetransfer_bytes_sent_total'=>$serverdetails_query[0]['connection_filetransfer_bytes_sent_total'],
|
||||
'connection_filetransfer_bytes_received_total'=>$serverdetails_query[0]['connection_filetransfer_bytes_received_total'],
|
||||
'connection_bytes_sent_total'=>$serverdetails_query[0]['connection_bytes_sent_total'],
|
||||
'connection_bytes_received_total'=>$serverdetails_query[0]['connection_bytes_received_total'],
|
||||
'virtualserver_name' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_name']),
|
||||
'virtualserver_welcomemessage' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_welcomemessage']),
|
||||
'virtualserver_hostbanner_url' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbanner_url']),
|
||||
'virtualserver_hostbanner_gfx_url' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbanner_gfx_url']),
|
||||
'virtualserver_hostbutton_tooltip' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_tooltip']),
|
||||
'virtualserver_hostbutton_url' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_url']),
|
||||
'virtualserver_hostbutton_gfx_url' => $this->ReplaceFromTS3($serverdetails_query[0]['virtualserver_hostbutton_gfx_url']),
|
||||
'virtualserver_maxclients' => $serverdetails_query[0]['virtualserver_maxclients'],
|
||||
'virtualserver_flag_password' => $serverdetails_query[0]['virtualserver_flag_password'],
|
||||
'virtualserver_max_download_total_bandwidth' => $serverdetails_query[0]['virtualserver_max_download_total_bandwidth'],
|
||||
'virtualserver_max_upload_total_bandwidth' => $serverdetails_query[0]['virtualserver_max_upload_total_bandwidth'],
|
||||
'virtualserver_clientsonline' => $serverdetails_query[0]['virtualserver_clientsonline'],
|
||||
'virtualserver_queryclientsonline' => $serverdetails_query[0]['virtualserver_queryclientsonline'],
|
||||
'virtualserver_uptime' => $serverdetails_query[0]['virtualserver_uptime'],
|
||||
'virtualserver_status' => $serverdetails_query[0]['virtualserver_status'],
|
||||
'connection_filetransfer_bytes_sent_total' => $serverdetails_query[0]['connection_filetransfer_bytes_sent_total'],
|
||||
'connection_filetransfer_bytes_received_total' => $serverdetails_query[0]['connection_filetransfer_bytes_received_total'],
|
||||
'connection_bytes_sent_total' => $serverdetails_query[0]['connection_bytes_sent_total'],
|
||||
'connection_bytes_received_total' => $serverdetails_query[0]['connection_bytes_received_total'],
|
||||
|
||||
# Ticket https://github.com/easy-wi/developer/issues/13 "Bearbeiten von TS3 Servern im Usermodul erweitern"
|
||||
'virtualserver_reserved_slots'=>$serverdetails_query[0]['virtualserver_reserved_slots'],
|
||||
'virtualserver_needed_identity_security_level'=>$serverdetails_query[0]['virtualserver_needed_identity_security_level'],
|
||||
'virtualserver_hostmessage_mode'=>$serverdetails_query[0]['virtualserver_hostmessage_mode'],
|
||||
'virtualserver_hostbanner_gfx_interval'=>$serverdetails_query[0]['virtualserver_hostbanner_gfx_interval'],
|
||||
'virtualserver_antiflood_points_tick_reduce'=>$serverdetails_query[0]['virtualserver_antiflood_points_tick_reduce'],
|
||||
'virtualserver_antiflood_points_needed_command_block'=>$serverdetails_query[0]['virtualserver_antiflood_points_needed_command_block'],
|
||||
'virtualserver_antiflood_points_needed_ip_block'=>$serverdetails_query[0]['virtualserver_antiflood_points_needed_ip_block']
|
||||
'virtualserver_reserved_slots' => $serverdetails_query[0]['virtualserver_reserved_slots'],
|
||||
'virtualserver_needed_identity_security_level' => $serverdetails_query[0]['virtualserver_needed_identity_security_level'],
|
||||
'virtualserver_hostmessage_mode' => $serverdetails_query[0]['virtualserver_hostmessage_mode'],
|
||||
'virtualserver_hostbanner_gfx_interval' => $serverdetails_query[0]['virtualserver_hostbanner_gfx_interval'],
|
||||
'virtualserver_antiflood_points_tick_reduce' => $serverdetails_query[0]['virtualserver_antiflood_points_tick_reduce'],
|
||||
'virtualserver_antiflood_points_needed_command_block' => $serverdetails_query[0]['virtualserver_antiflood_points_needed_command_block'],
|
||||
'virtualserver_antiflood_points_needed_ip_block' => $serverdetails_query[0]['virtualserver_antiflood_points_needed_ip_block']
|
||||
);
|
||||
if ($this->debug==true){
|
||||
print "Serverdetails:";
|
||||
@ -438,7 +438,7 @@ class TS3 {
|
||||
$permissioncount=$newcount;
|
||||
} else if ($newcount==$permissioncount) {
|
||||
if (isset($admingroupid) and is_array($admingroupid)) {
|
||||
$admingroupid[]=$servegroups['sgid'];
|
||||
$admingroupid[] = $servegroups['sgid'];
|
||||
} else {
|
||||
if (isset($admingroupid)) $admingroupid=array($admingroupid,$servegroups['sgid']);
|
||||
}
|
||||
@ -459,7 +459,7 @@ class TS3 {
|
||||
$cldbid=$userid['cldbid'];
|
||||
$userdata=$this->SendCommand("clientdbinfo cldbid=".$cldbid);
|
||||
$client_unique_identifier=$this->ReplaceFromTS3($userdata[0]['client_unique_identifier']);
|
||||
$adminlist[$cldbid]=$client_unique_identifier;
|
||||
$adminlist[$cldbid] = $client_unique_identifier;
|
||||
}
|
||||
} else {
|
||||
$adminlist = array();
|
||||
@ -473,11 +473,11 @@ class TS3 {
|
||||
$return = array();
|
||||
$servergroups=$this->SendCommand('servergrouplist');
|
||||
foreach ($servergroups as $servergroup) {
|
||||
if ($servergroup['type']==1) $admingroupid[$servergroup['sgid']]=$this->ReplaceFromTS3($servergroup['name']);
|
||||
if ($servergroup['type']==1) $admingroupid[$servergroup['sgid']] = $this->ReplaceFromTS3($servergroup['name']);
|
||||
}
|
||||
$this->SendCommand("privilegekeylist");
|
||||
foreach ($this->SendCommand("privilegekeylist") as $key) {
|
||||
if (isset($key['token_type']) and $key['token_type']==0 and isset($admingroupid)) $return[]=array('token'=>$key['token'],'groupname'=>$this->ReplaceFromTS3($admingroupid[$key['token_id1']]));
|
||||
if (isset($key['token_type']) and $key['token_type']==0 and isset($admingroupid)) $return[]=array('token' => $key['token'],'groupname' => $this->ReplaceFromTS3($admingroupid[$key['token_id1']]));
|
||||
}
|
||||
} else {
|
||||
$return=$useserver[0]['msg'];
|
||||
@ -538,7 +538,7 @@ class TS3 {
|
||||
if (isset($useserver[0]['msg']) and strtolower($useserver[0]['msg'])==strtolower('ok')) {
|
||||
$servergroups=$this->SendCommand('servergrouplist');
|
||||
foreach ($servergroups as $servergroup) {
|
||||
$return[]=array('id'=>$servergroup['sgid'],'name'=>$this->ReplaceFromTS3($servergroup['name']),'type'=>$servergroup['type']);
|
||||
$return[]=array('id' => $servergroup['sgid'],'name' => $this->ReplaceFromTS3($servergroup['name']),'type' => $servergroup['type']);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
@ -574,7 +574,7 @@ class TS3 {
|
||||
foreach ($channelList as $channel) {
|
||||
if (isset($channel['cid']) and isid($channel['cid'],30)) {
|
||||
$props=$this->SendCommand('channelinfo cid='.$channel['cid']);
|
||||
if (isset($props[0]['channel_name'])) $channels[$this->ReplaceFromTS3($props[0]['channel_name'])]=$this->ReplaceFromTS3($props[0]['channel_filepath']);
|
||||
if (isset($props[0]['channel_name'])) $channels[$this->ReplaceFromTS3($props[0]['channel_name'])] = $this->ReplaceFromTS3($props[0]['channel_filepath']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -595,7 +595,7 @@ function tsbackup ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$noti
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($sship,$sshport, array('hostkey'=>'ssh-rsa'));
|
||||
$ssh2= @ssh2_connect($sship,$sshport, array('hostkey' => 'ssh-rsa'));
|
||||
} else {
|
||||
$ssh2 = false;
|
||||
}
|
||||
@ -677,7 +677,7 @@ function tsdns ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notifie
|
||||
$pubkey=EASYWIDIR."/keys/".$sshkey.".pub";
|
||||
$key=EASYWIDIR."/keys/".$sshkey;
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($sship,$sshport, array('hostkey'=>'ssh-rsa'));
|
||||
$ssh2= @ssh2_connect($sship,$sshport, array('hostkey' => 'ssh-rsa'));
|
||||
} else {
|
||||
$ssh2 = false;
|
||||
}
|
||||
@ -762,7 +762,7 @@ function tsdns ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notifie
|
||||
$ca = array();
|
||||
foreach (preg_split('/\n/',$data,-1,PREG_SPLIT_NO_EMPTY) as $configLine) {
|
||||
if ($action!='li' and $configLine!="$olddns=$oldip:$oldport" and $configLine!="$newdns=$newip:$newport") {
|
||||
$ca[]=$configLine."\r\n";
|
||||
$ca[] = $configLine."\r\n";
|
||||
} else if ($action == 'md' and $edited==false and ($configLine=="$olddns=$oldip:$oldport" or $configLine=="$newdns=$newip:$newport")) {
|
||||
$edited = true;
|
||||
$ca[]="$newdns=$newip:$newport\r\n";
|
||||
@ -772,7 +772,7 @@ function tsdns ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notifie
|
||||
if (isset($dnsconfig[1])) {
|
||||
$linedns=$dnsconfig[0];
|
||||
$lineserver=$dnsconfig[1];
|
||||
$dnsarray[$lineserver]=$linedns;
|
||||
$dnsarray[$lineserver] = $linedns;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -803,25 +803,25 @@ function tsdns ($action,$sship,$sshport,$sshuser,$keyuse,$sshkey,$sshpw,$notifie
|
||||
if ($configLine!='' and !preg_match('/^#(|\s+)(.*)$/',$configLine)) {
|
||||
$splittedLine=preg_split('/\=/',$configLine,-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($splittedLine[1])) {
|
||||
$usedIPs[]=array('dns'=>$splittedLine[0],'address'=>$splittedLine[1]);
|
||||
$usedIPs[]=array('dns' => $splittedLine[0],'address' => $splittedLine[1]);
|
||||
} else {
|
||||
$usedIPs[]=$configLine;
|
||||
$usedIPs[] = $configLine;
|
||||
}
|
||||
} else {
|
||||
$usedIPs[]=$configLine;
|
||||
$usedIPs[] = $configLine;
|
||||
}
|
||||
}
|
||||
foreach ($tsip as $newLine) {
|
||||
$splittedLine=preg_split('/\=/',strtolower($newLine),-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($splittedLine[1]) and !array_key_exists($splittedLine[1],$usedIPs)) {
|
||||
$usedIPs[]=array('dns'=>$splittedLine[0],'address'=>$splittedLine[1]);
|
||||
$usedIPs[]=array('dns' => $splittedLine[0],'address' => $splittedLine[1]);
|
||||
}
|
||||
}
|
||||
function array_multi_dimensional_unique($multi){
|
||||
$unique = array();
|
||||
foreach($multi as $sub){
|
||||
if(!in_array($sub,$unique)){
|
||||
$unique[]=$sub;
|
||||
$unique[] = $sub;
|
||||
}
|
||||
}
|
||||
return $unique;
|
||||
@ -919,8 +919,8 @@ function checkDNS ($dns,$id=null,$user_id=null,$type='') {
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['externalDefaultDNS'] == 'N') {
|
||||
if ($type == 'server' and $id != null and $row['id']==$masterID) {
|
||||
$defaultdns=strtolower($id.'.'.$row['defaultdns']);
|
||||
if ($type == 'server' and $id != null and $row['id'] == $masterID) {
|
||||
$defaultdns=strtolower($id . '.' . $row['defaultdns']);
|
||||
$partCount=count(explode('.',$defaultdns));
|
||||
}
|
||||
unset($temp);
|
||||
@ -928,22 +928,22 @@ function checkDNS ($dns,$id=null,$user_id=null,$type='') {
|
||||
$i=count($ex)-1;
|
||||
while ($i>=0) {
|
||||
if (isset($temp)) {
|
||||
$temp=$ex[$i].'.'.$temp;
|
||||
$temp=$ex[$i] . '.' . $temp;
|
||||
} else {
|
||||
$temp=$ex[$i];
|
||||
}
|
||||
$serverdnsArray[]=$temp;
|
||||
$serverdnsArray[] = $temp;
|
||||
$i--;
|
||||
}
|
||||
} else if ($type == 'server' and $row['externalDefaultDNS'] == 'Y' and $id != null and $row['id']==$masterID) {
|
||||
} else if ($type == 'server' and $row['externalDefaultDNS'] == 'Y' and $id != null and $row['id'] == $masterID) {
|
||||
$tsdnsServerID=$row['tsdnsServerID'];
|
||||
}
|
||||
}
|
||||
$query = $sql->prepare("SELECT `id`,`defaultdns` FROM `voice_tsdns` WHERE `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ((isset($tsdnsServerID) and $id != null and $row['id']==$tsdnsServerID) or ($type == 'dns' and $id != null and $row['id']==$masterID)) {
|
||||
$defaultdns=strtolower($id . '-' . getusername($user_id).'.'.$row['defaultdns']);
|
||||
if ((isset($tsdnsServerID) and $id != null and $row['id'] == $tsdnsServerID) or ($type == 'dns' and $id != null and $row['id'] == $masterID)) {
|
||||
$defaultdns=strtolower($id . '-' . getusername($user_id) . '.' . $row['defaultdns']);
|
||||
$partCount=count(explode('.',$defaultdns));
|
||||
}
|
||||
unset($temp);
|
||||
@ -951,11 +951,11 @@ function checkDNS ($dns,$id=null,$user_id=null,$type='') {
|
||||
$i=count($ex)-1;
|
||||
while ($i>=0) {
|
||||
if (isset($temp)) {
|
||||
$temp=$ex[$i].'.'.$temp;
|
||||
$temp=$ex[$i] . '.' . $temp;
|
||||
} else {
|
||||
$temp=$ex[$i];
|
||||
}
|
||||
$serverdnsArray[]=$temp;
|
||||
$serverdnsArray[] = $temp;
|
||||
$i--;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = $spracheResponse->token;
|
||||
} else if (!$ui->w('action', 4, 'post')) {
|
||||
$pselect=$sql->prepare("SELECT `active`,`ip`,AES_DECRYPT(`port`,:aeskey) AS `dport`,AES_DECRYPT(`user`,:aeskey) AS `duser`,AES_DECRYPT(`pass`,:aeskey) AS `dpass`,`publickey`,`keyname`,`cfgdir`,`normal_3`,`normal_4`,`hlds_3`,`hlds_4`,`hlds_5`,`hlds_6` FROM `eac` WHERE resellerid=:reseller_id LIMIT 1");
|
||||
$pselect->execute(array(':aeskey'=>$aeskey,':reseller_id'=>$reseller_id));
|
||||
$pselect->execute(array(':aeskey' => $aeskey,':reseller_id' => $reseller_id));
|
||||
foreach ($pselect->fetchAll() as $row) {
|
||||
$eac_active=$row['active'];
|
||||
$eac_ip=$row['ip'];
|
||||
@ -135,7 +135,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$pass=startparameter($ui->post['pass']);
|
||||
$cfgdir=folder($ui->post['cfgdir']);
|
||||
$pupdate=$sql->prepare("UPDATE `eac` SET `active`=:active,`ip`=:ip,`port`=AES_ENCRYPT(:port, :aeskey),`user`=AES_ENCRYPT(:user, :aeskey),`pass`=AES_ENCRYPT(:pass, :aeskey),`publickey`=:publickey,`keyname`=:keyname,`cfgdir`=:cfgdir,`normal_3`=:normal_3,`normal_4`=:normal_4,`hlds_3`=:hlds_3,`hlds_4`=:hlds_4,`hlds_5`=:hlds_5,`hlds_6`=:hlds_6 WHERE resellerid=:reseller_id");
|
||||
$pupdate->execute(array(':active'=>$active,':ip'=>$ip,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':publickey'=>$publickey,':keyname'=>$keyname,':cfgdir'=>$cfgdir,':normal_3'=>$normal_3,':normal_4'=>$normal_4,':hlds_3'=>$hlds_3,':hlds_4'=>$hlds_4,':hlds_5'=>$hlds_5,':hlds_6'=>$hlds_6,':reseller_id'=>$reseller_id));
|
||||
$pupdate->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':cfgdir' => $cfgdir,':normal_3' => $normal_3,':normal_4' => $normal_4,':hlds_3' => $hlds_3,':hlds_4' => $hlds_4,':hlds_5' => $hlds_5,':hlds_6' => $hlds_6,':reseller_id' => $reseller_id));
|
||||
$template_file = $spracheResponse->table_add;
|
||||
$loguseraction="%mod% %eac%";
|
||||
$insertlog->execute();
|
||||
|
@ -269,7 +269,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgAlt='Inactive';
|
||||
}
|
||||
$twitter=($row['twitter'] == 'Y') ? $gsprache->yes : $gsprache->no;
|
||||
$table[]=array('id'=>$row['feedID'],'img'=>$imgName,'alt'=>$imgAlt,'twitter'=>$twitter,'feedUrl'=>$row['feedUrl'],'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['feedID'],'img' => $imgName,'alt' => $imgAlt,'twitter' => $twitter,'feedUrl' => $row['feedUrl'],'active' => $row['active']);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT COUNT(`feedID`) AS `amount` FROM `feeds_url` WHERE `resellerID`=?");
|
||||
@ -298,7 +298,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -112,7 +112,7 @@ if ($ui->st('d','get') == 'ud') {
|
||||
$twitter=($row['twitter'] == 'Y') ? $gsprache->yes : $gsprache->no;
|
||||
$title=$row['title'];
|
||||
if (strlen($row['title'])<=1) $title=$row['link'];
|
||||
$table[]=array('id'=>$row['newsID'],'active'=>$row['active'],'img'=>$imgName,'alt'=>$imgAlt,'pubDate'=>$row['pubDate'],'twitter'=>$twitter,'title'=>$title,'link'=>$row['link'],'feedUrl'=>$row['feedUrl']);
|
||||
$table[]=array('id' => $row['newsID'],'active' => $row['active'],'img' => $imgName,'alt' => $imgAlt,'pubDate' => $row['pubDate'],'twitter' => $twitter,'title' => $title,'link' => $row['link'],'feedUrl' => $row['feedUrl']);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$query = $sql->prepare("SELECT COUNT(`newsID`) AS `amount` FROM `feeds_news` WHERE `resellerID`=?");
|
||||
@ -141,7 +141,7 @@ if ($ui->st('d','get') == 'ud') {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -66,7 +66,7 @@ if (isset($newsInclude) and $newsInclude==true) {
|
||||
$theCount = 0;
|
||||
foreach ($json->appnews->newsitems as $item) {
|
||||
if ($item->is_external_url==false and $theCount<$newsAmount) {
|
||||
$steamNews[$lookUpAppID][]=array('title'=>$item->title,'description'=>$item->contents,'link'=>$item->url,'pubDate'=>date('Y-m-d H:i:s',$item->date),'content'=>$lookUpAppID,'author'=>$item->author,'creator'=>$item->author);
|
||||
$steamNews[$lookUpAppID][]=array('title' => $item->title,'description' => $item->contents,'link' => $item->url,'pubDate'=>date('Y-m-d H:i:s',$item->date),'content' => $lookUpAppID,'author' => $item->author,'creator' => $item->author);
|
||||
$theCount++;
|
||||
}
|
||||
}
|
||||
@ -94,7 +94,7 @@ if (isset($newsInclude) and $newsInclude==true) {
|
||||
foreach ($steamNews as $news) {
|
||||
$i = 0;
|
||||
while ($i<count($news) and $i<=$newsAmount) {
|
||||
$feedsArray[0][]=$news[$i];
|
||||
$feedsArray[0][] = $news[$i];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -111,7 +111,7 @@ if (isset($newsInclude) and $newsInclude==true) {
|
||||
$theCount = 0;
|
||||
foreach ($json->appnews->newsitems as $item) {
|
||||
if ($item->is_external_url==false and $theCount<$newsAmount) {
|
||||
$feedsArray[0][]=array('title'=>$item->title,'description'=>$item->contents,'link'=>$item->url,'pubDate'=>date('Y-m-d H:i:s',$item->date),'content'=>$lookUpAppID,'author'=>$item->author,'creator'=>$item->author);
|
||||
$feedsArray[0][]=array('title' => $item->title,'description' => $item->contents,'link' => $item->url,'pubDate'=>date('Y-m-d H:i:s',$item->date),'content' => $lookUpAppID,'author' => $item->author,'creator' => $item->author);
|
||||
$theCount++;
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ if (isset($newsInclude) and $newsInclude==true) {
|
||||
$content = '';
|
||||
$author=$tweet->user->name;
|
||||
$creator=$tweet->user->name;
|
||||
$feedsArray[$feedID][]=array('title'=>$feedTitle,'description'=>$description,'link'=>$link,'pubDate'=>$pubDate,'content'=>$content,'author'=>$author,'creator'=>$creator);
|
||||
$feedsArray[$feedID][]=array('title' => $feedTitle,'description' => $description,'link' => $link,'pubDate' => $pubDate,'content' => $content,'author' => $author,'creator' => $creator);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -259,7 +259,7 @@ if (isset($newsInclude) and $newsInclude==true) {
|
||||
$description=base64_decode($description);
|
||||
}
|
||||
if($theCount<$newsAmount) {
|
||||
$feedsArray[$feedID][]=array('title'=>$feedTitle,'description'=>$description,'link'=>$link,'pubDate'=>$pubDate,'content'=>$content,'author'=>$author,'creator'=>$creator);
|
||||
$feedsArray[$feedID][]=array('title' => $feedTitle,'description' => $description,'link' => $link,'pubDate' => $pubDate,'content' => $content,'author' => $author,'creator' => $creator);
|
||||
}
|
||||
$theCount++;
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ if ($ui->st('d','get') == 'pw') {
|
||||
$template_file = ($logusertype == 'user') ? 'userpanel_pass.tpl' : 'admin_user_own_pass.tpl';
|
||||
} else if ($ui->smallletters('action',2,'post') == 'md'){
|
||||
$errors = array();
|
||||
if (!$ui->password('password', 255, 'post')) $errors[]=$sprache->error_pass;
|
||||
if (!$ui->password('pass2', 255, 'post')) $errors[]=$sprache->error_pas;
|
||||
if ($ui->password('password', 255, 'post') != $ui->password('pass2', 255, 'post')) $errors[]=$sprache->error_passw_succ;
|
||||
if (!token(true)) $errors[]=$spracheResponse->token;
|
||||
if (!$ui->password('password', 255, 'post')) $errors[] = $sprache->error_pass;
|
||||
if (!$ui->password('pass2', 255, 'post')) $errors[] = $sprache->error_pas;
|
||||
if ($ui->password('password', 255, 'post') != $ui->password('pass2', 255, 'post')) $errors[] = $sprache->error_passw_succ;
|
||||
if (!token(true)) $errors[] = $spracheResponse->token;
|
||||
if (count($errors)>0) {
|
||||
$template_file = implode('<br />',$errors);
|
||||
} else {
|
||||
@ -126,7 +126,7 @@ if ($ui->st('d','get') == 'pw') {
|
||||
|
||||
#https://github.com/easy-wi/developer/issues/5
|
||||
$oldValues = array();
|
||||
foreach ($row as $k=>$v) $oldValues[$k]=$v;
|
||||
foreach ($row as $k=>$v) $oldValues[$k] = $v;
|
||||
}
|
||||
if ($ui->smallletters('action',2,'post') == 'md' and isset($oldValues)){
|
||||
if ($ui->ismail('mail','post') and token(true)) {
|
||||
@ -155,7 +155,7 @@ if ($ui->st('d','get') == 'pw') {
|
||||
if($query->rowCount()>0) {
|
||||
#https://github.com/easy-wi/developer/issues/5
|
||||
$changed = array();
|
||||
foreach ($oldValues as $k=>$v) if (isset($$k) and "{$$k}" != $v) $changed[$k]=$v;
|
||||
foreach ($oldValues as $k=>$v) if (isset($$k) and "{$$k}" != $v) $changed[$k] = $v;
|
||||
$query = $sql->prepare("INSERT INTO `userdata_value_log` (`userID`,`date`,`json`,`resellerID`) VALUES (?,NOW(),?,?)");
|
||||
$query->execute(array($lookUpID,json_encode($changed),$reseller_id));
|
||||
|
||||
|
@ -96,20 +96,20 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
} else {
|
||||
$percenserver = 0;
|
||||
}
|
||||
$serverusage[$rootid]=array('slots'=>$percentslots,'server'=>$percenserver);
|
||||
$serverusage[$rootid]=array('slots' => $percentslots,'server' => $percenserver);
|
||||
if (!isset($i)) $i = 0;
|
||||
if (!isset($available)) $available = 0;
|
||||
$ips=array($row['ip']);
|
||||
foreach (ipstoarray($row['altips']) as $ip) {
|
||||
$ips[] = $ip;
|
||||
}
|
||||
$table2[]=array('id'=>$rootid,'ip'=>implode(' / ', array_unique($ips)));
|
||||
$table2[]=array('id' => $rootid,'ip'=>implode(' / ', array_unique($ips)));
|
||||
}
|
||||
$query = $sql->prepare("SELECT s.`description`,s.`shorten` FROM `servertypes` s WHERE s.`resellerid`=? AND EXISTS (SELECT m.`id` FROM `rservermasterg` m WHERE m.`servertypeid`=s.`id` LIMIT 1) ORDER BY s.`description` ASC");
|
||||
$query->execute(array($reseller_id));
|
||||
$table3 = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table3[]=array('shorten'=>$row['shorten'],'description'=>$row['description']);
|
||||
$table3[]=array('shorten' => $row['shorten'],'description' => $row['description']);
|
||||
}
|
||||
$installedserver = 0;
|
||||
$maxserver = 0;
|
||||
@ -183,7 +183,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
} else {
|
||||
$upload = 0;
|
||||
}
|
||||
$table[]=array('description'=>$row['description'],'id'=>$row['id'],'steamgame'=>$row['steamgame'],'shorten'=>$shorten,'gamebinary'=>$row['gamebinary'],'binarydir'=>$row['binarydir'],'modfolder'=>$row['modfolder'],'fps'=>$row['fps'],'slots'=>$row['slots'],'map'=>$row['map'],'mapGroup'=>$row['mapGroup'],'cmd'=>$cmd,'tic'=>$row['tic'],'upload'=>$upload,'qstat'=>$qstat,'installing'=>$installing);
|
||||
$table[]=array('description' => $row['description'],'id' => $row['id'],'steamgame' => $row['steamgame'],'shorten' => $shorten,'gamebinary' => $row['gamebinary'],'binarydir' => $row['binarydir'],'modfolder' => $row['modfolder'],'fps' => $row['fps'],'slots' => $row['slots'],'map' => $row['map'],'mapGroup' => $row['mapGroup'],'cmd' => $cmd,'tic' => $row['tic'],'upload' => $upload,'qstat' => $qstat,'installing' => $installing);
|
||||
$i++;
|
||||
}
|
||||
if ($query->rowcount()==0) {
|
||||
@ -521,7 +521,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
$query = $sql->prepare("SELECT s.`id`,t.`description`,t.`shorten` FROM `serverlist` s LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=? AND s.`resellerid`=?");
|
||||
$query->execute(array($server_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('id'=>$row['id'],'description'=>$row['description'],'shorten'=>$row['shorten']);
|
||||
$table[]=array('id' => $row['id'],'description' => $row['description'],'shorten' => $row['shorten']);
|
||||
}
|
||||
if (isset($serverip) and isset($port)) {
|
||||
$template_file = 'admin_gserver_dl.tpl';
|
||||
@ -682,7 +682,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
}
|
||||
$gamestringtemp .= "_$shorten";
|
||||
$cmd=stripslashes($row2['cmd']);
|
||||
$table[]=array('id'=>$row2['id'],'shorten'=>$row2['shorten'],'description'=>$row2['description'],'gamebinary'=>$row2['gamebinary'],'binarydir'=>$row2['binarydir'],'modfolder'=>$row2['modfolder'],'fps'=>$row2['fps'],'map'=>$row2['map'],'mapGroup'=>$row2['mapGroup'],'cmd'=>$cmd,'tic'=>$row2['tic'],'qstat'=>$qstat,'upload'=>$upload,'uploaddir'=>$uploaddir,'userfps'=>$row2['userfps'],'usertick'=>$row2['usertick'],'usermap'=>$row2['usermap'],'user_uploaddir'=>$row2['user_uploaddir'],'owncmd'=>$row2['owncmd'],'style'=>$style);
|
||||
$table[]=array('id' => $row2['id'],'shorten' => $row2['shorten'],'description' => $row2['description'],'gamebinary' => $row2['gamebinary'],'binarydir' => $row2['binarydir'],'modfolder' => $row2['modfolder'],'fps' => $row2['fps'],'map' => $row2['map'],'mapGroup' => $row2['mapGroup'],'cmd' => $cmd,'tic' => $row2['tic'],'qstat' => $qstat,'upload' => $upload,'uploaddir' => $uploaddir,'userfps' => $row2['userfps'],'usertick' => $row2['usertick'],'usermap' => $row2['usermap'],'user_uploaddir' => $row2['user_uploaddir'],'owncmd' => $row2['owncmd'],'style' => $style);
|
||||
$i++;
|
||||
}
|
||||
$gamestring = $i.$gamestringtemp;
|
||||
@ -833,14 +833,14 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
$usedcores=implode(',',$usedcores);
|
||||
$template_file = '';
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `id`!=:switchID AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port_new,':switchID'=>$server_id,':serverip'=>$serverip_new,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port_new,':switchID' => $server_id,':serverip' => $serverip_new,':reseller_id' => $reseller_id));
|
||||
$num_check_game = $query->rowcount();
|
||||
$query = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($port_new,$serverip_new,$reseller_id));
|
||||
$num_check_game += $query->rowCount();
|
||||
if ($port2_old != $port2) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `id`!=:switchID AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port2,':switchID'=>$server_id,':serverip'=>$serverip_new,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port2,':switchID' => $server_id,':serverip' => $serverip_new,':reseller_id' => $reseller_id));
|
||||
$num_check_port2 = $query->rowCount();
|
||||
$query = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($port2,$serverip_new,$reseller_id));
|
||||
@ -850,7 +850,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
}
|
||||
if ($port3_old != $port3) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `id`!=:switchID AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port3,':switchID'=>$server_id,':serverip'=>$serverip_new,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port3,':switchID' => $server_id,':serverip' => $serverip_new,':reseller_id' => $reseller_id));
|
||||
$num_check_port3 = $query->rowCount();
|
||||
$query = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($port3,$serverip_new,$reseller_id));
|
||||
@ -860,7 +860,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
}
|
||||
if ($port4_old != $port4) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `id`!=:switchID AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port4,':switchID'=>$server_id,':serverip'=>$serverip_new,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port4,':switchID' => $server_id,':serverip' => $serverip_new,':reseller_id' => $reseller_id));
|
||||
$num_check_port4 = $query->rowCount();
|
||||
$check_select_port4_2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$check_select_port4_2->execute(array($port4,$serverip_new,$reseller_id));
|
||||
@ -870,7 +870,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
}
|
||||
if ($port5_old != $port5) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `id`!=:switchID AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port5,':switchID'=>$server_id,':serverip'=>$serverip_new,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port5,':switchID' => $server_id,':serverip' => $serverip_new,':reseller_id' => $reseller_id));
|
||||
$num_check_port5 = $query->rowCount();
|
||||
$check_select_port4_2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$check_select_port4_2->execute(array($port5,$serverip_new,$reseller_id));
|
||||
@ -970,7 +970,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
$query2->execute(array($server_id,$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$servertemplate=($row['serverid'] == $row2['id']) ? $row2['servertemplate'] : '';
|
||||
$table[]=array('id'=>$row2['id'],'description'=>$row2['description'],'shorten'=>$row2['shorten'],'servertemplate'=>$servertemplate);
|
||||
$table[]=array('id' => $row2['id'],'description' => $row2['description'],'shorten' => $row2['shorten'],'servertemplate' => $servertemplate);
|
||||
}
|
||||
}
|
||||
if (isset($serverip) and isset($port)) {
|
||||
@ -1178,7 +1178,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lG']) and $licenc
|
||||
$nameremoved="<div class=\"error\">".$sprache->nameremoved."</div>";
|
||||
}
|
||||
}
|
||||
$table[]=array('serveractive'=>$serveractive,'shorten'=>$row['shorten'],'useractive'=>$row['useractive'],'cname'=>$row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'img'=>$imgName,'alt'=>$imgAlt,'premoved'=>$premoved,'nameremoved'=>$nameremoved,'server'=>$server,'serverid'=>$serverid,'name'=>$name,'type'=>$type,'map'=>$map,'numplayers'=>$numplayers,'maxplayers'=>$maxplayers,'id'=>$userid,'lendserver'=>$lendserver,'active'=>$row['active'],'jobPending'=>$jobPending);
|
||||
$table[]=array('serveractive' => $serveractive,'shorten' => $row['shorten'],'useractive' => $row['useractive'],'cname' => $row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'img' => $imgName,'alt' => $imgAlt,'premoved' => $premoved,'nameremoved' => $nameremoved,'server' => $server,'serverid' => $serverid,'name' => $name,'type' => $type,'map' => $map,'numplayers' => $numplayers,'maxplayers' => $maxplayers,'id' => $userid,'lendserver' => $lendserver,'active' => $row['active'],'jobPending' => $jobPending);
|
||||
}
|
||||
$next = $start+$amount;
|
||||
$vor=($colcount>$next) ? $start+$amount : $start;
|
||||
|
@ -86,23 +86,23 @@ if ($seo== 'Y') {
|
||||
redirect('/');
|
||||
}
|
||||
} else {
|
||||
$page_data->SetMenu($gsprache->news, array('site'=>'news'),'news');
|
||||
$page_data->SetMenu($gsprache->news, array('site' => 'news'),'news');
|
||||
if ($protectioncheck== 'Y') {
|
||||
$page_data->SetMenu($page_sprache->protectioncheck, array('site'=>'protectioncheck'),'protectioncheck');
|
||||
$page_data->SetMenu($page_sprache->protectioncheck, array('site' => 'protectioncheck'),'protectioncheck');
|
||||
}
|
||||
if ($page_data->lendactive == 'Y') {
|
||||
$page_data->SetMenu($gsprache->lendserver, array('site'=>'lendserver'),'lendserver');
|
||||
$page_data->SetMenu($gsprache->gameserver, array('site'=>'lendserver','d'=>'gs'),'lendservergs');
|
||||
$page_data->SetMenu($gsprache->voiceserver, array('site'=>'lendserver','d'=>'vo'),'lendservervoice');
|
||||
$page_data->SetMenu($gsprache->lendserver, array('site' => 'lendserver'),'lendserver');
|
||||
$page_data->SetMenu($gsprache->gameserver, array('site' => 'lendserver','d' => 'gs'),'lendservergs');
|
||||
$page_data->SetMenu($gsprache->voiceserver, array('site' => 'lendserver','d' => 'vo'),'lendservervoice');
|
||||
}
|
||||
$page_data->SetMenu($gsprache->downloads, array('site'=>'downloads'),'downloads');
|
||||
$page_data->SetMenu($page_sprache->about, array('site'=>'about'),'about');
|
||||
$page_data->SetMenu($page_sprache->sitemap, array('site'=>'sitemap'),'sitemap');
|
||||
$page_data->SetMenu($page_sprache->gallery, array('site'=>'gallery'),'gallery');
|
||||
$page_data->SetMenu($gsprache->imprint, array('site'=>'imprint'),'imprint');
|
||||
$page_data->SetMenu($page_sprache->contact, array('site'=>'contact'),'contact');
|
||||
$page_data->SetMenu($page_sprache->search, array('site'=>'search'),'search');
|
||||
$page_data->SetMenu($page_sprache->register, array('site'=>'register'),'register');
|
||||
$page_data->SetMenu($gsprache->downloads, array('site' => 'downloads'),'downloads');
|
||||
$page_data->SetMenu($page_sprache->about, array('site' => 'about'),'about');
|
||||
$page_data->SetMenu($page_sprache->sitemap, array('site' => 'sitemap'),'sitemap');
|
||||
$page_data->SetMenu($page_sprache->gallery, array('site' => 'gallery'),'gallery');
|
||||
$page_data->SetMenu($gsprache->imprint, array('site' => 'imprint'),'imprint');
|
||||
$page_data->SetMenu($page_sprache->contact, array('site' => 'contact'),'contact');
|
||||
$page_data->SetMenu($page_sprache->search, array('site' => 'search'),'search');
|
||||
$page_data->SetMenu($page_sprache->register, array('site' => 'register'),'register');
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['naviDisplay'] == 'Y') {
|
||||
$page_data->SetMenu($row['title'], $row['id'], $row['subpage'], $row['id']);
|
||||
@ -186,11 +186,11 @@ if (!isset($s) and !isset($page_category) and isset($page_default) and isid($pag
|
||||
$s='404';
|
||||
$throw404 = true;
|
||||
}
|
||||
$what_to_be_included_array=array('news'=>'page_news.php','contact'=>'page_contact.php',
|
||||
'page'=>'page_page.php','home'=>'page_page.php','about'=>'page_page.php','gallery'=>'page_page.php','sitemap'=>'page_page.php','search'=>'page_page.php',
|
||||
'tag'=>'page_tag.php','categories'=>'page_tag.php','downloads'=>'page_download.php',
|
||||
'lendserver'=>'lend.php',
|
||||
'protectioncheck'=>'protectioncheck.php',
|
||||
'imprint'=>'imprint.php',
|
||||
'register'=>'page_register.php'
|
||||
$what_to_be_included_array=array('news' => 'page_news.php','contact' => 'page_contact.php',
|
||||
'page' => 'page_page.php','home' => 'page_page.php','about' => 'page_page.php','gallery' => 'page_page.php','sitemap' => 'page_page.php','search' => 'page_page.php',
|
||||
'tag' => 'page_tag.php','categories' => 'page_tag.php','downloads' => 'page_download.php',
|
||||
'lendserver' => 'lend.php',
|
||||
'protectioncheck' => 'protectioncheck.php',
|
||||
'imprint' => 'imprint.php',
|
||||
'register' => 'page_register.php'
|
||||
);
|
@ -103,7 +103,7 @@ if ($lastlogin != null and $lastlogin!='0000-00-00 00:00:00' and $user_language
|
||||
|
||||
# https://github.com/easy-wi/developer/issues/61
|
||||
# basic modules array. available at any time to anyone
|
||||
$what_to_be_included_array = array('ip'=>'imprint.php','lo'=>'userpanel_logdata.php','ti'=>'userpanel_tickets.php');
|
||||
$what_to_be_included_array = array('ip' => 'imprint.php','lo' => 'userpanel_logdata.php','ti' => 'userpanel_tickets.php');
|
||||
|
||||
|
||||
$easywiModules = array('gs' => true, 'my' => true, 'ro' => true, 'ti' => true, 'le' => true, 'vo' => true);
|
||||
|
@ -85,7 +85,7 @@ if (isset($action) and $action == 'dl') {
|
||||
foreach ($pselect->fetchall() as $row) {
|
||||
$logdate=explode(' ', $row['bantime']);
|
||||
if (isset($row['id']) and isid($row['id'],'30') and isset($logdate[1])) {
|
||||
$table[]=array('id'=>$row['id'],'logday'=>$logdate[0],'loghour'=>$logdate[0],'badip'=>$row['badip'],'failcount'=>$row['failcount'],'reason'=>$row['reason']);
|
||||
$table[]=array('id' => $row['id'],'logday' => $logdate[0],'loghour' => $logdate[0],'badip' => $row['badip'],'failcount' => $row['failcount'],'reason' => $row['reason']);
|
||||
}
|
||||
}
|
||||
$pselect=$sql->prepare("SELECT `faillogins` FROM `settings` WHERE `resellerid`='0' LIMIT 1");
|
||||
@ -122,7 +122,7 @@ if (isset($action) and $action == 'dl') {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -114,7 +114,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$tmp = gsrestart($row2['affectedID'],'so',$aeskey, $row['resellerID']);
|
||||
if (is_array($tmp)) {
|
||||
foreach($tmp as $t) {
|
||||
$cmds[]=$t;
|
||||
$cmds[] = $t;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$tmp = gsrestart($row2['affectedID'],'re',$aeskey, $row2['resellerID']);
|
||||
if (is_array($tmp)) {
|
||||
foreach($tmp as $t) {
|
||||
$cmds[]=$t;
|
||||
$cmds[] = $t;
|
||||
}
|
||||
}
|
||||
$query4 = $sql->prepare("UPDATE `jobs` SET `status`='3' WHERE `jobID`=? AND `type`='gs' LIMIT 1");
|
||||
@ -140,7 +140,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$command='(Re)Start gsswitchID: '.$row2['affectedID'].' name: '.$row2['name'];
|
||||
} else if (isset($i) and $row2['action'] == 'st' and isset($customer)) {
|
||||
$tmp = gsrestart($row2['affectedID'],'so',$aeskey, $row2['resellerID']);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
$query4 = $sql->prepare("UPDATE `jobs` SET `status`='3' WHERE `jobID`=? AND `type`='gs' LIMIT 1");
|
||||
$query4->execute(array($row2['jobID']));
|
||||
$command='Stop gsswitchID: '.$row2['affectedID'].' name: '.$row2['name'];
|
||||
|
@ -128,7 +128,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT * FROM `jobs` $where ORDER BY $orderby LIMIT $start,$amount");
|
||||
$query->execute(array($reseller_id));
|
||||
}
|
||||
$type=array('de'=>$gsprache->dedicated,'ds'=>'TS3 DNS','gs'=>$gsprache->gameserver,'my'=>'MYSQL','us'=>$gsprache->user,'vo'=>$gsprache->voiceserver,'vs'=>$gsprache->virtual);
|
||||
$type=array('de' => $gsprache->dedicated,'ds' => 'TS3 DNS','gs' => $gsprache->gameserver,'my' => 'MYSQL','us' => $gsprache->user,'vo' => $gsprache->voiceserver,'vs' => $gsprache->virtual);
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($user_language == 'de') {
|
||||
$date=date('Y-d-m H:m:s',strtotime($row['date']));
|
||||
@ -162,7 +162,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
else if ($row['action'] == 'ri') $action='(Re)Install';
|
||||
else if ($row['action'] == 'rc') $action='Recovery Mode';
|
||||
else $action = '';
|
||||
$table[]=array('jobID'=>$row['jobID'],'date'=>$date,'name'=>$row['name'],'api'=>$api,'status'=>$row['status'],'img'=>$imgName,'alt'=>$imgAlt,'userID'=>$row['userID'],'type'=>$type[$row['type']],'action'=>$action);
|
||||
$table[]=array('jobID' => $row['jobID'],'date' => $date,'name' => $row['name'],'api' => $api,'status' => $row['status'],'img' => $imgName,'alt' => $imgAlt,'userID' => $row['userID'],'type' => $type[$row['type']],'action' => $action);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
if ($reseller_id==0) {
|
||||
@ -198,7 +198,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -49,7 +49,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$extraData=@json_decode($row['extraData']);
|
||||
$extraData=(array)$extraData;
|
||||
$type=($row['type'] == 'de') ? 'dedicated' : 'vmware';
|
||||
if (!isset($extraData['runAt']) or strtotime("now")>$extraData['runAt']) {
|
||||
if (!isset($extraData['runAt']) or strtotime('now')>$extraData['runAt']) {
|
||||
$return=$rootObject->rootServer($row['affectedID'], $row['action'],$type,$extraData);
|
||||
|
||||
// bei add und mod restart Auftrag schreiben mit extra Data = timestamp
|
||||
@ -57,7 +57,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($return===true) {
|
||||
$query2->execute(array($row['jobID']));
|
||||
$command=$gsprache->del." $type server: ".$row['affectedID'].' name:'.$row['name'];
|
||||
$removeIDs[$row['type']][]=$row['affectedID'];
|
||||
$removeIDs[$row['type']][] = $row['affectedID'];
|
||||
} else {
|
||||
$query4->execute(array($row['jobID']));
|
||||
$command='Error: '.$gsprache->del." $type server: ".$row['affectedID'].' name:'.$row['name'] . ' ' . $return;
|
||||
@ -74,10 +74,10 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$command="Error modding $type server: ".$row['affectedID'].' name: '.$row['name'] . ' ' . $return;
|
||||
}
|
||||
} else if ($row['action'] == 're') {
|
||||
if ($return===true and !isset($extraData->reboot) and strtotime("now")<$extraData->reboot) {
|
||||
if ($return===true and !isset($extraData->reboot) and strtotime('now')<$extraData->reboot) {
|
||||
$query2->execute(array($row['jobID']));
|
||||
$command="Skipped (Re)Start $type server: ".$row['affectedID'].' name: '.$row['name'].' will try later';
|
||||
} else if ($return===true and (!isset($extraData->reboot) or strtotime("now")>$extraData->reboot)) {
|
||||
} else if ($return===true and (!isset($extraData->reboot) or strtotime('now')>$extraData->reboot)) {
|
||||
$query2->execute(array($row['jobID']));
|
||||
$command="(Re)Start $type server: ".$row['affectedID'].' name: '.$row['name'];
|
||||
} else {
|
||||
|
@ -47,7 +47,7 @@ $query6 = $sql->prepare("UPDATE `jobs` SET `status`='3' WHERE `jobID`=? AND `typ
|
||||
$query7 = $sql->prepare("UPDATE `voice_dns` SET `active`=?,`jobPending`='N' WHERE `dnsID`=? LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$query2->execute(array(':aeskey'=>$aeskey,':id'=>$row['hostID'],':reseller_id'=>$row['resellerID']));
|
||||
$query2->execute(array(':aeskey' => $aeskey,':id' => $row['hostID'],':reseller_id' => $row['resellerID']));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$publickey=$row2['publickey'];
|
||||
$queryip=$row2['ssh2ip'];
|
||||
|
@ -60,16 +60,16 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$query2->execute(array($row['affectedID']));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
if ($row2['accounttype'] == 'r') {
|
||||
removeUser($row['affectedID'], array('userdata'=>'id','userpermissions'=>'userid'));
|
||||
$tables=array('addons'=>'resellerid','addons_installed'=>'resellerid','gsswitch'=>'resellerid','rserverdata'=>'resellerid','rservermasterg'=>'resellerid','serverlist'=>'resellerid',
|
||||
'servertypes'=>'resellerid','settings'=>'resellerid','tickets'=>'resellerid','ticket_topics'=>'resellerid','userdata'=>'resellerid','userpermissions'=>'resellerid','userlog'=>'resellerid','resellerdata'=>'resellerid',
|
||||
'gserver_restarts'=>'resellerid','eac'=>'resellerid','imprints'=>'resellerid','lendedserver'=>'resellerid','lendsettings'=>'resellerid','lendstats'=>'resellerID','voice_server'=>'resellerid','voice_masterserver'=>'resellerid',
|
||||
'translations'=>'resellerID','voice_server_stats'=>'resellerid','voice_server_stats_hours'=>'resellerid','voice_stats_settings'=>'resellerid','mysql_external_servers'=>'resellerid','mysql_external_dbs'=>'resellerid','usergroups'=>'resellerid',
|
||||
'api_ips'=>'resellerID','api_settings'=>'resellerID','voice_tsdns'=>'resellerid','voice_dns'=>'resellerID');
|
||||
removeUser($row['affectedID'], array('userdata' => 'id','userpermissions' => 'userid'));
|
||||
$tables=array('addons' => 'resellerid','addons_installed' => 'resellerid','gsswitch' => 'resellerid','rserverdata' => 'resellerid','rservermasterg' => 'resellerid','serverlist' => 'resellerid',
|
||||
'servertypes' => 'resellerid','settings' => 'resellerid','tickets' => 'resellerid','ticket_topics' => 'resellerid','userdata' => 'resellerid','userpermissions' => 'resellerid','userlog' => 'resellerid','resellerdata' => 'resellerid',
|
||||
'gserver_restarts' => 'resellerid','eac' => 'resellerid','imprints' => 'resellerid','lendedserver' => 'resellerid','lendsettings' => 'resellerid','lendstats' => 'resellerID','voice_server' => 'resellerid','voice_masterserver' => 'resellerid',
|
||||
'translations' => 'resellerID','voice_server_stats' => 'resellerid','voice_server_stats_hours' => 'resellerid','voice_stats_settings' => 'resellerid','mysql_external_servers' => 'resellerid','mysql_external_dbs' => 'resellerid','usergroups' => 'resellerid',
|
||||
'api_ips' => 'resellerID','api_settings' => 'resellerID','voice_tsdns' => 'resellerid','voice_dns' => 'resellerID');
|
||||
removeUser($row['affectedID'],$tables);
|
||||
if ($row2['resellerid']==$row['affectedID']) {
|
||||
removeUser($row['affectedID'], array('traffic_data'=>'userid','traffic_data_day'=>'userid'));
|
||||
removeUser($row['affectedID'], array('traffic_data'=>'resellerid','traffic_data_day'=>'resellerid'));
|
||||
if ($row2['resellerid'] == $row['affectedID']) {
|
||||
removeUser($row['affectedID'], array('traffic_data' => 'userid','traffic_data_day' => 'userid'));
|
||||
removeUser($row['affectedID'], array('traffic_data' => 'resellerid','traffic_data_day' => 'resellerid'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ $query = $sql->prepare("SELECT `hostID`,`resellerID` FROM `jobs` WHERE (`status`
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$query2 = $sql->prepare("SELECT `active`,`usedns`,`defaultdns`,`bitversion`,`defaultname`,`defaultwelcome`,`defaulthostbanner_url`,`defaulthostbanner_gfx_url`,`defaulthostbutton_tooltip`,`defaulthostbutton_url`,`defaulthostbutton_gfx_url`,`queryport`,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,`maxserver`,`maxslots`,`rootid`,`addedby`,`publickey`,`ssh2ip`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password`,`serverdir`,`keyname`,`notified` FROM `voice_masterserver` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query2->execute(array(':aeskey'=>$aeskey,':id'=>$row['hostID'],':reseller_id'=>$row['resellerID']));
|
||||
$query2->execute(array(':aeskey' => $aeskey,':id' => $row['hostID'],':reseller_id' => $row['resellerID']));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$active=$row2['active'];
|
||||
$addedby=$row2['addedby'];
|
||||
|
@ -206,7 +206,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$servertype=$row['servertype'];
|
||||
$serverid=$row['serverid'];
|
||||
$lendtime=$row['lendtime'];
|
||||
$timeleft=round($lendtime-(strtotime("now")-strtotime($row['started']))/60);
|
||||
$timeleft=round($lendtime-(strtotime('now')-strtotime($row['started']))/60);
|
||||
if ($servertype == 'g' and (!isset($nextfree) or $timeleft<$nextfree)) {
|
||||
$nextfree=$timeleft;
|
||||
} else if ($servertype == 'v' and (!isset($vonextfree) or $timeleft<$vonextfree)) {
|
||||
@ -270,7 +270,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$shorten=$row2['type'];
|
||||
}
|
||||
}
|
||||
$table[]=array('id'=>$id,'servertype'=>$servertype,'server'=>$server,'shorten'=>$shorten,'password'=>$password,'rcon'=>$rcon,'slots'=>$slots,'lenderip'=>$lenderip,'lendtime'=>$lendtime,'timeleft'=>$timeleft);
|
||||
$table[]=array('id' => $id,'servertype' => $servertype,'server' => $server,'shorten' => $shorten,'password' => $password,'rcon' => $rcon,'slots' => $slots,'lenderip' => $lenderip,'lendtime' => $lendtime,'timeleft' => $timeleft);
|
||||
}
|
||||
}
|
||||
if (!isset($nextfree) or (isset($nextfree) and $gscount>0))$nextfree = 0;
|
||||
@ -280,7 +280,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$nextcheck=$query->fetchColumn();
|
||||
$nextcheck=($nextcheck>0) ? ceil($nextcheck) : ceil($nextcheck)*-1;
|
||||
$used[] = 'Teamspeak 3: '.$voused. '/' . $voTotalCount;
|
||||
foreach ($gscounts as $key=>$value) $used[]=$key.': '.$gsused[$key]. '/' . $value;
|
||||
foreach ($gscounts as $key=>$value) $used[] = $key.': '.$gsused[$key]. '/' . $value;
|
||||
$template_file = "admin_lendserver_list.tpl";
|
||||
}
|
||||
}
|
@ -104,14 +104,14 @@ foreach ($pselect->fetchall() as $row) {
|
||||
$hostname=$row['hostname'];
|
||||
}
|
||||
$useraction=$row['useraction'];
|
||||
$placeholders=array('%%','%add%','%dl%','%del%','%mod%','%start%','%restart%','%stop%','%upd%','%fail%','%ok%','%psw%','%cfg%','%import%','%reinstall%','%backup%','%use%');
|
||||
$placeholders=array('%%', '%add%', '%dl%', '%del%', '%mod%', '%start%', '%restart%', '%stop%', '%upd%', '%fail%', '%ok%', '%psw%', '%cfg%', '%import%', '%reinstall%', '%backup%', '%use%');
|
||||
$replace=array('',$gsprache->add.': ',$gsprache->del.': ',$gsprache->del.': ',$gsprache->mod.': ',$gsprache->start.': ',$gsprache->start.': ',$gsprache->stop.': ',$gsprache->update.': ','','',$gssprache->password.': ',$gssprache->config.': ',$gsprache->import.': ',$gssprache->reinstall.': ',$gsprache->backup,$gsprache->use.': ');
|
||||
$replacedpics=str_replace($placeholders,$replace,$useraction);
|
||||
$placeholders=array('%modules%','%voserver%','%gserver%','%user%','%group%','%fastdl%','%master%','%user%','%root%','%addon%','%settings%','%vserver%','%ticket_subject%','%reseller%','%virtual%','%eac%','%resync%','%virtualimage%','%template%','%voserver%','%emailsettings%','%dns%','%tsdns%','%pmode%','%comment%');
|
||||
$placeholders=array('%modules%', '%voserver%', '%gserver%', '%user%', '%group%', '%fastdl%', '%master%', '%user%', '%root%', '%addon%', '%settings%', '%vserver%', '%ticket_subject%', '%reseller%', '%virtual%', '%eac%', '%resync%', '%virtualimage%', '%template%', '%voserver%', '%emailsettings%', '%dns%', '%tsdns%', '%pmode%', '%comment%');
|
||||
$replace=array($gsprache->modules,$gsprache->voiceserver,$gsprache->gameserver,$gsprache->user,$gsprache->groups,$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->comments);
|
||||
$replacedwords=str_replace($placeholders,$replace,$replacedpics);
|
||||
$logdate=explode(' ', $row['logdate']);
|
||||
$table[]=array('logday'=>$logdate[0],'loghour'=>$logdate[1],'ip'=>$ip,'hostname'=>$hostname,'username'=>$username,'useraction'=>$replacedwords);
|
||||
$table[]=array('logday' => $logdate[0],'loghour' => $logdate[1],'ip' => $ip,'hostname' => $hostname,'username' => $username,'useraction' => $replacedwords);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
if ($reseller_id==0) {
|
||||
@ -155,7 +155,7 @@ if ($start==0) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -92,7 +92,7 @@ if (isset($action) and $action == 'dl' and $ui->id('id',30,'post')) {
|
||||
}
|
||||
$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']);
|
||||
$table[]=array('id' => $row['id'],'logday' => $logdate[0],'loghour' => $logdate[1],'username' => $username,'topic' => $row['topic']);
|
||||
}
|
||||
}
|
||||
$next=$start+$amount;
|
||||
@ -133,7 +133,7 @@ if (isset($action) and $action == 'dl' and $ui->id('id',30,'post')) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -105,7 +105,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $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($id,$reseller_id,$shorten));
|
||||
if ($query->rowCount()<1) {
|
||||
$table[]=array('id'=>$gameid,'shorten'=>$shorten,'description'=>$description);
|
||||
$table[]=array('id' => $gameid,'shorten' => $shorten,'description' => $description);
|
||||
}
|
||||
}
|
||||
$template_file = "admin_master_add.tpl";
|
||||
@ -155,7 +155,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$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,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('id'=>$row['id'],'shorten'=>$row['shorten'],'description'=>$row['description']);
|
||||
$table[]=array('id' => $row['id'],'shorten' => $row['shorten'],'description' => $row['description']);
|
||||
}
|
||||
if (count($table)>0) {
|
||||
$template_file = "admin_master_dl.tpl";
|
||||
@ -212,7 +212,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$toolong=date($row2['installstarted'],strtotime("+15 minutes"));
|
||||
if (strtotime($logdate)>strtotime($toolong) or $row2['updating'] == 'Y') {
|
||||
$sshcheck[]=$row2['shorten'];
|
||||
$sshcheck[] = $row2['shorten'];
|
||||
} else {
|
||||
$statusList[$row2['shorten']] = '16_installing';
|
||||
}
|
||||
@ -234,7 +234,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach (preg_split('/\:/',$check,-1,PREG_SPLIT_NO_EMPTY) as $status) {
|
||||
$ex=explode('=',$status);
|
||||
if (isset($ex[1])) {
|
||||
$games[$ex[0]]=$ex[1];
|
||||
$games[$ex[0]] = $ex[1];
|
||||
}
|
||||
}
|
||||
foreach ($games as $k=>$v) {
|
||||
@ -254,7 +254,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$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']);
|
||||
$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;
|
||||
$countp=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `rserverdata` WHERE `resellerid`=?");
|
||||
@ -285,7 +285,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
@ -304,7 +304,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$ips[$id]=$row['ip'];
|
||||
$ips[$id] = $row['ip'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,18 +315,18 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT s.`description`,s.`shorten` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` $where GROUP BY s.`description` ORDER BY s.`description` ASC");
|
||||
$query->execute(array(':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':reseller_id' => $reseller_id));
|
||||
$table = array();
|
||||
$i = 0;
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[$i]['game']=array('shorten'=>$row['shorten'],'description'=>$row['description']);
|
||||
$table[$i]['game']=array('shorten' => $row['shorten'],'description' => $row['description']);
|
||||
$i++;
|
||||
}
|
||||
$query = $sql->prepare("SELECT d.`id`,d.`ip` FROM `rservermasterg` r INNER JOIN `rserverdata` d ON r.`serverid`=d.`id` INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` $where GROUP BY d.`id` ASC");
|
||||
$query->execute(array(':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':reseller_id' => $reseller_id));
|
||||
$i2 = 0;
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[$i2]['server']=array('id'=>$row['id'],'ip'=>$row['ip']);
|
||||
$table[$i2]['server']=array('id' => $row['id'],'ip' => $row['ip']);
|
||||
$i2++;
|
||||
}
|
||||
$query5 = $sql->prepare("SELECT s.`shorten` FROM `rservermasterg` r INNER JOIN `servertypes` s ON r.`servertypeid`=s.`id` WHERE r.`resellerid`=? GROUP BY s.`shorten` ORDER BY s.`shorten` ASC");
|
||||
|
@ -88,7 +88,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $column) {
|
||||
$columnName=$column['Field'];
|
||||
$inserts[] = '`'.$columnName.'`';
|
||||
$this->tableList[$table][$columnName]=$column['Type'];
|
||||
$this->tableList[$table][$columnName] = $column['Type'];
|
||||
}
|
||||
$query=$this->connection->prepare("SELECT COUNT(*) AS `amount` FROM `".$table."`");
|
||||
$query->execute();
|
||||
@ -111,7 +111,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
$inserts = array();
|
||||
foreach($row as $key => $val){
|
||||
if (in_array($this->tableList[$table][$key], array('tinyint','smallint','int','bigint'))) {
|
||||
$inserts[]=$val;
|
||||
$inserts[] = $val;
|
||||
} else if ($this->tableList[$table][$key] != 'blob') {
|
||||
$inserts[]="'".str_replace("\r\n",'\r\n',$val)."'";
|
||||
} else {
|
||||
|
@ -106,7 +106,7 @@ class ExternalSQL {
|
||||
$select=$this->remotesql->prepare("SELECT `host` FROM `mysql`.`host` WHERE `db`=?");
|
||||
$select->execute(array($dbname));
|
||||
foreach ($select->fetchall() as $row) {
|
||||
$allowedips[]=$row['host'];
|
||||
$allowedips[] = $row['host'];
|
||||
}
|
||||
foreach ($iparray as $ip) {
|
||||
if (!in_array($ip,$allowedips)) {
|
||||
|
@ -102,10 +102,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$ds = array();
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$ds[]=array('id'=>$row2['id'],'address'=>$row2['dbname'],'status'=>($row2['active'] == 'N') ? 2 : 1);
|
||||
$ds[]=array('id' => $row2['id'],'address' => $row2['dbname'],'status'=>($row2['active'] == 'N') ? 2 : 1);
|
||||
$i++;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'img'=>$imgName,'alt'=>$imgAlt,'max_databases'=>$row['max_databases'],'dbcount'=>$i,'ip'=>$row['ip'],'interface'=>$row['interface'],'active'=>$row['active'],'server'=>$ds);
|
||||
$table[]=array('id' => $row['id'],'img' => $imgName,'alt' => $imgAlt,'max_databases' => $row['max_databases'],'dbcount' => $i,'ip' => $row['ip'],'interface' => $row['interface'],'active' => $row['active'],'server' => $ds);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$vor=($colcount>$next) ? $start+$amount : $start;
|
||||
@ -245,7 +245,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$max_connections_per_hour=$row2['max_connections_per_hour'];
|
||||
$max_userconnections_per_hour=$row2['max_userconnections_per_hour'];
|
||||
}
|
||||
$table2[]=array('id'=>$row2['id'],'ip'=>$row2['ip']);
|
||||
$table2[]=array('id' => $row2['id'],'ip' => $row2['ip']);
|
||||
}
|
||||
if (!isset($installed)) {
|
||||
$installed = 0;
|
||||
@ -258,8 +258,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = "admin_mysql_db_add.tpl";
|
||||
} else if ($ui->st('action','post') == 'ad' and $ui->id('serverid',10,'post') and $ui->id('userid',10,'post')) {
|
||||
$errors = array();
|
||||
if (!$ui->active('active','post')) $errors[]=$sprache->active;
|
||||
if (!$ui->password('password',40,'post')) $errors[]=$sprache->password;
|
||||
if (!$ui->active('active','post')) $errors[] = $sprache->active;
|
||||
if (!$ui->password('password',40,'post')) $errors[] = $sprache->password;
|
||||
if (count($errors)>0) {
|
||||
$template_file = "Error: ".implode('<br>',$errors);
|
||||
} else {
|
||||
@ -348,8 +348,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = (isset($active)) ? 'admin_mysql_db_md.tpl' : 'admin_404.tpl';
|
||||
} else if ($ui->st('action','post') == 'md') {
|
||||
$errors = array();
|
||||
if (!$ui->active('active','post')) $errors[]=$sprache->active;
|
||||
if (!$ui->password('password',40,'post')) $errors[]=$sprache->password;
|
||||
if (!$ui->active('active','post')) $errors[] = $sprache->active;
|
||||
if (!$ui->password('password',40,'post')) $errors[] = $sprache->password;
|
||||
if (count($errors)>0) {
|
||||
$template_file = "Error: ".implode('<br>',$errors);
|
||||
} else {
|
||||
@ -506,7 +506,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$dbname=$row['dbname'];
|
||||
$jobPending=($row['jobPending'] == 'Y') ? $gsprache->yes: $gsprache->no;
|
||||
#https://github.com/easy-wi/developer/issues/42 column description added
|
||||
$table[]=array('id'=>$row['id'],'uid'=>$row['uid'],'img'=>$imgName,'description'=>$row['description'],'alt'=>$imgAlt,'dbname'=>$dbname,'cname'=>$row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'ip'=>$row['ip'],'interface'=>$row['interface'],'jobPending'=>$jobPending,'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['id'],'uid' => $row['uid'],'img' => $imgName,'description' => $row['description'],'alt' => $imgAlt,'dbname' => $dbname,'cname' => $row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'ip' => $row['ip'],'interface' => $row['interface'],'jobPending' => $jobPending,'active' => $row['active']);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `mysql_external_dbs` WHERE `resellerid`=?");
|
||||
@ -537,7 +537,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -197,7 +197,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link=$page_url. '/' . $row['language'] . '/' . szrp($titleLanguages[$row['language']]['general']->news) . '/' . szrp($row['title']).'/';
|
||||
}
|
||||
$table[]=array('pageid'=>$row['pageid'],'title'=>htmlentities($row['title']),'comment'=>htmlentities($row['comment']),'commentID'=>$row['commentID'],'date'=>date($commentDate,strtotime($row['date'])),'authorname'=>htmlentities($row['authorname']),'moderated'=>$moderated,'spam'=>$spam,'spamReason'=>$row['spamReason'],'link'=>$link);
|
||||
$table[]=array('pageid' => $row['pageid'],'title'=>htmlentities($row['title']),'comment'=>htmlentities($row['comment']),'commentID' => $row['commentID'],'date'=>date($commentDate,strtotime($row['date'])),'authorname'=>htmlentities($row['authorname']),'moderated' => $moderated,'spam' => $spam,'spamReason' => $row['spamReason'],'link' => $link);
|
||||
}
|
||||
$pageamount = ceil($colcount / $amount);
|
||||
$link='<a href="admin.php?w=pc&o='.$o.'&a=';
|
||||
@ -211,7 +211,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0'.$getParams.'">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -50,7 +50,7 @@ if ($ui->escaped('email','post')) {
|
||||
if (isset($_SESSION['token'])) unset($_SESSION['token']);
|
||||
if (count($error)>0) {
|
||||
$token=md5(passwordgenerate(32));
|
||||
$_SESSION['token']=$token;
|
||||
$_SESSION['token'] = $token;
|
||||
$comments=str_replace('<br />','',$comments);
|
||||
} else {
|
||||
unset($error);
|
||||
@ -60,7 +60,7 @@ if ($ui->escaped('email','post')) {
|
||||
}
|
||||
} else {
|
||||
$token=md5(passwordgenerate(32));
|
||||
$_SESSION['token']=$token;
|
||||
$_SESSION['token'] = $token;
|
||||
}
|
||||
$page_data->setCanonicalUrl($s);
|
||||
|
||||
|
@ -96,7 +96,7 @@ if (isset($downloadID)) {
|
||||
$query->execute(array($user_language));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (($row['show'] == 'E' or ($row['show'] == 'A' and isset($admin_id)) or ($row['show'] == 'R' and (isset($user_id) or isset($admin_id)))) and file_exists(EASYWIDIR."/downloads/${row['fileID']}.${row['fileExtension']}")) {
|
||||
$table[]=array('id'=>$row['fileID'],'description'=>$row['description'],'link'=>(isset($seo) and $seo== 'Y') ? $page_data->pages['downloads']['link'].'get/'.$row['fileID'].'/' : $page_data->pages['downloads']['link'].'&action=get&id='.$row['fileID'],'text'=>$row['text']);
|
||||
$table[]=array('id' => $row['fileID'],'description' => $row['description'],'link'=>(isset($seo) and $seo== 'Y') ? $page_data->pages['downloads']['link'].'get/'.$row['fileID'].'/' : $page_data->pages['downloads']['link'].'&action=get&id='.$row['fileID'],'text' => $row['text']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$displayNone='display_none';
|
||||
$checkbox='<input type="checkbox" name="language[]" value="'.$row.'" onclick="textdrop('."'".$row."'".');" /> ';
|
||||
}
|
||||
$foundLanguages[]=array('style'=>$style,'lang'=>$row,'checkbox'=>$checkbox,'description'=>$description,'display'=>$displayNone);
|
||||
$foundLanguages[]=array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'description' => $description,'display' => $displayNone);
|
||||
}
|
||||
}
|
||||
if (!$ui->st('action','post') and $ui->st('d','get') == 'ad') {
|
||||
@ -115,28 +115,28 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($id) {
|
||||
if ($_FILES["upload"]["error"]===0) {
|
||||
$allowedTypes=array('pdf'=>array('application/pdf','application/x-download'),'xls'=>array('application/excel','application/vnd.ms-excel'),
|
||||
'ppt'=>'application/powerpoint',
|
||||
'gz'=>'application/x-gzip',
|
||||
'tar'=>'application/x-tar',
|
||||
'tgz'=>'application/x-tar',
|
||||
'ppt' => 'application/powerpoint',
|
||||
'gz' => 'application/x-gzip',
|
||||
'tar' => 'application/x-tar',
|
||||
'tgz' => 'application/x-tar',
|
||||
'zip'=>array('application/x-zip','application/zip','application/x-zip-compressed','application/octet-stream'),
|
||||
'xml'=>'text/xml',
|
||||
'xsl'=>'text/xml',
|
||||
'mpeg'=>'video/mpeg',
|
||||
'mpg'=>'video/mpeg',
|
||||
'mpe'=>'video/mpeg',
|
||||
'qt'=>'video/quicktime',
|
||||
'mov'=>'video/quicktime',
|
||||
'avi'=>'video/x-msvideo',
|
||||
'movie'=>'video/x-sgi-movie',
|
||||
'doc'=>'application/msword',
|
||||
'xml' => 'text/xml',
|
||||
'xsl' => 'text/xml',
|
||||
'mpeg' => 'video/mpeg',
|
||||
'mpg' => 'video/mpeg',
|
||||
'mpe' => 'video/mpeg',
|
||||
'qt' => 'video/quicktime',
|
||||
'mov' => 'video/quicktime',
|
||||
'avi' => 'video/x-msvideo',
|
||||
'movie' => 'video/x-sgi-movie',
|
||||
'doc' => 'application/msword',
|
||||
'word'=>array('application/msword','application/octet-stream'),
|
||||
'xl'=>'application/excel',
|
||||
'rar'=>'application/x-rar-compressed');
|
||||
'xl' => 'application/excel',
|
||||
'rar' => 'application/x-rar-compressed');
|
||||
$exploded=explode('.',$_FILES["upload"]["name"]);
|
||||
$extension=$exploded[count($exploded)-1];
|
||||
if(isset($allowedTypes[$extension]) and ((is_array($allowedTypes[$extension]) and in_array($_FILES["upload"]["type"],$allowedTypes[$extension])) or (!is_array($allowedTypes[$extension]) and $_FILES["upload"]["type"]==$allowedTypes[$extension])) ) {
|
||||
if (move_uploaded_file($_FILES["upload"]["tmp_name"],EASYWIDIR . '/downloads/'.$id.'.'.$extension)) {
|
||||
if(isset($allowedTypes[$extension]) and ((is_array($allowedTypes[$extension]) and in_array($_FILES["upload"]["type"],$allowedTypes[$extension])) or (!is_array($allowedTypes[$extension]) and $_FILES["upload"]["type"] == $allowedTypes[$extension])) ) {
|
||||
if (move_uploaded_file($_FILES["upload"]["tmp_name"],EASYWIDIR . '/downloads/'.$id . '.' . $extension)) {
|
||||
$changed = true;
|
||||
$query = $sql->prepare("UPDATE `page_downloads` SET `fileExtension`=? WHERE `fileID`=? AND `resellerID`=?");
|
||||
$query->execute(array($extension,$id,$reseller_id));
|
||||
@ -218,7 +218,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `fileID`,`description`,`order`,`count` FROM `page_downloads` WHERE `resellerID`=? ORDER BY ${orderby}");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('id'=>$row['fileID'],'description'=>$row['description'],'order'=>$row['order'],'count'=>$row['count']);
|
||||
$table[]=array('id' => $row['fileID'],'description' => $row['description'],'order' => $row['order'],'count' => $row['count']);
|
||||
}
|
||||
$template_file = 'admin_page_downloads_list.tpl';
|
||||
}
|
@ -43,7 +43,7 @@ if ($ui->id('id',19,'get')) {
|
||||
$query = $sql->prepare("SELECT p.`id`,t.`title` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` WHERE `type`='news' AND t.`language`=? AND p.`released`=1 AND p.`resellerid`=0");
|
||||
$query->execute(array($user_language));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$pagesAvailable[szrp($row['title'])]=$row['id'];
|
||||
$pagesAvailable[szrp($row['title'])] = $row['id'];
|
||||
}
|
||||
if (array_key_exists(strtolower($page_name),$pagesAvailable)) {
|
||||
$page_id=$pagesAvailable[strtolower($page_name)];
|
||||
@ -75,9 +75,9 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
$categoryLink=$page_url.'/index.php?site=categories&tag='.szrp($row2['name']);
|
||||
}
|
||||
if ($row2['type'] == 'tag') {
|
||||
$allTags[]=array('name'=>$row2['name'],'link'=>$tagLink,'href'=>'<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
$allTags[]=array('name' => $row2['name'],'link' => $tagLink,'href' => '<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
} else if ($row2['type'] == 'category') {
|
||||
$allCategories[]=array('name'=>$row2['name'],'link'=>$categoryLink,'href'=>'<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
$allCategories[]=array('name' => $row2['name'],'link' => $categoryLink,'href' => '<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
}
|
||||
}
|
||||
$pageLanguage=$row['language'];
|
||||
@ -149,7 +149,7 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
if ($commentsModerated== 'Y' and (!isset($admin_id) and !isset($user_id))) {
|
||||
$query = $sql->prepare("INSERT INTO `page_comments` (`date`,`moderateAccepted`,`pageTextID`,`replyTo`,`authorname`,`homepage`,`comment`,`ip`,`dns`,`markedSpam`,`spamReason`,`email`) VALUES (NOW(),'N',?,?,?,?,?,?,?,?,?,?)");
|
||||
$query->execute(array($textID,$replyTo,$author,$url,$ui->escaped('comment','post'),$ui->ip('REMOTE_ADDR','server'),gethostbyaddr($ui->ip4('REMOTE_ADDR','server')),$isSpam,$spamReason,$email));
|
||||
$_SESSION['toBeModerated'][]=$sql->lastInsertId();
|
||||
$_SESSION['toBeModerated'][] = $sql->lastInsertId();
|
||||
} else {
|
||||
$query = $sql->prepare("INSERT INTO `page_comments` (`date`,`moderateAccepted`,`pageTextID`,`replyTo`,`authorname`,`homepage`,`comment`,`ip`,`dns`,`markedSpam`,`spamReason`,`email`) VALUES (NOW(),'Y',?,?,?,?,?,?,?,?,?,?)");
|
||||
$query->execute(array($textID,$replyTo,$author,$url,$ui->escaped('comment','post'),$ui->ip('REMOTE_ADDR','server'),gethostbyaddr($ui->ip4('REMOTE_ADDR','server')),$isSpam,$spamReason,$email));
|
||||
@ -158,7 +158,7 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
}
|
||||
}
|
||||
$token=md5(passwordgenerate(10));
|
||||
$_SESSION['news'][$textID]=$token;
|
||||
$_SESSION['news'][$textID] = $token;
|
||||
$commentArray = array();
|
||||
$OR = '';
|
||||
if (isset($_SESSION['toBeModerated']) and count($_SESSION['toBeModerated'])>0) {
|
||||
@ -176,7 +176,7 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
} else {
|
||||
$commentDate=date('m.d.Y H:i',strtotime($row['date']));
|
||||
}
|
||||
$commentArray[]=array('commentID'=>$row['commentID'],'replyTo'=>$row['replyTo'],'homepage'=>$row['homepage'],'date'=>$commentDate,'author'=>htmlentities($row['authorname']),'comment'=>htmlentities($row['comment']));
|
||||
$commentArray[]=array('commentID' => $row['commentID'],'replyTo' => $row['replyTo'],'homepage' => $row['homepage'],'date' => $commentDate,'author'=>htmlentities($row['authorname']),'comment'=>htmlentities($row['comment']));
|
||||
}
|
||||
}
|
||||
$page_data->setCanonicalUrl($s,$textID);
|
||||
@ -259,11 +259,11 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
}
|
||||
$page_data->AddData('keywords', $row2['name']);
|
||||
if ($row2['type'] == 'tag') {
|
||||
$allTags[]=array('name'=>$row2['name'],'link'=>$tagLink,'href'=>'<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
$tag_tags[]=array('name'=>$row2['name'],'link'=>$tagLink,'href'=>'<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
$allTags[]=array('name' => $row2['name'],'link' => $tagLink,'href' => '<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
$tag_tags[]=array('name' => $row2['name'],'link' => $tagLink,'href' => '<a href="'.$tagLink.'">'.$row2['name'].'</a>');
|
||||
} else if ($row2['type'] == 'category') {
|
||||
$allCategories[]=array('name'=>$row2['name'],'link'=>$categoryLink,'href'=>'<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
$category_tags[]=array('name'=>$row2['name'],'link'=>$categoryLink,'href'=>'<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
$allCategories[]=array('name' => $row2['name'],'link' => $categoryLink,'href' => '<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
$category_tags[]=array('name' => $row2['name'],'link' => $categoryLink,'href' => '<a href="'.$categoryLink.'">'.$row2['name'].'</a>');
|
||||
}
|
||||
}
|
||||
if ($row['language'] == 'de') {
|
||||
@ -277,7 +277,7 @@ if ((isset($page_name) and $page_name!=szrp($page_sprache->older) and isset($pag
|
||||
} else {
|
||||
$commentCount = 0;
|
||||
}
|
||||
$news[]=array('date'=>$date,'title'=>$page_title,'text'=>$page_text,'href'=>$href,'link'=>$link,'tags'=>$tag_tags,'categories'=>$category_tags,'comments'=>$row['comments'],'commentCount'=>$commentCount,'authorname'=>$row['authorname']);
|
||||
$news[]=array('date' => $date,'title' => $page_title,'text' => $page_text,'href' => $href,'link' => $link,'tags' => $tag_tags,'categories' => $category_tags,'comments' => $row['comments'],'commentCount' => $commentCount,'authorname' => $row['authorname']);
|
||||
}
|
||||
if ($seo== 'Y') {
|
||||
$paginationLink=$page_url. '/' . $user_language . '/' . szrp($gsprache->news) . '/' . szrp($page_sprache->older).'/';
|
||||
|
@ -59,19 +59,19 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `name` FROM `page_terms` WHERE `type`='category' AND `language`=? AND `resellerid`=? GROUP BY `name` ORDER BY `name` DESC");
|
||||
$query->execute(array($lg,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$categories[$lg][]=$row['name'];
|
||||
$categories[$lg][] = $row['name'];
|
||||
}
|
||||
$query2 = $sql->prepare("SELECT `name` FROM `page_terms` WHERE `type`='tag' AND `language`=? AND `resellerid`=? GROUP BY `name` ORDER BY `count` DESC LIMIT 10");
|
||||
$query2->execute(array($lg,$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$keywords[$lg][]=$row2['name'];
|
||||
$keywords[$lg][] = $row2['name'];
|
||||
}
|
||||
}
|
||||
$template_file = "admin_page_news_add.tpl";
|
||||
} else if ($ui->smallletters('action',2,'post')=="ad" and $ui->id('released','1','post') and ($ui->id('subpage',19,'post') or $ui->id('subpage',19,'post')==0)) {
|
||||
if (is_object($ui->st('language','post'))) {
|
||||
foreach ($ui->st('language','post') as $key=>$lg) {
|
||||
$posted_languages[$key]=$lg;
|
||||
$posted_languages[$key] = $lg;
|
||||
}
|
||||
} else {
|
||||
$posted_languages = array();
|
||||
@ -95,11 +95,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2->execute(array($pageid,$lg,$ui->htmlcode('title','post',$lg),$ui->escaped('text','post',$lg),$reseller_id));
|
||||
$newpageid=$sql->lastInsertId();
|
||||
foreach (preg_split('/\,/',$ui->escaped('keywords','post',$lg),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$addterms[$lg][]=array('lid'=>$newpageid,'keyword'=>$keyword,'termtype'=>'tag');
|
||||
$addterms[$lg][]=array('lid' => $newpageid,'keyword' => $keyword,'termtype' => 'tag');
|
||||
}
|
||||
if (is_object($ui->escaped('categories','post',$lg))) {
|
||||
foreach ($ui->escaped('categories','post',$lg) as $category) {
|
||||
$addterms[$lg][]=array('lid'=>$newpageid,'keyword'=>$category,'termtype'=>'category');
|
||||
$addterms[$lg][]=array('lid' => $newpageid,'keyword' => $category,'termtype' => 'category');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2 = $sql->prepare("SELECT `language` FROM `page_pages_text` WHERE `pageid`=? AND `resellerid`=? ORDER BY `language`");
|
||||
$query2->execute(array($id,$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$p_languages[]=$row2['language'];
|
||||
$p_languages[] = $row2['language'];
|
||||
}
|
||||
$page_title=$row['title'];
|
||||
if (($row['title'] == null or $row['title'] == '') and isset($p_languages)) {
|
||||
@ -212,12 +212,12 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query3->execute(array($id, $row2['id'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
if ($row3['type'] == 'tag') {
|
||||
$keywords_used[$row2['language']][]=$row3['name'];
|
||||
$keywords_used[$row2['language']][] = $row3['name'];
|
||||
} else {
|
||||
$categories_used[$row2['language']][]=$row3['name'];
|
||||
$categories_used[$row2['language']][] = $row3['name'];
|
||||
}
|
||||
}
|
||||
$table[$row2['language']]=array('title'=>$row2['title'],'keywords'=>implode(', ',$keywords_used[$row2['language']]),'categories'=>(is_array($categories_used[$row2['language']])) ? $categories_used[$row2['language']] : array(),'text'=>$row2['text']);
|
||||
$table[$row2['language']]=array('title' => $row2['title'],'keywords'=>implode(', ',$keywords_used[$row2['language']]),'categories'=>(is_array($categories_used[$row2['language']])) ? $categories_used[$row2['language']] : array(),'text' => $row2['text']);
|
||||
}
|
||||
}
|
||||
$subpages = array();
|
||||
@ -233,7 +233,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$page_title=$row5['title'];
|
||||
}
|
||||
}
|
||||
$subpages[$row4['id']]=$page_title;
|
||||
$subpages[$row4['id']] = $page_title;
|
||||
}
|
||||
}
|
||||
$categories = array();
|
||||
@ -245,14 +245,14 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($lg,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!in_array($row['name'],$categories_used[$lg])) {
|
||||
$categories[$lg][]=$row['name'];
|
||||
$categories[$lg][] = $row['name'];
|
||||
}
|
||||
}
|
||||
$query2 = $sql->prepare("SELECT `name` FROM `page_terms` WHERE `type`='tag' AND `language`=? AND `resellerid`=? GROUP BY `name` ORDER BY `count` DESC LIMIT 10");
|
||||
$query2->execute(array($lg,$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
if (!in_array($row2['name'],$keywords_used[$lg])) {
|
||||
$keywords[$lg][]=$row2['name'];
|
||||
$keywords[$lg][] = $row2['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$id=($ui->id('id',19,'post')) ? $ui->id('id',19,'post') : $ui->id('id',19,'get');
|
||||
if (is_object($ui->st('language','post'))) {
|
||||
foreach ($ui->st('language','post') as $key=>$lg) {
|
||||
$posted_languages[$key]=$lg;
|
||||
$posted_languages[$key] = $lg;
|
||||
}
|
||||
} else {
|
||||
$posted_languages = array();
|
||||
@ -282,15 +282,15 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($id,$reseller_id));
|
||||
$lang_exist = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$lang_exist[]=$row['language'];
|
||||
$lang_exist[] = $row['language'];
|
||||
$keywords = array();
|
||||
foreach (preg_split('/\,/',preg_replace("/\,\s+/",',',preg_replace("/\s+/"," ",$ui->escaped('keywords','post', $row['language']))),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$keywords[]=$keyword;
|
||||
$keywords[] = $keyword;
|
||||
}
|
||||
$categories = array();
|
||||
if (is_object($ui->escaped('categories','post', $row['language']))) {
|
||||
foreach ($ui->escaped('categories','post', $row['language']) as $category) {
|
||||
$categories[]=$category;
|
||||
$categories[] = $category;
|
||||
}
|
||||
}
|
||||
if (in_array($row['language'],$posted_languages)) {
|
||||
@ -298,29 +298,29 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$keyword_exist = array();
|
||||
$query3->execute(array($id, $row['id'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$keyword_exist[]=$row3['name'];
|
||||
$keyword_exist[] = $row3['name'];
|
||||
if (!in_array($row3['name'],$keywords)) {
|
||||
$query5->execute(array($row3['term_id'],$id, $row['id'],$reseller_id));
|
||||
$countreduce[]=$row3['name'];
|
||||
$countreduce[] = $row3['name'];
|
||||
}
|
||||
}
|
||||
$category_exist = array();
|
||||
$query4->execute(array($id, $row['id'],$reseller_id));
|
||||
foreach ($query4->fetchAll(PDO::FETCH_ASSOC) as $row4) {
|
||||
$category_exist[]=$row4['name'];
|
||||
$category_exist[] = $row4['name'];
|
||||
if (!in_array($row4['name'],$categories)) {
|
||||
$query5->execute(array($row4['term_id'],$id, $row['id'],$reseller_id));
|
||||
$countreduce[]=$row4['name'];
|
||||
$countreduce[] = $row4['name'];
|
||||
}
|
||||
}
|
||||
foreach ($keywords as $keyword) {
|
||||
if (!in_array($keyword,$keyword_exist)) {
|
||||
$addterms[$row['language']][]=array('lid'=>$row['id'],'keyword'=>$keyword,'termtype'=>'tag');
|
||||
$addterms[$row['language']][]=array('lid' => $row['id'],'keyword' => $keyword,'termtype' => 'tag');
|
||||
}
|
||||
}
|
||||
foreach ($categories as $category) {
|
||||
if (!in_array($category,$category_exist)) {
|
||||
$addterms[$row['language']][]=array('lid'=>$row['id'],'keyword'=>$category,'termtype'=>'category');
|
||||
$addterms[$row['language']][]=array('lid' => $row['id'],'keyword' => $category,'termtype' => 'category');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -337,10 +337,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2->execute(array($id,$lg,$reseller_id));
|
||||
$newpageid=$query6->fetchColumn();
|
||||
foreach (preg_split('/\,/',$ui->escaped('keywords','post',$lg),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$addterms[$lg][]=array('lid'=>$newpageid,'keyword'=>$keyword,'termtype'=>'tag');
|
||||
$addterms[$lg][]=array('lid' => $newpageid,'keyword' => $keyword,'termtype' => 'tag');
|
||||
}
|
||||
foreach ($ui->escaped('categories','post',$lg) as $category) {
|
||||
$addterms[$lg][]=array('lid'=>$newpageid,'category'=>$category,'termtype'=>'category');
|
||||
$addterms[$lg][]=array('lid' => $newpageid,'category' => $category,'termtype' => 'category');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -374,7 +374,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT t.`name` FROM `page_terms_used` u LEFT JOIN `page_terms` t ON u.`term_id`=t.`id` WHERE u.`page_id`=? AND u.`resellerid`=?");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$countreduce[]=$row['name'];
|
||||
$countreduce[] = $row['name'];
|
||||
}
|
||||
$query = $sql->prepare("DELETE FROM `page_page` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
@ -446,7 +446,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
unset($p_languages);
|
||||
$query3->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$p_languages[]=$row3['language'];
|
||||
$p_languages[] = $row3['language'];
|
||||
}
|
||||
$page_title=$row['title'];
|
||||
if (($row['title'] == null or $row['title'] == '') and isset($p_languages[0])) {
|
||||
@ -464,7 +464,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($seo== 'N') {
|
||||
$link=$page_url.'/index.php?site=page&id='.$row['id'];
|
||||
} else {
|
||||
if ($row['language']==$user_language) {
|
||||
if ($row['language'] == $user_language) {
|
||||
$link=$page_url. '/' . $user_language . '/' . szrp($titleLanguages[$row['language']]['general']->news) . '/' . strtolower(szrp($row['title'])).'/';
|
||||
} else {
|
||||
$link=$page_url. '/' . $row['language'] . '/' . szrp($titleLanguages[$row['language']]['general']->news) . '/' . strtolower(szrp($row['title'])).'/';
|
||||
@ -477,7 +477,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$date=$explodedtime2[1] . '.' . $explodedtime2[2] . '.' . $explodedtime2[0] . ' ' . $explodedtime[1];
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'author'=>$author,'date'=>$date,'released'=>$released,'title'=>$page_title,'link'=>$link,'languages'=>$p_languages);
|
||||
$table[]=array('id' => $row['id'],'author' => $author,'date' => $date,'released' => $released,'title' => $page_title,'link' => $link,'languages' => $p_languages);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `page_pages` WHERE `resellerid`=?");
|
||||
@ -506,7 +506,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -74,7 +74,7 @@ if (isset($page_id) and is_numeric($page_id)) {
|
||||
unset($breadcrumbID);
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$link=(isset($seo) and $seo== 'Y') ? $page_data->pageurl. '/' . $user_language . '/' . szrp($row['title']).'/' : $page_data->pageurl.'?s=page&l='.$user_language.'&id='.$row['id'];
|
||||
$breadcrumbs[]=array('href'=>'<a href="'.$link.'">'.$row['title'].'</a>','link'=>$link);
|
||||
$breadcrumbs[]=array('href' => '<a href="'.$link.'">'.$row['title'].'</a>','link' => $link);
|
||||
$breadcrumbID=$row['subpage'];
|
||||
$breadcrumbPageID=$row['id'];
|
||||
}
|
||||
@ -119,7 +119,7 @@ if (isset($page_id) and is_numeric($page_id)) {
|
||||
function returnRating ($value,$exact=false) {
|
||||
global $sql,$newssidebar_textlength,$page_data,$results,$seo;
|
||||
$query = $sql->prepare("SELECT t.`id`,p.`id` AS `pageID`,p.`type`,t.`shortlink`,t.`title`,t.`text`,t.`language` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` WHERE p.`released`=1 AND p.`resellerid`=0 AND (LOWER(t.`shortlink`) LIKE :search OR LOWER(t.`title`) LIKE :search OR LOWER(t.`text`) LIKE :search)");
|
||||
$query->execute(array(':search'=>'%'.$value.'%'));
|
||||
$query->execute(array(':search' => '%'.$value.'%'));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if(!isset($titleLanguages[$row['language']])) {
|
||||
$titleLanguages[$row['language']]=array('page'=>getlanguagefile('page', $row['language'],0),'general'=>getlanguagefile('general', $row['language'],0));
|
||||
@ -165,31 +165,31 @@ if (isset($page_id) and is_numeric($page_id)) {
|
||||
if(isset($results[$row['id']])) {
|
||||
$oldWorth=$results[$row['id']]['worth'];
|
||||
$hits=$results[$row['id']]['hits'];
|
||||
$hits[]=$value;
|
||||
$hits[] = $value;
|
||||
$hits=array_unique($hits);
|
||||
$worth+=$oldWorth;
|
||||
unset($results[$row['id']]);
|
||||
} else {
|
||||
$hits=array($value);
|
||||
}
|
||||
$results[$row['id']]=array('textID'=>$row['id'],'pageID'=>$row['pageID'],'language'=>$row['language'],'type'=>$type,'worth'=>$worth,'href'=>$href,'title'=>$title,'link'=>$link,'text'=>str_replace('%url%',$page_data->pageurl,$text),'hits'=>$hits);
|
||||
$results[$row['id']]=array('textID' => $row['id'],'pageID' => $row['pageID'],'language' => $row['language'],'type' => $type,'worth' => $worth,'href' => $href,'title' => $title,'link' => $link,'text'=>str_replace('%url%',$page_data->pageurl,$text),'hits' => $hits);
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
foreach ($searchFor['general'] as $v) {
|
||||
foreach (returnRating($v) as $key=>$val) {
|
||||
$results[$key]=$val;
|
||||
$results[$key] = $val;
|
||||
}
|
||||
}
|
||||
foreach ($searchFor['exact'] as $v) {
|
||||
foreach (returnRating($v) as $key=>$val) {
|
||||
$results[$key]=$val;
|
||||
$results[$key] = $val;
|
||||
}
|
||||
}
|
||||
$resultsArray = array();
|
||||
foreach ($results as $k=>$v) {
|
||||
unset($results[$k]);
|
||||
$resultsArray[$v['worth']][$v['textID']]=$v;
|
||||
$resultsArray[$v['worth']][$v['textID']] = $v;
|
||||
}
|
||||
krsort($resultsArray);
|
||||
$results = array();
|
||||
@ -198,8 +198,8 @@ if (isset($page_id) and is_numeric($page_id)) {
|
||||
foreach ($val as $k=>$v) {
|
||||
if(!in_array($key,$exists)) {
|
||||
unset($resultsArray[$key][$k]);
|
||||
$results[]=$v;
|
||||
$exists[]=$key;
|
||||
$results[] = $v;
|
||||
$exists[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$page_title=$row2['title'];
|
||||
}
|
||||
}
|
||||
$subpage[$row['id']]=$page_title;
|
||||
$subpage[$row['id']] = $page_title;
|
||||
}
|
||||
$keywords = array();
|
||||
foreach ($lang_avail as $lg) {
|
||||
@ -71,14 +71,14 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query3 = $sql->prepare("SELECT `name` FROM `page_terms` WHERE `type`='tag' AND `language`=? AND `resellerid`=? GROUP BY `name` ORDER BY `count` DESC LIMIT 10");
|
||||
$query3->execute(array($lg,$reseller_id));
|
||||
foreach ($query3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$keywords[$lg][]=$row3['name'];
|
||||
$keywords[$lg][] = $row3['name'];
|
||||
}
|
||||
}
|
||||
$template_file = "admin_page_pages_add.tpl";
|
||||
} else if ($ui->smallletters('action',2,'post')=="ad" and $ui->id('released','1','post') and ($ui->id('subpage',19,'post') or $ui->id('subpage',19,'post')==0)) {
|
||||
if (is_object($ui->st('language','post'))) {
|
||||
foreach ($ui->st('language','post') as $key=>$lg) {
|
||||
$posted_languages[$key]=$lg;
|
||||
$posted_languages[$key] = $lg;
|
||||
}
|
||||
} else {
|
||||
$posted_languages = array();
|
||||
@ -112,7 +112,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$newpageid=$row3['id'];
|
||||
}
|
||||
foreach (preg_split('/\,/',$ui->escaped('keywords','post',$lg),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$addkeywords[]=array('lid'=>$newpageid,'keyword'=>$keyword);
|
||||
$addkeywords[]=array('lid' => $newpageid,'keyword' => $keyword);
|
||||
}
|
||||
}
|
||||
$query = $sql->prepare("SELECT `id` FROM `page_terms` WHERE `type`='tag' AND `name`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -159,7 +159,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `language` FROM `page_pages_text` WHERE `pageid`=? AND `resellerid`=? ORDER BY `language`");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$p_languages[]=$row['language'];
|
||||
$p_languages[] = $row['language'];
|
||||
}
|
||||
if (($page_title==null or $page_title == '') and isset($p_languages)) {
|
||||
$query = $sql->prepare("SELECT `title` FROM `page_pages_text` WHERE `pageid`=? AND `language`=? AND `resellerid`=? ORDER BY `language` LIMIT 1");
|
||||
@ -218,10 +218,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$keywords = array();
|
||||
$query3->execute(array($id, $row2['id'],$reseller_id));
|
||||
foreach ($query3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$keywords[]=$row3['name'];
|
||||
$keywords_used[$row2['language']][]=$row3['name'];
|
||||
$keywords[] = $row3['name'];
|
||||
$keywords_used[$row2['language']][] = $row3['name'];
|
||||
}
|
||||
$table[$row2['language']]=array('title'=>$row2['title'],'keywords'=>implode(', ',$keywords),'text'=>$row2['text']);
|
||||
$table[$row2['language']]=array('title' => $row2['title'],'keywords'=>implode(', ',$keywords),'text' => $row2['text']);
|
||||
}
|
||||
}
|
||||
$subpages = array();
|
||||
@ -237,7 +237,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$page_title=$row2['title'];
|
||||
}
|
||||
}
|
||||
$subpages[$row['id']]=$page_title;
|
||||
$subpages[$row['id']] = $page_title;
|
||||
}
|
||||
}
|
||||
$keywords = array();
|
||||
@ -247,7 +247,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($lg,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!in_array($row['name'],$keywords_used[$lg])) {
|
||||
$keywords[$lg][]=$row['name'];
|
||||
$keywords[$lg][] = $row['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if (isset($action) and $action == 'md' and ($ui->id('subpage',19,'post') or $ui->id('subpage','30','post')==0)) {
|
||||
if (is_object($ui->st('language','post'))) {
|
||||
foreach ($ui->st('language','post') as $key=>$lg) {
|
||||
$posted_languages[$key]=$lg;
|
||||
$posted_languages[$key] = $lg;
|
||||
}
|
||||
} else {
|
||||
$posted_languages = array();
|
||||
@ -274,10 +274,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($id,$reseller_id));
|
||||
$lang_exist = array();
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$lang_exist[]=$row['language'];
|
||||
$lang_exist[] = $row['language'];
|
||||
$keywords = array();
|
||||
foreach (preg_split('/\,/',preg_replace("/\,\s+/",',',preg_replace("/\s+/"," ",$ui->escaped('keywords','post', $row['language']))),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$keywords[]=$keyword;
|
||||
$keywords[] = $keyword;
|
||||
}
|
||||
if (in_array($row['language'],$posted_languages)) {
|
||||
$query2 = $sql->prepare("UPDATE `page_pages_text` SET `title`=?,`text`=? WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -286,16 +286,16 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2 = $sql->prepare("SELECT u.`term_id`,t.`name` FROM `page_terms_used` u LEFT JOIN `page_terms` t ON u.`term_id`=t.`id` WHERE u.`page_id`=? AND u.`language_id`=? AND u.`resellerid`=?");
|
||||
$query2->execute(array($id, $row['id'],$reseller_id));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$keyword_exist[]=$row2['name'];
|
||||
$keyword_exist[] = $row2['name'];
|
||||
if (!in_array($row2['name'],$keywords)) {
|
||||
$query2 = $sql->prepare("DELETE FROM `page_terms_used` WHERE `term_id`=? AND `page_id`=? AND `language_id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($row2['term_id'],$id, $row['id'],$reseller_id));
|
||||
$countreduce[]=$row2['name'];
|
||||
$countreduce[] = $row2['name'];
|
||||
}
|
||||
}
|
||||
foreach ($keywords as $keyword) {
|
||||
if (!in_array($keyword,$keyword_exist)) {
|
||||
$addkeywords[]=array('lid'=>$row['id'],'keyword'=>$keyword);
|
||||
$addkeywords[]=array('lid' => $row['id'],'keyword' => $keyword);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -310,13 +310,13 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (!in_array($lg,$lang_exist)) {
|
||||
$query = $sql->prepare("INSERT INTO `page_pages_text` (`pageid`,`language`,`title`,`text`,`resellerid`) VALUES (?,?,?,?,?)");
|
||||
$query->execute(array($id,$lg,$ui->htmlcode('title','post',$lg),$ui->escaped('text','post',$lg),$reseller_id));
|
||||
$query = $sql->prepare("SELECT `id` FROM `page_pages_text` WHERE `pageid`=? `language`=? AND `resellerid`=? LIMIT 1");
|
||||
$query = $sql->prepare("SELECT `id` FROM `page_pages_text` WHERE `pageid`=? AND `language`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$lg,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$newpageid=$row['id'];
|
||||
}
|
||||
foreach (preg_split('/\,/',$ui->escaped('keywords','post',$lg),-1,PREG_SPLIT_NO_EMPTY) as $keyword) {
|
||||
$addkeywords[]=array('lid'=>$newpageid,'keyword'=>$keyword);
|
||||
$addkeywords[]=array('lid' => $newpageid,'keyword' => $keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -346,7 +346,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT t.`name` FROM `page_terms_used` u LEFT JOIN `page_terms` t ON u.`term_id`=t.`id` WHERE u.`page_id`=? AND u.`resellerid`=?");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$countreduce[]=$row['name'];
|
||||
$countreduce[] = $row['name'];
|
||||
}
|
||||
$query = $sql->prepare("DELETE FROM `page_page` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
@ -425,7 +425,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query3 = $sql->prepare("SELECT `language` FROM `page_pages_text` WHERE `pageid`=? AND `resellerid`=? ORDER BY `language`");
|
||||
$query3->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query3->fetchall(PDO::FETCH_ASSOC) as $row3) {
|
||||
$p_languages[]=$row3['language'];
|
||||
$p_languages[] = $row3['language'];
|
||||
}
|
||||
$page_title=$row['title'];
|
||||
if (($row['title'] == null or $row['title'] == '') and isset($p_languages[0])) {
|
||||
@ -444,7 +444,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($seo== 'N') {
|
||||
$link=$page_url.'/index.php?site=page&id='.$row['id'];
|
||||
} else {
|
||||
if ($row['language']==$user_language) {
|
||||
if ($row['language'] == $user_language) {
|
||||
$link=$page_url. '/' . $user_language . '/' . strtolower(szrp($row['title'])).'/';
|
||||
} else {
|
||||
$link=$page_url. '/' . $row['language'] . '/' . strtolower(szrp($row['title'])).'/';
|
||||
@ -457,7 +457,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$date=$explodedtime2[1] . '.' . $explodedtime2[2] . '.' . $explodedtime2[0] . ' ' . $explodedtime[1];
|
||||
}
|
||||
array_push($table, array('id'=>$row['id'],'author'=>$author,'date'=>$date,'released'=>$released,'title'=>$page_title,'link'=>$link,'languages'=>$p_languages,'sort'=>$row['sort']));
|
||||
array_push($table, array('id' => $row['id'],'author' => $author,'date' => $date,'released' => $released,'title' => $page_title,'link' => $link,'languages' => $p_languages,'sort' => $row['sort']));
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `page_pages` WHERE `resellerid`=?");
|
||||
@ -488,7 +488,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -61,7 +61,7 @@ if (isset($registration) and in_array($registration, array('A','M','D'))) {
|
||||
if (isid($userID,10)) {
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `active`='Y',`token`=null,`updateTime`=NOW() WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($userID));
|
||||
$_SESSION['userid']=$userID;
|
||||
$_SESSION['userid'] = $userID;
|
||||
$_SESSION['resellerid'] = 0;
|
||||
$template_file = $page_sprache->registerActivated;
|
||||
$langObjectTemp = getlanguagefile('redirect',(isset($user_language)) ? $user_language : $default_language,0);
|
||||
@ -88,7 +88,7 @@ if (isset($registration) and in_array($registration, array('A','M','D'))) {
|
||||
$tous = array();
|
||||
$query = $sql->prepare("SELECT `lang`,`text` FROM `translations` WHERE `type`='to'");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $tous[$row['lang']]=$row['text'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $tous[$row['lang']] = $row['text'];
|
||||
if (isset($user_language) and isset($tous[$user_language])) $tou=$tous[$user_language];
|
||||
else if (isset($default_language) and isset($tous[$default_language])) $tou=$tous[$default_language];
|
||||
else if (count($tous)>0) $tou=key($tous);
|
||||
@ -96,57 +96,57 @@ if (isset($registration) and in_array($registration, array('A','M','D'))) {
|
||||
if (($ui->escaped('mail','post') or $ui->escaped('password','post')) and !$ui->escaped('email','post')) {
|
||||
|
||||
// Captcha match?
|
||||
if (!isset($_SESSION['registerToken']) or $ui->w('token',32,'post') != $_SESSION['registerToken']) $error[]=$page_sprache->registerErrorCookies;
|
||||
if (!isset($_SESSION['registerToken']) or $ui->w('token',32,'post') != $_SESSION['registerToken']) $error[] = $page_sprache->registerErrorCookies;
|
||||
|
||||
// E-Mail in use?
|
||||
if ($ui->ismail('mail','post')) {
|
||||
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `userdata` WHERE `mail`=? LIMIT 1");
|
||||
$query->execute(array($ui->ismail('mail','post')));
|
||||
if ($query->fetchColumn()>0) {
|
||||
$error[]=$page_sprache->registerErrorMail;
|
||||
$error[] = $page_sprache->registerErrorMail;
|
||||
$alert['email'] = true;
|
||||
} else {
|
||||
foreach (explode("\r\n",$registrationBadEmail) as $row) {
|
||||
if (strlen($row)>0 and substr($ui->ismail('mail','post'), -1*strlen($row))===$row and !in_array($page_sprache->registerErrorMail,$error)) {
|
||||
$error[]=$page_sprache->registerErrorMail;
|
||||
$error[] = $page_sprache->registerErrorMail;
|
||||
$alert['email'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error[]=$page_sprache->registerErrorMail;
|
||||
$error[] = $page_sprache->registerErrorMail;
|
||||
$alert['email'] = true;
|
||||
}
|
||||
|
||||
// TOU?
|
||||
if (isset($tou) and $ui->active('tou','post') != 'Y') {
|
||||
$error[]=$page_sprache->registerErrorTou;
|
||||
$error[] = $page_sprache->registerErrorTou;
|
||||
$alert['tou'] = true;
|
||||
}
|
||||
|
||||
// Password entered and stronger one?
|
||||
if ($ui->password('password',100,'post') and $ui->password('passwordsecond',100,'post') and $ui->password('password',100,'post') != $ui->password('passwordsecond',100,'post')) {
|
||||
$error[]=$page_sprache->registerErrorPassword;
|
||||
$error[] = $page_sprache->registerErrorPassword;
|
||||
$alert['password2'] = true;
|
||||
} else if ($ui->escaped('password','post') and !$ui->password('password',100,'post')) {
|
||||
$error[]=$page_sprache->registerErrorPassword2;
|
||||
$error[] = $page_sprache->registerErrorPassword2;
|
||||
$alert['password'] = true;
|
||||
} else if (!$ui->escaped('password','post')) {
|
||||
$error[]=$page_sprache->registerErrorPassword3;
|
||||
$error[] = $page_sprache->registerErrorPassword3;
|
||||
$alert['password'] = true;
|
||||
}
|
||||
|
||||
// IP blocked?
|
||||
if (count($error)>0) {
|
||||
foreach (explode("\r\n",$registrationBadIP) as $row) {
|
||||
if (strlen($row)>0 and substr($ui->ip('REMOTE_ADDR','server'),0,strlen($row))===$row and !in_array($page_sprache->registerErrorIP,$error)) $error[]=$page_sprache->registerErrorBot;
|
||||
if (strlen($row)>0 and substr($ui->ip('REMOTE_ADDR','server'),0,strlen($row))===$row and !in_array($page_sprache->registerErrorIP,$error)) $error[] = $page_sprache->registerErrorBot;
|
||||
}
|
||||
}
|
||||
|
||||
// If no error occurred go on otherwise display form again
|
||||
if(count($error)>0) {
|
||||
$token=md5(date('Y-d-m H:i:s u').md5(mt_rand()));
|
||||
$_SESSION['registerToken']=$token;
|
||||
$_SESSION['registerToken'] = $token;
|
||||
$template_file = 'page_register.tpl';
|
||||
} else {
|
||||
// personal Salt and activation md5
|
||||
@ -183,14 +183,14 @@ if (isset($registration) and in_array($registration, array('A','M','D'))) {
|
||||
// send Mail
|
||||
sendmail('emailregister',$userID,'',$page_data->pages['register']['link'].'activate/'.$activeHash.'/');
|
||||
} else {
|
||||
$_SESSION['userid']=$userID;
|
||||
$_SESSION['userid'] = $userID;
|
||||
$_SESSION['resellerid'] = 0;
|
||||
$template_file = $page_sprache->registerAccountOK;
|
||||
}
|
||||
} else {
|
||||
$error[]=$page_sprache->registerErrorUnknown;
|
||||
$error[] = $page_sprache->registerErrorUnknown;
|
||||
$token=md5(date('Y-d-m H:i:s u').md5(mt_rand()));
|
||||
$_SESSION['registerToken']=$token;
|
||||
$_SESSION['registerToken'] = $token;
|
||||
$template_file = 'page_register.tpl';
|
||||
}
|
||||
}
|
||||
@ -198,7 +198,7 @@ if (isset($registration) and in_array($registration, array('A','M','D'))) {
|
||||
$template_file = $page_sprache->registerErrorBot;
|
||||
} else {
|
||||
$token=md5(date('Y-d-m H:i:s u').md5(mt_rand()));
|
||||
$_SESSION['registerToken']=$token;
|
||||
$_SESSION['registerToken'] = $token;
|
||||
$template_file = 'page_register.tpl';
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$queryAffected+=$query->rowCount();
|
||||
$posted_languages = array();
|
||||
if (is_object($ui->st('language','post'))) {
|
||||
foreach ($ui->st('language','post') as $key=>$lg) $posted_languages[$key]=$lg;
|
||||
foreach ($ui->st('language','post') as $key=>$lg) $posted_languages[$key] = $lg;
|
||||
}
|
||||
$query = $sql->prepare("SELECT `id` FROM `page_pages` WHERE `type`='about' AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
@ -79,7 +79,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($about_id,$reseller_id));
|
||||
$lang_exist = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$lang_exist[]=$row['language'];
|
||||
$lang_exist[] = $row['language'];
|
||||
if (in_array($row['language'],$posted_languages)) {
|
||||
$query2->execute(array($ui->escaped('about','post', $row['language']),$about_id, $row['language'],$reseller_id));
|
||||
} else {
|
||||
@ -99,7 +99,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
$posted_touLanguages = array();
|
||||
if (is_object($ui->st('touLanguages','post'))) {
|
||||
foreach ($ui->st('touLanguages','post') as $key=>$lg) $posted_touLanguages[$key]=$lg;
|
||||
foreach ($ui->st('touLanguages','post') as $key=>$lg) $posted_touLanguages[$key] = $lg;
|
||||
}
|
||||
if (count($posted_touLanguages)>0) {
|
||||
$query = $sql->prepare("SELECT `lang` FROM `translations` WHERE `type`='to' AND `resellerID`=?");
|
||||
@ -108,7 +108,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($reseller_id));
|
||||
$lang_exist = array();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$lang_exist[]=$row['lang'];
|
||||
$lang_exist[] = $row['lang'];
|
||||
if (in_array($row['lang'],$posted_touLanguages)) {
|
||||
$query2->execute(array($ui->escaped('tou','post', $row['lang']), $row['lang'],$reseller_id));
|
||||
} else {
|
||||
@ -170,7 +170,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$about_id=$query->fetchColumn();
|
||||
$query = $sql->prepare("SELECT `language`,`text` FROM `page_pages_text` WHERE `pageid`=? AND `resellerid`=?");
|
||||
$query->execute(array($about_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $about_text[$row['language']]=$row['text'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $about_text[$row['language']] = $row['text'];
|
||||
$subpage = array();
|
||||
$query = $sql->prepare("SELECT p.`id`,t.`title` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` AND t.`language`=? WHERE p.`resellerid`=? AND p.`type`='page' ORDER BY t.`title`");
|
||||
$query2 = $sql->prepare("SELECT `title` FROM `page_pages_text` WHERE `pageid`=? AND `resellerid`=? ORDER BY `language` LIMIT 1");
|
||||
@ -181,7 +181,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) $page_title=$row2['title'];
|
||||
}
|
||||
$subpage[$row['id']]=$page_title;
|
||||
$subpage[$row['id']] = $page_title;
|
||||
}
|
||||
$default_language=$rSA['language'];
|
||||
$tous = array();
|
||||
@ -189,7 +189,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($languages as $row) {
|
||||
if (small_letters_check($row,2)) {
|
||||
$query->execute(array(1, $row,$reseller_id));
|
||||
$tous[$row]=$query->fetchColumn();
|
||||
$tous[$row] = $query->fetchColumn();
|
||||
}
|
||||
}
|
||||
$template_file = "admin_page_settings.tpl";
|
||||
|
@ -101,7 +101,7 @@ if (isset($search_tag) and $search_tag != '' and $search_tag != null) {
|
||||
} else {
|
||||
$row_link=$page_url.'/index.php?site='.$row['type'].'&id='.$row['id'];
|
||||
}
|
||||
$table[]=array('title'=>$row['title'],'text'=>nl2br($row['text']),'link'=>$row_link,'date'=>$row['date']);
|
||||
$table[]=array('title' => $row['title'],'text'=>nl2br($row['text']),'link' => $row_link,'date' => $row['date']);
|
||||
}
|
||||
$template_file = 'page_tag.tpl';
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (is_dir($dir)){
|
||||
$dirs=scandir($dir);
|
||||
foreach ($dirs as $row) {
|
||||
if (is_dir('template/'.$row) and !preg_match('/^\.(.*)$/', $row)) $templates[]=$row;
|
||||
if (is_dir('template/'.$row) and !preg_match('/^\.(.*)$/', $row)) $templates[] = $row;
|
||||
}
|
||||
}
|
||||
$selectlanguages=getlanguages($template_choosen);
|
||||
@ -201,7 +201,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$imprint=$row['imprint'];
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$query->rowCount(),'lang'=>$langrow2,'imprint'=>$imprint);
|
||||
$foundlanguages[]=array('style' => $query->rowCount(),'lang' => $langrow2,'imprint' => $imprint);
|
||||
}
|
||||
$template_file = "admin_settings.tpl";
|
||||
}
|
@ -118,7 +118,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$style='class="display_none"';
|
||||
$checkbox='<input id="inputCheckbox'.$row.'" type="checkbox" name="language[]" value="'.$row.'" onclick="textdrop('."'".$row."'".');" /> ';
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'class'=>$class,'lang'=>$row,'checkbox'=>$checkbox);
|
||||
$foundlanguages[]=array('style' => $style,'class' => $class,'lang' => $row,'checkbox' => $checkbox);
|
||||
}
|
||||
}
|
||||
$template_file = 'admin_settings_columns_add.tpl';
|
||||
@ -150,7 +150,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$class = '';
|
||||
$checkbox="<input id=\"inputCheckbox$ln\" type=\"checkbox\" name=\"language[]\" value=\"$ln\" onclick=\"textdrop('$ln');\" checked /> ";
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'class'=>$class,'lang'=>$ln,'checkbox'=>$checkbox,'text'=>$text);
|
||||
$foundlanguages[]=array('style' => $style,'class' => $class,'lang' => $ln,'checkbox' => $checkbox,'text' => $text);
|
||||
}
|
||||
$template_file = (isset($active)) ? 'admin_settings_columns_md.tpl' : 'admin_404.tpl';
|
||||
}
|
||||
@ -233,7 +233,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgAlt='Inactive';
|
||||
}
|
||||
$type=($row['type'] == 'I') ? $sprache->int : $sprache->var;
|
||||
$table[]=array('id'=>$row['customID'],'img'=>$imgName,'alt'=>$imgAlt,'name'=>$row['name'],'type'=>$type,'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['customID'],'img' => $imgName,'alt' => $imgAlt,'name' => $row['name'],'type' => $type,'active' => $row['active']);
|
||||
}
|
||||
$pageamount = ceil($colcount / $amount);
|
||||
$link='<a href="admin.php?w=cc&o='.$o.'&a=';
|
||||
@ -247,7 +247,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -169,7 +169,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($language,$what,$reseller_id));
|
||||
$xml=$query->fetchColumn();
|
||||
$style=($query->rowCount()==1) ? 1 : 0;
|
||||
return array('style'=>$style,'lang'=>$language,'xml'=>$xml);
|
||||
return array('style' => $style,'lang' => $language,'xml' => $xml);
|
||||
}
|
||||
$emailbackup_xml = array();
|
||||
$emailbackuprestore_xml = array();
|
||||
|
@ -51,6 +51,9 @@ function serverQuery ($ip, $port, $type) {
|
||||
|
||||
} else {
|
||||
|
||||
//5 seconds read timeout
|
||||
stream_set_timeout($socket, 5);
|
||||
|
||||
if ($type == 'gtasamp') {
|
||||
$ex = explode('.', $ip);
|
||||
$packet = 'SAMP' . chr($ex[0]) . chr($ex[1]) . chr($ex[2]) . chr($ex[3]) . chr($port & 0xFF) . chr($port >> 8 & 0xFF) . 'i';
|
||||
|
117
web/stuff/queries_updates.php
Normal file
117
web/stuff/queries_updates.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: queries_updates.php.
|
||||
* Author: Ulrich Block
|
||||
* Date: 03.10.13
|
||||
* Time: 21:35
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
function getCraftBukkitVersion ($follow = 'http://dl.bukkit.org/latest-rb/craftbukkit.jar', $start = false) {
|
||||
|
||||
// CaftBukkit does not offer an API where we can retrieve the current version
|
||||
// But they have redirect in place. So lets follow them and cut out the version
|
||||
|
||||
$follow = str_replace('http://', '', $follow);
|
||||
$splitUrl = preg_split('/\//', $follow, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$domain = $splitUrl[0];
|
||||
|
||||
$path = '';
|
||||
$i = 1;
|
||||
while ($i < count($splitUrl)) {
|
||||
$path .= '/' . $splitUrl[$i];
|
||||
$i++;
|
||||
}
|
||||
$fp = @fsockopen($domain, 80, $errno, $errstr,5);
|
||||
|
||||
$buffer = '';
|
||||
|
||||
if ($fp) {
|
||||
|
||||
$send = "GET $path HTTP/1.1\r\n";
|
||||
$send .= "Host: $domain\r\n";
|
||||
$send .= "User-Agent: easy-wi.com\r\n";
|
||||
$send .= "Connection: Close\r\n\r\n";
|
||||
|
||||
fwrite($fp, $send);
|
||||
|
||||
// small chunks and break out the loop once we have the header
|
||||
while (!feof($fp) and strpos($buffer, "\r\n\r\n") === false) {
|
||||
$buffer .= fgets($fp, 128);
|
||||
if (strpos($buffer, "\r\n\r\n") !== false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
|
||||
// finally a 200 instead of 301 or 302
|
||||
if (strpos(strtolower($buffer), 'http/1.1 200') !== false or strpos(strtolower($buffer), 'http/1.0 200') ==! false) {
|
||||
|
||||
$split = preg_split('/\//', $follow, -1, PREG_SPLIT_NO_EMPTY);
|
||||
return array('version' => $split[count($split) - 2], 'downloadPath' => 'http://' . $follow);
|
||||
|
||||
} else {
|
||||
|
||||
// Header parsing, the Location attribute is what we want
|
||||
foreach (explode("\r\n", $buffer) as $info) {
|
||||
|
||||
@list($key, $value) = explode(': ', $info);
|
||||
|
||||
if ($key == 'Location') {
|
||||
$redirectedTo = getCraftBukkitVersion($value);
|
||||
if (is_array($redirectedTo)) {
|
||||
return $redirectedTo;
|
||||
} else if ($start == false) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getMinecraftVersion($release = 'release') {
|
||||
|
||||
$responseBody = webhostRequest('s3.amazonaws.com', 'https://easy-wi.com', '/Minecraft.Download/versions/versions.json');
|
||||
|
||||
$json = @json_decode(cleanFsockOpenRequest($responseBody, '{', '}'));
|
||||
|
||||
if ($json) {
|
||||
return array('version' => $json->latest->$release, 'downloadPath' => 'http://s3.amazonaws.com/Minecraft.Download/versions/' . $json->latest->$release . '/minecraft_server.' . $json->latest->$release . '.jar');
|
||||
}
|
||||
|
||||
return array('version' => '', 'downloadPath' => '');
|
||||
}
|
@ -72,7 +72,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$type=($row['accounttype'] == 'u') ? $gsprache->user : $gsprache->reseller;
|
||||
$table[$row['id']]=$type . ' ' . trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
$table[$row['id']] = $type . ' ' . trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
}
|
||||
$id=$ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT * FROM `rootsDedicated` WHERE `dedicatedID`=? AND `resellerID`=? LIMIT 1");
|
||||
@ -150,7 +150,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['active'] != $active or $row['ip'] != $ip or $row['mac'] != $mac or $row['useDHCP'] != $useDHCP or $row['usePXE'] != $usePXE) {
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('D','de',NULL,?,?,?,?,NULL,NOW(),'md',?,?)");
|
||||
$query->execute(array($admin_id,$id,$userID,$ip,json_encode(array('oldactive'=>$row['active'],'oldip'=>$row['ip'],'oldmac'=>$row['mac'])),$reseller_id));
|
||||
$query->execute(array($admin_id,$id,$userID,$ip,json_encode(array('oldactive' => $row['active'],'oldip' => $row['ip'],'oldmac' => $row['mac'])),$reseller_id));
|
||||
}
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `rootsDedicated` SET `active`=?,`userID`=?,`description`=?,`ip`=?,`ips`=?,`restart`=?,`apiRequestType`=?,`apiRequestRestart`=?,`apiRequestStop`=?,`apiURL`=?,`https`=?,`mac`=?,`useDHCP`=?,`usePXE`=?,`externalID`=?,`jobPending`='Y' WHERE `dedicatedID`=? AND `resellerID`=?");
|
||||
@ -277,7 +277,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
$query = $sql->prepare("SELECT `id`,`description`,`bitversion` FROM `resellerimages` WHERE `description` NOT IN ('Rescue 32bit','Rescue 64bit') ORDER BY `distro`,`bitversion`,`description`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['description'] != 'Rescue 32bit' and $row['description'] != 'Rescue 64bit') $templates[]=array('id'=>$row['id'],'description'=>$row['description']);
|
||||
if ($row['description'] != 'Rescue 32bit' and $row['description'] != 'Rescue 64bit') $templates[]=array('id' => $row['id'],'description' => $row['description']);
|
||||
}
|
||||
$template_file = (isset($ip)) ? 'admin_root_dedicated_ri.tpl' : 'admin_404.tpl';
|
||||
} else if (in_array($ui->st('action','post'), array('ri','rc','rs','st'))) {
|
||||
@ -291,11 +291,11 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
if (isset($ip)) {
|
||||
$extraData = array();
|
||||
if ($ui->st('action','post') == 'ri') {
|
||||
$extraData['imageID']=$ui->id('imageid',10,'post');
|
||||
$extraData['imageID'] = $ui->id('imageid',10,'post');
|
||||
} else if ($ui->st('action','post') == 'rc') {
|
||||
$query = $sql->prepare("SELECT `id` FROM `resellerimages` WHERE `bitversion`=? AND `active`='Y' AND `distro`='other' AND `description` LIKE 'Rescue %' LIMIT 1");
|
||||
$query->execute(array($bitversion));
|
||||
$extraData['imageID']=$query->fetchColumn();
|
||||
$extraData['imageID'] = $query->fetchColumn();
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('D','de',NULL,?,?,NULL,?,NULL,NOW(),?,?,?)");
|
||||
$query->execute(array($admin_id,$id,$ip,$ui->st('action','post'),json_encode($extraData),$reseller_id));
|
||||
@ -387,7 +387,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
} else {
|
||||
$status=$sprache->ok;
|
||||
}
|
||||
$table[]=array('id'=>$row['dedicatedID'],'ip'=>$row['ip'],'description'=>$row['description'],'status'=>$status,'img'=>$imgName,'alt'=>$imgAlt,'userID'=>$row['userID'],'cname'=>$row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'active'=>$active,'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['dedicatedID'],'ip' => $row['ip'],'description' => $row['description'],'status' => $status,'img' => $imgName,'alt' => $imgAlt,'userID' => $row['userID'],'cname' => $row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'active' => $active,'jobPending' => $jobPending);
|
||||
}
|
||||
$pageamount = ceil($colcount / $amount);
|
||||
$link='<a href="admin.php?w=rp&o='.$o.'&a=';
|
||||
@ -395,7 +395,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lDs']) and $licen
|
||||
else $link .=$amount;
|
||||
if ($start==0) $link .='&p=0" class="bold">1</a>';
|
||||
else $link .='&p=0">1</a>';
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -59,7 +59,7 @@ if (in_array($ui->st('d','get'), array('md','ad'))){
|
||||
if (!in_array($ui->smallletters('action',2,'post'), array('md','ad')) and $ui->st('d','get') == 'md') {
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `decryptedport`,AES_DECRYPT(`user`,:aeskey) AS `decrypteduser`,AES_DECRYPT(`pass`,:aeskey) AS `decryptedpass` FROM `rootsDHCP` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$ip=$row['ip'];
|
||||
@ -117,11 +117,11 @@ if (in_array($ui->st('d','get'), array('md','ad'))){
|
||||
if ($ui->st('d','get') == 'md' and $ui->id('id',19,'get')) {
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("UPDATE `rootsDHCP` SET `active`=:active,`ip`=:ip,`ips`=:ips,`netmask`=:netmask,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`publickey`=:publickey,`keyname`=:keyname,`startCmd`=:startCmd,`dhcpFile`=:dhcpFile,`description`=:description,`subnetOptions`=:subnetOptions WHERE `id`=:id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':ips'=>$ips,':netmask'=>$netmask,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':publickey'=>$publickey,':keyname'=>$keyname,':startCmd'=>$startCmd,':dhcpFile'=>$dhcpFile,':description'=>$description,':subnetOptions'=>$subnetOptions,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':ips' => $ips,':netmask' => $netmask,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':startCmd' => $startCmd,':dhcpFile' => $dhcpFile,':description' => $description,':subnetOptions' => $subnetOptions,':id' => $id,':reseller_id' => $reseller_id));
|
||||
$loguseraction="%mod% DHCP";
|
||||
} else if ($ui->st('d','get') == 'ad') {
|
||||
$query = $sql->prepare("INSERT INTO `rootsDHCP` (`active`,`ip`,`ips`,`netmask`,`port`,`user`,`pass`,`publickey`,`keyname`,`startCmd`,`dhcpFile`,`description`,`subnetOptions`,`resellerid`) VALUES (:active,:ip,:ips,:netmask,AES_ENCRYPT(:port,:aeskey),AES_ENCRYPT(:user,:aeskey),AES_ENCRYPT(:pass,:aeskey),:publickey,:keyname,:startCmd,:dhcpFile,:description,:subnetOptions,:reseller_id)");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':ips'=>$ips,':netmask'=>$netmask,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':publickey'=>$publickey,':keyname'=>$keyname,':startCmd'=>$startCmd,':dhcpFile'=>$dhcpFile,':description'=>$description,':subnetOptions'=>$subnetOptions,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':ips' => $ips,':netmask' => $netmask,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':startCmd' => $startCmd,':dhcpFile' => $dhcpFile,':description' => $description,':subnetOptions' => $subnetOptions,':reseller_id' => $reseller_id));
|
||||
$loguseraction="%add% DHCP";
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
@ -192,7 +192,7 @@ if (in_array($ui->st('d','get'), array('md','ad'))){
|
||||
$imgName='16_bad';
|
||||
$imgAlt='Inactive';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'active'=>$row['active'],'ip'=>$row['ip'],'description'=>$row['description'],'img'=>$imgName,'alt'=>$imgAlt);
|
||||
$table[]=array('id' => $row['id'],'active' => $row['active'],'ip' => $row['ip'],'description' => $row['description'],'img' => $imgName,'alt' => $imgAlt);
|
||||
}
|
||||
$template_file = 'admin_root_dhcp_list.tpl';
|
||||
}
|
@ -61,7 +61,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (!in_array($ui->smallletters('action',2,'post'), array('md','ad')) and $ui->st('d','get') == 'md') {
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `decryptedport`,AES_DECRYPT(`user`,:aeskey) AS `decrypteduser`,AES_DECRYPT(`pass`,:aeskey) AS `decryptedpass` FROM `rootsPXE` WHERE `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$ip=$row['ip'];
|
||||
@ -113,11 +113,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($ui->st('d','get') == 'md' and $ui->id('id',19,'get')) {
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("UPDATE `rootsPXE` SET `active`=:active,`ip`=:ip,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`publickey`=:publickey,`keyname`=:keyname,`PXEFolder`=:PXEFolder,`description`=:description WHERE `id`=:id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':publickey'=>$publickey,':keyname'=>$keyname,':PXEFolder'=>$PXEFolder,':description'=>$description,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':PXEFolder' => $PXEFolder,':description' => $description,':id' => $id,':reseller_id' => $reseller_id));
|
||||
$loguseraction="%mod% PXE";
|
||||
} else if ($ui->st('d','get') == 'ad') {
|
||||
$query = $sql->prepare("INSERT INTO `rootsPXE` (`active`,`ip`,`port`,`user`,`pass`,`publickey`,`keyname`,`PXEFolder`,`description`,`resellerid`) VALUES (:active,:ip,AES_ENCRYPT(:port,:aeskey),AES_ENCRYPT(:user,:aeskey),AES_ENCRYPT(:pass,:aeskey),:publickey,:keyname,:PXEFolder,:description,:reseller_id)");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':publickey'=>$publickey,':keyname'=>$keyname,':PXEFolder'=>$PXEFolder,':description'=>$description,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':publickey' => $publickey,':keyname' => $keyname,':PXEFolder' => $PXEFolder,':description' => $description,':reseller_id' => $reseller_id));
|
||||
$loguseraction="%add% PXE";
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
@ -188,7 +188,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgName='16_bad';
|
||||
$imgAlt='Inactive';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'ip'=>$row['ip'],'description'=>$row['description'],'img'=>$imgName,'alt'=>$imgAlt,'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['id'],'ip' => $row['ip'],'description' => $row['description'],'img' => $imgName,'alt' => $imgAlt,'active' => $row['active']);
|
||||
}
|
||||
$template_file = 'admin_root_pxe_list.tpl';
|
||||
}
|
@ -122,7 +122,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$mhz=isid($ui->post['mhz'],"5");
|
||||
$ram=isinteger($ui->post['ram']);
|
||||
$pinsert=$sql->prepare("INSERT INTO `virtualhosts` (`active`,`esxi`,`ip`,`port`,`user`,`pass`,`os`,`description`,`publickey`,`keyname`,`cpu`,`cores`,`mhz`,`ram`,`maxserver`,`thin`,`thinquota`,`resellerid`) VALUES (:active, :esxi, :ip, AES_ENCRYPT(:port, :aeskey),AES_ENCRYPT(:user, :aeskey),AES_ENCRYPT(:pass, :aeskey),:os, :description, :publickey, :keyname, :cpu, :cores, :mhz, :ram, :maxserver, :thin, :thinquota, :reseller)");
|
||||
$pinsert->execute(array(':active'=>$active,':esxi'=>$esxi,':ip'=>$ip,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':os'=>$os,':description'=>$description,':publickey'=>$publickey,':keyname'=>$keyname, ':cpu'=>$cpu, ':cores'=>$cores,':mhz'=>$mhz,':ram'=>$ram,':maxserver'=>$maxserver,':thin'=>$thin,':thinquota'=>$thinquota,':reseller'=>$reseller));
|
||||
$pinsert->execute(array(':active' => $active,':esxi' => $esxi,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':os' => $os,':description' => $description,':publickey' => $publickey,':keyname' => $keyname, ':cpu' => $cpu, ':cores' => $cores,':mhz' => $mhz,':ram' => $ram,':maxserver' => $maxserver,':thin' => $thin,':thinquota' => $thinquota,':reseller' => $reseller));
|
||||
$serverid=$sql->lastInsertId();
|
||||
include(EASYWIDIR . '/stuff/ssh_exec.php');
|
||||
$uidb=ssh2_execute('vh',$serverid,'cd /vmfs/volumes; S = ''; for U in `ls -la | grep "drwxr-xr-t" | awk \'{print $9}\'`; do C=`vmkfstools -Ph $U 2> /dev/null | grep "Capacity" | awk \'{print $2$3}\'`; S="$S$U:$C;"; done; for U in `ls -la | grep "drwxrwxrwx" | awk \'{print $9}\'`; do C=`vmkfstools -Ph $U 2> /dev/null | grep "Capacity" | awk \'{print $2$3}\'`; S="$S$U:$C;"; done; echo $S');
|
||||
@ -197,7 +197,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$id=$ui->id('id', 10, 'get');
|
||||
if (!$ui->smallletters('action',2,'post')) {
|
||||
$query = $sql->prepare("SELECT `active`,`esxi`,`ip`,AES_DECRYPT(`port`,:aeskey) AS `decryptedport`,AES_DECRYPT(`user`,:aeskey) AS `decrypteduser`,AES_DECRYPT(`pass`,:aeskey) AS `decryptedpass`,`os`,`description`,`publickey`,`keyname`,`cpu`,`cores`,`mhz`,`hdd`,`ram`,`maxserver`,`thin`,`thinquota`,`resellerid` FROM `virtualhosts` WHERE `id`=:id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$esxi=$row['esxi'];
|
||||
@ -220,7 +220,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$resellerid=$row['resellerid'];
|
||||
}
|
||||
$query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `accounttype`='r' ORDER BY `id` DESC");
|
||||
$query->execute(array(':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $table[]=($resellerid==$row['id']) ? '<option value="'.$row['id'].'" selected="selected">'.$row['cname'].'</option>' : '<option value="'.$row['id'].'">'.$row['cname'].'</option>';
|
||||
$template_file = "admin_root_virtualhosts_md.tpl";
|
||||
} else if ($ui->smallletters('action',2,'post') == 'md'){
|
||||
@ -278,7 +278,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$hdd=startparameter($ui->post['hdd']);
|
||||
$maxserver=isid($ui->post['maxserver'],"3");
|
||||
$pinsert=$sql->prepare("UPDATE `virtualhosts` SET `active`=:active,`esxi`=:esxi,`ip`=:ip,`port`=AES_ENCRYPT(:port,:aeskey),`user`=AES_ENCRYPT(:user,:aeskey),`pass`=AES_ENCRYPT(:pass,:aeskey),`os`=:os,`description`=:description,`publickey`=:publickey,`keyname`=:keyname,`cpu`=:cpu,`cores`=:cores,`mhz`=:mhz,`hdd`=:hdd,`ram`=:ram,`maxserver`=:maxserver,`thin`=:thin,`thinquota`=:thinquota,`resellerid`=:reseller WHERE `id`=:id LIMIT 1");
|
||||
$pinsert->execute(array(':active'=>$active,':esxi'=>$esxi,':ip'=>$ip,':port'=>$port,':aeskey'=>$aeskey,':user'=>$user,':pass'=>$pass,':os'=>$os,':description'=>$description,':publickey'=>$publickey,':keyname'=>$keyname, ':cpu'=>$cpu, ':cores'=>$cores,':mhz'=>$mhz,':hdd'=>$hdd,':ram'=>$ram,':maxserver'=>$maxserver,':id'=>$id,':thin'=>$thin,':thinquota'=>$thinquota,':reseller'=>$reseller));
|
||||
$pinsert->execute(array(':active' => $active,':esxi' => $esxi,':ip' => $ip,':port' => $port,':aeskey' => $aeskey,':user' => $user,':pass' => $pass,':os' => $os,':description' => $description,':publickey' => $publickey,':keyname' => $keyname, ':cpu' => $cpu, ':cores' => $cores,':mhz' => $mhz,':hdd' => $hdd,':ram' => $ram,':maxserver' => $maxserver,':id' => $id,':thin' => $thin,':thinquota' => $thinquota,':reseller' => $reseller));
|
||||
$template_file = $spracheResponse->table_add;
|
||||
$loguseraction="%mod% %virtual% $ip";
|
||||
$insertlog->execute();
|
||||
@ -325,15 +325,15 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1])) {
|
||||
$mountpoint=$data_explode[0];
|
||||
$hdd[]=$mountpoint;
|
||||
$mountsize[$mountpoint]=$data_explode[1];
|
||||
$hdd[] = $mountpoint;
|
||||
$mountsize[$mountpoint] = $data_explode[1];
|
||||
$mountunused[$mountpoint] = 0;
|
||||
}
|
||||
}
|
||||
$i = 1;
|
||||
$cpucores = '';
|
||||
while ($i<=$cores) {
|
||||
$cpucores[]=$i;
|
||||
$cpucores[] = $i;
|
||||
$cpucore[$i] = 0;
|
||||
$i++;
|
||||
}
|
||||
@ -343,23 +343,23 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($pselect2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$mountpoint=$row2['mountpoint'];
|
||||
$addstracthdd=$mountunused[$mountpoint]+$row2['hddsize'];
|
||||
$mountunused[$mountpoint]=$addstracthdd;
|
||||
$mountunused[$mountpoint] = $addstracthdd;
|
||||
$addstractram=$ramused+$row2['minram'];
|
||||
$ramused=$addstractram;
|
||||
$cpuhz=$row2['cores']*$row2['minmhz'];
|
||||
$addcpu=$cpucore[1]+$cpuhz;
|
||||
if ($addcpu<=$mhz) {
|
||||
$cpucore[1]=$addcpu;
|
||||
$cpucore[1] = $addcpu;
|
||||
} else {
|
||||
$cpucore[1]=$mhz;
|
||||
$cpucore[1] = $mhz;
|
||||
$nextcore = 2;
|
||||
while ($nextcore<=$cores) {
|
||||
$extra=$addcpu-$mhz;
|
||||
$addcpu=$cpucore[$nextcore]+$extra;
|
||||
if ($addcpu<=$mhz and $addcpu>=0) {
|
||||
$cpucore[$nextcore]=$addcpu;
|
||||
$cpucore[$nextcore] = $addcpu;
|
||||
} else if ($addcpu>=0) {
|
||||
$cpucore[$nextcore]=$mhz;
|
||||
$cpucore[$nextcore] = $mhz;
|
||||
}
|
||||
$nextcore++;
|
||||
}
|
||||
@ -377,7 +377,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgAlt='Deactivated';
|
||||
}
|
||||
$installedserver=$i2. '/' . $row['maxserver'];
|
||||
$table[]=array('id'=>$id,'img'=>$imgName,'alt'=>$imgAlt,'ip'=>$row['ip'],'active'=>$row['active'],'description'=>$row['description'],'cores'=>$cores,'mhz'=>$mhz,'cpus'=>$cpucore,'hdd'=>$hdd,'ram'=>$ram,'ramused'=>$ramused,'mountsize'=>$mountsize,'mountunused'=>$mountunused,'installedserver'=>$installedserver);
|
||||
$table[]=array('id' => $id,'img' => $imgName,'alt' => $imgAlt,'ip' => $row['ip'],'active' => $row['active'],'description' => $row['description'],'cores' => $cores,'mhz' => $mhz,'cpus' => $cpucore,'hdd' => $hdd,'ram' => $ram,'ramused' => $ramused,'mountsize' => $mountsize,'mountunused' => $mountunused,'installedserver' => $installedserver);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `virtualhosts`");
|
||||
@ -408,7 +408,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -89,39 +89,39 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1])) {
|
||||
$mountpoint=$data_explode[0];
|
||||
$hdd[]=$mountpoint;
|
||||
$mountsize[$mountpoint]=$data_explode[1];
|
||||
$hdd[] = $mountpoint;
|
||||
$mountsize[$mountpoint] = $data_explode[1];
|
||||
$mountunused[$mountpoint] = 0;
|
||||
}
|
||||
}
|
||||
$i = 1;
|
||||
$cpucores = '';
|
||||
while ($i<=$cores) {
|
||||
$cpucores[]=$i;
|
||||
$cpucores[] = $i;
|
||||
$cpucore[$i] = 0;
|
||||
$i++;
|
||||
}
|
||||
$query2 = $sql->prepare("SELECT `cores`,`minmhz`,`maxmhz`,`hddsize`,`mountpoint`,`minram` FROM `virtualcontainer` WHERE `hostid`=:id");
|
||||
$query2->execute(array(':id'=>$id));
|
||||
$query2->execute(array(':id' => $id));
|
||||
$i2 = 0;
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$mountpoint=$row2['mountpoint'];
|
||||
$addstracthdd=$mountunused[$mountpoint]+($row2['hddsize']*($percent/100));
|
||||
$mountunused[$mountpoint]=$addstracthdd;
|
||||
$mountunused[$mountpoint] = $addstracthdd;
|
||||
$addstractram=$ramused+$row2['minram'];
|
||||
$ramused=$addstractram;
|
||||
$cpuhz=$row2['cores']*$row2['minmhz'];
|
||||
$addcpu=$cpucore[1]+$cpuhz;
|
||||
if ($addcpu<=$mhz) {
|
||||
$cpucore[1]=$addcpu;
|
||||
$cpucore[1] = $addcpu;
|
||||
} else {
|
||||
$cpucore[1]=$mhz;
|
||||
$cpucore[1] = $mhz;
|
||||
$nextcore = 2;
|
||||
while ($nextcore<=$cores) {
|
||||
$extra=$addcpu-$mhz;
|
||||
$addcpu=$cpucore[$nextcore]+$extra;
|
||||
if ($addcpu<=$mhz and $addcpu>=0) $cpucore[$nextcore]=$addcpu;
|
||||
else if ($addcpu>=0) $cpucore[$nextcore]=$mhz;
|
||||
if ($addcpu<=$mhz and $addcpu>=0) $cpucore[$nextcore] = $addcpu;
|
||||
else if ($addcpu>=0) $cpucore[$nextcore] = $mhz;
|
||||
$nextcore++;
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
if($cpucore[$i]==0) {
|
||||
$percentusedcpu[$i] = 0;
|
||||
} else {
|
||||
$percentusedcpu[$i]=$cpucore[$i]/($mhz/100);
|
||||
$percentusedcpu[$i] = $cpucore[$i]/($mhz/100);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -146,23 +146,23 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
unset($freespace);
|
||||
foreach ($hdd as $hdd_row) {
|
||||
$percentusedhdd[$hdd_row]=($mountunused[$hdd_row]==0) ? 0 : $mountunused[$hdd_row]/($mountsize[$hdd_row]/100);
|
||||
$freespace[$hdd_row]=$mountsize[$hdd_row]-($mountunused[$hdd_row]*($percent/100));
|
||||
$freespace[$hdd_row] = $mountsize[$hdd_row]-($mountunused[$hdd_row]*($percent/100));
|
||||
}
|
||||
natsort($freespace);
|
||||
$freespace=array_reverse($freespace);
|
||||
$serverused[$id]=array('ram'=>$ramused,'cpu'=>$cpucore,'server'=>$i2,'hdd'=>$mountunused,'freespace'=>$freespace);
|
||||
$serverused[$id]=array('ram' => $ramused,'cpu' => $cpucore,'server' => $i2,'hdd' => $mountunused,'freespace' => $freespace);
|
||||
if ($resellerid==$reseller_id) {
|
||||
$serverusage[$id]=array('ram'=>$percentusedram,'cpu'=>$percentusedcpu,'server'=>$percentserver,'hdd'=>$percentusedhdd,'freespace'=>$freespace);
|
||||
$table[]=array('id'=>$id,'ip'=>$row['ip']);
|
||||
$serverusage[$id]=array('ram' => $percentusedram,'cpu' => $percentusedcpu,'server' => $percentserver,'hdd' => $percentusedhdd,'freespace' => $freespace);
|
||||
$table[]=array('id' => $id,'ip' => $row['ip']);
|
||||
} else {
|
||||
$serverusage2[$id]=array('ram'=>$percentusedram,'cpu'=>$percentusedcpu,'server'=>$percentserver,'hdd'=>$percentusedhdd,'freespace'=>$freespace);
|
||||
$serverusage2[$id]=array('ram' => $percentusedram,'cpu' => $percentusedcpu,'server' => $percentserver,'hdd' => $percentusedhdd,'freespace' => $freespace);
|
||||
}
|
||||
}
|
||||
if (isset($serverusage) and is_array($serverusage)) {
|
||||
asort($serverusage);
|
||||
$bestserver=key($serverusage);
|
||||
$query = $sql->prepare("SELECT `cores`,`cpu`,`esxi`,`mhz`,`hdd`,`ram`,`maxserver` FROM `virtualhosts` WHERE `id`=:bestserver LIMIT 1");
|
||||
$query->execute(array(':bestserver'=>$bestserver));
|
||||
$query->execute(array(':bestserver' => $bestserver));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$mhz=$row['mhz'];
|
||||
$ram=$row['ram'];
|
||||
@ -173,7 +173,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$hdd = '';
|
||||
$i = 1;
|
||||
while ($i<=$row['cores']) {
|
||||
$core[]=$i;
|
||||
$core[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$i = 1;
|
||||
@ -183,7 +183,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$maxcore=$row['cores'];
|
||||
}
|
||||
while ($i<=$cores and $i<=$maxcore) {
|
||||
$add_core[]=$i;
|
||||
$add_core[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$hdd_rows=explode("\r\n", $row['hdd']);
|
||||
@ -191,11 +191,11 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1])) {
|
||||
$mountpoint=$data_explode[0];
|
||||
$mountsize[$mountpoint]=$data_explode[1];
|
||||
$mountsize[$mountpoint] = $data_explode[1];
|
||||
}
|
||||
}
|
||||
foreach ($serverused[$bestserver]['freespace'] as $mountpoint => $free) {
|
||||
$hdd[]=$mountpoint;
|
||||
$hdd[] = $mountpoint;
|
||||
if (!isset($firstfreespace)) {
|
||||
$firstfreespace=$free;
|
||||
}
|
||||
@ -219,7 +219,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$hdd = '';
|
||||
$i = 1;
|
||||
while ($i<=$row['cores']) {
|
||||
$core[]=$i;
|
||||
$core[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$i = 1;
|
||||
@ -229,7 +229,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$maxcore=$row['cores'];
|
||||
}
|
||||
while ($i<=$cores and $i<=$maxcore) {
|
||||
$add_core[]=$i;
|
||||
$add_core[] = $i;
|
||||
$i++;
|
||||
}
|
||||
$hdd_rows=explode("\r\n", $row['hdd']);
|
||||
@ -237,17 +237,17 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1])) {
|
||||
$mountpoint=$data_explode[0];
|
||||
$mountsize[$mountpoint]=$data_explode[1];
|
||||
$mountsize[$mountpoint] = $data_explode[1];
|
||||
}
|
||||
}
|
||||
foreach ($serverused[$bestserver]['freespace'] as $mountpoint => $free) {
|
||||
$hdd[]=$mountpoint;
|
||||
$hdd[] = $mountpoint;
|
||||
if (!isset($firstfreespace)) {
|
||||
$firstfreespace=$free;
|
||||
}
|
||||
}
|
||||
$firstpoint=$hdd[0];
|
||||
$table[]=array('id'=>$bestserver,'ip'=>$row['ip']);
|
||||
$table[]=array('id' => $bestserver,'ip' => $row['ip']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -295,7 +295,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$firstresellerip=current($checkedips);
|
||||
}
|
||||
$type=($row['accounttype'] == 'u') ? $gsprache->user : $gsprache->reseller;
|
||||
$reseller[$row['id']]=$type . ' ' . trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
$reseller[$row['id']] = $type . ' ' . trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
}
|
||||
if (!isset($firstresellerip) or !isip($firstresellerip,'all')) {
|
||||
$checkedips = array();
|
||||
@ -305,7 +305,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$query = $sql->prepare("SELECT `id`,`description`,`bitversion` FROM `resellerimages` ORDER BY `distro`,`bitversion`,`description`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$templates[]=array('id'=>$row['id'],'description'=>$row['description'] . ' ' . $row['bitversion']." Bit");
|
||||
$templates[]=array('id' => $row['id'],'description' => $row['description'] . ' ' . $row['bitversion']." Bit");
|
||||
}
|
||||
$template_file = "admin_root_vserver_add.tpl";
|
||||
} else if ($ui->smallletters('action',2,'post') == 'ad'){
|
||||
@ -405,7 +405,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
}
|
||||
if ($reseller_id != 0) {
|
||||
$query = $sql->prepare("SELECT `maxvserver`, `maxuserram`, `maxusermhz` FROM `resellerdata` WHERE `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$maxvserver=$row['maxvserver'];
|
||||
$maxuserram=$row['maxuserram'];
|
||||
@ -458,7 +458,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$hdd_rows=explode("\r\n", $row['hdd']);
|
||||
foreach ($hdd_rows as $hddline) {
|
||||
$data_explode=explode(" ", $hddline);
|
||||
if (isset($data_explode[1]) and $data_explode[0]==$mountpoint) {
|
||||
if (isset($data_explode[1]) and $data_explode[0] == $mountpoint) {
|
||||
$mountspace=$data_explode[1];
|
||||
}
|
||||
}
|
||||
@ -527,7 +527,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$row=$query->rowCount();
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `virtualcontainer` (`userid`,`hostid`,`ip`,`ips`,`mac`,`port`,`pass`,`cores`,`minmhz`,`maxmhz`,`hddsize`,`mountpoint`,`ram`,`minram`,`maxram`,`status`,`resellerid`) VALUES (:userid, :hostid, :ip, :ips, :mac, :port, AES_ENCRYPT(:pass, :aeskey), :cores, :minmhz, :maxmhz, :hddsize, :mountpoint, :ram, :minram, :maxram, :status, :resellerid)");
|
||||
$query->execute(array(':userid'=>$userid,':hostid'=>$hostid,':ip'=>$ip,':ips'=>$ips,':mac'=>$mac,':port' => '21',':pass'=>$pass,':aeskey'=>$aeskey,':cores'=>$cores,':minmhz'=>$minmhz,':maxmhz'=>$maxmhz,':hddsize'=>$hddsize,':mountpoint'=>$mountpoint,':ram'=>$ram,':minram'=>$minram,':maxram'=>$maxram,':status' => 0,':resellerid'=>$resellerid));
|
||||
$query->execute(array(':userid' => $userid,':hostid' => $hostid,':ip' => $ip,':ips' => $ips,':mac' => $mac,':port' => '21',':pass' => $pass,':aeskey' => $aeskey,':cores' => $cores,':minmhz' => $minmhz,':maxmhz' => $maxmhz,':hddsize' => $hddsize,':mountpoint' => $mountpoint,':ram' => $ram,':minram' => $minram,':maxram' => $maxram,':status' => 0,':resellerid' => $resellerid));
|
||||
if ($query->rowCount()>0) {
|
||||
$loguseraction="%add% %vserver% $ip Ram: $ram; MinRam: $minram; MaxRam: $maxram; Cores: $cores; MinMhz: $minmhz; MaxMhz: $maxmhz; HDD: $hddsize";
|
||||
$insertlog->execute();
|
||||
@ -581,13 +581,13 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
if (!$ui->smallletters('action',2,'post')) {
|
||||
if ($reseller_id==0) {
|
||||
$query = $sql->prepare("SELECT c.`active`,c.`ip`,c.`ips`,c.`mac`,c.`cores`,c.`minmhz`,c.`maxmhz`,c.`hddsize`,c.`mountpoint`,c.`ram`,c.`minram`,c.`maxram`,AES_DECRYPT(c.`pass`, :aeskey) AS `decryptedpass`,r.`description`,r.`bitversion`,u.`cname`,h.`cores` AS `hcore`,h.`esxi`,u.`id` AS `userid` FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.`imageid`=r.`id` LEFT JOIN `userdata` u ON c.`userid`=u.`id` LEFT JOIN `virtualhosts` h ON c.`hostid`=h.`id` WHERE c.`id`=:id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey));
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query = $sql->prepare("SELECT c.`active`,c.`ip`,c.`ips`,c.`mac`,c.`cores`,c.`minmhz`,c.`maxmhz`,c.`hddsize`,c.`mountpoint`,c.`ram`,c.`minram`,c.`maxram`,AES_DECRYPT(c.`pass`, :aeskey) AS `decryptedpass`,r.`description`,r.`bitversion`,u.`cname`,h.`cores` AS `hcore`,h.`esxi`,u.`id` AS `userid` FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.`imageid`=r.`id` LEFT JOIN `userdata` u ON c.`userid`=u.`id` LEFT JOIN `virtualhosts` h ON c.`hostid`=h.`id` WHERE c.`id`=:id AND c.`resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey,':reseller_id' => $reseller_id));
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT c.`active`,c.`ip`,c.`ips`,c.`mac`,c.`cores`,c.`minmhz`,c.`maxmhz`,c.`hddsize`,c.`mountpoint`,c.`ram`,c.`minram`,c.`maxram`,AES_DECRYPT(c.`pass`, :aeskey) AS `decryptedpass`,r.`description`,r.`bitversion`,u.`cname`,h.`cores` AS `hcore`,h.`esxi`,u.`id` AS `userid` FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.`imageid`=r.`id` LEFT JOIN `userdata` u ON c.`userid`=u.`id` LEFT JOIN `virtualhosts` h ON c.`hostid`=h.`id` WHERE c.`id`=:id AND c.`userid`=:admin_id AND c.`resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey,':admin_id'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey,':admin_id' => $admin_id,':reseller_id' => $reseller_id));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
@ -616,7 +616,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$maxcore=$row['hcore'];
|
||||
}
|
||||
while ($i<=$maxcore) {
|
||||
$cpucores[]=$i;
|
||||
$cpucores[] = $i;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -720,7 +720,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
if (is_array($postedips)) {
|
||||
foreach ($postedips as $postedip) {
|
||||
if (in_array($postedip, $freeips)) {
|
||||
$checked_ips[]=$postedip;
|
||||
$checked_ips[] = $postedip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -732,7 +732,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ui->post['ip']==$oldip or in_array($ui->post['ip'],$freeips)) {
|
||||
if ($ui->post['ip'] == $oldip or in_array($ui->post['ip'],$freeips)) {
|
||||
$ip=$ui->post['ip'];
|
||||
} else if(isset($checked_ips[0]) and isip($checked_ips[0],'all')) {
|
||||
$ip=$checked_ips[0];
|
||||
@ -760,17 +760,17 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$mac=$ui->post['mac'];
|
||||
if ($reseller_id==0) {
|
||||
$query = $sql->prepare("UPDATE `virtualcontainer` SET `active`=:active, `ip`=:ip, `ips`=:ips,`mac`=:mac,`cores`=:cores, minmhz=:minmhz, maxmhz=:maxmhz, hddsize=:hddsize, ram=:ram, minram=:minram, maxram=:maxram WHERE `id`=:id LIMIT 1");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':ips'=>$ips,':mac'=>$mac,':cores'=>$cores,':minmhz'=>$minmhz,':maxmhz'=>$maxmhz,':hddsize'=>$hddsize,':ram'=>$ram,':minram'=>$minram,':maxram'=>$maxram,':id'=>$id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':ips' => $ips,':mac' => $mac,':cores' => $cores,':minmhz' => $minmhz,':maxmhz' => $maxmhz,':hddsize' => $hddsize,':ram' => $ram,':minram' => $minram,':maxram' => $maxram,':id' => $id));
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query = $sql->prepare("UPDATE `virtualcontainer` SET `active`=:active, `ip`=:ip, `ips`=:ips,`mac`=:mac,`cores`=:cores, minmhz=:minmhz, maxmhz=:maxmhz, hddsize=:hddsize, ram=:ram, minram=:minram, maxram=:maxram WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':ips'=>$ips,':mac'=>$mac,':cores'=>$cores,':minmhz'=>$minmhz,':maxmhz'=>$maxmhz,':hddsize'=>$hddsize,':ram'=>$ram,':minram'=>$minram,':maxram'=>$maxram,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':ips' => $ips,':mac' => $mac,':cores' => $cores,':minmhz' => $minmhz,':maxmhz' => $maxmhz,':hddsize' => $hddsize,':ram' => $ram,':minram' => $minram,':maxram' => $maxram,':id' => $id,':reseller_id' => $reseller_id));
|
||||
} else {
|
||||
$query = $sql->prepare("UPDATE `virtualcontainer` SET `active`=:active, `ip`=:ip, `ips`=:ips,`mac`=:mac,`cores`=:cores, minmhz=:minmhz, maxmhz=:maxmhz, hddsize=:hddsize, ram=:ram, minram=:minram, maxram=:maxram WHERE `id`=:id AND `userid`=:userid AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':active'=>$active,':ip'=>$ip,':ips'=>$ips,':mac'=>$mac,':cores'=>$cores,':minmhz'=>$minmhz,':maxmhz'=>$maxmhz,':hddsize'=>$hddsize,':ram'=>$ram,':minram'=>$minram,':maxram'=>$maxram,':id'=>$id,':userid'=>$userid,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':active' => $active,':ip' => $ip,':ips' => $ips,':mac' => $mac,':cores' => $cores,':minmhz' => $minmhz,':maxmhz' => $maxmhz,':hddsize' => $hddsize,':ram' => $ram,':minram' => $minram,':maxram' => $maxram,':id' => $id,':userid' => $userid,':reseller_id' => $reseller_id));
|
||||
}
|
||||
if ($oldmac != $mac or $oldcores != $cores or $oldminmhz != $minmhz or $oldmaxmhz != $maxmhz or $oldhddsize != $hddsize or $oldram != $ram or $oldminram != $minram or $oldmaxram != $maxram or $oldactive != $active) {
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('D','vs',NULL,?,?,?,?,NULL,NOW(),'md',?,?)");
|
||||
$query->execute(array($admin_id,$id,$userid,$ip,json_encode(array('oldactive'=>$row['active'],'oldip'=>$row['ip'],'oldmac'=>$row['mac'])),$reseller_id));
|
||||
$query->execute(array($admin_id,$id,$userid,$ip,json_encode(array('oldactive' => $row['active'],'oldip' => $row['ip'],'oldmac' => $row['mac'])),$reseller_id));
|
||||
}
|
||||
if ($query->rowCount()>0) {
|
||||
$loguseraction="%mod% %vserver% $ip Ram: $ram; MinRam: $minram; MaxRam: $maxram; Cores: $cores; MinMhz: $minmhz; MaxMhz: $maxmhz; HDD: $hddsize";
|
||||
@ -789,13 +789,13 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$option = array();
|
||||
if ($reseller_id==0) {
|
||||
$query = $sql->prepare("SELECT c.ip,c.status,AES_DECRYPT(c.pass, :aeskey) AS decryptedpass,r.description,r.bitversion FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.imageid=r.id WHERE c.id=:id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey));
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$query = $sql->prepare("SELECT c.ip,c.status,AES_DECRYPT(c.pass, :aeskey) AS decryptedpass,r.description,r.bitversion FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.imageid=r.id WHERE c.id=:id AND c.resellerid=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey,':reseller_id' => $reseller_id));
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT c.ip,c.status,AES_DECRYPT(c.pass, :aeskey) AS decryptedpass,r.description,r.bitversion FROM `virtualcontainer` c LEFT JOIN `resellerimages` r ON c.imageid=r.id WHERE c.id=:id AND c.userid=:userid AND c.resellerid=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':id'=>$id,':aeskey'=>$aeskey,':userid'=>$admin_id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':id' => $id,':aeskey' => $aeskey,':userid' => $admin_id,':reseller_id' => $reseller_id));
|
||||
}
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$ip=$row['ip'];
|
||||
@ -823,7 +823,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
$query = $sql->prepare("SELECT `id`,`description`,`bitversion` FROM `resellerimages` ORDER BY `distro`,`bitversion`,`description`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['description'] != 'Rescue 32bit' and $row['description'] != 'Rescue 64bit') $templates[]=array('id'=>$row['id'],'description'=>$row['description']);
|
||||
if ($row['description'] != 'Rescue 32bit' and $row['description'] != 'Rescue 64bit') $templates[]=array('id' => $row['id'],'description' => $row['description']);
|
||||
}
|
||||
$template_file = "admin_root_vserver_re.tpl";
|
||||
} else if (in_array($ui->st('action','post'), array('ri','rc','rs','st'))) {
|
||||
@ -839,11 +839,11 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
if (isset($ip)) {
|
||||
$extraData = array();
|
||||
if ($ui->st('action','post') == 'ri') {
|
||||
$extraData['imageID']=$ui->id('imageid',10,'post');
|
||||
$extraData['imageID'] = $ui->id('imageid',10,'post');
|
||||
} else if ($ui->st('action','post') == 'rc') {
|
||||
$query = $sql->prepare("SELECT `id` FROM `resellerimages` WHERE `bitversion`=? AND `active`='Y' AND `distro`='other' AND `description` LIKE 'Rescue %' LIMIT 1");
|
||||
$query->execute(array($bitversion));
|
||||
$extraData['imageID']=$query->fetchColumn();
|
||||
$extraData['imageID'] = $query->fetchColumn();
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('D','vs',?,?,?,?,?,NULL,NOW(),?,?,?)");
|
||||
$query->execute(array($hostid,$admin_id,$id,$userID,$ip,$ui->st('action','post'),json_encode($extraData),$reseller_id));
|
||||
@ -927,7 +927,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
} else if ($row['active'] == 'N') {
|
||||
$active = 'N';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'active'=>$active,'cip'=>$row['ip'],'cores'=>$row['cores'],'minmhz'=>$row['minmhz'],'maxmhz'=>$row['maxmhz'],'hddsize'=>$row['hddsize'],'ram'=>$row['ram'],'minram'=>$row['minram'],'maxram'=>$row['maxram'],'status'=>$status,'idescription'=>$row['idescription'],'bitversion'=>$row['bitversion'],'hip'=>$row['hip'],'hid'=>$row['hid'],'hdescription'=>$row['hdescription'],'cname'=>$row['cname'],'userid'=>$row['userid'],'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['id'],'active' => $active,'cip' => $row['ip'],'cores' => $row['cores'],'minmhz' => $row['minmhz'],'maxmhz' => $row['maxmhz'],'hddsize' => $row['hddsize'],'ram' => $row['ram'],'minram' => $row['minram'],'maxram' => $row['maxram'],'status' => $status,'idescription' => $row['idescription'],'bitversion' => $row['bitversion'],'hip' => $row['hip'],'hid' => $row['hid'],'hdescription' => $row['hdescription'],'cname' => $row['cname'],'userid' => $row['userid'],'jobPending' => $jobPending);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
if ($reseller_id==0) {
|
||||
@ -966,7 +966,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVs']) and $licen
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -155,7 +155,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT * FROM `resellerimages` ORDER BY $orderby");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('id'=>$row['id'],'distro'=>$row['distro'],'description'=>$row['description'],'bitversion'=>$row['bitversion']);
|
||||
$table[]=array('id' => $row['id'],'distro' => $row['distro'],'description' => $row['description'],'bitversion' => $row['bitversion']);
|
||||
}
|
||||
$template_file = 'admin_root_templates_list.tpl';
|
||||
}
|
@ -57,6 +57,8 @@ if (isset($debug) and $debug==1) {
|
||||
$dbConnect['debug'] = 1;
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL|E_STRICT);
|
||||
} else {
|
||||
$dbConnect['debug'] = 0;
|
||||
}
|
||||
try {
|
||||
$dbConnect['connect']="${dbConnect['type']}:host=${dbConnect['host']};dbname=${dbConnect['db']}";
|
||||
@ -74,9 +76,11 @@ try {
|
||||
$insertlog->bindParam(':ip', $loguserip);
|
||||
$insertlog->bindParam(':hostname', $userHostname);
|
||||
$insertlog->bindParam(':reseller_id', $reseller_id);
|
||||
|
||||
if ($ui->ip('REMOTE_ADDR','server')) {
|
||||
$loguserip = $ui->ip('REMOTE_ADDR','server');
|
||||
$userHostname = @gethostbyaddr($ui->ip('REMOTE_ADDR','server'));
|
||||
|
||||
} else {
|
||||
$loguserip = 'localhost';
|
||||
$userHostname = 'localhost';
|
||||
@ -85,22 +89,31 @@ try {
|
||||
catch(PDOException $error) {
|
||||
die($error->getMessage());
|
||||
}
|
||||
|
||||
$page_url=($ui->escaped ('HTTPS','server')) ? 'https://'.$ui->domain('HTTP_HOST','server') : 'http://'.$ui->domain('HTTP_HOST','server');
|
||||
|
||||
if ($loguserip != 'localhost') {
|
||||
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION['userid']) and is_numeric($_SESSION['userid']) and isset($_SESSION['adminid']) and is_numeric($_SESSION['adminid'])) {
|
||||
$user_id = $_SESSION['userid'];
|
||||
$admin_id = $_SESSION['adminid'];
|
||||
|
||||
} else if(isset($_SESSION['userid']) and is_numeric($_SESSION['userid'])) {
|
||||
$user_id = $_SESSION['userid'];
|
||||
|
||||
} else if (isset($_SESSION['adminid']) and is_numeric($_SESSION['adminid'])) {
|
||||
$admin_id = $_SESSION['adminid'];
|
||||
}
|
||||
|
||||
if (isset($_SESSION['resellerid']) and is_numeric($_SESSION['resellerid'])) {
|
||||
$reseller_id = $_SESSION['resellerid'];
|
||||
}
|
||||
|
||||
if (isset($_SESSION['HTTP_USER_AGENT']) and isset($_SESSION['REMOTE_ADDR'])){
|
||||
if ($_SESSION['HTTP_USER_AGENT']!=md5($ui->escaped('HTTP_USER_AGENT','server')) or $_SESSION['REMOTE_ADDR']!=md5($ui->ip('REMOTE_ADDR','server'))){
|
||||
|
||||
if ($_SESSION['HTTP_USER_AGENT'] != md5($ui->escaped('HTTP_USER_AGENT','server')) or $_SESSION['REMOTE_ADDR'] != md5($ui->ip('REMOTE_ADDR','server'))){
|
||||
session_unset();
|
||||
session_destroy();
|
||||
if (isset($page_include)) {
|
||||
@ -114,7 +127,9 @@ if ($loguserip != 'localhost') {
|
||||
$_SESSION['HTTP_USER_AGENT'] = md5($ui->escaped('HTTP_USER_AGENT','server'));
|
||||
}
|
||||
}
|
||||
|
||||
$rSA = array();
|
||||
|
||||
if (isset($reseller_id)) {
|
||||
$query = $sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
@ -123,24 +138,31 @@ if (isset($reseller_id)) {
|
||||
$rSA[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$resellerstimezone = $rSA['timezone'];
|
||||
$template_to_use = $rSA['template'];
|
||||
$downChecks = $rSA['down_checks'];
|
||||
$logdate = date('Y-m-d H:i:s', strtotime($resellerstimezone .' hour'));
|
||||
|
||||
if (isset($user_id) and !isset($admin_id)) {
|
||||
$lookupid = $reseller_id;
|
||||
|
||||
} else {
|
||||
$check_split = preg_split("/\//", $ui->escaped('SCRIPT_NAME','server'),-1,PREG_SPLIT_NO_EMPTY);
|
||||
$which_file = $check_split[count($check_split)-1];
|
||||
|
||||
if ($which_file == 'userpanel.php') {
|
||||
$lookupid = $reseller_id;
|
||||
|
||||
} else {
|
||||
$lookupid = ($reseller_id == $admin_id) ? 0 : $reseller_id;
|
||||
}
|
||||
}
|
||||
|
||||
$query = $sql->prepare("SELECT `supportnumber` FROM `settings` WHERE `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($lookupid));
|
||||
$support_phonenumber = $query->fetchColumn();
|
||||
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT * FROM `settings` WHERE `resellerid`=0 LIMIT 1");
|
||||
$query->execute();
|
||||
@ -149,13 +171,20 @@ if (isset($reseller_id)) {
|
||||
$rSA[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$template_to_use = $rSA['template'];
|
||||
$support_phonenumber = $rSA['supportnumber'];
|
||||
$logdate = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if ($loguserip!='localhost') {
|
||||
if (isset($_SESSION['language'])) $user_language = $_SESSION['language'];
|
||||
|
||||
if (isset($_SESSION['language'])) {
|
||||
$user_language = $_SESSION['language'];
|
||||
}
|
||||
|
||||
if (isset($page_include)) {
|
||||
|
||||
$query = $sql->prepare("SELECT * FROM `page_settings` WHERE `resellerid`='0' LIMIT 1");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
@ -178,25 +207,34 @@ if ($loguserip!='localhost') {
|
||||
$commentsModerated = $row['commentsModerated'];
|
||||
$honeyPotKey = $row['honeyPotKey'];
|
||||
}
|
||||
|
||||
$ewInstallPath = EASYWIDIR;
|
||||
|
||||
$elements=(!empty($ewInstallPath) and strpos($ui->escaped('REQUEST_URI','server'), $ewInstallPath)===false) ? preg_split('/\//', $ui->escaped('REQUEST_URI','server'),-1,PREG_SPLIT_NO_EMPTY) : preg_split('/\//',substr($ui->escaped('REQUEST_URI','server'),strlen($ewInstallPath)),-1,PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
if (isset($seo) and $seo== 'Y' and isset($elements[0])) {
|
||||
|
||||
$page_detect_language = $elements[0];
|
||||
|
||||
if (substr($ui->escaped('REQUEST_URI','server'),-1) != '/' and !$ui->w('site',50, 'get')) {
|
||||
$throw404 = true;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[a-z]{2}+$/', $elements[0]) and !$ui->w('site',50, 'get')) {
|
||||
$throw404 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($elements[1]) and $elements[1] != '') {
|
||||
$page_category=strtolower($elements[1]);
|
||||
$page_category = strtolower($elements[1]);
|
||||
}
|
||||
|
||||
if (isset($elements[2]) and $elements[2] != '') {
|
||||
$page_name=strtolower($elements[2]);
|
||||
$page_name = strtolower($elements[2]);
|
||||
}
|
||||
|
||||
if (isset($elements[3]) and $elements[3] != '') {
|
||||
$page_count=strtolower($elements[3]);
|
||||
$page_count = strtolower($elements[3]);
|
||||
}
|
||||
}
|
||||
if (!isset($user_language) and isset($user_id) and isset($admin_id)) {
|
||||
|
@ -46,7 +46,7 @@ if (!function_exists('ssh2_execute')) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`port`,:aeskey) AS `decryptedport`,AES_DECRYPT(`user`,:aeskey) AS `decrypteduser`,AES_DECRYPT(`pass`,:aeskey) AS `decryptedpass` FROM `virtualhosts` WHERE `id`=:serverID LIMIT 1");
|
||||
}
|
||||
if (isset($query)) {
|
||||
$query->execute(array(':serverID'=>$id,':aeskey'=>$aeskey));
|
||||
$query->execute(array(':serverID' => $id,':aeskey' => $aeskey));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$serverID=$row['id'];
|
||||
$resellerID=$row['resellerid'];
|
||||
@ -62,7 +62,7 @@ if (!function_exists('ssh2_execute')) {
|
||||
$pubkey=EASYWIDIR . '/keys/'.$sshkey.'.pub';
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
$ssh2Socket=($ssh2Publickey == 'Y') ? (file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($ssh2IP,$ssh2Port, array('hostkey'=>'ssh-rsa')) : false : @ssh2_connect($ssh2IP,$ssh2Port);
|
||||
$ssh2Socket=($ssh2Publickey == 'Y') ? (file_exists($pubkey) and file_exists($key)) ? @ssh2_connect($ssh2IP,$ssh2Port, array('hostkey' => 'ssh-rsa')) : false : @ssh2_connect($ssh2IP,$ssh2Port);
|
||||
if ($ssh2Socket==true) {
|
||||
$ssh2Connect=($ssh2Publickey == 'Y') ? @ssh2_auth_pubkey_file($ssh2Socket,$ssh2User,$pubkey,$key) : @ssh2_auth_password($ssh2Socket,$ssh2User,$ssh2Pass);
|
||||
if ($ssh2Connect==true) {
|
||||
|
@ -696,7 +696,7 @@ $query="CREATE TABLE IF NOT EXISTS `rservermasterg` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`serverid` varchar(11) NOT NULL,
|
||||
`servertypeid` int(10) unsigned DEFAULT NULL,
|
||||
`localVersion` varchar(20) NULL,
|
||||
`localVersion` varchar(255) NULL,
|
||||
`installing` enum('Y','N') DEFAULT 'N',
|
||||
`updating` enum('Y','N') DEFAULT 'N',
|
||||
`installstarted` datetime NOT NULL,
|
||||
@ -842,6 +842,7 @@ $query="CREATE TABLE IF NOT EXISTS `servertypes` (
|
||||
`portFour` smallint(5) unsigned DEFAULT 27018,
|
||||
`portFive` smallint(5) unsigned DEFAULT 27019,
|
||||
`protected` enum('Y','N') NOT NULL DEFAULT 'Y',
|
||||
`downloadPath` text,
|
||||
`resellerid` int(10) unsigned DEFAULT 0,
|
||||
PRIMARY KEY (`id`),KEY(`appID`),KEY(`resellerid`)
|
||||
) ENGINE=InnoDB";
|
||||
|
@ -604,7 +604,7 @@ $defined['rserverdata']=array('id'=>array("Type"=>"int(10) unsigned","Null"=>"NO
|
||||
$defined['rservermasterg']=array('id'=>array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
|
||||
'serverid'=>array("Type"=>"varchar(11)","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'servertypeid'=>array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"","Extra"=>""),
|
||||
'localVersion'=>array("Type"=>"varchar(20)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'localVersion'=>array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'installing'=>array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
|
||||
'updating'=>array("Type"=>"enum('Y','N')","Null"=>"YES","Key"=>"","Default"=>"N","Extra"=>""),
|
||||
'installstarted'=>array("Type"=>"datetime","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
|
||||
@ -639,7 +639,7 @@ $defined['serverlist']=array('id'=>array("Type"=>"int(10) unsigned","Null"=>"NO"
|
||||
$defined['servertypes']=array('id'=>array("Type"=>"int(10) unsigned","Null"=>"NO","Key"=>"PRI","Default"=>"","Extra"=>"auto_increment"),
|
||||
'steamgame'=>array("Type"=>"enum('Y','N','S')","Null"=>"NO","Key"=>"","Default"=>"Y","Extra"=>""),
|
||||
'appID'=>array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"","Extra"=>""),
|
||||
'steamVersion'=>array("Type"=>"varchar(20)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'steamVersion'=>array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'updates'=>array("Type"=>"smallint(1) unsigned","Null"=>"YES","Key"=>"","Default"=>"1","Extra"=>""),
|
||||
'shorten'=>array("Type"=>"varchar(20)","Null"=>"NO","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'description'=>array("Type"=>"varchar(255)","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
@ -670,6 +670,7 @@ $defined['servertypes']=array('id'=>array("Type"=>"int(10) unsigned","Null"=>"NO
|
||||
'portFour'=>array("Type"=>"smallint(5) unsigned","Null"=>"YES","Key"=>"","Default"=>"27018","Extra"=>""),
|
||||
'portFive'=>array("Type"=>"smallint(5) unsigned","Null"=>"YES","Key"=>"","Default"=>"27019","Extra"=>""),
|
||||
'protected'=>array("Type"=>"enum('Y','N')","Null"=>"NO","Key"=>"","Default"=>"Y","Extra"=>""),
|
||||
'downloadPath'=>array("Type"=>"text","Null"=>"YES","Key"=>"","Default"=>"","Extra"=>""),
|
||||
'resellerid'=>array("Type"=>"int(10) unsigned","Null"=>"YES","Key"=>"MUL","Default"=>"0","Extra"=>"")
|
||||
);
|
||||
|
||||
@ -1275,11 +1276,11 @@ foreach ($defined as $table => $t_p) {
|
||||
$properties=$t_p[$Field];
|
||||
foreach ($row as $key=>$value) {
|
||||
if ($key != 'Field' and $key != 'Key' and !in_array($Field,$key_differ) and $properties[$key] != $value) {
|
||||
$key_differ[]=$Field;
|
||||
$key_differ[] = $Field;
|
||||
} else if ($key == 'Key' and $value == '' and $properties['Key'] == 'MUL') {
|
||||
$addIndex[]=$Field;
|
||||
$addIndex[] = $Field;
|
||||
} else if ($key == 'Key' and $value == 'MUL' and $properties['Key'] == '') {
|
||||
$removeIndex[]=$Field;
|
||||
$removeIndex[] = $Field;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -65,7 +65,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$style='display_none';
|
||||
$checkbox="<input type=\"checkbox\" name=\"language[]\" value=\"$row\" onclick=\"textdrop('$row');\" /> ";
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'lang'=>$row,'checkbox'=>$checkbox,'checked'=>$checked);
|
||||
$foundlanguages[]=array('style' => $style,'lang' => $row,'checkbox' => $checkbox,'checked' => $checked);
|
||||
}
|
||||
$query = $sql->prepare("SELECT `id`,`topic` FROM `ticket_topics` WHERE `id`=maintopic AND `resellerid`=?");
|
||||
$query2 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='ti' AND `lang`=? AND `transID`=? AND `resellerID`=? LIMIT 1");
|
||||
@ -100,7 +100,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$id=$sql->lastInsertId();
|
||||
if ($maintopic=="none") {
|
||||
$query = $sql->prepare("UPDATE `ticket_topics` SET `maintopic`=:id, priority='NULL' WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':id'=> $id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':id'=> $id,':reseller_id' => $reseller_id));
|
||||
}
|
||||
if (isset($ui->post['language'])) {
|
||||
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ti',?,?,?,?) ON DUPLICATE KEY UPDATE `resellerID`=`resellerID`");
|
||||
@ -184,7 +184,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (empty($topics)) {
|
||||
$topics=$row['topic'];
|
||||
}
|
||||
if ($row['id']==$maintopic) {
|
||||
if ($row['id'] == $maintopic) {
|
||||
$options[]="<option value=\"".$row['id']."\" selected=\"selected\">".$topics."</option>";
|
||||
} else {
|
||||
$options[]="<option value=\"".$row['id']."\">".$topics."</option>";
|
||||
@ -209,7 +209,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$checked = '';
|
||||
$checkbox="<input type=\"checkbox\" name=\"language[]\" value=\"$langrow2\" onclick=\"textdrop('$langrow2');\" /> ";
|
||||
}
|
||||
$foundlanguages[]=array('style'=>$style,'lang'=>$langrow2,'checkbox'=>$checkbox,'checked'=>$checked,'subject' => stripslashes($subject));
|
||||
$foundlanguages[]=array('style' => $style,'lang' => $langrow2,'checkbox' => $checkbox,'checked' => $checked,'subject' => stripslashes($subject));
|
||||
}
|
||||
$template_file = "admin_ticket_topic_md.tpl";
|
||||
} else if ($ui->smallletters('action',2,'post') == 'md' and $ui->id('id',19,'get')){
|
||||
@ -223,7 +223,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$priority = '';
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `ticket_topics` SET `topic`=:topic,`maintopic`=:maintopic,`priority`=:priority WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':topic'=> $topic_name, ':maintopic'=> $maintopic, ':priority'=> $priority, ':id'=> $id, ':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':topic'=> $topic_name, ':maintopic'=> $maintopic, ':priority'=> $priority, ':id'=> $id, ':reseller_id' => $reseller_id));
|
||||
if (isset($ui->post['language'])) {
|
||||
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('ti',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
|
||||
foreach($ui->post['language'] as $language) {
|
||||
@ -291,7 +291,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$topic=$row2['topic'];
|
||||
}
|
||||
if ($row2['id']==$row2['maintopic']) {
|
||||
if ($row2['id'] == $row2['maintopic']) {
|
||||
$maintopic = '';
|
||||
$mTopic = '';
|
||||
} else {
|
||||
@ -308,7 +308,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
$maintopic=' - ';
|
||||
}
|
||||
$table[]=array('id'=>$row2['id'],'topic'=>$topic,'maintopic'=>$maintopic,'mTopic'=>$mTopic,'priority'=>$priority);
|
||||
$table[]=array('id' => $row2['id'],'topic' => $topic,'maintopic' => $maintopic,'mTopic' => $mTopic,'priority' => $priority);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$countp=$sql->prepare("SELECT `id` FROM `ticket_topics` WHERE `resellerid`=?");
|
||||
@ -337,7 +337,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
@ -457,7 +457,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$where='WHERE t.`resellerid`=?';
|
||||
if (isset($ui->get['ts'])) {
|
||||
foreach ($ui->get['ts'] as $get) {
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[]=$get;
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[] = $get;
|
||||
}
|
||||
} else {
|
||||
$selected=array('N','P','R');
|
||||
@ -467,7 +467,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($selected as $get) {
|
||||
if ($i==0) $temp.="`state`='${get}'";
|
||||
else $temp.=" OR `state`='${get}'";
|
||||
if (!in_array($get,$selected)) $selected[]=$get;
|
||||
if (!in_array($get,$selected)) $selected[] = $get;
|
||||
$i++;
|
||||
}
|
||||
$temp.=')';
|
||||
@ -584,7 +584,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$status=$sprache->status_reopen;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'priority'=>$priority,'userPriority'=>$userPriority,'writedate'=>$writedate,'supporter'=>(trim($row['supportername']) != '') ? trim($row['supportername']) : $row['supporter'],'user'=>(trim($row['username']) != '') ? trim($row['username']) : $row['cname'],'subject'=>$topic,'status'=>$status,'rawState'=>$row['state'],'statusClass'=>$statusClass);
|
||||
$table[]=array('id' => $row['id'],'priority' => $priority,'userPriority' => $userPriority,'writedate' => $writedate,'supporter'=>(trim($row['supportername']) != '') ? trim($row['supportername']) : $row['supporter'],'user'=>(trim($row['username']) != '') ? trim($row['username']) : $row['cname'],'subject' => $topic,'status' => $status,'rawState' => $row['state'],'statusClass' => $statusClass);
|
||||
}
|
||||
$template_file = "admin_tickets_list.tpl";
|
||||
}
|
@ -80,7 +80,7 @@ if ($ui->st('d','get') == 'ad') {
|
||||
if (empty($topic)) {
|
||||
$topic=$row['topic'];
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'topic'=>$topic);
|
||||
$table[]=array('id' => $row['id'],'topic' => $topic);
|
||||
if ($i==1) {
|
||||
$query2 = $sql->prepare("SELECT * FROM `ticket_topics` WHERE `maintopic`=? AND `maintopic`!=`id` AND `resellerid`=? ORDER BY `id`");
|
||||
$query2->execute(array($row['id'],$resellerid));
|
||||
@ -95,7 +95,7 @@ if ($ui->st('d','get') == 'ad') {
|
||||
if (empty($topic)) {
|
||||
$topic=$row2['topic'];
|
||||
}
|
||||
$table2[]=array('id'=>$row2['id'],'topic'=>$topic);
|
||||
$table2[]=array('id' => $row2['id'],'topic' => $topic);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
@ -226,7 +226,7 @@ if ($ui->st('d','get') == 'ad') {
|
||||
$where='WHERE t.`userid`=? AND t.`resellerid`=?';
|
||||
if (isset($ui->get['ts'])) {
|
||||
foreach ($ui->get['ts'] as $get) {
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[]=$get;
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[] = $get;
|
||||
}
|
||||
} else {
|
||||
$selected=array('A','D','N','P','R');
|
||||
@ -236,7 +236,7 @@ if ($ui->st('d','get') == 'ad') {
|
||||
foreach ($selected as $get) {
|
||||
if ($i==0) $temp.="`state`='${get}'";
|
||||
else $temp.=" OR `state`='${get}'";
|
||||
$selected[]=$get;
|
||||
$selected[] = $get;
|
||||
$i++;
|
||||
}
|
||||
$temp.=')';
|
||||
@ -348,7 +348,7 @@ if ($ui->st('d','get') == 'ad') {
|
||||
} else {
|
||||
$status=$sprache->status_reopen;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'priority'=>$priority,'writedate'=>$writedate,'supporter'=>$row['supporter'],'subject'=>$topic,'status'=>$status,'rawState'=>$row['state'],'statusClass'=>$statusClass);
|
||||
$table[]=array('id' => $row['id'],'priority' => $priority,'writedate' => $writedate,'supporter' => $row['supporter'],'subject' => $topic,'status' => $status,'rawState' => $row['state'],'statusClass' => $statusClass);
|
||||
}
|
||||
$template_file = "admin_reseller_tickets_list.tpl";
|
||||
}
|
@ -81,14 +81,14 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
if (!isset($ui->post['line_colour_3']) or (!validate_int($ui->post['line_colour_3'], 0 , 255) and $ui->post['line_colour_3'] != 0)) $error = 1;
|
||||
if ($error==0) {
|
||||
$query = $sql->prepare("UPDATE `traffic_settings` SET `type`=:type,`statip`=:statip,`dbname`=AES_ENCRYPT(:dbname,:aeskey),`dbuser`=AES_ENCRYPT(:dbuser,:aeskey),`dbpassword`=AES_ENCRYPT(:dbpassword,:aeskey),`multiplier`=:multiplier,`table_name`=:table_name,`column_sourceip`=:column_sourceip,`column_destip`=:column_destip,`column_byte`=:column_byte,`column_date`=:column_date,`text_colour_1`=:text_colour_1,`text_colour_2`=:text_colour_2,`text_colour_3`=:text_colour_3,`barin_colour_1`=:barin_colour_1,`barin_colour_2`=:barin_colour_2,`barin_colour_3`=:barin_colour_3,`barout_colour_1`=:barout_colour_1,`barout_colour_2`=:barout_colour_2,`barout_colour_3`=:barout_colour_3,`bartotal_colour_1`=:bartotal_colour_1,`bartotal_colour_2`=:bartotal_colour_2,`bartotal_colour_3`=:bartotal_colour_3,`bg_colour_1`=:bg_colour_1,`bg_colour_2`=:bg_colour_2,`bg_colour_3`=:bg_colour_3,`border_colour_1`=:border_colour_1,`border_colour_2`=:border_colour_2,`border_colour_3`=:border_colour_3,`line_colour_1`=:line_colour_1,`line_colour_2`=:line_colour_2,`line_colour_3`=:line_colour_3 LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':type'=>$ui->post['type'],':statip'=>$ui->post['statip'],':dbname'=>$ui->post['dbname'],':dbuser'=>$ui->post['dbuser'],':dbpassword'=>$ui->post['dbpassword'],':table_name'=>$ui->post['table_name'],':multiplier'=>$ui->post['multiplier'],':column_sourceip'=>$ui->post['column_sourceip'],':column_destip'=>$ui->post['column_destip'],':column_byte'=>$ui->post['column_byte'],':column_date'=>$ui->post['column_date'],':text_colour_1'=>$ui->post['text_colour_1'],':text_colour_2'=>$ui->post['text_colour_2'],':text_colour_3'=>$ui->post['text_colour_3'],':barin_colour_1'=>$ui->post['barin_colour_1'],':barin_colour_2'=>$ui->post['barin_colour_2'],':barin_colour_3'=>$ui->post['barin_colour_3'],':barout_colour_1'=>$ui->post['barout_colour_1'],':barout_colour_2'=>$ui->post['barout_colour_2'],':barout_colour_3'=>$ui->post['barout_colour_3'],':bartotal_colour_1'=>$ui->post['bartotal_colour_1'],':bartotal_colour_2'=>$ui->post['bartotal_colour_2'],':bartotal_colour_3'=>$ui->post['bartotal_colour_3'],':bg_colour_1'=>$ui->post['bg_colour_1'],':bg_colour_2'=>$ui->post['bg_colour_2'],':bg_colour_3'=>$ui->post['bg_colour_3'],':border_colour_1'=>$ui->post['border_colour_1'],':border_colour_2'=>$ui->post['border_colour_2'],':border_colour_3'=>$ui->post['border_colour_3'],':line_colour_1'=>$ui->post['line_colour_1'],':line_colour_2'=>$ui->post['line_colour_2'],':line_colour_3'=>$ui->post['line_colour_3']));
|
||||
$query->execute(array(':aeskey' => $aeskey,':type' => $ui->post['type'],':statip' => $ui->post['statip'],':dbname' => $ui->post['dbname'],':dbuser' => $ui->post['dbuser'],':dbpassword' => $ui->post['dbpassword'],':table_name' => $ui->post['table_name'],':multiplier' => $ui->post['multiplier'],':column_sourceip' => $ui->post['column_sourceip'],':column_destip' => $ui->post['column_destip'],':column_byte' => $ui->post['column_byte'],':column_date' => $ui->post['column_date'],':text_colour_1' => $ui->post['text_colour_1'],':text_colour_2' => $ui->post['text_colour_2'],':text_colour_3' => $ui->post['text_colour_3'],':barin_colour_1' => $ui->post['barin_colour_1'],':barin_colour_2' => $ui->post['barin_colour_2'],':barin_colour_3' => $ui->post['barin_colour_3'],':barout_colour_1' => $ui->post['barout_colour_1'],':barout_colour_2' => $ui->post['barout_colour_2'],':barout_colour_3' => $ui->post['barout_colour_3'],':bartotal_colour_1' => $ui->post['bartotal_colour_1'],':bartotal_colour_2' => $ui->post['bartotal_colour_2'],':bartotal_colour_3' => $ui->post['bartotal_colour_3'],':bg_colour_1' => $ui->post['bg_colour_1'],':bg_colour_2' => $ui->post['bg_colour_2'],':bg_colour_3' => $ui->post['bg_colour_3'],':border_colour_1' => $ui->post['border_colour_1'],':border_colour_2' => $ui->post['border_colour_2'],':border_colour_3' => $ui->post['border_colour_3'],':line_colour_1' => $ui->post['line_colour_1'],':line_colour_2' => $ui->post['line_colour_2'],':line_colour_3' => $ui->post['line_colour_3']));
|
||||
$template_file = $spracheResponse->table_add;
|
||||
} else {
|
||||
$template_file = 'Error';
|
||||
}
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT `type`,`statip`,AES_DECRYPT(`dbname`,:aeskey) AS `decpteddbname`,AES_DECRYPT(`dbuser`,:aeskey) AS `decpteddbuser`,AES_DECRYPT(`dbpassword`,:aeskey) AS `decpteddbpassword`,`table_name`,`column_sourceip`,`column_destip`,`column_byte`,`column_date`,`multiplier`,`text_colour_1`,`text_colour_2`,`text_colour_3`,`barin_colour_1`,`barin_colour_2`,`barin_colour_3`,`barout_colour_1`,`barout_colour_2`,`barout_colour_3`,`bartotal_colour_1`,`bartotal_colour_2`,`bartotal_colour_3`,`bg_colour_1`,`bg_colour_2`,`bg_colour_3`,`border_colour_1`,`border_colour_2`,`border_colour_3`,`line_colour_1`,`line_colour_2`,`line_colour_3` FROM `traffic_settings` LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey));
|
||||
$query->execute(array(':aeskey' => $aeskey));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$type=$row['type'];
|
||||
$statip=$row['statip'];
|
||||
@ -166,13 +166,13 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
$userips=ipstoarray($row['ips']);
|
||||
foreach ($userips as $ip) {
|
||||
$ip_ex=explode(".",$ip);
|
||||
$ips[]=$ip_ex[0] . '.' . $ip_ex[1] . '.' . $ip_ex[2].".";
|
||||
$ips[] = $ip_ex[0] . '.' . $ip_ex[1] . '.' . $ip_ex[2].".";
|
||||
}
|
||||
}
|
||||
$subnets=array_unique($ips);
|
||||
natsort($subnets);
|
||||
foreach ($subnets as $subnet) {
|
||||
if ($ui->post['what']==$subnet) {
|
||||
if ($ui->post['what'] == $subnet) {
|
||||
$data[] = '<option selected="selected">'.$subnet.'</option>';
|
||||
} else {
|
||||
$data[] = '<option>'.$subnet.'</option>';
|
||||
@ -188,7 +188,7 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
$pselect->execute();
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.$row['cname'].'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.$row['cname'].'</option>';
|
||||
@ -206,7 +206,7 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
$pselect->execute(array(':reseller_id' => $reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.$row['cname'].'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.$row['cname'].'</option>';
|
||||
@ -215,10 +215,10 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
}
|
||||
if ($reseller_id==0) {
|
||||
$pselect=$sql->prepare("SELECT `cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=:id LIMIT 1");
|
||||
$pselect->execute(array(':id'=>$ui->post['what']));
|
||||
$pselect->execute(array(':id' => $ui->post['what']));
|
||||
} else if ($reseller_id==$admin_id) {
|
||||
$pselect=$sql->prepare("SELECT `cname` FROM `userdata` WHERE `accounttype`='r' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$pselect->execute(array(':id'=>$ui->post['what'],':reseller_id'=>$reseller_id));
|
||||
$pselect->execute(array(':id' => $ui->post['what'],':reseller_id' => $reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$display=$extra . ' ' . $row['cname'];
|
||||
@ -252,7 +252,7 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
$pselect->execute(array(':admin_id' => $admin_id,':reseller_id' => $reseller_id));
|
||||
}
|
||||
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.$row['cname'] . '-' . $row['id'].'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.$row['cname'] . '-' . $row['id'].'</option>';
|
||||
@ -280,13 +280,13 @@ if ($d== 'se' and $reseller_id==0) {
|
||||
unset($user_ips);
|
||||
$user_ips=ipstoarray($row['ips']);
|
||||
foreach ($user_ips as $userip) {
|
||||
$userips[]=$userip;
|
||||
$userips[] = $userip;
|
||||
}
|
||||
}
|
||||
$ips=array_unique($userips);
|
||||
natsort($ips);
|
||||
foreach ($ips as $ip) {
|
||||
if ($ui->post['what']==$ip) {
|
||||
if ($ui->post['what'] == $ip) {
|
||||
$data[] = '<option selected="selected">'.$ip.'</option>';
|
||||
} else {
|
||||
$data[] = '<option>'.$ip.'</option>';
|
||||
|
@ -57,13 +57,13 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($ui->smallletters('action',2,'post') == 'ad') {
|
||||
$error = array();
|
||||
if (!$ui->ismail('mail','post')){
|
||||
$error[]=$sprache->error_mail;
|
||||
$error[] = $sprache->error_mail;
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `userdata` WHERE `mail`=? LIMIT 1");
|
||||
$query->execute(array($ui->ismail('mail','post')));
|
||||
if ($query->fetchColumn()>0) $error[]=$sprache->error_mail_exists;
|
||||
if ($query->fetchColumn()>0) $error[] = $sprache->error_mail_exists;
|
||||
}
|
||||
if (!$ui->password('security',20,'post'))$error[]=$sprache->error_pass;
|
||||
if (!$ui->password('security',20,'post'))$error[] = $sprache->error_pass;
|
||||
if (!$ui->smallletters('accounttype',1,'post')){
|
||||
$error[] = '';
|
||||
} else {
|
||||
@ -236,11 +236,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($key != 'id' and $key != 'resellerid'){
|
||||
$keys[]="`".$key."`";
|
||||
$questionmarks[] = '?';
|
||||
$intos[]=$value;
|
||||
$intos[] = $value;
|
||||
}
|
||||
}
|
||||
$keys[]="`resellerid`";
|
||||
$intos[]=$id;
|
||||
$intos[] = $id;
|
||||
$questionmarks[] = '?';
|
||||
$into='INSERT INTO `'.$tablename.'` ('.implode(',',$keys).') VALUES ('.implode(',',$questionmarks).')';
|
||||
$query = $sql->prepare("$into");
|
||||
@ -308,8 +308,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`grouptype`,`name`,`defaultgroup` FROM `usergroups` WHERE `active`='Y' AND `resellerid`=?");
|
||||
$query->execute(array($lookUpID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row['defaultgroup'] == 'Y') $defaultGroups[$row['grouptype']][$row['id']]=$row['name'];
|
||||
$groups[$row['grouptype']][$row['id']]=$row['name'];
|
||||
if ($row['defaultgroup'] == 'Y') $defaultGroups[$row['grouptype']][$row['id']] = $row['name'];
|
||||
$groups[$row['grouptype']][$row['id']] = $row['name'];
|
||||
}
|
||||
if ($reseller_id==0 or $reseller_id==$admin_id) {
|
||||
$availableips=freeips($reseller_id);
|
||||
@ -430,13 +430,13 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`name` FROM `usergroups` WHERE `active`='Y' AND `grouptype`=? AND `resellerid`=?");
|
||||
$query->execute(array($accounttype,$lookUpID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$groups[$row['id']]=$row['name'];
|
||||
$groups[$row['id']] = $row['name'];
|
||||
}
|
||||
if ($accounttype == 'r' and $reseller_id==0) $lookUpID=$id;
|
||||
$query = $sql->prepare("SELECT `groupID` FROM `userdata_groups` WHERE `userID`=? AND `resellerID`=?");
|
||||
$query->execute(array($id,$lookUpID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$groupsAssigned[]=$row['groupID'];
|
||||
$groupsAssigned[] = $row['groupID'];
|
||||
}
|
||||
if ($accounttype == 'r') {
|
||||
$ips=($reseller_id==0 or $reseller_id==$admin_id) ? freeips($reseller_id) : freeips($admin_id);
|
||||
@ -446,8 +446,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$useractive=$row['useractive'];
|
||||
foreach(ipstoarray($row['ips']) as $ip) {
|
||||
$ipsAssigned[]=$ip;
|
||||
$ips[]=$ip;
|
||||
$ipsAssigned[] = $ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
$maxuser=$row['maxuser'];
|
||||
$maxgserver=$row['maxgserver'];
|
||||
@ -468,11 +468,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if ($ui->smallletters('action',2,'post') == 'md') {
|
||||
$errors = array();
|
||||
if (!$ui->ismail('mail','post')){
|
||||
$errors[]=$sprache->error_mail;
|
||||
$errors[] = $sprache->error_mail;
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `userdata` WHERE `mail`=? AND `id`!=? LIMIT 1");
|
||||
$query->execute(array($ui->ismail('mail','post'),$id));
|
||||
if ($query->fetchColumn()>0) $error[]=$sprache->error_mail;
|
||||
if ($query->fetchColumn()>0) $error[] = $sprache->error_mail;
|
||||
}
|
||||
if (!$ui->id('groups',30,'post') and $id != $admin_id){
|
||||
$errors[] = 'Error: Group';
|
||||
@ -535,7 +535,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$oldips=ipstoarray($query->fetchColumn());
|
||||
$ips = array();
|
||||
foreach ($post_ips2 as $ip) {
|
||||
if (in_array($ip,$availableips) or in_array($ip,$oldips)) $ips[]=$ip;
|
||||
if (in_array($ip,$availableips) or in_array($ip,$oldips)) $ips[] = $ip;
|
||||
}
|
||||
$ips=implode("\r\n",$ips);
|
||||
$maxuser=$ui->id('maxuser',10,'post');
|
||||
@ -554,7 +554,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$update=$sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='us' AND (`status` IS NULL OR `status`='1') AND `userID`=? and `resellerID`=?");
|
||||
$update->execute(array($id,$reseller_id));
|
||||
$insert=$sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('U','us',?,?,?,?,NULL,NOW(),'md',?,?)");
|
||||
$insert->execute(array($admin_id, $row['id'], $row['id'], $row['cname'],json_encode(array('newActive'=>$useractive)),$id));
|
||||
$insert->execute(array($admin_id, $row['id'], $row['id'], $row['cname'],json_encode(array('newActive' => $useractive)),$id));
|
||||
updateJobs($row['id'],$reseller_id);
|
||||
}
|
||||
}
|
||||
@ -566,7 +566,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$update=$sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='us' AND (`status` IS NULL OR `status`='1') AND `userID`=? and `resellerID`=?");
|
||||
$update->execute(array($id,$reseller_id));
|
||||
$insert=$sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('U','us',?,?,?,?,NULL,NOW(),'md',?,?)");
|
||||
$insert->execute(array($admin_id,$id,$id,$cname,json_encode(array('newActive'=>$active)),$reseller_id));
|
||||
$insert->execute(array($admin_id,$id,$id,$cname,json_encode(array('newActive' => $active)),$reseller_id));
|
||||
updateJobs($id,$reseller_id);
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `userdata` SET `updateTime`=NOW(),`salutation`=?,`birthday`=?,`country`=?,`fax`=?,`name`=?,`vname`=?,`mail`=?,`phone`=?,`handy`=?,`city`=?,`cityn`=?,`street`=?,`streetn`=?,`fdlpath`=?,`mail_backup`=?,`mail_gsupdate`=?,`mail_securitybreach`=?,`mail_serverdown`=?,`mail_ticket`=?,`mail_vserver`=?$jobPending WHERE `id`=? and `resellerid`=? LIMIT 1");
|
||||
@ -577,7 +577,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query=($accounttype == 'r' and $reseller_id==0) ? $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=0 LIMIT 1") : $sql->prepare("SELECT `id` FROM `usergroups` WHERE `id`=? AND `grouptype`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2 = $sql->prepare("INSERT INTO `userdata_groups` (`userID`,`groupID`,`resellerID`) VALUES (?,?,?) ON DUPLICATE KEY UPDATE `groupID`=VALUES(`groupID`)");
|
||||
foreach ($ui->id('groups',10,'post') as $gid) {
|
||||
$tempArray[]=$gid;
|
||||
$tempArray[] = $gid;
|
||||
if ($accounttype == 'r' and $reseller_id==0) $query->execute(array($gid,$accounttype));
|
||||
else $query->execute(array($gid,$accounttype,$resellerlockupid));
|
||||
if(isid($query->fetchColumn(),10)) $query2->execute(array($id,$gid,$resellerlockupid));
|
||||
@ -613,9 +613,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = 'admin_user_pass.tpl';
|
||||
} else if ($ui->smallletters('action',2,'post') == 'pw' and isset($cname)) {
|
||||
$errors = array();
|
||||
if (!$ui->password('password',20,'post')) $errors[]=$sprache->error_pass;
|
||||
if (!$ui->password('pass2',20,'post'))$errors[]=$sprache->error_pass;
|
||||
if ($ui->password('password',20,'post') != $ui->password('pass2',20,'post')) $errors[]=$sprache->error_passw_succ;
|
||||
if (!$ui->password('password',20,'post')) $errors[] = $sprache->error_pass;
|
||||
if (!$ui->password('pass2',20,'post'))$errors[] = $sprache->error_pass;
|
||||
if ($ui->password('password',20,'post') != $ui->password('pass2',20,'post')) $errors[] = $sprache->error_passw_succ;
|
||||
if (count($errors)>0) {
|
||||
$template_file = implode('<br />',$errors);
|
||||
} else {
|
||||
@ -664,7 +664,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$selected = array();
|
||||
if (isset($ui->get['state'])) {
|
||||
foreach ($ui->get['state'] as $get) {
|
||||
if (preg_match('/[YNR]/',$get)) $selected[]=$get;
|
||||
if (preg_match('/[YNR]/',$get)) $selected[] = $get;
|
||||
}
|
||||
} else {
|
||||
$selected=array('Y','N','R');
|
||||
@ -718,7 +718,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgName='16_bad';
|
||||
$imgAlt='Inactive';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'img'=>$imgName,'alt'=>$imgAlt,'adminaccount'=>$adminaccount,'accounttype'=>$accounttype,'cname'=>$row['cname'],'name'=>$row['name'],'jobPending'=>$jobPending,'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['id'],'img' => $imgName,'alt' => $imgAlt,'adminaccount' => $adminaccount,'accounttype' => $accounttype,'cname' => $row['cname'],'name' => $row['name'],'jobPending' => $jobPending,'active' => $row['active']);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
if ($reseller_id==0) {
|
||||
@ -752,7 +752,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 1;
|
||||
while ($i<$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -423,7 +423,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$defaultgroup=$gsprache->no;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'img'=>$imgName,'alt'=>$imgAlt,'grouptype'=>$grouptype,'defaultgroup'=>$defaultgroup,'name'=>$row['name'],'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['id'],'img' => $imgName,'alt' => $imgAlt,'grouptype' => $grouptype,'defaultgroup' => $defaultgroup,'name' => $row['name'],'active' => $row['active']);
|
||||
}
|
||||
$template_file = 'admin_user_groups_list.tpl';
|
||||
}
|
@ -244,12 +244,12 @@ if ($ui->id('id', 10, 'get') and $ui->id('adid',10,'get') and in_array($ui->smal
|
||||
}
|
||||
$link='userpanel.php?w=ao&id='.$switchID.'&adid='.$adid.'&action='.$action.$delete.'&r=gs';
|
||||
if ($row2['type'] == 'tool') {
|
||||
$table2[]=array('adid'=>$adid,'menudescription'=>$menudescription,'addescription'=>$addescription,'installedid'=>$installedid,'img'=>$imgName,'bootstrap'=>$bootstrap,'alt'=>$imgAlt,'link'=>$link);
|
||||
$table2[]=array('adid' => $adid,'menudescription' => $menudescription,'addescription' => $addescription,'installedid' => $installedid,'img' => $imgName,'bootstrap' => $bootstrap,'alt' => $imgAlt,'link' => $link);
|
||||
} else if ($row2['type'] == 'map') {
|
||||
$table3[]=array('adid'=>$adid,'menudescription'=>$menudescription,'addescription'=>$addescription,'installedid'=>$installedid,'img'=>$imgName,'bootstrap'=>$bootstrap,'alt'=>$imgAlt,'link'=>$link);
|
||||
$table3[]=array('adid' => $adid,'menudescription' => $menudescription,'addescription' => $addescription,'installedid' => $installedid,'img' => $imgName,'bootstrap' => $bootstrap,'alt' => $imgAlt,'link' => $link);
|
||||
}
|
||||
}
|
||||
$table=array('id'=>$switchID,'serverip'=>$serverip,'port'=>$serverport,'tools'=>$table2,'maps'=>$table3,'name'=>$description);
|
||||
$table=array('id' => $switchID,'serverip' => $serverip,'port' => $serverport,'tools' => $table2,'maps' => $table3,'name' => $description);
|
||||
unset($table2,$table3);
|
||||
}
|
||||
$template_file = "userpanel_gserver_addon.tpl";
|
||||
|
@ -90,9 +90,9 @@ if ($ui->id('id', 10, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('
|
||||
$query = $sql->prepare("SELECT DISTINCT(t.`shorten`) FROM `serverlist` s LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=?");
|
||||
$query->execute(array($id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$shortens[]=$row['shorten'];
|
||||
$shortens[]=$row['shorten'].'-2';
|
||||
$shortens[]=$row['shorten'].'-3';
|
||||
$shortens[] = $row['shorten'];
|
||||
$shortens[] = $row['shorten'].'-2';
|
||||
$shortens[] = $row['shorten'].'-3';
|
||||
}
|
||||
$template_file = "userpanel_gserver_backup_rb.tpl";
|
||||
} else if ($ui->w('action',3,'post') == 'rb2' and $ui->gamestring('template','post')){
|
||||
|
@ -111,7 +111,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`description`,`bitversion` FROM `resellerimages` WHERE `description` NOT IN ('Rescue 32bit','Rescue 64bit') ORDER BY `distro`,`bitversion`,`description`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$templates[]=array('id'=>$row['id'],'description'=>$row['description']);
|
||||
$templates[]=array('id' => $row['id'],'description' => $row['description']);
|
||||
}
|
||||
$template_file = (isset($ip)) ? 'userpanel_root_dedicated_ri.tpl' : 'admin_404.tpl';
|
||||
} else if (in_array($ui->st('action','post'), array('ri','rc','rs','st'))) {
|
||||
@ -125,11 +125,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (isset($ip)) {
|
||||
$extraData = array();
|
||||
if ($ui->st('action','post') == 'ri') {
|
||||
$extraData['imageID']=$ui->id('imageid',10,'post');
|
||||
$extraData['imageID'] = $ui->id('imageid',10,'post');
|
||||
} else if ($ui->st('action','post') == 'rc') {
|
||||
$query = $sql->prepare("SELECT `id` FROM `resellerimages` WHERE `bitversion`=? AND `active`='Y' AND `distro`='other' AND `description` LIKE 'Rescue %' LIMIT 1");
|
||||
$query->execute(array($bitversion));
|
||||
$extraData['imageID']=$query->fetchColumn();
|
||||
$extraData['imageID'] = $query->fetchColumn();
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('D','de',NULL,?,?,NULL,?,NULL,NOW(),?,?,?)");
|
||||
$query->execute(array($user_id,$id,$ip,$ui->st('action','post'),json_encode($extraData),$reseller_id));
|
||||
@ -179,7 +179,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgAlt='Inactive';
|
||||
$active = 'N';
|
||||
}
|
||||
$table[]=array('id'=>$row['dedicatedID'],'ip'=>$row['ip'],'description'=>$row['description'],'img'=>$imgName,'alt'=>$imgAlt,'active'=>$active,'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['dedicatedID'],'ip' => $row['ip'],'description' => $row['description'],'img' => $imgName,'alt' => $imgAlt,'active' => $active,'jobPending' => $jobPending);
|
||||
}
|
||||
}
|
||||
$template_file = 'userpanel_root_dedicated_list.tpl';
|
||||
|
@ -141,12 +141,12 @@ if ($ui->st('d','get') == 'ud' and $ui->id('id',19,'get') and (!isset($_SESSION[
|
||||
$fdlpath=explode('@', $row['fdlpath']);
|
||||
$username=$row['cname'];
|
||||
}
|
||||
if (!isset($fdlpath[1])) $fdlpath[1]=$sprache->noset;
|
||||
if (!isset($fdlpath[1])) $fdlpath[1] = $sprache->noset;
|
||||
$table = array();
|
||||
$query = $sql->prepare("SELECT `id`,`serverip`,`port` FROM `gsswitch` WHERE `active`='Y' AND `userid`=? AND `resellerid`=?");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!isset($_SESSION['sID']) or in_array($row['id'],$substituteAccess['gs'])) $table[]=array('id'=>$row['id'],'serverip'=>$row['serverip'],'port'=>$row['port']);
|
||||
if (!isset($_SESSION['sID']) or in_array($row['id'],$substituteAccess['gs'])) $table[]=array('id' => $row['id'],'serverip' => $row['serverip'],'port' => $row['port']);
|
||||
}
|
||||
$template_file = "userpanel_gserver_fdl_list.tpl";
|
||||
}
|
@ -83,7 +83,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$templates = (array) $ui->id('template',10,'post');
|
||||
foreach($templates as $id => $tpl) {
|
||||
if ($tpl>0) {
|
||||
$template[]=$tpl;
|
||||
$template[] = $tpl;
|
||||
if ($ui->active('type','post') == 'Y') {
|
||||
$query = $sql->prepare("DELETE FROM `addons_installed` WHERE `serverid`=? AND `resellerid`=? AND `userid`=?");
|
||||
$query->execute(array($id,$reseller_id,$user_id));
|
||||
@ -127,7 +127,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$servertemplate=($currentID==$row['id']) ? $row['servertemplate'] : '';
|
||||
$table[]=array('id'=>$row['id'],'description'=>$row['description'],'shorten'=>$row['shorten'],'servertemplate'=>$servertemplate);
|
||||
$table[]=array('id' => $row['id'],'description' => $row['description'],'shorten' => $row['shorten'],'servertemplate' => $servertemplate);
|
||||
}
|
||||
if (count($table)>0) {
|
||||
$template_file = "userpanel_gserver_reinstall.tpl";
|
||||
@ -206,7 +206,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$anticheatsoft = '';
|
||||
}
|
||||
if ($row['id']==$serverID) {
|
||||
if ($row['id'] == $serverID) {
|
||||
$currentTemplate=$gshorten;
|
||||
$displayNone = '';
|
||||
$displayNoneBoot='in';
|
||||
@ -266,7 +266,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$workshopCollection=$row['workshopCollection'];
|
||||
}
|
||||
$map=(!in_array($row['defaultmap'], array('', null))) ? $row['map'] : null;
|
||||
$table[]=array('id'=>$row['id'],'cmd'=>$row['cmd'],'fps' =>$row['fps'],'tic'=>$row['tic'],'map'=>$map,'workshopCollection'=>$workshopCollection,'webapiAuthkey'=>$row['dwebapiAuthkey'],'mapGroup'=>$row['mapGroup'],'defaultMapGroup'=>$row['defaultMapGroup'],'servertemplate'=>$row['servertemplate'],'userfps'=>$row['userfps'],'usertick'=>$row['usertick'],'usermap'=>$row['usermap'],'description'=>$row['description'],'option'=>$option,'qstat'=>$qstat,'upload'=>$upload,'uploaddir'=>$uploaddir,'anticheat'=>$anticheat,'anticheatsoft'=>$anticheatsoft,'eac'=>$eac,'shorten'=>$gshorten,'mod'=>$mod,'mods'=>$mods,'displayNone'=>$displayNone,'displayNoneBoot'=>$displayNoneBoot);
|
||||
$table[]=array('id' => $row['id'],'cmd' => $row['cmd'],'fps' =>$row['fps'],'tic' => $row['tic'],'map' => $map,'workshopCollection' => $workshopCollection,'webapiAuthkey' => $row['dwebapiAuthkey'],'mapGroup' => $row['mapGroup'],'defaultMapGroup' => $row['defaultMapGroup'],'servertemplate' => $row['servertemplate'],'userfps' => $row['userfps'],'usertick' => $row['usertick'],'usermap' => $row['usermap'],'description' => $row['description'],'option' => $option,'qstat' => $qstat,'upload' => $upload,'uploaddir' => $uploaddir,'anticheat' => $anticheat,'anticheatsoft' => $anticheatsoft,'eac' => $eac,'shorten' => $gshorten,'mod' => $mod,'mods' => $mods,'displayNone' => $displayNone,'displayNoneBoot' => $displayNoneBoot);
|
||||
$i++;
|
||||
}
|
||||
if ($i>0) {
|
||||
@ -345,7 +345,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$cmds = array();
|
||||
if (isset($oldID) and $oldID != $switchID) {
|
||||
$tmp=gsrestart($id,'so',$aeskey,$reseller_id);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
}
|
||||
$query = $sql->prepare("UPDATE `gsswitch` SET `serverid`=?,`ftppassword`=AES_ENCRYPT(?,?) WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($switchID,$ftppass,$aeskey,$id,$reseller_id));
|
||||
@ -355,10 +355,10 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("UPDATE `gsswitch` SET `protected`='N' WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
$tmp=gsrestart($id,'re',$aeskey,$reseller_id);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
} else {
|
||||
$tmp=gsrestart($id,'re',$aeskey,$reseller_id);
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[]=$t;
|
||||
if (is_array($tmp)) foreach($tmp as $t) $cmds[] = $t;
|
||||
}
|
||||
}
|
||||
if ($ftppass != $oldPass) {
|
||||
@ -420,8 +420,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$data_explode=explode(" ", $configline);
|
||||
$permission=(isset($data_explode[1])) ? $data_explode[1] : 'full';
|
||||
if ($data_explode[0] != '') {
|
||||
$configs[]=array('permission'=>$permission,'line'=>$data_explode[0]);
|
||||
$configCheck[]=$data_explode[0];
|
||||
$configs[]=array('permission' => $permission,'line' => $data_explode[0]);
|
||||
$configCheck[] = $data_explode[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -434,8 +434,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$data_explode=explode(" ", $configline);
|
||||
$permission=(isset($data_explode[1])) ? $data_explode[1] : 'full';
|
||||
if ($data_explode[0] != '') {
|
||||
$configs[]=array('permission'=>$permission,'line'=>$data_explode[0]);
|
||||
$configCheck[]=$data_explode[0];
|
||||
$configs[]=array('permission' => $permission,'line' => $data_explode[0]);
|
||||
$configCheck[] = $data_explode[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -631,9 +631,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$value=$split[1];
|
||||
if ($cvar!="exec") {
|
||||
if (in_array($cvar, $general_cvar) or in_array($cvar, $game_cvars)) {
|
||||
$linearray[$cvar]=$value;
|
||||
$linearray[$cvar] = $value;
|
||||
} else {
|
||||
$unknownarray[$cvar]=$value;
|
||||
$unknownarray[$cvar] = $value;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -643,9 +643,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$value=(isset($split[1])) ? $split[1] : '';
|
||||
if ($cvar!="exec") {
|
||||
if (in_array($cvar, $general_cvar) or in_array($cvar, $game_cvars)) {
|
||||
$linearray[$cvar]=$value;
|
||||
$linearray[$cvar] = $value;
|
||||
} else {
|
||||
$unknownarray[$cvar]=$value;
|
||||
$unknownarray[$cvar] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -697,7 +697,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$ce=explode(',', $row['cores']);
|
||||
$coreCount=count($ce);
|
||||
$cores = array();
|
||||
if ($row['taskset'] == 'Y' and $coreCount>0) foreach ($ce as $uc) $cores[]=$uc;
|
||||
if ($row['taskset'] == 'Y' and $coreCount>0) foreach ($ce as $uc) $cores[] = $uc;
|
||||
$cores=implode(', ',$cores);
|
||||
$password=$row['queryPassword'];
|
||||
$stopped=$row['stopped'];
|
||||
@ -764,18 +764,18 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$nameremoved=$sprache->nameremoved;
|
||||
}
|
||||
}
|
||||
$initalize[]=$gameserverid.'-start';
|
||||
$initalize[]=$gameserverid.'-stop';
|
||||
$initalize[]=$gameserverid.'-settings';
|
||||
$initalize[]=$gameserverid.'-config';
|
||||
$initalize[]=$gameserverid.'-reinstall';
|
||||
$initalize[]=$gameserverid.'-planer';
|
||||
$initalize[]=$gameserverid.'-logs';
|
||||
$initalize[]=$gameserverid.'-backup';
|
||||
$initalize[]=$gameserverid.'-addons';
|
||||
$initalize[]=$gameserverid.'-protect';
|
||||
$initalize[]=$gameserverid.'-sourcetv';
|
||||
$table[]=array('id'=>$gameserverid,'premoved'=>$premoved,'nameremoved'=>$nameremoved,'server'=>$address,'name'=>$name,'img'=>$imgName,'alt'=>$imgAlt,'imgp'=>$imgNameP,'altp'=>$imgAltP,'numplayers'=>$numplayers,'maxplayers'=>$maxplayers,'map'=>$map,'cname'=>$cname,'cftppass'=>$cftppass,'ip'=>$ip,'ftpport'=>$ftpport,'port'=>$port,'shorten'=>$currentTemplate,'gameShorten'=>$shorten,'ftpdata'=>$ftpdata,'updatetime'=>$updatetime,'stopped'=>$stopped,'pro'=>$pro,'upload'=>$upload,'minram'=>$row['minram'],'maxram'=>$row['maxram'],'taskset'=>$row['taskset'],'coreCount'=>$coreCount,'cores'=>$cores);
|
||||
$initalize[] = $gameserverid.'-start';
|
||||
$initalize[] = $gameserverid.'-stop';
|
||||
$initalize[] = $gameserverid.'-settings';
|
||||
$initalize[] = $gameserverid.'-config';
|
||||
$initalize[] = $gameserverid.'-reinstall';
|
||||
$initalize[] = $gameserverid.'-planer';
|
||||
$initalize[] = $gameserverid.'-logs';
|
||||
$initalize[] = $gameserverid.'-backup';
|
||||
$initalize[] = $gameserverid.'-addons';
|
||||
$initalize[] = $gameserverid.'-protect';
|
||||
$initalize[] = $gameserverid.'-sourcetv';
|
||||
$table[]=array('id' => $gameserverid,'premoved' => $premoved,'nameremoved' => $nameremoved,'server' => $address,'name' => $name,'img' => $imgName,'alt' => $imgAlt,'imgp' => $imgNameP,'altp' => $imgAltP,'numplayers' => $numplayers,'maxplayers' => $maxplayers,'map' => $map,'cname' => $cname,'cftppass' => $cftppass,'ip' => $ip,'ftpport' => $ftpport,'port' => $port,'shorten' => $currentTemplate,'gameShorten' => $shorten,'ftpdata' => $ftpdata,'updatetime' => $updatetime,'stopped' => $stopped,'pro' => $pro,'upload' => $upload,'minram' => $row['minram'],'maxram' => $row['maxram'],'taskset' => $row['taskset'],'coreCount' => $coreCount,'cores' => $cores);
|
||||
}
|
||||
}
|
||||
$template_file = "userpanel_gserver_list.tpl";
|
||||
|
@ -36,7 +36,7 @@
|
||||
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if ((!isset($user_id) or !$main == "1") or (isset($user_id) and !isanyuser($user_id))) {
|
||||
if ((!isset($user_id) or !$main == "1") or (isset($user_id) and !isanyuser($user_id))) {
|
||||
header('Location: login.php');
|
||||
die('No acces');
|
||||
}
|
||||
@ -106,7 +106,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$crached_ts3_virtual++;
|
||||
}
|
||||
|
||||
$crashedArray['ts3']=$crached_ts3_virtual;
|
||||
$crashedArray['ts3'] = $crached_ts3_virtual;
|
||||
$feedArray = array();
|
||||
|
||||
if($ui->smallletters('w',2,'get') == 'da' or (!$ui->smallletters('w',2,'get') and !$ui->smallletters('d',2,'get'))) {
|
||||
@ -126,7 +126,7 @@ if($ui->smallletters('w',2,'get') == 'da' or (!$ui->smallletters('w',2,'get') an
|
||||
$query2 = $sql->prepare("SELECT p.`id`,t.`id` AS `textID`,t.`title`,t.`text` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` WHERE p.`released`='1' AND p.`type`='news' AND t.`language`=? AND p.`resellerid`=0 ORDER BY `date` DESC LIMIT 0,$newsAmount");
|
||||
$query2->execute(array($user_language));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
if ($row['merge'] == 'N') {
|
||||
if ($row['merge'] == 'N') {
|
||||
$feedArray[$page_url][] = array('title' => $row2['title'], 'link' => ($seo == 'Y') ? $page_url. '/' . $user_language . '/' . szrp($gsprache->news) . '/' . szrp($row2['title']) . '/' : $page_url.'/index.php?site=news&id='.$row2['id'], 'text' => nl2br($row2['text']), 'url' => $page_url);
|
||||
} else {
|
||||
$feedArray['News'][] = array('title' => $row2['title'], 'link' => ($seo == 'Y') ? $page_url. '/' . $user_language . '/' . szrp($gsprache->news) . '/' . szrp($row2['title']) . '/' : $page_url.'/index.php?site=news&id='.$row2['id'], 'text' => nl2br($row2['text']), 'url' => $page_url);
|
||||
@ -160,9 +160,9 @@ if($ui->smallletters('w',2,'get') == 'da' or (!$ui->smallletters('w',2,'get') an
|
||||
}
|
||||
$theNews = array('title' => $row3['title'],'link' => $row3['link'],'text' => $text,'url' => $url);
|
||||
if ($row['merge'] == 'Y'){
|
||||
$feedArray['News'][]=$theNews;
|
||||
$feedArray['News'][] = $theNews;
|
||||
} else {
|
||||
$feedArray[$url][]=$theNews;
|
||||
$feedArray[$url][] = $theNews;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@ if($ui->smallletters('w',2,'get') == 'da' or (!$ui->smallletters('w',2,'get') an
|
||||
$title=$row2['link'];
|
||||
}
|
||||
$theNews = array('title' => $title,'link' => $row2['link'],'text' => $text,'url' => $url);
|
||||
$feedArray['News'][]=$theNews;
|
||||
$feedArray['News'][] = $theNews;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,14 +63,14 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
}
|
||||
}
|
||||
$useraction=$row['useraction'];
|
||||
$placeholders=array('%%','%add%','%dl%','%del%','%md%','%mod%','%start%','%restart%','%stop%','%upd%','%fail%','%ok%','%psw%','%cfg%','%import%','%reinstall%','%backup%','%use%');
|
||||
$placeholders=array('%%', '%add%', '%dl%', '%del%', '%md%', '%mod%', '%start%', '%restart%', '%stop%', '%upd%', '%fail%', '%ok%', '%psw%', '%cfg%', '%import%', '%reinstall%', '%backup%', '%use%');
|
||||
$replace=array('',$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.': ');
|
||||
$replacedpics=str_replace($placeholders,$replace,$useraction);
|
||||
$placeholders=array('%voserver%','%gserver%','%user%','%fastdl%','%master%','%user%','%root%','%addon%','%settings%','%vserver%','%ticket_subject%','%reseller%','%virtual%','%eac%','%resync%','%virtualimage%','%template%','%voserver%','%emailsettings%','%dns%','%tsdns%','%pmode%');
|
||||
$placeholders=array('%voserver%', '%gserver%', '%user%', '%fastdl%', '%master%', '%user%', '%root%', '%addon%', '%settings%', '%vserver%', '%ticket_subject%', '%reseller%', '%virtual%', '%eac%', '%resync%', '%virtualimage%', '%template%', '%voserver%', '%emailsettings%', '%dns%', '%tsdns%', '%pmode%');
|
||||
$replace=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);
|
||||
$replacedwords=str_replace($placeholders,$replace,$replacedpics);
|
||||
$logdate=explode(' ', $row['logdate']);
|
||||
$table[]=array('logday'=>$logdate[0],'loghour'=>$logdate[1],'ip'=>$ip,'username'=>$username,'useraction'=>$replacedwords);
|
||||
$table[]=array('logday' => $logdate[0],'loghour' => $logdate[1],'ip' => $ip,'username' => $username,'useraction' => $replacedwords);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$query = $sql->prepare("SELECT `id` FROM `userlog` WHERE `usertype`='user' AND `userid`=? AND `resellerid`=?");
|
||||
|
@ -84,9 +84,9 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
} else if ($row2['gamebinary'] == 'srcds_run' and $row2['appID']!=740 and $row2['appID']!=730) {
|
||||
$search='/'. $row2['binarydir']. '/' . $row2['modfolder'];
|
||||
}
|
||||
$temp[$row2['shorten']]=array('shorten'=>$row2['shorten'],'description'=>$row2['description'],'searchFor'=>$search,'modfolder'=>$row2['modfolder']);
|
||||
$temp[$row2['shorten']]=array('shorten' => $row2['shorten'],'description' => $row2['description'],'searchFor' => $search,'modfolder' => $row2['modfolder']);
|
||||
}
|
||||
$table[$row['id']]=array('id'=>$row['id'],'address'=>$row['serverip'] . ':' . $row['port'],'games'=>$temp,'rootID'=>$row['rootID'],'gsfolder'=>$row['serverip'] . '_' . $row['port'],'customer'=>$customer,'cftppass'=>$row['cftppass']);
|
||||
$table[$row['id']]=array('id' => $row['id'],'address' => $row['serverip'] . ':' . $row['port'],'games' => $temp,'rootID' => $row['rootID'],'gsfolder' => $row['serverip'] . '_' . $row['port'],'customer' => $customer,'cftppass' => $row['cftppass']);
|
||||
}
|
||||
}
|
||||
if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
@ -104,13 +104,13 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$list=preg_split('/(\s|\s+)/',$d,-1,PREG_SPLIT_NO_EMPTY);
|
||||
if (preg_match('/^d[rwx\-]{9}+$/',$list[0]) and !preg_match('/^[\.\/]{0,}Steam[\/]{0,}+$/',$list[count($list)-1]) and !in_array($list[count($list)-1],$donotsearch)) {
|
||||
if (substr($dir.$list[count($list)-1],$spl)==$searchFor) return $dir.$list[count($list)-1];
|
||||
$folders[]=$dir.$list[count($list)-1];
|
||||
$folders[] = $dir.$list[count($list)-1];
|
||||
if (is_numeric($maxDepth) and $currentDepth<($maxDepth+1)) {
|
||||
$array=checkFolders($dir.$list[count($list)-1],$searchFor,$maxDepth,$currentDepth+1);
|
||||
if (is_array($array)) {
|
||||
foreach ($array as $f){
|
||||
if (substr($f,$spl)==$searchFor) return $f;
|
||||
$folders[]=$f;
|
||||
$folders[] = $f;
|
||||
}
|
||||
} else if (substr($array,$spl)==$searchFor) {
|
||||
return $array;
|
||||
@ -123,27 +123,27 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
return $dir;
|
||||
}
|
||||
if (!$ui->domain('ftpAddress','post') and !$ui->ip('ftpAddress','post')) {
|
||||
$error[]=$sprache->ftp_adresse;
|
||||
$error[] = $sprache->ftp_adresse;
|
||||
} else {
|
||||
$ftpAddress=$ui->post['ftpAddress'];
|
||||
}
|
||||
if (!$ui->port('ftpPort','post')) {
|
||||
$error[]=$sprache->ftp_port;
|
||||
$error[] = $sprache->ftp_port;
|
||||
} else {
|
||||
$ftpPort=$ui->port('ftpPort','post');
|
||||
}
|
||||
if (!$ui->config('ftpUser','post')) {
|
||||
$error[]=$sprache->ftp_user;
|
||||
$error[] = $sprache->ftp_user;
|
||||
} else {
|
||||
$ftpUser=$ui->config('ftpUser','post');
|
||||
}
|
||||
if (!$ui->config('ftpPassword','post')) {
|
||||
$error[]=$sprache->ftp_password;
|
||||
$error[] = $sprache->ftp_password;
|
||||
} else {
|
||||
$ftpPassword=$ui->config('ftpPassword','post');
|
||||
}
|
||||
if (!$ui->id('switchID',10,'post') or !isset($table[$ui->id('switchID',10,'post')])) {
|
||||
$error[]=$sprache->server;
|
||||
$error[] = $sprache->server;
|
||||
} else {
|
||||
$thisID=$ui->id('switchID',10,'post');
|
||||
$address=$table[$ui->id('switchID',10,'post')]['address'];
|
||||
@ -153,7 +153,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$cftppass=$table[$ui->id('switchID',10,'post')]['cftppass'];
|
||||
}
|
||||
if (!$ui->config('template','post',$thisID) or !isset($table[$ui->id('switchID',10,'post')]['games'])) {
|
||||
$error[]=$gsprache->template;
|
||||
$error[] = $gsprache->template;
|
||||
} else if (isset($table[$ui->id('switchID',10,'post')]['games'])) {
|
||||
foreach($table[$ui->id('switchID',10,'post')]['games'] as $game) {
|
||||
unset($temp);
|
||||
@ -174,7 +174,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (isset($shorten)) {
|
||||
$thisTemplate=$ui->config('template','post',$thisID);
|
||||
} else if (!in_array($gsprache->template,$error)) {
|
||||
$error[]=$gsprache->template;
|
||||
$error[] = $gsprache->template;
|
||||
}
|
||||
}
|
||||
if ($ui->anyPath('ftpPath','post')) $ftpPath=$ui->anyPath('ftpPath','post');
|
||||
@ -188,19 +188,19 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (substr($currentPath,strlen($searchFor)*(-1))==$searchFor) {
|
||||
$ftpPath=$currentPath;
|
||||
} else {
|
||||
$error[]=$sprache->ftp_path.'. '.$sprache->import_corrected;
|
||||
$error[] = $sprache->ftp_path.'. '.$sprache->import_corrected;
|
||||
$foundPath=checkFolders($currentPath,$searchFor,5);
|
||||
$ftpPath=(is_array($foundPath)) ? '' : $foundPath;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error[]=$sprache->ftp_user;
|
||||
$error[]=$sprache->ftp_password;
|
||||
$error[] = $sprache->ftp_user;
|
||||
$error[] = $sprache->ftp_password;
|
||||
}
|
||||
ftp_close($ftp);
|
||||
} else {
|
||||
if (!in_array($sprache->ftp_adresse,$error)) $error[]=$sprache->ftp_adresse;
|
||||
if (!in_array($sprache->ftp_port,$error)) $error[]=$sprache->ftp_port;
|
||||
if (!in_array($sprache->ftp_adresse,$error)) $error[] = $sprache->ftp_adresse;
|
||||
if (!in_array($sprache->ftp_port,$error)) $error[] = $sprache->ftp_port;
|
||||
}
|
||||
if (count($error)==0 and isset($rootID)) {
|
||||
include(EASYWIDIR . '/stuff/ssh_exec.php');
|
||||
|
@ -146,7 +146,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$dbname .=' ( '.$row2['server'].' ) ';
|
||||
}
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'dbname'=>$dbname,'ip'=>$row['ip'],'interface'=>$row['interface']);
|
||||
$table[]=array('id' => $row['id'],'dbname' => $dbname,'ip' => $row['ip'],'interface' => $row['interface']);
|
||||
}
|
||||
}
|
||||
$template_file = "userpanel_mysql_db_list.tpl";
|
||||
|
@ -70,7 +70,7 @@ foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$customerp=$customer.'-p';
|
||||
$ftppass=$row['dftppassword'];
|
||||
$ftppassProtected=$row['dpftppassword'];
|
||||
foreach (explode("\r\n", $row['protectedSaveCFGs']) as $cfg) if ($cfg != '') $files[]=$cfg;
|
||||
foreach (explode("\r\n", $row['protectedSaveCFGs']) as $cfg) if ($cfg != '') $files[] = $cfg;
|
||||
$shorten=$row['shorten'];
|
||||
$serverTemplate=($row['servertemplate']!=1) ? $row['shorten'] . '-' . $row['servertemplate'] : $row['shorten'];
|
||||
if($row['gamebinary'] == 'srcds_run') $gamePath="${row['binarydir']}/${row['modfolder']}";
|
||||
|
@ -94,12 +94,12 @@ if ($ui->smallletters('edit',4,'post') == 'edit' and isset($serverip) and isset(
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$shorten=$row['shorten'];
|
||||
$uploadallowed[]=$row['upload'];
|
||||
$qstat_array[$shorten]=$row['qstat'];
|
||||
$uploadallowed[] = $row['upload'];
|
||||
$qstat_array[$shorten] = $row['qstat'];
|
||||
if (!isset($qstat)) {
|
||||
$qstat=$row['qstat'];
|
||||
}
|
||||
$table[$row['shorten']]=array('shorten'=>$shorten,'description'=>$row['description'],'defaultMapGroup'=>$row['mapGroup']);
|
||||
$table[$row['shorten']]=array('shorten' => $shorten,'description' => $row['description'],'defaultMapGroup' => $row['mapGroup']);
|
||||
}
|
||||
$template = '';
|
||||
$anticheat = '';
|
||||
@ -267,14 +267,14 @@ if ($ui->smallletters('edit',4,'post') == 'edit' and isset($serverip) and isset(
|
||||
} else if (isset($serverip) and isset($port)){
|
||||
$i = 0;
|
||||
while ($i<24) {
|
||||
$restarts[$i]=array('mon'=>'','tue'=>'','wed'=>'','thu'=>'','fri'=>'','sat'=>'','sun'=>'');
|
||||
$restarts[$i]=array('mon' => '','tue' => '','wed' => '','thu' => '','fri' => '','sat' => '','sun' => '');
|
||||
$i++;
|
||||
}
|
||||
$query = $sql->prepare("SELECT t.`shorten`,t.`qstat` FROM `serverlist` s LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE s.`switchID`=? AND s.`resellerid`=? GROUP BY t.`shorten`");
|
||||
$query->execute(array($ui->id('id',19,'get'),$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$shorten=$row['shorten'];
|
||||
$qstat_array[$shorten]=$row['qstat'];
|
||||
$qstat_array[$shorten] = $row['qstat'];
|
||||
}
|
||||
$backup = 'N';
|
||||
$query = $sql->prepare("SELECT `template`,`restarttime`,`gsswitch`,`anticheat`,`map`,`restart`,`backup`,`worldsafe`,`upload` FROM `gserver_restarts` WHERE `switchID`=? AND `resellerid`=?");
|
||||
@ -340,9 +340,9 @@ if ($ui->smallletters('edit',4,'post') == 'edit' and isset($serverip) and isset(
|
||||
$imgName='16_protected';
|
||||
$imgAlt='Protected';
|
||||
}
|
||||
$restarts[$hour][$day]=array('out'=>$routput,'img'=>$imgName,'alt'=>$imgAlt);
|
||||
$restarts[$hour][$day]=array('out' => $routput,'img' => $imgName,'alt' => $imgAlt);
|
||||
} else {
|
||||
$restarts[$hour][$day]=array('out'=>$routput);
|
||||
$restarts[$hour][$day]=array('out' => $routput);
|
||||
}
|
||||
}
|
||||
$template_file = "userpanel_gserver_calendar_list.tpl";
|
||||
|
@ -61,22 +61,22 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$ro = array();
|
||||
$query = $sql->prepare("SELECT `id`,`dbname` FROM `mysql_external_dbs` WHERE `uid`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $db[$row['id']]=$row['dbname'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $db[$row['id']] = $row['dbname'];
|
||||
$query = $sql->prepare("SELECT `id`,CONCAT(`serverip`,':',`port`) AS `address` FROM `gsswitch` WHERE `userid`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $gs[$row['id']]=$row['address'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $gs[$row['id']] = $row['address'];
|
||||
$query = $sql->prepare("SELECT `id`,CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `userid`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vo[$row['id']]=$row['address'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vo[$row['id']] = $row['address'];
|
||||
$query = $sql->prepare("SELECT `dnsID`,`dns` FROM `voice_dns` WHERE `userID`=? AND `resellerID`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vd[$row['dnsID']]=$row['dns'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vd[$row['dnsID']] = $row['dns'];
|
||||
$query = $sql->prepare("SELECT `id`,`ip` FROM `virtualcontainer` WHERE `userid`=? AND `resellerid`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vs[$row['id']]=$row['ip'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $vs[$row['id']] = $row['ip'];
|
||||
$query = $sql->prepare("SELECT `dedicatedID`,`ip` FROM `rootsDedicated` WHERE `userID`=? AND `resellerID`=? AND `active`='Y'");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $ro[$row['dedicatedID']]=$row['ip'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $ro[$row['dedicatedID']] = $row['ip'];
|
||||
}
|
||||
if (!$ui->st('action','post') and $ui->st('d','get') == 'ad') {
|
||||
$randompass=passwordgenerate(10);
|
||||
@ -169,7 +169,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `sID`,`loginName`,`active` FROM `userdata_substitutes` WHERE `userID`=? AND `resellerID`=?");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$table[]=array('id'=>$row['sID'],'loginName'=>$row['loginName'],'active'=>$row['active']);
|
||||
$table[]=array('id' => $row['sID'],'loginName' => $row['loginName'],'active' => $row['active']);
|
||||
}
|
||||
$template_file = 'userpanel_substitutes_list.tpl';
|
||||
}
|
@ -69,7 +69,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (empty($topic)) {
|
||||
$topic=$row['topic'];
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'topic'=>$topic);
|
||||
$table[]=array('id' => $row['id'],'topic' => $topic);
|
||||
if ($i==1) {
|
||||
$query2 = $sql->prepare("SELECT * FROM `ticket_topics` WHERE `maintopic`=? AND `maintopic`!=`id` AND `resellerid`=? ORDER BY `id`");
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
@ -84,7 +84,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (empty($topic)) {
|
||||
$topic=$row2['topic'];
|
||||
}
|
||||
$table2[]=array('id'=>$row2['id'],'topic'=>$topic);
|
||||
$table2[]=array('id' => $row2['id'],'topic' => $topic);
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
@ -220,7 +220,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$where='WHERE t.`userid`=? AND t.`resellerid`=?';
|
||||
if (isset($ui->get['ts'])) {
|
||||
foreach ($ui->get['ts'] as $get) {
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[]=$get;
|
||||
if (preg_match('/[ACDNPR]/',$get)) $selected[] = $get;
|
||||
}
|
||||
} else {
|
||||
$selected=array('A','D','N','P','R');
|
||||
@ -230,7 +230,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($selected as $get) {
|
||||
if ($i==0) $temp.="`state`='${get}'";
|
||||
else $temp.=" OR `state`='${get}'";
|
||||
$selected[]=$get;
|
||||
$selected[] = $get;
|
||||
$i++;
|
||||
}
|
||||
$temp.=')';
|
||||
@ -342,7 +342,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$status=$sprache->status_reopen;
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'priority'=>$priority,'writedate'=>$writedate,'supporter'=>(trim($row['vname'] . ' ' . $row['name']) != '') ? trim($row['vname'] . ' ' . $row['name']) : $row['cname'],'subject'=>$topic,'status'=>$status,'rawState'=>$row['state'],'statusClass'=>$statusClass);
|
||||
$table[]=array('id' => $row['id'],'priority' => $priority,'writedate' => $writedate,'supporter'=>(trim($row['vname'] . ' ' . $row['name']) != '') ? trim($row['vname'] . ' ' . $row['name']) : $row['cname'],'subject' => $topic,'status' => $status,'rawState' => $row['state'],'statusClass' => $statusClass);
|
||||
}
|
||||
$template_file = "userpanel_tickets_list.tpl";
|
||||
}
|
@ -112,7 +112,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`description`,`bitversion` FROM `resellerimages` WHERE `description` NOT IN ('Rescue 32bit','Rescue 64bit') ORDER BY `distro`,`bitversion`,`description`");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$templates[]=array('id'=>$row['id'],'description'=>$row['description']);
|
||||
$templates[]=array('id' => $row['id'],'description' => $row['description']);
|
||||
}
|
||||
$template_file = (isset($ip)) ? 'userpanel_root_virtual_ri.tpl' : 'admin_404.tpl';
|
||||
} else if (in_array($ui->st('action','post'), array('ri','rc','rs','st'))) {
|
||||
@ -126,11 +126,11 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if (isset($ip)) {
|
||||
$extraData = array();
|
||||
if ($ui->st('action','post') == 'ri') {
|
||||
$extraData['imageid']=$ui->id('imageid',10,'post');
|
||||
$extraData['imageid'] = $ui->id('imageid',10,'post');
|
||||
} else if ($ui->st('action','post') == 'rc') {
|
||||
$query = $sql->prepare("SELECT `id` FROM `resellerimages` WHERE `bitversion`=? AND `active`='Y' AND `distro`='other' AND `description` LIKE 'Rescue %' LIMIT 1");
|
||||
$query->execute(array($bitversion));
|
||||
$extraData['imageid']=$query->fetchColumn();
|
||||
$extraData['imageid'] = $query->fetchColumn();
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`hostID`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerID`) VALUES ('D','vs',NULL,?,?,NULL,?,NULL,NOW(),?,?,?)");
|
||||
$query->execute(array($user_id,$id,$ip,$ui->st('action','post'),json_encode($extraData),$reseller_id));
|
||||
@ -180,7 +180,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgAlt='Inactive';
|
||||
$active = 'N';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'ip'=>$row['ip'],'img'=>$imgName,'alt'=>$imgAlt,'active'=>$active,'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['id'],'ip' => $row['ip'],'img' => $imgName,'alt' => $imgAlt,'active' => $active,'jobPending' => $jobPending);
|
||||
}
|
||||
}
|
||||
$template_file = 'userpanel_root_virtual_list.tpl';
|
||||
|
@ -56,7 +56,7 @@ include(EASYWIDIR . '/stuff/class_voice.php');
|
||||
if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSION['sID']) or in_array($ui->id('id', 10, 'get'), $substituteAccess['vo']))) {
|
||||
$id=$ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT v.`id`,v.`ip`,v.`port`,v.`dns`,v.`localserverid`,m.`type`,m.`queryport`,AES_DECRYPT(m.`querypassword`,:aeskey) AS `decryptedquerypassword`,m.`rootid`,m.`addedby`,m.`ssh2ip`,m.`type`,m.`usedns`,m.`publickey`,m.`ssh2ip`,AES_DECRYPT(m.`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(m.`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(m.`ssh2password`,:aeskey) AS `decryptedssh2password`,m.`serverdir`,m.`keyname`,m.`notified` FROM `voice_server` v LEFT JOIN `voice_masterserver` m ON v.`masterserver`=m.`id` WHERE v.`active`='Y' AND m.`active`='Y' AND v.`backup`='Y' AND v.`id`=:server_id AND v.`userid`=:user_id AND v.`resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':server_id'=>$id,':user_id'=>$user_id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':server_id' => $id,':user_id' => $user_id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$dns=$row['dns'];
|
||||
if ($row['type'] == 'ts3') {
|
||||
@ -94,7 +94,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
$query2 = $sql->prepare("SELECT `id`,`name`,`date` FROM `voice_server_backup` WHERE `sid`=? AND `uid`=? AND `resellerid`=? ORDER BY `date` DESC");
|
||||
$query2->execute(array($id, $user_id, $reseller_id));
|
||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||
$table[]=array('id'=>$row2['id'],'date'=>$row2['date'],'name'=>$row2['name']);
|
||||
$table[]=array('id' => $row2['id'],'date' => $row2['date'],'name' => $row2['name']);
|
||||
}
|
||||
$template_file = "userpanel_voiceserver_backup_list.tpl";
|
||||
} else if (isset($server) and !$ui->smallletters('action',2,'post') and $ui->port('po', 'get') == 1) {
|
||||
@ -172,7 +172,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
$move = array();
|
||||
$channelListOld=@json_decode($row['channels']);
|
||||
$channelListDeployed=@json_decode($connection->channelList($volocalserverid));
|
||||
if (is_object($channelListDeployed) and is_object($channelListOld)) foreach ($channelListOld as $k=>$v) if (isset($channelListDeployed->$k)) $move[$v]=$channelListDeployed->$k;
|
||||
if (is_object($channelListDeployed) and is_object($channelListOld)) foreach ($channelListOld as $k=>$v) if (isset($channelListDeployed->$k)) $move[$v] = $channelListDeployed->$k;
|
||||
tsbackup('deploy', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $notified, $serverdir, $volocalserverid, $ui->id('id',10,'post'), $reseller_id, $sql, $move);
|
||||
$query = $sql->prepare("SELECT CONCAT(`ip`,':',`port`) AS `address` FROM `voice_server` WHERE `id`=? AND `userid`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($row['sid'], $user_id, $reseller_id));
|
||||
@ -198,7 +198,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
}
|
||||
if (isset($masterserver)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND (`resellerid`=:reseller_id OR (`managedServer`='Y' AND `managedForID`=:reseller_id)) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterserver,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterserver,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$masteractive=$row['active'];
|
||||
$addedby=$row['addedby'];
|
||||
@ -224,7 +224,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
$servergroups = array();
|
||||
foreach($connection->ServerGroups($localserverid) as $servergroup) {
|
||||
if ($servergroup['type'] == '1') {
|
||||
$servergroups[$servergroup['id']]=$servergroup['name'];
|
||||
$servergroups[$servergroup['id']] = $servergroup['name'];
|
||||
}
|
||||
}
|
||||
$template_file = "userpanel_voiceserver_key_add.tpl";
|
||||
@ -361,7 +361,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
$resellerToUse=$row2['resellerid'];
|
||||
$masteractive=$row2['active'];
|
||||
$usedns=$row2['usedns'];
|
||||
$defaultdns=strtolower($id.'.'.$row2['defaultdns']);
|
||||
$defaultdns=strtolower($id . '.' . $row2['defaultdns']);
|
||||
$queryport=$row2['queryport'];
|
||||
$querypassword=$row2['decryptedquerypassword'];
|
||||
$addedby=$row2['addedby'];
|
||||
@ -382,7 +382,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
$query2->execute(array($tsdnsServerID, $resellerToUse));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
if ($externalDefaultDNS== 'Y') {
|
||||
$defaultdns=strtolower($id.'.'.$row2['defaultdns']);
|
||||
$defaultdns=strtolower($id . '.' . $row2['defaultdns']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -439,7 +439,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
}
|
||||
if ($active == 'Y') {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND (`resellerid`=:reseller_id OR (`managedServer`='Y' AND `managedForID`=:reseller_id)) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterserver,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterserver,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$resellerToUse=$row['resellerid'];
|
||||
$masteractive=$row['active'];
|
||||
@ -477,7 +477,7 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
if ($fail!=1 and $usedns == 'Y' and $dns != $olddns and $dns != '' and $dnsCheck!==false) {
|
||||
if (isset($tsdnsServerID) and isid($tsdnsServerID,10) and isset($resellerToUse)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$resellerToUse));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $resellerToUse));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$ip=$row['ssh2ip'];
|
||||
@ -677,14 +677,14 @@ if ($ui->st('d','get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSIO
|
||||
} else {
|
||||
$maxtraffic=$row['maxtraffic'];
|
||||
}
|
||||
$initalize[]=$row['id'].'-start';
|
||||
$initalize[]=$row['id'].'-stop';
|
||||
$initalize[]=$row['id'].'-reinstall';
|
||||
$initalize[]=$row['id'].'-backup';
|
||||
$initalize[]=$row['id'].'-token';
|
||||
$initalize[]=$row['id'].'-settings';
|
||||
$initalize[] = $row['id'].'-start';
|
||||
$initalize[] = $row['id'].'-stop';
|
||||
$initalize[] = $row['id'].'-reinstall';
|
||||
$initalize[] = $row['id'].'-backup';
|
||||
$initalize[] = $row['id'].'-token';
|
||||
$initalize[] = $row['id'].'-settings';
|
||||
}
|
||||
$table[]=array('id'=>$row['id'],'virtual_id'=>$row['localserverid'],'backup'=>$row['backup'],'filetraffic'=>$filetraffic,'maxtraffic'=>$maxtraffic,'server'=>$server,'address'=>$address,'usage'=>$usage,'uptime'=>$uptime,'stopped'=>$stopped,'img'=>$imgName,'alt'=>$imgAlt,'type'=>$type);
|
||||
$table[]=array('id' => $row['id'],'virtual_id' => $row['localserverid'],'backup' => $row['backup'],'filetraffic' => $filetraffic,'maxtraffic' => $maxtraffic,'server' => $server,'address' => $address,'usage' => $usage,'uptime' => $uptime,'stopped' => $stopped,'img' => $imgName,'alt' => $imgAlt,'type' => $type);
|
||||
}
|
||||
}
|
||||
$template_file = "userpanel_voiceserver_list.tpl";
|
||||
|
@ -94,7 +94,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$error[]="DNS";
|
||||
}
|
||||
if (count($error)==0 and $ip==$oldip and $dns==$olddns and $port==$oldport) {
|
||||
$error[]=$spracheResponse->error_table;
|
||||
$error[] = $spracheResponse->error_table;
|
||||
} else if (count($error)==0 and checkDNS($dns,$id,$user_id,$type='dns')===false) {
|
||||
$error[]="DNS";
|
||||
}
|
||||
@ -103,7 +103,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -146,7 +146,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `dnsID`,`dns`,`ip`,`port` FROM `voice_dns` WHERE `active`='Y' AND `userID`=? AND `resellerID`=? ORDER BY $orderby");
|
||||
$query->execute(array($user_id,$reseller_id));
|
||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
if (!isset($_SESSION['sID']) or in_array($row['dnsID'],$substituteAccess['vd'])) $table[]=array('id'=>$row['dnsID'],'dns'=>$row['dns'],'address'=>$row['ip'] . ':' . $row['port']);
|
||||
if (!isset($_SESSION['sID']) or in_array($row['dnsID'],$substituteAccess['vd'])) $table[]=array('id' => $row['dnsID'],'dns' => $row['dns'],'address' => $row['ip'] . ':' . $row['port']);
|
||||
}
|
||||
$template_file = 'userpanel_voiceserver_dns_list.tpl';
|
||||
}
|
@ -54,10 +54,10 @@ if ($ui->st('d','get') == 'ud' and $reseller_id==0 and $pa['updateEW'] and ($ewV
|
||||
$this->response = array();
|
||||
}
|
||||
function add ($newtext) {
|
||||
$this->response[]=$newtext;
|
||||
$this->response[] = $newtext;
|
||||
}
|
||||
function addError ($newtext) {
|
||||
$this->errors[]=$newtext;
|
||||
$this->errors[] = $newtext;
|
||||
}
|
||||
function printresponse () {
|
||||
return $this->response;
|
||||
@ -90,7 +90,7 @@ if ($ui->st('d','get') == 'ud' and $reseller_id==0 and $pa['updateEW'] and ($ewV
|
||||
}
|
||||
if (is_dir(EASYWIDIR . '/tmp')) {
|
||||
$response->add('Creating tempfolder <b>tmp/</b>');
|
||||
$opts=stream_context_create(array('http'=>array('method'=>'GET','header'=>"Accept-language: en\r\nUser-Agent: ".$ui->server['HTTP_HOST']."\r\n")));
|
||||
$opts=stream_context_create(array('http'=>array('method' => 'GET','header'=>"Accept-language: en\r\nUser-Agent: ".$ui->server['HTTP_HOST']."\r\n")));
|
||||
$fp=@fopen('http://update.easy-wi.com/ew/'.$licenceDetails['v'].'.zip','rb', false,$opts);
|
||||
$zip=@fopen(EASYWIDIR . '/tmp/'.$licenceDetails['v'].'.zip','wb');
|
||||
if ($fp==true and $zip==true) {
|
||||
@ -184,17 +184,17 @@ if ($ui->st('d','get') == 'ud' and $reseller_id==0 and $pa['updateEW'] and ($ewV
|
||||
$query = $sql->prepare("SELECT `version`,`$column` FROM `easywi_version` ORDER BY `id` DESC");
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($row[$column] != null and $row[$column] != '') $table[]=array('version'=>$row['version'],'text'=>$row[$column]);
|
||||
if ($row[$column] != null and $row[$column] != '') $table[]=array('version' => $row['version'],'text' => $row[$column]);
|
||||
}
|
||||
$update=($reseller_id==0 and isset($pa['updateEW']) and $pa['updateEW']==true) ? '<div class="right"><a href="admin.php?w=vc&d=ud">Update</a></div>' : '';
|
||||
if ($ewVersions['cVersion']<$ewVersions['version']) {
|
||||
$state = 1;
|
||||
$class='versioncheckbad';
|
||||
$isok=$vcsprache->outdated . ' ' . $ewVersions['cVersion'] . ' ' . $vcsprache->latestversion . ' ' . $ewVersions['version'].'.'.$release . ' ' . $update;
|
||||
$isok=$vcsprache->outdated . ' ' . $ewVersions['cVersion'] . ' ' . $vcsprache->latestversion . ' ' . $ewVersions['version'] . '.' . $release . ' ' . $update;
|
||||
} else if ($ewVersions['files']<$ewVersions['version']) {
|
||||
$state = 1;
|
||||
$class='versioncheckbad';
|
||||
$isok=$vcsprache->filesoutdated . ' ' . $ewVersions['cVersion'].'. '.$vcsprache->latestversion . ' ' . $ewVersions['version'].'.'.$release . ' ' . $update;
|
||||
$isok=$vcsprache->filesoutdated . ' ' . $ewVersions['cVersion'].'. '.$vcsprache->latestversion . ' ' . $ewVersions['version'] . '.' . $release . ' ' . $update;
|
||||
} else {
|
||||
$state = 2;
|
||||
$class='versioncheckok';
|
||||
|
@ -71,13 +71,13 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$query = $sql->prepare("SELECT m.`id`,m.`ssh2ip`,m.`ips`,m.`usedns`,m.`defaultdns`,m.`type`,m.`rootid`,m.`maxserver`,m.`maxslots`,m.`active`,m.`resellerid`,m.`managedForID`,COUNT(v.`id`)*(100/m.`maxserver`) AS `serverpercent`,SUM(v.`slots`)*(100/m.`maxslots`) AS `slotpercent`,COUNT(v.`id`) AS `installedserver`,SUM(v.`slots`) AS `installedslots`,SUM(v.`usedslots`) AS `uslots`,r.`ip` FROM `voice_masterserver` m LEFT JOIN `rserverdata` r ON m.`rootid`=r.`id` LEFT JOIN `voice_server` v ON m.`id`=v.`masterserver` GROUP BY m.`id` HAVING (`installedserver`<`maxserver` AND (`installedslots`<`maxslots` OR `installedslots` IS NULL) AND `active`='Y' AND (`resellerid`=? OR m.`managedForID`=?)) ORDER BY `slotpercent`,`serverpercent` ASC");
|
||||
$query->execute(array($reseller_id,$admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$ips[]=$row['ssh2ip'];
|
||||
foreach (ipstoarray($row['ips']) as $ip) $ips[]=$ip;
|
||||
$ips[] = $row['ssh2ip'];
|
||||
foreach (ipstoarray($row['ips']) as $ip) $ips[] = $ip;
|
||||
if ($row['type'] == 'ts3') $type=$sprache->ts3;
|
||||
$installedserver=($row['installedserver'] == null) ? 0 : $row['installedserver'];
|
||||
$installedslots=($row['installedslots'] == null) ? 0 : $row['installedslots'];
|
||||
$uslots=($row['uslots'] == null) ? 0 : $row['uslots'];
|
||||
$table2[]=array('id'=>$row['id'],'server'=>implode('/', array_unique($ips)),'type'=>$type,'maxserver'=>$row['maxserver'],'maxslots'=>$row['maxslots'],'installedserver'=>$installedserver,'uslots'=>$uslots,'installedslots'=>$installedslots);
|
||||
$table2[]=array('id' => $row['id'],'server'=>implode('/', array_unique($ips)),'type' => $type,'maxserver' => $row['maxserver'],'maxslots' => $row['maxslots'],'installedserver' => $installedserver,'uslots' => $uslots,'installedslots' => $installedslots);
|
||||
}
|
||||
$template_file = "admin_voiceserver_add.tpl";
|
||||
} else if ($ui->w('action',3,'post') == 'ad' and $ui->id('masterserver',19,'post') and $ui->id('customer',19,'post')) {
|
||||
@ -92,12 +92,12 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$installedserver=($row2['installedserver'] == null) ? 0 : $row2['installedserver'];
|
||||
$installedslots=($row2['installedslots'] == null) ? 0 : $row2['installedslots'];
|
||||
if ($row2['usedns'] == 'Y') {
|
||||
$dns=strtolower($cname.'.'.$row2['defaultdns']);
|
||||
$dns=strtolower($cname . '.' . $row2['defaultdns']);
|
||||
if ($row2['externalDefaultDNS'] == 'Y' and isid($row2['tsdnsServerID'],19)) {
|
||||
$query3 = $sql->prepare("SELECT `defaultdns` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['tsdnsServerID'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$dns=strtolower($cname.'.'.$row3['defaultdns']);
|
||||
$dns=strtolower($cname . '.' . $row3['defaultdns']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -117,17 +117,17 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$defaultFlexSlotsFree=$row2['defaultFlexSlotsFree'];
|
||||
$defaultFlexSlotsPercent=$row2['defaultFlexSlotsPercent'];
|
||||
if ($addedby == '2') {
|
||||
$ips[]=$row2['ssh2ip'];
|
||||
$ips[] = $row2['ssh2ip'];
|
||||
foreach (preg_split('/\r\n/', $row2['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
|
||||
$ips[]=$ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
} else if ($addedby == '1') {
|
||||
$query3 = $sql->prepare("SELECT `ip`,`altips` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['rootid'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$ips[]=$row3['ip'];
|
||||
$ips[] = $row3['ip'];
|
||||
foreach (preg_split('/\r\n/', $row3['altips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
|
||||
$ips[]=$ip;
|
||||
$ips[] = $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -137,18 +137,18 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$query = $sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? ORDER BY `port`");
|
||||
$query->execute(array($serverIP));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (is_numeric($row['port'])) $ports[]=$row['port'];
|
||||
if (is_numeric($row['port2'])) $ports[]=$row['port2'];
|
||||
if (is_numeric($row['port3'])) $ports[]=$row['port3'];
|
||||
if (is_numeric($row['port4'])) $ports[]=$row['port4'];
|
||||
if (is_numeric($row['port5'])) $ports[]=$row['port5'];
|
||||
if (is_numeric($row['port'])) $ports[] = $row['port'];
|
||||
if (is_numeric($row['port2'])) $ports[] = $row['port2'];
|
||||
if (is_numeric($row['port3'])) $ports[] = $row['port3'];
|
||||
if (is_numeric($row['port4'])) $ports[] = $row['port4'];
|
||||
if (is_numeric($row['port5'])) $ports[] = $row['port5'];
|
||||
}
|
||||
$query = $sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
|
||||
$query->execute(array($ips[0]));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if (is_numeric($row['port']))$ports[]=$row['port'];
|
||||
if (is_numeric($row['port']))$ports[] = $row['port'];
|
||||
}
|
||||
$portsArray[count($ports)]=array('ip'=>$serverIP,'ports'=>$ports);
|
||||
$portsArray[count($ports)]=array('ip' => $serverIP,'ports' => $ports);
|
||||
}
|
||||
$bestIP=current($portsArray);
|
||||
$ip=$bestIP['ip'];
|
||||
@ -169,25 +169,25 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
if ($ui->startparameter('name','post')) {
|
||||
$name=$ui->startparameter('name','post');
|
||||
} else {
|
||||
$errors[]=$sprache->name;
|
||||
$errors[] = $sprache->name;
|
||||
}
|
||||
if ($ui->ip('ip','post')) {
|
||||
$ip=$ui->ip('ip','post');
|
||||
} else {
|
||||
$errors[]=$sprache->ip;
|
||||
$errors[] = $sprache->ip;
|
||||
}
|
||||
if ($ui->port('port','post')) {
|
||||
$port=$ui->port('port','post');
|
||||
if (isset($ip)) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `serverip`=:serverip AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':port'=>$port,':serverip'=>$ip,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':port' => $port,':serverip' => $ip,':reseller_id' => $reseller_id));
|
||||
$query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($port,$ip,$reseller_id));
|
||||
$num_check_game=$query->rowCount()+$query2->rowCount();
|
||||
if ($num_check_game>0) $errors[]=$sprache->port;
|
||||
if ($num_check_game>0) $errors[] = $sprache->port;
|
||||
}
|
||||
} else {
|
||||
$errors[]=$sprache->port;
|
||||
$errors[] = $sprache->port;
|
||||
}
|
||||
$masterserver=$ui->id('masterserver',19,'post');
|
||||
$customer=$ui->id('customer',19,'post');
|
||||
@ -216,7 +216,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
if ($ui->id('slots',30,'post')) {
|
||||
$slots=$ui->id('slots',30,'post');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterserver,':reseller_id'=>$reseller_id,':managedForID'=>$admin_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterserver,':reseller_id' => $reseller_id,':managedForID' => $admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$defaultname=$row['defaultname'];
|
||||
@ -260,14 +260,14 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$installedserver=($row['installedserver'] == null) ? 0 : $row['installedserver'];
|
||||
$installedslots=($row['installedslots'] == null) ? 0 : $row['installedslots'];
|
||||
if (($installedslots+$slots)>$maxslots) $errors[]=$gsprache->licence.' ('.$sprache->slots.')';
|
||||
if ($installedserver>=$maxserver) $errors[]=$gsprache->licence;
|
||||
if (($installedslots+$slots)>$maxslots) $errors[] = $gsprache->licence.' ('.$sprache->slots.')';
|
||||
if ($installedserver>=$maxserver) $errors[] = $gsprache->licence;
|
||||
}
|
||||
} else {
|
||||
$errors[]=$sprache->rootserver;
|
||||
$errors[] = $sprache->rootserver;
|
||||
}
|
||||
} else {
|
||||
$errors[]=$sprache->slots;
|
||||
$errors[] = $sprache->slots;
|
||||
}
|
||||
if (count($errors)==0) {
|
||||
$initialpassword = '';
|
||||
@ -289,14 +289,14 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
customColumns('T',$ts3LocalID,'save');
|
||||
$template_file = $spracheResponse->table_add;
|
||||
if ($usedns == 'Y') {
|
||||
if ($dns==strtolower($username.'.'.$defaultdns)) {
|
||||
$dns=strtolower($ts3LocalID.'.'.$defaultdns);
|
||||
if ($dns==strtolower($username . '.' . $defaultdns)) {
|
||||
$dns=strtolower($ts3LocalID . '.' . $defaultdns);
|
||||
$query = $sql->prepare("UPDATE `voice_server` SET `dns`=? WHERE `id`=? LIMIT 1");
|
||||
$query->execute(array($dns,$ts3LocalID));
|
||||
}
|
||||
if (isid($tsdnsServerID,19)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -337,7 +337,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$template_file = 'admin_voiceserver_dl.tpl';
|
||||
} else if ($ui->w('action',2,'post') == 'dl' and isset($server)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterserver,':reseller_id'=>$reseller_id,':managedForID'=>$admin_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterserver,':reseller_id' => $reseller_id,':managedForID' => $admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$defaultdns=$row['defaultdns'];
|
||||
$serverdir=$row['serverdir'];
|
||||
@ -385,7 +385,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
if (isset($usedns) and $usedns == 'Y') {
|
||||
if (isset($tsdnsServerID) and isid($tsdnsServerID,19)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$reseller_id,':managedForID'=>$admin_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $reseller_id,':managedForID' => $admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -455,31 +455,31 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$addedby=$row2['addedby'];
|
||||
if ($addedby == '2') {
|
||||
$queryip=$row2['ssh2ip'];
|
||||
$ips[]=$row2['ssh2ip'];
|
||||
foreach (preg_split('/\r\n/', $row2['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) $ips[]=$ip;
|
||||
$ips[] = $row2['ssh2ip'];
|
||||
foreach (preg_split('/\r\n/', $row2['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) $ips[] = $ip;
|
||||
} else if ($addedby == '1') {
|
||||
$query3 = $sql->prepare("SELECT `ip`,`altips` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query3->execute(array($row2['rootid'],$reseller_id));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
$queryip=$row3['ip'];
|
||||
$ips[]=$row3['ip'];
|
||||
foreach (preg_split('/\r\n/', $row3['altips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) $ips[]=$ip;
|
||||
$ips[] = $row3['ip'];
|
||||
foreach (preg_split('/\r\n/', $row3['altips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) $ips[] = $ip;
|
||||
}
|
||||
}
|
||||
$ports = array();
|
||||
$query3 = $sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? ORDER BY `port`");
|
||||
$query3->execute(array($ips[0]));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
if (is_numeric($row3['port'])) $ports[]=$row3['port'];
|
||||
if (is_numeric($row3['port2'])) $ports[]=$row3['port2'];
|
||||
if (is_numeric($row3['port3'])) $ports[]=$row3['port3'];
|
||||
if (is_numeric($row3['port4'])) $ports[]=$row3['port4'];
|
||||
if (is_numeric($row3['port5'])) $ports[]=$row3['port5'];
|
||||
if (is_numeric($row3['port'])) $ports[] = $row3['port'];
|
||||
if (is_numeric($row3['port2'])) $ports[] = $row3['port2'];
|
||||
if (is_numeric($row3['port3'])) $ports[] = $row3['port3'];
|
||||
if (is_numeric($row3['port4'])) $ports[] = $row3['port4'];
|
||||
if (is_numeric($row3['port5'])) $ports[] = $row3['port5'];
|
||||
}
|
||||
$query3 = $sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
|
||||
$query3->execute(array($ips[0]));
|
||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||
if (is_numeric($row3['port'])) $ports[]=$row3['port'];
|
||||
if (is_numeric($row3['port'])) $ports[] = $row3['port'];
|
||||
}
|
||||
asort($ports);
|
||||
$ports=implode(", ", $ports);
|
||||
@ -510,10 +510,10 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$masterserver = 0;
|
||||
$slots=$ui->id('slots',30,'post');
|
||||
$ip=$ui->ip('ip','post');
|
||||
if (!$ui->id('slots',30,'post')) $errors[]=$sprache->slots;
|
||||
if (!$ui->ip('ip','post')) $errors[]=$sprache->ip;
|
||||
if (!$ui->id('slots',30,'post')) $errors[] = $sprache->slots;
|
||||
if (!$ui->ip('ip','post')) $errors[] = $sprache->ip;
|
||||
if ($ui->password('initialpassword',50,'post') or (isset($ui->post['initialpassword']) and ($ui->post['initialpassword'] == '' or $ui->post['initialpassword'] == null))) $initialpassword=$ui->post['initialpassword'];
|
||||
else $errors[]=$sprache->password;
|
||||
else $errors[] = $sprache->password;
|
||||
|
||||
$query = $sql->prepare("SELECT * FROM `voice_server` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
@ -532,11 +532,11 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$query2->execute(array($masterserver,$reseller_id));
|
||||
$futureSlots=(int)$query2->fetchColumn()-$oldslots+$slots;
|
||||
}
|
||||
if (!isset($oldslots)) $errors[]=$gsprache->voiceserver.' ID';
|
||||
if (!isset($oldslots)) $errors[] = $gsprache->voiceserver.' ID';
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterserver,':reseller_id'=>$reseller_id,':managedForID'=>$admin_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterserver,':reseller_id' => $reseller_id,':managedForID' => $admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($futureSlots>$row['maxslots']) $errors[]=$gsprache->licence.' ('.$sprache->slots.')';
|
||||
if ($futureSlots>$row['maxslots']) $errors[] = $gsprache->licence.' ('.$sprache->slots.')';
|
||||
$serverdir=$row['serverdir'];
|
||||
$addedby=$row['addedby'];
|
||||
$usedns=$row['usedns'];
|
||||
@ -562,19 +562,19 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($queryport)) $errors[]=$sprache->rootserver;
|
||||
if (!isset($queryport)) $errors[] = $sprache->rootserver;
|
||||
if ($ui->port('port','post')) {
|
||||
$port=$ui->port('port','post');
|
||||
if (isset($ip) and ($port != $oldport or $ip != $oldip)) {
|
||||
$query = $sql->prepare("SELECT `id` FROM `gsswitch` WHERE (`port`=:port OR `port2`=:port OR `port3`=:port OR `port4`=:port OR `port5`=:port) AND `serverip`=:serverip LIMIT 1");
|
||||
$query->execute(array(':port'=>$port,':serverip'=>$ip));
|
||||
$query->execute(array(':port' => $port,':serverip' => $ip));
|
||||
$query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `port`=? AND `ip`=? LIMIT 1");
|
||||
$query2->execute(array($port,$ip));
|
||||
$num_check_game=$query->rowcount()+$query2->rowcount();
|
||||
if ($num_check_game>0) $errors[]=$sprache->port;
|
||||
if ($num_check_game>0) $errors[] = $sprache->port;
|
||||
}
|
||||
} else {
|
||||
$errors[]=$sprache->port;
|
||||
$errors[] = $sprache->port;
|
||||
}
|
||||
$max_download_total_bandwidth=($ui->id('max_download_total_bandwidth',255,'post')) ? $ui->id('max_download_total_bandwidth',255,'post') : 65536;
|
||||
$max_upload_total_bandwidth=($ui->id('max_upload_total_bandwidth',255,'post')) ? $ui->id('max_upload_total_bandwidth',255,'post') : 65536;
|
||||
@ -601,7 +601,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
if ($usedns == 'Y') {
|
||||
if (isid($tsdnsServerID,19)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `dnsID`=:id AND (`resellerid`=:reseller_id OR `managedForID`=:managedForID) LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$reseller_id,':managedForID'=>$admin_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $reseller_id,':managedForID' => $admin_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -751,7 +751,7 @@ if ($ui->st('d','get') == 'ad' and is_numeric($licenceDetails['lVo']) and $licen
|
||||
$minutes=floor(($row['uptime']-($days*86400)-($hours*3600))/60);
|
||||
$uptime=$days.'D '.$hours.'H '.$minutes.'M';
|
||||
$userid=$row['userid'];
|
||||
$table[]=array('id'=>$row['id'],'active'=>$row['active'],'virtualID'=>$row['localserverid'],'img'=>$imgName,'alt'=>$imgAlt,'usage'=>$usage,'uptime'=>$uptime,'server'=>$server,'cname'=>$row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'userid'=>$userid,'lendserver'=>$lendserver,'type'=>$type,'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['id'],'active' => $row['active'],'virtualID' => $row['localserverid'],'img' => $imgName,'alt' => $imgAlt,'usage' => $usage,'uptime' => $uptime,'server' => $server,'cname' => $row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'userid' => $userid,'lendserver' => $lendserver,'type' => $type,'jobPending' => $jobPending);
|
||||
}
|
||||
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `voice_server` WHERE `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
|
@ -93,12 +93,12 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$externalDNS = array();
|
||||
$query = $sql->prepare("SELECT `id`,`ssh2ip`,`description` FROM `voice_tsdns` WHERE `active`='Y' AND `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $externalDNS[$row['id']]=$row['ssh2ip'].': '.$row['description'];
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) $externalDNS[$row['id']] = $row['ssh2ip'].': '.$row['description'];
|
||||
$template_file = 'admin_voicemasterserver_add.tpl';
|
||||
} else if ($ui->st('d','get') == 'md' and !$ui->w('action',3,'post') and $ui->id('id',19,'get')) {
|
||||
$id=$ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$defaultname=$row['defaultname'];
|
||||
@ -152,7 +152,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query = $sql->prepare("SELECT `id`,`ssh2ip`,`description` FROM `voice_tsdns` WHERE `active`='Y' AND `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$externalDNS[$row['id']]=$row['ssh2ip'].': '.$row['description'];
|
||||
$externalDNS[$row['id']] = $row['ssh2ip'].': '.$row['description'];
|
||||
}
|
||||
if (isset($defaultname)) {
|
||||
$template_file = 'admin_voicemasterserver_md.tpl';
|
||||
@ -294,7 +294,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if ($ui->st('d','get') == 'ri' and $id=$ui->id('id', 10, 'get')) {
|
||||
$masterid=$id=$ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterid,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterid,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$defaultname=$row['defaultname'];
|
||||
@ -361,7 +361,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($usedns == 'Y') {
|
||||
if (isset($tsdnsServerID) and isid($tsdnsServerID,19)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$ip=$row['ssh2ip'];
|
||||
@ -419,7 +419,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
|
||||
// https://github.com/easy-wi/developer/issues/36 managedServer,managedForID added
|
||||
$query = $sql->prepare("INSERT INTO `voice_masterserver` (`active`,`type`,`defaultname`,`bitversion`,`queryport`,`querypassword`,`filetransferport`,`maxserver`,`maxslots`,`rootid`,`addedby`,`usedns`,`defaultdns`,`defaultwelcome`,`defaulthostbanner_url`,`defaulthostbanner_gfx_url`,`defaulthostbutton_tooltip`,`defaulthostbutton_url`,`defaulthostbutton_gfx_url`,`defaultFlexSlotsFree`,`defaultFlexSlotsPercent`,`publickey`,`ssh2ip`,`ssh2port`,`ssh2user`,`ssh2password`,`ips`,`serverdir`,`keyname`,`autorestart`,`externalID`,`tsdnsServerID`,`externalDefaultDNS`,`managedServer`,`managedForID`,`resellerid`) VALUES (:active,:type,:defaultname,:bit,:queryport,AES_ENCRYPT(:querypassword,:aeskey),:filetransferport,:maxserver,:maxslots,:rootid,:addedby,:usedns,:defaultdns,:defaultwelcome,:defaulthostbanner_url,:defaulthostbanner_gfx_url,:defaulthostbutton_tooltip,:defaulthostbutton_url,:defaulthostbutton_gfx_url,:defaultFlexSlotsFree,:defaultFlexSlotsPercent,:publickey,:ssh2ip,AES_ENCRYPT(:ssh2port,:aeskey),AES_ENCRYPT(:ssh2user,:aeskey),AES_ENCRYPT(:ssh2password,:aeskey),:ips,:serverdir,:keyname,:autorestart,:externalID,:tsdnsServerID,:externalDefaultDNS,:managedServer,:managedForID,:reseller_id)");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':active'=>$active,':type'=>$type,':defaultname'=>$defaultname,':bit'=>$bit,':queryport'=>$queryport,':querypassword'=>$querypassword,':filetransferport'=>$filetransferport,':maxserver'=>$maxserver,':maxslots'=>$maxslots,':rootid'=>$rootid,':addedby'=>$addtype,':usedns'=>$usedns,':defaultdns'=>$defaultdns,':defaultwelcome'=>$defaultwelcome,':defaulthostbanner_url'=>$defaulthostbanner_url,':defaulthostbanner_gfx_url'=>$defaulthostbanner_gfx_url,':defaulthostbutton_tooltip'=>$defaulthostbutton_tooltip,':defaulthostbutton_url'=>$defaulthostbutton_url,':defaulthostbutton_gfx_url'=>$defaulthostbutton_gfx_url,':defaultFlexSlotsFree'=>$defaultFlexSlotsFree,':defaultFlexSlotsPercent'=>$defaultFlexSlotsPercent,':publickey'=>$publickey,':ssh2ip'=>$ip,':ssh2port'=>$port,':ssh2user'=>$user,':ssh2password'=>$pass,':ips'=>$ips,':serverdir'=>$serverdir,':keyname'=>$keyname,':autorestart'=>$autorestart,':externalID'=>$externalID,':tsdnsServerID'=>$tsdnsServerID,':externalDefaultDNS'=>$externalDefaultDNS,':managedServer'=>$ui->active('managedServer','post'),':managedForID'=>$resellerToBeWritten,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':active' => $active,':type' => $type,':defaultname' => $defaultname,':bit' => $bit,':queryport' => $queryport,':querypassword' => $querypassword,':filetransferport' => $filetransferport,':maxserver' => $maxserver,':maxslots' => $maxslots,':rootid' => $rootid,':addedby' => $addtype,':usedns' => $usedns,':defaultdns' => $defaultdns,':defaultwelcome' => $defaultwelcome,':defaulthostbanner_url' => $defaulthostbanner_url,':defaulthostbanner_gfx_url' => $defaulthostbanner_gfx_url,':defaulthostbutton_tooltip' => $defaulthostbutton_tooltip,':defaulthostbutton_url' => $defaulthostbutton_url,':defaulthostbutton_gfx_url' => $defaulthostbutton_gfx_url,':defaultFlexSlotsFree' => $defaultFlexSlotsFree,':defaultFlexSlotsPercent' => $defaultFlexSlotsPercent,':publickey' => $publickey,':ssh2ip' => $ip,':ssh2port' => $port,':ssh2user' => $user,':ssh2password' => $pass,':ips' => $ips,':serverdir' => $serverdir,':keyname' => $keyname,':autorestart' => $autorestart,':externalID' => $externalID,':tsdnsServerID' => $tsdnsServerID,':externalDefaultDNS' => $externalDefaultDNS,':managedServer' => $ui->active('managedServer','post'),':managedForID' => $resellerToBeWritten,':reseller_id' => $reseller_id));
|
||||
$loguseraction="%add% %voserver% %master% $ip";
|
||||
$insertlog->execute();
|
||||
$query = $sql->prepare("SELECT `id` FROM `voice_masterserver` WHERE `rootid`=? AND `ssh2ip`=? AND `resellerid`=? LIMIT 1");
|
||||
@ -435,7 +435,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if ($ui->w('action',3,'post') == 'md') {
|
||||
$tsstop = '';
|
||||
$query = $sql->prepare("SELECT `active`,`type`,`rootid`,`addedby`,`ssh2ip`,`notified`,`usedns`,`publickey`,`keyname`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password`,`serverdir`,`bitversion` FROM `voice_masterserver` WHERE `id`=:id AND `resellerid`=:reseller_id");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$oldactive=$row['active'];
|
||||
$ts3masternotified=$row['notified'];
|
||||
@ -456,7 +456,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$key=EASYWIDIR . '/keys/'.$sshkey;
|
||||
|
||||
if (file_exists($pubkey) and file_exists($key)) {
|
||||
$ssh2= @ssh2_connect($queryip, $row['decryptedssh2port'], array('hostkey'=>'ssh-rsa'));
|
||||
$ssh2= @ssh2_connect($queryip, $row['decryptedssh2port'], array('hostkey' => 'ssh-rsa'));
|
||||
} else {
|
||||
$ssh2 = false;
|
||||
}
|
||||
@ -515,7 +515,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
|
||||
// https://github.com/easy-wi/developer/issues/36 managedServer,managedForID added
|
||||
$query = $sql->prepare("UPDATE `voice_masterserver` SET `active`=:active,`managedServer`=:managedServer,`managedForID`=:managedForID,`externalID`=:externalID,`defaultname`=:defaultname,`bitversion`=:bit,`queryport`=:queryport,`querypassword`=AES_ENCRYPT(:querypassword,:aeskey),`filetransferport`=:filetransferport,`maxserver`=:maxserver,`maxslots`=:maxslots,`usedns`=:usedns,`defaultdns`=:defaultdns,`defaultwelcome`=:defaultwelcome,`defaulthostbanner_url`=:defaulthostbanner_url,`defaulthostbanner_gfx_url`=:defaulthostbanner_gfx_url,`defaulthostbutton_tooltip`=:defaulthostbutton_tooltip,`defaulthostbutton_url`=:defaulthostbutton_url,`defaulthostbutton_gfx_url`=:defaulthostbutton_gfx_url,`defaultFlexSlotsFree`=:defaultFlexSlotsFree,`defaultFlexSlotsPercent`=:defaultFlexSlotsPercent,`publickey`=:publickey,`ssh2ip`=:ssh2ip,`ssh2port`=AES_ENCRYPT(:ssh2port,:aeskey),`ssh2user`=AES_ENCRYPT(:ssh2user,:aeskey),`ssh2password`=AES_ENCRYPT(:ssh2password,:aeskey),`ips`=:ips,`serverdir`=:serverdir,`keyname`=:keyname,`autorestart`=:autorestart,`tsdnsServerID`=:tsdnsServerID,`externalDefaultDNS`=:externalDefaultDNS WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':active'=>$active,':managedServer'=>$ui->active('managedServer','post'),':managedForID'=>$resellerToBeWritten,':externalID'=>$externalID,':defaultname'=>$defaultname,':bit'=>$bit,':queryport'=>$queryport,':querypassword'=>$querypassword,':filetransferport'=>$filetransferport,':maxserver'=>$maxserver,':maxslots'=>$maxslots,':usedns'=>$usedns,':defaultdns'=>$defaultdns,':defaultwelcome'=>$defaultwelcome,':defaulthostbanner_url'=>$defaulthostbanner_url,':defaulthostbanner_gfx_url'=>$defaulthostbanner_gfx_url,':defaulthostbutton_tooltip'=>$defaulthostbutton_tooltip,':defaulthostbutton_url'=>$defaulthostbutton_url,':defaulthostbutton_gfx_url'=>$defaulthostbutton_gfx_url,':defaultFlexSlotsFree'=>$defaultFlexSlotsFree,':defaultFlexSlotsPercent'=>$defaultFlexSlotsPercent,':publickey'=>$publickey,':ssh2ip'=>$ip,':ssh2port'=>$port,':ssh2user'=>$user,':ssh2password'=>$pass,':ips'=>$ips,':serverdir'=>$serverdir,':keyname'=>$keyname,':autorestart'=>$autorestart,':tsdnsServerID'=>$tsdnsServerID,':externalDefaultDNS'=>$externalDefaultDNS,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':active' => $active,':managedServer' => $ui->active('managedServer','post'),':managedForID' => $resellerToBeWritten,':externalID' => $externalID,':defaultname' => $defaultname,':bit' => $bit,':queryport' => $queryport,':querypassword' => $querypassword,':filetransferport' => $filetransferport,':maxserver' => $maxserver,':maxslots' => $maxslots,':usedns' => $usedns,':defaultdns' => $defaultdns,':defaultwelcome' => $defaultwelcome,':defaulthostbanner_url' => $defaulthostbanner_url,':defaulthostbanner_gfx_url' => $defaulthostbanner_gfx_url,':defaulthostbutton_tooltip' => $defaulthostbutton_tooltip,':defaulthostbutton_url' => $defaulthostbutton_url,':defaulthostbutton_gfx_url' => $defaulthostbutton_gfx_url,':defaultFlexSlotsFree' => $defaultFlexSlotsFree,':defaultFlexSlotsPercent' => $defaultFlexSlotsPercent,':publickey' => $publickey,':ssh2ip' => $ip,':ssh2port' => $port,':ssh2user' => $user,':ssh2password' => $pass,':ips' => $ips,':serverdir' => $serverdir,':keyname' => $keyname,':autorestart' => $autorestart,':tsdnsServerID' => $tsdnsServerID,':externalDefaultDNS' => $externalDefaultDNS,':id' => $id,':reseller_id' => $reseller_id));
|
||||
$template_file = $tsstop.$spracheResponse->table_add;
|
||||
$loguseraction="%mod% %voserver% %master% $ip";
|
||||
$insertlog->execute();
|
||||
@ -527,7 +527,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($ui->id('id', 10, 'get')) {
|
||||
$masterid=$ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`querypassword`,:aeskey) AS `decryptedquerypassword`,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_masterserver` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$masterid,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $masterid,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$defaultdns=$row['defaultdns'];
|
||||
$serverdir=$row['serverdir'];
|
||||
@ -562,7 +562,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
if (isid($tsdnsServerID,19)) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsServerID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsServerID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$ssh2ip=$row['ssh2ip'];
|
||||
@ -619,7 +619,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
} else {
|
||||
$userlist = '';
|
||||
$cldbid=rand(1,100).'.'.rand(1,100);
|
||||
$cldbid=rand(1,100) . '.' . rand(1,100);
|
||||
$adminList=$connection->AdminList($virtualserver_id);
|
||||
if (is_array($adminList)) {
|
||||
foreach ($adminList as $cldbid=>$client_unique_identifier) {
|
||||
@ -665,7 +665,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$password = 'N';
|
||||
}
|
||||
$serverdns=($ui->domain("$virtualserver_id-virtualserver_dns",'post') == '') ? $cnamenew . '-' . $virtualserver_id.'.'.$defaultdns: $ui->domain("$virtualserver_id-virtualserver_dns",'post');
|
||||
$serverdns=($ui->domain("$virtualserver_id-virtualserver_dns",'post') == '') ? $cnamenew . '-' . $virtualserver_id . '.' . $defaultdns: $ui->domain("$virtualserver_id-virtualserver_dns",'post');
|
||||
if($port != null) {
|
||||
$serverdns=strtolower($serverdns);
|
||||
unset($addlist);
|
||||
@ -679,8 +679,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($forcebanner== 'Y') {
|
||||
$removelist[] = 'b_virtualserver_modify_hostbanner';
|
||||
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
||||
$settings['virtualserver_hostbanner_url']=$defaulthostbanner_url;
|
||||
$settings['virtualserver_hostbanner_gfx_url']=$defaulthostbanner_gfx_url;
|
||||
$settings['virtualserver_hostbanner_url'] = $defaulthostbanner_url;
|
||||
$settings['virtualserver_hostbanner_gfx_url'] = $defaulthostbanner_gfx_url;
|
||||
} else if ($forcebanner== 'N') {
|
||||
$addlist[] = 'b_virtualserver_modify_hostbanner';
|
||||
$addlist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
||||
@ -688,9 +688,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($forcebutton == 'Y') {
|
||||
$removelist[] = 'b_virtualserver_modify_hostbutton';
|
||||
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbutton';
|
||||
$settings['virtualserver_hostbutton_url']=$defaulthostbutton_url;
|
||||
$settings['virtualserver_hostbutton_gfx_url']=$defaulthostbutton_gfx_url;
|
||||
$settings['virtualserver_hostbutton_tooltip']=$defaulthostbutton_tooltip;
|
||||
$settings['virtualserver_hostbutton_url'] = $defaulthostbutton_url;
|
||||
$settings['virtualserver_hostbutton_gfx_url'] = $defaulthostbutton_gfx_url;
|
||||
$settings['virtualserver_hostbutton_tooltip'] = $defaulthostbutton_tooltip;
|
||||
} else if ($forcebutton == 'N') {
|
||||
$addlist[] = 'b_virtualserver_modify_hostbutton';
|
||||
$addlist[] = 'i_needed_modify_power_virtualserver_modify_hostbutton';
|
||||
@ -698,7 +698,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($forcewelcome == 'Y') {
|
||||
$removelist[] = 'b_virtualserver_modify_welcomemessage';
|
||||
$removelist[] = 'i_needed_modify_power_virtualserver_modify_welcomemessage';
|
||||
$settings['virtualserver_welcomemessage']=$defaultwelcome;
|
||||
$settings['virtualserver_welcomemessage'] = $defaultwelcome;
|
||||
} else if ($forcewelcome == 'N') {
|
||||
$addlist[] = 'b_virtualserver_modify_welcomemessage';
|
||||
$addlist[] = 'i_needed_modify_power_virtualserver_modify_welcomemessage';
|
||||
@ -732,14 +732,14 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
|
||||
$dns[]=$row2['dns'].'='.$row2['ip'] . ':' . $row2['port'];
|
||||
$dns[] = $row2['dns'].'='.$row2['ip'] . ':' . $row2['port'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT `ip`,`port`,`dns` FROM `voice_server` WHERE `masterserver`=? AND `resellerid`=?");
|
||||
$query->execute(array($masterid,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$dns[]=$row['dns'].'='.$row['ip'] . ':' . $row['port'];
|
||||
$dns[] = $row['dns'].'='.$row['ip'] . ':' . $row['port'];
|
||||
}
|
||||
}
|
||||
$dns=array_unique($dns);
|
||||
@ -874,9 +874,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
if ($row3['active'] == 'N' or $row3['uptime']==1) $vsStatus = 2;
|
||||
else if ($row3['active'] == 'Y' and $row3['uptime']<1) $vsStatus = 3;
|
||||
else $vsStatus = 1;
|
||||
$vs[]=array('id'=>$row3['id'],'address'=>$row3['address'],'name'=>$row3['queryName'],'status'=>$vsStatus);
|
||||
$vs[]=array('id' => $row3['id'],'address' => $row3['address'],'name' => $row3['queryName'],'status' => $vsStatus);
|
||||
}
|
||||
$table[]=array('id'=>$id,'active'=>$row['active'],'managedServer'=>$row['managedServer'],'img'=>$imgName,'alt'=>$imgAlt,'ip'=>$ip,'type'=>$type,'defaultdns'=>$defaultdns,'installedserver'=>$row['installedserver']. '/' . $row['maxserver'],'installedslots'=>$uslots. '/' . $installedslots. '/' . $row['maxslots'],'server'=>$vs);
|
||||
$table[]=array('id' => $id,'active' => $row['active'],'managedServer' => $row['managedServer'],'img' => $imgName,'alt' => $imgAlt,'ip' => $ip,'type' => $type,'defaultdns' => $defaultdns,'installedserver' => $row['installedserver']. '/' . $row['maxserver'],'installedslots' => $uslots. '/' . $installedslots. '/' . $row['maxslots'],'server' => $vs);
|
||||
}
|
||||
}
|
||||
$next=$start+$amount;
|
||||
|
@ -70,7 +70,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else if ($ui->st('d','get') == 'md' and !$ui->smallletters('action',2,'post') and $ui->id('id',19,'get')) {
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$active=$row['active'];
|
||||
$description=$row['description'];
|
||||
@ -141,7 +141,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($ip));
|
||||
if ($query->fetchColumn()==0) {
|
||||
$query = $sql->prepare("INSERT INTO `voice_tsdns` (`active`,`bitversion`,`defaultdns`,`publickey`,`ssh2ip`,`ssh2port`,`ssh2user`,`ssh2password`,`serverdir`,`keyname`,`autorestart`,`description`,`resellerid`) VALUES (:active,:bit,:defaultdns,:publickey,:ssh2ip,AES_ENCRYPT(:ssh2port,:aeskey),AES_ENCRYPT(:ssh2user,:aeskey),AES_ENCRYPT(:ssh2password,:aeskey),:serverdir,:keyname,:autorestart,:description,:reseller_id)");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':active'=>$active,':bit'=>$bit,':defaultdns'=>$defaultdns,':publickey'=>$publickey,':ssh2ip'=>$ip,':ssh2port'=>$port,':ssh2user'=>$user,':ssh2password'=>$pass,':serverdir'=>$serverdir,':keyname'=>$keyname,':autorestart'=>$autorestart,':description'=>$description,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':active' => $active,':bit' => $bit,':defaultdns' => $defaultdns,':publickey' => $publickey,':ssh2ip' => $ip,':ssh2port' => $port,':ssh2user' => $user,':ssh2password' => $pass,':serverdir' => $serverdir,':keyname' => $keyname,':autorestart' => $autorestart,':description' => $description,':reseller_id' => $reseller_id));
|
||||
} else {
|
||||
$insterfail = true;
|
||||
}
|
||||
@ -149,7 +149,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$log='mod';
|
||||
$id=$ui->id('id',19,'get');
|
||||
$query = $sql->prepare("UPDATE `voice_tsdns` SET `active`=:active,`bitversion`=:bit,`defaultdns`=:defaultdns,`publickey`=:publickey,`ssh2ip`=:ssh2ip,`ssh2port`=AES_ENCRYPT(:ssh2port,:aeskey),`ssh2user`=AES_ENCRYPT(:ssh2user,:aeskey),`ssh2password`=AES_ENCRYPT(:ssh2password,:aeskey),`serverdir`=:serverdir,`keyname`=:keyname,`autorestart`=:autorestart,`description`=:description WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':active'=>$active,':bit'=>$bit,':defaultdns'=>$defaultdns,':publickey'=>$publickey,':ssh2ip'=>$ip,':ssh2port'=>$port,':ssh2user'=>$user,':ssh2password'=>$pass,':serverdir'=>$serverdir,':keyname'=>$keyname,':autorestart'=>$autorestart,':description'=>$description,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':active' => $active,':bit' => $bit,':defaultdns' => $defaultdns,':publickey' => $publickey,':ssh2ip' => $ip,':ssh2port' => $port,':ssh2user' => $user,':ssh2password' => $pass,':serverdir' => $serverdir,':keyname' => $keyname,':autorestart' => $autorestart,':description' => $description,':id' => $id,':reseller_id' => $reseller_id));
|
||||
}
|
||||
if (!isset($insterfail) and $query->rowCount()>0) {
|
||||
$loguseraction="%$log% %voserver% %tsdns% $ip";
|
||||
@ -200,7 +200,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2->execute(array($v,$reseller_id));
|
||||
$ex=explode(':',$k);
|
||||
if ($query->rowCount()==0 and $query2->rowCount()==0 and $i<=$max and isset($ex[1]) and port($ex[1])) {
|
||||
$newArray[$k]=$v;
|
||||
$newArray[$k] = $v;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$id=$ui->id('id',19,'get');
|
||||
if (!$ui->smallletters('action',2,'post')) {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$id,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $id,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$ssh2ip=$row['ssh2ip'];
|
||||
@ -268,7 +268,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query2->execute(array($v,$reseller_id));
|
||||
$ex=explode(':',$k);
|
||||
if ($query->rowCount()==0 and $query2->rowCount()==0 and $i<=$max and isset($ex[1]) and port($ex[1])) {
|
||||
$newArray[$k]=$v;
|
||||
$newArray[$k] = $v;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@ -313,7 +313,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$cldbid=rand(1,100).'.'.rand(1,100);
|
||||
$cldbid=rand(1,100) . '.' . rand(1,100);
|
||||
$cnamenew=$prefix.$cldbid;
|
||||
$query = $sql->prepare("INSERT INTO `userdata` (`cname`,`security`,`mail`,`accounttype`,`resellerid`) VALUES (?,?,?,'u',?)");
|
||||
$query->execute(array($cnamenew,passwordgenerate(10),'ts3@import.mail',$reseller_id));
|
||||
@ -428,8 +428,8 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
}
|
||||
$ds = array();
|
||||
$query2->execute(array($row['id'],$reseller_id));
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) $ds[]=array('id'=>$row2['dnsID'],'address'=>$row2['dns'],'status'=>($row2['active'] == 'N') ? 2 : 1);
|
||||
$table[]=array('id'=>$row['id'],'active'=>$row['active'],'img'=>$imgName,'alt'=>$imgAlt,'ip'=>$row['ssh2ip'],'defaultdns'=>$row['defaultdns'],'description'=>$row['description'],'server'=>$ds);
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row2) $ds[]=array('id' => $row2['dnsID'],'address' => $row2['dns'],'status'=>($row2['active'] == 'N') ? 2 : 1);
|
||||
$table[]=array('id' => $row['id'],'active' => $row['active'],'img' => $imgName,'alt' => $imgAlt,'ip' => $row['ssh2ip'],'defaultdns' => $row['defaultdns'],'description' => $row['description'],'server' => $ds);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
$vor=($colcount>$next) ? $start+$amount : $start;
|
||||
|
@ -103,7 +103,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$query->execute(array($tsdnsID,$reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$tsdns = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
$dns=strtolower(trim($lastID . '-' . $cname.'.'.$row['defaultdns']));
|
||||
$dns=strtolower(trim($lastID . '-' . $cname . '.' . $row['defaultdns']));
|
||||
}
|
||||
if (!isset($tsdns)) {
|
||||
$error[] = 'tsdnsID';
|
||||
@ -203,7 +203,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = 'Error: '.implode('<br />',$error);
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -300,7 +300,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$deleteDNS=$row['ip'] . ' ' . $row['port'] . ' ' . $row['dns'];
|
||||
}
|
||||
$query = $sql->prepare("SELECT *,AES_DECRYPT(`ssh2port`,:aeskey) AS `decryptedssh2port`,AES_DECRYPT(`ssh2user`,:aeskey) AS `decryptedssh2user`,AES_DECRYPT(`ssh2password`,:aeskey) AS `decryptedssh2password` FROM `voice_tsdns` WHERE `active`='Y' AND `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey,':id'=>$tsdnsID,':reseller_id'=>$reseller_id));
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsID,':reseller_id' => $reseller_id));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$publickey=$row['publickey'];
|
||||
$queryip=$row['ssh2ip'];
|
||||
@ -389,7 +389,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$imgName='16_bad';
|
||||
$imgAlt='inactive';
|
||||
}
|
||||
$table[]=array('id'=>$row['dnsID'],'active'=>$row['active'],'img'=>$imgName,'alt'=>$imgAlt,'dns'=>$row['dns'],'address'=>$row['ip'] . ':' . $row['port'],'masterip'=>trim($row['ssh2ip'] . ' ' . $row['description']),'cname'=>$row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'userid'=>$row['userID'],'jobPending'=>$jobPending);
|
||||
$table[]=array('id' => $row['dnsID'],'active' => $row['active'],'img' => $imgName,'alt' => $imgAlt,'dns' => $row['dns'],'address' => $row['ip'] . ':' . $row['port'],'masterip'=>trim($row['ssh2ip'] . ' ' . $row['description']),'cname' => $row['cname'],'names'=>trim($row['name'] . ' ' . $row['vname']),'userid' => $row['userID'],'jobPending' => $jobPending);
|
||||
}
|
||||
$next=$start+$amount;
|
||||
if ($colcount>$next) {
|
||||
@ -415,7 +415,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
} else {
|
||||
$link .='&p=0">1</a>';
|
||||
}
|
||||
$pages[]=$link;
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
|
@ -108,7 +108,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$pselect=$sql->prepare("SELECT u.`id`,u.`cname`,u.`vname`,u.`name` FROM `userdata` u INNER JOIN `voice_server` v ON u.`id`=v.`userid` AND v.`active`='Y' WHERE u.`resellerid`=? GROUP BY u.`id`");
|
||||
$pselect->execute(array($reseller_id));
|
||||
foreach ($pselect->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']).'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']).'</option>';
|
||||
@ -131,7 +131,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$pselect->execute(array($reseller_id));
|
||||
foreach ($pselect->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
$server=$row['ip'] . ':' . $row['port'];
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.$server.'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.$server.'</option>';
|
||||
@ -148,7 +148,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$pselect=$sql->prepare("SELECT `id`,`ssh2ip` FROM `voice_masterserver` WHERE `resellerid`=? ORDER BY `ssh2ip`");
|
||||
$pselect->execute(array($reseller_id));
|
||||
foreach ($pselect->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||
if ($ui->post['what']==$row['id']) {
|
||||
if ($ui->post['what'] == $row['id']) {
|
||||
$data[] = '<option value='.$row['id'].' selected="selected">'.$row['ssh2ip'].'</option>';
|
||||
} else {
|
||||
$data[] = '<option value='.$row['id'].'>'.$row['ssh2ip'].'</option>';
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<div class="span10">
|
||||
<dl class="dl-horizontal">
|
||||
<?php foreach($ips as $id=>$ip) { ?>
|
||||
<dt><?php echo $ip;?></dt>
|
||||
|
@ -56,7 +56,7 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
print "The time is now: ".ini_get('max_execution_time')."\r\n";
|
||||
print "The memory limit is now: ".ini_get('memory_limit')."\r\n";
|
||||
}
|
||||
if (!isset($remoteip) or $_SERVER['SERVER_ADDR']==$remoteip) {
|
||||
if (!isset($remoteip) or $_SERVER['SERVER_ADDR'] == $remoteip) {
|
||||
define('EASYWIDIR', dirname(__FILE__));
|
||||
include(EASYWIDIR . '/stuff/vorlage.php');
|
||||
include(EASYWIDIR . '/stuff/class_validator.php');
|
||||
@ -64,7 +64,7 @@ if (!isset($remoteip) or $_SERVER['SERVER_ADDR']==$remoteip) {
|
||||
include(EASYWIDIR . '/stuff/settings.php');
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
$query = $sql->prepare("SELECT `type`,`statip`,AES_DECRYPT(`dbname`,:aeskey) AS `decpteddbname`,AES_DECRYPT(`dbuser`,:aeskey) AS `decpteddbuser`,AES_DECRYPT(`dbpassword`,:aeskey) AS `decpteddbpassword`,`table_name`,`column_sourceip`,`column_destip`,`column_byte`,`column_date` FROM `traffic_settings` LIMIT 1");
|
||||
$query->execute(array(':aeskey'=>$aeskey));
|
||||
$query->execute(array(':aeskey' => $aeskey));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$stats_databanktype=$row['type'];
|
||||
$stats_host=$row['statip'];
|
||||
@ -104,19 +104,19 @@ if (!isset($remoteip) or $_SERVER['SERVER_ADDR']==$remoteip) {
|
||||
$query->execute();
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
unset($vserverip);
|
||||
$vserverip[]=$row['ip'];
|
||||
$vserverip[] = $row['ip'];
|
||||
$vserverid=$row['id'];
|
||||
foreach(ipstoarray($row['ips']) as $vip) {
|
||||
$vserverip[]=$vip;
|
||||
$vserverip[] = $vip;
|
||||
}
|
||||
$vserverips[$vserverid]=$vserverip;
|
||||
$vserverips[$vserverid] = $vserverip;
|
||||
}
|
||||
$query = $sql2->prepare("SHOW PROCESSLIST");
|
||||
$query->execute();
|
||||
print "Killing active locks and threads regarding database $stats_db\r\n";
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
list($host)=explode(':', $row['Host']);
|
||||
if ($host == 'localhost' and $row['db']==$stats_db) {
|
||||
if ($host == 'localhost' and $row['db'] == $stats_db) {
|
||||
$query2 = $sql2->prepare("KILL ?");
|
||||
$query2->execute(array($row['Id']));
|
||||
}
|
||||
@ -169,8 +169,8 @@ if (!isset($remoteip) or $_SERVER['SERVER_ADDR']==$remoteip) {
|
||||
foreach ($query2->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||
$userid=$row['userid'];
|
||||
$resellerid=$row['resellerid'];
|
||||
$serverIDs[$serverid]['userid']=$userid;
|
||||
$serverIDs[$serverid]['resellerid']=$resellerid;
|
||||
$serverIDs[$serverid]['userid'] = $userid;
|
||||
$serverIDs[$serverid]['resellerid'] = $resellerid;
|
||||
}
|
||||
}
|
||||
} else if (searchinnerarray($ip_src,$userips)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user