/usr/share/php/Horde/Itip/Response/Type/Base.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 | <?php
/**
* Basic iTip response type definition.
*
* 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
*/
/**
* Basic iTip response type definition.
*
* Copyright 2010 Kolab Systems AG
*
* 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
*/
abstract class Horde_Itip_Response_Type_Base
implements Horde_Itip_Response_Type
{
/**
* The request we are going to answer.
*
* @var Horde_Itip_Event
*/
private $_request;
/**
* The invited resource.
*
* @var Horde_Itip_Resource
*/
private $_resource;
/**
* An optional comment that should appear in the response subject.
*
* @var string
*/
private $_comment;
/**
* Constructor.
*
* @param Horde_Itip_Resource $resource The invited resource.
* @param string $comment A comment for the subject line.
*/
public function __construct(
Horde_Itip_Resource $resource,
$comment = null
)
{
$this->_resource = $resource;
$this->_comment = $comment;
}
/**
* Set the request.
*
* @param Horde_Itip_Event $request The request this instance will respond
* to.
*
* @return NULL
*/
public function setRequest(
Horde_Itip_Event $request
)
{
$this->_request = $request;
}
/**
* Get the request for this response.
*
* @return Horde_Itip_Event The request this instance will
* respond to.
*
* @throws Horde_Itip_Exception If the request has not been
* set yet.
*/
public function getRequest()
{
if (empty($this->_request)) {
throw new Horde_Itip_Exception(
'The iTip request is still undefined!'
);
}
return $this->_request;
}
/**
* Return the subject of the response without using the comment.
*
* @return string The subject.
*/
public function getBriefSubject()
{
return sprintf(
'%s: %s',
$this->getShortSubject(),
$this->getRequest()->getSummary()
);
}
/**
* Return the subject of the response.
*
* @return string The subject.
*/
public function getSubject()
{
if ($this->_comment === null) {
return $this->getBriefSubject();
} else {
return sprintf(
'%s [%s]: %s',
$this->getShortSubject(),
$this->_comment,
$this->getRequest()->getSummary()
);
}
}
/**
* Return an additional message for the response.
*
* @param boolean $is_update Indicates if the request was an update.
*
* @return string The message.
*/
public function getMessage($is_update = false)
{
if ($this->_comment === null) {
return sprintf(
"%s %s:\n\n%s",
$this->_resource->getCommonName(),
$this->getShortMessage($is_update),
$this->getRequest()->getSummary()
);
} else {
return sprintf(
"%s %s:\n\n%s\n\n%s",
$this->_resource->getCommonName(),
$this->getShortMessage($is_update),
$this->getRequest()->getSummary(),
$this->_comment
);
}
}
}
|