[TYPO3] moc-file manager download problem
andreas stein
andre01 at typotemp.com
Fri Apr 21 11:16:07 CEST 2006
It seems the support had stopped long ago - many small bugs are in some
files. And the changes which where made through developing of typo3, mysql
and php where ignored. Only one thing i found out: the ext_tables.sql file
has bugs - i have to made the log table manually. Now the log table works
but still the download doesnt start - i guess it comes through a change of
php4 to php5. Prob. somebody know the point:
/*
*
* TASK = download
*
*/
if(!empty($filename) && ($task == "download")) {
$name = t3lib_div::resolveBackPath("$dir/$filename");
$len = strlen($this->mount->basedir);
// print "Test 1".substr($name,0,$len)."<br />";
// print "Test 2".$this->mount->basedir."<br />";
if(substr($name,0,$len)!= $this->mount->basedir) {
$content = '<p
class="error">'.$this->pi_getLL("noreadaccessfordownload").'</p>';
return $this->pi_wrapInBaseClass($content);
}
if(!($this->hasAccess($this->mount,$dir,"read"))) {
$content = '<p
class="error">'.$this->pi_getLL("noreadaccessfordownload").'</p>';
return $this->pi_wrapInBaseClass($content);
}
$this->dbObj->sql_query("UPDATE tx_mocfilemanager_files SET
downloads=downloads + 1 WHERE
file='".addslashes($this->div->removeFirstSlash($reldir."/".$filename))."'
AND mount=".intval($this->mount->uid));
// function log($action,$path,$mountId,$size) {
$this->div->log('DOWNLOAD',"$dir/$filename",$this->mount->uid,filesize("$dir/$filename"));
// $file=$this->removeFirstSlash($file);
//Clean all output buffers.
while (@ob_end_clean());
//Set time limit to value given in conf
if($this->conf["timeLimit"]>0) {
set_time_limit($this->conf["timelimit"]);
}
if($this->conf["killChild"]) {
apache_child_terminate();
}
// including mimetypes.php here means it is only included when
required, thereby saving parsing time for all other requests
include("mimetypes.php");
// extract the file extesion and attempt to determine the Mime type
from the file's extension
$fileinfo = t3lib_div::split_fileref($filename);
$mimetype = $mimetypes[$fileinfo["fileext"]];
if ($mimetype == "") {
$mimetype = "application/octet-stream";
}
$name = "$dir/$filename";
// return "Name: $dir/$filename";
$fp = @fopen($name, 'rb');
if(!$fp) {
return "File not found";
}
// send the right headers
header("Cache-control: must-revalidate, post-check=0, pre-check=0");
header("Content-Transfer-Encoding: binary");
header("Content-Type: $mimetype");
header("Content-Length: ".filesize($name));
header("Content-Disposition: attachment; filename=$filename");
header("Cache-control: private");
while (!feof($fp)) {
$buffer = fgets($fp, 4096);
echo $buffer;
}
fclose($fp);
if($this->conf["timeLimit"])
set_time_limit(0);
exit;
}
thanx andreas
>> I've Installed the extensions Moc filemanager. Everything works
>>
>> BUT......
>>
>> If I would like to download one of the file, the following errors are
>> displayed:
>>
>>
More information about the TYPO3-english
mailing list