| © 2006-2007 Worldviewer.com & Avoo.com. |
100) {
$ext = substr($dest_file, strrpos($dest_file, '.'));
$dest_file = substr($dest_file, 20, 60) . $ext;//keep some chars and the extension
}
//echo $dest_file . ' = ' . filesize($dest_file);
if(!file_exists($dest_file) || filesize($dest_file) == 0 || filemtime($dest_file) < (time()-$timeout)) {
echo 'update';
$data = @file_get_contents($url);
if ($data !== false) {
$tmpf = tempnam('/tmp','YWS');
$fp = @fopen($tmpf,"w");
@fwrite($fp, $data);
@fclose($fp);
if(file_exists($dest_file)) @unlink($dest_file);
rename($tmpf, $dest_file);
@chmod($dest_file, 0666);
}
} else {
$data = file_get_contents($dest_file);
}
return($data);
}
?>
|