Changeset 1671

Show
Ignore:
Timestamp:
09/04/2007 06:36:09 PM (16 months ago)
Author:
jeena
Message:

fixed #144

Location:
trunk/scripts
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/scripts/bbcode.php

    r1669 r1671  
    1818 
    1919function do_bbcode_url ($action, $attributes, $content, $params, $node_object) { 
     20 
    2021    // URL auslesen 
    2122    $url = isset($attributes['default']) ? $attributes['default'] : $content; 
    2223     
    23     // URL validieren (Fix #137) 
     24    // URL validieren 
    2425    if($action == 'validate') { 
    25         if('javascript:' == substr($url, 0, 11)) return false; 
    26         return true; 
     26                        if (isset($params["no_js"]) AND (stripos(trim($url), "javascript:")) === 0) return false;                
     27                        return true; 
    2728    } 
    2829 
    29     // Optik bei relativen URLs verbessern 
     30    // relative in absolute URLs umwandeln 
    3031    if(!isset($attributes['default']) AND strpos($url, "/") === 0) { 
    3132      $content = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $url; 
    3233    } 
    33     return '<a href="' . htmlspecialchars($url) . '">' . htmlspecialchars($content) . '</a>'; 
     34    return '<a href="' . htmlspecialchars($url) . '">' . $content . '</a>'; 
    3435} 
    3536 
     
    120121$bbcode->setCodeFlag ('headline', 'opentag.before.newline', BBCODE_NEWLINE_DROP); 
    121122$bbcode->setCodeFlag ('headline', 'closetag.after.newline', BBCODE_NEWLINE_DROP); 
    122 # $bbcode->setCodeFlag ('html', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); 
    123123$bbcode->setCodeFlag ('html', 'opentag.before.newline', BBCODE_NEWLINE_DROP); 
    124124$bbcode->setCodeFlag ('html', 'closetag.after.newline', BBCODE_NEWLINE_DROP); 
     
    141141$bbcomments->addCode ('i', 'simple_replace', null, array ('start_tag' => '<em>', 'end_tag' => '</em>'), 
    142142                  'inline', array ('block', 'inline', 'link'), array ()); 
    143 $bbcomments->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'), 
     143$bbcomments->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default', 'no_js' => true), 
    144144                  'link', array ('block', 'inline'), array ('link')); 
    145145$bbcomments->addCode ('quote', 'simple_replace', null, array('start_tag' => '<blockquote>', 'end_tag' => '</blockquote>'), 
  • trunk/scripts/general.func.php

    r1626 r1671  
    230230} 
    231231 
     232if (!function_exists("stripos")) { 
     233  function stripos($str,$needle,$offset=0) { 
     234      return strpos( strtolower($str), strtolower($needle), $offset ); 
     235  } 
     236} 
     237 
     238if(!function_exists('str_ireplace')){ 
     239    function str_ireplace($search, $replace, $subject){ 
     240        if(is_array($search)){ 
     241            array_walk($search, create_function('&$pat, $key', '"/".preg_quote($pat, "/")."/i"')); 
     242        } 
     243        else{ 
     244            $search = '/'.preg_quote($search, '/').'/i'; 
     245        } 
     246        return preg_replace($search, $replace, $subject); 
     247    } 
     248} 
     249 
    232250// output the administration menu 
    233251function output_admin_menu() {