/usr/share/php/Horde/Itip/Event/Vevent.php is in php-horde-itip 2.0.5-1.
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | <?php
/**
* A wrapper for vEvent iCalender data.
*
* PHP version 5
*
* @category Horde
* @package Itip
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL
* @link http://pear.horde.org/index.php?package=Itip
*/
/**
* A wrapper for vEvent iCalender data.
*
* Copyright 2002-2013 Horde LLC (http://www.horde.org/)
* Copyright 2004-2010 Klarälvdalens Datakonsult AB
*
* See the enclosed file COPYING for license information (LGPL). If you did not
* receive this file, see
* {@link http://www.horde.org/licenses/lgpl21 LGPL}.
*
* @category Horde
* @package Itip
* @author Gunnar Wrobel <wrobel@pardus.de>
* @license http://www.horde.org/licenses/lgpl21 LGPL
* @link http://pear.horde.org/index.php?package=Itip
*
* @todo Clean this class up. Accessing private methods for copying the object
* is not nice. Reconsider if an interface is really needed. See also PMD
* report.
*/
class Horde_Itip_Event_Vevent
implements Horde_Itip_Event
{
/**
* The wrapped vEvent.
*
* @var Horde_Icalendar_Vevent
*/
private $_vevent;
/**
* Constructor.
*
* @param Horde_Icalendar_Vevent $vevent The iCalendar object that will be
* wrapped by this instance.
*/
public function __construct(Horde_Icalendar_Vevent $vevent)
{
$this->_vevent = $vevent;
}
/**
* Returns the wrapped vEvent.
*
* @return Horde_Icalendar_Vevent The wrapped event.
*/
public function getVevent()
{
return $this->_vevent;
}
/**
* Return the method of the iTip request.
*
* @return string The method of the request.
*/
public function getMethod()
{
return $this->_vevent->getAttributeDefault('METHOD', 'REQUEST');
}
/**
* Return the uid of the iTip event.
*
* @return string The uid of the event.
*/
public function getUid()
{
return $this->_vevent->getAttribute('UID');
}
/**
* Return the summary for the event.
*
* @return string The summary.
*/
public function getSummary()
{
return $this->_vevent->getAttributeDefault('SUMMARY', Horde_Itip_Translation::t("No summary available"));
}
/**
* Return the start of the iTip event.
*
* @return string The start of the event.
*/
public function getStart()
{
return $this->_vevent->getAttributeDefault('DTSTART', 0);
}
/**
* Return the end of the iTip event.
*
* @return string The end of the event.
*/
public function getEnd()
{
return $this->_vevent->getAttributeDefault('DTEND', 0);
}
/**
* Return the organizer of the iTip event.
*
* @return string The organizer of the event.
*
* @todo Parse mailto using parse_url
*/
public function getOrganizer()
{
return preg_replace('/^mailto:\s*/i', '', $this->_vevent->getAttributeDefault('ORGANIZER', ''));
}
/**
* Copy the details from an event into this one.
*
* @param Horde_Itip_Event $event The event to copy from.
*
* @return NULL
*/
public function copyEventInto(Horde_Itip_Event $event)
{
$this->copyUid($event);
$this->copySummary($event);
$this->copyDescription($event);
$this->copyStart($event);
$this->copyEndOrDuration($event);
$this->copySequence($event);
$this->copyLocation($event);
$this->copyOrganizer($event);
}
/**
* Set the attendee parameters.
*
* @param string $attendee The mail address of the attendee.
* @param string $common_name Common name of the attendee.
* @param string $status Attendee status (ACCPETED, DECLINED, TENTATIVE)
*
* @return NULL
*/
public function setAttendee($attendee, $common_name, $status)
{
$this->_vevent->setAttribute(
'ATTENDEE',
'mailto:' . $attendee,
array(
'CN' => $common_name,
'PARTSTAT' => $status
)
);
}
/**
* Set the uid of the iTip event.
*
* @param string $uid The uid of the event.
*
* @return NULL
*/
private function setUid($uid)
{
$this->_vevent->setAttribute('UID', $uid);
}
/**
* Copy the uid from the request into the provided iTip instance.
*
* @return NULL
*/
private function copyUid(Horde_Itip_Event $itip)
{
$itip->setUid($this->getUid());
}
/**
* Set the summary for the event.
*
* @param string $summary The summary.
*
* @return NULL
*/
private function setSummary($summary)
{
$this->_vevent->setAttribute('SUMMARY', $summary);
}
/**
* Copy the summary from the request into the provided iTip instance.
*
* @return NULL
*/
private function copySummary(Horde_Itip_Event $itip)
{
$itip->setSummary($this->getSummary());
}
/**
* Return the description for the event.
*
* @return string The description.
*/
private function getDescription()
{
return $this->_vevent->getAttribute('DESCRIPTION');
}
/**
* Set the description for the event.
*
* @param string $description The description.
*
* @return NULL
*/
private function setDescription($description)
{
$this->_vevent->setAttribute('DESCRIPTION', $description);
}
/**
* Copy the description from the request into the provided iTip instance.
*
* @return NULL
*/
private function copyDescription(Horde_Itip_Event $itip)
{
try {
$itip->setDescription($this->getDescription());
} catch (Horde_Icalendar_Exception $e) {
}
}
/**
* Return the start parameters of the iTip event.
*
* @return array The start parameters of the event.
*/
public function getStartParameters()
{
$parameters = $this->_vevent->getAttribute('DTSTART', true);
return array_pop($parameters);
}
/**
* Set the start of the iTip event.
*
* @param string $start The start of the event.
* @param array $parameters Additional parameters.
*
* @return NULL
*/
private function setStart($start, $parameters)
{
$this->_vevent->setAttribute('DTSTART', $start, $parameters);
}
/**
* Copy the start time from the request into the provided iTip instance.
*
* @return NULL
*/
private function copyStart(Horde_Itip_Event $itip)
{
$itip->setStart($this->getStart(), $this->getStartParameters());
}
/**
* Return the end parameters of the iTip event.
*
* @return array The end parameters of the event.
*/
private function getEndParameters()
{
$parameters = $this->_vevent->getAttribute('DTEND', true);
return array_pop($parameters);
}
/**
* Set the end of the iTip event.
*
* @param string $end The end of the event.
* @param array $parameters Additional parameters.
*
* @return NULL
*/
private function setEnd($end, $parameters)
{
$this->_vevent->setAttribute('DTEND', $end, $parameters);
}
/**
* Return the duration for the event.
*
* @return string The duration of the event.
*/
private function getDuration()
{
return $this->_vevent->getAttribute('DURATION');
}
/**
* Return the duration parameters of the iTip event.
*
* @return array The duration parameters of the event.
*/
private function getDurationParameters()
{
$parameters = $this->_vevent->getAttribute('DURATION', true);
return array_pop($parameters);
}
/**
* Set the duration of the iTip event.
*
* @param string $duration The duration of the event.
* @param array $parameters Additional parameters.
*
* @return NULL
*/
private function setDuration($duration, $parameters)
{
$this->_vevent->setAttribute('DURATION', $duration, $parameters);
}
/**
* Copy the end time or event duration from the request into the provided
* iTip instance.
*
* @return NULL
*/
private function copyEndOrDuration(Horde_Itip_Event $itip)
{
try {
$itip->setEnd($this->getEnd(), $this->getEndParameters());
} catch (Horde_Icalendar_Exception $e) {
$itip->setDuration($this->getDuration(), $this->getDurationParameters());
}
}
/**
* Return the sequence for the event.
*
* @return string The sequence.
*/
private function getSequence()
{
return $this->_vevent->getAttribute('SEQUENCE');
}
/**
* Set the sequence for the event.
*
* @param string $sequence The sequence.
*
* @return NULL
*/
private function setSequence($sequence)
{
$this->_vevent->setAttribute('SEQUENCE', $sequence);
}
/**
* Copy the sequence from the request into the provided iTip instance.
*
* @return NULL
*/
private function copySequence(Horde_Itip_Event $itip)
{
try {
$itip->setSequence($this->getSequence());
} catch (Horde_Icalendar_Exception $e) {
}
}
/**
* Return the location for the event.
*
* @return string The location.
*/
private function getLocation()
{
return $this->_vevent->getAttribute('LOCATION');
}
/**
* Set the location for the event.
*
* @param string $location The location.
*
* @return NULL
*/
private function setLocation($location)
{
$this->_vevent->setAttribute('LOCATION', $location);
}
/**
* Copy the location from the request into the provided iTip instance.
*
* @return NULL
*/
private function copyLocation(Horde_Itip_Event $itip)
{
try {
$itip->setLocation($this->getLocation());
} catch (Horde_Icalendar_Exception $e) {
}
}
/**
* Return the organizer for the event.
*
* @return string The organizer of the event.
*/
private function getRawOrganizer()
{
return $this->_vevent->getAttribute('ORGANIZER');
}
/**
* Return the organizer parameters of the iTip event.
*
* @return array The organizer parameters of the event.
*/
private function getOrganizerParameters()
{
$parameters = $this->_vevent->getAttribute('ORGANIZER', true);
return array_pop($parameters);
}
/**
* Set the organizer of the iTip event.
*
* @param string $organizer The organizer of the event.
* @param array $parameters Additional parameters.
*
* @return NULL
*/
private function setOrganizer($organizer, $parameters)
{
$this->_vevent->setAttribute('ORGANIZER', $organizer, $parameters);
}
/**
* Copy the organizer from the request into the provided iTip instance.
*
* @return NULL
*/
private function copyOrganizer(Horde_Itip_Event $itip)
{
$itip->setOrganizer($this->getRawOrganizer(), $this->getOrganizerParameters());
}
}
|