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 5640 2011-10-26 09:22:59Z 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']) && verify_post_check($mybb->input['my_post_key'], true))
| if(!empty($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
| { $mybb->settings['bblanguage'] = $mybb->input['language']; // If user is logged in, update their language selection with the new one
|
Zeile 82 | Zeile 82 |
---|
$mybb->user['language'] = $mybb->settings['bblanguage']; } // Cookied language!
|
$mybb->user['language'] = $mybb->settings['bblanguage']; } // Cookied language!
|
else if(!$mybb->user['uid'] && $mybb->cookies['mybblang'] && $lang->language_exists($mybb->cookies['mybblang']))
| else if(!$mybb->user['uid'] && !empty($mybb->cookies['mybblang']) && $lang->language_exists($mybb->cookies['mybblang']))
|
{ $mybb->settings['bblanguage'] = $mybb->cookies['mybblang']; }
| { $mybb->settings['bblanguage'] = $mybb->cookies['mybblang']; }
|
Zeile 95 | Zeile 95 |
---|
$lang->set_language($mybb->settings['bblanguage']); $lang->load("global"); $lang->load("messages");
|
$lang->set_language($mybb->settings['bblanguage']); $lang->load("global"); $lang->load("messages");
|
| $newpmmsg = '';
|
// 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 133 | Zeile 134 |
---|
cache_forums();
// If we're accessing a post, fetch the forum theme for it and if we're overriding it
|
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(!empty($mybb->input['pid']))
|
{ $query = $db->simple_select("posts", "fid", "pid = '".intval($mybb->input['pid'])."'", array("limit" => 1)); $fid = $db->fetch_field($query, "fid");
| { $query = $db->simple_select("posts", "fid", "pid = '".intval($mybb->input['pid'])."'", array("limit" => 1)); $fid = $db->fetch_field($query, "fid");
|
Zeile 144 | Zeile 145 |
---|
$load_from_forum = 1; } }
|
$load_from_forum = 1; } }
|
| |
// We have a thread id and a forum id, we can easily fetch the theme for this forum
|
// We have a thread id and a forum id, we can easily fetch the theme for this forum
|
else if($mybb->input['tid'])
| else if(!empty($mybb->input['tid']))
|
{ $query = $db->simple_select("threads", "fid", "tid = '".intval($mybb->input['tid'])."'", array("limit" => 1)); $fid = $db->fetch_field($query, "fid");
| { $query = $db->simple_select("threads", "fid", "tid = '".intval($mybb->input['tid'])."'", array("limit" => 1)); $fid = $db->fetch_field($query, "fid");
|
Zeile 207 | Zeile 207 |
---|
$theme = @array_merge($theme, unserialize($theme['properties']));
// Fetch all necessary stylesheets
|
$theme = @array_merge($theme, unserialize($theme['properties']));
// Fetch all necessary stylesheets
|
| $stylesheets = '';
|
$theme['stylesheets'] = unserialize($theme['stylesheets']); $stylesheet_scripts = array("global", basename($_SERVER['PHP_SELF'])); foreach($stylesheet_scripts as $stylesheet_script) { $stylesheet_actions = array("global");
|
$theme['stylesheets'] = unserialize($theme['stylesheets']); $stylesheet_scripts = array("global", basename($_SERVER['PHP_SELF'])); foreach($stylesheet_scripts as $stylesheet_script) { $stylesheet_actions = array("global");
|
if($mybb->input['action'])
| if(!empty($mybb->input['action']))
|
{ $stylesheet_actions[] = $mybb->input['action']; }
| { $stylesheet_actions[] = $mybb->input['action']; }
|
Zeile 224 | Zeile 225 |
---|
continue; }
|
continue; }
|
if($theme['stylesheets'][$stylesheet_script][$stylesheet_action])
| if(!empty($theme['stylesheets'][$stylesheet_script][$stylesheet_action]))
|
{ // 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])
| if(!empty($already_loaded[$page_stylesheet]))
|
{ continue; }
| { continue; }
|
Zeile 241 | Zeile 242 |
---|
}
// 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']))
|
Zeile 278 | Zeile 279 |
---|
{ // Check if a custom language directory exists for this theme if(is_dir($theme['imgdir'].'/'.$mybb->settings['bblanguage']))
|
{ // Check if a custom language directory exists for this theme if(is_dir($theme['imgdir'].'/'.$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
| $theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage']; } // Otherwise, the image language directory is the same as the language directory for the theme
|
Zeile 300 | Zeile 301 |
---|
{ $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 .= "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";
|
$templatelist .= ",global_pending_joinrequests,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,header_welcomeblock_member_moderator,redirect,error";
|
| $templatelist .= ",global_boardclosed_warning,global_bannedwarning,error_inline,error_nopermission_loggedin,error_nopermission";
|
$templates->cache($db->escape_string($templatelist));
// Set the current date and time now $datenow = my_date($mybb->settings['dateformat'], TIME_NOW, '', false); $timenow = my_date($mybb->settings['timeformat'], TIME_NOW);
|
$templates->cache($db->escape_string($templatelist));
// Set the current date and time now $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);
| $lang->welcome_current_time = $lang->sprintf($lang->welcome_current_time, $datenow . $lang->comma . $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']);
| $lastvisit = my_date($mybb->settings['dateformat'], $mybb->user['lastvisit']) . $lang->comma . my_date($mybb->settings['timeformat'], $mybb->user['lastvisit']);
|
}
// Otherwise, they've never visited before
| }
// Otherwise, they've never visited before
|
Zeile 356 | Zeile 358 |
---|
// 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 369 | Zeile 386 |
---|
$gids = ""; foreach($groupleader as $user)
|
$gids = ""; foreach($groupleader as $user)
|
{
| {
|
if($user['canmanagerequests'] != 1) { continue; } $gids .= ",{$user['gid']}";
|
if($user['canmanagerequests'] != 1) { continue; } $gids .= ",{$user['gid']}";
|
}
| }
|
$query = $db->simple_select("joinrequests", "COUNT(uid) as total", "gid IN (0{$gids})"); $total_joinrequests = $db->fetch_field($query, "total"); $pending_joinrequests = ""; if($total_joinrequests > 0)
|
$query = $db->simple_select("joinrequests", "COUNT(uid) as total", "gid IN (0{$gids})"); $total_joinrequests = $db->fetch_field($query, "total"); $pending_joinrequests = ""; if($total_joinrequests > 0)
|
{
| {
|
if($total_joinrequests == 1) { $lang->pending_joinrequests = $lang->pending_joinrequest;
| if($total_joinrequests == 1) { $lang->pending_joinrequests = $lang->pending_joinrequest;
|
Zeile 409 | Zeile 426 |
---|
if($reported['unread'] == 1) { $lang->unread_reports = $lang->unread_report;
|
if($reported['unread'] == 1) { $lang->unread_reports = $lang->unread_report;
|
} else
| } else
|
{ $lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']); }
| { $lang->unread_reports = $lang->sprintf($lang->unread_reports, $reported['unread']); }
|
Zeile 464 | Zeile 481 |
---|
$lang->ajax_loading = str_replace("'", "\\'", $lang->ajax_loading);
// Check if this user has a new private message.
|
$lang->ajax_loading = str_replace("'", "\\'", $lang->ajax_loading);
// 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"))
| $pm_notice = ''; if(isset($mybb->user['pmnotice']) && $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 474 | Zeile 498 |
---|
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) {
|
Zeile 531 | Zeile 557 |
---|
}
// Are we showing the quick language selection box?
|
}
// Are we showing the quick language selection box?
|
$lang_select = '';
| $lang_select = $lang_options = '';
|
if($mybb->settings['showlanguageselect'] != 0) { $languages = $lang->get_languages();
| if($mybb->settings['showlanguageselect'] != 0) { $languages = $lang->get_languages();
|
Zeile 542 | Zeile 568 |
---|
if($lang->language == $key) { $lang_options .= "<option value=\"{$key}\" selected=\"selected\"> {$language}</option>\n";
|
if($lang->language == $key) { $lang_options .= "<option value=\"{$key}\" selected=\"selected\"> {$language}</option>\n";
|
}
| }
|
else { $lang_options .= "<option value=\"{$key}\"> {$language}</option>\n";
| else { $lang_options .= "<option value=\"{$key}\"> {$language}</option>\n";
|
Zeile 555 | Zeile 581 |
---|
}
// DST Auto detection enabled?
|
}
// DST Auto detection enabled?
|
| $auto_dst_detection = '';
|
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";
|
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 582 | Zeile 609 |
---|
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."'"); } error($lang->error_banned);
|
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."'"); } error($lang->error_banned);
|
}
| }
|
$closed_bypass = array( "member.php" => array( "login",
| $closed_bypass = array( "member.php" => array( "login",
|
Zeile 607 | Zeile 634 |
---|
{ // User is not an administrator and the load limit is higher than the limit, show an error error($lang->error_loadlimit);
|
{ // 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 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'])))
|
Zeile 615 | Zeile 642 |
---|
if(isset($mybb->input['referrername'])) { $condition = "username='".$db->escape_string($mybb->input['referrername'])."'";
|
if(isset($mybb->input['referrername'])) { $condition = "username='".$db->escape_string($mybb->input['referrername'])."'";
|
}
| }
|
else { $condition = "uid='".intval($mybb->input['referrer'])."'";
| else { $condition = "uid='".intval($mybb->input['referrer'])."'";
|
Zeile 623 | Zeile 650 |
---|
$query = $db->simple_select("users", "uid", $condition, array('limit' => 1)); $referrer = $db->fetch_array($query); if($referrer['uid'])
|
$query = $db->simple_select("users", "uid", $condition, array('limit' => 1)); $referrer = $db->fetch_array($query); if($referrer['uid'])
|
{
| {
|
my_setcookie("mybb[referrer]", $referrer['uid']); } }
| my_setcookie("mybb[referrer]", $referrer['uid']); } }
|
Zeile 670 | Zeile 697 |
---|
}
// work out which items the user has collapsed
|
}
// work out which items the user has collapsed
|
$colcookie = $mybb->cookies['collapsed'];
| $colcookie = empty($mybb->cookies['collapsed']) ? false : $mybb->cookies['collapsed'];
|
// set up collapsable items (to automatically show them us expanded)
|
// set up collapsable items (to automatically show them us expanded)
|
| $collapsed = array('boardstats' => '', 'boardstats_e' => '', 'quickreply' => '', 'quickreply_e' => ''); $collapsedimg = $collapsed;
|
if($colcookie) { $col = explode("|", $colcookie);
| if($colcookie) { $col = explode("|", $colcookie);
|