Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: global.php 5380 2011-02-21 12:04:43Z Tomm $
| * $Id$
|
*/
$working_dir = dirname(__FILE__);
| */
$working_dir = dirname(__FILE__);
|
Zeile 61 | Zeile 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 125 | Zeile 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 225 | Zeile 228 |
---|
{ // Actually add the stylesheets to the list foreach($theme['stylesheets'][$stylesheet_script][$stylesheet_action] as $page_stylesheet)
|
{ // Actually add the stylesheets to the list foreach($theme['stylesheets'][$stylesheet_script][$stylesheet_action] as $page_stylesheet)
|
{
| {
|
if($already_loaded[$page_stylesheet]) { continue;
| if($already_loaded[$page_stylesheet]) { continue;
|
Zeile 233 | Zeile 236 |
---|
$stylesheets .= "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$mybb->settings['bburl']}/{$page_stylesheet}\" />\n"; $already_loaded[$page_stylesheet] = 1; }
|
$stylesheets .= "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$mybb->settings['bburl']}/{$page_stylesheet}\" />\n"; $already_loaded[$page_stylesheet] = 1; }
|
} }
| } }
|
}
// Are we linking to a remote theme server?
|
}
// Are we linking to a remote theme server?
|
if(substr($theme['imgdir'], 0, 7) == "http://")
| if(substr($theme['imgdir'], 0, 7) == "http://" || substr($theme['imgdir'], 0, 8) == "https://")
|
{ // If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']))
|
{ // If a language directory for the current language exists within the theme - we use it if(!empty($mybb->user['language']))
|
{ $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language']; }
| { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language']; }
|
else { // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage'])) {
|
else { // Check if a custom language directory exists for this theme if(!empty($mybb->settings['bblanguage'])) {
|
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; } // Otherwise, the image language directory is the same as the language directory for the theme else {
| $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; } // Otherwise, the image language directory is the same as the language directory for the theme else {
|
$theme['imglangdir'] = $theme['imgdir']; } }
| $theme['imglangdir'] = $theme['imgdir']; } }
|
Zeile 270 | Zeile 273 |
---|
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language'])) { $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
|
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 288 | Zeile 291 |
---|
// Theme logo - is it a relative URL to the forum root? Append bburl if(!preg_match("#^(\.\.?(/|$)|([a-z0-9]+)://)#i", $theme['logo']) && substr($theme['logo'], 0, 1) != "/")
|
// Theme logo - is it a relative URL to the forum root? Append bburl if(!preg_match("#^(\.\.?(/|$)|([a-z0-9]+)://)#i", $theme['logo']) && substr($theme['logo'], 0, 1) != "/")
|
{
| {
|
$theme['logo'] = $mybb->settings['bburl']."/".$theme['logo']; }
| $theme['logo'] = $mybb->settings['bburl']."/".$theme['logo']; }
|
Zeile 296 | Zeile 299 |
---|
if(isset($templatelist)) { $templatelist .= ',';
|
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 .= ",global_pending_joinrequests,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,header_welcomeblock_member_moderator,redirect,error"; $templates->cache($db->escape_string($templatelist));
| $templatelist .= "css,headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin,global_pm_alert,global_unreadreports,"; $templatelist .= ",global_pending_joinrequests,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,header_welcomeblock_member_moderator,redirect,error"; $templates->cache($db->escape_string($templatelist));
|
Zeile 305 | Zeile 308 |
---|
$datenow = my_date($mybb->settings['dateformat'], TIME_NOW, '', false); $timenow = my_date($mybb->settings['timeformat'], TIME_NOW); $lang->welcome_current_time = $lang->sprintf($lang->welcome_current_time, $datenow.', '.$timenow);
|
$datenow = my_date($mybb->settings['dateformat'], TIME_NOW, '', false); $timenow = my_date($mybb->settings['timeformat'], TIME_NOW); $lang->welcome_current_time = $lang->sprintf($lang->welcome_current_time, $datenow.', '.$timenow);
|
|
|
// Format the last visit date of this user appropriately if(isset($mybb->user['lastvisit']))
|
// Format the last visit date of this user appropriately if(isset($mybb->user['lastvisit']))
|
{
| {
|
$lastvisit = my_date($mybb->settings['dateformat'], $mybb->user['lastvisit']) . ', ' . my_date($mybb->settings['timeformat'], $mybb->user['lastvisit']); }
// Otherwise, they've never visited before
|
$lastvisit = my_date($mybb->settings['dateformat'], $mybb->user['lastvisit']) . ', ' . my_date($mybb->settings['timeformat'], $mybb->user['lastvisit']); }
// Otherwise, they've never visited before
|
else {
| else {
|
$lastvisit = $lang->lastvisit_never; }
| $lastvisit = $lang->lastvisit_never; }
|
Zeile 323 | Zeile 326 |
---|
if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['cancp'] == 1) { eval("\$bbclosedwarning = \"".$templates->get("global_boardclosed_warning")."\";");
|
if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['cancp'] == 1) { eval("\$bbclosedwarning = \"".$templates->get("global_boardclosed_warning")."\";");
|
}
| }
|
// Prepare the main templates for use unset($admincplink);
| // Prepare the main templates for use unset($admincplink);
|
Zeile 334 | Zeile 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")."\";"); } if($mybb->usergroup['canmodcp'] == 1) { eval("\$modcplink = \"".$templates->get("header_welcomeblock_member_moderator")."\";");
|
eval("\$admincplink = \"".$templates->get("header_welcomeblock_member_admin")."\";"); } if($mybb->usergroup['canmodcp'] == 1) { eval("\$modcplink = \"".$templates->get("header_welcomeblock_member_moderator")."\";");
|
}
| }
|
// 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 352 | Zeile 356 |
---|
// Otherwise, we have a guest else {
|
// Otherwise, we have a guest else {
|
| switch($mybb->settings['username_method']) { case 0: $login_username = $lang->login_username; break; case 1: $login_username = $lang->login_username1; break; case 2: $login_username = $lang->login_username2; break; default: $login_username = $lang->login_username; break; }
|
eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_guest")."\";"); }
| eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_guest")."\";"); }
|
Zeile 367 | Zeile 386 |
---|
foreach($groupleader as $user) { if($user['canmanagerequests'] != 1)
|
foreach($groupleader as $user) { if($user['canmanagerequests'] != 1)
|
{
| {
|
continue; }
| continue; }
|
Zeile 462 | Zeile 481 |
---|
// Check if this user has a new private message. if($mybb->user['pmnotice'] == 2 && $mybb->user['pms_unread'] > 0 && $mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->usergroup['canview'] != 0 && ($current_page != "private.php" || $mybb->input['action'] != "read")) {
|
// Check if this user has a new private message. if($mybb->user['pmnotice'] == 2 && $mybb->user['pms_unread'] > 0 && $mybb->settings['enablepms'] != 0 && $mybb->usergroup['canusepms'] != 0 && $mybb->usergroup['canview'] != 0 && ($current_page != "private.php" || $mybb->input['action'] != "read")) {
|
| if(!$parser) { require_once MYBB_ROOT.'inc/class_parser.php'; $parser = new postParser; }
|
$query = $db->query(" SELECT pm.subject, pm.pmid, fu.username AS fromusername, fu.uid AS fromuid FROM ".TABLE_PREFIX."privatemessages pm
| $query = $db->query(" SELECT pm.subject, pm.pmid, fu.username AS fromusername, fu.uid AS fromuid FROM ".TABLE_PREFIX."privatemessages pm
|
Zeile 470 | Zeile 495 |
---|
ORDER BY pm.dateline DESC LIMIT 1 ");
|
ORDER BY pm.dateline DESC LIMIT 1 ");
|
|
|
$pm = $db->fetch_array($query);
|
$pm = $db->fetch_array($query);
|
| $pm['subject'] = $parser->parse_badwords($pm['subject']);
|
if($pm['fromuid'] == 0)
|
if($pm['fromuid'] == 0)
|
{
| {
|
$pm['fromusername'] = $lang->mybb_engine; $user_text = $pm['fromusername']; }
| $pm['fromusername'] = $lang->mybb_engine; $user_text = $pm['fromusername']; }
|
Zeile 505 | Zeile 532 |
---|
if($mybb->settings['showvernum'] == 1) { $mybbversion = ' '.$mybb->version;
|
if($mybb->settings['showvernum'] == 1) { $mybbversion = ' '.$mybb->version;
|
} else {
| } else {
|
$mybbversion = ''; }
| $mybbversion = ''; }
|
Zeile 648 | Zeile 675 |
---|
else { error_no_permission();
|
else { 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));
|
} }
| } }
|