Completed
Push — 16.1 ( b39e15...d98aac )
by Klaus
18:52
created
filemanager/inc/class.filemanager_hooks.inc.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		);
106 106
 		if ($location == 'admin')
107 107
 		{
108
-        	display_section(self::$appname,$file);
108
+			display_section(self::$appname,$file);
109 109
 		}
110 110
 		else
111 111
 		{
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			'yes' => lang('Yes')
129 129
 		);
130 130
 
131
-        $settings = array(
131
+		$settings = array(
132 132
 			'startfolder'	=> array(
133 133
 				'type'		=> 'input',
134 134
 				'name'		=> 'startfolder',
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_merge.inc.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 		}
124 124
 		// Custom fields
125 125
 		if($content && strpos($content, '#') !== 0)
126
-                {
126
+				{
127 127
 			// Expand link-to custom fields
128 128
 			 $this->cf_link_to_expand($file, $content, $info);
129 129
 
Please login to merge, or discard this patch.
calendar/setup/tables_update.inc.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1909,7 +1909,7 @@
 block discarded – undo
1909 1909
 			WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__);
1910 1910
 	}
1911 1911
 
1912
-    $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1912
+	$GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1
1913 1913
 			WHERE recur_interval=0',__LINE__,__FILE__);
1914 1914
 
1915 1915
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007';
Please login to merge, or discard this patch.
calendar/inc/class.calendar_ical.inc.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
 									{
484 484
 										$user = $this->resource_info($this->user);
485 485
 										$attributes['ATTENDEE'][] = 'mailto:' . $user['email'];
486
-			    						$parameters['ATTENDEE'][] = array(
487
-			    							'CN'		=>	$user['name'],
488
-			    							'ROLE'		=> 'REQ-PARTICIPANT',
486
+										$parameters['ATTENDEE'][] = array(
487
+											'CN'		=>	$user['name'],
488
+											'ROLE'		=> 'REQ-PARTICIPANT',
489 489
 											'PARTSTAT'	=> 'NEEDS-ACTION',
490 490
 											'CUTYPE'	=> 'INDIVIDUAL',
491 491
 											'RSVP'		=> 'TRUE',
492 492
 											'X-EGROUPWARE-UID'	=> (string)$this->user,
493
-			    						);
494
-			    						$event['participants'][$this->user] = true;
493
+										);
494
+										$event['participants'][$this->user] = true;
495 495
 									}
496 496
 									break;
497 497
 								case 'r':
@@ -543,24 +543,24 @@  discard block
 block discarded – undo
543 543
 						}
544 544
 						break;
545 545
 
546
-    				case 'ORGANIZER':
547
-	    				if (!$organizerURL)
548
-	    				{
549
-	    					$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
550
-			    				. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
551
-			    			$organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
552
-			    			if ($version == '1.0')
553
-			    			{
554
-		    					$organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>'));
555
-			    			}
556
-			    			else
557
-			    			{
558
-		    					$organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail;
559
-			    			}
560
-			    			$organizerUID = $event['owner'];
561
-		    				if (!isset($event['participants'][$event['owner']]))
562
-		    				{
563
-			    				$options = array(
546
+					case 'ORGANIZER':
547
+						if (!$organizerURL)
548
+						{
549
+							$organizerCN = '"' . trim($GLOBALS['egw']->accounts->id2name($event['owner'],'account_firstname')
550
+								. ' ' . $GLOBALS['egw']->accounts->id2name($event['owner'],'account_lastname')) . '"';
551
+							$organizerEMail = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_email');
552
+							if ($version == '1.0')
553
+							{
554
+								$organizerURL = trim($organizerCN . (empty($organizerURL) ? '' : ' <' . $organizerURL .'>'));
555
+							}
556
+							else
557
+							{
558
+								$organizerURL = empty($organizerEMail) ? '' : 'mailto:' . $organizerEMail;
559
+							}
560
+							$organizerUID = $event['owner'];
561
+							if (!isset($event['participants'][$event['owner']]))
562
+							{
563
+								$options = array(
564 564
 									'ROLE'     => 'CHAIR',
565 565
 									'PARTSTAT' => 'DELEGATED',
566 566
 									'CUTYPE'   => 'INDIVIDUAL',
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 								if (!empty($organizerEMail)) $options['EMAIL'] = $organizerEMail;
571 571
 								if (!empty($event['owner'])) $options['X-EGROUPWARE-UID'] = $event['owner'];
572 572
 								$attributes['ATTENDEE'][] = $organizerURL;
573
-			    				$parameters['ATTENDEE'][] = $options;
574
-		    				}
575
-	    				}
576
-    					// do NOT use ORGANIZER for events without further participants or a different organizer
577
-	    				if (count($event['participants']) > 1 || !isset($event['participants'][$event['owner']]))
578
-	    				{
579
-		    				$attributes['ORGANIZER'] = $organizerURL;
580
-		    				$parameters['ORGANIZER']['CN'] = $organizerCN;
581
-		    				if (!empty($organizerUID))
582
-		    				{
583
-			    				$parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID;
584
-		    				}
585
-	    				}
586
-	    				break;
573
+								$parameters['ATTENDEE'][] = $options;
574
+							}
575
+						}
576
+						// do NOT use ORGANIZER for events without further participants or a different organizer
577
+						if (count($event['participants']) > 1 || !isset($event['participants'][$event['owner']]))
578
+						{
579
+							$attributes['ORGANIZER'] = $organizerURL;
580
+							$parameters['ORGANIZER']['CN'] = $organizerCN;
581
+							if (!empty($organizerUID))
582
+							{
583
+								$parameters['ORGANIZER']['X-EGROUPWARE-UID'] = $organizerUID;
584
+							}
585
+						}
586
+						break;
587 587
 
588 588
 					case 'DTSTART':
589 589
 						if (empty($event['whole_day']))
@@ -992,12 +992,12 @@  discard block
 block discarded – undo
992 992
 				foreach (is_array($value) && $parameters[$key]['VALUE']!='DATE' ? $value : array($value) as $valueID => $valueData)
993 993
 				{
994 994
 					$valueData = Api\Translation::convert($valueData,Api\Translation::charset(),$charset);
995
-                    $paramData = (array) Api\Translation::convert(is_array($value) ?
996
-                    		$parameters[$key][$valueID] : $parameters[$key],
997
-                            Api\Translation::charset(),$charset);
998
-                    $valuesData = (array) Api\Translation::convert($values[$key],
999
-                    		Api\Translation::charset(),$charset);
1000
-                    $content = $valueData . implode(';', $valuesData);
995
+					$paramData = (array) Api\Translation::convert(is_array($value) ?
996
+							$parameters[$key][$valueID] : $parameters[$key],
997
+							Api\Translation::charset(),$charset);
998
+					$valuesData = (array) Api\Translation::convert($values[$key],
999
+							Api\Translation::charset(),$charset);
1000
+					$content = $valueData . implode(';', $valuesData);
1001 1001
 
1002 1002
 					if ($version == '1.0' && (preg_match('/[^\x20-\x7F]/', $content) ||
1003 1003
 						($paramData['CN'] && preg_match('/[^\x20-\x7F]/', $paramData['CN']))))
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 	 * @param string|resource $_vcalData
2234 2234
 	 * @param string $principalURL ='' Used for CalDAV imports
2235 2235
 	 * @param string $charset  The encoding charset for $text. Defaults to
2236
-     *                         utf-8 for new format, iso-8859-1 for old format.
2236
+	 *                         utf-8 for new format, iso-8859-1 for old format.
2237 2237
 	 * @return Iterator|array|boolean Iterator if resource given or array of events on success, false on failure
2238 2238
 	 */
2239 2239
 	function icaltoegw($_vcalData, $principalURL='', $charset=null)
@@ -2784,10 +2784,10 @@  discard block
 block discarded – undo
2784 2784
 					// fall throught
2785 2785
 				case 'ATTENDEE':
2786 2786
 					if (isset($attributes['params']['PARTSTAT']))
2787
-				    {
2788
-				    	$attributes['params']['STATUS'] = $attributes['params']['PARTSTAT'];
2789
-				    }
2790
-				    if (isset($attributes['params']['STATUS']))
2787
+					{
2788
+						$attributes['params']['STATUS'] = $attributes['params']['PARTSTAT'];
2789
+					}
2790
+					if (isset($attributes['params']['STATUS']))
2791 2791
 					{
2792 2792
 						$status = $this->status_ical2egw[strtoupper($attributes['params']['STATUS'])];
2793 2793
 						if (empty($status)) $status = 'X';
@@ -3178,7 +3178,7 @@  discard block
 block discarded – undo
3178 3178
 				array2string($event)."\n",3,$this->logfile);
3179 3179
 		}
3180 3180
 		//Horde::logMessage("vevent2egw:\n" . print_r($event, true),
3181
-        //    	__FILE__, __LINE__, PEAR_LOG_DEBUG);
3181
+		//    	__FILE__, __LINE__, PEAR_LOG_DEBUG);
3182 3182
 		return $event;
3183 3183
 	}
3184 3184
 
Please login to merge, or discard this patch.
calendar/inc/class.calendar_import_csv.inc.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@
 block discarded – undo
32 32
 	protected static $conditions = array('exists');
33 33
 
34 34
 	/**
35
-	* For figuring out if an entry has changed
36
-	*/
35
+	 * For figuring out if an entry has changed
36
+	 */
37 37
 	protected $tracking;
38 38
 
39 39
 	/**
Please login to merge, or discard this patch.
calendar/inc/class.calendar_zpush.inc.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
 	 * @param int $cutoffdate =null
178 178
 	 * @param array $not_uids =null uids NOT to return for meeting requests
179 179
 	 * @return array
180
-  	 */
180
+	 */
181 181
 	function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null)
182 182
 	{
183 183
 		if (!isset($this->calendar)) $this->calendar = new calendar_boupdate();
Please login to merge, or discard this patch.
calendar/inc/class.calendar_ui.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -387,11 +387,11 @@
 block discarded – undo
387 387
 	}
388 388
 
389 389
 	/**
390
-	* gets the icons displayed for a given event
391
-	*
392
-	* @param array $event
393
-	* @return array of 'img' / 'title' pairs
394
-	*/
390
+	 * gets the icons displayed for a given event
391
+	 *
392
+	 * @param array $event
393
+	 * @return array of 'img' / 'title' pairs
394
+	 */
395 395
 	function event_icons($event)
396 396
 	{
397 397
 		$is_private = !$event['public'] && !$this->bo->check_perms(Acl::READ,$event);
Please login to merge, or discard this patch.
calendar/inc/class.calendar_uiforms.inc.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2415,14 +2415,14 @@  discard block
 block discarded – undo
2415 2415
 	}
2416 2416
 
2417 2417
 	/**
2418
-     * Export events as vCalendar version 2.0 files (iCal)
2419
-     *
2420
-     * @param int|array $content numeric cal_id or submitted content from etempalte::exec
2421
-     * @param boolean $return_error should an error-msg be returned or a regular page with it generated (default)
2422
-     * @return string error-msg if $return_error
2423
-     */
2424
-    function export($content=0,$return_error=false)
2425
-    {
2418
+	 * Export events as vCalendar version 2.0 files (iCal)
2419
+	 *
2420
+	 * @param int|array $content numeric cal_id or submitted content from etempalte::exec
2421
+	 * @param boolean $return_error should an error-msg be returned or a regular page with it generated (default)
2422
+	 * @return string error-msg if $return_error
2423
+	 */
2424
+	function export($content=0,$return_error=false)
2425
+	{
2426 2426
 		$boical = new calendar_ical();
2427 2427
 		#error_log(__METHOD__.print_r($content,true));
2428 2428
 		if (is_numeric($cal_id = $content ? $content : $_REQUEST['cal_id']))
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 		$GLOBALS['egw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('iCal Export');
2477 2477
 		$etpl = new etemplate_new('calendar.export');
2478 2478
 		$etpl->exec('calendar.calendar_uiforms.export',$content);
2479
-    }
2479
+	}
2480 2480
 	
2481 2481
 	/**
2482 2482
 	 * Edit category ACL (admin only)
@@ -2548,8 +2548,8 @@  discard block
 block discarded – undo
2548 2548
 	}
2549 2549
 
2550 2550
 	/**
2551
-	* Set up the required fields to get the history tab
2552
-	*/
2551
+	 * Set up the required fields to get the history tab
2552
+	 */
2553 2553
 	public function setup_history(&$content, &$sel_options)
2554 2554
 	{
2555 2555
 		$status = 'history_status';
Please login to merge, or discard this patch.
Switch Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -584,214 +584,214 @@  discard block
 block discarded – undo
584 584
 
585 585
 		switch((string)$button)
586 586
 		{
587
-		case 'exception':	// create an exception in a recuring event
588
-			$msg = $this->_create_exception($event,$preserv);
589
-			break;
587
+			case 'exception':	// create an exception in a recuring event
588
+				$msg = $this->_create_exception($event,$preserv);
589
+				break;
590 590
 
591
-		case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
592
-			unset($event['id']);
593
-			unset($event['uid']);
594
-			unset($event['reference']);
595
-			unset($preserv['reference']);
596
-			unset($event['recurrence']);
597
-			unset($preserv['recurrence']);
598
-			unset($event['recur_exception']);
599
-			unset($event['edit_single']);	// in case it has been set
600
-			unset($event['modified']);
601
-			unset($event['modifier']);
602
-			unset($event['caldav_name']);
603
-			$event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner'];
591
+			case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
592
+				unset($event['id']);
593
+				unset($event['uid']);
594
+				unset($event['reference']);
595
+				unset($preserv['reference']);
596
+				unset($event['recurrence']);
597
+				unset($preserv['recurrence']);
598
+				unset($event['recur_exception']);
599
+				unset($event['edit_single']);	// in case it has been set
600
+				unset($event['modified']);
601
+				unset($event['modifier']);
602
+				unset($event['caldav_name']);
603
+				$event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner'];
604
+
605
+				// Clear participant stati
606
+				foreach($event['participant_types'] as $type => &$participants)
607
+				{
608
+					foreach($participants as $id => &$p_response)
609
+					{
610
+						if($type == 'u' && $id == $event['owner']) continue;
611
+						calendar_so::split_status($p_response, $quantity, $role);
612
+						// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
613
+						$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
614
+						$p_response = calendar_so::combine_status($status,$quantity,$role);
615
+					}
616
+				}
604 617
 
605
-			// Clear participant stati
606
-			foreach($event['participant_types'] as $type => &$participants)
607
-			{
608
-				foreach($participants as $id => &$p_response)
618
+				// Copy alarms
619
+				if (is_array($event['alarm']))
609 620
 				{
610
-					if($type == 'u' && $id == $event['owner']) continue;
611
-					calendar_so::split_status($p_response, $quantity, $role);
612
-					// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
613
-					$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
614
-					$p_response = calendar_so::combine_status($status,$quantity,$role);
621
+					foreach($event['alarm'] as $n => &$alarm)
622
+					{
623
+						unset($alarm['id']);
624
+						unset($alarm['cal_id']);
625
+					}
615 626
 				}
616
-			}
617 627
 
618
-			// Copy alarms
619
-			if (is_array($event['alarm']))
620
-			{
621
-				foreach($event['alarm'] as $n => &$alarm)
628
+				// Get links to be copied
629
+				// With no ID, $content['link_to']['to_id'] is used
630
+				$content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0);
631
+				foreach(Link::get_links('calendar', $content['id']) as $link)
622 632
 				{
623
-					unset($alarm['id']);
624
-					unset($alarm['cal_id']);
633
+					if ($link['app'] != Link::VFS_APPNAME)
634
+					{
635
+						Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
636
+					}
637
+					elseif ($link['app'] == Link::VFS_APPNAME)
638
+					{
639
+						Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
640
+							'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
641
+							'name' => $link['id'],
642
+						), $link['remark']);
643
+					}
625 644
 				}
626
-			}
645
+				unset($link);
646
+				$preserv['view'] = $preserv['edit_single'] = false;
647
+				$msg = lang('Event copied - the copy can now be edited');
648
+				$event['title'] = lang('Copy of:').' '.$event['title'];
649
+				break;
627 650
 
628
-			// Get links to be copied
629
-			// With no ID, $content['link_to']['to_id'] is used
630
-			$content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0);
631
-			foreach(Link::get_links('calendar', $content['id']) as $link)
632
-			{
633
-				if ($link['app'] != Link::VFS_APPNAME)
651
+			case 'mail':
652
+			case 'sendrequest':
653
+			case 'save':
654
+			case 'print':
655
+			case 'apply':
656
+			case 'infolog':
657
+				if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
634 658
 				{
635
-					Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
659
+					$msg = lang('Permission denied');
660
+					$button = '';
661
+					break;
636 662
 				}
637
-				elseif ($link['app'] == Link::VFS_APPNAME)
663
+				if ($event['start'] > $event['end'])
638 664
 				{
639
-					Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
640
-						'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
641
-						'name' => $link['id'],
642
-					), $link['remark']);
665
+					$msg = lang('Error: Starttime has to be before the endtime !!!');
666
+					$button = '';
667
+					break;
643 668
 				}
644
-			}
645
-			unset($link);
646
-			$preserv['view'] = $preserv['edit_single'] = false;
647
-			$msg = lang('Event copied - the copy can now be edited');
648
-			$event['title'] = lang('Copy of:').' '.$event['title'];
649
-			break;
650
-
651
-		case 'mail':
652
-		case 'sendrequest':
653
-		case 'save':
654
-		case 'print':
655
-		case 'apply':
656
-		case 'infolog':
657
-			if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
658
-			{
659
-				$msg = lang('Permission denied');
660
-				$button = '';
661
-				break;
662
-			}
663
-			if ($event['start'] > $event['end'])
664
-			{
665
-				$msg = lang('Error: Starttime has to be before the endtime !!!');
666
-				$button = '';
667
-				break;
668
-			}
669
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
670
-			{
671
-				$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
672
-				$button = '';
673
-				break;
674
-			}
675
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
676
-			{
677
-				$msg = lang('Error: Duration of event longer then recurrence interval!');
678
-				$button = '';
679
-				break;
680
-			}
681
-			if (!$event['participants'])
682
-			{
683
-				$msg = lang('Error: no participants selected !!!');
684
-				$button = '';
685
-				break;
686
-			}
687
-			// if private event with ressource reservation is forbidden
688
-			if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
689
-			{
690
-				foreach (array_keys($event['participants']) as $uid)
669
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
691 670
 				{
692
-					if ($uid[0] == 'r') //ressource detection
671
+					$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
672
+					$button = '';
673
+					break;
674
+				}
675
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
676
+				{
677
+					$msg = lang('Error: Duration of event longer then recurrence interval!');
678
+					$button = '';
679
+					break;
680
+				}
681
+				if (!$event['participants'])
682
+				{
683
+					$msg = lang('Error: no participants selected !!!');
684
+					$button = '';
685
+					break;
686
+				}
687
+				// if private event with ressource reservation is forbidden
688
+				if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
689
+				{
690
+					foreach (array_keys($event['participants']) as $uid)
693 691
 					{
694
-						$msg = lang('Error: ressources reservation in private events is not allowed!!!');
695
-						$button = '';
696
-						break 2; //break foreach and case
692
+						if ($uid[0] == 'r') //ressource detection
693
+						{
694
+							$msg = lang('Error: ressources reservation in private events is not allowed!!!');
695
+							$button = '';
696
+							break 2; //break foreach and case
697
+						}
697 698
 					}
698 699
 				}
699
-			}
700
-			if ($content['edit_single'])	// we edited a single event from a series
701
-			{
702
-				$event['reference'] = $event['id'];
703
-				$event['recurrence'] = $content['edit_single'];
704
-				unset($event['id']);
705
-				$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
706
-				if (!is_array($conflicts) && $conflicts)
700
+				if ($content['edit_single'])	// we edited a single event from a series
707 701
 				{
708
-					// now we need to add the original start as recur-execption to the series
709
-					$recur_event = $this->bo->read($event['reference']);
710
-					$recur_event['recur_exception'][] = $content['edit_single'];
711
-					// check if we need to move the alarms, because they are next on that exception
712
-					foreach($recur_event['alarm'] as $id => $alarm)
702
+					$event['reference'] = $event['id'];
703
+					$event['recurrence'] = $content['edit_single'];
704
+					unset($event['id']);
705
+					$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
706
+					if (!is_array($conflicts) && $conflicts)
713 707
 					{
714
-						if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
708
+						// now we need to add the original start as recur-execption to the series
709
+						$recur_event = $this->bo->read($event['reference']);
710
+						$recur_event['recur_exception'][] = $content['edit_single'];
711
+						// check if we need to move the alarms, because they are next on that exception
712
+						foreach($recur_event['alarm'] as $id => $alarm)
715 713
 						{
716
-							$rrule = calendar_rrule::event2rrule($recur_event, true);
717
-							foreach ($rrule as $time)
714
+							if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
718 715
 							{
719
-								if ($content['edit_single'] < $time->format('ts'))
716
+								$rrule = calendar_rrule::event2rrule($recur_event, true);
717
+								foreach ($rrule as $time)
720 718
 								{
721
-									$alarm['time'] = $time->format('ts') - $alarm['offset'];
722
-									$this->bo->save_alarm($event['reference'], $alarm);
723
-									break;
719
+									if ($content['edit_single'] < $time->format('ts'))
720
+									{
721
+										$alarm['time'] = $time->format('ts') - $alarm['offset'];
722
+										$this->bo->save_alarm($event['reference'], $alarm);
723
+										break;
724
+									}
724 725
 								}
725 726
 							}
726 727
 						}
727
-					}
728
-					unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
729
-					unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
730
-					$this->bo->update($recur_event,true);	// no conflict check here
728
+						unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
729
+						unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
730
+						$this->bo->update($recur_event,true);	// no conflict check here
731 731
 
732
-					if(Api\Json\Response::isJSONResponse())
732
+						if(Api\Json\Response::isJSONResponse())
733
+						{
734
+							// Sending null will trigger a removal of the original
735
+							// for that date
736
+							Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
737
+						}
738
+
739
+						unset($recur_event);
740
+						unset($event['edit_single']);			// if we further edit it, it's just a single event
741
+						unset($preserv['edit_single']);
742
+					}
743
+					else	// conflict or error, we need to reset everything to the state befor we tried to save it
733 744
 					{
734
-						// Sending null will trigger a removal of the original
735
-						// for that date
736
-						Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
745
+						$event['id'] = $event['reference'];
746
+						$event['reference'] = $event['recurrence'] = 0;
747
+						$event['uid'] = $content['uid'];
737 748
 					}
738
-
739
-					unset($recur_event);
740
-					unset($event['edit_single']);			// if we further edit it, it's just a single event
741
-					unset($preserv['edit_single']);
742
-				}
743
-				else	// conflict or error, we need to reset everything to the state befor we tried to save it
744
-				{
745
-					$event['id'] = $event['reference'];
746
-					$event['reference'] = $event['recurrence'] = 0;
747
-					$event['uid'] = $content['uid'];
749
+					$update_type = 'edit';
748 750
 				}
749
-				$update_type = 'edit';
750
-			}
751
-			else	// we edited a non-reccuring event or the whole series
752
-			{
753
-				if (($old_event = $this->bo->read($event['id'])))
751
+				else	// we edited a non-reccuring event or the whole series
754 752
 				{
755
-					if ($event['recur_type'] != MCAL_RECUR_NONE)
753
+					if (($old_event = $this->bo->read($event['id'])))
756 754
 					{
757
-						$update_type = 'edit';
758
-
759
-						// we edit a existing series event
760
-						if ($event['start'] != $old_event['start'] ||
761
-							$event['whole_day'] != $old_event['whole_day'] ||
762
-							$event['end'] != $old_event['end'])
755
+						if ($event['recur_type'] != MCAL_RECUR_NONE)
763 756
 						{
764
-							// calculate offset against old series start or clicked recurrance,
765
-							// depending on which is smaller
766
-							$offset = $event['start'] - $old_event['start'];
767
-							if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
768
-							{
769
-								$offset = $off2;
770
-							}
771
-							$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
772
-							if($msg)
757
+							$update_type = 'edit';
758
+
759
+							// we edit a existing series event
760
+							if ($event['start'] != $old_event['start'] ||
761
+								$event['whole_day'] != $old_event['whole_day'] ||
762
+								$event['end'] != $old_event['end'])
773 763
 							{
774
-								$noerror = false;
764
+								// calculate offset against old series start or clicked recurrance,
765
+								// depending on which is smaller
766
+								$offset = $event['start'] - $old_event['start'];
767
+								if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
768
+								{
769
+									$offset = $off2;
770
+								}
771
+								$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
772
+								if($msg)
773
+								{
774
+									$noerror = false;
775
+								}
775 776
 							}
776 777
 						}
777
-					}
778
-					else
779
-					{
780
-						if ($old_event['start'] != $event['start'] ||
781
-							$old_event['end'] != $event['end'] ||
782
-							$event['whole_day'] != $old_event['whole_day'])
778
+						else
783 779
 						{
784
-							$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
785
-							foreach((array)$event['participants'] as $uid => $status)
780
+							if ($old_event['start'] != $event['start'] ||
781
+								$old_event['end'] != $event['end'] ||
782
+								$event['whole_day'] != $old_event['whole_day'])
786 783
 							{
787
-								$q = $r = null;
788
-								calendar_so::split_status($status,$q,$r);
789
-								if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
784
+								$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
785
+								foreach((array)$event['participants'] as $uid => $status)
790 786
 								{
791
-									$preferences = new Api\Preferences($uid);
792
-									$part_prefs = $preferences->read_repository();
793
-									switch ($part_prefs['calendar']['reset_stati'])
787
+									$q = $r = null;
788
+									calendar_so::split_status($status,$q,$r);
789
+									if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
794 790
 									{
791
+										$preferences = new Api\Preferences($uid);
792
+										$part_prefs = $preferences->read_repository();
793
+										switch ($part_prefs['calendar']['reset_stati'])
794
+										{
795 795
 										case 'no':
796 796
 											break;
797 797
 										case 'startday':
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 											$status_reset_to_unknown = true;
801 801
 											$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
802 802
 											// todo: report reset status to user
803
-									}
803
+										}
804 804
 								}
805 805
 							}
806 806
 							// check if we need to move the alarms, because they are relative
@@ -942,83 +942,83 @@  discard block
 block discarded – undo
942 942
 			}
943 943
 			break;
944 944
 
945
-		case 'cancel':
946
-			if($content['cancel_needs_refresh'])
947
-			{
948
-				Framework::refresh_opener($msg, 'calendar');
949
-			}
950
-			break;
951
-
952
-		case 'delete':					// delete of event (regular or series)
953
-			$exceptions_kept = null;
954
-			if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
955
-				$content['delete_exceptions'] == 'true', $exceptions_kept))
956
-			{
957
-				if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
945
+			case 'cancel':
946
+				if($content['cancel_needs_refresh'])
958 947
 				{
959
-					$msg = lang('Series deleted');
960
-					if ($exceptions_kept) $msg .= lang(', exceptions preserved');
948
+					Framework::refresh_opener($msg, 'calendar');
961 949
 				}
962
-				else
950
+				break;
951
+
952
+			case 'delete':					// delete of event (regular or series)
953
+				$exceptions_kept = null;
954
+				if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
955
+					$content['delete_exceptions'] == 'true', $exceptions_kept))
963 956
 				{
964
-					$msg = lang('Event deleted');
965
-				}
957
+					if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
958
+					{
959
+						$msg = lang('Series deleted');
960
+						if ($exceptions_kept) $msg .= lang(', exceptions preserved');
961
+					}
962
+					else
963
+					{
964
+						$msg = lang('Event deleted');
965
+					}
966 966
 
967
-			}
968
-			break;
967
+				}
968
+				break;
969 969
 
970
-		case 'freetime':
971
-			// the "click" has to be in onload, to make sure the button is already created
972
-			$event['button_was'] = $button;
973
-			break;
970
+			case 'freetime':
971
+				// the "click" has to be in onload, to make sure the button is already created
972
+				$event['button_was'] = $button;
973
+				break;
974 974
 
975
-		case 'add_alarm':
976
-			$time = $content['start'];
977
-			$offset = $time - $content['new_alarm']['date'];
978
-			if ($event['recur_type'] != MCAL_RECUR_NONE &&
979
-				($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
980
-				$time < $next_occurrence['start'])
981
-			{
982
-				$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
983
-			}
984
-			if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
985
-			{
986
-				$alarm = array(
987
-					'offset' => $offset,
988
-					'time'   => $content['new_alarm']['date'],
989
-					'all'    => !$content['new_alarm']['owner'],
990
-					'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
991
-				);
992
-				if ($alarm['time'] < $this->bo->now_su)
975
+			case 'add_alarm':
976
+				$time = $content['start'];
977
+				$offset = $time - $content['new_alarm']['date'];
978
+				if ($event['recur_type'] != MCAL_RECUR_NONE &&
979
+					($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
980
+					$time < $next_occurrence['start'])
993 981
 				{
994
-					$msg = lang("Can't add alarms in the past !!!");
982
+					$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
995 983
 				}
996
-				elseif ($event['id'])	// save the alarm immediatly
984
+				if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
997 985
 				{
998
-					if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
986
+					$alarm = array(
987
+						'offset' => $offset,
988
+						'time'   => $content['new_alarm']['date'],
989
+						'all'    => !$content['new_alarm']['owner'],
990
+						'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
991
+					);
992
+					if ($alarm['time'] < $this->bo->now_su)
993
+					{
994
+						$msg = lang("Can't add alarms in the past !!!");
995
+					}
996
+					elseif ($event['id'])	// save the alarm immediatly
999 997
 					{
1000
-						$alarm['id'] = $alarm_id;
1001
-						$event['alarm'][$alarm_id] = $alarm;
998
+						if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
999
+						{
1000
+							$alarm['id'] = $alarm_id;
1001
+							$event['alarm'][$alarm_id] = $alarm;
1002 1002
 
1003
-						$msg = lang('Alarm added');
1004
-						Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
1003
+							$msg = lang('Alarm added');
1004
+							Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
1005
+						}
1006
+						else
1007
+						{
1008
+							$msg = lang('Error adding the alarm');
1009
+						}
1005 1010
 					}
1006 1011
 					else
1007 1012
 					{
1008
-						$msg = lang('Error adding the alarm');
1013
+						for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
1014
+						$event['alarm'][$alarm['id']] = $alarm;
1009 1015
 					}
1010 1016
 				}
1011 1017
 				else
1012 1018
 				{
1013
-					for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
1014
-					$event['alarm'][$alarm['id']] = $alarm;
1019
+					$msg = lang('Permission denied');
1015 1020
 				}
1016
-			}
1017
-			else
1018
-			{
1019
-				$msg = lang('Permission denied');
1020
-			}
1021
-			break;
1021
+				break;
1022 1022
 		}
1023 1023
 		// add notification-errors, if we have some
1024 1024
 		if (($notification_errors = notifications::errors(true)))
Please login to merge, or discard this patch.
calendar/inc/class.calendar_bo.inc.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1490,13 +1490,13 @@  discard block
 block discarded – undo
1490 1490
 	}
1491 1491
 
1492 1492
 	/**
1493
-	* Converts a participant into a (readable) user- or resource-name
1494
-	*
1495
-	* @param string|int $id id of user or resource
1496
-	* @param string|boolean $use_type =false type-letter or false
1497
-	* @param boolean $append_email =false append email (Name <email>)
1498
-	* @return string with name
1499
-	*/
1493
+	 * Converts a participant into a (readable) user- or resource-name
1494
+	 *
1495
+	 * @param string|int $id id of user or resource
1496
+	 * @param string|boolean $use_type =false type-letter or false
1497
+	 * @param boolean $append_email =false append email (Name <email>)
1498
+	 * @return string with name
1499
+	 */
1500 1500
 	function participant_name($id,$use_type=false, $append_email=false)
1501 1501
 	{
1502 1502
 		static $id2lid = array();
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
 	}
1526 1526
 
1527 1527
 	/**
1528
-	* Converts participants array of an event into array of (readable) participant-names with status
1529
-	*
1530
-	* @param array $event event-data
1531
-	* @param boolean $long_status =false should the long/verbose status or an icon be use
1532
-	* @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default)
1533
-	* @return array with id / names with status pairs
1534
-	*/
1528
+	 * Converts participants array of an event into array of (readable) participant-names with status
1529
+	 *
1530
+	 * @param array $event event-data
1531
+	 * @param boolean $long_status =false should the long/verbose status or an icon be use
1532
+	 * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default)
1533
+	 * @return array with id / names with status pairs
1534
+	 */
1535 1535
 	function participants($event,$long_status=false,$show_group_invitation=false)
1536 1536
 	{
1537 1537
 		//error_log(__METHOD__.__LINE__.array2string($event['participants']));
@@ -1601,12 +1601,12 @@  discard block
 block discarded – undo
1601 1601
 	}
1602 1602
 
1603 1603
 	/**
1604
-	* Converts category string of an event into array of (readable) category-names
1605
-	*
1606
-	* @param string $category cat-id (multiple id's commaseparated)
1607
-	* @param int $color color of the category, if multiple cats, the color of the last one with color is returned
1608
-	* @return array with id / names
1609
-	*/
1604
+	 * Converts category string of an event into array of (readable) category-names
1605
+	 *
1606
+	 * @param string $category cat-id (multiple id's commaseparated)
1607
+	 * @param int $color color of the category, if multiple cats, the color of the last one with color is returned
1608
+	 * @return array with id / names
1609
+	 */
1610 1610
 	function categories($category,&$color)
1611 1611
 	{
1612 1612
 		static $id2cat = array();
Please login to merge, or discard this patch.