WordPress File Upload - Version 3.2.1

Version Description

  • removed 'form-field' class from admin table tr elements
  • corrected bug that was causing problems in uploadrole and uploaduser attributes when a username or role contained uppercase letters
  • uploadrole and uploaduser attributes logic modified; guests are allowed only if 'guests' word is included in the attribute
  • modifications to the download functionality script to be more robust
  • corrected bug that was not showing options below a line item of admin tables in Internet Explorer
  • several feature additions and bug fixes in Professional version
Download this release

Release Info

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

Code changes from version 3.2.0 to 3.2.1

css/wordpress_file_upload_adminstyle.css CHANGED
@@ -1 +1 @@
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}
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_bloglist_checkbtn,div.wfu_mchecklist_checkall,div.wfu_postlist_checkbtn,div.wfu_rolelist_checkbtn,div.wfu_userlist_checkbtn{display:inline-block;vertical-align:top;margin:0 0 0 10px}table.wfu_bloglist_container,table.wfu_postlist_container,table.wfu_rolelist_container,table.wfu_userlist_container{border:none;background:0 0;margin:0;padding:0;border-spacing:0}table.wfu_bloglist_container tr:nth-child(odd),table.wfu_postlist_container tr:nth-child(odd),table.wfu_rolelist_container tr:nth-child(odd),table.wfu_userlist_container tr:nth-child(odd){border:none;background:0 0;margin:0;padding:0}table.wfu_bloglist_container td,table.wfu_postlist_container td,table.wfu_rolelist_container td,table.wfu_userlist_container td{width:1%;border:none;background:0 0;margin:0;padding:0;vertical-align:top}table.wfu_postlist_container td{padding-right:20px}table.wfu_postlist_container td:last-child{padding-right:0}div.wfu_postlist_header{padding:0 10px}div.wfu_postlist_selectall{float:right}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}
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(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)}})});
1
+ function wfu_admin_activate_tab(e){for(var t,l,a=document.getElementById("wfu_tab_container"),d=0;d<a.childNodes.length;d++)t=a.childNodes[d],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"),a=document.getElementsByClassName("wfu_shadow_"+e,"div",l),d=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<a.length;u++)a[u].style.display="none";for(var u=0;u<d.length;u++)d[u].style.display="block"}else{document.getElementById("wfu_attribute_value_"+e).value="false",t.className="wfu_onoff_container_off";for(var u=0;u<a.length;u++)a[u].style.display="block";for(var u=0;u<d.length;u++)d[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"),a=document.getElementsByClassName("wfu_shadow_"+e,"div",l),d=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<a.length;r++)a[r].style.display="none";for(var r=0;r<d.length;r++)d[r].style.display="block"}else{for(var r=0;r<a.length;r++)a[r].style.display="block";for(var r=0;r<d.length;r++)d[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){var e=document.getElementById("wfu_placements_container");if(e){for(var t,l=document.getElementById("wfu_componentlist_container"),a=0;a<e.childNodes.length;a++)t=e.childNodes[a],"wfu_component_box"==t.className&&(wfu_addEventHandler(t,"dragstart",wfu_component_dragstart),wfu_addEventHandler(t,"dragend",wfu_component_dragend));for(var a=0;a<l.childNodes.length;a++)if(t=l.childNodes[a],"wfu_component_box_container"==t.className)for(var d=0;d<t.childNodes.length;d++)"wfu_component_box wfu_inbase"==t.childNodes[d].className&&(wfu_addEventHandler(t.childNodes[d],"dragstart",wfu_component_dragstart),wfu_addEventHandler(t.childNodes[d],"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 a=wfu_admin_recreate_placements_text(null,"");return wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,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 a=wfu_admin_recreate_placements_text(e.target,t);return wfu_admin_recreate_placements_panel(a),document.getElementById("wfu_attribute_value_placements").value=a,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+=d),n+=e,d=""}for(var a=document.getElementById("wfu_placements_container"),d="",n="",u=0;u<a.childNodes.length;u++)item=a.childNodes[u],"wfu_component_separator_ver"==item.className?(""==d&&(d="+"),item==e&&(l(t),d="+")):"wfu_component_separator_hor"==item.className?(d="/",item==e&&(l(t),d="/")):"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,a,d=document.getElementById("wfu_placements_container"),n="",u=0;u<d.childNodes.length;u++)t=d.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));d.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),d.appendChild(t),t=document.createElement("DIV"),t.className="wfu_component_separator_ver",t.setAttribute("draggable",!0),d.appendChild(t),a=l[u].split("+");for(var r=0;r<a.length;r++)t=document.getElementById("wfu_component_box_"+a[r]),t&&(d.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),d.appendChild(t))}t=document.createElement("DIV"),t.className="wfu_component_separator_hor",t.setAttribute("draggable",!0),d.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_hor",t.className="wfu_component_bar_hor",d.appendChild(t),t=document.createElement("DIV"),t.id="wfu_component_bar_ver",t.className="wfu_component_bar_ver",d.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 a=document.getElementById("wfu_attribute_"+l);if(!(a.selectedIndex<0)){var d,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(_)d="",n="";else{var s=a.data;t=s[a.selectedIndex],d=t.path,n=t.label}if(u.value==d&&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),a=document.getElementById("wfu_subfolders_editable_"+e),d=document.getElementById("wfu_subfolders_manualtext_"+e);if(l.checked){var n=document.getElementById("wfu_attribute_value_"+e).value;"auto"!=n.substr(0,4)&&(d.value=n),a.parentNode.style.display="inline",wfu_apply_value(e,"folderlist","auto"+(a.checked?"+":"")),t.disabled=!0}else t.disabled=!1,a.parentNode.style.display="none",wfu_apply_value(e,"folderlist",d.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 a=item.index-1;if(!(0>a)){for(var d=-1,n=t.selectedIndex-1;n>=0;){if(l[n].level==item.level&&l[n].index==a){d=n;break}n--}if(-1!=d){var u=0;for(n=t.selectedIndex+1;n<l.length&&l[n].level>item.level;)u++,n++;l[d].index=item.index,item.index=a,t.data=l.slice(0,d).concat(l.slice(t.selectedIndex,t.selectedIndex+1+u)).concat(l.slice(d,t.selectedIndex)).concat(l.slice(t.selectedIndex+1+u));var r=wfu_update_subfolder_list(e);t.selectedIndex=d,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 a=item.index+1,d=-1;for(curind=t.selectedIndex+1;curind<l.length;){if(l[curind].level==item.level){d=curind;break}if(l[curind].level<item.level)break;curind++}if(-1!=d){var n=0;for(curind=d+1;curind<l.length&&l[curind].level>item.level;)n++,curind++;l[d].index=item.index,item.index=a,t.data=l.slice(0,t.selectedIndex).concat(l.slice(d,d+1+n)).concat(l.slice(t.selectedIndex,d)).concat(l.slice(d+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 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_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 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_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 a=0;a<l.length;a++)l[a].default=!1;item.default=!0}var d=wfu_update_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_ok_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=document.getElementById("wfu_subfolders_path_"+e),a=document.getElementById("wfu_subfolders_label_"+e);if(""==l.value||""==a.value)return void alert("Path or label cannot be empty!");var d=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:a.value,path:l.value,level:u,"default":!1},o=parseInt(document.getElementById("wfu_subfolders_newitemindex_"+e).value);o>=d.length?d.push(r):d.splice(o,0,r)}else item=d[t.selectedIndex],item.path=l.value,item.label=a.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 a=0;for(curind=t.selectedIndex+1;curind<l.length&&l[curind].level>item.level;)a++,curind++;if(!(a>0)||confirm("Children items will be deleted as well. Proceed?")){l.splice(t.selectedIndex,1+a);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_add_clicked(e){var t=document.getElementById("wfu_attribute_"+e);if(!(t.selectedIndex<0)){var l=t.data,a=t.selectedIndex;item=l[a];var d=t.options,n=document.createElement("option");n.value="",n.innerHTML="",d.add(n,a),t.selectedIndex=a;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=a,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(a){}if(null!=l){for(var d=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",d.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",d.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),a=document.getElementById("wfu_subfolders_browser_msg_"+t),d=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?(a.innerHTML=txt_value,d.style.display="none",u.disabled=!1):(a.innerHTML="Unknown error",d.style.display="none",u.disabled=!1)}}function wfu_readfolderFailed(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),a=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",a.style.display="none",d.disabled=!1}function wfu_readfolderCanceled(e){var t=e.target.key,l=document.getElementById("wfu_subfolders_browser_msg_"+t),a=document.getElementById("wfu_subfolders_browser_img_"+t),d=document.getElementById("wfu_subfolders_browser_ok_"+t);l.innerHTML="Unknown error",a.style.display="none",d.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),a=(document.getElementById("wfu_subfolders_browse_"+e),document.getElementById("wfu_subfolders_inner_shadow_"+e));t.onclick=null,a.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,a=t.data,d="1"==document.getElementById("wfu_subfolders_isnewitem_"+e).value;l=d?parseInt(document.getElementById("wfu_subfolders_newitemlevel_"+e).value):a[t.selectedIndex].level;for(var n="/",u=t.selectedIndex-1,r=l;u>=0&&r>1;)a[u].level<r&&(n="/"+a[u].path+n,r=a[u].level),u--;return d&&"1"==document.getElementById("wfu_subfolders_newitemlevel2_"+e).value&&l>0&&t.selectedIndex>0&&(n+=","+a[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,a=document.getElementById("wfu_attribute_"+e),d=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==a.data?(t=wfu_decode_subfolder_list(e),a.data=t):t=a.data,0===a.data.length?(a.className="wfu_select_folders wfu_select_folders_empty",a.options[0].innerHTML=_.checked?"":"press here"):a.className="wfu_select_folders",a.selectedIndex<0)d.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(a.selectedIndex>=a.options.length-1){d.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 d.className="wfu_subfolder_tools_container",u.disabled=!1,r.disabled=!0,l=t[a.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(a.selectedIndex<0||a.selectedIndex>=a.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),a=document.getElementById("wfu_subfolders_down_"+e),d=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++}a.disabled=0==s.level||0==nextind,d.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,a=!1;l<e.length&&"*"==e.substr(l,1);)l++;e=e.substr(l,e.length-l),"&"==e.substr(0,1)&&(e=e.substr(1),a=!0),t.level=l,t.default=a;var d=e.split("/");return 1==d.length?(t.path=d[0],t.label=d[0]):d.length>1&&(t.path=d[0],t.label=d[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,a=Array(),d=["root"],n=[0],u=-1,r=0;r<l.length-1;r++){for(a.push(wfu_decode_subfolder(wfu_plugin_decode_string(l[r].value))),d.length>a[r].level?d[a[r].level]=a[r].path:d.push(a[r].path),t="",j=1;j<=a[r].level;j++)t+=d[j]+"/";a[r].fullpath=t,n.length<=a[r].level&&n.push(0),a[r].index=a[r].level>u?0:n[a[r].level]+1,n[a[r].level]=a[r].index,u=a[r].level}return a}function wfu_update_subfolder_list(e){var t=document.getElementById("wfu_attribute_"+e).options,l=document.getElementById("wfu_attribute_"+e),a=l.data;if(null!=a){var d,n,u="";t.length=a.length+1;for(var r=0;r<a.length;r++){for(d="",n="",j=0;j<a[r].level;j++)d+="*",n+="&nbsp;&nbsp;&nbsp;";a[r].default?(d+="&",t[r].className="wfu_select_folders_option_default"):t[r].className="",d+=a[r].path+"/"+a[r].label,n+=a[r].label,t[r].value=wfu_plugin_encode_string(d),t[r].innerHTML=n,""!=u&&(u+=","),u+=d}return t[a.length].value="",t[a.length].innerHTML="",u}}function wfu_userdata_edit_field(e,t,l){for(var a,d=0;d<e.childNodes.length;d++)a=e.childNodes[d],"INPUT"==a.tagName?"text"==a.type?(a.value=t,wfu_attach_element_handlers(a,wfu_update_userfield_value)):"checkbox"==a.type&&(a.checked=l):"DIV"==a.tagName&&(a.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,a=null,d=0;d<l.childNodes.length;d++)if(1===l.childNodes[d].nodeType){a=l.childNodes[d];break}if(t!=a){t.parentNode.removeChild(t);for(var d=0;d<a.childNodes.length;d++)if(1===a.childNodes[d].nodeType){wfu_update_userfield_value({target:a.childNodes[d]});break}}}function wfu_generate_shortcode(){for(var e,t=document.getElementById("wfu_shortcode_tag").value,l=document.getElementById("wfu_attribute_defaults"),a=(document.getElementById("wfu_attribute_values"),""),d="",n="["+t,u="",r=0;r<l.childNodes.length;r++)e=l.childNodes[r],1===e.nodeType&&(a=e.id.replace("wfu_attribute_default_",""),d=document.getElementById("wfu_attribute_value_"+a).value,e.value!=d&&(u+=" "+a+'="'+d+'"'));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_",""),a=t.value;a=a.replace(/(\r\n|\n|\r)/gm,"%n%"),a=a.replace(/\"/gm,"%dq%"),a=a.replace(/\[/gm,"%brl%"),a=a.replace(/\]/gm,"%brr%"),a!==t.oldVal&&(t.oldVal=a,document.getElementById("wfu_attribute_value_"+l).value=a,wfu_generate_shortcode())}function wfu_update_date_value(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_",""),a=t.value;a!==t.oldVal&&(t.oldVal=a,document.getElementById("wfu_attribute_value_"+l).value=a,wfu_generate_shortcode())}function wfu_update_stringmatch_textvalue(e){e=e||window.event;var t=e.target,l=t.id.replace("wfu_attribute_","");l=l.replace("_matchfield","").replace("_matchvalue",""),wfu_update_stringmatch_value(l)}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 a=t.value+","+document.getElementById("wfu_attribute_"+l+"_bgcolor").value+","+document.getElementById("wfu_attribute_"+l+"_borcolor").value;a!==t.oldVal&&(t.oldVal=a,document.getElementById("wfu_attribute_value_"+l).value=a,wfu_generate_shortcode())}function wfu_update_dimension_value(e){e=e||window.event;var t=e.target,l=t.name.replace("wfu_dimension_elements_",""),a=document.getElementsByName(t.name);t=a[0];for(var d="",n="",u=0;u<a.length;u++)n=a[u].id.replace("wfu_attribute_"+l+"_",""),""!=d&&""!=a[u].value&&(d+=", "),""!=a[u].value&&(d+=n+":"+a[u].value);d!==t.oldVal&&(t.oldVal=d,document.getElementById("wfu_attribute_value_"+l).value=d,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 a=document.getElementById("wfu_attribute_s_"+l).value,d=document.getElementById("wfu_attribute_p_"+l).value,n=a+"/"+d;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),a=document.getElementById("wfu_attribute_"+e+"_guests"),d=document.getElementById("wfu_attribute_"+e+"_all");if(d.checked)l.disabled=!0,t="all";else{l.disabled=!1;for(var n=l.options,u=0;u<n.length;u++)n[u].selected&&(""!=t&&(t+=","),t+=n[u].value)}a.checked&&(""!=t&&(t+=","),t+="guests"),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),a=document.getElementById("wfu_attribute_"+e+"_current"),d=document.getElementById("wfu_attribute_"+e+"_guests"),n=document.getElementById("wfu_attribute_"+e+"_all");if(a&&a.checked)l.disabled=!0,n.disabled=!0,d.disabled=!0,t="current";else{if(n.disabled=!1,d.disabled=!1,n.checked)l.disabled=!0,t="all";else{l.disabled=!1;for(var u=l.options,r=0;r<u.length;r++)u[r].selected&&(""!=t&&(t+=","),t+=u[r].value)}d.checked&&(""!=t&&(t+=","),t+="guests")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_postlist_value(e){for(var t="",l=Array(),a=Array(),d=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),n=0;n<d.length;n++)l.push(document.getElementById("wfu_attribute_"+e+"_"+d[n])),a.push(document.getElementById("wfu_attribute_"+e+"_all_"+d[n]));var u=document.getElementById("wfu_attribute_"+e+"_current");if(u&&u.checked){for(var n=0;n<d.length;n++)l[n].disabled=!0,a[n].disabled=!0;t="current"}else{var r=!0;t="";for(var n=0;n<d.length;n++)if(a[n].disabled=!1,a[n].checked)l[n].disabled=!0,""!=t&&(t+=","),t+="all"+d[n];else{l[n].disabled=!1,r=!1;for(var o=l[n].options,_=0;_<o.length;_++)o[_].selected&&(""!=t&&(t+=","),t+=o[_].value)}r&&(t="all")}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_bloglist_value(e){var t="",l=document.getElementById("wfu_attribute_"+e),a=document.getElementById("wfu_attribute_"+e+"_current"),d=document.getElementById("wfu_attribute_"+e+"_all");if(a&&a.checked)l.disabled=!0,d.disabled=!0,t="current";else if(d.disabled=!1,d.checked)l.disabled=!0,t="all";else{l.disabled=!1;for(var n=l.options,u=0;u<n.length;u++)n[u].selected&&(""!=t&&(t+=","),t+=n[u].value)}document.getElementById("wfu_attribute_value_"+e).value=t,wfu_generate_shortcode()}function wfu_update_stringmatch_value(e){var t=document.getElementById("wfu_attribute_"+e+"_matchfield").value,l=document.getElementById("wfu_attribute_"+e+"_matchcriterion").value,a=document.getElementById("wfu_attribute_"+e+"_matchvalue").value;
2
+ t=t.replace(";",""),document.getElementById("wfu_attribute_value_"+e).value=""==t.trim()?"":"field:"+t+";criterion:"+l+";value:"+a,wfu_generate_shortcode()}function wfu_update_userfield_value(e){e=e||window.event;for(var t=e.target,l=t.parentNode,a=l.parentNode,d="",n=!1,u="",r=0;r<a.childNodes.length;r++)if(l=a.childNodes[r],"DIV"===l.tagName){for(var o=0;o<l.childNodes.length;o++)"INPUT"==l.childNodes[o].tagName&&("text"==l.childNodes[o].type?(d=l.childNodes[o].value,0==r&&(t=l.childNodes[o])):"checkbox"==l.childNodes[o].type&&(n=l.childNodes[o].checked));""!=u&&""!=d&&(u+="/"),""!=d&&n&&(u+="*"),""!=d&&(u+=d)}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),a=document.getElementsByName("wfu_userfield_select"),d=0;d<a.length;d++)a[d].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("/"),r="",d=1;d<=u.length;d++)r=u[d-1],"*"==r[0]&&(r=r.substr(1)),n+='<option value="%userdata'+d+'%">'+d+": "+r+"</option>";for(var d=0;d<a.length;d++)a[d].innerHTML=n,a[d].style.display="inline-block"}}}function wfu_attach_element_handlers(e,t){for(var l=["DOMAttrModified","textInput","input","change","keypress","paste","focus","propertychange"],a=0;a<l.length;a++)wfu_addEventHandler(e,l[a],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 a=document.getElementsByName("wfu_ptext_elements"),l=0;l<a.length;l++)wfu_attach_element_handlers(a[l],wfu_update_ptext_value);for(var d=document.getElementsByName("wfu_date_elements"),l=0;l<d.length;l++)wfu_attach_element_handlers(d[l],wfu_update_date_value);for(var n=document.getElementsByName("wfu_stringmatch_elements"),l=0;l<n.length;l++)wfu_attach_element_handlers(n[l],wfu_update_stringmatch_textvalue);for(var u=document.getElementsByName("wfu_triplecolor_elements"),l=0;l<u.length;l++)wfu_attach_element_handlers(u[l],wfu_update_triplecolor_value);for(var r=document.getElementsByName("wfu_dimension_elements_widths"),l=0;l<r.length;l++)wfu_attach_element_handlers(r[l],wfu_update_dimension_value);r=document.getElementsByName("wfu_dimension_elements_heights");for(var l=0;l<r.length;l++)wfu_attach_element_handlers(r[l],wfu_update_dimension_value);for(var o=document.getElementsByName("wfu_userfield_elements"),l=0;l<o.length;l++)wfu_attach_element_handlers(o[l],wfu_update_userfield_value);for(var _=document.getElementsByName("wfu_subfolder_tools_input"),l=0;l<_.length;l++)wfu_attach_element_handlers(_[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),a=l.selectionStart,d=l.value;l.value=d.substr(0,a)+e.innerHTML+d.substr(a),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),a=l.selectionStart,d=l.value;l.value=d.substr(0,a)+e.value+d.substr(a),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"),a=document.getElementById("wfu_attribute_"+e);if("add"==t){for(var d=0;d<l.options.length;d++)if(l.options[d].selected||"wfu_columns_item_required"==l.options[d].className){for(var n=!1,u=0;u<a.options.length;u++)if(a.options[u].value==l.options[d].value){n=!0;break}if(!n){var r=document.createElement("OPTION");r.value=l.options[d].value,r.innerHTML=l.options[d].innerHTML,r.className=l.options[d].className,a.appendChild(r)}}}else if("del"==t)for(var d=0;d<a.options.length;)a.options[d].selected&&"wfu_columns_item_required"!=a.options[d].className?a.options.remove(d):d++;else if("up"==t||"down"==t){for(var o=-1,d=0;d<a.options.length;d++)a.options[d].selected&&-1==o?o=d:a.options[d].selected&&o>-1&&(a.options[d].selected=!1);"up"==t&&o>0?a.insertBefore(a.options[o],a.options[o-1]):"down"==t&&o<a.options.length-1&&a.insertBefore(a.options[o+1],a.options[o])}wfu_update_columns(e)}function wfu_update_columns(e){for(var t=document.getElementById("wfu_attribute_"+e),l="",a=0;a<t.options.length;a++)""!=l&&(l+=","),l+=t.options[a].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,a="",d="";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)),d=t.toString(16),(1==d.length||3==d.length||5==d.length)&&(d="0"+d),a+=d;return a}function wfu_plugin_decode_string(e){for(var t,l,a=0,d="";a<e.length;)t=parseInt(e.substr(a,2),16),l=128>t?t:224>t?((31&t)<<6)+(63&parseInt(e.substr(a+=2,2),16)):((15&t)<<12)+((63&parseInt(e.substr(a+=2,2),16))<<6)+(63&parseInt(e.substr(a+=2,2),16)),d+=String.fromCharCode(l),a+=2;return d}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="",a=0;a<params.length;a++)l+=(a>0?"&":"")+params[a][0]+"="+encodeURI(params[a][1]);var d=new Date;Autosave?ShortcodeNextSave=d.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 a=(e.responseText.substr(0,l),e.responseText.substr(l+t.length,e.responseText.length-l-t.length));l=a.indexOf(":");var n=a.substr(0,l);if(txt_value=a.substr(l+1,a.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=d.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,a=0;t>a;a++)l=1-a/t,setTimeout('wfu_adjust_opacity("'+l.toString()+'")',a*e/t);setTimeout('wfu_adjust_opacity("0.0")',a*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 a=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 d=colourNameToHex(l);d||(d=l),jQuery("#wfu_attribute_"+e).wpColorPicker("color",d)}a.value=l,wfu_update_text_value({target:a})}else if("date"==t){var a=document.getElementById("wfu_attribute_"+e);a.value=l,wfu_update_date_value({target:a})}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){var a=document.getElementById("wfu_attribute_"+e),i=document.getElementById("wfu_attribute_"+e+"_all"),m=i.className.indexOf("wfu_default_administrator")>-1,w=l.split(",");if(w.indexOf("all")>-1){i.checked=!0;for(var u=0;u<a.options.length;u++)a.options[u].selected=m&&"administrator"==a.options[u].value}else{i.checked=!1;for(var u=0;u<w.length;u++)w[u]=w[u].trim();for(var u=0;u<a.options.length;u++)a.options[u].selected=w.indexOf(a.options[u].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=w.indexOf("guests")>-1,wfu_update_rolelist_value(e)}else if("userlist"==t){var a=document.getElementById("wfu_attribute_"+e),i=document.getElementById("wfu_attribute_"+e+"_all"),p=i.className.indexOf("wfu_default_0")>-1,g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==l){g.checked=!0,i.checked=!1,document.getElementById("wfu_attribute_"+e+"_guests").checked=!1;for(var u=0;u<a.options.length;u++)a.options[u].selected=p&&1>u}else{g&&(g.checked=!1);var v=l.split(",");if(v.indexOf("all")>-1){i.checked=!0;for(var u=0;u<a.options.length;u++)a.options[u].selected=p&&1>u}else{i.checked=!1;for(var u=0;u<v.length;u++)v[u]=v[u].trim();for(var u=0;u<a.options.length;u++)a.options[u].selected=v.indexOf(a.options[u].value)>-1}document.getElementById("wfu_attribute_"+e+"_guests").checked=v.indexOf("guests")>-1}wfu_update_userlist_value(e)}else if("postlist"==t){for(var b=Array(),i=Array(),h=document.getElementById("wfu_attribute_"+e+"_postlist").value.split(","),u=0;u<h.length;u++)b.push(document.getElementById("wfu_attribute_"+e+"_"+h[u])),i.push(document.getElementById("wfu_attribute_"+e+"_all_"+h[u]));var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==l){g.checked=!0;for(var u=0;u<h.length;u++){i[u].checked=!1;for(var y=0;y<b[u].options.length;y++)b[u].options[y].selected=!1}}else{g&&(g.checked=!1);for(var I=l.split(","),u=0;u<h.length;u++){("all"==l||I.indexOf("all"+h[u])>-1)&&(i[u].checked=!0);for(var y=0;y<b[u].options.length;y++)b[u].options[y].selected=I.indexOf(b[u].options[y].value)>-1}}wfu_update_postlist_value(e)}else if("bloglist"==t){var g=document.getElementById("wfu_attribute_"+e+"_current");if(g&&"current"==l){g.checked=!0,document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var a=document.getElementById("wfu_attribute_"+e),u=0;u<a.options.length;u++)a.options[u].selected=!1}else{g&&(g.checked=!1);var E=l.split(",");if("all"==l)document.getElementById("wfu_attribute_"+e+"_all").checked=!0;else{document.getElementById("wfu_attribute_"+e+"_all").checked=!1;for(var u=0;u<E.length;u++)E[u]=E[u].trim();for(var a=document.getElementById("wfu_attribute_"+e),u=0;u<a.options.length;u++)a.options[u].selected=E.indexOf(a.options[u].value)>-1}}wfu_update_bloglist_value(e)}else if("stringmatch"==t){var B="",k="equal to",x="",N=l.match(/^field:(.*?);\s*criterion:(.*?)\s*;\s*value:(.*)$/);N&&4==N.length&&(B=N[1],k=N[2],x=N[3]),document.getElementById("wfu_attribute_"+e+"_matchfield").value=B,document.getElementById("wfu_attribute_"+e+"_matchcriterion").value=k,document.getElementById("wfu_attribute_"+e+"_matchvalue").value=x,wfu_update_stringmatch_value(e)}else if("columns"==t){var T=document.getElementById("wfu_attribute_"+e+"_sourcelist"),O=document.getElementById("wfu_attribute_"+e);O.innerHTML="";for(var H=l.split(","),u=0;u<T.options.length;u++)if("wfu_columns_item_required"==T.options[u].className&&-1==H.indexOf(T.options[u].value)){var A=document.createElement("OPTION");A.value=T.options[u].value,A.innerHTML=T.options[u].innerHTML,A.className=T.options[u].className,O.appendChild(A)}for(var u=0;u<H.length;u++){for(var j=-1,y=0;y<T.options.length;y++)if(T.options[y].value==H[u]){j=y;break}for(var C=!1,y=0;y<O.options.length;y++)if(O.options[y].value==H[u]){C=!0;break}if(j>-1&&!C){var A=document.createElement("OPTION");A.value=T.options[j].value,A.innerHTML=T.options[j].innerHTML,A.className=T.options[j].className,O.appendChild(A)}}wfu_update_columns(e)}else if("dimensions"==t){for(var D,L,S,a,V=l.split(","),M=document.getElementsByName("wfu_dimension_elements_"+e),u=0;u<M.length;u++)M[u].value="";for(var u=0;u<V.length;u++)D=V[u].split(":",2),L=D.length<1?"":D[0],S=D.length<2?L:D[1],a=document.getElementById("wfu_attribute_"+e+"_"+L.trim()),a&&(a.value=S.trim());a=M[0],wfu_update_dimension_value({target:a})}else if("userfields"==t){for(var P,q=l.split("/"),R=Array(),u=0;u<q.length;u++)P="*"==q[u].substr(0,1),P&&(q[u]=q[u].substr(1)),""!=q[u]&&R.push({name:q[u],required:P});for(var F=document.getElementById("wfu_attribute_"+e),Q=null,U=Array(),u=0;u<F.childNodes.length;u++)1===F.childNodes[u].nodeType&&(null==Q?Q=F.childNodes[u]:U.push(F.childNodes[u]));for(var u=0;u<U.length;u++)F.removeChild(U[u]);wfu_userdata_edit_field(Q,"",!1);for(var X,G=Q,u=0;u<R.length;u++)0==u?wfu_userdata_edit_field(Q,R[u].name,R[u].required):(X=G.cloneNode(!0),wfu_userdata_edit_field(X,R[u].name,R[u].required),F.insertBefore(X,G.nextSibling),G=X);for(var a,u=0;u<Q.childNodes.length&&(a=Q.childNodes[u],"INPUT"!=a.tagName);u++);wfu_update_userfield_value({target:a})}else if("color-triplet"==t){for(var W=l.split(","),u=0;u<W.length;u++)W[u]=W[u].trim();2==W.length?W=[W[0],W[1],"#000000"]:1==W.length?W=[W[0],"#FFFFFF","#000000"]:W.length<3&&(W=["#000000","#FFFFFF","#000000"]);var d=colourNameToHex(W[0]);d||(d=W[0]),jQuery("#wfu_attribute_"+e+"_color").wpColorPicker("color",d);var a=document.getElementById("wfu_attribute_"+e+"_color");a.value=W[0],d=colourNameToHex(W[1]),d||(d=W[1]),jQuery("#wfu_attribute_"+e+"_bgcolor").wpColorPicker("color",d),document.getElementById("wfu_attribute_"+e+"_bgcolor").value=W[1],d=colourNameToHex(W[2]),d||(d=W[2]),jQuery("#wfu_attribute_"+e+"_borcolor").wpColorPicker("color",d),document.getElementById("wfu_attribute_"+e+"_borcolor").value=W[2],wfu_update_triplecolor_value({target:a})}else if("folderlist"==t){for(var f=wfu_parse_folderlist_js(l),z=document.getElementById("wfu_attribute_"+e).options;z.length>0;)z.remove(0);for(var A,$,J,K,Y,Z,u=0;u<f.path.length;u++){$=f.path[u],"/"==$.substr($.length,1)&&($=$.substr(0,$.length-1)),J=$.split("/"),$=J[J.length-1],Y=parseInt(f.level[u]),K="",Z="";for(var y=0;Y>y;y++)K+="&nbsp;&nbsp;&nbsp;",Z+="*";K+=f.label[u],f.default[u]&&(Z+="&"),Z+=""==$?"{root}/"+f.label[u]:$+f.label[u],A=document.createElement("option"),A.className=f.default[u]?"wfu_select_folders_option_default":"",A.value=wfu_plugin_encode_string(Z),A.innerHTML=K,z.add(A)}A=document.createElement("option"),A.value="",A.innerHTML="",z.add(A);var et=document.getElementById("wfu_attribute_"+e);et.data=wfu_decode_subfolder_list(e),wfu_subfolders_update_toolnav(e),a=et,l!==a.oldVal&&(a.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 a,d,n,u,r,o,_,s=["root"],c=0,f=0,i=-1,m=0;m<l.length;m++){for(a=l[m].trim(),d=0,n="",u=!1;d<a.length&&"*"==a.substr(d,1);)d++,n+="&nbsp;&nbsp;&nbsp;";if(1>=d-c&&(d>0||0==f)&&(a=a.substr(d,a.length-d),"&"==a.substr(0,1)&&(a=a.substr(1),u=!0),subfolder_items=a.split("/"),subfolder_items.length<2&&subfolder_items.push(""),""!=subfolder_items[1]?(r=subfolder_items[0],o=subfolder_items[1]):(r=a,o=a),""!=r)){u&&-1==i?i=t.path.length:u=!1,0==d&&(f=1),s.length>d?s[d]=r:s.push(r),_="";for(var w=1;d>=w;w++)_+=s[w]+"/";t.path.push(_),t.label.push(o),t.level.push(d),t.default.push(u),c=d}}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 a=wfu_GetHttpRequestObject();if(null!=a){var d=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]);a.open("POST",d,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){if(4==a.readyState&&200==a.status){var l="wfu_ajax_action_download_file_invoker:",d=a.responseText.indexOf(l);-1==d&&(d=a.responseText.length);var n=(a.responseText.substr(0,d),a.responseText.substr(d+l.length,a.responseText.length-d-l.length));d=n.indexOf(":");var u=n.substr(0,d);if(txt_value=n.substr(d+1,n.length-d-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)}}},a.send(n)}}function wfu_download_file_monitor(e,t,l){var a=wfu_GetHttpRequestObject();if(null!=a){var d=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]);a.open("POST",d,!0),a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){if(4==a.readyState&&200==a.status){var l="wfu_ajax_action_download_file_monitor:",d=a.responseText.indexOf(l);-1==d&&(d=a.responseText.length);var n=(a.responseText.substr(0,d),a.responseText.substr(d+l.length,a.responseText.length-d-l.length));d=n.indexOf(":");var u=n.substr(0,d);if(txt_value=n.substr(d+1,n.length-d-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)}},a.send(n)}}function wfu_filedetails_userdata_changed(){for(var e,t,l=document.getElementsByName("wfu_filedetails_userdata"),a=!1,d=0;d<l.length;d++)if(e=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_default_")),t=document.getElementById(l[d].id.replace("wfu_filedetails_userdata_value_","wfu_filedetails_userdata_")),t.value=l[d].value,l[d].value!=e.value){a=!0;break}document.getElementById("dp_filedetails_submit_fields").disabled=!a}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"),a=document.getElementById("wfu_fbperm_roles"),d=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=d.checked&&n.checked,u.checked=d.checked&&u.checked,r.checked=d.checked&&r.checked,n.disabled=!d.checked,u.disabled=!d.checked,r.disabled=!d.checked;for(var o=a.value.split(","),_=0;_<o.length;_++){var s=o[_].indexOf("["),c=o[_].substr(0,s);"0"!=c&&wfu_update_browserpermission_option("role",c)}var f=(d.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");a.value=a.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");d.checked=m.checked?w.checked:d.checked,i.style.fontWeight=m.checked?"":"bold",n.checked=m.checked?p.checked:d.checked&&n.checked,u.checked=m.checked?g.checked:d.checked&&u.checked,r.checked=m.checked?v.checked:d.checked&&r.checked,d.disabled=m.checked,n.disabled=m.checked||!d.checked,u.disabled=m.checked||!d.checked,r.disabled=m.checked||!d.checked;var f=m.checked?"":"D"+(d.checked?"v":"")+(n.checked?"d":"")+(u.checked?"e":"")+(r.checked?"l":"");a.value=a.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){d.checked=y.checked?!1:d.checked,n.checked=y.checked?!1:d.checked&&n.checked,u.checked=y.checked?!1:d.checked&&u.checked,r.checked=y.checked?!1:d.checked&&r.checked,d.disabled=y.checked,n.disabled=y.checked||!d.checked,u.disabled=y.checked||!d.checked,r.disabled=y.checked||!d.checked,d.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"+(d.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 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,d.checked=m.checked?E.checked?B:w.checked:y.checked?B:d.checked,n.checked=m.checked?E.checked?k:p.checked:y.checked?k:d.checked&&n.checked,u.checked=m.checked?E.checked?x:g.checked:y.checked?x:d.checked&&u.checked,r.checked=m.checked?E.checked?N:v.checked:y.checked?N:d.checked&&r.checked,y.disabled=m.checked,d.disabled=m.checked||y.checked,n.disabled=m.checked||y.checked||!d.checked,u.disabled=m.checked||y.checked||!d.checked,r.disabled=m.checked||y.checked||!d.checked;var f=m.checked?"":"D"+(y.checked?"":"R"+(d.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)}})});
languages/wordpress-file-upload.pot CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-06-25 14:29+0200\n"
6
- "PO-Revision-Date: 2015-06-25 14:29+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
2
  msgstr ""
3
  "Project-Id-Version: Wordpress File Upload\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2015-08-14 22:02+0200\n"
6
+ "PO-Revision-Date: 2015-08-14 22:02+0200\n"
7
  "Last-Translator: nickboss <info@iptanus.com>\n"
8
  "Language-Team: Iptanus Team <info@iptanus.com>\n"
9
  "Language: en\n"
lib/wfu_admin.php CHANGED
@@ -42,12 +42,14 @@ 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
  sessionid VARCHAR(40),
46
  filepath TEXT NOT NULL,
47
  filehash VARCHAR(100) NOT NULL,
48
  filesize bigint NOT NULL,
49
  uploadid VARCHAR(20) NOT NULL,
50
  pageid mediumint(9),
 
51
  sid VARCHAR(10),
52
  date_from DATETIME,
53
  date_to DATETIME,
@@ -221,7 +223,7 @@ function wfu_manage_mainmenu($message = '') {
221
  $echo_str .= "\n\t\t".'<table class="form-table">';
222
  $echo_str .= "\n\t\t\t".'<tbody>';
223
  //plugin edition
224
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
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>';
@@ -240,7 +242,7 @@ function wfu_manage_mainmenu($message = '') {
240
  $echo_str .= "\n\t\t\t\t\t".'</td>';
241
  $echo_str .= "\n\t\t\t\t".'</tr>';
242
  //plugin version
243
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
244
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
245
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Version</label>';
246
  $echo_str .= "\n\t\t\t\t\t".'</th>';
@@ -267,7 +269,7 @@ function wfu_manage_mainmenu($message = '') {
267
  $echo_str .= "\n\t\t\t\t".'</tr>';
268
  //server environment
269
  $php_env = wfu_get_server_environment();
270
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
271
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
272
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Server Environment</label>';
273
  $echo_str .= "\n\t\t\t\t\t".'</th>';
@@ -277,7 +279,7 @@ function wfu_manage_mainmenu($message = '') {
277
  if ( $php_env == '' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Unknown</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
278
  $echo_str .= "\n\t\t\t\t\t".'</td>';
279
  $echo_str .= "\n\t\t\t\t".'</tr>';
280
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
281
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
282
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">PHP Version</label>';
283
  $echo_str .= "\n\t\t\t\t\t".'</th>';
@@ -288,7 +290,7 @@ function wfu_manage_mainmenu($message = '') {
288
  $echo_str .= "\n\t\t\t\t\t".'<td>';
289
  $echo_str .= "\n\t\t\t\t\t".'</td>';
290
  $echo_str .= "\n\t\t\t\t".'</tr>';
291
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field">';
292
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
293
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Release Notes</label>';
294
  $echo_str .= "\n\t\t\t\t\t".'</th>';
@@ -464,7 +466,7 @@ function wfu_manage_instances_of_shortcode($tag, $title, $slug, $inc) {
464
  foreach ( $wfu_shortcodes as $key => $data ) {
465
  $id = $data['post_id'];
466
  $data_enc = wfu_safe_store_shortcode_data(wfu_encode_array_to_string($data));
467
- $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\';}">';
468
  $echo_str .= "\n\t\t\t\t\t".'<td style="padding: 5px 5px 5px 10px; text-align:center;">';
469
  $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>';
470
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_shortcode_actions_'.$inc.'_'.$i.'" name="wfu_shortcode_actions_'.$inc.'" style="visibility:hidden;">';
42
  idlog mediumint(9) NOT NULL AUTO_INCREMENT,
43
  userid mediumint(9) NOT NULL,
44
  uploaduserid mediumint(9) NOT NULL,
45
+ uploadtime bigint,
46
  sessionid VARCHAR(40),
47
  filepath TEXT NOT NULL,
48
  filehash VARCHAR(100) NOT NULL,
49
  filesize bigint NOT NULL,
50
  uploadid VARCHAR(20) NOT NULL,
51
  pageid mediumint(9),
52
+ blogid mediumint(9),
53
  sid VARCHAR(10),
54
  date_from DATETIME,
55
  date_to DATETIME,
223
  $echo_str .= "\n\t\t".'<table class="form-table">';
224
  $echo_str .= "\n\t\t\t".'<tbody>';
225
  //plugin edition
226
+ $echo_str .= "\n\t\t\t\t".'<tr>';
227
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
228
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Edition</label>';
229
  $echo_str .= "\n\t\t\t\t\t".'</th>';
242
  $echo_str .= "\n\t\t\t\t\t".'</td>';
243
  $echo_str .= "\n\t\t\t\t".'</tr>';
244
  //plugin version
245
+ $echo_str .= "\n\t\t\t\t".'<tr>';
246
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
247
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Version</label>';
248
  $echo_str .= "\n\t\t\t\t\t".'</th>';
269
  $echo_str .= "\n\t\t\t\t".'</tr>';
270
  //server environment
271
  $php_env = wfu_get_server_environment();
272
+ $echo_str .= "\n\t\t\t\t".'<tr>';
273
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
274
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Server Environment</label>';
275
  $echo_str .= "\n\t\t\t\t\t".'</th>';
279
  if ( $php_env == '' ) $echo_str .= "\n\t\t\t\t\t\t".'<label style="font-weight:bold; cursor:default;">Unknown</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
280
  $echo_str .= "\n\t\t\t\t\t".'</td>';
281
  $echo_str .= "\n\t\t\t\t".'</tr>';
282
+ $echo_str .= "\n\t\t\t\t".'<tr>';
283
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
284
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">PHP Version</label>';
285
  $echo_str .= "\n\t\t\t\t\t".'</th>';
290
  $echo_str .= "\n\t\t\t\t\t".'<td>';
291
  $echo_str .= "\n\t\t\t\t\t".'</td>';
292
  $echo_str .= "\n\t\t\t\t".'</tr>';
293
+ $echo_str .= "\n\t\t\t\t".'<tr>';
294
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
295
  $echo_str .= "\n\t\t\t\t\t\t".'<label style="cursor:default;">Release Notes</label>';
296
  $echo_str .= "\n\t\t\t\t\t".'</th>';
466
  foreach ( $wfu_shortcodes as $key => $data ) {
467
  $id = $data['post_id'];
468
  $data_enc = wfu_safe_store_shortcode_data(wfu_encode_array_to_string($data));
469
+ $echo_str .= "\n\t\t\t\t".'<tr onmouseover="var actions=document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_shortcode_actions_'.$inc.'_'.$i.'\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_shortcode_actions_'.$inc.'\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';}">';
470
  $echo_str .= "\n\t\t\t\t\t".'<td style="padding: 5px 5px 5px 10px; text-align:center;">';
471
  $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>';
472
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_shortcode_actions_'.$inc.'_'.$i.'" name="wfu_shortcode_actions_'.$inc.'" style="visibility:hidden;">';
lib/wfu_admin_browser.php CHANGED
@@ -154,7 +154,7 @@ function wfu_browse_files($basedir_code) {
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>';
160
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_dir_actions_'.$ii.'" name="wfu_dir_actions" style="visibility:hidden;">';
@@ -181,7 +181,7 @@ function wfu_browse_files($basedir_code) {
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 )
187
  $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_details&file='.$file_code.'" title="View and edit file details" style="font-weight:normal;">'.$file['name'].'</a>';
@@ -363,7 +363,7 @@ function wfu_rename_file($file_code, $type) {
363
  elseif ( file_exists($new_file) ) $error = 'Error: The '.( $type == 'dir' ? 'folder' : 'file' ).' <strong>'.$_POST['wfu_newname'].'</strong> already exists! Please choose another one.';
364
  else {
365
  //pre-log rename action
366
- if ( $type == 'file' ) $retid = wfu_log_action('rename:'.$new_file, $dec_file, $user->ID, '', 0, '', null);
367
  //perform rename action
368
  if ( rename($dec_file, $new_file) == false ) $error = 'Error: Rename of '.( $type == 'dir' ? 'folder' : 'file' ).' <strong>'.$parts['basename'].'</strong> failed!';
369
  //revert log action if file was not renamed
@@ -444,7 +444,7 @@ function wfu_delete_file($file_code, $type) {
444
  if ( isset($_POST['submit']) ) {
445
  if ( $_POST['submit'] == "Delete" ) {
446
  //pre-log delete action
447
- if ( $type == 'file' ) $retid = wfu_log_action('delete', $dec_file, $user->ID, '', 0, '', null);
448
  if ( $type == 'dir' && $dec_file != "" ) wfu_delTree($dec_file);
449
  else unlink($dec_file);
450
  //revert log action if file has not been deleted
@@ -580,7 +580,7 @@ function wfu_file_details($file_code, $errorstatus) {
580
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
581
  $echo_str .= "\n\t\t\t\t".'<tbody>';
582
  if ( $is_admin ) {
583
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
584
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
585
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Full Path</label>';
586
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -588,7 +588,7 @@ function wfu_file_details($file_code, $errorstatus) {
588
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.$filepath.'" readonly="readonly" />';
589
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
590
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
591
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
592
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
593
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Uploaded From User</label>';
594
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -597,7 +597,7 @@ function wfu_file_details($file_code, $errorstatus) {
597
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
598
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
599
  }
600
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
601
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
602
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>File Size</label>';
603
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -605,7 +605,7 @@ function wfu_file_details($file_code, $errorstatus) {
605
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.$filedata->filesize.'" readonly="readonly" style="width:auto;" />';
606
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
607
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
608
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
609
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
610
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>File Date</label>';
611
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -613,7 +613,7 @@ function wfu_file_details($file_code, $errorstatus) {
613
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.date("d/m/Y H:i:s", $stat['mtime']).'" readonly="readonly" style="width:auto;" />';
614
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
615
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
616
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
617
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
618
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Uploaded From Page</label>';
619
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -622,7 +622,7 @@ function wfu_file_details($file_code, $errorstatus) {
622
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
623
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
624
  if ( $is_admin ) {
625
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
626
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
627
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Upload Plugin ID</label>';
628
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -638,7 +638,7 @@ function wfu_file_details($file_code, $errorstatus) {
638
  $echo_str .= "\n\t\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">File History</h3>';
639
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
640
  $echo_str .= "\n\t\t\t\t".'<tbody>';
641
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
642
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
643
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label></label>';
644
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -684,7 +684,7 @@ function wfu_file_details($file_code, $errorstatus) {
684
  $echo_str .= "\n\t\t\t\t".'<tbody>';
685
  if ( count($filedata->userdata) > 0 ) {
686
  foreach ( $filedata->userdata as $userdata ) {
687
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
688
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
689
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>'.$userdata->property.'</label>';
690
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -697,7 +697,7 @@ function wfu_file_details($file_code, $errorstatus) {
697
  }
698
  }
699
  else {
700
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
701
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
702
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>No user data</label>';
703
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -785,7 +785,7 @@ function wfu_edit_filedetails($file_code) {
785
  )
786
  );
787
  }
788
- if ( $userdata_count > 0 ) wfu_log_action('modify:'.$now_date, $dec_file, $user->ID, '', 0, '', null);
789
  }
790
  }
791
  }
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="var actions=document.getElementsByName(\'wfu_dir_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_dir_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_dir_actions\'); for (var i=0; i<actions.length; i++) {actions[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>';
160
  $echo_str .= "\n\t\t\t\t\t\t".'<div id="wfu_dir_actions_'.$ii.'" name="wfu_dir_actions" style="visibility:hidden;">';
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="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_'.$ii.'\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[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 )
187
  $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_details&file='.$file_code.'" title="View and edit file details" style="font-weight:normal;">'.$file['name'].'</a>';
363
  elseif ( file_exists($new_file) ) $error = 'Error: The '.( $type == 'dir' ? 'folder' : 'file' ).' <strong>'.$_POST['wfu_newname'].'</strong> already exists! Please choose another one.';
364
  else {
365
  //pre-log rename action
366
+ if ( $type == 'file' ) $retid = wfu_log_action('rename:'.$new_file, $dec_file, $user->ID, '', 0, 0, '', null);
367
  //perform rename action
368
  if ( rename($dec_file, $new_file) == false ) $error = 'Error: Rename of '.( $type == 'dir' ? 'folder' : 'file' ).' <strong>'.$parts['basename'].'</strong> failed!';
369
  //revert log action if file was not renamed
444
  if ( isset($_POST['submit']) ) {
445
  if ( $_POST['submit'] == "Delete" ) {
446
  //pre-log delete action
447
+ if ( $type == 'file' ) $retid = wfu_log_action('delete', $dec_file, $user->ID, '', 0, 0, '', null);
448
  if ( $type == 'dir' && $dec_file != "" ) wfu_delTree($dec_file);
449
  else unlink($dec_file);
450
  //revert log action if file has not been deleted
580
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
581
  $echo_str .= "\n\t\t\t\t".'<tbody>';
582
  if ( $is_admin ) {
583
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
584
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
585
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Full Path</label>';
586
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
588
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.$filepath.'" readonly="readonly" />';
589
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
590
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
591
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
592
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
593
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Uploaded From User</label>';
594
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
597
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
598
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
599
  }
600
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
601
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
602
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>File Size</label>';
603
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
605
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.$filedata->filesize.'" readonly="readonly" style="width:auto;" />';
606
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
607
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
608
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
609
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
610
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>File Date</label>';
611
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
613
  $echo_str .= "\n\t\t\t\t\t\t\t".'<input type="text" value="'.date("d/m/Y H:i:s", $stat['mtime']).'" readonly="readonly" style="width:auto;" />';
614
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
615
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
616
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
617
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
618
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Uploaded From Page</label>';
619
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
622
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
623
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
624
  if ( $is_admin ) {
625
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
626
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
627
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>Upload Plugin ID</label>';
628
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
638
  $echo_str .= "\n\t\t\t".'<h3 style="margin-bottom: 10px; margin-top: 40px;">File History</h3>';
639
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
640
  $echo_str .= "\n\t\t\t\t".'<tbody>';
641
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
642
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
643
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label></label>';
644
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
684
  $echo_str .= "\n\t\t\t\t".'<tbody>';
685
  if ( count($filedata->userdata) > 0 ) {
686
  foreach ( $filedata->userdata as $userdata ) {
687
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
688
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
689
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>'.$userdata->property.'</label>';
690
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
697
  }
698
  }
699
  else {
700
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
701
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
702
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label>No user data</label>';
703
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
785
  )
786
  );
787
  }
788
+ if ( $userdata_count > 0 ) wfu_log_action('modify:'.$now_date, $dec_file, $user->ID, '', 0, 0, '', null);
789
  }
790
  }
791
  }
lib/wfu_admin_composer.php CHANGED
@@ -155,7 +155,7 @@ function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upl
155
  //check if new sub-category must be generated
156
  if ( $def['subcategory'] != $prevsubcat ) {
157
  $prevsubcat = $def['subcategory'];
158
- $echo_str .= "\n\t\t\t\t".'<tr class="form-field wfu_subcategory">';
159
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row" colspan="3">';
160
  $echo_str .= "\n\t\t\t\t\t\t".'<h3 style="margin-bottom: 10px; margin-top: 10px;">'.$prevsubcat.'</h3>';
161
  $echo_str .= "\n\t\t\t\t\t".'</th>';
@@ -173,7 +173,7 @@ function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upl
173
  }
174
  $dlp = "\n\t\t\t\t\t\t\t\t";
175
  }
176
- $echo_str .= $dlp.'<tr class="form-field">';
177
  $echo_str .= $dlp."\t".'<th scope="row"><div class="wfu_td_div">';
178
  if ( $def['parent'] == "" ) $echo_str .= $dlp."\t\t".'<div class="wfu_shadow wfu_shadow_'.$governor['attribute'].$governor['inv'].'" style="display:'.( $governor['active'] ? 'none' : 'block' ).';"></div>';
179
  $echo_str .= $dlp."\t\t".'<div class="wfu_restore_container" title="Double-click to restore defaults setting"><img src="'.WFU_IMAGE_ADMIN_RESTOREDEFAULT.'" ondblclick="wfu_apply_value(\''.$attr.'\', \''.$def['type'].'\', \''.$def['default'].'\');" /></div>';
@@ -239,10 +239,16 @@ function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upl
239
  elseif ( $def['type'] == "integer" ) {
240
  $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
241
  $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" min="1" value="'.$val.'" />';
 
242
  }
243
  elseif ( $def['type'] == "float" ) {
244
  $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
245
  $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" step="any" min="0" value="'.$val.'" />';
 
 
 
 
 
246
  }
247
  elseif ( $def['type'] == "radio" ) {
248
  $echo_str .= $dlp."\t\t";
@@ -383,31 +389,140 @@ function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upl
383
  }
384
  elseif ( $def['type'] == "rolelist" ) {
385
  $roles = $wp_roles->get_names();
386
- $def['value'] = strtolower($def['value']);
387
- if ( $def['value'] == "all" ) $selected = array("administrator");
388
- else $selected = explode(",", $def['value']);
 
389
  foreach ( $selected as $key => $item ) $selected[$key] = trim($item);
390
- $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.count($roles).'" onchange="wfu_update_rolelist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' disabled="disabled"' : '' ).'>';
 
391
  foreach ( $roles as $roleid => $rolename )
392
- $echo_str .= $dlp."\t\t\t".'<option value="'.$roleid.'"'.( in_array($roleid, $selected) ? ' selected="selected"' : '' ).'>'.$rolename.'</option>';
393
  $echo_str .= $dlp."\t\t".'</select>';
394
- $echo_str .= $dlp."\t\t".'<div class="wfu_rolelist_checkall"><input id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_rolelist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all</label></div>';
 
 
 
395
  }
396
  elseif ( $def['type'] == "userlist" ) {
397
  $users = get_users();
398
- $def['value'] = strtolower($def['value']);
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>';
406
  $echo_str .= $dlp."\t\t".'</td><td>';
407
- $echo_str .= $dlp."\t\t".'<div class="wfu_userlist_checkall"><input id="wfu_attribute_'.$attr.'_guests" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( strtolower($def['value']) == "all" || in_array("guests", $selected) ? ' checked="checked"' : '' ).( strtolower($def['value']) == "all" ? ' disabled="disabled"' : '' ).' /><label for="wfu_attribute_'.$attr.'_guests"> Include guests</label></div><br />';
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();
155
  //check if new sub-category must be generated
156
  if ( $def['subcategory'] != $prevsubcat ) {
157
  $prevsubcat = $def['subcategory'];
158
+ $echo_str .= "\n\t\t\t\t".'<tr class="wfu_subcategory">';
159
  $echo_str .= "\n\t\t\t\t\t".'<th scope="row" colspan="3">';
160
  $echo_str .= "\n\t\t\t\t\t\t".'<h3 style="margin-bottom: 10px; margin-top: 10px;">'.$prevsubcat.'</h3>';
161
  $echo_str .= "\n\t\t\t\t\t".'</th>';
173
  }
174
  $dlp = "\n\t\t\t\t\t\t\t\t";
175
  }
176
+ $echo_str .= $dlp.'<tr>';
177
  $echo_str .= $dlp."\t".'<th scope="row"><div class="wfu_td_div">';
178
  if ( $def['parent'] == "" ) $echo_str .= $dlp."\t\t".'<div class="wfu_shadow wfu_shadow_'.$governor['attribute'].$governor['inv'].'" style="display:'.( $governor['active'] ? 'none' : 'block' ).';"></div>';
179
  $echo_str .= $dlp."\t\t".'<div class="wfu_restore_container" title="Double-click to restore defaults setting"><img src="'.WFU_IMAGE_ADMIN_RESTOREDEFAULT.'" ondblclick="wfu_apply_value(\''.$attr.'\', \''.$def['type'].'\', \''.$def['default'].'\');" /></div>';
239
  elseif ( $def['type'] == "integer" ) {
240
  $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
241
  $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" min="1" value="'.$val.'" />';
242
+ if ( isset($def['listitems']['unit']) ) $echo_str .= $dlp."\t\t".'<label> '.$def['listitems']['unit'].'</label>';
243
  }
244
  elseif ( $def['type'] == "float" ) {
245
  $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
246
  $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="number" name="wfu_text_elements" class="wfu_short_text" step="any" min="0" value="'.$val.'" />';
247
+ if ( isset($def['listitems']['unit']) ) $echo_str .= $dlp."\t\t".'<label> '.$def['listitems']['unit'].'</label>';
248
+ }
249
+ elseif ( $def['type'] == "date" ) {
250
+ $val = $def['value'];
251
+ $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="date" name="wfu_date_elements" value="'.$val.'" />';
252
  }
253
  elseif ( $def['type'] == "radio" ) {
254
  $echo_str .= $dlp."\t\t";
389
  }
390
  elseif ( $def['type'] == "rolelist" ) {
391
  $roles = $wp_roles->get_names();
392
+ $selected = explode(",", $def['value']);
393
+ $default_administrator = ( is_array($def['listitems']) && in_array('default_administrator', $def['listitems']) );
394
+ if ( in_array('all', $selected) ) $rolesselected = ( $default_administrator ? array("administrator") : array( ) );
395
+ else $rolesselected = $selected;
396
  foreach ( $selected as $key => $item ) $selected[$key] = trim($item);
397
+ $echo_str .= $dlp."\t\t".'<table class="wfu_rolelist_container"><tbody><tr><td>';
398
+ $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.count($roles).'" onchange="wfu_update_rolelist_value(\''.$attr.'\');"'.( in_array('all', $selected) ? ' disabled="disabled"' : '' ).'>';
399
  foreach ( $roles as $roleid => $rolename )
400
+ $echo_str .= $dlp."\t\t\t".'<option value="'.$roleid.'"'.( in_array($roleid, $rolesselected) ? ' selected="selected"' : '' ).'>'.$rolename.'</option>';
401
  $echo_str .= $dlp."\t\t".'</select>';
402
+ $echo_str .= $dlp."\t\t".'</td><td>';
403
+ $echo_str .= $dlp."\t\t".'<div class="wfu_rolelist_checkbtn"><input class="'.( $default_administrator ? 'wfu_default_administrator' : '' ).'" id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_rolelist_value(\''.$attr.'\');"'.( in_array('all', $selected) ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all</label></div><br />';
404
+ $echo_str .= $dlp."\t\t".'<div class="wfu_rolelist_checkbtn"><input id="wfu_attribute_'.$attr.'_guests" type="checkbox" onchange="wfu_update_rolelist_value(\''.$attr.'\');"'.( in_array("guests", $selected) ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_guests"> Include guests</label></div>';
405
+ $echo_str .= $dlp."\t\t".'</td></tr></tbody></table>';
406
  }
407
  elseif ( $def['type'] == "userlist" ) {
408
  $users = get_users();
409
+ $selected = explode(",", $def['value']);
410
+ $default_0 = ( is_array($def['listitems']) && in_array('default_0', $def['listitems']) );
411
+ if ( in_array('all', $selected) ) $usersselected = ( $default_0 ? array($users[0]->user_login) : array( ) );
412
+ else $usersselected = $selected;
413
+ $only_current = false;
414
+ $echo_str .= $dlp."\t\t".'<table class="wfu_userlist_container"><tbody><tr>';
415
+ if ( is_array($def['listitems']) && in_array('include_current', $def['listitems']) ) {
416
+ $only_current = ( $def['value'] == 'current' );
417
+ if ( $only_current ) $usersselected = ( $default_0 ? array($users[0]->user_login) : array( ) );
418
+ $echo_str .= $dlp."\t\t".'<td colspan="2"><div class="wfu_userlist_checkbtn"><input id="wfu_attribute_'.$attr.'_current" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( $only_current ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_current"> Only From Current User</label></div>';
419
+ $echo_str .= $dlp."\t\t".'</td></tr><tr>';
420
+ }
421
+ $echo_str .= $dlp."\t\t".'<td><select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.min(count($users), 10).'" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( $only_current || in_array('all', $selected) ? ' disabled="disabled"' : '' ).'>';
422
  foreach ( $users as $userid => $user )
423
+ $echo_str .= $dlp."\t\t\t".'<option value="'.$user->user_login.'"'.( in_array($user->user_login, $usersselected) ? ' selected="selected"' : '' ).'>'.$user->display_name.' ('.$user->user_login.')</option>';
424
  $echo_str .= $dlp."\t\t".'</select>';
425
  $echo_str .= $dlp."\t\t".'</td><td>';
426
+ $echo_str .= $dlp."\t\t".'<div class="wfu_userlist_checkbtn"><input class="'.( $default_0 ? 'wfu_default_0' : '' ).'" id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( in_array('all', $selected) ? ' checked="checked"' : '' ).( $only_current ? ' disabled="disabled"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all</label></div><br />';
427
+ $echo_str .= $dlp."\t\t".'<div class="wfu_userlist_checkbtn"><input id="wfu_attribute_'.$attr.'_guests" type="checkbox" onchange="wfu_update_userlist_value(\''.$attr.'\');"'.( in_array("guests", $selected) ? ' checked="checked"' : '' ).( $only_current ? ' disabled="disabled"' : '' ).' /><label for="wfu_attribute_'.$attr.'_guests"> Include guests</label></div>';
428
  $echo_str .= $dlp."\t\t".'</td></tr></tbody></table>';
429
  }
430
+ elseif ( $def['type'] == "postlist" ) {
431
+ $processed = false;
432
+ if ( is_array($def['listitems']) ) {
433
+ $has_current = in_array('include_current', $def['listitems']);
434
+ if ( $has_current ) unset($def['listitems'][array_search('include_current', $def['listitems'])]);
435
+ foreach ( $def['listitems'] as $post_type ) {
436
+ // if a post type cannot be found then we reset the list so that it is not processed at all
437
+ if ( get_post_type_object( $post_type ) == null ) {
438
+ $def['listitems'] = array();
439
+ break;
440
+ }
441
+ }
442
+ if ( count($def['listitems']) > 0 ) {
443
+ $selected = explode(",", $def['value']);
444
+ $only_current = false;
445
+ $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'_postlist" type="hidden" value="'.implode(",", $def['listitems']).'" />';
446
+ $echo_str .= $dlp."\t\t".'<table class="wfu_postlist_container"><tbody><tr>';
447
+ if ( $has_current ) {
448
+ $only_current = ( $def['value'] == 'current' );
449
+ if ( $only_current ) $sselected = array();
450
+ $echo_str .= $dlp."\t\t".'<td colspan="'.count($def['listitems']).'"><div class="wfu_postlist_checkbtn"><input id="wfu_attribute_'.$attr.'_current" type="checkbox" onchange="wfu_update_postlist_value(\''.$attr.'\');"'.( $only_current ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_current"> Only From Current Post/Page</label></div>';
451
+ $echo_str .= $dlp."\t\t".'</td></tr><tr>';
452
+ }
453
+ $postargs = array( 'post_type' => $def['listitems'], 'post_status' => "publish,private,draft", 'posts_per_page' => -1 );
454
+ $posts = get_posts($postargs);
455
+ $list = wfu_construct_post_list($posts);
456
+ foreach ( $def['listitems'] as $post_type ) {
457
+ $flatlist = wfu_flatten_post_list($list[$post_type]);
458
+ $postobj = get_post_type_object( $post_type );
459
+ $echo_str .= $dlp."\t\t".'<td><div class="wfu_postlist_header"><label>'.$postobj->label.'</label><div class="wfu_postlist_selectall"><input id="wfu_attribute_'.$attr.'_all_'.$post_type.'" type="checkbox" onchange="wfu_update_postlist_value(\''.$attr.'\');"'.( in_array('all', $selected) || in_array('all'.$post_type, $selected) ? ' checked="checked"' : '' ).( $only_current ? ' disabled="disabled"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all_'.$post_type.'"> Select all</label></div></div>';
460
+ $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'_'.$post_type.'" multiple="multiple" size="'.min(count($flatlist), 10).'" onchange="wfu_update_postlist_value(\''.$attr.'\');"'.( $only_current || in_array('all', $selected) || in_array('all'.$post_type, $selected) ? ' disabled="disabled"' : '' ).'>';
461
+ foreach ( $flatlist as $item )
462
+ $echo_str .= $dlp."\t\t\t".'<option value="'.$item['id'].'"'.( in_array($item['id'], $selected) ? ' selected="selected"' : '' ).'>'.str_repeat('&nbsp;', 4 * $item['level']).( $item['status'] == 1 ? '[Private]' : ( $item['status'] == 2 ? '[Draft]' : '' ) ).$item['title'].'</option>';
463
+ $echo_str .= $dlp."\t\t".'</select></td>';
464
+ }
465
+ $echo_str .= $dlp."\t\t".'</tr></tbody></table>';
466
+ $processed = true;
467
+ }
468
+ }
469
+ if ( !processed ) {
470
+ $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
471
+ $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" value="'.$val.'" />';
472
+ }
473
+ }
474
+ elseif ( $def['type'] == "bloglist" ) {
475
+ if ( function_exists('wp_get_sites') ) {
476
+ $blogs = wp_get_sites( );
477
+ $selected = explode(",", $def['value']);
478
+ if ( in_array('all', $selected) ) $blogsselected = array( );
479
+ else $blogsselected = $selected;
480
+ $only_current = false;
481
+ $echo_str .= $dlp."\t\t".'<table class="wfu_bloglist_container"><tbody><tr>';
482
+ if ( is_array($def['listitems']) && in_array('include_current', $def['listitems']) ) {
483
+ $only_current = ( $def['value'] == 'current' );
484
+ if ( $only_current ) $blogsselected = array( );
485
+ $echo_str .= $dlp."\t\t".'<td colspan="2"><div class="wfu_bloglist_checkbtn"><input id="wfu_attribute_'.$attr.'_current" type="checkbox" onchange="wfu_update_bloglist_value(\''.$attr.'\');"'.( $only_current ? ' checked="checked"' : '' ).' /><label for="wfu_attribute_'.$attr.'_current"> Only From Current Site</label></div>';
486
+ $echo_str .= $dlp."\t\t".'</td></tr><tr>';
487
+ }
488
+ $echo_str .= $dlp."\t\t".'<td><select id="wfu_attribute_'.$attr.'" multiple="multiple" size="'.min(count($blogs), 10).'" onchange="wfu_update_bloglist_value(\''.$attr.'\');"'.( $only_current || in_array('all', $selected) ? ' disabled="disabled"' : '' ).'>';
489
+ foreach ( $blogs as $blog )
490
+ $echo_str .= $dlp."\t\t\t".'<option value="'.$blog->blog_id.'"'.( in_array($blog->blog_id, $blogsselected) ? ' selected="selected"' : '' ).'>'.$blog->path.'</option>';
491
+ $echo_str .= $dlp."\t\t".'</select>';
492
+ $echo_str .= $dlp."\t\t".'</td><td>';
493
+ $echo_str .= $dlp."\t\t".'<div class="wfu_bloglist_checkbtn"><input id="wfu_attribute_'.$attr.'_all" type="checkbox" onchange="wfu_update_bloglist_value(\''.$attr.'\');"'.( in_array('all', $selected) ? ' checked="checked"' : '' ).( $only_current ? ' disabled="disabled"' : '' ).' /><label for="wfu_attribute_'.$attr.'_all"> Select all</label></div>';
494
+ $echo_str .= $dlp."\t\t".'</td></tr></tbody></table>';
495
+ }
496
+ else {
497
+ $val = str_replace(array( "%n%", "%dq%", "%brl%", "%brr%" ), array( "\n", "&quot;", "[", "]" ), $def['value']);
498
+ $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'" type="text" name="wfu_text_elements" value="'.$val.'" />';
499
+ }
500
+ }
501
+ elseif ( $def['type'] == "stringmatch" ) {
502
+ $matchfield = "";
503
+ $matchcriterion = "equal to";
504
+ $matchvalue = "";
505
+ preg_match('/^field:(.*?);\s*criterion:(.*?)\s*;\s*value:(.*)$/', $def['value'], $matches);
506
+ if ( count($matches) == 4 ) {
507
+ $matchfield = $matches[1];
508
+ $matchcriterion = $matches[2];
509
+ $matchvalue = $matches[3];
510
+ }
511
+ $echo_str .= $dlp."\t\t".'<div style="white-space:nowrap;">';
512
+ $echo_str .= $dlp."\t\t".'<label>Field </label><input id="wfu_attribute_'.$attr.'_matchfield" type="text" name="wfu_stringmatch_elements" value="'.$matchfield.'" />';
513
+ $echo_str .= $dlp."\t\t".'<select id="wfu_attribute_'.$attr.'_matchcriterion" value="'.$matchcriterion.'" onchange="wfu_update_stringmatch_value(\''.$attr.'\');">';
514
+ $echo_str .= $dlp."\t\t\t".'<option value="equal to"'.( $matchcriterion == "equal to" ? 'selected="selected"' : '' ).'>equal to</option>';
515
+ $echo_str .= $dlp."\t\t\t".'<option value="starts with"'.( $matchcriterion == "starts with" ? 'selected="selected"' : '' ).'>starts with</option>';
516
+ $echo_str .= $dlp."\t\t\t".'<option value="ends with"'.( $matchcriterion == "ends with" ? 'selected="selected"' : '' ).'>ends with</option>';
517
+ $echo_str .= $dlp."\t\t\t".'<option value="contains"'.( $matchcriterion == "contains" ? 'selected="selected"' : '' ).'>contains</option>';
518
+ $echo_str .= $dlp."\t\t\t".'<option value="not equal to"'.( $matchcriterion == "not equal to" ? 'selected="selected"' : '' ).'>not equal to</option>';
519
+ $echo_str .= $dlp."\t\t\t".'<option value="does not start with"'.( $matchcriterion == "does not start with" ? 'selected="selected"' : '' ).'>does not start with</option>';
520
+ $echo_str .= $dlp."\t\t\t".'<option value="does not end with"'.( $matchcriterion == "does not end with" ? 'selected="selected"' : '' ).'>does not end with</option>';
521
+ $echo_str .= $dlp."\t\t\t".'<option value="does not contain"'.( $matchcriterion == "does not contain" ? 'selected="selected"' : '' ).'>does not contain</option>';
522
+ $echo_str .= $dlp."\t\t".'</select>';
523
+ $echo_str .= $dlp."\t\t".'<input id="wfu_attribute_'.$attr.'_matchvalue" type="text" name="wfu_stringmatch_elements" value="'.$matchvalue.'" />';
524
+ $echo_str .= $dlp."\t\t".'</div>';
525
+ }
526
  elseif ( $def['type'] == "columns" ) {
527
  $selected = explode(",", $def['value']);
528
  if ( count($selected) == 1 && $selected[0] == "" ) $selected = array();
lib/wfu_admin_settings.php CHANGED
@@ -19,7 +19,7 @@ function wfu_manage_settings($message = '') {
19
  $echo_str .= "\n\t\t\t".'<input type="hidden" name="action" value="edit_settings">';
20
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
21
  $echo_str .= "\n\t\t\t\t".'<tbody>';
22
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
23
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
24
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_hashfiles">Hash Files</label>';
25
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -28,7 +28,7 @@ function wfu_manage_settings($message = '') {
28
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.($plugin_options['hashfiles'] == '1' ? 'Yes' : 'No' ).'</strong></p>';
29
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
30
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
31
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
32
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
33
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_basedir">Base Directory</label>';
34
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -37,7 +37,7 @@ function wfu_manage_settings($message = '') {
37
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['basedir'].'</strong></p>';
38
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
39
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
40
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
41
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
42
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_postmethod">Post Method</label>';
43
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
@@ -50,7 +50,7 @@ function wfu_manage_settings($message = '') {
50
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.( $plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? 'Using fopen' : ( $plugin_options['postmethod'] == 'curl' ? 'Using cURL' : 'Using Sockets' ) ).'</strong></p>';
51
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
52
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
53
- $echo_str .= "\n\t\t\t\t\t".'<tr class="form-field">';
54
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
55
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_relaxcss">Relax CSS Rules</label>';
56
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
19
  $echo_str .= "\n\t\t\t".'<input type="hidden" name="action" value="edit_settings">';
20
  $echo_str .= "\n\t\t\t".'<table class="form-table">';
21
  $echo_str .= "\n\t\t\t\t".'<tbody>';
22
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
23
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
24
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_hashfiles">Hash Files</label>';
25
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
28
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.($plugin_options['hashfiles'] == '1' ? 'Yes' : 'No' ).'</strong></p>';
29
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
30
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
31
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
32
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
33
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_basedir">Base Directory</label>';
34
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
37
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.$plugin_options['basedir'].'</strong></p>';
38
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
39
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
40
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
41
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
42
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_postmethod">Post Method</label>';
43
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
50
  $echo_str .= "\n\t\t\t\t\t\t\t".'<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>'.( $plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? 'Using fopen' : ( $plugin_options['postmethod'] == 'curl' ? 'Using cURL' : 'Using Sockets' ) ).'</strong></p>';
51
  $echo_str .= "\n\t\t\t\t\t\t".'</td>';
52
  $echo_str .= "\n\t\t\t\t\t".'</tr>';
53
+ $echo_str .= "\n\t\t\t\t\t".'<tr>';
54
  $echo_str .= "\n\t\t\t\t\t\t".'<th scope="row">';
55
  $echo_str .= "\n\t\t\t\t\t\t\t".'<label for="wfu_relaxcss">Relax CSS Rules</label>';
56
  $echo_str .= "\n\t\t\t\t\t\t".'</th>';
lib/wfu_ajaxactions.php CHANGED
@@ -352,7 +352,7 @@ function wfu_ajax_action_download_file_monitor() {
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
  }
358
  else {
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, 0, '', null);
356
  die('wfu_ajax_action_download_file_monitor:'.$_SESSION['wfu_download_status_'.$id].':');
357
  }
358
  else {
lib/wfu_attributes.php CHANGED
@@ -130,7 +130,7 @@ function wfu_attribute_definitions() {
130
  "name" => "Upload Roles",
131
  "attribute" => "uploadrole",
132
  "type" => "rolelist",
133
- "listitems" => null,
134
  "value" => WFU_UPLOADROLE,
135
  "mode" => "free",
136
  "category" => "general",
@@ -138,7 +138,7 @@ function wfu_attribute_definitions() {
138
  "parent" => "",
139
  "dependencies" => null,
140
  "variables" => null,
141
- "help" => "Defines the categories (roles) of users allowed to upload files. Multiple selections can be made. If 'all' is selected, then all users, even guests (non logged users) can upload files. Please use carefully."
142
  ),
143
  array(
144
  "name" => "Allowed File Extensions",
130
  "name" => "Upload Roles",
131
  "attribute" => "uploadrole",
132
  "type" => "rolelist",
133
+ "listitems" => array("default_administrator"),
134
  "value" => WFU_UPLOADROLE,
135
  "mode" => "free",
136
  "category" => "general",
138
  "parent" => "",
139
  "dependencies" => null,
140
  "variables" => null,
141
+ "help" => "Defines the categories (roles) of users allowed to upload files. Multiple selections can be made. If 'Select All' is checked, then all logged users can upload files. If 'Include Guests' is checked, then guests (not logged users) can also upload files. Default value is 'all,guests'."
142
  ),
143
  array(
144
  "name" => "Allowed File Extensions",
lib/wfu_constants.php CHANGED
@@ -8,7 +8,7 @@ DEFINE("WFU_UPLOADTITLE", __('Upload files', 'wordpress-file-upload'));
8
  DEFINE("WFU_SELECTBUTTON", __('Select File', 'wordpress-file-upload'));
9
  DEFINE("WFU_UPLOADBUTTON", __('Upload File', 'wordpress-file-upload'));
10
  DEFINE("WFU_SINGLEBUTTON", "false");
11
- DEFINE("WFU_UPLOADROLE", "all");
12
  DEFINE("WFU_UPLOADPATH", 'uploads');
13
  DEFINE("WFU_CREATEPATH", "false");
14
  DEFINE("WFU_FORCEFILENAME", "false");
8
  DEFINE("WFU_SELECTBUTTON", __('Select File', 'wordpress-file-upload'));
9
  DEFINE("WFU_UPLOADBUTTON", __('Upload File', 'wordpress-file-upload'));
10
  DEFINE("WFU_SINGLEBUTTON", "false");
11
+ DEFINE("WFU_UPLOADROLE", "all,guests");
12
  DEFINE("WFU_UPLOADPATH", 'uploads');
13
  DEFINE("WFU_CREATEPATH", "false");
14
  DEFINE("WFU_FORCEFILENAME", "false");
lib/wfu_functions.php CHANGED
@@ -21,6 +21,10 @@ function wfu_upload_plugin_wildcard_to_preg($pattern) {
21
  return '/^' . str_replace(array('\*', '\?', '\[', '\]'), array('.*', '.', '[', ']+'), preg_quote($pattern)) . '$/is';
22
  }
23
 
 
 
 
 
24
  function wfu_upload_plugin_wildcard_match($pattern, $str) {
25
  $pattern = wfu_upload_plugin_wildcard_to_preg($pattern);
26
  return preg_match($pattern, $str);
@@ -647,24 +651,22 @@ function wfu_human_filesize($size, $unit = "") {
647
  //********************* User Functions *****************************************************************************************************
648
 
649
  function wfu_get_user_role($user, $param_roles) {
 
650
  if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
651
  /* Go through the array of the roles of the current user */
652
  foreach ( $user->roles as $user_role ) {
653
  $user_role = strtolower($user_role);
654
- /* If one role of the current user matches to the roles allowed to upload */
655
- if ( in_array($user_role, $param_roles) || $user_role == 'administrator' ) {
656
- /* We affect this role to current user */
657
  $result_role = $user_role;
658
  break;
659
  }
660
- else {
661
- /* We affect the 'visitor' role to current user */
662
- $result_role = 'visitor';
663
- }
664
  }
665
  }
666
- else {
667
- $result_role = 'visitor';
 
668
  }
669
  return $result_role;
670
  }
@@ -690,7 +692,7 @@ function wfu_get_user_valid_role_names($user) {
690
  //*********************** DB Functions *****************************************************************************************************
691
 
692
  //log action to database
693
- function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $userdata) {
694
  global $wpdb;
695
  $table_name1 = $wpdb->prefix . "wfu_log";
696
  $table_name2 = $wpdb->prefix . "wfu_userdata";
@@ -721,18 +723,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
721
  array(
722
  'userid' => $userid,
723
  'uploaduserid' => $userid,
 
724
  'sessionid' => session_id(),
725
  'filepath' => $relativepath,
726
  'filehash' => $filehash,
727
  'filesize' => $filesize,
728
  'uploadid' => $uploadid,
729
  'pageid' => $pageid,
 
730
  'sid' => $sid,
731
  'date_from' => $now_date,
732
  'date_to' => 0,
733
  'action' => 'upload'
734
  ),
735
  array(
 
736
  '%d',
737
  '%d',
738
  '%s',
@@ -741,6 +746,7 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
741
  '%d',
742
  '%s',
743
  '%d',
 
744
  '%s',
745
  '%s',
746
  '%s',
@@ -797,19 +803,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
797
  array(
798
  'userid' => $userid,
799
  'uploaduserid' => $filerec->uploaduserid,
 
800
  'sessionid' => $filerec->sessionid,
801
  'filepath' => $relativepath,
802
  'filehash' => $filerec->filehash,
803
  'filesize' => $filerec->filesize,
804
  'uploadid' => $filerec->uploadid,
805
  'pageid' => $filerec->pageid,
 
806
  'sid' => $filerec->sid,
807
  'date_from' => $now_date,
808
  'date_to' => 0,
809
  'action' => 'rename',
810
  'linkedto' => $filerec->idlog
811
  ),
812
- array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' ) ) !== false )
813
  $retid = $wpdb->insert_id;
814
  }
815
  }
@@ -831,19 +839,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
831
  array(
832
  'userid' => $userid,
833
  'uploaduserid' => $filerec->uploaduserid,
 
834
  'sessionid' => $filerec->sessionid,
835
  'filepath' => $filerec->filepath,
836
  'filehash' => $filerec->filehash,
837
  'filesize' => $filerec->filesize,
838
  'uploadid' => $filerec->uploadid,
839
  'pageid' => $filerec->pageid,
 
840
  'sid' => $filerec->sid,
841
  'date_from' => $now_date,
842
  'date_to' => $now_date,
843
  'action' => 'delete',
844
  'linkedto' => $filerec->idlog
845
  ),
846
- array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
847
  $retid = $wpdb->insert_id;
848
  }
849
  }
@@ -865,19 +875,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
865
  array(
866
  'userid' => $userid,
867
  'uploaduserid' => $filerec->uploaduserid,
 
868
  'sessionid' => $filerec->sessionid,
869
  'filepath' => $filerec->filepath,
870
  'filehash' => $filerec->filehash,
871
  'filesize' => $filerec->filesize,
872
  'uploadid' => $filerec->uploadid,
873
  'pageid' => $filerec->pageid,
 
874
  'sid' => $filerec->sid,
875
  'date_from' => $now_date,
876
  'date_to' => 0,
877
  'action' => 'download',
878
  'linkedto' => $filerec->idlog
879
  ),
880
- array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
881
  $retid = $wpdb->insert_id;
882
  }
883
  }
@@ -900,19 +912,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
900
  array(
901
  'userid' => $userid,
902
  'uploaduserid' => $filerec->uploaduserid,
 
903
  'sessionid' => $filerec->sessionid,
904
  'filepath' => $filerec->filepath,
905
  'filehash' => $filerec->filehash,
906
  'filesize' => $filerec->filesize,
907
  'uploadid' => $filerec->uploadid,
908
  'pageid' => $filerec->pageid,
 
909
  'sid' => $filerec->sid,
910
  'date_from' => $now_date,
911
  'date_to' => 0,
912
  'action' => 'modify',
913
  'linkedto' => $filerec->idlog
914
  ),
915
- array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
916
  $retid = $wpdb->insert_id;
917
  }
918
  }
@@ -924,19 +938,21 @@ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $sid, $
924
  array(
925
  'userid' => $userid,
926
  'uploaduserid' => -1,
 
927
  'sessionid' => '',
928
  'filepath' => $info,
929
  'filehash' => '',
930
  'filesize' => 0,
931
  'uploadid' => '',
932
  'pageid' => 0,
 
933
  'sid' => '',
934
  'date_from' => $now_date,
935
  'date_to' => $now_date,
936
  'action' => 'other',
937
  'linkedto' => -1
938
  ),
939
- array( '%d','%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
940
  $retid = $wpdb->insert_id;
941
  }
942
  return $retid;
@@ -1113,6 +1129,116 @@ function wfu_get_recs_of_user($userid) {
1113
  return $out;
1114
  }
1115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1116
  //********************* Shortcode Options Functions ****************************************************************************************
1117
 
1118
  function wfu_generate_current_params_index($shortcode_id, $user_login) {
21
  return '/^' . str_replace(array('\*', '\?', '\[', '\]'), array('.*', '.', '[', ']+'), preg_quote($pattern)) . '$/is';
22
  }
23
 
24
+ function wfu_upload_plugin_wildcard_to_mysqlregexp($pattern) {
25
+ return str_replace("\\", "\\\\", '^'.str_replace(array('\*', '\?', '\[', '\]'), array('.*', '.', '[', ']+'), preg_quote($pattern)).'$');
26
+ }
27
+
28
  function wfu_upload_plugin_wildcard_match($pattern, $str) {
29
  $pattern = wfu_upload_plugin_wildcard_to_preg($pattern);
30
  return preg_match($pattern, $str);
651
  //********************* User Functions *****************************************************************************************************
652
 
653
  function wfu_get_user_role($user, $param_roles) {
654
+ $result_role = 'nomatch';
655
  if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
656
  /* Go through the array of the roles of the current user */
657
  foreach ( $user->roles as $user_role ) {
658
  $user_role = strtolower($user_role);
659
+ /* if this role matches to the roles in $param_roles or it is administrator or $param_roles allow all roles then it is approved */
660
+ if ( in_array($user_role, $param_roles) || $user_role == 'administrator' || in_array('all', $param_roles) ) {
661
+ /* We approve this role of the user and exit */
662
  $result_role = $user_role;
663
  break;
664
  }
 
 
 
 
665
  }
666
  }
667
+ /* if the user has no roles (guest) and guests are allowed, then it is approved */
668
+ elseif ( in_array('guests', $param_roles) ) {
669
+ $result_role = 'guest';
670
  }
671
  return $result_role;
672
  }
692
  //*********************** DB Functions *****************************************************************************************************
693
 
694
  //log action to database
695
+ function wfu_log_action($action, $filepath, $userid, $uploadid, $pageid, $blogid, $sid, $userdata) {
696
  global $wpdb;
697
  $table_name1 = $wpdb->prefix . "wfu_log";
698
  $table_name2 = $wpdb->prefix . "wfu_userdata";
723
  array(
724
  'userid' => $userid,
725
  'uploaduserid' => $userid,
726
+ 'uploadtime' => time(),
727
  'sessionid' => session_id(),
728
  'filepath' => $relativepath,
729
  'filehash' => $filehash,
730
  'filesize' => $filesize,
731
  'uploadid' => $uploadid,
732
  'pageid' => $pageid,
733
+ 'blogid' => $blogid,
734
  'sid' => $sid,
735
  'date_from' => $now_date,
736
  'date_to' => 0,
737
  'action' => 'upload'
738
  ),
739
  array(
740
+ '%d',
741
  '%d',
742
  '%d',
743
  '%s',
746
  '%d',
747
  '%s',
748
  '%d',
749
+ '%d',
750
  '%s',
751
  '%s',
752
  '%s',
803
  array(
804
  'userid' => $userid,
805
  'uploaduserid' => $filerec->uploaduserid,
806
+ 'uploadtime' => $filerec->uploadtime,
807
  'sessionid' => $filerec->sessionid,
808
  'filepath' => $relativepath,
809
  'filehash' => $filerec->filehash,
810
  'filesize' => $filerec->filesize,
811
  'uploadid' => $filerec->uploadid,
812
  'pageid' => $filerec->pageid,
813
+ 'blogid' => $filerec->blogid,
814
  'sid' => $filerec->sid,
815
  'date_from' => $now_date,
816
  'date_to' => 0,
817
  'action' => 'rename',
818
  'linkedto' => $filerec->idlog
819
  ),
820
+ array( '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%d' ) ) !== false )
821
  $retid = $wpdb->insert_id;
822
  }
823
  }
839
  array(
840
  'userid' => $userid,
841
  'uploaduserid' => $filerec->uploaduserid,
842
+ 'uploadtime' => $filerec->uploadtime,
843
  'sessionid' => $filerec->sessionid,
844
  'filepath' => $filerec->filepath,
845
  'filehash' => $filerec->filehash,
846
  'filesize' => $filerec->filesize,
847
  'uploadid' => $filerec->uploadid,
848
  'pageid' => $filerec->pageid,
849
+ 'blogid' => $filerec->blogid,
850
  'sid' => $filerec->sid,
851
  'date_from' => $now_date,
852
  'date_to' => $now_date,
853
  'action' => 'delete',
854
  'linkedto' => $filerec->idlog
855
  ),
856
+ array( '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
857
  $retid = $wpdb->insert_id;
858
  }
859
  }
875
  array(
876
  'userid' => $userid,
877
  'uploaduserid' => $filerec->uploaduserid,
878
+ 'uploadtime' => $filerec->uploadtime,
879
  'sessionid' => $filerec->sessionid,
880
  'filepath' => $filerec->filepath,
881
  'filehash' => $filerec->filehash,
882
  'filesize' => $filerec->filesize,
883
  'uploadid' => $filerec->uploadid,
884
  'pageid' => $filerec->pageid,
885
+ 'blogid' => $filerec->blogid,
886
  'sid' => $filerec->sid,
887
  'date_from' => $now_date,
888
  'date_to' => 0,
889
  'action' => 'download',
890
  'linkedto' => $filerec->idlog
891
  ),
892
+ array( '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
893
  $retid = $wpdb->insert_id;
894
  }
895
  }
912
  array(
913
  'userid' => $userid,
914
  'uploaduserid' => $filerec->uploaduserid,
915
+ 'uploadtime' => $filerec->uploadtime,
916
  'sessionid' => $filerec->sessionid,
917
  'filepath' => $filerec->filepath,
918
  'filehash' => $filerec->filehash,
919
  'filesize' => $filerec->filesize,
920
  'uploadid' => $filerec->uploadid,
921
  'pageid' => $filerec->pageid,
922
+ 'blogid' => $filerec->blogid,
923
  'sid' => $filerec->sid,
924
  'date_from' => $now_date,
925
  'date_to' => 0,
926
  'action' => 'modify',
927
  'linkedto' => $filerec->idlog
928
  ),
929
+ array( '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
930
  $retid = $wpdb->insert_id;
931
  }
932
  }
938
  array(
939
  'userid' => $userid,
940
  'uploaduserid' => -1,
941
+ 'uploadtime' => 0,
942
  'sessionid' => '',
943
  'filepath' => $info,
944
  'filehash' => '',
945
  'filesize' => 0,
946
  'uploadid' => '',
947
  'pageid' => 0,
948
+ 'blogid' => 0,
949
  'sid' => '',
950
  'date_from' => $now_date,
951
  'date_to' => $now_date,
952
  'action' => 'other',
953
  'linkedto' => -1
954
  ),
955
+ array( '%d', '%d', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%d' )) != false )
956
  $retid = $wpdb->insert_id;
957
  }
958
  return $retid;
1129
  return $out;
1130
  }
1131
 
1132
+ function wfu_get_filtered_recs($filter) {
1133
+ global $wpdb;
1134
+ $table_name1 = $wpdb->prefix . "wfu_log";
1135
+ $table_name2 = $wpdb->prefix . "wfu_userdata";
1136
+ $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
1137
+
1138
+ $queries = array();
1139
+ // add default filters
1140
+ array_push($queries, 'action <> \'other\'');
1141
+ array_push($queries, 'date_to = 0');
1142
+ // construct user filter
1143
+ if ( isset($filter['user']) ) {
1144
+ if ( $filter['user']['all'] ) {
1145
+ if ( $filter['user']['guests'] ) $query = 'uploaduserid >= 0';
1146
+ else $query = 'uploaduserid > 0';
1147
+ }
1148
+ elseif ( count($filter['user']['ids']) == 1 && substr($filter['user']['ids'][0], 0, 5) == 'guest' )
1149
+ $query = 'uploaduserid = 0 AND sessionid = \''.substr($filter['user']['ids'][0], 5).'\'';
1150
+ else {
1151
+ if ( $filter['user']['guests'] ) array_push($filter['user']['ids'], '0');
1152
+ if ( count($filter['user']['ids']) == 1 ) $query = 'uploaduserid = '.$filter['user']['ids'][0];
1153
+ else $query = 'uploaduserid in ('.implode(",",$filter['user']['ids']).')';
1154
+ }
1155
+ array_push($queries, $query);
1156
+ }
1157
+ // construct size filter
1158
+ if ( isset($filter['size']) ) {
1159
+ if ( isset($filter['size']['lower']) && isset($filter['size']['upper']) )
1160
+ $query = 'filesize > '.$filter['size']['lower'].' AND filesize < '.$filter['size']['upper'];
1161
+ elseif ( isset($filter['size']['lower']) ) $query = 'filesize > '.$filter['size']['lower'];
1162
+ else $query = 'filesize < '.$filter['size']['upper'];
1163
+ array_push($queries, $query);
1164
+ }
1165
+ // construct date filter
1166
+ if ( isset($filter['date']) ) {
1167
+ if ( isset($filter['date']['lower']) && isset($filter['date']['upper']) )
1168
+ $query = 'uploadtime > '.$filter['date']['lower'].' AND uploadtime < '.$filter['date']['upper'];
1169
+ elseif ( isset($filter['date']['lower']) ) $query = 'uploadtime > '.$filter['date']['lower'];
1170
+ else $query = 'uploadtime < '.$filter['date']['upper'];
1171
+ array_push($queries, $query);
1172
+ }
1173
+ // construct file pattern filter
1174
+ if ( isset($filter['pattern']) ) {
1175
+ $query = 'filepath REGEXP \''.wfu_upload_plugin_wildcard_to_mysqlregexp($filter['pattern']).'\'';
1176
+ array_push($queries, $query);
1177
+ }
1178
+ // construct page/post filter
1179
+ if ( isset($filter['post']) ) {
1180
+ if ( count($filter['post']['ids']) == 1 ) $query = 'pageid = '.$filter['post']['ids'][0];
1181
+ else $query = 'pageid in ('.implode(",",$filter['post']['ids']).')';
1182
+ array_push($queries, $query);
1183
+ }
1184
+ // construct blog filter
1185
+ if ( isset($filter['blog']) ) {
1186
+ if ( count($filter['blog']['ids']) == 1 ) $query = 'blogid = '.$filter['blog']['ids'][0];
1187
+ else $query = 'blogid in ('.implode(",",$filter['blog']['ids']).')';
1188
+ array_push($queries, $query);
1189
+ }
1190
+ // construct userdata filter
1191
+ if ( isset($filter['userdata']) ) {
1192
+ if ( $filter['userdata']['criterion'] == "equal to" ) $valuecriterion = 'propvalue = \''.$filter['userdata']['value'].'\'';
1193
+ elseif ( $filter['userdata']['criterion'] == "starts with" ) $valuecriterion = 'propvalue LIKE \''.$filter['userdata']['value'].'%\'';
1194
+ elseif ( $filter['userdata']['criterion'] == "ends with" ) $valuecriterion = 'propvalue LIKE \'%'.$filter['userdata']['value'].'\'';
1195
+ elseif ( $filter['userdata']['criterion'] == "contains" ) $valuecriterion = 'propvalue LIKE \'%'.$filter['userdata']['value'].'%\'';
1196
+ elseif ( $filter['userdata']['criterion'] == "not equal to" ) $valuecriterion = 'propvalue <> \''.$filter['userdata']['value'].'\'';
1197
+ elseif ( $filter['userdata']['criterion'] == "does not start with" ) $valuecriterion = 'propvalue NOT LIKE \''.$filter['userdata']['value'].'%\'';
1198
+ elseif ( $filter['userdata']['criterion'] == "does not end with" ) $valuecriterion = 'propvalue NOT LIKE \'%'.$filter['userdata']['value'].'\'';
1199
+ elseif ( $filter['userdata']['criterion'] == "does not contain" ) $valuecriterion = 'propvalue NOT LIKE \'%'.$filter['userdata']['value'].'%\'';
1200
+ else $valuecriterion = 'propvalue = \''.$filter['userdata']['value'].'\'';
1201
+ $query = 'uploadid in (SELECT DISTINCT uploadid FROM '.$table_name2.' WHERE date_to = 0 AND property = \''.$filter['userdata']['field'] .'\' AND '.$valuecriterion.')';
1202
+ array_push($queries, $query);
1203
+ }
1204
+
1205
+ $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE '.implode(' AND ', $queries));
1206
+ $out = array();
1207
+ foreach( $filerecs as $filerec ) {
1208
+ $obsolete = true;
1209
+ //calculate full file path
1210
+ $filepath = wfu_path_rel2abs($filerec->filepath);
1211
+ if ( file_exists($filepath) ) {
1212
+ if ( $plugin_options['hashfiles'] == '1' ) {
1213
+ $filehash = md5_file($filepath);
1214
+ if ( $filehash == $filerec->filehash ) $obsolete = false;
1215
+ }
1216
+ else {
1217
+ $filesize = filesize($filepath);
1218
+ if ( $filesize == $filerec->filesize ) $obsolete = false;
1219
+ }
1220
+ }
1221
+ if ( $obsolete ) {
1222
+ $now_date = date('Y-m-d H:i:s');
1223
+ //make previous record obsolete
1224
+ $wpdb->update($table_name1,
1225
+ array( 'date_to' => $now_date ),
1226
+ array( 'idlog' => $filerec->idlog ),
1227
+ array( '%s' ),
1228
+ array( '%d' )
1229
+ );
1230
+ }
1231
+ else {
1232
+ $filerec->userdata = null;
1233
+ if ( $filerec->uploadid != '' )
1234
+ $filerec->userdata = $wpdb->get_results('SELECT * FROM '.$table_name2.' WHERE uploadid = \''.$filerec->uploadid.'\' AND date_to = 0');
1235
+ array_push($out, $filerec);
1236
+ }
1237
+ }
1238
+
1239
+ return $out;
1240
+ }
1241
+
1242
  //********************* Shortcode Options Functions ****************************************************************************************
1243
 
1244
  function wfu_generate_current_params_index($shortcode_id, $user_login) {
lib/wfu_processfiles.php CHANGED
@@ -527,7 +527,7 @@ function wfu_process_files($params, $method) {
527
 
528
  if ( $file_finished_successfully && !$ignore_server_actions ) {
529
  /* log file upload action if file has finished uploading successfully */
530
- wfu_log_action('upload', $target_path, $user->ID, $unique_id, $params['pageid'], $sid, $userdata_fields);
531
  /* Apply wfu_after_file_upload filter after failed upload, in order to allow the user to perform any post-upload actions.
532
  If additional data are required, such as user_id or userdata values or filepath, they can be retrieved by implementing
533
  the previous filters wfu_before_file_check and wfu_before_file_upload, corresponding them to the unique file id.
527
 
528
  if ( $file_finished_successfully && !$ignore_server_actions ) {
529
  /* log file upload action if file has finished uploading successfully */
530
+ wfu_log_action('upload', $target_path, $user->ID, $unique_id, $params['pageid'], $params['blogid'], $sid, $userdata_fields);
531
  /* Apply wfu_after_file_upload filter after failed upload, in order to allow the user to perform any post-upload actions.
532
  If additional data are required, such as user_id or userdata values or filepath, they can be retrieved by implementing
533
  the previous filters wfu_before_file_check and wfu_before_file_upload, corresponding them to the unique file id.
readme.txt CHANGED
@@ -129,6 +129,14 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
129
 
130
  == Changelog ==
131
 
 
 
 
 
 
 
 
 
132
  = 3.2.0 =
133
  * added option in plugin's settings to relax CSS rules so that plugin inherits theme styling
134
  * modifications in html and css of editable subfolders feature to look better
@@ -469,6 +477,12 @@ Initial version.
469
 
470
  == Upgrade Notice ==
471
 
 
 
 
 
 
 
472
  = 3.1.2 =
473
  Upgrade to fix an important bug.
474
 
129
 
130
  == Changelog ==
131
 
132
+ = 3.2.1 =
133
+ * removed 'form-field' class from admin table tr elements
134
+ * corrected bug that was causing problems in uploadrole and uploaduser attributes when a username or role contained uppercase letters
135
+ * uploadrole and uploaduser attributes logic modified; guests are allowed only if 'guests' word is included in the attribute
136
+ * modifications to the download functionality script to be more robust
137
+ * corrected bug that was not showing options below a line item of admin tables in Internet Explorer
138
+ * several feature additions and bug fixes in Professional version
139
+
140
  = 3.2.0 =
141
  * added option in plugin's settings to relax CSS rules so that plugin inherits theme styling
142
  * modifications in html and css of editable subfolders feature to look better
477
 
478
  == Upgrade Notice ==
479
 
480
+ = 3.2.1 =
481
+ Upgrade to fix some bugs and add some features.
482
+
483
+ = 3.2.0 =
484
+ Upgrade to fix some bugs and add some features.
485
+
486
  = 3.1.2 =
487
  Upgrade to fix an important bug.
488
 
release_notes.txt CHANGED
@@ -1 +1 @@
1
- <span><strong>Latest release notes: </strong>This is an important release as it incorporates a very significant feature, <strong>relaxation of CSS rules</strong>. By default, the plugin's buttons and textboxes are styled to look the same in all themes. However, there are many users that want them to inherit the styles (colors, fonts, sizes) of the theme they are using. An option has been added in plugin's settings in Dashboard to relax the CSS rules. If enabled, then minimum styling will be applied on buttons and textboxes of the plugin, so that they inherit theme's styles. For more information please check this </span><a href="http://www.iptanus.com/improve-styling-of-wordpress-file-upload-plugin/">article</a><span>.</span><br />Moreover, this release introduces some changes in the html code of <strong>editable subfolders</strong> feature so that it looks better and also some changes in <strong>user fields</strong> so that a hint next to a required field is shown when the field has empty value.</span>
1
+ <span><strong>Latest release notes: </strong>This version introduces some minor bug fixes and code improvements.<!-- --> The professional version of the plugin introduces some important improvements to the front-end file list viewer feature. For details, 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
@@ -28,29 +28,26 @@ function wfu_download_file() {
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
33
- if ( $fd = fopen ($filepath, "r") ) {
34
- $fsize = filesize($filepath);
35
- $path_parts = pathinfo($filepath);
36
- $ext = strtolower($path_parts["extension"]);
37
- switch ($ext) {
38
- case "pdf":
39
- header("Content-type: application/pdf");
40
- header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a file download
41
- break;
42
- // add more headers for other content types here
43
- default;
44
- header("Content-type: application/octet-stream");
45
- header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
46
- break;
47
- }
48
  header("Content-length: $fsize");
49
- header("Cache-control: private"); //use this to open files directly
50
  $failed = false;
51
  while( !feof($fd) ) {
52
- $buffer = fread($fd, 2048);
53
  echo $buffer;
 
 
54
  if ( connection_status() != 0 ) {
55
  $failed = true;
56
  break;
28
  $_SESSION['wfu_download_status_'.$ticket] = 'failed';
29
  die('<script language="javascript">alert("Error! File does not exist.'.$filepath.'");</script>');
30
  }
31
+ //get mime type
32
 
33
  set_time_limit(0); // disable the time limit for this script
34
+ $fsize = filesize($filepath);
35
+ $path_parts = pathinfo($filepath);
36
+ if ( $fd = @fopen ($filepath, "rb") ) {
37
+ header('Content-Type: application/octet-stream');
38
+ header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
39
+ header('Content-Transfer-Encoding: binary');
40
+ header('Connection: Keep-Alive');
41
+ header('Expires: 0');
42
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
43
+ header('Pragma: public');
 
 
 
 
 
44
  header("Content-length: $fsize");
 
45
  $failed = false;
46
  while( !feof($fd) ) {
47
+ $buffer = @fread($fd, 1024*8);
48
  echo $buffer;
49
+ ob_flush();
50
+ flush();
51
  if ( connection_status() != 0 ) {
52
  $failed = true;
53
  break;
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.2.0
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
@@ -31,7 +31,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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 */
@@ -132,8 +135,9 @@ function wordpress_file_upload_function($incomingfromhandler) {
132
  $shortcode_tag = 'wordpress_file_upload';
133
  $params = wfu_plugin_parse_array($incomingfromhandler);
134
  $sid = $params["uploadid"];
135
- // store current page id in params array
136
  $params["pageid"] = $post->ID;
 
137
 
138
  if ( !isset($_SESSION['wfu_token_'.$sid]) || $_SESSION['wfu_token_'.$sid] == "" )
139
  $_SESSION['wfu_token_'.$sid] = uniqid(mt_rand(), TRUE);
@@ -152,10 +156,10 @@ function wordpress_file_upload_function($incomingfromhandler) {
152
  //check if user is allowed to view plugin, otherwise do not generate it
153
  $uploadroles = explode(",", $params["uploadrole"]);
154
  foreach ( $uploadroles as &$uploadrole ) {
155
- $uploadrole = strtolower(trim($uploadrole));
156
  }
157
  $plugin_upload_user_role = wfu_get_user_role($user, $uploadroles);
158
- if ( !in_array($plugin_upload_user_role, $uploadroles) && $plugin_upload_user_role != 'administrator' && $params["uploadrole"] != 'all' ) return;
159
 
160
  //activate debug mode only for admins
161
  if ( $plugin_upload_user_role != 'administrator' ) $params["debugmode"] = "false";
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.2.1
8
  Author: Nickolas Bossinas
9
  Author URI: http://www.iptanus.com
10
  */
31
  //set global db variables
32
  //wfu_tb_log_version v2.0 changes:
33
  // sessionid field added
34
+ //wfu_tb_log_version v3.0 changes:
35
+ // uploadtime field added
36
+ // blogid field added
37
+ $wfu_tb_log_version = "3.0";
38
  $wfu_tb_userdata_version = "1.0";
39
 
40
  /* do not load plugin if this is the login page */
135
  $shortcode_tag = 'wordpress_file_upload';
136
  $params = wfu_plugin_parse_array($incomingfromhandler);
137
  $sid = $params["uploadid"];
138
+ // store current page and blog id in params array
139
  $params["pageid"] = $post->ID;
140
+ $params["blogid"] = $blog_id;
141
 
142
  if ( !isset($_SESSION['wfu_token_'.$sid]) || $_SESSION['wfu_token_'.$sid] == "" )
143
  $_SESSION['wfu_token_'.$sid] = uniqid(mt_rand(), TRUE);
156
  //check if user is allowed to view plugin, otherwise do not generate it
157
  $uploadroles = explode(",", $params["uploadrole"]);
158
  foreach ( $uploadroles as &$uploadrole ) {
159
+ $uploadrole = trim($uploadrole);
160
  }
161
  $plugin_upload_user_role = wfu_get_user_role($user, $uploadroles);
162
+ if ( $plugin_upload_user_role == 'nomatch' ) return;
163
 
164
  //activate debug mode only for admins
165
  if ( $plugin_upload_user_role != 'administrator' ) $params["debugmode"] = "false";