X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Foutput.php;h=c2a644b59516a7177744b178418d8dff5e87e24d;hp=1d1a71ffd8a4fe5e061af850e4fb55ef27eb87bc;hb=f11c2bcac54384c4154324e4c72a2b62af35995c;hpb=75d3974143dbaa3601317f767d77ed1c3cc13e9b diff --git a/include/output.php b/include/output.php index 1d1a71f..c2a644b 100644 --- a/include/output.php +++ b/include/output.php @@ -1,5 +1,5 @@ +/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 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,80 @@ 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 '
'; - $i=0; + 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"; - /* delete players name, since he will be on position D anyway */ - unset($copy_names[array_search($_SESSION["name"],$copy_names)]); + echo '
'; - srand((float) microtime() * 10000000); - foreach( array("PlayerA","PlayerB","PlayerC","PlayerD") as $player) + $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 ' 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 '
'; + $rand = $_SESSION["name"]; + echo "
\n"; + $i++; + echo " \n
\n"; + + /* ask player for names */ echo '
'; echo ''; @@ -378,13 +425,13 @@ function output_header() - - - - - - - + " /> + " /> + "/> + + + + @@ -406,7 +453,7 @@ function output_footer() echo "
\n\n"; echo "