Usuwanie avatarów z galerii
: 18 grudnia 2005, 07:04
Poszukuję moda, który "zabiera" avatar z galerii po tym, jak jakiś user wybierze go dla siebie.
Kod: Zaznacz cały
#################################################################
## Nazwa Moda: Avatar gallery hack
## Wersja Moda: 1.0.0
## Wersja phpBB: 2.0.2
## Autor: dzidzius - dzidzius@dione.ids.pl (możecie też mnie znaleźć na forum www.ForumBest.150.pl, tam wysyłajcie pytania)
## Opis:
## Mod, dzięki któremu raz wybrany przez użytkownika avatar znika z galerii i nie może być ponownie wybrany.
##
## Poziom Trudności Instalacji: łatwy
## Czas Instalacji: 2 minuty
## Pliki do edycji:
##
## includes\usercp_avatar.php,
## Generator: phpBB2 phpBB MODCreator v 1.1
#################################################################
## Warunki Rozpowszechniania:
## Ten mod nie może być dodawany do nieoficjalnych stron o phpBB
#################################################################
## Nota Autora:
#################################################################
## Zanim dodasz ten mod, zrób kopię bezpieczeństwa zmienianych plików.
#################################################################
#
#-----[ TWÓRZ ]------------------------------------------
#
# includes\usercp_avatar.php
#
#-----[ ZNAJDŹ ]------------------------------------------
#
# $dir = @opendir($board_config['avatar_gallery_path']);
#
#-----[ PRZED, DODAJ ]------------------------------------------
#
$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);
#
#-----[ ZNAJDŹ ]------------------------------------------
#
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;
}
}
}
#
#-----[ ZAMIEŃ NA ]------------------------------------------
#
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;
}
}
}
}
#
#-----[ ZAPISZ I ZAMKNIJ WSZYSTKO ]------------------------------------------
#
# EoM
Translated by Polish Translation Group (PTG)