Changeset 2113409
- Timestamp:
- 06/27/2019 07:03:13 AM (7 years ago)
- Location:
- custom-404-pro/trunk
- Files:
-
- 13 edited
-
README.md (modified) (1 diff)
-
admin/AdminClass.php (modified) (6 diffs)
-
admin/Helpers.php (modified) (1 diff)
-
admin/views/logs.php (modified) (1 diff)
-
admin/views/migrate.php (modified) (2 diffs)
-
admin/views/reset.php (modified) (2 diffs)
-
admin/views/settings-general.php (modified) (2 diffs)
-
admin/views/settings-global-redirect.php (modified) (1 diff)
-
custom-404-pro.php (modified) (1 diff)
-
includes/ActivateClass.php (modified) (1 diff)
-
includes/PluginClass.php (modified) (1 diff)
-
includes/UninstallClass.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-404-pro/trunk/README.md
r2087394 r2113409 5 5 Override the default 404 page with **any page** from the Admin Panel or a **Custom URL**. 6 6 7 **UPDATE **: In version 3.2.2 and above, we've added the ability to migrate your old logs to the new logging system. It's highly recommended as you'll get immense performance benefits in the WP Dashboard. Once you've migrated your logs to the new system, you should use the Reset tab and make sure that they're completely gone from your WP Install.7 **UPDATE [June 26, 2019]**: This plugin is currently taken off the [WordPress plugin repository](https://wordpress.org/plugins/custom-404-pro/) due to a few security loopholes. I am currently working on the highest priority to fix them and work with the WordPress Plugin team to get it back up. I apologize for any inconvenience caused to all of you and I appreciate your understanding in this matter. Thanks! 8 8 9 9 As always, if you do like the plugin, please take a minute and give it a rating. Thanks! -
custom-404-pro/trunk/admin/AdminClass.php
r2112484 r2113409 8 8 9 9 public function create_menu() { 10 add_menu_page( 'Custom 404 Pro', 'Custom 404 Pro', 'manage_options', 'c4p-main', array( $this, 'page_logs' ), 'dashicons-chart-bar' ); 11 add_submenu_page( 'c4p-main', 'Logs', 'Logs', 'manage_options', 'c4p-main', array( $this, 'page_logs' ) ); 12 add_submenu_page( 'c4p-main', 'Settings', 'Settings', 'manage_options', 'c4p-settings', array( $this, 'page_settings' ) ); 13 add_submenu_page( 'c4p-main', 'Migrate', 'Migrate', 'manage_options', 'c4p-migrate', array( $this, 'page_migrate' ) ); 14 add_submenu_page( 'c4p-main', 'Reset', 'Reset', 'manage_options', 'c4p-reset', array( $this, 'page_reset' ) ); 15 add_submenu_page( 'c4p-main', 'About', 'About', 'manage_options', 'c4p-about', array( $this, 'page_about' ) ); 10 if(current_user_can('administrator')) { 11 add_menu_page( 'Custom 404 Pro', 'Custom 404 Pro', 'manage_options', 'c4p-main', array( $this, 'page_logs' ), 'dashicons-chart-bar' ); 12 add_submenu_page( 'c4p-main', 'Logs', 'Logs', 'manage_options', 'c4p-main', array( $this, 'page_logs' ) ); 13 add_submenu_page( 'c4p-main', 'Settings', 'Settings', 'manage_options', 'c4p-settings', array( $this, 'page_settings' ) ); 14 add_submenu_page( 'c4p-main', 'Migrate', 'Migrate', 'manage_options', 'c4p-migrate', array( $this, 'page_migrate' ) ); 15 add_submenu_page( 'c4p-main', 'Reset', 'Reset', 'manage_options', 'c4p-reset', array( $this, 'page_reset' ) ); 16 add_submenu_page( 'c4p-main', 'About', 'About', 'manage_options', 'c4p-about', array( $this, 'page_about' ) ); 17 } 16 18 } 17 19 … … 37 39 38 40 public function enqueue_styles() { 39 if ( array_key_exists( 'page', $_REQUEST ) ) { 40 $request = esc_html($_REQUEST['page']); 41 if ( $request === 'c4p-settings' || $request === 'c4p-main' || $request === 'c4p-about' ) { 42 wp_enqueue_style( 'custom-404-pro-admin-css', plugin_dir_url( __FILE__ ) . 'css/custom-404-pro-admin.css', array(), '3.2.0' ); 41 if(current_user_can('administrator')) { 42 if ( array_key_exists( 'page', $_REQUEST ) ) { 43 $request = sanitize_text_field($_REQUEST['page']); 44 if ( $request === 'c4p-settings' || $request === 'c4p-main' || $request === 'c4p-about' ) { 45 wp_enqueue_style( 'custom-404-pro-admin-css', plugin_dir_url( __FILE__ ) . 'css/custom-404-pro-admin.css', array(), '3.2.0' ); 46 } 43 47 } 44 48 } … … 46 50 47 51 public function enqueue_scripts() { 48 if ( array_key_exists( 'page', $_REQUEST ) ) { 49 $request = esc_html($_REQUEST['page']); 50 if ( $request === 'c4p-settings' || $request === 'c4p-main' ) { 51 wp_enqueue_script( 'custom-404-pro-admin-js', plugin_dir_url( __FILE__ ) . 'js/custom-404-pro-admin.js', array( 'jquery' ), '3.2.0', false ); 52 if(current_user_can('administrator')) { 53 if ( array_key_exists( 'page', $_REQUEST ) ) { 54 $request = sanitize_text_field($_REQUEST['page']); 55 if ( $request === 'c4p-settings' || $request === 'c4p-main' ) { 56 wp_enqueue_script( 'custom-404-pro-admin-js', plugin_dir_url( __FILE__ ) . 'js/custom-404-pro-admin.js', array( 'jquery' ), '3.2.0', false ); 57 } 52 58 } 53 59 } … … 58 64 $messageType = 'success'; 59 65 $html = ''; 60 if ( array_key_exists( 'c4pmessage', $_REQUEST ) ) { 61 $message = urldecode( esc_html($_REQUEST['c4pmessage']) ); 62 if ( array_key_exists( 'c4pmessageType', $_REQUEST ) ) { 63 $messageType = esc_html($_REQUEST['c4pmessageType']); 64 } 65 $html .= '<div class="notice notice-' . $messageType . ' is-dismissible">'; 66 $html .= '<p>' . $message . '</p>'; 67 $html .= '</div>'; 68 echo $html; 66 if(current_user_can('administrator')) { 67 if ( array_key_exists( 'c4pmessage', $_REQUEST ) ) { 68 $message = urldecode( sanitize_text_field($_REQUEST['c4pmessage']) ); 69 if ( array_key_exists( 'c4pmessageType', $_REQUEST ) ) { 70 $messageType = sanitize_text_field($_REQUEST['c4pmessageType']); 71 } 72 $html .= '<div class="notice notice-' . $messageType . ' is-dismissible">'; 73 $html .= '<p>' . $message . '</p>'; 74 $html .= '</div>'; 75 echo $html; 76 } 69 77 } 70 78 } … … 72 80 public function form_settings_global_redirect() { 73 81 global $wpdb; 74 $mode = $_POST['mode']; 75 $page = $_POST['mode_page']; 76 $url = $_POST['mode_url']; 77 self::update_mode( $mode, $page, $url ); 78 $message = urlencode( 'Saved!' ); 79 wp_redirect( admin_url( 'admin.php?page=c4p-settings&tab=global-redirect&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 82 if(wp_verify_nonce($_POST['form-settings-global-redirect'], 'form-settings-global-redirect') && check_admin_referer("form-settings-global-redirect", "form-settings-global-redirect") && current_user_can('administrator')) { 83 $mode = sanitize_text_field($_POST['mode']); 84 $page = sanitize_text_field($_POST['mode_page']); 85 $url = sanitize_text_field($_POST['mode_url']); 86 self::update_mode( $mode, $page, $url ); 87 $message = urlencode( 'Saved!' ); 88 wp_redirect( admin_url( 'admin.php?page=c4p-settings&tab=global-redirect&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 89 } 80 90 } 81 91 82 92 public function form_settings_general() { 83 93 global $wpdb; 84 if ( isset( $_POST['send_email'] ) && $_POST['send_email'] === 'on' ) { 85 $field_send_email = true; 86 } else { 87 $field_send_email = false; 88 } 89 if ( isset( $_POST['logging_enabled'] ) && $_POST['logging_enabled'] === 'enabled' ) { 90 $field_logging_enabled = true; 91 } else { 92 $field_logging_enabled = false; 93 } 94 if ( isset( $_POST['log_ip'] ) && $_POST['log_ip'] === 'on' ) { 95 $field_log_ip = true; 96 } else { 97 $field_log_ip = false; 98 } 99 $field_redirect_error_code = $_POST['redirect_error_code']; 100 $this->helpers->update_option( 'send_email', $field_send_email ); 101 $this->helpers->update_option( 'logging_enabled', $field_logging_enabled ); 102 $this->helpers->update_option( 'redirect_error_code', $field_redirect_error_code ); 103 // New options 104 $this->helpers->upsert_option( 'log_ip', $field_log_ip ); 105 $message = urlencode( 'Saved!' ); 106 wp_redirect( admin_url( 'admin.php?page=c4p-settings&tab=general&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 94 if(wp_verify_nonce($_POST['form-settings-general'], 'form-settings-general') && check_admin_referer("form-settings-general", "form-settings-general") && current_user_can('administrator')) { 95 $send_email = sanitize_text_field($_POST['send_email']); 96 $logging_enabled = sanitize_text_field($_POST['logging_enabled']); 97 $log_ip = sanitize_text_field($_POST['log_ip']); 98 $field_redirect_error_code = sanitize_text_field($_POST['redirect_error_code']); 99 if ( isset( $send_email ) && $send_email === 'on' ) { 100 $field_send_email = true; 101 } else { 102 $field_send_email = false; 103 } 104 if ( isset( $logging_enabled ) && $logging_enabled === 'enabled' ) { 105 $field_logging_enabled = true; 106 } else { 107 $field_logging_enabled = false; 108 } 109 if ( isset( $log_ip ) && $log_ip === 'on' ) { 110 $field_log_ip = true; 111 } else { 112 $field_log_ip = false; 113 } 114 $this->helpers->update_option( 'send_email', $field_send_email ); 115 $this->helpers->update_option( 'logging_enabled', $field_logging_enabled ); 116 $this->helpers->update_option( 'redirect_error_code', $field_redirect_error_code ); 117 // New options 118 $this->helpers->upsert_option( 'log_ip', $field_log_ip ); 119 $message = urlencode( 'Saved!' ); 120 wp_redirect( admin_url( 'admin.php?page=c4p-settings&tab=general&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 121 } 107 122 } 108 123 109 124 public function custom_404_pro_admin_init() { 110 125 global $wpdb; 111 if ( array_key_exists( 'action', $_REQUEST ) ) { 112 $action = esc_html($_REQUEST['action']); 113 if ( $action === 'c4p-logs--delete' ) { 114 if ( array_key_exists( 'path', $_REQUEST ) ) { 115 $this->helpers->delete_logs( esc_html($_REQUEST['path']) ); 116 $message = urlencode( 'Log(s) successfully deleted!' ); 126 if(current_user_can('administrator')) { 127 if ( array_key_exists( 'action', $_REQUEST ) ) { 128 $action = sanitize_text_field($_REQUEST['action']); 129 if ( $action === 'c4p-logs--delete' ) { 130 if ( array_key_exists( 'path', $_REQUEST ) ) { 131 $this->helpers->delete_logs( sanitize_text_field($_REQUEST['path']) ); 132 $message = urlencode( 'Log(s) successfully deleted!' ); 133 wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 134 } else { 135 $message = urlencode( 'Please select a few logs to delete and try again.' ); 136 wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=warning' ) ); 137 } 138 } elseif ( $action === 'c4p-logs--delete-all' ) { 139 $this->helpers->delete_logs( 'all' ); 140 $message = urlencode( 'All Logs successfully deleted!' ); 117 141 wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 142 } elseif ( $action === 'c4p-logs--export-csv' ) { 143 $this->helpers->export_logs_csv(); 144 } 145 } 146 } 147 } 148 149 public function custom_404_pro_redirect() { 150 global $wpdb; 151 if(current_user_can('administrator')) { 152 if ( is_404() ) { 153 $sql = 'SELECT * FROM ' . $this->helpers->table_options; 154 $sql_result = $wpdb->get_results( $sql ); 155 $row_mode = $sql_result[0]; 156 $row_mode_page = $sql_result[1]; 157 $row_mode_url = $sql_result[2]; 158 $row_send_email = $sql_result[3]; 159 $row_logging_enabled = $sql_result[4]; 160 $row_redirect_error_code = $sql_result[5]; 161 if ( $row_logging_enabled->value ) { 162 self::custom_404_pro_log( $row_send_email->value ); 163 } 164 if ( $row_mode->value === 'page' ) { 165 $page = get_post( $row_mode_page->value ); 166 wp_redirect( $page->guid, $row_redirect_error_code->value ); 167 } elseif ( $row_mode->value === 'url' ) { 168 wp_redirect( $row_mode_url->value, $row_redirect_error_code->value ); 169 } 170 } 171 } 172 } 173 174 private function custom_404_pro_log( $is_email ) { 175 global $wpdb; 176 if(current_user_can('administrator')) { 177 if ( ! $this->helpers->is_option( 'log_ip' ) ) { 178 $this->helpers->insert_option( 'log_ip', true ); 179 } 180 if ( empty( $this->helpers->get_option( 'log_ip' ) ) ) { 181 $ip = 'N/A'; 182 } else { 183 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 184 $ip = $_SERVER['HTTP_CLIENT_IP']; 185 } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 186 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 118 187 } else { 119 $message = urlencode( 'Please select a few logs to delete and try again.' ); 120 wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=warning' ) ); 121 } 122 } elseif ( $action === 'c4p-logs--delete-all' ) { 123 $this->helpers->delete_logs( 'all' ); 124 $message = urlencode( 'All Logs successfully deleted!' ); 125 wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 126 } elseif ( $action === 'c4p-logs--export-csv' ) { 127 $this->helpers->export_logs_csv(); 128 } 129 } 130 } 131 132 public function custom_404_pro_redirect() { 133 global $wpdb; 134 if ( is_404() ) { 135 $sql = 'SELECT * FROM ' . $this->helpers->table_options; 136 $sql_result = $wpdb->get_results( $sql ); 137 $row_mode = $sql_result[0]; 138 $row_mode_page = $sql_result[1]; 139 $row_mode_url = $sql_result[2]; 140 $row_send_email = $sql_result[3]; 141 $row_logging_enabled = $sql_result[4]; 142 $row_redirect_error_code = $sql_result[5]; 143 if ( $row_logging_enabled->value ) { 144 self::custom_404_pro_log( $row_send_email->value ); 145 } 146 if ( $row_mode->value === 'page' ) { 147 $page = get_post( $row_mode_page->value ); 148 wp_redirect( $page->guid, $row_redirect_error_code->value ); 149 } elseif ( $row_mode->value === 'url' ) { 150 wp_redirect( $row_mode_url->value, $row_redirect_error_code->value ); 151 } 152 } 153 } 154 155 private function custom_404_pro_log( $is_email ) { 156 global $wpdb; 157 if ( ! $this->helpers->is_option( 'log_ip' ) ) { 158 $this->helpers->insert_option( 'log_ip', true ); 159 } 160 if ( empty( $this->helpers->get_option( 'log_ip' ) ) ) { 161 $ip = 'N/A'; 162 } else { 163 if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { 164 $ip = $_SERVER['HTTP_CLIENT_IP']; 165 } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 166 $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; 167 } else { 168 $ip = $_SERVER['REMOTE_ADDR']; 169 } 170 } 171 $path = $_SERVER['REQUEST_URI']; 172 $referer = ''; 173 if ( array_key_exists( 'HTTP_REFERER', $_SERVER ) ) { 174 $referer = $_SERVER['HTTP_REFERER']; 175 } 176 $user_agent = $_SERVER['HTTP_USER_AGENT']; 177 $sql_save = 'INSERT INTO ' . $this->helpers->table_logs . " (ip, path, referer, user_agent) VALUES ('$ip', '$path', '$referer', '$user_agent')"; 178 $wpdb->query( $sql_save ); 179 if ( ! empty( $is_email ) ) { 180 self::custom_404_pro_send_mail( $ip, $path, $referer, $user_agent ); 188 $ip = $_SERVER['REMOTE_ADDR']; 189 } 190 } 191 $path = $_SERVER['REQUEST_URI']; 192 $referer = ''; 193 if ( array_key_exists( 'HTTP_REFERER', $_SERVER ) ) { 194 $referer = $_SERVER['HTTP_REFERER']; 195 } 196 $user_agent = $_SERVER['HTTP_USER_AGENT']; 197 $sql_save = 'INSERT INTO ' . $this->helpers->table_logs . " (ip, path, referer, user_agent) VALUES ('$ip', '$path', '$referer', '$user_agent')"; 198 $wpdb->query( $sql_save ); 199 if ( ! empty( $is_email ) ) { 200 self::custom_404_pro_send_mail( $ip, $path, $referer, $user_agent ); 201 } 181 202 } 182 203 } 183 204 184 205 private function custom_404_pro_send_mail( $ip, $path, $referer, $user_agent ) { 185 $admin_email = get_option( 'admin_email' ); 186 if ( is_multisite() ) { 187 global $blog_id; 188 $current_blog_details = get_blog_details( array( 'blog_id' => $blog_id ) ); 189 $current_site_name = $current_blog_details->blogname; 190 } else { 191 $current_site_name = get_bloginfo( 'name' ); 192 } 193 $headers[] = 'From: Site Admin <' . $admin_email . '>' . "\r\n"; 194 $headers[] = 'Content-Type: text/html; charset=UTF-8'; 195 $message = '<p>Here are the 404 Log Details:</p>'; 196 $message .= '<table>'; 197 $message .= '<tr>'; 198 $message .= '<th>Site</th>'; 199 $message .= '<td>' . $current_site_name . '</td>'; 200 $message .= '</tr>'; 201 $message .= '<tr>'; 202 $message .= '<th>User IP</th>'; 203 $message .= '<td>' . $ip . '</td>'; 204 $message .= '</tr>'; 205 $message .= '<tr>'; 206 $message .= '<th>404 Path</th>'; 207 $message .= '<td>' . $path . '</td>'; 208 $message .= '</tr>'; 209 $message .= '<tr>'; 210 $message .= '<th>Referer</th>'; 211 $message .= '<td>' . $referer . '</td>'; 212 $message .= '</tr>'; 213 $message .= '<tr>'; 214 $message .= '<th>User Agent</th>'; 215 $message .= '<td>' . $user_agent . '</td>'; 216 $message .= '</tr>'; 217 $message .= '</table>'; 218 $is_sent = wp_mail( 219 $admin_email, 220 '404 Error on Site', 221 $message, 222 $headers 223 ); 206 if(current_user_can('administrator')) { 207 $admin_email = get_option( 'admin_email' ); 208 if ( is_multisite() ) { 209 global $blog_id; 210 $current_blog_details = get_blog_details( array( 'blog_id' => $blog_id ) ); 211 $current_site_name = $current_blog_details->blogname; 212 } else { 213 $current_site_name = get_bloginfo( 'name' ); 214 } 215 $headers[] = 'From: Site Admin <' . $admin_email . '>' . "\r\n"; 216 $headers[] = 'Content-Type: text/html; charset=UTF-8'; 217 $message = '<p>Here are the 404 Log Details:</p>'; 218 $message .= '<table>'; 219 $message .= '<tr>'; 220 $message .= '<th>Site</th>'; 221 $message .= '<td>' . $current_site_name . '</td>'; 222 $message .= '</tr>'; 223 $message .= '<tr>'; 224 $message .= '<th>User IP</th>'; 225 $message .= '<td>' . $ip . '</td>'; 226 $message .= '</tr>'; 227 $message .= '<tr>'; 228 $message .= '<th>404 Path</th>'; 229 $message .= '<td>' . $path . '</td>'; 230 $message .= '</tr>'; 231 $message .= '<tr>'; 232 $message .= '<th>Referer</th>'; 233 $message .= '<td>' . $referer . '</td>'; 234 $message .= '</tr>'; 235 $message .= '<tr>'; 236 $message .= '<th>User Agent</th>'; 237 $message .= '<td>' . $user_agent . '</td>'; 238 $message .= '</tr>'; 239 $message .= '</table>'; 240 $is_sent = wp_mail( 241 $admin_email, 242 '404 Error on Site', 243 $message, 244 $headers 245 ); 246 } 224 247 } 225 248 226 249 private function update_mode( $mode, $page, $url ) { 227 250 global $wpdb; 228 $mode_val = ''; 229 $mode_page_val = ''; 230 $mode_url_val = ''; 231 switch ( $mode ) { 232 case 'page': 233 $mode_val = 'page'; 234 $mode_page_val = $page; 235 $mode_url_val = ''; 236 break; 237 case 'url': 238 $mode_val = 'url'; 239 $mode_page_val = ''; 240 $mode_url_val = $url; 241 break; 242 case '': 243 $mode_val = ''; 244 $mode_page_val = ''; 245 $mode_url_val = ''; 246 break; 247 } 248 $this->helpers->update_option( 'mode', $mode_val ); 249 $this->helpers->update_option( 'mode_page', $mode_page_val ); 250 $this->helpers->update_option( 'mode_url', $mode_url_val ); 251 if(current_user_can('administrator')) { 252 $mode_val = ''; 253 $mode_page_val = ''; 254 $mode_url_val = ''; 255 switch ( $mode ) { 256 case 'page': 257 $mode_val = 'page'; 258 $mode_page_val = $page; 259 $mode_url_val = ''; 260 break; 261 case 'url': 262 $mode_val = 'url'; 263 $mode_page_val = ''; 264 $mode_url_val = $url; 265 break; 266 case '': 267 $mode_val = ''; 268 $mode_page_val = ''; 269 $mode_url_val = ''; 270 break; 271 } 272 $this->helpers->update_option( 'mode', $mode_val ); 273 $this->helpers->update_option( 'mode_page', $mode_page_val ); 274 $this->helpers->update_option( 'mode_url', $mode_url_val ); 275 } 251 276 } 252 277 … … 254 279 global $wpdb; 255 280 $logsData = []; 256 $old_logs = get_posts( 257 [ 258 'numberposts' => 500, 259 'post_status' => 'publish', 260 'post_type' => 'c4p_log', 261 ] 262 ); 263 foreach ( $old_logs as $log ) { 264 $temp = new stdClass(); 265 $temp->id = $log->ID; 266 $temp->ip = get_post_meta( $log->ID, 'c4p_log_ip', true ); 267 $temp->path = get_post_meta( $log->ID, 'c4p_log_404_path', true ); 268 $temp->referer = get_post_meta( $log->ID, 'c4p_log_referer', true ); 269 $temp->user_agent = get_post_meta( $log->ID, 'c4p_log_user_agent', true ); 270 array_push( $logsData, $temp ); 271 } 272 $this->helpers->create_logs( $logsData, true ); 273 $message = urlencode( 'Older log(s) before 3.0.0 have been migrated successfully. You might need to repeat this process if there are some left.' ); 274 wp_redirect( admin_url( 'admin.php?page=c4p-migrate&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 281 if(wp_verify_nonce($_POST['form-migrate'], 'form-migrate') && check_admin_referer("form-migrate", "form-migrate") && current_user_can('administrator')) { 282 $old_logs = get_posts( 283 [ 284 'numberposts' => 500, 285 'post_status' => 'publish', 286 'post_type' => 'c4p_log', 287 ] 288 ); 289 foreach ( $old_logs as $log ) { 290 $temp = new stdClass(); 291 $temp->id = $log->ID; 292 $temp->ip = get_post_meta( $log->ID, 'c4p_log_ip', true ); 293 $temp->path = get_post_meta( $log->ID, 'c4p_log_404_path', true ); 294 $temp->referer = get_post_meta( $log->ID, 'c4p_log_referer', true ); 295 $temp->user_agent = get_post_meta( $log->ID, 'c4p_log_user_agent', true ); 296 array_push( $logsData, $temp ); 297 } 298 $this->helpers->create_logs( $logsData, true ); 299 $message = urlencode( 'Older log(s) before 3.0.0 have been migrated successfully. You might need to repeat this process if there are some left.' ); 300 wp_redirect( admin_url( 'admin.php?page=c4p-migrate&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 301 } 275 302 } 276 303 277 304 public function form_reset() { 278 305 global $wpdb; 279 $table_wp_posts = $wpdb->prefix . 'wp_posts'; 280 $table_wp_postmeta = $wpdb->prefix . 'wp_postmeta'; 281 $table_wp_term_relationships = $wpdb->prefix . 'wp_term_relationships'; 282 $sql1 = 'DELETE FROM ' . $table_wp_posts . " WHERE post_type='c4p_log'"; 283 $sql2 = 'DELETE FROM ' . $table_wp_postmeta . ' WHERE post_id NOT IN (SELECT id FROM wp_posts)'; 284 $sql3 = 'DELETE FROM ' . $table_wp_term_relationships . ' WHERE object_id NOT IN (SELECT id FROM wp_posts)'; 285 $wpdb->query( $sql1 ); 286 $wpdb->query( $sql2 ); 287 $wpdb->query( $sql3 ); 288 $message = urlencode( 'Older logs before 3.0.0 have been deleted successfully!' ); 289 wp_redirect( admin_url( 'admin.php?page=c4p-reset&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 306 if(wp_verify_nonce($_POST['form-reset'], 'form-reset') && check_admin_referer("form-reset", "form-reset") && current_user_can('administrator')) { 307 $table_wp_posts = $wpdb->prefix . 'wp_posts'; 308 $table_wp_postmeta = $wpdb->prefix . 'wp_postmeta'; 309 $table_wp_term_relationships = $wpdb->prefix . 'wp_term_relationships'; 310 $sql1 = 'DELETE FROM ' . $table_wp_posts . " WHERE post_type='c4p_log'"; 311 $sql2 = 'DELETE FROM ' . $table_wp_postmeta . ' WHERE post_id NOT IN (SELECT id FROM wp_posts)'; 312 $sql3 = 'DELETE FROM ' . $table_wp_term_relationships . ' WHERE object_id NOT IN (SELECT id FROM wp_posts)'; 313 $wpdb->query( $sql1 ); 314 $wpdb->query( $sql2 ); 315 $wpdb->query( $sql3 ); 316 $message = urlencode( 'Older logs before 3.0.0 have been deleted successfully!' ); 317 wp_redirect( admin_url( 'admin.php?page=c4p-reset&c4pmessage=' . $message . '&c4pmessageType=success' ) ); 318 } 290 319 } 291 320 292 321 public function custom_404_pro_upgrader( $upgrader_object, $options ) { 293 322 global $wpdb; 294 if ( $options['action'] === 'update' && $options['type'] === 'plugin' ) { 295 if ( ! empty( get_option( 'c4p_mode' ) ) ) { 296 $mode = get_option( 'c4p_mode' ); 297 $page = get_option( 'c4p_selected_page' ); 298 $url = get_option( 'c4p_selected_url' ); 299 self::update_mode( $mode, $page, $url ); 300 delete_option( 'c4p_mode' ); 301 delete_option( 'c4p_selected_page' ); 302 delete_option( 'c4p_selected_url' ); 303 } 304 // When new features are requested by customers, they usually get a new option. 305 // This is where we add new option keys when customers upgrade the plugin. 306 $this->helpers->upsert_option( 'log_ip', true ); 323 if(current_user_can('administrator')) { 324 if ( $options['action'] === 'update' && $options['type'] === 'plugin' ) { 325 if ( ! empty( get_option( 'c4p_mode' ) ) ) { 326 $mode = get_option( 'c4p_mode' ); 327 $page = get_option( 'c4p_selected_page' ); 328 $url = get_option( 'c4p_selected_url' ); 329 self::update_mode( $mode, $page, $url ); 330 delete_option( 'c4p_mode' ); 331 delete_option( 'c4p_selected_page' ); 332 delete_option( 'c4p_selected_url' ); 333 } 334 // When new features are requested by customers, they usually get a new option. 335 // This is where we add new option keys when customers upgrade the plugin. 336 $this->helpers->upsert_option( 'log_ip', true ); 337 } 307 338 } 308 339 // TODO: Migrate old logs -
custom-404-pro/trunk/admin/Helpers.php
r2074974 r2113409 57 57 public function initialize_table_options() { 58 58 global $wpdb; 59 $count = count( $this->options_defaults ); 60 $sql = 'INSERT INTO ' . $this->table_options . ' (name, value) VALUES '; 61 foreach ( $this->options_defaults as $key => $option ) { 62 if ( $key !== ( $count - 1 ) ) { 63 $sql .= "('" . $option->name . "', '" . $option->value . "'),"; 64 } else { 65 $sql .= "('" . $option->name . "', '" . $option->value . "')"; 66 } 67 } 68 $wpdb->query( $sql ); 59 if(current_user_can('administrator')) { 60 $count = count( $this->options_defaults ); 61 $sql = 'INSERT INTO ' . $this->table_options . ' (name, value) VALUES '; 62 foreach ( $this->options_defaults as $key => $option ) { 63 if ( $key !== ( $count - 1 ) ) { 64 $sql .= "('" . $option->name . "', '" . $option->value . "'),"; 65 } else { 66 $sql .= "('" . $option->name . "', '" . $option->value . "')"; 67 } 68 } 69 $wpdb->query( $sql ); 70 } 69 71 } 70 72 71 73 public function is_option( $option_name ) { 72 74 global $wpdb; 73 $query = 'SELECT * FROM ' . $this->table_options . " WHERE name='" . $option_name . "'"; 74 $result = $wpdb->get_results( $query ); 75 if ( empty( $result ) ) { 76 return false; 77 } else { 78 return $result[0]; 79 } 75 if(current_user_can('administrator')) { 76 $query = 'SELECT * FROM ' . $this->table_options . " WHERE name='" . $option_name . "'"; 77 $result = $wpdb->get_results( $query ); 78 if ( empty( $result ) ) { 79 return false; 80 } else { 81 return $result[0]; 82 } 83 } 80 84 } 81 85 82 86 public function get_option( $option_name ) { 83 87 global $wpdb; 84 $query = 'SELECT value FROM ' . $this->table_options . " WHERE name='" . $option_name . "'"; 85 $result = $wpdb->get_var( $query ); 86 return $result; 88 if(current_user_can('administrator')) { 89 $query = 'SELECT value FROM ' . $this->table_options . " WHERE name='" . $option_name . "'"; 90 $result = $wpdb->get_var( $query ); 91 return $result; 92 } 87 93 } 88 94 89 95 public function insert_option( $option_name, $option_value ) { 90 96 global $wpdb; 91 $result = $wpdb->insert( 92 $this->table_options, 93 array( 94 'name' => $option_name, 95 'value' => $option_value, 96 ) 97 ); 98 return $result; 97 if(current_user_can('administrator')) { 98 $result = $wpdb->insert( 99 $this->table_options, 100 array( 101 'name' => $option_name, 102 'value' => $option_value, 103 ) 104 ); 105 return $result; 106 } 99 107 } 100 108 101 109 public function update_option( $option_name, $option_value ) { 102 110 global $wpdb; 103 $result = $wpdb->update( 104 $this->table_options, 105 array( 'value' => $option_value ), 106 array( 'name' => $option_name ) 107 ); 108 return $result; 111 if(current_user_can('administrator')) { 112 $result = $wpdb->update( 113 $this->table_options, 114 array( 'value' => $option_value ), 115 array( 'name' => $option_name ) 116 ); 117 return $result; 118 } 109 119 } 110 120 111 121 public function upsert_option( $option_name, $option_value ) { 112 122 global $wpdb; 113 if ( self::is_option( $option_name ) ) { 114 $result = self::update_option( $option_name, $option_value ); 115 } else { 116 $result = self::insert_option( $option_name, $option_value ); 117 } 118 return $result; 123 if(current_user_can('administrator')) { 124 if ( self::is_option( $option_name ) ) { 125 $result = self::update_option( $option_name, $option_value ); 126 } else { 127 $result = self::insert_option( $option_name, $option_value ); 128 } 129 return $result; 130 } 119 131 } 120 132 121 133 public function get_logs_columns() { 122 134 global $wpdb; 123 $query = 'SHOW COLUMNS FROM ' . $this->table_logs; 124 $result = $wpdb->get_results( $query ); 125 return $result; 135 if(current_user_can('administrator')) { 136 $query = 'SHOW COLUMNS FROM ' . $this->table_logs; 137 $result = $wpdb->get_results( $query ); 138 return $result; 139 } 126 140 } 127 141 128 142 public function get_old_logs_count() { 129 143 global $wpdb; 130 $query = 'SELECT COUNT(*) FROM ' . $wpdb->prefix . "posts WHERE post_type='c4p_log'"; 131 $result = $wpdb->get_var( $query ); 132 return (int) $result; 144 if(current_user_can('administrator')) { 145 $query = 'SELECT COUNT(*) FROM ' . $wpdb->prefix . "posts WHERE post_type='c4p_log'"; 146 $result = $wpdb->get_var( $query ); 147 return (int) $result; 148 } 133 149 } 134 150 135 151 public function delete_old_logs( $logIDs ) { 136 152 global $wpdb; 137 foreach ( $logIDs as $id ) { 138 wp_delete_post( $id, true ); 139 } 153 if(current_user_can('administrator')) { 154 foreach ( $logIDs as $id ) { 155 wp_delete_post( $id, true ); 156 } 157 } 140 158 } 141 159 142 160 public function create_logs( $logsData, $isDeletingOld ) { 143 161 global $wpdb; 144 $count = count( $logsData ); 145 $logIDs = []; 146 $query = 'INSERT INTO ' . $this->table_logs . ' (ip, path, referer, user_agent) VALUES'; 147 foreach ( $logsData as $key => $log ) { 148 if ( ! empty( $log->id ) ) { 149 array_push( $logIDs, $log->id ); 150 } 151 $query .= " ('$log->ip', '$log->path', '$log->referer', '$log->user_agent')"; 152 if ( $key < $count - 1 ) { 153 $query .= ','; 154 } 155 } 156 $result = $wpdb->query( $query ); 157 if ( ! is_wp_error( $result ) ) { 158 if ( ! empty( $isDeletingOld ) && $isDeletingOld ) { 159 self::delete_old_logs( $logIDs ); 160 } 161 } 162 return $result; 162 if(current_user_can('administrator')) { 163 $count = count( $logsData ); 164 $logIDs = []; 165 $query = 'INSERT INTO ' . $this->table_logs . ' (ip, path, referer, user_agent) VALUES'; 166 foreach ( $logsData as $key => $log ) { 167 if ( ! empty( $log->id ) ) { 168 array_push( $logIDs, $log->id ); 169 } 170 $query .= " ('$log->ip', '$log->path', '$log->referer', '$log->user_agent')"; 171 if ( $key < $count - 1 ) { 172 $query .= ','; 173 } 174 } 175 $result = $wpdb->query( $query ); 176 if ( ! is_wp_error( $result ) ) { 177 if ( ! empty( $isDeletingOld ) && $isDeletingOld ) { 178 self::delete_old_logs( $logIDs ); 179 } 180 } 181 return $result; 182 } 163 183 } 164 184 165 185 public function get_logs() { 166 186 global $wpdb; 167 $query = 'SELECT * from ' . $this->table_logs; 168 $result = $wpdb->get_results( $query, ARRAY_A ); 169 return $result; 187 if(current_user_can('administrator')) { 188 $query = 'SELECT * from ' . $this->table_logs; 189 $result = $wpdb->get_results( $query, ARRAY_A ); 190 return $result; 191 } 170 192 } 171 193 172 194 public function delete_logs( $path ) { 173 195 global $wpdb; 174 if ( $path === 'all' ) { 175 $query = 'TRUNCATE TABLE ' . $this->table_logs; 176 } elseif ( is_array( $path ) ) { 177 $query = 'DELETE FROM ' . $this->table_logs . ' WHERE id in (' . implode( ',', $path ) . ')'; 178 } else { 179 $query = 'DELETE FROM ' . $this->table_logs . ' WHERE id=' . $path . ''; 180 } 181 $result = $wpdb->query( $query ); 182 return $result; 196 if(current_user_can('administrator')) { 197 if ( $path === 'all' ) { 198 $query = 'TRUNCATE TABLE ' . $this->table_logs; 199 } elseif ( is_array( $path ) ) { 200 $query = 'DELETE FROM ' . $this->table_logs . ' WHERE id in (' . implode( ',', $path ) . ')'; 201 } else { 202 $query = 'DELETE FROM ' . $this->table_logs . ' WHERE id=' . $path . ''; 203 } 204 $result = $wpdb->query( $query ); 205 return $result; 206 } 183 207 } 184 208 185 209 public function export_logs_csv() { 186 $filename = 'logs_' . time() . '.csv'; 187 $csv_output = ''; 188 $columns = self::get_logs_columns(); 189 if ( count( $columns ) > 0 ) { 190 foreach ( $columns as $column ) { 191 $csv_output .= $column->Field . ', '; 192 } 193 } 194 $csv_output .= "\n"; 195 $results = self::get_logs(); 196 if ( count( $results ) > 0 ) { 197 foreach ( $results as $result ) { 198 foreach ( $result as $q ) { 199 $csv_output .= "\"$q\"" . ', '; 200 } 201 $csv_output .= "\n"; 202 } 203 } 204 header( 'Content-Type: application/csv' ); 205 header( 'Content-Disposition: attachment; filename=' . $filename ); 206 header( 'Pragma: no-cache' ); 207 print $csv_output; 208 exit; 210 if(current_user_can('administrator')) { 211 $filename = 'logs_' . time() . '.csv'; 212 $csv_output = ''; 213 $columns = self::get_logs_columns(); 214 if ( count( $columns ) > 0 ) { 215 foreach ( $columns as $column ) { 216 $csv_output .= $column->Field . ', '; 217 } 218 } 219 $csv_output .= "\n"; 220 $results = self::get_logs(); 221 if ( count( $results ) > 0 ) { 222 foreach ( $results as $result ) { 223 foreach ( $result as $q ) { 224 $csv_output .= "\"$q\"" . ', '; 225 } 226 $csv_output .= "\n"; 227 } 228 } 229 header( 'Content-Type: application/csv' ); 230 header( 'Content-Disposition: attachment; filename=' . $filename ); 231 header( 'Pragma: no-cache' ); 232 print $csv_output; 233 exit; 234 } 209 235 } 210 236 } -
custom-404-pro/trunk/admin/views/logs.php
r2112484 r2113409 12 12 <form id="form_logs" method="GET"> 13 13 <!-- For plugins, we also need to ensure that the form posts back to our current page --> 14 <input type="hidden" name="page" value="<?php echo esc_html($_REQUEST['page']); ?>" />14 <input type="hidden" name="page" value="<?php echo sanitize_text_field($_REQUEST['page']); ?>" /> 15 15 <!-- Now we can render the completed list table --> 16 16 <p class="search-box"> 17 17 <label class="screen-reader-text" for="search_id-search-input">Search</label> 18 <input id="search_id-search-input" type="text" name="s" value="<?php if ( array_key_exists( 's', $_GET ) ) { echo esc_html($_GET['s']); } ?>" autocomplete="off" />18 <input id="search_id-search-input" type="text" name="s" value="<?php if ( array_key_exists( 's', $_GET ) ) { echo sanitize_text_field($_GET['s']); } ?>" autocomplete="off" /> 19 19 <input id="search-submit" class="button" type="submit" name="" value="Search" /> 20 20 </p> -
custom-404-pro/trunk/admin/views/migrate.php
r2112484 r2113409 8 8 <h2>Migrate (Important, read carefully)</h2> 9 9 <?php if ( array_key_exists( 'message', $_GET ) ) : ?> 10 <?php if ( esc_html($_GET['message']) === 'updated' ) : ?>10 <?php if ( sanitize_text_field($_GET['message']) === 'updated' ) : ?> 11 11 <div class="updated"> 12 12 <p>Old logs (prior to version 3.0.0) deleted successfully!</p> … … 30 30 <input type="hidden" name="action" value="form-migrate"/> 31 31 <input type="submit" name="submit" id="submit" class="button button-primary" value="Migrate"> 32 <?php wp_nonce_field("form-migrate", "form-migrate"); ?> 32 33 </p> 33 34 </form> -
custom-404-pro/trunk/admin/views/reset.php
r2112484 r2113409 2 2 <h2>Reset (Important, read carefully)</h2> 3 3 <?php if ( array_key_exists( 'message', $_GET ) ) : ?> 4 <?php if ( esc_html($_GET['message']) === 'updated' ) : ?>4 <?php if ( sanitize_text_field($_GET['message']) === 'updated' ) : ?> 5 5 <div class="updated"> 6 6 <p>Old logs (prior to version 3.0.0) deleted successfully!</p> … … 21 21 <input type="hidden" name="action" value="form-reset"/> 22 22 <input type="submit" name="submit" id="submit" class="button button-primary" value="Reset"> 23 <?php wp_nonce_field("form-reset", "form-reset"); ?> 23 24 </p> 24 25 </form> -
custom-404-pro/trunk/admin/views/settings-general.php
r2074974 r2113409 15 15 ?> 16 16 <div class="wrap"> 17 <form method="post" action="<?php echo get_admin_url() . 'admin-post.php'; ?>">17 <form method="post" action="<?php echo get_admin_url() . 'admin-post.php'; ?>"> 18 18 <table class="form-table"> 19 19 <tbody> … … 75 75 <input type="hidden" name="action" value="form-settings-general"/> 76 76 <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"> 77 <?php wp_nonce_field("form-settings-general", "form-settings-general"); ?> 77 78 </p> 78 79 </form> -
custom-404-pro/trunk/admin/views/settings-global-redirect.php
r2074974 r2113409 72 72 <input type="hidden" name="action" value="form-settings-global-redirect"/> 73 73 <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"> 74 <?php wp_nonce_field("form-settings-global-redirect", "form-settings-global-redirect"); ?> 74 75 </p> 75 76 </form> -
custom-404-pro/trunk/custom-404-pro.php
r2112484 r2113409 5 5 Plugin URI: https://wordpress.org/plugins/custom-404-pro/ 6 6 Description: Override the default 404 page with any page or a custom URL from the Admin Panel. 7 Version: 3.2. 97 Version: 3.2.10 8 8 Author: Kunal Nagar 9 9 Author URI: https://kunalnagar.in -
custom-404-pro/trunk/includes/ActivateClass.php
r2074974 r2113409 5 5 public static function activate() { 6 6 global $wpdb; 7 $helpers = Helpers::singleton(); 8 $is_table_options_query = "SHOW TABLES LIKE '" . $helpers->table_options . "';"; 9 $is_table_logs_query = "SHOW TABLES LIKE '" . $helpers->table_logs . "';"; 10 $is_table_options = $wpdb->query( $is_table_options_query ); 11 $is_table_logs = $wpdb->query( $is_table_logs_query ); 12 if ( empty( $is_table_options ) && empty( $is_table_logs ) ) { 13 self::create_tables(); 14 self::initialize_options(); 15 } 7 if(current_user_can('administrator')) { 8 $helpers = Helpers::singleton(); 9 $is_table_options_query = "SHOW TABLES LIKE '" . $helpers->table_options . "';"; 10 $is_table_logs_query = "SHOW TABLES LIKE '" . $helpers->table_logs . "';"; 11 $is_table_options = $wpdb->query( $is_table_options_query ); 12 $is_table_logs = $wpdb->query( $is_table_logs_query ); 13 if ( empty( $is_table_options ) && empty( $is_table_logs ) ) { 14 self::create_tables(); 15 self::initialize_options(); 16 } 17 } 16 18 } 17 19 18 20 public static function create_tables() { 19 21 global $wpdb; 20 $charset_collate = $wpdb->get_charset_collate(); 21 $helpers = Helpers::singleton(); 22 $sql_logs = "CREATE TABLE $helpers->table_logs ( 23 id mediumint(9) NOT NULL AUTO_INCREMENT, 24 ip text, 25 path text, 26 referer text, 27 user_agent text, 28 created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 29 updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 30 PRIMARY KEY (id) 31 ) $charset_collate;"; 32 $sql_options = "CREATE TABLE $helpers->table_options ( 33 id mediumint(9) NOT NULL AUTO_INCREMENT, 34 name text, 35 value text, 36 created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 37 updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 38 PRIMARY KEY (id) 39 ) $charset_collate;"; 40 include_once ABSPATH . 'wp-admin/includes/upgrade.php'; 41 dbDelta( $sql_logs ); 42 echo $wpdb->last_error; 43 dbDelta( $sql_options ); 44 echo $wpdb->last_error; 22 if(current_user_can('administrator')) { 23 $charset_collate = $wpdb->get_charset_collate(); 24 $helpers = Helpers::singleton(); 25 $sql_logs = "CREATE TABLE $helpers->table_logs ( 26 id mediumint(9) NOT NULL AUTO_INCREMENT, 27 ip text, 28 path text, 29 referer text, 30 user_agent text, 31 created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 32 updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 33 PRIMARY KEY (id) 34 ) $charset_collate;"; 35 $sql_options = "CREATE TABLE $helpers->table_options ( 36 id mediumint(9) NOT NULL AUTO_INCREMENT, 37 name text, 38 value text, 39 created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 40 updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 41 PRIMARY KEY (id) 42 ) $charset_collate;"; 43 include_once ABSPATH . 'wp-admin/includes/upgrade.php'; 44 dbDelta( $sql_logs ); 45 echo $wpdb->last_error; 46 dbDelta( $sql_options ); 47 echo $wpdb->last_error; 48 } 45 49 } 46 50 47 51 public static function initialize_options() { 48 52 global $wpdb; 49 $helpers = Helpers::singleton(); 50 $helpers->initialize_table_options(); 53 if(current_user_can('administrator')) { 54 $helpers = Helpers::singleton(); 55 $helpers->initialize_table_options(); 56 } 51 57 } 52 58 } -
custom-404-pro/trunk/includes/PluginClass.php
r2074974 r2113409 16 16 private function define_admin_hooks() { 17 17 // Core action hooks 18 add_action( 'admin_menu', array( $this->plugin_admin, 'create_menu' ) );18 add_action( 'admin_menu', array( $this->plugin_admin, 'create_menu' ) ); 19 19 add_action( 'admin_enqueue_scripts', array( $this->plugin_admin, 'enqueue_scripts' ) ); 20 20 add_action( 'admin_enqueue_scripts', array( $this->plugin_admin, 'enqueue_styles' ) ); -
custom-404-pro/trunk/includes/UninstallClass.php
r2074974 r2113409 5 5 public static function uninstall() { 6 6 global $wpdb; 7 $table_logs = $wpdb->prefix . 'custom_404_pro_logs'; 8 $sql_logs = "DROP TABLE IF EXISTS $table_logs"; 9 $table_options = $wpdb->prefix . 'custom_404_pro_options'; 10 $sql_options = "DROP TABLE IF EXISTS $table_options"; 11 $wpdb->query( $sql_logs ); 12 $wpdb->query( $sql_options ); 7 if(current_user_can('administrator')) { 8 $table_logs = $wpdb->prefix . 'custom_404_pro_logs'; 9 $sql_logs = "DROP TABLE IF EXISTS $table_logs"; 10 $table_options = $wpdb->prefix . 'custom_404_pro_options'; 11 $sql_options = "DROP TABLE IF EXISTS $table_options"; 12 $wpdb->query( $sql_logs ); 13 $wpdb->query( $sql_options ); 14 } 13 15 } 14 16 } -
custom-404-pro/trunk/readme.txt
r2112484 r2113409 5 5 Requires at least: 3.0.1 6 6 Tested up to: 5.2 7 Stable tag: 3.2. 97 Stable tag: 3.2.10 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 43 43 44 44 == Changelog == 45 46 = 3.2.10 = 47 * More updates and fixes 45 48 46 49 = 3.2.9 =
Note: See TracChangeset
for help on using the changeset viewer.