Add $staticurl global settings for CDN url

This commit is contained in:
2024-11-23 19:16:21 +07:00
parent 29fcff5ea1
commit 3971042436
3 changed files with 6 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ $mmessage = 'Мы тут шаманим немного. Скоро всё буд
$mbname = 'www.rock.ru'; # The name of your forum.
$language = 'russian'; # The default language file set for the forum.
$boardurl = 'http://192.168.201.100/forum'; # URL to your forum's folder. (without the trailing /!)
$staticurl = 'http://192.168.201.102/forum'; # URL to your forum's folder. (without the trailing /!)
$boarddir = '/var/www/rock/forum';
$sourcedir = '/var/www/rock/forum/Sources';
$webmaster_email = 'noreply@rock.ru'; # Email address to send emails from. (like noreply@yourdomain.com.)

View File

@@ -514,7 +514,7 @@ function loadMemberContext($user)
global $themeUser, $user_profile, $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;
global $boardurl;
global $staticurl;
static $dataLoaded = array();
// If this person's data is already loaded, skip it.
@@ -622,8 +622,8 @@ function loadMemberContext($user)
'posts' => $profile['posts'] > 100000 ? $txt[683] : ($profile['posts'] == 1337 ? 'leet' : comma_format($profile['posts'])),
'avatar' => array(
'name' => &$profile['avatar'],
'image' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? '<img src="' . $boardurl . '/' . $__avatar . '" alt="" />' : '') : '' ,
'href' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? $boardurl . '/' . $__avatar : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'image' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? '<img src="' . $staticurl . '/' . $__avatar . '" alt="" />' : '') : '' ,
'href' => $profile['avatar'] == '' ? ($profile['ID_ATTACH'] > 0 && !empty($modSettings['avatar_allow_upload']) ? $staticurl . '/' . $__avatar : '') : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar']),
'url' => $profile['avatar'] == '' ? '' : (stristr($profile['avatar'], 'http://') ? $profile['avatar'] : $modSettings['avatar_url'] . '/' . $profile['avatar'])
),
'last_login' => empty($profile['lastLogin']) ? $txt['never'] : timeformat($profile['lastLogin']),

View File

@@ -1916,6 +1916,7 @@ function setupThemeContext()
{
global $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt, $maintenance;
global $db_prefix; // Grudge's Mod
global $staticurl;
// Get some news...
$context['news_lines'] = explode("\n", str_replace("\r", '', trim(addslashes($modSettings['news']))));
@@ -1967,7 +1968,7 @@ function setupThemeContext()
{
$__avatar = glob('attachments/avatar_'.$context['user']['id'].'.{jpg,png,gif}', GLOB_BRACE);
if (!empty($__avatar)) $__avatar = $__avatar[0];
$context['user']['avatar']['href'] = 'http://img.rock.ru/forum/'.$__avatar;
$context['user']['avatar']['href'] = $staticurl . '/'.$__avatar;
}
}
// Full URL?