Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp...
File: admin.php
}
[2500] Fix | Delete
} elseif (preg_match('/^downloaded:(\d+):(.*)$/', $file, $matches) && file_exists($matches[2])) {
[2501] Fix | Delete
$response['p'] = 100;
[2502] Fix | Delete
$response['f'] = $matches[2];
[2503] Fix | Delete
$response['s'] = (int) $matches[1];
[2504] Fix | Delete
$response['t'] = (int) $matches[1];
[2505] Fix | Delete
$response['m'] = __('File ready.', 'updraftplus');
[2506] Fix | Delete
if ('db' != substr($type, 0, 2)) $response['can_show_contents'] = true;
[2507] Fix | Delete
} elseif (preg_match('/^downloading:(\d+):(.*)$/', $file, $matches) && file_exists($matches[2])) {
[2508] Fix | Delete
// Convert to bytes
[2509] Fix | Delete
$response['f'] = $matches[2];
[2510] Fix | Delete
$total_size = (int) max($matches[1], 1);
[2511] Fix | Delete
$cur_size = filesize($matches[2]);
[2512] Fix | Delete
$response['s'] = $cur_size;
[2513] Fix | Delete
$file_age = time() - filemtime($matches[2]);
[2514] Fix | Delete
if ($file_age > 20) $response['a'] = time() - filemtime($matches[2]);
[2515] Fix | Delete
$response['t'] = $total_size;
[2516] Fix | Delete
$response['m'] .= __("Download in progress", 'updraftplus').' ('.round($cur_size/1024).' / '.round(($total_size/1024)).' KB)';
[2517] Fix | Delete
$response['p'] = round(100*$cur_size/$total_size);
[2518] Fix | Delete
} else {
[2519] Fix | Delete
$response['m'] .= __('No local copy present.', 'updraftplus');
[2520] Fix | Delete
$response['p'] = 0;
[2521] Fix | Delete
$response['s'] = 0;
[2522] Fix | Delete
$response['t'] = 1;
[2523] Fix | Delete
}
[2524] Fix | Delete
}
[2525] Fix | Delete
return $response;
[2526] Fix | Delete
}
[2527] Fix | Delete
[2528] Fix | Delete
/**
[2529] Fix | Delete
* Used with the WP filter upload_dir to adjust where uploads go to when uploading a backup
[2530] Fix | Delete
*
[2531] Fix | Delete
* @param Array $uploads - pre-filter array
[2532] Fix | Delete
*
[2533] Fix | Delete
* @return Array - filtered array
[2534] Fix | Delete
*/
[2535] Fix | Delete
public function upload_dir($uploads) {
[2536] Fix | Delete
global $updraftplus;
[2537] Fix | Delete
$updraft_dir = $updraftplus->backups_dir_location();
[2538] Fix | Delete
if (is_writable($updraft_dir)) $uploads['path'] = $updraft_dir;
[2539] Fix | Delete
return $uploads;
[2540] Fix | Delete
}
[2541] Fix | Delete
[2542] Fix | Delete
/**
[2543] Fix | Delete
* We do actually want to over-write
[2544] Fix | Delete
*
[2545] Fix | Delete
* @param String $dir Directory
[2546] Fix | Delete
* @param String $name Name
[2547] Fix | Delete
* @param String $ext File extension
[2548] Fix | Delete
*
[2549] Fix | Delete
* @return String
[2550] Fix | Delete
*/
[2551] Fix | Delete
public function unique_filename_callback($dir, $name, $ext) {// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Filter use
[2552] Fix | Delete
return $name.$ext;
[2553] Fix | Delete
}
[2554] Fix | Delete
[2555] Fix | Delete
public function sanitize_file_name($filename) {
[2556] Fix | Delete
// WordPress 3.4.2 on multisite (at least) adds in an unwanted underscore
[2557] Fix | Delete
return preg_replace('/-db(.*)\.gz_\.crypt$/', '-db$1.gz.crypt', $filename);
[2558] Fix | Delete
}
[2559] Fix | Delete
[2560] Fix | Delete
/**
[2561] Fix | Delete
* Runs upon the WordPress action plupload_action
[2562] Fix | Delete
*/
[2563] Fix | Delete
public function plupload_action() {
[2564] Fix | Delete
[2565] Fix | Delete
global $updraftplus;
[2566] Fix | Delete
if (function_exists('set_time_limit')) @set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2567] Fix | Delete
[2568] Fix | Delete
if (!UpdraftPlus_Options::user_can_manage()) return;
[2569] Fix | Delete
check_ajax_referer('updraft-uploader');
[2570] Fix | Delete
[2571] Fix | Delete
$updraft_dir = $updraftplus->backups_dir_location();
[2572] Fix | Delete
if (!@UpdraftPlus_Filesystem_Functions::really_is_writable($updraft_dir)) {// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2573] Fix | Delete
echo json_encode(array('e' => sprintf(__("Backup directory (%s) is not writable, or does not exist.", 'updraftplus'), $updraft_dir).' '.__('You will find more information about this in the Settings section.', 'updraftplus')));
[2574] Fix | Delete
exit;
[2575] Fix | Delete
}
[2576] Fix | Delete
[2577] Fix | Delete
add_filter('upload_dir', array($this, 'upload_dir'));
[2578] Fix | Delete
add_filter('sanitize_file_name', array($this, 'sanitize_file_name'));
[2579] Fix | Delete
// handle file upload
[2580] Fix | Delete
[2581] Fix | Delete
$farray = array('test_form' => true, 'action' => 'plupload_action');
[2582] Fix | Delete
[2583] Fix | Delete
$farray['test_type'] = false;
[2584] Fix | Delete
$farray['ext'] = 'x-gzip';
[2585] Fix | Delete
$farray['type'] = 'application/octet-stream';
[2586] Fix | Delete
[2587] Fix | Delete
if (!isset($_POST['chunks'])) {
[2588] Fix | Delete
$farray['unique_filename_callback'] = array($this, 'unique_filename_callback');
[2589] Fix | Delete
}
[2590] Fix | Delete
[2591] Fix | Delete
$status = wp_handle_upload(
[2592] Fix | Delete
$_FILES['async-upload'],
[2593] Fix | Delete
$farray
[2594] Fix | Delete
);
[2595] Fix | Delete
remove_filter('upload_dir', array($this, 'upload_dir'));
[2596] Fix | Delete
remove_filter('sanitize_file_name', array($this, 'sanitize_file_name'));
[2597] Fix | Delete
[2598] Fix | Delete
if (isset($status['error'])) {
[2599] Fix | Delete
echo json_encode(array('e' => $status['error']));
[2600] Fix | Delete
exit;
[2601] Fix | Delete
}
[2602] Fix | Delete
[2603] Fix | Delete
// If this was the chunk, then we should instead be concatenating onto the final file
[2604] Fix | Delete
if (isset($_POST['chunks']) && isset($_POST['chunk']) && preg_match('/^[0-9]+$/', $_POST['chunk'])) {
[2605] Fix | Delete
[2606] Fix | Delete
$final_file = basename($_POST['name']);
[2607] Fix | Delete
[2608] Fix | Delete
if (!rename($status['file'], $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp')) {
[2609] Fix | Delete
@unlink($status['file']);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2610] Fix | Delete
echo json_encode(array('e' => sprintf(__('Error: %s', 'updraftplus'), __('This file could not be uploaded', 'updraftplus'))));
[2611] Fix | Delete
exit;
[2612] Fix | Delete
}
[2613] Fix | Delete
[2614] Fix | Delete
$status['file'] = $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp';
[2615] Fix | Delete
[2616] Fix | Delete
}
[2617] Fix | Delete
[2618] Fix | Delete
$response = array();
[2619] Fix | Delete
if (!isset($_POST['chunks']) || (isset($_POST['chunk']) && preg_match('/^[0-9]+$/', $_POST['chunk']) && $_POST['chunk'] == $_POST['chunks']-1) && isset($final_file)) {
[2620] Fix | Delete
if (!preg_match('/^log\.[a-f0-9]{12}\.txt/i', $final_file) && !preg_match('/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-([\-a-z]+)([0-9]+)?(\.(zip|gz|gz\.crypt))?$/i', $final_file, $matches)) {
[2621] Fix | Delete
$accept = apply_filters('updraftplus_accept_archivename', array());
[2622] Fix | Delete
if (is_array($accept)) {
[2623] Fix | Delete
foreach ($accept as $acc) {
[2624] Fix | Delete
if (preg_match('/'.$acc['pattern'].'/i', $final_file)) {
[2625] Fix | Delete
$response['dm'] = sprintf(__('This backup was created by %s, and can be imported.', 'updraftplus'), $acc['desc']);
[2626] Fix | Delete
}
[2627] Fix | Delete
}
[2628] Fix | Delete
}
[2629] Fix | Delete
if (empty($response['dm'])) {
[2630] Fix | Delete
if (isset($status['file'])) @unlink($status['file']);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2631] Fix | Delete
echo json_encode(array('e' => sprintf(__('Error: %s', 'updraftplus'), __('Bad filename format - this does not look like a file created by UpdraftPlus', 'updraftplus'))));
[2632] Fix | Delete
exit;
[2633] Fix | Delete
}
[2634] Fix | Delete
} else {
[2635] Fix | Delete
$backupable_entities = $updraftplus->get_backupable_file_entities(true);
[2636] Fix | Delete
$type = isset($matches[3]) ? $matches[3] : '';
[2637] Fix | Delete
if (!preg_match('/^log\.[a-f0-9]{12}\.txt/', $final_file) && 'db' != $type && !isset($backupable_entities[$type])) {
[2638] Fix | Delete
if (isset($status['file'])) @unlink($status['file']);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2639] Fix | Delete
echo json_encode(array('e' => sprintf(__('Error: %s', 'updraftplus'), sprintf(__('This looks like a file created by UpdraftPlus, but this install does not know about this type of object: %s. Perhaps you need to install an add-on?', 'updraftplus'), htmlspecialchars($type)))));
[2640] Fix | Delete
exit;
[2641] Fix | Delete
}
[2642] Fix | Delete
}
[2643] Fix | Delete
[2644] Fix | Delete
// Final chunk? If so, then stich it all back together
[2645] Fix | Delete
if (isset($_POST['chunk']) && $_POST['chunk'] == $_POST['chunks']-1 && !empty($final_file)) {
[2646] Fix | Delete
if ($wh = fopen($updraft_dir.'/'.$final_file, 'wb')) {
[2647] Fix | Delete
for ($i = 0; $i < $_POST['chunks']; $i++) {
[2648] Fix | Delete
$rf = $updraft_dir.'/'.$final_file.'.'.$i.'.zip.tmp';
[2649] Fix | Delete
if ($rh = fopen($rf, 'rb+')) {
[2650] Fix | Delete
[2651] Fix | Delete
// April 1st 2020 - Due to a bug during uploads to Dropbox some backups had string "null" appended to the end which caused warnings, this removes the string "null" from these backups
[2652] Fix | Delete
fseek($rh, -4, SEEK_END);
[2653] Fix | Delete
$data = fgets($rh, 5);
[2654] Fix | Delete
[2655] Fix | Delete
if ("null" === $data) {
[2656] Fix | Delete
ftruncate($rh, filesize($rf) - 4);
[2657] Fix | Delete
}
[2658] Fix | Delete
[2659] Fix | Delete
fseek($rh, 0, SEEK_SET);
[2660] Fix | Delete
[2661] Fix | Delete
while ($line = fread($rh, 262144)) {
[2662] Fix | Delete
fwrite($wh, $line);
[2663] Fix | Delete
}
[2664] Fix | Delete
fclose($rh);
[2665] Fix | Delete
@unlink($rf);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2666] Fix | Delete
}
[2667] Fix | Delete
}
[2668] Fix | Delete
fclose($wh);
[2669] Fix | Delete
$status['file'] = $updraft_dir.'/'.$final_file;
[2670] Fix | Delete
if ('.tar' == substr($final_file, -4, 4)) {
[2671] Fix | Delete
if (file_exists($status['file'].'.gz')) unlink($status['file'].'.gz');
[2672] Fix | Delete
if (file_exists($status['file'].'.bz2')) unlink($status['file'].'.bz2');
[2673] Fix | Delete
} elseif ('.tar.gz' == substr($final_file, -7, 7)) {
[2674] Fix | Delete
if (file_exists(substr($status['file'], 0, strlen($status['file'])-3))) unlink(substr($status['file'], 0, strlen($status['file'])-3));
[2675] Fix | Delete
if (file_exists(substr($status['file'], 0, strlen($status['file'])-3).'.bz2')) unlink(substr($status['file'], 0, strlen($status['file'])-3).'.bz2');
[2676] Fix | Delete
} elseif ('.tar.bz2' == substr($final_file, -8, 8)) {
[2677] Fix | Delete
if (file_exists(substr($status['file'], 0, strlen($status['file'])-4))) unlink(substr($status['file'], 0, strlen($status['file'])-4));
[2678] Fix | Delete
if (file_exists(substr($status['file'], 0, strlen($status['file'])-4).'.gz')) unlink(substr($status['file'], 0, strlen($status['file'])-3).'.gz');
[2679] Fix | Delete
}
[2680] Fix | Delete
}
[2681] Fix | Delete
}
[2682] Fix | Delete
[2683] Fix | Delete
}
[2684] Fix | Delete
[2685] Fix | Delete
// send the uploaded file url in response
[2686] Fix | Delete
$response['m'] = $status['url'];
[2687] Fix | Delete
echo json_encode($response);
[2688] Fix | Delete
exit;
[2689] Fix | Delete
}
[2690] Fix | Delete
[2691] Fix | Delete
/**
[2692] Fix | Delete
* Database decrypter - runs upon the WP action plupload_action2
[2693] Fix | Delete
*/
[2694] Fix | Delete
public function plupload_action2() {
[2695] Fix | Delete
[2696] Fix | Delete
if (function_exists('set_time_limit')) @set_time_limit(UPDRAFTPLUS_SET_TIME_LIMIT);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2697] Fix | Delete
global $updraftplus;
[2698] Fix | Delete
[2699] Fix | Delete
if (!UpdraftPlus_Options::user_can_manage()) return;
[2700] Fix | Delete
check_ajax_referer('updraft-uploader');
[2701] Fix | Delete
[2702] Fix | Delete
$updraft_dir = $updraftplus->backups_dir_location();
[2703] Fix | Delete
if (!is_writable($updraft_dir)) exit;
[2704] Fix | Delete
[2705] Fix | Delete
add_filter('upload_dir', array($this, 'upload_dir'));
[2706] Fix | Delete
add_filter('sanitize_file_name', array($this, 'sanitize_file_name'));
[2707] Fix | Delete
// handle file upload
[2708] Fix | Delete
[2709] Fix | Delete
$farray = array('test_form' => true, 'action' => 'plupload_action2');
[2710] Fix | Delete
[2711] Fix | Delete
$farray['test_type'] = false;
[2712] Fix | Delete
$farray['ext'] = 'crypt';
[2713] Fix | Delete
$farray['type'] = 'application/octet-stream';
[2714] Fix | Delete
[2715] Fix | Delete
if (isset($_POST['chunks'])) {
[2716] Fix | Delete
// $farray['ext'] = 'zip';
[2717] Fix | Delete
// $farray['type'] = 'application/zip';
[2718] Fix | Delete
} else {
[2719] Fix | Delete
$farray['unique_filename_callback'] = array($this, 'unique_filename_callback');
[2720] Fix | Delete
}
[2721] Fix | Delete
[2722] Fix | Delete
$status = wp_handle_upload(
[2723] Fix | Delete
$_FILES['async-upload'],
[2724] Fix | Delete
$farray
[2725] Fix | Delete
);
[2726] Fix | Delete
remove_filter('upload_dir', array($this, 'upload_dir'));
[2727] Fix | Delete
remove_filter('sanitize_file_name', array($this, 'sanitize_file_name'));
[2728] Fix | Delete
[2729] Fix | Delete
if (isset($status['error'])) die('ERROR: '.$status['error']);
[2730] Fix | Delete
[2731] Fix | Delete
// If this was the chunk, then we should instead be concatenating onto the final file
[2732] Fix | Delete
if (isset($_POST['chunks']) && isset($_POST['chunk']) && preg_match('/^[0-9]+$/', $_POST['chunk'])) {
[2733] Fix | Delete
$final_file = basename($_POST['name']);
[2734] Fix | Delete
rename($status['file'], $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp');
[2735] Fix | Delete
$status['file'] = $updraft_dir.'/'.$final_file.'.'.$_POST['chunk'].'.zip.tmp';
[2736] Fix | Delete
}
[2737] Fix | Delete
[2738] Fix | Delete
if (!isset($_POST['chunks']) || (isset($_POST['chunk']) && $_POST['chunk'] == $_POST['chunks']-1)) {
[2739] Fix | Delete
if (!preg_match('/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-db([0-9]+)?\.(gz\.crypt)$/i', $final_file)) {
[2740] Fix | Delete
[2741] Fix | Delete
@unlink($status['file']);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2742] Fix | Delete
echo 'ERROR:'.__('Bad filename format - this does not look like an encrypted database file created by UpdraftPlus', 'updraftplus');
[2743] Fix | Delete
exit;
[2744] Fix | Delete
}
[2745] Fix | Delete
[2746] Fix | Delete
// Final chunk? If so, then stich it all back together
[2747] Fix | Delete
if (isset($_POST['chunk']) && $_POST['chunk'] == $_POST['chunks']-1 && isset($final_file)) {
[2748] Fix | Delete
if ($wh = fopen($updraft_dir.'/'.$final_file, 'wb')) {
[2749] Fix | Delete
for ($i=0; $i<$_POST['chunks']; $i++) {
[2750] Fix | Delete
$rf = $updraft_dir.'/'.$final_file.'.'.$i.'.zip.tmp';
[2751] Fix | Delete
if ($rh = fopen($rf, 'rb')) {
[2752] Fix | Delete
while ($line = fread($rh, 32768)) {
[2753] Fix | Delete
fwrite($wh, $line);
[2754] Fix | Delete
}
[2755] Fix | Delete
fclose($rh);
[2756] Fix | Delete
@unlink($rf);// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2757] Fix | Delete
}
[2758] Fix | Delete
}
[2759] Fix | Delete
fclose($wh);
[2760] Fix | Delete
}
[2761] Fix | Delete
}
[2762] Fix | Delete
[2763] Fix | Delete
}
[2764] Fix | Delete
[2765] Fix | Delete
// send the uploaded file url in response
[2766] Fix | Delete
if (isset($final_file)) echo 'OK:'.$final_file;
[2767] Fix | Delete
exit;
[2768] Fix | Delete
}
[2769] Fix | Delete
[2770] Fix | Delete
/**
[2771] Fix | Delete
* Show footer review message and link.
[2772] Fix | Delete
*
[2773] Fix | Delete
* @return string
[2774] Fix | Delete
*/
[2775] Fix | Delete
public function display_footer_review_message() {
[2776] Fix | Delete
$message = sprintf(
[2777] Fix | Delete
__('Enjoyed %s? Please leave us a %s rating. We really appreciate your support!', 'updraftplus'),
[2778] Fix | Delete
'<b>UpdraftPlus</b>',
[2779] Fix | Delete
'<a href="https://www.g2.com/products/updraftplus/reviews" target="_blank">&starf;&starf;&starf;&starf;&starf;</a>'
[2780] Fix | Delete
);
[2781] Fix | Delete
return $message;
[2782] Fix | Delete
}
[2783] Fix | Delete
[2784] Fix | Delete
/**
[2785] Fix | Delete
* Include the settings header template
[2786] Fix | Delete
*/
[2787] Fix | Delete
public function settings_header() {
[2788] Fix | Delete
$this->include_template('wp-admin/settings/header.php');
[2789] Fix | Delete
}
[2790] Fix | Delete
[2791] Fix | Delete
/**
[2792] Fix | Delete
* Include the settings footer template
[2793] Fix | Delete
*/
[2794] Fix | Delete
public function settings_footer() {
[2795] Fix | Delete
$this->include_template('wp-admin/settings/footer.php');
[2796] Fix | Delete
}
[2797] Fix | Delete
[2798] Fix | Delete
/**
[2799] Fix | Delete
* Output the settings page content. Will also run a restore if $_REQUEST so indicates.
[2800] Fix | Delete
*/
[2801] Fix | Delete
public function settings_output() {
[2802] Fix | Delete
[2803] Fix | Delete
if (false == ($render = apply_filters('updraftplus_settings_page_render', true))) {
[2804] Fix | Delete
do_action('updraftplus_settings_page_render_abort', $render);
[2805] Fix | Delete
return;
[2806] Fix | Delete
}
[2807] Fix | Delete
[2808] Fix | Delete
do_action('updraftplus_settings_page_init');
[2809] Fix | Delete
[2810] Fix | Delete
global $updraftplus;
[2811] Fix | Delete
[2812] Fix | Delete
/**
[2813] Fix | Delete
* We use request here because the initial restore is triggered by a POSTed form. we then may need to obtain credential for the WP_Filesystem. to do this WP outputs a form, but we don't pass our parameters via that. So the values are passed back in as GET parameters.
[2814] Fix | Delete
*/
[2815] Fix | Delete
if (isset($_REQUEST['action']) && (('updraft_restore' == $_REQUEST['action'] && isset($_REQUEST['backup_timestamp'])) || ('updraft_restore_continue' == $_REQUEST['action'] && !empty($_REQUEST['job_id'])))) {
[2816] Fix | Delete
$this->prepare_restore();
[2817] Fix | Delete
return;
[2818] Fix | Delete
}
[2819] Fix | Delete
[2820] Fix | Delete
if (isset($_REQUEST['action']) && 'updraft_delete_old_dirs' == $_REQUEST['action']) {
[2821] Fix | Delete
$nonce = empty($_REQUEST['updraft_delete_old_dirs_nonce']) ? '' : $_REQUEST['updraft_delete_old_dirs_nonce'];
[2822] Fix | Delete
if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) die('Security check');
[2823] Fix | Delete
$this->delete_old_dirs_go();
[2824] Fix | Delete
return;
[2825] Fix | Delete
}
[2826] Fix | Delete
[2827] Fix | Delete
if (!empty($_REQUEST['action']) && 'updraftplus_broadcastaction' == $_REQUEST['action'] && !empty($_REQUEST['subaction'])) {
[2828] Fix | Delete
$nonce = (empty($_REQUEST['nonce'])) ? "" : $_REQUEST['nonce'];
[2829] Fix | Delete
if (!wp_verify_nonce($nonce, 'updraftplus-credentialtest-nonce')) die('Security check');
[2830] Fix | Delete
do_action($_REQUEST['subaction']);
[2831] Fix | Delete
return;
[2832] Fix | Delete
}
[2833] Fix | Delete
[2834] Fix | Delete
if (isset($_GET['error'])) {
[2835] Fix | Delete
// This is used by Microsoft OneDrive authorisation failures (May 15). I am not sure what may have been using the 'error' GET parameter otherwise - but it is harmless.
[2836] Fix | Delete
if (!empty($_GET['error_description'])) {
[2837] Fix | Delete
$this->show_admin_warning(htmlspecialchars($_GET['error_description']).' ('.htmlspecialchars($_GET['error']).')', 'error');
[2838] Fix | Delete
} else {
[2839] Fix | Delete
$this->show_admin_warning(htmlspecialchars($_GET['error']), 'error');
[2840] Fix | Delete
}
[2841] Fix | Delete
}
[2842] Fix | Delete
[2843] Fix | Delete
if (isset($_GET['message'])) $this->show_admin_warning(htmlspecialchars($_GET['message']));
[2844] Fix | Delete
[2845] Fix | Delete
if (isset($_GET['action']) && 'updraft_create_backup_dir' == $_GET['action'] && isset($_GET['nonce']) && wp_verify_nonce($_GET['nonce'], 'create_backup_dir')) {
[2846] Fix | Delete
$created = $this->create_backup_dir();
[2847] Fix | Delete
if (is_wp_error($created)) {
[2848] Fix | Delete
echo '<p>'.__('Backup directory could not be created', 'updraftplus').'...<br>';
[2849] Fix | Delete
echo '<ul class="disc">';
[2850] Fix | Delete
foreach ($created->get_error_messages() as $msg) {
[2851] Fix | Delete
echo '<li>'.htmlspecialchars($msg).'</li>';
[2852] Fix | Delete
}
[2853] Fix | Delete
echo '</ul></p>';
[2854] Fix | Delete
} elseif (false !== $created) {
[2855] Fix | Delete
echo '<p>'.__('Backup directory successfully created.', 'updraftplus').'</p><br>';
[2856] Fix | Delete
}
[2857] Fix | Delete
echo '<b>'.__('Actions', 'updraftplus').':</b> <a href="'.UpdraftPlus_Options::admin_page_url().'?page=updraftplus">'.__('Return to UpdraftPlus configuration', 'updraftplus').'</a>';
[2858] Fix | Delete
return;
[2859] Fix | Delete
}
[2860] Fix | Delete
[2861] Fix | Delete
if (substr($updraftplus->version, 0, 1) === '2') {
[2862] Fix | Delete
/**
[2863] Fix | Delete
* Add filter for display footer review message and link.
[2864] Fix | Delete
*/
[2865] Fix | Delete
add_filter('admin_footer_text', array($this, 'display_footer_review_message'));
[2866] Fix | Delete
}
[2867] Fix | Delete
[2868] Fix | Delete
echo '<div id="updraft_backup_started" class="updated updraft-hidden" style="display:none;"></div>';
[2869] Fix | Delete
[2870] Fix | Delete
// This opens a div
[2871] Fix | Delete
$this->settings_header();
[2872] Fix | Delete
?>
[2873] Fix | Delete
[2874] Fix | Delete
<div id="updraft-hidethis">
[2875] Fix | Delete
<p>
[2876] Fix | Delete
<strong><?php _e('Warning:', 'updraftplus'); ?> <?php _e("If you can still read these words after the page finishes loading, then there is a JavaScript or jQuery problem in the site.", 'updraftplus'); ?></strong>
[2877] Fix | Delete
[2878] Fix | Delete
<?php if (false !== strpos(basename(UPDRAFTPLUS_URL), ' ')) { ?>
[2879] Fix | Delete
<strong><?php _e('The UpdraftPlus directory in wp-content/plugins has white-space in it; WordPress does not like this. You should rename the directory to wp-content/plugins/updraftplus to fix this problem.', 'updraftplus');?></strong>
[2880] Fix | Delete
<?php } else { ?>
[2881] Fix | Delete
<a href="<?php echo apply_filters('updraftplus_com_link', "https://updraftplus.com/do-you-have-a-javascript-or-jquery-error/");?>" target="_blank"><?php _e('Go here for more information.', 'updraftplus'); ?></a>
[2882] Fix | Delete
<?php } ?>
[2883] Fix | Delete
</p>
[2884] Fix | Delete
</div>
[2885] Fix | Delete
[2886] Fix | Delete
<?php
[2887] Fix | Delete
[2888] Fix | Delete
$include_deleteform_div = true;
[2889] Fix | Delete
[2890] Fix | Delete
// Opens a div, which needs closing later
[2891] Fix | Delete
if (isset($_GET['updraft_restore_success'])) {
[2892] Fix | Delete
[2893] Fix | Delete
if (get_template() === 'optimizePressTheme' || is_plugin_active('optimizePressPlugin') || is_plugin_active_for_network('optimizePressPlugin')) {
[2894] Fix | Delete
$this->show_admin_warning("<a href='https://optimizepress.zendesk.com/hc/en-us/articles/203699826-Update-URL-References-after-moving-domain' target='_blank'>" . __("OptimizePress 2.0 encodes its contents, so search/replace does not work.", "updraftplus") . ' ' . __("To fix this problem go here.", "updraftplus") . "</a>", "notice notice-warning");
[2895] Fix | Delete
}
[2896] Fix | Delete
$success_advert = (isset($_GET['pval']) && 0 == $_GET['pval'] && !$updraftplus->have_addons) ? '<p>'.__('For even more features and personal support, check out ', 'updraftplus').'<strong><a href="'.$updraftplus->get_url('premium').'" target="_blank">UpdraftPlus Premium</a>.</strong></p>' : "";
[2897] Fix | Delete
[2898] Fix | Delete
echo "<div class=\"updated backup-restored\"><span><strong>".__('Your backup has been restored.', 'updraftplus').'</strong></span><br>';
[2899] Fix | Delete
// Unnecessary - will be advised of this below
[2900] Fix | Delete
// if (2 == $_GET['updraft_restore_success']) echo ' '.__('Your old (themes, uploads, plugins, whatever) directories have been retained with "-old" appended to their name. Remove them when you are satisfied that the backup worked properly.');
[2901] Fix | Delete
echo $success_advert;
[2902] Fix | Delete
$include_deleteform_div = false;
[2903] Fix | Delete
[2904] Fix | Delete
}
[2905] Fix | Delete
[2906] Fix | Delete
if ($this->scan_old_dirs(true)) $this->print_delete_old_dirs_form(true, $include_deleteform_div);
[2907] Fix | Delete
[2908] Fix | Delete
// Close the div opened by the earlier section
[2909] Fix | Delete
if (isset($_GET['updraft_restore_success'])) echo '</div>';
[2910] Fix | Delete
[2911] Fix | Delete
if (empty($success_advert) && empty($this->no_settings_warning)) {
[2912] Fix | Delete
[2913] Fix | Delete
if (!class_exists('UpdraftPlus_Notices')) include_once(UPDRAFTPLUS_DIR.'/includes/updraftplus-notices.php');
[2914] Fix | Delete
global $updraftplus_notices;
[2915] Fix | Delete
[2916] Fix | Delete
$backup_history = UpdraftPlus_Backup_History::get_history();
[2917] Fix | Delete
$review_dismiss = UpdraftPlus_Options::get_updraft_option('dismissed_review_notice', 0);
[2918] Fix | Delete
$backup_dir = $updraftplus->backups_dir_location();
[2919] Fix | Delete
// N.B. Not an exact proxy for the installed time; they may have tweaked the expert option to move the directory
[2920] Fix | Delete
$installed = @filemtime($backup_dir.'/index.html');// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
[2921] Fix | Delete
$installed_for = time() - $installed;
[2922] Fix | Delete
[2923] Fix | Delete
$advert = false;
[2924] Fix | Delete
if (!empty($backup_history) && $installed && time() > $review_dismiss && $installed_for > 28*86400 && $installed_for < 84*86400) {
[2925] Fix | Delete
$advert = 'rate';
[2926] Fix | Delete
}
[2927] Fix | Delete
[2928] Fix | Delete
$updraftplus_notices->do_notice($advert);
[2929] Fix | Delete
}
[2930] Fix | Delete
[2931] Fix | Delete
if (!$updraftplus->memory_check(64)) {
[2932] Fix | Delete
// HS8390 - A case where UpdraftPlus::memory_check_current() returns -1
[2933] Fix | Delete
$memory_check_current = $updraftplus->memory_check_current();
[2934] Fix | Delete
if ($memory_check_current > 0) {
[2935] Fix | Delete
?>
[2936] Fix | Delete
<div class="updated memory-limit"><?php _e('Your PHP memory limit (set by your web hosting company) is very low. UpdraftPlus attempted to raise it but was unsuccessful. This plugin may struggle with a memory limit of less than 64 Mb - especially if you have very large files uploaded (though on the other hand, many sites will be successful with a 32Mb limit - your experience may vary).', 'updraftplus');?> <?php _e('Current limit is:', 'updraftplus');?> <?php echo $updraftplus->memory_check_current(); ?> MB</div>
[2937] Fix | Delete
<?php }
[2938] Fix | Delete
}
[2939] Fix | Delete
[2940] Fix | Delete
[2941] Fix | Delete
if (!empty($updraftplus->errors)) {
[2942] Fix | Delete
echo '<div class="error updraft_list_errors">';
[2943] Fix | Delete
$updraftplus->list_errors();
[2944] Fix | Delete
echo '</div>';
[2945] Fix | Delete
}
[2946] Fix | Delete
[2947] Fix | Delete
$backup_history = UpdraftPlus_Backup_History::get_history();
[2948] Fix | Delete
if (empty($backup_history)) {
[2949] Fix | Delete
UpdraftPlus_Backup_History::rebuild();
[2950] Fix | Delete
$backup_history = UpdraftPlus_Backup_History::get_history();
[2951] Fix | Delete
}
[2952] Fix | Delete
[2953] Fix | Delete
$tabflag = 'backups';
[2954] Fix | Delete
$main_tabs = $this->get_main_tabs_array();
[2955] Fix | Delete
[2956] Fix | Delete
if (isset($_REQUEST['tab'])) {
[2957] Fix | Delete
$request_tab = sanitize_text_field($_REQUEST['tab']);
[2958] Fix | Delete
$valid_tabflags = array_keys($main_tabs);
[2959] Fix | Delete
if (in_array($request_tab, $valid_tabflags)) {
[2960] Fix | Delete
$tabflag = $request_tab;
[2961] Fix | Delete
} else {
[2962] Fix | Delete
$tabflag = 'backups';
[2963] Fix | Delete
}
[2964] Fix | Delete
}
[2965] Fix | Delete
[2966] Fix | Delete
$this->include_template('wp-admin/settings/tab-bar.php', false, array('main_tabs' => $main_tabs, 'backup_history' => $backup_history, 'tabflag' => $tabflag));
[2967] Fix | Delete
?>
[2968] Fix | Delete
[2969] Fix | Delete
<div id="updraft-poplog" >
[2970] Fix | Delete
<pre id="updraft-poplog-content"></pre>
[2971] Fix | Delete
</div>
[2972] Fix | Delete
[2973] Fix | Delete
<?php
[2974] Fix | Delete
$this->include_template('wp-admin/settings/delete-and-restore-modals.php');
[2975] Fix | Delete
?>
[2976] Fix | Delete
[2977] Fix | Delete
<div id="updraft-navtab-backups-content" <?php if ('backups' != $tabflag) echo 'class="updraft-hidden"'; ?> style="<?php if ('backups' != $tabflag) echo 'display:none;'; ?>">
[2978] Fix | Delete
<?php
[2979] Fix | Delete
$is_opera = (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') || false !== strpos($_SERVER['HTTP_USER_AGENT'], 'OPR/'));
[2980] Fix | Delete
$tmp_opts = array('include_opera_warning' => $is_opera);
[2981] Fix | Delete
$this->include_template('wp-admin/settings/tab-backups.php', false, array('backup_history' => $backup_history, 'options' => $tmp_opts));
[2982] Fix | Delete
$this->include_template('wp-admin/settings/upload-backups-modal.php');
[2983] Fix | Delete
?>
[2984] Fix | Delete
</div>
[2985] Fix | Delete
[2986] Fix | Delete
<div id="updraft-navtab-migrate-content"<?php if ('migrate' != $tabflag) echo ' class="updraft-hidden"'; ?> style="<?php if ('migrate' != $tabflag) echo 'display:none;'; ?>">
[2987] Fix | Delete
<?php
[2988] Fix | Delete
if (has_action('updraftplus_migrate_tab_output')) {
[2989] Fix | Delete
do_action('updraftplus_migrate_tab_output');
[2990] Fix | Delete
} else {
[2991] Fix | Delete
$this->include_template('wp-admin/settings/migrator-no-migrator.php');
[2992] Fix | Delete
}
[2993] Fix | Delete
?>
[2994] Fix | Delete
</div>
[2995] Fix | Delete
[2996] Fix | Delete
<div id="updraft-navtab-settings-content" <?php if ('settings' != $tabflag) echo 'class="updraft-hidden"'; ?> style="<?php if ('settings' != $tabflag) echo 'display:none;'; ?>">
[2997] Fix | Delete
<h2 class="updraft_settings_sectionheading"><?php _e('Backup Contents And Schedule', 'updraftplus');?></h2>
[2998] Fix | Delete
<?php UpdraftPlus_Options::options_form_begin(); ?>
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function