Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ require_once "root.php"; require_once "includes/require.php"; require_once "includes/checkauth.php"; if (permission_exists('domain_setting_add') || permission_exists('domain_setting_edit')) { //access granted } else { echo "access denied"; exit; } //action add or update if (isset($_REQUEST["id"])) { $action = "update"; $domain_setting_uuid = check_str($_REQUEST["id"]); } else { $action = "add"; } if (strlen($_GET["domain_uuid"]) > 0) { $domain_uuid = check_str($_GET["domain_uuid"]); } //get http post variables and set them to php variables if (count($_POST)>0) { $domain_setting_category = check_str($_POST["domain_setting_category"]); $domain_setting_subcategory = check_str($_POST["domain_setting_subcategory"]); $domain_setting_name = check_str($_POST["domain_setting_name"]); $domain_setting_value = check_str($_POST["domain_setting_value"]); $domain_setting_enabled = check_str($_POST["domain_setting_enabled"]); $domain_setting_description = check_str($_POST["domain_setting_description"]); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { $domain_setting_uuid = check_str($_POST["domain_setting_uuid"]); } //check for all required data //if (strlen($domain_uuid) == 0) { $msg .= "Please provide: domain_uuid
\n"; } //if (strlen($domain_setting_category) == 0) { $msg .= "Please provide: Category
\n"; } //if (strlen($domain_setting_subcategory) == 0) { $msg .= "Please provide: Subcategory
\n"; } //if (strlen($domain_setting_name) == 0) { $msg .= "Please provide: Type
\n"; } //if (strlen($domain_setting_value) == 0) { $msg .= "Please provide: Value
\n"; } //if (strlen($domain_setting_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } //if (strlen($domain_setting_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "includes/footer.php"; return; } //add or update the database if ($_POST["persistformvar"] != "true") { if ($action == "add" && permission_exists('domain_setting_add')) { $sql = "insert into v_domain_settings "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "domain_setting_uuid, "; $sql .= "domain_setting_category, "; $sql .= "domain_setting_subcategory, "; $sql .= "domain_setting_name, "; $sql .= "domain_setting_value, "; $sql .= "domain_setting_enabled, "; $sql .= "domain_setting_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'".uuid()."', "; $sql .= "'$domain_setting_category', "; $sql .= "'$domain_setting_subcategory', "; $sql .= "'$domain_setting_name', "; $sql .= "'$domain_setting_value', "; $sql .= "'$domain_setting_enabled', "; $sql .= "'$domain_setting_description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; require_once "includes/footer.php"; return; } //if ($action == "add") if ($action == "update" && permission_exists('domain_setting_edit')) { $sql = "update v_domain_settings set "; $sql .= "domain_setting_category = '$domain_setting_category', "; $sql .= "domain_setting_subcategory = '$domain_setting_subcategory', "; $sql .= "domain_setting_name = '$domain_setting_name', "; $sql .= "domain_setting_value = '$domain_setting_value', "; $sql .= "domain_setting_enabled = '$domain_setting_enabled', "; $sql .= "domain_setting_description = '$domain_setting_description' "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and domain_setting_uuid = '$domain_setting_uuid'"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; require_once "includes/footer.php"; return; } //if ($action == "update") } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $domain_setting_uuid = check_str($_GET["id"]); $sql = "select * from v_domain_settings "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and domain_setting_uuid = '$domain_setting_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $domain_setting_category = $row["domain_setting_category"]; $domain_setting_subcategory = $row["domain_setting_subcategory"]; $domain_setting_name = $row["domain_setting_name"]; $domain_setting_value = $row["domain_setting_value"]; $domain_setting_enabled = $row["domain_setting_enabled"]; $domain_setting_description = $row["domain_setting_description"]; break; //limit to 1 row } unset ($prep_statement); } //show the header require_once "includes/header.php"; //show the content echo "
"; echo "\n"; echo "\n"; echo " "; echo " "; echo "
\n"; echo "
"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; echo "
Domain Setting
\n"; echo "Settings used for each domain.

\n"; echo "
\n"; echo " Category:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the category.\n"; echo "
\n"; echo " Subcategory:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the subcategory.\n"; echo "
\n"; echo " Type:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the type.\n"; echo "
\n"; echo " Value:\n"; echo "\n"; $category = $row['domain_setting_category']; $subcategory = $row['domain_setting_subcategory']; $name = $row['domain_setting_name']; if ($category == "domain" && $subcategory == "menu" && $name == "uuid" ) { echo " \n"; } elseif ($category == "domain" && $subcategory == "template" && $name == "name" ) { echo " \n"; } elseif ($category == "domain" && $subcategory == "time" && $name == "zone" ) { echo " \n"; break; } elseif ($category == "email" && $subcategory == "smtp_password" && $name == "var" ) { echo " \n"; } elseif ($category == "provision" && $subcategory == "password" && $name == "var" ) { echo " \n"; } else { echo " \n"; } echo "
\n"; echo "Enter the value.\n"; echo "
\n"; echo " Enabled:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Choose to enable or disable the value.\n"; echo "
\n"; echo " Description:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the description.\n"; echo "
\n"; echo " \n"; if ($action == "update") { echo " \n"; } echo " \n"; echo "
"; echo ""; echo "
"; echo "
"; //include the footer require_once "includes/footer.php"; ?>