News:

SMF 2.1.3 has been released! Take it for a spin! Read more.

Main Menu

Download System

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

Previous topic - Next topic

Eddy Matthews

#700
I'm looking forward to the Pro version - I'm perfectly happy to pay for decent software!

But there are two things that MUST be in it, otherwise it's no good for my use....

#1. It MUST allow files to be uploaded using FTP which can then be imported
#2. It MUST work with the "mod_security" directive ON

If those two criteria are met, I'll be one of your first paying customers!

Regards
Eddy

budduke

Quote from: mivm on February 26, 2009, 10:00:35 AM
When I try to upload a file I get an error message back, saying "Error has occured" 4.88KB

Anyone knows what the problem may be??

You ran into what I ran into, I had to look through the code to find the problem. It is with the max filesize error.
In the download.php file look for twice...
$txt['downloads_error_img_filesize']
replace both instances with
$txt['downloads_error_file_filesize']

I am not the programmer of this mod but that is what I found and how I fixed it.

PS: anyone trying to put a max value in download size (lets say you want 10meg limit)
I thought I could just type 10000000, did not work, that error message showed 9.6?? meg (I think)
Then I had to pull out my math memory to realize that 1 meg = 1024X1024 bytes
so in reallity if you want it to say 10meg limit you have to do this
1024 X 1024 X 10 = 10485760 (this value displays 10meg on the error screen)

vbgamer45

Quote from: Eddy Matthews on February 27, 2009, 01:14:24 PM
I'm looking forward to the Pro version - I'm perfectly happy to pay for decent software!

But there are two things that MUST be in it, otherwise it's no good for my use....

#1. It MUST allow files to be uploaded using FTP which can then be imported
#2. It MUST work with the "mod_security" directive ON

If those two criteria are met, I'll be one of your first paying customers!

Regards
Eddy
I am working on it should be ready in the next month.

For mod_security you can do a find a replace for
;id=
To
&id=

In download.template.php and sources/downloads.php
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

qubbah

when we use Upload Url: - that is mean that the file will be upload to our hosting or only give a link to download from original url?

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

coucnilhomeswap

hi is there any way i can limit the amount of downloads a certain member group has. Say the newbie group can only download 5 times per day

SoLoGHoST

Hello, while this is a great MOD.  I am having 1 issue with it - While the buttons for Smileys, etc. are showing in Add Download and Edit Download, clicking on these buttons does not put any of the BBC Code into the text area where you type.  However, when Adding and Editing Comments, it does put in the BBC Code when clicking on the buttons and the drop down menus for Font Face, Font Size, and Change Color.  I can input the BBC Code manually into the text area and that works fine, but like I said, I only have a problem when Adding and Editing Downloads.  Adding Comments and Editing Comments both work fine.

Can you please help me??

Here is the Code in my Downloads2.template.php file for the function "template_edit_download():

function template_edit_download()
{
global $scripturl, $modSettings, $txt, $context, $settings;

$g_manage = allowedTo('downloads_manage');


// Load the spell checker?
if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';


echo '<form method="post" enctype="multipart/form-data" name="picform" id="picform" action="', $scripturl, '?action=downloads&sa=edit2" onsubmit="submitonce(this);">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr class="catbg">
    <td width="50%" colspan="2"  align="center">
    <b>', $txt['downloads_form_editdownload'], '</b></td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['downloads_form_title'] . '</b>&nbsp;</td>
  <td><input type="text" name="title" size="50" value="' . $context['downloads_file']['title'] . '" /></td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['downloads_form_category'] . '</b>&nbsp;</td>
  <td><select name="cat">';

foreach ($context['downloads_cat'] as $i => $category)
{
echo '<option value="' . $category['ID_CAT']  . '" ' . (($context['downloads_file']['ID_CAT'] == $category['ID_CAT']) ? ' selected="selected"' : '') .'>' . $category['title'] . '</option>';
}


echo '</select>
  </td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['downloads_form_description'] . '</b>&nbsp;</td>
  <td><table>
   ';
 
// Showing BBC?
if ($context['show_bbc'])
{
echo '
<tr class="windowbg2">

<td colspan="2" align="center">
', template_control_richedit($context['post_box_name'], 'bbc'), '
</td>
</tr>';
}

// What about smileys?
if (!empty($context['smileys']['postform']))
echo '
<tr class="windowbg2">

<td colspan="2" align="center">
', template_control_richedit($context['post_box_name'], 'smileys'), '
</td>
</tr>';

// Show BBC buttons, smileys and textbox.
echo '
<tr class="windowbg2">

<td colspan="2" align="center">
', template_control_richedit($context['post_box_name'], 'message'), '
</td>
</tr>
</table>';

      if ($context['show_spellchecking'])
      echo '
      <br /><input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\', \'description\');" />';



echo '
  </td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['downloads_form_keywords'] . '</b>&nbsp;</td>
  <td><input type="text" name="keywords" size="50" maxlength="100" value="' . $context['downloads_file']['keywords'] . '" />
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>', $txt['downloads_form_uploadfile'], '</b>&nbsp;</td>

    <td><input type="file" size="48" name="download" />
    </td>
  </tr>
   <tr class="windowbg2">
  <td align="right"><b>', $txt['downloads_form_uploadurl'], '</b>&nbsp;</td>
  <td><input type="text" name="fileurl" size="50" value="' . $context['downloads_file']['fileurl'] . '" />
  </tr>

   <tr>
  <td colspan="2" class="windowbg2"><hr /></td>
  </tr>';

foreach ($context['downloads_custom'] as $i => $custom)
{
echo '<tr>
<td class="windowbg2" align="right"><b>', $custom['title'], ($custom['is_required'] ? '<font color="#FF0000">*</font>' : ''), '</b></td>
<td class="windowbg2"><input type="text" name="cus_', $custom['ID_CUSTOM'],'" value="' , $custom['value'], '" /></td>

</tr>';
}


echo '
       <tr class="windowbg2">
<td align="right"><b>' . $txt['downloads_form_additionaloptions'] . '</b>&nbsp;</td>
<td><input type="checkbox" name="sendemail" ' . ($context['downloads_file']['sendemail'] ? 'checked="checked"' : '' ) . ' /><b>' . $txt['downloads_notify_title'] .'</b>
  </tr>';

  if ($modSettings['down_commentchoice'])
  {
echo '
   <tr class="windowbg2">
<td align="right">&nbsp;</td>
<td><input type="checkbox" name="allowcomments" ' . ($context['downloads_file']['allowcomments'] ? 'checked="checked"' : '' ) . ' /><b>',$txt['downloads_form_allowcomments'],'</b>
  </tr>';
  }
 
  // If the user can manage the downloads give them the option to change the download owner.
  if ($g_manage == true)
  {
  echo '<tr class="windowbg2">
  <td align="right">', $txt['downloads_text_changeowner'], '</td>
  <td><input type="text" name="pic_postername" id="pic_postername" value="" />
  <a href="', $scripturl, '?action=findmember;input=pic_postername;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);"><img src="', $settings['images_url'], '/icons/assist.gif" alt="', $txt['find_members'], '" /></a>
  <a href="', $scripturl, '?action=findmember;input=pic_postername;quote=1;sesc=', $context['session_id'], '" onclick="return reqWin(this.href, 350, 400);">', $txt['find_members'], '</a>
  </td>
  </tr>
  ';
  }

 
  // Display the file quota information
  if ($context['quotalimit'] != 0)
  {
echo '
   <tr class="windowbg2">
<td align="right">',$txt['downloads_quotagrouplimit'],'&nbsp;</td>
<td>',format_size($context['quotalimit'], 2),'</td>
  </tr>
   <tr class="windowbg2">
<td align="right">',$txt['downloads_quotagspaceused'],'&nbsp;</td>
<td>',format_size($context['userspace'], 2),'</td>
  </tr>
   <tr class="windowbg2">
<td align="right">',$txt['downloads_quotaspaceleft'],'&nbsp;</td>
<td><b>', format_size(($context['quotalimit']-$context['userspace']), 2), '</b></td>
  </tr>  
 
  ';
  }

echo '
  <tr class="windowbg2">
    <td width="28%" colspan="2"  align="center" class="windowbg2">
<input type="hidden" name="id" value="' . $context['downloads_file']['ID_FILE'] . '" />
    <input type="submit" value="' . $txt['downloads_form_editdownload'] . '" name="submit" /><br />';

  if (!allowedTo('downloads_autoapprove'))
  echo $txt['downloads_form_notapproved'];

echo '<div align="center"><br /><b>' . $txt['downloads_text_olddownload'] . '</b><br />
' . $context['downloads_file']['orginalfilename'] . '<br />
<span class="smalltext">' . $txt['downloads_text_views']  . $context['downloads_file']['views'] . '<br />
' . $txt['downloads_text_filesize']  . format_size($context['downloads_file']['filesize'],2) . '<br />
' . $txt['downloads_text_date'] . $context['downloads_file']['date'] . '<br />
</div>
    </td>
  </tr>
</table>

</form>
';

if ($context['show_spellchecking'])
echo '<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';


}


and here is the code for Downloads2.php for the function EditDownload():

function EditDownload()

{

global $context, $mbname, $txt, $modSettings, $user_info, $smcFunc, $sourcedir;



is_not_guest();



$id = (int) $_REQUEST['id'];

if (empty($id))

fatal_error($txt['downloads_error_no_file_selected']);



if ($context['user']['is_guest'])

$groupid = -1;

else

$groupid =  $user_info['groups'][0];



// Check if the user owns the file or is admin

    $dbresult = $smcFunc['db_query']('', "

    SELECT

    p.ID_FILE, p.allowcomments, p.ID_CAT, p.keywords, p.commenttotal, p.filesize,

    p.filename, p.approved, p.views, p.title, p.id_member,

      m.real_name, p.date, p.description, p.sendemail, p.fileurl, p.orginalfilename

    FROM {db_prefix}down_file as p

       LEFT JOIN {db_prefix}members AS m ON (m.id_member = p.id_member)

     WHERE p.ID_FILE = $id  LIMIT 1");

if ($smcFunc['db_affected_rows']()== 0)

    fatal_error($txt['downloads_error_no_downloadexist'],false);

    $row = $smcFunc['db_fetch_assoc']($dbresult);





    // Check the category permission

GetCatPermission($row['ID_CAT'],'editfile');



// Download information

$context['downloads_file'] = array(

'ID_FILE' => $row['ID_FILE'],

'id_member' => $row['id_member'],

'commenttotal' => $row['commenttotal'],

'views' => $row['views'],

'title' => $row['title'],

'description' => $row['description'],

'filesize' => $row['filesize'],

'filename' => $row['filename'],

'fileurl' => $row['fileurl'],

'allowcomments' => $row['allowcomments'],

'ID_CAT' => $row['ID_CAT'],

'date' => timeformat($row['date']),

'keywords' => $row['keywords'],

'real_name' => $row['real_name'],

'sendemail' => $row['sendemail'],

'orginalfilename' => $row['orginalfilename'],

);

$smcFunc['db_free_result']($dbresult);

// Check if spellchecking is both enabled and actually working.

// $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');

// $modSettings['disable_wysiwyg'] = !empty($modSettings['disable_wysiwyg']) || empty($modSettings['enableBBC']);





// Needed for the WYSIWYG editor.

require_once($sourcedir . '/Subs-Editor.php');



// Now create the editor.

$editorOptions = array(

'id' => 'description',

'value' => $row['description'],

'width' => '90%',

'form' => 'picform',

'labels' => array(

'post_button' => '',

),

);

// Needed for the WYSIWYG editor.

create_control_richedit($editorOptions);

$context['post_box_name'] = $editorOptions['id'];







// Custom Fields

$result = $smcFunc['db_query']('', "

SELECT

f.title, f.is_required, f.ID_CUSTOM, d.value

FROM  {db_prefix}down_custom_field as f

LEFT JOIN {db_prefix}down_custom_field_data as d ON (d.ID_CUSTOM = f.ID_CUSTOM)

WHERE ID_FILE = " . $context['downloads_file']['ID_FILE'] . " AND ID_CAT = " . $context['downloads_file']['ID_CAT']);

$context['downloads_custom'] = array();

while ($row = $smcFunc['db_fetch_assoc']($result))

{

$context['downloads_custom'][] = array(

'ID_CUSTOM' => $row['ID_CUSTOM'],

'title' => $row['title'],

'is_required' => $row['is_required'],

'value' => $row['value'],



);

}

$smcFunc['db_free_result']($result);





if (allowedTo('downloads_manage') || (allowedTo('downloads_edit') && $user_info['id'] == $context['downloads_file']['id_member']))

{

// Get the category information



$dbresult = $smcFunc['db_query']('', "

SELECT

c.ID_CAT, c.title, p.view, p.addfile

FROM {db_prefix}down_cat AS c

LEFT JOIN {db_prefix}down_catperm AS p ON (p.ID_GROUP = $groupid AND c.ID_CAT = p.ID_CAT)

WHERE c.redirect = 0 ORDER BY c.roworder ASC");

$context['downloads_cat'] = array();

while($row = $smcFunc['db_fetch_assoc']($dbresult))

{

// Check if they have permission to add to this category.

if ($row['view'] == '0' || $row['addfile'] == '0' )

continue;



$context['downloads_cat'][] = array(

'ID_CAT' => $row['ID_CAT'],

'title' => $row['title'],

);

}

$smcFunc['db_free_result']($dbresult);



// Get Quota Limits to Display

$context['quotalimit'] = GetQuotaGroupLimit($user_info['id']);

$context['userspace'] = GetUserSpaceUsed($user_info['id']);



$context['page_title'] = $mbname . ' - ' . $txt['downloads_text_title'] . ' - ' . $txt['downloads_form_editdownload'];

$context['sub_template']  = 'edit_download';



// Check if spellchecking is both enabled and actually working.

$context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');

}

else

fatal_error($txt['downloads_error_noedit_permission']);
}


There is this code in there that I'm concerned about the most:


// Needed for the WYSIWYG editor.

require_once($sourcedir . '/Subs-Editor.php');



// Now create the editor.

$editorOptions = array(

'id' => 'description',

'value' => $row['description'],

'width' => '90%',

'form' => 'picform',

'labels' => array(

'post_button' => '',

),

);

// Needed for the WYSIWYG editor.

create_control_richedit($editorOptions);

$context['post_box_name'] = $editorOptions['id'];


Strange enough, if I change the id of $editorOptions from "description" to "comment" then it seems to work.  Clicking on the BBC Buttons actually adds the code into the text area when Editing downloads, but then there is the problem when clicking on the Edit Download button, I get a completely empty post.

I originally thought it must be something improperly named in the template function template_edit_download() in Downloads2.template.php, however after looking this over, it seems that it has "description" in there, and that it doesn't have any id equal to "comment".

Is anyone else having this problem??  Can someone please help me with this as it seems to be very minor.  I have tried several things, tho, nothing I do seems to work :( :(

So Basically my question is:  How come I can click on the BBC Buttons and it works for Adding/Editing Comments, but Clicking on the same buttons when Add/Editing Downloads does not work (meaning it doesn't put the BBC into the textarea/post/download)???  AND How can I get this to work???  Is there some other place where "comment" is defined that i can take a look at to be sure that "description" is defined in there also???

Should I post up the code for Adding/Editing comments also???  So you can see that code and compare, which I have already done with absolutely NO LUCK!

SoLoGHoST


Aamid

I am not been able to use it on a different template other than the default.

SoLoGHoST

Ok, Here is an ADD-ON that I made for this MOD with an option for a Cool Layout, or Normal Layout (default)!  To see what the Cool Layout Looks like, go here - DEMO SITE for Downloads System MOD with Cool Layout Add-On.  Improved Rating System so that it will not give you the ability to rate your own downloads.  Also, if you have rated a download, Your Rating will be shown in place of where you rated that download instead of the Rating Options.  Fixed BBC buttons when Adding and Editing Downloads so that when clicking on these buttons, they will have an effect in the textarea.  Please note that this is a test site, and this is a theme that is not available in this package.

How to Install:

STEP 1 - Please be sure you have the Downloads System MOD INSTALLED before downloading and installing this "Cool Layout - MOD Add-On".

STEP 2 - After you have successfully installed the Downloads System Mod (Version 1.1.5).  Download and extract it.  Copy install.php to your root directory of where you have SMF installed (The same directory that index.php is located in) via FTP or whatever program. Run install.php from your web browser, once you have done this, delete install.php, and install the files relative to the paths that they are in in the unzipped folder.  Be sure to copy all of the files in their respective folder to your folders related to the root of your SMF installation (where index.php is installed).

Note:  The folder "your_themes" are files that should be copied/overwritten to your theme folders (whatever their names may be).  Once you have done all of this, Flush/Clear Your SMF cache (Admin->Forum Maintenance->Routine->Empty the file cache and TADA, the Cool Layout ADDON for the Downloads System MOD is now fully functioning.  To set a category to the Cool Layout, you will see a link called [Layout] in each Category View Box (right next to the [Permissions] link).  You can also specify how many files to show per page with the Cool Layout and the Normal Layout separately in Admin->Downloads Configuration->Settings :: Downloads per page (Normal Layout) - Default = 20 :: Downloads per page (Cool Layout) - Default = 5.

ENJOY!!  Took me awhile to figure this all out, but as you can see by the  DEMO SITE of what it actually looks like for guests/users/etc., it was well worth it.  Just thought other people would be interested in this also.

(EDIT:  Get the latest Cool Layout Add-On for the Downloads System MOD Below)

heinandar


SoLoGHoST

Sorry, don't think so, it was difficult enough to do for 2.0.  But you can always try it with 1.1.8, haven't tested it with this version tho... maybe it isn't any different at all.

EDIT:
Anyways, I'm still working on this AddOn, will post it up again when completely done!  But the download above is a good start for this Add-On.

Phlux-

Okay so the system is installed and working perfectly - the only problem is that uploading thru the upload system doesnt seem to work on files larger than about 3 megs - which directory can i upload the files via ftp to and how do i create entries on the download system for files allready existing on the folder - i looked around and things were not what they seemed.

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

Phlux-

max download under the download tab on admin was set by default to 5000000bytes - thats 5mb right i changed it to 10000000 - still wont work.

heinandar

Quote from: Phlux- on March 12, 2009, 07:51:41 AM
max download under the download tab on admin was set by default to 5000000bytes - thats 5mb right i changed it to 10000000 - still wont work.

you need to modify php.ini
this is usuall in /bin/php/php5.?.?/php.ini

post_max_size = 100M
upload_max_filesize = 100M

if your host are on VPS or Dedicated server , you can manage in whm in php settings.

if you are on share hosting, you can ask your host.

Phlux-

thanks man. i did that - im using shared hosting so the admin on that side had to do it for me - im sure it will fix it but if i have any other problems - il post them here.

1 other thing i wanted to ask is - can i use my ftp client to upload the files then just tell the download manager where to find them ?

heinandar

Quote from: Phlux- on March 12, 2009, 08:44:19 AM
thanks man. i did that - im using shared hosting so the admin on that side had to do it for me - im sure it will fix it but if i have any other problems - il post them here.

1 other thing i wanted to ask is - can i use my ftp client to upload the files then just tell the download manager where to find them ?

Nope you can't use ftp.

heinandar

Hello SoLoGhost
I only want to know how to edit like Attach file

SoLoGHoST

#719
Ok, I have finally completed the Cool Layout Add-On for the Downloads System MOD!  Read "How to Install.txt" for a step by step guide for you to install this add-on!

You can view the Cool Layout Addon in Action at:  Graphics Mayhem and at the Demo/Test Site

Read Notes carefully and follow instructions exactly as defined in the .txt file included in the package.  It's fairly simple to install.

Perhaps vbgamer45 will add it in the next release of this awesome MOD  ???

Solomon

EDIT:  Admin options in SMF for downloaded files (Download Configuration Settings for only files) had no effect on the Cool Layout, now it is very customisable from within the ADMIN and working fine! :)

For the 5 members who have downloaded it before, if you installed it on your forum just 1 step needed for this update, overwrite "Downloads2.template.php" and "Downloads2.php" in the .zip file and that's it!

For Everyone else - Follow instructions in the .txt file!!

Furthermore, would like to see your websites that are using this Add-On and how you are using it in your site if that would be okay.  Just post the URL in a reply to this topic would be fine.

Thanks,
Solomon

Advertisement: