2 /* make sure that we are not called from outside the scripts,
3 * use a variable defined in config.php to check this
8 /* functions which only ouput html */
10 function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
14 echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
15 echo "Do you want to continue playing?(This will start a new game, with the next person as dealer.)\n";
16 echo " <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
17 echo " <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
18 echo " <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
19 echo " <input type=\"hidden\" name=\"PlayerD\" value=\"$playerD\" />\n";
20 echo " <input type=\"hidden\" name=\"dullen\" value=\"".$RULES["dullen"]."\" />\n";
21 echo " <input type=\"hidden\" name=\"schweinchen\" value=\"".$RULES["schweinchen"]."\" />\n";
22 echo " <input type=\"hidden\" name=\"callrule\" value=\"".$RULES["call"]."\" />\n";
23 echo " <input type=\"hidden\" name=\"followup\" value=\"$oldgameid\" />\n";
24 echo " <input type=\"submit\" value=\"keep playing\" />\n";
25 echo "</form>\n</div>";
29 function output_form_for_new_game($names)
32 <form action="index.php?action=new" method="post">
33 <h2> Select players (Remember: you need to be one of the players) </h2>
36 <img class="table" src="pics/table.png" alt="table" />
38 /* ask for player names */
40 foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player)
42 srand((float) microtime() * 10000000);
43 $randkey = array_rand($names);
44 $rand = $names[$randkey];
45 echo "<div class=\"table".$i."\">\n";
47 echo " <select name=\"$player\" size=\"1\" /> \n";
48 foreach($names as $name)
52 echo " <option selected=\"selected\">$name</option>\n";
55 echo " <option>$name</option>\n";
57 echo " </select>\n</div>\n";
62 <h2 class="rules"> Rules </h2>
63 <p> Some areas are grayed out which means that the rule is not implemented yet and therefore cannot be selected </p>
66 <li> <input type="radio" name="dullen" value="none" /> just normal non-trump </li>
67 <li> <input type="radio" name="dullen" value="firstwins" /> first ten of hearts wins the trick </li>
68 <li> <input type="radio" name="dullen" value="secondwins" checked="checked" /> second ten of hearts wins the trick </li>
71 <p> Schweinchen (both foxes), only in normal games or silent solos:
73 <li> <input type="radio" name="schweinchen" value="none" checked="checked" /> none </li>
74 <li> <input type="radio" name="schweinchen" value="both" />
75 both become highest trump (automatic call at beginning of the game)
77 <li> <input type="radio" name="schweinchen" value="second" />
78 first one normal, second one becomes highest (call during the game) </li>
79 <li> <input type="radio" name="schweinchen" value="secondaftercall" disabled="disabled" />
80 second one become highest only in case re/contra was announced (not working yet)
84 <p> Call Re/Contra, etc.:
86 <li><input type="radio" name="callrule" value="1st-own-card" checked="checked" />
87 Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</li>
88 <li><input type="radio" name="callrule" value="5th-card" />
89 Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</li>
90 <li><input type="radio" name="callrule" value="9-cards" />
91 Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</li>
94 <input type="submit" value="start game" />
99 function display_card($card,$dir="english")
101 /* cards are only availabl for the odd values, e.g. 1.png, 3.png, ...
102 * convert even cards to the matching odd value */
104 if( $card/2 - (int)($card/2) == 0.5)
105 echo "<img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" />\n";
107 echo "<img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" />\n";
112 function display_link_card($card,$dir="english",$type="card")
114 if( $card/2 - (int)($card/2) == 0.5)
115 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";
117 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";
121 function output_check_for_sickness($me,$mycards)
124 <div class="sickness"> Thanks for joining the game...<br />
126 do you want to play solo?
127 <select name="solo" size="1">
128 <option selected="selected">No</option>
129 <option>trumpless</option>
130 <option>trump</option>
131 <option>queen</option>
132 <option>jack</option>
133 <option>club</option>
134 <option>spade</option>
135 <option>heart</option>
142 if(check_wedding($mycards))
144 echo " yes<input type=\"radio\" name=\"wedding\" value=\"yes\" checked=\"checked\" />";
145 echo " no <input type=\"radio\" name=\"wedding\" value=\"no\" /> <br />\n";
149 echo " no <input type=\"hidden\" name=\"wedding\" value=\"no\" /> <br />\n";
152 echo "Do you have poverty?";
153 if(count_trump($mycards)<4)
155 echo " yes<input type=\"radio\" name=\"poverty\" value=\"yes\" checked=\"checked\" />";
156 echo " no <input type=\"radio\" name=\"poverty\" value=\"no\" /> <br />\n";
160 echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
163 echo "Do you have too many nines?";
164 if(count_nines($mycards)>4)
166 echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
167 echo " no <input type=\"radio\" name=\"nines\" value=\"no\" /> <br />\n";
171 echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
174 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
175 echo "<input type=\"submit\" value=\"count me in\" />\n";
182 function output_form_calls($me)
184 if( can_call(120,$me) )
185 echo " re/contra (120):".
186 " <input type=\"radio\" name=\"call\" value=\"120\" /> <br />";
187 if( can_call(90,$me) )
189 " <input type=\"radio\" name=\"call\" value=\"90\" /> <br />";
190 if( can_call(60,$me) )
192 " <input type=\"radio\" name=\"call\" value=\"60\" /> <br />";
193 if( can_call(30,$me) )
195 " <input type=\"radio\" name=\"call\" value=\"30\" /> <br />";
196 if( can_call(0,$me) )
198 " <input type=\"radio\" name=\"call\" value=\"0\" /> <br />".
200 " <input type=\"radio\" name=\"call\" value=\"no\" /> <br />";
203 function output_check_want_to_play($me)
206 <div class="joingame">
207 Do you want to play a game of DoKo? <br />
208 yes<input type="radio" name="in" value="yes" />
209 no<input type="radio" name="in" value="no" /> <br />
211 echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n";
213 echo "<input type=\"submit\" value=\"submit\" />\n";
219 function output_header()
223 <!DOCTYPE html PUBLIC
224 "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
225 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
226 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
228 <title>e-Doko</title>
229 <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
230 <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
231 <link rel="stylesheet" type="text/css" href="css/standard002.css" />
232 <script type="text/javascript">
234 if(document.getElementById){
237 if(document.getElementById("trick"+i))
238 document.getElementById("trick"+i).style.display = 'none';
240 document.getElementById("trick"+num).style.display = 'block';
243 function high_last(){
244 if(document.getElementById){
247 if(document.getElementById("trick"+i))
257 <body onload="high_last();">
259 <h1> Welcome to E-Doko <sup style="color:#888;">(beta)</sup> </h1>
263 echo "<div class=\"main\">";
267 function output_footer()
272 echo "<div class=\"footer\">\n";
273 echo " <p class=\"left\"> copyright 2006-2008 Arun Persaud, Lance Thornton <br />\n".
274 " Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n".
275 " - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n".
276 " a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n";
277 echo " <p class=\"right\"> See the latest changes <a href=\"http://nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=summary\">\n".
278 " via git </a> <br />or download the source via <br />\n'git clone http://nubati.net/git/e-DoKo.git' <br />\n".
279 " <a href=\"http://www.dreamhost.com/green.cgi\">\n".
280 " <img border=\"0\" alt=\"Green Web Hosting! This site hosted by DreamHost.\"".
281 "src=\"https://secure.newdream.net/green1.gif\" height=\"32\" width=\"100\" /></a>\n".
292 function output_status()
294 global $defaulttimezone;
295 if(isset($_SESSION["name"]))
297 $name = $_SESSION["name"];
300 echo "\n<div class=\"status\">";
302 echo " <a href=\"index.php?action=logout\">logout</a>";
305 /* last logon time */
306 $myid = DB_get_userid("name",$name);
307 $zone = DB_get_user_timezone($myid);
309 $time = DB_get_user_timestamp($myid);
310 date_default_timezone_set($defaulttimezone);
311 $unixtime = strtotime($time);
312 date_default_timezone_set($zone);
314 echo "<div class=\"lastlogin\">last login: ".date("r",$unixtime)."</div>\n";
319 function output_select_timezone($name,$timezone="")
321 $Tzone = array ( "Europe/London" => "London",
322 "Europe/Berlin" => "Berlin",
323 "America/Vancouver" => "Berkeley",
324 "Pacific/Auckland" => "Wellington" );
326 echo " <select id=\"$name\" name=\"$name\" size=\"1\">\n";
328 foreach($Tzone as $zone=>$city)
331 echo " <option value=\"$zone\" selected=\"selected\">$city</option>\n";
333 echo " <option value=\"$zone\">$city</option>\n";
342 function output_password_recovery($email,$password)
345 <form action="index.php" method="post">
347 echo " <input type=\"hidden\" name=\"email\" value=\"".$email."\" />\n";
348 echo " <input type=\"hidden\" name=\"password\" value=\"".$password."\" />\n";
349 echo " <input type=\"hidden\" name=\"passwd\" value=\"set\" />\n";
352 <legend>Password recovery</legend>
355 <td><label for="email">Old password:</label></td>
356 <td><input type="password" id="password0" name="password0" size="20" maxlength="30" /> </td>
358 <td><label for="password">New password:</label></td>
359 <td><input type="password" id="password1" name="password1" size="20" maxlength="30" /></td>
361 <td><label for="password">Retype:</label></td>
362 <td><input type="password" id="password2" name="password2" size="20" maxlength="30" /></td>
365 <td> <input type="submit" class="submitbutton" name="passwd" value="set" /></td>