From: Meik S. <acy...@ph...> - 2009-08-17 14:46:00
|
Author: acydburn Date: Mon Aug 17 15:45:14 2009 New Revision: 10008 Log: Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset... This feature does not change anything for those not using the constant and this feature is also quite in-flux. We need to test this with some applications and bridges and there may be other locations able to benefit from it. Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html branches/phpBB-3_0_0/phpBB/includes/functions.php branches/phpBB-3_0_0/phpBB/includes/functions_content.php branches/phpBB-3_0_0/phpBB/includes/functions_posting.php branches/phpBB-3_0_0/phpBB/includes/session.php Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original) --- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Mon Aug 17 15:45:14 2009 *************** *** 278,284 **** <li>[Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)</li> <li>[Feature] Separate PM Reply and PM Reply to all in prosilver.</li> <li>[Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.</li> ! </ul> <a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3> --- 278,284 ---- <li>[Feature] Fallback options for missing language files. (Bug #38575 - Patch by EXreaction)</li> <li>[Feature] Separate PM Reply and PM Reply to all in prosilver.</li> <li>[Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.</li> ! <li>[Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...</li> </ul> <a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3> Modified: branches/phpBB-3_0_0/phpBB/includes/functions.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions.php Mon Aug 17 15:45:14 2009 *************** *** 4089,4094 **** --- 4089,4098 ---- $db->sql_freeresult($result); } + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; + // The following assigns all _common_ variables that may be used at any point in a template. $template->assign_vars(array( 'SITENAME' => $config['sitename'], *************** *** 4112,4117 **** --- 4116,4122 ---- '_SID' => $_SID, 'SESSION_ID' => $user->session_id, 'ROOT_PATH' => $phpbb_root_path, + 'BOARD_URL' => $board_url, 'L_LOGIN_LOGOUT' => $l_login_logout, 'L_INDEX' => $user->lang['FORUM_INDEX'], *************** *** 4170,4190 **** 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false, 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, ! 'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme', ! 'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template', ! 'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$phpbb_root_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template', ! 'T_IMAGESET_PATH' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset', ! 'T_IMAGESET_LANG_PATH' => "{$phpbb_root_path}styles/" . $user->theme['imageset_path'] . '/imageset/' . $user->data['user_lang'], ! 'T_IMAGES_PATH' => "{$phpbb_root_path}images/", ! 'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", ! 'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", ! 'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", ! 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", ! 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", ! 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", ! 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'], 'T_STYLESHEET_NAME' => $user->theme['theme_name'], 'SITE_LOGO_IMG' => $user->img('site_logo'), 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), --- 4175,4208 ---- 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false, 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, ! 'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme', ! 'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template', ! 'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template', ! 'T_IMAGESET_PATH' => "{$web_path}styles/" . $user->theme['imageset_path'] . '/imageset', ! 'T_IMAGESET_LANG_PATH' => "{$web_path}styles/" . $user->theme['imageset_path'] . '/imageset/' . $user->data['user_lang'], ! 'T_IMAGES_PATH' => "{$web_path}images/", ! 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", ! 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", ! 'T_AVATAR_GALLERY_PATH' => "{$web_path}{$config['avatar_gallery_path']}/", ! 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", ! 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", ! 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", ! 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->data['user_lang']), 'T_STYLESHEET_NAME' => $user->theme['theme_name'], + 'T_THEME_NAME' => $user->theme['theme_path'], + 'T_TEMPLATE_NAME' => $user->theme['template_path'], + 'T_SUPER_TEMPLATE_NAME' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? $user->theme['template_inherit_path'] : $user->theme['template_path'], + 'T_IMAGESET_NAME' => $user->theme['imageset_path'], + 'T_IMAGESET_LANG_NAME' => $user->data['user_lang'], + 'T_IMAGES' => 'images', + 'T_SMILIES' => $config['smilies_path'], + 'T_AVATAR' => $config['avatar_path'], + 'T_AVATAR_GALLERY' => $config['avatar_gallery_path'], + 'T_ICONS' => $config['icons_path'], + 'T_RANKS' => $config['ranks_path'], + 'T_UPLOAD' => $config['upload_path'], + 'SITE_LOGO_IMG' => $user->img('site_logo'), 'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')), Modified: branches/phpBB-3_0_0/phpBB/includes/functions_content.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions_content.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions_content.php Mon Aug 17 15:45:14 2009 *************** *** 733,739 **** } else { ! return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $phpbb_root_path . $config['smilies_path'] . '/\2 />', $text); } } --- 733,740 ---- } else { ! $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; ! return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); } } Modified: branches/phpBB-3_0_0/phpBB/includes/functions_posting.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions_posting.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions_posting.php Mon Aug 17 15:45:14 2009 *************** *** 112,123 **** if (sizeof($smilies)) { foreach ($smilies as $row) { $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), ! 'SMILEY_IMG' => $phpbb_root_path . $config['smilies_path'] . '/' . $row['smiley_url'], 'SMILEY_WIDTH' => $row['smiley_width'], 'SMILEY_HEIGHT' => $row['smiley_height'], 'SMILEY_DESC' => $row['emotion']) --- 112,125 ---- if (sizeof($smilies)) { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; + foreach ($smilies as $row) { $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), ! 'SMILEY_IMG' => $root_path . $config['smilies_path'] . '/' . $row['smiley_url'], 'SMILEY_WIDTH' => $row['smiley_width'], 'SMILEY_HEIGHT' => $row['smiley_height'], 'SMILEY_DESC' => $row['emotion']) Modified: branches/phpBB-3_0_0/phpBB/includes/session.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/session.php (original) --- branches/phpBB-3_0_0/phpBB/includes/session.php Mon Aug 17 15:45:14 2009 *************** *** 2196,2202 **** return $img_data; } ! $img_data['src'] = $phpbb_root_path . 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename']; $img_data['width'] = $this->img_array[$img]['image_width']; $img_data['height'] = $this->img_array[$img]['image_height']; } --- 2196,2205 ---- return $img_data; } ! // Use URL if told so ! $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; ! ! $img_data['src'] = $root_path . 'styles/' . rawurlencode($this->theme['imageset_path']) . '/imageset/' . ($this->img_array[$img]['image_lang'] ? $this->img_array[$img]['image_lang'] .'/' : '') . $this->img_array[$img]['image_filename']; $img_data['width'] = $this->img_array[$img]['image_width']; $img_data['height'] = $this->img_array[$img]['image_height']; } |