X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Foutput.php;h=6a61b085aecfae99b5c1f4c1fecccb80eb070f47;hp=df1d69a7ff179c16cbe62852d310b0ad1c374785;hb=c42caf707e7b0b9e4e22a2d15b034b39101172e1;hpb=cc95c662be086f71697755fe6939ff4840fe25b1 diff --git a/include/output.php b/include/output.php index df1d69a..6a61b08 100644 --- a/include/output.php +++ b/include/output.php @@ -1,5 +1,5 @@ +/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arun Persaud * * This file is part of e-DoKo. * @@ -26,6 +26,21 @@ if(!isset($HOST)) /* functions which only ouput html */ +function autoversion($file) +{ + /* changes the file name of e.g. css/style.css to css/style..css/js + * this way the browser can cache the file and will reload it if the file changed + * needs to have .htaccess set up correctly to link back to css/style.css */ + + /* only use it for file that have an absolut path */ + if(!file_exists(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file)) + return $file; + + $md5 = md5_file(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file); + return preg_replace('{\\.([^./]+)$}', ".$md5.\$1", $file); +} + + function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid) { global $RULES; @@ -53,48 +68,79 @@ function output_form_for_new_game($names) * after we selected them to make sure that each name * only shows up once */ + + /* delete players name, since he will be on position D anyway */ + unset($copy_names[array_search($_SESSION["name"],$copy_names)]); + srand((float) microtime() * 10000000); + + echo '
'; echo '

'._('Select players (Remember: you need to be one of the players)').'

'; + echo '
'; - echo ' table'; - /* ask player for names */ + echo "
\n"; + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo " \n
\n"; - $i=0; + echo '
'; - /* delete players name, since he will be on position D anyway */ - unset($copy_names[array_search($_SESSION["name"],$copy_names)]); + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo "
\n"; + echo " \n
\n"; - srand((float) microtime() * 10000000); - foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player) + echo ' table'; + $randkey = array_rand($copy_names); + $rand = $copy_names[$randkey]; + /* delete this name from the list of possible names */ + unset($copy_names[$randkey]); + echo "
\n"; + echo " \n
\n"; - echo "
\n"; - $i++; - echo " \n
\n"; + echo '
'; + $rand = $_SESSION["name"]; + echo "
\n"; + echo " \n
\n"; + + /* ask player for names */ echo '
'; echo ''; @@ -222,72 +268,72 @@ function output_check_for_sickness($me,$mycards) echo ''; echo ' '._('Do you want to play solo?').''; echo ' '; echo '
'; - echo _('Wedding?'); if(check_wedding($mycards)) { + echo _('Do you want to call Wedding?'); echo ' '._('yes').""; echo ' '._('no')."
\n"; } else { - echo ' '._('no')."
\n"; + echo " \n"; }; - echo _('Do you have poverty?'); if(count_trump($mycards)<4) { + echo _('Do you want to call poverty?'); echo ' '._('yes').""; echo ' '._('no')."
\n"; } else { - echo ' '._('no')."
\n"; + echo " \n"; }; - echo _('Do you have too many nines?'); if(count_nines($mycards)>4) { + echo _('Do you want to call too many nines?'); echo ' '._('yes').""; echo ' '._('no')."
\n"; } else { - echo ' '._('no')."
\n"; + echo " \n"; }; if($RULES['lowtrump']=='cancel' || $RULES['lowtrump']=='poverty') { - if($RULES['lowtrump']=='cancel') - echo _('Do you have low trump (cancel game)?'); - else - echo _('Do you have low trump (poverty)?'); - if(check_low_trump($mycards)) { + if($RULES['lowtrump']=='cancel') + echo _('Do you want to call low trump (cancel game)?'); + else + echo _('Do you want to call low trump (poverty)?'); + echo ' '._('yes').""; echo ' '._('no')."
\n"; } else { - echo ' '._('no')."
\n"; + echo " \n"; }; } else - echo ""; + echo " "; echo "\n"; - echo "\n"; + echo "
\n"; echo "\n"; @@ -357,7 +403,7 @@ function output_check_want_to_play($me) { echo '
'; echo ' '._('Do you want to play a game of DoKo?').'
'; - echo ' '._('yes').''; + echo ' '._('yes').''; echo ' '._('no').'
'; echo "\n"; echo "\n"; @@ -376,56 +422,18 @@ function output_header() e-Doko - - - - - - - - - + + + " /> + " /> + "/> + -
- '._('Welcome to E-Doko').' '; -?> -
"; @@ -438,18 +446,20 @@ function output_footer() echo "
\n\n"; echo "
\n"; - echo "

copyright 2006,2007,2008,2009,2010 Arun Persaud, et al.
\n". - " Verwendung der [deutschen] Kartenbilder mit Genehmigung
der Spielkartenfabrik Altenburg GmbH,(c) ASS Altenburger
\n". - " - ASS Altenburger Spielkarten - Spielkartenfabrik Altenburg GmbH
\n". - " a Carta Mundi Company Email: info@spielkarten.com Internet: www.spielkarten.com

\n"; - echo "

See the latest changes \n". + echo "

copyright 2006-2013 Arun Persaud, et al.
\n"; + echo "

See the latest changes \n". " via git
or download the source via
\n'git clone http://nubati.net/git/e-DoKo.git'
\n". " \n". " \"Green\n". - "

\n"; - echo "\n"; - echo "
\n"; + " src=\"pics/green1.gif\" height=\"32\" width=\"100\" />

\n"; + echo "\n\n"; + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo "\n"; echo "\n"; @@ -457,13 +467,14 @@ function output_footer() return; } -function output_status() +function output_navbar() { global $defaulttimezone, $INDEX, $WIKI, $RSS; if(isset($_SESSION['name'])) { - $name = $_SESSION['name']; + $name = $_SESSION['name']; + $email = DB_get_email('name',$name); /* last logon time */ $myid = DB_get_userid('name',$name); @@ -478,18 +489,25 @@ function output_status() $token = get_user_token($myid); /* logout info */ - echo "\n

\n"; - echo $name,"\n"; - echo " | "._('mypage')."\n"; - echo " | "._('settings')."\n"; - echo " | "._('new game')."\n"; - echo " | "._('statistics')."\n"; - echo " | "._('wiki/bugs')."\n"; - echo " | "._('atom')."\n"; - echo " |    "._('logout')."\n"; + echo "\n
\n"; + echo " E-DoKo\n"; + echo " \n"; echo "
\n"; - echo "
"._('last login').": ".date("r",$unixtime)."
\n"; + echo "
"._('last login').": ".date("r",$unixtime)."
\n\n"; } return; } @@ -597,10 +615,10 @@ function output_user_notes($userid,$gameid,$userstatus) echo "
"._('Personal notes').":
\n"; $notes = DB_get_notes_by_userid_and_gameid($userid,$gameid); foreach($notes as $note) - echo "$note
\n"; + echo " $note
\n"; if($userstatus!='gameover') - echo "\n"; - echo "
\n"; + echo " \n"; + echo "
\n\n"; return; } @@ -622,7 +640,7 @@ function output_robotproof($i) } } -function output_exchanged_cards() +function output_exchanged_cards($gametype) { /* in a poverty game this function will output the exchanged cards * players in the team will see the cards, the other team will see @@ -630,7 +648,7 @@ function output_exchanged_cards() */ /* need some information about the game */ - global $gameid,$mygametype, $PREF,$me,$mystatus, $RULES; + global $gameid,$PREF,$me,$mystatus, $RULES; /* some variables to track where the people with poverty are sitting */ $partnerpos1 = 0; @@ -641,7 +659,7 @@ function output_exchanged_cards() /* only need to do it in a poverty game, this might not be needed, but * just to make sure everything is ok */ - if($mygametype == 'poverty' || $mygametype=='dpoverty') + if($gametype == 'poverty' || $gametype=='dpoverty') { /* find out who has poverty */ for($mypos=1;$mypos<5;$mypos++) @@ -680,6 +698,19 @@ function output_exchanged_cards() $show=1; for($mypos=1;$mypos<5;$mypos++) { + /* output comments */ + if($mypos==2) + { + /* display all comments on the top right (card1)*/ + $comments = DB_get_pre_comment($gameid); + /* display card */ + echo "
\n"; + /* display comments */ + foreach( $comments as $comment ) + echo " ".$comment[1].": ".$comment[0]."\n"; + echo "
\n"; /* end div card */ + } + $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid); if($usersick!=NULL || $mypos==$povertypos1 || $mypos==$partnerpos1 || @@ -764,7 +795,7 @@ function output_exchanged_cards() } echo " \n"; } - if($mygametype == $usersick) + if($gametype == $usersick) $show = 0; } }