예제 #1
0
파일: system.php 프로젝트: sdoney/nas4free
 }
 if ($oldwebguihostsallow != $config['system']['webgui']['hostsallow']) {
     // XXX shoud be fixed for more better way
     touch($d_sysrebootreqd_path);
 }
 if ($config['system']['webgui']['certificate'] != $oldcert || $config['system']['webgui']['privatekey'] != $oldkey) {
     touch($d_sysrebootreqd_path);
 }
 $retval = 0;
 if (!file_exists($d_sysrebootreqd_path)) {
     config_lock();
     $retval |= rc_exec_service("rcconf");
     $retval |= rc_exec_service("timezone");
     $retval |= rc_exec_service("resolv");
     $retval |= rc_exec_service("hosts");
     $retval |= rc_restart_service("hostname");
     $retval |= rc_exec_service("userdb");
     $retval |= rc_exec_service("htpasswd");
     $retval |= rc_exec_service("websrv_htpasswd");
     $retval |= rc_update_service("ntpdate");
     $retval |= rc_update_service("mdnsresponder");
     $retval |= rc_update_service("bsnmpd");
     $retval |= rc_update_service("cron");
     config_unlock();
 }
 if ($pconfig['systime'] !== "Not Set" && !empty($pconfig['systime'])) {
     $timestamp = strtotime($pconfig['systime']);
     if (FALSE !== $timestamp) {
         $timestamp = strftime("%g%m%d%H%M", $timestamp);
         // The date utility exits 0 on success, 1 if unable to set the date,
         // and 2 if able to set the local date, but unable to set it globally.
        $config['syslogd']['reverse'] = $_POST['reverse'] ? true : false;
        $config['syslogd']['nentries'] = (int) $_POST['nentries'];
        $config['syslogd']['resolve'] = $_POST['resolve'] ? true : false;
        $config['syslogd']['remote']['enable'] = $_POST['enable'] ? true : false;
        $config['syslogd']['remote']['ipaddr'] = $_POST['ipaddr'];
        $config['syslogd']['remote']['system'] = $_POST['system'] ? true : false;
        $config['syslogd']['remote']['ftp'] = $_POST['ftp'] ? true : false;
        $config['syslogd']['remote']['rsyncd'] = $_POST['rsyncd'] ? true : false;
        $config['syslogd']['remote']['sshd'] = $_POST['sshd'] ? true : false;
        $config['syslogd']['remote']['smartd'] = $_POST['smartd'] ? true : false;
        $config['syslogd']['remote']['daemon'] = $_POST['daemon'] ? true : false;
        write_config();
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval = rc_restart_service("syslogd");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	var endis = !(document.iform.enable.checked || enable_change);
	document.iform.ipaddr.disabled = endis;
	document.iform.sshd.disabled = endis;
	document.iform.system.disabled = endis;
	document.iform.ftp.disabled = endis;
                rc_update_rcconf("dnsmasq", "enable");
                rc_restart_service("dnsmasq");
            } else {
                $savemsg = "";
                $warnmess = "";
                rc_stop_service("dnsmasq");
            }
        }
    }
    if (isset($_POST['apply']) && $_POST['apply'] === "Apply changes") {
        $savemsg = "";
        $warnmess = "";
        dnsmasq_config();
        if (isset($config['dnsmasq']['enable'])) {
            rc_update_rcconf("dnsmasq", "enable");
            rc_restart_service("dnsmasq");
        } else {
            rc_stop_service("dnsmasq");
            rc_update_rcconf("dnsmasq", "disable");
        }
        unlink("/var/run/dnsmasq.reload");
    }
}
$pconfig['enable'] = isset($config['dnsmasq']['enable']) ? true : false;
$pconfig['extconfig'] = isset($config['dnsmasq']['extconfig']) ? true : false;
$pconfig['logging'] = $config['dnsmasq']['logging'];
$pconfig['noresolv'] = isset($config['dnsmasq']['noresolv']) ? true : false;
$pconfig['startadr'] = $config['dnsmasq']['startadr'];
$pconfig['endadr'] = $config['dnsmasq']['endadr'];
$pconfig['leasecount'] = $config['dnsmasq']['leasecount'];
//$pconfig['leasetime'] = $config['dnsmasq']['leasetime'];