Exemple #1
0
		");
		/*insert query*/
		$db->query_write("INSERT INTO " . TABLE_PREFIX . "moderator
			(userid, forumid, permissions, permissions2)
		VALUES
			(
				$userid,
				-1,
				" . (array_sum($vbulletin->bf_misc_moderatorpermissions) - ($vbulletin->bf_misc_moderatorpermissions['newthreademail'] + $vbulletin->bf_misc_moderatorpermissions['newpostemail'])) . ",
				" . (array_sum($vbulletin->bf_misc_moderatorpermissions2)) . "
			)
		");

		build_image_cache('smilie');
		build_image_cache('avatar');
		build_image_cache('icon');
		build_bbcode_cache();
		require_once(DIR . '/includes/functions_databuild.php');
		build_user_statistics();
		build_forum_child_lists();
		build_forum_permissions();
		require_once(DIR . '/includes/functions_cron.php');
		build_cron_next_run();
		require_once(DIR . '/includes/adminfunctions_attachment.php');
		build_attachment_permissions();
		require_once(DIR . '/includes/class_bitfield_builder.php');
		vB_Bitfield_Builder::save($db);
		require_once(DIR . '/includes/class_block.php');
		$blockmanager = vB_BlockManager::create($vbulletin);
		$blockmanager->reloadBlockTypes();
Exemple #2
0
	//change the standard icons to the new png images.
	$i = 0;
	foreach ($smilies_to_change as $smilie)
	{
		$i++;
		$upgrade->run_query(
			sprintf($upgrade_phrases['upgrade_404.php']['update_smilie'], $i, count($smilies_to_change)),
			"UPDATE " . TABLE_PREFIX . "smilie SET smiliepath = 'images/smilies/$smilie.png'
			WHERE smiliepath = 'images/smilies/$smilie.gif' AND imagecategoryid = 1"
		);
	}

	$upgrade->execute();

	require_once(DIR . '/includes/adminfunctions.php');
	build_image_cache('smilie');
}

if ($vbulletin->GPC['step'] == 2)
{
	// Do some queries to fix oddities between new installs and upgrades
	$upgrade->drop_field(
		sprintf($upgradecore_phrases['altering_x_table'], 'usergroup', 1, 1),
		'usergroup',
		'albumpicmaxsize'
	);

	$upgrade->run_query(
		sprintf($upgradecore_phrases['altering_x_table'], 'usertitle', 1, 1),
		"ALTER TABLE " . TABLE_PREFIX . "usertitle CHANGE usertitleid usertitleid INT UNSIGNED NOT NULL AUTO_INCREMENT"
	);
    /**
     * Step #7 - Default User Setup...
     *
     */
    function step_7($data = null)
    {
        if ($data['response']) {
            array_map('trim', $data['htmldata']);
            $errors = array();
            if (empty($data['htmldata']['username'])) {
                $errors['username'] = $this->phrase['install']['error_username'];
            }
            if (empty($data['htmldata']['email']) or !is_valid_email($data['htmldata']['email'])) {
                $errors['email'] = $this->phrase['install']['error_email'];
            }
            if (empty($data['htmldata']['password']) or empty($data['htmldata']['confirmpassword'])) {
                if (empty($data['htmldata']['password'])) {
                    $errors['password'] = $this->phrase['install']['error_password'];
                } else {
                    if (empty($data['htmldata']['confirmpassword'])) {
                        $errors['confirmpassword'] = $this->phrase['install']['error_confirmpassword'];
                    }
                }
            } else {
                if ($data['htmldata']['password'] != $data['htmldata']['confirmpassword']) {
                    $errors['mismatch'] = $this->phrase['install']['error_password_not_match'];
                } else {
                    if ($data['htmldata']['password'] == $data['htmldata']['username'] and !defined('ALLOW_SAME_USERNAME_PASSWORD')) {
                        $errors['samepasswordasusername'] = $this->phrase['install']['error_same_password_as_username'];
                    }
                }
            }
            // check if a user already exists. If so, DO NOT CREATE A NEW USER.
            $vbexists = $this->fetch_vbexists();
            if (!$vbexists) {
                $errors[] = $this->phrase['install']['user_table_missing'];
                // we can't create a user without a user table.
            } else {
                // assuming if user table exists, userid will exist. If a user exists, DO NOT CREATE A NEW USER
                if ($this->db->query_first("SELECT userid FROM " . trim($this->registry->config['Database']['tableprefix']) . "user LIMIT 1")) {
                    $errors[] = $this->phrase['install']['user_already_exists'];
                }
            }
            if (empty($errors)) {
                require_once DIR . '/includes/class_bitfield_builder.php';
                vB_Bitfield_Builder::save($this->db);
                $admin_defaults = array('vbasset_enable', 'showsignatures', 'showavatars', 'showimages', 'adminemail', 'dstauto', 'receivepm', 'showusercss', 'receivefriendemailrequest', 'vm_enable');
                $admin_useroption = 0;
                foreach ($admin_defaults as $bitfield) {
                    $admin_useroption |= $this->registry->bf_misc_useroptions["{$bitfield}"];
                }
                require_once DIR . '/includes/functions_user.php';
                //for now we'll just include these to get the define for the salt length.  Should investigate
                //using the DM to add the initial admin user, but there may be issues with doing that without
                //a proper user session (which we can't have until we require the user.
                require_once DIR . '/includes/class_dm.php';
                require_once DIR . '/includes/class_dm_user.php';
                $salt = fetch_user_salt(SALT_LENGTH);
                /*insert query*/
                $this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "user\n\t\t\t\t\t\t(username, salt, password, email, usertitle, joindate, lastvisit, lastactivity, usergroupid, passworddate, options, showvbcode)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $this->db->escape_string(htmlspecialchars_uni($data['htmldata']['username'])) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($salt) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string(md5(md5($data['htmldata']['password']) . $salt)) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($data['htmldata']['email']) . "',\n\t\t\t\t\t\t'" . $this->db->escape_string($this->phrase['install']['usergroup_admin_usertitle']) . "',\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t6,\n\t\t\t\t\t\tFROM_UNIXTIME(" . TIMENOW . "),\n\t\t\t\t\t\t{$admin_useroption},\n\t\t\t\t\t\t2\n\t\t\t\t\t)\n\t\t\t\t");
                $userid = $this->db->insert_id();
                /*insert query*/
                $this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "usertextfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
                /*insert query*/
                $this->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "userfield\n\t\t\t\t\t\t(userid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$userid})\n\t\t\t\t");
                /*insert query*/
                $this->db->query_write("INSERT INTO " . TABLE_PREFIX . "administrator\n\t\t\t\t\t(userid, adminpermissions)\n\t\t\t\tVALUES\n\t\t\t\t\t({$userid}, " . (array_sum($this->registry->bf_ugp_adminpermissions) - 3) . ")\n\t\t\t\t");
                /*insert query*/
                $this->db->query_write("INSERT INTO " . TABLE_PREFIX . "moderator\n\t\t\t\t\t(userid, forumid, permissions, permissions2)\n\t\t\t\tVALUES\n\t\t\t\t\t(\n\t\t\t\t\t\t{$userid},\n\t\t\t\t\t\t-1,\n\t\t\t\t\t\t" . (array_sum($this->registry->bf_misc_moderatorpermissions) - ($this->registry->bf_misc_moderatorpermissions['newthreademail'] + $this->registry->bf_misc_moderatorpermissions['newpostemail'])) . ",\n\t\t\t\t\t\t" . array_sum($this->registry->bf_misc_moderatorpermissions2) . "\n\t\t\t\t\t)\n\t\t\t\t");
                build_image_cache('smilie');
                build_image_cache('avatar');
                build_image_cache('icon');
                build_bbcode_cache();
                require_once DIR . '/includes/functions_databuild.php';
                build_user_statistics();
                require_once DIR . '/includes/adminfunctions_forums.php';
                build_forum_child_lists();
                build_forum_permissions();
                require_once DIR . '/includes/functions_cron.php';
                build_cron_next_run();
                require_once DIR . '/includes/adminfunctions_attachment.php';
                build_attachment_permissions();
                require_once DIR . '/includes/class_block.php';
                $blockmanager = vB_BlockManager::create($this->registry);
                $blockmanager->reloadBlockTypes();
                $this->show_message($this->phrase['install']['administrator_account_created']);
                return;
            } else {
                foreach ($errors as $key => $value) {
                    $errors["{$key}"] = '<span class="usererror">' . $value . '</span>';
                }
            }
        } else {
            $data['htmldata'] = array();
        }
        $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']['username'] . $errors['username'] . '
		<span id="htmldata[username]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt1">
		<div id="ctrl_username">
			<input type="text" tabindex="1" dir="ltr" size="35" value="' . htmlspecialchars_uni($data['htmldata']['username']) . '" id="it_username_1" name="htmldata[username]" class="bginput" vbrequire="1" />
		</div>
	</td>
</tr>
<tr valign="top">
	<td class="alt2">' . $this->phrase['install']['password'] . $errors['password'] . $errors['mismatch'] . $errors['samepasswordasusername'] . '
		<span id="htmldata[password]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt2">
		<div id="ctrl_password">
			<input type="password" tabindex="1" size="35" value="' . htmlspecialchars_uni($data['htmldata']['password']) . '" name="htmldata[password]" class="bginput" vbrequire="1" />
		</div>
	</td>
</tr>
<tr valign="top">
	<td class="alt1">' . $this->phrase['install']['confirm_password'] . $errors['confirmpassword'] . $errors['mismatch'] . '
		<span id="htmldata[confirmpassword]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt1">
		<div id="ctrl_confirmpassword">
			<input type="password" tabindex="1" size="35" value="' . htmlspecialchars_uni($data['htmldata']['confirmpassword']) . '" name="htmldata[confirmpassword]" class="bginput" vbrequire="1" />
		</div>
	</td>
</tr>
<tr valign="top">
	<td class="alt2">' . $this->phrase['install']['email_address'] . $errors['email'] . '
		<span id="htmldata[email]_error" class="usererror hidden">' . $this->phrase['install']['field_required'] . '</span>
	</td>
	<td class="alt2">
		<div id="ctrl_email">
			<input type="text" tabindex="1" dir="ltr" size="35" value="' . htmlspecialchars_uni($data['htmldata']['email']) . '" id="it_email_2" name="htmldata[email]" class="bginput" vbrequire="1" />
		</div>
	</td>
</tr>
</tbody></table>';
        return array('html' => $html, 'width' => '640px', 'hidecancel' => true, 'title' => $this->phrase['install']['administrator_account_setup'], 'reset' => true);
    }
Exemple #4
0
                while ($item = $db->fetch_array($items)) {
                    $ordercache["{$item[$itemid]}"] = $item['displayorder'];
                }
                unset($item);
                $db->free_result($items);
                foreach ($vbulletin->GPC['order'] as $id => $displayorder) {
                    $id = intval($id);
                    $displayorder = intval($displayorder);
                    if ($displayorder != $ordercache["{$id}"]) {
                        $db->query_write("UPDATE " . TABLE_PREFIX . $vbulletin->GPC['table'] . " SET displayorder = {$displayorder} WHERE {$itemid} = {$id}");
                    }
                }
            }
        }
    }
    build_image_cache($vbulletin->GPC['table']);
    build_image_permissions($vbulletin->GPC['table']);
    $_REQUEST['do'] = 'viewimages';
}
// ###################### Start View Images #######################
if ($_REQUEST['do'] == 'viewimages') {
    $vbulletin->input->clean_array_gpc('r', array('pagesub' => TYPE_INT, 'page' => TYPE_INT, 'perpage' => TYPE_INT, 'imagecategoryid' => TYPE_INT, 'massmove' => TYPE_INT));
    if (!empty($vbulletin->GPC['pagesub'])) {
        $vbulletin->GPC['page'] = $vbulletin->GPC['pagesub'];
    }
    if ($vbulletin->GPC['page'] < 1) {
        $vbulletin->GPC['page'] = 1;
    }
    if ($vbulletin->GPC['perpage'] < 1) {
        $vbulletin->GPC['perpage'] = 20;
    }
Exemple #5
0
 /**
  * Step #3 - change the standard icons to the new png images.
  *
  */
 function step_3()
 {
     for ($i = 1; $i < 15; $i++) {
         $this->run_query(sprintf($this->phrase['version']['402']['update_icon'], $i, 14), "UPDATE " . TABLE_PREFIX . "icon SET iconpath = 'images/icons/icon{$i}.png'\n\t\t\t\tWHERE iconpath = 'images/icons/icon{$i}.gif' AND imagecategoryid = 2");
     }
     require_once DIR . '/includes/adminfunctions.php';
     build_image_cache('icon');
     // Reload forum types to make blocktype title translatable
     require_once DIR . '/includes/class_block.php';
     $blockmanager = vB_BlockManager::create($this->registry);
     $blockmanager->reloadBlockTypes();
 }
Exemple #6
0
 /**
  * Step #4
  *
  */
 function step_4()
 {
     require_once DIR . '/includes/adminfunctions.php';
     build_image_cache('smilie');
     $this->drop_field(sprintf($this->phrase['core']['altering_x_table'], 'usergroup', 1, 1), 'usergroup', 'albumpicmaxsize');
 }
Exemple #7
0
 /**
  * Step #15
  *
  */
 function step_15()
 {
     $this->run_query(sprintf($this->phrase['vbphrase']['update_table'], 'searchcore_text'), "DELETE " . TABLE_PREFIX . "searchcore_text\n\t\t\tFROM " . TABLE_PREFIX . "searchcore_text\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "searchcore ON (" . TABLE_PREFIX . "searchcore.searchcoreid = " . TABLE_PREFIX . "searchcore_text.searchcoreid)\n\t\t\tWHERE " . TABLE_PREFIX . "searchcore.searchcoreid IS NULL");
     // We have changed smilies and post icons
     require_once DIR . '/includes/adminfunctions.php';
     build_image_cache('smilie');
     build_image_cache('icon');
 }