Project

General

Profile

« Previous | Next » 

Revision 1801

Added by Dietmar almost 12 years ago

! upgrade-script: update if filesRemove or remove dirs failed
! update methode StripCodeFromText, add remove ,
! security fixes in form modul with StripCodeFromText

View differences:

class.wb.php
664 664

  
665 665
	/**
666 666
     *
667
     * remove [[text]], link, script, scriptblock and styleblock from a given string
667
     * remove <?php code ?>, [[text]], link, script, scriptblock and styleblock from a given string
668 668
     * and return the cleaned string
669 669
	 *
670 670
	 * @param string $sValue
......
672 672
     *    false: if @param is not a string
673 673
     *    string: cleaned string
674 674
	 */
675
	public function StripCodeFromText($sValue){
675
	public function StripCodeFromText($sValue, $bPhpCode=false){
676 676
        if(!is_string($sValue)) { return false; }
677
        $sValue = ( ($bPhpCode==true) ? preg_replace ('/\[\[.*?\]\]\s*?|<\?php\s+.*\?>\s*?/isU', '', $sValue ) : $sValue );
677 678
        $sPattern = '/\[\[.*?\]\]\s*?|<!--\s+.*?-->\s*?|<(script|link|style)[^>]*\/>\s*?|<(script|link|style)[^>]*?>.*?<\/\2>\s*?|\s*$/isU';
678 679
        return (preg_replace ($sPattern, '', $sValue));
679 680
	}

Also available in: Unified diff