/** * Panel showing form to restore previous Snapshot. * * @since 1.0.2 * @uses metaboxes setup in $this->admin_menu_proc() * @uses $_REQUEST['item'] * @uses $this->config_data['items'] * * @param none * @return none */ function snapshot_admin_show_restore_panel($item) { global $wpmudev_snapshot; require( $wpmudev_snapshot->snapshot_get_setting('SNAPSHOT_PLUGIN_BASE_DIR'). '/lib/snapshot_admin_metaboxes.php' ); $this->_snapshot_metaboxes = new wpmudev_snapshot_admin_metaboxes( ); if ((isset($_GET['snapshot-data-item'])) && (isset($item['data'][intval($_GET['snapshot-data-item'])]))) { $data_item_key = intval($_GET['snapshot-data-item']); ?> <div id="snapshot-settings-metaboxes-general" class="wrap snapshot-wrap"> <?php screen_icon('snapshot'); ?> <h2><?php _ex("Restore Snapshot", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?></h2> <p class="snapshot-restore-description"><?php _ex("On this page you can restore a previous snapshot. Using the 'Restore Options' section below you can also opt to turn off all plugins as well as switch to a different theme as part of the restore.", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?></p> <div id='snapshot-ajax-warning' class='updated fade'><p><?php _e('You are about to restore a previous version of your WordPress database. This will remove any new information added since the snapshot backup.', SNAPSHOT_I18N_DOMAIN); ?></p></div> <?php if (!snapshot_utility_check_server_timeout()) { $current_timeout = ini_get('max_execution_time'); ?><div class='error snapshot-error'><p><?php printf(__('Your web server timeout is set very low, %d seconds. Also, it appears this timeout cannot be adjusted via the Snapshot restore process. Attempting a snapshot restore could result in a partial restore of your tables.', SNAPSHOT_I18N_DOMAIN), $current_timeout); ?></p></div><?php } ?> <?php snapshot_utility_form_ajax_panels(); ?> <?php if (isset($_GET['snapshot-data-item'])) { $data_item = $item['data'][$_GET['snapshot-data-item']]; } $backupFolder = $wpmudev_snapshot->snapshot_get_item_destination_path($item, $data_item); if (empty($backupFolder)) { $backupFolder = $wpmudev_snapshot->snapshot_get_setting('backupBaseFolderFull'); } if ((isset($data_item['filename'])) && (strlen($data_item['filename']))) { $manifest_filename = snapshot_utility_extract_archive_manifest(trailingslashit($backupFolder) . $data_item['filename']); if ($manifest_filename) { //echo "manifest_filename=[". $manifest_filename ."]<br />"; $manifest_data = snapshot_utility_consume_archive_manifest($manifest_filename); if ($manifest_data) { //echo "manifest_data<pre>"; print_r($manifest_data); echo "</pre>"; $item['MANIFEST'] = $manifest_data; } } } ?> <div id="poststuff" class="metabox-holder"> <form id="snapshot-edit-restore" action="<?php echo $wpmudev_snapshot->snapshot_get_setting('SNAPSHOT_MENU_URL'); ?>snapshots_edit_panel" method="post"> <input type="hidden" name="snapshot-action" value="restore-request" /> <input type="hidden" name="item" value="<?php echo $item['timestamp']; ?>" /> <?php wp_nonce_field('snapshot-restore', 'snapshot-noonce-field'); ?> <?php $this->_snapshot_metaboxes->snapshot_metaboxes_show_item_header_information( __('Snapshot Information', SNAPSHOT_I18N_DOMAIN), $item, true ); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_archive_files( __('Selected Archive to Restore', SNAPSHOT_I18N_DOMAIN), $item, true ); ?> <?php //if (is_multisite()) { $this->_snapshot_metaboxes->snapshot_metabox_restore_blog_options( __('Restore Blog Options', SNAPSHOT_I18N_DOMAIN), $item ); //} ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_restore_tables_options( __('What Tables to Restore?', SNAPSHOT_I18N_DOMAIN), $item, $data_item_key); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_show_restore_files_options( __('What Files to Restore?', SNAPSHOT_I18N_DOMAIN), $item, $data_item_key); ?> <?php $this->_snapshot_metaboxes->snapshot_metabox_restore_options( __('Restore Theme Options', SNAPSHOT_I18N_DOMAIN), $item ); ?> <input id="snapshot-form-restore-submit" class="button-primary" <?php if (!$data_item_key) { ?> disabled="disabled" <?php } ?> type="submit" value="<?php _e('Restore Snapshot', SNAPSHOT_I18N_DOMAIN); ?>" /> <a class="button-secondary" href="<?php echo $wpmudev_snapshot->snapshot_get_setting('SNAPSHOT_MENU_URL'); ?> snapshots_edit_panel"><?php _e('Cancel', SNAPSHOT_I18N_DOMAIN); ?></a> </form> </div> </div> <?php } else { ?> <div id="snapshot-settings-metaboxes-general" class="wrap snapshot-wrap"> <?php screen_icon('snapshot'); ?> <h2><?php _ex("Restore Snapshot", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?></h2> <p class="snapshot-restore-description"><?php _ex("ERROR: Missing argument. Please return to the main Snapshot panel and select the archive to restore. ", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?><a href="?page=snapshots_edit_panel">Snapshot</a>.</p> </div> <?php } }
function snapshot_destination_edit_panel() { global $wpmudev_snapshot; ?> <div id="snapshot-metaboxes-destination_add" class="wrap snapshot-wrap"> <?php screen_icon('snapshot'); ?> <?php $item = 0; if (isset($_REQUEST['snapshot-action'])) { if (sanitize_text_field($_REQUEST['snapshot-action']) == "edit") { ?> <h2><?php _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?></h2> <p><?php _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?></p> <?php if (isset($_REQUEST['item'])) { $item_key = sanitize_text_field($_REQUEST['item']); if (isset($wpmudev_snapshot->config_data['destinations'][$item_key])) { $item = $wpmudev_snapshot->config_data['destinations'][$item_key]; } } } else if (sanitize_text_field($_REQUEST['snapshot-action']) == "add") { ?> <h2><?php _ex("Add Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?></h2> <p><?php _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?></p> <?php unset($item); $item = array(); if (isset($_REQUEST['type'])) { $item['type'] = sanitize_text_field($_REQUEST['type']); } } else if (sanitize_text_field($_REQUEST['snapshot-action']) == "update") { ?> <h2><?php _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN); ?></h2> <p><?php _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN); ?></p> <?php if (isset($_POST['snapshot-destination'])) { $item = $_POST['snapshot-destination']; } } } if ($item) { snapshot_utility_form_ajax_panels(); ?> <form action="<?php echo $wpmudev_snapshot->snapshot_get_setting('SNAPSHOT_MENU_URL'); ?>snapshots_destinations_panel&snapshot-action=<?php echo urlencode(sanitize_text_field($_GET['snapshot-action'])); ?>&type=<?php echo urlencode($item['type']); ?>" method="post"> <?php if ((sanitize_text_field($_GET['snapshot-action']) == "edit") || (sanitize_text_field($_GET['snapshot-action']) == "update")) { ?> <input type="hidden" name="snapshot-action" value="update" /> <input type="hidden" name="item" value="<?php echo sanitize_text_field($_GET['item']); ?>" /> <?php wp_nonce_field('snapshot-update-destination', 'snapshot-noonce-field'); ?> <?php } else if (sanitize_text_field($_GET['snapshot-action']) == "add") { ?> <input type="hidden" name="snapshot-action" value="add" /> <?php wp_nonce_field('snapshot-add-destination', 'snapshot-noonce-field'); ?> <?php } $item_object = snapshot_destination_get_object_from_type($item['type']); if (($item_object) && (is_object($item_object))) { $item_object->display_details_form($item); } ?> <input class="button-primary" type="submit" value="<?php _e('Save Destination', SNAPSHOT_I18N_DOMAIN); ?>" /> <a class="button-secondary" href="<?php echo $wpmudev_snapshot->snapshot_get_setting('SNAPSHOT_MENU_URL'); ?>snapshots_destinations_panel"><?php _e('Cancel', SNAPSHOT_I18N_DOMAIN); ?></a> </div> </form> <?php } ?> </div> <?php }