<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion='1'>
    <options customize='never'/>
    <options hostArchitectures='i386'/>
    <platforms>
        <client arch="i386"/>
        <server arch="i386"/>
    </platforms>
    <title>SU_TITLE</title>
    <license file="License.rtf" sla="EA0390"/>
    <readme file='SUDescription.html'/>
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <choices-outline>
        <line choice='manual'/>
    </choices-outline>
    <choice id='su' suDisabledGroupID='SecUpd2012-003'>
        <pkg-ref id='com.apple.pkg.update.security.2012.003.leopard' auth='Root'>SecUpd2012-003.pkg</pkg-ref>
    </choice>
    <choice id='manual' title='SU_TITLE'>
        <pkg-ref id='manual' auth='Root'>#SecUpd2012-003.pkg</pkg-ref>
    </choice>
    <choice id='su' title='SU_TITLE'/>
    <choice id='su' versStr='SU_VERS'/>
    <choice id='su' description='SU_DESCRIPTION' description-mime-type='text/html'/>
    <choice id='su' visible='NeedsUpgrade()'/>
    <volume-check script='volumeCheck()'/>
    <script>
function volumeCheck()
{
	if (commonRequirements()) 
	{
		return true;
	}
	my.result.type = 'Fatal';
	my.result.message = system.localizedString('ERROR_INSTALL');
	return(false);
}
	
function commonRequirements() 
{
	try 
	{			
		// must have an OS
		if(false == system.files.fileExistsAtPath(my.target.mountpoint + "/System/Library/CoreServices/SystemVersion.plist")) 
		{
			return (false);
		}

		// 10.5.8 only
		if( (my.target.systemVersion.ProductVersion != '10.5.8')) 
		{
			return (false);
		}
	}
	catch(err) 
	{ 
		return false; 
	}
	return(true);
}

function NeedsUpgrade()
{
	return (!AlreadyInstalled() &amp;&amp; needsFlashUpgrade());
}
	
function needsFlashUpgrade()
{
    var path = "/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist";
    var plist = system.files.plistAtPath(path);

    if( plist )
    {
        var version = plist.CFBundleShortVersionString;
        if (version)
        {
            if (system.compareVersions(version, "10.1.102.64") > 0) 
            {
            	debuglog("Flash is newer than threshold, does not need update.");
            	return false;
            }
            else
            {
            	debuglog("Flash is older than threshold, needs update.");
            	return true;
            }
        }
        else
        {
        	debuglog("Flash has no version? -- needs update");
        	return true;
        }
    }
    else
    {
    	debuglog("No flash installed. No update needed.");
    	return false;
    }
}
	
function AlreadyInstalled()
{
    if (-1 == system.compareVersions(MRTReceiptVersion(),"1.0"))
    {
        debuglog("No receipt, or receipt old enough to qualify.");
        return false;
    }
    else
    {
        debuglog("Receipt too new.");
        return true;
    }
}

function MRTReceiptVersion()
{
    var MRTReceipt = my.target.receiptForIdentifier('com.apple.pkg.update.security.2012.003.leopard');
    if (null == MRTReceipt)
    {
        debuglog("No receipt found for myself");
        return 0;
    }
    else
    {
        var receiptVersion = MRTReceipt.version;
        debuglog("Receipt found, version " + receiptVersion);
        return receiptVersion;
    }
}

var updateName = "SecUpd2012-003";

function debuglog(message)
{
    // yes, this is secure
    if (system.files.fileExistsAtPath("/tmp/com.apple.pkg.testing")) system.log("********** " + updateName + ": " + message);
}
</script>
    <localization>
        <strings language="pl"><![CDATA["SU_VERS" = "1.0";
"SU_SERVERCOMMENT" = "Dla systemów Leopard";
"SU_TITLE" = "Uaktualnienie zabezpieczeń 2012-003 (Leopard)";

"SU_DESCRIPTION"='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Content-Style-Type" content="text/css">
        <title></title>
        <style type="text/css">
            body { font: 11.0px Lucida Grande; }
        </style>
    </head>
    <body>
        <p>W tym uaktualnieniu wyłączono wersje programu Adobe Flash Player, które nie zawierają najnowszych uaktualnień zabezpieczeń, a także udostępniono opcję pobrania aktualnej wersji z witryny Adobe. Więcej informacji na ten temat można znaleźć pod adresem: <a href="http://support.apple.com/kb/HT5271?viewlocale=pl_PL">http://support.apple.com/kb/HT5271?viewlocale=pl_PL</a>.</p>
    </body>
</html>
';
]]></strings>
    </localization>

	<pkg-ref id='com.apple.pkg.update.security.2012.003.leopard' installKBytes='3758' version='1.0.0.0.1.1191932192'/>
</installer-gui-script>