Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/eula.html *
|
* $Id: global.php 3063 2007-05-15 23:53:07Z chris $
| * $Id: global.php 3596 2008-01-20 08:27:39Z Tikitiki $
|
*/
// Load main MyBB core file which begins all of the magic
| */
// Load main MyBB core file which begins all of the magic
|
Zeile 42 | Zeile 42 |
---|
$session = new session; $session->init();
|
$session = new session; $session->init();
|
// Run global_start plugin hook now that the basics are set up $plugins->run_hooks("global_start");
| // Set our POST validation code here $mybb->post_code = generate_post_check();
|
// Set and load the language if(!isset($mybb->settings['bblanguage'])) { $mybb->settings['bblanguage'] = "english"; }
|
// Set and load the language if(!isset($mybb->settings['bblanguage'])) { $mybb->settings['bblanguage'] = "english"; }
|
|
|
// Load language $lang->set_language($mybb->settings['bblanguage']); $lang->load("global"); $lang->load("messages");
|
// Load language $lang->set_language($mybb->settings['bblanguage']); $lang->load("global"); $lang->load("messages");
|
| // 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'])) {
| if(function_exists('mb_internal_encoding') && !empty($lang->settings['charset'])) {
|
Zeile 106 | Zeile 109 |
---|
// 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'])."'");
| $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; }
| $style = $db->fetch_array($query); $load_from_forum = 1; }
|
Zeile 114 | Zeile 117 |
---|
// 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 122 | Zeile 125 |
---|
// 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; }
|
Zeile 145 | Zeile 148 |
---|
}
// 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);
// No theme was found - we attempt to load the master or any other theme
| $theme = $db->fetch_array($query);
// No theme was found - we attempt to load the master or any other theme
|
Zeile 209 | Zeile 212 |
---|
$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 266 | Zeile 269 |
---|
{ // 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 286 | Zeile 289 |
---|
if($lang->settings['charset']) { $charset = $lang->settings['charset'];
|
if($lang->settings['charset']) { $charset = $lang->settings['charset'];
|
}
| }
|
// If not, revert to UTF-8 else {
| // If not, revert to UTF-8 else {
|
Zeile 298 | Zeile 301 |
---|
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'])
| if($ban['uid'])
|
{ // Format their ban lift date and reason appropriately if($ban['lifted'] > 0)
| { // Format their ban lift date and reason appropriately if($ban['lifted'] > 0)
|
Zeile 352 | Zeile 356 |
---|
$navbits = array(); $navbits[0]['name'] = $mybb->settings['bbname']; $navbits[0]['url'] = $mybb->settings['bburl']."/index.php";
|
$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 if(is_banned_ip($session->ipaddress))
| // Check banned ip addresses if(is_banned_ip($session->ipaddress))
|
Zeile 361 | Zeile 368 |
---|
} // 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
|
// Load Limiting
|
if(strtolower(substr(PHP_OS, 0, 3)) !== 'win') { if($uptime = @exec('uptime')) { 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); }
| if(($load = get_server_load()) && $load != $lang->unknown) { // 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);
|
} }
| } }
|
Zeile 394 | Zeile 396 |
---|
{ $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 457 | Zeile 460 |
---|
$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");
|