Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Mod Name / Version: Restrict signatures
Description: This hack allows the administrators to restrict the users' signatures via the admin panel.
Possible restrictions:
- maximum height/width of an image
- number of images
- max. filesize of the images
- max. number of linebreaks
Working Under: UBB.Threads 6.3-6.4
Mod Status: Finished
Any pre-requisites: none
Author(s): Astaran
Date: 02/09/04
Credits: My moderators who requested it
Files Altered: changebasic.php, ubbt.inc.php, config.inc.php
New Files: none
Database Altered: no
Info/Instructions:
Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.
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.
Edited by Astaran (02/11/04 04:15 PM)
|
Zackary
Code Monkey
   
Reged: 10/23/02
Posts: 540
|
|
Awesome! A must have! No more HUUUUGE sig images on my forums. muahaha 
Tossing this on my todo list, thanks Astaran!
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
I forgot the language strings. Just grab the updated instructions.
-------------------- Running a community? -> Keep informed and take it to the next level
|
DLWebmaestro
Addict
 
Reged: 01/16/03
Posts: 1696
Loc: North Carolina
|
|
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.
-------------------- ThreadsDev 2003 Member Spotlight Winner
JoshPet was here.
Miserable Failure
|
JoshPet
The artist formerly known as Mr. Bug
  
Reged: 11/29/01
Posts: 11414
Loc: Charlotte, NC
|
|
Nice!
--------------------
Josh - Joshua PettitWebsite - For Hire Coding work and Modifications
Feel Better, Look younger - www.BuyTransD.com
Use Coupon Code 1004 to Save $20 Off Your Initial Order of Trans-D Tropin
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Quote:
DLWebmaestro said: 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.
You're right. I fixed it and updated the instructions. Only this row changed:
$sigLines = preg_match_all("/\\n/",$Signature, $outLines);
|
PhotoPost
Hacker
  
Reged: 02/03/02
Posts: 989
|
|
Great mod!
Now all I need to do is write a script to check all the existing ones!
--------------------

Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
I already did such a script. It sends out an PM to all users who have a signature that don't fit to the new rules.
-------------------- Running a community? -> Keep informed and take it to the next level
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Attached you'll find a script that checks all signatures if they match to your rules defined in the config file.
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.
Note: Change the Body of the private message and make a Backup of your database first!
Rename the attachement to .php and upload it to you ubbthreads main dir. Delete it after execution.
Edited by Astaran (02/10/04 06:30 PM)
|
DLWebmaestro
Addict
 
Reged: 01/16/03
Posts: 1696
Loc: North Carolina
|
|
It works now! But where is that attached script you were talking about?
-------------------- ThreadsDev 2003 Member Spotlight Winner
JoshPet was here.
Miserable Failure
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Good question. There it is.
-------------------- Running a community? -> Keep informed and take it to the next level
|
DLWebmaestro
Addict
 
Reged: 01/16/03
Posts: 1696
Loc: North Carolina
|
|
-------------------- ThreadsDev 2003 Member Spotlight Winner
JoshPet was here.
Miserable Failure
|
PhotoPost
Hacker
  
Reged: 02/03/02
Posts: 989
|
|
What is $imageSize = remoteFileSize($imageUrl); ?
Also, I'm getting some $imageUrl errors, its creating:
http://http://www.viperalley
--------------------

Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
My fault, I didn't add that to the instructions. Just add this function to your ubbt.inc.php (I updated the instructions to reflect this):
function remoteFileSize($remote_file) { $file = file_get_contents($remote_file); return strlen($file); }
Quote:
Also, I'm getting some $imageUrl errors, its creating:
http://http://www.viperalley
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
|
PhotoPost
Hacker
  
Reged: 02/03/02
Posts: 989
|
|
Keep in mind file_get_contents() only works with PHP 4.3 and later...
--------------------

Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Yes, anyone who is using an older version can use this to make it compatible:
if (!function_exists("file_get_contents")) { function file_get_contents($filename, $use_include_path = 0) { $data = FALSE; $file = fopen($filename, "rb", $use_include_path); if ($file) { while (!feof($file)) $data .= fread($file, 1024); fclose($file); } return $data; } }
-------------------- Running a community? -> Keep informed and take it to the next level
|
smoknz28
Enthusiast
Reged: 04/10/03
Posts: 401
Loc: Washington, D.C.
|
|
Interesting and a well needed mod! However, it's not working on my site after the applied changes.
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.
Here's what I changed the fields to and it's still allowing huge sigs:
$config['sigMaxImages'] = '1';
$config['sigImageHeight'] = '150';
$config['sigImageWidth'] = '400';
$config['sigImageSize'] = '55000';
$config['sigMaxLines'] = '10';
-------------------- F-Body Hideout
Project Speedy
|
Astaran
Addict
  
Reged: 12/21/00
Posts: 1552
Loc: Germany
|
|
Any error messages? What php version are you using?
-------------------- Running a community? -> Keep informed and take it to the next level
|
smoknz28
Enthusiast
Reged: 04/10/03
Posts: 401
Loc: Washington, D.C.
|
|
Quote:
Astaran said: Any error messages? What php version are you using?
No, not picking up on visible errors...
I'm running PHP version 4.3.3.
-------------------- F-Body Hideout
Project Speedy
|
Khârn
Lurker
Reged: 05/04/03
Posts: 9
Loc: Tennessee
|
|
Hi all, I'm not too familar with php yet (I'm still stuck in the perl days )but a user reported the following error and it is able to be reproduced by attempting to change the basic profile. Code:
Fatal error: Call to undefined function: remotefilesize() in /home/xganon/www/forums/ubbt.inc.php on line 739 I am using mysql 4.0.16, php 4.1.2, Redhat ES 2.3(or so). 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)
Any ideas? Line 739 of that file is: Code:
739 $imageSize = remoteFileSize($imageUrl); 740 if ($imageSize > $config['sigImageSize']) { 741 $this -> not_right ($ubbt_lang['SIGMAX_SIZE'],$Cat);
-------------------- Moderator - Infopop Corporation
|