3 /* functions which only ouput html */
5 function display_links($email,$password)
8 echo "<div class=\"bug\">\n".
9 "Report bugs in the <a href=\"". $wiki."\">wiki</a>.<hr />\n";
10 output_link_to_user_page($email,$password);
15 function output_link_to_user_page($email,$password)
17 echo "<a href=\"index.php\"> go to my user page </a>";
22 function output_user_settings($email,$password)
26 echo "<div class=\"useroptions\">\n";
27 echo "<h4> Settings </h4>\n";
28 echo "<a href=\"index.php?passwd=ask\">change password</a><br /";
30 if( $PREF["cardset"] == "english" )
31 echo "<a href=\"index.php?setpref=germancards\">use german cards</a><br />";
33 echo "<a href=\"index.php?setpref=englishcards\">use english cards</a> <br />";
40 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
44 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
45 echo "<form action=\"index.php\" method=\"post\">\n";
46 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
47 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
48 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
49 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
50 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
51 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
52 echo " <input type=\"hidden\" name=\"call\" value=\"".$RULES["call"]."\" />\n";
53 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
54 echo " <input type=\"submit\" value=\"keep playing\" />\n";
60 function output_form_for_new_game($names)
64 <p>Please select four players (or use the randomly pre-selected names)</p>
65 <form action="index.php" method="post">
67 /* ask for player names */
68 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
70 srand((float) microtime() * 10000000);
71 $randkey = array_rand($names);
72 $rand = $names[$randkey];
73 echo " Name: <select name=\"$player\" size=\"1\" /> \n";
74 foreach($names as $name)
78 echo " <option selected=\"selected\">$name</option>\n";
81 echo " <option>$name</option>\n";
87 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
90 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
91 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
92 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
95 <p> schweinchen (both foxes), only in normal games or silent solos:
97 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
98 <li> <input type="radio" name="schweinchen" value="both" />
99 both become highest trump (automatic call at beginning of the game)
101 <li> <input type="radio" name="schweinchen" value="second" />
102 first one normal, second one becomes highest (call during the game) </li>
103 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
104 second one become highest only in case re/contra was announced (not working yet)
108 <p> Call Re/Contra, etc.:
110 <li><input type="radio" name="call" value="1st-own-card" checked="checked" />
111 Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
112 <li><input type="radio" name="call" value="5th-card" />
113 Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
114 <li><input type="radio" name="call" value="9-cards" />
115 Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
118 <input type="submit" value="start game" />
123 function display_card($card,$dir="english")
125 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
126 * convert even cards to the matching odd value */
128 if( $card/2 - (int)($card/2) == 0.5)
129 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" />\n";
131 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" />\n";
136 function display_link_card($card,$dir="english",$type="card")
138 if( $card/2 - (int)($card/2) == 0.5)
139 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";
141 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";
145 function output_check_for_sickness($me,$mycards)
148 <form action="index.php" method="post">
150 do you want to play solo?
151 <select name="solo" size="1">
152 <option selected="selected">No</option>
153 <option>trumpless</option>
154 <option>trump</option>
155 <option>queen</option>
156 <option>jack</option>
157 <option>club</option>
158 <option>spade</option>
159 <option>heart</option>
166 if(check_wedding($mycards))
168 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
169 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
173 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
176 echo "Do you have poverty?";
177 if(count_trump($mycards)<4)
179 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
180 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
184 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
187 echo "Do you have too many nines?";
188 if(count_nines($mycards)>4)
190 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
191 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
195 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
198 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
199 echo "<input type=\"submit\" value=\"count me in\" />\n";
206 function output_form_calls($me)
208 if( can_call(120,$me) )
209 echo " re/contra (120):".
210 " <input type=\"radio\" name=\"call120\" value=\"yes\" /> <br />";
211 if( can_call(90,$me) )
213 " <input type=\"radio\" name=\"call90\" value=\"yes\" /> <br />";
214 if( can_call(60,$me) )
216 " <input type=\"radio\" name=\"call60\" value=\"yes\" /> ";
217 if( can_call(30,$me) )
219 " <input type=\"radio\" name=\"call30\" value=\"yes\" /> ";
220 if( can_call(0,$me) )
222 " <input type=\"radio\" name=\"call0\" value=\"yes\" /> ".
224 " <input type=\"radio\" name=\"call0\" value=\"no\" /> ";
228 function output_check_want_to_play($me)
231 <form action="index.php" method="post">
232 Do you want to play a game of DoKo?
233 yes<input type="radio" name="in" value="yes" />
234 no<input type="radio" name="in" value="no" /> <br />
236 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
238 echo "<input type=\"submit\" value=\"count me in\" />\n";
244 function output_home_page($pre,$game,$done,$avgtime)
247 <p> If you want to play a game of Doppelkopf, you found the right place ;) </p>
250 echo "<p> At the moment there are no games that are being started ";
252 echo "<p> At the moment there is one games that is being started ";
254 echo "<p> At the moment there are $pre games that are being started ";
259 echo "zero games that are ongoing. ";
261 echo "one game that is ongoing. ";
263 echo "$game games that are ongoing. ";
268 echo "No game has been completed on this server. </p>";
270 echo "One game has been completed on this server. </p>";
272 echo "$done games have been completed on this server. Average time of a game: $avgtime days</p>";
275 <p> Please <a href="register.php">register</a>, in case you haven't done that yet <br />
276 or login with you email-address or name and password here:
278 <form action="index.php" method="post">
280 <legend>Login</legend>
283 <td><label for="email">Email:</label></td>
284 <td><input type="text" id="email" name="email" size="20" maxlength="30" /> </td>
286 <td><label for="password">Password:</label></td>
287 <td><input type="password" id="password" name="password" size="20" maxlength="30" /></td>
289 <td> <input type="submit" class="submitbutton" name="login" value="login" /></td>
290 <td> <input type="submit" class="submitbutton" name="forgot" value="Forgot your password?" /></td>
300 function output_header()
304 <!DOCTYPE html PUBLIC
305 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
306 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
307 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
309 <title>e-Doko</title>
310 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
311 <link rel="stylesheet" type="text/css" href="css/standard.css" />
312 <script type="text/javascript">
314 if(document.getElementById){
317 if(document.getElementById("trick"+i))
318 document.getElementById("trick"+i).style.display = 'none';
320 document.getElementById("trick"+num).style.display = 'block';
323 function high_last(){
324 if(document.getElementById){
327 if(document.getElementById("trick"+i))
337 <body onload="high_last();">
339 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
346 function output_footer()
350 echo "<div class=\"footer\">\n";
351 echo "<p class=\"left\"> copyright 2006-2007 Arun Persaud <br />\n".
352 "Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />".
353 "- ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />".
354 "a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
355 echo "<p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">".
356 "via git </a> <br />or download the source via <br />'git clone http://nubati.net/git/e-DoKo.git' <br />".
357 "<a href=\"http://www.dreamhost.com/green.cgi\">".
358 "<img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
359 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>".
370 function output_status($name)
372 echo "<div class=\"status\">\n";
374 echo " <a href=\"index.php?logout=1\">logout</a>\n";
381 function output_password_recovery($email,$password)
384 <form action="index.php" method="post">
386 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
387 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
388 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
391 <legend>Password recovery</legend>
394 <td><label for="email">Old password:</label></td>
395 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
397 <td><label for="password">New password:</label></td>
398 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
400 <td><label for="password">Retype:</label></td>
401 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
404 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>