Esempio n. 1
0
 */
session_start();
if (!$_SESSION['fm_entry']) {
    die('Not a Valid Entry');
}
include_once "../../lang/" . $_SESSION['lang'] . ".lang.php";
include_once "../../lib/func.php";
include_once "../../lib/sysfunc.php";
include_once "func.php";
extract(stripslashes_r($_POST));
setenvlang();
if (!is_dir($dir) && !@mkdir($dir)) {
    echo "{$strMkDirFailed} " . hc($dir);
    exit;
}
$res = extract_files($archive, $dir, $type);
if ($type != "zip") {
    if (!empty($res)) {
        echo $strExtractFailed . " " . hc($archive) . "<br>" . hs($res[0]);
        exit;
    }
    if ($type == "gz" || $type == "bz2") {
        $bn = substr($archive, 0, strrpos($archive, '.'));
        @rename($bn, $dir . "/" . basename($bn));
    }
    echo "success";
    exit;
} else {
    if (!$res) {
        echo $strExtractFailed . " " . hc($archive) . "<br>" . hc($ar->errorInfo(true));
        exit;
Esempio n. 2
0
<?php

$page_title = 'Unzipping Backup File';
require_once '_header.php';
echo '<div class="wrap">';
echo pb_backupbuddy::$classes['import']->status_box('Extracting backup ZIP file with ImportBuddy v' . pb_backupbuddy::$options['bb_version'] . '... Powered by BackupBuddy.');
echo '<div id="pb_importbuddy_working"><img src="' . pb_backupbuddy::plugin_url() . '/images/loading_large.gif" title="Working... Please wait as this may take a moment..."></div>';
flush();
$results = extract_files();
echo '<script type="text/javascript">jQuery("#pb_importbuddy_working").hide();</script>';
if (true === $results) {
    // Move on to next step.
    echo '<br><br><p style="text-align: center;">Files successfully extracted.</p>';
    echo '<form action="?step=3" method=post>';
    echo '<input type="hidden" name="options" value="' . htmlspecialchars(serialize(pb_backupbuddy::$options)) . '" />';
    echo '</div><!-- /wrap -->';
    echo '<div class="main_box_foot"><input type="submit" name="submit" value="Next Step &rarr;" class="button" /></div>';
    echo '</form>';
} else {
    pb_backupbuddy::alert('File extraction process did not complete successfully. Unable to continue to next step. Manually extract the backup ZIP file and choose to "Skip File Extraction" from the advanced options on Step 1.', true, '9005');
    echo '<p style="text-align: center;"><a href="http://pluginbuddy.com/tutorials/unzip-backup-zip-file-in-cpanel/">Click here for instructions on manual ZIP extraction as a work-around.</a></p>';
    echo '</div><!-- /wrap -->';
}
rename_htaccess_temp();
// Rename .htaccess to .htaccess.bb_temp until end of migration.
get_dat_from_backup();
require_once '_footer.php';
Esempio n. 3
0
function execute_backup_restore($dump_options)
{
    global $ADMIN_PATH;
    // Disable time limit
    @set_time_limit(0);
    $str = get_tr();
    echo '<h1>' . $str['restore_init'] . "</h1>\n";
    flush();
    global $known_arrays;
    // Array of archive names that may present in backup. FIXME: change variable name to something related with it's meaning!
    if (!isset($_POST['mysql_host']) || !isset($_POST['mysql_user']) || !isset($_POST['mysql_password']) || !isset($_POST['mysql_db_name']) || !$_POST['mysql_db_name'] || !isset($_POST['mysql_charset'])) {
        echo '<p class="error">' . $str['err_nosettings'] . '</p>';
        return show_form($dump_options);
    }
    // Get MySQL settings
    $MYSQL_HOST = trim($_POST['mysql_host']);
    if ($MYSQL_HOST === "") {
        $MYSQL_HOST = "localhost";
    }
    $MYSQL_USER = trim($_POST['mysql_user']);
    $MYSQL_PASSWORD = $_POST['mysql_password'];
    $MYSQL_DB_NAME = trim($_POST['mysql_db_name']);
    $MYSQL_CHARSET = trim($_POST['mysql_charset']);
    if ($MYSQL_CHARSET === "") {
        $MYSQL_CHARSET = "utf8";
    }
    // Restore database dump
    echo $str['dbrestore'] . "\n";
    flush();
    $dump_result = restore_dump($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DB_NAME, $MYSQL_CHARSET);
    if ($dump_result !== true) {
        echo '<p class="error">' . $str['err_restore'] . ': ' . $dump_result . '</p>';
        return show_form($dump_options);
    }
    echo $str['done'] . '<br />';
    flush();
    if ($dump_options['mode'] != 'sql') {
        // Extract files
        extract_files($known_arrays);
        // Update vars.inc.php
        update_varsinc($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DB_NAME, $MYSQL_CHARSET);
    }
    echo '<p>' . $str['finish_text'] . ' <a href="' . $ADMIN_PATH . '">' . $str['finish_link_title'] . '</a>.</p>';
}