// **********************************************************************
// Simple > encoding
// Functions implemented by Korbo
// http://goulvench.free.fr/
// 17th of May 2005
// Comments to goulvench@gmail.com are welcome.
// **********************************************************************
// **********************************************************************
// Use this function when adding html to the base.
// unescaped < and > will be parsed,
// \< and \> will be displayed as < and >.
// Additionnally, I replace \n with
and \n\n with a new paragraph.
// Be careful when inside another block element!
// **********************************************************************
function textarea_input_filter($input) {
$input=str_replace("\r", "", $input);
$input=str_replace("\n\n", "
", $input);
$input=str_replace("\n", "
", $input);
$input = str_replace("&","&",$input);
$input=str_replace("&", "&", $input);
$input = str_replace("\<", "\<", $input);
$input = str_replace("\>", "\>", $input);
return $input;
}
/* Use this function before editing text already in the database.*/
function textarea_input_defilter($input) {
$input=str_replace("
", "\n\n", $input);
$input=str_replace("
", "\n", $input);
$input = str_replace("<", "<", $input);
$input = str_replace(">", ">", $input);
$input = str_replace("\<", "\<", $input);
$input = str_replace("\>", "\>", $input);
return $input ;
}
/* Use this function when outputting to html. */
function display_entity_encode($input) {
$input=str_replace("
\n
", "
", $input); $input = str_replace("\<", "<", $input); $input = str_replace("\>", ">", $input); return $input ; } /* A very basic function denying any code from user-input. */ function defuse_user_input($input) { $input=str_replace("&","&","$input"); $input=str_replace("<","<","$input"); $input=str_replace(">",">","$input"); return $input ; }