WordPress Download Manager - Version 3.1.23

Version Description

  • 2021.04.27 =
  • Improved asset manager
Download this release

Release Info

Developer codename065
Plugin Icon 128x128 WordPress Download Manager
Version 3.1.23
Comparing to
See all releases

Code changes from version 3.1.22 to 3.1.23

download-manager.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Download Manager
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
- Version: 3.1.22
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
@@ -108,7 +108,7 @@ class WordPressDownloadManager{
108
 
109
  function __construct(){
110
 
111
- define('WPDM_Version','3.1.22');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
+ Version: 3.1.23
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
108
 
109
  function __construct(){
110
 
111
+ define('WPDM_Version','3.1.23');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
libs/class.AssetManager.php CHANGED
@@ -294,7 +294,6 @@ class AssetManager
294
  {
295
  if (!isset($_REQUEST['__wpdm_createzip']) || !wp_verify_nonce($_REQUEST['__wpdm_createzip'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
296
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_createzip');
297
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
298
  if (!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __("<b>Unauthorized Action!</b><br/>Execution is cancelled by the system.", "download-manager")));
299
  global $current_user;
300
  $root = AssetManager::root();
@@ -310,7 +309,6 @@ class AssetManager
310
  function unZip(){
311
  if (!isset($_REQUEST['__wpdm_unzipit']) || !wp_verify_nonce($_REQUEST['__wpdm_unzipit'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
312
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_unzipit');
313
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
314
  if (!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __("<b>Unauthorized Action!</b><br/>Execution is cancelled by the system.", "download-manager")));
315
  global $current_user;
316
  $root = AssetManager::root();
@@ -446,7 +444,7 @@ class AssetManager
446
  {
447
  if (!isset($_REQUEST['__wpdm_updatelink']) || !wp_verify_nonce($_REQUEST['__wpdm_updatelink'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
448
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_updatelink');
449
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
450
 
451
  $link_ID = wpdm_query_var('ID', 'int');
452
  $access = wpdm_query_var('access');
@@ -460,7 +458,7 @@ class AssetManager
460
  {
461
  if (!isset($_REQUEST['__wpdm_deletelink']) || !wp_verify_nonce($_REQUEST['__wpdm_deletelink'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
462
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_deletelink');
463
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
464
 
465
  $link_ID = wpdm_query_var('linkid', 'int');
466
  $link = \WPDM\Asset::deleteLink($link_ID);
@@ -472,7 +470,7 @@ class AssetManager
472
  {
473
  if (isset($_REQUEST['__wpdm_savefile']) && !wp_verify_nonce($_REQUEST['__wpdm_savefile'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
474
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_savefile');
475
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
476
 
477
  $ofilepath = \WPDM\Session::get(wpdm_query_var('opened'));
478
  $relpath = Crypt::decrypt(wpdm_query_var('file'));
@@ -495,7 +493,7 @@ class AssetManager
495
  {
496
  if (isset($_REQUEST['__wpdm_rename']) && !wp_verify_nonce($_REQUEST['__wpdm_rename'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
497
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_rename');
498
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
499
  global $current_user;
500
  $asset = new Asset();
501
  $asset->get(wpdm_query_var('assetid', 'int'));
@@ -515,7 +513,7 @@ class AssetManager
515
  {
516
  if (isset($_REQUEST['__wpdm_cutpaste']) && !wp_verify_nonce($_REQUEST['__wpdm_cutpaste'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
517
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_cutpaste');
518
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
519
 
520
  $opath = explode("|||", wpdm_query_var('source'));
521
  $olddir = Crypt::decrypt($opath[0]);
@@ -543,7 +541,7 @@ class AssetManager
543
  {
544
  if (isset($_REQUEST['__wpdm_copypaste']) && !wp_verify_nonce($_REQUEST['__wpdm_copypaste'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
545
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_copypaste');
546
- if (!is_user_logged_in()) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
547
  global $current_user;
548
  $root = AssetManager::root();
549
  $opath = explode("|||", wpdm_query_var('source'));
294
  {
295
  if (!isset($_REQUEST['__wpdm_createzip']) || !wp_verify_nonce($_REQUEST['__wpdm_createzip'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
296
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_createzip');
 
297
  if (!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __("<b>Unauthorized Action!</b><br/>Execution is cancelled by the system.", "download-manager")));
298
  global $current_user;
299
  $root = AssetManager::root();
309
  function unZip(){
310
  if (!isset($_REQUEST['__wpdm_unzipit']) || !wp_verify_nonce($_REQUEST['__wpdm_unzipit'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
311
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_unzipit');
 
312
  if (!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __("<b>Unauthorized Action!</b><br/>Execution is cancelled by the system.", "download-manager")));
313
  global $current_user;
314
  $root = AssetManager::root();
444
  {
445
  if (!isset($_REQUEST['__wpdm_updatelink']) || !wp_verify_nonce($_REQUEST['__wpdm_updatelink'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
446
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_updatelink');
447
+ if (!current_user_can('access_server_browser')) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
448
 
449
  $link_ID = wpdm_query_var('ID', 'int');
450
  $access = wpdm_query_var('access');
458
  {
459
  if (!isset($_REQUEST['__wpdm_deletelink']) || !wp_verify_nonce($_REQUEST['__wpdm_deletelink'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
460
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_deletelink');
461
+ if (!current_user_can('access_server_browser')) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
462
 
463
  $link_ID = wpdm_query_var('linkid', 'int');
464
  $link = \WPDM\Asset::deleteLink($link_ID);
470
  {
471
  if (isset($_REQUEST['__wpdm_savefile']) && !wp_verify_nonce($_REQUEST['__wpdm_savefile'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
472
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_savefile');
473
+ if (!current_user_can('access_server_browser')) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
474
 
475
  $ofilepath = \WPDM\Session::get(wpdm_query_var('opened'));
476
  $relpath = Crypt::decrypt(wpdm_query_var('file'));
493
  {
494
  if (isset($_REQUEST['__wpdm_rename']) && !wp_verify_nonce($_REQUEST['__wpdm_rename'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
495
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_rename');
496
+ if (!current_user_can(WPDM_ADMIN_CAP)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
497
  global $current_user;
498
  $asset = new Asset();
499
  $asset->get(wpdm_query_var('assetid', 'int'));
513
  {
514
  if (isset($_REQUEST['__wpdm_cutpaste']) && !wp_verify_nonce($_REQUEST['__wpdm_cutpaste'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
515
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_cutpaste');
516
+ if (!current_user_can('access_server_browser')) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
517
 
518
  $opath = explode("|||", wpdm_query_var('source'));
519
  $olddir = Crypt::decrypt($opath[0]);
541
  {
542
  if (isset($_REQUEST['__wpdm_copypaste']) && !wp_verify_nonce($_REQUEST['__wpdm_copypaste'], WPDMAM_NONCE_KEY)) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
543
  check_ajax_referer(WPDMAM_NONCE_KEY, '__wpdm_copypaste');
544
+ if (!current_user_can('access_server_browser')) wp_send_json(array('success' => false, 'message' => __("Error! Session Expired. Try refreshing page.", "download-manager")));
545
  global $current_user;
546
  $root = AssetManager::root();
547
  $opath = explode("|||", wpdm_query_var('source'));
libs/class.Installer.php CHANGED
@@ -111,7 +111,7 @@ if (!class_exists('\WPDM\Installer')):
111
  PRIMARY KEY (`ID`)
112
  )";
113
 
114
- $sqls[] = "CREATE TABLE `{$wpdb->prefix}ahm_user_download_counts` (
115
  `ID` int(11) NOT NULL AUTO_INCREMENT,
116
  `user` varchar(255) NOT NULL,
117
  `package_id` int(11) NOT NULL,
111
  PRIMARY KEY (`ID`)
112
  )";
113
 
114
+ $sqls[] = "CREATE TABLE IF EXISTS `{$wpdb->prefix}ahm_user_download_counts` (
115
  `ID` int(11) NOT NULL AUTO_INCREMENT,
116
  `user` varchar(255) NOT NULL,
117
  `package_id` int(11) NOT NULL,
readme.txt CHANGED
@@ -181,6 +181,9 @@ Check download stats and get a push notification when someone downloads, install
181
 
182
  == Changelog ==
183
 
 
 
 
184
  = 3.1.22 - 2021.04.22 =
185
  * Fixed settings save issue with plugin update settings
186
 
181
 
182
  == Changelog ==
183
 
184
+ = 3.1.23 - 2021.04.27 =
185
+ * Improved asset manager
186
+
187
  = 3.1.22 - 2021.04.22 =
188
  * Fixed settings save issue with plugin update settings
189
 
wpdm-core.php CHANGED
@@ -322,7 +322,7 @@ function wpdm_access_token(){
322
  function wpdm_get_allowed_file_types()
323
  {
324
  $allowed_file_types = get_option("__wpdm_allowed_file_types", '');
325
- if($allowed_file_types === '') {
326
  $wp_allowed_file_types = get_allowed_mime_types();
327
  $wp_allowed_file_exts = array_keys($wp_allowed_file_types);
328
  $wp_allowed_file_exts = implode(",", $wp_allowed_file_exts);
322
  function wpdm_get_allowed_file_types()
323
  {
324
  $allowed_file_types = get_option("__wpdm_allowed_file_types", '');
325
+ if($allowed_file_types === '' || $allowed_file_types === '*') {
326
  $wp_allowed_file_types = get_allowed_mime_types();
327
  $wp_allowed_file_exts = array_keys($wp_allowed_file_types);
328
  $wp_allowed_file_exts = implode(",", $wp_allowed_file_exts);
wpdm-functions.php CHANGED
@@ -392,32 +392,22 @@ function wpdm_package_link_legacy($params)
392
  */
393
  function wpdm_downloadable($content)
394
  {
395
- if (defined('WPDM_THEME_SUPPORT') && WPDM_THEME_SUPPORT == true) return $content;
396
- if (get_post_type(get_the_ID()) != 'wpdmpro') return $content;
397
-
398
- global $wpdb, $current_user, $post, $wp_query, $wpdm_package;
399
- if (isset($wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')]) && $wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')] != '')
400
- return wpdm_embed_category(array("id" => $wp_query->query_vars[get_option('__wpdm_curl_base', 'downloads')]));
401
- $postlink = site_url('/');
402
- //get_currentuserinfo();
403
- $permission_msg = WPDM_Messages::permission_denied();
404
- $login_msg = WPDM_Messages::login_required();
405
- $login_msg = wpdm_escs(htmlspecialchars_decode($login_msg));
406
- $user = new WP_User(null);
407
- if (isset($_GET[get_option('__wpdm_purl_base', 'download')]) && $_GET[get_option('__wpdm_purl_base', 'download')] != '' && $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] == '')
408
- $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = esc_attr($_GET[get_option('__wpdm_purl_base', 'download')]);
409
- $wp_query->query_vars[get_option('__wpdm_purl_base', 'download')] = isset($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) ? urldecode($wp_query->query_vars[get_option('__wpdm_purl_base', 'download')]) : '';
410
-
411
- if (is_singular('wpdmpro')) {
412
- if (get_option('_wpdm_custom_template') == 1 || current_theme_supports('wpdm')) return $content;
413
-
414
- $template = get_post_meta(get_the_ID(), '__wpdm_page_template', true);
415
- $data = FetchTemplate($template, get_the_ID(), 'page');
416
- $siteurl = site_url('/');
417
- return "<div class='w3eden'>{$data}</div>";
418
  }
419
 
420
- return $content;
 
 
 
421
 
422
 
423
  }
392
  */
393
  function wpdm_downloadable($content)
394
  {
395
+ global $post;
396
+ //echo "<pre>".print_r($post, 1)."</pre>";
397
+
398
+ if ( ( defined('WPDM_THEME_SUPPORT') && WPDM_THEME_SUPPORT == true )
399
+ || current_theme_supports('wpdm')
400
+ || get_post_type(get_the_ID()) != 'wpdmpro'
401
+ || ! is_singular('wpdmpro')
402
+ || ! is_main_query()
403
+ || ! in_the_loop()) {
404
+ return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  }
406
 
407
+
408
+ $template = get_post_meta(get_the_ID(), '__wpdm_page_template', true);
409
+ $data = FetchTemplate($template, get_the_ID(), 'page');
410
+ return "<div class='w3eden'>{$data}</div>";
411
 
412
 
413
  }