Hack Title: Restrict images in posts
Hack Version: 0.3.0
Nu kwam ik ervandaag achter dat als je gewoon html gebruikt
<img src="een_link.jpg">
Dat hij dan niet ingrijpt hoe kan ik dat veranderen?
Code: Selecteer alles
#
#-----[ OPEN ]--------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]--------------------------------------------
#
// Check message
if (!empty($message))
{
#
#-----[ AFTER, ADD ]--------------------------------------
#
if( preg_match_all("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie", $message, $matches) )
{
if( count($matches[0]) > $board_config['images_max_limit'] )
{
$l_too_many_images = ( $board_config['images_max_limit'] == 1 ) ? sprintf($lang['Too_many_image'], $board_config['images_max_limit']) : sprintf($lang['Too_many_images'], $board_config['images_max_limit']);
$error_msg .= (!empty($error_msg)) ? '<br />' . $l_too_many_images : $l_too_many_images;
}
else
{
for( $i = 0; $i < count($matches[0]); $i++ )
{
$image = preg_replace("#\[img\](.*)\[/img\]#si", "\\1", $matches[0][$i]);
list($width, $height) = @getimagesize($image);
if( $width > $board_config['images_max_width'] || $height > $board_config['images_max_height'] )
{
$l_image_too_large = sprintf($lang['Image_too_large'], $board_config['images_max_width'], $board_config['images_max_height']);
$error_msg .= (!empty($error_msg)) ? '<br />' . $l_image_too_large : $l_image_too_large;
break;
}
}
}
}