Beispiel #1
0
        $vbulletin->url = 'profile.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editavatar';
    } else {
        $vbulletin->url = 'usercp.php' . $vbulletin->session->vars['sessionurl_q'];
    }
    // recache the global group to get the stuff from the new language
    $globalgroup = $db->query_first_slave("\n\t\tSELECT phrasegroup_global, languagecode, charset\n\t\tFROM " . TABLE_PREFIX . "language\n\t\tWHERE languageid = " . intval($userdata->fetch_field('languageid') ? $userdata->fetch_field('languageid') : $vbulletin->options['languageid']));
    if ($globalgroup) {
        $vbphrase = array_merge($vbphrase, unserialize($globalgroup['phrasegroup_global']));
        global $stylevar;
        if ($stylevar['charset'] != $globalgroup['charset']) {
            // change the character set in a bunch of places - a total hack
            global $headinclude;
            $headinclude = str_replace("content=\"text/html; charset={$stylevar['charset']}\"", "content=\"text/html; charset={$globalgroup['charset']}\"", $headinclude);
            $stylevar['charset'] = $globalgroup['charset'];
            $vbulletin->userinfo['lang_charset'] = $globalgroup['charset'];
            exec_headers();
        }
        $stylevar['languagecode'] = $globalgroup['languagecode'];
    }
    eval(print_standard_redirect('redirect_updatethanks', true, false, $userdata->fetch_field('languageid')));
}
// ############################################################################
// ############################## EDIT SIGNATURE ##############################
// ############################################################################
// ########################### start update signature #########################
if ($_POST['do'] == 'updatesignature') {
    $vbulletin->input->clean_array_gpc('p', array('wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'preview' => TYPE_STR, 'deletesigpic' => TYPE_BOOL, 'sigpicurl' => TYPE_STR));
    if (!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature'])) {
        eval(standard_error(fetch_error('nosignaturepermission')));
    }
    if ($permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['cansigpic']) {
Beispiel #2
0
function do_login_redirect()
{
	global $vbulletin, $vbphrase;

	$vbulletin->input->fetch_basepath();

	if (
		$vbulletin->url == 'login.php'
		OR $vbulletin->url == $vbulletin->options['forumhome'] . '.php'
		OR strpos($vbulletin->url, 'do=logout') !== false
		OR (!$vbulletin->options['allowmultiregs'] AND strpos($vbulletin->url, $vbulletin->basepath . 'register.php') === 0)
	)
	{
		$vbulletin->url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'];
	}
	else
	{
		$vbulletin->url = fetch_replaced_session_url($vbulletin->url);
		$vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url); // bug 3654 don't ask why
	}

	$temp = strpos($vbulletin->url, '?');
	if ($temp)
	{
		$formfile = substr($vbulletin->url, 0, $temp);
	}
	else
	{
		$formfile =& $vbulletin->url;
	}

	$postvars = $vbulletin->GPC['postvars'];

	($hook = vBulletinHook::fetch_hook('login_redirect')) ? eval($hook) : false;

	// recache the global group to get the stuff from the new language
	$globalgroup = $vbulletin->db->query_first_slave("
		SELECT phrasegroup_global, languagecode, charset
		FROM " . TABLE_PREFIX . "language
		WHERE languageid = " . intval($vbulletin->userinfo['languageid'] ? $vbulletin->userinfo['languageid'] : $vbulletin->options['languageid'])
	);
	if ($globalgroup)
	{
		$vbphrase = array_merge($vbphrase, unserialize($globalgroup['phrasegroup_global']));

		if (vB_Template_Runtime::fetchStyleVar('charset') != $globalgroup['charset'])
		{
			// change the character set in a bunch of places - a total hack
			global $headinclude;

			$headinclude = str_replace(
				"content=\"text/html; charset=" . vB_Template_Runtime::fetchStyleVar('charset') . "\"",
				"content=\"text/html; charset=$globalgroup[charset]\"",
				$headinclude
			);

			vB_Template_Runtime::addStyleVar('charset', $globalgroup['charset'], 'imgdir');
			$vbulletin->userinfo['lang_charset'] = $globalgroup['charset'];

			exec_headers();
		}
		if ($vbulletin->GPC['postvars'])
		{
			$postvars = @unserialize(verify_client_string($vbulletin->GPC['postvars']));
			if ($postvars['securitytoken'] = 'guest')
			{
				$vbulletin->userinfo['securitytoken_raw'] = sha1($vbulletin->userinfo['userid'] . sha1($vbulletin->userinfo['salt']) . sha1(COOKIE_SALT));
				$vbulletin->userinfo['securitytoken'] = TIMENOW . '-' . sha1(TIMENOW . $vbulletin->userinfo['securitytoken_raw']);
				$postvars['securitytoken'] = $vbulletin->userinfo['securitytoken'];
				$vbulletin->GPC['postvars'] = sign_client_string(serialize($postvars));
			}
		}

		vB_Template_Runtime::addStyleVar('languagecode', $globalgroup['languagecode']);
	}

	eval(print_standard_redirect('redirect_login', true, true, $vbulletin->userinfo['languageid']));
}
function do_login_redirect()
{
    global $vbulletin, $vbphrase;
    if ($vbulletin->url == 'login.php' or $vbulletin->url == $vbulletin->options['forumhome'] . '.php' or strpos($vbulletin->url, 'do=logout') !== false) {
        $vbulletin->url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'];
    } else {
        $vbulletin->url = fetch_replaced_session_url($vbulletin->url);
        $vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url);
        // bug 3654 don't ask why
    }
    $temp = strpos($vbulletin->url, '?');
    if ($temp) {
        $formfile = substr($vbulletin->url, 0, $temp);
    } else {
        $formfile =& $vbulletin->url;
    }
    $postvars = $vbulletin->GPC['postvars'];
    ($hook = vBulletinHook::fetch_hook('login_redirect')) ? eval($hook) : false;
    // recache the global group to get the stuff from the new language
    $globalgroup = $vbulletin->db->query_first_slave("\n\t\tSELECT phrasegroup_global, languagecode, charset\n\t\tFROM " . TABLE_PREFIX . "language\n\t\tWHERE languageid = " . intval($vbulletin->userinfo['languageid'] ? $vbulletin->userinfo['languageid'] : $vbulletin->options['languageid']));
    if ($globalgroup) {
        $vbphrase = array_merge($vbphrase, unserialize($globalgroup['phrasegroup_global']));
        global $stylevar;
        if ($stylevar['charset'] != $globalgroup['charset']) {
            // change the character set in a bunch of places - a total hack
            global $headinclude;
            $headinclude = str_replace("content=\"text/html; charset={$stylevar['charset']}\"", "content=\"text/html; charset={$globalgroup['charset']}\"", $headinclude);
            $stylevar['charset'] = $globalgroup['charset'];
            $vbulletin->userinfo['lang_charset'] = $globalgroup['charset'];
            exec_headers();
        }
        $stylevar['languagecode'] = $globalgroup['languagecode'];
    }
    eval(print_standard_redirect('redirect_login', true, true, $vbulletin->userinfo['languageid']));
}
Beispiel #4
0
function do_login_redirect()
{
    global $vbulletin, $vbphrase;
    $vbulletin->input->fetch_basepath();
    //the clauses
    //url $vbulletin->url == 'login.php' and $vbulletin->url == $vbulletin->options['forumhome'] . '.php'
    //will never be true -- $vbulletin->url contains the full url path.
    //The second shouldn't be needed, the else clause seems to handle this just fine.
    //the first we'll change to match a partial url.
    if (preg_match('#login.php(?:\\?|$)#', $vbulletin->url) or strpos($vbulletin->url, 'do=logout') !== false or !$vbulletin->options['allowmultiregs'] and strpos($vbulletin->url, $vbulletin->basepath . 'register.php') === 0) {
        $vbulletin->url = fetch_seo_url('forumhome', array());
    } else {
        $vbulletin->url = fetch_replaced_session_url($vbulletin->url);
        $vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url);
        // bug 3654 don't ask why
    }
    $temp = strpos($vbulletin->url, '?');
    if ($temp) {
        $formfile = substr($vbulletin->url, 0, $temp);
    } else {
        $formfile =& $vbulletin->url;
    }
    $postvars = $vbulletin->GPC['postvars'];
    ($hook = vBulletinHook::fetch_hook('login_redirect')) ? eval($hook) : false;
    if (!VB_API) {
        // recache the global group to get the stuff from the new language
        $globalgroup = $vbulletin->db->query_first_slave("\n\t\t\tSELECT phrasegroup_global, languagecode, charset\n\t\t\tFROM " . TABLE_PREFIX . "language\n\t\t\tWHERE languageid = " . intval($vbulletin->userinfo['languageid'] ? $vbulletin->userinfo['languageid'] : $vbulletin->options['languageid']));
        if ($globalgroup) {
            $vbphrase = array_merge($vbphrase, unserialize($globalgroup['phrasegroup_global']));
            if (vB_Template_Runtime::fetchStyleVar('charset') != $globalgroup['charset']) {
                // change the character set in a bunch of places - a total hack
                global $headinclude;
                $headinclude = str_replace("content=\"text/html; charset=" . vB_Template_Runtime::fetchStyleVar('charset') . "\"", "content=\"text/html; charset={$globalgroup['charset']}\"", $headinclude);
                vB_Template_Runtime::addStyleVar('charset', $globalgroup['charset'], 'imgdir');
                $vbulletin->userinfo['lang_charset'] = $globalgroup['charset'];
                exec_headers();
            }
            if ($vbulletin->GPC['postvars']) {
                $postvars = @unserialize(verify_client_string($vbulletin->GPC['postvars']));
                $postvars['login_redirect'] = true;
                if ($postvars['securitytoken'] == 'guest') {
                    $vbulletin->userinfo['securitytoken_raw'] = sha1($vbulletin->userinfo['userid'] . sha1($vbulletin->userinfo['salt']) . sha1(COOKIE_SALT));
                    $vbulletin->userinfo['securitytoken'] = TIMENOW . '-' . sha1(TIMENOW . $vbulletin->userinfo['securitytoken_raw']);
                    $postvars['securitytoken'] = $vbulletin->userinfo['securitytoken'];
                }
                $vbulletin->GPC['postvars'] = sign_client_string(serialize($postvars));
            }
            vB_Template_Runtime::addStyleVar('languagecode', $globalgroup['languagecode']);
        }
    }
    print_standard_redirect(array('redirect_login', $vbulletin->userinfo['username']), true, true, $vbulletin->userinfo['languageid']);
}
Beispiel #5
0
	/**
	* Processes the global templates (header, footer, etc) and the variables they need.
	*/
	public function process_templates()
	{
		if ($this->called('template'))
		{
			return;
		}
		$this->called['template'] = true;

		$this->load_style();

		global $vbulletin, $show, $vbphrase, $style, $template_hook;

		$this->cache_templates($style['templatelist']);

		// #############################################################################
		// turn off popups if they are not available to this browser
		if ($vbulletin->options['usepopups'])
		{
			if ((is_browser('ie', 5) AND !is_browser('mac')) OR is_browser('mozilla') OR is_browser('firebird') OR is_browser('opera', 7) OR is_browser('webkit') OR is_browser('konqueror', 3.2))
			{
				// use popups
			}
			else
			{
				// don't use popups
				$vbulletin->options['usepopups'] = 0;
			}
		}

		global $vbcollapse;
		$vbcollapse = self::build_vbcollapse($vbulletin->GPC['vbulletin_collapse']);

		// #############################################################################
		// set up the vars for the private message area of the navbar
		global $pmbox;
		$pmbox = array(
			'lastvisitdate' => vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit'], 1),
			'lastvisittime' => vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit'])
		);

		if ($vbulletin->userinfo['userid'])
		{
			$pmunread_html = construct_phrase(($vbulletin->userinfo['pmunread'] ? $vbphrase['numeric_value_emphasized'] : $vbphrase['numeric_value']), $vbulletin->userinfo['pmunread']);
			$vbphrase['unread_x_nav_compiled'] = construct_phrase($vbphrase['unread_x_nav'], $pmunread_html);
			$vbphrase['total_x_nav_compiled'] = construct_phrase($vbphrase['total_x_nav'], $vbulletin->userinfo['pmtotal']);
		}

		// #############################################################################
		// Generate Language/Style Chooser Dropdowns
		if (empty($_POST['do']))
		{
			$languagecount = 0;
			$languagechooserbits = construct_language_options('--', true, $languagecount);
			$show['languagechooser'] = ($languagecount > 1 ? true : false);
		}
		else
		{
			$show['languagechooser'] = false;
		}

		if ($vbulletin->options['allowchangestyles'] AND empty($_POST['do']))
		{
			$stylecount = 0;
			$quickchooserbits = construct_style_options(-1, '--', true, true, $stylecount);
			$show['quickchooser'] = ($stylecount > 1 ? true : false);
		}
		else
		{
			$show['quickchooser'] = false;
		}

		// #############################################################################
		// do cron stuff - goes into footer
		if ($vbulletin->cron <= TIMENOW)
		{
			$cronimage = '<img src="' . create_full_url('cron.php?' . $vbulletin->session->vars['sessionurl'] . 'rand=' .  TIMENOW) . '" alt="" width="1" height="1" border="0" />';
		}
		else
		{
			$cronimage = '';
		}

		global $ad_location;

		// parse some global templates
		global $gobutton, $spacer_open, $spacer_close;
		$gobutton = vB_Template::create('gobutton')->render();
		$spacer_open = vB_Template::create('spacer_open')->render();
		$spacer_close = vB_Template::create('spacer_close')->render();

		// facebook templates
		if (is_facebookenabled())
		{
			$templater = vB_Template::create('facebook_opengraph');
			$templater->register('opengrapharray', get_fbopengrapharray());
			$facebook_opengraph = $templater->render();

			$templater = vB_Template::create('facebook_header');
			$templater->register('profileurl', get_fbprofileurl());
			$templater->register('squarepicurl', get_fbprofilepicurl());
			$facebook_header = $templater->render();

			$templater = vB_Template::create('facebook_footer');
			$templater->register('connected', (is_userfbconnected() ? 1 : 0));
			$templater->register('active', (is_userfbactive() ? 1 : 0));
			$facebook_footer = $templater->render();
		}

		($hook = vBulletinHook::fetch_hook('parse_templates')) ? eval($hook) : false;

		// parse headinclude, header & footer
		$admincpdir = $vbulletin->config['Misc']['admincpdir'];
		$modcpdir = $vbulletin->config['Misc']['modcpdir'];

		// advertising location setup
		$template = vB_Template::create('ad_navbar_below');
		$template->register('adsense_pub_id', $vbulletin->adsense_pub_id);
		$template->register('adsense_host_id', $vbulletin->adsense_host_id);
		$ad_location['ad_navbar_below'] = $template->render();

		$ad_location['global_header1'] = vB_Template::create('ad_global_header1')->render();
		$ad_location['global_header2'] = vB_Template::create('ad_global_header2')->render();
		$ad_location['global_below_navbar'] = vB_Template::create('ad_global_below_navbar')->render();
		$ad_location['global_above_footer'] = vB_Template::create('ad_global_above_footer')->render();

		$template = vB_Template::create('ad_footer_start');
		$template->register('adsense_pub_id', $vbulletin->adsense_pub_id);
		$template->register('adsense_host_id', $vbulletin->adsense_host_id);
		$ad_location['ad_footer_start'] = $template->render();

		// #############################################################################
		// handle notices
		global $notices;
		$notices = $this->build_notices();
		$show['notices'] = ($notices !== '');

		// #############################################################################
		// set up user notifications
		$notifications = $this->build_notifications();
		if ($notifications)
		{
			$show['notifications'] = true;
			global $notifications_menubits, $notifications_total;
			$notifications_menubits = $notifications['bits'];
			$notifications_total = $notifications['total'];
		}
		else
		{
			$notifications_menubits = '';
			$notifications_total = '';
			$show['notifications'] = false;
		}

		$newpm = $this->check_new_pm();

		// #############################################################################
		// page number is used in meta tags (sometimes)
		global $pagenumber, $headinclude, $headinclude_bottom, $header, $footer;
		global $threadinfo, $foruminfo;
		if ($pagenumber === NULL)
		{
			$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
		}

		$templater = vB_Template::create('headinclude');
			$templater->register('foruminfo', $foruminfo);
			$templater->register('pagenumber', $pagenumber);
			$templater->register('style', $style);
			$templater->register('basepath', $vbulletin->input->fetch_basepath());
			$templater->register('this_script', THIS_SCRIPT);
			$templater->register('facebook_opengraph', $facebook_opengraph);
		$headinclude = $templater->render();

		$templater = vB_Template::create('headinclude_bottom');
			$templater->register('foruminfo', $foruminfo);
			$templater->register('pagenumber', $pagenumber);
			$templater->register('style', $style);
			$templater->register('basepath', $vbulletin->input->fetch_basepath());
		$headinclude_bottom = $templater->render();

		$templater = vB_Template::create('header');
			$templater->register('ad_location', $ad_location);
			$templater->register('pmbox', $pmbox);
			$templater->register('notifications_menubits', $notifications_menubits);
			$templater->register('notifications_total', $notifications_total);
			$templater->register('notices', $notices);
			$templater->register('facebook_header', $facebook_header);
		$header = $templater->render();

		$templater = vB_Template::create('footer');
			$templater->register('admincpdir', $admincpdir);
			$templater->register('ad_location', $ad_location);
			$templater->register('cronimage', $cronimage);
			$templater->register('languagechooserbits', $languagechooserbits);
			$templater->register('modcpdir', $modcpdir);
			$templater->register('quickchooserbits', $quickchooserbits);
			$templater->register('template_hook', $template_hook);
			$templater->register('facebook_footer', $facebook_footer);
		$footer = $templater->render();

		// #############################################################################
		// Check for pm popup
		if ($newpm)
		{
			if ($vbulletin->userinfo['pmunread'] == 1)
			{
				$pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js'] . "do=showpm&pmid=$newpm[pmid]";
			}
			else if (!empty($vbulletin->session->vars['sessionurl_js']))
			{
				$pmpopupurl = 'private.php?' . $vbulletin->session->vars['sessionurl_js'];
			}
			else
			{
				$pmpopupurl = 'private.php';
			}
			$templater = vB_Template::create('pm_popup_script');
				$templater->register('newpm', $newpm);
				$templater->register('pmpopupurl', $pmpopupurl);
			$footer .= $templater->render();
		}

		if (!$vbulletin->options['bbactive'] AND
			($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
		{
			// show the board disabled warning message so that admins don't leave the board turned off by accident
			$warning = vB_Template::create('board_inactive_warning')->render();
			$header = $warning . $header;
			$footer .= $warning;
		}

		($hook = vBulletinHook::fetch_hook('process_templates_complete')) ? eval($hook) : false;

		exec_headers();
	}
function do_login_redirect()
{
    global $vbulletin, $vbphrase;
    $vbulletin->input->fetch_basepath();
    //the clauses
    //url $vbulletin->url == 'login.php' and $vbulletin->url == $vbulletin->options['forumhome'] . '.php'
    //will never be true -- $vbulletin->url contains the full url path.
    //The second shouldn't be needed, the else clause seems to handle this just fine.
    //the first we'll change to match a partial url.
    if (preg_match('#login.php(?:\\?|$)#', $vbulletin->url) or strpos($vbulletin->url, 'do=logout') !== false or !$vbulletin->options['allowmultiregs'] and strpos($vbulletin->url, $vbulletin->basepath . 'register.php') === 0) {
        $forumHome = vB_Library::instance('content_channel')->getForumHomeChannel();
        $vbulletin->url = vB5_Route::buildUrl($forumHome['routeid'] . '|fullurl');
    } else {
        $vbulletin->url = fetch_replaced_session_url($vbulletin->url);
        $vbulletin->url = preg_replace('#^/+#', '/', $vbulletin->url);
        // bug 3654 don't ask why
    }
    $temp = strpos($vbulletin->url, '?');
    if ($temp) {
        $formfile = substr($vbulletin->url, 0, $temp);
    } else {
        $formfile =& $vbulletin->url;
    }
    $postvars = $vbulletin->GPC['postvars'];
    // Legacy Hook 'login_redirect' Removed //
    if (!VB_API) {
        // recache the global group to get the stuff from the new language
        $globalgroup = $vbulletin->db->query_first_slave("\n\t\t\tSELECT phrasegroup_global, languagecode, charset\n\t\t\tFROM " . TABLE_PREFIX . "language\n\t\t\tWHERE languageid = " . intval($vbulletin->userinfo['languageid'] ? $vbulletin->userinfo['languageid'] : $vbulletin->options['languageid']));
        if ($globalgroup) {
            $vbphrase = array_merge($vbphrase, unserialize($globalgroup['phrasegroup_global']));
            if (vB_Template_Runtime::fetchStyleVar('charset') != $globalgroup['charset']) {
                // change the character set in a bunch of places - a total hack
                global $headinclude;
                $headinclude = str_replace("content=\"text/html; charset=" . vB_Template_Runtime::fetchStyleVar('charset') . "\"", "content=\"text/html; charset={$globalgroup['charset']}\"", $headinclude);
                vB_Template_Runtime::addStyleVar('charset', $globalgroup['charset'], 'imgdir');
                $vbulletin->userinfo['lang_charset'] = $globalgroup['charset'];
                exec_headers();
            }
            if ($vbulletin->GPC['postvars']) {
                $postvars = array();
                $client_string = verify_client_string($vbulletin->GPC['postvars']);
                if ($client_string) {
                    $postvars = @json_decode($client_string, true);
                }
                if ($postvars['securitytoken'] == 'guest') {
                    $vbulletin->userinfo['securitytoken_raw'] = sha1($vbulletin->userinfo['userid'] . sha1($vbulletin->userinfo['secret']) . sha1(vB_Request_Web::$COOKIE_SALT));
                    $vbulletin->userinfo['securitytoken'] = TIMENOW . '-' . sha1(TIMENOW . $vbulletin->userinfo['securitytoken_raw']);
                    $postvars['securitytoken'] = $vbulletin->userinfo['securitytoken'];
                    $vbulletin->GPC['postvars'] = sign_client_string(json_encode($postvars));
                }
            }
            vB_Template_Runtime::addStyleVar('languagecode', $globalgroup['languagecode']);
        }
    }
    if ($vbulletin->GPC['logintype'] === 'cplogin' or $vbulletin->GPC['logintype'] === 'modcplogin') {
        require_once DIR . '/includes/adminfunctions.php';
        print_cp_redirect($vbulletin->url);
    } else {
        eval(print_standard_redirect('redirect_login_gfrontredirect', true, true, $vbulletin->userinfo['languageid']));
    }
}