X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=250450657a068a588916d50331729d9c764b78be;hp=a06f3d425ed4c1acf4ae189b446f162b052ef650;hb=08583506b9bdb4ef2d30bad9752c960f20fe54b6;hpb=850378a3e2da48d387dc565cc6e3c2b47f12e34d diff --git a/include/functions.php b/include/functions.php index a06f3d4..2504506 100644 --- a/include/functions.php +++ b/include/functions.php @@ -73,15 +73,71 @@ 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; + 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.="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". @@ -89,8 +145,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 +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)) @@ -939,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"; @@ -972,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") @@ -1103,7 +1158,7 @@ function display_user_menu($id) if($i==0) { echo "
\n"; - echo "It's your turn in these games:
\n"; + echo _('It\'s your turn in these games').":
\n"; } $i++;