Test Setup Failed
Push — master ( 12c298...4a14e0 )
by Ralf
22:03
created
api/src/Vfs/WebDAV.php 2 patches
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.
Braces   +133 added lines, -50 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@  discard block
 block discarded – undo
64 64
 		// special treatment for litmus compliance test
65 65
 		// reply on its identifier header
66 66
 		// not needed for the test itself but eases debugging
67
-		if (isset($this->_SERVER['HTTP_X_LITMUS'])) {
67
+		if (isset($this->_SERVER['HTTP_X_LITMUS']))
68
+		{
68 69
 			error_log("Litmus test ".$this->_SERVER['HTTP_X_LITMUS']);
69 70
 			header("X-Litmus-reply: ".$this->_SERVER['HTTP_X_LITMUS']);
70 71
 		}
@@ -123,24 +124,30 @@  discard block
 block discarded – undo
123 124
         $path   = $this->_unslashify($this->base .$options["path"]);
124 125
         $parent = Vfs::dirname($path);
125 126
 
126
-        if (!file_exists($parent)) {
127
+        if (!file_exists($parent))
128
+        {
127 129
             return "409 Conflict";
128 130
         }
129 131
 
130
-        if (!is_dir($parent)) {
132
+        if (!is_dir($parent))
133
+        {
131 134
             return "403 Forbidden";
132 135
         }
133 136
 
134
-        if ( file_exists($path) ) {
137
+        if ( file_exists($path) )
138
+        {
135 139
             return "405 Method not allowed";
136 140
         }
137 141
 
138
-        if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
142
+        if (!empty($this->_SERVER["CONTENT_LENGTH"]))
143
+        {
144
+// no body parsing yet
139 145
             return "415 Unsupported media type";
140 146
         }
141 147
 
142 148
         $stat = mkdir($path, 0777);
143
-        if (!$stat) {
149
+        if (!$stat)
150
+        {
144 151
             return "403 Forbidden";
145 152
         }
146 153
 
@@ -157,24 +164,35 @@  discard block
 block discarded – undo
157 164
     {
158 165
         // TODO Property updates still broken (Litmus should detect this?)
159 166
 
160
-        if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
167
+        if (!empty($this->_SERVER["CONTENT_LENGTH"]))
168
+        {
169
+// no body parsing yet
161 170
             return "415 Unsupported media type";
162 171
         }
163 172
 
164 173
         // no copying to different WebDAV Servers yet
165
-        if (isset($options["dest_url"])) {
174
+        if (isset($options["dest_url"]))
175
+        {
166 176
             return "502 bad gateway";
167 177
         }
168 178
 
169 179
         $source = $this->base .$options["path"];
170
-        if (!file_exists($source)) return "404 Not found";
180
+        if (!file_exists($source))
181
+        {
182
+        	return "404 Not found";
183
+        }
171 184
 
172
-        if (is_dir($source)) { // resource is a collection
173
-            switch ($options["depth"]) {
185
+        if (is_dir($source))
186
+        {
187
+// resource is a collection
188
+            switch ($options["depth"])
189
+            {
174 190
             case "infinity": // valid
175 191
                 break;
176 192
             case "0": // valid for COPY only
177
-                if ($del) { // MOVE?
193
+                if ($del)
194
+                {
195
+// MOVE?
178 196
                     return "400 Bad request";
179 197
                 }
180 198
                 break;
@@ -187,7 +205,8 @@  discard block
 block discarded – undo
187 205
         $dest         = $this->base . $options["dest"];
188 206
         $destdir      = Vfs::dirname($dest);
189 207
 
190
-        if (!file_exists($destdir) || !is_dir($destdir)) {
208
+        if (!file_exists($destdir) || !is_dir($destdir))
209
+        {
191 210
 			//error_log(__METHOD__."(".array2string($options).", $del) file_exists('$destdir')=".array2string(file_exists($destdir)).", is_dir('$destdir')=".array2string(is_dir($destdir)));
192 211
             return "409 Conflict";
193 212
         }
@@ -195,69 +214,96 @@  discard block
 block discarded – undo
195 214
         $new          = !file_exists($dest);
196 215
         $existing_col = false;
197 216
 
198
-        if (!$new) {
199
-            if ($del && is_dir($dest)) {
200
-                if (!$options["overwrite"]) {
217
+        if (!$new)
218
+        {
219
+            if ($del && is_dir($dest))
220
+            {
221
+                if (!$options["overwrite"])
222
+                {
201 223
                     return "412 precondition failed";
202 224
                 }
203 225
                 $dest .= Vfs::basename($source);
204
-                if (file_exists($dest)) {
226
+                if (file_exists($dest))
227
+                {
205 228
                     $options["dest"] .= Vfs::basename($source);
206
-                } else {
229
+                }
230
+                else
231
+                {
207 232
                     $new          = true;
208 233
                     $existing_col = true;
209 234
                 }
210 235
             }
211 236
         }
212 237
 
213
-        if (!$new) {
214
-            if ($options["overwrite"]) {
238
+        if (!$new)
239
+        {
240
+            if ($options["overwrite"])
241
+            {
215 242
                 $stat = $this->DELETE(array("path" => $options["dest"]));
216
-                if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
243
+                if (($stat{0} != "2") && (substr($stat, 0, 3) != "404"))
244
+                {
217 245
                     return $stat;
218 246
                 }
219
-            } else {
247
+            }
248
+            else
249
+            {
220 250
                 return "412 precondition failed";
221 251
             }
222 252
         }
223 253
 
224
-        if ($del) {
254
+        if ($del)
255
+        {
225 256
 			try {
226
-				if (!rename($source, $dest)) {
257
+				if (!rename($source, $dest))
258
+				{
227 259
 					return "500 Internal server error";
228 260
 				}
229 261
 			}
230 262
 			catch (Exception\ProtectedDirectory $e) {
231 263
 				return "403 Forbidden: ".$e->getMessage();
232 264
 			}
233
-        } else {
234
-            if (is_dir($source) && $options['depth'] == 'infinity') {
265
+        }
266
+        else
267
+        {
268
+            if (is_dir($source) && $options['depth'] == 'infinity')
269
+            {
235 270
             	$files = Vfs::find($source,array('depth' => true,'url' => true));	// depth=true: return dirs first, url=true: allow urls!
236
-            } else {
271
+            }
272
+            else
273
+            {
237 274
                 $files = array($source);
238 275
             }
239 276
 
240
-            if (!is_array($files) || empty($files)) {
277
+            if (!is_array($files) || empty($files))
278
+            {
241 279
                 return "500 Internal server error";
242 280
             }
243 281
 
244 282
 
245
-            foreach ($files as $file) {
246
-                if (is_dir($file)) {
283
+            foreach ($files as $file)
284
+            {
285
+                if (is_dir($file))
286
+                {
247 287
                     $file = $this->_slashify($file);
248 288
                 }
249 289
 
250 290
                 $destfile = str_replace($source, $dest, $file);
251 291
 
252
-                if (is_dir($file)) {
253
-                    if (!is_dir($destfile)) {
292
+                if (is_dir($file))
293
+                {
294
+                    if (!is_dir($destfile))
295
+                    {
254 296
                         // TODO "mkdir -p" here? (only natively supported by PHP 5)
255
-                        if (!@mkdir($destfile)) {
297
+                        if (!@mkdir($destfile))
298
+                        {
256 299
                             return "409 Conflict";
257 300
                         }
258 301
                     }
259
-                } else {
260
-                    if (!@copy($file, $destfile)) {
302
+                }
303
+                else
304
+                {
305
+                    if (!@copy($file, $destfile))
306
+                    {
261 307
                         return "409 Conflict";
262 308
                     }
263 309
                 }
@@ -307,17 +353,23 @@  discard block
 block discarded – undo
307 353
         $info["props"][] = self::mkprop("ishidden",        Vfs::is_hidden($fspath));
308 354
 
309 355
 		// type and size (caller already made sure that path exists)
310
-		if (is_dir($fspath)) {
356
+		if (is_dir($fspath))
357
+		{
311 358
 			// directory (WebDAV collection)
312 359
 			$info['props'][] = self::mkprop	('resourcetype', array(
313 360
 			 	self::mkprop('collection', '')));
314 361
 			$info['props'][] = self::mkprop	('getcontenttype', 'httpd/unix-directory');
315
-		} else {
362
+		}
363
+		else
364
+		{
316 365
 			// plain file (WebDAV resource)
317 366
 			$info['props'][] = self::mkprop	('resourcetype', '');
318
-			if (Vfs::is_readable($path)) {
367
+			if (Vfs::is_readable($path))
368
+			{
319 369
 				$info['props'][] = self::mkprop	('getcontenttype', Vfs::mime_content_type($path));
320
-			} else {
370
+			}
371
+			else
372
+			{
321 373
 				error_log(__METHOD__."($path) $fspath is not readable!");
322 374
 				$info['props'][] = self::mkprop	('getcontenttype', 'application/x-non-readable');
323 375
 			}
@@ -389,7 +441,10 @@  discard block
 block discarded – undo
389 441
 				continue;
390 442
 			}
391 443
 			$_path = $info['path'];
392
-			if (!$n && $info['path'] != '/' && substr($info['path'],-1) == '/') $_path = substr($info['path'],0,-1);
444
+			if (!$n && $info['path'] != '/' && substr($info['path'],-1) == '/')
445
+			{
446
+				$_path = substr($info['path'],0,-1);
447
+			}
393 448
 
394 449
 			// need to encode path again, as $info['path'] is NOT encoded, but Vfs::(stat|propfind) require it
395 450
 			// otherwise pathes containing url special chars like ? or # will not stat
@@ -428,16 +483,22 @@  discard block
 block discarded – undo
428 483
 				$fileprops =& $files['files'][$path2n[$path]]['props'];
429 484
 				foreach($props as $prop)
430 485
 				{
431
-					if ($prop['ns'] == Vfs::DEFAULT_PROP_NAMESPACE && $prop['name'][0] == '#')	// eGW's customfields
486
+					if ($prop['ns'] == Vfs::DEFAULT_PROP_NAMESPACE && $prop['name'][0] == '#')
487
+					{
488
+						// eGW's customfields
432 489
 					{
433 490
 						$prop['ns'] .= 'customfields/';
491
+					}
434 492
 						$prop['name'] = substr($prop['name'],1);
435 493
 					}
436 494
 					$fileprops[] = $prop;
437 495
 				}
438 496
 			}
439 497
 		}
440
-		if ($this->debug) error_log(__METHOD__."() props=".array2string($files['files']));
498
+		if ($this->debug)
499
+		{
500
+			error_log(__METHOD__."() props=".array2string($files['files']));
501
+		}
441 502
 		return true;
442 503
 	}
443 504
 
@@ -489,7 +550,8 @@  discard block
 block discarded – undo
489 550
 	{
490 551
 		$path = Api\Translation::convert($options['path'],'utf-8');
491 552
 
492
-		foreach ($options['props'] as $key => $prop) {
553
+		foreach ($options['props'] as $key => $prop)
554
+		{
493 555
 			$attributes = array();
494 556
 			switch($prop['ns'])
495 557
 			{
@@ -506,7 +568,10 @@  discard block
 block discarded – undo
506 568
 							//$attributes['created'] = strtotime($prop['val']);
507 569
 							//break;
508 570
 						default:
509
-							if (!Vfs::proppatch($path,array($prop))) $options['props'][$key]['status'] = '403 Forbidden';
571
+							if (!Vfs::proppatch($path,array($prop)))
572
+							{
573
+								$options['props'][$key]['status'] = '403 Forbidden';
574
+							}
510 575
 							break;
511 576
 					}
512 577
 					break;
@@ -535,7 +600,10 @@  discard block
 block discarded – undo
535 600
 						case 'Win32LastAccessTime':
536 601
 						case 'Win32FileAttributes':	// not sure what that is, it was always "00000000"
537 602
 						default:
538
-							if (!Vfs::proppatch($path,array($prop))) $options['props'][$key]['status'] = '403 Forbidden';
603
+							if (!Vfs::proppatch($path,array($prop)))
604
+							{
605
+								$options['props'][$key]['status'] = '403 Forbidden';
606
+							}
539 607
 							break;
540 608
 					}
541 609
 					break;
@@ -545,15 +613,24 @@  discard block
 block discarded – undo
545 613
 					$prop['name'] = '#'.$prop['name'];
546 614
 					// fall through
547 615
 				default:
548
-					if (!Vfs::proppatch($path,array($prop))) $options['props'][$key]['status'] = '403 Forbidden';
616
+					if (!Vfs::proppatch($path,array($prop)))
617
+					{
618
+						$options['props'][$key]['status'] = '403 Forbidden';
619
+					}
549 620
 					break;
550 621
 			}
551
-			if ($this->debug) $props[] = '('.$prop['ns'].')'.$prop['name'].'='.$prop['val'];
622
+			if ($this->debug)
623
+			{
624
+				$props[] = '('.$prop['ns'].')'.$prop['name'].'='.$prop['val'];
625
+			}
552 626
 		}
553 627
 		if ($this->debug)
554 628
 		{
555 629
 			error_log(__METHOD__.": path=$options[path], props=".implode(', ',$props));
556
-			if ($attributes) error_log(__METHOD__.": path=$options[path], set attributes=".str_replace("\n",' ',print_r($attributes,true)));
630
+			if ($attributes)
631
+			{
632
+				error_log(__METHOD__.": path=$options[path], set attributes=".str_replace("\n",' ',print_r($attributes,true)));
633
+			}
557 634
 		}
558 635
 
559 636
 		return '';	// this is as the filesystem example handler does it, no true or false ...
@@ -567,7 +644,10 @@  discard block
 block discarded – undo
567 644
 	 */
568 645
 	function LOCK(&$options)
569 646
 	{
570
-		if ($this->debug) error_log(__METHOD__.'('.str_replace(array("\n",'    '),'',print_r($options,true)).')');
647
+		if ($this->debug)
648
+		{
649
+			error_log(__METHOD__.'('.str_replace(array("\n",'    '),'',print_r($options,true)).')');
650
+		}
571 651
 		// TODO recursive locks on directories not supported yet
572 652
 		if (is_dir($this->base . $options['path']) && !empty($options['depth']))
573 653
 		{
@@ -593,7 +673,10 @@  discard block
 block discarded – undo
593 673
 	 */
594 674
 	function UNLOCK(&$options)
595 675
 	{
596
-		if ($this->debug) error_log(__METHOD__.'('.str_replace(array("\n",'    '),'',print_r($options,true)).')');
676
+		if ($this->debug)
677
+		{
678
+			error_log(__METHOD__.'('.str_replace(array("\n",'    '),'',print_r($options,true)).')');
679
+		}
597 680
 		return Vfs::unlock($options['path'],$options['token']) ? '204 No Content' : '409 Conflict';
598 681
 	}
599 682
 
Please login to merge, or discard this patch.
api/src/WebDAV/Tools/_parse_lockinfo.php 2 patches
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.
Braces   +45 added lines, -20 removed lines patch added patch discarded remove patch
@@ -99,7 +99,8 @@  discard block
 block discarded – undo
99 99
 
100 100
         // open stream
101 101
         $f_in = fopen($path, "r");
102
-        if (!$f_in) {
102
+        if (!$f_in)
103
+        {
103 104
             $this->success = false;
104 105
             return;
105 106
         }
@@ -119,16 +120,19 @@  discard block
 block discarded – undo
119 120
                               XML_OPTION_CASE_FOLDING, false);
120 121
 
121 122
         // parse input
122
-        while ($this->success && !feof($f_in)) {
123
+        while ($this->success && !feof($f_in))
124
+        {
123 125
             $line = fgets($f_in);
124
-            if (is_string($line)) {
126
+            if (is_string($line))
127
+            {
125 128
                 $had_input = true;
126 129
                 $this->success &= xml_parse($xml_parser, $line, false);
127 130
             }
128 131
         }
129 132
 
130 133
         // finish parsing
131
-        if ($had_input) {
134
+        if ($had_input)
135
+        {
132 136
             $this->success &= xml_parse($xml_parser, "", true);
133 137
         }
134 138
 
@@ -156,29 +160,40 @@  discard block
 block discarded – undo
156 160
     function _startElement($parser, $name, $attrs)
157 161
     {
158 162
         // namespace handling
159
-        if (strstr($name, " ")) {
163
+        if (strstr($name, " "))
164
+        {
160 165
             list($ns, $tag) = explode(" ", $name);
161
-        } else {
166
+        }
167
+        else
168
+        {
162 169
             $ns  = "";
163 170
             $tag = $name;
164 171
         }
165 172
 
166 173
 
167
-        if ($this->collect_owner) {
174
+        if ($this->collect_owner)
175
+        {
168 176
             // everything within the <owner> tag needs to be collected
169 177
             $ns_short = "";
170 178
             $ns_attr  = "";
171
-            if ($ns) {
172
-                if ($ns == "DAV:") {
179
+            if ($ns)
180
+            {
181
+                if ($ns == "DAV:")
182
+                {
173 183
                     $ns_short = "D:";
174
-                } else {
184
+                }
185
+                else
186
+                {
175 187
                     $ns_attr = " xmlns='$ns'";
176 188
                 }
177 189
             }
178 190
             $this->owner .= "<$ns_short$tag$ns_attr>";
179
-        } else if ($ns == "DAV:") {
191
+        }
192
+        else if ($ns == "DAV:")
193
+        {
180 194
             // parse only the essential tags
181
-            switch ($tag) {
195
+            switch ($tag)
196
+            {
182 197
             case "write":
183 198
                 $this->locktype = $tag;
184 199
                 break;
@@ -204,7 +219,8 @@  discard block
 block discarded – undo
204 219
     function _data($parser, $data)
205 220
     {
206 221
         // only the <owner> tag has data content
207
-        if ($this->collect_owner) {
222
+        if ($this->collect_owner)
223
+        {
208 224
             $this->owner .= $data;
209 225
         }
210 226
     }
@@ -220,26 +236,35 @@  discard block
 block discarded – undo
220 236
     function _endElement($parser, $name)
221 237
     {
222 238
         // namespace handling
223
-        if (strstr($name, " ")) {
239
+        if (strstr($name, " "))
240
+        {
224 241
             list($ns, $tag) = explode(" ", $name);
225
-        } else {
242
+        }
243
+        else
244
+        {
226 245
             $ns  = "";
227 246
             $tag = $name;
228 247
         }
229 248
 
230 249
         // <owner> finished?
231
-        if (($ns == "DAV:") && ($tag == "owner")) {
250
+        if (($ns == "DAV:") && ($tag == "owner"))
251
+        {
232 252
             $this->collect_owner = false;
233 253
         }
234 254
 
235 255
         // within <owner> we have to collect everything
236
-        if ($this->collect_owner) {
256
+        if ($this->collect_owner)
257
+        {
237 258
             $ns_short = "";
238 259
             $ns_attr  = "";
239
-            if ($ns) {
240
-                if ($ns == "DAV:") {
260
+            if ($ns)
261
+            {
262
+                if ($ns == "DAV:")
263
+                {
241 264
                     $ns_short = "D:";
242
-                } else {
265
+                }
266
+                else
267
+                {
243 268
                     $ns_attr = " xmlns='$ns'";
244 269
                 }
245 270
             }
Please login to merge, or discard this patch.
api/src/WebDAV/Server/Filesystem.php 2 patches
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.
Braces   +212 added lines, -91 removed lines patch added patch discarded remove patch
@@ -105,15 +105,19 @@  discard block
 block discarded – undo
105 105
         // special treatment for litmus compliance test
106 106
         // reply on its identifier header
107 107
         // not needed for the test itself but eases debugging
108
-        if (isset($this->_SERVER['HTTP_X_LITMUS'])) {
108
+        if (isset($this->_SERVER['HTTP_X_LITMUS']))
109
+        {
109 110
             error_log("Litmus test ".$this->_SERVER['HTTP_X_LITMUS']);
110 111
             header("X-Litmus-reply: ".$this->_SERVER['HTTP_X_LITMUS']);
111 112
         }
112 113
 
113 114
         // set root directory, defaults to webserver document root if not set
114
-        if ($base) {
115
+        if ($base)
116
+        {
115 117
             $this->base = realpath($base); // TODO throw if not a directory
116
-        } else if (!$this->base) {
118
+        }
119
+        else if (!$this->base)
120
+        {
117 121
             $this->base = $this->_SERVER['DOCUMENT_ROOT'];
118 122
         }
119 123
 
@@ -154,7 +158,8 @@  discard block
 block discarded – undo
154 158
         $fspath = $this->base . $options["path"];
155 159
 
156 160
         // sanity check
157
-        if (!file_exists($fspath)) {
161
+        if (!file_exists($fspath))
162
+        {
158 163
             return false;
159 164
         }
160 165
 
@@ -165,7 +170,8 @@  discard block
 block discarded – undo
165 170
         $files["files"][] = $this->fileinfo($options["path"]);
166 171
 
167 172
         // information for contained resources requested?
168
-        if (!empty($options["depth"]) && is_dir($fspath) && $this->_is_readable($fspath)) {
173
+        if (!empty($options["depth"]) && is_dir($fspath) && $this->_is_readable($fspath))
174
+        {
169 175
 
170 176
             // make sure path ends with '/'
171 177
             $options["path"] = $this->_slashify($options["path"]);
@@ -173,10 +179,13 @@  discard block
 block discarded – undo
173 179
             // try to open directory
174 180
             $handle = opendir($fspath);
175 181
 
176
-            if ($handle) {
182
+            if ($handle)
183
+            {
177 184
                 // ok, now get all its contents
178
-                while ($filename = readdir($handle)) {
179
-                    if ($filename != "." && $filename != "..") {
185
+                while ($filename = readdir($handle))
186
+                {
187
+                    if ($filename != "." && $filename != "..")
188
+                    {
180 189
                         $files["files"][] = $this->fileinfo($options["path"].$filename);
181 190
                     }
182 191
                 }
@@ -218,16 +227,22 @@  discard block
 block discarded – undo
218 227
         $info["props"][] = $this->mkprop("ishidden", ('.' === substr(basename($fspath), 0, 1)));
219 228
 
220 229
         // type and size (caller already made sure that path exists)
221
-        if (is_dir($fspath)) {
230
+        if (is_dir($fspath))
231
+        {
222 232
             // directory (WebDAV collection)
223 233
             $info["props"][] = $this->mkprop("resourcetype", "collection");
224 234
             $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory");
225
-        } else {
235
+        }
236
+        else
237
+        {
226 238
             // plain file (WebDAV resource)
227 239
             $info["props"][] = $this->mkprop("resourcetype", "");
228
-            if ($this->_is_readable($fspath)) {
240
+            if ($this->_is_readable($fspath))
241
+            {
229 242
                 $info["props"][] = $this->mkprop("getcontenttype", $this->_mimetype($fspath));
230
-            } else {
243
+            }
244
+            else
245
+            {
231 246
                 $info["props"][] = $this->mkprop("getcontenttype", "application/x-non-readable");
232 247
             }
233 248
             $info["props"][] = $this->mkprop("getcontentlength", filesize($fspath));
@@ -238,7 +253,8 @@  discard block
 block discarded – undo
238 253
                         FROM {$this->db_prefix}properties
239 254
                        WHERE path = '$path'";
240 255
         $res = mysql_query($query);
241
-        while ($row = mysql_fetch_assoc($res)) {
256
+        while ($row = mysql_fetch_assoc($res))
257
+        {
242 258
             $info["props"][] = $this->mkprop($row["ns"], $row["name"], $row["value"]);
243 259
         }
244 260
         mysql_free_result($res);
@@ -259,30 +275,45 @@  discard block
 block discarded – undo
259 275
     function _can_execute($name, $path = false)
260 276
     {
261 277
         // path defaults to PATH from environment if not set
262
-        if ($path === false) {
278
+        if ($path === false)
279
+        {
263 280
             $path = getenv("PATH");
264 281
         }
265 282
 
266 283
         // check method depends on operating system
267
-        if (!strncmp(PHP_OS, "WIN", 3)) {
284
+        if (!strncmp(PHP_OS, "WIN", 3))
285
+        {
268 286
             // on Windows an appropriate COM or EXE file needs to exist
269 287
             $exts     = array(".exe", ".com");
270 288
             $check_fn = "file_exists";
271
-        } else {
289
+        }
290
+        else
291
+        {
272 292
             // anywhere else we look for an executable file of that name
273 293
             $exts     = array("");
274 294
             $check_fn = "is_executable";
275 295
         }
276 296
 
277 297
         // now check the directories in the path for the program
278
-        foreach (explode(PATH_SEPARATOR, $path) as $dir) {
298
+        foreach (explode(PATH_SEPARATOR, $path) as $dir)
299
+        {
279 300
             // skip invalid path entries
280
-            if (!file_exists($dir)) continue;
281
-            if (!is_dir($dir)) continue;
301
+            if (!file_exists($dir))
302
+            {
303
+            	continue;
304
+            }
305
+            if (!is_dir($dir))
306
+            {
307
+            	continue;
308
+            }
282 309
 
283 310
             // and now look for the file
284
-            foreach ($exts as $ext) {
285
-                if ($check_fn("$dir/$name".$ext)) return true;
311
+            foreach ($exts as $ext)
312
+            {
313
+                if ($check_fn("$dir/$name".$ext))
314
+                {
315
+                	return true;
316
+                }
286 317
             }
287 318
         }
288 319
 
@@ -323,13 +354,18 @@  discard block
 block discarded – undo
323 354
      */
324 355
     function _mimetype($fspath)
325 356
     {
326
-        if (is_dir($fspath)) {
357
+        if (is_dir($fspath))
358
+        {
327 359
             // directories are easy
328 360
             return "httpd/unix-directory";
329
-        } else if (function_exists("mime_content_type")) {
361
+        }
362
+        else if (function_exists("mime_content_type"))
363
+        {
330 364
             // use mime magic extension if available
331 365
             $mime_type = mime_content_type($fspath);
332
-        } else if ($this->_can_execute("file")) {
366
+        }
367
+        else if ($this->_can_execute("file"))
368
+        {
333 369
             // it looks like we have a 'file' command,
334 370
             // lets see it it does have mime support
335 371
             $fp    = popen("file -i '$fspath' 2>/dev/null", "r");
@@ -341,16 +377,19 @@  discard block
 block discarded – undo
341 377
             // so we test the format of the returned string
342 378
 
343 379
             // the reply begins with the requested filename
344
-            if (!strncmp($reply, "$fspath: ", strlen($fspath)+2)) {
380
+            if (!strncmp($reply, "$fspath: ", strlen($fspath)+2))
381
+            {
345 382
                 $reply = substr($reply, strlen($fspath)+2);
346 383
                 // followed by the mime type (maybe including options)
347
-                if (preg_match('|^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*|', $reply, $matches)) {
384
+                if (preg_match('|^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*|', $reply, $matches))
385
+                {
348 386
                     $mime_type = $matches[0];
349 387
                 }
350 388
             }
351 389
         }
352 390
 
353
-        if (empty($mime_type)) {
391
+        if (empty($mime_type))
392
+        {
354 393
             // Fallback solution: try to guess the type by the file extension
355 394
             // TODO: add more ...
356 395
             // TODO: it has been suggested to delegate mimetype detection
@@ -364,7 +403,8 @@  discard block
 block discarded – undo
364 403
             //       anyway (overriding it with information taken from
365 404
             //       the registry)
366 405
             // TODO: have a seperate PEAR class for mimetype detection?
367
-            switch (strtolower(strrchr(basename($fspath), "."))) {
406
+            switch (strtolower(strrchr(basename($fspath), ".")))
407
+            {
368 408
             case ".html":
369 409
                 $mime_type = "text/html";
370 410
                 break;
@@ -395,7 +435,10 @@  discard block
 block discarded – undo
395 435
         $fspath = $this->base . $options["path"];
396 436
 
397 437
         // sanity check
398
-        if (!file_exists($fspath)) return false;
438
+        if (!file_exists($fspath))
439
+        {
440
+        	return false;
441
+        }
399 442
 
400 443
         // detect resource type
401 444
         $options['mimetype'] = $this->_mimetype($fspath);
@@ -424,12 +467,14 @@  discard block
 block discarded – undo
424 467
         $fspath = $this->base . $options["path"];
425 468
 
426 469
         // is this a collection?
427
-        if (is_dir($fspath)) {
470
+        if (is_dir($fspath))
471
+        {
428 472
             return $this->GetDir($fspath, $options);
429 473
         }
430 474
 
431 475
         // the header output is the same as for HEAD
432
-        if (!$this->HEAD($options)) {
476
+        if (!$this->HEAD($options))
477
+        {
433 478
             return false;
434 479
         }
435 480
 
@@ -451,7 +496,8 @@  discard block
 block discarded – undo
451 496
     function GetDir($fspath, &$options)
452 497
     {
453 498
         $path = $this->_slashify($options["path"]);
454
-        if ($path != $options["path"]) {
499
+        if ($path != $options["path"])
500
+        {
455 501
             header("Location: ".$this->base_uri.$path);
456 502
             exit;
457 503
         }
@@ -459,12 +505,14 @@  discard block
 block discarded – undo
459 505
         // fixed width directory column format
460 506
         $format = "%15s  %-19s  %-s\n";
461 507
 
462
-        if (!$this->_is_readable($fspath)) {
508
+        if (!$this->_is_readable($fspath))
509
+        {
463 510
             return false;
464 511
         }
465 512
 
466 513
         $handle = opendir($fspath);
467
-        if (!$handle) {
514
+        if (!$handle)
515
+        {
468 516
             return false;
469 517
         }
470 518
 
@@ -476,8 +524,10 @@  discard block
 block discarded – undo
476 524
         printf($format, "Size", "Last modified", "Filename");
477 525
         echo "<hr>";
478 526
 
479
-        while ($filename = readdir($handle)) {
480
-            if ($filename != "." && $filename != "..") {
527
+        while ($filename = readdir($handle))
528
+        {
529
+            if ($filename != "." && $filename != "..")
530
+            {
481 531
                 $fullpath = $fspath.$filename;
482 532
                 $name     = htmlspecialchars($filename);
483 533
                 printf($format,
@@ -507,19 +557,23 @@  discard block
 block discarded – undo
507 557
         $fspath = $this->base . $options["path"];
508 558
 
509 559
         $dir = dirname($fspath);
510
-        if (!file_exists($dir) || !is_dir($dir)) {
560
+        if (!file_exists($dir) || !is_dir($dir))
561
+        {
511 562
             return "409 Conflict"; // TODO right status code for both?
512 563
         }
513 564
 
514 565
         $options["new"] = ! file_exists($fspath);
515 566
 
516
-        if ($options["new"] && !$this->_is_writable($dir)) {
567
+        if ($options["new"] && !$this->_is_writable($dir))
568
+        {
517 569
             return "403 Forbidden";
518 570
         }
519
-        if (!$options["new"] && !$this->_is_writable($fspath)) {
571
+        if (!$options["new"] && !$this->_is_writable($fspath))
572
+        {
520 573
             return "403 Forbidden";
521 574
         }
522
-        if (!$options["new"] && is_dir($fspath)) {
575
+        if (!$options["new"] && is_dir($fspath))
576
+        {
523 577
             return "403 Forbidden";
524 578
         }
525 579
 
@@ -541,24 +595,30 @@  discard block
 block discarded – undo
541 595
         $parent = dirname($path);
542 596
         $name   = basename($path);
543 597
 
544
-        if (!file_exists($parent)) {
598
+        if (!file_exists($parent))
599
+        {
545 600
             return "409 Conflict";
546 601
         }
547 602
 
548
-        if (!is_dir($parent)) {
603
+        if (!is_dir($parent))
604
+        {
549 605
             return "403 Forbidden";
550 606
         }
551 607
 
552
-        if ( file_exists($parent."/".$name) ) {
608
+        if ( file_exists($parent."/".$name) )
609
+        {
553 610
             return "405 Method not allowed";
554 611
         }
555 612
 
556
-        if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
613
+        if (!empty($this->_SERVER["CONTENT_LENGTH"]))
614
+        {
615
+// no body parsing yet
557 616
             return "415 Unsupported media type";
558 617
         }
559 618
 
560 619
         $stat = mkdir($parent."/".$name, 0777);
561
-        if (!$stat) {
620
+        if (!$stat)
621
+        {
562 622
             return "403 Forbidden";
563 623
         }
564 624
 
@@ -576,16 +636,20 @@  discard block
 block discarded – undo
576 636
     {
577 637
         $path = $this->base . "/" .$options["path"];
578 638
 
579
-        if (!file_exists($path)) {
639
+        if (!file_exists($path))
640
+        {
580 641
             return "404 Not found";
581 642
         }
582 643
 
583
-        if (is_dir($path)) {
644
+        if (is_dir($path))
645
+        {
584 646
             $query = "DELETE FROM {$this->db_prefix}properties
585 647
                            WHERE path LIKE '".$this->_slashify($options["path"])."%'";
586 648
             mysql_query($query);
587 649
             System::rm(array("-rf", $path));
588
-        } else {
650
+        }
651
+        else
652
+        {
589 653
             unlink($path);
590 654
         }
591 655
         $query = "DELETE FROM {$this->db_prefix}properties
@@ -617,26 +681,35 @@  discard block
 block discarded – undo
617 681
     {
618 682
         // TODO Property updates still broken (Litmus should detect this?)
619 683
 
620
-        if (!empty($this->_SERVER["CONTENT_LENGTH"])) { // no body parsing yet
684
+        if (!empty($this->_SERVER["CONTENT_LENGTH"]))
685
+        {
686
+// no body parsing yet
621 687
             return "415 Unsupported media type";
622 688
         }
623 689
 
624 690
         // no copying to different WebDAV Servers yet
625
-        if (isset($options["dest_url"])) {
691
+        if (isset($options["dest_url"]))
692
+        {
626 693
             return "502 bad gateway";
627 694
         }
628 695
 
629 696
         $source = $this->base . $options["path"];
630
-        if (!file_exists($source)) {
697
+        if (!file_exists($source))
698
+        {
631 699
             return "404 Not found";
632 700
         }
633 701
 
634
-        if (is_dir($source)) { // resource is a collection
635
-            switch ($options["depth"]) {
702
+        if (is_dir($source))
703
+        {
704
+// resource is a collection
705
+            switch ($options["depth"])
706
+            {
636 707
             case "infinity": // valid
637 708
                 break;
638 709
             case "0": // valid for COPY only
639
-                if ($del) { // MOVE?
710
+                if ($del)
711
+                {
712
+// MOVE?
640 713
                     return "400 Bad request";
641 714
                 }
642 715
                 break;
@@ -649,7 +722,8 @@  discard block
 block discarded – undo
649 722
         $dest         = $this->base . $options["dest"];
650 723
         $destdir      = dirname($dest);
651 724
 
652
-        if (!file_exists($destdir) || !is_dir($destdir)) {
725
+        if (!file_exists($destdir) || !is_dir($destdir))
726
+        {
653 727
             return "409 Conflict";
654 728
         }
655 729
 
@@ -657,38 +731,52 @@  discard block
 block discarded – undo
657 731
         $new          = !file_exists($dest);
658 732
         $existing_col = false;
659 733
 
660
-        if (!$new) {
661
-            if ($del && is_dir($dest)) {
662
-                if (!$options["overwrite"]) {
734
+        if (!$new)
735
+        {
736
+            if ($del && is_dir($dest))
737
+            {
738
+                if (!$options["overwrite"])
739
+                {
663 740
                     return "412 precondition failed";
664 741
                 }
665 742
                 $dest .= basename($source);
666
-                if (file_exists($dest)) {
743
+                if (file_exists($dest))
744
+                {
667 745
                     $options["dest"] .= basename($source);
668
-                } else {
746
+                }
747
+                else
748
+                {
669 749
                     $new          = true;
670 750
                     $existing_col = true;
671 751
                 }
672 752
             }
673 753
         }
674 754
 
675
-        if (!$new) {
676
-            if ($options["overwrite"]) {
755
+        if (!$new)
756
+        {
757
+            if ($options["overwrite"])
758
+            {
677 759
                 $stat = $this->DELETE(array("path" => $options["dest"]));
678
-                if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
760
+                if (($stat{0} != "2") && (substr($stat, 0, 3) != "404"))
761
+                {
679 762
                     return $stat;
680 763
                 }
681
-            } else {
764
+            }
765
+            else
766
+            {
682 767
                 return "412 precondition failed";
683 768
             }
684 769
         }
685 770
 
686
-        if ($del) {
687
-            if (!rename($source, $dest)) {
771
+        if ($del)
772
+        {
773
+            if (!rename($source, $dest))
774
+            {
688 775
                 return "500 Internal server error";
689 776
             }
690 777
             $destpath = $this->_unslashify($options["dest"]);
691
-            if (is_dir($source)) {
778
+            if (is_dir($source))
779
+            {
692 780
                 $query = "UPDATE {$this->db_prefix}properties
693 781
                                  SET path = REPLACE(path, '".$options["path"]."', '".$destpath."')
694 782
                                WHERE path LIKE '".$this->_slashify($options["path"])."%'";
@@ -699,40 +787,58 @@  discard block
 block discarded – undo
699 787
                              SET path = '".$destpath."'
700 788
                            WHERE path = '".$options["path"]."'";
701 789
             mysql_query($query);
702
-        } else {
703
-            if (is_dir($source) && $options["depth"] == "infinity") {	// no find for depth="0"
790
+        }
791
+        else
792
+        {
793
+            if (is_dir($source) && $options["depth"] == "infinity")
794
+            {
795
+// no find for depth="0"
704 796
                 $files = System::find($source);
705 797
                 $files = array_reverse($files);
706
-            } else {
798
+            }
799
+            else
800
+            {
707 801
                 $files = array($source);
708 802
             }
709 803
 
710
-            if (!is_array($files) || empty($files)) {
804
+            if (!is_array($files) || empty($files))
805
+            {
711 806
                 return "500 Internal server error";
712 807
             }
713 808
 
714 809
 
715
-            foreach ($files as $file) {
716
-                if (is_dir($file)) {
810
+            foreach ($files as $file)
811
+            {
812
+                if (is_dir($file))
813
+                {
717 814
                     $file = $this->_slashify($file);
718 815
                 }
719 816
 
720 817
                 $destfile = str_replace($source, $dest, $file);
721 818
 
722
-                if (is_dir($file)) {
723
-                    if (!file_exists($destfile)) {
724
-                        if (!$this->_is_writable(dirname($destfile))) {
819
+                if (is_dir($file))
820
+                {
821
+                    if (!file_exists($destfile))
822
+                    {
823
+                        if (!$this->_is_writable(dirname($destfile)))
824
+                        {
725 825
                             return "403 Forbidden";
726 826
                         }
727
-                        if (!mkdir($destfile)) {
827
+                        if (!mkdir($destfile))
828
+                        {
728 829
                             return "409 Conflict";
729 830
                         }
730
-                    } else if (!is_dir($destfile)) {
831
+                    }
832
+                    else if (!is_dir($destfile))
833
+                    {
731 834
                         return "409 Conflict";
732 835
                     }
733
-                } else {
836
+                }
837
+                else
838
+                {
734 839
 
735
-                    if (!copy($file, $destfile)) {
840
+                    if (!copy($file, $destfile))
841
+                    {
736 842
                         return "409 Conflict";
737 843
                     }
738 844
                 }
@@ -762,17 +868,24 @@  discard block
 block discarded – undo
762 868
         $dir  = dirname($path)."/";
763 869
         $base = basename($path);
764 870
 
765
-        foreach ($options["props"] as $key => $prop) {
766
-            if ($prop["ns"] == "DAV:") {
871
+        foreach ($options["props"] as $key => $prop)
872
+        {
873
+            if ($prop["ns"] == "DAV:")
874
+            {
767 875
                 $options["props"][$key]['status'] = "403 Forbidden";
768
-            } else {
769
-                if (isset($prop["val"])) {
876
+            }
877
+            else
878
+            {
879
+                if (isset($prop["val"]))
880
+                {
770 881
                     $query = "REPLACE INTO {$this->db_prefix}properties
771 882
                                            SET path = '$options[path]'
772 883
                                              , name = '$prop[name]'
773 884
                                              , ns= '$prop[ns]'
774 885
                                              , value = '$prop[val]'";
775
-                } else {
886
+                }
887
+                else
888
+                {
776 889
                     $query = "DELETE FROM {$this->db_prefix}properties
777 890
                                         WHERE path = '$options[path]'
778 891
                                           AND name = '$prop[name]'
@@ -799,13 +912,16 @@  discard block
 block discarded – undo
799 912
 
800 913
         // TODO recursive locks on directories not supported yet
801 914
         // makes litmus test "32. lock_collection" fail
802
-        if (is_dir($fspath) && !empty($options["depth"])) {
915
+        if (is_dir($fspath) && !empty($options["depth"]))
916
+        {
803 917
             return "409 Conflict";
804 918
         }
805 919
 
806 920
         $options["timeout"] = time()+300; // 5min. hardcoded
807 921
 
808
-        if (isset($options["update"])) { // Lock Update
922
+        if (isset($options["update"]))
923
+        {
924
+// Lock Update
809 925
             $where = "WHERE path = '$options[path]' AND token = '$options[update]'";
810 926
 
811 927
             $query = "SELECT owner, exclusivelock FROM {$this->db_prefix}locks $where";
@@ -813,7 +929,8 @@  discard block
 block discarded – undo
813 929
             $row   = mysql_fetch_assoc($res);
814 930
             mysql_free_result($res);
815 931
 
816
-            if (is_array($row)) {
932
+            if (is_array($row))
933
+            {
817 934
                 $query = "UPDATE {$this->db_prefix}locks
818 935
                                  SET expires = '$options[timeout]'
819 936
                                    , modified = ".time()."
@@ -825,7 +942,9 @@  discard block
 block discarded – undo
825 942
                 $options['type']  = $row["exclusivelock"] ? "write"     : "read";
826 943
 
827 944
                 return true;
828
-            } else {
945
+            }
946
+            else
947
+            {
829 948
                 return false;
830 949
             }
831 950
         }
@@ -876,11 +995,13 @@  discard block
 block discarded – undo
876 995
                ";
877 996
         $res = mysql_query($query);
878 997
 
879
-        if ($res) {
998
+        if ($res)
999
+        {
880 1000
             $row = mysql_fetch_array($res);
881 1001
             mysql_free_result($res);
882 1002
 
883
-            if ($row) {
1003
+            if ($row)
1004
+            {
884 1005
                 $result = array( "type"    => "write",
885 1006
                                  "scope"   => $row["exclusivelock"] ? "exclusive" : "shared",
886 1007
                                  "depth"   => 0,
Please login to merge, or discard this patch.
api/src/Mail/Imap.php 2 patches
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.
Braces   +130 added lines, -42 removed lines patch added patch discarded remove patch
@@ -156,7 +156,10 @@  discard block
 block discarded – undo
156 156
 		$this->loginType = $this->params['acc_imap_logintype'];
157 157
 		$this->domainName = $this->params['acc_domain'];
158 158
 
159
-		if (is_null($_timeout)) $_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
159
+		if (is_null($_timeout))
160
+		{
161
+			$_timeout = $this->params['acc_imap_timeout']?$this->params['acc_imap_timeout']:self::getTimeOut ();
162
+		}
160 163
 
161 164
 		// Horde use locale for translation of error messages
162 165
 		// need to set LC_CTYPE for charachter classification (eg. Umlauts)
@@ -169,7 +172,10 @@  discard block
 block discarded – undo
169 172
 		{
170 173
 			$username = $this->getMailBoxUserName($username);
171 174
 		}
172
-		if ($_adminConnection) $this->adminConnection($username);
175
+		if ($_adminConnection)
176
+		{
177
+			$this->adminConnection($username);
178
+		}
173 179
 		$parent_params = array(
174 180
 			'username' => $this->params[$_adminConnection ? 'acc_imap_admin_username' : 'acc_imap_username'],
175 181
 			'password' => $this->params[$_adminConnection ? 'acc_imap_admin_password' : 'acc_imap_password'],
@@ -343,7 +349,11 @@  discard block
 block discarded – undo
343 349
 	static function getTimeOut($_use='IMAP')
344 350
 	{
345 351
 		$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
346
-		if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
352
+		if (empty($timeout) || !($timeout > 0))
353
+		{
354
+			$timeout = $_use == 'SIEVE' ? 10 : 20;
355
+		}
356
+		// this is the default value
347 357
 		return $timeout;
348 358
 	}
349 359
 
@@ -406,7 +416,8 @@  discard block
 block discarded – undo
406 416
 	 */
407 417
 	function encodeFolderName($_folderName)
408 418
 	{
409
-		if($this->mbAvailable) {
419
+		if($this->mbAvailable)
420
+		{
410 421
 			return mb_convert_encoding($_folderName, "UTF7-IMAP", Api\Translation::charset());
411 422
 		}
412 423
 
@@ -424,14 +435,21 @@  discard block
 block discarded – undo
424 435
 	function getMailbox($mailbox)
425 436
 	{
426 437
 		$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_ALL);
427
-		if (empty($mailboxes)) $mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
438
+		if (empty($mailboxes))
439
+		{
440
+			$mailboxes = $this->listMailboxes($mailbox,Horde_Imap_Client::MBOX_UNSUBSCRIBED);
441
+		}
428 442
 		//error_log(__METHOD__.__LINE__.'->'.$mailbox.'/'.array2string($mailboxes));
429 443
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
430 444
 		//_debug_array($mboxes->count());
431 445
 		foreach ($mboxes->getIterator() as $k =>$box)
432 446
 		{
433 447
 			//error_log(__METHOD__.__LINE__.'->'.$k);
434
-			if ($k!='user' && $k != '' && $k==$mailbox) return $box['mailbox']; //_debug_array(array($k => $client->status($k)));
448
+			if ($k!='user' && $k != '' && $k==$mailbox)
449
+			{
450
+				return $box['mailbox'];
451
+			}
452
+			//_debug_array(array($k => $client->status($k)));
435 453
 		}
436 454
 		return ($this->mailboxExist($mailbox)?$mailbox:false);
437 455
 	}
@@ -500,8 +518,14 @@  discard block
 block discarded – undo
500 518
 			//throw new egw_exception(__METHOD__.' ('.__LINE__.") failed to ".__METHOD__." :".$e->getMessage());
501 519
 			unset($e);
502 520
 		}
503
-		if (!empty($mailbox)) return $mailbox['mailbox'];
504
-		if (empty($mailbox) && $this->mailboxExist('INBOX')) return 'INBOX';
521
+		if (!empty($mailbox))
522
+		{
523
+			return $mailbox['mailbox'];
524
+		}
525
+		if (empty($mailbox) && $this->mailboxExist('INBOX'))
526
+		{
527
+			return 'INBOX';
528
+		}
505 529
 		return null;
506 530
 	}
507 531
 
@@ -571,7 +595,10 @@  discard block
 block discarded – undo
571 595
 			));
572 596
 
573 597
 		$flags = Horde_Imap_Client::STATUS_ALL;
574
-		if ($ignoreStatusCache) $flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
598
+		if ($ignoreStatusCache)
599
+		{
600
+			$flags |= Horde_Imap_Client::STATUS_FORCE_REFRESH;
601
+		}
575 602
 
576 603
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
577 604
 		//error_log(__METHOD__.__LINE__.array2string($mboxes->count()));
@@ -614,12 +641,15 @@  discard block
 block discarded – undo
614 641
 	 */
615 642
 	function getMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
616 643
 	{
617
-		if ( is_bool($restriction_search) ){
644
+		if ( is_bool($restriction_search) )
645
+		{
618 646
 			$restriction_search = (int) $restriction_search;
619 647
 		}
620 648
 		$mailbox = '';
621
-		if ( is_int( $restriction_search ) ){
622
-			switch ( $restriction_search ) {
649
+		if ( is_int( $restriction_search ) )
650
+		{
651
+			switch ( $restriction_search )
652
+			{
623 653
 			case 0:
624 654
 				$searchstring = $reference."*";
625 655
 				break;
@@ -631,8 +661,11 @@  discard block
 block discarded – undo
631 661
 				$searchstring = $reference."%";
632 662
 				break;
633 663
 			}
634
-		}else{
635
-			if ( is_string( $restriction_search ) ){
664
+		}
665
+		else
666
+		{
667
+			if ( is_string( $restriction_search ) )
668
+			{
636 669
 				$mailbox = $searchstring = $restriction_search;
637 670
 			}
638 671
 		}
@@ -698,12 +731,15 @@  discard block
 block discarded – undo
698 731
 	 */
699 732
 	function listSubscribedMailboxes($reference = ''  , $restriction_search = 0, $returnAttributes = false)
700 733
 	{
701
-		if ( is_bool($restriction_search) ){
734
+		if ( is_bool($restriction_search) )
735
+		{
702 736
 			$restriction_search = (int) $restriction_search;
703 737
 		}
704 738
 		$mailbox = '';
705
-		if ( is_int( $restriction_search ) ){
706
-			switch ( $restriction_search ) {
739
+		if ( is_int( $restriction_search ) )
740
+		{
741
+			switch ( $restriction_search )
742
+			{
707 743
 			case 0:
708 744
 				$searchstring = $reference."*";
709 745
 				break;
@@ -715,8 +751,11 @@  discard block
 block discarded – undo
715 751
 				$searchstring = $reference."%";
716 752
 				break;
717 753
 			}
718
-		}else{
719
-			if ( is_string( $restriction_search ) ){
754
+		}
755
+		else
756
+		{
757
+			if ( is_string( $restriction_search ) )
758
+			{
720 759
 				$mailbox = $searchstring = $restriction_search;
721 760
 			}
722 761
 		}
@@ -764,12 +803,15 @@  discard block
 block discarded – undo
764 803
 	 */
765 804
 	function listUnSubscribedMailboxes($reference = ''  , $restriction_search = 0)
766 805
 	{
767
-		if ( is_bool($restriction_search) ){
806
+		if ( is_bool($restriction_search) )
807
+		{
768 808
 			$restriction_search = (int) $restriction_search;
769 809
 		}
770 810
 
771
-		if ( is_int( $restriction_search ) ){
772
-			switch ( $restriction_search ) {
811
+		if ( is_int( $restriction_search ) )
812
+		{
813
+			switch ( $restriction_search )
814
+			{
773 815
 			case 0:
774 816
 				$mailbox = $reference."*";
775 817
 				break;
@@ -781,8 +823,11 @@  discard block
 block discarded – undo
781 823
 				$mailbox = "%";
782 824
 				break;
783 825
 			}
784
-		}else{
785
-			if ( is_string( $restriction_search ) ){
826
+		}
827
+		else
828
+		{
829
+			if ( is_string( $restriction_search ) )
830
+			{
786 831
 				$mailbox = $restriction_search;
787 832
 			}
788 833
 		}
@@ -801,7 +846,10 @@  discard block
 block discarded – undo
801 846
 		foreach ($unsubscribed as $box)
802 847
 		{
803 848
 			//error_log(__METHOD__.__LINE__.' Box:'.$k.'->'.array2string($box['mailbox']->utf8));
804
-			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX') $ret[]=$box['mailbox']->utf8;
849
+			if (!in_array($box['mailbox']->utf8,$sret) && $box['mailbox']->utf8!='INBOX')
850
+			{
851
+				$ret[]=$box['mailbox']->utf8;
852
+			}
805 853
 		}
806 854
 		return $ret;
807 855
 	}
@@ -815,10 +863,16 @@  discard block
 block discarded – undo
815 863
 	 */
816 864
 	function examineMailbox($mailbox, $flags=null)
817 865
 	{
818
-		if ($mailbox=='') return false;
866
+		if ($mailbox=='')
867
+		{
868
+			return false;
869
+		}
819 870
 		$mailboxes = $this->listMailboxes($mailbox);
820 871
 
821
-		if (is_null($flags)) $flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
872
+		if (is_null($flags))
873
+		{
874
+			$flags = Horde_Imap_Client::STATUS_ALL | Horde_Imap_Client::STATUS_FLAGS | Horde_Imap_Client::STATUS_PERMFLAGS;
875
+		}
822 876
 
823 877
 		$mboxes = new Horde_Imap_Client_Mailbox_List($mailboxes);
824 878
 		//_debug_array($mboxes->count());
@@ -900,7 +954,10 @@  discard block
 block discarded – undo
900 954
 		}
901 955
 		catch (\Exception $e)
902 956
 		{
903
-			if ($this->debug) error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
957
+			if ($this->debug)
958
+			{
959
+				error_log(__METHOD__.__LINE__.' error querying for capability:'.$capability.' ->'.$e->getMessage());
960
+			}
904 961
 			return false;
905 962
 		}
906 963
 		if (!is_array($cap))
@@ -940,7 +997,10 @@  discard block
 block discarded – undo
940 997
 	{
941 998
 		foreach($_nameSpace as &$singleNameSpace)
942 999
 		{
943
-			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix']) return $singleNameSpace['prefix'];
1000
+			if (substr($_folderName,0,strlen($singleNameSpace['prefix'])) == $singleNameSpace['prefix'])
1001
+			{
1002
+				return $singleNameSpace['prefix'];
1003
+			}
944 1004
 		}
945 1005
 		return "";
946 1006
 	}
@@ -957,7 +1017,8 @@  discard block
 block discarded – undo
957 1017
 	 */
958 1018
 	function getMailBoxesRecursive($_mailbox, $delimiter, $prefix, $reclevel=0)
959 1019
 	{
960
-		if ($reclevel > 25) {
1020
+		if ($reclevel > 25)
1021
+		{
961 1022
 			error_log( __METHOD__." Recursion Level Exeeded ($reclevel) while looking up $_mailbox$delimiter ");
962 1023
 			return array();
963 1024
 		}
@@ -973,7 +1034,8 @@  discard block
 block discarded – undo
973 1034
 		{
974 1035
 			$buff = $this->getMailboxes($mbx[$mbxkeys[0]]['MAILBOX'].($mbx[$mbxkeys[0]]['MAILBOX'] == $prefix ? '':$delimiter),2,false);
975 1036
 			$allMailboxes = array();
976
-			foreach ($buff as $mbxname) {
1037
+			foreach ($buff as $mbxname)
1038
+			{
977 1039
 				$mbxname = preg_replace('~'.($delimiter == '.' ? "\\".$delimiter:$delimiter).'+~s',$delimiter,$mbxname['MAILBOX']);
978 1040
 				#echo "About to recur in level $reclevel:".$mbxname."<br>";
979 1041
 				if ( $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'] && $mbxname != $prefix  && $mbxname != $mbx[$mbxkeys[0]]['MAILBOX'].$delimiter)
@@ -981,7 +1043,10 @@  discard block
 block discarded – undo
981 1043
 					$allMailboxes = array_merge($allMailboxes, self::getMailBoxesRecursive($mbxname, $delimiter, $prefix, $reclevel));
982 1044
 				}
983 1045
 			}
984
-			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]))) $allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1046
+			if (!(in_array('\NoSelect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\Noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"]) || in_array('\noselect',$mbx[$mbxkeys[0]]["ATTRIBUTES"])))
1047
+			{
1048
+				$allMailboxes[] = $mbx[$mbxkeys[0]]['MAILBOX'];
1049
+			}
985 1050
 			return $allMailboxes;
986 1051
 		}
987 1052
 		else
@@ -1003,9 +1068,16 @@  discard block
 block discarded – undo
1003 1068
 		static $nameSpace=null;
1004 1069
 		$foldersNameSpace = array();
1005 1070
 		$delimiter = $this->getDelimiter();
1006
-		if (empty($delimiter)) $delimiter='/';
1007
-		if (is_null($nameSpace)) $nameSpace = $this->getNameSpaceArray();
1008
-		if (is_array($nameSpace)) {
1071
+		if (empty($delimiter))
1072
+		{
1073
+			$delimiter='/';
1074
+		}
1075
+		if (is_null($nameSpace))
1076
+		{
1077
+			$nameSpace = $this->getNameSpaceArray();
1078
+		}
1079
+		if (is_array($nameSpace))
1080
+		{
1009 1081
 			foreach($nameSpace as $type => $singleNameSpaceArray)
1010 1082
 			{
1011 1083
 				foreach ($singleNameSpaceArray as $singleNameSpace)
@@ -1022,7 +1094,9 @@  discard block
 block discarded – undo
1022 1094
 						$_foldersNameSpace['prefix_present'] = 'forced';
1023 1095
 						// uw-imap server with mailbox prefix or dovecot maybe
1024 1096
 						$_foldersNameSpace['prefix'] = 'mail';
1025
-					} else {
1097
+					}
1098
+					else
1099
+					{
1026 1100
 						$_foldersNameSpace['prefix_present'] = !empty($singleNameSpace['name']);
1027 1101
 						$_foldersNameSpace['prefix'] = $singleNameSpace['name'];
1028 1102
 					}
@@ -1062,7 +1136,10 @@  discard block
 block discarded – undo
1062 1136
 		$namespaces = $this->getNamespaces();
1063 1137
 		foreach ($namespaces as $nsp)
1064 1138
 		{
1065
-			if ($nsp['type']==$type && $nsp['delimiter']) return $nsp['delimiter'];
1139
+			if ($nsp['type']==$type && $nsp['delimiter'])
1140
+			{
1141
+				return $nsp['delimiter'];
1142
+			}
1066 1143
 		}
1067 1144
 		return "/";
1068 1145
 	}
@@ -1158,12 +1235,14 @@  discard block
 block discarded – undo
1158 1235
 	{
1159 1236
 		$nameSpaces = $this->getNameSpaceArray();
1160 1237
 
1161
-		if(!isset($nameSpaces['others'])) {
1238
+		if(!isset($nameSpaces['others']))
1239
+		{
1162 1240
 			return false;
1163 1241
 		}
1164 1242
 
1165 1243
 		$username = $this->getMailBoxUserName($_username);
1166
-		if($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber') {
1244
+		if($this->loginType == 'vmailmgr' || $this->loginType == 'uidNumber')
1245
+		{
1167 1246
 			$username .= '@'. $this->domainName;
1168 1247
 		}
1169 1248
 
@@ -1315,7 +1394,10 @@  discard block
 block discarded – undo
1315 1394
 	 */
1316 1395
 	public function __call($name,array $params=null)
1317 1396
 	{
1318
-		if ($this->debug) error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1397
+		if ($this->debug)
1398
+		{
1399
+			error_log(__METHOD__.'->'.$name.' with params:'.array2string($params));
1400
+		}
1319 1401
 		switch($name)
1320 1402
 		{
1321 1403
 			case 'installScript':
@@ -1350,7 +1432,10 @@  discard block
 block discarded – undo
1350 1432
 	 */
1351 1433
 	public function setVacationUser($_euser, array $_vacation, $_scriptName=null)
1352 1434
 	{
1353
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1435
+		if ($this->debug)
1436
+		{
1437
+			error_log(__METHOD__.' User:'.array2string($_euser).' Scriptname:'.array2string($_scriptName).' VacationMessage:'.array2string($_vacation));
1438
+		}
1354 1439
 
1355 1440
 		if (is_numeric($_euser))
1356 1441
 		{
@@ -1378,7 +1463,10 @@  discard block
 block discarded – undo
1378 1463
 	 */
1379 1464
 	public function getVacationUser($_euser, $_scriptName=null)
1380 1465
 	{
1381
-		if ($this->debug) error_log(__METHOD__.' User:'.array2string($_euser));
1466
+		if ($this->debug)
1467
+		{
1468
+			error_log(__METHOD__.' User:'.array2string($_euser));
1469
+		}
1382 1470
 
1383 1471
 		if (is_numeric($_euser))
1384 1472
 		{
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_admin.inc.php 1 patch
Braces   +16 added lines, -4 removed lines patch added patch discarded remove patch
@@ -131,7 +131,10 @@  discard block
 block discarded – undo
131 131
 					($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount']))
132 132
 				{
133 133
 					$url = str_replace('$path',$path,$content['mounts']['url']);
134
-					if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path;
134
+					if (empty($url) && $this->versioning)
135
+					{
136
+						$url = Versioning\StreamWrapper::PREFIX.$path;
137
+					}
135 138
 
136 139
 					if ($content['mounts']['enable'] && !$this->versioning)
137 140
 					{
@@ -227,16 +230,25 @@  discard block
 block discarded – undo
227 230
 			$content['versionedpath'] = '/';
228 231
 			$content['mtime'] = 100;
229 232
 		}
230
-		if (true) $content = array(
233
+		if (true)
234
+		{
235
+			$content = array(
231 236
 			'versionedpath' => $content['versionedpath'],
232 237
 			'mtime' => $content['mtime'],
233 238
 		);
239
+		}
234 240
 		if ($this->versioning)
235 241
 		{
236 242
 			// statistical information
237 243
 			$content += Versioning\StreamWrapper::summary();
238
-			if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%';
239
-			if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%';
244
+			if ($content['total_files'])
245
+			{
246
+				$content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%';
247
+			}
248
+			if ($content['total_size'])
249
+			{
250
+				$content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%';
251
+			}
240 252
 		}
241 253
 		if (!($content['is_root']=Vfs::$is_root))
242 254
 		{
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_shares.inc.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,10 @@
 block discarded – undo
101 101
 				$row['type'] = $row['share_writable'] ? Sharing::WRITABLE : Sharing::READONLY;
102 102
 			}
103 103
 			$row['share_passwd'] = (boolean)$row['share_passwd'];
104
-			if ($row['share_with']) $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']);
104
+			if ($row['share_with'])
105
+			{
106
+				$row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']);
107
+			}
105 108
 		}
106 109
 		return $total;
107 110
 	}
Please login to merge, or discard this patch.
filemanager/inc/class.filemanager_favorite_portlet.inc.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,10 @@
 block discarded – undo
104 104
 		if ($content['nm']['action'])
105 105
 		{
106 106
 			$msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']);
107
-			if($msg) Api\Json\Response::get()->apply('egw.message',array($msg));
107
+			if($msg)
108
+			{
109
+				Api\Json\Response::get()->apply('egw.message',array($msg));
110
+			}
108 111
 			foreach($content['nm']['selected'] as &$id)
109 112
 			{
110 113
 				$id = 'filemanager::'.$id;
Please login to merge, or discard this patch.
filemanager/test.php 1 patch
Braces   +12 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,10 @@  discard block
 block discarded – undo
22 22
 {
23 23
 	$path = '/home/'.$GLOBALS['egw_info']['user']['account_lid'];
24 24
 }
25
-if (isset($_REQUEST['path'])) $path = $_REQUEST['path'];
25
+if (isset($_REQUEST['path']))
26
+{
27
+	$path = $_REQUEST['path'];
28
+}
26 29
 echo Api\Html::form("<p>Path: ".Api\Html::input('path',$path,'text','size="40"').
27 30
 	Api\Html::submit_button('',lang('Submit'))."</p>\n",array(),'','','','','GET');
28 31
 
@@ -53,9 +56,12 @@  discard block
 block discarded – undo
53 56
 	$stime = number_format(1000*(microtime(true)-$time),1);
54 57
 
55 58
 	$time2 = microtime(true);
56
-	if ($is_dir)// && ($d = Vfs::opendir($path)))
59
+	if ($is_dir)
60
+	{
61
+		// && ($d = Vfs::opendir($path)))
57 62
 	{
58 63
 		$files = array();
64
+	}
59 65
 		//while(($file = readdir($d)))
60 66
 		foreach(Vfs::scandir($path) as $file)
61 67
 		{
@@ -69,7 +75,10 @@  discard block
 block discarded – undo
69 75
 		//closedir($d);
70 76
 		$time2f = number_format(1000*(microtime(true)-$time2),1);
71 77
 		echo "<p>".($files ? 'Directory' : 'Empty directory')." took $time2f ms</p>\n";
72
-		if($files) echo '<ol><li>'.implode("</li>\n<li>",$files).'</ol>'."\n";
78
+		if($files)
79
+		{
80
+			echo '<ol><li>'.implode("</li>\n<li>",$files).'</ol>'."\n";
81
+		}
73 82
 	}
74 83
 
75 84
 	echo "<p><b>stat('$path')</b> took $stime ms (mode = ".(isset($stat['mode'])?sprintf('%o',$stat['mode']).' = '.Vfs::int2mode($stat['mode']):'NULL').')';
Please login to merge, or discard this patch.
calendar/sitemgr/class.module_calendar_planner.inc.php 1 patch
Braces   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -178,15 +178,17 @@  discard block
 block discarded – undo
178 178
 		$acl = new Acl($anon_user);
179 179
 		$acl->read_repository();
180 180
  		foreach ($calendar_bo->resources as $type => $data)
181
-		{
181
+ 		{
182 182
 			// Check anon user's permissions - must have at least run for the hook to be available
183 183
 			if($acl->check('run',EGW_ACL_READ, $data['app']) &&
184 184
 				$type != '' && $data['app'] && Link::get_registry($data['app'], 'query')
185
-			)
186
-			{
185
+			) {
187 186
 				$_results = Link::query($data['app'], $query,$options);
188 187
 			}
189
-			if(!$_results) continue;
188
+			if(!$_results)
189
+			{
190
+				continue;
191
+			}
190 192
 			$_results = array_unique($_results);
191 193
 			foreach ($_results as $key => $value)
192 194
 			{
@@ -223,8 +225,14 @@  discard block
 block discarded – undo
223 225
 			$arguments['sortby'] = 'month';
224 226
 			$arguments['date'] = substr($arguments['date'],0,4).'0101';
225 227
 		}
226
-		if (isset($_GET['date'])) $arguments['date'] = $_GET['date'];
227
-		if (empty($arguments['cat_id'])) $arguments['cat_id'] = '';
228
+		if (isset($_GET['date']))
229
+		{
230
+			$arguments['date'] = $_GET['date'];
231
+		}
232
+		if (empty($arguments['cat_id']))
233
+		{
234
+			$arguments['cat_id'] = '';
235
+		}
228 236
 		if(isset($arguments['resources']) && in_array('r0', $arguments['resources']))
229 237
 		{
230 238
 			foreach($arguments['resources'] as $index => $value)
@@ -259,7 +267,8 @@  discard block
 block discarded – undo
259 267
 		if (is_array($params['owner']))
260 268
 		{
261 269
 			// Buffer, and add anything that gets cleared to the content
262
-			ob_start(function($buffer) use(&$html) {
270
+			ob_start(function($buffer) use(&$html)
271
+			{
263 272
 				$html .= $buffer;
264 273
 				return '';
265 274
 			});
@@ -268,20 +277,26 @@  discard block
 block discarded – undo
268 277
 			$ui->sortby = $arguments['sortby'];
269 278
 			$ui->owner = $params['owner'];
270 279
 
271
-			if (!$ui->planner_view || $ui->planner_view == 'month')	// planner monthview
280
+			if (!$ui->planner_view || $ui->planner_view == 'month')
281
+			{
282
+				// planner monthview
272 283
 			{
273 284
 				if ($ui->day < 15)	// show one complete month
274 285
 				{
275 286
 					$ui->_week_align_month($ui->first,$ui->last);
287
+			}
276 288
 				}
277 289
 				else	// show 2 half month
278 290
 				{
279 291
 					$ui->_week_align_month($ui->first,$ui->last,15);
280 292
 				}
281 293
 			}
282
-			elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN')	// weeekview
294
+			elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN')
295
+			{
296
+				// weeekview
283 297
 			{
284 298
 				$start = new Api\DateTime($ui->date);
299
+			}
285 300
 				$start->setWeekstart();
286 301
 				$ui->first = $start->format('ts');
287 302
 				$ui->last = $ui->bo->date2array($this->first);
Please login to merge, or discard this patch.