Topic: Auto URL thingy

i get this error when i type a link and the site is correcting it


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\lanorama.org\forum\include\parser.php on line 791 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\lanorama.org\forum\include\parser.php on line 791 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\lanorama.org\forum\include\parser.php on line 791 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\lanorama.org\forum\include\parser.php on line 791 Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in E:\lanorama.org\forum\include\parser.php on line 791

Im ze dude from Sweden! :)

Re: Auto URL thingy

PHP 5.5.x ?

ForkBB
I speak only Russian  :P

3 (edited by Wikzen 2014-04-08 05:24)

Re: Auto URL thingy

PHP: 5.5.6,  is that the problem that i have a newr version of php then the forum can handle? or?

Im ze dude from Sweden! :)

Re: Auto URL thingy

...
    $pattern[] = '#\[url\]([^\[]*?)\[/url\]#e';
    $pattern[] = '#\[url=([^\[]+?)\](.*?)\[/url\]#e';
    $pattern[] = '#\[email\]([^\[]*?)\[/email\]#';
    $pattern[] = '#\[email=([^\[]+?)\](.*?)\[/email\]#';
...
    $text = preg_replace($pattern, $replace, $text);
...

http://www.php.net/manual/en/migration55.deprecated.php

It is required to update a parser code in order that it correctly worked in PHP 5.5.x
This question should be addressed to the PunBB developers wink

ForkBB
I speak only Russian  :P

Re: Auto URL thingy

Questions then, were do i edit so i can get this working? smile

Im ze dude from Sweden! :)

Re: Auto URL thingy

I have already mentioned this problem in the post: http://punbb.informer.com/forums/post/150468/#p150468

I you have a choice, I suggest to use php 5.4 or lower. And if you really must have the newest version of php, you should disable deprecate notification in you php.ini for example: error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

You may also turn them off for this particular file, by adding this line just below the hook: ($hook = get_hook('ps_start')) ? eval($hook) : null;

error_reporting(E_ALL ^ (E_DEPRECATED | E_STRICT));

If you want to contact me quickly - send e-mail, not PM.
<?php $t='<?php $t=%c%s%c; printf($t,39,$t,39,10);%c'; printf($t,39,$t,39,10);

Re: Auto URL thingy

There is no ready decision for PHP 5.5.x.
Here is how it was made for FluxBB:
Old

function do_bbcode($text, $is_signature = false)
{
    global $lang_common, $pun_user, $pun_config, $re_list;

    if (strpos($text, '[quote') !== false)
    {
        $text = preg_replace('%\[quote\]\s*%', '</p><div class="quotebox"><blockquote><div><p>', $text);
        $text = preg_replace('%\[quote=(&quot;|&\#039;|"|\'|)(.*?)\\1\]%se', '"</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'&#91;\', \'"\'), \'$2\')." ".$lang_common[\'wrote\']."</cite><blockquote><div><p>"', $text);
        $text = preg_replace('%\s*\[\/quote\]%S', '</p></div></blockquote></div><p>', $text);
    }

    if (!$is_signature)
    {
        $pattern[] = $re_list;
        $replace[] = 'handle_list_tag(\'$2\', \'$1\')';
    }

    $pattern[] = '%\[b\](.*?)\[/b\]%ms';
    $pattern[] = '%\[i\](.*?)\[/i\]%ms';
    $pattern[] = '%\[u\](.*?)\[/u\]%ms';
    $pattern[] = '%\[s\](.*?)\[/s\]%ms';
    $pattern[] = '%\[del\](.*?)\[/del\]%ms';
    $pattern[] = '%\[ins\](.*?)\[/ins\]%ms';
    $pattern[] = '%\[em\](.*?)\[/em\]%ms';
    $pattern[] = '%\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]%ms';
    $pattern[] = '%\[h\](.*?)\[/h\]%ms';

    $replace[] = '<strong>$1</strong>';
    $replace[] = '<em>$1</em>';
    $replace[] = '<span class="bbu">$1</span>';
    $replace[] = '<span class="bbs">$1</span>';
    $replace[] = '<del>$1</del>';
    $replace[] = '<ins>$1</ins>';
    $replace[] = '<em>$1</em>';
    $replace[] = '<span style="color: $1">$2</span>';
    $replace[] = '</p><h5>$1</h5><p>';

    if (($is_signature && $pun_config['p_sig_img_tag'] == '1') || (!$is_signature && $pun_config['p_message_img_tag'] == '1'))
    {
        $pattern[] = '%\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%e';
        $pattern[] = '%\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%e';
        if ($is_signature)
        {
            $replace[] = 'handle_img_tag(\'$1$3\', true)';
            $replace[] = 'handle_img_tag(\'$2$4\', true, \'$1\')';
        }
        else
        {
            $replace[] = 'handle_img_tag(\'$1$3\', false)';
            $replace[] = 'handle_img_tag(\'$2$4\', false, \'$1\')';
        }
    }

    $pattern[] = '%\[url\]([^\[]*?)\[/url\]%e';
    $pattern[] = '%\[url=([^\[]+?)\](.*?)\[/url\]%e';
    $pattern[] = '%\[email\]([^\[]*?)\[/email\]%';
    $pattern[] = '%\[email=([^\[]+?)\](.*?)\[/email\]%';
    $pattern[] = '%\[topic\]([1-9]\d*)\[/topic\]%e';
    $pattern[] = '%\[topic=([1-9]\d*)\](.*?)\[/topic\]%e';
    $pattern[] = '%\[post\]([1-9]\d*)\[/post\]%e';
    $pattern[] = '%\[post=([1-9]\d*)\](.*?)\[/post\]%e';
    $pattern[] = '%\[forum\]([1-9]\d*)\[/forum\]%e';
    $pattern[] = '%\[forum=([1-9]\d*)\](.*?)\[/forum\]%e';
    $pattern[] = '%\[user\]([1-9]\d*)\[/user\]%e';
    $pattern[] = '%\[user=([1-9]\d*)\](.*?)\[/user\]%e';

    $replace[] = 'handle_url_tag(\'$1\')';
    $replace[] = 'handle_url_tag(\'$1\', \'$2\')';
    $replace[] = '<a href="mailto:$1">$1</a>';
    $replace[] = '<a href="mailto:$1">$2</a>';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=$1\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=$1\', \'$2\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=$1#p$1\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=$1#p$1\', \'$2\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=$1\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=$1\', \'$2\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=$1\')';
    $replace[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=$1\', \'$2\')';

    // This thing takes a while! :)
    $text = preg_replace($pattern, $replace, $text);

    return $text;
}

New

function do_bbcode($text, $is_signature = false)
{
    global $lang_common, $pun_user, $pun_config, $re_list;

    if (strpos($text, '[quote') !== false)
    {
        $text = preg_replace('%\[quote\]\s*%', '</p><div class="quotebox"><blockquote><div><p>', $text);
        $text = preg_replace_callback('%\[quote=(&quot;|&\#039;|"|\'|)(.*?)\\1\]%s', create_function('$matches', 'global $lang_common; return "</p><div class=\"quotebox\"><cite>".str_replace(array(\'[\', \'\\"\'), array(\'&#91;\', \'"\'), $matches[2])." ".$lang_common[\'wrote\']."</cite><blockquote><div><p>";'), $text);
        $text = preg_replace('%\s*\[\/quote\]%S', '</p></div></blockquote></div><p>', $text);
    }
    if (!$is_signature)
    {
        $pattern_callback[] = $re_list;
        $replace_callback[] = 'handle_list_tag($matches[2], $matches[1])';
    }

    $pattern[] = '%\[b\](.*?)\[/b\]%ms';
    $pattern[] = '%\[i\](.*?)\[/i\]%ms';
    $pattern[] = '%\[u\](.*?)\[/u\]%ms';
    $pattern[] = '%\[s\](.*?)\[/s\]%ms';
    $pattern[] = '%\[del\](.*?)\[/del\]%ms';
    $pattern[] = '%\[ins\](.*?)\[/ins\]%ms';
    $pattern[] = '%\[em\](.*?)\[/em\]%ms';
    $pattern[] = '%\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]%ms';
    $pattern[] = '%\[h\](.*?)\[/h\]%ms';

    $replace[] = '<strong>$1</strong>';
    $replace[] = '<em>$1</em>';
    $replace[] = '<span class="bbu">$1</span>';
    $replace[] = '<span class="bbs">$1</span>';
    $replace[] = '<del>$1</del>';
    $replace[] = '<ins>$1</ins>';
    $replace[] = '<em>$1</em>';
    $replace[] = '<span style="color: $1">$2</span>';
    $replace[] = '</p><h5>$1</h5><p>';

    if (($is_signature && $pun_config['p_sig_img_tag'] == '1') || (!$is_signature && $pun_config['p_message_img_tag'] == '1'))
    {
        $pattern_callback[] = '%\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%';
        $pattern_callback[] = '%\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]%';
        if ($is_signature)
        {
            $replace_callback[] = 'handle_img_tag($matches[1].$matches[3], true)';
            $replace_callback[] = 'handle_img_tag($matches[2].$matches[4], true, $matches[1])';
        }
        else
        {
            $replace_callback[] = 'handle_img_tag($matches[1].$matches[3], false)';
            $replace_callback[] = 'handle_img_tag($matches[2].$matches[4], false, $matches[1])';
        }
    }

    $pattern_callback[] = '%\[url\]([^\[]*?)\[/url\]%';
    $pattern_callback[] = '%\[url=([^\[]+?)\](.*?)\[/url\]%';
    $pattern[] = '%\[email\]([^\[]*?)\[/email\]%';
    $pattern[] = '%\[email=([^\[]+?)\](.*?)\[/email\]%';
    $pattern_callback[] = '%\[topic\]([1-9]\d*)\[/topic\]%';
    $pattern_callback[] = '%\[topic=([1-9]\d*)\](.*?)\[/topic\]%';
    $pattern_callback[] = '%\[post\]([1-9]\d*)\[/post\]%';
    $pattern_callback[] = '%\[post=([1-9]\d*)\](.*?)\[/post\]%';
    $pattern_callback[] = '%\[forum\]([1-9]\d*)\[/forum\]%';
    $pattern_callback[] = '%\[forum=([1-9]\d*)\](.*?)\[/forum\]%';
    $pattern_callback[] = '%\[user\]([1-9]\d*)\[/user\]%';
    $pattern_callback[] = '%\[user=([1-9]\d*)\](.*?)\[/user\]%';

    $replace_callback[] = 'handle_url_tag($matches[1])';
    $replace_callback[] = 'handle_url_tag($matches[1], $matches[2])';
    $replace[] = '<a href="mailto:$1">$1</a>';
    $replace[] = '<a href="mailto:$1">$2</a>';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=\'.$matches[1])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=\'.$matches[1], $matches[2])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=\'.$matches[1].\'#p\'.$matches[1])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?pid=\'.$matches[1].\'#p\'.$matches[1], $matches[2])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=\'.$matches[1])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewforum.php?id=\'.$matches[1], $matches[2])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=\'.$matches[1])';
    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/profile.php?id=\'.$matches[1], $matches[2])';

    // This thing takes a while! :)
    $text = preg_replace($pattern, $replace, $text);
    $count = count($pattern_callback);
    for($i = 0 ; $i < $count ; $i++)
    {
        $text = preg_replace_callback($pattern_callback[$i], create_function('$matches', 'return '.$replace_callback[$i].';'), $text);
    }
    return $text;
}
ForkBB
I speak only Russian  :P

8 (edited by Wikzen 2014-04-08 09:16)

Re: Auto URL thingy

erhm.. ?! tongue

RSS topic feed

Posts: 1


Fatal error: Call to undefined function get_base_url() in E:\lanorama.org\forum\include\parser.php on line 796

Line 796 is:

    $replace_callback[] = 'handle_url_tag(\''.get_base_url(true).'/viewtopic.php?id=\'.$matches[1])';

http://www.lanorama.org/forum/viewtopic.php?id=2

Im ze dude from Sweden! :)

Re: Auto URL thingy

It is impossible to take the decision from FluxBB without changes!
It should be adapted for PunBB.

ForkBB
I speak only Russian  :P

10

Re: Auto URL thingy

Hmm, how to notice punbb staffs to do a update for this? hmm

Im ze dude from Sweden! :)

11

Re: Auto URL thingy

No one that can help me fix this problem? hmm

Im ze dude from Sweden! :)

12

Re: Auto URL thingy

this post http://punbb.informer.com/forums/post/151319/#p151319

ForkBB
I speak only Russian  :P

Re: Auto URL thingy

No problem, but I still think, that you should just disable these warnings in the php.ini.

patch: parser.patch
parser.php: parser.php

If you want to contact me quickly - send e-mail, not PM.
<?php $t='<?php $t=%c%s%c; printf($t,39,$t,39,10);%c'; printf($t,39,$t,39,10);

14

Re: Auto URL thingy

Have now replaced that file with the new one and still not working..

How do i disable the error in php.ini?

Im ze dude from Sweden! :)

15

Re: Auto URL thingy

Guess im not gonna be able to use this shit cuse the support is crap!

Im ze dude from Sweden! :)

Re: Auto URL thingy

Have you even read my first post in this topic? You can always ask google for error_reporting, it doesn't hurt.

You can change php.ini (read more here http://www.php.net/manual/en/errorfunc. … ration.php) or in /include/essentials.php disable deprecated warnings.

/* essentials.php line 64-67 - old version
if (defined('FORUM_DEBUG'))
    error_reporting(E_ALL);
else
    error_reporting(E_ALL ^ E_NOTICE);
*/
/* new version */
if (defined('FORUM_DEBUG'))
    error_reporting(E_ALL);
else
    error_reporting(E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT));

Of course the best solution will be to avoid php 5.5 for a while.

If you want to contact me quickly - send e-mail, not PM.
<?php $t='<?php $t=%c%s%c; printf($t,39,$t,39,10);%c'; printf($t,39,$t,39,10);

17

Re: Auto URL thingy

Sorry for beeing rude, but it sucks to have 5.5 and i dont have that exp to downgrade it in the xampp version im using for my server.

Im ze dude from Sweden! :)

18

Re: Auto URL thingy

thx alot for the support anyway.

Im ze dude from Sweden! :)

Re: Auto URL thingy

Для русскоязычных пользователей!
Эта недоработка осталась в последнем релизе,указанные выше исправления устраняют ее полностью
Итак Вам необходимо после инсталляции проделать следующее
если у Вас версия PHP 5.5 и выше для работы BB-кодов
-заменить файл parser.php (скачайте в этой ветке выше)
-заменить код в строках-64-67 файла /include/essentials.php (указано в этой ветке выше)

источник
http://punbb.informer.com/forums/topic/ … rl-thingy/
после этого все работает в норме
tongue