This commit is contained in:
Ulrich Block 2013-10-26 13:38:10 +02:00
parent d590a913fc
commit f2e0853adc
12 changed files with 2282 additions and 37 deletions

2245
server/control_new.sh Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,13 +50,13 @@ if (isset($admin_id)) {
$userpermissionquery = $sql->prepare("SELECT * FROM `userpermissions` WHERE `userid`=? LIMIT 1");
$userpermissionquery->execute(array($permissionid));
foreach ($userpermissionquery->fetchall() as $userpermissionrow) {
if ($userpermissionrow['root']=="Y") {
if ($userpermissionrow['root'] == 'Y') {
foreach ($userpermissionrow as $key => $value) {
$pa[$key] = true;
}
} else {
foreach ($userpermissionrow as $key => $value) {
if ($value=="Y") {
if ($value == 'Y') {
$pa[$key] = true;
} else {
$pa[$key] = false;
@ -69,7 +69,7 @@ if (isset($user_id)) {
$userpermissionquery = $sql->prepare("SELECT * FROM `userpermissions` WHERE `userid`=? LIMIT 1");
$userpermissionquery->execute(array($user_id));
foreach ($userpermissionquery->fetchall() as $userpermissionrow) {
if ($userpermissionrow['miniroot']=="Y") {
if ($userpermissionrow['miniroot'] == 'Y') {
foreach ($userpermissionrow as $key => $value) {
$pau[$key] = true;
}
@ -78,7 +78,7 @@ if (isset($user_id)) {
if (isset($admin_id)) {
$pau[$key] = true;
} else {
if ($value=="Y") {
if ($value == 'Y') {
$pau[$key] = true;
} else {
$pau[$key] = false;

View File

@ -146,10 +146,10 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$resellerid = $row2['resellerid'];
$autorestart = $row2['autorestart'];
if ($addedby == '2') {
if ($addedby == 2) {
$queryip = $row2['ssh2ip'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$query3 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query3->execute(array($row2['rootid'], $resellerid));
$queryip = $query3->fetchColumn();
@ -482,7 +482,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
} 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') {
} 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;
}

View File

@ -100,7 +100,7 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
$maxserver = $row['maxserver'];
$esxi = $row['esxi'];
$besthostcpu = $row['cpu'] . ' ' . $cores."x".$mhz." MHz";
if ($row['thin']=="Y") {
if ($row['thin'] == 'Y') {
$percent = $row['thinquota'];
} else {
$percent="100";
@ -123,7 +123,7 @@ if ($ui->smallletters('w',5, 'get') == 'check') {
$i++;
}
$i = 1;
if ($esxi=="Y") {
if ($esxi == 'Y') {
$maxcore="8";
} else {
$maxcore = $cores;

View File

@ -158,7 +158,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$rulebreak[] = $ssprache->nopassword;
if ($resellersettings[$resellerid]['nopassword'] == '1') {
if ($resellersettings[$resellerid]['nopassword'] == 1) {
$stopserver = true;
print "Will stop server $address because running without password. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $name).".\r\n";
@ -171,7 +171,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$rulebreak[] = $ssprache->tohighslots;
if ($resellersettings[$resellerid]['tohighslots'] == '1') {
if ($resellersettings[$resellerid]['tohighslots'] == 1) {
$stopserver = true;
print "Will stop server $address because running with to much slots. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $name).".\r\n";
} else {
@ -183,7 +183,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$rulebreak[] = $ssprache->noservertag;
if ($resellersettings[$resellerid]['noservertag'] == '1') {
if ($resellersettings[$resellerid]['noservertag'] == 1) {
$stopserver = true;
print "Will stop server $address because running without servertag. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $name).".\r\n";
} else {
@ -739,9 +739,9 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
$querypassword = $vrow['decryptedquerypassword'];
$resellerid = $vrow['resellerid'];
$autorestart = $vrow['autorestart'];
if ($addedby == '2') {
if ($addedby == 2) {
$queryip = $vrow['ssh2ip'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$vselect2 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$vselect2->execute(array($vrow['rootid'], $resellerid));
foreach ($vselect2->fetchall(PDO::FETCH_ASSOC) as $vrow2) $queryip = $vrow2['ip'];

View File

@ -140,12 +140,12 @@ if (!isset($success['false']) and array_value_exists('action','add',$data) and $
$query2->execute(array($tsdnsServerID,$resellerID));
$defaultdns = $query2->fetchColumn();
}
if ($row['addedby'] == '2') {
if ($row['addedby'] == 2) {
$ips[] = $row['ssh2ip'];
foreach (preg_split('/\r\n/', $row['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
$ips[] = $ip;
}
} else if ($row['addedby'] == '1') {
} 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) {

View File

@ -255,7 +255,7 @@ class rootServer {
foreach ($this->dhcpData as $k => $v) {
$i = 0;
unset($tempBad);
if ($v['publickey']=="Y") {
if ($v['publickey'] == 'Y') {
# https://github.com/easy-wi/developer/issues/70
$sshkey=removePub($v['keyname']);
@ -317,7 +317,7 @@ class rootServer {
}
public function PXEFiles() {
foreach($this->PXEData as $k => $v) {
if ($v['publickey']=="Y") {
if ($v['publickey'] == 'Y') {
# https://github.com/easy-wi/developer/issues/70
$sshkey=removePub($v['keyname']);

View File

@ -145,9 +145,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$querypassword = $row['decryptedquerypassword'];
$addedby = $row['addedby'];
$localserverid = $row['localserverid'];
if ($addedby == '2') {
if ($addedby == 2) {
$queryip = $row['ssh2ip'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$query = $sql->prepare("SELECT `ip`,`altips` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($row2['rootid'],$reseller_id));
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
@ -226,9 +226,9 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$querypassword = $row2['decryptedquerypassword'];
$addedby = $row2['addedby'];
$localserverid = $row2['localserverid'];
if ($addedby == '2') {
if ($addedby == 2) {
$queryip = $row2['ssh2ip'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$query4->execute(array($row2['rootid'],$reseller_id));
foreach ($query4->fetchall(PDO::FETCH_ASSOC) as $row3) {
$queryip = $row3['ip'];

View File

@ -142,7 +142,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$pselect = $sql->prepare("SELECT p.`id`,p.`released`,t.`title` FROM `page_pages` p LEFT JOIN `page_pages_text` t ON p.`id`=t.`pageid` AND t.`language`=? WHERE p.`id`=? AND p.`resellerid`=? LIMIT 1");
$pselect->execute(array($user_language,$id,$reseller_id));
foreach ($pselect->fetchAll(PDO::FETCH_ASSOC) as $row) {
if ($row['released'] == '1') {
if ($row['released'] == 1) {
$page_active = $gsprache->yes;
} else {
$page_active = $gsprache->no;
@ -429,7 +429,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
if (!isset($titleLanguages[$row['language']])) {
$titleLanguages[$row['language']] = array('page' => getlanguagefile('page', $row['language'],0),'general' => getlanguagefile('general', $row['language'],0));
}
if ($row['released'] == '1') {
if ($row['released'] == 1) {
$released = $gsprache->yes;
} else {
$released = $gsprache->no;

View File

@ -151,7 +151,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query->execute(array($user_language,$id,$reseller_id));
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
$page_title = $row['title'];
if ($row['released'] == '1') {
if ($row['released'] == 1) {
$page_active = $gsprache->yes;
} else {
$page_active = $gsprache->no;
@ -406,7 +406,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query->execute(array($user_language,$reseller_id));
$table = array();
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
if ($row['released'] == '1') {
if ($row['released'] == 1) {
$released = $gsprache->yes;
} else {
$released = $gsprache->no;

View File

@ -39,7 +39,7 @@
$sprache = getlanguagefile('voice',$user_language,$reseller_id);
$loguserid = $user_id;
$logusername = getusername($user_id);
$logusertype='user';
$logusertype = 'user';
$logreseller = 0;
if (isset($admin_id)) {
$logsubuser = $admin_id;

View File

@ -128,12 +128,12 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$hostbutton_gfx_url = $row2['defaulthostbutton_gfx_url'];
$defaultFlexSlotsFree = $row2['defaultFlexSlotsFree'];
$defaultFlexSlotsPercent = $row2['defaultFlexSlotsPercent'];
if ($addedby == '2') {
if ($addedby == 2) {
$ips[] = $row2['ssh2ip'];
foreach (preg_split('/\r\n/', $row2['ips'],-1,PREG_SPLIT_NO_EMPTY) as $ip) {
$ips[] = $ip;
}
} else if ($addedby == '1') {
} 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) {
@ -241,7 +241,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$maxslots = $row['maxslots'];
$serverdir = $row['serverdir'];
$mnotified = $row['notified'];
if ($addedby == '2') {
if ($addedby == 2) {
$publickey = $row['publickey'];
$queryip = $row['ssh2ip'];
$ssh2port = $row['decryptedssh2port'];
@ -249,7 +249,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$ssh2password = $row['decryptedssh2password'];
$keyname = $row['keyname'];
$bitversion = $row['bitversion'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$pselect2 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$pselect2->execute(array($row['rootid'],$reseller_id));
foreach ($pselect2->fetchAll(PDO::FETCH_ASSOC) as $row2) {
@ -360,7 +360,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$mnotified = $row['notified'];
$tsdnsServerID = $row['tsdnsServerID'];
$externalDefaultDNS = $row['externalDefaultDNS'];
if ($addedby == '2') {
if ($addedby == 2) {
$publickey = $row['publickey'];
$queryip = $row['ssh2ip'];
$ssh2port = $row['decryptedssh2port'];
@ -368,7 +368,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$ssh2password = $row['decryptedssh2password'];
$keyname = $row['keyname'];
$bitversion = $row['bitversion'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$query = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($row['rootid'],$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
@ -465,11 +465,11 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$maxserver = $row2['maxserver'];
$maxslots = $row2['maxslots'];
$addedby = $row2['addedby'];
if ($addedby == '2') {
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;
} else if ($addedby == '1') {
} 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) {
@ -557,7 +557,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$mnotified = $row['notified'];
$tsdnsServerID = $row['tsdnsServerID'];
$externalDefaultDNS = $row['externalDefaultDNS'];
if ($addedby == '2') {
if ($addedby == 2) {
$publickey = $row['publickey'];
$queryip = $row['ssh2ip'];
$ssh2port = $row['decryptedssh2port'];
@ -565,7 +565,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
$ssh2password = $row['decryptedssh2password'];
$keyname = $row['keyname'];
$bitversion = $row['bitversion'];
} else if ($addedby == '1') {
} else if ($addedby == 1) {
$query = $sql->prepare("SELECT `ip`,`bitversion` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($row['rootid'],$reseller_id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {