Completed
Pull Request — 1.11.x (#1293)
by José
387:57 queued 349:55
created
main/inc/lib/nusoap/class.wsdlcache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
45 45
 	* @access public
46 46
 	*/
47
-	function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
47
+	function nusoap_wsdlcache($cache_dir = '.', $cache_lifetime = 0) {
48 48
 		$this->fplock = array();
49 49
 		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
50 50
 		$this->cache_lifetime = $cache_lifetime;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	* @access private
59 59
 	*/
60 60
 	function createFilename($wsdl) {
61
-		return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
61
+		return $this->cache_dir.'/wsdlcache-'.md5($wsdl);
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	* @param    string $string debug data
68 68
 	* @access   private
69 69
 	*/
70
-	function debug($string){
70
+	function debug($string) {
71 71
 		$this->debug_str .= get_class($this).": $string\n";
72 72
 	}
73 73
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$s = serialize($wsdl_instance);
147 147
 		if ($this->obtainMutex($filename, "w")) {
148 148
 			$fp = fopen($filename, "w");
149
-			if (! $fp) {
149
+			if (!$fp) {
150 150
 				$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
151 151
 				$this->releaseMutex($filename);
152 152
 				return false;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
174 174
 		fclose($this->fplock[md5($filename)]);
175 175
 		unset($this->fplock[md5($filename)]);
176
-		if (! $ret) {
176
+		if (!$ret) {
177 177
 			$this->debug("Not able to release lock for $filename");
178 178
 		}
179 179
 		return $ret;
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_val.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	* @param	mixed $attributes associative array of attributes to add to element serialization
70 70
 	* @access   public
71 71
 	*/
72
-  	function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
72
+  	function soapval($name = 'soapval', $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false) {
73 73
 		parent::nusoap_base();
74 74
 		$this->name = $name;
75 75
 		$this->type = $type;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	* @return	string XML data
87 87
 	* @access   public
88 88
 	*/
89
-	function serialize($use='encoded') {
89
+	function serialize($use = 'encoded') {
90 90
 		return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true);
91 91
     }
92 92
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	* @return	mixed
97 97
 	* @access   public
98 98
 	*/
99
-	function decode(){
99
+	function decode() {
100 100
 		return $this->value;
101 101
 	}
102 102
 }
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_transport_http.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 	var $incoming_cookies = array();
30 30
 	var $outgoing_payload = '';
31 31
 	var $incoming_payload = '';
32
-	var $response_status_line;	// HTTP response status line
32
+	var $response_status_line; // HTTP response status line
33 33
 	var $useSOAPAction = true;
34 34
 	var $persistentConnection = false;
35
-	var $ch = false;	// cURL handle
36
-	var $ch_options = array();	// cURL custom options
37
-	var $use_curl = false;		// force cURL use
38
-	var $proxy = null;			// proxy information (associative array)
35
+	var $ch = false; // cURL handle
36
+	var $ch_options = array(); // cURL custom options
37
+	var $use_curl = false; // force cURL use
38
+	var $proxy = null; // proxy information (associative array)
39 39
 	var $username = '';
40 40
 	var $password = '';
41 41
 	var $authtype = '';
42 42
 	var $digestRequest = array();
43
-	var $certRequest = array();	// keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
43
+	var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional)
44 44
 								// cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem'
45 45
 								// sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem'
46 46
 								// sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem'
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	* @param boolean $use_curl Whether to try to force cURL use
58 58
 	* @access public
59 59
 	*/
60
-	function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
60
+	function soap_transport_http($url, $curl_options = NULL, $use_curl = false) {
61 61
 		parent::nusoap_base();
62 62
 		$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
63 63
 		$this->appendDebug($this->varDump($curl_options));
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$this->ch_options = $curl_options;
67 67
 		}
68 68
 		$this->use_curl = $use_curl;
69
-		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
69
+		preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev);
70 70
 		$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
71 71
 	}
72 72
 
@@ -118,19 +118,19 @@  discard block
 block discarded – undo
118 118
 		$this->url = $url;
119 119
 
120 120
 		$u = parse_url($url);
121
-		foreach($u as $k => $v){
121
+		foreach ($u as $k => $v) {
122 122
 			$this->debug("parsed URL $k = $v");
123 123
 			$this->$k = $v;
124 124
 		}
125 125
 		
126 126
 		// add any GET params to path
127
-		if(isset($u['query']) && $u['query'] != ''){
128
-            $this->path .= '?' . $u['query'];
127
+		if (isset($u['query']) && $u['query'] != '') {
128
+            $this->path .= '?'.$u['query'];
129 129
 		}
130 130
 		
131 131
 		// set default port
132
-		if(!isset($u['port'])){
133
-			if($u['scheme'] == 'https'){
132
+		if (!isset($u['port'])) {
133
+			if ($u['scheme'] == 'https') {
134 134
 				$this->port = 443;
135 135
 			} else {
136 136
 				$this->port = 80;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	* @return	boolean true if connected, false if not
175 175
 	* @access   private
176 176
 	*/
177
-	function connect($connection_timeout=0,$response_timeout=30){
177
+	function connect($connection_timeout = 0, $response_timeout = 30) {
178 178
 	  	// For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
179 179
 	  	// "regular" socket.
180 180
 	  	// TODO: disabled for now because OpenSSL must be *compiled* in (not just
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 		}
199 199
 
200 200
 		// use persistent connection
201
-		if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){
201
+		if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) {
202 202
 			if (!feof($this->fp)) {
203 203
 				$this->debug('Re-use persistent connection');
204 204
 				return true;
@@ -209,20 +209,20 @@  discard block
 block discarded – undo
209 209
 
210 210
 		// munge host if using OpenSSL
211 211
 		if ($this->scheme == 'ssl') {
212
-			$host = 'ssl://' . $host;
212
+			$host = 'ssl://'.$host;
213 213
 		}
214
-		$this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout);
214
+		$this->debug('calling fsockopen with host '.$host.' connection_timeout '.$connection_timeout);
215 215
 
216 216
 		// open socket
217
-		if($connection_timeout > 0){
218
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout);
217
+		if ($connection_timeout > 0) {
218
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout);
219 219
 		} else {
220
-			$this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str);
220
+			$this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str);
221 221
 		}
222 222
 		
223 223
 		// test pointer
224
-		if(!$this->fp) {
225
-			$msg = 'Couldn\'t open socket connection to server ' . $this->url;
224
+		if (!$this->fp) {
225
+			$msg = 'Couldn\'t open socket connection to server '.$this->url;
226 226
 			if ($this->errno) {
227 227
 				$msg .= ', Error ('.$this->errno.'): '.$this->error_str;
228 228
 			} else {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 		}
235 235
 		
236 236
 		// set response timeout
237
-		$this->debug('set response timeout to ' . $response_timeout);
238
-		socket_set_timeout( $this->fp, $response_timeout);
237
+		$this->debug('set response timeout to '.$response_timeout);
238
+		socket_set_timeout($this->fp, $response_timeout);
239 239
 
240 240
 		$this->debug('socket connected');
241 241
 		return true;
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 		$this->debug('cURL connection set up');
395 395
 		return true;
396 396
 	  } else {
397
-		$this->setError('Unknown scheme ' . $this->scheme);
398
-		$this->debug('Unknown scheme ' . $this->scheme);
397
+		$this->setError('Unknown scheme '.$this->scheme);
398
+		$this->debug('Unknown scheme '.$this->scheme);
399 399
 		return false;
400 400
 	  }
401 401
 	}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	* @return	string data
411 411
 	* @access   public
412 412
 	*/
413
-	function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
413
+	function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) {
414 414
 		
415 415
 		$this->debug('entered send() with data of length: '.strlen($data));
416 416
 
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 			$this->tryagain = false;
421 421
 			if ($tries++ < 2) {
422 422
 				// make connnection
423
-				if (!$this->connect($timeout, $response_timeout)){
423
+				if (!$this->connect($timeout, $response_timeout)) {
424 424
 					return false;
425 425
 				}
426 426
 				
427 427
 				// send request
428
-				if (!$this->sendRequest($data, $cookies)){
428
+				if (!$this->sendRequest($data, $cookies)) {
429 429
 					return false;
430 430
 				}
431 431
 				
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	* @access   public
452 452
 	* @deprecated
453 453
 	*/
454
-	function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) {
454
+	function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) {
455 455
 		return $this->send($data, $timeout, $response_timeout, $cookies);
456 456
 	}
457 457
 	
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		$this->appendDebug($this->varDump($certRequest));
473 473
 		// cf. RFC 2617
474 474
 		if ($authtype == 'basic') {
475
-			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password));
475
+			$this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':', '', $username).':'.$password));
476 476
 		} elseif ($authtype == 'digest') {
477 477
 			if (isset($digestRequest['nonce'])) {
478 478
 				$digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1;
@@ -480,16 +480,16 @@  discard block
 block discarded – undo
480 480
 				// calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html)
481 481
 	
482 482
 				// A1 = unq(username-value) ":" unq(realm-value) ":" passwd
483
-				$A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password;
483
+				$A1 = $username.':'.(isset($digestRequest['realm']) ? $digestRequest['realm'] : '').':'.$password;
484 484
 	
485 485
 				// H(A1) = MD5(A1)
486 486
 				$HA1 = md5($A1);
487 487
 	
488 488
 				// A2 = Method ":" digest-uri-value
489
-				$A2 = $this->request_method . ':' . $this->digest_uri;
489
+				$A2 = $this->request_method.':'.$this->digest_uri;
490 490
 	
491 491
 				// H(A2)
492
-				$HA2 =  md5($A2);
492
+				$HA2 = md5($A2);
493 493
 	
494 494
 				// KD(secret, data) = H(concat(secret, ":", data))
495 495
 				// if qop == auth:
@@ -506,19 +506,19 @@  discard block
 block discarded – undo
506 506
 				$nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : '';
507 507
 				$cnonce = $nonce;
508 508
 				if ($digestRequest['qop'] != '') {
509
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2;
509
+					$unhashedDigest = $HA1.':'.$nonce.':'.sprintf("%08d", $digestRequest['nc']).':'.$cnonce.':'.$digestRequest['qop'].':'.$HA2;
510 510
 				} else {
511
-					$unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2;
511
+					$unhashedDigest = $HA1.':'.$nonce.':'.$HA2;
512 512
 				}
513 513
 	
514 514
 				$hashedDigest = md5($unhashedDigest);
515 515
 	
516 516
 				$opaque = '';	
517 517
 				if (isset($digestRequest['opaque'])) {
518
-					$opaque = ', opaque="' . $digestRequest['opaque'] . '"';
518
+					$opaque = ', opaque="'.$digestRequest['opaque'].'"';
519 519
 				}
520 520
 
521
-				$this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"');
521
+				$this->setHeader('Authorization', 'Digest username="'.$username.'", realm="'.$digestRequest['realm'].'", nonce="'.$nonce.'", uri="'.$this->digest_uri.$opaque.'", cnonce="'.$cnonce.'", nc='.sprintf("%08x", $digestRequest['nc']).', qop="'.$digestRequest['qop'].'", response="'.$hashedDigest.'"');
522 522
 			}
523 523
 		} elseif ($authtype == 'certificate') {
524 524
 			$this->certRequest = $certRequest;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	* @access   public
541 541
 	*/
542 542
 	function setSOAPAction($soapaction) {
543
-		$this->setHeader('SOAPAction', '"' . $soapaction . '"');
543
+		$this->setHeader('SOAPAction', '"'.$soapaction.'"');
544 544
 	}
545 545
 	
546 546
 	/**
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	* @param    string $enc encoding style. supported values: gzip, deflate, or both
550 550
 	* @access   public
551 551
 	*/
552
-	function setEncoding($enc='gzip, deflate') {
552
+	function setEncoding($enc = 'gzip, deflate') {
553 553
 		if (function_exists('gzdeflate')) {
554 554
 			$this->protocol_version = '1.1';
555 555
 			$this->setHeader('Accept-Encoding', $enc);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	 * @access	private
603 603
 	 */
604 604
 	function isSkippableCurlHeader(&$data) {
605
-		$skipHeaders = array(	'HTTP/1.1 100',
605
+		$skipHeaders = array('HTTP/1.1 100',
606 606
 								'HTTP/1.0 301',
607 607
 								'HTTP/1.1 301',
608 608
 								'HTTP/1.0 302',
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	* @access   public
629 629
 	* @deprecated
630 630
 	*/
631
-	function decodeChunked($buffer, $lb){
631
+	function decodeChunked($buffer, $lb) {
632 632
 		// length := 0
633 633
 		$length = 0;
634 634
 		$new = '';
@@ -640,17 +640,17 @@  discard block
 block discarded – undo
640 640
 			$this->debug('no linebreak found in decodeChunked');
641 641
 			return $new;
642 642
 		}
643
-		$temp = substr($buffer,0,$chunkend);
644
-		$chunk_size = hexdec( trim($temp) );
643
+		$temp = substr($buffer, 0, $chunkend);
644
+		$chunk_size = hexdec(trim($temp));
645 645
 		$chunkstart = $chunkend + strlen($lb);
646 646
 		// while (chunk-size > 0) {
647 647
 		while ($chunk_size > 0) {
648 648
 			$this->debug("chunkstart: $chunkstart chunk_size: $chunk_size");
649
-			$chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size);
649
+			$chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size);
650 650
 		  	
651 651
 			// Just in case we got a broken connection
652 652
 		  	if ($chunkend == FALSE) {
653
-		  	    $chunk = substr($buffer,$chunkstart);
653
+		  	    $chunk = substr($buffer, $chunkstart);
654 654
 				// append chunk-data to entity-body
655 655
 		    	$new .= $chunk;
656 656
 		  	    $length += strlen($chunk);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			}
659 659
 			
660 660
 		  	// read chunk-data and CRLF
661
-		  	$chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
661
+		  	$chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart);
662 662
 		  	// append chunk-data to entity-body
663 663
 		  	$new .= $chunk;
664 664
 		  	// length := length + chunk-size
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 			if ($chunkend == FALSE) {
671 671
 				break; //Just in case we got a broken connection
672 672
 			}
673
-			$temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
674
-			$chunk_size = hexdec( trim($temp) );
673
+			$temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
674
+			$chunk_size = hexdec(trim($temp));
675 675
 			$chunkstart = $chunkend;
676 676
 		}
677 677
 		return $new;
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		$this->outgoing_payload = "$req\r\n";
707 707
 
708 708
 		// loop thru headers, serializing
709
-		foreach($this->outgoing_headers as $k => $v){
709
+		foreach ($this->outgoing_headers as $k => $v) {
710 710
 			$hdr = $k.': '.$v;
711 711
 			$this->debug("HTTP header: $hdr");
712 712
 			$this->outgoing_payload .= "$hdr\r\n";
@@ -743,12 +743,12 @@  discard block
 block discarded – undo
743 743
 
744 744
 	  if ($this->io_method() == 'socket') {
745 745
 		// send payload
746
-		if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
746
+		if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) {
747 747
 			$this->setError('couldn\'t write message data to socket');
748 748
 			$this->debug('couldn\'t write message data to socket');
749 749
 			return false;
750 750
 		}
751
-		$this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload));
751
+		$this->debug('wrote data to socket, length = '.strlen($this->outgoing_payload));
752 752
 		return true;
753 753
 	  } else if ($this->io_method() == 'curl') {
754 754
 		// set payload
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 		// some servers refuse to work with (so we no longer use this method!)
758 758
 		//$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload);
759 759
 		$curl_headers = array();
760
-		foreach($this->outgoing_headers as $k => $v){
760
+		foreach ($this->outgoing_headers as $k => $v) {
761 761
 			if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') {
762 762
 				$this->debug("Skip cURL header $k: $v");
763 763
 			} else {
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			}
766 766
 		}
767 767
 		if ($cookie_str != '') {
768
-			$curl_headers[] = 'Cookie: ' . $cookie_str;
768
+			$curl_headers[] = 'Cookie: '.$cookie_str;
769 769
 		}
770 770
 		$this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers);
771 771
 		$this->debug('set cURL HTTP headers');
@@ -791,62 +791,62 @@  discard block
 block discarded – undo
791 791
 	* @return	string the response (also sets member variables like incoming_payload)
792 792
 	* @access   private
793 793
 	*/
794
-	function getResponse(){
794
+	function getResponse() {
795 795
 		$this->incoming_payload = '';
796 796
 	    
797 797
 	  if ($this->io_method() == 'socket') {
798 798
 	    // loop until headers have been retrieved
799 799
 	    $data = '';
800
-	    while (!isset($lb)){
800
+	    while (!isset($lb)) {
801 801
 
802 802
 			// We might EOF during header read.
803
-			if(feof($this->fp)) {
803
+			if (feof($this->fp)) {
804 804
 				$this->incoming_payload = $data;
805
-				$this->debug('found no headers before EOF after length ' . strlen($data));
806
-				$this->debug("received before EOF:\n" . $data);
805
+				$this->debug('found no headers before EOF after length '.strlen($data));
806
+				$this->debug("received before EOF:\n".$data);
807 807
 				$this->setError('server failed to send headers');
808 808
 				return false;
809 809
 			}
810 810
 
811 811
 			$tmp = fgets($this->fp, 256);
812 812
 			$tmplen = strlen($tmp);
813
-			$this->debug("read line of $tmplen bytes: " . trim($tmp));
813
+			$this->debug("read line of $tmplen bytes: ".trim($tmp));
814 814
 
815 815
 			if ($tmplen == 0) {
816 816
 				$this->incoming_payload = $data;
817
-				$this->debug('socket read of headers timed out after length ' . strlen($data));
818
-				$this->debug("read before timeout: " . $data);
817
+				$this->debug('socket read of headers timed out after length '.strlen($data));
818
+				$this->debug("read before timeout: ".$data);
819 819
 				$this->setError('socket read of headers timed out');
820 820
 				return false;
821 821
 			}
822 822
 
823 823
 			$data .= $tmp;
824
-			$pos = strpos($data,"\r\n\r\n");
825
-			if($pos > 1){
824
+			$pos = strpos($data, "\r\n\r\n");
825
+			if ($pos > 1) {
826 826
 				$lb = "\r\n";
827 827
 			} else {
828
-				$pos = strpos($data,"\n\n");
829
-				if($pos > 1){
828
+				$pos = strpos($data, "\n\n");
829
+				if ($pos > 1) {
830 830
 					$lb = "\n";
831 831
 				}
832 832
 			}
833 833
 			// remove 100 headers
834
-			if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) {
834
+			if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) {
835 835
 				unset($lb);
836 836
 				$data = '';
837 837
 			}//
838 838
 		}
839 839
 		// store header data
840 840
 		$this->incoming_payload .= $data;
841
-		$this->debug('found end of headers after length ' . strlen($data));
841
+		$this->debug('found end of headers after length '.strlen($data));
842 842
 		// process headers
843
-		$header_data = trim(substr($data,0,$pos));
844
-		$header_array = explode($lb,$header_data);
843
+		$header_data = trim(substr($data, 0, $pos));
844
+		$header_array = explode($lb, $header_data);
845 845
 		$this->incoming_headers = array();
846 846
 		$this->incoming_cookies = array();
847
-		foreach($header_array as $header_line){
848
-			$arr = explode(':',$header_line, 2);
849
-			if(count($arr) > 1){
847
+		foreach ($header_array as $header_line) {
848
+			$arr = explode(':', $header_line, 2);
849
+			if (count($arr) > 1) {
850 850
 				$header_name = strtolower(trim($arr[0]));
851 851
 				$this->incoming_headers[$header_name] = trim($arr[1]);
852 852
 				if ($header_name == 'set-cookie') {
@@ -854,20 +854,20 @@  discard block
 block discarded – undo
854 854
 					$cookie = $this->parseCookie(trim($arr[1]));
855 855
 					if ($cookie) {
856 856
 						$this->incoming_cookies[] = $cookie;
857
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
857
+						$this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']);
858 858
 					} else {
859
-						$this->debug('did not find cookie in ' . trim($arr[1]));
859
+						$this->debug('did not find cookie in '.trim($arr[1]));
860 860
 					}
861 861
     			}
862 862
 			} else if (isset($header_name)) {
863 863
 				// append continuation line to previous header
864
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
864
+				$this->incoming_headers[$header_name] .= $lb.' '.$header_line;
865 865
 			}
866 866
 		}
867 867
 		
868 868
 		// loop until msg has been received
869 869
 		if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') {
870
-			$content_length =  2147483647;	// ignore any content-length header
870
+			$content_length = 2147483647; // ignore any content-length header
871 871
 			$chunked = true;
872 872
 			$this->debug("want to read chunked content");
873 873
 		} elseif (isset($this->incoming_headers['content-length'])) {
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 			$chunked = false;
876 876
 			$this->debug("want to read content of length $content_length");
877 877
 		} else {
878
-			$content_length =  2147483647;
878
+			$content_length = 2147483647;
879 879
 			$chunked = false;
880 880
 			$this->debug("want to read content to EOF");
881 881
 		}
@@ -887,8 +887,8 @@  discard block
 block discarded – undo
887 887
 				$this->debug("read chunk line of $tmplen bytes");
888 888
 				if ($tmplen == 0) {
889 889
 					$this->incoming_payload = $data;
890
-					$this->debug('socket read of chunk length timed out after length ' . strlen($data));
891
-					$this->debug("read before timeout:\n" . $data);
890
+					$this->debug('socket read of chunk length timed out after length '.strlen($data));
891
+					$this->debug("read before timeout:\n".$data);
892 892
 					$this->setError('socket read of chunk length timed out');
893 893
 					return false;
894 894
 				}
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
 				$this->debug("read buffer of $tmplen bytes");
904 904
 				if (($tmplen == 0) && (!feof($this->fp))) {
905 905
 					$this->incoming_payload = $data;
906
-					$this->debug('socket read of body timed out after length ' . strlen($data));
907
-					$this->debug("read before timeout:\n" . $data);
906
+					$this->debug('socket read of body timed out after length '.strlen($data));
907
+					$this->debug("read before timeout:\n".$data);
908 908
 					$this->setError('socket read of body timed out');
909 909
 					return false;
910 910
 				}
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
 				$this->debug("read chunk terminator of $tmplen bytes");
918 918
 				if ($tmplen == 0) {
919 919
 					$this->incoming_payload = $data;
920
-					$this->debug('socket read of chunk terminator timed out after length ' . strlen($data));
921
-					$this->debug("read before timeout:\n" . $data);
920
+					$this->debug('socket read of chunk terminator timed out after length '.strlen($data));
921
+					$this->debug("read before timeout:\n".$data);
922 922
 					$this->setError('socket read of chunk terminator timed out');
923 923
 					return false;
924 924
 				}
@@ -927,21 +927,21 @@  discard block
 block discarded – undo
927 927
 		if (feof($this->fp)) {
928 928
 			$this->debug('read to EOF');
929 929
 		}
930
-		$this->debug('read body of length ' . strlen($data));
930
+		$this->debug('read body of length '.strlen($data));
931 931
 		$this->incoming_payload .= $data;
932 932
 		$this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server');
933 933
 		
934 934
 		// close filepointer
935
-		if(
935
+		if (
936 936
 			(isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || 
937
-			(! $this->persistentConnection) || feof($this->fp)){
937
+			(!$this->persistentConnection) || feof($this->fp)) {
938 938
 			fclose($this->fp);
939 939
 			$this->fp = false;
940 940
 			$this->debug('closed socket');
941 941
 		}
942 942
 		
943 943
 		// connection was closed unexpectedly
944
-		if($this->incoming_payload == ''){
944
+		if ($this->incoming_payload == '') {
945 945
 			$this->setError('no response from server');
946 946
 			return false;
947 947
 		}
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 		if ($cErr != '') {
968 968
         	$err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>';
969 969
         	// TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE
970
-			foreach(curl_getinfo($this->ch) as $k => $v){
970
+			foreach (curl_getinfo($this->ch) as $k => $v) {
971 971
 				$err .= "$k: $v<br>";
972 972
 			}
973 973
 			$this->debug($err);
@@ -987,44 +987,44 @@  discard block
 block discarded – undo
987 987
 		$savedata = $data;
988 988
 		while ($this->isSkippableCurlHeader($data)) {
989 989
 			$this->debug("Found HTTP header to skip");
990
-			if ($pos = strpos($data,"\r\n\r\n")) {
991
-				$data = ltrim(substr($data,$pos));
992
-			} elseif($pos = strpos($data,"\n\n") ) {
993
-				$data = ltrim(substr($data,$pos));
990
+			if ($pos = strpos($data, "\r\n\r\n")) {
991
+				$data = ltrim(substr($data, $pos));
992
+			} elseif ($pos = strpos($data, "\n\n")) {
993
+				$data = ltrim(substr($data, $pos));
994 994
 			}
995 995
 		}
996 996
 
997 997
 		if ($data == '') {
998 998
 			// have nothing left; just remove 100 header(s)
999 999
 			$data = $savedata;
1000
-			while (preg_match('/^HTTP\/1.1 100/',$data)) {
1001
-				if ($pos = strpos($data,"\r\n\r\n")) {
1002
-					$data = ltrim(substr($data,$pos));
1003
-				} elseif($pos = strpos($data,"\n\n") ) {
1004
-					$data = ltrim(substr($data,$pos));
1000
+			while (preg_match('/^HTTP\/1.1 100/', $data)) {
1001
+				if ($pos = strpos($data, "\r\n\r\n")) {
1002
+					$data = ltrim(substr($data, $pos));
1003
+				} elseif ($pos = strpos($data, "\n\n")) {
1004
+					$data = ltrim(substr($data, $pos));
1005 1005
 				}
1006 1006
 			}
1007 1007
 		}
1008 1008
 		
1009 1009
 		// separate content from HTTP headers
1010
-		if ($pos = strpos($data,"\r\n\r\n")) {
1010
+		if ($pos = strpos($data, "\r\n\r\n")) {
1011 1011
 			$lb = "\r\n";
1012
-		} elseif( $pos = strpos($data,"\n\n")) {
1012
+		} elseif ($pos = strpos($data, "\n\n")) {
1013 1013
 			$lb = "\n";
1014 1014
 		} else {
1015 1015
 			$this->debug('no proper separation of headers and document');
1016 1016
 			$this->setError('no proper separation of headers and document');
1017 1017
 			return false;
1018 1018
 		}
1019
-		$header_data = trim(substr($data,0,$pos));
1020
-		$header_array = explode($lb,$header_data);
1021
-		$data = ltrim(substr($data,$pos));
1019
+		$header_data = trim(substr($data, 0, $pos));
1020
+		$header_array = explode($lb, $header_data);
1021
+		$data = ltrim(substr($data, $pos));
1022 1022
 		$this->debug('found proper separation of headers and document');
1023 1023
 		$this->debug('cleaned data, stringlen: '.strlen($data));
1024 1024
 		// clean headers
1025 1025
 		foreach ($header_array as $header_line) {
1026
-			$arr = explode(':',$header_line,2);
1027
-			if(count($arr) > 1){
1026
+			$arr = explode(':', $header_line, 2);
1027
+			if (count($arr) > 1) {
1028 1028
 				$header_name = strtolower(trim($arr[0]));
1029 1029
 				$this->incoming_headers[$header_name] = trim($arr[1]);
1030 1030
 				if ($header_name == 'set-cookie') {
@@ -1032,14 +1032,14 @@  discard block
 block discarded – undo
1032 1032
 					$cookie = $this->parseCookie(trim($arr[1]));
1033 1033
 					if ($cookie) {
1034 1034
 						$this->incoming_cookies[] = $cookie;
1035
-						$this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']);
1035
+						$this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']);
1036 1036
 					} else {
1037
-						$this->debug('did not find cookie in ' . trim($arr[1]));
1037
+						$this->debug('did not find cookie in '.trim($arr[1]));
1038 1038
 					}
1039 1039
     			}
1040 1040
 			} else if (isset($header_name)) {
1041 1041
 				// append continuation line to previous header
1042
-				$this->incoming_headers[$header_name] .= $lb . ' ' . $header_line;
1042
+				$this->incoming_headers[$header_name] .= $lb.' '.$header_line;
1043 1043
 			}
1044 1044
 		}
1045 1045
 	  }
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
  		// see if we need to resend the request with http digest authentication
1054 1054
  		if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) {
1055
- 			$this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']);
1055
+ 			$this->debug("Got $http_status $http_reason with Location: ".$this->incoming_headers['location']);
1056 1056
  			$this->setURL($this->incoming_headers['location']);
1057 1057
 			$this->tryagain = true;
1058 1058
 			return false;
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
  		// see if we need to resend the request with http digest authentication
1062 1062
  		if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) {
1063
- 			$this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']);
1063
+ 			$this->debug("Got 401 $http_reason with WWW-Authenticate: ".$this->incoming_headers['www-authenticate']);
1064 1064
  			if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) {
1065 1065
  				$this->debug('Server wants digest authentication');
1066 1066
  				// remove "Digest " from our elements
@@ -1095,10 +1095,10 @@  discard block
 block discarded – undo
1095 1095
 		}
1096 1096
 
1097 1097
 		// decode content-encoding
1098
-		if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){
1099
-			if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){
1098
+		if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') {
1099
+			if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') {
1100 1100
     			// if decoding works, use it. else assume data wasn't gzencoded
1101
-    			if(function_exists('gzinflate')){
1101
+    			if (function_exists('gzinflate')) {
1102 1102
 					//$timer->setMarker('starting decoding of gzip/deflated content');
1103 1103
 					// IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress)
1104 1104
 					// this means there are no Zlib headers, although there should be
@@ -1107,13 +1107,13 @@  discard block
 block discarded – undo
1107 1107
 					if ($this->incoming_headers['content-encoding'] == 'deflate') {
1108 1108
 						if ($degzdata = @gzinflate($data)) {
1109 1109
 	    					$data = $degzdata;
1110
-	    					$this->debug('The payload has been inflated to ' . strlen($data) . ' bytes');
1110
+	    					$this->debug('The payload has been inflated to '.strlen($data).' bytes');
1111 1111
 	    					if (strlen($data) < $datalen) {
1112 1112
 	    						// test for the case that the payload has been compressed twice
1113 1113
 		    					$this->debug('The inflated payload is smaller than the gzipped one; try again');
1114 1114
 								if ($degzdata = @gzinflate($data)) {
1115 1115
 			    					$data = $degzdata;
1116
-			    					$this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes');
1116
+			    					$this->debug('The payload has been inflated again to '.strlen($data).' bytes');
1117 1117
 								}
1118 1118
 	    					}
1119 1119
 	    				} else {
@@ -1123,13 +1123,13 @@  discard block
 block discarded – undo
1123 1123
 					} elseif ($this->incoming_headers['content-encoding'] == 'gzip') {
1124 1124
 						if ($degzdata = @gzinflate(substr($data, 10))) {	// do our best
1125 1125
 							$data = $degzdata;
1126
-	    					$this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes');
1126
+	    					$this->debug('The payload has been un-gzipped to '.strlen($data).' bytes');
1127 1127
 	    					if (strlen($data) < $datalen) {
1128 1128
 	    						// test for the case that the payload has been compressed twice
1129 1129
 		    					$this->debug('The un-gzipped payload is smaller than the gzipped one; try again');
1130 1130
 								if ($degzdata = @gzinflate(substr($data, 10))) {
1131 1131
 			    					$data = $degzdata;
1132
-			    					$this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes');
1132
+			    					$this->debug('The payload has been un-gzipped again to '.strlen($data).' bytes');
1133 1133
 								}
1134 1134
 	    					}
1135 1135
 	    				} else {
@@ -1146,14 +1146,14 @@  discard block
 block discarded – undo
1146 1146
 					$this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.');
1147 1147
 				}
1148 1148
 			} else {
1149
-				$this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
1150
-				$this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']);
1149
+				$this->debug('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']);
1150
+				$this->setError('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']);
1151 1151
 			}
1152 1152
 		} else {
1153 1153
 			$this->debug('No Content-Encoding header');
1154 1154
 		}
1155 1155
 		
1156
-		if(strlen($data) == 0){
1156
+		if (strlen($data) == 0) {
1157 1157
 			$this->debug('no data after headers!');
1158 1158
 			$this->setError('no data present after HTTP headers');
1159 1159
 			return false;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 	 * @access	public
1171 1171
 	 */
1172 1172
 	function setContentType($type, $charset = false) {
1173
-		$this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : ''));
1173
+		$this->setHeader('Content-Type', $type.($charset ? '; charset='.$charset : ''));
1174 1174
 	}
1175 1175
 
1176 1176
 	/**
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 	 * @return	boolean whether the request was honored by this method.
1180 1180
 	 * @access	public
1181 1181
 	 */
1182
-	function usePersistentConnection(){
1182
+	function usePersistentConnection() {
1183 1183
 		if (isset($this->outgoing_headers['Accept-Encoding'])) {
1184 1184
 			return false;
1185 1185
 		}
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 	 * TODO: allow a Set-Cookie string to be parsed into multiple cookies
1201 1201
 	 */
1202 1202
 	function parseCookie($cookie_str) {
1203
-		$cookie_str = str_replace('; ', ';', $cookie_str) . ';';
1203
+		$cookie_str = str_replace('; ', ';', $cookie_str).';';
1204 1204
 		$data = preg_split('/;/', $cookie_str);
1205 1205
 		$value_str = $data[0];
1206 1206
 
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
 		$cookie_param = 'path=';
1226 1226
 		$start = strpos($cookie_str, $cookie_param);
1227
-		if ( $start > 0 ) {
1227
+		if ($start > 0) {
1228 1228
 			$path = substr($cookie_str, $start + strlen($cookie_param));
1229 1229
 			$path = substr($path, 0, strpos($path, ';'));
1230 1230
 		} else {
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 		if ($sep_pos) {
1244 1244
 			$name = substr($value_str, 0, $sep_pos);
1245 1245
 			$value = substr($value_str, $sep_pos + 1);
1246
-			$cookie= array(	'name' => $name,
1246
+			$cookie = array('name' => $name,
1247 1247
 			                'value' => $value,
1248 1248
 							'domain' => $domain,
1249 1249
 							'path' => $path,
@@ -1263,40 +1263,40 @@  discard block
 block discarded – undo
1263 1263
 	 * @return	string for Cookie-HTTP-Header
1264 1264
 	 * @access	private
1265 1265
 	 */
1266
-	function getCookiesForRequest($cookies, $secure=false) {
1266
+	function getCookiesForRequest($cookies, $secure = false) {
1267 1267
 		$cookie_str = '';
1268
-		if ((! is_null($cookies)) && (is_array($cookies))) {
1268
+		if ((!is_null($cookies)) && (is_array($cookies))) {
1269 1269
 			foreach ($cookies as $cookie) {
1270
-				if (! is_array($cookie)) {
1270
+				if (!is_array($cookie)) {
1271 1271
 					continue;
1272 1272
 				}
1273 1273
 	    		$this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']);
1274
-				if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
1274
+				if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
1275 1275
 					if (strtotime($cookie['expires']) <= time()) {
1276 1276
 						$this->debug('cookie has expired');
1277 1277
 						continue;
1278 1278
 					}
1279 1279
 				}
1280
-				if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) {
1280
+				if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) {
1281 1281
 					$domain = preg_quote($cookie['domain']);
1282
-					if (! preg_match("'.*$domain$'i", $this->host)) {
1282
+					if (!preg_match("'.*$domain$'i", $this->host)) {
1283 1283
 						$this->debug('cookie has different domain');
1284 1284
 						continue;
1285 1285
 					}
1286 1286
 				}
1287
-				if ((isset($cookie['path'])) && (! empty($cookie['path']))) {
1287
+				if ((isset($cookie['path'])) && (!empty($cookie['path']))) {
1288 1288
 					$path = preg_quote($cookie['path']);
1289
-					if (! preg_match("'^$path.*'i", $this->path)) {
1289
+					if (!preg_match("'^$path.*'i", $this->path)) {
1290 1290
 						$this->debug('cookie is for a different path');
1291 1291
 						continue;
1292 1292
 					}
1293 1293
 				}
1294
-				if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1294
+				if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) {
1295 1295
 					$this->debug('cookie is secure, transport is not');
1296 1296
 					continue;
1297 1297
 				}
1298
-				$cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; ';
1299
-	    		$this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']);
1298
+				$cookie_str .= $cookie['name'].'='.$cookie['value'].'; ';
1299
+	    		$this->debug('add cookie to Cookie-String: '.$cookie['name'].'='.$cookie['value']);
1300 1300
 			}
1301 1301
 		}
1302 1302
 		return $cookie_str;
Please login to merge, or discard this patch.
main/inc/lib/nusoap/nusoapmime.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	* @access public
87 87
 	*/
88 88
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
89
-		if (! $cid) {
89
+		if (!$cid) {
90 90
 			$cid = md5(uniqid(time()));
91 91
 		}
92 92
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	* @access   private
222 222
 	*/
223 223
     function parseResponse($headers, $data) {
224
-		$this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
224
+		$this->debug('Entering parseResponse() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
225 225
 		$this->responseAttachments = array();
226 226
 		if (strstr($headers['content-type'], 'multipart/related')) {
227 227
 			$this->debug('Decode multipart/related');
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			foreach ($headers as $k => $v) {
230 230
 				$input .= "$k: $v\r\n";
231 231
 			}
232
-			$params['input'] = $input . "\r\n" . $data;
232
+			$params['input'] = $input."\r\n".$data;
233 233
 			$params['include_bodies'] = true;
234 234
 			$params['decode_bodies'] = true;
235 235
 			$params['decode_headers'] = true;
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 
239 239
 			foreach ($structure->parts as $part) {
240 240
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
241
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
241
+					$this->debug('Have root part of type '.$part->headers['content-type']);
242 242
 					$root = $part->body;
243 243
 					$return = parent::parseResponse($part->headers, $part->body);
244 244
 				} else {
245
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
245
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
246 246
 					$info['data'] = $part->body;
247 247
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
248 248
 					$info['contenttype'] = $part->headers['content-type'];
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	* @access public
317 317
 	*/
318 318
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
319
-		if (! $cid) {
319
+		if (!$cid) {
320 320
 			$cid = md5(uniqid(time()));
321 321
 		}
322 322
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	* @access   private
452 452
 	*/
453 453
     function parseRequest($headers, $data) {
454
-		$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
454
+		$this->debug('Entering parseRequest() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
455 455
 		$this->requestAttachments = array();
456 456
 		if (strstr($headers['content-type'], 'multipart/related')) {
457 457
 			$this->debug('Decode multipart/related');
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			foreach ($headers as $k => $v) {
460 460
 				$input .= "$k: $v\r\n";
461 461
 			}
462
-			$params['input'] = $input . "\r\n" . $data;
462
+			$params['input'] = $input."\r\n".$data;
463 463
 			$params['include_bodies'] = true;
464 464
 			$params['decode_bodies'] = true;
465 465
 			$params['decode_headers'] = true;
@@ -468,10 +468,10 @@  discard block
 block discarded – undo
468 468
 
469 469
 			foreach ($structure->parts as $part) {
470 470
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
471
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
471
+					$this->debug('Have root part of type '.$part->headers['content-type']);
472 472
 					$return = parent::parseRequest($part->headers, $part->body);
473 473
 				} else {
474
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
474
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
475 475
 					$info['data'] = $part->body;
476 476
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
477 477
 					$info['contenttype'] = $part->headers['content-type'];
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.wsdl.php 1 patch
Spacing   +205 added lines, -207 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	var $proxypassword = '';
48 48
 	var $timeout = 0;
49 49
 	var $response_timeout = 30;
50
-	var $curl_options = array();	// User-specified cURL options
51
-	var $use_curl = false;			// whether to always try to use cURL
50
+	var $curl_options = array(); // User-specified cURL options
51
+	var $use_curl = false; // whether to always try to use cURL
52 52
 	// for HTTP authentication
53
-	var $username = '';				// Username for HTTP authentication
54
-	var $password = '';				// Password for HTTP authentication
55
-	var $authtype = '';				// Type of HTTP authentication
56
-	var $certRequest = array();		// Certificate for HTTP SSL authentication
53
+	var $username = ''; // Username for HTTP authentication
54
+	var $password = ''; // Password for HTTP authentication
55
+	var $authtype = ''; // Type of HTTP authentication
56
+	var $certRequest = array(); // Certificate for HTTP SSL authentication
57 57
 
58 58
     /**
59 59
      * constructor
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param boolean $use_curl try to use cURL
70 70
      * @access public
71 71
      */
72
-    function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
72
+    function wsdl($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false) {
73 73
 		parent::nusoap_base();
74 74
 		$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
75 75
         $this->proxyhost = $proxyhost;
@@ -105,19 +105,19 @@  discard block
 block discarded – undo
105 105
     		// Schema imports
106 106
     		foreach ($this->schemas as $ns => $list) {
107 107
     			foreach ($list as $xs) {
108
-					$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
108
+					$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
109 109
 		            foreach ($xs->imports as $ns2 => $list2) {
110 110
 		                for ($ii = 0; $ii < count($list2); $ii++) {
111
-		                	if (! $list2[$ii]['loaded']) {
111
+		                	if (!$list2[$ii]['loaded']) {
112 112
 		                		$this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
113 113
 		                		$url = $list2[$ii]['location'];
114 114
 								if ($url != '') {
115 115
 									$urlparts = parse_url($url);
116 116
 									if (!isset($urlparts['host'])) {
117
-										$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') .
118
-												substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
117
+										$url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : '').
118
+												substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path'];
119 119
 									}
120
-									if (! in_array($url, $imported_urls)) {
120
+									if (!in_array($url, $imported_urls)) {
121 121
 					                	$this->parseWSDL($url);
122 122
 				                		$imported++;
123 123
 				                		$imported_urls[] = $url;
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
     			}
132 132
     		}
133 133
     		// WSDL imports
134
-			$wsdlparts = parse_url($this->wsdl);	// this is bogusly simple!
134
+			$wsdlparts = parse_url($this->wsdl); // this is bogusly simple!
135 135
             foreach ($this->import as $ns => $list) {
136 136
                 for ($ii = 0; $ii < count($list); $ii++) {
137
-                	if (! $list[$ii]['loaded']) {
137
+                	if (!$list[$ii]['loaded']) {
138 138
                 		$this->import[$ns][$ii]['loaded'] = true;
139 139
                 		$url = $list[$ii]['location'];
140 140
 						if ($url != '') {
141 141
 							$urlparts = parse_url($url);
142 142
 							if (!isset($urlparts['host'])) {
143
-								$url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') .
144
-										substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path'];
143
+								$url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : '').
144
+										substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path'];
145 145
 							}
146
-							if (! in_array($url, $imported_urls)) {
146
+							if (!in_array($url, $imported_urls)) {
147 147
 			                	$this->parseWSDL($url);
148 148
 		                		$imported++;
149 149
 		                		$imported_urls[] = $url;
@@ -156,30 +156,28 @@  discard block
 block discarded – undo
156 156
             }
157 157
 		}
158 158
         // add new data to operation data
159
-        foreach($this->bindings as $binding => $bindingData) {
159
+        foreach ($this->bindings as $binding => $bindingData) {
160 160
             if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
161
-                foreach($bindingData['operations'] as $operation => $data) {
162
-                    $this->debug('post-parse data gathering for ' . $operation);
161
+                foreach ($bindingData['operations'] as $operation => $data) {
162
+                    $this->debug('post-parse data gathering for '.$operation);
163 163
                     $this->bindings[$binding]['operations'][$operation]['input'] =
164 164
 						isset($this->bindings[$binding]['operations'][$operation]['input']) ?
165
-						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) :
166
-						$this->portTypes[ $bindingData['portType'] ][$operation]['input'];
165
+						array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input'];
167 166
                     $this->bindings[$binding]['operations'][$operation]['output'] =
168 167
 						isset($this->bindings[$binding]['operations'][$operation]['output']) ?
169
-						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) :
170
-						$this->portTypes[ $bindingData['portType'] ][$operation]['output'];
171
-                    if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){
172
-						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ];
168
+						array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output'];
169
+                    if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) {
170
+						$this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']];
173 171
 					}
174
-					if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){
175
-                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ];
172
+					if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) {
173
+                   		$this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']];
176 174
                     }
177 175
                     // Set operation style if necessary, but do not override one already provided
178 176
 					if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) {
179 177
                         $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
180 178
                     }
181 179
                     $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
182
-                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : '';
180
+                    $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : '';
183 181
                     $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
184 182
                 }
185 183
             }
@@ -205,13 +203,13 @@  discard block
 block discarded – undo
205 203
         $wsdl_props = parse_url($wsdl);
206 204
 
207 205
         if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) {
208
-            $this->debug('getting WSDL http(s) URL ' . $wsdl);
206
+            $this->debug('getting WSDL http(s) URL '.$wsdl);
209 207
         	// get wsdl
210 208
 	        $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl);
211 209
 			$tr->request_method = 'GET';
212 210
 			$tr->useSOAPAction = false;
213
-			if($this->proxyhost && $this->proxyport){
214
-				$tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
211
+			if ($this->proxyhost && $this->proxyport) {
212
+				$tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
215 213
 			}
216 214
 			if ($this->authtype != '') {
217 215
 				$tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
@@ -222,8 +220,8 @@  discard block
 block discarded – undo
222 220
 			//$this->debug("WSDL response\n" . $tr->incoming_payload);
223 221
 			$this->appendDebug($tr->getDebug());
224 222
 			// catch errors
225
-			if($err = $tr->getError() ){
226
-				$errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err;
223
+			if ($err = $tr->getError()) {
224
+				$errstr = 'Getting '.$wsdl.' - HTTP ERROR: '.$err;
227 225
 				$this->debug($errstr);
228 226
 	            $this->setError($errstr);
229 227
 				unset($tr);
@@ -234,11 +232,11 @@  discard block
 block discarded – undo
234 232
         } else {
235 233
             // $wsdl is not http(s), so treat it as a file URL or plain file path
236 234
         	if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) {
237
-        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path'];
235
+        		$path = isset($wsdl_props['host']) ? ($wsdl_props['host'].':'.$wsdl_props['path']) : $wsdl_props['path'];
238 236
         	} else {
239 237
         		$path = $wsdl;
240 238
         	}
241
-            $this->debug('getting WSDL file ' . $path);
239
+            $this->debug('getting WSDL file '.$path);
242 240
             if ($fp = @fopen($path, 'r')) {
243 241
                 $wsdl_string = '';
244 242
                 while ($data = fread($fp, 32768)) {
@@ -274,7 +272,7 @@  discard block
 block discarded – undo
274 272
                 xml_error_string(xml_get_error_code($this->parser))
275 273
                 );
276 274
             $this->debug($errstr);
277
-			$this->debug("XML payload:\n" . $wsdl_string);
275
+			$this->debug("XML payload:\n".$wsdl_string);
278 276
             $this->setError($errstr);
279 277
             return false;
280 278
         }
@@ -282,7 +280,7 @@  discard block
 block discarded – undo
282 280
         xml_parser_free($this->parser);
283 281
         $this->debug('Parsing WSDL done');
284 282
 		// catch wsdl parse errors
285
-		if($this->getError()){
283
+		if ($this->getError()) {
286 284
 			return false;
287 285
 		}
288 286
         return true;
@@ -320,21 +318,21 @@  discard block
 block discarded – undo
320 318
             // process attributes
321 319
             if (count($attrs) > 0) {
322 320
 				// register namespace declarations
323
-                foreach($attrs as $k => $v) {
324
-                    if (preg_match('/^xmlns/',$k)) {
321
+                foreach ($attrs as $k => $v) {
322
+                    if (preg_match('/^xmlns/', $k)) {
325 323
                         if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
326 324
                             $this->namespaces[$ns_prefix] = $v;
327 325
                         } else {
328
-                            $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v;
326
+                            $this->namespaces['ns'.(count($this->namespaces) + 1)] = $v;
329 327
                         }
330 328
                         if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
331 329
                             $this->XMLSchemaVersion = $v;
332
-                            $this->namespaces['xsi'] = $v . '-instance';
330
+                            $this->namespaces['xsi'] = $v.'-instance';
333 331
                         }
334 332
                     }
335 333
                 }
336 334
                 // expand each attribute prefix to its namespace
337
-                foreach($attrs as $k => $v) {
335
+                foreach ($attrs as $k => $v) {
338 336
                     $k = strpos($k, ':') ? $this->expandQname($k) : $k;
339 337
                     if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') {
340 338
                         $v = strpos($v, ':') ? $this->expandQname($v) : $v;
@@ -360,12 +358,12 @@  discard block
 block discarded – undo
360 358
                 case 'message':
361 359
                     if ($name == 'part') {
362 360
 			            if (isset($attrs['type'])) {
363
-		                    $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs));
361
+		                    $this->debug("msg ".$this->currentMessage.": found part (with type) $attrs[name]: ".implode(',', $attrs));
364 362
 		                    $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type'];
365 363
             			}
366 364
 			            if (isset($attrs['element'])) {
367
-		                    $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs));
368
-			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^';
365
+		                    $this->debug("msg ".$this->currentMessage.": found part (with element) $attrs[name]: ".implode(',', $attrs));
366
+			                $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'].'^';
369 367
 			            }
370 368
         			}
371 369
         			break;
@@ -434,15 +432,15 @@  discard block
 block discarded – undo
434 432
 					switch ($name) {
435 433
 					    case 'port':
436 434
 					        $this->currentPort = $attrs['name'];
437
-					        $this->debug('current port: ' . $this->currentPort);
435
+					        $this->debug('current port: '.$this->currentPort);
438 436
 					        $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']);
439 437
 
440 438
 					        break;
441 439
 					    case 'address':
442 440
 					        $this->ports[$this->currentPort]['location'] = $attrs['location'];
443 441
 					        $this->ports[$this->currentPort]['bindingType'] = $namespace;
444
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace;
445
-					        $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location'];
442
+					        $this->bindings[$this->ports[$this->currentPort]['binding']]['bindingType'] = $namespace;
443
+					        $this->bindings[$this->ports[$this->currentPort]['binding']]['endpoint'] = $attrs['location'];
446 444
 					        break;
447 445
 					}
448 446
 					break;
@@ -452,13 +450,13 @@  discard block
 block discarded – undo
452 450
 			case 'import':
453 451
 			    if (isset($attrs['location'])) {
454 452
                     $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false);
455
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')');
453
+                    $this->debug('parsing import '.$attrs['namespace'].' - '.$attrs['location'].' ('.count($this->import[$attrs['namespace']]).')');
456 454
 				} else {
457 455
                     $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
458
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
459
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
456
+					if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
457
+						$this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace'];
460 458
 					}
461
-                    $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')');
459
+                    $this->debug('parsing import '.$attrs['namespace'].' - [no location] ('.count($this->import[$attrs['namespace']]).')');
462 460
 				}
463 461
 				break;
464 462
 			//wait for schema
@@ -485,13 +483,13 @@  discard block
 block discarded – undo
485 483
 					}
486 484
 					$this->status = 'binding';
487 485
 					$this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']);
488
-					$this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']);
486
+					$this->debug("current binding: $this->currentBinding of portType: ".$attrs['type']);
489 487
 				}
490 488
 				break;
491 489
 			case 'service':
492 490
 				$this->serviceName = $attrs['name'];
493 491
 				$this->status = 'service';
494
-				$this->debug('current service: ' . $this->serviceName);
492
+				$this->debug('current service: '.$this->serviceName);
495 493
 				break;
496 494
 			case 'definitions':
497 495
 				foreach ($attrs as $name => $value) {
@@ -509,7 +507,7 @@  discard block
 block discarded – undo
509 507
 	* @param string $name element name
510 508
 	* @access private
511 509
 	*/
512
-	function end_element($parser, $name){
510
+	function end_element($parser, $name) {
513 511
 		// unset schema status
514 512
 		if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) {
515 513
 			$this->status = "";
@@ -594,8 +592,8 @@  discard block
 block discarded – undo
594 592
 		}
595 593
 		$this->debug("getOperations for port '$portName' bindingType $bindingType");
596 594
 		// loop thru ports
597
-		foreach($this->ports as $port => $portData) {
598
-			$this->debug("getOperations checking port $port bindingType " . $portData['bindingType']);
595
+		foreach ($this->ports as $port => $portData) {
596
+			$this->debug("getOperations checking port $port bindingType ".$portData['bindingType']);
599 597
 			if ($portName == '' || $port == $portName) {
600 598
 				// binding type of port matches parameter
601 599
 				if ($portData['bindingType'] == $bindingType) {
@@ -603,8 +601,8 @@  discard block
 block discarded – undo
603 601
 					//$this->debug("port data: " . $this->varDump($portData));
604 602
 					//$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ]));
605 603
 					// merge bindings
606
-					if (isset($this->bindings[ $portData['binding'] ]['operations'])) {
607
-						$ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']);
604
+					if (isset($this->bindings[$portData['binding']]['operations'])) {
605
+						$ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']);
608 606
 					}
609 607
 				}
610 608
 			}
@@ -631,15 +629,15 @@  discard block
 block discarded – undo
631 629
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
632 630
 		}
633 631
 		// loop thru ports
634
-		foreach($this->ports as $port => $portData) {
632
+		foreach ($this->ports as $port => $portData) {
635 633
 			// binding type of port matches parameter
636 634
 			if ($portData['bindingType'] == $bindingType) {
637 635
 				// get binding
638 636
 				//foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
639
-				foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) {
637
+				foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) {
640 638
 					// note that we could/should also check the namespace here
641 639
 					if ($operation == $bOperation) {
642
-						$opData = $this->bindings[ $portData['binding'] ]['operations'][$operation];
640
+						$opData = $this->bindings[$portData['binding']]['operations'][$operation];
643 641
 					    return $opData;
644 642
 					}
645 643
 				}
@@ -662,11 +660,11 @@  discard block
 block discarded – undo
662 660
 			$bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/';
663 661
 		}
664 662
 		// loop thru ports
665
-		foreach($this->ports as $port => $portData) {
663
+		foreach ($this->ports as $port => $portData) {
666 664
 			// binding type of port matches parameter
667 665
 			if ($portData['bindingType'] == $bindingType) {
668 666
 				// loop through operations for the binding
669
-				foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) {
667
+				foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) {
670 668
 					if ($opData['soapAction'] == $soapAction) {
671 669
 					    return $opData;
672 670
 					}
@@ -695,7 +693,7 @@  discard block
 block discarded – undo
695 693
     */
696 694
 	function getTypeDef($type, $ns) {
697 695
 		$this->debug("in getTypeDef: type=$type, ns=$ns");
698
-		if ((! $ns) && isset($this->namespaces['tns'])) {
696
+		if ((!$ns) && isset($this->namespaces['tns'])) {
699 697
 			$ns = $this->namespaces['tns'];
700 698
 			$this->debug("in getTypeDef: type namespace forced to $ns");
701 699
 		}
@@ -753,7 +751,7 @@  discard block
 block discarded – undo
753 751
     *
754 752
     * @access private
755 753
     */
756
-    function webDescription(){
754
+    function webDescription() {
757 755
     	global $HTTP_SERVER_VARS;
758 756
 
759 757
 		if (isset($_SERVER)) {
@@ -847,19 +845,19 @@  discard block
 block discarded – undo
847 845
 				<p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service.
848 846
 				Click on an operation name to view it&apos;s details.</p>
849 847
 				<ul>';
850
-				foreach($this->getOperations() as $op => $data){
848
+				foreach ($this->getOperations() as $op => $data) {
851 849
 				    $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>";
852 850
 				    // create hidden div
853 851
 				    $b .= "<div id='$op' class='hidden'>
854 852
 				    <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>";
855
-				    foreach($data as $donnie => $marie){ // loop through opdata
856
-						if($donnie == 'input' || $donnie == 'output'){ // show input/output data
853
+				    foreach ($data as $donnie => $marie) { // loop through opdata
854
+						if ($donnie == 'input' || $donnie == 'output') { // show input/output data
857 855
 						    $b .= "<font color='white'>".ucfirst($donnie).':</font><br>';
858
-						    foreach($marie as $captain => $tenille){ // loop through data
859
-								if($captain == 'parts'){ // loop thru parts
856
+						    foreach ($marie as $captain => $tenille) { // loop through data
857
+								if ($captain == 'parts') { // loop thru parts
860 858
 								    $b .= "&nbsp;&nbsp;$captain:<br>";
861 859
 					                //if(is_array($tenille)){
862
-								    	foreach($tenille as $joanie => $chachi){
860
+								    	foreach ($tenille as $joanie => $chachi) {
863 861
 											$b .= "&nbsp;&nbsp;&nbsp;&nbsp;$joanie: $chachi<br>";
864 862
 								    	}
865 863
 					        		//}
@@ -891,31 +889,31 @@  discard block
 block discarded – undo
891 889
 	{
892 890
 		$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
893 891
 		$xml .= "\n<definitions";
894
-		foreach($this->namespaces as $k => $v) {
892
+		foreach ($this->namespaces as $k => $v) {
895 893
 			$xml .= " xmlns:$k=\"$v\"";
896 894
 		}
897 895
 		// 10.9.02 - add poulter fix for wsdl and tns declarations
898 896
 		if (isset($this->namespaces['wsdl'])) {
899
-			$xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\"";
897
+			$xml .= " xmlns=\"".$this->namespaces['wsdl']."\"";
900 898
 		}
901 899
 		if (isset($this->namespaces['tns'])) {
902
-			$xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\"";
900
+			$xml .= " targetNamespace=\"".$this->namespaces['tns']."\"";
903 901
 		}
904 902
 		$xml .= '>';
905 903
 		// imports
906 904
 		if (sizeof($this->import) > 0) {
907
-			foreach($this->import as $ns => $list) {
905
+			foreach ($this->import as $ns => $list) {
908 906
 				foreach ($list as $ii) {
909 907
 					if ($ii['location'] != '') {
910
-						$xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />';
908
+						$xml .= '<import location="'.$ii['location'].'" namespace="'.$ns.'" />';
911 909
 					} else {
912
-						$xml .= '<import namespace="' . $ns . '" />';
910
+						$xml .= '<import namespace="'.$ns.'" />';
913 911
 					}
914 912
 				}
915 913
 			}
916 914
 		}
917 915
 		// types
918
-		if (count($this->schemas)>=1) {
916
+		if (count($this->schemas) >= 1) {
919 917
 			$xml .= "\n<types>\n";
920 918
 			foreach ($this->schemas as $ns => $list) {
921 919
 				foreach ($list as $xs) {
@@ -926,10 +924,10 @@  discard block
 block discarded – undo
926 924
 		}
927 925
 		// messages
928 926
 		if (count($this->messages) >= 1) {
929
-			foreach($this->messages as $msgName => $msgParts) {
930
-				$xml .= "\n<message name=\"" . $msgName . '">';
931
-				if(is_array($msgParts)){
932
-					foreach($msgParts as $partName => $partType) {
927
+			foreach ($this->messages as $msgName => $msgParts) {
928
+				$xml .= "\n<message name=\"".$msgName.'">';
929
+				if (is_array($msgParts)) {
930
+					foreach ($msgParts as $partName => $partType) {
933 931
 						// print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>';
934 932
 						if (strpos($partType, ':')) {
935 933
 						    $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType));
@@ -937,7 +935,7 @@  discard block
 block discarded – undo
937 935
 						    // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>';
938 936
 						    $typePrefix = 'xsd';
939 937
 						} else {
940
-						    foreach($this->typemap as $ns => $types) {
938
+						    foreach ($this->typemap as $ns => $types) {
941 939
 						        if (isset($types[$partType])) {
942 940
 						            $typePrefix = $this->getPrefixFromNamespace($ns);
943 941
 						        }
@@ -957,7 +955,7 @@  discard block
 block discarded – undo
957 955
 						} else {
958 956
 							$elementortype = 'type';
959 957
 						}
960
-						$xml .= "\n" . '  <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />';
958
+						$xml .= "\n".'  <part name="'.$partName.'" '.$elementortype.'="'.$typePrefix.':'.$localPart.'" />';
961 959
 					}
962 960
 				}
963 961
 				$xml .= '</message>';
@@ -967,54 +965,54 @@  discard block
 block discarded – undo
967 965
 		if (count($this->bindings) >= 1) {
968 966
 			$binding_xml = '';
969 967
 			$portType_xml = '';
970
-			foreach($this->bindings as $bindingName => $attrs) {
971
-				$binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">';
972
-				$binding_xml .= "\n" . '  <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>';
973
-				$portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">';
974
-				foreach($attrs['operations'] as $opName => $opParts) {
975
-					$binding_xml .= "\n" . '  <operation name="' . $opName . '">';
976
-					$binding_xml .= "\n" . '    <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>';
968
+			foreach ($this->bindings as $bindingName => $attrs) {
969
+				$binding_xml .= "\n<binding name=\"".$bindingName.'" type="tns:'.$attrs['portType'].'">';
970
+				$binding_xml .= "\n".'  <soap:binding style="'.$attrs['style'].'" transport="'.$attrs['transport'].'"/>';
971
+				$portType_xml .= "\n<portType name=\"".$attrs['portType'].'">';
972
+				foreach ($attrs['operations'] as $opName => $opParts) {
973
+					$binding_xml .= "\n".'  <operation name="'.$opName.'">';
974
+					$binding_xml .= "\n".'    <soap:operation soapAction="'.$opParts['soapAction'].'" style="'.$opParts['style'].'"/>';
977 975
 					if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') {
978
-						$enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"';
976
+						$enc_style = ' encodingStyle="'.$opParts['input']['encodingStyle'].'"';
979 977
 					} else {
980 978
 						$enc_style = '';
981 979
 					}
982
-					$binding_xml .= "\n" . '    <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>';
980
+					$binding_xml .= "\n".'    <input><soap:body use="'.$opParts['input']['use'].'" namespace="'.$opParts['input']['namespace'].'"'.$enc_style.'/></input>';
983 981
 					if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') {
984
-						$enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"';
982
+						$enc_style = ' encodingStyle="'.$opParts['output']['encodingStyle'].'"';
985 983
 					} else {
986 984
 						$enc_style = '';
987 985
 					}
988
-					$binding_xml .= "\n" . '    <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>';
989
-					$binding_xml .= "\n" . '  </operation>';
990
-					$portType_xml .= "\n" . '  <operation name="' . $opParts['name'] . '"';
986
+					$binding_xml .= "\n".'    <output><soap:body use="'.$opParts['output']['use'].'" namespace="'.$opParts['output']['namespace'].'"'.$enc_style.'/></output>';
987
+					$binding_xml .= "\n".'  </operation>';
988
+					$portType_xml .= "\n".'  <operation name="'.$opParts['name'].'"';
991 989
 					if (isset($opParts['parameterOrder'])) {
992
-					    $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"';
990
+					    $portType_xml .= ' parameterOrder="'.$opParts['parameterOrder'].'"';
993 991
 					}
994 992
 					$portType_xml .= '>';
995
-					if(isset($opParts['documentation']) && $opParts['documentation'] != '') {
996
-						$portType_xml .= "\n" . '    <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>';
993
+					if (isset($opParts['documentation']) && $opParts['documentation'] != '') {
994
+						$portType_xml .= "\n".'    <documentation>'.htmlspecialchars($opParts['documentation']).'</documentation>';
997 995
 					}
998
-					$portType_xml .= "\n" . '    <input message="tns:' . $opParts['input']['message'] . '"/>';
999
-					$portType_xml .= "\n" . '    <output message="tns:' . $opParts['output']['message'] . '"/>';
1000
-					$portType_xml .= "\n" . '  </operation>';
996
+					$portType_xml .= "\n".'    <input message="tns:'.$opParts['input']['message'].'"/>';
997
+					$portType_xml .= "\n".'    <output message="tns:'.$opParts['output']['message'].'"/>';
998
+					$portType_xml .= "\n".'  </operation>';
1001 999
 				}
1002
-				$portType_xml .= "\n" . '</portType>';
1003
-				$binding_xml .= "\n" . '</binding>';
1000
+				$portType_xml .= "\n".'</portType>';
1001
+				$binding_xml .= "\n".'</binding>';
1004 1002
 			}
1005
-			$xml .= $portType_xml . $binding_xml;
1003
+			$xml .= $portType_xml.$binding_xml;
1006 1004
 		}
1007 1005
 		// services
1008
-		$xml .= "\n<service name=\"" . $this->serviceName . '">';
1006
+		$xml .= "\n<service name=\"".$this->serviceName.'">';
1009 1007
 		if (count($this->ports) >= 1) {
1010
-			foreach($this->ports as $pName => $attrs) {
1011
-				$xml .= "\n" . '  <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">';
1012
-				$xml .= "\n" . '    <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>';
1013
-				$xml .= "\n" . '  </port>';
1008
+			foreach ($this->ports as $pName => $attrs) {
1009
+				$xml .= "\n".'  <port name="'.$pName.'" binding="tns:'.$attrs['binding'].'">';
1010
+				$xml .= "\n".'    <soap:address location="'.$attrs['location'].($debug ? '?debug=1' : '').'"/>';
1011
+				$xml .= "\n".'  </port>';
1014 1012
 			}
1015 1013
 		}
1016
-		$xml .= "\n" . '</service>';
1017
-		return $xml . "\n</definitions>";
1014
+		$xml .= "\n".'</service>';
1015
+		return $xml."\n</definitions>";
1018 1016
 	}
1019 1017
 
1020 1018
 	/**
@@ -1111,7 +1109,7 @@  discard block
 block discarded – undo
1111 1109
 	 */
1112 1110
 	function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') {
1113 1111
 		$this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType");
1114
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
1112
+		$this->appendDebug('parameters='.$this->varDump($parameters));
1115 1113
 
1116 1114
 		if ($direction != 'input' && $direction != 'output') {
1117 1115
 			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
@@ -1119,8 +1117,8 @@  discard block
 block discarded – undo
1119 1117
 			return false;
1120 1118
 		}
1121 1119
 		if (!$opData = $this->getOperationData($operation, $bindingType)) {
1122
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
1123
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType);
1120
+			$this->debug('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType);
1121
+			$this->setError('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType);
1124 1122
 			return false;
1125 1123
 		}
1126 1124
 		$this->debug('in serializeRPCParameters: opData:');
@@ -1128,7 +1126,7 @@  discard block
 block discarded – undo
1128 1126
 
1129 1127
 		// Get encoding style for output and set to current
1130 1128
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1131
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1129
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1132 1130
 			$encodingStyle = $opData['output']['encodingStyle'];
1133 1131
 			$enc_style = $encodingStyle;
1134 1132
 		}
@@ -1213,7 +1211,7 @@  discard block
 block discarded – undo
1213 1211
 	function serializeParameters($operation, $direction, $parameters)
1214 1212
 	{
1215 1213
 		$this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion");
1216
-		$this->appendDebug('parameters=' . $this->varDump($parameters));
1214
+		$this->appendDebug('parameters='.$this->varDump($parameters));
1217 1215
 
1218 1216
 		if ($direction != 'input' && $direction != 'output') {
1219 1217
 			$this->debug('The value of the \$direction argument needs to be either "input" or "output"');
@@ -1221,8 +1219,8 @@  discard block
 block discarded – undo
1221 1219
 			return false;
1222 1220
 		}
1223 1221
 		if (!$opData = $this->getOperationData($operation)) {
1224
-			$this->debug('Unable to retrieve WSDL data for operation: ' . $operation);
1225
-			$this->setError('Unable to retrieve WSDL data for operation: ' . $operation);
1222
+			$this->debug('Unable to retrieve WSDL data for operation: '.$operation);
1223
+			$this->setError('Unable to retrieve WSDL data for operation: '.$operation);
1226 1224
 			return false;
1227 1225
 		}
1228 1226
 		$this->debug('opData:');
@@ -1230,7 +1228,7 @@  discard block
 block discarded – undo
1230 1228
 
1231 1229
 		// Get encoding style for output and set to current
1232 1230
 		$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1233
-		if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1231
+		if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) {
1234 1232
 			$encodingStyle = $opData['output']['encodingStyle'];
1235 1233
 			$enc_style = $encodingStyle;
1236 1234
 		}
@@ -1241,14 +1239,14 @@  discard block
 block discarded – undo
1241 1239
 
1242 1240
 			$use = $opData[$direction]['use'];
1243 1241
 			$this->debug("use=$use");
1244
-			$this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)');
1242
+			$this->debug('got '.count($opData[$direction]['parts']).' part(s)');
1245 1243
 			if (is_array($parameters)) {
1246 1244
 				$parametersArrayType = $this->isArraySimpleOrStruct($parameters);
1247
-				$this->debug('have ' . $parametersArrayType . ' parameters');
1248
-				foreach($opData[$direction]['parts'] as $name => $type) {
1245
+				$this->debug('have '.$parametersArrayType.' parameters');
1246
+				foreach ($opData[$direction]['parts'] as $name => $type) {
1249 1247
 					$this->debug('serializing part "'.$name.'" of type "'.$type.'"');
1250 1248
 					// Track encoding style
1251
-					if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1249
+					if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) {
1252 1250
 						$encodingStyle = $opData[$direction]['encodingStyle'];
1253 1251
 						$enc_style = $encodingStyle;
1254 1252
 					} else {
@@ -1289,18 +1287,18 @@  discard block
 block discarded – undo
1289 1287
 	 * @return string value serialized as an XML string
1290 1288
 	 * @access private
1291 1289
 	 */
1292
-	function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false)
1290
+	function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false)
1293 1291
 	{
1294
-		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified"));
1295
-		$this->appendDebug("value=" . $this->varDump($value));
1296
-		if($use == 'encoded' && $encodingStyle) {
1297
-			$encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"';
1292
+		$this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=".($unqualified ? "unqualified" : "qualified"));
1293
+		$this->appendDebug("value=".$this->varDump($value));
1294
+		if ($use == 'encoded' && $encodingStyle) {
1295
+			$encodingStyle = ' SOAP-ENV:encodingStyle="'.$encodingStyle.'"';
1298 1296
 		}
1299 1297
 
1300 1298
 		// if a soapval has been supplied, let its type override the WSDL
1301 1299
     	if (is_object($value) && get_class($value) == 'soapval') {
1302 1300
     		if ($value->type_ns) {
1303
-    			$type = $value->type_ns . ':' . $value->type;
1301
+    			$type = $value->type_ns.':'.$value->type;
1304 1302
 		    	$forceType = true;
1305 1303
 		    	$this->debug("in serializeType: soapval overrides type to $type");
1306 1304
     		} elseif ($value->type) {
@@ -1319,7 +1317,7 @@  discard block
 block discarded – undo
1319 1317
 	    			$value['!'] = $value;
1320 1318
 	    		}
1321 1319
 	    		foreach ($attrs as $n => $v) {
1322
-	    			$value['!' . $n] = $v;
1320
+	    			$value['!'.$n] = $v;
1323 1321
 	    		}
1324 1322
 		    	$this->debug("in serializeType: soapval provides attributes");
1325 1323
 		    }
@@ -1337,7 +1335,7 @@  discard block
 block discarded – undo
1337 1335
 				$this->debug("in serializeType: expanded prefixed type: $uqType, $ns");
1338 1336
 			}
1339 1337
 
1340
-			if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){
1338
+			if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') {
1341 1339
 				$this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type');
1342 1340
 				if ($unqualified && $use == 'literal') {
1343 1341
 					$elementNS = " xmlns=\"\"";
@@ -1350,7 +1348,7 @@  discard block
 block discarded – undo
1350 1348
 						$xml = "<$name$elementNS/>";
1351 1349
 					} else {
1352 1350
 						// TODO: depends on nillable, which should be checked before calling this method
1353
-						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
1351
+						$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>";
1354 1352
 					}
1355 1353
 					$this->debug("in serializeType: returning: $xml");
1356 1354
 					return $xml;
@@ -1360,7 +1358,7 @@  discard block
 block discarded – undo
1360 1358
 					return $this->serialize_val($value, $name, false, false, false, false, $use);
1361 1359
 				}
1362 1360
 		    	if ($uqType == 'boolean') {
1363
-		    		if ((is_string($value) && $value == 'false') || (! $value)) {
1361
+		    		if ((is_string($value) && $value == 'false') || (!$value)) {
1364 1362
 						$value = 'false';
1365 1363
 					} else {
1366 1364
 						$value = 'true';
@@ -1378,12 +1376,12 @@  discard block
 block discarded – undo
1378 1376
 				if (!$this->getTypeDef($uqType, $ns)) {
1379 1377
 					if ($use == 'literal') {
1380 1378
 						if ($forceType) {
1381
-							$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
1379
+							$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>";
1382 1380
 						} else {
1383 1381
 							$xml = "<$name$elementNS>$value</$name>";
1384 1382
 						}
1385 1383
 					} else {
1386
-						$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
1384
+						$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>";
1387 1385
 					}
1388 1386
 					$this->debug("in serializeType: returning: $xml");
1389 1387
 					return $xml;
@@ -1393,29 +1391,29 @@  discard block
 block discarded – undo
1393 1391
 				$this->debug('in serializeType: appears to be Apache SOAP type');
1394 1392
 				if ($uqType == 'Map') {
1395 1393
 					$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1396
-					if (! $tt_prefix) {
1394
+					if (!$tt_prefix) {
1397 1395
 						$this->debug('in serializeType: Add namespace for Apache SOAP type');
1398
-						$tt_prefix = 'ns' . rand(1000, 9999);
1396
+						$tt_prefix = 'ns'.rand(1000, 9999);
1399 1397
 						$this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap';
1400 1398
 						// force this to be added to usedNamespaces
1401 1399
 						$tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap');
1402 1400
 					}
1403 1401
 					$contents = '';
1404
-					foreach($value as $k => $v) {
1402
+					foreach ($value as $k => $v) {
1405 1403
 						$this->debug("serializing map element: key $k, value $v");
1406 1404
 						$contents .= '<item>';
1407
-						$contents .= $this->serialize_val($k,'key',false,false,false,false,$use);
1408
-						$contents .= $this->serialize_val($v,'value',false,false,false,false,$use);
1405
+						$contents .= $this->serialize_val($k, 'key', false, false, false, false, $use);
1406
+						$contents .= $this->serialize_val($v, 'value', false, false, false, false, $use);
1409 1407
 						$contents .= '</item>';
1410 1408
 					}
1411 1409
 					if ($use == 'literal') {
1412 1410
 						if ($forceType) {
1413
-							$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>";
1411
+							$xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\">$contents</$name>";
1414 1412
 						} else {
1415 1413
 							$xml = "<$name>$contents</$name>";
1416 1414
 						}
1417 1415
 					} else {
1418
-						$xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>";
1416
+						$xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\"$encodingStyle>$contents</$name>";
1419 1417
 					}
1420 1418
 					$this->debug("in serializeType: returning: $xml");
1421 1419
 					return $xml;
@@ -1429,13 +1427,13 @@  discard block
 block discarded – undo
1429 1427
 			$ns = '';
1430 1428
 			$uqType = $type;
1431 1429
 		}
1432
-		if(!$typeDef = $this->getTypeDef($uqType, $ns)){
1430
+		if (!$typeDef = $this->getTypeDef($uqType, $ns)) {
1433 1431
 			$this->setError("$type ($uqType) is not a supported type.");
1434 1432
 			$this->debug("in serializeType: $type ($uqType) is not a supported type.");
1435 1433
 			return false;
1436 1434
 		} else {
1437 1435
 			$this->debug("in serializeType: found typeDef");
1438
-			$this->appendDebug('typeDef=' . $this->varDump($typeDef));
1436
+			$this->appendDebug('typeDef='.$this->varDump($typeDef));
1439 1437
 			if (substr($uqType, -1) == '^') {
1440 1438
 				$uqType = substr($uqType, 0, -1);
1441 1439
 			}
@@ -1446,7 +1444,7 @@  discard block
 block discarded – undo
1446 1444
 			return false;
1447 1445
 		}
1448 1446
 		$phpType = $typeDef['phpType'];
1449
-		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') );
1447
+		$this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: ".(isset($typeDef['arrayType']) ? $typeDef['arrayType'] : ''));
1450 1448
 		// if php type == struct, map value to the <all> element names
1451 1449
 		if ($phpType == 'struct') {
1452 1450
 			if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') {
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 					// TODO: depends on minOccurs and nillable
1470 1468
 					$xml = "<$elementName$elementNS/>";
1471 1469
 				} else {
1472
-					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>";
1470
+					$xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>";
1473 1471
 				}
1474 1472
 				$this->debug("in serializeType: returning: $xml");
1475 1473
 				return $xml;
@@ -1481,12 +1479,12 @@  discard block
 block discarded – undo
1481 1479
 				$elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType);
1482 1480
 				if ($use == 'literal') {
1483 1481
 					if ($forceType) {
1484
-						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">";
1482
+						$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">";
1485 1483
 					} else {
1486 1484
 						$xml = "<$elementName$elementNS$elementAttrs>";
1487 1485
 					}
1488 1486
 				} else {
1489
-					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>";
1487
+					$xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>";
1490 1488
 				}
1491 1489
 
1492 1490
 				if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') {
@@ -1521,13 +1519,13 @@  discard block
 block discarded – undo
1521 1519
 					// TODO: depends on minOccurs
1522 1520
 					$xml = "<$name$elementNS/>";
1523 1521
 				} else {
1524
-					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" .
1525
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
1526
-						":Array\" " .
1527
-						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') .
1528
-						':arrayType="' .
1529
-						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) .
1530
-						':' .
1522
+					$xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".
1523
+						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').
1524
+						":Array\" ".
1525
+						$this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/').
1526
+						':arrayType="'.
1527
+						$this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])).
1528
+						':'.
1531 1529
 						$this->getLocalPart($typeDef['arrayType'])."[0]\"/>";
1532 1530
 				}
1533 1531
 				$this->debug("in serializeType: returning: $xml");
@@ -1535,8 +1533,8 @@  discard block
 block discarded – undo
1535 1533
 			}
1536 1534
 			if (isset($typeDef['multidimensional'])) {
1537 1535
 				$nv = array();
1538
-				foreach($value as $v) {
1539
-					$cols = ',' . sizeof($v);
1536
+				foreach ($value as $v) {
1537
+					$cols = ','.sizeof($v);
1540 1538
 					$nv = array_merge($nv, $v);
1541 1539
 				}
1542 1540
 				$value = $nv;
@@ -1546,10 +1544,10 @@  discard block
 block discarded – undo
1546 1544
 			if (is_array($value) && sizeof($value) >= 1) {
1547 1545
 				$rows = sizeof($value);
1548 1546
 				$contents = '';
1549
-				foreach($value as $k => $v) {
1547
+				foreach ($value as $k => $v) {
1550 1548
 					//$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]");
1551 1549
 					//if (strpos($typeDef['arrayType'], ':') ) {
1552
-					if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1550
+					if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) {
1553 1551
 					    $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use);
1554 1552
 					} else {
1555 1553
 					    $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use);
@@ -1586,12 +1584,12 @@  discard block
 block discarded – undo
1586 1584
 			}
1587 1585
 			if ($use == 'literal') {
1588 1586
 				if ($forceType) {
1589
-					$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>";
1587
+					$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>";
1590 1588
 				} else {
1591 1589
 					$xml = "<$name$elementNS>$value</$name>";
1592 1590
 				}
1593 1591
 			} else {
1594
-				$xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>";
1592
+				$xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>";
1595 1593
 			}
1596 1594
 		}
1597 1595
 		$this->debug("in serializeType: returning: $xml");
@@ -1635,22 +1633,22 @@  discard block
 block discarded – undo
1635 1633
 				$xvalue = array();
1636 1634
 			}
1637 1635
 			foreach ($typeDef['attrs'] as $aName => $attrs) {
1638
-				if (isset($xvalue['!' . $aName])) {
1639
-					$xname = '!' . $aName;
1636
+				if (isset($xvalue['!'.$aName])) {
1637
+					$xname = '!'.$aName;
1640 1638
 					$this->debug("value provided for attribute $aName with key $xname");
1641 1639
 				} elseif (isset($xvalue[$aName])) {
1642 1640
 					$xname = $aName;
1643 1641
 					$this->debug("value provided for attribute $aName with key $xname");
1644 1642
 				} elseif (isset($attrs['default'])) {
1645
-					$xname = '!' . $aName;
1643
+					$xname = '!'.$aName;
1646 1644
 					$xvalue[$xname] = $attrs['default'];
1647
-					$this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName);
1645
+					$this->debug('use default value of '.$xvalue[$aName].' for attribute '.$aName);
1648 1646
 				} else {
1649 1647
 					$xname = '';
1650 1648
 					$this->debug("no value provided for attribute $aName");
1651 1649
 				}
1652 1650
 				if ($xname) {
1653
-					$xml .=  " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\"";
1651
+					$xml .= " $aName=\"".$this->expandEntities($xvalue[$xname])."\"";
1654 1652
 				}
1655 1653
 			}
1656 1654
 		} else {
@@ -1671,7 +1669,7 @@  discard block
 block discarded – undo
1671 1669
 	 * @return string value serialized as an XML string
1672 1670
 	 * @access private
1673 1671
 	 */
1674
-	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) {
1672
+	function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) {
1675 1673
 		$this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType");
1676 1674
 		$xml = '';
1677 1675
 		if (isset($typeDef['extensionBase'])) {
@@ -1698,23 +1696,23 @@  discard block
 block discarded – undo
1698 1696
 				$xvalue = array();
1699 1697
 			}
1700 1698
 			// toggle whether all elements are present - ideally should validate against schema
1701
-			if (count($typeDef['elements']) != count($xvalue)){
1699
+			if (count($typeDef['elements']) != count($xvalue)) {
1702 1700
 				$optionals = true;
1703 1701
 			}
1704 1702
 			foreach ($typeDef['elements'] as $eName => $attrs) {
1705 1703
 				if (!isset($xvalue[$eName])) {
1706 1704
 					if (isset($attrs['default'])) {
1707 1705
 						$xvalue[$eName] = $attrs['default'];
1708
-						$this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName);
1706
+						$this->debug('use default value of '.$xvalue[$eName].' for element '.$eName);
1709 1707
 					}
1710 1708
 				}
1711 1709
 				// if user took advantage of a minOccurs=0, then only serialize named parameters
1712 1710
 				if (isset($optionals)
1713 1711
 				    && (!isset($xvalue[$eName]))
1714
-					&& ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1715
-					){
1712
+					&& ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true')
1713
+					) {
1716 1714
 					if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') {
1717
-						$this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']);
1715
+						$this->debug("apparent error: no value provided for element $eName with minOccurs=".$attrs['minOccurs']);
1718 1716
 					}
1719 1717
 					// do nothing
1720 1718
 					$this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing");
@@ -1779,15 +1777,15 @@  discard block
 block discarded – undo
1779 1777
 	* @see nusoap_xmlschema
1780 1778
 	* @access public
1781 1779
 	*/
1782
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') {
1780
+	function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') {
1783 1781
 		if (count($elements) > 0) {
1784 1782
 			$eElements = array();
1785
-	    	foreach($elements as $n => $e){
1783
+	    	foreach ($elements as $n => $e) {
1786 1784
 	            // expand each element
1787 1785
 	            $ee = array();
1788 1786
 	            foreach ($e as $k => $v) {
1789
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1790
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1787
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1788
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1791 1789
 		            $ee[$k] = $v;
1792 1790
 		    	}
1793 1791
 	    		$eElements[$n] = $ee;
@@ -1796,11 +1794,11 @@  discard block
 block discarded – undo
1796 1794
 		}
1797 1795
 
1798 1796
 		if (count($attrs) > 0) {
1799
-	    	foreach($attrs as $n => $a){
1797
+	    	foreach ($attrs as $n => $a) {
1800 1798
 	            // expand each attribute
1801 1799
 	            foreach ($a as $k => $v) {
1802
-		            $k = strpos($k,':') ? $this->expandQname($k) : $k;
1803
-		            $v = strpos($v,':') ? $this->expandQname($v) : $v;
1800
+		            $k = strpos($k, ':') ? $this->expandQname($k) : $k;
1801
+		            $v = strpos($v, ':') ? $this->expandQname($v) : $v;
1804 1802
 		            $aa[$k] = $v;
1805 1803
 		    	}
1806 1804
 	    		$eAttrs[$n] = $aa;
@@ -1808,11 +1806,11 @@  discard block
 block discarded – undo
1808 1806
 	    	$attrs = $eAttrs;
1809 1807
 		}
1810 1808
 
1811
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1812
-		$arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType;
1809
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1810
+		$arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType;
1813 1811
 
1814 1812
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1815
-		$this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType);
1813
+		$this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
1816 1814
 	}
1817 1815
 
1818 1816
 	/**
@@ -1826,8 +1824,8 @@  discard block
 block discarded – undo
1826 1824
 	* @see nusoap_xmlschema
1827 1825
 	* @access public
1828 1826
 	*/
1829
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
1830
-		$restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1827
+	function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) {
1828
+		$restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase;
1831 1829
 
1832 1830
 		$typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns'];
1833 1831
 		$this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration);
@@ -1859,7 +1857,7 @@  discard block
 block discarded – undo
1859 1857
 	* @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
1860 1858
 	* @access public
1861 1859
 	*/
1862
-	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){
1860
+	function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') {
1863 1861
 		if ($use == 'encoded' && $encodingStyle == '') {
1864 1862
 			$encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/';
1865 1863
 		}
@@ -1869,24 +1867,24 @@  discard block
 block discarded – undo
1869 1867
 			foreach ($in as $n => $t) {
1870 1868
 				$elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
1871 1869
 			}
1872
-			$this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements);
1873
-			$this->addElement(array('name' => $name, 'type' => $name . 'RequestType'));
1874
-			$in = array('parameters' => 'tns:' . $name . '^');
1870
+			$this->addComplexType($name.'RequestType', 'complexType', 'struct', 'all', '', $elements);
1871
+			$this->addElement(array('name' => $name, 'type' => $name.'RequestType'));
1872
+			$in = array('parameters' => 'tns:'.$name.'^');
1875 1873
 
1876 1874
 			$elements = array();
1877 1875
 			foreach ($out as $n => $t) {
1878 1876
 				$elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified');
1879 1877
 			}
1880
-			$this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements);
1881
-			$this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified'));
1882
-			$out = array('parameters' => 'tns:' . $name . 'Response' . '^');
1878
+			$this->addComplexType($name.'ResponseType', 'complexType', 'struct', 'all', '', $elements);
1879
+			$this->addElement(array('name' => $name.'Response', 'type' => $name.'ResponseType', 'form' => 'qualified'));
1880
+			$out = array('parameters' => 'tns:'.$name.'Response'.'^');
1883 1881
 		}
1884 1882
 
1885 1883
 		// get binding
1886
-		$this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] =
1884
+		$this->bindings[$this->serviceName.'Binding']['operations'][$name] =
1887 1885
 		array(
1888 1886
 		'name' => $name,
1889
-		'binding' => $this->serviceName . 'Binding',
1887
+		'binding' => $this->serviceName.'Binding',
1890 1888
 		'endpoint' => $this->endpoint,
1891 1889
 		'soapAction' => $soapaction,
1892 1890
 		'style' => $style,
@@ -1894,42 +1892,42 @@  discard block
 block discarded – undo
1894 1892
 			'use' => $use,
1895 1893
 			'namespace' => $namespace,
1896 1894
 			'encodingStyle' => $encodingStyle,
1897
-			'message' => $name . 'Request',
1895
+			'message' => $name.'Request',
1898 1896
 			'parts' => $in),
1899 1897
 		'output' => array(
1900 1898
 			'use' => $use,
1901 1899
 			'namespace' => $namespace,
1902 1900
 			'encodingStyle' => $encodingStyle,
1903
-			'message' => $name . 'Response',
1901
+			'message' => $name.'Response',
1904 1902
 			'parts' => $out),
1905 1903
 		'namespace' => $namespace,
1906 1904
 		'transport' => 'http://schemas.xmlsoap.org/soap/http',
1907 1905
 		'documentation' => $documentation);
1908 1906
 		// add portTypes
1909 1907
 		// add messages
1910
-		if($in)
1908
+		if ($in)
1911 1909
 		{
1912
-			foreach($in as $pName => $pType)
1910
+			foreach ($in as $pName => $pType)
1913 1911
 			{
1914
-				if(strpos($pType,':')) {
1912
+				if (strpos($pType, ':')) {
1915 1913
 					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1916 1914
 				}
1917 1915
 				$this->messages[$name.'Request'][$pName] = $pType;
1918 1916
 			}
1919 1917
 		} else {
1920
-            $this->messages[$name.'Request']= '0';
1918
+            $this->messages[$name.'Request'] = '0';
1921 1919
         }
1922
-		if($out)
1920
+		if ($out)
1923 1921
 		{
1924
-			foreach($out as $pName => $pType)
1922
+			foreach ($out as $pName => $pType)
1925 1923
 			{
1926
-				if(strpos($pType,':')) {
1924
+				if (strpos($pType, ':')) {
1927 1925
 					$pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType);
1928 1926
 				}
1929 1927
 				$this->messages[$name.'Response'][$pName] = $pType;
1930 1928
 			}
1931 1929
 		} else {
1932
-            $this->messages[$name.'Response']= '0';
1930
+            $this->messages[$name.'Response'] = '0';
1933 1931
         }
1934 1932
 		return true;
1935 1933
 	}
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.nusoap_base.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -183,26 +183,26 @@  discard block
 block discarded – undo
183 183
 	*/
184 184
 	var $typemap = array(
185 185
 	'http://www.w3.org/2001/XMLSchema' => array(
186
-		'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
187
-		'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
188
-		'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
186
+		'string'=>'string', 'boolean'=>'boolean', 'float'=>'double', 'double'=>'double', 'decimal'=>'double',
187
+		'duration'=>'', 'dateTime'=>'string', 'time'=>'string', 'date'=>'string', 'gYearMonth'=>'',
188
+		'gYear'=>'', 'gMonthDay'=>'', 'gDay'=>'', 'gMonth'=>'', 'hexBinary'=>'string', 'base64Binary'=>'string',
189 189
 		// abstract "any" types
190
-		'anyType'=>'string','anySimpleType'=>'string',
190
+		'anyType'=>'string', 'anySimpleType'=>'string',
191 191
 		// derived datatypes
192
-		'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
193
-		'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
194
-		'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
195
-		'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
192
+		'normalizedString'=>'string', 'token'=>'string', 'language'=>'', 'NMTOKEN'=>'', 'NMTOKENS'=>'', 'Name'=>'', 'NCName'=>'', 'ID'=>'',
193
+		'IDREF'=>'', 'IDREFS'=>'', 'ENTITY'=>'', 'ENTITIES'=>'', 'integer'=>'integer', 'nonPositiveInteger'=>'integer',
194
+		'negativeInteger'=>'integer', 'long'=>'integer', 'int'=>'integer', 'short'=>'integer', 'byte'=>'integer', 'nonNegativeInteger'=>'integer',
195
+		'unsignedLong'=>'', 'unsignedInt'=>'', 'unsignedShort'=>'', 'unsignedByte'=>'', 'positiveInteger'=>''),
196 196
 	'http://www.w3.org/2000/10/XMLSchema' => array(
197
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
198
-		'float'=>'double','dateTime'=>'string',
199
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
197
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
198
+		'float'=>'double', 'dateTime'=>'string',
199
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
200 200
 	'http://www.w3.org/1999/XMLSchema' => array(
201
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
202
-		'float'=>'double','dateTime'=>'string',
203
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
201
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
202
+		'float'=>'double', 'dateTime'=>'string',
203
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
204 204
 	'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
205
-	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
205
+	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string', 'array'=>'array', 'Array'=>'array'),
206 206
     'http://xml.apache.org/xml-soap' => array('Map')
207 207
 	);
208 208
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	* @deprecated
215 215
 	* @see	expandEntities
216 216
 	*/
217
-	var $xmlEntities = array('quot' => '"','amp' => '&',
218
-		'lt' => '<','gt' => '>','apos' => "'");
217
+	var $xmlEntities = array('quot' => '"', 'amp' => '&',
218
+		'lt' => '<', 'gt' => '>', 'apos' => "'");
219 219
 
220 220
 	/**
221 221
 	* constructor
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	* @param    string $string debug data
273 273
 	* @access   private
274 274
 	*/
275
-	function debug($string){
275
+	function debug($string) {
276 276
 		if ($this->debugLevel > 0) {
277 277
 			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
278 278
 		}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	* @param    string $string debug data
285 285
 	* @access   public
286 286
 	*/
287
-	function appendDebug($string){
287
+	function appendDebug($string) {
288 288
 		if ($this->debugLevel > 0) {
289 289
 			// it would be nice to use a memory stream here to use
290 290
 			// memory more efficiently
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		while (strpos($this->debug_str, '--')) {
329 329
 			$this->debug_str = str_replace('--', '- -', $this->debug_str);
330 330
 		}
331
-		$ret = "<!--\n" . $this->debug_str . "\n-->";
331
+		$ret = "<!--\n".$this->debug_str."\n-->";
332 332
     	return $ret;
333 333
 	}
334 334
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* @return   mixed error string or false
356 356
 	* @access   public
357 357
 	*/
358
-	function getError(){
359
-		if($this->error_str != ''){
358
+	function getError() {
359
+		if ($this->error_str != '') {
360 360
 			return $this->error_str;
361 361
 		}
362 362
 		return false;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	* @return   boolean $string error string
369 369
 	* @access   private
370 370
 	*/
371
-	function setError($str){
371
+	function setError($str) {
372 372
 		$this->error_str = $str;
373 373
 	}
374 374
 
@@ -404,12 +404,12 @@  discard block
 block discarded – undo
404 404
 	* @return	string	The serialized element, possibly with child elements
405 405
     * @access	public
406 406
 	*/
407
-	function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) {
407
+	function serialize_val($val, $name = false, $type = false, $name_ns = false, $type_ns = false, $attributes = false, $use = 'encoded', $soapval = false) {
408 408
 		$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
409
-		$this->appendDebug('value=' . $this->varDump($val));
410
-		$this->appendDebug('attributes=' . $this->varDump($attributes));
409
+		$this->appendDebug('value='.$this->varDump($val));
410
+		$this->appendDebug('attributes='.$this->varDump($attributes));
411 411
 
412
-    	if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
412
+    	if (is_object($val) && get_class($val) == 'soapval' && (!$soapval)) {
413 413
     		$this->debug("serialize_val: serialize soapval");
414 414
         	$xml = $val->serialize($use);
415 415
 			$this->appendDebug($val->getDebug());
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
         }
420 420
 		// force valid name if necessary
421 421
 		if (is_numeric($name)) {
422
-			$name = '__numeric_' . $name;
423
-		} elseif (! $name) {
422
+			$name = '__numeric_'.$name;
423
+		} elseif (!$name) {
424 424
 			$name = 'noname';
425 425
 		}
426 426
 		// if name has ns, add ns prefix to name
427 427
 		$xmlns = '';
428
-        if($name_ns){
429
-			$prefix = 'nu'.rand(1000,9999);
428
+        if ($name_ns) {
429
+			$prefix = 'nu'.rand(1000, 9999);
430 430
 			$name = $prefix.':'.$name;
431 431
 			$xmlns .= " xmlns:$prefix=\"$name_ns\"";
432 432
 		}
433 433
 		// if type is prefixed, create type prefix
434
-		if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
434
+		if ($type_ns != '' && $type_ns == $this->namespaces['xsd']) {
435 435
 			// need to fix this. shouldn't default to xsd if no ns specified
436 436
 		    // w/o checking against typemap
437 437
 			$type_prefix = 'xsd';
438
-		} elseif($type_ns){
439
-			$type_prefix = 'ns'.rand(1000,9999);
438
+		} elseif ($type_ns) {
439
+			$type_prefix = 'ns'.rand(1000, 9999);
440 440
 			$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
441 441
 		}
442 442
 		// serialize attributes if present
443 443
 		$atts = '';
444
-		if($attributes){
445
-			foreach($attributes as $k => $v){
444
+		if ($attributes) {
445
+			foreach ($attributes as $k => $v) {
446 446
 				$atts .= " $k=\"".$this->expandEntities($v).'"';
447 447
 			}
448 448
 		}
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
         	}
467 467
 		}
468 468
         // serialize if an xsd built-in primitive type
469
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
469
+        if ($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])) {
470 470
     		$this->debug("serialize_val: serialize xsd built-in primitive type");
471 471
         	if (is_bool($val)) {
472 472
         		if ($type == 'boolean') {
473 473
 	        		$val = $val ? 'true' : 'false';
474
-	        	} elseif (! $val) {
474
+	        	} elseif (!$val) {
475 475
 	        		$val = 0;
476 476
 	        	}
477 477
 			} else if (is_string($val)) {
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
         }
490 490
 		// detect type and serialize
491 491
 		$xml = '';
492
-		switch(true) {
492
+		switch (true) {
493 493
 			case (is_bool($val) || $type == 'boolean'):
494 494
 		   		$this->debug("serialize_val: serialize boolean");
495 495
         		if ($type == 'boolean') {
496 496
 	        		$val = $val ? 'true' : 'false';
497
-	        	} elseif (! $val) {
497
+	        	} elseif (!$val) {
498 498
 	        		$val = 0;
499 499
 	        	}
500 500
 				if ($use == 'literal') {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
512 512
 				}
513 513
 				break;
514
-			case (is_float($val)|| is_double($val) || $type == 'float'):
514
+			case (is_float($val) || is_double($val) || $type == 'float'):
515 515
 		   		$this->debug("serialize_val: serialize float");
516 516
 				if ($use == 'literal') {
517 517
 					$xml .= "<$name$xmlns$atts>$val</$name>";
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 					$this->appendDebug($val->getDebug());
537 537
 					$val->clearDebug();
538 538
 		        } else {
539
-					if (! $name) {
539
+					if (!$name) {
540 540
 						$name = get_class($val);
541 541
 						$this->debug("In serialize_val, used class name $name as element name");
542 542
 					} else {
543
-						$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
543
+						$this->debug("In serialize_val, do not override name $name for element name for class ".get_class($val));
544 544
 					}
545
-					foreach(get_object_vars($val) as $k => $v){
546
-						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
545
+					foreach (get_object_vars($val) as $k => $v) {
546
+						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v, $k, false, false, false, false, $use) : $this->serialize_val($v, $k, false, false, false, false, $use);
547 547
 					}
548 548
 				}
549
-				if(isset($type) && isset($type_prefix)){
549
+				if (isset($type) && isset($type_prefix)) {
550 550
 					$type_str = " xsi:type=\"$type_prefix:$type\"";
551 551
 				} else {
552 552
 					$type_str = '';
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
 			case (is_array($val) || $type):
562 562
 				// detect if struct or array
563 563
 				$valueType = $this->isArraySimpleOrStruct($val);
564
-                if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
564
+                if ($valueType == 'arraySimple' || preg_match('/^ArrayOf/', $type)) {
565 565
 			   		$this->debug("serialize_val: serialize array");
566 566
 					$i = 0;
567
-					if(is_array($val) && count($val)> 0){
568
-						foreach($val as $v){
569
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
567
+					if (is_array($val) && count($val) > 0) {
568
+						foreach ($val as $v) {
569
+	                    	if (is_object($v) && get_class($v) == 'soapval') {
570 570
 								$tt_ns = $v->type_ns;
571 571
 								$tt = $v->type;
572 572
 							} elseif (is_array($v)) {
@@ -576,26 +576,26 @@  discard block
 block discarded – undo
576 576
 	                        }
577 577
 							$array_types[$tt] = 1;
578 578
 							// TODO: for literal, the name should be $name
579
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
579
+							$xml .= $this->serialize_val($v, 'item', false, false, false, false, $use);
580 580
 							++$i;
581 581
 						}
582
-						if(count($array_types) > 1){
582
+						if (count($array_types) > 1) {
583 583
 							$array_typename = 'xsd:anyType';
584
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
584
+						} elseif (isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
585 585
 							if ($tt == 'integer') {
586 586
 								$tt = 'int';
587 587
 							}
588 588
 							$array_typename = 'xsd:'.$tt;
589
-						} elseif(isset($tt) && $tt == 'arraySimple'){
589
+						} elseif (isset($tt) && $tt == 'arraySimple') {
590 590
 							$array_typename = 'SOAP-ENC:Array';
591
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
591
+						} elseif (isset($tt) && $tt == 'arrayStruct') {
592 592
 							$array_typename = 'unnamed_struct_use_soapval';
593 593
 						} else {
594 594
 							// if type is prefixed, create type prefix
595
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
596
-								 $array_typename = 'xsd:' . $tt;
595
+							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']) {
596
+								 $array_typename = 'xsd:'.$tt;
597 597
 							} elseif ($tt_ns) {
598
-								$tt_prefix = 'ns' . rand(1000, 9999);
598
+								$tt_prefix = 'ns'.rand(1000, 9999);
599 599
 								$array_typename = "$tt_prefix:$tt";
600 600
 								$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
601 601
 							} else {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 				} else {
626 626
 					// got a struct
627 627
 			   		$this->debug("serialize_val: serialize struct");
628
-					if(isset($type) && isset($type_prefix)){
628
+					if (isset($type) && isset($type_prefix)) {
629 629
 						$type_str = " xsi:type=\"$type_prefix:$type\"";
630 630
 					} else {
631 631
 						$type_str = '';
@@ -635,15 +635,15 @@  discard block
 block discarded – undo
635 635
 					} else {
636 636
 						$xml .= "<$name$xmlns$type_str$atts>";
637 637
 					}
638
-					foreach($val as $k => $v){
638
+					foreach ($val as $k => $v) {
639 639
 						// Apache Map
640 640
 						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
641 641
 							$xml .= '<item>';
642
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
643
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
642
+							$xml .= $this->serialize_val($k, 'key', false, false, false, false, $use);
643
+							$xml .= $this->serialize_val($v, 'value', false, false, false, false, $use);
644 644
 							$xml .= '</item>';
645 645
 						} else {
646
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
646
+							$xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
647 647
 						}
648 648
 					}
649 649
 					$xml .= "</$name>";
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
     * @return string the message
671 671
     * @access public
672 672
     */
673
-    function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
673
+    function serializeEnvelope($body, $headers = false, $namespaces = array(), $style = 'rpc', $use = 'encoded', $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/') {
674 674
     // TODO: add an option to automatically run utf8_encode on $body and $headers
675 675
     // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
676 676
     // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
677 677
 
678
-	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
678
+	$this->debug("In serializeEnvelope length=".strlen($body)." body (max 1000 characters)=".substr($body, 0, 1000)." style=$style use=$use encodingStyle=$encodingStyle");
679 679
 	$this->debug("headers:");
680 680
 	$this->appendDebug($this->varDump($headers));
681 681
 	$this->debug("namespaces:");
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 
684 684
 	// serialize namespaces
685 685
     $ns_string = '';
686
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
686
+	foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
687 687
 		$ns_string .= " xmlns:$k=\"$v\"";
688 688
 	}
689
-	if($encodingStyle) {
689
+	if ($encodingStyle) {
690 690
 		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
691 691
 	}
692 692
 
693 693
 	// serialize headers
694
-	if($headers){
694
+	if ($headers) {
695 695
 		if (is_array($headers)) {
696 696
 			$xml = '';
697 697
 			foreach ($headers as $k => $v) {
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 	// serialize envelope
710 710
 	return
711
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
711
+	'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?'.">".
712 712
 	'<SOAP-ENV:Envelope'.$ns_string.">".
713 713
 	$headers.
714 714
 	"<SOAP-ENV:Body>".
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 * @access public
726 726
 	 * @deprecated
727 727
 	 */
728
-    function formatDump($str){
728
+    function formatDump($str) {
729 729
 		$str = htmlspecialchars($str);
730 730
 		return nl2br($str);
731 731
     }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	* @return	string contracted qname
738 738
 	* @access   private
739 739
 	*/
740
-	function contractQname($qname){
740
+	function contractQname($qname) {
741 741
 		// get element namespace
742 742
 		//$this->xdebug("Contract $qname");
743 743
 		if (strrpos($qname, ':')) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 			$ns = substr($qname, 0, strrpos($qname, ':'));
748 748
 			$p = $this->getPrefixFromNamespace($ns);
749 749
 			if ($p) {
750
-				return $p . ':' . $name;
750
+				return $p.':'.$name;
751 751
 			}
752 752
 			return $qname;
753 753
 		} else {
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	* @return	string expanded qname
763 763
 	* @access   private
764 764
 	*/
765
-	function expandQname($qname){
765
+	function expandQname($qname) {
766 766
 		// get element prefix
767
-		if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
767
+		if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
768 768
 			// get unqualified name
769
-			$name = substr(strstr($qname,':'),1);
769
+			$name = substr(strstr($qname, ':'), 1);
770 770
 			// get ns prefix
771
-			$prefix = substr($qname,0,strpos($qname,':'));
772
-			if(isset($this->namespaces[$prefix])){
771
+			$prefix = substr($qname, 0, strpos($qname, ':'));
772
+			if (isset($this->namespaces[$prefix])) {
773 773
 				return $this->namespaces[$prefix].':'.$name;
774 774
 			} else {
775 775
 				return $qname;
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
     * @return string The local part
788 788
     * @access public
789 789
     */
790
-	function getLocalPart($str){
791
-		if($sstr = strrchr($str,':')){
790
+	function getLocalPart($str) {
791
+		if ($sstr = strrchr($str, ':')) {
792 792
 			// get unqualified name
793
-			return substr( $sstr, 1 );
793
+			return substr($sstr, 1);
794 794
 		} else {
795 795
 			return $str;
796 796
 		}
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
     * @return mixed The prefix or false if there is no prefix
805 805
     * @access public
806 806
     */
807
-	function getPrefix($str){
808
-		if($pos = strrpos($str,':')){
807
+	function getPrefix($str) {
808
+		if ($pos = strrpos($str, ':')) {
809 809
 			// get prefix
810
-			return substr($str,0,$pos);
810
+			return substr($str, 0, $pos);
811 811
 		}
812 812
 		return false;
813 813
 	}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     * @return mixed The namespace, false if no namespace has the specified prefix
820 820
     * @access public
821 821
     */
822
-	function getNamespaceFromPrefix($prefix){
822
+	function getNamespaceFromPrefix($prefix) {
823 823
 		if (isset($this->namespaces[$prefix])) {
824 824
 			return $this->namespaces[$prefix];
825 825
 		}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 			$sec = time();
861 861
 			$usec = 0;
862 862
 		}
863
-		return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
863
+		return strftime('%Y-%m-%d %H:%M:%S', $sec).'.'.sprintf('%06d', $usec);
864 864
 	}
865 865
 
866 866
 	/**
@@ -901,31 +901,31 @@  discard block
 block discarded – undo
901 901
 * @return	mixed ISO 8601 date string or false
902 902
 * @access   public
903 903
 */
904
-function timestamp_to_iso8601($timestamp,$utc=true){
905
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
904
+function timestamp_to_iso8601($timestamp, $utc = true) {
905
+	$datestr = date('Y-m-d\TH:i:sO', $timestamp);
906 906
 	$pos = strrpos($datestr, "+");
907 907
 	if ($pos === FALSE) {
908 908
 		$pos = strrpos($datestr, "-");
909 909
 	}
910 910
 	if ($pos !== FALSE) {
911 911
 		if (strlen($datestr) == $pos + 5) {
912
-			$datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2);
912
+			$datestr = substr($datestr, 0, $pos + 3).':'.substr($datestr, -2);
913 913
 		}
914 914
 	}
915
-	if($utc){
915
+	if ($utc) {
916 916
 		$pattern = '/'.
917
-		'([0-9]{4})-'.	// centuries & years CCYY-
918
-		'([0-9]{2})-'.	// months MM-
919
-		'([0-9]{2})'.	// days DD
920
-		'T'.			// separator T
921
-		'([0-9]{2}):'.	// hours hh:
922
-		'([0-9]{2}):'.	// minutes mm:
923
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
924
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
917
+		'([0-9]{4})-'.// centuries & years CCYY-
918
+		'([0-9]{2})-'.// months MM-
919
+		'([0-9]{2})'.// days DD
920
+		'T'.// separator T
921
+		'([0-9]{2}):'.// hours hh:
922
+		'([0-9]{2}):'.// minutes mm:
923
+		'([0-9]{2})(\.[0-9]*)?'.// seconds ss.ss...
924
+		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
925 925
 		'/';
926 926
 
927
-		if(preg_match($pattern,$datestr,$regs)){
928
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
927
+		if (preg_match($pattern, $datestr, $regs)) {
928
+			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ', $regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6]);
929 929
 		}
930 930
 		return false;
931 931
 	} else {
@@ -940,27 +940,27 @@  discard block
 block discarded – undo
940 940
 * @return	mixed Unix timestamp (int) or false
941 941
 * @access   public
942 942
 */
943
-function iso8601_to_timestamp($datestr){
943
+function iso8601_to_timestamp($datestr) {
944 944
 	$pattern = '/'.
945
-	'([0-9]{4})-'.	// centuries & years CCYY-
946
-	'([0-9]{2})-'.	// months MM-
947
-	'([0-9]{2})'.	// days DD
948
-	'T'.			// separator T
949
-	'([0-9]{2}):'.	// hours hh:
950
-	'([0-9]{2}):'.	// minutes mm:
951
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
952
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
945
+	'([0-9]{4})-'.// centuries & years CCYY-
946
+	'([0-9]{2})-'.// months MM-
947
+	'([0-9]{2})'.// days DD
948
+	'T'.// separator T
949
+	'([0-9]{2}):'.// hours hh:
950
+	'([0-9]{2}):'.// minutes mm:
951
+	'([0-9]{2})(\.[0-9]+)?'.// seconds ss.ss...
952
+	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
953 953
 	'/';
954
-	if(preg_match($pattern,$datestr,$regs)){
954
+	if (preg_match($pattern, $datestr, $regs)) {
955 955
 		// not utc
956
-		if($regs[8] != 'Z'){
957
-			$op = substr($regs[8],0,1);
958
-			$h = substr($regs[8],1,2);
959
-			$m = substr($regs[8],strlen($regs[8])-2,2);
960
-			if($op == '-'){
956
+		if ($regs[8] != 'Z') {
957
+			$op = substr($regs[8], 0, 1);
958
+			$h = substr($regs[8], 1, 2);
959
+			$m = substr($regs[8], strlen($regs[8]) - 2, 2);
960
+			if ($op == '-') {
961 961
 				$regs[4] = $regs[4] + $h;
962 962
 				$regs[5] = $regs[5] + $m;
963
-			} elseif($op == '+'){
963
+			} elseif ($op == '+') {
964 964
 				$regs[4] = $regs[4] - $h;
965 965
 				$regs[5] = $regs[5] - $m;
966 966
 			}
Please login to merge, or discard this patch.
main/inc/lib/link.lib.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
         $params['session_id'] = api_get_session_id();
78 78
         $params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
79 79
 
80
-        $sql =  "SELECT MAX(display_order)
80
+        $sql = "SELECT MAX(display_order)
81 81
                 FROM  ".$this->table."
82 82
                 WHERE
83 83
                     c_id = $courseId AND
84
-                    category_id = '" . intval($params['category_id'])."'";
84
+                    category_id = '".intval($params['category_id'])."'";
85 85
         $result = Database:: query($sql);
86 86
         list ($orderMax) = Database:: fetch_row($result);
87 87
         $order = $orderMax + 1;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
             // We ensure URL to be absolute.
187 187
             if (strpos($urllink, '://') === false) {
188
-                $urllink = 'http://' . $urllink;
188
+                $urllink = 'http://'.$urllink;
189 189
             }
190 190
 
191 191
             // If the title is empty, we use the URL as title.
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                     'c_id' => $course_id,
208 208
                     'url' => $urllink,
209 209
                     'title' => $title,
210
-                    'description' => $description ,
210
+                    'description' => $description,
211 211
                     'category_id' => $selectcategory,
212 212
                     'on_homepage' => $onhomepage,
213 213
                     'target' => $target,
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
                 if ((api_get_setting('search_enabled') == 'true') &&
221 221
                     $link_id && extension_loaded('xapian')
222 222
                 ) {
223
-                    require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
224
-                    require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
225
-                    require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
223
+                    require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
224
+                    require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
225
+                    require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
226 226
 
227 227
                     $course_int_id = $_course['real_id'];
228 228
                     $courseCode = $_course['code'];
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                         if (isset ($_REQUEST[$specific_field['code']])) {
236 236
                             $sterms = trim($_REQUEST[$specific_field['code']]);
237 237
                             if (!empty ($sterms)) {
238
-                                $all_specific_terms .= ' ' . $sterms;
238
+                                $all_specific_terms .= ' '.$sterms;
239 239
                                 $sterms = explode(',', $sterms);
240 240
                                 foreach ($sterms as $sterm) {
241 241
                                     $ic_slide->addTerm(
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
                         SE_COURSE_ID => $courseCode,
263 263
                         SE_TOOL_ID => TOOL_LINK,
264 264
                         SE_DATA => array(
265
-                            'link_id' => (int)$link_id
265
+                            'link_id' => (int) $link_id
266 266
                         ),
267
-                        SE_USER => (int)api_get_user_id(),
267
+                        SE_USER => (int) api_get_user_id(),
268 268
                     );
269 269
                     $ic_slide->xapian_data = serialize($xapian_data);
270
-                    $description = $all_specific_terms . ' ' . $description;
270
+                    $description = $all_specific_terms.' '.$description;
271 271
                     $ic_slide->addValue('content', $description);
272 272
 
273 273
                     // Add category name if set.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
                         $sql_cat = sprintf(
280 280
                             $sql_cat,
281 281
                             $table_link_category,
282
-                            (int)$selectcategory,
282
+                            (int) $selectcategory,
283 283
                             $course_int_id
284 284
                         );
285 285
                         $result = Database:: query($sql_cat);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
                 // This will make a restore function possible for the platform administrator.
400 400
 
401 401
                 $sql = "UPDATE $tbl_link SET on_homepage='0'
402
-                        WHERE c_id = $course_id AND id='" . $id . "'";
402
+                        WHERE c_id = $course_id AND id='".$id."'";
403 403
                 Database:: query($sql);
404 404
 
405 405
                 api_item_property_update(
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
                 break;
416 416
             case 'category':
417 417
                 // First we delete the category itself and afterwards all the links of this category.
418
-                $sql = "DELETE FROM " . $tbl_categories . "
419
-                        WHERE c_id = $course_id AND id='" . $id . "'";
418
+                $sql = "DELETE FROM ".$tbl_categories."
419
+                        WHERE c_id = $course_id AND id='".$id."'";
420 420
                 Database:: query($sql);
421 421
 
422
-                $sql = "DELETE FROM " . $tbl_link . "
423
-                        WHERE c_id = $course_id AND category_id='" . $id . "'";
422
+                $sql = "DELETE FROM ".$tbl_link."
423
+                        WHERE c_id = $course_id AND category_id='".$id."'";
424 424
                 Database:: query($sql);
425 425
 
426 426
                 api_item_property_update(
@@ -459,16 +459,16 @@  discard block
 block discarded – undo
459 459
                 $row = Database:: fetch_array($res);
460 460
                 require_once api_get_path(
461 461
                         LIBRARY_PATH
462
-                    ) . 'search/ChamiloIndexer.class.php';
462
+                    ).'search/ChamiloIndexer.class.php';
463 463
                 $di = new ChamiloIndexer();
464
-                $di->remove_document((int)$row['search_did']);
464
+                $di->remove_document((int) $row['search_did']);
465 465
             }
466 466
             $sql = 'DELETE FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
467 467
             $sql = sprintf($sql, $tbl_se_ref, $course_id, TOOL_LINK, $link_id);
468 468
             Database:: query($sql);
469 469
 
470 470
             // Remove terms from db.
471
-            require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
471
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
472 472
             delete_all_values_for_item($course_id, TOOL_DOCUMENT, $link_id);
473 473
         }
474 474
     }
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
     {
485 485
         $tbl_link = Database:: get_course_table(TABLE_LINK);
486 486
         $course_id = api_get_course_int_id();
487
-        $sql = "SELECT * FROM " . $tbl_link . "
488
-                WHERE c_id = $course_id AND id='" . intval($id) . "' ";
487
+        $sql = "SELECT * FROM ".$tbl_link."
488
+                WHERE c_id = $course_id AND id='".intval($id)."' ";
489 489
         $result = Database::query($sql);
490 490
         $data = array();
491 491
         if (Database::num_rows($result)) {
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 
515 515
         // We ensure URL to be absolute.
516 516
         if (strpos($values['url'], '://') === false) {
517
-            $values['url'] = 'http://' . $_POST['url'];
517
+            $values['url'] = 'http://'.$_POST['url'];
518 518
         }
519 519
 
520 520
         // If the title is empty, we use the URL as title.
@@ -532,18 +532,18 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         // Finding the old category_id.
535
-        $sql = "SELECT * FROM " . $tbl_link . "
536
-                WHERE c_id = $course_id AND id='" . $id . "'";
535
+        $sql = "SELECT * FROM ".$tbl_link."
536
+                WHERE c_id = $course_id AND id='".$id."'";
537 537
         $result = Database:: query($sql);
538 538
         $row = Database:: fetch_array($result);
539 539
         $category_id = $row['category_id'];
540 540
 
541 541
         if ($category_id != $values['category_id']) {
542 542
             $sql = "SELECT MAX(display_order)
543
-                    FROM " . $tbl_link . "
543
+                    FROM " . $tbl_link."
544 544
                     WHERE
545 545
                         c_id = $course_id AND
546
-                        category_id='" . intval($values['category_id']) . "'";
546
+                        category_id='".intval($values['category_id'])."'";
547 547
             $result = Database:: query($sql);
548 548
             list ($max_display_order) = Database:: fetch_row($result);
549 549
             $max_display_order++;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
             'target' => $values['target'],
561 561
             'category_id' => $values['category_id'],
562 562
         ];
563
-        Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id] ]);
563
+        Database::update($tbl_link, $params, ['c_id = ? AND id = ?' => [$course_id, $id]]);
564 564
 
565 565
         // Update search enchine and its values table if enabled.
566 566
         if (api_get_setting('search_enabled') == 'true') {
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                             $_REQUEST[$specific_field['code']]
614 614
                         );
615 615
                         if (!empty ($sterms)) {
616
-                            $all_specific_terms .= ' ' . $sterms;
616
+                            $all_specific_terms .= ' '.$sterms;
617 617
                             $sterms = explode(',', $sterms);
618 618
                             foreach ($sterms as $sterm) {
619 619
                                 $ic_slide->addTerm(
@@ -640,13 +640,13 @@  discard block
 block discarded – undo
640 640
                     SE_COURSE_ID => $course_id,
641 641
                     SE_TOOL_ID => TOOL_LINK,
642 642
                     SE_DATA => array(
643
-                        'link_id' => (int)$id
643
+                        'link_id' => (int) $id
644 644
                     ),
645
-                    SE_USER => (int)api_get_user_id(),
645
+                    SE_USER => (int) api_get_user_id(),
646 646
 
647 647
                 );
648 648
                 $ic_slide->xapian_data = serialize($xapian_data);
649
-                $link_description = $all_specific_terms . ' ' . $link_description;
649
+                $link_description = $all_specific_terms.' '.$link_description;
650 650
                 $ic_slide->addValue('content', $link_description);
651 651
 
652 652
                 // Add category name if set.
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
                 $di = new ChamiloIndexer();
675 675
                 isset ($_POST['language']) ? $lang = Database:: escape_string($_POST['language']) : $lang = 'english';
676 676
                 $di->connectDb(null, null, $lang);
677
-                $di->remove_document((int)$se_ref['search_did']);
677
+                $di->remove_document((int) $se_ref['search_did']);
678 678
                 $di->addChunk($ic_slide);
679 679
 
680 680
                 // Index and return search engine document id.
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         $sql = "SELECT *, linkcat.id
792 792
                 FROM $tblLinkCategory linkcat
793 793
                 WHERE
794
-                    linkcat.c_id = " . $courseId . "
794
+                    linkcat.c_id = ".$courseId."
795 795
                     $sessionCondition
796 796
                 ORDER BY linkcat.display_order DESC";
797 797
 
@@ -803,10 +803,10 @@  discard block
 block discarded – undo
803 803
                 INNER JOIN $tblItemProperty itemproperties
804 804
                 ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
805 805
                 WHERE
806
-                    itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
806
+                    itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND
807 807
                     (itemproperties.visibility = '0' OR itemproperties.visibility = '1')
808 808
                     $sessionCondition AND
809
-                    linkcat.c_id = " . $courseId . "
809
+                    linkcat.c_id = ".$courseId."
810 810
                 ORDER BY linkcat.display_order DESC";
811 811
 
812 812
         $result = Database::query($sql);
@@ -829,10 +829,10 @@  discard block
 block discarded – undo
829 829
                 INNER JOIN $tblItemProperty itemproperties
830 830
                 ON (linkcat.id = itemproperties.ref AND linkcat.c_id = itemproperties.c_id)
831 831
                 WHERE
832
-                    itemproperties.tool = '" . TOOL_LINK_CATEGORY . "' AND
832
+                    itemproperties.tool = '".TOOL_LINK_CATEGORY."' AND
833 833
                     (itemproperties.visibility = '0' OR itemproperties.visibility = '1')
834 834
                     $sessionCondition AND
835
-                    linkcat.c_id = " . $courseId . "
835
+                    linkcat.c_id = ".$courseId."
836 836
                 ORDER BY linkcat.display_order DESC
837 837
                 ";
838 838
         $result = Database::query($sql);
@@ -864,12 +864,12 @@  discard block
 block discarded – undo
864 864
                 INNER JOIN $TABLE_ITEM_PROPERTY itemproperties
865 865
                 ON (link.id=itemproperties.ref AND link.c_id = itemproperties.c_id )
866 866
                 WHERE
867
-                    itemproperties.tool='" . TOOL_LINK . "' AND
868
-                    link.category_id='" . $catid . "' AND
867
+                    itemproperties.tool='".TOOL_LINK."' AND
868
+                    link.category_id='" . $catid."' AND
869 869
                     (itemproperties.visibility='0' OR itemproperties.visibility='1')
870 870
                     $condition_session AND
871
-                    link.c_id = " . $course_id . " AND
872
-                    itemproperties.c_id = " . $course_id . "
871
+                    link.c_id = ".$course_id." AND
872
+                    itemproperties.c_id = " . $course_id."
873 873
                 ORDER BY link.display_order DESC";
874 874
         $result = Database:: query($sql);
875 875
         $numberoflinks = Database:: num_rows($result);
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
                             'retweet',
893 893
                             'default btn-sm',
894 894
                             array(
895
-                                'onclick' => "check_url('" . $myrow['id'] . "', '" . addslashes($myrow['url']) . "');",
895
+                                'onclick' => "check_url('".$myrow['id']."', '".addslashes($myrow['url'])."');",
896 896
                                 'title' => get_lang('CheckURL')
897 897
                                 )
898 898
                             );
899 899
                     $link_validator .= Display::span(
900 900
                         '',
901 901
                         array(
902
-                            'id' => 'url_id_' . $myrow['id'],
902
+                            'id' => 'url_id_'.$myrow['id'],
903 903
                             'class' => 'check-link'
904 904
                             )
905 905
                     );
@@ -909,10 +909,10 @@  discard block
 block discarded – undo
909 909
                 if (api_is_allowed_to_edit(null, true)) {
910 910
 
911 911
                     if ($session_id == $myrow['session_id']) {
912
-                        $url = api_get_self() . '?' . api_get_cidreq() .
913
-                            '&action=editlink&category=' . (!empty ($category) ? $category : '') .
914
-                            '&id=' . $myrow['id'] .
915
-                            '&category_id=' . $myrow['id'];
912
+                        $url = api_get_self().'?'.api_get_cidreq().
913
+                            '&action=editlink&category='.(!empty ($category) ? $category : '').
914
+                            '&id='.$myrow['id'].
915
+                            '&category_id='.$myrow['id'];
916 916
                         $title = get_lang('Edit');
917 917
                         $toolbar .= Display::toolbarButton(
918 918
                             '',
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
                         }*/
941 941
 
942 942
                         if ($myrow['visibility'] == '1') {
943
-                            $url .= 'link.php?' . api_get_cidreq() .
944
-                                '&sec_token=' . $token .
945
-                                '&action=invisible&id=' . $myrow['id'] .
946
-                                '&scope=link&category_id=' . $myrow['category_id'];
943
+                            $url .= 'link.php?'.api_get_cidreq().
944
+                                '&sec_token='.$token.
945
+                                '&action=invisible&id='.$myrow['id'].
946
+                                '&scope=link&category_id='.$myrow['category_id'];
947 947
                             $title = get_lang('MakeInvisible');
948 948
                             $toolbar .= Display::toolbarButton(
949 949
                                 '',
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 
958 958
                         }
959 959
                         if ($myrow['visibility'] == '0') {
960
-                            $url .= 'link.php?' . api_get_cidreq() .'&sec_token=' . $token .'&action=visible&id=' . $myrow['id'] .'&scope=link&category_id=' . $myrow['category_id'];
960
+                            $url .= 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope=link&category_id='.$myrow['category_id'];
961 961
                             $title = get_lang('MakeVisible');
962 962
                             $toolbar .= Display::toolbarButton(
963 963
                                 '',
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
                             );
971 971
                         }
972 972
 
973
-                        $url .= api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletelink&id=' . $myrow['id'] .'&category_id=' . $myrow['category_id'];
974
-                        $event = "javascript: if(!confirm('" . get_lang('LinkDelconfirm') . "'))return false;";
973
+                        $url .= api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletelink&id='.$myrow['id'].'&category_id='.$myrow['category_id'];
974
+                        $event = "javascript: if(!confirm('".get_lang('LinkDelconfirm')."'))return false;";
975 975
                         $title = get_lang('Delete');
976 976
 
977 977
                         $toolbar .= Display::toolbarButton(
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                     $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>';
1013 1013
                     $content .= '<h4 class="list-group-item-heading">';
1014 1014
                     $content .= $iconLink;
1015
-                    $url =  'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] .'&link_url=' . urlencode($myrow['url']);
1015
+                    $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id'].'&link_url='.urlencode($myrow['url']);
1016 1016
                     $content .= Display::tag(
1017 1017
                             'a',
1018 1018
                             Security:: remove_XSS($myrow['title']),
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
                     $content .= $session_img;
1026 1026
                     $content .= '</h4>';
1027 1027
 
1028
-                    $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>';
1028
+                    $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>';
1029 1029
                     $content .= '</div>';
1030 1030
                 } else {
1031 1031
                     if (api_is_allowed_to_edit(null, true)) {
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
                         $content .= '<div class="pull-right"><div class="btn-group">'.$toolbar.'</div></div>';
1034 1034
                         $content .= '<h4 class="list-group-item-heading">';
1035 1035
                         $content .= $iconLink;
1036
-                        $url = 'link_goto.php?' . api_get_cidreq() .'&link_id=' . $myrow['id'] . "&link_url=" . urlencode($myrow['url']);
1036
+                        $url = 'link_goto.php?'.api_get_cidreq().'&link_id='.$myrow['id']."&link_url=".urlencode($myrow['url']);
1037 1037
                         $content .= Display::tag(
1038 1038
                                 'a',
1039 1039
                                 Security:: remove_XSS($myrow['title']),
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
                         $content .= $link_validator;
1047 1047
                         $content .= $session_img;
1048 1048
                         $content .= '</h4>';
1049
-                        $content .= '<p class="list-group-item-text">' . $myrow['description'] . '</p>';
1049
+                        $content .= '<p class="list-group-item-text">'.$myrow['description'].'</p>';
1050 1050
                         $content .= '</div>';
1051 1051
                     }
1052 1052
                 }
@@ -1068,58 +1068,58 @@  discard block
 block discarded – undo
1068 1068
     {
1069 1069
         $categoryId = $category['id'];
1070 1070
         $token = null;
1071
-        $tools = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=editcategory&id=' . $categoryId . '&category_id=' . $categoryId . '" title=' . get_lang('Modify') . '">' .
1071
+        $tools = '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=editcategory&id='.$categoryId.'&category_id='.$categoryId.'" title='.get_lang('Modify').'">'.
1072 1072
             Display:: return_icon(
1073 1073
                 'edit.png',
1074 1074
                 get_lang('Modify'),
1075 1075
                 array(),
1076 1076
                 ICON_SIZE_SMALL
1077
-            ) . '</a>';
1077
+            ).'</a>';
1078 1078
 
1079 1079
         // DISPLAY MOVE UP COMMAND only if it is not the top link.
1080 1080
         if ($currentCategory != 0) {
1081
-            $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&sec_token=' . $token . '&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'.
1081
+            $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=up&up='.$categoryId.'&category_id='.$categoryId.'" title="'.get_lang('Up').'">'.
1082 1082
                 Display:: return_icon(
1083 1083
                     'up.png',
1084 1084
                     get_lang('Up'),
1085 1085
                     array(),
1086 1086
                     ICON_SIZE_SMALL
1087
-                ) . '</a>';
1087
+                ).'</a>';
1088 1088
         } else {
1089 1089
             $tools .= Display:: return_icon(
1090 1090
                 'up_na.png',
1091 1091
                 get_lang('Up'),
1092 1092
                 array(),
1093 1093
                 ICON_SIZE_SMALL
1094
-            ) . '</a>';
1094
+            ).'</a>';
1095 1095
         }
1096 1096
 
1097 1097
         // DISPLAY MOVE DOWN COMMAND only if it is not the bottom link.
1098
-        if ($currentCategory < $countCategories-1) {
1099
-            $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=down&down=' . $categoryId .'&category_id=' . $categoryId . '">'.
1098
+        if ($currentCategory < $countCategories - 1) {
1099
+            $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=down&down='.$categoryId.'&category_id='.$categoryId.'">'.
1100 1100
                 Display:: return_icon(
1101 1101
                     'down.png',
1102 1102
                     get_lang('Down'),
1103 1103
                     array(),
1104 1104
                     ICON_SIZE_SMALL
1105
-                ) . '</a>';
1105
+                ).'</a>';
1106 1106
         } else {
1107 1107
             $tools .= Display:: return_icon(
1108 1108
                     'down_na.png',
1109 1109
                     get_lang('Down'),
1110 1110
                     array(),
1111 1111
                     ICON_SIZE_SMALL
1112
-                ) . '</a>';
1112
+                ).'</a>';
1113 1113
         }
1114 1114
 
1115
-        $tools .= '<a href="' . api_get_self() . '?' . api_get_cidreq() .'&sec_token=' . $token .'&action=deletecategory&id='.$categoryId.            "&category_id=$categoryId\"
1116
-            onclick=\"javascript: if(!confirm('" . get_lang('CategoryDelconfirm') . "')) return false;\">".
1115
+        $tools .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&sec_token='.$token.'&action=deletecategory&id='.$categoryId."&category_id=$categoryId\"
1116
+            onclick=\"javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;\">".
1117 1117
             Display:: return_icon(
1118 1118
                 'delete.png',
1119 1119
                 get_lang('Delete'),
1120 1120
                 array(),
1121 1121
                 ICON_SIZE_SMALL
1122
-            ) . '</a>';
1122
+            ).'</a>';
1123 1123
 
1124 1124
         return $tools;
1125 1125
     }
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
             $movetable = $tbl_link;
1167 1167
             // Getting the category of the link.
1168 1168
             if (!empty ($thiscatlinkId)) {
1169
-                $sql = "SELECT category_id FROM " . $movetable . "
1169
+                $sql = "SELECT category_id FROM ".$movetable."
1170 1170
                         WHERE c_id = $courseId AND id='$thiscatlinkId'";
1171 1171
                 $result = Database:: query($sql);
1172 1172
                 $catid = Database:: fetch_array($result);
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
                         ORDER BY display_order $sortDirection";
1187 1187
             } else {
1188 1188
                 $sql = "SELECT id, display_order FROM  $movetable
1189
-                        WHERE c_id = $courseId AND category_id='" . $catid[0] . "'
1189
+                        WHERE c_id = $courseId AND category_id='".$catid[0]."'
1190 1190
                         ORDER BY display_order $sortDirection";
1191 1191
             }
1192 1192
             $linkresult = Database:: query($sql);
@@ -1200,12 +1200,12 @@  discard block
 block discarded – undo
1200 1200
                     $nextlinkOrder = $sortrow['display_order'];
1201 1201
 
1202 1202
                     Database:: query(
1203
-                        "UPDATE " . $movetable . "
1203
+                        "UPDATE ".$movetable."
1204 1204
                         SET display_order = '$nextlinkOrder'
1205 1205
                         WHERE c_id = $courseId  AND id =  '$thiscatlinkId'"
1206 1206
                     );
1207 1207
                     Database:: query(
1208
-                        "UPDATE " . $movetable . "
1208
+                        "UPDATE ".$movetable."
1209 1209
                         SET display_order = '$thislinkOrder'
1210 1210
                         WHERE c_id = $courseId  AND id =  '$nextlinkId'"
1211 1211
                     );
@@ -1233,10 +1233,10 @@  discard block
 block discarded – undo
1233 1233
         $course_id = api_get_course_int_id();
1234 1234
 
1235 1235
         $result = Database:: query(
1236
-            "SELECT id FROM " . $tbl_categories . "
1237
-            WHERE c_id = $course_id AND category_title='" . Database::escape_string(
1236
+            "SELECT id FROM ".$tbl_categories."
1237
+            WHERE c_id = $course_id AND category_title='".Database::escape_string(
1238 1238
                 $catname
1239
-            ) . "'"
1239
+            )."'"
1240 1240
         );
1241 1241
         if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array(
1242 1242
                 $result
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
         }
1247 1247
 
1248 1248
         $result = Database:: query(
1249
-            "SELECT MAX(display_order) FROM " . $tbl_categories . " WHERE c_id = $course_id "
1249
+            "SELECT MAX(display_order) FROM ".$tbl_categories." WHERE c_id = $course_id "
1250 1250
         );
1251 1251
         list ($max_order) = Database:: fetch_row($result);
1252 1252
 
@@ -1273,12 +1273,12 @@  discard block
 block discarded – undo
1273 1273
         $tbl_link = Database:: get_course_table(TABLE_LINK);
1274 1274
         $course_id = api_get_course_int_id();
1275 1275
 
1276
-        $urleq = "url='" . Database:: escape_string($url) . "'";
1277
-        $cateq = "category_id=" . intval($cat);
1276
+        $urleq = "url='".Database:: escape_string($url)."'";
1277
+        $cateq = "category_id=".intval($cat);
1278 1278
 
1279 1279
         $result = Database:: query("
1280 1280
             SELECT id FROM $tbl_link
1281
-            WHERE c_id = $course_id AND " . $urleq . ' AND ' . $cateq
1281
+            WHERE c_id = $course_id AND ".$urleq.' AND '.$cateq
1282 1282
         );
1283 1283
 
1284 1284
         if (Database:: num_rows($result) >= 1 && ($row = Database:: fetch_array(
@@ -1286,14 +1286,14 @@  discard block
 block discarded – undo
1286 1286
             ))
1287 1287
         ) {
1288 1288
             Database:: query(
1289
-                "UPDATE $tbl_link set title='" . Database:: escape_string(
1289
+                "UPDATE $tbl_link set title='".Database:: escape_string(
1290 1290
                     $title
1291
-                ) . "', description='" . Database:: escape_string(
1291
+                )."', description='".Database:: escape_string(
1292 1292
                     $description
1293
-                ) . "'
1294
-                WHERE c_id = $course_id AND  id='" . Database:: escape_string(
1293
+                )."'
1294
+                WHERE c_id = $course_id AND  id='".Database:: escape_string(
1295 1295
                     $row['id']
1296
-                ) . "'"
1296
+                )."'"
1297 1297
             );
1298 1298
 
1299 1299
             $ipu = 'LinkUpdated';
@@ -1302,18 +1302,18 @@  discard block
 block discarded – undo
1302 1302
             // Add new link
1303 1303
             $result = Database:: query(
1304 1304
                 "SELECT MAX(display_order) FROM  $tbl_link
1305
-                WHERE c_id = $course_id AND category_id='" . intval($cat) . "'"
1305
+                WHERE c_id = $course_id AND category_id='".intval($cat)."'"
1306 1306
             );
1307 1307
             list ($max_order) = Database:: fetch_row($result);
1308 1308
 
1309 1309
             Database:: query(
1310 1310
                 "INSERT INTO $tbl_link (c_id, url, title, description, category_id, display_order, on_homepage)
1311
-                VALUES (" . api_get_course_int_id() . ",
1312
-                '" . Database:: escape_string($url) . "',
1313
-                '" . Database:: escape_string($title) . "',
1314
-                '" . Database:: escape_string($description) . "',
1315
-                '" . intval($cat) . "','" . (intval($max_order) + 1) . "',
1316
-                '" . intval($on_homepage) .
1311
+                VALUES (".api_get_course_int_id().",
1312
+                '" . Database:: escape_string($url)."',
1313
+                '" . Database:: escape_string($title)."',
1314
+                '" . Database:: escape_string($description)."',
1315
+                '" . intval($cat)."','".(intval($max_order) + 1)."',
1316
+                '" . intval($on_homepage).
1317 1317
                 "')"
1318 1318
             );
1319 1319
 
@@ -1391,30 +1391,30 @@  discard block
 block discarded – undo
1391 1391
                     )
1392 1392
                 ) { // possibly in <...>
1393 1393
                     if (($kwlist = trim($regs[1])) != '') {
1394
-                        $kw = '<i kw="' . htmlspecialchars($kwlist) . '">';
1394
+                        $kw = '<i kw="'.htmlspecialchars($kwlist).'">';
1395 1395
                     } else {
1396 1396
                         $kw = '';
1397 1397
                     }
1398 1398
                     // i.e. assume only one of the $hide_fields will be present
1399 1399
                     // and if found, hide the value as expando property of an <i> tag
1400 1400
                 } elseif (trim($value)) {
1401
-                    $d .= ', ' . $key . ':' . $value;
1401
+                    $d .= ', '.$key.':'.$value;
1402 1402
                 }
1403 1403
             }
1404 1404
         }
1405 1405
         if (!empty($d)) {
1406
-            $d = substr($d, 2) . ' - ';
1406
+            $d = substr($d, 2).' - ';
1407 1407
         }
1408 1408
 
1409 1409
         return Link::put_link(
1410 1410
             $url,
1411 1411
             $cat,
1412 1412
             $title,
1413
-            $kw . ereg_replace(
1413
+            $kw.ereg_replace(
1414 1414
                 '\[((/?(b|big|i|small|sub|sup|u))|br/)\]',
1415 1415
                 '<\\1>',
1416
-                htmlspecialchars($d . $linkdata['description'])
1417
-            ) . ($kw ? '</i>' : ''),
1416
+                htmlspecialchars($d.$linkdata['description'])
1417
+            ).($kw ? '</i>' : ''),
1418 1418
             $linkdata['on_homepage'] ? '1' : '0',
1419 1419
             $linkdata['hidden'] ? '1' : '0'
1420 1420
         );
@@ -1535,19 +1535,19 @@  discard block
 block discarded – undo
1535 1535
         echo '<div class="actions">';
1536 1536
         if (api_is_allowed_to_edit(null, true)) {
1537 1537
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addlink&category_id='.$categoryId.'">'.
1538
-                Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
1538
+                Display::return_icon('new_link.png', get_lang('LinkAdd'), '', ICON_SIZE_MEDIUM).'</a>';
1539 1539
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addcategory&category_id='.$categoryId.'">'.
1540
-                Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';
1540
+                Display::return_icon('new_folder.png', get_lang('CategoryAdd'), '', ICON_SIZE_MEDIUM).'</a>';
1541 1541
         }
1542 1542
 
1543 1543
         $categories = Link::getLinkCategories($course_id, $session_id);
1544 1544
         $count = count($categories);
1545 1545
         if (!empty($count)) {
1546 1546
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=none">';
1547
-            echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . ' </a>';
1547
+            echo Display::return_icon('forum_listview.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).' </a>';
1548 1548
 
1549 1549
             echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=list&show=all">';
1550
-            echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM) . '</a>';
1550
+            echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM).'</a>';
1551 1551
         }
1552 1552
         echo '</div>';
1553 1553
 
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
             $strVisibility = '';
1580 1580
             $visibilityClass = null;
1581 1581
             if ($myrow['visibility'] == '1') {
1582
-                $strVisibility =  '<a href="link.php?' . api_get_cidreq() .  '&sec_token='.$token.'&action=invisible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Hide') . '">' .
1583
-                    Display :: return_icon('visible.png', get_lang('Hide'), array (), ICON_SIZE_SMALL) . '</a>';
1582
+                $strVisibility = '<a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Hide').'">'.
1583
+                    Display :: return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL).'</a>';
1584 1584
             } elseif ($myrow['visibility'] == '0') {
1585 1585
                 $visibilityClass = 'invisible';
1586
-                $strVisibility =  ' <a href="link.php?' . api_get_cidreq() .  '&sec_token='.$token.'&action=visible&id=' . $myrow['id'] . '&scope=' . TOOL_LINK_CATEGORY . '" title="' . get_lang('Show') . '">' .
1587
-                    Display :: return_icon('invisible.png', get_lang('Show'), array (), ICON_SIZE_SMALL) . '</a>';
1586
+                $strVisibility = ' <a href="link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY.'" title="'.get_lang('Show').'">'.
1587
+                    Display :: return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL).'</a>';
1588 1588
             }
1589 1589
 
1590 1590
             $header = '';
Please login to merge, or discard this patch.
main/inc/lib/add_many_session_to_category_functions.lib.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
      * @assert () !== ''
22 22
      * @assert ('abc','single') !== ''
23 23
      */
24
-    function search_courses($needle,$type)
24
+    function search_courses($needle, $type)
25 25
     {
26 26
         $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
27 27
 		$xajax_response = new xajaxResponse();
28 28
 		$return = '';
29
-		if(!empty($needle) && !empty($type)) {
29
+		if (!empty($needle) && !empty($type)) {
30 30
 			// xajax send utf8 datas... datas in db can be non-utf8 datas
31 31
 			$charset = api_get_system_encoding();
32 32
 			$needle = api_convert_encoding($needle, $charset, 'utf-8');
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 			$course_list = array();
39 39
 
40 40
 			$return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
41
-			while($course = Database :: fetch_array($rs)) {
41
+			while ($course = Database :: fetch_array($rs)) {
42 42
 				$course_list[] = $course['id'];
43
-				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>';
43
+				$return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'], ENT_QUOTES).'">'.$course['name'].'</option>';
44 44
 			}
45 45
 			$return .= '</select>';
46
-			$xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return));
46
+			$xajax_response -> addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
47 47
 		}
48 48
 		$_SESSION['course_list'] = $course_list;
49 49
 		return $xajax_response;
Please login to merge, or discard this patch.
main/inc/lib/statistics.lib.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
         $course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER);
105 105
         $course_table = Database:: get_main_table(TABLE_MAIN_COURSE);
106 106
         $user_table = Database:: get_main_table(TABLE_MAIN_USER);
107
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
107
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
108 108
         $current_url_id = api_get_current_access_url_id();
109
-        $active_filter = $onlyActive?' AND active=1':'';
110
-        $status_filter = isset($status)?' AND status = '.intval($status):'';
109
+        $active_filter = $onlyActive ? ' AND active=1' : '';
110
+        $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
111 111
 
112 112
         if (api_is_multiple_url_enabled()) {
113 113
             $sql = "SELECT COUNT(DISTINCT(u.user_id)) AS number
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
                     FROM $user_table
132 132
                     WHERE 1=1 $status_filter $active_filter";
133 133
             if (isset ($categoryCode)) {
134
-                $status_filter = isset($status)?' AND status = '.intval($status):'';
134
+                $status_filter = isset($status) ? ' AND status = '.intval($status) : '';
135 135
                 $sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
136 136
                         FROM $course_user_table cu, $course_table c
137 137
                         WHERE
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public static function countSessions()
157 157
     {
158 158
         $session_table = Database :: get_main_table(TABLE_MAIN_SESSION);
159
-        $access_url_rel_session_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
159
+        $access_url_rel_session_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
160 160
         if (api_is_multiple_url_enabled()) {
161 161
             $current_url_id = api_get_current_access_url_id();
162 162
             $sql = "SELECT COUNT(id) AS number
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
     public static function getNumberOfActivities()
180 180
     {
181 181
         // Database table definitions
182
-        $track_e_default  = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
182
+        $track_e_default = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
183 183
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
184
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
184
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
185 185
         $current_url_id = api_get_current_access_url_id();
186 186
         if (api_is_multiple_url_enabled()) {
187 187
             $sql = "SELECT count(default_id) AS total_number_of_items
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         $from = intval($from);
226 226
         $numberOfItems = intval($numberOfItems);
227 227
 
228
-        if (!in_array($direction, array('ASC','DESC'))) {
228
+        if (!in_array($direction, array('ASC', 'DESC'))) {
229 229
             $direction = 'DESC';
230 230
         }
231 231
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $sql .= " LIMIT $from,$numberOfItems ";
277 277
 
278 278
         $res = Database::query($sql);
279
-        $activities = array ();
279
+        $activities = array();
280 280
         while ($row = Database::fetch_row($res)) {
281 281
 
282 282
             if (strpos($row[1], '_object') === false && strpos($row[1], '_array') === false) {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $sql = "SELECT code, name FROM $categoryTable
344 344
                 ORDER BY tree_pos";
345 345
         $res = Database::query($sql);
346
-        $categories = array ();
346
+        $categories = array();
347 347
         while ($category = Database::fetch_object($res)) {
348 348
             $categories[$category->code] = $category->name;
349 349
         }
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
             $data_max = ($data_max < $value ? $value : $data_max);
365 365
         }
366 366
         reset($data);
367
-        $result = array ();
367
+        $result = array();
368 368
         $delta = $max / $data_max;
369 369
         foreach ($data as $index => $value) {
370 370
             $result[$index] = (int) round($value * $delta);
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
             } else {
399 399
                 $number_label = Statistics::makeSizeString($number);
400 400
             }
401
-            $percentage = ($total>0?number_format(100*$number/$total, 1, ',', '.'):'0');
401
+            $percentage = ($total > 0 ? number_format(100 * $number / $total, 1, ',', '.') : '0');
402 402
 
403
-            echo '<tr class="row_'.($i%2 == 0 ? 'odd' : 'even').'">
403
+            echo '<tr class="row_'.($i % 2 == 0 ? 'odd' : 'even').'">
404 404
                     <td width="150">'.$subtitle.'</td>
405 405
                     <td width="550">'.Display::bar_progress($percentage, false).'</td>
406 406
                     <td align="right">'.$number_label.'</td>';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
                 echo '<td align="right"> '.$percentage.'%</td>';
409 409
             }
410 410
             echo '</tr>';
411
-            $i ++;
411
+            $i++;
412 412
         }
413 413
         if ($showTotal) {
414 414
             if (!$isFileSize) {
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
     public static function printLoginStats($type)
429 429
     {
430 430
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
431
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
431
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
432 432
         $current_url_id = api_get_current_access_url_id();
433 433
 
434 434
         $table_url = null;
435 435
         $where_url = null;
436 436
         $now = api_get_utc_datetime();
437
-        $where_url_last = ' WHERE login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
437
+        $where_url_last = ' WHERE login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
438 438
         if (api_is_multiple_url_enabled()) {
439 439
             $table_url = ", $access_url_rel_user_table";
440 440
             $where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
441
-            $where_url_last = ' AND login_date > DATE_SUB("' . $now . '",INTERVAL 1 %s)';
441
+            $where_url_last = ' AND login_date > DATE_SUB("'.$now.'",INTERVAL 1 %s)';
442 442
         }
443 443
 
444 444
         $period = get_lang('PeriodMonth');
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
             case 'hour':
454 454
                 $period = get_lang('PeriodHour');
455 455
                 $sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
456
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
456
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'DAY')." GROUP BY stat_date ORDER BY stat_date ";
457 457
                 break;
458 458
             case 'day':
459 459
                 $periodCollection = api_get_week_days_long();
460 460
                 $period = get_lang('PeriodDay');
461 461
                 $sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
-                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
462
+                $sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last, 'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
463 463
                 break;
464 464
         }
465 465
         if ($sql_last_x) {
@@ -501,14 +501,14 @@  discard block
 block discarded – undo
501 501
     {
502 502
         $totalLogin = array();
503 503
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
504
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
504
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
505 505
         $current_url_id = api_get_current_access_url_id();
506 506
         if (api_is_multiple_url_enabled()) {
507 507
             $table_url = ", $access_url_rel_user_table";
508 508
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
509 509
         } else {
510 510
             $table_url = '';
511
-            $where_url='';
511
+            $where_url = '';
512 512
         }
513 513
         $now = api_get_utc_datetime();
514 514
         $field = 'login_user_id';
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $totalLogin = [];
542 542
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
543
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
543
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
544 544
         $current_url_id = api_get_current_access_url_id();
545 545
         if (api_is_multiple_url_enabled()) {
546 546
             $table_url = ", $access_url_rel_user_table";
547 547
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
548 548
         } else {
549 549
             $table_url = '';
550
-            $where_url='';
550
+            $where_url = '';
551 551
         }
552 552
         $now = api_get_utc_datetime();
553 553
         $field = 'login_user_id';
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
         $sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)";
558 558
         
559 559
         $res = Database::query($sql);
560
-        while($row = Database::fetch_array($res,'ASSOC')){
560
+        while ($row = Database::fetch_array($res, 'ASSOC')) {
561 561
             $totalLogin[$row['login_date']] = $row['number'];
562 562
         }
563 563
         
@@ -652,13 +652,13 @@  discard block
 block discarded – undo
652 652
     public static function printUserPicturesStats()
653 653
     {
654 654
         $user_table = Database :: get_main_table(TABLE_MAIN_USER);
655
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
655
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
656 656
         $current_url_id = api_get_current_access_url_id();
657 657
         $url_condition = null;
658 658
         $url_condition2 = null;
659 659
         $table = null;
660 660
         if (api_is_multiple_url_enabled()) {
661
-            $url_condition =  ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
661
+            $url_condition = ", $access_url_rel_user_table as url WHERE url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
662 662
             $url_condition2 = " AND url.user_id=u.user_id AND access_url_id='".$current_url_id."'";
663 663
             $table = ", $access_url_rel_user_table as url ";
664 664
         }
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             'width=200px',
691 691
             false
692 692
         );
693
-        $renderer =& $form->defaultRenderer();
693
+        $renderer = & $form->defaultRenderer();
694 694
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
695 695
         $form->addElement('hidden', 'report', 'activities');
696 696
         $form->addElement('hidden', 'activities_direction', 'DESC');
@@ -740,10 +740,10 @@  discard block
 block discarded – undo
740 740
         $columns[1] = 'access_date';
741 741
         $sql_order[SORT_ASC] = 'ASC';
742 742
         $sql_order[SORT_DESC] = 'DESC';
743
-        $per_page = isset($_GET['per_page'])?intval($_GET['per_page']) : 10;
744
-        $page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
745
-        $column = isset($_GET['column'])?intval($_GET['column']) : 0;
746
-        $date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
743
+        $per_page = isset($_GET['per_page']) ? intval($_GET['per_page']) : 10;
744
+        $page_nr = isset($_GET['page_nr']) ? intval($_GET['page_nr']) : 1;
745
+        $column = isset($_GET['column']) ? intval($_GET['column']) : 0;
746
+        $date_diff = isset($_GET['date_diff']) ? intval($_GET['date_diff']) : 60;
747 747
 
748 748
         $direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
749 749
 
@@ -772,25 +772,25 @@  discard block
 block discarded – undo
772 772
                         access_url_id='".$current_url_id."'
773 773
                    GROUP BY c_id
774 774
                    HAVING c_id <> ''
775
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
775
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
776 776
         } else {
777 777
             $sql = "SELECT * FROM $table
778 778
                    GROUP BY c_id
779 779
                    HAVING c_id <> ''
780
-                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ". $date_diff;
780
+                   AND DATEDIFF( '".date('Y-m-d h:i:s')."' , access_date ) <= ".$date_diff;
781 781
         }
782 782
         $sql .= ' ORDER BY '.$columns[$column].' '.$sql_order[$direction];
783
-        $from = ($page_nr -1) * $per_page;
783
+        $from = ($page_nr - 1) * $per_page;
784 784
         $sql .= ' LIMIT '.$from.','.$per_page;
785 785
 
786 786
         echo '<p>'.get_lang('LastAccess').' &gt;= '.$date_diff.' '.get_lang('Days').'</p>';
787 787
         $res = Database::query($sql);
788 788
         if (Database::num_rows($res) > 0) {
789
-            $courses = array ();
789
+            $courses = array();
790 790
             while ($obj = Database::fetch_object($res)) {
791 791
                 $courseInfo = api_get_course_info_by_id($obj->c_id);
792
-                $course = array ();
793
-                $course[]= '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
792
+                $course = array();
793
+                $course[] = '<a href="'.api_get_path(WEB_COURSE_PATH).$courseInfo['code'].'">'.$courseInfo['code'].' <a>';
794 794
                 // Allow sort by date hiding the numerical date
795 795
                 $course[] = '<span style="display:none;">'.$obj->access_date.'</span>'.api_convert_and_format_date($obj->access_date);
796 796
                 $courses[] = $course;
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
     {
864 864
         $user_friend_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
865 865
         $user_table = Database::get_main_table(TABLE_MAIN_USER);
866
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
866
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
867 867
         $current_url_id = api_get_current_access_url_id();
868 868
 
869 869
         if (api_is_multiple_url_enabled()) {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
     {
896 896
         $totalLogin = array();
897 897
         $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
898
-        $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
898
+        $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
899 899
         $current_url_id = api_get_current_access_url_id();
900 900
         $total = self::countUsers();
901 901
         if (api_is_multiple_url_enabled()) {
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
             $where_url = " AND login_user_id=user_id AND access_url_id='".$current_url_id."'";
904 904
         } else {
905 905
             $table_url = '';
906
-            $where_url='';
906
+            $where_url = '';
907 907
         }
908 908
         $now = api_get_utc_datetime();
909
-        $sql[get_lang('ThisDay')]    =
909
+        $sql[get_lang('ThisDay')] =
910 910
             "SELECT count(distinct(login_user_id)) AS number ".
911 911
             " FROM $table $table_url ".
912 912
             " WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url";
913
-        $sql[get_lang('Last7days')]  =
913
+        $sql[get_lang('Last7days')] =
914 914
             "SELECT count(distinct(login_user_id)) AS number ".
915 915
             " FROM $table $table_url ".
916 916
             " WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url";
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
             "SELECT count(distinct(login_user_id)) AS number ".
923 923
             " FROM $table $table_url ".
924 924
             " WHERE DATE_ADD(login_date, INTERVAL 6 MONTH) >= '$now' $where_url";
925
-        $sql[get_lang('NeverConnected')]      =
925
+        $sql[get_lang('NeverConnected')] =
926 926
             "SELECT count(distinct(login_user_id)) AS number ".
927 927
             " FROM $table $table_url WHERE 1=1 $where_url";
928 928
         foreach ($sql as $index => $query) {
Please login to merge, or discard this patch.