<td> <?php if (defined('HMBKP_ROOT')) { ?> <p><?php printf(__('You\'ve set it to: %s', 'hmbkp'), '<code>' . HMBKP_ROOT . '</code>'); ?> </p> <?php } ?> <p><?php printf(__('The root directory that is backed up. Defaults to %s.', 'hmbkp'), '<code>' . HM_Backup::get_home_path() . '</code>'); ?> <?php _e('e.g.', 'hmbkp'); ?> <code>define( 'HMBKP_ROOT', ABSPATH . 'wp/' );</code></p> </td> </tr> <tr<?php if (defined('HMBKP_SCHEDULE_TIME') && HMBKP_SCHEDULE_TIME !== '11pm') { ?> class="hmbkp_active"<?php }
/** * Send the download file to the browser and then redirect back to the backups page */ function hmbkp_request_download_backup() { check_admin_referer('hmbkp_download_backup', 'hmbkp_download_backup_nonce'); if (!file_exists(sanitize_text_field(base64_decode($_GET['hmbkp_backup_archive'])))) { return; } $url = str_replace(HM_Backup::conform_dir(HM_Backup::get_home_path()), home_url(), trailingslashit(dirname(sanitize_text_field(base64_decode($_GET['hmbkp_backup_archive']))))) . urlencode(pathinfo(sanitize_text_field(base64_decode($_GET['hmbkp_backup_archive'])), PATHINFO_BASENAME)); global $is_apache; if ($is_apache) { HMBKP_Path::get_instance()->protect_path('reset'); $url = add_query_arg('key', HMBKP_SECURE_KEY, $url); } wp_safe_redirect($url, 303); die; }
function hmbkp_is_path_accessible($dir) { if (strpos($dir, HM_Backup::get_home_path()) === false) { // path is inaccessible return false; } return true; }
/** * Send the download file to the browser and * then redirect back to the backups page */ function hmbkp_request_download_backup() { global $is_apache; if (empty($_GET['hmbkp_download_backup']) || !check_admin_referer('hmbkp-download_backup') || !file_exists(sanitize_text_field(base64_decode($_GET['hmbkp_download_backup'])))) { return; } $url = str_replace(HM_Backup::conform_dir(HM_Backup::get_home_path()), home_url(), trailingslashit(dirname(sanitize_text_field(base64_decode($_GET['hmbkp_download_backup']))))) . urlencode(pathinfo(sanitize_text_field(base64_decode($_GET['hmbkp_download_backup'])), PATHINFO_BASENAME)); if ($is_apache) { // Force the .htaccess to be rebuilt if (file_exists(hmbkp_path() . '/.htaccess')) { unlink(hmbkp_path() . '/.htaccess'); } hmbkp_path(); $url = add_query_arg('key', HMBKP_SECURE_KEY, $url); } wp_redirect($url, 303); die; }