##############################################################
## MOD Title: 		phpBB SEO Rewrite Avanc MAJ 0.2.0RC3 => 0.4.0RC1
## MOD Author: 		dcz <n/a> http://www.phpbb-seo.com/
## MOD Description: 	Ceci est la procdure de mise  jour du MOD phpBB SEO Rewrite Avanc pour la transition version 0.2.0RC3 => 0.4.0RC1.
## 			Rendez-vous sur http://www.phpbb-seo.com/
## 			pour toujours obtenir la dernire version ou de l'aide pour ce MOD.
##
## MOD Version: 	1.0
##
## Installation Level: 	(Intermediate)
## Installation Time: 	10 Minutes
# Files To Edit: 	(8)
##			includes/functions.php,
##			includes/functions_display.php,
##			includes/functions_posting.php,
##			includes/session.php,
##			search.php,
##			styles/prosilver/template/viewtopic_body.html,
##			viewforum.php,
##			viewtopic.php
##
## Included Files: n/a
##############################################################
## Author Notes:
## _____________
##
## Voici les instructions de mise  jour : phpBB3 SEO Mod Rewrite Avanc 0.2.0RC3 => 0.4.0RC1
##
## NOTE :
## _____________
##
## Il n'y a pas de mise  jour pas  pas du fichier phpbb_seo_class.php, 
## vous devrez donc remettre vos rglages dans celui-ci.
## De plus, il vous faudra vider le dossier phpBB/cache/ avant de pouvoir utiliser pleinement ce mod,
## effacez simplement tout son contenu SAUF le .htaccess.
## Vous devrez galement CHMODer le dossier phpbb_seo/cache/  0777.
##
##
##############################################################
## MOD History:
##
##	2007-08-10 - 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 POUR VOTRE FORUM <<<<<
_____________________________________________

La procdure d'installation qui suit conservera votre standard d'URL actuel, en fonction des rglages de la classe phpbb_seo_class.php.
Veuillez lire attentivement l'installation, vous y trouverez plus d'information  propos des nouvelles fonctionnalits de la 0.4.0.
Il y a des chances que cela implique une envie de changer d'url, et donc de .htaccess.

Vous devrez galement CHMODer le dossier phpbb_seo/cache/  0777.

_______________
AVERTISSEMENT :
_______________

Il n'y a pas de mise  jour pas  pas du fichier phpbb_seo_class.php, 
vous devrez donc remettre vos rglages dans celui-ci.
De plus, il vous faudra vider le dossier phpBB/cache/ avant de pouvoir utiliser pleinement ce mod,
effacez simplement tout son contenu SAUF le .htaccess.

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

copy root/*.* to *.*

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

includes/functions.php

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

	// 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 (is_object($phpbb_seo)) {
		$page_string = preg_replace("`(\.html?|/)(&amp;|\?)start=([0-9]+)`i", $phpbb_seo->seo_static['start'] . "\\3\\1", $page_string);
		$page_string = str_replace($url_delim . 'start=0', '', $page_string);
		$prev = preg_replace("`(\.html?|/)(&amp;|\?)start=([0-9]+)`i", $phpbb_seo->seo_static['start'] . "\\3\\1", $prev);
		$prev = str_replace($phpbb_seo->seo_static['start'] . '0', '', $prev);
		$next = preg_replace("`(\.html?|/)(&amp;|\?)start=([0-9]+)`i", $phpbb_seo->seo_static['start'] . "\\3\\1", $next);

	}
	$template->assign_vars(array(
		$tpl_prefix . 'BASE_URL'	=> $base_url,
		$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

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

	// 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 (is_object($phpbb_seo)) {
		$page_string = str_replace($url_delim . 'start=0', '', $page_string);
		$page_string = preg_replace(array('`(\.[a-z0-9]+)(&amp;|\?)start=([0-9]+)`i', '`(/)(&amp;|\?)start=([0-9]+)`i'), array($phpbb_seo->seo_delim['start'] . '\\3\\1', '\\1' . $phpbb_seo->seo_static['pagination'] . '\\3' . $phpbb_seo->seo_ext['pagination']), $page_string);
		$prev = preg_replace(array('`(\.[a-z0-9]+)(&amp;|\?)start=([0-9]+)`i', '`(/)(&amp;|\?)start=([0-9]+)`i'), array($phpbb_seo->seo_delim['start'] . '\\3\\1', '\\1' . $phpbb_seo->seo_static['pagination'] . '\\3' . $phpbb_seo->seo_ext['pagination']), $prev);
		$prev = str_replace(array($phpbb_seo->seo_delim['start'] . '0', $phpbb_seo->seo_static['pagination'] . '0' . $phpbb_seo->seo_ext['pagination']), '', $prev);
		$next = preg_replace(array('`(\.[a-z0-9]+)(&amp;|\?)start=([0-9]+)`i', '`(/)(&amp;|\?)start=([0-9]+)`i'), array($phpbb_seo->seo_delim['start'] . '\\3\\1', '\\1' . $phpbb_seo->seo_static['pagination'] . '\\3' . $phpbb_seo->seo_ext['pagination']), $next);
	}
	$template->assign_vars(array(
		$tpl_prefix . 'BASE_URL'	=> $base_url,
		$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

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

includes/functions_display.php

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

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
			$phpbb_seo->seo_url['forum'][$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 ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
			$phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($row['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
		}
		// www.phpBB-SEO.com SEO TOOLKIT END



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

			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
			if ( empty($phpbb_seo->seo_url['forum'][$parent_forum_id]) ) {
				$phpbb_seo->seo_url['forum'][$parent_forum_id] = $phpbb_seo->format_url($parent_name, $phpbb_seo->seo_static['forum']);
			}
			// www.phpBB-SEO.com SEO TOOLKIT END


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

			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
			if ( empty($phpbb_seo->seo_url['forum'][$parent_forum_id]) ) {
				$phpbb_seo->seo_url['forum'][$parent_forum_id] = $phpbb_seo->set_url($parent_name, $parent_forum_id, $phpbb_seo->seo_static['forum']);
			}
			// www.phpBB-SEO.com SEO TOOLKIT END

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

includes/functions_posting.php

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

	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']);
	}

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

	if ( empty($phpbb_seo->seo_url['forum'][$data['forum_id']]) ) {
		$phpbb_seo->seo_url['forum'][$data['forum_id']] = $phpbb_seo->set_url($data['forum_name'], $data['forum_id'], $phpbb_seo->seo_static['forum']);
	}

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

includes/session.php

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

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

#
#-----[ REPLACE WITH ]------------------------------------------
# EG : Delete !



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

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		// Path Settings
		$phpbb_seo->seo_path['current_script_path'] =  (trim($this->page['script_path']) != '/') ? trim($this->page['script_path'], '/') . '/' : '';
		$phpbb_seo->seo_path['current_dir'] =  (trim($this->page['page_dir']) != '/') ? trim($this->page['page_dir'], '/') . '/' : '';
		// www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ REPLACE WITH ]------------------------------------------
# EG : Delete !



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

search.php

#
#-----[ FIND ]------------------------------------------
#
			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']);
			}

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

			if ( empty($phpbb_seo->seo_url['forum'][$u_forum_id]) ) {
				$phpbb_seo->seo_url['forum'][$u_forum_id] = $phpbb_seo->set_url($row['forum_name'], $u_forum_id, $phpbb_seo->seo_static['forum']);
			}

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

styles/prosilver/template/viewtopic_body.html

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

<a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a> 

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

<a href="{U_VIEW_TOPIC}#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a> 

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

viewforum.php

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

// Start initial var setup
$forum_id	= request_var('f', 0);
$mark_read	= request_var('mark', '');
$start		= request_var('start', 0);

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

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ($forum_id == 0) {
	$phpbb_seo->get_forum_id($forum_id, $start);
}
// www.phpBB-SEO.com SEO TOOLKIT END

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

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


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

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( empty($phpbb_seo->seo_url['forum'][$forum_data['forum_id']]) ) {
	$phpbb_seo->seo_url['forum'][$forum_data['forum_id']] = $phpbb_seo->set_url($forum_data['forum_name'], $forum_data['forum_id'], $phpbb_seo->seo_static['forum']);
}
// www.phpBB-SEO.com SEO TOOLKIT END

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

		// We want to retain some values
		$row = array_merge($row, array(
			'topic_moved_id'	=> $rowset[$orig_topic_id]['topic_moved_id'],
			'topic_status'		=> $rowset[$orig_topic_id]['topic_status'])
		);

		$rowset[$orig_topic_id] = $row;

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

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		if ( empty($phpbb_seo->seo_url['topic'][$row['topic_moved_id']]) ) {
			$phpbb_seo->seo_censored[$row['topic_moved_id']] = censor_text($row['topic_title']);
			$phpbb_seo->seo_url['topic'][$row['topic_moved_id']] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$row['topic_moved_id']]);
		}
		// www.phpBB-SEO.com SEO TOOLKIT END 

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

viewtopic.php

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

if ( empty($phpbb_seo->seo_url['forum'][$topic_data['forum_id']]) ) {
	$phpbb_seo->seo_url['forum'][$topic_data['forum_id']] = $phpbb_seo->format_url($topic_data['forum_name'], $phpbb_seo->seo_static['forum']);
}

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

if ( empty($phpbb_seo->seo_url['forum'][$topic_data['forum_id']]) ) {
	$phpbb_seo->seo_url['forum'][$topic_data['forum_id']] = $phpbb_seo->set_url($topic_data['forum_name'], $topic_data['forum_id'], $phpbb_seo->seo_static['forum']);
}

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

	$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");

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

	// www.phpBB-SEO.com SEO TOOLKIT BEGIN
	//$redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");
	// www.phpBB-SEO.com SEO TOOLKIT END

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

		login_box($redirect_url . "&amp;p=$post_id&amp;e=$jump_to", $user->lang['LOGIN_NOTIFY_TOPIC']);

#
#-----[ REPLACE WITH ]------------------------------------------
#
		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		login_box(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=$post_id&amp;e=$jump_to"), $user->lang['LOGIN_NOTIFY_TOPIC']);
		// www.phpBB-SEO.com SEO TOOLKIT END

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

		redirect($redirect_url . ((!$post_id) ? "&amp;p=$jump_to" : "&amp;p=$post_id") . "#p$jump_to");

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

		// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . ((!$post_id) ? "&amp;p=$jump_to" : "&amp;p=$post_id")) . "#p$jump_to");
		// www.phpBB-SEO.com SEO TOOLKIT END

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