Changeset 1647 in ExiteCMS for trunk/includes/core_functions.php


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

fixed incorrectly parsing [img] tags

File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.