Sindbad~EG File Manager
<?php
// ini_set('memory_limit','9999999');
$server_cache = 7200;
$cache_dir = '/var/www/html-cms-saraya-com/powercms/plugins/PowerCMS/cache/';
// for windows
if ((stristr(PHP_OS, 'win')) && (PHP_OS != 'Darwin')) {
$cache_dir = str_replace('/', '\\', $cache_dir);
}
include('/var/www/html-cms-saraya-com/powercms/php/mt.php');
$mt = new MT(90, '/var/www/html-cms-saraya-com/powercms/mt-config.cgi');
$pattern = '/(dynamic\/search\.html|dynamic\/feed\.xml)\?/';
$request = $_SERVER['REQUEST_URI'];
if (preg_match($pattern, $request)) {
$search = true;
//check own cache
$path = $request;
$path = md5($path);
$cache = $cache_dir . $path;
if (file_exists($cache)) {
$mtime = filemtime($cache);
if ((time() - $mtime) > $server_cache) {
unlink($cache);
$match = 0;
} else {
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s", $mtime ) . ' GMT' );
$match = 1;
}
} else {
$match = 0;
}
if ($match) {
if (!($fcache = fopen($cache, 'r'))) {
$match = 0;
} else {
// $rec = file($cache);
// foreach ($rec as $line) {
// echo "$line\n";
// }
// return;
$fp = fopen( $cache, "r" );
while ( !feof( $fp ) ) {
echo fread( $fp, 8192 );
}
fclose($fp);
exit();
}
}
}
$tracking = '/(dynamic\/tracking\.html|dynamic\/search_tracking\.html)\?/';
if (! preg_match($tracking, $request)) {
if (! $search ) {
$mt->caching = true;
$mt->conditional = true;
}
} else {
$search = false;
}
ob_start();
$mt->view();
$output = ob_get_contents();
ob_end_clean();
$ctime = time();
header( "Last-Modified: " . gmdate( "D, d M Y H:i:s", $ctime ) . ' GMT' );
echo $output;
if ($search) {
//save own cache
if (!($match)) {
if (!($fh = fopen($cache, 'w'))) {
return;
}
fwrite($fh, $output, 128000);
fclose($fh);
touch ($cache, $ctime);
}
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists