| | |
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
Autor | Správa |
---|
Registrovaný: 01.05.05 Príspevky: 13348 Témy: 1496 Bydlisko: Bratislava | Napísal JanoF: 14.10.2006 15:11 | |
|
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.phpKó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"> </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);
?>
_________________ Streacom DA2 | SilverStone Titanium SX800-LTI 800W | ASRock X299E-ITX/ac | Intel Core i9-9980XE & be quiet! Dark Rock TF | Kingston HyperX Impact 64 GB DDR4 2666 MHz | NVIDIA Titan RTX 24 GB | Intel SSD Optane 905P 480 GB NVMe U.2 & Intel SSD 750 1,2 TB NVMe U.2 & Intel SSD 660p 2 TB NVMe M.2 & Seagate BackUp Plus Portable 56 TB USB | 55" 4K OLED Dell Alienware AW5520QF & 24" LCD EIZO FlexScan EV2451 | Ergotron LX Wall Mount Keyboard Arm | Logitech Craft | Logitech G603 | Logitech F710 | Harman Kardon Sabre SB 35 & Sennheiser RS 175 | Microsoft Windows 7 Ultimate | APC Back-UPS ES 700 | Lenovo ThinkPad X250 | iPhone X 256 GB & Pitaka Aramid | SilverStone ML05B Milo | Corsair SF600 SFX 600W | ASRock X99E-ITX/ac | Intel Xeon E5-2683 v4 & NOCTUA NH-L12S | Kingston HyperX Savage 32 GB DDR4 2400 MHz | NVIDIA GeForce GT 710 1 GB | Intel SSD Optane Memory 32 GB NVMe M.2 & Intel SSD 730 240 GB SATA | Ubuntu Server |
|
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
Podobné témy | Témy | Odpovede | Zobrazenia | Posledný príspevok |
---|
| Removes images from signatures in chosen forums v Redakčné systémy | 0 | 664 | 13.10.2006 9:29 JanoF | | Restrict Account To IP v Redakčné systémy | 0 | 573 | 14.10.2006 14:50 JanoF | | images v HTML, XHTML, XML, CSS | 9 | 552 | 24.11.2009 15:44 Svolo | | background+images v HTML, XHTML, XML, CSS | 1 | 296 | 12.07.2013 17:17 shaggy | | images upload v PHP, ASP | 8 | 815 | 20.07.2006 13:57 scooby | | Remove Images MOD v Redakčné systémy | 0 | 2511 | 14.10.2006 15:21 JanoF | | Problem s images v Počítačové hry | 14 | 1244 | 25.07.2008 21:10 eXistenZ | | Scripty pre Images hosting v Ostatné | 0 | 995 | 02.11.2006 13:07 Exodus | | CSS Multi Backrounds images v HTML, XHTML, XML, CSS | 4 | 354 | 05.02.2014 12:37 F3RY | | java - SimpleWindow a Images v Assembler, C, C++, Pascal, Java | 2 | 331 | 27.11.2011 20:07 mack0 | | Niečo ako preload images ale text v JavaScript, VBScript, Ajax | 7 | 624 | 08.09.2011 11:58 camo |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|