From 95b72fab501b778555252b005ea8618a3305ad4c Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sat, 24 May 2008 13:33:55 -0700 Subject: [PATCH] NEW FEATURE: automatically accept new games user can set this in the preferences now and won't be asked during a game setup Signed-off-by: Arun Persaud --- include/db.php | 13 ++++++++++ include/game.php | 8 ++++-- include/preferences.php | 54 ++++++++++++++++++++++++++++++++++------- 3 files changed, 64 insertions(+), 11 deletions(-) diff --git a/include/db.php b/include/db.php index 208334f..c8750b4 100644 --- a/include/db.php +++ b/include/db.php @@ -705,6 +705,19 @@ function DB_get_PREF($myid) else $PREF["email"]="emailnonaddict"; + /* Autosetup */ + $r = DB_query_array("SELECT value FROM User_Prefs". + " WHERE user_id='$myid' AND pref_key='autosetup'" ); + if($r) + { + if($r[0]=='yes') + $PREF['autosetup']='yes'; + else + $PREF['autosetup']='no'; + } + else + $PREF['autosetup']='no'; + return $PREF; } diff --git a/include/game.php b/include/game.php index 4dbf68f..3540be4 100644 --- a/include/game.php +++ b/include/game.php @@ -142,7 +142,11 @@ display_table(); switch($mystatus) { case 'start': - if( !myisset("in") ) + /* don't ask if user has autosetup set to yest */ + $skip = 0; + if($PREF['autosetup']=='yes') $skip = 1; + + if( !myisset("in") && !$skip) { /* asks the player, if he wants to join the game */ output_check_want_to_play($me); @@ -151,7 +155,7 @@ switch($mystatus) else { /* check the result, if player wants to join, got next stage, else cancel game */ - if($_REQUEST["in"] == "no") + if($_REQUEST["in"] == "no" && !$skip) { /* cancel the game */ $message = "Hello, \n\n". diff --git a/include/preferences.php b/include/preferences.php index 3e25d31..8a6050d 100644 --- a/include/preferences.php +++ b/include/preferences.php @@ -1,5 +1,5 @@ \n"; } echo " \n"; if($changed_notify) echo "changed"; -echo " \n"; +echo " \n"; +echo " Autosetup: "; + +echo " \n"; +if($changed_autosetup) echo "changed"; +echo " \n"; echo " Card set: "; echo " \n"; } echo " \n"; if($changed_cards) echo "changed"; -echo " \n"; +echo " \n"; echo " Password(old): ", ""; switch($changed_password) @@ -168,7 +204,7 @@ echo " \n"; echo " \n"; echo " \n"; -echo "\n"; +echo "\n"; output_footer(); DB_close(); -- 2.25.1