summaryrefslogtreecommitdiffstats
path: root/include/functions.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-10-18 11:33:36 -0700
committerArun Persaud <arun@nubati.net>2008-10-18 11:54:53 -0700
commiteb20bf1a0cae1192eb50c19220e72df8d971d8e7 (patch)
treeb056fd4e9933c733195ebf40ebbb8d5c957df5b3 /include/functions.php
parent9cbbe2da9cde298ec2fbacc5029388b2a33db9f8 (diff)
downloade-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.tar.gz
e-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.tar.bz2
e-DoKo-eb20bf1a0cae1192eb50c19220e72df8d971d8e7.zip
NEW FEATURE: make it possible to view games where people played with the same hand
had to change a few things and check more often if people are logge in, so that for example personal notes only show up when you are logged in and not when someone else is looking at your cards Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/include/functions.php b/include/functions.php
index 82b4bb6..ca62cd9 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -846,7 +846,13 @@ function display_table ()
function display_user_menu()
{
- global $WIKI,$myid,$INDEX;
+ global $WIKI,$INDEX;
+
+ /* get the id we are looking for */
+ if(isset($_SESSION['id']))
+ $myid = $_SESSION['id'];
+ else
+ return;
$result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand".
" LEFT JOIN Game On Hand.game_id=Game.id".
@@ -1055,7 +1061,12 @@ function format_score_table_html($score,$userid)
$i++;
$output.=" <tr>";
$userhash = DB_get_hash_from_gameid_and_userid($game['gameid'],$userid);
- $output.=" <td> <a href=\"".$INDEX."?action=game&amp;me=".$userhash."\">$i</a></td>";
+ /* create link to old games only if you are logged in and its your game*/
+ if(isset($_SESSION['id']) && $_SESSION['id']==$userid)
+ $output.=" <td> <a href=\"".$INDEX."?action=game&amp;me=".$userhash."\">$i</a></td>";
+ else
+ $output.=" <td>$i</td>";
+
foreach($game['players'] as $id=>$points)
$output.="<td>".$points."</td>";
$output.="<td>".$game['points'];
@@ -1071,7 +1082,7 @@ function format_score_table_html($score,$userid)
return $output;
}
-function createCache($content, $cacheFile)
+function createCache($content, $cacheFile)
{
$fp = fopen($cacheFile,"w");
if($fp)
@@ -1085,10 +1096,10 @@ function createCache($content, $cacheFile)
return;
}
-function getCache($cacheFile, $expireTime)
+function getCache($cacheFile, $expireTime)
{
- if( file_exists($cacheFile) &&
- filemtime($cacheFile )>( time() - $expireTime ) )
+ if( file_exists($cacheFile) &&
+ filemtime($cacheFile )>( time() - $expireTime ) )
{
return file_get_contents($cacheFile);
}