Version 1.12

This commit is contained in:
nemunaire 2009-11-01 12:00:00 +01:00
commit de31cd3e9a
1373 changed files with 156282 additions and 45238 deletions

52
onyx/cache.class.php Normal file
View file

@ -0,0 +1,52 @@
<?php
/***************************************************************************
* cache.class.php
* -----------------
* begin : mercredi 24 décembre 2008
* update : mercredi 24 décembre 2008
* email : nemunaire@gmail.com
*
*
***************************************************************************/
class Cache
{
var $values = array(),
$file = '',
$time;
/**
* Constructor
* @access protected
*/
function Cache($file)
{
if (file_exists(_FCORE."../game/cache/".$file))
{
$time = time() - filemtime(_FCORE."../game/cache/".$file);
$this->values = unserialize(file_get_contents(_FCORE."../game/cache/".$file));
$this->file = $file;
}
else
{
$time = 0;
}
}
function valide($max)
{
if ($time > $max || $time == 0) return false;
else return true;
}
function put($file = null)
{
if (empty($file))
$file = $this->file;
file_put_contents(_FCORE."../game/cache/".$file, serialize($this->values));
}
}
?>