vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   My Downloads v1.2 - A Download Manager for VBulletin (https://vborg.vbsupport.ru/showthread.php?t=73311)

ipas2 12-25-2004 10:00 PM

My Downloads v1.2 - A Download Manager for VBulletin
 
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

Quote:

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

Quote:

Originally Posted by ipas2
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 :) )

Quote:

Originally Posted by ipas2
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 ?

Quote:

Originally Posted by ipas2
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:

Code:

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

Quote:

Originally Posted by ipas2
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.

Quote:

$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

Quote:

Originally Posted by lebanon
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.
Code:

// ####################### 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:
Code:

// 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:
Code:

// 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:
Code:

$footer
add after:
Code:

</body>
</html>

Find in file download.php:
Code:

eval('$dlnavbar = "' . fetch_template('navbar') . '";');
add before:
Code:

$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.
Code:

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

PHP Code:

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

To:

PHP Code:

   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

Quote:

Originally Posted by yoyoyoyo
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

Quote:

Originally Posted by ipas2
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

Quote:

Originally Posted by Onkel_Tom
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.


All times are GMT. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01968 seconds
  • Memory Usage 1,850KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (2)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete