Advertisement:

Author Topic: Download System  (Read 636838 times)

Offline wintstar

  • Jr. Member
  • **
  • Posts: 154
Re: Download System
« Reply #2220 on: February 27, 2020, 09:47:33 AM »
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
Code: [Select]
spamProtection('spam');replace with
Code: [Select]
spamProtection('downloads');
open languages/Downloads.english.php
find
Code: [Select]
$txt['downloads_error_invalid_picture'] = 'Invalid Picture file';add after
Code: [Select]
$txt['downloads_WaitTime_broken'] = 'The last commenting from your IP was less than %1$d seconds ago. Please try again later.';

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,966
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Download System
« Reply #2221 on: February 27, 2020, 09:58:13 AM »
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

Offline wintstar

  • Jr. Member
  • **
  • Posts: 154
Re: Download System
« Reply #2222 on: February 27, 2020, 10:03:07 AM »
Please wait a moment with a new version. I still have a few suggestions for improvement regarding breadcrumbs (linktree). I'll post it today.

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,966
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Download System
« Reply #2223 on: February 27, 2020, 10:07:06 AM »
Ok thanks!
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

Offline wintstar

  • Jr. Member
  • **
  • Posts: 154
Re: Download System
« Reply #2224 on: February 27, 2020, 10:29:48 AM »
Suggestion for linktree

open Sources/Downloads2.php
find line 1079
Code: [Select]
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
Code: [Select]
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
Code: [Select]
function Downloads_AddComment()
{
global $context, $mbname, $txt, $modSettings, $user_info, $sourcedir, $smcFunc;
replace with
Code: [Select]
function Downloads_AddComment()
{
global $context, $mbname, $txt, $modSettings, $user_info, $sourcedir, $scripturl, $smcFunc;

find
Code: [Select]
// 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
Code: [Select]
// 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

Offline SMFHacks.com Team

  • Full Member
  • ***
  • Posts: 438
    • smfhacks on Facebook
    • @smfhacks on Twitter
    • SMFHacks.com
Re: Download System
« Reply #2225 on: February 27, 2020, 12:16:36 PM »
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

Offline wintstar

  • Jr. Member
  • **
  • Posts: 154
Re: Download System
« Reply #2226 on: February 27, 2020, 01:26:33 PM »
Database Error: Data too long for column 'log_type'  is a Bug in SMF RC2  => https://github.com/SimpleMachines/SMF2.1/issues/6031

Online vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 22,966
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Download System
« Reply #2227 on: February 27, 2020, 02:47:06 PM »
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

Offline SMFHacks.com Team

  • Full Member
  • ***
  • Posts: 438
    • smfhacks on Facebook
    • @smfhacks on Twitter
    • SMFHacks.com
Re: Download System
« Reply #2228 on: October 17, 2020, 06:42:21 PM »
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