~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to html/inc/cache.inc

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    }
42
42
}
43
43
 
44
 
function get_path($params) {
 
44
function get_path($params, $phpfile=null) {
45
45
    if (!@filemtime("../cache/00")) make_cache_dirs();
46
 
    $y = pathinfo($_SERVER["PHP_SELF"]);
47
 
    $z = $y["basename"];
 
46
    if ($phpfile) {
 
47
        $z = $phpfile;
 
48
    } else {
 
49
        $y = pathinfo($_SERVER["PHP_SELF"]);
 
50
        $z = $y["basename"];
 
51
    }
48
52
 
49
53
    // add a layer of subdirectories for reducing file lookup time
50
54
    $sz = substr(md5($z."_".urlencode($params)),1,2);
241
245
    }
242
246
    $path = get_path($params);
243
247
    //echo $path;
244
 
    $fhandle=fopen($path, "w");
 
248
    $fhandle = fopen($path, "w");
245
249
    fwrite($fhandle, $data);
246
250
    fclose($fhandle);
247
 
}?>
 
251
}
 
252
 
 
253
function clear_cache_entry($phpfile, $params) {
 
254
    if (strstr($phpfile, "..")) {
 
255
        return;
 
256
    }
 
257
    if (strstr($params, "..")) {
 
258
        return;
 
259
    }
 
260
    $path = get_path($params, $phpfile);
 
261
    unlink($path);
 
262
}
 
263
 
 
264
?>