##############################################################
## MOD Title: 		phpBB SEO Advanced mod Rewrite 0.2.0RC2a => 0.2.0RC3 update
## MOD Author: 		dcz <n/a> http://www.phpbb-seo.com/
## MOD Description: 	This are the update steps for the phpBB SEO Advanced mod Rewrite 0.2.0RC2a => 0.2.0RC3 update.
## 			Check http://www.phpbb-seo.com/
## 			for the latest version or to get help with this MOD
##
## MOD Version: 	1.0
##
## Installation Level: 	(Intermediate)
## Installation Time: 	5 Minutes
## Files To Edit: 	(6)
##			includes/functions.php,
##			includes/functions_posting.php,
##			search.php,
##			styles/prosilver/template/overall_header.html,
##			viewforum.php,
##			viewtopic.php
##
## Included Files: n/a
##############################################################
## Author Notes:
## _____________
##
## This are the update steps for the phpBB3 SEO Advanced mod Rewrite 0.2.0RC2a => 0.2.0RC3 update.
##
## PLEASE NOTE :
## _____________
##
## There is no step by step update of the phpbb_seo_class.php file, 
## this mean you will have to proceed to the settings again in the file.
## As well, you will have to empty the phpBB/cache/ folder before the mod will fully work, 
## just delete all files BUT the .htaccess.
## 
## 
##
##############################################################
## MOD History:
##
##	2007-07-22 - 1.0
##		- First version released
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#-----[ DIY INSTRUCTIONS ]--------------------------------------------------
#
_________________________________________
>>>>   INSTALLATION INSTRUCTIONS    <<<<<
_________________________________________

This update procedure will keep the previous URL standard used, but you need to set up the new
virtual_folder option, as told in the install : 


=> The 'virtual_folder' option ('virtual_folder' => false,), if you set it to true ('virtual_folder' => true,), 
Forum URL will be added as a virtual folder in topic URLs : 
forum-title-fxx/topic-title-txx.html VS topic-title-txx.html for a topic URL.
_________
WARNING :
_________
The Virtual folder injection option can change all your web site's URLs almost too easily.
Starting to use it with an already indexed web site should thus be considered
with as much care as when migrating and not to often. 
So you'd better be decided to go for it or not.

This new option implies a small change in the .htaccess : 

______
OPEN :
______

.htaccess

____________________________________________________
>>> YOUR FORUM IS INSTALLED AT THE DOMAIN'S ROOT <<<
____________________________________________________
FIND :
____________________________________________________

# GLOBAL ANNOUNCES
RewriteRule ^annonces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
____________________________________________________
REPLACE WITH : 
____________________________________________________

# GLOBAL ANNOUNCES && TOPIC WITHOUT FORUM URLS
RewriteRule ^(annonces/)?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$2&start=$4 [QSA,L,NC]

___________________________________________
>>> YOUR FORUM IS INSTALLED IN A FOLDER <<<
___________________________________________
FIND :
___________________________________________

# GLOBAL ANNOUNCES
RewriteRule ^phpbb/annonces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /phpbb/viewtopic.php?t=$1&start=$3 [QSA,L,NC]
____________________________________________________
REPLACE WITH : 
____________________________________________________

# GLOBAL ANNOUNCES && TOPIC WITHOUT FORUM URLS
RewriteRule ^phpbb/(annonces/)?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /phpbb/viewtopic.php?t=$2&start=$4 [QSA,L,NC]

_________
WARNING :
_________

There is no step by step update of the phpbb_seo_class.php file, this mean you will have to proceed to the settings again in the file.
As well, you will have to empty the phpBB/cache/ folder before the mod will fully work, 
just delete all files BUT the .htaccess.


#
#-----[ COPY ]--------------------------------------------------
#

copy phpbb_seo/*.* to phpbb_seo/*.*

#
#-----[ OPEN ]------------------------------------------
#

includes/functions.php

#
#-----[ FIND ]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	return str_replace('&', '&amp;', trim($redirect,'?'));
	// www.phpBB-SEO.com SEO TOOLKIT END


#
#-----[ REPLACE WITH ]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	return (strpos($redirect, 'http://') !==FALSE ? '' : $phpbb_root_path) . str_replace('&', '&amp;', trim($redirect,'?'));
	// www.phpBB-SEO.com SEO TOOLKIT END



#
#-----[ FIND ]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	global $phpbb_seo;
	if ( !defined('ADMIN_START') ) {
		$template->assign_vars( array( 'PHPBB_FULL_URL' => $phpbb_seo->seo_path['phpbb_url'] ) );
	}
	// www.phpBB-SEO.com SEO TOOLKIT END


#
#-----[REPLACE WITH ]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	global $phpbb_seo;
	if ( !defined('ADMIN_START') ) {
		$template->assign_vars( array( 'PHPBB_FULL_URL' => $phpbb_seo->seo_path['phpbb_url'], 'SEO_BASE_HREF' => $phpbb_seo->seo_opt['seo_base_href'] ) );
	}
	// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ OPEN ]------------------------------------------
#

includes/functions_posting.php

#
#-----[ FIND ]------------------------------------------
#

function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $update_message = true)
{
	global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path;

#
#-----[ AFTER, ADD]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	global $phpbb_seo;
	// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ FIND ]------------------------------------------
#

	$url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
	$url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;

#
#-----[ BEFORE, ADD]------------------------------------------
#

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	if ( $params && empty($phpbb_seo->seo_url['topic'][$data['topic_id']]) ) {
		$phpbb_seo->seo_url['topic'][$data['topic_id']] = $phpbb_seo->format_url($data['topic_title']);
	}
	if ( empty($phpbb_seo->seo_url['forum'][$data['forum_id']]) ) {
		$phpbb_seo->seo_url['forum'][$data['forum_id']] = $phpbb_seo->format_url($data['forum_name'], $phpbb_seo->seo_static['forum']);
	}
	// www.phpBB-SEO.com SEO TOOLKIT END



#
#-----[ OPEN ]------------------------------------------
#

search.php

#
#-----[ FIND ]------------------------------------------
#
			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
			if ( empty($phpbb_seo->seo_url['topic'][$result_topic_id]) ) {
				$phpbb_seo->seo_url['topic'][$result_topic_id] = $phpbb_seo->format_url($topic_title);
			}
			if ( empty($phpbb_seo->seo_url['forum'][$u_forum_id]) ) {
				$phpbb_seo->seo_url['forum'][$u_forum_id] = $phpbb_seo->format_url($row['forum_name'], $phpbb_seo->seo_static['forum']);
			}
			// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[REPLACE WITH ]------------------------------------------
#

			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
			if ($row['topic_type'] == POST_GLOBAL) {
				$phpbb_seo->seo_opt['topic_type'][$result_topic_id] = POST_GLOBAL;
			}
			if ( empty($phpbb_seo->seo_url['topic'][$result_topic_id]) ) {
				$phpbb_seo->seo_url['topic'][$result_topic_id] = $phpbb_seo->format_url($topic_title);
			}
			if ( empty($phpbb_seo->seo_url['forum'][$u_forum_id]) ) {
				$phpbb_seo->seo_url['forum'][$u_forum_id] = $phpbb_seo->format_url($row['forum_name'], $phpbb_seo->seo_static['forum']);
			}
			// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ FIND ]------------------------------------------
#

					// www.phpBB-SEO.com SEO TOOLKIT BEGIN
					'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&amp;t=$result_topic_id&amp;hilit=$u_hilit" . '&amp;view=unread#unread'),
					// www.phpBB-SEO.com SEO TOOLKIT END


#
#-----[REPLACE WITH ]------------------------------------------
#

					// www.phpBB-SEO.com SEO TOOLKIT BEGIN
					'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&amp;t=$result_topic_id&amp;hilit=$u_hilit" . '&amp;view=unread') . '#unread',
					// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ OPEN ]------------------------------------------
#

styles/prosilver/template/overall_header.html


#
#-----[ FIND ]------------------------------------------
#

<BASE HREF="{PHPBB_FULL_URL}">

#
#-----[REPLACE WITH ]------------------------------------------
#

{SEO_BASE_HREF}

#
#-----[ OPEN ]------------------------------------------
#

viewforum.php


#
#-----[ FIND ]------------------------------------------
#
			'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;view=unread#unread'),


#
#-----[REPLACE WITH ]------------------------------------------
#

			'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&amp;t=' . $topic_id . '&amp;view=unread') . '#unread',

#
#-----[ OPEN ]------------------------------------------
#

viewtopic.php


#
#-----[ FIND ]------------------------------------------
#

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		'L_IGNORE_POST'		=> ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}") . '">', '</a>') : '',
		// www.phpBB-SEO.com SEO TOOLKIT END


#
#-----[REPLACE WITH ]------------------------------------------
#

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		'L_IGNORE_POST'		=> ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p={$row['post_id']}&amp;view=show") . '#p' . $row['post_id'] . '">', '</a>') : '',
		// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
