Example #1
0
 /**
  * Step #1 - Import Settings XML
  *
  */
 function step_1()
 {
     build_forum_permissions();
     vBulletinHook::build_datastore($this->db);
     build_product_datastore();
     build_activitystream_datastore();
     if (VB_AREA == 'Upgrade') {
         $this->show_message($this->phrase['final']['import_latest_options']);
         require_once DIR . '/includes/adminfunctions_options.php';
         if (!($xml = file_read(DIR . '/install/vbulletin-settings.xml'))) {
             $this->add_error(sprintf($this->phrase['vbphrase']['file_not_found'], 'vbulletin-settings.xml'), self::PHP_TRIGGER_ERROR, true);
             return;
         }
         $this->show_message(sprintf($this->phrase['vbphrase']['importing_file'], 'vbulletin-settings.xml'));
         xml_import_settings($xml);
         $this->show_message($this->phrase['core']['import_done']);
     } else {
         $this->skip_message();
     }
 }
Example #2
0
     }
     echo '<p>Importing vbulletin-style.xml</p>';
     xml_import_style($xml);
     // define those phrases that are used for the import
     $vbphrase['style'] = 'Style';
     $vbphrase['please_wait'] = 'Please Wait';
     build_all_styles(0, 1);
     break;
 case 'settings':
     require_once './includes/adminfunctions_options.php';
     if (!($xml = file_read('./install/vbulletin-settings.xml'))) {
         echo '<p>Uh oh, ./install/vbulletin-settings.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
         print_cp_footer();
     }
     echo '<p>Importing vbulletin-settings.xml';
     xml_import_settings($xml);
     echo '<br /><span class="smallfont"><b>Okay</b></span></p>';
     break;
 case 'language':
     require_once './includes/adminfunctions_language.php';
     if (!($xml = file_read('./install/vbulletin-language.xml'))) {
         echo '<p>Uh oh, ./install/vbulletin-language.xml doesn\'t appear to exist! Upload it and refresh the page.</p>';
         print_cp_footer();
     }
     echo '<p>Importing vbulletin-language.xml';
     xml_import_language($xml);
     build_language();
     echo '<br /><span class="smallfont"><b>Okay</b></span></p>';
     break;
 case 'adminhelp':
     require_once './includes/adminfunctions_help.php';
Example #3
0
    /**
     * Step #5 - Ask Options...
     *
     */
    function step_5($data = null)
    {
        require_once DIR . '/includes/adminfunctions_options.php';
        if ($data['response']) {
            $this->registry->options = array('bbtitle' => $data['htmldata']['bbtitle'], 'hometitle' => $data['htmldata']['hometitle'], 'bburl' => $data['htmldata']['bburl'], 'homeurl' => $data['htmldata']['homeurl'], 'webmasteremail' => $data['htmldata']['webmasteremail']);
            if (!($xml = file_read(DIR . '/install/vbulletin-settings.xml'))) {
                $this->add_error(sprintf($this->phrase['vbphrase']['file_not_found'], 'vbulletin-settings.xml'), self::PHP_TRIGGER_ERROR, true);
                return;
            }
            $gdinfo = fetch_gdinfo();
            if ($gdinfo['version'] >= 2) {
                if ($gdinfo['freetype'] == 'freetype') {
                    $this->registry->options['regimagetype'] = 'GDttf';
                }
            } else {
                $this->registry->options['hv_type'] = '0';
                $this->registry->options['regimagetype'] = '';
            }
            if (empty($gdinfo['version'])) {
                $this->registry->options['imagetype'] = 0;
            }
            //if ($this->install_suite())
            //{
            // Hooks are enabled now because of Skimlinks
            $this->registry->options['enablehooks'] = 1;
            //}
            // Need to set default language id!
            $languageinfo = $this->db->query_first("\n\t\t\t\tSELECT languageid\n\t\t\t\tFROM " . TABLE_PREFIX . "language\n\t\t\t");
            $this->registry->options['languageid'] = $languageinfo['languageid'];
            // Need to import settings here to get the custom settings inserted ..
            xml_import_settings($xml);
            $this->show_message($this->phrase['install']['general_settings_saved']);
            return;
        }
        $port = intval($_SERVER['SERVER_PORT']);
        $port = in_array($port, array(80, 443)) ? '' : ':' . $port;
        $scheme = ($port == ':443' or isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] and $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://';
        $vboptions['bburl'] = $scheme . $_SERVER['SERVER_NAME'] . $port . substr(SCRIPTPATH, 0, strpos(SCRIPTPATH, '/install/'));
        $vboptions['homeurl'] = $scheme . $_SERVER['SERVER_NAME'] . $port;
        $webmaster = 'webmaster@' . preg_replace('#^www\\.#', '', $_SERVER['SERVER_NAME']);
        $html = '<table cellspacing="0" cellpadding="4" border="0" align="center" width="100%" id="cpform_table" class="" style="border-collapse: separate;">
<tbody>
<tr valign="top">
	<td class="alt1">' . $this->phrase['install']['bbtitle'] . '
		<span id="htmldata[bbtitle]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt1"><input type="text" tabindex="1" dir="ltr" size="40" value="Forums" name="htmldata[bbtitle]" class="bginput" vbrequire="1" /></td>
</tr>
<tr valign="top">
	<td class="alt2">' . $this->phrase['install']['hometitle'] . '
	</td>
	<td class="alt2"><input type="text" tabindex="1" dir="ltr" size="40" value="" name="htmldata[hometitle]" class="bginput" /></td>
</tr>
<tr valign="top">
	<td class="alt1">' . $this->phrase['install']['bburl'] . '
		<span id="htmldata[bburl]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt1"><input type="text" tabindex="1" dir="ltr" size="40" value="' . $vboptions['bburl'] . '" name="htmldata[bburl]" class="bginput" vbrequire="1" /></td>
</tr>
<tr valign="top">
	<td class="alt2">' . $this->phrase['install']['homeurl'] . '
		<span id="htmldata[homeurl]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt2"><input type="text" tabindex="1" dir="ltr" size="40" value="' . $vboptions['homeurl'] . '" name="htmldata[homeurl]" class="bginput" vbrequire="1" /></td>
</tr>
<tr valign="top">
	<td class="alt1">' . $this->phrase['install']['webmasteremail'] . '
		<span id="htmldata[webmasteremail]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt1"><input type="text" tabindex="1" dir="ltr" size="40" value="' . $webmaster . '" name="htmldata[webmasteremail]" class="bginput" vbrequire="1" /></td>
</tr>
</tbody></table>';
        return array('html' => $html, 'width' => '640px', 'hidecancel' => true, 'title' => $this->phrase['install']['general_settings'], 'reset' => true);
    }
Example #4
0
// The End Part 1 - Do things that would cause the admin to no longer be able to run this script.
if ($vbulletin->GPC['step'] == 41) {
    $db->hide_errors();
    $db->query_write("ALTER TABLE " . TABLE_PREFIX . "setting ADD product VARCHAR(15) NOT NULL DEFAULT ''");
    $db->query_write("ALTER TABLE " . TABLE_PREFIX . "setting ADD datatype ENUM('free', 'number', 'boolean', 'bitfield', 'username') NOT NULL DEFAULT 'free'");
    $db->query_write("ALTER TABLE " . TABLE_PREFIX . "setting ADD blacklist SMALLINT NOT NULL DEFAULT '0'");
    $db->query_write("ALTER TABLE " . TABLE_PREFIX . "settinggroup ADD product VARCHAR(15) NOT NULL DEFAULT ''");
    $db->show_errors();
    // Update options from the vb2 style to the vb3 style but leave them in place
    // until the end so that this script can use them.
    // this should generate $vboptions and stick it in the datastore table
    require_once DIR . '/includes/adminfunctions_options.php';
    $datastore = $db->query_first("SELECT data FROM datastore WHERE title='options'");
    $vboptions = unserialize($datastore['data']);
    $path = DIR . '/install/vbulletin-settings.xml';
    xml_import_settings();
    echo "<p>{$upgrade_phrases['upgrade_300b3.php']['settings_imported_sucessfully']}</p>";
    // Remove old options template
    $query[] = "DELETE FROM template WHERE title = 'options'";
    $explain[] = $upgrade_phrases['upgrade_300b3.php']['remove_old_settings_storage'];
    $query[] = "ALTER TABLE usergroup DROP cancontrolpanel";
    $explain[] = sprintf($vbphrase['alter_table'], TABLE_PREFIX . "usergroup");
    $users = $db->query_read("SELECT userid, username, salt, password FROM user WHERE usergroupid = 6");
    while ($user = $db->fetch_array($users)) {
        $query[] = "UPDATE user SET password = '******'password'] . $user['salt'])) . "' WHERE userid = {$user['userid']}";
        $explain[] = sprintf($upgrade_phrases['upgrade_300b3.php']['salt_admin_x'], $user['username']);
    }
    exec_queries();
    echo_flush('<p>' . $upgrade_phrases['upgrade_300b3.php']['build_forum_and_usergroup_cache']);
    build_forum_permissions();
    echo_flush($vbphrase['done'] . '</p>');
Example #5
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;
 }