Version Description
When Simple Download Monitor was used in conjunction with W3 Total Cache (and possibly others), a file just a few megabytes long could cause "Internal Server Errors". This is now fixed, along with any and all output buffering plugins.
Simple Download Monitor wasn't compatible with webhosters who provide the fileinfo extension in conjunction with PHP older than 5.3.
Download this release
Release Info
Developer | pepak.net |
Plugin | Simple Download Monitor |
Version | 0.18 |
Comparing to | |
See all releases |
Code changes from version 0.17 to 0.18
- readme.txt +12 -2
- simple-download-monitor.php +9 -5
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Pepak
|
|
3 |
Donate link:
|
4 |
Tags: files, counter, count, tracking, download monitor, monitor, downloads, download
|
5 |
Requires at least: 2.8.0
|
6 |
-
Tested up to: 3.0.
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Count the number of downloads without having to maintain a comprehensive download page.
|
10 |
|
@@ -118,6 +118,16 @@ http://www.pepak.net/wordpress/simple-download-monitor-plugin/#comment-4729
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 0.17 =
|
122 |
|
123 |
* Forgot to allow empty strings in "Inline files".
|
3 |
Donate link:
|
4 |
Tags: files, counter, count, tracking, download monitor, monitor, downloads, download
|
5 |
Requires at least: 2.8.0
|
6 |
+
Tested up to: 3.0.3
|
7 |
+
Stable tag: 0.18
|
8 |
|
9 |
Count the number of downloads without having to maintain a comprehensive download page.
|
10 |
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 0.18 =
|
122 |
+
|
123 |
+
* When Simple Download Monitor was used in conjunction with W3 Total Cache
|
124 |
+
(and possibly others), a file just a few megabytes long could cause
|
125 |
+
"Internal Server Errors". This is now fixed, along with any and all
|
126 |
+
output buffering plugins.
|
127 |
+
|
128 |
+
* Simple Download Monitor wasn't compatible with webhosters who provide
|
129 |
+
the fileinfo extension in conjunction with PHP older than 5.3.
|
130 |
+
|
131 |
= 0.17 =
|
132 |
|
133 |
* Forgot to allow empty strings in "Inline files".
|
simple-download-monitor.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Simple Download Monitor
|
5 |
Plugin URI: http://www.pepak.net/wordpress/simple-download-monitor-plugin
|
6 |
Description: Count the number of downloads without having to maintain a comprehensive download page.
|
7 |
-
Version: 0.
|
8 |
Author: Pepak
|
9 |
Author URI: http://www.pepak.net
|
10 |
*/
|
@@ -31,7 +31,7 @@ if (!class_exists('SimpleDownloadMonitor'))
|
|
31 |
class SimpleDownloadMonitor
|
32 |
{
|
33 |
|
34 |
-
const VERSION = '0.
|
35 |
const PREFIX = 'sdmon_';
|
36 |
const PREG_DELIMITER = '`';
|
37 |
const GET_PARAM = 'sdmon';
|
@@ -160,7 +160,7 @@ if (!class_exists('SimpleDownloadMonitor'))
|
|
160 |
}
|
161 |
}
|
162 |
|
163 |
-
function buffered_read($file, $bytes, $buffer_size=
|
164 |
/*
|
165 |
Outputs up to $bytes from the file $file to standard output, $buffer_size bytes at a time.
|
166 |
*/
|
@@ -190,6 +190,10 @@ if (!class_exists('SimpleDownloadMonitor'))
|
|
190 |
"multipart/byteranges".
|
191 |
*/
|
192 |
|
|
|
|
|
|
|
|
|
193 |
$filesize=filesize($filename);
|
194 |
$file=fopen($filename,"rb");
|
195 |
|
@@ -255,7 +259,7 @@ if (!class_exists('SimpleDownloadMonitor'))
|
|
255 |
header("Content-Type: $mimetype");
|
256 |
if ($disposition)
|
257 |
header("Content-Disposition: $disposition");
|
258 |
-
|
259 |
}
|
260 |
fclose($file);
|
261 |
}
|
@@ -324,7 +328,7 @@ if (!class_exists('SimpleDownloadMonitor'))
|
|
324 |
return FALSE;
|
325 |
// Generate proper headers
|
326 |
$mimetype = '';
|
327 |
-
if (function_exists('finfo_open'))
|
328 |
{
|
329 |
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
330 |
$mimetype = finfo_file($finfo, $fullfilename);
|
4 |
Plugin Name: Simple Download Monitor
|
5 |
Plugin URI: http://www.pepak.net/wordpress/simple-download-monitor-plugin
|
6 |
Description: Count the number of downloads without having to maintain a comprehensive download page.
|
7 |
+
Version: 0.18
|
8 |
Author: Pepak
|
9 |
Author URI: http://www.pepak.net
|
10 |
*/
|
31 |
class SimpleDownloadMonitor
|
32 |
{
|
33 |
|
34 |
+
const VERSION = '0.18';
|
35 |
const PREFIX = 'sdmon_';
|
36 |
const PREG_DELIMITER = '`';
|
37 |
const GET_PARAM = 'sdmon';
|
160 |
}
|
161 |
}
|
162 |
|
163 |
+
function buffered_read($file, $bytes, $buffer_size=65536){
|
164 |
/*
|
165 |
Outputs up to $bytes from the file $file to standard output, $buffer_size bytes at a time.
|
166 |
*/
|
190 |
"multipart/byteranges".
|
191 |
*/
|
192 |
|
193 |
+
// Clean all buffering components, if any.
|
194 |
+
while (ob_list_handlers())
|
195 |
+
ob_end_clean();
|
196 |
+
|
197 |
$filesize=filesize($filename);
|
198 |
$file=fopen($filename,"rb");
|
199 |
|
259 |
header("Content-Type: $mimetype");
|
260 |
if ($disposition)
|
261 |
header("Content-Disposition: $disposition");
|
262 |
+
$this->buffered_read($file, $filesize);
|
263 |
}
|
264 |
fclose($file);
|
265 |
}
|
328 |
return FALSE;
|
329 |
// Generate proper headers
|
330 |
$mimetype = '';
|
331 |
+
if (function_exists('finfo_open') AND defined('FILEINFO_MIME_TYPE'))
|
332 |
{
|
333 |
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
334 |
$mimetype = finfo_file($finfo, $fullfilename);
|