]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes to convert mail to individual mailing ...
authormartin <martin>
Wed, 5 Jun 2002 14:05:59 +0000 (14:05 +0000)
committermartin <martin>
Wed, 5 Jun 2002 14:05:59 +0000 (14:05 +0000)
so that we can use the new preferences for mail (plain or html).

error/index.php
lib/moodlelib.php
lib/setup.php
login/forgot_password.php
login/signup.php

index a4bef56d00eed94610b1f4c71fedd7b9f1f6563d..7550b0825c84d39619cd56db87e6f8e444851d4f 100644 (file)
@@ -3,11 +3,11 @@
     require("../config.php");
 
     if (isset($text)) {    // form submitted
-        if (!$user = get_records("users", "id", 1)) {
+        if (!$admin = get_admin() ) {
             error("Could not find the admin user to mail to!");
         }
 
-        email_to_users($user, $USER, "Error: $referer -> $requested", "$text");
+        email_to_user($admin, $USER, "Error: $referer -> $requested", "$text");
 
         redirect("$CFG->wwwroot/course/", "Message sent, thanks", 3);
         die;
index b60e3571afc1475ac8503194e49d673d0a255a5e..d6bf254e50419cfea5e7e1cb2d2836c014f14a5a 100644 (file)
@@ -178,22 +178,31 @@ function print_editing_switch($courseid) {
 }
 
 
-function userdate($date, $format="l, j F Y, g:i A") {
+function userdate($date, $format="", $timezone=99) {
     global $USER;
 
-    if (abs($USER->timezone) > 12) {
+    if ($format == "") {
+        $format = "l, j F Y, g:i A";
+    }
+    if ($timezone == 99) {
+        $timezone = (float)$USER->timezone;
+    }
+    if (abs($timezone) > 12) {
         return date("$format T", $date);
     }
-    return gmdate($format, $date + (int)($USER->timezone * 3600));
+    return gmdate($format, $date + (int)($timezone * 3600));
 }
 
-function usergetdate($date) {
+function usergetdate($date, $timezone=99) {
     global $USER;
 
-    if (abs($USER->timezone) > 12) {
+    if ($timezone == 99) {
+        $timezone = (float)$USER->timezone;
+    }
+    if (abs($timezone) > 12) {
         return getdate($date);
     }
-    return getdate($date + (int)($USER->timezone * 3600));
+    return getdate($date + (int)($timezone * 3600));
 }
 
 
@@ -879,8 +888,10 @@ function print_update_module_icon($moduleid) {
 
 /// CORRESPONDENCE  ////////////////////////////////////////////////
 
-function email_to_users(&$users, $from, $subject, $messagetext, $messagehtml="", $attachment="", $attachname="") {
-//  users       - an array of user records as returned by get_records_sql
+function email_to_user($user, $from, $subject, $messagetext, $messagehtml="", $attachment="", $attachname="") {
+//  user        - a user record as an object
+//  from        - a user record as an object
+//  subject     - plain text subject line of the email
 //  messagetext - plain text version of the message
 //  messagehtml - complete html version of the message (optional)
 //  attachment  - a file on the filesystem, relative to $CFG->dataroot
@@ -890,7 +901,7 @@ function email_to_users(&$users, $from, $subject, $messagetext, $messagehtml="",
 
     include_once("$CFG->libdir/phpmailer/class.phpmailer.php");
 
-    if (!$users) {
+    if (!$user) {
         return false;
     }
     
@@ -905,9 +916,7 @@ function email_to_users(&$users, $from, $subject, $messagetext, $messagehtml="",
     $mail->FromName = "$from->firstname $from->lastname";
     $mail->Subject  =  stripslashes($subject);
 
-    foreach ($users as $user) {
-        $mail->AddAddress("$user->email","$user->firstname $user->lastname"); 
-    }
+    $mail->AddBCC("$user->email","$user->firstname $user->lastname"); 
 
     $mail->WordWrap = 70;                               // set word wrap
 
index 6a12ff0473bf4bc2388f34d6fd0275fe312c9e83..094ad4399e845aed0af080f10ea0d612bcf4ccb5 100644 (file)
@@ -22,7 +22,7 @@
 
 // Default editing time for discussions and the like (in seconds)
 
-    $CFG->maxeditingtime = 1800;
+    $CFG->maxeditingtime = 10;
 
 // Location of standard files
 
index fc7044cb021e768f2e4de8a03d8b5e3a09e606c4..7d7b34311365701afc2efa8683de597bf0f5a645 100644 (file)
@@ -93,8 +93,7 @@ function reset_password_and_mail($user) {
 
     $subject  = "$site->fullname: Changed password";
 
-    $users[] = $user;
-    return email_to_users($users, $from, $subject, $message);
+    return email_to_user($user, $from, $subject, $message);
 
 }
 
index 28078b03011a2a4a39a6e8b494eed9bfd6d31671..ada95adcc1ce18fb83e10bda118a83cb98cc9f99 100644 (file)
@@ -117,8 +117,7 @@ function send_confirmation_email($user) {
 
     $subject  = "$site->fullname account confirmation";
 
-    $users[] = $user;
-    return email_to_users($users, $from, $subject, $message);
+    return email_to_user($user, $from, $subject, $message);
 
 }