Completed
Push — master ( aa44e9...fa84e5 )
by Ralf
90:14 queued 73:21
created
calendar/inc/class.calendar_uiforms.inc.php 1 patch
Switch Indentation   +229 added lines, -229 removed lines patch added patch discarded remove patch
@@ -557,214 +557,214 @@  discard block
 block discarded – undo
557 557
 
558 558
 		switch((string)$button)
559 559
 		{
560
-		case 'exception':	// create an exception in a recuring event
561
-			$msg = $this->_create_exception($event,$preserv);
562
-			break;
560
+			case 'exception':	// create an exception in a recuring event
561
+				$msg = $this->_create_exception($event,$preserv);
562
+				break;
563 563
 
564
-		case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
565
-			unset($event['id']);
566
-			unset($event['uid']);
567
-			unset($event['reference']);
568
-			unset($preserv['reference']);
569
-			unset($event['recurrence']);
570
-			unset($preserv['recurrence']);
571
-			unset($event['recur_exception']);
572
-			unset($event['edit_single']);	// in case it has been set
573
-			unset($event['modified']);
574
-			unset($event['modifier']);
575
-			unset($event['caldav_name']);
576
-			$event['owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD,0,$this->owner) ? $this->user : $this->owner;
564
+			case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
565
+				unset($event['id']);
566
+				unset($event['uid']);
567
+				unset($event['reference']);
568
+				unset($preserv['reference']);
569
+				unset($event['recurrence']);
570
+				unset($preserv['recurrence']);
571
+				unset($event['recur_exception']);
572
+				unset($event['edit_single']);	// in case it has been set
573
+				unset($event['modified']);
574
+				unset($event['modifier']);
575
+				unset($event['caldav_name']);
576
+				$event['owner'] = !(int)$this->owner || !$this->bo->check_perms(Acl::ADD,0,$this->owner) ? $this->user : $this->owner;
577
+
578
+				// Clear participant stati
579
+				foreach($event['participant_types'] as $type => &$participants)
580
+				{
581
+					foreach($participants as $id => &$p_response)
582
+					{
583
+						if($type == 'u' && $id == $event['owner']) continue;
584
+						calendar_so::split_status($p_response, $quantity, $role);
585
+						// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
586
+						$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
587
+						$p_response = calendar_so::combine_status($status,$quantity,$role);
588
+					}
589
+				}
577 590
 
578
-			// Clear participant stati
579
-			foreach($event['participant_types'] as $type => &$participants)
580
-			{
581
-				foreach($participants as $id => &$p_response)
591
+				// Copy alarms
592
+				if (is_array($event['alarm']))
582 593
 				{
583
-					if($type == 'u' && $id == $event['owner']) continue;
584
-					calendar_so::split_status($p_response, $quantity, $role);
585
-					// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
586
-					$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
587
-					$p_response = calendar_so::combine_status($status,$quantity,$role);
594
+					foreach($event['alarm'] as $n => &$alarm)
595
+					{
596
+						unset($alarm['id']);
597
+						unset($alarm['cal_id']);
598
+					}
588 599
 				}
589
-			}
590 600
 
591
-			// Copy alarms
592
-			if (is_array($event['alarm']))
593
-			{
594
-				foreach($event['alarm'] as $n => &$alarm)
601
+				// Get links to be copied
602
+				// With no ID, $content['link_to']['to_id'] is used
603
+				$content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0);
604
+				foreach(Link::get_links('calendar', $content['id']) as $link)
595 605
 				{
596
-					unset($alarm['id']);
597
-					unset($alarm['cal_id']);
606
+					if ($link['app'] != Link::VFS_APPNAME)
607
+					{
608
+						Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
609
+					}
610
+					elseif ($link['app'] == Link::VFS_APPNAME)
611
+					{
612
+						Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
613
+							'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
614
+							'name' => $link['id'],
615
+						), $link['remark']);
616
+					}
598 617
 				}
599
-			}
618
+				unset($link);
619
+				$preserv['view'] = $preserv['edit_single'] = false;
620
+				$msg = lang('Event copied - the copy can now be edited');
621
+				$event['title'] = lang('Copy of:').' '.$event['title'];
622
+				break;
600 623
 
601
-			// Get links to be copied
602
-			// With no ID, $content['link_to']['to_id'] is used
603
-			$content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0);
604
-			foreach(Link::get_links('calendar', $content['id']) as $link)
605
-			{
606
-				if ($link['app'] != Link::VFS_APPNAME)
624
+			case 'mail':
625
+			case 'sendrequest':
626
+			case 'save':
627
+			case 'print':
628
+			case 'apply':
629
+			case 'infolog':
630
+				if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
607 631
 				{
608
-					Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
632
+					$msg = lang('Permission denied');
633
+					$button = '';
634
+					break;
609 635
 				}
610
-				elseif ($link['app'] == Link::VFS_APPNAME)
636
+				if ($event['start'] > $event['end'])
611 637
 				{
612
-					Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
613
-						'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
614
-						'name' => $link['id'],
615
-					), $link['remark']);
638
+					$msg = lang('Error: Starttime has to be before the endtime !!!');
639
+					$button = '';
640
+					break;
616 641
 				}
617
-			}
618
-			unset($link);
619
-			$preserv['view'] = $preserv['edit_single'] = false;
620
-			$msg = lang('Event copied - the copy can now be edited');
621
-			$event['title'] = lang('Copy of:').' '.$event['title'];
622
-			break;
623
-
624
-		case 'mail':
625
-		case 'sendrequest':
626
-		case 'save':
627
-		case 'print':
628
-		case 'apply':
629
-		case 'infolog':
630
-			if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
631
-			{
632
-				$msg = lang('Permission denied');
633
-				$button = '';
634
-				break;
635
-			}
636
-			if ($event['start'] > $event['end'])
637
-			{
638
-				$msg = lang('Error: Starttime has to be before the endtime !!!');
639
-				$button = '';
640
-				break;
641
-			}
642
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
643
-			{
644
-				$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
645
-				$button = '';
646
-				break;
647
-			}
648
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
649
-			{
650
-				$msg = lang('Error: Duration of event longer then recurrence interval!');
651
-				$button = '';
652
-				break;
653
-			}
654
-			if (!$event['participants'])
655
-			{
656
-				$msg = lang('Error: no participants selected !!!');
657
-				$button = '';
658
-				break;
659
-			}
660
-			// if private event with ressource reservation is forbidden
661
-			if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
662
-			{
663
-				foreach (array_keys($event['participants']) as $uid)
642
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
664 643
 				{
665
-					if ($uid[0] == 'r') //ressource detection
644
+					$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
645
+					$button = '';
646
+					break;
647
+				}
648
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
649
+				{
650
+					$msg = lang('Error: Duration of event longer then recurrence interval!');
651
+					$button = '';
652
+					break;
653
+				}
654
+				if (!$event['participants'])
655
+				{
656
+					$msg = lang('Error: no participants selected !!!');
657
+					$button = '';
658
+					break;
659
+				}
660
+				// if private event with ressource reservation is forbidden
661
+				if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
662
+				{
663
+					foreach (array_keys($event['participants']) as $uid)
666 664
 					{
667
-						$msg = lang('Error: ressources reservation in private events is not allowed!!!');
668
-						$button = '';
669
-						break 2; //break foreach and case
665
+						if ($uid[0] == 'r') //ressource detection
666
+						{
667
+							$msg = lang('Error: ressources reservation in private events is not allowed!!!');
668
+							$button = '';
669
+							break 2; //break foreach and case
670
+						}
670 671
 					}
671 672
 				}
672
-			}
673
-			if ($content['edit_single'])	// we edited a single event from a series
674
-			{
675
-				$event['reference'] = $event['id'];
676
-				$event['recurrence'] = $content['edit_single'];
677
-				unset($event['id']);
678
-				$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
679
-				if (!is_array($conflicts) && $conflicts)
673
+				if ($content['edit_single'])	// we edited a single event from a series
680 674
 				{
681
-					// now we need to add the original start as recur-execption to the series
682
-					$recur_event = $this->bo->read($event['reference']);
683
-					$recur_event['recur_exception'][] = $content['edit_single'];
684
-					// check if we need to move the alarms, because they are next on that exception
685
-					foreach($recur_event['alarm'] as $id => $alarm)
675
+					$event['reference'] = $event['id'];
676
+					$event['recurrence'] = $content['edit_single'];
677
+					unset($event['id']);
678
+					$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
679
+					if (!is_array($conflicts) && $conflicts)
686 680
 					{
687
-						if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
681
+						// now we need to add the original start as recur-execption to the series
682
+						$recur_event = $this->bo->read($event['reference']);
683
+						$recur_event['recur_exception'][] = $content['edit_single'];
684
+						// check if we need to move the alarms, because they are next on that exception
685
+						foreach($recur_event['alarm'] as $id => $alarm)
688 686
 						{
689
-							$rrule = calendar_rrule::event2rrule($recur_event, true);
690
-							foreach ($rrule as $time)
687
+							if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
691 688
 							{
692
-								if ($content['edit_single'] < $time->format('ts'))
689
+								$rrule = calendar_rrule::event2rrule($recur_event, true);
690
+								foreach ($rrule as $time)
693 691
 								{
694
-									$alarm['time'] = $time->format('ts') - $alarm['offset'];
695
-									$this->bo->save_alarm($event['reference'], $alarm);
696
-									break;
692
+									if ($content['edit_single'] < $time->format('ts'))
693
+									{
694
+										$alarm['time'] = $time->format('ts') - $alarm['offset'];
695
+										$this->bo->save_alarm($event['reference'], $alarm);
696
+										break;
697
+									}
697 698
 								}
698 699
 							}
699 700
 						}
700
-					}
701
-					unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
702
-					unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
703
-					$this->bo->update($recur_event,true);	// no conflict check here
701
+						unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
702
+						unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
703
+						$this->bo->update($recur_event,true);	// no conflict check here
704 704
 
705
-					if(Api\Json\Response::isJSONResponse())
705
+						if(Api\Json\Response::isJSONResponse())
706
+						{
707
+							// Sending null will trigger a removal of the original
708
+							// for that date
709
+							Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
710
+						}
711
+
712
+						unset($recur_event);
713
+						unset($event['edit_single']);			// if we further edit it, it's just a single event
714
+						unset($preserv['edit_single']);
715
+					}
716
+					else	// conflict or error, we need to reset everything to the state befor we tried to save it
706 717
 					{
707
-						// Sending null will trigger a removal of the original
708
-						// for that date
709
-						Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
718
+						$event['id'] = $event['reference'];
719
+						$event['reference'] = $event['recurrence'] = 0;
720
+						$event['uid'] = $content['uid'];
710 721
 					}
711
-
712
-					unset($recur_event);
713
-					unset($event['edit_single']);			// if we further edit it, it's just a single event
714
-					unset($preserv['edit_single']);
715
-				}
716
-				else	// conflict or error, we need to reset everything to the state befor we tried to save it
717
-				{
718
-					$event['id'] = $event['reference'];
719
-					$event['reference'] = $event['recurrence'] = 0;
720
-					$event['uid'] = $content['uid'];
722
+					$update_type = 'edit';
721 723
 				}
722
-				$update_type = 'edit';
723
-			}
724
-			else	// we edited a non-reccuring event or the whole series
725
-			{
726
-				if (($old_event = $this->bo->read($event['id'])))
724
+				else	// we edited a non-reccuring event or the whole series
727 725
 				{
728
-					if ($event['recur_type'] != MCAL_RECUR_NONE)
726
+					if (($old_event = $this->bo->read($event['id'])))
729 727
 					{
730
-						$update_type = 'edit';
731
-
732
-						// we edit a existing series event
733
-						if ($event['start'] != $old_event['start'] ||
734
-							$event['whole_day'] != $old_event['whole_day'] ||
735
-							$event['end'] != $old_event['end'])
728
+						if ($event['recur_type'] != MCAL_RECUR_NONE)
736 729
 						{
737
-							// calculate offset against old series start or clicked recurrance,
738
-							// depending on which is smaller
739
-							$offset = $event['start'] - $old_event['start'];
740
-							if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
741
-							{
742
-								$offset = $off2;
743
-							}
744
-							$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
745
-							if($msg)
730
+							$update_type = 'edit';
731
+
732
+							// we edit a existing series event
733
+							if ($event['start'] != $old_event['start'] ||
734
+								$event['whole_day'] != $old_event['whole_day'] ||
735
+								$event['end'] != $old_event['end'])
746 736
 							{
747
-								$noerror = false;
737
+								// calculate offset against old series start or clicked recurrance,
738
+								// depending on which is smaller
739
+								$offset = $event['start'] - $old_event['start'];
740
+								if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
741
+								{
742
+									$offset = $off2;
743
+								}
744
+								$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
745
+								if($msg)
746
+								{
747
+									$noerror = false;
748
+								}
748 749
 							}
749 750
 						}
750
-					}
751
-					else
752
-					{
753
-						if ($old_event['start'] != $event['start'] ||
754
-							$old_event['end'] != $event['end'] ||
755
-							$event['whole_day'] != $old_event['whole_day'])
751
+						else
756 752
 						{
757
-							$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
758
-							foreach((array)$event['participants'] as $uid => $status)
753
+							if ($old_event['start'] != $event['start'] ||
754
+								$old_event['end'] != $event['end'] ||
755
+								$event['whole_day'] != $old_event['whole_day'])
759 756
 							{
760
-								$q = $r = null;
761
-								calendar_so::split_status($status,$q,$r);
762
-								if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
757
+								$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));
758
+								foreach((array)$event['participants'] as $uid => $status)
763 759
 								{
764
-									$preferences = CreateObject('phpgwapi.preferences',$uid);
765
-									$part_prefs = $preferences->read_repository();
766
-									switch ($part_prefs['calendar']['reset_stati'])
760
+									$q = $r = null;
761
+									calendar_so::split_status($status,$q,$r);
762
+									if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U')
767 763
 									{
764
+										$preferences = CreateObject('phpgwapi.preferences',$uid);
765
+										$part_prefs = $preferences->read_repository();
766
+										switch ($part_prefs['calendar']['reset_stati'])
767
+										{
768 768
 										case 'no':
769 769
 											break;
770 770
 										case 'startday':
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 											$status_reset_to_unknown = true;
774 774
 											$event['participants'][$uid] = calendar_so::combine_status('U',$q,$r);
775 775
 											// todo: report reset status to user
776
-									}
776
+										}
777 777
 								}
778 778
 							}
779 779
 							// check if we need to move the alarms, because they are relative
@@ -910,83 +910,83 @@  discard block
 block discarded – undo
910 910
 			}
911 911
 			break;
912 912
 
913
-		case 'cancel':
914
-			if($content['cancel_needs_refresh'])
915
-			{
916
-				Framework::refresh_opener($msg, 'calendar');
917
-			}
918
-			break;
919
-
920
-		case 'delete':					// delete of event (regular or series)
921
-			$exceptions_kept = null;
922
-			if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
923
-				$content['delete_exceptions'] == 'true', $exceptions_kept))
924
-			{
925
-				if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
913
+			case 'cancel':
914
+				if($content['cancel_needs_refresh'])
926 915
 				{
927
-					$msg = lang('Series deleted');
928
-					if ($exceptions_kept) $msg .= lang(', exceptions preserved');
916
+					Framework::refresh_opener($msg, 'calendar');
929 917
 				}
930
-				else
918
+				break;
919
+
920
+			case 'delete':					// delete of event (regular or series)
921
+				$exceptions_kept = null;
922
+				if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
923
+					$content['delete_exceptions'] == 'true', $exceptions_kept))
931 924
 				{
932
-					$msg = lang('Event deleted');
933
-				}
925
+					if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
926
+					{
927
+						$msg = lang('Series deleted');
928
+						if ($exceptions_kept) $msg .= lang(', exceptions preserved');
929
+					}
930
+					else
931
+					{
932
+						$msg = lang('Event deleted');
933
+					}
934 934
 
935
-			}
936
-			break;
935
+				}
936
+				break;
937 937
 
938
-		case 'freetime':
939
-			// the "click" has to be in onload, to make sure the button is already created
940
-			$event['button_was'] = $button;
941
-			break;
938
+			case 'freetime':
939
+				// the "click" has to be in onload, to make sure the button is already created
940
+				$event['button_was'] = $button;
941
+				break;
942 942
 
943
-		case 'add_alarm':
944
-			$time = $content['start'];
945
-			$offset = $time - $content['new_alarm']['date'];
946
-			if ($event['recur_type'] != MCAL_RECUR_NONE &&
947
-				($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
948
-				$time < $next_occurrence['start'])
949
-			{
950
-				$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
951
-			}
952
-			if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
953
-			{
954
-				$alarm = array(
955
-					'offset' => $offset,
956
-					'time'   => $content['new_alarm']['date'],
957
-					'all'    => !$content['new_alarm']['owner'],
958
-					'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
959
-				);
960
-				if ($alarm['time'] < $this->bo->now_su)
943
+			case 'add_alarm':
944
+				$time = $content['start'];
945
+				$offset = $time - $content['new_alarm']['date'];
946
+				if ($event['recur_type'] != MCAL_RECUR_NONE &&
947
+					($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
948
+					$time < $next_occurrence['start'])
961 949
 				{
962
-					$msg = lang("Can't add alarms in the past !!!");
950
+					$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
963 951
 				}
964
-				elseif ($event['id'])	// save the alarm immediatly
952
+				if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
965 953
 				{
966
-					if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
954
+					$alarm = array(
955
+						'offset' => $offset,
956
+						'time'   => $content['new_alarm']['date'],
957
+						'all'    => !$content['new_alarm']['owner'],
958
+						'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
959
+					);
960
+					if ($alarm['time'] < $this->bo->now_su)
961
+					{
962
+						$msg = lang("Can't add alarms in the past !!!");
963
+					}
964
+					elseif ($event['id'])	// save the alarm immediatly
967 965
 					{
968
-						$alarm['id'] = $alarm_id;
969
-						$event['alarm'][$alarm_id] = $alarm;
966
+						if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
967
+						{
968
+							$alarm['id'] = $alarm_id;
969
+							$event['alarm'][$alarm_id] = $alarm;
970 970
 
971
-						$msg = lang('Alarm added');
972
-						Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
971
+							$msg = lang('Alarm added');
972
+							Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
973
+						}
974
+						else
975
+						{
976
+							$msg = lang('Error adding the alarm');
977
+						}
973 978
 					}
974 979
 					else
975 980
 					{
976
-						$msg = lang('Error adding the alarm');
981
+						for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
982
+						$event['alarm'][$alarm['id']] = $alarm;
977 983
 					}
978 984
 				}
979 985
 				else
980 986
 				{
981
-					for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
982
-					$event['alarm'][$alarm['id']] = $alarm;
987
+					$msg = lang('Permission denied');
983 988
 				}
984
-			}
985
-			else
986
-			{
987
-				$msg = lang('Permission denied');
988
-			}
989
-			break;
989
+				break;
990 990
 		}
991 991
 		// add notification-errors, if we have some
992 992
 		if (($notification_errors = notifications::errors(true)))
Please login to merge, or discard this patch.
api/src/Vfs/WebDAV.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -171,16 +171,16 @@
 block discarded – undo
171 171
 
172 172
         if (is_dir($source)) { // resource is a collection
173 173
             switch ($options["depth"]) {
174
-            case "infinity": // valid
175
-                break;
176
-            case "0": // valid for COPY only
177
-                if ($del) { // MOVE?
178
-                    return "400 Bad request";
179
-                }
180
-                break;
181
-            case "1": // invalid for both COPY and MOVE
182
-            default:
183
-                return "400 Bad request";
174
+            	case "infinity": // valid
175
+                	break;
176
+            	case "0": // valid for COPY only
177
+                	if ($del) { // MOVE?
178
+                    	return "400 Bad request";
179
+                	}
180
+                	break;
181
+            	case "1": // invalid for both COPY and MOVE
182
+            	default:
183
+                	return "400 Bad request";
184 184
             }
185 185
         }
186 186
 
Please login to merge, or discard this patch.
api/src/WebDAV/Tools/_parse_lockinfo.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -179,16 +179,16 @@
 block discarded – undo
179 179
         } else if ($ns == "DAV:") {
180 180
             // parse only the essential tags
181 181
             switch ($tag) {
182
-            case "write":
183
-                $this->locktype = $tag;
184
-                break;
185
-            case "exclusive":
186
-            case "shared":
187
-                $this->lockscope = $tag;
188
-                break;
189
-            case "owner":
190
-                $this->collect_owner = true;
191
-                break;
182
+            	case "write":
183
+                	$this->locktype = $tag;
184
+                	break;
185
+            	case "exclusive":
186
+            	case "shared":
187
+                	$this->lockscope = $tag;
188
+                	break;
189
+            	case "owner":
190
+                	$this->collect_owner = true;
191
+                	break;
192 192
             }
193 193
         }
194 194
     }
Please login to merge, or discard this patch.
api/src/WebDAV/Server.php 1 patch
Switch Indentation   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -816,34 +816,34 @@  discard block
 block discarded – undo
816 816
 	            	// this can happen if we have allprop and prop in one propfind:
817 817
 	            	// <allprop /><prop><blah /></prop>, eg. blah is not automatic returned by allprop
818 818
 	                switch(is_array($props) ? $props[0] : $props) {
819
-	                case "all":
820
-	                    // nothing to remove
821
-	                    break;
822
-
823
-	                case "names":
824
-	                    // only the names of all existing properties were requested
825
-	                    // so we remove all values
826
-	                    unset($prop["val"]);
827
-	                    break;
828
-
829
-	                default:
830
-	                    $found = false;
831
-
832
-	                    // search property name in requested properties
833
-	                    foreach ((array)$props as $reqprop) {
834
-	                        if (   $reqprop["name"]  == $prop["name"]
835
-	                               && @$reqprop["xmlns"] == $prop["ns"]) {
836
-	                            $found = true;
837
-	                            break;
838
-	                        }
839
-	                    }
840
-
841
-	                    // unset property and continue with next one if not found/requested
842
-	                    if (!$found) {
843
-	                        $prop="";
844
-	                        continue(2);
845
-	                    }
846
-	                    break;
819
+	                	case "all":
820
+	                    	// nothing to remove
821
+	                    	break;
822
+
823
+	                	case "names":
824
+	                    	// only the names of all existing properties were requested
825
+	                    	// so we remove all values
826
+	                    	unset($prop["val"]);
827
+	                    	break;
828
+
829
+	                	default:
830
+	                    	$found = false;
831
+
832
+	                    	// search property name in requested properties
833
+	                    	foreach ((array)$props as $reqprop) {
834
+	                        	if (   $reqprop["name"]  == $prop["name"]
835
+	                               	&& @$reqprop["xmlns"] == $prop["ns"]) {
836
+	                            	$found = true;
837
+	                            	break;
838
+	                        	}
839
+	                    	}
840
+
841
+	                    	// unset property and continue with next one if not found/requested
842
+	                    	if (!$found) {
843
+	                        	$prop="";
844
+	                        	continue(2);
845
+	                    	}
846
+	                    	break;
847 847
 	                }
848 848
 
849 849
 	                // namespace handling
@@ -964,49 +964,49 @@  discard block
 block discarded – undo
964 964
                     } else if ($prop["ns"] == "DAV:") {
965 965
                         // some WebDAV properties need special treatment
966 966
                         switch ($prop["name"]) {
967
-                        case "creationdate":
968
-                            echo '     <'.($this->crrnd?'':'D:')."creationdate ns0:dt=\"dateTime.tz\">"
969
-                                . gmdate("Y-m-d\\TH:i:s\\Z", $prop['val'])
970
-                                . '</'.($this->crrnd?'':'D:')."creationdate>\n";
971
-                            break;
972
-                        case "getlastmodified":
973
-                            echo '     <'.($this->crrnd?'':'D:')."getlastmodified ns0:dt=\"dateTime.rfc1123\">"
974
-                                . gmdate("D, d M Y H:i:s ", $prop['val'])
975
-                                . "GMT</".($this->crrnd?'':'D:')."getlastmodified>\n";
976
-                            break;
977
-                        case "supportedlock":
978
-                            echo '     <'.($this->crrnd?'':'D:')."supportedlock>$prop[val]</".($this->crrnd?'':'D:')."supportedlock>\n";
979
-                            break;
980
-                        case "lockdiscovery":
981
-                            echo '     <'.($this->crrnd?'':'D:')."lockdiscovery>\n";
982
-                            echo $prop["val"];
983
-                            echo '     </'.($this->crrnd?'':'D:')."lockdiscovery>\n";
984
-                            break;
985
-                        // the following are non-standard Microsoft extensions to the DAV namespace
986
-                        case "lastaccessed":
987
-                            echo '     <'.($this->crrnd?'':'D:')."lastaccessed ns0:dt=\"dateTime.rfc1123\">"
988
-                                . gmdate("D, d M Y H:i:s ", $prop['val'])
989
-                                . 'GMT</'.($this->crrnd?'':'D:')."lastaccessed>\n";
990
-                            break;
991
-                        case "ishidden":
992
-                            echo '     <'.($this->crrnd?'':'D:')."ishidden>"
993
-                                . is_string($prop['val']) ? $prop['val'] : ($prop['val'] ? 'true' : 'false')
994
-                                . '</'.($this->crrnd?'':'D:')."</D:ishidden>\n";
995
-                            break;
996
-                        default:
997
-                        	$ns_defs = '';
998
-                            if (is_array($prop['val']))
999
-                            {
1000
-                            	$hns_hash = $ns_hash;
1001
-                            	$val = $this->_hierarchical_prop_encode($prop['val'], 'DAV:', $ns_defs, $hns_hash);
1002
-                            } elseif (isset($prop['raw'])) {
1003
-                            	$val = $this->_prop_encode('<![CDATA['.$prop['val'].']]>');
1004
-                            } else {
1005
-	                    		$val = $this->_prop_encode(htmlspecialchars($prop['val'], ENT_NOQUOTES, 'utf-8'));
1006
-                            }
1007
-	                        echo '     <'.($this->crrnd?'':'D:')."$prop[name]$ns_defs>$val".
1008
-	                        	'</'.($this->crrnd?'':'D:')."$prop[name]>\n";
1009
-                            break;
967
+                        	case "creationdate":
968
+                            	echo '     <'.($this->crrnd?'':'D:')."creationdate ns0:dt=\"dateTime.tz\">"
969
+                                	. gmdate("Y-m-d\\TH:i:s\\Z", $prop['val'])
970
+                                	. '</'.($this->crrnd?'':'D:')."creationdate>\n";
971
+                            	break;
972
+                        	case "getlastmodified":
973
+                            	echo '     <'.($this->crrnd?'':'D:')."getlastmodified ns0:dt=\"dateTime.rfc1123\">"
974
+                                	. gmdate("D, d M Y H:i:s ", $prop['val'])
975
+                                	. "GMT</".($this->crrnd?'':'D:')."getlastmodified>\n";
976
+                            	break;
977
+                        	case "supportedlock":
978
+                            	echo '     <'.($this->crrnd?'':'D:')."supportedlock>$prop[val]</".($this->crrnd?'':'D:')."supportedlock>\n";
979
+                            	break;
980
+                        	case "lockdiscovery":
981
+                            	echo '     <'.($this->crrnd?'':'D:')."lockdiscovery>\n";
982
+                            	echo $prop["val"];
983
+                            	echo '     </'.($this->crrnd?'':'D:')."lockdiscovery>\n";
984
+                            	break;
985
+                        	// the following are non-standard Microsoft extensions to the DAV namespace
986
+                        	case "lastaccessed":
987
+                            	echo '     <'.($this->crrnd?'':'D:')."lastaccessed ns0:dt=\"dateTime.rfc1123\">"
988
+                                	. gmdate("D, d M Y H:i:s ", $prop['val'])
989
+                                	. 'GMT</'.($this->crrnd?'':'D:')."lastaccessed>\n";
990
+                            	break;
991
+                        	case "ishidden":
992
+                            	echo '     <'.($this->crrnd?'':'D:')."ishidden>"
993
+                                	. is_string($prop['val']) ? $prop['val'] : ($prop['val'] ? 'true' : 'false')
994
+                                	. '</'.($this->crrnd?'':'D:')."</D:ishidden>\n";
995
+                            	break;
996
+                        	default:
997
+                        		$ns_defs = '';
998
+                            	if (is_array($prop['val']))
999
+                            	{
1000
+                            		$hns_hash = $ns_hash;
1001
+                            		$val = $this->_hierarchical_prop_encode($prop['val'], 'DAV:', $ns_defs, $hns_hash);
1002
+                            	} elseif (isset($prop['raw'])) {
1003
+                            		$val = $this->_prop_encode('<![CDATA['.$prop['val'].']]>');
1004
+                            	} else {
1005
+	                    			$val = $this->_prop_encode(htmlspecialchars($prop['val'], ENT_NOQUOTES, 'utf-8'));
1006
+                            	}
1007
+	                        	echo '     <'.($this->crrnd?'':'D:')."$prop[name]$ns_defs>$val".
1008
+	                        		'</'.($this->crrnd?'':'D:')."$prop[name]>\n";
1009
+                            	break;
1010 1010
                         }
1011 1011
                     } else {
1012 1012
                         // allow multiple values and attributes, required eg. for caldav:supported-calendar-component-set
@@ -1761,9 +1761,9 @@  discard block
 block discarded – undo
1761 1761
             foreach ($this->_SERVER as $key => $val) {
1762 1762
                 if (strncmp($key, "HTTP_CONTENT", 11)) continue;
1763 1763
                 switch ($key) {
1764
-                case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11
1765
-		        	switch($this->_SERVER['HTTP_CONTENT_ENCODING'])
1766
-		        	{
1764
+                	case 'HTTP_CONTENT_ENCODING': // RFC 2616 14.11
1765
+		        		switch($this->_SERVER['HTTP_CONTENT_ENCODING'])
1766
+		        		{
1767 1767
 		        		case 'gzip':
1768 1768
 		        		case 'deflate':	//zlib
1769 1769
 		        			if (extension_loaded('zlib')) break;
@@ -1772,67 +1772,67 @@  discard block
 block discarded – undo
1772 1772
 					        $this->http_status('415 Unsupported Media Type');
1773 1773
 					        echo "The service does not support '$val' content encoding";
1774 1774
 					        return;
1775
-		        	}
1775
+		        		}
1776 1776
 		        	break;
1777 1777
 
1778
-                case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12
1779
-                    // we assume it is not critical if this one is ignored
1780
-                    // in the actual PUT implementation ...
1781
-                    $options["content_language"] = $val;
1782
-                    break;
1778
+                	case 'HTTP_CONTENT_LANGUAGE': // RFC 2616 14.12
1779
+                    	// we assume it is not critical if this one is ignored
1780
+                    	// in the actual PUT implementation ...
1781
+                    	$options["content_language"] = $val;
1782
+                    	break;
1783 1783
 
1784
-                case 'HTTP_CONTENT_LENGTH':
1785
-                    // defined on IIS and has the same value as CONTENT_LENGTH
1786
-                    break;
1784
+                	case 'HTTP_CONTENT_LENGTH':
1785
+                    	// defined on IIS and has the same value as CONTENT_LENGTH
1786
+                    	break;
1787 1787
 
1788
-                case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14
1789
-                    /* The meaning of the Content-Location header in PUT
1788
+                	case 'HTTP_CONTENT_LOCATION': // RFC 2616 14.14
1789
+                    	/* The meaning of the Content-Location header in PUT
1790 1790
                      or POST requests is undefined; servers are free
1791 1791
                      to ignore it in those cases. */
1792
-                    break;
1793
-
1794
-                case 'HTTP_CONTENT_RANGE':    // RFC 2616 14.16
1795
-                    // single byte range requests are supported
1796
-                    // the header format is also specified in RFC 2616 14.16
1797
-                    // TODO we have to ensure that implementations support this or send 501 instead
1798
-					$matches = null;
1799
-                    if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $val, $matches)) {
1800
-                        $this->http_status("400 bad request");
1801
-                        echo "The service does only support single byte ranges";
1802
-                        return;
1803
-                    }
1804
-
1805
-                    $range = array("start" => $matches[1], "end" => $matches[2]);
1806
-                    if (is_numeric($matches[3])) {
1807
-                        $range["total_length"] = $matches[3];
1808
-                    }
1809
-
1810
-                    if (!isset($options['ranges'])) {
1811
-                        $options['ranges'] = array();
1812
-                    }
1813
-
1814
-                    $options["ranges"][] = $range;
1815
-
1816
-                    // TODO make sure the implementation supports partial PUT
1817
-                    // this has to be done in advance to avoid data being overwritten
1818
-                    // on implementations that do not support this ...
1819
-                    break;
1820
-
1821
-                case 'HTTP_CONTENT_TYPE':
1822
-                    // defined on IIS and has the same value as CONTENT_TYPE
1823
-                    break;
1824
-
1825
-                case 'HTTP_CONTENT_MD5':      // RFC 2616 14.15
1826
-                    // TODO: maybe we can just pretend here?
1827
-                    $this->http_status("501 not implemented");
1828
-                    echo "The service does not support content MD5 checksum verification";
1829
-                    return;
1830
-
1831
-                default:
1832
-                    // any other unknown Content-* headers
1833
-                    $this->http_status("501 not implemented");
1834
-                    echo "The service does not support '$key'";
1835
-                    return;
1792
+                    	break;
1793
+
1794
+                	case 'HTTP_CONTENT_RANGE':    // RFC 2616 14.16
1795
+                    	// single byte range requests are supported
1796
+                    	// the header format is also specified in RFC 2616 14.16
1797
+                    	// TODO we have to ensure that implementations support this or send 501 instead
1798
+						$matches = null;
1799
+                    	if (!preg_match('@bytes\s+(\d+)-(\d+)/((\d+)|\*)@', $val, $matches)) {
1800
+                        	$this->http_status("400 bad request");
1801
+                        	echo "The service does only support single byte ranges";
1802
+                        	return;
1803
+                    	}
1804
+
1805
+                    	$range = array("start" => $matches[1], "end" => $matches[2]);
1806
+                    	if (is_numeric($matches[3])) {
1807
+                        	$range["total_length"] = $matches[3];
1808
+                    	}
1809
+
1810
+                    	if (!isset($options['ranges'])) {
1811
+                        	$options['ranges'] = array();
1812
+                    	}
1813
+
1814
+                    	$options["ranges"][] = $range;
1815
+
1816
+                    	// TODO make sure the implementation supports partial PUT
1817
+                    	// this has to be done in advance to avoid data being overwritten
1818
+                    	// on implementations that do not support this ...
1819
+                    	break;
1820
+
1821
+                	case 'HTTP_CONTENT_TYPE':
1822
+                    	// defined on IIS and has the same value as CONTENT_TYPE
1823
+                    	break;
1824
+
1825
+                	case 'HTTP_CONTENT_MD5':      // RFC 2616 14.15
1826
+                    	// TODO: maybe we can just pretend here?
1827
+                    	$this->http_status("501 not implemented");
1828
+                    	echo "The service does not support content MD5 checksum verification";
1829
+                    	return;
1830
+
1831
+                	default:
1832
+                    	// any other unknown Content-* headers
1833
+                    	$this->http_status("501 not implemented");
1834
+                    	echo "The service does not support '$key'";
1835
+                    	return;
1836 1836
                 }
1837 1837
             }
1838 1838
 
@@ -2390,34 +2390,34 @@  discard block
 block discarded – undo
2390 2390
 
2391 2391
         // now it depends on what we found
2392 2392
         switch ($c) {
2393
-        case "<":
2394
-            // URIs are enclosed in <...>
2395
-            $pos2 = strpos($string, ">", $pos);
2396
-            $uri  = substr($string, $pos, $pos2 - $pos);
2397
-            $pos  = $pos2 + 1;
2398
-            return array("URI", $uri);
2399
-
2400
-        case "[":
2401
-            //Etags are enclosed in [...]
2402
-            if ($string{$pos} == "W") {
2403
-                $type = "ETAG_WEAK";
2404
-                $pos += 2;
2405
-            } else {
2406
-                $type = "ETAG_STRONG";
2407
-            }
2408
-            $pos2 = strpos($string, "]", $pos);
2409
-            $etag = substr($string, $pos + 1, $pos2 - $pos - 2);
2410
-            $pos  = $pos2 + 1;
2411
-            return array($type, $etag);
2412
-
2413
-        case "N":
2414
-            // "N" indicates negation
2415
-            $pos += 2;
2416
-            return array("NOT", "Not");
2417
-
2418
-        default:
2419
-            // anything else is passed verbatim char by char
2420
-            return array("CHAR", $c);
2393
+        	case "<":
2394
+            	// URIs are enclosed in <...>
2395
+            	$pos2 = strpos($string, ">", $pos);
2396
+            	$uri  = substr($string, $pos, $pos2 - $pos);
2397
+            	$pos  = $pos2 + 1;
2398
+            	return array("URI", $uri);
2399
+
2400
+        	case "[":
2401
+            	//Etags are enclosed in [...]
2402
+            	if ($string{$pos} == "W") {
2403
+                	$type = "ETAG_WEAK";
2404
+                	$pos += 2;
2405
+            	} else {
2406
+                	$type = "ETAG_STRONG";
2407
+            	}
2408
+            	$pos2 = strpos($string, "]", $pos);
2409
+            	$etag = substr($string, $pos + 1, $pos2 - $pos - 2);
2410
+            	$pos  = $pos2 + 1;
2411
+            	return array($type, $etag);
2412
+
2413
+        	case "N":
2414
+            	// "N" indicates negation
2415
+            	$pos += 2;
2416
+            	return array("NOT", "Not");
2417
+
2418
+        	default:
2419
+            	// anything else is passed verbatim char by char
2420
+            	return array("CHAR", $c);
2421 2421
         }
2422 2422
     }
2423 2423
 
@@ -2461,33 +2461,33 @@  discard block
 block discarded – undo
2461 2461
                     continue;
2462 2462
                 }
2463 2463
                 switch ($token[0]) {
2464
-                case "CHAR":
2465
-                    switch ($token[1]) {
2466
-                    case "(":
2467
-                        $level++;
2468
-                        break;
2469
-                    case ")":
2470
-                        $level--;
2471
-                        break;
2472
-                    default:
2473
-                        return false;
2474
-                    }
2464
+                	case "CHAR":
2465
+                    	switch ($token[1]) {
2466
+                    		case "(":
2467
+                        		$level++;
2468
+                        		break;
2469
+                    		case ")":
2470
+                        		$level--;
2471
+                        		break;
2472
+                    		default:
2473
+                        		return false;
2474
+                    	}
2475 2475
                     break;
2476 2476
 
2477
-                case "URI":
2478
-                    $list[] = $not."<$token[1]>";
2479
-                    break;
2477
+                	case "URI":
2478
+                    	$list[] = $not."<$token[1]>";
2479
+                    	break;
2480 2480
 
2481
-                case "ETAG_WEAK":
2482
-                    $list[] = $not."[W/'$token[1]']>";
2483
-                    break;
2481
+                	case "ETAG_WEAK":
2482
+                    	$list[] = $not."[W/'$token[1]']>";
2483
+                    	break;
2484 2484
 
2485
-                case "ETAG_STRONG":
2486
-                    $list[] = $not."['$token[1]']>";
2487
-                    break;
2485
+                	case "ETAG_STRONG":
2486
+                    	$list[] = $not."['$token[1]']>";
2487
+                    	break;
2488 2488
 
2489
-                default:
2490
-                    return false;
2489
+                	default:
2490
+                    	return false;
2491 2491
                 }
2492 2492
                 $not = "";
2493 2493
             }
Please login to merge, or discard this patch.
api/src/WebDAV/Server/Filesystem.php 1 patch
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -365,18 +365,18 @@  discard block
 block discarded – undo
365 365
             //       the registry)
366 366
             // TODO: have a seperate PEAR class for mimetype detection?
367 367
             switch (strtolower(strrchr(basename($fspath), "."))) {
368
-            case ".html":
369
-                $mime_type = "text/html";
370
-                break;
371
-            case ".gif":
372
-                $mime_type = "image/gif";
373
-                break;
374
-            case ".jpg":
375
-                $mime_type = "image/jpeg";
376
-                break;
377
-            default:
378
-                $mime_type = "application/octet-stream";
379
-                break;
368
+            	case ".html":
369
+                	$mime_type = "text/html";
370
+                	break;
371
+            	case ".gif":
372
+                	$mime_type = "image/gif";
373
+                	break;
374
+            	case ".jpg":
375
+                	$mime_type = "image/jpeg";
376
+                	break;
377
+            	default:
378
+                	$mime_type = "application/octet-stream";
379
+                	break;
380 380
             }
381 381
         }
382 382
 
@@ -633,16 +633,16 @@  discard block
 block discarded – undo
633 633
 
634 634
         if (is_dir($source)) { // resource is a collection
635 635
             switch ($options["depth"]) {
636
-            case "infinity": // valid
637
-                break;
638
-            case "0": // valid for COPY only
639
-                if ($del) { // MOVE?
640
-                    return "400 Bad request";
641
-                }
642
-                break;
643
-            case "1": // invalid for both COPY and MOVE
644
-            default:
645
-                return "400 Bad request";
636
+            	case "infinity": // valid
637
+                	break;
638
+            	case "0": // valid for COPY only
639
+                	if ($del) { // MOVE?
640
+                    	return "400 Bad request";
641
+                	}
642
+                	break;
643
+            	case "1": // invalid for both COPY and MOVE
644
+            	default:
645
+                	return "400 Bad request";
646 646
             }
647 647
         }
648 648
 
Please login to merge, or discard this patch.
api/src/Mail/Imap.php 1 patch
Switch Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -580,16 +580,16 @@  discard block
 block discarded – undo
580 580
 		$mailbox = '';
581 581
 		if ( is_int( $restriction_search ) ){
582 582
 			switch ( $restriction_search ) {
583
-			case 0:
584
-				$searchstring = $reference."*";
585
-				break;
586
-			case 1:
587
-				$mailbox = $searchstring = $reference;
588
-				//$reference = '%';
589
-				break;
590
-			case 2:
591
-				$searchstring = $reference."%";
592
-				break;
583
+				case 0:
584
+					$searchstring = $reference."*";
585
+					break;
586
+				case 1:
587
+					$mailbox = $searchstring = $reference;
588
+					//$reference = '%';
589
+					break;
590
+				case 2:
591
+					$searchstring = $reference."%";
592
+					break;
593 593
 			}
594 594
 		}else{
595 595
 			if ( is_string( $restriction_search ) ){
@@ -664,16 +664,16 @@  discard block
 block discarded – undo
664 664
 		$mailbox = '';
665 665
 		if ( is_int( $restriction_search ) ){
666 666
 			switch ( $restriction_search ) {
667
-			case 0:
668
-				$searchstring = $reference."*";
669
-				break;
670
-			case 1:
671
-				$mailbox = $searchstring = $reference;
672
-				//$reference = '%';
673
-				break;
674
-			case 2:
675
-				$searchstring = $reference."%";
676
-				break;
667
+				case 0:
668
+					$searchstring = $reference."*";
669
+					break;
670
+				case 1:
671
+					$mailbox = $searchstring = $reference;
672
+					//$reference = '%';
673
+					break;
674
+				case 2:
675
+					$searchstring = $reference."%";
676
+					break;
677 677
 			}
678 678
 		}else{
679 679
 			if ( is_string( $restriction_search ) ){
@@ -730,16 +730,16 @@  discard block
 block discarded – undo
730 730
 
731 731
 		if ( is_int( $restriction_search ) ){
732 732
 			switch ( $restriction_search ) {
733
-			case 0:
734
-				$mailbox = $reference."*";
735
-				break;
736
-			case 1:
737
-				$mailbox = $reference;
738
-				$reference = '%';
739
-				break;
740
-			case 2:
741
-				$mailbox = "%";
742
-				break;
733
+				case 0:
734
+					$mailbox = $reference."*";
735
+					break;
736
+				case 1:
737
+					$mailbox = $reference;
738
+					$reference = '%';
739
+					break;
740
+				case 2:
741
+					$mailbox = "%";
742
+					break;
743 743
 			}
744 744
 		}else{
745 745
 			if ( is_string( $restriction_search ) ){
Please login to merge, or discard this patch.
setup/setup-cli.php 1 patch
Switch Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -68,91 +68,91 @@
 block discarded – undo
68 68
 
69 69
 switch($action)
70 70
 {
71
-	case '--version':
72
-	case '--check':
73
-		setup_cmd::check_installed($arguments[0],0,true);
74
-		break;
75
-
76
-	case '--create-header':
77
-	case '--edit-header':
78
-	case '--upgrade-header':
79
-	case '--update-header':
80
-		do_header($action == '--create-header',$arguments);
81
-		break;
82
-
83
-	case '--install':
84
-		do_install($arguments);
85
-		break;
86
-
87
-	case '--config':
88
-		do_config($arguments);
89
-		break;
90
-
91
-	case '--admin':
92
-		do_admin($arguments[0]);
93
-		break;
94
-
95
-	case '--update':
96
-		do_update($arguments[0]);
97
-		break;
98
-
99
-	case '--register-hooks':
100
-	case '--register-all-hooks':
101
-		do_hooks($arguments[0]);
102
-		break;
103
-
104
-	case '--backup':
105
-		do_backup($arguments[0]);
106
-		break;
107
-
108
-	case '--languages':
109
-		echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8');
110
-		break;
111
-
112
-	case '--charsets':
113
-		echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n";
114
-		break;
115
-
116
-	case '--exit-codes':
117
-		list_exit_codes();
118
-		break;
119
-
120
-	case '--help':
121
-	case '--usage':
122
-		do_usage($arguments[0]);
123
-		break;
124
-
125
-	default:
126
-		// we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE
127
-		if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) &&
128
-			is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE'))
129
-		{
130
-			$args = array();
131
-			list($args['domain']) = explode(',', array_shift($arguments));	// domain must be first argument, to ensure right domain get's selected in header-include
132
-			foreach($arguments as $arg)
71
+		case '--version':
72
+		case '--check':
73
+			setup_cmd::check_installed($arguments[0],0,true);
74
+			break;
75
+
76
+		case '--create-header':
77
+		case '--edit-header':
78
+		case '--upgrade-header':
79
+		case '--update-header':
80
+			do_header($action == '--create-header',$arguments);
81
+			break;
82
+
83
+		case '--install':
84
+			do_install($arguments);
85
+			break;
86
+
87
+		case '--config':
88
+			do_config($arguments);
89
+			break;
90
+
91
+		case '--admin':
92
+			do_admin($arguments[0]);
93
+			break;
94
+
95
+		case '--update':
96
+			do_update($arguments[0]);
97
+			break;
98
+
99
+		case '--register-hooks':
100
+		case '--register-all-hooks':
101
+			do_hooks($arguments[0]);
102
+			break;
103
+
104
+		case '--backup':
105
+			do_backup($arguments[0]);
106
+			break;
107
+
108
+		case '--languages':
109
+			echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8');
110
+			break;
111
+
112
+		case '--charsets':
113
+			echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n";
114
+			break;
115
+
116
+		case '--exit-codes':
117
+			list_exit_codes();
118
+			break;
119
+
120
+		case '--help':
121
+		case '--usage':
122
+			do_usage($arguments[0]);
123
+			break;
124
+
125
+		default:
126
+			// we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE
127
+			if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) &&
128
+				is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE'))
133 129
 			{
134
-				list($name,$value) = explode('=',$arg,2);
135
-				if(property_exists('admin_cmd',$name))		// dont allow to overwrite admin_cmd properties
136
-				{
137
-					throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90);
138
-				}
139
-				if (substr($name,-1) == ']')	// allow 1-dim. arrays
130
+				$args = array();
131
+				list($args['domain']) = explode(',', array_shift($arguments));	// domain must be first argument, to ensure right domain get's selected in header-include
132
+				foreach($arguments as $arg)
140 133
 				{
141
-					list($name,$sub) = explode('[',substr($name,0,-1),2);
142
-					$args[$name][$sub] = $value;
143
-				}
144
-				else
145
-				{
146
-					$args[$name] = $value;
134
+					list($name,$value) = explode('=',$arg,2);
135
+					if(property_exists('admin_cmd',$name))		// dont allow to overwrite admin_cmd properties
136
+					{
137
+						throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90);
138
+					}
139
+					if (substr($name,-1) == ']')	// allow 1-dim. arrays
140
+					{
141
+						list($name,$sub) = explode('[',substr($name,0,-1),2);
142
+						$args[$name][$sub] = $value;
143
+					}
144
+					else
145
+					{
146
+						$args[$name] = $value;
147
+					}
147 148
 				}
149
+				$cmd = new $class($args);
150
+				$msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run);
151
+				if (is_array($msg)) $msg = print_r($msg,true);
152
+				echo "$msg\n";
153
+				break;
148 154
 			}
149
-			$cmd = new $class($args);
150
-			$msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run);
151
-			if (is_array($msg)) $msg = print_r($msg,true);
152
-			echo "$msg\n";
153
-			break;
154
-		}
155
-		throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90);
155
+			throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90);
156 156
 }
157 157
 exit(0);
158 158
 
Please login to merge, or discard this patch.
setup/index.php 1 patch
Switch Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 
185 185
 switch($GLOBALS['egw_info']['setup']['stage']['db'])
186 186
 {
187
-	case 1:
188
-		$setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error);
189
-		$setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set'));
190
-		$setup_tpl->set_var('notcomplete',lang('not complete'));
191
-		$setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly'));
192
-		$setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>');
193
-		$setup_tpl->set_var('create_database',lang('Create database'));
194
-		$setup_tpl->set_var('instr','');
195
-		$info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain];
196
-		switch ($info['db_type'])
197
-		{
187
+		case 1:
188
+			$setup_tpl->set_var('dbnotexist','<b>'.lang('Your Database is not working!').'</b>: '.$GLOBALS['egw_setup']->db->Error);
189
+			$setup_tpl->set_var('makesure',lang('Make sure that your database is created and the account permissions are set'));
190
+			$setup_tpl->set_var('notcomplete',lang('not complete'));
191
+			$setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly'));
192
+			$setup_tpl->set_var('createdb','<b>'.lang('Or we can attempt to create the database for you:').'</b>');
193
+			$setup_tpl->set_var('create_database',lang('Create database'));
194
+			$setup_tpl->set_var('instr','');
195
+			$info = $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain];
196
+			switch ($info['db_type'])
197
+			{
198 198
 			case 'mysql':
199 199
 			case 'mysqli':
200 200
 			case 'mysqlt':
@@ -227,77 +227,77 @@  discard block
 block discarded – undo
227 227
 				//break;
228 228
 			default:
229 229
 				$setup_tpl->parse('V_db_stage_1','B_db_stage_1a');
230
-		}
230
+			}
231 231
 		$db_filled_block = $setup_tpl->get_var('V_db_stage_1');
232 232
 		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
233 233
 		break;
234
-	case 2:
235
-		$setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.'));
236
-		$setup_tpl->set_var('notcomplete',lang('not complete'));
237
-		$setup_tpl->parse('V_db_stage_2','B_db_stage_2');
238
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_2');
239
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
240
-		break;
241
-	case 3:
242
-		$setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>');
243
-		$setup_tpl->set_var('install',lang('Install'));
244
-		$setup_tpl->set_var('proceed',lang('We can proceed'));
245
-		$setup_tpl->set_var('coreapps',lang('all applications'));
246
-		$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
247
-		$setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.'));
248
-		$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> &nbsp;'.
249
-			'<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />');
250
-		$setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>');
251
-		$setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'.
252
-			lang('Convert backup to charset selected above').'</label>');
253
-		$setup_tpl->parse('V_db_stage_3','B_db_stage_3');
254
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_3');
255
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
256
-		break;
257
-	case 4:
258
-		$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
259
-		$setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare',
260
-			isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver']));
261
-		$setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version']));
262
-		$setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>'));
263
-		$setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB'));
264
-		$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
265
-		$setup_tpl->set_var('upgrade',lang('Upgrade'));
266
-		$setup_tpl->set_var('goto',lang('Go to'));
267
-		$setup_tpl->set_var('configuration',lang('configuration'));
268
-		$setup_tpl->set_var('admin_account',lang('Create admin account'));
269
-		$setup_tpl->set_var('applications',lang('Manage Applications'));
270
-		$setup_tpl->set_var('db_backup',lang('DB backup and restore'));
271
-		$setup_tpl->set_var('language_management',lang('Manage Languages'));
272
-		$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
273
-		$setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data'));
274
-		$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
234
+		case 2:
235
+			$setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of eGroupWare.<br />These versions are no longer supported, and there is no upgrade path for them in setup.<br /> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br />and then upgrade from there with the current version.'));
236
+			$setup_tpl->set_var('notcomplete',lang('not complete'));
237
+			$setup_tpl->parse('V_db_stage_2','B_db_stage_2');
238
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_2');
239
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
240
+			break;
241
+		case 3:
242
+			$setup_tpl->set_var('dbexists','<b>'.lang('Your database is working, but you dont have any applications installed').'</b>');
243
+			$setup_tpl->set_var('install',lang('Install'));
244
+			$setup_tpl->set_var('proceed',lang('We can proceed'));
245
+			$setup_tpl->set_var('coreapps',lang('all applications'));
246
+			$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
247
+			$setup_tpl->set_var('lang_restore',lang('Or you can install a previous backup.'));
248
+			$setup_tpl->set_var('upload','<input type="file" name="uploaded" /> &nbsp;'.
249
+				'<input type="submit" name="upload" value="'.htmlspecialchars(lang('install backup')).'" title="'.htmlspecialchars(lang("uploads a backup and installs it on your DB")).'" />');
250
+			$setup_tpl->set_var('convert_checkbox','<input type="checkbox" name="convert_charset" id="convert_checkbox" value="1"/>');
251
+			$setup_tpl->set_var('lang_convert_charset','<label for="convert_checkbox">'.
252
+				lang('Convert backup to charset selected above').'</label>');
253
+			$setup_tpl->parse('V_db_stage_3','B_db_stage_3');
254
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_3');
255
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
256
+			break;
257
+		case 4:
258
+			$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
259
+			$setup_tpl->set_var('oldver',lang('You appear to be running version %1 of eGroupWare',
260
+				isset($setup_info['api']['currentver']) ? $setup_info['api']['currentver'] : $setup_info['phpgwapi']['currentver']));
261
+			$setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to %1',$setup_info['api']['version']));
262
+			$setup_tpl->set_var('backupwarn',lang('but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br /><strong>These automated scripts can easily destroy your data.</strong>'));
263
+			$setup_tpl->set_var('lang_backup',lang('create a backup before upgrading the DB'));
264
+			$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
265
+			$setup_tpl->set_var('upgrade',lang('Upgrade'));
266
+			$setup_tpl->set_var('goto',lang('Go to'));
267
+			$setup_tpl->set_var('configuration',lang('configuration'));
268
+			$setup_tpl->set_var('admin_account',lang('Create admin account'));
269
+			$setup_tpl->set_var('applications',lang('Manage Applications'));
270
+			$setup_tpl->set_var('db_backup',lang('DB backup and restore'));
271
+			$setup_tpl->set_var('language_management',lang('Manage Languages'));
272
+			$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
273
+			$setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data'));
274
+			$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
275 275
 
276
-		$setup_tpl->parse('V_db_stage_4','B_db_stage_4');
277
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_4');
278
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
279
-		break;
280
-	case 5:
281
-		$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
282
-		$setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?'));
283
-		$setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications'));
284
-		$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
285
-		$setup_tpl->set_var('cancel',lang('cancel'));
286
-		$setup_tpl->parse('V_db_stage_5','B_db_stage_5');
287
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_5');
288
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
289
-		break;
290
-	case 6:
291
-		$setup_tpl->set_var('status',lang('Status'));
292
-		$setup_tpl->set_var('notcomplete',lang('not complete'));
293
-		$setup_tpl->set_var('tblchange',lang('Table Change Messages'));
294
-		$setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre');
295
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre');
296
-		$setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been'));
276
+			$setup_tpl->parse('V_db_stage_4','B_db_stage_4');
277
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_4');
278
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
279
+			break;
280
+		case 5:
281
+			$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
282
+			$setup_tpl->set_var('are_you_sure',lang('ARE YOU SURE?'));
283
+			$setup_tpl->set_var('really_uninstall_all_applications',lang('REALLY Uninstall all applications'));
284
+			$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
285
+			$setup_tpl->set_var('cancel',lang('cancel'));
286
+			$setup_tpl->parse('V_db_stage_5','B_db_stage_5');
287
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_5');
288
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
289
+			break;
290
+		case 6:
291
+			$setup_tpl->set_var('status',lang('Status'));
292
+			$setup_tpl->set_var('notcomplete',lang('not complete'));
293
+			$setup_tpl->set_var('tblchange',lang('Table Change Messages'));
294
+			$setup_tpl->parse('V_db_stage_6_pre','B_db_stage_6_pre');
295
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_6_pre');
296
+			$setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been'));
297 297
 
298
-		try {	// catch DB errors to report them
299
-			switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi'])
300
-			{
298
+			try {	// catch DB errors to report them
299
+				switch ($GLOBALS['egw_info']['setup']['currentver']['phpgwapi'])
300
+				{
301 301
 				case 'dbcreate':
302 302
 					$GLOBALS['egw_setup']->db->create_database($_POST['db_root'], $_POST['db_pass'], 'utf8',	// create all new db's with utf8
303 303
 						!preg_match('/^[0-9.a-z_]+$/i', $_POST['db_grant_host']) ? 'localhost' : $_POST['db_grant_host']);
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 						$GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
377 377
 					}
378 378
 					break;
379
-			}
379
+				}
380 380
 		}
381 381
 		catch (Api\Db\Exception $e)
382 382
 		{
@@ -388,21 +388,21 @@  discard block
 block discarded – undo
388 388
 		$db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_6_post');
389 389
 		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
390 390
 		break;
391
-	case 10:
392
-		$setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current'));
393
-		$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
394
-		$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
395
-		$setup_tpl->set_var('deletetables',lang('Uninstall all applications'));
396
-		$setup_tpl->parse('V_db_stage_10','B_db_stage_10');
397
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_10');
398
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
399
-		break;
400
-	default:
401
-		$setup_tpl->set_var('dbnotexist',lang('Your database does not exist'));
402
-		$setup_tpl->parse('V_db_stage_default','B_db_stage_default');
403
-		$db_filled_block = $setup_tpl->get_var('V_db_stage_default');
404
-		$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
405
-		break;
391
+		case 10:
392
+			$setup_tpl->set_var('tablescurrent',lang('Your eGroupWare API is current'));
393
+			$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
394
+			$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
395
+			$setup_tpl->set_var('deletetables',lang('Uninstall all applications'));
396
+			$setup_tpl->parse('V_db_stage_10','B_db_stage_10');
397
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_10');
398
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
399
+			break;
400
+		default:
401
+			$setup_tpl->set_var('dbnotexist',lang('Your database does not exist'));
402
+			$setup_tpl->parse('V_db_stage_default','B_db_stage_default');
403
+			$db_filled_block = $setup_tpl->get_var('V_db_stage_default');
404
+			$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
405
+			break;
406 406
 }
407 407
 
408 408
 // Config Section
Please login to merge, or discard this patch.