1 | <?php |
||
21 | class BackendTypo3 extends AbstractBackend |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * The table name that will be used for calendars |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $calendarTableName; |
||
30 | |||
31 | /** |
||
32 | * The table name that will be used for calendar objects |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $calendarObjectTableName; |
||
37 | |||
38 | /** |
||
39 | * List of CalDAV properties, and how they map to database fieldnames |
||
40 | * |
||
41 | * Add your own properties by simply adding on to this array |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | public $propertyMap = [ |
||
46 | '{DAV:}displayname' => 'title', |
||
47 | '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'tx_caldav_data', |
||
48 | '{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone', |
||
49 | '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder', |
||
50 | '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor' |
||
51 | ]; |
||
52 | |||
53 | /** |
||
54 | * Creates the backend |
||
55 | * |
||
56 | * @param string $calendarTableName |
||
57 | * @param string $calendarObjectTableName |
||
58 | */ |
||
59 | public function __construct($calendarTableName = 'calendars', $calendarObjectTableName = 'calendarobjects') |
||
64 | |||
65 | /** |
||
66 | * Returns a list of calendars for a principal. |
||
67 | * |
||
68 | * Every project is an array with the following keys: |
||
69 | * * id, a unique id that will be used by other functions to modify the |
||
70 | * calendar. This can be the same as the uri or a database key. |
||
71 | * * uri, which the basename of the uri with which the calendar is |
||
72 | * accessed. |
||
73 | * * principalUri. The owner of the calendar. Almost always the same as |
||
74 | * principalUri passed to this method. |
||
75 | * |
||
76 | * Furthermore it can contain webdav properties in clark notation. A very |
||
77 | * common one is '{DAV:}displayname'. |
||
78 | * |
||
79 | * @param string $principalUri |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getCalendarsForUser($principalUri) |
||
122 | |||
123 | /** |
||
124 | * Creates a new calendar for a principal. |
||
125 | * |
||
126 | * If the creation was a success, an id must be returned that can be used to reference |
||
127 | * this calendar in other methods, such as updateCalendar |
||
128 | * |
||
129 | * @param string $principalUri |
||
130 | * @param string $calendarUri |
||
131 | * @param array $properties |
||
132 | * |
||
133 | * @return mixed |
||
134 | * @throws Sabre_DAV_Exception |
||
135 | */ |
||
136 | public function createCalendar($principalUri, $calendarUri, array $properties) |
||
177 | |||
178 | /** |
||
179 | * Updates a calendars properties |
||
180 | * |
||
181 | * The properties array uses the propertyName in clark-notation as key, |
||
182 | * and the array value for the property value. In the case a property |
||
183 | * should be deleted, the property value will be null. |
||
184 | * |
||
185 | * This method must be atomic. If one property cannot be changed, the |
||
186 | * entire operation must fail. |
||
187 | * |
||
188 | * If the operation was successful, true can be returned. |
||
189 | * If the operation failed, false can be returned. |
||
190 | * |
||
191 | * Deletion of a non-existant property is always succesful. |
||
192 | * |
||
193 | * Lastly, it is optional to return detailed information about any |
||
194 | * failures. In this case an array should be returned with the following |
||
195 | * structure: |
||
196 | * |
||
197 | * array( |
||
198 | * 403 => array( |
||
199 | * '{DAV:}displayname' => null, |
||
200 | * ), |
||
201 | * 424 => array( |
||
202 | * '{DAV:}owner' => null, |
||
203 | * ) |
||
204 | * ) |
||
205 | * |
||
206 | * In this example it was forbidden to update {DAV:}displayname. |
||
207 | * (403 Forbidden), which in turn also caused {DAV:}owner to fail |
||
208 | * (424 Failed Dependency) because the request needs to be atomic. |
||
209 | * |
||
210 | * @param string $calendarId |
||
211 | * @param PropPatch $properties |
||
212 | * |
||
213 | * @return bool|array |
||
214 | */ |
||
215 | public function updateCalendar($calendarId, PropPatch $properties) |
||
278 | |||
279 | /** |
||
280 | * Delete a calendar and all it's objects |
||
281 | * |
||
282 | * @param string $calendarId |
||
283 | * |
||
284 | * @return void |
||
285 | */ |
||
286 | public function deleteCalendar($calendarId) |
||
305 | |||
306 | /** |
||
307 | * Returns all calendar objects within a calendar object. |
||
308 | * |
||
309 | * Every item contains an array with the following keys: |
||
310 | * * id - unique identifier which will be used for subsequent updates |
||
311 | * * calendardata - The iCalendar-compatible calnedar data |
||
312 | * * uri - a unique key which will be used to construct the uri. This can be any arbitrary string. |
||
313 | * * lastmodified - a timestamp of the last modification time |
||
314 | * |
||
315 | * @param string $calendarId |
||
316 | * |
||
317 | * @return array |
||
318 | */ |
||
319 | public function getCalendarObjects($calendarId) |
||
363 | |||
364 | /** |
||
365 | * Returns information from a single calendar object, based on it's object uri. |
||
366 | * |
||
367 | * @param string $calendarId |
||
368 | * @param string $objectUri |
||
369 | * |
||
370 | * @return array |
||
371 | */ |
||
372 | public function getCalendarObject($calendarId, $objectUri) |
||
392 | |||
393 | /** |
||
394 | * Creates a new calendar object. |
||
395 | * |
||
396 | * @param string $calendarId |
||
397 | * @param string $objectUri |
||
398 | * @param string $calendarData |
||
399 | * |
||
400 | * @return void |
||
401 | */ |
||
402 | public function createCalendarObject($calendarId, $objectUri, $calendarData) |
||
427 | |||
428 | /** |
||
429 | * Updates an existing calendarobject, based on it's uri. |
||
430 | * |
||
431 | * @param string $calendarId |
||
432 | * @param string $objectUri |
||
433 | * @param string $calendarData |
||
434 | * |
||
435 | * @return void |
||
436 | */ |
||
437 | public function updateCalendarObject($calendarId, $objectUri, $calendarData) |
||
459 | |||
460 | /** |
||
461 | * Deletes an existing calendar object. |
||
462 | * |
||
463 | * @param string $calendarId |
||
464 | * @param string $objectUri |
||
465 | * |
||
466 | * @return void |
||
467 | */ |
||
468 | public function deleteCalendarObject($calendarId, $objectUri) |
||
487 | |||
488 | /** |
||
489 | * Update cal event |
||
490 | * |
||
491 | * @param $calendarId |
||
492 | * @param $objectUri |
||
493 | * @param $calendarData |
||
494 | */ |
||
495 | private function updateCalEvent($calendarId, $objectUri, $calendarData) |
||
502 | |||
503 | /** |
||
504 | * Clear cache |
||
505 | * |
||
506 | * @param int $pid |
||
507 | */ |
||
508 | private function clearCache($pid) |
||
520 | } |
||
521 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.