Pagina 1 van 1

avatar verdwijnt uit gallery na selectie door gebruiker.

Geplaatst: 14 okt 2006, 18:31
door Php
Als ik onderstaande mod installeer, zijn alle avatrs uit de gallery ineens verdwenen (niet beschikbaar), je weet wel, wit met een rood kruisje.

Enig idee waar het fout gaat?

Code: Selecteer alles

#################################################################
## Mod Title: Avatar gallery hack
## Mod Version: 1.0.0
## phpBB Version: 2.0.2
## Author: dzidzius - dzidzius@dione.ids.pl (you can find me also at forum www.ForumBest.150.pl, there send all questions)
## Description:
## Avatar from gallery after chosing it by user automatically disappear from gallery. Thanks
## to this hack two users cannot have the same avatar. If user resign from that avatar it will 
## be shown again in gallery.
## Installation Level: easy
## Installation Time: 2
## Files To Edit: 
##
##   includes\usercp_avatar.php, 
## Generator: phpBB2 phpBB MODCreator v 1.1
#################################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
#################################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
#################################################################
## Author Note:
## 
#################################################################
##
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
# includes\usercp_avatar.php
#
#-----[ FIND ]------------------------------------------
#
# $dir = @opendir($board_config['avatar_gallery_path']);
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$my_counter = 0;
$my_checker = 0;
$sql = "SELECT user_avatar
	FROM " . USERS_TABLE . "
	WHERE user_avatar_type=3";

if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
	$my_counter++;
	$my_used_list[$my_counter] = $row['user_avatar'];		
}

$db->sql_freeresult($result);
#
#-----[ FIND ]------------------------------------------
#
while( $sub_file = @readdir($sub_dir) )
{
	if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
	{
		$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file; 
		$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

		$avatar_col_count++;
		if( $avatar_col_count == 5 )
		{
			$avatar_row_count++;
			$avatar_col_count = 0;
		}
	}
}


#
#-----[ REPLACE WITH ]------------------------------------------
#
while( $sub_file = @readdir($sub_dir) )
{
$my_checker = 0;
for ($i = 1; $i<= $my_counter; $i++ )
{
	$my_temp = $file . '/' . $sub_file;
	if ($my_temp == $my_used_list[$i]) $my_checker=1;
	if ($my_checker==1) break;
}
	if ($my_checker == 0)		
	{
		if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
		{
			$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file; 
			$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

			$avatar_col_count++;
			if( $avatar_col_count == 5 )
			{
				$avatar_row_count++;
				$avatar_col_count = 0;
			}
		}
	}
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM