Problem with the download mod - Blank page in category view

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
cavallino
Beiträge: 41
Registriert: Fr 22.Sep, 2006 22:24

Problem with the download mod - Blank page in category view

Beitrag von cavallino »

Hello,
I have noticed a really strange problem in my phpbb2 board, with the download mod 5.3.2 and since I upgraded to php 5.3.x
I actually have Apache/2.2.15 and PHP/5.3.2

I cannot enter anymore into the Categories, when there are uploaded files.
If i point to downloads.php page, all is okay, I can see the categories, the last file uploaded, I can access statistics ("downloads.php?view=stat"), overview... download configuration... I can access directly the last uploaded file, for example if I point to "downloads.php?view=detail&df_id=3" ... there i can download file with no problems at all.

The ONLY problem is if I try to enter inside "Categories", for example if I point to "downloads.php?cat=1" or whatever categories created... I see only a blank white page, with no errors at all.

The strange fact is that If I delete completely the uploaded files inside the "downloads" folder, then I can access again inside the category pages, but ONLY if there are NO files inside the downloads folder.
As soon as I upload a file in the "downloads" folder, from either the upload page, or manually throught FTP... the category page is then not accessible anymore (Blank page!) :(


I have already tried to uninstall the mod completely, and reinstall it as new, but the problem is exactly the same, its not possible to enter any categories directly, when the is at least 1 upload.

Can you help? I don't want to uninstall this mod, it's been always working properly :(
Oxpus, you don't have anymore a phpbb2 test board to have a look at this problem ? :(
How can I contact Hotschi directly?
Benutzeravatar
oxpus
Administrator
Beiträge: 28737
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Re: Problem with the download mod - Blank page in category v

Beitrag von oxpus »

First of all, Hotschi doesn't develop the MOD any longer, he was given it to me. Just in respect of the original mod autor (Hotschi) the mod is named to him.
So support about this mod you can only get here, on oxpus.de, for the phpBB 2 release. The phpBB 3 release I'll support on http://phpbb3.oxpus.net

Then about the problem:
I've enough phpBB 2 boards available to monitor the issue, which is initially no one.
The problem based more in the different way in which PHP 5 functions and file operations uses.
Regard: phpBB 2 was not developed for phpBB 5 and the mods for it less, too!

In the mod release for phpBB 3 I'd re-written the key function for this issue, because PHP 5 can work more comfortably at this point.
So please do the following changes to the file dl_mod/classes/class_dlmod.php:

FIND:

Code: Alles auswählen

	function read_dl_sizes($download_dir, $path = '')
	{
		$file_size = 0;

		$dl_dir = substr($download_dir, 0, strlen($download_dir)-1);

		@$dir = opendir($dl_dir . $path);

		while (false !== ($file=@readdir($dir)))
		{
			if ($file{0} != ".")
			{
				$file_size += sprintf("%u", @filesize($dl_dir . $path . '/' . $file));
				$file_size += $this->read_dl_sizes($dl_dir, $path . '/' . $file);
			}
		}

		@closedir($dir);

		return $file_size;
	}
REPLACE THIS WITH:

Code: Alles auswählen

	function read_dl_sizes($download_dir)
	{
		$file_size = 0;
		
		if (@function_exists('scandir'))
		{
			$dirs = array_diff(scandir($download_dir), array(".", ".."));
			$dir_array = array();
			
			foreach($dirs as $d)
			{
				if (is_dir($download_dir . '/' . $d))
				{
					$file_size += $this->read_dl_sizes($download_dir . '/' . $d);
				}
				else
				{
					$file_size += sprintf("%u", @filesize($download_dir . '/' . $d));
				}
			}
		}
		else
		{
			$file_size = $this->_old_read_dl_sizes($download_dir);
		}
		
		return $file_size;
	}

	// Internal function for PHP 4 compliant
	function _old_read_dl_sizes($download_dir, $path = '')
	{
		$file_size = 0;

		$dl_dir = substr($download_dir, 0, strlen($download_dir)-1);

		@$dir = opendir($dl_dir . $path);

		while (false !== ($file=@readdir($dir)))
		{
			if ($file{0} != ".")
			{
				$file_size += sprintf("%u", @filesize($dl_dir . $path . '/' . $file));
				$file_size += $this->_old_read_dl_sizes($download_dir, $path . '/' . $file);
			}
		}

		@closedir($dir);

		return $file_size;
	}
After this changes your category view shall run again as wanted.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
cavallino
Beiträge: 41
Registriert: Fr 22.Sep, 2006 22:24

Re: Problem with the download mod - Blank page in category v

Beitrag von cavallino »

Thanks for all the clarifications oxpus!
I dont know what we should do without you... You're great.

I have tested your code-change and I've made some uploads.
The download mod works perfectly now, even with Phpbb2!

Thanks again and happy new year
Holger
Beiträge: 2253
Registriert: Mi 17.Mär, 2004 18:09

Re: Problem with the download mod - Blank page in category v

Beitrag von Holger »

Perfect! THANK YOU! :respect:
Real men don’t back up, they learn data recovery. ;-)
http://www.mysqldumper.de
http://www.mysqldumper.se
Antworten