Extensions Database 3.2 / 3.3 / 4.0 ⇒ 3.3 & 4.0 Download System

3.2 & 3.3 & 4.0
User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Download System

Post by dmzx »

Extension Name: Download System
Author: [hidden]

Special thanks to: [hidden]

Extension Description:
This extension will add an easy download system to your forum, where you can offer your user to download files from your webspace.

[hidden] [hidden]

[hidden]
- Fixed the ACP category edit moving a subcategory to the top level on every save: the parent selector was shown only for a category that already had subcategories, so a leaf posted no parent and the default 0 replaced the stored one. The selector now shows for a category without subcategories, the stored parent is kept when the field is not posted, and a posted parent must be an existing top-level category.
- Fixed the upload size check for a PHP limit given in gigabytes (`upload_max_filesize = 1G`): the front end upload ended in a TypeError and the ACP add refused valid files. The limit is read with phpBB's `php_ini` service, the smaller of `upload_max_filesize` and `post_max_size` is used, and the hint shows it in the unit it is configured in.
- The category overview, its subcategory line and the search list no longer select every category column next to an aggregate with `GROUP BY` (SQL Server and Oracle refuse that); the download count and newest change come from a derived table. Subcategories and the newest download are fetched in one query for the whole page instead of one per category, and the newest download is now looked up per category (a download in another category with the same time was shown), the highest id winning a tie.
- ACP "Manage downloads" selects only the rows of the current page (it fetched all downloads), keeps the sort order and the search words in the page links, and sorts ties by id.
- Creating a category makes its folder first: a failing `mkdir` stops with a message and writes nothing, and a failed image upload removes the folder it just made. Before, the row and the tree were saved first and success was reported anyway.
- The category edit and move controllers fetch the row instead of counting affected rows after a SELECT.
- Saving a download while Ultimate Points is not available no longer resets its stored cost to 0; a missing download id gives a message.
- `download_title`, `download_filename` and `cat_name` are Unicode columns (new migration, default of `cat_name` is an empty string); the admin permission has its own description (`ACL_A_DM_EDS`).
- Removed the unused `get_cat_infos()`, three unused ACP language keys and the unused `erusev/parsedown` entry in composer.json (the library is bundled in `includes/`, now with its MIT licence file `includes/LICENSE-Parsedown.txt`); three ACP forms lost a stray `/`; the category folder help names `store/dmzx_downloadsystem/files/`; constructor arguments that nothing read are removed.

[hidden]
- Code clean-up without a change in behaviour: `public static function` instead of `static public function` in 32 files (PSR-12), and the two properties of the upload controller (`ext_path`, `ext_path_web`) are declared (no dynamic properties on PHP 8.2+).
- Removed 53 language keys that nothing uses (25 in `acp_downloadsystem.php`, 27 in `common.php`), after checking that no other extension of ours borrows them. Every key that is used is unchanged.

[hidden]
- ACP: adding a download, creating a category and editing now store their files only after every check passed and the row is saved; a refused or failed upload no longer leaves a file in the store folder, and the size check removes the right file. Emoji in the title or description of an ACP download are stored safely.
- ACP: the category name in the delete confirmation is escaped.
- The About page showed the word CHANGELOG instead of its translation; added the missing language key.
- Search: `%` and `_` typed in the search box are no longer treated as wildcards (the pattern is built with sql_like_expression()).
- The upload page no longer writes an inline script; the two editor variables come from a script file.

[hidden]
- Downloads are now sent with phpBB's response objects (`BinaryFileResponse`, and a small `Response` for the first-bytes check of a direct link) instead of `header()`, `echo` and `exit`. Range requests, file names with special characters and the counter work as before.
- The category and download routes now also require the "Can use the Download System" permission, like the index. A member without it can no longer list a category or download a file; direct links of free files are unchanged.
- The ACP "Edit download" now checks everything before it changes anything (title, category, file type, an existing file name) and removes the old file only after the new file is stored and the row is updated. A refused replacement or a move to another category no longer leaves a download without its file. The category move together with a new file now works.
- Front end upload: the category must be one the upload page offers, and a title is required. A post with an invented category or without a title is refused with a message instead of an error page. Four byte characters in the ACP title and description are stored safely too.
- The donation URL is decoded once before it is escaped for the page, so a link with several parameters reaches the browser intact; only http and https links are used.
- Added the language keys that were missing (file not readable, cannot open file, FTP upload, parent category).
- Delete Data now also removes the uploaded files (`store/dmzx_downloadsystem`) and `images/downloadsystem`; deleting a member removes that member's download log rows.

[hidden]
- Fixed a stored XSS on the category page: the rendered description (and the title) was placed in the `data-eds-search` attribute, where a double quote closed the attribute. The search text is now built in PHP and escaped for the attribute, and the image `alt`, the download link, and the image URL in the page footer are escaped the same way.
- Fixed uploading a file with an emoji (or another four byte character) in the title or description: the front end upload no longer ends in an SQL error on a utf8mb3 column. Four byte characters are stored as numeric entities and are shown unchanged.
- The front end upload now checks the file size before anything is stored, adds the database row first, moves the file afterwards and removes the row again if the file cannot be moved. The announcement topic is created only after the file is stored. Before, a failed insert left the moved file in the store folder with no row, and a later upload of the same file said it already existed.
- A front end upload without a file (the removed FTP option) is refused instead of ending in an undefined variable.
- Fixed the category folder name check in the ACP: the name is compared with an equals sign and escaped, instead of being used in a LIKE pattern, where an underscore matched any character (`u_ils` was refused because `utils` existed).

[hidden]
- Added direct links: with the new ACP setting "Allow direct links" (Download System -> Configuration, off by default) a free file can be fetched without logging in and without the confirmation step, through the direct link of that file only. The link carries a key that only this board can make (a new secret is created on install), so other files cannot be guessed from it.
- The download counter and the per-user download log are updated exactly as for a normal download. Files with a points cost are never handed out through a direct link.
- Every download in the ACP list has a "Direct link to this file" icon that copies the link and shows that it was copied. The icon is hidden while direct links are off.
- Update note: the update adds one column to the configuration table and one config value; run the extension update in the ACP after replacing the folder.

[hidden]
- Fixed a fatal SQL error on the category overview on MySQL 5.7/8.0 with the default sql_mode (only_full_group_by), and on PostgreSQL/MSSQL/Oracle, as soon as at least one category exists: the category queries no longer select the joined downloads table's columns next to the aggregates.
- Fixed a stored XSS: category and download descriptions were passed through html_entity_decode() before rendering, which turned the already-encoded TextFormatter storage back into live markup. Descriptions are now rendered directly from storage.
- The download action now requires a link hash for logged-in members. Internal links carry it automatically; a member who follows an external or bookmarked link without it gets a one-click confirmation page (same page guests see for the bot check) instead of an immediate download, so a hidden image on another site can no longer spend a member's points or bump the download counter. Guests are unaffected (captcha as before). External links keep working.
- Removed the download_system_version config row; the version now comes from the extension metadata (composer.json). The ACP config page shows the version as text instead of a third-party badge image.
- Fixed the category filter on the front-end upload form: the admin check tested a non-existent permission and the category dropdown marked every option as selected.
- Fixed a PHP 8.2+ deprecation in the ACP module (undeclared dynamic properties).
- Hardened the download controller: permission check before the database query, and the served path can no longer contain a parent-directory reference.
- Fixed the ACP "Edit downloads" form: the three BBCode/smilies/URL checkboxes were always pre-ticked because the stored flags were never passed to the template, so saving an edit silently disabled BBCode, smilies and links for that download. The checkbox labels and option status texts also showed raw language keys (the posting language file was not loaded in the ACP).
- Fixed the broken "Current image" preview on the ACP edit forms (relative path from inside adm/).
- Moved all remaining inline JavaScript (front-end search, read-more modal, download configuration) into downloadsystem.js; the configuration is now passed through data attributes. Inline styles moved to the stylesheets.


[hidden]
- Added a bot-check (phpBB's own captcha) for guests downloading a file, shown on the exact same download URL - no separate confirm route or token needed. - Logged-in members are completely unaffected regardless of which link (internal or external) they use.
- This lets the "Can download files" guest permission stay enabled (needed for external links to keep working) while still filtering out automated/bot traffic from the per-user download log and file server.
- Requires the guest permission "Can download files in Download System" to be set to Yes - the captcha is now the gate for guests, not the permission itself.

[hidden]
Added template events to index_body.html, showcat_body.html and upload_body.html so other extensions can inject content (e.g. reviews, badges, achievement indicators) without modifying this extension's templates directly.
Consolidated all inline CSS from index_body.html and showcat_body.html into a single stylesheet, styles/prosilver/theme/downloadsystem.css, loaded via INCLUDECSS.
No functional or visual changes - purely template structure and asset organization.

[hidden]
- Added a public API facade (dmzx.downloadsystem.api): has_user_downloaded(), get_download_count(), get_user_download_count(), get_user_downloads() for other extensions to query without touching this extension's tables directly.
- Added a new per-user download history table (dm_eds_log) that records every download.
- Added dispatcher events dmzx.downloadsystem.download_completed_after and dmzx.downloadsystem.upload_completed_after for other extensions to hook into.
- Major refactor: split the ~1500-line monolithic admin_controller.php into 12 focused classes under controller/admin/, each handling a single ACP action, plus a shared trait for common logging/URL helpers. acp/downloadsystem_module.php now dispatches to the matching service per mode/action instead of one shared controller.
- Fixed a latent bug in the category-folder delete flow where a subdirectory cleanup call was missing its class reference (would have fatally errored had it ever been reached).
- Fixed a broken "selected" check on the category dropdown when adding a new download (comparison against the wrong value meant nothing was ever pre-selected).
- No functional/behavioural changes for board admins or end users beyond the two bug fixes above - this is an internal code-organization release.

[hidden]
- Added optional Ultimate Points Extension integration: users can be charged points to download a file.
- New ACP setting to enable/disable charging, only visible when Ultimate Points Extension is installed, off by default.
- New cost-per-download field on the add/copy/edit download forms, only visible when Ultimate Points Extension is installed.
- Front-end category page shows the user's points balance and a cost badge on downloads that have a price, only when both the extension is installed and charging is enabled.
- Balance is checked before streaming a file and points are deducted only after the file was confirmed readable, so a failed download is never charged.
- Behaviour is completely unchanged when Ultimate Points Extension is not installed, or when installed but the setting is left off.

[hidden]
- Added CSRF protection (add_form_key/check_form_key) to all ACP write actions: add/copy/edit/update download, create/edit category, save configuration.
- Added CSRF protection to the front-end upload form.
- Added link-hash protection (generate_link_hash/check_link_hash) to the category move up/down actions, since those are plain GET links rather than forms.
- Added explicit methods constraint to routing.yml (GET for display/serve routes, GET+POST for the upload route).
- Fixed the viewonline listener's outdated hardcoded 'app.php' front-controller assumption (generic prefix-strip, matching the fix already applied to 5 other dt2bapps extensions).

[hidden]
- Moved uploaded download files out of ext/dmzx/downloadsystem/files/ into store/dmzx_downloadsystem/files/ (board-root-relative), so extension updates/reinstalls can no longer overwrite user-uploaded files.
- New dmzx.downloadsystem.files_path parameter replaces 10+ scattered hardcoded path references.
- Added .htaccess to the new storage location to block direct access.
- Redesigned category and download listing pages: card-based layout, badges, "Read more" for long descriptions, real server-side search across all categories.

[hidden]
- Code update for phpBB 4.0.0-a1
- Added $language

[hidden]
- Add search in ACP.
- Changed table to div in ACP.
- Changed table to div on download page.

[hidden]
- Code update.

[hidden]
- Short syntax code.

[hidden]
- Fix code.

[hidden]
- Code update.

[hidden]
- Fixed errors on upload page and ACP.
- Code update.

[hidden]
- Code update in acp controller and composer.

[hidden]
- Added file extension to fa download icon.
- Added download count in ACP.

[hidden]
- Code update tables.yml

[hidden]
- Fixed downloading multiple files in one folder.

[hidden]
- Code added sweetalert2
- Fixed category move up and down.
- Added link for donation in ACP settings.

[hidden]
Code update for ACP pages

[hidden]
Code update.
ACP redo category section.

[hidden]
Code update.
Can upload category and file images.
Drop support of 3.1.x
Twig Update

[hidden]
Added number of files in subcategories.
Added subcategories to pagination.

[hidden]
Added Sub categories
Added images on download page. (indicate also sub categories)
Added correct pagination
Added Show on index upload for categories. (Admins can always see all categories)
Code update

[hidden]
Added Upload section, default on for admins.
Added new permission for upload section use.
Code update

[hidden]
Added log entries

[hidden]
Code update

[hidden]
Compatible with 3.2
Code update

[hidden]
Code update

[hidden]
Added permissions for latest phpBB

Screenshots:
[hidden]

[hidden]

[hidden]

[hidden]

[hidden]

[hidden]

[hidden]

[hidden]

Extension Download:
[hidden]

Installation:
  1. Download the latest release.
  2. Unzip the downloaded release, and change the name of the folder to `downloadsystem`.
  3. In the `ext` directory of your phpBB board, create a new directory named `dmzx` (if it does not already exist).
  4. Copy the `downloadsystem` folder to `/ext/dmzx/` if done correctly, you'll have the main extension class at
    (your forum root)/ext/dmzx/downloadsystem/composer.json
  5. Navigate in the ACP to `Customise -> Manage extensions`
  6. Look for `Download System` under the Disabled Extensions list, and click its `Enable` link.
Links, images and downloads in this post are hidden Log in or register, then thank this post to see them. Login Register
cgozzie75, korayaksu61, skittels, samara99, sky and 9 others thanked this post
Last edited by dmzx on 09 Nov 2026, 08:26, edited 3 times in total.
Reason: Updated to version 1.5.5

User avatar

Jaantje
Users
Users
Posts: 356
Joined: 02 Nov 2014, 21:25
Starter · Lv 1 ❤

Re: Download System

Post by Jaantje »

Thanx U very Much :tumbsyes:
Grreeetttttzzzzz, Jaantje

User avatar

Mickroz
Users
Users
Posts: 30
Joined: 08 Feb 2015, 22:47
Starter · Lv 1 ❤

Re: Download System

Post by Mickroz »

We need:
u_download_edit
u_download_delete
u_download_post
u_download_noapprove

;)
Q: Whats a hash and a root password?
A: hash gets you high, root password gives you god powers, combine the 2 and you are invincible.

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

Mickroz wrote:we need:
u_download_edit
u_download_delete
u_download_post
u_download_noapprove

;)
Will look into this :wink:

User avatar

Mickroz
Users
Users
Posts: 30
Joined: 08 Feb 2015, 22:47
Starter · Lv 1 ❤

Re: Download System

Post by Mickroz »

Thanks :thumbup:

User avatar

Cyber Man
Users
Users
Posts: 6
Joined: 10 Oct 2015, 15:42
Starter · Lv 1

Re: Download System

Post by Cyber Man »

:D Hello Friends!
In my Admin area, there is displaying a wrong user guide for this extension. Please look at the image below & reply me.


Thank you! :thumbup:

Image

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

Cyber Man wrote::D Hello Friends!
In my Admin area, there is displaying a wrong user guide for this extension. Please look at the image below & reply me.
Yes it takes the guide from ultimate points will check on it for next release.
Thanks for reporting :thumbup:

User avatar

TWEagle
Users
Users
Posts: 74
Joined: 23 Nov 2014, 20:38
Starter · Lv 1 ❤

Re: Download System

Post by TWEagle »

Is it possible to add automatically all the attachments in this download system
Image

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

TWEagle wrote:is it possible to add automatically all the attachments in this download system
No it is not possible.

User avatar

TWEagle
Users
Users
Posts: 74
Joined: 23 Nov 2014, 20:38
Starter · Lv 1 ❤

Re: Download System

Post by TWEagle »

In what folder will those downloads been added??

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

You mean the attachments or where the files are stored in the ext?

User avatar

TWEagle
Users
Users
Posts: 74
Joined: 23 Nov 2014, 20:38
Starter · Lv 1 ❤

Re: Download System

Post by TWEagle »

dmzx wrote:you mean the attachments or where the files are stored in the ext?
the files for the downloadsystem

and is every download category a different folder?

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

TWEagle wrote:
dmzx wrote:you mean the attachments or where the files are stored in the ext?
the files for the downloadsystem

and is every download category a different folder?

Yes every category will be in different folder in the \ext\dmzx\downloadsystem\files\ folder of the extension.

User avatar

TWEagle
Users
Users
Posts: 74
Joined: 23 Nov 2014, 20:38
Starter · Lv 1 ❤

Re: Download System

Post by TWEagle »

dmzx wrote:
TWEagle wrote:
dmzx wrote:you mean the attachments or where the files are stored in the ext?
the files for the downloadsystem

and is every download category a different folder?

Yes every category will be in different folder in the \ext\dmzx\downloadsystem\files\ folder of the extension.
so if I make a script where all the attachments will be copied to the right folder in the ext\dmzx\downloadsystem\files then it is automatically
Last edited by TWEagle on 09 Dec 2015, 21:19, edited 1 time in total.

User avatar

Topic Author
dmzx
Founder
Founder
Posts: 7035
Joined: 13 Jan 2014, 21:45
582 given 4
Starter · Lv 8

Re: Download System

Post by dmzx »

TWEagle wrote:
dmzx wrote:
TWEagle wrote:
dmzx wrote:you mean the attachments or where the files are stored in the ext?
the files for the downloadsystem

and is every download category a different folder?

Yes every category will be in different folder in the \ext\dmzx\downloadsystem\files\ folder of the extension.
so if I make a script where all the attachments will be copied to the right folder in the ext\dmzx\downloadsystem\files then it is automatically
It needs to make also then the category in the extension to show, like you do normal when you add it manual in ACP.

Post Reply Previous topicNext topic