NEW FEATURE: new sorting algorithm
[e-DoKo.git] / include / db.php
index 1e18f95f007a538d4136b6b9055e0ac3f99994c3..de549a5bd68a438f39b28c14cc603ac74af2b066 100644 (file)
@@ -729,6 +729,14 @@ function DB_get_PREF($myid)
   else
     $PREF['autosetup']='no';
 
+  /* Sorting */
+  $r = DB_query_array("SELECT value FROM User_Prefs".
+                     " WHERE user_id='$myid' AND pref_key='sorting'" );
+  if($r)
+    $PREF['sorting'] = $r[0];
+  else
+    $PREF['sorting']='high-low';
+
   return $PREF;
 }
 
@@ -1102,5 +1110,13 @@ function DB_get_exchanged_cards($hash)
   return $cards;
 }
 
-
+function DB_played_by_others($gameid)
+{
+  $gameids = array();
+  $result = DB_query("SELECT id FROM Game WHERE randomnumbers=(SELECT randomnumbers from Game where id=$gameid) and status='gameover'");
+  while($r = DB_fetch_array($result))
+    if($r[0]!=$gameid)
+      $gameids[]=$r[0];
+  return $gameids;
+}
 ?>
\ No newline at end of file