|
|
|
@ -537,15 +537,15 @@ class SystemAnnouncementManager { |
|
|
|
|
$user_table = Database :: get_main_table(TABLE_MAIN_USER); |
|
|
|
|
|
|
|
|
|
if ($teacher <> 0 AND $student == 0) { |
|
|
|
|
$sql = "SELECT firstname, lastname, email, status FROM $user_table u $url_condition WHERE status = '1' "; |
|
|
|
|
$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '1' "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($teacher == 0 AND $student <> 0) { |
|
|
|
|
$sql = "SELECT firstname, lastname, email, status FROM $user_table u $url_condition WHERE status = '5' "; |
|
|
|
|
$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE status = '5' "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($teacher<> 0 AND $student <> 0) { |
|
|
|
|
$sql = "SELECT firstname, lastname, email FROM $user_table u $url_condition WHERE 1=1 "; |
|
|
|
|
$sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition WHERE 1 = 1 "; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($language)) { //special condition because language was already treated for SQL insert before |
|
|
|
@ -570,13 +570,14 @@ 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); |
|
|
|
|
$admin_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
|
|
|
|
|
|
|
|
|
$message_sent = false; |
|
|
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result,'ASSOC')) { |
|
|
|
|
$name = api_get_person_name($row['firstname'], $row['lastname'], null, PERSON_NAME_EMAIL_ADDRESS); |
|
|
|
|
$res = @api_mail_html($name, $row['email'], $title, $content, $admin_name, api_get_setting('emailAdministrator')); |
|
|
|
|
MessageManager::send_message_simple($row['user_id'], $title, $content); |
|
|
|
|
$message_sent = true; |
|
|
|
|
} |
|
|
|
|
return $res; //true if at least one e-mail was sent |
|
|
|
|
return $message_sent; //true if at least one e-mail was sent |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|