Mod Name / Version: Restrict signatures <br /> <br />Description: This hack allows the administrators to restrict the users' signatures via the admin panel. <br />Possible restrictions: <br />- maximum height/width of an image <br />- number of images <br />- max. filesize of the images <br />- max. number of linebreaks <br /> <br />Working Under: UBB.Threads 6.3-6.4 <br /> <br />Mod Status: Finished <br /> <br />Any pre-requisites: none <br /> <br />Author(s): Astaran <br /> <br />Date: 02/09/04 <br /> <br />Credits: My moderators who requested it <br /> <br />Files Altered: changebasic.php, ubbt.inc.php, config.inc.php <br /> <br />New Files: none <br /> <br />Database Altered: no <br /> <br />Info/Instructions: <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.
Registered: 03/01/01
Posts: 652
Loc: West Fargo, ND USA
Awesome! A must have! No more HUUUUGE sig images on my forums. muahaha <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /><br /><br />Tossing this on my todo list, thanks Astaran! <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />
[]DLWebmaestro said:<br />Has this just plain not worked for anyone? I tested it by entered a sig with a bunch of line breaks, but it allows it. [/]<br /><br />You're right. I fixed it and updated the instructions.<br />Only this row changed:<br /><br /> $sigLines = preg_match_all("/\\n/",$Signature, $outLines);
Great mod!<br /><br />Now all I need to do is write a script to check all the existing ones! <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" />
Attached you'll find a script that checks all signatures if they match to your rules defined in the config file. <br />If the signature don't fit to the rules, the signature is deleted. Additionally, the user receives an PM with his old signature so that he can changed and reapply it. <br /> <br />Note: Change the Body of the private message and make a Backup of your database first! <br />Rename the attachement to .php and upload it to you ubbthreads main dir. Delete it after execution.
<img src="http://www.ubbdev.com/forum/images/graemlins/yay.gif" alt="" /> It works now! <img src="http://www.ubbdev.com/forum/images/graemlins/grin.gif" alt="" /> But where is that attached script you were talking about?
My fault, I didn't add that to the instructions.<br />Just add this function to your ubbt.inc.php (I updated the instructions to reflect this):<br /><br />function remoteFileSize($remote_file)<br />{<br /> $file = file_get_contents($remote_file);<br /> <br /> return strlen($file);<br />}<br /><br />[]<br />Also, I'm getting some $imageUrl errors, its creating:<br /><br />http://http://www.viperalley [/]<br />Mhh, I just use the standard regexp. Maybe the user entered it that way?
_________________________
Running a community? -> Keep informed and take it to the next level
Yes, anyone who is using an older version can use this to make it compatible:<br /><br />if (!function_exists("file_get_contents")) {<br /> function file_get_contents($filename, $use_include_path = 0) {<br /> $data = FALSE;<br /> $file = fopen($filename, "rb", $use_include_path);<br /> if ($file) {<br /> while (!feof($file)) $data .= fread($file, 1024);<br /> fclose($file);<br /> }<br /> return $data;<br /> }<br />}
_________________________
Running a community? -> Keep informed and take it to the next level
Interesting and a well needed mod! However, it's not working on my site after the applied changes. <br /> <br />I've gone in and created some huge signature images and they are still showing after the mod, changing the height and width, and making a new registered member with it. <br /> <br />Here's what I changed the fields to and it's still allowing huge sigs: <br /> <br />$config['sigMaxImages'] = '1'; <br />$config['sigImageHeight'] = '150'; <br />$config['sigImageWidth'] = '400'; <br />$config['sigImageSize'] = '55000'; <br />$config['sigMaxLines'] = '10';
[]Astaran said:<br />Any error messages?<br />What php version are you using? [/]<br /><br />No, not picking up on visible errors...<br /><br />I'm running PHP version 4.3.3.
Hi all,<br />I'm not too familar with php yet (I'm still stuck in the perl days <img src="http://www.ubbdev.com/forum/images/graemlins/mryuck.gif" alt="" /> )but a user reported the following error and it is able to be reproduced by attempting to change the basic profile.<br />
Code:
<br />Fatal error: Call to undefined function: remotefilesize() in /home/xganon/www/forums/ubbt.inc.php on line 739<br />
<br />I am using mysql 4.0.16, php 4.1.2, Redhat ES 2.3(or so).<br />I added the function to the bottom of ubbt.inc.php but stil no go (It was the code for php versions that aren't 4.3)<br /><br />Any ideas?<br />Line 739 of that file is:<br />
[]Astaran said:<br />Have you added the function remoteFileSize as stated in the instructions and the the function that is needed for older php versions? [/]<br /><br />I must be blind, I added the function for the older php versions but didn't add the function for remoteFileSize, unfortunatly I had installed this before that was added to the instructions and wasn't made aware of it until this weekend.<br />Thanks for the help! <img src="http://www.ubbdev.com/forum/images/graemlins/cool.gif" alt="" />
I would love to implemente this in 6.5 and run the check script for all those who have to big allready....<br /><br />Whats needed for this to work in 6.5???
works fine in 6.5, but there are some lines that must be changed manually, as it have been a few small changes in them by Infopop... anyway, kinda logic!
Anno
Code Monkey
Registered: 05/23/01
Posts: 562
Loc: Austria
There is something missing in that code, only the first image found is checked for the size and other parameters, all others are not.<br />A for loop is missing so to say.<br /><br />Also, I found a remote file size check that doesn't download the images to check the filesize but checks the headers instead.<br /><br />http://www.php-editors.com/contest/1/33-read.html
[]Anno said:<br />There is something missing in that code, only the first image found is checked for the size and other parameters, all others are not.<br />A for loop is missing so to say.<br /> [/]<br /><br />In my original code or the updated one?
_________________________
Running a community? -> Keep informed and take it to the next level
Anno
Code Monkey
Registered: 05/23/01
Posts: 562
Loc: Austria
In the one in your first post. <br /> <br />This part: <br /> <br />elseif ($images != 0) { <br />$imageUrl = "http" . $out['0']['2'] . "." . $out['0']['3']; <br /> <br />Should be included in a loop, the way it is now it only checks the first image found. <br /> <br />Also, you might check the function I use for the remote file size checking without the need to downlod the file to the server.
drkknght
Kahuna
Registered: 11/09/00
Posts: 1249
Loc: rob's pad -- where it takes sk...
how much more difficult would it be to additionally force users to upload their signature images to my server? in a similar fashion as the user avatar's current upload setting.<br /><br />this way, i could (1) better monitor the content of the images and (2) ensure there's no page drag because a sig image is hosted on a slower server
_________________________
professional discussion killer due to intelligence limitations, i do not offer support. my site ~ my boards
drkknght
Kahuna
Registered: 11/09/00
Posts: 1249
Loc: rob's pad -- where it takes sk...
in addition, i'd also prefer to have a little upload field, too, for the users to upload their sig images (which would help enforce the idea that they'd have to be hosted on my server) <br /> <br />any chance on whippin all this up for the codily handicapped? <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />
_________________________
professional discussion killer due to intelligence limitations, i do not offer support. my site ~ my boards
Hi, please help....<br /><br />I am using 6.3.2 and have gone into the admin panel - edit config settings. Where exactly do I add these variables? There isnt anywhere obvious to put them. can they be added to the php file manually?<br /><br /><br />
Code:
##################<br />Open your admin panel -> config settings and add these variables:<br />###################<br /><br />$config['sigMaxImages'] = '1';<br />$config['sigImageHeight'] = '80';<br />$config['sigImageWidth'] = '400';<br />$config['sigImageSize'] = '30720';<br />$config['sigMaxLines'] = '10';