Vergleich global.php - 1.6.0 - 1.6.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: global.php 5016 2010-06-12 00:24:02Z RyanGordon $

 * $Id: global.php 5640 2011-10-26 09:22:59Z Tomm $

 */

$working_dir = dirname(__FILE__);

 */

$working_dir = dirname(__FILE__);

Zeile 61Zeile 61
$mybb->post_code = generate_post_check();

// Set and load the language

$mybb->post_code = generate_post_check();

// Set and load the language

if($mybb->input['language'] && $lang->language_exists($mybb->input['language']))

if($mybb->input['language'] && $lang->language_exists($mybb->input['language']) && verify_post_check($mybb->input['my_post_key'], true))

{
$mybb->settings['bblanguage'] = $mybb->input['language'];
// If user is logged in, update their language selection with the new one
if($mybb->user['uid'])
{

{
$mybb->settings['bblanguage'] = $mybb->input['language'];
// If user is logged in, update their language selection with the new one
if($mybb->user['uid'])
{

 
		if($mybb->cookies['mybblang'])
{
my_unsetcookie("mybblang");
}


		$db->update_query("users", array("language" => $db->escape_string($mybb->settings['bblanguage'])), "uid='{$mybb->user['uid']}'");

		$db->update_query("users", array("language" => $db->escape_string($mybb->settings['bblanguage'])), "uid='{$mybb->user['uid']}'");

	}

	}

	// Guest = cookie
else
{
my_setcookie("mybblang", $mybb->settings['bblanguage']);
}
$mybb->user['language'] = $mybb->settings['bblanguage'];

	// Guest = cookie
else
{
my_setcookie("mybblang", $mybb->settings['bblanguage']);
}
$mybb->user['language'] = $mybb->settings['bblanguage'];

}

}

// Cookied language!

// Cookied language!

else if($mybb->cookies['mybblang'] && $lang->language_exists($mybb->cookies['mybblang']))
{

else if(!$mybb->user['uid'] && $mybb->cookies['mybblang'] && $lang->language_exists($mybb->cookies['mybblang']))
{

	$mybb->settings['bblanguage'] = $mybb->cookies['mybblang'];

	$mybb->settings['bblanguage'] = $mybb->cookies['mybblang'];

}

}

else if(!isset($mybb->settings['bblanguage']))
{
$mybb->settings['bblanguage'] = "english";

else if(!isset($mybb->settings['bblanguage']))
{
$mybb->settings['bblanguage'] = "english";

}


}


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

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

Zeile 125Zeile 130

if(in_array($current_page, $valid))
{


if(in_array($current_page, $valid))
{

 
	cache_forums();


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

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

		$query = $db->query("
SELECT f.style, f.overridestyle, p.*
FROM ".TABLE_PREFIX."forums f
LEFT JOIN ".TABLE_PREFIX."posts p ON(f.fid=p.fid)
WHERE p.pid='".intval($mybb->input['pid'])."'
LIMIT 1
");
$style = $db->fetch_array($query);

$load_from_forum = 1;
}


		$query = $db->simple_select("posts", "fid", "pid = '".intval($mybb->input['pid'])."'", array("limit" => 1));
$fid = $db->fetch_field($query, "fid");

if($fid)
{
$style = $forum_cache[$fid];
$load_from_forum = 1;
}
}




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

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

	{
$query = $db->query("
SELECT f.style, f.overridestyle, t.*
FROM ".TABLE_PREFIX."forums f
LEFT JOIN ".TABLE_PREFIX."threads t ON (f.fid=t.fid)
WHERE t.tid='".intval($mybb->input['tid'])."'
LIMIT 1
");
$style = $db->fetch_array($query);
$load_from_forum = 1;
}


	{
$query = $db->simple_select("threads", "fid", "tid = '".intval($mybb->input['tid'])."'", array("limit" => 1));
$fid = $db->fetch_field($query, "fid");

if($fid)
{
$style = $forum_cache[$fid];
$load_from_forum = 1;
}
}



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

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

		cache_forums();

 
		$style = $forum_cache[intval($mybb->input['fid'])];
$load_from_forum = 1;
}

		$style = $forum_cache[intval($mybb->input['fid'])];
$load_from_forum = 1;
}

Zeile 294Zeile 297

// Load Main Templates and Cached Templates
if(isset($templatelist))


// Load Main Templates and Cached Templates
if(isset($templatelist))

{

{

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

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

Zeile 334Zeile 337
	// User can access the admin cp and we're not hiding admin cp links, fetch it
if($mybb->usergroup['cancp'] == 1 && $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'] == 1 && $mybb->config['hide_admin_links'] != 1)
{

 
		$admin_dir = $config['admin_dir'];

		eval("\$admincplink = \"".$templates->get("header_welcomeblock_member_admin")."\";");
}


		eval("\$admincplink = \"".$templates->get("header_welcomeblock_member_admin")."\";");
}


Zeile 343Zeile 347
	}

// Format the welcome back message

	}

// Format the welcome back message

	$lang->welcome_back = $lang->sprintf($lang->welcome_back, $mybb->user['username'], $lastvisit);

	$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);


// Tell the user their PM usage
$lang->welcome_pms_usage = $lang->sprintf($lang->welcome_pms_usage, my_number_format($mybb->user['pms_unread']), my_number_format($mybb->user['pms_total']));


// Tell the user their PM usage
$lang->welcome_pms_usage = $lang->sprintf($lang->welcome_pms_usage, my_number_format($mybb->user['pms_unread']), my_number_format($mybb->user['pms_total']));

Zeile 512Zeile 516
}

// Check to see if we have any tasks to run

}

// Check to see if we have any tasks to run

if($mybb->settings['taskscron'] != 1)


$task_cache = $cache->read("tasks");
if(!$task_cache['nextrun'])

{

{

	$task_cache = $cache->read("tasks");
if(!$task_cache['nextrun'])
{
$task_cache['nextrun'] = TIME_NOW;
}
if($task_cache['nextrun'] <= TIME_NOW)
{
$task_image = "<img src=\"{$mybb->settings['bburl']}/task.php\" border=\"0\" width=\"1\" height=\"1\" alt=\"\" />";
}
else
{
$task_image = '';
}

	$task_cache['nextrun'] = TIME_NOW;
}
if($task_cache['nextrun'] <= TIME_NOW)
{
$task_image = "<img src=\"{$mybb->settings['bburl']}/task.php\" border=\"0\" width=\"1\" height=\"1\" alt=\"\" />";
}
else
{
$task_image = '';





}

// Are we showing the quick language selection box?

}

// Are we showing the quick language selection box?

Zeile 551Zeile 552
	$lang_redirect_url = get_current_location(true, 'language');

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

	$lang_redirect_url = get_current_location(true, 'language');

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

}


}


// DST Auto detection enabled?
if($mybb->user['uid'] > 0 && $mybb->user['dstcorrection'] == 2)
{
$auto_dst_detection = "<script type=\"text/javascript\">if(MyBB) { Event.observe(window, 'load', function() { MyBB.detectDSTChange('".($mybb->user['timezone']+$mybb->user['dst'])."'); }); }</script>\n";

// DST Auto detection enabled?
if($mybb->user['uid'] > 0 && $mybb->user['dstcorrection'] == 2)
{
$auto_dst_detection = "<script type=\"text/javascript\">if(MyBB) { Event.observe(window, 'load', function() { MyBB.detectDSTChange('".($mybb->user['timezone']+$mybb->user['dst'])."'); }); }</script>\n";

}


}


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

// Add our main parts to the navigation

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

// Add our main parts to the navigation

Zeile 573Zeile 574
if(is_banned_ip($session->ipaddress, true))
{
if ($mybb->user['uid'])

if(is_banned_ip($session->ipaddress, true))
{
if ($mybb->user['uid'])

    {

    {

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

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

    }

    }

    else
{
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."'");
}
error($lang->error_banned);

    else
{
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."'");
}
error($lang->error_banned);

}

}


$closed_bypass = array(
"member.php" => array(


$closed_bypass = array(
"member.php" => array(

Zeile 599Zeile 600
	$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
if($mybb->usergroup['cancp'] != 1 && $mybb->settings['load'] > 0 && ($load = get_server_load()) && $load != $lang->unknown && $load > $mybb->settings['load'])
{
// User is not an administrator and the load limit is higher than the limit, show an error
error($lang->error_loadlimit);

// Load Limiting
if($mybb->usergroup['cancp'] != 1 && $mybb->settings['load'] > 0 && ($load = get_server_load()) && $load != $lang->unknown && $load > $mybb->settings['load'])
{
// User is not an administrator and the load limit is higher than the limit, show an error
error($lang->error_loadlimit);

}


}


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

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

	{

	{

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

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

	}
else
{

	}
else
{

		$condition = "uid='".intval($mybb->input['referrer'])."'";
}
$query = $db->simple_select("users", "uid", $condition, array('limit' => 1));

		$condition = "uid='".intval($mybb->input['referrer'])."'";
}
$query = $db->simple_select("users", "uid", $condition, array('limit' => 1));

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

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

	}
}

	}
}


if($mybb->usergroup['canview'] != 1)
{


if($mybb->usergroup['canview'] != 1)
{

Zeile 633Zeile 634
	if(defined("ALLOWABLE_PAGE"))
{
if(is_string(ALLOWABLE_PAGE))

	if(defined("ALLOWABLE_PAGE"))
{
if(is_string(ALLOWABLE_PAGE))

		{

		{

			$allowable_actions = explode(',', ALLOWABLE_PAGE);

			$allowable_actions = explode(',', ALLOWABLE_PAGE);

			

			

			if(!in_array($mybb->input['action'], $allowable_actions))
{
error_no_permission();
}

unset($allowable_actions);

			if(!in_array($mybb->input['action'], $allowable_actions))
{
error_no_permission();
}

unset($allowable_actions);

		}

		}

		else if(ALLOWABLE_PAGE !== 1)
{
error_no_permission();
}

		else if(ALLOWABLE_PAGE !== 1)
{
error_no_permission();
}

	}

	}

	else

	else

	{

	{

		error_no_permission();

		error_no_permission();

 
	}
}

// Find out if this user of ours is using a banned email address.
// If they are, redirect them to change it
if($mybb->user['uid'] && is_banned_email($mybb->user['email']) && $mybb->settings['emailkeep'] != 1)
{
if(THIS_SCRIPT != "usercp.php" || THIS_SCRIPT == "usercp.php" && $mybb->input['action'] != "email" && $mybb->input['action'] != "do_email")
{
redirect("usercp.php?action=email");
}
else if($mybb->request_method != "post")
{
$banned_email_error = inline_error(array($lang->banned_email_warning));

	}
}


	}
}