Test Setup Failed
Push — master ( 1bbfb1...65294a )
by Ralf
22:09
created
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/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.
admin/apcu.php 1 patch
Switch Indentation   +284 added lines, -284 removed lines patch added patch discarded remove patch
@@ -344,105 +344,105 @@  discard block
 block discarded – undo
344 344
 
345 345
 	switch ($MYREQUEST['IMG']) {
346 346
 
347
-	case 1:
348
-		$s=$mem['num_seg']*$mem['seg_size'];
349
-		$a=$mem['avail_mem'];
350
-		$x=$y=$size/2;
351
-		$fuzz = 0.000001;
352
-
353
-		// This block of code creates the pie chart.  It is a lot more complex than you
354
-		// would expect because we try to visualize any memory fragmentation as well.
355
-		$angle_from = 0;
356
-		$string_placement=array();
357
-		for($i=0; $i<$mem['num_seg']; $i++) {
358
-			$ptr = 0;
359
-			$free = $mem['block_lists'][$i];
360
-			uasort($free, 'block_sort');
361
-			foreach($free as $block) {
362
-				if($block['offset']!=$ptr) {       // Used block
363
-					$angle_to = $angle_from+($block['offset']-$ptr)/$s;
347
+		case 1:
348
+			$s=$mem['num_seg']*$mem['seg_size'];
349
+			$a=$mem['avail_mem'];
350
+			$x=$y=$size/2;
351
+			$fuzz = 0.000001;
352
+
353
+			// This block of code creates the pie chart.  It is a lot more complex than you
354
+			// would expect because we try to visualize any memory fragmentation as well.
355
+			$angle_from = 0;
356
+			$string_placement=array();
357
+			for($i=0; $i<$mem['num_seg']; $i++) {
358
+				$ptr = 0;
359
+				$free = $mem['block_lists'][$i];
360
+				uasort($free, 'block_sort');
361
+				foreach($free as $block) {
362
+					if($block['offset']!=$ptr) {       // Used block
363
+						$angle_to = $angle_from+($block['offset']-$ptr)/$s;
364
+						if(($angle_to+$fuzz)>1) $angle_to = 1;
365
+						if( ($angle_to*360) - ($angle_from*360) >= 1) {
366
+							fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
367
+							if (($angle_to-$angle_from)>0.05) {
368
+								array_push($string_placement, array($angle_from,$angle_to));
369
+							}
370
+						}
371
+						$angle_from = $angle_to;
372
+					}
373
+					$angle_to = $angle_from+($block['size'])/$s;
364 374
 					if(($angle_to+$fuzz)>1) $angle_to = 1;
365 375
 					if( ($angle_to*360) - ($angle_from*360) >= 1) {
366
-						fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
376
+						fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green);
367 377
 						if (($angle_to-$angle_from)>0.05) {
368 378
 							array_push($string_placement, array($angle_from,$angle_to));
369 379
 						}
370 380
 					}
371 381
 					$angle_from = $angle_to;
382
+					$ptr = $block['offset']+$block['size'];
372 383
 				}
373
-				$angle_to = $angle_from+($block['size'])/$s;
374
-				if(($angle_to+$fuzz)>1) $angle_to = 1;
375
-				if( ($angle_to*360) - ($angle_from*360) >= 1) {
376
-					fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_green);
384
+				if ($ptr < $mem['seg_size']) { // memory at the end
385
+					$angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s;
386
+					if(($angle_to+$fuzz)>1) $angle_to = 1;
387
+					fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
377 388
 					if (($angle_to-$angle_from)>0.05) {
378 389
 						array_push($string_placement, array($angle_from,$angle_to));
379 390
 					}
380 391
 				}
381
-				$angle_from = $angle_to;
382
-				$ptr = $block['offset']+$block['size'];
383 392
 			}
384
-			if ($ptr < $mem['seg_size']) { // memory at the end
385
-				$angle_to = $angle_from + ($mem['seg_size'] - $ptr)/$s;
386
-				if(($angle_to+$fuzz)>1) $angle_to = 1;
387
-				fill_arc($image,$x,$y,$size,$angle_from*360,$angle_to*360,$col_black,$col_red);
388
-				if (($angle_to-$angle_from)>0.05) {
389
-					array_push($string_placement, array($angle_from,$angle_to));
390
-				}
393
+			foreach ($string_placement as $angle) {
394
+				text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0])));
391 395
 			}
392
-		}
393
-		foreach ($string_placement as $angle) {
394
-			text_arc($image,$x,$y,$size,$angle[0]*360,$angle[1]*360,$col_black,bsize($s*($angle[1]-$angle[0])));
395
-		}
396
-		break;
397
-
398
-	case 2:
399
-		$s=$cache['num_hits']+$cache['num_misses'];
400
-		$a=$cache['num_hits'];
396
+			break;
401 397
 
402
-		fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0));
403
-		fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0));
404
-		break;
405
-
406
-	case 3:
407
-		$s=$mem['num_seg']*$mem['seg_size'];
408
-		$a=$mem['avail_mem'];
409
-		$x=130;
410
-		$y=1;
411
-		$j=1;
398
+		case 2:
399
+			$s=$cache['num_hits']+$cache['num_misses'];
400
+			$a=$cache['num_hits'];
412 401
 
413
-		// This block of code creates the bar chart.  It is a lot more complex than you
414
-		// would expect because we try to visualize any memory fragmentation as well.
415
-		for($i=0; $i<$mem['num_seg']; $i++) {
416
-			$ptr = 0;
417
-			$free = $mem['block_lists'][$i];
418
-			uasort($free, 'block_sort');
419
-			foreach($free as $block) {
420
-				if($block['offset']!=$ptr) {       // Used block
421
-					$h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s;
402
+			fill_box($image, 30,$size,50,$s ? (-$a*($size-21)/$s) : 0,$col_black,$col_green,sprintf("%.1f%%",$s ? $cache['num_hits']*100/$s : 0));
403
+			fill_box($image,130,$size,50,$s ? -max(4,($s-$a)*($size-21)/$s) : 0,$col_black,$col_red,sprintf("%.1f%%",$s ? $cache['num_misses']*100/$s : 0));
404
+			break;
405
+
406
+		case 3:
407
+			$s=$mem['num_seg']*$mem['seg_size'];
408
+			$a=$mem['avail_mem'];
409
+			$x=130;
410
+			$y=1;
411
+			$j=1;
412
+
413
+			// This block of code creates the bar chart.  It is a lot more complex than you
414
+			// would expect because we try to visualize any memory fragmentation as well.
415
+			for($i=0; $i<$mem['num_seg']; $i++) {
416
+				$ptr = 0;
417
+				$free = $mem['block_lists'][$i];
418
+				uasort($free, 'block_sort');
419
+				foreach($free as $block) {
420
+					if($block['offset']!=$ptr) {       // Used block
421
+						$h=(GRAPH_SIZE-5)*($block['offset']-$ptr)/$s;
422
+						if ($h>0) {
423
+                                                	$j++;
424
+							if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j);
425
+                                                	else fill_box($image,$x,$y,50,$h,$col_black,$col_red);
426
+                                        	}
427
+						$y+=$h;
428
+					}
429
+					$h=(GRAPH_SIZE-5)*($block['size'])/$s;
422 430
 					if ($h>0) {
423
-                                                $j++;
424
-						if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($block['offset']-$ptr),$j);
425
-                                                else fill_box($image,$x,$y,50,$h,$col_black,$col_red);
426
-                                        }
431
+                                        	$j++;
432
+						if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j);
433
+						else fill_box($image,$x,$y,50,$h,$col_black,$col_green);
434
+                                	}
427 435
 					$y+=$h;
436
+					$ptr = $block['offset']+$block['size'];
428 437
 				}
429
-				$h=(GRAPH_SIZE-5)*($block['size'])/$s;
430
-				if ($h>0) {
431
-                                        $j++;
432
-					if($j<75) fill_box($image,$x,$y,50,$h,$col_black,$col_green,bsize($block['size']),$j);
433
-					else fill_box($image,$x,$y,50,$h,$col_black,$col_green);
434
-                                }
435
-				$y+=$h;
436
-				$ptr = $block['offset']+$block['size'];
437
-			}
438
-			if ($ptr < $mem['seg_size']) { // memory at the end
439
-				$h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s;
440
-				if ($h > 0) {
441
-					fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++);
438
+				if ($ptr < $mem['seg_size']) { // memory at the end
439
+					$h = (GRAPH_SIZE-5) * ($mem['seg_size'] - $ptr) / $s;
440
+					if ($h > 0) {
441
+						fill_box($image,$x,$y,50,$h,$col_black,$col_red,bsize($mem['seg_size']-$ptr),$j++);
442
+					}
442 443
 				}
443 444
 			}
444
-		}
445
-		break;
445
+			break;
446 446
 
447 447
 		case 4:
448 448
 			$s=$cache['num_hits']+$cache['num_misses'];
@@ -769,40 +769,40 @@  discard block
 block discarded – undo
769 769
 // -----------------------------------------------
770 770
 // Host Stats
771 771
 // -----------------------------------------------
772
-case OB_HOST_STATS:
773
-	$mem_size = $mem['num_seg']*$mem['seg_size'];
774
-	$mem_avail= $mem['avail_mem'];
775
-	$mem_used = $mem_size-$mem_avail;
776
-	$seg_size = bsize($mem['seg_size']);
777
-	$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time'])) : 0);
778
-	$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/($time-$cache['start_time'])) : 0);
779
-	$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/($time-$cache['start_time'])) : 0);
780
-	$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/($time-$cache['start_time'])) : 0);
781
-	$apcversion = phpversion('apcu');
782
-	$phpversion = phpversion();
783
-	$number_vars = $cache['num_entries'];
784
-    $size_vars = bsize($cache['mem_size']);
785
-	$i=0;
786
-	echo <<< EOB
772
+	case OB_HOST_STATS:
773
+		$mem_size = $mem['num_seg']*$mem['seg_size'];
774
+		$mem_avail= $mem['avail_mem'];
775
+		$mem_used = $mem_size-$mem_avail;
776
+		$seg_size = bsize($mem['seg_size']);
777
+		$req_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits']+$cache['num_misses'])/($time-$cache['start_time'])) : 0);
778
+		$hit_rate_user = sprintf("%.2f", $cache['num_hits'] ? (($cache['num_hits'])/($time-$cache['start_time'])) : 0);
779
+		$miss_rate_user = sprintf("%.2f", $cache['num_misses'] ? (($cache['num_misses'])/($time-$cache['start_time'])) : 0);
780
+		$insert_rate_user = sprintf("%.2f", $cache['num_inserts'] ? (($cache['num_inserts'])/($time-$cache['start_time'])) : 0);
781
+		$apcversion = phpversion('apcu');
782
+		$phpversion = phpversion();
783
+		$number_vars = $cache['num_entries'];
784
+    	$size_vars = bsize($cache['mem_size']);
785
+		$i=0;
786
+		echo <<< EOB
787 787
 		<div class="info div1"><h2>General Cache Information</h2>
788 788
 		<table cellspacing=0><tbody>
789 789
 		<tr class=tr-0><td class=td-0>APCu Version</td><td>$apcversion</td></tr>
790 790
 		<tr class=tr-1><td class=td-0>PHP Version</td><td>$phpversion</td></tr>
791
-EOB;
791
+	EOB;
792 792
 
793
-	if(!empty($_SERVER['SERVER_NAME']))
794
-		echo "<tr class=tr-0><td class=td-0>APCu Host</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n";
795
-	if(!empty($_SERVER['SERVER_SOFTWARE']))
796
-		echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";
793
+		if(!empty($_SERVER['SERVER_NAME']))
794
+			echo "<tr class=tr-0><td class=td-0>APCu Host</td><td>{$_SERVER['SERVER_NAME']} $host</td></tr>\n";
795
+		if(!empty($_SERVER['SERVER_SOFTWARE']))
796
+			echo "<tr class=tr-1><td class=td-0>Server Software</td><td>{$_SERVER['SERVER_SOFTWARE']}</td></tr>\n";
797 797
 
798
-	echo <<<EOB
799
-		<tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size
798
+		echo <<<EOB
799
+			<tr class=tr-0><td class=td-0>Shared Memory</td><td>{$mem['num_seg']} Segment(s) with $seg_size
800 800
     <br/> ({$cache['memory_type']} memory)
801 801
     </td></tr>
802 802
 EOB;
803
-	echo   '<tr class=tr-1><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>';
804
-	echo   '<tr class=tr-0><td class=td-0>Uptime</td><td>',duration($cache['start_time']),'</td></tr>';
805
-	echo <<<EOB
803
+		echo   '<tr class=tr-1><td class=td-0>Start Time</td><td>',date(DATE_FORMAT,$cache['start_time']),'</td></tr>';
804
+		echo   '<tr class=tr-0><td class=td-0>Uptime</td><td>',duration($cache['start_time']),'</td></tr>';
805
+		echo <<<EOB
806 806
 		</tbody></table>
807 807
 		</div>
808 808
 
@@ -824,46 +824,46 @@  discard block
 block discarded – undo
824 824
 		<div class="info div2"><h2>Runtime Settings</h2><table cellspacing=0><tbody>
825 825
 EOB;
826 826
 
827
-	$j = 0;
828
-	foreach (ini_get_all('apcu') as $k => $v) {
829
-		echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value']),"</td></tr>\n";
830
-		$j = 1 - $j;
831
-	}
827
+		$j = 0;
828
+		foreach (ini_get_all('apcu') as $k => $v) {
829
+			echo "<tr class=tr-$j><td class=td-0>",$k,"</td><td>",str_replace(',',',<br />',$v['local_value']),"</td></tr>\n";
830
+			$j = 1 - $j;
831
+		}
832 832
 
833
-	if($mem['num_seg']>1 || $mem['num_seg']==1 && count($mem['block_lists'][0])>1)
834
-		$mem_note = "Memory Usage<br /><font size=-2>(multiple slices indicate fragments)</font>";
835
-	else
836
-		$mem_note = "Memory Usage";
833
+		if($mem['num_seg']>1 || $mem['num_seg']==1 && count($mem['block_lists'][0])>1)
834
+			$mem_note = "Memory Usage<br /><font size=-2>(multiple slices indicate fragments)</font>";
835
+		else
836
+			$mem_note = "Memory Usage";
837 837
 
838
-	echo <<< EOB
838
+		echo <<< EOB
839 839
 		</tbody></table>
840 840
 		</div>
841 841
 
842 842
 		<div class="graph div3"><h2>Host Status Diagrams</h2>
843 843
 		<table cellspacing=0><tbody>
844 844
 EOB;
845
-	$size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10);
846
-echo <<<EOB
845
+		$size='width='.(GRAPH_SIZE+50).' height='.(GRAPH_SIZE+10);
846
+	echo <<<EOB
847 847
 		<tr>
848 848
 		<td class=td-0>$mem_note</td>
849 849
 		<td class=td-1>Hits &amp; Misses</td>
850 850
 		</tr>
851 851
 EOB;
852 852
 
853
-	echo
854
-		graphics_avail() ?
855
-			  '<tr>'.
856
-			  "<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>".
857
-			  "<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n"
858
-			: "",
859
-		'<tr>',
860
-		'<td class=td-0><span class="green box">&nbsp;</span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
861
-		'<td class=td-1><span class="green box">&nbsp;</span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n",
862
-		'</tr>',
863
-		'<tr>',
864
-		'<td class=td-0><span class="red box">&nbsp;</span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
865
-		'<td class=td-1><span class="red box">&nbsp;</span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n";
866
-	echo <<< EOB
853
+		echo
854
+			graphics_avail() ?
855
+			  	'<tr>'.
856
+			  	"<td class=td-0><img alt=\"\" $size src=\"$PHP_SELF?IMG=1&$time\"></td>".
857
+			  	"<td class=td-1><img alt=\"\" $size src=\"$PHP_SELF?IMG=2&$time\"></td></tr>\n"
858
+				: "",
859
+			'<tr>',
860
+			'<td class=td-0><span class="green box">&nbsp;</span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n",
861
+			'<td class=td-1><span class="green box">&nbsp;</span>Hits: ',$cache['num_hits'].@sprintf(" (%.1f%%)",$cache['num_hits']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n",
862
+			'</tr>',
863
+			'<tr>',
864
+			'<td class=td-0><span class="red box">&nbsp;</span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n",
865
+			'<td class=td-1><span class="red box">&nbsp;</span>Misses: ',$cache['num_misses'].@sprintf(" (%.1f%%)",$cache['num_misses']*100/($cache['num_hits']+$cache['num_misses'])),"</td>\n";
866
+		echo <<< EOB
867 867
 		</tr>
868 868
 		</tbody></table>
869 869
 
@@ -874,141 +874,141 @@  discard block
 block discarded – undo
874 874
 		<td class=td-0 colspan=2><br/>
875 875
 EOB;
876 876
 
877
-	// Fragementation: (freeseg - 1) / total_seg
878
-	$nseg = $freeseg = $fragsize = $freetotal = 0;
879
-	for($i=0; $i<$mem['num_seg']; $i++) {
880
-		$ptr = 0;
881
-		foreach($mem['block_lists'][$i] as $block) {
882
-			if ($block['offset'] != $ptr) {
883
-				++$nseg;
877
+		// Fragementation: (freeseg - 1) / total_seg
878
+		$nseg = $freeseg = $fragsize = $freetotal = 0;
879
+		for($i=0; $i<$mem['num_seg']; $i++) {
880
+			$ptr = 0;
881
+			foreach($mem['block_lists'][$i] as $block) {
882
+				if ($block['offset'] != $ptr) {
883
+					++$nseg;
884
+				}
885
+				$ptr = $block['offset'] + $block['size'];
886
+                        	/* Only consider blocks <5M for the fragmentation % */
887
+                        	if($block['size']<(5*1024*1024)) $fragsize+=$block['size'];
888
+                        	$freetotal+=$block['size'];
884 889
 			}
885
-			$ptr = $block['offset'] + $block['size'];
886
-                        /* Only consider blocks <5M for the fragmentation % */
887
-                        if($block['size']<(5*1024*1024)) $fragsize+=$block['size'];
888
-                        $freetotal+=$block['size'];
890
+			$freeseg += count($mem['block_lists'][$i]);
889 891
 		}
890
-		$freeseg += count($mem['block_lists'][$i]);
891
-	}
892 892
 
893
-	if ($freeseg > 1) {
894
-		$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg);
895
-	} else {
896
-		$frag = "0%";
897
-	}
893
+		if ($freeseg > 1) {
894
+			$frag = sprintf("%.2f%% (%s out of %s in %d fragments)", ($fragsize/$freetotal)*100,bsize($fragsize),bsize($freetotal),$freeseg);
895
+		} else {
896
+			$frag = "0%";
897
+		}
898 898
 
899
-	if (graphics_avail()) {
900
-		$size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10);
899
+		if (graphics_avail()) {
900
+			$size='width='.(2*GRAPH_SIZE+150).' height='.(GRAPH_SIZE+10);
901
+			echo <<<EOB
902
+				<img alt="" $size src="$PHP_SELF?IMG=3&$time">
903
+	EOB;
904
+		}
901 905
 		echo <<<EOB
902
-			<img alt="" $size src="$PHP_SELF?IMG=3&$time">
903
-EOB;
904
-	}
905
-	echo <<<EOB
906
-		</br>Fragmentation: $frag
906
+			</br>Fragmentation: $frag
907 907
 		</td>
908 908
 		</tr>
909 909
 EOB;
910
-        if(isset($mem['adist'])) {
911
-          foreach($mem['adist'] as $i=>$v) {
912
-            $cur = pow(2,$i); $nxt = pow(2,$i+1)-1;
913
-            if($i==0) $range = "1";
914
-            else $range = "$cur - $nxt";
915
-            echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n";
916
-          }
917
-        }
918
-        echo <<<EOB
910
+        	if(isset($mem['adist'])) {
911
+          	foreach($mem['adist'] as $i=>$v) {
912
+            	$cur = pow(2,$i); $nxt = pow(2,$i+1)-1;
913
+            	if($i==0) $range = "1";
914
+            	else $range = "$cur - $nxt";
915
+            	echo "<tr><th align=right>$range</th><td align=right>$v</td></tr>\n";
916
+          	}
917
+        	}
918
+        	echo <<<EOB
919 919
 		</tbody></table>
920 920
 		</div>
921 921
 EOB;
922 922
 
923
-	break;
923
+		break;
924 924
 
925 925
 
926
-// -----------------------------------------------
927
-// User Cache Entries
928
-// -----------------------------------------------
929
-case OB_USER_CACHE:
930
-	if (!$AUTHENTICATED) {
931
-    echo '<div class="error">You need to login to see the user values here!<br/>&nbsp;<br/>';
932
-		put_login_link("Login now!");
933
-		echo '</div>';
934
-		break;
935
-	}
936
-	$fieldname='info';
937
-	$fieldheading='User Entry Label';
938
-	$fieldkey='info';
926
+	// -----------------------------------------------
927
+	// User Cache Entries
928
+	// -----------------------------------------------
929
+	case OB_USER_CACHE:
930
+		if (!$AUTHENTICATED) {
931
+    	echo '<div class="error">You need to login to see the user values here!<br/>&nbsp;<br/>';
932
+			put_login_link("Login now!");
933
+			echo '</div>';
934
+			break;
935
+		}
936
+		$fieldname='info';
937
+		$fieldheading='User Entry Label';
938
+		$fieldkey='info';
939 939
 
940
-	$cols=6;
941
-	echo <<<EOB
940
+		$cols=6;
941
+		echo <<<EOB
942 942
 		<div class=sorting><form>Scope:
943 943
 		<input type=hidden name=OB value={$MYREQUEST['OB']}>
944 944
 		<select name=SCOPE>
945 945
 EOB;
946
-	echo
947
-		"<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>",
948
-		"<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>",
949
-		"</select>",
950
-		", Sorting:<select name=SORT1>",
951
-		"<option value=H",$MYREQUEST['SORT1']=='H' ? " selected":"",">Hits</option>",
952
-		"<option value=Z",$MYREQUEST['SORT1']=='Z' ? " selected":"",">Size</option>",
953
-		"<option value=S",$MYREQUEST['SORT1']=='S' ? " selected":"",">$fieldheading</option>",
954
-		"<option value=A",$MYREQUEST['SORT1']=='A' ? " selected":"",">Last accessed</option>",
955
-		"<option value=M",$MYREQUEST['SORT1']=='M' ? " selected":"",">Last modified</option>",
956
-		"<option value=C",$MYREQUEST['SORT1']=='C' ? " selected":"",">Created at</option>",
957
-		"<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>";
958
-	if($fieldname=='info') echo
959
-		"<option value=D",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>";
960
-	echo
961
-		'</select>',
962
-		'<select name=SORT2>',
963
-		'<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>',
964
-		'<option value=A',$MYREQUEST['SORT2']=='A' ? ' selected':'','>ASC</option>',
965
-		'</select>',
966
-		'<select name=COUNT onChange="form.submit()">',
967
-		'<option value=10 ',$MYREQUEST['COUNT']=='10' ? ' selected':'','>Top 10</option>',
968
-		'<option value=20 ',$MYREQUEST['COUNT']=='20' ? ' selected':'','>Top 20</option>',
969
-		'<option value=50 ',$MYREQUEST['COUNT']=='50' ? ' selected':'','>Top 50</option>',
970
-		'<option value=100',$MYREQUEST['COUNT']=='100'? ' selected':'','>Top 100</option>',
971
-		'<option value=150',$MYREQUEST['COUNT']=='150'? ' selected':'','>Top 150</option>',
972
-		'<option value=200',$MYREQUEST['COUNT']=='200'? ' selected':'','>Top 200</option>',
973
-		'<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>',
974
-		'<option value=0  ',$MYREQUEST['COUNT']=='0'  ? ' selected':'','>All</option>',
975
-		'</select>',
976
-    '&nbsp; Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>',
977
-		'&nbsp;<input type=submit value="GO!">',
978
-		'</form></div>';
979
-
980
-  if (isset($MYREQUEST['SEARCH'])) {
981
-   // Don't use preg_quote because we want the user to be able to specify a
982
-   // regular expression subpattern.
983
-   $MYREQUEST['SEARCH'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i';
984
-   if (preg_match($MYREQUEST['SEARCH'], 'test') === false) {
985
-     echo '<div class="error">Error: enter a valid regular expression as a search query.</div>';
986
-     break;
987
-   }
988
-  }
989
-
990
-  echo
991
-		'<div class="info"><table cellspacing=0><tbody>',
992
-		'<tr>',
993
-		'<th>',sortheader('S',$fieldheading,  "&OB=".$MYREQUEST['OB']),'</th>',
994
-		'<th>',sortheader('H','Hits',         "&OB=".$MYREQUEST['OB']),'</th>',
995
-		'<th>',sortheader('Z','Size',         "&OB=".$MYREQUEST['OB']),'</th>',
996
-		'<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>',
997
-		'<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>',
998
-		'<th>',sortheader('C','Created at',   "&OB=".$MYREQUEST['OB']),'</th>';
999
-
1000
-	if($fieldname=='info') {
1001
-		$cols+=2;
1002
-		 echo '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>';
1003
-	}
1004
-	echo '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>';
946
+		echo
947
+			"<option value=A",$MYREQUEST['SCOPE']=='A' ? " selected":"",">Active</option>",
948
+			"<option value=D",$MYREQUEST['SCOPE']=='D' ? " selected":"",">Deleted</option>",
949
+			"</select>",
950
+			", Sorting:<select name=SORT1>",
951
+			"<option value=H",$MYREQUEST['SORT1']=='H' ? " selected":"",">Hits</option>",
952
+			"<option value=Z",$MYREQUEST['SORT1']=='Z' ? " selected":"",">Size</option>",
953
+			"<option value=S",$MYREQUEST['SORT1']=='S' ? " selected":"",">$fieldheading</option>",
954
+			"<option value=A",$MYREQUEST['SORT1']=='A' ? " selected":"",">Last accessed</option>",
955
+			"<option value=M",$MYREQUEST['SORT1']=='M' ? " selected":"",">Last modified</option>",
956
+			"<option value=C",$MYREQUEST['SORT1']=='C' ? " selected":"",">Created at</option>",
957
+			"<option value=D",$MYREQUEST['SORT1']=='D' ? " selected":"",">Deleted at</option>";
958
+		if($fieldname=='info') echo
959
+			"<option value=D",$MYREQUEST['SORT1']=='T' ? " selected":"",">Timeout</option>";
960
+		echo
961
+			'</select>',
962
+			'<select name=SORT2>',
963
+			'<option value=D',$MYREQUEST['SORT2']=='D' ? ' selected':'','>DESC</option>',
964
+			'<option value=A',$MYREQUEST['SORT2']=='A' ? ' selected':'','>ASC</option>',
965
+			'</select>',
966
+			'<select name=COUNT onChange="form.submit()">',
967
+			'<option value=10 ',$MYREQUEST['COUNT']=='10' ? ' selected':'','>Top 10</option>',
968
+			'<option value=20 ',$MYREQUEST['COUNT']=='20' ? ' selected':'','>Top 20</option>',
969
+			'<option value=50 ',$MYREQUEST['COUNT']=='50' ? ' selected':'','>Top 50</option>',
970
+			'<option value=100',$MYREQUEST['COUNT']=='100'? ' selected':'','>Top 100</option>',
971
+			'<option value=150',$MYREQUEST['COUNT']=='150'? ' selected':'','>Top 150</option>',
972
+			'<option value=200',$MYREQUEST['COUNT']=='200'? ' selected':'','>Top 200</option>',
973
+			'<option value=500',$MYREQUEST['COUNT']=='500'? ' selected':'','>Top 500</option>',
974
+			'<option value=0  ',$MYREQUEST['COUNT']=='0'  ? ' selected':'','>All</option>',
975
+			'</select>',
976
+    	'&nbsp; Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>',
977
+			'&nbsp;<input type=submit value="GO!">',
978
+			'</form></div>';
979
+
980
+  	if (isset($MYREQUEST['SEARCH'])) {
981
+   	// Don't use preg_quote because we want the user to be able to specify a
982
+   	// regular expression subpattern.
983
+   	$MYREQUEST['SEARCH'] = '/'.str_replace('/', '\\/', $MYREQUEST['SEARCH']).'/i';
984
+   	if (preg_match($MYREQUEST['SEARCH'], 'test') === false) {
985
+     	echo '<div class="error">Error: enter a valid regular expression as a search query.</div>';
986
+     	break;
987
+   	}
988
+  	}
989
+
990
+  	echo
991
+			'<div class="info"><table cellspacing=0><tbody>',
992
+			'<tr>',
993
+			'<th>',sortheader('S',$fieldheading,  "&OB=".$MYREQUEST['OB']),'</th>',
994
+			'<th>',sortheader('H','Hits',         "&OB=".$MYREQUEST['OB']),'</th>',
995
+			'<th>',sortheader('Z','Size',         "&OB=".$MYREQUEST['OB']),'</th>',
996
+			'<th>',sortheader('A','Last accessed',"&OB=".$MYREQUEST['OB']),'</th>',
997
+			'<th>',sortheader('M','Last modified',"&OB=".$MYREQUEST['OB']),'</th>',
998
+			'<th>',sortheader('C','Created at',   "&OB=".$MYREQUEST['OB']),'</th>';
999
+
1000
+		if($fieldname=='info') {
1001
+			$cols+=2;
1002
+		 	echo '<th>',sortheader('T','Timeout',"&OB=".$MYREQUEST['OB']),'</th>';
1003
+		}
1004
+		echo '<th>',sortheader('D','Deleted at',"&OB=".$MYREQUEST['OB']),'</th></tr>';
1005 1005
 
1006
-	// builds list with alpha numeric sortable keys
1007
-	//
1008
-	$list = array();
1006
+		// builds list with alpha numeric sortable keys
1007
+		//
1008
+		$list = array();
1009 1009
 
1010
-	foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) {
1011
-		switch($MYREQUEST['SORT1']) {
1010
+		foreach($cache[$scope_list[$MYREQUEST['SCOPE']]] as $i => $entry) {
1011
+			switch($MYREQUEST['SORT1']) {
1012 1012
 			case 'A': $k=sprintf('%015d-',$entry['access_time']);  	     break;
1013 1013
 			case 'H': $k=sprintf('%015d-',$entry['num_hits']); 	     break;
1014 1014
 			case 'Z': $k=sprintf('%015d-',$entry['mem_size']); 	     break;
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 			case 'T': $k=sprintf('%015d-',$entry['ttl']);		     break;
1018 1018
 			case 'D': $k=sprintf('%015d-',$entry['deletion_time']);      break;
1019 1019
 			case 'S': $k=$entry["info"];				     break;
1020
-		}
1020
+			}
1021 1021
 		if (!$AUTHENTICATED) {
1022 1022
 			// hide all path entries if not logged in
1023 1023
 			$list[$k.$entry[$fieldname]]=preg_replace('/^.*(\\/|\\\\)/','*hidden*/',$entry);
@@ -1097,61 +1097,61 @@  discard block
 block discarded – undo
1097 1097
 // -----------------------------------------------
1098 1098
 // Version check
1099 1099
 // -----------------------------------------------
1100
-case OB_VERSION_CHECK:
1101
-	echo <<<EOB
1100
+	case OB_VERSION_CHECK:
1101
+		echo <<<EOB
1102 1102
 		<div class="info"><h2>APCu Version Information</h2>
1103 1103
 		<table cellspacing=0><tbody>
1104 1104
 		<tr>
1105 1105
 		<th></th>
1106 1106
 		</tr>
1107 1107
 EOB;
1108
-  if (defined('PROXY')) {
1109
-    $ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) );
1110
-    $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt);
1111
-  } else {
1112
-    $rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss");
1113
-  }
1114
-	if (!$rss) {
1115
-		echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>';
1116
-	} else {
1117
-		$apcversion = phpversion('apcu');
1118
-
1119
-		preg_match('!<title>APCu ([0-9.]+)</title>!', $rss, $match);
1120
-		echo '<tr class="tr-0 center"><td>';
1121
-		if (version_compare($apcversion, $match[1], '>=')) {
1122
-			echo '<div class="ok">You are running the latest version of APCu ('.$apcversion.')</div>';
1123
-			$i = 3;
1108
+  	if (defined('PROXY')) {
1109
+    	$ctxt = stream_context_create( array( 'http' => array( 'proxy' => PROXY, 'request_fulluri' => True ) ) );
1110
+    	$rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss", False, $ctxt);
1111
+  	} else {
1112
+    	$rss = @file_get_contents("http://pecl.php.net/feeds/pkg_apcu.rss");
1113
+  	}
1114
+		if (!$rss) {
1115
+			echo '<tr class="td-last center"><td>Unable to fetch version information.</td></tr>';
1124 1116
 		} else {
1125
-			echo '<div class="failed">You are running an older version of APCu ('.$apcversion.'),
1117
+			$apcversion = phpversion('apcu');
1118
+
1119
+			preg_match('!<title>APCu ([0-9.]+)</title>!', $rss, $match);
1120
+			echo '<tr class="tr-0 center"><td>';
1121
+			if (version_compare($apcversion, $match[1], '>=')) {
1122
+				echo '<div class="ok">You are running the latest version of APCu ('.$apcversion.')</div>';
1123
+				$i = 3;
1124
+			} else {
1125
+				echo '<div class="failed">You are running an older version of APCu ('.$apcversion.'),
1126 1126
 				newer version '.$match[1].' is available at <a href="http://pecl.php.net/package/APCu/'.$match[1].'">
1127 1127
 				http://pecl.php.net/package/APCu/'.$match[1].'</a>
1128 1128
 				</div>';
1129
-			$i = -1;
1130
-		}
1131
-		echo '</td></tr>';
1132
-		echo '<tr class="tr-0"><td><h3>Change Log:</h3><br/>';
1133
-
1134
-		preg_match_all('!<(title|description)>([^<]+)</\\1>!', $rss, $match);
1135
-		next($match[2]); next($match[2]);
1136
-
1137
-		while (list(,$v) = each($match[2])) {
1138
-			list(,$ver) = explode(' ', $v, 2);
1139
-			if ($i < 0 && version_compare($apcversion, $ver, '>=')) {
1140
-				break;
1141
-			} else if (!$i--) {
1142
-				break;
1129
+				$i = -1;
1130
+			}
1131
+			echo '</td></tr>';
1132
+			echo '<tr class="tr-0"><td><h3>Change Log:</h3><br/>';
1133
+
1134
+			preg_match_all('!<(title|description)>([^<]+)</\\1>!', $rss, $match);
1135
+			next($match[2]); next($match[2]);
1136
+
1137
+			while (list(,$v) = each($match[2])) {
1138
+				list(,$ver) = explode(' ', $v, 2);
1139
+				if ($i < 0 && version_compare($apcversion, $ver, '>=')) {
1140
+					break;
1141
+				} else if (!$i--) {
1142
+					break;
1143
+				}
1144
+				echo "<b><a href=\"http://pecl.php.net/package/APCu/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>";
1145
+				echo nl2br(htmlspecialchars(current($match[2]), ENT_QUOTES, 'UTF-8'))."</blockquote>";
1146
+				next($match[2]);
1143 1147
 			}
1144
-			echo "<b><a href=\"http://pecl.php.net/package/APCu/$ver\">".htmlspecialchars($v, ENT_QUOTES, 'UTF-8')."</a></b><br><blockquote>";
1145
-			echo nl2br(htmlspecialchars(current($match[2]), ENT_QUOTES, 'UTF-8'))."</blockquote>";
1146
-			next($match[2]);
1148
+			echo '</td></tr>';
1147 1149
 		}
1148
-		echo '</td></tr>';
1149
-	}
1150
-	echo <<< EOB
1150
+		echo <<< EOB
1151 1151
 		</tbody></table>
1152 1152
 		</div>
1153 1153
 EOB;
1154
-	break;
1154
+		break;
1155 1155
 
1156 1156
 }
1157 1157
 
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|ENT_XML1|ENT_DISALLOWED, '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|ENT_XML1|ENT_DISALLOWED, '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.
calendar/inc/class.calendar_merge.inc.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 				{
180 180
 					$value = date($format, $key == 'end' ? $id['end'] : $id['start']);
181 181
 					if($key == 'month') $value = lang($value);
182
-					$values["$\$range/$key$$"] = $value;
182
+					$values["$\$range/$key$key$"] = $value;
183 183
 				}
184 184
 			}
185 185
 			$replacements += $values;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			}
247 247
 			foreach($types as $t_id => $type)
248 248
 			{
249
-				$replacements['$$'.($prefix ? $prefix . '/' : '') . "calendar_participants/{$t_id}$$"] = implode(', ',$type);
249
+				$replacements['$$'.($prefix ? $prefix . '/' : '') . "calendar_participants/{$t_id}}$"] = implode(', ',$type);
250 250
 			}
251 251
 		}
252 252
 		// Participant email list (not declined)
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.
calendar/inc/class.calendar_uiforms.inc.php 1 patch
Switch Indentation   +342 added lines, -342 removed lines patch added patch discarded remove patch
@@ -644,436 +644,436 @@
 block discarded – undo
644 644
 
645 645
 		switch((string)$button)
646 646
 		{
647
-		case 'exception':	// create an exception in a recuring event
648
-			$msg = $this->_create_exception($event,$preserv);
649
-			break;
650
-		case 'edit':
651
-			// Going from add dialog to full edit dialog
652
-			unset($preserv['template']);
653
-			unset($event['template']);
654
-			break;
655
-
656
-		case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
657
-			unset($event['id']);
658
-			unset($event['uid']);
659
-			unset($event['reference']);
660
-			unset($preserv['reference']);
661
-			unset($event['recurrence']);
662
-			unset($preserv['recurrence']);
663
-			unset($event['recur_exception']);
664
-			unset($event['edit_single']);	// in case it has been set
665
-			unset($event['modified']);
666
-			unset($event['modifier']);
667
-			unset($event['caldav_name']);
668
-			$event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner'];
647
+			case 'exception':	// create an exception in a recuring event
648
+				$msg = $this->_create_exception($event,$preserv);
649
+				break;
650
+			case 'edit':
651
+				// Going from add dialog to full edit dialog
652
+				unset($preserv['template']);
653
+				unset($event['template']);
654
+				break;
669 655
 
670
-			// Clear participant stati
671
-			foreach($event['participant_types'] as $type => &$participants)
672
-			{
673
-				foreach($participants as $id => &$p_response)
656
+			case 'copy':	// create new event with copied content, some content need to be unset to make a "new" event
657
+				unset($event['id']);
658
+				unset($event['uid']);
659
+				unset($event['reference']);
660
+				unset($preserv['reference']);
661
+				unset($event['recurrence']);
662
+				unset($preserv['recurrence']);
663
+				unset($event['recur_exception']);
664
+				unset($event['edit_single']);	// in case it has been set
665
+				unset($event['modified']);
666
+				unset($event['modifier']);
667
+				unset($event['caldav_name']);
668
+				$event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner'];
669
+
670
+				// Clear participant stati
671
+				foreach($event['participant_types'] as $type => &$participants)
672
+				{
673
+					foreach($participants as $id => &$p_response)
674
+					{
675
+						if($type == 'u' && $id == $event['owner']) continue;
676
+						calendar_so::split_status($p_response, $quantity, $role);
677
+						// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
678
+						$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
679
+						$p_response = calendar_so::combine_status($status,$quantity,$role);
680
+					}
681
+				}
682
+
683
+				// Copy alarms
684
+				if (is_array($event['alarm']))
674 685
 				{
675
-					if($type == 'u' && $id == $event['owner']) continue;
676
-					calendar_so::split_status($p_response, $quantity, $role);
677
-					// if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it
678
-					$status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U';
679
-					$p_response = calendar_so::combine_status($status,$quantity,$role);
686
+					foreach($event['alarm'] as $n => &$alarm)
687
+					{
688
+						unset($alarm['id']);
689
+						unset($alarm['cal_id']);
690
+					}
680 691
 				}
681
-			}
682 692
 
683
-			// Copy alarms
684
-			if (is_array($event['alarm']))
685
-			{
686
-				foreach($event['alarm'] as $n => &$alarm)
693
+				// Get links to be copied
694
+				// With no ID, $content['link_to']['to_id'] is used
695
+				$content['link_to'] = array('to_app' => 'calendar', 'to_id' => 0);
696
+				foreach(Link::get_links('calendar', $content['id']) as $link)
687 697
 				{
688
-					unset($alarm['id']);
689
-					unset($alarm['cal_id']);
698
+					if ($link['app'] != Link::VFS_APPNAME)
699
+					{
700
+						Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
701
+					}
702
+					elseif ($link['app'] == Link::VFS_APPNAME)
703
+					{
704
+						Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
705
+							'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
706
+							'name' => $link['id'],
707
+						), $link['remark']);
708
+					}
690 709
 				}
691
-			}
710
+				unset($link);
711
+				$preserv['view'] = $preserv['edit_single'] = false;
712
+				$msg = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('calendar','entry')));
713
+				$event['title'] = lang('Copy of:').' '.$event['title'];
714
+				break;
692 715
 
693
-			// Get links to be copied
694
-			// With no ID, $content['link_to']['to_id'] is used
695
-			$content['link_to'] = array('to_app' => 'calendar', 'to_id' => 0);
696
-			foreach(Link::get_links('calendar', $content['id']) as $link)
697
-			{
698
-				if ($link['app'] != Link::VFS_APPNAME)
716
+			case 'mail':
717
+			case 'sendrequest':
718
+			case 'save':
719
+			case 'print':
720
+			case 'apply':
721
+			case 'infolog':
722
+				if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
699 723
 				{
700
-					Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']);
724
+					$msg = lang('Permission denied');
725
+					$button = '';
726
+					break;
701 727
 				}
702
-				elseif ($link['app'] == Link::VFS_APPNAME)
728
+				if ($event['start'] > $event['end'])
703 729
 				{
704
-					Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array(
705
-						'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'],
706
-						'name' => $link['id'],
707
-					), $link['remark']);
730
+					$msg = lang('Error: Starttime has to be before the endtime !!!');
731
+					$button = '';
732
+					break;
708 733
 				}
709
-			}
710
-			unset($link);
711
-			$preserv['view'] = $preserv['edit_single'] = false;
712
-			$msg = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('calendar','entry')));
713
-			$event['title'] = lang('Copy of:').' '.$event['title'];
714
-			break;
715
-
716
-		case 'mail':
717
-		case 'sendrequest':
718
-		case 'save':
719
-		case 'print':
720
-		case 'apply':
721
-		case 'infolog':
722
-			if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event))
723
-			{
724
-				$msg = lang('Permission denied');
725
-				$button = '';
726
-				break;
727
-			}
728
-			if ($event['start'] > $event['end'])
729
-			{
730
-				$msg = lang('Error: Starttime has to be before the endtime !!!');
731
-				$button = '';
732
-				break;
733
-			}
734
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
735
-			{
736
-				$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
737
-				$button = '';
738
-				break;
739
-			}
740
-			if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
741
-			{
742
-				$msg = lang('Error: Duration of event longer then recurrence interval!');
743
-				$button = '';
744
-				break;
745
-			}
746
-			if (!$event['participants'])
747
-			{
748
-				$msg = lang('Error: no participants selected !!!');
749
-				$button = '';
750
-				break;
751
-			}
752
-			// if private event with ressource reservation is forbidden
753
-			if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
754
-			{
755
-				foreach (array_keys($event['participants']) as $uid)
734
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate'])
735
+				{
736
+					$msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!');
737
+					$button = '';
738
+					break;
739
+				}
740
+				if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval']))
741
+				{
742
+					$msg = lang('Error: Duration of event longer then recurrence interval!');
743
+					$button = '';
744
+					break;
745
+				}
746
+				if (!$event['participants'])
747
+				{
748
+					$msg = lang('Error: no participants selected !!!');
749
+					$button = '';
750
+					break;
751
+				}
752
+				// if private event with ressource reservation is forbidden
753
+				if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private'])
756 754
 				{
757
-					if ($uid[0] == 'r') //ressource detection
755
+					foreach (array_keys($event['participants']) as $uid)
758 756
 					{
759
-						$msg = lang('Error: ressources reservation in private events is not allowed!!!');
760
-						$button = '';
761
-						break 2; //break foreach and case
757
+						if ($uid[0] == 'r') //ressource detection
758
+						{
759
+							$msg = lang('Error: ressources reservation in private events is not allowed!!!');
760
+							$button = '';
761
+							break 2; //break foreach and case
762
+						}
762 763
 					}
763 764
 				}
764
-			}
765
-			if ($content['edit_single'])	// we edited a single event from a series
766
-			{
767
-				$event['reference'] = $event['id'];
768
-				$event['recurrence'] = $content['edit_single'];
769
-				unset($event['id']);
770
-				$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
771
-				if (!is_array($conflicts) && $conflicts)
772
-				{
773
-					// now we need to add the original start as recur-execption to the series
774
-					$recur_event = $this->bo->read($event['reference']);
775
-					$recur_event['recur_exception'][] = $content['edit_single'];
776
-					// check if we need to move the alarms, because they are next on that exception
777
-					foreach($recur_event['alarm'] as $id => $alarm)
765
+				if ($content['edit_single'])	// we edited a single event from a series
766
+				{
767
+					$event['reference'] = $event['id'];
768
+					$event['recurrence'] = $content['edit_single'];
769
+					unset($event['id']);
770
+					$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
771
+					if (!is_array($conflicts) && $conflicts)
778 772
 					{
779
-						if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
773
+						// now we need to add the original start as recur-execption to the series
774
+						$recur_event = $this->bo->read($event['reference']);
775
+						$recur_event['recur_exception'][] = $content['edit_single'];
776
+						// check if we need to move the alarms, because they are next on that exception
777
+						foreach($recur_event['alarm'] as $id => $alarm)
780 778
 						{
781
-							$rrule = calendar_rrule::event2rrule($recur_event, true);
782
-							foreach ($rrule as $time)
779
+							if ($alarm['time'] == $content['edit_single'] - $alarm['offset'])
783 780
 							{
784
-								if ($content['edit_single'] < $time->format('ts'))
781
+								$rrule = calendar_rrule::event2rrule($recur_event, true);
782
+								foreach ($rrule as $time)
785 783
 								{
786
-									$alarm['time'] = $time->format('ts') - $alarm['offset'];
787
-									$this->bo->save_alarm($event['reference'], $alarm);
788
-									break;
784
+									if ($content['edit_single'] < $time->format('ts'))
785
+									{
786
+										$alarm['time'] = $time->format('ts') - $alarm['offset'];
787
+										$this->bo->save_alarm($event['reference'], $alarm);
788
+										break;
789
+									}
789 790
 								}
790 791
 							}
791 792
 						}
792
-					}
793
-					unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
794
-					unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
795
-					$this->bo->update($recur_event,true);	// no conflict check here
793
+						unset($recur_event['start']); unset($recur_event['end']);	// no update necessary
794
+						unset($recur_event['alarm']);	// unsetting alarms too, as they cant be updated without start!
795
+						$this->bo->update($recur_event,true);	// no conflict check here
796 796
 
797
-					// Save links
798
-					if($content['links'])
799
-					{
800
-						Link::link('calendar', $event['id'], $content['links']['to_id']);
801
-					}
797
+						// Save links
798
+						if($content['links'])
799
+						{
800
+							Link::link('calendar', $event['id'], $content['links']['to_id']);
801
+						}
802
+
803
+						if(Api\Json\Response::isJSONResponse())
804
+						{
805
+							// Sending null will trigger a removal of the original
806
+							// for that date
807
+							Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
808
+						}
802 809
 
803
-					if(Api\Json\Response::isJSONResponse())
810
+						unset($recur_event);
811
+						unset($event['edit_single']);			// if we further edit it, it's just a single event
812
+						unset($preserv['edit_single']);
813
+					}
814
+					else	// conflict or error, we need to reset everything to the state befor we tried to save it
804 815
 					{
805
-						// Sending null will trigger a removal of the original
806
-						// for that date
807
-						Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null));
816
+						$event['id'] = $event['reference'];
817
+						$event['reference'] = $event['recurrence'] = 0;
818
+						$event['uid'] = $content['uid'];
808 819
 					}
809
-
810
-					unset($recur_event);
811
-					unset($event['edit_single']);			// if we further edit it, it's just a single event
812
-					unset($preserv['edit_single']);
813
-				}
814
-				else	// conflict or error, we need to reset everything to the state befor we tried to save it
815
-				{
816
-					$event['id'] = $event['reference'];
817
-					$event['reference'] = $event['recurrence'] = 0;
818
-					$event['uid'] = $content['uid'];
820
+					$update_type = 'edit';
819 821
 				}
820
-				$update_type = 'edit';
821
-			}
822
-			else	// we edited a non-reccuring event or the whole series
823
-			{
824
-				if (($old_event = $this->bo->read($event['id'])))
822
+				else	// we edited a non-reccuring event or the whole series
825 823
 				{
826
-					if ($event['recur_type'] != MCAL_RECUR_NONE)
824
+					if (($old_event = $this->bo->read($event['id'])))
827 825
 					{
828
-						$update_type = 'edit';
829
-
830
-						// we edit a existing series event
831
-						if ($event['start'] != $old_event['start'] ||
832
-							$event['whole_day'] != $old_event['whole_day'] ||
833
-							$event['end'] != $old_event['end'])
826
+						if ($event['recur_type'] != MCAL_RECUR_NONE)
834 827
 						{
835
-							// calculate offset against old series start or clicked recurrance,
836
-							// depending on which is smaller
837
-							$offset = $event['start'] - $old_event['start'];
838
-							if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
828
+							$update_type = 'edit';
829
+
830
+							// we edit a existing series event
831
+							if ($event['start'] != $old_event['start'] ||
832
+								$event['whole_day'] != $old_event['whole_day'] ||
833
+								$event['end'] != $old_event['end'])
839 834
 							{
840
-								$offset = $off2;
835
+								// calculate offset against old series start or clicked recurrance,
836
+								// depending on which is smaller
837
+								$offset = $event['start'] - $old_event['start'];
838
+								if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date']))
839
+								{
840
+									$offset = $off2;
841
+								}
842
+								$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
843
+								if($msg)
844
+								{
845
+									$noerror = false;
846
+								}
841 847
 							}
842
-							$msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']);
843
-							if($msg)
848
+						}
849
+						else
850
+						{
851
+							if ($old_event['start'] != $event['start'] ||
852
+								$old_event['end'] != $event['end'] ||
853
+								$event['whole_day'] != $old_event['whole_day'])
844 854
 							{
845
-								$noerror = false;
855
+								// check if we need to move the alarms, because they are relative
856
+								$this->bo->check_move_alarms($event, $old_event);
846 857
 							}
847 858
 						}
848 859
 					}
849
-					else
860
+					// Update alarm (default alarm or set alarm before change start date)
861
+					// for new event.
862
+					elseif (is_array($event['alarm']) && ($event['alarm'][1]['time'] + $event['alarm'][1]['offset'] != $event['start']))
850 863
 					{
851
-						if ($old_event['start'] != $event['start'] ||
852
-							$old_event['end'] != $event['end'] ||
853
-							$event['whole_day'] != $old_event['whole_day'])
854
-						{
855
-							// check if we need to move the alarms, because they are relative
856
-							$this->bo->check_move_alarms($event, $old_event);
857
-						}
864
+						$this->bo->check_move_alarms($event);
865
+					}
866
+					// Adding participants needs to be done as an edit, in case we
867
+					// have participants visible in seperate calendars
868
+					if(is_array($old_event['participants']) && count(array_diff_key($event['participants'], $old_event['participants'])))
869
+					{
870
+						$update_type = 'edit';
858 871
 					}
872
+					// Changing category may affect event filtering
873
+					if($this->cal_prefs['saved_states']['cat_id'] && $old_event['category'] != $event['category'])
874
+					{
875
+						$update_type = 'edit';
876
+					}
877
+					$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
878
+					unset($event['ignore']);
859 879
 				}
860
-				// Update alarm (default alarm or set alarm before change start date)
861
-				// for new event.
862
-				elseif (is_array($event['alarm']) && ($event['alarm'][1]['time'] + $event['alarm'][1]['offset'] != $event['start']))
880
+				if (is_array($conflicts))
863 881
 				{
864
-					$this->bo->check_move_alarms($event);
882
+					$event['button_was'] = $button;	// remember for ignore
883
+					return $this->conflicts($event,$conflicts,$preserv);
865 884
 				}
866
-				// Adding participants needs to be done as an edit, in case we
867
-				// have participants visible in seperate calendars
868
-				if(is_array($old_event['participants']) && count(array_diff_key($event['participants'], $old_event['participants'])))
885
+
886
+				// Event spans multiple days, need an edit to make sure they all get updated
887
+				// We could check old date, as removing from days could still be an update
888
+				if(date('Ymd', $event['start']) != date('Ymd', $event['end']))
869 889
 				{
870 890
 					$update_type = 'edit';
871 891
 				}
872
-				// Changing category may affect event filtering
873
-				if($this->cal_prefs['saved_states']['cat_id'] && $old_event['category'] != $event['category'])
892
+				// check if there are messages from update, eg. removed participants or Api\Categories because of missing rights
893
+				if ($messages)
874 894
 				{
875
-					$update_type = 'edit';
895
+					$msg  .= ($msg ? ', ' : '').implode(', ',$messages);
876 896
 				}
877
-				$conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']);
878
-				unset($event['ignore']);
879
-			}
880
-			if (is_array($conflicts))
881
-			{
882
-				$event['button_was'] = $button;	// remember for ignore
883
-				return $this->conflicts($event,$conflicts,$preserv);
884
-			}
885
-
886
-			// Event spans multiple days, need an edit to make sure they all get updated
887
-			// We could check old date, as removing from days could still be an update
888
-			if(date('Ymd', $event['start']) != date('Ymd', $event['end']))
889
-			{
890
-				$update_type = 'edit';
891
-			}
892
-			// check if there are messages from update, eg. removed participants or Api\Categories because of missing rights
893
-			if ($messages)
894
-			{
895
-				$msg  .= ($msg ? ', ' : '').implode(', ',$messages);
896
-			}
897
-			if ($conflicts === 0)
898
-			{
899
-				$msg .= ($msg ? ', ' : '') .lang('Error: the entry has been updated since you opened it for editing!').'<br />'.
900
-							lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'.
901
-								htmlspecialchars(Egw::link('/index.php',array(
902
-								'menuaction' => 'calendar.calendar_uiforms.edit',
903
-								'cal_id'    => $content['id'],
904
-							))).'">','</a>');
905
-				$noerror = false;
906
-			}
907
-			elseif ($conflicts > 0)
908
-			{
909
-				// series moved by splitting in two --> move alarms and exceptions
910
-				if ($old_event && $old_event['id'] != $event['id'])
897
+				if ($conflicts === 0)
911 898
 				{
912
-					$update_type = 'edit';
913
-					foreach ((array)$old_event['alarms'] as $alarm)
899
+					$msg .= ($msg ? ', ' : '') .lang('Error: the entry has been updated since you opened it for editing!').'<br />'.
900
+								lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'.
901
+									htmlspecialchars(Egw::link('/index.php',array(
902
+									'menuaction' => 'calendar.calendar_uiforms.edit',
903
+									'cal_id'    => $content['id'],
904
+								))).'">','</a>');
905
+					$noerror = false;
906
+				}
907
+				elseif ($conflicts > 0)
908
+				{
909
+					// series moved by splitting in two --> move alarms and exceptions
910
+					if ($old_event && $old_event['id'] != $event['id'])
914 911
 					{
915
-						// check if alarms still needed in old event, if not delete it
916
-						$event_time = $alarm['time'] + $alarm['offset'];
917
-						if ($event_time >= $this->bo->now_su)
918
-						{
919
-							$this->bo->delete_alarm($alarm['id']);
920
-						}
921
-						$alarm['time'] += $offset;
922
-						unset($alarm['id']);
923
-						// if alarm would be in the past (eg. event moved back) --> move to next possible recurrence
924
-						if ($alarm['time'] < $this->bo->now_su)
912
+						$update_type = 'edit';
913
+						foreach ((array)$old_event['alarms'] as $alarm)
925 914
 						{
926
-							if (($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su+$alarm['offset'], true)))
915
+							// check if alarms still needed in old event, if not delete it
916
+							$event_time = $alarm['time'] + $alarm['offset'];
917
+							if ($event_time >= $this->bo->now_su)
927 918
 							{
928
-								$alarm['time'] =  $next_occurrence['start'] - $alarm['offset'];
919
+								$this->bo->delete_alarm($alarm['id']);
929 920
 							}
930
-							else
921
+							$alarm['time'] += $offset;
922
+							unset($alarm['id']);
923
+							// if alarm would be in the past (eg. event moved back) --> move to next possible recurrence
924
+							if ($alarm['time'] < $this->bo->now_su)
925
+							{
926
+								if (($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su+$alarm['offset'], true)))
927
+								{
928
+									$alarm['time'] =  $next_occurrence['start'] - $alarm['offset'];
929
+								}
930
+								else
931
+								{
932
+									$alarm = false;	// no (further) recurence found --> ignore alarm
933
+								}
934
+							}
935
+							// alarm is currently on a previous recurrence --> set for first recurrence of new series
936
+							elseif ($event_time < $event['start'])
931 937
 							{
932
-								$alarm = false;	// no (further) recurence found --> ignore alarm
938
+								$alarm['time'] =  $event['start'] - $alarm['offset'];
939
+							}
940
+							if ($alarm)
941
+							{
942
+								$alarm['id'] = $this->bo->save_alarm($event['id'], $alarm);
943
+								$event['alarm'][$alarm['id']] = $alarm;
933 944
 							}
934 945
 						}
935
-						// alarm is currently on a previous recurrence --> set for first recurrence of new series
936
-						elseif ($event_time < $event['start'])
937
-						{
938
-							$alarm['time'] =  $event['start'] - $alarm['offset'];
939
-						}
940
-						if ($alarm)
946
+						// attach all future exceptions to the new series
947
+						$events =& $this->bo->search(array(
948
+							'query' => array('cal_uid' => $old_event['uid']),
949
+							'filter' => 'owner',  // return all possible entries
950
+							'daywise' => false,
951
+							'date_format' => 'ts',
952
+						));
953
+						foreach ((array)$events as $exception)
941 954
 						{
942
-							$alarm['id'] = $this->bo->save_alarm($event['id'], $alarm);
943
-							$event['alarm'][$alarm['id']] = $alarm;
955
+							if ($exception['recurrence'] > $this->bo->now_su)
956
+							{
957
+								$exception['recurrence'] += $offset;
958
+								$exception['reference'] = $event['id'];
959
+								$exception['uid'] = $event['uid'];
960
+								$this->bo->update($exception, true, true, true, true, $msg=null, $content['no_notifications']);
961
+							}
944 962
 						}
945 963
 					}
946
-					// attach all future exceptions to the new series
947
-					$events =& $this->bo->search(array(
948
-						'query' => array('cal_uid' => $old_event['uid']),
949
-						'filter' => 'owner',  // return all possible entries
950
-						'daywise' => false,
951
-						'date_format' => 'ts',
952
-					));
953
-					foreach ((array)$events as $exception)
964
+
965
+					$message = lang('Event saved');
966
+					if ($status_reset_to_unknown)
954 967
 					{
955
-						if ($exception['recurrence'] > $this->bo->now_su)
968
+						foreach((array)$event['participants'] as $uid => $status)
956 969
 						{
957
-							$exception['recurrence'] += $offset;
958
-							$exception['reference'] = $event['id'];
959
-							$exception['uid'] = $event['uid'];
960
-							$this->bo->update($exception, true, true, true, true, $msg=null, $content['no_notifications']);
970
+							if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user)
971
+							{
972
+								calendar_so::split_status($status,$q,$r);
973
+								$status = calendar_so::combine_status('U',$q,$r);
974
+								$this->bo->set_status($event['id'], $uid, $status, 0, true);
975
+							}
961 976
 						}
977
+						$message .= lang(', stati of participants reset');
962 978
 					}
963
-				}
964 979
 
965
-				$message = lang('Event saved');
966
-				if ($status_reset_to_unknown)
967
-				{
968
-					foreach((array)$event['participants'] as $uid => $status)
980
+					$response = Api\Json\Response::get();
981
+					if($response && $update_type != 'delete')
969 982
 					{
970
-						if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user)
971
-						{
972
-							calendar_so::split_status($status,$q,$r);
973
-							$status = calendar_so::combine_status('U',$q,$r);
974
-							$this->bo->set_status($event['id'], $uid, $status, 0, true);
975
-						}
983
+						$client_updated = $this->update_client($event['id']);
976 984
 					}
977
-					$message .= lang(', stati of participants reset');
978
-				}
979 985
 
980
-				$response = Api\Json\Response::get();
981
-				if($response && $update_type != 'delete')
982
-				{
983
-					$client_updated = $this->update_client($event['id']);
986
+					$msg = $message . ($msg ? ', ' . $msg : '');
987
+					Framework::refresh_opener($msg, 'calendar', $event['id'], $client_updated ? ($event['recur_type'] ? 'edit' : $update_type) : 'delete');
988
+					// writing links for new entry, existing ones are handled by the widget itself
989
+					if (!$content['id'] && is_array($content['link_to']['to_id']))
990
+					{
991
+						Link::link('calendar',$event['id'],$content['link_to']['to_id']);
992
+					}
984 993
 				}
985
-
986
-				$msg = $message . ($msg ? ', ' . $msg : '');
987
-				Framework::refresh_opener($msg, 'calendar', $event['id'], $client_updated ? ($event['recur_type'] ? 'edit' : $update_type) : 'delete');
988
-				// writing links for new entry, existing ones are handled by the widget itself
989
-				if (!$content['id'] && is_array($content['link_to']['to_id']))
994
+				else
990 995
 				{
991
-					Link::link('calendar',$event['id'],$content['link_to']['to_id']);
996
+					$msg = lang('Error: saving the event !!!');
992 997
 				}
993
-			}
994
-			else
995
-			{
996
-				$msg = lang('Error: saving the event !!!');
997
-			}
998
-			break;
999
-
1000
-		case 'cancel':
1001
-			if($content['cancel_needs_refresh'])
1002
-			{
1003
-				Framework::refresh_opener($msg, 'calendar');
1004
-			}
1005
-			break;
998
+				break;
1006 999
 
1007
-		case 'delete':					// delete of event (regular or series)
1008
-			$exceptions_kept = null;
1009
-			if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
1010
-				$content['delete_exceptions'] == 'true', $exceptions_kept))
1011
-			{
1012
-				if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
1000
+			case 'cancel':
1001
+				if($content['cancel_needs_refresh'])
1013 1002
 				{
1014
-					$msg = lang('Series deleted');
1015
-					if ($exceptions_kept) $msg .= lang(', exceptions preserved');
1003
+					Framework::refresh_opener($msg, 'calendar');
1016 1004
 				}
1017
-				else
1005
+				break;
1006
+
1007
+			case 'delete':					// delete of event (regular or series)
1008
+				$exceptions_kept = null;
1009
+				if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'],
1010
+					$content['delete_exceptions'] == 'true', $exceptions_kept))
1018 1011
 				{
1019
-					$msg = lang('Event deleted');
1020
-				}
1012
+					if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single'])
1013
+					{
1014
+						$msg = lang('Series deleted');
1015
+						if ($exceptions_kept) $msg .= lang(', exceptions preserved');
1016
+					}
1017
+					else
1018
+					{
1019
+						$msg = lang('Event deleted');
1020
+					}
1021 1021
 
1022
-			}
1023
-			break;
1022
+				}
1023
+				break;
1024 1024
 
1025
-		case 'freetime':
1026
-			// the "click" has to be in onload, to make sure the button is already created
1027
-			$event['button_was'] = $button;
1028
-			break;
1025
+			case 'freetime':
1026
+				// the "click" has to be in onload, to make sure the button is already created
1027
+				$event['button_was'] = $button;
1028
+				break;
1029 1029
 
1030
-		case 'add_alarm':
1031
-			$time = $content['start'];
1032
-			$offset = $time - $content['new_alarm']['date'];
1033
-			if ($event['recur_type'] != MCAL_RECUR_NONE &&
1034
-				($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
1035
-				$time < $next_occurrence['start'])
1036
-			{
1037
-				$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
1038
-			}
1039
-			if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
1040
-			{
1041
-				$alarm = array(
1042
-					'offset' => $offset,
1043
-					'time'   => $content['new_alarm']['date'],
1044
-					'all'    => !$content['new_alarm']['owner'],
1045
-					'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
1046
-				);
1047
-				if ($alarm['time'] < $this->bo->now_su)
1030
+			case 'add_alarm':
1031
+				$time = $content['start'];
1032
+				$offset = $time - $content['new_alarm']['date'];
1033
+				if ($event['recur_type'] != MCAL_RECUR_NONE &&
1034
+					($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) &&
1035
+					$time < $next_occurrence['start'])
1048 1036
 				{
1049
-					$msg = lang("Can't add alarms in the past !!!");
1037
+					$content['new_alarm']['date'] = $next_occurrence['start'] - $offset;
1050 1038
 				}
1051
-				elseif ($event['id'])	// save the alarm immediatly
1039
+				if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner']))
1052 1040
 				{
1053
-					if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
1041
+					$alarm = array(
1042
+						'offset' => $offset,
1043
+						'time'   => $content['new_alarm']['date'],
1044
+						'all'    => !$content['new_alarm']['owner'],
1045
+						'owner'  => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user,
1046
+					);
1047
+					if ($alarm['time'] < $this->bo->now_su)
1054 1048
 					{
1055
-						$alarm['id'] = $alarm_id;
1056
-						$event['alarm'][$alarm_id] = $alarm;
1049
+						$msg = lang("Can't add alarms in the past !!!");
1050
+					}
1051
+					elseif ($event['id'])	// save the alarm immediatly
1052
+					{
1053
+						if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm)))
1054
+						{
1055
+							$alarm['id'] = $alarm_id;
1056
+							$event['alarm'][$alarm_id] = $alarm;
1057 1057
 
1058
-						$msg = lang('Alarm added');
1059
-						Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
1058
+							$msg = lang('Alarm added');
1059
+							Framework::refresh_opener($msg,'calendar', $event['id'], 'update');
1060
+						}
1061
+						else
1062
+						{
1063
+							$msg = lang('Error adding the alarm');
1064
+						}
1060 1065
 					}
1061 1066
 					else
1062 1067
 					{
1063
-						$msg = lang('Error adding the alarm');
1068
+						for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
1069
+						$event['alarm'][$alarm['id']] = $alarm;
1064 1070
 					}
1065 1071
 				}
1066 1072
 				else
1067 1073
 				{
1068
-					for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {}	// get a temporary non-conflicting, numeric id
1069
-					$event['alarm'][$alarm['id']] = $alarm;
1074
+					$msg = lang('Permission denied');
1070 1075
 				}
1071
-			}
1072
-			else
1073
-			{
1074
-				$msg = lang('Permission denied');
1075
-			}
1076
-			break;
1076
+				break;
1077 1077
 		}
1078 1078
 		// add notification-errors, if we have some
1079 1079
 		if (($notification_errors = notifications::errors(true)))
Please login to merge, or discard this patch.