WordPress File Upload - Version 4.9.1

Version Description

  • added Maintenance action 'Purge All Data' that entirely erases the plugin from the website and deactivates it
  • added advanced option 'Hide Invalid Uploaded Files' so that Uploaded Files page in Dashboard can show only valid uploads
  • added advanced option 'Restrict Front-End Loading' to load the plugin only on specific pages or posts in order to reduce unnecessary workload on pages not containing the plugin
  • code improved for better operation of the plugin when the website works behind a proxy
  • added option in Clean Log to erase the files together with plugin data
Download this release

Release Info

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

Code changes from version 4.9.0 to 4.9.1

css/wordpress_file_upload_adminstyle.css CHANGED
@@ -1 +1 @@
1
- div.wfu_help_container,div.wfu_restore_container,div.wfu_shortcode_container,div.wfu_td_div{background:0 0;border:none;padding:0;position:relative}select.wfu_variable,span.wfu_variable{font-size:smaller;color:#333;-webkit-touch-callout:none;-khtml-user-select:none;cursor:default}.wfu_conquestions_optable,.wfu_logactions_table,.wfu_permissions_table{border-collapse:collapse}.wfu_cleanlog_proceed.disabled,.wfu_frozen{pointer-events:none}div.wfu_shortcode_container{display:inline-block;width:50%;margin:0}div.wfu_container input.wfu_long_text,textarea.wfu_shortcode{width:100%}div.wfu_container{margin-top:10px}div.wfu_help_container{display:inline-block;top:4px;margin:0}div.wfu_help_container img{visibility:hidden}table.wfu_inner_table th:hover div.wfu_help_container img,table.wfu_main_table th:hover div.wfu_help_container img{visibility:visible}div.wfu_restore_container{display:inline-block;top:4px;margin:0}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%;margin:0}div.wfu_container input.wfu_short_text{width:60px}div.wfu_container input{width:200px}div.wfu_container input[type=checkbox]{width:auto}div.wfu_container textarea{width:100%}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}select.wfu_variable,span.wfu_variable,table.wfu_main_table tr.wfu_subcategory{background-color:#ddd}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>th{padding-top:0;padding-bottom:0}select.wfu_variable{padding:0;margin:0;height:auto;border:1px solid #ccc;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.wfu_variable{padding:1px;margin:0;border:1px solid #ccc;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.wfu_date_container{display:inline-block;position:relative;width:auto;height:100%;padding:0;margin:0;background:0 0;border:none}.wfu_datereset_button{position:absolute;right:4px;top:0;bottom:0;margin:auto 0;opacity:.5}.wfu_datereset_button:hover{opacity:1}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{background:0 0;margin:0;padding:0;border:none}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{width:100%;padding:0;margin: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_stringmatch_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_stringmatch_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;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;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_component_box_inner{display:table;width:100%;height:100%}div.wfu_component_box_label{display:table-cell;text-align:center;vertical-align:middle}div.wfu_component_box_index{background-color:coral;padding:1px;float:right;border-radius:10px}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;z-index:1;cursor:default}div.wfu_component_box_dragged{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4}div.wfu_component_separator_ver{display:inline-block;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{background-color:silver;border:none;display:none;position:absolute}div.wfu_component_bar_hor{width:auto;height:4px;left:10px;right:0;margin:11px 0 0;padding:0}div.wfu_component_bar_ver{width:4px;height:40px;margin:-6px 0 0 11px;padding:0}div.wfu_componentlist_dragdrop{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#f8f8f8;border:4px dashed #aaa;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;z-index:2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7}div.wfu_componentlist_dragdrop_dragover{border:4px dashed #555}div.wfu_formdata_container,div.wfu_userdata_container{display:block;position:relative;width:100%;height:100%;padding:0;margin:0;background:0 0;border:none}label.wfu_formdata_label{margin-right:6px}.wfu_formdata_props{padding-left:20px}div.wfu_formdata_action,div.wfu_userdata_action{display:inline-block;position:relative;top:2px;width:16px;height:16px;padding:0;margin:0;background:0 0;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_formdata_action:hover,div.wfu_userdata_action:hover{border:1px solid #aaa}div.wfu_formdata_action.wfu_formdata_action_disabled:hover,div.wfu_userdata_action.wfu_userdata_action_disabled:hover{border:1px solid transparent}div.wfu_formdata_action>img,div.wfu_userdata_action>img{width:12px;height:12px}div.wfu_formdata_action_disabled>img,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_formdata_line_container,div.wfu_userdata_line{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap}table.wfu_formdata_props_table{background:0 0;border:none;padding:0}table.wfu_formdata_props_table td,table.wfu_main_table table.wfu_inner_table table.wfu_formdata_props_table td{background:0 0;border:none;padding:0;width:auto}table.wfu_formdata_props_table td.wfu_formdata_props,table.wfu_main_table table.wfu_inner_table table.wfu_formdata_props_table td.wfu_formdata_props{padding-left:20px}div.wfu_color_container{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap;z-index:1}span.wfu_save_label,span.wfu_save_label_fail{border-radius:6px;padding:1px 2px;box-shadow:1px 1px 1px;opacity:0;font-size:smaller}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}.wfu_conquestion_itemcontainer,.wfu_conquestions_opsel.wfu_forced_selection{opacity:.5}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}.wfu_buttons_container .button,.wfu_buttons_container .wfu_cleanlog_error,.wfu_pdheader_button,.wfu_selectdate_container input[type=text],.wfu_selectdate_container label,.wfu_selectdates_container input[type=text],.wfu_selectdates_container label,.wfu_selectperiod_container input[type=number],.wfu_selectperiod_container label,.wfu_selectperiod_container select{vertical-align:middle}table.wfu_main_table table.wfu_columnprops_container{border:none;background:0 0;margin:0;padding:6px;border-spacing:0;width:100%;box-shadow:0 0 1px #aaa}table.wfu_main_table table.wfu_columnprops_container tr{background:0 0}table.wfu_main_table table.wfu_columnprops_container td{border:none;background:0 0;margin:0;padding:0;vertical-align:middle;width:auto}table.wfu_main_table table.wfu_columnprops_container label.wfu_columnprops_label_disabled,table.wfu_main_table table.wfu_columnprops_container_disabled label{color:#ccc}button.wfu_columns_addbutton{font-size:smaller}option.wfu_columns_item_required{color:gray}@font-face{font-family:wfu-icons;src:url(../images/fonts/wfu-icons.eot?xnqdfz);src:url(../images/fonts/wfu-icons.eot?xnqdfz#iefix) format('embedded-opentype'),url(../images/fonts/wfu-icons.ttf?xnqdfz) format('truetype'),url(../images/fonts/wfu-icons.woff?xnqdfz) format('woff'),url(../images/fonts/wfu-icons.svg?xnqdfz#wfu-icons) format('svg');font-weight:400;font-style:normal}.wfu-dashicons-media-external:before{font-family:wfu-icons;content:"\e900"}.wfu-dashicons-ftp:before{font-family:wfu-icons;content:"\e901"}.wfu-uploadedfiles .wfu-dashicons-after{margin-left:4px}.wfu-uploadedfiles .wfu-dashicons-hidden{display:none}.wfu-uploadedfiles .wfu-properties.wfu-clicked,.wfu-uploadedfiles .wfu-properties:hover{color:#00f}.wfu-uploadedfiles .wfu_unread{box-shadow:4px 0 0 inset #0f0;font-weight:700}.wfu-uploadedfiles .wfu-remarks-container:before{content:'-';width:0;display:inline-block;overflow:hidden}.wfu_cleanlog_error.hidden,.wfu_cleanlog_tr,.wfu_consent_logactions,.wfu_consent_operations,.wfu_consent_permissions,.wfu_consent_questions,.wfu_consent_users,.wfu_plugin_operations,.wfu_selectdate_container,.wfu_selectdates_container,.wfu_selectperiod_container{display:none}.wfu-adminbrowser .wfu-highlighted,.wfu-historylog .wfu-highlighted{box-shadow:0 -1000px 0 inset rgba(0,255,0,.2)}.wfu_cleanlog_tr td{margin-top:0;padding-top:0}.wfu_buttons_container,.wfu_selectdate_container,.wfu_selectdates_container,.wfu_selectperiod_container{margin-top:10px}.wfu_selectdate_container input[type=text],.wfu_selectdates_container input[type=text]{width:8em;text-align:center}.wfu_selectperiod_container input[type=number]{width:4em}.wfu_cleanlog_error{color:red;font-size:small}.wfu_cleanlog_error:before{content:'!';font-weight:700;margin-right:2px}.wfu_conop_header,.wfu_pdop_header{transition:.4s;padding:6px}.wfu_conop_header label,.wfu_pdop_header label{font-weight:700;cursor:default}.wfu_conop_button,.wfu_pdheader_button,.wfu_pdop_button{color:#777;width:1em;height:1em;cursor:pointer;text-align:center}.wfu_conop_header.atomic label,.wfu_pdop_header.atomic label{font-weight:400}.wfu_pdheader_button{padding:2px;border:1px solid gray;border-radius:1em;position:relative;display:inline-block;font-size:smaller}.wfu_pdheader_button:after{content:'\02795';position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}.wfu_conop_panel,.wfu_conop_topmost_panel,.wfu_pdop_panel,.wfu_pdop_topmost_panel{margin-left:40px;overflow:hidden}.wfu_pdheader_button.expanded:after{content:'\02796'}.wfu_conop_panel,.wfu_pdop_panel{display:none}.wfu_conop_level_1,.wfu_pdop_level_1{padding:10px;font-size:larger}.wfu_conop_level_2,.wfu_pdop_level_2{padding:6px;font-size:smaller}.wfu_conop_level_3,.wfu_conop_level_4,.wfu_conop_level_5,.wfu_pdop_level_3,.wfu_pdop_level_4,.wfu_pdop_level_5{padding:2px}.wfu_conop_header:hover,.wfu_pdop_header:hover{background-color:rgba(0,0,0,.2)}.wfu_conop_button,.wfu_pdop_button{float:right;padding:2px;border:1px solid gray;border-radius:4px;position:relative;display:none}.wfu_conop_button:after,.wfu_pdop_button:after{content:'\02795';position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;font-size:smaller}.wfu_conop_button.expanded:after,.wfu_pdop_button.expanded:after{content:'\02796'}.wfu_conop_header:hover .wfu_conop_button,.wfu_pdop_header:hover .wfu_pdop_button{display:block}input[type=checkbox].wfu_conop_selector,input[type=checkbox].wfu_pdop_selector{-webkit-appearance:checkbox;margin:0 0 0 4px}.wfu_conquestions_operations{margin-top:20px;margin-left:40px}.wfu_conquestions_operations label{display:block;font-size:larger;font-weight:700}.wfu_conquestions_oppanel{background-color:#fff;padding:10px;display:inline-block;margin-top:10px}.wfu_conquestions_optable tbody tr:hover{background-color:rgba(0,0,0,.1)}.wfu_conquestions_optable td{cursor:default}.wfu_conquestions_optable td:not(:first-child){text-align:center}.wfu_op_unassigned{background-color:#ffdb99}.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover{background-color:#e6c58a}.wfu_op_unassigned .wfu_conquestions_opinv,.wfu_op_unassigned .wfu_conquestions_opsel{background-color:#ffdb99}.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover .wfu_conquestions_opinv,.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover .wfu_conquestions_opsel{background-color:#e6c58a}.wfu_conquestions_container{margin-top:20px;margin-left:40px}.wfu_conquestion_header{font-size:larger}.wfu_conquestion_subcontainer{padding:10px}.wfu_conquestion_headerlabel{font-weight:700}.wfu_conquestion_tools{float:right}.wfu_conquestion_itemprops,.wfu_conquestion_itemspreview,.wfu_conquestion_mainprops{display:table-cell;position:relative;border:1px solid silver;padding:4ex 10px 10px;vertical-align:top;min-width:10em;min-height:4ex;resize:both;overflow:auto}.wfu_conquestion_itempropstitle,.wfu_conquestion_itemspreviewtitle,.wfu_conquestion_mainpropstitle{position:absolute;top:0;left:0;height:3ex;font-size:inherit;text-align:center;width:100%;background-color:rgba(0,0,0,.1)}.wfu_conquestion_displayedtitle,.wfu_conquestion_groupedlabel,.wfu_conquestion_labellabel,.wfu_conquestion_labellocationlabel,.wfu_conquestion_matrixlabel,.wfu_conquestion_preselectedlabel,.wfu_conquestion_titlelabel,.wfu_conquestion_titlelocationlabel,.wfu_conquestion_typelabel,.wfu_conquestion_visiblelabel{display:block}.wfu_conquestion_labeltext,.wfu_conquestion_titletext{width:100%}.wfu_conquestion_matrix_x,.wfu_conquestion_matrix_y{width:4em;text-align:center}.wfu_conquestion_matrixsep{width:1em;display:inline-block;text-align:center}.wfu_empty_label{font-style:italic}.wfu_conquestion_itemtable td:hover{background-color:rgba(0,0,0,.1)}.wfu_item_selected{background-color:rgba(0,0,0,.2)}.wfu_item_assigned{color:#00f}.wfu_item_visible{opacity:1}.wfu_conquestion_btn{display:inline-block;position:relative;width:16px;height:16px;padding:0;margin:0;background:0 0;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_conquestion_btn:hover{border:1px solid #aaa}.wfu_conquestion_btn>img{width:12px;height:12px;position:absolute;top:0;left:0;right:0;bottom:0;margin:auto}.wfu_log_button,.wfu_perm_button{width:1.5ex;height:1.5ex;cursor:pointer;display:inline-block;vertical-align:middle;text-align:center}div.wfu_conquestion_btn.wfu_tool_disabled:hover{border:1px solid transparent}.wfu_conquestion_btn.wfu_tool_disabled>img{opacity:.4}.wfu_permissions_topmost_panel{margin-left:40px}.wfu_permissions_panel{background-color:#fff;padding:10px;display:inline-block;margin-top:20px}.wfu_perm_container{padding-right:20px}.wfu_location_cell{text-align:center}.wfu_perm_level_1{padding-left:0}.wfu_perm_level_2{padding-left:20px}.wfu_perm_level_3{padding-left:40px}.wfu_permissions_table td:nth-child(n+2),.wfu_permissions_table tr:nth-child(2) th{border-left:1px solid rgba(0,0,0,.1)}.wfu_perm_row:hover{background-color:rgba(0,0,0,.1)}.wfu_perm_button{color:#777;border:1px solid gray;position:relative}.wfu_perm_button:after{content:'+';position:absolute;left:0;right:0;top:-.75ex;bottom:0;margin:auto}.wfu_perm_button:hover{color:#000}.wfu_perm_button.expanded:after{content:'-'}input[type=checkbox].wfu_location_selector{-webkit-appearance:checkbox;margin:0}.wfu_logactions_topmost_panel{margin-left:40px}.wfu_logactions_panel{background-color:#fff;padding:10px;display:inline-block;margin-top:20px}.wfu_log_container{padding-right:20px}.wfu_entity_cell{text-align:center}.wfu_log_level_1{padding-left:0}.wfu_log_level_2{padding-left:20px}.wfu_log_level_3{padding-left:40px}.wfu_logactions_table td:nth-child(n+2),.wfu_logactions_table tr:nth-child(2) th{border-left:1px solid rgba(0,0,0,.1)}.wfu_log_row:hover{background-color:rgba(0,0,0,.1)}.wfu_log_button{color:#777;border:1px solid gray;position:relative}.wfu_log_button:after{content:'+';position:absolute;left:0;right:0;top:-.75ex;bottom:0;margin:auto}.wfu_log_button:hover{color:#000}.wfu_log_button.expanded:after{content:'-'}input[type=checkbox].wfu_entity_selector{-webkit-appearance:checkbox;margin:0}.wfu_pdusers_topmost_panel{margin-top:20px;margin-left:40px}.wfu_pdusers_topmost_panel>label{display:block;font-size:larger;font-weight:700}.wfu_pdusers_rolepanel,.wfu_pdusers_userpanel{margin-top:20px;margin-bottom:20px}.wfu_pdusers_roles_container,.wfu_pdusers_users_container{display:inline-block}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_roles_midpanel,.wfu_pdusers_roles_rightpanel,.wfu_pdusers_users_leftpanel,.wfu_pdusers_users_midpanel,.wfu_pdusers_users_rightpanel{display:table-cell;position:relative}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_roles_rightpanel{height:200px;min-width:100px}.wfu_pdusers_users_leftpanel,.wfu_pdusers_users_rightpanel{height:100px;min-width:100px}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_users_leftpanel{padding:10px 10px 10px 0}.wfu_pdusers_roles_midpanel,.wfu_pdusers_users_midpanel{padding:10px 0;vertical-align:top}.wfu_pdusers_roles_rightpanel,.wfu_pdusers_users_rightpanel{padding:20px;vertical-align:top}.wfu_pdusers_roles_container>label,.wfu_pdusers_users_container>label{font-weight:700}.wfu_pdusers_users_leftpanel label{display:block}.wfu_pdusers_users_midpanel label,.wfu_pdusers_users_rightpanel label{display:block;visibility:hidden}.wfu_pdusers_users_leftpanel input[type=text]{width:100%;display:block}.wfu_pdusers_roles_leftpanel select{height:100%!important;line-height:100%!important}.wfu_pdusers_roles_leftpanel select,.wfu_pdusers_users_leftpanel select{min-width:100px;min-height:100px}.wfu_pdusers_roles_show,.wfu_pdusers_users_show{overflow-x:visible;overflow-y:scroll;height:100%}.wfu_pdusers_roles_back,.wfu_pdusers_users_back{border:1px solid gray;position:absolute;left:10px;top:10px;bottom:10px;right:10px;pointer-events:none},.wfu_pdusers_roles_back.active{background-color:rgba(255,255,255,.7)}.wfu_pdusers_roles_role,.wfu_pdusers_users_user{border:1px solid gray;text-align:center;padding:2px 24px 2px 4px;border-radius:1em;cursor:default;background-color:rgba(0,0,0,.05);position:relative;display:inline-block;white-space:nowrap}.wfu_pdusers_roles_all{text-align:center;padding:2px 20px;font-weight:700}.wfu_pdusers_roles_role span,.wfu_pdusers_users_user span{width:14px;height:14px;position:absolute;display:inline-block;right:3px;top:0;bottom:0;margin:auto;border:1px solid #888;border-radius:1em}.wfu_pdusers_roles_role span:after,.wfu_pdusers_roles_role span:before,.wfu_pdusers_users_user span:after,.wfu_pdusers_users_user span:before{content:'';height:1px;margin-top:0;position:absolute;width:10px;top:50%;right:2px;background:#888}.wfu_pdusers_roles_role span:before,.wfu_pdusers_users_user span:before{transform:rotate(45deg)}.wfu_pdusers_roles_role span:after,.wfu_pdusers_users_user span:after{transform:rotate(-45deg)}.wfu_pdusers_roles_role span:hover,.wfu_pdusers_users_user span:hover{background-color:rgba(0,0,0,.1);border:1px solid #1ebcc5}.wfu_pdusers_roles_role span:hover:after,.wfu_pdusers_roles_role span:hover:before,.wfu_pdusers_users_user span:hover:after,.wfu_pdusers_users_user span:hover:before{background:#1ebcc5}.wfu_pdusers_roles_add,.wfu_pdusers_users_add{width:20px;height:18px;display:inline-block;border:1px solid #888;border-radius:4px}.wfu_pdusers_roles_add:after,.wfu_pdusers_users_add:after{border:solid #555;border-width:0 3px 3px 0;display:inline-block;padding:3px;vertical-align:middle;transform:rotate(-45deg);content:'';margin-left:4px;margin-top:-2px}.wfu_pdusers_roles_add:hover,.wfu_pdusers_users_add:hover{border:1px solid #444;background-color:rgba(0,0,0,.1)}.wfu_pd_user_box0{width:100%}.wfu_pd_user_select0,.wfu_pdusers_users_leftpanel select{width:100%;height:100px!important;line-height:100px!important;min-width:100px;min-height:100px}
1
+ div.wfu_help_container,div.wfu_restore_container,div.wfu_shortcode_container,div.wfu_td_div{background:0 0;border:none;padding:0;position:relative}select.wfu_variable,span.wfu_variable{font-size:smaller;color:#333;-webkit-touch-callout:none;-khtml-user-select:none;cursor:default}.wfu_conquestions_optable,.wfu_logactions_table,.wfu_permissions_table{border-collapse:collapse}.wfu_cleanlog_proceed.disabled,.wfu_frozen{pointer-events:none}div.wfu_shortcode_container{display:inline-block;width:50%;margin:0}div.wfu_container input.wfu_long_text,textarea.wfu_shortcode{width:100%}div.wfu_container{margin-top:10px}div.wfu_help_container{display:inline-block;top:4px;margin:0}div.wfu_help_container img{visibility:hidden}table.wfu_inner_table th:hover div.wfu_help_container img,table.wfu_main_table th:hover div.wfu_help_container img{visibility:visible}div.wfu_restore_container{display:inline-block;top:4px;margin:0}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%;margin:0}div.wfu_container input.wfu_short_text{width:60px}div.wfu_container input{width:200px}div.wfu_container input[type=checkbox]{width:auto}div.wfu_container textarea{width:100%}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}select.wfu_variable,span.wfu_variable,table.wfu_main_table tr.wfu_subcategory{background-color:#ddd}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>th{padding-top:0;padding-bottom:0}select.wfu_variable{padding:0;margin:0;height:auto;border:1px solid #ccc;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}span.wfu_variable{padding:1px;margin:0;border:1px solid #ccc;-webkit-border-radius:5px;-moz-border-radius:5px;-khtml-border-radius:5px;border-radius:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}div.wfu_date_container{display:inline-block;position:relative;width:auto;height:100%;padding:0;margin:0;background:0 0;border:none}.wfu_datereset_button{position:absolute;right:4px;top:0;bottom:0;margin:auto 0;opacity:.5}.wfu_datereset_button:hover{opacity:1}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{background:0 0;margin:0;padding:0;border:none}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{width:100%;padding:0;margin: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_stringmatch_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_stringmatch_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;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;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_component_box_inner{display:table;width:100%;height:100%}div.wfu_component_box_label{display:table-cell;text-align:center;vertical-align:middle}div.wfu_component_box_index{background-color:coral;padding:1px;float:right;border-radius:10px}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;z-index:1;cursor:default}div.wfu_component_box_dragged{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);-moz-opacity:.4;-khtml-opacity:.4;opacity:.4}div.wfu_component_separator_ver{display:inline-block;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{background-color:silver;border:none;display:none;position:absolute}div.wfu_component_bar_hor{width:auto;height:4px;left:10px;right:0;margin:11px 0 0;padding:0}div.wfu_component_bar_ver{width:4px;height:40px;margin:-6px 0 0 11px;padding:0}div.wfu_componentlist_dragdrop{position:absolute;width:100%;height:100%;left:0;top:0;background-color:#f8f8f8;border:4px dashed #aaa;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;z-index:2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70);-moz-opacity:.7;-khtml-opacity:.7;opacity:.7}div.wfu_componentlist_dragdrop_dragover{border:4px dashed #555}div.wfu_formdata_container,div.wfu_userdata_container{display:block;position:relative;width:100%;height:100%;padding:0;margin:0;background:0 0;border:none}label.wfu_formdata_label{margin-right:6px}.wfu_formdata_props{padding-left:20px}div.wfu_formdata_action,div.wfu_userdata_action{display:inline-block;position:relative;top:2px;width:16px;height:16px;padding:0;margin:0;background:0 0;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_formdata_action:hover,div.wfu_userdata_action:hover{border:1px solid #aaa}div.wfu_formdata_action.wfu_formdata_action_disabled:hover,div.wfu_userdata_action.wfu_userdata_action_disabled:hover{border:1px solid transparent}div.wfu_formdata_action>img,div.wfu_userdata_action>img{width:12px;height:12px}div.wfu_formdata_action_disabled>img,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_formdata_line_container,div.wfu_userdata_line{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap}table.wfu_formdata_props_table{background:0 0;border:none;padding:0}table.wfu_formdata_props_table td,table.wfu_main_table table.wfu_inner_table table.wfu_formdata_props_table td{background:0 0;border:none;padding:0;width:auto}table.wfu_formdata_props_table td.wfu_formdata_props,table.wfu_main_table table.wfu_inner_table table.wfu_formdata_props_table td.wfu_formdata_props{padding-left:20px}div.wfu_color_container{display:block;position:relative;padding:0;margin:0;background:0 0;border:none;white-space:nowrap;z-index:1}span.wfu_save_label,span.wfu_save_label_fail{border-radius:6px;padding:1px 2px;box-shadow:1px 1px 1px;opacity:0;font-size:smaller}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}.wfu_conquestion_itemcontainer,.wfu_conquestions_opsel.wfu_forced_selection{opacity:.5}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}.wfu_buttons_container .button,.wfu_buttons_container .wfu_cleanlog_error,.wfu_includefiles_container input[type=checkbox],.wfu_includefiles_container label,.wfu_pdheader_button,.wfu_selectdate_container input[type=text],.wfu_selectdate_container label,.wfu_selectdates_container input[type=text],.wfu_selectdates_container label,.wfu_selectperiod_container input[type=number],.wfu_selectperiod_container label,.wfu_selectperiod_container select{vertical-align:middle}table.wfu_main_table table.wfu_columnprops_container{border:none;background:0 0;margin:0;padding:6px;border-spacing:0;width:100%;box-shadow:0 0 1px #aaa}table.wfu_main_table table.wfu_columnprops_container tr{background:0 0}table.wfu_main_table table.wfu_columnprops_container td{border:none;background:0 0;margin:0;padding:0;vertical-align:middle;width:auto}table.wfu_main_table table.wfu_columnprops_container label.wfu_columnprops_label_disabled,table.wfu_main_table table.wfu_columnprops_container_disabled label{color:#ccc}button.wfu_columns_addbutton{font-size:smaller}option.wfu_columns_item_required{color:gray}@font-face{font-family:wfu-icons;src:url(../images/fonts/wfu-icons.eot?xnqdfz);src:url(../images/fonts/wfu-icons.eot?xnqdfz#iefix) format('embedded-opentype'),url(../images/fonts/wfu-icons.ttf?xnqdfz) format('truetype'),url(../images/fonts/wfu-icons.woff?xnqdfz) format('woff'),url(../images/fonts/wfu-icons.svg?xnqdfz#wfu-icons) format('svg');font-weight:400;font-style:normal}.wfu-dashicons-media-external:before{font-family:wfu-icons;content:"\e900"}.wfu-dashicons-ftp:before{font-family:wfu-icons;content:"\e901"}.wfu-uploadedfiles .wfu-dashicons-after{margin-left:4px}.wfu-uploadedfiles .wfu-dashicons-hidden{display:none}.wfu-uploadedfiles .wfu-properties.wfu-clicked,.wfu-uploadedfiles .wfu-properties:hover{color:#00f}.wfu-uploadedfiles .wfu_unread{box-shadow:4px 0 0 inset #0f0;font-weight:700}.wfu-uploadedfiles .wfu-remarks-container:before{content:'-';width:0;display:inline-block;overflow:hidden}.wfu_cleanlog_error.hidden,.wfu_cleanlog_tr,.wfu_consent_logactions,.wfu_consent_operations,.wfu_consent_permissions,.wfu_consent_questions,.wfu_consent_users,.wfu_plugin_operations,.wfu_selectdate_container,.wfu_selectdates_container,.wfu_selectperiod_container{display:none}.wfu-adminbrowser .wfu-highlighted,.wfu-historylog .wfu-highlighted{box-shadow:0 -1000px 0 inset rgba(0,255,0,.2)}.wfu_cleanlog_tr td{margin-top:0;padding-top:0}.wfu_buttons_container,.wfu_includefiles_container,.wfu_selectdate_container,.wfu_selectdates_container,.wfu_selectperiod_container{margin-top:10px}.wfu_selectdate_container input[type=text],.wfu_selectdates_container input[type=text]{width:8em;text-align:center}.wfu_selectperiod_container input[type=number]{width:4em}.wfu_includefiles_container label{font-size:80%;opacity:.5}.wfu_includefiles_container input[type=checkbox]{transform:scale(.8,.8)}.wfu_cleanlog_error{color:red;font-size:small}.wfu_cleanlog_error:before{content:'!';font-weight:700;margin-right:2px}.wfu_conop_header,.wfu_pdop_header{transition:.4s;padding:6px}.wfu_conop_header label,.wfu_pdop_header label{font-weight:700;cursor:default}.wfu_conop_button,.wfu_pdheader_button,.wfu_pdop_button{color:#777;width:1em;height:1em;cursor:pointer;text-align:center}.wfu_conop_header.atomic label,.wfu_pdop_header.atomic label{font-weight:400}.wfu_pdheader_button{padding:2px;border:1px solid gray;border-radius:1em;position:relative;display:inline-block;font-size:smaller}.wfu_pdheader_button:after{content:'\02795';position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}.wfu_conop_panel,.wfu_conop_topmost_panel,.wfu_pdop_panel,.wfu_pdop_topmost_panel{margin-left:40px;overflow:hidden}.wfu_pdheader_button.expanded:after{content:'\02796'}.wfu_conop_panel,.wfu_pdop_panel{display:none}.wfu_conop_level_1,.wfu_pdop_level_1{padding:10px;font-size:larger}.wfu_conop_level_2,.wfu_pdop_level_2{padding:6px;font-size:smaller}.wfu_conop_level_3,.wfu_conop_level_4,.wfu_conop_level_5,.wfu_pdop_level_3,.wfu_pdop_level_4,.wfu_pdop_level_5{padding:2px}.wfu_conop_header:hover,.wfu_pdop_header:hover{background-color:rgba(0,0,0,.2)}.wfu_conop_button,.wfu_pdop_button{float:right;padding:2px;border:1px solid gray;border-radius:4px;position:relative;display:none}.wfu_conop_button:after,.wfu_pdop_button:after{content:'\02795';position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;font-size:smaller}.wfu_conop_button.expanded:after,.wfu_pdop_button.expanded:after{content:'\02796'}.wfu_conop_header:hover .wfu_conop_button,.wfu_pdop_header:hover .wfu_pdop_button{display:block}input[type=checkbox].wfu_conop_selector,input[type=checkbox].wfu_pdop_selector{-webkit-appearance:checkbox;margin:0 0 0 4px}.wfu_conquestions_operations{margin-top:20px;margin-left:40px}.wfu_conquestions_operations label{display:block;font-size:larger;font-weight:700}.wfu_conquestions_oppanel{background-color:#fff;padding:10px;display:inline-block;margin-top:10px}.wfu_conquestions_optable tbody tr:hover{background-color:rgba(0,0,0,.1)}.wfu_conquestions_optable td{cursor:default}.wfu_conquestions_optable td:not(:first-child){text-align:center}.wfu_op_unassigned{background-color:#ffdb99}.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover{background-color:#e6c58a}.wfu_op_unassigned .wfu_conquestions_opinv,.wfu_op_unassigned .wfu_conquestions_opsel{background-color:#ffdb99}.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover .wfu_conquestions_opinv,.wfu_conquestions_optable tbody tr.wfu_op_unassigned:hover .wfu_conquestions_opsel{background-color:#e6c58a}.wfu_conquestions_container{margin-top:20px;margin-left:40px}.wfu_conquestion_header{font-size:larger}.wfu_conquestion_subcontainer{padding:10px}.wfu_conquestion_headerlabel{font-weight:700}.wfu_conquestion_tools{float:right}.wfu_conquestion_itemprops,.wfu_conquestion_itemspreview,.wfu_conquestion_mainprops{display:table-cell;position:relative;border:1px solid silver;padding:4ex 10px 10px;vertical-align:top;min-width:10em;min-height:4ex;resize:both;overflow:auto}.wfu_conquestion_itempropstitle,.wfu_conquestion_itemspreviewtitle,.wfu_conquestion_mainpropstitle{position:absolute;top:0;left:0;height:3ex;font-size:inherit;text-align:center;width:100%;background-color:rgba(0,0,0,.1)}.wfu_conquestion_displayedtitle,.wfu_conquestion_groupedlabel,.wfu_conquestion_labellabel,.wfu_conquestion_labellocationlabel,.wfu_conquestion_matrixlabel,.wfu_conquestion_preselectedlabel,.wfu_conquestion_titlelabel,.wfu_conquestion_titlelocationlabel,.wfu_conquestion_typelabel,.wfu_conquestion_visiblelabel{display:block}.wfu_conquestion_labeltext,.wfu_conquestion_titletext{width:100%}.wfu_conquestion_matrix_x,.wfu_conquestion_matrix_y{width:4em;text-align:center}.wfu_conquestion_matrixsep{width:1em;display:inline-block;text-align:center}.wfu_empty_label{font-style:italic}.wfu_conquestion_itemtable td:hover{background-color:rgba(0,0,0,.1)}.wfu_item_selected{background-color:rgba(0,0,0,.2)}.wfu_item_assigned{color:#00f}.wfu_item_visible{opacity:1}.wfu_conquestion_btn{display:inline-block;position:relative;width:16px;height:16px;padding:0;margin:0;background:0 0;text-align:center;border:1px solid transparent;-webkit-border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;border-radius:3px}div.wfu_conquestion_btn:hover{border:1px solid #aaa}.wfu_conquestion_btn>img{width:12px;height:12px;position:absolute;top:0;left:0;right:0;bottom:0;margin:auto}.wfu_log_button,.wfu_perm_button{width:1.5ex;height:1.5ex;cursor:pointer;display:inline-block;vertical-align:middle;text-align:center}div.wfu_conquestion_btn.wfu_tool_disabled:hover{border:1px solid transparent}.wfu_conquestion_btn.wfu_tool_disabled>img{opacity:.4}.wfu_permissions_topmost_panel{margin-left:40px}.wfu_permissions_panel{background-color:#fff;padding:10px;display:inline-block;margin-top:20px}.wfu_perm_container{padding-right:20px}.wfu_location_cell{text-align:center}.wfu_perm_level_1{padding-left:0}.wfu_perm_level_2{padding-left:20px}.wfu_perm_level_3{padding-left:40px}.wfu_permissions_table td:nth-child(n+2),.wfu_permissions_table tr:nth-child(2) th{border-left:1px solid rgba(0,0,0,.1)}.wfu_perm_row:hover{background-color:rgba(0,0,0,.1)}.wfu_perm_button{color:#777;border:1px solid gray;position:relative}.wfu_perm_button:after{content:'+';position:absolute;left:0;right:0;top:-.75ex;bottom:0;margin:auto}.wfu_perm_button:hover{color:#000}.wfu_perm_button.expanded:after{content:'-'}input[type=checkbox].wfu_location_selector{-webkit-appearance:checkbox;margin:0}.wfu_logactions_topmost_panel{margin-left:40px}.wfu_logactions_panel{background-color:#fff;padding:10px;display:inline-block;margin-top:20px}.wfu_log_container{padding-right:20px}.wfu_entity_cell{text-align:center}.wfu_log_level_1{padding-left:0}.wfu_log_level_2{padding-left:20px}.wfu_log_level_3{padding-left:40px}.wfu_logactions_table td:nth-child(n+2),.wfu_logactions_table tr:nth-child(2) th{border-left:1px solid rgba(0,0,0,.1)}.wfu_log_row:hover{background-color:rgba(0,0,0,.1)}.wfu_log_button{color:#777;border:1px solid gray;position:relative}.wfu_log_button:after{content:'+';position:absolute;left:0;right:0;top:-.75ex;bottom:0;margin:auto}.wfu_log_button:hover{color:#000}.wfu_log_button.expanded:after{content:'-'}input[type=checkbox].wfu_entity_selector{-webkit-appearance:checkbox;margin:0}.wfu_pdusers_topmost_panel{margin-top:20px;margin-left:40px}.wfu_pdusers_topmost_panel>label{display:block;font-size:larger;font-weight:700}.wfu_pdusers_rolepanel,.wfu_pdusers_userpanel{margin-top:20px;margin-bottom:20px}.wfu_pdusers_roles_container,.wfu_pdusers_users_container{display:inline-block}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_roles_midpanel,.wfu_pdusers_roles_rightpanel,.wfu_pdusers_users_leftpanel,.wfu_pdusers_users_midpanel,.wfu_pdusers_users_rightpanel{display:table-cell;position:relative}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_roles_rightpanel{height:200px;min-width:100px}.wfu_pdusers_users_leftpanel,.wfu_pdusers_users_rightpanel{height:100px;min-width:100px}.wfu_pdusers_roles_leftpanel,.wfu_pdusers_users_leftpanel{padding:10px 10px 10px 0}.wfu_pdusers_roles_midpanel,.wfu_pdusers_users_midpanel{padding:10px 0;vertical-align:top}.wfu_pdusers_roles_rightpanel,.wfu_pdusers_users_rightpanel{padding:20px;vertical-align:top}.wfu_pdusers_roles_container>label,.wfu_pdusers_users_container>label{font-weight:700}.wfu_pdusers_users_leftpanel label{display:block}.wfu_pdusers_users_midpanel label,.wfu_pdusers_users_rightpanel label{display:block;visibility:hidden}.wfu_pdusers_users_leftpanel input[type=text]{width:100%;display:block}.wfu_pdusers_roles_leftpanel select{height:100%!important;line-height:100%!important}.wfu_pdusers_roles_leftpanel select,.wfu_pdusers_users_leftpanel select{min-width:100px;min-height:100px}.wfu_pdusers_roles_show,.wfu_pdusers_users_show{overflow-x:visible;overflow-y:scroll;height:100%}.wfu_pdusers_roles_back,.wfu_pdusers_users_back{border:1px solid gray;position:absolute;left:10px;top:10px;bottom:10px;right:10px;pointer-events:none},.wfu_pdusers_roles_back.active{background-color:rgba(255,255,255,.7)}.wfu_pdusers_roles_role,.wfu_pdusers_users_user{border:1px solid gray;text-align:center;padding:2px 24px 2px 4px;border-radius:1em;cursor:default;background-color:rgba(0,0,0,.05);position:relative;display:inline-block;white-space:nowrap}.wfu_pdusers_roles_all{text-align:center;padding:2px 20px;font-weight:700}.wfu_pdusers_roles_role span,.wfu_pdusers_users_user span{width:14px;height:14px;position:absolute;display:inline-block;right:3px;top:0;bottom:0;margin:auto;border:1px solid #888;border-radius:1em}.wfu_pdusers_roles_role span:after,.wfu_pdusers_roles_role span:before,.wfu_pdusers_users_user span:after,.wfu_pdusers_users_user span:before{content:'';height:1px;margin-top:0;position:absolute;width:10px;top:50%;right:2px;background:#888}.wfu_pdusers_roles_role span:before,.wfu_pdusers_users_user span:before{transform:rotate(45deg)}.wfu_pdusers_roles_role span:after,.wfu_pdusers_users_user span:after{transform:rotate(-45deg)}.wfu_pdusers_roles_role span:hover,.wfu_pdusers_users_user span:hover{background-color:rgba(0,0,0,.1);border:1px solid #1ebcc5}.wfu_pdusers_roles_role span:hover:after,.wfu_pdusers_roles_role span:hover:before,.wfu_pdusers_users_user span:hover:after,.wfu_pdusers_users_user span:hover:before{background:#1ebcc5}.wfu_pdusers_roles_add,.wfu_pdusers_users_add{width:20px;height:18px;display:inline-block;border:1px solid #888;border-radius:4px}.wfu_pdusers_roles_add:after,.wfu_pdusers_users_add:after{border:solid #555;border-width:0 3px 3px 0;display:inline-block;padding:3px;vertical-align:middle;transform:rotate(-45deg);content:'';margin-left:4px;margin-top:-2px}.wfu_pdusers_roles_add:hover,.wfu_pdusers_users_add:hover{border:1px solid #444;background-color:rgba(0,0,0,.1)}.wfu_pd_user_box0{width:100%}.wfu_pd_user_select0,.wfu_pdusers_users_leftpanel select{width:100%;height:100px!important;line-height:100px!important;min-width:100px;min-height:100px}
js/wordpress_file_upload_adminfunctions.js CHANGED
@@ -291,11 +291,12 @@ function wfu_cleanlog_period_changed(){var sel=document.getElementById("wfu_clea
291
  1){document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display="block";document.querySelector(".wfu_selectdates_container").style.display="none";document.getElementById("wfu_cleanlog_periodold").value="1";document.getElementById("wfu_cleanlog_periodtype").selectedIndex=1;document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==2){document.querySelector(".wfu_selectdate_container").style.display=
292
  "none";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="block";document.getElementById("wfu_cleanlog_datefrom").value="";document.getElementById("wfu_cleanlog_dateto").value="";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==3){document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display=
293
  "none";document.querySelector(".wfu_selectdates_container").style.display="none";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else{document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="none";document.querySelector(".wfu_cleanlog_proceed").classList.add("disabled")}document.querySelector(".wfu_cleanlog_error").classList.add("hidden")}
294
- function wfu_cleanlog_selector_toggle(show){if(show){document.getElementById("wfu_cleanlog_period").selectedIndex=-1;wfu_cleanlog_period_changed();document.querySelector(".wfu_cleanlog_tr").style.display="table-row"}else document.querySelector(".wfu_cleanlog_tr").style.display="none"}
295
- function wfu_cleanlog_selector_validate(){var ret={error:"",param:""};var sel=document.getElementById("wfu_cleanlog_period");if(sel.selectedIndex==-1)ret.error="Invalid clean-up period selected";else if(sel.selectedIndex==0){var date=jQuery("#wfu_cleanlog_dateold").datepicker("getDate");if(date==null)ret.error="Invalid or empty date";else{var today=new Date;if(date>today)ret.error="Date must be older than today";else{var timelimit=jQuery.datepicker.formatDate("yymmdd",date);ret.param="0:"+timelimit.toString()}}}else if(sel.selectedIndex==
296
- 1){var inp=document.getElementById("wfu_cleanlog_periodold");var sel2=document.getElementById("wfu_cleanlog_periodtype");if(parseInt(inp.value)<=0)ret.error="Invalid period";else if(sel2.selectedIndex<0||sel2.selectedIndex>2)ret.error="Invalid period interval";else ret.param="1:"+inp.value.toString()+":"+sel2.value.substr(0,1)}else if(sel.selectedIndex==2){var datefrom=jQuery("#wfu_cleanlog_datefrom").datepicker("getDate");var dateto=jQuery("#wfu_cleanlog_dateto").datepicker("getDate");if(datefrom==
297
- null)ret.error="Invalid or empty starting date";else if(dateto==null)ret.error="Invalid or empty ending date";else{var today=new Date;if(datefrom>today)ret.error="Starting date must be older than today";else if(dateto>datefrom)ret.error="Ending date must be older or equal to starting date";else{var fromlimit=jQuery.datepicker.formatDate("yymmdd",datefrom);var tolimit=jQuery.datepicker.formatDate("yymmdd",dateto);ret.param="2:"+fromlimit.toString()+":"+tolimit.toString()}}}else if(sel.selectedIndex==
298
- 3)ret.param="3";return ret}function wfu_cleanlog_selector_checkproceed(){var ret=wfu_cleanlog_selector_validate();if(ret.error!=""){document.querySelector(".wfu_cleanlog_error").innerHTML=ret.error;document.querySelector(".wfu_cleanlog_error").classList.remove("hidden");return false}document.querySelector(".wfu_cleanlog_error").classList.add("hidden");document.querySelector(".wfu_cleanlog_proceed").href=document.getElementById("wfu_cleanlog_href").value+"&data="+ret.param;return true}
 
299
  function wfu_initialize_consent_policy(params){wfu_PD_bank.params=params;wfu_adjust_pdops_levels();wfu_adjust_permissions_levels();wfu_adjust_logactions_levels();wfu_attach_pdheaders_events();wfu_attach_pdops_events();wfu_attach_conops_events();wfu_pdops_update(true);wfu_allops_freeze_events=true;wfu_conops_update();wfu_consent_question_optable_recreate();wfu_update_consent_questions();wfu_consent_question_operations_reassign();wfu_update_consent_question_itemprops(0,-1);wfu_permissions_update(true);
300
  wfu_logactions_update(true);wfu_pdusers_update();wfu_allops_freeze_events=false}function wfu_get_consent_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_consent_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}function wfu_get_permissions_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_permissions_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}
301
  function wfu_get_logactions_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_logactions_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}function wfu_get_pd_users(){var pd_users_str=wfu_plugin_decode_string(document.getElementById("wfu_assigned_users").value);var pd_users=null;try{pd_users=JSON.parse(pd_users_str)}catch(e){}return pd_users}
291
  1){document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display="block";document.querySelector(".wfu_selectdates_container").style.display="none";document.getElementById("wfu_cleanlog_periodold").value="1";document.getElementById("wfu_cleanlog_periodtype").selectedIndex=1;document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==2){document.querySelector(".wfu_selectdate_container").style.display=
292
  "none";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="block";document.getElementById("wfu_cleanlog_datefrom").value="";document.getElementById("wfu_cleanlog_dateto").value="";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else if(sel.selectedIndex==3){document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display=
293
  "none";document.querySelector(".wfu_selectdates_container").style.display="none";document.querySelector(".wfu_cleanlog_proceed").classList.remove("disabled")}else{document.querySelector(".wfu_selectdate_container").style.display="none";document.querySelector(".wfu_selectperiod_container").style.display="none";document.querySelector(".wfu_selectdates_container").style.display="none";document.querySelector(".wfu_cleanlog_proceed").classList.add("disabled")}document.querySelector(".wfu_cleanlog_error").classList.add("hidden")}
294
+ function wfu_cleanlog_selector_toggle(show){if(show){document.getElementById("wfu_includefiles").checked=false;document.getElementById("wfu_cleanlog_period").selectedIndex=-1;wfu_cleanlog_period_changed();document.querySelector(".wfu_cleanlog_tr").style.display="table-row"}else document.querySelector(".wfu_cleanlog_tr").style.display="none"}
295
+ function wfu_cleanlog_selector_validate(){var ret={error:"",param:""};var flag=document.getElementById("wfu_includefiles").checked?"1":"0";var sel=document.getElementById("wfu_cleanlog_period");if(sel.selectedIndex==-1)ret.error="Invalid clean-up period selected";else if(sel.selectedIndex==0){var date=jQuery("#wfu_cleanlog_dateold").datepicker("getDate");if(date==null)ret.error="Invalid or empty date";else{var today=new Date;if(date>today)ret.error="Date must be older than today";else{var timelimit=
296
+ jQuery.datepicker.formatDate("yymmdd",date);ret.param="0"+flag+":"+timelimit.toString()}}}else if(sel.selectedIndex==1){var inp=document.getElementById("wfu_cleanlog_periodold");var sel2=document.getElementById("wfu_cleanlog_periodtype");if(parseInt(inp.value)<=0)ret.error="Invalid period";else if(sel2.selectedIndex<0||sel2.selectedIndex>2)ret.error="Invalid period interval";else ret.param="1"+flag+":"+inp.value.toString()+":"+sel2.value.substr(0,1)}else if(sel.selectedIndex==2){var datefrom=jQuery("#wfu_cleanlog_datefrom").datepicker("getDate");
297
+ var dateto=jQuery("#wfu_cleanlog_dateto").datepicker("getDate");if(datefrom==null)ret.error="Invalid or empty starting date";else if(dateto==null)ret.error="Invalid or empty ending date";else{var today=new Date;if(datefrom>today)ret.error="Starting date must be older than today";else if(dateto>datefrom)ret.error="Ending date must be older or equal to starting date";else{var fromlimit=jQuery.datepicker.formatDate("yymmdd",datefrom);var tolimit=jQuery.datepicker.formatDate("yymmdd",dateto);ret.param=
298
+ "2"+flag+":"+fromlimit.toString()+":"+tolimit.toString()}}}else if(sel.selectedIndex==3)ret.param="3"+flag;return ret}
299
+ function wfu_cleanlog_selector_checkproceed(){var ret=wfu_cleanlog_selector_validate();if(ret.error!=""){document.querySelector(".wfu_cleanlog_error").innerHTML=ret.error;document.querySelector(".wfu_cleanlog_error").classList.remove("hidden");return false}document.querySelector(".wfu_cleanlog_error").classList.add("hidden");document.querySelector(".wfu_cleanlog_proceed").href=document.getElementById("wfu_cleanlog_href").value+"&data="+ret.param;return true}
300
  function wfu_initialize_consent_policy(params){wfu_PD_bank.params=params;wfu_adjust_pdops_levels();wfu_adjust_permissions_levels();wfu_adjust_logactions_levels();wfu_attach_pdheaders_events();wfu_attach_pdops_events();wfu_attach_conops_events();wfu_pdops_update(true);wfu_allops_freeze_events=true;wfu_conops_update();wfu_consent_question_optable_recreate();wfu_update_consent_questions();wfu_consent_question_operations_reassign();wfu_update_consent_question_itemprops(0,-1);wfu_permissions_update(true);
301
  wfu_logactions_update(true);wfu_pdusers_update();wfu_allops_freeze_events=false}function wfu_get_consent_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_consent_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}function wfu_get_permissions_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_permissions_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}
302
  function wfu_get_logactions_policy(){var policy_str=wfu_plugin_decode_string(document.getElementById("wfu_logactions_policy").value);var policy=null;try{policy=JSON.parse(policy_str)}catch(e){}return policy}function wfu_get_pd_users(){var pd_users_str=wfu_plugin_decode_string(document.getElementById("wfu_assigned_users").value);var pd_users=null;try{pd_users=JSON.parse(pd_users_str)}catch(e){}return pd_users}
lib/wfu_admin.php CHANGED
@@ -358,8 +358,16 @@ function wordpress_file_upload_manage_dashboard() {
358
  }
359
  elseif ( $action == 'clean_log' ) {
360
  $ret = wfu_clean_log();
361
- if ( $ret <= -1 ) $echo_str = wfu_maintenance_actions();
362
- else $echo_str = wfu_maintenance_actions('Database cleaned. '.$ret.' items where affected.');
 
 
 
 
 
 
 
 
363
  }
364
  elseif ( $action == 'reset_all_transfers' && $nonce != "" ) {
365
  if ( wfu_reset_all_transfers_controller($nonce) === true )
358
  }
359
  elseif ( $action == 'clean_log' ) {
360
  $ret = wfu_clean_log();
361
+ if ( $ret["recs_count"] <= -1 && $ret["files_count"] ) $echo_str = wfu_maintenance_actions();
362
+ else $echo_str = wfu_maintenance_actions('Database cleaned. '.$ret["recs_count"].' records and '.$ret["files_count"].' files where deleted.');
363
+ }
364
+ elseif ( $action == 'purge_data_ask' && $nonce != "" ) {
365
+ $echo_str = wfu_purge_data_prompt($nonce);
366
+ }
367
+ elseif ( $action == 'purge_data' ) {
368
+ $ret = wfu_purge_data();
369
+ if ( !$ret ) $echo_str = wfu_maintenance_actions();
370
+ else $echo_str = '<script type="text/javascript">window.location.replace("'.admin_url('plugins.php').'");</script>';
371
  }
372
  elseif ( $action == 'reset_all_transfers' && $nonce != "" ) {
373
  if ( wfu_reset_all_transfers_controller($nonce) === true )
lib/wfu_admin_maintenance.php CHANGED
@@ -32,7 +32,7 @@ function wfu_maintenance_actions($message = '') {
32
  $echo_str .= "\n\t\t\t\t\t\t".'<a href="" class="button" title="Clean database log" onclick="wfu_cleanlog_selector_toggle(true); return false;">Clean Log</a>';
33
  $echo_str .= "\n\t\t\t\t\t".'</th>';
34
  $echo_str .= "\n\t\t\t\t\t".'<td>';
35
- $echo_str .= "\n\t\t\t\t\t\t".'<label>Clean-up database log, either all or of specific period, including file information and user data (files will not be affected).</label>';
36
  $echo_str .= "\n\t\t\t\t\t".'</td>';
37
  $echo_str .= "\n\t\t\t\t".'</tr>';
38
  $echo_str .= "\n\t\t\t\t".'<tr class="wfu_cleanlog_tr">';
@@ -65,6 +65,10 @@ function wfu_maintenance_actions($message = '') {
65
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<label>back to</label>';
66
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<input id="wfu_cleanlog_dateto" type="text" />';
67
  $echo_str .= "\n\t\t\t\t\t\t\t".'</div>';
 
 
 
 
68
  $echo_str .= "\n\t\t\t\t\t\t\t".'<div class="wfu_buttons_container">';
69
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="" class="button" title="Close" onclick="wfu_cleanlog_selector_toggle(false); return false;">Close</a>';
70
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="" class="button wfu_cleanlog_proceed" title="Proceed to log clean-up" onclick="if (wfu_cleanlog_selector_checkproceed()) return true; else return false; ">Proceed</a>';
@@ -74,6 +78,14 @@ function wfu_maintenance_actions($message = '') {
74
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
75
  $echo_str .= "\n\t\t\t\t\t".'</td>';
76
  $echo_str .= "\n\t\t\t\t".'</tr>';
 
 
 
 
 
 
 
 
77
  $echo_str .= "\n\t\t\t".'</tbody>';
78
  $echo_str .= "\n\t\t".'</table>';
79
  $echo_str .= "\n\t".'</div>';
@@ -114,16 +126,18 @@ function wfu_clean_log_parse_data($data) {
114
  $data = sanitize_text_field($data);
115
  $data_array = explode(":", $data);
116
  if ( count($data_array) == 0 ) $ret["result"] = false;
117
- elseif ( $data_array[0] == "0" ) {
118
  $ret["code"] = "0";
 
119
  if ( count($data_array) != 2 || strlen($data_array[1]) != 8 ) $ret["result"] = false;
120
  else {
121
  $ret["dateold"] = strtotime(substr($data_array[1], 0, 4)."-".substr($data_array[1], 4, 2)."-".substr($data_array[1], 6, 2)." 00:00");
122
  if ( $ret["dateold"] > time() ) $ret["result"] = false;
123
  }
124
  }
125
- elseif ( $data_array[0] == "1" ) {
126
  $ret["code"] = "1";
 
127
  if ( count($data_array) != 3 ) $ret["result"] = false;
128
  else {
129
  $ret["periodold"] = (int)$data_array[1];
@@ -134,8 +148,9 @@ function wfu_clean_log_parse_data($data) {
134
  else $ret["result"] = false;
135
  }
136
  }
137
- elseif ( $data_array[0] == "2" ) {
138
  $ret["code"] = "2";
 
139
  if ( count($data_array) != 3 || strlen($data_array[1]) != 8 || strlen($data_array[2]) != 8 ) $ret["result"] = false;
140
  $ret["datefrom"] = strtotime(substr($data_array[1], 0, 4)."-".substr($data_array[1], 4, 2)."-".substr($data_array[1], 6, 2)." 00:00");
141
  if ( $ret["datefrom"] > time() ) $ret["result"] = false;
@@ -144,8 +159,9 @@ function wfu_clean_log_parse_data($data) {
144
  if ( $ret["dateto"] > $ret["datefrom"] ) $ret["result"] = false;
145
  }
146
  }
147
- elseif ( $data_array[0] == "3" ) {
148
  $ret["code"] = "3";
 
149
  if ( count($data_array) != 1 ) $ret["result"] = false;
150
  }
151
  else $ret["result"] = false;
@@ -153,7 +169,21 @@ function wfu_clean_log_parse_data($data) {
153
  return $ret;
154
  }
155
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  function wfu_clean_log_prompt($nonce, $data_enc) {
 
 
157
  $siteurl = site_url();
158
 
159
  if ( !current_user_can( 'manage_options' ) || !wp_verify_nonce($nonce, 'wfu_maintenance_actions') ) return wfu_maintenance_actions();
@@ -173,14 +203,48 @@ function wfu_clean_log_prompt($nonce, $data_enc) {
173
  $echo_str .= "\n\t\t".$nonce_ref;
174
  $echo_str .= "\n\t\t".'<input type="hidden" name="action" value="clean_log">';
175
  $echo_str .= "\n\t\t".'<input type="hidden" name="data" value="'.$data_enc.'">';
176
- if ( $data["code"] == "0" )
177
- $echo_str .= "\n\t\t".'<label>This will erase all database records <strong>before '.date("Y-m-d", $data["dateold"]).'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
178
- elseif ( $data["code"] == "1" )
179
- $echo_str .= "\n\t\t".'<label>This will erase all database records <strong>older than '.$data["periodold"].' '.$data["periodtype"].'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
180
- elseif ( $data["code"] == "2" )
181
- $echo_str .= "\n\t\t".'<label>This will erase all database records <strong>between '.date("Y-m-d", $data["datefrom"]).' and '.date("Y-m-d", $data["dateto"]).'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
182
- else
183
- $echo_str .= "\n\t\t".'<label>This will erase <strong>ALL</strong> database records kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  $echo_str .= "\n\t\t".'<p class="submit">';
185
  $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Yes">';
186
  $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Cancel">';
@@ -194,10 +258,10 @@ function wfu_clean_log() {
194
  $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
195
  global $wpdb;
196
 
197
- if ( !current_user_can( 'manage_options' ) ) return -1;
198
- if ( !check_admin_referer('wfu_clean_log') ) return -1;
199
 
200
- $count = -1;
201
  if ( isset($_POST['data']) && isset($_POST['submit']) && $_POST['submit'] == "Yes" ) {
202
  $data = wfu_clean_log_parse_data($_POST['data']);
203
  if ( $data["result"] ) {
@@ -205,6 +269,11 @@ function wfu_clean_log() {
205
  $table_name2 = $wpdb->prefix . "wfu_userdata";
206
  //$table_name3 = $wpdb->prefix . "wfu_dbxqueue";
207
 
 
 
 
 
 
208
  $query1 = "DELETE FROM $table_name1";
209
  $query2 = "DELETE FROM $table_name2";
210
  //$query3 = "DELETE FROM $table_name3";
@@ -221,13 +290,90 @@ function wfu_clean_log() {
221
  $query1 .= " WHERE date_from < '".date('Y-m-d H:i:s', $data["datefrom"] + 86400)."' AND date_from >= '".date('Y-m-d H:i:s', $data["dateto"])."'";
222
  $query2 .= " WHERE date_from < '".date('Y-m-d H:i:s', $data["datefrom"] + 86400)."' AND date_from >= '".date('Y-m-d H:i:s', $data["dateto"])."'";
223
  }
224
- $count = $wpdb->query($query1);
225
- $count += $wpdb->query($query2);
226
- //$count += $wpdb->query($query3);
 
 
 
 
 
 
 
227
  }
228
  }
229
 
230
- return $count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
 
233
 
32
  $echo_str .= "\n\t\t\t\t\t\t".'<a href="" class="button" title="Clean database log" onclick="wfu_cleanlog_selector_toggle(true); return false;">Clean Log</a>';
33
  $echo_str .= "\n\t\t\t\t\t".'</th>';
34
  $echo_str .= "\n\t\t\t\t\t".'<td>';
35
+ $echo_str .= "\n\t\t\t\t\t\t".'<label>Clean-up database log, either all or of specific period, including file information, user data and optionally the files.</label>';
36
  $echo_str .= "\n\t\t\t\t\t".'</td>';
37
  $echo_str .= "\n\t\t\t\t".'</tr>';
38
  $echo_str .= "\n\t\t\t\t".'<tr class="wfu_cleanlog_tr">';
65
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<label>back to</label>';
66
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<input id="wfu_cleanlog_dateto" type="text" />';
67
  $echo_str .= "\n\t\t\t\t\t\t\t".'</div>';
68
+ $echo_str .= "\n\t\t\t\t\t\t\t".'<div class="wfu_includefiles_container">';
69
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<label for="wfu_includefiles">Clean-up also affected files</label>';
70
+ $echo_str .= "\n\t\t\t\t\t\t\t\t".'<input id="wfu_includefiles" type="checkbox" />';
71
+ $echo_str .= "\n\t\t\t\t\t\t\t".'</div>';
72
  $echo_str .= "\n\t\t\t\t\t\t\t".'<div class="wfu_buttons_container">';
73
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="" class="button" title="Close" onclick="wfu_cleanlog_selector_toggle(false); return false;">Close</a>';
74
  $echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="" class="button wfu_cleanlog_proceed" title="Proceed to log clean-up" onclick="if (wfu_cleanlog_selector_checkproceed()) return true; else return false; ">Proceed</a>';
78
  $echo_str .= "\n\t\t\t\t\t\t".'</div>';
79
  $echo_str .= "\n\t\t\t\t\t".'</td>';
80
  $echo_str .= "\n\t\t\t\t".'</tr>';
81
+ $echo_str .= "\n\t\t\t\t".'<tr>';
82
+ $echo_str .= "\n\t\t\t\t\t".'<th scope="row">';
83
+ $echo_str .= "\n\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=purge_data_ask&amp;nonce='.$wfu_maintenance_nonce.'" class="button" title="Remove all plugin data from website" style="color:red;">Purge All Data</a>';
84
+ $echo_str .= "\n\t\t\t\t\t".'</th>';
85
+ $echo_str .= "\n\t\t\t\t\t".'<td>';
86
+ $echo_str .= "\n\t\t\t\t\t\t".'<label>Purge all plugin options and tables from database, as well as any session data. The plugin will be deactivated after this action.</label>';
87
+ $echo_str .= "\n\t\t\t\t\t".'</td>';
88
+ $echo_str .= "\n\t\t\t\t".'</tr>';
89
  $echo_str .= "\n\t\t\t".'</tbody>';
90
  $echo_str .= "\n\t\t".'</table>';
91
  $echo_str .= "\n\t".'</div>';
126
  $data = sanitize_text_field($data);
127
  $data_array = explode(":", $data);
128
  if ( count($data_array) == 0 ) $ret["result"] = false;
129
+ elseif ( $data_array[0] == "00" || $data_array[0] == "01" ) {
130
  $ret["code"] = "0";
131
+ $ret["include_files"] = ( substr($data_array[0], 1, 1) == "1" );
132
  if ( count($data_array) != 2 || strlen($data_array[1]) != 8 ) $ret["result"] = false;
133
  else {
134
  $ret["dateold"] = strtotime(substr($data_array[1], 0, 4)."-".substr($data_array[1], 4, 2)."-".substr($data_array[1], 6, 2)." 00:00");
135
  if ( $ret["dateold"] > time() ) $ret["result"] = false;
136
  }
137
  }
138
+ elseif ( $data_array[0] == "10" || $data_array[0] == "11" ) {
139
  $ret["code"] = "1";
140
+ $ret["include_files"] = ( substr($data_array[0], 1, 1) == "1" );
141
  if ( count($data_array) != 3 ) $ret["result"] = false;
142
  else {
143
  $ret["periodold"] = (int)$data_array[1];
148
  else $ret["result"] = false;
149
  }
150
  }
151
+ elseif ( $data_array[0] == "20" || $data_array[0] == "21" ) {
152
  $ret["code"] = "2";
153
+ $ret["include_files"] = ( substr($data_array[0], 1, 1) == "1" );
154
  if ( count($data_array) != 3 || strlen($data_array[1]) != 8 || strlen($data_array[2]) != 8 ) $ret["result"] = false;
155
  $ret["datefrom"] = strtotime(substr($data_array[1], 0, 4)."-".substr($data_array[1], 4, 2)."-".substr($data_array[1], 6, 2)." 00:00");
156
  if ( $ret["datefrom"] > time() ) $ret["result"] = false;
159
  if ( $ret["dateto"] > $ret["datefrom"] ) $ret["result"] = false;
160
  }
161
  }
162
+ elseif ( $data_array[0] == "30" || $data_array[0] == "31" ) {
163
  $ret["code"] = "3";
164
+ $ret["include_files"] = ( substr($data_array[0], 1, 1) == "1" );
165
  if ( count($data_array) != 1 ) $ret["result"] = false;
166
  }
167
  else $ret["result"] = false;
169
  return $ret;
170
  }
171
 
172
+ function wfu_clean_log_where_query($data) {
173
+ $query = "";
174
+ if ( $data["code"] == "0" ) $query = " WHERE date_from < '".date('Y-m-d H:i:s', $data["dateold"])."'";
175
+ elseif ( $data["code"] == "1" ) {
176
+ $date = strtotime(date('Y-m-d', strtotime('-'.$data["periodold"].' '.$data["periodtype"]))." 00:00");
177
+ $query = " WHERE date_from < '".date('Y-m-d H:i:s', $date)."'";
178
+ }
179
+ elseif ( $data["code"] == "2" ) $query = " WHERE date_from < '".date('Y-m-d H:i:s', $data["datefrom"] + 86400)."' AND date_from >= '".date('Y-m-d H:i:s', $data["dateto"])."'";
180
+
181
+ return $query;
182
+ }
183
+
184
  function wfu_clean_log_prompt($nonce, $data_enc) {
185
+ global $wpdb;
186
+ $table_name1 = $wpdb->prefix . "wfu_log";
187
  $siteurl = site_url();
188
 
189
  if ( !current_user_can( 'manage_options' ) || !wp_verify_nonce($nonce, 'wfu_maintenance_actions') ) return wfu_maintenance_actions();
203
  $echo_str .= "\n\t\t".$nonce_ref;
204
  $echo_str .= "\n\t\t".'<input type="hidden" name="action" value="clean_log">';
205
  $echo_str .= "\n\t\t".'<input type="hidden" name="data" value="'.$data_enc.'">';
206
+ if ( $data["include_files"] ) {
207
+ if ( $data["code"] == "0" )
208
+ $echo_str .= "\n\t\t".'<label>This will erase all files uploaded <strong>before '.date("Y-m-d", $data["dateold"]).'</strong> together with associated records kept by the plugin in the database (like file metadata and userdata).</label><br/>';
209
+ elseif ( $data["code"] == "1" )
210
+ $echo_str .= "\n\t\t".'<label>This will erase all files uploaded <strong>'.$data["periodold"].' '.$data["periodtype"].' ago or older</strong> together with associated records kept by the plugin in the database (like file metadata and userdata).</label><br/>';
211
+ elseif ( $data["code"] == "2" )
212
+ $echo_str .= "\n\t\t".'<label>This will erase all files uploaded <strong>between '.date("Y-m-d", $data["datefrom"]).' and '.date("Y-m-d", $data["dateto"]).'</strong> together with associated records kept by the plugin in the database (like file metadata and userdata).</label><br/>';
213
+ else
214
+ $echo_str .= "\n\t\t".'<label>This will erase <strong>ALL</strong> files and associated records kept by the plugin in the database (like file metadata and userdata).</label><br/>';
215
+ $affected_recs = $wpdb->get_results("SELECT * FROM $table_name1".wfu_clean_log_where_query($data));
216
+ $affected_files = wfu_get_valid_affected_files($affected_recs);
217
+ $echo_str .= "\n\t\t".'<br/><div class="wfu_cleanlog_files">';
218
+ $echo_str .= "\n\t\t\t".'<div>';
219
+ $echo_str .= "\n\t\t\t\t".'<label style="vertical-align: middle;"><strong>'.count($affected_files).'</strong> files will be deleted</label>';
220
+ $echo_str .= "\n\t\t\t\t".'<button id="wfu_cleanlog_prompt_button" onclick="document.querySelector(\'.wfu_cleanlog_files\').classList.toggle(\'visible\');return false;" style="vertical-align: middle;"></button>';
221
+ $echo_str .= "\n\t\t\t".'</div>';
222
+ $echo_str .= "\n\t\t\t".'<div id="wfu_cleanlog_prompt_list" style="margin-top:10px;">';
223
+ $echo_str .= "\n\t\t\t\t".'<textarea readonly="readonly" style="width:250px; height:150px; overflow:scroll; white-space:pre; resize:both;">';
224
+ foreach ( $affected_files as $file ) {
225
+ $echo_str .= $file."\n";
226
+ }
227
+ $echo_str .= "\n\t\t\t\t".'</textarea>';
228
+ $echo_str .= "\n\t\t\t".'</div>';
229
+ $echo_str .= "\n\t\t".'</div>';
230
+ $echo_str .= "\n\t\t".'<br/><label>Are you sure that you want to continue?</label><br/>';
231
+ $echo_str .= "\n\t\t".'<style>';
232
+ $echo_str .= "\n\t\t".'.wfu_cleanlog_files button:before { content: "Click to see affected files"; } ';
233
+ $echo_str .= "\n\t\t".'.wfu_cleanlog_files.visible button:before { content: "Close list"; } ';
234
+ $echo_str .= "\n\t\t".'.wfu_cleanlog_files #wfu_cleanlog_prompt_list { display: none; } ';
235
+ $echo_str .= "\n\t\t".'.wfu_cleanlog_files.visible #wfu_cleanlog_prompt_list { display: block; } ';
236
+ $echo_str .= "\n\t\t".'</style>';
237
+ }
238
+ else {
239
+ if ( $data["code"] == "0" )
240
+ $echo_str .= "\n\t\t".'<label>This will erase all records <strong>before '.date("Y-m-d", $data["dateold"]).'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
241
+ elseif ( $data["code"] == "1" )
242
+ $echo_str .= "\n\t\t".'<label>This will erase all records <strong>older than '.$data["periodold"].' '.$data["periodtype"].'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
243
+ elseif ( $data["code"] == "2" )
244
+ $echo_str .= "\n\t\t".'<label>This will erase all records <strong>between '.date("Y-m-d", $data["datefrom"]).' and '.date("Y-m-d", $data["dateto"]).'</strong> kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
245
+ else
246
+ $echo_str .= "\n\t\t".'<label>This will erase <strong>ALL</strong> records kept by the plugin in the database (like file metadata and userdata, however files uploaded by the plugin will be maintained). Are you sure that you want to continue?</label><br/>';
247
+ }
248
  $echo_str .= "\n\t\t".'<p class="submit">';
249
  $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Yes">';
250
  $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Cancel">';
258
  $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
259
  global $wpdb;
260
 
261
+ if ( !current_user_can( 'manage_options' ) ) return array( "recs_count" => -1, "files_count" => -1 );
262
+ if ( !check_admin_referer('wfu_clean_log') ) return array( "recs_count" => -1, "files_count" => -1 );
263
 
264
+ $recs_count = 0;
265
  if ( isset($_POST['data']) && isset($_POST['submit']) && $_POST['submit'] == "Yes" ) {
266
  $data = wfu_clean_log_parse_data($_POST['data']);
267
  if ( $data["result"] ) {
269
  $table_name2 = $wpdb->prefix . "wfu_userdata";
270
  //$table_name3 = $wpdb->prefix . "wfu_dbxqueue";
271
 
272
+ $affected_files = array();
273
+ if ( $data["include_files"] ) {
274
+ $affected_recs = $wpdb->get_results("SELECT * FROM $table_name1".wfu_clean_log_where_query($data));
275
+ $affected_files = wfu_get_valid_affected_files($affected_recs);
276
+ }
277
  $query1 = "DELETE FROM $table_name1";
278
  $query2 = "DELETE FROM $table_name2";
279
  //$query3 = "DELETE FROM $table_name3";
290
  $query1 .= " WHERE date_from < '".date('Y-m-d H:i:s', $data["datefrom"] + 86400)."' AND date_from >= '".date('Y-m-d H:i:s', $data["dateto"])."'";
291
  $query2 .= " WHERE date_from < '".date('Y-m-d H:i:s', $data["datefrom"] + 86400)."' AND date_from >= '".date('Y-m-d H:i:s', $data["dateto"])."'";
292
  }
293
+ $recs_count = $wpdb->query($query1);
294
+ $recs_count += $wpdb->query($query2);
295
+ //$recs_count += $wpdb->query($query3);
296
+
297
+ //delete affected files
298
+ $files_count = 0;
299
+ foreach( $affected_files as $file ) {
300
+ unlink($file);
301
+ if ( !file_exists($file) ) $files_count ++;
302
+ }
303
  }
304
  }
305
 
306
+ return array( "recs_count" => $recs_count, "files_count" => $files_count );
307
+ }
308
+
309
+ function wfu_purge_data_prompt($nonce) {
310
+ $siteurl = site_url();
311
+
312
+ if ( !current_user_can( 'manage_options' ) || !wp_verify_nonce($nonce, 'wfu_maintenance_actions') ) return wfu_maintenance_actions();
313
+
314
+ $echo_str = "\n".'<div class="wrap">';
315
+ $echo_str .= "\n\t".'<div style="margin-top:20px;">';
316
+ $echo_str .= "\n\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=maintenance_actions" class="button" title="go back">Go back</a>';
317
+ $echo_str .= "\n\t".'</div>';
318
+ $echo_str .= "\n\t".'<h2 style="margin-bottom: 10px;">Purge All Data</h2>';
319
+ $echo_str .= "\n\t".'<form enctype="multipart/form-data" name="purge_data" id="purge_data" method="post" action="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload" class="validate">';
320
+ $nonce = wp_nonce_field('wfu_purge_data', '_wpnonce', false, false);
321
+ $nonce_ref = wp_referer_field(false);
322
+ $echo_str .= "\n\t\t".$nonce;
323
+ $echo_str .= "\n\t\t".$nonce_ref;
324
+ $echo_str .= "\n\t\t".'<input type="hidden" name="action" value="purge_data">';
325
+ $echo_str .= "\n\t\t".'<label>This action will remove all plugin options and records from database, data stored in session and will dectivate the plugin. Use it only if you want to entirely remove the plugin from the website.</label><br/>';
326
+ $echo_str .= "\n\t\t".'<br/><label>Are you sure you want to continue?</label><br/>';
327
+ $echo_str .= "\n\t\t".'<p class="submit">';
328
+ $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Yes">';
329
+ $echo_str .= "\n\t\t\t".'<input type="submit" class="button-primary" name="submit" value="Cancel">';
330
+ $echo_str .= "\n\t\t".'</p>';
331
+ $echo_str .= "\n\t".'</form>';
332
+ $echo_str .= "\n".'</div>';
333
+ return $echo_str;
334
+ }
335
+
336
+ function wfu_purge_data() {
337
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
338
+ global $wpdb;
339
+
340
+ if ( !current_user_can( 'manage_options' ) ) return;
341
+ if ( !check_admin_referer('wfu_purge_data') ) return;
342
+
343
+ if ( isset($_POST['submit']) && $_POST['submit'] == "Yes" ) {
344
+ $all_options = array_keys(wp_load_alloptions());
345
+ $all_session = array_keys($_SESSION);
346
+ $wfu_options = wfu_get_all_plugin_options();
347
+ //first delete relevant db options
348
+ foreach ( $all_options as $opt1 )
349
+ foreach ( $wfu_options as $opt2 )
350
+ if ( $opt2[2] && $opt2[1] == "db" ) {
351
+ if (( substr($opt2[0], 0, 1) != "*" && substr($opt2[0], -1) != "*" && $opt1 == $opt2[0] ) ||
352
+ ( substr($opt2[0], 0, 1) != "*" && substr($opt2[0], -1) == "*" && substr($opt1, 0, strlen($opt2[0])) == substr($opt2[0], 0, -1) ) ||
353
+ ( substr($opt2[0], 0, 1) == "*" && substr($opt2[0], -1) != "*" && substr($opt1, -strlen($opt2[0])) == substr($opt2[0], 1) ) ||
354
+ ( substr($opt2[0], 0, 1) == "*" && substr($opt2[0], -1) == "*" && strpos($opt1, substr($opt2[0], 1, -1)) !== false ))
355
+ delete_option($opt1);
356
+ }
357
+ //then delete relevant session data
358
+ foreach ( $all_session as $opt1 )
359
+ foreach ( $wfu_options as $opt2 )
360
+ if ( $opt2[2] && $opt2[1] == "session" ) {
361
+ if (( substr($opt2[0], 0, 1) != "*" && substr($opt2[0], -1) != "*" && $opt1 == $opt2[0] ) ||
362
+ ( substr($opt2[0], 0, 1) != "*" && substr($opt2[0], -1) == "*" && substr($opt1, 0, strlen($opt2[0])) == substr($opt2[0], 0, -1) ) ||
363
+ ( substr($opt2[0], 0, 1) == "*" && substr($opt2[0], -1) != "*" && substr($opt1, -strlen($opt2[0])) == substr($opt2[0], 1) ) ||
364
+ ( substr($opt2[0], 0, 1) == "*" && substr($opt2[0], -1) == "*" && strpos($opt1, substr($opt2[0], 1, -1)) !== false ))
365
+ unset($_SESSION[$opt1]);
366
+ }
367
+ //then delete relevant tables
368
+ $wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."wfu_log" );
369
+ $wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."wfu_userdata" );
370
+ $wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."wfu_dbxqueue" );
371
+ //then deactivate the plugin
372
+ deactivate_plugins( plugin_basename( WPFILEUPLOAD_PLUGINFILE ) );
373
+ }
374
+ else return;
375
+
376
+ return true;
377
  }
378
 
379
 
lib/wfu_admin_uploadedfiles.php CHANGED
@@ -19,9 +19,13 @@ function wfu_uploadedfiles_manager($page = 1, $only_table_rows = false) {
19
  $maxrows = (int)WFU_VAR("WFU_UPLOADEDFILES_TABLE_MAXROWS");
20
 
21
  //get log data from database
22
- $files_total = $wpdb->get_var('SELECT COUNT(idlog) FROM '.$table_name1.' WHERE action = \'upload\'');
23
- $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action = \'upload\' ORDER BY date_from DESC'.( $maxrows > 0 ? ' LIMIT '.$maxrows.' OFFSET '.(($page - 1) * $maxrows) : '' ));
24
-
 
 
 
 
25
  //get last record already read
26
  $last_idlog = get_option( "wordpress_file_upload_last_idlog", array( "pre" => 0, "post" => 0, "time" => 0 ) );
27
 
@@ -130,9 +134,11 @@ function wfu_uploadedfiles_manager($page = 1, $only_table_rows = false) {
130
  $i ++;
131
  $initialrec = $filerec;
132
  //get all newer associated file records
133
- $filerecs = wfu_get_rec_new_history($initialrec->idlog);
 
 
134
  //get the latest record of this upload
135
- $filerec = $filerecs[count($filerecs) - 1];
136
  $filedata = wfu_get_filedata_from_rec($filerec, false, true, false);
137
  if ( $filedata == null ) $filedata = array();
138
 
@@ -268,6 +274,48 @@ function wfu_uploadedfiles_manager($page = 1, $only_table_rows = false) {
268
  return $echo_str;
269
  }
270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  function wfu_init_uploadedfiles_properties() {
272
  $props["status"] = array(
273
  "icon" => "obsolete",
19
  $maxrows = (int)WFU_VAR("WFU_UPLOADEDFILES_TABLE_MAXROWS");
20
 
21
  //get log data from database
22
+ //$files_total = $wpdb->get_var('SELECT COUNT(idlog) FROM '.$table_name1.' WHERE action = \'upload\'');
23
+ //$filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action = \'upload\' ORDER BY date_from DESC'.( $maxrows > 0 ? ' LIMIT '.$maxrows.' OFFSET '.(($page - 1) * $maxrows) : '' ));
24
+ $files_total = 0;
25
+ $filerecs = array();
26
+ $has_history = false;
27
+ extract(wfu_uploadedfiles_get_filerecs($page));
28
+
29
  //get last record already read
30
  $last_idlog = get_option( "wordpress_file_upload_last_idlog", array( "pre" => 0, "post" => 0, "time" => 0 ) );
31
 
134
  $i ++;
135
  $initialrec = $filerec;
136
  //get all newer associated file records
137
+ $historyrecs = array();
138
+ if ( $has_history ) $historyrecs = $filerec->history;
139
+ else $historyrecs = wfu_get_rec_new_history($initialrec->idlog);
140
  //get the latest record of this upload
141
+ $filerec = $historyrecs[count($historyrecs) - 1];
142
  $filedata = wfu_get_filedata_from_rec($filerec, false, true, false);
143
  if ( $filedata == null ) $filedata = array();
144
 
274
  return $echo_str;
275
  }
276
 
277
+ function wfu_uploadedfiles_get_filerecs($page) {
278
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
279
+ global $wpdb;
280
+ $table_name1 = $wpdb->prefix . "wfu_log";
281
+ $maxrows = (int)WFU_VAR("WFU_UPLOADEDFILES_TABLE_MAXROWS");
282
+ $ret = array(
283
+ "files_total" => 0,
284
+ "filerecs" => array(),
285
+ "has_history" => false
286
+ );
287
+
288
+ if ( WFU_VAR("WFU_UPLOADEDFILES_HIDEINVALID") != "true" ) {
289
+ $ret["files_total"] = $wpdb->get_var('SELECT COUNT(idlog) FROM '.$table_name1.' WHERE action = \'upload\'');
290
+ $ret["filerecs"] = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action = \'upload\' ORDER BY date_from DESC'.( $maxrows > 0 ? ' LIMIT '.$maxrows.' OFFSET '.(($page - 1) * $maxrows) : '' ));
291
+ }
292
+ else {
293
+ $filerecs = $wpdb->get_results('SELECT * FROM '.$table_name1.' WHERE action = \'upload\' ORDER BY date_from DESC');
294
+ foreach ( $filerecs as $ind => $filerec ) {
295
+ $initialrec = $filerec;
296
+ //get all newer associated file records
297
+ $historyrecs = wfu_get_rec_new_history($initialrec->idlog);
298
+ //get the latest record of this upload
299
+ $filerec = $historyrecs[count($historyrecs) - 1];
300
+ $file_abspath = wfu_path_rel2abs($filerec->filepath);
301
+ //check if file is stored in FTP location
302
+ $file_in_ftp = ( substr($file_abspath, 0, 6) == 'ftp://' || substr($file_abspath, 0, 7) == 'ftps://' || substr($file_abspath, 0, 7) == 'sftp://' );
303
+ //check if file exists for non-ftp uploads
304
+ $file_exists = ( $file_in_ftp ? true : file_exists($file_abspath) );
305
+ //check if record is obsolete
306
+ $obsolete = ( $filerec->date_to != "0000-00-00 00:00:00" );
307
+ if ( !$file_exists || $obsolete ) unset($filerecs[$ind]);
308
+ else $filerecs[$ind]->history = $historyrecs;
309
+ }
310
+ $ret["files_total"] = count($filerecs);
311
+ if ( $maxrows > 0 ) $filerecs = array_slice($filerecs, ($page - 1) * $maxrows, $maxrows);
312
+ $ret["filerecs"] = $filerecs;
313
+ $ret["has_history"] = true;
314
+ }
315
+
316
+ return $ret;
317
+ }
318
+
319
  function wfu_init_uploadedfiles_properties() {
320
  $props["status"] = array(
321
  "icon" => "obsolete",
lib/wfu_constants.php CHANGED
@@ -299,6 +299,7 @@ $GLOBALS["WFU_GLOBALS"] = array(
299
  //other plugin values
300
  $GLOBALS["WFU_GLOBALS"] += array(
301
  "WFU_DEBUG" => array( "Plugin Debug Mode", "string", "OFF", "If DEBUG mode is activated then advanced hook of plugin's function can be performed. This option may make the plugin slower, so use it very carefully. It can be 'OFF' or 'ON'." ),
 
302
  "WFU_UPLOADPROGRESS_MODE" => array( "Upload Progress Mode", "string", "incremental", "Defines how the upload progress is calculated. It can be 'incremental' or 'absolute'. Default value is 'incremental'." ),
303
  "WFU_DOS_ATTACKS_CHECK" => array( "Check for Denial-Of-Service Attacks", "string", "true", "If it is true then then plugin will check if the number of files uploaded within a specific amount of time exceeds the limit, thus protecting from DOS attacks. It can be 'true' or 'false'." ),
304
  "WFU_DOS_ATTACKS_FILE_LIMIT" => array( "Denial-Of-Service File Limit", "integer", 10000, "Defines the maximum number of files that are allowed to be uploaded within a specific amount of time. It can be any positive integer." ),
@@ -335,6 +336,7 @@ $GLOBALS["WFU_GLOBALS"] += array(
335
  "WFU_UPLOADEDFILES_DEFACTION" => array( "Uploaded Files Default Action", "string", "adminbrowser", "Defines the default action that will be executed when a file link is pressed in Uploaded Files page. It can be 'details', 'adminbrowser', 'historylog', 'link', 'download' and 'none'." ),
336
  "WFU_UPLOADEDFILES_COLUMNS" => array( "Uploaded Files Columns", "string", "#, file, upload_date, user, properties, remarks, actions", "Defines the visible columns of the Uploaded Files list as well as their order. It is noted that 'File' column is always visible and it is the second column if '#' column is visible, or the first one if '#' column is hidden." ),
337
  "WFU_UPLOADEDFILES_ACTIONS" => array( "Uploaded Files Actions", "string", "details, media, adminbrowser, historylog, link, download", "Defines the allowable actions and their order for each file in Uploaded Files list. It is noted that the actions shown for each file depend on its properties." ),
 
338
  "WFU_UPLOADEDFILES_RESET_TIME" => array( "Uploaded Files Reset Time", "integer", 5, "Defines the interval in seconds before the unread uploaded files can be marked as read. A value of -1 denotes that there is no interval." ),
339
  "WFU_UPLOADEDFILES_BARMENU" => array( "Uploaded Files Toolbar Menu State", "string", "true", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be shown or not. It can be 'true' or 'false'." ),
340
  "WFU_UPLOADEDFILES_BARAUTOHIDE" => array( "Uploaded Files Auto-Hide on Toolbar", "string", "false", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be hidden when there are no new uploads. It can be 'true' or 'false'." )
299
  //other plugin values
300
  $GLOBALS["WFU_GLOBALS"] += array(
301
  "WFU_DEBUG" => array( "Plugin Debug Mode", "string", "OFF", "If DEBUG mode is activated then advanced hook of plugin's function can be performed. This option may make the plugin slower, so use it very carefully. It can be 'OFF' or 'ON'." ),
302
+ "WFU_RESTRICT_FRONTEND_LOADING" => array( "Restrict Front-End Loading", "string", "false", "It defines whether the plugin will load on all pages or specific ones. If it is 'false' then it will load on all pages. To restrict loading only on specific pages set a comma-separated list of page or post IDs." ),
303
  "WFU_UPLOADPROGRESS_MODE" => array( "Upload Progress Mode", "string", "incremental", "Defines how the upload progress is calculated. It can be 'incremental' or 'absolute'. Default value is 'incremental'." ),
304
  "WFU_DOS_ATTACKS_CHECK" => array( "Check for Denial-Of-Service Attacks", "string", "true", "If it is true then then plugin will check if the number of files uploaded within a specific amount of time exceeds the limit, thus protecting from DOS attacks. It can be 'true' or 'false'." ),
305
  "WFU_DOS_ATTACKS_FILE_LIMIT" => array( "Denial-Of-Service File Limit", "integer", 10000, "Defines the maximum number of files that are allowed to be uploaded within a specific amount of time. It can be any positive integer." ),
336
  "WFU_UPLOADEDFILES_DEFACTION" => array( "Uploaded Files Default Action", "string", "adminbrowser", "Defines the default action that will be executed when a file link is pressed in Uploaded Files page. It can be 'details', 'adminbrowser', 'historylog', 'link', 'download' and 'none'." ),
337
  "WFU_UPLOADEDFILES_COLUMNS" => array( "Uploaded Files Columns", "string", "#, file, upload_date, user, properties, remarks, actions", "Defines the visible columns of the Uploaded Files list as well as their order. It is noted that 'File' column is always visible and it is the second column if '#' column is visible, or the first one if '#' column is hidden." ),
338
  "WFU_UPLOADEDFILES_ACTIONS" => array( "Uploaded Files Actions", "string", "details, media, adminbrowser, historylog, link, download", "Defines the allowable actions and their order for each file in Uploaded Files list. It is noted that the actions shown for each file depend on its properties." ),
339
+ "WFU_UPLOADEDFILES_HIDEINVALID" => array( "Hide Invalid Uploaded Files", "string", "false", "Defines whether all uploaded file records will be shown in Uploaded File menu or only the valid ones. Invalid are the records who are obsolete or their files do not exist anymore." ),
340
  "WFU_UPLOADEDFILES_RESET_TIME" => array( "Uploaded Files Reset Time", "integer", 5, "Defines the interval in seconds before the unread uploaded files can be marked as read. A value of -1 denotes that there is no interval." ),
341
  "WFU_UPLOADEDFILES_BARMENU" => array( "Uploaded Files Toolbar Menu State", "string", "true", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be shown or not. It can be 'true' or 'false'." ),
342
  "WFU_UPLOADEDFILES_BARAUTOHIDE" => array( "Uploaded Files Auto-Hide on Toolbar", "string", "false", "Defines whether the Uploaded Files Toolbar (Admin Bar) menu item will be hidden when there are no new uploads. It can be 'true' or 'false'." )
lib/wfu_functions.php CHANGED
@@ -1659,6 +1659,24 @@ function wfu_get_file_rec($filepath, $include_userdata) {
1659
  return $filerec;
1660
  }
1661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1662
  //get database record for id
1663
  function wfu_get_file_rec_from_id($idlog, $include_userdata = false) {
1664
  global $wpdb;
@@ -2134,6 +2152,118 @@ function wfu_export_uploaded_files($params) {
2134
  return $path;
2135
  }
2136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2137
  //********************* Widget Functions ****************************************************************************************
2138
 
2139
  function wfu_get_widget_obj_from_id($widgetid) {
@@ -3024,6 +3154,15 @@ function wfu_decode_socket_response($response) {
3024
  function wfu_post_request($url, $params, $verifypeer = true, $internal_request = false, $timeout = 0) {
3025
  $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
3026
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
 
 
 
 
 
 
 
 
 
3027
  if ( isset($plugin_options['postmethod']) && $plugin_options['postmethod'] == 'curl' ) {
3028
  // POST request using CURL
3029
  $ch = curl_init($url);
@@ -3036,7 +3175,8 @@ function wfu_post_request($url, $params, $verifypeer = true, $internal_request =
3036
  CURLINFO_HEADER_OUT => false,
3037
  CURLOPT_HEADER => false,
3038
  CURLOPT_RETURNTRANSFER => true,
3039
- CURLOPT_SSL_VERIFYPEER => $verifypeer
 
3040
  );
3041
  if ( $timeout > 0 ) $options[CURLOPT_TIMEOUT] = $timeout;
3042
  //for internal requests to /wp-admin area that is password protected
@@ -3046,6 +3186,17 @@ function wfu_post_request($url, $params, $verifypeer = true, $internal_request =
3046
  $options[CURLOPT_USERPWD] = WFU_VAR("WFU_DASHBOARD_USERNAME").":".WFU_VAR("WFU_DASHBOARD_PASSWORD");
3047
  }
3048
  if ( WFU_VAR("WFU_RELAX_CURL_VERIFY_HOST") == "true" ) $options[CURLOPT_SSL_VERIFYHOST] = false;
 
 
 
 
 
 
 
 
 
 
 
3049
  curl_setopt_array($ch, $options);
3050
  $result = curl_exec($ch);
3051
  curl_close ($ch);
@@ -3058,30 +3209,50 @@ function wfu_post_request($url, $params, $verifypeer = true, $internal_request =
3058
  $errno = 0;
3059
  $errstr = '';
3060
  $ret = '';
3061
- $url = parse_url($url);
3062
- $host = $url['host'];
3063
- $path = $url['path'];
3064
- if ( $url['scheme'] == 'https' ) {
 
3065
  $scheme = "ssl://";
3066
  $port = 443;
3067
  if ( $timeout == 0 ) $timeout = 30;
3068
  }
3069
  elseif ( $url['scheme'] != 'http' ) return '';
3070
- $handle = fsockopen($scheme.$host, $port, $errno, $errstr, ($timeout == 0 ? ini_get("default_socket_timeout") : $timeout));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3071
  if ( $errno !== 0 || $errstr !== '' ) $handle = false;
3072
  if ( $handle !== false ) {
3073
  $content = http_build_query($params);
3074
  $request = "POST " . $path . " HTTP/1.1\r\n";
3075
- $request .= "Host: " . $host . "\r\n";
3076
- $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
3077
  //for internal requests to /wp-admin area that is password protected
3078
  //authorization is required
3079
- if ( $internal_request && WFU_VAR("WFU_DASHBOARD_PROTECTED") == "true" ) {
3080
  $request .= "Authorization: Basic ".base64_encode(WFU_VAR("WFU_DASHBOARD_USERNAME").":".WFU_VAR("WFU_DASHBOARD_PASSWORD"))."\r\n";
3081
- }
3082
- $request .= "Content-length: " . strlen($content) . "\r\n";
3083
- $request .= "Connection: close\r\n\r\n";
3084
- $request .= $content . "\r\n\r\n";
 
 
 
 
3085
  fwrite($handle, $request, strlen($request));
3086
  $response = '';
3087
  while ( !feof($handle) ) {
@@ -3103,6 +3274,12 @@ function wfu_post_request($url, $params, $verifypeer = true, $internal_request =
3103
  'header' => "Content-type: application/x-www-form-urlencoded\r\n",
3104
  'content' => http_build_query($params)
3105
  );
 
 
 
 
 
 
3106
  if ( $timeout > 0 ) $http_array['timeout'] = $timeout;
3107
  //for internal requests to /wp-admin area that is password protected
3108
  //authorization is required
@@ -3111,6 +3288,8 @@ function wfu_post_request($url, $params, $verifypeer = true, $internal_request =
3111
  }
3112
  $context_params = array( 'http' => $http_array );
3113
  if ( !$verifypeer ) $context_params['ssl'] = array( 'verify_peer' => false, 'allow_self_signed' => true, 'verify_peer_name' => false );
 
 
3114
  $context = stream_context_create($context_params);
3115
  return file_get_contents($url, false, $context);
3116
  }
1659
  return $filerec;
1660
  }
1661
 
1662
+ function wfu_get_valid_affected_files($recs) {
1663
+ global $wpdb;
1664
+ $table_name1 = $wpdb->prefix . "wfu_log";
1665
+
1666
+ $valid_affected_files = array();
1667
+ $files_checked = array();
1668
+ foreach ($recs as $rec)
1669
+ if ( $latestrec = wfu_get_latest_rec_from_id($rec->idlog) ) {
1670
+ $file = wfu_path_rel2abs($latestrec->filepath);
1671
+ if ( !in_array($file, $files_checked) ) {
1672
+ if ( file_exists($file) ) array_push($valid_affected_files, $file);
1673
+ array_push($files_checked, $file);
1674
+ }
1675
+ }
1676
+
1677
+ return $valid_affected_files;
1678
+ }
1679
+
1680
  //get database record for id
1681
  function wfu_get_file_rec_from_id($idlog, $include_userdata = false) {
1682
  global $wpdb;
2152
  return $path;
2153
  }
2154
 
2155
+ function wfu_get_all_plugin_options() {
2156
+ //structure of $options array; every item has the following properties:
2157
+ // 0: name of option, an asterisk (*) denotes many occurencies
2158
+ // 1: location of option, "db" or "session"
2159
+ // 2: delete this option when purging all plugin data
2160
+ // 3: store this option when extracting plugin data
2161
+ $options = array(
2162
+ //stored plugin's Settings
2163
+ array( "wordpress_file_upload_options", "db", true, true ),
2164
+ //wfu_log table version
2165
+ array( "wordpress_file_upload_table_log_version", "db", true, true ),
2166
+ //wfu_userdata version
2167
+ array( "wordpress_file_upload_table_userdata_version", "db", true, true ),
2168
+ //wfu_dbxqueue version
2169
+ array( "wordpress_file_upload_table_dbxqueue_version", "db", true, true ),
2170
+ //stored hooks
2171
+ array( "wordpress_file_upload_hooks", "db", true, true ),
2172
+ //transfer manager properties
2173
+ array( "wfu_transfermanager_props", "db", true, true ),
2174
+ //last file record that was read
2175
+ array( "wordpress_file_upload_last_idlog", "db", true, false ),
2176
+ //indices of stored shortcode parameters
2177
+ array( "wfu_params_index", "db", true, false ),
2178
+ //stored shortcode parameters
2179
+ array( "wfu_params_*", "db", true, false ),
2180
+ //stored advanced environment variables
2181
+ array( "wfu_environment_variables", "db", true, true ),
2182
+ //stored global tokens
2183
+ array( "wfu_gst_*", "db", true, false ),
2184
+ //data of unfinished uploaded files
2185
+ array( "wordpress_file_upload_unfinished_data", "db", true, false ),
2186
+ //list of stored variables in dboption user state
2187
+ array( "wfu_userstate_list", "db", true, false ),
2188
+ //stored variable value in dboption user state
2189
+ array( "wfu_userstate_*", "db", true, false ),
2190
+ //last time dboption user state was checked
2191
+ array( "wfu_userstate_list_last_check", "db", true, false ),
2192
+ //stored personal data policies
2193
+ array( "wordpress_file_upload_pd_policies", "db", true, true ),
2194
+ //last time admin was notified about DOS attack
2195
+ array( "wfu_admin_notification_about_DOS", "db", true, false ),
2196
+ //stored Dropbox authorization object
2197
+ array( "wfu_Dropbox_WebAuth", "session", true, false ),
2198
+ //stored Google Client object
2199
+ array( "wfu_GDrive_Client", "session", true, false ),
2200
+ //stored token for adding uploader shortcode
2201
+ array( "wfu_add_shortcode_ticket_for_wordpress_file_upload", "session", true, false ),
2202
+ //stored token for adding file viewer shortcode
2203
+ array( "wfu_add_shortcode_ticket_for_wordpress_file_upload_browser", "session", true, false ),
2204
+ //session array holding dir and file paths
2205
+ array( "wfu_filepath_safe_storage", "session", true, false ),
2206
+ //stored rename file flag when renaming file
2207
+ array( "wfu_rename_file", "session", true, false ),
2208
+ //stored rename file error when renaming file
2209
+ array( "wfu_rename_file_error", "session", true, false ),
2210
+ //stored create dir flag when creating dir
2211
+ array( "wfu_create_dir", "session", true, false ),
2212
+ //stored create dir error when creating dir
2213
+ array( "wfu_create_dir_error", "session", true, false ),
2214
+ //stored file details error when updating file details
2215
+ array( "wfu_filedetails_error", "session", true, false ),
2216
+ //stored hook data key when updating a hook
2217
+ array( "wfu_hook_data_key", "session", true, false ),
2218
+ //stored hook data title when updating a hook
2219
+ array( "wfu_hook_data_title", "session", true, false ),
2220
+ //stored hook data description when updating a hook
2221
+ array( "wfu_hook_data_description", "session", true, false ),
2222
+ //stored hook data code when updating a hook
2223
+ array( "wfu_hook_data_code", "session", true, false ),
2224
+ //stored hook data status when updating a hook
2225
+ array( "wfu_hook_data_status", "session", true, false ),
2226
+ //stored hook data scope when updating a hook
2227
+ array( "wfu_hook_data_scope", "session", true, false ),
2228
+ //stored hook data error message when updating a hook
2229
+ array( "wfu_hook_data_message", "session", true, false ),
2230
+ //stored data of file transfers tab
2231
+ array( "wfu_transfers_data", "session", true, false ),
2232
+ //stored token of upload form
2233
+ array( "wfu_token_*", "session", true, false ),
2234
+ //stored data of uploaded files
2235
+ array( "filedata_*", "session", true, false ),
2236
+ //stored status of upload
2237
+ array( "wfu_uploadstatus_*", "session", true, false ),
2238
+ //flag determining if this is the first pass of an upload
2239
+ array( "wfu_upload_first_pass_*", "session", true, false ),
2240
+ //stored approved captcha verification code
2241
+ array( "wfu_approvedcaptcha_*", "session", true, false ),
2242
+ //stored short tokens
2243
+ array( "wfu_ust_*", "session", true, false ),
2244
+ //stored shortcode data
2245
+ array( "wfu_shortcode_data_safe_storage", "session", true, false ),
2246
+ //stored number of deleted thumbnails
2247
+ array( "wfu_deleted_thumbnails_counter", "session", true, false ),
2248
+ //stored number of added thumbnails
2249
+ array( "wfu_added_thumbnails_counter", "session", true, false ),
2250
+ //stored consent data
2251
+ array( "WFU_Consent_Data", "session", true, false ),
2252
+ //stored browser actions
2253
+ array( "wfu_browser_actions_safe_storage", "session", true, false ),
2254
+ //stored data of chunked uploads
2255
+ array( "chunkdata_*", "session", true, false ),
2256
+ //stored flag of uploader form refresh status
2257
+ array( "wfu_check_refresh_*", "session", true, false ),
2258
+ //stored upload start time
2259
+ array( "wfu_start_time_*", "session", true, false ),
2260
+ //stored upload start time
2261
+ array( "wfu_start_time_*", "session", true, false )
2262
+ );
2263
+
2264
+ return $options;
2265
+ }
2266
+
2267
  //********************* Widget Functions ****************************************************************************************
2268
 
2269
  function wfu_get_widget_obj_from_id($widgetid) {
3154
  function wfu_post_request($url, $params, $verifypeer = true, $internal_request = false, $timeout = 0) {
3155
  $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
3156
  $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
3157
+ $default_args = array(
3158
+ 'url' => $url,
3159
+ 'params' => $params,
3160
+ 'verifypeer' => $verifypeer,
3161
+ 'internal_request' => $internal_request,
3162
+ 'timeout' => $timeout
3163
+ );
3164
+ //check proxy
3165
+ $proxy = new WP_HTTP_Proxy();
3166
  if ( isset($plugin_options['postmethod']) && $plugin_options['postmethod'] == 'curl' ) {
3167
  // POST request using CURL
3168
  $ch = curl_init($url);
3175
  CURLINFO_HEADER_OUT => false,
3176
  CURLOPT_HEADER => false,
3177
  CURLOPT_RETURNTRANSFER => true,
3178
+ CURLOPT_SSL_VERIFYPEER => $verifypeer,
3179
+ CURLOPT_SSL_VERIFYHOST => ( $verifypeer ? CURLOPT_SSL_VERIFYHOST : false )
3180
  );
3181
  if ( $timeout > 0 ) $options[CURLOPT_TIMEOUT] = $timeout;
3182
  //for internal requests to /wp-admin area that is password protected
3186
  $options[CURLOPT_USERPWD] = WFU_VAR("WFU_DASHBOARD_USERNAME").":".WFU_VAR("WFU_DASHBOARD_PASSWORD");
3187
  }
3188
  if ( WFU_VAR("WFU_RELAX_CURL_VERIFY_HOST") == "true" ) $options[CURLOPT_SSL_VERIFYHOST] = false;
3189
+ //configure cURL request for proxy
3190
+ if ( $proxy->is_enabled() && $proxy->send_through_proxy($url) ) {
3191
+ $options[CURLOPT_PROXYTYPE] = CURLPROXY_HTTP;
3192
+ $options[CURLOPT_PROXY] = $proxy->host().":".$proxy->port();
3193
+ if ( $proxy->use_authentication() ) {
3194
+ $options[CURLOPT_PROXYAUTH] = CURLAUTH_ANY;
3195
+ $options[CURLOPT_PROXYUSERPWD] = $proxy->authentication();
3196
+ }
3197
+ }
3198
+ //customize request options before dispatching to destination
3199
+ $options = apply_filters("_wfu_post_request_options", $options, "curl", $default_args);
3200
  curl_setopt_array($ch, $options);
3201
  $result = curl_exec($ch);
3202
  curl_close ($ch);
3209
  $errno = 0;
3210
  $errstr = '';
3211
  $ret = '';
3212
+ $url_parts = parse_url($url);
3213
+ $host = $url_parts['host'];
3214
+ $socket_host = $host;
3215
+ $path = $url_parts['path'];
3216
+ if ( $url_parts['scheme'] == 'https' ) {
3217
  $scheme = "ssl://";
3218
  $port = 443;
3219
  if ( $timeout == 0 ) $timeout = 30;
3220
  }
3221
  elseif ( $url['scheme'] != 'http' ) return '';
3222
+ //configure sockets request for proxy
3223
+ if ( $proxy->is_enabled() && $proxy->send_through_proxy($url) ) {
3224
+ $scheme = "";
3225
+ $socket_host = $proxy->host();
3226
+ $port = $proxy->port();
3227
+ $path = $url;
3228
+ }
3229
+ if ( $verifypeer ) $handle = fsockopen($scheme.$socket_host, $port, $errno, $errstr, ($timeout == 0 ? ini_get("default_socket_timeout") : $timeout));
3230
+ else {
3231
+ $context = stream_context_create(array(
3232
+ 'ssl' => array(
3233
+ 'verify_peer' => false,
3234
+ 'verify_peer_name' => false
3235
+ )));
3236
+ $handle = stream_socket_client($scheme.$socket_host.":".$port, $errno, $errstr, ($timeout == 0 ? ini_get("default_socket_timeout") : $timeout), STREAM_CLIENT_CONNECT, $context);
3237
+ }
3238
  if ( $errno !== 0 || $errstr !== '' ) $handle = false;
3239
  if ( $handle !== false ) {
3240
  $content = http_build_query($params);
3241
  $request = "POST " . $path . " HTTP/1.1\r\n";
3242
+ $request .= "Host: " . $host . "\r\n";
3243
+ $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
3244
  //for internal requests to /wp-admin area that is password protected
3245
  //authorization is required
3246
+ if ( $internal_request && WFU_VAR("WFU_DASHBOARD_PROTECTED") == "true" )
3247
  $request .= "Authorization: Basic ".base64_encode(WFU_VAR("WFU_DASHBOARD_USERNAME").":".WFU_VAR("WFU_DASHBOARD_PASSWORD"))."\r\n";
3248
+ //add proxy authentication if exists and is required
3249
+ if ( $proxy->is_enabled() && $proxy->send_through_proxy($url) && $proxy->use_authentication() )
3250
+ $request .= $proxy->authentication_header()."\r\n";
3251
+ $request .= "Content-length: " . strlen($content) . "\r\n";
3252
+ $request .= "Connection: close\r\n\r\n";
3253
+ $request .= $content . "\r\n\r\n";
3254
+ //customize request options before dispatching to destination
3255
+ $request = apply_filters("_wfu_post_request_options", $request, "socket", $default_args);
3256
  fwrite($handle, $request, strlen($request));
3257
  $response = '';
3258
  while ( !feof($handle) ) {
3274
  'header' => "Content-type: application/x-www-form-urlencoded\r\n",
3275
  'content' => http_build_query($params)
3276
  );
3277
+ //configure fopen request for proxy
3278
+ if ( $proxy->is_enabled() && $proxy->send_through_proxy($url) ) {
3279
+ $http_array['proxy'] = 'tcp://'.$proxy->host().":".$proxy->port();
3280
+ if ( $proxy->use_authentication() )
3281
+ $http_array['header'] .= $proxy->authentication_header()."\r\n";
3282
+ }
3283
  if ( $timeout > 0 ) $http_array['timeout'] = $timeout;
3284
  //for internal requests to /wp-admin area that is password protected
3285
  //authorization is required
3288
  }
3289
  $context_params = array( 'http' => $http_array );
3290
  if ( !$verifypeer ) $context_params['ssl'] = array( 'verify_peer' => false, 'allow_self_signed' => true, 'verify_peer_name' => false );
3291
+ //customize request options before dispatching to destination
3292
+ $context_params = apply_filters("_wfu_post_request_options", $context_params, "fopen", $default_args);
3293
  $context = stream_context_create($context_params);
3294
  return file_get_contents($url, false, $context);
3295
  }
lib/wfu_template.php CHANGED
@@ -2933,8 +2933,12 @@ this.update = function(data) {
2933
  file_contents = file_contents.replace(/\[filesubheaderadminmessage_display\]/g, "style=\"display:none;\"");
2934
  file_contents = file_contents.replace(/\[filesubheader_adminmessage\]/g, file.message3);
2935
  // put file contents to temp div element to convert them to HTML elements
2936
- file_contents = "<table><tbody>" + file_contents + "<\/tbody><\/table>"; //IE6 fix: door is a div element so that innerHTML is writable
2937
- door.innerHTML = file_contents;
 
 
 
 
2938
  // post process created file block to adjust visibility of its contents
2939
  headerspan = 1;
2940
  subheaderspan = 2;
@@ -3050,13 +3054,13 @@ this._apply_header_template = function(data) {
3050
  * @return string the generated HTML code
3051
  */
3052
  this._format_debug_data = function(debug_data) {
3053
- output = '<label class="file_messageblock_subheader_debugmessage_label">';
3054
- output += debug_data.title;
3055
- output += '<\/label>';
3056
- output += '<div class="file_messageblock_subheader_debugmessage_container">';
3057
- output += debug_data.data;
3058
- output += '<\/div>';
3059
- return output;
3060
  }
3061
 
3062
  /**
2933
  file_contents = file_contents.replace(/\[filesubheaderadminmessage_display\]/g, "style=\"display:none;\"");
2934
  file_contents = file_contents.replace(/\[filesubheader_adminmessage\]/g, file.message3);
2935
  // put file contents to temp div element to convert them to HTML elements
2936
+ var door_table = document.createElement("TABLE");
2937
+ var door_tbody = document.createElement("TBODY");
2938
+ door_tbody.innerHTML = file_contents;
2939
+ door_table.appendChild(door_tbody);
2940
+ door.innerHTML = "";
2941
+ door.appendChild(door_table);
2942
  // post process created file block to adjust visibility of its contents
2943
  headerspan = 1;
2944
  subheaderspan = 2;
3054
  * @return string the generated HTML code
3055
  */
3056
  this._format_debug_data = function(debug_data) {
3057
+ var lab = document.createElement("LABEL");
3058
+ lab.className = "file_messageblock_subheader_debugmessage_label"
3059
+ lab.innerHTML = debug_data.title;
3060
+ var div = document.createElement("DIV");
3061
+ div.className = "file_messageblock_subheader_debugmessage_container"
3062
+ div.innerHTML = debug_data.data;
3063
+ return lab.outerHTML+div.outerHTML;
3064
  }
3065
 
3066
  /**
readme.txt CHANGED
@@ -149,6 +149,13 @@ There is an option in plugin's settings in Dashboard to relax the CSS rules, so
149
 
150
  == Changelog ==
151
 
 
 
 
 
 
 
 
152
  = 4.9.0 =
153
  * code further improved to reduce "Iptanus Server unreachable..." errors
154
  * checked Weglot Translate compatibility; /wp-admin/admin-ajax.php needs to be added to Exclusion URL list of Weglot configuration so that uploads can work
@@ -795,6 +802,9 @@ Initial version.
795
 
796
  == Upgrade Notice ==
797
 
 
 
 
798
  = 4.9.0 =
799
  Significant update to introduce some new features and improvements and fix some bugs.
800
 
149
 
150
  == Changelog ==
151
 
152
+ = 4.9.1 =
153
+ * added Maintenance action 'Purge All Data' that entirely erases the plugin from the website and deactivates it
154
+ * added advanced option 'Hide Invalid Uploaded Files' so that Uploaded Files page in Dashboard can show only valid uploads
155
+ * added advanced option 'Restrict Front-End Loading' to load the plugin only on specific pages or posts in order to reduce unnecessary workload on pages not containing the plugin
156
+ * code improved for better operation of the plugin when the website works behind a proxy
157
+ * added option in Clean Log to erase the files together with plugin data
158
+
159
  = 4.9.0 =
160
  * code further improved to reduce "Iptanus Server unreachable..." errors
161
  * checked Weglot Translate compatibility; /wp-admin/admin-ajax.php needs to be added to Exclusion URL list of Weglot configuration so that uploads can work
802
 
803
  == Upgrade Notice ==
804
 
805
+ = 4.9.1 =
806
+ Regular update to introduce some new features and improvements and fix some bugs.
807
+
808
  = 4.9.0 =
809
  Significant update to introduce some new features and improvements and fix some bugs.
810
 
release_notes.txt CHANGED
@@ -1,7 +1,10 @@
1
- <!-- --><span><strong>Version 4.9.0</strong> is a <strong>significant update</strong> due to addition of <strong>Microsoft OneDrive</strong> intgeration in the <strong>Pro</strong> version. The <strong>Free</strong> version introduces some improvements and bugs fixes as follows:</span>
2
  <ul style="list-style: disc; padding-left: 30px;">
3
- <li>Code further improved to reduce "Iptanus Server unreachable..." errors.</li>
4
- <li>Checked <strong>Weglot Translate</strong> compatibility; /wp-admin/admin-ajax.php needs to be added to Exclusion URL list of Weglot configuration so that uploads can work.</li>
 
 
 
5
  </ul>
6
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span><!-- -->
7
  <!-- -->
1
+ <!-- --><span><strong>Version 4.9.1</strong> is a <strong>regular</strong> update introducing some new features, improvements and bugs fixes as follows:</span>
2
  <ul style="list-style: disc; padding-left: 30px;">
3
+ <li>Added Maintenance action <strong>Purge All Data</strong> that entirely erases the plugin from the website and deactivates it.</li>
4
+ <li>Added advanced option <strong>Hide Invalid Uploaded Files</strong> so that <strong>Uploaded Files</strong> page in Dashboard can show only valid uploads.</li>
5
+ <li>Added advanced option <strong>Restrict Front-End Loading</strong> to load the plugin <strong>only on specific pages or posts</strong> in order to reduce unnecessary workload on pages not containing the plugin.</li>
6
+ <li>Code improved for better operation of the plugin when the website works behind a <strong>proxy</strong>.</li>
7
+ <li>Added option in <strong>Clean Log</strong> to <strong>erase</strong> the files together with plugin data.</li>
8
  </ul>
9
  For more details about this version's changes please visit the Release Notes of the plugin's </span><a href="http://www.iptanus.com/wordpress-plugins/wordpress-file-upload/">support page</a><span>.</span><!-- -->
10
  <!-- -->
wfu_loader.php ADDED
@@ -0,0 +1,611 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if( !session_id() ) { session_start(); }
3
+ /*Plugin Name: Wordpress File Upload
4
+ /*
5
+ Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
+ Description: Simple interface to upload files from a page.
7
+ Version: 4.9.1
8
+ Author: Nickolas Bossinas
9
+ Author URI: http://www.iptanus.com
10
+ */
11
+
12
+ /*
13
+ Wordpress File Upload (Wordpress Plugin)
14
+ Copyright (C) 2010-2018 Nickolas Bossinas
15
+ Contact me at http://www.iptanus.com
16
+
17
+ This program is free software: you can redistribute it and/or modify
18
+ it under the terms of the GNU General Public License as published by
19
+ the Free Software Foundation, either version 3 of the License, or
20
+ (at your option) any later version.
21
+
22
+ This program is distributed in the hope that it will be useful,
23
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ GNU General Public License for more details.
26
+
27
+ You should have received a copy of the GNU General Public License
28
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
29
+ */
30
+
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 v4.0 changes:
38
+ // filedata field added
39
+ $wfu_tb_log_version = "4.0";
40
+ $wfu_tb_userdata_version = "1.0";
41
+ $wfu_tb_dbxqueue_version = "1.0";
42
+
43
+ DEFINE("WPFILEUPLOAD_PLUGINFILE", __FILE__);
44
+ DEFINE("WPFILEUPLOAD_DIR", plugin_dir_url( WPFILEUPLOAD_PLUGINFILE ));
45
+ DEFINE("ABSWPFILEUPLOAD_DIR", plugin_dir_path( WPFILEUPLOAD_PLUGINFILE ));
46
+ add_shortcode("wordpress_file_upload", "wordpress_file_upload_handler");
47
+ //activation-deactivation hooks
48
+ register_activation_hook(__FILE__,'wordpress_file_upload_install');
49
+ register_deactivation_hook(__FILE__,'wordpress_file_upload_uninstall');
50
+ add_action('plugins_loaded', 'wordpress_file_upload_initialize');
51
+ add_action('plugins_loaded', 'wordpress_file_upload_update_db_check');
52
+ //widget
53
+ add_action( 'widgets_init', 'register_wfu_widget' );
54
+ //admin hooks
55
+ add_action('admin_init', 'wordpress_file_upload_admin_init');
56
+ add_action('admin_menu', 'wordpress_file_upload_add_admin_pages');
57
+ //load styles and scripts for front pages
58
+ if ( !is_admin() ) {
59
+ add_action( 'wp_enqueue_scripts', 'wfu_enqueue_frontpage_scripts' );
60
+ }
61
+ //add admin bar menu item of new uploaded files
62
+ add_action( 'wp_before_admin_bar_render', 'wfu_admin_toolbar_new_uploads', 999 );
63
+ //general ajax actions
64
+ add_action('wp_ajax_wfu_ajax_action', 'wfu_ajax_action_callback');
65
+ add_action('wp_ajax_nopriv_wfu_ajax_action', 'wfu_ajax_action_callback');
66
+ add_action('wp_ajax_wfu_ajax_action_ask_server', 'wfu_ajax_action_ask_server');
67
+ add_action('wp_ajax_nopriv_wfu_ajax_action_ask_server', 'wfu_ajax_action_ask_server');
68
+ add_action('wp_ajax_wfu_ajax_action_cancel_upload', 'wfu_ajax_action_cancel_upload');
69
+ add_action('wp_ajax_nopriv_wfu_ajax_action_cancel_upload', 'wfu_ajax_action_cancel_upload');
70
+ add_action('wp_ajax_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
71
+ add_action('wp_ajax_nopriv_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
72
+ add_action('wp_ajax_wfu_ajax_action_notify_wpfilebase', 'wfu_ajax_action_notify_wpfilebase');
73
+ add_action('wp_ajax_nopriv_wfu_ajax_action_notify_wpfilebase', 'wfu_ajax_action_notify_wpfilebase');
74
+ add_action('wp_ajax_wfu_ajax_action_save_shortcode', 'wfu_ajax_action_save_shortcode');
75
+ add_action('wp_ajax_wfu_ajax_action_check_page_contents', 'wfu_ajax_action_check_page_contents');
76
+ add_action('wp_ajax_wfu_ajax_action_read_subfolders', 'wfu_ajax_action_read_subfolders');
77
+ add_action('wp_ajax_wfu_ajax_action_download_file_invoker', 'wfu_ajax_action_download_file_invoker');
78
+ add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_invoker', 'wfu_ajax_action_download_file_invoker');
79
+ add_action('wp_ajax_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
80
+ add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
81
+ add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
82
+ add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
83
+ add_action('wp_ajax_wfu_ajax_action_get_uploadedfiles_page', 'wfu_ajax_action_get_uploadedfiles_page');
84
+ add_action('wp_ajax_wfu_ajax_action_get_adminbrowser_page', 'wfu_ajax_action_get_adminbrowser_page');
85
+ add_action('wp_ajax_wfu_ajax_action_include_file', 'wfu_ajax_action_include_file');
86
+ add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
87
+ add_action('wp_ajax_wfu_ajax_action_transfer_command', 'wfu_ajax_action_transfer_command');
88
+ add_action('wp_ajax_wfu_ajax_action_pdusers_get_users', 'wfu_ajax_action_pdusers_get_users');
89
+ //personal data related actions
90
+ add_action( 'show_user_profile', 'wfu_show_consent_profile_fields' );
91
+ add_action( 'edit_user_profile', 'wfu_show_consent_profile_fields' );
92
+ add_action( 'personal_options_update', 'wfu_update_consent_profile_fields' );
93
+ add_action( 'edit_user_profile_update', 'wfu_update_consent_profile_fields' );
94
+ //Media editor custom properties
95
+ if ( is_admin() ) add_action( 'attachment_submitbox_misc_actions', 'wfu_media_editor_properties', 11 );
96
+ //register internal filter that is executed before upload for classic uploader
97
+ add_filter("_wfu_before_upload", "wfu_classic_before_upload_handler", 10, 2);
98
+ wfu_include_lib();
99
+
100
+ function wordpress_file_upload_initialize() {
101
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
102
+ load_plugin_textdomain('wp-file-upload', false, dirname(plugin_basename (__FILE__)).'/languages');
103
+ wfu_initialize_i18n_strings();
104
+ //store the User State handler in a global variable for easy access by the
105
+ //plugin's routines
106
+ $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
107
+ $GLOBALS["wfu_user_state_handler"] = $plugin_options['userstatehandler'];
108
+ //add abspath in session for use by downloader; exclude internal ajax requests
109
+ if ( !isset($_POST["action"]) || ( $_POST["action"] != "wfu_ajax_action_wfu_call_async" && $_POST["action"] != "wfu_ajax_action_load_hook_code" ) )
110
+ WFU_USVAR_store_session('wfu_ABSPATH', wfu_abspath());
111
+ }
112
+
113
+ function register_wfu_widget() {
114
+ register_widget( 'WFU_Widget' );
115
+ }
116
+
117
+ function wfu_enqueue_frontpage_scripts() {
118
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
119
+ $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
120
+ $relaxcss = false;
121
+ if ( isset($plugin_options['relaxcss']) ) $relaxcss = ( $plugin_options['relaxcss'] == '1' );
122
+ //apply wfu_before_frontpage_scripts to get additional settings
123
+ $changable_data = array();
124
+ $ret_data = apply_filters('wfu_before_frontpage_scripts', $changable_data);
125
+ //if $ret_data contains 'return_value' key then no scripts will be enqueued
126
+ if ( isset($ret_data['return_value']) ) return $ret_data['return_value'];
127
+
128
+ if ( $relaxcss ) {
129
+ wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_relaxed.css');
130
+ wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_safe_relaxed.css');
131
+ }
132
+ else {
133
+ wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style.css');
134
+ wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_safe.css');
135
+ }
136
+ wp_enqueue_style('wordpress-file-upload-adminbar-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_adminbarstyle.css');
137
+ //do not load JQuery UI css if $ret_data denotes incompatibility issues
138
+ if ( ( !isset($ret_data["correct_NextGenGallery_incompatibility"]) || $ret_data["correct_NextGenGallery_incompatibility"] != "true" ) &&
139
+ ( !isset($ret_data["correct_JQueryUI_incompatibility"]) || $ret_data["correct_JQueryUI_incompatibility"] != "true" ) )
140
+ wp_enqueue_style('jquery-ui-css', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui.min.css');
141
+ //do not load timepicker css if $ret_data exclude_timepicker flag is true
142
+ if ( !isset($ret_data["exclude_timepicker"]) || $ret_data["exclude_timepicker"] != "true" )
143
+ wp_enqueue_style('jquery-ui-timepicker-addon-css', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui-timepicker-addon.min.css');
144
+ wp_enqueue_script('json2');
145
+ wp_enqueue_script('wordpress_file_upload_script', WPFILEUPLOAD_DIR.'js/wordpress_file_upload_functions.js');
146
+ //do not load timepicker js if $ret_data exclude_timepicker flag is true
147
+ if ( !isset($ret_data["exclude_timepicker"]) || $ret_data["exclude_timepicker"] != "true" ) {
148
+ wp_enqueue_script('jquery-ui-slider');
149
+ wp_enqueue_script('jquery-ui-timepicker-addon-js', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui-timepicker-addon.min.js', array("jquery-ui-datepicker"));
150
+ }
151
+ }
152
+
153
+ function wfu_include_lib() {
154
+ $dir = plugin_dir_path( __FILE__ )."lib/";
155
+ if ( $handle = opendir($dir) ) {
156
+ $blacklist = array('.', '..');
157
+ while ( false !== ($file = readdir($handle)) )
158
+ if ( !in_array($file, $blacklist) && substr($file, 0, 1) != "_" )
159
+ include_once $dir.$file;
160
+ closedir($handle);
161
+ }
162
+ if ( $handle = opendir(plugin_dir_path( __FILE__ )) ) {
163
+ closedir($handle);
164
+ }
165
+ }
166
+
167
+
168
+ /* exit if we are in admin pages (in case of ajax call) */
169
+ if ( is_admin() ) return;
170
+
171
+ function wordpress_file_upload_handler($incomingfrompost) {
172
+ //replace old attribute definitions with new ones
173
+ $incomingfrompost = wfu_old_to_new_attributes($incomingfrompost);
174
+ //process incoming attributes assigning defaults if required
175
+ $defs_indexed = wfu_shortcode_attribute_definitions_adjusted($incomingfrompost);
176
+ $incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
177
+ //run function that actually does the work of the plugin
178
+ $wordpress_file_upload_output = wordpress_file_upload_function($incomingfrompost);
179
+ //send back text to replace shortcode in post
180
+ return $wordpress_file_upload_output;
181
+ }
182
+
183
+ function wordpress_file_upload_browser_handler($incomingfrompost) {
184
+ //process incoming attributes assigning defaults if required
185
+ $defs = wfu_browser_attribute_definitions();
186
+ $defs_indexed = array();
187
+ foreach ( $defs as $def ) $defs_indexed[$def["attribute"]] = $def["value"];
188
+ $incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
189
+ //run function that actually does the work of the plugin
190
+ $wordpress_file_upload_browser_output = wordpress_file_upload_browser_function($incomingfrompost);
191
+ //send back text to replace shortcode in post
192
+ return $wordpress_file_upload_browser_output;
193
+ }
194
+
195
+ function wordpress_file_upload_function($incomingfromhandler) {
196
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
197
+ global $post;
198
+ global $blog_id;
199
+ $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
200
+ $shortcode_tag = 'wordpress_file_upload';
201
+ $params = wfu_plugin_parse_array($incomingfromhandler);
202
+ //sanitize params
203
+ $params = wfu_sanitize_shortcode_array($params, $shortcode_tag);
204
+ $sid = $params["uploadid"];
205
+ // store current page and blog id in params array
206
+ $params["pageid"] = $post->ID;
207
+ $params["blogid"] = $blog_id;
208
+
209
+ $token_sid = 'wfu_token_'.$sid;
210
+ if ( !WFU_USVAR_exists($token_sid) || WFU_USVAR($token_sid) == "" )
211
+ WFU_USVAR_store($token_sid, uniqid(mt_rand(), TRUE));
212
+ //store the server environment (32 or 64bit) for use when checking file size limits
213
+ $params["php_env"] = wfu_get_server_environment();
214
+
215
+ $user = wp_get_current_user();
216
+ $widths = wfu_decode_dimensions($params["widths"]);
217
+ $heights = wfu_decode_dimensions($params["heights"]);
218
+ //additional parameters to pass to visualization routines
219
+ $additional_params = array( );
220
+ $additional_params['widths'] = $widths;
221
+ $additional_params['heights'] = $heights;
222
+ $additional_params["require_consent"] = ( $plugin_options["personaldata"] == "1" && wfu_check_user_consent($user) == "" && $params["askconsent"] == "true" );
223
+
224
+ $uploadedfile = 'uploadedfile_'.$sid;
225
+ $hiddeninput = 'hiddeninput_'.$sid;
226
+ $adminerrorcodes = 'adminerrorcodes_'.$sid;
227
+
228
+ //set necessary parameters to be passed to client initialization function
229
+ $init_params = array();
230
+ $init_params["shortcode_id"] = $sid;
231
+ $init_params["shortcode_tag"] = $shortcode_tag;
232
+ $init_params["container_id"] = $shortcode_tag.'_block_'.$sid;
233
+ $init_params["session"] = WFU_USVAR($token_sid);
234
+ $init_params["testmode"] = ( $params["testmode"] == "true" );
235
+ $init_params["widgetid"] = $params["widgetid"];
236
+ $init_params["require_consent"] = $additional_params["require_consent"];
237
+ $init_params["consent_format"] = $params["consentformat"];
238
+ $init_params["consent_question"] = preg_replace("/:(\w):/", "<a href=\"".$params["consentdisclaimer"]."\">$1</a>", $params["consentquestion"]);
239
+ //add allow no file flag
240
+ $init_params["allownofile"] = ( $params["allownofile"] == "true" );
241
+ //add params related to visual editor button
242
+ if ( current_user_can( 'manage_options' ) ) {
243
+ $init_params["post_id"] = $post->ID;
244
+ $init_params["post_hash"] = hash('md5', $post->post_content);
245
+ }
246
+
247
+ //check if user is allowed to view plugin, otherwise do not generate it
248
+ $uploadroles = explode(",", $params["uploadrole"]);
249
+ foreach ( $uploadroles as &$uploadrole ) {
250
+ $uploadrole = trim($uploadrole);
251
+ }
252
+ $plugin_upload_user_role = wfu_get_user_role($user, $uploadroles);
253
+ if ( $plugin_upload_user_role == 'nomatch' ) return apply_filters("_wfu_file_upload_hide_output", "");
254
+
255
+ //activate debug mode only for admins
256
+ if ( $plugin_upload_user_role != 'administrator' ) $params["debugmode"] = "false";
257
+
258
+ $params["adminmessages"] = ( $params["adminmessages"] == "true" && $plugin_upload_user_role == 'administrator' );
259
+ // define variable to hold any additional admin errors coming before processing of files (e.g. due to redirection)
260
+ $params["adminerrors"] = "";
261
+
262
+ /* Define dynamic upload path from variables */
263
+ $search = array ('/%userid%/', '/%username%/', '/%blogid%/', '/%pageid%/', '/%pagetitle%/');
264
+ if ( is_user_logged_in() ) $username = $user->user_login;
265
+ else $username = "guests";
266
+ $replace = array ($user->ID, $username, $blog_id, $post->ID, get_the_title($post->ID));
267
+ $params["uploadpath"] = preg_replace($search, $replace, $params["uploadpath"]);
268
+
269
+ /* Determine if userdata fields have been defined */
270
+ $userdata_fields = array();
271
+ $userdata_occurrencies = substr_count($params["placements"], "userdata");
272
+ if ( $userdata_occurrencies == 0 ) $userdata_occurrencies = 1;
273
+ if ( $params["userdata"] == "true" ) {
274
+ for ( $i = 1; $i <= $userdata_occurrencies; $i++ ) {
275
+ $userdata_fields2 = wfu_parse_userdata_attribute($params["userdatalabel".( $i > 1 ? $i : "" )]);
276
+ foreach ( $userdata_fields2 as $key => $item ) $userdata_fields2[$key]["occurrence"] = $i;
277
+ $userdata_fields = array_merge($userdata_fields, $userdata_fields2);
278
+ }
279
+ }
280
+ $params["userdata_fields"] = $userdata_fields;
281
+
282
+ /* If medialink or postlink is activated, then subfolders are deactivated */
283
+ if ( $params["medialink"] == "true" || $params["postlink"] == "true" ) $params["askforsubfolders"] = "false";
284
+
285
+ /* Generate the array of subfolder paths */
286
+ $params['subfoldersarray'] = wfu_get_subfolders_paths($params);
287
+
288
+
289
+ /* in case that webcam is activated, then some elements related to file
290
+ selection need to be removed */
291
+ if ( strpos($params["placements"], "webcam") !== false && $params["webcam"] == "true" ) {
292
+ $params["placements"] = wfu_placements_remove_item($params["placements"], "filename");
293
+ $params["placements"] = wfu_placements_remove_item($params["placements"], "selectbutton");
294
+ $params["singlebutton"] = "false";
295
+ $params["uploadbutton"] = $params["uploadmediabutton"];
296
+ }
297
+
298
+ //____________________________________________________________________________________________________________________________________________________________________________________
299
+
300
+ if ( $params['forceclassic'] != "true" ) {
301
+ //**************section to put additional options inside params array**************
302
+ $params['subdir_selection_index'] = "-1";
303
+ //**************end of section of additional options inside params array**************
304
+
305
+
306
+ // below this line no other changes to params array are allowed
307
+
308
+
309
+ //**************section to save params as Wordpress options**************
310
+ // every params array is indexed (uniquely identified) by three fields:
311
+ // - the page that contains the shortcode
312
+ // - the id of the shortcode instance (because there may be more than one instances of the shortcode inside a page)
313
+ // - the user that views the plugin (because some items of the params array are affected by the user name)
314
+ // the wordpress option "wfu_params_index" holds an array of combinations of these three fields, together with a randomly generated string that corresponds to these fields.
315
+ // the wordpress option "wfu_params_xxx", where xxx is the randomly generated string, holds the params array (encoded to string) that corresponds to this string.
316
+ // the structure of the "wfu_params_index" option is as follows: "a1||b1||c1||d1&&a2||b2||c2||d2&&...", where
317
+ // - a is the randomly generated string (16 characters)
318
+ // - b is the page id
319
+ // - c is the shortcode id
320
+ // - d is the user name
321
+ $params_index = wfu_generate_current_params_index($sid, $user->user_login);
322
+ $params_str = wfu_encode_array_to_string($params);
323
+ update_option('wfu_params_'.$params_index, $params_str);
324
+ $init_params["params_index"] = $params_index;
325
+ $init_params["debugmode"] = ( $params["debugmode"] == "true" );
326
+ $init_params["is_admin"] = ( $plugin_upload_user_role == "administrator" );
327
+ $init_params["has_filters"] = has_filter("wfu_before_upload");
328
+ $init_params["error_header"] = $params["errormessage"];
329
+ $init_params["fail_colors"] = $params["failmessagecolors"];
330
+ }
331
+
332
+
333
+ /* set the template that will be used, default is empty (the original) */
334
+ $params["uploadertemplate"] = "";
335
+ // $params["uploadertemplate"] = "Custom1";
336
+ $params["uploadertemplate"] = apply_filters("_wfu_uploader_template", $params["uploadertemplate"], $params);
337
+ $uploadertemplate = wfu_get_uploader_template($params["uploadertemplate"]);
338
+ /* Compose the html code for the plugin */
339
+ $wordpress_file_upload_output = "";
340
+ $wordpress_file_upload_output .= wfu_init_run_js_script();
341
+ $plugin_style = "";
342
+ if ( $widths["plugin"] != "" ) $plugin_style .= 'width: '.$widths["plugin"].'; ';
343
+ if ( $heights["plugin"] != "" ) $plugin_style .= 'height: '.$heights["plugin"].'; ';
344
+ if ( $plugin_style != "" ) $plugin_style = ' style="'.$plugin_style.'"';
345
+ $wordpress_file_upload_output .= "\n".'<div id="'.$init_params["container_id"].'" class="file_div_clean'.( $params["fitmode"] == "responsive" ? '_responsive_container' : '' ).' wfu_container"'.$plugin_style.'>';
346
+ $wordpress_file_upload_output .= "\n".'<!-- Using template '.call_user_func(array($uploadertemplate, 'get_name')).' -->';
347
+ //read indexed component definitions
348
+ $component_output = "";
349
+ $css = "";
350
+ $js = "";
351
+ /* Add generic uploadform code to output from template */
352
+ $wordpress_file_upload_output .= wfu_template_to_HTML("base", $params, array(), 0);
353
+ /* Continue with uploadform elements */
354
+ $components = wfu_component_definitions();
355
+ $components_indexed = array();
356
+ foreach ( $components as $component ) {
357
+ $components_indexed[$component['id']] = $component;
358
+ $components_indexed[$component['id']]['occurrencies'] = 0;
359
+ }
360
+ $itemplaces = explode("/", $params["placements"]);
361
+ foreach ( $itemplaces as $section ) {
362
+ $items_in_section = explode("+", trim($section));
363
+ $section_array = array( $params );
364
+ foreach ( $items_in_section as $item_in_section ) {
365
+ $item_in_section = strtolower(trim($item_in_section));
366
+ if ( isset($components_indexed[$item_in_section]) && ( $components_indexed[$item_in_section]['multiplacements'] || $components_indexed[$item_in_section]['occurrencies'] == 0 ) ) {
367
+ $components_indexed[$item_in_section]['occurrencies'] ++;
368
+ $occurrence_index = ( $components_indexed[$item_in_section]['multiplacements'] ? $components_indexed[$item_in_section]['occurrencies'] : 0 );
369
+ if ( $item_in_section == "title" ) array_push($section_array, wfu_prepare_title_block($params, $additional_params, $occurrence_index));
370
+ elseif ( $item_in_section == "filename" ) array_push($section_array, wfu_prepare_textbox_block($params, $additional_params, $occurrence_index));
371
+ elseif ( $item_in_section == "selectbutton" ) array_push($section_array, wfu_prepare_uploadform_block($params, $additional_params, $occurrence_index));
372
+ elseif ( $item_in_section == "uploadbutton" && $params["singlebutton"] != "true" ) array_push($section_array, wfu_prepare_submit_block($params, $additional_params, $occurrence_index));
373
+ elseif ( $item_in_section == "subfolders" ) array_push($section_array, wfu_prepare_subfolders_block($params, $additional_params, $occurrence_index));
374
+ elseif ( $item_in_section == "progressbar" ) array_push($section_array, wfu_prepare_progressbar_block($params, $additional_params, $occurrence_index));
375
+ elseif ( $item_in_section == "message" ) array_push($section_array, wfu_prepare_message_block($params, $additional_params, $occurrence_index));
376
+ elseif ( $item_in_section == "userdata" && $params["userdata"] == "true" ) array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, $occurrence_index));
377
+ elseif ( $item_in_section == "consent" && $additional_params["require_consent"] ) array_push($section_array, wfu_prepare_consent_block($params, $additional_params, $occurrence_index));
378
+ elseif ( $item_in_section == "webcam" && $params["webcam"] == "true" ) array_push($section_array, wfu_prepare_webcam_block($params, $additional_params, $occurrence_index));
379
+ }
380
+ }
381
+ wfu_extract_css_js_from_components($section_array, $css, $js);
382
+ $component_output .= call_user_func_array("wfu_add_div", $section_array);
383
+ }
384
+ /* Append mandatory blocks, if have not been included in placements attribute */
385
+ if ( $params["userdata"] == "true" && strpos($params["placements"], "userdata") === false ) {
386
+ $section_array = array( $params );
387
+ array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, 0));
388
+ wfu_extract_css_js_from_components($section_array, $css, $js);
389
+ $component_output .= call_user_func_array("wfu_add_div", $section_array);
390
+ }
391
+ if ( $additional_params["require_consent"] && strpos($params["placements"], "consent") === false ) {
392
+ $section_array = array( $params );
393
+ array_push($section_array, wfu_prepare_consent_block($params, $additional_params, 0));
394
+ wfu_extract_css_js_from_components($section_array, $css, $js);
395
+ $component_output .= call_user_func_array("wfu_add_div", $section_array);
396
+ }
397
+ if ( strpos($params["placements"], "selectbutton") === false ) {
398
+ $section_array = array( $params );
399
+ array_push($section_array, wfu_prepare_uploadform_block($params, $additional_params, 0));
400
+ wfu_extract_css_js_from_components($section_array, $css, $js);
401
+ $component_output .= call_user_func_array("wfu_add_div", $section_array);
402
+ }
403
+ if ( strpos($params["placements"], "uploadbutton") === false ) $params["singlebutton"] = "true";
404
+
405
+ //set some more parameters for the initialization script
406
+ $init_params["is_formupload"] = ( $params['forceclassic'] == "true" );
407
+ $init_params["singlebutton"] = ( $params["singlebutton"] == "true" );
408
+ $init_params["resetmode"] = $params["resetmode"];
409
+
410
+ //output css styling rules
411
+ if ( $css != "" ) {
412
+ //relax css rules if this option is enabled
413
+ if ( $plugin_options['relaxcss'] == '1' ) $css = preg_replace('#.*?/\*relax\*/\s*#', '', $css);
414
+ $wordpress_file_upload_output .= wfu_css_to_HTML($css);
415
+ }
416
+ //output javascript code
417
+ if ( $js != "" ) {
418
+ //add initialization of the object of the upload form
419
+ $wfu_js = 'var WFU_JS_'.$sid.' = function() {';
420
+ $wfu_js .= "\n".'GlobalData.WFU['.$sid.'] = '.wfu_PHP_array_to_JS_object($init_params).'; GlobalData.WFU.n.push('.$sid.');';
421
+ $wfu_js .= "\n".$js;
422
+ $wfu_js .= "\n".'}';
423
+ $wfu_js .= "\n".'wfu_run_js("window", "WFU_JS_'.$sid.'");';
424
+ $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
425
+ }
426
+ //add visual editor overlay if the current user is administrator
427
+ if ( current_user_can( 'manage_options' ) ) {
428
+ $wordpress_file_upload_output .= wfu_add_visual_editor_button($shortcode_tag, $params);
429
+ }
430
+ //add components' html output
431
+ $wordpress_file_upload_output .= $component_output;
432
+
433
+ /* Pass constants to javascript and run plugin post-load actions */
434
+ $consts = wfu_set_javascript_constants();
435
+ $handler = 'function() { wfu_Initialize_Consts("'.$consts.'"); wfu_Load_Code_Connectors('.$sid.'); wfu_plugin_load_action('.$sid.'); }';
436
+ $wfu_js = 'if (typeof wfu_addLoadHandler == "undefined") function wfu_addLoadHandler(handler) { if(window.addEventListener) { window.addEventListener("load", handler, false); } else if(window.attachEvent) { window.attachEvent("onload", handler); } else { window["onload"] = handler; } }';
437
+ $wfu_js .= "\n".'wfu_addLoadHandler('.$handler.');';
438
+ $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
439
+ $wordpress_file_upload_output .= '</div>';
440
+ // $wordpress_file_upload_output .= '<div>';
441
+ // $wordpress_file_upload_output .= wfu_test_admin();
442
+ // $wordpress_file_upload_output .= '</div>';
443
+
444
+ // The plugin uses sessions in order to detect if the page was loaded due to file upload or
445
+ // because the user pressed the Refresh button (or F5) of the page.
446
+ // In the second case we do not want to perform any file upload, so we abort the rest of the script.
447
+ $check_refresh_sid = 'wfu_check_refresh_'.$sid;
448
+ if ( !WFU_USVAR_exists($check_refresh_sid) || WFU_USVAR($check_refresh_sid) != "form button pressed" ) {
449
+ WFU_USVAR_store($check_refresh_sid, 'do not process');
450
+ $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
451
+ $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
452
+ return $wordpress_file_upload_output."\n";
453
+ }
454
+ WFU_USVAR_store($check_refresh_sid, 'do not process');
455
+ $params["upload_start_time"] = WFU_USVAR('wfu_start_time_'.$sid);
456
+
457
+ // The plugin uses two ways to upload the file:
458
+ // - The first one uses classic functionality of an HTML form (highest compatibility with browsers but few capabilities).
459
+ // - The second uses ajax (HTML5) functionality (medium compatibility with browsers but many capabilities, like no page refresh and progress bar).
460
+ // The plugin loads using ajax functionality by default, however if it detects that ajax functionality is not supported, it will automatically switch to classic functionality.
461
+ // The next line checks to see if the form was submitted using ajax or classic functionality.
462
+ // If the uploaded file variable stored in $_FILES ends with "_redirected", then it means that ajax functionality is not supported and the plugin must switch to classic functionality.
463
+ if ( isset($_FILES[$uploadedfile.'_redirected']) ) $params['forceclassic'] = "true";
464
+
465
+ if ( $params['forceclassic'] != "true" ) {
466
+ $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
467
+ $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
468
+ return $wordpress_file_upload_output."\n";
469
+ }
470
+
471
+ // The following code is executed in case of non-ajax uploads to process the files.
472
+ // Consecutive checks are performed in order to verify and approve the upload of files
473
+ $_REQUEST = stripslashes_deep($_REQUEST);
474
+ $_POST = stripslashes_deep($_POST);
475
+ $wfu_checkpass = true;
476
+
477
+ // First we test that WP nonce passes the check
478
+ $wfu_checkpass = ( $wfu_checkpass && isset($_REQUEST["wfu_uploader_nonce"]) && wp_verify_nonce( $_REQUEST["wfu_uploader_nonce"], "wfu-uploader-nonce" ) !== false );
479
+
480
+ $unique_id = ( isset($_POST['uniqueuploadid_'.$sid]) ? sanitize_text_field($_POST['uniqueuploadid_'.$sid]) : "" );
481
+ // Check that upload_id is valid
482
+ $wfu_checkpass = ( $wfu_checkpass && strlen($unique_id) == 10 );
483
+
484
+
485
+ if ( $wfu_checkpass ) {
486
+ //process any error messages due to redirection to non-ajax upload
487
+ if ( isset( $_POST[$adminerrorcodes] ) ) {
488
+ $code = $_POST[$adminerrorcodes];
489
+ if ( $code == "" ) $params['adminerrors'] = "";
490
+ elseif ( $code == "1" || $code == "2" || $code == "3" ) $params['adminerrors'] = constant('WFU_ERROR_REDIRECTION_ERRORCODE'.$code);
491
+ else $params['adminerrors'] = WFU_ERROR_REDIRECTION_ERRORCODE0;
492
+ }
493
+
494
+ $params['subdir_selection_index'] = -1;
495
+ if ( isset( $_POST[$hiddeninput] ) ) $params['subdir_selection_index'] = sanitize_text_field($_POST[$hiddeninput]);
496
+
497
+ //in case that that the upload has been cancelled then proceed
498
+ //accordingly to notify the user
499
+ $uploadstatus_id = "wfu_uploadstatus_".$unique_id;
500
+ if ( WFU_USVAR_exists($uploadstatus_id) && WFU_USVAR($uploadstatus_id) == 0 ) {
501
+ $safe_output = "17;".WFU_VAR("WFU_DEFAULTMESSAGECOLORS").";0";
502
+ $wfu_process_file_array_str = " ";
503
+ $js_script_enc = "";
504
+ }
505
+ else {
506
+ //update consent status of user
507
+ if ( $additional_params["require_consent"] ) {
508
+ if ( !isset($_POST['consent_result']) ) die();
509
+ $consent_result = ( $_POST['consent_result'] == "yes" ? "yes" : ( $_POST['consent_result'] == "no" ? "no" : "" ) );
510
+ wfu_update_user_consent($user, $consent_result);
511
+ }
512
+ $wfu_process_file_array = wfu_process_files($params, 'no_ajax');
513
+ $safe_output = $wfu_process_file_array["general"]['safe_output'];
514
+ unset($wfu_process_file_array["general"]['safe_output']);
515
+ //javascript code generated from individual wfu_after_upload_filters is not executed in non-ajax uploads
516
+ unset($wfu_process_file_array["general"]['js_script']);
517
+ $js_script_enc = "";
518
+ //execute after upload filters
519
+ $ret = wfu_execute_after_upload_filters($sid, $unique_id);
520
+ if ( $ret["js_script"] != "" ) $js_script_enc = wfu_plugin_encode_string($ret["js_script"]);
521
+ $wfu_process_file_array_str = wfu_encode_array_to_string($wfu_process_file_array);
522
+ }
523
+
524
+ $ProcessUploadComplete_functiondef = 'function(){wfu_ProcessUploadComplete('.$sid.', 1, "'.$wfu_process_file_array_str.'", "no-ajax", "'.$safe_output.'", [false, null, false], "fileupload", "'.$js_script_enc.'");}';
525
+ $wfu_js = 'wfu_addLoadHandler('.$ProcessUploadComplete_functiondef.');';
526
+ $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
527
+ }
528
+
529
+ $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
530
+ $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
531
+ return $wordpress_file_upload_output."\n";
532
+ }
533
+
534
+ function wfu_add_visual_editor_button($shortcode_tag, $params) {
535
+ return wfu_template_to_HTML("visualeditorbutton", $params, array( "shortcode_tag" => $shortcode_tag ), 0);
536
+ }
537
+
538
+ function wfu_post_plugin_actions($params) {
539
+ $echo_str = '';
540
+
541
+ return $echo_str;
542
+ }
543
+
544
+ function wfu_get_subfolders_paths($params) {
545
+ $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
546
+ $subfolder_paths = array ( );
547
+ if ( $params["askforsubfolders"] == "true" && $params["testmode"] != "true" ) {
548
+ array_push($subfolder_paths, "");
549
+ if ( substr($params["subfoldertree"], 0, 4) == "auto" ) {
550
+ $upload_directory = wfu_upload_plugin_full_path($params);
551
+ $dirtree = wfu_getTree($upload_directory);
552
+ foreach ( $dirtree as &$dir ) $dir = '*'.$dir;
553
+ $params["subfoldertree"] = implode(',', $dirtree);
554
+ }
555
+ $subfolders = wfu_parse_folderlist($params["subfoldertree"]);
556
+ if ( count($subfolders['path']) == 0 ) array_push($subfolders['path'], "");
557
+ foreach ( $subfolders['path'] as $subfolder ) array_push($subfolder_paths, $subfolder);
558
+ }
559
+
560
+ return $subfolder_paths;
561
+ }
562
+
563
+ function wfu_old_to_new_attributes($shortcode_attrs) {
564
+ //old to new attribute definitions
565
+ $old_to_new = array(
566
+ "dublicatespolicy" => "duplicatespolicy"
567
+ );
568
+ //implement changes
569
+ foreach ( $old_to_new as $old => $new ) {
570
+ if ( isset($shortcode_attrs[$old]) ) {
571
+ $shortcode_attrs[$new] = $shortcode_attrs[$old];
572
+ unset($shortcode_attrs[$old]);
573
+ }
574
+ }
575
+ return $shortcode_attrs;
576
+ }
577
+
578
+ function wfu_classic_before_upload_handler($ret, $attr) {
579
+ //run only if start_time exists in $_REQUEST parameters
580
+ if ( !isset($_REQUEST['start_time']) ) return $ret;
581
+ if ( $ret["status"] == "die" ) return $ret;
582
+ $start_time = sanitize_text_field( $_REQUEST["start_time"] );
583
+ $sid = $attr["sid"];
584
+ if ( $sid == "" ) {
585
+ $ret["status"] = "die";
586
+ return $ret;
587
+ }
588
+ if ( $ret["status"] != "error" ) {
589
+ $ret["status"] = "success";
590
+ WFU_USVAR_store('wfu_check_refresh_'.$sid, 'form button pressed');
591
+ WFU_USVAR_store('wfu_start_time_'.$sid, $start_time);
592
+ }
593
+ return $ret;
594
+ }
595
+
596
+ function wfu_execute_after_upload_filters($sid, $unique_id) {
597
+ //apply internal filters from extensions
598
+ $ret = array( "echo" => "" );
599
+ $files = array();
600
+ $filedata_id = "filedata_".$unique_id;
601
+ if ( WFU_USVAR_exists($filedata_id) ) $files = WFU_USVAR($filedata_id);
602
+ $attr = array( "sid" => $sid, "unique_id" => $unique_id, "files" => $files );
603
+ $ret = apply_filters("_wfu_after_upload", $ret, $attr);
604
+ //then apply any custom filters created by admin
605
+ $echo_str = "";
606
+ $ret = array( "js_script" => "" );
607
+ $ret = apply_filters("wfu_after_upload", $ret, $attr);
608
+ return $ret;
609
+ }
610
+
611
+ ?>
wordpress_file_upload.php CHANGED
@@ -1,615 +1,30 @@
1
  <?php
2
- if( !session_id() ) { session_start(); }
3
- /*Plugin Name: Wordpress File Upload
4
- /*
5
- Plugin URI: http://www.iptanus.com/support/wordpress-file-upload
6
- Description: Simple interface to upload files from a page.
7
- Version: 4.9.0
8
- Author: Nickolas Bossinas
9
- Author URI: http://www.iptanus.com
10
- */
11
-
12
- /*
13
- Wordpress File Upload (Wordpress Plugin)
14
- Copyright (C) 2010-2018 Nickolas Bossinas
15
- Contact me at http://www.iptanus.com
16
-
17
- This program is free software: you can redistribute it and/or modify
18
- it under the terms of the GNU General Public License as published by
19
- the Free Software Foundation, either version 3 of the License, or
20
- (at your option) any later version.
21
-
22
- This program is distributed in the hope that it will be useful,
23
- but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- GNU General Public License for more details.
26
-
27
- You should have received a copy of the GNU General Public License
28
- along with this program. If not, see <http://www.gnu.org/licenses/>.
29
- */
30
-
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 v4.0 changes:
38
- // filedata field added
39
- $wfu_tb_log_version = "4.0";
40
- $wfu_tb_userdata_version = "1.0";
41
- $wfu_tb_dbxqueue_version = "1.0";
42
 
43
  /* do not load plugin if this is the login page */
44
  $uri = $_SERVER['REQUEST_URI'];
45
  if ( strpos($uri, 'wp-login.php') !== false ) return;
46
 
47
- DEFINE("WPFILEUPLOAD_PLUGINFILE", __FILE__);
48
- DEFINE("WPFILEUPLOAD_DIR", plugin_dir_url( WPFILEUPLOAD_PLUGINFILE ));
49
- DEFINE("ABSWPFILEUPLOAD_DIR", plugin_dir_path( WPFILEUPLOAD_PLUGINFILE ));
50
- add_shortcode("wordpress_file_upload", "wordpress_file_upload_handler");
51
- //activation-deactivation hooks
52
- register_activation_hook(__FILE__,'wordpress_file_upload_install');
53
- register_deactivation_hook(__FILE__,'wordpress_file_upload_uninstall');
54
- add_action('plugins_loaded', 'wordpress_file_upload_initialize');
55
- add_action('plugins_loaded', 'wordpress_file_upload_update_db_check');
56
- //widget
57
- add_action( 'widgets_init', 'register_wfu_widget' );
58
- //admin hooks
59
- add_action('admin_init', 'wordpress_file_upload_admin_init');
60
- add_action('admin_menu', 'wordpress_file_upload_add_admin_pages');
61
- //load styles and scripts for front pages
62
  if ( !is_admin() ) {
63
- add_action( 'wp_enqueue_scripts', 'wfu_enqueue_frontpage_scripts' );
64
- }
65
- //add admin bar menu item of new uploaded files
66
- add_action( 'wp_before_admin_bar_render', 'wfu_admin_toolbar_new_uploads', 999 );
67
- //general ajax actions
68
- add_action('wp_ajax_wfu_ajax_action', 'wfu_ajax_action_callback');
69
- add_action('wp_ajax_nopriv_wfu_ajax_action', 'wfu_ajax_action_callback');
70
- add_action('wp_ajax_wfu_ajax_action_ask_server', 'wfu_ajax_action_ask_server');
71
- add_action('wp_ajax_nopriv_wfu_ajax_action_ask_server', 'wfu_ajax_action_ask_server');
72
- add_action('wp_ajax_wfu_ajax_action_cancel_upload', 'wfu_ajax_action_cancel_upload');
73
- add_action('wp_ajax_nopriv_wfu_ajax_action_cancel_upload', 'wfu_ajax_action_cancel_upload');
74
- add_action('wp_ajax_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
75
- add_action('wp_ajax_nopriv_wfu_ajax_action_send_email_notification', 'wfu_ajax_action_send_email_notification');
76
- add_action('wp_ajax_wfu_ajax_action_notify_wpfilebase', 'wfu_ajax_action_notify_wpfilebase');
77
- add_action('wp_ajax_nopriv_wfu_ajax_action_notify_wpfilebase', 'wfu_ajax_action_notify_wpfilebase');
78
- add_action('wp_ajax_wfu_ajax_action_save_shortcode', 'wfu_ajax_action_save_shortcode');
79
- add_action('wp_ajax_wfu_ajax_action_check_page_contents', 'wfu_ajax_action_check_page_contents');
80
- add_action('wp_ajax_wfu_ajax_action_read_subfolders', 'wfu_ajax_action_read_subfolders');
81
- add_action('wp_ajax_wfu_ajax_action_download_file_invoker', 'wfu_ajax_action_download_file_invoker');
82
- add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_invoker', 'wfu_ajax_action_download_file_invoker');
83
- add_action('wp_ajax_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
84
- add_action('wp_ajax_nopriv_wfu_ajax_action_download_file_monitor', 'wfu_ajax_action_download_file_monitor');
85
- add_action('wp_ajax_wfu_ajax_action_edit_shortcode', 'wfu_ajax_action_edit_shortcode');
86
- add_action('wp_ajax_wfu_ajax_action_get_historylog_page', 'wfu_ajax_action_get_historylog_page');
87
- add_action('wp_ajax_wfu_ajax_action_get_uploadedfiles_page', 'wfu_ajax_action_get_uploadedfiles_page');
88
- add_action('wp_ajax_wfu_ajax_action_get_adminbrowser_page', 'wfu_ajax_action_get_adminbrowser_page');
89
- add_action('wp_ajax_wfu_ajax_action_include_file', 'wfu_ajax_action_include_file');
90
- add_action('wp_ajax_wfu_ajax_action_update_envar', 'wfu_ajax_action_update_envar');
91
- add_action('wp_ajax_wfu_ajax_action_transfer_command', 'wfu_ajax_action_transfer_command');
92
- add_action('wp_ajax_wfu_ajax_action_pdusers_get_users', 'wfu_ajax_action_pdusers_get_users');
93
- //personal data related actions
94
- add_action( 'show_user_profile', 'wfu_show_consent_profile_fields' );
95
- add_action( 'edit_user_profile', 'wfu_show_consent_profile_fields' );
96
- add_action( 'personal_options_update', 'wfu_update_consent_profile_fields' );
97
- add_action( 'edit_user_profile_update', 'wfu_update_consent_profile_fields' );
98
- //Media editor custom properties
99
- if ( is_admin() ) add_action( 'attachment_submitbox_misc_actions', 'wfu_media_editor_properties', 11 );
100
- //register internal filter that is executed before upload for classic uploader
101
- add_filter("_wfu_before_upload", "wfu_classic_before_upload_handler", 10, 2);
102
- wfu_include_lib();
103
-
104
- function wordpress_file_upload_initialize() {
105
- $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
106
- load_plugin_textdomain('wp-file-upload', false, dirname(plugin_basename (__FILE__)).'/languages');
107
- wfu_initialize_i18n_strings();
108
- //store the User State handler in a global variable for easy access by the
109
- //plugin's routines
110
- $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
111
- $GLOBALS["wfu_user_state_handler"] = $plugin_options['userstatehandler'];
112
- //add abspath in session for use by downloader; exclude internal ajax requests
113
- if ( !isset($_POST["action"]) || ( $_POST["action"] != "wfu_ajax_action_wfu_call_async" && $_POST["action"] != "wfu_ajax_action_load_hook_code" ) )
114
- WFU_USVAR_store_session('wfu_ABSPATH', wfu_abspath());
115
- }
116
-
117
- function register_wfu_widget() {
118
- register_widget( 'WFU_Widget' );
119
- }
120
-
121
- function wfu_enqueue_frontpage_scripts() {
122
- $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
123
- $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
124
- $relaxcss = false;
125
- if ( isset($plugin_options['relaxcss']) ) $relaxcss = ( $plugin_options['relaxcss'] == '1' );
126
- //apply wfu_before_frontpage_scripts to get additional settings
127
- $changable_data = array();
128
- $ret_data = apply_filters('wfu_before_frontpage_scripts', $changable_data);
129
- //if $ret_data contains 'return_value' key then no scripts will be enqueued
130
- if ( isset($ret_data['return_value']) ) return $ret_data['return_value'];
131
-
132
- if ( $relaxcss ) {
133
- wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_relaxed.css');
134
- wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_safe_relaxed.css');
135
- }
136
- else {
137
- wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style.css');
138
- wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_style_safe.css');
139
- }
140
- wp_enqueue_style('wordpress-file-upload-adminbar-style', WPFILEUPLOAD_DIR.'css/wordpress_file_upload_adminbarstyle.css');
141
- //do not load JQuery UI css if $ret_data denotes incompatibility issues
142
- if ( ( !isset($ret_data["correct_NextGenGallery_incompatibility"]) || $ret_data["correct_NextGenGallery_incompatibility"] != "true" ) &&
143
- ( !isset($ret_data["correct_JQueryUI_incompatibility"]) || $ret_data["correct_JQueryUI_incompatibility"] != "true" ) )
144
- wp_enqueue_style('jquery-ui-css', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui.min.css');
145
- //do not load timepicker css if $ret_data exclude_timepicker flag is true
146
- if ( !isset($ret_data["exclude_timepicker"]) || $ret_data["exclude_timepicker"] != "true" )
147
- wp_enqueue_style('jquery-ui-timepicker-addon-css', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui-timepicker-addon.min.css');
148
- wp_enqueue_script('json2');
149
- wp_enqueue_script('wordpress_file_upload_script', WPFILEUPLOAD_DIR.'js/wordpress_file_upload_functions.js');
150
- //do not load timepicker js if $ret_data exclude_timepicker flag is true
151
- if ( !isset($ret_data["exclude_timepicker"]) || $ret_data["exclude_timepicker"] != "true" ) {
152
- wp_enqueue_script('jquery-ui-slider');
153
- wp_enqueue_script('jquery-ui-timepicker-addon-js', WPFILEUPLOAD_DIR.'vendor/jquery/jquery-ui-timepicker-addon.min.js', array("jquery-ui-datepicker"));
154
- }
155
- }
156
-
157
- function wfu_include_lib() {
158
- $dir = plugin_dir_path( __FILE__ )."lib/";
159
- if ( $handle = opendir($dir) ) {
160
- $blacklist = array('.', '..');
161
- while ( false !== ($file = readdir($handle)) )
162
- if ( !in_array($file, $blacklist) && substr($file, 0, 1) != "_" )
163
- include_once $dir.$file;
164
- closedir($handle);
165
- }
166
- if ( $handle = opendir(plugin_dir_path( __FILE__ )) ) {
167
- closedir($handle);
168
- }
169
- }
170
-
171
-
172
- /* exit if we are in admin pages (in case of ajax call) */
173
- if ( is_admin() ) return;
174
-
175
- function wordpress_file_upload_handler($incomingfrompost) {
176
- //replace old attribute definitions with new ones
177
- $incomingfrompost = wfu_old_to_new_attributes($incomingfrompost);
178
- //process incoming attributes assigning defaults if required
179
- $defs_indexed = wfu_shortcode_attribute_definitions_adjusted($incomingfrompost);
180
- $incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
181
- //run function that actually does the work of the plugin
182
- $wordpress_file_upload_output = wordpress_file_upload_function($incomingfrompost);
183
- //send back text to replace shortcode in post
184
- return $wordpress_file_upload_output;
185
- }
186
-
187
- function wordpress_file_upload_browser_handler($incomingfrompost) {
188
- //process incoming attributes assigning defaults if required
189
- $defs = wfu_browser_attribute_definitions();
190
- $defs_indexed = array();
191
- foreach ( $defs as $def ) $defs_indexed[$def["attribute"]] = $def["value"];
192
- $incomingfrompost = shortcode_atts($defs_indexed, $incomingfrompost);
193
- //run function that actually does the work of the plugin
194
- $wordpress_file_upload_browser_output = wordpress_file_upload_browser_function($incomingfrompost);
195
- //send back text to replace shortcode in post
196
- return $wordpress_file_upload_browser_output;
197
- }
198
-
199
- function wordpress_file_upload_function($incomingfromhandler) {
200
- $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
201
- global $post;
202
- global $blog_id;
203
- $plugin_options = wfu_decode_plugin_options(get_option( "wordpress_file_upload_options" ));
204
- $shortcode_tag = 'wordpress_file_upload';
205
- $params = wfu_plugin_parse_array($incomingfromhandler);
206
- //sanitize params
207
- $params = wfu_sanitize_shortcode_array($params, $shortcode_tag);
208
- $sid = $params["uploadid"];
209
- // store current page and blog id in params array
210
- $params["pageid"] = $post->ID;
211
- $params["blogid"] = $blog_id;
212
-
213
- $token_sid = 'wfu_token_'.$sid;
214
- if ( !WFU_USVAR_exists($token_sid) || WFU_USVAR($token_sid) == "" )
215
- WFU_USVAR_store($token_sid, uniqid(mt_rand(), TRUE));
216
- //store the server environment (32 or 64bit) for use when checking file size limits
217
- $params["php_env"] = wfu_get_server_environment();
218
-
219
- $user = wp_get_current_user();
220
- $widths = wfu_decode_dimensions($params["widths"]);
221
- $heights = wfu_decode_dimensions($params["heights"]);
222
- //additional parameters to pass to visualization routines
223
- $additional_params = array( );
224
- $additional_params['widths'] = $widths;
225
- $additional_params['heights'] = $heights;
226
- $additional_params["require_consent"] = ( $plugin_options["personaldata"] == "1" && wfu_check_user_consent($user) == "" && $params["askconsent"] == "true" );
227
-
228
- $uploadedfile = 'uploadedfile_'.$sid;
229
- $hiddeninput = 'hiddeninput_'.$sid;
230
- $adminerrorcodes = 'adminerrorcodes_'.$sid;
231
-
232
- //set necessary parameters to be passed to client initialization function
233
- $init_params = array();
234
- $init_params["shortcode_id"] = $sid;
235
- $init_params["shortcode_tag"] = $shortcode_tag;
236
- $init_params["container_id"] = $shortcode_tag.'_block_'.$sid;
237
- $init_params["session"] = WFU_USVAR($token_sid);
238
- $init_params["testmode"] = ( $params["testmode"] == "true" );
239
- $init_params["widgetid"] = $params["widgetid"];
240
- $init_params["require_consent"] = $additional_params["require_consent"];
241
- $init_params["consent_format"] = $params["consentformat"];
242
- $init_params["consent_question"] = preg_replace("/:(\w):/", "<a href=\"".$params["consentdisclaimer"]."\">$1</a>", $params["consentquestion"]);
243
- //add allow no file flag
244
- $init_params["allownofile"] = ( $params["allownofile"] == "true" );
245
- //add params related to visual editor button
246
- if ( current_user_can( 'manage_options' ) ) {
247
- $init_params["post_id"] = $post->ID;
248
- $init_params["post_hash"] = hash('md5', $post->post_content);
249
- }
250
-
251
- //check if user is allowed to view plugin, otherwise do not generate it
252
- $uploadroles = explode(",", $params["uploadrole"]);
253
- foreach ( $uploadroles as &$uploadrole ) {
254
- $uploadrole = trim($uploadrole);
255
- }
256
- $plugin_upload_user_role = wfu_get_user_role($user, $uploadroles);
257
- if ( $plugin_upload_user_role == 'nomatch' ) return apply_filters("_wfu_file_upload_hide_output", "");
258
-
259
- //activate debug mode only for admins
260
- if ( $plugin_upload_user_role != 'administrator' ) $params["debugmode"] = "false";
261
-
262
- $params["adminmessages"] = ( $params["adminmessages"] == "true" && $plugin_upload_user_role == 'administrator' );
263
- // define variable to hold any additional admin errors coming before processing of files (e.g. due to redirection)
264
- $params["adminerrors"] = "";
265
-
266
- /* Define dynamic upload path from variables */
267
- $search = array ('/%userid%/', '/%username%/', '/%blogid%/', '/%pageid%/', '/%pagetitle%/');
268
- if ( is_user_logged_in() ) $username = $user->user_login;
269
- else $username = "guests";
270
- $replace = array ($user->ID, $username, $blog_id, $post->ID, get_the_title($post->ID));
271
- $params["uploadpath"] = preg_replace($search, $replace, $params["uploadpath"]);
272
-
273
- /* Determine if userdata fields have been defined */
274
- $userdata_fields = array();
275
- $userdata_occurrencies = substr_count($params["placements"], "userdata");
276
- if ( $userdata_occurrencies == 0 ) $userdata_occurrencies = 1;
277
- if ( $params["userdata"] == "true" ) {
278
- for ( $i = 1; $i <= $userdata_occurrencies; $i++ ) {
279
- $userdata_fields2 = wfu_parse_userdata_attribute($params["userdatalabel".( $i > 1 ? $i : "" )]);
280
- foreach ( $userdata_fields2 as $key => $item ) $userdata_fields2[$key]["occurrence"] = $i;
281
- $userdata_fields = array_merge($userdata_fields, $userdata_fields2);
282
- }
283
- }
284
- $params["userdata_fields"] = $userdata_fields;
285
-
286
- /* If medialink or postlink is activated, then subfolders are deactivated */
287
- if ( $params["medialink"] == "true" || $params["postlink"] == "true" ) $params["askforsubfolders"] = "false";
288
-
289
- /* Generate the array of subfolder paths */
290
- $params['subfoldersarray'] = wfu_get_subfolders_paths($params);
291
-
292
-
293
- /* in case that webcam is activated, then some elements related to file
294
- selection need to be removed */
295
- if ( strpos($params["placements"], "webcam") !== false && $params["webcam"] == "true" ) {
296
- $params["placements"] = wfu_placements_remove_item($params["placements"], "filename");
297
- $params["placements"] = wfu_placements_remove_item($params["placements"], "selectbutton");
298
- $params["singlebutton"] = "false";
299
- $params["uploadbutton"] = $params["uploadmediabutton"];
300
- }
301
-
302
- //____________________________________________________________________________________________________________________________________________________________________________________
303
-
304
- if ( $params['forceclassic'] != "true" ) {
305
- //**************section to put additional options inside params array**************
306
- $params['subdir_selection_index'] = "-1";
307
- //**************end of section of additional options inside params array**************
308
-
309
-
310
- // below this line no other changes to params array are allowed
311
-
312
-
313
- //**************section to save params as Wordpress options**************
314
- // every params array is indexed (uniquely identified) by three fields:
315
- // - the page that contains the shortcode
316
- // - the id of the shortcode instance (because there may be more than one instances of the shortcode inside a page)
317
- // - the user that views the plugin (because some items of the params array are affected by the user name)
318
- // the wordpress option "wfu_params_index" holds an array of combinations of these three fields, together with a randomly generated string that corresponds to these fields.
319
- // the wordpress option "wfu_params_xxx", where xxx is the randomly generated string, holds the params array (encoded to string) that corresponds to this string.
320
- // the structure of the "wfu_params_index" option is as follows: "a1||b1||c1||d1&&a2||b2||c2||d2&&...", where
321
- // - a is the randomly generated string (16 characters)
322
- // - b is the page id
323
- // - c is the shortcode id
324
- // - d is the user name
325
- $params_index = wfu_generate_current_params_index($sid, $user->user_login);
326
- $params_str = wfu_encode_array_to_string($params);
327
- update_option('wfu_params_'.$params_index, $params_str);
328
- $init_params["params_index"] = $params_index;
329
- $init_params["debugmode"] = ( $params["debugmode"] == "true" );
330
- $init_params["is_admin"] = ( $plugin_upload_user_role == "administrator" );
331
- $init_params["has_filters"] = has_filter("wfu_before_upload");
332
- $init_params["error_header"] = $params["errormessage"];
333
- $init_params["fail_colors"] = $params["failmessagecolors"];
334
- }
335
-
336
-
337
- /* set the template that will be used, default is empty (the original) */
338
- $params["uploadertemplate"] = "";
339
- // $params["uploadertemplate"] = "Custom1";
340
- $params["uploadertemplate"] = apply_filters("_wfu_uploader_template", $params["uploadertemplate"], $params);
341
- $uploadertemplate = wfu_get_uploader_template($params["uploadertemplate"]);
342
- /* Compose the html code for the plugin */
343
- $wordpress_file_upload_output = "";
344
- $wordpress_file_upload_output .= wfu_init_run_js_script();
345
- $plugin_style = "";
346
- if ( $widths["plugin"] != "" ) $plugin_style .= 'width: '.$widths["plugin"].'; ';
347
- if ( $heights["plugin"] != "" ) $plugin_style .= 'height: '.$heights["plugin"].'; ';
348
- if ( $plugin_style != "" ) $plugin_style = ' style="'.$plugin_style.'"';
349
- $wordpress_file_upload_output .= "\n".'<div id="'.$init_params["container_id"].'" class="file_div_clean'.( $params["fitmode"] == "responsive" ? '_responsive_container' : '' ).' wfu_container"'.$plugin_style.'>';
350
- $wordpress_file_upload_output .= "\n".'<!-- Using template '.call_user_func(array($uploadertemplate, 'get_name')).' -->';
351
- //read indexed component definitions
352
- $component_output = "";
353
- $css = "";
354
- $js = "";
355
- /* Add generic uploadform code to output from template */
356
- $wordpress_file_upload_output .= wfu_template_to_HTML("base", $params, array(), 0);
357
- /* Continue with uploadform elements */
358
- $components = wfu_component_definitions();
359
- $components_indexed = array();
360
- foreach ( $components as $component ) {
361
- $components_indexed[$component['id']] = $component;
362
- $components_indexed[$component['id']]['occurrencies'] = 0;
363
- }
364
- $itemplaces = explode("/", $params["placements"]);
365
- foreach ( $itemplaces as $section ) {
366
- $items_in_section = explode("+", trim($section));
367
- $section_array = array( $params );
368
- foreach ( $items_in_section as $item_in_section ) {
369
- $item_in_section = strtolower(trim($item_in_section));
370
- if ( isset($components_indexed[$item_in_section]) && ( $components_indexed[$item_in_section]['multiplacements'] || $components_indexed[$item_in_section]['occurrencies'] == 0 ) ) {
371
- $components_indexed[$item_in_section]['occurrencies'] ++;
372
- $occurrence_index = ( $components_indexed[$item_in_section]['multiplacements'] ? $components_indexed[$item_in_section]['occurrencies'] : 0 );
373
- if ( $item_in_section == "title" ) array_push($section_array, wfu_prepare_title_block($params, $additional_params, $occurrence_index));
374
- elseif ( $item_in_section == "filename" ) array_push($section_array, wfu_prepare_textbox_block($params, $additional_params, $occurrence_index));
375
- elseif ( $item_in_section == "selectbutton" ) array_push($section_array, wfu_prepare_uploadform_block($params, $additional_params, $occurrence_index));
376
- elseif ( $item_in_section == "uploadbutton" && $params["singlebutton"] != "true" ) array_push($section_array, wfu_prepare_submit_block($params, $additional_params, $occurrence_index));
377
- elseif ( $item_in_section == "subfolders" ) array_push($section_array, wfu_prepare_subfolders_block($params, $additional_params, $occurrence_index));
378
- elseif ( $item_in_section == "progressbar" ) array_push($section_array, wfu_prepare_progressbar_block($params, $additional_params, $occurrence_index));
379
- elseif ( $item_in_section == "message" ) array_push($section_array, wfu_prepare_message_block($params, $additional_params, $occurrence_index));
380
- elseif ( $item_in_section == "userdata" && $params["userdata"] == "true" ) array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, $occurrence_index));
381
- elseif ( $item_in_section == "consent" && $additional_params["require_consent"] ) array_push($section_array, wfu_prepare_consent_block($params, $additional_params, $occurrence_index));
382
- elseif ( $item_in_section == "webcam" && $params["webcam"] == "true" ) array_push($section_array, wfu_prepare_webcam_block($params, $additional_params, $occurrence_index));
383
- }
384
  }
385
- wfu_extract_css_js_from_components($section_array, $css, $js);
386
- $component_output .= call_user_func_array("wfu_add_div", $section_array);
387
- }
388
- /* Append mandatory blocks, if have not been included in placements attribute */
389
- if ( $params["userdata"] == "true" && strpos($params["placements"], "userdata") === false ) {
390
- $section_array = array( $params );
391
- array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, 0));
392
- wfu_extract_css_js_from_components($section_array, $css, $js);
393
- $component_output .= call_user_func_array("wfu_add_div", $section_array);
394
- }
395
- if ( $additional_params["require_consent"] && strpos($params["placements"], "consent") === false ) {
396
- $section_array = array( $params );
397
- array_push($section_array, wfu_prepare_consent_block($params, $additional_params, 0));
398
- wfu_extract_css_js_from_components($section_array, $css, $js);
399
- $component_output .= call_user_func_array("wfu_add_div", $section_array);
400
- }
401
- if ( strpos($params["placements"], "selectbutton") === false ) {
402
- $section_array = array( $params );
403
- array_push($section_array, wfu_prepare_uploadform_block($params, $additional_params, 0));
404
- wfu_extract_css_js_from_components($section_array, $css, $js);
405
- $component_output .= call_user_func_array("wfu_add_div", $section_array);
406
- }
407
- if ( strpos($params["placements"], "uploadbutton") === false ) $params["singlebutton"] = "true";
408
-
409
- //set some more parameters for the initialization script
410
- $init_params["is_formupload"] = ( $params['forceclassic'] == "true" );
411
- $init_params["singlebutton"] = ( $params["singlebutton"] == "true" );
412
- $init_params["resetmode"] = $params["resetmode"];
413
-
414
- //output css styling rules
415
- if ( $css != "" ) {
416
- //relax css rules if this option is enabled
417
- if ( $plugin_options['relaxcss'] == '1' ) $css = preg_replace('#.*?/\*relax\*/\s*#', '', $css);
418
- $wordpress_file_upload_output .= wfu_css_to_HTML($css);
419
- }
420
- //output javascript code
421
- if ( $js != "" ) {
422
- //add initialization of the object of the upload form
423
- $wfu_js = 'var WFU_JS_'.$sid.' = function() {';
424
- $wfu_js .= "\n".'GlobalData.WFU['.$sid.'] = '.wfu_PHP_array_to_JS_object($init_params).'; GlobalData.WFU.n.push('.$sid.');';
425
- $wfu_js .= "\n".$js;
426
- $wfu_js .= "\n".'}';
427
- $wfu_js .= "\n".'wfu_run_js("window", "WFU_JS_'.$sid.'");';
428
- $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
429
- }
430
- //add visual editor overlay if the current user is administrator
431
- if ( current_user_can( 'manage_options' ) ) {
432
- $wordpress_file_upload_output .= wfu_add_visual_editor_button($shortcode_tag, $params);
433
  }
434
- //add components' html output
435
- $wordpress_file_upload_output .= $component_output;
436
-
437
- /* Pass constants to javascript and run plugin post-load actions */
438
- $consts = wfu_set_javascript_constants();
439
- $handler = 'function() { wfu_Initialize_Consts("'.$consts.'"); wfu_Load_Code_Connectors('.$sid.'); wfu_plugin_load_action('.$sid.'); }';
440
- $wfu_js = 'if (typeof wfu_addLoadHandler == "undefined") function wfu_addLoadHandler(handler) { if(window.addEventListener) { window.addEventListener("load", handler, false); } else if(window.attachEvent) { window.attachEvent("onload", handler); } else { window["onload"] = handler; } }';
441
- $wfu_js .= "\n".'wfu_addLoadHandler('.$handler.');';
442
- $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
443
- $wordpress_file_upload_output .= '</div>';
444
- // $wordpress_file_upload_output .= '<div>';
445
- // $wordpress_file_upload_output .= wfu_test_admin();
446
- // $wordpress_file_upload_output .= '</div>';
447
-
448
- // The plugin uses sessions in order to detect if the page was loaded due to file upload or
449
- // because the user pressed the Refresh button (or F5) of the page.
450
- // In the second case we do not want to perform any file upload, so we abort the rest of the script.
451
- $check_refresh_sid = 'wfu_check_refresh_'.$sid;
452
- if ( !WFU_USVAR_exists($check_refresh_sid) || WFU_USVAR($check_refresh_sid) != "form button pressed" ) {
453
- WFU_USVAR_store($check_refresh_sid, 'do not process');
454
- $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
455
- $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
456
- return $wordpress_file_upload_output."\n";
457
- }
458
- WFU_USVAR_store($check_refresh_sid, 'do not process');
459
- $params["upload_start_time"] = WFU_USVAR('wfu_start_time_'.$sid);
460
-
461
- // The plugin uses two ways to upload the file:
462
- // - The first one uses classic functionality of an HTML form (highest compatibility with browsers but few capabilities).
463
- // - The second uses ajax (HTML5) functionality (medium compatibility with browsers but many capabilities, like no page refresh and progress bar).
464
- // The plugin loads using ajax functionality by default, however if it detects that ajax functionality is not supported, it will automatically switch to classic functionality.
465
- // The next line checks to see if the form was submitted using ajax or classic functionality.
466
- // If the uploaded file variable stored in $_FILES ends with "_redirected", then it means that ajax functionality is not supported and the plugin must switch to classic functionality.
467
- if ( isset($_FILES[$uploadedfile.'_redirected']) ) $params['forceclassic'] = "true";
468
-
469
- if ( $params['forceclassic'] != "true" ) {
470
- $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
471
- $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
472
- return $wordpress_file_upload_output."\n";
473
- }
474
-
475
- // The following code is executed in case of non-ajax uploads to process the files.
476
- // Consecutive checks are performed in order to verify and approve the upload of files
477
- $_REQUEST = stripslashes_deep($_REQUEST);
478
- $_POST = stripslashes_deep($_POST);
479
- $wfu_checkpass = true;
480
-
481
- // First we test that WP nonce passes the check
482
- $wfu_checkpass = ( $wfu_checkpass && isset($_REQUEST["wfu_uploader_nonce"]) && wp_verify_nonce( $_REQUEST["wfu_uploader_nonce"], "wfu-uploader-nonce" ) !== false );
483
-
484
- $unique_id = ( isset($_POST['uniqueuploadid_'.$sid]) ? sanitize_text_field($_POST['uniqueuploadid_'.$sid]) : "" );
485
- // Check that upload_id is valid
486
- $wfu_checkpass = ( $wfu_checkpass && strlen($unique_id) == 10 );
487
-
488
-
489
- if ( $wfu_checkpass ) {
490
- //process any error messages due to redirection to non-ajax upload
491
- if ( isset( $_POST[$adminerrorcodes] ) ) {
492
- $code = $_POST[$adminerrorcodes];
493
- if ( $code == "" ) $params['adminerrors'] = "";
494
- elseif ( $code == "1" || $code == "2" || $code == "3" ) $params['adminerrors'] = constant('WFU_ERROR_REDIRECTION_ERRORCODE'.$code);
495
- else $params['adminerrors'] = WFU_ERROR_REDIRECTION_ERRORCODE0;
496
- }
497
-
498
- $params['subdir_selection_index'] = -1;
499
- if ( isset( $_POST[$hiddeninput] ) ) $params['subdir_selection_index'] = sanitize_text_field($_POST[$hiddeninput]);
500
-
501
- //in case that that the upload has been cancelled then proceed
502
- //accordingly to notify the user
503
- $uploadstatus_id = "wfu_uploadstatus_".$unique_id;
504
- if ( WFU_USVAR_exists($uploadstatus_id) && WFU_USVAR($uploadstatus_id) == 0 ) {
505
- $safe_output = "17;".WFU_VAR("WFU_DEFAULTMESSAGECOLORS").";0";
506
- $wfu_process_file_array_str = " ";
507
- $js_script_enc = "";
508
- }
509
- else {
510
- //update consent status of user
511
- if ( $additional_params["require_consent"] ) {
512
- if ( !isset($_POST['consent_result']) ) die();
513
- $consent_result = ( $_POST['consent_result'] == "yes" ? "yes" : ( $_POST['consent_result'] == "no" ? "no" : "" ) );
514
- wfu_update_user_consent($user, $consent_result);
515
- }
516
- $wfu_process_file_array = wfu_process_files($params, 'no_ajax');
517
- $safe_output = $wfu_process_file_array["general"]['safe_output'];
518
- unset($wfu_process_file_array["general"]['safe_output']);
519
- //javascript code generated from individual wfu_after_upload_filters is not executed in non-ajax uploads
520
- unset($wfu_process_file_array["general"]['js_script']);
521
- $js_script_enc = "";
522
- //execute after upload filters
523
- $ret = wfu_execute_after_upload_filters($sid, $unique_id);
524
- if ( $ret["js_script"] != "" ) $js_script_enc = wfu_plugin_encode_string($ret["js_script"]);
525
- $wfu_process_file_array_str = wfu_encode_array_to_string($wfu_process_file_array);
526
- }
527
-
528
- $ProcessUploadComplete_functiondef = 'function(){wfu_ProcessUploadComplete('.$sid.', 1, "'.$wfu_process_file_array_str.'", "no-ajax", "'.$safe_output.'", [false, null, false], "fileupload", "'.$js_script_enc.'");}';
529
- $wfu_js = 'wfu_addLoadHandler('.$ProcessUploadComplete_functiondef.');';
530
- $wordpress_file_upload_output .= "\n".wfu_js_to_HTML($wfu_js);
531
- }
532
-
533
- $wordpress_file_upload_output .= wfu_post_plugin_actions($params);
534
- $wordpress_file_upload_output = apply_filters("_wfu_file_upload_output", $wordpress_file_upload_output, $params);
535
- return $wordpress_file_upload_output."\n";
536
- }
537
-
538
- function wfu_add_visual_editor_button($shortcode_tag, $params) {
539
- return wfu_template_to_HTML("visualeditorbutton", $params, array( "shortcode_tag" => $shortcode_tag ), 0);
540
- }
541
-
542
- function wfu_post_plugin_actions($params) {
543
- $echo_str = '';
544
-
545
- return $echo_str;
546
- }
547
-
548
- function wfu_get_subfolders_paths($params) {
549
- $a = func_get_args(); $a = WFU_FUNCTION_HOOK(__FUNCTION__, $a, $out); if (isset($out['vars'])) foreach($out['vars'] as $p => $v) $$p = $v; switch($a) { case 'R': return $out['output']; break; case 'D': die($out['output']); }
550
- $subfolder_paths = array ( );
551
- if ( $params["askforsubfolders"] == "true" && $params["testmode"] != "true" ) {
552
- array_push($subfolder_paths, "");
553
- if ( substr($params["subfoldertree"], 0, 4) == "auto" ) {
554
- $upload_directory = wfu_upload_plugin_full_path($params);
555
- $dirtree = wfu_getTree($upload_directory);
556
- foreach ( $dirtree as &$dir ) $dir = '*'.$dir;
557
- $params["subfoldertree"] = implode(',', $dirtree);
558
- }
559
- $subfolders = wfu_parse_folderlist($params["subfoldertree"]);
560
- if ( count($subfolders['path']) == 0 ) array_push($subfolders['path'], "");
561
- foreach ( $subfolders['path'] as $subfolder ) array_push($subfolder_paths, $subfolder);
562
- }
563
-
564
- return $subfolder_paths;
565
- }
566
-
567
- function wfu_old_to_new_attributes($shortcode_attrs) {
568
- //old to new attribute definitions
569
- $old_to_new = array(
570
- "dublicatespolicy" => "duplicatespolicy"
571
- );
572
- //implement changes
573
- foreach ( $old_to_new as $old => $new ) {
574
- if ( isset($shortcode_attrs[$old]) ) {
575
- $shortcode_attrs[$new] = $shortcode_attrs[$old];
576
- unset($shortcode_attrs[$old]);
577
- }
578
- }
579
- return $shortcode_attrs;
580
- }
581
-
582
- function wfu_classic_before_upload_handler($ret, $attr) {
583
- //run only if start_time exists in $_REQUEST parameters
584
- if ( !isset($_REQUEST['start_time']) ) return $ret;
585
- if ( $ret["status"] == "die" ) return $ret;
586
- $start_time = sanitize_text_field( $_REQUEST["start_time"] );
587
- $sid = $attr["sid"];
588
- if ( $sid == "" ) {
589
- $ret["status"] = "die";
590
- return $ret;
591
- }
592
- if ( $ret["status"] != "error" ) {
593
- $ret["status"] = "success";
594
- WFU_USVAR_store('wfu_check_refresh_'.$sid, 'form button pressed');
595
- WFU_USVAR_store('wfu_start_time_'.$sid, $start_time);
596
- }
597
- return $ret;
598
- }
599
-
600
- function wfu_execute_after_upload_filters($sid, $unique_id) {
601
- //apply internal filters from extensions
602
- $ret = array( "echo" => "" );
603
- $files = array();
604
- $filedata_id = "filedata_".$unique_id;
605
- if ( WFU_USVAR_exists($filedata_id) ) $files = WFU_USVAR($filedata_id);
606
- $attr = array( "sid" => $sid, "unique_id" => $unique_id, "files" => $files );
607
- $ret = apply_filters("_wfu_after_upload", $ret, $attr);
608
- //then apply any custom filters created by admin
609
- $echo_str = "";
610
- $ret = array( "js_script" => "" );
611
- $ret = apply_filters("wfu_after_upload", $ret, $attr);
612
- return $ret;
613
  }
 
 
614
 
615
  ?>
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  /* do not load plugin if this is the login page */
4
  $uri = $_SERVER['REQUEST_URI'];
5
  if ( strpos($uri, 'wp-login.php') !== false ) return;
6
 
7
+ //before loading the plugin we need to check if restricted loading is enabled
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  if ( !is_admin() ) {
9
+ $page = get_page_by_path($uri);
10
+ if ( $page ) {
11
+ $envars = get_option("wfu_environment_variables", array());
12
+ $ids = ( isset($envars["WFU_RESTRICT_FRONTEND_LOADING"]) ? $envars["WFU_RESTRICT_FRONTEND_LOADING"] : "false" );
13
+ //if restricted loading is enabled, then the plugin will load only if
14
+ //the current page ID is included in $ids list
15
+ if ( $ids !== "false" ) {
16
+ $ids = explode(",", $ids);
17
+ $pass = false;
18
+ foreach ( $ids as $id )
19
+ if ( trim($id) != "" && (int)trim($id) > 0 && (int)trim($id) == $page->ID ) {
20
+ $pass = true;
21
+ break;
22
+ }
23
+ if ( !$pass ) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
+ //proceed loading the plugin
28
+ require_once( plugin_dir_path( __FILE__ ) . 'wfu_loader.php' );
29
 
30
  ?>