Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Zero duplicate support forum. Personalized HTTP 301 dynamic redirections for phpBB.

Moderator: Moderators

Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby IPB_Refugee » Sun Jul 27, 2008 2:36 pm

Hello again! :wink:

It is possible that some mods won't work properly, at first, after install.
If a mod added a GET or POST var on index.php, viewforum.php, viewtopic.php or a member's profile,
it's URLs will most likely (for sure when running in strict mode) be redirected at first.

Example :
viewtopic.php?report=true&p=xx |would be first redirected to| topic-title-tyy-zz.html.

It's simple to fix, we just need to allow this additional var in our dupe filter.


Would you please be so kind to describe how to allow additional vars in the dupe filter?

primehalo's Post Revision MOD adds this to the URL:

Code: Select all
viewtopic.php?p=11433&display_history=true


The problem is, that the link doesn't work - neither in strict mode nor in non-strict mode if Posts Redirections is set to "all".

What I want is: When someone posts a message, he should be redirected to

topic-name-txx.html#pxx instead of postxx.html

But primehalo's great MOD should work nonetheless. I hope this is possible.

Kind regards
Wolfgang
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Advertisement

Postby dcz » Mon Jul 28, 2008 7:33 am

The zero dupe setting for viewtopic.php are in viewtopic.php :

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );
if ( $post_id && !$phpbb_seo->set_do_redir_post()) {
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'p' => array('val' => $post_id, 'keep' => true, 'force' => true),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight)),
   );
} else {
   $seo_watch = request_var('watch', '');
   $seo_unwatch = request_var('unwatch', '');
   $seo_bookmark = request_var('bookmark', 0);
   $keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
   $keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
      't' => array('val' => $topic_id, 'keep' => true, 'force' => true),
      'p' => array('val' => $post_id, 'keep' =>  ($view == 'show' ? true : false)),
      'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
      'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
      'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
      'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
      'st' => array('val' => $sort_days, 'keep' => true),
      'sk' => array('val' => $sort_key, 'keep' => true),
      'sd' => array('val' => $sort_dir, 'keep' => true),
      'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : false),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
   );
}
$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe


No need to say that this is the more complex file to handle.
But the principle is pretty simple, we just need to specify here the GET or POST vars that can interact with viewtopic.php.

In your case, since it's a post url, we need to add the variable twice, one for when redirecting posts, and one for when we are not.

You'd need to add something like :
Code: Select all
      'display_history' => array('val' => $display_history, 'keep' => (boolean) ($display_history == true)),

after :
Code: Select all
      'p' => array('val' => $post_id, 'keep' => true, 'force' => true),


and after :

Code: Select all
      'p' => array('val' => $post_id, 'keep' =>  ($view == 'show' ? true : false)),


And most likely replace :
Code: Select all
      'p' => array('val' => $post_id, 'keep' =>  ($view == 'show' ? true : false)),

with :
Code: Select all
      'p' => array('val' => $post_id, 'keep' =>  ($view == 'show' || $display_history ? true : false)),


This bit assumes that $display_history holds the display_history GET value, you'll need to change this var name in case it's grabbed before with another var name, or just add :
Code: Select all
$display_history = request_var('display_history', false);

after :
Code: Select all
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );


Should work.

Please post here a link to where your mod is released if you have troubles ;)
++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21379
Joined: Fri Apr 28, 2006 9:03 pm

Postby IPB_Refugee » Mon Jul 28, 2008 2:46 pm

Hi dcz,

thanks a lot for your help (also in the Instant Post Redirect topic)! First part is working now. :D Now I have to deal with URLs like

postxxx.html?remove_history=-1

from the same MOD. But due to your previous help, I think I will be able to solve this problem by myself. I will post the solution here later.

You can find primehalo's MODs at phpBB.com or simply here:

http://www.absoluteanime.com/admin/mods.htm

Man, I love this MOD author! He is sooo talented! Wish I will be as good as he is some day. :!:

Kind regards
Wolfgang
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Postby IPB_Refugee » Mon Jul 28, 2008 5:33 pm

Hi dcz,

that was a little bit sophisticated but I think I got it working! :D Here is the viewtopic.php part to make Zero Duplicate MOD work together with primehalo's Post Revision MOD. (It even works with Strict Mode == yes and Post Redirections == all.)

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );

   // Changings for primehalo's Post Revision MOD
   $displ_history = request_var('display_history', false);
   $rem_history = request_var('remove_history', '');
   $conf_key = request_var('confirm_key', '');

if ( $post_id && !$phpbb_seo->set_do_redir_post()) {
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'p' => array('val' => $post_id, 'keep' => true, 'force' => true),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight)),
      
      // Changings for primehalo's Post Revision MOD
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
   );
} else {
   $seo_watch = request_var('watch', '');
   $seo_unwatch = request_var('unwatch', '');
   $seo_bookmark = request_var('bookmark', 0);
   $keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
   $keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);

   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
      't' => array('val' => $topic_id, 'keep' => true, 'force' => true),
      
      // Changings for primehalo's Post Revision MOD
      'p' => array('val' => $post_id, 'keep' =>  (($view == 'show' || $displ_history || !empty($rem_history) || !empty($conf_key)) ? true : false)),
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
      
      'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
      'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
      'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
      'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
      'st' => array('val' => $sort_days, 'keep' => true),
      'sk' => array('val' => $sort_key, 'keep' => true),
      'sd' => array('val' => $sort_dir, 'keep' => true),
      'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : false),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
   );
}

$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe


Have a nice evening!
Wolfgang
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby dcz » Sat Aug 22, 2009 11:04 am

Update for this part should be replace :
Code: Select all
      'p' => array('val' => $post_id, 'keep' =>  ($post_id && $view == 'show' ? true : false), 'hash' => "p$post_id"),


with :
Code: Select all
      'p' => array('val' => $post_id, 'keep' =>  ($post_id && ($view == 'show' || $displ_history || !empty($rem_history) || !empty($conf_key)) ? true : false, 'hash' => "p$post_id"),
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21379
Joined: Fri Apr 28, 2006 9:03 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby Asira » Sun Aug 23, 2009 9:18 pm

I think you miss a closure ')'

Shouldn't it be like this (?):

Code: Select all
'p' => array('val' => $post_id, 'keep' =>  ($post_id && ($view == 'show' || $displ_history || !empty($rem_history) || !empty($conf_key)) ? true : false), 'hash' => "p$post_id"),
User avatar
Asira
 
Posts: 39
Joined: Sat Aug 15, 2009 2:04 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby dcz » Mon Aug 24, 2009 8:40 am

Yes you're right, is it working ?
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21379
Joined: Fri Apr 28, 2006 9:03 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby Asira » Mon Aug 24, 2009 10:26 am

Yes it's working as far as i know. I tested it locally yesterday. Works fine.
User avatar
Asira
 
Posts: 39
Joined: Sat Aug 15, 2009 2:04 pm

Zero Duplicate 0.6.4 and primehalo's Post Revisions 1.2.5a

Postby gunwitch » Tue Jun 08, 2010 11:32 pm

Hello guys,

I'm here with nearly the same question:

I'm using Prime Post Revisions 1.2.5.a and phpBB3 SEO Zero dupilcate 0.6.4 :)

I don't think that asking dcz to write exclusions for every new version of these mods is a good idea (he's already did a great job), so maybe there's a guide to writing No Dupe exclusions?

I'd be happy to read it once and don't bother phpBB-SEO team everytime a need an exclusion :)


P.S.
I need to handle the following URLs:

../forum/viewtopic.php?p=2&display_history=true
(initial URL, which gets redirected to ../forum/post2.html#p2)

and, if the URL above wasn't redirected:
../forum/post2.html?remove_history=-1
../forum/post2.html?remove_history=1275793109

(I temporary disabled Zero Dupe to see the post history and two URLs above)

This example is for post #2 on my board, which installed in the /forum/ directory.
gunwitch
 
Posts: 2
Joined: Mon Jun 07, 2010 3:32 am

Re:

Postby geolim4 » Fri Aug 26, 2011 2:19 am

IPB_Refugee wrote:Hi dcz,

that was a little bit sophisticated but I think I got it working! :D Here is the viewtopic.php part to make Zero Duplicate MOD work together with primehalo's Post Revision MOD. (It even works with Strict Mode == yes and Post Redirections == all.)

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );

   // Changings for primehalo's Post Revision MOD
   $displ_history = request_var('display_history', false);
   $rem_history = request_var('remove_history', '');
   $conf_key = request_var('confirm_key', '');

if ( $post_id && !$phpbb_seo->set_do_redir_post()) {
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'p' => array('val' => $post_id, 'keep' => true, 'force' => true),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight)),
      
      // Changings for primehalo's Post Revision MOD
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
   );
} else {
   $seo_watch = request_var('watch', '');
   $seo_unwatch = request_var('unwatch', '');
   $seo_bookmark = request_var('bookmark', 0);
   $keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
   $keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);

   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
      't' => array('val' => $topic_id, 'keep' => true, 'force' => true),
      
      // Changings for primehalo's Post Revision MOD
      'p' => array('val' => $post_id, 'keep' =>  (($view == 'show' || $displ_history || !empty($rem_history) || !empty($conf_key)) ? true : false)),
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
      
      'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
      'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
      'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
      'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
      'st' => array('val' => $sort_days, 'keep' => true),
      'sk' => array('val' => $sort_key, 'keep' => true),
      'sd' => array('val' => $sort_dir, 'keep' => true),
      'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : false),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
   );
}

$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe


Have a nice evening!
Wolfgang


Thanks this work perfect: phpbb 3.0.9, seo 0.6.8 last version of prime ;)
geolim4
PR1
PR1
 
Posts: 105
Joined: Sun Sep 12, 2010 7:21 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby Leinad4Mind » Fri Nov 16, 2012 10:12 pm

Latest version:

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN -> Zero dupe
$phpbb_seo->seo_opt['zero_dupe']['start'] = $phpbb_seo->seo_chk_start( $start, $config['posts_per_page'] );
// Changings for primehalo's Post Revision MOD
$displ_history = request_var('display_history', false);
$rem_history = request_var('remove_history', '');
$conf_key = request_var('confirm_key', '');

if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
   $phpbb_seo->seo_path['canonical'] = $phpbb_seo->drop_sid(append_sid("{$phpbb_root_path}", "f=$forum_id&t=$topic_id&start=$start"));
}
if ( $post_id && !$view && !$phpbb_seo->set_do_redir_post()) {
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'p' => array('val' => $post_id, 'keep' => true, 'force' => true, 'hash' => "p$post_id"),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => !empty($highlight_match)),
      // Changings for primehalo's Post Revision MOD
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
   );
} else {
   $seo_watch = request_var('watch', '');
   $seo_unwatch = request_var('unwatch', '');
   $seo_bookmark = request_var('bookmark', 0);
   $keep_watch = (boolean) ($seo_watch == 'topic' && $user->data['is_registered']);
   $keep_unwatch = (boolean) ($seo_unwatch == 'topic' && $user->data['is_registered']);
   $keep_hash = (boolean) ($keep_watch || $keep_unwatch || $seo_bookmark);
   $seo_uid = max(0, request_var('uid', 0));
   $phpbb_seo->seo_opt['zero_dupe']['redir_def'] = array(
      'uid' => array('val' => $seo_uid, 'keep' => (boolean) ($keep_hash && $seo_uid)),
      'f' => array('val' => $forum_id, 'keep' => true, 'force' => true),
      't' => array('val' => $topic_id, 'keep' => true, 'force' => true, 'hash' => $post_id ? "p$post_id" : ''),
      // Changings for primehalo's Post Revision MOD
      'p' => array('val' => $post_id, 'keep' =>  (($post_id && $view == 'show' || $displ_history || !empty($rem_history) || !empty($conf_key)) ? true : false), 'hash' => "p$post_id"),
      'display_history' => array('val' => $displ_history, 'keep' => (boolean) ($displ_history == true)),
      'remove_history' => array('val' => $rem_history, 'keep' => $rem_history),
      'confirm_key' => array('val' => $conf_key, 'keep' => $conf_key),
      'watch' => array('val' => $seo_watch, 'keep' => $keep_watch),
      'unwatch' => array('val' => $seo_unwatch, 'keep' => $keep_unwatch),
      'bookmark' => array('val' => $seo_bookmark, 'keep' => (boolean) ($user->data['is_registered'] && $config['allow_bookmarks'] && $seo_bookmark)),
      'start' => array('val' => $phpbb_seo->seo_opt['zero_dupe']['start'], 'keep' => true, 'force' => true),
      'hash' => array('val' => request_var('hash', ''), 'keep' => $keep_hash),
      'st' => array('val' => $sort_days, 'keep' => true),
      'sk' => array('val' => $sort_key, 'keep' => true),
      'sd' => array('val' => $sort_dir, 'keep' => true),
      'view' => array('val' => $view, 'keep' => $view == 'print' ? (boolean) $auth->acl_get('f_print', $forum_id) : (($view == 'viewpoll' || $view == 'show') ? true : false)),
      'hilit' => array('val' => (($highlight_match) ? $highlight : ''), 'keep' => (boolean) !(!$user->data['is_registered'] && $phpbb_seo->seo_opt['rem_hilit'])),
   );
   if ($phpbb_seo->seo_opt['zero_dupe']['redir_def']['bookmark']['keep']) { // Prevent unessecary redirections
      // Note : bookmark, watch and unwatch cases could just not be handled by the zero dupe (no redirect at all when used),
      // but the handling as well acts as a poweful security shield so, it's worth it ;)
      unset($phpbb_seo->seo_opt['zero_dupe']['redir_def']['start']);
   }
}
$phpbb_seo->seo_chk_dupe();
// www.phpBB-SEO.com SEO TOOLKIT END -> Zero dupe


I think it's working good. :D
Leinad4Mind
 
Posts: 3
Joined: Thu Jan 26, 2012 3:23 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby geolim4 » Fri Nov 16, 2012 10:40 pm

Leinad4Mind wrote:Latest version:

Of? Prime Post or SEO? 8)
geolim4
PR1
PR1
 
Posts: 105
Joined: Sun Sep 12, 2010 7:21 pm

Re: Zero Dupe 0.4.4 and primehalo's Post Revision MOD

Postby Leinad4Mind » Sat Nov 17, 2012 12:28 am

Both lol

EDIT: I just know that I've installed both latest version, and with this topic I've "create" this new code ^^
Leinad4Mind
 
Posts: 3
Joined: Thu Jan 26, 2012 3:23 pm


Return to Zero duplicate

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 2 guests