Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('voicemail_greeting_edit')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //get greeting id if (isset($_REQUEST["id"])) { $voicemail_greeting_uuid = check_str($_REQUEST["id"]); } //get the form value and set to php variables $voicemail_id = check_str($_REQUEST["voicemail_id"]); if (count($_POST) > 0) { $greeting_name = check_str($_POST["greeting_name"]); $greeting_description = check_str($_POST["greeting_description"]); //clean the name $greeting_name = str_replace("'", "", $greeting_name); } if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //get greeting uuid to edit $voicemail_greeting_uuid = check_str($_POST["voicemail_greeting_uuid"]); //check for all required data $msg = ''; if (strlen($greeting_name) == 0) { $msg .= "".$text['confirm-name']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "resources/footer.php"; return; } //update the database if ($_POST["persistformvar"] != "true") { if (permission_exists('voicemail_greeting_edit')) { //update the database with the new data $sql = "update v_voicemail_greetings set "; $sql .= "greeting_name = '".$greeting_name."', "; $sql .= "greeting_description = '".$greeting_description."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and voicemail_greeting_uuid = '".$voicemail_greeting_uuid."' "; $db->exec(check_sql($sql)); unset($sql); //redirect the user messages::add($text['message-update']); header("Location: voicemail_greetings.php?id=".$voicemail_id); return; } //if (permission_exists('voicemail_greeting_edit')) { } //if ($_POST["persistformvar"] != "true") } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { $voicemail_greeting_uuid = check_str($_GET["id"]); $sql = "select * from v_voicemail_greetings "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and voicemail_greeting_uuid = '".$voicemail_greeting_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { $greeting_name = $row["greeting_name"]; $greeting_description = $row["greeting_description"]; break; //limit to 1 row } unset ($prep_statement); } //show the header $document['title'] = $text['label-edit']; require_once "resources/header.php"; //show the content echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " "; echo " \n"; echo "
\n"; echo "".$text['label-edit']."\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 "
\n"; echo " ".$text['label-name']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "".$text['description-name']."\n"; echo "
\n"; echo " ".$text['label-description']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "".$text['description-info']."\n"; echo "
\n"; echo " \n"; echo " \n"; echo "
"; echo " \n"; echo "
"; echo "

"; echo "
"; //include the footer require_once "resources/footer.php"; ?>