summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/db.php13
-rw-r--r--include/game.php8
-rw-r--r--include/preferences.php54
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 @@
<?php
-/* make sure that we are not called from outside the scripts,
+/* make sure that we are not called from outside the scripts,
* use a variable defined in config.php to check this
*/
if(!isset($HOST))
@@ -12,10 +12,11 @@ if(!$myid)
return;
/* track what got changed */
-$changed_notify = 0;
-$changed_password = 0;
-$changed_cards = 0;
-$changed_timezone = 0;
+$changed_notify = 0;
+$changed_password = 0;
+$changed_cards = 0;
+$changed_timezone = 0;
+$changed_autosetup = 0;
output_status();
display_user_menu();
@@ -74,6 +75,25 @@ if(myisset("notify"))
}
}
+if(myisset("autosetup"))
+ {
+ $autosetup = $_REQUEST['autosetup'];
+ if($autosetup != $PREF['autosetup'])
+ {
+ /* check if we already have an entry for the user, if so change it, if not create new one */
+ $result = DB_query("SELECT * from User_Prefs".
+ " WHERE user_id='$myid' AND pref_key='autosetup'" );
+ if( DB_fetch_array($result))
+ $result = DB_query("UPDATE User_Prefs SET value=".DB_quote_smart($autosetup).
+ " WHERE user_id='$myid' AND pref_key='autosetup'" );
+ else
+ $result = DB_query("INSERT INTO User_Prefs VALUES(NULL,'$myid','autosetup',".
+ DB_quote_smart($autosetup).")");
+ $changed_autosetup=1;
+ }
+ }
+
+
if(myisset("password0") && $_REQUEST["password0"]!="" )
{
$changed_password = 1;
@@ -87,7 +107,7 @@ if(myisset("password0") && $_REQUEST["password0"]!="" )
/* check if new passwords are types the same twice */
if($_REQUEST["password1"] != $_REQUEST["password2"] )
$changed_password = -2;
-
+
if($changed_password==1)
{
DB_query("UPDATE User SET password='".md5($_REQUEST["password1"]).
@@ -126,7 +146,23 @@ echo " <select id=\"notify\" name=\"notify\" size=\"1\">\n";
}
echo " </select>\n";
if($changed_notify) echo "changed";
-echo " </td></tr>\n";
+echo " </td></tr>\n";
+echo " <tr><td>Autosetup: </td><td>";
+
+echo " <select id=\"autosetup\" name=\"autosetup\" size=\"1\">\n";
+ if($PREF['autosetup']=="yes")
+ {
+ echo " <option value=\"yes\" selected=\"selected\">accept every game</option>\n";
+ echo " <option value=\"no\">ask for games</option>\n";
+ }
+ else
+ {
+ echo " <option value=\"yes\">accept every game</option>\n";
+ echo " <option value=\"no\" selected=\"selected\">ask for games</option>\n";
+ }
+ echo " </select>\n";
+if($changed_autosetup) echo "changed";
+echo " </td></tr>\n";
echo " <tr><td>Card set: </td><td>";
echo " <select id=\"cards\" name=\"cards\" size=\"1\">\n";
@@ -142,7 +178,7 @@ echo " <select id=\"cards\" name=\"cards\" size=\"1\">\n";
}
echo " </select>\n";
if($changed_cards) echo "changed";
-echo " </td></tr>\n";
+echo " </td></tr>\n";
echo " <tr><td>Password(old): </td><td>",
"<input type=\"password\" id=\"password0\" name=\"password0\" size=\"20\" maxlength=\"30\" />";
switch($changed_password)
@@ -168,7 +204,7 @@ echo " <tr><td><input type=\"submit\" class=\"submitbutton\" name=\"passwd\"
"<td></td></tr>\n";
echo " </table>\n";
echo " </form>\n";
-echo "</div>\n";
+echo "</div>\n";
output_footer();
DB_close();