function domain_list($tmp, $page) { $domains_a =& Domain::getAllDomains(); $domains = array(); foreach ($domains_a as $domain) { $domains[] = array('id' => $domain->getId(), 'dname' => $domain->getName(), 'sname' => $domain->getServerName(), 'sip' => $domain->getServerIP(), 'sport' => $domain->getServerPort(), 'sadmin' => $domain->getServerAdmin(), 'salias' => $domain->getAlias(), 'isactive' => $domain->isActive()); } $tmp->assign('data', $domains); $tmp->assign('tab_page', $page); }
function wb_manage($tmp, $page, $TABLE) { global $RS; $manage[] = array_values($RS['LIST_MANAGEMENT_TYPE']); $manages = array_shift($manage); $mchoise = null; if ($_POST['mchoise']) { $mchoise = $_POST['mchoise']; } $db = new DBConnection(); if ($mchoise) { $db->addManagements($mchoise); } $mvalues = $db->getAllManagements(); if ($mvalues) { $mkeys = array_keys($mvalues); } foreach ($manages as $key => $value) { if ($key) { if ($mkeys) { if (in_array($key, $mkeys)) { $checked[] = $key; } } $mvalues[$key] ? $m = $mvalues[$key] : ($m = '0000-00-00 00:00:00'); $checkbox[$key] = "<b>{$value}</b> (<i>{$m}</i>)"; } } $file = "webekci_conf"; if (is_dir("{$file}")) { //chown($file, 'apache'); //chgrp($file, 'apache'); deleteDirectory("{$file}"); mkdir("{$file}"); // if(is_array($mvalues)) { $mkeys = array_keys($mvalues); foreach ($mkeys as $m) { if ($m == 1) { mkdir("{$file}/virtualhosts"); $domains_a =& Domain::getAllDomains(); $domains = array(); foreach ($domains_a as $domain) { $vhost_file_name = $domain->getServerName(); $vhost_info = null; $vhost_file = fopen("{$file}/virtualhosts/{$vhost_file_name}", "w+"); if ($domain->getServerIP() && $domain->getServerPort() && $domain->getServerName()) { $vhost_info .= '<VirtualHost ' . $domain->getServerIP() . ':' . $domain->getServerPort() . '>' . "\n"; $vhost_info .= 'ServerName ' . $domain->getServerName() . "\n"; if ($domain->getAlias()) { $vhost_info .= 'ServerAlias ' . $domain->getAlias() . "\n"; } if ($domain->getServerAdmin()) { $vhost_info .= 'ServerAdmin ' . $domain->getServerIP() . "\n"; } $vhost_info .= $domain->getOther() . "\n"; if ($domain->getModSecConf()) { $vhost_info .= 'Include ../modsecurityconfs/' . $domain->getModSecConfName() . ".conf\n"; } $vhost_info .= '</VirtualHost>' . "\n"; fwrite($vhost_file, $vhost_info); } fclose($vhost_file); } } if ($m == 2) { mkdir("{$file}/modsecurityconfs"); } if ($m == 3) { mkdir("{$file}/rules"); } if ($m == 4) { mkdir("{$file}/whitelists"); } } } else { print "no dir (webekci_conf)"; } $tmp->assign('wb_list', $checkbox); $tmp->assign('selected_wb', $checked); $tmp->assign('tab_page', $page); }