// Trim a line of text to a preferred length
function trimlink($text, $length) {
$dec = array("\"", "'", "\\", '\"', "\'", "<", ">");
$enc = array(""", "'", "\", """, "'", "<", ">");
$text = str_replace($enc, $dec, $text);
if (strlen($text) > $length) $text = substr($text, 0, ($length-3))."...";
$text = str_replace($dec, $enc, $text);
return $text;
}
// Validate numeric input
function isNum($value) {
return (preg_match("/^[0-9]+$/", $value));
}
[b]//WOOYA - Validate bbcode images
function isImage($matches) {
$res = "";
if (!isNum($matches[1])) {
$img = $matches[1].str_replace(array(".php","?","&","="),"",$matches[3]).$matches[4];
$size = @getimagesize($img);
if ($size[0]) {
if (verify_image($img)) {
if ($size[0]>400) {
$y_prop = ceil($size[1]/($size[0]/400));
$res = "
".$size[0]."x".$size[1]." [".str_replace(".", "", strtoupper($matches[4]))."]
";
} else if ($size[1]>300) {
$x_prop = ceil($size[0]/($size[1]/300));
$res = "".$size[0]."x".$size[1]." [".str_replace(".", "", strtoupper($matches[4]))."]
";
} else {
$res = "
";
}
} else {
$res = "WARNING! Propably exploit image found! [$img]";
//'http://'.$_SERVER['SERVER_NAME'].FUSION_REQUEST.FUSION_QUERY;
}
} else {
$res = "[img]".$matches[1].$matches[3].$matches[4]."[/img]";
}
} else {
$img = $matches[3].str_replace(array(".php","?","&","="),"",$matches[5]).$matches[6];
$size = @getimagesize($img);
if ($size[0]) {
if (verify_image($img)) {
if ($size[0]>$matches[1]) {
if ($size[0]>400) {
$y_prop = ceil($size[1]/($size[0]/400));
$res = "".$size[0]."x".$size[1]." [".str_replace(".", "", strtoupper($matches[6]))."]
";
} else if ($size[1]>300) {
$x_prop = ceil($size[0]/($size[1]/300));
$res = "".$size[0]."x".$size[1]." [".str_replace(".", "", strtoupper($matches[6]))."]
";
} else {
$res = "".$size[0]."x".$size[1]." [".str_replace(".", "", strtoupper($matches[6]))."]
";
}
} else {
$res = "
";
}
} else {
$res = "WARNING! Propably exploit image found! [$img]";
}
} else {
$res = "[img]".$matches[1].$matches[3].$matches[4]."[/img]";
}
}
unset($size);
return $res;
}
//WOOYA - Validate bbcode images[/b]
// Parse smiley bbcode into HTML images
function parsesmileys($message) {
$smiley = array(