I have installed the zero dup into test but getting the following error
Fatal error: Call to undefined method phpbb_seo::set_cond() in /xxxx/xxxxxxxxx/public_html/forum2/index.php on line 43
any thoughts??
Moderator: Moderators


// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
$phpbb_seo->seo_path['canonical'] = $phpbb_seo->drop_sid(append_sid("{$phpbb_root_path}index.$phpEx"));
}
$seo_mark = request_var('mark', '');
$keep_mark = in_array($seo_mark, array('topics', 'topic', 'forums', 'all')) ? (boolean) ($user->data['is_registered'] || $config['load_anon_lastread']) : false;
$phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
'hash' => array('val' => request_var('hash', ''), 'keep' => $keep_mark),
'mark' => array('val' => $seo_mark, 'keep' => $keep_mark),
);
if ( !$phpbb_seo->seo_opt['zero_dupe']['strict'] ) { // strict mode is here a bit faster
if ( !empty($phpbb_seo->seo_static['index']) ) {
$phpbb_seo->set_cond( (boolean) (utf8_strpos($phpbb_seo->seo_path['uri'], $phpbb_seo->seo_static['index']) === false), 'do_redir', (empty($_GET) || (!empty($seo_mark) && !$keep_mark)));
} else {
$phpbb_seo->set_cond( (boolean) (utf8_strpos($phpbb_seo->seo_path['uri'], "index.$phpEx") !== false), 'do_redir', (empty($_GET) || (!empty($seo_mark) && !$keep_mark)));
}
}
$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe
display_forums('', $config['load_moderators']);$phpbb_seo->set_cond( (boolean) (utf8_strpos($phpbb_seo->seo_path['uri'], "index.$phpEx") !== false), 'do_redir', (empty($_GET) || (!empty($seo_mark) && !$keep_mark)));

// Let's make sure that settings are consistent
$this->check_config();
}
// Here start the add-on methods
// --> Zero Duplicate
/**
* Custom HTTP 301 redirections.
* To kill duplicates
*/
function seo_redirect($url, $header = '301 Moved Permanently', $code = 301, $replace = true) {
global $db;
if (!$this->seo_opt['zero_dupe']['on'] || @headers_sent()) {
return false;
}
garbage_collection();
$url = str_replace('&', '&', $url);
// Behave as redirect() for checks to provide with the same level of protection
// Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false) {
trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
}
// Now, also check the protocol and for a valid url the last time...
$allowed_protocols = array('http', 'https'/*, 'ftp', 'ftps'*/);
$url_parts = parse_url($url);
if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols)) {
trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
}
$http = 'HTTP/1.1 ';
header($http . $header, $replace, $code);
header('Location: ' . $url);
exit_handler();
}
/**
* Set the do_redir_post option right
*/
function set_do_redir_post() {
global $user;
switch ($this->seo_opt['zero_dupe']['post_redir']) {
case 'guest':
if ( empty($user->data['is_registered']) ) {
$this->seo_opt['zero_dupe']['do_redir_post'] = true;
}
break;
case 'all':
$this->seo_opt['zero_dupe']['do_redir_post'] = true;
break;
case 'off': // Do not redirect
$this->seo_opt['zero_dupe']['do_redir'] = false;
$this->seo_opt['zero_dupe']['go_redir'] = false;
$this->seo_opt['zero_dupe']['do_redir_post'] = false;
break;
default:
$this->seo_opt['zero_dupe']['do_redir_post'] = false;
break;
}
return $this->seo_opt['zero_dupe']['do_redir_post'];
}
/**
* Redirects if the uri sent does not match (fully) the
* attended url
*/
function seo_chk_dupe($url = '', $uri = '', $path = '') {
global $auth, $user, $_SID, $phpbb_root_path, $config;
if (empty($this->seo_opt['req_file']) || (!$this->seo_opt['rewrite_usermsg'] && $this->seo_opt['req_file'] == 'search') ) {
return false;
}
if (!empty($_REQUEST['explain']) && (boolean) ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))) {
if ($_REQUEST['explain'] == 1) {
return true;
}
}
$path = empty($path) ? $phpbb_root_path : $path;
$uri = !empty($uri) ? $uri : $this->seo_path['uri'];
$reg = !empty($user->data['is_registered']) ? true : false;
$url = empty($url) ? $this->expected_url($path) : str_replace('&', '&', append_sid($url, false, true, 0));
$url = $this->drop_sid($url);
// Only add sid if user is registered and needs it to keep session
if (!empty($_GET['sid']) && !empty($_SID) && ($reg || !$this->seo_opt['rem_sid']) ) {
if ($_GET['sid'] == $user->session_id) {
$url .= (utf8_strpos( $url, '?' ) !== false ? '&' : '?') . 'sid=' . $user->session_id;
}
}
$url = str_replace( '%26', '&', urldecode($url));
if ($this->seo_opt['zero_dupe']['do_redir']) {
$this->seo_redirect($url);
} else {
$url_check = $url;
// we remove url hash for comparison, but keep it for redirect
if (strpos($url, '#') !== false) {
list($url_check, $hash) = explode('#', $url, 2);
}
if ($this->seo_opt['zero_dupe']['strict']) {
return $this->seo_opt['zero_dupe']['go_redir'] && ( ($uri != $url_check) ? $this->seo_redirect($url) : false );
} else {
return $this->seo_opt['zero_dupe']['go_redir'] && ( (utf8_strpos( $uri, $url_check ) === false) ? $this->seo_redirect($url) : false );
}
}
}
/**
* expected_url($path = '')
* build expected url
*/
function expected_url($path = '') {
global $phpbb_root_path, $phpEx;
$path = empty($path) ? $phpbb_root_path : $path;
$params = array();
foreach ($this->seo_opt['zero_dupe']['redir_def'] as $get => $def) {
if ((isset($_GET[$get]) && $def['keep']) || !empty($def['force'])) {
$params[$get] = $def['val'];
if (!empty($def['hash'])) {
$params['#'] = $def['hash'];
}
}
}
$this->page_url = append_sid($path . $this->seo_opt['req_file'] . ".$phpEx", $params, false, 0);
return $this->page_url;
}
/**
* set_cond($bool, $type = 'bool_redir', $or = true)
* Helps out grabbing boolean vars
*/
function set_cond($bool, $type = 'do_redir', $or = true) {
if ( $or ) {
$this->seo_opt['zero_dupe'][$type] = (boolean) ($bool || $this->seo_opt['zero_dupe'][$type]);
} else {
$this->seo_opt['zero_dupe'][$type] = (boolean) ($bool && $this->seo_opt['zero_dupe'][$type]);
}
return;
}
/**
* check start var consistency
* Returns our best guess for $start, eg the first valid page
*/
function seo_chk_start($start = 0, $limit = 0) {
if ($limit > 0) {
$start = is_int($start/$limit) ? $start : intval($start/$limit)*$limit;
}
if ( $start >= 1 ) {
$this->start = $this->seo_delim['start'] . (int) $start;
return (int) $start;
}
$this->start = '';
return 0;
}
// <-- Zero Duplicate


<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
# Lines That should already be in your .htacess
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
# You may need to un-comment the following lines
# Options +FollowSymlinks
# To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
# Options -MultiViews
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /forum2/
# HERE IS A GOOD PLACE TO FORCE CANONICAL DOMAIN
# RewriteCond %{HTTP_HOST} !^www\.thecampingforum\.co\.uk$ [NC]
# RewriteRule ^(.*)$ http://www.thecampingforum.co.uk/forum2/$1 [QSA,L,R=301]
# DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
#####################################################
# PHPBB SEO REWRITE RULES ALL MODES
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. "forum" REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^forum\.html$ index.php [QSA,L,NC]
# FORUM ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/?(page([0-9]+)\.html)?$ viewforum.php?f=$2&start=$4 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER ALL MODES
RewriteRule ^announces/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?t=$2&start=$4 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM ALL MODES
RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]
# PHPBB FILES ALL MODES
RewriteRule ^resources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ download/file.php?id=$2&t=$1 [QSA,L,NC]
# PROFILES THROUGH USERNAME
RewriteRule ^member/([^/]+)/?$ memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]
# USER MESSAGES THROUGH USERNAME
RewriteRule ^member/([^/]+)/(topics|posts)/?(page([0-9]+)\.html)?$ search.php?author=$1&sr=$2&start=$4 [QSA,L,NC]
# GROUPS ALL MODES
RewriteRule ^(group|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
# POST
RewriteRule ^post([0-9]+)\.html$ viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^active-topics(-([0-9]+))?\.html$ search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^unanswered(-([0-9]+))?\.html$ search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^newposts(-([0-9]+))?\.html$ search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM
RewriteRule ^the-team\.html$ memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES
# FORUM WITHOUT ID & DELIM ALL MODES (SAME DELIM)
# THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
# FIX RELATIVE PATHS : FILES
RewriteRule ^.+/(style\.php|ucp\.php|mcp\.php|faq\.php|download/file.php)$ $1 [QSA,L,NC,R=301]
# FIX RELATIVE PATHS : IMAGES
RewriteRule ^.+/(styles/.*|images/.*)/$ $1 [QSA,L,NC,R=301]
# END PHPBB PAGES
#####################################################

austin881 wrote:Thank you.
Now go back to the instructions and check that you made the correct additions in phpbb_seo/includes/setup_phpbb_seo.php
Find:
- Code: Select all
// Let's make sure that settings are consistent
$this->check_config();
}
// Here start the add-on methods
Add after:
- Code: Select all
// --> Zero Duplicate
/**
* Custom HTTP 301 redirections.
* To kill duplicates
*/
function seo_redirect($url, $header = '301 Moved Permanently', $code = 301, $replace = true) {
global $db;
if (!$this->seo_opt['zero_dupe']['on'] || @headers_sent()) {
return false;
}
garbage_collection();
$url = str_replace('&', '&', $url);
// Behave as redirect() for checks to provide with the same level of protection
// Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false) {
trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
}
// Now, also check the protocol and for a valid url the last time...
$allowed_protocols = array('http', 'https'/*, 'ftp', 'ftps'*/);
$url_parts = parse_url($url);
if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols)) {
trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
}
$http = 'HTTP/1.1 ';
header($http . $header, $replace, $code);
header('Location: ' . $url);
exit_handler();
}
/**
* Set the do_redir_post option right
*/
function set_do_redir_post() {
global $user;
switch ($this->seo_opt['zero_dupe']['post_redir']) {
case 'guest':
if ( empty($user->data['is_registered']) ) {
$this->seo_opt['zero_dupe']['do_redir_post'] = true;
}
break;
case 'all':
$this->seo_opt['zero_dupe']['do_redir_post'] = true;
break;
case 'off': // Do not redirect
$this->seo_opt['zero_dupe']['do_redir'] = false;
$this->seo_opt['zero_dupe']['go_redir'] = false;
$this->seo_opt['zero_dupe']['do_redir_post'] = false;
break;
default:
$this->seo_opt['zero_dupe']['do_redir_post'] = false;
break;
}
return $this->seo_opt['zero_dupe']['do_redir_post'];
}
/**
* Redirects if the uri sent does not match (fully) the
* attended url
*/
function seo_chk_dupe($url = '', $uri = '', $path = '') {
global $auth, $user, $_SID, $phpbb_root_path, $config;
if (empty($this->seo_opt['req_file']) || (!$this->seo_opt['rewrite_usermsg'] && $this->seo_opt['req_file'] == 'search') ) {
return false;
}
if (!empty($_REQUEST['explain']) && (boolean) ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))) {
if ($_REQUEST['explain'] == 1) {
return true;
}
}
$path = empty($path) ? $phpbb_root_path : $path;
$uri = !empty($uri) ? $uri : $this->seo_path['uri'];
$reg = !empty($user->data['is_registered']) ? true : false;
$url = empty($url) ? $this->expected_url($path) : str_replace('&', '&', append_sid($url, false, true, 0));
$url = $this->drop_sid($url);
// Only add sid if user is registered and needs it to keep session
if (!empty($_GET['sid']) && !empty($_SID) && ($reg || !$this->seo_opt['rem_sid']) ) {
if ($_GET['sid'] == $user->session_id) {
$url .= (utf8_strpos( $url, '?' ) !== false ? '&' : '?') . 'sid=' . $user->session_id;
}
}
$url = str_replace( '%26', '&', urldecode($url));
if ($this->seo_opt['zero_dupe']['do_redir']) {
$this->seo_redirect($url);
} else {
$url_check = $url;
// we remove url hash for comparison, but keep it for redirect
if (strpos($url, '#') !== false) {
list($url_check, $hash) = explode('#', $url, 2);
}
if ($this->seo_opt['zero_dupe']['strict']) {
return $this->seo_opt['zero_dupe']['go_redir'] && ( ($uri != $url_check) ? $this->seo_redirect($url) : false );
} else {
return $this->seo_opt['zero_dupe']['go_redir'] && ( (utf8_strpos( $uri, $url_check ) === false) ? $this->seo_redirect($url) : false );
}
}
}
/**
* expected_url($path = '')
* build expected url
*/
function expected_url($path = '') {
global $phpbb_root_path, $phpEx;
$path = empty($path) ? $phpbb_root_path : $path;
$params = array();
foreach ($this->seo_opt['zero_dupe']['redir_def'] as $get => $def) {
if ((isset($_GET[$get]) && $def['keep']) || !empty($def['force'])) {
$params[$get] = $def['val'];
if (!empty($def['hash'])) {
$params['#'] = $def['hash'];
}
}
}
$this->page_url = append_sid($path . $this->seo_opt['req_file'] . ".$phpEx", $params, false, 0);
return $this->page_url;
}
/**
* set_cond($bool, $type = 'bool_redir', $or = true)
* Helps out grabbing boolean vars
*/
function set_cond($bool, $type = 'do_redir', $or = true) {
if ( $or ) {
$this->seo_opt['zero_dupe'][$type] = (boolean) ($bool || $this->seo_opt['zero_dupe'][$type]);
} else {
$this->seo_opt['zero_dupe'][$type] = (boolean) ($bool && $this->seo_opt['zero_dupe'][$type]);
}
return;
}
/**
* check start var consistency
* Returns our best guess for $start, eg the first valid page
*/
function seo_chk_start($start = 0, $limit = 0) {
if ($limit > 0) {
$start = is_int($start/$limit) ? $start : intval($start/$limit)*$limit;
}
if ( $start >= 1 ) {
$this->start = $this->seo_delim['start'] . (int) $start;
return (int) $start;
}
$this->start = '';
return 0;
}
// <-- Zero Duplicate


Users browsing this forum: Bing [Bot] and 1 guest