Beispiel #1
0
    $vbulletin->input->clean_array_gpc('f', array('settingsfile' => TYPE_FILE));
    if (is_demo_mode()) {
        print_cp_message('This function is disabled within demo mode');
    }
    // got an uploaded file?
    if (file_exists($vbulletin->GPC['settingsfile']['tmp_name'])) {
        $xml = file_read($vbulletin->GPC['settingsfile']['tmp_name']);
    } else {
        if (file_exists($vbulletin->GPC['serverfile'])) {
            $xml = file_read($vbulletin->GPC['serverfile']);
        } else {
            print_stop_message('no_file_uploaded_and_no_local_file_found');
        }
    }
    if ($vbulletin->GPC['restore']) {
        xml_restore_settings($xml, $vbulletin->GPC['blacklist']);
    } else {
        xml_import_settings($xml);
    }
    print_cp_redirect("options.php?" . $vbulletin->session->vars['sessionurl'], 0);
}
// ###################### Start import settings XML #######################
if ($_REQUEST['do'] == 'files') {
    if (is_demo_mode()) {
        print_cp_message('This function is disabled within demo mode');
    }
    $vbulletin->input->clean_array_gpc('r', array('type' => TYPE_NOHTML));
    // download form
    print_form_header('options', 'download', 0, 1, 'downloadform', '90%', '', true, 'post" target="download');
    print_table_header($vbphrase['download']);
    print_select_row($vbphrase['product'], 'product', fetch_product_list());
Beispiel #2
0
 /**
  * This function gets the settings for given product or vbulletin if not specified
  * @param string $settingsFile url
  * @param string $serverFile url
  * @param string $restore
  * @param boolean $blacklist
  * @return array
  */
 public function importSettingsXML($settingsFile, $serverFile, $restore, $blacklist)
 {
     $this->checkHasAdminPermission('canadminsettings');
     require_once DIR . '/includes/class_xml.php';
     require_once DIR . '/includes/functions_file.php';
     require_once DIR . '/includes/adminfunctions_options.php';
     $response = array();
     $xml = null;
     // got an uploaded file?
     // do not use file_exists here, under IIS it will return false in some cases
     if ($settingsFile) {
         if (is_uploaded_file($settingsFile['tmp_name'])) {
             $xml = file_read($settingsFile['tmp_name']);
         }
     } else {
         if ($serverFile) {
             if (file_exists($serverFile)) {
                 $xml = file_read($serverFile);
             }
         } else {
             throw new vB_Exception_Api('no_file_uploaded_and_no_local_file_found_gerror');
         }
     }
     if ($xml) {
         if ($restore) {
             xml_restore_settings($xml, $blacklist);
         } else {
             xml_import_settings($xml);
         }
     }
     $response['import'] = true;
     return $response;
 }