Installations : Modules : FCK Editor Page(s): 2/3
Modification du Mainfile.php
9) Editez le fichier "mainfile.php" qui se trouve à la racine de votre site
10) Trouvez ce code :
| Code: |
function check_html ($str, $strip="") {
/* The core of this code has been lifted from phpslash */
/* which is licenced under the GPL. */
include("config.php");
if ($strip == "nohtml") $AllowableHTML = array('');
$str = eregi_replace("<[:space:]*([^>]*)[:space:]*>",'<1>', $str);
// Delete all spaces from html tags .
// Delete all attribs from Anchor, except an href, double quoted.
$str = eregi_replace("<[:space:]* img[:space:]*([^>]*)[:space:]*>", '', $str);
// Delete all img tags
$str = eregi_replace("<a[^>]*href[:space:]*=[:space:]*"?javascript[:punct:]*"?[^>]*>", '', $str);
// Delete javascript code from a href tags -- Zhen-Xjell @ http://nukecops.com
$tmp = "";
while (ereg("<(/?[:alpha:]*)[:space:]*([^>]*)>",$str,$reg)) {
$i = strpos($str,$reg[0]);
$l = strlen($reg[0]);
if ($reg[1][0] == "/") $tag = strtolower(substr($reg[1],1));
else $tag = strtolower($reg[1]);
if ($a = (isset($AllowableHTML[$tag])) ? $AllowableHTML[$tag] : 0)
if ($reg[1][0] == "/") $tag = "</$tag>";
elseif (($a == 1) || (empty($reg[2]))) $tag = "<$tag>";
else {
# Place here the double quote fix function.
$attrb_list=delQuotes($reg[2]);
// A VER
$attrb_list = str_replace("&","&",$attrb_list);
$attrb_list = str_replace("&","&",$attrb_list);
$tag = "<$tag" . $attrb_list . ">";
} # Attribs in tag allowed
else $tag = "";
$tmp .= substr($str,0,$i) . $tag;
$str = substr($str,$i+$l);
}
$str = $tmp . $str;
$str = str_replace("<br>", "<br />", $str);
return $str;
exit;
/* Squash PHP tags unconditionally */
$str = str_replace("<@@@?","",$str);
return $str;
} |
11) Remplacez le par celui-ci :
| Code: |
function check_html ($string, $allowed_html = "", $allowed_protocols = array('http', 'https', 'ftp', 'news', 'nntp', 'gopher', 'mailto'))
{
$stop = FALSE;
if(!function_exists(kses_no_null))
{
@include_once(INCLUDE_PATH."includes/kses/kses.php");
}
if (get_magic_quotes_gpc() == 1 )
{
$string = stripslashes($string );
}
$hotHtml = "nohtml";
$Zstrip = stripos_clone($allowed_html, $hotHtml);
if ($Zstrip === false)
{
global $AllowableHTML;
$allowed_html = $AllowableHTML;
} else {
$allowed_html = array('<null>');
}
$string = kses_no_null($string);
$string = kses_js_entities($string);
$string = kses_normalize_entities($string);
$string = kses_hook($string);
$allowed_html_fixed = kses_array_lc($allowed_html);
return kses_split($string, $allowed_html_fixed, $allowed_protocols);
}
function wysiwyg_textarea($name, $value, $config = "NukeUser", $cols = 50, $rows = 10)
{
global $advanced_editor;
# Don't waste bandwidth by loading WYSIWYG editor for crawlers
if ($advanced_editor == 0 or !isset($_COOKIE))
{
echo "<textarea name="$name" cols="$cols" rows="$rows">$value</textarea>";
} else {
@include_once(INCLUDE_PATH."includes/FCKeditor/fckeditor.php");
$oFCKeditor = new FCKeditor($name) ;
$oFCKheight = $rows * 20;
$oFCKeditor->Height = "$oFCKheight";
$oFCKeditor->ToolbarSet = "$config" ;
$oFCKeditor->InstanceName = "$name" ;
$oFCKeditor->Value = "$value" ;
$oFCKeditor->Create() ;
}
}
function wysiwyg_textarea_html($name, $value, $config = "NukeUser", $cols = 50, $rows = 10)
{
global $advanced_editor;
# Don't waste bandwidth by loading WYSIWYG editor for crawlers
if ($advanced_editor == 0 or !isset($_COOKIE))
{
echo "<textarea name="$name" cols="$cols" rows="$rows">$value</textarea>";
} else {
@include_once(INCLUDE_PATH."includes/FCKeditor/fckeditor.php");
$oFCKeditor = new FCKeditor($name) ;
$oFCKheight = $rows * 20;
$oFCKeditor->Height = "$oFCKheight";
$oFCKeditor->ToolbarSet = "$config" ;
$oFCKeditor->InstanceName = "$name" ;
$oFCKeditor->Value = "$value" ;
$wysiwygHTML = $oFCKeditor->CreateHtml() ;
return $wysiwygHTML;
}
} |
12) Sauvegardez, fermez et uploadez le fichier sur votre serveur
Passez à l'étape suivante
Page précédente (1/3) - Page suivante (3/3) 
Publié le : 2007-07-26 par stefvar, dernière modification le : 2007-08-15 par eddy(353 lectures)
|