Completed
Pull Request — 1.11.x (#1339)
by José
73:57 queued 34:43
created
custompages/language.inc.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@
 block discarded – undo
29 29
     krsort($langs, SORT_NUMERIC);
30 30
     // Choosing the best match
31 31
     foreach($langs as $weight => $codes) {
32
-		foreach ($codes as $code) {
33
-        	if (in_array($code, $available_langs)) {
34
-            	return $code;
35
-        	}
36
-		}
32
+        foreach ($codes as $code) {
33
+            if (in_array($code, $available_langs)) {
34
+                return $code;
35
+            }
36
+        }
37 37
     }
38 38
     // No match
39 39
     return null;
Please login to merge, or discard this patch.
custompages/language.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
 $lang_match = $chamilo_langs[get_preferred_language($available_langs)];
25 25
 // recover previous value ...
26 26
 if (isset($_SESSION['user_language_choice']))
27
-	$lang_match = $_SESSION['user_language_choice'];
27
+    $lang_match = $_SESSION['user_language_choice'];
28 28
 
29 29
 // Chamilo parameter, on logout
30 30
 if (isset($_REQUEST['language']) && !empty($_REQUEST['language']) && in_array($_REQUEST['language'], $chamilo_langs)) {
31
-	$lang_match = $_REQUEST['language'];
31
+    $lang_match = $_REQUEST['language'];
32 32
 }
33 33
 // Incoming link parameter
34 34
 if (isset($_REQUEST['lang']) && !empty($_REQUEST['lang']) && in_array($_REQUEST['lang'], $available_langs)) {
35
-	$lang_match = $chamilo_langs[$_REQUEST['lang']];
35
+    $lang_match = $chamilo_langs[$_REQUEST['lang']];
36 36
 }
37 37
 
38 38
 $detect = api_get_setting('auto_detect_language_custom_pages');
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_parser.php 1 patch
Indentation   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -11,235 +11,235 @@  discard block
 block discarded – undo
11 11
 */
12 12
 class nusoap_parser extends nusoap_base
13 13
 {
14
-	var $xml = '';
15
-	var $xml_encoding = '';
16
-	var $method = '';
17
-	var $root_struct = '';
18
-	var $root_struct_name = '';
19
-	var $root_struct_namespace = '';
20
-	var $root_header = '';
14
+    var $xml = '';
15
+    var $xml_encoding = '';
16
+    var $method = '';
17
+    var $root_struct = '';
18
+    var $root_struct_name = '';
19
+    var $root_struct_namespace = '';
20
+    var $root_header = '';
21 21
     var $document = '';			// incoming SOAP body (text)
22
-	// determines where in the message we are (envelope,header,body,method)
23
-	var $status = '';
24
-	var $position = 0;
25
-	var $depth = 0;
26
-	var $default_namespace = '';
27
-	var $namespaces = array();
28
-	var $message = array();
22
+    // determines where in the message we are (envelope,header,body,method)
23
+    var $status = '';
24
+    var $position = 0;
25
+    var $depth = 0;
26
+    var $default_namespace = '';
27
+    var $namespaces = array();
28
+    var $message = array();
29 29
     var $parent;
30
-	var $fault = false;
31
-	var $fault_code = '';
32
-	var $fault_str = '';
33
-	var $fault_detail = '';
34
-	var $depth_array = array();
35
-	var $debug_flag = true;
36
-	var $soapresponse = NULL;	// parsed SOAP Body
37
-	var $soapheader = NULL;		// parsed SOAP Header
38
-	var $responseHeaders = '';	// incoming SOAP headers (text)
39
-	var $body_position = 0;
40
-	// for multiref parsing:
41
-	// array of id => pos
42
-	var $ids = array();
43
-	// array of id => hrefs => pos
44
-	var $multirefs = array();
45
-	// toggle for auto-decoding element content
46
-	var $decode_utf8 = true;
30
+    var $fault = false;
31
+    var $fault_code = '';
32
+    var $fault_str = '';
33
+    var $fault_detail = '';
34
+    var $depth_array = array();
35
+    var $debug_flag = true;
36
+    var $soapresponse = NULL;	// parsed SOAP Body
37
+    var $soapheader = NULL;		// parsed SOAP Header
38
+    var $responseHeaders = '';	// incoming SOAP headers (text)
39
+    var $body_position = 0;
40
+    // for multiref parsing:
41
+    // array of id => pos
42
+    var $ids = array();
43
+    // array of id => hrefs => pos
44
+    var $multirefs = array();
45
+    // toggle for auto-decoding element content
46
+    var $decode_utf8 = true;
47 47
 
48
-	/**
49
-	* constructor that actually does the parsing
50
-	*
51
-	* @param    string $xml SOAP message
52
-	* @param    string $encoding character encoding scheme of message
53
-	* @param    string $method method for which XML is parsed (unused?)
54
-	* @param    bool $decode_utf8 whether to decode UTF-8 to ISO-8859-1
55
-	* @return void|bool
56
-	* @access   public
57
-	*/
58
-	function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
59
-		parent::nusoap_base();
60
-		$this->xml = $xml;
61
-		$this->xml_encoding = $encoding;
62
-		$this->method = $method;
63
-		$this->decode_utf8 = $decode_utf8;
48
+    /**
49
+     * constructor that actually does the parsing
50
+     *
51
+     * @param    string $xml SOAP message
52
+     * @param    string $encoding character encoding scheme of message
53
+     * @param    string $method method for which XML is parsed (unused?)
54
+     * @param    bool $decode_utf8 whether to decode UTF-8 to ISO-8859-1
55
+     * @return void|bool
56
+     * @access   public
57
+     */
58
+    function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
59
+        parent::nusoap_base();
60
+        $this->xml = $xml;
61
+        $this->xml_encoding = $encoding;
62
+        $this->method = $method;
63
+        $this->decode_utf8 = $decode_utf8;
64 64
 
65
-		// Check whether content has been read.
66
-		if(!empty($this->xml)){
67
-			// Check XML encoding
68
-			$pos_xml = strpos($xml, '<?xml');
69
-			if ($pos_xml !== FALSE) {
70
-				$xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
71
-				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
72
-					$xml_encoding = $res[1];
73
-					if (strtoupper($xml_encoding) != $encoding) {
74
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
75
-						$this->debug($err);
76
-						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
77
-							$this->setError($err);
78
-							return false;
79
-						}
80
-						// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
81
-					} else {
82
-						$this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
83
-					}
84
-				} else {
85
-					$this->debug('No encoding specified in XML declaration');
86
-				}
87
-			} else {
88
-				$this->debug('No XML declaration');
89
-			}
90
-			$this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
91
-			// Create an XML parser - why not xml_parser_create_ns?
92
-			$this->parser = xml_parser_create($this->xml_encoding);
93
-			// Set the options for parsing the XML data.
94
-			//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
95
-			xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
96
-			xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
97
-			// Set the object for the parser.
98
-			xml_set_object($this->parser, $this);
99
-			// Set the element handlers for the parser.
100
-			xml_set_element_handler($this->parser, 'start_element','end_element');
101
-			xml_set_character_data_handler($this->parser,'character_data');
65
+        // Check whether content has been read.
66
+        if(!empty($this->xml)){
67
+            // Check XML encoding
68
+            $pos_xml = strpos($xml, '<?xml');
69
+            if ($pos_xml !== FALSE) {
70
+                $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
71
+                if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
72
+                    $xml_encoding = $res[1];
73
+                    if (strtoupper($xml_encoding) != $encoding) {
74
+                        $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
75
+                        $this->debug($err);
76
+                        if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
77
+                            $this->setError($err);
78
+                            return false;
79
+                        }
80
+                        // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
81
+                    } else {
82
+                        $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
83
+                    }
84
+                } else {
85
+                    $this->debug('No encoding specified in XML declaration');
86
+                }
87
+            } else {
88
+                $this->debug('No XML declaration');
89
+            }
90
+            $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
91
+            // Create an XML parser - why not xml_parser_create_ns?
92
+            $this->parser = xml_parser_create($this->xml_encoding);
93
+            // Set the options for parsing the XML data.
94
+            //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
95
+            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
96
+            xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
97
+            // Set the object for the parser.
98
+            xml_set_object($this->parser, $this);
99
+            // Set the element handlers for the parser.
100
+            xml_set_element_handler($this->parser, 'start_element','end_element');
101
+            xml_set_character_data_handler($this->parser,'character_data');
102 102
 
103
-			xml_parse($this->parser, $this->xml);
103
+            xml_parse($this->parser, $this->xml);
104 104
 
105
-			// Parse the XML file.
106
-			//if (!xml_parse($this->parser,$xml,true)){
107
-			if (false) {
108
-			    // Display an error message.
109
-			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
110
-			    xml_get_current_line_number($this->parser),
111
-			    xml_error_string(xml_get_error_code($this->parser)));
112
-				$this->debug($err);
113
-				$this->debug("XML payload:\n" . $xml);
114
-				$this->setError($err);
115
-			} else {
116
-				$this->debug('in nusoap_parser ctor, message:');
117
-				$this->appendDebug($this->varDump($this->message));
118
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
119
-				// get final value
120
-				$this->soapresponse = $this->message[$this->root_struct]['result'];
121
-				// get header value
122
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
123
-					$this->soapheader = $this->message[$this->root_header]['result'];
124
-				}
125
-				// resolve hrefs/ids
126
-				if(sizeof($this->multirefs) > 0){
127
-					foreach($this->multirefs as $id => $hrefs){
128
-						$this->debug('resolving multirefs for id: '.$id);
129
-						$idVal = $this->buildVal($this->ids[$id]);
130
-						if (is_array($idVal) && isset($idVal['!id'])) {
131
-							unset($idVal['!id']);
132
-						}
133
-						foreach($hrefs as $refPos => $ref){
134
-							$this->debug('resolving href at pos '.$refPos);
135
-							$this->multirefs[$id][$refPos] = $idVal;
136
-						}
137
-					}
138
-				}
139
-			}
140
-			xml_parser_free($this->parser);
141
-		} else {
142
-			$this->debug('xml was empty, didn\'t parse!');
143
-			$this->setError('xml was empty, didn\'t parse!');
144
-		}
145
-	}
105
+            // Parse the XML file.
106
+            //if (!xml_parse($this->parser,$xml,true)){
107
+            if (false) {
108
+                // Display an error message.
109
+                $err = sprintf('XML error parsing SOAP payload on line %d: %s',
110
+                xml_get_current_line_number($this->parser),
111
+                xml_error_string(xml_get_error_code($this->parser)));
112
+                $this->debug($err);
113
+                $this->debug("XML payload:\n" . $xml);
114
+                $this->setError($err);
115
+            } else {
116
+                $this->debug('in nusoap_parser ctor, message:');
117
+                $this->appendDebug($this->varDump($this->message));
118
+                $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
119
+                // get final value
120
+                $this->soapresponse = $this->message[$this->root_struct]['result'];
121
+                // get header value
122
+                if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
123
+                    $this->soapheader = $this->message[$this->root_header]['result'];
124
+                }
125
+                // resolve hrefs/ids
126
+                if(sizeof($this->multirefs) > 0){
127
+                    foreach($this->multirefs as $id => $hrefs){
128
+                        $this->debug('resolving multirefs for id: '.$id);
129
+                        $idVal = $this->buildVal($this->ids[$id]);
130
+                        if (is_array($idVal) && isset($idVal['!id'])) {
131
+                            unset($idVal['!id']);
132
+                        }
133
+                        foreach($hrefs as $refPos => $ref){
134
+                            $this->debug('resolving href at pos '.$refPos);
135
+                            $this->multirefs[$id][$refPos] = $idVal;
136
+                        }
137
+                    }
138
+                }
139
+            }
140
+            xml_parser_free($this->parser);
141
+        } else {
142
+            $this->debug('xml was empty, didn\'t parse!');
143
+            $this->setError('xml was empty, didn\'t parse!');
144
+        }
145
+    }
146 146
 
147
-	/**
148
-	* start-element handler
149
-	*
150
-	* @param    resource $parser XML parser object
151
-	* @param    string $name element name
152
-	* @param    array $attrs associative array of attributes
153
-	* @access   private
154
-	*/
155
-	function start_element($parser, $name, $attrs) {
147
+    /**
148
+     * start-element handler
149
+     *
150
+     * @param    resource $parser XML parser object
151
+     * @param    string $name element name
152
+     * @param    array $attrs associative array of attributes
153
+     * @access   private
154
+     */
155
+    function start_element($parser, $name, $attrs) {
156 156
 
157
-		// position in a total number of elements, starting from 0
158
-		// update class level pos
159
-		$pos = $this->position++;
160
-		// and set mine
161
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
162
-		// depth = how many levels removed from root?
163
-		// set mine as current global depth and increment global depth value
164
-		$this->message[$pos]['depth'] = $this->depth++;
157
+        // position in a total number of elements, starting from 0
158
+        // update class level pos
159
+        $pos = $this->position++;
160
+        // and set mine
161
+        $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
162
+        // depth = how many levels removed from root?
163
+        // set mine as current global depth and increment global depth value
164
+        $this->message[$pos]['depth'] = $this->depth++;
165 165
 
166
-		// else add self as child to whoever the current parent is
167
-		if($pos != 0){
168
-			$this->message[$this->parent]['children'] .= '|'.$pos;
169
-		}
170
-		// set my parent
171
-		$this->message[$pos]['parent'] = $this->parent;
172
-		// set self as current parent
173
-		$this->parent = $pos;
174
-		// set self as current value for this depth
175
-		$this->depth_array[$this->depth] = $pos;
176
-		// get element prefix
177
-		if(strpos($name,':')){
178
-			// get ns prefix
179
-			$prefix = substr($name,0,strpos($name,':'));
180
-			// get unqualified name
181
-			$name = substr(strstr($name,':'),1);
182
-		}
183
-		// set status
184
-		if ($name == 'Envelope' && $this->status == '') {
185
-			$this->status = 'envelope';
186
-		} elseif ($name == 'Header' && $this->status == 'envelope') {
187
-			$this->root_header = $pos;
188
-			$this->status = 'header';
189
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
190
-			$this->status = 'body';
191
-			$this->body_position = $pos;
192
-		// set method
193
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
194
-			$this->status = 'method';
195
-			$this->root_struct_name = $name;
196
-			$this->root_struct = $pos;
197
-			$this->message[$pos]['type'] = 'struct';
198
-			$this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
199
-		}
200
-		// set my status
201
-		$this->message[$pos]['status'] = $this->status;
202
-		// set name
203
-		$this->message[$pos]['name'] = htmlspecialchars($name);
204
-		// set attrs
205
-		$this->message[$pos]['attrs'] = $attrs;
166
+        // else add self as child to whoever the current parent is
167
+        if($pos != 0){
168
+            $this->message[$this->parent]['children'] .= '|'.$pos;
169
+        }
170
+        // set my parent
171
+        $this->message[$pos]['parent'] = $this->parent;
172
+        // set self as current parent
173
+        $this->parent = $pos;
174
+        // set self as current value for this depth
175
+        $this->depth_array[$this->depth] = $pos;
176
+        // get element prefix
177
+        if(strpos($name,':')){
178
+            // get ns prefix
179
+            $prefix = substr($name,0,strpos($name,':'));
180
+            // get unqualified name
181
+            $name = substr(strstr($name,':'),1);
182
+        }
183
+        // set status
184
+        if ($name == 'Envelope' && $this->status == '') {
185
+            $this->status = 'envelope';
186
+        } elseif ($name == 'Header' && $this->status == 'envelope') {
187
+            $this->root_header = $pos;
188
+            $this->status = 'header';
189
+        } elseif ($name == 'Body' && $this->status == 'envelope'){
190
+            $this->status = 'body';
191
+            $this->body_position = $pos;
192
+        // set method
193
+        } elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
194
+            $this->status = 'method';
195
+            $this->root_struct_name = $name;
196
+            $this->root_struct = $pos;
197
+            $this->message[$pos]['type'] = 'struct';
198
+            $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
199
+        }
200
+        // set my status
201
+        $this->message[$pos]['status'] = $this->status;
202
+        // set name
203
+        $this->message[$pos]['name'] = htmlspecialchars($name);
204
+        // set attrs
205
+        $this->message[$pos]['attrs'] = $attrs;
206 206
 
207
-		// loop through atts, logging ns and type declarations
207
+        // loop through atts, logging ns and type declarations
208 208
         $attstr = '';
209
-		foreach($attrs as $key => $value){
210
-        	$key_prefix = $this->getPrefix($key);
211
-			$key_localpart = $this->getLocalPart($key);
212
-			// if ns declarations, add to class level array of valid namespaces
209
+        foreach($attrs as $key => $value){
210
+            $key_prefix = $this->getPrefix($key);
211
+            $key_localpart = $this->getLocalPart($key);
212
+            // if ns declarations, add to class level array of valid namespaces
213 213
             if($key_prefix == 'xmlns'){
214
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
215
-					$this->XMLSchemaVersion = $value;
216
-					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
217
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
218
-				}
214
+                if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
215
+                    $this->XMLSchemaVersion = $value;
216
+                    $this->namespaces['xsd'] = $this->XMLSchemaVersion;
217
+                    $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
218
+                }
219 219
                 $this->namespaces[$key_localpart] = $value;
220
-				// set method namespace
221
-				if($name == $this->root_struct_name){
222
-					$this->methodNamespace = $value;
223
-				}
224
-			// if it's a type declaration, set type
220
+                // set method namespace
221
+                if($name == $this->root_struct_name){
222
+                    $this->methodNamespace = $value;
223
+                }
224
+            // if it's a type declaration, set type
225 225
         } elseif($key_localpart == 'type'){
226
-        		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
227
-        			// do nothing: already processed arrayType
228
-        		} else {
229
-	            	$value_prefix = $this->getPrefix($value);
230
-	                $value_localpart = $this->getLocalPart($value);
231
-					$this->message[$pos]['type'] = $value_localpart;
232
-					$this->message[$pos]['typePrefix'] = $value_prefix;
233
-	                if(isset($this->namespaces[$value_prefix])){
234
-	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
235
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
236
-						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
237
-	                }
238
-					// should do something here with the namespace of specified type?
239
-				}
240
-			} elseif($key_localpart == 'arrayType'){
241
-				$this->message[$pos]['type'] = 'array';
242
-				/* do arrayType ereg here
226
+                if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
227
+                    // do nothing: already processed arrayType
228
+                } else {
229
+                    $value_prefix = $this->getPrefix($value);
230
+                    $value_localpart = $this->getLocalPart($value);
231
+                    $this->message[$pos]['type'] = $value_localpart;
232
+                    $this->message[$pos]['typePrefix'] = $value_prefix;
233
+                    if(isset($this->namespaces[$value_prefix])){
234
+                        $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
235
+                    } else if(isset($attrs['xmlns:'.$value_prefix])) {
236
+                        $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
237
+                    }
238
+                    // should do something here with the namespace of specified type?
239
+                }
240
+            } elseif($key_localpart == 'arrayType'){
241
+                $this->message[$pos]['type'] = 'array';
242
+                /* do arrayType ereg here
243 243
 				[1]    arrayTypeValue    ::=    atype asize
244 244
 				[2]    atype    ::=    QName rank*
245 245
 				[3]    rank    ::=    '[' (',')* ']'
@@ -247,129 +247,129 @@  discard block
 block discarded – undo
247 247
 				[5]    length    ::=    nextDimension* Digit+
248 248
 				[6]    nextDimension    ::=    Digit+ ','
249 249
 				*/
250
-				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
251
-				if(preg_match($expr,$value,$regs)){
252
-					$this->message[$pos]['typePrefix'] = $regs[1];
253
-					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
254
-	                if (isset($this->namespaces[$regs[1]])) {
255
-	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
256
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
257
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
258
-	                }
259
-					$this->message[$pos]['arrayType'] = $regs[2];
260
-					$this->message[$pos]['arraySize'] = $regs[3];
261
-					$this->message[$pos]['arrayCols'] = $regs[4];
262
-				}
263
-			// specifies nil value (or not)
264
-			} elseif ($key_localpart == 'nil'){
265
-				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
266
-			// some other attribute
267
-			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
268
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
269
-			}
250
+                $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
251
+                if(preg_match($expr,$value,$regs)){
252
+                    $this->message[$pos]['typePrefix'] = $regs[1];
253
+                    $this->message[$pos]['arrayTypePrefix'] = $regs[1];
254
+                    if (isset($this->namespaces[$regs[1]])) {
255
+                        $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
256
+                    } else if (isset($attrs['xmlns:'.$regs[1]])) {
257
+                        $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
258
+                    }
259
+                    $this->message[$pos]['arrayType'] = $regs[2];
260
+                    $this->message[$pos]['arraySize'] = $regs[3];
261
+                    $this->message[$pos]['arrayCols'] = $regs[4];
262
+                }
263
+            // specifies nil value (or not)
264
+            } elseif ($key_localpart == 'nil'){
265
+                $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
266
+            // some other attribute
267
+            } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
268
+                $this->message[$pos]['xattrs']['!' . $key] = $value;
269
+            }
270 270
 
271
-			if ($key == 'xmlns') {
272
-				$this->default_namespace = $value;
273
-			}
274
-			// log id
275
-			if($key == 'id'){
276
-				$this->ids[$value] = $pos;
277
-			}
278
-			// root
279
-			if($key_localpart == 'root' && $value == 1){
280
-				$this->status = 'method';
281
-				$this->root_struct_name = $name;
282
-				$this->root_struct = $pos;
283
-				$this->debug("found root struct $this->root_struct_name, pos $pos");
284
-			}
271
+            if ($key == 'xmlns') {
272
+                $this->default_namespace = $value;
273
+            }
274
+            // log id
275
+            if($key == 'id'){
276
+                $this->ids[$value] = $pos;
277
+            }
278
+            // root
279
+            if($key_localpart == 'root' && $value == 1){
280
+                $this->status = 'method';
281
+                $this->root_struct_name = $name;
282
+                $this->root_struct = $pos;
283
+                $this->debug("found root struct $this->root_struct_name, pos $pos");
284
+            }
285 285
             // for doclit
286 286
             $attstr .= " $key=\"$value\"";
287
-		}
287
+        }
288 288
         // get namespace - must be done after namespace atts are processed
289
-		if(isset($prefix)){
290
-			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
291
-			$this->default_namespace = $this->namespaces[$prefix];
292
-		} else {
293
-			$this->message[$pos]['namespace'] = $this->default_namespace;
294
-		}
289
+        if(isset($prefix)){
290
+            $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
291
+            $this->default_namespace = $this->namespaces[$prefix];
292
+        } else {
293
+            $this->message[$pos]['namespace'] = $this->default_namespace;
294
+        }
295 295
         if($this->status == 'header'){
296
-        	if ($this->root_header != $pos) {
297
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
298
-	        }
296
+            if ($this->root_header != $pos) {
297
+                $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
298
+            }
299 299
         } elseif($this->root_struct_name != ''){
300
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
300
+            $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
301 301
         }
302
-	}
302
+    }
303 303
 
304
-	/**
305
-	* end-element handler
306
-	*
307
-	* @param    resource $parser XML parser object
308
-	* @param    string $name element name
309
-	* @access   private
310
-	*/
311
-	function end_element($parser, $name) {
312
-		// position of current element is equal to the last value left in depth_array for my depth
313
-		$pos = $this->depth_array[$this->depth--];
304
+    /**
305
+     * end-element handler
306
+     *
307
+     * @param    resource $parser XML parser object
308
+     * @param    string $name element name
309
+     * @access   private
310
+     */
311
+    function end_element($parser, $name) {
312
+        // position of current element is equal to the last value left in depth_array for my depth
313
+        $pos = $this->depth_array[$this->depth--];
314 314
 
315 315
         // get element prefix
316
-		if(strpos($name,':')){
317
-			// get ns prefix
318
-			$prefix = substr($name,0,strpos($name,':'));
319
-			// get unqualified name
320
-			$name = substr(strstr($name,':'),1);
321
-		}
316
+        if(strpos($name,':')){
317
+            // get ns prefix
318
+            $prefix = substr($name,0,strpos($name,':'));
319
+            // get unqualified name
320
+            $name = substr(strstr($name,':'),1);
321
+        }
322 322
 		
323
-		// build to native type
324
-		if(isset($this->body_position) && $pos > $this->body_position){
325
-			// deal w/ multirefs
326
-			if(isset($this->message[$pos]['attrs']['href'])){
327
-				// get id
328
-				$id = substr($this->message[$pos]['attrs']['href'],1);
329
-				// add placeholder to href array
330
-				$this->multirefs[$id][$pos] = 'placeholder';
331
-				// add set a reference to it as the result value
332
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
323
+        // build to native type
324
+        if(isset($this->body_position) && $pos > $this->body_position){
325
+            // deal w/ multirefs
326
+            if(isset($this->message[$pos]['attrs']['href'])){
327
+                // get id
328
+                $id = substr($this->message[$pos]['attrs']['href'],1);
329
+                // add placeholder to href array
330
+                $this->multirefs[$id][$pos] = 'placeholder';
331
+                // add set a reference to it as the result value
332
+                $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
333 333
             // build complexType values
334
-			} elseif($this->message[$pos]['children'] != ''){
335
-				// if result has already been generated (struct/array)
336
-				if(!isset($this->message[$pos]['result'])){
337
-					$this->message[$pos]['result'] = $this->buildVal($pos);
338
-				}
339
-			// build complexType values of attributes and possibly simpleContent
340
-			} elseif (isset($this->message[$pos]['xattrs'])) {
341
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
342
-					$this->message[$pos]['xattrs']['!'] = null;
343
-				} elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
344
-	            	if (isset($this->message[$pos]['type'])) {
345
-						$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
346
-					} else {
347
-						$parent = $this->message[$pos]['parent'];
348
-						if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
349
-							$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
350
-						} else {
351
-							$this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
352
-						}
353
-					}
354
-				}
355
-				$this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
356
-			// set value of simpleType (or nil complexType)
357
-			} else {
358
-            	//$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
359
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
360
-					$this->message[$pos]['xattrs']['!'] = null;
361
-				} elseif (isset($this->message[$pos]['type'])) {
362
-					$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
363
-				} else {
364
-					$parent = $this->message[$pos]['parent'];
365
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
366
-						$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
367
-					} else {
368
-						$this->message[$pos]['result'] = $this->message[$pos]['cdata'];
369
-					}
370
-				}
334
+            } elseif($this->message[$pos]['children'] != ''){
335
+                // if result has already been generated (struct/array)
336
+                if(!isset($this->message[$pos]['result'])){
337
+                    $this->message[$pos]['result'] = $this->buildVal($pos);
338
+                }
339
+            // build complexType values of attributes and possibly simpleContent
340
+            } elseif (isset($this->message[$pos]['xattrs'])) {
341
+                if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
342
+                    $this->message[$pos]['xattrs']['!'] = null;
343
+                } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
344
+                    if (isset($this->message[$pos]['type'])) {
345
+                        $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
346
+                    } else {
347
+                        $parent = $this->message[$pos]['parent'];
348
+                        if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
349
+                            $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
350
+                        } else {
351
+                            $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
352
+                        }
353
+                    }
354
+                }
355
+                $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
356
+            // set value of simpleType (or nil complexType)
357
+            } else {
358
+                //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
359
+                if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
360
+                    $this->message[$pos]['xattrs']['!'] = null;
361
+                } elseif (isset($this->message[$pos]['type'])) {
362
+                    $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
363
+                } else {
364
+                    $parent = $this->message[$pos]['parent'];
365
+                    if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
366
+                        $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
367
+                    } else {
368
+                        $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
369
+                    }
370
+                }
371 371
 
372
-				/* add value to parent's result, if parent is struct/array
372
+                /* add value to parent's result, if parent is struct/array
373 373
 				$parent = $this->message[$pos]['parent'];
374 374
 				if($this->message[$parent]['type'] != 'map'){
375 375
 					if(strtolower($this->message[$parent]['type']) == 'array'){
@@ -379,261 +379,261 @@  discard block
 block discarded – undo
379 379
 					}
380 380
 				}
381 381
 				*/
382
-			}
383
-		}
382
+            }
383
+        }
384 384
 		
385 385
         // for doclit
386 386
         if($this->status == 'header'){
387
-        	if ($this->root_header != $pos) {
388
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389
-	        }
387
+            if ($this->root_header != $pos) {
388
+                $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389
+            }
390 390
         } elseif($pos >= $this->root_struct){
391
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
391
+            $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
392 392
         }
393
-		// switch status
394
-		if ($pos == $this->root_struct){
395
-			$this->status = 'body';
396
-			$this->root_struct_namespace = $this->message[$pos]['namespace'];
397
-		} elseif ($pos == $this->root_header) {
398
-			$this->status = 'envelope';
399
-		} elseif ($name == 'Body' && $this->status == 'body') {
400
-			$this->status = 'envelope';
401
-		} elseif ($name == 'Header' && $this->status == 'header') { // will never happen
402
-			$this->status = 'envelope';
403
-		} elseif ($name == 'Envelope' && $this->status == 'envelope') {
404
-			$this->status = '';
405
-		}
406
-		// set parent back to my parent
407
-		$this->parent = $this->message[$pos]['parent'];
408
-	}
393
+        // switch status
394
+        if ($pos == $this->root_struct){
395
+            $this->status = 'body';
396
+            $this->root_struct_namespace = $this->message[$pos]['namespace'];
397
+        } elseif ($pos == $this->root_header) {
398
+            $this->status = 'envelope';
399
+        } elseif ($name == 'Body' && $this->status == 'body') {
400
+            $this->status = 'envelope';
401
+        } elseif ($name == 'Header' && $this->status == 'header') { // will never happen
402
+            $this->status = 'envelope';
403
+        } elseif ($name == 'Envelope' && $this->status == 'envelope') {
404
+            $this->status = '';
405
+        }
406
+        // set parent back to my parent
407
+        $this->parent = $this->message[$pos]['parent'];
408
+    }
409 409
 
410
-	/**
411
-	* element content handler
412
-	*
413
-	* @param    resource $parser XML parser object
414
-	* @param    string $data element content
415
-	* @access   private
416
-	*/
417
-	function character_data($parser, $data)
410
+    /**
411
+     * element content handler
412
+     *
413
+     * @param    resource $parser XML parser object
414
+     * @param    string $data element content
415
+     * @access   private
416
+     */
417
+    function character_data($parser, $data)
418 418
     {
419
-		$pos = $this->depth_array[$this->depth];
420
-		if ($this->xml_encoding == 'UTF-8'){
421
-			// TODO: add an option to disable this for folks who want
422
-			// raw UTF-8 that, e.g., might not map to iso-8859-1
423
-			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
424
-			if($this->decode_utf8){
425
-				$data = utf8_decode($data);
426
-			}
427
-		}
419
+        $pos = $this->depth_array[$this->depth];
420
+        if ($this->xml_encoding == 'UTF-8'){
421
+            // TODO: add an option to disable this for folks who want
422
+            // raw UTF-8 that, e.g., might not map to iso-8859-1
423
+            // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
424
+            if($this->decode_utf8){
425
+                $data = utf8_decode($data);
426
+            }
427
+        }
428 428
         $this->message[$pos]['cdata'] .= $data;
429 429
         // for doclit
430 430
         if($this->status == 'header'){
431
-        	$this->responseHeaders .= $data;
431
+            $this->responseHeaders .= $data;
432 432
         } else {
433
-        	$this->document .= $data;
433
+            $this->document .= $data;
434 434
         }
435
-	}
435
+    }
436 436
 
437
-	/**
438
-	* get the parsed message (SOAP Body)
439
-	*
440
-	* @return	mixed
441
-	* @access   public
442
-	* @deprecated	use get_soapbody instead
443
-	*/
444
-	function get_response(){
445
-		return $this->soapresponse;
446
-	}
437
+    /**
438
+     * get the parsed message (SOAP Body)
439
+     *
440
+     * @return	mixed
441
+     * @access   public
442
+     * @deprecated	use get_soapbody instead
443
+     */
444
+    function get_response(){
445
+        return $this->soapresponse;
446
+    }
447 447
 
448
-	/**
449
-	* get the parsed SOAP Body (NULL if there was none)
450
-	*
451
-	* @return	mixed
452
-	* @access   public
453
-	*/
454
-	function get_soapbody(){
455
-		return $this->soapresponse;
456
-	}
448
+    /**
449
+     * get the parsed SOAP Body (NULL if there was none)
450
+     *
451
+     * @return	mixed
452
+     * @access   public
453
+     */
454
+    function get_soapbody(){
455
+        return $this->soapresponse;
456
+    }
457 457
 
458
-	/**
459
-	* get the parsed SOAP Header (NULL if there was none)
460
-	*
461
-	* @return	mixed
462
-	* @access   public
463
-	*/
464
-	function get_soapheader(){
465
-		return $this->soapheader;
466
-	}
458
+    /**
459
+     * get the parsed SOAP Header (NULL if there was none)
460
+     *
461
+     * @return	mixed
462
+     * @access   public
463
+     */
464
+    function get_soapheader(){
465
+        return $this->soapheader;
466
+    }
467 467
 
468
-	/**
469
-	* get the unparsed SOAP Header
470
-	*
471
-	* @return	string XML or empty if no Header
472
-	* @access   public
473
-	*/
474
-	function getHeaders(){
475
-	    return $this->responseHeaders;
476
-	}
468
+    /**
469
+     * get the unparsed SOAP Header
470
+     *
471
+     * @return	string XML or empty if no Header
472
+     * @access   public
473
+     */
474
+    function getHeaders(){
475
+        return $this->responseHeaders;
476
+    }
477 477
 
478
-	/**
479
-	* decodes simple types into PHP variables
480
-	*
481
-	* @param    string $value value to decode
482
-	* @param    string $type XML type to decode
483
-	* @param    string $typens XML type namespace to decode
484
-	* @return	mixed PHP value
485
-	* @access   private
486
-	*/
487
-	function decodeSimple($value, $type, $typens) {
488
-		// TODO: use the namespace!
489
-		if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
490
-			return (string) $value;
491
-		}
492
-		if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
493
-			return (int) $value;
494
-		}
495
-		if ($type == 'float' || $type == 'double' || $type == 'decimal') {
496
-			return (double) $value;
497
-		}
498
-		if ($type == 'boolean') {
499
-			if (strtolower($value) == 'false' || strtolower($value) == 'f') {
500
-				return false;
501
-			}
502
-			return (boolean) $value;
503
-		}
504
-		if ($type == 'base64' || $type == 'base64Binary') {
505
-			$this->debug('Decode base64 value');
506
-			return base64_decode($value);
507
-		}
508
-		// obscure numeric types
509
-		if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
510
-			|| $type == 'nonNegativeInteger' || $type == 'positiveInteger'
511
-			|| $type == 'unsignedInt'
512
-			|| $type == 'unsignedShort' || $type == 'unsignedByte') {
513
-			return (int) $value;
514
-		}
515
-		// bogus: parser treats array with no elements as a simple type
516
-		if ($type == 'array') {
517
-			return array();
518
-		}
519
-		// everything else
520
-		return (string) $value;
521
-	}
478
+    /**
479
+     * decodes simple types into PHP variables
480
+     *
481
+     * @param    string $value value to decode
482
+     * @param    string $type XML type to decode
483
+     * @param    string $typens XML type namespace to decode
484
+     * @return	mixed PHP value
485
+     * @access   private
486
+     */
487
+    function decodeSimple($value, $type, $typens) {
488
+        // TODO: use the namespace!
489
+        if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
490
+            return (string) $value;
491
+        }
492
+        if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
493
+            return (int) $value;
494
+        }
495
+        if ($type == 'float' || $type == 'double' || $type == 'decimal') {
496
+            return (double) $value;
497
+        }
498
+        if ($type == 'boolean') {
499
+            if (strtolower($value) == 'false' || strtolower($value) == 'f') {
500
+                return false;
501
+            }
502
+            return (boolean) $value;
503
+        }
504
+        if ($type == 'base64' || $type == 'base64Binary') {
505
+            $this->debug('Decode base64 value');
506
+            return base64_decode($value);
507
+        }
508
+        // obscure numeric types
509
+        if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
510
+            || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
511
+            || $type == 'unsignedInt'
512
+            || $type == 'unsignedShort' || $type == 'unsignedByte') {
513
+            return (int) $value;
514
+        }
515
+        // bogus: parser treats array with no elements as a simple type
516
+        if ($type == 'array') {
517
+            return array();
518
+        }
519
+        // everything else
520
+        return (string) $value;
521
+    }
522 522
 
523
-	/**
524
-	* builds response structures for compound values (arrays/structs)
525
-	* and scalars
526
-	*
527
-	* @param    integer $pos position in node tree
528
-	* @return	mixed	PHP value
529
-	* @access   private
530
-	*/
531
-	function buildVal($pos){
532
-		if(!isset($this->message[$pos]['type'])){
533
-			$this->message[$pos]['type'] = '';
534
-		}
535
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
536
-		// if there are children...
537
-		if($this->message[$pos]['children'] != ''){
538
-			$this->debug('in buildVal, there are children');
539
-			$children = explode('|',$this->message[$pos]['children']);
540
-			array_shift($children); // knock off empty
541
-			// md array
542
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
543
-            	$r=0; // rowcount
544
-            	$c=0; // colcount
545
-            	foreach($children as $child_pos){
546
-					$this->debug("in buildVal, got an MD array element: $r, $c");
547
-					$params[$r][] = $this->message[$child_pos]['result'];
548
-				    $c++;
549
-				    if($c == $this->message[$pos]['arrayCols']){
550
-				    	$c = 0;
551
-						$r++;
552
-				    }
523
+    /**
524
+     * builds response structures for compound values (arrays/structs)
525
+     * and scalars
526
+     *
527
+     * @param    integer $pos position in node tree
528
+     * @return	mixed	PHP value
529
+     * @access   private
530
+     */
531
+    function buildVal($pos){
532
+        if(!isset($this->message[$pos]['type'])){
533
+            $this->message[$pos]['type'] = '';
534
+        }
535
+        $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
536
+        // if there are children...
537
+        if($this->message[$pos]['children'] != ''){
538
+            $this->debug('in buildVal, there are children');
539
+            $children = explode('|',$this->message[$pos]['children']);
540
+            array_shift($children); // knock off empty
541
+            // md array
542
+            if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
543
+                $r=0; // rowcount
544
+                $c=0; // colcount
545
+                foreach($children as $child_pos){
546
+                    $this->debug("in buildVal, got an MD array element: $r, $c");
547
+                    $params[$r][] = $this->message[$child_pos]['result'];
548
+                    $c++;
549
+                    if($c == $this->message[$pos]['arrayCols']){
550
+                        $c = 0;
551
+                        $r++;
552
+                    }
553 553
                 }
554 554
             // array
555
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
555
+            } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
556 556
                 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
557 557
                 foreach($children as $child_pos){
558
-                	$params[] = &$this->message[$child_pos]['result'];
558
+                    $params[] = &$this->message[$child_pos]['result'];
559 559
                 }
560 560
             // apache Map type: java hashtable
561 561
             } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
562 562
                 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
563 563
                 foreach($children as $child_pos){
564
-                	$kv = explode("|",$this->message[$child_pos]['children']);
565
-                   	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
564
+                    $kv = explode("|",$this->message[$child_pos]['children']);
565
+                        $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
566 566
                 }
567 567
             // generic compound type
568 568
             //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
569
-		    } else {
570
-	    		// Apache Vector type: treat as an array
569
+            } else {
570
+                // Apache Vector type: treat as an array
571 571
                 $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
572
-				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
573
-					$notstruct = 1;
574
-				} else {
575
-					$notstruct = 0;
576
-	            }
577
-            	//
578
-            	foreach($children as $child_pos){
579
-            		if($notstruct){
580
-            			$params[] = &$this->message[$child_pos]['result'];
581
-            		} else {
582
-            			if (isset($params[$this->message[$child_pos]['name']])) {
583
-            				// de-serialize repeated element name into an array
584
-            				if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
585
-            					$params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
586
-            				}
587
-            				$params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
588
-            			} else {
589
-					    	$params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
590
-					    }
591
-                	}
572
+                if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
573
+                    $notstruct = 1;
574
+                } else {
575
+                    $notstruct = 0;
592 576
                 }
593
-			}
594
-			if (isset($this->message[$pos]['xattrs'])) {
577
+                //
578
+                foreach($children as $child_pos){
579
+                    if($notstruct){
580
+                        $params[] = &$this->message[$child_pos]['result'];
581
+                    } else {
582
+                        if (isset($params[$this->message[$child_pos]['name']])) {
583
+                            // de-serialize repeated element name into an array
584
+                            if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
585
+                                $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
586
+                            }
587
+                            $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
588
+                        } else {
589
+                            $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
590
+                        }
591
+                    }
592
+                }
593
+            }
594
+            if (isset($this->message[$pos]['xattrs'])) {
595 595
                 $this->debug('in buildVal, handling attributes');
596
-				foreach ($this->message[$pos]['xattrs'] as $n => $v) {
597
-					$params[$n] = $v;
598
-				}
599
-			}
600
-			// handle simpleContent
601
-			if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
596
+                foreach ($this->message[$pos]['xattrs'] as $n => $v) {
597
+                    $params[$n] = $v;
598
+                }
599
+            }
600
+            // handle simpleContent
601
+            if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
602 602
                 $this->debug('in buildVal, handling simpleContent');
603
-            	if (isset($this->message[$pos]['type'])) {
604
-					$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
605
-				} else {
606
-					$parent = $this->message[$pos]['parent'];
607
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
608
-						$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
609
-					} else {
610
-						$params['!'] = $this->message[$pos]['cdata'];
611
-					}
612
-				}
613
-			}
614
-			$ret = is_array($params) ? $params : array();
615
-			$this->debug('in buildVal, return:');
616
-			//$this->appendDebug($this->varDump($ret));
617
-			return $ret;
618
-		} else {
619
-        	$this->debug('in buildVal, no children, building scalar');
620
-			$cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
621
-        	if (isset($this->message[$pos]['type'])) {
622
-				$ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
623
-				$this->debug("in buildVal, return: $ret");
624
-				return $ret;
625
-			}
626
-			$parent = $this->message[$pos]['parent'];
627
-			if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
628
-				$ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
629
-				$this->debug("in buildVal, return: $ret");
630
-				return $ret;
631
-			}
632
-           	$ret = $this->message[$pos]['cdata'];
633
-			$this->debug("in buildVal, return: $ret");
634
-           	return $ret;
635
-		}
636
-	}
603
+                if (isset($this->message[$pos]['type'])) {
604
+                    $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
605
+                } else {
606
+                    $parent = $this->message[$pos]['parent'];
607
+                    if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
608
+                        $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
609
+                    } else {
610
+                        $params['!'] = $this->message[$pos]['cdata'];
611
+                    }
612
+                }
613
+            }
614
+            $ret = is_array($params) ? $params : array();
615
+            $this->debug('in buildVal, return:');
616
+            //$this->appendDebug($this->varDump($ret));
617
+            return $ret;
618
+        } else {
619
+            $this->debug('in buildVal, no children, building scalar');
620
+            $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
621
+            if (isset($this->message[$pos]['type'])) {
622
+                $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
623
+                $this->debug("in buildVal, return: $ret");
624
+                return $ret;
625
+            }
626
+            $parent = $this->message[$pos]['parent'];
627
+            if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
628
+                $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
629
+                $this->debug("in buildVal, return: $ret");
630
+                return $ret;
631
+            }
632
+                $ret = $this->message[$pos]['cdata'];
633
+            $this->debug("in buildVal, return: $ret");
634
+                return $ret;
635
+        }
636
+    }
637 637
 }
638 638
 
639 639
 /**
Please login to merge, or discard this patch.
main/admin/add_sessions_to_usergroup.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
       <option value = "%">--</option>
198 198
       <?php
199 199
         echo Display :: get_alphabet_options();
200
-      ?>
200
+        ?>
201 201
      </select>
202 202
 </td>
203 203
 <td align="center">&nbsp;</td>
@@ -207,31 +207,31 @@  discard block
 block discarded – undo
207 207
   <td align="center">
208 208
   <div id="content_source">
209 209
       <?php
210
-      if (!($add_type=='multiple')) {
210
+        if (!($add_type=='multiple')) {
211 211
         ?>
212 212
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
213 213
         <div id="ajax_list_users_single"></div>
214 214
         <?php
215
-      } else {
216
-      ?>
215
+        } else {
216
+        ?>
217 217
       <div id="ajax_list_multiple">
218 218
         <?php echo Display::select('session_not_in_promotion_name',$session_not_in_promotion, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'session_not_in_promotion','size'=>'15px'),false); ?>
219 219
       </div>
220 220
     <?php
221
-      }
222
-     ?>
221
+        }
222
+        ?>
223 223
   </div>
224 224
   </td>
225 225
   <td width="10%" valign="middle" align="center">
226 226
   <?php
227
-  if ($ajax_search) {
228
-  ?>
227
+    if ($ajax_search) {
228
+    ?>
229 229
     <button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('session_in_promotion'))" >
230 230
         <em class="fa fa-arrow-left"></em>
231 231
     </button>
232 232
   <?php
233
-  } else {
234
-  ?>
233
+    } else {
234
+    ?>
235 235
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))" onclick="moveItem(document.getElementById('session_not_in_promotion'), document.getElementById('session_in_promotion'))">
236 236
         <em class="fa fa-arrow-right"></em>
237 237
     </button>
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
         <em class="fa fa-arrow-left"></em>
241 241
     </button>
242 242
     <?php
243
-  }
244
-  ?>
243
+    }
244
+    ?>
245 245
     <br /><br /><br /><br /><br /><br />
246 246
   </td>
247 247
   <td align="center">
Please login to merge, or discard this patch.
main/exercise/live_stats.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 $result = $objExercise->read($exercise_id);
18 18
 
19 19
 if (!$result) {
20
-	api_not_allowed(true);
20
+    api_not_allowed(true);
21 21
 }
22 22
 
23 23
 $interbreadcrumb[] = array(
Please login to merge, or discard this patch.
main/exercise/multiple_answer_combination.class.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     }
179 179
 
180 180
     /**
181
-	 * abstract function which creates the form to create/edit the answers of the question
182
-	 * @param FormValidator $form
183
-	 */
181
+     * abstract function which creates the form to create/edit the answers of the question
182
+     * @param FormValidator $form
183
+     */
184 184
     public function processAnswersCreation($form)
185 185
     {
186 186
         $questionWeighting = $nbrGoodAnswers = 0;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         // sets the total weighting of the question
222 222
         $this->updateWeighting($questionWeighting);
223 223
         $this->save();
224
-	}
224
+    }
225 225
 
226 226
     function return_header($feedback_type = null, $counter = null, $score = null)
227 227
     {
Please login to merge, or discard this patch.
main/exercise/result.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id
18 18
 
19 19
 if ($origin == 'learnpath') {
20
-	$show_headers = false;
20
+    $show_headers = false;
21 21
 }
22 22
 
23 23
 api_protect_course_script($show_headers);
24 24
 
25 25
 if (empty($id)) {
26
-	api_not_allowed($show_headers);
26
+    api_not_allowed($show_headers);
27 27
 }
28 28
 
29 29
 $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 // Only users can see their own results
50 50
 if (!$is_allowedToEdit) {
51 51
     if ($student_id != $current_user_id) {
52
-    	api_not_allowed($show_headers);
52
+        api_not_allowed($show_headers);
53 53
     }
54 54
 }
55 55
 
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
         "name" => get_lang('Exercises'),
63 63
     );
64 64
     $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result'));
65
-	$this_section = SECTION_COURSES;
66
-	Display::display_header();
65
+    $this_section = SECTION_COURSES;
66
+    Display::display_header();
67 67
 } else {
68 68
     $htmlHeadXtra[] = "
69 69
     <style>
70 70
     body { background: none;}
71 71
     </style>
72 72
     ";
73
-	Display::display_reduced_header();
73
+    Display::display_reduced_header();
74 74
 }
75 75
 
76 76
 ExerciseLib::display_question_list_by_attempt($objExercise, $id, false);
77 77
 
78 78
 if ($show_headers) {
79
-	Display::display_footer();
79
+    Display::display_footer();
80 80
 }
Please login to merge, or discard this patch.
main/exercise/stats.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $result = $objExercise->read($exercise_id);
13 13
 
14 14
 if (!$result) {
15
-	api_not_allowed(true);
15
+    api_not_allowed(true);
16 16
 }
17 17
 
18 18
 $sessionId = api_get_session_id();
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 $data = array();
30 30
 // Question title 	# of students who tool it 	Lowest score 	Average 	Highest score 	Maximum score
31 31
 $headers = array(
32
-	get_lang('Question'),
32
+    get_lang('Question'),
33 33
     get_lang('QuestionType'),
34 34
     get_lang('NumberStudentWhoSelectedIt'),
35
-	get_lang('LowestScore'),
36
-	get_lang('AverageScore'),
37
-	get_lang('HighestScore'),
38
-	get_lang('Weighting')
35
+    get_lang('LowestScore'),
36
+    get_lang('AverageScore'),
37
+    get_lang('HighestScore'),
38
+    get_lang('Weighting')
39 39
 );
40 40
 
41 41
 if (!empty($question_list)) {
42
-	foreach ($question_list as $question_id) {
42
+    foreach ($question_list as $question_id) {
43 43
         $question_obj = Question::read($question_id);
44 44
 
45 45
         $exercise_stats = ExerciseLib::get_student_stats_by_question(
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
74 74
         $data[$question_id]['highest_score'] = round($exercise_stats['max'], 2);
75 75
         $data[$question_id]['max_score'] = round($question_obj->weighting, 2);
76
-	}
76
+    }
77 77
 }
78 78
 
79 79
 // Format A table
@@ -81,37 +81,37 @@  discard block
 block discarded – undo
81 81
 $row = 0;
82 82
 $column = 0;
83 83
 foreach ($headers as $header) {
84
-	$table->setHeaderContents($row, $column, $header);
85
-	$column++;
84
+    $table->setHeaderContents($row, $column, $header);
85
+    $column++;
86 86
 }
87 87
 $row++;
88 88
 foreach ($data as $row_table) {
89
-	$column = 0;
90
-	foreach ($row_table as $cell) {
91
-		$table->setCellContents($row, $column, $cell);
92
-		$table->updateCellAttributes($row, $column, 'align="center"');
93
-		$column++;
94
-	}
95
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
96
-	$row++;
89
+    $column = 0;
90
+    foreach ($row_table as $cell) {
91
+        $table->setCellContents($row, $column, $cell);
92
+        $table->updateCellAttributes($row, $column, 'align="center"');
93
+        $column++;
94
+    }
95
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
96
+    $row++;
97 97
 }
98 98
 $content = $table->toHtml();
99 99
 
100 100
 // Format B
101 101
 
102 102
 $headers = array(
103
-	get_lang('Question'),
104
-	get_lang('Answer'),
105
-	get_lang('Correct'),
106
-	get_lang('NumberStudentWhoSelectedIt')
103
+    get_lang('Question'),
104
+    get_lang('Answer'),
105
+    get_lang('Correct'),
106
+    get_lang('NumberStudentWhoSelectedIt')
107 107
 );
108 108
 
109 109
 $data = array();
110 110
 
111 111
 if (!empty($question_list)) {
112 112
     $id = 0;
113
-	foreach ($question_list as $question_id) {
114
-		$question_obj = Question::read($question_id);
113
+    foreach ($question_list as $question_id) {
114
+        $question_obj = Question::read($question_id);
115 115
         $exercise_stats = ExerciseLib::get_student_stats_by_question(
116 116
             $question_id,
117 117
             $exercise_id,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         );
121 121
 
122 122
         $answer = new Answer($question_id);
123
-		$answer_count = $answer->selectNbrAnswers();
123
+        $answer_count = $answer->selectNbrAnswers();
124 124
 
125 125
         for ($answer_id = 1; $answer_id <= $answer_count; $answer_id++) {
126 126
             $answer_info = $answer->selectAnswer($answer_id);
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
                         $correct = '';
176 176
 
177 177
                         for ($i = 1; $i <= $answer_count; $i++) {
178
-                             $is_correct_i = $answer->isCorrect($i);
179
-                             if ($is_correct_i != 0 && $is_correct_i == $answer_id) {
180
-                                 $correct = $answer->selectAnswer($i);
181
-                                 break;
182
-                             }
178
+                                $is_correct_i = $answer->isCorrect($i);
179
+                                if ($is_correct_i != 0 && $is_correct_i == $answer_id) {
180
+                                    $correct = $answer->selectAnswer($i);
181
+                                    break;
182
+                                }
183 183
                         }
184 184
                         $data[$id]['answer'] = $correct;
185 185
                         $data[$id]['correct'] = $answer_info;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
             }
246 246
             $id++;
247 247
         }
248
-	}
248
+    }
249 249
 }
250 250
 
251 251
 // Format A table
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
 $row = 0;
254 254
 $column = 0;
255 255
 foreach ($headers as $header) {
256
-	$table->setHeaderContents($row, $column, $header);
257
-	$column++;
256
+    $table->setHeaderContents($row, $column, $header);
257
+    $column++;
258 258
 }
259 259
 $row++;
260 260
 foreach ($data as $row_table) {
261
-	$column = 0;
262
-	foreach ($row_table as $cell) {
263
-		$table->setCellContents($row, $column, $cell);
264
-		$table->updateCellAttributes($row, $column, 'align="center"');
265
-		$column++;
266
-	}
267
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
268
-	$row++;
261
+    $column = 0;
262
+    foreach ($row_table as $cell) {
263
+        $table->setCellContents($row, $column, $cell);
264
+        $table->updateCellAttributes($row, $column, 'align="center"');
265
+        $column++;
266
+    }
267
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
268
+    $row++;
269 269
 }
270 270
 $content .= $table->toHtml();
271 271
 
Please login to merge, or discard this patch.
main/exercise/hotspot_actionscript_admin.as.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@
 block discarded – undo
98 98
         }*/
99 99
     }
100 100
 
101
-	// This is a good answer, count + 1 for nmbr of clicks
102
-	if ($answers['weighting'][$i] > 0) {
103
-		$nmbrTries++;
104
-	}
101
+    // This is a good answer, count + 1 for nmbr of clicks
102
+    if ($answers['weighting'][$i] > 0) {
103
+        $nmbrTries++;
104
+    }
105 105
 
106 106
     $hotSpot['coord'] = $answers['hotspot_coordinates'][$i];
107 107
     $data['hotspots'][] = $hotSpot;
Please login to merge, or discard this patch.