PDA

View Full Version : My Downloads v1.2 - A Download Manager for VBulletin


ipas2
12-25-2004, 10:00 PM
Well well.. have I been busy in such a short time.. hehehe.. I listened and i changed... here's a newer version, more integrated it is..

What does this script do ?

This script indexes your download directory of your website and put this information
into records on your database. Now you can track who is downloading your files and you get
information how popular each file is.

version 1.2
- Use of templates in vbulletin
- The download database is integrated into the forumdatabase
- Use of vbulletin stylesheets
- Auto index of subdirectories ( 1 layer ) into download-categories.
- Auto clean up of log database when file is removed from the database
(The Cleanup button has been removed)
- IP address logging added
- Gifs are made transparent
- Non admin auto update option
- Some other small tunes...

version 1.1
not released

version 1.0
Features:
- Auto index of the download directory
- Easy add descriptions to files
- Easy database cleanup of deleted files
- Restrict the usergroups who may download
- Tracking of downloads.
- Display download history of a file by admin group.
- Database cleanup by admingroup

Nice to know:
- Easy to install for not-dummies
- Its just one php script

The package:
- download.php - this is the actual script ( you can rename this )
- mydownloads.sql - database strucure
- mydownloads.template.txt - Vbulletin template
- ./gifs/ - gifs
- install.txt - this file

cinq
12-26-2004, 08:57 AM
Nice idea, but I just tried it, and it doesn't work.
Cannot detect files in download folder.

Btw, might be better off using templates and phrases, instead of hardcoding everything.
Also, might want to create the 2 tables in the existing vb one, easier for a lot of people :)

ipas2
12-26-2004, 09:32 AM
Are u seening the UPDATE and CLEAN buttons ? if not.. probably you are not member of the admin group.
did u check $dir='./download/'; ?

About the templates.. you are right. Actually this is my first vbulletin script. I have to find out about those phrases. Think about modifying it in the future.

cinq
12-26-2004, 09:39 AM
Nope, I cannot see the buttons. I am admin.

Download dir is correctly set I should think,
I tried full path too, likewise no go :(

ipas2
12-26-2004, 09:43 AM
If you dont see the buttons then somehow you are not validated to see them. Line 14 of the script defines group 6 to be admin. Check if your admin group is 6 otherwise change this number in the script.

T3MEDIA
12-26-2004, 11:47 AM
I will ginny pig this out. Let you know about errors.

boo.3
12-26-2004, 12:13 PM
ok so is this a download manager? like you upload files to it and they can download? lol

or is this from another program?

neo88
12-26-2004, 05:55 PM
Before I try this out, can you index files from another server. Say if you have a media host.. Could you link the links off of that..?

Freezerator
12-26-2004, 08:43 PM
It would be nicer if i can add a location of a file, and that would be downloadable :)

PixelFx
12-27-2004, 04:06 PM
This looks really promising

jamesk
12-27-2004, 05:49 PM
Before I try this out, can you index files from another server. Say if you have a media host.. Could you link the links off of that..?

I'm curious of this too. Any way that a specified Usergroup Can Upload to the interface as well?

cinq
12-28-2004, 12:58 AM
I don't think there is any upload feature.
It merely scans the files in the specified dir.

alkatraz
12-28-2004, 03:27 AM
The script does exactly what ipas2's says it does and does a great job at it. Unfortunately it requires so much custimization that it's a huge pain the butt to install. Not only do you have to edit the css inside the document, they aren't titled acurately. "zx, result, chill, updated" ?? What kind of naming system is that. The gifs don't have transparent backgrounds so even if you take the time to customize the css, you still have to create your own icons.

Anyways, thx for releasing this hack and it has a lot of potential but should really be released as a beta until these basic things are taken care of.

Skyline_GT
12-28-2004, 03:40 AM
do you have a live demo?

WPH|EmaX
12-28-2004, 08:53 AM
I will have one soon on my site.
i like it.
i'll post link wen i get it all installed.

ipas2
12-29-2004, 11:44 AM
Indeed..I'm busy with a more updated version. This one scans also one subdirectory layer in the download directory and put this into categories. Have a version online on my website http://www.groningen.it -> Downloadbutton

The css is indeed a bit complex because I copy/pasted it from another script of mine. In this version it's more clear.
I will also try to fix it in templates but due to lack of time I doubt this will succeed.

I thought about the upload feature, but in this case what good is a autoindex feature. !?

Then again.. I'm openminded about sugestions.. :)

Grtz
Ipas

cinq
12-29-2004, 11:53 AM
Indeed..I'm busy with a more updated version. This one scans also one subdirectory layer in the download directory and put this into categories.
That would be a nice addition ( i see it is already working nicely on your site :) )


The css is indeed a bit complex because I copy/pasted it from another script of mine. In this version it's more clear.
I will also try to fix it in templates but due to lack of time I doubt this will succeed.
Why not just use vb css/templates ?


I thought about the upload feature, but in this case what good is a autoindex feature. !?
Perhaps a means to upload files ( even past the 2mb barrier for most php.ini ) to the download directory ( or subfolders in download directory ) for your script to index them later.

Also, an installer would be good. :)

Keep up the nice work Ipas :D

bkbelew
12-29-2004, 08:31 PM
I had some problems executing the mydownloads.sql script in plesk. Probably because our database versions differ? It was throwing up syntax errors. So I edited the script to get rid of all the dumps, and what not.. it worked.. if anyone else is having this problem.. here you go:

CREATE TABLE files (
fileid int(11) NOT NULL auto_increment,
filename varchar(255) NOT NULL default '',
info longtext NOT NULL,
PRIMARY KEY (fileid,fileid)
) TYPE=MyISAM;
CREATE TABLE log (
logid int(6) unsigned NOT NULL auto_increment,
filename varchar(255) default NULL,
dldate date default NULL,
dltime time default NULL,
dluser varchar(255) default NULL,
dlipaddr varchar(15) NOT NULL default '',
PRIMARY KEY (logid)
) TYPE=MyISAM;

bkbelew
12-29-2004, 08:46 PM
Btw, is there any way to make it auto update, so my members dont have to click update before they can see the downloads?

ipas2
12-30-2004, 06:05 AM
I'm busy with a newer version. I will add this option so files will autoindex if selected.

neo88
12-30-2004, 06:10 AM
All these ideas are nice, When will we be seeing these ideas in our forums..??

Onkel_Tom
01-06-2005, 10:32 PM
Hi all,
I installed this hack on my testboard. Great Idea !
But there are so many wishes for the new release:

include in vB database and get the dbname etc. from includes/config.php
vB Style
transparent background in images
phrasen version to translate in other languages
installation script for phrases from a .xml file
vbformating for date, filesize etc.
last download also add the date
if somebody uses a link like "http://www.yourdomain.tld/forums/download.php?download=18" don't show the content of the download page

I'm waiting for the next release ;)
thanks in advance

Viks
01-07-2005, 05:32 AM
I was just reading through the messages... this appears to be a really good mod. I will definately look forward to the update release.

ipas2
01-07-2005, 07:44 AM
Ooof... thnx for the suggestions. I'm busy extracting the script to a vb template and integrate it more into vb. I have not done this one before, but i will manage.

i'l keep u informed.

ipas

jluerken
01-08-2005, 06:33 PM
Ooof... thnx for the suggestions. I'm busy extracting the script to a vb template and integrate it more into vb. I have not done this one before, but i will manage.

i'l keep u informed.

ipas

I downloaded and installed the latest version.
I created the three new tables and put some test files in the dir.
They are written to the database but not shown in any way.

I also don't understand and see where I can create categories.

This version is now working for me.
http://www.clanforums.com/forum/download.php

ipas2 can you please add TABLE PREFIXES to the next release cause I think many users are using those?

In the actual downloadable version the file mydownloads_template.txt seems to be broken. There is no footer information in the file.


$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$dlnavbar

$error
$deletemsg
$addmsg

$dlcontent

$mydlversion


This is all :D

ipas2
01-08-2005, 09:06 PM
Like I said before, you must be forum admin to have the update button. This will scan the download directory for main category and subdirs for other categories. You will see messages when new dirs or files has been added or deleted to the database.
Other thing... categories without files will not be shown.

Uncommend the auto_update option in the script if you want the update to be done all the time.. even if users are viewing the page.

prefixes of tables.. all three added tables starts with 'mydl_' , so they dont conflict with possible other scripts.

if you want a footer, just add '$footer' at the end of the template.:rolleyes:

Grtz,
ipas

neo88
01-16-2005, 10:21 AM
When will you impliment the remote url linking??
Unless its already done so..

lebanon
01-17-2005, 11:28 PM
i installed this script and i got the BUTTON update database , so i did
Found files i added
But when i go to /download.php it shows the forum page with
My Downloads v1.2
The page loads normally , but missing the download links !!!
Is there something wrong could have been done to cause this ?
Update database shows correct files btw .

Onkel_Tom
01-18-2005, 12:45 AM
But when i go to /download.php it shows the forum page with
My Downloads v1.2

Same for me ;)
You need a small workaround to get this work.
Just go to your download directory and add a subdirectory there. It doesn't matter what the name is, just a new Subdirectory under your "Download-Root" Directory.
After that open your download.php again and klicke on "update database" and you will see your files ;)

ipas2, can you fix this for the first installation or update on a board ?
btw, great work for Version 1.2 ! many thanks

Onkel_Tom
01-18-2005, 12:57 AM
@ ipas2

You should use the following header to be "vB" conform and also to cache your Template mydownloads which is actually uncached.

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'mydownloads');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
'mydownloads'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

also it would be very nice if you can change the colours of each Download entry with the alt1, alt2 tag.

Onkel_Tom
01-18-2005, 01:48 AM
For those people who wants to have formated filesizes:

find:// Check if the file is OFFLINE
if ($runrootonce){
if (file_exists($dir . $filename)) {
$filesize= (filesize($dir . $filename));
}
else{
$filesize='OFFLINE';
$offline=true;
}
}
else{
if (file_exists($dir . $catname . '/' . $filename)) {
$filesize= (filesize($dir . $catname . '/' . $filename));
}
else{
$filesize='OFFLINE';
$offline=true;
and replace it with:// Check if the file is OFFLINE
if ($runrootonce){
if (file_exists($dir . $filename)) {
$filesiz= (filesize($dir . $filename));
if ($filesiz < 1024) {
$filesize= $filesiz.' b';
}
elseif ($filesiz < 1048576) {
$filesize= vb_number_format($filesiz / 1024 ,0).' kb';
}
elseif ($filesiz > 1048576) {
$filesize= vb_number_format($filesiz / 1048576 ,2).' mb';
}
}
else{
$filesize='OFFLINE';
$offline=true;
}
}
else{
if (file_exists($dir . $catname . '/' . $filename)) {
$filesiz= (filesize($dir . $catname . '/' . $filename));
if ($filesiz < 1024) {
$filesize= $filesiz.' b';
}
elseif ($filesiz < 1048576) {
$filesize= vb_number_format($filesiz / 1024 ,0).' kb';
}
elseif ($filesiz > 1048576) {
$filesize= vb_number_format($filesiz / 1048576 ,2).' mb';
}
}
else{
$filesize='OFFLINE';
$offline=true;

It's only quick and dirty but it works ;)

Onkel_Tom
01-18-2005, 02:04 AM
Okay, some more bugfixes:

In Template mydownloads find at the end:$footer
add after:</body>
</html>

Find in file download.php:eval('$dlnavbar = "' . fetch_template('navbar') . '";');
add before:$navbits = array();
$navbits[$parent] = 'Downloads';

$navbits = construct_navbits($navbits);

But my "exploded" tablesize is not gone :(
horizontal size is toooo long for my display..
I will look for that tomorrow ;)

ipas2
01-18-2005, 08:03 AM
It looks a version 1.3 is needed :) Uncle Tom, I will look at your fixes soon.
I have to familliar myself more with those templates I guess.

I found a bug myself. In the template replace the phrase $error to $errormsg
This are messages when a non-logged-in user tries to download a file.

Grtz,
Ipas

Onkel_Tom
01-18-2005, 02:00 PM
I get the following db error on the screen while downloading a file from downloads root directory. But the download will happen ! It's only an error on the screen.
Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 18 in /download.php on line 80
I changes line 80 to the original line of your version ipas2
I think this happen because there is no catid entry for the root download dir in the database...

ipas2
01-18-2005, 08:06 PM
You're right. Will be fixed in 1.3
For now:
Replace line 80,81,82

$cat="SELECT * FROM mydl_category WHERE catid=$dlcat";
$catresult=mysql_query($cat);
$dldir=mysql_result($catresult,0,"directory");

To:

if ($dlcat!=0){
$cat="SELECT * FROM mydl_category WHERE catid=$dlcat";
$catresult=mysql_query($cat);
$dldir=mysql_result($catresult,0,"directory");
}

Grtz
Ipas

ipas2
01-19-2005, 06:06 AM
[QUOTE=Onkel_Tom]For those people who wants to have formated filesizes:

Thnx Oncle_Tom.. :) added !

yoyoyoyo
01-19-2005, 06:59 AM
excellent hack, but how about adding the ability to count the downloads and display the top 5, 10, 20 (or however many the admin wants) most popular downloads?

ipas2
01-19-2005, 08:06 AM
excellent hack, but how about adding the ability to count the downloads and display the top 5, 10, 20 (or however many the admin wants) most popular downloads?

That should not be a problem. I thought about this myself. Version 1.3 I guess

yoyoyoyo
01-19-2005, 08:38 AM
That should not be a problem. I thought about this myself. Version 1.3 I guess
cool. Would a password protected download be a problem? maybe each file could have a password that the admin specifies in the control panel? or only certain user ID #s are allowed to d/l certain files?

gigaenvy
01-20-2005, 10:15 PM
Hi all,
I installed this hack on my testboard. Great Idea !
But there are so many wishes for the new release:

include in vB database and get the dbname etc. from includes/config.php
vB Style
transparent background in images
phrasen version to translate in other languages
installation script for phrases from a .xml file
vbformating for date, filesize etc.
last download also add the date
if somebody uses a link like "http://www.yourdomain.tld/forums/download.php?download=18" don't show the content of the download page

I'm waiting for the next release ;)
thanks in advance


along with anti-leeching support such as specifying 1 download for each ip address.

Onkel_Tom
01-21-2005, 05:13 AM
ipas2, there should also be a parameter in download.php to enable or disable the main output screen of download.php.
I think there are a lot of applications the provider is not willing to show to complete content of his downlad directory and the subs. So a download could only be startet if the downloader knows the ID of the file and submit it directly in the download string.

I think this could be very easily doen by adding a routine like the "no_permisson" just asking if the display output setting is off or on.

T3MEDIA
01-27-2005, 07:02 AM
All these little changes and for nows untill 1.3 are they in the file or should I go thru this form to have the install done properly?

Not being rude just dont feel link installing for nothing. rahter copy everything now.

Onkel_Tom
01-27-2005, 07:10 AM
@ T3MEDIA
With my minor changes and hints you will get version 1.2 to run. But if you want more functionality you must wait until version 1.3 ;)

cdasso
01-29-2005, 02:31 AM
Onkel Tom:

Did you ever get the wide table thing fixed? I got the thing working but it makes the navbar really wide.

Also after a download moves the whole page down a line or two. :ermm:

Onkel_Tom
01-29-2005, 07:36 AM
My time is limited at the moment so I'm also waiting for version 1.3 to begin new "bugfixing".
I didn't use this hack in my live-board until all bugs are fixed.
I have no idea why the table is to wide.

ipas2
01-29-2005, 07:40 AM
There is a setting to adjust the table width in the script.

$tablewidth=665; // The width of the table

My time is also limited. Beta's are downloadeble on my site. I added one new feature. Auto thumbnails if a file is a MPEG file. It only works on linux..

Grtz
Mark

Onkel_Tom
01-29-2005, 07:49 AM
this tablewidth variable only changes the size of the download table but never fix the problem of the to wide navigation table of the header.
I tested with several sizes but never get the header in size

Onkel_Tom
01-29-2005, 07:53 AM
I can't access your site www.groningen.it
When I open a browser window with this URL I get a white blanc page and only some javascripts when opening the source code view.

ipas2
02-02-2005, 09:38 AM
Hmm.. I checked it myself. I dont see any problems

neo88
02-13-2005, 05:42 AM
So how is version 1.3 coming along...? Any new updates?

Suomi
02-25-2005, 03:02 PM
enyting new whit ver. 1.3 ???
:squareeyed:

ipas2
02-26-2005, 04:03 PM
Sorry.. I seriously dont have any time to finish the 1.3 version at the moment.
Then again there is a working 1.3 version available on my site.

Grtz
Ipas

animehawk
03-17-2005, 01:49 PM
Is there a way to tweak the mod to search more then 1 sub dir? Then catagroize them by dir? I'm looking for a way to replace the Links mod v1.25 with something a little more automatic.

Wordplay
03-19-2005, 10:48 AM
help! got this error:

An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '---------------------------------------------------------
-- S

and on my download.php file it now says

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/dedxi02/public_html/forum/download.php on line 281

Wordplay
03-24-2005, 09:17 AM
no help or support from this thread?

ipas2
03-28-2005, 07:31 PM
Wordplay : Have you edited all the variables in the download.php file ?

puertoblack2003
11-24-2007, 03:04 PM
can this be ported over to 3.6.8??????????

youjoomla
04-02-2008, 02:13 PM
you have a duplicated entery in sql

PRIMARY KEY (fileid,fileid)
should be

PRIMARY KEY (fileid)