UWAGA: Pojawiła się nowa wersja systemu - phpBB 3.3.19. Ostatnie wydania (od wersji 3.3.17 do najnowszej) przynoszą kluczowe poprawki, które chronią Twoje forum przed zagrożeniami i dbają o spokój Twojej społeczności. Polecam nie odkładać tego na później, tyllko zaktualizować fora!

Polski pakiet językowy dla phpBB 3.3.19

Hack, który skraca adresy

Jeżeli masz pomysł na jakąś modyfikację bądź poszukujesz jakiegoś moda to zerknij do tego działu.
Lee
Posty: 29
Rejestracja: 22 maja 2005, 09:54
Lokalizacja: Co Skąd ?
Kontakt:

Hack, który skraca adresy

Post autor: Lee » 21 marca 2006, 21:42

Na niektórych forach opartych o phpBB widzę, że adresy do poszczególnych działów to nie np. posting.php?mode=newtopic&f=10&sid=8b829b7ca3f921661437aada4b7ad2b5 tylko
jakas-tam-nazwa.html i własnie poszukuje takiego hacka, który konwertuje te długie adresy na te w formie .html

Sorry, ale nie wiedziałem jak zabrać się za wyszukiwarke - co wpisać, żeby znaleźć to co szukam :roll:

Awatar użytkownika
HARNAŚ
Posty: 133
Rejestracja: 15 maja 2005, 10:20
Lokalizacja: Kalisz
Kontakt:

Post autor: HARNAŚ » 22 marca 2006, 01:19

Kod: Zaznacz cały

##############################################################
## 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/indeks.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(' ',
            'é',
            '&egrave;',
            'ë',
            '&ecirc;');
   
    $url = str_replace ($find, 'e', $url);
   
    $find = array(' ',
            'ó',
            '&ograve;',
            'ô',
            'ö');
   
    $url = str_replace ($find, 'o', $url);
   
    $find = array(' ',
            'á',
            '&agrave;',
            'â',
            'ä');
   
    $url = str_replace ($find, 'a', $url);
   
    $find = array(' ',
            'í',
            '&igrave;',
            'î',
            '&iuml;');
   
    $url = str_replace ($find, 'i', $url);
   
    $find = array(' ',
            'ú',
            '&ugrave;',
            '&ucirc;',
            'ü');
   
    $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]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?p=([0-9]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?t=([0-9]+)((&)|(&)){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 ]------------------------------------------
# 

Blak
Posty: 26
Rejestracja: 20 marca 2006, 14:56
Lokalizacja: Kraków
Kontakt:

Post autor: Blak » 22 marca 2006, 06:51

No i małe tłumaczenie co trza robić. Przyda sie osobą które nie mogą sobie z takimi żeczami poradzić:

Kod: Zaznacz cały

##############################################################
## 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/indeks.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
##############################################################


#
#-----[ Otwórz ]------------------------------------------
#

includes/page_header.php

#
#-----[ Znajdź ]------------------------------------------
#

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

#
#-----[ Dodaj po  ]------------------------------------------
#

ob_start();


function make_url_friendly($url)
{

    $url = strtolower($url);

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

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

    $find = array(' ',
            'é',
            '&egrave;',
            'ë',
            '&ecirc;');
   
    $url = str_replace ($find, 'e', $url);
   
    $find = array(' ',
            'ó',
            '&ograve;',
            'ô',
            'ö');
   
    $url = str_replace ($find, 'o', $url);
   
    $find = array(' ',
            'á',
            '&agrave;',
            'â',
            'ä');
   
    $url = str_replace ($find, 'a', $url);
   
    $find = array(' ',
            'í',
            '&igrave;',
            'î',
            '&iuml;');
   
    $url = str_replace ($find, 'i', $url);
   
    $find = array(' ',
            'ú',
            '&ugrave;',
            '&ucirc;',
            'ü');
   
    $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]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?p=([0-9]+)((&)|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
            '/(?<!\/)viewtopic.php\?t=([0-9]+)((&)|(&)){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;

}

#
#-----[ Otwórz ]------------------------------------------
#

includes/page_tail.php

#
#-----[ Szukaj ]------------------------------------------
#

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);
}

#
#-----[ Zamień na ]------------------------------------------
#

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;
}

#
#-----[ Otwórz ]------------------------------------------
#

.htaccess

#
#-----[ Dodaj  ]------------------------------------------
#

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


#
#-----[ Zapisz i zamknij wszystkie pliki  ]------------------------------------------
#

Awatar użytkownika
NoVi
Posty: 151
Rejestracja: 16 maja 2005, 14:56
Lokalizacja: Czeladź
Kontakt:

Post autor: NoVi » 25 marca 2006, 20:59

a czy dąło by się przerobić tego hacka żeby zmieniał jeszcze linki do profilów? na np.

http://www.adresforum.pl/m@teo.htm ??


?

jaroslw
Zasłużony
Posty: 4524
Rejestracja: 10 grudnia 2005, 18:48
Kontakt:

Post autor: jaroslw » 25 marca 2006, 21:14

m@teo,

Tego hacka ściągniesz z http://www.phpbb2.pl/download.php?d=480 :)
Pobierz styl: we_universal • we_clearblue
Nowości i aktualizacje: Facebook • Google+ • Twitter

Zablokowany

Wróć do „Propozycje i Poszukiwania”