X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=a50b247d0adc76e90fdc0b363940950f5393b2a0;hp=6c6b12bdac6e4b542a201a27811856d84485088e;hb=692b2c53acc3d0f8a0205b7aba84938580540df7;hpb=d170223b2c1d92771a6bb6dcd2eac07bb2ad777c
diff --git a/include/game.php b/include/game.php
index 6c6b12b..a50b247 100644
--- a/include/game.php
+++ b/include/game.php
@@ -27,7 +27,7 @@ if(!isset($HOST))
/* calling game.php only makes sense when we give it a hash for a game */
if(!myisset('me'))
{
- echo "Hmm, you really shouldn't mess with the urls.
\n";
+ echo _("Hmm, you really shouldn't mess with the urls.")."
\n";
return;
}
$me = $_REQUEST['me'];
@@ -36,8 +36,8 @@ $me = $_REQUEST['me'];
$myid = DB_get_userid('hash',$me);
if(!$myid)
{
- echo "Can't find you in the database, please check the url.
\n";
- echo "perhaps the game has been canceled, check by login in here.";
+ echo _('Cannot find you in the database, please check the url.')."
\n";
+ printf(_('Perhaps the game has been canceled, check by login in here.'),$INDEX);
return;
}
@@ -65,17 +65,20 @@ set_language($PREF['language']);
$RULES = DB_get_RULES($gameid);
/* get some infos about the game */
-$gametype = DB_get_gametype_by_gameid($gameid);
-$gamestatus = DB_get_game_status_by_gameid($gameid);
-$GT = $gametype;
-if($gametype=='solo')
- {
- $gametype = DB_get_solo_by_gameid($gameid);
- if($gametype=='silent')
- $GT = 'normal';
- else
- $GT = $gametype.' '.$GT;
- }
+$gametype_raw = DB_get_gametype_by_gameid($gameid);
+$gametype_solo = DB_get_solo_by_gameid($gameid);
+
+/* replace solo with the type of solo */
+$gametype = $gametype_raw;
+if($gametype_raw=='solo')
+ $gametype = $gametype_solo;
+
+/* gametype for displaying it (hides hidden solo)*/
+$GT = get_display_gametype($gameid);
+
+$gamestatus = DB_get_game_status_by_gameid($gameid);
+
+
/* do we need to worry about Schweinchen?
* check gametype and rules
@@ -184,7 +187,7 @@ if( myisset('call') )
/* get time from the last action of the game */
-$r = DB_query_array("SELECT mod_date from Game WHERE id='$gameid' " );
+$r = DB_query_array("SELECT mod_date from Game WHERE id=".DB_quote_smart($gameid));
$gameend = time() - strtotime($r[0]);
/* handle comments in case player didn't play a card, allow comments a week after the end of the game */
@@ -215,9 +218,8 @@ else if( $mystatus == 'gameover' && isset($_SESSION['id']) )
}
else
{
- echo "
If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted."; + $messages[] = _("The game has been canceled due to the request of one player.
If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.");
break;
case 'cancel-timedout':
- $messages[] = "The game has been canceled because one player wasn't responding.
If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.";
+ $messages[] = _("The game has been canceled because one player wasn't responding.
If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.");
break;
case 'cancel-nines':
- $messages[] = 'The game has been canceled because one player had too many nines.';
+ $messages[] = _('The game has been canceled because one player had too many nines.');
break;
case 'cancel-lowtrump':
- $messages[] = 'The game has been canceled because one player had low trump.';
+ $messages[] = _('The game has been canceled because one player had low trump.');
break;
case 'cancel-trump':
- $messages[] = 'The game has been canceled because nobody wanted to take the trump.';
+ $messages[] = _('The game has been canceled because nobody wanted to take the trump.');
break;
}
/* for these two types, we shouldn't show the cards, since we might want to restart the game */
@@ -1254,19 +1289,6 @@ switch($mystatus)
* accordingly
*/
- $gametype = DB_get_gametype_by_gameid($gameid);
- $GT = $gametype;
- if($gametype=='solo')
- {
- $gametype = DB_get_solo_by_gameid($gameid);
- if($gametype=='silent')
- $GT = 'normal';
- else
- $GT = $gametype.' '.$GT;
- }
- else
- $gametype = 'normal';
-
set_gametype($gametype); /* this sets the $CARDS variable */
/* get some infos about the game, need to reset this, since it might have changed */
@@ -1286,20 +1308,20 @@ switch($mystatus)
$result = DB_query('SELECT Hand_Card.card_id as card,'.
' Hand.position as position,'.
' Play.sequence as sequence, '.
- ' Trick.id, '.
+ ' Trick.id,'.
" GROUP_CONCAT(CONCAT('',User.fullname,': ',Comment.comment,'')".
" SEPARATOR '\n' ), ".
- ' Play.create_date, '.
- ' Hand.user_id '.
- 'FROM Trick '.
- 'LEFT JOIN Play ON Trick.id=Play.trick_id '.
- 'LEFT JOIN Hand_Card ON Play.hand_card_id=Hand_Card.id '.
- 'LEFT JOIN Hand ON Hand_Card.hand_id=Hand.id '.
- 'LEFT JOIN Comment ON Play.id=Comment.play_id '.
- 'LEFT JOIN User On User.id=Comment.user_id '.
- "WHERE Trick.game_id='".$gameid."' ".
- 'GROUP BY Trick.id, sequence '.
- 'ORDER BY Trick.id, sequence ASC');
+ ' Play.create_date,'.
+ ' Hand.user_id'.
+ ' FROM Trick'.
+ ' LEFT JOIN Play ON Trick.id=Play.trick_id'.
+ ' LEFT JOIN Hand_Card ON Play.hand_card_id=Hand_Card.id'.
+ ' LEFT JOIN Hand ON Hand_Card.hand_id=Hand.id'.
+ ' LEFT JOIN Comment ON Play.id=Comment.play_id'.
+ ' LEFT JOIN User On User.id=Comment.user_id'.
+ " WHERE Trick.game_id=".DB_quote_smart($gameid).
+ ' GROUP BY Trick.id, sequence'.
+ ' ORDER BY Trick.id, sequence ASC');
$trickNR = 0;
$lasttrick = DB_get_max_trickid($gameid);
@@ -1311,16 +1333,14 @@ switch($mystatus)
echo "\n
This game took '.$r[0]." hours.
\n"; + echo ''; + printf(_('This game took %d hours.'), $r[0]); + echo "
\n"; - echo "See how other played the same hand: \n"; + echo '
'._('See how other played the same hand:')." \n"; foreach($other_game_ids as $id) { $otherhash = DB_get_hash_from_game_and_pos($id,$mypos); @@ -2361,13 +2399,10 @@ if($mystatus=='gameover' && { /* suggest a new game with the same people in it, just rotated once (unless last game was solo) */ $names = DB_get_all_names_by_gameid($gameid); - $type = DB_get_gametype_by_gameid($gameid); - if($type=='solo') + if($gametype_raw=='solo') { - $solo = DB_get_solo_by_gameid($gameid); - - if($solo!='silent') /* repeat game with same first player */ + if($gametype_solo!='silent') /* repeat game with same first player */ output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid); else /* rotate normally */ output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);