Avatar gallery hack
Geplaatst: 11 feb 2007, 19:48
Om even het probleem uit te leggen, ik probeer dus deze MOD te installeren, zodat users een avatar uit de gallery maar 1 keer kunnen kiezen (veel mensen kozen dezelfde en dan kreeg ik geklaag naar m'n hoofd), maar als ik de MOD dan installeer, laten de avatars zich niet meer zien (rood kruisje!)
Nou heb ik ontdekt dat het dan 2 keer is forum/images/avatars/gallery/GALLERYNAAM/GALLERYNAAM/avatar1.jpg, maar ik heb geen idee hoe ik die '2e keer' weg krijg ?
Kan iemand me helpen ?
Hier is de MOD beschrijving:
Nou heb ik ontdekt dat het dan 2 keer is forum/images/avatars/gallery/GALLERYNAAM/GALLERYNAAM/avatar1.jpg, maar ik heb geen idee hoe ik die '2e keer' weg krijg ?
Kan iemand me helpen ?
Hier is de MOD beschrijving:
Code: Selecteer alles
#################################################################
## Mod Title:
## 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