<?php

/********************************************************/
/* NSN Your Account                                     */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.fr                            */
/* Original Script www.nukescripst.net                  */
/* Copyright © 2000-2005 by NukeScripts Network         */
/* ==================================================== */
/* Based from:                                          */
/* PHP-NUKE: Web Portal System                          */
/********************************************************/
if (!defined('MAXIMUS')) {
header("Location: index.php");
  die();
}
if (!defined('IN_YA')) { die("You can't access this file directly."); }


if (is_user($user)) {
    incoh();
    $avatarcatname = ereg_replace ("_", "&nbsp;", $avatarcategory);
    title($avatarcategory." "._YA_AVATARGALL);
    Max_Opentable();
    nav();
    Max_CloseTable();
    Max_Opentable();
    echo "<center><font class='title'><b>"._AVAILABLEAVATARS." "._YA_ONCAT." ".$avatarcatname."</b></font><br /><br />";
    echo "<b>"._YA_TOSELCTAVAT."</b><br /><br /></center>";
    Max_Opentable2();
    echo "<center>";
    $d = dir("modules/Forums/images/avatars/$avatarcategory");
    $temcount = 1;
    while (false !== ($entry = $d->read())) {
        if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $entry) ) {
            if( $entry != '.' && $entry != '..' && !is_file($d . '/' . $entry) && !is_link($d . '/' . $entry) ) {
                $patterns[0] = "/\.gif/";
                $patterns[1] = "/\.png/";
                $patterns[2] = "/\.jpg/";
                $patterns[3] = "/\.jpeg/";
                $patterns[4] = "/-/";
                $patterns[5] = "/_/";
                $replacements[5] = "";
                $replacements[4] = "&nbsp;";
                $replacements[3] = "";
                $replacements[2] = "";
                $replacements[1] = "";
                $replacements[0] = "";
                ksort($patterns);
                ksort($replacements);
                $entryname =  preg_replace($patterns, $replacements, $entry);
                $a=1;
                echo "<a href=\"modules.php?name=$module_name&op=avatarsave&category=$avatarcategory&avatar=$entry\"><img src=\"modules/Forums/images/avatars/$avatarcategory/$entry\" border=\"0\" alt=\"$entryname\" title=\"$entryname\" hspace=\"10\" vspace=\"10\"></a>";
            }
            if ($temcount == 10) {
                br('1');
                $temcount -= 10;
            }
            $temcount ++;
        }
    }
    echo "</center>";
    Max_CloseTable2();
    echo "<center><br />"._GOBACK."<br /></center>";
    $d->close();
    Max_CloseTable();
    incof();
} else { notuser(); }
?>