Vergleich global.php - 1.2.2 - 1.2.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright © 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright © 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: global.php 2445 2006-11-27 00:02:54Z CraKteR $

 * $Id: global.php 3488 2007-11-17 17:27:22Z Tikitiki $

 */

// Load main MyBB core file which begins all of the magic

 */

// Load main MyBB core file which begins all of the magic

require_once dirname(__FILE__)."/inc/init.php";

require_once "./inc/init.php";


$shutdown_queries = array();



$shutdown_queries = array();


Zeile 30Zeile 30

// Send page headers
send_page_headers();


// Send page headers
send_page_headers();


// Trigger an error if the installation directory exists
if(is_dir(MYBB_ROOT."install") && !file_exists(MYBB_ROOT."install/lock"))
{
$mybb->trigger_generic_error("install_directory", true);
}

 

// Do not use session system for defined pages


// Do not use session system for defined pages

if((isset($mybb->input['action']) && isset($nosession[$mybb->input['action']])) || (isset($mybb->input['thumbnail']) && strstr($_SERVER["PHP_SELF"], 'attachment.php')))

if((@isset($mybb->input['action']) && @isset($nosession[$mybb->input['action']])) || (@isset($mybb->input['thumbnail']) && strstr($_SERVER["PHP_SELF"], 'attachment.php')))

{
define("NO_ONLINE", 1);
}

{
define("NO_ONLINE", 1);
}

Zeile 47Zeile 41
require_once MYBB_ROOT."inc/class_session.php";
$session = new session;
$session->init();

require_once MYBB_ROOT."inc/class_session.php";
$session = new session;
$session->init();


// Run global_start plugin hook now that the basics are set up
$plugins->run_hooks("global_start");

 

// Set and load the language
if(!isset($mybb->settings['bblanguage']))


// Set and load the language
if(!isset($mybb->settings['bblanguage']))

Zeile 62Zeile 53
$lang->load("global");
$lang->load("messages");


$lang->load("global");
$lang->load("messages");


if(function_exists('mb_internal_encoding'))




// Run global_start plugin hook now that the basics are set up
$plugins->run_hooks("global_start");

if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset']))

{

{

	mb_internal_encoding($lang->settings['charset']);

	@mb_internal_encoding($lang->settings['charset']);

}

// Which thread mode is our user using?

}

// Which thread mode is our user using?

Zeile 102Zeile 96
	"moderation.php"	
);


	"moderation.php"	
);


 
// This user has a custom theme set in their profile
if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0)
{
$loadstyle = "tid='".$mybb->user['style']."'";
}

if(in_array(strtolower(basename($_SERVER['PHP_SELF'])), $valid))

if(in_array(strtolower(basename($_SERVER['PHP_SELF'])), $valid))

{
// This user has a custom theme set in their profile
if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0)
{
$loadstyle = "tid='".$mybb->user['style']."'";
}


{







	// If we're accessing a post, fetch the forum theme for it and if we're overriding it
if(isset($mybb->input['pid']))

	// If we're accessing a post, fetch the forum theme for it and if we're overriding it
if(isset($mybb->input['pid']))

	{
$query = $db->simple_select(TABLE_PREFIX."forums f, ".TABLE_PREFIX."posts p", "f.style, f.overridestyle", "f.fid=p.fid AND p.pid='".intval($mybb->input['pid'])."'");
$style = $db->fetch_array($query);
$load_from_forum = 1;

	{
$query = $db->simple_select(TABLE_PREFIX."forums f, ".TABLE_PREFIX."posts p", "f.style, f.overridestyle", "f.fid=p.fid AND p.pid='".intval($mybb->input['pid'])."'", array('limit' => 1));
$style = $db->fetch_array($query);
$load_from_forum = 1;

	}

// We have a thread id and a forum id, we can easily fetch the theme for this forum
else if(isset($mybb->input['tid']))

	}

// We have a thread id and a forum id, we can easily fetch the theme for this forum
else if(isset($mybb->input['tid']))

	{
$query = $db->simple_select(TABLE_PREFIX."forums f, ".TABLE_PREFIX."threads t", "f.style, f.overridestyle", "f.fid=t.fid AND t.tid='".intval($mybb->input['tid'])."'");

	{
$query = $db->simple_select(TABLE_PREFIX."forums f, ".TABLE_PREFIX."threads t", "f.style, f.overridestyle", "f.fid=t.fid AND t.tid='".intval($mybb->input['tid'])."'", array('limit' => 1));

		$style = $db->fetch_array($query);
$load_from_forum = 1;
}

		$style = $db->fetch_array($query);
$load_from_forum = 1;
}

Zeile 129Zeile 122
	// We have a forum id - simply load the theme from it
else if(isset($mybb->input['fid']))
{

	// We have a forum id - simply load the theme from it
else if(isset($mybb->input['fid']))
{

		$query = $db->simple_select(TABLE_PREFIX."forums", "style, overridestyle", "fid='".intval($mybb->input['fid'])."'");

		$query = $db->simple_select(TABLE_PREFIX."forums", "style, overridestyle", "fid='".intval($mybb->input['fid'])."'", array('limit' => 1));

		$style = $db->fetch_array($query);
$load_from_forum = 1;

		$style = $db->fetch_array($query);
$load_from_forum = 1;

	}

	}

}

// From all of the above, a theme was found
if(isset($style['style']) && $style['style'] > 0)

}

// From all of the above, a theme was found
if(isset($style['style']) && $style['style'] > 0)

{

{

	// This theme is forced upon the user, overriding their selection
if($style['overridestyle'] == "yes" || !isset($mybb->user['style']))
{

	// This theme is forced upon the user, overriding their selection
if($style['overridestyle'] == "yes" || !isset($mybb->user['style']))
{

Zeile 147Zeile 140

// After all of that no theme? Load the board default
if(empty($loadstyle))


// After all of that no theme? Load the board default
if(empty($loadstyle))

{

{

	$loadstyle = "def='1'";
}

	$loadstyle = "def='1'";
}





// Fetch the theme to load from the database

// Fetch the theme to load from the database

$query = $db->simple_select(TABLE_PREFIX."themes", "name, tid, themebits, csscached", $loadstyle);

$query = $db->simple_select(TABLE_PREFIX."themes", "name, tid, themebits, csscached", $loadstyle, array('limit' => 1));

$theme = $db->fetch_array($query);

$theme = $db->fetch_array($query);





// No theme was found - we attempt to load the master or any other theme
if(!$theme['tid'])
{
// Missing theme was from a forum, run a query to set any forums using the theme to the default
if($load_from_forum == 1)

// No theme was found - we attempt to load the master or any other theme
if(!$theme['tid'])
{
// Missing theme was from a forum, run a query to set any forums using the theme to the default
if($load_from_forum == 1)

	{

	{

		$db->update_query(TABLE_PREFIX."forums", array("style" => 0), "style='{$style['style']}'");
}
// Missing theme was from a user, run a query to set any users using the theme to the default

		$db->update_query(TABLE_PREFIX."forums", array("style" => 0), "style='{$style['style']}'");
}
// Missing theme was from a user, run a query to set any users using the theme to the default

Zeile 171Zeile 164
	// Attempt to load the master or any other theme if the master is not available
$query = $db->simple_select(TABLE_PREFIX."themes", "name, tid, themebits, csscached", "", array("order_by" => "tid", "limit" => 1));
$theme = $db->fetch_array($query);

	// Attempt to load the master or any other theme if the master is not available
$query = $db->simple_select(TABLE_PREFIX."themes", "name, tid, themebits, csscached", "", array("order_by" => "tid", "limit" => 1));
$theme = $db->fetch_array($query);

}


}


$theme = @array_merge($theme, unserialize($theme['themebits']));

// Loading CSS from a file or from the server?
if($theme['csscached'] > 0 && $mybb->settings['cssmedium'] == 'file')
{
$theme['css_url'] = $mybb->settings['bburl']."/css/theme_{$theme['tid']}.css";

$theme = @array_merge($theme, unserialize($theme['themebits']));

// Loading CSS from a file or from the server?
if($theme['csscached'] > 0 && $mybb->settings['cssmedium'] == 'file')
{
$theme['css_url'] = $mybb->settings['bburl']."/css/theme_{$theme['tid']}.css";

}

}

else
{
$theme['css_url'] = $mybb->settings['bburl']."/css.php?theme={$theme['tid']}";

else
{
$theme['css_url'] = $mybb->settings['bburl']."/css.php?theme={$theme['tid']}";

Zeile 198Zeile 191
		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}
// Otherwise, the image language directory is the same as the language directory for the theme

		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}
// Otherwise, the image language directory is the same as the language directory for the theme

	else

	else

	{
$theme['imglangdir'] = $theme['imgdir'];
}

	{
$theme['imglangdir'] = $theme['imgdir'];
}

 
}

// Theme logo - is it a relative URL to the forum root? Append bburl
if(!preg_match("#^(\/|\.\.|\.|([a-z0-9]+)://)#i", $theme['logo']))
{
$theme['logo'] = $mybb->settings['bburl']."/".$theme['logo'];

}

// Load Main Templates and Cached Templates

}

// Load Main Templates and Cached Templates

Zeile 210Zeile 209
	$templatelist .= ',';
}
$templatelist .= "css,headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin";

	$templatelist .= ',';
}
$templatelist .= "css,headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin";

$templatelist .= ",nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active";

$templatelist .= ",nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,global_unreadreports";

$templates->cache($db->escape_string($templatelist));

// Set the current date and time now

$templates->cache($db->escape_string($templatelist));

// Set the current date and time now

Zeile 263Zeile 262

$unreadreports = '';
// This user is a moderator, super moderator or administrator


$unreadreports = '';
// This user is a moderator, super moderator or administrator

if($mybb->usergroup['cancp'] == "yes" || $mybb->usergroup['issupermod'] == "yes" || $mybb->usergroup['gid'] == 6)

if($mybb->usergroup['cancp'] == "yes" || $mybb->usergroup['issupermod'] == "yes" || $mybb->user['usergroup'] == 6)

{
// Read the reported posts cache
$reported = $cache->read("reportedposts");

{
// Read the reported posts cache
$reported = $cache->read("reportedposts");



	

	// 0 or more reported posts currently exist
if($reported['unread'] > 0)
{

	// 0 or more reported posts currently exist
if($reported['unread'] > 0)
{

Zeile 299Zeile 298
if($mybb->usergroup['isbannedgroup'] == "yes")
{
// Fetch details on their ban

if($mybb->usergroup['isbannedgroup'] == "yes")
{
// Fetch details on their ban

	$query = $db->simple_select(TABLE_PREFIX."banned", "*", "uid='{$mybb->user['uid']}'");

	$query = $db->simple_select(TABLE_PREFIX."banned", "*", "uid='{$mybb->user['uid']}'", array('limit' => 1));

	$ban = $db->fetch_array($query);

	$ban = $db->fetch_array($query);

 
	

	if($ban['uid'])
{
// Format their ban lift date and reason appropriately

	if($ban['uid'])
{
// Format their ban lift date and reason appropriately

Zeile 342Zeile 342
if($mybb->settings['showvernum'] == "on")
{
$mybbversion = $mybb->version;

if($mybb->settings['showvernum'] == "on")
{
$mybbversion = $mybb->version;

}

}

else
{
$mybbversion = '';
}
eval("\$footer = \"".$templates->get("footer")."\";");

else
{
$mybbversion = '';
}
eval("\$footer = \"".$templates->get("footer")."\";");





// Add our main parts to the navigation
$navbits = array();
$navbits[0]['name'] = $mybb->settings['bbname'];
$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";

// Add our main parts to the navigation
$navbits = array();
$navbits[0]['name'] = $mybb->settings['bbname'];
$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";

 

// Set the link to the archive.
$archive_url = $mybb->settings['bburl']."/archive/index.php";


// Check banned ip addresses


// Check banned ip addresses

$bannedips = explode(",", $mybb->settings['bannedips']);
if(is_array($bannedips))
{
foreach($bannedips as $key => $bannedip)
{
$bannedip = trim($bannedip);
if($bannedip != '')
{
// This address is banned, show an error and delete the session
if(strstr($session->ipaddress, $bannedip))
{
$db->delete_query(TABLE_PREFIX."sessions", "ip='".$db->escape_string($session->ipaddress)."' OR uid='{$mybb->user['uid']}'");
error($lang->error_banned);
}
}
}

if(is_banned_ip($session->ipaddress))
{
$db->delete_query(TABLE_PREFIX."sessions", "ip='".$db->escape_string($session->ipaddress)."' OR uid='{$mybb->user['uid']}'");
error($lang->error_banned);













}
// If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message
if($mybb->settings['boardclosed'] == "yes" && $mybb->usergroup['cancp'] != "yes" && !(basename($_SERVER['PHP_SELF']) == "member.php" && ($mybb->input['action'] == "login" || $mybb->input['action'] == "do_login" || $mybb->input['action'] == "logout")))

}
// If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message
if($mybb->settings['boardclosed'] == "yes" && $mybb->usergroup['cancp'] != "yes" && !(basename($_SERVER['PHP_SELF']) == "member.php" && ($mybb->input['action'] == "login" || $mybb->input['action'] == "do_login" || $mybb->input['action'] == "logout")))

Zeile 379Zeile 370
	$lang->error_boardclosed .= "<blockquote>{$mybb->settings['boardclosed_reason']}</blockquote>";
error($lang->error_boardclosed);
exit;

	$lang->error_boardclosed .= "<blockquote>{$mybb->settings['boardclosed_reason']}</blockquote>";
error($lang->error_boardclosed);
exit;

}


}


// Load Limiting

// Load Limiting

if(strtolower(substr(PHP_OS, 0, 3)) !== 'win')

if(($load = get_server_load()) && $load != $lang->unknown)

{

{

	if($uptime = @exec('uptime'))


	// User is not an administrator and the load limit is higher than the limit, show an error
if(($mybb->usergroup['cancp'] != "yes" && $load > $mybb->settings['load'] && $mybb->settings['load'] > 0))

	{

	{

		preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/", $uptime, $regs);
$load = $regs[1];
// User is not an administrator and the load limit is higher than the limit, show an error
if($mybb->usergroup['cancp'] != "yes" && $load > $mybb->settings['load'] && $mybb->settings['load'] > 0)
{
error($lang->error_loadlimit);
}

		error($lang->error_loadlimit);







	}
}


	}
}


Zeile 407Zeile 393
	{
$condition = "uid='".intval($mybb->input['referrer'])."'";
}

	{
$condition = "uid='".intval($mybb->input['referrer'])."'";
}

	$query = $db->simple_select(TABLE_PREFIX."users", "uid", $condition);

	$query = $db->simple_select(TABLE_PREFIX."users", "uid", $condition, array('limit' => 1));

	$referrer = $db->fetch_array($query);

	$referrer = $db->fetch_array($query);

 
	

	if($referrer['uid'])
{
my_setcookie("mybb[referrer]", $referrer['uid']);

	if($referrer['uid'])
{
my_setcookie("mybb[referrer]", $referrer['uid']);

Zeile 470Zeile 457
	$db->delete_query(TABLE_PREFIX."sessions", "uid=0 AND time<='$timecut'");
}


	$db->delete_query(TABLE_PREFIX."sessions", "uid=0 AND time<='$timecut'");
}



// Set the link to the archive.
$archive_url = $mybb->settings['bburl']."/archive/index.php";

 

// Run hooks for end of global.php
$plugins->run_hooks("global_end");


// Run hooks for end of global.php
$plugins->run_hooks("global_end");