@@ -171,16 +171,16 @@ |
||
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 |
@@ -179,16 +179,16 @@ |
||
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 | } |
@@ -365,18 +365,18 @@ discard block |
||
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 |
||
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 |
@@ -580,16 +580,16 @@ discard block |
||
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 |
||
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 |
||
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 ) ){ |
@@ -68,91 +68,91 @@ |
||
68 | 68 | |
69 | 69 | switch($action) |
70 | 70 | { |
71 | - case '--version': |
|
72 | - case '--check': |
|
73 | - setup_cmd::check_installed($arguments[0],0,true); |
|
74 | - break; |
|
75 | - |
|
76 | - case '--create-header': |
|
77 | - case '--edit-header': |
|
78 | - case '--upgrade-header': |
|
79 | - case '--update-header': |
|
80 | - do_header($action == '--create-header',$arguments); |
|
81 | - break; |
|
82 | - |
|
83 | - case '--install': |
|
84 | - do_install($arguments); |
|
85 | - break; |
|
86 | - |
|
87 | - case '--config': |
|
88 | - do_config($arguments); |
|
89 | - break; |
|
90 | - |
|
91 | - case '--admin': |
|
92 | - do_admin($arguments[0]); |
|
93 | - break; |
|
94 | - |
|
95 | - case '--update': |
|
96 | - do_update($arguments[0]); |
|
97 | - break; |
|
98 | - |
|
99 | - case '--register-hooks': |
|
100 | - case '--register-all-hooks': |
|
101 | - do_hooks($arguments[0]); |
|
102 | - break; |
|
103 | - |
|
104 | - case '--backup': |
|
105 | - do_backup($arguments[0]); |
|
106 | - break; |
|
107 | - |
|
108 | - case '--languages': |
|
109 | - echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | - break; |
|
111 | - |
|
112 | - case '--charsets': |
|
113 | - echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | - break; |
|
115 | - |
|
116 | - case '--exit-codes': |
|
117 | - list_exit_codes(); |
|
118 | - break; |
|
119 | - |
|
120 | - case '--help': |
|
121 | - case '--usage': |
|
122 | - do_usage($arguments[0]); |
|
123 | - break; |
|
124 | - |
|
125 | - default: |
|
126 | - // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | - is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
129 | - { |
|
130 | - $args = array(); |
|
131 | - list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | - foreach($arguments as $arg) |
|
71 | + case '--version': |
|
72 | + case '--check': |
|
73 | + setup_cmd::check_installed($arguments[0],0,true); |
|
74 | + break; |
|
75 | + |
|
76 | + case '--create-header': |
|
77 | + case '--edit-header': |
|
78 | + case '--upgrade-header': |
|
79 | + case '--update-header': |
|
80 | + do_header($action == '--create-header',$arguments); |
|
81 | + break; |
|
82 | + |
|
83 | + case '--install': |
|
84 | + do_install($arguments); |
|
85 | + break; |
|
86 | + |
|
87 | + case '--config': |
|
88 | + do_config($arguments); |
|
89 | + break; |
|
90 | + |
|
91 | + case '--admin': |
|
92 | + do_admin($arguments[0]); |
|
93 | + break; |
|
94 | + |
|
95 | + case '--update': |
|
96 | + do_update($arguments[0]); |
|
97 | + break; |
|
98 | + |
|
99 | + case '--register-hooks': |
|
100 | + case '--register-all-hooks': |
|
101 | + do_hooks($arguments[0]); |
|
102 | + break; |
|
103 | + |
|
104 | + case '--backup': |
|
105 | + do_backup($arguments[0]); |
|
106 | + break; |
|
107 | + |
|
108 | + case '--languages': |
|
109 | + echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); |
|
110 | + break; |
|
111 | + |
|
112 | + case '--charsets': |
|
113 | + echo html_entity_decode(implode("\n",$GLOBALS['egw_setup']->translation->get_charsets(false)),ENT_COMPAT,'utf-8')."\n"; |
|
114 | + break; |
|
115 | + |
|
116 | + case '--exit-codes': |
|
117 | + list_exit_codes(); |
|
118 | + break; |
|
119 | + |
|
120 | + case '--help': |
|
121 | + case '--usage': |
|
122 | + do_usage($arguments[0]); |
|
123 | + break; |
|
124 | + |
|
125 | + default: |
|
126 | + // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE |
|
127 | + if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && |
|
128 | + is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) |
|
133 | 129 | { |
134 | - list($name,$value) = explode('=',$arg,2); |
|
135 | - if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | - { |
|
137 | - throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | - } |
|
139 | - if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
130 | + $args = array(); |
|
131 | + list($args['domain']) = explode(',', array_shift($arguments)); // domain must be first argument, to ensure right domain get's selected in header-include |
|
132 | + foreach($arguments as $arg) |
|
140 | 133 | { |
141 | - list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | - $args[$name][$sub] = $value; |
|
143 | - } |
|
144 | - else |
|
145 | - { |
|
146 | - $args[$name] = $value; |
|
134 | + list($name,$value) = explode('=',$arg,2); |
|
135 | + if(property_exists('admin_cmd',$name)) // dont allow to overwrite admin_cmd properties |
|
136 | + { |
|
137 | + throw new Api\Exception\WrongUserinput(lang("Invalid argument '%1' !!!",$arg),90); |
|
138 | + } |
|
139 | + if (substr($name,-1) == ']') // allow 1-dim. arrays |
|
140 | + { |
|
141 | + list($name,$sub) = explode('[',substr($name,0,-1),2); |
|
142 | + $args[$name][$sub] = $value; |
|
143 | + } |
|
144 | + else |
|
145 | + { |
|
146 | + $args[$name] = $value; |
|
147 | + } |
|
147 | 148 | } |
149 | + $cmd = new $class($args); |
|
150 | + $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | + if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | + echo "$msg\n"; |
|
153 | + break; |
|
148 | 154 | } |
149 | - $cmd = new $class($args); |
|
150 | - $msg = $cmd->run($time=null, $set_modifier=true, $skip_checks=false, $check_only=$dry_run); |
|
151 | - if (is_array($msg)) $msg = print_r($msg,true); |
|
152 | - echo "$msg\n"; |
|
153 | - break; |
|
154 | - } |
|
155 | - throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
155 | + throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$action),90); |
|
156 | 156 | } |
157 | 157 | exit(0); |
158 | 158 |
@@ -344,105 +344,105 @@ discard block |
||
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 |
||
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 |
||
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 & 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"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", |
|
861 | - '<td class=td-1><span class="green box"> </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"> </span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", |
|
865 | - '<td class=td-1><span class="red box"> </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"> </span>Free: ',bsize($mem_avail).sprintf(" (%.1f%%)",$mem_avail*100/$mem_size),"</td>\n", |
|
861 | + '<td class=td-1><span class="green box"> </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"> </span>Used: ',bsize($mem_used).sprintf(" (%.1f%%)",$mem_used *100/$mem_size),"</td>\n", |
|
865 | + '<td class=td-1><span class="red box"> </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 |
||
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/> <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/> <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 | - ' Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', |
|
977 | - ' <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 | + ' Search: <input name=SEARCH value="',$MYREQUEST['SEARCH'],'" type=text size=25/>', |
|
977 | + ' <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 |
||
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 |
||
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 |
@@ -598,220 +598,220 @@ discard block |
||
598 | 598 | |
599 | 599 | switch((string)$button) |
600 | 600 | { |
601 | - case 'exception': // create an exception in a recuring event |
|
602 | - $msg = $this->_create_exception($event,$preserv); |
|
603 | - break; |
|
601 | + case 'exception': // create an exception in a recuring event |
|
602 | + $msg = $this->_create_exception($event,$preserv); |
|
603 | + break; |
|
604 | 604 | |
605 | - case 'copy': // create new event with copied content, some content need to be unset to make a "new" event |
|
606 | - unset($event['id']); |
|
607 | - unset($event['uid']); |
|
608 | - unset($event['reference']); |
|
609 | - unset($preserv['reference']); |
|
610 | - unset($event['recurrence']); |
|
611 | - unset($preserv['recurrence']); |
|
612 | - unset($event['recur_exception']); |
|
613 | - unset($event['edit_single']); // in case it has been set |
|
614 | - unset($event['modified']); |
|
615 | - unset($event['modifier']); |
|
616 | - unset($event['caldav_name']); |
|
617 | - $event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner']; |
|
605 | + case 'copy': // create new event with copied content, some content need to be unset to make a "new" event |
|
606 | + unset($event['id']); |
|
607 | + unset($event['uid']); |
|
608 | + unset($event['reference']); |
|
609 | + unset($preserv['reference']); |
|
610 | + unset($event['recurrence']); |
|
611 | + unset($preserv['recurrence']); |
|
612 | + unset($event['recur_exception']); |
|
613 | + unset($event['edit_single']); // in case it has been set |
|
614 | + unset($event['modified']); |
|
615 | + unset($event['modifier']); |
|
616 | + unset($event['caldav_name']); |
|
617 | + $event['owner'] = !(int)$event['owner'] || !$this->bo->check_perms(Acl::ADD,0,$event['owner']) ? $this->user : $event['owner']; |
|
618 | + |
|
619 | + // Clear participant stati |
|
620 | + foreach($event['participant_types'] as $type => &$participants) |
|
621 | + { |
|
622 | + foreach($participants as $id => &$p_response) |
|
623 | + { |
|
624 | + if($type == 'u' && $id == $event['owner']) continue; |
|
625 | + calendar_so::split_status($p_response, $quantity, $role); |
|
626 | + // if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it |
|
627 | + $status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U'; |
|
628 | + $p_response = calendar_so::combine_status($status,$quantity,$role); |
|
629 | + } |
|
630 | + } |
|
618 | 631 | |
619 | - // Clear participant stati |
|
620 | - foreach($event['participant_types'] as $type => &$participants) |
|
621 | - { |
|
622 | - foreach($participants as $id => &$p_response) |
|
632 | + // Copy alarms |
|
633 | + if (is_array($event['alarm'])) |
|
623 | 634 | { |
624 | - if($type == 'u' && $id == $event['owner']) continue; |
|
625 | - calendar_so::split_status($p_response, $quantity, $role); |
|
626 | - // if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it |
|
627 | - $status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U'; |
|
628 | - $p_response = calendar_so::combine_status($status,$quantity,$role); |
|
635 | + foreach($event['alarm'] as $n => &$alarm) |
|
636 | + { |
|
637 | + unset($alarm['id']); |
|
638 | + unset($alarm['cal_id']); |
|
639 | + } |
|
629 | 640 | } |
630 | - } |
|
631 | 641 | |
632 | - // Copy alarms |
|
633 | - if (is_array($event['alarm'])) |
|
634 | - { |
|
635 | - foreach($event['alarm'] as $n => &$alarm) |
|
642 | + // Get links to be copied |
|
643 | + // With no ID, $content['link_to']['to_id'] is used |
|
644 | + $content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0); |
|
645 | + foreach(Link::get_links('calendar', $content['id']) as $link) |
|
636 | 646 | { |
637 | - unset($alarm['id']); |
|
638 | - unset($alarm['cal_id']); |
|
647 | + if ($link['app'] != Link::VFS_APPNAME) |
|
648 | + { |
|
649 | + Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
|
650 | + } |
|
651 | + elseif ($link['app'] == Link::VFS_APPNAME) |
|
652 | + { |
|
653 | + Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array( |
|
654 | + 'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'], |
|
655 | + 'name' => $link['id'], |
|
656 | + ), $link['remark']); |
|
657 | + } |
|
639 | 658 | } |
640 | - } |
|
659 | + unset($link); |
|
660 | + $preserv['view'] = $preserv['edit_single'] = false; |
|
661 | + $msg = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('calendar','entry'))); |
|
662 | + $event['title'] = lang('Copy of:').' '.$event['title']; |
|
663 | + break; |
|
641 | 664 | |
642 | - // Get links to be copied |
|
643 | - // With no ID, $content['link_to']['to_id'] is used |
|
644 | - $content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0); |
|
645 | - foreach(Link::get_links('calendar', $content['id']) as $link) |
|
646 | - { |
|
647 | - if ($link['app'] != Link::VFS_APPNAME) |
|
665 | + case 'mail': |
|
666 | + case 'sendrequest': |
|
667 | + case 'save': |
|
668 | + case 'print': |
|
669 | + case 'apply': |
|
670 | + case 'infolog': |
|
671 | + if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event)) |
|
648 | 672 | { |
649 | - Link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
|
673 | + $msg = lang('Permission denied'); |
|
674 | + $button = ''; |
|
675 | + break; |
|
650 | 676 | } |
651 | - elseif ($link['app'] == Link::VFS_APPNAME) |
|
677 | + if ($event['start'] > $event['end']) |
|
652 | 678 | { |
653 | - Link::link('calendar', $content['link_to']['to_id'], Link::VFS_APPNAME, array( |
|
654 | - 'tmp_name' => Link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'], |
|
655 | - 'name' => $link['id'], |
|
656 | - ), $link['remark']); |
|
679 | + $msg = lang('Error: Starttime has to be before the endtime !!!'); |
|
680 | + $button = ''; |
|
681 | + break; |
|
657 | 682 | } |
658 | - } |
|
659 | - unset($link); |
|
660 | - $preserv['view'] = $preserv['edit_single'] = false; |
|
661 | - $msg = lang('%1 copied - the copy can now be edited', lang(Link::get_registry('calendar','entry'))); |
|
662 | - $event['title'] = lang('Copy of:').' '.$event['title']; |
|
663 | - break; |
|
664 | - |
|
665 | - case 'mail': |
|
666 | - case 'sendrequest': |
|
667 | - case 'save': |
|
668 | - case 'print': |
|
669 | - case 'apply': |
|
670 | - case 'infolog': |
|
671 | - if ($event['id'] && !$this->bo->check_perms(Acl::EDIT,$event)) |
|
672 | - { |
|
673 | - $msg = lang('Permission denied'); |
|
674 | - $button = ''; |
|
675 | - break; |
|
676 | - } |
|
677 | - if ($event['start'] > $event['end']) |
|
678 | - { |
|
679 | - $msg = lang('Error: Starttime has to be before the endtime !!!'); |
|
680 | - $button = ''; |
|
681 | - break; |
|
682 | - } |
|
683 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate']) |
|
684 | - { |
|
685 | - $msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!'); |
|
686 | - $button = ''; |
|
687 | - break; |
|
688 | - } |
|
689 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval'])) |
|
690 | - { |
|
691 | - $msg = lang('Error: Duration of event longer then recurrence interval!'); |
|
692 | - $button = ''; |
|
693 | - break; |
|
694 | - } |
|
695 | - if (!$event['participants']) |
|
696 | - { |
|
697 | - $msg = lang('Error: no participants selected !!!'); |
|
698 | - $button = ''; |
|
699 | - break; |
|
700 | - } |
|
701 | - // if private event with ressource reservation is forbidden |
|
702 | - if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private']) |
|
703 | - { |
|
704 | - foreach (array_keys($event['participants']) as $uid) |
|
683 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate']) |
|
684 | + { |
|
685 | + $msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!'); |
|
686 | + $button = ''; |
|
687 | + break; |
|
688 | + } |
|
689 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval'])) |
|
690 | + { |
|
691 | + $msg = lang('Error: Duration of event longer then recurrence interval!'); |
|
692 | + $button = ''; |
|
693 | + break; |
|
694 | + } |
|
695 | + if (!$event['participants']) |
|
705 | 696 | { |
706 | - if ($uid[0] == 'r') //ressource detection |
|
697 | + $msg = lang('Error: no participants selected !!!'); |
|
698 | + $button = ''; |
|
699 | + break; |
|
700 | + } |
|
701 | + // if private event with ressource reservation is forbidden |
|
702 | + if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private']) |
|
703 | + { |
|
704 | + foreach (array_keys($event['participants']) as $uid) |
|
707 | 705 | { |
708 | - $msg = lang('Error: ressources reservation in private events is not allowed!!!'); |
|
709 | - $button = ''; |
|
710 | - break 2; //break foreach and case |
|
706 | + if ($uid[0] == 'r') //ressource detection |
|
707 | + { |
|
708 | + $msg = lang('Error: ressources reservation in private events is not allowed!!!'); |
|
709 | + $button = ''; |
|
710 | + break 2; //break foreach and case |
|
711 | + } |
|
711 | 712 | } |
712 | 713 | } |
713 | - } |
|
714 | - if ($content['edit_single']) // we edited a single event from a series |
|
715 | - { |
|
716 | - $event['reference'] = $event['id']; |
|
717 | - $event['recurrence'] = $content['edit_single']; |
|
718 | - unset($event['id']); |
|
719 | - $conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']); |
|
720 | - if (!is_array($conflicts) && $conflicts) |
|
714 | + if ($content['edit_single']) // we edited a single event from a series |
|
721 | 715 | { |
722 | - // now we need to add the original start as recur-execption to the series |
|
723 | - $recur_event = $this->bo->read($event['reference']); |
|
724 | - $recur_event['recur_exception'][] = $content['edit_single']; |
|
725 | - // check if we need to move the alarms, because they are next on that exception |
|
726 | - foreach($recur_event['alarm'] as $id => $alarm) |
|
716 | + $event['reference'] = $event['id']; |
|
717 | + $event['recurrence'] = $content['edit_single']; |
|
718 | + unset($event['id']); |
|
719 | + $conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']); |
|
720 | + if (!is_array($conflicts) && $conflicts) |
|
727 | 721 | { |
728 | - if ($alarm['time'] == $content['edit_single'] - $alarm['offset']) |
|
722 | + // now we need to add the original start as recur-execption to the series |
|
723 | + $recur_event = $this->bo->read($event['reference']); |
|
724 | + $recur_event['recur_exception'][] = $content['edit_single']; |
|
725 | + // check if we need to move the alarms, because they are next on that exception |
|
726 | + foreach($recur_event['alarm'] as $id => $alarm) |
|
729 | 727 | { |
730 | - $rrule = calendar_rrule::event2rrule($recur_event, true); |
|
731 | - foreach ($rrule as $time) |
|
728 | + if ($alarm['time'] == $content['edit_single'] - $alarm['offset']) |
|
732 | 729 | { |
733 | - if ($content['edit_single'] < $time->format('ts')) |
|
730 | + $rrule = calendar_rrule::event2rrule($recur_event, true); |
|
731 | + foreach ($rrule as $time) |
|
734 | 732 | { |
735 | - $alarm['time'] = $time->format('ts') - $alarm['offset']; |
|
736 | - $this->bo->save_alarm($event['reference'], $alarm); |
|
737 | - break; |
|
733 | + if ($content['edit_single'] < $time->format('ts')) |
|
734 | + { |
|
735 | + $alarm['time'] = $time->format('ts') - $alarm['offset']; |
|
736 | + $this->bo->save_alarm($event['reference'], $alarm); |
|
737 | + break; |
|
738 | + } |
|
738 | 739 | } |
739 | 740 | } |
740 | 741 | } |
741 | - } |
|
742 | - unset($recur_event['start']); unset($recur_event['end']); // no update necessary |
|
743 | - unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start! |
|
744 | - $this->bo->update($recur_event,true); // no conflict check here |
|
742 | + unset($recur_event['start']); unset($recur_event['end']); // no update necessary |
|
743 | + unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start! |
|
744 | + $this->bo->update($recur_event,true); // no conflict check here |
|
745 | 745 | |
746 | - // Save links |
|
747 | - if($content['links']) |
|
748 | - { |
|
749 | - Link::link('calendar', $event['id'], $content['links']['to_id']); |
|
750 | - } |
|
746 | + // Save links |
|
747 | + if($content['links']) |
|
748 | + { |
|
749 | + Link::link('calendar', $event['id'], $content['links']['to_id']); |
|
750 | + } |
|
751 | 751 | |
752 | - if(Api\Json\Response::isJSONResponse()) |
|
752 | + if(Api\Json\Response::isJSONResponse()) |
|
753 | + { |
|
754 | + // Sending null will trigger a removal of the original |
|
755 | + // for that date |
|
756 | + Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null)); |
|
757 | + } |
|
758 | + |
|
759 | + unset($recur_event); |
|
760 | + unset($event['edit_single']); // if we further edit it, it's just a single event |
|
761 | + unset($preserv['edit_single']); |
|
762 | + } |
|
763 | + else // conflict or error, we need to reset everything to the state befor we tried to save it |
|
753 | 764 | { |
754 | - // Sending null will trigger a removal of the original |
|
755 | - // for that date |
|
756 | - Api\Json\Response::get()->generic('data', array('uid' => 'calendar::'.$content['reference'].':'.$content['actual_date'], 'data' => null)); |
|
765 | + $event['id'] = $event['reference']; |
|
766 | + $event['reference'] = $event['recurrence'] = 0; |
|
767 | + $event['uid'] = $content['uid']; |
|
757 | 768 | } |
758 | - |
|
759 | - unset($recur_event); |
|
760 | - unset($event['edit_single']); // if we further edit it, it's just a single event |
|
761 | - unset($preserv['edit_single']); |
|
769 | + $update_type = 'edit'; |
|
762 | 770 | } |
763 | - else // conflict or error, we need to reset everything to the state befor we tried to save it |
|
771 | + else // we edited a non-reccuring event or the whole series |
|
764 | 772 | { |
765 | - $event['id'] = $event['reference']; |
|
766 | - $event['reference'] = $event['recurrence'] = 0; |
|
767 | - $event['uid'] = $content['uid']; |
|
768 | - } |
|
769 | - $update_type = 'edit'; |
|
770 | - } |
|
771 | - else // we edited a non-reccuring event or the whole series |
|
772 | - { |
|
773 | - if (($old_event = $this->bo->read($event['id']))) |
|
774 | - { |
|
775 | - if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
773 | + if (($old_event = $this->bo->read($event['id']))) |
|
776 | 774 | { |
777 | - $update_type = 'edit'; |
|
778 | - |
|
779 | - // we edit a existing series event |
|
780 | - if ($event['start'] != $old_event['start'] || |
|
781 | - $event['whole_day'] != $old_event['whole_day'] || |
|
782 | - $event['end'] != $old_event['end']) |
|
775 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
783 | 776 | { |
784 | - // calculate offset against old series start or clicked recurrance, |
|
785 | - // depending on which is smaller |
|
786 | - $offset = $event['start'] - $old_event['start']; |
|
787 | - if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date'])) |
|
788 | - { |
|
789 | - $offset = $off2; |
|
790 | - } |
|
791 | - $msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']); |
|
792 | - if($msg) |
|
777 | + $update_type = 'edit'; |
|
778 | + |
|
779 | + // we edit a existing series event |
|
780 | + if ($event['start'] != $old_event['start'] || |
|
781 | + $event['whole_day'] != $old_event['whole_day'] || |
|
782 | + $event['end'] != $old_event['end']) |
|
793 | 783 | { |
794 | - $noerror = false; |
|
784 | + // calculate offset against old series start or clicked recurrance, |
|
785 | + // depending on which is smaller |
|
786 | + $offset = $event['start'] - $old_event['start']; |
|
787 | + if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date'])) |
|
788 | + { |
|
789 | + $offset = $off2; |
|
790 | + } |
|
791 | + $msg = $this->_break_recurring($event, $old_event, $event['actual_date'] + $offset,$content['no_notifications']); |
|
792 | + if($msg) |
|
793 | + { |
|
794 | + $noerror = false; |
|
795 | + } |
|
795 | 796 | } |
796 | 797 | } |
797 | - } |
|
798 | - else |
|
799 | - { |
|
800 | - if ($old_event['start'] != $event['start'] || |
|
801 | - $old_event['end'] != $event['end'] || |
|
802 | - $event['whole_day'] != $old_event['whole_day']) |
|
798 | + else |
|
803 | 799 | { |
804 | - $sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])); |
|
805 | - foreach((array)$event['participants'] as $uid => $status) |
|
800 | + if ($old_event['start'] != $event['start'] || |
|
801 | + $old_event['end'] != $event['end'] || |
|
802 | + $event['whole_day'] != $old_event['whole_day']) |
|
806 | 803 | { |
807 | - $q = $r = null; |
|
808 | - calendar_so::split_status($status,$q,$r); |
|
809 | - if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U') |
|
804 | + $sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])); |
|
805 | + foreach((array)$event['participants'] as $uid => $status) |
|
810 | 806 | { |
811 | - $preferences = new Api\Preferences($uid); |
|
812 | - $part_prefs = $preferences->read_repository(); |
|
813 | - switch ($part_prefs['calendar']['reset_stati']) |
|
807 | + $q = $r = null; |
|
808 | + calendar_so::split_status($status,$q,$r); |
|
809 | + if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U') |
|
814 | 810 | { |
811 | + $preferences = new Api\Preferences($uid); |
|
812 | + $part_prefs = $preferences->read_repository(); |
|
813 | + switch ($part_prefs['calendar']['reset_stati']) |
|
814 | + { |
|
815 | 815 | case 'no': |
816 | 816 | break; |
817 | 817 | case 'startday': |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | $status_reset_to_unknown = true; |
821 | 821 | $event['participants'][$uid] = calendar_so::combine_status('U',$q,$r); |
822 | 822 | // todo: report reset status to user |
823 | - } |
|
823 | + } |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | // check if we need to move the alarms, because they are relative |
@@ -962,83 +962,83 @@ discard block |
||
962 | 962 | } |
963 | 963 | break; |
964 | 964 | |
965 | - case 'cancel': |
|
966 | - if($content['cancel_needs_refresh']) |
|
967 | - { |
|
968 | - Framework::refresh_opener($msg, 'calendar'); |
|
969 | - } |
|
970 | - break; |
|
971 | - |
|
972 | - case 'delete': // delete of event (regular or series) |
|
973 | - $exceptions_kept = null; |
|
974 | - if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'], |
|
975 | - $content['delete_exceptions'] == 'true', $exceptions_kept)) |
|
976 | - { |
|
977 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single']) |
|
965 | + case 'cancel': |
|
966 | + if($content['cancel_needs_refresh']) |
|
978 | 967 | { |
979 | - $msg = lang('Series deleted'); |
|
980 | - if ($exceptions_kept) $msg .= lang(', exceptions preserved'); |
|
968 | + Framework::refresh_opener($msg, 'calendar'); |
|
981 | 969 | } |
982 | - else |
|
970 | + break; |
|
971 | + |
|
972 | + case 'delete': // delete of event (regular or series) |
|
973 | + $exceptions_kept = null; |
|
974 | + if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'], |
|
975 | + $content['delete_exceptions'] == 'true', $exceptions_kept)) |
|
983 | 976 | { |
984 | - $msg = lang('Event deleted'); |
|
985 | - } |
|
977 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single']) |
|
978 | + { |
|
979 | + $msg = lang('Series deleted'); |
|
980 | + if ($exceptions_kept) $msg .= lang(', exceptions preserved'); |
|
981 | + } |
|
982 | + else |
|
983 | + { |
|
984 | + $msg = lang('Event deleted'); |
|
985 | + } |
|
986 | 986 | |
987 | - } |
|
988 | - break; |
|
987 | + } |
|
988 | + break; |
|
989 | 989 | |
990 | - case 'freetime': |
|
991 | - // the "click" has to be in onload, to make sure the button is already created |
|
992 | - $event['button_was'] = $button; |
|
993 | - break; |
|
990 | + case 'freetime': |
|
991 | + // the "click" has to be in onload, to make sure the button is already created |
|
992 | + $event['button_was'] = $button; |
|
993 | + break; |
|
994 | 994 | |
995 | - case 'add_alarm': |
|
996 | - $time = $content['start']; |
|
997 | - $offset = $time - $content['new_alarm']['date']; |
|
998 | - if ($event['recur_type'] != MCAL_RECUR_NONE && |
|
999 | - ($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) && |
|
1000 | - $time < $next_occurrence['start']) |
|
1001 | - { |
|
1002 | - $content['new_alarm']['date'] = $next_occurrence['start'] - $offset; |
|
1003 | - } |
|
1004 | - if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner'])) |
|
1005 | - { |
|
1006 | - $alarm = array( |
|
1007 | - 'offset' => $offset, |
|
1008 | - 'time' => $content['new_alarm']['date'], |
|
1009 | - 'all' => !$content['new_alarm']['owner'], |
|
1010 | - 'owner' => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user, |
|
1011 | - ); |
|
1012 | - if ($alarm['time'] < $this->bo->now_su) |
|
995 | + case 'add_alarm': |
|
996 | + $time = $content['start']; |
|
997 | + $offset = $time - $content['new_alarm']['date']; |
|
998 | + if ($event['recur_type'] != MCAL_RECUR_NONE && |
|
999 | + ($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) && |
|
1000 | + $time < $next_occurrence['start']) |
|
1013 | 1001 | { |
1014 | - $msg = lang("Can't add alarms in the past !!!"); |
|
1002 | + $content['new_alarm']['date'] = $next_occurrence['start'] - $offset; |
|
1015 | 1003 | } |
1016 | - elseif ($event['id']) // save the alarm immediatly |
|
1004 | + if ($this->bo->check_perms(Acl::EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner'])) |
|
1017 | 1005 | { |
1018 | - if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm))) |
|
1006 | + $alarm = array( |
|
1007 | + 'offset' => $offset, |
|
1008 | + 'time' => $content['new_alarm']['date'], |
|
1009 | + 'all' => !$content['new_alarm']['owner'], |
|
1010 | + 'owner' => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user, |
|
1011 | + ); |
|
1012 | + if ($alarm['time'] < $this->bo->now_su) |
|
1013 | + { |
|
1014 | + $msg = lang("Can't add alarms in the past !!!"); |
|
1015 | + } |
|
1016 | + elseif ($event['id']) // save the alarm immediatly |
|
1019 | 1017 | { |
1020 | - $alarm['id'] = $alarm_id; |
|
1021 | - $event['alarm'][$alarm_id] = $alarm; |
|
1018 | + if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm))) |
|
1019 | + { |
|
1020 | + $alarm['id'] = $alarm_id; |
|
1021 | + $event['alarm'][$alarm_id] = $alarm; |
|
1022 | 1022 | |
1023 | - $msg = lang('Alarm added'); |
|
1024 | - Framework::refresh_opener($msg,'calendar', $event['id'], 'update'); |
|
1023 | + $msg = lang('Alarm added'); |
|
1024 | + Framework::refresh_opener($msg,'calendar', $event['id'], 'update'); |
|
1025 | + } |
|
1026 | + else |
|
1027 | + { |
|
1028 | + $msg = lang('Error adding the alarm'); |
|
1029 | + } |
|
1025 | 1030 | } |
1026 | 1031 | else |
1027 | 1032 | { |
1028 | - $msg = lang('Error adding the alarm'); |
|
1033 | + for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {} // get a temporary non-conflicting, numeric id |
|
1034 | + $event['alarm'][$alarm['id']] = $alarm; |
|
1029 | 1035 | } |
1030 | 1036 | } |
1031 | 1037 | else |
1032 | 1038 | { |
1033 | - for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {} // get a temporary non-conflicting, numeric id |
|
1034 | - $event['alarm'][$alarm['id']] = $alarm; |
|
1039 | + $msg = lang('Permission denied'); |
|
1035 | 1040 | } |
1036 | - } |
|
1037 | - else |
|
1038 | - { |
|
1039 | - $msg = lang('Permission denied'); |
|
1040 | - } |
|
1041 | - break; |
|
1041 | + break; |
|
1042 | 1042 | } |
1043 | 1043 | // add notification-errors, if we have some |
1044 | 1044 | if (($notification_errors = notifications::errors(true))) |
@@ -816,34 +816,34 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -179,7 +179,7 @@ discard block |
||
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 |
||
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) |