BBCode not parsed / uid / checksum problem ?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Suggested Hosts
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
Letus2001
Registered User
Posts: 22
Joined: Thu Nov 04, 2004 8:22 pm

BBCode not parsed / uid / checksum problem ?

Post by Letus2001 » Fri Mar 21, 2008 8:34 am

Hi,
based on this posts

http://www.phpbb.com/community/viewtopi ... &start=285

i've created the modification to allow displaying of TABLE MOD from older 2.0 version of phpbb in 3.0.

With new topics, it work just fine, or if I take the post, edit it and save it, but as my forum has been already migrated, i still have "old code" in my posts. I used the function to do "on fly" replacement


Code: Select all

/**
* Convert the Table BBCode MOD to a more phpBB3 friendly format
* (c) MMVIII by TerraFrost (http://www.frostjedi.com/terra/)
*/
function table_callback($long_tag)
{
   static $stack = array();
   static $subtag = array('mrow' => 'mcol', 'row' => 'col');

   preg_match('#^\[(/?\w+)#', $long_tag, $matches);
   $short_tag = $matches[1];

   switch ($short_tag)
   {
      case 'mrow':
      case 'row':
         $temp = '';
         while (count($stack))
         {
            $top = array_pop($stack);
            $temp.= '[/' . $top . ']';
         }
         $stack[] = $short_tag;

         $stack[] = $subtag[$short_tag];
         return $temp . $long_tag . '[' . $subtag[$short_tag] . ']';
      case 'mcol':
      case 'col':
         $top = array_pop($stack);

         $stack[] = $short_tag;
         return '[/' . $short_tag . ']' . $long_tag;
      case '/table':
         $temp = '';
         while (count($stack))
         {
            $top = array_pop($stack);
            $temp.= '[/' . $top . ']';
         }
         return $temp . '[/table]';
   }
}


      $message = preg_replace(
         '#(\[(?:mrow|mcol|row|col(?!or)|/table)[^\]]*\])#e',
         "table_callback(str_replace('\\\"','\"','$1'))",
         $message
      );
so the output is fully ok and should be converted to HTML table. But, is not. Whatever I try, wherever i place this code (in second_pass parsing function, or viewtopic or any other page), the output is correct, but all tags remains as BBCode, do not turn into HTML. I tried to do tags with UID, or without it (like [table] or [table:asdfa1s]), no change. If i take the code generated with this function, go to EDIT topic, i just resave it, with the very same content, it works. So what am I doing wrong ? Do I need to update the checksum of the post, or the bbcode_bitfield, or something else, so my post_text modified during the run of the page get parsed and changed from BB to HTML ?

Locked

Return to “[3.0.x] Support Forum”