Strony: [1]
  Drukuj  
Autor Wątek: aaa  (Przeczytany 113 razy)
Administrator
Ekspert
Reputacja 1
Wiadomości: 511
Offline Offline
Zobacz profil WWW
aaa
« : Maj 13, 2008, 04:13:39 »

##############################################################
## MOD Title:       Advanced phpBB3 SEO mod Rewrite
## MOD Author:       dcz / www.phpbb-seo.com
## MOD Description:    This mod will URL rewrite phpBB URLs, injecting
##         categories, forums and topic titles in their URLS.
##          Please read the author notes BEFORE using this mod.
##          Check http://www.phpbb-seo.com/boards/advanced-seo-url/advanced-phpbb3-seo-url-vt1219.html
##          for the latest version or to get help with this MOD.
##
## MOD Version:    0.4.2
##
## Installation Level:    ADVANCED
## Installation Time:    20 Minutes
## Files To Edit:    18
##         .htaccess,
##         common.php,
##         includes/db/dbal.php,
##         includes/functions.php,
##         includes/functions_content.php,
##         includes/functions_display.php,
##         includes/functions_posting.php,
##         index.php,
##         language/en/acp/common.php,
##         memberlist.php,
##         search.php,
##         styles/prosilver/template/forum_fn.js,
##         styles/prosilver/template/overall_header.html,
##         styles/prosilver/template/viewtopic_body.html,
##         styles/subsilver2/template/overall_header.html,
##         styles/subsilver2/template/viewtopic_body.html,
##         viewforum.php,
##         viewtopic.php
##
## Included Files:   (Cool
##         includes/acp/acp_phpbb_seo.php
##         includes/acp/info/acp_phpbb_seo.php
##         images/phpbb-seo.png
##         language/en/acp/phpbb_seo.php
##         phpbb_seo/.htaccess
##         phpbb_seo/docs/COPYING
##         phpbb_seo/phpbb_seo_class.php
##         phpbb_seo/phpbb_seo_install.php
##
## License: http://www.opensource.org/licenses/rpl.php Reciprocal Public License
##############################################################
## Author Notes:
## _____________
##
## This is the phpBB SEO Advanced mod_rewrite core.
## Please note that this version will not inject topic titles in post's URLS. This is to make it easier
## to disallow them with our robots.txt file, since these are duplicates any way.
##
## You can insall the No Duplicate mod ( http://www.phpbb-seo.com/boards/advanced-seo-url/advanced-phpbb3-seo-url-vt1219.html )
## if you want to replace post URL with their corresponding topic URL.
##
## This mod requires running Apache Server with mod_Rewrite module loaded, or IIS server running isapi_rewrite.
##
## This mod no longer requires any other SID removal method, phpBB is doing it by itself as long as you set it up properly.
##
## With this mod, phpBB URL will transformed this way :
##
##   viewforum.php?f=xx            =>   any-keywords-fxx.html (by default),
##                        any-keywords-fxx/ (optional),
##                        any-keywords/ (optional)
##
##   viewforum.php?f=xx&start=yy         =>   any-keywords-fxx-yy.html (by default),
##                        any-keywords-fxx/pageyy.html (optional),
##                        any-keywords/pageyy.html (optional)
##
##   viewtopic.php?f=xx&t=yy            =>   topic-title-tyy.html (by default),
##                        any-keywords-fxx/topic-title-tyy.html (optional),
##                        any-keywords/topic-title-tyy.html (optional)
##
##   viewtopic.php?f=xx&t=yy&start=zz      =>   topic-title-tyy-zz.html (by default),
##                        any-keywords-fxx/topic-title-tyy-zz.html (optional),
##                        any-keywords/topic-title-tyy-zz.html (optional),
##                        topic-title-tyy/pagezz.html (optional),
##                        any-keywords-fxx/topic-title-tyy/pagezz.html (optional),
##                        any-keywords/topic-title-tyy/pagezz.html (optional)
##
##   viewtopic.php?p=xx            =>   postxx.html (by default)
##
##   memberlist.php?mode=viewprofile&u=xx      =>   memberxx.html (by default),
##   memberlist.php?mode=viewprofile&un=nickname      memberxx/ (by default),
##   if possible                  nickname-uxx.html (optional),
##                        nickname-uxx/ (optional),
##                        member/nickname (optional)
##
##   memberlist.php?mode=group&g=xx         =>   groupxx.html (by default),
##                        groupe-name-gxx.html (optional)
##
##   memberlist.php?mode=group&g=xx&start=yy      =>   groupxx-yy.html (by default),
##                        groupe-name-gxx-yy.html (optional),
##                        groupxx/pageyy.html (optional),
##                        groupe-name-gxx/pageyy.html (optional)
##
##   memberlist.php?mode=leaders         =>   the-team.html (by default)
##
##   search.php?author_id=xx&sr=post|topics      =>   memberxx-posts|topics.html (optional),
##   search_id=egosearch               memberxx/posts|topics/ (optional),
##   search.php?author=nickname&sr=post|topics      nickname-uxx-posts|topics.html (optional),
##   if possible                   nickname-uxx/posts|topics/ (optional),
##                        member/nickname/posts|topics/ (optional)
##
##   search.php?author_id=xx&sr=post|topics&start=yy   =>   memberxx-posts|topics-yy.html (optional),
##   search.php?author=nickname&sr=post|topics&start=yy   memberxx/posts|topics/pageyy.html (optional),
##   if possible                   nickname-uxx-posts|topics-yy.html (optional),
##                         nickname-uxx/posts|topics/pageyy.html (optional),
##                        member/nickname/posts|topics/pageyy.html (optional)
##
##   search_id=active_topics            =>    active-topics.html
##
##   search_id=active_topics&start=xx      =>    active-topics-xx.html
##
##   search_id=unanswered&sr=topics         =>    unanswered.html,
##
##   search_id=unanswered&start=xx&sr=topics      =>    unanswered-xx.html,
##
##   search_id=newposts&sr=topics         =>    newposts.html,
##
##   search_id=newposts&start=xx&sr=topics      =>    newposts-xx.html,
##
##   If the virtual folder is turned on, global announces will be treated in a separate virtual folder :
##
##   viewtopic.php?f=xx&t=yy            =>   announces/announces-title-tyy.html
##
##   viewtopic.php?f=xx&t=yy&start=zz      =>   announces/announces-title-tyy-zz.html
##
## This mod has nothing in common with other phpBB mod rewrite, it will perform the URL rewriting
## without using ob_start() nor adding any SQL. It is thus faster and not messing anymore with Gun-Zip
## or with the html link format, and will not output any pagination duplicates.
##
## The process is optimized, titles and URLs are transformed once, even if the url is called and outputted many times.
##
## WARNING : Topic title injection in URL can be hard to deal with depending on the type of subjects your
## forum is about. In most cases phpBB SEO recommend the use of the phpBB SEO mixed mod Rewrite instead.
## Please read : http://boards.phpbb-seo.com/phpbb-seo-toolkit/phpbb-seo-mod-rewrites-vt66.html
##
## This mod is and will be compatible to all phpBB SEO modules, specific install instructions may apply.
## phpBB SEO will provide patches to allow for other URL standards support upon request,
## so that everyone can take advantage of the phpBB mod Rewrites enhancement without jeopardising his Page-Ranking.
##
##
## Char-sets :
## ___________
##
##    phpBB3 uses UTF-8 as final encoding, and this should be enough to handle all cases.
## UTF-8 is fully supported by this mod.
## The mod rewrite will only inject the ASCII Chars ( after removing all accents ) available in the titles.
##
## For example : "[non ASCII chars] Software nińo" will be formated this way prior to injection : "software-nino".
## It is still possible that some characters only having a decimal HTML/XML entity won't be handled properly at first.
## The method to filter these is simple, please ask for help in our forums.
##
## Migration :
## ___________
##
## If you are migration, eg if your forum is already indexed using different URLs,
## you'll have to use another robots.txt and install the zero duplicate.
## The migrating procedure will allow you to migrate and keep your previously indexed pages.
## Older links will be HTTP 301 redirected to the new ones. It is rather simple, but the solution depends on cases.
## Let's meet in the Advanced mod rewrite forum ( http://www.phpbb-seo.com/boards/advanced-seo-url-vf54/ ).
##
##
####  UPDATE
## 0.4.0 => 0.4.2 Update : Required changes to be found in contrib/0.4.0_0.4.2_Advanced_Update.txt
## Previous updates are to be found in the contrib/old/ folder.
####
##
## LICENSE:
##
## We, phpBB SEO, have decided to license this mod under the RPL Licence ( http://www.opensource.org/licenses/rpl.php )
## which states you cannot remove the phpBB SEO credits and if you make any modifications you have to resubmit them
## to phpBB SEO for inclusion into this package again. You can read the license for yourself for further info.
##
## You can of course use this mod without any more limitations than those stated here and in the licence.
##
## At least a link ( http://www.phpbb-seo.com/ ) is required on every web site using this mod, or,
## if your web site does not comply with what phpBB SEO can link to, one proven link within a
## general audience hard link directory of your choice not already listing phpBB SEO.
## For more details about possible exceptions, please contact a phpBB SEO administrator (primarily SeO or dcz).
##
## Failure to comply will jeopardize support and developments.
##
##############################################################
## MOD History:
##
##   2008-04-14 - 0.4.2
##      - Updated : User messages pages URLs structure,
##      - Added : virtual folder option for user messages pages,
##      - Added : copyright link formatting options,
##      - Added : support for active_topics link,
##      - Added : support for unanswered link,
##      - Added : support for newposts link,
##      - Added : support for egosearch link,
##      - Added : support for most active topic link on profile view,
##      - Fixed : group sort option links,
##      - Fixed : unread link it topic view,
##      - Fixed : Session tracking : Sessions tracking is now fully fixed for viewforum,
##           but will only work with virtual folder trick in viewtopic,
##      - Various optimizations in phpbb_seo_class.php and acp_phpbb_seo.php.
##   2007-12-18 - 0.4.0
##      - Added : Group URL rewriting, with optional group name injection,
##      - Added : profile URL can use nickname injection (optional),
##      - Added : profile URL can use nickname injection without ID (optional),
##      - Added : User messages URL can use nickname injection (optional),
##      - Added : User messages URL can use nickname injection without ID (optional),
##      - Added : 404 header is now returned for forums that do not exist (both rewritten and vanilla URLs),
##      - Added : subsilver2 code changes,
##      - Fixed : Usage of a slash as a suffix is now fully supported for all rewritten URLs,
##      - Fixed : Base href handling (bug with virtual root option),
##      - Fixed : 100% XHTML valid output,
##      - Updated to comply with phpBB3.0.0.
##   2007-10-15 - 0.4.0RC4
##      - Fixed JS jump to page script,
##      - Updated to comply with phpBB3.0.RC7.
##   2007-09-15 - 0.4.0RC3
##      - Enhanced the phpBB SEO ACP a bit,
##      - Updated part of the code to take the other two versions into account.
##   2007-09-06 - 0.4.0RC2a
##      - Fixed ACP bug with the zero duplicate,
##      - Fixed typo in install.
##   2007-08-31 - 0.4.0RC2
##      - Added phpBB3 acp module with installer,
##      - Added an option to be able to turn on / off URL rewriting,
##      - Updated the install to comply with phpBB3.0.RC5.
##   2007-08-10 - 0.4.0RC1
##      - Added a custom pagination for when forum are treated as virtual folders,
##      - Added a forum URLs cache and setting page,
##      - Added a phpBB SEO mod rewrite setting page,
##      - Added an .htaccess setup page,
##      - Fixed small word filtering (thx pvchat1),
##      - Fixed back to top link in viewtopic (thx GTT),
##      - Fixed notification link redirection (thx Illuminati).
##   2007-07-29 - 0.2.0RC3
##      - Updated to work with phpBB3 RC4 (no changes with phpBB3 RC3),
##      - New option : To add or not the forum url in the topic ones,
##      - New base href handling, now conditioned to the required files only,
##      - Added rewriting of the return link while posting,
##      - Added small words filtering using the fast preg_replace() method,
##      - Optimized URL caching.
##   2007-06-27 - 0.2.0RC2a
##      - Fixed last and newest post link in search view
##   2007-06-27 - 0.2.0RC2
##      - Updated to work with phpBB3 RC2
##      - Easier install, better virtual folder handling
##   2007-05-26 - 0.2.0RC1
##      - First public Version
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


#
#-----[ DIY INSTRUCTIONS ]--------------------------------------------------
#
________________________________________
>>>>   INSTALLATION INSTRUCTION    <<<<<
________________________________________

You will find the premodded phpBB 3.0.1 files in contrib/phpBB_3.0.1_modified_files/root/,
you can safely overwrite the phpBB 3.0.1 files with these and skip the file editing part of this install
if you did not modify these before you install this mod.
Additional language files modified by this mod are to be found in
contrib/phpBB_3.0.1_modified_files/translations/.

A phpBB 3.0.1 => advanced mod rewrite 0.4.2 diff file is as well available in the
contrib/ directory of this release.

___________
IMPORTANT :
________________________________________
Before you start, read this with caution.
=> For a smooth install :
   1) Backup all your files;
   2) Apply the mod code changes on copies of your files;
   3) Upload all files;
   4) CHMOD the phpbb_seo/cache/ folder to 0777;
   5) Empty the phpBB/cache/ folder : just delete all files EXCEPTS the .htaccess.
   6) Go to www.yoursite.com/phpBB/phpbb_seo/phpbb_seo_install.php and follow the install instruction
   7) Go to phpBB ACP : It's now time to play with settings described bellow;
   Cool Generate your personalized .htaccess and upload or move it following the instructions;
   9) Test a rewritten URL, such as www.yoursite.com/phpBB/post1.html, if you end up with a 404 (not a phpBB message), go back to step 8;
   10) Activate URL rewriting in phpBB ACP and allow yourself some auto-congratulation Chichot
________________________________________

Once you will have installed the mod, you will have to refresh your theme's cache as well as phpBB's cache (ACP => STYLE, Themes => Refresh).
__________
Settings :
__________

The settings must be done before step 7 above for the generated .htaccess to be up to date.
Later modification will most likey require a new .htaccess as well as personalized redirections.


=> By Default, this mod will get rid of index.php for phpBB's index.
You can change this in phpbb_seo/phpbb_seo_class.php if you prefer.
Look for :

'index' => ''

In this line of code :

      $this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );

And replace with  :

'index' => 'forum'

or whatever you may prefer.
This is mostly useful if you're running a portal in the folder where phpBB is installed.

=> The first setting to do is to select which static part to use in your URLs.

To do so, you can modify this line in phpbb_seo/phpbb_seo_class.php :

      $this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );

   => the-team :   
      'leaders' => 'the-team'

   => announces :
      'global_announce' => 'announces'

   => Active topics :
      'atopic' => 'active-topics'

   => Unaswered :
      'utopic' => 'unanswered'

   => Newposts :
      'npost' => 'newposts'
 
   => As well as forum ('forum' => 'forum'), topic ('topic' => 'topic'), post ('post' => 'post'),
   member ('user' => 'member'), groups ('group' => 'group') and virtual folder pagination ('pagination' => 'page')

   => And the suffixes, if you do not like .html :
      $this->seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'group' => '.html',  'index' => '', 'global_announce' => '/', 'leaders' => '.html', 'atopic' => '.html', 'utopic' => '.html', 'npost' => '.html', 'pagination' => '.html', 'gz_ext' => '');

   Please note that suffixes may not be ".php" or empty, if you set a suffix to "/",
   it will automatically activate the pagexx.html pagination.

Once set, these settings will be taken into account while generating the .htaccess.

=> Other options are configurable on the setting page (step 7 of the above list).
Go to the "phpBB SEO Class Settings" page, and take your time to set up the class as you whish.

=> It is now time to play with your forum URLs.
To do so, go to the "Forum URL management" page and start selecting good keywords for your forum URLs.
Take your time to do it, and remember that using the remove IDs option in the settings makes it a bit harder to build appropriate redirection, in case you edit the forum URLs later.
If you later create more forums, you'll just have to go to this page again an eventually update the
new forum URL.
If not, the new forum URL will not be cached and the default one will be used (forum-title-fxx).

___________
NOTE: Cache
___________
The cache files are in the phpbb_seo_/cache/ folder.
phpbb_cache.php is the cached file containing both your settings and forum URLs.

The mod always creates a backups of the current cached file :
   => phpbb_cache.php.current is a copy of the phpbb_cache.php file.
   It will automatically be used in case phpbb_cache.php is deleted or corrupted (which should not occur but).
   => phpbb_cache.php.old is a copy of the previous settings you had set, before the last update you performed.

You should backup these file when you update them, they are as crucial as you data base for your forum
since they are required for your forum URL to work properly.
So relax, this is just a basic precaution, you should not have trouble with these,
but never is better, hence the backup.

_________________
NOTE: .htaccess :
_________________

On the phpBB SEO ACP module, go to the ".htaccess" page.
A personalised .htaccess will be generated. It's the first one to consider trying.
If the default suggestion does not work, you will be to try more options, and generate several alternative.
You'll find an empty .htaccess file in this mod's archive contrib/ folder, you can use it to paste the .htaccess content generated on the htaccess page or save it directly on the server.


Please take a look at : http://www.phpbb-seo.com/boards/seo-principles/locking-the-www-in-urls-vt30.html
to find out how to lock the use (or un use) of the www prefix in your domain's url.
This is a major Search Engine Optimisation issue to take care of the www prefix issue.

__________________
NOTE: robots.txt :
__________________

You will find a sample robots.txt file in the contrib/ folder of this package.
The robots.txt file must be uploaded in your domain's root folder (can be different from the phpBB one).
You must obviously replace phpbb/ with your real phpBB installation folder (or with nothing if it's installed in the domain's root).

IMPORTANT :
   If your forum previously was indexed with the natural urls (viewtopic.php etc...), then you must make sure
   that the robots.txt advised for our mod rewrite is not installed, if so delete it from the server.
   This because we want to redirect old urls before we disallow them, it's crucial!
   In such case, a month or two after you activated the zero duplicate, you can safely implement the robots.txt.

__________________________________________________
NOTE: profile and user messages pages ID removing:
__________________________________________________

phpBB/member/nicknames VS  phpBB/nicknames-uxx.html

If you use profile and / or user messages pages ID removing, you should know that a custom urlencode
will be used to circumvent a bug with mod_rewrite.
This imply that some chars like "&", "/", "#" and spaces will always be double encoded.
For example a user named rock&roll will require rock%2526roll (double urlencoded &) to be usable.
( http://www.php.net/urlencode => http://issues.apache.org/bugzilla/show_bug.cgi?id=34602 )

There are other issues with custom characters, like accents, which will add some urlencoded chars in urls.
It's not an SEO issue, since bots knows about urlencoding, but it can end up building pretty long url with multi byte characters.
This does not concern the a-zA-Z0-9 chars, underscore ("_"), hyphen ("-") and dot (".") included.
In phpbb_seo/phpbb_seo_class.php, you will no longer see different methods.

This of course means that the ID removing on profile and user messages pages is more comfy and universally efficient
to use with alphanumeric chars user names (without accents).

If you only allow alphanumeric chars for your user nicknames, then you can make the injection process faster by adding :

   return $url;

right after :

   function seo_url_encode( $url ) {

Remember that keeping the ID here will always work and that you still can simulate a folder structure for user messages pages.

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

copy root/*.* to root/*.*

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

common.php

#
#-----[ FIND ]------------------------------------------
#
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
#
#-----[ AFTER, ADD ]------------------------------------------
#

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if (empty($phpbb_seo) ) {
   require_once($phpbb_root_path . 'phpbb_seo/phpbb_seo_class.'.$phpEx);
   $phpbb_seo = new phpbb_seo();
}
// www.phpBB-SEO.com SEO TOOLKIT END

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

includes/db/dbal.php

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

   function sql_report($mode, $query = '')
   {
      global $cache, $starttime, $phpbb_root_path, $user;

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

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

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

                  <link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />

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

                  <link href="' . $phpbb_seo->seo_path['phpbb_url'] . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />

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

includes/functions.php

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

function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '')
{
   global $template, $user;

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

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

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

   $template->assign_vars(array(
      $tpl_prefix . 'BASE_URL'      => $base_url,
      'A_' . $tpl_prefix . 'BASE_URL'   => addslashes($base_url),
      $tpl_prefix . 'PER_PAGE'      => $per_page,

      $tpl_prefix . 'PREVIOUS_PAGE'   => ($on_page == 1) ? '' : $base_url . "{$url_delim}start=" . (($on_page - 2) * $per_page),
      $tpl_prefix . 'NEXT_PAGE'      => ($on_page == $total_pages) ? '' : $base_url . "{$url_delim}start=" . ($on_page * $per_page),
      $tpl_prefix . 'TOTAL_PAGES'      => $total_pages,
   ));

#
#-----[ 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 (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
      static $pagin_find = array();
      static $pagin_replace = array();
      static $prev_find = array();
      if (empty($pagin_replace)) {
         $pagin_find = array('`(\.(?!' . $phpEx . ')[a-z0-9]+)([\w\#$%&~\-;:=,?@+]*)(&amp;|\?)start=([0-9]+)`i', '`/([\w\#$%&~\-;:=,?@+]*)(&amp;|\?)start=([0-9]+)`i' );
         $pagin_replace = array( $phpbb_seo->seo_delim['start'] . '\\4\\1\\2', '/' . $phpbb_seo->seo_static['pagination'] . '\\3' . $phpbb_seo->seo_ext['pagination'] . '\\1' );
         $prev_find = array($phpbb_seo->seo_delim['start'] . '0', $phpbb_seo->seo_static['pagination'] . '0' . $phpbb_seo->seo_ext['pagination']);
      }
      $page_string = str_replace($url_delim . 'start=0', '', $page_string);
      $page_string = preg_replace($pagin_find, $pagin_replace, $page_string);
      $prev = preg_replace($pagin_find, $pagin_replace, $prev);
      $prev = str_replace($prev_find, '', $prev);
      $next = preg_replace( $pagin_find, $pagin_replace, $next);
   }
   $template->assign_vars(array(
      $tpl_prefix . 'BASE_URL'   => $base_url,
      'A_' . $tpl_prefix . 'BASE_URL'   => addslashes($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

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

function append_sid($url, $params = false, $is_amp = true, $session_id = false)
{
   global $_SID, $_EXTRA_URL, $phpbb_hook;

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

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

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

         return $url . (($append_url) ? $url_delim . $append_url : '') . $anchor;

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         $url .= (($append_url) ? $url_delim . $append_url : '') . $anchor;
         return $phpbb_seo->url_rewrite($url, $is_amp);
         // www.phpBB-SEO.com SEO TOOLKIT END

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

         return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . 'sid=' . $session_id . $anchor;

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         $url .= (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . 'sid=' . $session_id . $anchor;
         return $phpbb_seo->url_rewrite($url, $is_amp);
         // www.phpBB-SEO.com SEO TOOLKIT END

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

   return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id) . $anchor;

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   $url .= (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id) . $anchor;
   return $phpbb_seo->url_rewrite($url, $is_amp);
   // www.phpBB-SEO.com SEO TOOLKIT END

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

   return $phpbb_root_path . str_replace('&', '&amp;', $redirect);

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

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

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

function page_header($page_title = '', $display_online_list = true)
{
   global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path;

   if (defined('HEADER_INC'))
   {
      return;
   }

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpbb_seo;
   $template->assign_vars( array( 'PHPBB_FULL_URL' => $phpbb_seo->seo_path['phpbb_url'],
         'SEO_BASE_HREF' => $phpbb_seo->seo_opt['seo_base_href'],
         'SEO_START_DELIM' => $phpbb_seo->seo_delim['start'],
         'SEO_SATIC_PAGE' => $phpbb_seo->seo_static['pagination'],
         'SEO_EXT_PAGE' => $phpbb_seo->seo_ext['pagination'])
   );
   // www.phpBB-SEO.com SEO TOOLKIT END

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

/**
* Generate page footer
*/
function page_footer($run_cron = true)
{
   global $db, $config, $template, $user, $auth, $cache, $starttime, $phpbb_root_path, $phpEx;

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpbb_seo;
   if (is_object($phpbb_seo)) {
      $phpbb_seo->seo_end();
   }
   // www.phpBB-SEO.com SEO TOOLKIT END

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

         $debug_output .= ' | <a href="' . build_url() . '&amp;explain=1">Explain</a>';

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         $url_prefix = build_url();
         $debug_output .= ' | <a href="' . $url_prefix . ((strpos($url_prefix, '?') === false) ? '?' : '&amp;') . 'explain=1">Explain</a>';
         // www.phpBB-SEO.com SEO TOOLKIT END

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

includes/functions_content.php

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

function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
{
   global $phpbb_root_path, $phpEx, $user, $auth;

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

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

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

         $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&amp;u=' . (int) $user_id : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . (int) $user_id);

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         $phpbb_seo->set_user_url( strip_tags($username), $user_id );
         // www.phpBB-SEO.com SEO TOOLKIT END

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

includes/functions_display.php

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

function display_forums($root_data = '', $display_moderators = true, $return_moderators = false)
{
   global $db, $auth, $user, $template;
   global $phpbb_root_path, $phpEx, $config;

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

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

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

   while ($row = $db->sql_fetchrow($result))
   {
      $forum_id = $row['forum_id'];

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

      // 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 ]------------------------------------------
#

function generate_forum_nav(&$forum_data)
{
   global $db, $user, $template, $auth;
   global $phpEx, $phpbb_root_path;

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

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

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

      foreach ($forum_parents as $parent_forum_id => $parent_data)
      {
         list($parent_name, $parent_type) = array_values($parent_data);

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

         // 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

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

/**
* Generate topic pagination
*/
function topic_generate_pagination($replies, $url)
{
   global $config, $user;

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

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

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

   }
   else
   {
      $pagination = '';
   }

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

      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      if (!empty($phpbb_seo->seo_opt['url_rewrite'])) {
         static $pagin_find = array();
         static $pagin_replace = array();
         if (empty($pagin_find)) {
            $pagin_find = array( '`(\.(?!' . $phpEx . ')[a-z0-9]+)([\w\#$%&~\-;:=,?@+]*)&amp;start=([0-9]+)`i', '`/([\w\#$%&~\-;:=,?@+]*)&amp;start=([0-9]+)`i' );
            $pagin_replace = array( $phpbb_seo->seo_delim['start'] . '\\3\\1\\2', '/' . $phpbb_seo->seo_static['pagination'] . '\\2' . $phpbb_seo->seo_ext['pagination'] .'\\1' );
         }
         $pagination = str_replace( '&amp;start=0', '', $pagination );
         $pagination = preg_replace( $pagin_find, $pagin_replace, $pagination );
      }
      // www.phpBB-SEO.com SEO TOOLKIT END

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

function get_moderators(&$forum_moderators, $forum_id = false)
{
   global $config, $template, $db, $phpbb_root_path, $phpEx;

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

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

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

         $forum_moderators[$row['forum_id']][] = '<a' . (($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . ';"' : '') . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';

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

         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         if ( $phpbb_seo->seo_opt['profile_inj'] && empty($phpbb_seo->seo_url['group'][$row['group_id']]) ) {
            $phpbb_seo->seo_url['group'][$row['group_id']] = $phpbb_seo->format_url($row['group_name'], $phpbb_seo->seo_static['group']);
         }
         // www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#
function display_user_activity(&$userdata)
{
   global $auth, $template, $db, $user;
   global $phpbb_root_path, $phpEx;
#
#-----[ AFTER, ADD ]------------------------------------------
#
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpbb_seo;
   // www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ FIND ]------------------------------------------
#
      $sql = 'SELECT topic_title
         FROM ' . TOPICS_TABLE . '
         WHERE topic_id = ' . $active_t_row['topic_id'];
      $result = $db->sql_query($sql);
      $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title');
#
#-----[ REPLACE WITH ]------------------------------------------
#
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      $sql = 'SELECT t.topic_title, t.topic_type, f.forum_id, f.forum_name
         FROM ' . TOPICS_TABLE . ' AS t, ' . FORUMS_TABLE . ' AS f
         WHERE t.topic_id = ' . $active_t_row['topic_id'] . '
         AND f.forum_id = t.forum_id';
      $result = $db->sql_query($sql);
      $seo_active_t_row = $db->sql_fetchrow($result);
      if ($seo_active_t_row) {
         $active_t_row = array_merge($active_t_row, $seo_active_t_row);
      }
      // www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#
      $active_f_pct = ($userdata['user_posts']) ? ($active_f_count / $userdata['user_posts']) * 100 : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      if ( empty($phpbb_seo->seo_url['forum'][$active_f_id]) ) {
         $phpbb_seo->seo_url['forum'][$active_f_id] = $phpbb_seo->set_url($active_f_name, $active_f_id, $phpbb_seo->seo_static['forum']);
      }
      // www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#
      $active_t_pct = ($userdata['user_posts']) ? ($active_t_count / $userdata['user_posts']) * 100 : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      if (!empty($seo_active_t_row)) {
         if ( empty($phpbb_seo->seo_url['topic'][$active_t_id]) ) {
            if ($active_t_row['topic_type'] == POST_GLOBAL) {
               $phpbb_seo->seo_opt['topic_type'][$active_t_id] = POST_GLOBAL;
            }
            $phpbb_seo->seo_url['topic'][$active_t_id] = $phpbb_seo->format_url(censor_text($active_t_name));
         }
         $active_t_forum_id = (int) $active_t_row['forum_id'];
         if ( empty($phpbb_seo->seo_url['forum'][$active_t_forum_id]) ) {
            $phpbb_seo->seo_url['forum'][$active_t_forum_id] = $phpbb_seo->set_url($active_t_row['forum_name'], $active_t_forum_id, $phpbb_seo->seo_static['forum']);
         }
      }
      // www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#
      'U_ACTIVE_TOPIC'      => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id),
#
#-----[ REPLACE WITH ]------------------------------------------
#
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      'U_ACTIVE_TOPIC'      => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (!empty($active_t_forum_id) ? "f=$active_t_forum_id&amp;" : '' ) . 't=' . $active_t_id),
      // 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 ($topic_type == POST_GLOBAL) {
      $phpbb_seo->seo_opt['topic_type'][$data['topic_id']] = POST_GLOBAL;
   }
   if ( $params && empty($phpbb_seo->seo_url['topic'][$data['topic_id']]) ) {
      $phpbb_seo->seo_url['topic'][$data['topic_id']] = $phpbb_seo->format_url(censor_text($data['topic_title']));
   }
   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']);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END

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

index.php

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

      $legend .= (($legend != '') ? ', ' : '') . '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';

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

      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      if ( $phpbb_seo->seo_opt['profile_inj'] && empty($phpbb_seo->seo_url['group'][$row['group_id']]) ) {
         $phpbb_seo->seo_url['group'][$row['group_id']] = $phpbb_seo->format_url($row['group_name'], $phpbb_seo->seo_static['group']);
      }
      // www.phpBB-SEO.com SEO TOOLKIT END

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

language/en/acp/common.php

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

?>

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

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$lang = array_merge($lang, array(
   'ACP_CAT_PHPBB_SEO' => 'phpBB SEO',
   'ACP_MOD_REWRITE' => 'URL Rewriting settings',
   'ACP_PHPBB_SEO_CLASS' => 'phpBB SEO Class settings',
   'ACP_FORUM_URL' => 'Forum URL Management',
   'ACP_HTACCESS' => '.htaccess',
   'ACP_PREMOD_UPDATE' => '<h1>Release announcement</h1>
   <p>This update does only concern the premod, not the phpBB core.</p>
   <p>A new version of the phpBB SEO premod is thus available : %1$s<br/>Make sure you visit<a href="%2$s" title="The release thread"><b>the release thread</b></a> and update your installation.</p>',
   'SEO_LOG_INSTALL_PHPBB_SEO' => '<strong>phpBB SEO mod rewrite installed</strong>',
   'SEO_LOG_INSTALL_PHPBB_SEO_FAIL' => '<strong>phpBB SEO mod rewrite install attempt failed</strong>',
   'SEO_LOG_UNINSTALL_PHPBB_SEO' => '<strong>phpBB SEO mod rewrite uninstalled</strong>',
   'SEO_LOG_UNINSTALL_PHPBB_SEO_FAIL' => '<strong>phpBB SEO mod rewrite uninstall attempts failed</strong>',
   'SEO_LOG_CONFIG_SETTINGS' => '<strong>Altered phpBB SEO Class settings</strong>',
   'SEO_LOG_CONFIG_FORUM_URL' => '<strong>Altered Forum URLs</strong>',
   'SEO_LOG_CONFIG_HTACCESS' => '<strong>Generated new .htaccess</strong>',
));
// www.phpBB-SEO.com SEO TOOLKIT END

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

memberlist.php

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

      $user_id = (int) $member['user_id'];

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

      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      $phpbb_seo->set_user_url( $member['username'], $user_id );
      // www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#
      // Generate page
      $template->assign_vars(array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
      // www.phpBB-SEO.com SEO TOOLKIT BEGIN
      $seo_sep = strpos($sort_url, '?') === false ? '?' : '&amp;';
      // www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ FIND ]------------------------------------------
#
         'U_SORT_USERNAME'      => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_FROM'         => $sort_url . '&amp;sk=b&amp;sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_JOINED'         => $sort_url . '&amp;sk=c&amp;sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_POSTS'         => $sort_url . '&amp;sk=d&amp;sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_EMAIL'         => $sort_url . '&amp;sk=e&amp;sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_WEBSITE'      => $sort_url . '&amp;sk=f&amp;sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_LOCATION'      => $sort_url . '&amp;sk=b&amp;sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_ICQ'         => $sort_url . '&amp;sk=g&amp;sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_AIM'         => $sort_url . '&amp;sk=h&amp;sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_MSN'         => $sort_url . '&amp;sk=i&amp;sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_YIM'         => $sort_url . '&amp;sk=j&amp;sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_ACTIVE'         => ($auth->acl_get('u_viewonline')) ? $sort_url . '&amp;sk=l&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
         'U_SORT_RANK'         => $sort_url . '&amp;sk=m&amp;sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_LIST_CHAR'         => $sort_url . '&amp;sk=a&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),

#
#-----[ REPLACE WITH ]------------------------------------------
#
         // www.phpBB-SEO.com SEO TOOLKIT BEGIN
         'U_SORT_USERNAME'      => $sort_url . $seo_sep . 'sk=a&amp;sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_FROM'         => $sort_url . $seo_sep . 'sk=b&amp;sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_JOINED'         => $sort_url . $seo_sep . 'sk=c&amp;sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_POSTS'         => $sort_url . $seo_sep . 'sk=d&amp;sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_EMAIL'         => $sort_url . $seo_sep . 'sk=e&amp;sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_WEBSITE'      => $sort_url . $seo_sep . 'sk=f&amp;sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_LOCATION'      => $sort_url . $seo_sep . 'sk=b&amp;sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_ICQ'         => $sort_url . $seo_sep . 'sk=g&amp;sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_AIM'         => $sort_url . $seo_sep . 'sk=h&amp;sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_MSN'         => $sort_url . $seo_sep . 'sk=i&amp;sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_YIM'         => $sort_url . $seo_sep . 'sk=j&amp;sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_SORT_ACTIVE'         => ($auth->acl_get('u_viewonline')) ? $sort_url . $seo_sep . 'sk=l&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a') : '',
         'U_SORT_RANK'         => $sort_url . $seo_sep . 'sk=m&amp;sd=' . (($sort_key == 'm' && $sort_dir == 'a') ? 'd' : 'a'),
         'U_LIST_CHAR'         => $sort_url . $seo_sep . 'sk=a&amp;sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
         // www.phpBB-SEO.com SEO TOOLKIT END

#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
$user->setup('search');
#
#-----[ AFTER, ADD ]------------------------------------------
#
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$can_encode = function_exists('utf8_encode') ? true : false;
$clean_request = array('keywords', 'author', 'add_keywords');
foreach ($clean_request as $request) {
   if (!empty($_REQUEST[$request])) {
      $_REQUEST[$request] = rawurldecode($_REQUEST[$request]);
      if (!$phpbb_seo->is_utf8($_REQUEST[$request]) && $can_encode) {
         $_REQUEST[$request] = utf8_normalize_nfc(utf8_encode($_REQUEST[$request]));
      }
   }
}
// www.phpBB-SEO.com SEO TOOLKIT END
#
#-----[ FIND ]------------------------------------------
#

   $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
   $u_search .= ($search_id) ? '&amp;search_id=' . $search_id : '';
   $u_search .= ($u_hilit) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : '';
   $u_search .= ($topic_id) ? '&amp;t=' . $topic_id : '';
   $u_search .= ($author) ? '&amp;author=' . urlencode(htmlspecialchars_decode($author)) : '';
   $u_search .= ($author_id) ? '&amp;author_id=' . $author_id : '';
   $u_search .= ($u_search_forum) ? '&amp;fid%5B%5D=' . $u_search_forum : '';
   $u_search .= (!$search_child) ? '&amp;sc=0' : '';
   $u_search .= ($search_fields != 'all') ? '&amp;sf=' . $search_fields : '';
   $u_search .= ($return_chars != 300) ? '&amp;ch=' . $return_chars : '';

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

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   //$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
   $u_search = $u_sort_param . $u_show_results;
   $u_search .= ($search_id) ? '&amp;search_id=' . $search_id : '';
   $u_search .= ($u_hilit) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : '';
   $u_search .= ($topic_id) ? '&amp;t=' . $topic_id : '';
   $u_search .= ($author) ? '&amp;author=' . urlencode(htmlspecialchars_decode($author)) : '';
   $u_search .= ($author_id) ? '&amp;author_id=' . $author_id : '';
   $u_search .= ($u_search_forum) ? '&amp;fid%5B%5D=' . $u_search_forum : '';
   $u_search .= (!$search_child) ? '&amp;sc=0' : '';
   $u_search .= ($search_fields != 'all') ? '&amp;sf=' . $search_fields : '';
   $u_search .= ($return_chars != 300) ? '&amp;ch=' . $return_chars : '';
   $u_search = trim($u_search, '&amp;');
   if ( $phpbb_seo->seo_opt['rewrite_usermsg'] && (!empty($author) || !empty($author_id)) ) {
      $author_name = '';
      if (!empty($author_id)) {
         $sql = $sql = 'SELECT username
            FROM ' . USERS_TABLE . "
            WHERE user_id = $author_id
            AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
         $result = $db->sql_query($sql);
         if ($row = $db->sql_fetchrow($result)) {
            $author_name = $row['username'];
            $phpbb_seo->set_user_url( $author_name, $author_id );
         }
      }
      if (!empty($author) && (strpos($author, '*') === false) ) {
         $sql = $sql = 'SELECT user_id
            FROM ' . USERS_TABLE . "
            WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'
            AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
         $result = $db->sql_query($sql);
         if ($row = $db->sql_fetchrow($result)) {
            $phpbb_seo->set_user_url( $author, $row['user_id'] );
         }
      }
      $author = empty($author) ? $author_name : $author;
   }
   $u_search = append_sid( "{$phpbb_root_path}search.$phpEx" . (!empty($u_search) ? '?' . $u_search : '') );
   // www.phpBB-SEO.com SEO TOOLKIT END


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

         $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : ''));

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

         // 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->set_url($row['forum_name'], $u_forum_id, $phpbb_seo->seo_static['forum']);
         }
         // www.phpBB-SEO.com SEO TOOLKIT END

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

               'U_LAST_POST'         => $view_topic_url . '&amp;p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'],

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

               // www.phpBB-SEO.com SEO TOOLKIT BEGIN
               'U_LAST_POST'         => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&amp;t=$result_topic_id&amp;hilit=$u_hilit" . '&amp;p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
               // www.phpBB-SEO.com SEO TOOLKIT END

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

               'U_NEWEST_POST'         => $view_topic_url . '&amp;view=unread#unread',

#
#-----[ 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/forum_fn.js

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

function jumpto()
{
   var page = prompt(jump_page, on_page);

   if (page !== null && !isNaN(page) && page > 0)
   {
      document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((
Zapisane

Nie pomagam na priv.
Strony: [1]
  Drukuj  
 
Skocz do: