سؤال

Hi for the last 3 years my site has used SMF2 the time came to move away from it i wont go into detail on that but anyway Ive converted all of it to phpBB3 everything works fine until you see a quote from the old system because there are differences it fails to parse the quotes for example

[quote="MitchaP":1ru0x694][/quote:1ru0x694] is what phpBB3 would look like but smf looks like [quote="MitchaP"][/quote]

I have tried to modify the bbcode.php file with no luck here is what i have so far BTW my regex is starting level if even that :)

    $this->bbcode_cache[$bbcode_id] = array(
                    'str' => array(
                        '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id),
          '[/quote]' => $this->bbcode_tpl('quote_close', $bbcode_id)
                    ),
                    'preg' => array(
                        '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')",
          '#\[quote(?:=\"(.*?)\")?\](.+)\[/quote\]#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')"
                    )
                );
هل كانت مفيدة؟

المحلول

find in includes/bbcode.php

foreach ($bbcode_ids as $bbcode_id)
{
    switch ($bbcode_id)
    {

and replace case 0: with below

        case 0:
            if($this->bbcode_uid > 0)
            {
                $this->bbcode_cache[$bbcode_id] = array(
                    'str' => array(
                        '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id)
                    ),
                    'preg' => array(
                        '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')"
                    )
                );
            }
            else
            {
                $this->bbcode_cache[$bbcode_id] = array(
                    'str' => array(
                        '[/quote]'  => $this->bbcode_tpl('quote_close', $bbcode_id)
                    ),
                    'preg' => array(
                        '#\[quote(?:="(.*?)")?\]((?!\[quote(?:=".*?")?\]).)?#ise'   => "\$this->bbcode_second_pass_quote('\$1', '\$2')"
                    )
                );                  
            }
        break;

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top