UBB.Dev
Posted By: Aglavalin File Download Page v1.0 - 09/20/2002 9:31 AM
Mod Name / Version - File Download Page v1.0

Description - Allows administrator to setup a Download page, seperate from UBBT, where allowed users can upload and maintain files and descriptions. Files can be categorized, and will display who uploaded them, and a download count. Uploaders can return and edit, delete, or upload a newer version of the file. Admin has full control with admin pages to edit and delete files. Custom settings include file size limit and file type restrictions.

Example - http://www.newoutriders.org/downloads/index.php

Pre-requisites - none

Author - Aglavalin, aka Steve Stout

Files Altered - config.inc.php

Database Altered - Only two tables are created, thus, very removable.

New Files - doeditcategories.php, doeditmyuploads.php, douploadfile.php, download.php, editcategories.php, editdownloads.php, editmyuploads.php, getdownload.php, index.php, updatedownload.php, updateupload.php, uploadfile.php

Credits: Dslam for suggesting this addon.

Notes: All new files go into their own directory, i.e. domain.com/downloads. The files are designed to work with an installation of IIP 4.3, so if you are using a different page layout, you will need to edit each page except for download.php to match your site.


Here is what I believe to be a good working copy.

Attached File
Posted By: msula Re: File Download Page v1.0 - 09/20/2002 4:29 PM
Holy crap, that's awesome! Now, not to be picky... but do you think in the future you could allow the admin to setup categories? Say documents, programs, etc..

Thanks for the good mods lately!
Posted By: Gardener Re: File Download Page v1.0 - 09/20/2002 4:41 PM
Nice one! I'll definitely try this one out as soon as I've updated my own mods.
Posted By: JoshPet Re: File Download Page v1.0 - 09/20/2002 5:37 PM
Very cool.
I might check this out this weekend, as I'm thinking about a use for this for Video Files on my site.
Thanks.
Posted By: AllenAyres Re: File Download Page v1.0 - 09/20/2002 6:56 PM
Yes, very nice

I agree with Jeremy, categories would be a very nice next step
Posted By: Dslam Re: File Download Page v1.0 - 09/20/2002 9:38 PM
Cool deal thanks
Posted By: Aglavalin Re: File Download Page v1.0 - 09/20/2002 10:03 PM
It does have categories. You need to have admin authority to see the admin links show up on the index.php page. But it does put everything on one page. I plan on giving the option to make each category a seperate page in the next version, perhaps multiple pages with a max file limit admins can set.

This addon ended up being quite massive, so I had to set some limits to get it done! LOL

It will not let you delete a category if files are still in it. If you rename a catagory, it will update the category name for each file in the database. I tried to make it foolproof, because if a file has an invalid category name, it will not show up on the list as a download. Editing the table by hand is such a pain.

Please let me know what else this addon could use, maybe I'll add it next version.
Posted By: Aglavalin Re: File Download Page v1.0 - 09/20/2002 10:44 PM
OK, seems like I messed up the second table creation syntax. I'll fix it and make the ubbt path a config file feature and reupload an updated version today!

The second table creation syntax should be:

code:

CREATE TABLE w3t_Dlcat (
DL_CategoryName varchar(30) NOT NULL,
DL_CatOrder tinyint(3) Default '0' NOT NULL,
KEY DL_CategoryName (DL_CategoryName)
);

Posted By: Aglavalin Re: File Download Page v1.0 - 09/20/2002 11:00 PM
Updated directions with a fix to the second table creation syntax.

The path to the main.inc.php file can not be put in the config file because these files are in a different directory than UBBT. Perhaps in a future release I will create a seperate config file for this addon, which would remove the need to edit this in each file. I gotta think about this a bit.

The $BasicTitle can be cusomized for each page, thus I prefer to leave it in each page for full feature. The pals path is probably gonna be edited out by many, I'll wait for some more feedback on this before making any changes.

Attached File
Posted By: Dslam Re: File Download Page v1.0 - 09/21/2002 1:06 AM
she's a working great
thanks
if your runing ipp5 the pal menu does not work .
so remove it or find a way to fix it .
Posted By: Gardener Re: File Download Page v1.0 - 11/18/2002 4:50 AM
I just made a trial installation of this, finally, and found some minor caveats.

First, the category list numbers need to start from 0 and be consecutive numbers, which wasn't entirely clear, should be in the description. Or even better, why not just sort by the number and do the loop on the number of rows returned?

Also, the check for if the user is in the right group isn't entirely correct. If the group chosen is first on the list, php returns a false value (position 0). Just change the following:

if (!strpos($user['U_Groups'],$dlgroup)) {

to this, in all pages:

if (strpos($user['U_Groups'],$dlgroup) === false) {


It was also a bit of a pain that the configuration strings weren't the same in all files, it would have made it so much easier to do a search and replace. =]


I think it might be a good idea to add the updated instructions to the main package in the first post of this thread.
Posted By: Lerosia Re: File Download Page v1.0 - 12/03/2002 5:46 PM
I am trying out this mod but not sure I understand this line:

$palspath = "c:/inetpub/wwwroot/YOURDOMAIN.COM/pals/";

"To match your paths. If you are not using IIP 4.3, then remove the '$palspath... line and replace with what you are using for menu/page layout. There is an include of menupal.php which you will want to edit or remove if not using IIP 4.3. Change the $BasicTitle to what you want to call each page, or leave them all the same for the whole section."


Question 1 What is IIP 4.3?

Question 2 What is a palspath?

Question 3 What is it referring to when it says "remove the '$palspath... line and replace with what you are using for menu/page layout?

What would I be using for menu/page layout in UBBT?

Question 4 In the line: $config['dlgroup'] = "5";

What the heck does 5 represent?

So, before I complete this one, is the a new version with Gardener's minor caveat suggestions above?

I havent even gotten to that issue yet

Thanks in advance

Lerosia


Posted By: Gardener Re: File Download Page v1.0 - 12/03/2002 6:22 PM
Here are some answers for you:
  1. IIP 4.3 is JustDaves Integrated Index Page add-on, which can be found in the Forum Design Integration board. The latest version is 5.x which I think might not be completely compatible with this script. It might be though.
  2. palspath is from the IIP add-on and is the path to where all the scripts for that add-on is located. Usually it is a sub-directory of the ubbthreads directory called "pals".
  3. It means that in order to get a menu if you don't have the IIP add-on you will have to create your own menu with at least a link to the main page of this download add-on.
  4. The number is the number of the user group that users have to be in to be allowed to download. If you want everyone to be able to download, set it to 3, which should be the regular user group. If you want to use some other group, you can find out which number it has by running the query below in the Admin->SQL Command page:
    select * from w3t_Groups
  5. I don't think anyone has done any work on this, and I'm not using it myself either, I just tried it out to see if it was what I wanted. I will probably wait for the extended download functions which are going to be added to a future version of JustDaves IIP add-on. The script should work without the things I mentioned, those were just some tips to make life easier.
Posted By: Lerosia Re: File Download Page v1.0 - 12/04/2002 1:44 AM
AHHHH..no wonder I couldnt figure it out.

This should teach me a valuable lesson about *BETA*



Thank you Gardener..I will check out the IIP as well


Lerosia
Posted By: Dslam Re: File Download Page v1.0 - 12/04/2002 4:36 AM
this download addon works fine .
if you don't have ipp then you have to open each page & edit out the calls to the menupal

Posted By: yors Re: File Download Page v1.0 - 06/21/2003 8:28 AM
OK Josh, saw you online right after I posted the suggestion, reading this. So am here too. Silly me

Reading it too...
Posted By: JoshPet Re: File Download Page v1.0 - 06/21/2003 8:28 AM
he he

That's OK - this is an old one - took me a bit to dig it up, but I thought I remembered it.
Posted By: oceanwest Re: File Download Page v1.0 - 07/04/2003 9:05 PM
Ok I added this and it doesn't work So now I want to get rid of it and undo the database changes... How do i do this?
Posted By: omegatron Re: File Download Page v1.0 - 07/04/2003 11:44 PM
Delete those tables in your database

You can use phpmyadmin http://www.phpmyadmin.net or any other brand you use
Posted By: smilesforu Re: File Download Page v1.0 - 02/16/2004 9:50 AM
Anybody running this on 6.4?
Posted By: DrChaos Re: File Download Page v1.0 - 02/27/2004 3:52 AM
I tried to install it on a 6.3.2 board not using the iip. and it was harder than I thought. I never did get it right. I deleted it all and ill try again later.
Posted By: smilesforu Re: File Download Page v1.0 - 03/01/2004 9:05 AM
getting errors myself

SQL ERROR: Mon, Mar 01 2004 01:59:41 -0500 Unable to do_query: SELECT DL_CatOrder FROM w3t_Dlcat ORDER BY DL_CatOrder ASC
Unknown column 'DL_CatOrder' in 'field list'
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /....../ubbthreads/mysql.inc.php on line 160
SQL ERROR: Mon, Mar 01 2004 01:59:41 -0500 Unable to do_query: SELECT DL_CategoryName,DL_CatOrder FROM w3t_Dlcat ORDER BY DL_CatOrder ASC
Unknown column 'DL_CatOrder' in 'field list'
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /............/ubbthreads/mysql.inc.php on line 160
Posted By: smilesforu help with mysql error? - 03/02/2004 12:20 AM
sql idiot here but it looks like

DL_CatOrder isn't in the w3t_Dlcat

I browsed the database and don't see that hiding in there. Is that right?
Posted By: slayer60 Re: help with mysql error? - 03/02/2004 12:55 AM
That's what it looks like to me. If you add that field it should get rid of that error.

Then you can troubleshoot the next error that pops up.
Posted By: smilesforu Re: help with mysql error? - 03/02/2004 1:01 AM
How do I add it? I am sql stupid
Posted By: scroungr Re: help with mysql error? - 03/02/2004 1:03 AM
well the first question is what the field is? is it an INT or a VARCHAR or a.. and what length and if an INT is it autoincrement.. there is alot of questions.. before you just add a field...
Posted By: smilesforu Re: help with mysql error? - 03/02/2004 1:19 AM
its for this mod beyond that I am clueless
Posted By: smilesforu Re: help with mysql error? - 03/02/2004 1:21 AM
According to this command

CREATE TABLE w3t_Dlcat ( DL_CategoryName varchar(30) NOT NULL, DL_CatOrder tinyint(3) Default '0' NOT NULL, KEY DL_CategoryName (DL_CategoryName));

I used that command but it didn't work properly?
Posted By: scroungr Re: help with mysql error? - 03/02/2004 1:37 AM
okay this mod is having you create two tables did the first one w3t_Downloads get created? Is it both that are giving you problems or just the second one w3t_Dlcat? BTW the notes say that creating the second table w3t_Dlcat with balk an error.
Posted By: smilesforu Re: help with mysql error? - 03/02/2004 11:05 AM
I ran both.. page comes up but it generates errors on the page. So far the only error I get is the one I posted above
Posted By: scroungr Re: help with mysql error? - 03/02/2004 3:43 PM
Hrmmm really need to see what the $user is throwing out.. Generic Threw an error? Hmmm ok well thats why I have IIP... do you have phpMyAdmin loaded on your box or another front-end like CPANEL or PLESK? I would have you go in and verify that it created the table..
Posted By: smilesforu Re: help with mysql error? - 03/02/2004 10:53 PM
yup I have cpanel phpMyAdmin and IIp (but the newer version)
Posted By: scroungr Re: help with mysql error? - 03/02/2004 11:10 PM
ok then use phpMyAdmin and see if the w3t_Dlcat was created
Posted By: scroungr Re: help with mysql error? - 03/03/2004 12:47 AM
ok I just added this to my test board and I will have to say the instructions are wropng.. you need to sql this table not the opne in the instructions

CREATE TABLE w3t_Dlcat (
DL_CategoryName varchar(30) NOT NULL,
DL_CatOrder tinyint(3) Default '0' NOT NULL,
KEY DL_CategoryName (DL_CategoryName)
);

secondly I would use Allen's code check

change

if (!strpos($user['U_Groups'],$dlgroup)) {

to this, in all pages:

if (strpos($user['U_Groups'],$dlgroup) === false) {


lastly it's Beta and thus needs some work...
Posted By: scroungr Re: help with mysql error? - 03/03/2004 2:11 AM
okay smiles here use this zip I fixed a few things that Allen had suggested on the first page in all the files. Also included the correct tables and um oh yeah when you delete the file it does delete it from the database but not off the server but I figure thats a good thing cause you don't want willy-nilly to be able to delete things off your server with this script..I would suggest using the File Atachments download on the IIP menupal and the file attachments of threads itself but this script does do a few things they don't like allow for categories...

Attached File
109169-downloaddirectory.zip  (48 downloads)
Posted By: smilesforu Re: help with mysql error? - 03/03/2004 10:39 AM
Appreciate the help.. I gave it a whirl tonight and got the same errors hmm.
Posted By: smilesforu Re: help with mysql error? - 03/03/2004 12:05 PM
I deleted and am going to just use the iip and private forums.
© UBB.Developers