Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard
Author Message
takaharu
Client



Joined: Sep 25, 2003
Posts: 58

PostPosted: Thu Feb 03, 2005 6:00 am Reply with quote

This is again a phpBB mod which might be interesting for us phpnuke users. It converts the usual url into as url made of keywords based on the title you use in the post.

Is there a way to change it and use it for phpnuke ?

Here is the mod :
Code:


##############################################################
## MOD Title:         phpBB google keyword URLs 1.1.0
## MOD Author:         webmedic (bah@webmedic.net) <Brook Hyumphrey> http://www.webmedic.net
## Original code from:    http://www.webmasterbrain.com/forum/question-static-sef-urls-for-phpbb-vt34.php
## MOD Description:     This mod makes static URLs for phpBB   
##             Please read the author notes BEFORE using this mod.
##             Check http://www.webmedic.net/released-phpbb-google-keyword-urls-110-vt2577.html
##             for the latest version or to get help with this MOD
##
## MOD Version:     1.1.0
##
## Installation Level:     (Advanced)
## Installation Time:     5 Minutes
## Files To Edit:     (3)
##            page_header.php,
##            page_footer.php,
##            .htaccess
## Included Files: n/a
##############################################################   
## Author Notes:
## Use this mod together with the manage bots mod already included with integramod   
## Make backups and test this on a test forum if you can. This is not a typical mod.
## This version is not like all the other mod rewrite and search engine optimization mods
## out there. It will make your urls into keword phrases. to do this it rewrites the url
## to look like the topic or forum title.
## To see this mod in action please goto:
## http://www.webmedic.net/index.php
##
##############################################################
## MOD History:
##
##   2004-11-03 - Version 1.1.0
##    - Added replacements for /, \, and foriegn character sets.   
##
##   2004-08-22 - Version 1.0.0
##      - Initial public release.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


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

includes/page_header.php

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

$template->set_filenames(array(
    'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);

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

ob_start();


function make_url_friendly($url)
{

    $url = strtolower($url);

    $find = array(' ',
            '&',
            '\r\n',
            '\n',
            '/',
            '\\',
            '+');

    $url = str_replace ($find, '-', $url);

    $find = array(' ',
            'é',
            'è',
            'ë',
            'ê');
     
    $url = str_replace ($find, 'e', $url);
     
    $find = array(' ',
            'ó',
            'ò',
            'ô',
            'ö');
     
    $url = str_replace ($find, 'o', $url);
     
    $find = array(' ',
            'á',
            'à',
            'â',
            'ä');
     
    $url = str_replace ($find, 'a', $url);
     
    $find = array(' ',
            'í',
            'ì',
            'î',
            'ï');
     
    $url = str_replace ($find, 'i', $url);
     
    $find = array(' ',
            'ú',
            'ù',
            'û',
            'ü');
     
    $url = str_replace ($find, 'u', $url);
     
    $find = array('/[^a-z0-9\-<>]/',
            '/[\-]+/',
            '/<[^>]*>/');

    $repl = array('',
            '-',
            '');

    $url =  preg_replace ($find, $repl, $url);

    return $url;

}


function rewrite_urls($content)
{

    function if_query($amp)
    {

        if($amp != '')
        {
            return '?';
        }

    }

    $url_in = array('/(?<!\/)viewforum.php\?f=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?p=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?t=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e');

    $url_out = array("make_url_friendly('\\6') . '-vf\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
            "make_url_friendly('\\6') . '-vp\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
            "make_url_friendly('\\6') . '-vt\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'");

    $content = preg_replace($url_in, $url_out, $content);

    return $content;

}   

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

includes/page_tail.php

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

if ( $do_gzip_compress )
{
    //
    // Borrowed from php.net!
    //
    $gzip_contents = ob_get_contents();
    ob_end_clean();

    $gzip_size = strlen($gzip_contents);
    $gzip_crc = crc32($gzip_contents);

    $gzip_contents = gzcompress($gzip_contents, 9);
    $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);

    echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
    echo $gzip_contents;
    echo pack('V', $gzip_crc);
    echo pack('V', $gzip_size);
}

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

if ( $do_gzip_compress )
{
    //
    // Borrowed from php.net!
    //
    $gzip_contents = ob_get_contents();
    ob_end_clean();
    echo rewrite_urls($contents);
    global $dbg_starttime;
     
    $gzip_size = strlen($gzip_contents);
    $gzip_crc = crc32($gzip_contents);

    $gzip_contents = gzcompress($gzip_contents, 9);
    $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);

    echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
    echo $gzip_contents;
    echo pack('V', $gzip_crc);
    echo pack('V', $gzip_size);
}
else
{
    $contents = ob_get_contents();
    ob_end_clean();
    echo rewrite_urls($contents);
    global $dbg_starttime;
}

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

.htaccess

#
#-----[ ADD  ]------------------------------------------
#   

Options +FollowSymlinks

RewriteEngine On
#this may cause isues with subdirs and so I have not enabled it.
#RewriteBase /

RewriteRule [.]*-vf([0-9]*) viewforum.php?%{QUERY_STRING}&f=$1
RewriteRule [.]*-vp([0-9]*) viewtopic.php?%{QUERY_STRING}&p=$1
RewriteRule [.]*-vt([0-9]*) viewtopic.php?%{QUERY_STRING}&t=$1


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

_________________
Airsoft | Tactical supplies| Military 
View user's profile Send private message Send e-mail Visit poster's website
NukeBling
New Member
New Member



Joined: Mar 29, 2005
Posts: 7

PostPosted: Tue Mar 29, 2005 3:03 am Reply with quote

Let me know if this can be ported ;-p
 
View user's profile Send private message Visit poster's website
takaharu







PostPosted: Wed Apr 06, 2005 2:20 am Reply with quote

Nobody interested ??? Shocked
 
Hecuba
New Member
New Member



Joined: May 25, 2005
Posts: 2

PostPosted: Wed May 25, 2005 3:13 am Reply with quote

I have ported it, but i am not sure if it will work for everybody, because it seems to be kind of independant of the template of the phpbb part, but i have it working on my test server (windows) which is running on phpnuke 7.7 with the latest version of phpbb. Here are the instructions for those who wanna try:

Code:
##############################################################

## MOD Title: phpBB google keyword URLs 1.1.0
## MOD Author: webmedic (bah@webmedic.net) <Brook Hyumphrey> http://www.webmedic.net
## Original code from: http://www.webmasterbrain.com/forum/question-static-sef-urls-for-phpbb-vt34.php
## MOD Description: This mod makes static URLs for phpBB
## Please read the author notes BEFORE using this mod.
## Check http://www.webmedic.net/released-phpbb-google-keyword-urls-110-vt2577.html
## for the latest version or to get help with this MOD
##
## MOD Version: 1.1.0
##
## Installation Level: (Advanced)
## Installation Time: 5 Minutes
## Files To Edit: (3)
## page_header.php,
## page_footer.php,
## .htaccess
## Included Files: n/a
##############################################################
## Author Notes:
## Use this mod together with the manage bots mod already included with integramod
## Make backups and test this on a test forum if you can. This is not a typical mod.
## This version is not like all the other mod rewrite and search engine optimization mods
## out there. It will make your urls into keword phrases. to do this it rewrites the url
## to look like the topic or forum title.
## To see this mod in action please goto:
## http://www.webmedic.net/index.php
##
##############################################################
## MOD History:
##
## 2004-11-03 - Version 1.1.0
## - Added replacements for /, \, and foriegn character sets.
##
## 2004-08-22 - Version 1.0.0
## - Initial public release.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################


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

includes/page_header.php

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

$template->set_filenames(array(
'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
);

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

ob_start();


function make_url_friendly($url)
{

$url = strtolower($url);

$find = array(' ',
'&',
'\r\n',
'\n',
'/',
'\\',
'+');

$url = str_replace ($find, '-', $url);

$find = array(' ',
'é',
'è',
'ë',
'ê');

$url = str_replace ($find, 'e', $url);

$find = array(' ',
'ó',
'ò',
'ô',
'ö');

$url = str_replace ($find, 'o', $url);

$find = array(' ',
'á',
'à',
'â',
'ä');

$url = str_replace ($find, 'a', $url);

$find = array(' ',
'í',
'ì',
'î',
'ï');

$url = str_replace ($find, 'i', $url);

$find = array(' ',
'ú',
'ù',
'û',
'ü');

$url = str_replace ($find, 'u', $url);

$find = array('/[^a-z0-9\-<>]/',
'/[\-]+/',
'/<[^>]*>/');

$repl = array('',
'-',
'');

$url = preg_replace ($find, $repl, $url);

return $url;

}


function rewrite_urls($content)
{

function if_query($amp)
{

if($amp != '')
{
return '&';
}

}

$url_in = array('/(?<!\/)modules.php\?name=Forums&file=viewforum&f=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
'/(?<!\/)modules.php\?name=Forums&file=viewtopic.php&p=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
'/(?<!\/)modules.php\?name=Forums&file=viewtopic.php$t=([0-9]+)((&amp;)|(&)){0,1}([^>]+>)(.*?)<\/a>/e');

$url_out = array("make_url_friendly('\\6') . '-vf\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
"make_url_friendly('\\6') . '-vp\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
"make_url_friendly('\\6') . '-vt\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'");

$content = preg_replace($url_in, $url_out, $content);

return $content;

}

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

includes/page_tail.php

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

$template->pparse('overall_footer');
CloseTable();

#
#-----[ ABOVE, ADD ]------------------------------------------
#


$contents = ob_get_contents();
ob_end_clean();
echo rewrite_urls($contents);


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

.htaccess

#
#-----[ ADD ]------------------------------------------
#

Options +FollowSymlinks

RewriteEngine On
#this may cause isues with subdirs and so I have not enabled it.
#RewriteBase /

RewriteRule [.]*-vf([0-9]*) modules.php ?name=Forums&file=viewforum%{QUERY_STRING}&f=$1
RewriteRule [.]*-vp([0-9]*) modules.php ?name=Forums&file=viewtopic%{QUERY_STRING}&p=$1
RewriteRule [.]*-vt([0-9]*) modules.php ?name=Forums&file=viewtopic%{QUERY_STRING}&t=$1


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


Remove the space between modules.php? and Forums, because googletap
is making it a .html url if i didn't add the space


P.S I didn't gave it extensive testing , so i only created 1 topic with 0 replies so i do not know for sure how it handles ith multiple pages of 1 topic. Also i am not sure which mods are compatible with this one, because when i had my old site , which had TONS of phpbb nuke mods , it didn't work.

I am also looking how i can make this work for phpnuke in it's who, so you get keywords for every single module with content. But i think this is out of my league. I also reported this mod the audioslaved but seems he has dropped of the face of the earth (once again). So any help with it would be noce Smile


Hope it works for everybody, enjoy it.
 
View user's profile Send private message
takaharu







PostPosted: Thu May 26, 2005 12:05 pm Reply with quote

Hi Hecuba,

I am running a 7.5 with gt next gen and this port only rewrites the categories after i take the space out of
Quote:
modules.php ?name=Forums

If not it gives me a 500 error.

But finally we seem to be getting somewhere. Let's hope some of the php wizards here can help us a hand on this Razz
 
Hecuba







PostPosted: Thu May 26, 2005 1:47 pm Reply with quote

I haven't installed gt-nextgen (on my old site i had it and i had the same issue as you). on the test site, but i installed googletap and it works very good with that, but i have seen a article on nukecops.com ( i know i am no big fan of the site but okay) that Zhen is making an advanced googletap module which actually does the same as this mod, but then for the entire site.



P.S try removing the gt-forums.php file and all the lines that interfer with the forum in your .htaccess file and try it then (btw BACKUP FIRST Wink )
 
takaharu







PostPosted: Fri May 27, 2005 12:41 am Reply with quote

Hello Hecuba ,

I already tried to remove the rewrite lines in the old access file and deleting the GT file but that results in correct rewriting of the categories and forums and NO rewriting for the posts. They appear in php format.

Would be great to have an advanced googletap that could do this rewriting job for the whole site.
 
xamrex
New Member
New Member



Joined: Mar 02, 2009
Posts: 2

PostPosted: Mon Mar 02, 2009 2:22 pm Reply with quote

I have got this same problem
This code change only Categories @ forum, but not change Posts. ;(
 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Mar 02, 2009 3:25 pm Reply with quote

this thread is really old, try:
[ Only registered users can see links on this board! Get registered or login! ]
[ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message Visit poster's website
xamrex







PostPosted: Tue Mar 03, 2009 9:23 am Reply with quote

thx;)
U rly helped me Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©