Completed
Push — 1.10.x ( f2aaaf...ef00db )
by Yannick
241:15 queued 197:35
created
main/inc/lib/wami-recorder/record_document.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 // Do not use here check Fileinfo method because return: text/plain
49 49
 
50 50
 $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
51
-$saveDir = $dirBaseDocuments . $wamidir;
51
+$saveDir = $dirBaseDocuments.$wamidir;
52 52
 
53 53
 if (!is_dir($saveDir)) {
54 54
     DocumentManager::createDefaultAudioFolder($_course);
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_parser.php 2 patches
Indentation   +545 added lines, -545 removed lines patch added patch discarded remove patch
@@ -11,234 +11,234 @@  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    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
55
-	* @access   public
56
-	*/
57
-	function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
58
-		parent::nusoap_base();
59
-		$this->xml = $xml;
60
-		$this->xml_encoding = $encoding;
61
-		$this->method = $method;
62
-		$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    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
55
+     * @access   public
56
+     */
57
+    function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
58
+        parent::nusoap_base();
59
+        $this->xml = $xml;
60
+        $this->xml_encoding = $encoding;
61
+        $this->method = $method;
62
+        $this->decode_utf8 = $decode_utf8;
63 63
 
64
-		// Check whether content has been read.
65
-		if(!empty($this->xml)){
66
-			// Check XML encoding
67
-			$pos_xml = strpos($xml, '<?xml');
68
-			if ($pos_xml !== FALSE) {
69
-				$xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
70
-				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
71
-					$xml_encoding = $res[1];
72
-					if (strtoupper($xml_encoding) != $encoding) {
73
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
74
-						$this->debug($err);
75
-						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
76
-							$this->setError($err);
77
-							return;
78
-						}
79
-						// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
80
-					} else {
81
-						$this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
82
-					}
83
-				} else {
84
-					$this->debug('No encoding specified in XML declaration');
85
-				}
86
-			} else {
87
-				$this->debug('No XML declaration');
88
-			}
89
-			$this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
90
-			// Create an XML parser - why not xml_parser_create_ns?
91
-			$this->parser = xml_parser_create($this->xml_encoding);
92
-			// Set the options for parsing the XML data.
93
-			//xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
94
-			xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
95
-			xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
96
-			// Set the object for the parser.
97
-			xml_set_object($this->parser, $this);
98
-			// Set the element handlers for the parser.
99
-			xml_set_element_handler($this->parser, 'start_element','end_element');
100
-			xml_set_character_data_handler($this->parser,'character_data');
64
+        // Check whether content has been read.
65
+        if(!empty($this->xml)){
66
+            // Check XML encoding
67
+            $pos_xml = strpos($xml, '<?xml');
68
+            if ($pos_xml !== FALSE) {
69
+                $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
70
+                if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
71
+                    $xml_encoding = $res[1];
72
+                    if (strtoupper($xml_encoding) != $encoding) {
73
+                        $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
74
+                        $this->debug($err);
75
+                        if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
76
+                            $this->setError($err);
77
+                            return;
78
+                        }
79
+                        // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
80
+                    } else {
81
+                        $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
82
+                    }
83
+                } else {
84
+                    $this->debug('No encoding specified in XML declaration');
85
+                }
86
+            } else {
87
+                $this->debug('No XML declaration');
88
+            }
89
+            $this->debug('Entering nusoap_parser(), length='.strlen($xml).', encoding='.$encoding);
90
+            // Create an XML parser - why not xml_parser_create_ns?
91
+            $this->parser = xml_parser_create($this->xml_encoding);
92
+            // Set the options for parsing the XML data.
93
+            //xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
94
+            xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
95
+            xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
96
+            // Set the object for the parser.
97
+            xml_set_object($this->parser, $this);
98
+            // Set the element handlers for the parser.
99
+            xml_set_element_handler($this->parser, 'start_element','end_element');
100
+            xml_set_character_data_handler($this->parser,'character_data');
101 101
 
102
-			xml_parse($this->parser, $this->xml);
102
+            xml_parse($this->parser, $this->xml);
103 103
 
104
-			// Parse the XML file.
105
-			//if (!xml_parse($this->parser,$xml,true)){
106
-			if (false) {
107
-			    // Display an error message.
108
-			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
109
-			    xml_get_current_line_number($this->parser),
110
-			    xml_error_string(xml_get_error_code($this->parser)));
111
-				$this->debug($err);
112
-				$this->debug("XML payload:\n" . $xml);
113
-				$this->setError($err);
114
-			} else {
115
-				$this->debug('in nusoap_parser ctor, message:');
116
-				$this->appendDebug($this->varDump($this->message));
117
-				$this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
118
-				// get final value
119
-				$this->soapresponse = $this->message[$this->root_struct]['result'];
120
-				// get header value
121
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
122
-					$this->soapheader = $this->message[$this->root_header]['result'];
123
-				}
124
-				// resolve hrefs/ids
125
-				if(sizeof($this->multirefs) > 0){
126
-					foreach($this->multirefs as $id => $hrefs){
127
-						$this->debug('resolving multirefs for id: '.$id);
128
-						$idVal = $this->buildVal($this->ids[$id]);
129
-						if (is_array($idVal) && isset($idVal['!id'])) {
130
-							unset($idVal['!id']);
131
-						}
132
-						foreach($hrefs as $refPos => $ref){
133
-							$this->debug('resolving href at pos '.$refPos);
134
-							$this->multirefs[$id][$refPos] = $idVal;
135
-						}
136
-					}
137
-				}
138
-			}
139
-			xml_parser_free($this->parser);
140
-		} else {
141
-			$this->debug('xml was empty, didn\'t parse!');
142
-			$this->setError('xml was empty, didn\'t parse!');
143
-		}
144
-	}
104
+            // Parse the XML file.
105
+            //if (!xml_parse($this->parser,$xml,true)){
106
+            if (false) {
107
+                // Display an error message.
108
+                $err = sprintf('XML error parsing SOAP payload on line %d: %s',
109
+                xml_get_current_line_number($this->parser),
110
+                xml_error_string(xml_get_error_code($this->parser)));
111
+                $this->debug($err);
112
+                $this->debug("XML payload:\n" . $xml);
113
+                $this->setError($err);
114
+            } else {
115
+                $this->debug('in nusoap_parser ctor, message:');
116
+                $this->appendDebug($this->varDump($this->message));
117
+                $this->debug('parsed successfully, found root struct: '.$this->root_struct.' of name '.$this->root_struct_name);
118
+                // get final value
119
+                $this->soapresponse = $this->message[$this->root_struct]['result'];
120
+                // get header value
121
+                if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
122
+                    $this->soapheader = $this->message[$this->root_header]['result'];
123
+                }
124
+                // resolve hrefs/ids
125
+                if(sizeof($this->multirefs) > 0){
126
+                    foreach($this->multirefs as $id => $hrefs){
127
+                        $this->debug('resolving multirefs for id: '.$id);
128
+                        $idVal = $this->buildVal($this->ids[$id]);
129
+                        if (is_array($idVal) && isset($idVal['!id'])) {
130
+                            unset($idVal['!id']);
131
+                        }
132
+                        foreach($hrefs as $refPos => $ref){
133
+                            $this->debug('resolving href at pos '.$refPos);
134
+                            $this->multirefs[$id][$refPos] = $idVal;
135
+                        }
136
+                    }
137
+                }
138
+            }
139
+            xml_parser_free($this->parser);
140
+        } else {
141
+            $this->debug('xml was empty, didn\'t parse!');
142
+            $this->setError('xml was empty, didn\'t parse!');
143
+        }
144
+    }
145 145
 
146
-	/**
147
-	* start-element handler
148
-	*
149
-	* @param    resource $parser XML parser object
150
-	* @param    string $name element name
151
-	* @param    array $attrs associative array of attributes
152
-	* @access   private
153
-	*/
154
-	function start_element($parser, $name, $attrs) {
146
+    /**
147
+     * start-element handler
148
+     *
149
+     * @param    resource $parser XML parser object
150
+     * @param    string $name element name
151
+     * @param    array $attrs associative array of attributes
152
+     * @access   private
153
+     */
154
+    function start_element($parser, $name, $attrs) {
155 155
 
156
-		// position in a total number of elements, starting from 0
157
-		// update class level pos
158
-		$pos = $this->position++;
159
-		// and set mine
160
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
161
-		// depth = how many levels removed from root?
162
-		// set mine as current global depth and increment global depth value
163
-		$this->message[$pos]['depth'] = $this->depth++;
156
+        // position in a total number of elements, starting from 0
157
+        // update class level pos
158
+        $pos = $this->position++;
159
+        // and set mine
160
+        $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
161
+        // depth = how many levels removed from root?
162
+        // set mine as current global depth and increment global depth value
163
+        $this->message[$pos]['depth'] = $this->depth++;
164 164
 
165
-		// else add self as child to whoever the current parent is
166
-		if($pos != 0){
167
-			$this->message[$this->parent]['children'] .= '|'.$pos;
168
-		}
169
-		// set my parent
170
-		$this->message[$pos]['parent'] = $this->parent;
171
-		// set self as current parent
172
-		$this->parent = $pos;
173
-		// set self as current value for this depth
174
-		$this->depth_array[$this->depth] = $pos;
175
-		// get element prefix
176
-		if(strpos($name,':')){
177
-			// get ns prefix
178
-			$prefix = substr($name,0,strpos($name,':'));
179
-			// get unqualified name
180
-			$name = substr(strstr($name,':'),1);
181
-		}
182
-		// set status
183
-		if ($name == 'Envelope' && $this->status == '') {
184
-			$this->status = 'envelope';
185
-		} elseif ($name == 'Header' && $this->status == 'envelope') {
186
-			$this->root_header = $pos;
187
-			$this->status = 'header';
188
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
189
-			$this->status = 'body';
190
-			$this->body_position = $pos;
191
-		// set method
192
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
193
-			$this->status = 'method';
194
-			$this->root_struct_name = $name;
195
-			$this->root_struct = $pos;
196
-			$this->message[$pos]['type'] = 'struct';
197
-			$this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
198
-		}
199
-		// set my status
200
-		$this->message[$pos]['status'] = $this->status;
201
-		// set name
202
-		$this->message[$pos]['name'] = htmlspecialchars($name);
203
-		// set attrs
204
-		$this->message[$pos]['attrs'] = $attrs;
165
+        // else add self as child to whoever the current parent is
166
+        if($pos != 0){
167
+            $this->message[$this->parent]['children'] .= '|'.$pos;
168
+        }
169
+        // set my parent
170
+        $this->message[$pos]['parent'] = $this->parent;
171
+        // set self as current parent
172
+        $this->parent = $pos;
173
+        // set self as current value for this depth
174
+        $this->depth_array[$this->depth] = $pos;
175
+        // get element prefix
176
+        if(strpos($name,':')){
177
+            // get ns prefix
178
+            $prefix = substr($name,0,strpos($name,':'));
179
+            // get unqualified name
180
+            $name = substr(strstr($name,':'),1);
181
+        }
182
+        // set status
183
+        if ($name == 'Envelope' && $this->status == '') {
184
+            $this->status = 'envelope';
185
+        } elseif ($name == 'Header' && $this->status == 'envelope') {
186
+            $this->root_header = $pos;
187
+            $this->status = 'header';
188
+        } elseif ($name == 'Body' && $this->status == 'envelope'){
189
+            $this->status = 'body';
190
+            $this->body_position = $pos;
191
+        // set method
192
+        } elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
193
+            $this->status = 'method';
194
+            $this->root_struct_name = $name;
195
+            $this->root_struct = $pos;
196
+            $this->message[$pos]['type'] = 'struct';
197
+            $this->debug("found root struct $this->root_struct_name, pos $this->root_struct");
198
+        }
199
+        // set my status
200
+        $this->message[$pos]['status'] = $this->status;
201
+        // set name
202
+        $this->message[$pos]['name'] = htmlspecialchars($name);
203
+        // set attrs
204
+        $this->message[$pos]['attrs'] = $attrs;
205 205
 
206
-		// loop through atts, logging ns and type declarations
206
+        // loop through atts, logging ns and type declarations
207 207
         $attstr = '';
208
-		foreach($attrs as $key => $value){
209
-        	$key_prefix = $this->getPrefix($key);
210
-			$key_localpart = $this->getLocalPart($key);
211
-			// if ns declarations, add to class level array of valid namespaces
208
+        foreach($attrs as $key => $value){
209
+            $key_prefix = $this->getPrefix($key);
210
+            $key_localpart = $this->getLocalPart($key);
211
+            // if ns declarations, add to class level array of valid namespaces
212 212
             if($key_prefix == 'xmlns'){
213
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
214
-					$this->XMLSchemaVersion = $value;
215
-					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
216
-					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
217
-				}
213
+                if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
214
+                    $this->XMLSchemaVersion = $value;
215
+                    $this->namespaces['xsd'] = $this->XMLSchemaVersion;
216
+                    $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
217
+                }
218 218
                 $this->namespaces[$key_localpart] = $value;
219
-				// set method namespace
220
-				if($name == $this->root_struct_name){
221
-					$this->methodNamespace = $value;
222
-				}
223
-			// if it's a type declaration, set type
219
+                // set method namespace
220
+                if($name == $this->root_struct_name){
221
+                    $this->methodNamespace = $value;
222
+                }
223
+            // if it's a type declaration, set type
224 224
         } elseif($key_localpart == 'type'){
225
-        		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
226
-        			// do nothing: already processed arrayType
227
-        		} else {
228
-	            	$value_prefix = $this->getPrefix($value);
229
-	                $value_localpart = $this->getLocalPart($value);
230
-					$this->message[$pos]['type'] = $value_localpart;
231
-					$this->message[$pos]['typePrefix'] = $value_prefix;
232
-	                if(isset($this->namespaces[$value_prefix])){
233
-	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
234
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
235
-						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
236
-	                }
237
-					// should do something here with the namespace of specified type?
238
-				}
239
-			} elseif($key_localpart == 'arrayType'){
240
-				$this->message[$pos]['type'] = 'array';
241
-				/* do arrayType ereg here
225
+                if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
226
+                    // do nothing: already processed arrayType
227
+                } else {
228
+                    $value_prefix = $this->getPrefix($value);
229
+                    $value_localpart = $this->getLocalPart($value);
230
+                    $this->message[$pos]['type'] = $value_localpart;
231
+                    $this->message[$pos]['typePrefix'] = $value_prefix;
232
+                    if(isset($this->namespaces[$value_prefix])){
233
+                        $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
234
+                    } else if(isset($attrs['xmlns:'.$value_prefix])) {
235
+                        $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
236
+                    }
237
+                    // should do something here with the namespace of specified type?
238
+                }
239
+            } elseif($key_localpart == 'arrayType'){
240
+                $this->message[$pos]['type'] = 'array';
241
+                /* do arrayType ereg here
242 242
 				[1]    arrayTypeValue    ::=    atype asize
243 243
 				[2]    atype    ::=    QName rank*
244 244
 				[3]    rank    ::=    '[' (',')* ']'
@@ -246,129 +246,129 @@  discard block
 block discarded – undo
246 246
 				[5]    length    ::=    nextDimension* Digit+
247 247
 				[6]    nextDimension    ::=    Digit+ ','
248 248
 				*/
249
-				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
250
-				if(preg_match($expr,$value,$regs)){
251
-					$this->message[$pos]['typePrefix'] = $regs[1];
252
-					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
253
-	                if (isset($this->namespaces[$regs[1]])) {
254
-	                	$this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
255
-	                } else if (isset($attrs['xmlns:'.$regs[1]])) {
256
-						$this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
257
-	                }
258
-					$this->message[$pos]['arrayType'] = $regs[2];
259
-					$this->message[$pos]['arraySize'] = $regs[3];
260
-					$this->message[$pos]['arrayCols'] = $regs[4];
261
-				}
262
-			// specifies nil value (or not)
263
-			} elseif ($key_localpart == 'nil'){
264
-				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
265
-			// some other attribute
266
-			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
267
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
268
-			}
249
+                $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
250
+                if(preg_match($expr,$value,$regs)){
251
+                    $this->message[$pos]['typePrefix'] = $regs[1];
252
+                    $this->message[$pos]['arrayTypePrefix'] = $regs[1];
253
+                    if (isset($this->namespaces[$regs[1]])) {
254
+                        $this->message[$pos]['arrayTypeNamespace'] = $this->namespaces[$regs[1]];
255
+                    } else if (isset($attrs['xmlns:'.$regs[1]])) {
256
+                        $this->message[$pos]['arrayTypeNamespace'] = $attrs['xmlns:'.$regs[1]];
257
+                    }
258
+                    $this->message[$pos]['arrayType'] = $regs[2];
259
+                    $this->message[$pos]['arraySize'] = $regs[3];
260
+                    $this->message[$pos]['arrayCols'] = $regs[4];
261
+                }
262
+            // specifies nil value (or not)
263
+            } elseif ($key_localpart == 'nil'){
264
+                $this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
265
+            // some other attribute
266
+            } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
267
+                $this->message[$pos]['xattrs']['!' . $key] = $value;
268
+            }
269 269
 
270
-			if ($key == 'xmlns') {
271
-				$this->default_namespace = $value;
272
-			}
273
-			// log id
274
-			if($key == 'id'){
275
-				$this->ids[$value] = $pos;
276
-			}
277
-			// root
278
-			if($key_localpart == 'root' && $value == 1){
279
-				$this->status = 'method';
280
-				$this->root_struct_name = $name;
281
-				$this->root_struct = $pos;
282
-				$this->debug("found root struct $this->root_struct_name, pos $pos");
283
-			}
270
+            if ($key == 'xmlns') {
271
+                $this->default_namespace = $value;
272
+            }
273
+            // log id
274
+            if($key == 'id'){
275
+                $this->ids[$value] = $pos;
276
+            }
277
+            // root
278
+            if($key_localpart == 'root' && $value == 1){
279
+                $this->status = 'method';
280
+                $this->root_struct_name = $name;
281
+                $this->root_struct = $pos;
282
+                $this->debug("found root struct $this->root_struct_name, pos $pos");
283
+            }
284 284
             // for doclit
285 285
             $attstr .= " $key=\"$value\"";
286
-		}
286
+        }
287 287
         // get namespace - must be done after namespace atts are processed
288
-		if(isset($prefix)){
289
-			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
290
-			$this->default_namespace = $this->namespaces[$prefix];
291
-		} else {
292
-			$this->message[$pos]['namespace'] = $this->default_namespace;
293
-		}
288
+        if(isset($prefix)){
289
+            $this->message[$pos]['namespace'] = $this->namespaces[$prefix];
290
+            $this->default_namespace = $this->namespaces[$prefix];
291
+        } else {
292
+            $this->message[$pos]['namespace'] = $this->default_namespace;
293
+        }
294 294
         if($this->status == 'header'){
295
-        	if ($this->root_header != $pos) {
296
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
297
-	        }
295
+            if ($this->root_header != $pos) {
296
+                $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
297
+            }
298 298
         } elseif($this->root_struct_name != ''){
299
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
299
+            $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
300 300
         }
301
-	}
301
+    }
302 302
 
303
-	/**
304
-	* end-element handler
305
-	*
306
-	* @param    resource $parser XML parser object
307
-	* @param    string $name element name
308
-	* @access   private
309
-	*/
310
-	function end_element($parser, $name) {
311
-		// position of current element is equal to the last value left in depth_array for my depth
312
-		$pos = $this->depth_array[$this->depth--];
303
+    /**
304
+     * end-element handler
305
+     *
306
+     * @param    resource $parser XML parser object
307
+     * @param    string $name element name
308
+     * @access   private
309
+     */
310
+    function end_element($parser, $name) {
311
+        // position of current element is equal to the last value left in depth_array for my depth
312
+        $pos = $this->depth_array[$this->depth--];
313 313
 
314 314
         // get element prefix
315
-		if(strpos($name,':')){
316
-			// get ns prefix
317
-			$prefix = substr($name,0,strpos($name,':'));
318
-			// get unqualified name
319
-			$name = substr(strstr($name,':'),1);
320
-		}
315
+        if(strpos($name,':')){
316
+            // get ns prefix
317
+            $prefix = substr($name,0,strpos($name,':'));
318
+            // get unqualified name
319
+            $name = substr(strstr($name,':'),1);
320
+        }
321 321
 		
322
-		// build to native type
323
-		if(isset($this->body_position) && $pos > $this->body_position){
324
-			// deal w/ multirefs
325
-			if(isset($this->message[$pos]['attrs']['href'])){
326
-				// get id
327
-				$id = substr($this->message[$pos]['attrs']['href'],1);
328
-				// add placeholder to href array
329
-				$this->multirefs[$id][$pos] = 'placeholder';
330
-				// add set a reference to it as the result value
331
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
322
+        // build to native type
323
+        if(isset($this->body_position) && $pos > $this->body_position){
324
+            // deal w/ multirefs
325
+            if(isset($this->message[$pos]['attrs']['href'])){
326
+                // get id
327
+                $id = substr($this->message[$pos]['attrs']['href'],1);
328
+                // add placeholder to href array
329
+                $this->multirefs[$id][$pos] = 'placeholder';
330
+                // add set a reference to it as the result value
331
+                $this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
332 332
             // build complexType values
333
-			} elseif($this->message[$pos]['children'] != ''){
334
-				// if result has already been generated (struct/array)
335
-				if(!isset($this->message[$pos]['result'])){
336
-					$this->message[$pos]['result'] = $this->buildVal($pos);
337
-				}
338
-			// build complexType values of attributes and possibly simpleContent
339
-			} elseif (isset($this->message[$pos]['xattrs'])) {
340
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
341
-					$this->message[$pos]['xattrs']['!'] = null;
342
-				} elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
343
-	            	if (isset($this->message[$pos]['type'])) {
344
-						$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'] : '');
345
-					} else {
346
-						$parent = $this->message[$pos]['parent'];
347
-						if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
348
-							$this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
349
-						} else {
350
-							$this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
351
-						}
352
-					}
353
-				}
354
-				$this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
355
-			// set value of simpleType (or nil complexType)
356
-			} else {
357
-            	//$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
358
-				if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
359
-					$this->message[$pos]['xattrs']['!'] = null;
360
-				} elseif (isset($this->message[$pos]['type'])) {
361
-					$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'] : '');
362
-				} else {
363
-					$parent = $this->message[$pos]['parent'];
364
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
365
-						$this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
366
-					} else {
367
-						$this->message[$pos]['result'] = $this->message[$pos]['cdata'];
368
-					}
369
-				}
333
+            } elseif($this->message[$pos]['children'] != ''){
334
+                // if result has already been generated (struct/array)
335
+                if(!isset($this->message[$pos]['result'])){
336
+                    $this->message[$pos]['result'] = $this->buildVal($pos);
337
+                }
338
+            // build complexType values of attributes and possibly simpleContent
339
+            } elseif (isset($this->message[$pos]['xattrs'])) {
340
+                if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
341
+                    $this->message[$pos]['xattrs']['!'] = null;
342
+                } elseif (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
343
+                    if (isset($this->message[$pos]['type'])) {
344
+                        $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'] : '');
345
+                    } else {
346
+                        $parent = $this->message[$pos]['parent'];
347
+                        if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
348
+                            $this->message[$pos]['xattrs']['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
349
+                        } else {
350
+                            $this->message[$pos]['xattrs']['!'] = $this->message[$pos]['cdata'];
351
+                        }
352
+                    }
353
+                }
354
+                $this->message[$pos]['result'] = $this->message[$pos]['xattrs'];
355
+            // set value of simpleType (or nil complexType)
356
+            } else {
357
+                //$this->debug('adding data for scalar value '.$this->message[$pos]['name'].' of value '.$this->message[$pos]['cdata']);
358
+                if (isset($this->message[$pos]['nil']) && $this->message[$pos]['nil']) {
359
+                    $this->message[$pos]['xattrs']['!'] = null;
360
+                } elseif (isset($this->message[$pos]['type'])) {
361
+                    $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'] : '');
362
+                } else {
363
+                    $parent = $this->message[$pos]['parent'];
364
+                    if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
365
+                        $this->message[$pos]['result'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
366
+                    } else {
367
+                        $this->message[$pos]['result'] = $this->message[$pos]['cdata'];
368
+                    }
369
+                }
370 370
 
371
-				/* add value to parent's result, if parent is struct/array
371
+                /* add value to parent's result, if parent is struct/array
372 372
 				$parent = $this->message[$pos]['parent'];
373 373
 				if($this->message[$parent]['type'] != 'map'){
374 374
 					if(strtolower($this->message[$parent]['type']) == 'array'){
@@ -378,261 +378,261 @@  discard block
 block discarded – undo
378 378
 					}
379 379
 				}
380 380
 				*/
381
-			}
382
-		}
381
+            }
382
+        }
383 383
 		
384 384
         // for doclit
385 385
         if($this->status == 'header'){
386
-        	if ($this->root_header != $pos) {
387
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
388
-	        }
386
+            if ($this->root_header != $pos) {
387
+                $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
388
+            }
389 389
         } elseif($pos >= $this->root_struct){
390
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
390
+            $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
391 391
         }
392
-		// switch status
393
-		if ($pos == $this->root_struct){
394
-			$this->status = 'body';
395
-			$this->root_struct_namespace = $this->message[$pos]['namespace'];
396
-		} elseif ($pos == $this->root_header) {
397
-			$this->status = 'envelope';
398
-		} elseif ($name == 'Body' && $this->status == 'body') {
399
-			$this->status = 'envelope';
400
-		} elseif ($name == 'Header' && $this->status == 'header') { // will never happen
401
-			$this->status = 'envelope';
402
-		} elseif ($name == 'Envelope' && $this->status == 'envelope') {
403
-			$this->status = '';
404
-		}
405
-		// set parent back to my parent
406
-		$this->parent = $this->message[$pos]['parent'];
407
-	}
392
+        // switch status
393
+        if ($pos == $this->root_struct){
394
+            $this->status = 'body';
395
+            $this->root_struct_namespace = $this->message[$pos]['namespace'];
396
+        } elseif ($pos == $this->root_header) {
397
+            $this->status = 'envelope';
398
+        } elseif ($name == 'Body' && $this->status == 'body') {
399
+            $this->status = 'envelope';
400
+        } elseif ($name == 'Header' && $this->status == 'header') { // will never happen
401
+            $this->status = 'envelope';
402
+        } elseif ($name == 'Envelope' && $this->status == 'envelope') {
403
+            $this->status = '';
404
+        }
405
+        // set parent back to my parent
406
+        $this->parent = $this->message[$pos]['parent'];
407
+    }
408 408
 
409
-	/**
410
-	* element content handler
411
-	*
412
-	* @param    resource $parser XML parser object
413
-	* @param    string $data element content
414
-	* @access   private
415
-	*/
416
-	function character_data($parser, $data)
409
+    /**
410
+     * element content handler
411
+     *
412
+     * @param    resource $parser XML parser object
413
+     * @param    string $data element content
414
+     * @access   private
415
+     */
416
+    function character_data($parser, $data)
417 417
     {
418
-		$pos = $this->depth_array[$this->depth];
419
-		if ($this->xml_encoding == 'UTF-8'){
420
-			// TODO: add an option to disable this for folks who want
421
-			// raw UTF-8 that, e.g., might not map to iso-8859-1
422
-			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
423
-			if($this->decode_utf8){
424
-				$data = utf8_decode($data);
425
-			}
426
-		}
418
+        $pos = $this->depth_array[$this->depth];
419
+        if ($this->xml_encoding == 'UTF-8'){
420
+            // TODO: add an option to disable this for folks who want
421
+            // raw UTF-8 that, e.g., might not map to iso-8859-1
422
+            // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
423
+            if($this->decode_utf8){
424
+                $data = utf8_decode($data);
425
+            }
426
+        }
427 427
         $this->message[$pos]['cdata'] .= $data;
428 428
         // for doclit
429 429
         if($this->status == 'header'){
430
-        	$this->responseHeaders .= $data;
430
+            $this->responseHeaders .= $data;
431 431
         } else {
432
-        	$this->document .= $data;
432
+            $this->document .= $data;
433 433
         }
434
-	}
434
+    }
435 435
 
436
-	/**
437
-	* get the parsed message (SOAP Body)
438
-	*
439
-	* @return	mixed
440
-	* @access   public
441
-	* @deprecated	use get_soapbody instead
442
-	*/
443
-	function get_response(){
444
-		return $this->soapresponse;
445
-	}
436
+    /**
437
+     * get the parsed message (SOAP Body)
438
+     *
439
+     * @return	mixed
440
+     * @access   public
441
+     * @deprecated	use get_soapbody instead
442
+     */
443
+    function get_response(){
444
+        return $this->soapresponse;
445
+    }
446 446
 
447
-	/**
448
-	* get the parsed SOAP Body (NULL if there was none)
449
-	*
450
-	* @return	mixed
451
-	* @access   public
452
-	*/
453
-	function get_soapbody(){
454
-		return $this->soapresponse;
455
-	}
447
+    /**
448
+     * get the parsed SOAP Body (NULL if there was none)
449
+     *
450
+     * @return	mixed
451
+     * @access   public
452
+     */
453
+    function get_soapbody(){
454
+        return $this->soapresponse;
455
+    }
456 456
 
457
-	/**
458
-	* get the parsed SOAP Header (NULL if there was none)
459
-	*
460
-	* @return	mixed
461
-	* @access   public
462
-	*/
463
-	function get_soapheader(){
464
-		return $this->soapheader;
465
-	}
457
+    /**
458
+     * get the parsed SOAP Header (NULL if there was none)
459
+     *
460
+     * @return	mixed
461
+     * @access   public
462
+     */
463
+    function get_soapheader(){
464
+        return $this->soapheader;
465
+    }
466 466
 
467
-	/**
468
-	* get the unparsed SOAP Header
469
-	*
470
-	* @return	string XML or empty if no Header
471
-	* @access   public
472
-	*/
473
-	function getHeaders(){
474
-	    return $this->responseHeaders;
475
-	}
467
+    /**
468
+     * get the unparsed SOAP Header
469
+     *
470
+     * @return	string XML or empty if no Header
471
+     * @access   public
472
+     */
473
+    function getHeaders(){
474
+        return $this->responseHeaders;
475
+    }
476 476
 
477
-	/**
478
-	* decodes simple types into PHP variables
479
-	*
480
-	* @param    string $value value to decode
481
-	* @param    string $type XML type to decode
482
-	* @param    string $typens XML type namespace to decode
483
-	* @return	mixed PHP value
484
-	* @access   private
485
-	*/
486
-	function decodeSimple($value, $type, $typens) {
487
-		// TODO: use the namespace!
488
-		if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
489
-			return (string) $value;
490
-		}
491
-		if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
492
-			return (int) $value;
493
-		}
494
-		if ($type == 'float' || $type == 'double' || $type == 'decimal') {
495
-			return (double) $value;
496
-		}
497
-		if ($type == 'boolean') {
498
-			if (strtolower($value) == 'false' || strtolower($value) == 'f') {
499
-				return false;
500
-			}
501
-			return (boolean) $value;
502
-		}
503
-		if ($type == 'base64' || $type == 'base64Binary') {
504
-			$this->debug('Decode base64 value');
505
-			return base64_decode($value);
506
-		}
507
-		// obscure numeric types
508
-		if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
509
-			|| $type == 'nonNegativeInteger' || $type == 'positiveInteger'
510
-			|| $type == 'unsignedInt'
511
-			|| $type == 'unsignedShort' || $type == 'unsignedByte') {
512
-			return (int) $value;
513
-		}
514
-		// bogus: parser treats array with no elements as a simple type
515
-		if ($type == 'array') {
516
-			return array();
517
-		}
518
-		// everything else
519
-		return (string) $value;
520
-	}
477
+    /**
478
+     * decodes simple types into PHP variables
479
+     *
480
+     * @param    string $value value to decode
481
+     * @param    string $type XML type to decode
482
+     * @param    string $typens XML type namespace to decode
483
+     * @return	mixed PHP value
484
+     * @access   private
485
+     */
486
+    function decodeSimple($value, $type, $typens) {
487
+        // TODO: use the namespace!
488
+        if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
489
+            return (string) $value;
490
+        }
491
+        if ($type == 'int' || $type == 'integer' || $type == 'short' || $type == 'byte') {
492
+            return (int) $value;
493
+        }
494
+        if ($type == 'float' || $type == 'double' || $type == 'decimal') {
495
+            return (double) $value;
496
+        }
497
+        if ($type == 'boolean') {
498
+            if (strtolower($value) == 'false' || strtolower($value) == 'f') {
499
+                return false;
500
+            }
501
+            return (boolean) $value;
502
+        }
503
+        if ($type == 'base64' || $type == 'base64Binary') {
504
+            $this->debug('Decode base64 value');
505
+            return base64_decode($value);
506
+        }
507
+        // obscure numeric types
508
+        if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
509
+            || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
510
+            || $type == 'unsignedInt'
511
+            || $type == 'unsignedShort' || $type == 'unsignedByte') {
512
+            return (int) $value;
513
+        }
514
+        // bogus: parser treats array with no elements as a simple type
515
+        if ($type == 'array') {
516
+            return array();
517
+        }
518
+        // everything else
519
+        return (string) $value;
520
+    }
521 521
 
522
-	/**
523
-	* builds response structures for compound values (arrays/structs)
524
-	* and scalars
525
-	*
526
-	* @param    integer $pos position in node tree
527
-	* @return	mixed	PHP value
528
-	* @access   private
529
-	*/
530
-	function buildVal($pos){
531
-		if(!isset($this->message[$pos]['type'])){
532
-			$this->message[$pos]['type'] = '';
533
-		}
534
-		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
535
-		// if there are children...
536
-		if($this->message[$pos]['children'] != ''){
537
-			$this->debug('in buildVal, there are children');
538
-			$children = explode('|',$this->message[$pos]['children']);
539
-			array_shift($children); // knock off empty
540
-			// md array
541
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
542
-            	$r=0; // rowcount
543
-            	$c=0; // colcount
544
-            	foreach($children as $child_pos){
545
-					$this->debug("in buildVal, got an MD array element: $r, $c");
546
-					$params[$r][] = $this->message[$child_pos]['result'];
547
-				    $c++;
548
-				    if($c == $this->message[$pos]['arrayCols']){
549
-				    	$c = 0;
550
-						$r++;
551
-				    }
522
+    /**
523
+     * builds response structures for compound values (arrays/structs)
524
+     * and scalars
525
+     *
526
+     * @param    integer $pos position in node tree
527
+     * @return	mixed	PHP value
528
+     * @access   private
529
+     */
530
+    function buildVal($pos){
531
+        if(!isset($this->message[$pos]['type'])){
532
+            $this->message[$pos]['type'] = '';
533
+        }
534
+        $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
535
+        // if there are children...
536
+        if($this->message[$pos]['children'] != ''){
537
+            $this->debug('in buildVal, there are children');
538
+            $children = explode('|',$this->message[$pos]['children']);
539
+            array_shift($children); // knock off empty
540
+            // md array
541
+            if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
542
+                $r=0; // rowcount
543
+                $c=0; // colcount
544
+                foreach($children as $child_pos){
545
+                    $this->debug("in buildVal, got an MD array element: $r, $c");
546
+                    $params[$r][] = $this->message[$child_pos]['result'];
547
+                    $c++;
548
+                    if($c == $this->message[$pos]['arrayCols']){
549
+                        $c = 0;
550
+                        $r++;
551
+                    }
552 552
                 }
553 553
             // array
554
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
554
+            } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
555 555
                 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
556 556
                 foreach($children as $child_pos){
557
-                	$params[] = &$this->message[$child_pos]['result'];
557
+                    $params[] = &$this->message[$child_pos]['result'];
558 558
                 }
559 559
             // apache Map type: java hashtable
560 560
             } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
561 561
                 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
562 562
                 foreach($children as $child_pos){
563
-                	$kv = explode("|",$this->message[$child_pos]['children']);
564
-                   	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
563
+                    $kv = explode("|",$this->message[$child_pos]['children']);
564
+                        $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
565 565
                 }
566 566
             // generic compound type
567 567
             //} elseif($this->message[$pos]['type'] == 'SOAPStruct' || $this->message[$pos]['type'] == 'struct') {
568
-		    } else {
569
-	    		// Apache Vector type: treat as an array
568
+            } else {
569
+                // Apache Vector type: treat as an array
570 570
                 $this->debug('in buildVal, adding Java Vector or generic compound type '.$this->message[$pos]['name']);
571
-				if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
572
-					$notstruct = 1;
573
-				} else {
574
-					$notstruct = 0;
575
-	            }
576
-            	//
577
-            	foreach($children as $child_pos){
578
-            		if($notstruct){
579
-            			$params[] = &$this->message[$child_pos]['result'];
580
-            		} else {
581
-            			if (isset($params[$this->message[$child_pos]['name']])) {
582
-            				// de-serialize repeated element name into an array
583
-            				if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
584
-            					$params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
585
-            				}
586
-            				$params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
587
-            			} else {
588
-					    	$params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
589
-					    }
590
-                	}
571
+                if ($this->message[$pos]['type'] == 'Vector' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
572
+                    $notstruct = 1;
573
+                } else {
574
+                    $notstruct = 0;
591 575
                 }
592
-			}
593
-			if (isset($this->message[$pos]['xattrs'])) {
576
+                //
577
+                foreach($children as $child_pos){
578
+                    if($notstruct){
579
+                        $params[] = &$this->message[$child_pos]['result'];
580
+                    } else {
581
+                        if (isset($params[$this->message[$child_pos]['name']])) {
582
+                            // de-serialize repeated element name into an array
583
+                            if ((!is_array($params[$this->message[$child_pos]['name']])) || (!isset($params[$this->message[$child_pos]['name']][0]))) {
584
+                                $params[$this->message[$child_pos]['name']] = array($params[$this->message[$child_pos]['name']]);
585
+                            }
586
+                            $params[$this->message[$child_pos]['name']][] = &$this->message[$child_pos]['result'];
587
+                        } else {
588
+                            $params[$this->message[$child_pos]['name']] = &$this->message[$child_pos]['result'];
589
+                        }
590
+                    }
591
+                }
592
+            }
593
+            if (isset($this->message[$pos]['xattrs'])) {
594 594
                 $this->debug('in buildVal, handling attributes');
595
-				foreach ($this->message[$pos]['xattrs'] as $n => $v) {
596
-					$params[$n] = $v;
597
-				}
598
-			}
599
-			// handle simpleContent
600
-			if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
595
+                foreach ($this->message[$pos]['xattrs'] as $n => $v) {
596
+                    $params[$n] = $v;
597
+                }
598
+            }
599
+            // handle simpleContent
600
+            if (isset($this->message[$pos]['cdata']) && trim($this->message[$pos]['cdata']) != '') {
601 601
                 $this->debug('in buildVal, handling simpleContent');
602
-            	if (isset($this->message[$pos]['type'])) {
603
-					$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
604
-				} else {
605
-					$parent = $this->message[$pos]['parent'];
606
-					if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
607
-						$params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
608
-					} else {
609
-						$params['!'] = $this->message[$pos]['cdata'];
610
-					}
611
-				}
612
-			}
613
-			$ret = is_array($params) ? $params : array();
614
-			$this->debug('in buildVal, return:');
615
-			//$this->appendDebug($this->varDump($ret));
616
-			return $ret;
617
-		} else {
618
-        	$this->debug('in buildVal, no children, building scalar');
619
-			$cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
620
-        	if (isset($this->message[$pos]['type'])) {
621
-				$ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
622
-				$this->debug("in buildVal, return: $ret");
623
-				return $ret;
624
-			}
625
-			$parent = $this->message[$pos]['parent'];
626
-			if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
627
-				$ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
628
-				$this->debug("in buildVal, return: $ret");
629
-				return $ret;
630
-			}
631
-           	$ret = $this->message[$pos]['cdata'];
632
-			$this->debug("in buildVal, return: $ret");
633
-           	return $ret;
634
-		}
635
-	}
602
+                if (isset($this->message[$pos]['type'])) {
603
+                    $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
604
+                } else {
605
+                    $parent = $this->message[$pos]['parent'];
606
+                    if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
607
+                        $params['!'] = $this->decodeSimple($this->message[$pos]['cdata'], $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
608
+                    } else {
609
+                        $params['!'] = $this->message[$pos]['cdata'];
610
+                    }
611
+                }
612
+            }
613
+            $ret = is_array($params) ? $params : array();
614
+            $this->debug('in buildVal, return:');
615
+            //$this->appendDebug($this->varDump($ret));
616
+            return $ret;
617
+        } else {
618
+            $this->debug('in buildVal, no children, building scalar');
619
+            $cdata = isset($this->message[$pos]['cdata']) ? $this->message[$pos]['cdata'] : '';
620
+            if (isset($this->message[$pos]['type'])) {
621
+                $ret = $this->decodeSimple($cdata, $this->message[$pos]['type'], isset($this->message[$pos]['type_namespace']) ? $this->message[$pos]['type_namespace'] : '');
622
+                $this->debug("in buildVal, return: $ret");
623
+                return $ret;
624
+            }
625
+            $parent = $this->message[$pos]['parent'];
626
+            if (isset($this->message[$parent]['type']) && ($this->message[$parent]['type'] == 'array') && isset($this->message[$parent]['arrayType'])) {
627
+                $ret = $this->decodeSimple($cdata, $this->message[$parent]['arrayType'], isset($this->message[$parent]['arrayTypeNamespace']) ? $this->message[$parent]['arrayTypeNamespace'] : '');
628
+                $this->debug("in buildVal, return: $ret");
629
+                return $ret;
630
+            }
631
+                $ret = $this->message[$pos]['cdata'];
632
+            $this->debug("in buildVal, return: $ret");
633
+                return $ret;
634
+        }
635
+    }
636 636
 }
637 637
 
638 638
 /**
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	var $root_struct_name = '';
19 19
 	var $root_struct_namespace = '';
20 20
 	var $root_header = '';
21
-    var $document = '';			// incoming SOAP body (text)
21
+    var $document = ''; // incoming SOAP body (text)
22 22
 	// determines where in the message we are (envelope,header,body,method)
23 23
 	var $status = '';
24 24
 	var $position = 0;
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	var $fault_detail = '';
34 34
 	var $depth_array = array();
35 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)
36
+	var $soapresponse = NULL; // parsed SOAP Body
37
+	var $soapheader = NULL; // parsed SOAP Header
38
+	var $responseHeaders = ''; // incoming SOAP headers (text)
39 39
 	var $body_position = 0;
40 40
 	// for multiref parsing:
41 41
 	// array of id => pos
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	* @param    string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
55 55
 	* @access   public
56 56
 	*/
57
-	function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
57
+	function nusoap_parser($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true) {
58 58
 		parent::nusoap_base();
59 59
 		$this->xml = $xml;
60 60
 		$this->xml_encoding = $encoding;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 		$this->decode_utf8 = $decode_utf8;
63 63
 
64 64
 		// Check whether content has been read.
65
-		if(!empty($this->xml)){
65
+		if (!empty($this->xml)) {
66 66
 			// Check XML encoding
67 67
 			$pos_xml = strpos($xml, '<?xml');
68 68
 			if ($pos_xml !== FALSE) {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 				if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
71 71
 					$xml_encoding = $res[1];
72 72
 					if (strtoupper($xml_encoding) != $encoding) {
73
-						$err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
73
+						$err = "Charset from HTTP Content-Type '".$encoding."' does not match encoding from XML declaration '".$xml_encoding."'";
74 74
 						$this->debug($err);
75 75
 						if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
76 76
 							$this->setError($err);
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 			// Set the object for the parser.
97 97
 			xml_set_object($this->parser, $this);
98 98
 			// Set the element handlers for the parser.
99
-			xml_set_element_handler($this->parser, 'start_element','end_element');
100
-			xml_set_character_data_handler($this->parser,'character_data');
99
+			xml_set_element_handler($this->parser, 'start_element', 'end_element');
100
+			xml_set_character_data_handler($this->parser, 'character_data');
101 101
 
102 102
 			xml_parse($this->parser, $this->xml);
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 			    xml_get_current_line_number($this->parser),
110 110
 			    xml_error_string(xml_get_error_code($this->parser)));
111 111
 				$this->debug($err);
112
-				$this->debug("XML payload:\n" . $xml);
112
+				$this->debug("XML payload:\n".$xml);
113 113
 				$this->setError($err);
114 114
 			} else {
115 115
 				$this->debug('in nusoap_parser ctor, message:');
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 				// get final value
119 119
 				$this->soapresponse = $this->message[$this->root_struct]['result'];
120 120
 				// get header value
121
-				if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){
121
+				if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
122 122
 					$this->soapheader = $this->message[$this->root_header]['result'];
123 123
 				}
124 124
 				// resolve hrefs/ids
125
-				if(sizeof($this->multirefs) > 0){
126
-					foreach($this->multirefs as $id => $hrefs){
125
+				if (sizeof($this->multirefs) > 0) {
126
+					foreach ($this->multirefs as $id => $hrefs) {
127 127
 						$this->debug('resolving multirefs for id: '.$id);
128 128
 						$idVal = $this->buildVal($this->ids[$id]);
129 129
 						if (is_array($idVal) && isset($idVal['!id'])) {
130 130
 							unset($idVal['!id']);
131 131
 						}
132
-						foreach($hrefs as $refPos => $ref){
132
+						foreach ($hrefs as $refPos => $ref) {
133 133
 							$this->debug('resolving href at pos '.$refPos);
134 134
 							$this->multirefs[$id][$refPos] = $idVal;
135 135
 						}
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 		// update class level pos
158 158
 		$pos = $this->position++;
159 159
 		// and set mine
160
-		$this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>'');
160
+		$this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>'');
161 161
 		// depth = how many levels removed from root?
162 162
 		// set mine as current global depth and increment global depth value
163 163
 		$this->message[$pos]['depth'] = $this->depth++;
164 164
 
165 165
 		// else add self as child to whoever the current parent is
166
-		if($pos != 0){
166
+		if ($pos != 0) {
167 167
 			$this->message[$this->parent]['children'] .= '|'.$pos;
168 168
 		}
169 169
 		// set my parent
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 		// set self as current value for this depth
174 174
 		$this->depth_array[$this->depth] = $pos;
175 175
 		// get element prefix
176
-		if(strpos($name,':')){
176
+		if (strpos($name, ':')) {
177 177
 			// get ns prefix
178
-			$prefix = substr($name,0,strpos($name,':'));
178
+			$prefix = substr($name, 0, strpos($name, ':'));
179 179
 			// get unqualified name
180
-			$name = substr(strstr($name,':'),1);
180
+			$name = substr(strstr($name, ':'), 1);
181 181
 		}
182 182
 		// set status
183 183
 		if ($name == 'Envelope' && $this->status == '') {
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		} elseif ($name == 'Header' && $this->status == 'envelope') {
186 186
 			$this->root_header = $pos;
187 187
 			$this->status = 'header';
188
-		} elseif ($name == 'Body' && $this->status == 'envelope'){
188
+		} elseif ($name == 'Body' && $this->status == 'envelope') {
189 189
 			$this->status = 'body';
190 190
 			$this->body_position = $pos;
191 191
 		// set method
192
-		} elseif($this->status == 'body' && $pos == ($this->body_position+1)) {
192
+		} elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) {
193 193
 			$this->status = 'method';
194 194
 			$this->root_struct_name = $name;
195 195
 			$this->root_struct = $pos;
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 
206 206
 		// loop through atts, logging ns and type declarations
207 207
         $attstr = '';
208
-		foreach($attrs as $key => $value){
208
+		foreach ($attrs as $key => $value) {
209 209
         	$key_prefix = $this->getPrefix($key);
210 210
 			$key_localpart = $this->getLocalPart($key);
211 211
 			// if ns declarations, add to class level array of valid namespaces
212
-            if($key_prefix == 'xmlns'){
213
-				if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){
212
+            if ($key_prefix == 'xmlns') {
213
+				if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) {
214 214
 					$this->XMLSchemaVersion = $value;
215 215
 					$this->namespaces['xsd'] = $this->XMLSchemaVersion;
216 216
 					$this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance';
217 217
 				}
218 218
                 $this->namespaces[$key_localpart] = $value;
219 219
 				// set method namespace
220
-				if($name == $this->root_struct_name){
220
+				if ($name == $this->root_struct_name) {
221 221
 					$this->methodNamespace = $value;
222 222
 				}
223 223
 			// if it's a type declaration, set type
224
-        } elseif($key_localpart == 'type'){
224
+        } elseif ($key_localpart == 'type') {
225 225
         		if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') {
226 226
         			// do nothing: already processed arrayType
227 227
         		} else {
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 	                $value_localpart = $this->getLocalPart($value);
230 230
 					$this->message[$pos]['type'] = $value_localpart;
231 231
 					$this->message[$pos]['typePrefix'] = $value_prefix;
232
-	                if(isset($this->namespaces[$value_prefix])){
232
+	                if (isset($this->namespaces[$value_prefix])) {
233 233
 	                	$this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix];
234
-	                } else if(isset($attrs['xmlns:'.$value_prefix])) {
234
+	                } else if (isset($attrs['xmlns:'.$value_prefix])) {
235 235
 						$this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix];
236 236
 	                }
237 237
 					// should do something here with the namespace of specified type?
238 238
 				}
239
-			} elseif($key_localpart == 'arrayType'){
239
+			} elseif ($key_localpart == 'arrayType') {
240 240
 				$this->message[$pos]['type'] = 'array';
241 241
 				/* do arrayType ereg here
242 242
 				[1]    arrayTypeValue    ::=    atype asize
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 				[6]    nextDimension    ::=    Digit+ ','
248 248
 				*/
249 249
 				$expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/';
250
-				if(preg_match($expr,$value,$regs)){
250
+				if (preg_match($expr, $value, $regs)) {
251 251
 					$this->message[$pos]['typePrefix'] = $regs[1];
252 252
 					$this->message[$pos]['arrayTypePrefix'] = $regs[1];
253 253
 	                if (isset($this->namespaces[$regs[1]])) {
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 					$this->message[$pos]['arrayCols'] = $regs[4];
261 261
 				}
262 262
 			// specifies nil value (or not)
263
-			} elseif ($key_localpart == 'nil'){
263
+			} elseif ($key_localpart == 'nil') {
264 264
 				$this->message[$pos]['nil'] = ($value == 'true' || $value == '1');
265 265
 			// some other attribute
266 266
 			} elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') {
267
-				$this->message[$pos]['xattrs']['!' . $key] = $value;
267
+				$this->message[$pos]['xattrs']['!'.$key] = $value;
268 268
 			}
269 269
 
270 270
 			if ($key == 'xmlns') {
271 271
 				$this->default_namespace = $value;
272 272
 			}
273 273
 			// log id
274
-			if($key == 'id'){
274
+			if ($key == 'id') {
275 275
 				$this->ids[$value] = $pos;
276 276
 			}
277 277
 			// root
278
-			if($key_localpart == 'root' && $value == 1){
278
+			if ($key_localpart == 'root' && $value == 1) {
279 279
 				$this->status = 'method';
280 280
 				$this->root_struct_name = $name;
281 281
 				$this->root_struct = $pos;
@@ -285,18 +285,18 @@  discard block
 block discarded – undo
285 285
             $attstr .= " $key=\"$value\"";
286 286
 		}
287 287
         // get namespace - must be done after namespace atts are processed
288
-		if(isset($prefix)){
288
+		if (isset($prefix)) {
289 289
 			$this->message[$pos]['namespace'] = $this->namespaces[$prefix];
290 290
 			$this->default_namespace = $this->namespaces[$prefix];
291 291
 		} else {
292 292
 			$this->message[$pos]['namespace'] = $this->default_namespace;
293 293
 		}
294
-        if($this->status == 'header'){
294
+        if ($this->status == 'header') {
295 295
         	if ($this->root_header != $pos) {
296
-	        	$this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
296
+	        	$this->responseHeaders .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>";
297 297
 	        }
298
-        } elseif($this->root_struct_name != ''){
299
-        	$this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>";
298
+        } elseif ($this->root_struct_name != '') {
299
+        	$this->document .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>";
300 300
         }
301 301
 	}
302 302
 
@@ -312,27 +312,27 @@  discard block
 block discarded – undo
312 312
 		$pos = $this->depth_array[$this->depth--];
313 313
 
314 314
         // get element prefix
315
-		if(strpos($name,':')){
315
+		if (strpos($name, ':')) {
316 316
 			// get ns prefix
317
-			$prefix = substr($name,0,strpos($name,':'));
317
+			$prefix = substr($name, 0, strpos($name, ':'));
318 318
 			// get unqualified name
319
-			$name = substr(strstr($name,':'),1);
319
+			$name = substr(strstr($name, ':'), 1);
320 320
 		}
321 321
 		
322 322
 		// build to native type
323
-		if(isset($this->body_position) && $pos > $this->body_position){
323
+		if (isset($this->body_position) && $pos > $this->body_position) {
324 324
 			// deal w/ multirefs
325
-			if(isset($this->message[$pos]['attrs']['href'])){
325
+			if (isset($this->message[$pos]['attrs']['href'])) {
326 326
 				// get id
327
-				$id = substr($this->message[$pos]['attrs']['href'],1);
327
+				$id = substr($this->message[$pos]['attrs']['href'], 1);
328 328
 				// add placeholder to href array
329 329
 				$this->multirefs[$id][$pos] = 'placeholder';
330 330
 				// add set a reference to it as the result value
331
-				$this->message[$pos]['result'] =& $this->multirefs[$id][$pos];
331
+				$this->message[$pos]['result'] = & $this->multirefs[$id][$pos];
332 332
             // build complexType values
333
-			} elseif($this->message[$pos]['children'] != ''){
333
+			} elseif ($this->message[$pos]['children'] != '') {
334 334
 				// if result has already been generated (struct/array)
335
-				if(!isset($this->message[$pos]['result'])){
335
+				if (!isset($this->message[$pos]['result'])) {
336 336
 					$this->message[$pos]['result'] = $this->buildVal($pos);
337 337
 				}
338 338
 			// build complexType values of attributes and possibly simpleContent
@@ -382,15 +382,15 @@  discard block
 block discarded – undo
382 382
 		}
383 383
 		
384 384
         // for doclit
385
-        if($this->status == 'header'){
385
+        if ($this->status == 'header') {
386 386
         	if ($this->root_header != $pos) {
387
-	        	$this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
387
+	        	$this->responseHeaders .= "</".(isset($prefix) ? $prefix.':' : '')."$name>";
388 388
 	        }
389
-        } elseif($pos >= $this->root_struct){
390
-        	$this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>";
389
+        } elseif ($pos >= $this->root_struct) {
390
+        	$this->document .= "</".(isset($prefix) ? $prefix.':' : '')."$name>";
391 391
         }
392 392
 		// switch status
393
-		if ($pos == $this->root_struct){
393
+		if ($pos == $this->root_struct) {
394 394
 			$this->status = 'body';
395 395
 			$this->root_struct_namespace = $this->message[$pos]['namespace'];
396 396
 		} elseif ($pos == $this->root_header) {
@@ -416,17 +416,17 @@  discard block
 block discarded – undo
416 416
 	function character_data($parser, $data)
417 417
     {
418 418
 		$pos = $this->depth_array[$this->depth];
419
-		if ($this->xml_encoding == 'UTF-8'){
419
+		if ($this->xml_encoding == 'UTF-8') {
420 420
 			// TODO: add an option to disable this for folks who want
421 421
 			// raw UTF-8 that, e.g., might not map to iso-8859-1
422 422
 			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
423
-			if($this->decode_utf8){
423
+			if ($this->decode_utf8) {
424 424
 				$data = utf8_decode($data);
425 425
 			}
426 426
 		}
427 427
         $this->message[$pos]['cdata'] .= $data;
428 428
         // for doclit
429
-        if($this->status == 'header'){
429
+        if ($this->status == 'header') {
430 430
         	$this->responseHeaders .= $data;
431 431
         } else {
432 432
         	$this->document .= $data;
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	* @access   public
441 441
 	* @deprecated	use get_soapbody instead
442 442
 	*/
443
-	function get_response(){
443
+	function get_response() {
444 444
 		return $this->soapresponse;
445 445
 	}
446 446
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	* @return	mixed
451 451
 	* @access   public
452 452
 	*/
453
-	function get_soapbody(){
453
+	function get_soapbody() {
454 454
 		return $this->soapresponse;
455 455
 	}
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	* @return	mixed
461 461
 	* @access   public
462 462
 	*/
463
-	function get_soapheader(){
463
+	function get_soapheader() {
464 464
 		return $this->soapheader;
465 465
 	}
466 466
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	* @return	string XML or empty if no Header
471 471
 	* @access   public
472 472
 	*/
473
-	function getHeaders(){
473
+	function getHeaders() {
474 474
 	    return $this->responseHeaders;
475 475
 	}
476 476
 
@@ -527,40 +527,40 @@  discard block
 block discarded – undo
527 527
 	* @return	mixed	PHP value
528 528
 	* @access   private
529 529
 	*/
530
-	function buildVal($pos){
531
-		if(!isset($this->message[$pos]['type'])){
530
+	function buildVal($pos) {
531
+		if (!isset($this->message[$pos]['type'])) {
532 532
 			$this->message[$pos]['type'] = '';
533 533
 		}
534 534
 		$this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
535 535
 		// if there are children...
536
-		if($this->message[$pos]['children'] != ''){
536
+		if ($this->message[$pos]['children'] != '') {
537 537
 			$this->debug('in buildVal, there are children');
538
-			$children = explode('|',$this->message[$pos]['children']);
538
+			$children = explode('|', $this->message[$pos]['children']);
539 539
 			array_shift($children); // knock off empty
540 540
 			// md array
541
-			if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){
542
-            	$r=0; // rowcount
543
-            	$c=0; // colcount
544
-            	foreach($children as $child_pos){
541
+			if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') {
542
+            	$r = 0; // rowcount
543
+            	$c = 0; // colcount
544
+            	foreach ($children as $child_pos) {
545 545
 					$this->debug("in buildVal, got an MD array element: $r, $c");
546 546
 					$params[$r][] = $this->message[$child_pos]['result'];
547 547
 				    $c++;
548
-				    if($c == $this->message[$pos]['arrayCols']){
548
+				    if ($c == $this->message[$pos]['arrayCols']) {
549 549
 				    	$c = 0;
550 550
 						$r++;
551 551
 				    }
552 552
                 }
553 553
             // array
554
-			} elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){
554
+			} elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') {
555 555
                 $this->debug('in buildVal, adding array '.$this->message[$pos]['name']);
556
-                foreach($children as $child_pos){
556
+                foreach ($children as $child_pos) {
557 557
                 	$params[] = &$this->message[$child_pos]['result'];
558 558
                 }
559 559
             // apache Map type: java hashtable
560
-            } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){
560
+            } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') {
561 561
                 $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']);
562
-                foreach($children as $child_pos){
563
-                	$kv = explode("|",$this->message[$child_pos]['children']);
562
+                foreach ($children as $child_pos) {
563
+                	$kv = explode("|", $this->message[$child_pos]['children']);
564 564
                    	$params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result'];
565 565
                 }
566 566
             // generic compound type
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 					$notstruct = 0;
575 575
 	            }
576 576
             	//
577
-            	foreach($children as $child_pos){
578
-            		if($notstruct){
577
+            	foreach ($children as $child_pos) {
578
+            		if ($notstruct) {
579 579
             			$params[] = &$this->message[$child_pos]['result'];
580 580
             		} else {
581 581
             			if (isset($params[$this->message[$child_pos]['name']])) {
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.wsdlcache.php 2 patches
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -16,189 +16,189 @@
 block discarded – undo
16 16
 * @access public 
17 17
 */
18 18
 class nusoap_wsdlcache {
19
-	/**
20
-	 *	@var resource
21
-	 *	@access private
22
-	 */
23
-	var $fplock;
24
-	/**
25
-	 *	@var integer
26
-	 *	@access private
27
-	 */
28
-	var $cache_lifetime;
29
-	/**
30
-	 *	@var string
31
-	 *	@access private
32
-	 */
33
-	var $cache_dir;
34
-	/**
35
-	 *	@var string
36
-	 *	@access public
37
-	 */
38
-	var $debug_str = '';
19
+    /**
20
+     *	@var resource
21
+     *	@access private
22
+     */
23
+    var $fplock;
24
+    /**
25
+     *	@var integer
26
+     *	@access private
27
+     */
28
+    var $cache_lifetime;
29
+    /**
30
+     *	@var string
31
+     *	@access private
32
+     */
33
+    var $cache_dir;
34
+    /**
35
+     *	@var string
36
+     *	@access public
37
+     */
38
+    var $debug_str = '';
39 39
 
40
-	/**
41
-	* constructor
42
-	*
43
-	* @param string $cache_dir directory for cache-files
44
-	* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
45
-	* @access public
46
-	*/
47
-	function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
48
-		$this->fplock = array();
49
-		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
50
-		$this->cache_lifetime = $cache_lifetime;
51
-	}
40
+    /**
41
+     * constructor
42
+     *
43
+     * @param string $cache_dir directory for cache-files
44
+     * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
45
+     * @access public
46
+     */
47
+    function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
48
+        $this->fplock = array();
49
+        $this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
50
+        $this->cache_lifetime = $cache_lifetime;
51
+    }
52 52
 
53
-	/**
54
-	* creates the filename used to cache a wsdl instance
55
-	*
56
-	* @param string $wsdl The URL of the wsdl instance
57
-	* @return string The filename used to cache the instance
58
-	* @access private
59
-	*/
60
-	function createFilename($wsdl) {
61
-		return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
62
-	}
53
+    /**
54
+     * creates the filename used to cache a wsdl instance
55
+     *
56
+     * @param string $wsdl The URL of the wsdl instance
57
+     * @return string The filename used to cache the instance
58
+     * @access private
59
+     */
60
+    function createFilename($wsdl) {
61
+        return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
62
+    }
63 63
 
64
-	/**
65
-	* adds debug data to the class level debug string
66
-	*
67
-	* @param    string $string debug data
68
-	* @access   private
69
-	*/
70
-	function debug($string){
71
-		$this->debug_str .= get_class($this).": $string\n";
72
-	}
64
+    /**
65
+     * adds debug data to the class level debug string
66
+     *
67
+     * @param    string $string debug data
68
+     * @access   private
69
+     */
70
+    function debug($string){
71
+        $this->debug_str .= get_class($this).": $string\n";
72
+    }
73 73
 
74
-	/**
75
-	* gets a wsdl instance from the cache
76
-	*
77
-	* @param string $wsdl The URL of the wsdl instance
78
-	* @return object wsdl The cached wsdl instance, null if the instance is not in the cache
79
-	* @access public
80
-	*/
81
-	function get($wsdl) {
82
-		$filename = $this->createFilename($wsdl);
83
-		if ($this->obtainMutex($filename, "r")) {
84
-			// check for expired WSDL that must be removed from the cache
85
- 			if ($this->cache_lifetime > 0) {
86
-				if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
87
-					unlink($filename);
88
-					$this->debug("Expired $wsdl ($filename) from cache");
89
-					$this->releaseMutex($filename);
90
-					return null;
91
-  				}
92
-			}
93
-			// see what there is to return
94
-			if (!file_exists($filename)) {
95
-				$this->debug("$wsdl ($filename) not in cache (1)");
96
-				$this->releaseMutex($filename);
97
-				return null;
98
-			}
99
-			$fp = @fopen($filename, "r");
100
-			if ($fp) {
101
-				$s = implode("", @file($filename));
102
-				fclose($fp);
103
-				$this->debug("Got $wsdl ($filename) from cache");
104
-			} else {
105
-				$s = null;
106
-				$this->debug("$wsdl ($filename) not in cache (2)");
107
-			}
108
-			$this->releaseMutex($filename);
109
-			return (!is_null($s)) ? unserialize($s) : null;
110
-		} else {
111
-			$this->debug("Unable to obtain mutex for $filename in get");
112
-		}
113
-		return null;
114
-	}
74
+    /**
75
+     * gets a wsdl instance from the cache
76
+     *
77
+     * @param string $wsdl The URL of the wsdl instance
78
+     * @return object wsdl The cached wsdl instance, null if the instance is not in the cache
79
+     * @access public
80
+     */
81
+    function get($wsdl) {
82
+        $filename = $this->createFilename($wsdl);
83
+        if ($this->obtainMutex($filename, "r")) {
84
+            // check for expired WSDL that must be removed from the cache
85
+                if ($this->cache_lifetime > 0) {
86
+                if (file_exists($filename) && (time() - filemtime($filename) > $this->cache_lifetime)) {
87
+                    unlink($filename);
88
+                    $this->debug("Expired $wsdl ($filename) from cache");
89
+                    $this->releaseMutex($filename);
90
+                    return null;
91
+                    }
92
+            }
93
+            // see what there is to return
94
+            if (!file_exists($filename)) {
95
+                $this->debug("$wsdl ($filename) not in cache (1)");
96
+                $this->releaseMutex($filename);
97
+                return null;
98
+            }
99
+            $fp = @fopen($filename, "r");
100
+            if ($fp) {
101
+                $s = implode("", @file($filename));
102
+                fclose($fp);
103
+                $this->debug("Got $wsdl ($filename) from cache");
104
+            } else {
105
+                $s = null;
106
+                $this->debug("$wsdl ($filename) not in cache (2)");
107
+            }
108
+            $this->releaseMutex($filename);
109
+            return (!is_null($s)) ? unserialize($s) : null;
110
+        } else {
111
+            $this->debug("Unable to obtain mutex for $filename in get");
112
+        }
113
+        return null;
114
+    }
115 115
 
116
-	/**
117
-	* obtains the local mutex
118
-	*
119
-	* @param string $filename The Filename of the Cache to lock
120
-	* @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
121
-	* @return boolean Lock successfully obtained ?!
122
-	* @access private
123
-	*/
124
-	function obtainMutex($filename, $mode) {
125
-		if (isset($this->fplock[md5($filename)])) {
126
-			$this->debug("Lock for $filename already exists");
127
-			return false;
128
-		}
129
-		$this->fplock[md5($filename)] = fopen($filename.".lock", "w");
130
-		if ($mode == "r") {
131
-			return flock($this->fplock[md5($filename)], LOCK_SH);
132
-		} else {
133
-			return flock($this->fplock[md5($filename)], LOCK_EX);
134
-		}
135
-	}
116
+    /**
117
+     * obtains the local mutex
118
+     *
119
+     * @param string $filename The Filename of the Cache to lock
120
+     * @param string $mode The open-mode ("r" or "w") or the file - affects lock-mode
121
+     * @return boolean Lock successfully obtained ?!
122
+     * @access private
123
+     */
124
+    function obtainMutex($filename, $mode) {
125
+        if (isset($this->fplock[md5($filename)])) {
126
+            $this->debug("Lock for $filename already exists");
127
+            return false;
128
+        }
129
+        $this->fplock[md5($filename)] = fopen($filename.".lock", "w");
130
+        if ($mode == "r") {
131
+            return flock($this->fplock[md5($filename)], LOCK_SH);
132
+        } else {
133
+            return flock($this->fplock[md5($filename)], LOCK_EX);
134
+        }
135
+    }
136 136
 
137
-	/**
138
-	* adds a wsdl instance to the cache
139
-	*
140
-	* @param object wsdl $wsdl_instance The wsdl instance to add
141
-	* @return boolean WSDL successfully cached
142
-	* @access public
143
-	*/
144
-	function put($wsdl_instance) {
145
-		$filename = $this->createFilename($wsdl_instance->wsdl);
146
-		$s = serialize($wsdl_instance);
147
-		if ($this->obtainMutex($filename, "w")) {
148
-			$fp = fopen($filename, "w");
149
-			if (! $fp) {
150
-				$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
151
-				$this->releaseMutex($filename);
152
-				return false;
153
-			}
154
-			fputs($fp, $s);
155
-			fclose($fp);
156
-			$this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
157
-			$this->releaseMutex($filename);
158
-			return true;
159
-		} else {
160
-			$this->debug("Unable to obtain mutex for $filename in put");
161
-		}
162
-		return false;
163
-	}
137
+    /**
138
+     * adds a wsdl instance to the cache
139
+     *
140
+     * @param object wsdl $wsdl_instance The wsdl instance to add
141
+     * @return boolean WSDL successfully cached
142
+     * @access public
143
+     */
144
+    function put($wsdl_instance) {
145
+        $filename = $this->createFilename($wsdl_instance->wsdl);
146
+        $s = serialize($wsdl_instance);
147
+        if ($this->obtainMutex($filename, "w")) {
148
+            $fp = fopen($filename, "w");
149
+            if (! $fp) {
150
+                $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
151
+                $this->releaseMutex($filename);
152
+                return false;
153
+            }
154
+            fputs($fp, $s);
155
+            fclose($fp);
156
+            $this->debug("Put $wsdl_instance->wsdl ($filename) in cache");
157
+            $this->releaseMutex($filename);
158
+            return true;
159
+        } else {
160
+            $this->debug("Unable to obtain mutex for $filename in put");
161
+        }
162
+        return false;
163
+    }
164 164
 
165
-	/**
166
-	* releases the local mutex
167
-	*
168
-	* @param string $filename The Filename of the Cache to lock
169
-	* @return boolean Lock successfully released
170
-	* @access private
171
-	*/
172
-	function releaseMutex($filename) {
173
-		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
174
-		fclose($this->fplock[md5($filename)]);
175
-		unset($this->fplock[md5($filename)]);
176
-		if (! $ret) {
177
-			$this->debug("Not able to release lock for $filename");
178
-		}
179
-		return $ret;
180
-	}
165
+    /**
166
+     * releases the local mutex
167
+     *
168
+     * @param string $filename The Filename of the Cache to lock
169
+     * @return boolean Lock successfully released
170
+     * @access private
171
+     */
172
+    function releaseMutex($filename) {
173
+        $ret = flock($this->fplock[md5($filename)], LOCK_UN);
174
+        fclose($this->fplock[md5($filename)]);
175
+        unset($this->fplock[md5($filename)]);
176
+        if (! $ret) {
177
+            $this->debug("Not able to release lock for $filename");
178
+        }
179
+        return $ret;
180
+    }
181 181
 
182
-	/**
183
-	* removes a wsdl instance from the cache
184
-	*
185
-	* @param string $wsdl The URL of the wsdl instance
186
-	* @return boolean Whether there was an instance to remove
187
-	* @access public
188
-	*/
189
-	function remove($wsdl) {
190
-		$filename = $this->createFilename($wsdl);
191
-		if (!file_exists($filename)) {
192
-			$this->debug("$wsdl ($filename) not in cache to be removed");
193
-			return false;
194
-		}
195
-		// ignore errors obtaining mutex
196
-		$this->obtainMutex($filename, "w");
197
-		$ret = unlink($filename);
198
-		$this->debug("Removed ($ret) $wsdl ($filename) from cache");
199
-		$this->releaseMutex($filename);
200
-		return $ret;
201
-	}
182
+    /**
183
+     * removes a wsdl instance from the cache
184
+     *
185
+     * @param string $wsdl The URL of the wsdl instance
186
+     * @return boolean Whether there was an instance to remove
187
+     * @access public
188
+     */
189
+    function remove($wsdl) {
190
+        $filename = $this->createFilename($wsdl);
191
+        if (!file_exists($filename)) {
192
+            $this->debug("$wsdl ($filename) not in cache to be removed");
193
+            return false;
194
+        }
195
+        // ignore errors obtaining mutex
196
+        $this->obtainMutex($filename, "w");
197
+        $ret = unlink($filename);
198
+        $this->debug("Removed ($ret) $wsdl ($filename) from cache");
199
+        $this->releaseMutex($filename);
200
+        return $ret;
201
+    }
202 202
 }
203 203
 
204 204
 /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	* @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
45 45
 	* @access public
46 46
 	*/
47
-	function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
47
+	function nusoap_wsdlcache($cache_dir = '.', $cache_lifetime = 0) {
48 48
 		$this->fplock = array();
49 49
 		$this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
50 50
 		$this->cache_lifetime = $cache_lifetime;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	* @access private
59 59
 	*/
60 60
 	function createFilename($wsdl) {
61
-		return $this->cache_dir.'/wsdlcache-' . md5($wsdl);
61
+		return $this->cache_dir.'/wsdlcache-'.md5($wsdl);
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	* @param    string $string debug data
68 68
 	* @access   private
69 69
 	*/
70
-	function debug($string){
70
+	function debug($string) {
71 71
 		$this->debug_str .= get_class($this).": $string\n";
72 72
 	}
73 73
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$s = serialize($wsdl_instance);
147 147
 		if ($this->obtainMutex($filename, "w")) {
148 148
 			$fp = fopen($filename, "w");
149
-			if (! $fp) {
149
+			if (!$fp) {
150 150
 				$this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache");
151 151
 				$this->releaseMutex($filename);
152 152
 				return false;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		$ret = flock($this->fplock[md5($filename)], LOCK_UN);
174 174
 		fclose($this->fplock[md5($filename)]);
175 175
 		unset($this->fplock[md5($filename)]);
176
-		if (! $ret) {
176
+		if (!$ret) {
177 177
 			$this->debug("Not able to release lock for $filename");
178 178
 		}
179 179
 		return $ret;
Please login to merge, or discard this patch.
main/inc/lib/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/extra_field_option.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
                         foreach ($sub_options as $sub_option) {
218 218
                             if (!empty($sub_option)) {
219
-                                $new_params  = array(
219
+                                $new_params = array(
220 220
                                     'field_id' => $field_id,
221 221
                                     'option_value' => $sub_id,
222 222
                                     'display_text' => $sub_option,
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         echo '<div class="actions">';
553 553
         $field_id = isset($_REQUEST['field_id']) ? intval($_REQUEST['field_id']) : null;
554 554
         echo '<a href="'.api_get_self().'?action=add&type='.$this->type.'&field_id='.$field_id.'">'.
555
-                Display::return_icon('add_user_fields.png', get_lang('Add'), '', ICON_SIZE_MEDIUM ).'</a>';
555
+                Display::return_icon('add_user_fields.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
556 556
         echo '</div>';
557 557
         echo Display::grid_html('extra_field_options');
558 558
     }
Please login to merge, or discard this patch.
main/inc/lib/statistics.lib.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -666,7 +666,7 @@
 block discarded – undo
666 666
         $res = Database::query($sql);
667 667
         $count1 = Database::fetch_object($res);
668 668
         $sql = "SELECT COUNT(*) AS n FROM $user_table as u $table ".
669
-               "WHERE LENGTH(picture_uri) > 0 $url_condition2";
669
+                "WHERE LENGTH(picture_uri) > 0 $url_condition2";
670 670
         $res = Database::query($sql);
671 671
         $count2 = Database::fetch_object($res);
672 672
         // #users without picture
Please login to merge, or discard this 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/opengraph/OpenGraph.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 
19 19
 class OpenGraph implements Iterator
20 20
 {
21
-  /**
22
-   * There are base schema's based on type, this is just
23
-   * a map so that the schema can be obtained
24
-   *
25
-   */
21
+    /**
22
+     * There are base schema's based on type, this is just
23
+     * a map so that the schema can be obtained
24
+     *
25
+     */
26 26
     public static $TYPES = array(
27 27
         'activity' => array('activity', 'sport'),
28 28
         'business' => array('bar', 'company', 'cafe', 'hotel', 'restaurant'),
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         'website' => array('blog', 'website'),
35 35
     );
36 36
 
37
-  /**
38
-   * Holds all the Open Graph values we've parsed from a page
39
-   *
40
-   */
37
+    /**
38
+     * Holds all the Open Graph values we've parsed from a page
39
+     *
40
+     */
41 41
     private $_values = array();
42 42
 
43
-  /**
44
-   * Fetches a URI and parses it for Open Graph data, returns
45
-   * false on error.
46
-   *
47
-   * @param $URI    URI to page to parse for Open Graph data
48
-   * @return OpenGraph
49
-   */
43
+    /**
44
+     * Fetches a URI and parses it for Open Graph data, returns
45
+     * false on error.
46
+     *
47
+     * @param $URI    URI to page to parse for Open Graph data
48
+     * @return OpenGraph
49
+     */
50 50
     static public function fetch($URI) {
51 51
         $curl = curl_init($URI);
52 52
 
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         }
70 70
     }
71 71
 
72
-  /**
73
-   * Parses HTML and extracts Open Graph data, this assumes
74
-   * the document is at least well formed.
75
-   *
76
-   * @param $HTML    HTML to parse
77
-   * @return OpenGraph
78
-   */
72
+    /**
73
+     * Parses HTML and extracts Open Graph data, this assumes
74
+     * the document is at least well formed.
75
+     *
76
+     * @param $HTML    HTML to parse
77
+     * @return OpenGraph
78
+     */
79 79
     static private function _parse($HTML) {
80 80
         $old_libxml_error = libxml_use_internal_errors(true);
81 81
 
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
         return $page;
141 141
     }
142 142
 
143
-  /**
144
-   * Helper method to access attributes directly
145
-   * Example:
146
-   * $graph->title
147
-   *
148
-   * @param $key    Key to fetch from the lookup
149
-   */
143
+    /**
144
+     * Helper method to access attributes directly
145
+     * Example:
146
+     * $graph->title
147
+     *
148
+     * @param $key    Key to fetch from the lookup
149
+     */
150 150
     public function __get($key) {
151 151
         if (array_key_exists($key, $this->_values)) {
152 152
             return $this->_values[$key];
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
         }
162 162
     }
163 163
 
164
-  /**
165
-   * Return all the keys found on the page
166
-   *
167
-   * @return array
168
-   */
164
+    /**
165
+     * Return all the keys found on the page
166
+     *
167
+     * @return array
168
+     */
169 169
     public function keys() {
170 170
         return array_keys($this->_values);
171 171
     }
172 172
 
173
-  /**
174
-   * Helper method to check an attribute exists
175
-   *
176
-   * @param $key
177
-   */
173
+    /**
174
+     * Helper method to check an attribute exists
175
+     *
176
+     * @param $key
177
+     */
178 178
     public function __isset($key) {
179 179
         return array_key_exists($key, $this->_values);
180 180
     }
181 181
 
182
-  /**
183
-   * Will return true if the page has location data embedded
184
-   *
185
-   * @return boolean Check if the page has location data
186
-   */
182
+    /**
183
+     * Will return true if the page has location data embedded
184
+     *
185
+     * @return boolean Check if the page has location data
186
+     */
187 187
     public function hasLocation() {
188 188
         if (array_key_exists('latitude', $this->_values) && array_key_exists('longitude', $this->_values)) {
189 189
             return true;
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         return $valid_address;
198 198
     }
199 199
 
200
-  /**
201
-   * Iterator code
202
-   */
200
+    /**
201
+     * Iterator code
202
+     */
203 203
     private $_position = 0;
204 204
     public function rewind() { reset($this->_values); $this->_position = 0; }
205 205
     public function current() { return current($this->_values); }
Please login to merge, or discard this patch.
main/inc/lib/events_dispatcher.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,9 +18,11 @@
 block discarded – undo
18 18
 
19 19
         foreach ($event_config[$event_name]["actions"] as $func) {
20 20
             $execute = true;
21
-            if (!function_exists($func)) // if the function doesn't exist, we log
21
+            if (!function_exists($func)) {
22
+                // if the function doesn't exist, we log
22 23
             {
23 24
                 error_log("EventsDispatcher warning : ".$func." does not exist.");
25
+            }
24 26
                 $execute = false;
25 27
             }
26 28
 
Please login to merge, or discard this patch.
main/inc/lib/auth.lib.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -379,7 +379,7 @@
 block discarded – undo
379 379
         $sql_delete = "DELETE FROM $tucc
380 380
                       WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
381 381
         $resultQuery = Database::query($sql_delete);
382
-       if (Database::affected_rows($resultQuery)) {
382
+        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
384 384
         }
385 385
         $sql = "UPDATE $TABLECOURSUSER
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
         $special_course_list = array();
47 47
         if (Database::num_rows($result) > 0) {
48 48
             while ($result_row = Database::fetch_array($result)) {
49
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
49
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
50 50
             }
51 51
         }
52 52
         $without_special_courses = '';
53 53
         if (!empty($special_course_list)) {
54
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
54
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
55 55
         }
56 56
 
57 57
         // Secondly we select the courses that are in a category (user_course_cat<>0) and sort these according to the sort of the category
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
                 FROM $TABLECOURS course, $TABLECOURSUSER  course_rel_user
71 71
                 WHERE
72 72
                     course.id = course_rel_user.c_id AND
73
-                    course_rel_user.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
74
-                    course_rel_user.user_id = '" . $user_id . "' $without_special_courses
73
+                    course_rel_user.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
74
+                    course_rel_user.user_id = '" . $user_id."' $without_special_courses
75 75
                 ORDER BY course_rel_user.sort ASC";
76 76
         $result = Database::query($sql);
77 77
         $courses = array();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         $user_id = api_get_user_id();
104 104
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
105
-        $sql = "SELECT * FROM " . $table_category . "
105
+        $sql = "SELECT * FROM ".$table_category."
106 106
                 WHERE user_id=$user_id
107 107
                 ORDER BY sort ASC";
108 108
         $result = Database::query($sql);
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
         $special_course_list = array();
145 145
         if (Database::num_rows($result) > 0) {
146 146
             while ($result_row = Database::fetch_array($result)) {
147
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
147
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
148 148
             }
149 149
         }
150 150
 
151 151
         $without_special_courses = '';
152 152
         if (!empty($special_course_list)) {
153
-            $without_special_courses = ' AND course.id NOT IN (' . implode(',', $special_course_list) . ')';
153
+            $without_special_courses = ' AND course.id NOT IN ('.implode(',', $special_course_list).')';
154 154
         }
155 155
 
156 156
         $sql = "SELECT
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $TABLECOURSUSER  course_rel_user
162 162
                 WHERE
163 163
                     course.id = course_rel_user.c_id AND
164
-                    course_rel_user.user_id = '" . $user_id . "' AND
165
-                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH . "
164
+                    course_rel_user.user_id = '".$user_id."' AND
165
+                    course_rel_user.relation_type <> " . COURSE_RELATION_TYPE_RRHH."
166 166
                     $without_special_courses
167 167
                 ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC";
168 168
         $result = Database::query($sql);
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
         $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
192 192
         $max_sort_value = api_max_sort_value($newcategory, $current_user);
193 193
         $sql = "UPDATE $TABLECOURSUSER SET
194
-                    user_course_cat='" . $newcategory . "',
195
-                    sort='" . ($max_sort_value + 1) . "'
194
+                    user_course_cat='".$newcategory."',
195
+                    sort='" . ($max_sort_value + 1)."'
196 196
                 WHERE
197
-                    c_id ='" . $courseId . "' AND
198
-                    user_id='" . $current_user . "' AND
197
+                    c_id ='" . $courseId."' AND
198
+                    user_id='" . $current_user."' AND
199 199
                     relation_type<>" . COURSE_RELATION_TYPE_RRHH;
200 200
         $resultQuery = Database::query($sql);
201 201
 
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
             $targetCourseId = $targetCourseInfo['real_id'];
255 255
 
256 256
             $sql = "UPDATE $table
257
-                    SET sort='" . $target_course['sort'] . "'
257
+                    SET sort='".$target_course['sort']."'
258 258
                     WHERE
259
-                        c_id = '" . $courseId . "' AND
260
-                        user_id = '" . $current_user_id . "' AND
259
+                        c_id = '" . $courseId."' AND
260
+                        user_id = '" . $current_user_id."' AND
261 261
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
262 262
 
263 263
             $result1 = Database::query($sql);
264 264
 
265
-            $sql = "UPDATE $table SET sort='" . $source_course['sort'] . "'
265
+            $sql = "UPDATE $table SET sort='".$source_course['sort']."'
266 266
                     WHERE
267
-                        c_id ='" . $targetCourseId . "' AND
268
-                        user_id='" . $current_user_id . "' AND
267
+                        c_id ='" . $targetCourseId."' AND
268
+                        user_id='" . $current_user_id."' AND
269 269
                         relation_type<>" . COURSE_RELATION_TYPE_RRHH;
270 270
 
271 271
             $result2 = Database::query($sql);
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
         }
310 310
 
311 311
         if (count($target_category) > 0 && count($source_category) > 0) {
312
-            $sql_update1 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($target_category['sort']) . "'
313
-                            WHERE id='" . intval($source_category['id']) . "' AND user_id='" . $current_user_id . "'";
314
-            $sql_update2 = "UPDATE $table_user_defined_category SET sort='" . Database::escape_string($source_category['sort']) . "'
315
-                            WHERE id='" . intval($target_category['id']) . "' AND user_id='" . $current_user_id . "'";
312
+            $sql_update1 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($target_category['sort'])."'
313
+                            WHERE id='" . intval($source_category['id'])."' AND user_id='".$current_user_id."'";
314
+            $sql_update2 = "UPDATE $table_user_defined_category SET sort='".Database::escape_string($source_category['sort'])."'
315
+                            WHERE id='" . intval($target_category['id'])."' AND user_id='".$current_user_id."'";
316 316
 
317 317
             $result1 = Database::query($sql_update2);
318 318
             $result2 = Database::query($sql_update1);
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
     {
332 332
         $current_user_id = api_get_user_id();
333 333
         $table_category = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
334
-        $sql = "SELECT * FROM " . $table_category . "
335
-                WHERE user_id='" . $current_user_id . "'
334
+        $sql = "SELECT * FROM ".$table_category."
335
+                WHERE user_id='" . $current_user_id."'
336 336
                 ORDER BY sort ASC";
337 337
         $result = Database::query($sql);
338 338
         while ($row = Database::fetch_array($result)) {
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
         $result = false;
356 356
         $tucc = Database::get_main_table(TABLE_USER_COURSE_CATEGORY);
357 357
         $sql = "UPDATE $tucc
358
-                SET title='" . api_htmlentities($title, ENT_QUOTES, api_get_system_encoding()) . "'
359
-                WHERE id='" . $category_id . "'";
358
+                SET title='".api_htmlentities($title, ENT_QUOTES, api_get_system_encoding())."'
359
+                WHERE id='" . $category_id."'";
360 360
         $resultQuery = Database::query($sql);
361 361
         if (Database::affected_rows($resultQuery)) {
362 362
             $result = true;
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         $category_id = intval($category_id);
378 378
         $result = false;
379 379
         $sql_delete = "DELETE FROM $tucc
380
-                      WHERE id='" . $category_id . "' and user_id='" . $current_user_id . "'";
380
+                      WHERE id='".$category_id."' and user_id='".$current_user_id."'";
381 381
         $resultQuery = Database::query($sql_delete);
382 382
        if (Database::affected_rows($resultQuery)) {
383 383
             $result = true;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
         $sql = "UPDATE $TABLECOURSUSER
386 386
                 SET user_course_cat='0'
387 387
                 WHERE
388
-                    user_course_cat='" . $category_id . "' AND
389
-                    user_id='" . $current_user_id . "' AND
390
-                    relation_type<>" . COURSE_RELATION_TYPE_RRHH . " ";
388
+                    user_course_cat='".$category_id."' AND
389
+                    user_id='" . $current_user_id."' AND
390
+                    relation_type<>" . COURSE_RELATION_TYPE_RRHH." ";
391 391
         Database::query($sql);
392 392
 
393 393
         return $result;
@@ -420,20 +420,20 @@  discard block
 block discarded – undo
420 420
         if (Database::num_rows($special_course_result) > 0) {
421 421
             $special_course_list = array();
422 422
             while ($result_row = Database::fetch_array($special_course_result)) {
423
-                $special_course_list[] = '"' . $result_row['item_id'] . '"';
423
+                $special_course_list[] = '"'.$result_row['item_id'].'"';
424 424
             }
425 425
         }
426 426
         $without_special_courses = '';
427 427
         if (!empty($special_course_list)) {
428
-            $without_special_courses = ' AND course.code NOT IN (' . implode(',', $special_course_list) . ')';
428
+            $without_special_courses = ' AND course.code NOT IN ('.implode(',', $special_course_list).')';
429 429
         }
430 430
 
431 431
         $search_term_safe = Database::escape_string($search_term);
432 432
         $sql_find = "SELECT * FROM $courseTable
433 433
                     WHERE (
434
-                            code LIKE '%" . $search_term_safe . "%' OR
435
-                            title LIKE '%" . $search_term_safe . "%' OR
436
-                            tutor_name LIKE '%" . $search_term_safe . "%'
434
+                            code LIKE '%".$search_term_safe."%' OR
435
+                            title LIKE '%" . $search_term_safe."%' OR
436
+                            tutor_name LIKE '%" . $search_term_safe."%'
437 437
                         )
438 438
                         $without_special_courses
439 439
                     ORDER BY title, visual_code ASC
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
                             ON (url_rel_course.c_id = course.id)
451 451
                             WHERE
452 452
                                 access_url_id = $url_access_id AND (
453
-                                    code LIKE '%" . $search_term_safe . "%' OR
454
-                                    title LIKE '%" . $search_term_safe . "%' OR
455
-                                    tutor_name LIKE '%" . $search_term_safe . "%'
453
+                                    code LIKE '%".$search_term_safe."%' OR
454
+                                    title LIKE '%" . $search_term_safe."%' OR
455
+                                    tutor_name LIKE '%" . $search_term_safe."%'
456 456
                                 )
457 457
                                 $without_special_courses
458 458
                             ORDER BY title, visual_code ASC
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
         // (s)he can only delete the course
514 514
         $sql = "SELECT * FROM $tbl_course_user
515 515
                 WHERE
516
-                    user_id='" . $current_user_id . "' AND
517
-                    c_id ='" . $courseId . "' AND
516
+                    user_id='".$current_user_id."' AND
517
+                    c_id ='" . $courseId."' AND
518 518
                     status='1' ";
519 519
         $result_check = Database::query($sql);
520 520
         $number_of_rows = Database::num_rows($result_check);
@@ -541,17 +541,17 @@  discard block
 block discarded – undo
541 541
         $result = false;
542 542
 
543 543
         // step 1: we determine the max value of the user defined course categories
544
-        $sql = "SELECT sort FROM $tucc WHERE user_id='" . $current_user_id . "' ORDER BY sort DESC";
544
+        $sql = "SELECT sort FROM $tucc WHERE user_id='".$current_user_id."' ORDER BY sort DESC";
545 545
         $rs_sort = Database::query($sql);
546 546
         $maxsort = Database::fetch_array($rs_sort);
547 547
         $nextsort = $maxsort['sort'] + 1;
548 548
 
549 549
         // step 2: we check if there is already a category with this name, if not we store it, else we give an error.
550
-        $sql = "SELECT * FROM $tucc WHERE user_id='" . $current_user_id . "' AND title='" . $category_title . "'ORDER BY sort DESC";
550
+        $sql = "SELECT * FROM $tucc WHERE user_id='".$current_user_id."' AND title='".$category_title."'ORDER BY sort DESC";
551 551
         $rs = Database::query($sql);
552 552
         if (Database::num_rows($rs) == 0) {
553 553
             $sql_insert = "INSERT INTO $tucc (user_id, title,sort)
554
-                           VALUES ('" . $current_user_id . "', '" . api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding()) . "', '" . $nextsort . "')";
554
+                           VALUES ('".$current_user_id."', '".api_htmlentities($category_title, ENT_QUOTES, api_get_system_encoding())."', '".$nextsort."')";
555 555
             $resultQuery = Database::query($sql_insert);
556 556
             if (Database::affected_rows($resultQuery)) {
557 557
                 $result = true;
@@ -628,10 +628,10 @@  discard block
 block discarded – undo
628 628
             if (isset($_POST['course_registration_code']) && $_POST['course_registration_code'] != $all_course_information['registration_code']) {
629 629
                 return false;
630 630
             }
631
-            $message = get_lang('CourseRequiresPassword') . '<br />';
631
+            $message = get_lang('CourseRequiresPassword').'<br />';
632 632
             $message .= $all_course_information['title'].' ('.$all_course_information['visual_code'].') ';
633 633
 
634
-            $action  = api_get_path(WEB_CODE_PATH) . "auth/courses.php?action=subscribe_user_with_password&sec_token=" . $_SESSION['sec_token'];
634
+            $action  = api_get_path(WEB_CODE_PATH)."auth/courses.php?action=subscribe_user_with_password&sec_token=".$_SESSION['sec_token'];
635 635
             $form = new FormValidator('subscribe_user_with_password', 'post', $action);
636 636
             $form->addElement('hidden', 'sec_token', $_SESSION['sec_token']);
637 637
             $form->addElement('hidden', 'subscribe_user_with_password', $all_course_information['code']);
Please login to merge, or discard this patch.