From 22dc909a3893264ab5d15953a5554bada84d2ee1 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 14 Sep 2015 11:58:57 +0200 Subject: [PATCH] Add expiration_date validation see BT#10259 --- main/inc/lib/system_announcements.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/inc/lib/system_announcements.lib.php b/main/inc/lib/system_announcements.lib.php index 79c119c7e8..5ab43ca0f6 100755 --- a/main/inc/lib/system_announcements.lib.php +++ b/main/inc/lib/system_announcements.lib.php @@ -655,6 +655,7 @@ class SystemAnnouncementManager $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset); $content = api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'', $content)), ENT_QUOTES, $charset); + $now = api_get_utc_datetime(); if ($sendEmailTest) { MessageManager::send_message_simple(api_get_user_id(), $title, $content); @@ -691,6 +692,9 @@ class SystemAnnouncementManager // Sent to active users. $sql .= " AND email <>'' AND active = 1 "; + // Expiration date + $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') "; + if ((empty($teacher) or $teacher == '0') AND (empty($student) or $student == '0')) { return true; }