Completed
Pull Request — 1.11.x (#1262)
by José
41:21
created
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.
main/inc/lib/javascript/chat/video.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 $idUserLocal = api_get_user_id();
35 35
 $userLocal = api_get_user_info($idUserLocal, true);
36 36
 $htmlHeadXtra[] = '<script type="text/javascript" src="'
37
-    . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js'
38
-    . '"></script>' . "\n";
37
+    . api_get_path(WEB_PATH).'web/assets/SimpleWebRTC/latest.js'
38
+    . '"></script>'."\n";
39 39
 
40 40
 $template = new Template();
41 41
 $template->assign('room_name', $chatVideo->getRoomName());
Please login to merge, or discard this patch.
main/inc/lib/thematic.lib.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $from = intval($from);
75 75
         $number_of_items = intval($number_of_items);
76 76
 
77
-        if (!in_array($direction, array('ASC','DESC'))) {
77
+        if (!in_array($direction, array('ASC', 'DESC'))) {
78 78
             $direction = 'ASC';
79 79
         }
80 80
 
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
             $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'.
98 98
                 Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>';
99 99
             if (api_is_allowed_to_edit(null, true)) {
100
-                $actions  = '';
100
+                $actions = '';
101 101
 
102 102
                 if (api_get_session_id()) {
103 103
                     if (api_get_session_id() == $thematic[3]) {
104 104
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
105
-                            Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
105
+                            Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
106 106
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
107
-                            Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
107
+                            Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
108 108
 
109 109
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
110
-                            Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
110
+                            Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
111 111
                         $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
112
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
112
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
113 113
                     } else {
114
-                        $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'&nbsp;';
115
-                        $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'&nbsp;';
116
-                        $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL);
117
-                        $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'&nbsp;';
114
+                        $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'&nbsp;';
115
+                        $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'&nbsp;';
116
+                        $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL);
117
+                        $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'&nbsp;';
118 118
                         $actions .= Display::url(
119 119
                             Display::return_icon('cd.gif', get_lang('Copy')),
120 120
                             'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0]
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
                     }
123 123
                 } else {
124 124
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
125
-                        Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
125
+                        Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
126 126
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
127
-                        Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
127
+                        Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
128 128
 
129 129
                     if ($thematic[2] > 1) {
130 130
                         $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
131
-                            Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>';
131
+                            Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>';
132 132
                     } else {
133
-                        $actions .= Display::return_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
133
+                        $actions .= Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
134 134
                     }
135 135
                     if ($thematic[2] < self::get_max_thematic_item()) {
136 136
                         $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
137
-                            Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>';
137
+                            Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>';
138 138
                     } else {
139
-                        $actions .= Display::return_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
139
+                        $actions .= Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
140 140
                     }
141 141
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
142
-                        Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
142
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
143 143
                     $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
144
-                        Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
144
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
145 145
                 }
146 146
                 $thematics[] = array($thematic[0], $thematic[1], $actions);
147 147
             }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
         $res = Database::query($sql);
279 279
         if (Database::num_rows($res) > 0) {
280 280
             if (!empty($thematic_id)) {
281
-                $data = Database::fetch_array($res,'ASSOC');
281
+                $data = Database::fetch_array($res, 'ASSOC');
282 282
             } else {
283
-                while ($row = Database::fetch_array($res,'ASSOC')) {
283
+                while ($row = Database::fetch_array($res, 'ASSOC')) {
284 284
                     $data[$row['id']] = $row;
285 285
                 }
286 286
             }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         if (is_array($thematic_id)) {
377 377
             foreach ($thematic_id as $id) {
378
-                $id	= intval($id);
378
+                $id = intval($id);
379 379
                 $sql = "UPDATE $tbl_thematic SET active = 0
380 380
                         WHERE c_id = $course_id AND id = $id";
381 381
                 $result = Database::query($sql);
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
                     );
392 392
                 }
393 393
             }
394
-        } else  {
395
-            $thematic_id	= intval($thematic_id);
394
+        } else {
395
+            $thematic_id = intval($thematic_id);
396 396
             $sql = "UPDATE $tbl_thematic SET active = 0
397 397
                     WHERE c_id = $course_id AND id = $thematic_id";
398 398
             $result = Database::query($sql);
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
         $new_thematic_id = $thematic_copy->thematic_save();
429 429
         if (!empty($new_thematic_id)) {
430 430
             $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id);
431
-            if(!empty($thematic_advanced)) {
432
-                foreach($thematic_advanced as $item) {
431
+            if (!empty($thematic_advanced)) {
432
+                foreach ($thematic_advanced as $item) {
433 433
                     $thematic = new Thematic();
434 434
                     $thematic->set_thematic_advance_attributes(
435 435
                         0,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         $column = intval($column);
493 493
         $from   = intval($from);
494 494
         $number_of_items = intval($number_of_items);
495
-        if (!in_array($direction, array('ASC','DESC'))) {
495
+        if (!in_array($direction, array('ASC', 'DESC'))) {
496 496
             $direction = 'ASC';
497 497
         }
498 498
         $data = array();
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
                     $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
526 526
                     $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
527 527
                     $actions  = '';
528
-                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
529
-                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
528
+                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
529
+                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
530 530
                     $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
531 531
                     $i++;
532 532
                 }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
                 $session_star = '';
592 592
                 if (api_is_allowed_to_edit(null, true)) {
593
-                    if ($thematic_advance['session_id'] !=0) {
593
+                    if ($thematic_advance['session_id'] != 0) {
594 594
                         $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
595 595
                     }
596 596
                 }
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 
617 617
         foreach ($data as $thematic_id => $thematic_plan_data) {
618 618
             $new_thematic_plan_data = array();
619
-            foreach($thematic_plan_data as $thematic_item) {
619
+            foreach ($thematic_plan_data as $thematic_item) {
620 620
                 $thematic_simple_list[] = $thematic_item['description_type'];
621 621
                 $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
622 622
             }
623 623
 
624 624
             if (!empty($thematic_simple_list)) {
625
-                foreach($thematic_simple_list as $item) {
625
+                foreach ($thematic_simple_list as $item) {
626 626
                     $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
627 627
                 }
628 628
             }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                     }
639 639
                     if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) {
640 640
                         if (api_is_allowed_to_edit(null, true)) {
641
-                            if ($data[$thematic_id][$id]['session_id'] !=0) {
641
+                            if ($data[$thematic_id][$id]['session_id'] != 0) {
642 642
                                 $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
643 643
                             }
644 644
                         }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
             if ($no_data) {
652 652
                 $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>';
653 653
             }
654
-            $return  .= '</div>';
654
+            $return .= '</div>';
655 655
             $final_return[$thematic_id] = $return;
656 656
         }
657 657
         return $final_return;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 api_get_session_id()
692 692
             );
693 693
             foreach ($list as $value) {
694
-                $elements[$value['ref']]= $value;
694
+                $elements[$value['ref']] = $value;
695 695
             }
696 696
         }
697 697
 
@@ -865,18 +865,18 @@  discard block
 block discarded – undo
865 865
             api_get_session_id()
866 866
         );
867 867
 
868
-        $thematic_plan_complete_list  = array();
868
+        $thematic_plan_complete_list = array();
869 869
         $thematic_plan_id_list = array();
870 870
 
871 871
         if (!empty($items_from_course)) {
872
-            foreach($items_from_course as $item) {
872
+            foreach ($items_from_course as $item) {
873 873
                 $thematic_plan_id_list[] = $item['ref'];
874 874
                 $thematic_plan_complete_list[$item['ref']] = $item;
875 875
             }
876 876
         }
877 877
 
878 878
         if (!empty($items_from_session)) {
879
-            foreach($items_from_session as $item) {
879
+            foreach ($items_from_session as $item) {
880 880
                 $thematic_plan_id_list[] = $item['ref'];
881 881
                 $thematic_plan_complete_list[$item['ref']] = $item;
882 882
             }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 if (!isset($thematic_id) && !isset($description_type)) {
899 899
                     // group all data group by thematic id
900 900
                     $tmp = array();
901
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
901
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
902 902
                         $tmp[] = $row['thematic_id'];
903 903
                         if (in_array($row['thematic_id'], $tmp)) {
904 904
                             $row['session_id'] = $thematic_plan_complete_list[$row['id']];
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         }
907 907
                     }
908 908
                 } else {
909
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
909
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
910 910
                         $row['session_id'] = $thematic_plan_complete_list[$row['id']];
911 911
                         $data[] = $row;
912 912
                     }
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
         );
942 942
 
943 943
         $elements_to_show = array();
944
-        foreach($list as $value) {
945
-            $elements_to_show[]= $value['ref'];
944
+        foreach ($list as $value) {
945
+            $elements_to_show[] = $value['ref'];
946 946
         }
947 947
         $condition = '';
948 948
         if (!empty($elements_to_show)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     c_id = $course_id AND
955 955
                     thematic_id = $thematic_id AND
956 956
                     description_type = '$description_type'";
957
-        $rs	 = Database::query($sql);
957
+        $rs = Database::query($sql);
958 958
 
959 959
         $affected_rows = 0;
960 960
         if (Database::num_rows($rs) > 0) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
             $diff = array_diff($all, $a_thematic_advance_ids);
1191 1191
             if (!empty($diff)) {
1192 1192
                 $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0
1193
-    			        WHERE c_id = $course_id AND id IN(".implode(',',$diff).") ";
1193
+    			        WHERE c_id = $course_id AND id IN(".implode(',', $diff).") ";
1194 1194
                 Database::query($upd);
1195 1195
             }
1196 1196
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
             $course_code = api_get_course_id();
1305 1305
         }
1306 1306
         if (api_get_session_id()) {
1307
-            $thematic_data = $this->get_thematic_list(null, $course_code );
1307
+            $thematic_data = $this->get_thematic_list(null, $course_code);
1308 1308
         } else {
1309 1309
             $thematic_data = $this->get_thematic_list(null, $course_code, 0);
1310 1310
         }
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             }
1357 1357
             // calculate average by thematic
1358 1358
             $count_total_advances = count($advances);
1359
-            $average = round(($count_done_advances*100)/$count_total_advances);
1359
+            $average = round(($count_done_advances * 100) / $count_total_advances);
1360 1360
         }
1361 1361
 
1362 1362
         return $average;
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
     public function get_default_thematic_plan_title()
1448 1448
     {
1449 1449
         $default_thematic_plan_titles = array();
1450
-        $default_thematic_plan_titles[1]= get_lang('Objectives');
1451
-        $default_thematic_plan_titles[2]= get_lang('SkillToAcquire');
1452
-        $default_thematic_plan_titles[3]= get_lang('Methodology');
1453
-        $default_thematic_plan_titles[4]= get_lang('Infrastructure');
1454
-        $default_thematic_plan_titles[5]= get_lang('Assessment');
1455
-        $default_thematic_plan_titles[6]= get_lang('Others');
1450
+        $default_thematic_plan_titles[1] = get_lang('Objectives');
1451
+        $default_thematic_plan_titles[2] = get_lang('SkillToAcquire');
1452
+        $default_thematic_plan_titles[3] = get_lang('Methodology');
1453
+        $default_thematic_plan_titles[4] = get_lang('Infrastructure');
1454
+        $default_thematic_plan_titles[5] = get_lang('Assessment');
1455
+        $default_thematic_plan_titles[6] = get_lang('Others');
1456 1456
 
1457 1457
         return $default_thematic_plan_titles;
1458 1458
     }
@@ -1464,12 +1464,12 @@  discard block
 block discarded – undo
1464 1464
     public function get_default_thematic_plan_icon()
1465 1465
     {
1466 1466
         $default_thematic_plan_icon = array();
1467
-        $default_thematic_plan_icon[1]= 'icons/32/objective.png';
1468
-        $default_thematic_plan_icon[2]= 'icons/32/skills.png';
1469
-        $default_thematic_plan_icon[3]= 'icons/32/strategy.png';
1470
-        $default_thematic_plan_icon[4]= 'icons/32/laptop.png';
1471
-        $default_thematic_plan_icon[5]= 'icons/32/assessment.png';
1472
-        $default_thematic_plan_icon[6]= 'icons/32/wizard.png';
1467
+        $default_thematic_plan_icon[1] = 'icons/32/objective.png';
1468
+        $default_thematic_plan_icon[2] = 'icons/32/skills.png';
1469
+        $default_thematic_plan_icon[3] = 'icons/32/strategy.png';
1470
+        $default_thematic_plan_icon[4] = 'icons/32/laptop.png';
1471
+        $default_thematic_plan_icon[5] = 'icons/32/assessment.png';
1472
+        $default_thematic_plan_icon[6] = 'icons/32/wizard.png';
1473 1473
 
1474 1474
         return $default_thematic_plan_icon;
1475 1475
     }
@@ -1481,11 +1481,11 @@  discard block
 block discarded – undo
1481 1481
     public function get_default_question()
1482 1482
     {
1483 1483
         $question = array();
1484
-        $question[1]= get_lang('ObjectivesQuestions');
1485
-        $question[2]= get_lang('SkillToAcquireQuestions');
1486
-        $question[3]= get_lang('MethodologyQuestions');
1487
-        $question[4]= get_lang('InfrastructureQuestions');
1488
-        $question[5]= get_lang('AssessmentQuestions');
1484
+        $question[1] = get_lang('ObjectivesQuestions');
1485
+        $question[2] = get_lang('SkillToAcquireQuestions');
1486
+        $question[3] = get_lang('MethodologyQuestions');
1487
+        $question[4] = get_lang('InfrastructureQuestions');
1488
+        $question[5] = get_lang('AssessmentQuestions');
1489 1489
 
1490 1490
         return $question;
1491 1491
     }
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Rights {
8 8
 	private static $rights_cache = array();
9
-	private static $rights = array (
9
+	private static $rights = array(
10 10
 		'show_tabs:reports' =>
11
-			array (
11
+			array(
12 12
 				'type' => 'const',
13 13
 				'const' => 'true' )
14 14
 		);
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.