Downloadcontrol_XH 1.7

for CMSimple_XH Version 1.6 or higher

Downloadcontrol allows different types of control and documentation for the download of files and groups of files, which you would like to offer on your website. Files from .htaccess-protected folders can also be offered via Downloadcontrol. As these file are not accessible via URL, Downloadcontrol is useful for offering protected files on pages with restricted access by e.g. memberpages.

New in 1.7:

Updating

Copy the unzipped package into the CMSimple_XH base folder. The old plugin downloadcontrol will be overwritten. Go to the plugin backend, and a new config file will be created, keeping your old settings. Check if Downloadcontrol displays your data as it used to in the old version; now you may delete the old log files in the plugin folder.

The Downloadcontrol Base Folder and File Protection

Downloadcontrol need to know where it should look for the files which are called for download. Therefore a base folder has to be set. If there is no entry for the base folder in plugin config, the standard download folder will be regarded as base folder. On installing Downloadcontrol a folder named protected which is a subfolder of the standard download folder will be created together with a .htaccess file. This .htaccess file prevents downloading any file from the folder via typing in the URL in a web browser. (However this works only on Apache webservers. If your site uses another webserver, you have to set the protection manually yourself.)

If you install Downloadcontrol for the first time, the default setting is:
Standard download folder as base folder and protected as a protected subfolder.
(Cons: no real control of the download folder, your stats may not be correct, but you can still use the download folder for standard downloads without Downloadcontrol.)

This setting is a compromise which you may want to change, either by moving the .htaccess file to the standard download folder (then you will get full control of all downloads, however simple downloads without Donwloadcontrol won't work any more) or by setting the protected folder as base folder (your stats will be correct, but look only at the protected folder and its subfolders. Standard download from the downloadfolder is still working as before). All three possibilities have pros aṇd cons.

Please keep in mind that changing the Downloadcontrol base folder means changing the paths to the called files in all Downloadcontrol plugin calls.

Plugin call short cuts

The backend offers plugin call short cuts via a number. A click on the number opens an area with all selectable files and display options. Using the short cut, you don't have to worry about the correct spelling of file names and using the correct call arguments.

In config you can set the number of available short cuts. In the plugin call give the short cut number as argument, e.g. for short cut 1:
{{{control 1}}}

The plugin checks it the first argument is a number. If it is, it will look for the prepared plugin call. If no corresponding preparation can be found, an error message will be displayed.

Log, Download Counting, and Email Alert

Log
Downloadcontrol_XH keeps a log of downloaded files, with date/time and name of the downloader (via Memberpages_XH/Register_XH or asking for the name before the download) or IP address if no name is available.
The log can be synchronised with the log of Dlcounter_XH. The synchroniser button will appear if Downloadcontrol detects Dlcounter_XH. Clicking the button will add those entries from one log to the respective other, which are not found in the other log. It will also ajust the counter in Downloadcontrol_XH.

Double Download Counter
You can select to display the counts of the offered file or of "all versions" of that file. What does that mean? Say, you offer the download myfile_1.4.zip and until now there were only 3 downloads. However there were 100 download of myfile_1.2.zip. If you select to show the download of "this file", the counter will show a meager 3 downloads. So you may prefer to show "all versions", i.e. 103 downloads. However you may have another file without versioning. Doesn't matter, the counter "all versions" will only show combined version downloads, if they exist, otherwise it will show the downloads of the one and only version. So in most cases the best setting is "all downloads". However if you want to inform your users very correctly, select both, "this file" and "all versions". If there are no other versions of a file, "all versions" will either not be displayed or, in a table, a hyphen will be given.

The downloads per file are counted in an "ini"-style file, which is directly editable so that the start numbers can be adjusted. You have to enter the character that separates file name from version number (usually _) in config, to activate the "all versions"-counting. To start this counting, go to "Log analysis" and click either "calculate totals", or "generate new count".

P.S. The "ini" format of the counter file (every line goes: key = value) means that the chars ?{}|&~!()^"#; have special meaning and cannot be used as keys. Therefore the plugin converts these characters, if they occur in filenames, to _. These characters can nevertheless still be used as file names, only they will be listed in the backend counter with _ in place of these characters.

Email alert
In plugin config you can set that an email with the log record will be sent to you when a download is initiated.

Plugin call

{{{control 'filename(s)/foldername/shortcutnumber' ,'startdate', 'enddate', 'password', 'linkstyle', 'askname/location' }}}
All arguments are optional.

Number of times a file was downloaded

{{{controlcount 'filename'}}}
(Usually this function will hardly be used any more as automatic display of the number of downloads can be set in plugin config.) A simple Number will be returned. Even if the file is located in a subfolder of the protected folder, enter just the file name.
Please note: different files with the same name in different subfolders are counted as one!

Examples

{{{control 'myfile.doc','','','','button'}}}
Large button for the download of ./userfiles/downloads/protected/myfile.doc

{{{control 'myfile.doc,subfolder/myotherfile.doc','','','Hello'}}}
Password "Hello" will be demanded for the download of the above mentioned file and the file
./userfiles/downloads/protected/subfolder/myotherfile.doc

{{{control '','1.1.2015','1.1.2017','','',1}}}
all files of the Downloadcontrol base folder will be offered for download between 1.1.2015 and 1.1.2017, while always asking for the name and location of the downloader.

History

Downloadcontrol was started by svasti as a simple add-on named ProtectedDownload. Holger Irmler made a Plugin from it. As there was already a plugin called protected_Download (by Emanuel Marinello), it was renamed by svasti to Downloadcontrol_XH and further developed (see history in changelog.txt).

-