Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2012-03-24 13:56:19

Trandex
Member
Registered: 2012-03-21
Posts: 17
Website

Offline

#2 2012-03-25 08:57:32

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

There's no file in the .zip folder to upload on this link. So I can't test any adaptation...

Offline

#3 2012-03-25 11:40:49

Trandex
Member
Registered: 2012-03-21
Posts: 17
Website

Re: Url avatar 1.4?

Wan wrote:

There's no file in the .zip folder to upload on this link. So I can't test any adaptation...

It did not.

Because this code does not reach the.

$form = extract_elements(array('use_avatar'));

And also do not find the other codes.

Offline

#4 2012-03-25 15:43:33

Trandex
Member
Registered: 2012-03-21
Posts: 17
Website

Re: Url avatar 1.4?

use_avatar ???

Offline

#5 2012-03-25 17:07:21

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

Trandex wrote:
Wan wrote:

There's no file in the .zip folder to upload on this link. So I can't test any adaptation...

It did not.

Because this code does not reach the.

$form = extract_elements(array('use_avatar'));

And also do not find the other codes.

I said I can't look at the code because the uploaded file is empty ! So I can't give any answer with no code.
If you know a correct link to downlod this mod it would be great.

Offline

#6 2012-03-25 17:37:42

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 843
Website

Re: Url avatar 1.4?

@Wan: there is a read me, so you should be fine tongue

#
#            Name :  Avatar par Url en francais
#
#         Version :  1.0
#   punBB version :  1.2.9
#          Author :  Olvean "planetaptor@live.fr"
#
#     Description :  Vous permet de mettre un avatar par url
#
#           Files :  viewtopic.php 
#                    profile.php 
#                    admin_options.php
#
#           Autre : ce mode et basée sur la version remote avatar mais moi je l'ai modifier pour avoir les 2 fonction avatar c'est a dire par url et par upload sur le #                   serveur
#

#===============================================================
# Dans votre base de données
#===============================================================

Ajouter un champ appelé "avatar_link" dans PunBB table d'utilisateurs. Je pense que c'est mieux pour l'ajouter juste après «use_avatar le terrain.

#===============================================================
# ouvre profile.php
#===============================================================

#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

$form = extract_elements(array('use_avatar'));

#---------------------------------------------------------------
# Ajouter après:
#---------------------------------------------------------------

			$avatar_size = @getimagesize($_POST['avatar_link']);
			if($avatar_size[0] <= $pun_config['o_avatars_width'] && $avatar_size[1] <= $pun_config['o_avatars_height'])
		{
	$form['avatar_link'] = $_POST['avatar_link'];
		}
	else
		{
		message('La taille maximale d\'un avatar est de '.$pun_config['o_avatars_width'].' x '.$pun_config['o_avatars_height'].' pixels !');
		}

#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.signature,

#---------------------------------------------------------------
# Remplace par :
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.use_avatar, u.avatar_link, u.signature,

#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

		if ($user['use_avatar'] == '1')
		{
			if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />';
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />';
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />';
			else
				$avatar_field = $lang_profile['No avatar'];
		}
#---------------------------------------------------------------
# remplace par :
#---------------------------------------------------------------

		if ($user['use_avatar'] == '1' && $user['avatar_link'] != "")
		{
			if ($img_size = @getimagesize($user['avatar_link']))
			if($img_size[0] <= $pun_config['o_avatars_width'] && $img_size[1] <= $pun_config['o_avatars_height'])
			$avatar_field = '<img src="'.$user['avatar_link'].'" '.$img_size[3].' alt="" />';
			if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.gif'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />';
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />';
			else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$id.'.png'))
				$avatar_field = '<img src="'.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />';
			else
				$avatar_field = $lang_profile['No avatar'];
		}

#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

<?php endif; ?>					<p><?php echo $lang_profile['Avatar info'] ?></p>
							<div class="rbox">
								<label><input type="checkbox" name="form[use_avatar]" value="1"<?php if ($user['use_avatar'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Use avatar'] ?><br /></label>
							</div>
							<p class="clearb"><?php echo $avatar_field ?></p>
						</div>
					</fieldset>
				</div>

#---------------------------------------------------------------
# Remplace par :
#---------------------------------------------------------------

<?php endif; ?>					<p><?php echo $lang_profile['Avatar info'] ?></p>
							<?php $img_size = @getimagesize($user['avatar_link']); if($user['avatar_link'] != "") { ?> <img src="<?php echo $user['avatar_link']; ?>" <?php 							echo $img_size[3]; ?> alt="" /><?php } ?><br /></p>
							<div class="rbox">
							Lien vers l'avatar :<br />
							<input type="text" name="avatar_link" value="<?php echo $user['avatar_link']; ?>" size="50" />
							</div>
							<div class="rbox">
								<label><input type="checkbox" name="form[use_avatar]" value="1"<?php if ($user['use_avatar'] == '1') echo ' checked="checked"' ?> /><?php echo $lang_profile['Use avatar'] ?><br /></label>
							</div>
							<p class="clearb"><?php echo $avatar_field ?></p>
						</div>
					</fieldset>
				</div>


#===============================================================
# ouvre viewtopic.php
#===============================================================


#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature,

#---------------------------------------------------------------
# remplace par :
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.avatar_link, u.signature,

#---------------------------------------------------------------
# recherche :
#---------------------------------------------------------------

if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
	if ($img_size = @getimagesize($cur_post['avatar_link']))
	{


#---------------------------------------------------------------
# ajoute aprés :
#---------------------------------------------------------------

		if($img_size[0] <= $pun_config['o_avatars_width'] && $img_size[1] <= $pun_config['o_avatars_height'])
			$user_avatar = '<img src="'.$cur_post['avatar_link'].'" '.$img_size[3].' alt="" />';


#---------------------------------------------------------------
# upload :
#---------------------------------------------------------------

envoyer sur le serveur 

FeatherBB - A simple and lightweight new generation forum system
Based on FluxBB, written in PHP, using Slim Framework for a proper OOP-MVC architecture.

Offline

#7 2012-03-25 18:33:12

Trandex
Member
Registered: 2012-03-21
Posts: 17
Website

Re: Url avatar 1.4?

File does not exist already.

But it does not reach codes.

Please, help me.

Offline

#8 2012-03-26 11:10:02

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

adaur wrote:

@Wan: there is a read me, so you should be fine tongue

Many thanks adaur ! (this compressed file couldn't be extracted in a normal way, I succeeded with 7-Zip...)

@Trandex :
The field use_avatar doesn't exist anymore in 1.4.x versions. The management of users' avatars is a bit more simple and a part of it made with the function generate_avatar_markup.
I'll try to suggest you soon an adaptation.

Last edited by Wan (2012-03-26 11:22:57)

Offline

#9 2012-03-26 17:53:24

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

Here is a readme text adapted to 1.4.8 (and probably others 1.4.x).
I tried to make it safer than the precedent version... hope I aimed the target.
I let you test...

#
#            Name :  Avatar by URL
#
#         Version :  2.0
#  FluxBB version :  1.4.8 (and probably others 1.4.x, you should verify that point)
#          Author :  Wan (wan@cara-vintage.com)
#					 based on a work by Olvean (planetaptor@live.fr) for PunBB 1.2.x
#
#     Description :  Allow user to get an avatar with a simple URL
#
#           Files :  viewtopic.php 
#                    profile.php 
#


#===============================================================
# In your DB
#===============================================================

Add a field in the users table with this parameters :
Column		:	avatar_link
Type		:	TEXT
Default		:	NULL
Collation	:	utf8_general_ci
Null		:	checked


#===============================================================
# open profile.php
#===============================================================


#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

	if (isset($_POST['form_sent']))
	{
		if (!isset($_FILES['req_file']))
	
#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

	if (isset($_POST['form_sent']))
	{
		if ($_POST['req_url'] != '')
		{
			$avatar_size = @getimagesize($_POST['req_url']);
			if($avatar_size[0] > $pun_config['o_avatars_width'] || $avatar_size[1] > $pun_config['o_avatars_height'])
				message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');
			if ($avatar_size[0]+$avatar_size[1] == 0)
				message('No image corresponding to this URL or wrong format or maybe image corrupted or protected');
				
			delete_avatar($id);;
			$db->query('UPDATE '.$db->prefix.'users SET avatar_link="'.$db->escape(($_POST['req_url']).'" WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());
		}
		else
		{
			if (!isset($_FILES['req_file']))

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

			// Delete any old avatars and put the new one in place
			delete_avatar($id);
			@rename(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.'.tmp', PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension);
			@chmod(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension, 0644);
		}
		else
			message($lang_profile['Unknown failure']);

		redirect('profile.php?section=personality&amp;id='.$id, $lang_profile['Avatar upload redirect']);
	}

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Upload avatar']);
	$required_fields = array('req_file' => $lang_profile['File']);
	$focus_element = array('upload_avatar', 'req_file');

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

				// Delete any old avatars and put the new one in place
				if (!is_null($pun_user['avatar_link']))
					$db->query('UPDATE '.$db->prefix.'users SET avatar_link=NULL WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());
				delete_avatar($id);
				@rename(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.'.tmp', PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension);
				@chmod(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension, 0644);
			}
			else
				message($lang_profile['Unknown failure']);
		}
		redirect('profile.php?section=personality&amp;id='.$id, $lang_profile['Avatar upload redirect']);
	}

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Upload avatar']);
	$required_fields = array();
	$focus_element = array('upload_avatar', 'req_file', 'req_url');
	
#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

						<label class="required"><strong><?php echo $lang_profile['File'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

						<label><strong><?php echo $lang_profile['File'].'...' ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
						<label><strong><?php echo '... or URL' ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_url" type="text" size="40" /><br /></label>

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

	if ($pun_user['id'] != $id && !$pun_user['is_admmod'])
		message($lang_common['No permission']);

	confirm_referrer('profile.php');

	delete_avatar($id);

#---------------------------------------------------------------
# after, add:
#---------------------------------------------------------------

	if (!is_null($pun_user['avatar_link']))
		$db->query('UPDATE '.$db->prefix.'users SET avatar_link=NULL WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig,

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.avatar_link, u.show_sig,

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

		$avatar_field = generate_avatar_markup($id);
	
#---------------------------------------------------------------
# before, add:
#---------------------------------------------------------------

		if (!is_null($user['avatar_link']))
			$avatar_field = '<img src="'.pun_htmlspecialchars($user['avatar_link']).'" '.$img_size[3].' alt="" />';
		else
		
#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

		$user_avatar = generate_avatar_markup($id);
	
#---------------------------------------------------------------
# before, add:
#---------------------------------------------------------------

		if (!is_null($user['avatar_link'])))
			$user_avatar = '<img src="'.pun_htmlspecialchars($user['avatar_link']).'" '.$img_size[3].' alt="" />';
		else


#===============================================================
# open viewtopic.php
#===============================================================


#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts,

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.avatar_link, u.num_posts,

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

			if (isset($user_avatar_cache[$cur_post['poster_id']]))

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

			if (!is_null($cur_post['avatar_link']))
			{	// First have to verify if the link is still ok to display (since it was recorded in the db)
				$avatar_size = @getimagesize($cur_post['avatar_link']);
				if($avatar_size[0] > $pun_config['o_avatars_width'] || $avatar_size[1] > $pun_config['o_avatars_height'] || $avatar_size[0]+$avatar_size[1] == 0)
					$user_avatar = 'Avatar no more displayable';
				else
					$user_avatar = '<img src="'.pun_htmlspecialchars($cur_post['avatar_link']).'" '.$img_size[3].' alt="" />';
			}
			elseif (isset($user_avatar_cache[$cur_post['poster_id']]))


#---------------------------------------------------------------
# Upload...
#---------------------------------------------------------------

Last edited by Wan (2012-03-26 18:07:40)

Offline

#10 2012-03-27 01:10:08

Trandex
Member
Registered: 2012-03-21
Posts: 17
Website

Re: Url avatar 1.4?

Wan wrote:

Here is a readme text adapted to 1.4.8 (and probably others 1.4.x).
I tried to make it safer than the precedent version... hope I aimed the target.
I let you test...

#
#            Name :  Avatar by URL
#
#         Version :  2.0
#  FluxBB version :  1.4.8 (and probably others 1.4.x, you should verify that point)
#          Author :  Wan (wan@cara-vintage.com)
#					 based on a work by Olvean (planetaptor@live.fr) for PunBB 1.2.x
#
#     Description :  Allow user to get an avatar with a simple URL
#
#           Files :  viewtopic.php 
#                    profile.php 
#


#===============================================================
# In your DB
#===============================================================

Add a field in the users table with this parameters :
Column		:	avatar_link
Type		:	TEXT
Default		:	NULL
Collation	:	utf8_general_ci
Null		:	checked


#===============================================================
# open profile.php
#===============================================================


#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

	if (isset($_POST['form_sent']))
	{
		if (!isset($_FILES['req_file']))
	
#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

	if (isset($_POST['form_sent']))
	{
		if ($_POST['req_url'] != '')
		{
			$avatar_size = @getimagesize($_POST['req_url']);
			if($avatar_size[0] > $pun_config['o_avatars_width'] || $avatar_size[1] > $pun_config['o_avatars_height'])
				message($lang_profile['Too wide or high'].' '.$pun_config['o_avatars_width'].'x'.$pun_config['o_avatars_height'].' '.$lang_profile['pixels'].'.');
			if ($avatar_size[0]+$avatar_size[1] == 0)
				message('No image corresponding to this URL or wrong format or maybe image corrupted or protected');
				
			delete_avatar($id);;
			$db->query('UPDATE '.$db->prefix.'users SET avatar_link="'.$db->escape(($_POST['req_url']).'" WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());
		}
		else
		{
			if (!isset($_FILES['req_file']))

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

			// Delete any old avatars and put the new one in place
			delete_avatar($id);
			@rename(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.'.tmp', PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension);
			@chmod(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension, 0644);
		}
		else
			message($lang_profile['Unknown failure']);

		redirect('profile.php?section=personality&amp;id='.$id, $lang_profile['Avatar upload redirect']);
	}

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Upload avatar']);
	$required_fields = array('req_file' => $lang_profile['File']);
	$focus_element = array('upload_avatar', 'req_file');

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

				// Delete any old avatars and put the new one in place
				if (!is_null($pun_user['avatar_link']))
					$db->query('UPDATE '.$db->prefix.'users SET avatar_link=NULL WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());
				delete_avatar($id);
				@rename(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.'.tmp', PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension);
				@chmod(PUN_ROOT.$pun_config['o_avatars_dir'].'/'.$id.$extension, 0644);
			}
			else
				message($lang_profile['Unknown failure']);
		}
		redirect('profile.php?section=personality&amp;id='.$id, $lang_profile['Avatar upload redirect']);
	}

	$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Upload avatar']);
	$required_fields = array();
	$focus_element = array('upload_avatar', 'req_file', 'req_url');
	
#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

						<label class="required"><strong><?php echo $lang_profile['File'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

						<label><strong><?php echo $lang_profile['File'].'...' ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_file" type="file" size="40" /><br /></label>
						<label><strong><?php echo '... or URL' ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input name="req_url" type="text" size="40" /><br /></label>

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

	if ($pun_user['id'] != $id && !$pun_user['is_admmod'])
		message($lang_common['No permission']);

	confirm_referrer('profile.php');

	delete_avatar($id);

#---------------------------------------------------------------
# after, add:
#---------------------------------------------------------------

	if (!is_null($pun_user['avatar_link']))
		$db->query('UPDATE '.$db->prefix.'users SET avatar_link=NULL WHERE id='.$id) or error('Unable to change avatar link', __FILE__, __LINE__, $db->error());

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.show_sig,

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

$result = $db->query('SELECT u.username, u.email, u.title, u.realname, u.url, u.jabber, u.icq, u.msn, u.aim, u.yahoo, u.location, u.signature, u.disp_topics, u.disp_posts, u.email_setting, u.notify_with_post, u.auto_notify, u.show_smilies, u.show_img, u.show_img_sig, u.show_avatars, u.avatar_link, u.show_sig,

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

		$avatar_field = generate_avatar_markup($id);
	
#---------------------------------------------------------------
# before, add:
#---------------------------------------------------------------

		if (!is_null($user['avatar_link']))
			$avatar_field = '<img src="'.pun_htmlspecialchars($user['avatar_link']).'" '.$img_size[3].' alt="" />';
		else
		
#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

		$user_avatar = generate_avatar_markup($id);
	
#---------------------------------------------------------------
# before, add:
#---------------------------------------------------------------

		if (!is_null($user['avatar_link'])))
			$user_avatar = '<img src="'.pun_htmlspecialchars($user['avatar_link']).'" '.$img_size[3].' alt="" />';
		else


#===============================================================
# open viewtopic.php
#===============================================================


#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts,

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.avatar_link, u.num_posts,

#---------------------------------------------------------------
# Search:
#---------------------------------------------------------------

			if (isset($user_avatar_cache[$cur_post['poster_id']]))

#---------------------------------------------------------------
# replace by:
#---------------------------------------------------------------

			if (!is_null($cur_post['avatar_link']))
			{	// First have to verify if the link is still ok to display (since it was recorded in the db)
				$avatar_size = @getimagesize($cur_post['avatar_link']);
				if($avatar_size[0] > $pun_config['o_avatars_width'] || $avatar_size[1] > $pun_config['o_avatars_height'] || $avatar_size[0]+$avatar_size[1] == 0)
					$user_avatar = 'Avatar no more displayable';
				else
					$user_avatar = '<img src="'.pun_htmlspecialchars($cur_post['avatar_link']).'" '.$img_size[3].' alt="" />';
			}
			elseif (isset($user_avatar_cache[$cur_post['poster_id']]))


#---------------------------------------------------------------
# Upload...
#---------------------------------------------------------------

OMG! Thanks for help!

Last edited by Trandex (2012-03-27 20:07:07)

Offline

#11 2012-03-27 04:28:08

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

Trandex wrote:

OMG! Thanks fo help!

You're welcome. Does it work fine ?

Offline

#12 2012-03-29 09:34:45

Wan
Member
From: France
Registered: 2011-10-17
Posts: 45

Re: Url avatar 1.4?

Wan wrote:
Trandex wrote:

OMG! Thanks fo help!

You're welcome. Does it work fine ?

No answer... nerver mind.

Something important about this mod : you should note that the way it is written could constitute a risk for your server :

- If an URL is posted, the function getimagesize used to check the size will cause PHP to first download temporary the remote file to the server. So, a hacker could link to a very large image file and cause the server to be inaccessible or to down.

- If an URL is posted, it would be important to check if image type and file extension are corresponding because a hacker could for example "disguise" a php file as an image file and cause harm.

For both reasons, I'm trying to write a different code in order to increase security in posting URL's and avoid those risks... but it's not as simple as you could think.

Offline

Board footer

Powered by FluxBB