X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=fc46a61e576fc3a06484336e4f86e25e21b177a8;hp=04d1bde7ec785ad779ed391322ad23d9c5b1449d;hb=34dca92fa9209df27921dcc58b9ea5bfb8f131f0;hpb=10c5ce6fbd07fc37b7606611bc6e49bcabca38a0
diff --git a/include/functions.php b/include/functions.php
index 04d1bde..fc46a61 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -73,15 +73,86 @@ 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);
+
+/* define possible status for showing cards */
+
+define("CARDS_EMPTY", 0); /* show player's hand*/
+define("CARDS_SHOW", 1); /* show player's hand*/
+define("CARDS_MYTURN", 2); /* show radiobuttons for cards that can be played*/
+define("CARDS_EXCHANGE", 3); /* do we need to return cards to our partner in poverty?*/
+define("CARDS_GAMEOVER_ME", 4); /* show all cards from everyone*/
+define("CARDS_GAMEOVER", 5); /* show all cards from everyone (looking at someone else's game)*/
+
+ /* cards_status: SHOW show our hand
+ * MYTURN show radiobutton for cards that can be played
+ * EXCHANGE do we need to return cards to our partner in poverty?
+ * GAMEOVER show all cards from everyone
+ */
+
+function mymail($uid,$gameid=0,$type,$message)
{
- global $EmailName;
+ global $EmailName,$WIKI;
/* do we send the email right away or save it in the database? */
$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.=sprintf(_("Game %s canceled"),$game);
+ break;
+ case GAME_CANCELED_POVERTY:
+ $subject.=sprintf(_("Game %s canceled (poverty not resolved)"),$game);
+ break;
+ case GAME_CANCELED_TIMEOUT:
+ $subject.=sprintf(_("Game %s canceled (timed out)"),$game);
+ break;
+ case GAME_YOUR_TURN:
+ $subject.=sprintf(_("A card has been played in game %s"),$game);
+ break;
+ case GAME_READY:
+ $subject.=sprintf(_("Ready, set, go... (game %s)"),$game);
+ break;
+ case GAME_POVERTY:
+ $subject.=sprintf(_("Poverty (game %s)"),$game);
+ break;
+ case GAME_DPOVERTY:
+ $subject.=sprintf(_("Double poverty (game %s)"),$game);
+ break;
+ case GAME_OVER:
+ $subject.=sprintf(_("Game over (game %s)"),$game);
+ break;
+ case GAME_RECOVERY:
+ $subject.=_("Recovery");
+ break;
+ case GAME_REMINDER:
+ $subject.=sprintf(_("Reminder: game %s it's your turn"),$game);
+ break;
+ case GAME_NEW:
+ $subject.=sprintf(_("You are invited to a game of DoKo (game %s)"),$game);
+ break;
+ default:
+ $subject.=sprintf(_("Problem with email, contact admin (errorcode %d)"),$gameid);
+ }
/* standard goodbye */
$footer = "\nHave a nice day\n".
@@ -89,8 +160,7 @@ function mymail($uid,$subject,$message)
"-- \n".
"You can change your mail delivery mode in the preference menu.\n".
'web: http://doko.nubati.net '.
- 'help: http://wiki.nubati.net/EmailDoko '.
- 'bugs: http://wiki.nubati.net/EmailDokoIssues';
+ "help, bugs, etc.: $WIKI";
if(is_array($uid))
{
@@ -857,12 +927,12 @@ function can_call($what,$hash)
}
else if ( 9 == ($NRcards + $offset))
{
- if( ($mincall>=0 && $mincall==120) )
+ if( ($mincall>=0 && $mincall<=120 && $what<=90 ) )
return 2;
}
else if ( 9 < ($NRcards + $offset))
{
- if( ($mincall>=0 && $mincall==120) )
+ if( ($mincall>=0 && $mincall<=120 && $what<=90 ) )
return 1;
}
else if ( 6 == ($NRcards + $offset))
@@ -939,8 +1009,8 @@ function display_table ()
$lastlogin = strtotime($r[6]);
date_default_timezone_set($timezone);
$timenow = strtotime(date("Y-m-d H:i:s"));
- $gravatar = "$name
";
-
+ $gravatar = "$name
\n ";
echo "