if ($ui->st('d', 'get') == 'dl' and $id) { $query = $sql->prepare("SELECT `dns`,`ip`,`port`,`tsdnsID` FROM `voice_dns` WHERE `dnsID`=? AND `resellerID`=? LIMIT 1"); $query->execute(array($id, $resellerLockupID)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $ip = $row['ip']; $port = $row['port']; $dns = $row['dns']; $tsdnsRootID = $row['tsdnsID']; $deleteDNS = $row['ip'] . ' ' . $row['port'] . ' ' . $row['dns']; } $serverFound = $query->rowCount(); if ($ui->st('action', 'post') == 'dl' and count($errors) == 0 and $serverFound > 0) { $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' => $tsdnsRootID, ':reseller_id' => $resellerLockupID)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $dnsReturn = tsdns('dl', $row['ssh2ip'], $row['decryptedssh2port'], $row['decryptedssh2user'], $row['publickey'], $row['keyname'], $row['decryptedssh2password'], 0, $row['serverdir'], $row['bitversion'], array($ip), array($port), array($dns), $resellerLockupID); } $query = $sql->prepare("DELETE FROM `voice_dns` WHERE `dnsID`=? AND `resellerid`=? LIMIT 1"); $query->execute(array($id, $resellerLockupID)); if ($query->rowCount() > 0) { $loguseraction = '%del% %tsdns% %dns% ' . $deleteDNS; $insertlog->execute(); $template_file = $spracheResponse->table_del; } else { $template_file = $spracheResponse->error_table; } } // Nothing submitted yet or csfr error, display the delete form if (!$ui->st('action', 'post') or count($errors) != 0) { // Check if we could find an entry and if not display 404 page $template_file = $serverFound > 0 ? 'admin_voice_dns_dl.tpl' : 'admin_404.tpl';
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)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $publickey = $row['publickey']; $queryip = $row['ssh2ip']; $ssh2port = $row['decryptedssh2port']; $ssh2user = $row['decryptedssh2user']; $ssh2password = $row['decryptedssh2password']; $serverdir = $row['serverdir']; $keyname = $row['keyname']; $bit = $row['bitversion']; $bitversion = $row['bitversion']; } } $return = tsdns('md', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip, $oldip), array($port, $oldport), array($dns, $olddns), $reseller_id); $template_file = $return == 'ok' ? $spracheResponse->ts_query_success . $return : $spracheResponse->error_ts_query . $return; } else { if ($usedns == 'Y' and $dns != $olddns and $dns != '' and $dnsCheck === false) { $errors[] = $sprache->dnsError; } } } if (count($errors) == 0) { $initialpassword = $ui->password('initialpassword', 50, 'post'); $name = $ui->post['name']; $connection = new TS3($queryip, $queryport, 'serveradmin', $querypassword); $errorcode = $connection->errorcode; if (strpos($errorcode, 'error id=0') === false) { $template_file = $spracheResponse->error_ts_query_connect . $errorcode; } else {
$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($localserverid, 'add', $addlist); } if (isset($removelist)) { $connection->AdminPermissions($localserverid, 'del', $removelist); } if ($usedns == 'Y') { $template_file = tsdns('md', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip, $oldip), array($port, $oldport), array($dns, $olddns), $row2['resellerID']); } if ($row3['active'] == 'N' or $extraData->newActive == 'N') { $connection->StopServer($localserverid); } $query3 = $sql->prepare("UPDATE `jobs` SET `status`='3' WHERE `jobID`=? AND `type`='vo' LIMIT 1"); $query3->execute(array($row2['jobID'])); $query3 = $sql->prepare("UPDATE `voice_server` SET `jobPending`='N' WHERE `id`=? LIMIT 1"); $query3->execute(array($row2['affectedID'])); } } else { if (!isset($localserverid) or !isid($localserverid, 30)) { $command = 'Error: can not find voiceserver'; $query3 = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `jobID`=? AND `type`='vo' LIMIT 1"); $query3->execute(array($row2['jobID'])); } else {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $query2->execute(array($row['id'], $reseller_id)); while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) { $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)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $dns[] = $row['dns'] . '=' . $row['ip'] . ':' . $row['port']; } } $dns = array_unique($dns); if ($i > 0) { $template_file = tsdns('mw', $TSDNSSsh2ip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, $dns, '', '', $reseller_id); } } } if ($added == '<br />Added:') { $template_file = $spracheResponse->error_table; } else { $template_file = $spracheResponse->table_add . $not . $added; } } else { unset($header, $text); $template_file = $ui->st('d', 'get') == 'md' ? 'admin_voicemasterserver_md.tpl' : 'admin_voicemasterserver_add.tpl'; } } } else { $template_file = 'admin_404.tpl';
$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)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $publickey = $row['publickey']; $ssh2ip = $row['ssh2ip']; $ssh2port = $row['decryptedssh2port']; $ssh2user = $row['decryptedssh2user']; $ssh2password = $row['decryptedssh2password']; $serverdir = $row['serverdir']; $keyname = $row['keyname']; $bit = $row['bitversion']; } if ($query->rowCount() > 0) { $dnsarray = tsdns('li', $ssh2ip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, 'N', $serverdir, $bit, array(''), array(''), array(''), $reseller_id); if (is_array($dnsarray)) { $newArray = array(); $table = array(); $newuser = $rSA['prefix1'] == 'Y' ? 1 : 2; $maxPost = @ini_get('suhosin.post.max_vars'); $maxRequests = @ini_get('suhosin.request.max_vars'); $i = 0; $max = ($maxRequests and $maxPost and $maxPost < $maxRequests) ? $maxPost : $maxRequests; $max = isset($max) ? ($max - 10) / 7 : count($dnsarray); $query = $sql->prepare("SELECT `id`,`cname`,`vname`,`name` FROM `userdata` WHERE `resellerid`=? AND `accounttype`='u' ORDER BY `id` DESC"); $query->execute(array($reseller_id)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $table[$row['id']] = trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']); } $query = $sql->prepare("SELECT `tsdnsID` FROM `voice_dns` WHERE `dns`=? AND `resellerID`=? LIMIT 1");
if (isset($usedns) and $usedns == 'Y') { if (isset($tsdnsServerID) and isid($tsdnsServerID, 10)) { $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' => $resellerLockupID, ':managedForID' => $admin_id)); while ($row = $query->fetch(PDO::FETCH_ASSOC)) { $publickey = $row['publickey']; $queryip = $row['ssh2ip']; $ssh2port = $row['decryptedssh2port']; $ssh2user = $row['decryptedssh2user']; $ssh2password = $row['decryptedssh2password']; $serverdir = $row['serverdir']; $keyname = $row['keyname']; $bitversion = $row['bitversion']; } } tsdns('dl', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip), array($port), array($dns), $resellerLockupID); } } else { if ($ui->w('safeDelete', 1, 'post') == 'S' and (!isset($errorcode) or strpos($errorcode, 'error id=0') === false)) { $template_file = isset($errorcode) ? 'Error: ' . $errorcode : 'Error: Could not connect to TS3 masterserver'; } else { $template_file = $spracheResponse->error_table; } } } // Nothing submitted yet or csfr error, display the delete form if (!$ui->st('action', 'post') or count($errors) != 0) { // Check if we could find an entry and if not display 404 page $template_file = $serverFound > 0 ? 'admin_voiceserver_dl.tpl' : 'admin_404.tpl'; } // List the available entries
customColumns('T', $row3['affectedID'], 'del'); } else { if ($row3['action'] == 'ad') { $command = $gsprache->add . ' TS DNS ID: ' . $row3['affectedID'] . ' name:' . $row4['dns']; } else { if ($row3['action'] == 'md') { $extraData = @json_decode($row3['extraData']); if (is_object($extraData) and isset($extraData->newActive)) { $active = $extraData->newActive; } $command = $gsprache->mod . ' TS DNS ID: ' . $row3['affectedID'] . ' name:' . $row4['dns']; if ($active == 'N') { $dnsAction = 'dl'; } else { if ($active == 'Y' and isset($oldip) and ($row4['ip'] != $oldip or $row4['port'] != $oldport or $row4['dns'] != $olddns)) { $ipArray = array($row4['ip'], $oldip); $portArray = array($row4['port'], $oldport); $dnsArray = array($row4['dns'], $olddns); } } } } } $query7->execute(array($active, $row3['affectedID'])); if (isset($dnsAction) and strlen($row4['ip']) > 0 and strlen($row4['port']) > 0 and strlen($row4['dns']) > 0) { tsdns($dnsAction, $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, 0, $serverdir, $bitversion, $ipArray, $portArray, $dnsArray, $row3['resellerID']); } $query6->execute(array($row3['jobID'])); } } }