• Welcome to Simple Machines Community Forum. Please login or sign up.
December 08, 2021, 07:20:46 AM

News:

Wondering if this will always be free?  See why free is better.


Download System

Started by SMFHacks.com Team, October 31, 2007, 06:55:37 PM

Previous topic - Next topic

Fredisland

Quote from: vbgamer45 on January 02, 2021, 11:03:42 AM
3.0.7a
!Fixes for remote filesize function more checks added. Requires allow_url_fopen to be set

Some changes have been made to my templates.
So, is there somewhere a full changelog file by file to modify files from 3.0.7 to 3.0.7a ?
Thank you

vbgamer45

I just replaced in downloads.2php the function at the bottom for file filesize with this code

function Downloads_getRemoteFilesize($file_url)
{
$file_url = trim($file_url);

if (empty($file_url))
return 0;

if (ini_get('allow_url_fopen') == 1)
{

$head = array();
$head['content-length'] = 0;


try
{
$head = array_change_key_case(get_headers($file_url, 1));
}
catch (Exception $e)
{

}

$result = isset($head['content-length']) ? $head['content-length'] : 0;

if (is_array($result))
return 0;

return $result;
}
else
{
return 0;

}
}
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Fredisland

Quote from: vbgamer45 on January 02, 2021, 11:36:34 AM
I just replaced in downloads.2php the function at the bottom for file filesize with this code

Thank you so much for you very very very quick support  :) !

vbgamer45

Glad to help. One tip I do is use a software called Beyond Compare to find changes between files/folders makes it way easier.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke

SMF 2.0.17
mod version 3.07a
site - aurora2.pentarch.org

Users can make uploads, but they all show as 0kb. When I (as admin) create an upload, or modify a user's upload the file shows the right size. This seems to me to be a permissions issue, but I've scoured the perms and cannot find where it might be.

Any help in pointers as to where to look?

vbgamer45

What type of  upload is it? Is it a file or url?  A url requires fopen for urls in php settings to be enabled
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke


vbgamer45

Hmm shouldn't do that. Not a permissions issue.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke

Okay. If you need it, I can create a user for you and PM you the details.

vbgamer45

The only way I been able to recreate that issue is if someone put something random in the upload file url field.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke

I will double-check that is not going on.

vbgamer45

Update
3.0.8
+Added check for upload url to be sure it is http:// or https://
!Minor code cleanup/fixes
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke

According to the user that has been helping me, he only used the file field. Did not touch the URL field.

I tried an upload from a test account and it worked. So it might be something on his side.

vbgamer45

Yeah, Maybe file too big.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

icehawke

I'd agree with that, except I can take the same file and upload it myself. And get a filesize and have everything working properly. Which is why I was thinking it was some permissions based issue.

@rjen

I am testing with PHP version 7.4 and I am seeing some errors from this MOD.
They occur is someone tries to download a non-existing link as far as I can see.

SMF version 2.0.18 (beta testing)
Mod version: 3.0.7
PHP version: 7.4.11

Example URL:
https://www.my-forum.com/index.php?action=downloads;sa=downfile&id=447

These errors are logged when the forum is on PHP version 7.4:

https://www.fjr-club.nl/index.php?action=downloads;sa=downfile&id=447
8: md5_file(): read of 8192 bytes failed with errno=21 Is a directory
File: /home/xxx/domains/my-forum.com/public_html/Sources/Downloads2.php
Regel: 5136

https://www.fjr-club.nl/index.php?action=downloads;sa=downfile&id=447
8: Trying to access array offset on value of type null
File: /home/xxx/domains/my-forum.com/public_html/Sources/Downloads2.php
Regel: 5107

The download system then tries to download a file called index.php. This downloads to an empty file...
On PHP 7.3 the same happens, but it does not log any errors.

Any chance to fix this?
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

vbgamer45

Does it happen to all downloads or just that one? Check that the downloads folder is wrirtable and files are there.
The first line for Regel: 5107
$filename = $modSettings['down_path'] . $row['filename'];

Shouldn't cause an error unless $modSettings['down_path'] is empty or $row['filename'] is empty

Check the database entry for file id 447
select * from smf_down_file where ID_FILE = 447

Also this download is a standard download not a remote linked? Remote linked code is processed before.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

@rjen

There is not file in the downloads with ID447 (not anymore).

It seems someone is visiting an old link to a file that has been removed. That's when the errors are logded.
The existing downloads work fine, no issues there...
Running SMF 2.0 with Tinyportal 2.1.0 at www.fjr-club.nl
Testing SMF 2.1 with Tinyportal 2.1.0 at test2.fjr-club.nl

vbgamer45

ah gotcha will add a check
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

vbgamer45

Quote from: @rjen on January 10, 2021, 01:49:50 PM
There is not file in the downloads with ID447 (not anymore).

It seems someone is visiting an old link to a file that has been removed. That's when the errors are logded.
The existing downloads work fine, no issues there...

Posted an update 3.0.8a  which should help try it out!
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: