@@ -265,8 +265,9 @@ |
||
| 265 | 265 | try { |
| 266 | 266 | $result = $this->service->importUrl($uri, $className, $extraHeaders); |
| 267 | 267 | } catch (Zend_Gdata_App_HttpException $e) { |
| 268 | - if ($e->getResponse()->getStatus() != '304') |
|
| 269 | - throw $e; |
|
| 268 | + if ($e->getResponse()->getStatus() != '304') { |
|
| 269 | + throw $e; |
|
| 270 | + } |
|
| 270 | 271 | } |
| 271 | 272 | |
| 272 | 273 | return $result; |
@@ -196,7 +196,9 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | // If we are connected to the wrong host, disconnect first |
| 198 | 198 | if (($this->connected_to[0] != $host || $this->connected_to[1] != $port)) { |
| 199 | - if (is_resource($this->socket)) $this->close(); |
|
| 199 | + if (is_resource($this->socket)) { |
|
| 200 | + $this->close(); |
|
| 201 | + } |
|
| 200 | 202 | } |
| 201 | 203 | |
| 202 | 204 | // Now, if we are not connected, connect |
@@ -220,7 +222,9 @@ discard block |
||
| 220 | 222 | } |
| 221 | 223 | |
| 222 | 224 | $flags = STREAM_CLIENT_CONNECT; |
| 223 | - if ($this->config['persistent']) $flags |= STREAM_CLIENT_PERSISTENT; |
|
| 225 | + if ($this->config['persistent']) { |
|
| 226 | + $flags |= STREAM_CLIENT_PERSISTENT; |
|
| 227 | + } |
|
| 224 | 228 | |
| 225 | 229 | $this->socket = @stream_socket_client($host . ':' . $port, |
| 226 | 230 | $errno, |
@@ -277,10 +281,14 @@ discard block |
||
| 277 | 281 | |
| 278 | 282 | // Build request headers |
| 279 | 283 | $path = $uri->getPath(); |
| 280 | - if ($uri->getQuery()) $path .= '?' . $uri->getQuery(); |
|
| 284 | + if ($uri->getQuery()) { |
|
| 285 | + $path .= '?' . $uri->getQuery(); |
|
| 286 | + } |
|
| 281 | 287 | $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; |
| 282 | 288 | foreach ($headers as $k => $v) { |
| 283 | - if (is_string($k)) $v = ucfirst($k) . ": $v"; |
|
| 289 | + if (is_string($k)) { |
|
| 290 | + $v = ucfirst($k) . ": $v"; |
|
| 291 | + } |
|
| 284 | 292 | $request .= "$v\r\n"; |
| 285 | 293 | } |
| 286 | 294 | |
@@ -322,7 +330,9 @@ discard block |
||
| 322 | 330 | $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false); |
| 323 | 331 | if ($gotStatus) { |
| 324 | 332 | $response .= $line; |
| 325 | - if (rtrim($line) === '') break; |
|
| 333 | + if (rtrim($line) === '') { |
|
| 334 | + break; |
|
| 335 | + } |
|
| 326 | 336 | } |
| 327 | 337 | } |
| 328 | 338 | |
@@ -331,7 +341,9 @@ discard block |
||
| 331 | 341 | $statusCode = Zend_Http_Response::extractCode($response); |
| 332 | 342 | |
| 333 | 343 | // Handle 100 and 101 responses internally by restarting the read again |
| 334 | - if ($statusCode == 100 || $statusCode == 101) return $this->read(); |
|
| 344 | + if ($statusCode == 100 || $statusCode == 101) { |
|
| 345 | + return $this->read(); |
|
| 346 | + } |
|
| 335 | 347 | |
| 336 | 348 | // Check headers to see what kind of connection / transfer encoding we have |
| 337 | 349 | $headers = Zend_Http_Response::extractHeaders($response); |
@@ -378,7 +390,9 @@ discard block |
||
| 378 | 390 | |
| 379 | 391 | do { |
| 380 | 392 | $current_pos = ftell($this->socket); |
| 381 | - if ($current_pos >= $read_to) break; |
|
| 393 | + if ($current_pos >= $read_to) { |
|
| 394 | + break; |
|
| 395 | + } |
|
| 382 | 396 | |
| 383 | 397 | if($this->out_stream) { |
| 384 | 398 | if(stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { |
@@ -448,7 +462,9 @@ discard block |
||
| 448 | 462 | } |
| 449 | 463 | |
| 450 | 464 | // Break if the connection ended prematurely |
| 451 | - if (feof($this->socket)) break; |
|
| 465 | + if (feof($this->socket)) { |
|
| 466 | + break; |
|
| 467 | + } |
|
| 452 | 468 | } |
| 453 | 469 | |
| 454 | 470 | // Fallback: just read the response until EOF |
@@ -460,7 +476,7 @@ discard block |
||
| 460 | 476 | $this->_checkSocketReadTimeout(); |
| 461 | 477 | break; |
| 462 | 478 | } |
| 463 | - } else { |
|
| 479 | + } else { |
|
| 464 | 480 | $buff = @fread($this->socket, 8192); |
| 465 | 481 | if ($buff === false || strlen($buff) === 0) { |
| 466 | 482 | $this->_checkSocketReadTimeout(); |
@@ -489,7 +505,9 @@ discard block |
||
| 489 | 505 | */ |
| 490 | 506 | public function close() |
| 491 | 507 | { |
| 492 | - if (is_resource($this->socket)) @fclose($this->socket); |
|
| 508 | + if (is_resource($this->socket)) { |
|
| 509 | + @fclose($this->socket); |
|
| 510 | + } |
|
| 493 | 511 | $this->socket = null; |
| 494 | 512 | $this->connected_to = array(null, null); |
| 495 | 513 | } |
@@ -537,7 +555,9 @@ discard block |
||
| 537 | 555 | public function __destruct() |
| 538 | 556 | { |
| 539 | 557 | if (! $this->config['persistent']) { |
| 540 | - if ($this->socket) $this->close(); |
|
| 558 | + if ($this->socket) { |
|
| 559 | + $this->close(); |
|
| 560 | + } |
|
| 541 | 561 | } |
| 542 | 562 | } |
| 543 | 563 | } |
@@ -352,7 +352,9 @@ discard block |
||
| 352 | 352 | public function getHeader($header) |
| 353 | 353 | { |
| 354 | 354 | $header = ucwords(strtolower($header)); |
| 355 | - if (! is_string($header) || ! isset($this->headers[$header])) return null; |
|
| 355 | + if (! is_string($header) || ! isset($this->headers[$header])) { |
|
| 356 | + return null; |
|
| 357 | + } |
|
| 356 | 358 | |
| 357 | 359 | return $this->headers[$header]; |
| 358 | 360 | } |
@@ -375,10 +377,9 @@ discard block |
||
| 375 | 377 | // Iterate over the headers and stringify them |
| 376 | 378 | foreach ($this->headers as $name => $value) |
| 377 | 379 | { |
| 378 | - if (is_string($value)) |
|
| 379 | - $str .= "{$name}: {$value}{$br}"; |
|
| 380 | - |
|
| 381 | - elseif (is_array($value)) { |
|
| 380 | + if (is_string($value)) { |
|
| 381 | + $str .= "{$name}: {$value}{$br}"; |
|
| 382 | + } elseif (is_array($value)) { |
|
| 382 | 383 | foreach ($value as $subval) { |
| 383 | 384 | $str .= "{$name}: {$subval}{$br}"; |
| 384 | 385 | } |
@@ -424,7 +425,9 @@ discard block |
||
| 424 | 425 | public static function responseCodeAsText($code = null, $http11 = true) |
| 425 | 426 | { |
| 426 | 427 | $messages = self::$messages; |
| 427 | - if (! $http11) $messages[302] = 'Moved Temporarily'; |
|
| 428 | + if (! $http11) { |
|
| 429 | + $messages[302] = 'Moved Temporarily'; |
|
| 430 | + } |
|
| 428 | 431 | |
| 429 | 432 | if ($code === null) { |
| 430 | 433 | return $messages; |
@@ -498,7 +501,9 @@ discard block |
||
| 498 | 501 | |
| 499 | 502 | // First, split body and headers |
| 500 | 503 | $parts = preg_split('|(?:\r?\n){2}|m', $response_str, 2); |
| 501 | - if (! $parts[0]) return $headers; |
|
| 504 | + if (! $parts[0]) { |
|
| 505 | + return $headers; |
|
| 506 | + } |
|
| 502 | 507 | |
| 503 | 508 | // Split headers part to lines |
| 504 | 509 | $lines = explode("\n", $parts[0]); |
@@ -507,7 +512,9 @@ discard block |
||
| 507 | 512 | |
| 508 | 513 | foreach($lines as $line) { |
| 509 | 514 | $line = trim($line, "\r\n"); |
| 510 | - if ($line == "") break; |
|
| 515 | + if ($line == "") { |
|
| 516 | + break; |
|
| 517 | + } |
|
| 511 | 518 | |
| 512 | 519 | // Locate headers like 'Location: ...' and 'Location:...' (note the missing space) |
| 513 | 520 | if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) { |
@@ -496,8 +496,9 @@ discard block |
||
| 496 | 496 | public function setParameterGet($name, $value = null) |
| 497 | 497 | { |
| 498 | 498 | if (is_array($name)) { |
| 499 | - foreach ($name as $k => $v) |
|
| 500 | - $this->_setParameter('GET', $k, $v); |
|
| 499 | + foreach ($name as $k => $v) { |
|
| 500 | + $this->_setParameter('GET', $k, $v); |
|
| 501 | + } |
|
| 501 | 502 | } else { |
| 502 | 503 | $this->_setParameter('GET', $name, $value); |
| 503 | 504 | } |
@@ -515,8 +516,9 @@ discard block |
||
| 515 | 516 | public function setParameterPost($name, $value = null) |
| 516 | 517 | { |
| 517 | 518 | if (is_array($name)) { |
| 518 | - foreach ($name as $k => $v) |
|
| 519 | - $this->_setParameter('POST', $k, $v); |
|
| 519 | + foreach ($name as $k => $v) { |
|
| 520 | + $this->_setParameter('POST', $k, $v); |
|
| 521 | + } |
|
| 520 | 522 | } else { |
| 521 | 523 | $this->_setParameter('POST', $name, $value); |
| 522 | 524 | } |
@@ -543,8 +545,9 @@ discard block |
||
| 543 | 545 | case 'post': |
| 544 | 546 | $parray = &$this->paramsPost; |
| 545 | 547 | if ( $value === null ) { |
| 546 | - if (isset($this->body_field_order[$name])) |
|
| 547 | - unset($this->body_field_order[$name]); |
|
| 548 | + if (isset($this->body_field_order[$name])) { |
|
| 549 | + unset($this->body_field_order[$name]); |
|
| 550 | + } |
|
| 548 | 551 | } else { |
| 549 | 552 | $this->body_field_order[$name] = self::VTYPE_SCALAR; |
| 550 | 553 | } |
@@ -552,7 +555,9 @@ discard block |
||
| 552 | 555 | } |
| 553 | 556 | |
| 554 | 557 | if ($value === null) { |
| 555 | - if (isset($parray[$name])) unset($parray[$name]); |
|
| 558 | + if (isset($parray[$name])) { |
|
| 559 | + unset($parray[$name]); |
|
| 560 | + } |
|
| 556 | 561 | } else { |
| 557 | 562 | $parray[$name] = $value; |
| 558 | 563 | } |
@@ -106,10 +106,11 @@ |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
| 109 | -if ( isset( $_GET['ajax'] ) ) |
|
| 109 | +if ( isset( $_GET['ajax'] ) ) { |
|
| 110 | 110 | echo $response; |
| 111 | -else |
|
| 111 | +} else { |
|
| 112 | 112 | header('location:../index.php?response='.$response); |
| 113 | +} |
|
| 113 | 114 | |
| 114 | 115 | |
| 115 | 116 | ?> |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | } |
| 182 | 182 | ?> |
| 183 | 183 | </div> |
| 184 | -<?php }else{ |
|
| 184 | +<?php } else{ |
|
| 185 | 185 | header("Location: index.php"); |
| 186 | 186 | } |
| 187 | 187 | ?> |
@@ -23,8 +23,9 @@ |
||
| 23 | 23 | $file = str_replace('\\', '/', $file); |
| 24 | 24 | |
| 25 | 25 | // Ignore "." and ".." folders |
| 26 | - if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) |
|
| 27 | - continue; |
|
| 26 | + if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) { |
|
| 27 | + continue; |
|
| 28 | + } |
|
| 28 | 29 | |
| 29 | 30 | $file = realpath($file); |
| 30 | 31 | |
@@ -85,11 +85,9 @@ |
||
| 85 | 85 | case 'value': |
| 86 | 86 | if ($attribute->nodeValue == "true") { |
| 87 | 87 | $this->_value = true; |
| 88 | - } |
|
| 89 | - else if ($attribute->nodeValue == "false") { |
|
| 88 | + } else if ($attribute->nodeValue == "false") { |
|
| 90 | 89 | $this->_value = false; |
| 91 | - } |
|
| 92 | - else { |
|
| 90 | + } else { |
|
| 93 | 91 | throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); |
| 94 | 92 | } |
| 95 | 93 | break; |
@@ -85,11 +85,9 @@ |
||
| 85 | 85 | case 'value': |
| 86 | 86 | if ($attribute->nodeValue == "true") { |
| 87 | 87 | $this->_value = true; |
| 88 | - } |
|
| 89 | - else if ($attribute->nodeValue == "false") { |
|
| 88 | + } else if ($attribute->nodeValue == "false") { |
|
| 90 | 89 | $this->_value = false; |
| 91 | - } |
|
| 92 | - else { |
|
| 90 | + } else { |
|
| 93 | 91 | require_once 'Zend/Gdata/App/InvalidArgumentException.php'; |
| 94 | 92 | throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); |
| 95 | 93 | } |