guid = $aGuid; $this->alertlevel = $aAlertlevel; $this->emailaddress = $aEmailaddress; $this->enabled = $aEnabled; $this->active = $aActive; $this->systemAccount = $aSystemAccount; $this->accountName = $aAccountName; $this->comment = $aComment; } }; $returnMessage="No method"; //Process data for actions if($_SERVER['REQUEST_METHOD']=='POST') { $url = $_REQUEST['url']; $isChecked = $_REQUEST['ischeck']; $method = $_REQUEST['method']; if(strcmp($method,"removeNotification")==0) { delete_notification($user, $_REQUEST['guid']); $returnMessage="The selected email notification was successfully removed."; } else if(strcmp($method,"addNotification")==0) { error_log("Alert level: ".$_REQUEST['alertlevel']); error_log("Email address: ".$_REQUEST['emailaddr']); $notification = new CNotification(0, (int)$_REQUEST['alertlevel'], $_REQUEST['emailaddr'], '', true, false, $_POST['comment'] ); add_notification($user, $notification); $returnMessage= "A new email address has been successfully added. $notification->emailaddress will now receive email notifications."; } else if(strcmp($method,"modifyNotification")==0) { $enabled = 0; if(strcmp($_REQUEST['enabled'],"true")==0) { $enabled = 1; } $notification = new CNotification($_REQUEST['guid'], (int)$_REQUEST['alertlevel'], $_REQUEST['emailaddr'], '',$enabled, false, $_POST['comment'] ); update_notification($user, $notification); $returnMessage="The properties of the selected email address have been successfully modified."; } else if(strcmp($method,"changeNotificationState")==0) { //update the email notification $enabled = 0; if(strcmp($_REQUEST['enabled'],"true")==0) { $enabled = 1; } $notification = new CNotification($_REQUEST['guid'], (int)$_REQUEST['alertlevel'], $_REQUEST['emailaddr'], $_POST['accountName'], $enabled, true, $_POST['comment']); error_log("Email address: ".$_REQUEST['emailaddr']." will be: ".$enabled); error_log(gettype($enabled)); update_notification($user, $notification); if($enabled == 1) { $returnMessage = "The selected email notification has been enabled."; } else { $returnMessage= "The selected email notification has been disabled."; } } else if(strcmp($method, "testNotificationEmail") == 0) { // declare variables $emailAddr = $_REQUEST['emailaddr']; if (!send_test_email($user, $emailAddr)) { $returnMessage = "Test email was successfully sent to "; $returnMessage .= $emailAddr; $returnMessage .= "."; } else { $returnMessage = "Test email was unsuccessfully sent to "; $returnMessage .= $emailAddr; $returnMessage .= "."; $errorCode = 0x37; } } } ?> Background data processing page