Ignore:
Timestamp:
07/28/08 11:07:59 (4 years ago)
Author:
root
Message:

Filter [img] tags in parsemessage() before checking for wiki links, to avoid image link corruption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/forum_functions_include.php

    r1550 r1553  
    393393// message parser, strip [code], [img] and [url] sections, parse for BBcode, smiley's, then insert the sections again 
    394394function parsemessage($msg_array) { 
    395     global $settings, $db_prefix, $codeblocks, $urlblocks, $current_message; 
     395    global $settings, $db_prefix, $codeblocks, $urlblocks, $imgblocks, $current_message; 
    396396 
    397397    // validate the parameters 
     
    409409    $imgblocks = array(); 
    410410 
    411     // convert any newlines to html <br> 
    412     $rawmsg = nl2br($rawmsg); 
    413  
    414411    // strip CODE bbcode, optionally perform Geshi color coding 
    415412    $rawmsg = preg_replace_callback('#\[code(=.*?)?\](.*?)([\r\n]*)\[/code\]#si', '_parseubb_codeblock', $rawmsg); 
     
    422419    $rawmsg = preg_replace_callback('#\[url(=.*?)\](.*?)([\r\n]*)\[/url\]#si', '_parseubb_urlblock', $rawmsg); 
    423420 
     421    // convert any newlines to html <br> 
     422    $rawmsg = nl2br($rawmsg); 
     423 
    424424    // strip IMG bbcode 
    425 //  $rawmsg = preg_replace_callback('#\[img\](.*?)([\r\n]*)\[/img\]#si', '_parseubb_imgblock', $rawmsg); 
     425    $rawmsg = preg_replace_callback('#\[img\](.*?)([\r\n]*)\[/img\]#si', '_parseubb_imgblock', $rawmsg); 
    426426 
    427427    // detect and convert wikitags to wiki bbcodes if needed 
     
    442442    // re-insert the saved img blocks 
    443443    foreach($imgblocks as $key => $imgblock) { 
    444         $rawmsg = str_replace("{*@*".$key."*@*}", $imgblock[0], $rawmsg); 
     444        $rawmsg = str_replace("{@*@".$key."@*@}", "[img]".$imgblock[0]."[/img]", $rawmsg); 
    445445    } 
    446446 
Note: See TracChangeset for help on using the changeset viewer.