mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
#315 TS3 slots can be edited after reset
This commit is contained in:
parent
2d14bfe52b
commit
b37389b167
45
web/lend.php
45
web/lend.php
@ -1172,7 +1172,8 @@ if (!isset($template_file) and ((!isset($servertype) and isset($page_include) an
|
|||||||
$connecterror = $errorcode;
|
$connecterror = $errorcode;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$query2 = $sql->prepare("SELECT `ip`,`port`,`dns`,`max_download_total_bandwidth`,`max_upload_total_bandwidth`,`localserverid` FROM `voice_server` WHERE `lendserver`='Y' AND `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
|
||||||
|
$query2 = $sql->prepare("SELECT * FROM `voice_server` WHERE `lendserver`='Y' AND `active`='Y' AND `id`=? AND `resellerid`=? LIMIT 1");
|
||||||
$query2->execute(array($tousevoiceid, $reseller_id));
|
$query2->execute(array($tousevoiceid, $reseller_id));
|
||||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||||
$voip = $row2['ip'];
|
$voip = $row2['ip'];
|
||||||
@ -1181,12 +1182,54 @@ if (!isset($template_file) and ((!isset($servertype) and isset($page_include) an
|
|||||||
$max_download_total_bandwidth = $row2['max_download_total_bandwidth'];
|
$max_download_total_bandwidth = $row2['max_download_total_bandwidth'];
|
||||||
$max_upload_total_bandwidth = $row2['max_upload_total_bandwidth'];
|
$max_upload_total_bandwidth = $row2['max_upload_total_bandwidth'];
|
||||||
$volocalserverid = $row2['localserverid'];
|
$volocalserverid = $row2['localserverid'];
|
||||||
|
$forcebanner = $row2['forcebanner'];
|
||||||
|
$forcebutton = $row2['forcebutton'];
|
||||||
|
$forcewelcome = $row2['forcewelcome'];
|
||||||
$server = ($usedns == 'N' or $vodns == null or $vodns == '') ? $voip . ':' . $voport : $vodns;
|
$server = ($usedns == 'N' or $vodns == null or $vodns == '') ? $voip . ':' . $voport : $vodns;
|
||||||
}
|
}
|
||||||
|
|
||||||
$connection->StartServer($volocalserverid);
|
$connection->StartServer($volocalserverid);
|
||||||
$connection->ModServer($volocalserverid, $slots, $voip, $voport, $password, $name, $welcome, $max_download_total_bandwidth, $max_upload_total_bandwidth, $banner_url, $banner_gfx, $button_url, $button_gfx, $tooltip);
|
$connection->ModServer($volocalserverid, $slots, $voip, $voport, $password, $name, $welcome, $max_download_total_bandwidth, $max_upload_total_bandwidth, $banner_url, $banner_gfx, $button_url, $button_gfx, $tooltip);
|
||||||
$reply = $connection->PermReset($volocalserverid);
|
$reply = $connection->PermReset($volocalserverid);
|
||||||
|
|
||||||
|
if (isset($reply[0]['token'])) {
|
||||||
|
|
||||||
|
$template_file = $spracheResponse->ts_query_success . $reply[0]['token'];
|
||||||
|
|
||||||
|
if ($forcebanner == 'Y') {
|
||||||
|
$removelist[] = 'b_virtualserver_modify_hostbanner';
|
||||||
|
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
||||||
|
} else if ($forcebanner == 'N') {
|
||||||
|
$addlist[] = 'b_virtualserver_modify_hostbanner';
|
||||||
|
$addlist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($forcebutton == 'Y') {
|
||||||
|
$removelist[] = 'b_virtualserver_modify_hostbutton';
|
||||||
|
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbutton';
|
||||||
|
} else if ($forcebutton == 'N') {
|
||||||
|
$addlist[] = 'b_virtualserver_modify_hostbutton';
|
||||||
|
$addlist[] = 'i_needed_modify_power_virtualserver_modify_hostbutton';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($forcewelcome == 'Y') {
|
||||||
|
$removelist[] = 'b_virtualserver_modify_welcomemessage';
|
||||||
|
$removelist[] = 'i_needed_modify_power_virtualserver_modify_welcomemessage';
|
||||||
|
} else if ($forcewelcome == 'N') {
|
||||||
|
$addlist[] = 'b_virtualserver_modify_welcomemessage';
|
||||||
|
$addlist[] = 'i_needed_modify_power_virtualserver_modify_welcomemessage';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($addlist)) {
|
||||||
|
$connection->AdminPermissions ($volocalserverid, 'add', $addlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($removelist)) {
|
||||||
|
$connection->AdminPermissions ($volocalserverid, 'del', $removelist);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$connection->CloseConnection();
|
$connection->CloseConnection();
|
||||||
|
|
||||||
$rcon = $reply[0]['token'];
|
$rcon = $reply[0]['token'];
|
||||||
|
@ -104,8 +104,11 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$query2 = $sql->prepare("SELECT `shutdownempty`,`shutdownemptytime`,`lastcheck`,`oldcheck` FROM `lendsettings` WHERE `resellerid`=? LIMIT 1");
|
$query2 = $sql->prepare("SELECT `shutdownempty`,`shutdownemptytime`,`lastcheck`,`oldcheck` FROM `lendsettings` WHERE `resellerid`=? LIMIT 1");
|
||||||
$query->execute();
|
$query->execute();
|
||||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||||
|
|
||||||
unset($shutdownempty);
|
unset($shutdownempty);
|
||||||
|
|
||||||
$resellerid = $row['resellerid'];
|
$resellerid = $row['resellerid'];
|
||||||
|
|
||||||
$query2->execute(array($resellerid));
|
$query2->execute(array($resellerid));
|
||||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||||
$shutdownempty = $row2['shutdownempty'];
|
$shutdownempty = $row2['shutdownempty'];
|
||||||
@ -113,10 +116,12 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$firstcheck = '00-00-' . round(2 * (strtotime($row2['lastcheck']) - strtotime($row2['oldcheck'])) / 60);
|
$firstcheck = '00-00-' . round(2 * (strtotime($row2['lastcheck']) - strtotime($row2['oldcheck'])) / 60);
|
||||||
$firstchecktime = date('d-G-i');
|
$firstchecktime = date('d-G-i');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($shutdownempty)) {
|
if (isset($shutdownempty)) {
|
||||||
$resellersettings[$resellerid] = array('shutdownempty' => $shutdownempty,'shutdownemptytime' => $shutdownemptytime,'firstchecktime' => $firstchecktime,'firstcheck' => $firstcheck,'brandname' => $row['brandname'], 'noservertag' => $row['noservertag'], 'nopassword' => $row['nopassword'], 'tohighslots' => $row['tohighslots'], 'down_checks' => $row['down_checks']);
|
$resellersettings[$resellerid] = array('shutdownempty' => $shutdownempty,'shutdownemptytime' => $shutdownemptytime,'firstchecktime' => $firstchecktime,'firstcheck' => $firstcheck,'brandname' => $row['brandname'], 'noservertag' => $row['noservertag'], 'nopassword' => $row['nopassword'], 'tohighslots' => $row['tohighslots'], 'down_checks' => $row['down_checks']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = $sql->prepare("UPDATE `lendsettings` SET `oldcheck`=`lastcheck`,`lastcheck`=NOW()");
|
$query = $sql->prepare("UPDATE `lendsettings` SET `oldcheck`=`lastcheck`,`lastcheck`=NOW()");
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
|
||||||
@ -211,6 +216,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
print "Checking $totalCount server(s) with GameQ query\r\n";
|
print "Checking $totalCount server(s) with GameQ query\r\n";
|
||||||
|
|
||||||
foreach ($allServersArray as $servers) {
|
foreach ($allServersArray as $servers) {
|
||||||
|
|
||||||
$gq = new GameQ();
|
$gq = new GameQ();
|
||||||
$gq->setOption('timeout', 3);
|
$gq->setOption('timeout', 3);
|
||||||
|
|
||||||
@ -224,6 +230,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
foreach($gq->requestData() as $switchID => $v) {
|
foreach($gq->requestData() as $switchID => $v) {
|
||||||
|
|
||||||
unset($userid, $stopserver, $doNotRestart);
|
unset($userid, $stopserver, $doNotRestart);
|
||||||
|
|
||||||
$lid = 0;
|
$lid = 0;
|
||||||
$elapsed = 0;
|
$elapsed = 0;
|
||||||
$shutdownemptytime = 0;
|
$shutdownemptytime = 0;
|
||||||
@ -233,6 +240,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$query2 = $sql->prepare("SELECT `id`,`started` FROM `lendedserver` WHERE `serverid`=? LIMIT 1");
|
$query2 = $sql->prepare("SELECT `id`,`started` FROM `lendedserver` WHERE `serverid`=? LIMIT 1");
|
||||||
$query->execute(array($switchID));
|
$query->execute(array($switchID));
|
||||||
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
foreach ($query->fetchall(PDO::FETCH_ASSOC) as $row) {
|
||||||
|
|
||||||
$serverip = $row['serverip'];
|
$serverip = $row['serverip'];
|
||||||
$autoRestart = $row['autoRestart'];
|
$autoRestart = $row['autoRestart'];
|
||||||
$port = $row['port'];
|
$port = $row['port'];
|
||||||
@ -253,7 +261,9 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($lendserver == 'Y' and $lendActive == 'Y' and $resellersettings[$resellerid]['shutdownempty'] == 'Y') {
|
if ($lendserver == 'Y' and $lendActive == 'Y' and $resellersettings[$resellerid]['shutdownempty'] == 'Y') {
|
||||||
|
|
||||||
$shutdownemptytime = $resellersettings[$resellerid]['shutdownemptytime'];
|
$shutdownemptytime = $resellersettings[$resellerid]['shutdownemptytime'];
|
||||||
|
|
||||||
$query2->execute(array($row['serverID']));
|
$query2->execute(array($row['serverID']));
|
||||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||||
$lid = $row2['id'];
|
$lid = $row2['id'];
|
||||||
@ -475,18 +485,27 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$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'");
|
$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'");
|
||||||
$query->execute(array(':aeskey' => $aeskey));
|
$query->execute(array(':aeskey' => $aeskey));
|
||||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
|
||||||
|
|
||||||
$resellerid = $row['resellerid'];
|
$resellerid = $row['resellerid'];
|
||||||
$tsdnscheck=@fsockopen ($row['ssh2ip'],41144, $errno, $errstr,5);
|
|
||||||
|
$tsdnscheck = @fsockopen ($row['ssh2ip'], 41144, $errno, $errstr,5);
|
||||||
|
|
||||||
if (!is_resource($tsdnscheck) and $row['autorestart'] == 'Y') {
|
if (!is_resource($tsdnscheck) and $row['autorestart'] == 'Y') {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$tsdnscheck=@fsockopen ($row['ssh2ip'],41144, $errno, $errstr,5);
|
$tsdnscheck = @fsockopen ($row['ssh2ip'], 41144, $errno, $errstr,5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_resource($tsdnscheck) and $row['autorestart'] == 'Y') {
|
if (!is_resource($tsdnscheck) and $row['autorestart'] == 'Y') {
|
||||||
|
|
||||||
print "TSDNS Error: ".$row['ssh2ip'] . ' ' . $errno.' ('.$errstr.")\r\n";
|
print "TSDNS Error: ".$row['ssh2ip'] . ' ' . $errno.' ('.$errstr.")\r\n";
|
||||||
|
|
||||||
$query3 = $sql->prepare("UPDATE `voice_tsdns` SET `notified`=`notified`+1 WHERE `id`=? LIMIT 1");
|
$query3 = $sql->prepare("UPDATE `voice_tsdns` SET `notified`=`notified`+1 WHERE `id`=? LIMIT 1");
|
||||||
$query3->execute(array($row['id']));
|
$query3->execute(array($row['id']));
|
||||||
|
|
||||||
$tsdnsDownCheck = $row['notified']+1;
|
$tsdnsDownCheck = $row['notified']+1;
|
||||||
|
|
||||||
if ($tsdnsDownCheck == $resellersettings[$resellerid]['down_checks']) {
|
if ($tsdnsDownCheck == $resellersettings[$resellerid]['down_checks']) {
|
||||||
|
|
||||||
if ($resellerid==0) {
|
if ($resellerid==0) {
|
||||||
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `accounttype`='a' AND `resellerid`=0");
|
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `accounttype`='a' AND `resellerid`=0");
|
||||||
$query3->execute();
|
$query3->execute();
|
||||||
@ -494,37 +513,39 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `id`=? LIMIT 1");
|
$query3 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||||
$query3->execute(array($resellerid));
|
$query3->execute(array($resellerid));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
foreach ($query3->fetchAll(PDO::FETCH_ASSOC) as $row3) {
|
||||||
if ($row3['mail_serverdown'] == 'Y') {
|
if ($row3['mail_serverdown'] == 'Y') {
|
||||||
sendmail('emaildownrestart', $row3['id'], $row['ssh2ip'].' (External TSDNS)','');
|
sendmail('emaildownrestart', $row3['id'], $row['ssh2ip'].' (External TSDNS)','');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($row['bitversion'] == '32') {
|
|
||||||
$tsdnsbin='tsdnsserver_linux_x86';
|
|
||||||
} else {
|
|
||||||
$tsdnsbin='tsdnsserver_linux_amd64';
|
|
||||||
}
|
|
||||||
|
|
||||||
$split_config=preg_split('/\//', $row['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
|
||||||
$folderfilecount=count($split_config)-1;
|
|
||||||
$i = 0;
|
|
||||||
unset($folders);
|
unset($folders);
|
||||||
$folders=(substr($row['serverdir'],0,1) == '/') ? 'cd /' : 'cd ';
|
|
||||||
|
$i = 0;
|
||||||
$lastFolder = '';
|
$lastFolder = '';
|
||||||
|
|
||||||
|
$tsdnsbin= ($row['bitversion'] == '32') ? 'tsdnsserver_linux_x86' : 'tsdnsserver_linux_amd64';
|
||||||
|
$split_config = preg_split('/\//', $row['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
$folderfilecount = count($split_config) - 1;
|
||||||
|
$folders = (substr($row['serverdir'], 0, 1) == '/') ? 'cd /' : 'cd ';
|
||||||
|
|
||||||
while ($i <= $folderfilecount) {
|
while ($i <= $folderfilecount) {
|
||||||
$folders = $folders.$split_config[$i] . '/';
|
$folders = $folders.$split_config[$i] . '/';
|
||||||
$lastFolder = $split_config[$i];
|
$lastFolder = $split_config[$i];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($folders == 'cd ') {
|
if ($folders == 'cd ') {
|
||||||
$folders = '';
|
$folders = '';
|
||||||
} else if ($lastFolder!='tsdns' or substr($row['serverdir'],0,1) != '/') {
|
} else if ($lastFolder != 'tsdns' or substr($row['serverdir'], 0, 1) != '/') {
|
||||||
$folders = $folders .'tsdns/ && ';
|
$folders = $folders . 'tsdns/ && ';
|
||||||
} else {
|
} else {
|
||||||
$folders = $folders . ' && ';
|
$folders = $folders . ' && ';
|
||||||
}
|
}
|
||||||
$ssh2cmd = $folders.'function r () { if [ "`ps fx | grep '.$tsdnsbin.' | grep -v grep`" == "" ]; then ./'.$tsdnsbin.' > /dev/null & else ./'.$tsdnsbin.' --update > /dev/null & fi }; r& ';
|
|
||||||
|
$ssh2cmd = $folders . 'function r () { if [ "`ps fx | grep ' . $tsdnsbin . ' | grep -v grep`" == "" ]; then ./' . $tsdnsbin . ' > /dev/null & else ./' . $tsdnsbin . ' --update > /dev/null & fi }; r& ';
|
||||||
|
|
||||||
if (ssh2_execute('vd', $row['id'], $ssh2cmd)) {
|
if (ssh2_execute('vd', $row['id'], $ssh2cmd)) {
|
||||||
print "Restarting TSDNS: {$row['ssh2ip']}\r\n";
|
print "Restarting TSDNS: {$row['ssh2ip']}\r\n";
|
||||||
@ -537,7 +558,9 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
print "TSDNS ${row['ssh2ip']} is up and running\r\n";
|
print "TSDNS ${row['ssh2ip']} is up and running\r\n";
|
||||||
|
|
||||||
$query3 = $sql->prepare("UPDATE `voice_tsdns` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
$query3 = $sql->prepare("UPDATE `voice_tsdns` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
||||||
$query3->execute(array($row['id']));
|
$query3->execute(array($row['id']));
|
||||||
}
|
}
|
||||||
@ -548,10 +571,12 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
print "Checking voice server with debug on\r\n";
|
print "Checking voice server with debug on\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$vselect = $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'");
|
$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 `active`='Y'");
|
||||||
$vselect->execute(array(':aeskey' => $aeskey));
|
$query->execute(array(':aeskey' => $aeskey));
|
||||||
foreach ($vselect->fetchall(PDO::FETCH_ASSOC) as $vrow) {
|
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $vrow) {
|
||||||
|
|
||||||
unset($connect_ssh2, $ssh2, $badLogin);
|
unset($connect_ssh2, $ssh2, $badLogin);
|
||||||
|
|
||||||
$ts3masterid = $vrow['id'];
|
$ts3masterid = $vrow['id'];
|
||||||
$ts3masternotified = $vrow['notified'];
|
$ts3masternotified = $vrow['notified'];
|
||||||
$addedby = $vrow['addedby'];
|
$addedby = $vrow['addedby'];
|
||||||
@ -560,58 +585,77 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$resellerid = $vrow['resellerid'];
|
$resellerid = $vrow['resellerid'];
|
||||||
$autorestart = $vrow['autorestart'];
|
$autorestart = $vrow['autorestart'];
|
||||||
|
|
||||||
if ($addedby == 2) {
|
if ($addedby == 1) {
|
||||||
$queryip = $vrow['ssh2ip'];
|
|
||||||
} else if ($addedby == 1) {
|
|
||||||
$vselect2 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
$vselect2 = $sql->prepare("SELECT `ip` FROM `rserverdata` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||||
$vselect2->execute(array($vrow['rootid'], $resellerid));
|
$vselect2->execute(array($vrow['rootid'], $resellerid));
|
||||||
$queryip = $vselect2->fetchColumn();
|
$queryip = $vselect2->fetchColumn();
|
||||||
|
} else {
|
||||||
|
$queryip = $vrow['ssh2ip'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vrow['type'] == 'ts3') {
|
if ($vrow['type'] == 'ts3') {
|
||||||
|
|
||||||
|
print "Connecting to TS3 server $queryip\r\n";
|
||||||
|
|
||||||
$tsdown = false;
|
$tsdown = false;
|
||||||
$tsdnsdown = false;
|
$tsdnsdown = false;
|
||||||
$defaultwelcome = $vrow['defaultwelcome'];
|
$defaultwelcome = $vrow['defaultwelcome'];
|
||||||
|
|
||||||
$default = array('virtualserver_hostbanner_url' => $vrow['defaulthostbanner_url'], 'virtualserver_hostbanner_gfx_url' => $vrow['defaulthostbanner_gfx_url'], 'virtualserver_hostbutton_tooltip' => $vrow['defaulthostbutton_tooltip'], 'virtualserver_hostbutton_url' => $vrow['defaulthostbutton_url'], 'virtualserver_hostbutton_gfx_url' => $vrow['defaulthostbutton_gfx_url'], 'defaultwelcome' => $vrow['defaultwelcome']);
|
$default = array('virtualserver_hostbanner_url' => $vrow['defaulthostbanner_url'], 'virtualserver_hostbanner_gfx_url' => $vrow['defaulthostbanner_gfx_url'], 'virtualserver_hostbutton_tooltip' => $vrow['defaulthostbutton_tooltip'], 'virtualserver_hostbutton_url' => $vrow['defaulthostbutton_url'], 'virtualserver_hostbutton_gfx_url' => $vrow['defaulthostbutton_gfx_url'], 'defaultwelcome' => $vrow['defaultwelcome']);
|
||||||
print "Connecting to TS3 server $queryip\r\n";
|
|
||||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword,(isset($args['tsDebug']) and $args['tsDebug'] == 1) ? true : false);
|
$connection = new TS3($queryip, $queryport,'serveradmin', $querypassword, (isset($args['tsDebug']) and $args['tsDebug'] == 1) ? true : false);
|
||||||
$errorcode = $connection->errorcode;
|
$errorcode = $connection->errorcode;
|
||||||
|
|
||||||
if (strpos($errorcode,'error id=0') === false) {
|
if (strpos($errorcode,'error id=0') === false) {
|
||||||
|
|
||||||
$connection->CloseConnection();
|
$connection->CloseConnection();
|
||||||
unset($connection);
|
unset($connection);
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$connection=new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
|
||||||
|
$connection = new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||||
$errorcode = $connection->errorcode;
|
$errorcode = $connection->errorcode;
|
||||||
}
|
}
|
||||||
if (strpos($errorcode,'error id=0') === false) {
|
|
||||||
|
if (strpos($errorcode, 'error id=0') === false) {
|
||||||
$connection->CloseConnection();
|
$connection->CloseConnection();
|
||||||
unset($connection);
|
unset($connection);
|
||||||
}
|
}
|
||||||
if (strpos($errorcode,'error id=0') === false) {
|
|
||||||
print "TS3 Query Error: ".$errorcode . "\r\n";
|
if (strpos($errorcode, 'error id=0') === false) {
|
||||||
|
print "TS3 Query Error: " . $errorcode . "\r\n";
|
||||||
$tsdown = true;
|
$tsdown = true;
|
||||||
$restartreturn="TS3";
|
$restartreturn = "TS3";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vrow['usedns'] == 'Y') {
|
if ($vrow['usedns'] == 'Y') {
|
||||||
$tsdnscheck=@fsockopen ($queryip,41144, $errno, $errstr,5);
|
|
||||||
|
$tsdnscheck = @fsockopen ($queryip,41144, $errno, $errstr,5);
|
||||||
|
|
||||||
if (!is_resource($tsdnscheck)) {
|
if (!is_resource($tsdnscheck)) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$tsdnscheck=@fsockopen ($queryip,41144, $errno, $errstr,5);
|
$tsdnscheck = @fsockopen ($queryip,41144, $errno, $errstr,5);
|
||||||
}
|
}
|
||||||
if (!is_resource($tsdnscheck)) {
|
if (!is_resource($tsdnscheck)) {
|
||||||
|
|
||||||
print "TSDNS Error: ".$errno.' ('.$errstr.")\r\n";
|
print "TSDNS Error: ".$errno.' ('.$errstr.")\r\n";
|
||||||
|
|
||||||
$tsdnsdown = true;
|
$tsdnsdown = true;
|
||||||
|
|
||||||
if (isset($restartreturn)) {
|
if (isset($restartreturn)) {
|
||||||
$restartreturn .=" and TSDNS";
|
$restartreturn .= " and TSDNS";
|
||||||
} else {
|
} else {
|
||||||
$restartreturn="TSDNS";
|
$restartreturn = "TSDNS";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tsdown == true or $tsdnsdown == true) {
|
if ($tsdown == true or $tsdnsdown == true) {
|
||||||
|
|
||||||
$ts3masternotified++;
|
$ts3masternotified++;
|
||||||
|
|
||||||
if ($ts3masternotified == $resellersettings[$resellerid]['down_checks']) {
|
if ($ts3masternotified == $resellersettings[$resellerid]['down_checks']) {
|
||||||
|
|
||||||
if ($resellerid == 0) {
|
if ($resellerid == 0) {
|
||||||
$query2 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `accounttype`='a' AND `resellerid`=0");
|
$query2 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `accounttype`='a' AND `resellerid`=0");
|
||||||
$query2->execute();
|
$query2->execute();
|
||||||
@ -619,12 +663,14 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$query2 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `id`=? LIMIT 1");
|
$query2 = $sql->prepare("SELECT `id`,`mail_serverdown` FROM `userdata` WHERE `id`=? LIMIT 1");
|
||||||
$query2->execute(array($resellerid));
|
$query2->execute(array($resellerid));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||||
if ($row2['mail_serverdown'] == 'Y') {
|
if ($row2['mail_serverdown'] == 'Y') {
|
||||||
sendmail('emaildownrestart', $row2['id'], $queryip.' ('.$restartreturn.')','');
|
sendmail('emaildownrestart', $row2['id'], $queryip . ' (' . $restartreturn . ')', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$query2 = $sql->prepare("UPDATE `voice_server` SET `uptime`=0 WHERE `masterserver`=?");
|
$query2 = $sql->prepare("UPDATE `voice_server` SET `uptime`=0 WHERE `masterserver`=?");
|
||||||
$query2->execute(array($ts3masterid));
|
$query2->execute(array($ts3masterid));
|
||||||
$query2 = $sql->prepare("UPDATE `voice_masterserver` SET `notified`=? WHERE `id`=? LIMIT 1");
|
$query2 = $sql->prepare("UPDATE `voice_masterserver` SET `notified`=? WHERE `id`=? LIMIT 1");
|
||||||
@ -634,37 +680,38 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
|
|
||||||
$cmds = array();
|
$cmds = array();
|
||||||
|
|
||||||
$split_config=preg_split('/\//', $vrow['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
|
||||||
$folderfilecount=count($split_config)-1;
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$split_config = preg_split('/\//', $vrow['serverdir'], -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
$folderfilecount = count($split_config) - 1;
|
||||||
$folders = (substr($vrow['serverdir'], 0, 1) == '/') ? 'cd /' : 'cd ';
|
$folders = (substr($vrow['serverdir'], 0, 1) == '/') ? 'cd /' : 'cd ';
|
||||||
|
|
||||||
while ($i <= $folderfilecount) {
|
while ($i <= $folderfilecount) {
|
||||||
$folders = $folders.$split_config[$i] . '/';
|
$folders = $folders . $split_config[$i] . '/';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($folders == 'cd ') {
|
if ($folders == 'cd ') {
|
||||||
$folders = '';
|
$folders = '';
|
||||||
$tsdnsFolders='cd tsdns && ';
|
$tsdnsFolders = 'cd tsdns && ';
|
||||||
} else {
|
} else {
|
||||||
$tsdnsFolders = $folders.'tsdns && ';
|
$tsdnsFolders = $folders.'tsdns && ';
|
||||||
$folders = $folders . ' && ';
|
$folders = $folders . ' && ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vrow['bitversion'] == '32') {
|
if ($vrow['bitversion'] == '32') {
|
||||||
$tsbin='ts3server_linux_x86';
|
$tsbin = 'ts3server_linux_x86';
|
||||||
$tsdnsbin='tsdnsserver_linux_x86';
|
$tsdnsbin = 'tsdnsserver_linux_x86';
|
||||||
} else {
|
} else {
|
||||||
$tsbin='ts3server_linux_amd64';
|
$tsbin = 'ts3server_linux_amd64';
|
||||||
$tsdnsbin='tsdnsserver_linux_amd64';
|
$tsdnsbin = 'tsdnsserver_linux_amd64';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tsdown == true) {
|
if ($tsdown == true) {
|
||||||
$cmds[] = $folders.'function r () { if [ "`ps fx | grep '.$tsbin.' | grep -v grep`" == "" ]; then ./ts3server_startscript.sh start > /dev/null & else ./ts3server_startscript.sh restart > /dev/null & fi }; r& ';
|
$cmds[] = $folders . 'function r () { if [ "`ps fx | grep ' . $tsbin . ' | grep -v grep`" == "" ]; then ./ts3server_startscript.sh start > /dev/null & else ./ts3server_startscript.sh restart > /dev/null & fi }; r& ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vrow['usedns'] == 'Y' and $tsdnsdown == true) {
|
if ($vrow['usedns'] == 'Y' and $tsdnsdown == true) {
|
||||||
$cmds[] = $tsdnsFolders.'function r () { if [ "`ps fx | grep '.$tsdnsbin.' | grep -v grep`" == "" ]; then ./'.$tsdnsbin.' > /dev/null & else ./'.$tsdnsbin.' --update > /dev/null & fi }; r& ';
|
$cmds[] = $tsdnsFolders . 'function r () { if [ "`ps fx | grep ' . $tsdnsbin . ' | grep -v grep`" == "" ]; then ./' . $tsdnsbin . ' > /dev/null & else ./' . $tsdnsbin . ' --update > /dev/null & fi }; r& ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($cmds) > 0) {
|
if (count($cmds) > 0) {
|
||||||
@ -685,7 +732,8 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($tsdown != true) {
|
if ($tsdown != true) {
|
||||||
if ($ts3masternotified>0) {
|
|
||||||
|
if ($ts3masternotified > 0) {
|
||||||
$pupdate = $sql->prepare("UPDATE `voice_masterserver` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
$pupdate = $sql->prepare("UPDATE `voice_masterserver` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
||||||
$pupdate->execute(array($ts3masterid));
|
$pupdate->execute(array($ts3masterid));
|
||||||
}
|
}
|
||||||
@ -695,13 +743,16 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
if (!isset($serverlist[0]['id']) or $serverlist[0]['id'] == 0) {
|
if (!isset($serverlist[0]['id']) or $serverlist[0]['id'] == 0) {
|
||||||
|
|
||||||
foreach ($serverlist as $server) {
|
foreach ($serverlist as $server) {
|
||||||
unset($modbadserver);
|
|
||||||
|
unset($newtrafficdata, $newtraffic, $ts3id);
|
||||||
|
|
||||||
$modbadserver = array();
|
$modbadserver = array();
|
||||||
|
$newnotified = 'N';
|
||||||
|
|
||||||
$virtualserver_id = $server['virtualserver_id'];
|
$virtualserver_id = $server['virtualserver_id'];
|
||||||
$vs = $server['virtualserver_status'];
|
$vs = $server['virtualserver_status'];
|
||||||
$uptime=(isset($server['virtualserver_uptime'])) ? $server['virtualserver_uptime'] : 0;
|
$uptime = (isset($server['virtualserver_uptime'])) ? $server['virtualserver_uptime'] : 0;
|
||||||
$newnotified = 'N';
|
|
||||||
unset($newtrafficdata, $newtraffic, $ts3id);
|
|
||||||
$vselect2 = $sql->prepare("SELECT * FROM `voice_server` WHERE `localserverid`=? AND `masterserver`=? AND `resellerid`=? AND `autoRestart`='Y' LIMIT 1");
|
$vselect2 = $sql->prepare("SELECT * FROM `voice_server` WHERE `localserverid`=? AND `masterserver`=? AND `resellerid`=? AND `autoRestart`='Y' LIMIT 1");
|
||||||
$vselect2->execute(array($virtualserver_id, $vrow['id'], $resellerid));
|
$vselect2->execute(array($virtualserver_id, $vrow['id'], $resellerid));
|
||||||
foreach ($vselect2->fetchall(PDO::FETCH_ASSOC) as $vrow2) {
|
foreach ($vselect2->fetchall(PDO::FETCH_ASSOC) as $vrow2) {
|
||||||
@ -727,23 +778,36 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$olduptime = $vrow2['uptime'];
|
$olduptime = $vrow2['uptime'];
|
||||||
$initialpassword = $vrow2['initialpassword'];
|
$initialpassword = $vrow2['initialpassword'];
|
||||||
$maxtrafficmb = $vrow2['maxtraffic'];
|
$maxtrafficmb = $vrow2['maxtraffic'];
|
||||||
$maxtraffic = $maxtrafficmb*1024;
|
$maxtraffic = $maxtrafficmb * 1024;
|
||||||
$filetraffic=($vrow2['filetraffic'] == null) ? 0 : $vrow2['filetraffic'];
|
$filetraffic = ($vrow2['filetraffic'] == null) ? 0 : $vrow2['filetraffic'];
|
||||||
$lastfiletraffic=($vrow2['lastfiletraffic'] == null) ? 0 : $vrow2['lastfiletraffic'];
|
$lastfiletraffic = ($vrow2['lastfiletraffic'] == null) ? 0 : $vrow2['lastfiletraffic'];
|
||||||
$newtrafficdata = $lastfiletraffic;
|
$newtrafficdata = $lastfiletraffic;
|
||||||
$newtraffic = $filetraffic;
|
$newtraffic = $filetraffic;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $vs == 'online' and $active == 'N') {
|
if (isset($ts3id) and $vs == 'online' and $active == 'N') {
|
||||||
|
|
||||||
print "Inactive TS3 server $address running. Stopping it.\r\n";
|
print "Inactive TS3 server $address running. Stopping it.\r\n";
|
||||||
$connection->StopServer($virtualserver_id);
|
$connection->StopServer($virtualserver_id);
|
||||||
|
|
||||||
} else if (isset($ts3id) and $vs == 'online' and $active == 'Y') {
|
} else if (isset($ts3id) and $vs == 'online' and $active == 'Y') {
|
||||||
|
|
||||||
unset($rulebreak, $changeSlots);
|
unset($rulebreak, $changeSlots);
|
||||||
|
|
||||||
$queryName = $server['virtualserver_name'];
|
$queryName = $server['virtualserver_name'];
|
||||||
$usedslots = (isset($server['virtualserver_clientsonline'])) ? $server['virtualserver_clientsonline'] : 0;
|
$usedslots = (isset($server['virtualserver_clientsonline'])) ? $server['virtualserver_clientsonline'] : 0;
|
||||||
|
|
||||||
|
if ($lendserver == 'Y') {
|
||||||
|
|
||||||
|
$vselect2 = $sql->prepare("SELECT `slots` FROM `lendedserver` WHERE `servertype`='v' AND `serverid`=? AND `resellerid`=? LIMIT 1");
|
||||||
|
$vselect2->execute(array($ts3id, $resellerid));
|
||||||
|
$lendslots = $vselect2->fetchColumn();
|
||||||
|
} else {
|
||||||
|
$lendslots = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$sd = $connection->ServerDetails($virtualserver_id);
|
$sd = $connection->ServerDetails($virtualserver_id);
|
||||||
$newtrafficdata=round(($sd['connection_filetransfer_bytes_sent_total']+$sd['connection_filetransfer_bytes_received_total']) / 1024);
|
$newtrafficdata = round(($sd['connection_filetransfer_bytes_sent_total'] + $sd['connection_filetransfer_bytes_received_total']) / 1024);
|
||||||
|
|
||||||
if (isset($resellersettings[$resellerid]['firstchecktime']) and isset($resellersettings[$resellerid]['firstcheck']) and $resellersettings[$resellerid]['firstchecktime'] < $resellersettings[$resellerid]['firstcheck']) {
|
if (isset($resellersettings[$resellerid]['firstchecktime']) and isset($resellersettings[$resellerid]['firstcheck']) and $resellersettings[$resellerid]['firstchecktime'] < $resellersettings[$resellerid]['firstcheck']) {
|
||||||
$filetraffic = 0;
|
$filetraffic = 0;
|
||||||
@ -781,101 +845,134 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($maxtraffic > 0 and $newtraffic > $maxtraffic and $sd['virtualserver_max_download_total_bandwidth'] > 1 and $sd['virtualserver_max_upload_total_bandwidth'] > 1) {
|
if ($maxtraffic > 0 and $newtraffic > $maxtraffic and $sd['virtualserver_max_download_total_bandwidth'] > 1 and $sd['virtualserver_max_upload_total_bandwidth'] > 1) {
|
||||||
|
|
||||||
$virtualserver_max_download_total_bandwidth = 1;
|
$virtualserver_max_download_total_bandwidth = 1;
|
||||||
$virtualserver_max_upload_total_bandwidth = 1;
|
$virtualserver_max_upload_total_bandwidth = 1;
|
||||||
$traffictext="and has now reached the traffic limit ".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
|
||||||
|
$traffictext = 'and has now reached the traffic limit ' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
|
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />Traffic Limit".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
$rulebreak .= '<br />Traffic Limit' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
} else {
|
} else {
|
||||||
$rulebreak = "<br />Traffic Limit".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
$rulebreak = '<br />Traffic Limit' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
}
|
}
|
||||||
} else if ($maxtraffic>0 and $newtraffic>$maxtraffic and $sd['virtualserver_max_download_total_bandwidth']<2 and $sd['virtualserver_max_upload_total_bandwidth']<2) {
|
|
||||||
|
} else if ($maxtraffic > 0 and $newtraffic > $maxtraffic and $sd['virtualserver_max_download_total_bandwidth'] < 2 and $sd['virtualserver_max_upload_total_bandwidth'] < 2) {
|
||||||
|
|
||||||
$virtualserver_max_download_total_bandwidth = 1;
|
$virtualserver_max_download_total_bandwidth = 1;
|
||||||
$virtualserver_max_upload_total_bandwidth = 1;
|
$virtualserver_max_upload_total_bandwidth = 1;
|
||||||
$traffictext="and has still reached the traffic limit ".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
$traffictext = 'and has still reached the traffic limit ' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
} else if ($maxtraffic>0) {
|
|
||||||
$traffictext="and has not reached traffic limit ".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
} else if ($maxtraffic > 0) {
|
||||||
|
$traffictext = 'and has not reached traffic limit ' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
} else {
|
} else {
|
||||||
$traffictext="and has traffic limit ".$newtrafficmb. '/' . $maxtrafficmb." MB";
|
$traffictext = 'and has traffic limit ' . $newtrafficmb . '/' . $maxtrafficmb." MB";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sd['virtualserver_max_download_total_bandwidth'] != $virtualserver_max_download_total_bandwidth or $sd['virtualserver_max_upload_total_bandwidth'] != $virtualserver_max_download_total_bandwidth) {
|
if ($sd['virtualserver_max_download_total_bandwidth'] != $virtualserver_max_download_total_bandwidth or $sd['virtualserver_max_upload_total_bandwidth'] != $virtualserver_max_download_total_bandwidth) {
|
||||||
$modbadserver['virtualserver_max_download_total_bandwidth'] = $virtualserver_max_download_total_bandwidth;
|
$modbadserver['virtualserver_max_download_total_bandwidth'] = $virtualserver_max_download_total_bandwidth;
|
||||||
$modbadserver['virtualserver_max_upload_total_bandwidth'] = $virtualserver_max_download_total_bandwidth;
|
$modbadserver['virtualserver_max_upload_total_bandwidth'] = $virtualserver_max_download_total_bandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forceservertag == 'Y' and $resellersettings[$resellerid]['brandname'] != '' and strpos(strtolower($server['virtualserver_name']), strtolower($resellersettings[$resellerid]['brandname'])) === false) {
|
if ($forceservertag == 'Y' and $resellersettings[$resellerid]['brandname'] != '' and strpos(strtolower($server['virtualserver_name']), strtolower($resellersettings[$resellerid]['brandname'])) === false) {
|
||||||
print $vrow['type']." server $address illegal without servertag. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
|
||||||
|
print $vrow['type'] . ' server $address illegal without servertag. The name converted to ISO-8859-1 is ' . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />".$ssprache->noservertag;
|
$rulebreak .= '<br />' . $ssprache->noservertag;
|
||||||
} else {
|
} else {
|
||||||
$rulebreak = $ssprache->noservertag;
|
$rulebreak = $ssprache->noservertag;
|
||||||
}
|
}
|
||||||
|
|
||||||
$modbadserver['virtualserver_name'] = $server['virtualserver_name'] . ' ' . $resellersettings[$resellerid]['brandname'];
|
$modbadserver['virtualserver_name'] = $server['virtualserver_name'] . ' ' . $resellersettings[$resellerid]['brandname'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $forcebanner == 'Y') {
|
if (isset($ts3id) and $forcebanner == 'Y') {
|
||||||
foreach (array('virtualserver_hostbanner_url','virtualserver_hostbanner_gfx_url') as $param) {
|
foreach (array('virtualserver_hostbanner_url', 'virtualserver_hostbanner_gfx_url') as $param) {
|
||||||
if ($default[$param] != '' and $sd[$param] != $default[$param]) {
|
if ($default[$param] != '' and $sd[$param] != $default[$param]) {
|
||||||
|
|
||||||
$modbadserver[$param] = $default[$param];
|
$modbadserver[$param] = $default[$param];
|
||||||
|
|
||||||
print $vrow['type']." server $address $param != ".$default[$param].". The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
print $vrow['type']." server $address $param != ".$default[$param].". The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />".$param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
$rulebreak .= '<br />' . $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
||||||
} else {
|
} else {
|
||||||
$rulebreak = $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
$rulebreak = $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $forcebutton == 'Y') {
|
if (isset($ts3id) and $forcebutton == 'Y') {
|
||||||
foreach (array('virtualserver_hostbutton_tooltip','virtualserver_hostbutton_url','virtualserver_hostbutton_gfx_url') as $param) {
|
foreach (array('virtualserver_hostbutton_tooltip', 'virtualserver_hostbutton_url', 'virtualserver_hostbutton_gfx_url') as $param) {
|
||||||
if ($default[$param] != '' and $sd[$param] != $default[$param]) {
|
if ($default[$param] != '' and $sd[$param] != $default[$param]) {
|
||||||
$modbadserver[$param] = $default[$param];
|
$modbadserver[$param] = $default[$param];
|
||||||
print $vrow['type']." server $address $param != ".$default[$param].". The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
print $vrow['type'] . " server $address $param != " . $default[$param] . ". The name converted to ISO-8859-1 is " . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />".$param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
$rulebreak .='<br />' . $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
||||||
} else {
|
} else {
|
||||||
$rulebreak = $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
$rulebreak = $param . ' ' . $vosprache->isnot . ' ' . $default[$param];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $forcewelcome == 'Y' and $default['defaultwelcome'] != '' and $sd['virtualserver_welcomemessage'] != $default['defaultwelcome']) {
|
if (isset($ts3id) and $forcewelcome == 'Y' and $default['defaultwelcome'] != '' and $sd['virtualserver_welcomemessage'] != $default['defaultwelcome']) {
|
||||||
$modbadserver['virtualserver_welcomemessage'] = $default['defaultwelcome'];
|
$modbadserver['virtualserver_welcomemessage'] = $default['defaultwelcome'];
|
||||||
print $vrow['type']." server $address $param != ".$default['defaultwelcome'].". The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
print $vrow['type'] . " server $address $param != ".$default['defaultwelcome'] . '. The name converted to ISO-8859-1 is ' . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />virtualserver_welcomemessage ".$vosprache->isnot . ' ' . $default['defaultwelcome'];
|
$rulebreak .= '<br />virtualserver_welcomemessage ' . $vosprache->isnot . ' ' . $default['defaultwelcome'];
|
||||||
} else {
|
} else {
|
||||||
$rulebreak="virtualserver_welcomemessage ".$vosprache->isnot . ' ' . $default['defaultwelcome'];
|
$rulebreak = 'virtualserver_welcomemessage ' . $vosprache->isnot . ' ' . $default['defaultwelcome'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($ts3id, $lendserver) and $lendserver == 'N' and $slots<$server['virtualserver_maxclients']) {
|
|
||||||
print $vrow['type']." server $address virtualserver_maxclients ${sd['virtualserver_maxclients']}!= ".$slots.". The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
if (isset($ts3id, $lendserver) and (($lendserver == 'N' and $slots < $server['virtualserver_maxclients']) or ($lendserver == 'Y' and $lendslots < $server['virtualserver_maxclients']))) {
|
||||||
|
|
||||||
|
$showSlots = ($lendserver == 'Y') ? $lendslots : $slots;
|
||||||
|
print $vrow['type'] . " server $address virtualserver_maxclients ${sd['virtualserver_maxclients']}!= " . $showSlots . ". The name converted to ISO-8859-1 is " . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />virtualserver_maxclients ".$vosprache->isnot . ' ' . $slots;
|
$rulebreak .= '<br />virtualserver_maxclients ' . $vosprache->isnot . ' ' . $showSlots;
|
||||||
} else {
|
} else {
|
||||||
$rulebreak="virtualserver_maxclients ".$vosprache->isnot . ' ' . $slots;
|
$rulebreak = 'virtualserver_maxclients ' . $vosprache->isnot . ' ' . $showSlots;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $password == 'Y' and $sd['virtualserver_flag_password'] != '1') {
|
if (isset($ts3id) and $password == 'Y' and $sd['virtualserver_flag_password'] != '1') {
|
||||||
$modbadserver['virtualserver_password'] = $initialpassword;
|
$modbadserver['virtualserver_password'] = $initialpassword;
|
||||||
print $vrow['type']." server $address virtualserver_flag_password != 1. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
print $vrow['type'] . " server $address virtualserver_flag_password != 1. The name converted to ISO-8859-1 is " . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
if (isset($rulebreak)) {
|
if (isset($rulebreak)) {
|
||||||
$rulebreak .="<br />virtualserver_flag_password ".$vosprache->isnot." 1";
|
$rulebreak .="<br />virtualserver_flag_password ".$vosprache->isnot." 1";
|
||||||
} else {
|
} else {
|
||||||
$rulebreak="virtualserver_flag_password ".$vosprache->isnot." 1";
|
$rulebreak="virtualserver_flag_password ".$vosprache->isnot." 1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($ts3id) and $lendserver == 'N' and !isset($rulebreak)) {
|
if (isset($ts3id) and $lendserver == 'N' and !isset($rulebreak)) {
|
||||||
|
|
||||||
if (isset($changeSlots)) {
|
if (isset($changeSlots)) {
|
||||||
print $vrow['type']." server $address Changing Flex Slots to ${changeSlots}. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
|
||||||
|
print $vrow['type'] . " server $address Changing Flex Slots to ${changeSlots}. The name converted to ISO-8859-1 is " . iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
$connection->ImportModServer($virtualserver_id, $changeSlots, $vrow2['ip'], $vrow2['port'], array());
|
$connection->ImportModServer($virtualserver_id, $changeSlots, $vrow2['ip'], $vrow2['port'], array());
|
||||||
|
|
||||||
$pupdate2 = $sql->prepare("UPDATE `voice_server` SET `notified`=0,`flexSlotsCurrent`=? WHERE `id`=? LIMIT 1");
|
$pupdate2 = $sql->prepare("UPDATE `voice_server` SET `notified`=0,`flexSlotsCurrent`=? WHERE `id`=? LIMIT 1");
|
||||||
$pupdate2->execute(array($changeSlots, $ts3id));
|
$pupdate2->execute(array($changeSlots, $ts3id));
|
||||||
} else if ($notified>0) {
|
|
||||||
|
} else if ($notified > 0) {
|
||||||
$pupdate2 = $sql->prepare("UPDATE `voice_server` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
$pupdate2 = $sql->prepare("UPDATE `voice_server` SET `notified`=0 WHERE `id`=? LIMIT 1");
|
||||||
$pupdate2->execute(array($ts3id));
|
$pupdate2->execute(array($ts3id));
|
||||||
}
|
}
|
||||||
|
|
||||||
print $vrow['type']." server $address is running $traffictext. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
print $vrow['type']." server $address is running $traffictext. The name converted to ISO-8859-1 is ".iconv('UTF-8','ISO-8859-1//TRANSLIT', $server['virtualserver_name']) . "\r\n";
|
||||||
|
|
||||||
} else if (isset($ts3id) and $notified == 0 and isset($rulebreak)) {
|
} else if (isset($ts3id) and $notified == 0 and isset($rulebreak)) {
|
||||||
$connection->ImportModServer($virtualserver_id, $slots, $vrow2['ip'], $vrow2['port'], $modbadserver);
|
|
||||||
|
$connection->ImportModServer($virtualserver_id,($lendserver == 'Y') ? $lendslots : $slots, $vrow2['ip'], $vrow2['port'], $modbadserver);
|
||||||
|
|
||||||
if ($resellerid==0) {
|
if ($resellerid==0) {
|
||||||
$query2 = $sql->prepare("SELECT `id`,`mail_securitybreach` FROM `userdata` WHERE `id`=? OR (`resellerid`=0 AND `accounttype`='a')");
|
$query2 = $sql->prepare("SELECT `id`,`mail_securitybreach` FROM `userdata` WHERE `id`=? OR (`resellerid`=0 AND `accounttype`='a')");
|
||||||
$query2->execute(array($userid));
|
$query2->execute(array($userid));
|
||||||
@ -883,6 +980,7 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
|
|||||||
$query2 = $sql->prepare("SELECT `id`,`mail_securitybreach` FROM `userdata` WHERE `id`=? OR (`id`=? AND `accounttype`='r')");
|
$query2 = $sql->prepare("SELECT `id`,`mail_securitybreach` FROM `userdata` WHERE `id`=? OR (`id`=? AND `accounttype`='r')");
|
||||||
$query2->execute(array($userid, $resellerid));
|
$query2->execute(array($userid, $resellerid));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
foreach ($query2->fetchall(PDO::FETCH_ASSOC) as $row2) {
|
||||||
if ($row2['mail_securitybreach'] == 'Y' or $row2['id'] == $userid) {
|
if ($row2['mail_securitybreach'] == 'Y' or $row2['id'] == $userid) {
|
||||||
sendmail('emailsecuritybreach', $row2['id'], $address, $rulebreak);
|
sendmail('emailsecuritybreach', $row2['id'], $address, $rulebreak);
|
||||||
|
@ -238,8 +238,8 @@ class TS3 {
|
|||||||
$servergroups = $this->SendCommand('servergrouplist');
|
$servergroups = $this->SendCommand('servergrouplist');
|
||||||
|
|
||||||
foreach ($servergroups as $servegroup) {
|
foreach ($servergroups as $servegroup) {
|
||||||
if ($servegroup['type']==1) {
|
if ($servegroup['type'] == 1) {
|
||||||
$delcommand="servergroupdelperm sgid=".$servegroup['sgid']." permsid=".implode('|permsid=', $remove);
|
$delcommand = "servergroupdelperm sgid=" . $servegroup['sgid']." permsid=" . implode('|permsid=', $remove);
|
||||||
$this->SendCommand($delcommand);
|
$this->SendCommand($delcommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -424,17 +424,28 @@ class TS3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($what == 'del') {
|
||||||
|
$remove = array('b_virtualserver_start','i_needed_modify_power_virtualserver_start',
|
||||||
|
'b_virtualserver_stop','i_needed_modify_power_virtualserver_stop',
|
||||||
|
'b_virtualserver_modify_maxclients','i_needed_modify_power_virtualserver_modify_maxclients',
|
||||||
|
'b_virtualserver_modify_port','i_needed_modify_power_virtualserver_modify_port',
|
||||||
|
'b_virtualserver_modify_autostart','i_needed_modify_power_virtualserver_modify_autostart',
|
||||||
|
'b_virtualserver_modify_ft_settings','i_needed_modify_power_virtualserver_modify_ft_settings'
|
||||||
|
);
|
||||||
|
$permlist = array_merge($permlist, $remove);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($admingroupid) and is_array($admingroupid)) {
|
if (isset($admingroupid) and is_array($admingroupid)) {
|
||||||
foreach ($admingroupid as $id) {
|
foreach ($admingroupid as $id) {
|
||||||
if ($what == 'add') {
|
if ($what == 'add') {
|
||||||
|
|
||||||
$command = 'servergroupaddperm sgid=' . $id . ' permsid='.implode(' permvalue=1 permnegated=0 permskip=0|permsid=', $permlist) . ' permvalue=1 permnegated=0 permskip=0';
|
$command = 'servergroupaddperm sgid=' . $id . ' permsid=' . implode(' permvalue=1 permnegated=0 permskip=0|permsid=', $permlist) . ' permvalue=1 permnegated=0 permskip=0';
|
||||||
|
|
||||||
$this->SendCommand($command);
|
$this->SendCommand($command);
|
||||||
|
|
||||||
} else if ($what == 'del') {
|
} else if ($what == 'del') {
|
||||||
|
|
||||||
$command = 'servergroupdelperm sgid=' . $id . ' permsid='.implode('|permsid=', $permlist);
|
$command = 'servergroupdelperm sgid=' . $id . ' permsid=' . implode('|permsid=', $permlist);
|
||||||
|
|
||||||
$this->SendCommand($command);
|
$this->SendCommand($command);
|
||||||
}
|
}
|
||||||
@ -444,13 +455,13 @@ class TS3 {
|
|||||||
|
|
||||||
if ($what == 'add') {
|
if ($what == 'add') {
|
||||||
|
|
||||||
$command='servergroupaddperm sgid=' . $admingroupid . ' permsid='.implode(' permvalue=1 permnegated=0 permskip=0|permsid=', $permlist) . ' permvalue=1 permnegated=0 permskip=0';
|
$command = 'servergroupaddperm sgid=' . $admingroupid . ' permsid=' . implode(' permvalue=1 permnegated=0 permskip=0|permsid=', $permlist) . ' permvalue=1 permnegated=0 permskip=0';
|
||||||
|
|
||||||
$this->SendCommand($command);
|
$this->SendCommand($command);
|
||||||
|
|
||||||
} else if ($what == 'del') {
|
} else if ($what == 'del') {
|
||||||
|
|
||||||
$command='servergroupdelperm sgid=' . $admingroupid . ' permsid='.implode('|permsid=', $permlist);
|
$command = 'servergroupdelperm sgid=' . $admingroupid . ' permsid=' . implode('|permsid=', $permlist);
|
||||||
|
|
||||||
$this->SendCommand($command);
|
$this->SendCommand($command);
|
||||||
|
|
||||||
|
@ -387,6 +387,7 @@ if ($ui->st('d', 'get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($queryip, $queryport, $querypassword)) {
|
if (isset($queryip, $queryport, $querypassword)) {
|
||||||
|
|
||||||
$connection = new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
$connection = new TS3($queryip, $queryport,'serveradmin', $querypassword);
|
||||||
$errorcode = $connection->errorcode;
|
$errorcode = $connection->errorcode;
|
||||||
|
|
||||||
@ -405,7 +406,7 @@ if ($ui->st('d', 'get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSI
|
|||||||
|
|
||||||
$template_file = $spracheResponse->ts_query_success . $reply[0]['token'];
|
$template_file = $spracheResponse->ts_query_success . $reply[0]['token'];
|
||||||
|
|
||||||
if ($forcebanner== 'Y') {
|
if ($forcebanner == 'Y') {
|
||||||
$removelist[] = 'b_virtualserver_modify_hostbanner';
|
$removelist[] = 'b_virtualserver_modify_hostbanner';
|
||||||
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
$removelist[] = 'i_needed_modify_power_virtualserver_modify_hostbanner';
|
||||||
} else if ($forcebanner== 'N') {
|
} else if ($forcebanner== 'N') {
|
||||||
@ -430,11 +431,11 @@ if ($ui->st('d', 'get') == 'bu' and $ui->id('id', 10, 'get') and (!isset($_SESSI
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($addlist)) {
|
if (isset($addlist)) {
|
||||||
$connection->AdminPermissions ($volocalserverid,'add', $addlist);
|
$connection->AdminPermissions ($volocalserverid, 'add', $addlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($removelist)) {
|
if (isset($removelist)) {
|
||||||
$connection->AdminPermissions ($volocalserverid,'del', $removelist);
|
$connection->AdminPermissions ($volocalserverid, 'del', $removelist);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user