Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/inc/lib/formvalidator/Rule/HTML.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function validate($html, $mode = NO_HTML)
18 18
     {
19
-        $allowed_tags = self::get_allowed_tags ($mode, $fullpage);
19
+        $allowed_tags = self::get_allowed_tags($mode, $fullpage);
20 20
         $cleaned_html = kses($html, $allowed_tags);
21 21
         return $html == $cleaned_html;
22 22
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         // Include the allowed tags.
34 34
         //include(dirname(__FILE__).'/allowed_tags.inc.php');
35 35
         global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page;
36
-        switch($mode)
36
+        switch ($mode)
37 37
         {
38 38
             case NO_HTML:
39 39
                 return array();
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MultipleRequired.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
30
+    	if (is_array($value))
31 31
     	{
32
-    		$value = implode(null,$value);
32
+    		$value = implode(null, $value);
33 33
     	}
34
-        if ((string)$value == '') {
34
+        if ((string) $value == '') {
35 35
             return false;
36 36
         }
37 37
         return true;
Please login to merge, or discard this patch.
main/inc/lib/events_email.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
                 // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
126 126
                 if ($event_config[$event_name]["sending_mail_once"]) {
127
-                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
127
+                    $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name)
128 128
                             VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
129 129
                     ';
130 130
                     Database::query($sql);
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
         // Second, we send to people linked to the event
136 136
         // So, we get everyone
137 137
         $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
138
-                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
138
+                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue
139 139
                 INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
140
-                WHERE event_type_name = "' . $event_name . '"';
140
+                WHERE event_type_name = "' . $event_name.'"';
141 141
         $result = Database::store_result(Database::query($sql), 'ASSOC');
142 142
         // for each of the linked users
143 143
         foreach ($result as $key => $value) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
             // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
179 179
             if ($event_config[$event_name]["sending_mail_once"]) {
180
-                $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
180
+                $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).'
181 181
                     (user_from, user_to, event_type_name)
182 182
                     VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
183 183
                     ';
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
         $current_language = api_get_interface_language();
203 203
 
204 204
         $sql = 'SELECT COUNT(*) as total
205
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
206
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
205
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
206
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
207 207
                 ON em.language_id = l.id
208 208
                 WHERE
209
-                    em.event_type_name = "' . $event_name . '" and
209
+                    em.event_type_name = "' . $event_name.'" and
210 210
                     l.dokeos_folder = "'.$current_language.'" and
211 211
                     em.activated = 1';
212 212
 
213 213
         $exists = Database::store_result(Database::query($sql), 'ASSOC');
214
-        if ($exists[0]["total"])  {
214
+        if ($exists[0]["total"]) {
215 215
             return true;
216 216
         } else {
217 217
             return false;
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
     private static function getMessage($event_name, $language)
229 229
     {
230 230
         $sql = 'SELECT message, subject, l.dokeos_folder
231
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
232
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
231
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
232
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
233 233
                 ON em.language_id = l.id
234 234
                 WHERE
235
-                    em.event_type_name = "' . $event_name . '" AND
236
-                    (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
235
+                    em.event_type_name = "' . $event_name.'" AND
236
+                    (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND
237 237
                     em.message <> ""
238 238
                 ';
239 239
         return Database::store_result(Database::query($sql), 'ASSOC');
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
275 275
     {
276 276
         foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
277
-            $message = str_replace('((' . $key . '))', $event_data[$word], $message);
278
-            $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
277
+            $message = str_replace('(('.$key.'))', $event_data[$word], $message);
278
+            $subject = str_replace('(('.$key.'))', $event_data[$word], $subject);
279 279
         }
280 280
     }
281 281
 }
Please login to merge, or discard this patch.
main/inc/lib/security.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $rel_path = '/'.$rel_path;
92 92
         }
93 93
         $abs_path = $current_path.$rel_path;
94
-        $true_path=str_replace("\\", '/', realpath($abs_path));
94
+        $true_path = str_replace("\\", '/', realpath($abs_path));
95 95
         $found = strpos($true_path.'/', $checker_path);
96 96
         if ($found === 0) {
97 97
             return true;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         }
322 322
 
323 323
         if ($user_status == COURSEMANAGERLOWSECURITY) {
324
-            return $var;  // No filtering.
324
+            return $var; // No filtering.
325 325
         }
326 326
 
327 327
         static $purifier = array();
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             }
345 345
 
346 346
             // Shows _target attribute in anchors
347
-            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent'));
347
+            $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent'));
348 348
 
349 349
             if ($user_status == STUDENT) {
350 350
                 global $allowed_html_student;
Please login to merge, or discard this patch.
main/inc/lib/access_url_edit_users_to_url_functions.lib.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,22 +43,22 @@
 block discarded – undo
43 43
                    ' WHERE (username LIKE "'.$needle.'%" '.
44 44
                    ' OR firstname LIKE "'.$needle.'%" '.
45 45
                    ' OR lastname LIKE "'.$needle.'%") '.
46
-                    $order_clause .
46
+                    $order_clause.
47 47
                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50
-            $i=0;
50
+            $i = 0;
51 51
 
52 52
             while ($user = Database :: fetch_array($rs)) {
53 53
                 $i++;
54
-                if ($i<=10) {
54
+                if ($i <= 10) {
55 55
                     $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
56 56
                 } else {
57 57
                     $return .= '...<br />';
58 58
                 }
59 59
             }
60 60
         }
61
-        $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return));
61
+        $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
62 62
         return $xajax_response;
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
main/inc/lib/nusoap/nusoapmime.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	* @access public
87 87
 	*/
88 88
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
89
-		if (! $cid) {
89
+		if (!$cid) {
90 90
 			$cid = md5(uniqid(time()));
91 91
 		}
92 92
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	* @access   private
222 222
 	*/
223 223
     function parseResponse($headers, $data) {
224
-		$this->debug('Entering parseResponse() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
224
+		$this->debug('Entering parseResponse() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
225 225
 		$this->responseAttachments = array();
226 226
 		if (strstr($headers['content-type'], 'multipart/related')) {
227 227
 			$this->debug('Decode multipart/related');
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			foreach ($headers as $k => $v) {
230 230
 				$input .= "$k: $v\r\n";
231 231
 			}
232
-			$params['input'] = $input . "\r\n" . $data;
232
+			$params['input'] = $input."\r\n".$data;
233 233
 			$params['include_bodies'] = true;
234 234
 			$params['decode_bodies'] = true;
235 235
 			$params['decode_headers'] = true;
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
 
239 239
 			foreach ($structure->parts as $part) {
240 240
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
241
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
241
+					$this->debug('Have root part of type '.$part->headers['content-type']);
242 242
 					$root = $part->body;
243 243
 					$return = parent::parseResponse($part->headers, $part->body);
244 244
 				} else {
245
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
245
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
246 246
 					$info['data'] = $part->body;
247 247
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
248 248
 					$info['contenttype'] = $part->headers['content-type'];
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	* @access public
317 317
 	*/
318 318
 	function addAttachment($data, $filename = '', $contenttype = 'application/octet-stream', $cid = false) {
319
-		if (! $cid) {
319
+		if (!$cid) {
320 320
 			$cid = md5(uniqid(time()));
321 321
 		}
322 322
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	* @access   private
452 452
 	*/
453 453
     function parseRequest($headers, $data) {
454
-		$this->debug('Entering parseRequest() for payload of length ' . strlen($data) . ' and type of ' . $headers['content-type']);
454
+		$this->debug('Entering parseRequest() for payload of length '.strlen($data).' and type of '.$headers['content-type']);
455 455
 		$this->requestAttachments = array();
456 456
 		if (strstr($headers['content-type'], 'multipart/related')) {
457 457
 			$this->debug('Decode multipart/related');
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			foreach ($headers as $k => $v) {
460 460
 				$input .= "$k: $v\r\n";
461 461
 			}
462
-			$params['input'] = $input . "\r\n" . $data;
462
+			$params['input'] = $input."\r\n".$data;
463 463
 			$params['include_bodies'] = true;
464 464
 			$params['decode_bodies'] = true;
465 465
 			$params['decode_headers'] = true;
@@ -468,10 +468,10 @@  discard block
 block discarded – undo
468 468
 
469 469
 			foreach ($structure->parts as $part) {
470 470
 				if (!isset($part->disposition) && (strstr($part->headers['content-type'], 'text/xml'))) {
471
-					$this->debug('Have root part of type ' . $part->headers['content-type']);
471
+					$this->debug('Have root part of type '.$part->headers['content-type']);
472 472
 					$return = parent::parseRequest($part->headers, $part->body);
473 473
 				} else {
474
-					$this->debug('Have an attachment of type ' . $part->headers['content-type']);
474
+					$this->debug('Have an attachment of type '.$part->headers['content-type']);
475 475
 					$info['data'] = $part->body;
476 476
 					$info['filename'] = isset($part->d_parameters['filename']) ? $part->d_parameters['filename'] : '';
477 477
 					$info['contenttype'] = $part->headers['content-type'];
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.nusoap_base.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -183,26 +183,26 @@  discard block
 block discarded – undo
183 183
 	*/
184 184
 	var $typemap = array(
185 185
 	'http://www.w3.org/2001/XMLSchema' => array(
186
-		'string'=>'string','boolean'=>'boolean','float'=>'double','double'=>'double','decimal'=>'double',
187
-		'duration'=>'','dateTime'=>'string','time'=>'string','date'=>'string','gYearMonth'=>'',
188
-		'gYear'=>'','gMonthDay'=>'','gDay'=>'','gMonth'=>'','hexBinary'=>'string','base64Binary'=>'string',
186
+		'string'=>'string', 'boolean'=>'boolean', 'float'=>'double', 'double'=>'double', 'decimal'=>'double',
187
+		'duration'=>'', 'dateTime'=>'string', 'time'=>'string', 'date'=>'string', 'gYearMonth'=>'',
188
+		'gYear'=>'', 'gMonthDay'=>'', 'gDay'=>'', 'gMonth'=>'', 'hexBinary'=>'string', 'base64Binary'=>'string',
189 189
 		// abstract "any" types
190
-		'anyType'=>'string','anySimpleType'=>'string',
190
+		'anyType'=>'string', 'anySimpleType'=>'string',
191 191
 		// derived datatypes
192
-		'normalizedString'=>'string','token'=>'string','language'=>'','NMTOKEN'=>'','NMTOKENS'=>'','Name'=>'','NCName'=>'','ID'=>'',
193
-		'IDREF'=>'','IDREFS'=>'','ENTITY'=>'','ENTITIES'=>'','integer'=>'integer','nonPositiveInteger'=>'integer',
194
-		'negativeInteger'=>'integer','long'=>'integer','int'=>'integer','short'=>'integer','byte'=>'integer','nonNegativeInteger'=>'integer',
195
-		'unsignedLong'=>'','unsignedInt'=>'','unsignedShort'=>'','unsignedByte'=>'','positiveInteger'=>''),
192
+		'normalizedString'=>'string', 'token'=>'string', 'language'=>'', 'NMTOKEN'=>'', 'NMTOKENS'=>'', 'Name'=>'', 'NCName'=>'', 'ID'=>'',
193
+		'IDREF'=>'', 'IDREFS'=>'', 'ENTITY'=>'', 'ENTITIES'=>'', 'integer'=>'integer', 'nonPositiveInteger'=>'integer',
194
+		'negativeInteger'=>'integer', 'long'=>'integer', 'int'=>'integer', 'short'=>'integer', 'byte'=>'integer', 'nonNegativeInteger'=>'integer',
195
+		'unsignedLong'=>'', 'unsignedInt'=>'', 'unsignedShort'=>'', 'unsignedByte'=>'', 'positiveInteger'=>''),
196 196
 	'http://www.w3.org/2000/10/XMLSchema' => array(
197
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
198
-		'float'=>'double','dateTime'=>'string',
199
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
197
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
198
+		'float'=>'double', 'dateTime'=>'string',
199
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
200 200
 	'http://www.w3.org/1999/XMLSchema' => array(
201
-		'i4'=>'','int'=>'integer','boolean'=>'boolean','string'=>'string','double'=>'double',
202
-		'float'=>'double','dateTime'=>'string',
203
-		'timeInstant'=>'string','base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
201
+		'i4'=>'', 'int'=>'integer', 'boolean'=>'boolean', 'string'=>'string', 'double'=>'double',
202
+		'float'=>'double', 'dateTime'=>'string',
203
+		'timeInstant'=>'string', 'base64Binary'=>'string', 'base64'=>'string', 'ur-type'=>'array'),
204 204
 	'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
205
-	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
205
+	'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string', 'array'=>'array', 'Array'=>'array'),
206 206
     'http://xml.apache.org/xml-soap' => array('Map')
207 207
 	);
208 208
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	* @deprecated
215 215
 	* @see	expandEntities
216 216
 	*/
217
-	var $xmlEntities = array('quot' => '"','amp' => '&',
218
-		'lt' => '<','gt' => '>','apos' => "'");
217
+	var $xmlEntities = array('quot' => '"', 'amp' => '&',
218
+		'lt' => '<', 'gt' => '>', 'apos' => "'");
219 219
 
220 220
 	/**
221 221
 	* constructor
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	* @param    string $string debug data
273 273
 	* @access   private
274 274
 	*/
275
-	function debug($string){
275
+	function debug($string) {
276 276
 		if ($this->debugLevel > 0) {
277 277
 			$this->appendDebug($this->getmicrotime().' '.get_class($this).": $string\n");
278 278
 		}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	* @param    string $string debug data
285 285
 	* @access   public
286 286
 	*/
287
-	function appendDebug($string){
287
+	function appendDebug($string) {
288 288
 		if ($this->debugLevel > 0) {
289 289
 			// it would be nice to use a memory stream here to use
290 290
 			// memory more efficiently
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		while (strpos($this->debug_str, '--')) {
329 329
 			$this->debug_str = str_replace('--', '- -', $this->debug_str);
330 330
 		}
331
-		$ret = "<!--\n" . $this->debug_str . "\n-->";
331
+		$ret = "<!--\n".$this->debug_str."\n-->";
332 332
     	return $ret;
333 333
 	}
334 334
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* @return   mixed error string or false
356 356
 	* @access   public
357 357
 	*/
358
-	function getError(){
359
-		if($this->error_str != ''){
358
+	function getError() {
359
+		if ($this->error_str != '') {
360 360
 			return $this->error_str;
361 361
 		}
362 362
 		return false;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	* @return   boolean $string error string
369 369
 	* @access   private
370 370
 	*/
371
-	function setError($str){
371
+	function setError($str) {
372 372
 		$this->error_str = $str;
373 373
 	}
374 374
 
@@ -404,12 +404,12 @@  discard block
 block discarded – undo
404 404
 	* @return	string	The serialized element, possibly with child elements
405 405
     * @access	public
406 406
 	*/
407
-	function serialize_val($val,$name=false,$type=false,$name_ns=false,$type_ns=false,$attributes=false,$use='encoded',$soapval=false) {
407
+	function serialize_val($val, $name = false, $type = false, $name_ns = false, $type_ns = false, $attributes = false, $use = 'encoded', $soapval = false) {
408 408
 		$this->debug("in serialize_val: name=$name, type=$type, name_ns=$name_ns, type_ns=$type_ns, use=$use, soapval=$soapval");
409
-		$this->appendDebug('value=' . $this->varDump($val));
410
-		$this->appendDebug('attributes=' . $this->varDump($attributes));
409
+		$this->appendDebug('value='.$this->varDump($val));
410
+		$this->appendDebug('attributes='.$this->varDump($attributes));
411 411
 
412
-    	if (is_object($val) && get_class($val) == 'soapval' && (! $soapval)) {
412
+    	if (is_object($val) && get_class($val) == 'soapval' && (!$soapval)) {
413 413
     		$this->debug("serialize_val: serialize soapval");
414 414
         	$xml = $val->serialize($use);
415 415
 			$this->appendDebug($val->getDebug());
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
         }
420 420
 		// force valid name if necessary
421 421
 		if (is_numeric($name)) {
422
-			$name = '__numeric_' . $name;
423
-		} elseif (! $name) {
422
+			$name = '__numeric_'.$name;
423
+		} elseif (!$name) {
424 424
 			$name = 'noname';
425 425
 		}
426 426
 		// if name has ns, add ns prefix to name
427 427
 		$xmlns = '';
428
-        if($name_ns){
429
-			$prefix = 'nu'.rand(1000,9999);
428
+        if ($name_ns) {
429
+			$prefix = 'nu'.rand(1000, 9999);
430 430
 			$name = $prefix.':'.$name;
431 431
 			$xmlns .= " xmlns:$prefix=\"$name_ns\"";
432 432
 		}
433 433
 		// if type is prefixed, create type prefix
434
-		if($type_ns != '' && $type_ns == $this->namespaces['xsd']){
434
+		if ($type_ns != '' && $type_ns == $this->namespaces['xsd']) {
435 435
 			// need to fix this. shouldn't default to xsd if no ns specified
436 436
 		    // w/o checking against typemap
437 437
 			$type_prefix = 'xsd';
438
-		} elseif($type_ns){
439
-			$type_prefix = 'ns'.rand(1000,9999);
438
+		} elseif ($type_ns) {
439
+			$type_prefix = 'ns'.rand(1000, 9999);
440 440
 			$xmlns .= " xmlns:$type_prefix=\"$type_ns\"";
441 441
 		}
442 442
 		// serialize attributes if present
443 443
 		$atts = '';
444
-		if($attributes){
445
-			foreach($attributes as $k => $v){
444
+		if ($attributes) {
445
+			foreach ($attributes as $k => $v) {
446 446
 				$atts .= " $k=\"".$this->expandEntities($v).'"';
447 447
 			}
448 448
 		}
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
         	}
467 467
 		}
468 468
         // serialize if an xsd built-in primitive type
469
-        if($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])){
469
+        if ($type != '' && isset($this->typemap[$this->XMLSchemaVersion][$type])) {
470 470
     		$this->debug("serialize_val: serialize xsd built-in primitive type");
471 471
         	if (is_bool($val)) {
472 472
         		if ($type == 'boolean') {
473 473
 	        		$val = $val ? 'true' : 'false';
474
-	        	} elseif (! $val) {
474
+	        	} elseif (!$val) {
475 475
 	        		$val = 0;
476 476
 	        	}
477 477
 			} else if (is_string($val)) {
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
         }
490 490
 		// detect type and serialize
491 491
 		$xml = '';
492
-		switch(true) {
492
+		switch (true) {
493 493
 			case (is_bool($val) || $type == 'boolean'):
494 494
 		   		$this->debug("serialize_val: serialize boolean");
495 495
         		if ($type == 'boolean') {
496 496
 	        		$val = $val ? 'true' : 'false';
497
-	        	} elseif (! $val) {
497
+	        	} elseif (!$val) {
498 498
 	        		$val = 0;
499 499
 	        	}
500 500
 				if ($use == 'literal') {
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 					$xml .= "<$name$xmlns xsi:type=\"xsd:int\"$atts>$val</$name>";
512 512
 				}
513 513
 				break;
514
-			case (is_float($val)|| is_double($val) || $type == 'float'):
514
+			case (is_float($val) || is_double($val) || $type == 'float'):
515 515
 		   		$this->debug("serialize_val: serialize float");
516 516
 				if ($use == 'literal') {
517 517
 					$xml .= "<$name$xmlns$atts>$val</$name>";
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 					$this->appendDebug($val->getDebug());
537 537
 					$val->clearDebug();
538 538
 		        } else {
539
-					if (! $name) {
539
+					if (!$name) {
540 540
 						$name = get_class($val);
541 541
 						$this->debug("In serialize_val, used class name $name as element name");
542 542
 					} else {
543
-						$this->debug("In serialize_val, do not override name $name for element name for class " . get_class($val));
543
+						$this->debug("In serialize_val, do not override name $name for element name for class ".get_class($val));
544 544
 					}
545
-					foreach(get_object_vars($val) as $k => $v){
546
-						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v,$k,false,false,false,false,$use) : $this->serialize_val($v,$k,false,false,false,false,$use);
545
+					foreach (get_object_vars($val) as $k => $v) {
546
+						$pXml = isset($pXml) ? $pXml.$this->serialize_val($v, $k, false, false, false, false, $use) : $this->serialize_val($v, $k, false, false, false, false, $use);
547 547
 					}
548 548
 				}
549
-				if(isset($type) && isset($type_prefix)){
549
+				if (isset($type) && isset($type_prefix)) {
550 550
 					$type_str = " xsi:type=\"$type_prefix:$type\"";
551 551
 				} else {
552 552
 					$type_str = '';
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
 			case (is_array($val) || $type):
562 562
 				// detect if struct or array
563 563
 				$valueType = $this->isArraySimpleOrStruct($val);
564
-                if($valueType=='arraySimple' || preg_match('/^ArrayOf/',$type)){
564
+                if ($valueType == 'arraySimple' || preg_match('/^ArrayOf/', $type)) {
565 565
 			   		$this->debug("serialize_val: serialize array");
566 566
 					$i = 0;
567
-					if(is_array($val) && count($val)> 0){
568
-						foreach($val as $v){
569
-	                    	if(is_object($v) && get_class($v) ==  'soapval'){
567
+					if (is_array($val) && count($val) > 0) {
568
+						foreach ($val as $v) {
569
+	                    	if (is_object($v) && get_class($v) == 'soapval') {
570 570
 								$tt_ns = $v->type_ns;
571 571
 								$tt = $v->type;
572 572
 							} elseif (is_array($v)) {
@@ -576,26 +576,26 @@  discard block
 block discarded – undo
576 576
 	                        }
577 577
 							$array_types[$tt] = 1;
578 578
 							// TODO: for literal, the name should be $name
579
-							$xml .= $this->serialize_val($v,'item',false,false,false,false,$use);
579
+							$xml .= $this->serialize_val($v, 'item', false, false, false, false, $use);
580 580
 							++$i;
581 581
 						}
582
-						if(count($array_types) > 1){
582
+						if (count($array_types) > 1) {
583 583
 							$array_typename = 'xsd:anyType';
584
-						} elseif(isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
584
+						} elseif (isset($tt) && isset($this->typemap[$this->XMLSchemaVersion][$tt])) {
585 585
 							if ($tt == 'integer') {
586 586
 								$tt = 'int';
587 587
 							}
588 588
 							$array_typename = 'xsd:'.$tt;
589
-						} elseif(isset($tt) && $tt == 'arraySimple'){
589
+						} elseif (isset($tt) && $tt == 'arraySimple') {
590 590
 							$array_typename = 'SOAP-ENC:Array';
591
-						} elseif(isset($tt) && $tt == 'arrayStruct'){
591
+						} elseif (isset($tt) && $tt == 'arrayStruct') {
592 592
 							$array_typename = 'unnamed_struct_use_soapval';
593 593
 						} else {
594 594
 							// if type is prefixed, create type prefix
595
-							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']){
596
-								 $array_typename = 'xsd:' . $tt;
595
+							if ($tt_ns != '' && $tt_ns == $this->namespaces['xsd']) {
596
+								 $array_typename = 'xsd:'.$tt;
597 597
 							} elseif ($tt_ns) {
598
-								$tt_prefix = 'ns' . rand(1000, 9999);
598
+								$tt_prefix = 'ns'.rand(1000, 9999);
599 599
 								$array_typename = "$tt_prefix:$tt";
600 600
 								$xmlns .= " xmlns:$tt_prefix=\"$tt_ns\"";
601 601
 							} else {
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 				} else {
626 626
 					// got a struct
627 627
 			   		$this->debug("serialize_val: serialize struct");
628
-					if(isset($type) && isset($type_prefix)){
628
+					if (isset($type) && isset($type_prefix)) {
629 629
 						$type_str = " xsi:type=\"$type_prefix:$type\"";
630 630
 					} else {
631 631
 						$type_str = '';
@@ -635,15 +635,15 @@  discard block
 block discarded – undo
635 635
 					} else {
636 636
 						$xml .= "<$name$xmlns$type_str$atts>";
637 637
 					}
638
-					foreach($val as $k => $v){
638
+					foreach ($val as $k => $v) {
639 639
 						// Apache Map
640 640
 						if ($type == 'Map' && $type_ns == 'http://xml.apache.org/xml-soap') {
641 641
 							$xml .= '<item>';
642
-							$xml .= $this->serialize_val($k,'key',false,false,false,false,$use);
643
-							$xml .= $this->serialize_val($v,'value',false,false,false,false,$use);
642
+							$xml .= $this->serialize_val($k, 'key', false, false, false, false, $use);
643
+							$xml .= $this->serialize_val($v, 'value', false, false, false, false, $use);
644 644
 							$xml .= '</item>';
645 645
 						} else {
646
-							$xml .= $this->serialize_val($v,$k,false,false,false,false,$use);
646
+							$xml .= $this->serialize_val($v, $k, false, false, false, false, $use);
647 647
 						}
648 648
 					}
649 649
 					$xml .= "</$name>";
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
     * @return string the message
671 671
     * @access public
672 672
     */
673
-    function serializeEnvelope($body,$headers=false,$namespaces=array(),$style='rpc',$use='encoded',$encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'){
673
+    function serializeEnvelope($body, $headers = false, $namespaces = array(), $style = 'rpc', $use = 'encoded', $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/') {
674 674
     // TODO: add an option to automatically run utf8_encode on $body and $headers
675 675
     // if $this->soap_defencoding is UTF-8.  Not doing this automatically allows
676 676
     // one to send arbitrary UTF-8 characters, not just characters that map to ISO-8859-1
677 677
 
678
-	$this->debug("In serializeEnvelope length=" . strlen($body) . " body (max 1000 characters)=" . substr($body, 0, 1000) . " style=$style use=$use encodingStyle=$encodingStyle");
678
+	$this->debug("In serializeEnvelope length=".strlen($body)." body (max 1000 characters)=".substr($body, 0, 1000)." style=$style use=$use encodingStyle=$encodingStyle");
679 679
 	$this->debug("headers:");
680 680
 	$this->appendDebug($this->varDump($headers));
681 681
 	$this->debug("namespaces:");
@@ -683,15 +683,15 @@  discard block
 block discarded – undo
683 683
 
684 684
 	// serialize namespaces
685 685
     $ns_string = '';
686
-	foreach(array_merge($this->namespaces,$namespaces) as $k => $v){
686
+	foreach (array_merge($this->namespaces, $namespaces) as $k => $v) {
687 687
 		$ns_string .= " xmlns:$k=\"$v\"";
688 688
 	}
689
-	if($encodingStyle) {
689
+	if ($encodingStyle) {
690 690
 		$ns_string = " SOAP-ENV:encodingStyle=\"$encodingStyle\"$ns_string";
691 691
 	}
692 692
 
693 693
 	// serialize headers
694
-	if($headers){
694
+	if ($headers) {
695 695
 		if (is_array($headers)) {
696 696
 			$xml = '';
697 697
 			foreach ($headers as $k => $v) {
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	}
709 709
 	// serialize envelope
710 710
 	return
711
-	'<?xml version="1.0" encoding="'.$this->soap_defencoding .'"?'.">".
711
+	'<?xml version="1.0" encoding="'.$this->soap_defencoding.'"?'.">".
712 712
 	'<SOAP-ENV:Envelope'.$ns_string.">".
713 713
 	$headers.
714 714
 	"<SOAP-ENV:Body>".
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 * @access public
726 726
 	 * @deprecated
727 727
 	 */
728
-    function formatDump($str){
728
+    function formatDump($str) {
729 729
 		$str = htmlspecialchars($str);
730 730
 		return nl2br($str);
731 731
     }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	* @return	string contracted qname
738 738
 	* @access   private
739 739
 	*/
740
-	function contractQname($qname){
740
+	function contractQname($qname) {
741 741
 		// get element namespace
742 742
 		//$this->xdebug("Contract $qname");
743 743
 		if (strrpos($qname, ':')) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 			$ns = substr($qname, 0, strrpos($qname, ':'));
748 748
 			$p = $this->getPrefixFromNamespace($ns);
749 749
 			if ($p) {
750
-				return $p . ':' . $name;
750
+				return $p.':'.$name;
751 751
 			}
752 752
 			return $qname;
753 753
 		} else {
@@ -762,14 +762,14 @@  discard block
 block discarded – undo
762 762
 	* @return	string expanded qname
763 763
 	* @access   private
764 764
 	*/
765
-	function expandQname($qname){
765
+	function expandQname($qname) {
766 766
 		// get element prefix
767
-		if(strpos($qname,':') && !preg_match('/^http:\/\//',$qname)){
767
+		if (strpos($qname, ':') && !preg_match('/^http:\/\//', $qname)) {
768 768
 			// get unqualified name
769
-			$name = substr(strstr($qname,':'),1);
769
+			$name = substr(strstr($qname, ':'), 1);
770 770
 			// get ns prefix
771
-			$prefix = substr($qname,0,strpos($qname,':'));
772
-			if(isset($this->namespaces[$prefix])){
771
+			$prefix = substr($qname, 0, strpos($qname, ':'));
772
+			if (isset($this->namespaces[$prefix])) {
773 773
 				return $this->namespaces[$prefix].':'.$name;
774 774
 			} else {
775 775
 				return $qname;
@@ -787,10 +787,10 @@  discard block
 block discarded – undo
787 787
     * @return string The local part
788 788
     * @access public
789 789
     */
790
-	function getLocalPart($str){
791
-		if($sstr = strrchr($str,':')){
790
+	function getLocalPart($str) {
791
+		if ($sstr = strrchr($str, ':')) {
792 792
 			// get unqualified name
793
-			return substr( $sstr, 1 );
793
+			return substr($sstr, 1);
794 794
 		} else {
795 795
 			return $str;
796 796
 		}
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
     * @return mixed The prefix or false if there is no prefix
805 805
     * @access public
806 806
     */
807
-	function getPrefix($str){
808
-		if($pos = strrpos($str,':')){
807
+	function getPrefix($str) {
808
+		if ($pos = strrpos($str, ':')) {
809 809
 			// get prefix
810
-			return substr($str,0,$pos);
810
+			return substr($str, 0, $pos);
811 811
 		}
812 812
 		return false;
813 813
 	}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     * @return mixed The namespace, false if no namespace has the specified prefix
820 820
     * @access public
821 821
     */
822
-	function getNamespaceFromPrefix($prefix){
822
+	function getNamespaceFromPrefix($prefix) {
823 823
 		if (isset($this->namespaces[$prefix])) {
824 824
 			return $this->namespaces[$prefix];
825 825
 		}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 			$sec = time();
861 861
 			$usec = 0;
862 862
 		}
863
-		return strftime('%Y-%m-%d %H:%M:%S', $sec) . '.' . sprintf('%06d', $usec);
863
+		return strftime('%Y-%m-%d %H:%M:%S', $sec).'.'.sprintf('%06d', $usec);
864 864
 	}
865 865
 
866 866
 	/**
@@ -901,31 +901,31 @@  discard block
 block discarded – undo
901 901
 * @return	mixed ISO 8601 date string or false
902 902
 * @access   public
903 903
 */
904
-function timestamp_to_iso8601($timestamp,$utc=true){
905
-	$datestr = date('Y-m-d\TH:i:sO',$timestamp);
904
+function timestamp_to_iso8601($timestamp, $utc = true) {
905
+	$datestr = date('Y-m-d\TH:i:sO', $timestamp);
906 906
 	$pos = strrpos($datestr, "+");
907 907
 	if ($pos === FALSE) {
908 908
 		$pos = strrpos($datestr, "-");
909 909
 	}
910 910
 	if ($pos !== FALSE) {
911 911
 		if (strlen($datestr) == $pos + 5) {
912
-			$datestr = substr($datestr, 0, $pos + 3) . ':' . substr($datestr, -2);
912
+			$datestr = substr($datestr, 0, $pos + 3).':'.substr($datestr, -2);
913 913
 		}
914 914
 	}
915
-	if($utc){
915
+	if ($utc) {
916 916
 		$pattern = '/'.
917
-		'([0-9]{4})-'.	// centuries & years CCYY-
918
-		'([0-9]{2})-'.	// months MM-
919
-		'([0-9]{2})'.	// days DD
920
-		'T'.			// separator T
921
-		'([0-9]{2}):'.	// hours hh:
922
-		'([0-9]{2}):'.	// minutes mm:
923
-		'([0-9]{2})(\.[0-9]*)?'. // seconds ss.ss...
924
-		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
917
+		'([0-9]{4})-'.// centuries & years CCYY-
918
+		'([0-9]{2})-'.// months MM-
919
+		'([0-9]{2})'.// days DD
920
+		'T'.// separator T
921
+		'([0-9]{2}):'.// hours hh:
922
+		'([0-9]{2}):'.// minutes mm:
923
+		'([0-9]{2})(\.[0-9]*)?'.// seconds ss.ss...
924
+		'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
925 925
 		'/';
926 926
 
927
-		if(preg_match($pattern,$datestr,$regs)){
928
-			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ',$regs[1],$regs[2],$regs[3],$regs[4],$regs[5],$regs[6]);
927
+		if (preg_match($pattern, $datestr, $regs)) {
928
+			return sprintf('%04d-%02d-%02dT%02d:%02d:%02dZ', $regs[1], $regs[2], $regs[3], $regs[4], $regs[5], $regs[6]);
929 929
 		}
930 930
 		return false;
931 931
 	} else {
@@ -940,27 +940,27 @@  discard block
 block discarded – undo
940 940
 * @return	mixed Unix timestamp (int) or false
941 941
 * @access   public
942 942
 */
943
-function iso8601_to_timestamp($datestr){
943
+function iso8601_to_timestamp($datestr) {
944 944
 	$pattern = '/'.
945
-	'([0-9]{4})-'.	// centuries & years CCYY-
946
-	'([0-9]{2})-'.	// months MM-
947
-	'([0-9]{2})'.	// days DD
948
-	'T'.			// separator T
949
-	'([0-9]{2}):'.	// hours hh:
950
-	'([0-9]{2}):'.	// minutes mm:
951
-	'([0-9]{2})(\.[0-9]+)?'. // seconds ss.ss...
952
-	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'. // Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
945
+	'([0-9]{4})-'.// centuries & years CCYY-
946
+	'([0-9]{2})-'.// months MM-
947
+	'([0-9]{2})'.// days DD
948
+	'T'.// separator T
949
+	'([0-9]{2}):'.// hours hh:
950
+	'([0-9]{2}):'.// minutes mm:
951
+	'([0-9]{2})(\.[0-9]+)?'.// seconds ss.ss...
952
+	'(Z|[+\-][0-9]{2}:?[0-9]{2})?'.// Z to indicate UTC, -/+HH:MM:SS.SS... for local tz's
953 953
 	'/';
954
-	if(preg_match($pattern,$datestr,$regs)){
954
+	if (preg_match($pattern, $datestr, $regs)) {
955 955
 		// not utc
956
-		if($regs[8] != 'Z'){
957
-			$op = substr($regs[8],0,1);
958
-			$h = substr($regs[8],1,2);
959
-			$m = substr($regs[8],strlen($regs[8])-2,2);
960
-			if($op == '-'){
956
+		if ($regs[8] != 'Z') {
957
+			$op = substr($regs[8], 0, 1);
958
+			$h = substr($regs[8], 1, 2);
959
+			$m = substr($regs[8], strlen($regs[8]) - 2, 2);
960
+			if ($op == '-') {
961 961
 				$regs[4] = $regs[4] + $h;
962 962
 				$regs[5] = $regs[5] + $m;
963
-			} elseif($op == '+'){
963
+			} elseif ($op == '+') {
964 964
 				$regs[4] = $regs[4] - $h;
965 965
 				$regs[5] = $regs[5] - $m;
966 966
 			}
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Rights {
8 8
 	private static $rights_cache = array();
9
-	private static $rights = array (
9
+	private static $rights = array(
10 10
 		'show_tabs:reports' =>
11
-			array (
11
+			array(
12 12
 				'type' => 'const',
13 13
 				'const' => 'true' )
14 14
 		);
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.