Download Monitor - Version 1.9.7

Version Description

Download this release

Release Info

Developer barrykooij
Plugin Icon 128x128 Download Monitor
Version 1.9.7
Comparing to
See all releases

Code changes from version 1.9.6 to 1.9.7

download-monitor.php CHANGED
@@ -3,11 +3,11 @@
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
- Version: 1.9.6
7
  Author: Never5
8
  Author URI: https://www.never5.com
9
  Requires at least: 3.8
10
- Tested up to: 4.7.2
11
  Text Domain: download-monitor
12
 
13
  License: GPL v3
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
- define( 'DLM_VERSION', '1.9.6' );
37
 
38
  function __download_monitor_main() {
39
 
@@ -69,4 +69,4 @@ if ( is_admin() && ( false === defined( 'DOING_AJAX' ) || false === DOING_AJAX )
69
 
70
  // Multisite blog delete
71
  add_filter( 'wpmu_drop_tables', '__download_monitor_mu_delete_blog' );
72
- }
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
+ Version: 1.9.7
7
  Author: Never5
8
  Author URI: https://www.never5.com
9
  Requires at least: 3.8
10
+ Tested up to: 4.7.4
11
  Text Domain: download-monitor
12
 
13
  License: GPL v3
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
+ define( 'DLM_VERSION', '1.9.7' );
37
 
38
  function __download_monitor_main() {
39
 
69
 
70
  // Multisite blog delete
71
  add_filter( 'wpmu_drop_tables', '__download_monitor_mu_delete_blog' );
72
+ }
includes/admin/class-dlm-admin.php CHANGED
@@ -600,6 +600,10 @@ class DLM_Admin {
600
  return;
601
  }
602
 
 
 
 
 
603
  check_admin_referer( 'delete_logs' );
604
 
605
  $wpdb->query( "DELETE FROM {$wpdb->download_log};" );
@@ -615,6 +619,10 @@ class DLM_Admin {
615
  return;
616
  }
617
 
 
 
 
 
618
  $filter_status = isset( $_REQUEST['filter_status'] ) ? sanitize_text_field( $_REQUEST['filter_status'] ) : '';
619
  $filter_month = ! empty( $_REQUEST['filter_month'] ) ? sanitize_text_field( $_REQUEST['filter_month'] ) : '';
620
 
@@ -744,4 +752,4 @@ class DLM_Admin {
744
  flush_rewrite_rules();
745
  }
746
  }
747
- }
600
  return;
601
  }
602
 
603
+ if ( ! current_user_can( 'manage_downloads' ) ) {
604
+ wp_die( "You're not allowed to delete logs." );
605
+ }
606
+
607
  check_admin_referer( 'delete_logs' );
608
 
609
  $wpdb->query( "DELETE FROM {$wpdb->download_log};" );
619
  return;
620
  }
621
 
622
+ if ( ! current_user_can( 'manage_downloads' ) ) {
623
+ wp_die( "You're not allowed to export logs." );
624
+ }
625
+
626
  $filter_status = isset( $_REQUEST['filter_status'] ) ? sanitize_text_field( $_REQUEST['filter_status'] ) : '';
627
  $filter_month = ! empty( $_REQUEST['filter_month'] ) ? sanitize_text_field( $_REQUEST['filter_month'] ) : '';
628
 
752
  flush_rewrite_rules();
753
  }
754
  }
755
+ }
includes/class-dlm-download-handler.php CHANGED
@@ -198,10 +198,18 @@ class DLM_Download_Handler {
198
  public function handler() {
199
  global $wp, $wpdb;
200
 
 
201
  if ( ! empty( $_GET[ $this->endpoint ] ) ) {
202
  $wp->query_vars[ $this->endpoint ] = $_GET[ $this->endpoint ];
203
  }
204
 
 
 
 
 
 
 
 
205
  if ( ! empty( $wp->query_vars[ $this->endpoint ] ) && ( ( null === $wp->request ) || ( null !== $wp->request && strstr( $wp->request, $this->endpoint . '/' ) ) ) ) {
206
 
207
  // Prevent caching when endpoint is set
198
  public function handler() {
199
  global $wp, $wpdb;
200
 
201
+ // GET to query_var
202
  if ( ! empty( $_GET[ $this->endpoint ] ) ) {
203
  $wp->query_vars[ $this->endpoint ] = $_GET[ $this->endpoint ];
204
  }
205
 
206
+ // check if endpoint is set but is empty
207
+ if ( apply_filters( 'dlm_empty_download_redirect_enabled', true ) && isset ( $wp->query_vars[ $this->endpoint ] ) && empty ($wp->query_vars[ $this->endpoint ] ) ) {
208
+ wp_redirect( apply_filters( 'dlm_empty_download_redirect_url', home_url(), $download_id ) );
209
+ exit;
210
+ }
211
+
212
+ // check if need to handle an actual download
213
  if ( ! empty( $wp->query_vars[ $this->endpoint ] ) && ( ( null === $wp->request ) || ( null !== $wp->request && strstr( $wp->request, $this->endpoint . '/' ) ) ) ) {
214
 
215
  // Prevent caching when endpoint is set
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: never5, barrykooij, mikejolley, hchouhan
3
  Donate link: http://www.barrykooij.com/donate/
4
  Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging, AJAX, digital, documents, download category, download manager, download template, downloadmanager, file manager, file tree, grid, hits, ip-address, manager, media, monitor, password, protect downloads, tracker
5
  Requires at least: 3.8
6
- Tested up to: 4.7.2
7
- Stable tag: 1.9.6
8
  License: GPLv3
9
  Text Domain: -
10
 
@@ -119,6 +119,10 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
119
 
120
  == Changelog ==
121
 
 
 
 
 
122
  = 1.9.6: February 28, 2017 =
123
  * Tweak: Fix display for unknown user in exported log, props [Matt Mower](https://github.com/mdmower).
124
  * Tweak: Settings screen hash tweaks.
3
  Donate link: http://www.barrykooij.com/donate/
4
  Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging, AJAX, digital, documents, download category, download manager, download template, downloadmanager, file manager, file tree, grid, hits, ip-address, manager, media, monitor, password, protect downloads, tracker
5
  Requires at least: 3.8
6
+ Tested up to: 4.7.4
7
+ Stable tag: 1.9.7
8
  License: GPLv3
9
  Text Domain: -
10
 
119
 
120
  == Changelog ==
121
 
122
+ = 1.9.7: May 5, 2017 =
123
+ * Tweak: Added capability checks to log export and delete functionality. Props [Pritect](http://www.pritect.net/).
124
+ * Tweak: We're now redirecting users to home on empty download request. Behavior can be changed via filters. See https://www.download-monitor.com/kb/empty-download-request-redirection/
125
+
126
  = 1.9.6: February 28, 2017 =
127
  * Tweak: Fix display for unknown user in exported log, props [Matt Mower](https://github.com/mdmower).
128
  * Tweak: Settings screen hash tweaks.