LAYOUT: make html standard conform in debug mode
[e-DoKo.git] / include / functions.php
index 9f58f51f969fb610a024637213c5ff9cdd726d5a..7b29a28fe311dbd12e27fd1e2af53d1a6250cc5d 100644 (file)
@@ -734,7 +734,7 @@ function display_table ()
       if(!$debug)
        echo "   $name \n";
       else
       if(!$debug)
        echo "   $name \n";
       else
-       echo "   <a href=\"".$INDEX."?action=game&me=".$hash."\">$name</a>\n";
+       echo "   <a href=\"".$INDEX."?action=game&amp;me=".$hash."\">$name</a>\n";
 
       /* add hints for poverty, wedding, solo, etc */
       if( $gametype != "solo")
 
       /* add hints for poverty, wedding, solo, etc */
       if( $gametype != "solo")
@@ -854,17 +854,18 @@ function display_user_menu()
                     " AND Game.player='$myid'".
                     " AND Game.status<>'gameover'".
                     " ORDER BY Game.session" );
                     " AND Game.player='$myid'".
                     " AND Game.status<>'gameover'".
                     " ORDER BY Game.session" );
-  if(DB_num_rows($result))
-      echo "It's your turn in these games:<br />\n";
 
   $i=0;
   while( $r = DB_fetch_array($result))
     {
       if($i==0)
 
   $i=0;
   while( $r = DB_fetch_array($result))
     {
       if($i==0)
-       echo "<div class=\"usermenu\">\n";
-
+       {
+         echo "<div class=\"usermenu\">\n";
+         echo "It's your turn in these games:<br />\n";
+       }
+      
       $i++;
       $i++;
-      echo "<a href=\"".$INDEX."?action=game&me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
+      echo "<a href=\"".$INDEX."?action=game&amp;me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
       if($i>4)
        {
          echo "...<br />\n";
       if($i>4)
        {
          echo "...<br />\n";
@@ -934,6 +935,8 @@ function generate_score_table($session)
 
 function generate_global_score_table()
 {
 
 function generate_global_score_table()
 {
+  $return = array();
+
   /* get all ids */
   $gameids = DB_get_gameids_of_finished_games_by_session(0);
 
   /* get all ids */
   $gameids = DB_get_gameids_of_finished_games_by_session(0);
 
@@ -967,7 +970,6 @@ function generate_global_score_table()
        }
     }
 
        }
     }
 
-  echo "<table>\n <tr>\n";
   function cmp($a,$b)
   {
     if($a['nr']==0 ) return 1;
   function cmp($a,$b)
   {
     if($a['nr']==0 ) return 1;
@@ -981,14 +983,15 @@ function generate_global_score_table()
     return ($a > $b) ? -1 : 1;
   }
   usort($player,"cmp");
     return ($a > $b) ? -1 : 1;
   }
   usort($player,"cmp");
+
   foreach($player as $pl)
     {
   foreach($player as $pl)
     {
+      /* limit to players with at least 10 games */
       if($pl['nr']>10)
       if($pl['nr']>10)
-       echo "  <tr><td>",$pl['name'],"</td><td>",round($pl['points']/$pl['nr'],3),"</td></tr>\n";
+       $return[] = array( $pl['name'], round($pl['points']/$pl['nr'],3) );
     }
     }
-  echo "</table>\n";
 
 
-  return;
+  return $return;
 }
 
 
 }