Source for file textsanitizer.php
Documentation is available at textsanitizer.php
* Zikula Application Framework
* @copyright (c) 2001, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: textsanitizer.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @subpackage Zikula_legacy
// added by sebastien, for the treatment of wiki ...
// this one is use to fake the view of the text if unfortunately there are some
// this one is supposed to return a 0 to 3 when reveiving "", "postnuke","wiki, "bbcode"
// thisone to fill $this->typeCoding with a 0, 1, 2, 3
// this is where I am stocking the value of Format_type coming from the
// end of added by sebastien, for the treatment of wiki ...
// Modified by Nathan Codding - July 20, 2000.
// Made it only work on URLs and e-mail addresses preceeded by a space, in order to stop
// The Following function was taken from the Scriplets area of http://www.phpwizard.net, and was written by Tobias Ratschiller.
// Visit phpwizard.net today, its an excellent site!
// original make_clickable
$ret = eregi_replace(" ([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", " <a href='\\1://\\2\\3' target='_blank' target='_new'>\\1://\\2\\3</a>", $text);
$ret = eregi_replace(" (([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-]))", " <a href='mailto:\\1' target='_new'>\\1</a>", $ret);
// Takes a string, and does the reverse of the PHP standard function htmlspecialchars().
// Note htmlspecialchars_decode is only available in PHP >=5.2
$string = preg_replace("/(\015\012)|(\015)|(\012)/", "<br>", $string);
$string = str_replace("<br><br><br>", "<br>", $string);
// dbescape checks the database type and escapes appropriately.
* @subpackage Zikula_legacy
// Allow no html tags for textbox data
// Smiley can be enabled/disabled for both textbox and textarea data
// Allow only the following html tags for textarea data
// <br> is not allowed since nl2br will be used when storing data
var $allowed = "<a>,<b>,<blockquote>,<img>,<code>,<div>,<em>,<i>,<li>,<ol>,<p>,<pre>,<strike>,<strong>,<sub>,<sup>,<tt>,<u>,<ul>,<image>,<hr>,%%%";
// called before saving textbox form data
$text = strip_tags($text, ''); // strip all html tags SF bug #457478
// we are preparing for a save so send to DB sanitize method
// called before displaying textbox form data
// smiley can be used if you want
// called before editting textbox form data
// called before preview of textbox form data
// smiley can be used if you want
// use makeTboxData4PreviewInForm when you want textbox data to be previewed in textbox again
// functions for filtering textarea form data
// called before saving first time data or editted textarea data
// we are preparing for a save so send to DB sanitize method
// called before displaying textarea form data
// called before editting textarea form data
// if magic_quotes_runtime is on, do stipslashes
// called before previewing textarea form data
// called before previewing textarea form data
// this time, text area data is inserted into textarea again
// if magic_quotes_gpc is on, do stipslashes
|