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