Problème mod categories hierarchy

Nouveau WRInaute
Bonjour à tous, j'ai un forum qui était très bien référencé sur google avec la méthode qui consiste à modifier le fichier session.php en enlevant les sessions.
J'ai installé le mod catégories hierarchy et remodifié le fichiers session comme il se doit et mon site n'est plus référencé sur google !!! Voici l'adresse : futurezone.free.fr/phpBB2/index.php
C'est assez urgent car mon site est entrain de couler lamentablement, il n'y a plus personne!!

Voici les modifications que ce mod apporte au fichier viewtopic.php car apparement le problème vient de là...

Code:
#
#-----[ OPEN ]------------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------------
#
<?php
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#

//-- mod : categories hierarchy ------------------------------------------------
//-- add
include($config->url('includes/class_forums'));

// read forums
$forums = new forums();
$forums->read();
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	if ( $HTTP_GET_VARS['view'] == 'newest' )
	{
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
/*
#
#-----[ FIND ]------------------------------------------------
#
		redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
#
#-----[ AFTER, ADD ]------------------------------------------
#
*/
//-- add
		// start the session in a clean way
		$userdata = session_pagestart($user_ip, PAGE_INDEX);
		init_userprefs($userdata);

		// get cookies
		$user->read_cookies();
		if ( empty($user->cookies['unreads']) || empty($user->cookies['unreads'][$topic_id]) )
		{
			$l_link = 'Click_return_topic';
			$u_link = $config->url('viewtopic', array(POST_TOPIC_URL => $topic_id), true);
			message_return('No_new_posts_last_visit', $l_link, $u_link);
		}
		else
		{
			$sql = 'SELECT post_id
						FROM ' . POSTS_TABLE . '
						WHERE topic_id = ' . $topic_id . '
							AND post_time > ' . intval($user->cookies['unreads'][$topic_id]) . '
						ORDER BY post_time
						LIMIT 1';
			$result = $db->sql_query($sql, false, __LINE__, __FILE__);
			if ( !$row = $db->sql_fetchrow($result) )
			{
				$l_link = 'Click_return_topic';
				$u_link = $config->url('viewtopic', array(POST_TOPIC_URL => $topic_id), true);
				message_return('No_new_posts_last_visit', $l_link, $u_link);
			}
			else
			{
				redirect($config->url('viewtopic', array(POST_POST_URL => $row['post_id']), true, $row['post_id']));
			}
		}
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		$order_sql";
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
//-- add
// we don't need the forums table, so do some cleanings
$sql = str_replace(', ' . FORUMS_TABLE . ' f', '', $sql);
$sql = str_replace('AND f.forum_id = t.forum_id', '', $sql);
$sql = str_replace(', f.forum_id', ', t.forum_id', $sql);
$sql = preg_replace('/, f\.\w*/si', '', $sql);

// added fields
$added_fields = 't.topic_duration, t.topic_first_post_id, t.topic_sub_title, ';
if ( defined('POST_CALENDAR') )
{
	$added_fields .= 't.topic_calendar_time, t.topic_calendar_duration, ';
}
$sql = str_replace('SELECT ', 'SELECT ' . $added_fields, $sql);
$sql = str_replace('GROUP BY ', 'GROUP BY ' . $added_fields, $sql);
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);

if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
	if ( !$userdata['session_logged_in'] )
	{
		$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
		$redirect .= ( isset($start) ) ? "&start=$start" : '';
		redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
	}

	$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);

	message_die(GENERAL_MESSAGE, $message);
}
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
// $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
//
// if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
// {
//	if ( !$userdata['session_logged_in'] )
//	{
//		$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
//		$redirect .= ( isset($start) ) ? "&start=$start" : '';
//		redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
//	}
//
//	$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
//
//	message_die(GENERAL_MESSAGE, $message);
// }
//-- add
// add forums data to the forum_topic_data row
if ( !isset($forums->data[$forum_id]) )
{
	message_return('Topic_post_not_exist');
}
$forum_topic_data = array_merge($forum_topic_data, $forums->data[$forum_id]);

// get auths
$user->get_cache(array(POST_FORUM_URL, POST_FORUM_URL . 'jbox'));
$is_auth = auth(AUTH_ALL, $forum_id, $user->data, $forum_topic_data);

if ( !$user->auth(POST_FORUM_URL, 'auth_read', $forum_id) )
{
	if ( !$user->data['session_logged_in'] )
	{
		$redirect = empty($post_id) || !empty($start) ? array(POST_TOPIC_URL => $topic_id) : array(POST_POST_URL => $post_id);
		redirect($config->url('viewtopic', $redirect + array('start' => intval($start)), true));
	}
	message_return($user->auth(POST_FORUM_URL, 'auth_view', $forum_id) ? sprintf($user->lang('Sorry_auth_read'), $user->lang('Auth_Users_granted_access')) : 'Topic_post_not_exist');
}
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longest
#
	$start = floor(($forum_topic_data['prev_posts'] - 1) /
}
#
#-----[ AFTER, ADD ]------------------------------------------
#

//-- mod : categories hierarchy ------------------------------------------------
//-- add
//
// unmark a post
//
// check if keep unread is on
$cookie_setup = $user->get_cookies_setup();
if ( $cookie_setup['keep_unreads'] )
{
	$unmark = _read('unmark', TYPE_NO_HTML);
	if ( in_array($unmark, array('post', 'topic')) )
	{
		// get the last time read for the topic or the post
		$last_time_read = intval($forum_topic_data['topic_time']) - 1;
		if ( ($unmark == 'post') && !empty($post_id) )
		{
			$sql = 'SELECT post_time
						FROM ' . POSTS_TABLE . '
						WHERE post_id = ' . intval($post_id);
			$result = $db->sql_query($sql, false, __LINE__, __FILE__);
			if ( !$row = $db->sql_fetchrow($result) )
			{
				message_return('No_such_post', 'Click_return_forum', $config->url('index', array(POST_FORUM_URL => $forum_id), true));
			}
			$last_time_read = intval($row['post_time']) - 1;
		}

		// unmark the topic
		$user->read_cookies();
		if ( isset($user->cookies['topics'][$topic_id]) )
		{
			unset($user->cookies['topics'][$topic_id]);
		}
		$user->cookies['unreads'][$topic_id] = $last_time_read;
		$user->write_cookies(array('topics', 'unreads'));

		// return to the forum
		message_return('Topic_unmarked_read', 'Click_return_forum', $config->url('index', array(POST_FORUM_URL => $forum_id), true));
	}
	$template->assign_vars(array(
		'I_UNREAD' => $user->img('icon_unmark_read'),
		'L_UNREAD_TOPIC' => $user->lang('Topic_unmark_read'),
		'U_UNREAD_TOPIC' => $config->url('viewtopic', array(POST_TOPIC_URL => $topic_id, 'unmark' => 'topic'), true),
		'L_UNREAD_POST' => $user->lang('Post_unmark_read'),
		)
	);
}
$template->set_switch('unmark_read', $cookie_setup['keep_unreads']);
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	ORDER BY p.post_time $post_time_order
	LIMIT $start, ".$board_config['posts_per_page'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
//-- add
$sql = str_replace('SELECT ', 'SELECT pt.post_sub_title, ', $sql);
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$sql = "SELECT *
	FROM " . RANKS_TABLE . "
	ORDER BY rank_special, rank_min";
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);
}

$ranksrow = array();
while ( $row = $db->sql_fetchrow($result) )
{
	$ranksrow[] = $row;
}
$db->sql_freeresult($result);
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
// $sql = "SELECT *
//	FROM " . RANKS_TABLE . "
//	ORDER BY rank_special, rank_min";
// if ( !($result = $db->sql_query($sql)) )
// {
//	message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql);
// }
//
// $ranksrow = array();
// while ( $row = $db->sql_fetchrow($result) )
// {
//	$ranksrow[] = $row;
// }
// $db->sql_freeresult($result);
//-- add
$ranks = new ranks();
$ranksrow = $ranks->read();
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
$view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id");
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
// $view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id");
//-- add
$view_forum_url = $config->url('index', array(POST_FORUM_URL => $forum_id), true);
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
//
// Set a cookie for this topic
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
/*
#
#-----[ FIND ]------------------------------------------------
#
# this is a partial search : the full line is longer
#
	setcookie($board_config['cookie_name'] . '_t',
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
*/
//-- add
$topic_last_read = $forums->mark(POST_POST_URL, $topic_id);
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
	if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read )
#
#-----[ REPLACE WITH ]---------------------------------------- 
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
//	if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read )
//-- add
	if ( !empty($topic_last_read) && ($postrow[$i]['post_time'] > $topic_last_read) )
//-- fin mod : categories hierarchy --------------------------------------------
#
#-----[ FIND ]------------------------------------------------
#
		'U_POST_ID' => $postrow[$i]['post_id'])
	);
}
#
#-----[ REPLACE WITH ]----------------------------------------
#
//-- mod : categories hierarchy ------------------------------------------------
//-- delete
//		'U_POST_ID' => $postrow[$i]['post_id'])
//	);
// }
//-- add
		'U_POST_ID' => $postrow[$i]['post_id'],
		'U_UNREAD_POST' => $config->url('viewtopic', array(POST_POST_URL => $postrow[$i]['post_id'], 'unmark' => 'post'), true),
	));
	$template->set_switch('postrow.unmark_read', $cookie_setup['keep_unreads']);

	// message icon
	$icons->topic_title('postrow', $postrow[$i]['post_icon'], ($forum_topic_data['topic_first_post_id'] == $postrow[$i]['post_id']) ? (($forum_topic_data['topic_type'] > POST_NORMAL) ? $forum_topic_data['topic_type'] : ($forum_topic_data['topic_calendar_time'] ? POST_CALENDAR : '')) : '');

	// sub title
	$front_sub_title = new front_sub_title();
	$front_sub_title->topic_title('postrow', $postrow[$i]['post_sub_title'], intval($config->data['sub_title_length']), $highlight_match);
	unset($front_sub_title);

	// first post of the topic, get additional information for the subject
	if ( $forum_topic_data['topic_first_post_id'] == $postrow[$i]['post_id'] )
	{
		// announce
		$front_announce = new front_announce();
		$front_announce->topic_title('postrow', $forum_topic_data['topic_time'], $forum_topic_data['topic_duration']);
		unset($front_announce);

		// calendar
		$front_calendar = new front_calendar();
		$front_calendar->topic_title('postrow', $forum_topic_data['topic_calendar_time'], $forum_topic_data['topic_calendar_duration']);
		unset($front_calendar);
	}
}

$forums->display_nav($forum_id);

$moderators = new moderators();
$moderators->read();
$moderators->display('moderators', $forum_id);

$pagination = new pagination('viewtopic', array(POST_TOPIC_URL => $topic_id, 'postdays' => $post_days, 'postorder' => $post_order, 'highlight' => $highlight));
$pagination->display('pagination', $total_replies, $config->data['posts_per_page'], $start, true, 'Posts_count');

$watch_mode = $is_watching_topic ? 'unwatch' : 'watch';
$l_watch_mode = $is_watching_topic ? 'Stop_watching_topic' : 'Start_watching_topic';
$watch_img = $is_watching_topic ? 'topic_un_watch' : 'topic_watch';
$template->assign_vars(array(
	'U_WATCH_TOPIC' => $config->url('viewtopic', array(POST_TOPIC_URL => $topic_id, $watch_mode => 'topic', 'start' => $start, 'postdays' => $post_days, 'postorder' => $post_order, 'highlight' => $highlight), true),
	'L_WATCH_TOPIC' => $user->lang($l_watch_mode),
	'I_WATCH_TOPIC' => $user->img($watch_img),
	)
);
$template->set_switch('watch', $can_watch_topic);
if ( $can_watch_topic )
{
	$template->set_switch('watch.image', !empty($images[$watch_img]));
}
//-- fin mod : categories hierarchy --------------------------------------------

il y a bien d'autres modifications apportées à d'autres fichiers que viewtopic.php, si vous les voulez je vous les donne mais la ce serait trop volumineux !

AIDEZ MOI PAR PITIEE, MON SITE EST ENTRAIN DE MOURIR !!!
Merci d'avance
 
Discussions similaires
Haut