if (!isset($uuid) && !sizeof($a_pool)) {
    $errormsg = sprintf(gettext("No configured pools. Please add new <a href='%s'>pools</a> first."), "disks_zfs_zpool.php");
}
$a_timehour = array();
foreach (range(0, 23) as $hour) {
    $min = 0;
    $a_timehour[sprintf("%02.2d%02.2d", $hour, $min)] = sprintf("%02.2d:%02.2d", $hour, $min);
}
$a_lifetime = array("0" => gettext("infinity"), "1w" => sprintf(gettext("%d week"), 1), "2w" => sprintf(gettext("%d weeks"), 2), "30d" => sprintf(gettext("%d days"), 30), "60d" => sprintf(gettext("%d days"), 60), "90d" => sprintf(gettext("%d days"), 90), "180d" => sprintf(gettext("%d days"), 180), "1y" => sprintf(gettext("%d year"), 1), "2y" => sprintf(gettext("%d years"), 2));
if ($_POST) {
    $pconfig = $_POST;
    if (isset($_POST['apply']) && $_POST['apply']) {
        $ret = array("output" => array(), "retval" => 0);
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            $ret = zfs_updatenotify_process("zfsautosnapshot", "zfsautosnapshot_process_updatenotification");
            config_lock();
            $ret['retval'] |= rc_update_service("autosnapshot");
            config_unlock();
        }
        $savemsg = get_std_save_message($ret['retval']);
        if ($ret['retval'] == 0) {
            updatenotify_delete("zfsautosnapshot");
            header("Location: disks_zfs_snapshot_auto.php");
            exit;
        }
        updatenotify_delete("zfsautosnapshot");
        $errormsg = implode("\n", $ret['output']);
    }
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
        $r['creation'] = $a[2];
        if ($r['origin'] == '-') {
            continue;
        }
        $result[] = $r;
    }
    return $result;
}
$a_clone = get_zfs_clones();
if ($_POST) {
    $pconfig = $_POST;
    if (isset($_POST['apply']) && $_POST['apply']) {
        $ret = array("output" => array(), "retval" => 0);
        if (!file_exists($d_sysrebootreqd_path)) {
            // Process notifications
            $ret = zfs_updatenotify_process("zfsclone", "zfsclone_process_updatenotification");
        }
        $savemsg = get_std_save_message($ret['retval']);
        if ($ret['retval'] == 0) {
            updatenotify_delete("zfsclone");
            header("Location: disks_zfs_snapshot_clone.php");
            exit;
        }
        updatenotify_delete("zfsclone");
        $errormsg = implode("\n", $ret['output']);
    }
}
if (isset($_GET['act']) && $_GET['act'] === "del") {
    $clone = array();
    $clone['path'] = $_GET['path'];
    updatenotify_set("zfsclone", UPDATENOTIFY_MODE_DIRTY, serialize($clone));