Vergleich global.php - 1.8.1 - 1.8.6

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 17Zeile 17
// Load main MyBB core file which begins all of the magic
require_once $working_dir.'/inc/init.php';


// Load main MyBB core file which begins all of the magic
require_once $working_dir.'/inc/init.php';


$shutdown_queries = array();

$shutdown_queries = $shutdown_functions = array();


// Read the usergroups cache as well as the moderators cache
$groupscache = $cache->read('usergroups');


// Read the usergroups cache as well as the moderators cache
$groupscache = $cache->read('usergroups');

Zeile 111Zeile 111
// The user used our new quick theme changer
if(isset($mybb->input['theme']) && verify_post_check($mybb->get_input('my_post_key'), true))
{

// The user used our new quick theme changer
if(isset($mybb->input['theme']) && verify_post_check($mybb->get_input('my_post_key'), true))
{

	$mybb->user['style'] = $mybb->get_input('theme');
// If user is logged in, update their theme selection with the new one
if($mybb->user['uid'])
{
if(isset($mybb->cookies['mybbtheme']))
{
my_unsetcookie('mybbtheme');
}

$db->update_query('users', array('style' => (int)$mybb->user['style']), "uid = '{$mybb->user['uid']}'");
}
// Guest = cookie
else
{
my_setcookie('mybbtheme', $mybb->get_input('theme'));
}



















	// Set up user handler.
require_once MYBB_ROOT.'inc/datahandlers/user.php';
$userhandler = new UserDataHandler('update');

$user = array(
'uid' => $mybb->user['uid'],
'style' => $mybb->get_input('theme', MyBB::INPUT_INT),
'usergroup' => $mybb->user['usergroup'],
'additionalgroups' => $mybb->user['additionalgroups']
);

$userhandler->set_data($user);

// validate_user verifies the style if it is set in the data array.
if($userhandler->validate_user())
{
$mybb->user['style'] = $user['style'];

// If user is logged in, update their theme selection with the new one
if($mybb->user['uid'])
{
if(isset($mybb->cookies['mybbtheme']))
{
my_unsetcookie('mybbtheme');
}

$userhandler->update_user();
}
// Guest = cookie
else
{
my_setcookie('mybbtheme', $user['style']);
}
}

}
// Cookied theme!
else if(!$mybb->user['uid'] && !empty($mybb->cookies['mybbtheme']))
{

}
// Cookied theme!
else if(!$mybb->user['uid'] && !empty($mybb->cookies['mybbtheme']))
{

	$mybb->user['style'] = $mybb->cookies['mybbtheme'];

	$mybb->user['style'] = (int)$mybb->cookies['mybbtheme'];

}

// This user has a custom theme set in their profile
if(isset($mybb->user['style']) && (int)$mybb->user['style'] != 0)

}

// This user has a custom theme set in their profile
if(isset($mybb->user['style']) && (int)$mybb->user['style'] != 0)

{
$mybb->user['style'] = (int)$mybb->user['style'];


{
$mybb->user['style'] = (int)$mybb->user['style'];


	$loadstyle = "tid = '{$mybb->user['style']}'";
$load_from_user = 1;
}

	$loadstyle = "tid = '{$mybb->user['style']}'";
$load_from_user = 1;
}

Zeile 207Zeile 225

// From all of the above, a theme was found
if(isset($style['style']) && $style['style'] > 0)


// From all of the above, a theme was found
if(isset($style['style']) && $style['style'] > 0)

{

{

	$style['style'] = (int)$style['style'];

	$style['style'] = (int)$style['style'];





	// This theme is forced upon the user, overriding their selection
if($style['overridestyle'] == 1 || !isset($mybb->user['style']))
{

	// This theme is forced upon the user, overriding their selection
if($style['overridestyle'] == 1 || !isset($mybb->user['style']))
{

Zeile 219Zeile 237

// After all of that no theme? Load the board default
if(empty($loadstyle))


// After all of that no theme? Load the board default
if(empty($loadstyle))

{

{

	$loadstyle = "def='1'";

	$loadstyle = "def='1'";

}


}


// Fetch the theme to load from the cache

// Fetch the theme to load from the cache

 
if($loadstyle != "def='1'")
{
$query = $db->simple_select('themes', 'name, tid, properties, stylesheets, allowedgroups', $loadstyle, array('limit' => 1));
$theme = $db->fetch_array($query);

if(isset($theme['tid']) && !$load_from_forum && !is_member($theme['allowedgroups']) && $theme['allowedgroups'] != 'all')
{
if($load_from_user == 1)
{
$db->update_query('users', array('style' => 0), "style='{$mybb->user['style']}' AND uid='{$mybb->user['uid']}'");
}

if(isset($mybb->cookies['mybbtheme']))
{
my_unsetcookie('mybbtheme');
}

$loadstyle = "def='1'";
}
}


if($loadstyle == "def='1'")
{
if(!$cache->read('default_theme'))
{
$cache->update_default_theme();
}

if($loadstyle == "def='1'")
{
if(!$cache->read('default_theme'))
{
$cache->update_default_theme();
}

 


	$theme = $cache->read('default_theme');

	$theme = $cache->read('default_theme');

}
else
{
$query = $db->simple_select('themes', 'name, tid, properties, stylesheets', $loadstyle, array('limit' => 1));
$theme = $db->fetch_array($query);


$load_from_forum = $load_from_user = 0;




}

// No theme was found - we attempt to load the master or any other theme

}

// No theme was found - we attempt to load the master or any other theme

Zeile 243Zeile 280
{
// Missing theme was from a forum, run a query to set any forums using the theme to the default
if($load_from_forum == 1)

{
// Missing theme was from a forum, run a query to set any forums using the theme to the default
if($load_from_forum == 1)

	{

	{

		$db->update_query('forums', array('style' => 0), "style = '{$style['style']}'");
}
// Missing theme was from a user, run a query to set any users using the theme to the default

		$db->update_query('forums', array('style' => 0), "style = '{$style['style']}'");
}
// Missing theme was from a user, run a query to set any users using the theme to the default

Zeile 265Zeile 302
if(!empty($theme['color']))
{
$stylesheet_scripts[] = $theme['color'];

if(!empty($theme['color']))
{
$stylesheet_scripts[] = $theme['color'];

}

}

$stylesheet_actions = array("global");
if(!empty($mybb->input['action']))

$stylesheet_actions = array("global");
if(!empty($mybb->input['action']))

{

{

	$stylesheet_actions[] = $mybb->get_input('action');
}
foreach($stylesheet_scripts as $stylesheet_script)

	$stylesheet_actions[] = $mybb->get_input('action');
}
foreach($stylesheet_scripts as $stylesheet_script)

Zeile 277Zeile 314
	foreach($stylesheet_actions as $stylesheet_action)
{
if(!$stylesheet_action)

	foreach($stylesheet_actions as $stylesheet_action)
{
if(!$stylesheet_action)

		{

		{

			continue;
}


			continue;
}


Zeile 298Zeile 335
				else
{
$stylesheet_url = $mybb->get_asset_url($page_stylesheet);

				else
{
$stylesheet_url = $mybb->get_asset_url($page_stylesheet);

				}


				}


				if($mybb->settings['minifycss'])
{
$stylesheet_url = str_replace('.css', '.min.css', $stylesheet_url);

				if($mybb->settings['minifycss'])
{
$stylesheet_url = str_replace('.css', '.min.css', $stylesheet_url);

Zeile 321Zeile 358

$already_loaded[$page_stylesheet] = 1;
}


$already_loaded[$page_stylesheet] = 1;
}

		}
}

		}
}

}
unset($actions);


}
unset($actions);


Zeile 333Zeile 370
		if(!empty($theme_stylesheets[$style_name]))
{
$stylesheets .= $theme_stylesheets[$style_name];

		if(!empty($theme_stylesheets[$style_name]))
{
$stylesheets .= $theme_stylesheets[$style_name];

		}
}
}


		}
}
}


// Are we linking to a remote theme server?
if(my_substr($theme['imgdir'], 0, 7) == 'http://' || my_substr($theme['imgdir'], 0, 8) == 'https://')
{
// If a language directory for the current language exists within the theme - we use it

// Are we linking to a remote theme server?
if(my_substr($theme['imgdir'], 0, 7) == 'http://' || my_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(!empty($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']))
{
$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'];
}
}
}
else
{
$img_directory = $theme['imgdir'];

if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$img_directory = rtrim($mybb->settings['cdnpath'], '/') . '/' . ltrim($theme['imgdir'], '/');
}

if(!@is_dir($img_directory))
{
$theme['imgdir'] = 'images';
}

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

	{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
// Check if a custom language directory exists for this theme

	{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
// Check if a custom language directory exists for this theme

		if(!empty($mybb->settings['bblanguage']))

		if(is_dir($img_directory.'/'.$mybb->settings['bblanguage']))

		{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}

		{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}

Zeile 358Zeile 428
			$theme['imglangdir'] = $theme['imgdir'];
}
}

			$theme['imglangdir'] = $theme['imgdir'];
}
}

}
else
{
$img_directory = $theme['imgdir'];

if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
{
$img_directory = rtrim($mybb->settings['cdnpath'], '/') . '/' . ltrim($theme['imgdir'], '/');
}

if(!@is_dir($img_directory))
{
$theme['imgdir'] = 'images';
}

// If a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']) && is_dir($img_directory.'/'.$mybb->user['language']))
{
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
// Check if a custom language directory exists for this theme
if(is_dir($img_directory.'/'.$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'];
}
}

 




    $theme['imgdir'] = $mybb->get_asset_url($theme['imgdir']);
$theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']);

	$theme['imgdir'] = $mybb->get_asset_url($theme['imgdir']);
$theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']);

}

// Theme logo - is it a relative URL to the forum root? Append bburl

}

// Theme logo - is it a relative URL to the forum root? Append bburl

Zeile 414Zeile 451

$templatelist .= "headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin,global_pm_alert,global_unreadreports,error,footer_languageselect_option,footer_contactus";
$templatelist .= ",global_pending_joinrequests,global_awaiting_activation,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,footer_themeselect,header_welcomeblock_member_moderator,redirect,header_menu_calendar,nav_dropdown,footer_themeselector,task_image";


$templatelist .= "headerinclude,header,footer,gobutton,htmldoctype,header_welcomeblock_member,header_welcomeblock_guest,header_welcomeblock_member_admin,global_pm_alert,global_unreadreports,error,footer_languageselect_option,footer_contactus";
$templatelist .= ",global_pending_joinrequests,global_awaiting_activation,nav,nav_sep,nav_bit,nav_sep_active,nav_bit_active,footer_languageselect,footer_themeselect,header_welcomeblock_member_moderator,redirect,header_menu_calendar,nav_dropdown,footer_themeselector,task_image";

$templatelist .= ",global_boardclosed_warning,global_bannedwarning,error_inline,error_nopermission_loggedin,error_nopermission,debug_summary,header_quicksearch,header_menu_search,header_menu_portal,header_menu_memberlist,usercp_themeselector_option,smilie";


$templatelist .= ",global_boardclosed_warning,global_bannedwarning,error_inline,error_nopermission_loggedin,error_nopermission,debug_summary,header_quicksearch,header_menu_search,header_menu_portal,header_menu_memberlist,usercp_themeselector_option,smilie,global_board_offline_modal";
$templatelist .= ",video_dailymotion_embed,video_facebook_embed,video_liveleak_embed,video_metacafe_embed,video_myspacetv_embed,video_veoh_embed,video_vimeo_embed,video_yahoo_embed,video_youtube_embed";

$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 . $lang->comma . $timenow);

$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 . $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']))
{

Zeile 588Zeile 626
	{
$can_access_moderationqueue = false;
}

	{
$can_access_moderationqueue = false;
}

	



	if($can_access_moderationqueue || ($mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'] == 1 && $mybb->usergroup['canmanagereportedcontent'] == 1))
{
// Read the reported content cache

	if($can_access_moderationqueue || ($mybb->user['ismoderator'] && $mybb->usergroup['canmodcp'] == 1 && $mybb->usergroup['canmanagereportedcontent'] == 1))
{
// Read the reported content cache

Zeile 719Zeile 757
	eval('$pm_notice = "'.$templates->get('global_pm_alert').'";');
}


	eval('$pm_notice = "'.$templates->get('global_pm_alert').'";');
}


if($mybb->usergroup['cancp'] == 1)

if($mybb->settings['awactialert'] == 1 && $mybb->usergroup['cancp'] == 1)

{
$awaitingusers = $cache->read('awaitingactivation');

{
$awaitingusers = $cache->read('awaitingactivation');

 

if(isset($awaitingusers['time']) && $awaitingusers['time'] + 86400 < TIME_NOW)
{
$cache->update_awaitingactivation();
$awaitingusers = $cache->read('awaitingactivation');
}


if(!empty($awaitingusers['users']))
{
$awaitingusers = (int)$awaitingusers['users'];
}


if(!empty($awaitingusers['users']))
{
$awaitingusers = (int)$awaitingusers['users'];
}

	else
{
$awaitingusers = 0;
}

	else
{
$awaitingusers = 0;
}


if($awaitingusers < 1)


if($awaitingusers < 1)

	{

	{

		$awaitingusers = 0;
}
else
{
$awaitingusers = my_number_format($awaitingusers);
}

		$awaitingusers = 0;
}
else
{
$awaitingusers = my_number_format($awaitingusers);
}

	



	if($awaitingusers > 0)
{
if($awaitingusers == 1)

	if($awaitingusers > 0)
{
if($awaitingusers == 1)

		{

		{

			$awaiting_message = $lang->awaiting_message_single;
}
else
{
$awaiting_message = $lang->sprintf($lang->awaiting_message_plural, $awaitingusers);
}

			$awaiting_message = $lang->awaiting_message_single;
}
else
{
$awaiting_message = $lang->sprintf($lang->awaiting_message_plural, $awaitingusers);
}

 

if($admincplink)
{
$awaiting_message .= $lang->sprintf($lang->awaiting_message_link, $mybb->settings['bburl'], $admin_dir);
}


		eval('$awaitingusers = "'.$templates->get('global_awaiting_activation').'";');
}
else

		eval('$awaitingusers = "'.$templates->get('global_awaiting_activation').'";');
}
else

Zeile 862Zeile 912
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_binary($session->packedip)." OR uid='{$mybb->user['uid']}'");

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

    }
else
{

	}
else
{

		$db->delete_query('sessions', "ip = ".$db->escape_binary($session->packedip));

		$db->delete_query('sessions', "ip = ".$db->escape_binary($session->packedip));

    }

	}

	error($lang->error_banned);
}

	error($lang->error_banned);
}





$closed_bypass = array(
'member.php' => array(
'login',

$closed_bypass = array(
'member.php' => array(
'login',

Zeile 885Zeile 935
if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['canviewboardclosed'] != 1 && !in_array($current_page, $closed_bypass) && (!is_array($closed_bypass[$current_page]) || !in_array($mybb->get_input('action'), $closed_bypass[$current_page])))
{
// Show error

if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['canviewboardclosed'] != 1 && !in_array($current_page, $closed_bypass) && (!is_array($closed_bypass[$current_page]) || !in_array($mybb->get_input('action'), $closed_bypass[$current_page])))
{
// Show error

 
	if(!$mybb->settings['boardclosed_reason'])
{
$mybb->settings['boardclosed_reason'] = $lang->boardclosed_reason;
}


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

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

	error($lang->error_boardclosed);












if(!$mybb->get_input('modal'))
{
error($lang->error_boardclosed);
}
else
{
$output = '';
eval('$output = "'.$templates->get('global_board_offline_modal', 1, 0).'";');
echo($output);
}

	exit;
}


	exit;
}


Zeile 931Zeile 996
	}
else
{

	}
else
{

		$condition = "uid = '".$mybb->get_input('referrer', 1)."'";

		$condition = "uid = '".$mybb->get_input('referrer', MyBB::INPUT_INT)."'";

	}

$query = $db->simple_select('users', 'uid', $condition, array('limit' => 1));

	}

$query = $db->simple_select('users', 'uid', $condition, array('limit' => 1));