forgot one query in admin_index; converted admin_ipsandports to new pdo database class
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -76,8 +76,15 @@ if ($page == 'overview') {
|
||||
|
||||
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||
$overview['diskspace_used'] = round($overview['diskspace_used'] / 1024, $settings['panel']['decimal_places']);
|
||||
$number_domains = $db->query_first("SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = '" . (int)$userinfo['adminid'] . "' "));
|
||||
|
||||
$number_domains_stmt = Database::prepare("
|
||||
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
|
||||
);
|
||||
Database::pexecute($number_domains_stmt, array('adminid' => $userinfo['adminid']));
|
||||
$number_domains = $number_domains_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$overview['number_domains'] = $number_domains['number_domains'];
|
||||
|
||||
$phpversion = phpversion();
|
||||
$phpmemorylimit = @ini_get("memory_limit");
|
||||
|
||||
|
||||
@@ -22,23 +22,20 @@ define('AREA', 'admin');
|
||||
/**
|
||||
* Include our init.php, which manages Sessions, Language etc.
|
||||
*/
|
||||
|
||||
require ("./lib/init.php");
|
||||
|
||||
if(isset($_POST['id']))
|
||||
{
|
||||
if (isset($_POST['id'])) {
|
||||
$id = intval($_POST['id']);
|
||||
}
|
||||
elseif(isset($_GET['id']))
|
||||
{
|
||||
} elseif(isset($_GET['id'])) {
|
||||
$id = intval($_GET['id']);
|
||||
}
|
||||
|
||||
if($page == 'ipsandports'
|
||||
|| $page == 'overview')
|
||||
{
|
||||
if($action == '')
|
||||
{
|
||||
if ($page == 'ipsandports'
|
||||
|| $page == 'overview'
|
||||
) {
|
||||
|
||||
if ($action == '') {
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
|
||||
$fields = array(
|
||||
'ip' => $lng['admin']['ipsandports']['ip'],
|
||||
@@ -46,8 +43,9 @@ if($page == 'ipsandports'
|
||||
);
|
||||
$paging = new paging($userinfo, $db, TABLE_PANEL_IPSANDPORTS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']);
|
||||
$ipsandports = '';
|
||||
$result = $db->query("SELECT `id`, `ip`, `port`, `listen_statement`, `namevirtualhost_statement`, `vhostcontainer`, `vhostcontainer_servername_statement`, `specialsettings`, `ssl` FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
$paging->setEntries($db->num_rows($result));
|
||||
$result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $paging->getSqlWhere(false) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit());
|
||||
Database::pexecute($result_stmt);
|
||||
$paging->setEntries(Database::num_rows());
|
||||
$sortcode = $paging->getHtmlSortCode($lng);
|
||||
$arrowcode = $paging->getHtmlArrowCode($filename . '?page=' . $page . '&s=' . $s);
|
||||
$searchcode = $paging->getHtmlSearchCode($lng);
|
||||
@@ -55,92 +53,103 @@ if($page == 'ipsandports'
|
||||
$i = 0;
|
||||
$count = 0;
|
||||
|
||||
while($row = $db->fetch_array($result))
|
||||
{
|
||||
if($paging->checkDisplay($i))
|
||||
{
|
||||
$row = htmlentities_array($row);
|
||||
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
if ($paging->checkDisplay($i)) {
|
||||
$row = htmlentities_array($row);
|
||||
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$row['ip'] = '[' . $row['ip'] . ']';
|
||||
}
|
||||
|
||||
eval("\$ipsandports.=\"" . getTemplate("ipsandports/ipsandports_ipandport") . "\";");
|
||||
$count++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports") . "\";");
|
||||
}
|
||||
elseif($action == 'delete'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if(isset($result['id'])
|
||||
&& $result['id'] == $id)
|
||||
{
|
||||
$result_checkdomain = $db->query_first("SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports`='" . (int)$id . "'");
|
||||
} elseif($action == 'delete'
|
||||
&& $id != 0
|
||||
) {
|
||||
$result_stmt = Database::prepare("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id");
|
||||
Database::pexecute($result_stmt, array('id' => $id));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($result_checkdomain['id'] == '')
|
||||
{
|
||||
if($result['id'] != $settings['system']['defaultip'])
|
||||
{
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
if (isset($result['id'])
|
||||
&& $result['id'] == $id
|
||||
) {
|
||||
$result_checkdomain_stmt = Database::prepare("
|
||||
SELECT `id_domain` as `id` FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_ipandports` = :id"
|
||||
);
|
||||
Database::pexecute($result_checkdomain_stmt, array('id' => $id));
|
||||
$result_checkdomain = $result_checkdomain_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if(($result['ip'] != $settings['system']['ipaddress'])
|
||||
|| ($result['ip'] == $settings['system']['ipaddress'] && $result_sameipotherport['id'] != ''))
|
||||
{
|
||||
$result = $db->query_first("SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
if ($result_checkdomain['id'] == '') {
|
||||
if ($result['id'] != $settings['system']['defaultip']) {
|
||||
|
||||
if($result['ip'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
$db->query("DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
$result_sameipotherport_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `ip` = :ip AND `id` <> :id"
|
||||
);
|
||||
Database::pexecute($result_sameipotherport_stmt, array('id' => $id, 'ip' => $result['ip']));
|
||||
$result_sameipotherport = $result_sameipotherport_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (($result['ip'] != $settings['system']['ipaddress'])
|
||||
|| ($result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] != '')
|
||||
) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['ip'] != '') {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($del_stmt, array('id' => $id));
|
||||
|
||||
// also, remove connections to domains (multi-stack)
|
||||
$db->query("DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports`='".(int)$id."'");
|
||||
$del_stmt = Database::prepare("
|
||||
DELETE FROM `".TABLE_DOMAINTOIP."` WHERE `id_ipandports` = :id"
|
||||
);
|
||||
Database::pexecute($del_stmt, array('id' => $id));
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "deleted IP/port '" . $result['ip'] . ":" . $result['port'] . "'");
|
||||
inserttask('1');
|
||||
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
inserttask('4');
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
else
|
||||
{
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
|
||||
} else {
|
||||
ask_yesno('admin_ip_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $result['ip'] . ':' . $result['port']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
standard_error('cantdeletesystemip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
standard_error('cantdeletedefaultip');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
standard_error('ipstillhasdomains');
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif($action == 'add')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
|
||||
} elseif($action == 'add') {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
|
||||
$ip = validate_ip($_POST['ip']);
|
||||
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
|
||||
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0;
|
||||
@@ -150,8 +159,8 @@ if($page == 'ipsandports'
|
||||
$vhostcontainer_servername_statement = isset($_POST['vhostcontainer_servername_statement']) ? 1 : 0;
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
$docroot = validate($_POST['docroot'], 'docroot');
|
||||
if((int)$settings['system']['use_ssl'] == 1)
|
||||
{
|
||||
|
||||
if ((int)$settings['system']['use_ssl'] == 1) {
|
||||
$ssl = intval($_POST['ssl']);
|
||||
$ssl_cert_file = validate($_POST['ssl_cert_file'], 'ssl_cert_file');
|
||||
$ssl_key_file = validate($_POST['ssl_key_file'], 'ssl_key_file');
|
||||
@@ -164,110 +173,100 @@ if($page == 'ipsandports'
|
||||
$ssl_ca_file = '';
|
||||
$ssl_cert_chainfile = '';
|
||||
}
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
|
||||
if ($listen_statement != '1') {
|
||||
$listen_statement = '0';
|
||||
}
|
||||
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
if ($namevirtualhost_statement != '1') {
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
if ($vhostcontainer != '1') {
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
if ($vhostcontainer_servername_statement != '1') {
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
if($ssl != '1')
|
||||
{
|
||||
if ($ssl != '1') {
|
||||
$ssl = '0';
|
||||
}
|
||||
|
||||
if($ssl_cert_file != '')
|
||||
{
|
||||
|
||||
if ($ssl_cert_file != '') {
|
||||
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
|
||||
}
|
||||
|
||||
if($ssl_key_file != '')
|
||||
{
|
||||
if ($ssl_key_file != '') {
|
||||
$ssl_key_file = makeCorrectFile($ssl_key_file);
|
||||
}
|
||||
|
||||
if($ssl_ca_file != '')
|
||||
{
|
||||
if ($ssl_ca_file != '') {
|
||||
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
|
||||
}
|
||||
|
||||
if($ssl_cert_chainfile != '')
|
||||
{
|
||||
if ($ssl_cert_chainfile != '') {
|
||||
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
|
||||
}
|
||||
|
||||
if(strlen(trim($docroot)) > 0)
|
||||
{
|
||||
if (strlen(trim($docroot)) > 0) {
|
||||
$docroot = makeCorrectDir($docroot);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
$result_checkfordouble_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `ip` = :ip AND `port` = :port"
|
||||
);
|
||||
Database::pexecute($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
|
||||
$result_checkfordouble = $result_checkfordouble_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($result_checkfordouble['id'] != '')
|
||||
{
|
||||
if ($result_checkfordouble['id'] != '') {
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->query("INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
SET
|
||||
`ip` = '" . $db->escape($ip) . "',
|
||||
`port` = '" . (int)$port . "',
|
||||
`listen_statement` = '" . (int)$listen_statement . "',
|
||||
`namevirtualhost_statement` = '" . (int)$namevirtualhost_statement . "',
|
||||
`vhostcontainer` = '" . (int)$vhostcontainer . "',
|
||||
`vhostcontainer_servername_statement` = '" . (int)$vhostcontainer_servername_statement . "',
|
||||
`specialsettings` = '" . $db->escape($specialsettings) . "',
|
||||
`ssl` = '" . (int)$ssl . "',
|
||||
`ssl_cert_file` = '" . $db->escape($ssl_cert_file) . "',
|
||||
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
|
||||
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
|
||||
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
|
||||
`docroot` = '" . $db->escape($docroot) . "';
|
||||
");
|
||||
} else {
|
||||
$ins_stmt = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
SET
|
||||
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
|
||||
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
|
||||
`vhostcontainer_servername_statement` = :vhcss,
|
||||
`specialsettings` = :ss, `ssl` = :ssl,
|
||||
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
|
||||
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
|
||||
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot;
|
||||
");
|
||||
$ins_data = array(
|
||||
'ip' => $ip,
|
||||
'port' => $port,
|
||||
'ls' => $listen_statement,
|
||||
'nvhs' => $namevirtualhost_statement,
|
||||
'vhc' => $vhostcontainer,
|
||||
'vhcss' => $vhostcontainer_servername_statement,
|
||||
'ss' => $specialsettings,
|
||||
'ssl' => $ssl,
|
||||
'ssl_cert' => $ssl_cert_file,
|
||||
'ssl_key' => $ssl_key_file,
|
||||
'ssl_ca' => $ssl_ca_file,
|
||||
'ssl_chain' => $ssl_cert_chainfile,
|
||||
'dvhd' => $default_vhostconf_domain,
|
||||
'docroot' => $docroot
|
||||
);
|
||||
Database::pexecute($ins_stmt, $ins_data);
|
||||
|
||||
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
|
||||
{
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
|
||||
$ip = '[' . $ip . ']';
|
||||
}
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "added IP/port '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
|
||||
// Using nameserver, insert a task which rebuilds the server config
|
||||
inserttask('4');
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', '0');
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', '1');
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', '1');
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', '1');
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', '1');
|
||||
*/
|
||||
|
||||
} else {
|
||||
|
||||
$ipsandports_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
|
||||
$ipsandports_add_form = htmlform::genHTMLForm($ipsandports_add_data);
|
||||
@@ -277,21 +276,24 @@ if($page == 'ipsandports'
|
||||
|
||||
eval("echo \"" . getTemplate("ipsandports/ipsandports_add") . "\";");
|
||||
}
|
||||
}
|
||||
elseif($action == 'edit'
|
||||
&& $id != 0)
|
||||
{
|
||||
$result = $db->query_first("SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int)$id . "'");
|
||||
|
||||
if($result['ip'] != '')
|
||||
{
|
||||
if(isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send')
|
||||
{
|
||||
} elseif($action == 'edit'
|
||||
&& $id != 0
|
||||
) {
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT * FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :id"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result['ip'] != '') {
|
||||
|
||||
if (isset($_POST['send'])
|
||||
&& $_POST['send'] == 'send'
|
||||
) {
|
||||
|
||||
$ip = validate_ip($_POST['ip']);
|
||||
$port = validate($_POST['port'], 'port', '/^(([1-9])|([1-9][0-9])|([1-9][0-9][0-9])|([1-9][0-9][0-9][0-9])|([1-5][0-9][0-9][0-9][0-9])|(6[0-4][0-9][0-9][0-9])|(65[0-4][0-9][0-9])|(655[0-2][0-9])|(6553[0-5]))$/Di', array('stringisempty', 'myport'));
|
||||
$result_checkfordouble = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($ip) . "' AND `port`='" . (int)$port . "'");
|
||||
$result_sameipotherport = $db->query_first("SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ip`='" . $db->escape($result['ip']) . "' AND `id`!='" . (int)$id . "'");
|
||||
$listen_statement = isset($_POST['listen_statement']) ? 1 : 0;
|
||||
$namevirtualhost_statement = isset($_POST['namevirtualhost_statement']) ? 1 : 0;
|
||||
$vhostcontainer = isset($_POST['vhostcontainer']) ? 1 : 0;
|
||||
@@ -300,7 +302,21 @@ if($page == 'ipsandports'
|
||||
$default_vhostconf_domain = validate(str_replace("\r\n", "\n", $_POST['default_vhostconf_domain']), 'default_vhostconf_domain', '/^[^\0]*$/');
|
||||
$docroot = validate($_POST['docroot'], 'docroot');
|
||||
|
||||
if((int)$settings['system']['use_ssl'] == 1
|
||||
$result_checkfordouble_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `ip` = :ip AND `port` = :port"
|
||||
);
|
||||
Database::pexecute($result_checkfordouble_stmt, array('ip' => $ip, 'port' => $port));
|
||||
$result_checkfordouble = $result_checkfordouble_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$result_sameipotherport_stmt = Database::prepare("
|
||||
SELECT `id` FROM `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
WHERE `ip` = :ip AND `id` <> :id"
|
||||
);
|
||||
Database::pexecute($result_sameipotherport_stmt, array('ip' => $ip, 'id' => $id));
|
||||
$result_sameipotherport = $result_sameipotherport_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ((int)$settings['system']['use_ssl'] == 1
|
||||
/*
|
||||
* check here if ssl is even checked, cause if not, we don't need
|
||||
* to validate and set all the $ssl_*_file vars
|
||||
@@ -321,92 +337,91 @@ if($page == 'ipsandports'
|
||||
$ssl_cert_chainfile = '';
|
||||
}
|
||||
|
||||
if($listen_statement != '1')
|
||||
{
|
||||
if ($listen_statement != '1') {
|
||||
$listen_statement = '0';
|
||||
}
|
||||
|
||||
if($namevirtualhost_statement != '1')
|
||||
{
|
||||
if ($namevirtualhost_statement != '1') {
|
||||
$namevirtualhost_statement = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer != '1')
|
||||
{
|
||||
if ($vhostcontainer != '1') {
|
||||
$vhostcontainer = '0';
|
||||
}
|
||||
|
||||
if($vhostcontainer_servername_statement != '1')
|
||||
{
|
||||
if ($vhostcontainer_servername_statement != '1') {
|
||||
$vhostcontainer_servername_statement = '0';
|
||||
}
|
||||
|
||||
if($ssl != '1')
|
||||
{
|
||||
if ($ssl != '1') {
|
||||
$ssl = '0';
|
||||
}
|
||||
|
||||
if($ssl_cert_file != '')
|
||||
{
|
||||
if ($ssl_cert_file != '') {
|
||||
$ssl_cert_file = makeCorrectFile($ssl_cert_file);
|
||||
}
|
||||
|
||||
if($ssl_key_file != '')
|
||||
{
|
||||
if ($ssl_key_file != '') {
|
||||
$ssl_key_file = makeCorrectFile($ssl_key_file);
|
||||
}
|
||||
|
||||
if($ssl_ca_file != '')
|
||||
{
|
||||
if ($ssl_ca_file != '') {
|
||||
$ssl_ca_file = makeCorrectFile($ssl_ca_file);
|
||||
}
|
||||
|
||||
if($ssl_cert_chainfile != '')
|
||||
{
|
||||
if ($ssl_cert_chainfile != '') {
|
||||
$ssl_cert_chainfile = makeCorrectFile($ssl_cert_chainfile);
|
||||
}
|
||||
|
||||
if(strlen(trim($docroot)) > 0)
|
||||
{
|
||||
if (strlen(trim($docroot)) > 0) {
|
||||
$docroot = makeCorrectDir($docroot);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$docroot = '';
|
||||
}
|
||||
|
||||
if($result['ip'] != $ip
|
||||
&& $result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] == '')
|
||||
{
|
||||
if ($result['ip'] != $ip
|
||||
&& $result['ip'] == $settings['system']['ipaddress']
|
||||
&& $result_sameipotherport['id'] == ''
|
||||
) {
|
||||
standard_error('cantchangesystemip');
|
||||
}
|
||||
elseif($result_checkfordouble['id'] != ''
|
||||
&& $result_checkfordouble['id'] != $id)
|
||||
{
|
||||
standard_error('myipnotdouble');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$db->query("UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
SET
|
||||
`ip` = '" . $db->escape($ip) . "',
|
||||
`port` = '" . (int)$port . "',
|
||||
`listen_statement` = '" . (int)$listen_statement . "',
|
||||
`namevirtualhost_statement` = '" . (int)$namevirtualhost_statement . "',
|
||||
`vhostcontainer` = '" . (int)$vhostcontainer . "',
|
||||
`vhostcontainer_servername_statement` = '" . (int)$vhostcontainer_servername_statement . "',
|
||||
`specialsettings` = '" . $db->escape($specialsettings) . "',
|
||||
`ssl` = '" . (int)$ssl . "',
|
||||
`ssl_cert_file` = '" . $db->escape($ssl_cert_file) . "',
|
||||
`ssl_key_file` = '" . $db->escape($ssl_key_file) . "',
|
||||
`ssl_ca_file` = '" . $db->escape($ssl_ca_file) . "',
|
||||
`ssl_cert_chainfile` = '" . $db->escape($ssl_cert_chainfile) . "',
|
||||
`default_vhostconf_domain` = '" . $db->escape($default_vhostconf_domain) . "',
|
||||
`docroot` = '" . $db->escape($docroot) . "'
|
||||
WHERE `id`='" . (int)$id . "'
|
||||
} elseif($result_checkfordouble['id'] != ''
|
||||
&& $result_checkfordouble['id'] != $id
|
||||
) {
|
||||
standard_error('myipnotdouble');
|
||||
|
||||
} else {
|
||||
|
||||
$upd_stmt = Datbase::prepare("
|
||||
UPDATE `" . TABLE_PANEL_IPSANDPORTS . "`
|
||||
SET
|
||||
`ip` = :ip, `port` = :port, `listen_statement` = :ls,
|
||||
`namevirtualhost_statement` = :nvhs, `vhostcontainer` = :vhc,
|
||||
`vhostcontainer_servername_statement` = :vhcss,
|
||||
`specialsettings` = :ss, `ssl` = :ssl,
|
||||
`ssl_cert_file` = :ssl_cert, `ssl_key_file` = :ssl_key,
|
||||
`ssl_ca_file` = :ssl_ca, `ssl_cert_chainfile` = :ssl_chain,
|
||||
`default_vhostconf_domain` = :dvhd, `docroot` = :docroot
|
||||
WHERE `id` = :id;
|
||||
");
|
||||
$upd_data = array(
|
||||
'ip' => $ip,
|
||||
'port' => $port,
|
||||
'ls' => $listen_statement,
|
||||
'nvhs' => $namevirtualhost_statement,
|
||||
'vhc' => $vhostcontainer,
|
||||
'vhcss' => $vhostcontainer_servername_statement,
|
||||
'ss' => $specialsettings,
|
||||
'ssl' => $ssl,
|
||||
'ssl_cert' => $ssl_cert_file,
|
||||
'ssl_key' => $ssl_key_file,
|
||||
'ssl_ca' => $ssl_ca_file,
|
||||
'ssl_chain' => $ssl_cert_chainfile,
|
||||
'dvhd' => $default_vhostconf_domain,
|
||||
'docroot' => $docroot,
|
||||
'id' => $id
|
||||
);
|
||||
Database::pexecute($upd_stmt, $upd_data);
|
||||
|
||||
$log->logAction(ADM_ACTION, LOG_WARNING, "changed IP/port from '" . $result['ip'] . ":" . $result['port'] . "' to '" . $ip . ":" . $port . "'");
|
||||
inserttask('1');
|
||||
@@ -416,17 +431,10 @@ if($page == 'ipsandports'
|
||||
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
|
||||
$result = htmlentities_array($result);
|
||||
/*
|
||||
$enable_ssl = makeyesno('ssl', '1', '0', $result['ssl']);
|
||||
$listen_statement = makeyesno('listen_statement', '1', '0', $result['listen_statement']);
|
||||
$namevirtualhost_statement = makeyesno('namevirtualhost_statement', '1', '0', $result['namevirtualhost_statement']);
|
||||
$vhostcontainer = makeyesno('vhostcontainer', '1', '0', $result['vhostcontainer']);
|
||||
$vhostcontainer_servername_statement = makeyesno('vhostcontainer_servername_statement', '1', '0', $result['vhostcontainer_servername_statement']);
|
||||
*/
|
||||
|
||||
$ipsandports_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
|
||||
$ipsandports_edit_form = htmlform::genHTMLForm($ipsandports_edit_data);
|
||||
@@ -439,5 +447,3 @@ if($page == 'ipsandports'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user