X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=index.php;h=1db07ce06bc033677d817052623054d74cbd4b1d;hb=9c5af0e78797d2c5c2e3bbf2439bb7b88fc32cdf;hp=291d93097e1699c1165eb543d16205c8400ef2aa;hpb=ff9effad42c5222df141e9c72f09aea315c15805;p=e-DoKo.git diff --git a/index.php b/index.php index 291d930..1db07ce 100644 --- a/index.php +++ b/index.php @@ -1,9 +1,6 @@ yes
"; } } - echo "I don't want to take any trump: ". - "yes
"; + echo "No,way I take those trump...
"; echo "Your cards are:
\n"; $mycards = DB_get_hand($me); @@ -897,13 +892,7 @@ else if(myisset("me")) else echo "it's not your turn yet to decide if you want to take the trump or not."; } - /* - * yes, display number of trump and user's hand, ask if he wants to take it - * no, set whom-to-ask to next player, email next player, cancle game if no next player - * yes -> link to new page:display all cards, ask for N return cards - * set re/contra - * - */ + }; } /* check if no one wanted to take trump, in that case the gamesickness would be set to 5 or 50 */ @@ -930,10 +919,10 @@ else if(myisset("me")) } /* check if all players are ready to play */ - $ok=1; + $ok = 1; foreach($userids as $user) if(DB_get_hand_status_by_userid_and_gameid($user,$gameid)!='play') - $ok=0; + $ok = 0; if($ok) { @@ -974,14 +963,14 @@ else if(myisset("me")) */ $gametype = DB_get_gametype_by_gameid($gameid); - $GT = $gametype; + $GT = $gametype; if($gametype=="solo") { $gametype = DB_get_solo_by_gameid($gameid); - $GT = $gametype." ".$GT; + $GT = $gametype." ".$GT; } else - $gametype="normal"; + $gametype = "normal"; set_gametype($gametype); /* this sets the $CARDS variable */ @@ -1050,8 +1039,8 @@ else if(myisset("me")) if($sickness=="poverty") { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); if($trumpNR) echo "(poverty < trump back)"; else @@ -1065,8 +1054,8 @@ else if(myisset("me")) if($sickness=="poverty") { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); if($trumpNR) echo "(poverty A < trump back)"; else @@ -1078,8 +1067,8 @@ else if(myisset("me")) if($sickness=="poverty") { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $cards = DB_get_all_hand($userhash); + $trumpNR = count_trump($cards); if($trumpNR) echo "(poverty B < trump back)"; else @@ -1124,8 +1113,7 @@ else if(myisset("me")) "LEFT JOIN Comment ON Play.id=Comment.play_id ". "WHERE Trick.game_id='".$gameid."' ". "ORDER BY Trick.id,sequence ASC"); - $trickNR = 1; - + $trickNR = 1; $lasttrick = DB_get_max_trickid($gameid); $play = array(); /* needed to calculate winner later */ @@ -1206,14 +1194,14 @@ else if(myisset("me")) /* whos turn is it? */ if($seq==4) { - $winner = get_winner($play,$gametype); /* returns the position */ - $next = $winner; + $winner = get_winner($play,$gametype); /* returns the position */ + $next = $winner; $firstcard = ""; /* new trick, no first card */ } else { $next = $pos+1; - if($next==5) $next=1; + if($next==5) $next = 1; } /* my turn?, display cards as links, ask for comments*/ @@ -1370,7 +1358,7 @@ else if(myisset("me")) " LEFT JOIN User ON Hand.user_id=User.id". " WHERE Hand.game_id=$gameid". " GROUP BY fullname" ); - $message = "The game is over. Thanks for playing :)\n"; + $message = "The game is over. Thanks for playing :)\n"; $message .= "Final score:\n"; while( $r = mysql_fetch_array($result,MYSQL_NUM)) $message .= " ".$r[0]."(".$r[2].") ".$r[1]."\n"; @@ -1384,26 +1372,23 @@ else if(myisset("me")) while( $r = mysql_fetch_array($result,MYSQL_NUM)) $message .= " ".$r[0]." ".$r[1]."\n"; - /* check who wants to be CC'ed on the email */ - $h = array(); - $header = ""; + /* send out final email */ + $all = array(); + foreach($userids as $user) - { - $result = mysql_query("SELECT value from User_Prefs". - " WHERE user_id='$user' AND pref_key='ccemail'" ); - $r = mysql_fetch_array($result,MYSQL_NUM); - if($r && $r[0]=="yes") - $h[] = DB_get_email_by_userid($user); - } - if(sizeof($h)) - $header = "CC: ".join(",",$h)."\r\n"; - + $all[] = DB_get_email_by_userid($user); + $TO = implode(",",$all); + + $help = "\n\n (you can use reply all on this email to reach all the players.)\n"; + mymail($To,$EmailName."game over (game $gameid) part 1(2)",$message.$help); + foreach($userids as $user) { $To = DB_get_email_by_userid($user); $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); - $mymessage = $message."Use this link to have a look at the game: ".$host."?me=".$hash."\n\n" ; - mymail($To,$EmailName."game over (game $gameid)",$mymessage,$header); + + $link = "Use this link to have a look at game $gameid: ".$host."?me=".$hash."\n\n" ; + mymail($To,$EmailName."game over (game $gameid) part 2(2)",$link); } } @@ -1521,6 +1506,24 @@ else if(myisset("me")) echo "Your cards were:
\n"; foreach($oldcards as $card) display_card($card,$PREF["cardset"]); + + $userids = DB_get_all_userid_by_gameid($gameid); + foreach($userids as $user) + { + $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); + + if($userhash!=$me) + { + echo "
"; + + $name = DB_get_name_by_userid($user); + $oldcards = DB_get_all_hand($userhash); + $oldcards = mysort($oldcards,$gametype); + echo "$name's cards were:
\n"; + foreach($oldcards as $card) + display_card($card,$PREF["cardset"]); + } + } } echo "\n"; @@ -1564,7 +1567,7 @@ else if(myisset("me")) " WHERE session=$session". " ORDER BY create_date DESC". " LIMIT 1"); - $r=-1; + $r = -1; if($result) $r = mysql_fetch_array($result,MYSQL_NUM); @@ -1593,11 +1596,11 @@ else if(myisset("me")) if(myisset("forgot")) { - $ok=1; + $ok = 1; $uid = DB_get_userid_by_email($email); if(!$uid) - $ok=0; + $ok = 0; if($ok) { @@ -1619,10 +1622,10 @@ else if(myisset("me")) if(strlen($password)!=32) $password = md5($password); - $ok=1; + $ok = 1; $uid = DB_get_userid_by_email_and_password($email,$password); if(!$uid) - $ok=0; + $ok = 0; if($ok) { @@ -1644,21 +1647,6 @@ else if(myisset("me")) $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$uid','cardset',".DB_quote_smart($setpref).")"); echo "Ok, changed you preferences for the cards.\n"; break; - case "ccemail": - $result = mysql_query("SELECT * from User_Prefs". - " WHERE user_id='$uid' AND pref_key='ccemail'" ); - if( mysql_fetch_array($result,MYSQL_NUM)) - if($PREF["ccemail"]=="yes") - $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart("no"). - " WHERE user_id='$uid' AND pref_key='ccemail'" ); - else - $result = mysql_query("UPDATE User_Prefs SET value=".DB_quote_smart("yes"). - " WHERE user_id='$uid' AND pref_key='ccemail'" ); - else - $result = mysql_query("INSERT INTO User_Prefs VALUES(NULL,'$uid','ccemail',".DB_quote_smart("yes").")"); - echo "Ok, changed you preferences for being CC'ed on emails.\n"; - break; - } } else /* output default user page */ @@ -1677,7 +1665,7 @@ else if(myisset("me")) DB_update_user_timestamp($uid); - echo "

these are your games that haven't started yet:
\n"; + echo "

These are your games that haven't started yet:
\n"; $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". " LEFT JOIN Game On Hand.game_id=Game.id". " WHERE Hand.user_id='$uid' AND Game.status='pre'" ); @@ -1702,7 +1690,7 @@ else if(myisset("me")) } echo "

\n"; - echo "

these are the games you are playing in:
\n"; + echo "

These are the games you are playing in:
\n"; $result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.mod_date,Game.player from Hand". " LEFT JOIN Game On Hand.game_id=Game.id". " WHERE Hand.user_id='$uid' AND Game.status='play'" ); @@ -1728,15 +1716,15 @@ else if(myisset("me")) echo "

\n"; - echo "

and these are your games that are already done:
Game: \n"; - $output=array(); + echo "

And these are your games that are already done:
Game: \n"; + $output = array(); $result = mysql_query("SELECT hash,game_id from Hand WHERE user_id='$uid' AND status='gameover'" ); while( $r = mysql_fetch_array($result,MYSQL_NUM)) - $output[]= "#".$r[1]." "; + $output[] = "#".$r[1]." "; echo implode(", ",$output)."

\n"; $names = DB_get_all_names(); - echo "

registered players:
\n"; + echo "

Registered players:
\n"; echo implode(", ",$names)."\n"; echo "

\n"; @@ -1745,7 +1733,7 @@ else if(myisset("me")) } else { - echo "sorry email and password don't match
"; + echo "Sorry email and password don't match
"; } }; output_footer();