Vergleich global.php - 1.2.0 - 1.2.9

  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 2191 2006-09-03 12:11:04Z chris $

 * $Id: global.php 3112 2007-05-30 05:53:00Z 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']))

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);

}

}


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


// Create session for this user
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");


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


Zeile 61Zeile 55
$lang->set_language($mybb->settings['bblanguage']);
$lang->load("global");
$lang->load("messages");

$lang->set_language($mybb->settings['bblanguage']);
$lang->load("global");
$lang->load("messages");

 

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


// Which thread mode is our user using?
if(!isset($mybb->input['mode']))


// Which thread mode is our user using?
if(!isset($mybb->input['mode']))

Zeile 83Zeile 82
$loadstyle = '';
$load_from_forum = 0;
$style = array();

$loadstyle = '';
$load_from_forum = 0;
$style = array();

 

$valid = array(
"showthread.php",
"forumdisplay.php",
"newthread.php",
"newreply.php",
"ratethread.php",
"editpost.php",
"polls.php",
"sendthread.php",
"printthread.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']."'";


// 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']))
{
$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;
}

// 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'])."'");
$style = $db->fetch_array($query);
$load_from_forum = 1;
}

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

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



















{

{

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





















	// 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;
}

// 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'])."'");
$style = $db->fetch_array($query);
$load_from_forum = 1;
}

// 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'])."'");
$style = $db->fetch_array($query);
$load_from_forum = 1;
}

}

// From all of the above, a theme was found

}

// From all of the above, a theme was found

if(isset($style['style']) && $style['style'] > 0)
{

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']))
{
$loadstyle = "tid='".intval($style['style'])."'";

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

	}

	}

}

// After all of that no theme? Load the board default

}

// After all of that no theme? Load the board default

Zeile 144Zeile 158
	}
// Missing theme was from a user, run a query to set any users using the theme to the default
else if($load_from_user == 1)

	}
// Missing theme was from a user, run a query to set any users using the theme to the default
else if($load_from_user == 1)

	{

	{

		$db->update_query(TABLE_PREFIX."users", array("style" => 0), "style='{$style['style']}'");
}
// 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);

		$db->update_query(TABLE_PREFIX."users", array("style" => 0), "style='{$style['style']}'");
}
// 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 = @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']}";

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

}

}


// If a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))
{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];


// If a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))
{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];

}

}

else
{
// Check if a custom language directory exists for this theme

else
{
// Check if a custom language directory exists for this theme

Zeile 181Zeile 195
	{
$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 191Zeile 211
$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";
$templates->cache($db->escape_string($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";
$templates->cache($db->escape_string($templatelist));





// Set the current date and time now
$datenow = my_date($mybb->settings['dateformat'], time(), '', false);
$timenow = my_date($mybb->settings['timeformat'], time());

// Set the current date and time now
$datenow = my_date($mybb->settings['dateformat'], time(), '', false);
$timenow = my_date($mybb->settings['timeformat'], time());

Zeile 214Zeile 234
if($mybb->settings['boardclosed'] == "yes" && $mybb->usergroup['cancp'] == "yes")
{
eval("\$bbclosedwarning = \"".$templates->get("global_boardclosed_warning")."\";");

if($mybb->settings['boardclosed'] == "yes" && $mybb->usergroup['cancp'] == "yes")
{
eval("\$bbclosedwarning = \"".$templates->get("global_boardclosed_warning")."\";");

}


}


// Prepare the main templates for use
unset($admincplink);

// Load appropriate welcome block for the current logged in user
if($mybb->user['uid'] != 0)

// Prepare the main templates for use
unset($admincplink);

// Load appropriate welcome block for the current logged in user
if($mybb->user['uid'] != 0)

{

{

	// User can access the admin cp and we're not hiding admin cp links, fetch it
if($mybb->usergroup['cancp'] == "yes" && $mybb->config['hide_admin_links'] != 1)
{

	// User can access the admin cp and we're not hiding admin cp links, fetch it
if($mybb->usergroup['cancp'] == "yes" && $mybb->config['hide_admin_links'] != 1)
{

Zeile 238Zeile 258
else
{
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_guest")."\";");

else
{
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_guest")."\";");

}

}


$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)
{
if($reported['unread'] == 1)

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

		{

		{

			$lang->unread_reports = $lang->unread_report;

			$lang->unread_reports = $lang->unread_report;

		}

		}

		else
{
$lang->unread_reports = sprintf($lang->unread_reports, $reported['unread']);

		else
{
$lang->unread_reports = sprintf($lang->unread_reports, $reported['unread']);

		}

		}

		eval("\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
}
}

		eval("\$unreadreports = \"".$templates->get("global_unreadreports")."\";");
}
}

Zeile 286Zeile 306
		if($ban['lifted'] > 0)
{
$banlift = my_date($mybb->settings['dateformat'], $ban['lifted']) . ", " . my_date($mybb->settings['timeformat'], $ban['lifted']);

		if($ban['lifted'] > 0)
{
$banlift = my_date($mybb->settings['dateformat'], $ban['lifted']) . ", " . my_date($mybb->settings['timeformat'], $ban['lifted']);

		}

		}

		else 
{
$banlift = $lang->banned_lifted_never;
}
$reason = htmlspecialchars_uni($ban['reason']);

		else 
{
$banlift = $lang->banned_lifted_never;
}
$reason = htmlspecialchars_uni($ban['reason']);

	}

	}

	if(empty($reason))
{
$reason = $lang->unknown;
}
if(empty($banlift))

	if(empty($reason))
{
$reason = $lang->unknown;
}
if(empty($banlift))

	{

	{

		$banlift = $lang->unknown;
}
if($ban['uid'])

		$banlift = $lang->unknown;
}
if($ban['uid'])

Zeile 316Zeile 336
eval("\$header = \"".$templates->get("header")."\";");

$copy_year = my_date("Y", time());

eval("\$header = \"".$templates->get("header")."\";");

$copy_year = my_date("Y", time());





// Are we showing version numbers in the footer?
if($mybb->settings['showvernum'] == "on")
{

// Are we showing version numbers in the footer?
if($mybb->settings['showvernum'] == "on")
{

Zeile 329Zeile 349
eval("\$footer = \"".$templates->get("footer")."\";");

// Add our main parts to the navigation

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";

// Check banned ip addresses

$navbits[0]['name'] = $mybb->settings['bbname'];
$navbits[0]['url'] = $mybb->settings['bburl']."/index.php";

// 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")))

{

{

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

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

}

}


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


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

Zeile 371Zeile 380
		{
error($lang->error_loadlimit);
}

		{
error($lang->error_loadlimit);
}

	}
}

	}
}


// If there is a valid referrer in the URL, cookie it
if(!$mybb->user['uid'] && $mybb->settings['usereferrals'] == "yes" && (isset($mybb->input['referrer']) || isset($mybb->input['referrername'])))


// If there is a valid referrer in the URL, cookie it
if(!$mybb->user['uid'] && $mybb->settings['usereferrals'] == "yes" && (isset($mybb->input['referrer']) || isset($mybb->input['referrername'])))

Zeile 382Zeile 391
		$condition = "username='".$db->escape_string($mybb->input['referrername'])."'";
}
else

		$condition = "username='".$db->escape_string($mybb->input['referrername'])."'";
}
else

	{

	{

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

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

	}

	}

	$query = $db->simple_select(TABLE_PREFIX."users", "uid", $condition);
$referrer = $db->fetch_array($query);
if($referrer['uid'])

	$query = $db->simple_select(TABLE_PREFIX."users", "uid", $condition);
$referrer = $db->fetch_array($query);
if($referrer['uid'])

	{
my_setcookie("mybb[referrer]", $referrer['username']);
}
}


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


// Check pages allowable even when not allowed to view board
$allowable_actions = array(
"member.php" => array(

// Check pages allowable even when not allowed to view board
$allowable_actions = array(
"member.php" => array(

Zeile 410Zeile 419
	),
);
if($mybb->usergroup['canview'] != "yes" && !(strtolower(basename($_SERVER['PHP_SELF'])) == "member.php" && in_array($mybb->input['action'], $allowable_actions['member.php'])) && strtolower(basename($_SERVER['PHP_SELF'])) != "captcha.php")

	),
);
if($mybb->usergroup['canview'] != "yes" && !(strtolower(basename($_SERVER['PHP_SELF'])) == "member.php" && in_array($mybb->input['action'], $allowable_actions['member.php'])) && strtolower(basename($_SERVER['PHP_SELF'])) != "captcha.php")

{

{

	error_no_permission();
}


	error_no_permission();
}


Zeile 433Zeile 442
		$collapsed[$ex] = "display: none;";
$collapsedimg[$val] = "_collapsed";
}

		$collapsed[$ex] = "display: none;";
$collapsedimg[$val] = "_collapsed";
}

}


}


// Randomly expire threads
if($rand > 8 || isset($mybb->input['force_thread_expiry']))

// Randomly expire threads
if($rand > 8 || isset($mybb->input['force_thread_expiry']))

{

{

	$db->delete_query(TABLE_PREFIX."threads", "deletetime != '0' AND deletetime < '".time()."'");
}

	$db->delete_query(TABLE_PREFIX."threads", "deletetime != '0' AND deletetime < '".time()."'");
}

 

// Randomly clear out old guest sessions (older than 24 hours)
if($rand > 4 && $rand < 8)
{
$timecut = time()-60*60*24;
$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";


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