Descriptor == "AR") && ($keys[$i]->isLicensed == 1)) { $showAR = 1; } } class CNotification { var $guid; var $alertlevel; var $emailaddress; var $enabled; var $active; var $systemAccount; var $accountName; var $comment; function CNotification($aGuid, $aAlertlevel, $aEmailaddress, $aAccountName, $aEnabled=true, $aSystemAccount=false, $aComment="" ) { $this->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']; $du = $_REQUEST['du']; $mu = $_REQUEST['mu']; $ms = $_REQUEST['ms']; $mi = $_REQUEST['mi']; $day = $_REQUEST['day']; $hour = $_REQUEST['hour']; $ampm = $_REQUEST['ampm']; $ARguidToMod = $_REQUEST['ARguidToMod']; if(strcmp($method,"removeNotification")==0) { if($showAR) { $tempAR = get_ar_notifications($user); foreach($tempAR as $temp) { if(strcmp($temp->emailaddress, $_REQUEST['email']) == 0) { delete_ar_notification($user, $temp->emailaddress, $temp->sendDriveUtilization, $temp->sendMediaIntegrity, $temp->sendMediaUsage, $temp->sendMediaSecurity); } } } delete_notification($user, $_REQUEST['guid']); $returnMessage="The selected email notification was successfully removed."; } else if(strcmp($method,"addNotification")==0) { if($showAR) { $hour = intval($hour); $hour = $hour + 1; $ampm = intval($ampm); // midnight if($hour == 12 && $ampm == 0) { $hour = 0; } // noon if($hour == 12 && $ampm == 1) { $hour = 12; } if(!($hour == 12 || $hour == 0) && $ampm == 1) { $hour = $hour + 12; } if($du == "true") { $du = 1; } else { $du = 0; } if($mi == "true") { $mi = 1; } else { $mi = 0; } if($mu == "true") { $mu = 1; } else { $mu = 0; } if($ms == "true") { $ms = 1; } else { $ms = 0; } create_ar_notification($user, $du, $mi, $mu, $ms, $_REQUEST['emailaddr'], "", intval($day), $hour); } $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) { if($showAR) { $hour = intval($hour); $hour = $hour + 1; $ampm = intval($ampm); // midnight if($hour == 12 && $ampm == 0) { $hour = 0; } // noon if($hour == 12 && $ampm == 1) { $hour = 12; } if(!($hour == 12 || $hour == 0) && $ampm == 1) { $hour = $hour + 12; } if($du == "true") { $du = 1; } else { $du = 0; } if($mi == "true") { $mi = 1; } else { $mi = 0; } if($mu == "true") { $mu = 1; } else { $mu = 0; } if($ms == "true") { $ms = 1; } else { $ms = 0; } modify_ar_notification($user, $du, $mi, $mu, $ms, $_REQUEST['emailaddr'], "", intval($day), $hour, intval($ARguidToMod)); } $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; } } } ?>