Mod Name / Version: Post Image Limit v1.0.0<br /><br />
Description: This trivial mod allows you to control number of images users put in their posts. All images are counted: graemlins, image code tags and html <img src> tag. <br /><br />
Working Under: UBB.Threads 6.4 <br /><br />
Mod Status: Finished <br /><br />
Any pre-requisites: None. <br /><br />
Author(s): PaNTerSan <br /><br />
Date: 06/11/04 <br /><br />
Credits: Astaran for guidance <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /> <br /><br />
Files Altered: config.inc.php, ubbt.inc.php <br /><br />
New Files: None. <br /><br />
Database Altered: NO <br /><br />
Info/Instructions: See below.<br /> <br /><br />
Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /><br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files. <br /><br />My notes:<br />[*]When using my instructions, use some board that supports ubbCode and make copy&paste instructions to a post - then use magic: preview <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /><br /><br /><br /><br />Feature suggestions & improvements:<br />[*]None.<br /><br /><br /><br />
History<br /> 2004.06.11 PaNTerSan - 1.0.0 Original coding started<br /><br /><br /><br />
Installation Steps<br /><br /><br />______________________________________________________________________________<br />[:"purple"]
Code changes [/] <br /><br />[*][:"green"]
File[/]<br />config.inc.php<br /><br />[:"red"]
At the end add[/]<br />
<br />$config['maxImages'] = '5'; // maximum number of immages in a post<br />
<br />Set value to your desires <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /><br /><br />[*][:"green"]
File[/]<br />ubbt.inc.php<br /><br />[:"blue"]
Find in do_markup[/] <br />
<br /> $Body = preg_replace("/(\[IMG\]|\[{$ubbt_lang['TEXT_IMAGE']}\])http([^\[]*)\.(gif|jpg|png)(\[\/IMG\]|\[\/{$ubbt_lang['TEXT_IMAGE']}\])/i", "<img src=\"http\\2.\\3\">", $Body); <br /><br /> <br />[:"red"]
Replace with[/]<br />
<br /> $Body = preg_replace("/(\[IMG\]|\[{$ubbt_lang['TEXT_IMAGE']}\])http([^\[]*)\.(gif|jpg|png)(\[\/IMG\]|\[\/{$ubbt_lang['TEXT_IMAGE']}\])/i", "<img src=\"http\\2.\\3\">", $Body); <br /> <br /> $images = preg_match_all("/img src/", $Body, $out, PREG_SET_ORDER);<br /> if ( $config['maxImages'] < $images ){<br /> $msg = "You can only have {$config['maxImages']} images in your post";<br /> $this->not_right($msg, $Cat);<br /> }<br /><br />Note: I am also using Astaran's signature restriction <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" /><br /><br />[*]End Code changes