[ Príspevok: 1 ] 
AutorSpráva
Offline

Prevádzkovateľ fóra
Prevádzkovateľ fóra
Restrict images in signatures

Registrovaný: 01.05.05
Príspevky: 12419
Témy: 1447 | 1447
Bydlisko: Bratislava
Vek: 32
NapísalOffline : 14.10.2006 15:11 | Restrict images in signatures

Kód:
###############################################
##   Hack Title:      Restrict images in signatures
##   Hack Version:   0.1.1
##   Author:         Freakin' Booty ;-P
##   Description:   Restrict the width, the height and the number of images in signatures. Everything
##               is configurable from the Administration Control Panel.
##   Compatibility:   2.0.4
##
##   Installation Level: Easy
##   Installation Time: 5 - 10 minutes
##   Files To Edit: 6
##      admin/admin_board.php
##      admin/admin_users.php
##      includes/usercp_register.php
##      language/lang_english/lang_admin.php
##      language/lang_english/lang_main.php
##      templates/subSilver/admin/board_config_body.tpl
##
##   Included Files: 1
##      db_update.php
##
##   History:
##      0.1.0:   Initial release
##      0.1.1:   Fixed a few mistakes in the admin board configuration file.
##
##   Author Notes:
##      None
##
##   Support:      http://www.phpbbhacks.com/forums
##   Copyright:      ©2003 Restrict images in signatures 0.1.1 - Freakin' Booty ;-P
##
###############################################
##   You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads.
##   Please visit http://www.phpbbhacks.com/forums for support.
###############################################
##
###############################################
##   This hack is released under the GPL License.
##   This hack can be freely used, but not distributed, without permission.
##   Intellectual Property is retained by the hack author(s) listed above.
###############################################

#
#-----[ COPY ]--------------------------------------------
#
# Run this file once (access it with your browser) and then delete it!
#
db_update.php      => db_update.php

#
#-----[ OPEN ]--------------------------------------------
#
admin/admin_board.php

#
#-----[ FIND ]--------------------------------------------
#
   "L_MAX_SIG_LENGTH" => $lang['Max_sig_length'],
   "L_MAX_SIG_LENGTH_EXPLAIN" => $lang['Max_sig_length_explain'],

#
#-----[ AFTER, ADD ]--------------------------------------
#
   "L_MAX_SIG_IMAGES_LIMIT" => $lang['Max_sig_images_limit'],
   "L_MAX_SIG_IMAGES_SIZE" => $lang['Max_sig_images_size'],
   "L_MAX_SIG_IMAGES_SIZE_EXPLAIN" => $lang['Max_sig_images_explain'],

#
#-----[ FIND ]--------------------------------------------
#
   "SIG_SIZE" => $new['max_sig_chars'],

#
#-----[ AFTER, ADD ]--------------------------------------
#sig_images_max_width
   "SIG_IMAGES_MAX_LIMIT" => $new['sig_images_max_limit'],
   "SIG_IMAGES_MAX_HEIGHT" => $new['sig_images_max_height'],
   "SIG_IMAGES_MAX_WIDTH" => $new['sig_images_max_width'],

#
#-----[ OPEN ]--------------------------------------------
#
admin/admin_users.php

#
#-----[ FIND ]--------------------------------------------
#
         if ( strlen($sig_length_check) > $board_config['max_sig_chars'] )
         {
            $error = TRUE;
            $error_msg .=  ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
         }

#
#-----[ AFTER, ADD ]--------------------------------------
#
         else
         {
            if( preg_match_all("#\[img(:$signature_bbcode_uid)?\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img(:$signature_bbcode_uid)?\]#sie", $signature, $matches) )
            {
               if( count($matches[0]) > $board_config['sig_images_max_limit'] )
               {
                  $error = TRUE;
                  $l_too_many_images = ( $board_config['sig_images_max_limit'] == 1 ) ? sprintf($lang['Too_many_sig_image'], $board_config['sig_images_max_limit']) : sprintf($lang['Too_many_sig_images'], $board_config['sig_images_max_limit']);
                  $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_too_many_images;
               }
               else
               {
                  for( $i = 0; $i < count($matches[0]); $i++ )
                  {
                     $image = preg_replace("#\[img(:$signature_bbcode_uid)?\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img(:$signature_bbcode_uid)?\]#si", "\\2\\4", $matches[0][$i]);
                     list($width, $height) = @getimagesize($image);
                     if( $width > $board_config['sig_images_max_width'] || $height > $board_config['sig_images_max_height'] )
                     {
                        $error = TRUE;
                        $l_image_too_large = sprintf($lang['Sig_image_too_large'], $board_config['sig_images_max_width'], $board_config['sig_images_max_height']);
                        $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_image_too_large;
                        break;
                     }
                  }
               }
            }
         }

#
#-----[ OPEN ]--------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]--------------------------------------------
#
      if ( strlen($signature) > $board_config['max_sig_chars'] )
      {
         $error = TRUE;
         $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Signature_too_long'];
      }

#
#-----[ AFTER, ADD ]--------------------------------------
#
      else
      {
         if( preg_match_all("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie", $signature, $matches) )
         {
            if( count($matches[0]) > $board_config['sig_images_max_limit'] )
            {
               $error = TRUE;
               $l_too_many_images = ( $board_config['images_max_limit'] == 1 ) ? sprintf($lang['Too_many_sig_image'], $board_config['sig_images_max_limit']) : sprintf($lang['Too_many_sig_images'], $board_config['sig_images_max_limit']);
               $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $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['sig_images_max_width'] || $height > $board_config['sig_images_max_height'] )
                  {
                     $error = TRUE;
                     $l_image_too_large = sprintf($lang['Sig_image_too_large'], $board_config['sig_images_max_width'], $board_config['sig_images_max_height']);
                     $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $l_image_too_large;
                     break;
                  }
               }
            }
         }
      }

#
#-----[ OPEN ]--------------------------------------------
#
# Make sure to edit this file for every language installed
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]--------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]-------------------------------------
#
//
// Restrict images in signatures
//
$lang['Max_sig_images_limit'] = 'Maximum Images Per Signatures';
$lang['Max_sig_images_size'] = 'Maximum Image Dimensions In Signatures';
$lang['Max_sig_images_size_explain'] = '(Height x Width in pixels)';

#
#-----[ OPEN ]--------------------------------------------
#
# Make sure to edit this file for every language installed
#
language/lang_english/lang_main.php

#
#-----[ FIND ]--------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]-------------------------------------
#
//
// Restrict images in signatures
//
$lang['Too_many_sig_image'] = 'You have added too many images in your signature. You can only add %d image in your signature.';
$lang['Too_many_sig_images'] = 'You have added too many images in your signature. You can only add %d images in your signature.';
$lang['Sig_image_too_large'] = 'You have added an image that is too large. Images can only be %d pixels wide and %d pixels high.';

#
#-----[ OPEN ]--------------------------------------------
#
# Make sure to edit this file for every template installed
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ FIND ]--------------------------------------------
#
   <tr>
      <td class="row1">{L_MAX_SIG_LENGTH}<br /><span class="gensmall">{L_MAX_SIG_LENGTH_EXPLAIN}</span></td>
      <td class="row2"><input class="post" type="text" size="5" maxlength="4" name="max_sig_chars" value="{SIG_SIZE}" /></td>
   </tr>

#
#-----[ AFTER, ADD ]--------------------------------------
#
   <tr>
      <td class="row1">{L_MAX_SIG_IMAGES_LIMIT} <br />
         <span class="gensmall">{L_MAX_SIG_IMAGES_LIMIT_EXPLAIN}</span>
      </td>
      <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="sig_images_max_limit" value="{SIG_IMAGES_MAX_LIMIT}" /></td>
   </tr>
   <tr>
      <td class="row1">{L_MAX_SIG_IMAGES_SIZE} <br />
         <span class="gensmall">{L_MAX_SIG_IMAGES_SIZE_EXPLAIN}</span>
      </td>
      <td class="row2"><input class="post" type="text" size="3" maxlength="4" name="sig_images_max_height" value="{SIG_IMAGES_MAX_HEIGHT}" /> x <input class="post" type="text" size="3" maxlength="4" name="sig_images_max_width" value="{SIG_IMAGES_MAX_WIDTH}" /></td>
   </tr>

#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#




db_update.php
Kód:
<?php
/***************************************************************************
 *                               db_update.php
 *                            -------------------
 *   copyright            : ?2003 Freakin' Booty ;-P
 *   built for            : Restrict images in signatures 0.1.1
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//


if( !$userdata['session_logged_in'] )
{
   $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
   header($header_location . append_sid('login.'.$phpEx.'?redirect=db_update.'.$phpEx, true));
   exit;
}

if( $userdata['user_level'] != ADMIN )
{
   message_die(GENERAL_MESSAGE, 'You are not authorised to access this page');
}


$page_title = 'Updating the database';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

echo '<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">';
echo '<tr><th>Updating the database</th></tr><tr><td><span class="genmed"><ul type="circle">';


$sql = array();
$sql[] = "INSERT INTO " . CONFIG_TABLE . " (config_name, config_value) VALUES ('sig_images_max_width', 400), ('sig_images_max_height', 300), ('sig_images_max_limit', 1)";

for( $i = 0; $i < count($sql); $i++ )
{
   if( !$result = $db->sql_query ($sql[$i]) )
   {
      $error = $db->sql_error();

      echo '<li>' . $sql[$i] . '<br /> +++ <font color="#FF0000"><b>Error:</b></font> ' . $error['message'] . '</li><br />';
   }
   else
   {
      echo '<li>' . $sql[$i] . '<br /> +++ <font color="#00AA00"><b>Successfull</b></font></li><br />';
   }
}


echo '</ul></span></td></tr><tr><td class="catBottom" height="28">&nbsp;</td></tr>';
echo '<tr><th>End</th></tr><tr><td><span class="genmed">Installation is now finished. Please be sure to delete this file now.<br />If you have run into any errors, please visit the <a href="http://www.phpbbhacks.com/forums" target="_phpbbhacks">phpBBHacks.com support forums</a> and ask someone for help.</span></td></tr>';
echo '<tr><td class="catBottom" height="28" align="center"><span class="genmed"><a href="' . append_sid("index.$phpEx") . '">Have a nice day</a></span></td></table>';

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>


_________________
SilverStone SST CS01 | Corsair SF600 600W SFX | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 (16 Cores / 32 Threads) & Noctua NH-U9DX i4 | Kingston HyperX Savage 32 GB DDR4 2400 MHz | PNY NVIDIA Quadro K1200 DP 4 GB DDR5 | Intel SSD 750 1.2 TB NVMe & Intel SSD 730 240 GB SATA & Seagate BackUp Plus Portable 12 TB USB | 31.5" 4K LCD EIZO FlexScan EV3237 & 2 x 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech Wireless G700s | Harman Kardon Nova | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 - Intel Core i7 5600U, 8 GB DDR3 1600 MHz, Intel HD Graphics 5500, SanDisk SSD 512 GB, 12.5 FHD LED IPS, WWAN 3G 4G LTE, Microsoft Windows 7 Ultimate | Nintendo Classic Mini | BlackBerry Passport 96 GB
 [ Príspevok: 1 ] 


Restrict images in signatures



Podobné témy

 Témy  Odpovede  Zobrazenia  Posledný príspevok 
V tomto fóre nie sú ďalšie neprečítané témy.

Removes images from signatures in chosen forums

v Redakčné systémy

0

295

13.10.2006 9:29

JanoF

V tomto fóre nie sú ďalšie neprečítané témy.

Restrict Account To IP

v Redakčné systémy

0

275

14.10.2006 14:50

JanoF

V tomto fóre nie sú ďalšie neprečítané témy.

images

v HTML, XHTML, XML, CSS

9

395

24.11.2009 15:44

Svolo

V tomto fóre nie sú ďalšie neprečítané témy.

background+images

v HTML, XHTML, XML, CSS

1

86

12.07.2013 17:17

shaggy

V tomto fóre nie sú ďalšie neprečítané témy.

images upload

v PHP, ASP

8

620

20.07.2006 13:57

scooby

V tomto fóre nie sú ďalšie neprečítané témy.

Problem s images

v Počítačové hry

14

886

25.07.2008 21:10

eXistenZ

V tomto fóre nie sú ďalšie neprečítané témy.

Remove Images MOD

v Redakčné systémy

0

302

14.10.2006 15:21

JanoF

V tomto fóre nie sú ďalšie neprečítané témy.

Scripty pre Images hosting

v Ostatné

0

721

02.11.2006 13:07

Exodus

V tomto fóre nie sú ďalšie neprečítané témy.

CSS Multi Backrounds images

v HTML, XHTML, XML, CSS

4

112

05.02.2014 12:37

F3RY

V tomto fóre nie sú ďalšie neprečítané témy.

java - SimpleWindow a Images

v Assembler, C, C++, Pascal, Java

2

201

27.11.2011 20:07

mack0

V tomto fóre nie sú ďalšie neprečítané témy.

Niečo ako preload images ale text

v JavaScript, VBScript, Ajax

7

347

08.09.2011 11:58

camo



© 2005 - 2017 PCforum, edited by JanoF