X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Ffunctions.php;h=82b4bb6bbcde05c2fe2b74779d304b22d35062e5;hp=f8a0da4e58d7e4faf1121a6eb44f707a9bb66899;hb=afdd753932734c300c2edc1a7e0b91e4f44564a0;hpb=765a4fb590113faa80a8560711f9c89de14a50ba diff --git a/include/functions.php b/include/functions.php index f8a0da4..82b4bb6 100644 --- a/include/functions.php +++ b/include/functions.php @@ -851,7 +851,7 @@ function display_user_menu() $result = DB_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand". " LEFT JOIN Game On Hand.game_id=Game.id". " WHERE Hand.user_id='$myid'". - " AND Game.player='$myid'". + " AND ( Game.player='$myid' OR ISNULL(Game.player) )". " AND Game.status<>'gameover'". " ORDER BY Game.session" ); @@ -1071,6 +1071,30 @@ function format_score_table_html($score,$userid) return $output; } +function createCache($content, $cacheFile) +{ + $fp = fopen($cacheFile,"w"); + if($fp) + { + fwrite($fp,$content); + fclose($fp); + } + else + echo "WARNING: couldn't create cache file"; + + return; +} + +function getCache($cacheFile, $expireTime) +{ + if( file_exists($cacheFile) && + filemtime($cacheFile )>( time() - $expireTime ) ) + { + return file_get_contents($cacheFile); + } + + return false; +} ?>