News:

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

Main Menu

Download System

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

Previous topic - Next topic

wintstar

SMF 2.1 RC2
PHP: 7.3.14
MySQL Version: 5.7.28-log

Type of error: Undefined
8: Undefined index: spam_WaitTime_broken
xxx://localhost/xxx/xxx/index.php?action=downloads;sa=comment&id=1
/var/www/html/xxx/xxx/Sources/Errors.php (Line 228)

Backtrace information
#2: spamProtection()
Called from /var/www/html/sfwd/board/Sources/Downloads2.php on line 2320

Solution
look in Sources/Errors.php. $sprintf spamProtection('spam') => spam is the first part of the language string = spam_. => WaitTime_broken is the second part of the language string
Combined, this results in => spam_WaitTime_broken


open Sources/Downloads2.php
To assign the language string to the downloads language file it would be better to use downloads instead of spam.

find
spamProtection('spam');
replace with
spamProtection('downloads');

open languages/Downloads.english.php
find
$txt['downloads_error_invalid_picture'] = 'Invalid Picture file';
add after
$txt['downloads_WaitTime_broken'] = 'The last commenting from your IP was less than %1$d seconds ago. Please try again later.';
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

vbgamer45

Thanks will add the fix!
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

wintstar

Please wait a moment with a new version. I still have a few suggestions for improvement regarding breadcrumbs (linktree). I'll post it today.
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

vbgamer45

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

wintstar

Suggestion for linktree

open Sources/Downloads2.php
find line 1079
Downloads_GetParentLink($row['ID_PARENT']);

// Link Tree
$context['linktree'][] = array(
'url' => $scripturl . '?action=downloads;cat=' . $row['ID_CAT'],
'name' => $row['CAT_TITLE']
);

// Show Custom Fields

replace with
Downloads_GetParentLink($row['ID_PARENT']);

// Link Tree
$context['linktree'][] = array(
'url' => $scripturl . '?action=downloads;cat=' . $row['ID_CAT'],
'name' => $row['CAT_TITLE']
);
// Link Tree
$context['linktree'][] = array(
'name' => $context['downloads_file']['title']
);

// Show Custom Fields


find
function Downloads_AddComment()
{
global $context, $mbname, $txt, $modSettings, $user_info, $sourcedir, $smcFunc;

replace with
function Downloads_AddComment()
{
global $context, $mbname, $txt, $modSettings, $user_info, $sourcedir, $scripturl, $smcFunc;


find
// Comments allowed check
$dbresult = $smcFunc['db_query']('', "
SELECT p.allowcomments, p.ID_CAT
FROM {db_prefix}down_file as p
WHERE ID_FILE = $id LIMIT 1");
$row = $smcFunc['db_fetch_assoc']($dbresult);
$ID_CAT = $row['ID_CAT'];
$smcFunc['db_free_result']($dbresult);
// Checked if comments are allowed
if ($row['allowcomments'] == 0)
{
fatal_error($txt['downloads_error_not_allowcomment']);
}
Downloads_GetCatPermission($ID_CAT,'addcomment');

replace with
// Comments allowed check
$dbresult = $smcFunc['db_query']('', "
SELECT p.allowcomments, p.id_cat, p.title, c.id_cat, c.title AS catname
FROM {db_prefix}down_file as p
LEFT JOIN {db_prefix}down_cat AS c ON (c.id_cat = p.id_cat)
WHERE ID_FILE = $id LIMIT 1");
$row = $smcFunc['db_fetch_assoc']($dbresult);
$context['downloads_cat_name'] = $row['catname'];
$context['downloads_cat_id'] = $row['id_cat'];
$context['downloads_file_name'] = $row['title'];
$ID_CAT = $row['id_cat'];
$smcFunc['db_free_result']($dbresult);
// Checked if comments are allowed
if ($row['allowcomments'] == 0)
{
fatal_error($txt['downloads_error_not_allowcomment']);
}
Downloads_GetCatPermission($ID_CAT,'addcomment');

// Link Tree
$context['linktree'][] = array(
'url' => $scripturl . '?action=downloads;cat=' . $context['downloads_cat_id'],
'name' => $context['downloads_cat_name']
);
$context['linktree'][] = array(
'url' => $scripturl . '?action=downloads;sa=view;down=' . $id,
'name' => $context['downloads_file_name']
);
$context['linktree'][] = array(
'name' => $txt['downloads_text_addcomment']
);


Look here the breadcrumb (it's in german)
Download file => https://www.stephan-frank.de/board/index.php?action=downloads;sa=view;down=1
Add comment = > https://www.stephan-frank.de/board/index.php?action=downloads;sa=comment&id=1
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

SMFHacks.com Team

Update
3.0.5
!Fixed missing language string bug for spam protection thanks to wintstar
+Better linktrees on view download/add comment page thanks to wintstar
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

wintstar

Database Error: Data too long for column 'log_type'  is a Bug in SMF RC2  => https://github.com/SimpleMachines/SMF2.1/issues/6031
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier

vbgamer45

ok...Should i change it to a shorter prefix which i will do now...
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

SMFHacks.com Team

Added install support for RC3
Disclaimer: SMFHacks.com Team is not affiliated with the SMF Team or the SimpleMachines NPO.

http://ForumRankings.net - Get Forum Ranked!
SMFHacks.com -  Paid Modifications for SMF
Latest Mods:
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

vbgamer45

Update!

3.0.6
!Fixes for PHP 7.4
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

#2231
Quote from: BartB on March 26, 2011, 02:16:53 PM
When I add a download to a category using the URL function (because the file is already on the system but in another directory) it adds the file correctly, but with a reported size of 0B. Any way to fix that?

Quote from: vbgamer45 on March 26, 2011, 02:21:13 PM
Possible but I would have to do another request to get the filesize.

Hello,

Did you make some modifications to your Download System masterpiece, in order to add the filesize for a distant file ? Because I have the same problem and it's reallyannoying. Or maybe ther is a way to manuallt edit the filesize.

Note : I use Download System 3.0.6 on SMF 2.0.17

Thank you

vbgamer45

I don't think I added it but found code

nction getRemoteFilesize($file_url, $formatSize = true)
{
    $head = array_change_key_case(get_headers($file_url, 1));
    // content-length of download (in bytes), read from Content-Length: field
    $clen = isset($head['content-length']) ? $head['content-length'] : 0;
    // cannot retrieve file size, return "-1"
    if (!$clen) {
        return –1;
    }
    if (!$formatSize) {
        return $clen;
// return size in bytes
    }

https://www.airtistic.info/?p=1081
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 December 29, 2020, 07:47:38 AM
I don't think I added it but found code

Thank you, I will try to add it to your MOD.

vbgamer45

Update!
3.0.7
+Added filesize support for remote links
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 December 29, 2020, 10:58:38 AM
Update!
3.0.7
+Added filesize support for remote links

OMG --- AND IT WORKS VERY WELL !!!!!
THANK YOU THANK YOU THANK YOU
PLEASE BE MY FRIEND FOR THE LIFE !!

I will just translate the Kb, Mb, Gb... in Ko, Mo, Go, because I'm french....

Fred

vbgamer45

No problem! add it to the language strings! Maybe will do in next update i didn't realize those were different in latin based languages.
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

#2237
Quote from: vbgamer45 on December 29, 2020, 02:45:07 PM
No problem! add it to the language strings! Maybe will do in next update i didn't realize those were different in latin based languages.

Done ! I have thanked you with Paypal (fred****@gmail.com).

vbgamer45

Thank you for support! Fred!
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

3.0.7a
!Fixes for remote filesize function more checks added. Requires allow_url_fopen to be set
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: