diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/about.php | 68 | ||||
-rw-r--r-- | include/game.php | 56 | ||||
-rw-r--r-- | include/newgame.php | 3 | ||||
-rw-r--r-- | include/output.php | 47 | ||||
-rw-r--r-- | include/preferences.php | 60 | ||||
-rw-r--r-- | include/user.php | 37 |
6 files changed, 195 insertions, 76 deletions
diff --git a/include/about.php b/include/about.php new file mode 100644 index 0000000..ad39eaf --- /dev/null +++ b/include/about.php @@ -0,0 +1,68 @@ +<?php +/* Copyright 2010 Arun Persaud <arun@nubati.net> + * + * This file is part of e-DoKo. + * + * e-DoKo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * e-DoKo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with e-DoKo. If not, see <http://www.gnu.org/licenses/>. + * + */ + +/* make sure that we are not called from outside the scripts, + * use a variable defined in config.php to check this + */ +if(!isset($HOST)) + exit; + +echo ' +<div class="about"> + +<div class="code"> +<h3>Coding</h3> + <ul> + <li> Arun Persaud </li> + <li> Sean Brennan </li> + </ul> +</div> + +<div class="database"> +<h3>Database support</h3> + <ul> + <li> Arun Persaud </li> + <li> Jeff Zerger</li> + </ul> +</div> + +<div class="graphics"> +<h3> Graphics </h3> + <ul> + <li> Lance Thornton </li> + <li> Frances Allen </li> + <li> Arun Persaud </li> + </ul> +</div> + +<div class="translation"> +<h3>Translation</h3> + <ul> + <li> German + <ul> + <li> Arun Persaud </li> + <li> BK </li> + </ul> + </li> + </ul> +</div> +</div> +' +?> diff --git a/include/game.php b/include/game.php index bd25e78..04df162 100644 --- a/include/game.php +++ b/include/game.php @@ -531,7 +531,7 @@ switch($mystatus) $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ + /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ echo "\n<ul class=\"tricks\">\n"; echo " <li class=\"nohighlight\"> Game ".DB_format_gameid($gameid).": </li>\n"; echo " <li onclick=\"hl('0');\" class=\"current\"><a href=\"#\">Pre</a>\n". @@ -1291,17 +1291,19 @@ switch($mystatus) echo ' <li class="nohighlight"> '._('Game').' '.DB_format_gameid($gameid).": </li>\n"; /* output vorbehalte */ - $mygametype = DB_get_gametype_by_gameid($gameid); - if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */ - { - echo " <li onclick=\"hl('0');\" class=\"current\"><a href=\"#\">Pre</a>\n". - " <div class=\"trick\" id=\"trick0\">\n"; + $mygametype = DB_get_gametype_by_gameid($gameid); + $mygamesolo = DB_get_solo_by_gameid($gameid); + if($mygametype != 'normal') /* only show when needed */ + if(!( $mygametype == 'solo' && $mygamesolo == 'silent') ) + { + echo " <li onclick=\"hl('0');\" class=\"current\"><a href=\"#\">Pre</a>\n". + " <div class=\"trick\" id=\"trick0\">\n"; - /* get information so show the cards that have been handed over in a poverty game */ - output_exchanged_cards(); + /* get information so show the cards that have been handed over in a poverty game */ + output_exchanged_cards(); - echo " </div>\n </li>\n"; /* end div trick, end li trick */ - } + echo " </div>\n </li>\n"; /* end div trick, end li trick */ + } /* output tricks */ while($r = DB_fetch_array($result)) @@ -1988,6 +1990,38 @@ switch($mystatus) if(have_suit($mycards,$firstcard)) $followsuit = 1; + /* count how many cards we can play, so that we can pre-select it if there is only one */ + $howmanycards = 0; + foreach($mycards as $card) + { + if($howmanycard>1) + break; + + /* display only cards that the player is allowed to play as links, the rest just display normal + * also check if we have both schweinchen, in that case only display on of them as playable + */ + if( ($followsuit && !same_type($card,$firstcard)) || + ( (int)($card)==19 && + !$GAME['schweinchen-first'] && + ( $RULES['schweinchen']=='second' || + ( $RULES['schweinchen']=='secondaftercall' && + (DB_get_call_by_hash($GAME['schweinchen-who']) || + DB_get_partner_call_by_hash($GAME['schweinchen-who']) ) + ) + ) && + $GAME['schweinchen-who']==$me && + in_array($gametype,array('normal','wedding','trump','silent')) + ) + ) + continue ; + else + $howmanycards++; + } + if($howmanycards==1) + $howmanycards=1; + else + $howmanycards=0; + foreach($mycards as $card) { /* display only cards that the player is allowed to play as links, the rest just display normal @@ -2008,7 +2042,7 @@ switch($mystatus) ) display_card($card,$PREF['cardset']); else - display_link_card($card,$PREF['cardset']); + display_link_card($card,$PREF['cardset'],$selected=$howmanycards); } } else if($mystatus=='play' ) diff --git a/include/newgame.php b/include/newgame.php index f06bebe..4e9deaf 100644 --- a/include/newgame.php +++ b/include/newgame.php @@ -191,8 +191,7 @@ else /* send out email, TODO: check for error with email */ $message = "You are invited to play a game of DoKo.\n". - "Please, place comments and bug reports here:\n". - "http://wiki.nubati.net/index.php?title=EmailDoko\n\n". + "Please, place comments and bug reports here:\n$WIKI\n\n". "The whole round would consist of the following players:\n". "$PlayerA\n". "$PlayerB\n". diff --git a/include/output.php b/include/output.php index a4b84a0..0c2ff96 100644 --- a/include/output.php +++ b/include/output.php @@ -202,12 +202,15 @@ function display_card($card,$dir="english") return; } -function display_link_card($card,$dir="english",$type="card") +function display_link_card($card,$dir="english",$type="card", $selected=0) { + if($selected) + $selected = 'selected="selected"'; + if( $card/2 - (int)($card/2) == 0.5) - echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></div>\n"; + echo "<div class=\"cardinput\"><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" $selected /><img src=\"cards/".$dir."/".$card.".png\" alt=\"".DB_get_card_name($card)."\" /></div>\n"; else - echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></div>\n"; + echo "<div class=\"cardinput\" ><input type=\"radio\" name=\"".$type."\" value=\"".$card."\" $selected /><img src=\"cards/".$dir."/".($card-1).".png\" alt=\"".DB_get_card_name($card-1)."\" /></div>\n"; return; } @@ -219,14 +222,14 @@ function output_check_for_sickness($me,$mycards) echo ''; echo ' '._('Do you want to play solo?').''; echo ' <select name="solo" size="1">'; - echo ' <option selected="selected">'.'No'.'</option>'; - echo ' <option>'.'trumpless'.'</option>'; - echo ' <option>'.'trump'.'</option>'; - echo ' <option>'.'queen'.'</option>'; - echo ' <option>'.'jack'.'</option>'; - echo ' <option>'.'club'.'</option>'; - echo ' <option>'.'spade'.'</option>'; - echo ' <option>'.'heart'.'</option>'; + echo ' <option value="No" selected="selected">'.'No'.'</option>'; + echo ' <option value="trumpless">'._('trumpless').'</option>'; + echo ' <option value="trump">'._('trump').'</option>'; + echo ' <option value="queen">'._('queen').'</option>'; + echo ' <option value="jack">'._('jack').'</option>'; + echo ' <option value="club">'._('club').'</option>'; + echo ' <option valvue="spade">'._('spade').'</option>'; + echo ' <option value="hear">'._('heart').'</option>'; echo ' </select>'; echo ' <br />'; @@ -376,24 +379,36 @@ function output_header() <title>e-Doko</title> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" /> <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" /> - <link rel="stylesheet" type="text/css" href="css/standard025.css" /> - <script type="text/javascript" src="include/game.js"> </script> + <link rel="stylesheet" type="text/css" href="css/standard028.css" /> <script type="text/javascript" src="include/jquery.js"> </script> <script type="text/javascript" src="include/jquery.tablesorter.js"></script> + <script type="text/javascript" src="include/game.js"> </script> <script type="text/javascript"> $(document).ready(function() { $("#ScoreTable").tablesorter({ widgets: ['zebra']}); $(".gameshidesession").click( function () { - $(this).parent().children(".gamessession").toggle(300); + $(this).parent().children(".gamessession").hide(300); + $(this).parent().children(".gamesshowsession").show(); + $(this).hide(); + }); + + $(".gamesshowsession").click( function () { + $(this).parent().children(".gamessession").show(300); + $(this).parent().children(".gameshidesession").show(); + $(this).hide(); }); $(".gameshowall").click( function () { $(".gamessession").show(300); + $(".gamesshowsession").hide(); + $(".gameshidesession").show(); }); $(".gamehideall").click( function () { $(".gamessession").hide(300); + $(".gamesshowsession").show(); + $(".gameshidesession").hide(); }); @@ -414,11 +429,11 @@ function output_header() function output_footer() { - global $REV,$PREF; + global $REV, $PREF, $INDEX; echo "</div>\n\n"; echo "<div class=\"footer\">\n"; - echo " <p class=\"left\"> copyright 2006,2007,2008,2009,2010 Arun Persaud, Lance Thornton(graphics), Jeff Zerger(database support) <br />\n". + echo " <p class=\"left\"> copyright 2006,2007,2008,2009,2010 <a href=\"$INDEX?action=about\">Arun Persaud, et al.</a> <br />\n". " Verwendung der [deutschen] Kartenbilder mit Genehmigung <br />der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger <br />\n". " - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH <br />\n". " a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com</p>\n"; diff --git a/include/preferences.php b/include/preferences.php index 3a841c3..0485d9e 100644 --- a/include/preferences.php +++ b/include/preferences.php @@ -337,12 +337,12 @@ if($PREF['vacation_start']) $value = substr($PREF['vacation_start'],0,10); else $value = ''; -echo " <td>start:<input type=\"text\" id=\"vacation_start\" name=\"vacation_start\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n"; +echo " <td>"._('start').":<input type=\"text\" id=\"vacation_start\" name=\"vacation_start\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n"; if($PREF['vacation_stop']) $value = substr($PREF['vacation_stop'],0,10); else $value = ''; -echo " <td>stop:<input type=\"text\" id=\"vacation_stop\" name=\"vacation_stop\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n"; +echo " <td>"._('stop').":<input type=\"text\" id=\"vacation_stop\" name=\"vacation_stop\" size=\"10\" maxlength=\"10\" value=\"$value\" /></td>\n"; if($PREF['vacation_comment']) $value = $PREF['vacation_comment']; else @@ -351,8 +351,8 @@ echo ' <td>'._('comment:')."<input type=\"text\" id=\"vacation_commen if($changed_vacation == 1) echo _('changed'); if($changed_vacation == -1) echo _('wrong date format'); echo "</td></tr>\n"; -echo "<tr><td></td><td>use YYYY-MM-DD</td><td>use '-' in start field to unset vacation</td></tr>\n"; -echo " <tr><td>Notification: </td><td>\n"; +echo '<tr><td></td><td>'._('use YYYY-MM-DD').'</td><td>'._("use '-' in start field to unset vacation")."</td></tr>\n"; +echo ' <tr><td>'._('Notification').": </td><td>\n"; echo " <select id=\"notify\" name=\"notify\" size=\"1\">\n"; if($PREF['email']=="emailaddict") { @@ -368,13 +368,13 @@ echo " </select>"; if($changed_notify) echo _('changed'); echo " </td></tr>\n"; -echo " <tr><td>Digest: </td><td>\n"; +echo ' <tr><td>'._('Digest').": </td><td>\n"; echo " <select id=\"digest\" name=\"digest\" size=\"1\">\n"; $selected = "selected=\"selected\""; echo " <option value=\"digest-off\""; if($PREF['digest']=="digest-off") echo $selected; -echo ">digest off</option>\n"; +echo '>'._('digest off')."</option>\n"; echo " <option value=\"digest-1h\" "; if($PREF['digest']=="digest-1h") echo $selected; @@ -409,7 +409,7 @@ if($changed_digest) echo _('changed'); echo " </td></tr>\n"; -echo " <tr><td>Autosetup: </td><td>\n"; +echo ' <tr><td>'._('Autosetup').": </td><td>\n"; echo " <select id=\"autosetup\" name=\"autosetup\" size=\"1\">\n"; if($PREF['autosetup']=="yes") { @@ -440,33 +440,33 @@ if($PREF['sorting']=="high-low") echo " </select>"; if($changed_sorting) echo _('changed'); echo " </td></tr>\n"; -echo " <tr><td>Open for new games: </td><td>\n"; +echo ' <tr><td>'._('Open for new games').": </td><td>\n"; echo " <select id=\"open_for_games\" name=\"open_for_games\" size=\"1\">\n"; if($PREF['open_for_games']=="no") { - echo " <option value=\"yes\">yes</option>\n"; + echo " <option value=\"yes\">"._('yes')."</option>\n"; echo " <option value=\"no\" selected=\"selected\">no</option>\n"; } else /* default */ { echo " <option value=\"yes\" selected=\"selected\">yes</option>\n"; - echo " <option value=\"no\">no</option>\n"; + echo " <option value=\"no\">"._('no')."</option>\n"; } echo " </select>"; if($changed_openforgames) echo _('changed'); echo " </td></tr>\n"; -echo " <tr><td>Card set: </td><td>\n"; +echo ' <tr><td>'.('Card set').": </td><td>\n"; echo " <select id=\"cards\" name=\"cards\" size=\"1\">\n"; if($PREF['cardset']=="altenburg") { - echo " <option value=\"altenburg\" selected=\"selected\">German cards</option>\n"; - echo " <option value=\"english\">English cards</option>\n"; + echo " <option value=\"altenburg\" selected=\"selected\">"._('German cards')."</option>\n"; + echo " <option value=\"english\">"._('English cards')."</option>\n"; } else { - echo " <option value=\"altenburg\">German cards</option>\n"; - echo " <option value=\"english\" selected=\"selected\">English cards</option>\n"; + echo " <option value=\"altenburg\">"._('German cards')."</option>\n"; + echo " <option value=\"english\" selected=\"selected\">"._('English cards')."</option>\n"; } echo " </select>"; if($changed_cards) echo _('changed'); @@ -474,45 +474,45 @@ echo " </td></tr>\n"; echo " </table>\n"; echo " </fieldset>\n"; echo " <fieldset>\n"; -echo " <legend>Personal</legend>\n"; +echo ' <legend>'._('Personal')."</legend>\n"; echo " <table>\n"; -echo " <tr><td>Email: </td><td> $email </td></tr>\n"; -echo " <tr><td>Timezone: </td><td>\n"; +echo ' <tr><td>'._('Email').": </td><td> $email </td></tr>\n"; +echo ' <tr><td>'._('Timezone').": </td><td>\n"; output_select_timezone("timezone",$timezone); if($changed_timezone) echo _('changed'); echo "</td></tr>\n"; -echo " <tr><td>Language: </td><td>\n"; +echo ' <tr><td>'._('Language').": </td><td>\n"; output_select_language("language",$PREF['language']); if($changed_language == 1) echo _('changed'); echo "</td></tr>\n"; -echo " <tr><td>Password(old): </td><td>", +echo ' <tr><td>'._('Password(old)').": </td><td>", "<input type=\"password\" id=\"password0\" name=\"password0\" size=\"20\" maxlength=\"30\" />"; switch($changed_password) { case '-3': - echo "The new passwords is not long enough (you need at least 4 characters)."; + echo _('The new passwords is not long enough (you need at least 4 characters).'); break; case '-2': - echo "The new passwords don't match."; + echo _('The new passwords don\'t match.'); break; case '-1': - echo "The old password is not correct."; + echo _('The old password is not correct.'); break; case '1': echo _('changed'); break; } echo " </td></tr>\n"; -echo " <tr><td>Password(new): </td><td>", +echo ' <tr><td>'._('Password(new)').": </td><td>", "<input type=\"password\" id=\"password1\" name=\"password1\" size=\"20\" maxlength=\"30\" />", " </td></tr>\n"; -echo " <tr><td>Password(new, retype): </td><td>", +echo ' <tr><td>'._('Password(new, retype)').": </td><td>", "<input type=\"password\" id=\"password2\" name=\"password2\" size=\"20\" maxlength=\"30\" />", " </td></tr>\n"; echo " </table>\n"; echo " </fieldset>\n"; echo " <fieldset>\n"; -echo " <legend>OpenID</legend>\n"; +echo ' <legend>'._('OpenID')."</legend>\n"; $openids = array(); $openids = DB_GetOpenIDsByUser($myid); @@ -531,14 +531,14 @@ if(sizeof($openids)) echo " </table>\n"; } -echo " add OpenID: ", +echo ' '._('add OpenID').': ', "<input type=\"text\" id=\"openid_url\" name=\"openid_url\" size=\"20\" maxlength=\"50\" />"; if($changed_openid) - echo " Deleted some OpenIDs! <br />\n"; + echo ' '._('Deleted some OpenIDs!')." <br />\n"; echo " </fieldset>\n"; -echo " <fieldset><legend>Submit</legend><input type=\"submit\" name=\"passwd\" value=\"set\" /></fieldset>\n"; +echo ' <fieldset><legend>'._('Submit')."</legend><input type=\"submit\" name=\"passwd\" value=\"set\" /></fieldset>\n"; echo " </form>\n"; -echo " <p>E-DoKo uses <a href=\"http://www.gravatar.org\">gravatars</a> as icons.</p>"; +echo ' <p>'._('E-DoKo uses <a href=\"http://www.gravatar.org\">gravatars</a> as icons.').'</p>'; echo "</div>\n"; return; diff --git a/include/user.php b/include/user.php index 9ac127a..e8d38f7 100644 --- a/include/user.php +++ b/include/user.php @@ -25,20 +25,22 @@ if(!isset($HOST)) exit; /* test id and password, should really be done in one step */ -if(!isset($_SESSION["name"])) +if(!isset($_SESSION['name'])) { - $email = $_REQUEST["email"]; - $password = $_REQUEST["password"]; + $email = $_REQUEST['email']; + $password = $_REQUEST['password']; } else { - $name = $_SESSION["name"]; + $name = $_SESSION['name']; $email = DB_get_email('name',$name); $password = DB_get_passwd_by_name($name); }; +global $ADMIN_NAME; + /* user has forgotten his password */ -if(myisset("forgot")) +if(myisset('forgot')) { /* check if player is in the database */ $ok = 1; @@ -55,16 +57,16 @@ if(myisset("forgot")) /* if less than N recent ones, add a new one and send out email */ if( $number < 5 ) { - echo "Ok, I send you a new password. <br />"; + echo _('Ok, I will send you a new password.').' <br />'; if($number >1) echo "N.B. You tried this already $number times during the last day and it will only work ". " 5 times during a day.<br />"; - echo "The new password will be valid for one day, make sure you reset it to something else.<br />"; + echo _('The new password will be valid for one day, make sure you reset it to something else.').'<br />'; echo "Back to the <a href=\"$INDEX\">main page</a>."; /* create temporary password, use the fist 8 letters of a md5 hash */ $TIME = (string) time(); /* to avoid collisions */ - $hash = md5("Anewpassword".$email.$TIME); + $hash = md5('Anewpassword'.$email.$TIME); $newpw = substr($hash,1,8); $message = "Someone (hopefully you) requested a new password. \n". @@ -83,8 +85,8 @@ if(myisset("forgot")) { /* make it so that people (or a robot) can request thousands of passwords within a short time * and spam a user this way */ - echo "Sorry you already tried 5 times during the last 24h.<br />". - "You need to use one of those passwords or wait to get a new one.<br />"; + echo _('Sorry you already tried 5 times during the last 24h.<br />'. + 'You need to use one of those passwords or wait to get a new one.').'<br />'; echo "Back to the <a href=\"$INDEX\">main page</a>."; } } @@ -97,7 +99,7 @@ if(myisset("forgot")) "Please try <a href=\"$INDEX\">again</a>."; else /* default error message */ echo "Couldn't find a player with this email! <br />". - "Please contact Arun, if you think this is a mistake <br />". + "Please contact $ADMIN_NAME, if you think this is a mistake <br />". "or else try <a href=\"$INDEX\">again</a>."; } } @@ -117,7 +119,7 @@ else { /* user information is ok */ $myname = DB_get_name('email',$email); - $_SESSION["name"] = $myname; + $_SESSION['name'] = $myname; $PREF = DB_get_PREF($myid); @@ -126,7 +128,7 @@ else display_user_menu($myid); /* display all games the user has played */ - echo "<div class=\"user\">"; + echo '<div class="user">'; if($myvacation = check_vacation($myid)) { @@ -255,7 +257,8 @@ else if($maxgame>1) { - $output_active .= ' <span class="gameshidesession link">'._('(hide/show) old').'</span><br />'."\n"; + $output_active .= ' <span class="gamesshowsession"><a href="#">'._('show old').'</a></span>'. + ' <span class="gameshidesession"><a href="#">'._('hide old').'</a></span><br />'."\n"; $output_active .= ' <span class="gamessession">'.$sessionoutput.'</span>'; } @@ -296,9 +299,9 @@ else } echo "<ul>\n "; - echo ' <li><span class="gameshowall link">'._('show all').'</span> <span class="gamehideall link">'._('hide all')."</span></li>\n"; + echo ' <li><span class="gameshowall"><a href="#">'._('show all').'</a></span> <span class="gamehideall"><a href="#">'._('hide all')."</a></span></li>\n"; echo $output_active; - echo ' <li><span class="gameshidesession link">'._('hide/show inactive').'</span><ul class="gamessession">'."$output_inactive </ul></li>"; + echo ' <li><span class="gamesshowsession"><a href="#">'._('show inactive').'</a></span><span class="gameshidesession"><a href="#">'._('hide inactive').'</a></span><ul class="gamessession">'."$output_inactive </ul></li>"; echo "</ul>\n"; /* give a hint for new players */ @@ -326,7 +329,7 @@ else } else { - echo "<div class=\"message\">Sorry email and password don't match. Please <a href=\"$INDEX\">try again</a>. </div>"; + echo '<div class="message">'."Sorry email and password don't match. Please <a href=\"$INDEX\">try again</a>.".' </div>'; } }; ?>
\ No newline at end of file |