'Enabled', false=>'Disabled'); 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; } }; $arNotifications = get_ar_notifications($user); error_log("Advanced Report notifications\n".print_r($arNotifications, true)); $errorCode = 0; $displayMessage = 0; //no $smtpWarn = 0; $sortType = true; if ($_SERVER['REQUEST_METHOD']=='POST') { $displayMessage=$_REQUEST['Message']; $errorCode=$_REQUEST['errorCode']; $returnMessage=$_REQUEST['returnMessage']; } $email_notif = get_email_configuration($user); $notifications = get_notifications($user); $total = count($notifications); error_log("Email Notifications\n".print_r($notifications, true)); if ($email_notif->smtpServer == "") { $displayMessage = 1; $smtpWarn = 1; } $arNotifications = get_ar_notifications($user); $keys = get_licensable_features($user); $numKeys = count($keys); $showAR = 0; for ($i=0; $i < $numKeys; $i++) { if (($keys[$i]->Descriptor == "AR") && ($keys[$i]->isLicensed == 1)) { $showAR = 1; } } /* * FIX FOR INVALID DATA IN PREVIOUS LIBRARY FW VERSIONS - ORION V7 * * Check if an email notification is disabled. If disabled and alertLevel is not 4, * this alert was created in previous library version and if there is an ARnotification * with the same email address it should be deleted. Update the email notification to the * new alert level of 4 used to display (None). * * Check if there are any ARNotifications with no reports to send. Delete these * ARnotifications. This takes care of the duplication issue where disabling an * email address set the ARNotification at GUID '0' to the disabled email address. * * * */ // Check if any email notifications are disabled then check alert level foreach( $notifications as $notif) { if($notif->enabled != "1" && $notif->alertLevel != 4) // If notification is disabled and alert level not 4 { // This notification was created on previous lib fw version // Set the email notification alertLevel to 4 error_log("Changing Alert level to 4 (None) for: ".$notif->emailaddress); $notification = new CNotification($notif->guid, 4, $notif->emailaddress, '', false, true, ""); update_notification($user, $notification); // Remove any AR notifications with this email address $arNotifications = get_ar_notifications($user); foreach( $arNotifications as $arNotif) { if(strcmp($notif->emailaddress, $arNotif->emailaddress) == 0) { error_log("Deleting AR notification because it was shown as disabled\n".print_r($arNotif,true)); // Delete the ARnotification delete_ar_notification($user, $arNotif->emailaddress, $arNotif->sendDriveUtilization, $arNotif->sendMediaIntegrity, $arNotif->sendMediaUsage, $arNotif->sendMediaSecurity); } } } } // Delete any AR notifications that have no reports selected $arNotifications = get_ar_notifications($user); foreach( $arNotifications as $arNotif) { if($arNotif->sendDriveUtilization == 0 && $arNotif->sendMediaIntegrity == 0 && $arNotif->sendMediaUsage == 0 && $arNotif->sendMediaSecurity == 0 ) { // Delete the ARnotification error_log("Deleting AR notification because it has no reports to send\n".print_r($arNotif,true)); delete_ar_notification($user, $arNotif->emailaddress, $arNotif->sendDriveUtilization, $arNotif->sendMediaIntegrity, $arNotif->sendMediaUsage, $arNotif->sendMediaSecurity); } } /* * END OF FIX FOR INVALID DATA IN PREVIOUS LIBRARY FIRMWARE VERSIONS */ //Update the notification list $notifications = get_notifications($user); $arNotifications = get_ar_notifications($user); $libTime = get_date_and_time($user); ?>