Changeset 1647 in ExiteCMS


Ignore:
Timestamp:
08/17/08 14:48:04 (3 years ago)
Author:
hverton
Message:

fixed incorrectly parsing [img] tags

Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core_functions.php

    r1645 r1647  
    374374 
    375375// validate an URL 
    376 function isURL($value, $onlyhttp=false) { 
     376function isURL($value, $onlyhttp=false, $schemereq=false) { 
    377377 
    378378    // Build the regex to check the URL 
     
    382382        $scheme = "(https?|s?ftp|mailto|svn|cvs|callto|mms|skype)\:\/\/";       // ALL SCHEMES supported 
    383383    } 
    384     $urlregex = "^(".$scheme.")?";                                              // make the scheme optional 
     384    if ($schemereq) { 
     385        $urlregex = "^(".$scheme.")";                                           // scheme 
     386    } else { 
     387        $urlregex = "^(".$scheme.")?";                                          // scheme (optional) 
     388    } 
    385389    $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)?";   // USERID + PASSWORD (optional) 
    386390    $urlregex .= "[a-z0-9+\$_-]+(\.[a-z0-9+\$_-]+)*";                           // HOSTNAME or IP 
     
    711715function verify_image($file) { 
    712716    $image_safe = true; 
    713     if (file_exists($file)) { 
     717    if (isURL($file, false, true) || file_exists($file)) { 
    714718        $er = error_reporting(0); 
    715719        // get info about the image 
  • trunk/includes/forum_functions_include.php

    r1598 r1647  
    447447    $rawmsg = preg_replace_callback('#\[url(=.*?)\](.*?)([\r\n]*)\[/url\]#si', '_parseubb_urlblock', $rawmsg); 
    448448 
     449    // strip IMG bbcode 
     450    $rawmsg = preg_replace_callback('#\[img\](.*?)([\r\n]*)\[/img\]#si', '_parseubb_imgblock', $rawmsg); 
     451 
    449452    // find other URL's in the text, strip them and add them to $urlblocks for conversion to [URL] bbcodes 
    450453    $rawmsg = preg_replace_callback('#(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)?((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|(localhost)|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)?(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&%\$\#\:\*\=~_\-@]*)*#si', '_parseubb_texturls', $rawmsg); 
     
    452455    // convert any newlines to html <br> 
    453456    $rawmsg = nl2br($rawmsg); 
    454  
    455     // strip IMG bbcode 
    456     $rawmsg = preg_replace_callback('#\[img\](.*?)([\r\n]*)\[/img\]#si', '_parseubb_imgblock', $rawmsg); 
    457457 
    458458    // detect and convert wikitags to wiki bbcodes if needed 
Note: See TracChangeset for help on using the changeset viewer.