X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=52c0ab7b6224e21bd76a8751d6b7d5e08b4a1a42;hp=98feae40b45505f02eb5fe2cffb0541e2f277213;hb=6da798e39be09e3cea651be2c7d826b79450a1f8;hpb=761622f46541afbaf2303a791595f6595f3208eb diff --git a/include/functions.php b/include/functions.php index 98feae4..52c0ab7 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.=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". @@ -856,12 +912,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)) @@ -938,7 +994,7 @@ 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
\"$name's"; echo "
\n"; @@ -971,12 +1027,12 @@ function display_table () $cards = DB_get_all_hand($userhash); $trumpNR = count_trump($cards,'all'); if($trumpNR) - echo " \"poverty"; + echo " \"poverty"; else - echo " \"poverty"; + echo " \"poverty"; } else - echo " \"poverty\" title=\"poverty partner\" />"; + echo " \"poverty"; if($GT=="dpoverty") if($party=="re")