/usr/share/z-push/lib/syncobjects/syncnote.php is in z-push-common 2.3.8-2ubuntu1.
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 | <?php
/***********************************************
* File : syncnote.php
* Project : Z-Push
* Descr : WBXML mail attachment entities that can be parsed
* directly (as a stream) from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings.
*
* Created : 16.01.2012
*
* Copyright 2007 - 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
************************************************/
class SyncNote extends SyncObject {
// Outlook transports note colors as categories
static private $colors = array(
0 => "Blue Category",
1 => "Green Category",
2 => "Red Category",
3 => "Yellow Category",
4 => "White Category",
);
// Purple and orange are not supported in PidLidNoteColor
static private $unsupportedColors = array(
"Purple Category",
"Orange Category",
);
public $asbody;
public $categories;
public $lastmodified;
public $messageclass;
public $subject;
public $Color;
function __construct() {
$mapping = array(
SYNC_AIRSYNCBASE_BODY => array ( self::STREAMER_VAR => "asbody",
self::STREAMER_TYPE => "SyncBaseBody",
self::STREAMER_RONOTIFY => true),
SYNC_NOTES_CATEGORIES => array ( self::STREAMER_VAR => "categories",
self::STREAMER_ARRAY => SYNC_NOTES_CATEGORY,
self::STREAMER_RONOTIFY => true),
SYNC_NOTES_LASTMODIFIEDDATE => array ( self::STREAMER_VAR => "lastmodified",
self::STREAMER_TYPE => self::STREAMER_TYPE_DATE,
self::STREAMER_RONOTIFY => true),
SYNC_NOTES_MESSAGECLASS => array ( self::STREAMER_VAR => "messageclass",
self::STREAMER_RONOTIFY => true),
SYNC_NOTES_SUBJECT => array ( self::STREAMER_VAR => "subject",
self::STREAMER_RONOTIFY => true),
SYNC_NOTES_IGNORE_COLOR => array ( self::STREAMER_VAR => "Color",
self::STREAMER_TYPE => self::STREAMER_TYPE_IGNORE),
);
parent::__construct($mapping);
}
/**
* Sets the color index from a known category.
*
* @access public
* @return void
*/
public function SetColorFromCategory() {
if (!empty($this->categories)) {
$result = array_intersect($this->categories, array_values(self::$colors));
if (empty($result)) {
$result = array_intersect($this->categories, array_values(self::$unsupportedColors));
if (!empty($result)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncNote->SetColorFromCategory(): unsupported color '%s', setting to color white", $result[0]));
$result = array("White Category");
}
}
if (!empty($result)) {
$this->Color = array_search($result[0], self::$colors);
}
}
// unset or empty category means we have to reset the color to yellow
else {
$this->Color = 3;
}
}
/**
* Sets the category for a Color if color categories are not yet set.
*
* @access public
* @return boolean
*/
public function SetCategoryFromColor() {
// is a color other than yellow set
if (isset($this->Color) && $this->Color != 3 && $this->Color > -1 && $this->Color < 5) {
// check existing categories - do not rewrite category if the category is already a supported or unsupported color
if (!empty($this->categories)) {
$insecUnsupp = array_intersect($this->categories, array_values(self::$unsupportedColors));
$insecColors = array_intersect($this->categories, array_values(self::$colors));
if (!empty($insecUnsupp) || !empty($insecColors)) {
return false;
}
}
if(!isset($this->categories)) {
$this->categories = array();
}
$this->categories[] = self::$colors[$this->Color];
return true;
}
}
}
|