| Line |   | 
|---|
| 1 | <?php | 
|---|
| 2 |          | 
|---|
| 3 | if(!function_exists("xpress_cache_read")): | 
|---|
| 4 |     function xpress_cache_read($mydirname,$collation_key) | 
|---|
| 5 |     { | 
|---|
| 6 |                 $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 7 |                 $cache_time = 0; | 
|---|
| 8 |         $filename = $cache_dir .$mydirname . '_' . $collation_key; | 
|---|
| 9 | //        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { | 
|---|
| 10 |         if (file_exists($filename)) { | 
|---|
| 11 |             return file_get_contents($filename); | 
|---|
| 12 |        } else { | 
|---|
| 13 |                         return ''; | 
|---|
| 14 |                 } | 
|---|
| 15 |     }  | 
|---|
| 16 | endif; | 
|---|
| 17 |  | 
|---|
| 18 | if(!function_exists("xpress_cache_write")): | 
|---|
| 19 |     function xpress_cache_write($mydirname,$collation_key,$content) | 
|---|
| 20 |     { | 
|---|
| 21 |                 $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 22 |                 $cache_time = 0; | 
|---|
| 23 |  | 
|---|
| 24 |         $filename = $cache_dir .$mydirname . '_' . $collation_key; | 
|---|
| 25 | //        if ((time() - @filemtime($filename)) > $cache_time) { | 
|---|
| 26 |             $fp = fopen($filename, "w"); | 
|---|
| 27 |             flock($fp, 2); | 
|---|
| 28 |             fputs($fp, $content); | 
|---|
| 29 |             fclose($fp); | 
|---|
| 30 |  //       }  | 
|---|
| 31 |     }  | 
|---|
| 32 | endif; | 
|---|
| 33 |  | 
|---|
| 34 | if(!function_exists("xpress_block_cache_clear")): | 
|---|
| 35 |     function xpress_cache_clear($mydirname) | 
|---|
| 36 |     { | 
|---|
| 37 |                 $cache_dir = XOOPS_ROOT_PATH . '/cache/'; | 
|---|
| 38 |                 $cache_time = 0; | 
|---|
| 39 |         if ($dh = opendir($cache_dir)) { | 
|---|
| 40 |             while (($file = readdir($dh)) !== false) { | 
|---|
| 41 |                 if (preg_match('/^' . preg_quote($mydirname) . '/', $file)) { | 
|---|
| 42 |                     unlink($cache_dir.$file); | 
|---|
| 43 |                 }  | 
|---|
| 44 |             }  | 
|---|
| 45 |             closedir($dh); | 
|---|
| 46 |         }  | 
|---|
| 47 |     }  | 
|---|
| 48 | endif; | 
|---|
| 49 |  | 
|---|
| 50 | ?> | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.