Skip to content
Permalink
Browse files

get_theme should not need to call get_member in 99% of cases / furthe…

…r fixes for Facebook bootstrap issue
  • Loading branch information...
chrisgraham committed May 29, 2019
1 parent 3752586 commit 4666f8a8dcb632eb64c887808bd9eef91d600caa
Showing with 12 additions and 7 deletions.
  1. +11 −6 sources/forum_stub.php
  2. +1 −1 sources_custom/facebook_connect.php
@@ -437,13 +437,12 @@ public function get_theme($zone_for = null, $member_id = null)
{
global $SITE_INFO, $ZONE, $USER_THEME_CACHE, $IN_MINIKERNEL_VERSION;
if (($member_id === null) || ($IN_MINIKERNEL_VERSION)) {
$member_id = $IN_MINIKERNEL_VERSION ? $this->get_guest_id() : get_member();
$is_current_member = true;
} else {
$is_current_member = (get_member() == $member_id);
if ($IN_MINIKERNEL_VERSION) {
return 'default';
}
$is_current_member = (($member_id === null) || (get_member() == $member_id));
if ($zone_for === null) {
if (($USER_THEME_CACHE !== null) && ($is_current_member)) {
return $USER_THEME_CACHE;
@@ -455,7 +454,7 @@ public function get_theme($zone_for = null, $member_id = null)
$current_zone_requested = (get_zone_name() == $zone_for);
}
if (($IN_MINIKERNEL_VERSION) || (in_safe_mode())) {
if (in_safe_mode()) {
return ($zone_for === 'adminzone' || $zone_for === 'cms') ? 'admin' : 'default';
}
@@ -469,6 +468,9 @@ public function get_theme($zone_for = null, $member_id = null)
$zone_theme = ($ZONE === null || !$current_zone_requested) ? $GLOBALS['SITE_DB']->query_select_value_if_there('zones', 'zone_theme', array('zone_name' => $zone_for)) : $ZONE['zone_theme'];
require_code('permissions');
if ($member_id === null) {
$member_id = get_member();
}
if (($theme == 'default') || ($theme == $zone_theme) || (has_category_access($member_id, 'theme', $theme))) { // Permissions check (but only if it's not what the zone setting says it should be anyway)
if (($current_zone_requested) && ($is_current_member)) {
$USER_THEME_CACHE = $theme;
@@ -506,6 +508,9 @@ public function get_theme($zone_for = null, $member_id = null)
// Get from member setting
require_code('permissions');
if ($member_id === null) {
$member_id = get_member();
}
$theme = filter_naughty($this->_get_theme(false, $member_id));
if (empty($theme)) { // Cleanup bad data
$theme = '-1';
@@ -39,7 +39,7 @@ function handle_facebook_connection_login($current_logged_in_member, $quick_only
if (!class_exists('Tempcode')) {
return null;
}
if (!function_exists('do_lang')) {
if (!function_exists('require_lang')) {
return null;
}

0 comments on commit 4666f8a

Please sign in to comment.
You can’t perform that action at this time.