| @@ -16,12 +16,8 @@ | ||
| 16 | 16 | */ |
| 17 | 17 | class Wpdb_Admin { |
| 18 | 18 | |
| 19 | 19 | public $mysqldump_command_path; |
| 20 | - public $root; | |
| 21 | - public $files; | |
| 22 | - public $mysqldump_method; | |
| 23 | - public $mysqldump_verified; | |
| 24 | 20 | |
| 25 | 21 | /** |
| 26 | 22 | * Construct. |
| 27 | 23 | */ |
| @@ -29,19 +25,17 @@ | ||
| 29 | 25 | add_action( 'admin_init', array( $this, 'wp_db_backup_admin_init' ) ); |
| 30 | 26 | add_action( 'admin_init', array( $this, 'admin_scripts_style' ) ); |
| 31 | 27 | add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); |
| 32 | 28 | add_filter( 'cron_schedules', array( $this, 'wp_db_backup_cron_schedules' ) ); |
| 33 | - add_action( 'wpdbbkp_db_backup_event', array( $this, 'wp_db_backup_event_process' ) ); | |
| 29 | + add_action( 'wp_db_backup_event', array( $this, 'wp_db_backup_event_process' ) ); | |
| 34 | 30 | add_action( 'init', array( $this, 'wp_db_backup_scheduler_activation' ) ); |
| 35 | - add_action( 'wpdbbkp_db_backup_completed', array( $this, 'wp_db_backup_completed_local' ), 12 ); | |
| 31 | + add_action( 'wp_logout', array( $this, 'wp_db_cookie_expiration' ) ); // Fixed Vulnerability 22-06-2016 for prevent direct download. | |
| 32 | + add_action( 'wp_db_backup_completed', array( $this, 'wp_db_backup_completed_local' ), 12 ); | |
| 36 | 33 | add_action('admin_enqueue_scripts', array( $this, 'wpdbbkp_admin_style')); |
| 37 | 34 | add_action('admin_enqueue_scripts', array( $this, 'wpdbbkp_admin_newsletter_script')); |
| 38 | 35 | add_action('wp_ajax_wpdbbkp_send_query_message', array( $this, 'wpdbbkp_send_query_message')); |
| 39 | 36 | add_filter( 'plugin_action_links_' . plugin_basename( WP_BACKUP_PLUGIN_FILE ), array( $this, 'add_settings_plugin_action_wp' ), 10, 4 ); |
| 40 | 37 | add_action( 'admin_notices', array($this, 'check_ziparchive_avalable_admin_notice' )); |
| 41 | - add_action( 'admin_notices', array($this, 'wpdbbkp_cloudbackup_notice' ) ); | |
| 42 | - add_action( 'wp_ajax_wpdbbkp_cloudbackup_dismiss_notice', array($this, 'wpdbbkp_cloudbackup_dismiss_notice' ) ); | |
| 43 | - add_action( 'admin_init', array($this, 'admin_backup_file_download' )); | |
| 44 | 38 | |
| 45 | 39 | } |
| 46 | 40 | |
| 47 | 41 | /** |
| @@ -82,24 +76,8 @@ | ||
| 82 | 76 | 'manage_options', |
| 83 | 77 | 'wp-database-backup#tab_db_destination', |
| 84 | 78 | array($this, 'wp_db_backup_settings_page' )); |
| 85 | 79 | |
| 86 | - add_submenu_page( | |
| 87 | - 'wp-database-backup', | |
| 88 | - 'Cloud Backup', | |
| 89 | - 'Cloud Backup', | |
| 90 | - 'manage_options', | |
| 91 | - 'wp-database-backup#tab_db_remotebackups', | |
| 92 | - array($this, 'wp_db_backup_settings_page' )); | |
| 93 | - | |
| 94 | - add_submenu_page( | |
| 95 | - 'wp-database-backup', | |
| 96 | - 'Migration', | |
| 97 | - 'Migration', | |
| 98 | - 'manage_options', | |
| 99 | - 'wp-database-backup#tab_db_migrate', | |
| 100 | - array($this, 'wp_db_backup_settings_page' )); | |
| 101 | - | |
| 102 | 80 | add_submenu_page( |
| 103 | 81 | 'wp-database-backup', |
| 104 | 82 | 'Settings', |
| 105 | 83 | 'Settings', |
| @@ -105,10 +83,20 @@ | ||
| 105 | 83 | 'Settings', |
| 106 | 84 | 'manage_options', |
| 107 | 85 | 'wp-database-backup#tab_db_setting', |
| 108 | 86 | array($this, 'wp_db_backup_settings_page' )); |
| 109 | - // if backup is not premium then show this | |
| 110 | - if ( ! is_plugin_active( 'wp-database-backup-premium/wp-database-backup-premium.php' ) ) { | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + add_submenu_page( | |
| 91 | + 'wp-database-backup', | |
| 92 | + 'Help & Support', | |
| 93 | + 'Help & Support', | |
| 94 | + 'manage_options', | |
| 95 | + 'wp-database-backup#tab_db_help', | |
| 96 | + array($this, 'wp_db_backup_settings_page' )); | |
| 97 | + | |
| 98 | + if(!defined('BKPFORWP_VERSION')){ | |
| 111 | 99 | add_submenu_page( |
| 112 | 100 | 'wp-database-backup', |
| 113 | 101 | 'Upgrade to Premium', |
| 114 | 102 | 'Upgrade to Premium', |
| @@ -114,29 +102,41 @@ | ||
| 114 | 102 | 'Upgrade to Premium', |
| 115 | 103 | 'manage_options', |
| 116 | 104 | 'wp-database-backup#tab_db_upgrade', |
| 117 | 105 | array($this, 'wp_db_backup_settings_page' )); |
| 118 | - } | |
| 106 | + } | |
| 107 | + else{ | |
| 119 | 108 | add_submenu_page( |
| 120 | 109 | 'wp-database-backup', |
| 121 | - 'Search and Replace', | |
| 122 | - 'Search and Replace', | |
| 110 | + 'Modules', | |
| 111 | + 'Modules', | |
| 123 | 112 | 'manage_options', |
| 124 | - 'wp-database-backup#searchreplace', | |
| 113 | + 'wp-database-backup#tab_db_features', | |
| 125 | 114 | array($this, 'wp_db_backup_settings_page' )); |
| 126 | - | |
| 127 | - | |
| 128 | 115 | add_submenu_page( |
| 129 | 116 | 'wp-database-backup', |
| 130 | - 'Help & Support', | |
| 131 | - 'Help & Support', | |
| 117 | + 'Licence', | |
| 118 | + 'Licence', | |
| 132 | 119 | 'manage_options', |
| 133 | - 'wp-database-backup#tab_db_help', | |
| 120 | + 'wp-database-backup#tab_db_licence', | |
| 134 | 121 | array($this, 'wp_db_backup_settings_page' )); |
| 122 | + } | |
| 135 | 123 | |
| 124 | + | |
| 125 | + | |
| 136 | 126 | } |
| 137 | 127 | |
| 138 | 128 | /** |
| 129 | + * Start Fixed Vulnerability 22-06-2016 for prevent direct download. | |
| 130 | + */ | |
| 131 | + public function wp_db_cookie_expiration() { | |
| 132 | + setcookie( 'can_download', 0, time() - 300, COOKIEPATH, COOKIE_DOMAIN ); | |
| 133 | + if ( SITECOOKIEPATH !== COOKIEPATH ) { | |
| 134 | + setcookie( 'can_download', 0, time() - 300, SITECOOKIEPATH, COOKIE_DOMAIN ); | |
| 135 | + } | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | 139 | * If Checked then it will remove local backup after uploading to destination. |
| 140 | 140 | * |
| 141 | 141 | * @param array $args - backup details. |
| 142 | 142 | */ |
| @@ -143,9 +143,9 @@ | ||
| 143 | 143 | public function wp_db_backup_completed_local( &$args ) { |
| 144 | 144 | $wp_db_remove_local_backup = get_option( 'wp_db_remove_local_backup' ); |
| 145 | 145 | if ( 1 === $wp_db_remove_local_backup ) { |
| 146 | 146 | if ( file_exists( $args[1] ) ) { |
| 147 | - wp_delete_file( $args[1] );// File path. | |
| 147 | + unlink( $args[1] );// File path. | |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| @@ -157,9 +157,9 @@ | ||
| 157 | 157 | if (get_option('wpdbbkp_activation_redirect', false)) { |
| 158 | 158 | delete_option('wpdbbkp_activation_redirect'); |
| 159 | 159 | if(!isset($_GET['activate-multi'])) |
| 160 | 160 | { |
| 161 | - wp_safe_redirect("admin.php?page=wp-database-backup"); | |
| 161 | + wp_redirect("admin.php?page=wp-database-backup"); | |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Start Fixed Vulnerability 04-08-2016 for data save in options. |
| @@ -164,15 +164,28 @@ | ||
| 164 | 164 | |
| 165 | 165 | // Start Fixed Vulnerability 04-08-2016 for data save in options. |
| 166 | 166 | if ( isset( $_GET['page'] ) && 'wp-database-backup' === $_GET['page'] ) { |
| 167 | 167 | if ( ! empty( $_POST ) && ! ( isset( $_POST['option_page'] ) && 'wp_db_backup_options' === $_POST['option_page'] ) ) { |
| 168 | - if ( false === isset( $_REQUEST['_wpnonce'] ) || false === wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ) , 'wp-database-backup' ) ) { //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- using as nonce | |
| 168 | + if ( false === isset( $_REQUEST['_wpnonce'] ) || false === wp_verify_nonce( $_REQUEST['_wpnonce'] , 'wp-database-backup' ) ) { | |
| 169 | 169 | wp_die( esc_html__('WPDB :: Invalid Access', 'wpdbbkp' ) ); |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | + | |
| 173 | + // End Fixed Vulnerability 04-08-2016 for data save in options. | |
| 174 | + if ( isset( $_GET['page'] ) && 'wp-database-backup' === $_GET['page'] && current_user_can( 'manage_options' ) ) { | |
| 175 | + setcookie( 'can_download', 1, 0, COOKIEPATH, COOKIE_DOMAIN ); | |
| 176 | + if ( SITECOOKIEPATH !== COOKIEPATH ) { | |
| 177 | + setcookie( 'can_download', 1, 0, SITECOOKIEPATH, COOKIE_DOMAIN ); | |
| 178 | + } | |
| 179 | + } else { | |
| 180 | + setcookie( 'can_download', 0, time() - 300, COOKIEPATH, COOKIE_DOMAIN ); | |
| 181 | + if ( SITECOOKIEPATH !== COOKIEPATH ) { | |
| 182 | + setcookie( 'can_download', 0, time() - 300, SITECOOKIEPATH, COOKIE_DOMAIN ); | |
| 183 | + } | |
| 184 | + } | |
| 172 | 185 | // End Fixed Vulnerability 22-06-2016 for prevent direct download. |
| 173 | 186 | if ( is_admin() && current_user_can( 'manage_options' ) ) { |
| 174 | - if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ) , 'wp-database-backup' ) ) { //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- using as nonce | |
| 187 | + if ( isset( $_REQUEST['_wpnonce'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'] , 'wp-database-backup' ) ) { | |
| 175 | 188 | if ( isset( $_POST['wpsetting_search'] ) ) { |
| 176 | 189 | if ( isset( $_POST['wp_db_backup_search_text'] ) ) { |
| 177 | 190 | update_option( 'wp_db_backup_search_text', sanitize_text_field( wp_unslash( $_POST['wp_db_backup_search_text'] ) ), false ); |
| 178 | 191 | } |
| @@ -182,9 +195,9 @@ | ||
| 182 | 195 | } |
| 183 | 196 | |
| 184 | 197 | if ( isset( $_POST['wpsetting'] ) ) { |
| 185 | 198 | if ( isset( $_POST['wp_local_db_backup_count'] ) ) { |
| 186 | - update_option( 'wp_local_db_backup_count', wpdbbkp_filter_data( sanitize_text_field( wp_unslash( $_POST['wp_local_db_backup_count'] ) ) ) , false); | |
| 199 | + update_option( 'wp_local_db_backup_count', wp_db_filter_data( sanitize_text_field( wp_unslash( $_POST['wp_local_db_backup_count'] ) ) ) , false); | |
| 187 | 200 | } |
| 188 | 201 | |
| 189 | 202 | if ( isset( $_POST['wp_db_log'] ) ) { |
| 190 | 203 | update_option( 'wp_db_log', 1 , false); |
| @@ -190,23 +203,13 @@ | ||
| 190 | 203 | update_option( 'wp_db_log', 1 , false); |
| 191 | 204 | } else { |
| 192 | 205 | update_option( 'wp_db_log', 0 , false); |
| 193 | 206 | } |
| 194 | - if ( isset( $_POST['wp_db_remove_on_uninstall'] ) ) { | |
| 195 | - update_option( 'wp_db_remove_on_uninstall', 1 , false); | |
| 196 | - } else { | |
| 197 | - update_option( 'wp_db_remove_on_uninstall', 0 , false); | |
| 198 | - } | |
| 199 | 207 | if ( isset( $_POST['wp_db_remove_local_backup'] ) ) { |
| 200 | 208 | update_option( 'wp_db_remove_local_backup', 1 , false); |
| 201 | 209 | } else { |
| 202 | 210 | update_option( 'wp_db_remove_local_backup', 0 , false); |
| 203 | 211 | } |
| 204 | - if ( isset( $_POST['wp_db_save_settings_in_backup'] ) ) { | |
| 205 | - update_option( 'wp_db_save_settings_in_backup', 1 , false); | |
| 206 | - } else { | |
| 207 | - update_option( 'wp_db_save_settings_in_backup', 0 , false); | |
| 208 | - } | |
| 209 | 212 | if ( isset( $_POST['wp_db_backup_enable_auto_upgrade'] ) ) { |
| 210 | 213 | update_option( 'wp_db_backup_enable_auto_upgrade', 1 , false); |
| 211 | 214 | } else { |
| 212 | 215 | update_option( 'wp_db_backup_enable_auto_upgrade', 0 , false); |
| @@ -211,11 +214,20 @@ | ||
| 211 | 214 | } else { |
| 212 | 215 | update_option( 'wp_db_backup_enable_auto_upgrade', 0 , false); |
| 213 | 216 | } |
| 214 | 217 | |
| 218 | + if ( isset( $_POST['wp_db_backup_enable_htaccess'] ) ) { | |
| 219 | + update_option( 'wp_db_backup_enable_htaccess', 1 , false); | |
| 220 | + } else { | |
| 221 | + update_option( 'wp_db_backup_enable_htaccess', 0 , false); | |
| 222 | + $path_info = wp_upload_dir(); | |
| 223 | + if ( file_exists( $path_info['basedir'] . '/db-backup/.htaccess' ) ) { | |
| 224 | + unlink( $path_info['basedir'] . '/db-backup/.htaccess' ); | |
| 225 | + } | |
| 226 | + } | |
| 227 | + | |
| 215 | 228 | if ( isset( $_POST['wp_db_exclude_table'] ) ) { |
| 216 | - $exclude_tables = $this->recursive_sanitize_text_field( wp_unslash( $_POST['wp_db_exclude_table'] ) ); // phpcs:ignore | |
| 217 | - update_option( 'wp_db_exclude_table', $this->filter_valid_exclude_tables( $exclude_tables ), false ); | |
| 229 | + update_option( 'wp_db_exclude_table', $this->recursive_sanitize_text_field( wp_unslash( $_POST['wp_db_exclude_table'] ) ) , false); // phpcs:ignore | |
| 218 | 230 | } else { |
| 219 | 231 | update_option( 'wp_db_exclude_table', '', false ); |
| 220 | 232 | } |
| 221 | 233 | $nonce = wp_create_nonce( 'wp-database-backup' ); |
| @@ -222,13 +234,13 @@ | ||
| 222 | 234 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=save&_wpnonce=' . $nonce ); |
| 223 | 235 | } |
| 224 | 236 | |
| 225 | 237 | if ( true === isset( $_POST['wp_db_local_backup_path'] ) ) { |
| 226 | - update_option( 'wp_db_local_backup_path', wpdbbkp_filter_data( sanitize_text_field( wp_unslash( $_POST['wp_db_local_backup_path'] ) ) ) ); | |
| 238 | + update_option( 'wp_db_local_backup_path', wp_db_filter_data( sanitize_text_field( wp_unslash( $_POST['wp_db_local_backup_path'] ) ) ) ); | |
| 227 | 239 | } |
| 228 | 240 | |
| 229 | 241 | if ( isset( $_POST['wp_db_backup_email_id'] ) ) { |
| 230 | - update_option( 'wp_db_backup_email_id', wpdbbkp_filter_data( sanitize_email( wp_unslash( $_POST['wp_db_backup_email_id'] ) ) ) , false); | |
| 242 | + update_option( 'wp_db_backup_email_id', wp_db_filter_data( sanitize_email( wp_unslash( $_POST['wp_db_backup_email_id'] ) ) ) , false); | |
| 231 | 243 | } |
| 232 | 244 | |
| 233 | 245 | if ( isset( $_POST['wp_db_backup_email_attachment'] ) ) { |
| 234 | 246 | $email_attachment = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_email_attachment'] ) , false); |
| @@ -242,71 +254,12 @@ | ||
| 242 | 254 | } |
| 243 | 255 | } |
| 244 | 256 | |
| 245 | 257 | if ( isset( $_POST['wp_db_backup_options'] ) ) { |
| 246 | - $option_to_save = []; | |
| 247 | - if ( isset( $_POST['wp_db_backup_options']['enable_autobackups'] ) ) { | |
| 248 | - $option_to_save['enable_autobackups'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['enable_autobackups'] ) ); | |
| 249 | - } | |
| 250 | - if ( isset( $_POST['wp_db_backup_options']['autobackup_type'] ) ) { | |
| 251 | - $option_to_save['autobackup_type'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['autobackup_type'] ) ); | |
| 252 | - } | |
| 253 | - if ( isset( $_POST['wp_db_backup_options']['autobackup_frequency'] ) ) { | |
| 254 | - $option_to_save['autobackup_frequency'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['autobackup_frequency'] ) ); | |
| 255 | - } | |
| 256 | - if ( isset( $_POST['wp_db_backup_options']['autobackup_full_days'] ) ) { | |
| 257 | - $option_to_save['autobackup_full_days'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['autobackup_full_days'] ) ); | |
| 258 | - } | |
| 259 | - if ( isset( $_POST['wp_db_backup_options']['autobackup_full_time'] ) ) { | |
| 260 | - $option_to_save['autobackup_full_time'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['autobackup_full_time'] ) ); | |
| 261 | - } | |
| 262 | - if ( isset( $_POST['wp_db_backup_options']['autobackup_full_date'] ) ) { | |
| 263 | - $option_to_save['autobackup_full_date'] = sanitize_text_field( wp_unslash( $_POST['wp_db_backup_options']['autobackup_full_date'] ) ); | |
| 264 | - } | |
| 265 | - if(!empty($option_to_save)) { | |
| 266 | - if(update_option( 'wp_db_backup_options', $option_to_save, false)){ | |
| 267 | - wp_clear_scheduled_hook( 'wpdbbkp_db_backup_event' ); | |
| 268 | - wp_clear_scheduled_hook( 'wpdbkup_event_fullbackup' ); | |
| 269 | - } | |
| 270 | - } | |
| 271 | - | |
| 258 | + update_option( 'wp_db_backup_options', $_POST['wp_db_backup_options'], false); | |
| 272 | 259 | } |
| 273 | 260 | |
| 274 | - | |
| 275 | - if ( isset( $_POST['featureSubmit'] ) && 'Save Settings' === $_POST['featureSubmit'] ) { | |
| 276 | - if ( isset( $_POST['enable_anonymization'] ) ) { | |
| 277 | - update_option( 'bkpforwp_enable_anonymization', 1 ); | |
| 278 | - } else { | |
| 279 | - update_option( 'bkpforwp_enable_anonymization', 0 ); | |
| 280 | - } | |
| 281 | - | |
| 282 | - if ( isset( $_POST['enable_backup_encryption'] ) ) { | |
| 283 | - update_option( 'bkpforwp_enable_backup_encryption', 1 ); | |
| 284 | - } else { | |
| 285 | - update_option( 'bkpforwp_enable_backup_encryption', 0 ); | |
| 286 | - } | |
| 287 | - if ( isset( $_POST['enable_exact_backup_time'] ) ) { | |
| 288 | - update_option( 'bkpforwp_enable_exact_backup_time', 1 ); | |
| 289 | - } else { | |
| 290 | - update_option( 'bkpforwp_enable_exact_backup_time', 0 ); | |
| 291 | - } | |
| 292 | - | |
| 293 | - if ( isset( $_POST['anonymization_type'] ) ) { | |
| 294 | - update_option( 'bkpforwp_anonymization_type', wpdbbkp_filter_data( sanitize_text_field( wp_unslash( $_POST['anonymization_type'] ) ) ) ); | |
| 295 | - | |
| 296 | - } | |
| 297 | - | |
| 298 | - if ( isset( $_POST['anonymization_pass'] )) { | |
| 299 | - update_option( 'bkpforwp_anonymization_pass', wpdbbkp_filter_data( sanitize_text_field( wp_unslash($_POST['anonymization_pass'] ) ) ) ); | |
| 300 | - | |
| 301 | - } | |
| 302 | - | |
| 303 | - if ( isset( $_POST['backup_encryption_pass'] )) { | |
| 304 | - update_option( 'bkpforwp_backup_encryption_pass', wpdbbkp_filter_data( sanitize_text_field( wp_unslash($_POST['backup_encryption_pass'] ) ) ) ); | |
| 305 | - | |
| 306 | - } | |
| 307 | - } | |
| 308 | - | |
| 261 | + do_action('wpdbbkp_save_pro_options'); | |
| 309 | 262 | } |
| 310 | 263 | $wp_db_backup_destination_email = get_option( 'wp_db_backup_destination_Email' , false); |
| 311 | 264 | |
| 312 | 265 | if ( isset( $_GET['page'] ) && 'wp-database-backup' === $_GET['page'] && isset( $_GET['action'] ) && 'unlink' === $_GET['action'] ) { |
| @@ -319,9 +272,9 @@ | ||
| 319 | 272 | $file = readdir( $dir_handle ); |
| 320 | 273 | while ( $file ) { |
| 321 | 274 | // If $file is NOT a directory remove it. |
| 322 | 275 | if ( ! is_dir( $file ) ) { |
| 323 | - wp_delete_file( $dir . $file ); | |
| 276 | + unlink( $dir . $file ); | |
| 324 | 277 | } |
| 325 | 278 | } |
| 326 | 279 | // Close the directory. |
| 327 | 280 | closedir( $dir_handle ); |
| @@ -340,17 +293,14 @@ | ||
| 340 | 293 | $index = (int) $_GET['index']; |
| 341 | 294 | $options = get_option( 'wp_db_backup_backups' ); |
| 342 | 295 | $newoptions = array(); |
| 343 | 296 | $count = 0; |
| 344 | - if(!empty($options) && is_array($options)){ | |
| 345 | - foreach ( $options as $option ) { | |
| 346 | - if ( $count !== $index ) { | |
| 347 | - $newoptions[] = $option; | |
| 348 | - } | |
| 349 | - $count++; | |
| 297 | + foreach ( $options as $option ) { | |
| 298 | + if ( $count !== $index ) { | |
| 299 | + $newoptions[] = $option; | |
| 350 | 300 | } |
| 301 | + $count++; | |
| 351 | 302 | } |
| 352 | - | |
| 353 | 303 | $upload_dir = wp_upload_dir(); |
| 354 | 304 | $actual_working_directory = getcwd(); |
| 355 | 305 | $file_directory = $upload_dir['basedir'].'/db-backup/'; |
| 356 | 306 | /* |
| @@ -356,20 +306,16 @@ | ||
| 356 | 306 | /* |
| 357 | 307 | Fix for when you try to delete a file thats in a folder |
| 358 | 308 | higher in the hierarchy to your working directory */ |
| 359 | 309 | chdir($file_directory); |
| 360 | - if ( isset($options[ $index ]['filename']) && file_exists( $options[ $index ]['filename'] ) ) { | |
| 361 | - wp_delete_file( $options[ $index ]['filename'] ); | |
| 310 | + if ( file_exists( $options[ $index ]['filename'] ) ) { | |
| 311 | + unlink( $options[ $index ]['filename'] ); | |
| 362 | 312 | } |
| 363 | - if(isset($options[ $index ]['filename'])){ | |
| 364 | - $file_sql = explode( '.', $options[ $index ]['filename'] ); | |
| 365 | - if ( isset($file_sql[0]) && file_exists( $file_sql[0] . '.sql' ) ) { | |
| 366 | - wp_delete_file( $file_sql[0] . '.sql' ); | |
| 367 | - } | |
| 313 | + $file_sql = explode( '.', $options[ $index ]['filename'] ); | |
| 314 | + if ( file_exists( $file_sql[0] . '.sql' ) ) { | |
| 315 | + unlink( $file_sql[0] . '.sql' ); | |
| 368 | 316 | } |
| 369 | - | |
| 370 | 317 | chdir($actual_working_directory); |
| 371 | - $newoptions = wpdbbkp_filter_unique_filenames( $newoptions ); | |
| 372 | 318 | update_option( 'wp_db_backup_backups', $newoptions , false); |
| 373 | 319 | $nonce = wp_create_nonce( 'wp-database-backup' ); |
| 374 | 320 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=delete&_wpnonce=' . $nonce ); |
| 375 | 321 | exit; |
| @@ -380,9 +326,8 @@ | ||
| 380 | 326 | |
| 381 | 327 | $upload_dir = wp_upload_dir(); |
| 382 | 328 | $actual_working_directory = getcwd(); |
| 383 | 329 | $file_directory = $upload_dir['basedir']; |
| 384 | - global $wpdb; | |
| 385 | 330 | /* |
| 386 | 331 | Fix for when you try to delete a file thats in a folder |
| 387 | 332 | higher in the hierarchy to your working directory |
| 388 | 333 | */ |
| @@ -389,20 +334,16 @@ | ||
| 389 | 334 | chdir($file_directory); |
| 390 | 335 | $files = glob($file_directory.'/db-backup'.'/*'); |
| 391 | 336 | |
| 392 | 337 | // Deleting all the files in the list |
| 393 | - if(!empty($files)){ | |
| 394 | - foreach($files as $file) { | |
| 395 | - if(is_file($file)){ | |
| 396 | - wp_delete_file($file); | |
| 397 | - } | |
| 398 | - } | |
| 399 | - } | |
| 338 | + foreach($files as $file) { | |
| 339 | + if(is_file($file)){ | |
| 340 | + unlink($file); | |
| 341 | + } | |
| 342 | + } | |
| 400 | 343 | chdir($actual_working_directory); |
| 401 | 344 | update_option( 'wp_db_backup_backups', array() , false); |
| 402 | 345 | $nonce = wp_create_nonce( 'wp-database-backup' ); |
| 403 | - $table_name = $wpdb->prefix . 'wpdbbkp_processed_files'; | |
| 404 | - $wpdb->query( "TRUNCATE TABLE $table_name" ); // phpcs:ignore | |
| 405 | 346 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=deleteall&_wpnonce=' . $nonce ); |
| 406 | 347 | exit; |
| 407 | 348 | |
| 408 | 349 | |
| @@ -411,15 +352,10 @@ | ||
| 411 | 352 | $options = get_option( 'wp_db_backup_backups' ); |
| 412 | 353 | $newoptions = array(); |
| 413 | 354 | $backup_check_list = array( '.htaccess', 'index.php' ); |
| 414 | 355 | $delete_message = 'WPDB : Deleted Files:'; |
| 415 | - if(!empty($options) && is_array($options)){ | |
| 416 | - foreach ( $options as $option ) { | |
| 417 | - if(!is_array($option)){ | |
| 418 | - continue; | |
| 419 | - } | |
| 420 | - $backup_check_list[] = $option['filename']; | |
| 421 | - } | |
| 356 | + foreach ( $options as $option ) { | |
| 357 | + $backup_check_list[] = $option['filename']; | |
| 422 | 358 | } |
| 423 | 359 | $path_info = wp_upload_dir(); |
| 424 | 360 | $wp_db_backup_path = $path_info['basedir'] . '/db-backup'; |
| 425 | 361 | |
| @@ -429,9 +365,9 @@ | ||
| 429 | 365 | if ( $dh ) { |
| 430 | 366 | while ( false !== ($file = readdir( $dh )) ) { |
| 431 | 367 | if ( ! ( in_array( $file, $backup_check_list, true ) ) ) { |
| 432 | 368 | if ( file_exists( $wp_db_backup_path . '/' . $file ) ) { |
| 433 | - wp_delete_file( $wp_db_backup_path . '/' . $file ); | |
| 369 | + unlink( $wp_db_backup_path . '/' . $file ); | |
| 434 | 370 | } |
| 435 | 371 | $delete_message .= ' ' . $file; |
| 436 | 372 | } |
| 437 | 373 | } |
| @@ -441,20 +377,18 @@ | ||
| 441 | 377 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=clear_temp_db_backup_file&_wpnonce=' . $nonce ); |
| 442 | 378 | exit; |
| 443 | 379 | break; |
| 444 | 380 | case 'restorebackup': |
| 445 | - $index = isset($_GET['index'])?(int) $_GET['index']:0; | |
| 381 | + $index = (int) $_GET['index']; | |
| 446 | 382 | $options = get_option( 'wp_db_backup_backups' ); |
| 447 | 383 | $restore_limit = get_option( 'wp_db_restore_limit'); |
| 448 | 384 | $newoptions = array(); |
| 449 | 385 | $count = 0; |
| 450 | - if(!empty($options) && is_array($options)){ | |
| 451 | - foreach ( $options as $option ) { | |
| 452 | - if ( $count !== $index ) { | |
| 453 | - $newoptions[] = $option; | |
| 454 | - } | |
| 455 | - $count++; | |
| 386 | + foreach ( $options as $option ) { | |
| 387 | + if ( $count !== $index ) { | |
| 388 | + $newoptions[] = $option; | |
| 456 | 389 | } |
| 390 | + $count++; | |
| 457 | 391 | } |
| 458 | 392 | if ( isset( $options[ $index ]['restore_limit'] ) && $options[ $index ]['restore_limit']==1) { |
| 459 | 393 | include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 460 | 394 | if ( !is_plugin_active( 'wp-database-backup-pro/wp-database-backup-pro.php' ) ) { |
| @@ -467,14 +401,11 @@ | ||
| 467 | 401 | |
| 468 | 402 | if ( isset( $options[ $index ]['sqlfile'] ) ) { // Added for extract zip file V.3.3.0. |
| 469 | 403 | $database_file = ( $options[ $index ]['sqlfile'] ); |
| 470 | 404 | } else { |
| 471 | - $database_file = isset($options[ $index ]['dir']) ? $options[ $index ]['dir'] : ''; | |
| 472 | - $file_sql = explode( '.', $database_file ); | |
| 473 | - if(isset($file_sql[0])){ | |
| 474 | - $database_file = ( $file_sql[0] . '.sql' ); | |
| 475 | - } | |
| 476 | - | |
| 405 | + $database_file = ( $options[ $index ]['dir'] ); | |
| 406 | + $file_sql = explode( '.', $options[ $index ]['dir'] ); | |
| 407 | + $database_file = ( $file_sql[0] . '.sql' ); | |
| 477 | 408 | } |
| 478 | 409 | $database_name = $this->wp_backup_get_config_db_name(); |
| 479 | 410 | $database_user = $this->wp_backup_get_config_data( 'DB_USER' ); |
| 480 | 411 | $datadase_password = $this->wp_backup_get_config_data( 'DB_PASSWORD' ); |
| @@ -500,97 +431,71 @@ | ||
| 500 | 431 | } |
| 501 | 432 | } |
| 502 | 433 | |
| 503 | 434 | // End for extract zip file V.3.3.0. |
| 504 | - set_time_limit( 0 ); // phpcs:ignore -- needed for long running process | |
| 435 | + set_time_limit( 0 ); | |
| 505 | 436 | ignore_user_abort(true); |
| 506 | - if ('' !== trim($database_name) && '' !== trim($database_user) && '' !== trim($database_host)) { | |
| 507 | - // Ensure we use WP's global DB connection. | |
| 508 | - global $wpdb; | |
| 509 | - if ( ! isset( $wpdb ) || ! is_object( $wpdb ) ) { | |
| 510 | - $wpdb = isset( $GLOBALS['wpdb'] ) ? $GLOBALS['wpdb'] : null; | |
| 511 | - } | |
| 512 | - if ( ! is_object( $wpdb ) ) { | |
| 513 | - wp_die( | |
| 514 | - esc_html__( 'Database connection is not available. Please reload the page and try again.', 'wpdbbkp' ), | |
| 515 | - esc_html__( 'Database Error', 'wpdbbkp' ) | |
| 516 | - ); | |
| 517 | - } | |
| 437 | + if ( '' !== ( trim( (string) $database_name ) ) && '' !== ( trim( (string) $database_user ) ) && '' !== ( trim( (string) $database_host ) ) ) { | |
| 438 | + $conn = mysqli_connect( (string) $database_host, (string) $database_user, (string) $datadase_password ); // phpcs:ignore | |
| 439 | + if ( $conn ) { | |
| 440 | + // Start Select the database. | |
| 441 | + if ( ! mysqli_select_db( $conn, (string) $database_name) ) { // phpcs:ignore | |
| 442 | + $sql = 'CREATE DATABASE IF NOT EXISTS `' . (string) $database_name . '`'; | |
| 443 | + mysqli_query($conn, $sql); // phpcs:ignore | |
| 444 | + mysqli_select_db($conn, (string) $database_name ); // phpcs:ignore | |
| 445 | + } | |
| 446 | + /* END: Select the Database */ | |
| 447 | + | |
| 448 | + /* BEGIN: Remove All Tables from the Database */ | |
| 449 | + $found_tables = null; | |
| 450 | + $result = mysqli_query( $conn, 'SHOW TABLES FROM `' . (string) $database_name . '`' ); // phpcs:ignore | |
| 518 | 451 | |
| 519 | - $wpdb->db_connect(); | |
| 520 | - $wpdb->select($database_name); | |
| 521 | - | |
| 522 | - //phpcs:ignore -- Check if database exists | |
| 523 | - $db_exists = $wpdb->get_var($wpdb->prepare( | |
| 524 | - "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = %s", | |
| 525 | - $database_name | |
| 526 | - )); | |
| 527 | - | |
| 528 | - if (!$db_exists) { | |
| 529 | - //phpcs:ignore -- Create DB if it doesn't exist | |
| 530 | - $wpdb->query( 'CREATE DATABASE IF NOT EXISTS `' . esc_sql( $database_name ) . '`' ); | |
| 531 | - $wpdb->select($database_name); | |
| 532 | - } | |
| 533 | - //phpcs:ignore -- Show tables from database | |
| 534 | - $tables = $wpdb->get_col( 'SHOW TABLES FROM `' . esc_sql( $database_name ) . '`' ); | |
| 535 | - | |
| 536 | - | |
| 537 | - if (!empty($tables)) { | |
| 538 | - foreach ($tables as $table_name) { | |
| 539 | - //phpcs:ignore -- delete tables before restore | |
| 540 | - $wpdb->query( 'DROP TABLE IF EXISTS `' . esc_sql( $table_name ) . '`' ); | |
| 452 | + if ( $result ) { | |
| 453 | + while ($row = mysqli_fetch_row($result)) { | |
| 454 | + $found_tables[] = $row[0]; | |
| 455 | + } | |
| 456 | + | |
| 457 | + if ( count( $found_tables ) > 0 ) { | |
| 458 | + foreach ( $found_tables as $table_name ) { | |
| 459 | + mysqli_query( $conn, "DROP TABLE " . (string) $database_name . ".".$table_name ); // phpcs:ignore | |
| 460 | + } | |
| 461 | + } | |
| 541 | 462 | } |
| 542 | - } | |
| 543 | - | |
| 544 | - // Restore database content | |
| 545 | - if (file_exists($database_file)) { | |
| 546 | - if ( ! function_exists( 'WP_Filesystem' ) ) { | |
| 547 | - require_once ABSPATH . '/wp-admin/includes/file.php'; | |
| 463 | + | |
| 464 | + /* END: Remove All Tables from the Database */ | |
| 465 | + | |
| 466 | + /* BEGIN: Restore Database Content */ | |
| 467 | + if ( isset( $database_file ) ) { | |
| 468 | + if ( file_exists( $database_file ) ) { | |
| 469 | + $sql_file = file_get_contents( $database_file, true ); | |
| 470 | + if($sql_file){ | |
| 471 | + $sql_queries = explode( ";\n", $sql_file ); | |
| 472 | + $sql_queries_count = count( $sql_queries ); | |
| 473 | + | |
| 474 | + mysqli_query($conn, "SET sql_mode = ''"); | |
| 475 | + | |
| 476 | + for ( $i = 0; $i < $sql_queries_count; $i++ ) { | |
| 477 | + $sql_query_=apply_filters( 'wpdbbkp_sql_query_restore', $sql_queries[ $i ] ); | |
| 478 | + mysqli_query($conn, $sql_query_ ); // phpcs:ignore | |
| 479 | + } | |
| 480 | + } | |
| 481 | + | |
| 548 | 482 | } |
| 549 | - | |
| 550 | - WP_Filesystem(); | |
| 551 | - if ( $wp_filesystem ) { | |
| 552 | - $sql_file = $wp_filesystem->get_contents( $database_file ); | |
| 553 | - if ( $sql_file !== false ) { | |
| 554 | - $sql_queries = explode(";\n", $sql_file); | |
| 555 | - //phpcs:ignore -- Set sql_mode to empty | |
| 556 | - $wpdb->query("SET sql_mode = ''"); | |
| 557 | - | |
| 558 | - foreach ($sql_queries as $query) { | |
| 559 | - $query = apply_filters('wpdbbkp_sql_query_restore', $query); | |
| 560 | - if (!empty(trim($query))) { | |
| 561 | - | |
| 562 | - /* Since $query is a dynqmic sql query from the backup file, we can't use $wpdb->prepare | |
| 563 | - * as we don't know the number / types of arguments in the query. So, we are using $wpdb->query | |
| 564 | - * directly to execute the query.*/ | |
| 565 | - //phpcs:ignore | |
| 566 | - $wpdb->query($query); | |
| 567 | - } | |
| 568 | - } | |
| 569 | - | |
| 570 | - } | |
| 571 | - } | |
| 483 | + } | |
| 572 | 484 | } |
| 573 | 485 | } |
| 574 | 486 | |
| 575 | 487 | if ( isset( $options[ $index ]['sqlfile'] ) && file_exists( $options[ $index ]['sqlfile'] ) ) { // Added for extract zip file V.3.3.0. |
| 576 | 488 | if ( file_exists( $options[ $index ]['sqlfile'] ) ) { |
| 577 | - wp_delete_file( $options[ $index ]['sqlfile'] ); | |
| 489 | + unlink( $options[ $index ]['sqlfile'] ); | |
| 578 | 490 | } |
| 579 | 491 | } else { |
| 580 | - $database_file = isset($options[ $index ]['dir'] )?$options[ $index ]['dir']:''; | |
| 581 | - if(!empty($database_file)){ | |
| 582 | - $file_sql = explode( '.', $database_file ); | |
| 583 | - if(isset($file_sql[0])){ | |
| 584 | - $database_file = ( $file_sql[0] . '.sql' ); | |
| 585 | - if ( file_exists( $database_file ) ) { | |
| 586 | - wp_delete_file( $database_file ); | |
| 587 | - } | |
| 588 | - | |
| 589 | - } | |
| 590 | - | |
| 492 | + $database_file = ( $options[ $index ]['dir'] ); | |
| 493 | + $file_sql = explode( '.', $options[ $index ]['dir'] ); | |
| 494 | + $database_file = ( $file_sql[0] . '.sql' ); | |
| 495 | + if ( file_exists( $database_file ) ) { | |
| 496 | + unlink( $database_file ); | |
| 591 | 497 | } |
| 592 | - | |
| 593 | 498 | } |
| 594 | 499 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=restore&_wpnonce=' . $nonce ); |
| 595 | 500 | exit; |
| 596 | 501 | break; |
| @@ -596,24 +501,18 @@ | ||
| 596 | 501 | break; |
| 597 | 502 | |
| 598 | 503 | case 'wpdbbkrestorefullbackup': |
| 599 | 504 | $index = (int) $_GET['index']; |
| 600 | - require_once( 'class-wpdbbkp-restore.php' ); | |
| 601 | - $restore = new Wpdbbkp_Restore(); | |
| 505 | + require_once( 'class-restore.php' ); | |
| 506 | + $restore = new Wpbp_Restore(); | |
| 602 | 507 | $restore->start($index); |
| 603 | 508 | if (get_option('wp_db_log') == 1) { |
| 604 | 509 | $options = get_option('wp_db_backup_backups'); |
| 605 | 510 | $path_info = wp_upload_dir(); |
| 606 | - if(isset($options[$index]['filename'])){ | |
| 607 | - $logFileName = explode(".", $options[$index]['filename']); | |
| 608 | - if(isset($logFileName[0])){ | |
| 609 | - $logfile = $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log/' . $logFileName[0] . '.txt'; | |
| 610 | - $message = "\n\n Restore Backup at " . gmdate("Y-m-d h:i:sa"); | |
| 611 | - $this->write_log($logfile, $message); | |
| 612 | - } | |
| 613 | - | |
| 614 | - } | |
| 615 | - | |
| 511 | + $logFileName = explode(".", $options[$index]['filename']); | |
| 512 | + $logfile = $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log/' . $logFileName[0] . '.txt'; | |
| 513 | + $message = "\n\n Restore Backup at " . date("Y-m-d h:i:sa"); | |
| 514 | + $this->write_log($logfile, $message); | |
| 616 | 515 | } |
| 617 | 516 | $nonce = wp_create_nonce( 'wp-database-backup' ); |
| 618 | 517 | wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=restore&_wpnonce=' . $nonce ); |
| 619 | 518 | exit; |
| @@ -644,23 +543,12 @@ | ||
| 644 | 543 | /** |
| 645 | 544 | * Setting page. |
| 646 | 545 | */ |
| 647 | 546 | public function wp_db_backup_settings_page() { |
| 648 | - global $wp_filesystem; | |
| 649 | - if(!function_exists('WP_Filesystem')){ | |
| 650 | - require_once ( ABSPATH . '/wp-admin/includes/file.php' ); | |
| 651 | - } | |
| 652 | - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
| 653 | - WP_Filesystem(); | |
| 654 | - $wp_db_is_pro = false; | |
| 655 | - if ( is_plugin_active( 'wp-database-backup-premium/wp-database-backup-premium.php' ) ) { | |
| 656 | - $wp_db_is_pro = true; | |
| 657 | - } | |
| 547 | + | |
| 658 | 548 | $options = get_option( 'wp_db_backup_backups' ); |
| 659 | - $options = wpdbbkp_filter_unique_filenames( $options ); | |
| 660 | 549 | $settings = get_option( 'wp_db_backup_options' ); |
| 661 | - $wp_db_log = get_option( 'wp_db_log' ); | |
| 662 | - $incremental_backup = get_option( 'wp_db_incremental_backup' ,false); ?> | |
| 550 | + $wp_db_log = get_option( 'wp_db_log' ); ?> | |
| 663 | 551 | <div class="bootstrap-wrapper"> |
| 664 | 552 | <?php |
| 665 | 553 | $wp_db_local_backup_path = get_option( 'wp_db_local_backup_path' ); |
| 666 | 554 | if ( false === empty( $wp_db_local_backup_path ) && false === file_exists( $wp_db_local_backup_path ) ) { |
| @@ -666,10 +554,10 @@ | ||
| 666 | 554 | if ( false === empty( $wp_db_local_backup_path ) && false === file_exists( $wp_db_local_backup_path ) ) { |
| 667 | 555 | echo '<div class="alert alert-warning alert-dismissible fade in" role="alert"> |
| 668 | 556 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> |
| 669 | 557 | <a href="#db_destination" data-toggle="tab">'; |
| 670 | - esc_html_e( 'Invalid Local Backup Path : ', 'wpdbbkp' ); | |
| 671 | - echo esc_html( $wp_db_local_backup_path ); | |
| 558 | + esc_attr_e( 'Invalid Local Backup Path : ', 'wp-database-backup' ); | |
| 559 | + echo esc_attr( $wp_db_local_backup_path ); | |
| 672 | 560 | echo '</a></div>'; |
| 673 | 561 | } |
| 674 | 562 | |
| 675 | 563 | $upload_dir = wp_upload_dir(); |
| @@ -676,9 +564,9 @@ | ||
| 676 | 564 | $dir = $upload_dir['basedir'] . '/db-backup'; |
| 677 | 565 | if ( ! is_dir( $dir ) ) { |
| 678 | 566 | $dir = $upload_dir['basedir']; |
| 679 | 567 | } |
| 680 | - if ( is_dir( $dir ) && !$wp_filesystem->is_writable( $dir )) { | |
| 568 | + if ( is_dir( $dir ) && ! is_writable( $dir ) ) { | |
| 681 | 569 | ?> |
| 682 | 570 | <div class="row"> |
| 683 | 571 | <div class="col-xs-12 col-sm-12 col-md-12"> |
| 684 | 572 | <div class="alert alert-danger alert-dismissible fade in" role="alert"> |
| @@ -683,11 +571,11 @@ | ||
| 683 | 571 | <div class="col-xs-12 col-sm-12 col-md-12"> |
| 684 | 572 | <div class="alert alert-danger alert-dismissible fade in" role="alert"> |
| 685 | 573 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"> |
| 686 | 574 | <span aria-hidden="true">×</span></button> |
| 687 | - <h4><?php esc_html_e( 'WP Database Backup', 'wpdbbkp' ); ?></h4> | |
| 688 | - <p><?php esc_html_e( 'Error: Permission denied, make sure you have write permission for', 'wpdbbkp' ); ?> <?php echo esc_attr( $dir ); ?> | |
| 689 | - <?php esc_html_e( 'folder', 'wpdbbkp' ); ?></p> | |
| 575 | + <h4>WP Database Backup</h4> | |
| 576 | + <p>Error: Permission denied, make sure you have write permission for <?php echo esc_attr( $dir ); ?> | |
| 577 | + folder</p> | |
| 690 | 578 | </div> |
| 691 | 579 | </button> |
| 692 | 580 | </div> |
| 693 | 581 | </div> |
| @@ -693,10 +581,8 @@ | ||
| 693 | 581 | </div> |
| 694 | 582 | <?php |
| 695 | 583 | } |
| 696 | 584 | ?> |
| 697 | - | |
| 698 | - | |
| 699 | 585 | |
| 700 | 586 | <div id="wpdbbkpModal" class="modal"> |
| 701 | 587 | <div class="wpdbbkpmodal-content"> |
| 702 | 588 | <div class="wpdbbkp-modal-header"> |
| @@ -719,26 +605,17 @@ | ||
| 719 | 605 | </div> |
| 720 | 606 | <div class="panel-body"> |
| 721 | 607 | <ul class="nav nav-tabs wbdbbkp_has_nav"> |
| 722 | 608 | <li class="active"><a href="#db_home" data-toggle="tab"><?php echo esc_html__('Backups', 'wpdbbkp') ?></a></li> |
| 723 | - <?php if($wp_db_is_pro){ | |
| 724 | - do_action('wpdbbkp_pro_tab_links'); | |
| 725 | - } else { ?> | |
| 726 | - <li><a href="#db_remotebackups" data-toggle="tab"><?php echo esc_html__('Cloud Backup', 'wpdbbkp') ?></a></li> | |
| 727 | - <?php } ?> | |
| 728 | - <li><a href="#db_migrate" data-toggle="tab"><?php echo esc_html__('Migration', 'wpdbbkp') ?></a></li> | |
| 729 | 609 | <li><a href="#db_schedul" data-toggle="tab"><?php echo esc_html__('Auto Scheduler', 'wpdbbkp') ?></a></li> |
| 730 | 610 | <li><a href="#db_destination" data-toggle="tab"><?php echo esc_html__('Save Backups to', 'wpdbbkp') ?></a></li> |
| 731 | 611 | <li><a href="#db_setting" data-toggle="tab"><?php echo esc_html__('Settings', 'wpdbbkp') ?></a></li> |
| 732 | - <li><a href="#searchreplace" style="display:none" data-toggle="tab"><?php echo esc_html__('Search and Replace', 'wpdbbkp') ?></a></li> | |
| 733 | - <li><a href="#db_features" data-toggle="tab"><?php echo esc_html__('Modules', 'wpdbbkp') ?></a></li> | |
| 734 | - <li title="System Info"><a href="#db_info" data-toggle="tab"><?php echo esc_html__('Usage', 'wpdbbkp') ?></a></li> | |
| 612 | + <li><a href="#searchreplace" data-toggle="tab"><?php echo esc_html__('Search and Replace', 'wpdbbkp') ?></a></li> | |
| 613 | + <li style="display:none"><a href="#db_upgrade" data-toggle="tab"><?php echo esc_html__('Upgrade', 'wpdbbkp') ?></a></li> | |
| 614 | + <?php do_action( 'wpdbbkp_pro_tab_links' ); ?> | |
| 735 | 615 | <li><a href="#db_help" data-toggle="tab"><?php echo esc_html__('Help & Support', 'wpdbbkp') ?></a></li> |
| 736 | - <?php if( ! $wp_db_is_pro ){ ?> | |
| 737 | - <li><a href="#db_upgrade" class="wpdbbkp-upgrade-a" data-toggle="tab"><?php echo esc_html__('Upgrade to Premium', 'wpdbbkp') ?></a></li> | |
| 738 | - <?php } ?> | |
| 616 | + <li id="db_info_link" title="System Info"><a href="#db_info" data-toggle="tab"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a></li> | |
| 739 | 617 | |
| 740 | - | |
| 741 | 618 | </ul> |
| 742 | 619 | |
| 743 | 620 | <?php |
| 744 | 621 | echo '<div class="tab-content">'; |
| @@ -757,9 +634,9 @@ | ||
| 757 | 634 | } |
| 758 | 635 | include_once 'admin-header-notification.php'; ?> |
| 759 | 636 | |
| 760 | 637 | <?php |
| 761 | - if ( !empty($options) ) { | |
| 638 | + if ( $options ) { | |
| 762 | 639 | |
| 763 | 640 | echo ' <script> |
| 764 | 641 | var $j = jQuery.noConflict(); |
| 765 | 642 | $j(document).ready(function () { |
| @@ -767,8 +644,14 @@ | ||
| 767 | 644 | var table = $j("#wpdbbkp_table").DataTable({ |
| 768 | 645 | order: [[0, "desc"]], |
| 769 | 646 | }); |
| 770 | 647 | $j(".popoverid").popover(); |
| 648 | + $j("#create_backup").click(function() { | |
| 649 | + $j(".wpdbbkp_notification").hide(); | |
| 650 | + $j("#backup_process").show(); | |
| 651 | + $j("#create_backup").attr("disabled", true); | |
| 652 | + | |
| 653 | + }); | |
| 771 | 654 | }); |
| 772 | 655 | |
| 773 | 656 | function excludetableall(){ |
| 774 | 657 | var checkboxes = document.getElementsByClassName("wp_db_exclude_table"); |
| @@ -779,8 +662,9 @@ | ||
| 779 | 662 | $j(".wp_db_exclude_table").each(function() { |
| 780 | 663 | this.checked = checked; |
| 781 | 664 | }); |
| 782 | 665 | } |
| 666 | + | |
| 783 | 667 | </script>'; |
| 784 | 668 | echo ' <div class="table-responsive"> |
| 785 | 669 | <div id="wpdbbkp_dataTables" class="dataTables_wrapper form-inline" role="grid"> |
| 786 | 670 | |
| @@ -810,90 +694,72 @@ | ||
| 810 | 694 | 'SFTP' => 'glyphicon glyphicon-tasks', |
| 811 | 695 | 'S3' => 'glyphicon glyphicon-cloud-upload', |
| 812 | 696 | 'Drive' => 'glyphicon glyphicon-hdd', |
| 813 | 697 | 'DropBox' => 'glyphicon glyphicon-inbox', |
| 814 | - 'Backblaze' => 'glyphicon glyphicon-cloud-upload', | |
| 815 | - 'CloudDrive' => 'glyphicon glyphicon-cloud-upload', | |
| 816 | - 'GenericS3' => 'glyphicon glyphicon-cloud-upload' | |
| 817 | 698 | ); |
| 818 | - if(!empty($options) && is_array($options)){ | |
| 819 | - foreach ( $options as $option ) { | |
| 820 | - if (!is_array($option)) { | |
| 821 | - continue; | |
| 699 | + foreach ( $options as $option ) { | |
| 700 | + $str_class = ( 0 === (int) $option['size'] ) ? 'text-danger' : 'wpdb_download'; | |
| 701 | + echo '<tr class="' . ( ( 0 === ( $count % 2 ) ) ? esc_attr( $str_class ) . ' alternate' : esc_attr( $str_class ) ) . '">'; | |
| 702 | + echo '<td style="text-align: center;">' . esc_attr( $count ) . '</td>'; | |
| 703 | + $curr_date = new DateTime(date( 'Y-m-d H:i:s', $option['date'] )); | |
| 704 | + $curr_date->setTimezone(new DateTimeZone(wp_timezone_string())); | |
| 705 | + echo '<td><span style="display:none">' . esc_attr( $curr_date->format('Y-m-d H:i:s') ) . '</span><span title="'.esc_attr( $curr_date->format('jS, F Y h:i:s A') ) .'">' .$this->wpdbbkp_get_timeago($option['date']).'</span>'; | |
| 706 | + echo '</td>'; | |
| 707 | + if($wp_db_log==1){ | |
| 708 | + echo '<td class="wpdb_log" align="center">'; | |
| 709 | + if (!empty($option['log'])) { | |
| 710 | + if(isset($option['type']) && ($option['type'] == 'complete' || $option['type'] == 'database')){ | |
| 711 | + echo '<a href="' . $option['log'] . '" target="_blank" class="label label-warning" title="There might be partial backup. Please check Log File for verify backup.">'; | |
| 712 | + echo '<span class="glyphicon glyphicon-list-alt"></span>'; | |
| 713 | + echo '</a>'; | |
| 714 | + }else{ | |
| 715 | + echo '<a class="popoverid btn" role="button" data-toggle="popover" data-html="true" title="There might be partial backup. Please check Log file to verify backup." data-content="' . wp_kses_post( $option['log'] ) . '"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a>'; | |
| 822 | 716 | } |
| 823 | - | |
| 824 | - $size = isset( $option['size'])? $option['size'] : 0; | |
| 825 | - $str_class = ( 0 === (int) $size ) ? 'text-danger' : 'wpdb_download'; | |
| 826 | - echo '<tr class="' . ( ( 0 === ( $count % 2 ) ) ? esc_attr( $str_class ) . ' alternate' : esc_attr( $str_class ) ) . '">'; | |
| 827 | - echo '<td style="text-align: center;">' . esc_attr( $count ) . '</td>'; | |
| 828 | - $curr_date = new DateTime(gmdate( 'Y-m-d H:i:s', $option['date'] )); | |
| 829 | - $curr_date->setTimezone(new DateTimeZone(wp_timezone_string())); | |
| 830 | - echo '<td><span style="display:none">' . esc_attr( $curr_date->format('Y-m-d H:i:s') ) . '</span><span title="'.esc_attr( $curr_date->format('jS, F Y h:i:s A') ) .'">' .esc_html($this->wpdbbkp_get_timeago($option['date'])).'</span>'; | |
| 831 | - echo '</td>'; | |
| 832 | - if($wp_db_log==1){ | |
| 833 | - echo '<td class="wpdb_log" align="center">'; | |
| 834 | - if (!empty($option['log'])) { | |
| 835 | - if(isset($option['type']) && ($option['type'] == 'complete' || $option['type'] == 'database')){ | |
| 836 | - echo '<a href="' . esc_url( admin_url('?wpdbbkp_log='.basename($option['log'])) ) . '" target="_blank" class="label label-warning" title="There might be partial backup. Please check Log File for verify backup.">'; | |
| 837 | - echo '<span class="glyphicon glyphicon-list-alt"></span>'; | |
| 838 | - echo '</a>'; | |
| 839 | - }else{ | |
| 840 | - echo '<a class="popoverid btn" role="button" data-toggle="popover" data-html="true" title="There might be partial backup. Please check Log file to verify backup." data-content="' . wp_kses_post( $option['log'] ) . '"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a>'; | |
| 717 | + } | |
| 718 | + echo '</td>'; | |
| 719 | + } | |
| 720 | + echo '<td>'; | |
| 721 | + if ( ! empty( $option['destination'] ) ) { | |
| 722 | + $destination = ( explode( ',', $option['destination'] ) ); | |
| 723 | + foreach ( $destination as $dest ) { | |
| 724 | + $key = trim( $dest ); | |
| 725 | + if ( ! empty( $dest ) && array_key_exists( $key, $destination_icon ) ) { | |
| 726 | + echo '<span class="' . esc_attr( $destination_icon[ $key ] ) . '" title="' . esc_attr( $dest ) . '"></span> '; | |
| 841 | 727 | } |
| 842 | 728 | } |
| 843 | - echo '</td>'; | |
| 729 | + } | |
| 730 | + echo '</td>'; | |
| 731 | + if(isset($option['type']) && !empty($option['type'])){ | |
| 732 | + if($option['type'] == 'complete'){ | |
| 733 | + echo '<td>'.esc_html__('Full Backup', 'wpdbbkp').'</td>'; | |
| 844 | 734 | } |
| 845 | - echo '<td>'; | |
| 846 | - if ( ! empty( $option['destination'] ) ) { | |
| 847 | - $destination = ( explode( ',', $option['destination'] ) ); | |
| 848 | - if ( ! empty( $destination ) && is_array( $destination ) ) { | |
| 849 | - foreach ( $destination as $dest ) { | |
| 850 | - $key = trim( $dest ); | |
| 851 | - if ( empty( $key ) ) { | |
| 852 | - continue; | |
| 853 | - } | |
| 854 | - // Icon | |
| 855 | - if ( array_key_exists( $key, $destination_icon ) ) { | |
| 856 | - echo '<span class="' . esc_attr( $destination_icon[ $key ] ) . '" title="' . esc_attr( $key ) . '"></span> '; | |
| 857 | - } | |
| 858 | - // Do not add any text label; icon-only for all destinations | |
| 859 | - } | |
| 860 | - } | |
| 735 | + if($option['type'] == 'database'){ | |
| 736 | + echo '<td>'.esc_html__('Database', 'wpdbbkp').'</td>'; | |
| 861 | 737 | } |
| 862 | - echo '</td>'; | |
| 738 | + }else{ | |
| 739 | + echo '<td>Database</td>'; | |
| 740 | + } | |
| 741 | + echo '<td>'; | |
| 742 | + echo '<a class="btn btn-default" href="' . esc_url( $option['url'] ) . '" style="color: #21759B;border-color:#337ab7;">'; | |
| 743 | + echo '<span class="glyphicon glyphicon-download-alt"></span> Download</a></td>'; | |
| 744 | + echo '<td>' . esc_attr( $this->wp_db_backup_format_bytes( $option['size'] ) ) . '</td>'; | |
| 745 | + $remove_backup_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=removebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 746 | + echo '<td><a title="Remove Database Backup" onclick="return confirm(\'Are you sure you want to delete database backup?\')" href="' . $remove_backup_href . '" class="btn btn-default"><span style="color:red" class="glyphicon glyphicon-trash"></span> Remove <a/> '; | |
| 747 | + if ( isset( $option['search_replace'] ) && 1 === (int) $option['search_replace'] ) { | |
| 748 | + echo '<span style="margin-left:15px" title="' . esc_html( $option['log'] ) . '" class="glyphicon glyphicon-search"></span>'; | |
| 749 | + } else { | |
| 750 | + $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=restorebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 863 | 751 | if(isset($option['type']) && !empty($option['type'])){ |
| 864 | 752 | if($option['type'] == 'complete'){ |
| 865 | - echo '<td>'.esc_html__('Full Backup', 'wpdbbkp').'</td>'; | |
| 753 | + $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=wpdbbkrestorefullbackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 866 | 754 | } |
| 867 | - if($option['type'] == 'database'){ | |
| 868 | - echo '<td>'.esc_html__('Database', 'wpdbbkp').'</td>'; | |
| 869 | - } | |
| 870 | - }else{ | |
| 871 | - echo '<td>Database</td>'; | |
| 755 | + | |
| 872 | 756 | } |
| 873 | - echo '<td>'; | |
| 874 | - echo '<a class="btn btn-default" href="' . esc_url( admin_url('?wpdbbkp_download='.basename($option['url'])) ) . '" style="color: #21759B;border-color:#337ab7;">'; | |
| 875 | - echo '<span class="glyphicon glyphicon-download-alt"></span> Download</a></td>'; | |
| 876 | - echo '<td>' . esc_attr( $this->wp_db_backup_format_bytes( $option['size'] ) ) . '</td>'; | |
| 877 | - $remove_backup_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=removebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 878 | - echo '<td><a title="Remove Database Backup" onclick="return confirm(\'Are you sure you want to delete database backup?\')" href="' . esc_url($remove_backup_href) . '" class="btn btn-default"><span style="color:red" class="glyphicon glyphicon-trash"></span> Remove <a/> '; | |
| 879 | - if ( isset( $option['search_replace'] ) && 1 === (int) $option['search_replace'] ) { | |
| 880 | - echo '<span style="margin-left:15px" title="' . esc_html( $option['log'] ) . '" class="glyphicon glyphicon-search"></span>'; | |
| 881 | - } else { | |
| 882 | - $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=restorebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 883 | - if(isset($option['type']) && !empty($option['type'])){ | |
| 884 | - if($option['type'] == 'complete'){ | |
| 885 | - $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=wpdbbkrestorefullbackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); | |
| 886 | - } | |
| 887 | - | |
| 888 | - } | |
| 889 | - echo '<a title="Restore Database Backup" onclick="wpdbbkp_restore_backup(this);" href="javascript:void(0);" data-msg="Are you sure you want to restore database backup? It will overwrite all data /files with the respective backup and all recent changes would be lost. Are you sure you want to continue?" data-title="Restore Backup" data-href="'.esc_url($restore_url_href).'" class="btn btn-default"><span class="glyphicon glyphicon-refresh" style="color:blue"></span> Restore <a/>'; | |
| 890 | - } | |
| 891 | - echo '</td></tr>'; | |
| 892 | - $count++; | |
| 757 | + echo '<a title="Restore Database Backup" onclick="wpdbbkp_restore_backup(this);" href="javascript:void(0);" data-msg="Are you sure you want to restore database backup? It will overwrite all data /files with the respective backup and all recent changes would be lost. Are you sure you want to continue?" data-title="Restore Backup" data-href="'.$restore_url_href.'" class="btn btn-default"><span class="glyphicon glyphicon-refresh" style="color:blue"></span> Restore <a/>'; | |
| 893 | 758 | } |
| 759 | + echo '</td></tr>'; | |
| 760 | + $count++; | |
| 894 | 761 | } |
| 895 | - | |
| 896 | 762 | echo '</tbody>'; |
| 897 | 763 | |
| 898 | 764 | echo ' </table> |
| 899 | 765 | </div> |
| @@ -898,14 +764,12 @@ | ||
| 898 | 764 | echo ' </table> |
| 899 | 765 | </div> |
| 900 | 766 | </div>'; |
| 901 | 767 | } else { |
| 902 | - echo '<p>'. esc_html__('No Database Backups Created!','wpdbbkp').'</p>'; | |
| 768 | + echo '<p>No Database Backups Created!</p>'; | |
| 903 | 769 | } |
| 904 | - ?> | |
| 905 | 770 | |
| 906 | - <p><?php echo esc_html__('If you like ','wpdbbkp')?><b> <?php echo esc_html__('WP Database Backup ','wpdbbkp')?> </b> <?php echo esc_html__('please leave us a ','wpdbbkp')?><a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-database-backup" title="Rating" sl-processed="1"> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> rating </a>. <?php echo esc_html__('Many thanks in advance!','wpdbbkp')?> </p> | |
| 907 | - <?php | |
| 771 | + echo '<p>If you like <b>WP Database Backup</b> please leave us a <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-database-backup" title="Rating" sl-processed="1"> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> rating </a>. Many thanks in advance!</p>'; | |
| 908 | 772 | echo '</div>'; |
| 909 | 773 | |
| 910 | 774 | echo '<div class="tab-pane" id="db_schedul">'; |
| 911 | 775 | echo '<div class="panel-group">'; |
| @@ -928,17 +792,17 @@ | ||
| 928 | 792 | if ( isset( $settings['autobackup_type'] ) ) { |
| 929 | 793 | $autobackup_type = $settings['autobackup_type']; |
| 930 | 794 | } |
| 931 | 795 | |
| 932 | - echo '<div class="row form-group"><label class="col-sm-3" for="enable_autobackups">'. esc_html__('Enable Auto Backups','wpdbbkp') .'</label>'; | |
| 796 | + echo '<div class="row form-group"><label class="col-sm-3" for="enable_autobackups">Enable Auto Backups</label>'; | |
| 933 | 797 | echo '<div class="col-sm-9"><input type="checkbox" id="enable_autobackups" name="wp_db_backup_options[enable_autobackups]" value="1" ' . checked( 1, $enable_autobackups, false ) . '/>'; |
| 934 | - echo '<div class="alert alert-default" role="alert"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>'. esc_html__('AutoBackups will be based on Wordpress Cron so it can have execution delay of +/- 30 mins . If you have disabled Wordpress Cron then autobackup will not work until you have set Server Cron for wordpress.','wpdbbkp') .'</div>'; | |
| 798 | + echo '<div class="alert alert-default" role="alert"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> AutoBackups will be based on Wordpress Cron so it can have execution delay of +/- 30 mins . If you have disabled Wordpress Cron then autobackup will not work until you have set Server Cron for wordpress.</div>'; | |
| 935 | 799 | echo '</div>'; |
| 936 | 800 | echo '</div>'; |
| 937 | 801 | |
| 938 | - echo '<div class="row form-group autobackup_type" style="display:none"><label class="col-sm-3" for="autobackup_frequency">'. esc_html__('Which part should we backup for you ?','wpdbbkp').'</label>'; | |
| 802 | + echo '<div class="row form-group autobackup_type" style="display:none"><label class="col-sm-3" for="autobackup_frequency">Which part should we backup for you ?</label>'; | |
| 939 | 803 | echo '<div class="col-sm-9"><select id="autobackup_type" class="form-control" name="wp_db_backup_options[autobackup_type]">'; |
| 940 | - echo '<option value="">'.esc_html__('Select Backup Type','wpdbbkp').'</option>'; | |
| 804 | + echo '<option value="">Select Backup Type</option>'; | |
| 941 | 805 | echo '<option value="full" ' . selected( 'full', $autobackup_type, false ) . '>Full(Files + DB)</option>'; |
| 942 | 806 | echo '<option value="files" ' . selected( 'files', $autobackup_type, false ) . '>Files Only</option>'; |
| 943 | 807 | echo '<option value="db" ' . selected( 'db', $autobackup_type, false ) . '>Database Only</option>'; |
| 944 | 808 | echo '</select>'; |
| @@ -943,9 +807,9 @@ | ||
| 943 | 807 | echo '<option value="db" ' . selected( 'db', $autobackup_type, false ) . '>Database Only</option>'; |
| 944 | 808 | echo '</select>'; |
| 945 | 809 | echo '</div></div>'; |
| 946 | 810 | |
| 947 | - echo '<div class="row form-group autobackup_frequency" style="display:none"><label class="col-sm-3" for="autobackup_frequency">'.esc_html__('How often should we run Automatically?','wpdbbkp'). '</label>'; | |
| 811 | + echo '<div class="row form-group autobackup_frequency" style="display:none"><label class="col-sm-3" for="autobackup_frequency">How often should we run Automatically?</label>'; | |
| 948 | 812 | echo '<div class="col-sm-9"><select id="autobackup_frequency" class="form-control" name="wp_db_backup_options[autobackup_frequency]">'; |
| 949 | 813 | echo '<option value="daily" ' . selected( 'daily', $autobackup_frequency, false ) . '>Daily</option>'; |
| 950 | 814 | echo '<option value="weekly" ' . selected( 'weekly', $autobackup_frequency, false ) . '>Weekly</option>'; |
| 951 | 815 | echo '<option value="monthly" ' . selected( 'monthly', $autobackup_frequency, false ) . '>Monthly</option>'; |
| @@ -951,313 +815,175 @@ | ||
| 951 | 815 | echo '<option value="monthly" ' . selected( 'monthly', $autobackup_frequency, false ) . '>Monthly</option>'; |
| 952 | 816 | echo '</select>'; |
| 953 | 817 | echo '</div></div>'; |
| 954 | 818 | |
| 955 | - echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_daily_lite" >'.esc_html__('We will automatically backup at 00:00 AM daily. ','wpdbbkp'). '<b><a href="javascript:modify_backup_frequency();">'.esc_html__('Change Back Frequency Timings','wpdbbkp') .'</a></b></label></div>'; | |
| 956 | - echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_weekly_lite" >'.esc_html__('We will automatically backup every Sunday on weekly basis.','wpdbbkp') . '<b><a href="javascript:modify_backup_frequency();">'.esc_html__('Change Back Frequency Timings','wpdbbkp') .'</a></b></label></div>'; | |
| 957 | - echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_monthly_lite" >'.esc_html__('We will automatically backup on 1st on Monday on monthly basis.','wpdbbkp') . ' <b><a href="javascript:modify_backup_frequency();">'.esc_html__('Change Back Frequency Timings','wpdbbkp') . '</a></b></label></div>'; | |
| 819 | + echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_daily_lite" >We will automatically backup at 00:00 AM daily. <b><a href="javascript:modify_backup_frequency();">Change Back Frequency Timings</a></b></label></div>'; | |
| 820 | + echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_weekly_lite" >We will automatically backup every Sunday on weekly basis. <b><a href="javascript:modify_backup_frequency();">Change Back Frequency Timings</a></b></label></div>'; | |
| 821 | + echo '<div class="row form-group autobackup_frequency_lite" style="display:none"><label class="col-sm-12 autobackup_monthly_lite" >We will automatically backup on 1st on Monday on monthly basis. <b><a href="javascript:modify_backup_frequency();">Change Back Frequency Timings</a></b></label></div>'; | |
| 958 | 822 | |
| 959 | 823 | do_action('wpdbbkp_database_backup_options'); |
| 960 | 824 | echo '<p class="submit">'; |
| 961 | - echo '<input type="submit" name="'.esc_html__('Submit','wpdbbkp') . '" class="btn btn-primary" value="'.esc_html__('Save Settings','wpdbbkp') . '" />'; | |
| 825 | + echo '<input type="submit" name="Submit" class="btn btn-primary" value="Save Settings" />'; | |
| 962 | 826 | echo '</p>'; |
| 963 | 827 | echo '</form>'; |
| 964 | 828 | echo '</div>'; |
| 965 | 829 | echo '</div>'; |
| 966 | - | |
| 967 | 830 | |
| 968 | - | |
| 969 | 831 | do_action('wpdbbkp_pro_tab_content'); |
| 970 | 832 | |
| 971 | 833 | ?> |
| 972 | 834 | |
| 973 | -<!-- Modal Structure --> | |
| 974 | -<div class="modal" id="wpdbbkp_offer_modal" data-dismiss="modal" tabindex="-1" aria-labelledby="wpdbbkp_offer_modalLabel" aria-hidden="true"> | |
| 975 | - <div class="modal-dialog"> | |
| 976 | - <div class="modal-content"> | |
| 977 | - <div class="modal-body"> | |
| 978 | - <button type="button" id="offer_close" class="close" data-dismiss="modal" aria-label="Close"> | |
| 979 | - <span aria-hidden="true">×</span> | |
| 980 | - </button> | |
| 981 | - <h3 class="modal-title" id="wpdbbkp_offer_modalLabel"><img src="<?php echo esc_attr( WPDB_PLUGIN_URL ); /* phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage */ ?>/assets/images/wp-database-backup.png" width="230px"></h3> | |
| 982 | - <p style="padding:0 50px;"><?php echo esc_html__('Cloud Backup offers a secure, reliable and affordable solution to backup your WP site to the cloud.','wpdbbkp');?></p> | |
| 983 | - <div class="wpdbbkp_offer_container"> | |
| 984 | - <div class="wpdbbkp_server"> | |
| 985 | - <h4><?php echo esc_html__('Server Backup','wpdbbkp');?></h4> | |
| 986 | - <p><?php echo esc_html__('Backup your site to server','wpdbbkp');?></p> | |
| 987 | - <ul> | |
| 988 | - <li>✔ <?php echo esc_html__('Easy to setup','wpdbbkp');?></li> | |
| 989 | - <li>✔ <?php echo esc_html__('Takes storage on your server','wpdbbkp');?></li> | |
| 990 | - <li>✔ <?php echo esc_html__('Availability subject to server','wpdbbkp');?></li> | |
| 991 | - </ul> | |
| 992 | - <h4><?php echo esc_html__('Free','wpdbbkp');?></h4> | |
| 993 | - <button id="wpdbbkp_server_backup" class="btn btn-secondary"><?php echo esc_html__('Create a Backup on this Server','wpdbbkp');?></button> | |
| 994 | - </div> | |
| 995 | - <div class="wpdbbkp_remote"> | |
| 996 | - <h4><?php echo esc_html__('Cloud Backup','wpdbbkp');?></h4> | |
| 997 | - <p><?php echo esc_html__('Backup your site in the cloud','wpdbbkp');?></p> | |
| 998 | - <ul> | |
| 999 | - <li>✔ <?php echo esc_html__('Secure and reliable','wpdbbkp');?></li> | |
| 1000 | - <li>✔ <?php echo esc_html__('Unlimited Storage *','wpdbbkp');?></li> | |
| 1001 | - <li>✔ <?php echo esc_html__('High availability','wpdbbkp');?></li> | |
| 1002 | - </ul> | |
| 1003 | - <h4><?php echo esc_html__('$49','wpdbbkp');?> <small><?php echo esc_html__('per month onwards','wpdbbkp');?></small></h4> | |
| 1004 | - <button id="wpdbbkp_remote_backup" class="btn btn-primary"><?php echo esc_html__('Create a Backup on Cloud Server','wpdbbkp');?></button> | |
| 1005 | - | |
| 1006 | - </div> | |
| 1007 | - | |
| 1008 | - </div> | |
| 1009 | - <br><small><?php echo esc_html__('* Fair Usage Policies applies','wpdbbkp');?></small> | |
| 1010 | - </div> | |
| 1011 | - </div> | |
| 1012 | - </div> | |
| 1013 | -</div> | |
| 1014 | -<div class="tab-pane" id="db_features"> | |
| 835 | + <div class="tab-pane" id="db_upgrade"> | |
| 836 | + <div class="panel-group "> | |
| 837 | + <div class="gn-flex-container row"> | |
| 838 | + <div class=" col-md-12"> | |
| 839 | + <div class="wpdbbkp-wrapper"> | |
| 840 | + <div class="wpdbbkp-wr"> | |
| 841 | + <div class="bkp-wpdbbkp-img"> | |
| 842 | + <span class="sp_ov"></span> | |
| 843 | + </div> | |
| 844 | + <div class="bkp-wpdbbkp-cnt"> | |
| 845 | + <h1><?php esc_html_e('UPGRADE to PRO Version','wpdbbkp');?></h1> | |
| 846 | + <a class="buy" href="https://backupforwp.com/pricing/#pricings" target="_blank">Purchase Now</a> | |
| 847 | + </div> | |
| 848 | + <div class="pvf"> | |
| 849 | + <div class="pvf-cnt"> | |
| 850 | + <div class="pvf-tlt"> | |
| 851 | + <h2><?php esc_html_e('Compare Pro vs. Free Version','wpdbbkp');?></h2> | |
| 852 | + <span><?php esc_html_e('See what you\'ll get with the professional version','wpdbbkp');?></span> | |
| 853 | + </div> | |
| 854 | + <div class="pvf-cmp"> | |
| 855 | + <div class="fr"> | |
| 856 | + <h1><?php esc_html_e('FREE','wpdbbkp');?></h1> | |
| 857 | + <div class="fr-fe"> | |
| 858 | + <div class="fe-1"> | |
| 859 | + <h4><?php esc_html_e('Continious Development','wpdbbkp');?></h4> | |
| 860 | + <p><?php esc_html_e('We take bug reports and feature requests seriously. We\'re continiously developing & improve this product for last 2 years with passion and love.','wpdbbkp');?></p> | |
| 861 | + </div> | |
| 862 | + <div class="fe-1"> | |
| 863 | + <h4><?php esc_html_e('10+ Features','wpdbbkp');?></h4> | |
| 864 | + <p><?php esc_html_e('We\'re constantly expanding the plugin and make it more useful. We have wide variety of features which will fit any use-case.','wpdbbkp');?></p> | |
| 865 | + </div> | |
| 866 | + </div><!-- /. fr-fe --> | |
| 867 | + </div><!-- /. fr --> | |
| 868 | + <div class="pr"> | |
| 869 | + <h1>PRO</h1> | |
| 870 | + <div class="pr-fe"> | |
| 871 | + <span><?php esc_html_e('Everything in Free, and:','wpdbbkp');?></span> | |
| 872 | + <div class="fet"> | |
| 873 | + <div class="fe-2"> | |
| 874 | + <div class="fe-t"> | |
| 875 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 876 | + <h4><?php esc_html_e('Anonymization Function','wpdbbkp');?></h4> | |
| 877 | + </div> | |
| 878 | + <p><?php esc_html_e('Anonymization you critical data during backup with three methods','wpdbbkp');?> </p> | |
| 879 | + </div> | |
| 880 | + <div class="fe-2"> | |
| 881 | + <div class="fe-t"> | |
| 882 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 883 | + <h4><?php esc_html_e('Pre-update backups','wpdbbkp');?></h4> | |
| 884 | + </div> | |
| 885 | + <p> <?php esc_html_e('Automatically backs up your website before any updates to plugins, themes and WordPress core.','wpdbbkp');?></p> | |
| 886 | + </div> | |
| 1015 | 887 | |
| 1016 | - <div class="panel-group"> | |
| 1017 | - <form method="post" action="" name="db_features_form"> | |
| 1018 | - <?php wp_nonce_field('wp-database-backup'); | |
| 1019 | - $enable_anonymization = get_option('bkpforwp_enable_anonymization',false); | |
| 1020 | - $anonymization_type = get_option('bkpforwp_anonymization_type',false); | |
| 1021 | - $enable_backup_encryption = get_option('bkpforwp_enable_backup_encryption',false); | |
| 1022 | - $anonymization_pass = get_option('bkpforwp_anonymization_pass',''); | |
| 1023 | - $backup_encryption_pass = get_option('bkpforwp_encryption_pass',''); | |
| 1024 | - $enable_exact_backup_time = get_option('bkpforwp_enable_exact_backup_time',false); | |
| 1025 | - ?> | |
| 1026 | - <div class="row form-group"><label class="col-sm-3" for="enable_anonymization"><?php esc_html_e('Data Anonymization','wpdbbkp'); ?></label> | |
| 1027 | - <div class="col-sm-9"><input type="checkbox" id="enable_anonymization" | |
| 1028 | - name="enable_anonymization" value="1" <?php checked($enable_anonymization,1,1); ?> /> | |
| 1029 | - | |
| 1030 | - <div class="alert alert-default" role="alert"> | |
| 1031 | - <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php esc_html_e('Data anonymization is protecting private or sensitive information by erasing or encrypting identifiers that connect an individual to stored data.','wpdbbkp'); ?><a href="https://backupforwp.com/" target="_blank">Learn More</a></div> | |
| 1032 | - </div> | |
| 1033 | - </div> | |
| 1034 | - <div class="row form-group" id="anonymization_type_div" style="display:none"> | |
| 1035 | - <label class="col-sm-3" for="anonymization_type"><?php esc_html_e('Data Anonymization Type','wpdbbkp'); ?> </label> | |
| 1036 | - <div class="col-sm-9"><select id="anonymization_type" class="form-control" | |
| 1037 | - name="anonymization_type"> | |
| 1038 | - <option value="masked_data" <?php selected('masked_data', $anonymization_type, true) ?>> <?php esc_html_e('Masked Data','wpdbbkp'); ?> | |
| 1039 | - </option> | |
| 1040 | - <option value="fake_data" <?php selected('fake_data', $anonymization_type, true) ?>> <?php esc_html_e('Fake Data','wpdbbkp'); ?> | |
| 1041 | - </option> | |
| 1042 | - <option value="encrypted_data" <?php selected('encrypted_data', $anonymization_type, true) ?>> <?php esc_html_e('Encrypted Data','wpdbbkp'); ?> | |
| 1043 | - </option> | |
| 1044 | - </select> | |
| 1045 | - <?php echo wp_kses_post('<table class="bkpforwp-infotable"> | |
| 1046 | - <tr><th>Masked Data </th><td>Data is masked with * character and <strong class="bkpforwp-red">data can not be recovered</strong> while restore.</td></tr> | |
| 1047 | - <tr><th>Fake Data </th><td>Data is replaced with fake data and <strong class="bkpforwp-red">data can not be recovered</strong> while restore.</td></tr> | |
| 1048 | - <tr><th>Encrypted Data </th><td>Data is encrypted with a password and <strong class="bkpforwp-green">data can be recovered</strong> while restore by using the same password used to backup the data.You just have to add the encryption password in Data Anonymization setting before restoring backup.</td></tr> | |
| 1049 | - </table>');?> | |
| 1050 | - | |
| 1051 | - </div> | |
| 1052 | - </div> | |
| 1053 | - | |
| 1054 | - <div class="row form-group" id="anonymization_enc_ip" style="display:none"> | |
| 1055 | - <label class="col-sm-3" for="anonymization_pass"><?php esc_html_e('Encrypted Data','wpdbbkp'); ?> <?php esc_html_e('Anonymization Password','wpdbbkp'); ?></label> | |
| 1056 | - <div class="col-sm-9"> | |
| 1057 | - <input type="password" name="anonymization_pass" id="anonymization_pass" class="form-control" value="<?php esc_attr($anonymization_pass);?>"> | |
| 1058 | - <div class="alert alert-default" role="alert"> | |
| 1059 | - <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php esc_html_e('Please enter the encryption password. If you lose this pass then you can not recover the encrypted data','wpdbbkp'); ?></div> | |
| 1060 | - </div> | |
| 1061 | - | |
| 1062 | - </div> | |
| 888 | + <div class="fe-2"> | |
| 889 | + <div class="fe-t"> | |
| 890 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 891 | + <h4><?php esc_html_e('Backup time and scheduling','wpdbbkp'); ?></h4> | |
| 892 | + </div> | |
| 893 | + <p><?php esc_html_e('Set exact times to create or delete backups.','wpdbbkp');?></p> | |
| 894 | + </div> | |
| 1063 | 895 | |
| 1064 | - <div class="row form-group" style="display:none"><label class="col-sm-3" for="enable_backup_encryption"><?php esc_html_e('Backup File Encrpytion','wpdbbkp'); ?></label> | |
| 1065 | - <div class="col-sm-9"><input type="checkbox" id="enable_backup_encryption" | |
| 1066 | - name="enable_backup_encryption" value="1" <?php checked($enable_backup_encryption,1,1); ?> /></div> | |
| 1067 | - </div> | |
| 1068 | 896 | |
| 1069 | - <div class="row form-group" id="encryption_pass_div" style="display:none"> | |
| 1070 | - <label class="col-sm-3" for="backup_encryption_pass"><?php esc_html_e('Backup Password','wpdbbkp'); ?></label> | |
| 1071 | - <div class="col-sm-9"> | |
| 1072 | - <input type="password" name="backup_encryption_pass" id="backup_encryption_pass" class="form-control" value="<?php esc_attr($backup_encryption_pass);?>"> | |
| 1073 | - </div> | |
| 1074 | - </div> | |
| 1075 | - | |
| 1076 | - <p class="submit"> | |
| 1077 | - <input type="submit" name="featureSubmit" class="btn btn-primary" value="Save Settings" /> | |
| 1078 | - </p> | |
| 1079 | - </form> | |
| 1080 | - </div> | |
| 1081 | - </div> | |
| 1082 | -<div class="tab-pane" id="db_remotebackups"> | |
| 1083 | -<?php | |
| 1084 | -$update_msg = ''; | |
| 1085 | -if ( true === isset( $_POST['wpdb_cd_s3'] ) && 'Y' === $_POST['wpdb_cd_s3'] ) { | |
| 1086 | - // Validate that the contents of the form request came from the current site and not somewhere else added 21-08-15 V.3.4. | |
| 1087 | - if ( ! isset( $_POST['wpdbbackup_update_cd_setting'] ) ) { | |
| 1088 | - wp_die( esc_html__('Invalid form data. form request came from the somewhere else not current site!','wpdbbkp') ); | |
| 1089 | - } | |
| 1090 | - if ( ! wp_verify_nonce( wp_unslash( $_POST['wpdbbackup_update_cd_setting'] ) , 'wpdbbackup-update-cd-setting' ) ) { //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 1091 | - wp_die( esc_html__('Invalid form data. form request came from the somewhere else not current site!','wpdbbkp') ); | |
| 1092 | - } | |
| 1093 | - | |
| 1094 | - if ( true === isset( $_POST['wpdb_clouddrive_token'] ) ) { | |
| 1095 | - update_option( 'wpdb_clouddrive_token', wpdbbkp_filter_data( sanitize_text_field( wp_unslash( $_POST['wpdb_clouddrive_token'] ) ) ), false ); | |
| 1096 | - } | |
| 1097 | - | |
| 1098 | - // Put a "settings updated" message on the screen. | |
| 1099 | - $update_msg = esc_html__('Your BackupforWP Cloud Backup setting has been saved.' , 'wpdbbkp'); | |
| 1100 | -} | |
| 1101 | - | |
| 1102 | -$wpdb_clouddrive_token = get_option( 'wpdb_clouddrive_token',null); | |
| 1103 | - | |
| 1104 | -$wpdbbkp_bb_s3_status = '<small><b>'.esc_html__('Status', 'wpdbbkp').'</b>: '.esc_html__('Not Configured', 'wpdbbkp').' </small> '; | |
| 1105 | - | |
| 1106 | -if($wpdb_clouddrive_token && !empty($wpdb_clouddrive_token)) | |
| 1107 | -{ | |
| 1108 | - $wpdbbkp_bb_s3_status ='<small>'.esc_html__('Status', 'wpdbbkp').'</b>: <span class="dashicons dashicons-yes-alt" style="color:green;font-size:16px" title="'.esc_attr__('Destination enabled', 'wpdbbkp').'"></span><span class="configured">'.esc_html__('Configured', 'wpdbbkp').' </span> </small> '; | |
| 1109 | -} | |
| 1110 | - | |
| 1111 | -?> | |
| 1112 | -<h2 align="center"><strong><?php echo esc_html__('Cloud Backup by BackupforWP', 'wpdbbkp') ?></strong></h2> | |
| 1113 | -<div class="panel panel-default"> | |
| 1114 | - <div class="panel-heading"> | |
| 1115 | - <h4 class="panel-title"> | |
| 1116 | - <a data-toggle="collapse" data-parent="#accordion" href="#collapsebb"> | |
| 1117 | - <?php echo '<b>'.esc_html__('Cloud Backup', 'wpdbbkp').'</b>'; ?> <?php echo wp_kses_post($wpdbbkp_bb_s3_status);?> | |
| 1118 | - | |
| 1119 | - </a> | |
| 1120 | - </h4> | |
| 1121 | - </div> | |
| 1122 | - <div class="panel-body"> | |
| 1123 | - <?php | |
| 1124 | - if($update_msg){ | |
| 1125 | - echo '<div class="updated"><p><strong>'.esc_html( $update_msg ).'</strong></p></div>'; | |
| 1126 | - } | |
| 1127 | - ?> | |
| 1128 | - <form class="form-group" name="Clouddrive3" method="post" action=""> | |
| 1129 | - | |
| 1130 | - <p style="padding:0 20px;"> | |
| 1131 | - <?php echo '<h2 style="padding:0 20px;">'.esc_html__('Getting started with our Cloud Backup service is simple.', 'wpdbbkp').'</h2>'; ?> | |
| 1132 | - | |
| 1133 | - <ul style="list-style-type: style;"> | |
| 1134 | - <li style="margin-left: 30px;"><?php echo esc_html__('Sign up for a free account at', 'wpdbbkp'); ?> <a href="https://backupforwp.com/register" target="_blank"><?php echo esc_html__(' Cloud Backup ', 'wpdbbkp');?> </a><?php echo esc_html__('by Backup for WP', 'wpdbbkp');?></li> | |
| 1135 | - <li style="margin-left: 30px;"><?php echo esc_html__('Add the website url', 'wpdbbkp'); ?> <a href="https://app.backupforwp.com/websites" target="_blank"><?php echo esc_html__('Add Website here', 'wpdbbkp');?> </a></li> | |
| 1136 | - <li style="margin-left: 30px;"><?php echo esc_html__('API token will be generated on adding website.', 'wpdbbkp'); ?></li> | |
| 1137 | - <li style="margin-left: 30px;"><?php echo esc_html__('Copy the token here and Click Save.', 'wpdbbkp'); ?></li> | |
| 1138 | - <li style="margin-left: 30px;"><b><?php echo esc_html__('You can see your backup files from ', 'wpdbbkp'); ?><a href="https://app.backupforwp.com/dashboard/" target="_blank"><?php echo esc_html__('here', 'wpdbbkp');?> </a></b></li> | |
| 1139 | - </ul> | |
| 897 | + <div class="fe-2"> | |
| 898 | + <div class="fe-t"> | |
| 899 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 900 | + <h4><?php esc_html_e('Fast, personal support','wpdbbkp'); ?></h4> | |
| 901 | + </div> | |
| 902 | + <p><?php esc_html_e('Provides expert help and support from the developers whenever you need it.','wpdbbkp'); ?></p> | |
| 903 | + </div> | |
| 904 | + <div class="fe-2"> | |
| 905 | + <div class="fe-t"> | |
| 906 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 907 | + <h4><?php esc_html_e('Continuous Updates','wpdbbkp'); ?></h4> | |
| 908 | + </div> | |
| 909 | + <p><?php esc_html_e('We\'re continuously updating our premium features and releasing them.','wpdbbkp'); ?></p> | |
| 910 | + </div> | |
| 911 | + <div class="fe-2"> | |
| 912 | + <div class="fe-t"> | |
| 913 | + <img src="<?php echo WPDB_PLUGIN_URL;?>/assets/images/right-tick.png" alt="right-tick"> | |
| 914 | + <h4><?php esc_html_e('Documentation','wpdbbkp'); ?></h4> | |
| 915 | + </div> | |
| 916 | + <p><?php esc_html_e('We create tutorials for every possible feature and keep it updated for you.','wpdbbkp'); ?></p> | |
| 917 | + </div> | |
| 918 | + </div><!-- /. fet --> | |
| 919 | + <div class="pr-btn"> | |
| 920 | + <a href="https://backupforwp.com/pricing/#pricings" target="_blank"><?php esc_html_e('Upgrade to Pro','wpdbbkp'); ?></a> | |
| 921 | + </div><!-- /. pr-btn --> | |
| 922 | + </div><!-- /. pr-fe --> | |
| 923 | + </div><!-- /.pr --> | |
| 924 | + </div><!-- /. pvf-cmp --> | |
| 925 | + </div><!-- /. pvf-cnt --> | |
| 926 | + | |
| 927 | + <div class="wpdbbkpfaq"> | |
| 928 | + <h2><?php esc_html_e('Frequently Asked Questions','wpdbbkp'); ?></h2> | |
| 929 | + <div class="faq-lst"> | |
| 930 | + <div class="lt"> | |
| 931 | + <ul> | |
| 932 | + <li> | |
| 933 | + <span><?php esc_html_e('Is there a setup fee?','wpdbbkp'); ?></span> | |
| 934 | + <p><?php esc_html_e('No. There are no setup fees on any of our plans','wpdbbkp'); ?></p> | |
| 935 | + </li> | |
| 936 | + <li> | |
| 937 | + <span><?php esc_html_e('What\'s the time span for your contracts?','wpdbbkp'); ?></span> | |
| 938 | + <p><?php esc_html_e('All the plans are year-to-year which are subscribed annually except for lifetime plan.','wpdbbkp'); ?></p> | |
| 939 | + </li> | |
| 940 | + <li> | |
| 941 | + <span><?php esc_html_e('What payment methods are accepted?','wpdbbkp'); ?></span> | |
| 942 | + <p><?php esc_html_e('We accepts PayPal and Credit Card payments.','wpdbbkp'); ?></p> | |
| 943 | + </li> | |
| 944 | + <li> | |
| 945 | + <span><?php esc_html_e('Do you offer support if I need help?','wpdbbkp'); ?></span> | |
| 946 | + <p><?php esc_html_e('Yes! Top-notch customer support for our paid customers is key for a quality product, so we\'ll do our very best to resolve any issues you encounter via our support page.','wpdbbkp'); ?></p> | |
| 947 | + </li> | |
| 948 | + <li> | |
| 949 | + <span><?php esc_html_e('Can I use the plugins after my subscription is expired?','wpdbbkp'); ?></span> | |
| 950 | + <p><?php esc_html_e('Yes, you can use the plugins, but you will not get future updates for those plugins.','wpdbbkp'); ?></p> | |
| 951 | + </li> | |
| 952 | + </ul> | |
| 953 | + </div> | |
| 954 | + <div class="rt"> | |
| 955 | + <ul> | |
| 956 | + <li> | |
| 957 | + <span><?php esc_html_e('Can I cancel my membership at any time?','wpdbbkp'); ?></span> | |
| 958 | + <p><?php esc_html_e('Yes. You can cancel your membership by contacting us.','wpdbbkp'); ?></p> | |
| 959 | + </li> | |
| 960 | + <li> | |
| 961 | + <span><?php esc_html_e('Can I change my plan later on?','wpdbbkp'); ?></span> | |
| 962 | + <p><?php esc_html_e('Yes. You can upgrade your plan by contacting us.','wpdbbkp'); ?></p> | |
| 963 | + </li> | |
| 964 | + <li> | |
| 965 | + <span><?php esc_html_e('Do you offer refunds?','wpdbbkp'); ?></span> | |
| 966 | + <p><?php esc_html_e('You are fully protected by our 100% Money-Back Guarantee Unconditional. If during the next 14 days you experience an issue that makes the plugin unusable, and we are unable to resolve it, we\'ll happily offer a full refund.','wpdbbkp'); ?></p> | |
| 967 | + </li> | |
| 968 | + <li> | |
| 969 | + <span><?php esc_html_e('Do I get updates for the premium plugin?','wpdbbkp'); ?></span> | |
| 970 | + <p><?php esc_html_e('Yes, you will get updates for all the premium plugins until your subscription is active.','wpdbbkp'); ?></p> | |
| 971 | + </li> | |
| 972 | + </ul> | |
| 973 | + </div> | |
| 974 | + </div><!-- /.faq-lst --> | |
| 975 | + </div><!-- /.faq --> | |
| 976 | + </div><!-- /. pvf --> | |
| 977 | + </div> | |
| 978 | + </div> | |
| 1140 | 979 | |
| 980 | + </div> | |
| 981 | + </div> | |
| 982 | + </div> | |
| 983 | + </div> | |
| 1141 | 984 | |
| 1142 | - <input type="hidden" name="wpdb_cd_s3" value="Y"> | |
| 1143 | - <input name="wpdbbackup_update_cd_setting" type="hidden" value="<?php echo esc_attr( wp_create_nonce( 'wpdbbackup-update-cd-setting' ) ); ?>" /> | |
| 1144 | - <?php wp_nonce_field( 'wp-database-backup' ); ?> | |
| 1145 | - <div class="row form-group"> | |
| 1146 | - <label class="col-sm-3" for="wpdb_clouddrive_token"><?php echo esc_html__('BackforWP API Token', 'wpdbbkp') ?></label> | |
| 1147 | - <div class="col-sm-6"> | |
| 1148 | 985 | |
| 1149 | - <input type="text" id="wpdb_clouddrive_token" class="form-control" name="wpdb_clouddrive_token" value="<?php echo esc_html( get_option( 'wpdb_clouddrive_token' ) ); ?>" size="25" placeholder="<?php esc_attr_e('26b18a624d2f5e01324bc81f90cfff63ba493bc15f00d790729fb437e90f54ea','wpdbbkp');?>"> | |
| 1150 | - <a href="https://app.backupforwp.com/websites" target="_blank"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> | |
| 1151 | - </div> | |
| 1152 | - </div> | |
| 1153 | - | |
| 1154 | - <p style="padding-left:20px"><input type="submit" name="Submit" class="btn btn-primary" value="<?php esc_attr_e( 'Save' , 'wpdbbkp' ); ?>" /> | |
| 1155 | - </p> | |
| 1156 | - </form> | |
| 1157 | - </div> | |
| 1158 | -</div> | |
| 1159 | - | |
| 1160 | - | |
| 1161 | -</div> | |
| 1162 | -<div class="tab-pane" id="db_migrate"> | |
| 1163 | - <ul class="nav nav-tabs"> | |
| 1164 | - <li class="msub-tab active" id="msub-tab-export" onclick="handleNavigateChildTab(event, 'export')" style="cursor:pointer"> | |
| 1165 | - <a href="#" data-toggle="tab"><?php echo esc_html__('Export', 'wpdbbkp') ?></a> | |
| 1166 | - </li> | |
| 1167 | - <li class="msub-tab" id="msub-tab-import" onclick="handleNavigateChildTab(event, 'import')" style="cursor:pointer"> | |
| 1168 | - <a href="#" data-toggle="tab"><?php echo esc_html__('Import', 'wpdbbkp') ?></a> | |
| 1169 | - </li> | |
| 1170 | - </ul> | |
| 1171 | - <?php | |
| 1172 | - $nonce = wp_create_nonce( 'wp-database-backup' ); | |
| 1173 | - $wp_db_backup_search_text = get_option( 'wp_db_backup_search_text' ); | |
| 1174 | - $wp_db_backup_replace_text = get_option( 'wp_db_backup_replace_text' ); | |
| 1175 | - ?> | |
| 1176 | - <div class="msub-tab-block" id="msub-tab-block-export" style="padding:20px;"> | |
| 1177 | - <div style="width: 500px;border: 5px dotted #204d74;margin: 0 auto;padding: 20px;border-radius: 10px; | |
| 1178 | -text-align: center;"> | |
| 1179 | - <?php | |
| 1180 | - $wpdbbkp_export_notify = get_option('wpdbbkp_export_notify',false); | |
| 1181 | - if($wpdbbkp_export_notify==false){ | |
| 1182 | - ?> | |
| 1183 | - <a href="#" id="wpdbbkp-create-full-export" class="btn btn-primary"> <span class="glyphicon glyphicon-plus-sign"></span> <?php echo esc_html__('Start Export', 'wpdbbkp');?></a> | |
| 1184 | - <?php }?> | |
| 1185 | - <div id="wpdb-export-process" style="display:none"> | |
| 1186 | - <div class="text-center"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL . "/assets/images/icon_loading.gif"); /* phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage */ ?>"> | |
| 1187 | - <h5 class="text-success"><strong><?php echo esc_html__('Import process is working in background, it may take some time depending on size of your | |
| 1188 | - website. You can close this tab if you want', 'wpdbbkp') ?></strong></h5> | |
| 1189 | - <div class="progress"> | |
| 1190 | - <div id="wpdbbkp_export_progressbar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" | |
| 1191 | - style="width:0%"> | |
| 1192 | - 0% | |
| 1193 | - </div> | |
| 1194 | - </div> | |
| 1195 | - <h4 class="text-success" id="wpdbbkup_export_process_stats"><?php echo esc_html__('Processing...', 'wpdbbkp') ?></h4> | |
| 1196 | - </div> | |
| 1197 | - </div> | |
| 1198 | - <?php | |
| 1199 | - | |
| 1200 | - if($wpdbbkp_export_notify){ | |
| 1201 | - ?> | |
| 1202 | - <div class="text-center wpdbbkp_notification"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL. "/assets/images/success.png"); /* phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage */ ?>"> | |
| 1203 | - <h4 class="text-success"> | |
| 1204 | - <?php if ($wpdbbkp_export_notify=='create') { | |
| 1205 | - $backup_link = false; | |
| 1206 | - $backup_list = get_option('wp_db_backup_backups'); | |
| 1207 | - if(!empty($backup_list) && is_array($backup_list)){ | |
| 1208 | - $download_backup = end($backup_list); | |
| 1209 | - if($download_backup && !empty($download_backup) && isset($download_backup['url'])) | |
| 1210 | - { | |
| 1211 | - $backup_link = '<a href="' . esc_url(admin_url('?wpdbbkp_download='.basename($download_backup['url']))) . '" style="color: #21759B;">' . __('Click here to Download', 'wpdbbkp') . '</a>'; | |
| 1212 | - } | |
| 1213 | - } | |
| 1214 | - update_option('wpdbbkp_export_notify',false); | |
| 1215 | - esc_html_e('Export Completed. ', 'wpdbbkp'); | |
| 1216 | - } | |
| 1217 | - ?> | |
| 1218 | - </h4> | |
| 1219 | - <?php if ($backup_link) { ?> | |
| 1220 | - <h5 class="text-success"><strong><?php echo wp_kses_post($backup_link); ?> </strong></h5> | |
| 1221 | - <?php } ?> | |
| 1222 | - </div> | |
| 1223 | - <?php }?> | |
| 1224 | - <p><?php echo esc_html__('If you like ','wpdbbkp');?> | |
| 1225 | - <b><?php echo esc_html__('WP Database Backup','wpdbbkp');?> </b> | |
| 1226 | - <?php echo esc_html__('please leave us a','wpdbbkp');?> | |
| 1227 | - <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-database-backup" title="Rating" sl-processed="1"> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <span class="glyphicon glyphicon-star" aria-hidden="true"></span> <?php echo esc_html__('rating','wpdbbkp');?> </a>. <?php echo esc_html__('Many thanks in advance!','wpdbbkp');?></p> | |
| 1228 | - </div> | |
| 1229 | - </div> | |
| 1230 | - <div class="msub-tab-block" id="msub-tab-block-import" style="padding:20px;display:none"> | |
| 1231 | - <div style="border: 5px dotted #5cb85c;margin: 0 auto;padding: 20px;border-radius: 10px; | |
| 1232 | -text-align: center;"> | |
| 1233 | - <input type="file" accept=".zip,.rar,.7zip" id="wpdbbkp-upload-import" style="display:none"y/> | |
| 1234 | - <a href="#" id="wpdbbkp-create-full-import" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> <?php echo esc_html__('Select File to Import', 'wpdbbkp');?></a> | |
| 1235 | - <a href="#" id="wpdbbkp-start-full-import" class="btn btn-success" style="display:none"> <span class="glyphicon glyphicon-plus-sign"></span> <?php echo esc_html__('Start Import', 'wpdbbkp');?></a> | |
| 1236 | - <a href="#" id="wpdbbkp-stop-full-import" class="btn btn-danger wpdbbkp-cancel-btn" style="display:none;margin-bottom: 20px;margin-left: 10px;" > <span class="glyphicon glyphicon-ban"></span><?php echo esc_html__('Stop Backup Process', 'wpdbbkp');?></a> | |
| 1237 | - <p style="font-weight: bold;font-size: 14px;margin-top: 5px;color:#5cb85c" id="imported-file-name"></p> | |
| 1238 | - | |
| 1239 | - <div id="wpdb-import-process" style="display:none"> | |
| 1240 | - <div class="text-center"><img width="50" height="50" src="<?php echo esc_url(WPDB_PLUGIN_URL . "/assets/images/icon_loading.gif"); /* phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage */ ?>"> | |
| 1241 | - <h5 class="text-success"><strong><?php echo esc_html__('Import process is working, it may take some time depending on size of import file.', 'wpdbbkp') ?></strong></h5> | |
| 1242 | - <div class="progress"> | |
| 1243 | - <div id="wpdbbkp_import_progressbar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" | |
| 1244 | - style="width:0%;text-align:center"> | |
| 1245 | - 0% | |
| 1246 | - </div> | |
| 1247 | - </div> | |
| 1248 | - <h4 class="text-success" id="wpdbbkup_import_process_stats" style="font-size:12px"><?php echo esc_html__('Processing...', 'wpdbbkp') ?></h4> | |
| 1249 | - </div> | |
| 1250 | - </div> | |
| 1251 | - <p><?php echo esc_html__('If you like ','wpdbbkp'); ?> <b> <?php echo esc_html__('WP Database Backup ','wpdbbkp'); ?></b> <?php echo esc_html__('please leave us a ','wpdbbkp'); ?><a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wp-database-backup" title="<?php echo esc_html__('Rating','wpdbbkp'); ?>" sl-processed="1"> | |
| 1252 | - <?php for($i=0;$i<5;$i++){?> | |
| 1253 | - <span class="glyphicon glyphicon-star" aria-hidden="true" style="color:#5cb85c"></span> | |
| 1254 | - <?php }?> | |
| 1255 | - <?php echo esc_html__('rating','wpdbbkp'); ?> </a>. <?php echo esc_html__('Many thanks in advance!','wpdbbkp'); ?></p> | |
| 1256 | - </div> | |
| 1257 | - </div> | |
| 1258 | -</div> | |
| 1259 | - | |
| 1260 | 986 | <div class="tab-pane" id="db_help"> |
| 1261 | 987 | <div class="panel-group "> |
| 1262 | 988 | <div class="gn-flex-container row"> |
| 1263 | 989 | <div class="wpdbbkp-left-side col-md-8"> |
| @@ -1267,9 +993,9 @@ | ||
| 1267 | 993 | <li> |
| 1268 | 994 | <label class="wpdbbkp-support-label"> <?php echo esc_html__('Email', 'wpdbbkp') ?> <span class="wpdbbkp-star-mark">*</span> |
| 1269 | 995 | </label> |
| 1270 | 996 | <div class="support-input"> |
| 1271 | - <input type="text" id="wpdbbkp_query_email" name="wpdbbkp_query_email" size="47" placeholder="<?php esc_attr_e('Enter your Email','wpdbbkp');?>" required=""> | |
| 997 | + <input type="text" id="wpdbbkp_query_email" name="wpdbbkp_query_email" size="47" placeholder="Enter your Email" required=""> | |
| 1272 | 998 | </div> |
| 1273 | 999 | </li> |
| 1274 | 1000 | <li> |
| 1275 | 1001 | <label class="wpdbbkp-support-label"> <?php echo esc_html__('Query', 'wpdbbkp') ?> <span class="wpdbbkp-star-mark">*</span> |
| @@ -1274,9 +1000,9 @@ | ||
| 1274 | 1000 | <li> |
| 1275 | 1001 | <label class="wpdbbkp-support-label"> <?php echo esc_html__('Query', 'wpdbbkp') ?> <span class="wpdbbkp-star-mark">*</span> |
| 1276 | 1002 | </label> |
| 1277 | 1003 | <div class="support-input"> |
| 1278 | - <textarea rows="5" cols="50" id="wpdbbkp_query_message" name="wpdbbkp_query_message" placeholder="<?php esc_attr_e('Write your query','wpdbbkp');?>"></textarea> | |
| 1004 | + <textarea rows="5" cols="50" id="wpdbbkp_query_message" name="wpdbbkp_query_message" placeholder="Write your query"></textarea> | |
| 1279 | 1005 | </div> |
| 1280 | 1006 | </li> |
| 1281 | 1007 | <li> |
| 1282 | 1008 | <button class="button button-primary wpdbbkp-send-query"> <?php echo esc_html__('Send Support Request', 'wpdbbkp') ?> </button> |
| @@ -1297,233 +1023,8 @@ | ||
| 1297 | 1023 | </div> |
| 1298 | 1024 | </div> |
| 1299 | 1025 | </div> |
| 1300 | 1026 | |
| 1301 | - <div class="tab-pane" id="db_upgrade"> | |
| 1302 | - <style> .fe-t h4,.fe-t img{vertical-align:middle}.pri-tb h5,.rcm{letter-spacing:2px}.ampfaq h4,.f-cnt,.pr-btn,.pri-tb,.wpdb-tlt,.tru-us,.upg-t,.wpdbbkp-feature,.wpdbbkp-hero{text-align:center}.f-cnt a,.pr-btn a,.pri-tb a,.tru-us a{text-decoration:none}.wpdbbkp-hero{background:#337ab7;color:#fff;padding:100px 20px 80px;position:relative}.wpdbbkp-hero::after{content:"";position:absolute;inset:0}.d-amt sup,.pri-lst .rec,.pri-tb,.pri-tb .amt sup,.wpdb,.wpdb-tlt span{position:relative}.wpdbbkp-hero-content{position:relative;z-index:1}.wpdbbkp-hero-content h1{font-size:48px;margin:0 0 20px}.wpdbbkp-hero-content p{font-size:18px;margin-bottom:30px}.wpdbbkp-btn{background:#7ed957;color:#fff;padding:14px 28px;font-size:16px;border:none;border-radius:25px;cursor:pointer}.wpdbbkp-features{display:flex!important;justify-content:space-around;padding:60px 20px;background:#f9f9f9;flex-wrap:wrap}.wpdbbkp-feature{max-width:300px;margin:20px}.wpdbbkp-feature-icon{font-size:40px;color:#8b5cf6;margin-bottom:15px}.wpdbbkp-feature h3{margin-bottom:10px;font-size:22px}.wpdbbkp-feature p{font-size:15px;color:#555}.ex-1 h4,.fe-2,.fr-fe,.upg-t{color:#222}.wpdb{top:-16px;border:1px solid #eee;padding-bottom:40px}.ext{display:grid;grid-template-columns:1fr 1fr 1fr;background:#f9f9f9;padding:45px 0 45px 25px}.wpdb-cnt,.wpdb-tlt span{display:inline-block}.ex-1{width:250px}.ampfaq,.fet,.pr-btn,.pri-lst,.wpdb-cnt,.wpdb-tlt{width:100%}.ex-1 h4{margin:15px 0 12px;font-size:18px;font-weight:500}.ex-1 p{font-size:14px;color:#555;font-weight:400;margin:0}.e-1 img{width:65px!important}.e-2 img{width:45px!important}.e-3 img{width:49px!important}.wpdb-tlt{margin:70px 0 60px}.wpdb-tlt h2{font-size:36px;line-height:1.4;color:#000;font-weight:500;margin:0}.wpdb-tlt span{font-size:16px;color:#000;margin-top:15px;top:4px}.wpdb-cmp{display:grid;grid-template-columns:1fr 2fr}.fr{border-right:1px solid #eee}.fr h1,.pr h1{font-size:36px;font-weight:700;line-height:1.5;border-bottom:1px solid #efefef;padding:0 0 20px 35px}.lt,.pr h1{padding-left:50px}.fr-fe{padding-top:10px}.fe-1{padding:22px 35px 35px}.fe-1 h4{margin:0 0 10px;font-size:20px;line-height:1.4;font-weight:400;color:#000}.fe-1 p{font-size:15px;line-height:1.4;margin:0;color:#333}.pr-fe{padding:34px 35px 35px}.pr-fe span{font-family:georgia;font-size:16px;font-weight:700;color:#000;font-style:italic;line-height:1.3}.fe-2 p,.fe-t h4{line-height:1.4;margin:0}.fet{display:grid;grid-template-columns:1fr 1fr;grid-gap:25px;margin-top:40px}.fe-t h4,.fe-t img,.pr-btn,.pr-btn a,.upg-t>span{display:inline-block}.fe-t img{width:22px!important}.fe-t h4{font-size:19px;color:#000;font-weight:400;padding-left:8px}.fe-2 p{font-size:15px;color:#555;padding-top:8px}.pr-btn{margin:50px 0 25px}.pr-btn a{color:#fff;padding:12px 35px 17px;border-radius:5px;font-size:28px;line-height:1.2;background:#eb3349;font-weight:600;margin-top:0;box-shadow:0 .15em .65em 0 rgba(0,0,0,.25)}.Backup for WP-upg{background:#f5f5f5;padding:60px 10px 0}.upg-t h2{margin:0;font-size:35px;color:#060606;line-height:1.3;font-weight:500}.pri-by,.pri-tb h5,.upg-t>span{line-height:1.2}.upg-t>span{font-size:14px;margin-top:15px;color:#666}.pri-lst{display:grid;grid-template-columns:1fr 1fr 1fr 1fr 1fr;margin-top:70px;grid-gap:1px;box-shadow:0 10px 15px 1px #ddd}.pri-tb{background:#fff;border:1px solid #f9f9f9}.f-cnt a,.pri-by{background:#333;display:inline-block}.pri-tb:hover{border:1px solid #489bff}.pri-lst .rec .pri-by,.pri-tb a:hover .pri-by{background:#1e8fff}.pri-tb a{display:inline-block;color:#222;padding:20px 12px}.pri-tb h5{margin:0 0 20px;font-size:13px;font-weight:400;color:#000}.pri-by,.pri-tb .amt,.pri-tb .d-amt,.pri-tb .s-amt,.tru-us h2{font-weight:500}.pri-tb span{display:inline-block}.pri-tb .amt{font-size:40px;margin-bottom:20px;display:block}.pri-tb .d-amt{font-size:24px;color:#666;margin-bottom:15px;display:none;text-decoration:line-through}.d-amt sup{line-height:0;top:7px}.pri-tb .s-amt{font-size:13px;color:#4caf50;margin-bottom:10px;display:block}.pri-tb .amt sup{font-size:22px;padding:0 4px 0 0;top:7px}.pri-tb .bil{color:#aaa;font-size:12px;margin-bottom:20px}.pri-tb .e,.pri-tb .f,.pri-tb .s{font-size:14px;margin-bottom:15px;color:#3b4750}.pri-tb .sv{font-size:12px;color:#fff;background:#4caf50;margin:0 auto;padding:1px 7px 2px;border-radius:45px;display:none}.pri-by{font-size:15px;border-radius:2px;padding:9px 18px 10px;color:#fff;margin-top:29px}.pri-lst .rec{box-shadow:0 1px 40px 0 #ccc;background:#fff;z-index:9;margin-top:-20px}.pri-lst .rec:hover .rcm{background:#e04371;color:#fff}.rcm{background:#dedede;color:#888;position:absolute;top:-20px;left:0;right:-1px;bottom:auto;padding:2px 0;font-size:11px}.tru-us{padding:60px 0;margin:0 auto;font-size:16px;color:#222}.tru-us h2{margin:20px 0 0;font-size:28px}.tru-us p{font-size:17px;margin:19px 15% 18px;color:#666;line-height:29px}.tru-us a{font-size:18px;color:#489bff;font-weight:400}.ampfaq h4,.f-cnt a,.f-cnt span{font-weight:500}.ampfaq{margin:25px 0}.ampfaq h4{margin:0;font-size:20px;color:#333}.faq-lst{margin-top:50px;display:grid;grid-template-columns:1fr 1fr}.lt,.rt{width:70%}.lt ul,.rt ul{margin:0}.lt ul li,.rt ul li{color:#222;margin-bottom:30px!important}.lt span,.rt span{font-size:17px;font-weight:500;margin-bottom:6px;display:inline-block}.lt p,.rt p{font-size:15px;margin:0}.f-cnt{margin-top:20px;color:#222}.f-cnt span{font-size:17px;margin:8px 0}.f-cnt p{font-size:15px;margin:6px 0}.faq-lst li span,h4{font-weight:600}.f-cnt a{color:#fff;padding:15px 30px;font-size:18px;margin-top:15px}@media (max-width:1366px){.Backup for WP-upg{padding:60px 0 0}}@media (max-width:768px){.ext,.faq-lst,.wpdb-cmp{grid-template-columns:1fr}.ext{grid-gap:30px 0px;padding:30px}.wpdb-tlt h2{font-size:26px}.pr-btn a{font-size:22px}.pri-lst{grid-template-columns:1fr 1fr 1fr}.ex-1{width:100%}.rt{padding-left:50px}} | |
| 1303 | - .wpdbbkp-hero-content a {color:#fff;font-size:24px;font-weight:500;text-decoration:none}.wpdbbkp-hero-content a:hover{color:#fff;text-decoration:underline}.wpdbbkp-hero-content h1{font-size:48px;margin:0 0 20px}.wpdbbkp-hero-content p{font-size:18px;margin-bottom:30px}.wpdbbkp-btn a{color:#fff;text-decoration:none}.wpdbbkp-btn a:hover{color:#fff;text-decoration:underline}.wpdb-tlt h3{font-weight: bold;}.wpdb-tlt{color:#000;} | |
| 1304 | - </style> | |
| 1305 | - <div class="panel-group "> | |
| 1306 | - <div class="wpdb"> | |
| 1307 | - <div class="wpdb-cnt"> | |
| 1308 | - <div class="wpdb-tlt"> | |
| 1309 | - <h1>Upgrade for Unlimited Storage</h1> | |
| 1310 | - <h3>Compare Pro vs. Free Version</h3> | |
| 1311 | - <span>See what you'll get with the professional version</span> | |
| 1312 | - </div> | |
| 1313 | - <div class="wpdb-cmp"> | |
| 1314 | - <div class="fr"> | |
| 1315 | - <h1>FREE</h1> | |
| 1316 | - <div class="fr-fe"> | |
| 1317 | - <div class="fe-1"> | |
| 1318 | - <h4>Continuous Development</h4> | |
| 1319 | - <p>We take bug reports and feature requests seriously. We're continuously developing & improving this product for the last 2 years with passion and love.</p> | |
| 1320 | - </div> | |
| 1321 | - <div class="fe-1"> | |
| 1322 | - <h4>50+ Features</h4> | |
| 1323 | - <p>We're constantly expanding the plugin and make it more useful. We have wide variety of features which will fit any use-case.</p> | |
| 1324 | - </div> | |
| 1325 | - <div class="fe-1"> | |
| 1326 | - <h4>Technical Support</h4> | |
| 1327 | - <p>We have a full time team which helps you with each and every issue regarding Backup for WP.</p> | |
| 1328 | - </div> | |
| 1329 | - </div><!-- /. fr-fe --> | |
| 1330 | - </div><!-- /. fr --> | |
| 1331 | - <div class="pr"> | |
| 1332 | - <h1>PRO</h1> | |
| 1333 | - <div class="pr-fe"> | |
| 1334 | - <span>Everything in Free, and:</span> | |
| 1335 | - <div class="fet"> | |
| 1336 | - <div class="fe-2"> | |
| 1337 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1338 | - <h4>Unlimited Backup<sup>*</sup></h4> | |
| 1339 | - </div> | |
| 1340 | - <p>Unlimited Storage for your websites</p> | |
| 1341 | - </div> | |
| 1342 | - <div class="fe-2"> | |
| 1343 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1344 | - <h4>Secure and reliable</h4> | |
| 1345 | - </div> | |
| 1346 | - <p>We follow industry-best practices to safeguard against unauthorized access, corruption, and loss</p> | |
| 1347 | - </div> | |
| 1348 | - <div class="fe-2"> | |
| 1349 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1350 | - <h4>High availability</h4> | |
| 1351 | - </div> | |
| 1352 | - <p>Our system is built on a globally distributed cloud infrastructure with 99% uptime</p> | |
| 1353 | - </div> | |
| 1354 | - | |
| 1355 | - | |
| 1356 | - <div class="fe-2"> | |
| 1357 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1358 | - <h4>Dedicated Support</h4> | |
| 1359 | - </div> | |
| 1360 | - <p>With a Dedicated person helping you with the extension setup and questions.</p> | |
| 1361 | - </div> | |
| 1362 | - <div class="fe-2"> | |
| 1363 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1364 | - <h4>Continious Updates</h4> | |
| 1365 | - </div> | |
| 1366 | - <p>We're continiously updating our premium features and releasing them.</p> | |
| 1367 | - </div> | |
| 1368 | - <div class="fe-2"> | |
| 1369 | - <div class="fe-t"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/right-tick.png'); ?>" /> | |
| 1370 | - <h4>Innovation</h4> | |
| 1371 | - </div> | |
| 1372 | - <p>Be the first one to get the innovative features that we build in the future.</p> | |
| 1373 | - </div> | |
| 1374 | - </div><!-- /. fet --> | |
| 1375 | - <div class="pr-btn"> | |
| 1376 | - <a href="#upgrade">Upgrade to Pro</a> | |
| 1377 | - </div><!-- /. pr-btn --> | |
| 1378 | - </div><!-- /. pr-fe --> | |
| 1379 | - </div><!-- /.pr --> | |
| 1380 | - </div><!-- /. wpdb-cmp --> | |
| 1381 | - </div><!-- /. wpdb-cnt --> | |
| 1382 | - <div id="upgrade" class="Backup for WP-upg"> | |
| 1383 | - <div class="upg-t"> | |
| 1384 | - <h2>Let's Get Your Backups Ready</h2> | |
| 1385 | - <span>Choose your plan and upgrade in minutes!</span> | |
| 1386 | - </div> | |
| 1387 | - <div class="pri-lst"> | |
| 1388 | - <div class="pri-tb"> | |
| 1389 | - <a href="https://backupforwp.com/checkout?edd_action=add_to_cart&download_id=1123&edd_options[price_id]=1"> | |
| 1390 | - <h5>PERSONAL</h5> | |
| 1391 | - <span class="d-amt"><sup>$</sup>49</span> | |
| 1392 | - <span class="amt"><sup>$</sup>49</span> | |
| 1393 | - <span class="s-amt">(Save $59)</span> | |
| 1394 | - <span class="bil">Billed Annually</span> | |
| 1395 | - <span class="s">1 Site License</span> | |
| 1396 | - <span class="e">E-mail support</span> | |
| 1397 | - <span class="f">Pro Features</span> | |
| 1398 | - <span class="sv">Save $800+</span> | |
| 1399 | - <span class="pri-by">Buy Now</span> | |
| 1400 | - </a> | |
| 1401 | - </div> | |
| 1402 | - <div class="pri-tb rec"> | |
| 1403 | - <a href="https://backupforwp.com/checkout?edd_action=add_to_cart&download_id=1123&edd_options[price_id]=2"> | |
| 1404 | - <h5>MULTIPLE</h5> | |
| 1405 | - <span class="d-amt"><sup>$</sup>99</span> | |
| 1406 | - <span class="amt"><sup>$</sup>99</span> | |
| 1407 | - <span class="s-amt">(Save $79)</span> | |
| 1408 | - <span class="bil">Billed Annually</span> | |
| 1409 | - <span class="s">3 Site License</span> | |
| 1410 | - <span class="e">E-mail support</span> | |
| 1411 | - <span class="f">Pro Features</span> | |
| 1412 | - <span class="sv">Save 55%</span> | |
| 1413 | - <span class="pri-by">Buy Now</span> | |
| 1414 | - <span class="rcm">RECOMMENDED</span> | |
| 1415 | - </a> | |
| 1416 | - </div> | |
| 1417 | - <div class="pri-tb"> | |
| 1418 | - <a href="https://backupforwp.com/checkout?edd_action=add_to_cart&download_id=1123&edd_options[price_id]=3"> | |
| 1419 | - <h5>WEBMASTER</h5> | |
| 1420 | - <span class="d-amt"><sup>$</sup>199</span> | |
| 1421 | - <span class="amt"><sup>$</sup>199</span> | |
| 1422 | - <span class="s-amt">(Save $99)</span> | |
| 1423 | - <span class="bil">Billed Annually</span> | |
| 1424 | - <span class="s">10 Site License</span> | |
| 1425 | - <span class="e">E-mail support</span> | |
| 1426 | - <span class="f">Pro Features</span> | |
| 1427 | - <span class="sv">Save 83%</span> | |
| 1428 | - <span class="pri-by">Buy Now</span> | |
| 1429 | - </a> | |
| 1430 | - </div> | |
| 1431 | - <div class="pri-tb"> | |
| 1432 | - <a href="https://backupforwp.com/checkout?edd_action=add_to_cart&download_id=1123&edd_options[price_id]=4"> | |
| 1433 | - <h5>FREELANCER</h5> | |
| 1434 | - <span class="d-amt"><sup>$</sup>299</span> | |
| 1435 | - <span class="amt"><sup>$</sup>299</span> | |
| 1436 | - <span class="s-amt">(Save $119)</span> | |
| 1437 | - <span class="bil">Billed Annually</span> | |
| 1438 | - <span class="s">25 Site License</span> | |
| 1439 | - <span class="e">E-mail support</span> | |
| 1440 | - <span class="f">Pro Features</span> | |
| 1441 | - <span class="sv">Save 90%</span> | |
| 1442 | - <span class="pri-by">Buy Now</span> | |
| 1443 | - </a> | |
| 1444 | - </div> | |
| 1445 | - <div class="pri-tb"> | |
| 1446 | - <a href="https://backupforwp.com/checkout?edd_action=add_to_cart&download_id=1123&edd_options[price_id]=5"> | |
| 1447 | - <h5>AGENCY</h5> | |
| 1448 | - <span class="d-amt"><sup>$</sup>499</span> | |
| 1449 | - <span class="amt"><sup>$</sup>499</span> | |
| 1450 | - <span class="s-amt">(Save $199)</span> | |
| 1451 | - <span class="bil">Billed Annually</span> | |
| 1452 | - <span class="s">Unlimited</span> | |
| 1453 | - <span class="e">E-mail support</span> | |
| 1454 | - <span class="f">Pro Features</span> | |
| 1455 | - <span class="sv">UNLIMITED</span> | |
| 1456 | - <span class="pri-by">Buy Now</span> | |
| 1457 | - </a> | |
| 1458 | - </div> | |
| 1459 | - </div><!-- /.pri-lst --> | |
| 1460 | - <div class="tru-us"><img src="<?php echo esc_url(WPDB_PLUGIN_URL.'/assets/images/rating.png'); ?>" /> | |
| 1461 | - | |
| 1462 | - <h2>Trusted by more that 30000+ Users!</h2> | |
| 1463 | - <p>More than 30k Websites, Blogs & E-Commerce website are powered by our Backup for WP making it the #1 Rated Backup for WP plugin in WordPress Community.</p> | |
| 1464 | - <a href="https://wordpress.org/support/plugin/wp-database-backup/reviews" target="_blank">Read The Reviews</a> | |
| 1465 | - </div> | |
| 1466 | - </div><!--/ .Backup for WP-upg --> | |
| 1467 | - <div class="ampfaq"> | |
| 1468 | - <h4>Frequently Asked Questions</h4> | |
| 1469 | - <div class="faq-lst"> | |
| 1470 | - <div class="lt"> | |
| 1471 | - <ul> | |
| 1472 | - <li> | |
| 1473 | - <span>Is there a setup fee?</span> | |
| 1474 | - <p>No. There are no setup fees on any of our plans</p> | |
| 1475 | - </li> | |
| 1476 | - <li> | |
| 1477 | - <span>What's the time span for your contracts?</span> | |
| 1478 | - <p>All the plans are year-to-year which are subscribed annually.</p> | |
| 1479 | - </li> | |
| 1480 | - <li> | |
| 1481 | - <span>What payment methods are accepted?</span> | |
| 1482 | - <p>We accepts PayPal and Credit Card payments.</p> | |
| 1483 | - </li> | |
| 1484 | - <li> | |
| 1485 | - <span>Do you offer support if I need help?</span> | |
| 1486 | - <p>Yes! Top-notch customer support for our paid customers is key for a quality product, so we’ll do our very best to resolve any issues you encounter via our support page.</p> | |
| 1487 | - </li> | |
| 1488 | - <li> | |
| 1489 | - <span>Can I use the plugins after my subscription is expired?</span> | |
| 1490 | - <p>Yes, you can use the plugins but you will not get future updates for those plugins.</p> | |
| 1491 | - </li> | |
| 1492 | - </ul> | |
| 1493 | - </div> | |
| 1494 | - <div class="rt"> | |
| 1495 | - <ul> | |
| 1496 | - <li> | |
| 1497 | - <span>Can I cancel my membership at any time?</span> | |
| 1498 | - <p>Yes. You can cancel your membership by contacting us.</p> | |
| 1499 | - </li> | |
| 1500 | - <li> | |
| 1501 | - <span>Can I change my plan later on?</span> | |
| 1502 | - <p>Yes. You can upgrade or downgrade your plan by contacting us.</p> | |
| 1503 | - </li> | |
| 1504 | - <li> | |
| 1505 | - <span>Do you offer refunds?</span> | |
| 1506 | - <p>You are fully protected by our 100% Money Back Guarantee Unconditional. If during the next 14 days you experience an issue that makes the plugin unusable and we are unable to resolve it, we’ll happily offer a full refund.</p> | |
| 1507 | - </li> | |
| 1508 | - <li> | |
| 1509 | - <span>Do I get updates for the premium plugin?</span> | |
| 1510 | - <p>Yes, you will get updates for all the premium plugins until your subscription is active.</p> | |
| 1511 | - </li> | |
| 1512 | - </ul> | |
| 1513 | - </div> | |
| 1514 | - </div><!-- /.faq-lst --> | |
| 1515 | - <div class="f-cnt"> | |
| 1516 | - <span>I have other pre-sale questions, can you help?</span> | |
| 1517 | - <p>All the plans are year-to-year which are subscribed annually.</p> | |
| 1518 | - <a href="https://backupforwp.com/contact/?utm_medium=freevspro&utm_campaign=Plugin" target="_blank"> Contact a Human</a> | |
| 1519 | - </div><!-- /.f-cnt --> | |
| 1520 | - </div><!-- /.faq --> | |
| 1521 | - </div><!-- /. wpdb --> | |
| 1522 | - </div> | |
| 1523 | - | |
| 1524 | - </div> | |
| 1525 | - | |
| 1526 | 1027 | <div class="tab-pane" id="db_info"> |
| 1527 | 1028 | |
| 1528 | 1029 | <div class="panel panel-group panel-default"> |
| 1529 | 1030 | <div class="panel-heading"> |
| @@ -1528,9 +1029,9 @@ | ||
| 1528 | 1029 | <div class="panel panel-group panel-default"> |
| 1529 | 1030 | <div class="panel-heading"> |
| 1530 | 1031 | <a class="toggle_anchor" data-toggle="collapse" data-parent="#accordion" href="#collapsedb"> |
| 1531 | 1032 | <h4 class="panel-title"> |
| 1532 | - <?php esc_attr_e( 'System Check', 'wpdbbkp' ); ?> | |
| 1033 | + <?php esc_attr_e( 'System Check', 'wpdbbk' ); ?> | |
| 1533 | 1034 | </h4> |
| 1534 | 1035 | </a> |
| 1535 | 1036 | </div> |
| 1536 | 1037 | <div id="collapsedb" class="panel-collapse collapse in"> |
| @@ -1537,9 +1038,8 @@ | ||
| 1537 | 1038 | <div class="panel-body list-group"> |
| 1538 | 1039 | |
| 1539 | 1040 | <div class="row list-group-item"> |
| 1540 | 1041 | <?php |
| 1541 | - $df = $dt = $dp = $du = 'NA'; | |
| 1542 | 1042 | if(function_exists('disk_free_space')){ |
| 1543 | 1043 | /* get disk space free (in bytes) */ |
| 1544 | 1044 | $df = disk_free_space( WPDB_ROOTPATH ); |
| 1545 | 1045 | /* and get disk space total (in bytes) */ |
| @@ -1546,11 +1046,9 @@ | ||
| 1546 | 1046 | $dt = disk_total_space( WPDB_ROOTPATH ); |
| 1547 | 1047 | /* now we calculate the disk space used (in bytes) */ |
| 1548 | 1048 | $du = $dt - $df; |
| 1549 | 1049 | /* percentage of disk used - this will be used to also set the width % of the progress bar */ |
| 1550 | - if($dt>0){ | |
| 1551 | - $dp = sprintf( '%.2f', ( $du / $dt ) * 100 ); | |
| 1552 | - } | |
| 1050 | + $dp = sprintf( '%.2f', ( $du / $dt ) * 100 ); | |
| 1553 | 1051 | $dp = isset( $dp )? $dp : 'NA'; |
| 1554 | 1052 | /* and we formate the size from bytes to MB, GB, etc. */ |
| 1555 | 1053 | $df = $this->wp_db_backup_format_bytes( $df ); |
| 1556 | 1054 | $du = $this->wp_db_backup_format_bytes( $du ); |
| @@ -1555,14 +1053,14 @@ | ||
| 1555 | 1053 | $df = $this->wp_db_backup_format_bytes( $df ); |
| 1556 | 1054 | $du = $this->wp_db_backup_format_bytes( $du ); |
| 1557 | 1055 | $dt = $this->wp_db_backup_format_bytes( $dt ); |
| 1558 | 1056 | } |
| 1559 | - | |
| 1057 | + $du=$dp=$df=$dt='NA'; | |
| 1560 | 1058 | ?> |
| 1561 | 1059 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1562 | 1060 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1563 | 1061 | </div> |
| 1564 | - <div class="col-md-12">Disk Space</div> | |
| 1062 | + <div class="col-md-3">Disk Space</div> | |
| 1565 | 1063 | <div class="col-md-5"> |
| 1566 | 1064 | <div class="progress"> |
| 1567 | 1065 | <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo esc_attr( trim( $dp ) ); ?>" aria-valuemin="0" aria-valuemax="100" style="width:<?php echo esc_attr( trim( $dp ) ); ?>%"> <?php echo esc_attr( $dp ); ?>% |
| 1568 | 1066 | </div> |
| @@ -1631,18 +1129,13 @@ | ||
| 1631 | 1129 | <div class="row list-group-item"> |
| 1632 | 1130 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1633 | 1131 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1634 | 1132 | </div> |
| 1635 | - <div class="col-md-3"><?php esc_attr_e( 'Upload directory URL', 'wpdbbkp' ); ?></div> | |
| 1133 | + <div class="col-md-3"><?php esc_attr_e( 'Upload directory URL', 'wpdbbk' ); ?></div> | |
| 1636 | 1134 | <div class="col-md-5"> |
| 1637 | 1135 | <?php |
| 1638 | 1136 | $upload_dir = wp_upload_dir(); |
| 1639 | - echo esc_url( $upload_dir['baseurl'] ); | |
| 1640 | - global $wp_filesystem; | |
| 1641 | - if(!function_exists('WP_Filesystem')){ | |
| 1642 | - require_once ( ABSPATH . '/wp-admin/includes/file.php' ); | |
| 1643 | - } | |
| 1644 | - WP_Filesystem(); | |
| 1137 | + echo esc_url( $upload_dir['baseurl'] ) | |
| 1645 | 1138 | ?> |
| 1646 | 1139 | </div> |
| 1647 | 1140 | <div class="col-md-3"></div> |
| 1648 | 1141 | </div> |
| @@ -1650,14 +1143,14 @@ | ||
| 1650 | 1143 | <div class="row list-group-item"> |
| 1651 | 1144 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1652 | 1145 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1653 | 1146 | </div> |
| 1654 | - <div class="col-md-3"><?php esc_attr_e( 'Upload directory', 'wpdbbkp' ); ?></div> | |
| 1147 | + <div class="col-md-3"><?php esc_attr_e( 'Upload directory', 'wpdbbk' ); ?></div> | |
| 1655 | 1148 | <div class="col-md-5"><?php echo esc_attr( $upload_dir['basedir'] ); ?></div> |
| 1656 | 1149 | <div class="col-md-1"> |
| 1657 | 1150 | <?php echo esc_attr( substr( sprintf( '%o', fileperms( $upload_dir['basedir'] ) ), -4 ) ); ?></div> |
| 1658 | 1151 | <div |
| 1659 | - class="col-md-2"><?php echo ( ! $wp_filesystem->is_writable( $upload_dir['basedir']) ) ? '<p class="text-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Not writable </p>' : '<p class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> writable</p>'; ?> | |
| 1152 | + class="col-md-2"><?php echo ( ! is_writable( $upload_dir['basedir'] ) ) ? '<p class="text-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Not writable </p>' : '<p class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> writable</p>'; ?> | |
| 1660 | 1153 | </div> |
| 1661 | 1154 | </div> |
| 1662 | 1155 | |
| 1663 | 1156 | <div class="row list-group-item"> |
| @@ -1675,9 +1168,10 @@ | ||
| 1675 | 1168 | <div class="col-md-5"> |
| 1676 | 1169 | <?php |
| 1677 | 1170 | echo esc_attr( WP_MEMORY_LIMIT ); |
| 1678 | 1171 | echo '(Max ' . esc_attr( WP_MAX_MEMORY_LIMIT ); |
| 1679 | - ?> ) | |
| 1172 | + ?> | |
| 1173 | + ) | |
| 1680 | 1174 | </div> |
| 1681 | 1175 | </div> |
| 1682 | 1176 | |
| 1683 | 1177 | |
| @@ -1684,9 +1178,9 @@ | ||
| 1684 | 1178 | <div class="row list-group-item"> |
| 1685 | 1179 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1686 | 1180 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1687 | 1181 | </div> |
| 1688 | - <div class="col-md-3"><?php esc_attr_e( 'Max Execution Time', 'wpdbbkp' ); ?></div> | |
| 1182 | + <div class="col-md-3"><?php esc_attr_e( 'Max Execution Time', 'wpdbbk' ); ?></div> | |
| 1689 | 1183 | <div class="col-md-5"> <?php echo esc_attr( ini_get( 'max_execution_time' ) ); ?></div> |
| 1690 | 1184 | <div class="col-md-1"></div> |
| 1691 | 1185 | <div |
| 1692 | 1186 | class="col-md-2"><?php echo esc_attr( ini_get( 'max_execution_time' ) ) < 60 ? '<p class="text-danger" data-toggle="tooltip" data-placement="left" title="For large site set high"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Low </p>' : ''; ?></div> |
| @@ -1694,15 +1188,15 @@ | ||
| 1694 | 1188 | <div class="row list-group-item"> |
| 1695 | 1189 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1696 | 1190 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1697 | 1191 | </div> |
| 1698 | - <div class="col-md-3"><?php esc_attr_e( 'Database backup directory', 'wpdbbkp' ); ?></div> | |
| 1192 | + <div class="col-md-3"><?php esc_attr_e( 'Database backup directory', 'wpdbbk' ); ?></div> | |
| 1699 | 1193 | <div |
| 1700 | 1194 | class="col-md-5"> <?php echo esc_attr( $upload_dir['basedir'] . '/db-backup' ); ?></div> |
| 1701 | 1195 | <div |
| 1702 | 1196 | class="col-md-1"><?php echo esc_attr( substr( sprintf( '%o', @fileperms( esc_attr( $upload_dir['basedir'] ) . '/db-backup' ) ), -4 ) ); ?></div> |
| 1703 | 1197 | <div |
| 1704 | - class="col-md-2"><?php echo ( ! $wp_filesystem->is_writable( $upload_dir['basedir'] . '/db-backup' ) ) ? '<p class="text-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Not writable </p>' : '<p class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> writable</p>'; ?></div> | |
| 1198 | + class="col-md-2"><?php echo ( ! is_writable( $upload_dir['basedir'] . '/db-backup' ) ) ? '<p class="text-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Not writable </p>' : '<p class="text-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> writable</p>'; ?></div> | |
| 1705 | 1199 | </div> |
| 1706 | 1200 | |
| 1707 | 1201 | <div class="row list-group-item"> |
| 1708 | 1202 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| @@ -1707,9 +1201,9 @@ | ||
| 1707 | 1201 | <div class="row list-group-item"> |
| 1708 | 1202 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1709 | 1203 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1710 | 1204 | </div> |
| 1711 | - <div class="col-md-3"><?php esc_attr_e( 'Class ZipArchive Present : ', 'wpdbbkp' ); ?></div> | |
| 1205 | + <div class="col-md-3"><?php esc_attr_e( 'Class ZipArchive Present : ', 'wpdbbk' ); ?></div> | |
| 1712 | 1206 | <div class="col-md-5"> |
| 1713 | 1207 | <?php |
| 1714 | 1208 | echo ( class_exists( 'ZipArchive' ) ) ? 'Yes </p>' : '<p class="">No</p>'; |
| 1715 | 1209 | ?> |
| @@ -1720,9 +1214,9 @@ | ||
| 1720 | 1214 | <div class="row list-group-item"> |
| 1721 | 1215 | <div class="col-md-1"><a href="" target="_blank" title="Help"><span |
| 1722 | 1216 | class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></a> |
| 1723 | 1217 | </div> |
| 1724 | - <div class="col-md-3"><?php esc_attr_e( 'mysqldump (cmd) Present : ', 'wpdbbkp' ); ?></div> | |
| 1218 | + <div class="col-md-3"><?php esc_attr_e( 'mysqldump (cmd) Present : ', 'wpdbbk' ); ?></div> | |
| 1725 | 1219 | <div class="col-md-5"> |
| 1726 | 1220 | <?php |
| 1727 | 1221 | $wpdb_admin = new Wpdb_Admin(); |
| 1728 | 1222 | echo ( $wpdb_admin->get_mysqldump_command_path() ) ? 'Yes </p>' : '<p class="">No</p>'; |
| @@ -1820,9 +1314,9 @@ | ||
| 1820 | 1314 | $no++; |
| 1821 | 1315 | echo '<tr' . esc_attr( $style ) . '>'; |
| 1822 | 1316 | echo '<td>' . esc_attr( number_format_i18n( $no ) ) . '</td>'; |
| 1823 | 1317 | echo '<td>' . esc_attr( $tablestatus_arr['Name'] ) . '</td>'; |
| 1824 | - echo '<td>' . esc_attr( number_format_i18n( isset($tablestatus_arr['Rows'])?$tablestatus_arr['Rows']:0 ) ) . '</td>'; | |
| 1318 | + echo '<td>' . esc_attr( number_format_i18n( $tablestatus_arr['Rows'] ) ) . '</td>'; | |
| 1825 | 1319 | |
| 1826 | 1320 | $row_usage += $tablestatus_arr['Rows']; |
| 1827 | 1321 | |
| 1828 | 1322 | echo '</tr>'; |
| @@ -1899,17 +1393,14 @@ | ||
| 1899 | 1393 | <th><?php echo esc_html__('Version', 'wpdbbkp') ?></th> |
| 1900 | 1394 | </tr> |
| 1901 | 1395 | <?php |
| 1902 | 1396 | $plugins = get_plugins(); |
| 1903 | - if(!empty($plugins) && is_array($plugins)){ | |
| 1904 | - foreach ( $plugins as $plugin ) { | |
| 1905 | - echo '<tr> | |
| 1906 | - <td>' . esc_attr( $plugin['Name'] ) . '</td> | |
| 1907 | - <td>' . esc_attr( $plugin['Version'] ) . '</td> | |
| 1908 | - </tr>'; | |
| 1909 | - } | |
| 1397 | + foreach ( $plugins as $plugin ) { | |
| 1398 | + echo '<tr> | |
| 1399 | + <td>' . esc_attr( $plugin['Name'] ) . '</td> | |
| 1400 | + <td>' . esc_attr( $plugin['Version'] ) . '</td> | |
| 1401 | + </tr>'; | |
| 1910 | 1402 | } |
| 1911 | - | |
| 1912 | 1403 | ?> |
| 1913 | 1404 | </table> |
| 1914 | 1405 | <table class="table table-condensed"> |
| 1915 | 1406 | <tr class="success"> |
| @@ -1993,53 +1484,30 @@ | ||
| 1993 | 1484 | } else { |
| 1994 | 1485 | $checked = ''; |
| 1995 | 1486 | } |
| 1996 | 1487 | $wp_db_remove_local_backup = get_option( 'wp_db_remove_local_backup' ); |
| 1997 | - $wp_db_remove_on_uninstall = get_option( 'wp_db_remove_on_uninstall'); | |
| 1998 | - $wp_db_incremental_backup = get_option( 'wp_db_incremental_backup'); | |
| 1999 | - $wp_db_save_settings_in_backup = get_option( 'wp_db_save_settings_in_backup',1); | |
| 2000 | 1488 | if ( 1 === (int) $wp_db_remove_local_backup ) { |
| 2001 | 1489 | $remove_local_backup = 'checked'; |
| 2002 | 1490 | } else { |
| 2003 | 1491 | $remove_local_backup = ''; |
| 2004 | 1492 | } |
| 2005 | - if ( 1 === (int) $wp_db_remove_on_uninstall ) { | |
| 2006 | - $remove_on_uninstall = 'checked'; | |
| 2007 | - } else { | |
| 2008 | - $remove_on_uninstall = ''; | |
| 2009 | - } | |
| 2010 | - if ( 1 === (int) $wp_db_incremental_backup ) { | |
| 2011 | - $incremental_backup = 'checked'; | |
| 2012 | - } else { | |
| 2013 | - $incremental_backup = ''; | |
| 2014 | - } | |
| 2015 | - if ( 1 === (int) $wp_db_save_settings_in_backup ) { | |
| 2016 | - $save_on_backup = 'checked'; | |
| 2017 | - } else { | |
| 2018 | - $save_on_backup = ''; | |
| 2019 | - } | |
| 2020 | 1493 | ?> |
| 2021 | 1494 | <form action="" method="post"> |
| 2022 | 1495 | <?php wp_nonce_field( 'wp-database-backup' ); ?> |
| 2023 | 1496 | <div class="input-group"> |
| 2024 | 1497 | <span class="input-group-addon" id="sizing-addon2"><?php echo esc_html__('Maximum Local Backups', 'wpdbbkp') ?></span> |
| 2025 | - <input type="number" name="wp_local_db_backup_count" value="<?php echo esc_html( $wp_local_db_backup_count ); ?>" class="form-control" placeholder="<?php esc_attr_e('Maximum Local Backups','wpdbbkp');?>" aria-describedby="sizing-addon2"> | |
| 1498 | + <input type="number" name="wp_local_db_backup_count" value="<?php echo esc_html( $wp_local_db_backup_count ); ?>" class="form-control" placeholder="Maximum Local Backups" aria-describedby="sizing-addon2"> | |
| 2026 | 1499 | |
| 2027 | - </div><br> | |
| 2028 | - <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span><?php echo esc_html__(' The maximum | |
| 1500 | + </div> | |
| 1501 | + <div class="alert alert-default" role="alert"> | |
| 1502 | + <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span><?php echo esc_html__(' The maximum | |
| 2029 | 1503 | number of Local Database Backups that should be kept, regardless of their size.', 'wpdbbkp') ?></br> |
| 2030 | 1504 | <?php echo esc_html__('Leave blank for keep unlimited database backups.', 'wpdbbkp') ?> |
| 2031 | - </p> | |
| 2032 | - | |
| 1505 | + </div> | |
| 2033 | 1506 | <hr> |
| 2034 | 1507 | <div class="input-group"> |
| 2035 | 1508 | <label><input type="checkbox" <?php echo esc_attr( $checked ); ?> name="wp_db_log"> <?php echo esc_html__('Enable Log', 'wpdbbkp') ?></label> |
| 2036 | 1509 | </div> |
| 2037 | - <br> | |
| 2038 | - <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> | |
| 2039 | - <?php echo esc_html__(' Create a log file to record details of each backup operation. ', 'wpdbbkp') ?> | |
| 2040 | - </p> | |
| 2041 | - | |
| 2042 | 1510 | <hr> |
| 2043 | 1511 | <div class="input-group"> |
| 2044 | 1512 | <label><input type="checkbox" <?php echo esc_attr( $wp_db_backup_enable_auto_upgrade_checked ); ?> name="wp_db_backup_enable_auto_upgrade"> <?php echo esc_html__('Enable Auto Backups Before Upgrade', 'wpdbbkp') ?></label> |
| 2045 | 1513 | <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> |
| @@ -2051,37 +1519,19 @@ | ||
| 2051 | 1519 | <div class="input-group"> |
| 2052 | 1520 | <label><input type="checkbox" <?php echo esc_attr( $remove_local_backup ); ?> name="wp_db_remove_local_backup"> <?php echo esc_html__('Remove local backup', 'wpdbbkp') ?></label> |
| 2053 | 1521 | <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> |
| 2054 | 1522 | <?php echo esc_html__('If Checked then it will remove local backup.', 'wpdbbkp') ?> |
| 2055 | - <?php echo esc_html__('Use this option only when you have set any destination.', 'wpdbbkp') ?> | |
| 2056 | - <?php echo esc_html__('If somesites you need only external backup.', 'wpdbbkp') ?> | |
| 1523 | + <br><?php echo esc_html__('Use this option only when you have set any destination.', 'wpdbbkp') ?> | |
| 1524 | + <br><?php echo esc_html__('If somesites you need only external backup.', 'wpdbbkp') ?> | |
| 2057 | 1525 | </p> |
| 2058 | 1526 | </div> |
| 2059 | 1527 | <hr> |
| 2060 | - <div class="input-group"> | |
| 2061 | - <label><input type="checkbox" <?php echo esc_attr( $save_on_backup ); ?> name="wp_db_save_settings_in_backup"> <?php echo esc_html__('Skip plugin settings from database backup', 'wpdbbkp') ?></label> | |
| 2062 | - <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> | |
| 2063 | - <?php echo esc_html__('If Checked then it will skip Backup for WP plugin settings from the DB backup file .', 'wpdbbkp') ?> | |
| 2064 | - </p> | |
| 2065 | - </div> | |
| 2066 | - <hr> | |
| 2067 | - <div class="input-group"> | |
| 2068 | - <label><input type="checkbox" <?php echo esc_attr( $remove_on_uninstall ); ?> name="wp_db_remove_on_uninstall"> <?php echo esc_html__('Delete Data and options on uninstall', 'wpdbbkp') ?></label> | |
| 2069 | - <p><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> | |
| 2070 | - <?php echo esc_html__('If Checked then it will delete all backup files and options when plugin is uninstalled', 'wpdbbkp') ?> | |
| 2071 | - | |
| 2072 | - </p> | |
| 2073 | - </div> | |
| 2074 | - | |
| 2075 | 1528 | <?php |
| 2076 | 1529 | $remove_backup_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=removeallbackup&_wpnonce=' . esc_attr( $nonce ); ?> |
| 2077 | 1530 | |
| 2078 | 1531 | <div class="input-group"> |
| 2079 | - <a title="Remove Database Backup" onclick="return confirm('Are you sure you want to delete all the backups? Deleted backups can not be recovered.')" href="<?php echo esc_url($remove_backup_href)?>" class="btn btn-danger" style="margin-bottom:10px;"><span class="glyphicon glyphicon-trash"></span> <?php esc_html_e('Delete all Backups', 'wpdbbkp')?></a> | |
| 2080 | - <p> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> | |
| 2081 | - <?php echo esc_html__('Warning :This is will delete all the backups on the website. Once deleted backups can not be recovered.', 'wpdbbkp') ?> | |
| 2082 | - </p> | |
| 2083 | - | |
| 1532 | + <a title="Remove Database Backup" onclick="return confirm('Are you sure you want to delete all the backups? Deleted backups can not be recovered.')" href="<?php echo esc_url($remove_backup_href)?>" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> <?php esc_html_e('Delete all Backups', 'wpdbbkp')?></a> | |
| 1533 | + <br><?php echo esc_html__('Warning :This is will delete all the backups on the website. Once deleted backups can not be recovered.', 'wpdbbkp') ?> | |
| 2084 | 1534 | |
| 2085 | 1535 | </div> |
| 2086 | 1536 | <hr> |
| 2087 | 1537 | <div class="panel panel-default"> |
| @@ -2117,9 +1567,9 @@ | ||
| 2117 | 1567 | $no++; |
| 2118 | 1568 | echo '<tr' . esc_attr( $style ) . '>'; |
| 2119 | 1569 | echo '<td>' . esc_attr( number_format_i18n( $no ) ) . '</td>'; |
| 2120 | 1570 | echo '<td>' . esc_attr( $tablestatus_arr['Name'] ) . '</td>'; |
| 2121 | - echo '<td>' . esc_attr( number_format_i18n( isset($tablestatus_arr['Rows'])?$tablestatus_arr['Rows']:0 ) ) . '</td>'; | |
| 1571 | + echo '<td>' . esc_attr( number_format_i18n( $tablestatus_arr['Rows'] ) ) . '</td>'; | |
| 2122 | 1572 | if ( false === empty( $wp_db_exclude_table ) && in_array( $tablestatus_arr['Name'], $wp_db_exclude_table, true ) ) { |
| 2123 | 1573 | $checked = 'checked'; |
| 2124 | 1574 | } else { |
| 2125 | 1575 | $checked = ''; |
| @@ -2165,15 +1615,15 @@ | ||
| 2165 | 1615 | </p> |
| 2166 | 1616 | <br> |
| 2167 | 1617 | <div class="input-group"> |
| 2168 | 1618 | <span class="input-group-addon" id="wp_db_backup_search_text"><?php echo esc_html__('Search For', 'wpdbbkp') ?></span> |
| 2169 | - <input type="text" name="wp_db_backup_search_text" value="<?php echo esc_html( $wp_db_backup_search_text ); ?>" class="form-control" placeholder="<?php esc_attr_e('https://example.com/wordpress','wpdbbkp'); ?>" aria-describedby="wp_db_backup_search_text"> | |
| 1619 | + <input type="text" name="wp_db_backup_search_text" value="<?php echo esc_html( $wp_db_backup_search_text ); ?>" class="form-control" placeholder="http://localhost/wordpress" aria-describedby="wp_db_backup_search_text"> | |
| 2170 | 1620 | |
| 2171 | 1621 | </div> |
| 2172 | 1622 | <br> |
| 2173 | 1623 | <div class="input-group"> |
| 2174 | 1624 | <span class="input-group-addon" id="wp_db_backup_replace_text"><?php echo esc_html__('Replace With', 'wpdbbkp') ?></span> |
| 2175 | - <input type="text" name="wp_db_backup_replace_text" value="<?php echo esc_html( $wp_db_backup_replace_text ); ?>" class="form-control" placeholder="<?php esc_attr_e('http://site.com','wpdbbkp');?>" aria-describedby="wp_db_backup_replace_text"> | |
| 1625 | + <input type="text" name="wp_db_backup_replace_text" value="<?php echo esc_html( $wp_db_backup_replace_text ); ?>" class="form-control" placeholder="http://site.com" aria-describedby="wp_db_backup_replace_text"> | |
| 2176 | 1626 | |
| 2177 | 1627 | </div> |
| 2178 | 1628 | |
| 2179 | 1629 | <div class="alert alert-default" role="alert"> |
| @@ -2180,10 +1630,10 @@ | ||
| 2180 | 1630 | <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> |
| 2181 | 1631 | <?php echo esc_html__("Leave blank those fields if you don't want use this feature and want only regular Database backup.", 'wpdbbkp') ?> |
| 2182 | 1632 | <br> |
| 2183 | 1633 | <?php echo esc_html__('Ex:', 'wpdbbkp') ?> |
| 2184 | - <br><?php echo esc_html__('Search For:', 'wpdbbkp') ?> <?php echo esc_url('http://example.com/wordpress/', 'wpdbbkp'); ?> | |
| 2185 | - <br><?php echo esc_html__('Replace With:', 'wpdbbkp') ?> <?php echo esc_url('http://domain.com/', 'wpdbbkp') ?> | |
| 1634 | + <br><?php echo esc_html__('Search For:', 'wpdbbkp') ?> http://localhost/wordpress/ | |
| 1635 | + <br><?php echo esc_html__('Replace With:', 'wpdbbkp') ?> http://domain.com/ | |
| 2186 | 1636 | |
| 2187 | 1637 | <br><br> |
| 2188 | 1638 | <?php echo esc_html__('Note - This is Search & Replace data in your WordPress Database Backup File not in current Database installation.', 'wpdbbkp') ?> |
| 2189 | 1639 | |
| @@ -2220,9 +1670,9 @@ | ||
| 2220 | 1670 | * Redirect to premium website |
| 2221 | 1671 | */ |
| 2222 | 1672 | public function wp_db_backup_premium_interface_render() |
| 2223 | 1673 | { |
| 2224 | - wp_safe_redirect("https://backupforwp.com/pricing/#price"); | |
| 1674 | + wp_redirect("https://backupforwp.com/pricing/"); | |
| 2225 | 1675 | exit; |
| 2226 | 1676 | } |
| 2227 | 1677 | |
| 2228 | 1678 | /** |
| @@ -2247,79 +1697,63 @@ | ||
| 2247 | 1697 | global $wpdb; |
| 2248 | 1698 | /* BEGIN : Prevent saving backup plugin settings in the database dump */ |
| 2249 | 1699 | $options_backup = get_option( 'wp_db_backup_backups' ); |
| 2250 | 1700 | $settings_backup = get_option( 'wp_db_backup_options' ); |
| 2251 | - $wp_db_save_settings_in_backup = get_option( 'wp_db_save_settings_in_backup',1); | |
| 2252 | - if($wp_db_save_settings_in_backup){ | |
| 2253 | - delete_option( 'wp_db_backup_backups' ); | |
| 2254 | - delete_option( 'wp_db_backup_options' ); | |
| 2255 | - } | |
| 1701 | + delete_option( 'wp_db_backup_backups' ); | |
| 1702 | + delete_option( 'wp_db_backup_options' ); | |
| 2256 | 1703 | /* END : Prevent saving backup plugin settings in the database dump */ |
| 2257 | 1704 | $wp_db_exclude_table = array(); |
| 2258 | 1705 | $wp_db_exclude_table = get_option( 'wp_db_exclude_table' ); |
| 2259 | 1706 | $tables = $wpdb->get_col( 'SHOW TABLES' ); // phpcs:ignore |
| 2260 | 1707 | $output = ''; |
| 2261 | - if(!empty($tables) && !is_array($tables)){ | |
| 2262 | - foreach ( $tables as $table ) { | |
| 2263 | - if ( empty( $wp_db_exclude_table ) || ( ! ( in_array( $table, $wp_db_exclude_table, true ) ) ) ) { | |
| 2264 | - | |
| 2265 | - $check_count = $wpdb->get_var( "SELECT count(*) FROM {$table}"); // phpcs:ignore | |
| 2266 | - $check_count = intval($check_count); | |
| 2267 | - $sub_limit =500; | |
| 2268 | - if(isset($check_count) && $check_count>$sub_limit){ | |
| 2269 | - $result =array(); | |
| 2270 | - $t_sub_queries= ceil($check_count/$sub_limit); | |
| 2271 | - for($sub_i=0;$sub_i<$t_sub_queries;$sub_i++) | |
| 2272 | - { | |
| 2273 | - $sub_offset = $sub_i*$sub_limit; | |
| 2274 | - $sub_result = false; | |
| 2275 | - if ( false === $sub_result ) { | |
| 2276 | - // phpcs:ignore -- using direct query to get the data of table in chunks. | |
| 2277 | - $sub_result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$table} LIMIT %d OFFSET %d",array($sub_limit,$sub_offset)), ARRAY_A ); | |
| 2278 | - } | |
| 2279 | - | |
| 2280 | - if($sub_result){ | |
| 2281 | - $result = array_merge($result,$sub_result); | |
| 2282 | - } | |
| 2283 | - sleep(1); | |
| 1708 | + foreach ( $tables as $table ) { | |
| 1709 | + if ( empty( $wp_db_exclude_table ) || ( ! ( in_array( $table, $wp_db_exclude_table, true ) ) ) ) { | |
| 1710 | + | |
| 1711 | + $check_count = $wpdb->get_var( "SELECT count(*) FROM {$table}"); // phpcs:ignore | |
| 1712 | + $check_count = intval($check_count); | |
| 1713 | + $sub_limit =500; | |
| 1714 | + if(isset($check_count) && $check_count>$sub_limit){ | |
| 1715 | + $result =array(); | |
| 1716 | + $t_sub_queries= ceil($check_count/$sub_limit); | |
| 1717 | + for($sub_i=0;$sub_i<$t_sub_queries;$sub_i++) | |
| 1718 | + { | |
| 1719 | + $sub_offset = $sub_i*$sub_limit; | |
| 1720 | + $sub_result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM %i LIMIT %d OFFSET %d",array($table,$sub_limit,$sub_offset)), ARRAY_A ); | |
| 1721 | + if($sub_result){ | |
| 1722 | + $result = array_merge($result,$sub_result); | |
| 2284 | 1723 | } |
| 1724 | + sleep(1); | |
| 2285 | 1725 | } |
| 2286 | - else{ | |
| 2287 | - $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM {$table}"), ARRAY_A ); // phpcs:ignore | |
| 2288 | - } | |
| 2289 | - | |
| 2290 | - | |
| 2291 | - $row2 = $wpdb->get_row( 'SHOW CREATE TABLE ' . $table, ARRAY_N ); // phpcs:ignore | |
| 2292 | - $output .= "\n\n" . $row2[1] . ";\n\n"; | |
| 2293 | - $result_count = count( $result ); | |
| 2294 | - for ( $i = 0; $i < $result_count; $i++ ) { | |
| 2295 | - if(isset($result[ $i ])){ | |
| 2296 | - $row = $result[ $i ]; | |
| 2297 | - $output .= 'INSERT INTO ' . $table . ' VALUES('; | |
| 2298 | - $result_o_index = count( $result[0] ); | |
| 2299 | - $j=0; | |
| 2300 | - foreach ($row as $key => $value) { | |
| 2301 | - $row[ $key] = $wpdb->_real_escape( apply_filters( 'wpdbbkp_process_db_fields', $row[$key],$table,$key) ); | |
| 2302 | - $output .= ( isset( $row[ $key ] ) ) ? '"' . $row[ $key ] . '"' : '""'; | |
| 2303 | - if ( $j < ( $result_o_index - 1 ) ) { | |
| 2304 | - $output .= ','; | |
| 2305 | - } | |
| 2306 | - $j++; | |
| 2307 | - } | |
| 2308 | - $output .= ");\n"; | |
| 1726 | + } | |
| 1727 | + else{ | |
| 1728 | + $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM %i",array($table)), ARRAY_A ); // phpcs:ignore | |
| 1729 | + } | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + $row2 = $wpdb->get_row( 'SHOW CREATE TABLE ' . $table, ARRAY_N ); // phpcs:ignore | |
| 1733 | + $output .= "\n\n" . $row2[1] . ";\n\n"; | |
| 1734 | + $result_count = count( $result ); | |
| 1735 | + for ( $i = 0; $i < $result_count; $i++ ) { | |
| 1736 | + $row = $result[ $i ]; | |
| 1737 | + $output .= 'INSERT INTO ' . $table . ' VALUES('; | |
| 1738 | + $result_o_index = count( $result[0] ); | |
| 1739 | + $j=0; | |
| 1740 | + foreach ($row as $key => $value) { | |
| 1741 | + $row[ $key] = $wpdb->_real_escape( apply_filters( 'wpdbbkp_process_db_fields', $row[$key],$table,$key) ); | |
| 1742 | + $output .= ( isset( $row[ $key ] ) ) ? '"' . $row[ $key ] . '"' : '""'; | |
| 1743 | + if ( $j < ( $result_o_index - 1 ) ) { | |
| 1744 | + $output .= ','; | |
| 2309 | 1745 | } |
| 2310 | - | |
| 1746 | + $j++; | |
| 2311 | 1747 | } |
| 2312 | - $output .= "\n"; | |
| 1748 | + $output .= ");\n"; | |
| 2313 | 1749 | } |
| 2314 | - sleep(1); | |
| 1750 | + $output .= "\n"; | |
| 2315 | 1751 | } |
| 2316 | - | |
| 1752 | + sleep(1); | |
| 2317 | 1753 | } |
| 2318 | - | |
| 2319 | 1754 | $wpdb->flush(); |
| 2320 | 1755 | /* BEGIN : Prevent saving backup plugin settings in the database dump */ |
| 2321 | - $options_backup = wpdbbkp_filter_unique_filenames( $options_backup ); | |
| 2322 | 1756 | add_option( 'wp_db_backup_backups', $options_backup ); |
| 2323 | 1757 | add_option( 'wp_db_backup_options', $settings_backup ); |
| 2324 | 1758 | /* END : Prevent saving backup plugin settings in the database dump */ |
| 2325 | 1759 | return $output; |
| @@ -2327,138 +1761,61 @@ | ||
| 2327 | 1761 | |
| 2328 | 1762 | /** |
| 2329 | 1763 | * Create database backup new function. |
| 2330 | 1764 | */ |
| 2331 | - public function wp_db_backup_create_mysql_backup_new( $table, $file_path ) { | |
| 2332 | - global $wpdb, $wp_filesystem; | |
| 2333 | - | |
| 2334 | - // Ensure WP Filesystem is loaded | |
| 2335 | - if ( ! function_exists( 'WP_Filesystem' ) ) { | |
| 2336 | - require_once ABSPATH . 'wp-admin/includes/file.php'; | |
| 2337 | - } | |
| 2338 | - WP_Filesystem(); | |
| 2339 | - | |
| 2340 | - // Define file size threshold (e.g., 10MB) | |
| 2341 | - $file_size_threshold = 10 * 1024 * 1024; // 10MB | |
| 2342 | - | |
| 2343 | - // Initialize the file with table creation statement if it doesn't exist | |
| 1765 | + public function wp_db_backup_create_mysql_backup_new($table) { | |
| 1766 | + global $wpdb; | |
| 1767 | + $output = ''; | |
| 2344 | 1768 | |
| 2345 | - $table = esc_sql( $table ); | |
| 2346 | - $row2 = $wpdb->get_row( "SHOW CREATE TABLE `{$table}`", ARRAY_N ); // phpcs:ignore | |
| 2347 | - $initial_output = "\n\n" . $row2[1] . ";\n\n"; | |
| 2348 | - | |
| 2349 | - $use_php_methods = false; | |
| 2350 | - if ( $wp_filesystem->exists( $file_path ) ) { | |
| 2351 | - // Check file size | |
| 2352 | - $file_size = $wp_filesystem->size( $file_path ); | |
| 2353 | - if ( $file_size !== false && $file_size > $file_size_threshold ) { | |
| 2354 | - $use_php_methods = true; | |
| 1769 | + $check_count = $wpdb->get_var( "SELECT count(*) FROM {$table}"); // phpcs:ignore | |
| 1770 | + $check_count = intval($check_count); | |
| 1771 | + $sub_limit =500; | |
| 1772 | + if(isset($check_count) && $check_count>$sub_limit){ | |
| 1773 | + $result =array(); | |
| 1774 | + $t_sub_queries= ceil($check_count/$sub_limit); | |
| 1775 | + for($sub_i=0;$sub_i<$t_sub_queries;$sub_i++) | |
| 1776 | + { | |
| 1777 | + $sub_offset = $sub_i*$sub_limit; | |
| 1778 | + $sub_result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM %i LIMIT %d OFFSET %d",array($table,$sub_limit,$sub_offset)), ARRAY_A ); | |
| 1779 | + if($sub_result){ | |
| 1780 | + $result = array_merge($result,$sub_result); | |
| 1781 | + } | |
| 1782 | + sleep(1); | |
| 2355 | 1783 | } |
| 2356 | 1784 | } |
| 2357 | - | |
| 2358 | - // Function to append content | |
| 2359 | - $append_content = function( $new_content ) use ( $file_path, $wp_filesystem, $use_php_methods ) { | |
| 2360 | - if ( $use_php_methods ) { | |
| 2361 | - // Using PHP methods to append | |
| 2362 | - if ( ! $wp_filesystem->exists( $file_path ) ) { | |
| 2363 | - // phpcs:ignore -- WP Filesystem fileing for large files | |
| 2364 | - file_put_contents( $file_path, $new_content ); | |
| 2365 | - } else { | |
| 2366 | - // phpcs:ignore -- WP Filesystem fileing for large files | |
| 2367 | - file_put_contents( $file_path, $new_content, FILE_APPEND ); | |
| 2368 | - } | |
| 2369 | - } else { | |
| 2370 | - // Use WP Filesystem to append | |
| 2371 | - if ( ! $wp_filesystem->exists( $file_path ) ) { | |
| 2372 | - $wp_filesystem->put_contents( $file_path, $new_content, FS_CHMOD_FILE ); | |
| 2373 | - } else { | |
| 2374 | - // Read current contents | |
| 2375 | - $current_contents = $wp_filesystem->get_contents( $file_path ); | |
| 2376 | - if ( $current_contents === false ) { | |
| 2377 | - // Handle error if reading fails | |
| 2378 | - return false; | |
| 2379 | - } | |
| 2380 | - // Append new content | |
| 2381 | - $updated_contents = $current_contents . $new_content; | |
| 2382 | - // Write back updated contents | |
| 2383 | - if ( ! $wp_filesystem->put_contents( $file_path, $updated_contents, FS_CHMOD_FILE ) ) { | |
| 2384 | - // Handle error if writing fails | |
| 2385 | - return false; | |
| 2386 | - } | |
| 2387 | - } | |
| 2388 | - } | |
| 2389 | - return true; | |
| 2390 | - }; | |
| 2391 | - | |
| 2392 | - // Write the initial output to the file | |
| 2393 | - if ( ! $append_content( $initial_output ) ) { | |
| 2394 | - return false; // Handle error if initial content writing fails | |
| 1785 | + else{ | |
| 1786 | + $result = $wpdb->get_results( $wpdb->prepare("SELECT * FROM %i",array($table)), ARRAY_A ); // phpcs:ignore | |
| 2395 | 1787 | } |
| 2396 | - | |
| 2397 | - $sub_limit = 500; | |
| 2398 | - // phpcs:ignore | |
| 2399 | - $check_count = $wpdb->get_var( "SELECT COUNT(*) FROM `{$table}`" ); | |
| 2400 | - $check_count = intval( $check_count ); | |
| 2401 | - | |
| 2402 | - if ( $check_count > $sub_limit ) { | |
| 2403 | - $t_sub_queries = ceil( $check_count / $sub_limit ); | |
| 2404 | - | |
| 2405 | - for ( $sub_i = 0; $sub_i < $t_sub_queries; $sub_i++ ) { | |
| 2406 | - $sub_offset = $sub_i * $sub_limit; | |
| 2407 | - $sub_result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$table}` LIMIT %d OFFSET %d", array( $sub_limit, $sub_offset ) ), ARRAY_A ); // phpcs:ignore | |
| 2408 | - | |
| 2409 | - if ( $sub_result ) { | |
| 2410 | - $output = ''; | |
| 2411 | - foreach ( $sub_result as $row ) { | |
| 2412 | - $output .= 'INSERT INTO ' . $table . ' VALUES('; | |
| 2413 | - $result_o_index = count( $row ); | |
| 2414 | - $j = 0; | |
| 2415 | - foreach ( $row as $key => $value ) { | |
| 2416 | - $row[ $key ] = $wpdb->_real_escape( apply_filters( 'wpdbbkp_process_db_fields', $value, $table, $key ) ); | |
| 2417 | - $output .= ( isset( $row[ $key ] ) ) ? '"' . $row[ $key ] . '"' : '""'; | |
| 2418 | - if ( $j < ( $result_o_index - 1 ) ) { | |
| 2419 | - $output .= ','; | |
| 2420 | - } | |
| 2421 | - $j++; | |
| 2422 | - } | |
| 2423 | - $output .= ");\n"; | |
| 2424 | - } | |
| 2425 | - // Append to the file | |
| 2426 | - if ( ! $append_content( $output ) ) { | |
| 2427 | - return false; // Handle error if appending content fails | |
| 2428 | - } | |
| 2429 | - } | |
| 2430 | - sleep(1); | |
| 2431 | - } | |
| 2432 | - } else { | |
| 2433 | - $result = $wpdb->get_results( "SELECT * FROM `{$table}`", ARRAY_A ); // phpcs:ignore | |
| 2434 | - | |
| 2435 | - $output = ''; | |
| 2436 | - foreach ( $result as $row ) { | |
| 2437 | - $output .= 'INSERT INTO ' . $table . ' VALUES('; | |
| 2438 | - $result_o_index = count( $row ); | |
| 2439 | - $j = 0; | |
| 2440 | - foreach ( $row as $key => $value ) { | |
| 2441 | - $row[ $key ] = $wpdb->_real_escape( apply_filters( 'wpdbbkp_process_db_fields', $value, $table, $key ) ); | |
| 2442 | - $output .= ( isset( $row[ $key ] ) ) ? '"' . $row[ $key ] . '"' : '""'; | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + $row2 = $wpdb->get_row( 'SHOW CREATE TABLE ' . $table, ARRAY_N ); // phpcs:ignore | |
| 1791 | + $output .= "\n\n" . $row2[1] . ";\n\n"; | |
| 1792 | + $result_count = count( $result ); | |
| 1793 | + for ( $i = 0; $i < $result_count; $i++ ) { | |
| 1794 | + $row = $result[ $i ]; | |
| 1795 | + $output .= 'INSERT INTO ' . $table . ' VALUES('; | |
| 1796 | + $result_o_index = count( $result[0] ); | |
| 1797 | + $j=0; | |
| 1798 | + if(!empty($row)){ | |
| 1799 | + foreach ($row as $key => $value) { | |
| 1800 | + $row[ $key] = $wpdb->_real_escape( apply_filters( 'wpdbbkp_process_db_fields', $row[$key],$table,$key) ); | |
| 1801 | + $output .= ( isset( $row[ $key ] ) ) ? '"' . $row[ $key ] . '"' : '""'; | |
| 2443 | 1802 | if ( $j < ( $result_o_index - 1 ) ) { |
| 2444 | 1803 | $output .= ','; |
| 2445 | 1804 | } |
| 2446 | 1805 | $j++; |
| 2447 | 1806 | } |
| 1807 | + } | |
| 2448 | 1808 | $output .= ");\n"; |
| 2449 | 1809 | } |
| 2450 | - // Append to the file | |
| 2451 | - if ( ! $append_content( $output ) ) { | |
| 2452 | - return false; // Handle error if appending content fails | |
| 2453 | - } | |
| 2454 | - } | |
| 2455 | - | |
| 2456 | - // Flush the database cache | |
| 1810 | + $output .= "\n"; | |
| 1811 | + | |
| 1812 | + sleep(1); | |
| 1813 | + | |
| 2457 | 1814 | $wpdb->flush(); |
| 2458 | - return true; | |
| 1815 | + | |
| 1816 | + return $output; | |
| 2459 | 1817 | } |
| 2460 | - | |
| 2461 | 1818 | |
| 2462 | 1819 | /** |
| 2463 | 1820 | * Mysql Dump set path. |
| 2464 | 1821 | * |
| @@ -2637,12 +1994,13 @@ | ||
| 2637 | 1994 | |
| 2638 | 1995 | // The file we're saving too. |
| 2639 | 1996 | $cmd .= ' -r ' . escapeshellarg( $sql_filename ); |
| 2640 | 1997 | |
| 1998 | + $wp_db_exclude_table = array(); | |
| 2641 | 1999 | $wp_db_exclude_table = get_option( 'wp_db_exclude_table' ); |
| 2642 | - if ( ! empty( $wp_db_exclude_table ) && is_array( $wp_db_exclude_table ) ) { | |
| 2643 | - foreach ( $this->filter_valid_exclude_tables( $wp_db_exclude_table ) as $exclude_table ) { | |
| 2644 | - $cmd .= ' --ignore-table=' . escapeshellarg( DB_NAME . '.' . $exclude_table ); | |
| 2000 | + if ( ! empty( $wp_db_exclude_table ) ) { | |
| 2001 | + foreach ( $wp_db_exclude_table as $wp_db_exclude_table ) { | |
| 2002 | + $cmd .= ' --ignore-table=' . DB_NAME . '.' . $wp_db_exclude_table; | |
| 2645 | 2003 | } |
| 2646 | 2004 | } |
| 2647 | 2005 | |
| 2648 | 2006 | // The database we're dumping. |
| @@ -2695,9 +2053,9 @@ | ||
| 2695 | 2053 | |
| 2696 | 2054 | // If there are mysqldump errors delete the database dump file as mysqldump will still have written one. |
| 2697 | 2055 | if ( $this->get_errors( $this->get_mysqldump_method() ) && file_exists( $sql_filename ) ) { |
| 2698 | 2056 | if ( file_exists( $sql_filename ) ) { |
| 2699 | - wp_delete_file( $sql_filename ); | |
| 2057 | + unlink( $sql_filename ); | |
| 2700 | 2058 | } |
| 2701 | 2059 | } |
| 2702 | 2060 | |
| 2703 | 2061 | // If we have an empty file delete it. |
| @@ -2702,9 +2060,9 @@ | ||
| 2702 | 2060 | |
| 2703 | 2061 | // If we have an empty file delete it. |
| 2704 | 2062 | if ( 0 === filesize( $sql_filename ) ) { |
| 2705 | 2063 | if ( file_exists( $sql_filename ) ) { |
| 2706 | - wp_delete_file( $sql_filename ); | |
| 2064 | + unlink( $sql_filename ); | |
| 2707 | 2065 | } |
| 2708 | 2066 | } |
| 2709 | 2067 | |
| 2710 | 2068 | // If the file still exists then it must be good. |
| @@ -2750,43 +2108,31 @@ | ||
| 2750 | 2108 | $source_directory = $this->wp_db_backup_wp_config_path(); |
| 2751 | 2109 | |
| 2752 | 2110 | $path_info = wp_upload_dir(); |
| 2753 | 2111 | $htasses_text = ''; |
| 2754 | - global $wpdb,$wp_filesystem; | |
| 2755 | - if ( ! function_exists( 'WP_Filesystem' ) ) { | |
| 2756 | - require_once ABSPATH . '/wp-admin/includes/file.php'; | |
| 2757 | - } | |
| 2758 | - WP_Filesystem(); | |
| 2759 | - | |
| 2760 | - if(!$wp_filesystem){ | |
| 2761 | - return false; | |
| 2762 | - } | |
| 2763 | - | |
| 2764 | 2112 | wp_mkdir_p($path_info['basedir'] . '/' . WPDB_BACKUPS_DIR); |
| 2765 | 2113 | wp_mkdir_p($path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log'); |
| 2766 | - $file_contents = "<?php\n// Silence is golden.\n"; | |
| 2767 | - | |
| 2768 | - // Create the file with the given contents | |
| 2769 | - $wp_filesystem->put_contents( $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/index.php', $file_contents, FS_CHMOD_FILE ); | |
| 2770 | - $wp_filesystem->put_contents( $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log/index.php', $file_contents, FS_CHMOD_FILE ); | |
| 2771 | - | |
| 2772 | - | |
| 2114 | + fclose(fopen($path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/index.php', 'w')); | |
| 2115 | + fclose(fopen($path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log/index.php', 'w')); | |
| 2773 | 2116 | // Added htaccess file 08-05-2015 for prevent directory listing. |
| 2774 | 2117 | // Fixed Vulnerability 22-06-2016 for prevent direct download. |
| 2775 | - | |
| 2776 | - $htaccess_content = '# Disable public access to this folder | |
| 2777 | -<IfModule mod_authz_core.c> | |
| 2778 | - Require all denied | |
| 2779 | -</IfModule> | |
| 2780 | - | |
| 2781 | -<IfModule !mod_authz_core.c> | |
| 2782 | - Deny from all | |
| 2783 | -</IfModule>'; | |
| 2784 | - $wp_filesystem->put_contents( $path_info['basedir'] . '/db-backup/.htaccess', $htaccess_content, FS_CHMOD_FILE ); | |
| 2785 | - | |
| 2118 | + if ( 1 === (int) get_option( 'wp_db_backup_enable_htaccess' ) ) { | |
| 2119 | + $f = fopen( $path_info['basedir'] . '/db-backup/.htaccess', 'w' ); // phpcs:ignore | |
| 2120 | + fwrite( // phpcs:ignore | |
| 2121 | + $f, | |
| 2122 | + '#These next two lines will already exist in your .htaccess file | |
| 2123 | + RewriteEngine On | |
| 2124 | + RewriteBase / | |
| 2125 | + # Add these lines right after the preceding two | |
| 2126 | + RewriteCond %{REQUEST_FILENAME} ^.*(.zip)$ | |
| 2127 | + RewriteCond %{HTTP_COOKIE} !^.*can_download.*$ [NC] | |
| 2128 | + RewriteRule . - [R=403,L]' | |
| 2129 | + ); // phpcs:ignore | |
| 2130 | + fclose( $f ); // phpcs:ignore | |
| 2131 | + } | |
| 2786 | 2132 | // Begin : Generate SQL DUMP and save to file database.sql. |
| 2787 | - $wp_site_name = preg_replace('/[^\p{L}\p{M}]+/u', '_', get_bloginfo('name')); | |
| 2788 | - $wp_db_file_name = $wp_site_name . '_' . gmdate( 'Y_m_d' ) . '_' . time() . '_' . substr( md5( wp_rand(100,9999999) ), 0, 9 ) . '_wpdb'; | |
| 2133 | + $wp_site_name = preg_replace( '/[^A-Za-z0-9\_]/', '_', get_bloginfo( 'name' ) ); | |
| 2134 | + $wp_db_file_name = $wp_site_name . '_' . date( 'Y_m_d' ) . '_' . time() . '_' . substr( md5( AUTH_KEY ), 0, 7 ) . '_wpdb'; | |
| 2789 | 2135 | $sql_filename = $wp_db_file_name . '.sql'; |
| 2790 | 2136 | $filename = $wp_db_file_name . '.zip'; |
| 2791 | 2137 | $logname = $wp_db_file_name . '.txt'; |
| 2792 | 2138 | |
| @@ -2803,27 +2149,25 @@ | ||
| 2803 | 2149 | if ( 1 === (int) $my_sql_dump ) { |
| 2804 | 2150 | /* BEGIN : Prevent saving backup plugin settings in the database dump */ |
| 2805 | 2151 | $options_backup = get_option( 'wp_db_backup_backups' ); |
| 2806 | 2152 | $settings_backup = get_option( 'wp_db_backup_options' ); |
| 2807 | - $wp_db_save_settings_in_backup = get_option( 'wp_db_save_settings_in_backup',1); | |
| 2808 | - if($wp_db_save_settings_in_backup){ | |
| 2809 | - delete_option( 'wp_db_backup_backups' ); | |
| 2810 | - delete_option( 'wp_db_backup_options' ); | |
| 2811 | - } | |
| 2153 | + delete_option( 'wp_db_backup_backups' ); | |
| 2154 | + delete_option( 'wp_db_backup_options' ); | |
| 2812 | 2155 | /* END : Prevent saving backup plugin settings in the database dump */ |
| 2813 | - //phpcs:ignore -- using direct query get all tables name to be backedup. | |
| 2156 | + global $wpdb; | |
| 2814 | 2157 | $tables = $wpdb->get_col( 'SHOW TABLES' ); |
| 2815 | 2158 | $wp_db_exclude_table = get_option( 'wp_db_exclude_table',array()); |
| 2816 | 2159 | if(!empty($tables)){ |
| 2817 | 2160 | foreach($tables as $table){ |
| 2818 | 2161 | if ( empty( $wp_db_exclude_table ) || ( ! ( in_array( $table, $wp_db_exclude_table, true ) ) ) ) { |
| 2819 | - $this->wp_db_backup_create_mysql_backup_new($table, $path_info['basedir'] . '/db-backup/' . $sql_filename ); | |
| 2162 | + $handle = fopen( $path_info['basedir'] . '/db-backup/' . $sql_filename, 'a' ); // phpcs:ignore | |
| 2163 | + fwrite( $handle, $this->wp_db_backup_create_mysql_backup_new($table) ); // phpcs:ignore | |
| 2164 | + fclose( $handle ); // phpcs:ignore | |
| 2165 | + | |
| 2820 | 2166 | } |
| 2821 | 2167 | } |
| 2822 | - | |
| 2823 | 2168 | } |
| 2824 | 2169 | /* BEGIN : Prevent saving backup plugin settings in the database dump */ |
| 2825 | - $options_backup = wpdbbkp_filter_unique_filenames( $options_backup ); | |
| 2826 | 2170 | add_option( 'wp_db_backup_backups', $options_backup ); |
| 2827 | 2171 | add_option( 'wp_db_backup_options', $settings_backup ); |
| 2828 | 2172 | /* END : Prevent saving backup plugin settings in the database dump */ |
| 2829 | 2173 | } |
| @@ -2833,10 +2177,10 @@ | ||
| 2833 | 2177 | $wp_db_backup_replace_text = get_option( 'wp_db_backup_replace_text' ); |
| 2834 | 2178 | if ( ( false === empty( $wp_db_backup_search_text ) ) && ( false === empty( $wp_db_backup_replace_text ) ) ) { |
| 2835 | 2179 | $filecontent = wp_remote_get( $path_info['basedir'] . '/db-backup/' . $sql_filename ); |
| 2836 | 2180 | if (! is_wp_error( $filecontent ) && isset($filecontent['body']) ) { |
| 2837 | - $backup_str = str_replace( $wp_db_backup_search_text, $wp_db_backup_replace_text, $filecontent['body'] ); | |
| 2838 | - $wp_filesystem->put_contents( $path_info['basedir'] . '/db-backup/' . $sql_filename, $backup_str, FS_CHMOD_FILE ); | |
| 2181 | + $backup_str = str_replace( $wp_db_backup_search_text, $wp_db_backup_replace_text, $filecontent['body'] ); // phpcs:ignore | |
| 2182 | + file_put_contents( $path_info['basedir'] . '/db-backup/' . $sql_filename, $backup_str ); // phpcs:ignore | |
| 2839 | 2183 | } |
| 2840 | 2184 | } |
| 2841 | 2185 | |
| 2842 | 2186 | /* End : Generate SQL DUMP and save to file database.sql */ |
| @@ -2862,9 +2206,9 @@ | ||
| 2862 | 2206 | // Create the archive. |
| 2863 | 2207 | $v_list = $archive->create( $v_dir, PCLZIP_OPT_REMOVE_PATH, $v_remove ); |
| 2864 | 2208 | } |
| 2865 | 2209 | |
| 2866 | - | |
| 2210 | + global $wpdb; | |
| 2867 | 2211 | $mysqlversion = wp_cache_get( 'wpdb_mysqlversion' ); |
| 2868 | 2212 | if ( true === empty( $mysqlversion ) ) { |
| 2869 | 2213 | $mysqlversion = $wpdb->get_var( 'SELECT VERSION() AS version' ); // phpcs:ignore |
| 2870 | 2214 | wp_cache_set( 'wpdb_mysqlversion', $mysqlversion, '', 18000 ); |
| @@ -2900,14 +2244,14 @@ | ||
| 2900 | 2244 | if ( ! ( $number_of_existing_backups < $number_of_backups_from_user ) ) { |
| 2901 | 2245 | $diff = $number_of_existing_backups - $number_of_backups_from_user; |
| 2902 | 2246 | for ( $i = 0; $i <= $diff; $i++ ) { |
| 2903 | 2247 | $index = $i; |
| 2904 | - if ( isset($options[ $index ]['dir']) && file_exists( $options[ $index ]['dir'] ) ) { | |
| 2905 | - wp_delete_file( $options[ $index ]['dir'] ); | |
| 2248 | + if ( file_exists( $options[ $index ]['dir'] ) ) { | |
| 2249 | + unlink( $options[ $index ]['dir'] ); | |
| 2906 | 2250 | } |
| 2907 | 2251 | $file_sql = explode( '.', $options[ $index ]['dir'] ); |
| 2908 | - if ( isset($file_sql[0]) && file_exists( $file_sql[0] . '.sql' ) ) { | |
| 2909 | - wp_delete_file( $file_sql[0] . '.sql' ); | |
| 2252 | + if ( file_exists( $file_sql[0] . '.sql' ) ) { | |
| 2253 | + unlink( $file_sql[0] . '.sql' ); | |
| 2910 | 2254 | } |
| 2911 | 2255 | } |
| 2912 | 2256 | for ( $i = ( $diff + 1 ); $i < $number_of_existing_backups; $i++ ) { |
| 2913 | 2257 | $index = $i; |
| @@ -2913,9 +2257,8 @@ | ||
| 2913 | 2257 | $index = $i; |
| 2914 | 2258 | |
| 2915 | 2259 | $newoptions[] = $options[ $index ]; |
| 2916 | 2260 | } |
| 2917 | - $newoptions = wpdbbkp_filter_unique_filenames( $newoptions ); | |
| 2918 | 2261 | |
| 2919 | 2262 | update_option( 'wp_db_backup_backups', $newoptions , false); |
| 2920 | 2263 | } |
| 2921 | 2264 | } |
| @@ -2920,9 +2263,9 @@ | ||
| 2920 | 2263 | } |
| 2921 | 2264 | } |
| 2922 | 2265 | |
| 2923 | 2266 | if ( file_exists( $path_info['basedir'] . '/db-backup/' . $sql_filename ) ) { |
| 2924 | - wp_delete_file( $path_info['basedir'] . '/db-backup/' . $sql_filename ); | |
| 2267 | + unlink( $path_info['basedir'] . '/db-backup/' . $sql_filename ); | |
| 2925 | 2268 | } |
| 2926 | 2269 | return $upload_path; |
| 2927 | 2270 | } |
| 2928 | 2271 | |
| @@ -2929,10 +2272,22 @@ | ||
| 2929 | 2272 | /** |
| 2930 | 2273 | * Config Path. |
| 2931 | 2274 | */ |
| 2932 | 2275 | public function wp_db_backup_wp_config_path() { |
| 2933 | - $path = str_replace('\\', '/', ABSPATH); | |
| 2934 | - | |
| 2276 | + $base = dirname( __FILE__ ); | |
| 2277 | + $path = false; | |
| 2278 | + if ( file_exists( dirname( dirname( $base ) ) . '/wp-config.php' ) ) { | |
| 2279 | + $path = dirname( dirname( $base ) ); | |
| 2280 | + } else { | |
| 2281 | + if ( file_exists( dirname( dirname( dirname( $base ) ) ) . '/wp-config.php' ) ) { | |
| 2282 | + $path = dirname( dirname( dirname( $base ) ) ); | |
| 2283 | + } else { | |
| 2284 | + $path = false; | |
| 2285 | + } | |
| 2286 | + } | |
| 2287 | + if ( false !== $path ) { | |
| 2288 | + $path = str_replace( '\\', '/', $path ); | |
| 2289 | + } | |
| 2935 | 2290 | return $path; |
| 2936 | 2291 | } |
| 2937 | 2292 | |
| 2938 | 2293 | /** |
| @@ -2939,20 +2294,15 @@ | ||
| 2939 | 2294 | * Backup Process. |
| 2940 | 2295 | */ |
| 2941 | 2296 | public function wp_db_backup_event_process() { |
| 2942 | 2297 | // Added in v.3.9.5! |
| 2943 | - global $wp_filesystem; | |
| 2944 | - if(!function_exists('WP_Filesystem')){ | |
| 2945 | - require_once ( ABSPATH . '/wp-admin/includes/file.php' ); | |
| 2946 | - } | |
| 2947 | - WP_Filesystem(); | |
| 2948 | 2298 | |
| 2949 | 2299 | $cron_condition = apply_filters('wpdbbkp_dbback_cron_condition',true ); |
| 2950 | 2300 | if(wp_doing_cron() && !$cron_condition){ |
| 2951 | - return false; | |
| 2301 | + wp_die(); | |
| 2952 | 2302 | } |
| 2953 | 2303 | |
| 2954 | - set_time_limit( 0 ); //phpcs:ignore -- increase time limit for backup process. | |
| 2304 | + set_time_limit( 0 ); | |
| 2955 | 2305 | ignore_user_abort(true); |
| 2956 | 2306 | |
| 2957 | 2307 | $details = $this->wp_db_backup_create_archive(); |
| 2958 | 2308 | $options = get_option( 'wp_db_backup_backups' ); |
| @@ -2976,32 +2326,9 @@ | ||
| 2976 | 2326 | $wp_db_remove_local_backup = get_option( 'wp_db_remove_local_backup' ); |
| 2977 | 2327 | $destination = ( 1 === (int) $wp_db_remove_local_backup ) ? '' : 'Local, '; |
| 2978 | 2328 | |
| 2979 | 2329 | $args = array( $details['filename'], $details['dir'], $log_message, $details['size'], $destination ); |
| 2980 | - | |
| 2981 | - do_action_ref_array( 'wpdbbkp_db_backup_completed', array( &$args ) ); | |
| 2982 | - | |
| 2983 | - // Ensure enabled destinations are reflected in the saved Destination string for table display | |
| 2984 | - // Note: Hook handlers may have already added destinations, so check before appending | |
| 2985 | - $destination_for_table = $args[4]; | |
| 2986 | - if ( get_option( 'wp_db_backup_destination_generics3' ) == 1 && !empty(get_option( 'wpdb_dest_generics3_bucket_key' ) ) && !empty(get_option( 'wpdb_dest_generics3_bucket_secret' ) ) ) { | |
| 2987 | - $destination_for_table .= 'GenericS3, '; | |
| 2988 | - } | |
| 2989 | - if ( get_option( 'wp_db_backup_destination_bb' ) == 1 && !empty(get_option( 'wpdb_dest_bb_s3_bucket_key' ) ) ) { | |
| 2990 | - $destination_for_table .= 'Backblaze, '; | |
| 2991 | - } | |
| 2992 | - if ( get_option( 'wp_db_backup_destination_s3' ) == 1 && !empty(get_option( 'wpdb_dest_amazon_s3_bucket_key' ) ) && !empty(get_option( 'wpdb_dest_amazon_s3_bucket_secret' ) ) ) { | |
| 2993 | - $destination_for_table .= 'S3, '; | |
| 2994 | - } | |
| 2995 | - if ( get_option( 'wp_db_backup_destination_SFTP' ) == 1 && !empty(get_option( 'wpdb_dest_sftp_host' ) ) && !empty(get_option( 'wpdb_dest_sftp_port' ) ) && !empty(get_option( 'wpdb_dest_sftp_username' ) ) && !empty(get_option( 'wpdb_dest_sftp_password' ) ) ) { | |
| 2996 | - $destination_for_table .= 'SFTP, '; | |
| 2997 | - } | |
| 2998 | - if ( get_option( 'wp_db_backup_destination_FTP' ) == 1 && !empty(get_option( 'wpdb_dest_ftp_host' ) ) && !empty(get_option( 'wpdb_dest_ftp_port' ) ) && !empty(get_option( 'wpdb_dest_ftp_username' ) ) && !empty(get_option( 'wpdb_dest_ftp_password' ) ) ) { | |
| 2999 | - $destination_for_table .= 'FTP, '; | |
| 3000 | - } | |
| 3001 | - if ( get_option( 'wp_db_backup_destination_Email' ) == 1 && strpos( $destination_for_table, 'Email' ) === false ) { | |
| 3002 | - $destination_for_table .= 'Email, '; | |
| 3003 | - } | |
| 2330 | + do_action_ref_array( 'wp_db_backup_completed', array( &$args ) ); | |
| 3004 | 2331 | |
| 3005 | 2332 | $options[] = array( |
| 3006 | 2333 | 'date' => time(), |
| 3007 | 2334 | 'filename' => $details['filename'], |
| @@ -3011,22 +2338,25 @@ | ||
| 3011 | 2338 | 'search_replace' => $is_search_replace_flag, |
| 3012 | 2339 | 'sqlfile' => $details['sqlfile'], |
| 3013 | 2340 | 'size' => $details['size'], |
| 3014 | 2341 | 'type' =>'database', |
| 3015 | - 'destination' => $destination_for_table | |
| 2342 | + 'destination' => $args[4] | |
| 3016 | 2343 | ); |
| 3017 | 2344 | if ( 1 !== (int) $wp_db_remove_local_backup ) { |
| 3018 | - $options = wpdbbkp_filter_unique_filenames( $options ); | |
| 3019 | 2345 | update_option( 'wp_db_backup_backups', $options , false); |
| 3020 | 2346 | } |
| 3021 | - | |
| 3022 | 2347 | if(isset($details['log_dir']) && !empty($details['log_dir'])) |
| 3023 | 2348 | { |
| 3024 | - $log_file_path = $details['log_dir']; | |
| 3025 | - $log_dir = dirname($log_file_path); | |
| 2349 | + if (is_writable($details['log_dir']) || !file_exists($details['log_dir'])) { | |
| 3026 | 2350 | |
| 3027 | - if ( $wp_filesystem->is_writable( $log_dir ) ) { | |
| 3028 | - $wp_filesystem->put_contents( $log_file_path, str_replace(array("<br>","<b>","</b>"), array("\n","",""), $args[2]), FS_CHMOD_FILE ); | |
| 2351 | + if ($handle = @fopen($details['log_dir'], 'a')) | |
| 2352 | + { | |
| 2353 | + if (fwrite($handle, str_replace(array("<br>","<b>","</b>"), array("\n","",""), $args[2]))) | |
| 2354 | + { | |
| 2355 | + fclose($handle); | |
| 2356 | + } | |
| 2357 | + } | |
| 2358 | + | |
| 3029 | 2359 | } |
| 3030 | 2360 | } |
| 3031 | 2361 | } |
| 3032 | 2362 | |
| @@ -3063,22 +2393,11 @@ | ||
| 3063 | 2393 | * Schedular activation. |
| 3064 | 2394 | */ |
| 3065 | 2395 | public function wp_db_backup_scheduler_activation() { |
| 3066 | 2396 | $options = get_option( 'wp_db_backup_options' ); |
| 3067 | - if ( ( ! wp_next_scheduled( 'wpdbbkp_db_backup_event' ) ) && ( true === isset( $options['enable_autobackups'] ) ) ) { | |
| 2397 | + if ( ( ! wp_next_scheduled( 'wp_db_backup_event' ) ) && ( true === isset( $options['enable_autobackups'] ) ) ) { | |
| 3068 | 2398 | $cron_freq = apply_filters( 'wpdbbkp_dbback_cron_frequency',$options['autobackup_frequency']); |
| 3069 | - if(isset($options['autobackup_type']) && $options['autobackup_type'] == 'db') | |
| 3070 | - { | |
| 3071 | - $timestamp = strtotime('today 23:59'); // Start at the next midnight | |
| 3072 | - wp_schedule_event( $timestamp , $cron_freq, 'wpdbbkp_db_backup_event' ); | |
| 3073 | - | |
| 3074 | - } | |
| 3075 | - }else{ | |
| 3076 | - if( !empty($options) && ( false === isset( $options['enable_autobackups'] ) ) || ( true === isset( $options['enable_autobackups'] ) ) && isset($options['autobackup_type']) && $options['autobackup_type'] != 'db') | |
| 3077 | - { | |
| 3078 | - wp_clear_scheduled_hook( 'wpdbbkp_db_backup_event' ); | |
| 3079 | - } | |
| 3080 | - | |
| 2399 | + wp_schedule_event( time(), $cron_freq, 'wp_db_backup_event' ); | |
| 3081 | 2400 | } |
| 3082 | 2401 | } |
| 3083 | 2402 | |
| 3084 | 2403 | /** |
| @@ -3087,9 +2406,9 @@ | ||
| 3087 | 2406 | * @param string $key - key name. |
| 3088 | 2407 | */ |
| 3089 | 2408 | public function wp_backup_get_config_data( $key ) { |
| 3090 | 2409 | $filepath = get_home_path() . '/wp-config.php'; |
| 3091 | - $config_file = @file_get_contents( "$filepath", true ); | |
| 2410 | + $config_file = file_get_contents( "$filepath", true ); | |
| 3092 | 2411 | if($config_file){ |
| 3093 | 2412 | switch ( $key ) { |
| 3094 | 2413 | case 'DB_NAME': |
| 3095 | 2414 | preg_match( "/'DB_NAME',\s*'(.*)?'/", $config_file, $matches ); |
| @@ -3115,9 +2434,9 @@ | ||
| 3115 | 2434 | * Get db name from config. |
| 3116 | 2435 | */ |
| 3117 | 2436 | public function wp_backup_get_config_db_name() { |
| 3118 | 2437 | $filepath = get_home_path() . '/wp-config.php'; |
| 3119 | - $config_file = @file_get_contents( "$filepath", true ); | |
| 2438 | + $config_file = file_get_contents( "$filepath", true ); | |
| 3120 | 2439 | if($config_file){ |
| 3121 | 2440 | preg_match( "/'DB_NAME',\s*'(.*)?'/", $config_file, $matches ); |
| 3122 | 2441 | return $matches[1]; |
| 3123 | 2442 | } |
| @@ -3124,40 +2443,8 @@ | ||
| 3124 | 2443 | return ''; |
| 3125 | 2444 | } |
| 3126 | 2445 | |
| 3127 | 2446 | /** |
| 3128 | - * Restrict exclude-table names to tables that exist in the database. | |
| 3129 | - * | |
| 3130 | - * @param array|string $exclude_tables Tables requested for exclusion. | |
| 3131 | - * | |
| 3132 | - * @return array | |
| 3133 | - */ | |
| 3134 | - public function filter_valid_exclude_tables( $exclude_tables ) { | |
| 3135 | - global $wpdb; | |
| 3136 | - | |
| 3137 | - if ( ! is_array( $exclude_tables ) ) { | |
| 3138 | - return array(); | |
| 3139 | - } | |
| 3140 | - | |
| 3141 | - $valid_tables = $wpdb->get_col( 'SHOW TABLES' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching | |
| 3142 | - | |
| 3143 | - if ( empty( $valid_tables ) ) { | |
| 3144 | - return array(); | |
| 3145 | - } | |
| 3146 | - | |
| 3147 | - $valid_tables = array_flip( $valid_tables ); | |
| 3148 | - $filtered = array(); | |
| 3149 | - | |
| 3150 | - foreach ( $exclude_tables as $exclude_table ) { | |
| 3151 | - if ( is_string( $exclude_table ) && isset( $valid_tables[ $exclude_table ] ) ) { | |
| 3152 | - $filtered[] = $exclude_table; | |
| 3153 | - } | |
| 3154 | - } | |
| 3155 | - | |
| 3156 | - return array_values( array_unique( $filtered ) ); | |
| 3157 | - } | |
| 3158 | - | |
| 3159 | - /** | |
| 3160 | 2447 | * Recursive sanitation for an array |
| 3161 | 2448 | * |
| 3162 | 2449 | * @param array $array - Array data to sanitize. |
| 3163 | 2450 | * |
| @@ -3163,11 +2450,8 @@ | ||
| 3163 | 2450 | * |
| 3164 | 2451 | * @return mixed |
| 3165 | 2452 | */ |
| 3166 | 2453 | public function recursive_sanitize_text_field( $array ) { |
| 3167 | - if( ! is_array( $array ) ) { | |
| 3168 | - return sanitize_text_field( $array ); | |
| 3169 | - } | |
| 3170 | 2454 | foreach ( $array as $key => &$value ) { |
| 3171 | 2455 | if ( is_array( $value ) ) { |
| 3172 | 2456 | $value = $this->recursive_sanitize_text_field( $value ); |
| 3173 | 2457 | } else { |
| @@ -3225,11 +2509,8 @@ | ||
| 3225 | 2509 | { |
| 3226 | 2510 | wp_register_script('wpdbbkp-admin-script', WPDB_PLUGIN_URL . '/assets/js/wpdbbkp-admin.js', array('jquery'), WPDB_VERSION, 'true' ); |
| 3227 | 2511 | wp_localize_script('wpdbbkp-admin-script', 'wpdbbkp_script_vars', array( |
| 3228 | 2512 | 'nonce' => wp_create_nonce( 'wpdbbkp-admin-nonce' ), |
| 3229 | - 'siteurl' => base64_encode(site_url( )), | |
| 3230 | - 'ud'=>wpdbbkp_get_current_user_name_email(), | |
| 3231 | - 'is_subscribed'=>wpdbbkp_if_remote_active(), | |
| 3232 | 2513 | )); |
| 3233 | 2514 | wp_enqueue_script('wpdbbkp-admin-script'); |
| 3234 | 2515 | |
| 3235 | 2516 | // Adding custom js |
| @@ -3235,16 +2516,13 @@ | ||
| 3235 | 2516 | // Adding custom js |
| 3236 | 2517 | $local = array( |
| 3237 | 2518 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 3238 | 2519 | 'wpdbbkp_admin_security_nonce' => wp_create_nonce('wpdbbkp_ajax_check_nonce'), |
| 3239 | - 'home_url' =>get_home_url() | |
| 3240 | 2520 | ); |
| 3241 | 2521 | wp_register_script('wpdbbkp-admin-fb', WPDB_PLUGIN_URL . '/assets/js/wpdbbkp-admin-cron-backup.js', array(), WPDB_VERSION , true ); |
| 3242 | - | |
| 2522 | + | |
| 3243 | 2523 | wp_localize_script('wpdbbkp-admin-fb', 'wpdbbkp_localize_admin_data', $local ); |
| 3244 | 2524 | wp_enqueue_script('wpdbbkp-admin-fb'); |
| 3245 | - wp_register_script('wpdbbkp-admin-export', WPDB_PLUGIN_URL . '/assets/js/wpdbbkp-admin-cron-export.js', array(), WPDB_VERSION , true ); | |
| 3246 | - wp_enqueue_script('wpdbbkp-admin-export'); | |
| 3247 | 2525 | // Custom Js ends |
| 3248 | 2526 | } |
| 3249 | 2527 | } |
| 3250 | 2528 | |
| @@ -3259,12 +2537,10 @@ | ||
| 3259 | 2537 | $post_type = $current_screen->post_type; |
| 3260 | 2538 | } |
| 3261 | 2539 | |
| 3262 | 2540 | $post_id = get_the_ID(); |
| 3263 | - //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3264 | 2541 | if(isset($_GET['tag_ID'])){ |
| 3265 | - //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3266 | - $post_id = intval($_GET['tag_ID']); | |
| 2542 | + $post_id = intval($_GET['tag_ID']); | |
| 3267 | 2543 | } |
| 3268 | 2544 | |
| 3269 | 2545 | |
| 3270 | 2546 | |
| @@ -3325,9 +2601,9 @@ | ||
| 3325 | 2601 | |
| 3326 | 2602 | if ( ! isset( $_POST['wpdbbkp_security_nonce'] ) ){ |
| 3327 | 2603 | return; |
| 3328 | 2604 | } |
| 3329 | - if ( !wp_verify_nonce( wp_unslash($_POST['wpdbbkp_security_nonce']), 'wpdbbkp-admin-nonce' ) ){ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- used as nonce | |
| 2605 | + if ( !wp_verify_nonce( $_POST['wpdbbkp_security_nonce'], 'wpdbbkp-admin-nonce' ) ){ | |
| 3330 | 2606 | return; |
| 3331 | 2607 | } |
| 3332 | 2608 | |
| 3333 | 2609 | if( ! current_user_can( 'manage_options' ) ) { |
| @@ -3333,10 +2609,10 @@ | ||
| 3333 | 2609 | if( ! current_user_can( 'manage_options' ) ) { |
| 3334 | 2610 | return; |
| 3335 | 2611 | } |
| 3336 | 2612 | |
| 3337 | - $message = isset($_POST['message']) ? $this->wpdbbkp_sanitize_textarea_field(wp_unslash($_POST['message'])) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized using custom function | |
| 3338 | - $email = isset($_POST['email']) ? $this->wpdbbkp_sanitize_textarea_field(wp_unslash($_POST['email'])) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- sanitized using custom function | |
| 2613 | + $message = $this->wpdbbkp_sanitize_textarea_field($_POST['message']); | |
| 2614 | + $email = $this->wpdbbkp_sanitize_textarea_field($_POST['email']); | |
| 3339 | 2615 | |
| 3340 | 2616 | if(function_exists('wp_get_current_user')){ |
| 3341 | 2617 | |
| 3342 | 2618 | $user = wp_get_current_user(); |
| @@ -3375,9 +2651,9 @@ | ||
| 3375 | 2651 | wp_die(); |
| 3376 | 2652 | } |
| 3377 | 2653 | public function add_settings_plugin_action_wp( $actions, $plugin_file, $plugin_data, $context ) { |
| 3378 | 2654 | $plugin_actions['settings'] = sprintf( |
| 3379 | - '<a href="%s">' . _x( 'Settings', 'Content translation' ,'wpdbbkp' ) . '</a>', | |
| 2655 | + '<a href="%s">' . _x( 'Settings', 'wpdbbkp' ) . '</a>', | |
| 3380 | 2656 | admin_url( 'options-general.php?page=wp-database-backup' ) |
| 3381 | 2657 | ); |
| 3382 | 2658 | $actions = array_merge( $actions, $plugin_actions ); |
| 3383 | 2659 | return $actions; |
| @@ -3386,10 +2662,10 @@ | ||
| 3386 | 2662 | public function wpdbbkp_update_backup_info($FileName, $logFile, $logMessage = '') { |
| 3387 | 2663 | $path_info = wp_upload_dir(); |
| 3388 | 2664 | $filename = $FileName . '.sql'; |
| 3389 | 2665 | $WPDBFileName = $FileName . '.zip'; |
| 3390 | - wp_delete_file($this->wp_db_backup_wp_config_path() . '/' . $filename); | |
| 3391 | - wp_delete_file($this->wp_db_backup_wp_config_path() . '/wp_installer.php'); | |
| 2666 | + @unlink($this->wp_db_backup_wp_config_path() . '/' . $filename); | |
| 2667 | + @unlink($this->wp_db_backup_wp_config_path() . '/wp_installer.php'); | |
| 3392 | 2668 | @$filesize = filesize($path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/' . $WPDBFileName); |
| 3393 | 2669 | |
| 3394 | 2670 | $upload_path = array( |
| 3395 | 2671 | 'filename' => ($WPDBFileName), |
| @@ -3413,19 +2689,18 @@ | ||
| 3413 | 2689 | } |
| 3414 | 2690 | |
| 3415 | 2691 | private function write_log($logFile, $logMessage) { |
| 3416 | 2692 | // Actually write the log file |
| 3417 | - if ( empty( $logMessage ) || empty( $logFile ) ) { | |
| 3418 | - return false; | |
| 3419 | - } | |
| 3420 | - global $wp_filesystem; | |
| 3421 | - if(!function_exists('WP_Filesystem')){ | |
| 3422 | - require_once ( ABSPATH . '/wp-admin/includes/file.php' ); | |
| 3423 | - } | |
| 3424 | - WP_Filesystem(); | |
| 3425 | - $logDir = dirname( $logFile ); | |
| 3426 | - if ($wp_filesystem && $wp_filesystem->is_writable($logDir)) { | |
| 3427 | - $wp_filesystem->put_contents( $logFile, $logMessage, FS_CHMOD_FILE ); | |
| 2693 | + if (is_writable($logFile) || !file_exists($logFile)) { | |
| 2694 | + | |
| 2695 | + if (!$handle = @fopen($logFile, 'a')) | |
| 2696 | + return; | |
| 2697 | + | |
| 2698 | + if (!fwrite($handle, $logMessage)) | |
| 2699 | + return; | |
| 2700 | + | |
| 2701 | + fclose($handle); | |
| 2702 | + | |
| 3428 | 2703 | return true; |
| 3429 | 2704 | } |
| 3430 | 2705 | } |
| 3431 | 2706 | |
| @@ -3486,11 +2761,12 @@ | ||
| 3486 | 2761 | } |
| 3487 | 2762 | |
| 3488 | 2763 | // Zip up $this->root without excludes |
| 3489 | 2764 | else { |
| 3490 | - | |
| 2765 | + // error_log('without exclude rule'); | |
| 3491 | 2766 | $stderr = shell_exec('cd ' . escapeshellarg($this->get_root()) . ' && ' . escapeshellcmd($this->get_zip_command_path()) . ' -rq ' . escapeshellarg($WPDBFileName) . ' ./' . ' 2>&1'); |
| 3492 | 2767 | } |
| 2768 | + error_log($stderr); | |
| 3493 | 2769 | if (!empty($stderr)) |
| 3494 | 2770 | $this->warning($this->get_archive_method(), $stderr); |
| 3495 | 2771 | |
| 3496 | 2772 | return $this->verify_archive($WPDBFileName); |
| @@ -3506,9 +2782,9 @@ | ||
| 3506 | 2782 | |
| 3507 | 2783 | public function set_root($path) { |
| 3508 | 2784 | |
| 3509 | 2785 | if (empty($path) || !is_string($path) || !is_dir($path)) |
| 3510 | - throw new Exception('Invalid root path <code>' . esc_html($path) . '</code> must be a valid directory path'); | |
| 2786 | + throw new Exception('Invalid root path <code>' . $path . '</code> must be a valid directory path'); | |
| 3511 | 2787 | |
| 3512 | 2788 | $this->root = self::conform_dir($path); |
| 3513 | 2789 | } |
| 3514 | 2790 | |
| @@ -3557,59 +2833,56 @@ | ||
| 3557 | 2833 | $excludes = WPDB_BACKUPS_DIR . '|' . $wp_all_backup_exclude_dir; |
| 3558 | 2834 | } |
| 3559 | 2835 | |
| 3560 | 2836 | $excludes = explode("|", $excludes); |
| 3561 | - if(!empty($excludes) && is_array($excludes)){ | |
| 3562 | - foreach ($excludes as $key => &$rule) { | |
| 2837 | + foreach ($excludes as $key => &$rule) { | |
| 3563 | 2838 | |
| 3564 | - $file = $absolute = $fragment = false; | |
| 3565 | - | |
| 3566 | - // Files don't end with / | |
| 3567 | - if (!in_array(substr($rule, -1), array('\\', '/'))) | |
| 3568 | - $file = true; | |
| 3569 | - | |
| 3570 | - // If rule starts with a / then treat as absolute path | |
| 3571 | - elseif (in_array(substr($rule, 0, 1), array('\\', '/'))) | |
| 3572 | - $absolute = true; | |
| 3573 | - | |
| 3574 | - // Otherwise treat as dir fragment | |
| 3575 | - else | |
| 3576 | - $fragment = true; | |
| 3577 | - | |
| 3578 | - // Strip $this->root and conform | |
| 3579 | - $rule = str_ireplace($this->get_root(), '', untrailingslashit(self::conform_dir($rule))); | |
| 3580 | - | |
| 3581 | - // Strip the preceeding slash | |
| 3582 | - if (in_array(substr($rule, 0, 1), array('\\', '/'))) | |
| 3583 | - $rule = substr($rule, 1); | |
| 3584 | - | |
| 3585 | - // Escape string for regex | |
| 3586 | - if ($context === 'regex') | |
| 3587 | - $rule = str_replace('.', '\.', $rule); | |
| 3588 | - | |
| 3589 | - // Convert any existing wildcards | |
| 3590 | - if ($wildcard !== '*' && strpos($rule, '*') !== false) | |
| 3591 | - $rule = str_replace('*', $wildcard, $rule); | |
| 3592 | - | |
| 3593 | - // Wrap directory fragments and files in wildcards for zip | |
| 3594 | - if ($context === 'zip' && ( $fragment || $file )) | |
| 3595 | - $rule = $wildcard . $rule . $wildcard; | |
| 3596 | - | |
| 3597 | - // Add a wildcard to the end of absolute url for zips | |
| 3598 | - if ($context === 'zip' && $absolute) | |
| 3599 | - $rule .= $wildcard; | |
| 3600 | - | |
| 3601 | - // Add and end carrot to files for pclzip but only if it doesn't end in a wildcard | |
| 3602 | - if ($file && $context === 'regex') | |
| 3603 | - $rule .= '$'; | |
| 3604 | - | |
| 3605 | - // Add a start carrot to absolute urls for pclzip | |
| 3606 | - if ($absolute && $context === 'regex') | |
| 3607 | - $rule = '^' . $rule; | |
| 3608 | - } | |
| 3609 | - } | |
| 3610 | - | |
| 2839 | + $file = $absolute = $fragment = false; | |
| 3611 | 2840 | |
| 2841 | + // Files don't end with / | |
| 2842 | + if (!in_array(substr($rule, -1), array('\\', '/'))) | |
| 2843 | + $file = true; | |
| 2844 | + | |
| 2845 | + // If rule starts with a / then treat as absolute path | |
| 2846 | + elseif (in_array(substr($rule, 0, 1), array('\\', '/'))) | |
| 2847 | + $absolute = true; | |
| 2848 | + | |
| 2849 | + // Otherwise treat as dir fragment | |
| 2850 | + else | |
| 2851 | + $fragment = true; | |
| 2852 | + | |
| 2853 | + // Strip $this->root and conform | |
| 2854 | + $rule = str_ireplace($this->get_root(), '', untrailingslashit(self::conform_dir($rule))); | |
| 2855 | + | |
| 2856 | + // Strip the preceeding slash | |
| 2857 | + if (in_array(substr($rule, 0, 1), array('\\', '/'))) | |
| 2858 | + $rule = substr($rule, 1); | |
| 2859 | + | |
| 2860 | + // Escape string for regex | |
| 2861 | + if ($context === 'regex') | |
| 2862 | + $rule = str_replace('.', '\.', $rule); | |
| 2863 | + | |
| 2864 | + // Convert any existing wildcards | |
| 2865 | + if ($wildcard !== '*' && strpos($rule, '*') !== false) | |
| 2866 | + $rule = str_replace('*', $wildcard, $rule); | |
| 2867 | + | |
| 2868 | + // Wrap directory fragments and files in wildcards for zip | |
| 2869 | + if ($context === 'zip' && ( $fragment || $file )) | |
| 2870 | + $rule = $wildcard . $rule . $wildcard; | |
| 2871 | + | |
| 2872 | + // Add a wildcard to the end of absolute url for zips | |
| 2873 | + if ($context === 'zip' && $absolute) | |
| 2874 | + $rule .= $wildcard; | |
| 2875 | + | |
| 2876 | + // Add and end carrot to files for pclzip but only if it doesn't end in a wildcard | |
| 2877 | + if ($file && $context === 'regex') | |
| 2878 | + $rule .= '$'; | |
| 2879 | + | |
| 2880 | + // Add a start carrot to absolute urls for pclzip | |
| 2881 | + if ($absolute && $context === 'regex') | |
| 2882 | + $rule = '^' . $rule; | |
| 2883 | + } | |
| 2884 | + | |
| 3612 | 2885 | // Escape shell args for zip command |
| 3613 | 2886 | if ($context === 'zip') |
| 3614 | 2887 | $excludes = array_map('escapeshellarg', array_unique($excludes)); |
| 3615 | 2888 | |
| @@ -3626,9 +2899,9 @@ | ||
| 3626 | 2899 | return true; |
| 3627 | 2900 | |
| 3628 | 2901 | // If there are errors delete the backup file. |
| 3629 | 2902 | if ($this->get_errors($this->get_archive_method()) && file_exists($WPDBFileName)) |
| 3630 | - wp_delete_file($WPDBFileName); | |
| 2903 | + unlink($WPDBFileName); | |
| 3631 | 2904 | |
| 3632 | 2905 | // If the archive file still exists assume it's good |
| 3633 | 2906 | if (file_exists($WPDBFileName)) |
| 3634 | 2907 | return $this->archive_verified = true; |
| @@ -3663,10 +2936,8 @@ | ||
| 3663 | 2936 | } |
| 3664 | 2937 | |
| 3665 | 2938 | public function wpdbbkp_get_timeago( $time ) |
| 3666 | 2939 | { |
| 3667 | - $time = intval($time) > 0 ? intval($time) : time(); | |
| 3668 | - | |
| 3669 | 2940 | $time_difference = time() - $time; |
| 3670 | 2941 | |
| 3671 | 2942 | if( $time_difference < 1 ) { return 'less than 1 second ago'; } |
| 3672 | 2943 | $condition = array( 12 * 30 * 24 * 60 * 60 => 'year', |
| @@ -3684,143 +2955,8 @@ | ||
| 3684 | 2955 | if( $d >= 1 ) |
| 3685 | 2956 | { |
| 3686 | 2957 | $t = floor( $d ); |
| 3687 | 2958 | return 'About ' . $t . ' ' . $str . ( $t > 1 ? 's' : '' ) . ' ago'; |
| 3688 | - } | |
| 3689 | - } | |
| 3690 | - } | |
| 3691 | - | |
| 3692 | - private function wpdbbkp_append_to_file($file_path, $content_to_append){ | |
| 3693 | - global $wp_filesystem; | |
| 3694 | - | |
| 3695 | - if (!function_exists('WP_Filesystem')) { | |
| 3696 | - require_once ABSPATH . 'wp-admin/includes/file.php'; | |
| 3697 | - } | |
| 3698 | - | |
| 3699 | - | |
| 3700 | - if (empty($wp_filesystem)) { | |
| 3701 | - WP_Filesystem(); | |
| 3702 | - } | |
| 3703 | - | |
| 3704 | - if (!$wp_filesystem) { | |
| 3705 | - return false; | |
| 3706 | - } | |
| 3707 | - | |
| 3708 | - // Check if the file exists | |
| 3709 | - if ($wp_filesystem->exists($file_path)) { | |
| 3710 | - // Open the file in append mode | |
| 3711 | - $handle = $wp_filesystem->get_contents($file_path); | |
| 3712 | - | |
| 3713 | - if ($handle) { | |
| 3714 | - // Append the new content | |
| 3715 | - $result = $wp_filesystem->put_contents($file_path, $handle . $content_to_append, FS_CHMOD_FILE); | |
| 3716 | - return $result !== false; | |
| 3717 | - } | |
| 3718 | - } else { | |
| 3719 | - // If the file doesn't exist, create it with the initial content | |
| 3720 | - $result = $wp_filesystem->put_contents($file_path, $content_to_append, FS_CHMOD_FILE); | |
| 3721 | - return $result !== false; | |
| 3722 | - } | |
| 3723 | - | |
| 3724 | - return false; | |
| 3725 | - } | |
| 3726 | - | |
| 3727 | - public function wpdbbkp_cloudbackup_notice(){ | |
| 3728 | - $user_id = get_current_user_id(); | |
| 3729 | - $wpdbbkp_cloudbackup_notice = get_option( 'wpdb_clouddrive_token', false ); | |
| 3730 | - | |
| 3731 | - if( $wpdbbkp_cloudbackup_notice ){ | |
| 3732 | - return; | |
| 3733 | - } | |
| 3734 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 3735 | - return; | |
| 3736 | - } | |
| 3737 | - | |
| 3738 | - if ( get_user_meta( $user_id, 'wpdbbkp_cloudbackup_notice_dismissed', true ) ) { | |
| 3739 | - return; | |
| 3740 | - } | |
| 3741 | - | |
| 3742 | - $nonce = wp_create_nonce( 'wpdbbkp_cloudbackup_notice_dismissed' ) | |
| 3743 | - ?> | |
| 3744 | - <div class="notice notice-info is-dismissible" id="wpdbbkp_cloudbackup_dismiss"> | |
| 3745 | - <p><?php echo esc_html__('Take a free 14-day trial of BackupforWP Cloud Backup.', 'wpdbbkp').'<a href="'.esc_url('https://backupforwp.com/register?from=plugin_notice').'" target="_blank">'.esc_html__('Get Started in 2 Minutes.', 'wpdbbkp'). '</a>';?></p> | |
| 3746 | - </div> | |
| 3747 | - <script type="text/javascript"> | |
| 3748 | - jQuery(document).ready(function($) { | |
| 3749 | - // Handle dismiss action | |
| 3750 | - $(document).on('click', '#wpdbbkp_cloudbackup_dismiss .notice-dismiss', function() { | |
| 3751 | - var ajaxurl = "<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>"; | |
| 3752 | - $.post(ajaxurl, { | |
| 3753 | - action: 'wpdbbkp_cloudbackup_dismiss_notice', | |
| 3754 | - nonce: '<?php echo esc_js( $nonce ); ?>' | |
| 3755 | - }); | |
| 3756 | - }); | |
| 3757 | - }); | |
| 3758 | - </script> | |
| 3759 | - <?php | |
| 3760 | - } | |
| 3761 | - public function wpdbbkp_cloudbackup_dismiss_notice() { | |
| 3762 | - | |
| 3763 | - | |
| 3764 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 3765 | - wp_die( esc_html__( 'Permission denied', 'wpdbbkp' ), '', [ 'response' => 403 ] ); | |
| 3766 | - } | |
| 3767 | - | |
| 3768 | - // Verify the nonce | |
| 3769 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( wp_unslash( $_POST['nonce'] ), 'wpdbbkp_cloudbackup_notice_dismissed' ) ) { //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- using as nonce | |
| 3770 | - wp_die( esc_html__( 'Invalid nonce', 'wpdbbkp' ), '', [ 'response' => 403 ] ); | |
| 3771 | - } | |
| 3772 | - | |
| 3773 | - $user_id = get_current_user_id(); | |
| 3774 | - update_user_meta( $user_id, 'wpdbbkp_cloudbackup_notice_dismissed', 1 ); | |
| 3775 | - wp_die(); | |
| 3776 | - } | |
| 3777 | - | |
| 3778 | - public function admin_backup_file_download() { | |
| 3779 | - if ( ! current_user_can( 'manage_options' ) ) { | |
| 3780 | - return; | |
| 3781 | - } | |
| 3782 | - | |
| 3783 | - // Check for a specific query parameter, e.g., ?download_backup=filename.zip | |
| 3784 | - if ( isset( $_GET['wpdbbkp_download'] ) && ! empty( $_GET['wpdbbkp_download'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3785 | - $path_info = wp_upload_dir(); | |
| 3786 | - $backup_dir = $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/'; | |
| 3787 | - $file_name = basename( sanitize_text_field( wp_unslash( $_GET['wpdbbkp_download'] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3788 | - $file_path = trailingslashit( $backup_dir ) . $file_name; | |
| 3789 | - | |
| 3790 | - | |
| 3791 | - // Check if file exists | |
| 3792 | - if ( file_exists( $file_path ) ) { | |
| 3793 | - // Serve the file | |
| 3794 | - header( 'Content-Description: File Transfer' ); | |
| 3795 | - header( 'Content-Type: application/octet-stream' ); | |
| 3796 | - header( 'Content-Disposition: attachment; filename="' . $file_name . '"' ); | |
| 3797 | - header( 'Content-Length: ' . filesize( $file_path ) ); | |
| 3798 | - readfile( $file_path ); //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- readfile is used to read the file with buffer | |
| 3799 | - exit; | |
| 3800 | - } else { | |
| 3801 | - wp_die( esc_html__( 'Backup file not found.', 'wpdbbkp' ) ); | |
| 3802 | - } | |
| 3803 | - } | |
| 3804 | - // Check for a specific query parameter, e.g., ?download_backup=filename.zip | |
| 3805 | - if ( isset( $_GET['wpdbbkp_log'] ) && ! empty( $_GET['wpdbbkp_log'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3806 | - $path_info = wp_upload_dir(); | |
| 3807 | - $backup_dir = $path_info['basedir'] . '/' . WPDB_BACKUPS_DIR . '/log/'; | |
| 3808 | - $file_name = basename( sanitize_text_field( wp_unslash( $_GET['wpdbbkp_log'] ) ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no form submission | |
| 3809 | - $file_path = trailingslashit( $backup_dir ) . $file_name; | |
| 3810 | - | |
| 3811 | - | |
| 3812 | - // Check if file exists | |
| 3813 | - if ( file_exists( $file_path ) ) { | |
| 3814 | - // Serve the file | |
| 3815 | - header( 'Content-Description: File Transfer' ); | |
| 3816 | - header( 'Content-Type: application/octet-stream' ); | |
| 3817 | - header( 'Content-Disposition: attachment; filename="' . $file_name . '"' ); | |
| 3818 | - header( 'Content-Length: ' . filesize( $file_path ) ); | |
| 3819 | - readfile( $file_path ); //phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- readfile is used to read the file with buffer | |
| 3820 | - exit; | |
| 3821 | - } else { | |
| 3822 | - wp_die( esc_html__( 'Backup file not found.', 'wpdbbkp' ) ); | |
| 3823 | 2959 | } |
| 3824 | 2960 | } |
| 3825 | 2961 | } |
| 3826 | 2962 | |