$reqdfieldsn = array(gettext("Old password"), gettext("Password"), gettext("Password (confirmed)"));
    $reqdfieldst = explode(" ", "password password password");
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
    // Validate old password.
    if ($_POST['password_old'] !== $a_user[$cnid]['password']) {
        $input_errors[] = gettext("The old password is not correct.");
    }
    // Validate new password.
    if ($_POST['password_new'] !== $_POST['password_confirm']) {
        $input_errors[] = gettext("The confimed password does not match. Please ensure the passwords match exactly.");
    }
    if (empty($input_errors)) {
        $a_user[$cnid]['password'] = $_POST['password_new'];
        write_config();
        updatenotify_set("userdb_user", UPDATENOTIFY_MODE_MODIFIED, $a_user[$cnid]['uuid']);
        // Write syslog entry and send an email to the administrator
        $message = sprintf("The user %s has changed his password via user portal.", Session::getUserName());
        write_log($message);
        if (0 == @email_validate_settings()) {
            $subject = sprintf(gettext("Notification email from host: %s"), system_get_hostname());
            @email_send($config['system']['email']['from'], $subject, $message, $error);
        }
        $savemsg = gettext("The administrator has been notified to apply your changes.");
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabcont">
        }
        header("Location: disks_raid_gvinum.php");
        exit;
    }
}
if (!is_array($config['gvinum']['vdisk'])) {
    $config['gvinum']['vdisk'] = array();
}
array_sort_key($config['gvinum']['vdisk'], "name");
$a_raid =& $config['gvinum']['vdisk'];
if ($_GET['act'] === "del") {
    unset($errormsg);
    if ($a_raid[$_GET['id']]) {
        // Check if disk is mounted.
        if (0 == disks_ismounted_ex($a_raid[$_GET['id']]['devicespecialfile'], "devicespecialfile")) {
            updatenotify_set("raid_gvinum", UPDATENOTIFY_MODE_DIRTY, $a_raid[$_GET['id']]['uuid']);
            header("Location: disks_raid_gvinum.php");
            exit;
        } else {
            $errormsg = sprintf(gettext("The RAID volume is currently mounted! Remove the <a href='%s'>mount point</a> first before proceeding."), "disks_mount.php");
        }
    }
}
function gvinum_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
            $retval |= disks_raid_gvinum_configure($data);
            break;
    do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
    if (empty($input_errors)) {
        $iscsiinit = array();
        $iscsiinit['uuid'] = $_POST['uuid'];
        $iscsiinit['name'] = $_POST['name'];
        $iscsiinit['targetname'] = $_POST['targetname'];
        $iscsiinit['targetaddress'] = $_POST['targetaddress'];
        $iscsiinit['initiatorname'] = $_POST['initiatorname'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_iscsiinit[$cnid] = $iscsiinit;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_iscsiinit[] = $iscsiinit;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("iscsiinitiator", $mode, $iscsiinit['uuid']);
        write_config();
        header("Location: disks_manage_iscsi.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td class="tabnavtbl">
      <ul id="tabnav">
      	<li class="tabinact"><a href="disks_manage.php"><span><?php 
echo gettext("Management");
?>
</span></a></li>
Example #4
0
    $savemsg = get_std_save_message($retval);
    if ($retval == 0) {
        updatenotify_delete("ftpd_mod_ban");
    }
}
if (!isset($config['ftpd']['mod_ban']['rule']) || !is_array($config['ftpd']['mod_ban']['rule'])) {
    $config['ftpd']['mod_ban']['rule'] = array();
}
$a_rule =& $config['ftpd']['mod_ban']['rule'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    if ($_GET['uuid'] === "all") {
        foreach ($a_rule as $rulek => $rulev) {
            updatenotify_set("ftpd_mod_ban", UPDATENOTIFY_MODE_DIRTY, $a_rule[$rulek]['uuid']);
        }
    } else {
        updatenotify_set("ftpd_mod_ban", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    }
    header("Location: services_ftp_mod.php");
    exit;
}
function ftpd_mod_ban_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            if (is_array($config['ftpd']['mod_ban']['rule'])) {
                $index = array_search_ex($data, $config['ftpd']['mod_ban']['rule'], "uuid");
Example #5
0
        }
    }
    if (empty($input_errors)) {
        $host = array();
        $host['uuid'] = $_POST['uuid'];
        $host['name'] = $_POST['name'];
        $host['address'] = $_POST['address'];
        $host['descr'] = $_POST['descr'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_hosts[$cnid] = $host;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_hosts[] = $host;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("hosts", $mode, $host['uuid']);
        write_config();
        header("Location: system_hosts.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="tabcont">
      <form action="system_hosts_edit.php" method="post" name="iform" id="iform">
      	<?php 
if (!empty($input_errors)) {
    print_input_errors($input_errors);
}
        $raid['type'] = 1;
        $raid['device'] = $_POST['device'];
        $raid['desc'] = "Software gmirror RAID 1";
        $raid['devicespecialfile'] = "/dev/mirror/{$raid['name']}";
        if (isset($id) && $a_raid[$id]) {
            $a_raid[$id] = $raid;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_raid[] = $raid;
            if ($_POST['init']) {
                $mode = UPDATENOTIFY_MODE_NEW;
            } else {
                $mode = UPDATENOTIFY_MODE_MODIFIED;
            }
        }
        updatenotify_set("raid_gmirror", $mode, $raid['uuid']);
        write_config();
        header("Location: disks_raid_gmirror.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
		<td class="tabnavtbl">
		  <ul id="tabnav">
				<li class="tabinact"><a href="disks_raid_gconcat.php"><span><?php 
echo gettext("JBOD");
?>
</span></a></li>
    }
    if (!$input_errors) {
        $route = array();
        $route['uuid'] = $_POST['uuid'];
        $route['interface'] = $_POST['interface'];
        $route['network'] = $osn;
        $route['gateway'] = $_POST['gateway'];
        $route['descr'] = $_POST['descr'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_routes[$cnid] = $route;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_routes[] = $route;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("routes", $mode, $route['uuid']);
        write_config();
        header("Location: system_routes.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="tabcont">
      <form action="system_routes_edit.php" method="post" name="iform" id="iform">
      	<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
    do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
    if (empty($input_errors)) {
        $param = array();
        $param['enable'] = isset($_POST['enable']) ? true : false;
        $param['uuid'] = $_POST['uuid'];
        $param['name'] = $pconfig['name'];
        $param['value'] = $pconfig['value'];
        $param['comment'] = $pconfig['comment'];
        if (isset($uuid) && FALSE !== $index) {
            $loader_param_list[$index] = $param;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $loader_param_list[] = $param;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("loaderconf", $mode, $param['uuid']);
        write_config();
        header("Location: system_loaderconf.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
    <td class="tabnavtbl">
      <ul id="tabnav">
      	<li class="tabinact"><a href="system_advanced.php"><span><?php 
echo gettext("Advanced");
?>
</span></a></li>
    }
    if ($_POST['disks_rescan']) {
        $do_action = true;
        $disks_rescan = true;
    }
}
if (!isset($do_action)) {
    $do_action = false;
}
if (!is_array($config['disks']['disk'])) {
    $config['disks']['disk'] = array();
}
array_sort_key($config['disks']['disk'], "name");
$a_disk_conf =& $config['disks']['disk'];
if ($_GET['act'] === "del") {
    updatenotify_set("device", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: disks_manage.php");
    exit;
}
function diskmanagement_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            if (is_array($config['disks']['disk'])) {
                $index = array_search_ex($data, $config['disks']['disk'], "uuid");
                if (false !== $index) {
                            $cfg['geli']['vdisk'][$index]['fstype'] = 'zfs';
                        }
                    }
                }
            }
        }
        if (isset($_GET['zfs']['autosnapshots'])) {
            $pconfig['zfs']['autosnapshots'] = $_GET['zfs']['autosnapshots'];
        }
        if (isset($_POST['leave_autosnapshots'])) {
            $cfg['zfs']['autosnapshots'] = !empty($config['zfs']['autosnapshots']) ? $config['zfs']['autosnapshots'] : array();
        }
        $config['zfs'] = $cfg['zfs'];
        $config['disks'] = $cfg['disks'];
        $config['geli'] = $cfg['geli'];
        updatenotify_set('zfs_import_config', UPDATENOTIFY_MODE_UNKNOWN, true);
        write_config();
        header('Location: disks_zfs_config_current.php');
        exit;
    }
}
$health = true;
if (!empty($zfs['extra']) && !empty($zfs['extra']['pools']) && !empty($zfs['extra']['pools']['pool'])) {
    $health &= (bool) (!array_search_ex('DEGRADED', $zfs['extra']['pools']['pool'], 'health'));
    $health &= (bool) (!array_search_ex('FAULTED', $zfs['extra']['pools']['pool'], 'health'));
}
if (!$health) {
    $message_box_type = 'warning';
    $message_box_text = gettext('Your ZFS system is not healthy.');
    $message_box_text .= ' ';
    $message_box_text .= gettext('It is not recommanded to import non healthy pools nor virtual devices that are part of a non healthy pool.');
        }
    }
    if (empty($input_errors)) {
        $iscsitarget_ag = array();
        $iscsitarget_ag['uuid'] = $_POST['uuid'];
        $iscsitarget_ag['tag'] = $_POST['tag'];
        $iscsitarget_ag['comment'] = $_POST['comment'];
        $iscsitarget_ag['agauth'] = $auths;
        if (isset($uuid) && FALSE !== $cnid) {
            $a_iscsitarget_ag[$cnid] = $iscsitarget_ag;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_iscsitarget_ag[] = $iscsitarget_ag;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("iscsitarget_ag", $mode, $iscsitarget_ag['uuid']);
        write_config();
        header("Location: services_iscsitarget_ag.php");
        exit;
    }
}
function expand_ipv6addr($v6addr)
{
    if (strlen($v6addr) == 0) {
        return null;
    }
    $v6str = $v6addr;
    // IPv4 mapped address
    $pos = strpos($v6str, ".");
    if ($pos !== false) {
        $pos = strrpos($v6str, ":");
    if (empty($input_errors)) {
        $vdevice = array();
        $vdevice['uuid'] = $_POST['uuid'];
        $vdevice['name'] = $_POST['name'];
        $vdevice['type'] = $_POST['type'];
        $vdevice['device'] = $_POST['device'];
        $vdevice['aft4k'] = isset($_POST['aft4k']);
        $vdevice['desc'] = $_POST['desc'];
        if (isset($uuid) && FALSE !== $cnid) {
            $mode = UPDATENOTIFY_MODE_MODIFIED;
            $a_vdevice[$cnid] = $vdevice;
        } else {
            $mode = UPDATENOTIFY_MODE_NEW;
            $a_vdevice[] = $vdevice;
        }
        updatenotify_set("zfsvdev", $mode, $vdevice['uuid']);
        write_config();
        header("Location: disks_zfs_zpool_vdevice.php");
        exit;
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	document.iform.name.disabled = !enable_change;
	document.iform.type.disabled = !enable_change;
	document.iform.device.disabled = !enable_change;
	document.iform.aft4k.disabled = !enable_change;
}
            }
        }
    }
}
if (!is_array($config['system']['firewall']['rule'])) {
    $config['system']['firewall']['rule'] = array();
}
array_sort_key($config['system']['firewall']['rule'], "ruleno");
$a_rule =& $config['system']['firewall']['rule'];
if ($_GET['act'] === "del") {
    if ($_GET['uuid'] === "all") {
        foreach ($a_rule as $rulek => $rulev) {
            updatenotify_set("firewall", UPDATENOTIFY_MODE_DIRTY, $a_rule[$rulek]['uuid']);
        }
    } else {
        updatenotify_set("firewall", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    }
    header("Location: system_firewall.php");
    exit;
}
function firewall_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['system']['firewall']['rule'], "uuid");
            if (false !== $cnid) {
Example #14
0
        }
    }
}
if (!isset($config['system']['hosts']) || !is_array($config['system']['hosts'])) {
    $config['system']['hosts'] = array();
}
if (!isset($config['system']['hostsacl']['rule']) || !is_array($config['system']['hostsacl']['rule'])) {
    $config['system']['hostsacl']['rule'] = array();
}
array_sort_key($config['system']['hosts'], "name");
$a_hosts = $config['system']['hosts'];
if (is_array($config['system']['hostsacl']['rule'])) {
    $pconfig['hostsacl'] = implode("\n", $config['system']['hostsacl']['rule']);
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("hosts", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: system_hosts.php");
    exit;
}
function hosts_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['system']['hosts'], "uuid");
            if (FALSE !== $cnid) {
                unset($config['system']['hosts'][$cnid]);
        $pooldata['uuid'] = $_POST['uuid'];
        $pooldata['name'] = $_POST['name'];
        $pooldata['vdevice'] = $_POST['vdevice'];
        $pooldata['root'] = $_POST['root'];
        $pooldata['mountpoint'] = $_POST['mountpoint'];
        $pooldata['force'] = isset($_POST['force']) ? true : false;
        $pooldata['hastpool'] = !empty($hastpool) ? true : false;
        $pooldata['desc'] = $_POST['desc'];
        if (isset($uuid) && FALSE !== $cnid) {
            $mode = UPDATENOTIFY_MODE_MODIFIED;
            $a_pool[$cnid] = $pooldata;
        } else {
            $mode = UPDATENOTIFY_MODE_NEW;
            $a_pool[] = $pooldata;
        }
        updatenotify_set("zfszpool", $mode, $pooldata['uuid']);
        write_config();
        header("Location: disks_zfs_zpool.php");
        exit;
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	document.iform.name.disabled = !enable_change;
	document.iform.vdevice.disabled = !enable_change;
	document.iform.root.disabled = !enable_change;
	//document.iform.mountpoint.disabled = !enable_change;
	document.iform.force.disabled = !enable_change;
Example #16
0
    do_input_validation_type($_POST, $reqdfields, $reqdfieldsn, $reqdfieldst, $input_errors);
    if (empty($input_errors)) {
        $param = array();
        $param['enable'] = isset($_POST['enable']) ? true : false;
        $param['uuid'] = $_POST['uuid'];
        $param['name'] = $pconfig['name'];
        $param['value'] = $pconfig['value'];
        $param['comment'] = $pconfig['comment'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_rcvar[$cnid] = $param;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_rcvar[] = $param;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("rcconf", $mode, $param['uuid']);
        write_config();
        header("Location: system_rcconf.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
    <td class="tabnavtbl">
      <ul id="tabnav">
      	<li class="tabinact"><a href="system_advanced.php"><span><?php 
echo gettext("Advanced");
?>
</span></a></li>
        $selftest['day'] = !empty($_POST['day']) ? $_POST['day'] : null;
        $selftest['month'] = !empty($_POST['month']) ? $_POST['month'] : null;
        $selftest['weekday'] = !empty($_POST['weekday']) ? $_POST['weekday'] : null;
        $selftest['all_hours'] = $_POST['all_hours'];
        $selftest['all_days'] = $_POST['all_days'];
        $selftest['all_months'] = $_POST['all_months'];
        $selftest['all_weekdays'] = $_POST['all_weekdays'];
        $selftest['desc'] = $_POST['desc'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_selftest[$cnid] = $selftest;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_selftest[] = $selftest;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("smartssd", $mode, $selftest['uuid']);
        write_config();
        header("Location: disks_manage_smart.php");
        exit;
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function set_selected(name) {
	document.getElementsByName(name)[1].checked = true;
}

function enable_change(enable_change) {
	document.iform.disk.disabled = !enable_change;
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("rsyncd");
        }
    }
}
if (!isset($config['rsyncd']['module']) || !is_array($config['rsyncd']['module'])) {
    $config['rsyncd']['module'] = array();
}
array_sort_key($config['rsyncd']['module'], "name");
$a_module =& $config['rsyncd']['module'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("rsyncd", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: services_rsyncd_module.php");
    exit;
}
function rsyncd_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['rsyncd']['module'], "uuid");
            if (FALSE !== $cnid) {
                unset($config['rsyncd']['module'][$cnid]);
Example #19
0
        $disks['controller'] = $a_phy_disk[$devname]['controller'];
        $disks['controller_id'] = $a_phy_disk[$devname]['controller_id'];
        $disks['controller_desc'] = $a_phy_disk[$devname]['controller_desc'];
        $disks['smart']['devicefilepath'] = $a_phy_disk[$devname]['smart']['devicefilepath'];
        $disks['smart']['devicetype'] = $a_phy_disk[$devname]['smart']['devicetype'];
        $disks['smart']['devicetypearg'] = $a_phy_disk[$devname]['smart']['devicetypearg'];
        $disks['smart']['enable'] = isset($_POST['smart_enable']) ? true : false;
        $disks['smart']['extraoptions'] = $_POST['smart_extraoptions'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_disk[$cnid] = $disks;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_disk[] = $disks;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("device", $mode, $disks['uuid']);
        write_config();
        header("Location: disks_manage.php");
        exit;
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	document.iform.name.disabled = !enable_change;
	document.iform.fstype.disabled = !enable_change;
}

function smart_enable_change() {
        $rule['src'] = $_POST['src'];
        $rule['srcport'] = $_POST['srcport'];
        $rule['dst'] = $_POST['dst'];
        $rule['dstport'] = $_POST['dstport'];
        $rule['direction'] = $_POST['direction'];
        $rule['if'] = $_POST['if'];
        $rule['extraoptions'] = $_POST['extraoptions'];
        $rule['desc'] = $_POST['desc'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_rule[$cnid] = $rule;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_rule[] = $rule;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("firewall", $mode, $rule['uuid']);
        write_config();
        header("Location: system_firewall.php");
        exit;
    }
}
// Get next rule number.
function get_next_rulenumber()
{
    global $config;
    // Set starting rule number
    $ruleno = 100;
    $a_rules = $config['system']['firewall']['rule'];
    if (false !== array_search_ex(strval($ruleno), $a_rules, "ruleno")) {
        do {
            $ruleno += 100;
Example #21
0
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("afpshare");
        }
    }
}
if (!isset($config['afp']['share']) || !is_array($config['afp']['share'])) {
    $config['afp']['share'] = array();
}
array_sort_key($config['afp']['share'], "name");
$a_share =& $config['afp']['share'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("afpshare", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: services_afp_share.php");
    exit;
}
function afpshare_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['afp']['share'], "uuid");
            if (FALSE !== $cnid) {
                unset($config['afp']['share'][$cnid]);
    if ($_POST['apply']) {
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            updatenotify_process("zfszpool", "zfszpool_process_updatenotification");
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("zfszpool");
        }
        header("Location: disks_zfs_zpool.php");
        exit;
    }
}
if ($_GET['act'] === "del") {
    updatenotify_set("zfszpool", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: disks_zfs_zpool.php");
    exit;
}
function zfszpool_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
            $retval = zfs_zpool_configure($data);
            break;
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['zfs']['pools']['pool'], "uuid");
if (isset($_GET['act']) && $_GET['act'] === "del") {
    $index = array_search_ex($_GET['uuid'], $config['iscsitarget']['initiatorgroup'], "uuid");
    if ($index !== false) {
        $ig = $config['iscsitarget']['initiatorgroup'][$index];
        foreach ($config['iscsitarget']['target'] as $target) {
            if (isset($target['pgigmap'])) {
                foreach ($target['pgigmap'] as $pgigmap) {
                    if ($pgigmap['igtag'] == $ig['tag']) {
                        $input_errors[] = gettext("This tag is used.");
                    }
                }
            }
        }
    }
    if (empty($input_errors)) {
        updatenotify_set("iscsitarget_ig", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
        header("Location: services_iscsitarget_ig.php");
        exit;
    }
}
function iscsitargetig_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['iscsitarget']['initiatorgroup'], "uuid");
            if (FALSE !== $cnid) {
                unset($config['iscsitarget']['initiatorgroup'][$cnid]);
                write_config();
            }
Example #24
0
            $retval |= rc_update_service("unison");
            $retval |= rc_update_service("iscsi_target");
            $retval |= rc_update_service("bsnmpd");
            $retval |= rc_update_service("nut");
            $retval |= rc_update_service("nut_upslog");
            $retval |= rc_update_service("nut_upsmon");
            $retval |= rc_update_service("mdnsresponder");
            config_unlock();
        } else {
            write_config();
        }
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= rc_update_service("hastd");
            if (false !== $mode) {
                updatenotify_set("cronjob", $mode, $cronjob['uuid']);
                $retval_cron |= rc_update_service("cron");
            }
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval_cron == 0) {
            updatenotify_delete("cronjob");
        }
    }
}
include "fbegin.inc";
?>
<script type="text/javascript">//<![CDATA[
$(document).ready(function(){
	function enable_change(enable_change) {
        $input_errors[] = gettext("The unique group ID is already used.");
    }
    if (empty($input_errors)) {
        $groups = array();
        $groups['uuid'] = $_POST['uuid'];
        $groups['id'] = $_POST['groupid'];
        $groups['name'] = $_POST['name'];
        $groups['desc'] = $_POST['desc'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_group[$cnid] = $groups;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_group[] = $groups;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("userdb_group", $mode, $groups['uuid']);
        write_config();
        header("Location: access_users_groups.php");
        exit;
    }
}
// Get next group id.
// Return next free user id.
function get_nextgroup_id()
{
    global $config;
    // Get next free user id.
    exec("/usr/sbin/pw groupnext", $output);
    $output = explode(":", $output[0]);
    $id = intval($output[0]);
    // Check if id is already in usage. If the user did not press the 'Apply'
        $rsyncclient['options']['compress'] = $_POST['compress'] ? true : false;
        $rsyncclient['options']['archive'] = $_POST['archive'] ? true : false;
        $rsyncclient['options']['delete'] = $_POST['delete'] ? true : false;
        $rsyncclient['options']['delete_algorithm'] = $_POST['delete_algorithm'];
        $rsyncclient['options']['quiet'] = $_POST['quiet'] ? true : false;
        $rsyncclient['options']['perms'] = $_POST['perms'] ? true : false;
        $rsyncclient['options']['xattrs'] = $_POST['xattrs'] ? true : false;
        $rsyncclient['options']['extraoptions'] = $_POST['extraoptions'];
        if (isset($uuid) && FALSE !== $cnid) {
            $a_rsyncclient[$cnid] = $rsyncclient;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_rsyncclient[] = $rsyncclient;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("rsyncclient", $mode, $rsyncclient['uuid']);
        write_config();
        if (stristr($_POST['Submit'], gettext("Execute now"))) {
            $retval = 0;
            // Update scripts and execute it.
            config_lock();
            $retval |= rc_exec_service("rsync_client");
            $retval |= rc_exec_script("/var/run/rsync_client_{$rsyncclient['uuid']}.sh");
            config_unlock();
            $savemsg = get_std_save_message($retval);
        } else {
            header("Location: services_rsyncd_client.php");
            exit;
        }
    }
}
Example #27
0
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            $retval |= updatenotify_process("websrvauth", "websrvauth_process_updatenotification");
            config_lock();
            $retval |= rc_exec_service("websrv_htpasswd");
            $retval |= rc_update_service("websrv");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if (0 == $retval) {
            updatenotify_delete("websrvauth");
        }
    }
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("websrvauth", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: services_websrv.php");
    exit;
}
function websrvauth_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            $cnid = array_search_ex($data, $config['websrv']['authentication']['url'], "uuid");
            if (FALSE !== $cnid) {
                unset($config['websrv']['authentication']['url'][$cnid]);
        $raid['type'] = 0;
        $raid['device'] = $_POST['device'];
        $raid['desc'] = "Software gstripe RAID 0";
        $raid['devicespecialfile'] = "/dev/stripe/{$raid['name']}";
        if (isset($id) && $a_raid[$id]) {
            $a_raid[$id] = $raid;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_raid[] = $raid;
            if (isset($_POST['init'])) {
                $mode = UPDATENOTIFY_MODE_NEW;
            } else {
                $mode = UPDATENOTIFY_MODE_MODIFIED;
            }
        }
        updatenotify_set("raid_gstripe", $mode, $raid['uuid']);
        write_config();
        header("Location: disks_raid_gstripe.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
		<td class="tabnavtbl">
		  <ul id="tabnav">
				<li class="tabinact"><a href="disks_raid_gconcat.php"><span><?php 
echo gettext("JBOD");
?>
</span></a></li>
        $resource['bremoteaddr'] = $_POST['bremoteaddr'];
        unset($resource['auxparam']);
        foreach (explode("\n", $_POST['auxparam']) as $auxparam) {
            $auxparam = trim($auxparam, "\t\n\r");
            if (!empty($auxparam)) {
                $resource['auxparam'][] = $auxparam;
            }
        }
        if (isset($uuid) && FALSE !== $cnid) {
            $a_resource[$cnid] = $resource;
            $mode = UPDATENOTIFY_MODE_MODIFIED;
        } else {
            $a_resource[] = $resource;
            $mode = UPDATENOTIFY_MODE_NEW;
        }
        updatenotify_set("hastresource", $mode, $resource['uuid']);
        write_config();
        header("Location: services_hast_resource.php");
        exit;
    }
}
include "fbegin.inc";
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="tabnavtbl">
      <ul id="tabnav">
	<li class="tabinact"><a href="services_hast.php"><span><?php 
echo gettext("Settings");
?>
</span></a></li>
Example #30
0
            config_lock();
            $retval |= rc_update_service("cron");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
        if ($retval == 0) {
            updatenotify_delete("cronjob");
        }
    }
}
if (!isset($config['cron']['job']) || !is_array($config['cron']['job'])) {
    $config['cron']['job'] = array();
}
$a_cron =& $config['cron']['job'];
if (isset($_GET['act']) && $_GET['act'] === "del") {
    updatenotify_set("cronjob", UPDATENOTIFY_MODE_DIRTY, $_GET['uuid']);
    header("Location: system_cron.php");
    exit;
}
function cronjob_process_updatenotification($mode, $data)
{
    global $config;
    $retval = 0;
    switch ($mode) {
        case UPDATENOTIFY_MODE_NEW:
        case UPDATENOTIFY_MODE_MODIFIED:
            break;
        case UPDATENOTIFY_MODE_DIRTY:
            if (is_array($config['cron']['job'])) {
                $index = array_search_ex($data, $config['cron']['job'], "uuid");
                if (false !== $index) {