WordPress Download Manager - Version 2.6.96

Version Description

  • Upgraded server file browser option to control access
  • Fixed minor issues
Download this release

Release Info

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

Code changes from version 2.6.2 to 2.6.96

download-manager.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name: Download Manager
4
  Plugin URI: http://www.wpdownloadmanager.com/
5
- Description: Manage, track and control file download from your wordpress site
6
  Author: Shaon
7
- Version: 2.6.2
8
  Author URI: http://www.wpdownloadmanager.com/
9
  */
10
 
@@ -67,6 +67,7 @@ function wpdm_free_install(){
67
 
68
  update_option('wpdm_access_level','publish_posts');
69
  delete_option('wpdm_first_install');
 
70
  $tf = $wpdb->get_var("select count(*) from `ahm_files`");
71
  if($tf==0){
72
  update_option('wpdm_install_time',time());
@@ -149,8 +150,7 @@ function wpdm_all_packages($params = array()){
149
  global $wpdb, $current_user;
150
  ob_start();
151
  include("wpdm-all-downloads.php");
152
- $data = ob_get_contents();
153
- ob_clean();
154
  return $data;
155
  }
156
 
@@ -402,8 +402,10 @@ if(!isset($_GET['task'])||$_GET['task']!='wpdm_tree') return;
402
 
403
  function wpdm_admin_options(){
404
 
405
- if(!file_exists(UPLOAD_DIR)&&$_GET[task]!='wpdm_create_dir'){
406
-
 
 
407
  echo "
408
  <div id=\"warning\" class=\"error fade\"><p>
409
  Automatic dir creation failed! [ <a href='admin.php?page=file-manager&task=CreateDir&re=1'>Try again to create dir automatically</a> ]<br><br>
@@ -418,20 +420,21 @@ function wpdm_admin_options(){
418
  </div>
419
  ";
420
  }
421
-
422
-
 
423
  if(!file_exists(UPLOAD_DIR.'.htaccess'))
424
  wpdm_set_htaccess();
425
-
426
- if(isset($_GET['task'])&&$_GET['task']!=''&&function_exists($_GET['task']))
427
- return call_user_func($_GET['task']);
428
  else
429
  include('wpdm-list-files.php');
430
  }
431
 
432
  function wpdm_delete_file(){
433
  global $wpdb;
434
- if(isset($_GET['task']) && $_GET['task'] == 'DeleteFile' && is_admin()){
435
  if(is_array($_GET['id'])){
436
  foreach($_GET['id'] as $id){
437
  $qry[] = "id='".(int)$id."'";
@@ -468,18 +471,22 @@ function wpdm_create_dir(){
468
  function wpdm_settings(){
469
  if(isset($_POST['access'])){
470
 
 
471
  update_option('wpdm_access_level',$_POST['access']);
472
  update_option('wpdm_login_msg',$_POST['wpdm_login_msg']);
473
  update_option('wpdm_show_cinfo',$_POST['wpdm_show_cinfo']);
 
474
  update_option('_wpdm_file_browser_root',$_POST['_wpdm_file_browser_root']);
475
 
476
  }
477
- if(is_uploaded_file($_FILES['icon']['tmp_name'])){
478
  ///print_r(dirname(__FILE__).'/icon/download.png');
479
  move_uploaded_file($_FILES['icon']['tmp_name'],dirname(__FILE__).'/icon/download.png');
480
  }
481
  $access = get_option('wpdm_access_level');
 
482
  $wpdm_show_cinfo = get_option('wpdm_show_cinfo');
 
483
  include('wpdm-settings.php');
484
  }
485
 
@@ -544,8 +551,8 @@ function wpdm_edit_file(){
544
  }
545
 
546
  function wpdm_categories(){
547
- $cid = addslashes($_GET['cid']);
548
- if($_GET['task']=='DeleteCategory'){
549
  $tpldata = maybe_unserialize(get_option('_fm_categories'));
550
  unset($tpldata[$cid]);
551
  update_option('_fm_categories',@serialize($tpldata));
@@ -554,7 +561,7 @@ function wpdm_categories(){
554
  </script>";
555
  die();
556
  }
557
- if($_POST['cat']){
558
  $tpldata = maybe_unserialize(get_option('_fm_categories'));
559
  if(!is_array($tpldata)) $tpldata =array();
560
  $_POST['cat']['title'] = esc_attr($_POST['cat']['title']);
@@ -621,7 +628,7 @@ foreach($ndata as $data){
621
  $data['page_link'] = "<a class='wpdm-popup' href='{$postlink}{$sap}download={$data['id']}'>$link_label</a>";
622
  //if($data['password']=='') { $data['page_link'] = "<a href='".home_url('/?wpdmact=process&did='.base64_encode($id.'.hotlink'))."'>{$link_label}</a>"; }
623
  if($data['password']=='') {
624
- $url = home_url('/?wpdmact=process&did='.base64_encode($data['id'].'.hotlink'));
625
  $data['page_link'] = "<a href='{$url}'>$link_label</a>";
626
  }
627
  if($data['icon']!='') $bg = "background-image: url(\"".plugins_url()."/download-manager/icon/{$data[icon]}\");";
@@ -692,7 +699,7 @@ function wpdm_embed_category_sc($params){
692
  $data['page_link'] = "<a class='wpdm-popup' href='{$postlink}{$sap}download={$data['id']}'>$link_label</a>";
693
  //if($data['password']=='') { $data['page_link'] = "<a href='".home_url('/?wpdmact=process&did='.base64_encode($id.'.hotlink'))."'>{$link_label}</a>"; }
694
  if($data['password']=='') {
695
- $url = home_url('/?wpdmact=process&did='.base64_encode($data['id'].'.hotlink'));
696
  $data['page_link'] = "<a href='{$url}'>$link_label</a>";
697
  }
698
  if($data['icon']!='') $bg = "background-image: url(\"".plugins_url()."/download-manager/icon/{$data[icon]}\");";
@@ -901,7 +908,7 @@ function wpdm_hotlink($params){
901
  }
902
 
903
  function delete_all_cats(){
904
- if(!isset($_GET['page'])) return;
905
  if($_GET['page']=='file-manager/categories'&&$_GET['task']=='delete-all'){
906
  delete_option('_fm_categories');
907
  header('location: '.$_SERVER['HTTP_REFERER']);
@@ -911,7 +918,7 @@ function delete_all_cats(){
911
 
912
  function wpdm_save_file(){
913
  global $wpdb;
914
- if(isset($_POST['id'])&&isset($_POST['wpdmtask'])&&$_POST['wpdmtask']=='update'){
915
  extract($_POST);
916
 
917
 
@@ -956,6 +963,7 @@ function wpdm_check_upload(){
956
  }
957
 
958
  function wpdm_delete__file(){
 
959
  global $wpdb;
960
  $id = intval($_REQUEST['file']);
961
  $data = $wpdb->get_row("select * from ahm_files where id='$id'",ARRAY_A);
@@ -966,6 +974,7 @@ function wpdm_delete__file(){
966
  unset($data['file']);
967
  $wpdb->query("update ahm_files set `file`='' where id='$id'");
968
  die('ok');
 
969
  }
970
 
971
 
@@ -979,9 +988,13 @@ function wpdm_help(){
979
  If you have anything to ask or if anything not clear please search or ask here:
980
  <br/>
981
  <strong><a href="http://www.wpdownloadmanager.com/support/forum/download-manager-free/" target="_blank">http://www.wpdownloadmanager.com/support/forum/download-manager-free/</a></strong>
982
-
983
-
984
-
 
 
 
 
985
  <?php
986
  }
987
 
@@ -993,8 +1006,8 @@ function wpdm_menu(){
993
  add_submenu_page( 'file-manager', 'File Manager', 'Manage', get_option('wpdm_access_level','manage_options'), 'file-manager', 'wpdm_admin_options');
994
  add_submenu_page( 'file-manager', 'Add New File &lsaquo; File Manager', 'Add New File', get_option('wpdm_access_level','manage_options'), 'file-manager/add-new-file', 'wpdm_add_new_file');
995
  add_submenu_page( 'file-manager', 'Categories &lsaquo; File Manager', 'Categories', get_option('wpdm_access_level','manage_options'), 'file-manager/categories', 'wpdm_categories');
996
- add_submenu_page( 'file-manager', 'Settings &lsaquo; File Manager', 'Settings', get_option('wpdm_access_level','manage_options'), 'file-manager/settings', 'wpdm_settings');
997
- add_submenu_page( 'file-manager', 'Help &lsaquo; File Manager', 'Help', get_option('wpdm_access_level','manage_options'), 'file-manager/help', 'wpdm_help');
998
 
999
  }
1000
 
@@ -1017,6 +1030,11 @@ function wpdm_enque_scripts(){
1017
  wp_enqueue_style('wpdm-front',plugins_url().'/download-manager/css/front.css');
1018
  }
1019
 
 
 
 
 
 
1020
 
1021
  add_action("admin_menu","wpdm_menu");
1022
  add_action("init","delete_all_cats");
@@ -1044,7 +1062,8 @@ add_action('init','wpdm_process');
1044
  add_action('wp_ajax_file_upload','wpdm_check_upload');
1045
  add_action('wp_ajax_delete_file','wpdm_delete__file');
1046
  add_action('wp_ajax_save_wpdm_file','wpdm_save_file');
1047
-
 
1048
 
1049
  add_action("init","wpdm_file_browser");
1050
  add_action("init","wpdm_dir_tree");
2
  /*
3
  Plugin Name: Download Manager
4
  Plugin URI: http://www.wpdownloadmanager.com/
5
+ Description: Manage, track and control file download from your WordPress site
6
  Author: Shaon
7
+ Version: 2.6.96
8
  Author URI: http://www.wpdownloadmanager.com/
9
  */
10
 
67
 
68
  update_option('wpdm_access_level','publish_posts');
69
  delete_option('wpdm_first_install');
70
+ delete_option('hide_wpdm270n');
71
  $tf = $wpdb->get_var("select count(*) from `ahm_files`");
72
  if($tf==0){
73
  update_option('wpdm_install_time',time());
150
  global $wpdb, $current_user;
151
  ob_start();
152
  include("wpdm-all-downloads.php");
153
+ $data = ob_get_clean();
 
154
  return $data;
155
  }
156
 
402
 
403
  function wpdm_admin_options(){
404
 
405
+ if(!file_exists(UPLOAD_DIR) && isset($_GET['task']) && $_GET['task']=='wpdm_create_dir') wpdm_create_dir();
406
+
407
+ if(!file_exists(UPLOAD_DIR) && isset($_GET['task']) && $_GET['task']!='wpdm_create_dir'){
408
+
409
  echo "
410
  <div id=\"warning\" class=\"error fade\"><p>
411
  Automatic dir creation failed! [ <a href='admin.php?page=file-manager&task=CreateDir&re=1'>Try again to create dir automatically</a> ]<br><br>
420
  </div>
421
  ";
422
  }
423
+
424
+
425
+
426
  if(!file_exists(UPLOAD_DIR.'.htaccess'))
427
  wpdm_set_htaccess();
428
+ //if(isset($_GET['task'])) die($_GET['task']);
429
+ if(isset($_GET['task'])&&$_GET['task']=='wpdm_edit_file')
430
+ return wpdm_edit_file();
431
  else
432
  include('wpdm-list-files.php');
433
  }
434
 
435
  function wpdm_delete_file(){
436
  global $wpdb;
437
+ if(isset($_GET['task']) && $_GET['task'] == 'DeleteFile' && current_user_can('edit_posts')){
438
  if(is_array($_GET['id'])){
439
  foreach($_GET['id'] as $id){
440
  $qry[] = "id='".(int)$id."'";
471
  function wpdm_settings(){
472
  if(isset($_POST['access'])){
473
 
474
+ update_option('wpdm_edtbtn',$_POST['edtbtn']);
475
  update_option('wpdm_access_level',$_POST['access']);
476
  update_option('wpdm_login_msg',$_POST['wpdm_login_msg']);
477
  update_option('wpdm_show_cinfo',$_POST['wpdm_show_cinfo']);
478
+ update_option('server_file_browser',$_POST['server_file_browser']);
479
  update_option('_wpdm_file_browser_root',$_POST['_wpdm_file_browser_root']);
480
 
481
  }
482
+ if(isset($_FILES['icon']) && is_uploaded_file($_FILES['icon']['tmp_name'])){
483
  ///print_r(dirname(__FILE__).'/icon/download.png');
484
  move_uploaded_file($_FILES['icon']['tmp_name'],dirname(__FILE__).'/icon/download.png');
485
  }
486
  $access = get_option('wpdm_access_level');
487
+ $edtbtn = get_option('wpdm_edtbtn');
488
  $wpdm_show_cinfo = get_option('wpdm_show_cinfo');
489
+ $server_file_browser = get_option('server_file_browser',1);
490
  include('wpdm-settings.php');
491
  }
492
 
551
  }
552
 
553
  function wpdm_categories(){
554
+ $cid = isset($_GET['cid'])?addslashes($_GET['cid']):'';
555
+ if(isset($_GET['task']) && $_GET['task']=='DeleteCategory'){
556
  $tpldata = maybe_unserialize(get_option('_fm_categories'));
557
  unset($tpldata[$cid]);
558
  update_option('_fm_categories',@serialize($tpldata));
561
  </script>";
562
  die();
563
  }
564
+ if(isset($_POST['cat'])){
565
  $tpldata = maybe_unserialize(get_option('_fm_categories'));
566
  if(!is_array($tpldata)) $tpldata =array();
567
  $_POST['cat']['title'] = esc_attr($_POST['cat']['title']);
628
  $data['page_link'] = "<a class='wpdm-popup' href='{$postlink}{$sap}download={$data['id']}'>$link_label</a>";
629
  //if($data['password']=='') { $data['page_link'] = "<a href='".home_url('/?wpdmact=process&did='.base64_encode($id.'.hotlink'))."'>{$link_label}</a>"; }
630
  if($data['password']=='') {
631
+ $url = home_url('/?wpdmact=process&did='.trim(base64_encode($data['id'].'.hotlink'),"="));
632
  $data['page_link'] = "<a href='{$url}'>$link_label</a>";
633
  }
634
  if($data['icon']!='') $bg = "background-image: url(\"".plugins_url()."/download-manager/icon/{$data[icon]}\");";
699
  $data['page_link'] = "<a class='wpdm-popup' href='{$postlink}{$sap}download={$data['id']}'>$link_label</a>";
700
  //if($data['password']=='') { $data['page_link'] = "<a href='".home_url('/?wpdmact=process&did='.base64_encode($id.'.hotlink'))."'>{$link_label}</a>"; }
701
  if($data['password']=='') {
702
+ $url = home_url('/?wpdmact=process&did='.trim(base64_encode($data['id'].'.hotlink'),"="));
703
  $data['page_link'] = "<a href='{$url}'>$link_label</a>";
704
  }
705
  if($data['icon']!='') $bg = "background-image: url(\"".plugins_url()."/download-manager/icon/{$data[icon]}\");";
908
  }
909
 
910
  function delete_all_cats(){
911
+ if(!isset($_GET['page']) || !isset($_GET['task'])) return;
912
  if($_GET['page']=='file-manager/categories'&&$_GET['task']=='delete-all'){
913
  delete_option('_fm_categories');
914
  header('location: '.$_SERVER['HTTP_REFERER']);
918
 
919
  function wpdm_save_file(){
920
  global $wpdb;
921
+ if(isset($_POST['id'])&&isset($_POST['wpdmtask'])&&$_POST['wpdmtask']=='update' && current_user_can('edit_posts')){
922
  extract($_POST);
923
 
924
 
963
  }
964
 
965
  function wpdm_delete__file(){
966
+ if(current_user_can('edit_posts')){
967
  global $wpdb;
968
  $id = intval($_REQUEST['file']);
969
  $data = $wpdb->get_row("select * from ahm_files where id='$id'",ARRAY_A);
974
  unset($data['file']);
975
  $wpdb->query("update ahm_files set `file`='' where id='$id'");
976
  die('ok');
977
+ }
978
  }
979
 
980
 
988
  If you have anything to ask or if anything not clear please search or ask here:
989
  <br/>
990
  <strong><a href="http://www.wpdownloadmanager.com/support/forum/download-manager-free/" target="_blank">http://www.wpdownloadmanager.com/support/forum/download-manager-free/</a></strong>
991
+ <br/>
992
+ <br/>
993
+ <div class="updated" style="padding: 20px" id="wpdm270n">
994
+ If you like to move wpdm to custom post type, you can start with <strong><a href="http://www.wpdownloadmanager.com/download/wordpress-download-manager-v2-7-0/">WPDM v2.7.0 here</a></strong>. This new version will be available at wp.org soon.
995
+
996
+ </div>
997
+
998
  <?php
999
  }
1000
 
1006
  add_submenu_page( 'file-manager', 'File Manager', 'Manage', get_option('wpdm_access_level','manage_options'), 'file-manager', 'wpdm_admin_options');
1007
  add_submenu_page( 'file-manager', 'Add New File &lsaquo; File Manager', 'Add New File', get_option('wpdm_access_level','manage_options'), 'file-manager/add-new-file', 'wpdm_add_new_file');
1008
  add_submenu_page( 'file-manager', 'Categories &lsaquo; File Manager', 'Categories', get_option('wpdm_access_level','manage_options'), 'file-manager/categories', 'wpdm_categories');
1009
+ add_submenu_page( 'file-manager', 'Settings &lsaquo; File Manager', 'Settings', 'manage_options', 'file-manager/settings', 'wpdm_settings');
1010
+ add_submenu_page( 'file-manager', 'Help &lsaquo; File Manager', 'Help', get_option('wpdm_access_level','manage_options'), 'file-manager/help', 'wpdm_help');
1011
 
1012
  }
1013
 
1030
  wp_enqueue_style('wpdm-front',plugins_url().'/download-manager/css/front.css');
1031
  }
1032
 
1033
+ function hide_wpdm270n(){
1034
+ update_option("hide_wpdm270n",1);
1035
+ die();
1036
+ }
1037
+
1038
 
1039
  add_action("admin_menu","wpdm_menu");
1040
  add_action("init","delete_all_cats");
1062
  add_action('wp_ajax_file_upload','wpdm_check_upload');
1063
  add_action('wp_ajax_delete_file','wpdm_delete__file');
1064
  add_action('wp_ajax_save_wpdm_file','wpdm_save_file');
1065
+ add_action('wp_ajax_hide_wpdm270n','hide_wpdm270n');
1066
+
1067
 
1068
  add_action("init","wpdm_file_browser");
1069
  add_action("init","wpdm_dir_tree");
editor_plugin.js CHANGED
@@ -3,20 +3,20 @@
3
 
4
  tinymce.create('tinymce.plugins.wpdm_tinyplugin', {
5
 
6
- init : function(ed, url){
7
  ed.addCommand('wpdm_mcedonwloadmanager', function() {
8
  ed.windowManager.open({
9
- title: 'Download Controller',
10
  file : 'admin.php?wpdm_action=wpdm_tinymce_button',
11
- height: 550,
12
- width:400,
13
  inline : 1
14
  }, {
15
  plugin_url : url, // Plugin absolute URL
16
  some_custom_arg : 'custom arg' // Custom argument
17
  });
18
  });
19
-
20
  ed.addButton('wpdm_tinyplugin', {
21
  title : 'Download Manager: Insert Package or Category',
22
  cmd : 'wpdm_mcedonwloadmanager',
@@ -36,5 +36,6 @@
36
  });
37
 
38
  tinymce.PluginManager.add('wpdm_tinyplugin', tinymce.plugins.wpdm_tinyplugin);
39
-
 
40
  })();
3
 
4
  tinymce.create('tinymce.plugins.wpdm_tinyplugin', {
5
 
6
+ init : function(ed, url){
7
  ed.addCommand('wpdm_mcedonwloadmanager', function() {
8
  ed.windowManager.open({
9
+ title: 'Download Manager',
10
  file : 'admin.php?wpdm_action=wpdm_tinymce_button',
11
+ height: 600,
12
+ width:480,
13
  inline : 1
14
  }, {
15
  plugin_url : url, // Plugin absolute URL
16
  some_custom_arg : 'custom arg' // Custom argument
17
  });
18
  });
19
+
20
  ed.addButton('wpdm_tinyplugin', {
21
  title : 'Download Manager: Insert Package or Category',
22
  cmd : 'wpdm_mcedonwloadmanager',
36
  });
37
 
38
  tinymce.PluginManager.add('wpdm_tinyplugin', tinymce.plugins.wpdm_tinyplugin);
39
+
40
+
41
  })();
functions.php CHANGED
@@ -79,17 +79,24 @@
79
 
80
  // Function that output's the contents of the dashboard widget
81
  function wpdm_dashboard_widget_function() {
82
- echo "<img src='".plugins_url('/download-manager/images/wpdm-logo.png')."' /><br/>";
83
-
84
- if(function_exists('curl_init')){
85
- $ch=curl_init();
86
- curl_setopt($ch,CURLOPT_URL,'http://wpdownloadmanager.com/notice.php');
87
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,2);
88
- curl_setopt($ch,CURLOPT_TIMEOUT,3);
89
- curl_exec($ch);
90
- curl_close($ch);
91
- } else
92
- echo "CURL need to be enabled!";
 
 
 
 
 
 
 
93
  }
94
 
95
  // Function that beeng used in the action hook
79
 
80
  // Function that output's the contents of the dashboard widget
81
  function wpdm_dashboard_widget_function() {
82
+ echo "<img style='max-width:100%;' src='".plugins_url('/download-manager/images/wpdm-logo.png')."' /><br/>";
83
+
84
+ ?>
85
+ <div class="tab-content">
86
+
87
+ <div class="tab-pane active" id="settings">
88
+ <iframe id="excelz" src="" style="height: 350px;width:100%;border:0px;overflow: hidden !important;"></iframe>
89
+ </div>
90
+ </div>
91
+
92
+ <script>
93
+ jQuery(function () {
94
+
95
+ jQuery('#excelz').attr('src','http://cdn.wpdownloadmanager.com/notice.php?wpdmvarsion=<?php echo WPDM_Version; ?>').css('overflow','hidden');
96
+
97
+ })
98
+ </script>
99
+ <?php
100
  }
101
 
102
  // Function that beeng used in the action hook
images/wpdm-logo.png CHANGED
Binary file
process.php CHANGED
@@ -30,7 +30,7 @@ if(is_array($data)){
30
  @unlink(dirname(__FILE__).'/cache/'.$_GET['did']);
31
 
32
 
33
- if($data['download_count']>=$data['quota']&&$data['quota']>0) die('Download Limit Excedded!');
34
 
35
  //added for download monitor import feature
36
  $data['file'] = str_replace(site_url('/'),ABSPATH, $data['file']);
@@ -50,195 +50,7 @@ if(is_array($data)){
50
  wp_die('File not found!');
51
 
52
  $wpdb->query("update ahm_files set download_count=download_count+1 where id='$data[id]'");
53
- /*
54
- $mime_types = array("323" => "text/h323",
55
- "acx" => "application/internet-property-stream",
56
- "ai" => "application/postscript",
57
- "aif" => "audio/x-aiff",
58
- "aifc" => "audio/x-aiff",
59
- "aiff" => "audio/x-aiff",
60
- "asf" => "video/x-ms-asf",
61
- "asr" => "video/x-ms-asf",
62
- "asx" => "video/x-ms-asf",
63
- "au" => "audio/basic",
64
- "avi" => "video/x-msvideo",
65
- "axs" => "application/olescript",
66
- "bas" => "text/plain",
67
- "bcpio" => "application/x-bcpio",
68
- "bin" => "application/octet-stream",
69
- "bmp" => "image/bmp",
70
- "c" => "text/plain",
71
- "cat" => "application/vnd.ms-pkiseccat",
72
- "cdf" => "application/x-cdf",
73
- "cer" => "application/x-x509-ca-cert",
74
- "class" => "application/octet-stream",
75
- "clp" => "application/x-msclip",
76
- "cmx" => "image/x-cmx",
77
- "cod" => "image/cis-cod",
78
- "cpio" => "application/x-cpio",
79
- "crd" => "application/x-mscardfile",
80
- "crl" => "application/pkix-crl",
81
- "crt" => "application/x-x509-ca-cert",
82
- "csh" => "application/x-csh",
83
- "css" => "text/css",
84
- "dcr" => "application/x-director",
85
- "der" => "application/x-x509-ca-cert",
86
- "dir" => "application/x-director",
87
- "dll" => "application/x-msdownload",
88
- "dms" => "application/octet-stream",
89
- "doc" => "application/msword",
90
- "dot" => "application/msword",
91
- "dvi" => "application/x-dvi",
92
- "dxr" => "application/x-director",
93
- "eps" => "application/postscript",
94
- "etx" => "text/x-setext",
95
- "evy" => "application/envoy",
96
- "exe" => "application/octet-stream",
97
- "fif" => "application/fractals",
98
- "flr" => "x-world/x-vrml",
99
- "gif" => "image/gif",
100
- "gtar" => "application/x-gtar",
101
- "gz" => "application/x-gzip",
102
- "h" => "text/plain",
103
- "hdf" => "application/x-hdf",
104
- "hlp" => "application/winhlp",
105
- "hqx" => "application/mac-binhex40",
106
- "hta" => "application/hta",
107
- "htc" => "text/x-component",
108
- "htm" => "text/html",
109
- "html" => "text/html",
110
- "htt" => "text/webviewhtml",
111
- "ico" => "image/x-icon",
112
- "ief" => "image/ief",
113
- "iii" => "application/x-iphone",
114
- "ins" => "application/x-internet-signup",
115
- "isp" => "application/x-internet-signup",
116
- "jfif" => "image/pipeg",
117
- "jpe" => "image/jpeg",
118
- "jpeg" => "image/jpeg",
119
- "jpg" => "image/jpeg",
120
- "js" => "application/x-javascript",
121
- "latex" => "application/x-latex",
122
- "lha" => "application/octet-stream",
123
- "lsf" => "video/x-la-asf",
124
- "lsx" => "video/x-la-asf",
125
- "lzh" => "application/octet-stream",
126
- "m13" => "application/x-msmediaview",
127
- "m14" => "application/x-msmediaview",
128
- "m3u" => "audio/x-mpegurl",
129
- "man" => "application/x-troff-man",
130
- "mdb" => "application/x-msaccess",
131
- "me" => "application/x-troff-me",
132
- "mht" => "message/rfc822",
133
- "mhtml" => "message/rfc822",
134
- "mid" => "audio/mid",
135
- "mny" => "application/x-msmoney",
136
- "mov" => "video/quicktime",
137
- "movie" => "video/x-sgi-movie",
138
- "mp2" => "video/mpeg",
139
- "mp3" => "audio/mpeg",
140
- "mpa" => "video/mpeg",
141
- "mpe" => "video/mpeg",
142
- "mpeg" => "video/mpeg",
143
- "mpg" => "video/mpeg",
144
- "mpp" => "application/vnd.ms-project",
145
- "mpv2" => "video/mpeg",
146
- "ms" => "application/x-troff-ms",
147
- "mvb" => "application/x-msmediaview",
148
- "nws" => "message/rfc822",
149
- "oda" => "application/oda",
150
- "p10" => "application/pkcs10",
151
- "p12" => "application/x-pkcs12",
152
- "p7b" => "application/x-pkcs7-certificates",
153
- "p7c" => "application/x-pkcs7-mime",
154
- "p7m" => "application/x-pkcs7-mime",
155
- "p7r" => "application/x-pkcs7-certreqresp",
156
- "p7s" => "application/x-pkcs7-signature",
157
- "pbm" => "image/x-portable-bitmap",
158
- "pdf" => "application/pdf",
159
- "pfx" => "application/x-pkcs12",
160
- "pgm" => "image/x-portable-graymap",
161
- "pko" => "application/ynd.ms-pkipko",
162
- "pma" => "application/x-perfmon",
163
- "pmc" => "application/x-perfmon",
164
- "pml" => "application/x-perfmon",
165
- "pmr" => "application/x-perfmon",
166
- "pmw" => "application/x-perfmon",
167
- "pnm" => "image/x-portable-anymap",
168
- "pot" => "application/vnd.ms-powerpoint",
169
- "ppm" => "image/x-portable-pixmap",
170
- "pps" => "application/vnd.ms-powerpoint",
171
- "ppt" => "application/vnd.ms-powerpoint",
172
- "prf" => "application/pics-rules",
173
- "ps" => "application/postscript",
174
- "pub" => "application/x-mspublisher",
175
- "qt" => "video/quicktime",
176
- "ra" => "audio/x-pn-realaudio",
177
- "ram" => "audio/x-pn-realaudio",
178
- "ras" => "image/x-cmu-raster",
179
- "rgb" => "image/x-rgb",
180
- "rmi" => "audio/mid",
181
- "roff" => "application/x-troff",
182
- "rtf" => "application/rtf",
183
- "rtx" => "text/richtext",
184
- "scd" => "application/x-msschedule",
185
- "sct" => "text/scriptlet",
186
- "setpay" => "application/set-payment-initiation",
187
- "setreg" => "application/set-registration-initiation",
188
- "sh" => "application/x-sh",
189
- "shar" => "application/x-shar",
190
- "sit" => "application/x-stuffit",
191
- "snd" => "audio/basic",
192
- "spc" => "application/x-pkcs7-certificates",
193
- "spl" => "application/futuresplash",
194
- "src" => "application/x-wais-source",
195
- "sst" => "application/vnd.ms-pkicertstore",
196
- "stl" => "application/vnd.ms-pkistl",
197
- "stm" => "text/html",
198
- "svg" => "image/svg+xml",
199
- "sv4cpio" => "application/x-sv4cpio",
200
- "sv4crc" => "application/x-sv4crc",
201
- "t" => "application/x-troff",
202
- "tar" => "application/x-tar",
203
- "tcl" => "application/x-tcl",
204
- "tex" => "application/x-tex",
205
- "texi" => "application/x-texinfo",
206
- "texinfo" => "application/x-texinfo",
207
- "tgz" => "application/x-compressed",
208
- "tif" => "image/tiff",
209
- "tiff" => "image/tiff",
210
- "tr" => "application/x-troff",
211
- "trm" => "application/x-msterminal",
212
- "tsv" => "text/tab-separated-values",
213
- "txt" => "text/plain",
214
- "uls" => "text/iuls",
215
- "ustar" => "application/x-ustar",
216
- "vcf" => "text/x-vcard",
217
- "vrml" => "x-world/x-vrml",
218
- "wav" => "audio/x-wav",
219
- "wcm" => "application/vnd.ms-works",
220
- "wdb" => "application/vnd.ms-works",
221
- "wks" => "application/vnd.ms-works",
222
- "wmf" => "application/x-msmetafile",
223
- "wps" => "application/vnd.ms-works",
224
- "wri" => "application/x-mswrite",
225
- "wrl" => "x-world/x-vrml",
226
- "wrz" => "x-world/x-vrml",
227
- "xaf" => "x-world/x-vrml",
228
- "xbm" => "image/x-xbitmap",
229
- "xla" => "application/vnd.ms-excel",
230
- "xlc" => "application/vnd.ms-excel",
231
- "xlm" => "application/vnd.ms-excel",
232
- "xls" => "application/vnd.ms-excel",
233
- "xlt" => "application/vnd.ms-excel",
234
- "xlw" => "application/vnd.ms-excel",
235
- "xof" => "x-world/x-vrml",
236
- "xpm" => "image/x-xpixmap",
237
- "xwd" => "image/x-xwindowdump",
238
- "z" => "application/x-compress",
239
- "zip" => "application/zip");
240
- *
241
- */
242
 
243
  $filetype = wp_check_filetype($fname);
244
 
@@ -247,7 +59,14 @@ if(is_array($data)){
247
  $asfname = basename($fname);
248
 
249
  $fsize = filesize($fname);
 
 
250
 
 
 
 
 
 
251
  header("Content-Description: File Transfer");
252
  header("Content-Type: $mtype");
253
  header("Content-Disposition: attachment; filename=\"$asfname\"");
@@ -287,7 +106,7 @@ if(is_array($data)){
287
  }
288
 
289
  } else {
290
- die('File not found or Downlaoad Link Expired!');
291
  }
292
 
293
  die();
30
  @unlink(dirname(__FILE__).'/cache/'.$_GET['did']);
31
 
32
 
33
+ if($data['download_count']>=$data['quota']&&$data['quota']>0) wp_die('Download Limit Excedded!');
34
 
35
  //added for download monitor import feature
36
  $data['file'] = str_replace(site_url('/'),ABSPATH, $data['file']);
50
  wp_die('File not found!');
51
 
52
  $wpdb->query("update ahm_files set download_count=download_count+1 where id='$data[id]'");
53
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  $filetype = wp_check_filetype($fname);
56
 
59
  $asfname = basename($fname);
60
 
61
  $fsize = filesize($fname);
62
+
63
+
64
 
65
+ header("Pragma: public");
66
+ header("Expires: 0");
67
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
68
+ header("Cache-Control: public");
69
+ header("Robots: none");
70
  header("Content-Description: File Transfer");
71
  header("Content-Type: $mtype");
72
  header("Content-Disposition: attachment; filename=\"$asfname\"");
106
  }
107
 
108
  } else {
109
+ wp_die('File not found or Downlaoad Link Expired!');
110
  }
111
 
112
  die();
readme.txt CHANGED
@@ -3,16 +3,16 @@ Contributors: codename065, shahriar0822
3
  Donate link:
4
  Tags: file management plugin, downloads, document management plugin, download manager, file manager, download monitor, download counter, password protection, download tracker, download protection
5
  Requires at least: 3.4
6
- Tested up to: 3.9
7
  License: GPLv2 or later
8
 
9
 
10
 
11
- This is a Files and Document Management plugin which will help you to manage, track and control file downloads from your WordPress site.
12
 
13
 
14
  == Description ==
15
- WordPress Download Manager is a Files and Document Management plugin for your WordPress Site. WordPress Download Manager plugin will help you to manage, track and control file downloads from your WordPress site. You can set password and set access level any of your downloadable files from your WordPress site.
16
  You can add/embed downloadable files anywhere in the post just pasting the embed code inside your post content using WordPress Download Manager.
17
 
18
  = Features =
@@ -61,8 +61,55 @@ You can add/embed downloadable files anywhere in the post just pasting the embed
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  = 2.6.2 =
65
- * Fixed an issue with categroy short-code pagination
66
 
67
  = 2.6.1 =
68
  * Compatibility release for WordPress 3.9
3
  Donate link:
4
  Tags: file management plugin, downloads, document management plugin, download manager, file manager, download monitor, download counter, password protection, download tracker, download protection
5
  Requires at least: 3.4
6
+ Tested up to: 4.0
7
  License: GPLv2 or later
8
 
9
 
10
 
11
+ This is a Files and Documents Management plugin which will help you to manage, track and control file downloads from your WordPress site.
12
 
13
 
14
  == Description ==
15
+ WordPress Download Manager is a Files and Documents Management plugin for your WordPress Site. WordPress Download Manager plugin will help you to manage, track and control file downloads from your WordPress site. You can set password and set access level any of your downloadable files from your WordPress site.
16
  You can add/embed downloadable files anywhere in the post just pasting the embed code inside your post content using WordPress Download Manager.
17
 
18
  = Features =
61
 
62
  == Changelog ==
63
 
64
+ = 2.6.96 =
65
+ * Upgraded server file browser option to control access
66
+ * Fixed minor issues
67
+
68
+ = 2.6.95 =
69
+ * Fixed a few notices in add new file page
70
+ * Fixed issue with output buffering
71
+
72
+ = 2.6.94 =
73
+ * Upgraded tinymce button add-on
74
+ * Fixed some notices
75
+
76
+ = 2.6.93 =
77
+ * Fixed security issue with update file
78
+ * Fixed security issue with delete file
79
+
80
+ = 2.6.92 =
81
+ * Compatibility release for WordPress 4
82
+
83
+ = 2.6.91 =
84
+ * Compatibility release for WordPress 3.9.2
85
+ * adjusted a minor issue with download url
86
+ * Fixed 3 minor issues from add new file window
87
+
88
+ = 2.6.9 =
89
+ * Adjusted a string formatting issue in edit file window
90
+ * adjusted download url, trimmed "="
91
+
92
+ = 2.6.8 =
93
+ * Adjusted some notices and deprecated functions
94
+
95
+ = 2.6.7 =
96
+ * Security bug fixed
97
+ * Fixed an output buffering issue
98
+
99
+ = 2.6.6 =
100
+ * Adjusted some minor issues from previous version
101
+
102
+ = 2.6.5 =
103
+ * Added new option to control tinymce button visibility
104
+
105
+ = 2.6.4 =
106
+ * Fixed issue with quick add window
107
+
108
+ = 2.6.3 =
109
+ * Fixed issue with delete single item
110
+
111
  = 2.6.2 =
112
+ * Fixed an issue with category short-code pagination
113
 
114
  = 2.6.1 =
115
  * Compatibility release for WordPress 3.9
wpdm-add-new-file.php CHANGED
@@ -20,7 +20,7 @@ input{
20
  </style>
21
 
22
  <div class="wrap metabox-holder has-right-sidebar">
23
- <?php if($_GET['task']=='wpdm_edit_file'){ ?>
24
  <div class="icon32" id="icon-add-new-file"><br></div>
25
  <h2>Edit Download Package</h2>
26
  <?php } else { ?>
@@ -31,19 +31,19 @@ input{
31
  <form id="wpdmpack" action="" method="post">
32
  <input type="hidden" name="action" value="save_wpdm_file" />
33
  <input type="hidden" name="wpdmtask" value="<?php echo isset($_GET['task'])&&$_GET['task']=='wpdm_edit_file'?'update':'create';?>" />
34
- <input type="hidden" name="id" value="<?php echo $file['id']; ?>" />
35
  <div style="width: 75%;float:left;">
36
 
37
  <table cellpadding="5" cellspacing="5" width="100%">
38
  <tr>
39
 
40
- <td><input style="font-size:16pt;width:100%;" placeholder="Enter Title Here" type="text" value="<?php echo $file['title']?esc_attr($file['title']):""; ?>" name="file[title]" /></td>
41
  </tr>
42
 
43
  <tr>
44
  <td valign="top">
45
  <div id="poststuff" class="postarea">
46
- <?php $file['description'] = !isset($file['description'])?' ':$file['description']; wp_editor(stripslashes($file['description']),'file[description]','file[description]', true); ?>
47
  <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
48
  <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
49
  </div>
@@ -62,7 +62,7 @@ input{
62
  <table cellpadding="5" id="file_settings_table" cellspacing="0" width="100%" class="frm">
63
  <tr id="link_label_row">
64
  <td width="110px">Link Label:</td>
65
- <td><input size="10" type="text" style="width: 200px" value="<?php echo $file[link_label]?esc_attr($file['link_label']):'Download'; ?>" name="file[link_label]" />
66
  </td></tr>
67
  <tr id="password_row">
68
  <td>Password:</td>
@@ -70,7 +70,7 @@ input{
70
  </tr>
71
  <tr id="download_limit_row">
72
  <td>Stock&nbsp;Limit:</td>
73
- <td><input size="10" style="width: 80px" type="text" name="file[quota]" value="<?php echo $file['quota']; ?>" /></td>
74
  </tr>
75
  <tr>
76
  <td>Download Count: </td>
@@ -316,7 +316,7 @@ jQuery('#dcf').click(function(){
316
  <div class="clear"></div>
317
  </div>
318
  </div>
319
-
320
  <div class="postbox " id="action">
321
  <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span>Add file from server</span></h3>
322
  <div class="inside">
@@ -330,7 +330,7 @@ jQuery('#dcf').click(function(){
330
 
331
  </ul> <br>
332
 
333
- <a href="admin.php?page=file-manager&task=wpdm_file_browser" class="thickbox button-secondary">Open File Browser</a>
334
 
335
 
336
 
@@ -342,7 +342,7 @@ jQuery('#dcf').click(function(){
342
  <div class="clear"></div>
343
  </div>
344
  </div>
345
-
346
 
347
  <!--download icon-->
348
 
@@ -382,7 +382,7 @@ jQuery('#dcf').click(function(){
382
 
383
 
384
 
385
- <input style="float: right" type="reset" value="Reset" tabindex="9" class="button-secondary button button-large" class="add:the-list:newmeta" name="addmeta" id="addmetasub">
386
 
387
  <input type="submit" value="<?php echo $_GET['task']=='wpdm_edit_file'?'Update Package':'Create Package'; ?>" accesskey="p" tabindex="5" id="publish" class="button-primary button button-large" name="publish">
388
  <div class="clear"></div>
20
  </style>
21
 
22
  <div class="wrap metabox-holder has-right-sidebar">
23
+ <?php if(isset($_GET['task']) && $_GET['task']=='wpdm_edit_file'){ ?>
24
  <div class="icon32" id="icon-add-new-file"><br></div>
25
  <h2>Edit Download Package</h2>
26
  <?php } else { ?>
31
  <form id="wpdmpack" action="" method="post">
32
  <input type="hidden" name="action" value="save_wpdm_file" />
33
  <input type="hidden" name="wpdmtask" value="<?php echo isset($_GET['task'])&&$_GET['task']=='wpdm_edit_file'?'update':'create';?>" />
34
+ <input type="hidden" name="id" value="<?php echo isset($file['id'])?$file['id']:''; ?>" />
35
  <div style="width: 75%;float:left;">
36
 
37
  <table cellpadding="5" cellspacing="5" width="100%">
38
  <tr>
39
 
40
+ <td><input style="font-size:16pt;width:100%;" placeholder="Enter Title Here" type="text" value="<?php echo isset($file['title'])?esc_attr($file['title']):""; ?>" name="file[title]" /></td>
41
  </tr>
42
 
43
  <tr>
44
  <td valign="top">
45
  <div id="poststuff" class="postarea">
46
+ <?php $file['description'] = !isset($file['description'])?' ':$file['description']; wp_editor(stripslashes($file['description']),'filedescription',array('textarea_name'=>'file[description]')); ?>
47
  <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
48
  <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
49
  </div>
62
  <table cellpadding="5" id="file_settings_table" cellspacing="0" width="100%" class="frm">
63
  <tr id="link_label_row">
64
  <td width="110px">Link Label:</td>
65
+ <td><input size="10" type="text" style="width: 200px" value="<?php echo isset($file['link_label'])?esc_attr($file['link_label']):'Download'; ?>" name="file[link_label]" />
66
  </td></tr>
67
  <tr id="password_row">
68
  <td>Password:</td>
70
  </tr>
71
  <tr id="download_limit_row">
72
  <td>Stock&nbsp;Limit:</td>
73
+ <td><input size="10" style="width: 80px" type="text" name="file[quota]" value="<?php echo isset($file['quota'])?$file['quota']:''; ?>" /></td>
74
  </tr>
75
  <tr>
76
  <td>Download Count: </td>
316
  <div class="clear"></div>
317
  </div>
318
  </div>
319
+ <?php if(get_option('server_file_browser',1)==1){ ?>
320
  <div class="postbox " id="action">
321
  <div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><span>Add file from server</span></h3>
322
  <div class="inside">
330
 
331
  </ul> <br>
332
 
333
+ <a title="Server File Browser" href="admin.php?page=file-manager&task=wpdm_file_browser" class="thickbox button-secondary">Open File Browser</a>
334
 
335
 
336
 
342
  <div class="clear"></div>
343
  </div>
344
  </div>
345
+ <?php } ?>
346
 
347
  <!--download icon-->
348
 
382
 
383
 
384
 
385
+ <input style="float: right;width: 90px !important;border: 1px solid #ddd" type="reset" value="Reset" tabindex="9" class="button-secondary button button-large" name="addmeta" id="addmetasub">
386
 
387
  <input type="submit" value="<?php echo $_GET['task']=='wpdm_edit_file'?'Update Package':'Create Package'; ?>" accesskey="p" tabindex="5" id="publish" class="button-primary button button-large" name="publish">
388
  <div class="clear"></div>
wpdm-free-mce-button.php CHANGED
@@ -7,14 +7,15 @@ add_filter('mce_buttons', 'wpdm_tinyplugin_add_button', 0);
7
 
8
  function wpdm_tinyplugin_add_button($buttons)
9
  {
 
10
  array_push($buttons, "separator", "wpdm_tinyplugin");
11
  return $buttons;
12
  }
13
 
14
  function wpdm_tinyplugin_register($plugin_array)
15
  {
 
16
  $url = plugins_url("download-manager/editor_plugin.js");
17
-
18
  $plugin_array['wpdm_tinyplugin'] = $url;
19
  return $plugin_array;
20
  }
@@ -23,29 +24,19 @@ function wpdm_tinyplugin_register($plugin_array)
23
  function wpdm_free_tinymce(){
24
  global $wpdb;
25
  if(!isset($_GET['wpdm_action'])||$_GET['wpdm_action']!='wpdm_tinymce_button') return false;
 
 
 
 
26
  ?>
27
- <html>
28
  <head>
29
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
30
- <title>Download Contrller &#187; Insert Package or Category</title>
31
  <style type="text/css">
32
  *{font-family: Tahoma !important; font-size: 9pt; letter-spacing: 1px;}
33
  select,input{padding:5px;font-size: 9pt !important;font-family: Tahoma !important; letter-spacing: 1px;margin:5px;}
34
- .button{
35
- background: #7abcff; /* old browsers */
36
-
37
- background: -moz-linear-gradient(top, #7abcff 0%, #60abf8 44%, #4096ee 100%); /* firefox */
38
-
39
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7abcff), color-stop(44%,#60abf8), color-stop(100%,#4096ee)); /* webkit */
40
 
41
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7abcff', endColorstr='#4096ee',GradientType=0 ); /* ie */
42
- -webkit-border-radius: 3px;
43
- -moz-border-radius: 3px;
44
- border-radius: 3px;
45
- border:0px solid #FFF;
46
- color: #FFF;
47
- cursor: pointer;
48
- }
49
 
50
  .input{
51
  width: 340px;
@@ -141,20 +132,46 @@ fieldset{padding: 10px;}
141
  background: #ffffff;
142
  padding:10px;
143
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  </style>
146
- <script type="text/javascript" src="<?php echo includes_url('/js/jquery/jquery.js'); ?>"></script>
147
- <script type="text/javascript" src="<?php echo includes_url('/js/jquery/jquery.form.js'); ?>"></script>
148
- <script type="text/javascript" src="<?php echo includes_url('/js/tinymce/tiny_mce_popup.js'); ?>"></script>
149
- <script type='text/javascript' src='<?php echo includes_url('/js/plupload/plupload.js');?>'></script>
150
- <script type='text/javascript' src='<?php echo includes_url('/js/plupload/plupload.html5.js');?>'></script>
151
- <script type='text/javascript' src='<?php echo includes_url('/js/plupload/plupload.flash.js');?>'></script>
152
- <script type='text/javascript' src='<?php echo includes_url('/js/plupload/plupload.silverlight.js');?>'></script>
153
- <script type='text/javascript' src='<?php echo includes_url('/js/plupload/plupload.html4.js');?>'></script>
 
 
 
 
 
 
 
 
 
154
  <script type="text/javascript">
155
 
156
- jQuery(function(){
157
-
158
  var s_title ='', s_desc = '';
159
  jQuery('#addtopost').click(function(){
160
 
@@ -166,14 +183,14 @@ fieldset{padding: 10px;}
166
  var template = ' template="'+jQuery('#template').val()+' '+shadow+'" ';
167
  if(jQuery('#template').val()=='') template = "";
168
  win.send_to_editor('[wpdm_file id='+jQuery('#fl').val()+s_title+s_desc+template+']');
169
- tinyMCEPopup.close();
170
  return false;
171
  });
172
  jQuery('#addtopostc').click(function(){
173
  var win = window.dialogArguments || opener || parent || top;
174
 
175
  win.send_to_editor('[wpdm_category id='+jQuery('#flc').val()+']');
176
- tinyMCEPopup.close();
177
  return false;
178
  });
179
 
@@ -181,15 +198,15 @@ fieldset{padding: 10px;}
181
  var win = window.dialogArguments || opener || parent || top;
182
 
183
  win.send_to_editor(jQuery('#esc').val());
184
- tinyMCEPopup.close();
185
  return false;
186
  });
187
 
188
  });
189
  </script>
190
-
191
  </head>
192
- <body>
193
 
194
  <a href="#scode" class="tab active">Insert ShortCode</a><a href="#qbtn" class="tab">Quick Add</a>
195
  <div style="clear: both;"></div>
@@ -212,7 +229,7 @@ Drop Shadow Effect: <select id="shadow">
212
  <br/>
213
  <br/>
214
 
215
- <select class="button input" id="fl">
216
  <?php
217
  $res = $wpdb->get_results("select * from ahm_files", ARRAY_A);
218
  foreach($res as $row){
@@ -229,7 +246,7 @@ Drop Shadow Effect: <select id="shadow">
229
  <input type="submit" id="addtopost" class="button button-primary" name="addtopost" value="Insert into post" />
230
  </fieldset> <br>
231
  <fieldset><legend>Embed Category</legend>
232
- <select class="button input" id="flc">
233
  <?php
234
  wpdm_dropdown_categories();
235
  ?>
@@ -237,7 +254,7 @@ Drop Shadow Effect: <select id="shadow">
237
  <input type="submit" id="addtopostc" class="button button-primary" name="addtopost" value="Insert into post" />
238
  </fieldset> <br>
239
  <fieldset><legend>Additional Short-codes</legend>
240
- <select class="button input" id="esc">
241
  <option value="[wpdm_all_packages]">All Downloads (Data Table)</option>
242
  <option value="[wpdm_tree]">All Downloads (Tree View)</option>
243
  </select>
@@ -247,7 +264,7 @@ Drop Shadow Effect: <select id="shadow">
247
  <div id="qbtn" class="tab-pane" style="display: none;">
248
  <fieldset>
249
  <legend>Add New Package</legend>
250
- <form action="admin.php?page=file-manager/add-new-package" id="wpdmpack" method="post">
251
 
252
  <input type="hidden" id="act" name="file[access]" value="guest" />
253
  <input type="hidden" name="action" value="save_wpdm_file" />
@@ -255,9 +272,9 @@ Drop Shadow Effect: <select id="shadow">
255
 
256
  <div class="row-fluid">
257
  <b>Title:</b><br>
258
- <input type="text" size="40" name="file[title]" /><br>
259
  <b>Description:</b><br>
260
- <textarea cols="50" rows="3" class="span12" name="file[description]"></textarea><br>
261
  <div>
262
  <b>Download Link Label:</b><br>
263
  <input type="text" id="act" style="max-width: 100%;" name="file[link_label]" value="Download" />
@@ -446,8 +463,8 @@ jQuery('#dcf').click(function(){
446
  <div class="clear"></div>
447
  </div>
448
  </div>
449
-
450
- <input type="submit" class="button btn btn-success" value="Insert into post" />
451
  <div id="sving" style="float: right;margin-right:10px;padding-left: 20px;background:url('<?php echo admin_url('images/loading.gif');?>') left center no-repeat;display: none;">Please Wait...</div>
452
  </div>
453
  </form>
@@ -471,7 +488,7 @@ jQuery('#dcf').click(function(){
471
  var win = window.dialogArguments || opener || parent || top;
472
 
473
  win.send_to_editor('[wpdm_file id='+res+']');
474
- tinyMCEPopup.close();
475
  return false;
476
  }
477
  });
@@ -497,5 +514,5 @@ jQuery('#dcf').click(function(){
497
  }
498
 
499
 
500
- add_action('init', 'wpdm_free_tinymce');
501
 
7
 
8
  function wpdm_tinyplugin_add_button($buttons)
9
  {
10
+ if(!current_user_can(get_option('wpdm_edtbtn','manage_options'))) return $buttons;
11
  array_push($buttons, "separator", "wpdm_tinyplugin");
12
  return $buttons;
13
  }
14
 
15
  function wpdm_tinyplugin_register($plugin_array)
16
  {
17
+ if(!current_user_can(get_option('wpdm_edtbtn','manage_options'))) return $plugin_array;
18
  $url = plugins_url("download-manager/editor_plugin.js");
 
19
  $plugin_array['wpdm_tinyplugin'] = $url;
20
  return $plugin_array;
21
  }
24
  function wpdm_free_tinymce(){
25
  global $wpdb;
26
  if(!isset($_GET['wpdm_action'])||$_GET['wpdm_action']!='wpdm_tinymce_button') return false;
27
+ //wp_enqueue_script('thickbox');
28
+ //wp_enqueue_style('thickbox');
29
+ //wp_enqueue_script('media-upload');
30
+ //wp_enqueue_media();
31
  ?>
32
+ <html style="height: 100%;background: #eeeeee">
33
  <head>
34
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
35
+ <title>Download Manager</title>
36
  <style type="text/css">
37
  *{font-family: Tahoma !important; font-size: 9pt; letter-spacing: 1px;}
38
  select,input{padding:5px;font-size: 9pt !important;font-family: Tahoma !important; letter-spacing: 1px;margin:5px;}
 
 
 
 
 
 
39
 
 
 
 
 
 
 
 
 
40
 
41
  .input{
42
  width: 340px;
132
  background: #ffffff;
133
  padding:10px;
134
  }
135
+ a.tab{
136
+ color: #4096ee;
137
+ font-weight: 700;
138
+ }
139
+ .tab-pane fieldset{
140
+ border: 1px solid #dddddd;
141
+ }
142
+ input[type=text], textarea{
143
+ border: 1px solid #dddddd;
144
+ border-radius: 3px;
145
+ padding: 10px;
146
+ width: 100%;
147
+ }
148
+ legend{
149
+ font-weight: 800;
150
+ padding: 0 10px !important;
151
+ }
152
 
153
  </style>
154
+
155
+
156
+ <link rel='stylesheet' id='dashicons-css' href='<?php echo includes_url(); ?>/css/dashicons.min.css?ver=3.9.1' type='text/css' media='all' />
157
+ <link rel='stylesheet' id='dashicons-css' href='<?php echo includes_url(); ?>/css/buttons.css' type='text/css' media='all' />
158
+ <link rel='stylesheet' id='admin-bar-css' href='<?php echo includes_url(); ?>/css/admin-bar.min.css?ver=3.9.1' type='text/css' media='all' />
159
+ <link rel='stylesheet' id='thickbox-css' href='<?php echo includes_url(); ?>/js/thickbox/thickbox.css?ver=3.9.1' type='text/css' media='all' />
160
+ <link rel='stylesheet' id='buttons-css' href='<?php echo includes_url(); ?>/css/buttons.min.css?ver=3.9.1' type='text/css' media='all' />
161
+ <link rel='stylesheet' id='mediaelement-css' href='<?php echo includes_url(); ?>/js/mediaelement/mediaelementplayer.min.css?ver=2.13.0' type='text/css' media='all' />
162
+ <link rel='stylesheet' id='wp-mediaelement-css' href='<?php echo includes_url(); ?>/js/mediaelement/wp-mediaelement.css?ver=3.9.1' type='text/css' media='all' />
163
+ <link rel='stylesheet' id='media-views-css' href='<?php echo includes_url(); ?>/css/media-views.min.css?ver=3.9.1' type='text/css' media='all' />
164
+ <link rel='stylesheet' id='imgareaselect-css' href='<?php echo includes_url(); ?>/js/imgareaselect/imgareaselect.css?ver=0.9.8' type='text/css' media='all' />
165
+ <script type='text/javascript' src='<?php echo admin_url(); ?>/load-scripts.php?c=1&amp;load%5B%5D=jquery-core,jquery-migrate,jquery-form,utils,plupload,json2&amp;ver=3.9.1'></script>
166
+ <?php
167
+ //do_action('wp_head');
168
+
169
+
170
+ ?>
171
  <script type="text/javascript">
172
 
173
+ jQuery(function(){
174
+
175
  var s_title ='', s_desc = '';
176
  jQuery('#addtopost').click(function(){
177
 
183
  var template = ' template="'+jQuery('#template').val()+' '+shadow+'" ';
184
  if(jQuery('#template').val()=='') template = "";
185
  win.send_to_editor('[wpdm_file id='+jQuery('#fl').val()+s_title+s_desc+template+']');
186
+ parent.tinyMCE.activeEditor.windowManager.close(window);
187
  return false;
188
  });
189
  jQuery('#addtopostc').click(function(){
190
  var win = window.dialogArguments || opener || parent || top;
191
 
192
  win.send_to_editor('[wpdm_category id='+jQuery('#flc').val()+']');
193
+ parent.tinyMCE.activeEditor.windowManager.close(window);
194
  return false;
195
  });
196
 
198
  var win = window.dialogArguments || opener || parent || top;
199
 
200
  win.send_to_editor(jQuery('#esc').val());
201
+ parent.tinyMCE.activeEditor.windowManager.close(window);
202
  return false;
203
  });
204
 
205
  });
206
  </script>
207
+
208
  </head>
209
+ <body class="wp-core-ui">
210
 
211
  <a href="#scode" class="tab active">Insert ShortCode</a><a href="#qbtn" class="tab">Quick Add</a>
212
  <div style="clear: both;"></div>
229
  <br/>
230
  <br/>
231
 
232
+ <select id="fl">
233
  <?php
234
  $res = $wpdb->get_results("select * from ahm_files", ARRAY_A);
235
  foreach($res as $row){
246
  <input type="submit" id="addtopost" class="button button-primary" name="addtopost" value="Insert into post" />
247
  </fieldset> <br>
248
  <fieldset><legend>Embed Category</legend>
249
+ <select id="flc">
250
  <?php
251
  wpdm_dropdown_categories();
252
  ?>
254
  <input type="submit" id="addtopostc" class="button button-primary" name="addtopost" value="Insert into post" />
255
  </fieldset> <br>
256
  <fieldset><legend>Additional Short-codes</legend>
257
+ <select id="esc">
258
  <option value="[wpdm_all_packages]">All Downloads (Data Table)</option>
259
  <option value="[wpdm_tree]">All Downloads (Tree View)</option>
260
  </select>
264
  <div id="qbtn" class="tab-pane" style="display: none;">
265
  <fieldset>
266
  <legend>Add New Package</legend>
267
+ <form action="admin.php?page=file-manager/add-new-package" id="wpdmpack" method="post" style="margin: 0 !important;">
268
 
269
  <input type="hidden" id="act" name="file[access]" value="guest" />
270
  <input type="hidden" name="action" value="save_wpdm_file" />
272
 
273
  <div class="row-fluid">
274
  <b>Title:</b><br>
275
+ <input type="text" class="widefat" size="40" name="file[title]" /><br>
276
  <b>Description:</b><br>
277
+ <textarea cols="50" rows="3" class="span12 widefat" name="file[description]"></textarea><br>
278
  <div>
279
  <b>Download Link Label:</b><br>
280
  <input type="text" id="act" style="max-width: 100%;" name="file[link_label]" value="Download" />
463
  <div class="clear"></div>
464
  </div>
465
  </div>
466
+ <br/>
467
+ <input style="margin: 0 !important;" type="submit" class="button button-primary btn btn-success" value="Insert into post" />
468
  <div id="sving" style="float: right;margin-right:10px;padding-left: 20px;background:url('<?php echo admin_url('images/loading.gif');?>') left center no-repeat;display: none;">Please Wait...</div>
469
  </div>
470
  </form>
488
  var win = window.dialogArguments || opener || parent || top;
489
 
490
  win.send_to_editor('[wpdm_file id='+res+']');
491
+ parent.tinyMCE.activeEditor.windowManager.close(window);
492
  return false;
493
  }
494
  });
514
  }
515
 
516
 
517
+ add_action('admin_init', 'wpdm_free_tinymce');
518
 
wpdm-list-files.php CHANGED
@@ -28,16 +28,29 @@ $row = $wpdb->get_row("select count(*) as total from ahm_files $cond",ARRAY_A);
28
  <a class="button add-new-h2" style="font-weight: bold" href="http://wordpress.org/support/view/plugin-reviews/download-manager">A 5&#9733; rating will inspire me a lot :)</a>
29
  <br />
30
 
31
- </h2>
32
- <div class="updated" style="padding:5px 10px;color:#fff;font-weight:bold;background: #6F9348; border: 0px;padding:8px 20px;font-size:10pt;font-style: italic;">
33
- <a style="color: #fff;font-family: 'Verdana'" href="http://www.wpdownloadmanager.com/?affid=admin&domain=<?php echo $_SERVER['HTTP_HOST']; ?>" target="_blank">Get download manager premium version now! </a> /
34
- <a style="color: #fff;font-family: 'Verdana'" href="http://www.wpdownloadmanager.com/?affid=admin&domain=<?php echo $_SERVER['HTTP_HOST']; ?>#features" target="_blank">Checkout the features here</a>
35
- </div>
36
- <i><b style="font-family:Georgia">Simply Copy and Paste the embed code at anywhere in post contents</b></i><br><br>
37
-
38
-
39
-
 
 
 
 
 
 
40
 
 
 
 
 
 
 
 
41
  <div style="position: absolute;right:10px;margin-top: 5px;">
42
  <form action="" method="get">
43
  <input type="hidden" name="page" value="file-manager" />
@@ -91,8 +104,8 @@ $row = $wpdb->get_row("select count(*) as total from ahm_files $cond",ARRAY_A);
91
 
92
  <tbody class="list:post" id="the-list">
93
  <?php foreach($res as $media) {
94
-
95
- switch(end(explode(".",$media['file']))){
96
  case 'jpg': case 'png': case 'bmp': case 'gif':
97
  $icon = 'img.png';
98
  break;
@@ -101,7 +114,7 @@ $row = $wpdb->get_row("select count(*) as total from ahm_files $cond",ARRAY_A);
101
  case 'zip': $icon = 'zip.png'; break;
102
 
103
  default:
104
- $icon = end(explode(".",$media['file'])).'.png';
105
  break;
106
 
107
 
@@ -121,7 +134,7 @@ $row = $wpdb->get_row("select count(*) as total from ahm_files $cond",ARRAY_A);
121
  <strong><a title="Edit" href="admin.php?page=file-manager&task=wpdm_edit_file&id=<?php echo $media['id']?>"><?php echo stripslashes($media['title'])?></a></strong> <input style="text-align:center" type="text" onclick="this.select()" size="20" title="Simply Copy and Paste in post contents" value="[wpdm_file id=<?php echo $media['id'];?>]" /><br>
122
  <code>File: <?php echo $media['file']; ?></code><Br>
123
 
124
- <div class="row-actions"><div class="button-group"><a class="button" href="admin.php?page=file-manager&task=wpdm_edit_file&id=<?php echo $media['id']?>">Edit</a><a href="admin.php?page=file-manager&task=wpdm_delete_file&id=<?php echo $media['id']?>" onclick="return showNotice.warn();" class="button submitdelete" style="color: #aa0000;">Delete Permanently</a></div></div>
125
  </td>
126
  <td class="author column-author"><?php echo $media['password']; ?></td>
127
  <td class="parent column-parent"><?php echo $media['access']; ?></td>
28
  <a class="button add-new-h2" style="font-weight: bold" href="http://wordpress.org/support/view/plugin-reviews/download-manager">A 5&#9733; rating will inspire me a lot :)</a>
29
  <br />
30
 
31
+ </h2>
32
+ <div style="border-radius: 3px;border: 2px solid #1E8CBE" class="updated">
33
+ <p>
34
+ <em><b>Download Manager Pro!</b><br>Social Locks/Share, Build a Shop or Even a Marketplace, Multi-Level Marketing Add-on to Boost Sales and many more... </em>
35
+
36
+ <a target="_blank" href="http://www.wpdownloadmanager.com/?affid=admin&domain=<?php echo $_SERVER['HTTP_HOST']; ?>" class="button button-primary button-hero" style="float:right;margin-top: -23px;margin-right: -6px;border: 0 none;border-radius: 2px;box-shadow: none;">Checkout The Features Here →</a>
37
+ </p>
38
+ </div>
39
+
40
+ <?php if(get_option('hide_wpdm270n',0)==0){ ?>
41
+ <div style="border-radius: 3px;border: 2px solid #D54E21;padding:12px" class="updated" id="wpdm270n">
42
+ <em><b>WordPress Download Manager 2.7</b><a href="#" style="float: right;font-size: 16pt;color: #880000" onclick="return _close_notice('#wpdm270n')">&times;</a><br/>
43
+ Custom Post Type version is available now, you can download <strong><a href="http://www.wpdownloadmanager.com/download/wordpress-download-manager-v2-7-0/">WPDM v2.7.0 here</a></strong>. This new version will be available at wp.org soon.
44
+ </em>
45
+ </div>
46
 
47
+ <script>
48
+ function _close_notice(id){
49
+ jQuery(id).fadeOut();
50
+ jQuery.post('admin-ajax.php?action=hide_wpdm270n');
51
+ }
52
+ </script>
53
+ <?php } ?>
54
  <div style="position: absolute;right:10px;margin-top: 5px;">
55
  <form action="" method="get">
56
  <input type="hidden" name="page" value="file-manager" />
104
 
105
  <tbody class="list:post" id="the-list">
106
  <?php foreach($res as $media) {
107
+ $tmp = explode(".",$media['file']);
108
+ switch(end($tmp)){
109
  case 'jpg': case 'png': case 'bmp': case 'gif':
110
  $icon = 'img.png';
111
  break;
114
  case 'zip': $icon = 'zip.png'; break;
115
 
116
  default:
117
+ $icon = end($tmp).'.png';
118
  break;
119
 
120
 
134
  <strong><a title="Edit" href="admin.php?page=file-manager&task=wpdm_edit_file&id=<?php echo $media['id']?>"><?php echo stripslashes($media['title'])?></a></strong> <input style="text-align:center" type="text" onclick="this.select()" size="20" title="Simply Copy and Paste in post contents" value="[wpdm_file id=<?php echo $media['id'];?>]" /><br>
135
  <code>File: <?php echo $media['file']; ?></code><Br>
136
 
137
+ <div class="row-actions"><div class="button-group"><a class="button" href="admin.php?page=file-manager&task=wpdm_edit_file&id=<?php echo $media['id']?>">Edit</a><a href="admin.php?page=file-manager&task=DeleteFile&id=<?php echo $media['id']?>" onclick="return showNotice.warn();" class="button submitdelete" style="color: #aa0000;">Delete Permanently</a></div></div>
138
  </td>
139
  <td class="author column-author"><?php echo $media['password']; ?></td>
140
  <td class="parent column-parent"><?php echo $media['access']; ?></td>
wpdm-server-file-browser.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  function wpdm_dir_tree(){
4
- if(!isset($_GET['task'])||$_GET['task']!='wpdm_dir_tree') return;
5
  $_POST['dir'] = urldecode($_POST['dir']);
6
  if( file_exists($root . $_POST['dir']) ) {
7
  $files = scandir($root . $_POST['dir']);
@@ -27,7 +27,7 @@ function wpdm_dir_tree(){
27
  }
28
 
29
  function wpdm_file_browser(){
30
- if(!isset($_GET['task'])||$_GET['task']!='wpdm_file_browser') return;
31
  ?>
32
  <link rel="stylesheet" href="<?php echo plugins_url().'/download-manager/css/jqueryFileTree.css';?>" />
33
  <style type="text/css">.jqueryFileTree li{line-height: 20px;}</style>
1
  <?php
2
 
3
  function wpdm_dir_tree(){
4
+ if(!isset($_GET['task'])||$_GET['task']!='wpdm_dir_tree' || get_option('server_file_browser',1)==0) return;
5
  $_POST['dir'] = urldecode($_POST['dir']);
6
  if( file_exists($root . $_POST['dir']) ) {
7
  $files = scandir($root . $_POST['dir']);
27
  }
28
 
29
  function wpdm_file_browser(){
30
+ if(!isset($_GET['task'])||$_GET['task']!='wpdm_file_browser' || get_option('server_file_browser',1)==0) return;
31
  ?>
32
  <link rel="stylesheet" href="<?php echo plugins_url().'/download-manager/css/jqueryFileTree.css';?>" />
33
  <style type="text/css">.jqueryFileTree li{line-height: 20px;}</style>
wpdm-settings.php CHANGED
@@ -17,7 +17,7 @@ input{
17
  <form action="" method="post" enctype="multipart/form-data">
18
 
19
  <table cellpadding="5" cellspacing="5">
20
-
21
  <tr>
22
  <td>Minimum User Access Level:</td>
23
  <td><select name="access">
@@ -27,6 +27,15 @@ input{
27
  </select>
28
  </td>
29
  </tr>
 
 
 
 
 
 
 
 
 
30
  <tr>
31
  <td>Show category info with short-code:</td>
32
  <td><select name="wpdm_show_cinfo">
@@ -36,7 +45,15 @@ input{
36
  </select>
37
  </td>
38
  </tr>
39
-
 
 
 
 
 
 
 
 
40
  <tr>
41
  <td>Login Required Message:</td>
42
  <td>
@@ -46,7 +63,7 @@ input{
46
 
47
  <?php if(current_user_can("manage_options")){ ?>
48
  <tr>
49
- <td>Server File Borwser Rooe:</td>
50
  <td>
51
  <input type="text" name="_wpdm_file_browser_root" value="<?php echo get_option('_wpdm_file_browser_root',$_SERVER['DOCUMENT_ROOT']); ?>" size="90">
52
  </td>
@@ -70,10 +87,9 @@ input{
70
  <br>
71
 
72
 
73
- <input type="submit" value="save" accesskey="p" tabindex="5" id="publish" class="button button-primary button-large" name="publish">
74
- <input type="button" value="&#171; back" tabindex="9" class="button button-secondary button-large" onclick="location.href='admin.php?page=file-manager'" class="add:the-list:newmeta" name="addmeta" id="addmetasub">
75
-
76
- <input type="reset" value="reset" tabindex="9" class="button button-secondary button-large" class="add:the-list:newmeta" name="addmeta" id="addmetasub">
77
  </td>
78
  </tr>
79
 
@@ -82,4 +98,36 @@ input{
82
 
83
  </form>
84
 
85
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <form action="" method="post" enctype="multipart/form-data">
18
 
19
  <table cellpadding="5" cellspacing="5">
20
+
21
  <tr>
22
  <td>Minimum User Access Level:</td>
23
  <td><select name="access">
27
  </select>
28
  </td>
29
  </tr>
30
+ <tr>
31
+ <td>Minimum User Level to Use TinyMce Button with Editor:</td>
32
+ <td><select name="edtbtn">
33
+ <option value="manage_options">Administrator</option>
34
+ <option value="manage_categories" <?php echo $edtbtn=='manage_categories'?'selected':''?>>Editor</option>
35
+ <option value="publish_posts" <?php echo $edtbtn=='publish_posts'?'selected':''?>>Author</option>
36
+ </select>
37
+ </td>
38
+ </tr>
39
  <tr>
40
  <td>Show category info with short-code:</td>
41
  <td><select name="wpdm_show_cinfo">
45
  </select>
46
  </td>
47
  </tr>
48
+ <tr>
49
+ <td>Server file browser:</td>
50
+ <td><select name="server_file_browser">
51
+ <option value="1">Enable</option>
52
+ <option value="0" <?php echo $server_file_browser==0?'selected':''?>>Disable</option>
53
+
54
+ </select>
55
+ </td>
56
+ </tr>
57
  <tr>
58
  <td>Login Required Message:</td>
59
  <td>
63
 
64
  <?php if(current_user_can("manage_options")){ ?>
65
  <tr>
66
+ <td>Server File Borwser Root:</td>
67
  <td>
68
  <input type="text" name="_wpdm_file_browser_root" value="<?php echo get_option('_wpdm_file_browser_root',$_SERVER['DOCUMENT_ROOT']); ?>" size="90">
69
  </td>
87
  <br>
88
 
89
 
90
+ <input type="submit" value="Save" accesskey="p" tabindex="5" id="publish" class="button button-primary button-large" name="publish">
91
+
92
+ <input type="reset" style="width: 90px !important;border: 1px solid #ddd" value="Reset" tabindex="9" class="button button-secondary button-large" class="add:the-list:newmeta" name="addmeta" id="addmetasub">
 
93
  </td>
94
  </tr>
95
 
98
 
99
  </form>
100
 
101
+ </div>
102
+ <script>
103
+ jQuery('body').on('click', '.btn-media-upload' , function( event ){
104
+ event.preventDefault();
105
+ dfield = jQuery(jQuery(this).attr('rel'));
106
+
107
+ // If the media frame already exists, reopen it.
108
+ if ( file_frame ) {
109
+ file_frame.open();
110
+ return;
111
+ }
112
+
113
+ // Create the media frame.
114
+ file_frame = wp.media.frames.file_frame = wp.media({
115
+ title: jQuery( this ).data( 'uploader_title' ),
116
+ button: {
117
+ text: jQuery( this ).data( 'uploader_button_text' )
118
+ },
119
+ multiple: false // Set to true to allow multiple files to be selected
120
+ });
121
+
122
+ // When an image is selected, run a callback.
123
+ file_frame.on( 'select', function() {
124
+ // We set multiple to false so only get one image from the uploader
125
+ attachment = file_frame.state().get('selection').first().toJSON();
126
+ dfield.val(attachment.url);
127
+
128
+ });
129
+
130
+ // Finally, open the modal
131
+ file_frame.open();
132
+ });
133
+ </script>