mirror of
https://github.com/easy-wi/developer.git
synced 2025-02-20 11:23:28 +08:00
#30 TSDNS
This commit is contained in:
parent
354176153b
commit
b3f1455c5a
@ -173,6 +173,10 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
|
||||
|
||||
require_once(EASYWIDIR . '/stuff/ajax/datatable_voiceserver.php');
|
||||
|
||||
} else if ($ui->smallletters('d', 5, 'get') == 'tsdns' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['voiceserver']) {
|
||||
|
||||
require_once(EASYWIDIR . '/stuff/ajax/datatable_tsdns.php');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -223,6 +227,11 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
|
||||
}
|
||||
die;
|
||||
|
||||
} else if ($ui->smallletters('d', 16, 'get') == 'tsdnsmasterusage' and isset($admin_id) and $pa['voiceserver']) {
|
||||
|
||||
require_once(EASYWIDIR . '/stuff/ajax/tsdns_master_usage.php');
|
||||
die;
|
||||
|
||||
} else if (isset($admin_id) and $pa['dedicatedServer'] and $ui->smallletters('d', 7, 'get') == 'freeips' and $reseller_id == 0) {
|
||||
|
||||
if ($ui->id('userID', 10, 'get')) {
|
||||
|
@ -97,11 +97,6 @@ if ($password == 'N') {
|
||||
$initialpassword = ($ui->password('initialpassword', 50, 'post')) ? $ui->password('initialpassword', 50, 'post') : passwordgenerate(10);
|
||||
}
|
||||
|
||||
// Add jQuery plugin chosen to the header
|
||||
$htmlExtraInformation['css'][] = '<link href="css/default/chosen/chosen.min.css" rel="stylesheet" type="text/css">';
|
||||
$htmlExtraInformation['js'][] = '<script src="js/default/plugins/chosen/chosen.jquery.min.js" type="text/javascript"></script>';
|
||||
|
||||
|
||||
// CSFR protection with hidden tokens. If token(true) returns false, we likely have an attack
|
||||
if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
|
||||
@ -120,6 +115,10 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
// Add and modify entries. Same validation can be used.
|
||||
} else if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
|
||||
|
||||
// Add jQuery plugin chosen to the header
|
||||
$htmlExtraInformation['css'][] = '<link href="css/default/chosen/chosen.min.css" rel="stylesheet" type="text/css">';
|
||||
$htmlExtraInformation['js'][] = '<script src="js/default/plugins/chosen/chosen.jquery.min.js" type="text/javascript"></script>';
|
||||
|
||||
if ($ui->st('d', 'get') == 'md' and $id) {
|
||||
|
||||
$query = $sql->prepare("SELECT v.*,CONCAT(u.`cname`,' ',u.`vname`,' ',u.`name`) AS `user_name` FROM `voice_server` AS v INNER JOIN `userdata` AS u ON u.`id`=v.`userid` WHERE v.`id`=? AND v.`resellerid`=? LIMIT 1");
|
||||
@ -177,7 +176,23 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors) == 0 and $ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad' and isset($masterServerData)) {
|
||||
if (count($errors) == 0 and ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') and isset($masterServerData)) {
|
||||
|
||||
if ($ui->st('action', 'post') == 'ad') {
|
||||
if (!$userID) {
|
||||
|
||||
$error['userID'] = $sprache->user;
|
||||
|
||||
} else {
|
||||
|
||||
$query = $sql->prepare("SELECT 1 FROM `userdata` WHERE `id`=? AND `resellerid`=? AND `accounttype`='u' LIMIT 1");
|
||||
$query->execute(array($userID, $resellerLockupID));
|
||||
|
||||
if ($query->rowCount() == 0) {
|
||||
$error['userID'] = $sprache->user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$active) {
|
||||
$errors['active'] = $sprache->active;
|
||||
@ -374,7 +389,6 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// An error occurred during validation
|
||||
// unset the redirect information and display the form again
|
||||
if (!$ui->smallletters('action', 2, 'post') or count($errors) != 0) {
|
||||
@ -421,7 +435,7 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
|
||||
$serverFound = $query->rowCount();
|
||||
|
||||
if ($ui->st('action', 'post') == 'dl' and count($errors) == 0) {
|
||||
if ($ui->st('action', 'post') == 'dl' and count($errors) == 0 and $serverFound > 0) {
|
||||
|
||||
$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' => $rootID,':reseller_id' => $resellerLockupID,':managedForID' => $admin_id));
|
||||
@ -473,6 +487,11 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
|
||||
customColumns('T', $id,'del');
|
||||
|
||||
$query = $sql->prepare("DELETE b.* FROM `voice_server_backup` b LEFT JOIN `voice_server` v ON b.`sid`=v.`id` WHERE v.`id` IS NULL");
|
||||
$query->execute();
|
||||
|
||||
tsbackup('delete', $ssh2user, $serverdir, $rootID, $localserverid, '*');
|
||||
|
||||
$template_file = $spracheResponse->table_del;
|
||||
$loguseraction = '%del% %voserver% ' . $ip . ':' . $port;
|
||||
$insertlog->execute();
|
||||
@ -496,11 +515,6 @@ if ($ui->st('d', 'get') == 'ad' and is_numeric($licenceDetails['lVo']) and $lice
|
||||
}
|
||||
|
||||
tsdns('dl', $queryip, $ssh2port, $ssh2user, $publickey, $keyname, $ssh2password, $mnotified, $serverdir, $bitversion, array($ip), array($port), array($dns), $resellerLockupID);
|
||||
|
||||
tsbackup('delete', $ssh2user, $serverdir, $rootID, $localserverid, '*');
|
||||
|
||||
$query = $sql->prepare("DELETE b.* FROM `voice_server_backup` b LEFT JOIN `voice_server` v ON b.`sid`=v.`id` WHERE v.`id` IS NULL");
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
} else if ( $ui->w('safeDelete',1, 'post') == 'S' and (!isset($errorcode) or strpos($errorcode,'error id=0') === false)) {
|
||||
|
@ -45,405 +45,269 @@ if ((!isset($admin_id) or $main != 1) or (isset($admin_id) and !$pa['voiceserver
|
||||
include(EASYWIDIR . '/stuff/methods/functions_ts3.php');
|
||||
include(EASYWIDIR . '/stuff/keyphrasefile.php');
|
||||
|
||||
$sprache = getlanguagefile('voice',$user_language,$reseller_id);
|
||||
$sprache = getlanguagefile('voice', $user_language, $reseller_id);
|
||||
$loguserid = $admin_id;
|
||||
$logusername = getusername($admin_id);
|
||||
$logusertype = 'admin';
|
||||
|
||||
if ($reseller_id == 0) {
|
||||
$logreseller = 0;
|
||||
$logsubuser = 0;
|
||||
} else {
|
||||
$logsubuser=(isset($_SESSION['oldid'])) ? $_SESSION['oldid'] : 0;
|
||||
$logsubuser = (isset($_SESSION['oldid'])) ? $_SESSION['oldid'] : 0;
|
||||
$logreseller = 0;
|
||||
}
|
||||
if ($reseller_id != 0 and $admin_id != $reseller_id) $reseller_id = $admin_id;
|
||||
|
||||
$table = array();
|
||||
$table2 = array();
|
||||
|
||||
$id = $ui->id('id', 10, 'get');
|
||||
$externalID = $ui->externalID('externalID', 'post');
|
||||
$userID = $ui->id('userID', 10, 'post');
|
||||
$rootID = $ui->id('rootID', 10, 'post');
|
||||
$ip = $ui->ip4('ip', 'post');
|
||||
$port = ($ui->port('port', 'post')) ? $ui->port('port', 'post') : 9987;
|
||||
$dns = ($ui->domain('dns', 'post')) ? strtolower($ui->domain('dns', 'post')) : $ui->domain('dns', 'post');
|
||||
$active = ($ui->active('active', 'post')) ? $ui->active('active', 'post') : 'Y';
|
||||
|
||||
// CSFR protection with hidden tokens. If token(true) returns false, we likely have an attack
|
||||
if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$template_file = $spracheResponse->token;
|
||||
} else if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
|
||||
|
||||
if ($ui->st('d', 'get') == 'ad' and !$ui->w('action',3, 'post')) {
|
||||
unset($header, $text);
|
||||
|
||||
$table = array();
|
||||
$table2 = array();
|
||||
$errors = array('token' => $spracheResponse->token);
|
||||
|
||||
$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 m.`id`,m.`ssh2ip`,m.`description`, COUNT(d.`dnsID`)/(m.`max_dns`/100) AS `usedpercent` FROM `voice_tsdns` AS m LEFT JOIN `voice_dns` AS d ON d.`tsdnsID`=m.`id` WHERE m.`resellerid`=? AND m.`active`='Y' GROUP BY m.`id` HAVING `usedpercent`<100 ORDER BY `usedpercent` ASC");
|
||||
$query->execute(array($reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$table2[$row['id']] = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
}
|
||||
|
||||
$template_file = 'admin_voice_dns_add.tpl';
|
||||
|
||||
} else if ($ui->st('d', 'get') == 'ad' and $ui->smallletters('action',2, 'post') == 'ad') {
|
||||
|
||||
$error = array();
|
||||
|
||||
if (!$ui->id('userID',19, 'post')) {
|
||||
$error[] = 'UserID';
|
||||
} else {
|
||||
$userID = $ui->id('userID',19, 'post');
|
||||
$query = $sql->prepare("SELECT `cname`,`vname`,`name` FROM `userdata` WHERE `id`=? AND `resellerid`=? AND `accounttype`='u' LIMIT 1");
|
||||
$query->execute(array($userID,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$user = trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
$cname = trim($row['cname']);
|
||||
}
|
||||
if (!isset($user)) {
|
||||
$error[] = 'UserID';
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ui->id('tsdnsID',19, 'post')) {
|
||||
$error[] = 'tsdnsID';
|
||||
} else {
|
||||
$tsdnsID = $ui->id('tsdnsID',19, 'post');
|
||||
$query = $sql->prepare("SELECT `dnsID` FROM `voice_dns` WHERE `resellerid`=? ORDER BY `dnsID` DESC LIMIT 1");
|
||||
$query->execute(array($reseller_id));
|
||||
$lastID = 1;
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$lastID = $row['dnsID'] + 1;
|
||||
}
|
||||
$query = $sql->prepare("SELECT `ssh2ip`,`description`,`defaultdns` FROM `voice_tsdns` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($tsdnsID,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$tsdns = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
$dns = strtolower(trim($lastID . '-' . $cname . '.' . $row['defaultdns']));
|
||||
}
|
||||
if (!isset($tsdns)) {
|
||||
$error[] = 'tsdnsID';
|
||||
}
|
||||
}
|
||||
if (count($error)>0) {
|
||||
$template_file = 'Error: '.implode('<br />',$error);
|
||||
} else {
|
||||
$template_file = 'admin_voice_dns_add2.tpl';
|
||||
}
|
||||
} else if ($ui->st('d', 'get') == 'md' and !$ui->smallletters('action',2, 'post') and $ui->id('id', 10, 'get')) {
|
||||
$id = $ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT d.*,t.`ssh2ip`,t.`description`,u.`cname`,u.`vname`,u.`name` FROM `voice_dns` d INNER JOIN `voice_tsdns` t ON d.`tsdnsID`=t.`id` INNER JOIN `userdata` u ON d.`userID`=u.`id` WHERE d.`dnsID`=? AND d.`resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$jobPending=($row['jobPending'] == 'Y') ? $gsprache->yes : $gsprache->no;
|
||||
if ($row['jobPending'] == 'Y') {
|
||||
$query2 = $sql->prepare("SELECT `extraData` FROM `jobs` WHERE `affectedID`=? AND `resellerID`=? AND `type`='us' AND (`status` IS NULL OR `status`=1) ORDER BY `jobID` DESC LIMIT 1");
|
||||
$query2->execute(array($row['id'], $row['resellerid']));
|
||||
$json=@json_decode($query2->fetchColumn());
|
||||
$active=(is_object($json) and isset($json->newActive)) ? $json->newActive : 'N';
|
||||
} else {
|
||||
$active = $row['active'];
|
||||
}
|
||||
$dns = $row['dns'];
|
||||
$ip = $row['ip'];
|
||||
$port = $row['port'];
|
||||
$externalID = $row['externalID'];
|
||||
$tsdns = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
$user = trim($row['cname'] . ' ' . $row['vname'] . ' ' . $row['name']);
|
||||
}
|
||||
if (isset($active)) {
|
||||
$template_file = 'admin_voice_dns_md.tpl';
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
} else if ($ui->w('action',3, 'post') == 'ad2' or $ui->smallletters('action',2, 'post') == 'md') {
|
||||
$error = array();
|
||||
|
||||
$externalID = $ui->externalID('externalID', 'post');
|
||||
|
||||
if ($ui->active('active', 'post')) {
|
||||
$active = $ui->active('active', 'post');
|
||||
} else {
|
||||
$error[] = 'Active';
|
||||
}
|
||||
if ($ui->ip('ip', 'post')) {
|
||||
$ip = $ui->ip('ip', 'post');
|
||||
} else {
|
||||
$error[]="IP";
|
||||
}
|
||||
if ($ui->port('port', 'post')) {
|
||||
$port = $ui->port('port', 'post');
|
||||
} else {
|
||||
$error[]="Port";
|
||||
}
|
||||
if ($ui->domain('dns', 'post')) {
|
||||
$dns=strtolower($ui->domain('dns', 'post'));
|
||||
} else {
|
||||
$error[]="DNS";
|
||||
}
|
||||
|
||||
if ($ui->w('action',3, 'post') == 'ad2') {
|
||||
if ($ui->id('userID',19, 'post')) {
|
||||
$userID = $ui->id('userID',19, 'post');
|
||||
$query = $sql->prepare("SELECT `cname`,`vname`,`name` FROM `userdata` WHERE `id`=? AND `resellerid`=? AND `accounttype`='u' LIMIT 1");
|
||||
$query->execute(array($userID,$reseller_id));
|
||||
if ($query->rowCount()==0) {
|
||||
$error[] = 'UserID does not exist';
|
||||
}
|
||||
} else {
|
||||
$error[] = 'UserID';
|
||||
}
|
||||
if ($ui->id('tsdnsID',19, 'post')) {
|
||||
$tsdnsID = $ui->id('tsdnsID',19, 'post');
|
||||
$query = $sql->prepare("SELECT `id` FROM `voice_tsdns` WHERE `id`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($tsdnsID,$reseller_id));
|
||||
if ($query->rowCount()==0) {
|
||||
$error[] = 'tsdnsID does not exist';
|
||||
}
|
||||
} else {
|
||||
$error[] = 'tsdnsID';
|
||||
}
|
||||
} else {
|
||||
$id = $ui->id('id', 10, 'get');
|
||||
$query = $sql->prepare("SELECT `active`,`dns`,`ip`,`port`,`tsdnsID` FROM `voice_dns` WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$oldactive = $row['active'];
|
||||
$olddns = $row['dns'];
|
||||
$oldip = $row['ip'];
|
||||
$oldport = $row['port'];
|
||||
$tsdnsID = $row['tsdnsID'];
|
||||
}
|
||||
if (!isset($tsdnsID)) {
|
||||
$error[] = 'No such ID';
|
||||
}
|
||||
}
|
||||
if (count($error)>0) {
|
||||
$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 `id`=:id AND `resellerid`=:reseller_id LIMIT 1");
|
||||
$query->execute(array(':aeskey' => $aeskey,':id' => $tsdnsID,':reseller_id' => $reseller_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'];
|
||||
}
|
||||
|
||||
if (isset($queryip) and $ui->w('action',3, 'post') == 'ad2') {
|
||||
$log='add';
|
||||
$query = $sql->prepare("SELECT COUNT(`dnsID`) AS `amount` FROM `voice_dns` WHERE `dns`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($dns,$reseller_id));
|
||||
$query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `dns`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($dns,$reseller_id));
|
||||
if ($query->fetchColumn()==0 and $query2->fetchColumn()==0) {
|
||||
if ($active == 'Y') {
|
||||
$template_file = tsdns('md',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,0,$serverdir,$bitversion, array($ip), array($port), array($dns),$reseller_id);
|
||||
}
|
||||
$query = $sql->prepare("INSERT INTO `voice_dns` (`active`,`dns`,`ip`,`port`,`tsdnsID`,`userID`,`externalID`,`resellerID`) VALUES (?,?,?,?,?,?,?,?)");
|
||||
$query->execute(array($active,$dns,$ip,$port,$tsdnsID,$userID,$externalID,$reseller_id));
|
||||
} else {
|
||||
$insterfail = true;
|
||||
}
|
||||
} else if (isset($queryip) and $ui->smallletters('action', 2, 'post') == 'md') {
|
||||
if ($dns != $olddns) {
|
||||
$query = $sql->prepare("SELECT COUNT(`dnsID`) AS `amount` FROM `voice_dns` WHERE `dnsID`!=? AND `dns`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$dns,$reseller_id));
|
||||
$query2 = $sql->prepare("SELECT `id` FROM `voice_server` WHERE `dns`=? AND `resellerid`=? LIMIT 1");
|
||||
$query2->execute(array($dns,$reseller_id));
|
||||
if ($query->fetchColumn() != 0 and $query2->fetchColumn() != 0) {
|
||||
$insterfail = true;
|
||||
}
|
||||
}
|
||||
if ($active != $oldactive and $active == 'N') {
|
||||
$dnsAction='dl';
|
||||
$ipArray=array($oldip);
|
||||
$portArray=array($oldport);
|
||||
$dnsArray=array($olddns);
|
||||
} else if ($active != $oldactive and $active == 'Y') {
|
||||
$dnsAction='md';
|
||||
$ipArray=array($ip);
|
||||
$portArray=array($port);
|
||||
$dnsArray=array($dns);
|
||||
} else if ($active == 'Y' and ($ip != $oldip or $port != $oldport or $dns != $olddns)) {
|
||||
$dnsAction='md';
|
||||
$ipArray=array($ip,$oldip);
|
||||
$portArray=array($port,$oldport);
|
||||
$dnsArray=array($dns,$olddns);
|
||||
}
|
||||
if (isset($dnsAction)) {
|
||||
$template_file = tsdns($dnsAction,$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,0,$serverdir,$bitversion,$ipArray,$portArray,$dnsArray,$reseller_id);
|
||||
}
|
||||
$log='mod';
|
||||
$query = $sql->prepare("UPDATE `voice_dns` SET `active`=?,`dns`=?,`ip`=?,`port`=?,`externalID`=? WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($active,$dns,$ip,$port,$externalID,$id,$reseller_id));
|
||||
}
|
||||
|
||||
if (isset($queryip) and !isset($insterfail) and $query->rowCount() > 0) {
|
||||
$template_file = $spracheResponse->table_add;
|
||||
$loguseraction="%$log% %voserver% %dns% $ip";
|
||||
$insertlog->execute();
|
||||
} else if (isset($queryip) and isset($insterfail)) {
|
||||
$template_file = 'Error: DNS already exists';
|
||||
} else {
|
||||
$template_file = $spracheResponse->error_table;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id', 10, 'get')) {
|
||||
$id = $ui->id('id', 10, 'get');
|
||||
if (!$ui->smallletters('action',2, 'post')) {
|
||||
$query = $sql->prepare("SELECT `dns`,`ip`,`port` FROM `voice_dns` WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ip = $row['ip'];
|
||||
$port = $row['port'];
|
||||
$dns = $row['dns'];
|
||||
}
|
||||
if (isset($ip)) {
|
||||
$template_file = 'admin_voice_dns_dl.tpl';
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
} else if ($ui->smallletters('action',2, 'post') == 'dl'){
|
||||
$query = $sql->prepare("SELECT `dns`,`ip`,`port`,`tsdnsID` FROM `voice_dns` WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$ip = $row['ip'];
|
||||
$port = $row['port'];
|
||||
$dns = $row['dns'];
|
||||
$tsdnsID = $row['tsdnsID'];
|
||||
$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));
|
||||
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'];
|
||||
}
|
||||
if ($query->rowCount() > 0) {
|
||||
$query = $sql->prepare("DELETE FROM `voice_dns` WHERE `dnsID`=? AND `resellerid`=?");
|
||||
$query->execute(array($id,$reseller_id));
|
||||
if ($query->rowCount() > 0) {
|
||||
$template_file = tsdns('dl',$queryip,$ssh2port,$ssh2user,$publickey,$keyname,$ssh2password,0,$serverdir,$bitversion, array($ip), array($port), array($dns),$reseller_id);
|
||||
$loguseraction="%del% %voserver% %dns% $deleteDNS";
|
||||
$insertlog->execute();
|
||||
$template_file = $spracheResponse->table_del;
|
||||
} else {
|
||||
$template_file = $spracheResponse->error_table;
|
||||
}
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
} else {
|
||||
$o = $ui->st('o', 'get');
|
||||
if ($ui->st('o', 'get') == 'da') {
|
||||
$orderby = 'd.`active` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'aa') {
|
||||
$orderby = 'd.`active` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'dt') {
|
||||
$orderby = 't.`ssh2ip` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'at') {
|
||||
$orderby = 't.`ssh2ip` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'dd') {
|
||||
$orderby = 'd.`dns` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'ad') {
|
||||
$orderby = 'd.`dns` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'db') {
|
||||
$orderby = 'd.`ip` DESC,d.`port` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'ab') {
|
||||
$orderby = 'd.`ip` ASC,d.`port` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'du') {
|
||||
$orderby = 'u.`cname` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'au') {
|
||||
$orderby = 'u.`cname` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'dn') {
|
||||
$orderby = 'u.`name` DESC,u.`vname` DESC';
|
||||
} else if ($ui->st('o', 'get') == 'an') {
|
||||
$orderby = 'u.`name` ASC,u.`vname` ASC';
|
||||
} else if ($ui->st('o', 'get') == 'di') {
|
||||
$orderby = 'd.`dnsID` DESC';
|
||||
} else {
|
||||
$orderby = 'd.`dnsID` ASC';
|
||||
$o = 'ai';
|
||||
$errors = array();
|
||||
}
|
||||
|
||||
if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
|
||||
|
||||
// Add jQuery plugin chosen to the header
|
||||
$htmlExtraInformation['css'][] = '<link href="css/default/chosen/chosen.min.css" rel="stylesheet" type="text/css">';
|
||||
$htmlExtraInformation['js'][] = '<script src="js/default/plugins/chosen/chosen.jquery.min.js" type="text/javascript"></script>';
|
||||
|
||||
$query = $sql->prepare("SELECT `defaultdns`,`publickey`,`keyname`,`ssh2ip`,`serverdir`,`bitversion`,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' => $rootID, ':reseller_id' => $resellerLockupID));
|
||||
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $rootServer) {
|
||||
$foundRoot = true;
|
||||
}
|
||||
$query = $sql->prepare("SELECT COUNT(`dnsID`) AS `amount` FROM `voice_dns` WHERE `resellerid`=?");
|
||||
$query->execute(array($reseller_id));
|
||||
$colcount = $query->fetchColumn();
|
||||
if ($start>$colcount) {
|
||||
$start = $colcount-$amount;
|
||||
if ($start<1) {
|
||||
$start = 0;
|
||||
|
||||
if ($id and $ui->st('d', 'get') == 'md') {
|
||||
|
||||
$query = $sql->prepare("SELECT d.`active`,d.`dns`,d.`ip`,d.`port`,d.`tsdnsID`,d.`userID`,m.`ssh2ip`,m.`description`,CONCAT(u.`cname`,' ',u.`vname`,' ',u.`name`) AS `user_name` FROM `voice_dns` AS d INNER JOIN `voice_tsdns` AS m ON m.`id`=d.`tsdnsID` INNER JOIN `userdata` AS u ON u.`id`=d.`userID` WHERE d.`dnsID`=? AND d.`resellerID`=? LIMIT 1");
|
||||
$query->execute(array($id, $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if (!$ui->st('action', 'post')) {
|
||||
$active = $row['active'];
|
||||
$ip = $row['ip'];
|
||||
$port = $row['port'];
|
||||
}
|
||||
|
||||
$userName = trim($row['user_name']);
|
||||
|
||||
$table2[$row['tsdnsID']] = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
|
||||
$oldActive = $row['active'];
|
||||
$oldDns = $row['dns'];
|
||||
$oldIp = $row['ip'];
|
||||
$oldPort = $row['port'];
|
||||
}
|
||||
}
|
||||
$table = array();
|
||||
$query = $sql->prepare("SELECT d.*,u.`cname`,u.`name`,u.`vname`,t.`ssh2ip`,t.`description` FROM `voice_dns` d INNER JOIN `userdata` u ON d.`userID`=u.`id` INNER JOIN `voice_tsdns` t ON d.`tsdnsID`=t.`id` WHERE d.`resellerid`=? ORDER BY $orderby LIMIT $start,$amount");
|
||||
$query->execute(array($reseller_id));
|
||||
$query2 = $sql->prepare("SELECT `extraData` FROM `jobs` WHERE `affectedID`=? AND `resellerID`=? AND `type`='ds' AND (`status` IS NULL OR `status`=1) ORDER BY `jobID` DESC LIMIT 1");
|
||||
|
||||
if (count($errors) == 0 and ($ui->st('action', 'post') == 'md' or $ui->st('action', 'post') == 'ad') and isset($rootServer)) {
|
||||
|
||||
if (!$active) {
|
||||
$errors['active'] = $sprache->active;
|
||||
}
|
||||
|
||||
if (!$dns) {
|
||||
$errors['dns'] = $sprache->dns;
|
||||
}
|
||||
|
||||
if (!$ip) {
|
||||
$errors['ip'] = $sprache->ip;
|
||||
}
|
||||
|
||||
if (!$port) {
|
||||
$errors['port'] = $sprache->port;
|
||||
}
|
||||
|
||||
if ($ui->st('action', 'post') == 'ad') {
|
||||
|
||||
if (!$userID) {
|
||||
|
||||
$errors['userID'] = $sprache->user;
|
||||
|
||||
} else {
|
||||
|
||||
$query = $sql->prepare("SELECT 1 FROM `userdata` WHERE `id`=? AND `resellerid`=? AND `accounttype`='u' LIMIT 1");
|
||||
$query->execute(array($userID, $resellerLockupID));
|
||||
|
||||
if ($query->rowCount() == 0) {
|
||||
$errors['userID'] = $sprache->user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($dns and $ip and $port) {
|
||||
$query = $sql->prepare("SELECT `dns`,`ip`,`port` FROM `voice_dns` WHERE `dnsID`!=? AND `resellerID`=? AND `active`='Y' AND (`dns`=? OR (`ip`=? AND `port`=?)) LIMIT 1");
|
||||
$query->execute(array($id, $resellerLockupID, $dns, $ip, $port));
|
||||
while($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
if (isset($rootServer['defaultdns']) and $dns != $rootServer['defaultdns'] and $dns == $row['dns']) {
|
||||
$errors['dns'] = $sprache->dns;
|
||||
} else if ($ip == $row['ip'] and $port == $row['port']) {
|
||||
$errors['ip'] = $sprache->ip;
|
||||
$errors['port'] = $sprache->port;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($errors) == 0) {
|
||||
|
||||
if ($ui->st('action', 'post') == 'ad' and isset($rootServer)) {
|
||||
|
||||
$query = $sql->prepare("INSERT INTO `voice_dns` (`active`,`dns`,`ip`,`port`,`tsdnsID`,`userID`,`externalID`,`resellerID`) VALUES (?,?,?,?,?,?,?,?)");
|
||||
$query->execute(array($active, $dns, $ip, $port, $rootID, $userID, $externalID, $resellerLockupID));
|
||||
$rowCount = $query->rowCount();
|
||||
|
||||
$id = $sql->lastInsertId();
|
||||
|
||||
if ($dns == $rootServer['defaultdns']) {
|
||||
|
||||
$dns = strtolower($id . '-' . getusername($userID) . '.' . $rootServer['defaultdns']);
|
||||
|
||||
$query = $sql->prepare("UPDATE `voice_dns` SET `dns`=? WHERE `dnsID`=? LIMIT 1");
|
||||
$query->execute(array($dns, $id));
|
||||
|
||||
$rowCount += $query->rowCount();
|
||||
}
|
||||
|
||||
$loguseraction = '%add% %voserver% ' . $ip . ':' . $port . ' ' . $dns;
|
||||
|
||||
} else if ($ui->st('action', 'post') == 'md' and $id and isset($rootServer)) {
|
||||
|
||||
$query = $sql->prepare("UPDATE `voice_dns` SET `active`=?,`dns`=?,`ip`=?,`port`=?,`externalID`=? WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($active, $dns, $ip, $port, $externalID, $id, $resellerLockupID));
|
||||
$rowCount = $query->rowCount();
|
||||
|
||||
$loguseraction = '%mod% %voserver% ' . $ip . ':' . $port . ' ' . $dns;
|
||||
}
|
||||
|
||||
if (isset($rowCount) and $rowCount > 0) {
|
||||
|
||||
if (isset($rootServer)) {
|
||||
|
||||
if ($active == 'Y' and ($ui->st('action', 'post') == 'ad' or ($ui->st('action', 'post') == 'md' and isset($oldActive) and $oldActive == 'N'))) {
|
||||
$serverReturn = tsdns('md', $rootServer['ssh2ip'], $rootServer['decryptedssh2port'], $rootServer['decryptedssh2user'], $rootServer['publickey'], $rootServer['keyname'], $rootServer['decryptedssh2password'], 0, $rootServer['serverdir'], $rootServer['bitversion'], array($ip), array($port), array($dns), $resellerLockupID);
|
||||
}
|
||||
|
||||
if ($ui->st('action', 'post') == 'md') {
|
||||
|
||||
if ($active == 'N' and isset($oldActive) and $oldActive == 'Y') {
|
||||
$serverReturn = tsdns('md', $rootServer['ssh2ip'], $rootServer['decryptedssh2port'], $rootServer['decryptedssh2user'], $rootServer['publickey'], $rootServer['keyname'], $rootServer['decryptedssh2password'], 0, $rootServer['serverdir'], $rootServer['bitversion'], array($oldIp), array($oldPort), array($oldDns), $resellerLockupID);
|
||||
}
|
||||
|
||||
if ($active == 'Y' and ($ip != $oldIp or $port != $oldPort or $dns != $oldDns)) {
|
||||
$serverReturn = tsdns('md', $rootServer['ssh2ip'], $rootServer['decryptedssh2port'], $rootServer['decryptedssh2user'], $rootServer['publickey'], $rootServer['keyname'], $rootServer['decryptedssh2password'], 0, $rootServer['serverdir'], $rootServer['bitversion'], array($ip, $oldIp), array($port, $oldPort), array($dns, $oldDns), $resellerLockupID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($serverReturn) and $serverReturn != 'ok') {
|
||||
|
||||
$template_file = $serverReturn;
|
||||
|
||||
} else {
|
||||
$insertlog->execute();
|
||||
$template_file = $spracheResponse->table_add;
|
||||
}
|
||||
|
||||
|
||||
// No update or insert failed
|
||||
} else {
|
||||
$template_file = $spracheResponse->error_table;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// An error occurred during validation
|
||||
// unset the redirect information and display the form again
|
||||
if (!$ui->smallletters('action', 2, 'post') or count($errors) != 0) {
|
||||
|
||||
unset($header, $text);
|
||||
|
||||
// Gather data for adding if needed and define add template
|
||||
if ($ui->st('d', 'get') == 'ad') {
|
||||
|
||||
$table = getUserList($resellerLockupID);
|
||||
|
||||
$query = $sql->prepare("SELECT m.`id`,m.`ssh2ip`,m.`description`, COUNT(d.`dnsID`)/(m.`max_dns`/100) AS `usedpercent` FROM `voice_tsdns` AS m LEFT JOIN `voice_dns` AS d ON d.`tsdnsID`=m.`id` WHERE m.`resellerid`=? AND m.`active`='Y' GROUP BY m.`id` HAVING `usedpercent`<100 ORDER BY `usedpercent` ASC");
|
||||
$query->execute(array($resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$table2[$row['id']] = trim($row['ssh2ip'] . ' ' . $row['description']);
|
||||
}
|
||||
|
||||
$template_file = 'admin_voice_dns_add.tpl';
|
||||
|
||||
// Gather data for modding in case we have an ID and define mod template
|
||||
} else if ($ui->st('d', 'get') == 'md' and $id) {
|
||||
|
||||
// Check if database entry exists and if not display 404 page
|
||||
$template_file = (isset($oldActive)) ? 'admin_voice_dns_md.tpl' : 'admin_404.tpl';
|
||||
|
||||
// Show 404 if GET parameters did not add up or no ID was given with mod
|
||||
} else {
|
||||
$template_file = 'admin_404.tpl';
|
||||
}
|
||||
}
|
||||
|
||||
} else 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)) {
|
||||
if ($row['jobPending'] == 'Y') {
|
||||
$jobPending = $gsprache->yes;
|
||||
$query2->execute(array($row['dnsID'], $row['resellerID']));
|
||||
$json=@json_decode($query2->fetchColumn());
|
||||
$tobeActive=(is_object($json) and isset($json->newActive)) ? $json->newActive : 'N';
|
||||
} else {
|
||||
$jobPending = $gsprache->no;
|
||||
$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);
|
||||
}
|
||||
if (($row['active'] == 'Y' and $row['jobPending'] == 'N') or ($row['jobPending'] == 'Y') and isset($tobeActive) and $tobeActive == 'Y') {
|
||||
$imgName = '16_ok';
|
||||
$imgAlt='online';
|
||||
|
||||
$query = $sql->prepare("DELETE FROM `voice_dns` WHERE `dnsID`=? AND `resellerid`=? LIMIT 1");
|
||||
$query->execute(array($id, $resellerLockupID));
|
||||
|
||||
if ($query->rowCount() > 0) {
|
||||
|
||||
$loguseraction = '%del% %voserver% %dns% ' . $deleteDNS;
|
||||
$insertlog->execute();
|
||||
|
||||
$template_file = $spracheResponse->table_del;
|
||||
} else {
|
||||
$imgName = '16_bad';
|
||||
$imgAlt='inactive';
|
||||
$template_file = $spracheResponse->error_table;
|
||||
}
|
||||
$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) {
|
||||
$vor = $start+$amount;
|
||||
} else {
|
||||
$vor = $start;
|
||||
|
||||
// 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';
|
||||
}
|
||||
$back = $start - $amount;
|
||||
if ($back>=0){
|
||||
$zur = $start - $amount;
|
||||
} else {
|
||||
$zur = $start;
|
||||
}
|
||||
$pageamount = ceil($colcount / $amount);
|
||||
$link='<a href="admin.php?w=vr&o='.$o.'&a=';
|
||||
if (!isset($amount)) {
|
||||
$link .="20";
|
||||
} else {
|
||||
$link .= $amount;
|
||||
}
|
||||
if ($start==0) {
|
||||
$link .= '&p=0" class="bold">1</a>';
|
||||
} else {
|
||||
$link .= '&p=0">1</a>';
|
||||
}
|
||||
$pages[] = $link;
|
||||
$i = 2;
|
||||
while ($i<=$pageamount) {
|
||||
$selectpage = ($i - 1) * $amount;
|
||||
if ($start==$selectpage) {
|
||||
$pages[] = '<a href="admin.php?w=vr&o='.$o.'&a=' . $amount . '&p=' . $selectpage . '" class="bold">' . $i . '</a>';
|
||||
} else {
|
||||
$pages[] = '<a href="admin.php?w=vr&o='.$o.'&a=' . $amount . '&p=' . $selectpage . '">' . $i . '</a>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$pages=implode(', ',$pages);
|
||||
|
||||
} else {
|
||||
|
||||
configureDateTables('-1', '1, "asc"', 'ajax.php?w=datatable&d=tsdns');
|
||||
|
||||
$template_file = 'admin_voice_dns_list.tpl';
|
||||
}
|
130
web/stuff/ajax/datatable_tsdns.php
Normal file
130
web/stuff/ajax/datatable_tsdns.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: datatable_tsdns.php.
|
||||
* Author: Ulrich Block
|
||||
* Date: 21.02.15
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
if (!defined('AJAXINCLUDED')) {
|
||||
die('Do not access directly!');
|
||||
}
|
||||
|
||||
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `voice_dns` WHERE `resellerID`=?");
|
||||
$query->execute(array($resellerLockupID));
|
||||
|
||||
$array['iTotalRecords'] = $query->fetchColumn();
|
||||
|
||||
if ($sSearch) {
|
||||
|
||||
$userInQuery = (count($userIDs) > 0) ? ' OR `userID` IN (' . implode(',', $userIDs) . ')' : '';
|
||||
|
||||
$toLower = strtolower($sSearch);
|
||||
|
||||
$statusQuery = array();
|
||||
|
||||
if (strpos(strtolower($gsprache->status_inactive), $toLower) !== false or strpos(strtolower($gsprache->status_stop), $toLower) !== false) {
|
||||
$statusQuery[] = "OR d.`active`='N'";
|
||||
}
|
||||
if (strpos(strtolower($gsprache->status_ok), $toLower) !== false) {
|
||||
$statusQuery[] = "OR d.`active`='Y'";
|
||||
}
|
||||
|
||||
$statusQuery = (count($statusQuery) > 0) ? implode(' ', $statusQuery) : '';
|
||||
|
||||
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `voice_dns` AS d LEFT JOIN `userdata` AS u ON d.`userID`=u.`id` WHERE d.`resellerID`=:reseller_id AND (d.`dnsID` LIKE :search OR CONCAT(`ip`,':',`port`,' (',`dns`,')') LIKE :search {$userInQuery} {$statusQuery})");
|
||||
$query->execute(array(':search' => '%' . $sSearch . '%', ':reseller_id' => $resellerLockupID));
|
||||
$array['iTotalDisplayRecords'] = $query->fetchColumn();
|
||||
|
||||
} else {
|
||||
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
|
||||
}
|
||||
|
||||
$orderFields = array(0 => '`server`', 1 => 'd.`dnsID`', 2 => '`active`', 3 => 'u.`cname`', 4 => '`jobPending`');
|
||||
|
||||
if (isset($orderFields[$iSortCol]) and is_array($orderFields[$iSortCol])) {
|
||||
$orderBy = implode(' ' . $sSortDir . ', ', $orderFields[$iSortCol]) . ' ' . $sSortDir;
|
||||
} else if (isset($orderFields[$iSortCol]) and !is_array($orderFields[$iSortCol])) {
|
||||
$orderBy = $orderFields[$iSortCol] . ' ' . $sSortDir;
|
||||
} else {
|
||||
$orderBy = 'd.`dnsID` DESC';
|
||||
}
|
||||
|
||||
|
||||
if ($sSearch) {
|
||||
$query = $sql->prepare("SELECT d.`dnsID`,d.`dns`,d.`jobPending`,d.`active`,d.`userID`,CONCAT(`ip`,':',`port`,' (',`dns`,')') AS `server`,u.`cname`,CONCAT(u.`vname`,' ',u.`name`) AS `full_name` FROM `voice_dns` AS d LEFT JOIN `userdata` AS u ON d.`userID`=u.`id` WHERE d.`resellerID`=:reseller_id AND (d.`dnsID` LIKE :search OR CONCAT(`ip`,':',`port`,' (',`dns`,')') LIKE :search {$userInQuery} {$statusQuery}) ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
|
||||
$query->execute(array(':search' => '%' . $sSearch . '%', ':reseller_id' => $resellerLockupID));
|
||||
} else {
|
||||
$query = $sql->prepare("SELECT d.`dnsID`,d.`dns`,d.`jobPending`,d.`active`,d.`userID`,CONCAT(`ip`,':',`port`,' (',`dns`,')') AS `server`,u.`cname`,CONCAT(u.`vname`,' ',u.`name`) AS `full_name` FROM `voice_dns` AS d LEFT JOIN `userdata` AS u ON d.`userID`=u.`id` WHERE d.`resellerID`=? ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
|
||||
$query->execute(array($resellerLockupID));
|
||||
}
|
||||
|
||||
$query2 = $sql->prepare("SELECT `action`,`extraData` FROM `jobs` WHERE `affectedID`=? AND `resellerID`=? AND `type`='ds' AND (`status` IS NULL OR `status`=1) ORDER BY `jobID` DESC LIMIT 1");
|
||||
$query3 = $sql->prepare("UPDATE `voice_dns` SET `jobPending`='N' WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
$jobPending = $gsprache->no;
|
||||
$status = 0;
|
||||
$statusMessage = $gsprache->status_ok;
|
||||
|
||||
if ($row['jobPending'] == 'Y') {
|
||||
|
||||
$query2->execute(array($row['id'], $resellerLockupID));
|
||||
while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if ($row2['action'] == 'ad') {
|
||||
$jobPending = $gsprache->add;
|
||||
} else if ($row2['action'] == 'dl') {
|
||||
$jobPending = $gsprache->del;
|
||||
} else {
|
||||
$jobPending = $gsprache->mod;
|
||||
}
|
||||
|
||||
$json = @json_decode($row2['extraData']);
|
||||
$row['status'] = ((is_object($json) and isset($json->newActive) and $json->newActive == 'N')) ? 2 : 0;
|
||||
}
|
||||
|
||||
if ($query2->rowCount() == 0) {
|
||||
$query3->execute(array($row['id'], $resellerLockupID));
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['active'] == 'N') {
|
||||
$status = 3;
|
||||
$statusMessage = $gsprache->status_inactive;
|
||||
}
|
||||
|
||||
$array['aaData'][] = array('<a href="ts3server://' . $row['dns'] . '">' . $row['server'] . '</a>', $row['dnsID'], returnButton($template_to_use, 'ajax_admin_show_status.tpl', '', '', $status, (string) $statusMessage), returnButton($template_to_use, 'ajax_admin_user_switch.tpl', $row['cname'], $row['full_name'], $row['userID'], ''), (string) $jobPending, returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'vr', 'dl', $row['dnsID'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_md.tpl', 'vr', 'md', $row['dnsID'], $gsprache->mod));
|
||||
}
|
67
web/stuff/ajax/tsdns_master_usage.php
Normal file
67
web/stuff/ajax/tsdns_master_usage.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File: tsdns_master_usage.php.
|
||||
* Author: Ulrich Block
|
||||
* Date: 21.02.15
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
if (!defined('AJAXINCLUDED')) {
|
||||
die('Do not access directly!');
|
||||
}
|
||||
|
||||
$sprache = getlanguagefile('voice', $user_language, $reseller_id);
|
||||
|
||||
if ($ui->id('id', 10, 'get')) {
|
||||
|
||||
$dns = '';
|
||||
$installedServer = 0;
|
||||
$maxServer = 0;
|
||||
|
||||
$query = $sql->prepare("SELECT COUNT(d.`dnsID`) AS `installed_server`,m.`max_dns`,m.`defaultdns` FROM `voice_tsdns` AS m LEFT JOIN `voice_dns` AS d ON d.`tsdnsID`=m.`id` WHERE m.`id`=? AND m.`resellerid`=? AND m.`active`='Y' GROUP BY m.`id` LIMIT 1");
|
||||
$query->execute(array($ui->id('id', 10, 'get'), $resellerLockupID));
|
||||
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$dns = $row['defaultdns'];
|
||||
$installedServer = (int) $row['installed_server'];
|
||||
$maxServer = (int) $row['max_dns'];
|
||||
}
|
||||
|
||||
if ($ui->id('serverID', 10, 'get') and isset($masterServerData)) {
|
||||
$query = $sql->prepare("SELECT `dns` FROM `voice_dns` WHERE `dnsID`=? AND `resellerID`=? LIMIT 1");
|
||||
$query->execute(array($ui->id('serverID', 10, 'get'), $resellerLockupID));
|
||||
$dns = $query->fetchColumn();
|
||||
}
|
||||
}
|
||||
|
||||
require_once IncludeTemplate($template_to_use, 'ajax_admin_tsdns_server_usage.tpl', 'ajax');
|
@ -156,7 +156,7 @@ class HttpdManagement {
|
||||
$this->vhostData['templateFileContent'] = "# DO NOT EDIT DIRECTLY!\r\n# This file is autogenerated by easy-wi.com.\r\n# Date and time of generation was " . date('Y-m-d H:i:s') . "\r\n\r\n";
|
||||
$this->vhostData['templateFileContent'] .= ($row['ownVhost'] == 'Y') ? $row['vhostTemplate'] : $this->hostData['vhostTemplate'];
|
||||
|
||||
$this->vhostData['templateFileContent'] = $this->removeNotNeededSlashes(str_replace(array('%url%', '%user%', '%vhostpath%', '%email%', '%htdocs%', '%logDir%'), array($row['dns'], $row['ftpUser'], $this->hostData['vhostStoragePath'], $row['mail'], $this->hostData['dirHttpd'], $this->hostData['dirLogs']), $this->vhostData['templateFileContent'])) . "\r\n";
|
||||
$this->vhostData['templateFileContent'] = $this->removeNotNeededSlashes(str_replace(array('%url%', '%user%', '%group%', '%vhostpath%', '%email%', '%htdocs%', '%logDir%'), array($row['dns'], $row['ftpUser'], $this->hostData['userGroup'], $this->hostData['vhostStoragePath'], $row['mail'], $this->hostData['dirHttpd'], $this->hostData['dirLogs']), $this->vhostData['templateFileContent'])) . "\r\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -132,7 +132,11 @@ function tsdns ($action, $sship, $sshport, $sshuser, $keyuse, $sshkey, $sshpw, $
|
||||
$sshpw->setPassword($sshpw);
|
||||
}
|
||||
|
||||
$sshpw->loadKey(file_get_contents($privateKey));
|
||||
$keyContent = @file_get_contents($privateKey);
|
||||
|
||||
if ($keyContent) {
|
||||
$sshpw->loadKey($keyContent);
|
||||
}
|
||||
}
|
||||
|
||||
if ($sshSftpObject->login($sshuser, $sshpw)) {
|
||||
|
@ -69,7 +69,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
|
||||
$dns = $row['dns'];
|
||||
$ip = $row['ip'];
|
||||
$port = $row['port'];
|
||||
$defaultdns = strtolower($row['dnsID'] . '-' . getusername($user_id).$row['defaultdns']);
|
||||
$defaultdns = strtolower($row['dnsID'] . '-' . getusername($user_id) . $row['defaultdns']);
|
||||
}
|
||||
|
||||
$template_file = (isset($dns)) ? 'userpanel_voiceserver_dns_md.tpl' : 'userpanel_404.tpl';
|
||||
|
@ -1,39 +1,125 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
|
||||
<li><a href="admin.php?w=vr">TSDNS</a> <span class="divider">/</span></li>
|
||||
<li class="active"><?php echo $gsprache->add;?></li>
|
||||
</ul>
|
||||
<section class="content-header">
|
||||
<h1>TSDNS</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="admin.php?w=vo"><i class="fa fa-microphone"></i> <?php echo $gsprache->voiceserver;?></a></li>
|
||||
<li><a href="admin.php?w=vr"><i class="fa fa-link"></i> TSDNS</a></li>
|
||||
<li class="active"><?php echo $gsprache->add;?></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<?php if (count($errors)>0){ ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<h4><?php echo $gsprache->errors;?></h4>
|
||||
<?php echo implode(', ',$errors);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<form name="form" class="form-horizontal" action="admin.php?w=vr&d=ad" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="ad">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputUser"><?php echo $sprache->user;?></label>
|
||||
<div class="controls">
|
||||
<select id="inputUser" name="userID">
|
||||
<?php foreach ($table as $key=>$value){ ?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-success">
|
||||
|
||||
<form role="form" action="admin.php?w=vr&d=ad&r=vr" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="ad">
|
||||
|
||||
<div class="box-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputExternalID">External ID</label>
|
||||
<div class="controls"><input class="form-control" id="inputExternalID" type="text" name="externalID" value="<?php echo $externalID;?>"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group<?php if(isset($errors['userID'])) echo ' has-error';?>">
|
||||
<label for="inputUser"><?php echo $sprache->user;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control chosen-select" id="inputUser" name="userID" required="required">
|
||||
<option></option>
|
||||
<?php foreach ($table as $key=>$val){ ?>
|
||||
<option value="<?php echo $key;?>" <?php if($key==$userID) echo 'selected="selected"';?>><?php echo $val;?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group<?php if(isset($errors['rootID'])) echo ' has-error';?>">
|
||||
<label for="inputRoot"><?php echo $sprache->rootserver;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control chosen-select" id="inputRoot" name="rootID">
|
||||
<?php foreach ($table2 as $key=>$val){ ?>
|
||||
<option value="<?php echo $key;?>" <?php if($key==$rootID) echo 'selected="selected"';?>><?php echo $val;?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rootWrapper">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputActive"><?php echo $sprache->active;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control" id="inputActive" name="active">
|
||||
<option value="Y"><?php echo $gsprache->yes;?></option>
|
||||
<option value="N" <?php if($active=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputIp"><?php echo $sprache->ip;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputIp" type="text" name="ip" value="<?php echo $ip;?>" maxlength="15">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort"><?php echo $sprache->port;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputPort" type="number" name="port" value="<?php echo $port;?>" maxlength="5" min="1" max="65535">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-footer">
|
||||
<button class="btn btn-success" id="inputEdit" type="submit"><i class="fa fa-plus-circle"> <?php echo $gsprache->add;?></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputMaster">TSDNS <?php echo $gsprache->master;?></label>
|
||||
<div class="controls">
|
||||
<select id="inputMaster" name="tsdnsID">
|
||||
<?php foreach ($table2 as $key=>$value){ ?><option value="<?php echo $key;?>"><?php echo $value;?></option><?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputEdit"></label>
|
||||
<div class="controls">
|
||||
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="icon-plus-sign icon-white"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#inputUser,#inputRoot").chosen({
|
||||
disable_search_threshold: 3,
|
||||
inherit_select_classes: true,
|
||||
no_results_text: '<?php echo $gsprache->chosenNoResult;?>',
|
||||
placeholder_text_single: '<?php echo $gsprache->chosenSelect;?>',
|
||||
placeholder_text_multiple: '<?php echo $gsprache->chosenSelect;?>',
|
||||
width: "100%"
|
||||
});
|
||||
|
||||
function loadRootDetails () {
|
||||
$.ajax({ url: 'ajax.php?d=tsdnsmasterusage&id=' + $("#inputRoot").val() + '&serverID=<?php echo $id;?>', cache: false } ).done(function(html) {
|
||||
$('#rootWrapper').html(html);
|
||||
});
|
||||
}
|
||||
|
||||
$('#inputRoot').on('change', function() {
|
||||
loadRootDetails();
|
||||
});
|
||||
|
||||
$(function(){
|
||||
loadRootDetails();
|
||||
});
|
||||
</script>
|
@ -1,36 +1,53 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
|
||||
<li><a href="admin.php?w=vr">TSDNS</a> <span class="divider">/</span></li>
|
||||
<li><?php echo $gsprache->del;?> <span class="divider">/</span></li>
|
||||
<li class="active"><?php echo $dns;?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>TSDNS</dt>
|
||||
<dd><?php echo $dns;?></dd>
|
||||
<dt><?php echo $sprache->ip;?></dt>
|
||||
<dd><?php echo $ip;?></dd>
|
||||
<dt><?php echo $sprache->port;?></dt>
|
||||
<dd><?php echo $port;?></dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<form name="form" class="form-horizontal" action="admin.php?w=vr&d=dl&id=<?php echo $id;?>&r=vr" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="dl">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputEdit"></label>
|
||||
<div class="controls">
|
||||
<button class="btn btn-danger pull-left" id="inputEdit" type="submit"><i class="fa fa-trash-o"></i> <?php echo $gsprache->del;?></button>
|
||||
</div>
|
||||
<section class="content-header">
|
||||
<h1>TSDNS</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="admin.php?w=vo"><i class="fa fa-microphone"></i> <?php echo $gsprache->voiceserver;?></a></li>
|
||||
<li><a href="admin.php?w=vr"><i class="fa fa-link"></i> TSDNS</a></li>
|
||||
<li><?php echo $gsprache->del;?></li>
|
||||
<li class="active"><?php echo $dns;?></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-danger">
|
||||
|
||||
<form role="form" action="admin.php?w=vr&d=dl&id=<?php echo $id;?>&r=vr" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="dl">
|
||||
|
||||
<div class="box-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputTSDNS">TSDNS</label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputTSDNS" type="text" name="dns" value="<?php echo $dns;?>" disabled="disabled">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputIP"><?php echo $sprache->ip;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputIP" type="text" name="ip" value="<?php echo $ip;?>" disabled="disabled">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort"><?php echo $sprache->port;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputPort" type="text" name="port" value="<?php echo $port;?>" disabled="disabled">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-footer">
|
||||
<button class="btn btn-danger" id="inputDelete" type="submit"><i class="fa fa-trash-o"></i> <?php echo $gsprache->del;?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -1,58 +1,53 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
|
||||
<li>TSDNS <span class="divider">/</span></li>
|
||||
<li class="active"><?php echo $gsprache->overview;?></li>
|
||||
</ul>
|
||||
<section class="content-header">
|
||||
<h1>TSDNS <?php echo $gsprache->master;?></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="admin.php?w=vo"><i class="fa fa-microphone"></i> <?php echo $gsprache->voiceserver;?></a></li>
|
||||
<li><a href="admin.php?w=vr"><i class="fa fa-hdd-o"></i> TSDNS</a></li>
|
||||
<li class="active"><?php echo $gsprache->overview;?></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
TSDNS <a href="admin.php?w=vr&d=ad"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> <?php echo $gsprache->add;?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
TSDNS <a href="admin.php?w=vr&d=ad"><span class="btn btn-primary btn-mini"><i class="icon-white icon-plus-sign"></i></span></a>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body table-responsive">
|
||||
<table id="dataTable" class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>TS3 DNS</th>
|
||||
<th>ID</th>
|
||||
<th><?php echo $gsprache->status;?></th>
|
||||
<th><?php echo $sprache->user;?></th>
|
||||
<th><?php echo $gsprache->jobPending;?></th>
|
||||
<th><?php echo $gsprache->action;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>TS3 DNS</th>
|
||||
<th>ID</th>
|
||||
<th><?php echo $gsprache->status;?></th>
|
||||
<th><?php echo $sprache->user;?></th>
|
||||
<th><?php echo $gsprache->jobPending;?></th>
|
||||
<th><?php echo $gsprache->action;?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row-fluid">
|
||||
<div class="span11 pagination">
|
||||
<ul>
|
||||
<li><a href="admin.php?w=vr&d=md&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $zur;?>"><i class="icon-step-backward"></i></a></li>
|
||||
<li><a href="admin.php?w=vr&o=<?php echo $o;?>&a=20&p=<?php echo $start; ?>">20</a></li>
|
||||
<li><a href="admin.php?w=vr&o=<?php echo $o;?>&a=50&p=<?php echo $start; ?>">50</a></li>
|
||||
<li><a href="admin.php?w=vr&o=<?php echo $o;?>&a=100&p=<?php echo $start; ?>">100</a></li>
|
||||
<li><a href="admin.php?w=vr&d=md&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $vor;?>"><i class="icon-step-forward"></i></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span11">
|
||||
<table class="table table-bordered table-hover table-striped footable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-class="expand"><a href="admin.php?w=vr&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $start;?>&o=<?php if ($o=='ad') { echo 'dd'; } else { echo 'ad'; } ?>">TS3 DNS</a></th>
|
||||
<th data-hide="phone,tablet"><a href="admin.php?w=vr&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $start;?>&o=<?php if ($o=='di') { echo 'ai'; } else { echo 'di'; } ?>">ID</a></th>
|
||||
<th data-hide="phone,tablet"><a href="admin.php?w=vr&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $start;?>&o=<?php if ($o=='aa') { echo 'da'; } else { echo 'aa'; } ?>"><?php echo $gsprache->status;?></a></th>
|
||||
<th data-hide="phone,tablet"><a href="admin.php?w=vr&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $start;?>&o=<?php if ($o=='ab') { echo 'db'; } else { echo 'ab'; } ?>"><?php echo $sprache->ip;?></a></th>
|
||||
<th data-hide="phone,tablet"><a href="admin.php?w=vr&a=<?php if(!isset($amount)) echo "20"; else echo $amount; ?>&p=<?php echo $start;?>&o=<?php if ($o=='au') { echo 'du'; } else { echo 'au'; } ?>"><?php echo $sprache->user;?></a></th>
|
||||
<th data-hide="phone"><?php echo $gsprache->jobPending;?></th>
|
||||
<th><?php echo $gsprache->del;?></th>
|
||||
<th><?php echo $gsprache->mod;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($table as $table_row) { ?>
|
||||
<tr>
|
||||
<td><?php echo $table_row['dns'];?></td>
|
||||
<td><?php echo $table_row['id'];?></td>
|
||||
<td><i class="<?php if($table_row['active']=='Y') echo 'icon-ok'; else echo 'icon-ban-circle';?>"></i></td>
|
||||
<td><?php echo $table_row['address'];?></td>
|
||||
<td><a href="switch.php?id=<?php echo $table_row['userid'];?>"><?php echo $table_row['cname'];?></a></td>
|
||||
<td><?php echo $table_row['jobPending'];?></td>
|
||||
<td><a href="admin.php?w=vr&d=dl&id=<?php echo $table_row['id'];?>" ><span class="btn btn-mini btn-danger"><i class="fa fa-trash-o"></i></span></a></td>
|
||||
<td><a href="admin.php?w=vr&d=md&id=<?php echo $table_row['id'];?>" ><span class="btn btn-mini btn-primary"><i class="icon-white icon-edit"></i></span></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -1,61 +1,119 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<ul class="breadcrumb">
|
||||
<li><a href="admin.php">Home</a> <span class="divider">/</span></li>
|
||||
<li><a href="admin.php?w=vr">TSDNS</a> <span class="divider">/</span></li>
|
||||
<li><?php echo $gsprache->mod;?> <span class="divider">/</span></li>
|
||||
<li class="active"><?php echo $tsdns;?></li>
|
||||
</ul>
|
||||
<section class="content-header">
|
||||
<h1>TSDNS</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="admin.php?w=vo"><i class="fa fa-microphone"></i> <?php echo $gsprache->voiceserver;?></a></li>
|
||||
<li><a href="admin.php?w=vr"><i class="fa fa-link"></i> TSDNS</a></li>
|
||||
<li><?php echo $gsprache->mod;?></li>
|
||||
<li class="active"><?php echo $dns;?></li>
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
|
||||
<?php if (count($errors)>0){ ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<h4><?php echo $gsprache->errors;?></h4>
|
||||
<?php echo implode(', ',$errors);?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<dl class="dl-horizontal">
|
||||
<dt><?php echo $sprache->user;?></dt>
|
||||
<dd><?php echo $user;?></dd>
|
||||
<dt>TSDNS</dt>
|
||||
<dd><?php echo $tsdns;?></dd>
|
||||
<dt><?php echo $gsprache->jobPending;?></dt>
|
||||
<dd><?php echo $jobPending;?></dd>
|
||||
</dl>
|
||||
<?php }?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
|
||||
<form role="form" action="admin.php?w=vr&d=md&id=<?php echo $id;?>&r=vr" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="md">
|
||||
|
||||
<div class="box-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputExternalID">External ID</label>
|
||||
<div class="controls"><input class="form-control" id="inputExternalID" type="text" name="externalID" value="<?php echo $externalID;?>"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputUser"><?php echo $sprache->user;?></label>
|
||||
<div class="controls"><input class="form-control" id="inputUser" type="text" name="userName" value="<?php echo $userName;?>" disabled="disabled"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group<?php if(isset($errors['rootID'])) echo ' has-error';?>">
|
||||
<label for="inputRoot"><?php echo $sprache->rootserver;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control chosen-select" id="inputRoot" name="rootID">
|
||||
<?php foreach ($table2 as $key=>$val){ ?>
|
||||
<option value="<?php echo $key;?>" <?php if($key==$rootID) echo 'selected="selected"';?>><?php echo $val;?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rootWrapper">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputActive"><?php echo $sprache->active;?></label>
|
||||
<div class="controls">
|
||||
<select class="form-control" id="inputActive" name="active">
|
||||
<option value="Y"><?php echo $gsprache->yes;?></option>
|
||||
<option value="N" <?php if($active=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputIp"><?php echo $sprache->ip;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputIp" type="text" name="ip" value="<?php echo $ip;?>" maxlength="15">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort"><?php echo $sprache->port;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputPort" type="number" name="port" value="<?php echo $port;?>" maxlength="5" min="1" max="65535">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-footer">
|
||||
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="fa fa-save"> <?php echo $gsprache->save;?></i></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<form name="form" class="form-horizontal" action="admin.php?w=vr&d=md&id=<?php echo $id;?>&r=vr" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo token();?>">
|
||||
<input type="hidden" name="action" value="md">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputActive"><?php echo $sprache->active;?></label>
|
||||
<div class="controls">
|
||||
<select id="inputActive" name="active">
|
||||
<option value="Y"><?php echo $gsprache->yes;?></option>
|
||||
<option value="N" <?php if($active=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputExternalID"><?php echo $gsprache->externalID;?></label>
|
||||
<div class="controls"><input id="inputExternalID" type="text" name="externalID" value="<?php echo $externalID;?>" maxlength="255"></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputDns"><?php echo $sprache->dns;?></label>
|
||||
<div class="controls"><input id="inputDns" type="text" name="dns" value="<?php echo $dns;?>"></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputIp"><?php echo $sprache->ip;?></label>
|
||||
<div class="controls"><input id="inputIp" type="text" name="ip" maxlength="15" value="<?php echo $ip;?>"></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputPort"><?php echo $sprache->port;?></label>
|
||||
<div class="controls"><input id="inputPort" type="text" name="port" value="<?php echo $port;?>" maxlength="5"></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="inputEdit"></label>
|
||||
<div class="controls">
|
||||
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="icon-edit icon-white"></i> <?php echo $gsprache->save;?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#inputRoot").chosen({
|
||||
disable_search_threshold: 3,
|
||||
inherit_select_classes: true,
|
||||
no_results_text: '<?php echo $gsprache->chosenNoResult;?>',
|
||||
placeholder_text_single: '<?php echo $gsprache->chosenSelect;?>',
|
||||
placeholder_text_multiple: '<?php echo $gsprache->chosenSelect;?>',
|
||||
width: "100%"
|
||||
});
|
||||
|
||||
function loadRootDetails () {
|
||||
$.ajax({ url: 'ajax.php?d=tsdnsmasterusage&id=' + $("#inputRoot").val() + '&serverID=<?php echo $id;?>', cache: false } ).done(function(html) {
|
||||
$('#rootWrapper').html(html);
|
||||
});
|
||||
}
|
||||
|
||||
$('#inputRoot').on('change', function() {
|
||||
loadRootDetails();
|
||||
});
|
||||
|
||||
$(function(){
|
||||
loadRootDetails();
|
||||
});
|
||||
</script>
|
@ -12,7 +12,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php echo $gsprache->voice.' '.$gsprache->master;?> <a href="admin.php?w=vd&d=ad"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> <?php echo $gsprache->add;?></span></a>
|
||||
TSDNS <?php echo $gsprache->master;?> <a href="admin.php?w=vd&d=ad"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> <?php echo $gsprache->add;?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
<div id="portWrapper">
|
||||
<div class="form-group">
|
||||
<label for="inputPortMain"><?php echo $sprache->port;?> 1</label>
|
||||
<div class="controls"><input class="form-control" id="inputPortMain" type="number" name="port" value="<?php echo $port;?>" min="0"></div>
|
||||
<div class="controls"><input class="form-control" id="inputPortMain" type="number" name="port" value="<?php echo $port;?>" min="1" max="65535"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort2"><?php echo $sprache->port;?> 2</label>
|
||||
<div class="controls"><input class="form-control" id="inputPort2" type="number" name="port2" value="<?php echo $port2;?>"></div>
|
||||
<div class="controls"><input class="form-control" id="inputPort2" type="number" name="port2" value="<?php echo $port2;?>" min="1" max="65535"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort3"><?php echo $sprache->port;?> 3</label>
|
||||
<div class="controls"><input class="form-control" id="inputPort3" type="number" name="port3" value="<?php echo $port3;?>"></div>
|
||||
<div class="controls"><input class="form-control" id="inputPort3" type="number" name="port3" value="<?php echo $port3;?>" min="1" max="65535"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort4"><?php echo $sprache->port;?> 4</label>
|
||||
<div class="controls"><input class="form-control" id="inputPort4" type="number" name="port4" value="<?php echo $port4;?>"></div>
|
||||
<div class="controls"><input class="form-control" id="inputPort4" type="number" name="port4" value="<?php echo $port4;?>" min="1" max="65535"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputPort5"><?php echo $sprache->port;?> 5</label>
|
||||
<div class="controls"><input class="form-control" id="inputPort5" type="number" name="port5" value="<?php echo $port5;?>"></div>
|
||||
<div class="controls"><input class="form-control" id="inputPort5" type="number" name="port5" value="<?php echo $port5;?>" min="1" max="65535"></div>
|
||||
</div>
|
||||
</div>
|
13
web/template/default/ajax/ajax_admin_tsdns_server_usage.tpl
Normal file
13
web/template/default/ajax/ajax_admin_tsdns_server_usage.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
<div class="form-group">
|
||||
<label for="inputServerInstalled"><?php echo $sprache->installedserver;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputServerInstalled" type="text" name="serverInstalled" value="<?php echo $installedServer.'/'.$maxServer;?>" disabled="disabled">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="inputDns"><?php echo $sprache->dns;?></label>
|
||||
<div class="controls">
|
||||
<input class="form-control" id="inputDns" type="text" name="dns" value="<?php echo $dns;?>">
|
||||
</div>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user