This update does only concern the premod, not the phpBB core.
+
Index: includes/functions_content.php
===================================================================
--- includes/functions_content.php (phpBB 3.0.5)
+++ includes/functions_content.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -750,7 +750,9 @@
global $template, $cache, $user;
global $extensions, $config, $phpbb_root_path, $phpEx;
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ global $phpbb_seo;
+ // www.phpBB-SEO.com SEO TOOLKIT END
//
$compiled_attachments = array();
@@ -926,9 +928,26 @@
{
$display_cat = ATTACHMENT_CATEGORY_NONE;
}
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ //$download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']);
+ $download_link = "{$phpbb_root_path}download/file.$phpEx?id=" . $attachment['attach_id'];
+ $comment_clean = preg_replace('`<[^>]*>`Ui', ' ', $comment);
+ $block_array += array(
+ 'COMMENT_CLEAN' => $comment_clean,
+ );
+ if (!empty($phpbb_seo->seo_opt['rewrite_files'])) {
+ if (empty($phpbb_seo->seo_url['file'][$attachment['attach_id']])) {
+ if (($_pos = utf8_strpos($comment, '
60 ? utf8_substr($comment_url, 0, 60) : $comment_url;
+ $phpbb_seo->seo_url['file'][$attachment['attach_id']] = $phpbb_seo->format_url($comment_url, $phpbb_seo->seo_static['file'][$display_cat]);
+ }
+ }
+ // www.phpBB-SEO.com SEO TOOLKIT END
- $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']);
-
switch ($display_cat)
{
// Images
@@ -1003,7 +1022,9 @@
'S_FLASH_FILE' => true,
'WIDTH' => $width,
'HEIGHT' => $height,
- 'U_VIEW_LINK' => $download_link . '&view=1',
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ 'U_VIEW_LINK' => append_sid($download_link . '&view=1'),
+ // www.phpBB-SEO.com SEO TOOLKIT END
);
// Viewed/Heared File ... update the download count
@@ -1018,7 +1039,9 @@
);
break;
}
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $download_link = append_sid($download_link);
+ // www.phpBB-SEO.com SEO TOOLKIT END
$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang[$l_downloaded_viewed . '_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang[$l_downloaded_viewed], $attachment['download_count']) : sprintf($user->lang[$l_downloaded_viewed . 'S'], $attachment['download_count']));
$block_array += array(
@@ -1226,7 +1249,12 @@
// For anonymous the link leads to a login page.
if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile')))
{
- $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']);
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ // $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']);
+ global $phpbb_seo, $phpbb_root_path, $phpEx;
+ $phpbb_seo->set_user_url( $username, $user_id );
+ $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . (int) $user_id);
+ // www.phpBB-SEO.com SEO TOOLKIT END
}
else
{
Index: includes/functions.php
===================================================================
--- includes/functions.php (phpBB 3.0.5)
+++ includes/functions.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -1764,7 +1764,9 @@
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '')
{
global $template, $user;
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ global $phpbb_seo, $phpEx;
+ // www.phpBB-SEO.com SEO TOOLKIT END
// Make sure $per_page is a valid value
$per_page = ($per_page <= 0) ? 1 : $per_page;
@@ -1828,16 +1830,34 @@
}
}
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $prev = ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page);
+ $next = ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page);
+ if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
+ static $pagin_find = array();
+ static $pagin_replace = array();
+ static $prev_find = array();
+ if (empty($pagin_replace)) {
+ $pagin_find = array('`(\.(?!' . $phpEx . ')[a-z0-9]+)([\w\#$%&~\-;:=,?@+]*)(&|\?)start=([0-9]+)`i', '`/([\w\#$%&~\-;:=,?@+]*)(&|\?)start=([0-9]+)`i' );
+ $pagin_replace = array( $phpbb_seo->seo_delim['start'] . '\\4\\1\\2', '/' . $phpbb_seo->seo_static['pagination'] . '\\3' . $phpbb_seo->seo_ext['pagination'] . '\\1' );
+ $prev_find = array($phpbb_seo->seo_delim['start'] . '0', $phpbb_seo->seo_static['pagination'] . '0' . $phpbb_seo->seo_ext['pagination']);
+ }
+ $page_string = str_replace($url_delim . 'start=0', '', $page_string);
+ $page_string = preg_replace($pagin_find, $pagin_replace, $page_string);
+ $prev = preg_replace($pagin_find, $pagin_replace, $prev);
+ $prev = str_replace($prev_find, '', $prev);
+ $next = preg_replace( $pagin_find, $pagin_replace, $next);
+ }
$template->assign_vars(array(
- $tpl_prefix . 'BASE_URL' => $base_url,
+ $tpl_prefix . 'BASE_URL' => $base_url,
'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url),
- $tpl_prefix . 'PER_PAGE' => $per_page,
+ $tpl_prefix . 'PER_PAGE' => $per_page,
+ $tpl_prefix . 'PREVIOUS_PAGE' => $prev,
+ $tpl_prefix . 'NEXT_PAGE' => $next,
+ $tpl_prefix . 'TOTAL_PAGES' => $total_pages)
+ );
+ // www.phpBB-SEO.com SEO TOOLKIT END
- $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page),
- $tpl_prefix . 'NEXT_PAGE' => ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page),
- $tpl_prefix . 'TOTAL_PAGES' => $total_pages,
- ));
-
return $page_string;
}
@@ -1883,7 +1903,13 @@
function append_sid($url, $params = false, $is_amp = true, $session_id = false)
{
global $_SID, $_EXTRA_URL, $phpbb_hook;
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ // We bypass the hook function here, the same effect as a standalone hook, which we want, but faster ;-)
+ global $phpbb_seo;
+ if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
+ return $phpbb_seo->url_rewrite($url, $params, $is_amp, $session_id);
+ } else
+ // www.phpBB-SEO.com SEO TOOLKIT END
// Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly.
// They could mimick most of what is within this function
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
@@ -2274,7 +2300,10 @@
$redirect .= ($query) ? '?' . $query : '';
}
- return $phpbb_root_path . str_replace('&', '&', $redirect);
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $redirect = (preg_match('`^https?://`i', $redirect) ? '' : $phpbb_root_path) . trim(str_replace('&', '&', $redirect), '? ');
+ return reapply_sid($redirect);
+ // www.phpBB-SEO.com SEO TOOLKIT END
}
/**
@@ -3624,7 +3653,15 @@
{
return;
}
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ global $phpbb_seo;
+ $template->assign_vars( array( 'PHPBB_FULL_URL' => $phpbb_seo->seo_path['phpbb_url'],
+ 'SEO_BASE_HREF' => $phpbb_seo->seo_opt['seo_base_href'],
+ 'SEO_START_DELIM' => $phpbb_seo->seo_delim['start'],
+ 'SEO_SATIC_PAGE' => $phpbb_seo->seo_static['pagination'],
+ 'SEO_EXT_PAGE' => $phpbb_seo->seo_ext['pagination'])
+ );
+ // www.phpBB-SEO.com SEO TOOLKIT END
define('HEADER_INC', true);
// gzip_compression
@@ -3836,7 +3873,12 @@
function page_footer($run_cron = true)
{
global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ global $phpbb_seo;
+ if (!empty($phpbb_seo)) {
+ $phpbb_seo->seo_end();
+ }
+ // www.phpBB-SEO.com SEO TOOLKIT END
// Output page creation time
if (defined('DEBUG'))
{
@@ -3864,7 +3906,10 @@
}
}
- $debug_output .= ' |
Explain';
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $url_prefix = build_url();
+ $debug_output .= ' |
Explain';
+ // www.phpBB-SEO.com SEO TOOLKIT END
}
}
Index: memberlist.php
===================================================================
--- memberlist.php (phpBB 3.0.5)
+++ memberlist.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -21,7 +21,14 @@
$user->session_begin();
$auth->acl($user->data);
$user->setup(array('memberlist', 'groups'));
-
+// www.phpBB-SEO.com SEO TOOLKIT BEGIN
+if (!empty($_REQUEST['un'])) {
+ $_REQUEST['un'] = rawurldecode($_REQUEST['un']);
+ if (!$phpbb_seo->is_utf8($_REQUEST['un'])) {
+ $_REQUEST['un'] = utf8_normalize_nfc(utf8_recode($_REQUEST['un'], 'ISO-8859-1'));
+ }
+}
+// www.phpBB-SEO.com SEO TOOLKIT END
// Grab data
$mode = request_var('mode', '');
$action = request_var('action', '');
@@ -234,6 +241,9 @@
else
{
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $phpbb_seo->prepare_url('group', $row['group_name'], $row['group_id']);
+ // www.phpBB-SEO.com SEO TOOLKIT END
$u_group = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']);
}
@@ -429,7 +439,9 @@
}
$user_id = (int) $member['user_id'];
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $phpbb_seo->set_user_url( $member['username'], $user_id );
+ // www.phpBB-SEO.com SEO TOOLKIT END
// Do the SQL thang
$sql = 'SELECT g.group_id, g.group_name, g.group_type
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
@@ -1476,7 +1488,9 @@
unset($id_cache[$user_id]);
}
}
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $seo_sep = strpos($sort_url, '?') === false ? '?' : '&';
+ // www.phpBB-SEO.com SEO TOOLKIT END
// Generate page
$template->assign_vars(array(
'PAGINATION' => generate_pagination($pagination_url, $total_users, $config['topics_per_page'], $start),
@@ -1496,20 +1510,22 @@
'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '',
'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser') ? $u_hide_find_member : '',
- 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FROM' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_WEBSITE' => $sort_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_LOCATION' => $sort_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ICQ' => $sort_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_AIM' => $sort_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_MSN' => $sort_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_YIM' => $sort_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
- 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ 'U_SORT_USERNAME' => $sort_url . $seo_sep . 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FROM' => $sort_url . $seo_sep . 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_JOINED' => $sort_url . $seo_sep . 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_POSTS' => $sort_url . $seo_sep . 'sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_EMAIL' => $sort_url . $seo_sep . 'sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_WEBSITE' => $sort_url . $seo_sep . 'sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_LOCATION' => $sort_url . $seo_sep . 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ICQ' => $sort_url . $seo_sep . 'sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_AIM' => $sort_url . $seo_sep . 'sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_MSN' => $sort_url . $seo_sep . 'sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_YIM' => $sort_url . $seo_sep . 'sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . $seo_sep . 'sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
+ 'U_SORT_RANK' => $sort_url . $seo_sep . 'sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_LIST_CHAR' => $sort_url . $seo_sep . 'sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
+ // www.phpBB-SEO.com SEO TOOLKIT END
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
'S_VIEWONLINE' => $auth->acl_get('u_viewonline'),
@@ -1517,7 +1533,11 @@
'S_MODE_SELECT' => $s_sort_key,
'S_ORDER_SELECT' => $s_sort_dir,
'S_CHAR_OPTIONS' => $s_char_options,
- 'S_MODE_ACTION' => $pagination_url)
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ // Here we circumvent because our append_sid does not allow
+ // an url to end with an ?, as it should.
+ 'S_MODE_ACTION' => $pagination_url . (strpos($pagination_url, '?') !== false ? '' : '?') )
+ // www.phpBB-SEO.com SEO TOOLKIT END
);
}
Index: viewforum.php
===================================================================
--- viewforum.php (phpBB 3.0.5)
+++ viewforum.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -16,7 +16,16 @@
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
-
+// www.phpBB-SEO.com SEO TOOLKIT BEGIN
+if (empty($_REQUEST['f'])) {
+ $phpbb_seo->get_forum_id($session_forum_id);
+ if ($session_forum_id == 0) {
+ header('HTTP/1.1 404 Not Found');
+ } else {
+ $_REQUEST['f'] = (int) $session_forum_id;
+ }
+}
+// www.phpBB-SEO.com SEO TOOLKIT END
// Start session
$user->session_begin();
$auth->acl($user->data);
@@ -69,8 +78,10 @@
{
trigger_error('NO_FORUM');
}
+// www.phpBB-SEO.com SEO TOOLKIT BEGIN
+$phpbb_seo->set_url($forum_data['forum_name'], $forum_data['forum_id'], $phpbb_seo->seo_static['forum']);
+// www.phpBB-SEO.com SEO TOOLKIT END
-
// Configure style, language, etc.
$user->setup('viewforum', $forum_data['forum_style']);
@@ -589,7 +600,10 @@
foreach ($topic_list as $topic_id)
{
$row = &$rowset[$topic_id];
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $cur_forum_id = ($row['forum_id']) ? (int) $row['forum_id'] : $forum_id;
+ $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$cur_forum_id]);
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
// This will allow the style designer to output a different header
// or even separate the list of announcements from sticky and normal topics
$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
Index: posting.php
===================================================================
--- posting.php (phpBB 3.0.5)
+++ posting.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -606,7 +606,30 @@
$post_data['enable_smilies'] = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true;
$post_data['enable_urls'] = (isset($_POST['disable_magic_url'])) ? 0 : 1;
$post_data['enable_sig'] = (!$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((isset($_POST['attach_sig']) && $user->data['is_registered']) ? true : false);
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ if (!empty($phpbb_seo->seo_opt['sql_rewrite'])) {
+ if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id)) {
+ $phpbb_seo->set_url($post_data['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
+ $_parent = $post_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id];
+ $_t = !empty($post_data['topic_id']) ? max(0, (int) $post_data['topic_id'] ) : 0;
+ $_url = $phpbb_seo->url_can_edit($forum_id) ? utf8_normalize_nfc(request_var('url', '', true)) : ( isset($post_data['topic_url']) ? $post_data['topic_url'] : '' );
+ if (!$phpbb_seo->check_url('topic', $_url, $_parent)) {
+ if (!empty($_url)) {
+ // Here we get rid of the seo delim (-t) and put it back even in simple mod
+ // to be able to handle all cases at once
+ $_url = preg_replace('`' . $phpbb_seo->seo_delim['topic'] . '$`i', '', $_url);
+ $_title = $phpbb_seo->get_url_info('topic', $_url . $phpbb_seo->seo_delim['topic'] . $_t);
+ } else {
+ $_title = $phpbb_seo->modrtype > 2 ? censor_text($post_data['post_subject']) : '';
+ }
+ unset($phpbb_seo->seo_url['topic'][$_t]);
+ $_url = $phpbb_seo->get_url_info('topic', $phpbb_seo->prepare_url( 'topic', $_title, $_t, $_parent , (( empty($_title) || ($_title == $phpbb_seo->seo_static['topic']) ) ? true : false)), 'url');
+ unset($phpbb_seo->seo_url['topic'][$_t]);
+ }
+ $post_data['topic_url'] = $_url;
+ }
+ }
+ // www.phpBB-SEO.com SEO TOOLKIT END
if ($config['allow_topic_notify'] && $user->data['is_registered'])
{
$notify = (isset($_POST['notify'])) ? true : false;
@@ -979,6 +1002,9 @@
$data = array(
'topic_title' => (empty($post_data['topic_title'])) ? $post_data['post_subject'] : $post_data['topic_title'],
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ 'topic_url' => isset($post_data['topic_url']) ? $post_data['topic_url'] : '',
+ // www.phpBB-SEO.com SEO TOOLKIT END
'topic_first_post_id' => (isset($post_data['topic_first_post_id'])) ? (int) $post_data['topic_first_post_id'] : 0,
'topic_last_post_id' => (isset($post_data['topic_last_post_id'])) ? (int) $post_data['topic_last_post_id'] : 0,
'topic_time_limit' => (int) $post_data['topic_time_limit'],
@@ -1299,6 +1325,10 @@
'FORUM_NAME' => $post_data['forum_name'],
'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '',
'TOPIC_TITLE' => censor_text($post_data['topic_title']),
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ 'TOPIC_URL' => isset($post_data['topic_url']) ? preg_replace('`' . $phpbb_seo->seo_delim['topic'] . '$`i', '', $post_data['topic_url']) : '',
+ 'S_URL' => ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'])) ? $phpbb_seo->url_can_edit($forum_id) : false,
+ // www.phpBB-SEO.com SEO TOOLKIT END
'MODERATORS' => (sizeof($moderators)) ? implode(', ', $moderators[$forum_id]) : '',
'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
'SUBJECT' => $post_data['post_subject'],
Index: search.php
===================================================================
--- search.php (phpBB 3.0.5)
+++ search.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -20,7 +20,17 @@
$user->session_begin();
$auth->acl($user->data);
$user->setup('search');
-
+// www.phpBB-SEO.com SEO TOOLKIT BEGIN
+$clean_request = array('keywords', 'author', 'add_keywords');
+foreach ($clean_request as $request) {
+ if (!empty($_REQUEST[$request])) {
+ $_REQUEST[$request] = rawurldecode($_REQUEST[$request]);
+ if (!$phpbb_seo->is_utf8($_REQUEST[$request])) {
+ $_REQUEST[$request] = utf8_normalize_nfc(utf8_recode($_REQUEST[$request], 'iso-8859-1'));
+ }
+ }
+}
+// www.phpBB-SEO.com SEO TOOLKIT END
// Define initial vars
$mode = request_var('mode', '');
$search_id = request_var('search_id', '');
@@ -487,7 +497,9 @@
$u_show_results = ($show_results != 'posts') ? '&sr=' . $show_results : '';
$u_search_forum = implode('&fid%5B%5D=', $search_forum);
- $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ //$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
+ $u_search = $u_sort_param . $u_show_results;
$u_search .= ($search_id) ? '&search_id=' . $search_id : '';
$u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : '';
$u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : '';
@@ -498,6 +510,34 @@
$u_search .= (!$search_child) ? '&sc=0' : '';
$u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : '';
$u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : '';
+ $u_search = preg_replace('`(^&|&$)`i', '', $u_search);
+ if ( $phpbb_seo->seo_opt['rewrite_usermsg'] && (!empty($author) || !empty($author_id)) ) {
+ $author_name = '';
+ if (!empty($author_id)) {
+ $sql = $sql = 'SELECT username
+ FROM ' . USERS_TABLE . "
+ WHERE user_id = $author_id
+ AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
+ $result = $db->sql_query($sql);
+ if ($row = $db->sql_fetchrow($result)) {
+ $author_name = $row['username'];
+ $phpbb_seo->set_user_url( $author_name, $author_id );
+ }
+ }
+ if (!empty($author) && (strpos($author, '*') === false) ) {
+ $sql = $sql = 'SELECT user_id
+ FROM ' . USERS_TABLE . "
+ WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'
+ AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
+ $result = $db->sql_query($sql);
+ if ($row = $db->sql_fetchrow($result)) {
+ $phpbb_seo->set_user_url( $author, $row['user_id'] );
+ }
+ }
+ $author = empty($author) ? $author_name : $author;
+ }
+ $u_search = append_sid( "{$phpbb_root_path}search.$phpEx" . (!empty($u_search) ? '?' . $u_search : '') );
+ // www.phpBB-SEO.com SEO TOOLKIT END
$template->assign_vars(array(
'SEARCH_TITLE' => $l_search_title,
@@ -780,7 +820,10 @@
{
$u_forum_id = $forum_id;
}
-
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $phpbb_seo->set_url($row['forum_name'], $u_forum_id, $phpbb_seo->seo_static['forum']);
+ $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$u_forum_id]);
+ // www.phpBB-SEO.com SEO TOOLKIT END
$view_topic_url_params = "f=$u_forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
Index: index.php
===================================================================
--- index.php (phpBB 3.0.5)
+++ index.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -72,6 +72,9 @@
}
else
{
+ // www.phpBB-SEO.com SEO TOOLKIT BEGIN
+ $phpbb_seo->prepare_url('group', $row['group_name'], $row['group_id']);
+ // www.phpBB-SEO.com SEO TOOLKIT END
$legend[] = '
' . $group_name . '';
}
}
Index: common.php
===================================================================
--- common.php (phpBB 3.0.5)
+++ common.php (phpBB 3.0.5 + Ultimate 0.6.0)
@@ -214,7 +214,12 @@
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
-
+// www.phpBB-SEO.com SEO TOOLKIT BEGIN
+if (empty($phpbb_seo) ) {
+ require_once($phpbb_root_path . 'phpbb_seo/phpbb_seo_class.'.$phpEx);
+ $phpbb_seo = new phpbb_seo();
+}
+// www.phpBB-SEO.com SEO TOOLKIT END
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));