PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
takaharu
Client


Joined: Sep 25, 2003
Posts: 58

PostPosted: Thu Feb 03, 2005 7:00 am Reply with quote Back to top

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 ]------------------------------------------
#
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 4:03 am Reply with quote Back to top

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


Joined: Sep 25, 2003
Posts: 58

PostPosted: Wed Apr 06, 2005 3:20 am Reply with quote Back to top

Nobody interested ??? Shocked
View user's profile Send private message Send e-mail Visit poster's website
Hecuba
New Member
New Member


Joined: May 25, 2005
Posts: 2

PostPosted: Wed May 25, 2005 4:13 am Reply with quote Back to top

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
Client


Joined: Sep 25, 2003
Posts: 58

PostPosted: Thu May 26, 2005 1:05 pm Reply with quote Back to top

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
View user's profile Send private message Send e-mail Visit poster's website
Hecuba
New Member
New Member


Joined: May 25, 2005
Posts: 2

PostPosted: Thu May 26, 2005 2:47 pm Reply with quote Back to top

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 )
View user's profile Send private message
takaharu
Client


Joined: Sep 25, 2003
Posts: 58

PostPosted: Fri May 27, 2005 1:41 am Reply with quote Back to top

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.
View user's profile Send private message Send e-mail Visit poster's website
xamrex
New Member
New Member


Joined: Mar 02, 2009
Posts: 2

PostPosted: Mon Mar 02, 2009 3:22 pm Reply with quote Back to top

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


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

PostPosted: Mon Mar 02, 2009 4:25 pm Reply with quote Back to top

this thread is really old, try:
Only registered users can see links on this board!
Get registered or login to the forums!

Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
xamrex
New Member
New Member


Joined: Mar 02, 2009
Posts: 2

PostPosted: Tue Mar 03, 2009 10:23 am Reply with quote Back to top

thx;)
U rly helped me Smile
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2009 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum