WordPress File Upload - Version 3.9.3

Version Description

  • added option to allow loading of plugin's styles and scripts on the front-end only for specific posts/pages through wfu_before_frontpage_scripts filter
  • fixed bug where when uploading big files with identical filenames and 'maintain both' option, not all would be saved separately
  • two advanced variables were added to let the admin change the export function separators
Download this release

Release Info

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

Code changes from version 3.9.2 to 3.9.3

lib/wfu_constants.php CHANGED
@@ -280,7 +280,9 @@ $GLOBALS["WFU_GLOBALS"] += array(
280
  "WFU_DASHBOARD_PROTECTED" => array( "Dashboard Is Protected", "string", "false", "If /wp-admin folder is password protected then this variable should be set to 'true' so that internal operations of the plugin can work. The username and password should also be set." ),
281
  "WFU_DASHBOARD_USERNAME" => array( "Protected Dashboard Username", "string", "", "Username entry for accessing protected /wp-admin folder." ),
282
  "WFU_DASHBOARD_PASSWORD" => array( "Protected Dashboard Password", "string", "", "Password entry for accessing protected /wp-admin folder." ),
283
- "WFU_DISABLE_VERSION_CHECK" => array( "Disable Version Check", "string", "false", "If it is set to 'true' then the plugin will not check if there are any new versions available. This is a temporary solution to problems having some users accessing Iptanus Services server causing the plugin to stall. It can be 'true' or 'false'." )
 
 
284
  );
285
  //color definitions
286
  $GLOBALS["WFU_GLOBALS"] += array(
280
  "WFU_DASHBOARD_PROTECTED" => array( "Dashboard Is Protected", "string", "false", "If /wp-admin folder is password protected then this variable should be set to 'true' so that internal operations of the plugin can work. The username and password should also be set." ),
281
  "WFU_DASHBOARD_USERNAME" => array( "Protected Dashboard Username", "string", "", "Username entry for accessing protected /wp-admin folder." ),
282
  "WFU_DASHBOARD_PASSWORD" => array( "Protected Dashboard Password", "string", "", "Password entry for accessing protected /wp-admin folder." ),
283
+ "WFU_DISABLE_VERSION_CHECK" => array( "Disable Version Check", "string", "false", "If it is set to 'true' then the plugin will not check if there are any new versions available. This is a temporary solution to problems having some users accessing Iptanus Services server causing the plugin to stall. It can be 'true' or 'false'." ),
284
+ "WFU_EXPORT_DATA_SEPARATOR" => array( "Export Data Separator", "string", ",", "This is the delimiter of the exported file data columns. It can be any symbol. Default value is comma (,)." ),
285
+ "WFU_EXPORT_USERDATA_SEPARATOR" => array( "Export User Data Separator", "string", ";", "This is the delimiter of the exported user data of each file. It can be any symbol. Default value is semicolon (;)." )
286
  );
287
  //color definitions
288
  $GLOBALS["WFU_GLOBALS"] += array(
lib/wfu_functions.php CHANGED
@@ -792,6 +792,12 @@ function wfu_human_filesize($size, $unit = "") {
792
  return number_format($size)." bytes";
793
  }
794
 
 
 
 
 
 
 
795
  //********************* User Functions *****************************************************************************************************
796
 
797
  function wfu_get_user_role($user, $param_roles) {
@@ -1410,9 +1416,11 @@ function wfu_export_uploaded_files($params) {
1410
  $table_name1 = $wpdb->prefix . "wfu_log";
1411
  $table_name2 = $wpdb->prefix . "wfu_userdata";
1412
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
 
 
1413
 
1414
  $contents = "";
1415
- $header = "Name,Path,Upload User,Upload Time,Size,Page ID,Blog ID,Shortcode ID,Upload ID,User Data";
1416
  $contents = $header;
1417
  $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action <> \'other\' AND date_to = 0');
1418
  foreach( $filerecs as $filerec ) {
@@ -1434,20 +1442,20 @@ function wfu_export_uploaded_files($params) {
1434
  $username = wfu_get_username_by_id($filerec->uploaduserid);
1435
  $filerec->userdata = $wpdb->get_results('SELECT * FROM '.$table_name2.' WHERE uploadid = \''.$filerec->uploadid.'\' AND date_to = 0');
1436
  $line = wfu_basename($filerec->filepath);
1437
- $line .= ",".wfu_basedir($filerec->filepath);
1438
- $line .= ",".$username;
1439
- $line .= ",".( $filerec->uploadtime == null ? "" : date("Y-m-d H:i:s", $filerec->uploadtime) );
1440
- $line .= ",".$filerec->filesize;
1441
- $line .= ",".( $filerec->pageid == null ? "" : $filerec->pageid );
1442
- $line .= ",".( $filerec->blogid == null ? "" : $filerec->blogid );
1443
- $line .= ",".( $filerec->sid == null ? "" : $filerec->sid );
1444
- $line .= ",".$filerec->uploadid;
1445
  $line2 = "";
1446
  foreach ( $filerec->userdata as $userdata ) {
1447
- if ( $line2 != "" ) $line2 .= ";";
1448
  $line2 .= $userdata->property.":".str_replace(array("\n", "\r", "\r\n"), " ", $userdata->propvalue);
1449
  }
1450
- $line .= ",".$line2;
1451
  $contents .= "\n".$line;
1452
  }
1453
  }
792
  return number_format($size)." bytes";
793
  }
794
 
795
+ function wfu_file_exists($path) {
796
+ if ( file_exists($path) ) return true;
797
+
798
+ return false;
799
+ }
800
+
801
  //********************* User Functions *****************************************************************************************************
802
 
803
  function wfu_get_user_role($user, $param_roles) {
1416
  $table_name1 = $wpdb->prefix . "wfu_log";
1417
  $table_name2 = $wpdb->prefix . "wfu_userdata";
1418
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1419
+ $sep = WFU_VAR("WFU_EXPORT_DATA_SEPARATOR");
1420
+ $sep2 = WFU_VAR("WFU_EXPORT_USERDATA_SEPARATOR");
1421
 
1422
  $contents = "";
1423
+ $header = 'Name'.$sep.'Path'.$sep.'Upload User'.$sep.'Upload Time'.$sep.'Size'.$sep.'Page ID'.$sep.'Blog ID'.$sep.'Shortcode ID'.$sep.'Upload ID'.$sep.'User Data';
1424
  $contents = $header;
1425
  $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action <> \'other\' AND date_to = 0');
1426
  foreach( $filerecs as $filerec ) {
1442
  $username = wfu_get_username_by_id($filerec->uploaduserid);
1443
  $filerec->userdata = $wpdb->get_results('SELECT * FROM '.$table_name2.' WHERE uploadid = \''.$filerec->uploadid.'\' AND date_to = 0');
1444
  $line = wfu_basename($filerec->filepath);
1445
+ $line .= $sep.wfu_basedir($filerec->filepath);
1446
+ $line .= $sep.$username;
1447
+ $line .= $sep.( $filerec->uploadtime == null ? "" : date("Y-m-d H:i:s", $filerec->uploadtime) );
1448
+ $line .= $sep.$filerec->filesize;
1449
+ $line .= $sep.( $filerec->pageid == null ? "" : $filerec->pageid );
1450
+ $line .= $sep.( $filerec->blogid == null ? "" : $filerec->blogid );
1451
+ $line .= $sep.( $filerec->sid == null ? "" : $filerec->sid );
1452
+ $line .= $sep.$filerec->uploadid;
1453
  $line2 = "";
1454
  foreach ( $filerec->userdata as $userdata ) {
1455
+ if ( $line2 != "" ) $line2 .= $sep2;
1456
  $line2 .= $userdata->property.":".str_replace(array("\n", "\r", "\r\n"), " ", $userdata->propvalue);
1457
  }
1458
+ $line .= $sep.$line2;
1459
  $contents .= "\n".$line;
1460
  }
1461
  }
lib/wfu_processfiles.php CHANGED
@@ -356,7 +356,7 @@ function wfu_process_files($params, $method) {
356
  $file_copied = false;
357
 
358
  if ($source_path) {
359
- $file_exists = file_exists($target_path);
360
  if ( !$file_exists || $params["duplicatespolicy"] == "" || $params["duplicatespolicy"] == "overwrite" ) {
361
  //redirect echo in internal buffer to receive and process any unwanted warning messages from wfu_upload_file
362
  ob_start();
@@ -410,7 +410,7 @@ function wfu_process_files($params, $method) {
410
  $only_filename = $name_part . "(" . $unique_ind . ")" . $ext_part;
411
  $target_path = $full_path . $only_filename;
412
  }
413
- while ( file_exists($target_path) );
414
  }
415
  else {
416
  $current_datetime = gmdate("U") - 1;
@@ -419,7 +419,7 @@ function wfu_process_files($params, $method) {
419
  $only_filename = $name_part . "-" . gmdate("YmdHis", $current_datetime) . $ext_part;
420
  $target_path = $full_path . $only_filename;
421
  }
422
- while ( file_exists($target_path) );
423
  }
424
  //redirect echo in internal buffer to receive and process any unwanted warning messages from move_uploaded_file
425
  ob_start();
356
  $file_copied = false;
357
 
358
  if ($source_path) {
359
+ $file_exists = wfu_file_exists($target_path);
360
  if ( !$file_exists || $params["duplicatespolicy"] == "" || $params["duplicatespolicy"] == "overwrite" ) {
361
  //redirect echo in internal buffer to receive and process any unwanted warning messages from wfu_upload_file
362
  ob_start();
410
  $only_filename = $name_part . "(" . $unique_ind . ")" . $ext_part;
411
  $target_path = $full_path . $only_filename;
412
  }
413
+ while ( wfu_file_exists($target_path) );
414
  }
415
  else {
416
  $current_datetime = gmdate("U") - 1;
419
  $only_filename = $name_part . "-" . gmdate("YmdHis", $current_datetime) . $ext_part;
420
  $target_path = $full_path . $only_filename;
421
  }
422
+ while ( wfu_file_exists($target_path) );
423
  }
424
  //redirect echo in internal buffer to receive and process any unwanted warning messages from move_uploaded_file
425
  ob_start();
readme.txt CHANGED
@@ -138,6 +138,11 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
138
 
139
  == Changelog ==
140
 
 
 
 
 
 
141
  = 3.9.2 =
142
  * added environment variable to enable or disable version check, due to access problems of some users to Iptanus Services server
143
  * added timeout option to wfu_post_request function
@@ -618,6 +623,9 @@ Initial version.
618
 
619
  == Upgrade Notice ==
620
 
 
 
 
621
  = 3.9.2 =
622
  Significant update to improve a temporary fix to an important problem and fix some minor bugs.
623
 
138
 
139
  == Changelog ==
140
 
141
+ = 3.9.3 =
142
+ * added option to allow loading of plugin's styles and scripts on the front-end only for specific posts/pages through wfu_before_frontpage_scripts filter
143
+ * fixed bug where when uploading big files with identical filenames and 'maintain both' option, not all would be saved separately
144
+ * two advanced variables were added to let the admin change the export function separators
145
+
146
  = 3.9.2 =
147
  * added environment variable to enable or disable version check, due to access problems of some users to Iptanus Services server
148
  * added timeout option to wfu_post_request function
623
 
624
  == Upgrade Notice ==
625
 
626
+ = 3.9.3 =
627
+ Update to introduce some new features and fix some bugs.
628
+
629
  = 3.9.2 =
630
  Significant update to improve a temporary fix to an important problem and fix some minor bugs.
631
 
release_notes.txt CHANGED
@@ -1,3 +1,3 @@
1
- <span><strong>Latest release notes: </strong>This release provides an improved fix to an issue that appeared some days ago. </span><span style="text-decoration: underline;">Some users face large delays opening the Main page of the plugin in Dashboard.</span><span> This is caused by problems accessing Iptanus Secure Services server. Efforts are being made to resolve the problem and issue a permanent solution. In the meantime, <strong>this release contains a temporary fix for users having this problem</strong>. The maximum delay is adjusted to 10 seconds. Furthermore, an environment variable has been added, <strong>Disable Version Check</strong>, that enables/disables version check of the plugin. When this variable is set to 'true' then no version check will be performed, however there will be no delays when opening Main page of the plugin in Dashboard. It is set to 'false' by default.</span><br /><br /><span>
2
 
3
  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>
1
+ <span><strong>Latest release notes: </strong>This is a regular release that introduces some new features and fixes some bugs. The filter <strong>wfu_before_frontpage_scripts</strong> has been improved so that frontpage scripts and styles of the plugin can be loaded only when it is necessary. This means that pages that do not contain the plugin shortcodes will not be overloaded with unnecessary code. Furthermore, the <strong>export</strong> function of the plugin, which creates a text file with uploaded file data, has been improved so that the delimeter character separating data between them can be altered.</span><br /><br /><span>
2
 
3
  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: 3.9.2
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -98,6 +98,8 @@ function wfu_enqueue_frontpage_scripts() {
98
  //apply wfu_before_frontpage_scripts to get additional settings
99
  $changable_data = array();
100
  $ret_data = apply_filters('wfu_before_frontpage_scripts', $changable_data);
 
 
101
 
102
  if ( $relaxcss ) {
103
  wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_relaxed.css',false,'1.0','all');
4
  /*
5
  Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
  Description: Simple interface to upload files from a page.
7
+ Version: 3.9.3
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
98
  //apply wfu_before_frontpage_scripts to get additional settings
99
  $changable_data = array();
100
  $ret_data = apply_filters('wfu_before_frontpage_scripts', $changable_data);
101
+ //if $ret_data contains 'return_value' key then no scripts will be enqueued
102
+ if ( isset($ret_data['return_value']) ) return $ret_data['return_value'];
103
 
104
  if ( $relaxcss ) {
105
  wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_relaxed.css',false,'1.0','all');