PHP Class Horde_ActiveSync_Device, horde

Author: Michael J Rubinsky ([email protected])
显示文件 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_clientType string Local override/cache of detected clientType.
$_dirty array Dirty flag
$_iOSVersion string Cache of OS version.
$_multiplexSet boolean Flag to indicate self::multiplex was set externally.
$_properties array Device properties.
$_state Horde_ActiveSync_State_Base State handler

Public Methods

Method Description
__construct ( Horde_ActiveSync_State_Base $state, array $data = [] ) Const'r
__get ( $property ) Getter
__isset ( $property ) Magic isset
__set ( $property, $value ) Setter
enforceProvisioning ( ) : boolean Check if we should enforce provisioning on this device.
getFormattedDeviceProperties ( ) : array Return an array of DEVICEINFO data, with keys suitable for displaying.
getLastSyncTimestamp ( ) : integer Return the last time the device issued a SYNC request.
getMajorVersion ( ) : integer Return the major version number of the OS (or client app) as reported by the client.
getMinorVersion ( ) : integer Return the minor version number of the OS (or client app) as reported by the client.
hasQuirk ( integer $quirk ) : boolean Return if this client has the described quirk.
isNonProvisionable ( ) : boolean Returns if the current device is an expected non-provisionable device.
needsVersionUpdate ( string $supported ) : boolean Indicates if we need to announce new EAS version string to the client.
normalizePoomContactsDates ( Horde_Date $date, boolean $toEas = false ) : Horde_Date Return the number of hours to offset a POOMCONTACTS:BIRTHDAY or ANNIVERSARY field in an attempt to work around a bug in the protocol - which doesn't define a standard time for birthdays to occur.
save ( boolean $all = true ) Save the dirty device info data.
setDeviceProperties ( array $data ) Set the device's DEVICEINFO data.

Protected Methods

Method Description
_getClientType ( ) : string Attempt to determine the *client* application as opposed to the device, which may or may not be the client.
_getIosVersion ( ) Detects the iOS version in M.m format and caches locally.
_isIos ( ) : boolean Return if this client is an iOS device. Different versions require different checks.
_isNine ( ) : boolean Helper method to sniff out the 9Folders client, "Nine".
_sniffMultiplex ( ) Basic sniffing for determining if devices can support non-multiplexed collections.

Method Details

__construct() public method

Const'r
public __construct ( Horde_ActiveSync_State_Base $state, array $data = [] )
$state Horde_ActiveSync_State_Base The state driver.
$data array The current device data.

__get() public method

Getter
public __get ( $property )

__isset() public method

Magic isset
public __isset ( $property )

__set() public method

Setter
public __set ( $property, $value )

_getClientType() protected method

Attempt to determine the *client* application as opposed to the device, which may or may not be the client.
protected _getClientType ( ) : string
return string The client name.

_getIosVersion() protected method

Detects the iOS version in M.m format and caches locally.
protected _getIosVersion ( )

_isIos() protected method

Return if this client is an iOS device. Different versions require different checks.
protected _isIos ( ) : boolean
return boolean [description]

_isNine() protected method

Helper method to sniff out the 9Folders client, "Nine".
See also: https://ninefolders.plan.io/track/7048/46b213 for the discussion on how to sniff out the Nine client. Not the best solution, but it's the one they decided to use.
protected _isNine ( ) : boolean
return boolean True if client is thought to be "Nine".

_sniffMultiplex() protected method

Basic sniffing for determining if devices can support non-multiplexed collections.
protected _sniffMultiplex ( )

enforceProvisioning() public method

Check if we should enforce provisioning on this device.
public enforceProvisioning ( ) : boolean
return boolean

getFormattedDeviceProperties() public method

Return an array of DEVICEINFO data, with keys suitable for displaying.

getLastSyncTimestamp() public method

Return the last time the device issued a SYNC request.
public getLastSyncTimestamp ( ) : integer
return integer The timestamp.

getMajorVersion() public method

Return the major version number of the OS (or client app) as reported by the client.
public getMajorVersion ( ) : integer
return integer The version number.

getMinorVersion() public method

Return the minor version number of the OS (or client app) as reported by the client.
public getMinorVersion ( ) : integer
return integer The version number.

hasQuirk() public method

Return if this client has the described quirk.
public hasQuirk ( integer $quirk ) : boolean
$quirk integer The specified quirk to check for.
return boolean True if quirk is present.

isNonProvisionable() public method

I.e., the client does not support provisioning at all, but should still be allowed to connect to a server that has provisioning set to Force. Currently, this only applies to Windows Communication Apps (Outlook 2013).
public isNonProvisionable ( ) : boolean
return boolean True if the device should be allowed to connect to a Forced provision server. False if not.

needsVersionUpdate() public method

If the property is empty, we don't send it since we are sending the EAS-Version header anyway and this is a new device.
public needsVersionUpdate ( string $supported ) : boolean
$supported string The current EAS-Version header.
return boolean True if we need to send the MS-RP header, otherwise false.

normalizePoomContactsDates() public method

WP: Devices seem to send the birthdays at the entered date, with a time of 00:00:00 UTC during standard time and with 01:00:00 UTC during DST if the client's configured timezone observes it. No idea what purpose this serves since no timezone data is transmitted for birthday values. iOS: Seems different based on version. iOS 5+, at least seems to send the birthday as midnight at the entered date in the device's timezone then converted to UTC. Some minor issues with offsets being off an hour or two for some timezones though. iOS < 5 sends the birthday time part as the time the birthday was entered/edited on the device, converted to UTC, so it can't be trusted at all. The best we can do here is transform the date to midnight on date_default_timezone() converted to UTC. Android: For contacts originating on the SERVER, the following is true: Stock 4.3 Takes the down-synched bday value which is assumed to be UTC, does some magic to it (converts to milliseconds, creates a gregorian calendar object, then converts to YYYY-MM-DD). When sending the bday value up, it sends it up as-is. No conversion to/from UTC or local is done. Stock 4.4.x does the above, but before sending the bday value, validates that it's in a correct format for sending to the server. This really only affects date data originally entered on the device for non-stock android clients. There is some strange bit of code in Android that adds 1 to the DAY_OF_MONTH when HOUR_OF_DAY >= 12 in an attempt to "fix" birthday handling for GMT+n users. See: https://android.googlesource.com/platform/packages/apps/Exchange/+/32daacdd71b9de8fd5e3f59c37934e3e4a9fa972%5E!/exchange2/src/com/android/exchange/adapter/ContactsSyncAdapter.java Not sure what to make of it, or why it's not just converted to local tz when displaying but this probably breaks birthday handling for people in a few timezones. For contacts originating on the CLIENT, the datetime is sent as 08:00:00 UTC, and this seems to be regardless of the timezone set in the Android system. Given all of this, it makes sense to me to ALWAYS send birthday data as occuring at 08:00:00 UTC for *native* Android clients. BB 10+ expects it at 11:00:00 UTC
public normalizePoomContactsDates ( Horde_Date $date, boolean $toEas = false ) : Horde_Date
$date Horde_Date The date. This should normally be in the local timezone if encoding the date for the client. If decoding the date from the client, it will normally be in UTC.
$toEas boolean Convert from local to device if true. DEFAULT: false
return Horde_Date The date of the birthday/anniversary, with any fixes applied for the current device. The timezone set in the object will depend on the client detected, and whether the date is being encoding or decoding.

save() public method

Save the dirty device info data.
public save ( boolean $all = true )
$all boolean If true, save all properties (deviceInfo and deviceProperties). Otherwise, just save dirty deviceProperties. @since 2.16.0

setDeviceProperties() public method

Set the device's DEVICEINFO data.
public setDeviceProperties ( array $data )
$data array The data array sent from the device.

Property Details

$_clientType protected_oe property

Local override/cache of detected clientType.
protected string $_clientType
return string

$_dirty protected_oe property

Dirty flag
protected array $_dirty
return array

$_iOSVersion protected_oe property

Cache of OS version.
protected string $_iOSVersion
return string

$_multiplexSet protected_oe property

Flag to indicate self::multiplex was set externally.
protected bool $_multiplexSet
return boolean

$_properties protected_oe property

Device properties.
protected array $_properties
return array

$_state protected_oe property

State handler
protected Horde_ActiveSync_State_Base $_state
return Horde_ActiveSync_State_Base