diff options
Diffstat (limited to 'apps/calendar/ajax/createcalendar.php')
-rw-r--r-- | apps/calendar/ajax/createcalendar.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/calendar/ajax/createcalendar.php b/apps/calendar/ajax/createcalendar.php index f8b5974f54c..b719b207c74 100644 --- a/apps/calendar/ajax/createcalendar.php +++ b/apps/calendar/ajax/createcalendar.php @@ -12,6 +12,18 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); +if(trim($_POST['name']) == ''){ + OC_JSON::error(array('message'=>'empty')); + exit; +} +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +foreach($calendars as $cal){ + if($cal['displayname'] == $_POST['name']){ + OC_JSON::error(array('message'=>'namenotavailable')); + exit; + } +} + $userid = OC_User::getUser(); $calendarid = OC_Calendar_Calendar::addCalendar($userid, $_POST['name'], 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']); OC_Calendar_Calendar::setCalendarActive($calendarid, 1); |