/usr/share/IlohaMail/include/cache.FS.inc is in ilohamail 0.8.14-0rc3sid6.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <?php
/////////////////////////////////////////////////////////
//
// include/cache.FS.inc
//
// (C)Copyright 2003 Ryo Chijiiwa <Ryo@IlohaMail.org>
//
// This file is part of IlohaMail, and released under GPL.
// See COPYING, or http://www.fsf.org/copyleft/gpl.html
//
/////////////////////////////////////////////////////////
/********************************************************
PURPOSE: Unified interface to read/write cache
********************************************************/
function cache_read($user, $host, $key){
global $CACHE_DIR;
//check if file is there
$user_dir = ereg_replace("[\\/]", "", $user.".".$host);
$path = $CACHE_DIR.$user_dir."/".$key;
if (!@file_exists(realpath($path))) return false;
//open file
$fp = fopen($path, "r");
if (!$fp) return false;
//read data
$data = false;
$data = fread($fp, filesize($path));
if ($data) $data = unserialize($data);
fclose($fp);
return $data;
}
function cache_write($user, $host, $key, $data){
global $CACHE_DIR;
//open file for writing
$user_dir = ereg_replace("[\\/]", "", $user.".".$host);
$path = $CACHE_DIR.$user_dir."/".$key;
$fp = @fopen($path, "w");
if (!$fp) return false;
//write data
fputs($fp, serialize($data));
fclose($fp);
return true;
}
function cache_clear($user, $host, $key){
global $CACHE_DIR;
//check if file is there
$user_dir = ereg_replace("[\\/]", "", $user.".".$host);
$path = $CACHE_DIR.$user_dir."/".$key;
if (!@file_exists(realpath($path))) return false;
else return unlink($path);
}
function cache_clear_all($user, $host){
global $CACHE_DIR;
//delete cache files
$cacheDir = $CACHE_DIR.ereg_replace("[\\/]", "", $user.".".$host);
if (@is_dir(realpath($cacheDir))){
if ($handle = opendir($cacheDir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file_path = $cacheDir."/".$file;
unlink($file_path);
}
}
closedir($handle);
}
}
}
?>
|