Skip to content
This repository has been archived by the owner on Oct 31, 2018. It is now read-only.

Commit

Permalink
fix infinite loop in master
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehrke committed Sep 2, 2014
1 parent 4e3ccef commit a723bf9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class OC_Calendar_Calendar{
* @brief Returns the list of calendars for a specific user.
* @param string $uid User ID
* @param boolean $active Only return calendars with this $active state, default(=false) is don't care
* @param boolean $createIfNecessary create calendars if no exist yet
* @return array
*/
public static function allCalendars($uid, $active=false) {
public static function allCalendars($uid, $active=false, $createIfNecessary=true) {
$values = array($uid);
$active_where = '';
if (!is_null($active) && $active) {
Expand All @@ -56,7 +57,7 @@ public static function allCalendars($uid, $active=false) {
$owned_calendar_ids[] = $row['id'];
}

if ($active === false && count($calendars) === 0) {
if ($active === false && count($calendars) === 0 && $createIfNecessary === true) {
self::addDefaultCalendars($uid);
return self::allCalendars($uid, false);
}
Expand Down Expand Up @@ -117,7 +118,7 @@ public static function find($id) {
* @return insertid
*/
public static function addCalendar($userid,$name,$components='VEVENT,VTODO,VJOURNAL',$timezone=null,$order=0,$color=null) {
$all = self::allCalendars($userid);
$all = self::allCalendars($userid, false, false);
$uris = array();
foreach($all as $i) {
$uris[] = $i['uri'];
Expand Down

0 comments on commit a723bf9

Please sign in to comment.