AntiSlaed CMS
Вход
Логин: Пароль:Забыли пароль?
Запомнить вас на этом компьютере?
Войти скрытым?

Здравствуйте, Гость ( Вход | Регистрация )

> Внимание!

Адрес нашего форума изменился, теперь мы доступны по адресу antislaed.net. Обновите ссылки и закладки, он больше не изменится.


> ЧПУ для IPB
Z1dan3
сообщение Oct 29 2008, 00:15
Сообщение #1


x_X
Иконка группы

Группа: Дизайнеры

Сообщений: 633
Регистрация:
12.4.2008
Из: :( Украина :(
Пользователь №: 3,219
Спасибо сказали: 229

Вставить ник




ЧПУ Отлично работает как на 2.1, 2.2 так и на 2.3.5
Делает ссылки на страницы вашего форума статическими html
Пример:
Было
index.php?showforum=2
Стало:
forum2.html
Было:
/index.php?showtopic=2
Стало:
topic2.html

И так абсолютно со всеми ссылками на вашем форуме.
Зачем? Да просто такие ссылки поисковики любят больше. Смысл я думаю понятен

В файле sources/classes/class_display.php
Найти:
КОД
/*-------------------------------------------------------------------------*/
    //
    // Parses all the information and prints it.
    //
    /*-------------------------------------------------------------------------*/

    function do_output($output_array)
    {

Вставить выше:
КОД
//-------------------------------------------
    // Hack. Convert php to html (class display)
    //-------------------------------------------
    function do_php_to_html($buffer)
    {
        if ($this->ipsclass->vars['php_to_html'] == 1)
        {
            $forum_url = str_replace("/","\/",$this->ipsclass->vars['board_url']);
            $forum_url = str_replace(":","\:",$forum_url);
            $forum_url = str_replace(".","\.",$forum_url);
            $s_search = array("'(\?|\&|\&)s=[0-9a-zA-Z]{32}(?:\&|\&)'i",
                      "'(?:\&|\&)s=[0-9a-zA-Z]{32}'i",
                      "'\?s=[0-9a-zA-Z]{32}'i");
            $s_replace = array("\\1",
                       "",
                       "");
            $search = array("'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=idx(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=idx([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=home(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=home([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=portal(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=portal([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showforum=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showforum=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SF(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SF(?:\&|\&)f=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})(?:\&|\&)hl=([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)hl=([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SC(?:\&|\&)c=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SC(?:\&|\&)c=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?c=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?c=([0-9]{1,5})([\"\'])'i",

                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=Print(?:\&|\&)client=printer(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showuser=([0-9]{1,5})(?:\&|\&)(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showuser=([0-9]{1,5})([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=Profile(?:\&|\&)CODE=03(?:\&|\&)MID=([0-9]{1,5})([\"\'])'i",

                            "'".$forum_url."\/index\.php\?s=([\"\'])'i",
                            "'".$forum_url."\/index\.php(\?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=(\S*?)([\"\'])'i",
                            "'".$forum_url."\/index\.php\?(\S*?)([\"\'])'i");
            $replace = array($this->ipsclass->vars['board_url']."/main.html?\\1\\2",
                            $this->ipsclass->vars['board_url']."/main.html\\1",
                            $this->ipsclass->vars['board_url']."/index.html?\\1\\2",
                            $this->ipsclass->vars['board_url']."/index.html\\1",
                            $this->ipsclass->vars['board_url']."/index.html?\\1\\2",
                            $this->ipsclass->vars['board_url']."/index.html\\1",
                            $this->ipsclass->vars['board_url']."/forum\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/forum\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/forum\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/forum\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/topic\\1s\\2.html\\3",
                            $this->ipsclass->vars['board_url']."/topic\\1s\\2.html?\\3\\4",
                            $this->ipsclass->vars['board_url']."/topic\\1s\\2.html\\3",
                            $this->ipsclass->vars['board_url']."/topic\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/topic\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/topic\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/topic\\2s\\3.html?\\4\\5",
                            $this->ipsclass->vars['board_url']."/topic\\2s\\3.html\\4",
                            $this->ipsclass->vars['board_url']."/topic\\2.html?\\3\\4",
                            $this->ipsclass->vars['board_url']."/topic\\2.html\\3",
                            $this->ipsclass->vars['board_url']."/cat\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/cat\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/cat\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/cat\\1.html\\2",

                            $this->ipsclass->vars['board_url']."/ptopic\\2.html\\3",
                            $this->ipsclass->vars['board_url']."/user\\1.html?\\2\\3",
                            $this->ipsclass->vars['board_url']."/user\\1.html\\2",
                            $this->ipsclass->vars['board_url']."/user\\1.html\\2",

                            $this->ipsclass->vars['board_url']."/index.html\\1",
                            $this->ipsclass->vars['board_url']."/index.html\\1\\2",
                            $this->ipsclass->vars['board_url']."/ipb.html?act=\\1\\2",
                            $this->ipsclass->vars['board_url']."/ipb.html?\\1\\2");
            $buffer = preg_replace($s_search,$s_replace,$buffer);
            $buffer = preg_replace($search,$replace,$buffer);
        }
        return $buffer;
    }

Найти:
КОД
print $this->ipsclass->skin['_wrapper'];

Вставить выше:
КОД
$this->ipsclass->skin['_wrapper'] = $this->do_php_to_html($this->ipsclass->skin['_wrapper']);

Найти (строка встречаеться в файле 2 раза):
КОД
echo ($html);
        exit;

Вставить выше:
КОД
$html = $this->do_php_to_html($html);



В файле sources/ipsclass.php
Найти:
КОД
  /*-------------------------------------------------------------------------*/
    //
    // Redirect using HTTP commands, not a page meta tag.
    //
    /*-------------------------------------------------------------------------*/

    /**
    * HTTP redirect with out message screen
    *
    * @param    string    URL to load
    * @return    void
    * @since    2.0
    */
    function boink_it($url)
    {

Вставить выше:
КОД
//-------------------------------------------
    // Hack. Convert php to html (class FUNC)
    //-------------------------------------------
    function do_php_to_html($buffer)
    {
        if ($this->vars['php_to_html'] == 1)
        {
            $forum_url = str_replace("/","\/",$this->vars['board_url']);
            $forum_url = str_replace(":","\:",$forum_url);
            $forum_url = str_replace(".","\.",$forum_url);
            $s_search = array("'(\?|\&|\&)s=[0-9a-zA-Z]{32}(?:\&|\&)'i",
                      "'(?:\&|\&)s=[0-9a-zA-Z]{32}'i",
                      "'\?s=[0-9a-zA-Z]{32}'i");
            $s_replace = array("\\1",
                       "",
                       "");
            $search = array("'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=idx(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=idx'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=home(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=home'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=portal(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=portal'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showforum=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showforum=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SF(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SF(?:\&|\&)f=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showtopic=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)st=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=ST(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SC(?:\&|\&)c=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=SC(?:\&|\&)c=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?c=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?c=([0-9]{1,5})'i",

                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=Print(?:\&|\&)client=printer(?:\&|\&)f=([0-9]{1,5})(?:\&|\&)t=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showuser=([0-9]{1,5})(?:\&|\&)(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?showuser=([0-9]{1,5})'i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?(?:\&|\&)*?act=Profile(?:\&|\&)CODE=03(?:\&|\&)MID=([0-9]{1,5})'i",

                            "'".$forum_url."\/index\.php\?s='i",
                            "'".$forum_url."\/index\.php\?(?:s=(?:\&|\&))*?act=(\S*?)'i",
                            "'".$forum_url."\/index\.php\?(\S*?)'i",
                               "'".$forum_url."\/index\.php'i");
            $replace = array($this->vars['board_url']."/main.html?\\1",
                            $this->vars['board_url']."/main.html",
                            $this->vars['board_url']."/index.html?\\1",
                            $this->vars['board_url']."/index.html",
                            $this->vars['board_url']."/index.html?\\1",
                            $this->vars['board_url']."/index.html",
                            $this->vars['board_url']."/forum\\1.html?\\2",
                            $this->vars['board_url']."/forum\\1.html",
                            $this->vars['board_url']."/forum\\1.html?\\2",
                            $this->vars['board_url']."/forum\\1.html",
                            $this->vars['board_url']."/topic\\1s\\2.html?\\3",
                            $this->vars['board_url']."/topic\\1s\\2.html",
                            $this->vars['board_url']."/topic\\1.html?\\2",
                            $this->vars['board_url']."/topic\\1.html",
                            $this->vars['board_url']."/topic\\2s\\3.html?\\4",
                            $this->vars['board_url']."/topic\\2s\\3.html",
                            $this->vars['board_url']."/topic\\2.html?\\3",
                            $this->vars['board_url']."/topic\\2.html",
                            $this->vars['board_url']."/cat\\1.html?\\2",
                            $this->vars['board_url']."/cat\\1.html",
                            $this->vars['board_url']."/cat\\1.html?\\2",
                            $this->vars['board_url']."/cat\\1.html",

                            $this->vars['board_url']."/ptopic\\2.html",
                            $this->vars['board_url']."/user\\1.html?\\2",
                            $this->vars['board_url']."/user\\1.html",
                            $this->vars['board_url']."/user\\1.html",

                            $this->vars['board_url']."/index.html",
                            $this->vars['board_url']."/ipb.html?act=\\1",
                            $this->vars['board_url']."/ipb.html?\\1",
                            $this->vars['board_url']."/index.html");
            $buffer = preg_replace($s_search,$s_replace,$buffer);
            $buffer = preg_replace($search,$replace,$buffer);
        }
        return $buffer;
    }

Найти:
КОД
function boink_it($url)
    {

Вставить ниже:
КОД
$url = $this->do_php_to_html($url);


В файле sources/action_public/misc/print_page.php
Найти:
КОД
return $posts_html;

Вставить выше:
КОД
$posts_html = $this->ipsclass->print->do_php_to_html($posts_html);

В MySQL выполнить запрос(если у вас другой префикс таблиц то измените ibf_ на свой):
КОД
INSERT INTO `ibf_conf_settings` ( `conf_title` , `conf_description` , `conf_group` , `conf_type` , `conf_key` , `conf_value` , `conf_default` , `conf_extra` , `conf_evalphp` , `conf_protected` , `conf_position` , `conf_start_group` , `conf_end_group` , `conf_add_cache` )
SELECT 'Enable PHP to HTML conversion ?', 'Before enable this features you must right set .htaccess file.', conf_title_id, 'yes_no', 'php_to_html', '', '0', '', '', '1', '127', 'Converter Settings', '1', '1'
FROM ibf_conf_settings_titles WHERE conf_title_keyword LIKE ('general')

Создать в корне форума файл .htaccess:
КОД
RewriteEngine On
RewriteRule ^index.htm index.php?%{QUERY_STRING}
RewriteRule ^index.html index.php?%{QUERY_STRING}
RewriteRule ^main.html index.php?act=idx&%{QUERY_STRING}
RewriteRule ^ipb.html index.php?%{QUERY_STRING}
RewriteRule ^topic([0-9]+)\.html$ index.php?showtopic=$1&%{QUERY_STRING}
RewriteRule ^topic([0-9]+)s([0-9]+)\.html$ index.php?showtopic=$1&st=$2&%{QUERY_STRING}
RewriteRule ^topic([0-9]+)\.html&st=([0-9]+)$ index.php?showtopic=$1&st=$2&%{QUERY_STRING}
RewriteRule ^forum([0-9]+)\.html$ index.php?showforum=$1&%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.html$ index.php?act=SC&c=$1&%{QUERY_STRING}
RewriteRule ^ptopic([0-9]+)\.html$ index.php?act=Print&client=printer&f=1&t=$1&%{QUERY_STRING}
RewriteRule ^user([0-9]+)\.html$ index.php?showuser=$1&%{QUERY_STRING}

Включить конвертор в панели администрирования:
Tools & Settings -> General Configuration -> Converter Settings -> Enable PHP to HTML conversion ?
Для запрета индексации "ненужной" части форума добавить в robots.txt
КОД
User-Agent: *
Disallow: /ipb



Так же выкладываю оригинальный файл-инструкцию:
Прикрепленный файл  php2html.txt ( 19.27 Кб ) Кол-во загрузок: 9


Если возникли проблемы с установкой,могу поставить мод за 1-2$
Z1dan3, Вас 2 раз(а) поблагодарили за это сообщение:
ATIX, D9D9_VAD9
Перейти в начало страницы
 
     Выделите текст перед нажатием цитаты
+Цитировать сообщение



Ответить в данную темуНачать новую тему

5 чел. читают эту тему (гостей: 5, скрытых пользователей: 0)
Пользователей: 0
 

RSS Текстовая версия Сейчас: 25 November 2024 - 14:34
Хостинг предоставлен NetLevel.Ru   Eleanor CMS