X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=7bdfd31d8121868d4a81c081a6a58347ad2c50c0;hp=7141ec75c86236389a668a33539d870ed0a6fdc8;hb=cdf3b418ca71babb4336243ccdd741bbd5970d4d;hpb=d661e260855977d34672388cfa8766de55a73f93 diff --git a/include/functions.php b/include/functions.php index 7141ec7..7bdfd31 100644 --- a/include/functions.php +++ b/include/functions.php @@ -73,10 +73,11 @@ function mymail($uid,$subject,$message) $subject = "$EmailName".$subject; /* standard greeting */ - $header = "Hello ...\n\n"; + $name = DB_get_name('userid',$uid); + $header = "Hello $name\n\n"; /* and standard goodbye */ - $footer = "\n\nHave a nice day\n". + $footer = "\nHave a nice day\n". " your E-Doko service department\n\n". "-- \n". "You can change your mail delivery mode in the preference menu.\n". @@ -921,7 +922,7 @@ function display_table () echo "
\n"; echo " ". - "". + "\"time". "\n"; echo " \n"; @@ -941,7 +942,7 @@ function display_user_menu($id) " LEFT JOIN Game On Hand.game_id=Game.id". " WHERE Hand.user_id='$id'". " AND ( Game.player='$id' OR ISNULL(Game.player) )". - " AND Game.status<>'gameover'". + " AND ( Game.status='pre' OR Game.status='play' )". " ORDER BY Game.session" ); $i=0; @@ -1252,4 +1253,35 @@ function check_vacation($userid) return NULL; } +function cancel_game($why,$gameid) +{ + $gameid = DB_quote_smart($gameid); + + /* update the game table */ + switch($why) + { + case 'timedout': + DB_query("UPDATE Game SET status='cancel-timedout' WHERE id=$gameid"); + break; + case 'nines': + DB_query("UPDATE Game SET status='cancel-nines' WHERE id=$gameid"); + break; + case 'trump': + DB_query("UPDATE Game SET status='cancel-trump' WHERE id=$gameid"); + break; + case 'noplay': + DB_query("UPDATE Game SET status='cancel-noplay' WHERE id=$gameid"); + break; + } + /* set each player to gameover */ + $result = DB_query("SELECT id FROM Hand WHERE game_id=".DB_quote_smart($gameid)); + while($r = DB_fetch_array($result)) + { + $id = $r[0]; + DB_query("UPDATE Hand SET status='gameover' WHERE id=".DB_quote_smart($id)); + } + + return; +} + ?>