WordPress File Upload - Version 3.1.0

Version Description

  • an important feature (front-end file browser) has been added in professional version 3.1.0
  • added port number support for uploads using ftp mode
  • corrected bug that was not showing correctly in file browser files that were uploaded using ftp mode
  • eliminated confirmbox warning showing in page when website's DEBUG mode is ON
  • eliminated warning: "Invalid argument supplied for foreach() in ...plugins/wordpress-file-upload-pro/lib/wfu_admin.php on line 384"
  • eliminated warning: "Notice: Undefined index: postmethod in /var/www/wordpress/wp-content/plugins/wordpress-file-upload-pro/lib/wfu_functions.php on line 1348"
  • eliminated warnings in plugin's settings in Dashboard
Download this release

Release Info

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

Code changes from version 3.0.0 to 3.1.0

css/wordpress_file_upload_adminstyle.css CHANGED
@@ -1 +1 @@
1
- div.wfu_shortcode_container{display:inline-block;position:relative;width:50%;padding:0;margin:0;background:0 0;border:none}textarea.wfu_shortcode{width:100%}div.wfu_container{margin-top:10px}div.wfu_help_container{display:inline-block;position:relative;top:4px;padding:0;margin:0;background:0 0;border:none}div.wfu_help_container img{visibility:hidden}table.wfu_inner_table th:hover div.wfu_help_container img,table.wfu_main_table th:hover div.wfu_help_container img{visibility:visible}div.wfu_restore_container{display:inline-block;position:relative;top:4px;padding:0;margin:0;background:0 0;border:none}div.wfu_restore_container img{visibility:hidden}table.wfu_inner_table th:hover div.wfu_restore_container img,table.wfu_main_table th:hover div.wfu_restore_container img{visibility:visible}div.wfu_td_div{display:block;position:relative;width:100%;height:100%;padding:0;margin:0;background:0 0;border:none}div.wfu_container input.wfu_long_text{width:100%}div.wfu_container input.wfu_short_text{width:60px}div.wfu_container input{width:200px}div.wfu_container input[type=checkbox]{width:auto}table.wfu_main_table{table-layout:fixed}table.wfu_main_table tr:nth-child(odd){background-color:#f4f4f4}table.wfu_main_table table.wfu_inner_table tr,table.wfu_main_table tr:nth-child(even){background-color:transparent}table.wfu_main_table th{width:17%}table.wfu_main_table td:nth-child(2){width:33%}table.wfu_main_table td:nth-child(3){width:50%}table.wfu_main_table table.wfu_inner_table th{width:34%}table.wfu_main_table table.wfu_inner_table td:nth-child(2){width:66%}table.wfu_main_table tr.wfu_subcategory{background-color:#ddd}table.wfu_main_table tr.wfu_subcategory>th{padding-top:0;padding-bottom:0}select.wfu_variable{padding:0;margin:0;height:auto;font-size:smaller;background-color:#ddd;border:1px solid #ccc;color:#333;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}span.wfu_variable{padding:1px;margin:0;font-size:smaller;background-color:#ddd;border:1px solid #ccc;color:#333;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}span.wfu_ptext_span{display:inline-block;width:60px}select.wfu_select_folders{height:auto;min-width:75%}select.wfu_select_folders_empty{font-style:italic;color:silver}div.wfu_subfolders_inner_shadow{position:absolute;width:100%;height:100%;padding:0;margin:0;border:none;background-color:rgba(255,255,255,.8)}option.wfu_select_folders_option_default{color:#00f}div.wfu_subfolder_nav_container{width:40px;margin:0;padding:0;border:none;background:0 0;display:inline-block;vertical-align:top}table.wfu_subfolder_nav{table-layout:fixed;width:100%;margin:0;padding:0;border:none;background:0 0;border-spacing:1px}table.wfu_subfolder_nav tr{margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_nav td{margin:0;padding:0;border:none;background:0 0;font-size:small;line-height:1;text-align:center}table.wfu_subfolder_nav button.button{margin:0;padding:0;width:17px;font-size:smaller;height:18px;line-height:1;color:#000;font-weight:700}table.wfu_subfolder_nav button.button:disabled{color:silver}.button.wfu_subfolder_nav_pressed,.button.wfu_subfolder_nav_pressed:focus,.button.wfu_subfolder_nav_pressed:hover{background:#4169e1}div.wfu_subfolder_tools_container{width:75%;margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_tools{table-layout:fixed;width:100%;margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_tools tr{margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_tools td{margin:0;padding:0;border:none;background:0 0;font-size:smaller}table.wfu_subfolder_tools td div{margin:0;padding:0;border:none;background:0 0;position:relative}table.wfu_subfolder_tools label{display:block;padding:0;margin:0;line-height:1}table.wfu_subfolder_tools input{width:100%;padding:0;margin:0}table.wfu_subfolder_tools input:disabled{width:100%;padding:0;margin:0;color:silver}table.wfu_subfolder_tools button.button{margin:0;padding:1px 0 0;width:17px;font-size:smaller;height:17px;line-height:1;position:absolute;bottom:2px}table.wfu_subfolder_tools button.button:disabled{color:silver}table.wfu_subfolder_tools button.button:disabled img{opacity:.4}.wfu_subfolder_tools_disabled{color:silver}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container{position:absolute;width:150px;height:150px;margin:0;padding:0;z-index:100;border:1px solid silver;box-shadow:1px 1px 2px;background-color:#fff;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container table{table-layout:fixed;width:100%;height:100%;border:none;background:#eee;margin:0;padding:0;border-spacing:0;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container tr{border:none;background:0 0;margin:0;padding:0;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td{border:none;background:0 0;margin:0;padding:2px;line-height:0;overflow:hidden;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div{position:relative;border:none;background:0 0;margin:0;padding:0;width:100%;height:100%;display:inline-block;line-height:1}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div button.button{font-size:inherit;line-height:1;height:17px;padding:4px;position:relative;width:auto;margin:0;bottom:auto}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container select{width:100%;height:100%;top:0;bottom:0;position:absolute;margin:0}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container label{color:#222;font-weight:700;position:absolute;top:0;bottom:0;height:10px;margin:auto}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div button.button.wfu_folder_browser_cancel{width:17px;height:17px;position:absolute;right:0;top:0;margin:0;padding:0}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container{position:absolute;width:100%;height:100%;top:0;bottom:0;margin:0;padding:0;background-color:rgba(255,255,255,.9);text-align:center}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container label{position:relative;display:block}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container img{position:relative}.button.wfu_folder_browser_cancel img{vertical-align:top;margin-top:2px}div.wfu_mchecklist_container{display:inline-block;border:1px solid #ddd;border-radius:4px;padding:4px}div.wfu_mchecklist_item{display:inline-block}div.wfu_mchecklist_item label{vertical-align:baseline;margin-left:4px;cursor:default}div.wfu_mchecklist_item input:disabled+label{color:gray}div.wfu_mchecklist_item div{margin-left:4px}div.wfu_mchecklist_item:hover img{visibility:visible}div.wfu_mchecklist_checkall,div.wfu_rolelist_checkall{display:inline-block;vertical-align:top;margin:0 0 0 10px}table.wfu_userlist_container{border:none;background:0 0;margin:0;padding:0;border-spacing:0}table.wfu_userlist_container tr:nth-child(odd){border:none;background:0 0;margin:0;padding:0}table.wfu_userlist_container td{width:1%;border:none;background:0 0;margin:0;padding:0;vertical-align:top}div.wfu_userlist_checkall{display:inline-block;vertical-align:top;margin:0 0 0 10px}div.wfu_shadow{position:absolute;width:100%;height:100%;left:0;top:0;margin:0;padding:0;background-color:#fff;z-index:10;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";filter:alpha(opacity=60);-moz-opacity:.6;-khtml-opacity:.6;opacity:.6}table.wfu_main_table tr:nth-child(odd) div.wfu_shadow{background-color:#f4f4f4}div.wfu_onoff_container_off,div.wfu_onoff_container_on{display:inline-block;position:relative;padding:2px;border:1px solid #aaa;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;background:#066dab;background:-moz-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(6,109,171,1)),color-stop(100%,rgba(197,222,234,1)));background:-webkit-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-o-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-ms-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:linear-gradient(to bottom,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#066dab', endColorstr='#c5deea', GradientType=0)}span.wfu_onoff_text{width:30px;display:inline-block;text-align:center;color:#FFF}div.wfu_onoff_slider{position:absolute;margin:0;width:31px;top:0;bottom:0;border:1px solid #fff;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;-moz-box-shadow:0 0 2px;-webkit-box-shadow:0 0 2px;box-shadow:0 0 2px;background:#ccc;background:-moz-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(204,204,204,1)),color-stop(100%,rgba(255,255,255,1)));background:-webkit-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-o-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-ms-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:linear-gradient(to bottom,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#ffffff', GradientType=0)}div.wfu_onoff_container_on div.wfu_onoff_slider{left:50%}div.wfu_onoff_container_off div.wfu_onoff_slider{left:0}@-webkit-keyframes set_on{from{left:0}to{left:50%}}@-moz-keyframes set_on{from{left:0}to{left:50%}}@-o-keyframes set_on{from{left:0}to{left:50%}}@keyframes set_on{from{left:0}to{left:50%}}div.wfu_placements_wrapper{display:block;position:relative;margin:0;padding:0;background:0 0;border:none}div.wfu_placements_container{display:inline-block;position:relative;width:100%;height:300px;background-color:#fff;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;padding:0;overflow:scroll;font-size:0;line-height:0;white-space:nowrap}div.wfu_componentlist_container{display:inline-block;position:absolute;width:auto;height:auto;top:0;left:100%;background:0 0;border:none;margin:0 0 0 20px;padding:0;z-index:1;white-space:nowrap}div.wfu_component_box_container{display:inline-block;position:relative;width:80px;height:30px;background-color:transparent;border:1px solid transparent;padding:4px;margin:0;cursor:default}div.wfu_component_box_base{display:block;position:absolute;width:80px;height:30px;left:-1px;top:-1px;background-color:#ddd;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;padding:4px;cursor:default;font-size:12px;line-height:1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4;white-space:normal}div.wfu_component_box{display:inline-block;position:relative;width:80px;height:30px;background-color:#ddd;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;padding:4px;cursor:default;font-size:12px;line-height:1;z-index:1;white-space:normal}div.wfu_inbase{display:block;position:absolute;left:-1px;top:-1px}div.wfu_component_box:hover{background-color:#eee;border:1px solid #bbb}div.wfu_component_box_selected{background-color:#aaa;border:1px solid #bbb}div.wfu_component_box_dragged{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4}div.wfu_component_separator_ver{display:inline-block;position:relative;width:8px;height:26px;background-color:transparent;border:1px solid transparent;margin:6px -8px;padding:0 8px;cursor:default;z-index:1}div.wfu_component_separator_hor{display:block;position:relative;width:100%;height:8px;background-color:transparent;border:1px solid transparent;margin:-8px 0;padding:8px 0;cursor:default;z-index:1}div.wfu_component_bar_hor{position:absolute;width:auto;height:4px;left:10px;right:0;background-color:silver;border:none;margin:11px 0 0;padding:0;display:none}div.wfu_component_bar_ver{position:absolute;width:4px;height:40px;background-color:silver;border:none;margin:-6px 0 0 11px;padding:0;display:none}div.wfu_componentlist_dragdrop{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#f8f8f8;border:4px dashed #aaa;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;z-index:2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7}div.wfu_componentlist_dragdrop_dragover{border:4px dashed #555}div.wfu_userdata_container{display:block;position:relative;width:100%;height:100%;padding:0;margin:0;background:0 0;border:none}div.wfu_userdata_action{display:inline-block;position:relative;top:2px;width:16px;height:16px;padding:0;margin:0;background:0 0;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_userdata_action:hover{border:1px solid #aaa}div.wfu_userdata_action.wfu_userdata_action_disabled:hover{border:1px solid transparent}div.wfu_userdata_action>img{width:12px;height:12px}div.wfu_userdata_action_disabled>img{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4}div.wfu_userdata_line{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap}div.wfu_color_container{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap;z-index:1}input[type=text].wp-color-picker{width:75px}input[type=button].wp-picker-clear{width:62px}span.wfu_save_label{background-color:#f0f8ff;color:#32cd32;border-radius:6px;padding:1px 2px;box-shadow:1px 1px 1px;font-size:smaller;opacity:0}span.wfu_save_label_fail{background-color:beige;color:#f08080;border-radius:6px;padding:1px 2px;box-shadow:1px 1px 1px;font-size:smaller;opacity:0}div.wfu_global_dialog_container{position:fixed;width:100%;height:100%;top:0;left:0;margin:0;padding:0;border:none;background:0 0;z-index:1;display:none}
1
+ div.wfu_help_container,div.wfu_restore_container{display:inline-block;top:4px}div.wfu_shortcode_container{display:inline-block;position:relative;width:50%;padding:0;margin:0;background:0 0;border:none}div.wfu_container input.wfu_long_text,textarea.wfu_shortcode{width:100%}div.wfu_container{margin-top:10px}div.wfu_help_container,div.wfu_restore_container,div.wfu_td_div{padding:0;position:relative;margin:0;background:0 0;border:none}div.wfu_help_container img{visibility:hidden}table.wfu_inner_table th:hover div.wfu_help_container img,table.wfu_main_table th:hover div.wfu_help_container img{visibility:visible}div.wfu_restore_container img{visibility:hidden}div.wfu_mchecklist_item:hover img,table.wfu_inner_table th:hover div.wfu_restore_container img,table.wfu_main_table th:hover div.wfu_restore_container img{visibility:visible}div.wfu_td_div{display:block;width:100%;height:100%}div.wfu_container input.wfu_short_text{width:60px}div.wfu_container input{width:200px}div.wfu_container input[type=checkbox]{width:auto}table.wfu_main_table{table-layout:fixed}table.wfu_main_table tr:nth-child(odd){background-color:#f4f4f4}table.wfu_main_table table.wfu_inner_table tr,table.wfu_main_table tr:nth-child(even){background-color:transparent}table.wfu_main_table th{width:17%}table.wfu_main_table td:nth-child(2){width:33%}table.wfu_main_table td:nth-child(3){width:50%}table.wfu_main_table table.wfu_inner_table th{width:34%}table.wfu_main_table table.wfu_inner_table td:nth-child(2){width:66%}table.wfu_main_table tr.wfu_subcategory{background-color:#ddd}table.wfu_main_table tr.wfu_subcategory>th{padding-top:0;padding-bottom:0}select.wfu_variable{padding:0;height:auto;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;user-select:none;cursor:default}select.wfu_variable,span.wfu_variable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;margin:0;font-size:smaller;background-color:#ddd;border:1px solid #ccc;color:#333}span.wfu_variable{padding:1px;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;user-select:none;cursor:default}span.wfu_ptext_span{display:inline-block;width:60px}select.wfu_select_folders{height:auto;min-width:75%}select.wfu_select_folders_empty{font-style:italic;color:silver}div.wfu_subfolders_inner_shadow{position:absolute;width:100%;height:100%;padding:0;margin:0;border:none;background-color:rgba(255,255,255,.8)}div.wfu_subfolder_nav_container,table.wfu_subfolder_nav,table.wfu_subfolder_nav td,table.wfu_subfolder_nav tr{border:none;margin:0;padding:0;background:0 0}option.wfu_select_folders_option_default{color:#00f}div.wfu_subfolder_nav_container{width:40px;display:inline-block;vertical-align:top}table.wfu_subfolder_nav{table-layout:fixed;width:100%;border-spacing:1px}table.wfu_subfolder_nav td{font-size:small;line-height:1;text-align:center}table.wfu_subfolder_nav button.button{margin:0;padding:0;width:17px;font-size:smaller;height:18px;line-height:1;color:#000;font-weight:700}.wfu_subfolder_tools_disabled,table.wfu_subfolder_nav button.button:disabled,table.wfu_subfolder_tools button.button:disabled{color:silver}.button.wfu_subfolder_nav_pressed,.button.wfu_subfolder_nav_pressed:focus,.button.wfu_subfolder_nav_pressed:hover{background:#4169e1}div.wfu_subfolder_tools_container{width:75%;margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_tools,table.wfu_subfolder_tools input{margin:0;width:100%;padding:0}table.wfu_subfolder_tools{table-layout:fixed;border:none;background:0 0}table.wfu_subfolder_tools tr{margin:0;padding:0;border:none;background:0 0}table.wfu_subfolder_tools td{margin:0;padding:0;border:none;background:0 0;font-size:smaller}table.wfu_subfolder_tools td div{margin:0;padding:0;border:none;background:0 0;position:relative}table.wfu_subfolder_tools label{display:block;padding:0;margin:0;line-height:1}table.wfu_subfolder_tools input:disabled{width:100%;padding:0;margin:0;color:silver}table.wfu_subfolder_tools button.button{margin:0;padding:1px 0 0;width:17px;font-size:smaller;height:17px;line-height:1;position:absolute;bottom:2px}table.wfu_subfolder_tools button.button:disabled img{opacity:.4}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container{position:absolute;width:150px;height:150px;margin:0;padding:0;z-index:100;border:1px solid silver;box-shadow:1px 1px 2px;background-color:#fff;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container table{table-layout:fixed;width:100%;height:100%;border:none;background:#eee;margin:0;padding:0;border-spacing:0;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container tr{border:none;background:0 0;margin:0;padding:0;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td{border:none;background:0 0;margin:0;padding:2px;line-height:0;overflow:hidden;font-size:inherit}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div{position:relative;border:none;background:0 0;margin:0;padding:0;width:100%;height:100%;display:inline-block;line-height:1}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div button.button{font-size:inherit;line-height:1;height:17px;padding:4px;position:relative;width:auto;margin:0;bottom:auto}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container select{width:100%;height:100%;top:0;bottom:0;position:absolute;margin:0}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container label{color:#222;font-weight:700;position:absolute;top:0;bottom:0;height:10px;margin:auto}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div button.button.wfu_folder_browser_cancel{width:17px;height:17px;position:absolute;right:0;top:0;margin:0;padding:0}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container{position:absolute;width:100%;height:100%;top:0;bottom:0;margin:0;padding:0;background-color:rgba(255,255,255,.9);text-align:center}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container label{position:relative;display:block}table.wfu_subfolder_tools td div.wfu_subfolders_browser_container td div div.wfu_folder_browser_loading_container img{position:relative}.button.wfu_folder_browser_cancel img{vertical-align:top;margin-top:2px}div.wfu_mchecklist_container{display:inline-block;border:1px solid #ddd;border-radius:4px;padding:4px}div.wfu_mchecklist_item{display:inline-block}div.wfu_mchecklist_item label{vertical-align:baseline;margin-left:4px;cursor:default}div.wfu_mchecklist_item input:disabled+label{color:gray}div.wfu_mchecklist_item div{margin-left:4px}div.wfu_mchecklist_checkall,div.wfu_rolelist_checkall{display:inline-block;vertical-align:top;margin:0 0 0 10px}table.wfu_userlist_container,table.wfu_userlist_container td,table.wfu_userlist_container tr:nth-child(odd){padding:0;border:none;background:0 0;margin:0}table.wfu_userlist_container{border-spacing:0}table.wfu_userlist_container td{width:1%;vertical-align:top}div.wfu_userlist_checkall{display:inline-block;vertical-align:top;margin:0 0 0 10px}div.wfu_shadow{position:absolute;width:100%;height:100%;left:0;top:0;margin:0;padding:0;background-color:#fff;z-index:10;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=60)";filter:alpha(opacity=60);-moz-opacity:.6;-khtml-opacity:.6;opacity:.6}table.wfu_main_table tr:nth-child(odd) div.wfu_shadow{background-color:#f4f4f4}div.wfu_onoff_container_off,div.wfu_onoff_container_on{display:inline-block;position:relative;padding:2px;border:1px solid #aaa;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;background:#066dab;background:-moz-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(6,109,171,1)),color-stop(100%,rgba(197,222,234,1)));background:-webkit-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-o-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:-ms-linear-gradient(top,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);background:linear-gradient(to bottom,rgba(6,109,171,1) 0,rgba(197,222,234,1) 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#066dab', endColorstr='#c5deea', GradientType=0 )}span.wfu_onoff_text{width:30px;display:inline-block;text-align:center;color:#FFF}div.wfu_onoff_slider{position:absolute;margin:0;width:31px;top:0;bottom:0;border:1px solid #fff;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px;-moz-box-shadow:0 0 2px;-webkit-box-shadow:0 0 2px;box-shadow:0 0 2px;background:#ccc;background:-moz-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0,rgba(204,204,204,1)),color-stop(100%,rgba(255,255,255,1)));background:-webkit-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-o-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:-ms-linear-gradient(top,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);background:linear-gradient(to bottom,rgba(204,204,204,1) 0,rgba(255,255,255,1) 100%);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#ffffff', GradientType=0 )}div.wfu_onoff_container_on div.wfu_onoff_slider{left:50%}div.wfu_onoff_container_off div.wfu_onoff_slider{left:0}@-webkit-keyframes set_on{from{left:0}to{left:50%}}@-moz-keyframes set_on{from{left:0}to{left:50%}}@-o-keyframes set_on{from{left:0}to{left:50%}}@keyframes set_on{from{left:0}to{left:50%}}div.wfu_placements_wrapper{display:block;position:relative;margin:0;padding:0;background:0 0;border:none}div.wfu_placements_container{display:inline-block;position:relative;width:100%;height:300px;background-color:#fff;border:1px solid #ccc;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;padding:0;overflow:scroll;font-size:0;line-height:0;white-space:nowrap}div.wfu_componentlist_container{display:inline-block;position:absolute;width:auto;height:auto;top:0;left:100%;background:0 0;border:none;margin:0 0 0 20px;padding:0;z-index:1;white-space:nowrap}div.wfu_component_box_container{display:inline-block;position:relative;width:80px;height:30px;background-color:transparent;border:1px solid transparent;padding:4px;margin:0;cursor:default}div.wfu_component_box,div.wfu_component_box_base{width:80px;height:30px;background-color:#ddd;padding:4px;cursor:default;font-size:12px;line-height:1;white-space:normal}div.wfu_component_box_base{display:block;position:absolute;left:-1px;top:-1px;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;filter:alpha(opacity=40);-khtml-opacity:.4;opacity:.4}div.wfu_component_box_base,div.wfu_component_box_dragged{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";-moz-opacity:.4}div.wfu_component_box{display:inline-block;position:relative;border:1px solid #bbb;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;z-index:1}div.wfu_inbase{display:block;position:absolute;left:-1px;top:-1px}div.wfu_component_box:hover{background-color:#eee;border:1px solid #bbb}div.wfu_component_box_selected{background-color:#aaa;border:1px solid #bbb}div.wfu_component_separator_hor,div.wfu_component_separator_ver{position:relative;background-color:transparent;border:1px solid transparent;cursor:default;z-index:1}div.wfu_component_box_dragged{filter:alpha(opacity=40);-khtml-opacity:.4;opacity:.4}div.wfu_component_separator_ver{display:inline-block;width:8px;height:26px;margin:6px -8px;padding:0 8px}div.wfu_component_separator_hor{display:block;width:100%;height:8px;margin:-8px 0;padding:8px 0}div.wfu_component_bar_hor,div.wfu_component_bar_ver{position:absolute;padding:0;background-color:silver;border:none;display:none}div.wfu_component_bar_hor{width:auto;height:4px;left:10px;right:0;margin:11px 0 0}div.wfu_component_bar_ver{width:4px;height:40px;margin:-6px 0 0 11px}div.wfu_componentlist_dragdrop{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#f8f8f8;border:4px dashed #aaa;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;z-index:2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7}div.wfu_userdata_action,div.wfu_userdata_container{position:relative;padding:0;margin:0;background:0 0}div.wfu_componentlist_dragdrop_dragover{border:4px dashed #555}div.wfu_userdata_container{display:block;width:100%;height:100%;border:none}div.wfu_userdata_action{display:inline-block;top:2px;width:16px;height:16px;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_userdata_action:hover{border:1px solid #aaa}div.wfu_userdata_action.wfu_userdata_action_disabled:hover{border:1px solid transparent}div.wfu_color_container,div.wfu_userdata_line{margin:0;display:block;position:relative;padding:0;background:0 0;border:none;white-space:nowrap}div.wfu_userdata_action>img{width:12px;height:12px}div.wfu_userdata_action_disabled>img{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4}div.wfu_color_container{z-index:1}span.wfu_save_label,span.wfu_save_label_fail{font-size:smaller;border-radius:6px;padding:1px 2px;box-shadow:1px 1px 1px;opacity:0}input[type=text].wp-color-picker{width:75px}input[type=button].wp-picker-clear{width:62px}span.wfu_save_label{background-color:#f0f8ff;color:#32cd32}span.wfu_save_label_fail{background-color:beige;color:#f08080}div.wfu_global_dialog_container{position:fixed;width:100%;height:100%;top:0;left:0;margin:0;padding:0;border:none;background:0 0;z-index:1;display:none}table.wfu_main_table table.wfu_columns_container{border:none;background:0 0;margin:0;padding:0;border-spacing:0}table.wfu_main_table table.wfu_columns_container tr{background:0 0}table.wfu_main_table table.wfu_columns_container td{border:none;background:0 0;margin:0;padding:0;vertical-align:top;width:auto}button.wfu_columns_addbutton{margin:0 10px;font-size:smaller}option.wfu_columns_item_required{color:gray}
css/wordpress_file_upload_style.css CHANGED
@@ -1 +1 @@
1
- input[type=text].file_input_textbox{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:#000}input[type=text].file_input_textbox:disabled{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:silver}input[type=text].file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}form.file_input_uploadform{position:relative;width:100px;height:27px;overflow:hidden;margin:0;padding:0}input[type=button].file_input_button{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button_hover{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_button:disabled,input[type=button].file_input_button_hover:disabled{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:focus,input[type=button].file_input_submit:hover{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=button].file_input_submit:disabled{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input[type=file].file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}div.file_progress_bar{display:block;position:relative;width:auto;border:1px solid #333;margin:0;padding:4px}div.file_progress_inner{display:block;width:100%;height:6px;margin:0;padding:0;border:1px solid silver;background-color:#fff}img.file_progress_imagesafe{width:100%;height:6px}span.file_progress_noanimation{display:block;width:0;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_progressive{display:block;width:auto;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;overflow:hidden}span.file_progress_shuffle{display:block;width:25%;height:6px;margin:0;padding:0;border-style:none;background-color:#2bc253;position:relative;-webkit-animation:shuffle 1s linear infinite alternate;-moz-animation:shuffle 1s linear infinite alternate;-o-animation:shuffle 1s linear infinite alternate;animation:shuffle 1s linear infinite alternate;overflow:hidden}span.file_progress_progressive:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(.25,rgba(255,255,255,.2)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.2)),color-stop(.75,rgba(255,255,255,.2)),color-stop(.75,transparent),to(transparent));background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);z-index:1;-webkit-background-size:30px 30px;-moz-background-size:30px 30px;background-size:30px 30px;-webkit-animation:lengthen 2s linear infinite;-moz-animation:lengthen 2s linear infinite;-o-animation:lengthen 2s linear infinite;animation:lengthen 2s linear infinite;overflow:hidden}@-webkit-keyframes shuffle{from{left:0}to{left:75%}}@-moz-keyframes shuffle{from{left:0}to{left:75%}}@-o-keyframes shuffle{from{left:0}to{left:75%}}@keyframes shuffle{from{left:0}to{left:75%}}@-webkit-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-moz-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-o-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}span.file_messagebox_inner{display:block;width:340px;margin:0;font-size:small;padding:10px;border-style:solid;border-width:1px;border-color:#D3D3D3;background-color:#F5F5F5;color:#000;line-height:1.2}div.file_div_clean{display:table;position:relative;margin:0;padding:0;border-style:none;background:0 0;color:#000;line-height:1}div.file_space_clean{display:block;margin:0 0 2px;padding:0;border-style:none;background:0 0;color:#000}table.file_table_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;width:auto}td.file_td_clean{margin:0;padding:0;border:none;border-spacing:0;background:0 0;color:#000;vertical-align:middle}span.file_item_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000;position:relative;display:inline-block}div.file_item_clean_inner{margin:0;padding:0;border-style:none;background:0 0;position:absolute;top:3px;left:4px;bottom:3px;right:18px}input[type=text].file_item_clean{border:none;box-shadow:none;padding:0;width:100%;height:100%}input[type=text].file_item_clean:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver}input[type=text].file_item_clean_match{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic}input[type=text].file_item_clean_match:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic;color:silver}input[type=text].file_item_clean_empty{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver;font-style:italic}input[type=text].file_item_clean_prompt{border:none;box-shadow:none;padding:0;width:100%;height:100%;background:red}select.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000}select.file_item_clean_prompt{margin:0;padding:0;height:25px;border-style:none;background:red;color:#000}select.file_item_clean:disabled{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:silver}select.file_item_clean option,select.file_item_clean_prompt option{background:#fff;color:#000}span.file_title_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_userdata_container{margin:0;padding:0;white-space:nowrap}label.file_userdata_label{margin:0;width:40%}input[type=text].file_userdata_message,input[type=text].file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:#000}input[type=text].file_userdata_message:disabled,input[type=text].file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:silver}input[type=text].file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}table.file_messageblock_table{margin:0;padding:0;border:none}td.file_messageblock_header_td{border:1px solid #ddd;margin:0;padding:0}div.file_messageblock_header{margin:0;padding:2px}label.file_messageblock_header_label{font-weight:700;font-size:12px;line-height:1}td.file_messageblock_arrow_td{border:1px solid #ddd;margin:0;padding:0;width:20px;vertical-align:middle}div.file_messageblock_header_arrow_up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}div.file_messageblock_header_arrow_down{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #555;margin:5px 1px 1px 5px;font-size:0;line-height:0}td.file_messageblock_subheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_subheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_subheader_messagelabel{font-weight:400;font-size:12px;line-height:1}div.file_messageblock_subheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7;overflow:scroll}label.file_messageblock_subheader_debugmessage_label{margin:0;padding:0;background:0 0;border:none;font-weight:700}div.file_messageblock_subheader_debugmessage_container{margin:0 0 0 20px;padding:0;background:0 0;border:none;font-size:10px}label.file_messageblock_subheader_adminmessagelabel{font-weight:400;font-size:12px;font-style:italic;line-height:1}td.file_messageblock_filenumber_td{width:30px;margin:0;padding:2px;text-align:center;vertical-align:middle;font-weight:700;font-size:11px;line-height:1;border:1px solid #ddd}td.file_messageblock_fileheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_fileheader{margin:0;padding:2px}label.file_messageblock_fileheader_label{font-weight:700;font-size:11px;line-height:1}td.file_messageblock_filearrow_td{margin:0;padding:0;width:20px;border:1px solid #ddd;vertical-align:middle}div.file_messageblock_file_arrow_up{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}div.file_messageblock_file_arrow_down{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid #555;margin:5px 1px 1px 6px;font-size:0;line-height:0}td.file_messageblock_filesubheaderempty_td{width:30px;margin:0;padding:0;border:1px solid #ddd}td.file_messageblock_filesubheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_filesubheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_filesubheader_messagelabel{font-weight:400;font-size:11px;line-height:1}div.file_messageblock_filesubheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7}label.file_messageblock_filesubheader_adminmessagelabel{font-weight:400;font-size:11px;font-style:italic;line-height:1}div.wfu_overlay_editor{width:18px;height:18px;padding:2px;box-shadow:1px 1px 2px #aaa;position:absolute;z-index:2;display:none;background-color:#fff}.wfu_container:hover div.wfu_overlay_editor{display:block}div.wfu_overlay_editor:hover{background-color:#ff0}button.wfu_overlay_editor_button,button.wfu_overlay_editor_button:focus{background:0 0;border:none;margin:0;padding:0;width:100;height:100%;outline:0}div.wfu_overlay_container{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background-color:rgba(255,255,255,.7);z-index:2;display:none}table.wfu_overlay_table,table.wfu_overlay_table td,table.wfu_overlay_table tr{border:none;margin:0;padding:0;background:0 0;width:100%;height:100%}table.wfu_overlay_table td{text-align:center;vertical-align:middle}div.wfu_overlay_container_inner{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background:0 0}div.wfu_overlay_container label{margin-left:4px}
1
+ table.wfu_overlay_table td,td.file_messageblock_filenumber_td{text-align:center;vertical-align:middle}input[type=text].file_input_textbox{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid #BBB;background-color:#fff;color:#000}input[type=text].file_input_textbox:disabled{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid #BBB;background-color:#fff;color:silver}input[type=text].file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid #BBB;background-color:red;color:#000}form.file_input_uploadform{position:relative;width:100px;height:27px;overflow:hidden;margin:0;padding:0}input[type=button].file_input_button{color:#555;border-color:#BBB;border-radius:2px}input[type=button].file_input_button,input[type=button].file_input_button_hover{top:0;position:absolute;width:100px;height:27px;margin:0;padding:0;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px}input[type=button].file_input_button_hover{color:#111;border-color:#333;border-radius:2px}input[type=button].file_input_button:disabled,input[type=button].file_input_button_hover:disabled{position:absolute;top:0;color:silver;border-radius:2px}input[type=button].file_input_button:disabled,input[type=button].file_input_button_hover:disabled,input[type=button].file_input_submit{width:100px;height:27px;margin:0;padding:0;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px}input[type=button].file_input_submit{position:relative;color:#555;border-radius:2px}input[type=button].file_input_submit:focus,input[type=button].file_input_submit:hover{color:#111;border-color:#333;border-radius:2px}input[type=button].file_input_submit:disabled,input[type=button].file_input_submit:focus,input[type=button].file_input_submit:hover{margin:0;padding:0;width:100px;height:27px;position:relative;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px}input[type=button].file_input_submit:disabled{color:silver;border-color:#BBB;border-radius:2px}div.file_div_clean,div.file_item_clean,div.file_space_clean,span.file_item_clean,table.file_table_clean,td.file_td_clean{background:0 0;color:#000}input[type=file].file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}div.file_progress_bar{display:block;position:relative;width:auto;border:1px solid #333;margin:0;padding:4px}div.file_progress_inner{display:block;width:100%;height:6px;margin:0;padding:0;border:1px solid silver;background-color:#fff}span.file_progress_noanimation,span.file_progress_progressive,span.file_progress_shuffle{margin:0;display:block;overflow:hidden;height:6px;padding:0;border-style:none;background-color:#2bc253;position:relative}img.file_progress_imagesafe{width:100%;height:6px}span.file_progress_noanimation{width:0}span.file_progress_progressive{width:auto}span.file_progress_shuffle{width:25%;-webkit-animation:shuffle 1s linear infinite alternate;-moz-animation:shuffle 1s linear infinite alternate;-o-animation:shuffle 1s linear infinite alternate;animation:shuffle 1s linear infinite alternate}span.file_progress_progressive:after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:-webkit-gradient(linear,0 0,100% 100%,color-stop(.25,rgba(255,255,255,.2)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.2)),color-stop(.75,rgba(255,255,255,.2)),color-stop(.75,transparent),to(transparent));background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);z-index:1;-webkit-background-size:30px 30px;-moz-background-size:30px 30px;background-size:30px 30px;-webkit-animation:lengthen 2s linear infinite;-moz-animation:lengthen 2s linear infinite;-o-animation:lengthen 2s linear infinite;animation:lengthen 2s linear infinite;overflow:hidden}@-webkit-keyframes shuffle{from{left:0}to{left:75%}}@-moz-keyframes shuffle{from{left:0}to{left:75%}}@-o-keyframes shuffle{from{left:0}to{left:75%}}@keyframes shuffle{from{left:0}to{left:75%}}@-webkit-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-moz-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@-o-keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}@keyframes lengthen{from{background-position:0 0}to{background-position:30px 30px}}span.file_messagebox_inner{display:block;width:340px;margin:0;font-size:small;padding:10px;border-style:solid;border-width:1px;border-color:#D3D3D3;background-color:#F5F5F5;color:#000;line-height:1.2}div.file_div_clean{display:table;position:relative;margin:0;padding:0;border-style:none;line-height:1}div.file_space_clean{display:block;margin:0 0 2px;padding:0;border-style:none}table.file_table_clean{margin:0;padding:0;border:none;border-spacing:0;width:auto}td.file_td_clean{margin:0;padding:0;border:none;border-spacing:0;vertical-align:middle}span.file_item_clean{margin:0;padding:0;border-style:none}div.file_item_clean{margin:0;padding:0;height:25px;border-style:none;position:relative;display:inline-block}div.file_item_clean_inner{margin:0;padding:0;border-style:none;background:0 0;position:absolute;top:3px;left:4px;bottom:3px;right:18px}input[type=text].file_item_clean{border:none;box-shadow:none;padding:0;width:100%;height:100%}input[type=text].file_item_clean:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver}input[type=text].file_item_clean_match{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic}input[type=text].file_item_clean_match:disabled{border:none;box-shadow:none;padding:0;width:100%;height:100%;font-weight:700;font-style:italic;color:silver}input[type=text].file_item_clean_empty{border:none;box-shadow:none;padding:0;width:100%;height:100%;color:silver;font-style:italic}input[type=text].file_item_clean_prompt{border:none;box-shadow:none;padding:0;width:100%;height:100%;background:red}select.file_item_clean{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:#000}select.file_item_clean_prompt{margin:0;padding:0;height:25px;border-style:none;background:red;color:#000}select.file_item_clean:disabled{margin:0;padding:0;height:25px;border-style:none;background:0 0;color:silver}select.file_item_clean option,select.file_item_clean_prompt option{background:#fff;color:#000}span.file_title_clean{margin:0;padding:0;border-style:none;background:0 0;color:#000}div.file_userdata_container{margin:0;padding:0;white-space:nowrap}label.file_userdata_label{margin:0;width:40%}input[type=text].file_userdata_message,input[type=text].file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background:0 0;color:#000}input[type=text].file_userdata_message:disabled,input[type=text].file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background:0 0;color:silver}input[type=text].file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background-color:red;color:#000}table.file_messageblock_table{margin:0;padding:0;border:none}td.file_messageblock_header_td{border:1px solid #ddd;margin:0;padding:0}div.file_messageblock_header{margin:0;padding:2px}label.file_messageblock_header_label{font-weight:700;font-size:12px;line-height:1}td.file_messageblock_arrow_td{border:1px solid #ddd;margin:0;padding:0;width:20px;vertical-align:middle}div.file_messageblock_header_arrow_down,div.file_messageblock_header_arrow_up{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;margin:5px 1px 1px 5px;font-size:0;line-height:0}div.file_messageblock_header_arrow_up{border-bottom:5px solid #555}div.file_messageblock_header_arrow_down{border-top:5px solid #555}td.file_messageblock_subheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_subheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_subheader_messagelabel{font-weight:400;font-size:12px;line-height:1}div.file_messageblock_subheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7;overflow:scroll}label.file_messageblock_subheader_debugmessage_label{margin:0;padding:0;background:0 0;border:none;font-weight:700}div.file_messageblock_subheader_debugmessage_container{margin:0 0 0 20px;padding:0;background:0 0;border:none;font-size:10px}label.file_messageblock_subheader_adminmessagelabel{font-weight:400;font-size:12px;font-style:italic;line-height:1}label.file_messageblock_fileheader_label,td.file_messageblock_filenumber_td{font-weight:700;font-size:11px;line-height:1}td.file_messageblock_filenumber_td{width:30px;margin:0;padding:2px;border:1px solid #ddd}td.file_messageblock_fileheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_fileheader{margin:0;padding:2px}td.file_messageblock_filearrow_td{margin:0;padding:0;width:20px;border:1px solid #ddd;vertical-align:middle}div.file_messageblock_file_arrow_down,div.file_messageblock_file_arrow_up{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;margin:5px 1px 1px 6px;font-size:0;line-height:0}div.file_messageblock_file_arrow_up{border-bottom:4px solid #555}div.file_messageblock_file_arrow_down{border-top:4px solid #555}td.file_messageblock_filesubheaderempty_td{width:30px;margin:0;padding:0;border:1px solid #ddd}td.file_messageblock_filesubheader_td{margin:0;padding:0;border:1px solid #ddd}div.file_messageblock_filesubheader_message{margin:0;padding:2px;background:0 0}label.file_messageblock_filesubheader_messagelabel{font-weight:400;font-size:11px;line-height:1}div.file_messageblock_filesubheader_adminmessage{margin:0;padding:2px;background-color:#F7F7F7}label.file_messageblock_filesubheader_adminmessagelabel{font-weight:400;font-size:11px;font-style:italic;line-height:1}div.wfu_overlay_editor{width:18px;height:18px;padding:2px;box-shadow:1px 1px 2px #aaa;position:absolute;top:0;left:0;z-index:2;display:none;background-color:#fff;line-height:1}.wfu_browser_container:hover div.wfu_overlay_editor,.wfu_container:hover div.wfu_overlay_editor{display:block}div.wfu_overlay_editor:hover{background-color:#ff0}button.wfu_overlay_editor_button,button.wfu_overlay_editor_button:focus{background:0 0;border:none;margin:0;padding:0;width:100%;height:100%;outline:0}div.wfu_overlay_container{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background-color:rgba(255,255,255,.7);z-index:2;display:none}table.wfu_overlay_table,table.wfu_overlay_table td,table.wfu_overlay_table tr{border:none;margin:0;padding:0;background:0 0;width:100%;height:100%}div.wfu_overlay_container_inner{position:absolute;width:100%;height:100%;top:0;left:0;margin:0;padding:0;background:0 0}div.wfu_overlay_container label{margin-left:4px}
css/wordpress_file_upload_style_safe.css CHANGED
@@ -1 +1 @@
1
- input.file_input_textbox{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:#000}input.file_input_textbox:disabled{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:#fff;color:silver}input.file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}input.file_input_button{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_button_hover{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_button:disabled,input.file_input_button_hover:disabled{width:100px;height:27px;position:absolute;top:0;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_submit{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#555;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_submit:focus,input.file_input_submit:hover{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:#111;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_submit:disabled{width:100px;height:27px;position:relative;margin:0;padding:0;background-color:#EEE;color:silver;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px;border-radius:2px}input.file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}input.file_userdata_message,input.file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:#000}input.file_userdata_message:disabled,input.file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background:0 0;color:silver}input.file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid;border-color:#BBB;background-color:red;color:#000}
1
+ input.file_input_textbox,input.file_input_textbox:disabled,input.file_input_textbox_nofile{position:relative;width:150px;height:25px;margin:0;padding:0;border:1px solid #BBB}input.file_input_textbox{background-color:#fff;color:#000}input.file_input_textbox:disabled{background-color:#fff;color:silver}input.file_input_textbox_nofile{background-color:red;color:#000}input.file_input_button,input.file_input_button_hover{top:0;width:100px;height:27px;margin:0;padding:0;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;-khtml-border-radius:2px}input.file_input_button{position:absolute;color:#555;border-color:#BBB;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}input.file_input_button_hover{position:absolute;color:#111;border-color:#333;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}input.file_input_button:disabled,input.file_input_button_hover:disabled{position:absolute;top:0;color:silver;-moz-border-radius:2px;border-radius:2px}input.file_input_button:disabled,input.file_input_button_hover:disabled,input.file_input_submit{width:100px;height:27px;margin:0;padding:0;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;border-color:#BBB;-webkit-border-radius:2px;-khtml-border-radius:2px}input.file_input_submit{position:relative;color:#555;-moz-border-radius:2px;border-radius:2px}input.file_input_submit:focus,input.file_input_submit:hover{color:#111;border-color:#333;border-radius:2px}input.file_input_submit:disabled,input.file_input_submit:focus,input.file_input_submit:hover{margin:0;padding:0;width:100px;height:27px;position:relative;background-color:#EEE;background-image:url(../images/white-grad-active.png);background-position:left top;background-repeat:repeat-x;border-style:solid;border-width:1px;-webkit-border-radius:2px;-moz-border-radius:2px;-khtml-border-radius:2px}input.file_input_submit:disabled{color:silver;border-color:#BBB;border-radius:2px}input.file_input_hidden{font-size:45px;position:absolute;right:0;top:0;margin:0;padding:0;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0}input.file_userdata_message,input.file_userdata_message_required{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background:0 0;color:#000}input.file_userdata_message:disabled,input.file_userdata_message_required:disabled{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background:0 0;color:silver}input.file_userdata_message_required_empty{width:60%;height:25px;margin:0;padding:0;border:1px solid #BBB;background-color:red;color:#000}
images/Version Comparison.png CHANGED
Binary file
js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_admin_activate_tab(e){for(var t,l,d=document.getElementById("wfu_tab_container"),a=0;a<d.childNodes.length;a++)t=d.childNodes[a],1===t.nodeType&&(l=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+l).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_wrapper"),d=document.getElementsByClassName("wfu_shadow_"+e,"div",l),a=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",l),n="on"==t.className.substr(t.className.length-2);if(n=!n){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<d.length;u++)d[u].style.display="none";for(var u=0;u<a.length;u++)a[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<d.length;u++)d[u].style.display="block";for(var u=0;u<a.length;u++)a[u].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),l=document.getElementById("wfu_wrapper"),d=document.getElementsByClassName("wfu_shadow_"+e,"div",l),a=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",l),n="";for(r=0;r<t.length;r++)t[r].checked&&(n=t[r].value);var u="*"==n.substr(0,1);if(u){n=n.substr(1);for(var r=0;r<d.length;r++)d[r].style.display="none";for(var r=0;r<a.length;r++)a[r].style.display="block"}else{for(var r=0;r<d.length;r++)d[r].style.display="block";for(var r=0;r<a.length;r++)a[r].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,l){e.addEventListener?e.addEventListener(t,l,!1):e.attachEvent?e.attachEvent("on"+t,l):e["on"+t]=l}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){for(var e,t=document.getElementById("wfu_placements_container"),l=document.getElementById("wfu_componentlist_container"),d=0;d<t.childNodes.length;d++)e=t.childNodes[d],"wfu_component_box"==e.className&&(wfu_addEventHandler(e,"dragstart",wfu_component_dragstart),wfu_addEventHandler(e,"dragend",wfu_component_dragend));for(var d=0;d<l.childNodes.length;d++)if(e=l.childNodes[d],"wfu_component_box_container"==e.className)for(var a=0;a<e.childNodes.length;a++)"wfu_component_box wfu_inbase"==e.childNodes[a].className&&(wfu_addEventHandler(e.childNodes[a],"dragstart",wfu_component_dragstart),wfu_addEventHandler(e.childNodes[a],"dragend",wfu_component_dragend));e=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(e,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(e,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var l=document.getElementById("wfu_component_box_"+t);l.className="wfu_component_box wfu_inbase",l.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(l);var d=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(d),document.getElementById("wfu_attribute_value_placements").value=d,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var l=document.getElementById("wfu_component_box_"+t);l.style.display="none",l.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(l);var d=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(d),document.getElementById("wfu_attribute_value_placements").value=d,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function l(e){""!=n&&(n+=a),n+=e,a=""}for(var d=document.getElementById("wfu_placements_container"),a="",n="",u=0;u<d.childNodes.length;u++)item=d.childNodes[u],"wfu_component_separator_ver"==item.className?(""==a&&(a="+"),item==e&&(l(t),a="+")):"wfu_component_separator_hor"==item.className?(a="/",item==e&&(l(t),a="/")):"wfu_component_box"==item.className&&l(item.id.replace("wfu_component_box_",""));return n}function wfu_admin_recreate_placements_panel(e){for(var t,l,d,a=document.getElementById("wfu_placements_container"),n="",u=0;u<a.childNodes.length;u++)t=a.childNodes[u],"wfu_component_box"==t.className&&(n=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+n).appendChild(t));a.innerHTML="",l=e.split("/");for(var u=0;u<l.length;u++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),a.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),a.appendChild(t),d=l[u].split("+");for(var r=0;r<d.length;r++)t=document.getElementById("wfu_component_box_"+d[r]),t&&(a.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),a.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),a.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",a.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",a.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_subfolders_path_","");l=l.replace("wfu_subfolders_label_","");var d=document.getElementById("wfu_attribute_"+l);if(!(d.selectedIndex<0)){var a,n,u=document.getElementById("wfu_subfolders_path_"+l),r=document.getElementById("wfu_subfolders_label_"+l),o=document.getElementById("wfu_subfolders_ok_"+l),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+l).value;if(_)a="",n="";else{var s=d.data;t=s[d.selectedIndex],a=t.path,n=t.label}if(u.value==a&&r.value==n)o.disabled=!0,_||wfu_subfolders_update_nav(l);else{o.disabled=!1;for(var c=document.getElementsByName("wfu_subfolder_nav_"+l),f=0;f<c.length;f++)c[f].disabled=!0}}}function wfu_subfolders_auto_changed(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_subfolders_auto_"+e),d=document.getElementById("wfu_subfolders_editable_"+e),a=document.getElementById("wfu_subfolders_manualtext_"+e);if(l.checked){var n=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=n.substr(0,4)&&(a.value=n),d.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(d.checked?"+":"")),t.disabled=!0}else t.disabled=!1,d.parentNode.style.display="none",wfu_apply_value(e,"folderlist",a.value)}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=item.index-1;if(!(0>d)){for(var a=-1,n=t.selectedIndex-1;n>=0;){if(l[n].level==item.level&&l[n].index==d){a=n;break}n--}if(-1!=a){var u=0;for(n=t.selectedIndex+1;n<l.length&&l[n].level>item.level;)u++,n++;l[a].index=item.index,item.index=d,t.data=l.slice(0,a).concat(l.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(l.slice(a,t.selectedIndex)).concat(l.slice(t.selectedIndex+1+u));var r=wfu_update_subfolder_list(e);t.selectedIndex=a,wfu_subfolders_update_toolnav(e),item=t,r!==item.oldVal&&(item.oldVal=r,document.getElementById("wfu_attribute_value_"+e).value=r,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=item.index+1,a=-1;for(curind=t.selectedIndex+1;curind<l.length;){if(l[curind].level==item.level){a=curind;break}if(l[curind].level<item.level)break;curind++}if(-1!=a){var n=0;for(curind=a+1;curind<l.length&&l[curind].level>item.level;)n++,curind++;l[a].index=item.index,item.index=d,t.data=l.slice(0,t.selectedIndex).concat(l.slice(a,a+1+n)).concat(l.slice(t.selectedIndex,a)).concat(l.slice(a+1+n));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+n+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;for(item=l[t.selectedIndex],curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)l[curind].level--,curind++;item.level--;var d=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,d!==item.oldVal&&(item.oldVal=d,document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;for(item=l[t.selectedIndex],curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)l[curind].level++,curind++;item.level++;var d=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,d!==item.oldVal&&(item.oldVal=d,document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;if(item=l[t.selectedIndex],item.default)item.default=!1;else{for(var d=0;d<l.length;d++)l[d].default=!1;item.default=!0}var a=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,a!==item.oldVal&&(item.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=document.getElementById("wfu_subfolders_path_"+e),d=document.getElementById("wfu_subfolders_label_"+e);if(""==l.value||""==d.value)return void alert("Path or label cannot be empty!");var a=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(n){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),r={label:d.value,path:l.value,level:u,"default":!1},o=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);o>=a.length?a.push(r):a.splice(o,0,r)}else item=a[t.selectedIndex],item.path=l.value,item.label=d.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=0;for(curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)d++,curind++;if(!(d>0)||confirm("Children items will be deleted as well. Proceed?")){l.splice(t.selectedIndex,1+d);var a=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,a!==item.oldVal&&(item.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data,d=t.selectedIndex;item=l[d];var a=t.options,n=document.createElement("option");n.value="",n.innerHTML="",a.add(n,d),t.selectedIndex=d;var u=document.getElementById("wfu_subfolder_tools_"+e),r=document.getElementById("wfu_subfolders_path_"+e),o=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",o.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=d,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",r.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(r.value="{root}",o.value="{upload folder}"):(r.value="",o.value="");for(var c=document.getElementsByName("wfu_subfolder_nav_"+e),f=0;f<c.length;f++)c[f].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var l=null;try{var l=new FormData}catch(d){}if(null!=l){for(var a=document.getElementById("wfu_global_dialog_container"),n=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),r=document.getElementById("wfu_subfolders_inner_shadow_"+e),o=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),c=document.getElementById("wfu_subfolders_browser_ok_"+e),f=document.getElementById("wfu_subfolders_browser_list_"+e);f.options.length>0;)f.options.remove(0);c.disabled=!0,c.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",o.style.display="block",a.style.display="block",n.style.display="block",n.style.left=u.offsetLeft+u.offsetWidth-n.offsetWidth+"px",n.style.top=u.offsetTop+u.offsetHeight-n.offsetHeight+"px",r.style.display="block",a.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var i=document.getElementById("wfu_attribute_uploadpath").value;"/"==i.substr(i.length-1)&&(i=i.substr(0,i.length-1));var m=wfu_get_relative_path(e).split(","),w=i+m[0];"/"!=w.substr(0)&&(w="/"+w);var p="";2==m.length&&(p=m[1]),l.append("action","wfu_ajax_action_read_subfolders"),l.append("folder1",wfu_plugin_encode_string(w)),l.append("folder2",wfu_plugin_encode_string(p)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(l)}}}function wfu_readfolderComplete(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msgcont_"+t),d=document.getElementById("wfu_subfolders_browser_msg_"+t),a=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),r=document.getElementById("wfu_subfolders_path_"+t),o=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",c=e.target.responseText.indexOf(s);-1==c&&(c=e.target.responseText.length);var f=(e.target.responseText.substr(0,c),e.target.responseText.substr(c+s.length,e.target.responseText.length-c-s.length));c=f.indexOf(":");var i=f.substr(0,c);if(txt_value=f.substr(c+1,f.length-c-1),"success"==i){for(var m,w=wfu_plugin_decode_string(txt_value),p=w.split(","),g=0,v=0;v<p.length;v++)""!=p[v]&&(m=document.createElement("option"),m.value=p[v],m.innerHTML=p[v].replace("*","&nbsp;&nbsp;&nbsp;"),n.add(m),g++);0==g&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,n.add(m)),n.selectedIndex=-1,u.onclick=function(){var e=n.options[n.selectedIndex].value,l=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==l)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=l+1,l>0&&(e=e.substr(1))),r.value=e,o.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},l.style.display="none"}else"error"==i?(d.innerHTML=txt_value,a.style.display="none",u.disabled=!1):(d.innerHTML="Unknown error",a.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),d=document.getElementById("wfu_subfolders_browser_img_"+t),a=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",d.style.display="none",a.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),d=document.getElementById("wfu_subfolders_browser_img_"+t),a=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",d.style.display="none",a.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),l=document.getElementById("wfu_subfolders_browser_ok_"+e);l.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),l=document.getElementById("wfu_subfolders_browser_"+e),d=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,d.style.display="none",l.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l,d=t.data,a="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;l=a?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):d[t.selectedIndex].level;for(var n="/",u=t.selectedIndex-1,r=l;u>=0&&r>1;)d[u].level<r&&(n="/"+d[u].path+n,r=d[u].level),u--;return a&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&l>0&&t.selectedIndex>0&&(n+=","+d[t.selectedIndex-1].path),n}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,l,d=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolder_tools_"+e),n=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),r=document.getElementById("wfu_subfolders_ok_"+e),o=document.getElementById("wfu_subfolders_browse_"+e),_=document.getElementById("wfu_subfolders_auto_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==d.data?(t=wfu_decode_subfolder_list(e),d.data=t):t=d.data,0===d.data.length?(d.className="wfu_select_folders wfu_select_folders_empty",d.options[0].innerHTML=_.checked?"":"press here"):d.className="wfu_select_folders",d.selectedIndex<0)a.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",n.disabled=!0,u.disabled=!0,r.disabled=!0,o.disabled=!0,u.value="",n.value="";else if(d.selectedIndex>=d.options.length-1){a.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var s;s=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=s,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",n.disabled=0==s,o.disabled=!1,0==s?(n.value="{root}",u.value="{upload folder}"):(n.value="",u.value="")}else a.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,l=t[d.selectedIndex],n.disabled=0==l.level,o.disabled=0==l.level,u.value=l.label,n.value=l.path;var c=document.getElementsByName("wfu_subfolder_nav_"+e);if(d.selectedIndex<0||d.selectedIndex>=d.options.length-1)for(var f=0;f<c.length;f++)c[f].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_subfolders_up_"+e),d=document.getElementById("wfu_subfolders_down_"+e),a=document.getElementById("wfu_subfolders_left_"+e),n=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),r=document.getElementById("wfu_subfolders_def_"+e),o=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(l.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}d.disabled=0==s.level||0==nextind,a.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,n.disabled=s.level-prevlevel>0,u.disabled=0==s.level,r.disabled=!1,r.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),o.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var l=0,d=!1;l<e.length&&"*"==e.substr(l,1);)l++;e=e.substr(l,e.length-l),"&"==e.substr(0,1)&&(e=e.substr(1),d=!0),t.level=l,t.default=d;var a=e.split("/");return 1==a.length?(t.path=a[0],t.label=a[0]):a.length>1&&(t.path=a[0],t.label=a[1]),0==l&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,l=document.getElementById("wfu_attribute_"+e).options,d=Array(),a=["root"],n=[0],u=-1,r=0;r<l.length-1;r++){for(d.push(wfu_decode_subfolder(wfu_plugin_decode_string(l[r].value))),a.length>d[r].level?a[d[r].level]=d[r].path:a.push(d[r].path),t="",j=1;j<=d[r].level;j++)t+=a[j]+"/";d[r].fullpath=t,n.length<=d[r].level&&n.push(0),d[r].index=d[r].level>u?0:n[d[r].level]+1,n[d[r].level]=d[r].index,u=d[r].level}return d}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,l=document.getElementById("wfu_attribute_"+e),d=l.data;if(null!=d){var a,n,u="";t.length=d.length+1;for(var r=0;r<d.length;r++){for(a="",n="",j=0;j<d[r].level;j++)a+="*",n+="&nbsp;&nbsp;&nbsp;";d[r].default?(a+="&",t[r].className="wfu_select_folders_option_default"):t[r].className="",a+=d[r].path+"/"+d[r].label,n+=d[r].label,t[r].value=wfu_plugin_encode_string(a),t[r].innerHTML=n,""!=u&&(u+=","),u+=a}return t[d.length].value="",t[d.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,l){for(var d,a=0;a<e.childNodes.length;a++)d=e.childNodes[a],"INPUT"==d.tagName?"text"==d.type?(d.value=t,wfu_attach_element_handlers(d,wfu_update_userfield_value)):"checkbox"==d.type&&(d.checked=l):"DIV"==d.tagName&&(d.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,l=t.cloneNode(!0);wfu_userdata_edit_field(l,"",!1),t.parentNode.insertBefore(l,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,l=t.parentNode,d=null,a=0;a<l.childNodes.length;a++)if(1===l.childNodes[a].nodeType){d=l.childNodes[a];break}if(t!=d){t.parentNode.removeChild(t);for(var a=0;a<d.childNodes.length;a++)if(1===d.childNodes[a].nodeType){wfu_update_userfield_value({target:d.childNodes[a]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_attribute_defaults"),l=(document.getElementById("wfu_attribute_values"),""),d="",a="[wordpress_file_upload",n="",u=0;u<t.childNodes.length;u++)e=t.childNodes[u],1===e.nodeType&&(l=e.id.replace("wfu_attribute_default_",""),d=document.getElementById("wfu_attribute_value_"+l).value,e.value!=d&&(n+=" "+l+'="'+d+'"'));a+=n+"]",document.getElementById("wfu_shortcode").value=a,ShortcodeString=n.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(a)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_",""),d=t.value;d=d.replace(/(\r\n|\n|\r)/gm,"%n%"),d=d.replace(/\"/gm,"%dq%"),d=d.replace(/\[/gm,"%brl%"),d=d.replace(/\]/gm,"%brr%"),d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+l).value=d,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_","");l=l.replace("_color",""),l=l.replace("_bgcolor",""),l=l.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+l+"_color");var d=t.value+","+document.getElementById("wfu_attribute_"+l+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+l+"_borcolor").value;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+l).value=d,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,l=t.name.replace("wfu_dimension_elements_",""),d=document.getElementsByName(t.name);t=d[0];for(var a="",n="",u=0;u<d.length;u++)n=d[u].id.replace("wfu_attribute_"+l+"_",""),""!=a&&""!=d[u].value&&(a+=", "),""!=d[u].value&&(a+=n+":"+d[u].value);a!==t.oldVal&&(t.oldVal=a,document.getElementById("wfu_attribute_value_"+l).value=a,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_","");l=l.substr(2);var d=document.getElementById("wfu_attribute_s_"+l).value,a=document.getElementById("wfu_attribute_p_"+l).value,n=d+"/"+a;n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+l).value=n),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",l=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));l.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",l=document.getElementById("wfu_attribute_"+e),d=document.getElementById("wfu_attribute_"+e+"_all");if(d.checked)l.disabled=!0,t="all";else{l.disabled=!1;for(var a=l.options,n=0;n<a.length;n++)a[n].selected&&(""!=t&&(t+=","),t+=a[n].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userlist_value(e){var t="",l=document.getElementById("wfu_attribute_"+e),d=document.getElementById("wfu_attribute_"+e+"_guests"),a=document.getElementById("wfu_attribute_"+e+"_all");if(a.checked)l.disabled=!0,d.disabled=!0,t="all";else{l.disabled=!1,d.disabled=!1;for(var n=l.options,u=0;u<n.length;u++)n[u].selected&&(""!=t&&(t+=","),t+=n[u].value);d.checked&&(""!=t&&(t+=","),t+="guests")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,l=t.parentNode,d=l.parentNode,a="",n=!1,u="",r=0;r<d.childNodes.length;r++)if(l=d.childNodes[r],"DIV"===l.tagName){for(var o=0;o<l.childNodes.length;o++)"INPUT"==l.childNodes[o].tagName&&("text"==l.childNodes[o].type?(a=l.childNodes[o].value,0==r&&(t=l.childNodes[o])):"checkbox"==l.childNodes[o].type&&(n=l.childNodes[o].checked));""!=u&&""!=a&&(u+="/"),""!=a&&n&&(u+="*"),""!=a&&(u+=a)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){for(var e=document.getElementById("wfu_attribute_value_userdatalabel").value,t=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_userdata","div",t),d=document.getElementsByName("wfu_userfield_select"),a=0;a<d.length;a++)d[a].style.display="none";if(0!=l.length&&"block"!=l[0].style.display){for(var n='<option style="display:none;">%userdataXXX%</option>',u=e.split("/"),r="",a=1;a<=u.length;a++)r=u[a-1],"*"==r[0]&&(r=r.substr(1)),n+='<option value="%userdata'+a+'%">'+a+": "+r+"</option>";for(var a=0;a<d.length;a++)d[a].innerHTML=n,d[a].style.display="inline-block"}}function wfu_attach_element_handlers(e,t){for(var l=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],d=0;d<l.length;d++)wfu_addEventHandler(e,l[d],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),l=0;l<t.length;l++)wfu_attach_element_handlers(t[l],wfu_update_text_value);for(var d=document.getElementsByName("wfu_ptext_elements"),l=0;l<d.length;l++)wfu_attach_element_handlers(d[l],wfu_update_ptext_value);for(var a=document.getElementsByName("wfu_triplecolor_elements"),l=0;l<a.length;l++)wfu_attach_element_handlers(a[l],wfu_update_triplecolor_value);for(var n=document.getElementsByName("wfu_dimension_elements_widths"),l=0;l<n.length;l++)wfu_attach_element_handlers(n[l],wfu_update_dimension_value);
2
- n=document.getElementsByName("wfu_dimension_elements_heights");for(var l=0;l<n.length;l++)wfu_attach_element_handlers(n[l],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),l=0;l<u.length;l++)wfu_attach_element_handlers(u[l],wfu_update_userfield_value);for(var r=document.getElementsByName("wfu_subfolder_tools_input"),l=0;l<r.length;l++)wfu_attach_element_handlers(r[l],wfu_subfolders_input_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),l=document.getElementById("wfu_attribute_"+t),d=l.selectionStart,a=l.value;l.value=a.substr(0,d)+e.innerHTML+a.substr(d),wfu_update_text_value({target:l})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),l=document.getElementById("wfu_attribute_"+t),d=l.selectionStart,a=l.value;l.value=a.substr(0,d)+e.value+a.substr(d),e.value="%userdataXXX%",wfu_update_text_value({target:l})}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(l){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,l=0,d="",a="";for(l=0;l<e.length;l++)t=e.charCodeAt(l),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),a=t.toString(16),(1==a.length||3==a.length||5==a.length)&&(a="0"+a),d+=a;return d}function wfu_plugin_decode_string(e){for(var t,l,d=0,a="";d<e.length;)t=parseInt(e.substr(d,2),16),l=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(d+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(d+=2,2),16))<<6)+(63&parseInt(e.substr(d+=2,2),16)),a+=String.fromCharCode(l),d+=2;return a}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(6),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value;for(var l="",d=0;d<params.length;d++)l+=(d>0?"&":"")+params[d][0]+"="+encodeURI(params[d][1]);var a=new Date;Autosave?ShortcodeNextSave=a.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",l=e.responseText.indexOf(t);-1==l&&(l=e.responseText.length);var d=(e.responseText.substr(0,l),e.responseText.substr(l+t.length,e.responseText.length-l-t.length));l=d.indexOf(":");var n=d.substr(0,l);txt_value=d.substr(l+1,d.length-l-1),"success"==n?(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=a.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value&&(document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("[wordpress_file_upload "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut))):(Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==n&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block"))}},e.send(l)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,l=0,d=0;t>d;d++)l=1-d/t,setTimeout('wfu_adjust_opacity("'+l.toString()+'")',d*e/t);setTimeout('wfu_adjust_opacity("0.0")',d*e/t)}function wfu_apply_value(e,t,l){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=l?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var d=document.getElementById("wfu_attribute_"+e);if(l=l.replace(/\%n\%/gm,"\n"),l=l.replace(/\%dq\%/gm,'"'),l=l.replace(/\%brl\%/gm,"["),l=l.replace(/\%brr\%/gm,"]"),"color"==t){var a=colourNameToHex(l);a||(a=l),jQuery("#wfu_attribute_"+e).wpColorPicker("color",a)}d.value=l,wfu_update_text_value({target:d})}else if("placements"==t)wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode();else if("radio"==t){for(var n=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<n.length;u++)n[u].checked=n[u].value==l||"*"+n[u].value==l;wfu_admin_radio_clicked(e)}else if("ptext"==t){l=l.replace(/\%n\%/gm,"\n"),l=l.replace(/\%dq\%/gm,'"'),l=l.replace(/\%brl\%/gm,"["),l=l.replace(/\%brr\%/gm,"]");var r=l.split("/"),o=r.length<1?"":r[0],_=r.length<2?o:r[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=o;var c=document.getElementById("wfu_attribute_p_"+e);c.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:c})}else if("mchecklist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var f=l.split(","),u=0;u<f.length;u++)f[u]=f[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",f.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=l.split(","),u=0;u<i.length;u++)i[u]=i[u].trim();for(var d=document.getElementById("wfu_attribute_"+e),u=0;u<d.options.length;u++)d.options[u].selected=i.indexOf(d.options[u].value)>-1}wfu_update_rolelist_value(e)}else if("userlist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var m=l.split(","),u=0;u<m.length;u++)m[u]=m[u].trim();for(var d=document.getElementById("wfu_attribute_"+e),u=0;u<d.options.length;u++)d.options[u].selected=m.indexOf(d.options[u].value)>-1;document.getElementById("wfu_attribute_"+e+"_guests").checked=m.indexOf("guests")>-1}wfu_update_userlist_value(e)}else if("dimensions"==t){for(var w,p,g,d,v=l.split(","),b=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<b.length;u++)b[u].value="";for(var u=0;u<v.length;u++)w=v[u].split(":",2),p=w.length<1?"":w[0],g=w.length<2?p:w[1],d=document.getElementById("wfu_attribute_"+e+"_"+p.trim()),d&&(d.value=g.trim());d=b[0],wfu_update_dimension_value({target:d})}else if("userfields"==t){for(var h,y=l.split("/"),I=Array(),u=0;u<y.length;u++)h="*"==y[u].substr(0,1),h&&(y[u]=y[u].substr(1)),""!=y[u]&&I.push({name:y[u],required:h});for(var E=document.getElementById("wfu_attribute_"+e),k=null,B=Array(),u=0;u<E.childNodes.length;u++)1===E.childNodes[u].nodeType&&(null==k?k=E.childNodes[u]:B.push(E.childNodes[u]));for(var u=0;u<B.length;u++)E.removeChild(B[u]);wfu_userdata_edit_field(k,"",!1);for(var x,N=k,u=0;u<I.length;u++)0==u?wfu_userdata_edit_field(k,I[u].name,I[u].required):(x=N.cloneNode(!0),wfu_userdata_edit_field(x,I[u].name,I[u].required),E.insertBefore(x,N.nextSibling),N=x);for(var d,u=0;u<k.childNodes.length&&(d=k.childNodes[u],"INPUT"!=d.tagName);u++);wfu_update_userfield_value({target:d})}else if("color-triplet"==t){for(var T=l.split(","),u=0;u<T.length;u++)T[u]=T[u].trim();2==T.length?T=[T[0],T[1],"#000000"]:1==T.length?T=[T[0],"#FFFFFF","#000000"]:T.length<3&&(T=["#000000","#FFFFFF","#000000"]);var a=colourNameToHex(T[0]);a||(a=T[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",a);var d=document.getElementById("wfu_attribute_"+e+"_color");d.value=T[0],a=colourNameToHex(T[1]),a||(a=T[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",a),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=T[1],a=colourNameToHex(T[2]),a||(a=T[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",a),document.getElementById("wfu_attribute_"+e+"_borcolor").value=T[2],wfu_update_triplecolor_value({target:d})}else if("folderlist"==t){for(var f=wfu_parse_folderlist_js(l),H=document.getElementById("wfu_attribute_"+e).options;H.length>0;)H.remove(0);for(var A,O,j,C,D,S,u=0;u<f.path.length;u++){O=f.path[u],"/"==O.substr(O.length,1)&&(O=O.substr(0,O.length-1)),j=O.split("/"),O=j[j.length-1],D=parseInt(f.level[u]),C="",S="";for(var L=0;D>L;L++)C+="&nbsp;&nbsp;&nbsp;",S+="*";C+=f.label[u],f.default[u]&&(S+="&"),S+=""==O?"{root}/"+f.label[u]:O+f.label[u],A=document.createElement("option"),A.className=f.default[u]?"wfu_select_folders_option_default":"",A.value=wfu_plugin_encode_string(S),A.innerHTML=C,H.add(A)}A=document.createElement("option"),A.value="",A.innerHTML="",H.add(A);var V=document.getElementById("wfu_attribute_"+e);V.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),d=V,l!==d.oldVal&&(d.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();if(t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array(),"auto"==e.substr(0,4))return t;var l=e.split(",");if(0==l.length)return t;if(1==l.length&&""==l[0].trim())return t;for(var d,a,n,u,r,o,_,s=["root"],c=0,f=0,i=-1,m=0;m<l.length;m++){for(d=l[m].trim(),a=0,n="",u=!1;a<d.length&&"*"==d.substr(a,1);)a++,n+="&nbsp;&nbsp;&nbsp;";if(1>=a-c&&(a>0||0==f)&&(d=d.substr(a,d.length-a),"&"==d.substr(0,1)&&(d=d.substr(1),u=!0),subfolder_items=d.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(r=subfolder_items[0],o=subfolder_items[1]):(r=d,o=d),""!=r)){u&&-1==i?i=t.path.length:u=!1,0==a&&(f=1),s.length>a?s[a]=r:s.push(r),_="";for(var w=1;a>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(o),t.level.push(a),t.default.push(u),c=a}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,l){var d=wfu_GetHttpRequestObject();if(null!=d){var a=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=l;for(var n="",u=0;u<params.length;u++)n+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);d.open("POST",a,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){var l="wfu_ajax_action_download_file_invoker:",a=d.responseText.indexOf(l);-1==a&&(a=d.responseText.length);var n=(d.responseText.substr(0,a),d.responseText.substr(a+l.length,d.responseText.length-a-l.length));a=n.indexOf(":");var u=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"wfu_download_id;"==u.substr(0,16)){var r=u.substr(16),o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+r+"')",100)}}},d.send(n)}}function wfu_download_file_monitor(e,t,l){var d=wfu_GetHttpRequestObject();if(null!=d){var a=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=l;for(var n="",u=0;u<params.length;u++)n+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);d.open("POST",a,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){var l="wfu_ajax_action_download_file_monitor:",a=d.responseText.indexOf(l);-1==a&&(a=d.responseText.length);var n=(d.responseText.substr(0,a),d.responseText.substr(a+l.length,d.responseText.length-a-l.length));a=n.indexOf(":");var u=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"repeat"!=u){var r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},d.send(n)}}function wfu_filedetails_userdata_changed(){for(var e,t,l=document.getElementsByName("wfu_filedetails_userdata"),d=!1,a=0;a<l.length;a++)if(e=document.getElementById(l[a].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(l[a].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=l[a].value,l[a].value!=e.value){d=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!d}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}function wfu_update_browserpermission_option(e,t){var l=document.getElementById("wfu_fbperm_users"),d=document.getElementById("wfu_fbperm_roles"),a=document.getElementById("wfu_fbperm_"+e+"_"+t+"_view"),n=document.getElementById("wfu_fbperm_"+e+"_"+t+"_dl"),u=document.getElementById("wfu_fbperm_"+e+"_"+t+"_edit"),r=document.getElementById("wfu_fbperm_"+e+"_"+t+"_del");if("role"==e){if("0"==t){n.checked=a.checked&&n.checked,u.checked=a.checked&&u.checked,r.checked=a.checked&&r.checked,n.disabled=!a.checked,u.disabled=!a.checked,r.disabled=!a.checked;for(var o=d.value.split(","),_=0;_<o.length;_++){var s=o[_].indexOf("["),c=o[_].substr(0,s);"0"!=c&&wfu_update_browserpermission_option("role",c)}var f=(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");d.value=d.value.replace(/^0\[\w*\]/,"0["+f+"]")}else if("administrator"!=t){var i=document.getElementById("wfu_fbperm_role_"+t+"_row"),m=document.getElementById("wfu_fbperm_role_"+t+"_def"),w=document.getElementById("wfu_fbperm_role_0_view"),p=document.getElementById("wfu_fbperm_role_0_dl"),g=document.getElementById("wfu_fbperm_role_0_edit"),v=document.getElementById("wfu_fbperm_role_0_del");a.checked=m.checked?w.checked:a.checked,i.style.fontWeight=m.checked?"":"bold",n.checked=m.checked?p.checked:a.checked&&n.checked,u.checked=m.checked?g.checked:a.checked&&u.checked,r.checked=m.checked?v.checked:a.checked&&r.checked,a.disabled=m.checked,n.disabled=m.checked||!a.checked,u.disabled=m.checked||!a.checked,r.disabled=m.checked||!a.checked;var f=m.checked?"":"D"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");d.value=d.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+f+"]")}for(var b=l.value.split(","),_=0;_<b.length;_++){var s=b[_].indexOf("["),h=b[_].substr(0,s);"0"!=h&&wfu_update_browserpermission_option("user",h)}}else if("user"==e){var y=document.getElementById("wfu_fbperm_user_"+t+"_role");if("0"==t){a.checked=y.checked?!1:a.checked,n.checked=y.checked?!1:a.checked&&n.checked,u.checked=y.checked?!1:a.checked&&u.checked,r.checked=y.checked?!1:a.checked&&r.checked,a.disabled=y.checked,n.disabled=y.checked||!a.checked,u.disabled=y.checked||!a.checked,r.disabled=y.checked||!a.checked,a.indeterminate=y.checked,n.indeterminate=y.checked,u.indeterminate=y.checked,r.indeterminate=y.checked;for(var b=l.value.split(","),_=0;_<b.length;_++){var s=b[_].indexOf("["),h=b[_].substr(0,s);"0"!=h&&wfu_update_browserpermission_option("user",h)}var f=y.checked?"":"R"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");l.value=l.value.replace(/^0\[\w*\]/,"0["+f+"]")}else{var I=document.getElementById("wfu_fbperm_user_"+t+"_roles").value.split(",");if(1==I.length&&""==I[0]&&(I=Array()),I.indexOf("administrator")<0){var i=document.getElementById("wfu_fbperm_user_"+t+"_row"),m=document.getElementById("wfu_fbperm_user_"+t+"_def"),E=document.getElementById("wfu_fbperm_user_0_role"),w=document.getElementById("wfu_fbperm_user_0_view"),p=document.getElementById("wfu_fbperm_user_0_dl"),g=document.getElementById("wfu_fbperm_user_0_edit"),v=document.getElementById("wfu_fbperm_user_0_del");if(I.length>0)for(var k=!1,B=!1,x=!1,N=!1,_=0;_<I.length;_++)k=k||document.getElementById("wfu_fbperm_role_"+I[_]+"_view").checked,B=k&&(B||document.getElementById("wfu_fbperm_role_"+I[_]+"_dl").checked),x=k&&(x||document.getElementById("wfu_fbperm_role_"+I[_]+"_edit").checked),N=k&&(N||document.getElementById("wfu_fbperm_role_"+I[_]+"_del").checked);else var k=document.getElementById("wfu_fbperm_role_0_view"),B=document.getElementById("wfu_fbperm_role_0_dl"),x=document.getElementById("wfu_fbperm_role_0_edit"),N=document.getElementById("wfu_fbperm_role_0_del");i.style.fontWeight=m.checked?"":"bold",y.checked=m.checked?E.checked:y.checked,a.checked=m.checked?E.checked?k:w.checked:y.checked?k:a.checked,n.checked=m.checked?E.checked?B:p.checked:y.checked?B:a.checked&&n.checked,u.checked=m.checked?E.checked?x:g.checked:y.checked?x:a.checked&&u.checked,r.checked=m.checked?E.checked?N:v.checked:y.checked?N:a.checked&&r.checked,y.disabled=m.checked,a.disabled=m.checked||y.checked,n.disabled=m.checked||y.checked||!a.checked,u.disabled=m.checked||y.checked||!a.checked,r.disabled=m.checked||y.checked||!a.checked;var f=m.checked?"":"D"+(y.checked?"":"R"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":""));l.value=l.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+f+"]")}}}}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
1
+ function wfu_admin_activate_tab(e){for(var t,l,d=document.getElementById("wfu_tab_container"),a=0;a<d.childNodes.length;a++)t=d.childNodes[a],1===t.nodeType&&(l=t.id.substr(8),t.className.indexOf("nav-tab-active")>-1&&(t.className="nav-tab",document.getElementById("wfu_container_"+l).style.display="none"));document.getElementById("wfu_tab_"+e).className="nav-tab nav-tab-active",document.getElementById("wfu_container_"+e).style.display="block"}function wfu_admin_onoff_clicked(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_wrapper"),d=document.getElementsByClassName("wfu_shadow_"+e,"div",l),a=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",l),n="on"==t.className.substr(t.className.length-2);if(n=!n){document.getElementById("wfu_attribute_value_"+e).value="true",t.className="wfu_onoff_container_on";for(var u=0;u<d.length;u++)d[u].style.display="none";for(var u=0;u<a.length;u++)a[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<d.length;u++)d[u].style.display="block";for(var u=0;u<a.length;u++)a[u].style.display="none"}wfu_generate_shortcode(),"userdata"==e&&wfu_update_userfield_variables()}function wfu_admin_radio_clicked(e){var t=document.getElementsByName("wfu_radioattribute_"+e),l=document.getElementById("wfu_wrapper"),d=document.getElementsByClassName("wfu_shadow_"+e,"div",l),a=document.getElementsByClassName("wfu_shadow_"+e+"_inv","div",l),n="";for(o=0;o<t.length;o++)t[o].checked&&(n=t[o].value);var u="*"==n.substr(0,1);if(u){n=n.substr(1);for(var o=0;o<d.length;o++)d[o].style.display="none";for(var o=0;o<a.length;o++)a[o].style.display="block"}else{for(var o=0;o<d.length;o++)d[o].style.display="block";for(var o=0;o<a.length;o++)a[o].style.display="none"}document.getElementById("wfu_attribute_value_"+e).value=n,wfu_generate_shortcode()}function wfu_addEventHandler(e,t,l){e.addEventListener?e.addEventListener(t,l,!1):e.attachEvent?e.attachEvent("on"+t,l):e["on"+t]=l}function wfu_attach_separator_dragdrop_events(){for(var e,t=document.getElementById("wfu_placements_container"),l=0;l<t.childNodes.length;l++)e=t.childNodes[l],("wfu_component_separator_hor"==e.className||"wfu_component_separator_ver"==e.className)&&(wfu_addEventHandler(e,"dragenter",wfu_separator_dragenter),wfu_addEventHandler(e,"dragover",wfu_default_dragover),wfu_addEventHandler(e,"dragleave",wfu_separator_dragleave),wfu_addEventHandler(e,"drop",wfu_separator_drop))}function wfu_Attach_Admin_DragDrop_Events(){if(window.FileReader){var e=document.getElementById("wfu_placements_container");if(e){for(var t,l=document.getElementById("wfu_componentlist_container"),d=0;d<e.childNodes.length;d++)t=e.childNodes[d],"wfu_component_box"==t.className&&(wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend));for(var d=0;d<l.childNodes.length;d++)if(t=l.childNodes[d],"wfu_component_box_container"==t.className)for(var a=0;a<t.childNodes.length;a++)"wfu_component_box wfu_inbase"==t.childNodes[a].className&&(wfu_addEventHandler(t.childNodes[a],"dragstart",wfu_component_dragstart),wfu_addEventHandler(t.childNodes[a],"dragend",wfu_component_dragend));t=document.getElementById("wfu_componentlist_dragdrop"),wfu_addEventHandler(t,"dragenter",wfu_componentlist_dragenter),wfu_addEventHandler(t,"dragover",wfu_default_dragover),wfu_addEventHandler(t,"dragleave",wfu_componentlist_dragleave),wfu_addEventHandler(t,"drop",wfu_componentlist_drop),wfu_attach_separator_dragdrop_events()}}}function wfu_componentlist_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return-1==t.className.indexOf("wfu_componentlist_dragdrop_dragover")&&(t.className+=" wfu_componentlist_dragdrop_dragover"),!1}function wfu_componentlist_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className=t.className.replace(" wfu_componentlist_dragdrop_dragover",""),!1}function wfu_componentlist_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var l=document.getElementById("wfu_component_box_"+t);l.className="wfu_component_box wfu_inbase",l.style.display="block",document.getElementById("wfu_component_box_container_"+t).appendChild(l);var d=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(d),document.getElementById("wfu_attribute_value_placements").value=d,wfu_generate_shortcode(),!1}function wfu_separator_dragenter(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.top=e.target.offsetTop+"px",t.style.display="block"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.top=e.target.offsetTop+"px",t.style.left=e.target.offsetLeft+"px",t.style.display="block"}return!1}function wfu_default_dragover(e){return e=e||window.event,e.preventDefault&&e.preventDefault(),!1}function wfu_separator_dragleave(e){if(e=e||window.event,e.preventDefault&&e.preventDefault(),!DraggedItem)return!1;if("wfu_component_separator_hor"==e.target.className){var t=document.getElementById("wfu_component_bar_hor");t.style.display="none"}else if("wfu_component_separator_ver"==e.target.className){var t=document.getElementById("wfu_component_bar_ver");t.style.display="none"}return!1}function wfu_separator_drop(e){e=e||window.event,e.preventDefault&&e.preventDefault();var t=e.dataTransfer.getData("Component");if(!t)return!1;var l=document.getElementById("wfu_component_box_"+t);l.style.display="none",l.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+t).appendChild(l);var d=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(d),document.getElementById("wfu_attribute_value_placements").value=d,wfu_generate_shortcode(),!1}function wfu_component_dragstart(e){e=e||window.event,e.dataTransfer.setData("Component",e.target.id.replace("wfu_component_box_","")),-1==e.target.className.indexOf("wfu_component_box_dragged")&&(e.target.className+=" wfu_component_box_dragged",DraggedItem=e.target),e.target.style.zIndex=3;var t=document.getElementById("wfu_componentlist_dragdrop");return t.className="wfu_componentlist_dragdrop wfu_componentlist_dragdrop_dragover",t.style.display="block",!1}function wfu_component_dragend(e){e=e||window.event,DraggedItem=null,e.target.style.zIndex=1;var t=document.getElementById("wfu_componentlist_dragdrop");return t.style.display="none",t.className="wfu_componentlist_dragdrop",e.target.className=e.target.className.replace(" wfu_component_box_dragged",""),document.getElementById("wfu_component_bar_ver").style.display="none",document.getElementById("wfu_component_bar_hor").style.display="none",!1}function wfu_admin_recreate_placements_text(e,t){function l(e){""!=n&&(n+=a),n+=e,a=""}for(var d=document.getElementById("wfu_placements_container"),a="",n="",u=0;u<d.childNodes.length;u++)item=d.childNodes[u],"wfu_component_separator_ver"==item.className?(""==a&&(a="+"),item==e&&(l(t),a="+")):"wfu_component_separator_hor"==item.className?(a="/",item==e&&(l(t),a="/")):"wfu_component_box"==item.className&&l(item.id.replace("wfu_component_box_",""));return n}function wfu_admin_recreate_placements_panel(e){for(var t,l,d,a=document.getElementById("wfu_placements_container"),n="",u=0;u<a.childNodes.length;u++)t=a.childNodes[u],"wfu_component_box"==t.className&&(n=t.id.replace("wfu_component_box_",""),t.style.display="inline-block",t.className="wfu_component_box wfu_inbase",document.getElementById("wfu_component_box_container_"+n).appendChild(t));a.innerHTML="",l=e.split("/");for(var u=0;u<l.length;u++){t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),a.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),a.appendChild(t),d=l[u].split("+");for(var o=0;o<d.length;o++)t=document.getElementById("wfu_component_box_"+d[o]),t&&(a.appendChild(t),t.className="wfu_component_box",t.style.display="inline-block",t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),a.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),a.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",a.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",a.appendChild(t),wfu_attach_separator_dragdrop_events()}function wfu_subfolders_input_changed(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_subfolders_path_","");l=l.replace("wfu_subfolders_label_","");var d=document.getElementById("wfu_attribute_"+l);if(!(d.selectedIndex<0)){var a,n,u=document.getElementById("wfu_subfolders_path_"+l),o=document.getElementById("wfu_subfolders_label_"+l),r=document.getElementById("wfu_subfolders_ok_"+l),_="1"==document.getElementById("wfu_subfolders_isnewitem_"+l).value;if(_)a="",n="";else{var s=d.data;t=s[d.selectedIndex],a=t.path,n=t.label}if(u.value==a&&o.value==n)r.disabled=!0,_||wfu_subfolders_update_nav(l);else{r.disabled=!1;for(var c=document.getElementsByName("wfu_subfolder_nav_"+l),f=0;f<c.length;f++)c[f].disabled=!0}}}function wfu_subfolders_auto_changed(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_subfolders_auto_"+e),d=document.getElementById("wfu_subfolders_editable_"+e),a=document.getElementById("wfu_subfolders_manualtext_"+e);if(l.checked){var n=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=n.substr(0,4)&&(a.value=n),d.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(d.checked?"+":"")),t.disabled=!0}else t.disabled=!1,d.parentNode.style.display="none",wfu_apply_value(e,"folderlist",a.value)}function wfu_subfolders_up_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=item.index-1;if(!(0>d)){for(var a=-1,n=t.selectedIndex-1;n>=0;){if(l[n].level==item.level&&l[n].index==d){a=n;break}n--}if(-1!=a){var u=0;for(n=t.selectedIndex+1;n<l.length&&l[n].level>item.level;)u++,n++;l[a].index=item.index,item.index=d,t.data=l.slice(0,a).concat(l.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(l.slice(a,t.selectedIndex)).concat(l.slice(t.selectedIndex+1+u));var o=wfu_update_subfolder_list(e);t.selectedIndex=a,wfu_subfolders_update_toolnav(e),item=t,o!==item.oldVal&&(item.oldVal=o,document.getElementById("wfu_attribute_value_"+e).value=o,wfu_generate_shortcode())}}}}function wfu_subfolders_down_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=item.index+1,a=-1;for(curind=t.selectedIndex+1;curind<l.length;){if(l[curind].level==item.level){a=curind;break}if(l[curind].level<item.level)break;curind++}if(-1!=a){var n=0;for(curind=a+1;curind<l.length&&l[curind].level>item.level;)n++,curind++;l[a].index=item.index,item.index=d,t.data=l.slice(0,t.selectedIndex).concat(l.slice(a,a+1+n)).concat(l.slice(t.selectedIndex,a)).concat(l.slice(a+1+n));var u=wfu_update_subfolder_list(e);t.selectedIndex=t.selectedIndex+n+1,wfu_subfolders_update_toolnav(e),item=t,u!==item.oldVal&&(item.oldVal=u,document.getElementById("wfu_attribute_value_"+e).value=u,wfu_generate_shortcode())}}}function wfu_subfolders_left_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;for(item=l[t.selectedIndex],curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)l[curind].level--,curind++;item.level--;var d=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,d!==item.oldVal&&(item.oldVal=d,document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode())}}function wfu_subfolders_right_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;for(item=l[t.selectedIndex],curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)l[curind].level++,curind++;item.level++;var d=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,d!==item.oldVal&&(item.oldVal=d,document.getElementById("wfu_attribute_value_"+e).value=d,wfu_generate_shortcode())}}function wfu_subfolders_def_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;if(item=l[t.selectedIndex],item.default)item.default=!1;else{for(var d=0;d<l.length;d++)l[d].default=!1;item.default=!0}var a=wfu_update_subfolder_list(e);wfu_subfolders_update_toolnav(e),item=t,a!==item.oldVal&&(item.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}function wfu_subfolders_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=document.getElementById("wfu_subfolders_path_"+e),d=document.getElementById("wfu_subfolders_label_"+e);if(""==l.value||""==d.value)return void alert("Path or label cannot be empty!");var a=t.data,n="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;if(n){var u=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value),o={label:d.value,path:l.value,level:u,"default":!1},r=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);r>=a.length?a.push(o):a.splice(r,0,o)}else item=a[t.selectedIndex],item.path=l.value,item.label=d.value;var _=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,_!==item.oldVal&&(item.oldVal=_,document.getElementById("wfu_attribute_value_"+e).value=_,wfu_generate_shortcode())}}function wfu_subfolders_del_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data;item=l[t.selectedIndex];var d=0;for(curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)d++,curind++;if(!(d>0)||confirm("Children items will be deleted as well. Proceed?")){l.splice(t.selectedIndex,1+d);var a=wfu_update_subfolder_list(e);t.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),item=t,a!==item.oldVal&&(item.oldVal=a,document.getElementById("wfu_attribute_value_"+e).value=a,wfu_generate_shortcode())}}}function wfu_subfolders_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data,d=t.selectedIndex;item=l[d];var a=t.options,n=document.createElement("option");n.value="",n.innerHTML="",a.add(n,d),t.selectedIndex=d;var u=document.getElementById("wfu_subfolder_tools_"+e),o=document.getElementById("wfu_subfolders_path_"+e),r=document.getElementById("wfu_subfolders_label_"+e),_=document.getElementById("wfu_subfolders_ok_"+e),s=document.getElementById("wfu_subfolders_browse_"+e);u.className="wfu_subfolder_tools_container",r.disabled=!1,_.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=d,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=item.level,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",o.disabled=0==item.level,s.disabled=0==item.level,0==item.level?(o.value="{root}",r.value="{upload folder}"):(o.value="",r.value="");for(var c=document.getElementsByName("wfu_subfolder_nav_"+e),f=0;f<c.length;f++)c[f].disabled=!0}}function wfu_subfolders_browse_clicked(e){var t=wfu_GetHttpRequestObject();if(null!=t){var l=null;try{var l=new FormData}catch(d){}if(null!=l){for(var a=document.getElementById("wfu_global_dialog_container"),n=document.getElementById("wfu_subfolders_browser_"+e),u=document.getElementById("wfu_subfolders_browse_"+e),o=document.getElementById("wfu_subfolders_inner_shadow_"+e),r=document.getElementById("wfu_subfolders_browser_msgcont_"+e),_=document.getElementById("wfu_subfolders_browser_msg_"+e),s=document.getElementById("wfu_subfolders_browser_img_"+e),c=document.getElementById("wfu_subfolders_browser_ok_"+e),f=document.getElementById("wfu_subfolders_browser_list_"+e);f.options.length>0;)f.options.remove(0);c.disabled=!0,c.onclick=function(){wfu_folder_browser_cancel_clicked(e)},_.innerHTML="loading folder contents...",s.style.display="inline",r.style.display="block",a.style.display="block",n.style.display="block",n.style.left=u.offsetLeft+u.offsetWidth-n.offsetWidth+"px",n.style.top=u.offsetTop+u.offsetHeight-n.offsetHeight+"px",o.style.display="block",a.onclick=function(){wfu_folder_browser_cancel_clicked(e)};var i=document.getElementById("wfu_attribute_uploadpath").value;"/"==i.substr(i.length-1)&&(i=i.substr(0,i.length-1));var m=wfu_get_relative_path(e).split(","),w=i+m[0];"/"!=w.substr(0)&&(w="/"+w);var p="";2==m.length&&(p=m[1]),l.append("action","wfu_ajax_action_read_subfolders"),l.append("folder1",wfu_plugin_encode_string(w)),l.append("folder2",wfu_plugin_encode_string(p)),t.key=e,t.addEventListener("load",wfu_readfolderComplete,!1),t.addEventListener("error",wfu_readfolderFailed,!1),t.addEventListener("abort",wfu_readfolderCanceled,!1),t.open("POST",AdminParams.wfu_ajax_url),t.send(l)}}}function wfu_readfolderComplete(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msgcont_"+t),d=document.getElementById("wfu_subfolders_browser_msg_"+t),a=document.getElementById("wfu_subfolders_browser_img_"+t),n=document.getElementById("wfu_subfolders_browser_list_"+t),u=document.getElementById("wfu_subfolders_browser_ok_"+t),o=document.getElementById("wfu_subfolders_path_"+t),r=document.getElementById("wfu_subfolders_label_"+t),_=e.target.responseText;if(-1!=_){var s="wfu_read_subfolders:",c=e.target.responseText.indexOf(s);-1==c&&(c=e.target.responseText.length);var f=(e.target.responseText.substr(0,c),e.target.responseText.substr(c+s.length,e.target.responseText.length-c-s.length));c=f.indexOf(":");var i=f.substr(0,c);if(txt_value=f.substr(c+1,f.length-c-1),"success"==i){for(var m,w=wfu_plugin_decode_string(txt_value),p=w.split(","),g=0,v=0;v<p.length;v++)""!=p[v]&&(m=document.createElement("option"),m.value=p[v],m.innerHTML=p[v].replace("*","&nbsp;&nbsp;&nbsp;"),n.add(m),g++);0==g&&(m=document.createElement("option"),m.value="",m.innerHTML="{empty}",m.disabled=!0,n.add(m)),n.selectedIndex=-1,u.onclick=function(){var e=n.options[n.selectedIndex].value,l=parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+t).value);("*"==e.substr(0,1)||0==l)&&(document.getElementById("wfu_subfolders_newitemlevel_"+t).value=l+1,l>0&&(e=e.substr(1))),o.value=e,r.value=e,wfu_folder_browser_cancel_clicked(t),wfu_subfolders_ok_clicked(t)},l.style.display="none"}else"error"==i?(d.innerHTML=txt_value,a.style.display="none",u.disabled=!1):(d.innerHTML="Unknown error",a.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),d=document.getElementById("wfu_subfolders_browser_img_"+t),a=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",d.style.display="none",a.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),d=document.getElementById("wfu_subfolders_browser_img_"+t),a=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",d.style.display="none",a.disabled=!1}function wfu_subfolders_browser_list_changed(e){var t=document.getElementById("wfu_subfolders_browser_list_"+e),l=document.getElementById("wfu_subfolders_browser_ok_"+e);l.disabled=t.selectedIndex<0}function wfu_folder_browser_cancel_clicked(e){var t=document.getElementById("wfu_global_dialog_container"),l=document.getElementById("wfu_subfolders_browser_"+e),d=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,d.style.display="none",l.style.display="none",t.style.display="none"}function wfu_get_relative_path(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l,d=t.data,a="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;l=a?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):d[t.selectedIndex].level;for(var n="/",u=t.selectedIndex-1,o=l;u>=0&&o>1;)d[u].level<o&&(n="/"+d[u].path+n,o=d[u].level),u--;return a&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&l>0&&t.selectedIndex>0&&(n+=","+d[t.selectedIndex-1].path),n}}function wfu_subfolders_changed(e){wfu_update_subfolder_list(e),wfu_subfolders_update_toolnav(e)}function wfu_subfolders_update_toolnav(e){var t,l,d=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_subfolder_tools_"+e),n=document.getElementById("wfu_subfolders_path_"+e),u=document.getElementById("wfu_subfolders_label_"+e),o=document.getElementById("wfu_subfolders_ok_"+e),r=document.getElementById("wfu_subfolders_browse_"+e),_=document.getElementById("wfu_subfolders_auto_"+e);if(document.getElementById("wfu_subfolders_isnewitem_"+e).value="",document.getElementById("wfu_subfolders_newitemindex_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel_"+e).value="",document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="",null==d.data?(t=wfu_decode_subfolder_list(e),d.data=t):t=d.data,0===d.data.length?(d.className="wfu_select_folders wfu_select_folders_empty",d.options[0].innerHTML=_.checked?"":"press here"):d.className="wfu_select_folders",d.selectedIndex<0)a.className="wfu_subfolder_tools_container wfu_subfolder_tools_disabled",n.disabled=!0,u.disabled=!0,o.disabled=!0,r.disabled=!0,u.value="",n.value="";else if(d.selectedIndex>=d.options.length-1){a.className="wfu_subfolder_tools_container",u.disabled=!1,o.disabled=!0,document.getElementById("wfu_subfolders_isnewitem_"+e).value="1",document.getElementById("wfu_subfolders_newitemindex_"+e).value=t.length;var s;s=0==t.length?0:0==t[t.length-1].level?1:t[t.length-1].level,document.getElementById("wfu_subfolders_newitemlevel_"+e).value=s,document.getElementById("wfu_subfolders_newitemlevel2_"+e).value="1",n.disabled=0==s,r.disabled=!1,0==s?(n.value="{root}",u.value="{upload folder}"):(n.value="",u.value="")}else a.className="wfu_subfolder_tools_container",u.disabled=!1,o.disabled=!0,l=t[d.selectedIndex],n.disabled=0==l.level,r.disabled=0==l.level,u.value=l.label,n.value=l.path;var c=document.getElementsByName("wfu_subfolder_nav_"+e);if(d.selectedIndex<0||d.selectedIndex>=d.options.length-1)for(var f=0;f<c.length;f++)c[f].disabled=!0;else wfu_subfolders_update_nav(e)}function wfu_subfolders_update_nav(e){var t=document.getElementById("wfu_attribute_"+e),l=document.getElementById("wfu_subfolders_up_"+e),d=document.getElementById("wfu_subfolders_down_"+e),a=document.getElementById("wfu_subfolders_left_"+e),n=document.getElementById("wfu_subfolders_right_"+e),u=document.getElementById("wfu_subfolders_add_"+e),o=document.getElementById("wfu_subfolders_def_"+e),r=document.getElementById("wfu_subfolders_del_"+e),_=t.data,s=_[t.selectedIndex];for(l.disabled=s.index<=0,ind=t.selectedIndex+1,nextind=0;ind<_.length;){if(_[ind].level==s.level){nextind=_[ind].index;break}if(_[ind].level<s.level)break;ind++}d.disabled=0==s.level||0==nextind,a.disabled=0==t.selectedIndex&&s.level<1||t.selectedIndex>0&&s.level<=1,prevlevel=t.selectedIndex>=1?_[t.selectedIndex-1].level:0,n.disabled=s.level-prevlevel>0,u.disabled=0==s.level,o.disabled=!1,o.className="button"+(s.default?" wfu_subfolder_nav_pressed":""),r.disabled=!1}function wfu_decode_subfolder(e){var t={label:"",path:"",level:0,"default":!1};e=e.trim();for(var l=0,d=!1;l<e.length&&"*"==e.substr(l,1);)l++;e=e.substr(l,e.length-l),"&"==e.substr(0,1)&&(e=e.substr(1),d=!0),t.level=l,t.default=d;var a=e.split("/");return 1==a.length?(t.path=a[0],t.label=a[0]):a.length>1&&(t.path=a[0],t.label=a[1]),0==l&&(t.path="{root}",""==t.label&&(t.label="{upload folder}")),t}function wfu_decode_subfolder_list(e){for(var t,l=document.getElementById("wfu_attribute_"+e).options,d=Array(),a=["root"],n=[0],u=-1,o=0;o<l.length-1;o++){for(d.push(wfu_decode_subfolder(wfu_plugin_decode_string(l[o].value))),a.length>d[o].level?a[d[o].level]=d[o].path:a.push(d[o].path),t="",j=1;j<=d[o].level;j++)t+=a[j]+"/";d[o].fullpath=t,n.length<=d[o].level&&n.push(0),d[o].index=d[o].level>u?0:n[d[o].level]+1,n[d[o].level]=d[o].index,u=d[o].level}return d}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,l=document.getElementById("wfu_attribute_"+e),d=l.data;if(null!=d){var a,n,u="";t.length=d.length+1;for(var o=0;o<d.length;o++){for(a="",n="",j=0;j<d[o].level;j++)a+="*",n+="&nbsp;&nbsp;&nbsp;";d[o].default?(a+="&",t[o].className="wfu_select_folders_option_default"):t[o].className="",a+=d[o].path+"/"+d[o].label,n+=d[o].label,t[o].value=wfu_plugin_encode_string(a),t[o].innerHTML=n,""!=u&&(u+=","),u+=a}return t[d.length].value="",t[d.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,l){for(var d,a=0;a<e.childNodes.length;a++)d=e.childNodes[a],"INPUT"==d.tagName?"text"==d.type?(d.value=t,wfu_attach_element_handlers(d,wfu_update_userfield_value)):"checkbox"==d.type&&(d.checked=l):"DIV"==d.tagName&&(d.className="wfu_userdata_action")}function wfu_userdata_add_field(e){var t=e.parentNode,l=t.cloneNode(!0);wfu_userdata_edit_field(l,"",!1),t.parentNode.insertBefore(l,t.nextSibling)}function wfu_userdata_remove_field(e){for(var t=e.parentNode,l=t.parentNode,d=null,a=0;a<l.childNodes.length;a++)if(1===l.childNodes[a].nodeType){d=l.childNodes[a];break}if(t!=d){t.parentNode.removeChild(t);for(var a=0;a<d.childNodes.length;a++)if(1===d.childNodes[a].nodeType){wfu_update_userfield_value({target:d.childNodes[a]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_shortcode_tag").value,l=document.getElementById("wfu_attribute_defaults"),d=(document.getElementById("wfu_attribute_values"),""),a="",n="["+t,u="",o=0;o<l.childNodes.length;o++)e=l.childNodes[o],1===e.nodeType&&(d=e.id.replace("wfu_attribute_default_",""),a=document.getElementById("wfu_attribute_value_"+d).value,e.value!=a&&(u+=" "+d+'="'+a+'"'));n+=u+"]",document.getElementById("wfu_shortcode").value=n,ShortcodeString=u.substr(1),document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=wfu_plugin_encode_string(n)==document.getElementById("wfu_shortcode_original_enc").value),Autosave&&wfu_schedule_save_shortcode()}function wfu_update_text_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_",""),d=t.value;d=d.replace(/(\r\n|\n|\r)/gm,"%n%"),d=d.replace(/\"/gm,"%dq%"),d=d.replace(/\[/gm,"%brl%"),d=d.replace(/\]/gm,"%brr%"),d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+l).value=d,wfu_generate_shortcode())}function wfu_update_triplecolor_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_","");l=l.replace("_color",""),l=l.replace("_bgcolor",""),l=l.replace("_borcolor",""),t=document.getElementById("wfu_attribute_"+l+"_color");var d=t.value+","+document.getElementById("wfu_attribute_"+l+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+l+"_borcolor").value;d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+l).value=d,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,l=t.name.replace("wfu_dimension_elements_",""),d=document.getElementsByName(t.name);t=d[0];for(var a="",n="",u=0;u<d.length;u++)n=d[u].id.replace("wfu_attribute_"+l+"_",""),""!=a&&""!=d[u].value&&(a+=", "),""!=d[u].value&&(a+=n+":"+d[u].value);a!==t.oldVal&&(t.oldVal=a,document.getElementById("wfu_attribute_value_"+l).value=a,wfu_generate_shortcode())}function wfu_update_ptext_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_","");l=l.substr(2);var d=document.getElementById("wfu_attribute_s_"+l).value,a=document.getElementById("wfu_attribute_p_"+l).value,n=d+"/"+a;n!==t.oldVal&&(t.oldVal=n,document.getElementById("wfu_attribute_value_"+l).value=n),wfu_generate_shortcode()}function wfu_update_mchecklist_value(e){var t="",l=(document.getElementById("wfu_attribute_"+e),document.getElementById("wfu_attribute_"+e+"_all"));l.checked?(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!0),jQuery("#wfu_attribute_"+e+" input").prop("checked",!0),t="all"):(jQuery("#wfu_attribute_"+e+" input").prop("disabled",!1),jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked")&&(t+=","+jQuery(this).next().html())}),t=t.substr(1)),document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_rolelist_value(e){var t="",l=document.getElementById("wfu_attribute_"+e),d=document.getElementById("wfu_attribute_"+e+"_all");if(d.checked)l.disabled=!0,t="all";else{l.disabled=!1;for(var a=l.options,n=0;n<a.length;n++)a[n].selected&&(""!=t&&(t+=","),t+=a[n].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userlist_value(e){var t="",l=document.getElementById("wfu_attribute_"+e),d=document.getElementById("wfu_attribute_"+e+"_guests"),a=document.getElementById("wfu_attribute_"+e+"_all");if(a.checked)l.disabled=!0,d.disabled=!0,t="all";else{l.disabled=!1,d.disabled=!1;for(var n=l.options,u=0;u<n.length;u++)n[u].selected&&(""!=t&&(t+=","),t+=n[u].value);d.checked&&(""!=t&&(t+=","),t+="guests")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,l=t.parentNode,d=l.parentNode,a="",n=!1,u="",o=0;o<d.childNodes.length;o++)if(l=d.childNodes[o],"DIV"===l.tagName){for(var r=0;r<l.childNodes.length;r++)"INPUT"==l.childNodes[r].tagName&&("text"==l.childNodes[r].type?(a=l.childNodes[r].value,0==o&&(t=l.childNodes[r])):"checkbox"==l.childNodes[r].type&&(n=l.childNodes[r].checked));""!=u&&""!=a&&(u+="/"),""!=a&&n&&(u+="*"),""!=a&&(u+=a)}u!==t.oldVal&&(t.oldVal=u,document.getElementById("wfu_attribute_value_userdatalabel").value=u,wfu_generate_shortcode(),wfu_update_userfield_variables())}function wfu_update_userfield_variables(){var e=document.getElementById("wfu_attribute_value_userdatalabel");if(e){for(var t=document.getElementById("wfu_wrapper"),l=document.getElementsByClassName("wfu_shadow_userdata","div",t),d=document.getElementsByName("wfu_userfield_select"),a=0;a<d.length;a++)d[a].style.display="none";if(0!=l.length&&"block"!=l[0].style.display){for(var n='<option style="display:none;">%userdataXXX%</option>',u=e.value.split("/"),o="",a=1;a<=u.length;a++)o=u[a-1],"*"==o[0]&&(o=o.substr(1)),n+='<option value="%userdata'+a+'%">'+a+": "+o+"</option>";for(var a=0;a<d.length;a++)d[a].innerHTML=n,d[a].style.display="inline-block"}}}function wfu_attach_element_handlers(e,t){for(var l=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],d=0;d<l.length;d++)wfu_addEventHandler(e,l[d],t)}function wfu_Attach_Admin_Events(e){Autosave=e,wfu_generate_shortcode(),wfu_update_userfield_variables(),wfu_Attach_Admin_DragDrop_Events();for(var t=document.getElementsByName("wfu_text_elements"),l=0;l<t.length;l++)wfu_attach_element_handlers(t[l],wfu_update_text_value);for(var d=document.getElementsByName("wfu_ptext_elements"),l=0;l<d.length;l++)wfu_attach_element_handlers(d[l],wfu_update_ptext_value);for(var a=document.getElementsByName("wfu_triplecolor_elements"),l=0;l<a.length;l++)wfu_attach_element_handlers(a[l],wfu_update_triplecolor_value);for(var n=document.getElementsByName("wfu_dimension_elements_widths"),l=0;l<n.length;l++)wfu_attach_element_handlers(n[l],wfu_update_dimension_value);
2
+ n=document.getElementsByName("wfu_dimension_elements_heights");for(var l=0;l<n.length;l++)wfu_attach_element_handlers(n[l],wfu_update_dimension_value);for(var u=document.getElementsByName("wfu_userfield_elements"),l=0;l<u.length;l++)wfu_attach_element_handlers(u[l],wfu_update_userfield_value);for(var o=document.getElementsByName("wfu_subfolder_tools_input"),l=0;l<o.length;l++)wfu_attach_element_handlers(o[l],wfu_subfolders_input_changed);""!=document.getElementById("wfu_shortcode_postid").value&&setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}function wfu_insert_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),l=document.getElementById("wfu_attribute_"+t),d=l.selectionStart,a=l.value;l.value=a.substr(0,d)+e.innerHTML+a.substr(d),wfu_update_text_value({target:l})}function wfu_insert_userfield_variable(e){var t=e.className.replace("wfu_variable wfu_variable_",""),l=document.getElementById("wfu_attribute_"+t),d=l.selectionStart,a=l.value;l.value=a.substr(0,d)+e.value+a.substr(d),e.value="%userdataXXX%",wfu_update_text_value({target:l})}function wfu_columns_itemclicked(e){var t=e.parentNode;if("SELECT"==t.tagName)for(var l=0;l<t.options.length;l++)t.options[l].selected=t.options[l]==e}function wfu_columns_buttonaction(e,t){var l=document.getElementById("wfu_attribute_"+e+"_sourcelist"),d=document.getElementById("wfu_attribute_"+e);if("add"==t){for(var a=0;a<l.options.length;a++)if(l.options[a].selected||"wfu_columns_item_required"==l.options[a].className){for(var n=!1,u=0;u<d.options.length;u++)if(d.options[u].value==l.options[a].value){n=!0;break}if(!n){var o=document.createElement("OPTION");o.value=l.options[a].value,o.innerHTML=l.options[a].innerHTML,o.className=l.options[a].className,d.appendChild(o)}}}else if("del"==t)for(var a=0;a<d.options.length;)d.options[a].selected&&"wfu_columns_item_required"!=d.options[a].className?d.options.remove(a):a++;else if("up"==t||"down"==t){for(var r=-1,a=0;a<d.options.length;a++)d.options[a].selected&&-1==r?r=a:d.options[a].selected&&r>-1&&(d.options[a].selected=!1);"up"==t&&r>0?d.insertBefore(d.options[r],d.options[r-1]):"down"==t&&r<d.options.length-1&&d.insertBefore(d.options[r+1],d.options[r])}wfu_update_columns(e)}function wfu_update_columns(e){for(var t=document.getElementById("wfu_attribute_"+e),l="",d=0;d<t.options.length;d++)""!=l&&(l+=","),l+=t.options[d].value;document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode()}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(l){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(t){}return e}function wfu_plugin_encode_string(e){var t,l=0,d="",a="";for(l=0;l<e.length;l++)t=e.charCodeAt(l),t>=2048?t=((16773120&t|917504)<<4)+((4032&t|8192)<<2)+(63&t|128):t>=128&&(t=((65472&t|12288)<<2)+(63&t|128)),a=t.toString(16),(1==a.length||3==a.length||5==a.length)&&(a="0"+a),d+=a;return d}function wfu_plugin_decode_string(e){for(var t,l,d=0,a="";d<e.length;)t=parseInt(e.substr(d,2),16),l=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(d+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(d+=2,2),16))<<6)+(63&parseInt(e.substr(d+=2,2),16)),a+=String.fromCharCode(l),d+=2;return a}function wfu_schedule_save_shortcode(){var e=new Date,t=ShortcodeNextSave-e.getTime();null!=ShortcodeTimeOut&&(clearTimeout(ShortcodeTimeOut),ShortcodeTimeOut=null),0>=t?wfu_save_shortcode():ShortcodeTimeOut=setTimeout(function(){wfu_save_shortcode()},t)}function wfu_check_page_obsolescence(){PageObsolete||PageUpdating||""==document.getElementById("wfu_shortcode_postid").value}function wfu_save_shortcode(){if(!PageObsolete){var e=wfu_GetHttpRequestObject();if(null!=e){PageUpdating=!0,document.getElementById("wfu_update_failed_message").style.display="none";var t=AdminParams.wfu_ajax_url;params=new Array(7),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_save_shortcode",params[1]=new Array(2),params[1][0]="shortcode",params[1][1]=wfu_plugin_encode_string(ShortcodeString),params[2]=new Array(2),params[2][0]="shortcode_original",params[2][1]=document.getElementById("wfu_shortcode_original_enc").value,params[3]=new Array(2),params[3][0]="post_id",params[3][1]=document.getElementById("wfu_shortcode_postid").value,params[4]=new Array(2),params[4][0]="post_hash",params[4][1]=document.getElementById("wfu_shortcode_posthash").value,params[5]=new Array(2),params[5][0]="shortcode_position",params[5][1]=document.getElementById("wfu_shortcode_position").value,params[6]=new Array(2),params[6][0]="shortcode_tag",params[6][1]=document.getElementById("wfu_shortcode_tag").value;for(var l="",d=0;d<params.length;d++)l+=(d>0?"&":"")+params[d][0]+"="+encodeURI(params[d][1]);var a=new Date;Autosave?ShortcodeNextSave=a.getTime()+5e3:document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="inline"),e.open("POST",t,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){PageUpdating=!1;var t="wfu_save_shortcode:",l=e.responseText.indexOf(t);-1==l&&(l=e.responseText.length);var d=(e.responseText.substr(0,l),e.responseText.substr(l+t.length,e.responseText.length-l-t.length));l=d.indexOf(":");var n=d.substr(0,l);if(txt_value=d.substr(l+1,d.length-l-1),"success"==n){if(Autosave?(document.getElementById("wfu_save_label").innerHTML="saved",document.getElementById("wfu_save_label").className="wfu_save_label",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300),ShortcodeNextSave=a.getTime()+1e3,null!=ShortcodeTimeOut&&wfu_schedule_save_shortcode()):document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode_wait").style.display="none",document.getElementById("wfu_update_shortcode").disabled=!0,window.plugin_window&&window.plugin_window.location.reload(!0)),""!=document.getElementById("wfu_shortcode_postid").value){var u=document.getElementById("wfu_shortcode_tag").value;document.getElementById("wfu_shortcode_original_enc").value=wfu_plugin_encode_string("["+u+" "+ShortcodeString+"]"),document.getElementById("wfu_shortcode_posthash").value=txt_value,setTimeout(function(){wfu_check_page_obsolescence()},CheckObsolescenceTimeOut)}}else Autosave&&(document.getElementById("wfu_save_label").innerHTML="not saved",document.getElementById("wfu_save_label").className="wfu_save_label_fail",document.getElementById("wfu_save_label").style.opacity=1,wfu_fadeout_element(300)),"fail"==n&&("post_modified"==txt_value?(PageObsolete=!0,document.getElementById("wfu_update_shortcode")&&(document.getElementById("wfu_update_shortcode").disabled=!0),document.getElementById("wfu_update_rejected_message").style.display="block"):document.getElementById("wfu_update_failed_message").style.display="block")}},e.send(l)}}}function wfu_adjust_opacity(e){document.getElementById("wfu_save_label").style.opacity=e}function wfu_fadeout_element(e){for(var t=20,l=0,d=0;t>d;d++)l=1-d/t,setTimeout('wfu_adjust_opacity("'+l.toString()+'")',d*e/t);setTimeout('wfu_adjust_opacity("0.0")',d*e/t)}function wfu_apply_value(e,t,l){if("onoff"==t)document.getElementById("wfu_attribute_"+e).className="wfu_onoff_container_"+("true"!=l?"on":"off"),wfu_admin_onoff_clicked(e);else if("text"==t||"ltext"==t||"integer"==t||"float"==t||"mtext"==t||"color"==t){var d=document.getElementById("wfu_attribute_"+e);if(l=l.replace(/\%n\%/gm,"\n"),l=l.replace(/\%dq\%/gm,'"'),l=l.replace(/\%brl\%/gm,"["),l=l.replace(/\%brr\%/gm,"]"),"color"==t){var a=colourNameToHex(l);a||(a=l),jQuery("#wfu_attribute_"+e).wpColorPicker("color",a)}d.value=l,wfu_update_text_value({target:d})}else if("placements"==t)wfu_admin_recreate_placements_panel(l),document.getElementById("wfu_attribute_value_placements").value=l,wfu_generate_shortcode();else if("radio"==t){for(var n=document.getElementsByName("wfu_radioattribute_"+e),u=0;u<n.length;u++)n[u].checked=n[u].value==l||"*"+n[u].value==l;wfu_admin_radio_clicked(e)}else if("ptext"==t){l=l.replace(/\%n\%/gm,"\n"),l=l.replace(/\%dq\%/gm,'"'),l=l.replace(/\%brl\%/gm,"["),l=l.replace(/\%brr\%/gm,"]");var o=l.split("/"),r=o.length<1?"":o[0],_=o.length<2?r:o[1],s=document.getElementById("wfu_attribute_s_"+e);s.value=r;var c=document.getElementById("wfu_attribute_p_"+e);c.value=_,wfu_update_ptext_value({target:s}),wfu_update_ptext_value({target:c})}else if("mchecklist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var f=l.split(","),u=0;u<f.length;u++)f[u]=f[u].trim();jQuery("#wfu_attribute_"+e+" input").each(function(){jQuery(this).prop("checked",f.indexOf(jQuery(this).next().html())>-1)})}wfu_update_mchecklist_value(e)}else if("rolelist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var i=l.split(","),u=0;u<i.length;u++)i[u]=i[u].trim();for(var d=document.getElementById("wfu_attribute_"+e),u=0;u<d.options.length;u++)d.options[u].selected=i.indexOf(d.options[u].value)>-1}wfu_update_rolelist_value(e)}else if("userlist"==t){if(l=l.toLowerCase(),"all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var m=l.split(","),u=0;u<m.length;u++)m[u]=m[u].trim();for(var d=document.getElementById("wfu_attribute_"+e),u=0;u<d.options.length;u++)d.options[u].selected=m.indexOf(d.options[u].value)>-1;document.getElementById("wfu_attribute_"+e+"_guests").checked=m.indexOf("guests")>-1}wfu_update_userlist_value(e)}else if("columns"==t){var w=document.getElementById("wfu_attribute_"+e+"_sourcelist"),p=document.getElementById("wfu_attribute_"+e);p.innerHTML="";for(var g=l.split(","),u=0;u<w.options.length;u++)if("wfu_columns_item_required"==w.options[u].className&&-1==g.indexOf(w.options[u].value)){var v=document.createElement("OPTION");v.value=w.options[u].value,v.innerHTML=w.options[u].innerHTML,v.className=w.options[u].className,p.appendChild(v)}for(var u=0;u<g.length;u++){for(var b=-1,h=0;h<w.options.length;h++)if(w.options[h].value==g[u]){b=h;break}for(var y=!1,h=0;h<p.options.length;h++)if(p.options[h].value==g[u]){y=!0;break}if(b>-1&&!y){var v=document.createElement("OPTION");v.value=w.options[b].value,v.innerHTML=w.options[b].innerHTML,v.className=w.options[b].className,p.appendChild(v)}}wfu_update_columns(e)}else if("dimensions"==t){for(var I,E,B,d,k=l.split(","),x=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<x.length;u++)x[u].value="";for(var u=0;u<k.length;u++)I=k[u].split(":",2),E=I.length<1?"":I[0],B=I.length<2?E:I[1],d=document.getElementById("wfu_attribute_"+e+"_"+E.trim()),d&&(d.value=B.trim());d=x[0],wfu_update_dimension_value({target:d})}else if("userfields"==t){for(var N,T=l.split("/"),H=Array(),u=0;u<T.length;u++)N="*"==T[u].substr(0,1),N&&(T[u]=T[u].substr(1)),""!=T[u]&&H.push({name:T[u],required:N});for(var O=document.getElementById("wfu_attribute_"+e),A=null,C=Array(),u=0;u<O.childNodes.length;u++)1===O.childNodes[u].nodeType&&(null==A?A=O.childNodes[u]:C.push(O.childNodes[u]));for(var u=0;u<C.length;u++)O.removeChild(C[u]);wfu_userdata_edit_field(A,"",!1);for(var j,D=A,u=0;u<H.length;u++)0==u?wfu_userdata_edit_field(A,H[u].name,H[u].required):(j=D.cloneNode(!0),wfu_userdata_edit_field(j,H[u].name,H[u].required),O.insertBefore(j,D.nextSibling),D=j);for(var d,u=0;u<A.childNodes.length&&(d=A.childNodes[u],"INPUT"!=d.tagName);u++);wfu_update_userfield_value({target:d})}else if("color-triplet"==t){for(var L=l.split(","),u=0;u<L.length;u++)L[u]=L[u].trim();2==L.length?L=[L[0],L[1],"#000000"]:1==L.length?L=[L[0],"#FFFFFF","#000000"]:L.length<3&&(L=["#000000","#FFFFFF","#000000"]);var a=colourNameToHex(L[0]);a||(a=L[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",a);var d=document.getElementById("wfu_attribute_"+e+"_color");d.value=L[0],a=colourNameToHex(L[1]),a||(a=L[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",a),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=L[1],a=colourNameToHex(L[2]),a||(a=L[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",a),document.getElementById("wfu_attribute_"+e+"_borcolor").value=L[2],wfu_update_triplecolor_value({target:d})}else if("folderlist"==t){for(var f=wfu_parse_folderlist_js(l),S=document.getElementById("wfu_attribute_"+e).options;S.length>0;)S.remove(0);for(var v,M,V,P,q,R,u=0;u<f.path.length;u++){M=f.path[u],"/"==M.substr(M.length,1)&&(M=M.substr(0,M.length-1)),V=M.split("/"),M=V[V.length-1],q=parseInt(f.level[u]),P="",R="";for(var h=0;q>h;h++)P+="&nbsp;&nbsp;&nbsp;",R+="*";P+=f.label[u],f.default[u]&&(R+="&"),R+=""==M?"{root}/"+f.label[u]:M+f.label[u],v=document.createElement("option"),v.className=f.default[u]?"wfu_select_folders_option_default":"",v.value=wfu_plugin_encode_string(R),v.innerHTML=P,S.add(v)}v=document.createElement("option"),v.value="",v.innerHTML="",S.add(v);var F=document.getElementById("wfu_attribute_"+e);F.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),d=F,l!==d.oldVal&&(d.oldVal=l,document.getElementById("wfu_attribute_value_"+e).value=l,wfu_generate_shortcode())}}function wfu_parse_folderlist_js(e){var t=Object();if(t.path=Array(),t.label=Array(),t.level=Array(),t.default=Array(),"auto"==e.substr(0,4))return t;var l=e.split(",");if(0==l.length)return t;if(1==l.length&&""==l[0].trim())return t;for(var d,a,n,u,o,r,_,s=["root"],c=0,f=0,i=-1,m=0;m<l.length;m++){for(d=l[m].trim(),a=0,n="",u=!1;a<d.length&&"*"==d.substr(a,1);)a++,n+="&nbsp;&nbsp;&nbsp;";if(1>=a-c&&(a>0||0==f)&&(d=d.substr(a,d.length-a),"&"==d.substr(0,1)&&(d=d.substr(1),u=!0),subfolder_items=d.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(o=subfolder_items[0],r=subfolder_items[1]):(o=d,r=d),""!=o)){u&&-1==i?i=t.path.length:u=!1,0==a&&(f=1),s.length>a?s[a]=o:s.push(o),_="";for(var w=1;a>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(r),t.level.push(a),t.default.push(u),c=a}}return t}function colourNameToHex(e){var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};return"undefined"!=typeof t[e.toLowerCase()]?t[e.toLowerCase()]:!1}function wfu_download_file(e,t,l){var d=wfu_GetHttpRequestObject();if(null!=d){var a=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_invoker",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="nonce",params[2][1]=l;for(var n="",u=0;u<params.length;u++)n+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);d.open("POST",a,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){var l="wfu_ajax_action_download_file_invoker:",a=d.responseText.indexOf(l);-1==a&&(a=d.responseText.length);var n=(d.responseText.substr(0,a),d.responseText.substr(a+l.length,d.responseText.length-a-l.length));a=n.indexOf(":");var u=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"wfu_download_id;"==u.substr(0,16)){var o=u.substr(16),r=document.getElementById("wfu_file_download_container_"+t);r.innerHTML=txt_value,setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+o+"')",100)}}},d.send(n)}}function wfu_download_file_monitor(e,t,l){var d=wfu_GetHttpRequestObject();if(null!=d){var a=AdminParams.wfu_ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_download_file_monitor",params[1]=new Array(2),params[1][0]="file",params[1][1]=e,params[2]=new Array(2),params[2][0]="id",params[2][1]=l;for(var n="",u=0;u<params.length;u++)n+=(u>0?"&":"")+params[u][0]+"="+encodeURI(params[u][1]);d.open("POST",a,!0),d.setRequestHeader("Content-type","application/x-www-form-urlencoded"),d.onreadystatechange=function(){if(4==d.readyState&&200==d.status){var l="wfu_ajax_action_download_file_monitor:",a=d.responseText.indexOf(l);-1==a&&(a=d.responseText.length);var n=(d.responseText.substr(0,a),d.responseText.substr(a+l.length,d.responseText.length-a-l.length));a=n.indexOf(":");var u=n.substr(0,a);if(txt_value=n.substr(a+1,n.length-a-1),"repeat"!=u){var o=document.getElementById("wfu_file_download_container_"+t);o.innerHTML=""}else"repeat"==u&&setTimeout("wfu_download_file_monitor('"+e+"', "+t+", '"+txt_value+"')",100)}},d.send(n)}}function wfu_filedetails_userdata_changed(){for(var e,t,l=document.getElementsByName("wfu_filedetails_userdata"),d=!1,a=0;a<l.length;a++)if(e=document.getElementById(l[a].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(l[a].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=l[a].value,l[a].value!=e.value){d=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!d}function wfu_Attach_FileDetails_Admin_Events(){for(var e=document.getElementsByName("wfu_filedetails_userdata"),t=0;t<e.length;t++)wfu_attach_element_handlers(e[t],wfu_filedetails_userdata_changed)}function wfu_update_browserpermission_option(e,t){var l=document.getElementById("wfu_fbperm_users"),d=document.getElementById("wfu_fbperm_roles"),a=document.getElementById("wfu_fbperm_"+e+"_"+t+"_view"),n=document.getElementById("wfu_fbperm_"+e+"_"+t+"_dl"),u=document.getElementById("wfu_fbperm_"+e+"_"+t+"_edit"),o=document.getElementById("wfu_fbperm_"+e+"_"+t+"_del");if("role"==e){if("0"==t){n.checked=a.checked&&n.checked,u.checked=a.checked&&u.checked,o.checked=a.checked&&o.checked,n.disabled=!a.checked,u.disabled=!a.checked,o.disabled=!a.checked;for(var r=d.value.split(","),_=0;_<r.length;_++){var s=r[_].indexOf("["),c=r[_].substr(0,s);"0"!=c&&wfu_update_browserpermission_option("role",c)}var f=(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(o.checked?"l":"");d.value=d.value.replace(/^0\[\w*\]/,"0["+f+"]")}else if("administrator"!=t){var i=document.getElementById("wfu_fbperm_role_"+t+"_row"),m=document.getElementById("wfu_fbperm_role_"+t+"_def"),w=document.getElementById("wfu_fbperm_role_0_view"),p=document.getElementById("wfu_fbperm_role_0_dl"),g=document.getElementById("wfu_fbperm_role_0_edit"),v=document.getElementById("wfu_fbperm_role_0_del");a.checked=m.checked?w.checked:a.checked,i.style.fontWeight=m.checked?"":"bold",n.checked=m.checked?p.checked:a.checked&&n.checked,u.checked=m.checked?g.checked:a.checked&&u.checked,o.checked=m.checked?v.checked:a.checked&&o.checked,a.disabled=m.checked,n.disabled=m.checked||!a.checked,u.disabled=m.checked||!a.checked,o.disabled=m.checked||!a.checked;var f=m.checked?"":"D"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(o.checked?"l":"");d.value=d.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+f+"]")}for(var b=l.value.split(","),_=0;_<b.length;_++){var s=b[_].indexOf("["),h=b[_].substr(0,s);"0"!=h&&wfu_update_browserpermission_option("user",h)}}else if("user"==e){var y=document.getElementById("wfu_fbperm_user_"+t+"_role");if("0"==t){a.checked=y.checked?!1:a.checked,n.checked=y.checked?!1:a.checked&&n.checked,u.checked=y.checked?!1:a.checked&&u.checked,o.checked=y.checked?!1:a.checked&&o.checked,a.disabled=y.checked,n.disabled=y.checked||!a.checked,u.disabled=y.checked||!a.checked,o.disabled=y.checked||!a.checked,a.indeterminate=y.checked,n.indeterminate=y.checked,u.indeterminate=y.checked,o.indeterminate=y.checked;for(var b=l.value.split(","),_=0;_<b.length;_++){var s=b[_].indexOf("["),h=b[_].substr(0,s);"0"!=h&&wfu_update_browserpermission_option("user",h)}var f=y.checked?"":"R"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(o.checked?"l":"");l.value=l.value.replace(/^0\[\w*\]/,"0["+f+"]")}else{var I=document.getElementById("wfu_fbperm_user_"+t+"_roles").value.split(",");if(1==I.length&&""==I[0]&&(I=Array()),I.indexOf("administrator")<0){var i=document.getElementById("wfu_fbperm_user_"+t+"_row"),m=document.getElementById("wfu_fbperm_user_"+t+"_def"),E=document.getElementById("wfu_fbperm_user_0_role"),w=document.getElementById("wfu_fbperm_user_0_view"),p=document.getElementById("wfu_fbperm_user_0_dl"),g=document.getElementById("wfu_fbperm_user_0_edit"),v=document.getElementById("wfu_fbperm_user_0_del");if(I.length>0)for(var B=!1,k=!1,x=!1,N=!1,_=0;_<I.length;_++)B=B||document.getElementById("wfu_fbperm_role_"+I[_]+"_view").checked,k=B&&(k||document.getElementById("wfu_fbperm_role_"+I[_]+"_dl").checked),x=B&&(x||document.getElementById("wfu_fbperm_role_"+I[_]+"_edit").checked),N=B&&(N||document.getElementById("wfu_fbperm_role_"+I[_]+"_del").checked);else var B=document.getElementById("wfu_fbperm_role_0_view"),k=document.getElementById("wfu_fbperm_role_0_dl"),x=document.getElementById("wfu_fbperm_role_0_edit"),N=document.getElementById("wfu_fbperm_role_0_del");i.style.fontWeight=m.checked?"":"bold",y.checked=m.checked?E.checked:y.checked,a.checked=m.checked?E.checked?B:w.checked:y.checked?B:a.checked,n.checked=m.checked?E.checked?k:p.checked:y.checked?k:a.checked&&n.checked,u.checked=m.checked?E.checked?x:g.checked:y.checked?x:a.checked&&u.checked,o.checked=m.checked?E.checked?N:v.checked:y.checked?N:a.checked&&o.checked,y.disabled=m.checked,a.disabled=m.checked||y.checked,n.disabled=m.checked||y.checked||!a.checked,u.disabled=m.checked||y.checked||!a.checked,o.disabled=m.checked||y.checked||!a.checked;var f=m.checked?"":"D"+(y.checked?"":"R"+(a.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(o.checked?"l":""));l.value=l.value.replace(new RegExp(","+t+"\\[\\w*\\]"),","+t+"["+f+"]")}}}}var DraggedItem=null,ShortcodeNextSave=0,ShortcodeTimeOut=null,ShortcodeString="",Autosave=!1,PageObsolete=!1,PageUpdating=!1,CheckObsolescenceTimeOut=5e3;jQuery(document).ready(function(e){e(".wfu_color_field").wpColorPicker({change:function(e,t){e.target.value=t.color.toString(),"wfu_text_elements"==e.target.name?wfu_update_text_value(e):"wfu_triplecolor_elements"==e.target.name&&wfu_update_triplecolor_value(e)}})});
js/wordpress_file_upload_functions.js CHANGED
@@ -1,2 +1,2 @@
1
- function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),s=0;s<a.length;s++)const_txt=a[s].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var a=document.getElementById("selectsubdiredit_"+e);a&&"none"!=a.style.display&&wfu_attach_element_handlers(a,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(s){}wfu_BrowserCaps.supportsHTML5=null!=a;var s=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=s,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",s="",t="Webkit Moz O ms Khtml".split(" "),n="",r=document.createElement("DIV");if(r.style.animationName&&(e=!0),e===!1)for(var l=0;l<t.length;l++)if(void 0!==r.style[t[l]+"AnimationName"]){n=t[l],a=n+"Animation",s="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),s="",t="",n=1;n<a.length;n++)t=""==s||""==a[n]?"":e,s+=t+a[n];return s}function wfu_plugin_decode_string(e){for(var a,s,t=0,n="";t<e.length;)a=parseInt(e.substr(t,2),16),s=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(t+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(t+=2,2),16))<<6)+(63&parseInt(e.substr(t+=2,2),16)),n+=String.fromCharCode(s),t+=2;return n}function wfu_plugin_encode_string(e){var a=0,s="",t="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),t=num.toString(16),(1==t.length||3==t.length||5==t.length)&&(t="0"+t),s+=t;return s}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",s=e,t="",n=0;s>n;n++){var r=Math.floor(Math.random()*a.length);t+=a.substring(r,r+1)}return t}function wfu_addEventHandler(e,a,s){e.addEventListener?e.addEventListener(a,s,!1):e.attachEvent?e.attachEvent("on"+a,s):e["on"+a]=s}function wfu_attach_element_handlers(e,a){for(var s=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],t=0;t<s.length;t++)wfu_addEventHandler(e,s[t],a)}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(s){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,s){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),r=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);s?(t.style.display="",n.style.display="none",r.style.display="",l.value=""):(t.style.display="none",n.style.display="",r.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),s="wfu_messageblock_"+e+"_",t=[];null!=a;)1===a.nodeType&&a.id.substr(0,s.length)==s&&t.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return t}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var s=document.getElementById("upfile_"+e),t=s.files;return t||(t=s.value?[{name:s.value}]:[]),a&&"undefined"!=typeof s.filearray&&(t=s.filearray),t}function wfu_filedetails_toggle(e,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==s.style.display)}function wfu_headerdetails_showhide(e,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),t=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),r=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),i=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(a){s.style.display="",t.style.display="none",("none"!=r.style.display||"none"!=l.style.display)&&(n.style.display=""),i.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{s.style.display="none",t.style.display="",n.style.display="none",i.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var s=document.getElementById("upfile_"+e),t=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof s.filearray&&(s.filearray=Array());for(var n=0;n<t.length;n++)s.filearray.push(t[n])}else"undefined"!=typeof s.filearray&&delete s.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var s=document.getElementById("fileName_"+e);s&&(s.value="",s.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var s=wfu_get_filelist(e),t=s.length>0;a.disabled=!t}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var s=wfu_get_filelist(e),t="",n=0;n<s.length;n++)""!=t&&(t+=", "),t+=s[n].name.replace(/c:\\fakepath\\/i,"");a.value=t}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var s=document.getElementById("selectsubdiredit_"+e),t="none"!=s.style.display;return t&&a.selectedIndex>0&&(s.value=a.value.replace(/^\s+/,""),s.className="file_item_clean_match",wfu_selectsubdiredit_change(e)),document.getElementById("hiddeninput_"+e).value=t?s.value:a.selectedIndex,!t&&0==a.selectedIndex||t&&(""==s.value||"file_item_clean_empty"==s.className)?(a.className="file_item_clean_prompt",t&&(s.className="file_item_clean_prompt",s.value=""),!1):(a.className="file_item_clean",t&&"file_item_clean_prompt"==s.className&&(s.className="file_item_clean"),a.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var a=document.getElementById("selectsubdir_"+e),s=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty"==s.className&&(s.value=""),a.className="file_item_clean",s.className="file_item_clean"}function wfu_selectsubdiredit_exit(e){var a=document.getElementById("selectsubdiredit_"+e);""==a.value&&(a.value=GlobalData.consts.wfu_subdir_typedir,a.className="file_item_clean_empty")}function wfu_selectsubdiredit_change(e){var a=document.getElementById("selectsubdir_"+e),s=document.getElementById("selectsubdiredit_"+e);if("none"!=s.style.display){if("file_item_clean_empty"==s.className)return a.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=s.value;for(var t,n=!1,r=1;r<a.options.length;r++)t=a.options[r].value.replace(/^\s+/,"").toLowerCase(),a.options[r].style.display=s.value.length>=3?t.substr(0,s.value.length)==s.value.toLowerCase()?"block":"none":"block",a.options[r].value.replace(/^\s+/,"")==s.value&&(a.selectedIndex=r,s.className="file_item_clean_match",n=!0);n||(a.selectedIndex=0,s.className="file_item_clean")}}function wfu_selectsubdir_disable_onoff(e,a){var s=document.getElementById("selectsubdir_"+e);if(!s)return!0;var t=document.getElementById("selectsubdiredit_"+e),n="none"!=t.style.display;s.disabled=a,n&&(t.disabled=a)}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,s,t){t&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[s],r=0,l=0,i=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var o=0;o<GlobalData[a].xhrs.length;o++)GlobalData[a].xhrs[o].file_id==n.file_id&&(GlobalData[a].xhrs[o].totalsize+=l)}if(i){for(var _=0,d=0,u=[],o=0;o<GlobalData[a].xhrs.length;o++)u[GlobalData[a].xhrs[o].file_id]=0;for(var o=0;o<GlobalData[a].xhrs.length;o++)u[GlobalData[a].xhrs[o].file_id]=Math.max(GlobalData[a].xhrs[o].totalsize,u[GlobalData[a].xhrs[o].file_id]);for(var o=0;o<u.length;o++)"undefined"!=typeof u[o]&&(_+=u[o]);for(var o=0;o<GlobalData[a].xhrs.length;o++)d+=GlobalData[a].xhrs[o].sizeloaded;r=Math.round(100*d/_),i.style.width=r.toString()+"%"}}else i&&(i.style.width="0%")}function wfu_notify_WPFilebase(e,a){var s=wfu_GetHttpRequestObject();if(null==s){var t=document.createElement("iframe");return t.style.display="none",t.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(t)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var r="",t=0;t<params.length;t++)r+=(t>0?"&":"")+params[t][0]+"="+encodeURI(params[t][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){},s.send(r)}function wfu_send_email_notification(e,a,s,t,n,r,l,i,o){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=s,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=t,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=r,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var f=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=i,_.is_admin=o,_.params_index=s,_.session_token=t,_.start_time=f.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,s=this.shortcode_id,t=(this.file_id,!1),n="",r="",l="",i="unknown",o="",_="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var d=e.target.responseText,u=d,m="error";if(-1!=d&&d.indexOf("force_errorabort_code")>-1&&(m="errorabort",d=d.replace("force_errorabort_code","")),-1!=d){var c=d.indexOf(_);if(c>-1&&("true"==this.debugmode&&(o=d.substr(0,c)),u=d.substr(c+_.length),c=u.indexOf(":"),n=u.substr(0,c),u=u.substr(c+1),c=u.indexOf(":"),l=u.substr(0,c),r=u.substr(c+1)),""!=o){var f="";"fileupload"==this.requesttype?f=" - File: "+this.file_id:"email"==this.requesttype&&(f=" - Email Notification"),o=wfu_format_debug_data(o,f)}if(""!=l){var p=l.split(";");if(1==parseInt(p[2])){var g=p[3].split(",");i=wfu_plugin_decode_string(g[0])}}}if(""==r||""==l){var b=this.fail_colors.split(","),y=wfu_Initialize_Params();y.general.shortcode_id=s,y.general.unique_id=this.unique_id,y.general.state=7,y.general.files_count="fileupload"==this.requesttype?1:0,y.general.upload_finish_time=this.finish_time,y.general.fail_message=GlobalData.consts.message_unknown,y.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+u),y.general.files_count>0?(y[0]={},y[0].color=b[0],y[0].bgcolor=b[1],y[0].borcolor=b[2],y[0].message_type=m,i=m,y[0].header=this.error_message_header,y[0].message=GlobalData.consts.message_timelimit,y[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):y.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",y.general.upload_finish_time>0&&a.getTime()<y.general.upload_finish_time&&(y.general.files_count>0?(y[0].message=y.general.fail_message,y[0].admin_messages="true"==this.is_admin?y.general.fail_admin_message:""):y.general.admin_messages.other="true"==this.is_admin?y.general.fail_admin_message:"")}return t=""==r||""==l?wfu_ProcessUploadComplete(s,this.file_id,y,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,o,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(s,this.file_id,r,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,o,this.is_admin],this.requesttype,n),t&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(s),wfu_clear(e.target.shortcode_id)),e.target.return_status?i:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,G.upload_state=UploadStates_Ok?Params.general.state:10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_show?subheader_state.value:"none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",file_block.style.display=single_file_shown?"":subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var s=e.target,t={target:{responseText:"",shortcode_id:s.shortcode_id}};wfu_uploadComplete.call(s,t)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,s,t){var n=wfu_GetHttpRequestObject();if(null!=n){var r=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="uniqueuploadid_"+e,params[1][1]=a,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=s,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var l="",i=0;i<params.length;i++)l+=(i>0?"&":"")+params[i][0]+"="+encodeURI(params[i][1]);n.open("POST",r,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,s,t){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,s,t,[""])}function wfu_redirect_to_classic_cont(e,a,s,t){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var r=wfu_Initialize_Params();if(r.general.shortcode_id=e,r.general.unique_id="",r.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,r,"no-ajax","",a,"",["false","","false"]),1==s){var l="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+l}document.getElementById("adminerrorcodes_"+e).value=t>0?t:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(10),document.getElementById("uploadform_"+e).submit()}},r="",l=new Date,i=GlobalData.consts.ajax_url+"?action=wfu_ajax_action&sid="+e+"&start_time="+l.getTime()+"&session_token="+a+r;wfu_lock_upload(e);var o=wfu_GetHttpRequestObject();if(null==o){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=i,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}o.open("GET",i,!0),o.onreadystatechange=function(){4==o.readyState&&200==o.status&&n(o.responseText)},o.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),s=wfu_get_filelist(e);return 0==s.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),s.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),s=!1,t=0;a>t;t++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+t),r=document.getElementById("userdata_"+e+"_message_"+t),l="file_userdata_message_required";r.className.substr(0,l.length)==l&&""==n.value&&(r.className=l+"_empty",r.value=GlobalData.consts.userdata_empty,s=!0)}return!s}function wfu_HTML5UploadFile(e,a,s){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,s,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,s,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var t=null;try{t=JSON.parse(a)}catch(n){}if(null==t)return void wfu_redirect_to_classic(e,s,1,3);var r=wfu_GetHttpRequestObject();if(null!=r){var l=wfu_filesselected(e);if(0!=l){var i=document.getElementById("upload_"+e),o=!i;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;return _+=_,wfu_check_required_userdata(e)?void wfu_HTML5UploadFile_cont(e,t,s,[""]):void(o&&wfu_clear_files(e))}}}function wfu_HTML5UploadFile_cont(e,a,s){function t(r,l,i,m){f=!0;var p=wfu_GetHttpRequestObject(),g=wfu_GetHttpRequestObject();if(null!=p&&null!=g){var b=null,y=null;try{var b=new FormData,y=new FormData}catch(w){}if(null!=b&&null!=y){i||b.append("uploadedfile_"+e+_,l),b.append("uploadedfile_"+e+"_index",r),b.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(o[r].name)),b.append("uploadedfile_"+e+"_size",o[r].size),b.append("action","wfu_ajax_action"),b.append("uniqueuploadid_"+e,u),b.append("params_index",a.params_index),b.append("subdir_sel_index",n),i?b.append("only_check","1"):b.append("only_check","0"),b.append("session_token",s),b.append("unique_id",d);
2
- for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)b.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var G=GlobalData[e].xhrs.push(p)-1,k=new Date;if(p.xhrid=G,p.shortcode_id=e,p.requesttype="fileupload",p.file_id=r+1,i?(p.size=0,p.totalsize=0,p.loading=!1):(p.size=l.size,p.totalsize=o[r].size,p.loading=!0),p.deltasize=0,p.sizeloaded=0,p.aborted=!1,p.unique_id=u,p.params_index=a.params_index,p.session_token=s,p.debugmode=a.debugmode,p.is_admin=a.is_admin,p.start_time=k.getTime(),p.end_time=p.start_time,p.finish_time=p.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),p.fail_colors=a.fail_colors,p.error_message_header=a.error_header.replace(/%username%/g,"no data"),p.error_message_header=p.error_message_header.replace(/%useremail%/g,"no data"),p.error_message_header=p.error_message_header.replace(/%filename%/g,o[r].name),p.error_message_header=p.error_message_header.replace(/%filepath%/g,o[r].name),p.error_message_failed=GlobalData.consts.message_failed,p.error_message_cancelled=GlobalData.consts.message_cancelled,p.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),p.error_adminmessage_unknown=p.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),p.error_adminmessage_unknown=p.error_adminmessage_unknown.replace(/%filename%/g,o[r].name),p.error_adminmessage_unknown=p.error_adminmessage_unknown.replace(/%filepath%/g,o[r].name),m){y.append("action","wfu_ajax_action"),y.append("params_index",a.params_index),y.append("session_token",s),y.append("force_connection_close","1"),g.open("POST",GlobalData.consts.ajax_url,!1);try{g.send(y)}catch(I){}f="success"==g.responseText}if(f)i?(p.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var s=wfu_uploadComplete.call(p,a);f="success"==s||"warning"==s,f&&t(r,l,!1,!1)},!1),p.addEventListener("error",function(){},!1),p.open("POST",GlobalData.consts.ajax_url,!0),p.send(b)):(p.upload.xhr=p,p.upload.dummy=1,p.upload.addEventListener("loadstart",wfu_loadStart,!1),p.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+G+", "+a.debugmode+");"),!1),p.addEventListener("load",wfu_uploadComplete,!1),p.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),p.addEventListener("abort",wfu_uploadCanceled,!1),p.open("POST",GlobalData.consts.ajax_url,!0),p.send(b));else{var E={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(p,E)}return c++,f}}}var n=-1,r=document.getElementById("selectsubdir_"+e);if(r){var l=document.getElementById("selectsubdiredit_"+e),i="none"!=l.style.display;n=i?l.value:r.selectedIndex}var o=wfu_get_filelist(e),_="",d=wfu_randomString(10),u=d;GlobalData.UploadInProgressString+="["+u+"]",GlobalData[e]={},GlobalData[e].unique_id=u,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");var m=wfu_Initialize_Params();m.general.shortcode_id=e,m.general.unique_id=u,wfu_ProcessUploadComplete(e,0,m,u,a.params_index,s,"",["false","","false"]);var c=0,f=!0,p=0;t(p,o[p],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0,wfu_selectsubdir_disable_onoff(e,!0);var s=document.getElementById("upload_"+e);s&&(s.disabled=!0);for(var t=wfu_get_userdata_count(e),n=0;t>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1,wfu_selectsubdir_disable_onoff(e,!1);var s=document.getElementById("upload_"+e);s&&(s.disabled=!1);for(var t=wfu_get_userdata_count(e),n=0;t>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!1}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var a=document.getElementById("selectsubdir_"+e);if(a){var s=document.getElementById("selectsubdiredit_"+e),t="none"!=s.style.display;t?(a.selectedIndex=-1,s.value=""):a.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value)}for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+r).value=""}function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var s=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(s.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",s.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var t=wfu_get_file_ids(e),n=1;n<=t.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var s=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");s&&("progressive"==a?(s.style.width="0%",s.className="file_progress_progressive",t.style.display="none",s.style.display="block"):wfu_BrowserCaps.supportsAnimation?(s.style.width="25%",s.className="file_progress_shuffle",t.style.display="none",s.style.display="block"):(s.style.width="0%",s.className="file_progress_noanimation",s.style.display="none",t.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",s.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,s){for(var t=document.getElementsByTagName("BUTTON"),n=0,r=null,l=0;l<t.length;l++)t[l].parentNode&&t[l].parentNode.id=="wordpress_file_upload_editor_"+e&&(r=t[l],n++);if(0!=n){if(n>1)return void alert(GlobalData.consts.same_pluginid);var i=wfu_GetHttpRequestObject();if(null!=i){r.parentNode.style.display="none",document.getElementById("wordpress_file_upload_overlay_"+e).style.display="block";var o=GlobalData.consts.ajax_url;params=new Array(4),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=s;for(var _="",l=0;l<params.length;l++)_+=(l>0?"&":"")+params[l][0]+"="+encodeURI(params[l][1]);i.open("POST",o,!0),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState&&200==i.status){document.getElementById("wordpress_file_upload_overlay_"+e).style.display="none",r.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",s=i.responseText.indexOf(a);-1==s&&(s=i.responseText.length);var t=(i.responseText.substr(0,s),i.responseText.substr(s+a.length,i.responseText.length-s-a.length));s=t.indexOf(":");var n=t.substr(0,s);if(txt_value=t.substr(s+1,t.length-s-1),"success"==n){var l=window.open(wfu_plugin_decode_string(txt_value),"_blank");l.plugin_window=window}else"check_page_obsolete"==n&&alert(txt_value)}},i.send(_)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
1
+ function wfu_Initialize_Consts(e){if("undefined"==typeof GlobalData.consts){GlobalData.consts=new Object;for(var a=e.split(";"),s=0;s<a.length;s++)const_txt=a[s].split(":"),GlobalData.consts[wfu_plugin_decode_string(const_txt[0])]=wfu_plugin_decode_string(const_txt[1])}}function wfu_plugin_load_action(e){wfu_install_unload_hook();var a=document.getElementById("selectsubdiredit_"+e);a&&"none"!=a.style.display&&wfu_attach_element_handlers(a,new Function("wfu_selectsubdiredit_change("+e+");"))}function wfu_install_unload_hook(){window.onbeforeunload=wfu_unload_hook}function wfu_unload_hook(){return""!=GlobalData.UploadInProgressString&&""!=GlobalData.UploadInProgressString.trim()?GlobalData.consts.wfu_pageexit_prompt:void 0}function wfu_Check_Browser_Capabilities(){if("undefined"==typeof wfu_BrowserCaps){wfu_BrowserCaps=new Object;var e=wfu_GetHttpRequestObject();wfu_BrowserCaps.supportsAJAX=null!=e,wfu_BrowserCaps.supportsUploadProgress=!!(e&&"upload"in e&&"onprogress"in e.upload);var a=null;try{var a=new FormData}catch(s){}wfu_BrowserCaps.supportsHTML5=null!=a;var s=document.createElement("iframe");wfu_BrowserCaps.supportsIFRAME=null!=s,wfu_BrowserCaps.supportsDRAGDROP=window.FileReader?!0:!1,wfu_BrowserCaps.supportsAnimation=wfu_check_animation(),wfu_BrowserCaps.isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0}}function wfu_check_animation(){var e=!1,a="animation",s="",t="Webkit Moz O ms Khtml".split(" "),n="",r=document.createElement("DIV");if(r.style.animationName&&(e=!0),e===!1)for(var l=0;l<t.length;l++)if(void 0!==r.style[t[l]+"AnimationName"]){n=t[l],a=n+"Animation",s="-"+n.toLowerCase()+"-",e=!0;break}return e}function wfu_join_strings(e){for(var a=[].slice.call(arguments),s="",t="",n=1;n<a.length;n++)t=""==s||""==a[n]?"":e,s+=t+a[n];return s}function wfu_plugin_decode_string(e){for(var a,s,t=0,n="";t<e.length;)a=parseInt(e.substr(t,2),16),s=128>a?a:224>a?((31&a)<<6)+(63&parseInt(e.substr(t+=2,2),16)):((15&a)<<12)+((63&parseInt(e.substr(t+=2,2),16))<<6)+(63&parseInt(e.substr(t+=2,2),16)),n+=String.fromCharCode(s),t+=2;return n}function wfu_plugin_encode_string(e){var a=0,s="",t="";for(a=0;a<e.length;a++)num=e.charCodeAt(a),num>=2048?num=((16773120&num|917504)<<4)+((4032&num|8192)<<2)+(63&num|128):num>=128&&(num=((65472&num|12288)<<2)+(63&num|128)),t=num.toString(16),(1==t.length||3==t.length||5==t.length)&&(t="0"+t),s+=t;return s}function wfu_randomString(e){for(var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",s=e,t="",n=0;s>n;n++){var r=Math.floor(Math.random()*a.length);t+=a.substring(r,r+1)}return t}function wfu_addEventHandler(e,a,s){e.addEventListener?e.addEventListener(a,s,!1):e.attachEvent?e.attachEvent("on"+a,s):e["on"+a]=s}function wfu_attach_element_handlers(e,a){for(var s=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],t=0;t<s.length;t++)wfu_addEventHandler(e,s[t],a)}function wfu_GetHttpRequestObject(){var e=null;try{e=new XMLHttpRequest}catch(a){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(s){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}}if(null==e&&window.createRequest)try{xmlhttp=window.createRequest()}catch(a){}return e}function wfu_filedetails_showhide(e,a,s){var t=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a)),n=document.getElementById("wfu_messageblock_arrow_"+e+"_down_"+a),r=document.getElementById("wfu_messageblock_subheader_"+e+"_"+a),l=document.getElementById("wfu_messageblock_header_"+e+"_state_"+a);s?(t.style.display="",n.style.display="none",r.style.display="",l.value=""):(t.style.display="none",n.style.display="",r.style.display="none",l.value="none")}function wfu_get_file_ids(e){for(var a=(document.getElementById("wfu_messageblock_"+e),document.getElementById("wfu_messageblock_subheader_"+e).nextSibling),s="wfu_messageblock_"+e+"_",t=[];null!=a;)1===a.nodeType&&a.id.substr(0,s.length)==s&&t.push(a.id.substr(a.id.lastIndexOf("_")+1)),a=a.nextSibling;return t}function wfu_get_filelist(e,a){a="undefined"!=typeof a?a:!0;var s=document.getElementById("upfile_"+e),t=s.files;return t||(t=s.value?[{name:s.value}]:[]),a&&"undefined"!=typeof s.filearray&&(t=s.filearray),t}function wfu_filedetails_toggle(e,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e+"_"+a),document.getElementById("wfu_messageblock_arrow_"+e+"_up_"+a));wfu_filedetails_showhide(e,a,"none"==s.style.display)}function wfu_headerdetails_showhide(e,a){var s=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up")),t=document.getElementById("wfu_messageblock_arrow_"+e+"_down"),n=document.getElementById("wfu_messageblock_subheader_"+e),r=document.getElementById("wfu_messageblock_subheader_"+e+"_message"),l=document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage"),i=document.getElementById("wfu_messageblock_header_"+e+"_state"),o=wfu_get_file_ids(e);if(a){s.style.display="",t.style.display="none",("none"!=r.style.display||"none"!=l.style.display)&&(n.style.display=""),i.value="";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display=document.getElementById("wfu_messageblock_header_"+e+"_state_"+o[_]).value}else{s.style.display="none",t.style.display="",n.style.display="none",i.value="none";for(var _=0;_<o.length;_++)document.getElementById("wfu_messageblock_"+e+"_"+o[_]).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_"+o[_]).style.display="none"}}function wfu_headerdetails_toggle(e){var a=(document.getElementById("wfu_messageblock_arrow_"+e),document.getElementById("wfu_messageblock_arrow_"+e+"_up"));wfu_headerdetails_showhide(e,"none"==a.style.display)}function wfu_selectbutton_changed(e,a){wfu_BrowserCaps.supportsAJAX&&wfu_BrowserCaps.supportsHTML5||(a=0);var s=document.getElementById("upfile_"+e),t=wfu_get_filelist(e,!1);if(1==a){"undefined"==typeof s.filearray&&(s.filearray=Array());for(var n=0;n<t.length;n++)s.filearray.push(t[n])}else"undefined"!=typeof s.filearray&&delete s.filearray;wfu_update_filename_text(e)}function wfu_selectbutton_clicked(e){var a=document.getElementById("wordpress_file_upload_message_"+e);a&&(a.style.display="none"),wfu_reset_message(e),document.getElementById("upfile_"+e).value="";var s=document.getElementById("fileName_"+e);s&&(s.value="",s.className="file_input_textbox")}function wfu_update_uploadbutton_status(e){var a=document.getElementById("upload_"+e);if(a){var s=wfu_get_filelist(e),t=s.length>0;a.disabled=!t}}function wfu_update_filename_text(e){var a=document.getElementById("fileName_"+e);if(a){for(var s=wfu_get_filelist(e),t="",n=0;n<s.length;n++)""!=t&&(t+=", "),t+=s[n].name.replace(/c:\\fakepath\\/i,"");a.value=t}}function wfu_selectsubdir_check(e){var a=document.getElementById("selectsubdir_"+e);if(!a)return!0;var s=document.getElementById("selectsubdiredit_"+e),t="none"!=s.style.display;return t&&a.selectedIndex>0&&(s.value=a.value.replace(/^\s+/,""),s.className="file_item_clean_match",wfu_selectsubdiredit_change(e)),document.getElementById("hiddeninput_"+e).value=t?s.value:a.selectedIndex,!t&&0==a.selectedIndex||t&&(""==s.value||"file_item_clean_empty"==s.className)?(a.className="file_item_clean_prompt",t&&(s.className="file_item_clean_prompt",s.value=""),!1):(a.className="file_item_clean",t&&"file_item_clean_prompt"==s.className&&(s.className="file_item_clean"),a.options[0].style.display="none",!0)}function wfu_selectsubdiredit_enter(e){var a=document.getElementById("selectsubdir_"+e),s=document.getElementById("selectsubdiredit_"+e);"file_item_clean_empty"==s.className&&(s.value=""),a.className="file_item_clean",s.className="file_item_clean"}function wfu_selectsubdiredit_exit(e){var a=document.getElementById("selectsubdiredit_"+e);""==a.value&&(a.value=GlobalData.consts.wfu_subdir_typedir,a.className="file_item_clean_empty")}function wfu_selectsubdiredit_change(e){var a=document.getElementById("selectsubdir_"+e),s=document.getElementById("selectsubdiredit_"+e);if("none"!=s.style.display){if("file_item_clean_empty"==s.className)return a.selectedIndex=0,void(document.getElementById("hiddeninput_"+e).value="");document.getElementById("hiddeninput_"+e).value=s.value;for(var t,n=!1,r=1;r<a.options.length;r++)t=a.options[r].value.replace(/^\s+/,"").toLowerCase(),a.options[r].style.display=s.value.length>=3?t.substr(0,s.value.length)==s.value.toLowerCase()?"block":"none":"block",a.options[r].value.replace(/^\s+/,"")==s.value&&(a.selectedIndex=r,s.className="file_item_clean_match",n=!0);n||(a.selectedIndex=0,s.className="file_item_clean")}}function wfu_selectsubdir_disable_onoff(e,a){var s=document.getElementById("selectsubdir_"+e);if(!s)return!0;var t=document.getElementById("selectsubdiredit_"+e),n="none"!=t.style.display;s.disabled=a,n&&(t.disabled=a)}function wfu_Redirect(e){window.location=e}function wfu_loadStart(){}function wfu_uploadProgress(e,a,s,t){t&&"undefined"==typeof this.xhr&&(console.log("total="+e.total+", loaded="+e.loaded),console.log(e));var n=GlobalData[a].xhrs[s],r=0,l=0,i=document.getElementById("progressbar_"+a+"_animation");if(e.lengthComputable){if(n.sizeloaded=e.loaded,n.size<e.total&&e.total>0){l=e.total-n.size,n.deltasize+=l,n.size+=l;for(var o=0;o<GlobalData[a].xhrs.length;o++)GlobalData[a].xhrs[o].file_id==n.file_id&&(GlobalData[a].xhrs[o].totalsize+=l)}if(i){for(var _=0,d=0,u=[],o=0;o<GlobalData[a].xhrs.length;o++)u[GlobalData[a].xhrs[o].file_id]=0;for(var o=0;o<GlobalData[a].xhrs.length;o++)u[GlobalData[a].xhrs[o].file_id]=Math.max(GlobalData[a].xhrs[o].totalsize,u[GlobalData[a].xhrs[o].file_id]);for(var o=0;o<u.length;o++)"undefined"!=typeof u[o]&&(_+=u[o]);for(var o=0;o<GlobalData[a].xhrs.length;o++)d+=GlobalData[a].xhrs[o].sizeloaded;r=Math.round(100*d/_),i.style.width=r.toString()+"%"}}else i&&(i.style.width="0%")}function wfu_notify_WPFilebase(e,a){var s=wfu_GetHttpRequestObject();if(null==s){var t=document.createElement("iframe");return t.style.display="none",t.src=GlobalData.consts.ajax_url+"?action=wfu_ajax_action_notify_wpfilebase&params_index="+e+"&session_token="+a,void document.body.appendChild(t)}var n=GlobalData.consts.ajax_url;params=new Array(3),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_notify_wpfilebase",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=e,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=a;for(var r="",t=0;t<params.length;t++)r+=(t>0?"&":"")+params[t][0]+"="+encodeURI(params[t][1]);s.open("POST",n,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.onreadystatechange=function(){},s.send(r)}function wfu_send_email_notification(e,a,s,t,n,r,l,i,o){var _=wfu_GetHttpRequestObject();if(null!=_){var d=GlobalData.consts.ajax_url,u=wfu_get_userdata_count(e);params=new Array(7+u),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_send_email_notification",params[1]=new Array(2),params[1][0]="params_index",params[1][1]=s,params[2]=new Array(2),params[2][0]="session_token",params[2][1]=t,params[3]=new Array(2),params[3][0]="only_filename_list",params[3][1]=n,params[4]=new Array(2),params[4][0]="target_path_list",params[4][1]=r,params[5]=new Array(2),params[5][0]="attachment_list",params[5][1]=l,params[6]=new Array(2),params[6][0]="uniqueuploadid_"+e,params[6][1]=a;for(var m=0;u>m;m++)params[7+m]=new Array(2),params[7+m][0]="userdata_"+m,params[7+m][1]=wfu_plugin_encode_string(document.getElementById("hiddeninput_"+e+"_userdata_"+m).value);for(var c="",m=0;m<params.length;m++)c+=(m>0?"&":"")+params[m][0]+"="+encodeURI(params[m][1]);var f=new Date;_.xhrid=-1,_.shortcode_id=e,_.requesttype="email",_.file_id=0,_.loading=!1,_.aborted=!1,_.unique_id=a,_.debugmode=i,_.is_admin=o,_.params_index=s,_.session_token=t,_.start_time=f.getTime(),_.end_time=_.start_time,_.finish_time=_.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),_.fail_colors=GlobalData.consts.fail_colors,_.error_message_header="",_.error_message_failed=GlobalData.consts.message_failed,_.error_message_cancelled=GlobalData.consts.message_cancelled,_.error_adminmessage_unknown="",_.open("POST",d,!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded"),_.addEventListener("load",wfu_uploadComplete,!1),_.addEventListener("error",wfu_uploadFailed,!1),_.addEventListener("abort",wfu_uploadCanceled,!1),_.send(c)}}function wfu_format_debug_data(e,a){return output='<label class="file_messageblock_subheader_debugmessage_label">',output+="Debug Data"+a,output+="</label>",output+='<div class="file_messageblock_subheader_debugmessage_container">',output+=e,output+="</div>"}function wfu_uploadComplete(e){var a=new Date,s=this.shortcode_id,t=(this.file_id,!1),n="",r="",l="",i="unknown",o="",_="",d="wfu_fileupload_success:";this.loading=!1,this.end_time=a.getTime();var u=e.target.responseText,m=u,c="error";if(-1!=u&&u.indexOf("force_errorabort_code")>-1&&(c="errorabort",u=u.replace("force_errorabort_code","")),-1!=u){var f=u.indexOf(d);if(f>-1&&("true"==this.debugmode&&(_=u.substr(0,f)),m=u.substr(f+d.length),f=m.indexOf(":"),n=m.substr(0,f),m=m.substr(f+1),f=m.indexOf(":"),l=m.substr(0,f),r=m.substr(f+1)),""!=_){var g="";"fileupload"==this.requesttype?g=" - File: "+this.file_id:"email"==this.requesttype&&(g=" - Email Notification"),_=wfu_format_debug_data(_,g)}if(""!=l){var p=l.split(";");if(1==parseInt(p[2])){var b=p[3].split(",");i=wfu_plugin_decode_string(b[0]),o=b[4]}}}if(""==r||""==l){var y=this.fail_colors.split(","),w=wfu_Initialize_Params();w.general.shortcode_id=s,w.general.unique_id=this.unique_id,w.general.state=7,w.general.files_count="fileupload"==this.requesttype?1:0,w.general.upload_finish_time=this.finish_time,w.general.fail_message=GlobalData.consts.message_unknown,w.general.fail_admin_message=wfu_join_strings("<br />",this.error_adminmessage_unknown,this.requesttype+":"+m),w.general.files_count>0?(w[0]={},w[0].color=y[0],w[0].bgcolor=y[1],w[0].borcolor=y[2],w[0].message_type=c,i=c,w[0].header=this.error_message_header,w[0].message=GlobalData.consts.message_timelimit,w[0].admin_messages="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:""):w.general.admin_messages.other="true"==this.is_admin?GlobalData.consts.message_admin_timelimit:"",w.general.upload_finish_time>0&&a.getTime()<w.general.upload_finish_time&&(w.general.files_count>0?(w[0].message=w.general.fail_message,w[0].admin_messages="true"==this.is_admin?w.general.fail_admin_message:""):w.general.admin_messages.other="true"==this.is_admin?w.general.fail_admin_message:"")}return t=""==r||""==l?wfu_ProcessUploadComplete(s,this.file_id,w,this.unique_id,this.params_index,this.session_token,"",[this.debugmode,_,this.is_admin],this.requesttype,""):wfu_ProcessUploadComplete(s,this.file_id,r,this.unique_id,this.params_index,this.session_token,l,[this.debugmode,_,this.is_admin],this.requesttype,n),t&&(wfu_unlock_upload(e.target.shortcode_id),wfu_hide_simple_progressbar(s),wfu_clear(e.target.shortcode_id)),e.target.return_status?i:void 0}function wfu_ProcessUploadComplete(sid,file_id,upload_params,unique_id,params_index,session_token,safe_output,debug_data,request_type,js_script_enc){if(sid&&!(0>sid)&&null!=upload_params&&""!=upload_params&&""!=unique_id&&("no-ajax"==unique_id||GlobalData[sid])){var do_redirect=!1;if("string"==typeof upload_params){upload_params=wfu_plugin_decode_string(upload_params.replace(/^\s+|\s+$/g,""));var Params=null;try{Params=JSON.parse(upload_params)}catch(e){}if(null==Params){var safe_parts=safe_output.split(";");Params=wfu_Initialize_Params(),Params.general.shortcode_id=sid,Params.general.unique_id=unique_id,Params.general.state=safe_parts[0],4==Params.general.state&&Params.general.state++;var default_colors=safe_parts[1].split(","),filedata="",error_jsonparse_filemessage=GlobalData.consts.jsonparse_filemessage,error_jsonparse_message=GlobalData.consts.jsonparse_message,error_jsonparse_adminmessage=GlobalData.consts.jsonparse_adminmessage;Params.general.files_count=parseInt(safe_parts[2]);for(var i=0;i<Params.general.files_count;i++)Params[i]={},Params[i].color=default_colors[0],Params[i].bgcolor=default_colors[1],Params[i].borcolor=default_colors[2],filedata=safe_parts[i+3].split(","),Params[i].message_type=wfu_plugin_decode_string(filedata[0]),Params[i].header=wfu_plugin_decode_string(filedata[1]),"success"==Params[i].message_type&&(Params[i].header+=error_jsonparse_filemessage,Params[i].message_type="warning"),Params[i].message=wfu_join_strings("<br />",error_jsonparse_message,wfu_plugin_decode_string(filedata[2])),Params[i].admin_messages=wfu_join_strings("<br />",error_jsonparse_adminmessage,wfu_plugin_decode_string(filedata[3]))}}else{if("object"!=typeof upload_params)return;var Params=upload_params}for(i=0;Params[i];)Params[i].message_type&&"error"==Params[i].message_type.substr(0,5)&&(Params[i].message_type=Params[i].message_type.substr(0,5)),i++;var message_table=document.getElementById("wfu_messageblock_"+sid),UploadStates_Ok=!0;if(!UploadStates[sid]&&message_table){var upload_states=document.getElementById("wfu_messageblock_header_"+sid+"_states").value;upload_states=wfu_plugin_decode_string(upload_states.replace(/^\s+|\s+$/g,"")),UploadStates[sid]=null;try{UploadStates[sid]=JSON.parse(upload_states)}catch(e){}null==UploadStates[sid]&&(UploadStates_Ok=!1)}GlobalData[sid]||(GlobalData[sid]=Object());var G=GlobalData[sid];if("no-ajax"==unique_id)G.last=!1,G.unique_id="",G.files_count=Params.general.files_count,0==Params.general.state&&(Params.general.files_count=0),G.files_processed=Params.general.files_count,G.upload_state=UploadStates_Ok?Params.general.state:10,G.message=Params.general.message,G.update_wpfilebase=Params.general.update_wpfilebase,G.redirect_link=Params.general.redirect_link,G.notify_only_filename_list="",G.notify_target_path_list="",G.notify_attachment_list="",G.admin_messages={},G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase,G.admin_messages.notify=Params.general.admin_messages.notify,G.admin_messages.redirect=Params.general.admin_messages.redirect,G.admin_messages.debug=debug_data[1],G.admin_messages.other=Params.general.admin_messages.other,G.errors={},G.errors.wpfilebase=Params.general.errors.wpfilebase,G.errors.notify=Params.general.errors.notify,G.errors.redirect=Params.general.errors.redirect,G.current_size=0,G.total_size=0;else{if(""==G.unique_id||G.unique_id!=unique_id||G.unique_id!=Params.general.unique_id)return;if(G.last)return;0==Params.general.files_count&&Params[0]&&"error"==Params[0].message_type&&(Params.general.files_count=1);for(var file_status="",i=0;i<Params.general.files_count;i++)file_status="error"==Params[i].message_type&&0==G.files_processed?"error1":"error"==Params[i].message_type&&G.files_processed>0?"error2":Params[i].message_type,G.upload_state=GlobalData.filestatematch[file_status][G.upload_state];UploadStates_Ok||(G.upload_state=10),G.files_processed+=Params.general.files_count,G.message=wfu_join_strings("<br />",G.message,Params.general.message),""==G.update_wpfilebase&&(G.update_wpfilebase=Params.general.update_wpfilebase),(!request_type||request_type&&"email"!=request_type)&&(G.redirect_link=Params.general.redirect_link),G.notify_only_filename_list=wfu_join_strings(", ",G.notify_only_filename_list,Params.general.notify_only_filename_list),G.notify_target_path_list=wfu_join_strings(", ",G.notify_target_path_list,Params.general.notify_target_path_list),G.notify_attachment_list=wfu_join_strings(",",G.notify_attachment_list,Params.general.notify_attachment_list),G.admin_messages.debug=wfu_join_strings("<br />",G.admin_messages.debug,debug_data[1]),G.admin_messages.other=wfu_join_strings("<br />",G.admin_messages.other,Params.general.admin_messages.other),""==G.admin_messages.wpfilebase&&(G.admin_messages.wpfilebase=Params.general.admin_messages.wpfilebase),""==G.admin_messages.notify&&(G.admin_messages.notify=Params.general.admin_messages.notify),""==G.admin_messages.redirect&&(G.admin_messages.redirect=Params.general.admin_messages.redirect),""==G.errors.wpfilebase&&(G.errors.wpfilebase=Params.general.errors.wpfilebase),""==G.errors.notify&&(G.errors.notify=Params.general.errors.notify),""==G.errors.redirect&&(G.errors.redirect=Params.general.errors.redirect)}G.files_processed==G.files_count&&(G.last=!0,""!=G.update_wpfilebase&&(G.admin_messages.wpfilebase="",wfu_notify_WPFilebase(params_index,session_token)),""!=G.notify_only_filename_list&&(G.admin_messages.notify="",wfu_send_email_notification(sid,unique_id,params_index,session_token,G.notify_only_filename_list,G.notify_target_path_list,G.notify_attachment_list,debug_data[0],debug_data[2]),G.last=!1,G.notify_only_filename_list=""),G.last&&("no-ajax"!=unique_id&&wfu_notify_server_upload_ended(sid,unique_id,params_index,session_token),GlobalData.UploadInProgressString=GlobalData.UploadInProgressString.replace(new RegExp("\\["+unique_id+"\\]","g"),"")),""!=G.errors.redirect&&(G.redirect_link=""),""!=G.redirect_link&&G.last&&""==GlobalData.UploadInProgressString.trim()&&(G.upload_state=11,do_redirect=!0));var nonadmin_message=G.message,admin_message=wfu_join_strings("<br />",G.admin_messages.other,G.admin_messages.wpfilebase,G.admin_messages.notify,G.admin_messages.redirect,G.admin_messages.debug);if(!UploadStates_Ok){var error_jsonparse_headermessage=GlobalData.consts.jsonparse_headermessage,error_jsonparse_headeradminmessage=GlobalData.consts.jsonparse_headeradminmessage;nonadmin_message=wfu_join_strings("<br />",error_jsonparse_headermessage,nonadmin_message),admin_message=wfu_join_strings("<br />",error_jsonparse_headeradminmessage,admin_message)}if(G.last){0==G.files_count?G.upload_state=8:G.upload_state<4&&(G.upload_state+=4);var admin_messages_exist=""!=G.admin_messages.wpfilebase||""!=G.admin_messages.notify||""!=G.admin_messages.redirect||""!=G.admin_messages.other;4==G.upload_state&&""!=admin_message?G.upload_state++:5==G.upload_state&&""==!admin_message&&""==nonadmin_message&&G.upload_state--}if(message_table){var subheader_state=document.getElementById("wfu_messageblock_header_"+sid+"_state"),single_file_shown=1==G.files_count&&""==nonadmin_message&&""==admin_message&&G.last&&!do_redirect;if(single_file_shown)document.getElementById("wfu_messageblock_header_"+sid).style.display="none";else{document.getElementById("wfu_messageblock_header_"+sid).style.display="";var header_container=document.getElementById("wfu_messageblock_header_"+sid+"_container");if(UploadStates_Ok){var suffix="";1!=G.files_count||5!=G.upload_state&&7!=G.upload_state||(suffix="_singlefile"),header_container.innerHTML=UploadStates[sid]["State"+G.upload_state+suffix]}else{header_container.innerHTML="";var safe_container=document.getElementById("wfu_messageblock_header_"+sid+"_safecontainer");header_container.innerHTML=safe_container.innerHTML.replace(/_safe/g,"")}var subheader_show=!1;""!=nonadmin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_messagelabel").innerHTML=nonadmin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_message").style.display="none",""!=admin_message?(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="",document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessagelabel").innerHTML=admin_message,subheader_show=!0):document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage").style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid).style.display=subheader_show?subheader_state.value:"none",subheader_show||G.files_processed>0?(header_container.colSpan=2,document.getElementById("wfu_messageblock_arrow_"+sid).style.display=""):(document.getElementById("wfu_messageblock_arrow_"+sid).style.display="none",header_container.colSpan=3)}for(var next_block=document.getElementById("wfu_messageblock_subheader_"+sid),next_block_id=0,file_block=null,file_template_container=document.getElementById("wfu_messageblock_"+sid+"_filetemplate"),file_contents="",door=document.getElementById("wfu_messageblock_"+sid+"_door"),ii=0,headerspan=1,subheaderspan=2,file_template=wfu_plugin_decode_string(file_template_container.value.replace(/^\s+|\s+$/g,"")),i=0;i<Params.general.files_count;i++){for(ii=i+file_id,file_contents=file_template.replace(/\[file_id\]/g,ii),file_contents=file_contents.replace(/\[filenumber_display\]/g,""),file_contents=file_contents.replace(/\[fileheader_color\]/g,Params[i].color),file_contents=file_contents.replace(/\[fileheader_bgcolor\]/g,Params[i].bgcolor),file_contents=file_contents.replace(/\[fileheader_borcolor\]/g,Params[i].borcolor),file_contents=file_contents.replace(/\[fileheader_message\]/g,Params[i].header),file_contents=file_contents.replace(/\[filesubheadermessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_message\]/g,Params[i].message),file_contents=file_contents.replace(/\[filesubheaderadminmessage_display\]/g,'style="display:none;"'),file_contents=file_contents.replace(/\[filesubheader_adminmessage\]/g,Params[i].admin_messages),file_contents="<table><tbody>"+file_contents+"</tbody></table>",door.innerHTML=file_contents,headerspan=1,subheaderspan=2,subheader_show=!1,file_block=document.getElementById("wfu_messageblock_"+sid+"_"+ii),1==G.files_count?(document.getElementById("wfu_messageblock_"+sid+"_filenumber_"+ii).style.display="none",document.getElementById("wfu_messageblock_subheader_"+sid+"_fileempty_"+ii).style.display="none",file_block.style.display=single_file_shown?"":subheader_state.value,headerspan++,subheaderspan++):file_block.style.display=subheader_state.value,""!=Params[i].message&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_message_"+ii).style.display="",subheader_show=!0),""!=Params[i].admin_messages&&(document.getElementById("wfu_messageblock_subheader_"+sid+"_adminmessage_"+ii).style.display="",subheader_show=!0),subheader_show||(document.getElementById("wfu_messageblock_arrow_"+sid+"_"+ii).style.display="none",headerspan++),document.getElementById("wfu_messageblock_header_"+sid+"_container_"+ii).colSpan=headerspan,document.getElementById("wfu_messageblock_subheader_"+sid+"_container_"+ii).colSpan=subheaderspan;ii>next_block_id&&(next_block=next_block.nextSibling,null!=next_block);)1===next_block.nodeType&&(next_block_id=next_block.id.substr(next_block.id.lastIndexOf("_")+1));message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block.nextSibling,file_block=document.getElementById("wfu_messageblock_subheader_"+sid+"_"+ii),message_table.tBodies[0].insertBefore(file_block,next_block),next_block=file_block,next_block_id=ii}single_file_shown&&(document.getElementById("wfu_messageblock_"+sid+"_1").style.display=""),message_table.style.display="",document.getElementById("wordpress_file_upload_message_"+sid).style.display=""}return js_script_enc&&eval(wfu_plugin_decode_string(js_script_enc)),do_redirect&&wfu_Redirect(G.redirect_link),G.last}}function wfu_uploadFailed(e,a){a&&(console.log("failure report following"),console.log(e));var s=e.target,t={target:{responseText:"",shortcode_id:s.shortcode_id}};wfu_uploadComplete.call(s,t)}function wfu_uploadCanceled(){}function wfu_notify_server_upload_ended(e,a,s,t){var n=wfu_GetHttpRequestObject();if(null!=n){var r=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action",params[1]=new Array(2),params[1][0]="uniqueuploadid_"+e,params[1][1]=a,params[2]=new Array(2),params[2][0]="params_index",params[2][1]=s,params[3]=new Array(2),params[3][0]="session_token",params[3][1]=t,params[4]=new Array(2),params[4][0]="upload_finished",params[4][1]=1;for(var l="",i=0;i<params.length;i++)l+=(i>0?"&":"")+params[i][0]+"="+encodeURI(params[i][1]);n.open("POST",r,!0),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){4==n.readyState&&200==n.status},n.send(l)}}function wfu_Initialize_Params(){var e={};return e.version="full",e.general={},e.general.shortcode_id=0,e.general.unique_id="",e.general.state=0,e.general.files_count=0,e.general.update_wpfilebase="",e.general.redirect_link="",e.general.upload_finish_time=0,e.general.message="",e.general.message_type="",e.general.admin_messages={},e.general.admin_messages.wpfilebase="",e.general.admin_messages.notify="",e.general.admin_messages.redirect="",e.general.admin_messages.other="",e.general.errors={},e.general.errors.wpfilebase="",e.general.errors.notify="",e.general.errors.redirect="",e.general.color="",e.general.bgcolor="",e.general.borcolor="",e.general.notify_only_filename_list="",e.general.notify_target_path_list="",e.general.notify_attachment_list="",e.general.fail_message="",e.general.fail_admin_message="",e}function wfu_redirect_to_classic(e,a,s,t){0!=wfu_filesselected(e)&&wfu_selectsubdir_check(e)&&wfu_check_required_userdata(e)&&wfu_redirect_to_classic_cont(e,a,s,t,[""])}function wfu_redirect_to_classic_cont(e,a,s,t){var n=function(n){if(n.indexOf("wfu_response_success:")>-1){var r=wfu_Initialize_Params();if(r.general.shortcode_id=e,r.general.unique_id="",r.general.files_count=wfu_filesselected(e),wfu_ProcessUploadComplete(e,0,r,"no-ajax","",a,"",["false","","false"]),1==s){var l="";document.getElementById("upfile_"+e).name="uploadedfile_"+e+"_redirected"+l}document.getElementById("adminerrorcodes_"+e).value=t>0?t:"",document.getElementById("upfile_"+e).disabled=!1,document.getElementById("uniqueuploadid_"+e).value=wfu_randomString(10),document.getElementById("uploadform_"+e).submit()}},r="",l=new Date,i=GlobalData.consts.ajax_url+"?action=wfu_ajax_action&sid="+e+"&start_time="+l.getTime()+"&session_token="+a+r;wfu_lock_upload(e);var o=wfu_GetHttpRequestObject();if(null==o){var _=document.createElement("iframe");return _?(_.style.display="none",_.src=i,document.body.appendChild(_),void(_.onload=function(){n(_.contentDocument.body.innerHTML)})):void 0}o.open("GET",i,!0),o.onreadystatechange=function(){4==o.readyState&&200==o.status&&n(o.responseText)},o.send(null)}function wfu_filesselected(e){var a=document.getElementById("fileName_"+e),s=wfu_get_filelist(e);return 0==s.length&&a&&(a.value=GlobalData.consts.nofilemessage,a.className="file_input_textbox_nofile"),s.length}function wfu_check_required_userdata(e){for(var a=wfu_get_userdata_count(e),s=!1,t=0;a>t;t++){var n=document.getElementById("hiddeninput_"+e+"_userdata_"+t),r=document.getElementById("userdata_"+e+"_message_"+t),l="file_userdata_message_required";r.className.substr(0,l.length)==l&&""==n.value&&(r.className=l+"_empty",r.value=GlobalData.consts.userdata_empty,s=!0)}return!s}function wfu_HTML5UploadFile(e,a,s){if(!wfu_BrowserCaps.supportsAJAX)return void wfu_redirect_to_classic(e,s,1,1);if(!wfu_BrowserCaps.supportsHTML5)return void wfu_redirect_to_classic(e,s,1,2);a=wfu_plugin_decode_string(a.replace(/^\s+|\s+$/g,""));var t=null;try{t=JSON.parse(a)}catch(n){}if(null==t)return void wfu_redirect_to_classic(e,s,1,3);var r=wfu_GetHttpRequestObject();if(null!=r){var l=wfu_filesselected(e);if(0!=l){var i=document.getElementById("upload_"+e),o=!i;if(!wfu_selectsubdir_check(e))return void(o&&wfu_clear_files(e));var _=l;return _+=_,wfu_check_required_userdata(e)?void wfu_HTML5UploadFile_cont(e,t,s,[""]):void(o&&wfu_clear_files(e))}}}function wfu_HTML5UploadFile_cont(e,a,s){function t(r,l,i,m){f=!0;var g=wfu_GetHttpRequestObject(),p=wfu_GetHttpRequestObject();if(null!=g&&null!=p){var b=null,y=null;try{var b=new FormData,y=new FormData}catch(w){}if(null!=b&&null!=y){i||b.append("uploadedfile_"+e+_,l),b.append("uploadedfile_"+e+"_index",r),b.append("uploadedfile_"+e+"_name",wfu_plugin_encode_string(o[r].name)),b.append("uploadedfile_"+e+"_size",o[r].size),b.append("action","wfu_ajax_action"),b.append("uniqueuploadid_"+e,u),b.append("params_index",a.params_index),b.append("subdir_sel_index",n),i?b.append("only_check","1"):b.append("only_check","0"),b.append("session_token",s),b.append("unique_id",d);
2
+ for(var h=wfu_get_userdata_count(e),v=0;h>v;v++)b.append("hiddeninput_"+e+"_userdata_"+v,document.getElementById("hiddeninput_"+e+"_userdata_"+v).value);var G=GlobalData[e].xhrs.push(g)-1,k=new Date;if(g.xhrid=G,g.shortcode_id=e,g.requesttype="fileupload",g.file_id=r+1,i?(g.size=0,g.totalsize=0,g.loading=!1):(g.size=l.size,g.totalsize=o[r].size,g.loading=!0),g.deltasize=0,g.sizeloaded=0,g.aborted=!1,g.unique_id=u,g.params_index=a.params_index,g.session_token=s,g.debugmode=a.debugmode,g.is_admin=a.is_admin,g.start_time=k.getTime(),g.end_time=g.start_time,g.finish_time=g.start_time+1e3*parseInt(GlobalData.consts.max_time_limit),g.fail_colors=a.fail_colors,g.error_message_header=a.error_header.replace(/%username%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%useremail%/g,"no data"),g.error_message_header=g.error_message_header.replace(/%filename%/g,o[r].name),g.error_message_header=g.error_message_header.replace(/%filepath%/g,o[r].name),g.error_message_failed=GlobalData.consts.message_failed,g.error_message_cancelled=GlobalData.consts.message_cancelled,g.error_adminmessage_unknown=GlobalData.consts.adminmessage_unknown.replace(/%username%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%useremail%/g,"no data"),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filename%/g,o[r].name),g.error_adminmessage_unknown=g.error_adminmessage_unknown.replace(/%filepath%/g,o[r].name),m){y.append("action","wfu_ajax_action"),y.append("params_index",a.params_index),y.append("session_token",s),y.append("force_connection_close","1"),p.open("POST",GlobalData.consts.ajax_url,!1);try{p.send(y)}catch(I){}f="success"==p.responseText}if(f)i?(g.addEventListener("load",function(a){a={target:{responseText:a.target.responseText,shortcode_id:e,return_status:!0}};var s=wfu_uploadComplete.call(g,a);f="success"==s||"warning"==s,f&&t(r,l,!1,!1)},!1),g.addEventListener("error",function(){},!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(b)):(g.upload.xhr=g,g.upload.dummy=1,g.upload.addEventListener("loadstart",wfu_loadStart,!1),g.upload.addEventListener("progress",new Function("evt","wfu_uploadProgress(evt, "+e+", "+G+", "+a.debugmode+");"),!1),g.addEventListener("load",wfu_uploadComplete,!1),g.addEventListener("error",new Function("evt","wfu_uploadFailed(evt, "+a.debugmode+");"),!1),g.addEventListener("abort",wfu_uploadCanceled,!1),g.open("POST",GlobalData.consts.ajax_url,!0),g.send(b));else{var E={target:{responseText:"",shortcode_id:e}};wfu_uploadComplete.call(g,E)}return c++,f}}}var n=-1,r=document.getElementById("selectsubdir_"+e);if(r){var l=document.getElementById("selectsubdiredit_"+e),i="none"!=l.style.display;n=i?l.value:r.selectedIndex}var o=wfu_get_filelist(e),_="",d=wfu_randomString(10),u=d;GlobalData.UploadInProgressString+="["+u+"]",GlobalData[e]={},GlobalData[e].unique_id=u,GlobalData[e].last=!1,GlobalData[e].files_count=1,GlobalData[e].files_processed=0,GlobalData[e].upload_state=0,GlobalData[e].message="",GlobalData[e].update_wpfilebase="",GlobalData[e].redirect_link="",GlobalData[e].notify_only_filename_list="",GlobalData[e].notify_target_path_list="",GlobalData[e].notify_attachment_list="",GlobalData[e].admin_messages={},GlobalData[e].admin_messages.wpfilebase="",GlobalData[e].admin_messages.notify="",GlobalData[e].admin_messages.redirect="",GlobalData[e].admin_messages.debug="",GlobalData[e].admin_messages.other="",GlobalData[e].errors={},GlobalData[e].errors.wpfilebase="",GlobalData[e].errors.notify="",GlobalData[e].errors.redirect="",GlobalData[e].xhrs=Array(),wfu_show_simple_progressbar(a.shortcode_id,"progressive");var m=wfu_Initialize_Params();m.general.shortcode_id=e,m.general.unique_id=u,wfu_ProcessUploadComplete(e,0,m,u,a.params_index,s,"",["false","","false"]);var c=0,f=!0,g=0;t(g,o[g],!0,!1)}function wfu_get_userdata_count(e){for(var a=0;document.getElementById("userdata_"+e+"_"+a);)a++;return a}function wfu_lock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!0),document.getElementById("input_"+e).disabled=!0,document.getElementById("upfile_"+e).disabled=!0,wfu_selectsubdir_disable_onoff(e,!0);var s=document.getElementById("upload_"+e);s&&(s.disabled=!0);for(var t=wfu_get_userdata_count(e),n=0;t>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!0}function wfu_unlock_upload(e){var a=document.getElementById("fileName_"+e);a&&(a.disabled=!1),document.getElementById("input_"+e).disabled=!1,document.getElementById("upfile_"+e).disabled=!1,wfu_selectsubdir_disable_onoff(e,!1);var s=document.getElementById("upload_"+e);s&&(s.disabled=!1);for(var t=wfu_get_userdata_count(e),n=0;t>n;n++)document.getElementById("userdata_"+e+"_message_"+n).disabled=!1}function wfu_clear_files(e){document.getElementById("uploadform_"+e).reset();var a=document.getElementById("fileName_"+e);a&&(a.value="",a.className="file_input_textbox")}function wfu_clear(e){wfu_clear_files(e);var a=document.getElementById("selectsubdir_"+e);if(a){var s=document.getElementById("selectsubdiredit_"+e),t="none"!=s.style.display;t?(a.selectedIndex=-1,s.value=""):a.selectedIndex=parseInt(document.getElementById("selectsubdirdefault_"+e).value)}for(var n=wfu_get_userdata_count(e),r=0;n>r;r++)document.getElementById("userdata_"+e+"_message_"+r).value="",document.getElementById("hiddeninput_"+e+"_userdata_"+r).value=""}function wfu_reset_message(e){var a=document.getElementById("wfu_messageblock_"+e);if(a){document.getElementById("wfu_messageblock_header_"+e).style.display="";var s=document.getElementById("wfu_messageblock_header_"+e+"_container");UploadStates[e]&&(s.innerHTML=UploadStates[e].State0),document.getElementById("wfu_messageblock_header_"+e+"_state").value="none",document.getElementById("wfu_messageblock_arrow_"+e).style.display="none",s.colSpan=3,document.getElementById("wfu_messageblock_subheader_"+e+"_messagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessagelabel").innerHTML="",document.getElementById("wfu_messageblock_subheader_"+e).style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_message").style.display="none",document.getElementById("wfu_messageblock_subheader_"+e+"_adminmessage").style.display="none";for(var t=wfu_get_file_ids(e),n=1;n<=t.length;n++)a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_"+e+"_"+n)),a.tBodies[0].removeChild(document.getElementById("wfu_messageblock_subheader_"+e+"_"+n))}}function wfu_show_simple_progressbar(e,a){var s=document.getElementById("progressbar_"+e+"_animation"),t=document.getElementById("progressbar_"+e+"_imagesafe");s&&("progressive"==a?(s.style.width="0%",s.className="file_progress_progressive",t.style.display="none",s.style.display="block"):wfu_BrowserCaps.supportsAnimation?(s.style.width="25%",s.className="file_progress_shuffle",t.style.display="none",s.style.display="block"):(s.style.width="0%",s.className="file_progress_noanimation",s.style.display="none",t.style.display="block"),document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="block")}function wfu_hide_simple_progressbar(e){var a=document.getElementById("progressbar_"+e+"_animation"),s=document.getElementById("progressbar_"+e+"_imagesafe");a&&(document.getElementById("wordpress_file_upload_progressbar_"+e).style.display="none",a.style.width="0%",a.className="file_progress_noanimation",s.style.display="none",a.style.display="block")}function wfu_invoke_shortcode_editor(e,a,s,t){for(var n=document.getElementsByTagName("BUTTON"),r=0,l=null,i=0;i<n.length;i++)n[i].parentNode&&n[i].parentNode.id==t+"_editor_"+e&&(l=n[i],r++);if(0!=r){if(r>1)return void alert(GlobalData.consts.same_pluginid);var o=wfu_GetHttpRequestObject();if(null!=o){l.parentNode.style.display="none",document.getElementById(t+"_overlay_"+e).style.display="block";var _=GlobalData.consts.ajax_url;params=new Array(5),params[0]=new Array(2),params[0][0]="action",params[0][1]="wfu_ajax_action_edit_shortcode",params[1]=new Array(2),params[1][0]="upload_id",params[1][1]=e,params[2]=new Array(2),params[2][0]="post_id",params[2][1]=a,params[3]=new Array(2),params[3][0]="post_hash",params[3][1]=s,params[4]=new Array(2),params[4][0]="shortcode_tag",params[4][1]=t;for(var d="",i=0;i<params.length;i++)d+=(i>0?"&":"")+params[i][0]+"="+encodeURI(params[i][1]);o.open("POST",_,!0),o.setRequestHeader("Content-type","application/x-www-form-urlencoded"),o.onreadystatechange=function(){if(4==o.readyState&&200==o.status){document.getElementById(t+"_overlay_"+e).style.display="none",l.parentNode.removeAttribute("style");var a="wfu_edit_shortcode:",s=o.responseText.indexOf(a);-1==s&&(s=o.responseText.length);var n=(o.responseText.substr(0,s),o.responseText.substr(s+a.length,o.responseText.length-s-a.length));s=n.indexOf(":");var r=n.substr(0,s);if(txt_value=n.substr(s+1,n.length-s-1),"success"==r){var i=window.open(wfu_plugin_decode_string(txt_value),"_blank");i.plugin_window=window}else"check_page_obsolete"==r&&alert(txt_value)}},o.send(d)}}}GlobalData={},UploadStates={},GlobalData.filestatematch={},GlobalData.filestatematch.success=[0,1,2,2],GlobalData.filestatematch.warning=[1,1,2,2],GlobalData.filestatematch.error1=[3,3,2,3],GlobalData.filestatematch.error2=[2,2,2,3],GlobalData.UploadInProgressString="",wfu_Check_Browser_Capabilities();
lib/wfu_admin.php CHANGED
@@ -42,6 +42,7 @@ function wordpress_file_upload_install() {
42
  idlog mediumint(9) NOT NULL AUTO_INCREMENT,
43
  userid mediumint(9) NOT NULL,
44
  uploaduserid mediumint(9) NOT NULL,
 
45
  filepath TEXT NOT NULL,
46
  filehash VARCHAR(100) NOT NULL,
47
  filesize bigint NOT NULL,
@@ -98,6 +99,7 @@ function wordpress_file_upload_manage_dashboard() {
98
  $data_enc = (!empty($_POST['data']) ? $_POST['data'] : (!empty($_GET['data']) ? $_GET['data'] : ''));
99
  $postid = (!empty($_POST['postid']) ? $_POST['postid'] : (!empty($_GET['postid']) ? $_GET['postid'] : ''));
100
  $nonce = (!empty($_POST['nonce']) ? $_POST['nonce'] : (!empty($_GET['nonce']) ? $_GET['nonce'] : ''));
 
101
  $echo_str = "";
102
 
103
  if ( $action == 'edit_settings' ) {
@@ -162,15 +164,15 @@ function wordpress_file_upload_manage_dashboard() {
162
  elseif ( $action == 'plugin_settings' ) {
163
  $echo_str = wfu_manage_settings();
164
  }
165
- elseif ( $action == 'add_shortcode' && $postid != "" && $nonce != "" ) {
166
  if ( $_SESSION['wfu_add_shortcode_ticket'] != $nonce ) $echo_str = wfu_manage_mainmenu();
167
- elseif ( wfu_add_shortcode($postid) ) $echo_str = wfu_manage_mainmenu();
168
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_ADD_SHORTCODE_REJECTED);
169
  $_SESSION['wfu_add_shortcode_ticket'] = 'noticket';
170
  }
171
- elseif ( $action == 'edit_shortcode' && $data_enc != "" ) {
172
  $data = wfu_decode_array_from_string($data_enc);
173
- if ( wfu_check_edit_shortcode($data) ) wfu_shortcode_composer($data);
174
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
175
  }
176
  elseif ( $action == 'delete_shortcode' && $data_enc != "" ) {
@@ -223,7 +225,7 @@ function wfu_manage_mainmenu($message = '') {
223
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
224
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Edition</label>';
225
  $echo_str .= "\n\t\t\t\t\t".'</th>';
226
- $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px;">';
227
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Free</label>';
228
  $echo_str .= "\n\t\t\t\t\t".'</td>';
229
  $echo_str .= "\n\t\t\t\t\t".'<td>';
@@ -232,7 +234,7 @@ function wfu_manage_mainmenu($message = '') {
232
  $echo_str .= "\n\t\t\t\t\t\t\t".'<button onclick="if (this.innerText == \'See why >>\') {this.innerText = \'<< Close\'; document.getElementById(\'wfu_version_comparison\').style.display = \'block\';} else {this.innerText = \'See why >>\'; document.getElementById(\'wfu_version_comparison\').style.display = \'none\';}">See why >></button>';
233
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
234
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_version_comparison" style="display:none; background-color:lightyellow; border:1px solid yellow; margin:10px 0; padding:10px;">';
235
- $echo_str .= "\n\t\t\t\t\t\t\t".'<img src="'.WFU_IMAGE_VERSION_COMPARISON.'" width="65%" style="display:block; margin-bottom:6px;" />';
236
  $echo_str .= "\n\t\t\t\t\t\t\t".'<a class="button-primary" href="'.WFU_PRO_VERSION_URL.'">Go for the PRO version</a>';
237
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
238
  $echo_str .= "\n\t\t\t\t\t".'</td>';
@@ -375,6 +377,7 @@ function wfu_construct_post_list($posts) {
375
 
376
  function wfu_flatten_post_list($list) {
377
  $flat = array();
 
378
  foreach( $list as $item ) {
379
  $flat_item = array(
380
  'id' => $item['id'],
@@ -389,44 +392,49 @@ function wfu_flatten_post_list($list) {
389
  }
390
 
391
  function wfu_manage_instances() {
 
 
 
 
 
 
392
  $siteurl = site_url();
393
  $args = array( 'post_type' => array( "post", "page" ), 'post_status' => "publish,private,draft", 'posts_per_page' => -1 );
394
  $posts = get_posts($args);
395
  $wfu_shortcodes = array();
396
  foreach ( $posts as $post ) {
397
- $ret = wfu_get_content_shortcodes($post, 'wordpress_file_upload');
398
  if ( $ret !== false ) $wfu_shortcodes = array_merge($wfu_shortcodes, $ret);
399
  }
400
 
401
  $list = wfu_construct_post_list($posts);
402
  $pagelist = wfu_flatten_post_list($list["page"]);
403
  $postlist = wfu_flatten_post_list($list["post"]);
404
- // echo '<pre>'; print_r ($list); echo '</pre>';
405
 
406
- $echo_str = "\n\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">Plugin Instances</h3>';
407
- $onchange_js = 'document.getElementById(\'wfu_add_plugin_ok\').disabled = !((document.getElementById(\'wfu_page_type\').value == \'page\' && document.getElementById(\'wfu_page_list\').value != \'\') || (document.getElementById(\'wfu_page_type\').value == \'post\' && document.getElementById(\'wfu_post_list\').value != \'\'));';
408
  $no_shortcodes = ( count($wfu_shortcodes) == 0 );
409
- $echo_str .= "\n\t\t".'<div id="wfu_add_plugin_button" style="'. ( !$no_shortcodes ? '' : 'color:blue; font-weight:bold; font-size:larger;' ).'margin-bottom: 20px; margin-top: 10px;">';
410
  $addbutton_pre = ( !$no_shortcodes ? '' : '<label>Press </label>');
411
- $addbutton_post = ( !$no_shortcodes ? '' : '<label> to get started and add the plugin in a page</label>');
412
- $echo_str .= "\n\t\t\t".$addbutton_pre.'<button onclick="document.getElementById(\'wfu_add_plugin_button\').style.display = \'none\'; document.getElementById(\'wfu_add_plugin\').style.display = \'inline-block\'; '.$onchange_js.'">'.( !$no_shortcodes ? 'Add Plugin Instance' : 'here' ).'</button>'.$addbutton_post;
413
  $echo_str .= "\n\t\t".'</div>';
414
- $echo_str .= "\n\t\t".'<div id="wfu_add_plugin" style="margin-bottom: 20px; margin-top: 10px; display:none;">';
415
- $echo_str .= "\n\t\t\t".'<label>Add plugin to </label><select id="wfu_page_type" onchange="document.getElementById(\'wfu_page_list\').style.display = (this.value == \'page\' ? \'inline-block\' : \'none\'); document.getElementById(\'wfu_post_list\').style.display = (this.value == \'post\' ? \'inline-block\' : \'none\'); '.$onchange_js.'"><option value="page" selected="selected">Page</option><option value="post">Post</option></select>';
416
- $echo_str .= "\n\t\t\t".'<select id="wfu_page_list" style="margin-bottom:6px;" onchange="'.$onchange_js.'">';
417
  $echo_str .= "\n\t\t\t\t".'<option value=""></option>';
418
  foreach ( $pagelist as $item )
419
  $echo_str .= "\n\t\t\t\t".'<option value="'.$item['id'].'">'.str_repeat('&nbsp;', 4 * $item['level']).( $item['status'] == 1 ? '[Private]' : ( $item['status'] == 2 ? '[Draft]' : '' ) ).$item['title'].'</option>';
420
  $echo_str .= "\n\t\t\t".'</select>';
421
- $echo_str .= "\n\t\t\t".'<select id="wfu_post_list" style="display:none; margin-bottom:6px;" onchange="'.$onchange_js.'">';
422
  $echo_str .= "\n\t\t\t\t".'<option value=""></option>';
423
  foreach ( $postlist as $item )
424
  $echo_str .= "\n\t\t\t\t".'<option value="'.$item['id'].'">'.str_repeat('&nbsp;', 4 * $item['level']).( $item['status'] == 1 ? '[Private]' : ( $item['status'] == 2 ? '[Draft]' : '' ) ).$item['title'].'</option>';
425
  $echo_str .= "\n\t\t\t".'</select><br />';
426
  $add_shortcode_ticket = wfu_create_random_string(16);
427
  $_SESSION['wfu_add_shortcode_ticket'] = $add_shortcode_ticket;
428
- $echo_str .= "\n\t\t".'<button id="wfu_add_plugin_ok" style="float:right; margin: 0 2px 0 4px;" disabled="disabled" onclick="document.getElementById(\'wfu_add_plugin\').style.display = \'none\'; window.location = \''.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=add_shortcode&amp;postid=\' + (document.getElementById(\'wfu_page_type\').value == \'page\' ? document.getElementById(\'wfu_page_list\').value : document.getElementById(\'wfu_post_list\').value) + \'&amp;nonce='.$add_shortcode_ticket.'\';">Ok</button>';
429
- $echo_str .= "\n\t\t".'<button style="float:right;" onclick="document.getElementById(\'wfu_page_type\').value = \'page\'; document.getElementById(\'wfu_page_list\').value = \'\'; document.getElementById(\'wfu_post_list\').value = \'\'; document.getElementById(\'wfu_add_plugin\').style.display = \'none\'; document.getElementById(\'wfu_add_plugin_button\').style.display = \'inline-block\';">Cancel</button>';
430
  $echo_str .= "\n\t\t".'</div>';
431
  $echo_str .= "\n\t\t".'<table class="widefat">';
432
  $echo_str .= "\n\t\t\t".'<thead>';
@@ -453,12 +461,12 @@ function wfu_manage_instances() {
453
  foreach ( $wfu_shortcodes as $key => $data ) {
454
  $id = $data['post_id'];
455
  $data_enc = wfu_encode_array_to_string($data);
456
- $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_shortcode_actions\')){document.getElementsByName(\'wfu_shortcode_actions\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_shortcode_actions_'.$i.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_shortcode_actions\')){document.getElementsByName(\'wfu_shortcode_actions\').item(i).style.visibility=\'hidden\';}">';
457
  $echo_str .= "\n\t\t\t\t\t".'<td style="padding: 5px 5px 5px 10px; text-align:center;">';
458
- $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_shortcode&data='.$data_enc.'" title="Plugin #'.$i.'">Plugin '.$i.'</a>';
459
- $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_shortcode_actions_'.$i.'" name="wfu_shortcode_actions" style="visibility:hidden;">';
460
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
461
- $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_shortcode&data='.$data_enc.'" title="Edit this shortcode">Edit</a>';
462
  $echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
463
  $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
464
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
@@ -518,9 +526,9 @@ function wfu_check_edit_shortcode($data) {
518
  return ( $hash == $data['post_hash'] );
519
  }
520
 
521
- function wfu_add_shortcode($postid) {
522
  $post = get_post($postid);
523
- $new_content = '[wordpress_file_upload]'.$post->post_content;
524
  $new_post = array( 'ID' => $postid, 'post_content' => $new_content );
525
  return ( wp_update_post( $new_post ) === 0 ? false : true );
526
  }
42
  idlog mediumint(9) NOT NULL AUTO_INCREMENT,
43
  userid mediumint(9) NOT NULL,
44
  uploaduserid mediumint(9) NOT NULL,
45
+ sessionid VARCHAR(40),
46
  filepath TEXT NOT NULL,
47
  filehash VARCHAR(100) NOT NULL,
48
  filesize bigint NOT NULL,
99
  $data_enc = (!empty($_POST['data']) ? $_POST['data'] : (!empty($_GET['data']) ? $_GET['data'] : ''));
100
  $postid = (!empty($_POST['postid']) ? $_POST['postid'] : (!empty($_GET['postid']) ? $_GET['postid'] : ''));
101
  $nonce = (!empty($_POST['nonce']) ? $_POST['nonce'] : (!empty($_GET['nonce']) ? $_GET['nonce'] : ''));
102
+ $tag = (!empty($_POST['tag']) ? $_POST['tag'] : (!empty($_GET['tag']) ? $_GET['tag'] : ''));
103
  $echo_str = "";
104
 
105
  if ( $action == 'edit_settings' ) {
164
  elseif ( $action == 'plugin_settings' ) {
165
  $echo_str = wfu_manage_settings();
166
  }
167
+ elseif ( $action == 'add_shortcode' && $postid != "" && $nonce != "" && $tag != "" ) {
168
  if ( $_SESSION['wfu_add_shortcode_ticket'] != $nonce ) $echo_str = wfu_manage_mainmenu();
169
+ elseif ( wfu_add_shortcode($postid, $tag) ) $echo_str = wfu_manage_mainmenu();
170
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_ADD_SHORTCODE_REJECTED);
171
  $_SESSION['wfu_add_shortcode_ticket'] = 'noticket';
172
  }
173
+ elseif ( $action == 'edit_shortcode' && $data_enc != "" && $tag != "" ) {
174
  $data = wfu_decode_array_from_string($data_enc);
175
+ if ( wfu_check_edit_shortcode($data) ) wfu_shortcode_composer($data, $tag);
176
  else $echo_str = wfu_manage_mainmenu(WFU_DASHBOARD_EDIT_SHORTCODE_REJECTED);
177
  }
178
  elseif ( $action == 'delete_shortcode' && $data_enc != "" ) {
225
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
226
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Edition</label>';
227
  $echo_str .= "\n\t\t\t\t\t".'</th>';
228
+ $echo_str .= "\n\t\t\t\t\t".'<td style="width:100px; vertical-align:top;">';
229
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Free</label>';
230
  $echo_str .= "\n\t\t\t\t\t".'</td>';
231
  $echo_str .= "\n\t\t\t\t\t".'<td>';
234
  $echo_str .= "\n\t\t\t\t\t\t\t".'<button onclick="if (this.innerText == \'See why >>\') {this.innerText = \'<< Close\'; document.getElementById(\'wfu_version_comparison\').style.display = \'block\';} else {this.innerText = \'See why >>\'; document.getElementById(\'wfu_version_comparison\').style.display = \'none\';}">See why >></button>';
235
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
236
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_version_comparison" style="display:none; background-color:lightyellow; border:1px solid yellow; margin:10px 0; padding:10px;">';
237
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<img src="'.WFU_IMAGE_VERSION_COMPARISON.'" style="display:block; margin-bottom:6px;" />';
238
  $echo_str .= "\n\t\t\t\t\t\t\t".'<a class="button-primary" href="'.WFU_PRO_VERSION_URL.'">Go for the PRO version</a>';
239
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
240
  $echo_str .= "\n\t\t\t\t\t".'</td>';
377
 
378
  function wfu_flatten_post_list($list) {
379
  $flat = array();
380
+ if ( !is_array($list) ) return $flat;
381
  foreach( $list as $item ) {
382
  $flat_item = array(
383
  'id' => $item['id'],
392
  }
393
 
394
  function wfu_manage_instances() {
395
+ $echo_str = wfu_manage_instances_of_shortcode('wordpress_file_upload', 'Uploader Instances', 'uploader', 1);
396
+
397
+ return $echo_str;
398
+ }
399
+
400
+ function wfu_manage_instances_of_shortcode($tag, $title, $slug, $inc) {
401
  $siteurl = site_url();
402
  $args = array( 'post_type' => array( "post", "page" ), 'post_status' => "publish,private,draft", 'posts_per_page' => -1 );
403
  $posts = get_posts($args);
404
  $wfu_shortcodes = array();
405
  foreach ( $posts as $post ) {
406
+ $ret = wfu_get_content_shortcodes($post, $tag);
407
  if ( $ret !== false ) $wfu_shortcodes = array_merge($wfu_shortcodes, $ret);
408
  }
409
 
410
  $list = wfu_construct_post_list($posts);
411
  $pagelist = wfu_flatten_post_list($list["page"]);
412
  $postlist = wfu_flatten_post_list($list["post"]);
 
413
 
414
+ $echo_str = "\n\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">'.$title.'</h3>';
415
+ $onchange_js = 'document.getElementById(\'wfu_add_plugin_ok_'.$inc.'\').disabled = !((document.getElementById(\'wfu_page_type_'.$inc.'\').value == \'page\' && document.getElementById(\'wfu_page_list_'.$inc.'\').value != \'\') || (document.getElementById(\'wfu_page_type_'.$inc.'\').value == \'post\' && document.getElementById(\'wfu_post_list_'.$inc.'\').value != \'\'));';
416
  $no_shortcodes = ( count($wfu_shortcodes) == 0 );
417
+ $echo_str .= "\n\t\t".'<div id="wfu_add_plugin_button_'.$inc.'" style="'. ( !$no_shortcodes ? '' : 'color:blue; font-weight:bold; font-size:larger;' ).'margin-bottom: 20px; margin-top: 10px;">';
418
  $addbutton_pre = ( !$no_shortcodes ? '' : '<label>Press </label>');
419
+ $addbutton_post = ( !$no_shortcodes ? '' : '<label> to get started and add the '.$slug.' in a page</label>');
420
+ $echo_str .= "\n\t\t\t".$addbutton_pre.'<button onclick="document.getElementById(\'wfu_add_plugin_button_'.$inc.'\').style.display = \'none\'; document.getElementById(\'wfu_add_plugin_'.$inc.'\').style.display = \'inline-block\'; '.$onchange_js.'">'.( !$no_shortcodes ? 'Add Plugin Instance' : 'here' ).'</button>'.$addbutton_post;
421
  $echo_str .= "\n\t\t".'</div>';
422
+ $echo_str .= "\n\t\t".'<div id="wfu_add_plugin_'.$inc.'" style="margin-bottom: 20px; margin-top: 10px; display:none;">';
423
+ $echo_str .= "\n\t\t\t".'<label>Add '.$slug.' to </label><select id="wfu_page_type_'.$inc.'" onchange="document.getElementById(\'wfu_page_list_'.$inc.'\').style.display = (this.value == \'page\' ? \'inline-block\' : \'none\'); document.getElementById(\'wfu_post_list_'.$inc.'\').style.display = (this.value == \'post\' ? \'inline-block\' : \'none\'); '.$onchange_js.'"><option value="page" selected="selected">Page</option><option value="post">Post</option></select>';
424
+ $echo_str .= "\n\t\t\t".'<select id="wfu_page_list_'.$inc.'" style="margin-bottom:6px;" onchange="'.$onchange_js.'">';
425
  $echo_str .= "\n\t\t\t\t".'<option value=""></option>';
426
  foreach ( $pagelist as $item )
427
  $echo_str .= "\n\t\t\t\t".'<option value="'.$item['id'].'">'.str_repeat('&nbsp;', 4 * $item['level']).( $item['status'] == 1 ? '[Private]' : ( $item['status'] == 2 ? '[Draft]' : '' ) ).$item['title'].'</option>';
428
  $echo_str .= "\n\t\t\t".'</select>';
429
+ $echo_str .= "\n\t\t\t".'<select id="wfu_post_list_'.$inc.'" style="display:none; margin-bottom:6px;" onchange="'.$onchange_js.'">';
430
  $echo_str .= "\n\t\t\t\t".'<option value=""></option>';
431
  foreach ( $postlist as $item )
432
  $echo_str .= "\n\t\t\t\t".'<option value="'.$item['id'].'">'.str_repeat('&nbsp;', 4 * $item['level']).( $item['status'] == 1 ? '[Private]' : ( $item['status'] == 2 ? '[Draft]' : '' ) ).$item['title'].'</option>';
433
  $echo_str .= "\n\t\t\t".'</select><br />';
434
  $add_shortcode_ticket = wfu_create_random_string(16);
435
  $_SESSION['wfu_add_shortcode_ticket'] = $add_shortcode_ticket;
436
+ $echo_str .= "\n\t\t".'<button id="wfu_add_plugin_ok_'.$inc.'" style="float:right; margin: 0 2px 0 4px;" disabled="disabled" onclick="document.getElementById(\'wfu_add_plugin_'.$inc.'\').style.display = \'none\'; window.location = \''.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=add_shortcode&amp;tag='.$tag.'&amp;postid=\' + (document.getElementById(\'wfu_page_type_'.$inc.'\').value == \'page\' ? document.getElementById(\'wfu_page_list_'.$inc.'\').value : document.getElementById(\'wfu_post_list_'.$inc.'\').value) + \'&amp;nonce='.$add_shortcode_ticket.'\';">Ok</button>';
437
+ $echo_str .= "\n\t\t".'<button style="float:right;" onclick="document.getElementById(\'wfu_page_type_'.$inc.'\').value = \'page\'; document.getElementById(\'wfu_page_list_'.$inc.'\').value = \'\'; document.getElementById(\'wfu_post_list_'.$inc.'\').value = \'\'; document.getElementById(\'wfu_add_plugin_'.$inc.'\').style.display = \'none\'; document.getElementById(\'wfu_add_plugin_button_'.$inc.'\').style.display = \'inline-block\';">Cancel</button>';
438
  $echo_str .= "\n\t\t".'</div>';
439
  $echo_str .= "\n\t\t".'<table class="widefat">';
440
  $echo_str .= "\n\t\t\t".'<thead>';
461
  foreach ( $wfu_shortcodes as $key => $data ) {
462
  $id = $data['post_id'];
463
  $data_enc = wfu_encode_array_to_string($data);
464
+ $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\')){document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_shortcode_actions_'.$inc.'_'.$i.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\')){document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\').item(i).style.visibility=\'hidden\';}">';
465
  $echo_str .= "\n\t\t\t\t\t".'<td style="padding: 5px 5px 5px 10px; text-align:center;">';
466
+ $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_shortcode&tag='.$tag.'&data='.$data_enc.'" title="Plugin #'.$i.'">Plugin '.$i.'</a>';
467
+ $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_shortcode_actions_'.$inc.'_'.$i.'" name="wfu_shortcode_actions_'.$inc.'" style="visibility:hidden;">';
468
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
469
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_shortcode&tag='.$tag.'&data='.$data_enc.'" title="Edit this shortcode">Edit</a>';
470
  $echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
471
  $echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
472
  $echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
526
  return ( $hash == $data['post_hash'] );
527
  }
528
 
529
+ function wfu_add_shortcode($postid, $tag) {
530
  $post = get_post($postid);
531
+ $new_content = '['.$tag.']'.$post->post_content;
532
  $new_post = array( 'ID' => $postid, 'post_content' => $new_content );
533
  return ( wp_update_post( $new_post ) === 0 ? false : true );
534
  }
lib/wfu_admin_browser.php CHANGED
@@ -14,6 +14,7 @@ function wfu_browse_files($basedir_code) {
14
  if ( isset($_SESSION['wfu_filepath_safe_storage']) && count($_SESSION['wfu_filepath_safe_storage']) > WFU_PHP_ARRAY_MAXLEN ) $_SESSION['wfu_filepath_safe_storage'] = array();
15
 
16
  //extract sort info from basedir
 
17
  if ( $basedir !== false ) {
18
  $ret = wfu_extract_sortdata_from_path($basedir);
19
  $basedir = $ret['path'];
@@ -28,7 +29,7 @@ function wfu_browse_files($basedir_code) {
28
  if ( substr($basedir, -1) != '/' ) $basedir .= '/';
29
  if ( substr($basedir, 0, 1) == '/' ) $basedir = substr($basedir, 1);
30
  //calculate the absolute path of basedir knowing that basedir is relative to website root
31
- $basedir = ABSPATH.$basedir;
32
  if ( !file_exists($basedir) ) $basedir = false;
33
  }
34
  //set basedit to default value if empty
@@ -74,26 +75,26 @@ function wfu_browse_files($basedir_code) {
74
  }
75
  //file browser header
76
  $echo_str .= "\n\t".'</div>';
77
- // $dir_code = wfu_safe_store_filepath(substr($basedir, strlen(ABSPATH)).'[['.$sort.']]');
78
  // $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>';
79
  $echo_str .= "\n\t".'<div style="margin-top:10px;">';
80
  $echo_str .= "\n\t\t".'<table class="widefat">';
81
  $echo_str .= "\n\t\t\t".'<thead>';
82
  $echo_str .= "\n\t\t\t\t".'<tr>';
83
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
84
- $dir_code = wfu_safe_store_filepath(substr($basedir, strlen(ABSPATH)).'[['.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? '-name' : 'name' ) : 'name' ).']]');
85
  $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>';
86
  $echo_str .= "\n\t\t\t\t\t".'</th>';
87
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:right;">';
88
- $dir_code = wfu_safe_store_filepath(substr($basedir, strlen(ABSPATH)).'[['.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? '-size' : 'size' ) : 'size' ).']]');
89
  $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>';
90
  $echo_str .= "\n\t\t\t\t\t".'</th>';
91
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="20%" style="text-align:left;">';
92
- $dir_code = wfu_safe_store_filepath(substr($basedir, strlen(ABSPATH)).'[['.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? '-date' : 'date' ) : 'date' ).']]');
93
  $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>';
94
  $echo_str .= "\n\t\t\t\t\t".'</th>';
95
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:center;">';
96
- $dir_code = wfu_safe_store_filepath(substr($basedir, strlen(ABSPATH)).'[['.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? '-user' : 'user' ) : 'user' ).']]');
97
  $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>';
98
  $echo_str .= "\n\t\t\t\t\t".'</th>';
99
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
@@ -139,7 +140,7 @@ function wfu_browse_files($basedir_code) {
139
 
140
  //show subfolders first
141
  if ( $reldir != "root/" ) {
142
- $dir_code = wfu_safe_store_filepath(substr($updir, strlen(ABSPATH)));
143
  $echo_str .= "\n\t\t\t\t".'<tr>';
144
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
145
  $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'" title="go up">..</a>';
@@ -152,7 +153,7 @@ function wfu_browse_files($basedir_code) {
152
  }
153
  $ii = 1;
154
  foreach ( $dirlist as $dir ) {
155
- $dir_code = wfu_safe_store_filepath(substr($dir['fullpath'], strlen(ABSPATH)).'[['.$sort.']]');
156
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_dir_actions\')){document.getElementsByName(\'wfu_dir_actions\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_dir_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_dir_actions\')){document.getElementsByName(\'wfu_dir_actions\').item(i).style.visibility=\'hidden\';}">';
157
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
158
  $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'" title="'.$dir['name'].'">'.$dir['name'].'</a>';
@@ -179,7 +180,7 @@ function wfu_browse_files($basedir_code) {
179
  }
180
  //show contained files
181
  foreach ( $filelist as $file ) {
182
- if ( $file['filedata'] != null ) $file_code = wfu_safe_store_filepath(substr($file['fullpath'], strlen(ABSPATH)).'[['.$sort.']]');
183
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_file_actions\')){document.getElementsByName(\'wfu_file_actions\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_file_actions\')){document.getElementsByName(\'wfu_file_actions\').item(i).style.visibility=\'hidden\';}">';
184
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
185
  if ( $file['filedata'] != null )
@@ -239,14 +240,15 @@ function wfu_browse_files($basedir_code) {
239
  }
240
 
241
  function wfu_current_user_owes_file($filepath) {
242
- //first check if file is php; for security reasons php files cannot be owned
243
- if ( preg_match("/\.php$/", $filepath) ) return false;
244
  //then get file data from database, if exist
245
  $filerec = wfu_get_file_rec($filepath, false);
246
  if ( $filerec == null ) return false;
247
 
248
  $user = wp_get_current_user();
249
- if ( 0 == $user->ID ) return false;
 
250
  if ( current_user_can('manage_options') ) return true;
251
  return false;
252
  }
@@ -292,7 +294,7 @@ function wfu_rename_file_prompt($file_code, $type, $error) {
292
 
293
  //first extract sort info from dec_file
294
  $ret = wfu_extract_sortdata_from_path($dec_file);
295
- $dec_file = ABSPATH.$ret['path'];
296
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
297
 
298
  //check if user is allowed to perform this action
@@ -300,7 +302,7 @@ function wfu_rename_file_prompt($file_code, $type, $error) {
300
 
301
  $parts = pathinfo($dec_file);
302
  $newname = $parts['basename'];
303
- $dir_code = wfu_safe_store_filepath(substr($parts['dirname'], strlen(ABSPATH)).'[['.$ret['sort'].']]');
304
 
305
  $echo_str = "\n".'<div class="wrap">';
306
  if ( $error ) {
@@ -342,7 +344,7 @@ function wfu_rename_file($file_code, $type) {
342
  $dec_file = wfu_get_filepath_from_safe($file_code);
343
  if ( $dec_file === false ) return;
344
 
345
- $dec_file = ABSPATH.wfu_flatten_path($dec_file);
346
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
347
  if ( !file_exists($dec_file) ) return;
348
 
@@ -354,8 +356,6 @@ function wfu_rename_file($file_code, $type) {
354
  if ( isset($_POST['wfu_newname']) && isset($_POST['submit']) ) {
355
  if ( $_POST['submit'] == "Rename" && $_POST['wfu_newname'] != $parts['basename'] ) {
356
  $new_file = $parts['dirname'].'/'.$_POST['wfu_newname'];
357
- $relativepath = str_replace(ABSPATH, '', $new_file);
358
- if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
359
  if ( $_POST['wfu_newname'] == "" ) $error = 'Error: New '.( $type == 'dir' ? 'folder ' : 'file' ).'name cannot be empty!';
360
  elseif ( preg_match("/[^A-Za-z0-9_.#\-$]/", $_POST['wfu_newname']) ) $error = 'Error: name contained invalid characters that were stripped off! Please try again.';
361
  elseif ( substr($_POST['wfu_newname'], -1 - strlen($parts['extension'])) != '.'.$parts['extension'] ) $error = 'Error: new and old file name extensions must be identical! Please correct.';
@@ -394,14 +394,14 @@ function wfu_delete_file_prompt($file_code, $type) {
394
 
395
  //first extract sort info from dec_file
396
  $ret = wfu_extract_sortdata_from_path($dec_file);
397
- $dec_file = ABSPATH.$ret['path'];
398
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
399
 
400
  //check if user is allowed to perform this action
401
  if ( !wfu_current_user_owes_file($dec_file) ) return;
402
 
403
  $parts = pathinfo($dec_file);
404
- $dir_code = wfu_safe_store_filepath(substr($parts['dirname'], strlen(ABSPATH)).'[['.$ret['sort'].']]');
405
 
406
  $echo_str = "\n".'<div class="wrap">';
407
  $echo_str .= "\n\t".'<div style="margin-top:20px;">';
@@ -435,7 +435,7 @@ function wfu_delete_file($file_code, $type) {
435
  $dec_file = wfu_get_filepath_from_safe($file_code);
436
  if ( $dec_file === false ) return;
437
 
438
- $dec_file = ABSPATH.wfu_flatten_path($dec_file);
439
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
440
 
441
  //check if user is allowed to perform this action
@@ -467,7 +467,7 @@ function wfu_create_dir_prompt($dir_code, $error) {
467
 
468
  //first extract sort info from dec_dir
469
  $ret = wfu_extract_sortdata_from_path($dec_dir);
470
- $dec_dir = ABSPATH.$ret['path'];
471
  if ( substr($dec_dir, -1) != '/' ) $dec_dir .= '/';
472
  $newname = '';
473
 
@@ -505,7 +505,7 @@ function wfu_create_dir($dir_code) {
505
  $dec_dir = wfu_get_filepath_from_safe($dir_code);
506
  if ( $dec_dir === false ) return;
507
 
508
- $dec_dir = ABSPATH.wfu_flatten_path($dec_dir);
509
  if ( substr($dec_dir, -1) != '/' ) $dec_dir .= '/';
510
  if ( !file_exists($dec_dir) ) return;
511
  $error = "";
@@ -542,7 +542,7 @@ function wfu_file_details($file_code, $errorstatus) {
542
 
543
  //extract file browser data from $file variable
544
  $ret = wfu_extract_sortdata_from_path($dec_file);
545
- $filepath = ABSPATH.$ret['path'];
546
 
547
  //check if user is allowed to perform this action
548
  if ( !wfu_current_user_owes_file($filepath) ) return;
@@ -556,7 +556,7 @@ function wfu_file_details($file_code, $errorstatus) {
556
 
557
  //extract sort info and construct contained dir
558
  $parts = pathinfo($filepath);
559
- $dir_code = wfu_safe_store_filepath(substr($parts['dirname'], strlen(ABSPATH)).'[['.$ret['sort'].']]');
560
 
561
  $stat = stat($filepath);
562
 
@@ -734,7 +734,7 @@ function wfu_edit_filedetails($file_code) {
734
  $dec_file = wfu_get_filepath_from_safe($file_code);
735
  if ( $dec_file === false ) return;
736
 
737
- $dec_file = ABSPATH.wfu_flatten_path($dec_file);
738
 
739
  //check if user is allowed to perform this action
740
  if ( !wfu_current_user_owes_file($dec_file) ) return;
14
  if ( isset($_SESSION['wfu_filepath_safe_storage']) && count($_SESSION['wfu_filepath_safe_storage']) > WFU_PHP_ARRAY_MAXLEN ) $_SESSION['wfu_filepath_safe_storage'] = array();
15
 
16
  //extract sort info from basedir
17
+ $sort = "";
18
  if ( $basedir !== false ) {
19
  $ret = wfu_extract_sortdata_from_path($basedir);
20
  $basedir = $ret['path'];
29
  if ( substr($basedir, -1) != '/' ) $basedir .= '/';
30
  if ( substr($basedir, 0, 1) == '/' ) $basedir = substr($basedir, 1);
31
  //calculate the absolute path of basedir knowing that basedir is relative to website root
32
+ $basedir = wfu_path_rel2abs($basedir);
33
  if ( !file_exists($basedir) ) $basedir = false;
34
  }
35
  //set basedit to default value if empty
75
  }
76
  //file browser header
77
  $echo_str .= "\n\t".'</div>';
78
+ // $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.$sort.']]');
79
  // $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>';
80
  $echo_str .= "\n\t".'<div style="margin-top:10px;">';
81
  $echo_str .= "\n\t\t".'<table class="widefat">';
82
  $echo_str .= "\n\t\t\t".'<thead>';
83
  $echo_str .= "\n\t\t\t\t".'<tr>';
84
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
85
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'name' ? ( $order == SORT_ASC ? '-name' : 'name' ) : 'name' ).']]');
86
  $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>';
87
  $echo_str .= "\n\t\t\t\t\t".'</th>';
88
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:right;">';
89
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'size' ? ( $order == SORT_ASC ? '-size' : 'size' ) : 'size' ).']]');
90
  $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>';
91
  $echo_str .= "\n\t\t\t\t\t".'</th>';
92
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="20%" style="text-align:left;">';
93
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'date' ? ( $order == SORT_ASC ? '-date' : 'date' ) : 'date' ).']]');
94
  $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>';
95
  $echo_str .= "\n\t\t\t\t\t".'</th>';
96
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="10%" style="text-align:center;">';
97
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.( substr($sort, -4) == 'user' ? ( $order == SORT_ASC ? '-user' : 'user' ) : 'user' ).']]');
98
  $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>';
99
  $echo_str .= "\n\t\t\t\t\t".'</th>';
100
  $echo_str .= "\n\t\t\t\t\t".'<th scope="col" width="30%" style="text-align:left;">';
140
 
141
  //show subfolders first
142
  if ( $reldir != "root/" ) {
143
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($updir));
144
  $echo_str .= "\n\t\t\t\t".'<tr>';
145
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
146
  $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'" title="go up">..</a>';
153
  }
154
  $ii = 1;
155
  foreach ( $dirlist as $dir ) {
156
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($dir['fullpath']).'[['.$sort.']]');
157
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_dir_actions\')){document.getElementsByName(\'wfu_dir_actions\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_dir_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_dir_actions\')){document.getElementsByName(\'wfu_dir_actions\').item(i).style.visibility=\'hidden\';}">';
158
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
159
  $echo_str .= "\n\t\t\t\t\t\t".'<a class="row-title" href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir='.$dir_code.'" title="'.$dir['name'].'">'.$dir['name'].'</a>';
180
  }
181
  //show contained files
182
  foreach ( $filelist as $file ) {
183
+ if ( $file['filedata'] != null ) $file_code = wfu_safe_store_filepath(wfu_path_abs2rel($file['fullpath']).'[['.$sort.']]');
184
  $echo_str .= "\n\t\t\t\t".'<tr onmouseover="for (i in document.getElementsByName(\'wfu_file_actions\')){document.getElementsByName(\'wfu_file_actions\').item(i).style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="for (i in document.getElementsByName(\'wfu_file_actions\')){document.getElementsByName(\'wfu_file_actions\').item(i).style.visibility=\'hidden\';}">';
185
  $echo_str .= "\n\t\t\t\t\t".'<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
186
  if ( $file['filedata'] != null )
240
  }
241
 
242
  function wfu_current_user_owes_file($filepath) {
243
+ //first check if file has a restricted extension; for security reasons some file extensions cannot be owned
244
+ if ( wfu_file_extension_restricted($filepath) ) return false;
245
  //then get file data from database, if exist
246
  $filerec = wfu_get_file_rec($filepath, false);
247
  if ( $filerec == null ) return false;
248
 
249
  $user = wp_get_current_user();
250
+ if ( 0 == $user->ID )
251
+ return false;
252
  if ( current_user_can('manage_options') ) return true;
253
  return false;
254
  }
294
 
295
  //first extract sort info from dec_file
296
  $ret = wfu_extract_sortdata_from_path($dec_file);
297
+ $dec_file = wfu_path_rel2abs($ret['path']);
298
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
299
 
300
  //check if user is allowed to perform this action
302
 
303
  $parts = pathinfo($dec_file);
304
  $newname = $parts['basename'];
305
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($parts['dirname']).'[['.$ret['sort'].']]');
306
 
307
  $echo_str = "\n".'<div class="wrap">';
308
  if ( $error ) {
344
  $dec_file = wfu_get_filepath_from_safe($file_code);
345
  if ( $dec_file === false ) return;
346
 
347
+ $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
348
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
349
  if ( !file_exists($dec_file) ) return;
350
 
356
  if ( isset($_POST['wfu_newname']) && isset($_POST['submit']) ) {
357
  if ( $_POST['submit'] == "Rename" && $_POST['wfu_newname'] != $parts['basename'] ) {
358
  $new_file = $parts['dirname'].'/'.$_POST['wfu_newname'];
 
 
359
  if ( $_POST['wfu_newname'] == "" ) $error = 'Error: New '.( $type == 'dir' ? 'folder ' : 'file' ).'name cannot be empty!';
360
  elseif ( preg_match("/[^A-Za-z0-9_.#\-$]/", $_POST['wfu_newname']) ) $error = 'Error: name contained invalid characters that were stripped off! Please try again.';
361
  elseif ( substr($_POST['wfu_newname'], -1 - strlen($parts['extension'])) != '.'.$parts['extension'] ) $error = 'Error: new and old file name extensions must be identical! Please correct.';
394
 
395
  //first extract sort info from dec_file
396
  $ret = wfu_extract_sortdata_from_path($dec_file);
397
+ $dec_file = wfu_path_rel2abs($ret['path']);
398
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
399
 
400
  //check if user is allowed to perform this action
401
  if ( !wfu_current_user_owes_file($dec_file) ) return;
402
 
403
  $parts = pathinfo($dec_file);
404
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($parts['dirname']).'[['.$ret['sort'].']]');
405
 
406
  $echo_str = "\n".'<div class="wrap">';
407
  $echo_str .= "\n\t".'<div style="margin-top:20px;">';
435
  $dec_file = wfu_get_filepath_from_safe($file_code);
436
  if ( $dec_file === false ) return;
437
 
438
+ $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
439
  if ( $type == 'dir' && substr($dec_file, -1) == '/' ) $dec_file = substr($dec_file, 0, -1);
440
 
441
  //check if user is allowed to perform this action
467
 
468
  //first extract sort info from dec_dir
469
  $ret = wfu_extract_sortdata_from_path($dec_dir);
470
+ $dec_dir = wfu_path_rel2abs($ret['path']);
471
  if ( substr($dec_dir, -1) != '/' ) $dec_dir .= '/';
472
  $newname = '';
473
 
505
  $dec_dir = wfu_get_filepath_from_safe($dir_code);
506
  if ( $dec_dir === false ) return;
507
 
508
+ $dec_dir = wfu_path_rel2abs(wfu_flatten_path($dec_dir));
509
  if ( substr($dec_dir, -1) != '/' ) $dec_dir .= '/';
510
  if ( !file_exists($dec_dir) ) return;
511
  $error = "";
542
 
543
  //extract file browser data from $file variable
544
  $ret = wfu_extract_sortdata_from_path($dec_file);
545
+ $filepath = wfu_path_rel2abs($ret['path']);
546
 
547
  //check if user is allowed to perform this action
548
  if ( !wfu_current_user_owes_file($filepath) ) return;
556
 
557
  //extract sort info and construct contained dir
558
  $parts = pathinfo($filepath);
559
+ $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($parts['dirname']).'[['.$ret['sort'].']]');
560
 
561
  $stat = stat($filepath);
562
 
734
  $dec_file = wfu_get_filepath_from_safe($file_code);
735
  if ( $dec_file === false ) return;
736
 
737
+ $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
738
 
739
  //check if user is allowed to perform this action
740
  if ( !wfu_current_user_owes_file($dec_file) ) return;
lib/wfu_admin_composer.php CHANGED
@@ -1,18 +1,24 @@
1
  <?php
2
 
3
- function wfu_shortcode_composer($data = '') {
4
  global $wpdb;
5
  global $wp_roles;
6
  $siteurl = site_url();
7
 
8
  $components = wfu_component_definitions();
9
- $cats = wfu_category_definitions();
10
- $defs = wfu_attribute_definitions();
 
 
 
 
 
 
11
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
12
 
13
  if ( $data == "" ) {
14
  $shortcode = $plugin_options['shortcode'];
15
- $shortcode_full = '[wordpress_file_upload '.$shortcode.']';
16
  $postid = "";
17
  $postname = "";
18
  $posttype = "";
@@ -21,7 +27,7 @@ function wfu_shortcode_composer($data = '') {
21
  $autosave = true;
22
  }
23
  else {
24
- $shortcode = trim(substr($data['shortcode'], strlen('[wordpress_file_upload'), -1));
25
  $shortcode_full = $data['shortcode'];
26
  $postid = $data['post_id'];
27
  $postname = get_the_title($postid);
@@ -38,7 +44,7 @@ function wfu_shortcode_composer($data = '') {
38
  if ( array_key_exists($def['attribute'], $shortcode_attrs) ) {
39
  $defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
40
  }
41
- if ( $def['attribute'] == 'uploadid' ) $shortcode_id = $defs[$key]['value'];
42
  }
43
 
44
  // index $components
@@ -65,6 +71,7 @@ function wfu_shortcode_composer($data = '') {
65
  $echo_str .= "\n\t".'<div style="margin-top:10px; display:inline-block;">';
66
  if ( $data != "") $echo_str .= "\n\t\t".'<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
67
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_original_enc" type="hidden" value="'.wfu_plugin_encode_string($shortcode_full).'" />';
 
68
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_postid" type="hidden" value="'.$postid.'" />';
69
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_posthash" type="hidden" value="'.$posthash.'" />';
70
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_position" type="hidden" value="'.$shortcode_position.'" />';
@@ -73,7 +80,7 @@ function wfu_shortcode_composer($data = '') {
73
  $echo_str .= "\n\t\t".'<div class="wfu_shortcode_container">';
74
  $echo_str .= "\n\t\t\t".'<span><strong>Generated Shortcode</strong></span>';
75
  $echo_str .= "\n\t\t\t".'<span id="wfu_save_label" class="wfu_save_label">saved</span>';
76
- $echo_str .= "\n\t\t\t".'<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">[wordpress_file_upload]</textarea>';
77
  $echo_str .= "\n\t\t\t".'<div id="wfu_attribute_defaults" style="display:none;">';
78
  foreach ( $defs as $def )
79
  $echo_str .= "\n\t\t\t\t".'<input id="wfu_attribute_default_'.$def['attribute'].'" type="hidden" value="'.$def['default'].'" />';
@@ -392,7 +399,7 @@ function wfu_shortcode_composer($data = '') {
392
  if ( $def['value'] == "all" ) $selected = array($users[0]->user_login);
393
  else $selected = explode(",", $def['value']);
394
  $echo_str .= $dlp."\t\t".'<table class="wfu_userlist_container"><tbody><tr><td>';
395
- $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.count($users).'" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' disabled="disabled"' : '' ).'>';
396
  foreach ( $users as $userid => $user )
397
  $echo_str .= $dlp."\t\t\t".'<option value="'.$user->user_login.'"'.( in_array($user->user_login, $selected) ? ' selected="selected"' : '' ).'>'.$user->display_name.' ('.$user->user_login.')</option>';
398
  $echo_str .= $dlp."\t\t".'</select>';
@@ -401,6 +408,54 @@ function wfu_shortcode_composer($data = '') {
401
  $echo_str .= $dlp."\t\t".'<div class="wfu_userlist_checkall"><input id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all (including guests)</label></div>';
402
  $echo_str .= $dlp."\t\t".'</td></tr></tbody></table>';
403
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  elseif ( $def['type'] == "dimensions" ) {
405
  $vals_arr = explode(",", $def['value']);
406
  $vals = array();
1
  <?php
2
 
3
+ function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upload') {
4
  global $wpdb;
5
  global $wp_roles;
6
  $siteurl = site_url();
7
 
8
  $components = wfu_component_definitions();
9
+ if ( $shortcode_tag == 'wordpress_file_upload' ) {
10
+ $cats = wfu_category_definitions();
11
+ $defs = wfu_attribute_definitions();
12
+ }
13
+ else {
14
+ $cats = wfu_browser_category_definitions();
15
+ $defs = wfu_browser_attribute_definitions();
16
+ }
17
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
18
 
19
  if ( $data == "" ) {
20
  $shortcode = $plugin_options['shortcode'];
21
+ $shortcode_full = '['.$shortcode_tag.' '.$shortcode.']';
22
  $postid = "";
23
  $postname = "";
24
  $posttype = "";
27
  $autosave = true;
28
  }
29
  else {
30
+ $shortcode = trim(substr($data['shortcode'], strlen('['.$shortcode_tag), -1));
31
  $shortcode_full = $data['shortcode'];
32
  $postid = $data['post_id'];
33
  $postname = get_the_title($postid);
44
  if ( array_key_exists($def['attribute'], $shortcode_attrs) ) {
45
  $defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
46
  }
47
+ if ( $def['attribute'] == 'uploadid' || $def['attribute'] == 'browserid' ) $shortcode_id = $defs[$key]['value'];
48
  }
49
 
50
  // index $components
71
  $echo_str .= "\n\t".'<div style="margin-top:10px; display:inline-block;">';
72
  if ( $data != "") $echo_str .= "\n\t\t".'<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
73
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_original_enc" type="hidden" value="'.wfu_plugin_encode_string($shortcode_full).'" />';
74
+ $echo_str .= "\n\t\t".'<input id="wfu_shortcode_tag" type="hidden" value="'.$shortcode_tag.'" />';
75
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_postid" type="hidden" value="'.$postid.'" />';
76
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_posthash" type="hidden" value="'.$posthash.'" />';
77
  $echo_str .= "\n\t\t".'<input id="wfu_shortcode_position" type="hidden" value="'.$shortcode_position.'" />';
80
  $echo_str .= "\n\t\t".'<div class="wfu_shortcode_container">';
81
  $echo_str .= "\n\t\t\t".'<span><strong>Generated Shortcode</strong></span>';
82
  $echo_str .= "\n\t\t\t".'<span id="wfu_save_label" class="wfu_save_label">saved</span>';
83
+ $echo_str .= "\n\t\t\t".'<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">['.$shortcode_tag.']</textarea>';
84
  $echo_str .= "\n\t\t\t".'<div id="wfu_attribute_defaults" style="display:none;">';
85
  foreach ( $defs as $def )
86
  $echo_str .= "\n\t\t\t\t".'<input id="wfu_attribute_default_'.$def['attribute'].'" type="hidden" value="'.$def['default'].'" />';
399
  if ( $def['value'] == "all" ) $selected = array($users[0]->user_login);
400
  else $selected = explode(",", $def['value']);
401
  $echo_str .= $dlp."\t\t".'<table class="wfu_userlist_container"><tbody><tr><td>';
402
+ $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.min(count($users), 10).'" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' disabled="disabled"' : '' ).'>';
403
  foreach ( $users as $userid => $user )
404
  $echo_str .= $dlp."\t\t\t".'<option value="'.$user->user_login.'"'.( in_array($user->user_login, $selected) ? ' selected="selected"' : '' ).'>'.$user->display_name.' ('.$user->user_login.')</option>';
405
  $echo_str .= $dlp."\t\t".'</select>';
408
  $echo_str .= $dlp."\t\t".'<div class="wfu_userlist_checkall"><input id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all (including guests)</label></div>';
409
  $echo_str .= $dlp."\t\t".'</td></tr></tbody></table>';
410
  }
411
+ elseif ( $def['type'] == "columns" ) {
412
+ $selected = explode(",", $def['value']);
413
+ if ( count($selected) == 1 && $selected[0] == "" ) $selected = array();
414
+ $echo_str .= $dlp."\t".'<table class="wfu_columns_container"><tbody><tr>';
415
+ $echo_str .= $dlp."\t\t".'<td>';
416
+ $echo_str .= $dlp."\t\t\t".'<label class="wfu_columns_listtitle">Available Columns</label><br />';
417
+ $echo_str .= $dlp."\t\t\t".'<select id="wfu_attribute_'.$attr.'_sourcelist" multiple="multiple" size="'.min(count($def['listitems']), 10).'">';
418
+ foreach ( $def['listitems'] as $item ) {
419
+ $item_required = ( substr($item, 0, 1) == "*" );
420
+ if ( $item_required ) $item = substr($item, 1);
421
+ $item_parts = explode("/", $item, 2);
422
+ if ( count($item_parts) == 1 ) {
423
+ $item_name = $item;
424
+ $item_label = $item.( $item_required ? ' (required)' : '' );
425
+ }
426
+ else {
427
+ $item_name = $item_parts[0];
428
+ $item_label = $item_parts[1];
429
+ }
430
+ $itemprops[$item_name] = array( 'label' => $item_label, 'required' => $item_required );
431
+ $echo_str .= $dlp."\t\t\t\t".'<option value="'.$item_name.'"'.( $item_required ? ' class="wfu_columns_item_required"' : '' ).' onclick="wfu_columns_itemclicked(this);">'.$item_label.'</option>';
432
+ }
433
+ $echo_str .= $dlp."\t\t\t".'</select>';
434
+ $echo_str .= $dlp."\t\t".'</td>';
435
+ foreach ( $itemprops as $item_name => $prop )
436
+ if ( $prop['required'] && !in_array($item_name, $selected) )
437
+ array_splice($selected, 0, 0, array( $item_name ));
438
+ $echo_str .= $dlp."\t\t".'<td align="center">';
439
+ $echo_str .= $dlp."\t\t\t".'<label class="wfu_columns_listtitle"></label><br />';
440
+ $echo_str .= $dlp."\t\t\t".'<button class="wfu_columns_addbutton" onclick="wfu_columns_buttonaction(\''.$attr.'\', \'add\');">Add &gt;&gt;</button><br />';
441
+ $echo_str .= $dlp."\t\t\t".'<button class="wfu_columns_addbutton" onclick="wfu_columns_buttonaction(\''.$attr.'\', \'del\');">&lt;&lt; Remove</button>';
442
+ $echo_str .= $dlp."\t\t".'</td>';
443
+ $echo_str .= $dlp."\t\t".'<td>';
444
+ $echo_str .= $dlp."\t\t\t".'<label class="wfu_columns_listtitle">Displayed Columns</label><br />';
445
+ $echo_str .= $dlp."\t\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.min(count($def['listitems']), 10).'" onchange="wfu_update_columns(\''.$attr.'\');">';
446
+ foreach ( $selected as $item_name ) {
447
+ $echo_str .= $dlp."\t\t\t\t".'<option value="'.$item_name.'"'.( $itemprops[$item_name]['required'] ? ' class="wfu_columns_item_required"' : '' ).' onclick="wfu_columns_itemclicked(this);">'.$itemprops[$item_name]['label'].'</option>';
448
+ }
449
+ $echo_str .= $dlp."\t\t\t".'</select>';
450
+ $echo_str .= $dlp."\t\t".'</td>';
451
+ $echo_str .= $dlp."\t\t".'<td align="center">';
452
+ $echo_str .= $dlp."\t\t\t".'<label class="wfu_columns_listtitle"></label><br />';
453
+ $echo_str .= $dlp."\t\t\t".'<button class="wfu_columns_addbutton" onclick="wfu_columns_buttonaction(\''.$attr.'\', \'up\');">&#8593;</button><br />';
454
+ $echo_str .= $dlp."\t\t\t".'<button class="wfu_columns_addbutton" onclick="wfu_columns_buttonaction(\''.$attr.'\', \'down\');">&#8595;</button>';
455
+ $echo_str .= $dlp."\t\t".'</td>';
456
+ $echo_str .= $dlp."\t".'</tr></tbody></table>';
457
+
458
+ }
459
  elseif ( $def['type'] == "dimensions" ) {
460
  $vals_arr = explode(",", $def['value']);
461
  $vals = array();
lib/wfu_ajaxactions.php CHANGED
@@ -151,30 +151,29 @@ function wfu_ajax_action_callback() {
151
 
152
  function wfu_ajax_action_save_shortcode() {
153
  if ( !current_user_can( 'manage_options' ) ) die();
154
- if ( !isset($_POST['shortcode']) || !isset($_POST['shortcode_original']) || !isset($_POST['post_id']) || !isset($_POST['post_hash']) || !isset($_POST['shortcode_position']) ) die();
 
 
 
 
 
 
 
 
155
 
156
  if ( $_POST['post_id'] == "" ) {
157
- $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
158
- $new_plugin_options['version'] = '1.0';
159
- $new_plugin_options['shortcode'] = $plugin_options['shortcode'];
160
- $new_plugin_options['hashfiles'] = $plugin_options['hashfiles'];
161
- $new_plugin_options['basedir'] = $plugin_options['basedir'];
162
- $new_plugin_options['postmethod'] = $plugin_options['postmethod'];
163
- $encoded_options = wfu_encode_plugin_options($new_plugin_options);
164
- update_option( "wordpress_file_upload_options", $encoded_options );
165
-
166
- die("wfu_save_shortcode:success:");
167
  }
168
  else {
169
- $data['post_id'] = $_POST['post_id'];
170
- $data['post_hash'] = $_POST['post_hash'];
171
- $data['shortcode'] = wfu_plugin_decode_string($_POST['shortcode_original']);
172
- $data['position'] = $_POST['shortcode_position'];
173
  if ( !wfu_check_edit_shortcode($data) ) die("wfu_save_shortcode:fail:post_modified");
174
  else {
175
- $new_shortcode = "[wordpress_file_upload ".wfu_plugin_decode_string($_POST['shortcode'])."]";
176
  if ( wfu_replace_shortcode($data, $new_shortcode) ) {
177
- $post = get_post($_POST['post_id']);
178
  $hash = hash('md5', $post->post_content);
179
  die("wfu_save_shortcode:success:".$hash);
180
  }
@@ -196,10 +195,16 @@ function wfu_ajax_action_check_page_contents() {
196
 
197
  function wfu_ajax_action_edit_shortcode() {
198
  if ( !current_user_can( 'manage_options' ) ) die();
199
- if ( !isset($_POST['upload_id']) || !isset($_POST['post_id']) || !isset($_POST['post_hash']) ) die();
200
 
201
- $data['post_id'] = $_POST['post_id'];
202
- $data['post_hash'] = $_POST['post_hash'];
 
 
 
 
 
 
203
  if ( wfu_check_edit_shortcode($data) ) {
204
  $post = get_post($data['post_id']);
205
  //get default value for uploadid
@@ -212,22 +217,22 @@ function wfu_ajax_action_edit_shortcode() {
212
  }
213
  }
214
  //get page shortcodes
215
- $wfu_shortcodes = wfu_get_content_shortcodes($post, 'wordpress_file_upload');
216
  //find the shortcodes' uploadid and the correct one
217
  $validkey = -1;
218
  foreach ( $wfu_shortcodes as $key => $data ) {
219
- $shortcode = trim(substr($data['shortcode'], strlen('[wordpress_file_upload'), -1));
220
  $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
221
  if ( array_key_exists('uploadid', $shortcode_attrs) ) $uploadid = $shortcode_attrs['uploadid'];
222
  else $uploadid = $default;
223
- if ( $uploadid == $_POST['upload_id'] ) {
224
  $validkey = $key;
225
  break;
226
  }
227
  }
228
  if ( $validkey == -1 ) die();
229
  $data_enc = wfu_encode_array_to_string($wfu_shortcodes[$validkey]);
230
- $url = site_url().'/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_shortcode&data='.$data_enc;
231
  die("wfu_edit_shortcode:success:".wfu_plugin_encode_string($url));
232
  }
233
  else die("wfu_edit_shortcode:check_page_obsolete:".WFU_ERROR_PAGE_OBSOLETE);
@@ -279,20 +284,20 @@ function wfu_ajax_action_download_file_invoker() {
279
  $file_code = (isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : ''));
280
  $nonce = (isset($_POST['nonce']) ? $_POST['nonce'] : (isset($_GET['nonce']) ? $_GET['nonce'] : ''));
281
  if ( $file_code == '' || $nonce == '' ) die();
282
-
283
  //security check to avoid CSRF attacks
284
  if ( !wp_verify_nonce($nonce, 'wfu_download_file_invoker') ) die();
285
 
286
  //check if user is allowed to download files
287
  if ( !current_user_can( 'manage_options' ) ) {
288
- die();
289
  }
290
 
291
  // $filepath = wfu_plugin_decode_string($file_code);
292
  $file_code = wfu_sanitize_code($file_code);
293
  $filepath = wfu_get_filepath_from_safe($file_code);
294
  if ( $filepath === false ) die();
295
- $filepath = ABSPATH.wfu_flatten_path($filepath);
296
 
297
  //check if user is allowed to perform this action on this file
298
  if ( !wfu_current_user_owes_file($filepath) ) die();
@@ -346,7 +351,7 @@ function wfu_ajax_action_download_file_monitor() {
346
  // $filepath = wfu_plugin_decode_string($file_code);
347
  $filepath = wfu_get_filepath_from_safe($file_code);
348
  if ( $filepath === false ) die();
349
- $filepath = wfu_flatten_path($filepath);
350
  wfu_log_action('download', $filepath, $user->ID, '', 0, '', null);
351
  die('wfu_ajax_action_download_file_monitor:'.$_SESSION['wfu_download_status_'.$id].':');
352
  }
@@ -357,6 +362,7 @@ function wfu_ajax_action_download_file_monitor() {
357
  }
358
  }
359
 
 
360
  function wfu_ajax_action_notify_wpfilebase() {
361
  $params_index = (isset($_POST['params_index']) ? $_POST['params_index'] : (isset($_GET['params_index']) ? $_GET['params_index'] : ''));
362
  $session_token = (isset($_POST['session_token']) ? $_POST['session_token'] : (isset($_GET['session_token']) ? $_GET['session_token'] : ''));
151
 
152
  function wfu_ajax_action_save_shortcode() {
153
  if ( !current_user_can( 'manage_options' ) ) die();
154
+ if ( !isset($_POST['shortcode']) || !isset($_POST['shortcode_original']) || !isset($_POST['post_id']) || !isset($_POST['post_hash']) || !isset($_POST['shortcode_position']) || !isset($_POST['shortcode_tag']) ) die();
155
+
156
+ //sanitize parameters
157
+ $shortcode = wfu_sanitize_code($_POST['shortcode']);
158
+ $shortcode_original = wfu_sanitize_code($_POST['shortcode_original']);
159
+ $post_id = wfu_sanitize_int($_POST['post_id']);
160
+ $post_hash = wfu_sanitize_code($_POST['post_hash']);
161
+ $shortcode_position = wfu_sanitize_int($_POST['shortcode_position']);
162
+ $shortcode_tag = wfu_sanitize_tag($_POST['shortcode_tag']);
163
 
164
  if ( $_POST['post_id'] == "" ) {
165
+ die();
 
 
 
 
 
 
 
 
 
166
  }
167
  else {
168
+ $data['post_id'] = $post_id;
169
+ $data['post_hash'] = $post_hash;
170
+ $data['shortcode'] = wfu_plugin_decode_string($shortcode_original);
171
+ $data['position'] = $shortcode_position;
172
  if ( !wfu_check_edit_shortcode($data) ) die("wfu_save_shortcode:fail:post_modified");
173
  else {
174
+ $new_shortcode = "[".$shortcode_tag." ".wfu_plugin_decode_string($shortcode)."]";
175
  if ( wfu_replace_shortcode($data, $new_shortcode) ) {
176
+ $post = get_post($post_id);
177
  $hash = hash('md5', $post->post_content);
178
  die("wfu_save_shortcode:success:".$hash);
179
  }
195
 
196
  function wfu_ajax_action_edit_shortcode() {
197
  if ( !current_user_can( 'manage_options' ) ) die();
198
+ if ( !isset($_POST['upload_id']) || !isset($_POST['post_id']) || !isset($_POST['post_hash']) || !isset($_POST['shortcode_tag']) ) die();
199
 
200
+ //sanitize parameters
201
+ $upload_id = sanitize_text_field($_POST['upload_id']);
202
+ $post_id = wfu_sanitize_int($_POST['post_id']);
203
+ $post_hash = wfu_sanitize_code($_POST['post_hash']);
204
+ $shortcode_tag = wfu_sanitize_tag($_POST['shortcode_tag']);
205
+
206
+ $data['post_id'] = $post_id;
207
+ $data['post_hash'] = $post_hash;
208
  if ( wfu_check_edit_shortcode($data) ) {
209
  $post = get_post($data['post_id']);
210
  //get default value for uploadid
217
  }
218
  }
219
  //get page shortcodes
220
+ $wfu_shortcodes = wfu_get_content_shortcodes($post, $shortcode_tag);
221
  //find the shortcodes' uploadid and the correct one
222
  $validkey = -1;
223
  foreach ( $wfu_shortcodes as $key => $data ) {
224
+ $shortcode = trim(substr($data['shortcode'], strlen('['.$shortcode_tag), -1));
225
  $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
226
  if ( array_key_exists('uploadid', $shortcode_attrs) ) $uploadid = $shortcode_attrs['uploadid'];
227
  else $uploadid = $default;
228
+ if ( $uploadid == $upload_id ) {
229
  $validkey = $key;
230
  break;
231
  }
232
  }
233
  if ( $validkey == -1 ) die();
234
  $data_enc = wfu_encode_array_to_string($wfu_shortcodes[$validkey]);
235
+ $url = site_url().'/wp-admin/options-general.php?page=wordpress_file_upload&tag='.$shortcode_tag.'&action=edit_shortcode&data='.$data_enc;
236
  die("wfu_edit_shortcode:success:".wfu_plugin_encode_string($url));
237
  }
238
  else die("wfu_edit_shortcode:check_page_obsolete:".WFU_ERROR_PAGE_OBSOLETE);
284
  $file_code = (isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : ''));
285
  $nonce = (isset($_POST['nonce']) ? $_POST['nonce'] : (isset($_GET['nonce']) ? $_GET['nonce'] : ''));
286
  if ( $file_code == '' || $nonce == '' ) die();
287
+
288
  //security check to avoid CSRF attacks
289
  if ( !wp_verify_nonce($nonce, 'wfu_download_file_invoker') ) die();
290
 
291
  //check if user is allowed to download files
292
  if ( !current_user_can( 'manage_options' ) ) {
293
+ die();
294
  }
295
 
296
  // $filepath = wfu_plugin_decode_string($file_code);
297
  $file_code = wfu_sanitize_code($file_code);
298
  $filepath = wfu_get_filepath_from_safe($file_code);
299
  if ( $filepath === false ) die();
300
+ $filepath = wfu_path_rel2abs(wfu_flatten_path($filepath));
301
 
302
  //check if user is allowed to perform this action on this file
303
  if ( !wfu_current_user_owes_file($filepath) ) die();
351
  // $filepath = wfu_plugin_decode_string($file_code);
352
  $filepath = wfu_get_filepath_from_safe($file_code);
353
  if ( $filepath === false ) die();
354
+ $filepath = wfu_path_rel2abs(wfu_flatten_path($filepath));
355
  wfu_log_action('download', $filepath, $user->ID, '', 0, '', null);
356
  die('wfu_ajax_action_download_file_monitor:'.$_SESSION['wfu_download_status_'.$id].':');
357
  }
362
  }
363
  }
364
 
365
+
366
  function wfu_ajax_action_notify_wpfilebase() {
367
  $params_index = (isset($_POST['params_index']) ? $_POST['params_index'] : (isset($_GET['params_index']) ? $_GET['params_index'] : ''));
368
  $session_token = (isset($_POST['session_token']) ? $_POST['session_token'] : (isset($_GET['session_token']) ? $_GET['session_token'] : ''));
lib/wfu_attributes.php CHANGED
@@ -820,4 +820,5 @@ function wfu_attribute_definitions() {
820
  return $defs;
821
  }
822
 
 
823
  ?>
820
  return $defs;
821
  }
822
 
823
+
824
  ?>
lib/wfu_blocks.php CHANGED
@@ -151,7 +151,6 @@ function wfu_prepare_uploadform_block($params, $widths, $heights, $clickaction,
151
  return $uploadform_item;
152
  }
153
 
154
-
155
  /* Prepare the submit button */
156
  function wfu_prepare_submit_block($params, $widths, $heights, $clickaction) {
157
  $sid = $params["uploadid"];
151
  return $uploadform_item;
152
  }
153
 
 
154
  /* Prepare the submit button */
155
  function wfu_prepare_submit_block($params, $widths, $heights, $clickaction) {
156
  $sid = $params["uploadid"];
lib/wfu_functions.php CHANGED
@@ -85,6 +85,14 @@ function wfu_sanitize_code($code) {
85
  return preg_replace("/[^A-Za-z0-9]/", "", $code);
86
  }
87
 
 
 
 
 
 
 
 
 
88
  //********************* Array Functions ****************************************************************************************************
89
 
90
  function wfu_encode_array_to_string($arr) {
@@ -338,6 +346,16 @@ function wfu_basedir($path) {
338
  return substr($path, 0, strlen($path) - strlen(wfu_basename($path)));
339
  }
340
 
 
 
 
 
 
 
 
 
 
 
341
  function wfu_upload_plugin_full_path( $params ) {
342
  $path = $params["uploadpath"];
343
  if ( $params["accessmethod"]=='ftp' && $params["ftpinfo"] != '' && $params["useftpdomain"] == "true" ) {
@@ -594,6 +612,7 @@ function wfu_safe_store_filepath($path) {
594
  function wfu_get_filepath_from_safe($code) {
595
  //sanitize $code
596
  $code = wfu_sanitize_code($code);
 
597
  //return filepath from session variable, if exists
598
  if ( !isset($_SESSION['wfu_filepath_safe_storage'][$code]) ) return false;
599
  return $_SESSION['wfu_filepath_safe_storage'][$code];
@@ -614,6 +633,16 @@ function wfu_file_extension_restricted($filename) {
614
  );
615
  }
616
 
 
 
 
 
 
 
 
 
 
 
617
  //********************* User Functions *****************************************************************************************************
618
 
619
  function wfu_get_user_role($user, $param_roles) {
@@ -668,8 +697,8 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
668
 
669
  if ( !file_exists($filepath) && substr($action, 0, 5) != 'other' ) return;
670
  $parts = pathinfo($filepath);
671
- $relativepath = str_replace(ABSPATH, '', $filepath);
672
- if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
673
 
674
  $retid = 0;
675
  if ( $action == 'upload' ) {
@@ -691,6 +720,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
691
  array(
692
  'userid' => $userid,
693
  'uploaduserid' => $userid,
 
694
  'filepath' => $relativepath,
695
  'filehash' => $filehash,
696
  'filesize' => $filesize,
@@ -706,6 +736,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
706
  '%d',
707
  '%s',
708
  '%s',
 
709
  '%d',
710
  '%s',
711
  '%d',
@@ -746,8 +777,8 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
746
  elseif ( substr($action, 0, 6) == 'rename' ) {
747
  //get new filepath
748
  $newfilepath = substr($action, 7);
749
- $relativepath = str_replace(ABSPATH, '', $newfilepath);
750
- if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
751
  //get stored file data from database without user data
752
  $filerec = wfu_get_file_rec($filepath, false);
753
  //log action only if there are previous stored file data
@@ -765,6 +796,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
765
  array(
766
  'userid' => $userid,
767
  'uploaduserid' => $filerec->uploaduserid,
 
768
  'filepath' => $relativepath,
769
  'filehash' => $filerec->filehash,
770
  'filesize' => $filerec->filesize,
@@ -776,7 +808,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
776
  'action' => 'rename',
777
  'linkedto' => $filerec->idlog
778
  ),
779
- array( '%d','%d', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' ) ) !== false )
780
  $retid = $wpdb->insert_id;
781
  }
782
  }
@@ -798,6 +830,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
798
  array(
799
  'userid' => $userid,
800
  'uploaduserid' => $filerec->uploaduserid,
 
801
  'filepath' => $filerec->filepath,
802
  'filehash' => $filerec->filehash,
803
  'filesize' => $filerec->filesize,
@@ -809,7 +842,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
809
  'action' => 'delete',
810
  'linkedto' => $filerec->idlog
811
  ),
812
- array( '%d','%d', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
813
  $retid = $wpdb->insert_id;
814
  }
815
  }
@@ -831,6 +864,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
831
  array(
832
  'userid' => $userid,
833
  'uploaduserid' => $filerec->uploaduserid,
 
834
  'filepath' => $filerec->filepath,
835
  'filehash' => $filerec->filehash,
836
  'filesize' => $filerec->filesize,
@@ -842,7 +876,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
842
  'action' => 'download',
843
  'linkedto' => $filerec->idlog
844
  ),
845
- array( '%d','%d', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
846
  $retid = $wpdb->insert_id;
847
  }
848
  }
@@ -865,6 +899,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
865
  array(
866
  'userid' => $userid,
867
  'uploaduserid' => $filerec->uploaduserid,
 
868
  'filepath' => $filerec->filepath,
869
  'filehash' => $filerec->filehash,
870
  'filesize' => $filerec->filesize,
@@ -876,18 +911,19 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
876
  'action' => 'modify',
877
  'linkedto' => $filerec->idlog
878
  ),
879
- array( '%d','%d', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
880
  $retid = $wpdb->insert_id;
881
  }
882
  }
883
  elseif ( substr($action, 0, 5) == 'other' ) {
884
  $info = substr($action, 6);
885
  $now_date = date('Y-m-d H:i:s');
886
- //insert new download record
887
  if ( $wpdb->insert($table_name1,
888
  array(
889
  'userid' => $userid,
890
  'uploaduserid' => -1,
 
891
  'filepath' => $info,
892
  'filehash' => '',
893
  'filesize' => 0,
@@ -899,7 +935,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
899
  'action' => 'other',
900
  'linkedto' => -1
901
  ),
902
- array( '%d','%d', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
903
  $retid = $wpdb->insert_id;
904
  }
905
  return $retid;
@@ -948,8 +984,8 @@ function wfu_get_file_rec($filepath, $include_userdata) {
948
 
949
  if ( !file_exists($filepath) ) return null;
950
 
951
- $relativepath = str_replace(ABSPATH, '', $filepath);
952
- if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
953
  //if file hash is enabled, then search file based on its path and hash, otherwise find file based on its path and size
954
  if ( isset($plugin_options['hashfiles']) && $plugin_options['hashfiles'] == '1' ) {
955
  $filehash = md5_file($filepath);
@@ -978,9 +1014,7 @@ function wfu_reassign_hashes() {
978
  $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE filehash = \'\' AND date_to = 0');
979
  foreach( $filerecs as $filerec ) {
980
  //calculate full file path
981
- $filepath = ABSPATH;
982
- if ( substr($filepath, -1) == '/' ) $filepath = substr($filepath, 0, -1);
983
- $filepath .= $filerec->filepath;
984
  if ( file_exists($filepath) ) {
985
  $filehash = md5_file($filepath);
986
  $wpdb->update($table_name1,
@@ -1005,9 +1039,7 @@ function wfu_sync_database() {
1005
  foreach( $filerecs as $filerec ) {
1006
  $obsolete = true;
1007
  //calculate full file path
1008
- $filepath = ABSPATH;
1009
- if ( substr($filepath, -1) == '/' ) $filepath = substr($filepath, 0, -1);
1010
- $filepath .= $filerec->filepath;
1011
  if ( file_exists($filepath) ) {
1012
  if ( $plugin_options['hashfiles'] == '1' ) {
1013
  $filehash = md5_file($filepath);
@@ -1039,14 +1071,16 @@ function wfu_get_recs_of_user($userid) {
1039
  $table_name2 = $wpdb->prefix . "wfu_userdata";
1040
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1041
 
1042
- $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action <> \'other\' AND uploaduserid = '.$userid.' AND date_to = 0');
 
 
 
 
1043
  $out = array();
1044
  foreach( $filerecs as $filerec ) {
1045
  $obsolete = true;
1046
  //calculate full file path
1047
- $filepath = ABSPATH;
1048
- if ( substr($filepath, -1) == '/' ) $filepath = substr($filepath, 0, -1);
1049
- $filepath .= $filerec->filepath;
1050
  if ( file_exists($filepath) ) {
1051
  if ( $plugin_options['hashfiles'] == '1' ) {
1052
  $filehash = md5_file($filepath);
@@ -1282,11 +1316,28 @@ function wfu_process_media_insert($file_path, $page_id){
1282
  return $attach_id;
1283
  }
1284
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1285
  //********************* POST/GET Requests Functions ****************************************************************************************************
1286
 
1287
  function wfu_post_request($url, $params, $verifypeer = false) {
1288
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1289
- if ( $plugin_options['postmethod'] == 'curl' ) {
1290
  // POST request using CURL
1291
  $ch = curl_init($url);
1292
  $options = array(
@@ -1305,7 +1356,7 @@ function wfu_post_request($url, $params, $verifypeer = false) {
1305
  curl_close ($ch);
1306
  return $result;
1307
  }
1308
- elseif ( $plugin_options['postmethod'] == 'socket' ) {
1309
  // POST request using sockets
1310
  $scheme = "";
1311
  $port = 80;
85
  return preg_replace("/[^A-Za-z0-9]/", "", $code);
86
  }
87
 
88
+ function wfu_sanitize_int($code) {
89
+ return preg_replace("/[^0-9]/", "", $code);
90
+ }
91
+
92
+ function wfu_sanitize_tag($code) {
93
+ return preg_replace("/[^A-Za-z_]/", "", $code);
94
+ }
95
+
96
  //********************* Array Functions ****************************************************************************************************
97
 
98
  function wfu_encode_array_to_string($arr) {
346
  return substr($path, 0, strlen($path) - strlen(wfu_basename($path)));
347
  }
348
 
349
+ function wfu_path_abs2rel($path) {
350
+ $abspath_notrailing_slash = substr(ABSPATH, 0, -1);
351
+ return ( substr($path, 0, 6) == 'ftp://' || substr($path, 0, 7) == 'ftps://' || substr($path, 0, 7) == 'sftp://' ? $path : str_replace($abspath_notrailing_slash, "", $path) );
352
+ }
353
+
354
+ function wfu_path_rel2abs($path) {
355
+ if ( substr($path, 0, 1) == "/" ) $path = substr($path, 1);
356
+ return ( substr($path, 0, 6) == 'ftp://' || substr($path, 0, 7) == 'ftps://' || substr($path, 0, 7) == 'sftp://' ? $path : ABSPATH.$path );
357
+ }
358
+
359
  function wfu_upload_plugin_full_path( $params ) {
360
  $path = $params["uploadpath"];
361
  if ( $params["accessmethod"]=='ftp' && $params["ftpinfo"] != '' && $params["useftpdomain"] == "true" ) {
612
  function wfu_get_filepath_from_safe($code) {
613
  //sanitize $code
614
  $code = wfu_sanitize_code($code);
615
+ if ( $code == "" ) return false;
616
  //return filepath from session variable, if exists
617
  if ( !isset($_SESSION['wfu_filepath_safe_storage'][$code]) ) return false;
618
  return $_SESSION['wfu_filepath_safe_storage'][$code];
633
  );
634
  }
635
 
636
+ function wfu_human_filesize($size, $unit = "") {
637
+ if ( ( !$unit && $size >= 1<<30 ) || $unit == "GB" )
638
+ return number_format($size / (1<<30), 2)."GB";
639
+ if( ( !$unit && $size >= 1<<20 ) || $unit == "MB" )
640
+ return number_format($size / (1<<20), 2)."MB";
641
+ if( ( !$unit && $size >= 1<<10 ) || $unit == "KB" )
642
+ return number_format($size / (1<<10), 2)."KB";
643
+ return number_format($size)." bytes";
644
+ }
645
+
646
  //********************* User Functions *****************************************************************************************************
647
 
648
  function wfu_get_user_role($user, $param_roles) {
697
 
698
  if ( !file_exists($filepath) && substr($action, 0, 5) != 'other' ) return;
699
  $parts = pathinfo($filepath);
700
+ $relativepath = wfu_path_abs2rel($filepath);
701
+ // if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
702
 
703
  $retid = 0;
704
  if ( $action == 'upload' ) {
720
  array(
721
  'userid' => $userid,
722
  'uploaduserid' => $userid,
723
+ 'sessionid' => session_id(),
724
  'filepath' => $relativepath,
725
  'filehash' => $filehash,
726
  'filesize' => $filesize,
736
  '%d',
737
  '%s',
738
  '%s',
739
+ '%s',
740
  '%d',
741
  '%s',
742
  '%d',
777
  elseif ( substr($action, 0, 6) == 'rename' ) {
778
  //get new filepath
779
  $newfilepath = substr($action, 7);
780
+ $relativepath = wfu_path_abs2rel($newfilepath);
781
+ // if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
782
  //get stored file data from database without user data
783
  $filerec = wfu_get_file_rec($filepath, false);
784
  //log action only if there are previous stored file data
796
  array(
797
  'userid' => $userid,
798
  'uploaduserid' => $filerec->uploaduserid,
799
+ 'sessionid' => $filerec->sessionid,
800
  'filepath' => $relativepath,
801
  'filehash' => $filerec->filehash,
802
  'filesize' => $filerec->filesize,
808
  'action' => 'rename',
809
  'linkedto' => $filerec->idlog
810
  ),
811
+ array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' ) ) !== false )
812
  $retid = $wpdb->insert_id;
813
  }
814
  }
830
  array(
831
  'userid' => $userid,
832
  'uploaduserid' => $filerec->uploaduserid,
833
+ 'sessionid' => $filerec->sessionid,
834
  'filepath' => $filerec->filepath,
835
  'filehash' => $filerec->filehash,
836
  'filesize' => $filerec->filesize,
842
  'action' => 'delete',
843
  'linkedto' => $filerec->idlog
844
  ),
845
+ array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
846
  $retid = $wpdb->insert_id;
847
  }
848
  }
864
  array(
865
  'userid' => $userid,
866
  'uploaduserid' => $filerec->uploaduserid,
867
+ 'sessionid' => $filerec->sessionid,
868
  'filepath' => $filerec->filepath,
869
  'filehash' => $filerec->filehash,
870
  'filesize' => $filerec->filesize,
876
  'action' => 'download',
877
  'linkedto' => $filerec->idlog
878
  ),
879
+ array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
880
  $retid = $wpdb->insert_id;
881
  }
882
  }
899
  array(
900
  'userid' => $userid,
901
  'uploaduserid' => $filerec->uploaduserid,
902
+ 'sessionid' => $filerec->sessionid,
903
  'filepath' => $filerec->filepath,
904
  'filehash' => $filerec->filehash,
905
  'filesize' => $filerec->filesize,
911
  'action' => 'modify',
912
  'linkedto' => $filerec->idlog
913
  ),
914
+ array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
915
  $retid = $wpdb->insert_id;
916
  }
917
  }
918
  elseif ( substr($action, 0, 5) == 'other' ) {
919
  $info = substr($action, 6);
920
  $now_date = date('Y-m-d H:i:s');
921
+ //insert new other type record
922
  if ( $wpdb->insert($table_name1,
923
  array(
924
  'userid' => $userid,
925
  'uploaduserid' => -1,
926
+ 'sessionid' => '',
927
  'filepath' => $info,
928
  'filehash' => '',
929
  'filesize' => 0,
935
  'action' => 'other',
936
  'linkedto' => -1
937
  ),
938
+ array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
939
  $retid = $wpdb->insert_id;
940
  }
941
  return $retid;
984
 
985
  if ( !file_exists($filepath) ) return null;
986
 
987
+ $relativepath = wfu_path_abs2rel($filepath);
988
+ // if ( substr($relativepath, 0, 1) != '/' ) $relativepath = '/'.$relativepath;
989
  //if file hash is enabled, then search file based on its path and hash, otherwise find file based on its path and size
990
  if ( isset($plugin_options['hashfiles']) && $plugin_options['hashfiles'] == '1' ) {
991
  $filehash = md5_file($filepath);
1014
  $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE filehash = \'\' AND date_to = 0');
1015
  foreach( $filerecs as $filerec ) {
1016
  //calculate full file path
1017
+ $filepath = wfu_path_rel2abs($filerec->filepath);
 
 
1018
  if ( file_exists($filepath) ) {
1019
  $filehash = md5_file($filepath);
1020
  $wpdb->update($table_name1,
1039
  foreach( $filerecs as $filerec ) {
1040
  $obsolete = true;
1041
  //calculate full file path
1042
+ $filepath = wfu_path_rel2abs($filerec->filepath);
 
 
1043
  if ( file_exists($filepath) ) {
1044
  if ( $plugin_options['hashfiles'] == '1' ) {
1045
  $filehash = md5_file($filepath);
1071
  $table_name2 = $wpdb->prefix . "wfu_userdata";
1072
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1073
 
1074
+ //if $userid starts with 'guest' then retrieval of records is done using sessionid and uploaduserid is zero (for guests)
1075
+ if ( substr($userid, 0, 5) == 'guest' )
1076
+ $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action <> \'other\' AND uploaduserid = 0 AND sessionid = \''.substr($userid, 5).'\' AND date_to = 0');
1077
+ else
1078
+ $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action <> \'other\' AND uploaduserid = '.$userid.' AND date_to = 0');
1079
  $out = array();
1080
  foreach( $filerecs as $filerec ) {
1081
  $obsolete = true;
1082
  //calculate full file path
1083
+ $filepath = wfu_path_rel2abs($filerec->filepath);
 
 
1084
  if ( file_exists($filepath) ) {
1085
  if ( $plugin_options['hashfiles'] == '1' ) {
1086
  $filehash = md5_file($filepath);
1316
  return $attach_id;
1317
  }
1318
 
1319
+ //********************* Media Functions ****************************************************************************************************
1320
+
1321
+ function wfu_safe_store_browser_actions($action_list) {
1322
+ $code = wfu_create_random_string(16);
1323
+ $_SESSION['wfu_browser_actions_safe_storage'][$code] = $action_list;
1324
+ return $code;
1325
+ }
1326
+
1327
+ function wfu_get_browser_actions_from_safe($code) {
1328
+ //sanitize $code
1329
+ $code = wfu_sanitize_code($code);
1330
+ if ( $code == "" ) return false;
1331
+ //return actions from session variable, if exists
1332
+ if ( !isset($_SESSION['wfu_browser_actions_safe_storage'][$code]) ) return false;
1333
+ return $_SESSION['wfu_browser_actions_safe_storage'][$code];
1334
+ }
1335
+
1336
  //********************* POST/GET Requests Functions ****************************************************************************************************
1337
 
1338
  function wfu_post_request($url, $params, $verifypeer = false) {
1339
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1340
+ if ( isset($plugin_options['postmethod']) && $plugin_options['postmethod'] == 'curl' ) {
1341
  // POST request using CURL
1342
  $ch = curl_init($url);
1343
  $options = array(
1356
  curl_close ($ch);
1357
  return $result;
1358
  }
1359
+ elseif ( isset($plugin_options['postmethod']) && $plugin_options['postmethod'] == 'socket' ) {
1360
  // POST request using sockets
1361
  $scheme = "";
1362
  $port = 80;
lib/wfu_io.php CHANGED
@@ -13,7 +13,10 @@ function wfu_create_directory($path, $method, $ftpdata) {
13
  $ftp_username = substr($ftpdata, 0, $pos1);
14
  $ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
15
  $ftp_host = substr($ftpdata, $pos2 + 1);
16
- $conn_id = ftp_connect($ftp_host);
 
 
 
17
  $login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
18
  if ( $conn_id && $login_result ) {
19
  $flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
@@ -66,7 +69,10 @@ function wfu_upload_file($source, $target, $method, $ftpdata, $passive, $fileper
66
  $ftp_username = substr($ftpdata, 0, $pos1);
67
  $ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
68
  $ftp_host = substr($ftpdata, $pos2 + 1);
69
- $conn_id = ftp_connect($ftp_host);
 
 
 
70
  $login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
71
  if ( $conn_id && $login_result ) {
72
  $flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
13
  $ftp_username = substr($ftpdata, 0, $pos1);
14
  $ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
15
  $ftp_host = substr($ftpdata, $pos2 + 1);
16
+ $ftp_port = preg_replace("/^[^:]*:?/", "", $ftp_host);
17
+ $ftp_host_clean = preg_replace("/:.*/", "", $ftp_host);
18
+ if ( $ftp_port != "" ) $conn_id = ftp_connect($ftp_host_clean, $ftp_port);
19
+ else $conn_id = ftp_connect($ftp_host_clean);
20
  $login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
21
  if ( $conn_id && $login_result ) {
22
  $flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
69
  $ftp_username = substr($ftpdata, 0, $pos1);
70
  $ftp_password = substr($ftpdata, $pos1 + 1, $pos2 - $pos1 - 1);
71
  $ftp_host = substr($ftpdata, $pos2 + 1);
72
+ $ftp_port = preg_replace("/^[^:]*:?/", "", $ftp_host);
73
+ $ftp_host_clean = preg_replace("/:.*/", "", $ftp_host);
74
+ if ( $ftp_port != "" ) $conn_id = ftp_connect($ftp_host_clean, $ftp_port);
75
+ else $conn_id = ftp_connect($ftp_host_clean);
76
  $login_result = ftp_login($conn_id, $ftp_username, $ftp_password);
77
  if ( $conn_id && $login_result ) {
78
  $flat_host = preg_replace("/^(.*\.)?([^.]*\..*)$/", "$2", $ftp_host);
lib/wfu_processfiles.php CHANGED
@@ -135,6 +135,7 @@ function wfu_process_files($params, $method) {
135
  $file_output['message'] = "";
136
  $file_output['message_type'] = "";
137
  $file_output['admin_messages'] = "";
 
138
 
139
  // determine if file data have been saved to session variables, due to a previous pass of this file
140
  $file_map = "filedata_".$unique_id."_".$single_file_index;
@@ -644,6 +645,7 @@ function wfu_process_files($params, $method) {
644
  $sout .= ",".wfu_plugin_encode_string($file_output['header']);
645
  $sout .= ",".wfu_plugin_encode_string($file_output['message']);
646
  $sout .= ",".wfu_plugin_encode_string($file_output['admin_messages']);
 
647
  }
648
  $params_output_array["general"]['safe_output'] = $sout;
649
 
135
  $file_output['message'] = "";
136
  $file_output['message_type'] = "";
137
  $file_output['admin_messages'] = "";
138
+ $file_output['uploaded_file_props'] = "";
139
 
140
  // determine if file data have been saved to session variables, due to a previous pass of this file
141
  $file_map = "filedata_".$unique_id."_".$single_file_index;
645
  $sout .= ",".wfu_plugin_encode_string($file_output['header']);
646
  $sout .= ",".wfu_plugin_encode_string($file_output['message']);
647
  $sout .= ",".wfu_plugin_encode_string($file_output['admin_messages']);
648
+ $sout .= ",".$file_output['uploaded_file_props'];
649
  }
650
  $params_output_array["general"]['safe_output'] = $sout;
651
 
readme.txt CHANGED
@@ -26,13 +26,13 @@ The characteristics of the plugin are:
26
 
27
  * It does not use flash and handles uploads using various technologies (HTML5, AJAX, classic HTML forms) depending on browser's capabilities, which detects automatically. As a result it can work in any browser, including mobiles phones (even old ones).
28
  * You can have more than one instances of the shortcode in the same page.
29
- * It includes an overall upload progress bar.
30
  * It supports multilingual characters and localization.
31
  * Uploaded files can be added to Media or be attached to the current page.
32
  * It is highly customizable with many (more than 50) options.
33
  * It produces notification messages and e-mails.
34
  * You can create additional fields that the user must fill in along with the uploaded file.
35
  * You can select from a list of subfolders.
 
36
  * It supports redirection to another url after successful upload.
37
  * It supports filters and actions before and after file upload, so that programmers can extend the plugin and make it cooperate with other plugins.
38
  * It contains a visual editor for customizing the plugin easily and without any knowledge of shortcodes or programming
@@ -48,7 +48,7 @@ The plugin is translated in the following languages:
48
 
49
  Please note that old desktop browsers or mobile browsers may not support all of the above functionalities. In order to get full functionality use the latest versions browsers, supporting HTML5, AJAX and CSS3.
50
 
51
- For additional features, such as multiple file upload, very large file upload, drag and drop of files, captcha, detailed upload progress bars, image gallery and custom css please consider [Wordpress File Upload Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page").
52
 
53
  Please visit the **Other Notes** section for customization options of this plugin.
54
 
@@ -61,6 +61,8 @@ Please visit the **Other Notes** section for customization options of this plugi
61
  1. You can change the upload directory or any other settings easily by pressing the small edit button found at the left-top corner of the upload form. A new window (or tab) with pop up with plugin options. If you do not see the new window, adjust your browser settings to allow pop-up windows.
62
  1. Full documentation about the plugin options can be found at https://wordpress.org/plugins/wp-file-upload/other_notes/ or at http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/ (including the Pro version)
63
 
 
 
64
  == Frequently Asked Questions ==
65
 
66
  = Will the plugin work in a mobile browser? =
@@ -89,7 +91,7 @@ Files by default are uploaded inside wp-content directory of your Wordpress webs
89
 
90
  = Can I see and download the uploaded files? =
91
 
92
- Administrators can view all uploaded files together with associated field data from the plugin's Settings in Dashboard. There is also an article in www.iptanus.com for enabling a front-end file browser for logged users or guests. Better browsing capabilities under currently under development.
93
 
94
  = Are there filters to restrict uploaded content? =
95
 
@@ -101,15 +103,11 @@ Yes, there are file size limitations imposed by the web server or the host. If y
101
 
102
  = Who can upload files? =
103
 
104
- By default only administrators can upload files. However you can define which user roles are allowed to upload files, beyond administrators. Even guests can be allowed to upload files, however use this option with care.
105
 
106
  = What security is used for uploading files? =
107
 
108
- The plugin is designed not to expose website information by using sessions. Parameters passing from server to client side are encoded. For higher protection, like use of captcha, please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin.
109
-
110
- = How can I view the uploaded files? =
111
-
112
- Administrators can view and manage the uploaded files from the File Browser that exists inside the plugin's Settings inside Dashboard, or use an FTP client. Other users can view their uploaded files by combining this plugin with WP-Filebase plugin. If you want to show the uploaded files as an image gallery please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin.
113
 
114
  = What happens if connection is lost during a file upload? =
115
 
@@ -127,6 +125,15 @@ In the free version the upload will fail. However in the Pro version the upload
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
 
 
 
 
130
  = 3.0.0 =
131
  * major version number has advanced because an important feature has been added in Pro version (logged users can browse their uploaded files through their Dashboard)
132
  * several code modifications in file browser to make the plugin more secure against hacking, some functionalities in file browser have slightly changed
@@ -444,6 +451,9 @@ Initial version.
444
 
445
  == Upgrade Notice ==
446
 
 
 
 
447
  = 3.0.0 =
448
  Upgrade to increase protection against hacking.
449
 
26
 
27
  * It does not use flash and handles uploads using various technologies (HTML5, AJAX, classic HTML forms) depending on browser's capabilities, which detects automatically. As a result it can work in any browser, including mobiles phones (even old ones).
28
  * You can have more than one instances of the shortcode in the same page.
 
29
  * It supports multilingual characters and localization.
30
  * Uploaded files can be added to Media or be attached to the current page.
31
  * It is highly customizable with many (more than 50) options.
32
  * It produces notification messages and e-mails.
33
  * You can create additional fields that the user must fill in along with the uploaded file.
34
  * You can select from a list of subfolders.
35
+ * Upload progress can be monitored with a progress bar.
36
  * It supports redirection to another url after successful upload.
37
  * It supports filters and actions before and after file upload, so that programmers can extend the plugin and make it cooperate with other plugins.
38
  * It contains a visual editor for customizing the plugin easily and without any knowledge of shortcodes or programming
48
 
49
  Please note that old desktop browsers or mobile browsers may not support all of the above functionalities. In order to get full functionality use the latest versions browsers, supporting HTML5, AJAX and CSS3.
50
 
51
+ For additional features, such as multiple file upload, very large file upload, drag and drop of files, captcha, detailed upload progress bars, list of uploaded files, image gallery and custom css please consider [Wordpress File Upload Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page").
52
 
53
  Please visit the **Other Notes** section for customization options of this plugin.
54
 
61
  1. You can change the upload directory or any other settings easily by pressing the small edit button found at the left-top corner of the upload form. A new window (or tab) with pop up with plugin options. If you do not see the new window, adjust your browser settings to allow pop-up windows.
62
  1. Full documentation about the plugin options can be found at https://wordpress.org/plugins/wp-file-upload/other_notes/ or at http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/ (including the Pro version)
63
 
64
+ A getting started guide can be found at http://www.iptanus.com/getting-started-with-wordpress-file-upload-plugin/
65
+
66
  == Frequently Asked Questions ==
67
 
68
  = Will the plugin work in a mobile browser? =
91
 
92
  = Can I see and download the uploaded files? =
93
 
94
+ Administrators can view all uploaded files together with associated field data from the plugin's Settings in Dashboard. The [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin allows users to view their uploaded files, either from the Dashboard, or from a page or post.
95
 
96
  = Are there filters to restrict uploaded content? =
97
 
103
 
104
  = Who can upload files? =
105
 
106
+ By default all users can upload files. You can define which user roles are allowed to upload files. Even guests can be allowed to upload files. If you want to allow only specific users to upload files, then please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin.
107
 
108
  = What security is used for uploading files? =
109
 
110
+ The plugin is designed not to expose website sensitive information. It has been tested by experts and verified that protects against CSRF and XSS attacks. All parameters passing from server to client side are encoded and sanitized. For higher protection, like use of captcha, please consider the [Professional](http://www.iptanus.com/support/wordpress-file-upload/ "Wordpress File Upload support page") version of the plugin.
 
 
 
 
111
 
112
  = What happens if connection is lost during a file upload? =
113
 
125
 
126
  == Changelog ==
127
 
128
+ = 3.1.0 =
129
+ * an important feature (front-end file browser) has been added in professional version 3.1.0
130
+ * added port number support for uploads using ftp mode
131
+ * corrected bug that was not showing correctly in file browser files that were uploaded using ftp mode
132
+ * eliminated confirmbox warning showing in page when website's DEBUG mode is ON
133
+ * eliminated warning: "Invalid argument supplied for foreach() in ...plugins/wordpress-file-upload-pro/lib/wfu_admin.php on line 384"
134
+ * eliminated warning: "Notice: Undefined index: postmethod in /var/www/wordpress/wp-content/plugins/wordpress-file-upload-pro/lib/wfu_functions.php on line 1348"
135
+ * eliminated warnings in plugin's settings in Dashboard
136
+
137
  = 3.0.0 =
138
  * major version number has advanced because an important feature has been added in Pro version (logged users can browse their uploaded files through their Dashboard)
139
  * several code modifications in file browser to make the plugin more secure against hacking, some functionalities in file browser have slightly changed
451
 
452
  == Upgrade Notice ==
453
 
454
+ = 3.1.0 =
455
+ Upgrade to fix some minor bugs.
456
+
457
  = 3.0.0 =
458
  Upgrade to increase protection against hacking.
459
 
release_notes.txt CHANGED
@@ -1 +1 @@
1
- <span><strong>Latest release notes: </strong>Major version number of the plugin has advanced to <strong>3</strong><!-- --> introducing some changes to the <strong>security policy</strong> of the plugin, so that it becomes more protected to hackers and malicious code. The file browser that is included in Dashboard for administrators displays all subdirectories and files existing inside the website root directory, as before. However, now, subdirectories cannot be created, renamed or deleted. In addition, only the files uploaded using the plugin can be edited, renamed, deleted or downloaded.</span>
1
+ <span><strong>Latest release notes: </strong>This release introduces some minor bug fixes related to php warnings and admin browser.<!-- --> The professional version of the plugin introduces a long waiting feature, which is <strong>a front-end list of uploaded files</strong>. Either logged users or guests can view the files they have uploaded from a page or post in a table layout. For details about this feature, please check the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">page</a><span>.<!-- --><!-- --></span>
wfu_file_downloader.php CHANGED
@@ -15,16 +15,18 @@ function wfu_download_file() {
15
  // $filepath = wfu_plugin_decode_string($file_code);
16
  $filepath = wfu_get_filepath_from_safe($file_code);
17
  if ( $filepath === false ) die();
18
- $filepath = $_SESSION['wfu_ABSPATH'].wfu_flatten_path($filepath);
 
 
19
  //reject download of php files for security reasons
20
- if ( preg_match("/\.php$/", $filepath) ) {
21
  $_SESSION['wfu_download_status_'.$ticket] = 'failed';
22
  die('<script language="javascript">alert("Error! File is forbidden for security reasons.");</script>');
23
  }
24
  //check that file exists
25
  if ( !file_exists($filepath) ) {
26
  $_SESSION['wfu_download_status_'.$ticket] = 'failed';
27
- die('<script language="javascript">alert("Error! File does not exist.");</script>');
28
  }
29
 
30
  set_time_limit(0); // disable the time limit for this script
15
  // $filepath = wfu_plugin_decode_string($file_code);
16
  $filepath = wfu_get_filepath_from_safe($file_code);
17
  if ( $filepath === false ) die();
18
+ $filepath = wfu_flatten_path($filepath);
19
+ if ( substr($filepath, 0, 1) == "/" ) $filepath = substr($filepath, 1);
20
+ $filepath = ( substr($filepath, 0, 6) == 'ftp://' || substr($filepath, 0, 7) == 'ftps://' || substr($filepath, 0, 7) == 'sftp://' ? $filepath : $_SESSION['wfu_ABSPATH'].$filepath );
21
  //reject download of php files for security reasons
22
+ if ( wfu_file_extension_restricted($filepath) ) {
23
  $_SESSION['wfu_download_status_'.$ticket] = 'failed';
24
  die('<script language="javascript">alert("Error! File is forbidden for security reasons.");</script>');
25
  }
26
  //check that file exists
27
  if ( !file_exists($filepath) ) {
28
  $_SESSION['wfu_download_status_'.$ticket] = 'failed';
29
+ die('<script language="javascript">alert("Error! File does not exist.'.$filepath.'");</script>');
30
  }
31
 
32
  set_time_limit(0); // disable the time limit for this script
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.0.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -29,7 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
29
  */
30
 
31
  //set global db variables
32
- $wfu_tb_log_version = "1.0";
 
 
33
  $wfu_tb_userdata_version = "1.0";
34
 
35
  /* do not load plugin if this is the login page */
@@ -103,9 +105,22 @@ function wordpress_file_upload_handler($incomingfrompost) {
103
  return $wordpress_file_upload_output;
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  function wordpress_file_upload_function($incomingfromhandler) {
107
  global $post;
108
  global $blog_id;
 
109
  $params = wfu_plugin_parse_array($incomingfromhandler);
110
  $sid = $params["uploadid"];
111
  // store current page id in params array
@@ -228,16 +243,10 @@ function wordpress_file_upload_function($incomingfromhandler) {
228
 
229
  /* Compose the html code for the plugin */
230
  $wordpress_file_upload_output = "";
231
- $wordpress_file_upload_output .= '<div id="wordpress_file_upload_block_'.$sid.'" class="file_div_clean wfu_container">';
232
  //add visual editor overlay if the current user is administrator
233
  if ( current_user_can( 'manage_options' ) ) {
234
- $wordpress_file_upload_output .= "\n\t".'<div id="wordpress_file_upload_editor_'.$sid.'" class="wfu_overlay_editor">';
235
- $wordpress_file_upload_output .= "\n\t\t".'<button class="wfu_overlay_editor_button" title="'.WFU_PAGE_PLUGINEDITOR_BUTTONTITLE.'" onclick="wfu_invoke_shortcode_editor('.$sid.', '.$post->ID.', \''.hash('md5', $post->post_content).'\');"><img src="'.WFU_IMAGE_OVERLAY_EDITOR.'" width="20px" height="20px" /></button>';
236
- $wordpress_file_upload_output .= "\n\t".'</div>';
237
- $wordpress_file_upload_output .= "\n\t".'<div id="wordpress_file_upload_overlay_'.$sid.'" class="wfu_overlay_container">';
238
- $wordpress_file_upload_output .= "\n\t\t".'<table class="wfu_overlay_table"><tbody><tr><td><img src="'.WFU_IMAGE_OVERLAY_LOADING.'" /><label>'.WFU_PAGE_PLUGINEDITOR_LOADING.'</label></td></tr></tbody></table>';
239
- $wordpress_file_upload_output .= "\n\t\t".'<div class="wfu_overlay_container_inner"></div>';
240
- $wordpress_file_upload_output .= "\n\t".'</div>';
241
  }
242
  $itemplaces = explode("/", $params["placements"]);
243
  foreach ( $itemplaces as $section ) {
@@ -248,7 +257,6 @@ function wordpress_file_upload_function($incomingfromhandler) {
248
  if ( $item_in_section == "title" ) array_push($section_array, $title_item);
249
  elseif ( $item_in_section == "filename" ) array_push($section_array, $textbox_item);
250
  elseif ( $item_in_section == "selectbutton" ) array_push($section_array, $uploadform_item);
251
- elseif ( $item_in_section == "confirmbox" && preg_match("/(^|,)\s*checkbox\s*(,|$)/", $params['security_active']) && $params["singlebutton"] != "true" ) array_push($section_array, $confirmbox_item);
252
  elseif ( $item_in_section == "uploadbutton" && $params["singlebutton"] != "true" ) array_push($section_array, $submit_item);
253
  elseif ( $item_in_section == "subfolders" ) array_push($section_array, $subfolders_item);
254
  elseif ( $item_in_section == "progressbar" ) array_push($section_array, $progressbar_item);
@@ -331,10 +339,23 @@ function wordpress_file_upload_function($incomingfromhandler) {
331
  return $wordpress_file_upload_output."\n";
332
  }
333
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  function wfu_post_plugin_actions($params) {
335
  $echo_str = '';
336
 
337
  return $echo_str;
338
  }
339
 
340
- ?>
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.1.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
29
  */
30
 
31
  //set global db variables
32
+ //wfu_tb_log_version v2.0 changes:
33
+ // sessionid field added
34
+ $wfu_tb_log_version = "2.0";
35
  $wfu_tb_userdata_version = "1.0";
36
 
37
  /* do not load plugin if this is the login page */
105
  return $wordpress_file_upload_output;
106
  }
107
 
108
+ function wordpress_file_upload_browser_handler($incomingfrompost) {
109
+ //process incoming attributes assigning defaults if required
110
+ $defs = wfu_browser_attribute_definitions();
111
+ $defs_indexed = array();
112
+ foreach ( $defs as $def ) $defs_indexed[$def["attribute"]] = $def["value"];
113
+ $incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
114
+ //run function that actually does the work of the plugin
115
+ $wordpress_file_upload_browser_output = wordpress_file_upload_browser_function($incomingfrompost);
116
+ //send back text to replace shortcode in post
117
+ return $wordpress_file_upload_browser_output;
118
+ }
119
+
120
  function wordpress_file_upload_function($incomingfromhandler) {
121
  global $post;
122
  global $blog_id;
123
+ $shortcode_tag = 'wordpress_file_upload';
124
  $params = wfu_plugin_parse_array($incomingfromhandler);
125
  $sid = $params["uploadid"];
126
  // store current page id in params array
243
 
244
  /* Compose the html code for the plugin */
245
  $wordpress_file_upload_output = "";
246
+ $wordpress_file_upload_output .= '<div id="'.$shortcode_tag.'_block_'.$sid.'" class="file_div_clean wfu_container">';
247
  //add visual editor overlay if the current user is administrator
248
  if ( current_user_can( 'manage_options' ) ) {
249
+ $wordpress_file_upload_output .= wfu_add_visual_editor_button($shortcode_tag, $sid);
 
 
 
 
 
 
250
  }
251
  $itemplaces = explode("/", $params["placements"]);
252
  foreach ( $itemplaces as $section ) {
257
  if ( $item_in_section == "title" ) array_push($section_array, $title_item);
258
  elseif ( $item_in_section == "filename" ) array_push($section_array, $textbox_item);
259
  elseif ( $item_in_section == "selectbutton" ) array_push($section_array, $uploadform_item);
 
260
  elseif ( $item_in_section == "uploadbutton" && $params["singlebutton"] != "true" ) array_push($section_array, $submit_item);
261
  elseif ( $item_in_section == "subfolders" ) array_push($section_array, $subfolders_item);
262
  elseif ( $item_in_section == "progressbar" ) array_push($section_array, $progressbar_item);
339
  return $wordpress_file_upload_output."\n";
340
  }
341
 
342
+ function wfu_add_visual_editor_button($shortcode_tag, $sid) {
343
+ global $post;
344
+ $echo_str = "\n\t".'<div id="'.$shortcode_tag.'_editor_'.$sid.'" class="wfu_overlay_editor">';
345
+ $echo_str .= "\n\t\t".'<button class="wfu_overlay_editor_button" title="'.WFU_PAGE_PLUGINEDITOR_BUTTONTITLE.'" onclick="wfu_invoke_shortcode_editor('.$sid.', '.$post->ID.', \''.hash('md5', $post->post_content).'\', \''.$shortcode_tag.'\');"><img src="'.WFU_IMAGE_OVERLAY_EDITOR.'" width="20px" height="20px" /></button>';
346
+ $echo_str .= "\n\t".'</div>';
347
+ $echo_str .= "\n\t".'<div id="'.$shortcode_tag.'_overlay_'.$sid.'" class="wfu_overlay_container">';
348
+ $echo_str .= "\n\t\t".'<table class="wfu_overlay_table"><tbody><tr><td><img src="'.WFU_IMAGE_OVERLAY_LOADING.'" /><label>'.WFU_PAGE_PLUGINEDITOR_LOADING.'</label></td></tr></tbody></table>';
349
+ $echo_str .= "\n\t\t".'<div class="wfu_overlay_container_inner"></div>';
350
+ $echo_str .= "\n\t".'</div>';
351
+
352
+ return $echo_str;
353
+ }
354
+
355
  function wfu_post_plugin_actions($params) {
356
  $echo_str = '';
357
 
358
  return $echo_str;
359
  }
360
 
361
+ ?>