diff --git a/.ssh/New Userscript.user.js b/.ssh/New Userscript.user.js
new file mode 100644
index 0000000..8ab352f
--- /dev/null
+++ b/.ssh/New Userscript.user.js
@@ -0,0 +1,594 @@
+// ==UserScript==
+// @name New Userscript
+// @namespace http://tampermonkey.net/
+// @version 0.1
+// @description try to take over the world!
+// @author You
+// @match http://*/*
+// @grant none
+// ==/UserScript==
+
+
+#
+# Title: CRL_Copy_v2.ps1
+# Date: 5/8/2013
+# Author: Paul Fox (MCS)
+# Copyright Microsoft Corporation @2013
+#
+# Description: This script monitors the remaining lifetime of a CRL, publishes a CRL to a UNC and\or NTFS location and sends notifications via SMTP and EventLog.
+# There are two input arguments:
+# "Monitor" - checks the "master" CRL and the CRL in CDP locations. If the NextUpdate time is within "threshold" an alert will be sent.
+# "Publish" - checks the status of the master CRL and copies the Master CRL to identified CDP locations if the CRL numbers do not match
+# Master CRL and CDP push location must be file system paths (UNC and\or NTFS). The script validates that push was successful by comparing the hash
+# values of the Master and CDP CRLs.
+# Settings are configured within the crl_config.xml file.
+# This script requires the Mono.Security.X509.X509Crl libraries version 2.10.9 (http://www.mono-project.com/Main_Page).
+# Load the PSCX powershell module for the get-hash commandlet (http://pscx.codeplex.com/). Make sure to follow the install instructions in the download's ReadMe.txt file.
+# If ran within the task scheduler using the "Publish" method make sure the process runs as local administrator so it can read CertSvc service status
+# and is given the right to "Logon as a batch job."
+#
+# For debug output type $debugpreference = "continue" at the powershell command prompt.
+#
+
+param ($arg1)
+
+if(!$arg1 -or (($arg1 -ne "publish") -and ($arg1 -ne "monitor")))
+{
+ write-host "Usage: ./crl_copy_v2.ps1 publish|monitor"
+ write-host ""
+ write-host "Example: to publish CRL to CDP locations specified in crl_config.xml"
+ write-host "./crl_copy_v2.ps1 publish"
+ write-host ""
+ write-host "Example: to compare the `"master`" CRL to published CRLs in the CDP locations specified in crl_config.xml"
+write-host "./crl_copy_v2.ps1 monitor"
+exit
+}
+
+#
+# Function: Results
+# Description: Writes the $evtlog_string to the Application eventlog and sends
+# SMTP message to recipients if $SMTP = [bool]$true and $EventLevel <= SMTPThreshold
+#
+function results([string]$evt_string, [string]$evtlog_string, [int]$level, [string]$title, [bool]$sendsmtp, [string]$from, [array]$to, [string]$SmtpServer, [string]$SMTPThreshold, [bool]$published)
+{
+write-debug "******** Inside results function ********"
+write-debug "SMTP = $sendsmtp"
+write-debug "EventLevel: $level"
+write-debug "SMTP threshold: $SMTPThreshold"
+write-debug "Published Notification: $published"
+
+# if eventlog does not exist create it (must run script as local administrator once to create)
+if(![system.diagnostics.eventlog]::sourceExists($EventSource))
+{
+$evtlog = [system.diagnostics.eventlog]::CreateEventSource($EventSource,"Application")
+}
+
+# set eventlog object
+$evtlog = new-object system.diagnostics.eventlog("application",".")
+$evtlog.source = $EventSource
+
+# write to eventlog
+$evtlog.writeEntry($evtlog_string, $level, $EventID)
+
+# send email if sendsmtp = TRUE and event level <= SMTPThreshold or Notify on Publish
+if($sendsmtp -and (($level -le $SMTPThreshold) -or $published))
+{
+write-debug "Sending SMTP"
+if($level -eq $EventHigh)
+{
+$SMTPPriority = "High"
+}
+else
+{
+$SMTPPriority = "Normal"
+}
+$messageParameters = @{
+Subject = $title
+From = $from
+To = $to
+SmtpServer = $SmtpServer
+Body = $evt_string | Out-String
+Priority = $SMTPPriority
+}
+Send-mailMessage @messageParameters -BodyAsHtml
+}
+else
+{
+write-debug "SMTP message not sent"
+}
+
+if($tmp_outfile)
+{
+foreach($file in $tmp_outfile)
+{
+$debug_out = "Outputing to: " + $file
+write-debug $debug_out
+$evt_string | Out-File $file
+}
+}
+else
+{
+write-debug "No output files specified"
+}
+} # end results function
+
+#
+# Function: retrieve
+# Description: Pulls the CRL based upon method
+#
+function retrieve([string]$name, [string]$method, [string]$path)
+{
+$debug_out = "Function: pulling CRL: " + $name + " Method: " + $method + " Path: " + $path
+write-debug $debug_out
+
+switch($method)
+{
+"file" {$retrieved_crl =[Mono.Security.X509.X509Crl]::CreateFromFile($path + $name)
+}
+"ldap" {$CRLNumber = 0
+$i = 0
+$found = [bool]$FALSE
+$tmp = $name.split(".")
+$name = $tmp[0]
+$domain = "LDAP://cn=cdp,cn=public key services,cn=services,cn=configuration," + $path
+$root = New-Object System.DirectoryServices.DirectoryEntry($domain)
+$query = New-Object System.DirectoryServices.DirectorySearcher($root)
+$strFilter = "(&(objectclass=cRLDistributionPoint)(cn=$name))"
+$query.Filter = $strFilter
+$query.SearchScope = "subtree"
+$query.PageSize = 1000
+$results = $query.FindAll()
+
+$debug_out = "LDAP: found " + $results.count + " CRLs"
+write-debug $debug_out
+if($results.count -gt 0)
+{
+# sometimes there might be multiple CRLs in the LDAP location
+# find the highest CRL number and return that one
+foreach($ldapcrl in $results)
+{
+if($ldapcrl.Properties.certificaterevocationlist)
+{
+[byte[]]$lcrl = $ldapcrl.Properties["certificaterevocationlist"][0]
+[Mono.Security.X509.X509Crl]$crl = $lcrl
+$CRLnumberTMP = [Mono.Security.ASN1Convert]::ToInt32($crl.Extensions["2.5.29.20"].ASN1[1].Value)
+if($CRLnumberTMP -ge $CRLNumber)
+{
+$CRLNumber = $CRLnumberTMP
+$result_num = $i
+$found = [bool]$TRUE
+}
+$i++
+}
+} #end foreach
+} # if results > 0
+else
+{
+write-debug "No LDAP CRL found"
+}
+
+if($found)
+{
+[byte[]]$lcrl = $results[$result_num].Properties["certificaterevocationlist"][0]
+$retrieved_crl = [Mono.Security.X509.X509Crl]$lcrl
+}
+else
+{
+$retrieved_crl = $null
+}
+}
+"www" {$web_client = New-Object System.Net.WebClient
+$retrieved_crl = [Mono.Security.X509.X509Crl]$web_client.DownloadData($path + $name)
+}
+default {write-host "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" "
+$evtlog_string = "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline
+$evt_string = $evt_string + "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline
+}
+}
+$debug_out = "Pulled CRL CRLNumber: " + [Mono.Security.ASN1Convert]::ToInt32($retrieved_crl.Extensions["2.5.29.20"].ASN1[1].Value) + $newline
+$debug_out = $debug_out + "Pulled CRL IssuerName: " + $retrieved_crl.IssuerName + $newline
+$debug_out = $debug_out + "Pulled CRL ThisUpdate: " + $retrieved_crl.ThisUpdate.ToLocalTime() + $newline
+$debug_out = $debug_out + "Pulled CRL NextUpdate: " + $retrieved_crl.NextUpdate.ToLocalTime() + $newline
+$debug_out = $debug_out + "Pulled CRL NextCRLPublish: " + [Mono.Security.ASN1Convert]::ToDateTime($retrieved_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + $newline
+write-debug $debug_out
+return [Mono.Security.X509.X509Crl]$retrieved_crl
+} # end of function retrieve
+
+#
+# MAIN
+#
+# Variables
+#
+[xml]$xmlconfigfile = get-content .\crl_config.xml
+$master_name = $xmlconfigfile.configuration.master_crl.name
+$master_retrieval = $xmlconfigfile.configuration.master_crl.retrieval
+$master_path = $xmlconfigfile.configuration.master_crl.path
+$cdps = $xmlconfigfile.configuration.cdps.cdp
+$SMTP = [bool]$xmlconfigfile.configuration.SMTP.send_SMTP
+$SmtpServer = $xmlconfigfile.configuration.SMTP.SmtpServer
+$from = $xmlconfigfile.configuration.SMTP.from
+$to = ($xmlconfigfile.configuration.SMTP.to).split(",")
+$published_notify = [bool]$xmlconfigfile.configuration.SMTP.published_notify
+$notify_of_publish = [bool]$false
+$title = $xmlconfigfile.configuration.SMTP.title
+$SMTPThreshold = $xmlconfigfile.configuration.SMTP.SMTPThreshold
+$EventSource = $xmlconfigfile.configuration.eventvwr.EventSource
+$EventID = $xmlconfigfile.configuration.eventvwr.EventID
+$EventHigh = $xmlconfigfile.configuration.eventvwr.EventHigh
+$EventWarning = $xmlconfigfile.configuration.eventvwr.EventWarning
+$EventInformation = $xmlconfigfile.configuration.eventvwr.EventInformation
+$threshold = $xmlconfigfile.configuration.warnings.threshold
+$threshold_unit = $xmlconfigfile.configuration.warnings.threshold_unit
+$cluster = [bool]$xmlconfigfile.configuration.adcs.cluster
+$publish_html = [bool]$xmlconfigfile.configuration.output.publish
+$tmp_outfile = ($xmlconfigfile.configuration.output.outfile).split(",")
+$newline = [System.Environment]::NewLine
+$time = Get-Date
+$EventLevel = $EventInformation
+
+#
+# Add Mono .Net References
+# If running on an x64 system make sure the path is correct
+#
+Add-Type -Path "C:\Program Files (x86)\Mono-2.10.9\lib\mono\2.0\Mono.Security.dll"
+Import-Module -Name Pscx
+
+#
+# Build the output string header
+#
+$evt_string = "
" + $title + " " + $time + " " + $newline
+$evt_string = $evt_string + "" + $title + " " + $time + " " + $newline
+$evt_string = $evt_string + "" + $newline
+$evt_string = $evt_string + "CRL Name: " + $master_name + $newline
+$evt_string = $evt_string + "Method: " + $arg1 + $newline
+$evt_string = $evt_string + "Warning threshold: " + $threshold + " " + $threshold_unit + " " + $newline
+
+#
+# Eventlog string
+#
+$evtlog_string = $evtlog_string + "CRL Name: " + $master_name + $newline
+$evtlog_string = $evtlog_string + "Method: " + $arg1 + $newline
+$evtlog_string = $evtlog_string + "Warning threshold: " + $threshold + " " + $threshold_unit + $newline
+
+#
+# If ran within the task scheduler, run with admin rights to read the service status
+# Is certsrv running? Is it a clustered CA?
+# If clustered and is not running, send an Informational message
+#
+$service = get-service | where-Object {$_.name -eq "certsvc"}
+if (!($service.Status -eq "Running"))
+{
+if($Cluster)
+{
+$evt_string = $evt_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline
+$evt_string = $evt_string + " " + $newline
+$evtlog_string = $evtlog_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline
+# don't write the HTML output files, the other node will write the files
+$tmp_outfile = $null
+results $evt_string $evtlog_string $EventInformation $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+write-debug "ADCS is not running. This is a clustered node. Exiting"
+exit
+}
+else
+{
+$evt_string = $evt_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT **** " + $newline
+ $evt_string = $evt_string + "Certsvc status is: " + $service.status + " " + $newline
+ $evt_string = $evt_string + "" + $newline
+ $evtlog_string = $evtlog_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT ****" + $newline
+ $evtlog_string = $evtlog_string + "Certsvc status is: " + $service.status + $newline
+ results $evt_string $evtlog_string $EventHigh $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+ write-debug "ADCS is not running and not a clustered node. Not good."
+ exit
+}
+}
+else
+{
+ write-debug "Certsvc is running. Continue."
+}
+
+#
+# Build the output table
+#
+$evt_string = $evt_string + "" + $newline
+$evt_string = $evt_string + " CRL `
+ Path `
+ Number `
+ ThisUpate `
+ NextUpdate `
+ NextCRLPublish `
+ Status "
+if($arg1 -eq "publish")
+{
+ $evt_string = $evt_string + " Published "
+}
+$evt_string = $evt_string + " " + $newline
+
+#
+# Get the master CRL
+#
+write-debug "Pulling master CRL"
+[Mono.Security.X509.X509Crl]$master_crl = retrieve $master_name $master_retrieval $master_path
+if($master_crl)
+{
+ $evt_string = $evt_string + " Master "
+ $evt_string = $evt_string + " " + $master_path + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " "
+ $evt_string = $evt_string + " " + $master_crl.ThisUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + $master_crl.NextUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($master_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " "
+}
+else
+{
+ $EventLevel = $EventHigh
+ $evt_string = $evt_string + "
" + $newline
+ $evt_string = $evt_string + "Unable to retrieve master crl: $master_path$master_name " + $newline
+$evt_string = $evt_string + "" + $newline
+$evtlog_string = $evtlog_string + "Unable to retrieve master crl: $master_name" + $newline
+results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+write-debug $evt_string
+exit
+}
+
+#
+# It looks like IsCurrent method checks againt UTC time
+# So reverting to compare with LocalTime
+#
+if($master_crl.NextUpdate.ToLocalTime() -gt $time)
+{
+# determine if with in threshold warning window
+$delta = new-timespan $time $master_crl.NextUpdate.ToLocalTime()
+$measure = "Total"+$threshold_unit
+if($delta.$measure -gt $threshold)
+{
+$evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Master CRL is current" + $newline
+}
+else
+{
+ $evt_string = $evt_string + " "
+$evtlog_string = $evtlog_string + "Master CRL is soon to expire and is below threshold level" + $newline
+$EventLevel = $EventWarning
+}
+}
+else
+{
+$evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Master CRL has expired" + $newline
+ $EventLevel = $EventHigh
+}
+if($arg1 -eq "publish")
+{
+ $evt_string = $evt_string + " "
+}
+$evt_string = $evt_string + "" + $newline
+
+#
+# Pull CRLs from the CDPs
+#
+write-debug "Pulling CDP CRLs"
+foreach($cdp in $cdps)
+{
+ $cdp_crl = $null
+ [Mono.Security.X509.X509Crl]$cdp_crl = retrieve $master_name $cdp.retrieval $cdp.retrieval_path
+ $evt_string = $evt_string + " " + $cdp.name + " "
+ # if CDP is http then make an HREF
+ if($cdp.retrieval -eq "www")
+ {
+ if($master_name -match " ")
+ {
+ $www_crl = $master_name.replace(" ","%20")
+ }
+ else
+ {
+ $www_crl = $master_name
+ }
+ $evt_string = $evt_string + "" + $cdp.retrieval_path + $www_crl +" "
+ }
+ else
+ {
+ $evt_string = $evt_string + " " + $cdp.retrieval_path + " "
+ }
+
+ if($cdp_crl)
+ {
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " "
+ $evt_string = $evt_string + " " + $cdp_crl.ThisUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + $cdp_crl.NextUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($cdp_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " "
+
+ if($cdp_crl.NextUpdate.ToLocalTime() -gt $time)
+ {
+ # determine if with in threshold warning window
+ $delta = new-timespan $time $cdp_crl.NextUpdate.ToLocalTime()
+ $measure = "Total"+$threshold_unit
+ if($delta.$measure -gt $threshold)
+ {
+ # if within threshold and the CRL numbers do not match set to orange
+ if([Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) -ne [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value))
+ {
+ $evt_string = $evt_string + " "
+$evtlog_string = $evtlog_string + $cdp.name + " CRL number does not match master CRL" + $newline
+}
+else
+{
+$evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " is current" + $newline
+ }
+ }
+ else
+ {
+ # within the threshold window
+ $evt_string = $evt_string + " "
+$evtlog_string = $evtlog_string + $cdp.name + " is soon to expire and is below threshold level" + $newline
+if($EventLevel -gt $EventWarning){$EventLevel = $EventWarning}
+}
+}
+else
+{
+# expired
+$evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " has expired" + $newline
+ if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh}
+ }
+ } # end $cdp_crl exists
+ else
+ {
+ $EventLevel = $EventWarning
+ $evt_string = $evt_string + "Unable to retrieve crl " + $newline
+ $evt_string = $evt_string + " "
+$evtlog_string = $evtlog_string + "Unable to retrieve crl: " + $cdp.retrieval_path + $master_name + $newline
+}
+
+
+if($arg1 -eq "publish")
+{
+if($cdp.push)
+{
+# push master CRL out to location if master CRL # > CDP CRL #
+if([Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) -gt [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value))
+{
+# only file copy at this time
+write-debug "Master CRL is newer, pushing out"
+$source_path = $master_path + $master_Name
+$source = Get-Item $source_path
+$dest_path = $cdp.push_path + $master_Name
+Copy-Item $source $dest_path
+
+# Compare the hash values of the master CRL to the copied CDP CRL
+# If they do not equal alert via SMTP set event level to high
+$master_hash = get-hash $source_path
+write-debug $master_hash.HashString
+$cdp_hash = get-hash $dest_path
+write-debug $cdp_hash.HashString
+if($master_hash.HashString -ne $cdp_hash.HashString)
+{
+$evt_string = $evt_string + " failed "
+ $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " failed" + $newline
+ if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh}
+ }
+ else
+ {
+ write-debug "Push succeeded"
+ $evt_string = $evt_string + " " + $time + " "
+$evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " succeeded" + $newline
+# determine if we need to send an SMTP message
+if($published_notify)
+{
+$notify_of_publish = $published_notify
+}
+}
+} #end if master crl # > cdp crl #
+else
+{
+$evt_string = $evt_string + " "
+}
+} #end if $cdp.push = TRUE
+else
+{
+$evt_string = $evt_string + " "
+}
+} #end of if arg1 = publish
+
+
+$evt_string = $evt_string + " " + $newline
+write-debug "----------------"
+} #end of foreach $cdps
+
+#
+# Close up the table
+#
+$evt_string = $evt_string + "" + $newline
+
+#
+# Send results
+#
+results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+
+
+
+
+CRL_Config.XML
+XML
+
+
+
+
+issuingca.crl
+file
+C:\Windows\System32\certsrv\CertEnroll\
+
+
+
+
+internal cdp1
+www
+http://www.f.internal/pki/
+true
+file
+\\www.f.internal\pki\
+
+
+
+internal ldap
+ldap
+dc=f,dc=internal
+
+
+
+
+
+
+external cdp
+www
+http://pki.g.internal/pki/
+
+
+
+
+
+
+
+true
+exchange.f.internal
+crlcopy@f.internal
+pfox@f.internal,pierref@f.internal
+true
+CRL Copy Process Results
+2
+
+
+
+CRL Copy Process
+5000
+1
+2
+4
+
+
+
+5
+hours
+
+
+
+
+
+
+
+c:\windows\system32\certsrv\certenroll\CRLCopy.htm,\\www.f.internal\pki\CRLCopy.htm
+
+
+
+function # # Title: CRL_Copy_v2.ps1 # Date: 5/8/2013 # Author: Paul Fox (MCS) # Copyright Microsoft Corporation @2013 # # Description: This script monitors the remaining lifetime of a CRL, publishes a CRL to a UNC and\or NTFS location and sends notifications via SMTP and EventLog. # There are two input arguments: # "Monitor" - checks the "master" CRL and the CRL in CDP locations. If the NextUpdate time is within "threshold" an alert will be sent. # "Publish" - checks the status of the master CRL and copies the Master CRL to identified CDP locations if the CRL numbers do not match # Master CRL and CDP push location must be file system paths (UNC and\or NTFS). The script validates that push was successful by comparing the hash # values of the Master and CDP CRLs. # Settings are configured within the crl_config.xml file. # This script requires the Mono.Security.X509.X509Crl libraries version 2.10.9 (http://www.mono-project.com/Main_Page). # Load the PSCX powershell module for the get-hash commandlet (http://pscx.codeplex.com/). Make sure to follow the install instructions in the download's ReadMe.txt file. # If ran within the task scheduler using the "Publish" method make sure the process runs as local administrator so it can read CertSvc service status # and is given the right to "Logon as a batch job." # # For debug output type $debugpreference = "continue" at the powershell command prompt. # param ($arg1) if(!$arg1 -or (($arg1 -ne "publish") -and ($arg1 -ne "monitor"))) { write-host "Usage: ./crl_copy_v2.ps1 publish|monitor" write-host "" write-host "Example: to publish CRL to CDP locations specified in crl_config.xml" write-host "./crl_copy_v2.ps1 publish" write-host "" write-host "Example: to compare the `"master`" CRL to published CRLs in the CDP locations specified in crl_config.xml" write-host "./crl_copy_v2.ps1 monitor" exit } # # Function: Results # Description: Writes the $evtlog_string to the Application eventlog and sends # SMTP message to recipients if $SMTP = [bool]$true and $EventLevel <= SMTPThreshold # function results([string]$evt_string, [string]$evtlog_string, [int]$level, [string]$title, [bool]$sendsmtp, [string]$from, [array]$to, [string]$SmtpServer, [string]$SMTPThreshold, [bool]$published) { write-debug "******** Inside results function ********" write-debug "SMTP = $sendsmtp" write-debug "EventLevel: $level" write-debug "SMTP threshold: $SMTPThreshold" write-debug "Published Notification: $published" # if eventlog does not exist create it (must run script as local administrator once to create) if(![system.diagnostics.eventlog]::sourceExists($EventSource)) { $evtlog = [system.diagnostics.eventlog]::CreateEventSource($EventSource,"Application") } # set eventlog object $evtlog = new-object system.diagnostics.eventlog("application",".") $evtlog.source = $EventSource # write to eventlog $evtlog.writeEntry($evtlog_string, $level, $EventID) # send email if sendsmtp = TRUE and event level <= SMTPThreshold or Notify on Publish if($sendsmtp -and (($level -le $SMTPThreshold) -or $published)) { write-debug "Sending SMTP" if($level -eq $EventHigh) { $SMTPPriority = "High" } else { $SMTPPriority = "Normal" } $messageParameters = @{ Subject = $title From = $from To = $to SmtpServer = $SmtpServer Body = $evt_string | Out-String Priority = $SMTPPriority } Send-mailMessage @messageParameters -BodyAsHtml } else { write-debug "SMTP message not sent" } if($tmp_outfile) { foreach($file in $tmp_outfile) { $debug_out = "Outputing to: " + $file write-debug $debug_out $evt_string | Out-File $file } } else { write-debug "No output files specified" } } # end results function # # Function: retrieve # Description: Pulls the CRL based upon method # function retrieve([string]$name, [string]$method, [string]$path) { $debug_out = "Function: pulling CRL: " + $name + " Method: " + $method + " Path: " + $path write-debug $debug_out switch($method) { "file" {$retrieved_crl =[Mono.Security.X509.X509Crl]::CreateFromFile($path + $name) } "ldap" {$CRLNumber = 0 $i = 0 $found = [bool]$FALSE $tmp = $name.split(".") $name = $tmp[0] $domain = "LDAP://cn=cdp,cn=public key services,cn=services,cn=configuration," + $path $root = New-Object System.DirectoryServices.DirectoryEntry($domain) $query = New-Object System.DirectoryServices.DirectorySearcher($root) $strFilter = "(&(objectclass=cRLDistributionPoint)(cn=$name))" $query.Filter = $strFilter $query.SearchScope = "subtree" $query.PageSize = 1000 $results = $query.FindAll() $debug_out = "LDAP: found " + $results.count + " CRLs" write-debug $debug_out if($results.count -gt 0) { # sometimes there might be multiple CRLs in the LDAP location # find the highest CRL number and return that one foreach($ldapcrl in $results) { if($ldapcrl.Properties.certificaterevocationlist) { [byte[]]$lcrl = $ldapcrl.Properties["certificaterevocationlist"][0] [Mono.Security.X509.X509Crl]$crl = $lcrl $CRLnumberTMP = [Mono.Security.ASN1Convert]::ToInt32($crl.Extensions["2.5.29.20"].ASN1[1].Value) if($CRLnumberTMP -ge $CRLNumber) { $CRLNumber = $CRLnumberTMP $result_num = $i $found = [bool]$TRUE } $i++ } } #end foreach } # if results > 0 else { write-debug "No LDAP CRL found" } if($found) { [byte[]]$lcrl = $results[$result_num].Properties["certificaterevocationlist"][0] $retrieved_crl = [Mono.Security.X509.X509Crl]$lcrl } else { $retrieved_crl = $null } } "www" {$web_client = New-Object System.Net.WebClient $retrieved_crl = [Mono.Security.X509.X509Crl]$web_client.DownloadData($path + $name) } default {write-host "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " $evtlog_string = "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline $evt_string = $evt_string + "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline } } $debug_out = "Pulled CRL CRLNumber: " + [Mono.Security.ASN1Convert]::ToInt32($retrieved_crl.Extensions["2.5.29.20"].ASN1[1].Value) + $newline $debug_out = $debug_out + "Pulled CRL IssuerName: " + $retrieved_crl.IssuerName + $newline $debug_out = $debug_out + "Pulled CRL ThisUpdate: " + $retrieved_crl.ThisUpdate.ToLocalTime() + $newline $debug_out = $debug_out + "Pulled CRL NextUpdate: " + $retrieved_crl.NextUpdate.ToLocalTime() + $newline $debug_out = $debug_out + "Pulled CRL NextCRLPublish: " + [Mono.Security.ASN1Convert]::ToDateTime($retrieved_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + $newline write-debug $debug_out return [Mono.Security.X509.X509Crl]$retrieved_crl } # end of function retrieve # # MAIN # # Variables # [xml]$xmlconfigfile = get-content .\crl_config.xml $master_name = $xmlconfigfile.configuration.master_crl.name $master_retrieval = $xmlconfigfile.configuration.master_crl.retrieval $master_path = $xmlconfigfile.configuration.master_crl.path $cdps = $xmlconfigfile.configuration.cdps.cdp $SMTP = [bool]$xmlconfigfile.configuration.SMTP.send_SMTP $SmtpServer = $xmlconfigfile.configuration.SMTP.SmtpServer $from = $xmlconfigfile.configuration.SMTP.from $to = ($xmlconfigfile.configuration.SMTP.to).split(",") $published_notify = [bool]$xmlconfigfile.configuration.SMTP.published_notify $notify_of_publish = [bool]$false $title = $xmlconfigfile.configuration.SMTP.title $SMTPThreshold = $xmlconfigfile.configuration.SMTP.SMTPThreshold $EventSource = $xmlconfigfile.configuration.eventvwr.EventSource $EventID = $xmlconfigfile.configuration.eventvwr.EventID $EventHigh = $xmlconfigfile.configuration.eventvwr.EventHigh $EventWarning = $xmlconfigfile.configuration.eventvwr.EventWarning $EventInformation = $xmlconfigfile.configuration.eventvwr.EventInformation $threshold = $xmlconfigfile.configuration.warnings.threshold $threshold_unit = $xmlconfigfile.configuration.warnings.threshold_unit $cluster = [bool]$xmlconfigfile.configuration.adcs.cluster $publish_html = [bool]$xmlconfigfile.configuration.output.publish $tmp_outfile = ($xmlconfigfile.configuration.output.outfile).split(",") $newline = [System.Environment]::NewLine $time = Get-Date $EventLevel = $EventInformation # # Add Mono .Net References # If running on an x64 system make sure the path is correct # Add-Type -Path "C:\Program Files (x86)\Mono-2.10.9\lib\mono\2.0\Mono.Security.dll" Import-Module -Name Pscx # # Build the output string header # $evt_string = "" + $title + " " + $time + " " + $newline $evt_string = $evt_string + "" + $title + " " + $time + " " + $newline $evt_string = $evt_string + "" + $newline $evt_string = $evt_string + "CRL Name: " + $master_name + $newline $evt_string = $evt_string + "Method: " + $arg1 + $newline $evt_string = $evt_string + "Warning threshold: " + $threshold + " " + $threshold_unit + " " + $newline # # Eventlog string # $evtlog_string = $evtlog_string + "CRL Name: " + $master_name + $newline $evtlog_string = $evtlog_string + "Method: " + $arg1 + $newline $evtlog_string = $evtlog_string + "Warning threshold: " + $threshold + " " + $threshold_unit + $newline # # If ran within the task scheduler, run with admin rights to read the service status # Is certsrv running? Is it a clustered CA? # If clustered and is not running, send an Informational message # $service = get-service | where-Object {$_.name -eq "certsvc"} if (!($service.Status -eq "Running")) { if($Cluster) { $evt_string = $evt_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline $evt_string = $evt_string + " " + $newline $evtlog_string = $evtlog_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline # don't write the HTML output files, the other node will write the files $tmp_outfile = $null results $evt_string $evtlog_string $EventInformation $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug "ADCS is not running. This is a clustered node. Exiting" exit } else { $evt_string = $evt_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT **** " + $newline $evt_string = $evt_string + "Certsvc status is: " + $service.status + " " + $newline $evt_string = $evt_string + "" + $newline $evtlog_string = $evtlog_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT ****" + $newline $evtlog_string = $evtlog_string + "Certsvc status is: " + $service.status + $newline results $evt_string $evtlog_string $EventHigh $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug "ADCS is not running and not a clustered node. Not good." exit } } else { write-debug "Certsvc is running. Continue." } # # Build the output table # $evt_string = $evt_string + "" + $newline $evt_string = $evt_string + " CRL ` Path ` Number ` ThisUpate ` NextUpdate ` NextCRLPublish ` Status " if($arg1 -eq "publish") { $evt_string = $evt_string + " Published " } $evt_string = $evt_string + " " + $newline # # Get the master CRL # write-debug "Pulling master CRL" [Mono.Security.X509.X509Crl]$master_crl = retrieve $master_name $master_retrieval $master_path if($master_crl) { $evt_string = $evt_string + " Master " $evt_string = $evt_string + " " + $master_path + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " " $evt_string = $evt_string + " " + $master_crl.ThisUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + $master_crl.NextUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($master_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " " } else { $EventLevel = $EventHigh $evt_string = $evt_string + "
" + $newline $evt_string = $evt_string + "Unable to retrieve master crl: $master_path$master_name " + $newline $evt_string = $evt_string + "" + $newline $evtlog_string = $evtlog_string + "Unable to retrieve master crl: $master_name" + $newline results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug $evt_string exit } # # It looks like IsCurrent method checks againt UTC time # So reverting to compare with LocalTime # if($master_crl.NextUpdate.ToLocalTime() -gt $time) { # determine if with in threshold warning window $delta = new-timespan $time $master_crl.NextUpdate.ToLocalTime() $measure = "Total"+$threshold_unit if($delta.$measure -gt $threshold) { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL is current" + $newline } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL is soon to expire and is below threshold level" + $newline $EventLevel = $EventWarning } } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL has expired" + $newline $EventLevel = $EventHigh } if($arg1 -eq "publish") { $evt_string = $evt_string + " " } $evt_string = $evt_string + "" + $newline # # Pull CRLs from the CDPs # write-debug "Pulling CDP CRLs" foreach($cdp in $cdps) { $cdp_crl = $null [Mono.Security.X509.X509Crl]$cdp_crl = retrieve $master_name $cdp.retrieval $cdp.retrieval_path $evt_string = $evt_string + " " + $cdp.name + " " # if CDP is http then make an HREF if($cdp.retrieval -eq "www") { if($master_name -match " ") { $www_crl = $master_name.replace(" ","%20") } else { $www_crl = $master_name } $evt_string = $evt_string + "" + $cdp.retrieval_path + $www_crl +" " } else { $evt_string = $evt_string + " " + $cdp.retrieval_path + " " } if($cdp_crl) { $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " " $evt_string = $evt_string + " " + $cdp_crl.ThisUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + $cdp_crl.NextUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($cdp_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " " if($cdp_crl.NextUpdate.ToLocalTime() -gt $time) { # determine if with in threshold warning window $delta = new-timespan $time $cdp_crl.NextUpdate.ToLocalTime() $measure = "Total"+$threshold_unit if($delta.$measure -gt $threshold) { # if within threshold and the CRL numbers do not match set to orange if([Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) -ne [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value)) { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " CRL number does not match master CRL" + $newline } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " is current" + $newline } } else { # within the threshold window $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " is soon to expire and is below threshold level" + $newline if($EventLevel -gt $EventWarning){$EventLevel = $EventWarning} } } else { # expired $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " has expired" + $newline if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh} } } # end $cdp_crl exists else { $EventLevel = $EventWarning $evt_string = $evt_string + "Unable to retrieve crl " + $newline $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Unable to retrieve crl: " + $cdp.retrieval_path + $master_name + $newline } if($arg1 -eq "publish") { if($cdp.push) { # push master CRL out to location if master CRL # > CDP CRL # if([Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) -gt [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value)) { # only file copy at this time write-debug "Master CRL is newer, pushing out" $source_path = $master_path + $master_Name $source = Get-Item $source_path $dest_path = $cdp.push_path + $master_Name Copy-Item $source $dest_path # Compare the hash values of the master CRL to the copied CDP CRL # If they do not equal alert via SMTP set event level to high $master_hash = get-hash $source_path write-debug $master_hash.HashString $cdp_hash = get-hash $dest_path write-debug $cdp_hash.HashString if($master_hash.HashString -ne $cdp_hash.HashString) { $evt_string = $evt_string + " failed " $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " failed" + $newline if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh} } else { write-debug "Push succeeded" $evt_string = $evt_string + " " + $time + " " $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " succeeded" + $newline # determine if we need to send an SMTP message if($published_notify) { $notify_of_publish = $published_notify } } } #end if master crl # > cdp crl # else { $evt_string = $evt_string + " " } } #end if $cdp.push = TRUE else { $evt_string = $evt_string + " " } } #end of if arg1 = publish $evt_string = $evt_string + " " + $newline write-debug "----------------" } #end of foreach $cdps # # Close up the table # $evt_string = $evt_string + "" + $newline # # Send results # results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish CRL_Config.XML XML issuingca.crl file C:\Windows\System32\certsrv\CertEnroll\ internal cdp1 www http://www.f.internal/pki/ true file \\www.f.internal\pki\ internal ldap ldap dc=f,dc=internal external cdp www http://pki.g.internal/pki/ true exchange.f.internal crlcopy@f.internal pfox@f.internal,pierref@f.internal true CRL Copy Process Results 2 CRL Copy Process 5000 1 2 4 5 hours c:\windows\system32\certsrv\certenroll\CRLCopy.htm,\\www.f.internal\pki\CRLCopy.htm () {
+
+}
+
+# # Title: CRL_Copy_v2.ps1 # Date: 5/8/2013 # Author: Paul Fox (MCS) # Copyright Microsoft Corporation @2013 # # Description: This script monitors the remaining lifetime of a CRL, publishes a CRL to a UNC and\or NTFS location and sends notifications via SMTP and EventLog. # There are two input arguments: # "Monitor" - checks the "master" CRL and the CRL in CDP locations. If the NextUpdate time is within "threshold" an alert will be sent. # "Publish" - checks the status of the master CRL and copies the Master CRL to identified CDP locations if the CRL numbers do not match # Master CRL and CDP push location must be file system paths (UNC and\or NTFS). The script validates that push was successful by comparing the hash # values of the Master and CDP CRLs. # Settings are configured within the crl_config.xml file. # This script requires the Mono.Security.X509.X509Crl libraries version 2.10.9 (http://www.mono-project.com/Main_Page). # Load the PSCX powershell module for the get-hash commandlet (http://pscx.codeplex.com/). Make sure to follow the install instructions in the download's ReadMe.txt file. # If ran within the task scheduler using the "Publish" method make sure the process runs as local administrator so it can read CertSvc service status # and is given the right to "Logon as a batch job." # # For debug output type $debugpreference = "continue" at the powershell command prompt. # param ($arg1) if(!$arg1 -or (($arg1 -ne "publish") -and ($arg1 -ne "monitor"))) { write-host "Usage: ./crl_copy_v2.ps1 publish|monitor" write-host "" write-host "Example: to publish CRL to CDP locations specified in crl_config.xml" write-host "./crl_copy_v2.ps1 publish" write-host "" write-host "Example: to compare the `"master`" CRL to published CRLs in the CDP locations specified in crl_config.xml" write-host "./crl_copy_v2.ps1 monitor" exit } # # Function: Results # Description: Writes the $evtlog_string to the Application eventlog and sends # SMTP message to recipients if $SMTP = [bool]$true and $EventLevel <= SMTPThreshold # function results([string]$evt_string, [string]$evtlog_string, [int]$level, [string]$title, [bool]$sendsmtp, [string]$from, [array]$to, [string]$SmtpServer, [string]$SMTPThreshold, [bool]$published) { write-debug "******** Inside results function ********" write-debug "SMTP = $sendsmtp" write-debug "EventLevel: $level" write-debug "SMTP threshold: $SMTPThreshold" write-debug "Published Notification: $published" # if eventlog does not exist create it (must run script as local administrator once to create) if(![system.diagnostics.eventlog]::sourceExists($EventSource)) { $evtlog = [system.diagnostics.eventlog]::CreateEventSource($EventSource,"Application") } # set eventlog object $evtlog = new-object system.diagnostics.eventlog("application",".") $evtlog.source = $EventSource # write to eventlog $evtlog.writeEntry($evtlog_string, $level, $EventID) # send email if sendsmtp = TRUE and event level <= SMTPThreshold or Notify on Publish if($sendsmtp -and (($level -le $SMTPThreshold) -or $published)) { write-debug "Sending SMTP" if($level -eq $EventHigh) { $SMTPPriority = "High" } else { $SMTPPriority = "Normal" } $messageParameters = @{ Subject = $title From = $from To = $to SmtpServer = $SmtpServer Body = $evt_string | Out-String Priority = $SMTPPriority } Send-mailMessage @messageParameters -BodyAsHtml } else { write-debug "SMTP message not sent" } if($tmp_outfile) { foreach($file in $tmp_outfile) { $debug_out = "Outputing to: " + $file write-debug $debug_out $evt_string | Out-File $file } } else { write-debug "No output files specified" } } # end results function # # Function: retrieve # Description: Pulls the CRL based upon method # function retrieve([string]$name, [string]$method, [string]$path) { $debug_out = "Function: pulling CRL: " + $name + " Method: " + $method + " Path: " + $path write-debug $debug_out switch($method) { "file" {$retrieved_crl =[Mono.Security.X509.X509Crl]::CreateFromFile($path + $name) } "ldap" {$CRLNumber = 0 $i = 0 $found = [bool]$FALSE $tmp = $name.split(".") $name = $tmp[0] $domain = "LDAP://cn=cdp,cn=public key services,cn=services,cn=configuration," + $path $root = New-Object System.DirectoryServices.DirectoryEntry($domain) $query = New-Object System.DirectoryServices.DirectorySearcher($root) $strFilter = "(&(objectclass=cRLDistributionPoint)(cn=$name))" $query.Filter = $strFilter $query.SearchScope = "subtree" $query.PageSize = 1000 $results = $query.FindAll() $debug_out = "LDAP: found " + $results.count + " CRLs" write-debug $debug_out if($results.count -gt 0) { # sometimes there might be multiple CRLs in the LDAP location # find the highest CRL number and return that one foreach($ldapcrl in $results) { if($ldapcrl.Properties.certificaterevocationlist) { [byte[]]$lcrl = $ldapcrl.Properties["certificaterevocationlist"][0] [Mono.Security.X509.X509Crl]$crl = $lcrl $CRLnumberTMP = [Mono.Security.ASN1Convert]::ToInt32($crl.Extensions["2.5.29.20"].ASN1[1].Value) if($CRLnumberTMP -ge $CRLNumber) { $CRLNumber = $CRLnumberTMP $result_num = $i $found = [bool]$TRUE } $i++ } } #end foreach } # if results > 0 else { write-debug "No LDAP CRL found" } if($found) { [byte[]]$lcrl = $results[$result_num].Properties["certificaterevocationlist"][0] $retrieved_crl = [Mono.Security.X509.X509Crl]$lcrl } else { $retrieved_crl = $null } } "www" {$web_client = New-Object System.Net.WebClient $retrieved_crl = [Mono.Security.X509.X509Crl]$web_client.DownloadData($path + $name) } default {write-host "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " $evtlog_string = "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline $evt_string = $evt_string + "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline } } $debug_out = "Pulled CRL CRLNumber: " + [Mono.Security.ASN1Convert]::ToInt32($retrieved_crl.Extensions["2.5.29.20"].ASN1[1].Value) + $newline $debug_out = $debug_out + "Pulled CRL IssuerName: " + $retrieved_crl.IssuerName + $newline $debug_out = $debug_out + "Pulled CRL ThisUpdate: " + $retrieved_crl.ThisUpdate.ToLocalTime() + $newline $debug_out = $debug_out + "Pulled CRL NextUpdate: " + $retrieved_crl.NextUpdate.ToLocalTime() + $newline $debug_out = $debug_out + "Pulled CRL NextCRLPublish: " + [Mono.Security.ASN1Convert]::ToDateTime($retrieved_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + $newline write-debug $debug_out return [Mono.Security.X509.X509Crl]$retrieved_crl } # end of function retrieve # # MAIN # # Variables # [xml]$xmlconfigfile = get-content .\crl_config.xml $master_name = $xmlconfigfile.configuration.master_crl.name $master_retrieval = $xmlconfigfile.configuration.master_crl.retrieval $master_path = $xmlconfigfile.configuration.master_crl.path $cdps = $xmlconfigfile.configuration.cdps.cdp $SMTP = [bool]$xmlconfigfile.configuration.SMTP.send_SMTP $SmtpServer = $xmlconfigfile.configuration.SMTP.SmtpServer $from = $xmlconfigfile.configuration.SMTP.from $to = ($xmlconfigfile.configuration.SMTP.to).split(",") $published_notify = [bool]$xmlconfigfile.configuration.SMTP.published_notify $notify_of_publish = [bool]$false $title = $xmlconfigfile.configuration.SMTP.title $SMTPThreshold = $xmlconfigfile.configuration.SMTP.SMTPThreshold $EventSource = $xmlconfigfile.configuration.eventvwr.EventSource $EventID = $xmlconfigfile.configuration.eventvwr.EventID $EventHigh = $xmlconfigfile.configuration.eventvwr.EventHigh $EventWarning = $xmlconfigfile.configuration.eventvwr.EventWarning $EventInformation = $xmlconfigfile.configuration.eventvwr.EventInformation $threshold = $xmlconfigfile.configuration.warnings.threshold $threshold_unit = $xmlconfigfile.configuration.warnings.threshold_unit $cluster = [bool]$xmlconfigfile.configuration.adcs.cluster $publish_html = [bool]$xmlconfigfile.configuration.output.publish $tmp_outfile = ($xmlconfigfile.configuration.output.outfile).split(",") $newline = [System.Environment]::NewLine $time = Get-Date $EventLevel = $EventInformation # # Add Mono .Net References # If running on an x64 system make sure the path is correct # Add-Type -Path "C:\Program Files (x86)\Mono-2.10.9\lib\mono\2.0\Mono.Security.dll" Import-Module -Name Pscx # # Build the output string header # $evt_string = "" + $title + " " + $time + " " + $newline $evt_string = $evt_string + "" + $title + " " + $time + " " + $newline $evt_string = $evt_string + "" + $newline $evt_string = $evt_string + "CRL Name: " + $master_name + $newline $evt_string = $evt_string + "Method: " + $arg1 + $newline $evt_string = $evt_string + "Warning threshold: " + $threshold + " " + $threshold_unit + " " + $newline # # Eventlog string # $evtlog_string = $evtlog_string + "CRL Name: " + $master_name + $newline $evtlog_string = $evtlog_string + "Method: " + $arg1 + $newline $evtlog_string = $evtlog_string + "Warning threshold: " + $threshold + " " + $threshold_unit + $newline # # If ran within the task scheduler, run with admin rights to read the service status # Is certsrv running? Is it a clustered CA? # If clustered and is not running, send an Informational message # $service = get-service | where-Object {$_.name -eq "certsvc"} if (!($service.Status -eq "Running")) { if($Cluster) { $evt_string = $evt_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline $evt_string = $evt_string + " " + $newline $evtlog_string = $evtlog_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline # don't write the HTML output files, the other node will write the files $tmp_outfile = $null results $evt_string $evtlog_string $EventInformation $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug "ADCS is not running. This is a clustered node. Exiting" exit } else { $evt_string = $evt_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT **** " + $newline $evt_string = $evt_string + "Certsvc status is: " + $service.status + " " + $newline $evt_string = $evt_string + "" + $newline $evtlog_string = $evtlog_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT ****" + $newline $evtlog_string = $evtlog_string + "Certsvc status is: " + $service.status + $newline results $evt_string $evtlog_string $EventHigh $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug "ADCS is not running and not a clustered node. Not good." exit } } else { write-debug "Certsvc is running. Continue." } # # Build the output table # $evt_string = $evt_string + "" + $newline $evt_string = $evt_string + " CRL ` Path ` Number ` ThisUpate ` NextUpdate ` NextCRLPublish ` Status " if($arg1 -eq "publish") { $evt_string = $evt_string + " Published " } $evt_string = $evt_string + " " + $newline # # Get the master CRL # write-debug "Pulling master CRL" [Mono.Security.X509.X509Crl]$master_crl = retrieve $master_name $master_retrieval $master_path if($master_crl) { $evt_string = $evt_string + " Master " $evt_string = $evt_string + " " + $master_path + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " " $evt_string = $evt_string + " " + $master_crl.ThisUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + $master_crl.NextUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($master_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " " } else { $EventLevel = $EventHigh $evt_string = $evt_string + "
" + $newline $evt_string = $evt_string + "Unable to retrieve master crl: $master_path$master_name " + $newline $evt_string = $evt_string + "" + $newline $evtlog_string = $evtlog_string + "Unable to retrieve master crl: $master_name" + $newline results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish write-debug $evt_string exit } # # It looks like IsCurrent method checks againt UTC time # So reverting to compare with LocalTime # if($master_crl.NextUpdate.ToLocalTime() -gt $time) { # determine if with in threshold warning window $delta = new-timespan $time $master_crl.NextUpdate.ToLocalTime() $measure = "Total"+$threshold_unit if($delta.$measure -gt $threshold) { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL is current" + $newline } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL is soon to expire and is below threshold level" + $newline $EventLevel = $EventWarning } } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Master CRL has expired" + $newline $EventLevel = $EventHigh } if($arg1 -eq "publish") { $evt_string = $evt_string + " " } $evt_string = $evt_string + "" + $newline # # Pull CRLs from the CDPs # write-debug "Pulling CDP CRLs" foreach($cdp in $cdps) { $cdp_crl = $null [Mono.Security.X509.X509Crl]$cdp_crl = retrieve $master_name $cdp.retrieval $cdp.retrieval_path $evt_string = $evt_string + " " + $cdp.name + " " # if CDP is http then make an HREF if($cdp.retrieval -eq "www") { if($master_name -match " ") { $www_crl = $master_name.replace(" ","%20") } else { $www_crl = $master_name } $evt_string = $evt_string + "" + $cdp.retrieval_path + $www_crl +" " } else { $evt_string = $evt_string + " " + $cdp.retrieval_path + " " } if($cdp_crl) { $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " " $evt_string = $evt_string + " " + $cdp_crl.ThisUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + $cdp_crl.NextUpdate.ToLocalTime() + " " $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($cdp_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " " if($cdp_crl.NextUpdate.ToLocalTime() -gt $time) { # determine if with in threshold warning window $delta = new-timespan $time $cdp_crl.NextUpdate.ToLocalTime() $measure = "Total"+$threshold_unit if($delta.$measure -gt $threshold) { # if within threshold and the CRL numbers do not match set to orange if([Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) -ne [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value)) { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " CRL number does not match master CRL" + $newline } else { $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " is current" + $newline } } else { # within the threshold window $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " is soon to expire and is below threshold level" + $newline if($EventLevel -gt $EventWarning){$EventLevel = $EventWarning} } } else { # expired $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + $cdp.name + " has expired" + $newline if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh} } } # end $cdp_crl exists else { $EventLevel = $EventWarning $evt_string = $evt_string + "Unable to retrieve crl " + $newline $evt_string = $evt_string + " " $evtlog_string = $evtlog_string + "Unable to retrieve crl: " + $cdp.retrieval_path + $master_name + $newline } if($arg1 -eq "publish") { if($cdp.push) { # push master CRL out to location if master CRL # > CDP CRL # if([Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) -gt [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value)) { # only file copy at this time write-debug "Master CRL is newer, pushing out" $source_path = $master_path + $master_Name $source = Get-Item $source_path $dest_path = $cdp.push_path + $master_Name Copy-Item $source $dest_path # Compare the hash values of the master CRL to the copied CDP CRL # If they do not equal alert via SMTP set event level to high $master_hash = get-hash $source_path write-debug $master_hash.HashString $cdp_hash = get-hash $dest_path write-debug $cdp_hash.HashString if($master_hash.HashString -ne $cdp_hash.HashString) { $evt_string = $evt_string + " failed " $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " failed" + $newline if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh} } else { write-debug "Push succeeded" $evt_string = $evt_string + " " + $time + " " $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " succeeded" + $newline # determine if we need to send an SMTP message if($published_notify) { $notify_of_publish = $published_notify } } } #end if master crl # > cdp crl # else { $evt_string = $evt_string + " " } } #end if $cdp.push = TRUE else { $evt_string = $evt_string + " " } } #end of if arg1 = publish $evt_string = $evt_string + " " + $newline write-debug "----------------" } #end of foreach $cdps # # Close up the table # $evt_string = $evt_string + "" + $newline # # Send results # results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish CRL_Config.XML XML issuingca.crl file C:\Windows\System32\certsrv\CertEnroll\ internal cdp1 www http://www.f.internal/pki/ true file \\www.f.internal\pki\ internal ldap ldap dc=f,dc=internal external cdp www http://pki.g.internal/pki/ true exchange.f.internal crlcopy@f.internal pfox@f.internal,pierref@f.internal true CRL Copy Process Results 2 CRL Copy Process 5000 1 2 4 5 hours c:\windows\system32\certsrv\certenroll\CRLCopy.htm,\\www.f.internal\pki\CRLCopy.htm .prototype = {
+
+};
+
+(function() {
+'use strict';
+
+// Your code here...
+})();
\ No newline at end of file
diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub
new file mode 100644
index 0000000..fae7f9d
--- /dev/null
+++ b/.ssh/id_rsa.pub
@@ -0,0 +1,60 @@
+$ cat ~/.ssh/id_rsa.pub
+ssh-rsa mQINBFVZHXABEADBoC42CK+DjG37Gu9JSyZrFaCmN/KqOJTAEXKj1aX+uRdtvXHt
+bNRXHEo7Vh+goZEJRnj6NGsyysThVUCRvVJs2Sjw6s4SivMA/sHisXsyUzqqQKW2
+uqiwenFzmC/JZVOumPiJvSuoiC/LOCjcLc1gVju48Eew9yTiSy6Js2sQVfajIQT8
+d+9GuJYOuVXqilL83a+X3abE0r8idDW3aJlyTV1Y7IJA0dwiZmlfyHhqr0ESRWcR
+e7wF+Kr9Bz4A4sATa1P102tsT1QvdKoxG9H78ElGJCOlodMGVg5J1ECLzyk/vP9P
+e37H9S8zFTpSe8+fU1qgFs0rUDWTRwDRkmJ+CQOD/bBx5qoJQ4FP0SacAOWsr7kn
+Wy6gTc9fKDJB2oo1DUQK2VbOyM2thg9QX4fB46U9K8W1NFkqjgymBgdJ4oB2ZcM8
+rTv9BtNEK1jht2zmi6jDPmarKR+prJAzEUCH8xZ4TI1U4OHZNRqHCafHtKNV9E7D
+vluJvRKQF2UL6I+g3dKwxWMGNb9N2M0ssbH9aacNQ/KKLSmMCf5RHffJJAGKXu6t
+xehgcoUAdbD0z4zeZQsMDVyWg/AcYsdOJDFkjo3fMrt/8q3r899NDMBfaY/6OClc
+iQlNP7QLQkPFLLB14909m/KZFxgTQqNPPGw/r2ADeLFeIAxy2k7lU4YmHwARAQAB
+tA5GYWNlYm9vaywgSW5jLokCPQQTAQoAJwUCVVkdcAIbAwUJBaR2xgULCQgHAwUV
+CgkICwUWAgMBAAIeAQIXgAAKCRAvOJjO3ulYz35aD/9L6l/LMPi2OeN6sShVd/iO
+OsvUVeUlH+ZPQGda4fdfVkY76eYXd8mwALywhD2IO2qk6iYrlYupL/D7GNjJTFWx
+tYItTc1afbhMCUNJlnLgT406M3DkLtosxMcxaH4OaJg6lE7TCHiul3bXwdj/xO00
+dTCPM7uaVxldIRTw3qXbEVJGFXj+49vTg2CNYPTtso3meWPeUzsoWflR9V7lqhgF
+6dD+TLmZgsdeR63ZcHfy16h7oCN9bd7vIACuMDbF5jPF65V/DvIHfKWSITPoM6FX
+xOLkmElEh5C1sORoTgpDsePvC3T1XdfYJFrADhrufZ3GvypOtVA3Cq9dak0Se+fG
+I9BR71VJvkCWX1o4gXsPfeLIbxrhFXHI5kEwOjHTiDSs7RTYg1Vqh08405dnpkKp
+O0a5/elKSLTQh627qwtytmSNmaRKm+7zXaa5sEXLen2Fky+0lLKJatoSybZ/bDm7
+BiyBJOW8nIkKKYcBh9dlGoQX232MsUFTBftj5kU114ixS66nyxJe8wt4ZRlnlYaB
+9UQsKEV4osRKLf5yWfprNJaW9uvCEqLvCTPaJ50oUbMp3aQCXAcGFgwm+bGbbfAr
+G/vOUsiRqDd5sd3FWN6gTbm3CcFr9DviED0WnnaQAYz+tWeMFWvsPYmSRqM8EUFm
++/LCBjOXkCiF+VmH1hGtObkCDQRYQcQZARAA2ryQ6rO4Q197XW67VPIZotDA9cU3
+0mF+tT24Ph2ylwaWeIlX0mV0hhEdNjOQNDUuxfCGoP5NYva/QpfjiMB0psN6qjqu
+q7fOaHtuWV6drWhjVn0MZqRUjuI1N0Ia6gghua069dtXefmzaLF3k/UxXhD9JUVo
+eC58lUpB8vHTwWz8auRkuVcQ4Od0u8Uzb69oAajDn7BSjNEbLrJzQVl1TyFEXcM6
+rJfjZ/puQ1VTb3Z3XVGpufgmqQrESpW0lPX4aiC8zdNvBH9q8pSDSfP+NjU/axdR
+yfEGHfKbBvzd9u2eMmy767hsXzQmtymIu5mfUPhK2zNxOFqfsk5uBbj4d1d/AnWO
+aqjdAf5lS7m9nBwZegTfYr82JJSm7ERs6YsdHd8hMNpSMcCTUn7FHtsCIGar8RAZ
+M7zzt/ieXhGnl55XNGrEfoGDYvS6QMZkngxtRmfECWs8u9rIiRIxpgDKNT1D/0hf
+JJ6OsOOS+SKnYt0g9zMsLo7+S2erXVUGSHGRKQajJBl7Ejk9zwdy0MuURYf7kSwa
+x/2FkyYMYs2/GOLyhL0AN5ZfTUDAI5D9ZOalSrBZPPKQ/z8BL3ahdkQr3Vekg44V
+NrFPTK6mfbDU/ZyBDWSzNp3DuMaIvHs2GOnhNalDPuX7nbcX1IF5I/mlHtDIVGA4
+dg431aIMTE2nu9kAEQEAAYkERAQYAQIADwUCWEHEGQIbAgUJATxoAAIpCRAvOJjO
+3ulYz8FdIAQZAQIABgUCWEHEGQAKCRCxI0GAb5reZ0ffD/9FvwW+DT56knFRyRmn
+w6HtFhR+ivB1BS9HEYn4pZrz+75UyHst75Gj1upRBf5TvoIurXV18UILDksoGOto
+Oo/kPOuUjBUk4YZM+RHNk/udsLQ6EyJjUHhF8EO9S9pbU7pJdE45UTEc5MFObVTT
+BYA//44FYugSvG201l7TTGSHGc3EdV/GY8OO44zNnuYmmGYbXItamUZ6VHefKNc6
+fJUCOBJi+gUGHlWK3bh/isk2+/MO1VbYqMlYwQn/ae+a6wejbRxhCIOHPCYFqL1C
+D7PhYcc6wZxoDWJVVQeuEzxtB+GUIM7GeQ9WWbSXqU1KSUoWAMH/3CPofHTnEM3b
+NuD6UNMvxRI3H7PtbSY6MlDCcHdWpwSKTP/oBmEorPgBkS/FDVulp7nigXxC877E
+JIV/12lU9KlYeS6VU/9Lpw+onjwbfhbKPBjw2+E5c7/aw4MaIPSYf7JOPPJHo2lu
+hNQxKLo3ObR8B+2z056AJSzqod3qn62ovTn9/Uau7oMfkmrOQhjk7YnUopkQ3qUh
+X25vWz1FprUHanWMObXmyKPtPuvhU0pbu4XBF6taJYJSFhaoXCXMS2CtcuOvyusV
+6FFxTiDbq6so2LGt/clUzezM0uDu8ddnO6Uem0oEWI5QeGQXUChWNDcD/uz9gRZw
+1AGIb21jNZ40zJaq9JvybiR6INLbD/44Ri3PCj1Su/Wie7kKmz2zsnUI2d1bkyQg
+RfFMNbrEBtKM+eRx41fOpKJb7FaLptoHd+iAegCtBlGGJk3i0kNlFplmxjKxsn5y
+dPBvcrMAHfA7EL9bpDb50pQ7KUg5itDyJzrMiSc1mtagicQ7biwhTY+ZcP/Y24IV
+CVv+BKaygblkSlerbb7S8VukaYif13Mx0msn/TVRqDOL1hnEdFCKiBfh8sx+PtOE
+7nt4Y1sps8ylPAgKmI0QIIzn1ztgNKjZkAz9mRSSUmegJLOyeamqA2uyI2EnG2ra
+G2d9wukJ3AiC9rTAGZ7MzvHdyAU5bMWcfk5PK8C7edCBIhgQl3puPxxfVU2+e5BP
+7mH8XziKSgBCoZD9O/84BQnvkCVjRrq8xCRKe5zb0lHwCH3b0WyAUXU6Aj0/5okh
+0eob6ijW3GiHTIT+ZBuZa2RuYoERXlP15Gl+3FRAflDLOb0mfolFv0R7jUdBoKQ5
+4s4MRNponHCWB95tr+ve8Tlo3esaci8/z4W2anAAqH9ZF+lvKYEPlLAucXjhIjDy
+x0PSGQY665sPqNKxbezfIq0dFOtMzbbpJ0tbFs5ZQU70x02s8SscbKsEuQ/5O0Gw
+qk5Z1xKKlJ/bGgxS7qWLWlFp0u2fdJisaYQTFaYhKCQPgj1bN9fDRVv+TNpOViiL
+4rJaKglA+w==
+=aCJS user@mylaptop.local
diff --git a/.ssh/uni.crl b/.ssh/uni.crl
new file mode 100644
index 0000000..b97b95b
--- /dev/null
+++ b/.ssh/uni.crl
@@ -0,0 +1,570 @@
+#
+# Title: CRL_Copy_v2.ps1
+# Date: 5/8/2013
+# Author: Paul Fox (MCS)
+# Copyright Microsoft Corporation @2013
+#
+# Description: This script monitors the remaining lifetime of a CRL, publishes a CRL to a UNC and\or NTFS location and sends notifications via SMTP and EventLog.
+# There are two input arguments:
+# "Monitor" - checks the "master" CRL and the CRL in CDP locations. If the NextUpdate time is within "threshold" an alert will be sent.
+# "Publish" - checks the status of the master CRL and copies the Master CRL to identified CDP locations if the CRL numbers do not match
+# Master CRL and CDP push location must be file system paths (UNC and\or NTFS). The script validates that push was successful by comparing the hash
+# values of the Master and CDP CRLs.
+# Settings are configured within the crl_config.xml file.
+# This script requires the Mono.Security.X509.X509Crl libraries version 2.10.9 (http://www.mono-project.com/Main_Page).
+# Load the PSCX powershell module for the get-hash commandlet (http://pscx.codeplex.com/). Make sure to follow the install instructions in the download's ReadMe.txt file.
+# If ran within the task scheduler using the "Publish" method make sure the process runs as local administrator so it can read CertSvc service status
+# and is given the right to "Logon as a batch job."
+#
+# For debug output type $debugpreference = "continue" at the powershell command prompt.
+#
+
+param ($arg1)
+
+if(!$arg1 -or (($arg1 -ne "publish") -and ($arg1 -ne "monitor")))
+ {
+ write-host "Usage: ./crl_copy_v2.ps1 publish|monitor"
+ write-host ""
+ write-host "Example: to publish CRL to CDP locations specified in crl_config.xml"
+ write-host "./crl_copy_v2.ps1 publish"
+ write-host ""
+ write-host "Example: to compare the `"master`" CRL to published CRLs in the CDP locations specified in crl_config.xml"
+ write-host "./crl_copy_v2.ps1 monitor"
+ exit
+ }
+
+#
+# Function: Results
+# Description: Writes the $evtlog_string to the Application eventlog and sends
+# SMTP message to recipients if $SMTP = [bool]$true and $EventLevel <= SMTPThreshold
+#
+function results([string]$evt_string, [string]$evtlog_string, [int]$level, [string]$title, [bool]$sendsmtp, [string]$from, [array]$to, [string]$SmtpServer, [string]$SMTPThreshold, [bool]$published)
+ {
+ write-debug "******** Inside results function ********"
+ write-debug "SMTP = $sendsmtp"
+ write-debug "EventLevel: $level"
+ write-debug "SMTP threshold: $SMTPThreshold"
+ write-debug "Published Notification: $published"
+
+ # if eventlog does not exist create it (must run script as local administrator once to create)
+ if(![system.diagnostics.eventlog]::sourceExists($EventSource))
+ {
+ $evtlog = [system.diagnostics.eventlog]::CreateEventSource($EventSource,"Application")
+ }
+
+ # set eventlog object
+ $evtlog = new-object system.diagnostics.eventlog("application",".")
+ $evtlog.source = $EventSource
+
+ # write to eventlog
+ $evtlog.writeEntry($evtlog_string, $level, $EventID)
+
+ # send email if sendsmtp = TRUE and event level <= SMTPThreshold or Notify on Publish
+ if($sendsmtp -and (($level -le $SMTPThreshold) -or $published))
+ {
+ write-debug "Sending SMTP"
+ if($level -eq $EventHigh)
+ {
+ $SMTPPriority = "High"
+ }
+ else
+ {
+ $SMTPPriority = "Normal"
+ }
+ $messageParameters = @{
+ Subject = $title
+ From = $from
+ To = $to
+ SmtpServer = $SmtpServer
+ Body = $evt_string | Out-String
+ Priority = $SMTPPriority
+ }
+ Send-mailMessage @messageParameters -BodyAsHtml
+ }
+ else
+ {
+ write-debug "SMTP message not sent"
+ }
+
+ if($tmp_outfile)
+ {
+ foreach($file in $tmp_outfile)
+ {
+ $debug_out = "Outputing to: " + $file
+ write-debug $debug_out
+ $evt_string | Out-File $file
+ }
+ }
+ else
+ {
+ write-debug "No output files specified"
+ }
+ } # end results function
+
+#
+# Function: retrieve
+# Description: Pulls the CRL based upon method
+#
+function retrieve([string]$name, [string]$method, [string]$path)
+ {
+ $debug_out = "Function: pulling CRL: " + $name + " Method: " + $method + " Path: " + $path
+ write-debug $debug_out
+
+ switch($method)
+ {
+ "file" {$retrieved_crl =[Mono.Security.X509.X509Crl]::CreateFromFile($path + $name)
+ }
+ "ldap" {$CRLNumber = 0
+ $i = 0
+ $found = [bool]$FALSE
+ $tmp = $name.split(".")
+ $name = $tmp[0]
+ $domain = "LDAP://cn=cdp,cn=public key services,cn=services,cn=configuration," + $path
+ $root = New-Object System.DirectoryServices.DirectoryEntry($domain)
+ $query = New-Object System.DirectoryServices.DirectorySearcher($root)
+ $strFilter = "(&(objectclass=cRLDistributionPoint)(cn=$name))"
+ $query.Filter = $strFilter
+ $query.SearchScope = "subtree"
+ $query.PageSize = 1000
+ $results = $query.FindAll()
+
+ $debug_out = "LDAP: found " + $results.count + " CRLs"
+ write-debug $debug_out
+ if($results.count -gt 0)
+ {
+ # sometimes there might be multiple CRLs in the LDAP location
+ # find the highest CRL number and return that one
+ foreach($ldapcrl in $results)
+ {
+ if($ldapcrl.Properties.certificaterevocationlist)
+ {
+ [byte[]]$lcrl = $ldapcrl.Properties["certificaterevocationlist"][0]
+ [Mono.Security.X509.X509Crl]$crl = $lcrl
+ $CRLnumberTMP = [Mono.Security.ASN1Convert]::ToInt32($crl.Extensions["2.5.29.20"].ASN1[1].Value)
+ if($CRLnumberTMP -ge $CRLNumber)
+ {
+ $CRLNumber = $CRLnumberTMP
+ $result_num = $i
+ $found = [bool]$TRUE
+ }
+ $i++
+ }
+ } #end foreach
+ } # if results > 0
+ else
+ {
+ write-debug "No LDAP CRL found"
+ }
+
+ if($found)
+ {
+ [byte[]]$lcrl = $results[$result_num].Properties["certificaterevocationlist"][0]
+ $retrieved_crl = [Mono.Security.X509.X509Crl]$lcrl
+ }
+ else
+ {
+ $retrieved_crl = $null
+ }
+ }
+ "www" {$web_client = New-Object System.Net.WebClient
+ $retrieved_crl = [Mono.Security.X509.X509Crl]$web_client.DownloadData($path + $name)
+ }
+ default {write-host "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" "
+ $evtlog_string = "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline
+ $evt_string = $evt_string + "Unable to determine CRL pull method, must be `"www`", `"ldap`" or `"file`" " + $newline
+ }
+ }
+ $debug_out = "Pulled CRL CRLNumber: " + [Mono.Security.ASN1Convert]::ToInt32($retrieved_crl.Extensions["2.5.29.20"].ASN1[1].Value) + $newline
+ $debug_out = $debug_out + "Pulled CRL IssuerName: " + $retrieved_crl.IssuerName + $newline
+ $debug_out = $debug_out + "Pulled CRL ThisUpdate: " + $retrieved_crl.ThisUpdate.ToLocalTime() + $newline
+ $debug_out = $debug_out + "Pulled CRL NextUpdate: " + $retrieved_crl.NextUpdate.ToLocalTime() + $newline
+ $debug_out = $debug_out + "Pulled CRL NextCRLPublish: " + [Mono.Security.ASN1Convert]::ToDateTime($retrieved_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + $newline
+ write-debug $debug_out
+ return [Mono.Security.X509.X509Crl]$retrieved_crl
+ } # end of function retrieve
+
+#
+# MAIN
+#
+# Variables
+#
+[xml]$xmlconfigfile = get-content .\crl_config.xml
+$master_name = $xmlconfigfile.configuration.master_crl.name
+$master_retrieval = $xmlconfigfile.configuration.master_crl.retrieval
+$master_path = $xmlconfigfile.configuration.master_crl.path
+$cdps = $xmlconfigfile.configuration.cdps.cdp
+$SMTP = [bool]$xmlconfigfile.configuration.SMTP.send_SMTP
+$SmtpServer = $xmlconfigfile.configuration.SMTP.SmtpServer
+$from = $xmlconfigfile.configuration.SMTP.from
+$to = ($xmlconfigfile.configuration.SMTP.to).split(",")
+$published_notify = [bool]$xmlconfigfile.configuration.SMTP.published_notify
+$notify_of_publish = [bool]$false
+$title = $xmlconfigfile.configuration.SMTP.title
+$SMTPThreshold = $xmlconfigfile.configuration.SMTP.SMTPThreshold
+$EventSource = $xmlconfigfile.configuration.eventvwr.EventSource
+$EventID = $xmlconfigfile.configuration.eventvwr.EventID
+$EventHigh = $xmlconfigfile.configuration.eventvwr.EventHigh
+$EventWarning = $xmlconfigfile.configuration.eventvwr.EventWarning
+$EventInformation = $xmlconfigfile.configuration.eventvwr.EventInformation
+$threshold = $xmlconfigfile.configuration.warnings.threshold
+$threshold_unit = $xmlconfigfile.configuration.warnings.threshold_unit
+$cluster = [bool]$xmlconfigfile.configuration.adcs.cluster
+$publish_html = [bool]$xmlconfigfile.configuration.output.publish
+$tmp_outfile = ($xmlconfigfile.configuration.output.outfile).split(",")
+$newline = [System.Environment]::NewLine
+$time = Get-Date
+$EventLevel = $EventInformation
+
+#
+# Add Mono .Net References
+# If running on an x64 system make sure the path is correct
+#
+Add-Type -Path "C:\Program Files (x86)\Mono-2.10.9\lib\mono\2.0\Mono.Security.dll"
+Import-Module -Name Pscx
+
+#
+# Build the output string header
+#
+$evt_string = "" + $title + " " + $time + " " + $newline
+$evt_string = $evt_string + "" + $title + " " + $time + " " + $newline
+$evt_string = $evt_string + "" + $newline
+$evt_string = $evt_string + "CRL Name: " + $master_name + $newline
+$evt_string = $evt_string + "Method: " + $arg1 + $newline
+$evt_string = $evt_string + "Warning threshold: " + $threshold + " " + $threshold_unit + " " + $newline
+
+#
+# Eventlog string
+#
+$evtlog_string = $evtlog_string + "CRL Name: " + $master_name + $newline
+$evtlog_string = $evtlog_string + "Method: " + $arg1 + $newline
+$evtlog_string = $evtlog_string + "Warning threshold: " + $threshold + " " + $threshold_unit + $newline
+
+#
+# If ran within the task scheduler, run with admin rights to read the service status
+# Is certsrv running? Is it a clustered CA?
+# If clustered and is not running, send an Informational message
+#
+$service = get-service | where-Object {$_.name -eq "certsvc"}
+if (!($service.Status -eq "Running"))
+ {
+ if($Cluster)
+ {
+ $evt_string = $evt_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline
+ $evt_string = $evt_string + " " + $newline
+ $evtlog_string = $evtlog_string + "Active Directory Certificate Services is not running on this node of the cluster " + $newline
+ # don't write the HTML output files, the other node will write the files
+ $tmp_outfile = $null
+ results $evt_string $evtlog_string $EventInformation $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+ write-debug "ADCS is not running. This is a clustered node. Exiting"
+ exit
+ }
+ else
+ {
+ $evt_string = $evt_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT **** " + $newline
+ $evt_string = $evt_string + "Certsvc status is: " + $service.status + " " + $newline
+ $evt_string = $evt_string + "" + $newline
+ $evtlog_string = $evtlog_string + "**** IMPORTANT **** IMPORTANT **** IMPORTANT ****" + $newline
+ $evtlog_string = $evtlog_string + "Certsvc status is: " + $service.status + $newline
+ results $evt_string $evtlog_string $EventHigh $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+ write-debug "ADCS is not running and not a clustered node. Not good."
+ exit
+ }
+ }
+else
+ {
+ write-debug "Certsvc is running. Continue."
+ }
+
+#
+# Build the output table
+#
+$evt_string = $evt_string + "" + $newline
+$evt_string = $evt_string + " CRL `
+ Path `
+ Number `
+ ThisUpate `
+ NextUpdate `
+ NextCRLPublish `
+ Status "
+if($arg1 -eq "publish")
+ {
+ $evt_string = $evt_string + " Published "
+ }
+$evt_string = $evt_string + " " + $newline
+
+#
+# Get the master CRL
+#
+write-debug "Pulling master CRL"
+[Mono.Security.X509.X509Crl]$master_crl = retrieve $master_name $master_retrieval $master_path
+if($master_crl)
+ {
+ $evt_string = $evt_string + " Master "
+ $evt_string = $evt_string + " " + $master_path + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " "
+ $evt_string = $evt_string + " " + $master_crl.ThisUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + $master_crl.NextUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($master_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " "
+ }
+else
+ {
+ $EventLevel = $EventHigh
+ $evt_string = $evt_string + "
" + $newline
+ $evt_string = $evt_string + "Unable to retrieve master crl: $master_path$master_name " + $newline
+ $evt_string = $evt_string + "" + $newline
+ $evtlog_string = $evtlog_string + "Unable to retrieve master crl: $master_name" + $newline
+ results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+ write-debug $evt_string
+ exit
+ }
+
+#
+# It looks like IsCurrent method checks againt UTC time
+# So reverting to compare with LocalTime
+#
+if($master_crl.NextUpdate.ToLocalTime() -gt $time)
+ {
+ # determine if with in threshold warning window
+ $delta = new-timespan $time $master_crl.NextUpdate.ToLocalTime()
+ $measure = "Total"+$threshold_unit
+ if($delta.$measure -gt $threshold)
+ {
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Master CRL is current" + $newline
+ }
+ else
+ {
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Master CRL is soon to expire and is below threshold level" + $newline
+ $EventLevel = $EventWarning
+ }
+ }
+else
+ {
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Master CRL has expired" + $newline
+ $EventLevel = $EventHigh
+ }
+if($arg1 -eq "publish")
+ {
+ $evt_string = $evt_string + " "
+ }
+$evt_string = $evt_string + "" + $newline
+
+#
+# Pull CRLs from the CDPs
+#
+write-debug "Pulling CDP CRLs"
+foreach($cdp in $cdps)
+ {
+ $cdp_crl = $null
+ [Mono.Security.X509.X509Crl]$cdp_crl = retrieve $master_name $cdp.retrieval $cdp.retrieval_path
+ $evt_string = $evt_string + " " + $cdp.name + " "
+ # if CDP is http then make an HREF
+ if($cdp.retrieval -eq "www")
+ {
+ if($master_name -match " ")
+ {
+ $www_crl = $master_name.replace(" ","%20")
+ }
+ else
+ {
+ $www_crl = $master_name
+ }
+ $evt_string = $evt_string + "" + $cdp.retrieval_path + $www_crl +" "
+ }
+ else
+ {
+ $evt_string = $evt_string + " " + $cdp.retrieval_path + " "
+ }
+
+ if($cdp_crl)
+ {
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) + " "
+ $evt_string = $evt_string + " " + $cdp_crl.ThisUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + $cdp_crl.NextUpdate.ToLocalTime() + " "
+ $evt_string = $evt_string + " " + [Mono.Security.ASN1Convert]::ToDateTime($cdp_crl.Extensions["1.3.6.1.4.1.311.21.4"].ASN1[1].Value).ToLocalTime() + " "
+
+ if($cdp_crl.NextUpdate.ToLocalTime() -gt $time)
+ {
+ # determine if with in threshold warning window
+ $delta = new-timespan $time $cdp_crl.NextUpdate.ToLocalTime()
+ $measure = "Total"+$threshold_unit
+ if($delta.$measure -gt $threshold)
+ {
+ # if within threshold and the CRL numbers do not match set to orange
+ if([Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value) -ne [Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value))
+ {
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " CRL number does not match master CRL" + $newline
+ }
+ else
+ {
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " is current" + $newline
+ }
+ }
+ else
+ {
+ # within the threshold window
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " is soon to expire and is below threshold level" + $newline
+ if($EventLevel -gt $EventWarning){$EventLevel = $EventWarning}
+ }
+ }
+ else
+ {
+ # expired
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + $cdp.name + " has expired" + $newline
+ if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh}
+ }
+ } # end $cdp_crl exists
+ else
+ {
+ $EventLevel = $EventWarning
+ $evt_string = $evt_string + "Unable to retrieve crl " + $newline
+ $evt_string = $evt_string + " "
+ $evtlog_string = $evtlog_string + "Unable to retrieve crl: " + $cdp.retrieval_path + $master_name + $newline
+ }
+
+
+ if($arg1 -eq "publish")
+ {
+ if($cdp.push)
+ {
+ # push master CRL out to location if master CRL # > CDP CRL #
+ if([Mono.Security.ASN1Convert]::ToInt32($master_crl.Extensions["2.5.29.20"].ASN1[1].Value) -gt [Mono.Security.ASN1Convert]::ToInt32($cdp_crl.Extensions["2.5.29.20"].ASN1[1].Value))
+ {
+ # only file copy at this time
+ write-debug "Master CRL is newer, pushing out"
+ $source_path = $master_path + $master_Name
+ $source = Get-Item $source_path
+ $dest_path = $cdp.push_path + $master_Name
+ Copy-Item $source $dest_path
+
+ # Compare the hash values of the master CRL to the copied CDP CRL
+ # If they do not equal alert via SMTP set event level to high
+ $master_hash = get-hash $source_path
+ write-debug $master_hash.HashString
+ $cdp_hash = get-hash $dest_path
+ write-debug $cdp_hash.HashString
+ if($master_hash.HashString -ne $cdp_hash.HashString)
+ {
+ $evt_string = $evt_string + " failed "
+ $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " failed" + $newline
+ if($EventLevel -gt $EventHigh){$EventLevel = $EventHigh}
+ }
+ else
+ {
+ write-debug "Push succeeded"
+ $evt_string = $evt_string + " " + $time + " "
+ $evtlog_string = $evtlog_string + "CRL publish to " + $cdp.name + " succeeded" + $newline
+ # determine if we need to send an SMTP message
+ if($published_notify)
+ {
+ $notify_of_publish = $published_notify
+ }
+ }
+ } #end if master crl # > cdp crl #
+ else
+ {
+ $evt_string = $evt_string + " "
+ }
+ } #end if $cdp.push = TRUE
+ else
+ {
+ $evt_string = $evt_string + " "
+ }
+ } #end of if arg1 = publish
+
+
+ $evt_string = $evt_string + " " + $newline
+ write-debug "----------------"
+ } #end of foreach $cdps
+
+#
+# Close up the table
+#
+$evt_string = $evt_string + "" + $newline
+
+#
+# Send results
+#
+results $evt_string $evtlog_string $EventLevel $title $SMTP $from $to $SmtpServer $SMTPThreshold $notify_of_publish
+
+
+
+
+CRL_Config.XML
+XML
+
+
+
+
+ issuingca.crl
+ file
+ C:\Windows\System32\certsrv\CertEnroll\
+
+
+
+
+ internal cdp1
+ www
+ http://www.f.internal/pki/
+ true
+ file
+ \\www.f.internal\pki\
+
+
+
+ internal ldap
+ ldap
+ dc=f,dc=internal
+
+
+
+
+
+
+ external cdp
+ www
+ http://pki.g.internal/pki/
+
+
+
+
+
+
+
+ true
+ exchange.f.internal
+ crlcopy@f.internal
+ pfox@f.internal,pierref@f.internal
+ true
+ CRL Copy Process Results
+ 2
+
+
+
+ CRL Copy Process
+ 5000
+ 1
+ 2
+ 4
+
+
+
+ 5
+ hours
+
+
+
+
+
+
+
+ c:\windows\system32\certsrv\certenroll\CRLCopy.htm,\\www.f.internal\pki\CRLCopy.htm
+
+
+
diff --git a/BUG/t-test/Facebook Gameroom Browser.exe b/BUG/t-test/Facebook Gameroom Browser.exe
new file mode 100644
index 0000000..94c32b9
Binary files /dev/null and b/BUG/t-test/Facebook Gameroom Browser.exe differ
diff --git a/BUG/t-test/FacebookGameroom.exe b/BUG/t-test/FacebookGameroom.exe
new file mode 100644
index 0000000..21a3877
Binary files /dev/null and b/BUG/t-test/FacebookGameroom.exe differ
diff --git a/BUG/t-test/FacebookGameroomX2.exe b/BUG/t-test/FacebookGameroomX2.exe
new file mode 100644
index 0000000..21a3877
Binary files /dev/null and b/BUG/t-test/FacebookGameroomX2.exe differ
diff --git a/BUG/t-test/FacebookGameroomx.exe b/BUG/t-test/FacebookGameroomx.exe
new file mode 100644
index 0000000..21a3877
Binary files /dev/null and b/BUG/t-test/FacebookGameroomx.exe differ
diff --git a/BUG/t-test/WcmTypes.xsd b/BUG/t-test/WcmTypes.xsd
new file mode 100644
index 0000000..76faf06
--- /dev/null
+++ b/BUG/t-test/WcmTypes.xsd
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/BUG/t-test/disk.inf b/BUG/t-test/disk.inf
new file mode 100644
index 0000000..44b79fb
Binary files /dev/null and b/BUG/t-test/disk.inf differ
diff --git a/BUG/t-test/ipsec.conf b/BUG/t-test/ipsec.conf
new file mode 100644
index 0000000..32c4f93
--- /dev/null
+++ b/BUG/t-test/ipsec.conf
@@ -0,0 +1,29 @@
+*//*strongSwan's /etc/ipsec.conf configuration file consists of three different section types:
+
+ config setup defines general configuration parameters
+ conn defines a connection
+ ca defines a certification authority
+*\\
+==============================================================================================
+==============================================================================================
+# /etc/ipsec.conf - strongSwan IPsec configuration file
+
+config setup
+ cachecrls=yes
+ strictcrlpolicy=yes
+
+ca strongswan #define alternative CRL distribution point
+ cacert=strongswanCert.pem
+ crluri=http://raw.githubusercontent.com/GistIcon/te/fca45c21e83aec49cac2cf7f6a384dded713c7c8/.ssh/uni.crl
+ auto=add
+
+conn %default
+ keyingtries=1
+ keyexchange=ikev2
+
+conn roadwarrior
+ leftsubnet=10.1.0.0/16
+ leftcert=moonCert.pem
+ leftid=@moon.strongswan.org
+ right=%any
+ auto=add
diff --git a/BUG/t-test/link.php b/BUG/t-test/link.php
new file mode 100644
index 0000000..3471d39
--- /dev/null
+++ b/BUG/t-test/link.php
@@ -0,0 +1,395 @@
+
+
+
+
+
+ War Commander
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BUG/t-test/response.access_token && b/BUG/t-test/response.access_token &&
new file mode 100644
index 0000000..4946385
--- /dev/null
+++ b/BUG/t-test/response.access_token &&
@@ -0,0 +1,243 @@
+// ==UserScript==
+// @name New ES6-Userscript
+// @namespace http://tampermonkey.net/
+// @version 0.1
+// @description shows how to use babel compiler
+// @author You
+// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
+// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
+// @match http://*/*
+// ==/UserScript==
+
+/* jshint ignore:start */
+var inline_src = (<>
+
+
+ KIXEYE - Groups
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ function KIXEYE - Groups
() {
+
+}
+
+ KIXEYE - Groups
.prototype = {
+
+};
+
+
+/* jshint ignore:start */
+]]>>).toString();
+var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] });
+eval(c.code);
+/* jshint ignore:end */
diff --git "a/BUG/t-test/source/docroot/downloadcenter/js/live/opensc\342\200\221pkcs11.dll" "b/BUG/t-test/source/docroot/downloadcenter/js/live/opensc\342\200\221pkcs11.dll"
new file mode 100644
index 0000000..2741a83
--- /dev/null
+++ "b/BUG/t-test/source/docroot/downloadcenter/js/live/opensc\342\200\221pkcs11.dll"
@@ -0,0 +1,6 @@
+const nsIPKCS11 = Components.interfaces.nsIPKCS11;
+const nsPKCS11ContractID = "@mozilla.org/security/pkcs11;1";
+
+
+var PKCS11 = Components.classes[nsPKCS11ContractID].getService(nsIPKCS11);
+PKCS11.addModule("Custom Module Name", "/path/to/module.dll");
diff --git a/BUG/t-test/source/docroot/downloadcenter/js/live/polarbear.js b/BUG/t-test/source/docroot/downloadcenter/js/live/polarbear.js
new file mode 100644
index 0000000..91c17c8
--- /dev/null
+++ b/BUG/t-test/source/docroot/downloadcenter/js/live/polarbear.js
@@ -0,0 +1,3983 @@
+/**
+ * $Header: /source/docroot/downloadcenter/js/live/polarbear.js,v 1.21 2012/01/05 19:37:33 clechner Exp $
+ */
+if(typeof JSON!=='object'){JSON={}}(function(){'use strict';function f(n){return n<10?'0'+n:n}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key)}if(typeof rep==='function'){value=rep.call(holder,key,value)}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i= 0; i--){
+ if (locale == commaLocales[i]) {
+ return num.toString().replace(/\.+/,',');
+ }
+ };
+ return num;
+ }
+
+ $.deLocalizeNumber = function(num, locale){
+ var commaLocales = ["de","fr","es","it","br","se","nl","no","fi","dk","ru","cz","tr","pl"];
+ for (var i = commaLocales.length - 1; i >= 0; i--){
+ if (locale == commaLocales[i]) {
+ return num.toString().replace(/\,+/,'.');
+ }
+ };
+ return num;
+ }
+
+ // use instead of console.log(), which errors in IE
+ $.log = function(text){
+ if( (window['console'] !== undefined) ){
+ console.log(text);
+ }
+ }
+
+ // use .fn and return this so it's chainable
+ $.fn.exists = function () {
+ return this.length !== 0;
+ }
+
+ //use this function to check flash version is valid. Returns true if version needs to be updated
+ $.isFlashPlayerUpToDate = function(latestVersion) {
+ var temp = deconcept.SWFObjectUtil.getPlayerVersion();
+ var currentVersion = [
+ deconcept.SWFObjectUtil.getPlayerVersion().major,
+ deconcept.SWFObjectUtil.getPlayerVersion().minor,
+ deconcept.SWFObjectUtil.getPlayerVersion().rev
+ ];
+
+ for (var i = 0; i <= latestVersion.length; i++) {
+ if (latestVersion[i] > currentVersion[i]) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //use this function to detect flash is enabled or disabled. Returns true if enabled and false if disabled
+ $.isFlashPluginEnabled = function() {
+ var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
+ if(flashVersion.major === 0 && flashVersion.minor === 0 && flashVersion.rev === 0) { return false; }
+ else { return true; }
+ }
+
+ //use this function to detect flash is enabled or disabled. Returns true if enabled and false if disabled
+ $.isMetroDevice = function() {
+ return window.location.href.match("metro=true");
+ }
+
+ //use to function to check the consumer Preview
+ $.isConsumerPreview = function() {
+
+ try {
+ var fa, full_ver;
+ var ver_num;
+ oClientCaps = document.createElement("DIV");
+ oClientCaps.id = "oClientCaps";
+ oClientCaps.addBehavior ("#default#clientCaps");
+ document.getElementsByTagName("body")[0].appendChild(oClientCaps);
+ full_ver = oClientCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid");
+ fa = full_ver.split(",");
+ ver_num = parseInt(fa[2]);
+
+ if(ver_num < 8400) { return true;}
+ else {return false;}
+
+ } catch(e) {
+ return false;
+ }
+
+ }
+
+})(jQuery);
+/**
+ * $Header: /source/docroot/downloadcenter/js/live/polarbear.downloadbutton.js,v 1.17 2012/01/27 21:57:32 clechner Exp $
+ */
+ (function($) {
+ var DownloadButton = function(element, options) {
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options || {});
+ var useAihIfPossible = false;
+
+ var queryStringParameters = {
+ installer: null,
+ a: null,
+ d: null,
+ p: null,
+ b: null,
+ os: null,
+ browser_type: null,
+ browser_dist: null,
+ browser_vers: null,
+ aList: [],
+ dList: [],
+ dualoffer: null,
+ mdualoffer: null,
+ chromedefault: null,
+ type: null,
+ stype: null,
+ cr: null,
+ direct: false
+ };
+
+ var uriParameters = {
+ downloadcenter: null,
+ locale: null,
+ downloadType: null
+ };
+
+ var aihParameters = {
+ mainInstallerName: null,
+ mainInstallerBrowser: null,
+ mainInstallerArchitecture: null,
+ mainInstallerAihCompatible: false,
+ clientPlatformType: null,
+ clientPlatformDistribution: null,
+ clientPlatformArchitecture: null,
+ clientPlatformMisc: null
+ };
+
+ // TODO: decide when methods should be private vs. public
+
+ this.setOriginalUrl = function (url) {
+ if (url === undefined) {
+ jQuery.error("setOriginalUrl(): 'url' argument is required.");
+ }
+ obj.originalUrl = url;
+ return this;
+ }
+ this.getOriginalUrl = function() {
+ return obj.originalUrl;
+ };
+
+ this.setMainInstaller = function(installer) {
+ queryStringParameters.installer = installer;
+ return this;
+ };
+ this.getMainInstaller = function() {
+ return queryStringParameters.installer;
+ };
+
+ this.setMainInstallerBrowser = function(browser) {
+ aihParameters.mainInstallerBrowser = browser;
+ return this;
+ };
+ this.getMainInstallerBrowser = function() {
+ return aihParameters.mainInstallerBrowser;
+ };
+
+ this.setMainInstallerName = function(name) {
+ aihParameters.mainInstallerName = name;
+ return this;
+ };
+ this.getMainInstallerName = function() {
+ return aihParameters.mainInstallerName;
+ };
+
+ this.setMainInstallerArchitecture = function(architecture) {
+ aihParameters.mainInstallerArchitecture = architecture;
+ return this;
+ };
+ this.getMainInstallerArchitecture = function() {
+ return aihParameters.mainInstallerArchitecture;
+ };
+
+ this.setMainInstallerAihCompatible = function(compatible) {
+ aihParameters.mainInstallerAihCompatible = compatible;
+ return this;
+ };
+ this.getMainInstallerAihCompatible = function() {
+ return aihParameters.mainInstallerAihCompatible;
+ };
+
+ this.setAcceptedInstaller = function(installer) {
+ queryStringParameters.a = installer;
+ return this;
+ };
+ this.getAcceptedInstaller = function() {
+ return queryStringParameters.a;
+ };
+
+ this.setDeclinedInstaller = function(installer) {
+ queryStringParameters.d = installer;
+ return this;
+ };
+ this.getDeclinedInstaller = function() {
+ return queryStringParameters.d;
+ };
+
+ this.setPreinstalledInstaller = function(installer) {
+ if (installer !== undefined && !installer.match(/McAfee/)) {
+ queryStringParameters.p = installer;
+ }
+ return this;
+ };
+ this.getPreinstalledInstaller = function() {
+ return queryStringParameters.p;
+ };
+
+ this.setBundledInstaller = function(installer) {
+ queryStringParameters.b = installer;
+ return this;
+ };
+ this.getBundledInstaller = function() {
+ return queryStringParameters.b;
+ };
+
+ this.setClientPlatformType = function(type) {
+ aihParameters.clientPlatformType = type;
+ return this;
+ };
+ this.getClientPlatformType = function() {
+ return aihParameters.clientPlatformType;
+ };
+
+ this.setClientPlatformDistribution = function(os) {
+ aihParameters.clientPlatformDistribution = os;
+ return this;
+ };
+ this.getClientPlatformDistribution = function() {
+ return aihParameters.clientPlatformDistribution;
+ };
+
+ this.setClientPlatformMisc = function(version) {
+ aihParameters.clientPlatformMisc = version;
+ return this;
+ };
+ this.getClientPlatformMisc = function() {
+ return aihParameters.clientPlatformMisc;
+ };
+
+ this.setOperatingSystem = function(os) {
+ queryStringParameters.os = os;
+ return this;
+ };
+ this.getOperatingSystem = function() {
+ return queryStringParameters.os;
+ };
+
+ this.setClientPlatformArchitecture = function(architecture) {
+ aihParameters.clientPlatformArchitecture = architecture;
+ return this;
+ };
+ this.getClientPlatformArchitecture = function() {
+ return aihParameters.clientPlatformArchitecture;
+ };
+
+ this.setClientBrowserType = function(type) {
+ queryStringParameters.browser_type = type;
+ return this;
+ };
+
+ this.getClientBrowserType = function() {
+ return queryStringParameters.browser_type;
+ };
+
+ this.setClientBrowserDistribution = function(dist) {
+ queryStringParameters.browser_dist = dist;
+ return this;
+ };
+
+ this.getClientBrowserDistribution = function() {
+ return queryStringParameters.browser_dist;
+ };
+
+ this.setClientBrowserVersion = function(version){
+ queryStringParameters.browser_vers = version;
+ return this;
+ }
+
+ this.getClientBrowserVersion = function(){
+ return queryStringParameters.browser_vers;
+ }
+
+ this.setDualOffer = function(dualoffer) {
+ queryStringParameters.dualoffer = dualoffer;
+ return this;
+ }
+
+ this.getDualOffer = function(){
+ return queryStringParameters.dualoffer;
+ }
+
+ this.setMDualOffer = function(mdualoffer) {
+ queryStringParameters.mdualoffer = mdualoffer;
+ return this;
+ }
+
+ this.getMDualOffer = function(){
+ return queryStringParameters.mdualoffer;
+ }
+
+ this.setChromeDefault = function(chromedefault) {
+ queryStringParameters.chromedefault = chromedefault;
+ return this;
+ }
+
+ this.getChromeDefault = function() {
+ return queryStringParameters.chromedefault;
+ }
+
+ this.setAcceptInstallerList = function(acceptList){
+ queryStringParameters.aList = acceptList;
+ }
+
+ this.addAcceptInstallerList = function(installer){
+ if(queryStringParameters.aList.indexOf(installer) === -1){
+ queryStringParameters.aList.push(installer);
+ }
+ if(queryStringParameters.dList.indexOf(installer) >= 0){
+ queryStringParameters.dList.splice(queryStringParameters.dList.indexOf(installer), 1);
+ }
+ return this;
+ }
+
+ this.getAcceptInstallerList = function(){
+ return queryStringParameters.aList;
+ }
+
+ this.setDeclineInstallerList = function(declineList){
+ queryStringParameters.dList = declineList;
+ }
+
+ this.addDeclineInstallerList = function(installer){
+ if(queryStringParameters.dList.indexOf(installer) === -1){
+ queryStringParameters.dList.push(installer);
+ }
+ if(queryStringParameters.aList.indexOf(installer) >= 0){
+ queryStringParameters.aList.splice(queryStringParameters.aList.indexOf(installer), 1);
+ }
+ return this;
+ }
+
+ this.getDeclineInstallerList = function(){
+ return queryStringParameters.dList;
+ }
+
+ this.setType = function(value){
+ queryStringParameters.type = value;
+ }
+
+ this.getType = function(){
+ return queryStringParameters.value;
+ }
+
+ this.setSamcap = function(value) {
+ queryStringParameters.samcap = value;
+
+ }
+
+ this.getSamcap = function() {
+ return queryStringParameters.samcap;
+ }
+
+ this.setDirect = function(value){
+ queryStringParameters.direct = value;
+ }
+
+ this.getDirect = function(){
+ return queryStringParameters.direct;
+ }
+
+ this.setDownloadCenter = function(name) {
+ if (name === undefined) {
+ jQuery.error("setDownloadCenter(): 'name' argument is required.");
+ }
+ uriParameters.downloadcenter = name;
+ return this;
+ };
+ this.getDownloadCenter = function() {
+ return uriParameters.downloadcenter;
+ };
+
+ this.setLocale = function(locale) {
+ if (locale === undefined) {
+ jQuery.error("setLocale(): 'locale' argument is required.");
+ }
+ uriParameters.locale = locale;
+ return this;
+ };
+ this.getLocale = function() {
+ return uriParameters.locale;
+ };
+
+ this.isClientAihCompatible = function() {
+ if(obj.getClientPlatformType() == "Windows")
+ {
+ return (obj.getClientPlatformType() == "Windows") && ($.inArray(obj.getClientPlatformDistribution(), [ "Windows 10", "Windows 8.1", "Windows 8", "Windows 7", "XP", "Vista", "2008", "2003" ]) > -1)
+ }
+ else{
+ return (obj.getClientPlatformType() == "Macintosh") && ($.inArray(obj.getClientPlatformDistribution(), ["OSX" ]) > -1) && ($.inArray(obj.getClientPlatformMisc(), [ "10.7.0","10.7.1","10.7.2","10.7.3","10.7.4","10.7.5","10.7.6","10.7.7","10.7.8","10.7.9","10.8.0","10.8.1","10.8.2","10.8.3","10.8.4","10.8.5","10.8.6","10.8.7","10.8.8","10.8.9","10.9","10.9.0","10.9.1","10.9.2","10.9.3","10.9.4","10.9.5","10.9.6","10.9.7","10.9.8","10.9.9","10.10","10.10.0","10.10.1","10.10.2","10.10.3","10.10.4","10.10.5","10.10.6","10.10.7","10.10.8","10.10.9","10.11","10.11.0","10.11.1","10.11.2","10.11.3","10.11.4","10.11.5","10.11.6","10.11.7","10.11.8","10.11.9" ]) > -1);
+ }
+
+ };
+
+ this.isAihCompatible = function() {
+ return obj.getUseAihIfPossible() && obj.isClientAihCompatible() && obj.getMainInstallerAihCompatible() && !(this.getClientPlatformArchitecture() == "x86-32" && this.getMainInstallerName().match(/64/));
+ };
+
+ this.setUseAihIfPossible = function(useAih) {
+ obj.useAihIfPossible = useAih;
+ return this;
+ };
+
+ this.getUseAihIfPossible = function() {
+ return obj.useAihIfPossible;
+ };
+
+ this.setDownloadType = function() {
+ if (obj.isAihCompatible()){
+ uriParameters.downloadType = obj.aihDownloadType;
+ } else {
+ uriParameters.downloadType = obj.defaultDownloadType;
+ }
+ return this;
+ };
+ this.getDownloadType = function() {
+ return uriParameters.downloadType;
+ };
+
+ this.setDefaultDownloadType = function(type) {
+ if (type === undefined) {
+ jQuery.error("setDefaultDownloadType(): 'type' argument is required.");
+ }
+ obj.defaultDownloadType = type;
+ return this;
+ };
+ this.getDefaultDownloadType = function() {
+ return obj.defaultDownloadType;
+ };
+
+ this.setSaiDownloadType = function(type) {
+ if (type === undefined)
+ type = obj.defaultDownloadType;
+
+ obj.saiDownloadType = type;
+ return this;
+ };
+ this.getSaiDownloadType = function() {
+ return obj.saiDownloadType;
+ };
+
+ this.setAihDownloadType = function(type) {
+ obj.aihDownloadType = type;
+ return this;
+ };
+ this.getAihDownloadType = function() {
+ return obj.aihDownloadType;
+ };
+
+ this.setstype = function(type) {
+ queryStringParameters.stype = type;
+ return this;
+ };
+ this.getstype = function() {
+ return queryStringParameters.stype;
+ };
+
+ this.setcr = function(type) {
+ queryStringParameters.cr = type;
+ return this;
+ };
+ this.getcr = function() {
+ return queryStringParameters.cr;
+ };
+
+ this.setButtonClass = function(str) {
+ if (str === undefined) {
+ jQuery.error("setButtonClass(): 'str' argument is required.");
+ }
+ obj.buttonClass = str;
+ return this;
+ }
+ this.getButtonClass = function() {
+ return obj.buttonClass;
+ }
+
+ this.isEnabled = function() {
+ return obj.getMainInstaller() !== undefined
+ && obj.getLocale() !== undefined
+ && obj.getDownloadCenter() !== undefined;
+ };
+
+ this.getQueryString = function() {
+ // Download pages use a different set of parameters than other pages
+ var params = obj.getDownloadType() == "download" ? [ "installer", "os", "browser_type", "browser_dist", "a", "b", "d", "p", "dualoffer", "mdualoffer","chromedefault", "type", "browser_vers", "cr", "stype" ] : [ "installer", "stype" ];
+
+ // Build the query string array
+ var queryString = [];
+ var isDualOffer = queryStringParameters.dualoffer !== undefined && queryStringParameters.dualoffer !== null && queryStringParameters.dualoffer ? true : false;
+ var isMDualOffer = queryStringParameters.mdualoffer !== undefined && queryStringParameters.mdualoffer !== null && queryStringParameters.mdualoffer ? true : false;
+ var isSamcap = queryStringParameters.samcap !== undefined && queryStringParameters.samcap !== null && queryStringParameters.samcap ? true : false;
+
+ $.each(params, function(key, value) {
+ if (queryStringParameters[value] === null || queryStringParameters[value] === undefined) return;
+ if(isDualOffer && (value == "a" || value == "d" )){
+ return;
+ }else if(isMDualOffer && (value == "a" || value == "d" )){
+ return;
+ }else{
+ $.log(" value=" + queryStringParameters[value]);
+ queryString.push([ value, queryStringParameters[value] ].join("="));
+ }
+ });
+
+ //set samcap for ltrosx when offer is accepted.
+ if(isSamcap) {
+ var sdid = '';
+ if (typeof samcapData !== 'undefined' && typeof samcapData.lightroom !== 'undefined' && typeof samcapData.lightroom[obj.getClientPlatformType()] !== 'undefined'){
+ sdid = samcapData.lightroom[obj.getClientPlatformType()];
+ }
+ else { //Fallback
+ if(obj.getClientPlatformType() == "Windows") {
+ sdid= 'KHBGG';
+ }
+ else {
+ sdid= 'KHBGH';
+ }
+ }
+ queryString.push([ 'sdid', sdid ].join("="));
+ }
+
+ if(isDualOffer){
+ $.each(queryStringParameters.aList, function(key, value) {
+ if($.trim(value).length > 0){
+ $.log("accept list value=" + value);
+ queryString.push(["a", value].join("="));
+ }
+ })
+
+ $.each(queryStringParameters.dList, function(key, value) {
+ if($.trim(value).length > 0){
+ $.log("decline list value=" + value);
+ queryString.push(["d", value].join("="));
+ }
+ })
+ }
+ if(isMDualOffer){
+ $.each(queryStringParameters.aList, function(key, value) {
+ if($.trim(value).length > 0){
+ $.log("accept list value=" + value);
+ queryString.push(["a", value].join("="));
+ }
+ })
+
+ $.each(queryStringParameters.dList, function(key, value) {
+ if($.trim(value).length > 0){
+ $.log("decline list value=" + value);
+ queryString.push(["d", value].join("="));
+ }
+ })
+ }
+ if(obj.getDirect()){
+ queryString.push(["direct", "true"].join("="));
+ }
+ if (!obj.isAihCompatible()){
+ queryString.push(["standalone", "1"].join("="));
+ }
+
+ return queryString;
+ };
+
+ this.getDownloadPageUrl = function() {
+
+ this.setDownloadType();
+
+ // Build the uri array
+ var uri = [
+ uriParameters.locale != "en" ? uriParameters.locale : null,
+ uriParameters.downloadcenter,
+ obj.isAihCompatible() ? uriParameters.downloadType : obj.saiDownloadType
+ ];
+
+ // Strip elements equal to null
+ uri = $.grep(uri, function(value) {
+ return value !== null;
+ });
+
+ // Pad the uri array with null elements to provide leading and trailing forward slashes
+ uri.splice(0, 0, null);
+ uri.splice(uri.length, 0, null);
+
+ // Join all elements and build a relative url string
+ return [ uri.join("/"), obj.getQueryString().join("&") ].join("?");
+ };
+
+ this.updateDownloadButton = function() {
+ if (obj.isEnabled()) {
+ return $(elem).removeClass(obj.buttonClass+"-disabled")
+ .removeAttr("disabled")
+ .attr("href", obj.getDownloadPageUrl());
+ } else {
+ return $(elem).addClass(obj.buttonClass+"-disabled")
+ .attr("disabled", true)
+ .attr("href", obj.originalUrl);
+ }
+ };
+
+ this.openExtraWindow = function() {
+ var userAgentObj = $.pbUserAgent().getClientUserAgent();
+ if (this.getClientBrowserType() == "MSIE" && userAgentObj.browser_vers <= 11 && this.getClientPlatformType() !== "Macintosh" && this.isAihCompatible()) {
+ // AIH work flow for IE.
+ var msie_aih_download_url = "";
+
+ if (obj.getLocale() !== undefined && obj.getLocale() !== 'en') {
+ msie_aih_download_url = "/"+obj.getLocale();
+ }
+ msie_aih_download_url += "/"+obj.getDownloadCenter()+"/download/msie/?"+obj.getQueryString().join("&");
+
+ window.open(
+ msie_aih_download_url
+ , "msiedownload"
+ , "status=0,toolbar=0,location=1,menubar=0,directories=0,resizable=1,scrollbars=1,height=1,width=1");
+ }
+ };
+
+ // Constructor should be run last
+ (function() {
+
+ // Retrieve the original href value
+ obj.setOriginalUrl(elem.attr("href"));
+
+ // Set instance values based on settings
+ obj.setMainInstaller(settings.mainInstaller);
+ obj.setMainInstallerName(settings.mainInstallerName);
+ obj.setMainInstallerBrowser(settings.mainInstallerBrowser);
+ obj.setMainInstallerArchitecture(settings.mainInstallerArchitecture);
+ obj.setMainInstallerAihCompatible(settings.mainInstallerAihCompatible);
+
+ obj.setAcceptedInstaller(settings.acceptedInstaller);
+ obj.setDeclinedInstaller(settings.declinedInstaller);
+ obj.setPreinstalledInstaller(settings.preinstalledInstaller);
+ obj.setBundledInstaller(settings.bundledInstaller);
+
+ obj.setClientPlatformType(settings.clientPlatformType);
+ obj.setClientPlatformDistribution(settings.clientPlatformDistribution);
+ obj.setClientPlatformArchitecture(settings.clientPlatformArchitecture);
+ obj.setClientBrowserType(settings.browser_type);
+ obj.setClientBrowserDistribution(settings.browser_dist);
+ obj.setClientBrowserVersion(settings.browser_vers);
+ obj.setClientPlatformMisc(settings.clientPlatformMisc);
+
+ obj.setOperatingSystem(settings.clientPlatformDistribution);
+ obj.setDownloadCenter(settings.downloadcenter);
+ obj.setDefaultDownloadType(settings.defaultDownloadType);
+ obj.setSaiDownloadType(settings.saiDownloadType);
+ obj.setAihDownloadType(settings.aihDownloadType);
+ obj.setstype(settings.sType);
+ obj.setcr(settings.cr);
+ obj.setLocale(settings.locale);
+ obj.setButtonClass(settings.buttonClass);
+ obj.setUseAihIfPossible(settings.useAihIfPossible);
+ obj.setType(settings.type);
+ if(settings.direct !== undefined && settings.direct === true){
+ obj.setDirect(settings.direct);
+ }
+
+ if(settings.downloadNowText !== undefined && !obj.isAihCompatible()){
+ $(elem).text(settings.downloadNowText);
+ }
+
+ elem.click(function(event) {
+ // opens depending on client (AIH work flow for IE).
+ obj.openExtraWindow();
+ });
+
+ // Add the standard download-button class
+ if (!elem.hasClass(obj.buttonClass)) {
+ elem.addClass(obj.buttonClass);
+ }
+ })();
+ };
+
+ $.fn.downloadbutton = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('downloadbutton')) return;
+ element.data('downloadbutton', new DownloadButton(this, options));
+ });
+ };
+})(jQuery);
+
+/**
+ * $Header: /source/docroot/downloadcenter/js/live/polarbear.otherversions.js,v 1.21 2012/02/16 21:21:28 alongnio Exp $
+ */
+ (function($) {
+ var OtherVersions = function(element, options) {
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options || {});
+ var selectBoxes = [];
+
+ var init = function() {
+ // Generate DOM nodes for select boxes and options
+ obj.setSelectBoxes(obj.generateSelectBoxes(settings.steps));
+ obj.generateSelectOptions(obj.getSelectBoxes(), settings.options, null, 0);
+ // keep to original URL, so we can set it back if necessary
+ obj.originalSysRequirementsUrl = settings.config.sysRequirementsLink.prop("href");
+
+ $.each(obj.getSelectBoxes(), function(key, select) {
+ select.bind("resetOptions", obj.getResetEventHandler());
+
+ if (key != obj.getSelectBoxes().length - 1) {
+ // Bind event handlers to the select boxes
+ select.bind("updateOptions.fromSelectBox", obj.getUpdateEventHandler());
+ select.bind("change.updateNextStep", obj.getChangeNextStepEventHandler());
+ } else {
+ // But the last select box has different event handlers
+ select.bind("updateOptions.fromAjax", obj.getAjaxEventHandler(obj.getSelectBoxes(), settings.config));
+ select.bind("change.updateDownloadContent", obj.getChangeDownloadContentEventHandler(settings.config));
+ }
+ // Reset the options to the default and add this select to the array of all selects
+ select.trigger("resetOptions");
+ })
+ // Populate options in the first select box
+ obj.getSelectBoxes()[0].trigger("updateOptions", [ null ]).prop('disabled', false).focus();
+ };
+
+ function sortByName(a,b){
+ var a_array=a.Name.split(" ");
+ var b_array=b.Name.split(" ");
+ if(a_array && b_array){
+ //return a.Name < b.Name ? 1 : -1;
+ return parseFloat(b_array[1]) - parseFloat(a_array[1]);
+ }
+ };
+
+ this.generateSelectBoxes = function(steps) {
+ // Iteratively generate the select boxes
+ var nodes = [];
+ $.each(steps, function(key, step) {
+ var seperator = $("
").append($(" ").prop("for",step.label).text(step.label));
+ var select = $(" ").prop("id", step.id).data("options", {}).data("defaultOption", step.defaultOption);
+ select.css("width", 300);
+ elem.append(seperator).append($("
").append(select));
+ // Add request parameters
+ select.data("requestParameters", step.requestParameters);
+ // Assign references to the next and previous select boxes
+ nodes.push(select);
+ if (nodes.length > 1) {
+ nodes[key - 1].data("nextSelectBox", select);
+ }
+ // Assign the nextSelectBox to null for the last select box
+ if (nodes.length == steps.length) {
+ select.data("nextSelectBox", null);
+ }
+ });
+ // Return the select objects in order
+ return nodes;
+ };
+
+ this.generateSelectOptions = function(selects, options, key, index) {
+ $.each(options, function(i) {
+ $.each(options[i], function(option, value) {
+ // Store a new array of options by key in the current select box
+ if (selects[index].data("options")[key] === undefined) {
+ selects[index].data("options")[key] = [ ];
+ }
+ // Add an option to the select box by key
+ selects[index].data("options")[key].push(option);
+ // Recurse into the next depth level
+ if (value !== null) {
+ obj.generateSelectOptions(selects, value, option, index + 1);
+ }
+ });
+ });
+ return this;
+ };
+
+ this.getResetEventHandler = function(select) {
+ // The reset event restores this select box to a default state
+ return function(event) {
+ $(event.currentTarget).empty()
+ .prop('disabled', 'disabled')
+ .append($(" ", { value: "default", selected: "selected" })
+ .text($(event.currentTarget).data("defaultOption")));
+ }
+ }
+
+ this.getUpdateEventHandler = function() {
+ // The update event populates this select box with the option elements matching
+ // the select from a previous select box
+ return function(event, selection) {
+ if ($(event.currentTarget).data("options")[selection]) {
+ // Reset the options if the selection matched one of the available choices
+ $(event.currentTarget).trigger("resetOptions");
+ // Iteratively generate new options
+ $.each($(event.currentTarget).data("options")[selection], function(key, option) {
+ $(event.currentTarget).append($(" ", { value: option }).text(option));
+ });
+ }
+ }
+ }
+
+ this.getChangeNextStepEventHandler = function() {
+ // The change event updates the next select box or resets all subsequent select boxes
+ // if the user chooses a default option
+ return function(event) {
+ // Reset all subsequent select boxes
+ var nextSelectBox = $(event.currentTarget).data("nextSelectBox");
+ while (nextSelectBox !== null) {
+ nextSelectBox.trigger("resetOptions");
+ nextSelectBox.trigger("change.updateDownloadContent").prop('disabled', 'disabled');
+ nextSelectBox = nextSelectBox.data("nextSelectBox");
+ }
+ // Update the next event
+ if ($(event.currentTarget).data("nextSelectBox") !== null) {
+ $(event.currentTarget).data("nextSelectBox").trigger("updateOptions", [ event.currentTarget.value ]);
+ $(event.currentTarget).data("nextSelectBox").trigger("change.updateDownloadContent");
+
+ // if it has more than just a default option, re-enable this select
+ if ($(event.currentTarget).data("nextSelectBox").children().length > 1) {
+ $(event.currentTarget).data("nextSelectBox").fadeOut(200).fadeIn(300);
+ $(event.currentTarget).data("nextSelectBox").prop('disabled', false).focus();
+ }
+ }
+ }
+ }
+
+ this.getChangeDownloadContentEventHandler = function(config) {
+ return function(event) {
+ if (event.currentTarget.value != "default") {
+ var selectedInstaller = $(event.currentTarget).data("installers")[event.currentTarget.value];
+ var bytesAbbreviation = config.megabyteAbbreviation;
+
+ // set installer info to determine if it's AIH compatible
+ config.downloadButton.setMainInstaller(selectedInstaller.queryName);
+ config.downloadButton.setMainInstallerName(selectedInstaller.Name);
+ config.downloadButton.setMainInstallerAihCompatible(selectedInstaller.aih_compatible);
+ config.downloadButton.updateDownloadButton();
+ if (config.displayProperties.bundledAddon !== undefined) {
+ config.displayProperties.bundledAddon.html("");
+ }
+
+ // Populate the display properties
+ $.each(config.displayProperties, function(property, node) {
+ if(config.locale !== undefined && property == 'file_size'){
+ node.text( $.localizeNumber(selectedInstaller[property],config.locale));
+ }else{
+ node.text( selectedInstaller[property] );
+ }
+ });
+
+ if (selectedInstaller.Name.match(/YUM/)) {
+ bytesAbbreviation = config.kilobyteAbbreviation;
+ }
+ config.displayProperties.fileSizeLabel.html(bytesAbbreviation);
+
+ // Handle addons
+ if (config.addons !== undefined) {
+ config.addons.reset();
+ }
+
+ $("#playerInformationPane").hide();
+ $("#offersInformationPane").hide();
+
+ var useAddon = config.addons !== undefined && selectedInstaller.aih_optional_addons !== undefined && config.downloadButton.isAihCompatible();
+ if (useAddon) {
+ var result = config.addons.getBestOfferFromList(selectedInstaller.aih_optional_addons);
+ if (result !== undefined) {
+ config.addons.preinstalled(result.preinstalled);
+ config.addons.offerOptionalAddon(result.best);
+ var addonOffered = config.addons.getAddonById(result.best);
+ if(typeof(addonOffered) != "undefined" && (addonOffered.abbr === "ltrosx" || addonOffered.abbr === "ltrosxjp" || addonOffered.abbr === "ltr5x32" || addonOffered.abbr === "ltr5x64")){
+ result.accepted = false;
+ }
+ result.accepted ? config.addons.accept() : config.addons.decline();
+ }
+ if (result.best == undefined || result.best == "" ) {
+ $("#playerInformationPane").show();
+ }
+ else {
+ $("#offersInformationPane").show();
+ }
+ if (selectedInstaller.aih_bundled_addons != "") {
+ config.addons.offerBundledAddon(selectedInstaller.aih_bundled_addons, selectedInstaller.aih_version_suffix);
+ }
+
+ } else if (selectedInstaller.aih_version_suffix !== undefined && selectedInstaller.aih_version_suffix != "" && selectedInstaller.aih_compatible != 1) {
+ //config.displayProperties.bundledAddon.html(selectedInstaller.aih_version_suffix);
+ $("#playerInformationPane").show();
+ $("#totalsize").text($("#clientfilesize").text());
+ } else {
+ $("#playerInformationPane").show();
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+
+ $("#buttonDownload").removeClass("ButtonGrey");
+ $("#buttonDownload").addClass("ButtonYellow");
+
+ // append query strings to modal link
+ if (config.sysRequirementsLink !== undefined && config.sysRequirementsUrl !== undefined) {
+ if (selectedInstaller.aih_version_suffix !== undefined && selectedInstaller.aih_version_suffix != "") {
+ var readerVersion = selectedInstaller.aih_version_suffix;
+ }
+ else {
+ var readerVersion = selectedInstaller.Version;
+ }
+ var sysRequirementsUrl = config.sysRequirementsUrl + "&version=" + readerVersion;
+ var selectOS = $('#select_os');
+ var selectedPlatformType = selectOS.data("requestParameters")[selectOS.val()]["platform_type"];
+ var majorVersion = readerVersion.toString().split('.')[0];
+ // only need these if we need a minor version exception
+ var minorVersion = readerVersion.toString().split('.')[1];
+ var shortVers = majorVersion + "." + minorVersion;
+
+ // only versions higher than 10 currently have SSI files for the modal window to display
+ if (majorVersion > 9 || (config.downloadButton.getDownloadCenter() == "air" && majorVersion > 2)) {
+ sysRequirementsUrl = sysRequirementsUrl + "&os=" + selectedPlatformType;
+ config.sysRequirementsLink.prop("href", sysRequirementsUrl);
+ config.sysRequirementsLink.removeAttr("target");
+ } else {
+ // reset link to original state
+ config.sysRequirementsLink.prop("href", obj.originalSysRequirementsUrl);
+ config.sysRequirementsLink.prop("target", "_blank");
+ config.sysRequirementsLink.unbind().removeData();
+ }
+ }
+
+ config.downloadContent.show();
+ } else {
+ // Disable and hide
+ if (config.addons !== undefined) {
+ config.addons.reset();
+ }
+ config.downloadButton.setMainInstaller();
+ config.downloadButton.setMainInstallerName();
+ config.downloadButton.setMainInstallerAihCompatible();
+ config.downloadButton.updateDownloadButton();
+ config.downloadContent.hide();
+ }
+
+ var selectOS = $('#select_os');
+ var selectVersion = $('#select_version');
+
+ if (selectOS.val() == "default" || selectVersion.val() == "default") {
+ if (config.addons !== undefined) {
+ config.addons.reset();
+ }
+ $("#playerInformationPane").show();
+ $("#offersInformationPane").hide();
+
+ $("#buttonDownload").removeClass("ButtonYellow");
+ $("#buttonDownload").addClass("ButtonGrey");
+ $("#totalsize").text("");
+ $("#total_size_text").hide();
+ }
+ else {
+ $("#total_size_text").show();
+ }
+
+ var selectedPlatformType = selectOS.data("requestParameters")[selectOS.val()]["platform_type"];
+ if(config.downloadButton.getClientPlatformType() !== selectedPlatformType){
+ config.downloadButton.setClientPlatformType(selectedPlatformType);
+ }
+ }
+ }
+
+ this.getAjaxEventHandler = function(selects, config) {
+ return function(event, selection) {
+ // Get request parameters from previous select boxes and generate query string
+ var q = [];
+ var cancelThisEvent = false;
+ $.each(selects, function(index, select) {
+ // Terminate early if one of the select boxes has a default selection
+ if (index < selects.length - 1 && select.val() == "default") {
+ cancelThisEvent = true;
+ return false;
+ }
+ // Build the query string
+ if (select.data("requestParameters")[select.val()]) {
+ $.each(select.data("requestParameters")[select.val()], function(key, value) {
+ q.push([ key, value ].join("="));
+ });
+ }
+ });
+
+ if (cancelThisEvent) {
+ return false;
+ }
+
+ // Note: I had to wrap this in a closure to preserve the original select box reference
+ (function(select) {
+ $.ajax({
+ url: [ config.webserviceUrl, q.join("&") ].join("?"),
+ beforeSend: function() {
+ // Show the spinner graphic
+ config.ajaxLoader.show();
+ },
+ success: function(installers) {
+ // remove error if there was one previously
+ if (config.errorBox.text().length) {
+ config.errorBox.fadeOut(300);
+ }
+ // Show unavailable message if no installers were found
+ if (installers.length == 0) {
+ config.unavailableContent.show();
+ return false;
+ }
+ // Setup the data for this select box
+ select.data("options", {});
+ select.data("options")[selection] = [];
+ select.data("installers", {});
+
+ // Sort Installers in Descending order
+ if(settings.config.sorting !== undefined && settings.config.sorting){
+ installers = $(installers).sort(sortByName);
+ }
+
+ // Add installers and options to the data of this select box
+ $.each(installers, function(i, installer) {
+ select.data("options")[selection].push(installer.Name);
+ select.data("installers")[installer.Name] = installer;
+ });
+ },
+ complete: function() {
+ // Hide the spinner graphic
+ config.ajaxLoader.hide();
+ // Bind the original updateOptions event and fire it off
+ select.bind("updateOptions.fromSelectBox", obj.getUpdateEventHandler());
+ select.trigger("updateOptions.fromSelectBox", [ selection ]);
+ select.fadeOut(100).fadeIn(300).prop('disabled', false).focus();
+ select.unbind("updateOptions.fromSelectBox");
+ },
+ error: function(xhr, errorType) {
+ if (errorType === "error"){
+ obj.showError( xhr.status,
+ xhr.statusText,
+ xhr.responseText,
+ config.errorMessage,
+ config.errorBox );
+ }
+ }
+ });
+ })($(event.currentTarget));
+ }
+ }
+
+
+ this.setSelectBoxes = function(selects) {
+ selectBoxes = selects;
+ return this;
+ };
+ this.getSelectBoxes = function() {
+ return selectBoxes;
+ };
+
+ this.showError = function( statusCode, statusText, errors, friendlyMessage, errorBox ) {
+ // NOTE: only uncomment logging for debugging on dev
+ //$.log('statusCode: '+statusCode);
+ //$.log('statusText: '+statusText);
+ //$.log('errors: '+errors);
+
+ // return friendly error message with nice animation to draw attention
+ errorBox.html(friendlyMessage).hide().fadeIn(1300);
+ };
+ init();
+ };
+
+ $.fn.otherversions = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('otherversions')) return;
+ element.data('otherversions', new OtherVersions(this, options));
+ });
+ };
+})(jQuery);
+
+(function($){
+
+ var DualOffer = function(element, options){
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options ||{});
+ var dualStruct = {
+ gtbcheckbox : undefined,
+ chrcheckbox : undefined,
+ chrdefcheckbox : undefined
+ };
+
+ var init = function() {
+ dualStruct.gtbcheckbox = settings.gtb;
+ dualStruct.chrcheckbox = settings.chr;
+ dualStruct.chrdefcheckbox = settings.chromedefault;
+ obj.getContainer();
+ };
+
+ this.getContainer = function(){
+ //elem.append(obj.getGtbCheckbox()).append(obj.getChrCheckbox()).append(obj.getChrDefaultCheckbox());
+ elem.append(obj.getChrDefaultCheckbox());
+ }
+
+ /*this.getGtbCheckbox = function(){
+ var addon = dualStruct.gtbcheckbox;
+ var localeFileSize = addon.SIZE;
+ if(settings.locale !== undefined){
+ localeFileSize = $.localizeNumber(localeFileSize,settings.locale);
+ }
+
+ var filesize = $(" ").text(" (" + localeFileSize + " " + settings.megabyteAbbr + ")");
+
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0)
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','gtbcheckbox').css({position: 'relative'});
+ else
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','gtbcheckbox');
+
+ inputcheckbox.on("change",obj.checkboxEventHandler);
+ var spanforimage = $(" ").attr('class','CheckboxImage');
+ var labelforcheckbox = $(" ").attr('for','gtbcheckbox');
+ labelforcheckbox.append(spanforimage);
+ labelforcheckbox.append(addon.TEXT);
+ labelforcheckbox.append(filesize);
+ var offer = $("
").attr('id','AUTO_ID_js_div_gtb_checkbox').attr('class','Checkbox dialog');
+ //var offer = "";
+ inputcheckbox.appendTo(offer);
+ labelforcheckbox.appendTo(offer);
+
+ return offer;
+ }
+
+ this.getChrCheckbox = function(){
+ var addon = dualStruct.chrcheckbox;
+ var localeFileSize = addon.SIZE;
+ if(settings.locale !== undefined){
+ localeFileSize = $.localizeNumber(localeFileSize,settings.locale);
+ }
+ var filesize = $(" ").text(" (" + localeFileSize + " " + settings.megabyteAbbr + ")");
+
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0)
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','chrcheckbox').css({position: 'relative'});
+ else
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','chrcheckbox');
+
+ inputcheckbox.on("change",obj.checkboxEventHandler);
+ var spanforimage = $(" ").attr('class','CheckboxImage');
+ var labelforcheckbox = $(" ").attr('for','chrcheckbox');
+ labelforcheckbox.append(spanforimage);
+ labelforcheckbox.append(addon.TEXT);
+ labelforcheckbox.append(filesize);
+ var offer = $("
").attr('id','AUTO_ID_js_div_chr_checkbox').attr('class','Checkbox dialog');
+ //var offer = "";
+ inputcheckbox.appendTo(offer);
+ labelforcheckbox.appendTo(offer);
+
+ return offer;
+ }*/
+
+ this.getChrDefaultCheckbox = function(){
+ var addon = dualStruct.chrdefcheckbox;
+
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0)
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox').css({position: 'relative'});
+ else
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox');
+
+ inputcheckbox.on("change",obj.checkboxEventHandler);
+ var spanforimage = $(" ").attr('id','CheckboxImageChrDef').attr('class','CheckboxImage');
+ var labelforcheckbox = $(" ").attr('for','chrdefcheckbox');
+ var brspace = $(" ");
+ labelforcheckbox.append(spanforimage);
+ labelforcheckbox.append(addon.TEXT);
+ var offer = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').attr('class','Checkbox dialog');
+ brspace.appendTo(offer);
+ inputcheckbox.appendTo(offer);
+ labelforcheckbox.appendTo(offer);
+
+ return offer;
+ }
+
+ this.checkboxEventHandler = function(event) {
+ var selectedOption = dualStruct[this.id];
+
+ if($(event.currentTarget).attr('checked'))
+ {
+ if (($('#offerLabelDef').length) && ($('#offerLabelNonDef').length) && ($("#offerCheckbox").attr("checked"))) {
+ $("#offerLabelNonDef").hide();
+ $("#offerLabelDef").show();
+ }
+ if ($("#offerCheckbox").attr("checked"))
+ {
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ else
+ {
+ $("#chrdefcheckbox").attr({checked: false});
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ }
+ else
+ {
+ if (($('#offerLabelDef').length) && ($('#offerLabelNonDef').length)) {
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ //if (this.id === "chrdefcheckbox") {
+ /*if ($(event.currentTarget).attr('checked') && !$("#chrcheckbox").attr('checked')) {
+ $("#chrdefcheckbox").attr({checked: false});
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }*/
+// else {
+ //$(event.currentTarget).attr('checked') ? settings.downloadButton.data("downloadbutton").setChromeDefault(true) : settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ //}
+ //}
+ /*else {
+ if(this.id === "chrcheckbox" && !$(event.currentTarget).attr('checked')){
+ $("#chrdefcheckbox").attr({ checked: false });
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }else if(this.id === "chrcheckbox" && $(event.currentTarget).attr('checked')){
+ $("#chrdefcheckbox").attr({ checked: true });
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ }
+ $(event.currentTarget).attr('checked') ? settings.downloadButton.data("downloadbutton").addAcceptInstallerList(selectedOption.QNAME) : settings.downloadButton.data("downloadbutton").addDeclineInstallerList(selectedOption.QNAME);
+ }*/
+
+// obj.displayFileSizeAndLink();
+// settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+// settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+// settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+
+
+ this.reset = function(event){
+
+ if(!$("#offerCheckbox").attr("checked"))
+ {
+ $("#chrdefcheckbox").attr('checked', false);
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ obj.clearDualOfferCookies();
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+
+ this.selectAll = function(event,installOptionAddon){
+
+ if (event === undefined)
+ {
+ $("#chrdefcheckbox").attr('checked', true);
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ }
+ if (installOptionAddon==='dual')
+ {
+ if (event === undefined && obj.getOfferCookieGTB())
+ {
+ obj.setCheckboxFromCookie();
+ }
+ else
+ {
+ if(!$("#offerCheckbox1").attr('checked')){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.gtbcheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.gtbcheckbox.QNAME);
+ }
+ if(!$("#offerCheckbox").attr('checked')){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ if(!$("#chrdefcheckbox").attr('checked')){
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ }
+ if($("#offerCheckbox").attr('checked') && (!$("#chrdefcheckbox").attr('checked')) && event !== undefined && event.currentTarget.id === "offerCheckbox") {
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ }
+ }
+ else if (installOptionAddon==='chr') {
+ if($("#offerCheckbox").attr('checked') && (!$("#chrdefcheckbox").attr('checked')) && event !== undefined && event.currentTarget.id === "offerCheckbox") {
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ }
+ }
+
+ this.getOfferCookieGTB = function() {
+
+ var gtbname = settings.downloadcenter + "gtbchoice";
+ var rexpGtb = new RegExp(gtbname + "=(.*)");
+ var resultGTB = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testGtb = cookie.match(rexpGtb))) {
+ resultGTB = unescape(decodeURI(testGtb[1]));
+ return false;
+ }
+ });
+ return resultGTB;
+ };
+
+ this.getOfferCookieCHR = function() {
+ var chrname = settings.downloadcenter + "chrchoice";
+ var rexpChr = new RegExp(chrname + "=(.*)");
+ var resultCHR = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testChr = cookie.match(rexpChr))) {
+ resultCHR = unescape(decodeURI(testChr[1]));
+ return false;
+ }
+ });
+ return resultCHR;
+ };
+
+ this.getOfferCookiedefCHR = function() {
+ var chrdefname = settings.downloadcenter + "defchrchoice";
+ var rexpdefChr = new RegExp(chrdefname + "=(.*)");
+ var resultdefCHR = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testdefChr = cookie.match(rexpdefChr))) {
+ resultdefCHR = unescape(decodeURI(testdefChr[1]));
+ return false;
+ }
+ });
+ return resultdefCHR;
+ };
+
+ this.setCookie = function() {
+
+ var addon= "dual";
+ var gtbchoice=$("#offerCheckbox1").attr("checked") ? true : false;
+ var chrchoice=$("#offerCheckbox").attr("checked") ? true : false;
+ var defchrchoice=$("#chrdefcheckbox").attr("checked") ? true : false;
+ window.document.cookie = settings.downloadcenter + "offerchoice" + "=" + escape(addon + "=" + true) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "gtbchoice" + "=" + escape("GTB=" + gtbchoice) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "chrchoice" + "=" + escape("CHR=" + chrchoice) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "defchrchoice" + "=" + escape("defChr=" + defchrchoice) + ";path=/";
+ }
+
+ this.clearDualOfferCookies = function(){
+ jaaulde.utils.cookies.set(settings.downloadcenter + "offerchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "gtbchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "chrchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "defchrchoice","",-1,"/");
+ }
+
+ /*this.displayFileSizeAndLink = function(){
+ var localeTotalFileSize = 0;
+ if(!$("#gtbcheckbox").attr('checked') && !$("#chrcheckbox").attr('checked'))
+ {
+ $('#adobeEULA').html(settings.adobeEula);
+ //$("#offerCheckbox").attr({ checked: false });
+ $("#CheckboxImage").fadeTo(1,1.0);
+ $(".addonResourcesCHR").hide();
+ $(".addonResourcesGTB").hide();
+ $('#dualEulaLink').attr('href',settings.eulaLink);
+ }else if(!$("#gtbcheckbox").attr('checked') && $("#chrcheckbox").attr('checked')){
+ $('#adobeEULA').html(settings.adobeDualEula);
+ //$("#offerCheckbox").attr({ checked: true });
+ $("#CheckboxImage").fadeTo(1,0.5);
+ $(".addonResourcesCHR").show();
+ $(".addonResourcesGTB").hide();
+ $('#dualEulaLink').attr('href',settings.eulaLink + settings.eulaLinkCHR);
+ localeTotalFileSize = dualStruct.chrcheckbox.SIZE;
+
+ }else if($("#gtbcheckbox").attr('checked') && !$("#chrcheckbox").attr('checked')){
+
+ $('#adobeEULA').html(settings.adobeDualEula);
+ //$("#offerCheckbox").attr({ checked: true });
+ $("#CheckboxImage").fadeTo(1,0.5);
+ $(".addonResourcesCHR").hide();
+ $(".addonResourcesGTB").show();
+ $('#dualEulaLink').attr('href',settings.eulaLink + settings.eulaLinkGTB);
+ localeTotalFileSize = dualStruct.gtbcheckbox.SIZE;
+
+ }else if($("#gtbcheckbox").attr('checked') && $("#chrcheckbox").attr('checked'))
+ {
+ $('#adobeEULA').html(settings.adobeDualEula);
+ //$("#offerCheckbox").attr({ checked: true });
+ $("#CheckboxImage").fadeTo(1,1.0);
+ $(".addonResourcesGTB").show();
+ $(".addonResourcesCHR").show();
+ $('#dualEulaLink').attr('href',settings.eulaLink);
+ localeTotalFileSize = dualStruct.gtbcheckbox.SIZE + dualStruct.chrcheckbox.SIZE;
+
+ }
+
+ if($("#gtbcheckbox").attr('checked') && $("#chrcheckbox").attr('checked') && !$("#chrdefcheckbox").attr('checked')){
+ $("#CheckboxImage").fadeTo(1,0.5);
+ }
+ obj.setTotalFileSize(localeTotalFileSize,'accept');
+ }*/
+
+ /*this.setTotalFileSize = function(totalSize,callfrom){
+ var localeTotalFileSize = totalSize;
+ if(settings.locale !== undefined){
+ localeTotalFileSize = $.localizeNumber(localeTotalFileSize,settings.locale);
+ }
+ if (callfrom == 'decline')
+ {
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else
+ {
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) + parseFloat(localeTotalFileSize))*100)/100;
+ $("#totalsize").text($.localizeNumber(fullsize,settings.locale));
+ }
+ }*/
+
+ this.setCheckboxFromCookie = function(){
+ if((cookieGTB = obj.getOfferCookieGTB())){
+ var gtbcheck = cookieGTB.split("=")[1] == "true" ? true : false;
+
+ $("#offerCheckbox1").attr({ checked: gtbcheck });
+ if(!gtbcheck){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.gtbcheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.gtbcheckbox.QNAME);
+ }
+ }
+
+ if((cookieCHR = obj.getOfferCookieCHR())){
+ var chrcheck = cookieCHR.split("=")[1] == "true" ? true : false;
+ $("#offerCheckbox").attr({ checked: chrcheck });
+ if(!chrcheck){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ }
+
+ if((cookiedefCHR = obj.getOfferCookiedefCHR())){
+ var defchrcheck = cookiedefCHR.split("=")[1] == "true" ? true : false;
+ $("#chrdefcheckbox").attr({ checked: defchrcheck });
+ if (!defchrcheck) {
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ settings.downloadButton.data("downloadbutton").setChromeDefault(defchrcheck);
+ }
+ }
+
+ init();
+ }
+
+ $.fn.dualoffer = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('dualoffer')) return;
+ element.data('dualoffer', new DualOffer(this, options));
+ });
+ }
+
+})(jQuery);
+
+(function($){
+
+ var MdualOffer = function(element, options){
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options ||{});
+ var dualStruct = {
+ msscheckbox : undefined,
+ msccheckbox : undefined
+ };
+
+ var init = function() {
+ dualStruct.msscheckbox = settings.mss;
+ dualStruct.msccheckbox = settings.msc;
+ };
+
+ this.reset = function(event){
+ obj.clearDualOfferCookies();
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+
+ this.selectAll = function(event,installOptionAddon){
+
+ if (event === undefined && obj.getOfferCookieMSC())
+ {
+ obj.setCheckboxFromCookie();
+ }
+ else
+ {
+ if(!$("#offerCheckbox1").attr('checked')){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.msccheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.msccheckbox.QNAME);
+ }
+ if(!$("#offerCheckbox").attr('checked')){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.msscheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.msscheckbox.QNAME);
+ }
+ }
+ }
+
+ this.getOfferCookieMSS = function() {
+
+ var mssname = settings.downloadcenter + "msschoice";
+ var rexpMss = new RegExp(mssname + "=(.*)");
+ var resultMSS = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testMss = cookie.match(rexpMss))) {
+ resultMSS = unescape(decodeURI(testMss[1]));
+ return false;
+ }
+ });
+ return resultMSS;
+ };
+
+ this.getOfferCookieMSC = function() {
+ var mscname = settings.downloadcenter + "mscchoice";
+ var rexpMsc = new RegExp(mscname + "=(.*)");
+ var resultMsc = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testMsc = cookie.match(rexpMsc))) {
+ resultMsc = unescape(decodeURI(testMsc[1]));
+ return false;
+ }
+ });
+ return resultMsc;
+ };
+
+ this.setCookie = function() {
+
+ var addon= "mdual";
+ var mscchoice=$("#offerCheckbox1").attr("checked") ? true : false;
+ var msschoice=$("#offerCheckbox").attr("checked") ? true : false;
+ window.document.cookie = settings.downloadcenter + "offerchoice" + "=" + escape(addon + "=" + true) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "msschoice" + "=" + escape("MSS=" + msschoice) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "mscchoice" + "=" + escape("MSC=" + mscchoice) + ";path=/";
+ }
+
+ this.clearDualOfferCookies = function(){
+ jaaulde.utils.cookies.set(settings.downloadcenter + "offerchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "msschoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "mscchoice","",-1,"/");
+ }
+
+ this.setCheckboxFromCookie = function(){
+ if((cookieMSS = obj.getOfferCookieMSS())){
+ var msscheck = cookieMSS.split("=")[1] == "true" ? true : false;
+
+ $("#offerCheckbox").attr({ checked: msscheck });
+ if(!msscheck){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.msscheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.msscheckbox.QNAME);
+ }
+ }
+
+ if((cookieMSC = obj.getOfferCookieMSC())){
+ var msccheck = cookieMSC.split("=")[1] == "true" ? true : false;
+ $("#offerCheckbox1").attr({ checked: msccheck });
+ if(!msccheck){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.msccheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.msccheckbox.QNAME);
+ }
+ }
+ }
+ init();
+ }
+
+ $.fn.mdualoffer = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('mdualoffer')) return;
+ element.data('mdualoffer', new MdualOffer(this, options));
+ });
+ }
+
+})(jQuery);
+/**
+ * $Header: /source/docroot/downloadcenter/js/live/polarbear.addons.js,v 1.11 2012/01/24 18:40:19 clechner Exp $
+ */
+ (function($) {
+ var Addons = function(element, options) {
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options || {});
+ var state = {
+ preinstalled: undefined,
+ optional: undefined,
+ bundled: undefined
+ };
+
+ var addons = {
+ byId: {},
+ byAbbr: {},
+ byGroup: {}
+ };
+
+ var init = function() {
+
+ };
+
+ this.registerAddon = function(id, properties) {
+ addons.byId[id] = properties;
+ addons.byAbbr[properties.abbr] = properties;
+ addons.byGroup[properties.group] = properties;
+ };
+
+ this.getBestOfferFromList = function(offers) {
+ var available = {};
+ var groups = [];
+ var result = { preinstalled: undefined, best: undefined, accepted: true, defaultAddon: undefined, singleAddon: undefined, brErrorCode: undefined };
+ var cookie;
+
+ if (offers === undefined) {
+ return;
+ }
+
+ var preinstalledAddonsArray = [];
+ var inPalSiteCatalyst = "false";
+ var eligibleAddonArray = [];
+
+ $.each(String(offers).split(/,/), function(k, id) {
+ // Only sort addons that have already been registered
+ var addon = obj.getAddonById(id);
+
+ if (addon === undefined) {
+ return;
+ }
+
+ if(addon.isEligibleOffer !== undefined && !addon.isEligibleOffer){
+ return;
+ }
+
+ if(addon.isDefault !== undefined && addon.isDefault == true){
+ result.defaultAddon = addon;
+ }
+ // Array containing the entire list of Addons
+ eligibleAddonArray.push(addon);
+
+ if(obj.isPal(addon.abbr)){
+ preinstalledAddonsArray.push(addon);
+ inPalSiteCatalyst = "true";
+ }
+
+
+ });
+
+ var eList = obj.getListAbbrFromAddonList(eligibleAddonArray);
+ var pList = obj.getListAbbrFromAddonList(preinstalledAddonsArray);
+ var initialeList = eList;
+ var initialpList = pList;
+
+ if (pList.indexOf('mdual') !== -1) {
+ if((pList.indexOf('mss') === -1) && (pList.indexOf('msc') === -1)) {
+ var pListArr = pList.split(",");
+ pListArr.splice(pListArr.indexOf("mdual"),1);
+ pList = pListArr.join();
+ }
+ }
+
+ if (navigator && (navigator.userAgent.indexOf("Edge") > -1))
+ {
+ eListArray = eList.split(",");
+ indexofgtb = eListArray.indexOf("gtb");
+
+ if(indexofgtb !== -1)
+ {
+ eListArray.splice(indexofgtb,1);
+ }
+ indexofdual = eListArray.indexOf("dual");
+
+ if(indexofdual !== -1)
+ {
+ eListArray.splice(indexofdual,1);
+ }
+ eList = eListArray.toString();
+
+ if((pList.indexOf('dual') !== -1) && (pList.indexOf('gtb') == -1))
+ {
+ var gtbinlist =",gtb";
+ pList = pList.concat(gtbinlist);
+ }
+
+ if((pList.indexOf('gtb') !== -1) || (pList.indexOf('chr') !== -1))
+ {
+ if(pList.indexOf('dual') == -1)
+ {
+ var duallist =",dual";
+ pList = pList.concat(duallist);
+ }
+ }
+ }
+
+ if((pList.indexOf('mss') !== -1) || (pList.indexOf('msc') !== -1))
+ {
+ var mudallist =",mdual";
+ pList = pList.concat(mudallist);
+ }
+
+ var bestOfferAbbr = undefined;
+ var req = {};
+
+ // Need to get geo detection.
+ req.country = "All";
+ req.language = "All";
+ if(obj.isObjInList(settings.brLanguageList, settings.language)){
+ req.language = settings.language;
+ }
+ if(obj.isObjInList(settings.brCountryList, settings.country)){
+ req.country = settings.country;
+ }
+ $.ajax({
+ url: "/webservices/adbr/",
+ global: false,
+ type: "GET",
+ data: {geo:req.country,language:req.language,dlc:settings.downloadcenter,os:settings.os,browser_type:settings.browser_type,browser_dist:settings.browser_dist},
+ dataType: "text",
+ async:false,
+ success: function(bestOfferFromBusinessRule){
+ try{
+ var returnedObject = $.parseJSON(bestOfferFromBusinessRule);
+ var bestOfferAbbr = settings.appdetection.getBestOffer(eList, pList,returnedObject.bestoffer);
+
+ if(bestOfferAbbr !== undefined || bestOfferAbbr != ""){
+ $.each(eligibleAddonArray, function(i,addon){
+ if(result.best === undefined && addon.abbr === bestOfferAbbr){
+ result.best = addon.id;
+ return false;
+ }
+ })
+ }
+ }catch(e){
+ result.best = undefined;
+ result.brErrorCode = 1001;
+ }
+ },
+ error: function(x, t, m){
+ result.brErrorCode = 1000;
+ }
+ }
+ );
+
+ if(result.best === undefined && result.defaultAddon !== undefined){
+ result.best = result.defaultAddon.id;
+ }
+
+ if(result.best === undefined && eligibleAddonArray[0] !== undefined){
+ result.best = eligibleAddonArray[0].id;
+ result.brErrorCode = 1002;
+ }
+
+
+ if(pList.length > 0){
+ // remove dual and replace with gtb
+ var pListArray = pList.split(",");
+ if(pListArray.indexOf("dual") !== -1){
+ pListArray.splice(pListArray.indexOf("dual"),1);
+ if(pListArray.indexOf("gtb") === -1){
+ pListArray.push("gtb");
+ }
+ }
+ if(pListArray.indexOf("ltr5x32") !== -1){
+ pListArray.splice(pListArray.indexOf("ltr5x32"), 1);
+ if(pListArray.indexOf("ltr5") === -1){
+ pListArray.push("ltr5");
+ }
+ }
+ if(pListArray.indexOf("ltr5x64") !== -1){
+ pListArray.splice(pListArray.indexOf("ltr5x64"), 1);
+ if(pListArray.indexOf("ltr5") === -1){
+ pListArray.push("ltr5");
+ }
+ }
+ pListArray.sort();
+ result.preinstalled = pListArray.join(",");
+
+ var mscinpreinstalled = result.preinstalled.indexOf("msc");
+ if(mscinpreinstalled != -1){
+ if(obj.getAddonById(result.best).abbr == "msc"){
+ result.best = "";
+ }
+ }
+
+ var mdualinpreinstalled = result.preinstalled.indexOf("mdual");
+ if(mdualinpreinstalled != -1){
+ if(obj.getAddonById(result.best).abbr == "mdual"){
+ result.best = "";
+ }
+ }
+
+ if(initialeList == initialpList)
+ {
+ result.best = "";
+ }
+ }
+
+ if(settings.siteCatalystWrapper !== undefined){
+ jaaulde.utils.cookies.set("palValue",inPalSiteCatalyst,0,"/",".adobe.com");
+ settings.siteCatalystWrapper.setSiteCatalystProperty("prop62", inPalSiteCatalyst);
+ settings.siteCatalystWrapper.setSiteCatalystRebootProperty("prop74", inPalSiteCatalyst);
+ if(result.brErrorCode !== undefined && result.best !== undefined){
+ settings.siteCatalystWrapper.setSiteCatalystRebootProperty("prop72", [settings.omniturePrefix + obj.getAddonById(result.best).abbr,result.brErrorCode].join("_"));
+ prop72Value = [settings.omniturePrefix + obj.getAddonById(result.best).abbr,result.brErrorCode].join("_");
+ jaaulde.utils.cookies.set("prop72Cookie",prop72Value,0,"/",".adobe.com");
+ }
+ }
+
+ // Test if there is already an offer cookie and override results if necessary
+ if ((cookie = obj.getOfferCookie())) {
+ var addon = obj.getAddonByAbbr(String(cookie).split("=")[0], offers);
+ if (addon && addon.id === result.best) {
+ result.best = addon.id;
+ result.accepted = String(cookie).split("=")[1] == "true" ? true : false;
+ result.cookie = String(cookie).split("=")[0];
+ $.log("Found offer cookie: " + addon.id + " | value = " + result.accepted);
+ }
+ }
+ $.log("Best offer is: " + result.best);
+
+ // Return the best addon
+ return result;
+
+ };
+
+ this.chrExtChkboxEventHandler = function(event) {
+ if($("#chrExtCheckbox").attr('checked'))
+ {
+ settings.downloadButton.data("downloadbutton").setcr(true);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ else
+ {
+ settings.downloadButton.data("downloadbutton").setcr(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ }
+
+ this.checkboxEventHandler = function(event) {
+ $.log("Checkbox: ");
+ if (this.id !== "chrdefcheckbox") {
+ $(event.currentTarget).attr('checked') ? obj.accept(event) : obj.decline(event);
+ }
+ else
+ {
+ if($("#chrdefcheckbox").attr('checked'))
+ {
+ if (($('#offerLabelDef').length) && ($('#offerLabelNonDef').length) && ($("#offerCheckbox").attr("checked"))) {
+ $("#offerLabelNonDef").hide();
+ $("#offerLabelDef").show();
+ }
+ if ($("#offerCheckbox").attr("checked"))
+ {
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ else
+ {
+ $("#chrdefcheckbox").attr({checked: false});
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ }
+ else
+ {
+ if (($('#offerLabelDef').length) && ($('#offerLabelNonDef').length)) {
+ $("#offerLabelDef").hide();
+ $("#offerLabelNonDef").show();
+ }
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ }
+ }
+
+ this.openNyroModal = function(event){
+ settings.dualModalWindow.click();
+ }
+
+ this.offerOptionalAddon = function(id) {
+ var addon = obj.getAddonById(id);
+
+ if ($("#chrchk").length) {
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0){
+ var inputcheckbox3 = $(" ").attr('type','checkbox').attr('id','chrExtCheckbox').attr("checked", true).css({position: 'relative'});
+ } else {
+ var inputcheckbox3 = $(" ").attr('type','checkbox').attr('id','chrExtCheckbox').attr("checked", true);
+ }
+ inputcheckbox3.on("change",obj.chrExtChkboxEventHandler);
+ var spanforimagebase3 = $(" ").attr('class','CheckboxImage');
+ var spanforimage3 = (IE_7_UserAgent) ? spanforimagebase3 : spanforimagebase3.attr('id','CheckboxImage3');
+ var labelforcheckbox3 = $(" ").attr('for','chrExtCheckbox');
+ labelforcheckbox3.append(spanforimage3);
+ labelforcheckbox3.append($("#chrchkText"));
+ var checkbox3 = $("
").attr('id','AUTO_ID_js_div_offer_checkbox3').addClass('Checkbox');
+ var learnMoreChrExt = $("
").append(""+ $("#chrchkLearn").text() +" ");
+ var marketingChromeExt = $("
").append($("
").append($("#chrchkLearnTxt").text()));
+ inputcheckbox3.appendTo(checkbox3);
+ labelforcheckbox3.appendTo(checkbox3);
+ $("#chrchk").addClass('Checkbox');
+ $("#chrchk").append(inputcheckbox3).append(labelforcheckbox3);
+ $("#chrextlearnmore").append(learnMoreChrExt).append(marketingChromeExt);
+ $("#chrchkText").css("display","block");
+ }
+
+ if(addon == undefined){
+ $("#offersInformationPane").hide();
+ $("#playerInformationPane").show();
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else {
+ if(addon.abbr === "dual" || addon.abbr === "mdual")
+ {
+ $("#AUTO_ID_columnright_h3_optional_offer").text(addon.text.optionalOffers);
+ }
+
+ if(addon.abbr !== "dual"){
+ var localeFileSize = addon.size;
+ if(settings.locale !== undefined){
+ localeFileSize = $.localizeNumber(localeFileSize,settings.locale);
+ }
+ }
+ if(addon.abbr === "gdr"){
+ $("#addonFileSize").text("");
+ } else{
+ $("#addonFileSize").text("Total size: " + localeFileSize + " " + settings.megabyteAbbr);
+ }
+ if (addon.abbr !== "dual" && addon.abbr !== "mdual") {
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0){
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','offerCheckbox').attr("checked", true).css({position: 'relative'});
+ }else{
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','offerCheckbox').attr("checked", true);
+ }
+ inputcheckbox.on("change",obj.checkboxEventHandler);
+ var IE_7_UserAgent = ($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 8.0);
+ var spanforimagebase = $(" ").attr('class','CheckboxImage');
+ var spanforimage = (IE_7_UserAgent) ? spanforimagebase : spanforimagebase.attr('id','CheckboxImage');
+ var labelforcheckbox = $(" ").attr('for','offerCheckbox');
+ labelforcheckbox.append(spanforimage);
+ if (addon.abbr === "chr") {
+ var labelfordeftext = $(" ").attr('id','offerLabelDef');
+ labelfordeftext.append(addon.text.checkboxChrome);
+ labelforcheckbox.append(labelfordeftext);
+ var labelfornondeftext = $(" ").attr('id','offerLabelNonDef').css('display','none');
+ labelfornondeftext.append(addon.text.checkboxChromeNonDef);
+ labelforcheckbox.append(labelfornondeftext);
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0)
+ var inputcheckbox2 = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox').css({position: 'relative'});
+ else
+ var inputcheckbox2 = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox');
+
+ inputcheckbox2.on("change",obj.checkboxEventHandler);
+ var spanforimage2 = $(" ").attr('id','CheckboxImageChrDef').attr('class','CheckboxImage');
+ var labelforcheckbox2 = $(" ").attr('for','chrdefcheckbox');
+ labelforcheckbox2.append(spanforimage2);
+ labelforcheckbox2.append(addon.text.chromedefault);
+ if (navigator && (navigator.userAgent.indexOf("Windows NT 10.0") > -1)){
+ var checkbox2 = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').attr('style','display:None;');
+ }else{
+ var checkbox2 = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').attr('class','Checkbox dialog');
+ }
+
+ inputcheckbox2.appendTo(checkbox2);
+ labelforcheckbox2.appendTo(checkbox2);
+ }else {
+ labelforcheckbox.append(addon.text.checkbox);
+ }
+ var checkbox = $("
").attr('id','AUTO_ID_js_div_offer_checkbox').addClass('Checkbox');
+ inputcheckbox.appendTo(checkbox);
+ labelforcheckbox.appendTo(checkbox);
+ }
+ else {
+
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0){
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','offerCheckbox').attr("checked", true).css({position: 'relative'});
+ }else{
+ var inputcheckbox = $(" ").attr('type','checkbox').attr('id','offerCheckbox').attr("checked", true);
+ }
+ inputcheckbox.on("change",obj.checkboxEventHandler);
+ var IE_7_UserAgent = ($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 8.0);
+ var spanforimagebase = $(" ").attr('class','CheckboxImage');
+ var spanforimage = (IE_7_UserAgent) ? spanforimagebase : spanforimagebase.attr('id','CheckboxImage');
+ var labelforcheckbox = $(" ").attr('for','offerCheckbox');
+ labelforcheckbox.append(spanforimage);
+ var labelfordeftext = $(" ").attr('id','offerLabelDef');
+ if (addon.abbr === "dual")
+ labelfordeftext.append(addon.text.checkboxChrome);
+ else
+ labelfordeftext.append(addon.text.checkboxMss);
+ labelforcheckbox.append(labelfordeftext);
+ var labelfornondeftext = $(" ").attr('id','offerLabelNonDef').css('display','none');
+ labelfornondeftext.append(addon.text.checkboxChromeNonDef);
+ labelforcheckbox.append(labelfornondeftext);
+ var checkbox = $("
").attr('id','AUTO_ID_js_div_offer_checkbox').addClass('Checkbox');
+ inputcheckbox.appendTo(checkbox);
+ labelforcheckbox.appendTo(checkbox);
+
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0){
+ var inputcheckbox1 = $(" ").attr('type','checkbox').attr('id','offerCheckbox1').attr("checked", true).css({position: 'relative'});
+ } else {
+ var inputcheckbox1 = $(" ").attr('type','checkbox').attr('id','offerCheckbox1').attr("checked", true);
+ }
+ inputcheckbox1.on("change",obj.checkboxEventHandler);
+ var spanforimagebase1 = $(" ").attr('class','CheckboxImage');
+ var spanforimage1 = (IE_7_UserAgent) ? spanforimagebase1 : spanforimagebase1.attr('id','CheckboxImage1');
+ var labelforcheckbox1 = $(" ").attr('for','offerCheckbox1');
+ labelforcheckbox1.append(spanforimage1);
+ if (addon.abbr === "dual")
+ labelforcheckbox1.append(addon.text.checkboxGTB);
+ else
+ labelforcheckbox1.append(addon.text.checkboxMsc);
+ var checkbox1 = $("
").attr('id','AUTO_ID_js_div_offer_checkbox1').addClass('Checkbox');
+ inputcheckbox1.appendTo(checkbox1);
+ labelforcheckbox1.appendTo(checkbox1);
+
+ if (addon.abbr === "dual"){
+ if($.browser.msie && parseFloat($.browser.version) >= 7.0 && parseFloat($.browser.version) < 9.0)
+ var inputcheckbox2 = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox').css({position: 'relative'});
+ else
+ var inputcheckbox2 = $(" ").attr('type','checkbox').attr('id','chrdefcheckbox');
+
+ inputcheckbox2.on("change",obj.checkboxEventHandler);
+ var spanforimage2 = $(" ").attr('id','CheckboxImageChrDef').attr('class','CheckboxImage');
+ var labelforcheckbox2 = $(" ").attr('for','chrdefcheckbox');
+ labelforcheckbox2.append(spanforimage2);
+ labelforcheckbox2.append(addon.text.chromedefault);
+ if (navigator && (navigator.userAgent.indexOf("Windows NT 10.0") > -1)){
+ var checkbox2 = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').attr('style','display:None;');
+ }else{
+ var checkbox2 = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').attr('class','Checkbox dialog');
+ }
+ //var checkbox2 = $("
").attr('id','AUTO_ID_js_div_chrdef_checkbox').addClass('Checkbox');
+ inputcheckbox2.appendTo(checkbox2);
+ labelforcheckbox2.appendTo(checkbox2);
+ }
+ }
+
+ var details = ''; //checkbox.append(addon.text.checkbox);
+ if(addon.abbr === "dual" || addon.abbr === "chrosx"){
+ //var installoptions = $("").text(addon.text.installoptions).click(obj.openNyroModal);
+ //var detailsWithOptions = details.append(" ").append(installoptions);
+ var offer = $("
").append(checkbox).append(checkbox2).append(checkbox1);//append(detailsWithOptions);
+ }else if (addon.abbr === "mdual"){
+ var offer = $("
").append(checkbox).append(checkbox1);
+ }else{
+ var offer = $("
").append(checkbox).append(details);
+ }
+
+ var image = $("
").append($(" ").attr({ src: addon.image.src, width: addon.image.width, height: addon.image.height, alt: addon.image.alt }));
+ if(addon.abbr === "ltrosx" || addon.abbr === "ltrosxjp" || addon.abbr === "ltr5x32" || addon.abbr === "ltr5x64"){
+ image = image.css({"padding-top":"20px"});
+ }
+ if(addon.abbr === "dual"){
+ var learnMoreChr = $("
").append(" "+ addon.text.learnmore +" ");
+ var learnMoreGtb = $("
").append(""+ addon.text.learnmore +" ");
+ }else if(addon.abbr === "mdual"){
+ var learnMoreMss = $("
").append(""+ addon.text.learnmore +" ");
+ var learnMoreMsc = $("
").append(""+ addon.text.learnmore +" ");
+ }else if(addon.abbr === "chr"){
+ var learnMore = $("
").append(""+ addon.text.learnmore +" ");
+ }else if(addon.abbr === "gtb"){
+ var learnMore = $("
").append(""+ addon.text.learnmore + " ");
+ }else if(addon.abbr === "msc"){
+ var learnMore = $("
").append(""+ addon.text.learnmore + " ");
+ }else {
+ var learnMore = $("
").append(""+ addon.text.learnmore + " ");
+ }
+ if(addon.text.marketing !== ""){
+ var marketing = $("
").append($(" ")).append($("
").append(addon.text.marketing));
+ if(addon.abbr === "dual") {
+ var marketingGTB = $("
").append($(" ")).append($("
").append(addon.text.marketingGTB));
+ var marketingChrome = $("
").append($(" ")).append($("
").append(addon.text.marketingChrome));
+ var container = $("
").append(checkbox).append(checkbox2).append(learnMoreChr).append(checkbox1).append(learnMoreGtb).append(image).append(marketingGTB).append(marketingChrome);
+ }
+ else if(addon.abbr === "mdual") {
+ var marketingMss = $("
").append($(" ")).append($("
").append(addon.text.marketingMss));
+ var marketingMsc = $("
").append($(" ")).append($("
").append(addon.text.marketingMsc));
+ var container = $("
").append(checkbox).append(learnMoreMss).append(checkbox1).append(learnMoreMsc).append(image).append(marketingMss).append(marketingMsc);
+ }
+ else if (addon.abbr === "gtb" || addon.abbr === "chr"){
+ var container = $("
").append(checkbox).append(checkbox2).append(checkbox1).append(learnMore).append(image).append(marketing);
+ }
+ else if(addon.abbr === "msc") {
+ var container = $("
").append(checkbox).append(learnMore).append(image).append(marketing);
+ }
+ else {
+ var container = $("
").append(checkbox).append(image).append(learnMore).append(marketing);
+ }
+ } else{
+ var container = offer.append(image).append(learnMore).append(marketing);
+ }
+
+ settings.downloadButton.click(function() {
+ obj.setOfferCookie(addon.abbr, $("#offerCheckbox").attr("checked") ? true : false);
+ });
+
+ elem.append(container);
+ state.optional = addon;
+ if (addon.abbr === "dual" || addon.abbr === "chr"){
+ $("#AUTO_ID_js_div_chrdef_checkbox").css({"margin-left": "20px"});
+ }
+ else if (addon.abbr === "mdual"){
+ $("#AUTO_ID_js_p_offer_image").css({"margin-top": "-13px"});
+ $("#learnMorePanelMss").css({"margin-top": "-17px"});
+ $("#learnMorePanelMsc").css({"margin-top": "-17px"});
+ }
+ var testdiv,colorvalue;
+ testdiv=document.createElement("div");
+ testdiv.style.color="rgb(31,41,59)";
+ document.body.appendChild(testdiv);
+ colorvalue=document.defaultView?document.defaultView.getComputedStyle(testdiv,null).color:testdiv.currentStyle.color;
+ document.body.removeChild(testdiv);
+ colorvalue=colorvalue.replace(/ /g,"");
+ if (colorvalue!="rgb(31,41,59)"){
+ $("#offerCheckbox").css({opacity: 1});
+ $("#CheckboxImage").removeClass("CheckboxImage");
+ $("#CheckboxImage").addClass("HCMcheckboxAlign");
+ $("#offerCheckbox1").css({opacity: 1});
+ $("#CheckboxImage1").removeClass("CheckboxImage");
+ $("#CheckboxImage1").addClass("HCMcheckboxAlign");
+ $("#chrdefcheckbox").css({opacity: 1});
+ $("#CheckboxImageChrDef").removeClass("CheckboxImage");
+ $("#CheckboxImageChrDef").addClass("HCMcheckboxAlign");
+ }
+
+ // Build the omniture value
+ var omniture = [];
+ var omniture_tag = [];
+
+ if (addon.abbr === "ltrosx" || addon.abbr === "ltrosxjp" || addon.abbr === "chrosx" || addon.abbr === "ltr5x32" || addon.abbr === "ltr5x64") {
+ omniture.push([ settings.omniturePrefix + addon.siteCatalystAbbr.toUpperCase(), "offer-eligible" ].join("="));
+ omniture_tag.push([ settings.omniturePrefix + addon.siteCatalystAbbr.toUpperCase(), "offer-eligible" ].join("="));
+ }else {
+ omniture.push([ settings.omniturePrefix + addon.abbr.toUpperCase(), "offer-eligible" ].join("="));
+ omniture_tag.push([ settings.omniturePrefix + addon.abbr.toUpperCase(), "offer-eligible" ].join("="));
+ }
+
+ // Add preinstalled addon
+ if (state.preinstalled) {
+ omniture.push([ state.preinstalled.abbr.toUpperCase(), "offer-preinstalled" ].join("="));
+ omniture_tag.push([ state.preinstalled.abbr.toUpperCase(), "offer-preinstalled" ].join("="));
+ }
+
+ // Set the omniture tag as a global js var
+ s_prop34 = omniture.join("&");
+ try{
+ s.prop34 = omniture_tag.join("&");
+ }catch (e) {};
+ return this;
+ }
+
+ }
+
+ this.offerBundledAddon = function(id, marketingText) {
+ var addon = obj.getAddonById(id);
+ if (settings.bundledAddon && addon) {
+ // Show the marketing text
+ settings.bundledAddon.html(marketingText);
+
+ // Update the file size
+ settings.fileSize.text(Math.round((parseFloat(settings.fileSize.text()) + parseFloat(addon.size))*100)/100);
+ settings.fileSizeLabel.text(settings.megabyteAbbr);
+
+ // Add the bundled addon
+ settings.downloadButton.data("downloadbutton").setBundledInstaller(addon.queryName).updateDownloadButton();
+ }
+ };
+
+ this.preinstalled = function(id) {
+ // Set the preinstalled addon
+ /*
+ var addon = obj.getAddonById(id);
+ state.preinstalled = addon;
+
+ if (addon !== undefined && addon.abbr !== "dual") {
+ settings.downloadButton.data("downloadbutton").setPreinstalledInstaller(addon.queryName);
+ }
+ */
+
+
+ if(id !== undefined){
+ settings.downloadButton.data("downloadbutton").setPreinstalledInstaller(id);
+ }
+
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ return this;
+ };
+
+ this.displayFileSizeAccept = function(secondaddon, firstaddon, optionaladdon){
+ //var localeTotalFileSize = 0;
+ var dualAcceptStruct = {
+ filesize : undefined,
+ addon : undefined
+ };
+
+ if (optionaladdon === "dual") {
+ if($("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = secondaddon + firstaddon;
+ dualAcceptStruct.addon = "dual";
+ }else if(!$("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = firstaddon;
+ dualAcceptStruct.addon = "chr";
+ }else if($("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = secondaddon;
+ dualAcceptStruct.addon = "gtb";
+ }
+ }
+ else {
+ if($("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = secondaddon + firstaddon;
+ dualAcceptStruct.addon = "mdual";
+ }else if(!$("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = firstaddon;
+ dualAcceptStruct.addon = "mss";
+ }else if($("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualAcceptStruct.filesize = secondaddon;
+ dualAcceptStruct.addon = "msc";
+ }
+ }
+ return dualAcceptStruct;
+ };
+
+ this.displayFileSizeDecline = function(secondaddon, firstaddon, optionaladdon){
+ var dualDeclineStruct = {
+ filesize : undefined,
+ addon : undefined
+ };
+ //var localeTotalFileSize = 0;
+ if (optionaladdon === "dual") {
+ if(!$("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = 0;
+ dualDeclineStruct.addon = "none";
+ }else if(!$("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = secondaddon;
+ dualDeclineStruct.addon = "gtb";
+ }else if($("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = firstaddon;
+ dualDeclineStruct.addon = "chr";
+ }
+ }
+ else {
+ if(!$("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = 0;
+ dualDeclineStruct.addon = "none";
+ }else if(!$("#offerCheckbox1").attr('checked') && $("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = secondaddon;
+ dualDeclineStruct.addon = "msc";
+ }else if($("#offerCheckbox1").attr('checked') && !$("#offerCheckbox").attr('checked')) {
+ dualDeclineStruct.filesize = firstaddon;
+ dualDeclineStruct.addon = "mss";
+ }
+ }
+ return dualDeclineStruct;
+ };
+
+ this.accept = function(event) {
+ if ($("#chrchk").length) {
+ if($("#chrExtCheckbox").attr('checked')) {
+ settings.downloadButton.data("downloadbutton").setcr(true);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ else {
+ settings.downloadButton.data("downloadbutton").setcr(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ }
+ if (state.optional) {
+ // Update the download button
+ $.log("offer accepted: " + state.optional.queryName);
+ if (state.optional.abbr !== "dual" && state.optional.abbr !== "mdual") {
+ $("#offerCheckbox").attr({ checked: true });
+ }
+ if(state.optional.abbr !== undefined && (state.optional.abbr === "ltrosx" || state.optional.abbr === "ltrosxjp" || state.optional.abbr === "ltr5x32" || state.optional.abbr === "ltr5x64")){
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) + parseFloat(state.optional.size))*100)/100;
+ $("#totalsize").text($.localizeNumber(fullsize,settings.locale));
+ settings.downloadButton.data("downloadbutton").setSamcap(true);
+ }
+ else if (state.optional.abbr !== undefined && state.optional.abbr === "dual") {
+ var addonstruct = obj.displayFileSizeAccept(state.optional.size.GTB, state.optional.size.Chrome, state.optional.abbr);
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) + parseFloat(addonstruct.filesize))*100)/100;
+ $("#totalsize").text(fullsize);
+ }
+ else if (state.optional.abbr !== undefined && state.optional.abbr === "mdual") {
+ var addonstruct = obj.displayFileSizeAccept(state.optional.size.msc, state.optional.size.mss, state.optional.abbr);
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) + parseFloat(addonstruct.filesize))*100)/100;
+ $("#totalsize").text(fullsize);
+ }
+ else
+ {
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) + parseFloat(state.optional.size))*100)/100;
+ $("#totalsize").text(fullsize);
+ }
+ if(state.optional.abbr !== undefined && state.optional.abbr === "dual"){
+ settings.downloadButton.data("downloadbutton").setDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setMDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+ settings.dualOfferInstallOptions.data("dualoffer").selectAll(event,state.optional.abbr);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ } else if(state.optional.abbr !== undefined && state.optional.abbr === "mdual"){
+ settings.downloadButton.data("downloadbutton").setMDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+ settings.dualOfferInstallOptions.data("mdualoffer").selectAll(event,state.optional.abbr);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ } else if(state.optional.abbr !== undefined && state.optional.abbr === "chrosx"){
+ $(".addonResourcesCHR").remove();
+ $.each(state.optional.text.additionalResourcesCHR, function(k, resource) {
+ settings.resources.append($(" ").html(resource));
+ });
+ settings.downloadButton.data("downloadbutton").setDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.dualOfferInstallOptions.data("chrsosxOffer").selectAll();
+
+ }else{
+
+ $.each(state.optional.text.additionalResources, function(k, resource) {
+ settings.resources.append($(" ").html(resource));
+
+ });
+ settings.downloadButton.data("downloadbutton").setDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setMDualOffer(false);
+ if(state.optional.abbr !== undefined && state.optional.abbr === "chr") {
+ settings.dualOfferInstallOptions.data("dualoffer").selectAll(event,state.optional.abbr);
+ }
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(state.optional.queryName);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+ // Replace the eula
+ settings.eula.html(state.optional.text.eula);
+ }
+ return this;
+ };
+
+ this.decline = function(event) {
+ if (state.optional) {
+ // Update the download button
+ $.log("offer declined: " + state.optional.queryName);
+ if (state.optional.abbr !== "dual" && state.optional.abbr !== "mdual") {
+ $("#offerCheckbox").attr({ checked: false });
+ }
+ var fullsize;
+ if(state.optional.abbr !== undefined && (state.optional.abbr === "ltrosx" || state.optional.abbr === "ltrosxjp" || state.optional.abbr === "ltr5x32" || state.optional.abbr === "ltr5x64")){
+ if (parseFloat($("#clientfilesize").text()) < parseFloat(state.optional.size))
+ {
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else
+ {
+ fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)) - parseFloat(state.optional.size))*100)/100;
+ if(fullsize>0) {
+ $("#totalsize").text($.localizeNumber(fullsize,settings.locale));
+ }
+ }
+ settings.downloadButton.data("downloadbutton").setSamcap(false);
+ }
+ else if (state.optional.abbr !== undefined && state.optional.abbr === "dual") {
+ var addonstruct = obj.displayFileSizeDecline(state.optional.size.GTB, state.optional.size.Chrome, state.optional.abbr);
+ if (addonstruct.filesize===0) {
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else {
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#totalsize").text(),settings.locale)) - parseFloat(addonstruct.filesize))*100)/100;
+ $("#totalsize").text(fullsize);
+ }
+ }
+ else if (state.optional.abbr !== undefined && state.optional.abbr === "mdual") {
+ var addonstruct = obj.displayFileSizeDecline(state.optional.size.msc, state.optional.size.mss, state.optional.abbr);
+ if (addonstruct.filesize===0) {
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else {
+ var fullsize = Math.round((parseFloat($.deLocalizeNumber($("#totalsize").text(),settings.locale)) - parseFloat(addonstruct.filesize))*100)/100;
+ $("#totalsize").text(fullsize);
+ }
+ }
+ else
+ {
+ if (parseFloat($("#clientfilesize").text()) < parseFloat(state.optional.size))
+ {
+ $("#totalsize").text($("#clientfilesize").text());
+ }
+ else
+ {
+ fullsize = Math.round((parseFloat($.deLocalizeNumber($("#clientfilesize").text(),settings.locale)))*100)/100;
+ if(fullsize>0) {
+ $("#totalsize").text(fullsize);
+ }
+ }
+ }
+ if(state.optional.abbr !== undefined && state.optional.abbr === "dual"){
+ settings.downloadButton.data("downloadbutton").setDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setMDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.gtb);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.chrome);
+ settings.dualOfferInstallOptions.data("dualoffer").reset(event);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ if(addonstruct.addon==="gtb"){
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(state.optional.chrome);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.gtb);
+ }
+ else if(addonstruct.addon==="chr"){
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(state.optional.gtb);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.chrome);
+ }
+ else if(addonstruct.addon==="none") {
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.gtb);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.chrome);
+ }
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }else if(state.optional.abbr !== undefined && state.optional.abbr === "mdual"){
+ settings.downloadButton.data("downloadbutton").setMDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.mss);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.msc);
+ settings.dualOfferInstallOptions.data("mdualoffer").reset(event);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ if(addonstruct.addon==="mss"){
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(state.optional.msc);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.mss);
+ }
+ else if(addonstruct.addon==="msc"){
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(state.optional.mss);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.msc);
+ }
+ else if(addonstruct.addon==="none") {
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.mss);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(state.optional.msc);
+ }
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }else if(state.optional.abbr !== undefined && state.optional.abbr === "chrosx"){
+ $(".addonResourcesCHR").remove();
+ $.each(state.optional.text.additionalResourcesCHR, function(k, resource) {
+ settings.resources.append($(" ").html(resource));
+ });
+ settings.dualOfferInstallOptions.data("chrsosxOffer").reset();
+ $("#CheckboxImage").fadeTo(1,1.0);
+ $(".addonResourcesCHR").hide();
+ }else{
+ settings.downloadButton.data("downloadbutton").setDualOffer(false);
+ settings.downloadButton.data("downloadbutton").setMDualOffer(false);
+ if(state.optional.abbr !== undefined && state.optional.abbr === "chr") {
+ settings.dualOfferInstallOptions.data("dualoffer").reset(event);
+ }
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(state.optional.queryName);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ $(".addonResources").remove();
+ }
+ if(state.optional.abbr !== undefined && (state.optional.abbr === "dual" || state.optional.abbr === "mdual") && addonstruct.addon==="none") {
+ settings.eula.html(settings.adobeEula);
+ }else if(state.optional.abbr !== undefined && state.optional.abbr !== "dual" && state.optional.abbr !== "mdual"){
+ settings.eula.html(settings.adobeEula);
+ }
+ }
+ return this;
+ };
+
+ this.getOfferCookie = function() {
+ var name = settings.downloadcenter + "offerchoice";
+ var rexp = new RegExp(name + "=(.*)");
+ var result = false;
+ $.each(String(window.document.cookie).split(";"), function(k, cookie) {
+ if ((test = cookie.match(rexp))) {
+ result = unescape(decodeURI(test[1]));
+ return false;
+ }
+ });
+
+ return result;
+ };
+
+ this.setOfferCookie = function(addon, choice) {
+ if(addon === "dual")
+ {
+ settings.dualOfferInstallOptions.data("dualoffer").setCookie();
+
+ }
+ else if(addon === "mdual")
+ {
+ settings.dualOfferInstallOptions.data("mdualoffer").setCookie();
+
+ }
+ else if(addon === "chrosx")
+ {
+ settings.dualOfferInstallOptions.data("chrsosxOffer").setCookie();
+
+ }
+ else
+ {
+ window.document.cookie = settings.downloadcenter + "offerchoice" + "=" + escape(addon + "=" + choice) + ";path=/";
+ }
+ };
+
+ this.reset = function() {
+ // Reset the addon element and download button
+ elem.text("");
+ settings.downloadButton.data("downloadbutton").setPreinstalledInstaller();
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller();
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller();
+ settings.downloadButton.data("downloadbutton").setBundledInstaller();
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ if (settings.bundledAddon) {
+ settings.bundledAddon.html("");
+ }
+
+ // Replace the eula
+ settings.eula.html(settings.adobeEula);
+
+ return this;
+ }
+
+
+ this.getAddonById = function(id) {
+ return addons.byId[id];
+ };
+
+ this.getAddonByAbbr = function(abbr, offers) {
+ addonFound = addons.byAbbr[abbr];
+ $.each(String(offers).split(/,/), function(k, id) {
+ if(addons.byId[id] && addons.byId[id].abbr === abbr){
+ addonFound = addons.byId[id];
+ }
+ })
+ return addonFound;
+ };
+
+ this.isObjInList = function(aList, obj){
+ var arr = aList.split(",");
+ return (arr.indexOf(obj) !== -1);
+ };
+
+ this.getListAbbrFromAddonList = function(addonList){
+ var retArr = [];
+ $.each(addonList, function(i, addon){
+ retArr.push(addon.abbr);
+ });
+ return retArr.join(",");
+ };
+
+ this.setPalList = function(aList){
+ if(aList !== undefined && aList.length > 0){
+ settings.polarbearpal.inPal(aList);
+ }
+ }
+
+ this.isPal = function(abbr){
+ try{
+ if(abbr === 'dual'){
+ return settings.polarbearpal.isPal('dual');
+ }else if(abbr === 'mdual'){
+ return settings.polarbearpal.isPal('mdual');
+ }else if(abbr === 'ltr5x32' || abbr === 'ltr5x64'){
+ return settings.polarbearpal.isPal('ltr5');
+ }else{
+ return settings.polarbearpal.isPal(abbr);
+ }
+ }catch(e){
+ return false;
+ }
+ }
+ init();
+ };
+
+ $.fn.addons = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('addons')) return;
+ element.data('addons', new Addons(this, options));
+ });
+ };
+})(jQuery);
+
+(function($){
+
+ var DualOffer = function(element, options){
+ var elem = $(element);
+ var obj = this;
+ var settings = $.extend({}, options ||{});
+ var dualStruct = {
+ chrcheckbox : undefined,
+ chrdefcheckbox : undefined
+ };
+
+ var init = function() {
+ dualStruct.chrcheckbox = settings.chr;
+ dualStruct.chrdefcheckbox = settings.chromedefault;
+ obj.getContainer();
+ };
+
+ this.getContainer = function(){
+ elem.append(obj.getChrCheckbox()).append(obj.getChrDefaultCheckbox());
+ }
+
+ this.getChrCheckbox = function(){
+ var addon = dualStruct.chrcheckbox;
+ var localeFileSize = addon.SIZE;
+ if(settings.locale !== undefined){
+ localeFileSize = $.localizeNumber(localeFileSize,settings.locale);
+ }
+ var filesize = $(" ").text(" (" + localeFileSize + " " + settings.megabyteAbbr + ")");
+ var checkbox = $("
").append($(" ").attr({ id: "chrcheckbox", type: "checkbox" }).change(obj.checkboxEventHandler));
+ var details = $("
").append($(" ").attr({ "for": "chrcheckbox" }).append(addon.TEXT).append(filesize));
+ var offer = $("
").append(checkbox).append(details);
+ return offer;
+ }
+
+ this.getChrDefaultCheckbox = function(){
+ var addon = dualStruct.chrdefcheckbox;
+ var checkbox = $("
").append($(" ").attr({ id: "chrdefcheckbox", type: "checkbox" }).change(obj.checkboxEventHandler));
+ var details = $("
").append($(" ").attr({ "for": "chrdefcheckbox" }).append(addon.TEXT));
+ var offer = $("
").append(checkbox).append(details);
+ return offer;
+ }
+
+ this.checkboxEventHandler = function(event) {
+ var selectedOption = dualStruct[this.id];
+ if (this.id === "chrdefcheckbox") {
+ if ($(event.currentTarget).attr('checked') && !$("#chrcheckbox").attr('checked')) {
+ $("#chrdefcheckbox").attr({checked: false});
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }
+ else {
+ $(event.currentTarget).attr('checked') ? settings.downloadButton.data("downloadbutton").setChromeDefault(true) : settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }
+ }
+ else {
+ if(this.id === "chrcheckbox" && !$(event.currentTarget).attr('checked')){
+ $("#chrdefcheckbox").attr({ checked: false });
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ }else if(this.id === "chrcheckbox" && $(event.currentTarget).attr('checked')){
+ $("#chrdefcheckbox").attr({ checked: true });
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ }
+ $(event.currentTarget).attr('checked') ? settings.downloadButton.data("downloadbutton").addAcceptInstallerList(selectedOption.QNAME) : settings.downloadButton.data("downloadbutton").addDeclineInstallerList(selectedOption.QNAME);
+ }
+
+ obj.displayFileSizeAndLink();
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ }
+
+
+ this.reset = function(){
+ $("#chrcheckbox").attr('checked', false);
+ $("#chrdefcheckbox").attr('checked', false);
+ obj.clearDualOfferCookies();
+ var localeTotalFileSize = dualStruct.chrcheckbox.SIZE;
+ obj.setTotalFileSize(localeTotalFileSize);
+ settings.downloadButton.data("downloadbutton").setDualOffer(true);
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.chrcheckbox.QNAME);
+ settings.downloadButton.data("downloadbutton").setChromeDefault(false);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ }
+
+ this.selectAll = function(){
+ $("#chrcheckbox").attr('checked', true);
+ $("#chrdefcheckbox").attr('checked', true);
+
+ settings.downloadButton.data("downloadbutton").setAcceptedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setDeclinedInstaller(null);
+ settings.downloadButton.data("downloadbutton").setAcceptInstallerList([]);
+ settings.downloadButton.data("downloadbutton").setDeclineInstallerList([]);
+
+ settings.downloadButton.data("downloadbutton").setDualOffer(true);
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.chrcheckbox.QNAME);
+ settings.downloadButton.data("downloadbutton").setChromeDefault(true);
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+ obj.setCheckboxFromCookie();
+ obj.clearDualOfferCookies();
+ obj.displayFileSizeAndLink();
+ settings.downloadButton.data("downloadbutton").updateDownloadButton();
+
+ }
+
+ this.getOfferCookieCHR = function() {
+ var chrname = settings.downloadcenter + "chrchoice";
+ var rexpChr = new RegExp(chrname + "=(.*)");
+ var resultCHR = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testChr = cookie.match(rexpChr))) {
+ resultCHR = unescape(decodeURI(testChr[1]));
+ return false;
+ }
+
+ });
+
+ return resultCHR;
+ };
+
+ this.getOfferCookiedefCHR = function() {
+ var chrdefname = settings.downloadcenter + "defchrchoice";
+ var rexpdefChr = new RegExp(chrdefname + "=(.*)");
+ var resultdefCHR = false;
+ $.each(window.document.cookie.split(";"), function(k, cookie) {
+ if ((testdefChr = cookie.match(rexpdefChr))) {
+ resultdefCHR = unescape(decodeURI(testdefChr[1]));
+ return false;
+ }
+
+ });
+
+ return resultdefCHR;
+ };
+
+
+
+ this.setCookie = function() {
+
+ var addon= "dual";
+ var chrchoice=$("#chrcheckbox").attr("checked") ? true : false;
+ var defchrchoice=$("#chrdefcheckbox").attr("checked") ? true : false;
+ var choice=$("#offerCheckbox").attr("checked") ? true : false;
+ window.document.cookie = settings.downloadcenter + "offerchoice" + "=" + escape(addon + "=" + choice) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "chrchoice" + "=" + escape("CHR=" + chrchoice) + ";path=/";
+ window.document.cookie = settings.downloadcenter + "defchrchoice" + "=" + escape("defChr=" + defchrchoice) + ";path=/";
+ }
+
+ this.clearDualOfferCookies = function(){
+ jaaulde.utils.cookies.set(settings.downloadcenter + "offerchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "chrchoice","",-1,"/");
+ jaaulde.utils.cookies.set(settings.downloadcenter + "defchrchoice","",-1,"/");
+ }
+
+ this.displayFileSizeAndLink = function(){
+ var localeTotalFileSize = 0;
+ if(!$("#chrcheckbox").attr('checked'))
+ {
+ $('#adobeEULA').html(settings.adobeEula);
+ $("#offerCheckbox").attr({ checked: false });
+ $("#offerCheckbox").fadeTo(1,1.0);
+ $(".addonResourcesCHR").hide();
+ $('#dualEulaLink').attr('href',settings.eulaLink);
+ localeTotalFileSize = dualStruct.chrcheckbox.SIZE;
+ }else if($("#chrcheckbox").attr('checked')){
+ $('#adobeEULA').html(settings.adobeDualEula);
+ $("#offerCheckbox").attr({ checked: true });
+ $("#offerCheckbox").fadeTo(1,1.0);
+ $(".addonResourcesCHR").show();
+ $('#dualEulaLink').attr('href',settings.eulaLink + settings.eulaLinkCHR);
+ localeTotalFileSize = dualStruct.chrcheckbox.SIZE;
+
+ }
+ if($("#chrcheckbox").attr('checked') && !$("#chrdefcheckbox").attr('checked')){
+ $("#offerCheckbox").fadeTo(1,0.5);
+ }
+ obj.setTotalFileSize(localeTotalFileSize);
+ }
+
+ this.setTotalFileSize = function(totalSize){
+ var localeTotalFileSize = totalSize;
+ if(settings.locale !== undefined){
+ localeTotalFileSize = $.localizeNumber(localeTotalFileSize,settings.locale);
+ }
+ $("#addonFileSize").text(" (" + localeTotalFileSize + " " + settings.megabyteAbbr + ")");
+ }
+
+ this.setCheckboxFromCookie = function(){
+ if((cookieCHR = obj.getOfferCookieCHR())){
+ var chrcheck = cookieCHR.split("=")[1] == "true" ? true : false;
+ $("#chrcheckbox").attr({ checked: chrcheck });
+ if(!chrcheck){
+ settings.downloadButton.data("downloadbutton").addDeclineInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ else{
+ settings.downloadButton.data("downloadbutton").addAcceptInstallerList(dualStruct.chrcheckbox.QNAME);
+ }
+ }
+
+ if((cookiedefCHR = obj.getOfferCookiedefCHR())){
+ var defchrcheck = cookiedefCHR.split("=")[1] == "true" ? true : false;
+ $("#chrdefcheckbox").attr({ checked: defchrcheck });
+ if(!defchrcheck){
+ settings.downloadButton.data("downloadbutton").setChromeDefault(defchrcheck);
+ }
+ }
+ }
+
+ init();
+ }
+
+ $.fn.chrsosxOffer = function(options) {
+ return this.each(function() {
+ var element = $(this);
+ if (element.data('chrsosxOffer')) return;
+ element.data('chrsosxOffer', new DualOffer(this, options));
+ });
+ }
+
+})(jQuery);
+
+/* $Header: /source/docroot/downloadcenter/js/live/polarbear.store.js */
+/* Copyright (c) 2010-2012 Marcus Westin */
+(function(){function g(){try{return d in b&&b[d]}catch(a){return!1}}var a={},b=window,c=b.document,d="localStorage",e="__storejs__",f;a.disabled=!1,a.set=function(a,b){},a.get=function(a){},a.remove=function(a){},a.clear=function(){},a.transact=function(b,c,d){var e=a.get(b);d==null&&(d=c,c=null),typeof e=="undefined"&&(e=c||{}),d(e),a.set(b,e)},a.getAll=function(){},a.serialize=function(a){return JSON.stringify(a)},a.deserialize=function(a){if(typeof a!="string")return undefined;try{return JSON.parse(a)}catch(b){return a||undefined}};if(g())f=b[d],a.set=function(b,c){return c===undefined?a.remove(b):(f.setItem(b,a.serialize(c)),c)},a.get=function(b){return a.deserialize(f.getItem(b))},a.remove=function(a){f.removeItem(a)},a.clear=function(){f.clear()},a.getAll=function(){var b={};for(var c=0;cdocument.w=window