Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Download System
Richard.R Offline
Junior Member
**
Posts: 1
Joined: Oct 2010
Post: #31
RE: Download System
This is really very useful Biggrin

I have added it to my dev site.
10-01-2010 04:44 PM
Find all posts by this user Quote this message in a reply
matulek Offline
Junior Member
**
Posts: 9
Joined: Oct 2010
Post: #32
RE: Download System
HeySmile
Is there posibility to add external links do download?? or only attached files?
10-11-2010 08:07 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,349
Joined: Mar 2010
Post: #33
RE: Download System
We can use a textbox field type for the file URL, something like this:

Textbox field for File URL:
  • Title: File URL
  • Key: dld_file
  • Applicable Forums: select our download forum
  • Input Field Type : Textbox
  • Editable by / Required Field? : Everyone (required)
    Modify it as our needs. Select which usergroups can use this fields.
  • Display Format :

    HTML Code
    <a href="{VALUE}">Download File</a>

  • Text Mask Filter :

    Code:
    ^https?\://

  • Viewable by Usergroups :
    Select which usergroup can download / view the download link. Leave it as default if we want the file available for all usergroup.
  • Unviewable Value :

    HTML Code
    <span class="smalltext"><em>You don't have permission to view this file URL</em></span>

    The Unviewable Value setting only available if we select at least one usergroup in Viewable by Usergroups settings. Modify it as our needs. This is a layout for usergroup that doesn't have permission to view the download link.


Then, put this variable in our template:

Code:
{$GLOBALS['threadfields']['dld_file']}


(This post was last modified: 10-11-2010 09:16 AM by RateU.)
10-11-2010 09:15 AM
Find all posts by this user Quote this message in a reply
x-Treme Offline
Member
***
Posts: 68
Joined: May 2010
Post: #34
RE: Download System
RateU, to use the textbox instead of the file upload, which templates on the first post should we edit with

Code:
{$GLOBALS['threadfields']['dld_file']}


Forum Freebies
10-18-2010 11:22 PM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,349
Joined: Mar 2010
Post: #35
RE: Download System
If you refer to this style:
http://mybbhacks.zingaburga.com/showthre...73#pid3773

We need to edit:
  1. mhdld_postbit_first and mhdld_postbit_first_classic template:
    Find (around line #29 - #34):

    HTML Code
    1
    2
    3
    4
    5
    6
    <strong>Download: <a href="{$GLOBALS['threadfields']['mhdld_file']['url']}">{$GLOBALS['threadfields']['mhdld_file']['filename']}</a></strong><br />
    <span class="smalltext">
    	Downloads: {$GLOBALS['threadfields']['mhdld_file']['downloads_friendly']}<br />
    	Last Updated: {$GLOBALS['threadfields']['mhdld_file']['update_date']}, {$GLOBALS['threadfields']['mhdld_file']['update_time']}<br /> 
    	Uploader: {$post['profilelink']}
    </span>


    Replace with:

    HTML Code
    <strong>Download: {$GLOBALS['threadfields']['dld_file']}</strong><br />
    <strong>Uploader:</strong> {$post['profilelink']}

  2. mhdld_forumdisplay_thread template:

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <tr>
    	<td align="center" class="{$bgcolor}" width="2%"><img src="{$theme['imgdir']}/{$folder}.gif" alt="{$folder_label}" title="{$folder_label}" /></td>
    	<td align="center" class="{$bgcolor}" width="2%">{$icon}</td>
    	<td class="{$bgcolor}">
    		{$attachment_count}
    		<div>
    			<span>{$prefix} {$gotounread}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>
    			{$GLOBALS['threadfields']['mhdld_desc']}
    		</div>
    	</td>
    	<td align="center" class="{$bgcolor}"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts}</td>
    	<td align="center" class="{$bgcolor}">{$thread['views']}</td>
    	{$rating}
    	<td class="{$bgcolor}" style="white-space: nowrap; text-align: right;">
    		<span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
    		<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
    	</td>
    {$modbit}
    </tr>



We don't need other template, because we can't count how many download for each file.

If we want to add other info for the file, for example: file size and version, we can add another textbox for it. But all of them should be filled manually when creating/editing a thread.

10-19-2010 02:05 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,349
Joined: Mar 2010
Post: #36
RE: Download System
Just a simple tips Biggrin
We can "set" some conditionals to download the XThreads attachments.

This is a simple example for that, the minimum post to download file:
Use this kinds of code in File Upload Display Format field:

HTML Code
1
2
3
4
5
6
7
<if $mybb->user['postnum'] < 5 then>
<em>You need at least 5 posts to download this file</em>
<else>
<form action="{URL}" method="get">
<input type="submit" value="Download Now" />
</form>
</if>

We can set the conditional to download the attachments per thread/attachments basis. Just add custom thread fields for the setting.


11-11-2010 04:08 AM
Find all posts by this user Quote this message in a reply
jim7777 Offline
Junior Member
**
Posts: 41
Joined: Nov 2010
Post: #37
RE: Download System
this is a nice mod

anyways just like to ask something
Is it possible to make an expiring links towards the Url of the file? in this case to avoid direct linking
11-20-2010 01:49 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,340
Joined: Jan 2008
Post: #38
RE: Download System
Dynamic links, no.
You may be able to block hotlinking with a htaccess edit: http://altlab.com/htaccess_tutorial.html
(that checks for image extensions, you could remap it to xthreads_attach.php)

My Blog
11-20-2010 04:52 PM
Find all posts by this user Quote this message in a reply
jim7777 Offline
Junior Member
**
Posts: 41
Joined: Nov 2010
Post: #39
RE: Download System
my point is just like vbulletin when the page is idle or inactive for an amount of time, all download links will expire then when clicked, the user will be forced to reload the page in order to reload the link

anyways thanks for the suggestion Biggrin
11-20-2010 10:01 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,340
Joined: Jan 2008
Post: #40
RE: Download System
As I said, XThreads doesn't do dynamic links.  The design principle is that it allows content to be cached, and this cannot be done if links keep changing.  I can't see many reasons why you'd want links to be dynamic, although you may have a good one, but unfortunately, XThreads doesn't support it.
If hotlink protection is all you wanted, then the above should be suffice, but if you want links to die after a period of time, it's not possible with this system.

Hope that helps.

My Blog
(This post was last modified: 11-20-2010 10:06 PM by ZiNgA BuRgA.)
11-20-2010 10:06 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: