Verstehst du die Install anleitung nicht wen ja hier auf Deutsch...
Code: Alles auswählen
#################################################################
## Mod Title: Remote Avatar Size Check
## Mod Version: 1.0.0
## Author: R. <webmaster@mlukfc.com> - http://www.mlukfc.com/
## Description: Dieser Umb. überprüft die Größe des verbundenen
## avatarsremote
## und verweigert sie, wenn sie nicht die Brettconfig
## zusammenbringen.
##
## Installation Level: moderate
## Installation Zeit: 3 Minutes
## Editirende Dateien: includes/usercp_avatar.php
## Hochzuladende Dateien: keine
#################################################################
## SicherheitscVerzicht: Dieser Umb. kann nicht zu bekanntgegeben werden oder an irgendwelchen unamtlichen phpBBaufstellungsorten hinzugefügt werden
#################################################################
##
## Author Note:
## This code works on PHP3
## Tested and working productive on PHP 3.0.12/Apache
## Tested and working productive on PHP 4.0.5/IIS4
## Important:
## The $board_config['avatar_path'] folder MUST be writeable by the webserver.
## Otherwise set an alternate path in function download_avatar()
## --> $localfile = '/tmp/'.$userdata['session_user_id'].basename($filename);
#################################################################
## Bevor Sie Diesen Umb. Ihrem Forum Hinzufügen, Sollten Sie Alle Akten Unterstützen, die Auf Diesem Umb. Bezogen Werden
#################################################################
#
#-----[ Öffnen ]------------------------------------------
#
/path2phpBB2/includes/usercp_avatar.php
#
#-----[ Finden ]------------------------------------------
#
/***************************************************************************
*
* 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.
*
*
***************************************************************************/
#
#-----[ Danach einfügen]------------------------------------------
#
function download_avatar($filename)
{
global $board_config, $userdata;
$retvar="NULL";
$localfile = './'.$board_config['avatar_path'].'/'.$userdata['session_user_id'].basename($filename);
$fd = @fopen($filename,"rb");
if ($fd)
{
// Read exactly the maximum defined avatar size from the remote file.
// If we don't find any dimension info in it afterwards, then it's not allowed anyway
$imgdata=fread($fd,$board_config['avatar_filesize']);
$fl=@fopen($localfile,"wb");
if ($fl)
{
@fwrite($fl,$imgdata);
@fclose($fl);
if ($fp != -1) $retvar=$localfile;
}
fclose($fd);
}
return $retvar;
}
#
#-----[ Finde ]------------------------------------------
#
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
if ( !preg_match('#^http:\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}
if ( !preg_match('#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is', $avatar_filename) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
return;
}
return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';
}
#
#-----[ Ersetze]------------------------------------------
#
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
global $board_config, $lang;
if ( !preg_match('#^http:\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}
if ( !preg_match('#^(http:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is', $avatar_filename) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
return;
}
// Get remote avatar size [R. 17.04.2002]
// Download the file
$tmp_filename=download_avatar($avatar_filename);
// Get avatar size, check the values and invalidate them, if necessary
if ($tmp_filename!='NULL') list($width, $height) = getimagesize($tmp_filename);
if (!isset($width) or $width==0) $width=2*$board_config['avatar_max_width'];
if (!isset($height) or $height==0) $height=2*$board_config['avatar_max_height'];
// Delete the tempfile
@unlink($tmp_filename);
// Now compare the image dimension with phpBB config and print error message, if necessary
if ( $width > $board_config['avatar_max_width'] && $height > $board_config['avatar_max_height'] )
{
$l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
return;
}
return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';
}
#
#-----[ Speicher/Schlisse alle Dateien]------------------------------------------
#
# EoM