Downloads Pepper Documentation
Contents
Installation
Installing Pepper
- If you have orderedlist’s “Download Counter Pepper” installed, uninstall it.
- Upload the
/downloads/directory and its contents to/mint/pepper/tillkruess/. If the directory/tillkruess/doesn’t exist, create it. - Login to your Mint installation and in the Preferences click “Install” under Pepper.
- Click the Downloads Pepper “Install” button. Click “Okay”.
Updating Pepper
- Delete the
/downloads/directory on the server. - Upload the
/downloads/directory and its contents to/mint/pepper/tillkruess/.
Tracking Methods
Method 1: Manual Redirect
Redirect those files that you want to track to the tracker.
Example: http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://domain.com/archive.zip
If you want to track files that are not on your local server, or your Mint installation is on a subdomain use the &remote query command.
Example: http://mint.domain.com/pepper/tillkruess/downloads/tracker.php?url=http://domain.com/archive.zip&remote
Example: http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://anotherdomain.com/archive.zip&remote
Note: If Mint is ignoring you or the file extension isn’t listed in the Pepper’s preferences, the tracker won’t count the download.
Note: If you’re using the &remote parameter, you have to enable remote file tracking in the Pepper’s preferences.
Note: The uri parameter has been renamed to url in Downloads v2.2.
Method 2: Automatic Redirect
Enable the automatic redirection in the Pepper’s preferences and set the file extensions that you want to get redirected.
Note: The script considers the “Site Domain(s)” in preferences.
Note: The script doesn’t work in older browsers like Netscape 4 and Explorer 5 Mac.
Method 3: Advanced Redirect
The base of this method is Apache’s mod_rewrite module, the &force (and &inline) or &remote query command and a .htaccess file.
Example 1: Redirect all file requests in this directory and subdirectories, if the requested file exists.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force
Example 2: Redirect only file requests that end with .zip, .rar or .tar.gz in this directory and subdirectories, if the requested file exists.
<FilesMatch "\.(zip|rar|tar\.gz)$">
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force
</FilesMatch>
Example 3: Redirect file requests in this directory and sub-directories that end with .mp3 or .pdf, and “display” them inline.
<FilesMatch "\.(mp3|pdf)$">
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?url=http://%{HTTP_HOST}%{REQUEST_URI}&force&inline
</FilesMatch>
Note: Use the &force parameter to avoid an infinite loop.
Note: Use the &inline parameter to set the Content-Disposition from attachment to inline.
Note: Don’t forget to set RewriteEngine On before your rewrite rules.
Note: If you’re using the &remote parameter, you have to enable remote file tracking in the Pepper’s preferences.
Note: The uri parameter has been renamed to url in Downloads v2.2.
Modules
phpBB3 module
To track attachment requests, setup the absolut path to root of your phpBB3 installation in
/mint/pepper/tillkruess/downloads/modules/phpbb3/config.php and create a .htaccess file in /phpBB3/download/ with the following contents.
RewriteCond %{QUERY_STRING} !avatar
RewriteRule ^file.php$ http://domain.com/mint/pepper/tillkruess/downloads/tracker.php?%{QUERY_STRING}&type=phpbb3
External Data Access
The following code displays the five most downloaded files.
<?php
$result = mysql_query('SELECT * FROM mint_files ORDER BY hits DESC LIMIT 0, 5');
while ($row = mysql_fetch_assoc($result)) {
var_dump($row);
}
?>
The following code displays the the hits of the first file that is ending with “somefile.zip”.
<?php
$result = mysql_query('SELECT hits FROM mint_files WHERE url LIKE "%somefile.zip" LIMIT 0, 1');
$row = mysql_fetch_assoc($result);
print 'This file has been downloaded '.$row['hits'].' times.';
?>
Note: The uri column has been renamed to url in Downloads v2.2.