diff --git a/app/notifications/notification_edit.php b/app/notifications/notification_edit.php index 75d4c15786..7a126a9cf8 100644 --- a/app/notifications/notification_edit.php +++ b/app/notifications/notification_edit.php @@ -114,6 +114,7 @@ else { ($project_notification_method == 'email' && $project_notification_recipient == '') || ($project_notification_method == 'text' && $project_notification_recipient == '') )) { + $_SESSION["form"] = $_POST; $_SESSION["message"] = $text['message-invalid_recipient']; header("Location: notification_edit.php"); return; @@ -217,40 +218,50 @@ else { } -// check local project notification participation flag - $sql = "select project_notifications from v_notifications"; - $prep_statement = $db->prepare($sql); - if ($prep_statement) { - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { - $project_notifications = $row["project_notifications"]; - break; // limit to 1 row - } - } - unset($sql, $prep_statement); +// check post back session + if (!isset($_SESSION["form"])) { - // if participation enabled - if ($project_notifications == 'true') { - - // get current project notification preferences - $url = "https://".$software_url."/app/notifications/notifications_manage.php?id=".$software_uuid; - if (function_exists('curl_version')) { - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); - $response = curl_exec($curl); - curl_close($curl); - } - else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) { - $response = file_get_contents($url); + // check local project notification participation flag + $sql = "select project_notifications from v_notifications"; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + foreach ($result as &$row) { + $setting["project_notifications"] = $row["project_notifications"]; + break; // limit to 1 row + } } + unset($sql, $prep_statement); - // parse response - $setting = json_decode($response, true); + // if participation enabled + if ($setting["project_notifications"] == 'true') { + + // get current project notification preferences + $url = "https://".$software_url."/app/notifications/notifications_manage.php?id=".$software_uuid; + if (function_exists('curl_version')) { + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + $response = curl_exec($curl); + curl_close($curl); + } + else if (file_get_contents(__FILE__) && ini_get('allow_url_fopen')) { + $response = file_get_contents($url); + } + + // parse response + $setting = json_decode($response, true); + $setting["project_notifications"] = 'true'; + } } + else { + $setting = fix_postback($_SESSION["form"]); + unset($_SESSION["form"]); + + } require_once "resources/header.php"; $page["title"] = $text['title-notifications']; @@ -286,10 +297,9 @@ $page["title"] = $text['title-notifications']; echo " \n"; echo "