Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-10-2001, 01:17 AM
c-pr0mpt's Avatar
c-pr0mpt c-pr0mpt is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi
I would like to be able to remove someones ability to post an image in their sig, or their sig area all together. I have rules on size limits, content, and so on. If they dont follow the rules I want to remove their ability to even have one, without affecting the members who are not breaking the rules.

Does this hack exist? If so where can I get it? If not, anyone willing to work on one?

Thanks in advance for any answers.
Reply With Quote
  #2  
Old 06-10-2001, 05:46 PM
c-pr0mpt's Avatar
c-pr0mpt c-pr0mpt is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I take it this hack doesnt exist. lol
Reply With Quote
  #3  
Old 06-10-2001, 10:02 PM
chrispadfield's Avatar
chrispadfield chrispadfield is offline
 
Join Date: Oct 2001
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it dosen't but is a good idea. Personally i think signature rules need to be looked at. Possible iteams of relevenace include:

1. Signature size global limit (there is a hack for this)
2. Signauture override based on usergroup
3. Signature override based on individual userid

and the same for images in signatures.
Reply With Quote
  #4  
Old 06-10-2001, 11:58 PM
c-pr0mpt's Avatar
c-pr0mpt c-pr0mpt is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where can I get the global limit hack? Does that mean size in mass, or dimension?

And the other stuff you listed, are you saying this is stuff i could do? Or just ways the hack could be made?
Reply With Quote
  #5  
Old 06-11-2001, 12:00 AM
Ratorasniki
Guest
 
Posts: n/a
Default

i've done the following for my board:

-maximum image filesize in sig (single image and combined)
-maximum image resolution (width by height)
-per user hardcoded (ie. no cp stuff) sig disabler

its not foolproof (i can think of about 3 ways to get past either the resolution or filesize thangs, since its only checked on user profile edit) but it works for me for the mostpart. i'm working on removing width and height tags from images as well - i've got some idiots on my board taking small images like smilies and making them enormous in size since they cant just use huge images with varying degrees of luck.

i didnt think anyone else'd use this stuff so i just did it really quick and its reaaaaaaally ugly but if anyone is interested i can clean it up and post it.
Reply With Quote
  #6  
Old 06-11-2001, 12:04 AM
c-pr0mpt's Avatar
c-pr0mpt c-pr0mpt is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would love if you could do that bro. Ugly is better than non existent. lol
Reply With Quote
  #7  
Old 06-11-2001, 12:18 AM
Ratorasniki
Guest
 
Posts: n/a
Default

you havent seen my ugly.

i've been known to compress an entire class to a single line

anyway i'll get on that.
Reply With Quote
  #8  
Old 06-11-2001, 12:35 AM
Ratorasniki
Guest
 
Posts: n/a
Default

in member.php:

find:
Code:
<?php
and insert after:
Code:
/************************************************************************
 stuff for img size
************************************************************************/
define(GIF_SIG, "\x47\x49\x46"); 
define(JPG_SIG, "\xff\xd8\xff"); 
define(PNG_SIG, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"); 
define(JPG_SOF0, "\xc0");
define(JPG_SOF1, "\xc1");
define(JPG_SOF2, "\xc2");
define(JPG_SOF3, "\xc3"); 
define(JPG_SOF5, "\xc5");
define(JPG_SOF6, "\xc6"); 
define(JPG_SOF7, "\xc7"); 
define(JPG_SOF9, "\xc9"); 
define(JPG_SOF10, "\xca"); 
define(JPG_SOF11, "\xcb"); 
define(JPG_SOF13, "\xcd"); 
define(JPG_SOF14, "\xce"); 
define(JPG_SOF15, "\xcf"); 
define(JPG_EOI, "\xd9");
define(JPG_SOS, "\xda");
define(RD_BUF, 512); 
//***********************************************************************
find:
Code:
  // check that nothing illegal is in the signature
  $signature=censortext($signature);
and insert after:
Code:
//************************************************
// rats sig checking shizynit

   $imgcount = substr_count($signature, "<img src=");
   $sigstart = 0;
   $sigend = strlen($signature);
   $tmpsig = $signature;
   $totalsigsize = 0;

//   $signature .= "<!-- imgcount: $imgcount -->";

   for($i = 0; $i < $imgcount; $i++) {

	if(ereg("<img src=\"(.*)\"(.*)>", $tmpsig, $img)) {
	  $img[2] = substr($img[2], 0, strlen($img[2]) - 1);
//	  $signature .= CheckSigImageSizes($img[2]);
	  CheckSigImageSizes($img[2]);
	  $sigstart = strpos($tmpsig,"<img src") + strlen($img[2]);
	}

	if(ereg("<img src=(http[s]*:[/]+)([-a-z0-9_\./]*)>", $tmpsig, $img)) {
	  if(substr_count($img[2], " ") > 0) {
	    $tmp = explode(" ", $img[2]);
//	    $signature .= CheckSigImageSizes("http://".$tmp[0]);
	    CheckSigImageSizes("http://".$tmp[0]);
	    $sigstart = strpos($tmpsig, "<img src") + strlen($tmp[2]) + 7;
	  } else {		
//	    $signature .= CheckSigImageSizes("http://".$img[2]);
	    CheckSigImageSizes("http://".$img[2]);
	    $sigstart = strpos($tmpsig,"<img src") + strlen($img[2]) + 7;
	  }
	}

	$tmpsig = substr($signature, $sigstart, $sigend - $sigstart);
   }
//************************************************
and if you're feeling adventurous you can try adding
Code:
//************************************************
// remove width and height params
//strip height tags
$signature=ereg_replace("[:space:]?height=\"[0-9]+\"","",$signature);
$signature=ereg_replace("[:space:]?height=[0-9]+","",$signature);
//strip width tags
$signature=ereg_replace("[:space:]?width=\"[0-9]+\"","",$signature);
$signature=ereg_replace("[:space:]?width=[0-9]+","",$signature);
//************************************************
after the above.

then find (should be right at the bottom):
Code:
  // parse this next line with eval:
  $sendtoname=$destuserinfo[username];
  eval("standardredirect(\"".gettemplate("redirect_sentemail")."\",\"usercp.php?s=$session[sessionhash]\");");
}
and under it add:
Code:
// img size stuff
function GetURLImageSize( $urlpic ){ 
   $fd= @fopen($urlpic,"r"); 
   if($fd){  
      #read in 1k, enough for GIF,PNG. 
      #continue to read from file, if the JPG chunk exceeds this 
      $imgData = fread( $fd,RD_BUF ); 
    
      if( substr($imgData,0,3)==GIF_SIG ){  
         $dim =unpack ("v2dim",substr($imgData,6,4) ); 
         $width=$dim["dim1"]; $height=$dim["dim2"]; 
         $type = 1; 
      } elseif( substr($imgData,0,8)==PNG_SIG ){  
         $dim =unpack ("N2dim",substr($imgData,16,8) ); 
         $width=$dim["dim1"]; $height=$dim["dim2"];       
         $type = 3; 
      } elseif( substr($imgData,0,3)==JPG_SIG ){            
         ################# JPG CHUNK SCAN #################### 
         $imgPos = 2; $type = 2; $buffer = RD_BUF-2; 
         while($imgPos < strlen($imgData)) { 
            /* synchronize to the marker 0xFF */ 
            $imgPos=strpos(&$imgData,0xFF,$imgPos)+1; 
            $marker = $imgData[$imgPos]; 
            do { $marker = ord($imgData[$imgPos++]); } while ($marker == 255); 
            /* find dimensions of block */ 
            switch (chr($marker)) { 
              /* Grab width/height from SOF segment (these are acceptable chunk types) */ 
              case JPG_SOF0:  case JPG_SOF1:  case JPG_SOF2: 
              case JPG_SOF3:  case JPG_SOF5:  case JPG_SOF6: 
              case JPG_SOF7:  case JPG_SOF9:  case JPG_SOF10: 
              case JPG_SOF11: case JPG_SOF12: case JPG_SOF13: 
              case JPG_SOF14: case JPG_SOF15:      
              $dim =unpack ("n2dim",substr($imgData,$imgPos+3,4) ); 
              $height=$dim["dim1"]; $width=$dim["dim2"]; 
              break 2; //found it so exit 
            case JPG_EOI: 
            case JPG_SOS: 
              return FALSE;    /* End loop in case we find one of these markers */ 
            default:            /* We're not interested in other markers */ 
              $skiplen = (ord($imgData[$imgPos++])<<8)+ord($imgData[$imgPos++])-2; 
              /* if the skip is more than what we've read in, read more */ 
              $buffer -= $skiplen; 
              if( $buffer<512 ){ #if the buffer of data is too low,read more file. 
                  $imgData .= fread( $fd,$skiplen+1024 ); 
                  $buffer += $skiplen+1024; 
              }; 
              $imgPos += $skiplen; 
              break; 
            }; //endif check marker type 
         }; //endif loop through JPG chunks 
      }; //endif chk for valid file types 
      
      # got the pic dimensions, close the file 
      fclose ($fd); 

      return array( $width,$height,$type ); 
    } else { 
      return array( '','','' ); 
    }; //endif valid file pointer chk 
}; // end function 

function CheckSigImageSizes($imageurl) {
	global $totalsigsize;

	//change this stuff
	$max_singleimgsz = 20000;	//20k
	$max_totalimgsz = 20000;	//20k
	$max_imgwidth = 300;		//300px wide
	$max_imgheight = 200;		//200px tall

	$imginfo = GetURLImageSize( $imageurl );
	$url=parse_url($imageurl); 
	$imgPath = $url[path];
	$imgHost = $url[host]; 
	$fp = fsockopen($imgHost, 80, &$errno, &$errstr, 30); 
	if(!$fp) { 
//	   echo "ERROR: $errno: $errstr"; 
	} else { 
	   fputs($fp,"HEAD $imgPath HTTP/1.0\nHost: $imgHost\n\n"); 
	   while(!feof($fp)) { 
	      $response .= fgets($fp,128); 
	   } 
	   fclose($fp); 
	} 
	$imgSz = ereg_replace("(.*)(Content-Length: )([0-9]*)(.*)","\\3",$response); 
	if($imgSz > $max_singleimgsz) //filesize in bytes
	{
	   eval("standarderror(\"".gettemplate("error_sigsizetoobig")."\");");
	   exit;
	}
	if($imgSz + $totalsigsize > $max_totalimgsz) //filesize in bytes
	{
	   $totalsigsize += $imgSz;
	   eval("standarderror(\"".gettemplate("error_sigtotalsizetoobig")."\");");
	   exit;
	}
	if($imginfo[0] > $max_imgwidth) //width
	{
	   eval("standarderror(\"".gettemplate("error_sigdemtoobig")."\");");
	   exit;
	}
	if($imginfo[1] > $max_imgheight) //height
	{
	   eval("standarderror(\"".gettemplate("error_sigdemtoobig")."\");");
	   exit;
	}
	$totalsigsize += $imgSz;
//return "\n<!-- $imageurl ($imgSz) - $imginfo[0] x $imginfo[1] -->";
}
change the vars at the top of the CheckSigImageSizes function to define your max sizes and that takes care of the image res and filesize stuff.

as for single user sig disabling open showthread.php and find:
Code:
    if ($post[showsignature] and $allowsignatures and trim($post[signature])!="" and ($bbuserinfo[userid]==0 or $bbuserinfo[showsignatures])) {
and change it to :
Code:
    if ($post[showsignature] and $allowsignatures and trim($post[signature])!="" and ($bbuserinfo[userid]==0 or $bbuserinfo[showsignatures]) and $post[username]!="Bad Boy One" and $post[username]!="Bad Boy Two") {
as necessary.

attached txt incase this gets formatted weird :P
Attached Files
File Type: txt sigtools.txt (7.8 KB, 24 views)
Reply With Quote
  #9  
Old 06-11-2001, 12:43 AM
c-pr0mpt's Avatar
c-pr0mpt c-pr0mpt is offline
 
Join Date: Oct 2001
Location: Michigan
Posts: 235
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you VERY much. I will get on this right away and let you know how it worked. =)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04352 seconds
  • Memory Usage 2,263KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (9)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (6)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete