News:

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

Main Menu

SimpleDownload

Started by crazystu, March 05, 2005, 02:41:47 AM

Previous topic - Next topic

sadiqbaig


oh tanx 4replying

can u plz tell me which lines  i ave 2edit

n wat 2add

!Hachi!

sadiq  go to themes/default/languages/Modifications.english.php and
search for
// Version: 1.0; Modifications

Add:
$txt['permissiongroup_downloads'] = "Downloads";
$txt['cannot_view_downloads'] = "You arent allowed to view the downloads!";
$txt['permissionhelp_view_downloads'] = "Allow this if you want this group to access the downloads";
$txt['permissionname_view_downloads'] = "Can view Downloads";


i think thats all you have to do in language files
Happy Ramadan

bbpiper

Anyone planning to update this for 1.1 RC2??

I tried to make it work but could not with the new default theme , could not get the tabs to work with it.


BHashman

#123
IIS 6.0 on W2003 server.  MySQL5.  PHP5. RC2 and SimpleDownload -
SMF RC2.  I just started using this for a company Intranet - not posted to the web yet.
Working in IE6.

With the old code all I got was "Hacking Attempt..." when clicking on the files in the Downloads window.  But I got it to work after changing the download.php file that is located in the root forum directory.

The download.php file uses the $HTTP_GET_VARS statement to get the directory and filename.  There are some posts out there that warn not to use $HTTP_GET_VARS but instead use $_GET to retrieve variables.  This has something to do with global variables and security that was invoked in PHP 4.

See here for an example:
http://www.gossamer-threads.com/forum/Gossamer_Links_C5/Products_C5/PHP_Front_End_F27/$HTTP_GET_VARS_not_working_P277939/ [nofollow]

Thus I modified the download.php file to read as follows:


<?php
// SimpleDownload 1.1.1 Hide Download Location
// By Nesianstyles

// Edited by BHashman 060110 - changed $HTTP_GET_VARS to $_GET which is I guess is a newer safer method to set variables with the register_globals set to off.  This is the default setting for the register_globals in PHP after version 4.2.0.


$rurl = "Downloads/";

$durl = $rurl.$_GET['d'].'/'.$_GET['name'];

if (
$_GET['name'])  {
header('location: '.$durl.'');
echo'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="refresh" content="0; url=index.php?action=downloads&amp;d='
.$_GET['d'].'" />
<title></title>
</head>
<body>
</body>
</html>'
;
} else {
echo 'Hacking Attempt...<br />';
}

?>


The resulting behavior:
When you click on a link in the downloads folder it displays the file in the browser.
Zip files will download automatically and open up the archive
If you right click - you can "Save Target As" and you are downloading the file.

Other items:
When installing this mod on RC2 the Downloads dir was not automatically created.  So you need to copy the Downloads dir and the contents of it (the .htaccess file) from the \Packages\temp dir after the install completes.

Also I don't see the downloads button displayed on the forum in RC2.  But you can get to the downloads dir by adding this line to the end of the address in your browser when you are at the forum index.  add everything inside the quotes "?action=downloads"

for example mine looks like this:  .../index.php?action=downloads

If you can get to the dir that way then the install did happen inside of RC2. 

Now to look at adding the downloads area to the tabbed section of RC2.  Prolly something to do the with index.template.php?  more on that later...

BHashman

OK - this morning I got the downloads tab to show up on the main forum index.  This takes a few modifications in the php files.  So consider this as an advanced level topic.

Backup your database before starting!  No kidding!  SMF makes this so easy to do there is no reason not to do so!

Files modified:
\Sources\Subs.php
\Themes\default\index.template.php
\Themes\default\languages\index.english.php

Open index.english.php
Scroll all the way to the bottom and paste the following

// Added for simple download
$txt['downloads'] = 'Downloads';
// Added for simple download


Save and close

Open Subs.php
Scroll down to line 3088 or search for this text

$context['allow_memberlist'] = allowedTo('view_mlist');


After that line paste the following


//  added for simple download
$context['allow_downloads'] = AllowedTo('view_downloads');
//  added for simple download



Save and close

Open index.template.php
Scroll down to line 551 or search for this text

// If the user is a guest, show [login] button.


BEFORE this line paste in the following

//  added for simple download
// the [download]!
if ($context['allow_downloads'])
echo ($current_action == 'downloads' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'downloads' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=downloads">' , $txt['downloads'] , '</a>
</td>' , $current_action == 'downloads' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
//  added for simple download



Save and close all files.  Refresh your browser.

If you are logged in as a Admin you will see the downloads button just to the right of the members button.

Now to test and set permissions.  I created a normal user account for testing.  With MIB in mind good old Zed seemed like a nice name for this guy. 

After creating a user account I can assign him to a group that has permissions to view the Downloads page.  To assign which groups have permissions to see the downloads page goto your admin panel...  and select "permissions" under the Members heading.  Select the "Modify" button on the group you want to grant access to see the downloads page.  You should see a choice titled "Can view Downloads".  Check the checkbox and save (you have to scroll all the way down to the bottom to find the save button).  Now anyone in that usergroup will have permission and see the Downloads tab on the forum index and their other pages.

Hope this helps!





Ne0z

is it possible to limit the downloads of each files ? the download link for each file exists and i could still download the file even though i was logged out as long i had the link. any ideas how to solve this issue ?

crazystu

Quote from: BHashman on January 10, 2006, 08:50:34 PM
IIS 6.0 on W2003 server.  MySQL5.  PHP5. RC2 and SimpleDownload -
SMF RC2.  I just started using this for a company Intranet - not posted to the web yet.
Working in IE6.

With the old code all I got was "Hacking Attempt..." when clicking on the files in the Downloads window.  But I got it to work after changing the download.php file that is located in the root forum directory.

The download.php file uses the $HTTP_GET_VARS statement to get the directory and filename.  There are some posts out there that warn not to use $HTTP_GET_VARS but instead use $_GET to retrieve variables.  This has something to do with global variables and security that was invoked in PHP 4.

See here for an example:
http://www.gossamer-threads.com/forum/Gossamer_Links_C5/Products_C5/PHP_Front_End_F27/$HTTP_GET_VARS_not_working_P277939/

Thus I modified the download.php file to read as follows:


<?php
// SimpleDownload 1.1.1 Hide Download Location
// By Nesianstyles

// Edited by BHashman 060110 - changed $HTTP_GET_VARS to $_GET which is I guess is a newer safer method to set variables with the register_globals set to off.  This is the default setting for the register_globals in PHP after version 4.2.0.


$rurl = "Downloads/";

$durl = $rurl.$_GET['d'].'/'.$_GET['name'];

if (
$_GET['name'])  {
header('location: '.$durl.'');
echo'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="refresh" content="0; url=index.php?action=downloads&amp;d='
.$_GET['d'].'" />
<title></title>
</head>
<body>
</body>
</html>'
;
} else {
echo 'Hacking Attempt...<br />';
}

?>


The resulting behavior:
When you click on a link in the downloads folder it displays the file in the browser.
Zip files will download automatically and open up the archive
If you right click - you can "Save Target As" and you are downloading the file.

Other items:
When installing this mod on RC2 the Downloads dir was not automatically created.  So you need to copy the Downloads dir and the contents of it (the .htaccess file) from the \Packages\temp dir after the install completes.

Also I don't see the downloads button displayed on the forum in RC2.  But you can get to the downloads dir by adding this line to the end of the address in your browser when you are at the forum index.  add everything inside the quotes "?action=downloads"

for example mine looks like this:  .../index.php?action=downloads

If you can get to the dir that way then the install did happen inside of RC2. 

Now to look at adding the downloads area to the tabbed section of RC2.  Prolly something to do the with index.template.php?  more on that later...
That download.php issue was solved a while ago, I showed someone else on my site. All it does is change the varibles from using the long and old method to the short and new method. If you do that, it works exactly like the old one.

This Mod is for 1.0.5, and it hasn't been updated for 1.1rc2 yet.
I have allot of themes I need to update first.

EDIT: Please post on my forum here instead of posting in this topic as I don't look here very much but I check my forums everyday.

SunBlind

What's up with the cryptic image variables? Is there any way to change the file icons?
-§- SunBlind
hxxp:tutorials.dreammare.net [nonactive]

Elrond

I'm wondering about the same thing here. I think it is the actual txt-based code for the images themselves. Not too sure on this though. Seems the images are created right within the code.

SunBlind

-§- SunBlind
hxxp:tutorials.dreammare.net [nonactive]

Tyegurl

okay couldn't get it to work and i did everything you told me to lol....can you help me?

andriyko

Man, if this had an option for regular mortals to upload files from the forum, this mod would be GOLD. As most of my users are computer illiterate no one knows how to use ftp.. even with all the help i've posted.

So... I was wandering if ANYONE could direct me how I would go about adding some functionality like that to this mod (i.e. UPLOAD option/button). The problem is that I only want the members to be able to upload.
Thnx if anyone helps!
you can also email me directly at drozzy (eeht) gmail.com

Jessie~chan

Hi, I'm trying to install SimpleDownload for my forum but I get this error:

QuoteHacking Attempt...

How do I fix that?

andriyko

Bump...  8) Sorry but could anyone help out?
...with getting some kind of upload script going with this mod?
Thank you!

bodycount

Hi

I'm trying to get this mod working on my site but the auto install for the mod failed when trying to access

index.php
index.template.php

I added code to the index.template that calls the action  for downloads and then added the following to the forum/index.php file


                'dlattach' => array('Display.php', 'Download'),

-->           'download' => array('Downloads.php', 'Downloads'),        <--

                'dumpdb' => array('DumpDatabase.php', 'DumpDatabase2'),


                'editagreement' => array('Admin.php', 'EditAgreement'),


This seems to work upto a point, it allows users to download from the downloads directory but if they click on a sub directoy they just default back to the main forum page.

I think the problem is that when they click on the subdirectory the page call is
.... index.php?action=downloads&d .... etc..

If I type in the same command but with .... index.php?action=download&d .... the command works

Can anyone tell me how to rectify this have I missed something from the forum/index.php file that is required ?

Yellowrose

I am currently using SMF ver 1.0.7 and would like to incorporate a  downloads section to my site.

The site is a downloads directory that allows visitors and members to search for available user created game content. Some of the older fansites have closed their sites and i would like to be able to make the files available again. will this version of Simple Download work for me ?

DemonicInfluence


Yellowrose

Thank you for your reply.

Got the mod installed with created directories and it is working great. You help is very much appreciated.

Yellowrose

As in my last post I got the mod installed and it works great on the default themes but I wiuld like to go back to using Mystica's Loon Turquoise theme I had been using before installing the mod. I know there are php files to be manually edited but have no idea what gets edited or where in these files. I would greatly appreciate it if someone could point me in the right direction so I can do the needed editing and get my previous theme working on my site again.

Flying Drupalist

Are there any possibilities of re-release for RC2? Thanks!

Advertisement: