Version Description
- 2021.12.21 =
- Codebase optimization
- Changed name from
WordPress Download Manager
toDownload Manager
Download this release
Release Info
Developer | codename065 |
Plugin | WordPress Download Manager |
Version | 3.2.33 |
Comparing to | |
See all releases |
Code changes from version 3.2.32 to 3.2.33
- download-manager.php +3 -3
- readme.txt +5 -1
- src/Admin/views/templates/list-templates.php +2 -7
- src/Form/Form.php +1 -1
- src/MediaLibrary/views/media-tab.php +1 -1
- src/Package/PackageLocks.php +0 -100
- src/User/Login.php +2 -2
- src/User/Register.php +2 -2
- src/User/views/dashboard/download-history.php +2 -2
- src/__/Apply.php +0 -33
- src/__/Email.php +2 -2
- src/__/Session.php +3 -2
- src/__/StreamMedia.php +0 -159
- src/__/__.php +7 -9
- src/wpdm-start-download.php +2 -2
download-manager.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.wpdownloadmanager.com/purchases/
|
|
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, Inc.
|
7 |
Author URI: https://www.wpdownloadmanager.com/
|
8 |
-
Version: 3.2.
|
9 |
Text Domain: download-manager
|
10 |
Domain Path: /languages
|
11 |
*/
|
@@ -39,7 +39,7 @@ use WPDM\Widgets\WidgetController;
|
|
39 |
|
40 |
global $WPDM;
|
41 |
|
42 |
-
define('WPDM_VERSION','3.2.
|
43 |
|
44 |
define('WPDM_TEXT_DOMAIN','download-manager');
|
45 |
|
@@ -473,7 +473,7 @@ final class WordPressDownloadManager{
|
|
473 |
|
474 |
wp_enqueue_script('wpdm-frontjs');
|
475 |
|
476 |
-
if(substr_count($post->post_content, "wpdm_all_packages")){
|
477 |
wp_enqueue_script("datatable", plugins_url('/assets/js/jquery.dataTables.min.js', __FILE__));
|
478 |
wp_enqueue_script("datatable-bs4", plugins_url('/assets/js/dataTables.bootstrap4.min.js', __FILE__));
|
479 |
wp_enqueue_style("datatable-css", plugins_url('/assets/css/jquery.dataTables.min.css', __FILE__));
|
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, Inc.
|
7 |
Author URI: https://www.wpdownloadmanager.com/
|
8 |
+
Version: 3.2.33
|
9 |
Text Domain: download-manager
|
10 |
Domain Path: /languages
|
11 |
*/
|
39 |
|
40 |
global $WPDM;
|
41 |
|
42 |
+
define('WPDM_VERSION','3.2.33');
|
43 |
|
44 |
define('WPDM_TEXT_DOMAIN','download-manager');
|
45 |
|
473 |
|
474 |
wp_enqueue_script('wpdm-frontjs');
|
475 |
|
476 |
+
if(is_object($post) && substr_count($post->post_content, "wpdm_all_packages")){
|
477 |
wp_enqueue_script("datatable", plugins_url('/assets/js/jquery.dataTables.min.js', __FILE__));
|
478 |
wp_enqueue_script("datatable-bs4", plugins_url('/assets/js/dataTables.bootstrap4.min.js', __FILE__));
|
479 |
wp_enqueue_style("datatable-css", plugins_url('/assets/css/jquery.dataTables.min.css', __FILE__));
|
readme.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
===
|
2 |
Contributors: w3eden, codename065, shahriar0822, shimo16ab, shafayat-alam
|
3 |
Donate link:
|
4 |
Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection
|
@@ -181,6 +181,10 @@ Check download stats and get a push notification when someone downloads, install
|
|
181 |
|
182 |
== Changelog ==
|
183 |
|
|
|
|
|
|
|
|
|
184 |
= 3.2.32 - 2021.12.21 =
|
185 |
* Fixed a wpdm add-on compatibility issue
|
186 |
|
1 |
+
=== Download Manager ===
|
2 |
Contributors: w3eden, codename065, shahriar0822, shimo16ab, shafayat-alam
|
3 |
Donate link:
|
4 |
Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection
|
181 |
|
182 |
== Changelog ==
|
183 |
|
184 |
+
= 3.2.33 - 2021.12.21 =
|
185 |
+
* Codebase optimization
|
186 |
+
* Changed name from `WordPress Download Manager` to `Download Manager`
|
187 |
+
|
188 |
= 3.2.32 - 2021.12.21 =
|
189 |
* Fixed a wpdm add-on compatibility issue
|
190 |
|
src/Admin/views/templates/list-templates.php
CHANGED
@@ -73,12 +73,7 @@ if(!isset($_GET['_type']) || $_GET['_type'] !== 'email'){ ?>
|
|
73 |
</td>
|
74 |
<td style="text-align: right">
|
75 |
<a data-toggle="modal" href="#" data-href="admin-ajax.php?action=template_preview&_type=<?php echo $ttype; ?>&template=<?php echo $ctpl; ?>&_tplnonce=<?php echo wp_create_nonce(WPDM_PUB_NONCE) ?>" data-target="#preview-modal" rel="<?php echo $ctpl; ?>" class="template_preview btn btn-sm btn-success"><i class="fa fa-desktop"></i> Preview</a>
|
76 |
-
|
77 |
-
<a href="edit.php?post_type=wpdmpro&page=templates&_type=<?php echo $ttype; ?>&task=NewTemplate&clone=<?php echo $ctpl; ?>" class="btn btn-sm btn-primary"><i class="fa fa-copy"></i> <?php echo __( "Clone" , "download-manager" ); ?></a>
|
78 |
-
<?php } else { ?>
|
79 |
-
<a href="edit.php?post_type=wpdmpro&page=templates&_type=<?php echo $ttype; ?>&task=EditTemplate&tplid=<?php echo $ctpl; ?>" class="btn btn-sm btn-info"><i class="fas fa-pencil-alt"></i> <?php echo __( "Edit" , "download-manager" ); ?></a>
|
80 |
-
<a data-ttype="<?php echo $ttype; ?>" data-tplid="<?php echo $ctpl; ?>" href="edit.php?post_type=wpdmpro&page=templates&_type=<?php echo $ttype; ?>&task=DeleteTemplate&tplid=<?php echo $ctpl; ?>" class="submitdelete delete-template btn btn-sm btn-danger"><i class="fa fa-trash-o"></i> <?php echo __( "Delete" , "download-manager" ); ?></a>
|
81 |
-
<?php } ?>
|
82 |
</td>
|
83 |
|
84 |
|
@@ -90,7 +85,7 @@ if(!isset($_GET['_type']) || $_GET['_type'] !== 'email'){ ?>
|
|
90 |
?>
|
91 |
<tr valign="top" class="author-self status-inherit" id="post-8">
|
92 |
<td class="column-icon media-icon" style="text-align: left;">
|
93 |
-
<?php echo $template['label']; ?> ( <?php _e( "To:" , "download-manager" ); ?> <?php echo ucfirst($template['for']); ?> )
|
94 |
|
95 |
</td>
|
96 |
<td>
|
73 |
</td>
|
74 |
<td style="text-align: right">
|
75 |
<a data-toggle="modal" href="#" data-href="admin-ajax.php?action=template_preview&_type=<?php echo $ttype; ?>&template=<?php echo $ctpl; ?>&_tplnonce=<?php echo wp_create_nonce(WPDM_PUB_NONCE) ?>" data-target="#preview-modal" rel="<?php echo $ctpl; ?>" class="template_preview btn btn-sm btn-success"><i class="fa fa-desktop"></i> Preview</a>
|
76 |
+
|
|
|
|
|
|
|
|
|
|
|
77 |
</td>
|
78 |
|
79 |
|
85 |
?>
|
86 |
<tr valign="top" class="author-self status-inherit" id="post-8">
|
87 |
<td class="column-icon media-icon" style="text-align: left;">
|
88 |
+
<?php echo esc_attr($template['label']); ?> ( <?php _e( "To:" , "download-manager" ); ?> <?php echo ucfirst($template['for']); ?> )
|
89 |
|
90 |
</td>
|
91 |
<td>
|
src/Form/Form.php
CHANGED
@@ -144,7 +144,7 @@ class Form
|
|
144 |
</style>
|
145 |
<script type="text/javascript">
|
146 |
var verifyCallback = function (response) {
|
147 |
-
jQuery('#<?php echo $attrs['id'] ?>').val(response);
|
148 |
};
|
149 |
var widgetId2;
|
150 |
var onloadCallback = function () {
|
144 |
</style>
|
145 |
<script type="text/javascript">
|
146 |
var verifyCallback = function (response) {
|
147 |
+
jQuery('#<?php echo esc_attr($attrs['id']) ?>').val(response);
|
148 |
};
|
149 |
var widgetId2;
|
150 |
var onloadCallback = function () {
|
src/MediaLibrary/views/media-tab.php
CHANGED
@@ -79,7 +79,7 @@
|
|
79 |
'prev_text' => __('«'),
|
80 |
'next_text' => __('»'),
|
81 |
'total' => ceil($wp_query->found_posts / 10),
|
82 |
-
'current' => $_GET['paged']
|
83 |
));
|
84 |
|
85 |
if ( $page_links )
|
79 |
'prev_text' => __('«'),
|
80 |
'next_text' => __('»'),
|
81 |
'total' => ceil($wp_query->found_posts / 10),
|
82 |
+
'current' => (int)$_GET['paged']
|
83 |
));
|
84 |
|
85 |
if ( $page_links )
|
src/Package/PackageLocks.php
CHANGED
@@ -92,105 +92,5 @@ class PackageLocks
|
|
92 |
wp_send_json($data);
|
93 |
}
|
94 |
|
95 |
-
function handleEmailLock()
|
96 |
-
{
|
97 |
-
global $wpdb;
|
98 |
-
$data = [ 'success' => false ];
|
99 |
-
|
100 |
-
$packageID = wpdm_query_var('__wpdm_ID', ['validate' => 'int']);
|
101 |
-
if(!$packageID || get_post_type($packageID) !== 'wpdmpro') {
|
102 |
-
$data['message'] = esc_attr__( 'Package not found!', 'download-manager' );
|
103 |
-
wp_send_json($data);
|
104 |
-
}
|
105 |
-
|
106 |
-
$emailLocked = (int)get_post_meta($packageID, '__wpdm_email_lock', true);
|
107 |
-
$limit = get_option('__wpdm_private_link_usage_limit', 3);
|
108 |
-
$expirePeriod = ((int)get_option('__wpdm_private_link_expiration_period', 60)) * ((int)get_option('__wpdm_private_link_expiration_period_unit', 60));
|
109 |
-
$expirePeriod = $expirePeriod > 0 ? $expirePeriod : 3600;
|
110 |
-
$key = uniqid();
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
if (!$emailLocked) {
|
115 |
-
$data['message'] = esc_attr__( 'Email lock is not enabled for this package', 'download-manager' );
|
116 |
-
wp_send_json($data);
|
117 |
-
}
|
118 |
-
|
119 |
-
if (wpdm_verify_email(wpdm_query_var('email'))) {
|
120 |
-
$subject = esc_attr__( "Your Download Link", 'download-manager' );
|
121 |
-
$site = get_option('blogname');
|
122 |
-
|
123 |
-
$custom_form_data = wpdm_query_var('custom_form_field', 'html');
|
124 |
-
if (isset($_REQUEST['name'])) $custom_form_data['name'] = wpdm_query_var('name', 'txt');
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Do something before sending download link
|
128 |
-
*/
|
129 |
-
do_action("wpdm_before_email_download_link", $_POST, ['ID' => $packageID]);
|
130 |
-
|
131 |
-
/**
|
132 |
-
* $emailLockDownloadLink = 0 <-- Email download link now
|
133 |
-
* $emailLockDownloadLink = 1 <-- Show downwload link on screen / Download instantly
|
134 |
-
* $emailLockDownloadLink = 2 <-- Wait for admin approval
|
135 |
-
*/
|
136 |
-
$emailLockDownloadLink = (int)get_post_meta($packageID, '__wpdm_email_lock_idl', true);
|
137 |
-
/**
|
138 |
-
* Do you also want to email download link when showing download link on screen
|
139 |
-
* For condition $emailLockDownloadLink = 1
|
140 |
-
*/
|
141 |
-
$emailDownloadLink = (int)get_post_meta($packageID, '__wpdm_email_lock_idl_email', true);
|
142 |
-
|
143 |
-
$requestStatus = $emailLockDownloadLink === 0 ? 3 : $emailLockDownloadLink;
|
144 |
-
$wpdb->insert("{$wpdb->prefix}ahm_emails", array('email' => wpdm_query_var('email'), 'pid' => $packageID, 'date' => time(), 'custom_data' => serialize($custom_form_data), 'request_status' => $requestStatus));
|
145 |
-
$subscriberID = $wpdb->insert_id;
|
146 |
-
|
147 |
-
$downloadURL = add_query_arg(['subscriber' => Crypt::encrypt($subscriberID)], WPDM()->package->expirableDownloadLink($packageID, $limit, $expirePeriod));
|
148 |
-
$downloadPageURL = add_query_arg(['subscriber' => Crypt::encrypt($subscriberID)], WPDM()->package->expirableDownloadPage($packageID, $limit, $expirePeriod));
|
149 |
-
|
150 |
-
if ($emailLockDownloadLink === 0 || ($emailLockDownloadLink == 1 && $emailDownloadLink == 0)) {
|
151 |
-
$name = isset($cff['name']) ? $cff['name'] : '';
|
152 |
-
$email_params = array('to_email' => $_POST['email'], 'name' => $name, 'download_count' => $limit, 'package_name' => get_the_title($packageID), 'package_url' => get_permalink($packageID), 'download_url' => $downloadURL, 'download_page_url' => $downloadPageURL);
|
153 |
-
$email_params = apply_filters("wpdm_email_lock_mail_params", $email_params, ['ID' => $packageID]);
|
154 |
-
\WPDM\__\Email::send("email-lock", $email_params);
|
155 |
-
}
|
156 |
-
$elmsg = sanitize_textarea_field(get_post_meta($packageID, '__wpdm_email_lock_msg', true));
|
157 |
-
if ($emailLockDownloadLink === 0) {
|
158 |
-
$data['downloadurl'] = "";
|
159 |
-
$data['message'] = ($elmsg != '' ? $elmsg : __("Download link sent to your email!", "download-manager"));
|
160 |
-
$data['success'] = true;
|
161 |
-
} else if ($emailLockDownloadLink === 2) {
|
162 |
-
$data['downloadurl'] = "";
|
163 |
-
$data['message'] = ($elmsg != '' ? $elmsg : __("Admin will review your request soon!", "download-manager"));
|
164 |
-
$data['success'] = true;
|
165 |
-
} else {
|
166 |
-
$data['success'] = true;
|
167 |
-
$data['downloadurl'] = $downloadURL;
|
168 |
-
if ($emailDownloadLink == 0)
|
169 |
-
$data['message'] = ($elmsg != '' ? $elmsg : __("Download link also sent to your email!", "download-manager"));
|
170 |
-
else
|
171 |
-
$data['message'] = ($elmsg != '' ? $elmsg : __("Download will be started shortly!", "download-manager"));
|
172 |
-
}
|
173 |
-
|
174 |
-
$data = apply_filters("wpdm_email_lock_response_data", $data);
|
175 |
-
|
176 |
-
|
177 |
-
$_pdata = $_POST;
|
178 |
-
$_pdata['pid'] = $packageID;
|
179 |
-
$_pdata['time'] = time();
|
180 |
-
|
181 |
-
Session::set("__wpdm_email_lock_verified", $_pdata, 604800);
|
182 |
-
|
183 |
-
wp_send_json($data);
|
184 |
-
die();
|
185 |
-
} else {
|
186 |
-
$data['downloadurl'] = "";
|
187 |
-
$data['message'] = get_option('__wpdm_blocked_domain_msg');
|
188 |
-
if (trim($data['message']) === '') $data['message'] = __("Invalid Email Address!", "download-manager");
|
189 |
-
$data['success'] = false;
|
190 |
-
|
191 |
-
wp_send_json($data);
|
192 |
-
die();
|
193 |
-
}
|
194 |
-
}
|
195 |
|
196 |
}
|
92 |
wp_send_json($data);
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
}
|
src/User/Login.php
CHANGED
@@ -397,8 +397,8 @@ class Login
|
|
397 |
$regurl = get_permalink($regurl);
|
398 |
}
|
399 |
$log_redirect = $_SERVER['REQUEST_URI'];
|
400 |
-
if (isset($params['redirect'])) $log_redirect =
|
401 |
-
if (isset($_GET['redirect_to'])) $log_redirect =
|
402 |
|
403 |
$up = parse_url($log_redirect);
|
404 |
if (isset($up['host']) && $up['host'] != $_SERVER['SERVER_NAME']) $log_redirect = $_SERVER['REQUEST_URI'];
|
397 |
$regurl = get_permalink($regurl);
|
398 |
}
|
399 |
$log_redirect = $_SERVER['REQUEST_URI'];
|
400 |
+
if (isset($params['redirect'])) $log_redirect = esc_url_raw($params['redirect']);
|
401 |
+
if (isset($_GET['redirect_to'])) $log_redirect = esc_url_raw($_GET['redirect_to']);
|
402 |
|
403 |
$up = parse_url($log_redirect);
|
404 |
if (isset($up['host']) && $up['host'] != $_SERVER['SERVER_NAME']) $log_redirect = $_SERVER['REQUEST_URI'];
|
src/User/Register.php
CHANGED
@@ -105,8 +105,8 @@ class Register
|
|
105 |
$loginurl = wpdm_login_url();
|
106 |
$reg_redirect = $loginurl;
|
107 |
if (isset($params['autologin']) && (int)$params['autologin'] === 1) $reg_redirect = wpdm_user_dashboard_url();
|
108 |
-
if (isset($params['redirect'])) $reg_redirect =
|
109 |
-
if (isset($_GET['redirect_to'])) $reg_redirect =
|
110 |
|
111 |
$force = uniqid();
|
112 |
|
105 |
$loginurl = wpdm_login_url();
|
106 |
$reg_redirect = $loginurl;
|
107 |
if (isset($params['autologin']) && (int)$params['autologin'] === 1) $reg_redirect = wpdm_user_dashboard_url();
|
108 |
+
if (isset($params['redirect'])) $reg_redirect = esc_url_raw($params['redirect']);
|
109 |
+
if (isset($_GET['redirect_to'])) $reg_redirect = esc_url_raw($_GET['redirect_to']);
|
110 |
|
111 |
$force = uniqid();
|
112 |
|
src/User/views/dashboard/download-history.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
<?php
|
14 |
global $wp_rewrite, $wp_query;
|
15 |
$items_per_page = 30;
|
16 |
-
$start = isset($_GET['pgd'])?($_GET['pgd']-1)*$items_per_page:0;
|
17 |
$res = $wpdb->get_results("select p.post_title,s.* from {$wpdb->prefix}posts p, {$wpdb->prefix}ahm_download_stats s where s.uid = '{$current_user->ID}' and s.pid = p.ID order by `timestamp` desc limit $start, $items_per_page");
|
18 |
foreach($res as $stat){
|
19 |
?>
|
@@ -31,7 +31,7 @@
|
|
31 |
<div class="card-footer">
|
32 |
<?php
|
33 |
|
34 |
-
isset($_GET['pgd']) && $_GET['pgd'] > 1 ? $current = $_GET['pgd'] : $current = 1;
|
35 |
$pagination = array(
|
36 |
'base' => @add_query_arg('pgd','%#%'),
|
37 |
'format' => '',
|
13 |
<?php
|
14 |
global $wp_rewrite, $wp_query;
|
15 |
$items_per_page = 30;
|
16 |
+
$start = isset($_GET['pgd'])?((int)$_GET['pgd']-1)*$items_per_page:0;
|
17 |
$res = $wpdb->get_results("select p.post_title,s.* from {$wpdb->prefix}posts p, {$wpdb->prefix}ahm_download_stats s where s.uid = '{$current_user->ID}' and s.pid = p.ID order by `timestamp` desc limit $start, $items_per_page");
|
18 |
foreach($res as $stat){
|
19 |
?>
|
31 |
<div class="card-footer">
|
32 |
<?php
|
33 |
|
34 |
+
isset($_GET['pgd']) && $_GET['pgd'] > 1 ? $current = (int)$_GET['pgd'] : $current = 1;
|
35 |
$pagination = array(
|
36 |
'base' => @add_query_arg('pgd','%#%'),
|
37 |
'format' => '',
|
src/__/Apply.php
CHANGED
@@ -228,39 +228,6 @@ class Apply
|
|
228 |
return $vars;
|
229 |
}
|
230 |
|
231 |
-
function playMedia()
|
232 |
-
{
|
233 |
-
|
234 |
-
if (strstr("!{$_SERVER['REQUEST_URI']}", "/wpdm-media/")) {
|
235 |
-
$media = explode("wpdm-media/", $_SERVER['REQUEST_URI']);
|
236 |
-
$media = explode("/", $media[1]);
|
237 |
-
list($ID, $file, $name) = $media;
|
238 |
-
$key = wpdm_query_var('_wpdmkey');
|
239 |
-
|
240 |
-
if (isset($_SERVER['HTTP_RANGE'])) {
|
241 |
-
$partialContent = true;
|
242 |
-
preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches);
|
243 |
-
$offset = intval($matches[1]);
|
244 |
-
$length = intval($matches[2]) - $offset;
|
245 |
-
} else {
|
246 |
-
$partialContent = false;
|
247 |
-
}
|
248 |
-
|
249 |
-
$keyValid = is_wpdmkey_valid($ID, $key, true);
|
250 |
-
wpdmdd($keyValid);
|
251 |
-
if (!$partialContent) {
|
252 |
-
if ($key == '' || !$keyValid)
|
253 |
-
Messages::Error(stripslashes(get_option('__wpdm_permission_denied_msg')), 1);
|
254 |
-
}
|
255 |
-
$files = WPDM()->package->getFiles($ID);
|
256 |
-
$file = $files[$file];
|
257 |
-
$file = FileSystem::fullPath($file, $ID);
|
258 |
-
$stream = new StreamMedia($file);
|
259 |
-
$stream->start();
|
260 |
-
die();
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
|
265 |
/**
|
266 |
* @usage Process Download Request from lock options
|
228 |
return $vars;
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
/**
|
233 |
* @usage Process Download Request from lock options
|
src/__/Email.php
CHANGED
@@ -282,7 +282,7 @@ class Email {
|
|
282 |
$params['template_file'] = wpdm_query_var('etmpl');
|
283 |
}
|
284 |
$template = self::prepare( $id, $params );
|
285 |
-
echo $template
|
286 |
die();
|
287 |
|
288 |
}
|
@@ -309,7 +309,7 @@ class Email {
|
|
309 |
{
|
310 |
if(substr_count($matched[1], "acfx_user_meta_")){
|
311 |
$meta_name = str_replace("acfx_user_meta_", "", $matched[1]);
|
312 |
-
$meta_value = get_field($meta_name, 'user_'.get_current_user_id());
|
313 |
return $meta_value;
|
314 |
}
|
315 |
if(substr_count($matched[1], "acf_user_meta_")){
|
282 |
$params['template_file'] = wpdm_query_var('etmpl');
|
283 |
}
|
284 |
$template = self::prepare( $id, $params );
|
285 |
+
echo wpdm_valueof($template, 'message', 'html');
|
286 |
die();
|
287 |
|
288 |
}
|
309 |
{
|
310 |
if(substr_count($matched[1], "acfx_user_meta_")){
|
311 |
$meta_name = str_replace("acfx_user_meta_", "", $matched[1]);
|
312 |
+
$meta_value = function_exists('get_field') ? get_field($meta_name, 'user_'.get_current_user_id()) : '';
|
313 |
return $meta_value;
|
314 |
}
|
315 |
if(substr_count($matched[1], "acf_user_meta_")){
|
src/__/Session.php
CHANGED
@@ -34,8 +34,9 @@ class Session
|
|
34 |
self::$store = get_option('__wpdm_tmp_storage', 'db');
|
35 |
|
36 |
if (self::$store === 'file') {
|
37 |
-
|
38 |
-
|
|
|
39 |
$data = Crypt::decrypt($data, true);
|
40 |
if (!is_array($data)) $data = array();
|
41 |
} else {
|
34 |
self::$store = get_option('__wpdm_tmp_storage', 'db');
|
35 |
|
36 |
if (self::$store === 'file') {
|
37 |
+
$session_file = realpath(WPDM_CACHE_DIR . "/session-{$deviceID}.txt");
|
38 |
+
if (file_exists($session_file) && substr_count($session_file, WPDM_CACHE_DIR)) {
|
39 |
+
$data = file_get_contents($session_file);
|
40 |
$data = Crypt::decrypt($data, true);
|
41 |
if (!is_array($data)) $data = array();
|
42 |
} else {
|
src/__/StreamMedia.php
DELETED
@@ -1,159 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* User: shahnuralam
|
4 |
-
* Date: 1/24/18
|
5 |
-
* Time: 3:14 PM
|
6 |
-
* Since: 3.7.4
|
7 |
-
*/
|
8 |
-
|
9 |
-
namespace WPDM\__;
|
10 |
-
|
11 |
-
if (!defined('ABSPATH')) die();
|
12 |
-
|
13 |
-
class StreamMedia
|
14 |
-
{
|
15 |
-
private $filePath;
|
16 |
-
private $filePointer;
|
17 |
-
private $chunk = 102400;
|
18 |
-
private $start = -1;
|
19 |
-
private $eof = -1;
|
20 |
-
private $size = 0;
|
21 |
-
|
22 |
-
function __construct($filePath)
|
23 |
-
{
|
24 |
-
$this->filePath = $filePath;
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Open The File
|
29 |
-
* @return $this
|
30 |
-
*/
|
31 |
-
private function open()
|
32 |
-
{
|
33 |
-
if (!($this->filePointer = fopen($this->filePath, 'rb'))) {
|
34 |
-
\WPDM\__\Messages::error(__( "Failed To Open File!" , "download-manager" ), 1);
|
35 |
-
}
|
36 |
-
return $this;
|
37 |
-
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Set Download Speed
|
42 |
-
* @return $this
|
43 |
-
*/
|
44 |
-
private function setSpeed(){
|
45 |
-
$speed = get_option('__wpdm_download_speed', 10240);
|
46 |
-
$speed = $speed > 0 ? $speed:10240;
|
47 |
-
$speed = apply_filters('wpdm_download_speed', $speed);
|
48 |
-
$this->chunk = $speed * 1024;
|
49 |
-
return $this;
|
50 |
-
}
|
51 |
-
|
52 |
-
/**
|
53 |
-
* Prepare and Set Download Headers
|
54 |
-
* @return $this
|
55 |
-
*/
|
56 |
-
private function setHeader()
|
57 |
-
{
|
58 |
-
ob_get_clean();
|
59 |
-
|
60 |
-
$this->start = 0;
|
61 |
-
$this->size = filesize($this->filePath);
|
62 |
-
|
63 |
-
$this->eof = $this->size - 1;
|
64 |
-
$mData = wp_check_filetype($this->filePath);
|
65 |
-
set_time_limit(0);
|
66 |
-
header("Content-Type: {$mData['type']}");
|
67 |
-
header("Cache-Control: max-age=604800, public");
|
68 |
-
header("Expires: ".gmdate('D, d M Y H:i:s', time()+604800) . ' GMT');
|
69 |
-
header("Last-Modified: ".gmdate('D, d M Y H:i:s', @filemtime($this->filePath)) . ' GMT' );
|
70 |
-
header("Accept-Ranges: 0-".$this->eof);
|
71 |
-
|
72 |
-
if (isset($_SERVER['HTTP_RANGE'])) {
|
73 |
-
|
74 |
-
|
75 |
-
$CPOF = $this->start;
|
76 |
-
$EOF = $this->eof;
|
77 |
-
|
78 |
-
list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
|
79 |
-
if (strpos($range, ',') !== false) {
|
80 |
-
header('HTTP/1.1 416 Requested Range Not Satisfiable');
|
81 |
-
header("Content-Range: bytes $this->start-$this->eof/$this->size");
|
82 |
-
exit;
|
83 |
-
}
|
84 |
-
if ($range == '-') {
|
85 |
-
$CPOF = $this->size - substr($range, 1);
|
86 |
-
}else{
|
87 |
-
$range = explode('-', $range);
|
88 |
-
$CPOF = $range[0];
|
89 |
-
|
90 |
-
$EOF = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $EOF;
|
91 |
-
}
|
92 |
-
$EOF = ($EOF > $this->eof) ? $this->eof : $EOF;
|
93 |
-
if ($CPOF > $EOF || $CPOF > $this->size - 1 || $EOF >= $this->size) {
|
94 |
-
header('HTTP/1.1 416 Requested Range Not Satisfiable');
|
95 |
-
header("Content-Range: bytes $this->start-$this->eof/$this->size");
|
96 |
-
exit;
|
97 |
-
}
|
98 |
-
$this->start = $CPOF;
|
99 |
-
$this->eof = $EOF;
|
100 |
-
$length = $this->eof - $this->start + 1;
|
101 |
-
fseek($this->filePointer, $this->start);
|
102 |
-
header('HTTP/1.1 206 Partial Content');
|
103 |
-
header("Content-Length: ".$length);
|
104 |
-
header("Content-Range: bytes $this->start-$this->eof/".$this->size);
|
105 |
-
}
|
106 |
-
else
|
107 |
-
{
|
108 |
-
header("Content-Length: ".$this->size);
|
109 |
-
}
|
110 |
-
|
111 |
-
return $this;
|
112 |
-
|
113 |
-
}
|
114 |
-
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Calculate range and serve the chunk
|
118 |
-
* @return $this
|
119 |
-
*/
|
120 |
-
private function serve()
|
121 |
-
{
|
122 |
-
$i = $this->start;
|
123 |
-
while(!feof($this->filePointer) && $i <= $this->eof) {
|
124 |
-
$bytesToRead = $this->chunk;
|
125 |
-
if(($i+$bytesToRead) > $this->eof) {
|
126 |
-
$bytesToRead = $this->eof - $i + 1;
|
127 |
-
}
|
128 |
-
$data = fread($this->filePointer, $bytesToRead);
|
129 |
-
echo $data;
|
130 |
-
flush();
|
131 |
-
$i += $bytesToRead;
|
132 |
-
}
|
133 |
-
return $this;
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Download is done!
|
138 |
-
*/
|
139 |
-
private function end()
|
140 |
-
{
|
141 |
-
fclose($this->filePointer);
|
142 |
-
exit;
|
143 |
-
}
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Start File Download
|
149 |
-
*/
|
150 |
-
|
151 |
-
function start()
|
152 |
-
{
|
153 |
-
$this->open()
|
154 |
-
->setSpeed()
|
155 |
-
->setHeader()
|
156 |
-
->serve()
|
157 |
-
->end();
|
158 |
-
}
|
159 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/__/__.php
CHANGED
@@ -41,18 +41,16 @@ class __
|
|
41 |
{
|
42 |
ob_start();
|
43 |
$id = uniqid();
|
44 |
-
$id = $data['id']
|
45 |
-
$value = $data
|
46 |
?>
|
47 |
<div class="input-group">
|
48 |
-
<input placeholder="<?php echo
|
49 |
-
id="<?php echo
|
50 |
-
value="<?php echo
|
51 |
<span class="input-group-btn">
|
52 |
-
<button class="btn btn-default btn-media-upload" type="button"
|
53 |
-
|
54 |
-
class="fa fa-picture-o"></i></button>
|
55 |
-
</span>
|
56 |
</div>
|
57 |
<?php
|
58 |
return ob_get_clean();
|
41 |
{
|
42 |
ob_start();
|
43 |
$id = uniqid();
|
44 |
+
$id = isset($data['id']) ? $data['id'] : $id;
|
45 |
+
$value = __::valueof($data, 'value');
|
46 |
?>
|
47 |
<div class="input-group">
|
48 |
+
<input placeholder="<?php echo esc_attr($data['placeholder']); ?>" type="url" name="<?php echo esc_attr($data['name']); ?>"
|
49 |
+
id="<?php echo esc_attr($id); ?>" class="form-control"
|
50 |
+
value="<?php echo esc_attr($value); ?>"/>
|
51 |
<span class="input-group-btn">
|
52 |
+
<button class="btn btn-default btn-media-upload" type="button" rel="#<?php echo esc_attr($id); ?>"><i class="fa fa-picture-o"></i></button>
|
53 |
+
</span>
|
|
|
|
|
54 |
</div>
|
55 |
<?php
|
56 |
return ob_get_clean();
|
src/wpdm-start-download.php
CHANGED
@@ -30,9 +30,9 @@ do_action("wpdm_onstart_download", $package);
|
|
30 |
$speed = (int)get_option('__wpdm_download_speed', 10240); //in KB - default 10 MB
|
31 |
$speed = $speed > 0 ? $speed : 10240;
|
32 |
$speed = apply_filters('wpdm_download_speed', $speed);
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
$_content_dir = str_replace('\\','/',WP_CONTENT_DIR);
|
38 |
$_old_up_dir = $_content_dir.'/uploads/download-manager-files/';
|
30 |
$speed = (int)get_option('__wpdm_download_speed', 10240); //in KB - default 10 MB
|
31 |
$speed = $speed > 0 ? $speed : 10240;
|
32 |
$speed = apply_filters('wpdm_download_speed', $speed);
|
33 |
+
//$user = get_user_by('id', $package['author']);
|
34 |
|
35 |
+
//$user_upload_dir = UPLOAD_DIR . $user->user_login . '/';
|
36 |
|
37 |
$_content_dir = str_replace('\\','/',WP_CONTENT_DIR);
|
38 |
$_old_up_dir = $_content_dir.'/uploads/download-manager-files/';
|