Thread: config.php help
View Single Post
  #2 (permalink)  
Old 12-29-2006, 09:37 AM
killerbee killerbee is offline
Member
 
Join Date: Nov 2004
Location: UK Derby
Posts: 481
Send a message via MSN to killerbee
Re: config.php help
Originally Posted by krimax
I want to be able to paste YouTube video and link of pics from other site.

Actually i would like to enable ALL HTML

thats what I got right now

$AllowableHTML = array("b"=>1,"i"=>1,"strike"=>1,"div"=>2,"u"=>1,"a "=>2,"em"=>1,"br"=>1,"strong"=>1,"blockquote"=>1," tt"=>1,"li"=>1,"ol"=>1,"ul"=>1);


what else do I need?
Try this

Code:
$AllowableHTML = array("b"=>1,
                    "i"=>1,
                    "a"=>2,
                    "em"=>1,
                    "br"=>1,
                    "strong"=>1,
                    "blockquote"=>1,
                    "tt"=>1,
                    "li"=>1,
                    "ol"=>1,
                    "H1"=>1,
                    "H2"=>1,
                    "H3"=>1,
                    "H4"=>1,
                    "center"=>1,
                    "img"=>2,
                    "alt"=>1,
                    "table"=>2,
                    "tr"=>2,
                    "td"=>2,
                    "p"=>2,
                    "div"=>2,
                    "font"=>2,
                    "p"=>1,
                    "p"=>1,
                    "ul"=>1);
The meaning of "1" and "2" is whether the tag accepts attributes or not. For example, if you want the

tag to NOT accept attributes (i.e. you accept

but you don't accept

) the you put "1", otherwise (i.e., if attributes like "align" etc. are accepted) you put "2". That this is indeed so, can be seen from the check_html() function of mainfile.php

Code:
if ($a = $AllowableHTML[$tag])
                        if ($reg[1][0] == "/") $tag = "</tag>";
                        elseif (($a == 1) || ($reg[2] == "")) $tag = "<tag>";
                        else {
                          # Place here the double quote fix function.
                          $attrb_list=delQuotes($reg[2]);
                          // A VER
                          $attrb_list = ereg_replace("&","&amp;",$attrb_list);
                          $tag = "<tag>";
                        } # Attribs in tag allowed
                else $tag = "";
The code checks if the associated value to the given tag ($tag) in the $AllowableHTML array is "1" or empty. If this is the case, the value of $tag is only "<tag>". Otherwise a set of replacements takes place on the attribute list:

The delQuotes() function deletes duplicate space and adds escaped quotes around each attribute value.

The ereg_replace() function replaces the ampersand (&) with its HTML entity "&amp;".

If the tag is not in the $AllowableHTML array, the line in the code above shows that it is replaced by the empty string, i.e. it is not echoed at all. Thus, if there is an HTML tag that you are missing, you should enter it in the $AllowableHTML array and take care to enter correctly a "1" or a "2" according to your needs


Peace Killerbee
__________________
www.MoWarez.com
Reply With Quote