Exemplo n.º 1
0
 // Get the backup_file
 switch ($_REQUEST['migration_type']) {
     case 'select':
         // Select a backup file from the backups directory
         if (isset($_REQUEST['backup_file']) && !empty($_REQUEST['backup_file'])) {
             $backupFile = array('name' => $_REQUEST['backup_file']);
         } else {
             // No backup file was selected
             $display .= INST_getAlertMsg($LANG_MIGRATE[18]);
             $backupFile = false;
             $importErrors++;
         }
         break;
     case 'upload':
         // Upload a new backup file
         if ($upload_error = INST_getUploadError($_FILES['backup_file'])) {
             // If an error occured while uploading the file
             // or if no backup file was selected
             $display .= INST_getAlertMsg($upload_error);
             $backupFile = false;
             $importErrors++;
         } else {
             $backupFile = $_FILES['backup_file'];
         }
         break;
     case 'dbcontent':
         // No upload / import required - use db as is
         $backupFile = false;
         $importErrors = 0;
         break;
     default:
Exemplo n.º 2
0
    $display .= '<p>' . sprintf($LANG_INSTALL[5], SUPPORTED_PHP_VER) . $phpv[0] . '.' . $phpv[1] . '.' . (int) $phpv[2] . $LANG_INSTALL[6] . '</p>' . LB;
} else {
    // Ok, the user's version of PHP is supported. Let's move on
    switch ($step) {
        /**
         * Step 1 - Display the upload form and allow
         * the user to select which plugins to install
         */
        case 1:
            // If 'file_uploads' is enabled in php.ini and the plugin directories are writable by the web server.
            $upload_enabled = ini_get('file_uploads') && is_writable($_CONF['path'] . 'plugins/') && is_writable($_CONF['path_html']) && is_writable(INST_getAdminPath() . 'plugins/') ? true : false;
            $display .= '<p>' . $LANG_PLUGINS[3] . ($upload_enabled ? ' ' . $LANG_PLUGINS[4] : '') . '</p>' . LB;
            // Check if a plugin file was uploaded
            $upload_success = false;
            if (isset($_FILES['plugin'])) {
                if ($error_msg = INST_getUploadError($_FILES['plugin'])) {
                    // If an error occured while uploading the file.
                    $display .= '<div class="notice"><span class="error">' . $LANG_INSTALL[38] . '</span> ' . $error_msg . '</div>' . LB;
                } else {
                    $plugin_file = $_CONF['path_data'] . $_FILES['plugin']['name'];
                    // Name the plugin file
                    if ($_FILES['plugin']['type'] == 'application/zip') {
                        // Zip
                        require_once 'Archive/Zip.php';
                        // import Archive_Zip library
                        $archive = new Archive_Zip($_FILES['plugin']['tmp_name']);
                        // Use PEAR's Archive_Zip to extract the package
                    } else {
                        // Tarball
                        require_once 'Archive/Tar.php';
                        // import Archive_Tar library