示例#1
0
文件: cache.php 项目: alencarmo/OCF
 function CacheManager(&$base)
 {
     global $gorumroll, $language, $theme, $gorumrecognised, $gorumjavascript_cache, $gorumcategory;
     list($this->timeFrame, $categorySpecific) = $base->getCacheTimeFrameAndCategorySpecificity();
     if ($this->timeFrame) {
         $this->key = "{$gorumroll->list}-{$gorumroll->method}-{$gorumroll->rollid}-";
         $details = "language: {$language}, theme: {$theme}, authentication: ";
         hasAdminRights($isAdm);
         if ($isAdm) {
             $details .= "admin, ";
         } elseif ($gorumrecognised) {
             $details .= "loggedin, ";
         } else {
             $details .= "loggedout, ";
         }
         $s = new Sorting($base);
         $details .= " sorting: " . $s->getSortSql();
         $classVars = $gorumroll->getClassVars();
         if (!empty($classVars["off"])) {
             $details .= " offset: {$classVars['off']}";
         }
         if ($categorySpecific) {
             $details .= " category: {$gorumcategory}";
         }
         //FP::log($details, "Details");
         $this->key .= substr(md5($details), 0, 16);
         $this->fileName = CACHE_DIR . "/" . $this->key . '.html';
         $this->incFileName = CACHE_DIR . "/" . $this->key . '.inc';
         if ($this->checkCache()) {
             $inc = file_get_contents($this->incFileName);
             $gorumjavascript_cache = unserialize($inc);
             //FP::log($this, "Loading include cache");
             JavaScript::mergeCache($gorumjavascript_cache);
         } else {
             // Inicializaljuk az inklud kesst:
             $gorumjavascript_cache = new JavaScript();
             //FP::log($gorumjavascript_cache, "IncCache ujainit");
         }
     }
 }