/usr/share/php/Horde/ActiveSync/Request/SyncBase.php is in php-horde-activesync 2.19.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | <?php
/**
* Horde_ActiveSync_Request_SyncBase::
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
* Version 2, the distribution of the Horde_ActiveSync module in or
* to the United States of America is excluded from the scope of this
* license.
* @copyright 2010-2014 Horde LLC (http://www.horde.org)
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
*/
/**
* Base class for handling ActiveSync Sync-type requests.
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
* Version 2, the distribution of the Horde_ActiveSync module in or
* to the United States of America is excluded from the scope of this
* license.
* @copyright 2010-2014 Horde LLC (http://www.horde.org)
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
* @internal
*/
abstract class Horde_ActiveSync_Request_SyncBase extends Horde_ActiveSync_Request_Base
{
/**
* Parse incoming BODYPARTPREFERENCE options.
*
* @param array $collection An array structure to parse the data into.
*/
protected function _bodyPartPrefs(&$collection)
{
$collection['bodypartprefs'] = array();
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_TYPE)) {
$collection['bodypartprefs']['type'] = $this->_decoder->getElementContent();
// MS-ASAIRS 2.2.2.22.3 type MUST be BODYPREF_TYPE_HTML
if (!$this->_decoder->getElementEndTag() ||
$collection['bodypartprefs']['type'] != Horde_ActiveSync::BODYPREF_TYPE_HTML) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_TRUNCATIONSIZE)) {
$collection['bodypartprefs']['truncationsize'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_ALLORNONE)) {
$collection['bodypartprefs']['allornone'] = $this->_decoder->getElementContent();
// MS-ASAIRS 2.2.2.1.1 - MUST be ignored if no trunction
// size is set. Note we still must read it if it sent
// so reading the wbxml stream does not break.
if (empty($collection['bodypartprefs']['truncationsize'])) {
unset($collection['bodypartprefs']['allornone']);
}
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_PREVIEW)) {
$collection['bodypartprefs']['preview'] = $this->_decoder->getElementContent();
// MS-ASAIRS 2.2.2.18.3 - Max size of preview is 255.
if (!$this->_decoder->getElementEndTag() ||
$collection['bodypartprefs']['preview'] > 255) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
/**
* Parse incoming BODYPREFERENCE options.
*
* @param array An array structure to parse the values into.
*/
protected function _bodyPrefs(&$collection)
{
$body_pref = array();
if (empty($collection['bodyprefs'])) {
$collection['bodyprefs'] = array();
}
while (1) {
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_TYPE)) {
$body_pref['type'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_TRUNCATIONSIZE)) {
$body_pref['truncationsize'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_ALLORNONE)) {
$body_pref['allornone'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
if ($this->_decoder->getElementStartTag(Horde_ActiveSync::AIRSYNCBASE_PREVIEW)) {
$body_pref['preview'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
$e = $this->_decoder->peek();
if ($e[Horde_ActiveSync_Wbxml::EN_TYPE] == Horde_ActiveSync_Wbxml::EN_TYPE_ENDTAG) {
$this->_decoder->getElementEndTag();
$collection['bodyprefs'][$body_pref['type']] = $body_pref;
break;
}
}
}
protected function _rightsManagement(&$collection)
{
$collection['rightsmanagement'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
protected function _mimeSupport(&$collection)
{
$collection['mimesupport'] = $this->_decoder->getElementContent();
if (!$this->_decoder->getElementEndTag()) {
$this->_statusCode = self::STATUS_PROTERROR;
$this->_handleError($collection);
exit;
}
}
}
|