CachenqMD5) { $this->CachenqMD5 = md5(e_BASE.(defined("ADMIN") && ADMIN == true ? "admin" : "").e_LANGUAGE.THEME.USERCLASS_LIST.filemtime(THEME.'theme.php')); } // Add 'nq' to indicate we are not using e_QUERY $CheckTag = '_nq_'.$this->CachenqMD5; } else { // It's a page - need the query in the hash if (!$this->CachePageMD5) { $this->CachePageMD5 = md5(e_BASE.e_LANGUAGE.THEME.USERCLASS_LIST.e_QUERY.filemtime(THEME.'theme.php')); } $CheckTag = '_'.$this->CachePageMD5; } } else { $CheckTag = ''; } } else { $CheckTag = ''; } $q = preg_replace("#\W#", "_", $CacheTag); $fname = './'.e_BASE.$FILES_DIRECTORY.'cache/'.$q.$CheckTag.'.cache.php'; return $fname; } /** * @return string * @param string $query * @param int $MaximumAge the time in minutes before the cache file 'expires' * @desc Returns the data from the cache file associated with $query, else it returns false if there is no cache for $query. * @scope public */ function retrieve($CacheTag, $MaximumAge = false, $ForcedCheck = false) { global $pref, $FILES_DIRECTORY, $tp; if (($pref['cachestatus'] || $ForcedCheck == true) && !$tp->checkHighlighting()) { $cache_file = (isset($this) ? $this->cache_fname($CacheTag) : ecache::cache_fname($CacheTag)); if (file_exists($cache_file)) { if ($MaximumAge != false && (filemtime($cache_file) + ($MaximumAge * 60)) < time()) { unlink($cache_file); return false; } else { $ret = file_get_contents($cache_file); $ret = substr($ret, 5); return $ret; } } else { return false; } } return false; } /** * @return void * @param string $CacheTag - name of tag for future retrieval * @param string $Data - data to be cached * @param bool $ForceCache (optional, default false) - if TRUE, writes cache even when disabled * @param bool $bRaw (optional, default false) - if TRUE, writes data exactly as provided instead of prefacing with php leadin * @desc Creates / overwrites the cache file for $query, $text is the data to store for $query. * @scope public */ function set($CacheTag, $Data, $ForceCache = false, $bRaw=0) { global $pref, $FILES_DIRECTORY, $tp; if (($pref['cachestatus'] || $ForceCache == true) && !$tp->checkHighlighting()) { $cache_file = (isset($this) ? $this->cache_fname($CacheTag) : ecache::cache_fname($CacheTag)); file_put_contents($cache_file, ($bRaw? $Data : '