Browse Source

Add expiration_date validation see BT#10259

Julio Montoya 9 years ago
parent
commit
22dc909a38
1 changed files with 4 additions and 0 deletions
  1. 4 0
      main/inc/lib/system_announcements.lib.php

+ 4 - 0
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;
 		}