<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./modx/1.2.5.xsl" ?>
<!--NOTICE: Please open this file in your web browser. If presented with a security warning, you may safely tell it to allow the blocked content.-->
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD.\nAlthough MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD.\nNo support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.2.5.xsd">
	<header>
		<meta name="generator" content="MODX file generated with PP MODX Creator by tumba25 (online version)"/>
		<license><![CDATA[http://opensource.org/licenses/gpl-license.php GNU General Public License v2]]></license>
		<title lang="en"><![CDATA[Default Random 'No Avatar'.]]></title>
		<description lang="en"><![CDATA[Random Avatars are displayed by default for users who have not selected an Avatar. Pack includes 17 ‘No Avatar’ images.]]></description>
		<author-notes lang="en"><![CDATA[A Random Avatar will display in the users mini profile beside posts and in their profile.]]></author-notes>
		<author-group>
			<author>
				<username><![CDATA[Boardtalk.net]]></username>
				<homepage><![CDATA[http://www.boardtalk.net]]></homepage>
				<contributions-group>
					<contributions status="current" from="2010-12-02" position="Made the avatars, the language code for 1.0.4a and packed mod as MODX"/>
				</contributions-group>
			</author>
			<author>
				<username><![CDATA[KillBill.]]></username>
				<homepage><![CDATA[http://jatek-vilag.com/]]></homepage>
				<contributions-group>
					<contributions status="current" from="2010-12-15" position="Rewrote mod from version 1.0.2"/>
				</contributions-group>
			</author>
			<author>
				<username><![CDATA[arukAdo]]></username>
				<contributions-group>
					<contributions status="past" position="The idea for random avatars"/>
				</contributions-group>
			</author>
			<author>
				<username><![CDATA[blkJack-21]]></username>
				<contributions-group>
					<contributions status="past" position="The origional author of Universal No Avatar"/>
				</contributions-group>
			</author>
		</author-group>
		<mod-version>1.0.4a</mod-version>
		<installation>
			<level>easy</level>
			<time>300</time>
			<target-version>3.0.8</target-version>
		</installation>
		<history>
			<entry>
				<date>2008-06-13</date>
				<rev-version>0.0.1</rev-version>
				<changelog lang="en">
					<change><![CDATA[Initial Release]]></change>
				</changelog>
			</entry>
			<entry>
				<date>2008-06-20</date>
				<rev-version>1.0.0</rev-version>
				<changelog lang="en">
					<change><![CDATA[Changed code so users that select "No" for "Display Avatars" in UCP will not be affected (previous version did not accomodate for this).]]></change>
				</changelog>
			</entry>
			<entry>
				<date>2010-12-01</date>
				<rev-version>1.0.1</rev-version>
				<changelog lang="en">
					<change><![CDATA[Code change to facilitate Random Avatars and 17 New ‘No Avatar’ images.]]></change>
				</changelog>
			</entry>
			<entry>
				<date>2011-01-09</date>
				<rev-version>1.0.2</rev-version>
				<changelog lang="en">
					<change><![CDATA[Corrected code as suggested by KillBill]]></change>
				</changelog>
			</entry>
			<entry>
				<date>2011-01-10</date>
				<rev-version>1.0.3</rev-version>
				<changelog lang="en">
					<change><![CDATA[Updated code to facilitate GD check as suggested by KillBill.]]></change>
				</changelog>
			</entry>
			<entry>
				<date>2011-01-31</date>
				<rev-version>1.0.4</rev-version>
				<changelog lang="en">
					<change><![CDATA[Change to code]]></change>
				</changelog>
			</entry>
		</history>
		<link-group>
			<link type="contrib" href="contrib/Update_1.0.3_to_1.0.4a/update.xml" lang="en">Upgrade Instructions 1.0.3 to 1.0.4a</link>
			<link type="contrib" href="contrib/Update_1.0.2_to_1.0.3/update.xml" lang="en">Upgrade Instructions 1.0.2 to 1.0.3</link>
			<link type="contrib" href="contrib/Update_1.0.1_to_1.0.2/update.xml" lang="en">Upgrade Instructions 1.0.1 to 1.0.2</link>
			<link type="contrib" href="contrib/Update_1.0.0_to_1.0.1/update.xml" lang="en">Upgrade Instructions 1.0.0 to 1.0.1</link>
			<link type="contrib" href="contrib/Sports_set_avatars/install_sports_avatars.xml" lang="en">Change Avatars to a Sports Set</link>
			<link type="contrib" href="contrib/Update_1.0.0_to_1.0.4a/update.xml" lang="en">Upgrade Instructions 1.0.0 to 1.0.4a</link>
		</link-group>
	</header>
	<action-group>
		<copy>
			<file from="root/images/avatars/random/*.*" to="images/avatars/random/*.*"/>
		</copy>
		<open src="includes/functions_display.php">
			<edit>
				<find><![CDATA[		return '';
	}]]></find>
				<action type="replace-with"><![CDATA[		$random_avatar = $phpbb_root_path . 'images/avatars/random/no_avatar' . mt_rand(1, 17) . '.gif';

		if (file_exists($random_avatar))
		{
			if (!$avatar_width && !$avatar_height)
			{
				if (list($width, $height) = @getimagesize($random_avatar))
				{
					$avatar_width  = $width;
					$avatar_height = $height;
				} 
				else
				{
					$avatar_width = $avatar_height = 100;
				}
			}

			return '<img src="' . $random_avatar . '" width="' . $avatar_width . '" height="' . $avatar_height . '" title="' . ((!empty($user->lang['RANDOM_AVATAR'])) ? $user->lang['RANDOM_AVATAR'] : 'RANDOM_AVATAR') . '" alt="' . ((!empty($user->lang['RANDOM_AVATAR'])) ? $user->lang['RANDOM_AVATAR'] : 'RANDOM_AVATAR') . '"/>';
		}
		else
		{
			return '';
		}
	}]]></action>
			</edit>
		</open>
		<open src="language/en/common.php">
			<edit>
				<find><![CDATA[	'READING_FORUM'				=> 'Viewing topics in %s',]]></find>
				<action type="before-add"><![CDATA[	'RANDOM_AVATAR'				=> 'Random avatar',]]></action>
			</edit>
		</open>
		<diy-instructions lang="en"><![CDATA[The current installed pack of 17 .gif avatars are 94x94 in size but you can make your own and name them the same, then upload the new avatars you have made to root/images/avatars/random/*.*

Don’t forget to purge the cache and if you still don’t see the images, do a Ctrl and F5 (hold down together) to clear your browsers cache.

For any other issues, don’t forget to check your edits and that you’ve uploaded the images to the correct directory path! 

Most important of all… have fun!]]></diy-instructions>
	</action-group>
</mod>
