head 1.1;
access;
symbols;
locks
yatesce:1.1; strict;
comment @# @;
1.1
date 2003.04.14.01.01.46; author yatesce; state Exp;
branches;
next ;
desc
@Original
@
1.1
log
@Initial revision
@
text
@
A Weblog With Comments - Show Comments
\\1 ");
return nl2br(preg_replace($searcharray, $replacearray, stripslashes($text) ));
}
function CheckForClosingTag($tag, $str)
{
$count = substr_count( $str, "<$tag>" );
if( $count != substr_count( $str, "$tag>" ) )
return FALSE;
return TRUE;
}
function breakLongWords( $str )
{
list ($words) = array (split (" ", $str));
$str = '';
foreach ($words as $c => $word)
{
if (strlen ($word) > 45 and !ereg("^href=", $word) and !ereg ("[\[|\]|\/\/]", $word))
$word = chunk_split ($word, 45, " ");
if ($c)
$str .= ' ';
$str .= $word;
}
return $str;
}
function StripHTML($str, $encode)
{
$str = stripslashes( $str );
// make allowed tags upper case
$search = array( "''", "''", "''", "''", "''", "''" );
$replace = array( "", "", "", "", "", "" );
$str = preg_replace( $search, $replace, $str );
// remove dodgy HTML tags
$allowed = "";
if( CheckForClosingTag( "b", $str ) == TRUE )
$allowed .= "";
if( CheckForClosingTag( "u", $str ) == TRUE )
$allowed .= "";
if( CheckForClosingTag( "i", $str ) == TRUE )
$allowed .= "";
$str = strip_tags( $str, $allowed );
// replace all lines with paragraphs
$str = str_replace("\n", "
", $str);
$str = str_replace("\r", "", $str);
if( $encode == true )
$str = HTMLEncode( $str );
else
$str = breakLongWords( $str );
return addslashes( $str );
}
function StripHTMLSimple($str)
{
// add spaces to very long strings
list ($words) = array (split (" ", $str));
$str = '';
foreach ($words as $c => $word)
{
if (strlen ($word) > 45 and !ereg ("[\[|\]|\/\/]", $word))
$word = chunk_split ($word, 45, " ");
if ($c)
$str .= ' ';
$str .= $word;
}
// replace all tags with the appropriate characters
$str = str_replace("<", "<", $str);
$str = str_replace(">", ">", $str);
// replace all lines with spaces
$str = str_replace("\n", " ", $str);
$str = str_replace("\r", "", $str);
return $str;
}
function ShowErrorPage()
{
?>
I do apologise, but an error has occured.
$line[6]\n";
if( strlen($line[5]) > 0 )
{
if( stristr( $line[5], "http://" ) == FALSE )
$url = "http://" . $line[5];
else
$url = $line[5];
print "Posted by $line[3] @@ $line[8]
\n";
}
else
print "Posted by $line[3] @@ $line[8]
\n";
print "
\n";
$count = $count + 1;
}
if( $count == 0 )
{
?>
Source for comments provided by John Conners
Go on, you know you want to...
Be nice now and leave a comment:
@