018372b37c7542b75dafd8fa1f33f47a893c82b3
[e-DoKo.git] / include / output.php
1 <?php
2 /* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
3  *
4  *   This file is part of e-DoKo.
5  *
6  *   e-DoKo is free software: you can redistribute it and/or modify
7  *   it under the terms of the GNU General Public License as published by
8  *   the Free Software Foundation, either version 3 of the License, or
9  *   (at your option) any later version.
10  *
11  *   e-DoKo is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU General Public License for more details.
15  *
16  *   You should have received a copy of the GNU General Public License
17  *   along with e-DoKo.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 /* make sure that we are not called from outside the scripts,
22  * use a variable defined in config.php to check this
23  */
24 if(!isset($HOST))
25   exit;
26
27 /* functions which only ouput html  */
28
29 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
30 {
31   global $RULES;
32
33   echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
34   echo "Do you want to continue playing?(This will start a new game, with $playerA starting the game.)\n";
35   echo "  <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
36   echo "  <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
37   echo "  <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
38   echo "  <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
39   echo "  <input type=\"hidden\" name=\"dullen\"  value=\"".$RULES["dullen"]."\" />\n";
40   echo "  <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
41   echo "  <input type=\"hidden\" name=\"callrule\" value=\"".$RULES["call"]."\" />\n";
42   echo "  <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
43   echo "  <input type=\"submit\" value=\"keep playing\" />\n";
44   echo "</form>\n</div>";
45   return;
46 }
47
48 function output_form_for_new_game($names)
49 {
50   $copy_names = $names; /* local copy, so that we can delete names from it
51                          * after we selected them to make sure that each name
52                          * only shows up once
53                          */
54 ?>
55   <form action="index.php?action=new" method="post">
56     <h2> Select players (Remember: you need to be one of the players) </h2>
57
58    <div class="table">
59      <img class="table" src="pics/table.png" alt="table" />
60 <?php
61
62   /* ask player for names */
63
64   $i=0;
65
66   /* delete players name, since he will be on position D anyway */
67   unset($copy_names[array_search($_SESSION["name"],$copy_names)]);
68
69   srand((float) microtime() * 10000000);
70   foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
71     {
72       /* pick 3 names at random and put the players name on position D*/
73       if($i<3)
74         {
75           $randkey = array_rand($copy_names);
76           $rand = $copy_names[$randkey];
77           /* delete this name from the list of possible names */
78           unset($copy_names[$randkey]);
79         }
80       else
81         {
82           $rand = $_SESSION["name"];
83         }
84
85       echo  "     <div class=\"table".$i."\">\n";
86       $i++;
87       echo "       <select name=\"$player\" size=\"1\">  \n";
88       foreach($names as $name)
89         {
90           if($name==$rand)
91             {
92               echo "         <option selected=\"selected\">$name</option>\n";
93             }
94           else
95             echo "         <option>$name</option>\n";
96         }
97       echo "       </select>\n     </div>\n";
98     }
99 ?>
100     </div>
101
102      <h2 class="rules">Rules</h2>
103      <h3>Gameplay-related</h3>
104      <h4>Ten of hearts:</h4>
105      <p>
106        <select name="dullen">
107          <option value="none"> just normal non-trump  </option>
108          <option value="firstwins"> first ten of hearts wins the trick </option>
109          <option value="secondwins" selected="selected"> second ten of hearts wins the trick </option>
110        </select>
111      </p>
112      <h4>Schweinchen (both foxes), only in normal games or silent solos:</h4>
113      <p>
114        <select name="schweinchen">
115          <option value="none" selected="selected"> none </option>
116          <option value="both"> both become highest trump (automatic call at beginning of the game)   </option>
117          <option value="second"> first one normal, second one becomes highest (call during the game) </option>
118          <option value="secondaftercall">  second one become highest only in case re/contra was announced
119          </option>
120        </select>
121      </p>
122      <h4>Call Re/Contra, etc.:</h4>
123      <p>
124        <select name="callrule">
125          <option value="1st-own-card" selected="selected">  Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</option>
126          <option value="5th-card">  Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
127          <option value="9-cards" > Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</option>
128        </select>
129      </p>
130      <h3>Scoring-related</h3>
131      <h4>(not yet implemented)</h4>
132      <p><input type="submit" value="start game"></p>
133      </form>
134 <?php
135 }
136
137 function output_table($data,$caption="",$class="",$id="")
138 {
139
140   $HTML  = "\n<table";
141
142   if($class!="")
143     $HTML.= " class=\"$class\"";
144   if($id!="")
145     $HTML.= " id=\"$id\"";
146
147   $HTML.=">\n";
148
149   $i=0;
150
151   if($caption!="")
152     $HTML .= "  <caption> $caption </caption>\n";
153
154   foreach($data as $record)
155     {
156       if(!$i)
157         $HTML .= "  <thead>\n  <tr>\n";
158       else
159         {
160           if($i==1) $HTML .= "  <tbody>\n";
161           $HTML .= "  <tr>  ";
162         }
163       foreach($record as $point)
164         {
165           if($i)
166             $HTML .= "    <td>$point</td> ";
167           else
168             $HTML .= "    <th>$point</th> ";
169         }
170
171       if(!$i)
172         $HTML .= "  </tr>\n  </thead>\n";
173       else
174         {
175           $HTML .= "  </tr>\n";
176         }
177       $i++;
178     }
179   $HTML .= "  </tbody>\n</table>\n";
180
181   return $HTML;
182 }
183
184 function display_card($card,$dir="english")
185 {
186   /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
187    * convert even cards to the matching odd value */
188
189   if( $card/2 - (int)($card/2) == 0.5 || $card == 0)
190     echo "<img src=\"cards/".$dir."/".$card.".png\"  alt=\"".DB_get_card_name($card)."\" />\n";
191   else
192     echo "<img src=\"cards/".$dir."/".($card-1).".png\"  alt=\"".DB_get_card_name($card-1)."\" />\n";
193
194   return;
195 }
196
197 function display_link_card($card,$dir="english",$type="card")
198 {
199   if( $card/2 - (int)($card/2) == 0.5)
200     echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></div>\n";
201   else
202     echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></div>\n";
203   return;
204 }
205
206 function output_check_for_sickness($me,$mycards)
207 {
208  ?>
209   <div class="sickness"> Thanks for joining the game...<br />
210
211     do you want to play solo?
212     <select name="solo" size="1">
213       <option selected="selected">No</option>
214       <option>trumpless</option>
215       <option>trump</option>
216       <option>queen</option>
217       <option>jack</option>
218       <option>club</option>
219       <option>spade</option>
220       <option>heart</option>
221     </select>
222     <br />
223
224  <?php
225
226   echo "Wedding?";
227   if(check_wedding($mycards))
228      {
229        echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
230        echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
231      }
232    else
233      {
234        echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
235      };
236
237   echo "Do you have poverty?";
238   if(count_trump($mycards)<4)
239     {
240       echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
241       echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
242     }
243   else
244     {
245       echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
246     };
247
248    echo "Do you have too many nines?";
249   if(count_nines($mycards)>4)
250      {
251        echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
252        echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
253      }
254    else
255      {
256        echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
257      };
258
259    echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
260    echo "<input type=\"submit\" value=\"count me in\" />\n";
261
262    echo "</div>\n";
263
264   return;
265 }
266
267 function output_form_calls($me,$myparty)
268 {
269   $highstart = "<span class=\"highcall\">";
270   $highend   = "</span>";
271
272   $tmp = can_call(120,$me);
273   if( $tmp )
274     {
275       if($tmp==2) echo $highstart;
276       if($myparty=='re')
277         echo "re (120):";
278       else if ($myparty=='contra')
279         echo "contra (120):";
280       else
281         echo " re/contra (120):";
282       echo " <input type=\"radio\" name=\"call\" value=\"120\" />";
283       if($tmp==2) echo $highend;
284       echo "<br />\n";
285     }
286   $tmp =  can_call(90,$me);
287   if( $tmp )
288     {
289       if($tmp==2) echo $highstart;
290       echo " 90:".
291         " <input type=\"radio\" name=\"call\" value=\"90\" />";
292       if($tmp==2) echo $highend;
293       echo "<br />\n";
294     }
295   $tmp = can_call(60,$me);
296   if( $tmp )
297     {
298       if($tmp==2) echo $highstart;
299       echo " 60:".
300         " <input type=\"radio\" name=\"call\" value=\"60\" />";
301       if($tmp==2) echo $highend;
302       echo "<br />\n";
303     }
304   $tmp = can_call(30,$me);
305   if( $tmp )
306     {
307       if($tmp==2) echo $highstart;
308       echo " 30:".
309         " <input type=\"radio\" name=\"call\" value=\"30\" />";
310       if($tmp==2) echo $highend;
311       echo "<br />\n";
312     }
313   $tmp = can_call(0,$me);
314   if( $tmp )
315     {
316       if($tmp==2) echo $highstart;
317       echo " 0:".
318         " <input type=\"radio\" name=\"call\" value=\"0\" />";
319       if($tmp==2) echo $highend;
320       echo "<br />\n".
321         " no call:".
322         " <input type=\"radio\" name=\"call\" value=\"no\" /> <br />";
323     }
324 }
325
326 function output_check_want_to_play($me)
327 {
328    ?>
329  <div class="joingame">
330    Do you want to play a game of DoKo? <br />
331    yes<input type="radio" name="in" value="yes" />
332    no<input type="radio" name="in" value="no" /> <br />
333 <?php
334   echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
335   echo "\n";
336   echo "<input type=\"submit\" value=\"submit\" />\n";
337   echo " </div>\n";
338
339   return;
340 }
341
342 function output_header()
343 {
344    global $REV;
345 ?>
346 <!DOCTYPE html PUBLIC
347     "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
348     "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
349 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
350   <head>
351      <title>e-Doko</title>
352      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
353      <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
354      <link rel="stylesheet" type="text/css" href="css/standard023.css" />
355      <script type="text/javascript" src="include/game.js"> </script>
356      <script type="text/javascript" src="include/jquery.js"> </script>
357      <script type="text/javascript" src="include/jquery.tablesorter.js"></script>
358      <script type="text/javascript">
359         $(document).ready(function()
360            {
361               $("#ScoreTable").tablesorter({ widgets: ['zebra']});
362            });
363      </script>
364   </head>
365 <body onload="high_last();">
366 <div class="header">
367 <h1> Welcome to E-Doko </h1>
368 </div>
369 <?php
370
371   echo "<div class=\"main\">";
372   return;
373 }
374
375 function output_footer()
376 {
377   global $REV,$PREF;
378
379   echo "</div>\n\n";
380   echo "<div class=\"footer\">\n";
381   echo "  <p class=\"left\"> copyright 2006,2007,2008,2009,2010 Arun Persaud, Lance Thornton(graphics),  Jeff Zerger(database support) <br />\n".
382     "  Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
383     "  - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
384     "  a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
385  echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
386     "  via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
387     "  <a href=\"http://www.dreamhost.com/green.cgi\">\n".
388     "  <img  border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
389     "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>\n".
390     "  </p> \n";
391   echo "\n";
392   echo "</div>\n";
393
394   echo "</body>\n";
395   echo "</html>\n";
396
397   return;
398 }
399
400 function output_status()
401 {
402   global $defaulttimezone, $INDEX, $WIKI, $RSS;
403
404   if(isset($_SESSION["name"]))
405     {
406       $name = $_SESSION["name"];
407
408       /* last logon time */
409       $myid  = DB_get_userid("name",$name);
410       $zone  = DB_get_user_timezone($myid);
411
412       $time     = DB_get_user_timestamp($myid);
413       date_default_timezone_set($defaulttimezone);
414       $unixtime = strtotime($time);
415       date_default_timezone_set($zone);
416
417       /* rss token */
418       $token = get_user_token($myid);
419
420       /* logout info */
421       echo "\n<div class=\"status\">\n";
422       echo $name,"\n";
423       echo " | <a href=\"".$INDEX."\"> mypage </a>\n";
424       echo " | <a href=\"".$INDEX."?action=prefs\">settings</a>\n";
425       echo " | <a href=\"".$INDEX."?action=new\">new game</a>\n";
426       echo " | <a href=\"".$INDEX."?action=stats\">statistics</a>\n";
427       echo " | <a href=\"".$WIKI."\">wiki</a>\n";
428       echo " | <a href=\"".$RSS."?uid=".$myid."&amp;token=".$token."\">rss</a>\n";
429       echo " |&nbsp;&nbsp;&nbsp; <a href=\"".$INDEX."?action=logout\">logout</a>\n";
430       echo "</div>\n";
431
432       echo "<div class=\"lastlogin\"><span>last login: ".date("r",$unixtime)."</span></div>\n";
433     }
434   else
435     {
436       echo "\n<div class=\"status\">\n";
437       echo "<a href=\"".$INDEX."\">login</a>\n";
438       echo "</div>\n";
439     }
440   return;
441 }
442
443 function output_select_timezone($name,$timezone="")
444 {
445   $Tzone = array ("Pacific/Apia"         => "Apia",                /*UTC-11*/
446                   "Pacific/Honolulu"     => "Honolulu",            /*UTC-10*/
447                   "America/Anchorage"    => "Anchorage",           /*UTC-9*/
448                   "America/Vancouver"    => "Berkeley",            /*UTC-8*/
449                   "America/Phoenix"      => "Phoenix",             /*UTC-7*/
450                   "America/Chicago"      => "Chicago",             /*UTC-6*/
451                   "America/New_York"     => "New York",            /*UTC-5*/
452                   "America/Santiago"     => "Santiago",            /*UTC-4*/
453                   "America/Buenos_Aires" => "Buenos Aires",        /*UTC-3*/
454                   "Atlantic/South_Georgia" => "Fernando de Noronha", /*UTC-2*/
455                   "Atlantic/Azores"       => "Azores",             /*UTC-1"*/
456                   "Europe/London"         => "London",             /*UTC*/
457                   "Europe/Berlin"         => "Berlin",             /*UTC+1*/
458                   "Africa/Cairo"          => "Cairo",              /*UTC+2*/
459                   "Europe/Moscow"         => "Moscow",             /*UTC+3*/
460                   "Asia/Tehran"           => "Tehran",             /*UTC+3:30*/
461                   "Asia/Dubai"            => "Dubai",              /*UTC+4*/
462                   "Asia/Karachi"          => "Karachi",            /*UTC+5*/
463                   "Asia/Calcutta"         => "Delhi",              /*UTC+5:30*/
464                   "Asia/Kathmandu"        => "Kathmandu",          /*UTC+5:45*/
465                   "Asia/Dhaka"            => "Dhaka",              /*UTC+6*/
466                   "Asia/Rangoon"          => "Yangon",             /*UTC+6:30*/
467                   "Asia/Bangkok"          => "Bangkok",            /*UTC+7*/
468                   "Asia/Hong_Kong"        => "Beijing",            /*UTC+8*/
469                   "Asia/Tokyo"            => "Tokyo",              /*UTC+9*/
470                   "Australia/Darwin"      => "Darwin",             /*UTC+9:30*/
471                   "Australia/Sydney"      => "Sydney",             /*UTC+10*/
472                   "Asia/Magadan"          => "Magadan",            /*UTC+11*/
473                   "Pacific/Auckland"      => "Wellington" );       /*UTC+12*/
474
475   echo "  <select id=\"$name\" name=\"$name\" size=\"1\">\n";
476
477   foreach($Tzone as $zone=>$city)
478     {
479       if($timezone==$zone)
480         echo "   <option value=\"$zone\" selected=\"selected\">$city</option>\n";
481       else
482         echo "   <option value=\"$zone\">$city</option>\n";
483     }
484   echo "  </select>\n";
485
486   return;
487 }
488
489 function output_password_recovery($email,$password)
490 {
491 ?>
492    <form action="index.php" method="post">
493 <?php
494   echo "  <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
495   echo "  <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
496   echo "  <input type=\"hidden\" name=\"passwd\"  value=\"set\" />\n";
497 ?>
498      <fieldset>
499        <legend>Password recovery</legend>
500         <table>
501          <tr>
502             <td><label for="email">Old password:</label></td>
503             <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
504          </tr><tr>
505             <td><label for="password">New password:</label></td>
506             <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
507          </tr><tr>
508             <td><label for="password">Retype:</label></td>
509             <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
510          </tr><tr>
511            <td></td>
512            <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>
513          </tr>
514         </table>
515      </fieldset>
516    </form>
517
518 <?php
519 }
520
521 function output_user_notes($userid,$gameid,$userstatus)
522 {
523   echo "<div class=\"notes\"> Personal notes: <br />\n";
524   $notes = DB_get_notes_by_userid_and_gameid($userid,$gameid);
525   foreach($notes as $note)
526     echo "$note <hr />\n";
527   if($userstatus!='gameover')
528     echo "<input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
529   echo "</div> \n";
530
531   return;
532 }
533
534 function output_robotproof($i)
535 {
536   switch($i)
537     {
538     case 0:
539       return "6*7=";
540     case 1:
541       return "5*7=";
542     case 2:
543       return "4*7=";
544     case 3:
545       return "3*7=";
546     case 4:
547       return "2*7=";
548     }
549 }
550
551 function output_exchanged_cards()
552 {
553   /* in a poverty game this function will output the exchanged cards
554    * players in the team will see the cards, the other team will see
555    * the backside of cards
556    */
557
558   /* need some information about the game */
559   global $gameid,$mygametype, $PREF,$me,$mystatus;
560
561   /* some variables to track where the people with poverty are sitting */
562   $partnerpos1 = 0;
563   $povertypos1 = 0;
564   $partnerpos2 = 0;
565   $povertypos2 = 0;
566
567   /* only need to do it in a poverty game, this might not be needed, but
568    * just to make sure everything is ok
569    */
570   if($mygametype == 'poverty' || $mygametype=='dpoverty')
571     {
572       /* find out who has poverty */
573       for($mypos=1;$mypos<5;$mypos++)
574         {
575           $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid);
576           if($usersick == 'poverty')
577             if($povertypos1)
578               $povertypos2 = $mypos;
579             else
580               $povertypos1 = $mypos;
581         }
582       /* get hash and exchanged cards for all involved */
583       $povertyhash1 = DB_get_hash_from_game_and_pos($gameid,$povertypos1);
584       $partnerhash1 = DB_get_partner_hash_by_hash($povertyhash1);
585
586       $povertycards1 = DB_get_exchanged_cards($povertyhash1);
587       $partnercards1 = DB_get_exchanged_cards($partnerhash1);
588
589       $partnerpos1 = DB_get_pos_by_hash($partnerhash1);
590       if($povertypos2)
591         {
592           $povertyhash2 = DB_get_hash_from_game_and_pos($gameid,$povertypos2);
593           $partnerhash2 = DB_get_partner_hash_by_hash($povertyhash2);
594
595           $povertycards2 = DB_get_exchanged_cards($povertyhash2);
596           $partnercards2 = DB_get_exchanged_cards($partnerhash2);
597
598           $partnerpos2 = DB_get_pos_by_hash($partnerhash2);
599         }
600     }
601
602   /* output the cards
603    * go through all positions, check that position has cards that need to be shown and
604    * show those cards
605    */
606   $show=1;
607   for($mypos=1;$mypos<5;$mypos++)
608     {
609       $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid);
610       if($usersick!=NULL ||
611          $mypos==$povertypos1 || $mypos==$partnerpos1 ||
612          $mypos==$povertypos2 || $mypos==$partnerpos2 )
613         {
614           /* figure out if we gave trump back */
615           $trump_back1=0;
616           if($povertypos2)
617             foreach($povertycards1 as $card)
618               {
619                 if(is_trump($card))
620                   {
621                     $trump_back1=1;
622                     break;
623                   }
624               }
625           $trump_back2=0;
626           if($povertypos2)
627             foreach($povertycards2 as $card)
628               {
629                 if(is_trump($card))
630                   {
631                     $trump_back2=1;
632                     break;
633                   }
634               }
635
636           /* output vorbehalt  */
637           echo "      <div class=\"vorbehalt".($mypos-1)."\"> Vorbehalt <br />\n";
638           if($show)
639             echo "       $usersick <br />\n";
640
641           /* output cards */
642           if($mypos==$partnerpos1)
643             {
644               foreach($partnercards1 as $card)
645                 {
646                   echo '        ';
647                   if($povertyhash1 == $me || $partnerhash1 == $me || $mystatus=='gameover')
648                     display_card($card,$PREF['cardset']);
649                   else
650                     display_card(0,$PREF['cardset']);
651                 }
652               if($trump_back1) echo "        Trump back";
653             }
654           else if($mypos==$povertypos1)
655             {
656               foreach($povertycards1 as $card)
657                 {
658                   echo '        ';
659                   if($povertyhash1 == $me || $partnerhash1 == $me || $mystatus=='gameover')
660                     display_card($card,$PREF['cardset']);
661                   else
662                     display_card(0,$PREF['cardset']);
663               }
664               if($trump_back1) echo "        Trump back";
665             }
666           else if($mypos==$povertypos2)
667             {
668               foreach($povertycards2 as $card)
669                 {
670                   echo '        ';
671                   if($povertyhash2 == $me || $partnerhash2 == $me || $mystatus=='gameover')
672                     display_card($card,$PREF['cardset']);
673                   else
674                     display_card(0,$PREF['cardset']);
675                 }
676               if($trump_back2) echo "        Trump back";
677             }
678           else if($mypos==$partnerpos2)
679             {
680               foreach($partnercards2 as $card)
681                 {
682                   if(is_trump($card)) $trump_back=1;
683                   echo '        ';
684                   if($povertyhash2 == $me || $partnerhash2 == $me || $mystatus=='gameover')
685                     display_card($card,$PREF['cardset']);
686                   else
687                     display_card(0,$PREF['cardset']);
688                 }
689               if($trump_back2) echo "        Trump back";
690             }
691           echo  "      </div>\n";
692         }
693       if($mygametype == $usersick)
694         $show = 0;
695     }
696 }
697
698
699 ?>