- /* Cardset */
- $r = DB_query_array("SELECT value from User_Prefs".
- " WHERE user_id='$myid' AND pref_key='cardset'" );
- if($r)
- {
- /* licence only valid until then */
- if($r[0]=="altenburg" && (time()-strtotime( "2009-12-31 23:59:59")<0) )
- $PREF["cardset"]="altenburg";
- else
- $PREF["cardset"]="english";
- }
- else
- $PREF["cardset"]="english";
-
- /* Email */
- $r = DB_query_array("SELECT value FROM User_Prefs".
- " WHERE user_id='$myid' AND pref_key='email'" );
- if($r)
- {
- if($r[0]=="emailaddict")
- $PREF["email"]="emailaddict";
- else
- $PREF["email"]="emailnonaddict";
- }
- else
- $PREF["email"]="emailnonaddict";
-
- /* Autosetup */
- $r = DB_query_array("SELECT value FROM User_Prefs".
- " WHERE user_id='$myid' AND pref_key='autosetup'" );
- if($r)
+ /* set defaults */
+ $PREF['cardset'] = 'english';
+ $PREF['email'] = 'emailnonaddict';
+ $PREF['autosetup'] = 'no';
+ $PREF['sorting'] = 'high-low';
+ $PREF['open_for_games'] = 'yes';
+ $PREF['vacation_start'] = NULL;
+ $PREF['vacation_stop'] = NULL;
+ $PREF['vacation_comment'] = '';
+
+ /* get all preferences */
+ $r = DB_query('SELECT pref_key, value FROM User_Prefs'.
+ " WHERE user_id='$myid' " );
+ while($pref = DB_fetch_array($r) )