WordPress File Upload - Version 4.6.1

Version Description

  • added uploader shortcode attribute 'resetmode' to control whether the upload form will be reset after an upload
  • added pagination in File Browser tab in Dashboard area of the plugin
Download this release

Release Info

Developer nickboss
Plugin Icon 128x128 WordPress File Upload
Version 4.6.1
Comparing to
See all releases

Code changes from version 4.6.0 to 4.6.1

js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -268,6 +268,12 @@ function wfu_apply_adminbrowser_bulkaction(){var actionselector=document.getElem
268
  selected[i].className.indexOf("wfu_included")>-1;if(included)codes_included++;else codes_not_included++;if(action=="delete"&&!included||action=="include"&&included)selected[i].checked=false;else codes.push(file_code)}}if(action=="delete"&&codes_not_included>0)alert("Notice! Files that were not uploaded using the plugin cannot be deleted and have been deselected.");else if(action=="include"&&codes_included>0)alert("Notice! Files already included in the plugin have been deselected.");if(codes.length==
269
  0)return;var url=document.getElementById("wfu_adminbrowser_action_url").value;var referer=document.getElementById("wfu_adminbrowser_referer").value;if(action=="delete"||action=="include"){var form=document.createElement("FORM");form.method="POST";form.action=url;form.style.display="none";var field1=document.createElement("INPUT");field1.type="hidden";field1.name="action";field1.value=action+"_file";form.appendChild(field1);var field2=document.createElement("INPUT");field2.type="hidden";field2.name=
270
  "file";field2.value="list:"+codes.join();form.appendChild(field2);var field3=document.createElement("INPUT");field3.type="hidden";field3.name="referer";field3.value=referer;form.appendChild(field3);document.body.appendChild(form);form.submit()}}
 
 
 
 
 
 
271
  function wfu_cleanlog_initialize_elements(){jQuery("#wfu_cleanlog_dateold").datepicker({dateFormat:"yy-mm-dd",beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});jQuery("#wfu_cleanlog_datefrom").datepicker({dateFormat:"yy-mm-dd",beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});jQuery("#wfu_cleanlog_dateto").datepicker({dateFormat:"yy-mm-dd",
272
  beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});wfu_attach_element_handlers(document.getElementById("wfu_cleanlog_periodold"),wfu_cleanlog_element_handler);wfu_attach_element_handlers(document.getElementById("wfu_cleanlog_periodtype"),wfu_cleanlog_element_handler)}function wfu_cleanlog_element_handler(e){document.querySelector(".wfu_cleanlog_error").classList.add("hidden")}
273
  function wfu_cleanlog_period_changed(){var sel=document.getElementById("wfu_cleanlog_period");if(sel.selectedIndex==0){document.querySelector(".wfu_selectdate_container").style.display="block";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="none";document.getElementById("wfu_cleanlog_dateold").value="";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==
268
  selected[i].className.indexOf("wfu_included")>-1;if(included)codes_included++;else codes_not_included++;if(action=="delete"&&!included||action=="include"&&included)selected[i].checked=false;else codes.push(file_code)}}if(action=="delete"&&codes_not_included>0)alert("Notice! Files that were not uploaded using the plugin cannot be deleted and have been deselected.");else if(action=="include"&&codes_included>0)alert("Notice! Files already included in the plugin have been deselected.");if(codes.length==
269
  0)return;var url=document.getElementById("wfu_adminbrowser_action_url").value;var referer=document.getElementById("wfu_adminbrowser_referer").value;if(action=="delete"||action=="include"){var form=document.createElement("FORM");form.method="POST";form.action=url;form.style.display="none";var field1=document.createElement("INPUT");field1.type="hidden";field1.name="action";field1.value=action+"_file";form.appendChild(field1);var field2=document.createElement("INPUT");field2.type="hidden";field2.name=
270
  "file";field2.value="list:"+codes.join();form.appendChild(field2);var field3=document.createElement("INPUT");field3.type="hidden";field3.name="referer";field3.value=referer;form.appendChild(field3);document.body.appendChild(form);form.submit()}}
271
+ function wfu_goto_adminbrowser_page(token,go_to){var sel=document.getElementById("wfu_adminbrowser_pages");var page=sel.selectedIndex+1;var newpage=page;if(go_to=="next")newpage=Math.min(page+1,sel.options.length);else if(go_to=="prev")newpage=Math.max(page-1,1);else if(go_to=="last")newpage=sel.options.length;else if(go_to=="first")newpage=1;else if(go_to=="sel")page=-1;if(newpage==page)return;var xhr=wfu_GetHttpRequestObject();if(xhr==null)return;var url=AdminParams.wfu_ajax_url;params=new Array(4);
272
+ params[0]=new Array(2);params[0][0]="action";params[0][1]="wfu_ajax_action_get_adminbrowser_page";params[1]=new Array(2);params[1][0]="code";params[1][1]=document.getElementById("wfu_adminbrowser_code").value;params[2]=new Array(2);params[2][0]="token";params[2][1]=token;params[3]=new Array(2);params[3][0]="page";params[3][1]=newpage;var parameters="";for(var i=0;i<params.length;i++)parameters+=(i>0?"&":"")+params[i][0]+"="+encodeURI(params[i][1]);document.getElementById("wfu_adminbrowser_overlay").style.display=
273
+ "block";xhr.open("POST",url,true);xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.onreadystatechange=function(){if(xhr.readyState==4)if(xhr.status==200){document.getElementById("wfu_adminbrowser_overlay").style.display="none";var start_text="wfu_adminbrowser_page_success:";var pos=xhr.responseText.indexOf(start_text);if(pos==-1)pos=xhr.responseText.length;var messages=xhr.responseText.substr(0,pos);var response=xhr.responseText.substr(pos+start_text.length,xhr.responseText.length-
274
+ pos-start_text.length);if(response!=""){response=wfu_plugin_decode_string(response);var t=document.getElementById("wfu_adminbrowser_table");t.tBodies[0].innerHTML=response;document.getElementById("wfu_select_all_visible").checked=false;wfu_adminbrowser_select_all_visible_changed();sel.selectedIndex=newpage-1;document.getElementById("wfu_adminbrowser_first_disabled").style.display=newpage==1?"inline":"none";document.getElementById("wfu_adminbrowser_prev_disabled").style.display=newpage==1?"inline":
275
+ "none";document.getElementById("wfu_adminbrowser_first").style.display=newpage==1?"none":"inline";document.getElementById("wfu_adminbrowser_prev").style.display=newpage==1?"none":"inline";document.getElementById("wfu_adminbrowser_last_disabled").style.display=newpage==sel.options.length?"inline":"none";document.getElementById("wfu_adminbrowser_next_disabled").style.display=newpage==sel.options.length?"inline":"none";document.getElementById("wfu_adminbrowser_last").style.display=newpage==sel.options.length?
276
+ "none":"inline";document.getElementById("wfu_adminbrowser_next").style.display=newpage==sel.options.length?"none":"inline"}}};xhr.send(parameters)}
277
  function wfu_cleanlog_initialize_elements(){jQuery("#wfu_cleanlog_dateold").datepicker({dateFormat:"yy-mm-dd",beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});jQuery("#wfu_cleanlog_datefrom").datepicker({dateFormat:"yy-mm-dd",beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});jQuery("#wfu_cleanlog_dateto").datepicker({dateFormat:"yy-mm-dd",
278
  beforeShow:function(){wfu_cleanlog_element_handler()},onSelect:function(){wfu_cleanlog_element_handler()},onClose:function(){wfu_cleanlog_element_handler()}});wfu_attach_element_handlers(document.getElementById("wfu_cleanlog_periodold"),wfu_cleanlog_element_handler);wfu_attach_element_handlers(document.getElementById("wfu_cleanlog_periodtype"),wfu_cleanlog_element_handler)}function wfu_cleanlog_element_handler(e){document.querySelector(".wfu_cleanlog_error").classList.add("hidden")}
279
  function wfu_cleanlog_period_changed(){var sel=document.getElementById("wfu_cleanlog_period");if(sel.selectedIndex==0){document.querySelector(".wfu_selectdate_container").style.display="block";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="none";document.getElementById("wfu_cleanlog_dateold").value="";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==
js/wordpress_file_upload_functions.js CHANGED
@@ -123,7 +123,8 @@ function wfu_get_userdata_count(sid){var WFU=GlobalData.WFU[sid];var fields_coun
123
  function wfu_lock_upload(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.textbox_exist)WFU.textbox.update("lock");if(!!WFU.uploadform_exist)WFU.uploadform.lock();if(!!WFU.subfolders_exist)WFU.subfolders.toggle(false);if(!!WFU.submit_exist)WFU.submit.toggle(false);var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].lock();wfu_Code_Objects[sid].do_action("lock_upload")}
124
  function wfu_unlock_upload(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.textbox_exist)WFU.textbox.update("unlock");if(!!WFU.uploadform_exist)WFU.uploadform.unlock();if(!!WFU.subfolders_exist)WFU.subfolders.toggle(true);if(!!WFU.submit_exist)WFU.submit.toggle(true);var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].unlock();wfu_Code_Objects[sid].do_action("unlock_upload")}
125
  function wfu_clear_files(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.uploadform_exist)WFU.uploadform.reset();if(typeof WFU.filearray!="undefined"){WFU.filearray.length=0;WFU.filearrayprops.length=0}if(!!WFU.textbox_exist)WFU.textbox.update("clear")}
126
- function wfu_clear(sid){var WFU=GlobalData.WFU[sid];wfu_clear_files(sid);if(!!WFU.subfolders_exist)WFU.subfolders.reset();var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].reset();wfu_Code_Objects[sid].do_action("clear_upload")}
 
127
  function wfu_invoke_shortcode_editor(WFU){var sid=WFU.shortcode_id;var same=0;var n=GlobalData.WFU.n;if(WFU.shortcode_tag=="wordpress_file_upload_browser")n=GlobalData.WFUB.n;for(var i=0;i<n.length;i++)if(n[i]==sid)same++;if(same==0)return;if(same>1){alert(GlobalData.consts.same_pluginid);return}var xhr=wfu_GetHttpRequestObject();if(xhr==null)return;WFU.visualeditorbutton.update("on_invoke");var url=GlobalData.consts.ajax_url;params=new Array(6);params[0]=new Array(2);params[0][0]="action";params[0][1]=
128
  "wfu_ajax_action_edit_shortcode";params[1]=new Array(2);params[1][0]="upload_id";params[1][1]=sid;params[2]=new Array(2);params[2][0]="post_id";params[2][1]=WFU.post_id;params[3]=new Array(2);params[3][0]="post_hash";params[3][1]=WFU.post_hash;params[4]=new Array(2);params[4][0]="shortcode_tag";params[4][1]=WFU.shortcode_tag;params[5]=new Array(2);params[5][0]="widget_id";params[5][1]=WFU.widgetid?WFU.widgetid:"";var parameters="";for(var i=0;i<params.length;i++)parameters+=(i>0?"&":"")+params[i][0]+
129
  "="+encodeURI(params[i][1]);xhr.open("POST",url,true);xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.onreadystatechange=function(){if(xhr.readyState==4)if(xhr.status==200){WFU.visualeditorbutton.update("on_open");var start_text="wfu_edit_shortcode:";var pos=xhr.responseText.indexOf(start_text);if(pos==-1)pos=xhr.responseText.length;var messages=xhr.responseText.substr(0,pos);var response=xhr.responseText.substr(pos+start_text.length,xhr.responseText.length-pos-start_text.length);
123
  function wfu_lock_upload(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.textbox_exist)WFU.textbox.update("lock");if(!!WFU.uploadform_exist)WFU.uploadform.lock();if(!!WFU.subfolders_exist)WFU.subfolders.toggle(false);if(!!WFU.submit_exist)WFU.submit.toggle(false);var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].lock();wfu_Code_Objects[sid].do_action("lock_upload")}
124
  function wfu_unlock_upload(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.textbox_exist)WFU.textbox.update("unlock");if(!!WFU.uploadform_exist)WFU.uploadform.unlock();if(!!WFU.subfolders_exist)WFU.subfolders.toggle(true);if(!!WFU.submit_exist)WFU.submit.toggle(true);var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].unlock();wfu_Code_Objects[sid].do_action("unlock_upload")}
125
  function wfu_clear_files(sid){var WFU=GlobalData.WFU[sid];if(!!WFU.uploadform_exist)WFU.uploadform.reset();if(typeof WFU.filearray!="undefined"){WFU.filearray.length=0;WFU.filearrayprops.length=0}if(!!WFU.textbox_exist)WFU.textbox.update("clear")}
126
+ function wfu_check_reset(sid){var WFU=GlobalData.WFU[sid];var G=GlobalData[sid];if(WFU.resetmode=="always")return true;else if(WFU.resetmode=="never")return false;else if(WFU.resetmode=="onsuccess")return[4,5,6,14].indexOf(G.upload_state)>-1;else if(WFU.resetmode=="onfullsuccess")return[4,5,14].indexOf(G.upload_state)>-1;else return true}
127
+ function wfu_clear(sid){var WFU=GlobalData.WFU[sid];var do_reset=wfu_check_reset(sid);wfu_clear_files(sid);if(do_reset){if(!!WFU.subfolders_exist)WFU.subfolders.reset();var userdata_count=wfu_get_userdata_count(sid);for(var i=0;i<userdata_count;i++)WFU.userdata.codes[i].reset()}wfu_Code_Objects[sid].do_action("clear_upload")}
128
  function wfu_invoke_shortcode_editor(WFU){var sid=WFU.shortcode_id;var same=0;var n=GlobalData.WFU.n;if(WFU.shortcode_tag=="wordpress_file_upload_browser")n=GlobalData.WFUB.n;for(var i=0;i<n.length;i++)if(n[i]==sid)same++;if(same==0)return;if(same>1){alert(GlobalData.consts.same_pluginid);return}var xhr=wfu_GetHttpRequestObject();if(xhr==null)return;WFU.visualeditorbutton.update("on_invoke");var url=GlobalData.consts.ajax_url;params=new Array(6);params[0]=new Array(2);params[0][0]="action";params[0][1]=
129
  "wfu_ajax_action_edit_shortcode";params[1]=new Array(2);params[1][0]="upload_id";params[1][1]=sid;params[2]=new Array(2);params[2][0]="post_id";params[2][1]=WFU.post_id;params[3]=new Array(2);params[3][0]="post_hash";params[3][1]=WFU.post_hash;params[4]=new Array(2);params[4][0]="shortcode_tag";params[4][1]=WFU.shortcode_tag;params[5]=new Array(2);params[5][0]="widget_id";params[5][1]=WFU.widgetid?WFU.widgetid:"";var parameters="";for(var i=0;i<params.length;i++)parameters+=(i>0?"&":"")+params[i][0]+
130
  "="+encodeURI(params[i][1]);xhr.open("POST",url,true);xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr.onreadystatechange=function(){if(xhr.readyState==4)if(xhr.status==200){WFU.visualeditorbutton.update("on_open");var start_text="wfu_edit_shortcode:";var pos=xhr.responseText.indexOf(start_text);if(pos==-1)pos=xhr.responseText.length;var messages=xhr.responseText.substr(0,pos);var response=xhr.responseText.substr(pos+start_text.length,xhr.responseText.length-pos-start_text.length);
lib/wfu_admin_browser.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function wfu_browse_files($basedir_code) {
4
  $siteurl = site_url();
5
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
6
  $user = wp_get_current_user();
@@ -59,114 +59,230 @@ function wfu_browse_files($basedir_code) {
59
  $delim_pos = strrpos($updir, '/');
60
  if ( $delim_pos !== false ) $updir = substr($updir, 0, $delim_pos + 1);
61
 
62
- $echo_str = "\n".'<div class="wrap">';
63
- $echo_str .= "\n\t".'<h2>Wordpress File Upload Control Panel</h2>';
64
- $echo_str .= "\n\t".'<div style="margin-top:20px;">';
65
- $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "File Browser");
66
- $echo_str .= "\n\t".'<div>';
67
- $echo_str .= "\n\t\t".'<span><strong>Location:</strong> </span>';
68
- foreach ( $route as $item ) {
69
- // store dir path that we need to pass to other functions in session, instead of exposing it in the url
70
- $dir_code = wfu_safe_store_filepath($item['path']);
71
- $echo_str .= '<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">'.$item['item'].'</a>';
72
- $echo_str .= '<span>/</span>';
73
- }
74
  //define referer (with sort data) to point to this url for use by the elements
75
  $referer = $siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$basedir_code;
76
  $referer_code = wfu_safe_store_filepath($referer.'[['.$sort.']]');
77
- //file browser header
78
- $echo_str .= "\n\t".'</div>';
79
- // $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.$sort.']]');
80
- // $echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=create_dir&dir='.$dir_code.'" class="button" title="create folder" style="margin-top:6px">Create folder</a>';
81
- $echo_str .= "\n\t".'<div style="margin-top:10px;">';
82
- $echo_str .= "\n\t\t".'<div class="wfu_adminbrowser_header" style="width: 100%;">';
83
- $bulkactions = array(
84
- array( "name" => "delete", "title" => "Delete" ),
85
- array( "name" => "include", "title" => "Include" )
86
- );
87
- $echo_str .= wfu_add_bulkactions_header("\n\t\t\t", "adminbrowser", $bulkactions);
88
- $echo_str .= "\n\t\t\t".'<input id="wfu_adminbrowser_action_url" type="hidden" value="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload" />';
89
- $echo_str .= "\n\t\t\t".'<input id="wfu_adminbrowser_referer" type="hidden" value="'.$referer_code.'" />';
90
- $echo_str .= "\n\t\t\t".'<input id="wfu_download_file_nonce" type="hidden" value="'.wp_create_nonce('wfu_download_file_invoker').'" />';
91
- $echo_str .= "\n\t\t\t".'<input id="wfu_include_file_nonce" type="hidden" value="'.wp_create_nonce('wfu_include_file').'" />';
92
  //define header parameters that can be later used when defining file actions
93
  $header_params = array();
94
- $echo_str .= "\n\t\t".'</div>';
95
- $echo_str .= "\n\t\t".'<table class="wp-list-table widefat fixed striped">';
96
- $echo_str .= "\n\t\t\t".'<thead>';
97
- $echo_str .= "\n\t\t\t\t".'<tr>';
98
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="5%" style="text-align:center;">';
99
- $echo_str .= "\n\t\t\t\t\t\t".'<input id="wfu_select_all_visible" type="checkbox" onchange="wfu_adminbrowser_select_all_visible_changed();" style="-webkit-appearance:checkbox;" />';
100
- $echo_str .= "\n\t\t\t\t\t".'</th>';
101
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="25%" style="text-align:left;">';
102
- $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? '-name' : 'name' ) : 'name' ).']]');
103
- $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Name'.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
104
- $echo_str .= "\n\t\t\t\t\t".'</th>';
105
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:right;">';
106
- $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? '-size' : 'size' ) : 'size' ).']]');
107
- $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Size'.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
108
- $echo_str .= "\n\t\t\t\t\t".'</th>';
109
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="20%" style="text-align:left;">';
110
- $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? '-date' : 'date' ) : 'date' ).']]');
111
- $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Date'.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
112
- $echo_str .= "\n\t\t\t\t\t".'</th>';
113
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:center;">';
114
- $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? '-user' : 'user' ) : 'user' ).']]');
115
- $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Uploaded By'.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
116
- $echo_str .= "\n\t\t\t\t\t".'</th>';
117
- $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
118
- $echo_str .= "\n\t\t\t\t\t\t".'<label>User Data</label>';
119
- $echo_str .= "\n\t\t\t\t\t".'</th>';
120
- $echo_str .= "\n\t\t\t\t".'</tr>';
121
- $echo_str .= "\n\t\t\t".'</thead>';
122
- $echo_str .= "\n\t\t\t".'<tbody>';
123
-
124
- //find contents of current folder
125
  $dirlist = array();
 
 
126
  $filelist = array();
 
 
127
  if ( $handle = opendir($basedir) ) {
128
  $blacklist = array('.', '..');
129
  while ( false !== ($file = readdir($handle)) )
130
  if ( !in_array($file, $blacklist) ) {
131
  $filepath = $basedir.$file;
132
- $stat = stat($filepath);
133
- if ( is_dir($filepath) ) {
134
- array_push($dirlist, array( 'name' => $file, 'fullpath' => $filepath, 'mdate' => $stat['mtime'] ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
- else {
137
- //find relative file record in database together with user data;
138
- //if the file is php, then file record is null meaning that the file can only be viewed
139
- //if file record is not found then the file can only be viewed
140
- if ( preg_match("/\.php$/", $filepath) ) $filerec = null;
141
- else $filerec = wfu_get_file_rec($filepath, true);
142
- //find user who uploaded the file
143
- $username = '';
144
- if ( $filerec != null ) $username = wfu_get_username_by_id($filerec->uploaduserid);
145
- array_push($filelist, array( 'name' => $file, 'fullpath' => $filepath, 'size' => $stat['size'], 'mdate' => $stat['mtime'], 'user' => $username, 'filedata' => $filerec ));
146
  }
147
  }
148
- closedir($handle);
 
149
  }
150
- $dirsort = ( substr($sort, -4) == 'date' ? 'mdate' : substr($sort, -4) );
151
- $filesort = $dirsort;
152
- $dirorder = $order;
153
- if ( $dirsort == 'size' ) { $dirsort = 'name'; $dirorder = SORT_ASC; }
154
- if ( $dirsort == 'user' ) { $dirsort = 'name'; $dirorder = SORT_ASC; }
155
- switch ( $dirsort ) {
156
- case "name": $dirsort .= ":s"; break;
157
- case "size": $dirsort .= ":n"; break;
158
- case "mdate": $dirsort .= ":n"; break;
159
- case "user": $dirsort .= ":s"; break;
160
- }
161
- $dirlist = wfu_array_sort($dirlist, $dirsort, $dirorder);
162
- switch ( $filesort ) {
163
- case "name": $filesort .= ":s"; break;
164
- case "size": $filesort .= ":n"; break;
165
- case "mdate": $filesort .= ":n"; break;
166
- case "user": $filesort .= ":s"; break;
167
- }
168
- $filelist = wfu_array_sort($filelist, $filesort, $order);
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  //show subfolders first
171
  if ( $reldir != "root/" ) {
172
  $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($updir));
@@ -282,12 +398,15 @@ function wfu_browse_files($basedir_code) {
282
  $echo_str .= "\n\t\t\t\t".'</tr>';
283
  $ii ++;
284
  }
285
- $echo_str .= "\n\t\t\t".'</tbody>';
286
- $echo_str .= "\n\t\t".'</table>';
287
- $echo_str .= "\n\t\t".'<iframe id="wfu_download_frame" style="display: none;"></iframe>';
288
- $echo_str .= "\n\t".'</div>';
289
- $echo_str .= "\n\t".'</div>';
290
- $echo_str .= "\n".'</div>';
 
 
 
291
 
292
  return $echo_str;
293
  }
1
  <?php
2
 
3
+ function wfu_browse_files($basedir_code, $page = 1, $only_table_rows = false) {
4
  $siteurl = site_url();
5
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
6
  $user = wp_get_current_user();
59
  $delim_pos = strrpos($updir, '/');
60
  if ( $delim_pos !== false ) $updir = substr($updir, 0, $delim_pos + 1);
61
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  //define referer (with sort data) to point to this url for use by the elements
63
  $referer = $siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$basedir_code;
64
  $referer_code = wfu_safe_store_filepath($referer.'[['.$sort.']]');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  //define header parameters that can be later used when defining file actions
66
  $header_params = array();
67
+
68
+ //find contents of current folder taking into account pagination, if it is
69
+ //activated; contents are found following an optimized procedure as follows:
70
+ // 1. all dirs and files are found and stored in separate arrays
71
+ // 2. if pagination is activated then it is checked if there are any dirs in
72
+ // the current page
73
+ // 3. if dir sorting is name then dirs are sorted
74
+ // 4. if dir sorting is date then stat is called for all dirs and then they
75
+ // are sorted
76
+ // 5. if pagination is activated then dirs array is sliced to keep only the
77
+ // ones belonging to the current page and then stat is called if it has
78
+ // not already been called
79
+ // 6. if there is room in the page for showing files, then files are also
80
+ // processed
81
+ // 7. if file sorting is name then files are sorted
82
+ // 8. if file sorting is date or size then stat is called for all files and
83
+ // then they are sorted
84
+ // 9. if file sorting is user then db record is retrieved for all files and
85
+ // then they are sorted
86
+ // 10. if pagination is activated then files array is sliced to keep only the
87
+ // ones fitting in the page; then stat is called and/or db record is
88
+ // retrieved
89
+ //first calculate dirs and files arrays
 
 
 
 
 
 
 
 
90
  $dirlist = array();
91
+ $dirlist_include = true;
92
+ $dirstat_ok = false;
93
  $filelist = array();
94
+ $filestat_ok = false;
95
+ $filerec_ok = false;
96
  if ( $handle = opendir($basedir) ) {
97
  $blacklist = array('.', '..');
98
  while ( false !== ($file = readdir($handle)) )
99
  if ( !in_array($file, $blacklist) ) {
100
  $filepath = $basedir.$file;
101
+ if ( is_dir($filepath) ) array_push($dirlist, array( 'name' => $file, 'fullpath' => $filepath ));
102
+ else array_push($filelist, array( 'name' => $file, 'fullpath' => $filepath ));
103
+ }
104
+ closedir($handle);
105
+ }
106
+ $dirlist_count = count($dirlist);
107
+ $filelist_count = count($filelist);
108
+ //get pagination details and determine if any dirs will be shown
109
+ $maxrows = (int)WFU_VAR("WFU_ADMINBROWSER_TABLE_MAXROWS");
110
+ $files_total = $dirlist_count + $filelist_count;
111
+ if ( $maxrows > 0 ) {
112
+ $pages = ceil($files_total / $maxrows);
113
+ if ( $page > $pages ) $page = $pages;
114
+ //if first item index passes number of dirs then do not include dirs
115
+ if ( ($page - 1) * $maxrows >= $dirlist_count ) $dirlist_include = false;
116
+ }
117
+ //process dirs if they are included in page
118
+ if ( $dirlist_include ) {
119
+ //adjust sort details
120
+ $dirsort = ( substr($sort, -4) == 'date' ? 'mdate' : substr($sort, -4) );
121
+ $dirorder = $order;
122
+ if ( $dirsort == 'size' ) { $dirsort = 'name'; $dirorder = SORT_ASC; }
123
+ if ( $dirsort == 'user' ) { $dirsort = 'name'; $dirorder = SORT_ASC; }
124
+ switch ( $dirsort ) {
125
+ case "name": $dirsort .= ":s"; break;
126
+ case "mdate": $dirsort .= ":n"; break;
127
+ }
128
+ //if dir sort is mdate then first calculate stat
129
+ if ( substr($dirsort, 0, 5) == 'mdate' ) {
130
+ foreach ( $dirlist as &$dir ) {
131
+ $stat = stat($dir['fullpath']);
132
+ $dir['mdate'] = $stat['mtime'];
133
+ }
134
+ unset($dir);
135
+ $dirstat_ok = true;
136
+ }
137
+ //sort dirs
138
+ $dirlist = wfu_array_sort($dirlist, $dirsort, $dirorder);
139
+ //if pagination is activated then slice dirs array to keep only the items
140
+ //belonging in the current page
141
+ if ( $maxrows > 0 )
142
+ $dirlist = array_slice($dirlist, ($page - 1) * $maxrows, $maxrows);
143
+ //calculate stat for the remaining dirs array, if it has not already been
144
+ //done
145
+ if ( !$dirstat_ok ) {
146
+ foreach ( $dirlist as &$dir ) {
147
+ $stat = stat($dir['fullpath']);
148
+ $dir['mdate'] = $stat['mtime'];
149
+ }
150
+ unset($dir);
151
+ }
152
+ }
153
+ else $dirlist = array();
154
+ //determine if any files will be included in page; in case pagination is
155
+ //activated then the remaining places need to be more than zero
156
+ $files_included = ( $maxrows > 0 ? ( $maxrows - count($dirlist) > 0 ) : true );
157
+ if ( $files_included ) {
158
+ //adjust sort details
159
+ $filesort = ( substr($sort, -4) == 'date' ? 'mdate' : substr($sort, -4) );
160
+ switch ( $filesort ) {
161
+ case "name": $filesort .= ":s"; break;
162
+ case "size": $filesort .= ":n"; break;
163
+ case "mdate": $filesort .= ":n"; break;
164
+ case "user": $filesort .= ":s"; break;
165
+ }
166
+ //if file sort is size or mdate then first calculate stat
167
+ if ( substr($filesort, 0, 4) == 'size' || substr($filesort, 0, 5) == 'mdate' ) {
168
+ foreach ( $filelist as &$file ) {
169
+ $stat = stat($file['fullpath']);
170
+ $file['size'] = $stat['size'];
171
+ $file['mdate'] = $stat['mtime'];
172
+ }
173
+ unset($file);
174
+ $filestat_ok = true;
175
+ }
176
+ //if file sort is user then first calculate db records
177
+ elseif ( substr($filesort, 0, 4) == 'user' ) {
178
+ foreach ( $filelist as &$file ) {
179
+ //find relative file record in database together with user data;
180
+ //if the file is php, then file record is null meaning that the file
181
+ //can only be viewed; if file record is not found then the file can
182
+ //again only be viewed
183
+ if ( preg_match("/\.php$/", $file['fullpath']) ) $filerec = null;
184
+ else $filerec = wfu_get_file_rec($file['fullpath'], true);
185
+ //find user who uploaded the file
186
+ $username = ( $filerec != null ? wfu_get_username_by_id($filerec->uploaduserid) : '' );
187
+ $file['user'] = $username;
188
+ $file['filedata'] = $filerec;
189
+ }
190
+ unset($file);
191
+ $filerec_ok = true;
192
+ }
193
+ //sort files
194
+ $filelist = wfu_array_sort($filelist, $filesort, $order);
195
+ //if pagination is activated then slice files array to keep only the items
196
+ //belonging in the current page
197
+ if ( $maxrows > 0 )
198
+ $filelist = array_slice($filelist, max(($page - 1) * $maxrows - $dirlist_count, 0), $maxrows - count($dirlist));
199
+ if ( !$filestat_ok || !$filerec_ok ) {
200
+ foreach ( $filelist as &$file ) {
201
+ if ( !$filestat_ok ) {
202
+ $stat = stat($file['fullpath']);
203
+ $file['size'] = $stat['size'];
204
+ $file['mdate'] = $stat['mtime'];
205
  }
206
+ if ( !$filerec_ok ) {
207
+ if ( preg_match("/\.php$/", $file['fullpath']) ) $filerec = null;
208
+ else $filerec = wfu_get_file_rec($file['fullpath'], true);
209
+ $username = ( $filerec != null ? wfu_get_username_by_id($filerec->uploaduserid) : '' );
210
+ $file['user'] = $username;
211
+ $file['filedata'] = $filerec;
 
 
 
 
212
  }
213
  }
214
+ unset($file);
215
+ }
216
  }
217
+ else $filelist = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
+ //start html output
220
+ $echo_str = "";
221
+ if ( !$only_table_rows ) {
222
+ $echo_str .= "\n".'<div class="wrap">';
223
+ $echo_str .= "\n\t".'<h2>Wordpress File Upload Control Panel</h2>';
224
+ $echo_str .= "\n\t".'<div style="margin-top:20px;">';
225
+ $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "File Browser");
226
+ $echo_str .= "\n\t".'<div>';
227
+ $echo_str .= "\n\t\t".'<span><strong>Location:</strong> </span>';
228
+ foreach ( $route as $item ) {
229
+ // store dir path that we need to pass to other functions in session, instead of exposing it in the url
230
+ $dir_code = wfu_safe_store_filepath($item['path']);
231
+ $echo_str .= '<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">'.$item['item'].'</a>';
232
+ $echo_str .= '<span>/</span>';
233
+ }
234
+ //file browser header
235
+ $echo_str .= "\n\t".'</div>';
236
+ // $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.$sort.']]');
237
+ // $echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=create_dir&dir='.$dir_code.'" class="button" title="create folder" style="margin-top:6px">Create folder</a>';
238
+ $echo_str .= "\n\t".'<div style="margin-top:10px; position:relative;">';
239
+ $echo_str .= wfu_add_loading_overlay("\n\t\t", "adminbrowser");
240
+ $adminbrowser_nonce = wp_create_nonce( 'wfu-adminbrowser-page' );
241
+ $echo_str .= "\n\t\t".'<div class="wfu_adminbrowser_header" style="width: 100%;">';
242
+ $bulkactions = array(
243
+ array( "name" => "delete", "title" => "Delete" ),
244
+ array( "name" => "include", "title" => "Include" )
245
+ );
246
+ $echo_str .= wfu_add_bulkactions_header("\n\t\t\t", "adminbrowser", $bulkactions);
247
+ if ( $maxrows > 0 ) {
248
+ $echo_str .= wfu_add_pagination_header("\n\t\t\t", "adminbrowser", $page, $pages, $adminbrowser_nonce);
249
+ }
250
+ $echo_str .= "\n\t\t\t".'<input id="wfu_adminbrowser_action_url" type="hidden" value="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload" />';
251
+ $echo_str .= "\n\t\t\t".'<input id="wfu_adminbrowser_code" type="hidden" value="'.$basedir_code.'" />';
252
+ $echo_str .= "\n\t\t\t".'<input id="wfu_adminbrowser_referer" type="hidden" value="'.$referer_code.'" />';
253
+ $echo_str .= "\n\t\t\t".'<input id="wfu_download_file_nonce" type="hidden" value="'.wp_create_nonce('wfu_download_file_invoker').'" />';
254
+ $echo_str .= "\n\t\t\t".'<input id="wfu_include_file_nonce" type="hidden" value="'.wp_create_nonce('wfu_include_file').'" />';
255
+ $echo_str .= "\n\t\t".'</div>';
256
+ $echo_str .= "\n\t\t".'<table id="wfu_adminbrowser_table" class="wp-list-table widefat fixed striped">';
257
+ $echo_str .= "\n\t\t\t".'<thead>';
258
+ $echo_str .= "\n\t\t\t\t".'<tr>';
259
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="5%" style="text-align:center;">';
260
+ $echo_str .= "\n\t\t\t\t\t\t".'<input id="wfu_select_all_visible" type="checkbox" onchange="wfu_adminbrowser_select_all_visible_changed();" style="-webkit-appearance:checkbox;" />';
261
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
262
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="25%" style="text-align:left;">';
263
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? '-name' : 'name' ) : 'name' ).']]');
264
+ $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Name'.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
265
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
266
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:right;">';
267
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? '-size' : 'size' ) : 'size' ).']]');
268
+ $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Size'.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
269
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
270
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="20%" style="text-align:left;">';
271
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? '-date' : 'date' ) : 'date' ).']]');
272
+ $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Date'.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
273
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
274
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:center;">';
275
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? '-user' : 'user' ) : 'user' ).']]');
276
+ $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'">Uploaded By'.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? ' &uarr;' : ' &darr;' ) : '' ).'</a>';
277
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
278
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
279
+ $echo_str .= "\n\t\t\t\t\t\t".'<label>User Data</label>';
280
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
281
+ $echo_str .= "\n\t\t\t\t".'</tr>';
282
+ $echo_str .= "\n\t\t\t".'</thead>';
283
+ $echo_str .= "\n\t\t\t".'<tbody>';
284
+ }
285
+
286
  //show subfolders first
287
  if ( $reldir != "root/" ) {
288
  $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($updir));
398
  $echo_str .= "\n\t\t\t\t".'</tr>';
399
  $ii ++;
400
  }
401
+
402
+ if ( !$only_table_rows ) {
403
+ $echo_str .= "\n\t\t\t".'</tbody>';
404
+ $echo_str .= "\n\t\t".'</table>';
405
+ $echo_str .= "\n\t\t".'<iframe id="wfu_download_frame" style="display: none;"></iframe>';
406
+ $echo_str .= "\n\t".'</div>';
407
+ $echo_str .= "\n\t".'</div>';
408
+ $echo_str .= "\n".'</div>';
409
+ }
410
 
411
  return $echo_str;
412
  }
lib/wfu_ajaxactions.php CHANGED
@@ -647,6 +647,23 @@ function wfu_ajax_action_get_historylog_page() {
647
  die(apply_filters('_wfu_ajax_action_get_historylog_page', 'wfu_historylog_page_success:'.wfu_plugin_encode_string($rows)));
648
  }
649
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
650
  function wfu_ajax_action_include_file() {
651
  $_POST = stripslashes_deep($_POST);
652
  $_GET = stripslashes_deep($_GET);
647
  die(apply_filters('_wfu_ajax_action_get_historylog_page', 'wfu_historylog_page_success:'.wfu_plugin_encode_string($rows)));
648
  }
649
 
650
+ function wfu_ajax_action_get_adminbrowser_page() {
651
+ if ( !isset($_POST['code']) || !isset($_POST['token']) || !isset($_POST['page']) ) die();
652
+
653
+ $_POST = stripslashes_deep($_POST);
654
+
655
+ check_ajax_referer( 'wfu-adminbrowser-page', 'token' );
656
+ if ( !current_user_can( 'manage_options' ) ) die();
657
+ if ( WFU_VAR("WFU_ADMINBROWSER_TABLE_MAXROWS") <= 0 ) die();
658
+
659
+ $code = wfu_sanitize_code($_POST['code']);
660
+ $page = wfu_sanitize_int($_POST['page']);
661
+ //get list of files
662
+ $rows = wfu_browse_files($code, $page, true);
663
+
664
+ die(apply_filters('_wfu_ajax_action_get_adminbrowser_page', 'wfu_adminbrowser_page_success:'.wfu_plugin_encode_string($rows)));
665
+ }
666
+
667
  function wfu_ajax_action_include_file() {
668
  $_POST = stripslashes_deep($_POST);
669
  $_GET = stripslashes_deep($_GET);
lib/wfu_attributes.php CHANGED
@@ -802,7 +802,22 @@ function wfu_attribute_definitions() {
802
  "parent" => "",
803
  "dependencies" => null,
804
  "variables" => null,
805
- "help" => "when it is activated a user can submit the upload form even if a file is not selected."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
806
  ),
807
  array(
808
  "name" => "Upload Roles",
802
  "parent" => "",
803
  "dependencies" => null,
804
  "variables" => null,
805
+ "help" => "When it is activated a user can submit the upload form even if a file is not selected."
806
+ ),
807
+ array(
808
+ "name" => "Reset Form Mode",
809
+ "attribute" => "resetmode",
810
+ "type" => "radio",
811
+ "validator" => "text",
812
+ "listitems" => array("always", "onsuccess", "never"),
813
+ "value" => WFU_VAR("WFU_RESETMODE"),
814
+ "mode" => "free",
815
+ "category" => "general",
816
+ "subcategory" => "Basic Functionalities",
817
+ "parent" => "",
818
+ "dependencies" => null,
819
+ "variables" => null,
820
+ "help" => "It defines whether the form will be reset after upload; 'always' means that it will be reset in any case, 'onsuccess' means that it will be reset only if upload was successful, 'never' means that it will never be reset."
821
  ),
822
  array(
823
  "name" => "Upload Roles",
lib/wfu_constants.php CHANGED
@@ -238,7 +238,8 @@ $GLOBALS["WFU_GLOBALS"] = array(
238
  "WFU_UPLOADPATH" => array( "Default Upload Path", "string", "uploads", "The default upload path of the uploader shortcode. It must be a folder relative to wp-content dir." ),
239
  "WFU_FITMODE" => array( "Default Fit Mode", "string", "fixed", "The default fit mode of the uploader shortcode. It can be 'fixed' or 'responsive'." ),
240
  "WFU_ALLOWNOFILE" => array( "Default Allow No File Mode", "string", "false", "The default mode for allowing no file uploads. If it is set to 'true' then an upload form can be submitted even if a file has not been selected. It can be 'true' or 'false'." ),
241
- "WFU_CREATEPATH" => array( "Default Create Path State", "string", "false", "The default create path state (create or not the upload path if it does not exist) of the uploader shortcode. It can be 'true' or 'false'." ),
 
242
  "WFU_FORCEFILENAME" => array( "Default Force Filename State", "string", "false", "The default force filename state (force plugin to leave filename unchanged) of the uploader shortcode. It can be 'true' or 'false'." ),
243
  "WFU_UPLOADPATTERNS" => array( "Default Upload Extensions", "string", "*.*", "The default allowed file extensions of the uploader shortcode. It can be a comma-separated list of wildcard extensions." ),
244
  "WFU_MAXSIZE" => array( "Default Maximum File Size", "string", "50", "The default maximum allowed file size of the uploader shortcode in Megabytes. It can be any positive number." ),
@@ -301,6 +302,7 @@ $GLOBALS["WFU_GLOBALS"] += array(
301
  "WFU_SANITIZE_FILENAME_DOTS" => array( "Sanitize Filename Dots", "string", "true", "Convert dot symbols (.) in filename into dashes, in order to avoid double extensions. It can be 'true' or 'false'." ),
302
  "WFU_WILDCARD_ASTERISK_MODE" => array( "Wildcard Asterisk Mode", "string", "strict", "The mode of wildcard pattern asterisk symbol. If it is strict, then the asterisk will not match dot (.) characters. It can be 'strict' or 'loose'." ),
303
  "WFU_PHP_ARRAY_MAXLEN" => array( "Max PHP Array Length", "string", "10000", "The maximum allowable number of items of a PHP array." ),
 
304
  "WFU_HISTORYLOG_TABLE_MAXROWS" => array( "History Log Table Rows Per Page", "integer", 25, "The number of rows per page of the History Log table." ),
305
  "WFU_ALTERNATIVE_RANDOMIZER" => array( "Use Alternative Randomizer", "string", "false", "On fast web servers the plugin's generator of random strings may not work properly causing various problems. If it is set to true, an alternative randomizer method is employed that works for fast web servers. It can be 'true' or 'false'." ),
306
  "WFU_FORCE_NOTIFICATIONS" => array( "Force Email Notifications", "string", "false", "Send email notifications (if they are activated) even if no file has been uploaded. It can be 'true' or 'false'." ),
238
  "WFU_UPLOADPATH" => array( "Default Upload Path", "string", "uploads", "The default upload path of the uploader shortcode. It must be a folder relative to wp-content dir." ),
239
  "WFU_FITMODE" => array( "Default Fit Mode", "string", "fixed", "The default fit mode of the uploader shortcode. It can be 'fixed' or 'responsive'." ),
240
  "WFU_ALLOWNOFILE" => array( "Default Allow No File Mode", "string", "false", "The default mode for allowing no file uploads. If it is set to 'true' then an upload form can be submitted even if a file has not been selected. It can be 'true' or 'false'." ),
241
+ "WFU_ALLOWNOFILE" => array( "Default Allow No File Mode", "string", "false", "The default mode for allowing no file uploads. If it is set to 'true' then an upload form can be submitted even if a file has not been selected. It can be 'true' or 'false'." ),
242
+ "WFU_RESETMODE" => array( "Default Reset Form Mode", "string", "always", "The default reset mode of the upload form. It can be 'always', 'onsuccess' or 'never'." ),
243
  "WFU_FORCEFILENAME" => array( "Default Force Filename State", "string", "false", "The default force filename state (force plugin to leave filename unchanged) of the uploader shortcode. It can be 'true' or 'false'." ),
244
  "WFU_UPLOADPATTERNS" => array( "Default Upload Extensions", "string", "*.*", "The default allowed file extensions of the uploader shortcode. It can be a comma-separated list of wildcard extensions." ),
245
  "WFU_MAXSIZE" => array( "Default Maximum File Size", "string", "50", "The default maximum allowed file size of the uploader shortcode in Megabytes. It can be any positive number." ),
302
  "WFU_SANITIZE_FILENAME_DOTS" => array( "Sanitize Filename Dots", "string", "true", "Convert dot symbols (.) in filename into dashes, in order to avoid double extensions. It can be 'true' or 'false'." ),
303
  "WFU_WILDCARD_ASTERISK_MODE" => array( "Wildcard Asterisk Mode", "string", "strict", "The mode of wildcard pattern asterisk symbol. If it is strict, then the asterisk will not match dot (.) characters. It can be 'strict' or 'loose'." ),
304
  "WFU_PHP_ARRAY_MAXLEN" => array( "Max PHP Array Length", "string", "10000", "The maximum allowable number of items of a PHP array." ),
305
+ "WFU_ADMINBROWSER_TABLE_MAXROWS" => array( "Admin Browser Rows Per Page", "integer", 25, "The number of rows per page of the admin browser. A value equal to zero or less denotes no pagination." ),
306
  "WFU_HISTORYLOG_TABLE_MAXROWS" => array( "History Log Table Rows Per Page", "integer", 25, "The number of rows per page of the History Log table." ),
307
  "WFU_ALTERNATIVE_RANDOMIZER" => array( "Use Alternative Randomizer", "string", "false", "On fast web servers the plugin's generator of random strings may not work properly causing various problems. If it is set to true, an alternative randomizer method is employed that works for fast web servers. It can be 'true' or 'false'." ),
308
  "WFU_FORCE_NOTIFICATIONS" => array( "Force Email Notifications", "string", "false", "Send email notifications (if they are activated) even if no file has been uploaded. It can be 'true' or 'false'." ),
readme.txt CHANGED
@@ -147,6 +147,10 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
147
 
148
  == Changelog ==
149
 
 
 
 
 
150
  = 4.6.0 =
151
  * corrected slash (/) parse Javascript error near 'fakepath' appearring on some situations
152
  * added nonces in Maintenance Actions to increase security
147
 
148
  == Changelog ==
149
 
150
+ = 4.6.1 =
151
+ * added uploader shortcode attribute 'resetmode' to control whether the upload form will be reset after an upload
152
+ * added pagination in File Browser tab in Dashboard area of the plugin
153
+
154
  = 4.6.0 =
155
  * corrected slash (/) parse Javascript error near 'fakepath' appearring on some situations
156
  * added nonces in Maintenance Actions to increase security
release_notes.txt CHANGED
@@ -1,9 +1,7 @@
1
- <!-- --><span>Version 4.6.0 is a significant update mainly because the <strong>Professional</strong> edition introduces integration with <strong>Google Drive</strong>, a long waited feature by many users. As regards the <strong>Free</strong> edition, the following improvements are included:
2
  <ul style="list-style: disc; padding-left: 30px;">
3
- <li>Improved code in <strong>View Log</strong> so that no links appear to invalid files.</li>
4
- <li>Improved code in <strong>View Log</strong> so that when the admin opens a file link to view file details, 'go back' button will lead back to the View Log page and not to File Browser.</li>
5
- <li>Improved code in <strong>Clean Log</strong> button in <strong>Maintenance Actions</strong> so that the admin can select the period of clean-up.</li>
6
  </ul>
7
- Furthermore this version includes some bug fixes and security improvements.<br /><br />
8
- For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span><!-- -->
9
- <!-- -->
1
+ <span>Version 4.6.1 is a regular update bringing two new features:
2
  <ul style="list-style: disc; padding-left: 30px;">
3
+ <li>Added uploader shortcode attribute <strong>resetmode</strong> to control whether the upload form will be reset after an upload.</li>
4
+ <li>Added <strong>pagination</strong> in <strong>File Browser</strong> feature in Dashboard area of the plugin.</li>
 
5
  </ul>
6
+ <br />
7
+ For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span>
 
wordpress_file_upload.php CHANGED
@@ -4,7 +4,7 @@ if( !session_id() ) { session_start(); }
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
- Version: 4.6.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -78,6 +78,7 @@ add_action('wp_ajax_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_dow
78
  add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
79
  add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
80
  add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
 
81
  add_action('wp_ajax_wfu_ajax_action_include_file', 'wfu_ajax_action_include_file');
82
  add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
83
  add_action('wp_ajax_wfu_ajax_action_transfer_command', 'wfu_ajax_action_transfer_command');
@@ -396,6 +397,7 @@ function wordpress_file_upload_function($incomingfromhandler) {
396
  //set some more parameters for the initialization script
397
  $init_params["is_formupload"] = ( $params['forceclassic'] == "true" );
398
  $init_params["singlebutton"] = ( $params["singlebutton"] == "true" );
 
399
 
400
  //output css styling rules
401
  if ( $css != "" ) {
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 4.6.1
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
78
  add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
79
  add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
80
  add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
81
+ add_action('wp_ajax_wfu_ajax_action_get_adminbrowser_page', 'wfu_ajax_action_get_adminbrowser_page');
82
  add_action('wp_ajax_wfu_ajax_action_include_file', 'wfu_ajax_action_include_file');
83
  add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
84
  add_action('wp_ajax_wfu_ajax_action_transfer_command', 'wfu_ajax_action_transfer_command');
397
  //set some more parameters for the initialization script
398
  $init_params["is_formupload"] = ( $params['forceclassic'] == "true" );
399
  $init_params["singlebutton"] = ( $params["singlebutton"] == "true" );
400
+ $init_params["resetmode"] = $params["resetmode"];
401
 
402
  //output css styling rules
403
  if ( $css != "" ) {