<?php

require "../settings.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = write_setting();
            break;
        default:
            $OUTPUT = get_range();
    }
} else {
    $OUTPUT = get_range();
}
require "../template.php";
function get_range($err = "")
{
    $blocked_range_from = getCSetting("BLOCKED_FROM");
    $blocked_range_to = getCSetting("BLOCKED_TO");
    if (!isset($blocked_range_from) or strlen($blocked_range_from) < 1) {
        $blocked_range_from = date("Y-m-d");
    }
    if (!isset($blocked_range_to) or strlen($blocked_range_to) < 1) {
        $blocked_range_to = date("Y-m-d");
    }
    $from_arr = explode("-", $blocked_range_from);
    $to_arr = explode("-", $blocked_range_to);
    $from_year = $from_arr[0];
    $from_month = $from_arr[1];
    $from_day = $from_arr[2];
    $to_year = $to_arr[0];
<?php

require "../settings.php";
if (isset($_POST["key"])) {
    $OUTPUT = write_setting($_POST);
} else {
    $OUTPUT = get_show_setting();
}
$OUTPUT .= "<p>" . mkQuickLinks(ql("../email-queue-manage.php", "Manage Email Queue"), ql("../email-groups.php", "Send Email To Group"), ql("../email-group-new.php", "Add Email Group"), ql("../email-group-view.php", "View Email Groups"));
require "../template.php";
function get_show_setting($err = "")
{
    db_connect();
    $setting = getCSetting("MARKET_MAIL_FROM");
    if (!isset($setting) or strlen($setting) < 1) {
        $setting = "";
    }
    $display = "\n\t\t\t\t\t<h2>Change Email Marketing From Address</h2>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t\t{$err}\n\t\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Email Marketing From Address</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><input type='text' size='40' name='setting' value='{$setting}'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='right'><input type='submit' value='Confirm'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</form>\n\t\t\t\t\t</table>\n\t\t\t\t";
    return $display;
}
function write_setting($_POST)
{
    extract($_POST);
    if (!isset($setting) or strlen($setting) < 1) {
        $setting = "";
    }
    db_connect();
    #update setting
    $check = getCSetting("MARKET_MAIL_FROM");
    if (!isset($check) or strlen($check) < 1) {
        #no setting ... insert