"); function LoadAvatarCategories() { $ignore = array('.', '..'); $avatarCategories = ""; if ($handle = opendir(AVATAR_FOLDER)) { while (false !== ($file = readdir($handle))) { if(!in_array($file, $ignore) && !is_file(AVATAR_FOLDER . '/' . $file)) { $avatarCategories[] = $file; } } closedir($handle); return $avatarCategories; } return false; } function loadAvatarImages($dir) { if ($handle = opendir(AVATAR_FOLDER . $dir)) { while (false !== ($file = readdir($handle))) { if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $file) ) { $avatar_images[] = $file; } } closedir($handle); return (isset($avatar_images)) ? $avatar_images : false; } return false; } function saveAvatar() { global $userdata, $db_prefix, $locale; $output = null; // check that an avatar is selected if(isset($_POST['avatar_save']) && !empty($_POST['avatar_select'])) { // get the avatar category $avatar_studio = $_POST['avatar_studio']; // get the selected avatar $avatar_image = $_POST['avatar_select']; // build the path to the avatar $avatar_path = AVATAR_FOLDER . $avatar_studio . '/' . $avatar_image; // check that the choosen avatar exists if(file_exists($avatar_path)) { $ext = strrchr($avatar_path, '.'); copy($avatar_path, IMAGES.'avatars/avatar['.$userdata['user_id'].']'.$ext); $saveresult = dbquery("UPDATE `".$db_prefix."users` SET `user_avatar` = 'avatar[".$userdata['user_id']."]".$ext."' WHERE `user_id` = '".$userdata['user_id']."' LIMIT 1"); $output .= ""; $output .= "\n

"; $output .= '
'.$locale['AST_004'].'

'; $output .= ''.$locale['AST_005'].'

'; $output .= "".$locale['AST_011']."".$userdata['user_name']."".$locale['AST_012']."



"; $output .= ""; $output .= "
"; }else{ $output .= "\n".$locale['AST_013']."\n\n"; } } return $output; } ?>