summaryrefslogtreecommitdiffstats
path: root/include/functions.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2011-03-20 00:40:54 -0700
committerArun Persaud <apersaud@lbl.gov>2011-03-20 00:40:54 -0700
commit08583506b9bdb4ef2d30bad9752c960f20fe54b6 (patch)
treef8fac0f7b889afccf3bc0d3b30fd523c0ff2ee07 /include/functions.php
parent455372db985024563b26bfa5af9c91b2a8e53c06 (diff)
downloade-DoKo-08583506b9bdb4ef2d30bad9752c960f20fe54b6.tar.gz
e-DoKo-08583506b9bdb4ef2d30bad9752c960f20fe54b6.tar.bz2
e-DoKo-08583506b9bdb4ef2d30bad9752c960f20fe54b6.zip
CLEANUP: added gameid to mymail and generate subject line in mymail directly
this way it will be easier to add translation and also to add the gameid into the database for the digest
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php60
1 files changed, 58 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index 5343d36..2504506 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -73,7 +73,20 @@ function config_check()
return;
}
-function mymail($uid,$subject,$message)
+/* define possible status for email subsjects */
+define("GAME_CANCELED", 0);
+define("GAME_CANCELED_POVERTY", 1);
+define("GAME_CANCELED_TIMEOUT", 2);
+define("GAME_YOUR_TURN", 3);
+define("GAME_READY", 4);
+define("GAME_POVERTY", 5);
+define("GAME_DPOVERTY", 6);
+define("GAME_OVER", 7);
+define("GAME_RECOVERY", 8);
+define("GAME_REMINDER", 9);
+define("GAME_NEW", 10);
+
+function mymail($uid,$gameid=0,$type,$message)
{
global $EmailName,$WIKI;
@@ -81,7 +94,50 @@ function mymail($uid,$subject,$message)
$send_now = 1;
/* add standard header and footer */
- $subject = "$EmailName".$subject;
+ $subject = "$EmailName ";
+ if($gameid)
+ $game = DB_format_gameid($gameid);
+ else
+ $game = '';
+
+ switch($type)
+ {
+ case GAME_CANCELED:
+ $subject.="Game $game canceled";
+ break;
+ case GAME_CANCELED_POVERTY:
+ $subject.="Game $game canceled (poverty not resolved)";
+ break;
+ case GAME_CANCELED_TIMEOUT:
+ $subject.="Game $game canceled (timed out)";
+ break;
+ case GAME_YOUR_TURN:
+ $subject.="A card has been played in game $game";
+ break;
+ case GAME_READY:
+ $subject.="Ready, set, go... (game $game)";
+ break;
+ case GAME_POVERTY:
+ $subject.="Poverty (game $game)";
+ break;
+ case GAME_DPOVERTY:
+ $subject.="Double poverty (game $game)";
+ break;
+ case GAME_OVER:
+ $subject.="Game over (game $game)";
+ break;
+ case GAME_RECOVERY:
+ $subject.="Recovery";
+ break;
+ case GAME_REMINDER:
+ $subject.="Reminder: game $game it's your turn";
+ break;
+ case GAME_NEW:
+ $subject.="You are invited to a game of DoKo (game $game)";
+ break;
+ default:
+ $subject.="Problem with email, contact admin (errorcode $gameid)";
+ }
/* standard goodbye */
$footer = "\nHave a nice day\n".