| @@ -1,6 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 2 | + if(!function_exists('wpdocs_secure_url')){ | |
| 3 | + function wpdocs_secure_url($file_id=''){ | |
| 4 | + | |
| 5 | + $ret = add_query_arg( | |
| 6 | + array( | |
| 7 | + 'wpdocs_dl' => $file_id, | |
| 8 | + 'wpdocs_nonce' => wp_create_nonce('wpdocs_dl_'.$file_id), | |
| 9 | + ), | |
| 10 | + home_url('/') | |
| 11 | + ); | |
| 12 | + return $ret; | |
| 13 | + } | |
| 14 | + } | |
| 3 | 15 | if(!function_exists('wp_docs_get_memphis_dir_option_id')){ |
| 4 | 16 | function wp_docs_get_option_id($option_name){ |
| 5 | 17 | global $wpdb; |
| 6 | 18 | $option_name = esc_sql( $option_name ); |
| @@ -44,8 +56,10 @@ | ||
| 44 | 56 | function wpdocs_admin_enqueue_script() |
| 45 | 57 | { |
| 46 | 58 | if (isset($_GET['page']) && $_GET['page'] == 'wpdocs') { |
| 47 | 59 | |
| 60 | + //pree(get_option('mdocs-list'));exit; | |
| 61 | + | |
| 48 | 62 | global $wpdocs_pro, $wpdocs_options; |
| 49 | 63 | |
| 50 | 64 | wp_enqueue_script('wpdocs_boostrap', plugin_dir_url(dirname(__FILE__)) . 'js/bootstrap.min.js', array('jquery')); |
| 51 | 65 | wp_enqueue_style('wpdocs-boostrap', plugins_url('css/bootstrap.min.css', dirname(__FILE__))); |
| @@ -65,8 +79,9 @@ | ||
| 65 | 79 | wp_enqueue_style('wpdocs-common', plugins_url('css/common-styles.css', dirname(__FILE__)), array(), date('Ymdhi')); |
| 66 | 80 | wp_enqueue_style('wpdocs-admin', plugins_url('css/admin-styles.css', dirname(__FILE__)), array(), date('Ymdhi')); |
| 67 | 81 | |
| 68 | 82 | wp_enqueue_script('wpdocs_admin_scripts', plugin_dir_url(dirname(__FILE__)) . 'js/admin-scripts.js', array('jquery', 'jquery-ui-dialog'), time()); |
| 83 | + wp_enqueue_script('wpdocs_verify_scripts', plugin_dir_url(dirname(__FILE__)) . 'js/verify-scripts.js', array('jquery', 'jquery-ui-dialog'), time()); | |
| 69 | 84 | |
| 70 | 85 | if($wpdocs_pro){ |
| 71 | 86 | wp_enqueue_script('wpdocs_pro_scripts', plugin_dir_url(dirname(__FILE__)) . 'pro/wp-docs-admin.js?t='.time(), array('jquery')); |
| 72 | 87 | } |
| @@ -83,8 +98,9 @@ | ||
| 83 | 98 | 'wpdocs_admin_scripts', |
| 84 | 99 | 'wpdocs_ajax_object', |
| 85 | 100 | array( |
| 86 | 101 | 'ajax_url' => admin_url('admin-ajax.php'), |
| 102 | + 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'), | |
| 87 | 103 | 'url' => admin_url('options-general.php?page=wpdocs'), |
| 88 | 104 | 'wpdocs_pro' => $wpdocs_pro, |
| 89 | 105 | 'wpdocs_delete_msg' => __('Do you want to delete this directory and data as well?', 'wp-docs'), |
| 90 | 106 | 'wpdocs_delete_shortcut_msg' => __('Do you want to delete this shortcut?', 'wp-docs'), |
| @@ -100,16 +116,64 @@ | ||
| 100 | 116 | 'undo_import_confirm' => __('Do you want to rollback the import?', 'wp-docs'), |
| 101 | 117 | 'select_role_str' => __('Select roles to allow upload', 'wp-docs'), |
| 102 | 118 | 'rename_confirm' => __('Do you want to rename this directory?', 'wp-docs'), |
| 103 | 119 | 'reset_confirm' => __('Do you want to reset all settings and clear directories?', 'wp-docs'), |
| 104 | - 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'), | |
| 120 | + | |
| 105 | 121 | 'empty_settings' => empty($wpdocs_options), |
| 106 | 122 | 'wc_os_pg' => (isset($_GET['pg'])?esc_attr($_GET['pg']):'0'), |
| 107 | 123 | 'wc_os_tab' => (isset($_GET['t'])?esc_attr($_GET['t']):'0'), |
| 108 | - 'all_dirs' => $dir_id_to_titles | |
| 124 | + 'all_dirs' => $dir_id_to_titles, | |
| 125 | + 'rename_confirm' => __('Please enter new folder name:', 'wp-docs'), | |
| 109 | 126 | |
| 110 | 127 | ) |
| 111 | 128 | ); |
| 129 | + | |
| 130 | + wp_localize_script( | |
| 131 | + 'wpdocs_verify_scripts', | |
| 132 | + 'wpdocs_vars', | |
| 133 | + array( | |
| 134 | + 'ajax_url' => admin_url('admin-ajax.php'), | |
| 135 | + 'url' => admin_url('options-general.php?page=wpdocs'), | |
| 136 | + 'nonce' => wp_create_nonce('wpdocs_verify_nonce'), | |
| 137 | + 'preparing_queue' => __('Preparing verification queue...', 'wp-docs'), | |
| 138 | + 'unable_to_start' => __('Unable to start verification.', 'wp-docs'), | |
| 139 | + 'ajax_error' => __('AJAX error.', 'wp-docs'), | |
| 140 | + 'verification_failed' => __('Verification failed.', 'wp-docs'), | |
| 141 | + 'verification_completed' => __('Verification completed.', 'wp-docs'), | |
| 142 | + 'verification_interrupted' => __('Verification interrupted.', 'wp-docs'), | |
| 143 | + 'checking_folder' => __('Checking Folder:', 'wp-docs'), | |
| 144 | + 'checking_file' => __('Checking File:', 'wp-docs'), | |
| 145 | + 'unknown_file' => __('Unknown File', 'wp-docs'), | |
| 146 | + 'items_processed' => __('items processed', 'wp-docs'), | |
| 147 | + 'total_folders' => __('Total Folders', 'wp-docs'), | |
| 148 | + 'verified_folders' => __('Verified Folders', 'wp-docs'), | |
| 149 | + 'missing_folders' => __('Missing Folders', 'wp-docs'), | |
| 150 | + 'total_files' => __('Total Files', 'wp-docs'), | |
| 151 | + 'verified_files' => __('Verified Files', 'wp-docs'), | |
| 152 | + 'missing_files' => __('Missing Files', 'wp-docs'), | |
| 153 | + 'missing_folder' => __('MISSING FOLDER', 'wp-docs'), | |
| 154 | + 'missing_file' => __('MISSING FILE', 'wp-docs'), | |
| 155 | + 'no_items_display' => __('No items to display.', 'wp-docs'), | |
| 156 | + 'import_in_progress' => __('Import is already in progress. Please wait.', 'wp-docs'), | |
| 157 | + 'import_missing_confirm' => __('This will import only missing folders and files. Do you want to continue?', 'wp-docs'), | |
| 158 | + 'initializing' => __('Initializing...', 'wp-docs'), | |
| 159 | + 'preparing_import_queue' => __('Preparing import queue...', 'wp-docs'), | |
| 160 | + 'unable_to_start_import' => __('Unable to start import.', 'wp-docs'), | |
| 161 | + 'import_failed' => __('Import failed.', 'wp-docs'), | |
| 162 | + 'import_completed' => __('Import completed!', 'wp-docs'), | |
| 163 | + 'refreshing_results' => __('Refreshing verification results...', 'wp-docs'), | |
| 164 | + 'import_interrupted' => __('Import interrupted. Please try again.', 'wp-docs'), | |
| 165 | + 'creating_folder' => __('Creating Folder:', 'wp-docs'), | |
| 166 | + 'importing_file' => __('Importing File:', 'wp-docs'), | |
| 167 | + 'path' => __('Path:', 'wp-docs'), | |
| 168 | + 'target' => __('Target:', 'wp-docs'), | |
| 169 | + 'folders_imported' => __('Folders imported:', 'wp-docs'), | |
| 170 | + 'files_imported' => __('Files imported:', 'wp-docs'), | |
| 171 | + 'failed' => __('Failed:', 'wp-docs'), | |
| 172 | + 'please_wait' => __('Please wait...', 'wp-docs'), | |
| 173 | + 'import_missing_items' => __('Import Missing Items Only', 'wp-docs'), | |
| 174 | + ) | |
| 175 | + ); | |
| 112 | 176 | } |
| 113 | 177 | } |
| 114 | 178 | |
| 115 | 179 | add_filter( 'ajax_query_attachments_args', 'wpdocs_filter_media'); |
| @@ -419,8 +483,10 @@ | ||
| 419 | 483 | $dir_id = (!$dir_id && array_key_exists('dir', $_GET)?sanitize_wpdocs_data($_GET['dir']):0); |
| 420 | 484 | |
| 421 | 485 | $params_array = array( |
| 422 | 486 | 'dir_id' => $dir_id, |
| 487 | + | |
| 488 | + 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'), | |
| 423 | 489 | 'parent_dir' => get_permalink($post->ID).'/?dir=', |
| 424 | 490 | 'wpdocs_pro' => $wpdocs_pro, |
| 425 | 491 | 'details_view_sorting' => $details_view_sorting, |
| 426 | 492 | 'ajax_based_deep_search' => $ajax_based_deep_search, |
| @@ -436,9 +502,8 @@ | ||
| 436 | 502 | 'block_ui' => __('Please wait...', 'wp-docs'), |
| 437 | 503 | 'is_ajax' => $is_ajax, |
| 438 | 504 | 'is_ajax_url' => $is_ajax_url, |
| 439 | 505 | 'del_from_front' => array_key_exists('del_from_front', $wpdocs_options), |
| 440 | - 'nonce' => wp_create_nonce('wpdocs_update_options_nonce'), | |
| 441 | 506 | 'restriction_load' => isset($_GET['wpdocs_restriction']), |
| 442 | 507 | 'restriction_id' => isset($_GET['wpdocs_restriction']) ? $_GET['wpdocs_restriction'] : '', |
| 443 | 508 | 'restriction_container' => isset($_GET['wpdocs_container']) ? $_GET['wpdocs_container'] : '', |
| 444 | 509 | 'current_user_id' => get_current_user_id(), |
| @@ -624,8 +689,13 @@ | ||
| 624 | 689 | add_action('wp_ajax_wpdocs_create_folder', 'wpdocs_create_folder'); |
| 625 | 690 | |
| 626 | 691 | function wpdocs_create_folder() |
| 627 | 692 | { |
| 693 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 694 | + wp_send_json_error( __("Unauthorized user", 'wp-docs') ); | |
| 695 | + wp_die(); | |
| 696 | + } | |
| 697 | + | |
| 628 | 698 | $nonce = sanitize_wpdocs_data(wp_unslash($_POST['nonce'])); |
| 629 | 699 | |
| 630 | 700 | if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) ) |
| 631 | 701 | die (__("Sorry, your nonce did not verify.", 'wp-docs')); |
| @@ -639,9 +709,29 @@ | ||
| 639 | 709 | $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid); |
| 640 | 710 | |
| 641 | 711 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 642 | 712 | |
| 643 | - echo '<li class="ab-dir ab-new" data-id="'.$dir_id.'" data-resource='.base64_encode($dir_id).'" data-linked="'.$list['content'].'" data-guid="'.($is_shortcut?$list['guid']:'').'"><a class="folder fa fa-folder"></a><a class="dtitle" title="'.__('Click here to rename', 'wp-docs').'">'.__('New Folder', 'wp-docs').'</a><span class="wpd_action_span"><a class="wpd-edit" title="'.__('Click here to edit', 'wp-docs').'"></a><span class="wpd_action_span_inner"><a class="wpd-copy" title="'.__('Click here to copy', 'wp-docs').'"></a><a class="wpd-move" title="'.__('Click here to move', 'wp-docs').'"></a></span><a class="wpd-trash" title="'.__('Click here to delete', 'wp-docs').'"></a></span></li>'; | |
| 713 | + echo '<li class="ab-dir ab-new" | |
| 714 | + data-id="' . esc_attr($dir_id) . '" | |
| 715 | + data-resource="' . esc_attr(base64_encode($dir_id)) . '" | |
| 716 | + data-linked="' . esc_attr($list['content']) . '" | |
| 717 | + data-guid="' . ($is_shortcut ? esc_attr($list['guid']) : '') . '"> | |
| 718 | + | |
| 719 | + <a class="folder fa fa-folder"></a> | |
| 720 | + | |
| 721 | + <a class="dtitle" title="' . esc_attr(__('Click here to rename', 'wp-docs')) . '"> | |
| 722 | + ' . esc_html__('New Folder', 'wp-docs') . ' | |
| 723 | + </a> | |
| 724 | + | |
| 725 | + <span class="wpd_action_span"> | |
| 726 | + <a class="wpd-edit" title="' . esc_attr(__('Click here to edit', 'wp-docs')) . '"></a> | |
| 727 | + <span class="wpd_action_span_inner"> | |
| 728 | + <a class="wpd-copy" title="' . esc_attr(__('Click here to copy', 'wp-docs')) . '"></a> | |
| 729 | + <a class="wpd-move" title="' . esc_attr(__('Click here to move', 'wp-docs')) . '"></a> | |
| 730 | + </span> | |
| 731 | + <a class="wpd-trash" title="' . esc_attr(__('Click here to delete', 'wp-docs')) . '"></a> | |
| 732 | + </span> | |
| 733 | + </li>'; | |
| 644 | 734 | |
| 645 | 735 | exit; |
| 646 | 736 | } |
| 647 | 737 | |
| @@ -718,16 +808,15 @@ | ||
| 718 | 808 | } |
| 719 | 809 | |
| 720 | 810 | |
| 721 | 811 | |
| 722 | - | |
| 723 | 812 | return array( |
| 724 | - | |
| 725 | - 'file_url' => $file_url, | |
| 726 | - 'ext' => $ext, | |
| 727 | - 'filename' => $filename, | |
| 728 | - 'title' => $filename, | |
| 729 | - 'icon_url' => $icon_url | |
| 813 | + 'file_id' => $item, | |
| 814 | + 'file_url' => esc_url($file_url), | |
| 815 | + 'ext' => esc_attr($ext), | |
| 816 | + 'filename' => esc_attr($filename), | |
| 817 | + 'title' => esc_html($filename), | |
| 818 | + 'icon_url' => esc_url($icon_url) | |
| 730 | 819 | ); |
| 731 | 820 | |
| 732 | 821 | |
| 733 | 822 | } |
| @@ -787,12 +876,12 @@ | ||
| 787 | 876 | |
| 788 | 877 | $item_data = wpd_get_item_type_icon_url($item); |
| 789 | 878 | extract($item_data); |
| 790 | 879 | |
| 791 | - //pree($item_data); | |
| 880 | + //pree($item_data);exit; | |
| 792 | 881 | //pree($wp_uploads_path);exit; |
| 793 | 882 | |
| 794 | - $icon_str = '<img src="'.$icon_url.'" style="">'; | |
| 883 | + $icon_str = '<img src="' . esc_url($icon_url) . '" style="" alt="' . esc_attr($title) . '">'; | |
| 795 | 884 | |
| 796 | 885 | switch ($ext) { |
| 797 | 886 | case 'png': |
| 798 | 887 | case 'jpg': |
| @@ -838,9 +927,9 @@ | ||
| 838 | 927 | |
| 839 | 928 | |
| 840 | 929 | } |
| 841 | 930 | |
| 842 | - $icon_str = '<img src="'.$file_url_thumb.'" style="">'; | |
| 931 | + $icon_str = '<img src="' . esc_url( $file_url_thumb ) . '" style="" alt="' . esc_attr( $title ) . '">'; | |
| 843 | 932 | |
| 844 | 933 | } |
| 845 | 934 | |
| 846 | 935 | } |
| @@ -851,21 +940,24 @@ | ||
| 851 | 940 | //$class .= 'fa-file'; |
| 852 | 941 | break; |
| 853 | 942 | } |
| 854 | 943 | $class = ''; |
| 855 | - $files_list[$title] = '<li data-id="' . $item . '" data-dir="'.$dir. '" title="'.esc_attr($filename).'"> | |
| 856 | - <a href="' . $file_url . '" target="_blank" class="file ' . $class . '"> '.$icon_str.' </a> | |
| 857 | - <a class="ftitle" title="' . $title . '">' . $title . '</a> | |
| 858 | - <span class="wpd_action_span"> | |
| 859 | - <a href="upload.php?item='.$item.'" target="_blank" class="wpd-edit" title="'.__('Click here to edit', 'wp-docs').'"></a> | |
| 860 | - <span class="wpd_action_span_inner"> | |
| 861 | - <a class="wpd-copy" title="'.__('Click here to copy', 'wp-docs').'"></a> | |
| 862 | - <a class="wpd-move" title="'.__('Click here to move', 'wp-docs').'"></a> | |
| 863 | - </span> | |
| 864 | - | |
| 865 | - <a href="upload.php?search='.esc_attr($filename).'" target="_blank" class="wpd-trash" title="'.__('Click here to delete', 'wp-docs').'"></a> | |
| 866 | - </span> | |
| 867 | - </li>'; | |
| 944 | + | |
| 945 | + | |
| 946 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 947 | + | |
| 948 | + $files_list[ $title ] = '<li data-id="' . esc_attr( $item ) . '" data-dir="' . esc_attr( $dir ) . '" title="' . esc_attr( $filename ) . '"> | |
| 949 | + <a href="' . esc_url( $secured_file_url ) . '" target="_blank" class="file ' . esc_attr( $class ) . '"> ' . $icon_str . ' </a> | |
| 950 | + <a class="ftitle" title="' . esc_attr( $title ) . '">' . esc_html( $title ) . '</a> | |
| 951 | + <span class="wpd_action_span"> | |
| 952 | + <a href="' . esc_url( 'upload.php?item=' . $item ) . '" target="_blank" class="wpd-edit" title="' . esc_attr__( 'Click here to edit', 'wp-docs' ) . '"></a> | |
| 953 | + <span class="wpd_action_span_inner"> | |
| 954 | + <a class="wpd-copy" title="' . esc_attr__( 'Click here to copy', 'wp-docs' ) . '"></a> | |
| 955 | + <a class="wpd-move" title="' . esc_attr__( 'Click here to move', 'wp-docs' ) . '"></a> | |
| 956 | + </span> | |
| 957 | + <a href="' . esc_url( 'upload.php?search=' . rawurlencode( $filename ) ) . '" target="_blank" class="wpd-trash" title="' . esc_attr__( 'Click here to delete', 'wp-docs' ) . '"></a> | |
| 958 | + </span> | |
| 959 | +</li>'; | |
| 868 | 960 | } |
| 869 | 961 | } |
| 870 | 962 | |
| 871 | 963 | ksort($files_list); |
| @@ -1134,12 +1226,19 @@ | ||
| 1134 | 1226 | |
| 1135 | 1227 | ?> |
| 1136 | 1228 | |
| 1137 | 1229 | |
| 1138 | - <div class="container-fluid wpdoc_container" data-dir_restrictions = "<?php echo wpdocs_get_dir_restrictions($dir, 'base64'); ?>" data-del_from_front="<?php echo $is_del_from_front; ?>" data-dir="<?php echo $dir; ?>" data-home="<?php echo $home_id; ?>"> | |
| 1139 | - <?php wp_nonce_field( 'wpdocs_front_list_nonce', 'wpdocs_front_list_nonce_field' ); ?> | |
| 1140 | - <input type="hidden" class="wpd_home_id" value="<?php echo esc_html($home_id); ?>" /> | |
| 1141 | - <input type="hidden" class="wpd_del_file_id" value="" /> | |
| 1230 | +<div class="container-fluid wpdoc_container" | |
| 1231 | + data-dir_restrictions="<?php echo esc_attr( wpdocs_get_dir_restrictions( $dir, 'base64' ) ); ?>" | |
| 1232 | + data-del_from_front="<?php echo esc_attr( $is_del_from_front ); ?>" | |
| 1233 | + data-dir="<?php echo esc_attr( $dir ); ?>" | |
| 1234 | + data-home="<?php echo esc_attr( $home_id ); ?>"> | |
| 1235 | + | |
| 1236 | + <?php wp_nonce_field( 'wpdocs_front_list_nonce', 'wpdocs_front_list_nonce_field' ); ?> | |
| 1237 | + | |
| 1238 | + <input type="hidden" class="wpd_home_id" value="<?php echo esc_attr( $home_id ); ?>" /> | |
| 1239 | + <input type="hidden" class="wpd_del_file_id" value="" /> | |
| 1240 | + | |
| 1142 | 1241 | <?php |
| 1143 | 1242 | |
| 1144 | 1243 | $wpdocs_view = array_key_exists($home_id, $wpdocs_view) ? $wpdocs_view[$home_id] : trim($default_view); |
| 1145 | 1244 | |
| @@ -1151,9 +1250,13 @@ | ||
| 1151 | 1250 | <ol class="breadcrumb bg-light" style="border-bottom:1px solid #dee2e6;border-radius: 0; min-height: 40px;"> |
| 1152 | 1251 | |
| 1153 | 1252 | <?php if (!empty($breadcrumb_array)) { ?> |
| 1154 | 1253 | |
| 1155 | - <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo $get_permalink ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li> | |
| 1254 | + <li class="breadcrumb-item bread_home_url"> | |
| 1255 | + <a class="wpd_bread_item" href="<?php echo esc_url($get_permalink); ?>" data-id="0"> | |
| 1256 | + <?php echo esc_html__('Home', 'wp-docs'); ?> | |
| 1257 | + </a> | |
| 1258 | +</li> | |
| 1156 | 1259 | <?php |
| 1157 | 1260 | |
| 1158 | 1261 | foreach (array_reverse($breadcrumb_array) as $bread_key => $bread_value) { |
| 1159 | 1262 | $active = ''; |
| @@ -1159,9 +1262,9 @@ | ||
| 1159 | 1262 | $active = ''; |
| 1160 | 1263 | $page = ''; |
| 1161 | 1264 | $permalink = stripos($get_permalink, '?'); |
| 1162 | 1265 | $permalink_c = ($permalink!='' && is_numeric($permalink) && $permalink>=0); |
| 1163 | - $link = '<a class="wpd_bread_item" href="' . $get_permalink . ($permalink_c?'&':'?').'dir=' . $bread_value . '" data-id="'.$bread_value.'" >' . get_the_title($bread_value) . '</a>'; | |
| 1266 | + $link = '<a class="wpd_bread_item" href="' . esc_url($get_permalink . ($permalink_c ? '&' : '?') . 'dir=' . $bread_value) . '" data-id="' . esc_attr($bread_value) . '">' . (get_the_title($bread_value)) . '</a>'; | |
| 1164 | 1267 | if ($bread_value == 0) { |
| 1165 | 1268 | continue; |
| 1166 | 1269 | } |
| 1167 | 1270 | if ($bread_value == $dir) { |
| @@ -1171,9 +1274,11 @@ | ||
| 1171 | 1274 | } |
| 1172 | 1275 | |
| 1173 | 1276 | |
| 1174 | 1277 | ?> |
| 1175 | - <li class="breadcrumb-item <?php echo $active ?>" aria-current="<?php echo $page; ?>"><?php echo $link; ?></li> | |
| 1278 | + <li class="breadcrumb-item <?php echo esc_attr($active); ?>" aria-current="<?php echo esc_attr($page); ?>"> | |
| 1279 | + <?php echo wp_kses_post($link); ?> | |
| 1280 | +</li> | |
| 1176 | 1281 | |
| 1177 | 1282 | <?php } ?> |
| 1178 | 1283 | <?php |
| 1179 | 1284 | } |
| @@ -1182,16 +1287,21 @@ | ||
| 1182 | 1287 | |
| 1183 | 1288 | </ol> |
| 1184 | 1289 | |
| 1185 | 1290 | <?php if($is_del_from_front):?> |
| 1291 | +<i style="opacity: 0.5;" | |
| 1292 | + class="fa fa-trash fa-1x position-absolute wp_docs_del_file <?php echo esc_attr(is_user_logged_in() ? 'logged_in' : 'logged_out'); ?>" | |
| 1293 | + title="<?php echo esc_attr__('Click here to delete selected files', 'wp-docs'); ?>"> | |
| 1294 | +</i> | |
| 1186 | 1295 | |
| 1187 | - <i style="opacity: 0.5;" class="fa fa-trash fa-1x position-absolute wp_docs_del_file <?php echo (is_user_logged_in()?'logged_in':'logged_out'); ?>" title="<?php _e('Click here to delete selected files', 'wp-docs'); ?>"></i> | |
| 1188 | - | |
| 1189 | 1296 | <?php endif; ?> |
| 1190 | 1297 | |
| 1191 | 1298 | <?php if($wpdocs_pro && $dir != 0 && wpdocs_can_current_user_upload_file($dir) && $is_file):?> |
| 1192 | 1299 | |
| 1193 | - <i class="fa fa-upload fa-1x wpdocs-front-add-media position-absolute" id="wpdocs_front_file_add_<?php echo $dir; ?>" title="<?php _e('Click here to add files', 'wp-docs'); ?>"></i> | |
| 1300 | +<i class="fa fa-upload fa-1x wpdocs-front-add-media position-absolute" | |
| 1301 | + id="wpdocs_front_file_add_<?php echo esc_attr( $dir ); ?>" | |
| 1302 | + title="<?php echo esc_attr__( 'Click here to add files', 'wp-docs' ); ?>"> | |
| 1303 | +</i> | |
| 1194 | 1304 | |
| 1195 | 1305 | <?php endif; ?> |
| 1196 | 1306 | </nav> |
| 1197 | 1307 | <?php |
| @@ -1224,10 +1334,9 @@ | ||
| 1224 | 1334 | pree($posts_array); |
| 1225 | 1335 | */ |
| 1226 | 1336 | ?> |
| 1227 | 1337 | |
| 1228 | - <?php echo $warning_msg?'<div class="card-body">'.$warning_msg.'</div>':''; ?> | |
| 1229 | - | |
| 1338 | + <?php echo $warning_msg ? '<div class="card-body">' . wp_kses_post( $warning_msg ) . '</div>' : ''; ?> | |
| 1230 | 1339 | <?php if($is_searchbox || $ajax_based_deep_search): ?> |
| 1231 | 1340 | <div class="wpdocs-searchbox"> |
| 1232 | 1341 | <input type="text" placeholder="<?php echo ($ajax_based_deep_search?__('Type here to search...', 'wp-docs'):__('Type here to filter...', 'wp-docs')); ?>" /> |
| 1233 | 1342 | </div> |
| @@ -1249,14 +1358,22 @@ | ||
| 1249 | 1358 | //$wpdocs_child_files_list = wpdocs_added_items($list['id']); |
| 1250 | 1359 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1251 | 1360 | ?> |
| 1252 | 1361 | |
| 1253 | - <div class="col-4 col-md-3 file_wrapper is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>"> | |
| 1254 | - <figure class="figure file_view p-0"> | |
| 1255 | - <span class="fa fa-folder text-warning" style="<?php echo $customize_icon_size; ?>"></span> | |
| 1256 | - <figcaption class="figure-caption text-center" style="<?php echo $customize_font_size; ?>"><?php echo $list['title']; ?></figcaption> | |
| 1257 | - </figure> | |
| 1258 | - </div> | |
| 1362 | +<div class="col-4 col-md-3 file_wrapper is_dir" style="cursor: pointer;" | |
| 1363 | + data-id="<?php echo esc_attr($list['id']); ?>" | |
| 1364 | + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" | |
| 1365 | + data-linked="<?php echo esc_attr($list['content']); ?>" | |
| 1366 | + data-guid="<?php echo esc_attr($is_shortcut ? $list['link'] : ''); ?>"> | |
| 1367 | + | |
| 1368 | + <figure class="figure file_view p-0"> | |
| 1369 | + <span class="fa fa-folder text-warning" style="<?php echo esc_attr($customize_icon_size); ?>"></span> | |
| 1370 | + <figcaption class="figure-caption text-center" style="<?php echo esc_attr($customize_font_size); ?>"> | |
| 1371 | + <?php echo esc_html($list['title']); ?> | |
| 1372 | + </figcaption> | |
| 1373 | + </figure> | |
| 1374 | + | |
| 1375 | +</div> | |
| 1259 | 1376 | <?php |
| 1260 | 1377 | } |
| 1261 | 1378 | } else { |
| 1262 | 1379 | $no_dir_found = true; |
| @@ -1273,14 +1390,23 @@ | ||
| 1273 | 1390 | $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid); |
| 1274 | 1391 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1275 | 1392 | |
| 1276 | 1393 | ?> |
| 1277 | - <div class="col-4 col-md-3 file_wrapper is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>"> | |
| 1278 | - <figure class="figure file_view p-0"> | |
| 1279 | - <span class="fa fa-folder text-warning" style="<?php echo $customize_icon_size; ?>"></span> | |
| 1280 | - <figcaption class="figure-caption text-center" style="<?php echo $customize_font_size; ?>"><?php echo $list['title']; ?></figcaption> | |
| 1281 | - </figure> | |
| 1282 | - </div> | |
| 1394 | +<div class="col-4 col-md-3 file_wrapper is_dir is_deep" style="cursor: pointer;" | |
| 1395 | + data-id="<?php echo esc_attr($list['id']); ?>" | |
| 1396 | + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" | |
| 1397 | + data-linked="<?php echo esc_attr($list['content']); ?>" | |
| 1398 | + data-guid="<?php echo esc_attr($is_shortcut ? $list['guid'] : ''); ?>"> | |
| 1399 | + | |
| 1400 | + <figure class="figure file_view p-0"> | |
| 1401 | + <span class="fa fa-folder text-warning" style="<?php echo esc_attr($customize_icon_size); ?>"></span> | |
| 1402 | + | |
| 1403 | + <figcaption class="figure-caption text-center" style="<?php echo esc_attr($customize_font_size); ?>"> | |
| 1404 | + <?php echo esc_html($list['title']); ?> | |
| 1405 | + </figcaption> | |
| 1406 | + </figure> | |
| 1407 | + | |
| 1408 | +</div> | |
| 1283 | 1409 | <?php |
| 1284 | 1410 | } |
| 1285 | 1411 | } |
| 1286 | 1412 | } |
| @@ -1357,21 +1483,23 @@ | ||
| 1357 | 1483 | default: |
| 1358 | 1484 | //$class .= 'fa-file'; |
| 1359 | 1485 | break; |
| 1360 | 1486 | } |
| 1487 | + | |
| 1488 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 1361 | 1489 | |
| 1362 | 1490 | $file_list_row = ' |
| 1363 | - | |
| 1364 | - | |
| 1365 | - <div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_shallow" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1366 | - <figure class="figure file_view p-1"> | |
| 1367 | - <a href="'.$file_url.'" target="_blank" class="file" ><img class="my-3" src="'.$icon_url.'" /></a> | |
| 1368 | - <figcaption class="figure-caption text-center">'.$title.'</figcaption> | |
| 1369 | - </figure> | |
| 1370 | - </div> | |
| 1371 | - | |
| 1372 | - | |
| 1373 | - '; | |
| 1491 | + | |
| 1492 | +<div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_shallow" style="cursor: pointer;" data-id="'.esc_attr($file).'"> | |
| 1493 | + <figure class="figure file_view p-1"> | |
| 1494 | + <a href="'.esc_url($secured_file_url).'" target="_blank" class="file"> | |
| 1495 | + <img class="my-3" src="'.esc_url($icon_url).'" /> | |
| 1496 | + </a> | |
| 1497 | + <figcaption class="figure-caption text-center">'.esc_html($title).'</figcaption> | |
| 1498 | + </figure> | |
| 1499 | +</div> | |
| 1500 | + | |
| 1501 | +'; | |
| 1374 | 1502 | $list = wpdocs_list_population($list, $file_data, $file_list_row, $default_orderby); |
| 1375 | 1503 | |
| 1376 | 1504 | } |
| 1377 | 1505 | |
| @@ -1442,21 +1570,23 @@ | ||
| 1442 | 1570 | default: |
| 1443 | 1571 | //$class .= 'fa-file'; |
| 1444 | 1572 | break; |
| 1445 | 1573 | } |
| 1574 | + | |
| 1575 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 1446 | 1576 | |
| 1447 | 1577 | $file_list_row = ' |
| 1448 | - | |
| 1449 | - | |
| 1450 | - <div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_deep" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1451 | - <figure class="figure file_view p-1"> | |
| 1452 | - <a href="'.$file_url.'" target="_blank" class="file" ><img class="my-3" src="'.$icon_url.'" /></a> | |
| 1453 | - <figcaption class="figure-caption text-center">'.$title.'</figcaption> | |
| 1454 | - </figure> | |
| 1455 | - </div> | |
| 1456 | - | |
| 1457 | - | |
| 1458 | - '; | |
| 1578 | + | |
| 1579 | +<div title="'.esc_attr($filename).'" class="col-4 col-md-3 is_file text-center is_deep" style="cursor: pointer;" data-id="'.esc_attr($file).'"> | |
| 1580 | + <figure class="figure file_view p-1"> | |
| 1581 | + <a href="'.esc_url($secured_file_url).'" target="_blank" class="file"> | |
| 1582 | + <img class="my-3" src="'.esc_url($icon_url).'" /> | |
| 1583 | + </a> | |
| 1584 | + <figcaption class="figure-caption text-center">'.esc_html($title).'</figcaption> | |
| 1585 | + </figure> | |
| 1586 | +</div> | |
| 1587 | + | |
| 1588 | +'; | |
| 1459 | 1589 | $list = wpdocs_list_population($list, $file_data, $file_list_row, $default_orderby); |
| 1460 | 1590 | |
| 1461 | 1591 | } |
| 1462 | 1592 | |
| @@ -1491,12 +1621,16 @@ | ||
| 1491 | 1621 | foreach ($wpdocs_list as $list) { |
| 1492 | 1622 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1493 | 1623 | ?> |
| 1494 | 1624 | |
| 1495 | - <div class="col-12 file_wrapper is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>"> | |
| 1625 | +<div class="col-12 file_wrapper is_dir" style="cursor: pointer;" | |
| 1626 | + data-id="<?php echo esc_attr($list['id']); ?>" | |
| 1627 | + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" | |
| 1628 | + data-linked="<?php echo esc_attr($list['content']); ?>" | |
| 1629 | + data-guid="<?php echo esc_attr($is_shortcut ? $list['link'] : ''); ?>"> | |
| 1496 | 1630 | <figure class="figure file_view p-2"> |
| 1497 | 1631 | <span class="fa fa-folder text-warning" style="font-size:25px"></span> |
| 1498 | - <small class="text-center"><?php echo $list['title']; ?></small> | |
| 1632 | + <small class="text-center"><?php echo esc_html($list['title']); ?></small> | |
| 1499 | 1633 | </figure> |
| 1500 | 1634 | </div> |
| 1501 | 1635 | <?php |
| 1502 | 1636 | } |
| @@ -1513,12 +1647,16 @@ | ||
| 1513 | 1647 | $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid); |
| 1514 | 1648 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1515 | 1649 | |
| 1516 | 1650 | ?> |
| 1517 | - <div class="col-12 file_wrapper is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>"> | |
| 1651 | + <div class="col-12 file_wrapper is_dir is_deep" style="cursor: pointer;" | |
| 1652 | + data-id="<?php echo esc_attr($list['id']); ?>" | |
| 1653 | + data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" | |
| 1654 | + data-linked="<?php echo esc_attr($list['content']); ?>" | |
| 1655 | + data-guid="<?php echo esc_attr($is_shortcut ? $list['guid'] : ''); ?>"> | |
| 1518 | 1656 | <figure class="figure file_view p-2"> |
| 1519 | 1657 | <span class="fa fa-folder text-warning" style="font-size:25px"></span> |
| 1520 | - <small class="text-center"><?php echo $list['title']; ?></small> | |
| 1658 | + <small class="text-center"><?php echo esc_html($list['title']); ?></small> | |
| 1521 | 1659 | </figure> |
| 1522 | 1660 | </div> |
| 1523 | 1661 | <?php |
| 1524 | 1662 | } |
| @@ -1534,13 +1672,15 @@ | ||
| 1534 | 1672 | extract($file_data); |
| 1535 | 1673 | |
| 1536 | 1674 | |
| 1537 | 1675 | if(trim($file_url)){ |
| 1676 | + | |
| 1677 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 1538 | 1678 | |
| 1539 | 1679 | $file_list_row = ' |
| 1540 | 1680 | <div title="'.esc_attr($filename).'" class="col-12 file_wrapper is_file" style="cursor: pointer;" data-id="'.$file.'"> |
| 1541 | 1681 | <figure class="figure file_view p-3"> |
| 1542 | - <a href="'.$file_url.'" target="_blank" class="file" ><img class="mb-2" src="'.$icon_url.'" style="width: 25px; height: 25px"></a> | |
| 1682 | + <a href="'.$secured_file_url.'" target="_blank" class="file" ><img class="mb-2" src="'.$icon_url.'" style="width: 25px; height: 25px"></a> | |
| 1543 | 1683 | <small class="text-center">'.$title.'</small> |
| 1544 | 1684 | </figure> |
| 1545 | 1685 | </div>'; |
| 1546 | 1686 | |
| @@ -1614,14 +1754,27 @@ | ||
| 1614 | 1754 | <div class="table-responsive" style="zoom:70%"> |
| 1615 | 1755 | <table class="table"> |
| 1616 | 1756 | <thead class="thead"> |
| 1617 | 1757 | <tr> |
| 1618 | - <th><?php _e('Name', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th> | |
| 1619 | - <?php if($details_date_created): ?> <th><?php _e('Created Date', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?> | |
| 1620 | - <?php if($details_date): ?> <th><?php _e('Modified Date', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?> | |
| 1621 | - <?php if($details_type): ?> <th><?php _e('Type', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?> | |
| 1622 | - <?php if($details_size): ?> <th><?php _e('Size', 'wp-docs'); ?> <?php echo $d_v_caret; ?></th><?php endif; ?> | |
| 1623 | - </tr> | |
| 1758 | + <th><?php esc_html_e('Name', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th> | |
| 1759 | + | |
| 1760 | +<?php if ( $details_date_created ) : ?> | |
| 1761 | + <th><?php esc_html_e('Created Date', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th> | |
| 1762 | +<?php endif; ?> | |
| 1763 | + | |
| 1764 | +<?php if ( $details_date ) : ?> | |
| 1765 | + <th><?php esc_html_e('Modified Date', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th> | |
| 1766 | +<?php endif; ?> | |
| 1767 | + | |
| 1768 | +<?php if ( $details_type ) : ?> | |
| 1769 | + <th><?php esc_html_e('Type', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th> | |
| 1770 | +<?php endif; ?> | |
| 1771 | + | |
| 1772 | +<?php if ( $details_size ) : ?> | |
| 1773 | + <th><?php esc_html_e('Size', 'wp-docs'); ?> <?php echo wp_kses_post($d_v_caret); ?></th> | |
| 1774 | +<?php endif; ?> | |
| 1775 | + | |
| 1776 | +</tr> | |
| 1624 | 1777 | </thead> |
| 1625 | 1778 | <?php |
| 1626 | 1779 | $no_dir_found = false; |
| 1627 | 1780 | $no_file_found = false; |
| @@ -1628,13 +1781,13 @@ | ||
| 1628 | 1781 | if (!empty($wpdocs_list)) { |
| 1629 | 1782 | foreach ($wpdocs_list as $list) { |
| 1630 | 1783 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1631 | 1784 | ?> |
| 1632 | - <tr title="<?php echo $list['id']; ?>" class="file_wrapper file_view is_dir" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['link']:''; ?>"> | |
| 1785 | + <tr title="<?php echo esc_attr($list['id']); ?>" class="file_wrapper file_view is_dir" style="cursor: pointer;" data-id="<?php echo esc_attr($list['id']); ?>" data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" data-linked="<?php echo esc_attr($list['content']); ?>" data-guid="<?php echo $is_shortcut?esc_url($list['link']):''; ?>"> | |
| 1633 | 1786 | <td> |
| 1634 | 1787 | <figure class="figure "> |
| 1635 | 1788 | <span class="fa fa-folder text-warning" style="font-size:25px"></span> |
| 1636 | - <small class="text-center mb-1"><?php echo $list['title']; ?></small> | |
| 1789 | + <small class="text-center mb-1"><?php echo esc_html($list['title']); ?></small> | |
| 1637 | 1790 | </figure> |
| 1638 | 1791 | </td> |
| 1639 | 1792 | |
| 1640 | 1793 | <?php if($details_date_created): ?> <td data-time="<?php get_post_time('U', false, $list['id']) ?>"><small><?php echo get_the_date(get_option( 'date_format' ), $list['id']) . ' ' . get_the_time(get_option( 'time_format' ), $list['id']) ?></small></td><?php endif; ?> |
| @@ -1672,13 +1825,13 @@ | ||
| 1672 | 1825 | $list = array('id'=>$list_obj->ID, 'content'=>$list_obj->post_content, 'title'=>$list_obj->post_title, 'type'=>$list_obj->post_type, 'guid'=>$list_obj->guid); |
| 1673 | 1826 | $is_shortcut = ($list['type']==$wpdocs_post_types['shortcut']); |
| 1674 | 1827 | |
| 1675 | 1828 | ?> |
| 1676 | - <tr title="<?php echo $list['id']; ?>" class="file_wrapper file_view is_dir is_deep" style="cursor: pointer;" data-id="<?php echo $list['id']; ?>" data-resource="<?php echo base64_encode($list['id']); ?>" data-linked="<?php echo $list['content']; ?>" data-guid="<?php echo $is_shortcut?$list['guid']:''; ?>"> | |
| 1829 | + <tr title="<?php echo esc_attr($list['id']); ?>" class="file_wrapper file_view is_dir is_deep" style="cursor: pointer;" data-id="<?php echo esc_attr($list['id']); ?>" data-resource="<?php echo esc_attr(base64_encode($list['id'])); ?>" data-linked="<?php echo esc_attr($list['content']); ?>" data-guid="<?php echo $is_shortcut?esc_attr($list['guid']):''; ?>"> | |
| 1677 | 1830 | <td> |
| 1678 | 1831 | <figure class="figure "> |
| 1679 | 1832 | <span class="fa fa-folder text-warning" style="font-size:25px"></span> |
| 1680 | - <small class="text-center mb-1"><?php echo $list['title']; ?></small> | |
| 1833 | + <small class="text-center mb-1"><?php echo esc_html($list['title']); ?></small> | |
| 1681 | 1834 | </figure> |
| 1682 | 1835 | </td> |
| 1683 | 1836 | |
| 1684 | 1837 | <?php if($details_date_created): ?> <td data-time="<?php get_post_time('U', false, $list['id']) ?>"><small><?php echo get_the_date(get_option( 'date_format' ), $list['id']) . ' ' . get_the_time(get_option( 'time_format' ), $list['id']) ?></small></td><?php endif; ?> |
| @@ -1718,11 +1871,11 @@ | ||
| 1718 | 1871 | extract($file_data); |
| 1719 | 1872 | //pree($ts); |
| 1720 | 1873 | |
| 1721 | 1874 | if(trim($icon_url)){ |
| 1722 | - | |
| 1875 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 1723 | 1876 | $files_list_row = ' |
| 1724 | - <tr title="'.esc_attr($filename).'" data-url="'.$file_url.'" class="file_view file_link is_file" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1877 | + <tr title="'.esc_attr($filename).'" data-url="'.$secured_file_url.'" class="file_view file_link is_file" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1725 | 1878 | |
| 1726 | 1879 | <td> |
| 1727 | 1880 | |
| 1728 | 1881 | <figure class="figure file_view"> |
| @@ -1775,11 +1928,13 @@ | ||
| 1775 | 1928 | extract($file_data); |
| 1776 | 1929 | //pree($ts); |
| 1777 | 1930 | |
| 1778 | 1931 | if(trim($icon_url)){ |
| 1932 | + | |
| 1933 | + $secured_file_url = wpdocs_secure_url($file_id); | |
| 1779 | 1934 | |
| 1780 | 1935 | $files_list_row = ' |
| 1781 | - <tr title="'.esc_attr($filename).'" data-url="'.$file_url.'" class="file_view file_link is_file is_deep" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1936 | + <tr title="'.esc_attr($filename).'" data-url="'.$secured_file_url.'" class="file_view file_link is_file is_deep" style="cursor: pointer;" data-id="'.$file.'"> | |
| 1782 | 1937 | |
| 1783 | 1938 | <td> |
| 1784 | 1939 | |
| 1785 | 1940 | <figure class="figure file_view"> |
| @@ -1845,9 +2000,9 @@ | ||
| 1845 | 2000 | </div> |
| 1846 | 2001 | <?php if($is_bootstrap): ?> |
| 1847 | 2002 | <div class="wpdocs_loader wpd_modal d-none"> |
| 1848 | 2003 | <div class="modal_content"> |
| 1849 | - <img src="<?php echo $wpdocs_url.'img/loader.gif' ?>" width="50px" height="50px"> | |
| 2004 | + <img src="<?php echo esc_url($wpdocs_url.'img/loader.gif'); ?>" width="50px" height="50px"> | |
| 1850 | 2005 | </div> |
| 1851 | 2006 | </div> |
| 1852 | 2007 | <?php endif; ?> |
| 1853 | 2008 | |
| @@ -2017,8 +2172,14 @@ | ||
| 2017 | 2172 | add_action('wp_ajax_wpdocs_delete_folder', 'wpdocs_delete_folder'); |
| 2018 | 2173 | |
| 2019 | 2174 | function wpdocs_delete_folder() |
| 2020 | 2175 | { |
| 2176 | + | |
| 2177 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 2178 | + wp_send_json_error( __( 'Unauthorized user', 'wp-docs' ) ); | |
| 2179 | + wp_die(); | |
| 2180 | + } | |
| 2181 | + | |
| 2021 | 2182 | $nonce = sanitize_wpdocs_data(wp_unslash($_POST['nonce'])); |
| 2022 | 2183 | |
| 2023 | 2184 | if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) ) |
| 2024 | 2185 | die (__("Sorry, your nonce did not verify.", 'wp-docs')); |
| @@ -2158,152 +2319,157 @@ | ||
| 2158 | 2319 | add_action('wp_ajax_wpdocs_update_option', 'wpdocs_update_option'); |
| 2159 | 2320 | |
| 2160 | 2321 | if(!function_exists('wpdocs_update_option')){ |
| 2161 | 2322 | function wpdocs_update_option(){ |
| 2323 | + | |
| 2324 | + if ( ! current_user_can('manage_options') ) { | |
| 2325 | + wp_send_json_error('Insufficient permissions.'); | |
| 2326 | + } | |
| 2162 | 2327 | |
| 2328 | + if ( | |
| 2329 | + ! isset($_POST['wpdocs_update_option_nonce']) || | |
| 2330 | + ! wp_verify_nonce($_POST['wpdocs_update_option_nonce'], 'wpdocs_update_options_nonce') | |
| 2331 | + ) { | |
| 2332 | + wp_send_json_error('Invalid nonce '.$_POST['wpdocs_update_option_nonce']); | |
| 2333 | + } else { | |
| 2334 | + //wp_send_json_success('Nonce valid!'); | |
| 2335 | + } | |
| 2163 | 2336 | |
| 2337 | + $return = array( | |
| 2164 | 2338 | |
| 2165 | - if(isset($_POST['wpdocs_update_option_nonce'])){ | |
| 2339 | + 'option_update' => false, | |
| 2340 | + 'dir_move' => false, | |
| 2341 | + ); | |
| 2166 | 2342 | |
| 2167 | - $nonce = sanitize_wpdocs_data(wp_unslash($_POST['wpdocs_update_option_nonce'])); | |
| 2343 | + | |
| 2168 | 2344 | |
| 2169 | - $return = array( | |
| 2345 | + if(isset($_POST['wpdocs_options'])){ | |
| 2170 | 2346 | |
| 2171 | - 'option_update' => false, | |
| 2172 | - 'dir_move' => false, | |
| 2173 | - ); | |
| 2347 | + $wpdocs_options = isset($_POST['wpdocs_options']) ? sanitize_wpdocs_data($_POST['wpdocs_options']) : array(); | |
| 2174 | 2348 | |
| 2175 | - if (!empty($_POST) && isset($_POST['nonce']) && ! wp_verify_nonce( $nonce, 'wpdocs_update_options_nonce' ) ) | |
| 2176 | - die (__("Sorry, your nonce did not verify.", 'wp-docs')); | |
| 2349 | + $wpdocs_dir_id = isset($_POST['wpdocs_dir_id']) ? sanitize_wpdocs_data($_POST['wpdocs_dir_id']) : 0; | |
| 2177 | 2350 | |
| 2178 | - if(isset($_POST['wpdocs_options'])){ | |
| 2179 | 2351 | |
| 2180 | - $wpdocs_options = isset($_POST['wpdocs_options']) ? sanitize_wpdocs_data($_POST['wpdocs_options']) : array(); | |
| 2352 | + $sanitized_option = sanitize_wpdocs_data($wpdocs_options); | |
| 2353 | + $sanitized_option['allowed_role'] = $sanitized_option['allowed_role'] !== 'empty' ? $sanitized_option['allowed_role'] : array(); | |
| 2181 | 2354 | |
| 2182 | - $wpdocs_dir_id = isset($_POST['wpdocs_dir_id']) ? sanitize_wpdocs_data($_POST['wpdocs_dir_id']) : 0; | |
| 2183 | 2355 | |
| 2356 | + if($wpdocs_dir_id == 0){ | |
| 2184 | 2357 | |
| 2185 | - $sanitized_option = sanitize_wpdocs_data($wpdocs_options); | |
| 2186 | - $sanitized_option['allowed_role'] = $sanitized_option['allowed_role'] !== 'empty' ? $sanitized_option['allowed_role'] : array(); | |
| 2358 | + $update = update_option('wpdocs_options', $sanitized_option); | |
| 2187 | 2359 | |
| 2360 | + }else{ | |
| 2188 | 2361 | |
| 2189 | - if($wpdocs_dir_id == 0){ | |
| 2362 | + $update = update_post_meta($wpdocs_dir_id, '_wpdocs_dir_options', $sanitized_option); | |
| 2363 | + $child_dir_list = wpdoc_get_dir_children($wpdocs_dir_id); | |
| 2364 | + if(!empty($child_dir_list)){ | |
| 2365 | + foreach ($child_dir_list as $child_dir) { | |
| 2190 | 2366 | |
| 2191 | - $update = update_option('wpdocs_options', $sanitized_option); | |
| 2367 | + $update = update_post_meta($child_dir, '_wpdocs_dir_options', $sanitized_option); | |
| 2192 | 2368 | |
| 2193 | - }else{ | |
| 2194 | - | |
| 2195 | - $update = update_post_meta($wpdocs_dir_id, '_wpdocs_dir_options', $sanitized_option); | |
| 2196 | - $child_dir_list = wpdoc_get_dir_children($wpdocs_dir_id); | |
| 2197 | - if(!empty($child_dir_list)){ | |
| 2198 | - foreach ($child_dir_list as $child_dir) { | |
| 2199 | - | |
| 2200 | - $update = update_post_meta($child_dir, '_wpdocs_dir_options', $sanitized_option); | |
| 2201 | - | |
| 2202 | - # code... | |
| 2203 | - } | |
| 2369 | + # code... | |
| 2204 | 2370 | } |
| 2371 | + } | |
| 2205 | 2372 | |
| 2206 | - | |
| 2373 | + | |
| 2207 | 2374 | |
| 2208 | - } | |
| 2209 | - } | |
| 2375 | + } | |
| 2376 | + } | |
| 2210 | 2377 | |
| 2211 | 2378 | |
| 2212 | 2379 | |
| 2213 | - if(isset($_POST['wpdocs_move_selected_dir'])){ | |
| 2380 | + if(isset($_POST['wpdocs_move_selected_dir'])){ | |
| 2214 | 2381 | |
| 2215 | - $wpdocs_move_selected_dir = sanitize_wpdocs_data($_POST['wpdocs_move_selected_dir']); | |
| 2216 | - $action_type = $wpdocs_move_selected_dir['action_type']; | |
| 2217 | - | |
| 2382 | + $wpdocs_move_selected_dir = sanitize_wpdocs_data($_POST['wpdocs_move_selected_dir']); | |
| 2383 | + $action_type = $wpdocs_move_selected_dir['action_type']; | |
| 2384 | + | |
| 2218 | 2385 | |
| 2219 | - $is_file = array_key_exists('is_file', $wpdocs_move_selected_dir) ? $wpdocs_move_selected_dir['is_file']: false; | |
| 2220 | - $is_file = $is_file == 'false' ? false: true; | |
| 2386 | + $is_file = array_key_exists('is_file', $wpdocs_move_selected_dir) ? $wpdocs_move_selected_dir['is_file']: false; | |
| 2387 | + $is_file = $is_file == 'false' ? false: true; | |
| 2221 | 2388 | |
| 2222 | 2389 | |
| 2223 | - if(!$is_file && array_key_exists('dir_selected', $wpdocs_move_selected_dir) && | |
| 2224 | - array_key_exists('dir_id', $wpdocs_move_selected_dir)){ | |
| 2390 | + if(!$is_file && array_key_exists('dir_selected', $wpdocs_move_selected_dir) && | |
| 2391 | + array_key_exists('dir_id', $wpdocs_move_selected_dir)){ | |
| 2392 | + | |
| 2393 | + switch($action_type){ | |
| 2394 | + default: | |
| 2395 | + case 'move': | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + $update = wp_update_post( | |
| 2399 | + array( | |
| 2400 | + 'ID' => $wpdocs_move_selected_dir['dir_selected'], | |
| 2401 | + 'post_parent' => $wpdocs_move_selected_dir['dir_id'] | |
| 2402 | + ) | |
| 2403 | + ); | |
| 2225 | 2404 | |
| 2226 | - switch($action_type){ | |
| 2227 | - default: | |
| 2228 | - case 'move': | |
| 2405 | + if($update == $wpdocs_move_selected_dir['dir_selected']){ | |
| 2406 | + $return['dir_move'] = true; | |
| 2407 | + } | |
| 2229 | 2408 | |
| 2230 | - | |
| 2231 | - $update = wp_update_post( | |
| 2232 | - array( | |
| 2233 | - 'ID' => $wpdocs_move_selected_dir['dir_selected'], | |
| 2234 | - 'post_parent' => $wpdocs_move_selected_dir['dir_id'] | |
| 2235 | - ) | |
| 2236 | - ); | |
| 2409 | + break; | |
| 2410 | + | |
| 2411 | + case 'copy': | |
| 2412 | + $existing_dir = get_post($wpdocs_move_selected_dir['dir_selected']); | |
| 2413 | + $existing_dir = (is_object($existing_dir)?(array)$existing_dir:array()); | |
| 2414 | + if(!empty($existing_dir) && array_key_exists('ID', $existing_dir) && function_exists('wpdocs_recursive_copy_folder')){ | |
| 2237 | 2415 | |
| 2238 | - if($update == $wpdocs_move_selected_dir['dir_selected']){ | |
| 2239 | - $return['dir_move'] = true; | |
| 2240 | - } | |
| 2416 | + wpdocs_recursive_copy_folder($wpdocs_move_selected_dir['dir_id'], $existing_dir); | |
| 2241 | 2417 | |
| 2242 | - break; | |
| 2418 | + $return['dir_move'] = true; | |
| 2419 | + | |
| 2420 | + } | |
| 2243 | 2421 | |
| 2244 | - case 'copy': | |
| 2245 | - $existing_dir = get_post($wpdocs_move_selected_dir['dir_selected']); | |
| 2246 | - $existing_dir = (is_object($existing_dir)?(array)$existing_dir:array()); | |
| 2247 | - if(!empty($existing_dir) && array_key_exists('ID', $existing_dir) && function_exists('wpdocs_recursive_copy_folder')){ | |
| 2248 | - | |
| 2249 | - wpdocs_recursive_copy_folder($wpdocs_move_selected_dir['dir_id'], $existing_dir); | |
| 2250 | - | |
| 2251 | - $return['dir_move'] = true; | |
| 2252 | - | |
| 2253 | - } | |
| 2254 | - | |
| 2255 | - | |
| 2256 | - break; | |
| 2257 | - } | |
| 2258 | - | |
| 2259 | - | |
| 2260 | - | |
| 2261 | - } | |
| 2262 | - //exit; | |
| 2422 | + | |
| 2423 | + break; | |
| 2424 | + } | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + } | |
| 2429 | + //exit; | |
| 2263 | 2430 | |
| 2264 | - if($is_file){ | |
| 2431 | + if($is_file){ | |
| 2265 | 2432 | |
| 2266 | - $file_id = $wpdocs_move_selected_dir['files']; | |
| 2267 | - | |
| 2268 | - $current_dir = $wpdocs_move_selected_dir['file_dir']; | |
| 2433 | + $file_id = $wpdocs_move_selected_dir['files']; | |
| 2434 | + | |
| 2435 | + $current_dir = $wpdocs_move_selected_dir['file_dir']; | |
| 2436 | + | |
| 2437 | + $new_dir = $wpdocs_move_selected_dir['dir_id']; | |
| 2438 | + | |
| 2439 | + $files = wpdocs_added_items($current_dir); | |
| 2440 | + | |
| 2441 | + $file_id = is_array($file_id) ? $file_id : array($file_id); | |
| 2442 | + $files = array_diff($files, $file_id); | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + switch($action_type){ | |
| 2446 | + default: | |
| 2447 | + case 'move': | |
| 2448 | + | |
| 2449 | + update_post_meta($current_dir, 'wpdocs_items', $files); | |
| 2450 | + | |
| 2451 | + break; | |
| 2269 | 2452 | |
| 2270 | - $new_dir = $wpdocs_move_selected_dir['dir_id']; | |
| 2271 | - | |
| 2272 | - $files = wpdocs_added_items($current_dir); | |
| 2273 | - | |
| 2274 | - $file_id = is_array($file_id) ? $file_id : array($file_id); | |
| 2275 | - $files = array_diff($files, $file_id); | |
| 2276 | - | |
| 2277 | - | |
| 2278 | - switch($action_type){ | |
| 2279 | - default: | |
| 2280 | - case 'move': | |
| 2281 | - | |
| 2282 | - update_post_meta($current_dir, 'wpdocs_items', $files); | |
| 2283 | - | |
| 2284 | - break; | |
| 2453 | + case 'copy': | |
| 2285 | 2454 | |
| 2286 | - case 'copy': | |
| 2287 | - | |
| 2288 | - break; | |
| 2289 | - | |
| 2290 | - } | |
| 2455 | + break; | |
| 2456 | + | |
| 2457 | + } | |
| 2291 | 2458 | |
| 2292 | - $update = wpdocs_update_files_meta($new_dir, $file_id); | |
| 2293 | - | |
| 2294 | - if($update === true){ | |
| 2295 | - $return['dir_move'] = true; | |
| 2296 | - } | |
| 2459 | + $update = wpdocs_update_files_meta($new_dir, $file_id); | |
| 2460 | + | |
| 2461 | + if($update === true){ | |
| 2462 | + $return['dir_move'] = true; | |
| 2463 | + } | |
| 2297 | 2464 | |
| 2298 | - } | |
| 2299 | - } | |
| 2465 | + } | |
| 2466 | + } | |
| 2300 | 2467 | |
| 2301 | - echo wp_json_encode($return); | |
| 2468 | + echo wp_json_encode($return); | |
| 2302 | 2469 | |
| 2303 | - } | |
| 2304 | 2470 | |
| 2305 | - wp_die(); | |
| 2471 | + wp_die(); | |
| 2306 | 2472 | |
| 2307 | 2473 | } |
| 2308 | 2474 | } |
| 2309 | 2475 | |
| @@ -2360,9 +2526,9 @@ | ||
| 2360 | 2526 | |
| 2361 | 2527 | if(!array_key_exists('id', $wp_dir)) continue; |
| 2362 | 2528 | $wpdocs_list_child = wpdocs_list($wp_dir['id']); |
| 2363 | 2529 | |
| 2364 | - $option .= '<option value="'.$wp_dir['id'].'" data-parent="'.$dir.'">'.str_repeat(str_replace(' ', ' ', $str), $level).$wp_dir['title'].'</option>'; | |
| 2530 | + $option .= '<option value="'.esc_attr($wp_dir['id']).'" data-parent="'.esc_attr($dir).'">'.str_repeat(str_replace(' ', ' ', $str), $level).esc_html($wp_dir['title']).'</option>'; | |
| 2365 | 2531 | |
| 2366 | 2532 | |
| 2367 | 2533 | if(!empty($wpdocs_list_child)){ |
| 2368 | 2534 | |
| @@ -2396,9 +2562,9 @@ | ||
| 2396 | 2562 | |
| 2397 | 2563 | <nav aria-label="breadcrumb" class="wpdocs-nav"> |
| 2398 | 2564 | <ol class="breadcrumb bg-light" style="border-bottom:1px solid #dee2e6;border-radius: 0;"> |
| 2399 | 2565 | |
| 2400 | - <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo $get_permalink ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li> | |
| 2566 | + <li class="breadcrumb-item bread_home_url"><a class="wpd_bread_item" href="<?php echo esc_url($get_permalink); ?>" data-id="0"><?php _e('Home', 'wp-docs'); ?></a></li> | |
| 2401 | 2567 | <?php |
| 2402 | 2568 | |
| 2403 | 2569 | foreach (array_reverse($breadcrumb_array) as $bread_key => $bread_value) { |
| 2404 | 2570 | $active = ''; |
| @@ -2415,9 +2581,9 @@ | ||
| 2415 | 2581 | } |
| 2416 | 2582 | |
| 2417 | 2583 | |
| 2418 | 2584 | ?> |
| 2419 | - <li class="breadcrumb-item <?php echo $active ?>" aria-current="<?php echo $page; ?>"><?php echo $link ?></li> | |
| 2585 | + <li class="breadcrumb-item <?php echo esc_attr($active); ?>" aria-current="<?php echo esc_attr($page); ?>"><?php echo ($link); ?></li> | |
| 2420 | 2586 | |
| 2421 | 2587 | <?php |
| 2422 | 2588 | } |
| 2423 | 2589 | |
| @@ -2653,13 +2819,91 @@ | ||
| 2653 | 2819 | return $ret; |
| 2654 | 2820 | |
| 2655 | 2821 | } |
| 2656 | 2822 | } |
| 2823 | + if(!function_exists('wpdocs_file_download')){ | |
| 2824 | + function wpdocs_file_download(){ | |
| 2825 | + | |
| 2826 | + if(empty($_GET['wpdocs_dl'])){ | |
| 2827 | + return; | |
| 2828 | + } | |
| 2829 | + | |
| 2830 | + $file_id = absint( | |
| 2831 | + wp_unslash($_GET['wpdocs_dl']) | |
| 2832 | + ); | |
| 2833 | + | |
| 2834 | + if(!$file_id){ | |
| 2835 | + status_header(404); | |
| 2836 | + exit; | |
| 2837 | + } | |
| 2838 | + | |
| 2839 | + $nonce = isset($_GET['wpdocs_nonce']) | |
| 2840 | + ? sanitize_text_field( | |
| 2841 | + wp_unslash($_GET['wpdocs_nonce']) | |
| 2842 | + ) | |
| 2843 | + : ''; | |
| 2844 | + | |
| 2845 | + if( | |
| 2846 | + !wp_verify_nonce( | |
| 2847 | + $nonce, | |
| 2848 | + 'wpdocs_dl_' . $file_id | |
| 2849 | + ) | |
| 2850 | + ){ | |
| 2851 | + status_header(403); | |
| 2852 | + exit; | |
| 2853 | + } | |
| 2854 | + | |
| 2855 | + // Adjust this according to where you store the file | |
| 2856 | + $file = get_attached_file($file_id); | |
| 2857 | + | |
| 2858 | + if( | |
| 2859 | + !$file || | |
| 2860 | + !file_exists($file) | |
| 2861 | + ){ | |
| 2862 | + status_header(404); | |
| 2863 | + exit; | |
| 2864 | + } | |
| 2865 | + | |
| 2866 | + $uploads = wp_get_upload_dir(); | |
| 2867 | + $base_real = realpath($uploads['basedir']); | |
| 2868 | + $file_real = realpath($file); | |
| 2869 | + | |
| 2870 | + if( | |
| 2871 | + !$base_real || | |
| 2872 | + !$file_real || | |
| 2873 | + strpos( | |
| 2874 | + $file_real, | |
| 2875 | + $base_real . DIRECTORY_SEPARATOR | |
| 2876 | + ) !== 0 | |
| 2877 | + ){ | |
| 2878 | + status_header(403); | |
| 2879 | + exit; | |
| 2880 | + } | |
| 2881 | + | |
| 2882 | + $mime = wp_check_filetype($file_real); | |
| 2883 | + $mime = !empty($mime['type']) | |
| 2884 | + ? $mime['type'] | |
| 2885 | + : 'application/octet-stream'; | |
| 2886 | + | |
| 2887 | + header('Content-Type: ' . $mime); | |
| 2888 | + header('Content-Length: ' . filesize($file_real)); | |
| 2889 | + header( | |
| 2890 | + 'Content-Disposition: inline; filename="' . | |
| 2891 | + basename($file_real) . | |
| 2892 | + '"' | |
| 2893 | + ); | |
| 2894 | + | |
| 2895 | + readfile($file_real); | |
| 2896 | + exit; | |
| 2897 | + } | |
| 2898 | + } | |
| 2657 | 2899 | |
| 2658 | 2900 | add_action('init', 'wpdocs_dir_actions'); |
| 2659 | 2901 | if(!function_exists('wpdocs_dir_actions')){ |
| 2660 | 2902 | function wpdocs_dir_actions(){ |
| 2661 | 2903 | |
| 2904 | + wpdocs_file_download(); | |
| 2905 | + | |
| 2662 | 2906 | if(is_admin() && get_option('wpdocs_memphis_uninstall')){ |
| 2663 | 2907 | if(wp_docs_memphis_folder_preserve('mdocs_2', 'mdocs')){ |
| 2664 | 2908 | update_option('wpdocs_memphis_uninstall', false); |
| 2665 | 2909 | } |
| @@ -3110,31 +3354,34 @@ | ||
| 3110 | 3354 | |
| 3111 | 3355 | } |
| 3112 | 3356 | } |
| 3113 | 3357 | |
| 3358 | + | |
| 3114 | 3359 | if(!function_exists('wp_docs_relocate_memphis_meta')){ |
| 3115 | 3360 | function wp_docs_relocate_memphis_meta($dir_id){ |
| 3116 | 3361 | global $wpdocs_imported_files, $wpdocs_imported_folder; |
| 3362 | + | |
| 3363 | + // Ensure arrays are initialized properly before using them | |
| 3364 | + $wpdocs_imported_files = (is_array($wpdocs_imported_files) ? $wpdocs_imported_files : array()); | |
| 3365 | + $wpdocs_imported_folder = (is_array($wpdocs_imported_folder) ? $wpdocs_imported_folder : array()); | |
| 3366 | + | |
| 3117 | 3367 | $wpdocs_items = get_post_meta($dir_id, 'wpdocs_items', true); |
| 3118 | 3368 | $wpdocs_items = (is_array($wpdocs_items) ? $wpdocs_items : array()); |
| 3119 | 3369 | $dir_slug = get_post_meta($dir_id, '_wpdocs_memphis_slug', true); |
| 3120 | - | |
| 3121 | - $wpdocs_imported_files = (is_array($wpdocs_imported_files)?$wpdocs_imported_files:array()); | |
| 3122 | - | |
| 3370 | + | |
| 3123 | 3371 | if(!empty($wpdocs_items)){ |
| 3124 | - | |
| 3125 | 3372 | $wpdocs_imported_files = array_diff($wpdocs_imported_files, $wpdocs_items); |
| 3126 | 3373 | } |
| 3127 | - | |
| 3374 | + | |
| 3128 | 3375 | if($dir_slug){ |
| 3129 | 3376 | $wpdocs_imported_folder = array_diff($wpdocs_imported_folder, array($dir_slug)); |
| 3130 | 3377 | } |
| 3131 | - | |
| 3378 | + | |
| 3132 | 3379 | update_option('wpdocs_imported_folder', $wpdocs_imported_folder); |
| 3133 | 3380 | update_option('wpdocs_imported_files', $wpdocs_imported_files); |
| 3381 | + } | |
| 3382 | + } | |
| 3134 | 3383 | |
| 3135 | - }; | |
| 3136 | - } | |
| 3137 | 3384 | |
| 3138 | 3385 | if(!function_exists('wp_docs_memphis_import_files')){ |
| 3139 | 3386 | function wp_docs_memphis_import_files(){ |
| 3140 | 3387 | global $memphis_folders_id, $memphis_files_array, $wpdocs_imported_files, $wpdocs_memphis_list, $wpdocs_post_types; |
| @@ -3170,8 +3417,10 @@ | ||
| 3170 | 3417 | |
| 3171 | 3418 | if(!empty($dir_list)){ |
| 3172 | 3419 | foreach($dir_list as $dir_id){ |
| 3173 | 3420 | update_post_meta($attachment_id, '_wpdocs_memphis_media_file', true); |
| 3421 | + update_post_meta($attachment_id, '_wpdocs_memphis_file_id', $file_data['id']); | |
| 3422 | + | |
| 3174 | 3423 | $wpdocs_imported_files[] = $attachment_id; |
| 3175 | 3424 | wpdocs_update_files_meta($dir_id, $files); |
| 3176 | 3425 | } |
| 3177 | 3426 | unset($memphis_files_array[$file_index]); |
| @@ -3352,15 +3601,15 @@ | ||
| 3352 | 3601 | $default_ext = ''; |
| 3353 | 3602 | |
| 3354 | 3603 | $breadcrumb = get_the_title($dir); |
| 3355 | 3604 | ?> |
| 3356 | - <small class="alert alert-success d-block"><i class="fas fa-chevron-right"></i> <?php echo $breadcrumb; ?></small> | |
| 3605 | + <small class="alert alert-success d-block"><i class="fas fa-chevron-right"></i> <?php echo esc_html($breadcrumb); ?></small> | |
| 3357 | 3606 | <?php |
| 3358 | 3607 | |
| 3359 | 3608 | } |
| 3360 | 3609 | ?> |
| 3361 | 3610 | <label for="wpdocs_options_file"> |
| 3362 | - <input <?php checked($is_file); ?> type="checkbox" class="<?php echo $dir_option_class; ?>" name="wpdocs_options[file_upload]" value="file_upload" id="wpdocs_options_file" /> | |
| 3611 | + <input <?php checked($is_file); ?> type="checkbox" class="<?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[file_upload]" value="file_upload" id="wpdocs_options_file" /> | |
| 3363 | 3612 | <?php echo __('File Upload Front-end', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small> <i title="<?php echo __('This icon will appear on front-end for users', 'wp-docs'); ?>" class="fa fa-upload" style="color:#ffc107"></i> |
| 3364 | 3613 | <a href="https://www.youtube.com/embed/flFmqpJCwYk" target="_blank"><?php echo __('Video Tutorial', 'wp-docs'); ?></a> |
| 3365 | 3614 | </label> |
| 3366 | 3615 | |
| @@ -3368,9 +3617,9 @@ | ||
| 3368 | 3617 | |
| 3369 | 3618 | <ul class="ml-4 <?php echo $is_file ? '' : 'd-none'?>"> |
| 3370 | 3619 | <li> |
| 3371 | 3620 | <label for="wpdocs_options_current_user_files"> |
| 3372 | - <input class="<?php echo $dir_option_class; ?>" <?php checked($is_file && $is_current_user_files); ?> type="checkbox" name="wpdocs_options[current_user_files]" value="current_user_files" id="wpdocs_options_current_user_files" /> | |
| 3621 | + <input class="<?php echo esc_attr($dir_option_class); ?>" <?php checked($is_file && $is_current_user_files); ?> type="checkbox" name="wpdocs_options[current_user_files]" value="current_user_files" id="wpdocs_options_current_user_files" /> | |
| 3373 | 3622 | <?php echo __('Do not make files public uploaded by users', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small> |
| 3374 | 3623 | </label> |
| 3375 | 3624 | </li> |
| 3376 | 3625 | |
| @@ -3375,9 +3624,9 @@ | ||
| 3375 | 3624 | </li> |
| 3376 | 3625 | |
| 3377 | 3626 | <li> |
| 3378 | 3627 | <label for="wpdocs_options_del_from_front"> |
| 3379 | - <input class="<?php echo $dir_option_class; ?>" <?php checked($is_file && $is_del_from_front); ?> type="checkbox" name="wpdocs_options[del_from_front]" value="del_from_front" id="wpdocs_options_del_from_front" /> | |
| 3628 | + <input class="<?php echo esc_attr($dir_option_class); ?>" <?php checked($is_file && $is_del_from_front); ?> type="checkbox" name="wpdocs_options[del_from_front]" value="del_from_front" id="wpdocs_options_del_from_front" /> | |
| 3380 | 3629 | <?php echo __('User can delete the files from front-end?', 'wp-docs'); ?> <small><?php echo $wpdocs_pro?__('(Optional)', 'wp-docs'):__('(Premium)', 'wp-docs'); ?></small> <i class="fas fa-trash-alt" style="color:#ffc107"></i> |
| 3381 | 3630 | </label> |
| 3382 | 3631 | </li> |
| 3383 | 3632 | |
| @@ -3387,9 +3636,9 @@ | ||
| 3387 | 3636 | </label> |
| 3388 | 3637 | |
| 3389 | 3638 | |
| 3390 | 3639 | |
| 3391 | - <select class="wpdocs_options_allowed_role <?php echo $dir_option_class; ?>" name="wpdocs_options[allowed_role]" data-name="allowed_role" id="wpdocs_options_allowed_role" multiple placeholder="<?php echo __('Select roles to allow upload', 'wp-docs'); ?>"> | |
| 3640 | + <select class="wpdocs_options_allowed_role <?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[allowed_role]" data-name="allowed_role" id="wpdocs_options_allowed_role" multiple placeholder="<?php echo __('Select roles to allow upload', 'wp-docs'); ?>"> | |
| 3392 | 3641 | |
| 3393 | 3642 | <?php echo wpdocs_get_user_roles_options($allowed_role) ?> |
| 3394 | 3643 | |
| 3395 | 3644 | </select> |
| @@ -3400,9 +3649,9 @@ | ||
| 3400 | 3649 | <li> |
| 3401 | 3650 | <label for="wpdocs_options_allowed_ext"> |
| 3402 | 3651 | <?php echo __('Allowed File Types', 'wp-docs'); ?> <?php echo ($wpdocs_pro?'':'<small>'.__('(Premium)', 'wp-docs').'</small> '); ?> <i class="fas fa-photo-video" style="color:#ffc107"></i> |
| 3403 | 3652 | </label> |
| 3404 | - <input type="text" class="form-control <?php echo $dir_option_class; ?>" name="wpdocs_options[allowed_ext]" data-name="allowed_ext" value="<?php echo $allowed_ext; ?>" id="wpdocs_options_allowed_ext" title="<?php _e('Leave blank if you want to allow all type of files', 'wp-docs'); ?>" placeholder="<?php echo $default_ext; ?>" /> | |
| 3653 | + <input type="text" class="form-control <?php echo esc_attr($dir_option_class); ?>" name="wpdocs_options[allowed_ext]" data-name="allowed_ext" value="<?php echo esc_attr($allowed_ext); ?>" id="wpdocs_options_allowed_ext" title="<?php _e('Leave blank if you want to allow all type of files', 'wp-docs'); ?>" placeholder="<?php echo esc_attr($default_ext); ?>" /> | |
| 3405 | 3654 | |
| 3406 | 3655 | </li> |
| 3407 | 3656 | |
| 3408 | 3657 | </ul> |
| @@ -3567,4 +3816,5 @@ | ||
| 3567 | 3816 | function wpdoc_humanize($str){ |
| 3568 | 3817 | return ucwords(str_replace(array('-', '_'), ' ', $str)); |
| 3569 | 3818 | } |
| 3570 | 3819 | } |
| 3820 | + include_once('functions-verify.php'); | |