commit
16c8f62658
@ -0,0 +1,27 @@ |
||||
Copyright (C) 2007-2011 Rooftop Solutions. |
||||
Copyright (C) 2007-2009 FileMobile inc. |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, |
||||
are permitted provided that the following conditions are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright notice, |
||||
this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright notice, |
||||
this list of conditions and the following disclaimer in the documentation |
||||
and/or other materials provided with the distribution. |
||||
* Neither the name of the SabreDAV nor the names of its contributors |
||||
may be used to endorse or promote products derived from this software |
||||
without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
POSSIBILITY OF SUCH DAMAGE. |
@ -0,0 +1,82 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
/** |
||||
* This class manages our app actions |
||||
*/ |
||||
OC_Calendar_App::$l10n = new OC_L10N('calendar'); |
||||
class OC_Calendar_App{ |
||||
public static $l10n; |
||||
|
||||
public static function getCalendar($id){ |
||||
$calendar = OC_Calendar_Calendar::find( $id ); |
||||
if( $calendar === false || $calendar['userid'] != OC_User::getUser()){ |
||||
OC_JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar')))); |
||||
exit(); |
||||
} |
||||
return $calendar; |
||||
} |
||||
|
||||
public static function getEventObject($id){ |
||||
$event_object = OC_Calendar_Object::find( $id ); |
||||
if( $event_object === false ){ |
||||
OC_JSON::error(); |
||||
exit(); |
||||
} |
||||
|
||||
self::getCalendar( $event_object['calendarid'] );//access check |
||||
return $event_object; |
||||
} |
||||
|
||||
public static function getVCalendar($id){ |
||||
$event_object = self::getEventObject( $id ); |
||||
|
||||
$vcalendar = OC_VObject::parse($event_object['calendardata']); |
||||
// Check if the vcalendar is valid |
||||
if(is_null($vcalendar)){ |
||||
OC_JSON::error(); |
||||
exit(); |
||||
} |
||||
return $vcalendar; |
||||
} |
||||
|
||||
public static function isNotModified($vevent, $lastmodified) |
||||
{ |
||||
$last_modified = $vevent->__get('LAST-MODIFIED'); |
||||
if($last_modified && $lastmodified != $last_modified->getDateTime()->format('U')){ |
||||
OC_JSON::error(array('modified'=>true)); |
||||
exit; |
||||
} |
||||
} |
||||
|
||||
public static function getCategoryOptions() |
||||
{ |
||||
return array( |
||||
self::$l10n->t('Birthday'), |
||||
self::$l10n->t('Business'), |
||||
self::$l10n->t('Call'), |
||||
self::$l10n->t('Clients'), |
||||
self::$l10n->t('Deliverer'), |
||||
self::$l10n->t('Holidays'), |
||||
self::$l10n->t('Ideas'), |
||||
self::$l10n->t('Journey'), |
||||
self::$l10n->t('Jubilee'), |
||||
self::$l10n->t('Meeting'), |
||||
self::$l10n->t('Other'), |
||||
self::$l10n->t('Personal'), |
||||
self::$l10n->t('Projects'), |
||||
self::$l10n->t('Questions'), |
||||
self::$l10n->t('Work'), |
||||
); |
||||
} |
||||
|
||||
public static function getRepeatOptions() |
||||
{ |
||||
OC_Calendar_Object::getRepeatOptions(self::$l10n); |
||||
} |
||||
} |
Loading…
Reference in new issue