summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-04-29 21:34:16 -0700
committerArun Persaud <arun@nubati.net>2009-04-29 21:34:16 -0700
commit03d6cd5ba13a0aac918734c1f797df4f149d9194 (patch)
tree852592c3d2f189d283cb1106bc4e4f67949a05e7
parent26bcd1e5b01ca8575b513e12ce7bdd302614273c (diff)
downloade-DoKo-03d6cd5ba13a0aac918734c1f797df4f149d9194.tar.gz
e-DoKo-03d6cd5ba13a0aac918734c1f797df4f149d9194.tar.bz2
e-DoKo-03d6cd5ba13a0aac918734c1f797df4f149d9194.zip
CLEANUP: all email now uses the standard header and footer
some email functions didn't use myemail, but used sendmail directly. This is now fixed and all emails should have the same header and footer.
-rw-r--r--include/functions.php27
-rw-r--r--include/game.php10
-rw-r--r--include/newgame.php11
-rw-r--r--include/user.php4
4 files changed, 30 insertions, 22 deletions
diff --git a/include/functions.php b/include/functions.php
index 7bdfd31..e57c2e5 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -72,11 +72,7 @@ function mymail($uid,$subject,$message)
/* add standard header and footer */
$subject = "$EmailName".$subject;
- /* standard greeting */
- $name = DB_get_name('userid',$uid);
- $header = "Hello $name\n\n";
-
- /* and standard goodbye */
+ /* standard goodbye */
$footer = "\nHave a nice day\n".
" your E-Doko service department\n\n".
"-- \n".
@@ -85,7 +81,26 @@ function mymail($uid,$subject,$message)
'help: http://wiki.nubati.net/EmailDoko '.
'bugs: http://wiki.nubati.net/EmailDokoIssues';
- $To = DB_get_email('userid',$uid);
+ if(is_array($uid))
+ {
+ /* send email to more than one person */
+
+ $header = "Hello all\n\n";
+
+ foreach($uid as $user)
+ {
+ $all[] = DB_get_email('userid',$user);
+ }
+ $To = implode(",",$all);
+ }
+ else
+ {
+ /* standard greeting */
+ $name = DB_get_name('userid',$uid);
+ $header = "Hello $name\n\n";
+
+ $To = DB_get_email('userid',$uid);
+ }
sendmail($To,$subject,$header.$message.$footer);
}
diff --git a/include/game.php b/include/game.php
index 1dc4802..9c8c427 100644
--- a/include/game.php
+++ b/include/game.php
@@ -1798,12 +1798,8 @@ switch($mystatus)
$message .= "\nUse these links to have a look at game ".DB_format_gameid($gameid).": \n";
/* send out final email */
- $all = array();
-
foreach($userids as $user)
{
- $all[] = DB_get_email('userid',$user);
-
/* add links for all players */
$hash = DB_get_hash_from_gameid_and_userid($gameid,$user);
$name = DB_get_name('userid',$user);
@@ -1811,11 +1807,9 @@ switch($mystatus)
$link = "$name: ".$HOST.$INDEX."?action=game&me=".$hash."\n" ;
$message .= $link;
}
- $To = implode(",",$all);
-
$message .= "\n\n (you can use reply all on this email to reach all the players.)\n";
- $subject = $EmailName.' Game over (game '.DB_format_gameid($gameid).') ';
- sendmail($To,$subject,$message);
+ $subject = ' Game over (game '.DB_format_gameid($gameid).') ';
+ mymail($userids,$subject,$message);
}
}
else
diff --git a/include/newgame.php b/include/newgame.php
index 4ce13cb..7d77612 100644
--- a/include/newgame.php
+++ b/include/newgame.php
@@ -170,8 +170,7 @@ else
DB_query("INSERT INTO Hand_Card VALUES (NULL, '$hand_idD', '".$randomNR[$i]."', 'false')");
/* send out email, TODO: check for error with email */
- $message = "\n".
- "you are invited to play a game of DoKo.\n".
+ $message = "You are invited to play a game of DoKo.\n".
"Please, place comments and bug reports here:\n".
"http://wiki.nubati.net/index.php?title=EmailDoko\n\n".
"The whole round would consist of the following players:\n".
@@ -183,10 +182,10 @@ else
"".$HOST.$INDEX."?action=game&me=";
$subject = 'You are invited to a game of DoKo (game '.DB_format_gameid($gameid).')';
- sendmail($EmailA,$subject, "Hello $PlayerA,\n".$message.$hashA);
- sendmail($EmailB,$subject, "Hello $PlayerB,\n".$message.$hashB);
- sendmail($EmailC,$subject, "Hello $PlayerC,\n".$message.$hashC);
- sendmail($EmailD,$subject, "Hello $PlayerD,\n".$message.$hashD);
+ mymail($useridA,$subject, $message.$hashA);
+ mymail($useridB,$subject, $message.$hashB);
+ mymail($useridC,$subject, $message.$hashC);
+ mymail($useridD,$subject, $message.$hashD);
echo "<div class=\"message\">You started a new game. The emails have been sent out!</div>\n";
display_user_menu($myid);
diff --git a/include/user.php b/include/user.php
index 0273183..bac4398 100644
--- a/include/user.php
+++ b/include/user.php
@@ -54,8 +54,8 @@ if(myisset("forgot"))
"to log into the server. The new password is valid for 24h, so make\n".
"sure you reset your password to something new. Your old password will\n".
"also still be valid until you set a new one.\n";
- $subject = $EmailName.' Recovery';
- sendmail($email,$subject,$message);
+ $subject = 'Recovery';
+ mymail($myid,$subject,$message);
/* we save these in the database */
DB_set_recovery_password($myid,md5($newpw));