@@ -10,27 +10,27 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncResolveRecipientsOptions extends SyncObject { |
| 13 | - public $certificateretrieval; |
|
| 14 | - public $maxcertificates; |
|
| 15 | - public $maxambiguousrecipients; |
|
| 16 | - public $availability; |
|
| 17 | - public $picture; |
|
| 13 | + public $certificateretrieval; |
|
| 14 | + public $maxcertificates; |
|
| 15 | + public $maxambiguousrecipients; |
|
| 16 | + public $availability; |
|
| 17 | + public $picture; |
|
| 18 | 18 | |
| 19 | - public function __construct() { |
|
| 20 | - $mapping = [ |
|
| 21 | - SYNC_RESOLVERECIPIENTS_CERTIFICATERETRIEVAL => [self::STREAMER_VAR => "certificateretrieval"], |
|
| 22 | - SYNC_RESOLVERECIPIENTS_MAXCERTIFICATES => [self::STREAMER_VAR => "maxcertificates"], |
|
| 23 | - SYNC_RESOLVERECIPIENTS_MAXAMBIGUOUSRECIPIENTS => [self::STREAMER_VAR => "maxambiguousrecipients"], |
|
| 24 | - SYNC_RESOLVERECIPIENTS_AVAILABILITY => [ |
|
| 25 | - self::STREAMER_VAR => "availability", |
|
| 26 | - self::STREAMER_TYPE => "SyncResolveRecipientsAvailability", |
|
| 27 | - ], |
|
| 28 | - SYNC_RESOLVERECIPIENTS_PICTURE => [ |
|
| 29 | - self::STREAMER_VAR => "picture", |
|
| 30 | - self::STREAMER_TYPE => "SyncResolveRecipientsPicture", |
|
| 31 | - ], |
|
| 32 | - ]; |
|
| 19 | + public function __construct() { |
|
| 20 | + $mapping = [ |
|
| 21 | + SYNC_RESOLVERECIPIENTS_CERTIFICATERETRIEVAL => [self::STREAMER_VAR => "certificateretrieval"], |
|
| 22 | + SYNC_RESOLVERECIPIENTS_MAXCERTIFICATES => [self::STREAMER_VAR => "maxcertificates"], |
|
| 23 | + SYNC_RESOLVERECIPIENTS_MAXAMBIGUOUSRECIPIENTS => [self::STREAMER_VAR => "maxambiguousrecipients"], |
|
| 24 | + SYNC_RESOLVERECIPIENTS_AVAILABILITY => [ |
|
| 25 | + self::STREAMER_VAR => "availability", |
|
| 26 | + self::STREAMER_TYPE => "SyncResolveRecipientsAvailability", |
|
| 27 | + ], |
|
| 28 | + SYNC_RESOLVERECIPIENTS_PICTURE => [ |
|
| 29 | + self::STREAMER_VAR => "picture", |
|
| 30 | + self::STREAMER_TYPE => "SyncResolveRecipientsPicture", |
|
| 31 | + ], |
|
| 32 | + ]; |
|
| 33 | 33 | |
| 34 | - parent::__construct($mapping); |
|
| 35 | - } |
|
| 34 | + parent::__construct($mapping); |
|
| 35 | + } |
|
| 36 | 36 | } |
@@ -11,171 +11,171 @@ |
||
| 11 | 11 | |
| 12 | 12 | // Exactly the same as SyncRecurrence, but then with SYNC_POOMTASKS_* |
| 13 | 13 | class SyncTaskRecurrence extends SyncObject { |
| 14 | - public $start; |
|
| 15 | - public $type; |
|
| 16 | - public $until; |
|
| 17 | - public $occurrences; |
|
| 18 | - public $interval; |
|
| 19 | - public $dayofweek; |
|
| 20 | - public $dayofmonth; |
|
| 21 | - public $weekofmonth; |
|
| 22 | - public $monthofyear; |
|
| 23 | - public $regenerate; |
|
| 24 | - public $deadoccur; |
|
| 25 | - public $calendartype; |
|
| 26 | - public $firstdayofweek; |
|
| 14 | + public $start; |
|
| 15 | + public $type; |
|
| 16 | + public $until; |
|
| 17 | + public $occurrences; |
|
| 18 | + public $interval; |
|
| 19 | + public $dayofweek; |
|
| 20 | + public $dayofmonth; |
|
| 21 | + public $weekofmonth; |
|
| 22 | + public $monthofyear; |
|
| 23 | + public $regenerate; |
|
| 24 | + public $deadoccur; |
|
| 25 | + public $calendartype; |
|
| 26 | + public $firstdayofweek; |
|
| 27 | 27 | |
| 28 | - public function __construct() { |
|
| 29 | - $mapping = [ |
|
| 30 | - SYNC_POOMTASKS_START => [self::STREAMER_VAR => "start", |
|
| 31 | - self::STREAMER_TYPE => self::STREAMER_TYPE_DATE, |
|
| 32 | - self::STREAMER_RONOTIFY => true, ], |
|
| 28 | + public function __construct() { |
|
| 29 | + $mapping = [ |
|
| 30 | + SYNC_POOMTASKS_START => [self::STREAMER_VAR => "start", |
|
| 31 | + self::STREAMER_TYPE => self::STREAMER_TYPE_DATE, |
|
| 32 | + self::STREAMER_RONOTIFY => true, ], |
|
| 33 | 33 | |
| 34 | - // Recurrence type |
|
| 35 | - // 0 = Recurs daily |
|
| 36 | - // 1 = Recurs weekly |
|
| 37 | - // 2 = Recurs monthly |
|
| 38 | - // 3 = Recurs monthly on the nth day |
|
| 39 | - // 5 = Recurs yearly |
|
| 40 | - // 6 = Recurs yearly on the nth day |
|
| 41 | - SYNC_POOMTASKS_TYPE => [ |
|
| 42 | - self::STREAMER_VAR => "type", |
|
| 43 | - self::STREAMER_CHECKS => [ |
|
| 44 | - self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO, |
|
| 45 | - self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 5, 6], |
|
| 46 | - ], |
|
| 47 | - self::STREAMER_RONOTIFY => true, |
|
| 48 | - ], |
|
| 49 | - SYNC_POOMTASKS_UNTIL => [ |
|
| 50 | - self::STREAMER_VAR => "until", |
|
| 51 | - self::STREAMER_TYPE => self::STREAMER_TYPE_DATE, |
|
| 52 | - self::STREAMER_RONOTIFY => true, |
|
| 53 | - ], |
|
| 54 | - SYNC_POOMTASKS_OCCURRENCES => [ |
|
| 55 | - self::STREAMER_VAR => "occurrences", |
|
| 56 | - self::STREAMER_CHECKS => [ |
|
| 57 | - self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 58 | - self::STREAMER_CHECK_CMPLOWER => 1000, |
|
| 59 | - ], |
|
| 60 | - self::STREAMER_RONOTIFY => true, |
|
| 61 | - ], |
|
| 62 | - SYNC_POOMTASKS_INTERVAL => [ |
|
| 63 | - self::STREAMER_VAR => "interval", |
|
| 64 | - self::STREAMER_CHECKS => [ |
|
| 65 | - self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 66 | - self::STREAMER_CHECK_CMPLOWER => 1000, |
|
| 67 | - ], |
|
| 68 | - self::STREAMER_RONOTIFY => true, |
|
| 69 | - ], |
|
| 70 | - // TODO: check iOS5 sends deadoccur inside of the recurrence |
|
| 71 | - SYNC_POOMTASKS_DEADOCCUR => [ |
|
| 72 | - self::STREAMER_VAR => "deadoccur", |
|
| 73 | - self::STREAMER_RONOTIFY => true, |
|
| 74 | - ], |
|
| 75 | - SYNC_POOMTASKS_REGENERATE => [ |
|
| 76 | - self::STREAMER_VAR => "regenerate", |
|
| 77 | - self::STREAMER_RONOTIFY => true, |
|
| 78 | - ], |
|
| 79 | - // DayOfWeek values |
|
| 80 | - // 1 = Sunday |
|
| 81 | - // 2 = Monday |
|
| 82 | - // 4 = Tuesday |
|
| 83 | - // 8 = Wednesday |
|
| 84 | - // 16 = Thursday |
|
| 85 | - // 32 = Friday |
|
| 86 | - // 62 = Weekdays // TODO check: value set by WA with daily weekday recurrence |
|
| 87 | - // 64 = Saturday |
|
| 88 | - // 127 = The last day of the month. Value valid only in monthly or yearly recurrences. |
|
| 89 | - SYNC_POOMTASKS_DAYOFWEEK => [ |
|
| 90 | - self::STREAMER_VAR => "dayofweek", |
|
| 91 | - self::STREAMER_CHECKS => [ |
|
| 92 | - self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 93 | - self::STREAMER_CHECK_CMPLOWER => 128, |
|
| 94 | - ], |
|
| 95 | - self::STREAMER_RONOTIFY => true, |
|
| 96 | - ], |
|
| 97 | - // DayOfMonth values |
|
| 98 | - // 1-31 representing the day |
|
| 99 | - SYNC_POOMTASKS_DAYOFMONTH => [ |
|
| 100 | - self::STREAMER_VAR => "dayofmonth", |
|
| 101 | - self::STREAMER_CHECKS => [ |
|
| 102 | - self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 103 | - self::STREAMER_CHECK_CMPLOWER => 32, |
|
| 104 | - ], |
|
| 105 | - self::STREAMER_RONOTIFY => true, |
|
| 106 | - ], |
|
| 107 | - // WeekOfMonth |
|
| 108 | - // 1-4 = Y st/nd/rd/th week of month |
|
| 109 | - // 5 = last week of month |
|
| 110 | - SYNC_POOMTASKS_WEEKOFMONTH => [ |
|
| 111 | - self::STREAMER_VAR => "weekofmonth", |
|
| 112 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4, 5]], |
|
| 113 | - self::STREAMER_RONOTIFY => true, |
|
| 114 | - ], |
|
| 115 | - // MonthOfYear |
|
| 116 | - // 1-12 representing the month |
|
| 117 | - SYNC_POOMTASKS_MONTHOFYEAR => [ |
|
| 118 | - self::STREAMER_VAR => "monthofyear", |
|
| 119 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]], |
|
| 120 | - self::STREAMER_RONOTIFY => true, |
|
| 121 | - ], |
|
| 122 | - ]; |
|
| 34 | + // Recurrence type |
|
| 35 | + // 0 = Recurs daily |
|
| 36 | + // 1 = Recurs weekly |
|
| 37 | + // 2 = Recurs monthly |
|
| 38 | + // 3 = Recurs monthly on the nth day |
|
| 39 | + // 5 = Recurs yearly |
|
| 40 | + // 6 = Recurs yearly on the nth day |
|
| 41 | + SYNC_POOMTASKS_TYPE => [ |
|
| 42 | + self::STREAMER_VAR => "type", |
|
| 43 | + self::STREAMER_CHECKS => [ |
|
| 44 | + self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO, |
|
| 45 | + self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 5, 6], |
|
| 46 | + ], |
|
| 47 | + self::STREAMER_RONOTIFY => true, |
|
| 48 | + ], |
|
| 49 | + SYNC_POOMTASKS_UNTIL => [ |
|
| 50 | + self::STREAMER_VAR => "until", |
|
| 51 | + self::STREAMER_TYPE => self::STREAMER_TYPE_DATE, |
|
| 52 | + self::STREAMER_RONOTIFY => true, |
|
| 53 | + ], |
|
| 54 | + SYNC_POOMTASKS_OCCURRENCES => [ |
|
| 55 | + self::STREAMER_VAR => "occurrences", |
|
| 56 | + self::STREAMER_CHECKS => [ |
|
| 57 | + self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 58 | + self::STREAMER_CHECK_CMPLOWER => 1000, |
|
| 59 | + ], |
|
| 60 | + self::STREAMER_RONOTIFY => true, |
|
| 61 | + ], |
|
| 62 | + SYNC_POOMTASKS_INTERVAL => [ |
|
| 63 | + self::STREAMER_VAR => "interval", |
|
| 64 | + self::STREAMER_CHECKS => [ |
|
| 65 | + self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 66 | + self::STREAMER_CHECK_CMPLOWER => 1000, |
|
| 67 | + ], |
|
| 68 | + self::STREAMER_RONOTIFY => true, |
|
| 69 | + ], |
|
| 70 | + // TODO: check iOS5 sends deadoccur inside of the recurrence |
|
| 71 | + SYNC_POOMTASKS_DEADOCCUR => [ |
|
| 72 | + self::STREAMER_VAR => "deadoccur", |
|
| 73 | + self::STREAMER_RONOTIFY => true, |
|
| 74 | + ], |
|
| 75 | + SYNC_POOMTASKS_REGENERATE => [ |
|
| 76 | + self::STREAMER_VAR => "regenerate", |
|
| 77 | + self::STREAMER_RONOTIFY => true, |
|
| 78 | + ], |
|
| 79 | + // DayOfWeek values |
|
| 80 | + // 1 = Sunday |
|
| 81 | + // 2 = Monday |
|
| 82 | + // 4 = Tuesday |
|
| 83 | + // 8 = Wednesday |
|
| 84 | + // 16 = Thursday |
|
| 85 | + // 32 = Friday |
|
| 86 | + // 62 = Weekdays // TODO check: value set by WA with daily weekday recurrence |
|
| 87 | + // 64 = Saturday |
|
| 88 | + // 127 = The last day of the month. Value valid only in monthly or yearly recurrences. |
|
| 89 | + SYNC_POOMTASKS_DAYOFWEEK => [ |
|
| 90 | + self::STREAMER_VAR => "dayofweek", |
|
| 91 | + self::STREAMER_CHECKS => [ |
|
| 92 | + self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 93 | + self::STREAMER_CHECK_CMPLOWER => 128, |
|
| 94 | + ], |
|
| 95 | + self::STREAMER_RONOTIFY => true, |
|
| 96 | + ], |
|
| 97 | + // DayOfMonth values |
|
| 98 | + // 1-31 representing the day |
|
| 99 | + SYNC_POOMTASKS_DAYOFMONTH => [ |
|
| 100 | + self::STREAMER_VAR => "dayofmonth", |
|
| 101 | + self::STREAMER_CHECKS => [ |
|
| 102 | + self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 103 | + self::STREAMER_CHECK_CMPLOWER => 32, |
|
| 104 | + ], |
|
| 105 | + self::STREAMER_RONOTIFY => true, |
|
| 106 | + ], |
|
| 107 | + // WeekOfMonth |
|
| 108 | + // 1-4 = Y st/nd/rd/th week of month |
|
| 109 | + // 5 = last week of month |
|
| 110 | + SYNC_POOMTASKS_WEEKOFMONTH => [ |
|
| 111 | + self::STREAMER_VAR => "weekofmonth", |
|
| 112 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4, 5]], |
|
| 113 | + self::STREAMER_RONOTIFY => true, |
|
| 114 | + ], |
|
| 115 | + // MonthOfYear |
|
| 116 | + // 1-12 representing the month |
|
| 117 | + SYNC_POOMTASKS_MONTHOFYEAR => [ |
|
| 118 | + self::STREAMER_VAR => "monthofyear", |
|
| 119 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]], |
|
| 120 | + self::STREAMER_RONOTIFY => true, |
|
| 121 | + ], |
|
| 122 | + ]; |
|
| 123 | 123 | |
| 124 | - if (Request::GetProtocolVersion() >= 14.0) { |
|
| 125 | - $mapping[SYNC_POOMTASKS_CALENDARTYPE] = [ |
|
| 126 | - self::STREAMER_VAR => "calendartype", |
|
| 127 | - self::STREAMER_RONOTIFY => true, |
|
| 128 | - ]; |
|
| 129 | - } |
|
| 124 | + if (Request::GetProtocolVersion() >= 14.0) { |
|
| 125 | + $mapping[SYNC_POOMTASKS_CALENDARTYPE] = [ |
|
| 126 | + self::STREAMER_VAR => "calendartype", |
|
| 127 | + self::STREAMER_RONOTIFY => true, |
|
| 128 | + ]; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - if (Request::GetProtocolVersion() >= 14.1) { |
|
| 132 | - // First day of the calendar week for recurrence. |
|
| 133 | - // FirstDayOfWeek values: |
|
| 134 | - // 0 = Sunday |
|
| 135 | - // 1 = Monday |
|
| 136 | - // 2 = Tuesday |
|
| 137 | - // 3 = Wednesday |
|
| 138 | - // 4 = Thursday |
|
| 139 | - // 5 = Friday |
|
| 140 | - // 6 = Saturday |
|
| 141 | - $mapping[SYNC_POOMTASKS_FIRSTDAYOFWEEK] = [ |
|
| 142 | - self::STREAMER_VAR => "firstdayofweek", |
|
| 143 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 4, 5, 6]], |
|
| 144 | - self::STREAMER_RONOTIFY => true, |
|
| 145 | - ]; |
|
| 146 | - } |
|
| 131 | + if (Request::GetProtocolVersion() >= 14.1) { |
|
| 132 | + // First day of the calendar week for recurrence. |
|
| 133 | + // FirstDayOfWeek values: |
|
| 134 | + // 0 = Sunday |
|
| 135 | + // 1 = Monday |
|
| 136 | + // 2 = Tuesday |
|
| 137 | + // 3 = Wednesday |
|
| 138 | + // 4 = Thursday |
|
| 139 | + // 5 = Friday |
|
| 140 | + // 6 = Saturday |
|
| 141 | + $mapping[SYNC_POOMTASKS_FIRSTDAYOFWEEK] = [ |
|
| 142 | + self::STREAMER_VAR => "firstdayofweek", |
|
| 143 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 4, 5, 6]], |
|
| 144 | + self::STREAMER_RONOTIFY => true, |
|
| 145 | + ]; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - parent::__construct($mapping); |
|
| 149 | - } |
|
| 148 | + parent::__construct($mapping); |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - /** |
|
| 152 | - * Method checks if the object has the minimum of required parameters |
|
| 153 | - * and fulfills semantic dependencies. |
|
| 154 | - * |
|
| 155 | - * This overloads the general check() with special checks to be executed |
|
| 156 | - * |
|
| 157 | - * @param bool $logAsDebug (opt) default is false, so messages are logged in WARN log level |
|
| 158 | - * |
|
| 159 | - * @return bool |
|
| 160 | - */ |
|
| 161 | - public function Check($logAsDebug = false) { |
|
| 162 | - $ret = parent::Check($logAsDebug); |
|
| 151 | + /** |
|
| 152 | + * Method checks if the object has the minimum of required parameters |
|
| 153 | + * and fulfills semantic dependencies. |
|
| 154 | + * |
|
| 155 | + * This overloads the general check() with special checks to be executed |
|
| 156 | + * |
|
| 157 | + * @param bool $logAsDebug (opt) default is false, so messages are logged in WARN log level |
|
| 158 | + * |
|
| 159 | + * @return bool |
|
| 160 | + */ |
|
| 161 | + public function Check($logAsDebug = false) { |
|
| 162 | + $ret = parent::Check($logAsDebug); |
|
| 163 | 163 | |
| 164 | - // semantic checks general "turn off switch" |
|
| 165 | - if (defined("DO_SEMANTIC_CHECKS") && DO_SEMANTIC_CHECKS === false) { |
|
| 166 | - return $ret; |
|
| 167 | - } |
|
| 164 | + // semantic checks general "turn off switch" |
|
| 165 | + if (defined("DO_SEMANTIC_CHECKS") && DO_SEMANTIC_CHECKS === false) { |
|
| 166 | + return $ret; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - if (!$ret) { |
|
| 170 | - return false; |
|
| 171 | - } |
|
| 169 | + if (!$ret) { |
|
| 170 | + return false; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - if (isset($this->start, $this->until) && $this->until < $this->start) { |
|
| 174 | - SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter 'start' is HIGHER than 'until'. Check failed!", get_class($this))); |
|
| 173 | + if (isset($this->start, $this->until) && $this->until < $this->start) { |
|
| 174 | + SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter 'start' is HIGHER than 'until'. Check failed!", get_class($this))); |
|
| 175 | 175 | |
| 176 | - return false; |
|
| 177 | - } |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - return true; |
|
| 180 | - } |
|
| 179 | + return true; |
|
| 180 | + } |
|
| 181 | 181 | } |
@@ -10,40 +10,40 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncBaseBodyPart extends SyncObject { |
| 13 | - public $status; |
|
| 14 | - public $type; // Should be html (2) |
|
| 15 | - public $estimatedDataSize; |
|
| 16 | - public $truncated; |
|
| 17 | - public $data; |
|
| 18 | - public $preview; |
|
| 13 | + public $status; |
|
| 14 | + public $type; // Should be html (2) |
|
| 15 | + public $estimatedDataSize; |
|
| 16 | + public $truncated; |
|
| 17 | + public $data; |
|
| 18 | + public $preview; |
|
| 19 | 19 | |
| 20 | - public function __construct() { |
|
| 21 | - $mapping = [ |
|
| 22 | - SYNC_AIRSYNCBASE_STATUS => [self::STREAMER_VAR => "status"], |
|
| 23 | - SYNC_AIRSYNCBASE_TYPE => [self::STREAMER_VAR => "type"], |
|
| 24 | - SYNC_AIRSYNCBASE_ESTIMATEDDATASIZE => [ |
|
| 25 | - self::STREAMER_VAR => "estimatedDataSize", |
|
| 26 | - // when stripping private we set the body to self::STRIP_PRIVATE_SUBSTITUTE, so the size needs to be its length |
|
| 27 | - self::STREAMER_PRIVATE => strlen(self::STRIP_PRIVATE_SUBSTITUTE), |
|
| 28 | - ], |
|
| 29 | - SYNC_AIRSYNCBASE_TRUNCATED => [self::STREAMER_VAR => "truncated"], |
|
| 30 | - SYNC_AIRSYNCBASE_DATA => [ |
|
| 31 | - self::STREAMER_VAR => "data", |
|
| 32 | - self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN, |
|
| 33 | - self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART, |
|
| 34 | - self::STREAMER_RONOTIFY => true, |
|
| 35 | - // replace the body with self::STRIP_PRIVATE_SUBSTITUTE when stripping private |
|
| 36 | - self::STREAMER_PRIVATE => StringStreamWrapper::Open(self::STRIP_PRIVATE_SUBSTITUTE), |
|
| 37 | - ], |
|
| 38 | - SYNC_AIRSYNCBASE_PREVIEW => [ |
|
| 39 | - self::STREAMER_VAR => "preview", |
|
| 40 | - self::STREAMER_PRIVATE => self::STRIP_PRIVATE_SUBSTITUTE, |
|
| 41 | - ], |
|
| 42 | - ]; |
|
| 20 | + public function __construct() { |
|
| 21 | + $mapping = [ |
|
| 22 | + SYNC_AIRSYNCBASE_STATUS => [self::STREAMER_VAR => "status"], |
|
| 23 | + SYNC_AIRSYNCBASE_TYPE => [self::STREAMER_VAR => "type"], |
|
| 24 | + SYNC_AIRSYNCBASE_ESTIMATEDDATASIZE => [ |
|
| 25 | + self::STREAMER_VAR => "estimatedDataSize", |
|
| 26 | + // when stripping private we set the body to self::STRIP_PRIVATE_SUBSTITUTE, so the size needs to be its length |
|
| 27 | + self::STREAMER_PRIVATE => strlen(self::STRIP_PRIVATE_SUBSTITUTE), |
|
| 28 | + ], |
|
| 29 | + SYNC_AIRSYNCBASE_TRUNCATED => [self::STREAMER_VAR => "truncated"], |
|
| 30 | + SYNC_AIRSYNCBASE_DATA => [ |
|
| 31 | + self::STREAMER_VAR => "data", |
|
| 32 | + self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN, |
|
| 33 | + self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART, |
|
| 34 | + self::STREAMER_RONOTIFY => true, |
|
| 35 | + // replace the body with self::STRIP_PRIVATE_SUBSTITUTE when stripping private |
|
| 36 | + self::STREAMER_PRIVATE => StringStreamWrapper::Open(self::STRIP_PRIVATE_SUBSTITUTE), |
|
| 37 | + ], |
|
| 38 | + SYNC_AIRSYNCBASE_PREVIEW => [ |
|
| 39 | + self::STREAMER_VAR => "preview", |
|
| 40 | + self::STREAMER_PRIVATE => self::STRIP_PRIVATE_SUBSTITUTE, |
|
| 41 | + ], |
|
| 42 | + ]; |
|
| 43 | 43 | |
| 44 | - parent::__construct($mapping); |
|
| 44 | + parent::__construct($mapping); |
|
| 45 | 45 | |
| 46 | - // Indicates that this SyncObject supports the private flag and stripping of private data. |
|
| 47 | - $this->supportsPrivateStripping = true; |
|
| 48 | - } |
|
| 46 | + // Indicates that this SyncObject supports the private flag and stripping of private data. |
|
| 47 | + $this->supportsPrivateStripping = true; |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -10,18 +10,18 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncEmailAddresses extends SyncObject { |
| 13 | - public $smtpaddress; |
|
| 14 | - public $primarysmtpaddress; |
|
| 13 | + public $smtpaddress; |
|
| 14 | + public $primarysmtpaddress; |
|
| 15 | 15 | |
| 16 | - public function __construct() { |
|
| 17 | - $mapping = [ |
|
| 18 | - SYNC_SETTINGS_SMPTADDRESS => [ |
|
| 19 | - self::STREAMER_VAR => "smtpaddress", |
|
| 20 | - self::STREAMER_PROP => self::STREAMER_TYPE_NO_CONTAINER, |
|
| 21 | - self::STREAMER_ARRAY => SYNC_SETTINGS_SMPTADDRESS, ], |
|
| 22 | - SYNC_SETTINGS_PRIMARYSMTPADDRESS => [self::STREAMER_VAR => "primarysmtpaddress"], |
|
| 23 | - ]; |
|
| 16 | + public function __construct() { |
|
| 17 | + $mapping = [ |
|
| 18 | + SYNC_SETTINGS_SMPTADDRESS => [ |
|
| 19 | + self::STREAMER_VAR => "smtpaddress", |
|
| 20 | + self::STREAMER_PROP => self::STREAMER_TYPE_NO_CONTAINER, |
|
| 21 | + self::STREAMER_ARRAY => SYNC_SETTINGS_SMPTADDRESS, ], |
|
| 22 | + SYNC_SETTINGS_PRIMARYSMTPADDRESS => [self::STREAMER_VAR => "primarysmtpaddress"], |
|
| 23 | + ]; |
|
| 24 | 24 | |
| 25 | - parent::__construct($mapping); |
|
| 26 | - } |
|
| 25 | + parent::__construct($mapping); |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -10,339 +10,339 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncProvisioning extends SyncObject { |
| 13 | - // AS 12.0, 12.1 and 14.0 props |
|
| 14 | - public $devpwenabled; |
|
| 15 | - public $alphanumpwreq; |
|
| 16 | - public $devencenabled; |
|
| 17 | - public $pwrecoveryenabled; |
|
| 18 | - public $docbrowseenabled; |
|
| 19 | - public $attenabled; |
|
| 20 | - public $mindevpwlenngth; |
|
| 21 | - public $maxinacttimedevlock; |
|
| 22 | - public $maxdevpwfailedattempts; |
|
| 23 | - public $maxattsize; |
|
| 24 | - public $allowsimpledevpw; |
|
| 25 | - public $devpwexpiration; |
|
| 26 | - public $devpwhistory; |
|
| 13 | + // AS 12.0, 12.1 and 14.0 props |
|
| 14 | + public $devpwenabled; |
|
| 15 | + public $alphanumpwreq; |
|
| 16 | + public $devencenabled; |
|
| 17 | + public $pwrecoveryenabled; |
|
| 18 | + public $docbrowseenabled; |
|
| 19 | + public $attenabled; |
|
| 20 | + public $mindevpwlenngth; |
|
| 21 | + public $maxinacttimedevlock; |
|
| 22 | + public $maxdevpwfailedattempts; |
|
| 23 | + public $maxattsize; |
|
| 24 | + public $allowsimpledevpw; |
|
| 25 | + public $devpwexpiration; |
|
| 26 | + public $devpwhistory; |
|
| 27 | 27 | |
| 28 | - // AS 12.1 and 14.0 props |
|
| 29 | - public $allowstoragecard; |
|
| 30 | - public $allowcam; |
|
| 31 | - public $reqdevenc; |
|
| 32 | - public $allowunsignedapps; |
|
| 33 | - public $allowunsigninstallpacks; |
|
| 34 | - public $mindevcomplexchars; |
|
| 35 | - public $allowwifi; |
|
| 36 | - public $allowtextmessaging; |
|
| 37 | - public $allowpopimapemail; |
|
| 38 | - public $allowbluetooth; |
|
| 39 | - public $allowirda; |
|
| 40 | - public $reqmansyncroam; |
|
| 41 | - public $allowdesktopsync; |
|
| 42 | - public $maxcalagefilter; |
|
| 43 | - public $allowhtmlemail; |
|
| 44 | - public $maxemailagefilter; |
|
| 45 | - public $maxemailbodytruncsize; |
|
| 46 | - public $maxemailhtmlbodytruncsize; |
|
| 47 | - public $reqsignedsmimemessages; |
|
| 48 | - public $reqencsmimemessages; |
|
| 49 | - public $reqsignedsmimealgorithm; |
|
| 50 | - public $reqencsmimealgorithm; |
|
| 51 | - public $allowsmimeencalgneg; |
|
| 52 | - public $allowsmimesoftcerts; |
|
| 53 | - public $allowbrowser; |
|
| 54 | - public $allowconsumeremail; |
|
| 55 | - public $allowremotedesk; |
|
| 56 | - public $allowinternetsharing; |
|
| 57 | - public $unapprovedinromapplist; |
|
| 58 | - public $approvedapplist; |
|
| 28 | + // AS 12.1 and 14.0 props |
|
| 29 | + public $allowstoragecard; |
|
| 30 | + public $allowcam; |
|
| 31 | + public $reqdevenc; |
|
| 32 | + public $allowunsignedapps; |
|
| 33 | + public $allowunsigninstallpacks; |
|
| 34 | + public $mindevcomplexchars; |
|
| 35 | + public $allowwifi; |
|
| 36 | + public $allowtextmessaging; |
|
| 37 | + public $allowpopimapemail; |
|
| 38 | + public $allowbluetooth; |
|
| 39 | + public $allowirda; |
|
| 40 | + public $reqmansyncroam; |
|
| 41 | + public $allowdesktopsync; |
|
| 42 | + public $maxcalagefilter; |
|
| 43 | + public $allowhtmlemail; |
|
| 44 | + public $maxemailagefilter; |
|
| 45 | + public $maxemailbodytruncsize; |
|
| 46 | + public $maxemailhtmlbodytruncsize; |
|
| 47 | + public $reqsignedsmimemessages; |
|
| 48 | + public $reqencsmimemessages; |
|
| 49 | + public $reqsignedsmimealgorithm; |
|
| 50 | + public $reqencsmimealgorithm; |
|
| 51 | + public $allowsmimeencalgneg; |
|
| 52 | + public $allowsmimesoftcerts; |
|
| 53 | + public $allowbrowser; |
|
| 54 | + public $allowconsumeremail; |
|
| 55 | + public $allowremotedesk; |
|
| 56 | + public $allowinternetsharing; |
|
| 57 | + public $unapprovedinromapplist; |
|
| 58 | + public $approvedapplist; |
|
| 59 | 59 | |
| 60 | - public function __construct() { |
|
| 61 | - $mapping = [ |
|
| 62 | - SYNC_PROVISION_DEVPWENABLED => [ |
|
| 63 | - self::STREAMER_VAR => "devpwenabled", |
|
| 64 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 65 | - ], |
|
| 66 | - SYNC_PROVISION_ALPHANUMPWREQ => [ |
|
| 67 | - self::STREAMER_VAR => "alphanumpwreq", |
|
| 68 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 69 | - ], |
|
| 70 | - SYNC_PROVISION_PWRECOVERYENABLED => [ |
|
| 71 | - self::STREAMER_VAR => "pwrecoveryenabled", |
|
| 72 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 73 | - ], |
|
| 74 | - SYNC_PROVISION_DEVENCENABLED => [ |
|
| 75 | - self::STREAMER_VAR => "devencenabled", |
|
| 76 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 77 | - ], |
|
| 78 | - // deprecated |
|
| 79 | - SYNC_PROVISION_DOCBROWSEENABLED => [self::STREAMER_VAR => "docbrowseenabled"], |
|
| 80 | - SYNC_PROVISION_ATTENABLED => [ |
|
| 81 | - self::STREAMER_VAR => "attenabled", |
|
| 82 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 83 | - ], |
|
| 84 | - SYNC_PROVISION_MINDEVPWLENGTH => [ |
|
| 85 | - self::STREAMER_VAR => "mindevpwlenngth", |
|
| 86 | - self::STREAMER_CHECKS => [ |
|
| 87 | - self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 88 | - self::STREAMER_CHECK_CMPLOWER => 17, |
|
| 89 | - ], |
|
| 90 | - ], |
|
| 91 | - SYNC_PROVISION_MAXINACTTIMEDEVLOCK => [self::STREAMER_VAR => "maxinacttimedevlock"], |
|
| 92 | - SYNC_PROVISION_MAXDEVPWFAILEDATTEMPTS => [ |
|
| 93 | - self::STREAMER_VAR => "maxdevpwfailedattempts", |
|
| 94 | - self::STREAMER_CHECKS => [ |
|
| 95 | - self::STREAMER_CHECK_CMPHIGHER => 3, |
|
| 96 | - self::STREAMER_CHECK_CMPLOWER => 17, |
|
| 97 | - ], |
|
| 98 | - ], |
|
| 99 | - SYNC_PROVISION_MAXATTSIZE => [ |
|
| 100 | - self::STREAMER_VAR => "maxattsize", |
|
| 101 | - self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 102 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 103 | - ], |
|
| 104 | - SYNC_PROVISION_ALLOWSIMPLEDEVPW => [ |
|
| 105 | - self::STREAMER_VAR => "allowsimpledevpw", |
|
| 106 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 107 | - ], |
|
| 108 | - SYNC_PROVISION_DEVPWEXPIRATION => [ |
|
| 109 | - self::STREAMER_VAR => "devpwexpiration", |
|
| 110 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 111 | - ], |
|
| 112 | - SYNC_PROVISION_DEVPWHISTORY => [ |
|
| 113 | - self::STREAMER_VAR => "devpwhistory", |
|
| 114 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 115 | - ], |
|
| 116 | - ]; |
|
| 60 | + public function __construct() { |
|
| 61 | + $mapping = [ |
|
| 62 | + SYNC_PROVISION_DEVPWENABLED => [ |
|
| 63 | + self::STREAMER_VAR => "devpwenabled", |
|
| 64 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 65 | + ], |
|
| 66 | + SYNC_PROVISION_ALPHANUMPWREQ => [ |
|
| 67 | + self::STREAMER_VAR => "alphanumpwreq", |
|
| 68 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 69 | + ], |
|
| 70 | + SYNC_PROVISION_PWRECOVERYENABLED => [ |
|
| 71 | + self::STREAMER_VAR => "pwrecoveryenabled", |
|
| 72 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 73 | + ], |
|
| 74 | + SYNC_PROVISION_DEVENCENABLED => [ |
|
| 75 | + self::STREAMER_VAR => "devencenabled", |
|
| 76 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 77 | + ], |
|
| 78 | + // deprecated |
|
| 79 | + SYNC_PROVISION_DOCBROWSEENABLED => [self::STREAMER_VAR => "docbrowseenabled"], |
|
| 80 | + SYNC_PROVISION_ATTENABLED => [ |
|
| 81 | + self::STREAMER_VAR => "attenabled", |
|
| 82 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 83 | + ], |
|
| 84 | + SYNC_PROVISION_MINDEVPWLENGTH => [ |
|
| 85 | + self::STREAMER_VAR => "mindevpwlenngth", |
|
| 86 | + self::STREAMER_CHECKS => [ |
|
| 87 | + self::STREAMER_CHECK_CMPHIGHER => 0, |
|
| 88 | + self::STREAMER_CHECK_CMPLOWER => 17, |
|
| 89 | + ], |
|
| 90 | + ], |
|
| 91 | + SYNC_PROVISION_MAXINACTTIMEDEVLOCK => [self::STREAMER_VAR => "maxinacttimedevlock"], |
|
| 92 | + SYNC_PROVISION_MAXDEVPWFAILEDATTEMPTS => [ |
|
| 93 | + self::STREAMER_VAR => "maxdevpwfailedattempts", |
|
| 94 | + self::STREAMER_CHECKS => [ |
|
| 95 | + self::STREAMER_CHECK_CMPHIGHER => 3, |
|
| 96 | + self::STREAMER_CHECK_CMPLOWER => 17, |
|
| 97 | + ], |
|
| 98 | + ], |
|
| 99 | + SYNC_PROVISION_MAXATTSIZE => [ |
|
| 100 | + self::STREAMER_VAR => "maxattsize", |
|
| 101 | + self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 102 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 103 | + ], |
|
| 104 | + SYNC_PROVISION_ALLOWSIMPLEDEVPW => [ |
|
| 105 | + self::STREAMER_VAR => "allowsimpledevpw", |
|
| 106 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 107 | + ], |
|
| 108 | + SYNC_PROVISION_DEVPWEXPIRATION => [ |
|
| 109 | + self::STREAMER_VAR => "devpwexpiration", |
|
| 110 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 111 | + ], |
|
| 112 | + SYNC_PROVISION_DEVPWHISTORY => [ |
|
| 113 | + self::STREAMER_VAR => "devpwhistory", |
|
| 114 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 115 | + ], |
|
| 116 | + ]; |
|
| 117 | 117 | |
| 118 | - if (Request::GetProtocolVersion() >= 12.1) { |
|
| 119 | - $mapping += [ |
|
| 120 | - SYNC_PROVISION_ALLOWSTORAGECARD => [ |
|
| 121 | - self::STREAMER_VAR => "allowstoragecard", |
|
| 122 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 123 | - ], |
|
| 124 | - SYNC_PROVISION_ALLOWCAM => [ |
|
| 125 | - self::STREAMER_VAR => "allowcam", |
|
| 126 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 127 | - ], |
|
| 128 | - SYNC_PROVISION_REQDEVENC => [ |
|
| 129 | - self::STREAMER_VAR => "reqdevenc", |
|
| 130 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 131 | - ], |
|
| 132 | - SYNC_PROVISION_ALLOWUNSIGNEDAPPS => [ |
|
| 133 | - self::STREAMER_VAR => "allowunsignedapps", |
|
| 134 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 135 | - ], |
|
| 136 | - SYNC_PROVISION_ALLOWUNSIGNEDINSTALLATIONPACKAGES => [ |
|
| 137 | - self::STREAMER_VAR => "allowunsigninstallpacks", |
|
| 138 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 139 | - ], |
|
| 140 | - SYNC_PROVISION_MINDEVPWCOMPLEXCHARS => [ |
|
| 141 | - self::STREAMER_VAR => "mindevcomplexchars", |
|
| 142 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4]], |
|
| 143 | - ], |
|
| 144 | - SYNC_PROVISION_ALLOWWIFI => [ |
|
| 145 | - self::STREAMER_VAR => "allowwifi", |
|
| 146 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 147 | - ], |
|
| 148 | - SYNC_PROVISION_ALLOWTEXTMESSAGING => [ |
|
| 149 | - self::STREAMER_VAR => "allowtextmessaging", |
|
| 150 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 151 | - ], |
|
| 152 | - SYNC_PROVISION_ALLOWPOPIMAPEMAIL => [ |
|
| 153 | - self::STREAMER_VAR => "allowpopimapemail", |
|
| 154 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 155 | - ], |
|
| 156 | - SYNC_PROVISION_ALLOWBLUETOOTH => [ |
|
| 157 | - self::STREAMER_VAR => "allowbluetooth", |
|
| 158 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2]], |
|
| 159 | - ], |
|
| 160 | - SYNC_PROVISION_ALLOWIRDA => [ |
|
| 161 | - self::STREAMER_VAR => "allowirda", |
|
| 162 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 163 | - ], |
|
| 164 | - SYNC_PROVISION_REQMANUALSYNCWHENROAM => [ |
|
| 165 | - self::STREAMER_VAR => "reqmansyncroam", |
|
| 166 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 167 | - ], |
|
| 168 | - SYNC_PROVISION_ALLOWDESKTOPSYNC => [ |
|
| 169 | - self::STREAMER_VAR => "allowdesktopsync", |
|
| 170 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 171 | - ], |
|
| 172 | - SYNC_PROVISION_MAXCALAGEFILTER => [ |
|
| 173 | - self::STREAMER_VAR => "maxcalagefilter", |
|
| 174 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 4, 5, 6, 7]], |
|
| 175 | - ], |
|
| 176 | - SYNC_PROVISION_ALLOWHTMLEMAIL => [ |
|
| 177 | - self::STREAMER_VAR => "allowhtmlemail", |
|
| 178 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 179 | - ], |
|
| 180 | - SYNC_PROVISION_MAXEMAILAGEFILTER => [ |
|
| 181 | - self::STREAMER_VAR => "maxemailagefilter", |
|
| 182 | - self::STREAMER_CHECKS => [ |
|
| 183 | - self::STREAMER_CHECK_CMPHIGHER => -1, |
|
| 184 | - self::STREAMER_CHECK_CMPLOWER => 6, |
|
| 185 | - ], |
|
| 186 | - ], |
|
| 187 | - SYNC_PROVISION_MAXEMAILBODYTRUNCSIZE => [ |
|
| 188 | - self::STREAMER_VAR => "maxemailbodytruncsize", |
|
| 189 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -2], |
|
| 190 | - ], |
|
| 191 | - SYNC_PROVISION_MAXEMAILHTMLBODYTRUNCSIZE => [ |
|
| 192 | - self::STREAMER_VAR => "maxemailhtmlbodytruncsize", |
|
| 193 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -2], |
|
| 194 | - ], |
|
| 195 | - SYNC_PROVISION_REQSIGNEDSMIMEMESSAGES => [ |
|
| 196 | - self::STREAMER_VAR => "reqsignedsmimemessages", |
|
| 197 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 198 | - ], |
|
| 199 | - SYNC_PROVISION_REQENCSMIMEMESSAGES => [ |
|
| 200 | - self::STREAMER_VAR => "reqencsmimemessages", |
|
| 201 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 202 | - ], |
|
| 203 | - SYNC_PROVISION_REQSIGNEDSMIMEALGORITHM => [ |
|
| 204 | - self::STREAMER_VAR => "reqsignedsmimealgorithm", |
|
| 205 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 206 | - ], |
|
| 207 | - SYNC_PROVISION_REQENCSMIMEALGORITHM => [ |
|
| 208 | - self::STREAMER_VAR => "reqencsmimealgorithm", |
|
| 209 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 4]], |
|
| 210 | - ], |
|
| 211 | - SYNC_PROVISION_ALLOWSMIMEENCALGORITHNEG => [ |
|
| 212 | - self::STREAMER_VAR => "allowsmimeencalgneg", |
|
| 213 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2]], |
|
| 214 | - ], |
|
| 215 | - SYNC_PROVISION_ALLOWSMIMESOFTCERTS => [ |
|
| 216 | - self::STREAMER_VAR => "allowsmimesoftcerts", |
|
| 217 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 218 | - ], |
|
| 219 | - SYNC_PROVISION_ALLOWBROWSER => [ |
|
| 220 | - self::STREAMER_VAR => "allowbrowser", |
|
| 221 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 222 | - ], |
|
| 223 | - SYNC_PROVISION_ALLOWCONSUMEREMAIL => [ |
|
| 224 | - self::STREAMER_VAR => "allowconsumeremail", |
|
| 225 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 226 | - ], |
|
| 227 | - SYNC_PROVISION_ALLOWREMOTEDESKTOP => [ |
|
| 228 | - self::STREAMER_VAR => "allowremotedesk", |
|
| 229 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 230 | - ], |
|
| 231 | - SYNC_PROVISION_ALLOWINTERNETSHARING => [ |
|
| 232 | - self::STREAMER_VAR => "allowinternetsharing", |
|
| 233 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 234 | - ], |
|
| 235 | - SYNC_PROVISION_UNAPPROVEDINROMAPPLIST => [ |
|
| 236 | - self::STREAMER_VAR => "unapprovedinromapplist", |
|
| 237 | - self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 238 | - self::STREAMER_ARRAY => SYNC_PROVISION_APPNAME, |
|
| 239 | - ], // TODO check |
|
| 240 | - SYNC_PROVISION_APPROVEDAPPLIST => [ |
|
| 241 | - self::STREAMER_VAR => "approvedapplist", |
|
| 242 | - self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 243 | - self::STREAMER_ARRAY => SYNC_PROVISION_HASH, |
|
| 244 | - ], // TODO check |
|
| 245 | - ]; |
|
| 246 | - } |
|
| 118 | + if (Request::GetProtocolVersion() >= 12.1) { |
|
| 119 | + $mapping += [ |
|
| 120 | + SYNC_PROVISION_ALLOWSTORAGECARD => [ |
|
| 121 | + self::STREAMER_VAR => "allowstoragecard", |
|
| 122 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 123 | + ], |
|
| 124 | + SYNC_PROVISION_ALLOWCAM => [ |
|
| 125 | + self::STREAMER_VAR => "allowcam", |
|
| 126 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 127 | + ], |
|
| 128 | + SYNC_PROVISION_REQDEVENC => [ |
|
| 129 | + self::STREAMER_VAR => "reqdevenc", |
|
| 130 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 131 | + ], |
|
| 132 | + SYNC_PROVISION_ALLOWUNSIGNEDAPPS => [ |
|
| 133 | + self::STREAMER_VAR => "allowunsignedapps", |
|
| 134 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 135 | + ], |
|
| 136 | + SYNC_PROVISION_ALLOWUNSIGNEDINSTALLATIONPACKAGES => [ |
|
| 137 | + self::STREAMER_VAR => "allowunsigninstallpacks", |
|
| 138 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 139 | + ], |
|
| 140 | + SYNC_PROVISION_MINDEVPWCOMPLEXCHARS => [ |
|
| 141 | + self::STREAMER_VAR => "mindevcomplexchars", |
|
| 142 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [1, 2, 3, 4]], |
|
| 143 | + ], |
|
| 144 | + SYNC_PROVISION_ALLOWWIFI => [ |
|
| 145 | + self::STREAMER_VAR => "allowwifi", |
|
| 146 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 147 | + ], |
|
| 148 | + SYNC_PROVISION_ALLOWTEXTMESSAGING => [ |
|
| 149 | + self::STREAMER_VAR => "allowtextmessaging", |
|
| 150 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 151 | + ], |
|
| 152 | + SYNC_PROVISION_ALLOWPOPIMAPEMAIL => [ |
|
| 153 | + self::STREAMER_VAR => "allowpopimapemail", |
|
| 154 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 155 | + ], |
|
| 156 | + SYNC_PROVISION_ALLOWBLUETOOTH => [ |
|
| 157 | + self::STREAMER_VAR => "allowbluetooth", |
|
| 158 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2]], |
|
| 159 | + ], |
|
| 160 | + SYNC_PROVISION_ALLOWIRDA => [ |
|
| 161 | + self::STREAMER_VAR => "allowirda", |
|
| 162 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 163 | + ], |
|
| 164 | + SYNC_PROVISION_REQMANUALSYNCWHENROAM => [ |
|
| 165 | + self::STREAMER_VAR => "reqmansyncroam", |
|
| 166 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 167 | + ], |
|
| 168 | + SYNC_PROVISION_ALLOWDESKTOPSYNC => [ |
|
| 169 | + self::STREAMER_VAR => "allowdesktopsync", |
|
| 170 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 171 | + ], |
|
| 172 | + SYNC_PROVISION_MAXCALAGEFILTER => [ |
|
| 173 | + self::STREAMER_VAR => "maxcalagefilter", |
|
| 174 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 4, 5, 6, 7]], |
|
| 175 | + ], |
|
| 176 | + SYNC_PROVISION_ALLOWHTMLEMAIL => [ |
|
| 177 | + self::STREAMER_VAR => "allowhtmlemail", |
|
| 178 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 179 | + ], |
|
| 180 | + SYNC_PROVISION_MAXEMAILAGEFILTER => [ |
|
| 181 | + self::STREAMER_VAR => "maxemailagefilter", |
|
| 182 | + self::STREAMER_CHECKS => [ |
|
| 183 | + self::STREAMER_CHECK_CMPHIGHER => -1, |
|
| 184 | + self::STREAMER_CHECK_CMPLOWER => 6, |
|
| 185 | + ], |
|
| 186 | + ], |
|
| 187 | + SYNC_PROVISION_MAXEMAILBODYTRUNCSIZE => [ |
|
| 188 | + self::STREAMER_VAR => "maxemailbodytruncsize", |
|
| 189 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -2], |
|
| 190 | + ], |
|
| 191 | + SYNC_PROVISION_MAXEMAILHTMLBODYTRUNCSIZE => [ |
|
| 192 | + self::STREAMER_VAR => "maxemailhtmlbodytruncsize", |
|
| 193 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -2], |
|
| 194 | + ], |
|
| 195 | + SYNC_PROVISION_REQSIGNEDSMIMEMESSAGES => [ |
|
| 196 | + self::STREAMER_VAR => "reqsignedsmimemessages", |
|
| 197 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 198 | + ], |
|
| 199 | + SYNC_PROVISION_REQENCSMIMEMESSAGES => [ |
|
| 200 | + self::STREAMER_VAR => "reqencsmimemessages", |
|
| 201 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 202 | + ], |
|
| 203 | + SYNC_PROVISION_REQSIGNEDSMIMEALGORITHM => [ |
|
| 204 | + self::STREAMER_VAR => "reqsignedsmimealgorithm", |
|
| 205 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 206 | + ], |
|
| 207 | + SYNC_PROVISION_REQENCSMIMEALGORITHM => [ |
|
| 208 | + self::STREAMER_VAR => "reqencsmimealgorithm", |
|
| 209 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2, 3, 4]], |
|
| 210 | + ], |
|
| 211 | + SYNC_PROVISION_ALLOWSMIMEENCALGORITHNEG => [ |
|
| 212 | + self::STREAMER_VAR => "allowsmimeencalgneg", |
|
| 213 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2]], |
|
| 214 | + ], |
|
| 215 | + SYNC_PROVISION_ALLOWSMIMESOFTCERTS => [ |
|
| 216 | + self::STREAMER_VAR => "allowsmimesoftcerts", |
|
| 217 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 218 | + ], |
|
| 219 | + SYNC_PROVISION_ALLOWBROWSER => [ |
|
| 220 | + self::STREAMER_VAR => "allowbrowser", |
|
| 221 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 222 | + ], |
|
| 223 | + SYNC_PROVISION_ALLOWCONSUMEREMAIL => [ |
|
| 224 | + self::STREAMER_VAR => "allowconsumeremail", |
|
| 225 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 226 | + ], |
|
| 227 | + SYNC_PROVISION_ALLOWREMOTEDESKTOP => [ |
|
| 228 | + self::STREAMER_VAR => "allowremotedesk", |
|
| 229 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 230 | + ], |
|
| 231 | + SYNC_PROVISION_ALLOWINTERNETSHARING => [ |
|
| 232 | + self::STREAMER_VAR => "allowinternetsharing", |
|
| 233 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [0, 1]], |
|
| 234 | + ], |
|
| 235 | + SYNC_PROVISION_UNAPPROVEDINROMAPPLIST => [ |
|
| 236 | + self::STREAMER_VAR => "unapprovedinromapplist", |
|
| 237 | + self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 238 | + self::STREAMER_ARRAY => SYNC_PROVISION_APPNAME, |
|
| 239 | + ], // TODO check |
|
| 240 | + SYNC_PROVISION_APPROVEDAPPLIST => [ |
|
| 241 | + self::STREAMER_VAR => "approvedapplist", |
|
| 242 | + self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 243 | + self::STREAMER_ARRAY => SYNC_PROVISION_HASH, |
|
| 244 | + ], // TODO check |
|
| 245 | + ]; |
|
| 246 | + } |
|
| 247 | 247 | |
| 248 | - parent::__construct($mapping); |
|
| 249 | - } |
|
| 248 | + parent::__construct($mapping); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * Loads provisioning policies into a SyncProvisioning object. |
|
| 253 | - * |
|
| 254 | - * @param array $policies array with policies' names and values |
|
| 255 | - * @param bool $logPolicies optional, determines if the policies and values should be logged. Default: false |
|
| 256 | - */ |
|
| 257 | - public function Load($policies = [], $logPolicies = false) { |
|
| 258 | - $this->LoadDefaultPolicies(); |
|
| 251 | + /** |
|
| 252 | + * Loads provisioning policies into a SyncProvisioning object. |
|
| 253 | + * |
|
| 254 | + * @param array $policies array with policies' names and values |
|
| 255 | + * @param bool $logPolicies optional, determines if the policies and values should be logged. Default: false |
|
| 256 | + */ |
|
| 257 | + public function Load($policies = [], $logPolicies = false) { |
|
| 258 | + $this->LoadDefaultPolicies(); |
|
| 259 | 259 | |
| 260 | - $streamerVars = $this->GetStreamerVars(); |
|
| 261 | - foreach ($policies as $p => $v) { |
|
| 262 | - if (!in_array($p, $streamerVars)) { |
|
| 263 | - SLog::Write(LOGLEVEL_INFO, sprintf("Policy '%s' not supported by the device, ignoring", $p)); |
|
| 260 | + $streamerVars = $this->GetStreamerVars(); |
|
| 261 | + foreach ($policies as $p => $v) { |
|
| 262 | + if (!in_array($p, $streamerVars)) { |
|
| 263 | + SLog::Write(LOGLEVEL_INFO, sprintf("Policy '%s' not supported by the device, ignoring", $p)); |
|
| 264 | 264 | |
| 265 | - continue; |
|
| 266 | - } |
|
| 267 | - if ($logPolicies) { |
|
| 268 | - SLog::Write(LOGLEVEL_WBXML, sprintf("Policy '%s' enforced with: %s (%s)", $p, (is_array($v)) ? Utils::PrintAsString(implode(',', $v)) : Utils::PrintAsString($v), gettype($v))); |
|
| 269 | - } |
|
| 270 | - $this->{$p} = (is_array($v) && empty($v)) ? [] : $v; |
|
| 271 | - } |
|
| 272 | - } |
|
| 265 | + continue; |
|
| 266 | + } |
|
| 267 | + if ($logPolicies) { |
|
| 268 | + SLog::Write(LOGLEVEL_WBXML, sprintf("Policy '%s' enforced with: %s (%s)", $p, (is_array($v)) ? Utils::PrintAsString(implode(',', $v)) : Utils::PrintAsString($v), gettype($v))); |
|
| 269 | + } |
|
| 270 | + $this->{$p} = (is_array($v) && empty($v)) ? [] : $v; |
|
| 271 | + } |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - /** |
|
| 275 | - * Loads default policies' values into a SyncProvisioning object. |
|
| 276 | - */ |
|
| 277 | - public function LoadDefaultPolicies() { |
|
| 278 | - // AS 12.0, 12.1 and 14.0 props |
|
| 279 | - $this->devpwenabled = 0; |
|
| 280 | - $this->alphanumpwreq = 0; |
|
| 281 | - $this->devencenabled = 0; |
|
| 282 | - $this->pwrecoveryenabled = 0; |
|
| 283 | - $this->attenabled = 1; |
|
| 284 | - $this->mindevpwlenngth = 4; |
|
| 285 | - $this->maxinacttimedevlock = 900; |
|
| 286 | - $this->maxdevpwfailedattempts = 8; |
|
| 287 | - $this->maxattsize = ''; |
|
| 288 | - $this->allowsimpledevpw = 1; |
|
| 289 | - $this->devpwexpiration = 0; |
|
| 290 | - $this->devpwhistory = 0; |
|
| 274 | + /** |
|
| 275 | + * Loads default policies' values into a SyncProvisioning object. |
|
| 276 | + */ |
|
| 277 | + public function LoadDefaultPolicies() { |
|
| 278 | + // AS 12.0, 12.1 and 14.0 props |
|
| 279 | + $this->devpwenabled = 0; |
|
| 280 | + $this->alphanumpwreq = 0; |
|
| 281 | + $this->devencenabled = 0; |
|
| 282 | + $this->pwrecoveryenabled = 0; |
|
| 283 | + $this->attenabled = 1; |
|
| 284 | + $this->mindevpwlenngth = 4; |
|
| 285 | + $this->maxinacttimedevlock = 900; |
|
| 286 | + $this->maxdevpwfailedattempts = 8; |
|
| 287 | + $this->maxattsize = ''; |
|
| 288 | + $this->allowsimpledevpw = 1; |
|
| 289 | + $this->devpwexpiration = 0; |
|
| 290 | + $this->devpwhistory = 0; |
|
| 291 | 291 | |
| 292 | - // AS 12.1 and 14.0 props |
|
| 293 | - $this->allowstoragecard = 1; |
|
| 294 | - $this->allowcam = 1; |
|
| 295 | - $this->reqdevenc = 0; |
|
| 296 | - $this->allowunsignedapps = 1; |
|
| 297 | - $this->allowunsigninstallpacks = 1; |
|
| 298 | - $this->mindevcomplexchars = 3; |
|
| 299 | - $this->allowwifi = 1; |
|
| 300 | - $this->allowtextmessaging = 1; |
|
| 301 | - $this->allowpopimapemail = 1; |
|
| 302 | - $this->allowbluetooth = 2; |
|
| 303 | - $this->allowirda = 1; |
|
| 304 | - $this->reqmansyncroam = 0; |
|
| 305 | - $this->allowdesktopsync = 1; |
|
| 306 | - $this->maxcalagefilter = 0; |
|
| 307 | - $this->allowhtmlemail = 1; |
|
| 308 | - $this->maxemailagefilter = 0; |
|
| 309 | - $this->maxemailbodytruncsize = -1; |
|
| 310 | - $this->maxemailhtmlbodytruncsize = -1; |
|
| 311 | - $this->reqsignedsmimemessages = 0; |
|
| 312 | - $this->reqencsmimemessages = 0; |
|
| 313 | - $this->reqsignedsmimealgorithm = 0; |
|
| 314 | - $this->reqencsmimealgorithm = 0; |
|
| 315 | - $this->allowsmimeencalgneg = 2; |
|
| 316 | - $this->allowsmimesoftcerts = 1; |
|
| 317 | - $this->allowbrowser = 1; |
|
| 318 | - $this->allowconsumeremail = 1; |
|
| 319 | - $this->allowremotedesk = 1; |
|
| 320 | - $this->allowinternetsharing = 1; |
|
| 321 | - $this->unapprovedinromapplist = []; |
|
| 322 | - $this->approvedapplist = []; |
|
| 323 | - } |
|
| 292 | + // AS 12.1 and 14.0 props |
|
| 293 | + $this->allowstoragecard = 1; |
|
| 294 | + $this->allowcam = 1; |
|
| 295 | + $this->reqdevenc = 0; |
|
| 296 | + $this->allowunsignedapps = 1; |
|
| 297 | + $this->allowunsigninstallpacks = 1; |
|
| 298 | + $this->mindevcomplexchars = 3; |
|
| 299 | + $this->allowwifi = 1; |
|
| 300 | + $this->allowtextmessaging = 1; |
|
| 301 | + $this->allowpopimapemail = 1; |
|
| 302 | + $this->allowbluetooth = 2; |
|
| 303 | + $this->allowirda = 1; |
|
| 304 | + $this->reqmansyncroam = 0; |
|
| 305 | + $this->allowdesktopsync = 1; |
|
| 306 | + $this->maxcalagefilter = 0; |
|
| 307 | + $this->allowhtmlemail = 1; |
|
| 308 | + $this->maxemailagefilter = 0; |
|
| 309 | + $this->maxemailbodytruncsize = -1; |
|
| 310 | + $this->maxemailhtmlbodytruncsize = -1; |
|
| 311 | + $this->reqsignedsmimemessages = 0; |
|
| 312 | + $this->reqencsmimemessages = 0; |
|
| 313 | + $this->reqsignedsmimealgorithm = 0; |
|
| 314 | + $this->reqencsmimealgorithm = 0; |
|
| 315 | + $this->allowsmimeencalgneg = 2; |
|
| 316 | + $this->allowsmimesoftcerts = 1; |
|
| 317 | + $this->allowbrowser = 1; |
|
| 318 | + $this->allowconsumeremail = 1; |
|
| 319 | + $this->allowremotedesk = 1; |
|
| 320 | + $this->allowinternetsharing = 1; |
|
| 321 | + $this->unapprovedinromapplist = []; |
|
| 322 | + $this->approvedapplist = []; |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - /** |
|
| 326 | - * Returns the policy hash. |
|
| 327 | - * |
|
| 328 | - * @return string |
|
| 329 | - */ |
|
| 330 | - public function GetPolicyHash() { |
|
| 331 | - return md5(serialize($this)); |
|
| 332 | - } |
|
| 325 | + /** |
|
| 326 | + * Returns the policy hash. |
|
| 327 | + * |
|
| 328 | + * @return string |
|
| 329 | + */ |
|
| 330 | + public function GetPolicyHash() { |
|
| 331 | + return md5(serialize($this)); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - /** |
|
| 335 | - * Returns the SyncProvisioning instance. |
|
| 336 | - * |
|
| 337 | - * @param array $policies array with policies' names and values |
|
| 338 | - * @param bool $logPolicies optional, determines if the policies and values should be logged. Default: false |
|
| 339 | - * |
|
| 340 | - * @return SyncProvisioning |
|
| 341 | - */ |
|
| 342 | - public static function GetObjectWithPolicies($policies = [], $logPolicies = false) { |
|
| 343 | - $p = new SyncProvisioning(); |
|
| 344 | - $p->Load($policies, $logPolicies); |
|
| 334 | + /** |
|
| 335 | + * Returns the SyncProvisioning instance. |
|
| 336 | + * |
|
| 337 | + * @param array $policies array with policies' names and values |
|
| 338 | + * @param bool $logPolicies optional, determines if the policies and values should be logged. Default: false |
|
| 339 | + * |
|
| 340 | + * @return SyncProvisioning |
|
| 341 | + */ |
|
| 342 | + public static function GetObjectWithPolicies($policies = [], $logPolicies = false) { |
|
| 343 | + $p = new SyncProvisioning(); |
|
| 344 | + $p->Load($policies, $logPolicies); |
|
| 345 | 345 | |
| 346 | - return $p; |
|
| 347 | - } |
|
| 346 | + return $p; |
|
| 347 | + } |
|
| 348 | 348 | } |
@@ -236,7 +236,7 @@ |
||
| 236 | 236 | self::STREAMER_VAR => "unapprovedinromapplist", |
| 237 | 237 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
| 238 | 238 | self::STREAMER_ARRAY => SYNC_PROVISION_APPNAME, |
| 239 | - ], // TODO check |
|
| 239 | + ], // TODO check |
|
| 240 | 240 | SYNC_PROVISION_APPROVEDAPPLIST => [ |
| 241 | 241 | self::STREAMER_VAR => "approvedapplist", |
| 242 | 242 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
@@ -10,474 +10,474 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | abstract class SyncObject extends Streamer { |
| 13 | - public const STREAMER_CHECKS = 6; |
|
| 14 | - public const STREAMER_CHECK_REQUIRED = 7; |
|
| 15 | - public const STREAMER_CHECK_ZEROORONE = 8; |
|
| 16 | - public const STREAMER_CHECK_NOTALLOWED = 9; |
|
| 17 | - public const STREAMER_CHECK_ONEVALUEOF = 10; |
|
| 18 | - public const STREAMER_CHECK_SETZERO = "setToValue0"; |
|
| 19 | - public const STREAMER_CHECK_SETONE = "setToValue1"; |
|
| 20 | - public const STREAMER_CHECK_SETTWO = "setToValue2"; |
|
| 21 | - public const STREAMER_CHECK_SETEMPTY = "setToValueEmpty"; |
|
| 22 | - public const STREAMER_CHECK_CMPLOWER = 13; |
|
| 23 | - public const STREAMER_CHECK_CMPHIGHER = 14; |
|
| 24 | - public const STREAMER_CHECK_LENGTHMAX = 15; |
|
| 25 | - public const STREAMER_CHECK_EMAIL = 16; |
|
| 26 | - |
|
| 27 | - protected $unsetVars; |
|
| 28 | - protected $supportsPrivateStripping; |
|
| 29 | - |
|
| 30 | - public function __construct($mapping) { |
|
| 31 | - $this->unsetVars = []; |
|
| 32 | - $this->supportsPrivateStripping = false; |
|
| 33 | - parent::__construct($mapping); |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Sets all supported but not transmitted variables |
|
| 38 | - * of this SyncObject to an "empty" value, so they are deleted when being saved. |
|
| 39 | - * |
|
| 40 | - * @param array $supportedFields array with all supported fields, if available |
|
| 41 | - * |
|
| 42 | - * @return bool |
|
| 43 | - */ |
|
| 44 | - public function emptySupported($supportedFields) { |
|
| 45 | - // Some devices do not send supported tag. In such a case remove all not set properties. |
|
| 46 | - if (($supportedFields === false || !is_array($supportedFields) || (empty($supportedFields)))) { |
|
| 47 | - if (defined('UNSET_UNDEFINED_PROPERTIES') && |
|
| 48 | - UNSET_UNDEFINED_PROPERTIES && |
|
| 49 | - ( |
|
| 50 | - $this instanceof SyncContact || |
|
| 51 | - $this instanceof SyncAppointment || |
|
| 52 | - $this instanceof SyncTask |
|
| 53 | - )) { |
|
| 54 | - SLog::Write(LOGLEVEL_INFO, sprintf("%s->emptySupported(): no supported list available, emptying all not set parameters", get_class($this))); |
|
| 55 | - $supportedFields = array_keys($this->mapping); |
|
| 56 | - } |
|
| 57 | - else { |
|
| 58 | - return false; |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - foreach ($supportedFields as $field) { |
|
| 63 | - if (!isset($this->mapping[$field])) { |
|
| 64 | - SLog::Write(LOGLEVEL_WARN, sprintf("Field '%s' is supposed to be emptied but is not defined for '%s'", $field, get_class($this))); |
|
| 65 | - |
|
| 66 | - continue; |
|
| 67 | - } |
|
| 68 | - $var = $this->mapping[$field][self::STREAMER_VAR]; |
|
| 69 | - // add var to $this->unsetVars if $var is not set |
|
| 70 | - if (!isset($this->{$var})) { |
|
| 71 | - $this->unsetVars[] = $var; |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("Supported variables to be unset: %s", implode(',', $this->unsetVars))); |
|
| 75 | - |
|
| 76 | - return true; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Compares this a SyncObject to another. |
|
| 81 | - * In case that all available mapped fields are exactly EQUAL, it returns true. |
|
| 82 | - * |
|
| 83 | - * @see SyncObject |
|
| 84 | - * |
|
| 85 | - * @param SyncObject $odo other SyncObject |
|
| 86 | - * @param bool $log flag to turn on logging |
|
| 87 | - * @param bool $strictTypeCompare to enforce type matching |
|
| 88 | - * |
|
| 89 | - * @return bool |
|
| 90 | - */ |
|
| 91 | - public function equals($odo, $log = false, $strictTypeCompare = false) { |
|
| 92 | - if ($odo === false) { |
|
| 93 | - return false; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - // check objecttype |
|
| 97 | - if (!($odo instanceof SyncObject)) { |
|
| 98 | - SLog::Write(LOGLEVEL_DEBUG, "SyncObject->equals() the target object is not a SyncObject"); |
|
| 99 | - |
|
| 100 | - return false; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - // check for mapped fields |
|
| 104 | - foreach ($this->mapping as $v) { |
|
| 105 | - $val = $v[self::STREAMER_VAR]; |
|
| 106 | - // array of values? |
|
| 107 | - if (isset($v[self::STREAMER_ARRAY])) { |
|
| 108 | - // if neither array is created then don't fail the comparison |
|
| 109 | - if (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 110 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is NOT SET in either object", $val)); |
|
| 111 | - |
|
| 112 | - continue; |
|
| 113 | - } |
|
| 114 | - if (is_array($this->{$val}) && is_array($odo->{$val})) { |
|
| 115 | - // if both arrays exist then seek for differences in the arrays |
|
| 116 | - if (count(array_diff($this->{$val}, $odo->{$val})) + count(array_diff($odo->{$val}, $this->{$val})) > 0) { |
|
| 117 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() items in array '%s' differ", $val)); |
|
| 118 | - |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - } |
|
| 122 | - else { |
|
| 123 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is set in one but not the other object", $val)); |
|
| 124 | - |
|
| 125 | - return false; |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - else { |
|
| 129 | - if (isset($this->{$val}, $odo->{$val})) { |
|
| 130 | - if ($strictTypeCompare) { |
|
| 131 | - if ($this->{$val} !== $odo->{$val}) { |
|
| 132 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s' using strictTypeCompare", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
|
| 133 | - |
|
| 134 | - return false; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - else { |
|
| 138 | - if ($this->{$val} != $odo->{$val}) { |
|
| 139 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
|
| 140 | - |
|
| 141 | - return false; |
|
| 142 | - } |
|
| 143 | - } |
|
| 144 | - } |
|
| 145 | - elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 146 | - continue; |
|
| 147 | - } |
|
| 148 | - else { |
|
| 149 | - SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false because field '%s' is only defined at one obj: '%s' != '%s'", $val, Utils::PrintAsString(isset($this->{$val})), Utils::PrintAsString(isset($odo->{$val})))); |
|
| 150 | - |
|
| 151 | - return false; |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return true; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * String representation of the object. |
|
| 161 | - * |
|
| 162 | - * @return string |
|
| 163 | - */ |
|
| 164 | - public function __toString() { |
|
| 165 | - $str = get_class($this) . " (\n"; |
|
| 166 | - |
|
| 167 | - $streamerVars = []; |
|
| 168 | - foreach ($this->mapping as $k => $v) { |
|
| 169 | - $streamerVars[$v[self::STREAMER_VAR]] = (isset($v[self::STREAMER_TYPE])) ? $v[self::STREAMER_TYPE] : false; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - foreach (get_object_vars($this) as $k => $v) { |
|
| 173 | - if ($k == "mapping") { |
|
| 174 | - continue; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if (array_key_exists($k, $streamerVars)) { |
|
| 178 | - $strV = "(S) "; |
|
| 179 | - } |
|
| 180 | - else { |
|
| 181 | - $strV = ""; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - // self::STREAMER_ARRAY ? |
|
| 185 | - if (is_array($v)) { |
|
| 186 | - $str .= "\t" . $strV . $k . "(Array) size: " . count($v) . "\n"; |
|
| 187 | - foreach ($v as $value) { |
|
| 188 | - $str .= "\t\t" . Utils::PrintAsString($value) . "\n"; |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - elseif ($v instanceof SyncObject) { |
|
| 192 | - $str .= "\t" . $strV . $k . " => " . str_replace("\n", "\n\t\t\t", $v->__toString()) . "\n"; |
|
| 193 | - } |
|
| 194 | - else { |
|
| 195 | - $str .= "\t" . $strV . $k . " => " . (isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null") . "\n"; |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - $str .= ")"; |
|
| 199 | - |
|
| 200 | - return $str; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * Returns the properties which have to be unset on the server. |
|
| 205 | - * |
|
| 206 | - * @return array |
|
| 207 | - */ |
|
| 208 | - public function getUnsetVars() { |
|
| 209 | - return $this->unsetVars; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Removes not necessary data from the object. |
|
| 214 | - * |
|
| 215 | - * @param mixed $flags |
|
| 216 | - * |
|
| 217 | - * @return bool |
|
| 218 | - */ |
|
| 219 | - public function StripData($flags = 0) { |
|
| 220 | - if ($flags === 0 && isset($this->unsetVars)) { |
|
| 221 | - unset($this->unsetVars); |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - return parent::StripData($flags); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * Indicates if a SyncObject supports the private flag and stripping of private data. |
|
| 229 | - * If an object does not support it, it will not be sent to the client but permanently be excluded from the sync. |
|
| 230 | - * |
|
| 231 | - * @return bool - default false defined in constructor - overwritten by implementation |
|
| 232 | - */ |
|
| 233 | - public function SupportsPrivateStripping() { |
|
| 234 | - return $this->supportsPrivateStripping; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * Method checks if the object has the minimum of required parameters |
|
| 239 | - * and fulfills semantic dependencies. |
|
| 240 | - * |
|
| 241 | - * General checks: |
|
| 242 | - * STREAMER_CHECK_REQUIRED may have as value false (do not fix, ignore object!) or set-to-values: STREAMER_CHECK_SETZERO/ONE/TWO, STREAMER_CHECK_SETEMPTY |
|
| 243 | - * STREAMER_CHECK_ZEROORONE may be 0 or 1, if none of these, set-to-values: STREAMER_CHECK_SETZERO or STREAMER_CHECK_SETONE |
|
| 244 | - * STREAMER_CHECK_NOTALLOWED fails if is set |
|
| 245 | - * STREAMER_CHECK_ONEVALUEOF expects an array with accepted values, fails if value is not in array |
|
| 246 | - * |
|
| 247 | - * Comparison: |
|
| 248 | - * STREAMER_CHECK_CMPLOWER compares if the current parameter is lower as a literal or another parameter of the same object |
|
| 249 | - * STREAMER_CHECK_CMPHIGHER compares if the current parameter is higher as a literal or another parameter of the same object |
|
| 250 | - * |
|
| 251 | - * @param bool $logAsDebug (opt) default is false, so messages are logged in WARN log level |
|
| 252 | - * |
|
| 253 | - * @return bool |
|
| 254 | - */ |
|
| 255 | - public function Check($logAsDebug = false) { |
|
| 256 | - // semantic checks general "turn off switch" |
|
| 257 | - if (defined("DO_SEMANTIC_CHECKS") && DO_SEMANTIC_CHECKS === false) { |
|
| 258 | - SLog::Write(LOGLEVEL_DEBUG, "SyncObject->Check(): semantic checks disabled. Check your config for 'DO_SEMANTIC_CHECKS'."); |
|
| 259 | - |
|
| 260 | - return true; |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - $defaultLogLevel = LOGLEVEL_WARN; |
|
| 264 | - |
|
| 265 | - // in some cases non-false checks should not provoke a WARN log but only a DEBUG log |
|
| 266 | - if ($logAsDebug) { |
|
| 267 | - $defaultLogLevel = LOGLEVEL_DEBUG; |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - $objClass = get_class($this); |
|
| 271 | - foreach ($this->mapping as $k => $v) { |
|
| 272 | - // check sub-objects recursively |
|
| 273 | - if (isset($v[self::STREAMER_TYPE], $this->{$v[self::STREAMER_VAR]})) { |
|
| 274 | - if ($this->{$v[self::STREAMER_VAR]} instanceof SyncObject) { |
|
| 275 | - if (!$this->{$v[self::STREAMER_VAR]}->Check($logAsDebug)) { |
|
| 276 | - return false; |
|
| 277 | - } |
|
| 278 | - } |
|
| 279 | - elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 280 | - foreach ($this->{$v[self::STREAMER_VAR]} as $subobj) { |
|
| 281 | - if ($subobj instanceof SyncObject && !$subobj->Check($logAsDebug)) { |
|
| 282 | - return false; |
|
| 283 | - } |
|
| 284 | - } |
|
| 285 | - } |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - if (isset($v[self::STREAMER_CHECKS])) { |
|
| 289 | - foreach ($v[self::STREAMER_CHECKS] as $rule => $condition) { |
|
| 290 | - // check REQUIRED settings |
|
| 291 | - if ($rule === self::STREAMER_CHECK_REQUIRED && (!isset($this->{$v[self::STREAMER_VAR]}) || $this->{$v[self::STREAMER_VAR]} === '')) { |
|
| 292 | - // parameter is not set but .. |
|
| 293 | - // requested to set to 0 |
|
| 294 | - if ($condition === self::STREAMER_CHECK_SETZERO) { |
|
| 295 | - $this->{$v[self::STREAMER_VAR]} = 0; |
|
| 296 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 0", $objClass, $v[self::STREAMER_VAR])); |
|
| 297 | - } |
|
| 298 | - // requested to be set to 1 |
|
| 299 | - elseif ($condition === self::STREAMER_CHECK_SETONE) { |
|
| 300 | - $this->{$v[self::STREAMER_VAR]} = 1; |
|
| 301 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 1", $objClass, $v[self::STREAMER_VAR])); |
|
| 302 | - } |
|
| 303 | - // requested to be set to 2 |
|
| 304 | - elseif ($condition === self::STREAMER_CHECK_SETTWO) { |
|
| 305 | - $this->{$v[self::STREAMER_VAR]} = 2; |
|
| 306 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 2", $objClass, $v[self::STREAMER_VAR])); |
|
| 307 | - } |
|
| 308 | - // requested to be set to '' |
|
| 309 | - elseif ($condition === self::STREAMER_CHECK_SETEMPTY) { |
|
| 310 | - if (!isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 311 | - $this->{$v[self::STREAMER_VAR]} = ''; |
|
| 312 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to ''", $objClass, $v[self::STREAMER_VAR])); |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - // there is another value !== false |
|
| 316 | - elseif ($condition !== false) { |
|
| 317 | - $this->{$v[self::STREAMER_VAR]} = $condition; |
|
| 318 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to '%s'", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 319 | - } |
|
| 320 | - // no fix available! |
|
| 321 | - else { |
|
| 322 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' is required but not set. Check failed!", $objClass, $v[self::STREAMER_VAR])); |
|
| 323 | - |
|
| 324 | - return false; |
|
| 325 | - } |
|
| 326 | - } // end STREAMER_CHECK_REQUIRED |
|
| 327 | - |
|
| 328 | - // check STREAMER_CHECK_ZEROORONE |
|
| 329 | - if ($rule === self::STREAMER_CHECK_ZEROORONE && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 330 | - if ($this->{$v[self::STREAMER_VAR]} != 0 && $this->{$v[self::STREAMER_VAR]} != 1) { |
|
| 331 | - $newval = $condition === self::STREAMER_CHECK_SETZERO ? 0 : 1; |
|
| 332 | - $this->{$v[self::STREAMER_VAR]} = $newval; |
|
| 333 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to '%s' as it was not 0 or 1", $objClass, $v[self::STREAMER_VAR], $newval)); |
|
| 334 | - } |
|
| 335 | - }// end STREAMER_CHECK_ZEROORONE |
|
| 336 | - |
|
| 337 | - // check STREAMER_CHECK_ONEVALUEOF |
|
| 338 | - if ($rule === self::STREAMER_CHECK_ONEVALUEOF && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 339 | - if (!in_array($this->{$v[self::STREAMER_VAR]}, $condition)) { |
|
| 340 | - SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): object from type %s: parameter '%s'->'%s' is not in the range of allowed values.", $objClass, $v[self::STREAMER_VAR], $this->{$v[self::STREAMER_VAR]})); |
|
| 341 | - |
|
| 342 | - return false; |
|
| 343 | - } |
|
| 344 | - }// end STREAMER_CHECK_ONEVALUEOF |
|
| 345 | - |
|
| 346 | - // Check value compared to other value or literal |
|
| 347 | - if ($rule === self::STREAMER_CHECK_CMPHIGHER || $rule === self::STREAMER_CHECK_CMPLOWER) { |
|
| 348 | - if (isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 349 | - $cmp = false; |
|
| 350 | - // directly compare against literals |
|
| 351 | - if (is_int($condition)) { |
|
| 352 | - $cmp = $condition; |
|
| 353 | - } |
|
| 354 | - // check for invalid compare-to |
|
| 355 | - elseif (!isset($this->mapping[$condition])) { |
|
| 356 | - SLog::Write(LOGLEVEL_ERROR, sprintf("SyncObject->Check(): Can not compare parameter '%s' against the other value '%s' as it is not defined object from type %s. Please report this! Check skipped!", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 357 | - |
|
| 358 | - continue; |
|
| 359 | - } |
|
| 360 | - else { |
|
| 361 | - $cmpPar = $this->mapping[$condition][self::STREAMER_VAR]; |
|
| 362 | - if (isset($this->{$cmpPar})) { |
|
| 363 | - $cmp = $this->{$cmpPar}; |
|
| 364 | - } |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - if ($cmp === false) { |
|
| 368 | - SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' can not be compared, as the comparable is not set. Check failed!", $objClass, $v[self::STREAMER_VAR])); |
|
| 369 | - |
|
| 370 | - return false; |
|
| 371 | - } |
|
| 372 | - if ( |
|
| 373 | - ($rule == self::STREAMER_CHECK_CMPHIGHER && $this->{$v[self::STREAMER_VAR]} < $cmp) || |
|
| 374 | - ($rule == self::STREAMER_CHECK_CMPLOWER && $this->{$v[self::STREAMER_VAR]} > $cmp) |
|
| 375 | - ) { |
|
| 376 | - SLog::Write(LOGLEVEL_WARN, sprintf( |
|
| 377 | - "SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' is %s than '%s'. Check failed!", |
|
| 378 | - $objClass, |
|
| 379 | - $v[self::STREAMER_VAR], |
|
| 380 | - (($rule === self::STREAMER_CHECK_CMPHIGHER) ? 'LOWER' : 'HIGHER'), |
|
| 381 | - ((isset($cmpPar) ? $cmpPar : $condition)) |
|
| 382 | - )); |
|
| 383 | - |
|
| 384 | - return false; |
|
| 385 | - } |
|
| 386 | - } |
|
| 387 | - } // STREAMER_CHECK_CMP* |
|
| 388 | - |
|
| 389 | - // check STREAMER_CHECK_LENGTHMAX |
|
| 390 | - if ($rule === self::STREAMER_CHECK_LENGTHMAX && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 391 | - if (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 392 | - // implosion takes 2bytes, so we just assume ", " here |
|
| 393 | - $chkstr = implode(", ", $this->{$v[self::STREAMER_VAR]}); |
|
| 394 | - } |
|
| 395 | - else { |
|
| 396 | - $chkstr = $this->{$v[self::STREAMER_VAR]}; |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - if (strlen($chkstr) > $condition) { |
|
| 400 | - SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' is longer than %d. Check failed", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 401 | - |
|
| 402 | - return false; |
|
| 403 | - } |
|
| 404 | - }// end STREAMER_CHECK_LENGTHMAX |
|
| 405 | - |
|
| 406 | - // check STREAMER_CHECK_EMAIL |
|
| 407 | - // if $condition is false then the check really fails. Otherwise invalid emails are removed. |
|
| 408 | - // if nothing is left (all emails were false), the parameter is set to condition |
|
| 409 | - if ($rule === self::STREAMER_CHECK_EMAIL && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 410 | - if ($condition === false && ((is_array($this->{$v[self::STREAMER_VAR]}) && empty($this->{$v[self::STREAMER_VAR]})) || strlen($this->{$v[self::STREAMER_VAR]}) == 0)) { |
|
| 411 | - continue; |
|
| 412 | - } |
|
| 413 | - |
|
| 414 | - $as_array = false; |
|
| 415 | - |
|
| 416 | - if (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 417 | - $mails = $this->{$v[self::STREAMER_VAR]}; |
|
| 418 | - $as_array = true; |
|
| 419 | - } |
|
| 420 | - else { |
|
| 421 | - $mails = [$this->{$v[self::STREAMER_VAR]}]; |
|
| 422 | - } |
|
| 423 | - |
|
| 424 | - $output = []; |
|
| 425 | - foreach ($mails as $mail) { |
|
| 426 | - if (!Utils::CheckEmail($mail)) { |
|
| 427 | - SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' contains an invalid email address '%s'. Address is removed.", $objClass, $v[self::STREAMER_VAR], $mail)); |
|
| 428 | - } |
|
| 429 | - else { |
|
| 430 | - $output[] = $mail; |
|
| 431 | - } |
|
| 432 | - } |
|
| 433 | - if (count($mails) != count($output)) { |
|
| 434 | - if ($condition === false) { |
|
| 435 | - return false; |
|
| 436 | - } |
|
| 437 | - |
|
| 438 | - // nothing left, use $condition as new value |
|
| 439 | - if (count($output) == 0) { |
|
| 440 | - $output[] = $condition; |
|
| 441 | - } |
|
| 442 | - |
|
| 443 | - // if we are allowed to rewrite the attribute, we do that |
|
| 444 | - if ($as_array) { |
|
| 445 | - $this->{$v[self::STREAMER_VAR]} = $output; |
|
| 446 | - } |
|
| 447 | - else { |
|
| 448 | - $this->{$v[self::STREAMER_VAR]} = $output[0]; |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - }// end STREAMER_CHECK_EMAIL |
|
| 452 | - } // foreach CHECKS |
|
| 453 | - } // isset CHECKS |
|
| 454 | - } // foreach mapping |
|
| 455 | - |
|
| 456 | - return true; |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * Returns human friendly property name from its value if a mapping is available. |
|
| 461 | - * |
|
| 462 | - * @param array $v |
|
| 463 | - * @param mixed $val |
|
| 464 | - * |
|
| 465 | - * @return mixed |
|
| 466 | - */ |
|
| 467 | - public function GetNameFromPropertyValue($v, $val) { |
|
| 468 | - if (isset($v[self::STREAMER_VALUEMAP][$val])) { |
|
| 469 | - return $v[self::STREAMER_VALUEMAP][$val]; |
|
| 470 | - } |
|
| 471 | - |
|
| 472 | - return $val; |
|
| 473 | - } |
|
| 474 | - |
|
| 475 | - /** |
|
| 476 | - * Called after the SyncObject was unserialized. |
|
| 477 | - * |
|
| 478 | - * @return bool |
|
| 479 | - */ |
|
| 480 | - public function postUnserialize() { |
|
| 481 | - return true; |
|
| 482 | - } |
|
| 13 | + public const STREAMER_CHECKS = 6; |
|
| 14 | + public const STREAMER_CHECK_REQUIRED = 7; |
|
| 15 | + public const STREAMER_CHECK_ZEROORONE = 8; |
|
| 16 | + public const STREAMER_CHECK_NOTALLOWED = 9; |
|
| 17 | + public const STREAMER_CHECK_ONEVALUEOF = 10; |
|
| 18 | + public const STREAMER_CHECK_SETZERO = "setToValue0"; |
|
| 19 | + public const STREAMER_CHECK_SETONE = "setToValue1"; |
|
| 20 | + public const STREAMER_CHECK_SETTWO = "setToValue2"; |
|
| 21 | + public const STREAMER_CHECK_SETEMPTY = "setToValueEmpty"; |
|
| 22 | + public const STREAMER_CHECK_CMPLOWER = 13; |
|
| 23 | + public const STREAMER_CHECK_CMPHIGHER = 14; |
|
| 24 | + public const STREAMER_CHECK_LENGTHMAX = 15; |
|
| 25 | + public const STREAMER_CHECK_EMAIL = 16; |
|
| 26 | + |
|
| 27 | + protected $unsetVars; |
|
| 28 | + protected $supportsPrivateStripping; |
|
| 29 | + |
|
| 30 | + public function __construct($mapping) { |
|
| 31 | + $this->unsetVars = []; |
|
| 32 | + $this->supportsPrivateStripping = false; |
|
| 33 | + parent::__construct($mapping); |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Sets all supported but not transmitted variables |
|
| 38 | + * of this SyncObject to an "empty" value, so they are deleted when being saved. |
|
| 39 | + * |
|
| 40 | + * @param array $supportedFields array with all supported fields, if available |
|
| 41 | + * |
|
| 42 | + * @return bool |
|
| 43 | + */ |
|
| 44 | + public function emptySupported($supportedFields) { |
|
| 45 | + // Some devices do not send supported tag. In such a case remove all not set properties. |
|
| 46 | + if (($supportedFields === false || !is_array($supportedFields) || (empty($supportedFields)))) { |
|
| 47 | + if (defined('UNSET_UNDEFINED_PROPERTIES') && |
|
| 48 | + UNSET_UNDEFINED_PROPERTIES && |
|
| 49 | + ( |
|
| 50 | + $this instanceof SyncContact || |
|
| 51 | + $this instanceof SyncAppointment || |
|
| 52 | + $this instanceof SyncTask |
|
| 53 | + )) { |
|
| 54 | + SLog::Write(LOGLEVEL_INFO, sprintf("%s->emptySupported(): no supported list available, emptying all not set parameters", get_class($this))); |
|
| 55 | + $supportedFields = array_keys($this->mapping); |
|
| 56 | + } |
|
| 57 | + else { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + foreach ($supportedFields as $field) { |
|
| 63 | + if (!isset($this->mapping[$field])) { |
|
| 64 | + SLog::Write(LOGLEVEL_WARN, sprintf("Field '%s' is supposed to be emptied but is not defined for '%s'", $field, get_class($this))); |
|
| 65 | + |
|
| 66 | + continue; |
|
| 67 | + } |
|
| 68 | + $var = $this->mapping[$field][self::STREAMER_VAR]; |
|
| 69 | + // add var to $this->unsetVars if $var is not set |
|
| 70 | + if (!isset($this->{$var})) { |
|
| 71 | + $this->unsetVars[] = $var; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("Supported variables to be unset: %s", implode(',', $this->unsetVars))); |
|
| 75 | + |
|
| 76 | + return true; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Compares this a SyncObject to another. |
|
| 81 | + * In case that all available mapped fields are exactly EQUAL, it returns true. |
|
| 82 | + * |
|
| 83 | + * @see SyncObject |
|
| 84 | + * |
|
| 85 | + * @param SyncObject $odo other SyncObject |
|
| 86 | + * @param bool $log flag to turn on logging |
|
| 87 | + * @param bool $strictTypeCompare to enforce type matching |
|
| 88 | + * |
|
| 89 | + * @return bool |
|
| 90 | + */ |
|
| 91 | + public function equals($odo, $log = false, $strictTypeCompare = false) { |
|
| 92 | + if ($odo === false) { |
|
| 93 | + return false; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + // check objecttype |
|
| 97 | + if (!($odo instanceof SyncObject)) { |
|
| 98 | + SLog::Write(LOGLEVEL_DEBUG, "SyncObject->equals() the target object is not a SyncObject"); |
|
| 99 | + |
|
| 100 | + return false; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + // check for mapped fields |
|
| 104 | + foreach ($this->mapping as $v) { |
|
| 105 | + $val = $v[self::STREAMER_VAR]; |
|
| 106 | + // array of values? |
|
| 107 | + if (isset($v[self::STREAMER_ARRAY])) { |
|
| 108 | + // if neither array is created then don't fail the comparison |
|
| 109 | + if (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 110 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is NOT SET in either object", $val)); |
|
| 111 | + |
|
| 112 | + continue; |
|
| 113 | + } |
|
| 114 | + if (is_array($this->{$val}) && is_array($odo->{$val})) { |
|
| 115 | + // if both arrays exist then seek for differences in the arrays |
|
| 116 | + if (count(array_diff($this->{$val}, $odo->{$val})) + count(array_diff($odo->{$val}, $this->{$val})) > 0) { |
|
| 117 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() items in array '%s' differ", $val)); |
|
| 118 | + |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + } |
|
| 122 | + else { |
|
| 123 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is set in one but not the other object", $val)); |
|
| 124 | + |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + else { |
|
| 129 | + if (isset($this->{$val}, $odo->{$val})) { |
|
| 130 | + if ($strictTypeCompare) { |
|
| 131 | + if ($this->{$val} !== $odo->{$val}) { |
|
| 132 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s' using strictTypeCompare", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
|
| 133 | + |
|
| 134 | + return false; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + else { |
|
| 138 | + if ($this->{$val} != $odo->{$val}) { |
|
| 139 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
|
| 140 | + |
|
| 141 | + return false; |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | + elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 146 | + continue; |
|
| 147 | + } |
|
| 148 | + else { |
|
| 149 | + SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false because field '%s' is only defined at one obj: '%s' != '%s'", $val, Utils::PrintAsString(isset($this->{$val})), Utils::PrintAsString(isset($odo->{$val})))); |
|
| 150 | + |
|
| 151 | + return false; |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return true; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * String representation of the object. |
|
| 161 | + * |
|
| 162 | + * @return string |
|
| 163 | + */ |
|
| 164 | + public function __toString() { |
|
| 165 | + $str = get_class($this) . " (\n"; |
|
| 166 | + |
|
| 167 | + $streamerVars = []; |
|
| 168 | + foreach ($this->mapping as $k => $v) { |
|
| 169 | + $streamerVars[$v[self::STREAMER_VAR]] = (isset($v[self::STREAMER_TYPE])) ? $v[self::STREAMER_TYPE] : false; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + foreach (get_object_vars($this) as $k => $v) { |
|
| 173 | + if ($k == "mapping") { |
|
| 174 | + continue; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if (array_key_exists($k, $streamerVars)) { |
|
| 178 | + $strV = "(S) "; |
|
| 179 | + } |
|
| 180 | + else { |
|
| 181 | + $strV = ""; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + // self::STREAMER_ARRAY ? |
|
| 185 | + if (is_array($v)) { |
|
| 186 | + $str .= "\t" . $strV . $k . "(Array) size: " . count($v) . "\n"; |
|
| 187 | + foreach ($v as $value) { |
|
| 188 | + $str .= "\t\t" . Utils::PrintAsString($value) . "\n"; |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + elseif ($v instanceof SyncObject) { |
|
| 192 | + $str .= "\t" . $strV . $k . " => " . str_replace("\n", "\n\t\t\t", $v->__toString()) . "\n"; |
|
| 193 | + } |
|
| 194 | + else { |
|
| 195 | + $str .= "\t" . $strV . $k . " => " . (isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null") . "\n"; |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + $str .= ")"; |
|
| 199 | + |
|
| 200 | + return $str; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * Returns the properties which have to be unset on the server. |
|
| 205 | + * |
|
| 206 | + * @return array |
|
| 207 | + */ |
|
| 208 | + public function getUnsetVars() { |
|
| 209 | + return $this->unsetVars; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Removes not necessary data from the object. |
|
| 214 | + * |
|
| 215 | + * @param mixed $flags |
|
| 216 | + * |
|
| 217 | + * @return bool |
|
| 218 | + */ |
|
| 219 | + public function StripData($flags = 0) { |
|
| 220 | + if ($flags === 0 && isset($this->unsetVars)) { |
|
| 221 | + unset($this->unsetVars); |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + return parent::StripData($flags); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * Indicates if a SyncObject supports the private flag and stripping of private data. |
|
| 229 | + * If an object does not support it, it will not be sent to the client but permanently be excluded from the sync. |
|
| 230 | + * |
|
| 231 | + * @return bool - default false defined in constructor - overwritten by implementation |
|
| 232 | + */ |
|
| 233 | + public function SupportsPrivateStripping() { |
|
| 234 | + return $this->supportsPrivateStripping; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * Method checks if the object has the minimum of required parameters |
|
| 239 | + * and fulfills semantic dependencies. |
|
| 240 | + * |
|
| 241 | + * General checks: |
|
| 242 | + * STREAMER_CHECK_REQUIRED may have as value false (do not fix, ignore object!) or set-to-values: STREAMER_CHECK_SETZERO/ONE/TWO, STREAMER_CHECK_SETEMPTY |
|
| 243 | + * STREAMER_CHECK_ZEROORONE may be 0 or 1, if none of these, set-to-values: STREAMER_CHECK_SETZERO or STREAMER_CHECK_SETONE |
|
| 244 | + * STREAMER_CHECK_NOTALLOWED fails if is set |
|
| 245 | + * STREAMER_CHECK_ONEVALUEOF expects an array with accepted values, fails if value is not in array |
|
| 246 | + * |
|
| 247 | + * Comparison: |
|
| 248 | + * STREAMER_CHECK_CMPLOWER compares if the current parameter is lower as a literal or another parameter of the same object |
|
| 249 | + * STREAMER_CHECK_CMPHIGHER compares if the current parameter is higher as a literal or another parameter of the same object |
|
| 250 | + * |
|
| 251 | + * @param bool $logAsDebug (opt) default is false, so messages are logged in WARN log level |
|
| 252 | + * |
|
| 253 | + * @return bool |
|
| 254 | + */ |
|
| 255 | + public function Check($logAsDebug = false) { |
|
| 256 | + // semantic checks general "turn off switch" |
|
| 257 | + if (defined("DO_SEMANTIC_CHECKS") && DO_SEMANTIC_CHECKS === false) { |
|
| 258 | + SLog::Write(LOGLEVEL_DEBUG, "SyncObject->Check(): semantic checks disabled. Check your config for 'DO_SEMANTIC_CHECKS'."); |
|
| 259 | + |
|
| 260 | + return true; |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + $defaultLogLevel = LOGLEVEL_WARN; |
|
| 264 | + |
|
| 265 | + // in some cases non-false checks should not provoke a WARN log but only a DEBUG log |
|
| 266 | + if ($logAsDebug) { |
|
| 267 | + $defaultLogLevel = LOGLEVEL_DEBUG; |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + $objClass = get_class($this); |
|
| 271 | + foreach ($this->mapping as $k => $v) { |
|
| 272 | + // check sub-objects recursively |
|
| 273 | + if (isset($v[self::STREAMER_TYPE], $this->{$v[self::STREAMER_VAR]})) { |
|
| 274 | + if ($this->{$v[self::STREAMER_VAR]} instanceof SyncObject) { |
|
| 275 | + if (!$this->{$v[self::STREAMER_VAR]}->Check($logAsDebug)) { |
|
| 276 | + return false; |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | + elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 280 | + foreach ($this->{$v[self::STREAMER_VAR]} as $subobj) { |
|
| 281 | + if ($subobj instanceof SyncObject && !$subobj->Check($logAsDebug)) { |
|
| 282 | + return false; |
|
| 283 | + } |
|
| 284 | + } |
|
| 285 | + } |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + if (isset($v[self::STREAMER_CHECKS])) { |
|
| 289 | + foreach ($v[self::STREAMER_CHECKS] as $rule => $condition) { |
|
| 290 | + // check REQUIRED settings |
|
| 291 | + if ($rule === self::STREAMER_CHECK_REQUIRED && (!isset($this->{$v[self::STREAMER_VAR]}) || $this->{$v[self::STREAMER_VAR]} === '')) { |
|
| 292 | + // parameter is not set but .. |
|
| 293 | + // requested to set to 0 |
|
| 294 | + if ($condition === self::STREAMER_CHECK_SETZERO) { |
|
| 295 | + $this->{$v[self::STREAMER_VAR]} = 0; |
|
| 296 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 0", $objClass, $v[self::STREAMER_VAR])); |
|
| 297 | + } |
|
| 298 | + // requested to be set to 1 |
|
| 299 | + elseif ($condition === self::STREAMER_CHECK_SETONE) { |
|
| 300 | + $this->{$v[self::STREAMER_VAR]} = 1; |
|
| 301 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 1", $objClass, $v[self::STREAMER_VAR])); |
|
| 302 | + } |
|
| 303 | + // requested to be set to 2 |
|
| 304 | + elseif ($condition === self::STREAMER_CHECK_SETTWO) { |
|
| 305 | + $this->{$v[self::STREAMER_VAR]} = 2; |
|
| 306 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to 2", $objClass, $v[self::STREAMER_VAR])); |
|
| 307 | + } |
|
| 308 | + // requested to be set to '' |
|
| 309 | + elseif ($condition === self::STREAMER_CHECK_SETEMPTY) { |
|
| 310 | + if (!isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 311 | + $this->{$v[self::STREAMER_VAR]} = ''; |
|
| 312 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to ''", $objClass, $v[self::STREAMER_VAR])); |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + // there is another value !== false |
|
| 316 | + elseif ($condition !== false) { |
|
| 317 | + $this->{$v[self::STREAMER_VAR]} = $condition; |
|
| 318 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to '%s'", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 319 | + } |
|
| 320 | + // no fix available! |
|
| 321 | + else { |
|
| 322 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' is required but not set. Check failed!", $objClass, $v[self::STREAMER_VAR])); |
|
| 323 | + |
|
| 324 | + return false; |
|
| 325 | + } |
|
| 326 | + } // end STREAMER_CHECK_REQUIRED |
|
| 327 | + |
|
| 328 | + // check STREAMER_CHECK_ZEROORONE |
|
| 329 | + if ($rule === self::STREAMER_CHECK_ZEROORONE && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 330 | + if ($this->{$v[self::STREAMER_VAR]} != 0 && $this->{$v[self::STREAMER_VAR]} != 1) { |
|
| 331 | + $newval = $condition === self::STREAMER_CHECK_SETZERO ? 0 : 1; |
|
| 332 | + $this->{$v[self::STREAMER_VAR]} = $newval; |
|
| 333 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): Fixed object from type %s: parameter '%s' is set to '%s' as it was not 0 or 1", $objClass, $v[self::STREAMER_VAR], $newval)); |
|
| 334 | + } |
|
| 335 | + }// end STREAMER_CHECK_ZEROORONE |
|
| 336 | + |
|
| 337 | + // check STREAMER_CHECK_ONEVALUEOF |
|
| 338 | + if ($rule === self::STREAMER_CHECK_ONEVALUEOF && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 339 | + if (!in_array($this->{$v[self::STREAMER_VAR]}, $condition)) { |
|
| 340 | + SLog::Write($defaultLogLevel, sprintf("SyncObject->Check(): object from type %s: parameter '%s'->'%s' is not in the range of allowed values.", $objClass, $v[self::STREAMER_VAR], $this->{$v[self::STREAMER_VAR]})); |
|
| 341 | + |
|
| 342 | + return false; |
|
| 343 | + } |
|
| 344 | + }// end STREAMER_CHECK_ONEVALUEOF |
|
| 345 | + |
|
| 346 | + // Check value compared to other value or literal |
|
| 347 | + if ($rule === self::STREAMER_CHECK_CMPHIGHER || $rule === self::STREAMER_CHECK_CMPLOWER) { |
|
| 348 | + if (isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 349 | + $cmp = false; |
|
| 350 | + // directly compare against literals |
|
| 351 | + if (is_int($condition)) { |
|
| 352 | + $cmp = $condition; |
|
| 353 | + } |
|
| 354 | + // check for invalid compare-to |
|
| 355 | + elseif (!isset($this->mapping[$condition])) { |
|
| 356 | + SLog::Write(LOGLEVEL_ERROR, sprintf("SyncObject->Check(): Can not compare parameter '%s' against the other value '%s' as it is not defined object from type %s. Please report this! Check skipped!", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 357 | + |
|
| 358 | + continue; |
|
| 359 | + } |
|
| 360 | + else { |
|
| 361 | + $cmpPar = $this->mapping[$condition][self::STREAMER_VAR]; |
|
| 362 | + if (isset($this->{$cmpPar})) { |
|
| 363 | + $cmp = $this->{$cmpPar}; |
|
| 364 | + } |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + if ($cmp === false) { |
|
| 368 | + SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' can not be compared, as the comparable is not set. Check failed!", $objClass, $v[self::STREAMER_VAR])); |
|
| 369 | + |
|
| 370 | + return false; |
|
| 371 | + } |
|
| 372 | + if ( |
|
| 373 | + ($rule == self::STREAMER_CHECK_CMPHIGHER && $this->{$v[self::STREAMER_VAR]} < $cmp) || |
|
| 374 | + ($rule == self::STREAMER_CHECK_CMPLOWER && $this->{$v[self::STREAMER_VAR]} > $cmp) |
|
| 375 | + ) { |
|
| 376 | + SLog::Write(LOGLEVEL_WARN, sprintf( |
|
| 377 | + "SyncObject->Check(): Unmet condition in object from type %s: parameter '%s' is %s than '%s'. Check failed!", |
|
| 378 | + $objClass, |
|
| 379 | + $v[self::STREAMER_VAR], |
|
| 380 | + (($rule === self::STREAMER_CHECK_CMPHIGHER) ? 'LOWER' : 'HIGHER'), |
|
| 381 | + ((isset($cmpPar) ? $cmpPar : $condition)) |
|
| 382 | + )); |
|
| 383 | + |
|
| 384 | + return false; |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | + } // STREAMER_CHECK_CMP* |
|
| 388 | + |
|
| 389 | + // check STREAMER_CHECK_LENGTHMAX |
|
| 390 | + if ($rule === self::STREAMER_CHECK_LENGTHMAX && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 391 | + if (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 392 | + // implosion takes 2bytes, so we just assume ", " here |
|
| 393 | + $chkstr = implode(", ", $this->{$v[self::STREAMER_VAR]}); |
|
| 394 | + } |
|
| 395 | + else { |
|
| 396 | + $chkstr = $this->{$v[self::STREAMER_VAR]}; |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + if (strlen($chkstr) > $condition) { |
|
| 400 | + SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' is longer than %d. Check failed", $objClass, $v[self::STREAMER_VAR], $condition)); |
|
| 401 | + |
|
| 402 | + return false; |
|
| 403 | + } |
|
| 404 | + }// end STREAMER_CHECK_LENGTHMAX |
|
| 405 | + |
|
| 406 | + // check STREAMER_CHECK_EMAIL |
|
| 407 | + // if $condition is false then the check really fails. Otherwise invalid emails are removed. |
|
| 408 | + // if nothing is left (all emails were false), the parameter is set to condition |
|
| 409 | + if ($rule === self::STREAMER_CHECK_EMAIL && isset($this->{$v[self::STREAMER_VAR]})) { |
|
| 410 | + if ($condition === false && ((is_array($this->{$v[self::STREAMER_VAR]}) && empty($this->{$v[self::STREAMER_VAR]})) || strlen($this->{$v[self::STREAMER_VAR]}) == 0)) { |
|
| 411 | + continue; |
|
| 412 | + } |
|
| 413 | + |
|
| 414 | + $as_array = false; |
|
| 415 | + |
|
| 416 | + if (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 417 | + $mails = $this->{$v[self::STREAMER_VAR]}; |
|
| 418 | + $as_array = true; |
|
| 419 | + } |
|
| 420 | + else { |
|
| 421 | + $mails = [$this->{$v[self::STREAMER_VAR]}]; |
|
| 422 | + } |
|
| 423 | + |
|
| 424 | + $output = []; |
|
| 425 | + foreach ($mails as $mail) { |
|
| 426 | + if (!Utils::CheckEmail($mail)) { |
|
| 427 | + SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' contains an invalid email address '%s'. Address is removed.", $objClass, $v[self::STREAMER_VAR], $mail)); |
|
| 428 | + } |
|
| 429 | + else { |
|
| 430 | + $output[] = $mail; |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | + if (count($mails) != count($output)) { |
|
| 434 | + if ($condition === false) { |
|
| 435 | + return false; |
|
| 436 | + } |
|
| 437 | + |
|
| 438 | + // nothing left, use $condition as new value |
|
| 439 | + if (count($output) == 0) { |
|
| 440 | + $output[] = $condition; |
|
| 441 | + } |
|
| 442 | + |
|
| 443 | + // if we are allowed to rewrite the attribute, we do that |
|
| 444 | + if ($as_array) { |
|
| 445 | + $this->{$v[self::STREAMER_VAR]} = $output; |
|
| 446 | + } |
|
| 447 | + else { |
|
| 448 | + $this->{$v[self::STREAMER_VAR]} = $output[0]; |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + }// end STREAMER_CHECK_EMAIL |
|
| 452 | + } // foreach CHECKS |
|
| 453 | + } // isset CHECKS |
|
| 454 | + } // foreach mapping |
|
| 455 | + |
|
| 456 | + return true; |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * Returns human friendly property name from its value if a mapping is available. |
|
| 461 | + * |
|
| 462 | + * @param array $v |
|
| 463 | + * @param mixed $val |
|
| 464 | + * |
|
| 465 | + * @return mixed |
|
| 466 | + */ |
|
| 467 | + public function GetNameFromPropertyValue($v, $val) { |
|
| 468 | + if (isset($v[self::STREAMER_VALUEMAP][$val])) { |
|
| 469 | + return $v[self::STREAMER_VALUEMAP][$val]; |
|
| 470 | + } |
|
| 471 | + |
|
| 472 | + return $val; |
|
| 473 | + } |
|
| 474 | + |
|
| 475 | + /** |
|
| 476 | + * Called after the SyncObject was unserialized. |
|
| 477 | + * |
|
| 478 | + * @return bool |
|
| 479 | + */ |
|
| 480 | + public function postUnserialize() { |
|
| 481 | + return true; |
|
| 482 | + } |
|
| 483 | 483 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | 164 | public function __toString() { |
| 165 | - $str = get_class($this) . " (\n"; |
|
| 165 | + $str = get_class($this)." (\n"; |
|
| 166 | 166 | |
| 167 | 167 | $streamerVars = []; |
| 168 | 168 | foreach ($this->mapping as $k => $v) { |
@@ -183,16 +183,16 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | // self::STREAMER_ARRAY ? |
| 185 | 185 | if (is_array($v)) { |
| 186 | - $str .= "\t" . $strV . $k . "(Array) size: " . count($v) . "\n"; |
|
| 186 | + $str .= "\t".$strV.$k."(Array) size: ".count($v)."\n"; |
|
| 187 | 187 | foreach ($v as $value) { |
| 188 | - $str .= "\t\t" . Utils::PrintAsString($value) . "\n"; |
|
| 188 | + $str .= "\t\t".Utils::PrintAsString($value)."\n"; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | elseif ($v instanceof SyncObject) { |
| 192 | - $str .= "\t" . $strV . $k . " => " . str_replace("\n", "\n\t\t\t", $v->__toString()) . "\n"; |
|
| 192 | + $str .= "\t".$strV.$k." => ".str_replace("\n", "\n\t\t\t", $v->__toString())."\n"; |
|
| 193 | 193 | } |
| 194 | 194 | else { |
| 195 | - $str .= "\t" . $strV . $k . " => " . (isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null") . "\n"; |
|
| 195 | + $str .= "\t".$strV.$k." => ".(isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null")."\n"; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | $str .= ")"; |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | )) { |
| 54 | 54 | SLog::Write(LOGLEVEL_INFO, sprintf("%s->emptySupported(): no supported list available, emptying all not set parameters", get_class($this))); |
| 55 | 55 | $supportedFields = array_keys($this->mapping); |
| 56 | - } |
|
| 57 | - else { |
|
| 56 | + } else { |
|
| 58 | 57 | return false; |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -118,14 +117,12 @@ discard block |
||
| 118 | 117 | |
| 119 | 118 | return false; |
| 120 | 119 | } |
| 121 | - } |
|
| 122 | - else { |
|
| 120 | + } else { |
|
| 123 | 121 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() array '%s' is set in one but not the other object", $val)); |
| 124 | 122 | |
| 125 | 123 | return false; |
| 126 | 124 | } |
| 127 | - } |
|
| 128 | - else { |
|
| 125 | + } else { |
|
| 129 | 126 | if (isset($this->{$val}, $odo->{$val})) { |
| 130 | 127 | if ($strictTypeCompare) { |
| 131 | 128 | if ($this->{$val} !== $odo->{$val}) { |
@@ -133,19 +130,16 @@ discard block |
||
| 133 | 130 | |
| 134 | 131 | return false; |
| 135 | 132 | } |
| 136 | - } |
|
| 137 | - else { |
|
| 133 | + } else { |
|
| 138 | 134 | if ($this->{$val} != $odo->{$val}) { |
| 139 | 135 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false on field '%s': '%s' != '%s'", $val, Utils::PrintAsString($this->{$val}), Utils::PrintAsString($odo->{$val}))); |
| 140 | 136 | |
| 141 | 137 | return false; |
| 142 | 138 | } |
| 143 | 139 | } |
| 144 | - } |
|
| 145 | - elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 140 | + } elseif (!isset($this->{$val}) && !isset($odo->{$val})) { |
|
| 146 | 141 | continue; |
| 147 | - } |
|
| 148 | - else { |
|
| 142 | + } else { |
|
| 149 | 143 | SLog::Write(LOGLEVEL_DEBUG, sprintf("SyncObject->equals() false because field '%s' is only defined at one obj: '%s' != '%s'", $val, Utils::PrintAsString(isset($this->{$val})), Utils::PrintAsString(isset($odo->{$val})))); |
| 150 | 144 | |
| 151 | 145 | return false; |
@@ -176,8 +170,7 @@ discard block |
||
| 176 | 170 | |
| 177 | 171 | if (array_key_exists($k, $streamerVars)) { |
| 178 | 172 | $strV = "(S) "; |
| 179 | - } |
|
| 180 | - else { |
|
| 173 | + } else { |
|
| 181 | 174 | $strV = ""; |
| 182 | 175 | } |
| 183 | 176 | |
@@ -187,11 +180,9 @@ discard block |
||
| 187 | 180 | foreach ($v as $value) { |
| 188 | 181 | $str .= "\t\t" . Utils::PrintAsString($value) . "\n"; |
| 189 | 182 | } |
| 190 | - } |
|
| 191 | - elseif ($v instanceof SyncObject) { |
|
| 183 | + } elseif ($v instanceof SyncObject) { |
|
| 192 | 184 | $str .= "\t" . $strV . $k . " => " . str_replace("\n", "\n\t\t\t", $v->__toString()) . "\n"; |
| 193 | - } |
|
| 194 | - else { |
|
| 185 | + } else { |
|
| 195 | 186 | $str .= "\t" . $strV . $k . " => " . (isset($this->{$k}) ? Utils::PrintAsString($this->{$k}) : "null") . "\n"; |
| 196 | 187 | } |
| 197 | 188 | } |
@@ -275,8 +266,7 @@ discard block |
||
| 275 | 266 | if (!$this->{$v[self::STREAMER_VAR]}->Check($logAsDebug)) { |
| 276 | 267 | return false; |
| 277 | 268 | } |
| 278 | - } |
|
| 279 | - elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 269 | + } elseif (is_array($this->{$v[self::STREAMER_VAR]})) { |
|
| 280 | 270 | foreach ($this->{$v[self::STREAMER_VAR]} as $subobj) { |
| 281 | 271 | if ($subobj instanceof SyncObject && !$subobj->Check($logAsDebug)) { |
| 282 | 272 | return false; |
@@ -356,8 +346,7 @@ discard block |
||
| 356 | 346 | SLog::Write(LOGLEVEL_ERROR, sprintf("SyncObject->Check(): Can not compare parameter '%s' against the other value '%s' as it is not defined object from type %s. Please report this! Check skipped!", $objClass, $v[self::STREAMER_VAR], $condition)); |
| 357 | 347 | |
| 358 | 348 | continue; |
| 359 | - } |
|
| 360 | - else { |
|
| 349 | + } else { |
|
| 361 | 350 | $cmpPar = $this->mapping[$condition][self::STREAMER_VAR]; |
| 362 | 351 | if (isset($this->{$cmpPar})) { |
| 363 | 352 | $cmp = $this->{$cmpPar}; |
@@ -391,8 +380,7 @@ discard block |
||
| 391 | 380 | if (is_array($this->{$v[self::STREAMER_VAR]})) { |
| 392 | 381 | // implosion takes 2bytes, so we just assume ", " here |
| 393 | 382 | $chkstr = implode(", ", $this->{$v[self::STREAMER_VAR]}); |
| 394 | - } |
|
| 395 | - else { |
|
| 383 | + } else { |
|
| 396 | 384 | $chkstr = $this->{$v[self::STREAMER_VAR]}; |
| 397 | 385 | } |
| 398 | 386 | |
@@ -416,8 +404,7 @@ discard block |
||
| 416 | 404 | if (is_array($this->{$v[self::STREAMER_VAR]})) { |
| 417 | 405 | $mails = $this->{$v[self::STREAMER_VAR]}; |
| 418 | 406 | $as_array = true; |
| 419 | - } |
|
| 420 | - else { |
|
| 407 | + } else { |
|
| 421 | 408 | $mails = [$this->{$v[self::STREAMER_VAR]}]; |
| 422 | 409 | } |
| 423 | 410 | |
@@ -425,8 +412,7 @@ discard block |
||
| 425 | 412 | foreach ($mails as $mail) { |
| 426 | 413 | if (!Utils::CheckEmail($mail)) { |
| 427 | 414 | SLog::Write(LOGLEVEL_WARN, sprintf("SyncObject->Check(): object from type %s: parameter '%s' contains an invalid email address '%s'. Address is removed.", $objClass, $v[self::STREAMER_VAR], $mail)); |
| 428 | - } |
|
| 429 | - else { |
|
| 415 | + } else { |
|
| 430 | 416 | $output[] = $mail; |
| 431 | 417 | } |
| 432 | 418 | } |
@@ -443,8 +429,7 @@ discard block |
||
| 443 | 429 | // if we are allowed to rewrite the attribute, we do that |
| 444 | 430 | if ($as_array) { |
| 445 | 431 | $this->{$v[self::STREAMER_VAR]} = $output; |
| 446 | - } |
|
| 447 | - else { |
|
| 432 | + } else { |
|
| 448 | 433 | $this->{$v[self::STREAMER_VAR]} = $output[0]; |
| 449 | 434 | } |
| 450 | 435 | } |
@@ -10,24 +10,24 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncAccount extends SyncObject { |
| 13 | - public $accountid; |
|
| 14 | - public $accountname; |
|
| 15 | - public $userdisplayname; |
|
| 16 | - public $senddisabled; |
|
| 17 | - public $emailaddresses; |
|
| 13 | + public $accountid; |
|
| 14 | + public $accountname; |
|
| 15 | + public $userdisplayname; |
|
| 16 | + public $senddisabled; |
|
| 17 | + public $emailaddresses; |
|
| 18 | 18 | |
| 19 | - public function __construct() { |
|
| 20 | - $mapping = [ |
|
| 21 | - SYNC_SETTINGS_ACCOUNTID => [self::STREAMER_VAR => "accountid"], |
|
| 22 | - SYNC_SETTINGS_ACCOUNTNAME => [self::STREAMER_VAR => "accountname"], |
|
| 23 | - SYNC_SETTINGS_USERDISPLAYNAME => [self::STREAMER_VAR => "userdisplayname"], |
|
| 24 | - SYNC_SETTINGS_SENDDISABLED => [self::STREAMER_VAR => "senddisabled"], |
|
| 25 | - SYNC_SETTINGS_EMAILADDRESSES => [ |
|
| 26 | - self::STREAMER_VAR => "emailaddresses", |
|
| 27 | - self::STREAMER_TYPE => "SyncEmailAddresses", |
|
| 28 | - ], |
|
| 29 | - ]; |
|
| 19 | + public function __construct() { |
|
| 20 | + $mapping = [ |
|
| 21 | + SYNC_SETTINGS_ACCOUNTID => [self::STREAMER_VAR => "accountid"], |
|
| 22 | + SYNC_SETTINGS_ACCOUNTNAME => [self::STREAMER_VAR => "accountname"], |
|
| 23 | + SYNC_SETTINGS_USERDISPLAYNAME => [self::STREAMER_VAR => "userdisplayname"], |
|
| 24 | + SYNC_SETTINGS_SENDDISABLED => [self::STREAMER_VAR => "senddisabled"], |
|
| 25 | + SYNC_SETTINGS_EMAILADDRESSES => [ |
|
| 26 | + self::STREAMER_VAR => "emailaddresses", |
|
| 27 | + self::STREAMER_TYPE => "SyncEmailAddresses", |
|
| 28 | + ], |
|
| 29 | + ]; |
|
| 30 | 30 | |
| 31 | - parent::__construct($mapping); |
|
| 32 | - } |
|
| 31 | + parent::__construct($mapping); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -10,18 +10,18 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncItemOperationsAttachment extends SyncObject { |
| 13 | - public $contenttype; |
|
| 14 | - public $data; |
|
| 13 | + public $contenttype; |
|
| 14 | + public $data; |
|
| 15 | 15 | |
| 16 | - public function __construct() { |
|
| 17 | - $mapping = [ |
|
| 18 | - SYNC_AIRSYNCBASE_CONTENTTYPE => [self::STREAMER_VAR => "contenttype"], |
|
| 19 | - SYNC_ITEMOPERATIONS_DATA => [ |
|
| 20 | - self::STREAMER_VAR => "data", |
|
| 21 | - self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASBASE64, |
|
| 22 | - self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART, ], |
|
| 23 | - ]; |
|
| 16 | + public function __construct() { |
|
| 17 | + $mapping = [ |
|
| 18 | + SYNC_AIRSYNCBASE_CONTENTTYPE => [self::STREAMER_VAR => "contenttype"], |
|
| 19 | + SYNC_ITEMOPERATIONS_DATA => [ |
|
| 20 | + self::STREAMER_VAR => "data", |
|
| 21 | + self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASBASE64, |
|
| 22 | + self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART, ], |
|
| 23 | + ]; |
|
| 24 | 24 | |
| 25 | - parent::__construct($mapping); |
|
| 26 | - } |
|
| 25 | + parent::__construct($mapping); |
|
| 26 | + } |
|
| 27 | 27 | } |
@@ -10,211 +10,211 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | class SyncMail extends SyncObject { |
| 13 | - public $to; |
|
| 14 | - public $cc; |
|
| 15 | - public $from; |
|
| 16 | - public $subject; |
|
| 17 | - public $threadtopic; |
|
| 18 | - public $datereceived; |
|
| 19 | - public $displayto; |
|
| 20 | - public $importance; |
|
| 21 | - public $read; |
|
| 22 | - public $attachments; |
|
| 23 | - public $mimetruncated; |
|
| 24 | - public $mimedata; |
|
| 25 | - public $mimesize; |
|
| 26 | - public $bodytruncated; |
|
| 27 | - public $bodysize; |
|
| 28 | - public $body; |
|
| 29 | - public $messageclass; |
|
| 30 | - public $meetingrequest; |
|
| 31 | - public $reply_to; |
|
| 13 | + public $to; |
|
| 14 | + public $cc; |
|
| 15 | + public $from; |
|
| 16 | + public $subject; |
|
| 17 | + public $threadtopic; |
|
| 18 | + public $datereceived; |
|
| 19 | + public $displayto; |
|
| 20 | + public $importance; |
|
| 21 | + public $read; |
|
| 22 | + public $attachments; |
|
| 23 | + public $mimetruncated; |
|
| 24 | + public $mimedata; |
|
| 25 | + public $mimesize; |
|
| 26 | + public $bodytruncated; |
|
| 27 | + public $bodysize; |
|
| 28 | + public $body; |
|
| 29 | + public $messageclass; |
|
| 30 | + public $meetingrequest; |
|
| 31 | + public $reply_to; |
|
| 32 | 32 | |
| 33 | - // AS 2.5 prop |
|
| 34 | - public $internetcpid; |
|
| 33 | + // AS 2.5 prop |
|
| 34 | + public $internetcpid; |
|
| 35 | 35 | |
| 36 | - // AS 12.0 props |
|
| 37 | - public $asbody; |
|
| 38 | - public $asattachments; |
|
| 39 | - public $flag; |
|
| 40 | - public $contentclass; |
|
| 41 | - public $nativebodytype; |
|
| 36 | + // AS 12.0 props |
|
| 37 | + public $asbody; |
|
| 38 | + public $asattachments; |
|
| 39 | + public $flag; |
|
| 40 | + public $contentclass; |
|
| 41 | + public $nativebodytype; |
|
| 42 | 42 | |
| 43 | - // AS 14.0 props |
|
| 44 | - public $umcallerid; |
|
| 45 | - public $umusernotes; |
|
| 46 | - public $conversationid; |
|
| 47 | - public $conversationindex; |
|
| 48 | - public $lastverbexecuted; // possible values unknown, reply to sender, reply to all, forward |
|
| 49 | - public $lastverbexectime; |
|
| 50 | - public $receivedasbcc; |
|
| 51 | - public $sender; |
|
| 52 | - public $categories; |
|
| 43 | + // AS 14.0 props |
|
| 44 | + public $umcallerid; |
|
| 45 | + public $umusernotes; |
|
| 46 | + public $conversationid; |
|
| 47 | + public $conversationindex; |
|
| 48 | + public $lastverbexecuted; // possible values unknown, reply to sender, reply to all, forward |
|
| 49 | + public $lastverbexectime; |
|
| 50 | + public $receivedasbcc; |
|
| 51 | + public $sender; |
|
| 52 | + public $categories; |
|
| 53 | 53 | |
| 54 | - // AS 14.1 props |
|
| 55 | - public $rightsManagementLicense; |
|
| 56 | - public $asbodypart; |
|
| 54 | + // AS 14.1 props |
|
| 55 | + public $rightsManagementLicense; |
|
| 56 | + public $asbodypart; |
|
| 57 | 57 | |
| 58 | - public function __construct() { |
|
| 59 | - $mapping = [ |
|
| 60 | - SYNC_POOMMAIL_TO => [ |
|
| 61 | - self::STREAMER_VAR => "to", |
|
| 62 | - self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
|
| 63 | - self::STREAMER_CHECKS => [ |
|
| 64 | - self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 65 | - self::STREAMER_CHECK_EMAIL => "", |
|
| 66 | - ], |
|
| 67 | - ], |
|
| 68 | - SYNC_POOMMAIL_CC => [ |
|
| 69 | - self::STREAMER_VAR => "cc", |
|
| 70 | - self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
|
| 71 | - self::STREAMER_CHECKS => [ |
|
| 72 | - self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 73 | - self::STREAMER_CHECK_EMAIL => "", |
|
| 74 | - ], |
|
| 75 | - ], |
|
| 76 | - SYNC_POOMMAIL_FROM => [ |
|
| 77 | - self::STREAMER_VAR => "from", |
|
| 78 | - self::STREAMER_CHECKS => [ |
|
| 79 | - self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 80 | - self::STREAMER_CHECK_EMAIL => "", |
|
| 81 | - ], |
|
| 82 | - self::STREAMER_RONOTIFY => true, |
|
| 83 | - ], |
|
| 84 | - SYNC_POOMMAIL_SUBJECT => [ |
|
| 85 | - self::STREAMER_VAR => "subject", |
|
| 86 | - self::STREAMER_RONOTIFY => true, |
|
| 87 | - ], |
|
| 88 | - SYNC_POOMMAIL_THREADTOPIC => [ |
|
| 89 | - self::STREAMER_VAR => "threadtopic", |
|
| 90 | - self::STREAMER_RONOTIFY => true, |
|
| 91 | - ], |
|
| 92 | - SYNC_POOMMAIL_DATERECEIVED => [ |
|
| 93 | - self::STREAMER_VAR => "datereceived", |
|
| 94 | - self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
|
| 95 | - self::STREAMER_RONOTIFY => true, |
|
| 96 | - ], |
|
| 97 | - SYNC_POOMMAIL_DISPLAYTO => [self::STREAMER_VAR => "displayto"], |
|
| 98 | - // Importance values |
|
| 99 | - // 0 = Low |
|
| 100 | - // 1 = Normal |
|
| 101 | - // 2 = High |
|
| 102 | - // even the default value 1 is optional, the native android client 2.2 interprets a non-existing value as 0 (low) |
|
| 103 | - SYNC_POOMMAIL_IMPORTANCE => [ |
|
| 104 | - self::STREAMER_VAR => "importance", |
|
| 105 | - self::STREAMER_CHECKS => [ |
|
| 106 | - self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETONE, |
|
| 107 | - self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2], |
|
| 108 | - ], |
|
| 109 | - ], |
|
| 110 | - SYNC_POOMMAIL_READ => [self::STREAMER_VAR => "read", |
|
| 111 | - self::STREAMER_CHECKS => [ |
|
| 112 | - self::STREAMER_CHECK_ONEVALUEOF => [0, 1], ], |
|
| 113 | - self::STREAMER_RONOTIFY => true, |
|
| 114 | - self::STREAMER_VALUEMAP => [ |
|
| 115 | - 0 => "No", |
|
| 116 | - 1 => "Yes", |
|
| 117 | - ], |
|
| 118 | - ], |
|
| 119 | - SYNC_POOMMAIL_ATTACHMENTS => [ |
|
| 120 | - self::STREAMER_VAR => "attachments", |
|
| 121 | - self::STREAMER_TYPE => "SyncAttachment", |
|
| 122 | - self::STREAMER_ARRAY => SYNC_POOMMAIL_ATTACHMENT, |
|
| 123 | - ], |
|
| 124 | - SYNC_POOMMAIL_MIMETRUNCATED => [ |
|
| 125 | - self::STREAMER_VAR => "mimetruncated", |
|
| 126 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO], |
|
| 127 | - ], |
|
| 128 | - SYNC_POOMMAIL_MIMEDATA => [ |
|
| 129 | - self::STREAMER_VAR => "mimedata", |
|
| 130 | - self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN, |
|
| 131 | - ], |
|
| 132 | - SYNC_POOMMAIL_MIMESIZE => [ |
|
| 133 | - self::STREAMER_VAR => "mimesize", |
|
| 134 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 135 | - ], |
|
| 136 | - SYNC_POOMMAIL_BODYTRUNCATED => [ |
|
| 137 | - self::STREAMER_VAR => "bodytruncated", |
|
| 138 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO], |
|
| 139 | - ], |
|
| 140 | - SYNC_POOMMAIL_BODYSIZE => [ |
|
| 141 | - self::STREAMER_VAR => "bodysize", |
|
| 142 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 143 | - ], |
|
| 144 | - SYNC_POOMMAIL_BODY => [self::STREAMER_VAR => "body"], |
|
| 145 | - SYNC_POOMMAIL_MESSAGECLASS => [self::STREAMER_VAR => "messageclass"], |
|
| 146 | - SYNC_POOMMAIL_MEETINGREQUEST => [ |
|
| 147 | - self::STREAMER_VAR => "meetingrequest", |
|
| 148 | - self::STREAMER_TYPE => "SyncMeetingRequest", |
|
| 149 | - ], |
|
| 150 | - SYNC_POOMMAIL_REPLY_TO => [ |
|
| 151 | - self::STREAMER_VAR => "reply_to", |
|
| 152 | - self::STREAMER_TYPE => self::STREAMER_TYPE_SEMICOLON_SEPARATED, |
|
| 153 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_EMAIL => ""], |
|
| 154 | - ], |
|
| 155 | - ]; |
|
| 58 | + public function __construct() { |
|
| 59 | + $mapping = [ |
|
| 60 | + SYNC_POOMMAIL_TO => [ |
|
| 61 | + self::STREAMER_VAR => "to", |
|
| 62 | + self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
|
| 63 | + self::STREAMER_CHECKS => [ |
|
| 64 | + self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 65 | + self::STREAMER_CHECK_EMAIL => "", |
|
| 66 | + ], |
|
| 67 | + ], |
|
| 68 | + SYNC_POOMMAIL_CC => [ |
|
| 69 | + self::STREAMER_VAR => "cc", |
|
| 70 | + self::STREAMER_TYPE => self::STREAMER_TYPE_COMMA_SEPARATED, |
|
| 71 | + self::STREAMER_CHECKS => [ |
|
| 72 | + self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 73 | + self::STREAMER_CHECK_EMAIL => "", |
|
| 74 | + ], |
|
| 75 | + ], |
|
| 76 | + SYNC_POOMMAIL_FROM => [ |
|
| 77 | + self::STREAMER_VAR => "from", |
|
| 78 | + self::STREAMER_CHECKS => [ |
|
| 79 | + self::STREAMER_CHECK_LENGTHMAX => 32768, |
|
| 80 | + self::STREAMER_CHECK_EMAIL => "", |
|
| 81 | + ], |
|
| 82 | + self::STREAMER_RONOTIFY => true, |
|
| 83 | + ], |
|
| 84 | + SYNC_POOMMAIL_SUBJECT => [ |
|
| 85 | + self::STREAMER_VAR => "subject", |
|
| 86 | + self::STREAMER_RONOTIFY => true, |
|
| 87 | + ], |
|
| 88 | + SYNC_POOMMAIL_THREADTOPIC => [ |
|
| 89 | + self::STREAMER_VAR => "threadtopic", |
|
| 90 | + self::STREAMER_RONOTIFY => true, |
|
| 91 | + ], |
|
| 92 | + SYNC_POOMMAIL_DATERECEIVED => [ |
|
| 93 | + self::STREAMER_VAR => "datereceived", |
|
| 94 | + self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
|
| 95 | + self::STREAMER_RONOTIFY => true, |
|
| 96 | + ], |
|
| 97 | + SYNC_POOMMAIL_DISPLAYTO => [self::STREAMER_VAR => "displayto"], |
|
| 98 | + // Importance values |
|
| 99 | + // 0 = Low |
|
| 100 | + // 1 = Normal |
|
| 101 | + // 2 = High |
|
| 102 | + // even the default value 1 is optional, the native android client 2.2 interprets a non-existing value as 0 (low) |
|
| 103 | + SYNC_POOMMAIL_IMPORTANCE => [ |
|
| 104 | + self::STREAMER_VAR => "importance", |
|
| 105 | + self::STREAMER_CHECKS => [ |
|
| 106 | + self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETONE, |
|
| 107 | + self::STREAMER_CHECK_ONEVALUEOF => [0, 1, 2], |
|
| 108 | + ], |
|
| 109 | + ], |
|
| 110 | + SYNC_POOMMAIL_READ => [self::STREAMER_VAR => "read", |
|
| 111 | + self::STREAMER_CHECKS => [ |
|
| 112 | + self::STREAMER_CHECK_ONEVALUEOF => [0, 1], ], |
|
| 113 | + self::STREAMER_RONOTIFY => true, |
|
| 114 | + self::STREAMER_VALUEMAP => [ |
|
| 115 | + 0 => "No", |
|
| 116 | + 1 => "Yes", |
|
| 117 | + ], |
|
| 118 | + ], |
|
| 119 | + SYNC_POOMMAIL_ATTACHMENTS => [ |
|
| 120 | + self::STREAMER_VAR => "attachments", |
|
| 121 | + self::STREAMER_TYPE => "SyncAttachment", |
|
| 122 | + self::STREAMER_ARRAY => SYNC_POOMMAIL_ATTACHMENT, |
|
| 123 | + ], |
|
| 124 | + SYNC_POOMMAIL_MIMETRUNCATED => [ |
|
| 125 | + self::STREAMER_VAR => "mimetruncated", |
|
| 126 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO], |
|
| 127 | + ], |
|
| 128 | + SYNC_POOMMAIL_MIMEDATA => [ |
|
| 129 | + self::STREAMER_VAR => "mimedata", |
|
| 130 | + self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN, |
|
| 131 | + ], |
|
| 132 | + SYNC_POOMMAIL_MIMESIZE => [ |
|
| 133 | + self::STREAMER_VAR => "mimesize", |
|
| 134 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 135 | + ], |
|
| 136 | + SYNC_POOMMAIL_BODYTRUNCATED => [ |
|
| 137 | + self::STREAMER_VAR => "bodytruncated", |
|
| 138 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ZEROORONE => self::STREAMER_CHECK_SETZERO], |
|
| 139 | + ], |
|
| 140 | + SYNC_POOMMAIL_BODYSIZE => [ |
|
| 141 | + self::STREAMER_VAR => "bodysize", |
|
| 142 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_CMPHIGHER => -1], |
|
| 143 | + ], |
|
| 144 | + SYNC_POOMMAIL_BODY => [self::STREAMER_VAR => "body"], |
|
| 145 | + SYNC_POOMMAIL_MESSAGECLASS => [self::STREAMER_VAR => "messageclass"], |
|
| 146 | + SYNC_POOMMAIL_MEETINGREQUEST => [ |
|
| 147 | + self::STREAMER_VAR => "meetingrequest", |
|
| 148 | + self::STREAMER_TYPE => "SyncMeetingRequest", |
|
| 149 | + ], |
|
| 150 | + SYNC_POOMMAIL_REPLY_TO => [ |
|
| 151 | + self::STREAMER_VAR => "reply_to", |
|
| 152 | + self::STREAMER_TYPE => self::STREAMER_TYPE_SEMICOLON_SEPARATED, |
|
| 153 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_EMAIL => ""], |
|
| 154 | + ], |
|
| 155 | + ]; |
|
| 156 | 156 | |
| 157 | - if (Request::GetProtocolVersion() >= 2.5) { |
|
| 158 | - $mapping[SYNC_POOMMAIL_INTERNETCPID] = [self::STREAMER_VAR => "internetcpid"]; |
|
| 159 | - } |
|
| 157 | + if (Request::GetProtocolVersion() >= 2.5) { |
|
| 158 | + $mapping[SYNC_POOMMAIL_INTERNETCPID] = [self::STREAMER_VAR => "internetcpid"]; |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - if (Request::GetProtocolVersion() >= 12.0) { |
|
| 162 | - $mapping[SYNC_AIRSYNCBASE_BODY] = [ |
|
| 163 | - self::STREAMER_VAR => "asbody", |
|
| 164 | - self::STREAMER_TYPE => "SyncBaseBody", |
|
| 165 | - ]; |
|
| 166 | - $mapping[SYNC_AIRSYNCBASE_ATTACHMENTS] = [ |
|
| 167 | - self::STREAMER_VAR => "asattachments", |
|
| 168 | - self::STREAMER_TYPE => "SyncBaseAttachment", |
|
| 169 | - self::STREAMER_ARRAY => SYNC_AIRSYNCBASE_ATTACHMENT, |
|
| 170 | - ]; |
|
| 171 | - $mapping[SYNC_POOMMAIL_CONTENTCLASS] = [ |
|
| 172 | - self::STREAMER_VAR => "contentclass", |
|
| 173 | - self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [DEFAULT_EMAIL_CONTENTCLASS, DEFAULT_CALENDAR_CONTENTCLASS]], |
|
| 174 | - ]; |
|
| 175 | - $mapping[SYNC_POOMMAIL_FLAG] = [ |
|
| 176 | - self::STREAMER_VAR => "flag", |
|
| 177 | - self::STREAMER_TYPE => "SyncMailFlags", |
|
| 178 | - self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 179 | - self::STREAMER_RONOTIFY => true, |
|
| 180 | - ]; |
|
| 181 | - $mapping[SYNC_AIRSYNCBASE_NATIVEBODYTYPE] = [self::STREAMER_VAR => "nativebodytype"]; |
|
| 161 | + if (Request::GetProtocolVersion() >= 12.0) { |
|
| 162 | + $mapping[SYNC_AIRSYNCBASE_BODY] = [ |
|
| 163 | + self::STREAMER_VAR => "asbody", |
|
| 164 | + self::STREAMER_TYPE => "SyncBaseBody", |
|
| 165 | + ]; |
|
| 166 | + $mapping[SYNC_AIRSYNCBASE_ATTACHMENTS] = [ |
|
| 167 | + self::STREAMER_VAR => "asattachments", |
|
| 168 | + self::STREAMER_TYPE => "SyncBaseAttachment", |
|
| 169 | + self::STREAMER_ARRAY => SYNC_AIRSYNCBASE_ATTACHMENT, |
|
| 170 | + ]; |
|
| 171 | + $mapping[SYNC_POOMMAIL_CONTENTCLASS] = [ |
|
| 172 | + self::STREAMER_VAR => "contentclass", |
|
| 173 | + self::STREAMER_CHECKS => [self::STREAMER_CHECK_ONEVALUEOF => [DEFAULT_EMAIL_CONTENTCLASS, DEFAULT_CALENDAR_CONTENTCLASS]], |
|
| 174 | + ]; |
|
| 175 | + $mapping[SYNC_POOMMAIL_FLAG] = [ |
|
| 176 | + self::STREAMER_VAR => "flag", |
|
| 177 | + self::STREAMER_TYPE => "SyncMailFlags", |
|
| 178 | + self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
|
| 179 | + self::STREAMER_RONOTIFY => true, |
|
| 180 | + ]; |
|
| 181 | + $mapping[SYNC_AIRSYNCBASE_NATIVEBODYTYPE] = [self::STREAMER_VAR => "nativebodytype"]; |
|
| 182 | 182 | |
| 183 | - // unset these properties because airsyncbase body and attachments will be used instead |
|
| 184 | - unset($mapping[SYNC_POOMMAIL_BODY], $mapping[SYNC_POOMMAIL_BODYTRUNCATED], $mapping[SYNC_POOMMAIL_ATTACHMENTS]); |
|
| 185 | - } |
|
| 183 | + // unset these properties because airsyncbase body and attachments will be used instead |
|
| 184 | + unset($mapping[SYNC_POOMMAIL_BODY], $mapping[SYNC_POOMMAIL_BODYTRUNCATED], $mapping[SYNC_POOMMAIL_ATTACHMENTS]); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - if (Request::GetProtocolVersion() >= 14.0) { |
|
| 188 | - $mapping[SYNC_POOMMAIL2_UMCALLERID] = [self::STREAMER_VAR => "umcallerid"]; |
|
| 189 | - $mapping[SYNC_POOMMAIL2_UMUSERNOTES] = [self::STREAMER_VAR => "umusernotes"]; |
|
| 190 | - $mapping[SYNC_POOMMAIL2_CONVERSATIONID] = [self::STREAMER_VAR => "conversationid"]; |
|
| 191 | - $mapping[SYNC_POOMMAIL2_CONVERSATIONINDEX] = [self::STREAMER_VAR => "conversationindex"]; |
|
| 192 | - $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTED] = [self::STREAMER_VAR => "lastverbexecuted"]; |
|
| 193 | - $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTIONTIME] = [ |
|
| 194 | - self::STREAMER_VAR => "lastverbexectime", |
|
| 195 | - self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
|
| 196 | - ]; |
|
| 197 | - $mapping[SYNC_POOMMAIL2_RECEIVEDASBCC] = [self::STREAMER_VAR => "receivedasbcc"]; |
|
| 198 | - $mapping[SYNC_POOMMAIL2_SENDER] = [self::STREAMER_VAR => "sender"]; |
|
| 199 | - $mapping[SYNC_POOMMAIL_CATEGORIES] = [ |
|
| 200 | - self::STREAMER_VAR => "categories", |
|
| 201 | - self::STREAMER_ARRAY => SYNC_POOMMAIL_CATEGORY, |
|
| 202 | - self::STREAMER_RONOTIFY => true, |
|
| 203 | - ]; |
|
| 204 | - // TODO bodypart, accountid |
|
| 205 | - } |
|
| 187 | + if (Request::GetProtocolVersion() >= 14.0) { |
|
| 188 | + $mapping[SYNC_POOMMAIL2_UMCALLERID] = [self::STREAMER_VAR => "umcallerid"]; |
|
| 189 | + $mapping[SYNC_POOMMAIL2_UMUSERNOTES] = [self::STREAMER_VAR => "umusernotes"]; |
|
| 190 | + $mapping[SYNC_POOMMAIL2_CONVERSATIONID] = [self::STREAMER_VAR => "conversationid"]; |
|
| 191 | + $mapping[SYNC_POOMMAIL2_CONVERSATIONINDEX] = [self::STREAMER_VAR => "conversationindex"]; |
|
| 192 | + $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTED] = [self::STREAMER_VAR => "lastverbexecuted"]; |
|
| 193 | + $mapping[SYNC_POOMMAIL2_LASTVERBEXECUTIONTIME] = [ |
|
| 194 | + self::STREAMER_VAR => "lastverbexectime", |
|
| 195 | + self::STREAMER_TYPE => self::STREAMER_TYPE_DATE_DASHES, |
|
| 196 | + ]; |
|
| 197 | + $mapping[SYNC_POOMMAIL2_RECEIVEDASBCC] = [self::STREAMER_VAR => "receivedasbcc"]; |
|
| 198 | + $mapping[SYNC_POOMMAIL2_SENDER] = [self::STREAMER_VAR => "sender"]; |
|
| 199 | + $mapping[SYNC_POOMMAIL_CATEGORIES] = [ |
|
| 200 | + self::STREAMER_VAR => "categories", |
|
| 201 | + self::STREAMER_ARRAY => SYNC_POOMMAIL_CATEGORY, |
|
| 202 | + self::STREAMER_RONOTIFY => true, |
|
| 203 | + ]; |
|
| 204 | + // TODO bodypart, accountid |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - if (Request::GetProtocolVersion() >= 14.1) { |
|
| 208 | - $mapping[SYNC_RIGHTSMANAGEMENT_LICENSE] = [ |
|
| 209 | - self::STREAMER_VAR => "rightsManagementLicense", |
|
| 210 | - self::STREAMER_TYPE => "SyncRightsManagementLicense", |
|
| 211 | - ]; |
|
| 212 | - $mapping[SYNC_AIRSYNCBASE_BODYPART] = [ |
|
| 213 | - self::STREAMER_VAR => "asbodypart", |
|
| 214 | - self::STREAMER_TYPE => "SyncBaseBodyPart", |
|
| 215 | - ]; |
|
| 216 | - } |
|
| 207 | + if (Request::GetProtocolVersion() >= 14.1) { |
|
| 208 | + $mapping[SYNC_RIGHTSMANAGEMENT_LICENSE] = [ |
|
| 209 | + self::STREAMER_VAR => "rightsManagementLicense", |
|
| 210 | + self::STREAMER_TYPE => "SyncRightsManagementLicense", |
|
| 211 | + ]; |
|
| 212 | + $mapping[SYNC_AIRSYNCBASE_BODYPART] = [ |
|
| 213 | + self::STREAMER_VAR => "asbodypart", |
|
| 214 | + self::STREAMER_TYPE => "SyncBaseBodyPart", |
|
| 215 | + ]; |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | - parent::__construct($mapping); |
|
| 219 | - } |
|
| 218 | + parent::__construct($mapping); |
|
| 219 | + } |
|
| 220 | 220 | } |