echo "<form action=\"index.php?action=game&me=$me\" method=\"post\">\n";
/* handle user notes (only possible while game is running)*/
-if( $mystatus!='gameover' )
+if( $mystatus!='gameover' )
if(myisset('note'))
{
$note = $_REQUEST['note'];
DB_insert_note($note,$gameid,$myid);
};
-/* make sure that we don't show the notes to the wrong person
- * (e.g. other people looking at an old game)
- */
-if( $mystatus != 'gameover' ||
- ( $mystatus == 'gameover' &&
- isset($_SESSION['id']) &&
- $myid == $_SESSION['id']))
- output_user_notes($myid,$gameid,$mystatus);
-
/* handle calls, output a comment to show when the call was made */
/* initialize comments */
$comment = '';
$userids = DB_get_all_userid_by_gameid($gameid);
foreach($userids as $user)
{
- $subject = 'Game '.DB_format_gameid($gameid).' canceled';
- mymail($user,$subject,$message);
+ mymail($user,$gameid,GAME_CANCELED,$message);
}
/* update game status */
$message = "It's your turn now in game ".DB_format_gameid($gameid).".\n".
"Use this link to go the game: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
- mymail($who,"Ready, set, go... (game ".DB_format_gameid($gameid).") ",$message);
+ mymail($who, $gameid, GAME_READY,$message);
*/
}
}
$userids = DB_get_all_userid_by_gameid($gameid);
foreach($userids as $user)
{
- $subject = 'Game '.DB_format_gameid($gameid).' canceled';
- mymail($user,$subject,$message);
+ mymail($user,$gameid, GAME_CANCELED, $message);
}
echo "</div>\n"; /* end div message */
/* email startplayer */
$message = "It's your turn now in game ".DB_format_gameid($gameid).".\n".
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
- $subject = 'Ready, set, go... (game '.DB_format_gameid($gameid).')';
- mymail($who,$subject,$message);
+ mymail($who,$gameid,GAME_READY,$message);
}
}
else
/* email player for poverty */
$message = "Poverty: It's your turn now in game ".DB_format_gameid($gameid).".\n".
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$whohash."\n\n" ;
- $subject = 'Poverty (game '.DB_format_gameid($gameid).') ';
- mymail($whoid,$subject,$message);
+ mymail($whoid,$gameid,GAME_POVERTY,$message);
}
}
}
/* email startplayer */
$message = "It's your turn now in game ".DB_format_gameid($gameid).".\n".
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
- $subject = 'Ready, set, go... (game '.DB_format_gameid($gameid).') ';
- mymail($who,$subject,$message);
+ mymail($who,$gameid,GAME_READY,$message);
}
}
else
echo "<div class=\"message\">Please, <a href=\"$INDEX?action=game&me=$me\">start</a> the game.</div>\n";
+ echo '<div class="mycards"></div>'."\n"; /* needed to make sure the message area is in the right position */
}
/* the following is part A) of what needs to be done */
$userids = DB_get_all_userid_by_gameid($gameid);
foreach($userids as $user)
{
- $subject = 'Game '.DB_format_gameid($gameid).' canceled (poverty not resolved)';
- mymail($user,$subject,$message);
+ mymail($user, $gameid, GAME_CANCELED_POVERTY, $message);
}
/* update game status */
$message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:".
" ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ;
- $subject = 'Poverty (game '.DB_format_gameid($gameid).')';
- mymail($userid,$subject,$message);
+ mymail($userid,$gameid, GAME_POVERTY, $message);
}
}
else
$message = "Two people have poverty, it's your turn to decide, if you want to take the trump. Please visit:".
" ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ;
- $subject = 'Double poverty (game '.DB_format_gameid($gameid).')';
- mymail($userid,$subject,$message);
+ mymail($userid,$gameid, GAME_DPOVERTY, $message);
}
}
echo "<div class=\"message\">Please, <a href=\"$INDEX?action=game&me=$me\">continue</a> here.</div>\n";
/* email startplayer) */
$message = "It's your turn now in game ".DB_format_gameid($gameid).".\n".
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
- $subject = 'Ready, set, go... (game '.DB_format_gameid($gameid).')';
- mymail($who,$subject,$message);
+ mymail($who,$gameid, GAME_READY, $message);
}
}
}
"Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$next_hash."\n\n" ;
if( DB_get_email_pref_by_uid($who)!='emailaddict' )
{
- $subject = 'A card has been played in game '.DB_format_gameid($gameid);
- mymail($who,$subject,$message);
+ mymail($who,$gameid, GAME_YOUR_TURN, $message);
}
}
else /* send out final email */
$message .= $link;
}
$message .= "\n\n (you can use reply all on this email to reach all the players.)\n\n";
- $subject = ' Game over (game '.DB_format_gameid($gameid).') ';
- mymail($userids,$subject,$message);
+ mymail($userids,$gameid, GAME_OVER, $message);
}
}
else
echo "</div>\n"; /* end gameinfo */
+/* make sure that we don't show the notes to the wrong person
+ * (e.g. other people looking at an old game)
+ */
+if( $mystatus != 'gameover' ||
+ ( $mystatus == 'gameover' &&
+ isset($_SESSION['id']) &&
+ $myid == $_SESSION['id']))
+ output_user_notes($myid,$gameid,$mystatus);
+
echo "</form>\n";
$gamestatus = DB_get_game_status_by_gameid($gameid);