GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2172)
by
unknown
25:01 queued 17:25
created
classes/db/queryparts/condition/ConditionWithoutArgument.class.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 	/**
13 13
 	 * constructor
14 14
 	 * @param string $column_name
15
-	 * @param mixed $argument
15
+	 * @param integer $argument
16 16
 	 * @param string $operation
17 17
 	 * @param string $pipe
18
-	 * @return void
18
+	 * @return boolean
19 19
 	 */
20 20
 	function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = "")
21 21
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
28 28
 				$argument = implode($argument, ',');
29 29
 			}
30 30
 			$this->_value = '(' . $argument . ')';
31
-		}
32
-		else
31
+		} else
33 32
 		{
34 33
 			$this->_value = $argument;
35 34
 		}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 	{
22 22
 		parent::Condition($column_name, $argument, $operation, $pipe);
23 23
 		$tmpArray = array('in' => 1, 'notin' => 1, 'not_in' => 1);
24
-		if(isset($tmpArray[$operation]))
24
+		if (isset($tmpArray[$operation]))
25 25
 		{
26
-			if(is_array($argument))
26
+			if (is_array($argument))
27 27
 			{
28 28
 				$argument = implode($argument, ',');
29 29
 			}
30
-			$this->_value = '(' . $argument . ')';
30
+			$this->_value = '('.$argument.')';
31 31
 		}
32 32
 		else
33 33
 		{
Please login to merge, or discard this patch.
classes/db/queryparts/expression/UpdateExpression.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 	/**
21 21
 	 * constructor
22 22
 	 * @param string $column_name
23
-	 * @param object $argument
23
+	 * @param Argument $argument
24 24
 	 * @return void
25 25
 	 */
26 26
 	function UpdateExpression($column_name, $argument)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function getExpression($with_value = true)
37 37
 	{
38
-		if($with_value)
38
+		if ($with_value)
39 39
 		{
40 40
 			return $this->getExpressionWithValue();
41 41
 		}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	{
51 51
 		$value = $this->argument->getValue();
52 52
 		$operation = $this->argument->getColumnOperation();
53
-		if(isset($operation))
53
+		if (isset($operation))
54 54
 		{
55 55
 			return "$this->column_name = $this->column_name $operation $value";
56 56
 		}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	function getExpressionWithoutValue()
66 66
 	{
67 67
 		$operation = $this->argument->getColumnOperation();
68
-		if(isset($operation))
68
+		if (isset($operation))
69 69
 		{
70 70
 			return "$this->column_name = $this->column_name $operation ?";
71 71
 		}
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		// TODO Escape value according to column type instead of variable type
78 78
 		$value = $this->argument->getValue();
79
-		if(!is_numeric($value))
79
+		if (!is_numeric($value))
80 80
 		{
81
-			return "'" . $value . "'";
81
+			return "'".$value."'";
82 82
 		}
83 83
 		return $value;
84 84
 	}
85 85
 
86 86
 	function show()
87 87
 	{
88
-		if(!$this->argument)
88
+		if (!$this->argument)
89 89
 		{
90 90
 			return false;
91 91
 		}
92 92
 		$value = $this->argument->getValue();
93
-		if(!isset($value))
93
+		if (!isset($value))
94 94
 		{
95 95
 			return false;
96 96
 		}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 	function getArguments()
106 106
 	{
107
-		if($this->argument)
107
+		if ($this->argument)
108 108
 		{
109 109
 			return array($this->argument);
110 110
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
 		if($this->argument)
63 63
 		{
64 64
 			return array($this->argument);
65
-		}
66
-		else
65
+		} else
67 66
 		{
68 67
 			return array();
69 68
 		}
Please login to merge, or discard this patch.
classes/db/queryparts/Query.class.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -251,6 +251,9 @@
 block discarded – undo
251 251
 		return $this->orderby;
252 252
 	}
253 253
 
254
+	/**
255
+	 * @param integer $limit
256
+	 */
254 257
 	function setLimit($limit = NULL)
255 258
 	{
256 259
 		if(!isset($limit))
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -378,8 +378,7 @@  discard block
 block discarded – undo
378 378
 				if($column->isSubquery())
379 379
 				{
380 380
 					$select[] = $column->toString($with_values) . ' as ' . $column->getAlias();
381
-				}
382
-				else
381
+				} else
383 382
 				{
384 383
 					$select[] = $column->getExpression($with_values);
385 384
 				}
@@ -403,7 +402,9 @@  discard block
 block discarded – undo
403 402
 			}
404 403
 		}
405 404
 
406
-		if(!$update) return;
405
+		if(!$update) {
406
+			return;
407
+		}
407 408
 		return trim(implode($update, ', '));
408 409
 	}
409 410
 
@@ -465,8 +466,7 @@  discard block
 block discarded – undo
465 466
 			if($table->isJoinTable() || !$simple_table_count)
466 467
 			{
467 468
 				$from .= $table->toString($with_values) . ' ';
468
-			}
469
-			else
469
+			} else
470 470
 			{
471 471
 				$from .= ', ' . $table->toString($with_values) . ' ';
472 472
 			}
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$this->action = $action;
109 109
 		$this->priority = $priority;
110 110
 
111
-		if(!isset($tables))
111
+		if (!isset($tables))
112 112
 		{
113 113
 			return;
114 114
 		}
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
 	function setColumnList($columnList)
145 145
 	{
146 146
 		$this->columnList = $columnList;
147
-		if(count($this->columnList) > 0)
147
+		if (count($this->columnList) > 0)
148 148
 		{
149 149
 			$selectColumns = array();
150 150
 			$dbParser = DB::getParser();
151 151
 
152
-			foreach($this->columnList as $columnName)
152
+			foreach ($this->columnList as $columnName)
153 153
 			{
154 154
 				$columnName = $dbParser->escapeColumn($columnName);
155 155
 				$selectColumns[] = new SelectExpression($columnName);
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
 
162 162
 	function setColumns($columns)
163 163
 	{
164
-		if(!isset($columns) || count($columns) === 0)
164
+		if (!isset($columns) || count($columns) === 0)
165 165
 		{
166 166
 			$this->columns = array(new StarExpression());
167 167
 			return;
168 168
 		}
169 169
 
170
-		if(!is_array($columns))
170
+		if (!is_array($columns))
171 171
 		{
172 172
 			$columns = array($columns);
173 173
 		}
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
 
178 178
 	function setTables($tables)
179 179
 	{
180
-		if(!isset($tables) || count($tables) === 0)
180
+		if (!isset($tables) || count($tables) === 0)
181 181
 		{
182 182
 			$this->setError(TRUE);
183 183
 			$this->setMessage("You must provide at least one table for the query.");
184 184
 			return;
185 185
 		}
186 186
 
187
-		if(!is_array($tables))
187
+		if (!is_array($tables))
188 188
 		{
189 189
 			$tables = array($tables);
190 190
 		}
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 	function setConditions($conditions)
201 201
 	{
202 202
 		$this->conditions = array();
203
-		if(!isset($conditions) || count($conditions) === 0)
203
+		if (!isset($conditions) || count($conditions) === 0)
204 204
 		{
205 205
 			return;
206 206
 		}
207
-		if(!is_array($conditions))
207
+		if (!is_array($conditions))
208 208
 		{
209 209
 			$conditions = array($conditions);
210 210
 		}
211 211
 
212
-		foreach($conditions as $conditionGroup)
212
+		foreach ($conditions as $conditionGroup)
213 213
 		{
214
-			if($conditionGroup->show())
214
+			if ($conditionGroup->show())
215 215
 			{
216 216
 				$this->conditions[] = $conditionGroup;
217 217
 			}
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 
221 221
 	function setGroups($groups)
222 222
 	{
223
-		if(!isset($groups) || count($groups) === 0)
223
+		if (!isset($groups) || count($groups) === 0)
224 224
 		{
225 225
 			return;
226 226
 		}
227
-		if(!is_array($groups))
227
+		if (!is_array($groups))
228 228
 		{
229 229
 			$groups = array($groups);
230 230
 		}
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 
235 235
 	function setOrder($order)
236 236
 	{
237
-		if(!isset($order) || count($order) === 0)
237
+		if (!isset($order) || count($order) === 0)
238 238
 		{
239 239
 			return;
240 240
 		}
241
-		if(!is_array($order))
241
+		if (!is_array($order))
242 242
 		{
243 243
 			$order = array($order);
244 244
 		}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 
254 254
 	function setLimit($limit = NULL)
255 255
 	{
256
-		if(!isset($limit))
256
+		if (!isset($limit))
257 257
 		{
258 258
 			return;
259 259
 		}
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 	function getClickCountColumns()
355 355
 	{
356 356
 		$click_count_columns = array();
357
-		foreach($this->columns as $column)
357
+		foreach ($this->columns as $column)
358 358
 		{
359
-			if($column->show() && is_a($column, 'ClickCountExpression'))
359
+			if ($column->show() && is_a($column, 'ClickCountExpression'))
360 360
 			{
361 361
 				$click_count_columns[] = $column;
362 362
 			}
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	function getSelectString($with_values = TRUE)
373 373
 	{
374
-		foreach($this->columns as $column)
374
+		foreach ($this->columns as $column)
375 375
 		{
376
-			if($column->show())
376
+			if ($column->show())
377 377
 			{
378
-				if($column->isSubquery())
378
+				if ($column->isSubquery())
379 379
 				{
380
-					$select[] = $column->toString($with_values) . ' as ' . $column->getAlias();
380
+					$select[] = $column->toString($with_values).' as '.$column->getAlias();
381 381
 				}
382 382
 				else
383 383
 				{
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	function getUpdateString($with_values = TRUE)
397 397
 	{
398
-		foreach($this->columns as $column)
398
+		foreach ($this->columns as $column)
399 399
 		{
400
-			if($column->show())
400
+			if ($column->show())
401 401
 			{
402 402
 				$update[] = $column->getExpression($with_values);
403 403
 			}
404 404
 		}
405 405
 
406
-		if(!$update) return;
406
+		if (!$update) return;
407 407
 		return trim(implode($update, ', '));
408 408
 	}
409 409
 
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 	{
417 417
 		$columnsList = '';
418 418
 		// means we have insert-select
419
-		if($this->subquery)
419
+		if ($this->subquery)
420 420
 		{
421
-			foreach($this->columns as $column)
421
+			foreach ($this->columns as $column)
422 422
 			{
423
-				$columnsList .= $column->getColumnName() . ', ';
423
+				$columnsList .= $column->getColumnName().', ';
424 424
 			}
425 425
 			$columnsList = substr($columnsList, 0, -2);
426 426
 			$selectStatement = $this->subquery->toString($with_values);
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 		}
430 430
 
431 431
 		$valuesList = '';
432
-		foreach($this->columns as $column)
432
+		foreach ($this->columns as $column)
433 433
 		{
434
-			if($column->show())
434
+			if ($column->show())
435 435
 			{
436
-				$columnsList .= $column->getColumnName() . ', ';
437
-				$valuesList .= $column->getValue($with_values) . ', ';
436
+				$columnsList .= $column->getColumnName().', ';
437
+				$valuesList .= $column->getValue($with_values).', ';
438 438
 			}
439 439
 		}
440 440
 		$columnsList = substr($columnsList, 0, -2);
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 	{
461 461
 		$from = '';
462 462
 		$simple_table_count = 0;
463
-		foreach($this->tables as $table)
463
+		foreach ($this->tables as $table)
464 464
 		{
465
-			if($table->isJoinTable() || !$simple_table_count)
465
+			if ($table->isJoinTable() || !$simple_table_count)
466 466
 			{
467
-				$from .= $table->toString($with_values) . ' ';
467
+				$from .= $table->toString($with_values).' ';
468 468
 			}
469 469
 			else
470 470
 			{
471
-				$from .= ', ' . $table->toString($with_values) . ' ';
471
+				$from .= ', '.$table->toString($with_values).' ';
472 472
 			}
473 473
 
474
-			if(is_a($table, 'Subquery'))
474
+			if (is_a($table, 'Subquery'))
475 475
 			{
476
-				$from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' ';
476
+				$from .= $table->getAlias() ? ' as '.$table->getAlias().' ' : ' ';
477 477
 			}
478 478
 
479 479
 			$simple_table_count++;
480 480
 		}
481
-		if(trim($from) == '')
481
+		if (trim($from) == '')
482 482
 		{
483 483
 			return '';
484 484
 		}
@@ -496,9 +496,9 @@  discard block
 block discarded – undo
496 496
 		$where = '';
497 497
 		$condition_count = 0;
498 498
 
499
-		foreach($this->conditions as $conditionGroup)
499
+		foreach ($this->conditions as $conditionGroup)
500 500
 		{
501
-			if($condition_count === 0)
501
+			if ($condition_count === 0)
502 502
 			{
503 503
 				$conditionGroup->setPipe("");
504 504
 			}
@@ -507,26 +507,26 @@  discard block
 block discarded – undo
507 507
 			$condition_count++;
508 508
 		}
509 509
 
510
-		if($with_optimization &&
510
+		if ($with_optimization &&
511 511
 				(strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order')))
512 512
 		{
513 513
 
514
-			if($condition_count !== 0)
514
+			if ($condition_count !== 0)
515 515
 			{
516
-				$where = '(' . $where . ') ';
516
+				$where = '('.$where.') ';
517 517
 			}
518 518
 
519
-			foreach($this->orderby as $order)
519
+			foreach ($this->orderby as $order)
520 520
 			{
521 521
 				$colName = $order->getColumnName();
522
-				if(strstr($colName, 'list_order') || strstr($colName, 'update_order'))
522
+				if (strstr($colName, 'list_order') || strstr($colName, 'update_order'))
523 523
 				{
524 524
 					$opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and');
525
-					if($condition_count === 0)
525
+					if ($condition_count === 0)
526 526
 					{
527 527
 						$opt_condition->setPipe("");
528 528
 					}
529
-					$where .= $opt_condition->toString($with_values) . ' ';
529
+					$where .= $opt_condition->toString($with_values).' ';
530 530
 					$condition_count++;
531 531
 				}
532 532
 			}
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 	function getGroupByString()
543 543
 	{
544 544
 		$groupBy = '';
545
-		if($this->groups)
545
+		if ($this->groups)
546 546
 		{
547
-			if($this->groups[0] !== "")
547
+			if ($this->groups[0] !== "")
548 548
 			{
549 549
 				$groupBy = implode(', ', $this->groups);
550 550
 			}
@@ -558,16 +558,16 @@  discard block
 block discarded – undo
558 558
 	 */
559 559
 	function getOrderByString()
560 560
 	{
561
-		if(!$this->_orderByString)
561
+		if (!$this->_orderByString)
562 562
 		{
563
-			if(count($this->orderby) === 0)
563
+			if (count($this->orderby) === 0)
564 564
 			{
565 565
 				return '';
566 566
 			}
567 567
 			$orderBy = '';
568
-			foreach($this->orderby as $order)
568
+			foreach ($this->orderby as $order)
569 569
 			{
570
-				$orderBy .= $order->toString() . ', ';
570
+				$orderBy .= $order->toString().', ';
571 571
 			}
572 572
 			$orderBy = substr($orderBy, 0, -2);
573 573
 			$this->_orderByString = $orderBy;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	function getLimitString()
588 588
 	{
589 589
 		$limit = '';
590
-		if(count($this->limit) > 0)
590
+		if (count($this->limit) > 0)
591 591
 		{
592 592
 			$limit = '';
593 593
 			$limit .= $this->limit->toString();
@@ -606,19 +606,19 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	function getArguments()
608 608
 	{
609
-		if(!isset($this->arguments))
609
+		if (!isset($this->arguments))
610 610
 		{
611 611
 			$this->arguments = array();
612 612
 
613 613
 			// Join table arguments
614
-			if(count($this->tables) > 0)
614
+			if (count($this->tables) > 0)
615 615
 			{
616
-				foreach($this->tables as $table)
616
+				foreach ($this->tables as $table)
617 617
 				{
618
-					if($table->isJoinTable() || is_a($table, 'Subquery'))
618
+					if ($table->isJoinTable() || is_a($table, 'Subquery'))
619 619
 					{
620 620
 						$args = $table->getArguments();
621
-						if($args)
621
+						if ($args)
622 622
 						{
623 623
 							$this->arguments = array_merge($this->arguments, $args);
624 624
 						}
@@ -628,14 +628,14 @@  discard block
 block discarded – undo
628 628
 
629 629
 			// Column arguments
630 630
 			// The if is for delete statements, all others must have columns
631
-			if(count($this->columns) > 0)
631
+			if (count($this->columns) > 0)
632 632
 			{
633
-				foreach($this->columns as $column)
633
+				foreach ($this->columns as $column)
634 634
 				{
635
-					if($column->show())
635
+					if ($column->show())
636 636
 					{
637 637
 						$args = $column->getArguments();
638
-						if($args)
638
+						if ($args)
639 639
 						{
640 640
 							$this->arguments = array_merge($this->arguments, $args);
641 641
 						}
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
 			}
645 645
 
646 646
 			// Condition arguments
647
-			if(count($this->conditions) > 0)
647
+			if (count($this->conditions) > 0)
648 648
 			{
649
-				foreach($this->conditions as $conditionGroup)
649
+				foreach ($this->conditions as $conditionGroup)
650 650
 				{
651 651
 					$args = $conditionGroup->getArguments();
652
-					if(count($args) > 0)
652
+					if (count($args) > 0)
653 653
 					{
654 654
 						$this->arguments = array_merge($this->arguments, $args);
655 655
 					}
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 			}
658 658
 
659 659
 			// Navigation arguments
660
-			if(count($this->orderby) > 0)
660
+			if (count($this->orderby) > 0)
661 661
 			{
662
-				foreach($this->orderby as $order)
662
+				foreach ($this->orderby as $order)
663 663
 				{
664 664
 					$args = $order->getArguments();
665
-					if(count($args) > 0)
665
+					if (count($args) > 0)
666 666
 					{
667 667
 						$this->arguments = array_merge($this->arguments, $args);
668 668
 					}
Please login to merge, or discard this patch.
classes/display/DisplayHandler.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n
134 134
 	 * This method only functions when __DEBUG__ variable is set to 1.
135 135
 	 * __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php
136
-	 * @return void
136
+	 * @return null|string
137 137
 	 */
138 138
 	function _debugOutput()
139 139
 	{
@@ -358,6 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
 	/**
360 360
 	 * print a HTTP HEADER for HTML, which is encoded in UTF-8
361
+	 * @param integer $code
361 362
 	 * @return void
362 363
 	 */
363 364
 	function _printHttpStatusCode($code)
Please login to merge, or discard this patch.
Braces   +13 added lines, -21 removed lines patch added patch discarded remove patch
@@ -40,24 +40,20 @@  discard block
 block discarded – undo
40 40
 		if(Context::get('xeVirtualRequestMethod') == 'xml')
41 41
 		{
42 42
 			$handler = new VirtualXMLDisplayHandler();
43
-		}
44
-		else if(Context::getRequestMethod() == 'XMLRPC')
43
+		} else if(Context::getRequestMethod() == 'XMLRPC')
45 44
 		{
46 45
 			$handler = new XMLDisplayHandler();
47 46
 			if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
48 47
 			{
49 48
 				$this->gz_enabled = FALSE;
50 49
 			}
51
-		}
52
-		else if(Context::getRequestMethod() == 'JSON')
50
+		} else if(Context::getRequestMethod() == 'JSON')
53 51
 		{
54 52
 			$handler = new JSONDisplayHandler();
55
-		}
56
-		else if(Context::getRequestMethod() == 'JS_CALLBACK')
53
+		} else if(Context::getRequestMethod() == 'JS_CALLBACK')
57 54
 		{
58 55
 			$handler = new JSCallbackDisplayHandler();
59
-		}
60
-		else
56
+		} else
61 57
 		{
62 58
 			$handler = new HTMLDisplayHandler();
63 59
 		}
@@ -71,7 +67,9 @@  discard block
 block discarded – undo
71 67
 		$called_position = 'before_display_content';
72 68
 		$oAddonController = getController('addon');
73 69
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
74
-		if(file_exists($addon_file)) include($addon_file);
70
+		if(file_exists($addon_file)) {
71
+			include($addon_file);
72
+		}
75 73
 
76 74
 		if(method_exists($handler, "prepareToPrint"))
77 75
 		{
@@ -84,18 +82,15 @@  discard block
 block discarded – undo
84 82
 		if($httpStatusCode && $httpStatusCode != 200)
85 83
 		{
86 84
 			$this->_printHttpStatusCode($httpStatusCode);
87
-		}
88
-		else
85
+		} else
89 86
 		{
90 87
 			if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
91 88
 			{
92 89
 				$this->_printJSONHeader();
93
-			}
94
-			else if(Context::getResponseMethod() != 'HTML')
90
+			} else if(Context::getResponseMethod() != 'HTML')
95 91
 			{
96 92
 				$this->_printXMLHeader();
97
-			}
98
-			else
93
+			} else
99 94
 			{
100 95
 				$this->_printHTMLHeader();
101 96
 			}
@@ -117,8 +112,7 @@  discard block
 block discarded – undo
117 112
 		{
118 113
 			header("Content-Encoding: gzip");
119 114
 			print ob_gzhandler($output, 5);
120
-		}
121
-		else
115
+		} else
122 116
 		{
123 117
 			print $output;
124 118
 		}
@@ -213,8 +207,7 @@  discard block
 block discarded – undo
213 207
 				);
214 208
 			}
215 209
 			// dislpay the file and HTML comments
216
-		}
217
-		else
210
+		} else
218 211
 		{
219 212
 
220 213
 			$buff = array();
@@ -269,8 +262,7 @@  discard block
 block discarded – undo
269 262
 						if($query['result'] == 'Success')
270 263
 						{
271 264
 							$query_result = "Query Success";
272
-						}
273
-						else
265
+						} else
274 266
 						{
275 267
 							$query_result = sprintf("Query $s : %d\n\t\t\t   %s", $query['result'], $query['errno'], $query['errstr']);
276 268
 						}
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	function printContent(&$oModule)
26 26
 	{
27 27
 		// Check if the gzip encoding supported
28
-		if(
28
+		if (
29 29
 				(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
30 30
 				strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE &&
31 31
 				function_exists('ob_gzhandler') &&
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 
39 39
 		// Extract contents to display by the request method
40
-		if(Context::get('xeVirtualRequestMethod') == 'xml')
40
+		if (Context::get('xeVirtualRequestMethod') == 'xml')
41 41
 		{
42 42
 			$handler = new VirtualXMLDisplayHandler();
43 43
 		}
44
-		else if(Context::getRequestMethod() == 'XMLRPC')
44
+		else if (Context::getRequestMethod() == 'XMLRPC')
45 45
 		{
46 46
 			$handler = new XMLDisplayHandler();
47
-			if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
47
+			if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
48 48
 			{
49 49
 				$this->gz_enabled = FALSE;
50 50
 			}
51 51
 		}
52
-		else if(Context::getRequestMethod() == 'JSON')
52
+		else if (Context::getRequestMethod() == 'JSON')
53 53
 		{
54 54
 			$handler = new JSONDisplayHandler();
55 55
 		}
56
-		else if(Context::getRequestMethod() == 'JS_CALLBACK')
56
+		else if (Context::getRequestMethod() == 'JS_CALLBACK')
57 57
 		{
58 58
 			$handler = new JSCallbackDisplayHandler();
59 59
 		}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		$called_position = 'before_display_content';
72 72
 		$oAddonController = getController('addon');
73 73
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
74
-		if(file_exists($addon_file)) include($addon_file);
74
+		if (file_exists($addon_file)) include($addon_file);
75 75
 
76
-		if(method_exists($handler, "prepareToPrint"))
76
+		if (method_exists($handler, "prepareToPrint"))
77 77
 		{
78 78
 			$handler->prepareToPrint($output);
79 79
 		}
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 		// header output
82 82
 
83 83
 		$httpStatusCode = $oModule->getHttpStatusCode();
84
-		if($httpStatusCode && $httpStatusCode != 200)
84
+		if ($httpStatusCode && $httpStatusCode != 200)
85 85
 		{
86 86
 			$this->_printHttpStatusCode($httpStatusCode);
87 87
 		}
88 88
 		else
89 89
 		{
90
-			if(Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
90
+			if (Context::getResponseMethod() == 'JSON' || Context::getResponseMethod() == 'JS_CALLBACK')
91 91
 			{
92 92
 				$this->_printJSONHeader();
93 93
 			}
94
-			else if(Context::getResponseMethod() != 'HTML')
94
+			else if (Context::getResponseMethod() != 'HTML')
95 95
 			{
96 96
 				$this->_printXMLHeader();
97 97
 			}
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 
108 108
 		// disable gzip if output already exists
109 109
 		ob_flush();
110
-		if(headers_sent())
110
+		if (headers_sent())
111 111
 		{
112 112
 			$this->gz_enabled = FALSE;
113 113
 		}
114 114
 
115 115
 		// results directly output
116
-		if($this->gz_enabled)
116
+		if ($this->gz_enabled)
117 117
 		{
118 118
 			header("Content-Encoding: gzip");
119 119
 			print ob_gzhandler($output, 5);
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	function _debugOutput()
139 139
 	{
140
-		if(!__DEBUG__)
140
+		if (!__DEBUG__)
141 141
 		{
142 142
 			return;
143 143
 		}
@@ -145,32 +145,32 @@  discard block
 block discarded – undo
145 145
 		$end = getMicroTime();
146 146
 
147 147
 		// Firebug console output
148
-		if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
148
+		if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
149 149
 		{
150 150
 			static $firephp;
151
-			if(!isset($firephp))
151
+			if (!isset($firephp))
152 152
 			{
153 153
 				$firephp = FirePHP::getInstance(true);
154 154
 			}
155 155
 
156
-			if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
156
+			if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
157 157
 			{
158 158
 				$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
159 159
 				return;
160 160
 			}
161 161
 			// display total execution time and Request/Response info
162
-			if(__DEBUG__ & 2)
162
+			if (__DEBUG__ & 2)
163 163
 			{
164 164
 				$firephp->fb(
165 165
 						array(
166
-							'Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(),
166
+							'Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(),
167 167
 							array(
168 168
 								array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'),
169 169
 								array(
170 170
 									sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']),
171 171
 									$_SERVER['REQUEST_METHOD'],
172 172
 									Context::getResponseMethod(),
173
-									$this->content_size . ' byte',
173
+									$this->content_size.' byte',
174 174
 									FileHandler::filesize(memory_get_peak_usage())
175 175
 								)
176 176
 							)
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 				);
180 180
 				$firephp->fb(
181 181
 						array(
182
-							'Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__),
182
+							'Elapsed time >>> Total : '.sprintf('%0.5f sec', $end - __StartTime__),
183 183
 							array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'),
184 184
 								array(
185 185
 									sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 			}
198 198
 
199 199
 			// display DB query history
200
-			if((__DEBUG__ & 4) && $GLOBALS['__db_queries__'])
200
+			if ((__DEBUG__ & 4) && $GLOBALS['__db_queries__'])
201 201
 			{
202 202
 				$queries_output = array(array('Result/'.PHP_EOL.'Elapsed time', 'Query ID', 'Query'));
203
-				foreach($GLOBALS['__db_queries__'] as $query)
203
+				foreach ($GLOBALS['__db_queries__'] as $query)
204 204
 				{
205
-					$queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']);
205
+					$queries_output[] = array($query['result'].PHP_EOL.sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']).PHP_EOL.$query['called_method'].'()'.PHP_EOL.$query['query_id'], $query['query']);
206 206
 				}
207 207
 				$firephp->fb(
208 208
 						array(
209
-							'DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
209
+							'DB Queries >>> '.count($GLOBALS['__db_queries__']).' Queries, '.sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']),
210 210
 							$queries_output
211 211
 						),
212 212
 						'TABLE'
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 
220 220
 			$buff = array();
221 221
 			// display total execution time and Request/Response info
222
-			if(__DEBUG__ & 2)
222
+			if (__DEBUG__ & 2)
223 223
 			{
224
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
224
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
225 225
 				{
226 226
 					return;
227 227
 				}
@@ -252,21 +252,21 @@  discard block
 block discarded – undo
252 252
 				$buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']);
253 253
 			}
254 254
 			// DB Logging
255
-			if(__DEBUG__ & 4)
255
+			if (__DEBUG__ & 4)
256 256
 			{
257
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
257
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
258 258
 				{
259 259
 					return;
260 260
 				}
261 261
 
262
-				if($GLOBALS['__db_queries__'])
262
+				if ($GLOBALS['__db_queries__'])
263 263
 				{
264 264
 					$buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
265 265
 					$num = 0;
266 266
 
267
-					foreach($GLOBALS['__db_queries__'] as $query)
267
+					foreach ($GLOBALS['__db_queries__'] as $query)
268 268
 					{
269
-						if($query['result'] == 'Success')
269
+						if ($query['result'] == 'Success')
270 270
 						{
271 271
 							$query_result = "Query Success";
272 272
 						}
@@ -283,30 +283,30 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 
285 285
 			// Output in HTML comments
286
-			if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML')
286
+			if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML')
287 287
 			{
288 288
 				$buff = implode("\r\n", $buff);
289 289
 				$buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
290 290
 
291
-				if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
291
+				if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
292 292
 				{
293 293
 					$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
294 294
 				}
295 295
 
296
-				return "<!--\r\n" . $buff . "\r\n-->";
296
+				return "<!--\r\n".$buff."\r\n-->";
297 297
 			}
298 298
 
299 299
 			// Output to a file
300
-			if($buff && __DEBUG_OUTPUT__ == 0)
300
+			if ($buff && __DEBUG_OUTPUT__ == 0)
301 301
 			{
302
-				$debug_file = _XE_PATH_ . 'files/_debug_message.php';
302
+				$debug_file = _XE_PATH_.'files/_debug_message.php';
303 303
 				$buff = implode(PHP_EOL, $buff);
304 304
 				$buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true));
305 305
 
306
-				$buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80);
307
-				$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
306
+				$buff = str_repeat('=', 80)."\n".$buff."\n".str_repeat('-', 80);
307
+				$buff = "\n<?php\n/*".$buff."*/\n?>\n";
308 308
 
309
-				if (!@file_put_contents($debug_file, $buff, FILE_APPEND|LOCK_EX))
309
+				if (!@file_put_contents($debug_file, $buff, FILE_APPEND | LOCK_EX))
310 310
 				{
311 311
 					return;
312 312
 				}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	{
323 323
 		header("Content-Type: text/xml; charset=UTF-8");
324 324
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
325
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
325
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
326 326
 		header("Cache-Control: no-store, no-cache, must-revalidate");
327 327
 		header("Cache-Control: post-check=0, pre-check=0", false);
328 328
 		header("Pragma: no-cache");
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	{
337 337
 		header("Content-Type: text/html; charset=UTF-8");
338 338
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
339
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
339
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
340 340
 		header("Cache-Control: no-store, no-cache, must-revalidate");
341 341
 		header("Cache-Control: post-check=0, pre-check=0", false);
342 342
 		header("Pragma: no-cache");
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	{
351 351
 		header("Content-Type: text/html; charset=UTF-8");
352 352
 		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
353
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
353
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
354 354
 		header("Cache-Control: no-store, no-cache, must-revalidate");
355 355
 		header("Cache-Control: post-check=0, pre-check=0", false);
356 356
 		header("Pragma: no-cache");
Please login to merge, or discard this patch.
classes/display/HTMLDisplayHandler.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -370,7 +370,7 @@
 block discarded – undo
370 370
 	/**
371 371
 	 * add given .css or .js file names in widget code to Context
372 372
 	 * @param array $matches
373
-	 * @return void
373
+	 * @return string|null
374 374
 	 */
375 375
 	function _transMeta($matches)
376 376
 	{
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
 		$template_path = $oModule->getTemplatePath();
21 21
 
22
-		if(!is_dir($template_path))
22
+		if (!is_dir($template_path))
23 23
 		{
24
-			if($oModule->module_info->module == $oModule->module)
24
+			if ($oModule->module_info->module == $oModule->module)
25 25
 			{
26 26
 				$skin = $oModule->origin_module_info->skin;
27 27
 			}
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 				$skin = $oModule->module_config->skin;
31 31
 			}
32 32
 
33
-			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false)
33
+			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false)
34 34
 			{
35
-				if($skin && is_string($skin))
35
+				if ($skin && is_string($skin))
36 36
 				{
37 37
 					$theme_skin = explode('|@|', $skin);
38 38
 					$template_path = $oModule->getTemplatePath();
39
-					if(count($theme_skin) == 2)
39
+					if (count($theme_skin) == 2)
40 40
 					{
41 41
 						$theme_path = sprintf('./themes/%s', $theme_skin[0]);
42 42
 						// FIXME $theme_path $theme_path $theme_path ??
43
-						if(substr($theme_path, 0, strlen($theme_path)) != $theme_path)
43
+						if (substr($theme_path, 0, strlen($theme_path)) != $theme_path)
44 44
 						{
45 45
 							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
46 46
 						}
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 		$output = $oTemplate->compile($template_path, $tpl_file);
62 62
 
63 63
 		// add .x div for adminitration pages
64
-		if(Context::getResponseMethod() == 'HTML')
64
+		if (Context::getResponseMethod() == 'HTML')
65 65
 		{
66
-			if(Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify')
66
+			if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') > 0 && Context::get('act') != 'dispPageAdminContentModify' && Context::get('act') != 'dispPageAdminMobileContentModify')
67 67
 			{
68
-				$output = '<div class="x">' . $output . '</div>';
68
+				$output = '<div class="x">'.$output.'</div>';
69 69
 			}
70 70
 
71
-			if(Context::get('layout') != 'none')
71
+			if (Context::get('layout') != 'none')
72 72
 			{
73
-				if(__DEBUG__ == 3)
73
+				if (__DEBUG__ == 3)
74 74
 				{
75 75
 					$start = getMicroTime();
76 76
 				}
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 				$layout_srl = $layout_info->layout_srl;
89 89
 
90 90
 				// compile if connected to the layout
91
-				if($layout_srl > 0)
91
+				if ($layout_srl > 0)
92 92
 				{
93 93
 
94 94
 					// handle separately if the layout is faceoff
95
-					if($layout_info && $layout_info->type == 'faceoff')
95
+					if ($layout_info && $layout_info->type == 'faceoff')
96 96
 					{
97 97
 						$oLayoutModel->doActivateFaceOff($layout_info);
98 98
 						Context::set('layout_info', $layout_info);
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 					// search if the changes CSS exists in the admin layout edit window
102 102
 					$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
103 103
 
104
-					if(FileHandler::exists($edited_layout_css))
104
+					if (FileHandler::exists($edited_layout_css))
105 105
 					{
106 106
 						Context::loadFile(array($edited_layout_css, 'all', '', 100));
107 107
 					}
108 108
 				}
109
-				if(!$layout_path)
109
+				if (!$layout_path)
110 110
 				{
111 111
 					$layout_path = './common/tpl';
112 112
 				}
113
-				if(!$layout_file)
113
+				if (!$layout_file)
114 114
 				{
115 115
 					$layout_file = 'default_layout';
116 116
 				}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 				// if popup_layout, remove admin bar.
120 120
 				$realLayoutPath = FileHandler::getRealPath($layout_path);
121
-				if(substr_compare($realLayoutPath, '/', -1) !== 0)
121
+				if (substr_compare($realLayoutPath, '/', -1) !== 0)
122 122
 				{
123 123
 					$realLayoutPath .= '/';
124 124
 				}
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 				$pathInfo = pathinfo($layout_file);
127 127
 				$onlyLayoutFile = $pathInfo['filename'];
128 128
 
129
-				if(__DEBUG__ == 3)
129
+				if (__DEBUG__ == 3)
130 130
 				{
131 131
 					$GLOBALS['__layout_compile_elapsed__'] = getMicroTime() - $start;
132 132
 				}
133 133
 
134
-				if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
134
+				if (stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && (Context::get('_use_ssl') == 'optional' || Context::get('_use_ssl') == 'always'))
135 135
 				{
136 136
 					Context::addHtmlFooter('<iframe id="xeTmpIframe" name="xeTmpIframe" style="width:1px;height:1px;position:absolute;top:-2px;left:-2px;"></iframe>');
137 137
 				}
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	function prepareToPrint(&$output)
149 149
 	{
150
-		if(Context::getResponseMethod() != 'HTML')
150
+		if (Context::getResponseMethod() != 'HTML')
151 151
 		{
152 152
 			return;
153 153
 		}
154 154
 
155
-		if(__DEBUG__ == 3)
155
+		if (__DEBUG__ == 3)
156 156
 		{
157 157
 			$start = getMicroTime();
158 158
 		}
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
 		$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\-\/\.\@\:]+)-->/is', array($this, '_transMeta'), $output);
171 171
 
172 172
 		// handles a relative path generated by using the rewrite module
173
-		if(Context::isAllowRewrite())
173
+		if (Context::isAllowRewrite())
174 174
 		{
175 175
 			$url = parse_url(Context::getRequestUri());
176 176
 			$real_path = $url['path'];
177 177
 
178 178
 			$pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s';
179
-			$output = preg_replace($pattern, 'src=$1' . $real_path . '$2$3', $output);
179
+			$output = preg_replace($pattern, 'src=$1'.$real_path.'$2$3', $output);
180 180
 
181 181
 			$pattern = '/href=("|\'){1}(\?[^"\']+)/s';
182
-			$output = preg_replace($pattern, 'href=$1' . $real_path . '$2', $output);
182
+			$output = preg_replace($pattern, 'href=$1'.$real_path.'$2', $output);
183 183
 
184
-			if(Context::get('vid'))
184
+			if (Context::get('vid'))
185 185
 			{
186
-				$pattern = '/\/' . Context::get('vid') . '\?([^=]+)=/is';
186
+				$pattern = '/\/'.Context::get('vid').'\?([^=]+)=/is';
187 187
 				$output = preg_replace($pattern, '/?$1=', $output);
188 188
 			}
189 189
 		}
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 		// prevent the 2nd request due to url(none) of the background-image
192 192
 		$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output);
193 193
 
194
-		if(is_array(Context::get('INPUT_ERROR')))
194
+		if (is_array(Context::get('INPUT_ERROR')))
195 195
 		{
196 196
 			$INPUT_ERROR = Context::get('INPUT_ERROR');
197 197
 			$keys = array_keys($INPUT_ERROR);
198
-			$keys = '(' . implode('|', $keys) . ')';
198
+			$keys = '('.implode('|', $keys).')';
199 199
 
200
-			$output = preg_replace_callback('@(<input)([^>]*?)\sname="' . $keys . '"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
201
-			$output = preg_replace_callback('@<select[^>]*\sname="' . $keys . '".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
202
-			$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
200
+			$output = preg_replace_callback('@(<input)([^>]*?)\sname="'.$keys.'"([^>]*?)/?>@is', array(&$this, '_preserveValue'), $output);
201
+			$output = preg_replace_callback('@<select[^>]*\sname="'.$keys.'".+</select>@isU', array(&$this, '_preserveSelectValue'), $output);
202
+			$output = preg_replace_callback('@<textarea[^>]*\sname="'.$keys.'".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
203 203
 		}
204 204
 
205
-		if(__DEBUG__ == 3)
205
+		if (__DEBUG__ == 3)
206 206
 		{
207 207
 			$GLOBALS['__trans_content_elapsed__'] = getMicroTime() - $start;
208 208
 		}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		// convert the final layout
221 221
 		Context::set('content', $output);
222 222
 		$oTemplate = TemplateHandler::getInstance();
223
-		if(Mobile::isFromMobilePhone())
223
+		if (Mobile::isFromMobilePhone())
224 224
 		{
225 225
 			$this->_loadMobileJSCSS();
226 226
 			$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
 	{
246 246
 		$INPUT_ERROR = Context::get('INPUT_ERROR');
247 247
 
248
-		$str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4];
248
+		$str = $match[1].$match[2].' name="'.$match[3].'"'.$match[4];
249 249
 
250 250
 		// get type
251 251
 		$type = 'text';
252
-		if(preg_match('/\stype="([a-z]+)"/i', $str, $m))
252
+		if (preg_match('/\stype="([a-z]+)"/i', $str, $m))
253 253
 		{
254 254
 			$type = strtolower($m[1]);
255 255
 		}
256 256
 
257
-		switch($type)
257
+		switch ($type)
258 258
 		{
259 259
 			case 'text':
260 260
 			case 'hidden':
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			case 'number':
273 273
 			case 'range':
274 274
 			case 'color':
275
-				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str) . ' value="' . htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '"';
275
+				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str).' value="'.htmlspecialchars($INPUT_ERROR[$match[3]], ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'"';
276 276
 				break;
277 277
 			case 'password':
278 278
 				$str = preg_replace('@\svalue="[^"]*?"@', ' ', $str);
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 			case 'radio':
281 281
 			case 'checkbox':
282 282
 				$str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str);
283
-				if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str))
283
+				if (@preg_match('@\s(?i:value)="'.$INPUT_ERROR[$match[3]].'"@', $str))
284 284
 				{
285 285
 					$str .= ' checked="checked"';
286 286
 				}
287 287
 				break;
288 288
 		}
289 289
 
290
-		return $str . ' />';
290
+		return $str.' />';
291 291
 	}
292 292
 
293 293
 	/**
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 		preg_match_all('@<option[^>]*\svalue="([^"]*)".+</option>@isU', $matches[0], $m);
305 305
 
306 306
 		$key = array_search($INPUT_ERROR[$matches[1]], $m[1]);
307
-		if($key === FALSE)
307
+		if ($key === FALSE)
308 308
 		{
309 309
 			return $matches[0];
310 310
 		}
311 311
 
312 312
 		$m[0][$key] = preg_replace('@(\svalue=".*?")@is', '$1 selected="selected"', $m[0][$key]);
313 313
 
314
-		return $mm[0] . implode('', $m[0]) . '</select>';
314
+		return $mm[0].implode('', $m[0]).'</select>';
315 315
 	}
316 316
 
317 317
 	/**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	{
324 324
 		$INPUT_ERROR = Context::get('INPUT_ERROR');
325 325
 		preg_match('@<textarea.*?>@is', $matches[0], $mm);
326
-		return $mm[0] . $INPUT_ERROR[$matches[1]] . '</textarea>';
326
+		return $mm[0].$INPUT_ERROR[$matches[1]].'</textarea>';
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	function _moveStyleToHeader($matches)
336 336
 	{
337
-		if(isset($matches[1]) && stristr($matches[1], 'scoped'))
337
+		if (isset($matches[1]) && stristr($matches[1], 'scoped'))
338 338
 		{
339 339
 			return $matches[0];
340 340
 		}
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	function _transMeta($matches)
372 372
 	{
373
-		if($matches[1])
373
+		if ($matches[1])
374 374
 		{
375 375
 			return '';
376 376
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		$lang_type = Context::getLangType();
388 388
 
389 389
 		// add common JS/CSS files
390
-		if(__DEBUG__ || !__XE_VERSION_STABLE__)
390
+		if (__DEBUG__ || !__XE_VERSION_STABLE__)
391 391
 		{
392 392
 			$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -1110000), true);
393 393
 			$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -1100000), true);
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true);
401 401
 			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true);
402 402
 			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true);
403
-			if(!__DISABLE_DEFAULT_CSS__)
403
+			if (!__DISABLE_DEFAULT_CSS__)
404 404
 			{
405 405
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
406 406
 			}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true);
416 416
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
417 417
 			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true);
418
-			if(!__DISABLE_DEFAULT_CSS__)
418
+			if (!__DISABLE_DEFAULT_CSS__)
419 419
 			{
420 420
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
421 421
 			}
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 		}
427 427
 
428 428
 		// for admin page, add admin css
429
-		if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
429
+		if (Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
430 430
 		{
431
-			if(__DEBUG__ || !__XE_VERSION_STABLE__)
431
+			if (__DEBUG__ || !__XE_VERSION_STABLE__)
432 432
 			{
433 433
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
434 434
 				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		$lang_type = Context::getLangType();
461 461
 
462 462
 		// add common JS/CSS files
463
-		if(__DEBUG__ || !__XE_VERSION_STABLE__)
463
+		if (__DEBUG__ || !__XE_VERSION_STABLE__)
464 464
 		{
465 465
 			$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -1100000), true);
466 466
 			$oContext->loadFile(array('./common/js/modernizr.js', 'head', '', -1000000), true);
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 			$oContext->loadFile(array('./common/js/xml2json.js', 'head', '', -1000000), true);
473 473
 			$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -1000000), true);
474 474
 			$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -1000000), true);
475
-			if(!__DISABLE_DEFAULT_CSS__)
475
+			if (!__DISABLE_DEFAULT_CSS__)
476 476
 			{
477 477
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
478 478
 				$oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true);
489 489
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
490 490
 			$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -1000000), true);
491
-			if(!__DISABLE_DEFAULT_CSS__)
491
+			if (!__DISABLE_DEFAULT_CSS__)
492 492
 			{
493 493
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
494 494
 				$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
 			if($oModule->module_info->module == $oModule->module)
25 25
 			{
26 26
 				$skin = $oModule->origin_module_info->skin;
27
-			}
28
-			else
27
+			} else
29 28
 			{
30 29
 				$skin = $oModule->module_config->skin;
31 30
 			}
@@ -45,13 +44,11 @@  discard block
 block discarded – undo
45 44
 							$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
46 45
 						}
47 46
 					}
48
-				}
49
-				else
47
+				} else
50 48
 				{
51 49
 					$template_path = $oModule->getTemplatePath();
52 50
 				}
53
-			}
54
-			else
51
+			} else
55 52
 			{
56 53
 				$template_path = $oModule->getTemplatePath();
57 54
 			}
@@ -224,8 +221,7 @@  discard block
 block discarded – undo
224 221
 		{
225 222
 			$this->_loadMobileJSCSS();
226 223
 			$output = $oTemplate->compile('./common/tpl', 'mobile_layout');
227
-		}
228
-		else
224
+		} else
229 225
 		{
230 226
 			$this->_loadJSCSS();
231 227
 			$output = $oTemplate->compile('./common/tpl', 'common_layout');
@@ -403,13 +399,11 @@  discard block
 block discarded – undo
403 399
 			if(!__DISABLE_DEFAULT_CSS__)
404 400
 			{
405 401
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
406
-			}
407
-			else
402
+			} else
408 403
 			{
409 404
 				$oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true);
410 405
 			}
411
-		}
412
-		else
406
+		} else
413 407
 		{
414 408
 			$oContext->loadFile(array('./common/js/jquery-1.x.min.js', 'head', 'lt IE 9', -1110000), true);
415 409
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', 'gte IE 9', -1100000), true);
@@ -418,8 +412,7 @@  discard block
 block discarded – undo
418 412
 			if(!__DISABLE_DEFAULT_CSS__)
419 413
 			{
420 414
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
421
-			}
422
-			else
415
+			} else
423 416
 			{
424 417
 				$oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
425 418
 			}
@@ -437,8 +430,7 @@  discard block
 block discarded – undo
437 430
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
438 431
 				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
439 432
 				$oContext->loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
440
-			}
441
-			else
433
+			} else
442 434
 			{
443 435
 				$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', '', '', 10), true);
444 436
 				$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", '', '', 10), true);
@@ -476,14 +468,12 @@  discard block
 block discarded – undo
476 468
 			{
477 469
 				$oContext->loadFile(array('./common/css/xe.css', '', '', -10000000), true);
478 470
 				$oContext->loadFile(array('./common/css/mobile.css', '', '', -10000000), true);
479
-			}
480
-			else
471
+			} else
481 472
 			{
482 473
 				$oContext->unloadFile(array('./common/css/xe.css', '', '', -10000000), true);
483 474
 				$oContext->unloadFile(array('./common/css/mobile.css', '', '', -10000000), true);
484 475
 			}
485
-		}
486
-		else
476
+		} else
487 477
 		{
488 478
 			$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -1100000), true);
489 479
 			$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -1000000), true);
@@ -492,8 +482,7 @@  discard block
 block discarded – undo
492 482
 			{
493 483
 				$oContext->loadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
494 484
 				$oContext->loadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
495
-			}
496
-			else
485
+			} else
497 486
 			{
498 487
 				$oContext->unloadFile(array('./common/css/xe.min.css', '', '', -10000000), true);
499 488
 				$oContext->unloadFile(array('./common/css/mobile.min.css', '', '', -10000000), true);
Please login to merge, or discard this patch.
classes/file/FileHandler.class.php 3 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $target_dir Path of target dir
35 35
 	 * @param string $filter Regex to filter files. If file matches this regex, the file is not copied.
36 36
 	 * @param string $type If set as 'force'. Even if the file exists in target, the file is copied.
37
-	 * @return void
37
+	 * @return false|null
38 38
 	 */
39 39
 	function copyDir($source_dir, $target_dir, $filter = null, $type = null)
40 40
 	{
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * This function creates directories recursively, which means that if ancestors of the target directory does not exist, they will be created too.
276 276
 	 *
277 277
 	 * @param string $path_string Path of target directory
278
-	 * @return bool TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed.
278
+	 * @return boolean|null TRUE if success. It might return nothing when ftp is used and connection to the ftp address failed.
279 279
 	 */
280 280
 	function makeDir($path_string)
281 281
 	{
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 	 * @param string $url The address of the target file
616 616
 	 * @param string $target_filename The location to store
617 617
 	 * @param string $body HTTP request body
618
-	 * @param string $timeout Connection timeout
618
+	 * @param integer $timeout Connection timeout
619 619
 	 * @param string $method GET/POST
620 620
 	 * @param string $content_type Content type header of HTTP request
621 621
 	 * @param string[] $headers Headers key value array.
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 	 * Convert size in string into numeric value
637 637
 	 *
638 638
 	 * @see self::filesize()
639
-	 * @param $val Size in string (ex., 10, 10K, 10M, 10G )
640
-	 * @return int converted size
639
+	 * @param string $val Size in string (ex., 10, 10K, 10M, 10G )
640
+	 * @return double converted size
641 641
 	 */
642 642
 	function returnBytes($val)
643 643
 	{
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	 * @param int $resize_height Height to resize
688 688
 	 * @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type
689 689
 	 * @param string $thumbnail_type Thumbnail type(crop, ratio)
690
-	 * @return bool TRUE: success, FALSE: failed
690
+	 * @return null|boolean TRUE: success, FALSE: failed
691 691
 	 */
692 692
 	function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop')
693 693
 	{
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 	 * Check file exists.
1001 1001
 	 *
1002 1002
 	 * @param string $filename Target file name
1003
-	 * @return bool Returns FALSE if the file does not exists, or Returns full path file(string).
1003
+	 * @return string|false Returns FALSE if the file does not exists, or Returns full path file(string).
1004 1004
 	 */
1005 1005
 	function exists($filename)
1006 1006
 	{
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 	/**
1012 1012
 	 * Check it is dir
1013 1013
 	 *
1014
-	 * @param string $dir Target dir path
1015
-	 * @return bool Returns FALSE if the dir is not dir, or Returns full path of dir(string).
1014
+	 * @param string $path
1015
+	 * @return string|false Returns FALSE if the dir is not dir, or Returns full path of dir(string).
1016 1016
 	 */
1017 1017
 	function isDir($path)
1018 1018
 	{
Please login to merge, or discard this patch.
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
 			if(is_dir($source_dir . $file))
75 75
 			{
76 76
 				self::copyDir($source_dir . $file, $target_dir . $file, $type);
77
-			}
78
-			else
77
+			} else
79 78
 			{
80 79
 				if($type == 'force')
81 80
 				{
82 81
 					@unlink($target_dir . $file);
83
-				}
84
-				else
82
+				} else
85 83
 				{
86 84
 					if(!file_exists($target_dir . $file))
87 85
 					{
@@ -379,15 +377,13 @@  discard block
 block discarded – undo
379 377
 				if(is_dir($target))
380 378
 				{
381 379
 					self::removeDir($target);
382
-				}
383
-				else
380
+				} else
384 381
 				{
385 382
 					unlink($target);
386 383
 				}
387 384
 			}
388 385
 			rmdir($path);
389
-		}
390
-		else
386
+		} else
391 387
 		{
392 388
 			unlink($path);
393 389
 		}
@@ -454,16 +450,16 @@  discard block
 block discarded – undo
454 450
 				if(is_dir($target))
455 451
 				{
456 452
 					self::removeFilesInDir($target);
457
-				}
458
-				else
453
+				} else
459 454
 				{
460 455
 					unlink($target);
461 456
 				}
462 457
 			}
463
-		}
464
-		else
458
+		} else
465 459
 		{
466
-			if(self::exists($path)) unlink($path);
460
+			if(self::exists($path)) {
461
+				unlink($path);
462
+			}
467 463
 		}
468 464
 
469 465
 	}
@@ -532,8 +528,7 @@  discard block
 block discarded – undo
532 528
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
533 529
 				$oRequest->setMethod('POST');
534 530
 				$oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
535
-			}
536
-			else
531
+			} else
537 532
 			{
538 533
 				$oRequest = new HTTP_Request($url);
539 534
 
@@ -547,8 +542,7 @@  discard block
 block discarded – undo
547 542
 							{
548 543
 								$oRequest->attach($observer);
549 544
 							}
550
-						}
551
-						else
545
+						} else
552 546
 						{
553 547
 							$oRequest->setConfig($key, $val);
554 548
 						}
@@ -559,8 +553,7 @@  discard block
 block discarded – undo
559 553
 					if(extension_loaded('curl'))
560 554
 					{
561 555
 						$oRequest->setConfig('adapter', 'curl');
562
-					}
563
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
556
+					} elseif(version_compare(PHP_VERSION, '5.6', '<'))
564 557
 					{
565 558
 						$oRequest->setConfig('ssl_verify_host', false);
566 559
 					}
@@ -591,20 +584,21 @@  discard block
 block discarded – undo
591 584
 						$oRequest->addPostData($key, $val);
592 585
 					}
593 586
 				}
594
-				if(!$content_type)
595
-					$oRequest->addHeader('Content-Type', 'text/html');
596
-				else
597
-					$oRequest->addHeader('Content-Type', $content_type);
587
+				if(!$content_type) {
588
+									$oRequest->addHeader('Content-Type', 'text/html');
589
+				} else {
590
+									$oRequest->addHeader('Content-Type', $content_type);
591
+				}
598 592
 				$oRequest->setMethod($method);
599
-				if($body)
600
-					$oRequest->setBody($body);
593
+				if($body) {
594
+									$oRequest->setBody($body);
595
+				}
601 596
 			}
602 597
 			
603 598
 			if(method_exists($oRequest, 'setConfig'))
604 599
 			{
605 600
 				$oRequest->setConfig('timeout', $timeout);
606
-			}
607
-			elseif(property_exists($oRequest, '_timeout'))
601
+			} elseif(property_exists($oRequest, '_timeout'))
608 602
 			{
609 603
 				$oRequest->_timeout = $timeout;
610 604
 			}
@@ -635,13 +629,11 @@  discard block
 block discarded – undo
635 629
 			if(isset($request_config['store_body']) && !$request_config['store_body'])
636 630
 			{
637 631
 				return TRUE;
638
-			}
639
-			else
632
+			} else
640 633
 			{
641 634
 				return $response;
642 635
 			}
643
-		}
644
-		catch(Exception $e)
636
+		} catch(Exception $e)
645 637
 		{
646 638
 			return NULL;
647 639
 		}
@@ -672,8 +664,7 @@  discard block
 block discarded – undo
672 664
 		try
673 665
 		{
674 666
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
675
-		}
676
-		catch(Exception $e)
667
+		} catch(Exception $e)
677 668
 		{
678 669
 			return FALSE;
679 670
 		}
@@ -803,8 +794,7 @@  discard block
 block discarded – undo
803 794
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
804 795
 			$resize_width = $width * $per;
805 796
 			$resize_height = $height * $per;
806
-		}
807
-		else
797
+		} else
808 798
 		{
809 799
 			$per = ($width_per < $height_per) ? $height_per : $width_per;
810 800
 		}
@@ -814,8 +804,7 @@  discard block
 block discarded – undo
814 804
 		if(function_exists('imagecreateTRUEcolor'))
815 805
 		{
816 806
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
817
-		}
818
-		else if(function_exists('imagecreate'))
807
+		} else if(function_exists('imagecreate'))
819 808
 		{
820 809
 			$thumb = imagecreate($resize_width, $resize_height);
821 810
 		}
@@ -880,8 +869,7 @@  discard block
 block discarded – undo
880 869
 		if(function_exists('imagecopyresampled'))
881 870
 		{
882 871
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
883
-		}
884
-		else
872
+		} else
885 873
 		{
886 874
 			imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
887 875
 		}
@@ -950,8 +938,7 @@  discard block
 block discarded – undo
950 938
 		if(is_array($arr) && count($arr) > 0)
951 939
 		{
952 940
 			return $arr;
953
-		}
954
-		else
941
+		} else
955 942
 		{
956 943
 			return array();
957 944
 		}
@@ -1001,12 +988,10 @@  discard block
 block discarded – undo
1001 988
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1002 989
 				}
1003 990
 				// value
1004
-			}
1005
-			else if(is_object($val))
991
+			} else if(is_object($val))
1006 992
 			{
1007 993
 				continue;
1008
-			}
1009
-			else
994
+			} else
1010 995
 			{
1011 996
 				$return[] = sprintf("%s=\"%s\"", $key, $val);
1012 997
 			}
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 	}
160 160
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	function moveFile($source, $target)
194 194
 	{
195
-		if(($source = self::exists($source)) !== FALSE)
195
+		if (($source = self::exists($source)) !== FALSE)
196 196
 		{
197 197
 			self::removeFile($target);
198 198
 			return self::rename($source, $target);
@@ -230,35 +230,35 @@  discard block
 block discarded – undo
230 230
 		$path = self::getRealPath($path);
231 231
 		$output = array();
232 232
 
233
-		if(substr($path, -1) != '/')
233
+		if (substr($path, -1) != '/')
234 234
 		{
235 235
 			$path .= '/';
236 236
 		}
237 237
 
238
-		if(!is_dir($path))
238
+		if (!is_dir($path))
239 239
 		{
240 240
 			return $output;
241 241
 		}
242 242
 
243 243
 		$files = scandir($path);
244
-		foreach($files as $file)
244
+		foreach ($files as $file)
245 245
 		{
246
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
246
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
247 247
 			{
248 248
 				continue;
249 249
 			}
250 250
 
251
-			if($to_lower)
251
+			if ($to_lower)
252 252
 			{
253 253
 				$file = strtolower($file);
254 254
 			}
255 255
 
256
-			if($filter)
256
+			if ($filter)
257 257
 			{
258 258
 				$file = preg_replace($filter, '$1', $file);
259 259
 			}
260 260
 
261
-			if($concat_prefix)
261
+			if ($concat_prefix)
262 262
 			{
263 263
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
264 264
 			}
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	function makeDir($path_string)
281 281
 	{
282
-		if(self::exists($path_string) !== FALSE)
282
+		if (self::exists($path_string) !== FALSE)
283 283
 		{
284 284
 			return TRUE;
285 285
 		}
286 286
 
287
-		if(!ini_get('safe_mode'))
287
+		if (!ini_get('safe_mode'))
288 288
 		{
289 289
 			@mkdir($path_string, 0755, TRUE);
290 290
 			@chmod($path_string, 0755);
@@ -295,35 +295,35 @@  discard block
 block discarded – undo
295 295
 			static $oFtp = NULL;
296 296
 
297 297
 			$ftp_info = Context::getFTPInfo();
298
-			if($oFtp == NULL)
298
+			if ($oFtp == NULL)
299 299
 			{
300
-				if(!Context::isFTPRegisted())
300
+				if (!Context::isFTPRegisted())
301 301
 				{
302 302
 					return;
303 303
 				}
304 304
 
305
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
305
+				require_once(_XE_PATH_.'libs/ftp.class.php');
306 306
 				$oFtp = new ftp();
307
-				if(!$ftp_info->ftp_host)
307
+				if (!$ftp_info->ftp_host)
308 308
 				{
309 309
 					$ftp_info->ftp_host = "127.0.0.1";
310 310
 				}
311
-				if(!$ftp_info->ftp_port)
311
+				if (!$ftp_info->ftp_port)
312 312
 				{
313 313
 					$ftp_info->ftp_port = 21;
314 314
 				}
315
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
315
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
316 316
 				{
317 317
 					return;
318 318
 				}
319
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
319
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
320 320
 				{
321 321
 					$oFtp->ftp_quit();
322 322
 					return;
323 323
 				}
324 324
 			}
325 325
 
326
-			if(!($ftp_path = $ftp_info->ftp_root_path))
326
+			if (!($ftp_path = $ftp_info->ftp_root_path))
327 327
 			{
328 328
 				$ftp_path = DIRECTORY_SEPARATOR;
329 329
 			}
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
333 333
 
334 334
 			$path = _XE_PATH_;
335
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
335
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
336 336
 			{
337
-				if(!$path_list[$i])
337
+				if (!$path_list[$i])
338 338
 				{
339 339
 					continue;
340 340
 				}
341 341
 
342
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
343
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
344
-				if(!is_dir($path))
342
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
343
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
344
+				if (!is_dir($path))
345 345
 				{
346 346
 					$oFtp->ftp_mkdir($ftp_path);
347
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
347
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
348 348
 				}
349 349
 			}
350 350
 		}
@@ -360,23 +360,23 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	function removeDir($path)
362 362
 	{
363
-		if(($path = self::isDir($path)) === FALSE)
363
+		if (($path = self::isDir($path)) === FALSE)
364 364
 		{
365 365
 			return;
366 366
 		}
367 367
 
368
-		if(self::isDir($path))
368
+		if (self::isDir($path))
369 369
 		{
370 370
 			$files = array_diff(scandir($path), array('..', '.'));
371 371
 
372
-			foreach($files as $file)
372
+			foreach ($files as $file)
373 373
 			{
374
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
374
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
375 375
 				{
376 376
 					continue;
377 377
 				}
378 378
 
379
-				if(is_dir($target))
379
+				if (is_dir($target))
380 380
 				{
381 381
 					self::removeDir($target);
382 382
 				}
@@ -401,22 +401,22 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	function removeBlankDir($path)
403 403
 	{
404
-		if(($path = self::isDir($path)) === FALSE)
404
+		if (($path = self::isDir($path)) === FALSE)
405 405
 		{
406 406
 			return;
407 407
 		}
408 408
 
409 409
 		$files = array_diff(scandir($path), array('..', '.'));
410 410
 
411
-		if(count($files) < 1)
411
+		if (count($files) < 1)
412 412
 		{
413 413
 			rmdir($path);
414 414
 			return;
415 415
 		}
416 416
 
417
-		foreach($files as $file)
417
+		foreach ($files as $file)
418 418
 		{
419
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
419
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
420 420
 			{
421 421
 				continue;
422 422
 			}
@@ -435,23 +435,23 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	function removeFilesInDir($path)
437 437
 	{
438
-		if(($path = self::getRealPath($path)) === FALSE)
438
+		if (($path = self::getRealPath($path)) === FALSE)
439 439
 		{
440 440
 			return;
441 441
 		}
442 442
 
443
-		if(is_dir($path))
443
+		if (is_dir($path))
444 444
 		{
445 445
 			$files = array_diff(scandir($path), array('..', '.'));
446 446
 
447
-			foreach($files as $file)
447
+			foreach ($files as $file)
448 448
 			{
449
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
449
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
450 450
 				{
451 451
 					continue;
452 452
 				}
453 453
 
454
-				if(is_dir($target))
454
+				if (is_dir($target))
455 455
 				{
456 456
 					self::removeFilesInDir($target);
457 457
 				}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 		else
465 465
 		{
466
-			if(self::exists($path)) unlink($path);
466
+			if (self::exists($path)) unlink($path);
467 467
 		}
468 468
 
469 469
 	}
@@ -477,22 +477,22 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	function filesize($size)
479 479
 	{
480
-		if(!$size)
480
+		if (!$size)
481 481
 		{
482 482
 			return '0Byte';
483 483
 		}
484 484
 
485
-		if($size === 1)
485
+		if ($size === 1)
486 486
 		{
487 487
 			return '1Byte';
488 488
 		}
489 489
 
490
-		if($size < 1024)
490
+		if ($size < 1024)
491 491
 		{
492
-			return $size . 'Bytes';
492
+			return $size.'Bytes';
493 493
 		}
494 494
 
495
-		if($size >= 1024 && $size < 1024 * 1024)
495
+		if ($size >= 1024 && $size < 1024 * 1024)
496 496
 		{
497 497
 			return sprintf("%0.1fKB", $size / 1024);
498 498
 		}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
519 519
 	{
520
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
520
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
521 521
 		$IDN = new idna_convert(array('idn_version' => 2008));
522 522
 		$url = $IDN->encode($url);
523 523
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			require_once('HTTP/Request.php');
528 528
 
529 529
 			$parsed_url = parse_url(__PROXY_SERVER__);
530
-			if($parsed_url["host"] && $parsed_url["path"])
530
+			if ($parsed_url["host"] && $parsed_url["path"])
531 531
 			{
532 532
 				// Old style proxy server support (POST payload to proxy script)
533 533
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 				$oRequest = new HTTP_Request($url);
540 540
 
541 541
 				// New style proxy server support (Use HTTP_Request2 native config format)
542
-				if($parsed_url['host'])
542
+				if ($parsed_url['host'])
543 543
 				{
544 544
 					$request_config['proxy_host'] = $parsed_url['host'];
545 545
 					$request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : '';
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
 					$request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http';
549 549
 				}
550 550
 
551
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
551
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
552 552
 				{
553
-					foreach($request_config as $key=>$val)
553
+					foreach ($request_config as $key=>$val)
554 554
 					{
555
-						if($key === 'observers')
555
+						if ($key === 'observers')
556 556
 						{
557
-							foreach($val as $observer)
557
+							foreach ($val as $observer)
558 558
 							{
559 559
 								$oRequest->attach($observer);
560 560
 							}
@@ -565,58 +565,58 @@  discard block
 block discarded – undo
565 565
 						}
566 566
 					}
567 567
 				}
568
-				if(method_exists($oRequest, 'setConfig'))
568
+				if (method_exists($oRequest, 'setConfig'))
569 569
 				{
570
-					if(extension_loaded('curl'))
570
+					if (extension_loaded('curl'))
571 571
 					{
572 572
 						$oRequest->setConfig('adapter', 'curl');
573 573
 					}
574
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
574
+					elseif (version_compare(PHP_VERSION, '5.6', '<'))
575 575
 					{
576 576
 						$oRequest->setConfig('ssl_verify_host', false);
577 577
 					}
578
-					if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem'))
578
+					if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem'))
579 579
 					{
580
-						$oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem');
580
+						$oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem');
581 581
 					}
582 582
 				}
583 583
 
584
-				if(count($headers) > 0)
584
+				if (count($headers) > 0)
585 585
 				{
586
-					foreach($headers as $key => $val)
586
+					foreach ($headers as $key => $val)
587 587
 					{
588 588
 						$oRequest->addHeader($key, $val);
589 589
 					}
590 590
 				}
591 591
 				$host = parse_url($url, PHP_URL_HOST);
592
-				if($cookies[$host])
592
+				if ($cookies[$host])
593 593
 				{
594
-					foreach($cookies[$host] as $key => $val)
594
+					foreach ($cookies[$host] as $key => $val)
595 595
 					{
596 596
 						$oRequest->addCookie($key, $val);
597 597
 					}
598 598
 				}
599
-				if(count($post_data) > 0)
599
+				if (count($post_data) > 0)
600 600
 				{
601
-					foreach($post_data as $key => $val)
601
+					foreach ($post_data as $key => $val)
602 602
 					{
603 603
 						$oRequest->addPostData($key, $val);
604 604
 					}
605 605
 				}
606
-				if(!$content_type)
606
+				if (!$content_type)
607 607
 					$oRequest->addHeader('Content-Type', 'text/html');
608 608
 				else
609 609
 					$oRequest->addHeader('Content-Type', $content_type);
610 610
 				$oRequest->setMethod($method);
611
-				if($body)
611
+				if ($body)
612 612
 					$oRequest->setBody($body);
613 613
 			}
614 614
 			
615
-			if(method_exists($oRequest, 'setConfig'))
615
+			if (method_exists($oRequest, 'setConfig'))
616 616
 			{
617 617
 				$oRequest->setConfig('timeout', $timeout);
618 618
 			}
619
-			elseif(property_exists($oRequest, '_timeout'))
619
+			elseif (property_exists($oRequest, '_timeout'))
620 620
 			{
621 621
 				$oRequest->_timeout = $timeout;
622 622
 			}
@@ -626,25 +626,25 @@  discard block
 block discarded – undo
626 626
 			$code = $oRequest->getResponseCode();
627 627
 			$header = $oRequest->getResponseHeader();
628 628
 			$response = $oRequest->getResponseBody();
629
-			if($c = $oRequest->getResponseCookies())
629
+			if ($c = $oRequest->getResponseCookies())
630 630
 			{
631
-				foreach($c as $k => $v)
631
+				foreach ($c as $k => $v)
632 632
 				{
633 633
 					$cookies[$host][$v['name']] = $v['value'];
634 634
 				}
635 635
 			}
636 636
 
637
-			if($code > 300 && $code < 399 && $header['location'])
637
+			if ($code > 300 && $code < 399 && $header['location'])
638 638
 			{
639 639
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
640 640
 			}
641 641
 
642
-			if($code != 200)
642
+			if ($code != 200)
643 643
 			{
644 644
 				return;
645 645
 			}
646 646
 
647
-			if(isset($request_config['store_body']) && !$request_config['store_body'])
647
+			if (isset($request_config['store_body']) && !$request_config['store_body'])
648 648
 			{
649 649
 				return TRUE;
650 650
 			}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 				return $response;
654 654
 			}
655 655
 		}
656
-		catch(Exception $e)
656
+		catch (Exception $e)
657 657
 		{
658 658
 			return NULL;
659 659
 		}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 		{
686 686
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
687 687
 		}
688
-		catch(Exception $e)
688
+		catch (Exception $e)
689 689
 		{
690 690
 			return FALSE;
691 691
 		}
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	function returnBytes($val)
703 703
 	{
704 704
 		$unit = strtoupper(substr($val, -1));
705
-		$val = (float)$val;
705
+		$val = (float) $val;
706 706
 
707 707
 		switch ($unit)
708 708
 		{
@@ -725,13 +725,13 @@  discard block
 block discarded – undo
725 725
 		$K64 = 65536;
726 726
 		$TWEAKFACTOR = 2.0;
727 727
 		$channels = $imageInfo['channels'];
728
-		if(!$channels)
728
+		if (!$channels)
729 729
 		{
730 730
 			$channels = 6; //for png
731 731
 		}
732
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
732
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
733 733
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
734
-		if($availableMemory < $memoryNeeded)
734
+		if ($availableMemory < $memoryNeeded)
735 735
 		{
736 736
 			return FALSE;
737 737
 		}
@@ -758,30 +758,30 @@  discard block
 block discarded – undo
758 758
 		}
759 759
 
760 760
 		$target_file = self::getRealPath($target_file);
761
-		if(!$resize_width)
761
+		if (!$resize_width)
762 762
 		{
763 763
 			$resize_width = 100;
764 764
 		}
765 765
 
766
-		if(!$resize_height)
766
+		if (!$resize_height)
767 767
 		{
768 768
 			$resize_height = $resize_width;
769 769
 		}
770 770
 
771 771
 		// retrieve source image's information
772 772
 		$imageInfo = getimagesize($source_file);
773
-		if(!self::checkMemoryLoadImage($imageInfo))
773
+		if (!self::checkMemoryLoadImage($imageInfo))
774 774
 		{
775 775
 			return FALSE;
776 776
 		}
777 777
 
778 778
 		list($width, $height, $type, $attrs) = $imageInfo;
779
-		if($width < 1 || $height < 1)
779
+		if ($width < 1 || $height < 1)
780 780
 		{
781 781
 			return;
782 782
 		}
783 783
 
784
-		switch($type)
784
+		switch ($type)
785 785
 		{
786 786
 			case '1' :
787 787
 				$type = 'gif';
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 				return;
800 800
 		}
801 801
 
802
-		if(!$target_type)
802
+		if (!$target_type)
803 803
 		{
804 804
 			$target_type = $type;
805 805
 		}
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
811 811
 
812 812
 		$per = NULL;
813
-		if($thumbnail_type == 'ratio')
813
+		if ($thumbnail_type == 'ratio')
814 814
 		{
815 815
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
816 816
 			$resize_width = $width * $per;
@@ -823,16 +823,16 @@  discard block
 block discarded – undo
823 823
 
824 824
 		// create temporary image with target size
825 825
 		$thumb = NULL;
826
-		if(function_exists('imagecreateTRUEcolor'))
826
+		if (function_exists('imagecreateTRUEcolor'))
827 827
 		{
828 828
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
829 829
 		}
830
-		else if(function_exists('imagecreate'))
830
+		else if (function_exists('imagecreate'))
831 831
 		{
832 832
 			$thumb = imagecreate($resize_width, $resize_height);
833 833
 		}
834 834
 
835
-		if(!$thumb)
835
+		if (!$thumb)
836 836
 		{
837 837
 			return FALSE;
838 838
 		}
@@ -841,37 +841,37 @@  discard block
 block discarded – undo
841 841
 
842 842
 		// create temporary image having original type
843 843
 		$source = NULL;
844
-		switch($type)
844
+		switch ($type)
845 845
 		{
846 846
 			case 'gif' :
847
-				if(function_exists('imagecreatefromgif'))
847
+				if (function_exists('imagecreatefromgif'))
848 848
 				{
849 849
 					$source = @imagecreatefromgif($source_file);
850 850
 				}
851 851
 				break;
852 852
 			case 'jpeg' :
853 853
 			case 'jpg' :
854
-				if(function_exists('imagecreatefromjpeg'))
854
+				if (function_exists('imagecreatefromjpeg'))
855 855
 				{
856 856
 					$source = @imagecreatefromjpeg($source_file);
857 857
 				}
858 858
 				break;
859 859
 			case 'png' :
860
-				if(function_exists('imagecreatefrompng'))
860
+				if (function_exists('imagecreatefrompng'))
861 861
 				{
862 862
 					$source = @imagecreatefrompng($source_file);
863 863
 				}
864 864
 				break;
865 865
 			case 'wbmp' :
866 866
 			case 'bmp' :
867
-				if(function_exists('imagecreatefromwbmp'))
867
+				if (function_exists('imagecreatefromwbmp'))
868 868
 				{
869 869
 					$source = @imagecreatefromwbmp($source_file);
870 870
 				}
871 871
 				break;
872 872
 		}
873 873
 
874
-		if(!$source)
874
+		if (!$source)
875 875
 		{
876 876
 			imagedestroy($thumb);
877 877
 			return FALSE;
@@ -883,13 +883,13 @@  discard block
 block discarded – undo
883 883
 
884 884
 		$x = 0;
885 885
 		$y = 0;
886
-		if($thumbnail_type == 'crop')
886
+		if ($thumbnail_type == 'crop')
887 887
 		{
888 888
 			$x = (int) ($resize_width / 2 - $new_width / 2);
889 889
 			$y = (int) ($resize_height / 2 - $new_height / 2);
890 890
 		}
891 891
 
892
-		if(function_exists('imagecopyresampled'))
892
+		if (function_exists('imagecopyresampled'))
893 893
 		{
894 894
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
895 895
 		}
@@ -903,30 +903,30 @@  discard block
 block discarded – undo
903 903
 
904 904
 		// write into the file
905 905
 		$output = NULL;
906
-		switch($target_type)
906
+		switch ($target_type)
907 907
 		{
908 908
 			case 'gif' :
909
-				if(function_exists('imagegif'))
909
+				if (function_exists('imagegif'))
910 910
 				{
911 911
 					$output = imagegif($thumb, $target_file);
912 912
 				}
913 913
 				break;
914 914
 			case 'jpeg' :
915 915
 			case 'jpg' :
916
-				if(function_exists('imagejpeg'))
916
+				if (function_exists('imagejpeg'))
917 917
 				{
918 918
 					$output = imagejpeg($thumb, $target_file, 100);
919 919
 				}
920 920
 				break;
921 921
 			case 'png' :
922
-				if(function_exists('imagepng'))
922
+				if (function_exists('imagepng'))
923 923
 				{
924 924
 					$output = imagepng($thumb, $target_file, 9);
925 925
 				}
926 926
 				break;
927 927
 			case 'wbmp' :
928 928
 			case 'bmp' :
929
-				if(function_exists('imagewbmp'))
929
+				if (function_exists('imagewbmp'))
930 930
 				{
931 931
 					$output = imagewbmp($thumb, $target_file, 100);
932 932
 				}
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 		imagedestroy($thumb);
937 937
 		imagedestroy($source);
938 938
 
939
-		if(!$output)
939
+		if (!$output)
940 940
 		{
941 941
 			return FALSE;
942 942
 		}
@@ -954,12 +954,12 @@  discard block
 block discarded – undo
954 954
 	 */
955 955
 	function readIniFile($filename)
956 956
 	{
957
-		if(($filename = self::exists($filename)) === FALSE)
957
+		if (($filename = self::exists($filename)) === FALSE)
958 958
 		{
959 959
 			return FALSE;
960 960
 		}
961 961
 		$arr = parse_ini_file($filename, TRUE);
962
-		if(is_array($arr) && count($arr) > 0)
962
+		if (is_array($arr) && count($arr) > 0)
963 963
 		{
964 964
 			return $arr;
965 965
 		}
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	 */
986 986
 	function writeIniFile($filename, $arr)
987 987
 	{
988
-		if(!is_array($arr) || count($arr) == 0)
988
+		if (!is_array($arr) || count($arr) == 0)
989 989
 		{
990 990
 			return FALSE;
991 991
 		}
@@ -1002,19 +1002,19 @@  discard block
 block discarded – undo
1002 1002
 	function _makeIniBuff($arr)
1003 1003
 	{
1004 1004
 		$return = array();
1005
-		foreach($arr as $key => $val)
1005
+		foreach ($arr as $key => $val)
1006 1006
 		{
1007 1007
 			// section
1008
-			if(is_array($val))
1008
+			if (is_array($val))
1009 1009
 			{
1010 1010
 				$return[] = sprintf("[%s]", $key);
1011
-				foreach($val as $k => $v)
1011
+				foreach ($val as $k => $v)
1012 1012
 				{
1013 1013
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1014 1014
 				}
1015 1015
 				// value
1016 1016
 			}
1017
-			else if(is_object($val))
1017
+			else if (is_object($val))
1018 1018
 			{
1019 1019
 				continue;
1020 1020
 			}
@@ -1089,15 +1089,15 @@  discard block
 block discarded – undo
1089 1089
 	function isWritableDir($path)
1090 1090
 	{
1091 1091
 		$path = self::getRealPath($path);
1092
-		if(is_dir($path)==FALSE)
1092
+		if (is_dir($path) == FALSE)
1093 1093
 		{
1094 1094
 			return FALSE;
1095 1095
 		}
1096 1096
 
1097
-		$checkFile = $path . '/_CheckWritableDir';
1097
+		$checkFile = $path.'/_CheckWritableDir';
1098 1098
 
1099 1099
 		$fp = fopen($checkFile, 'w');
1100
-		if(!is_resource($fp))
1100
+		if (!is_resource($fp))
1101 1101
 		{
1102 1102
 			return FALSE;
1103 1103
 		}
Please login to merge, or discard this patch.
classes/httprequest/XEHttpRequest.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 
52 52
 	/**
53 53
 	 * Mether to add key/value pair to the HTTP request header
54
-	 * @param int|string $key HTTP header element
54
+	 * @param string $key HTTP header element
55 55
 	 * @param string $value value string for HTTP header element
56 56
 	 * @return void
57 57
 	 */
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,8 +97,7 @@  discard block
 block discarded – undo
97 97
 		if(FALSE && is_callable('curl_init'))
98 98
 		{
99 99
 			return $this->sendWithCurl($target, $method, $timeout, $post_vars);
100
-		}
101
-		else
100
+		} else
102 101
 		{
103 102
 			return $this->sendWithSock($target, $method, $timeout, $post_vars);
104 103
 		}
@@ -179,8 +178,7 @@  discard block
 block discarded – undo
179 178
 				{
180 179
 					$body .= fgets($sock, $chunk_size+1);
181 180
 				}
182
-			}
183
-			else
181
+			} else
184 182
 			{
185 183
 				$body .= fgets($sock, 512);
186 184
 			}
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * constructor
42 42
 	 * @return void
43 43
 	 */
44
-	function XEHttpRequest($host, $port, $scheme='')
44
+	function XEHttpRequest($host, $port, $scheme = '')
45 45
 	{
46 46
 		$this->m_host = $host;
47 47
 		$this->m_port = $port;
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 		$this->addToHeader('Connection', 'close');
77 77
 
78 78
 		$method = strtoupper($method);
79
-		if(!$allow_methods)
79
+		if (!$allow_methods)
80 80
 		{
81 81
 			$allow_methods = explode(' ', 'GET POST PUT');
82 82
 		}
83
-		if(!in_array($method, $allow_methods))
83
+		if (!in_array($method, $allow_methods))
84 84
 		{
85 85
 			$method = $allow_methods[0];
86 86
 		}
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 		$timout = max((int) $timeout, 0);
90 90
 
91 91
 		// list of post variables
92
-		if(!is_array($post_vars))
92
+		if (!is_array($post_vars))
93 93
 		{
94 94
 			$post_vars = array();
95 95
 		}
96 96
 
97
-		if(FALSE && is_callable('curl_init'))
97
+		if (FALSE && is_callable('curl_init'))
98 98
 		{
99 99
 			return $this->sendWithCurl($target, $method, $timeout, $post_vars);
100 100
 		}
@@ -117,30 +117,30 @@  discard block
 block discarded – undo
117 117
 		static $crlf = "\r\n";
118 118
 
119 119
 		$scheme = '';
120
-		if($this->m_scheme=='https')
120
+		if ($this->m_scheme == 'https')
121 121
 		{
122 122
 			$scheme = 'ssl://';
123 123
 		}
124 124
 
125
-		$sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout);
126
-		if(!$sock)
125
+		$sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout);
126
+		if (!$sock)
127 127
 		{
128 128
 			return new Object(-1, 'socket_connect_failed');
129 129
 		}
130 130
 
131 131
 		$headers = $this->m_headers + array();
132
-		if(!isset($headers['Accept-Encoding']))
132
+		if (!isset($headers['Accept-Encoding']))
133 133
 		{
134 134
 			$headers['Accept-Encoding'] = 'identity';
135 135
 		}
136 136
 
137 137
 		// post body
138 138
 		$post_body = '';
139
-		if($method == 'POST' && count($post_vars))
139
+		if ($method == 'POST' && count($post_vars))
140 140
 		{
141
-			foreach($post_vars as $key => $value)
141
+			foreach ($post_vars as $key => $value)
142 142
 			{
143
-				$post_body .= urlencode($key) . '=' . urlencode($value) . '&';
143
+				$post_body .= urlencode($key).'='.urlencode($value).'&';
144 144
 			}
145 145
 			$post_body = substr($post_body, 0, -1);
146 146
 
@@ -149,35 +149,35 @@  discard block
 block discarded – undo
149 149
 		}
150 150
 
151 151
 		$request = "$method $target HTTP/1.1$crlf";
152
-		foreach($headers as $equiv => $content)
152
+		foreach ($headers as $equiv => $content)
153 153
 		{
154 154
 			$request .= "$equiv: $content$crlf";
155 155
 		}
156
-		$request .= $crlf . $post_body;
156
+		$request .= $crlf.$post_body;
157 157
 		fwrite($sock, $request);
158 158
 
159 159
 		list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3);
160 160
 
161 161
 		// read response headers
162 162
 		$is_chunked = FALSE;
163
-		while(strlen(trim($line = fgets($sock))))
163
+		while (strlen(trim($line = fgets($sock))))
164 164
 		{
165 165
 			list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2);
166
-			if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked')
166
+			if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked')
167 167
 			{
168 168
 				$is_chunked = TRUE;
169 169
 			}
170 170
 		}
171 171
 
172 172
 		$body = '';
173
-		while(!feof($sock))
173
+		while (!feof($sock))
174 174
 		{
175
-			if($is_chunked)
175
+			if ($is_chunked)
176 176
 			{
177 177
 				$chunk_size = hexdec(fgets($sock));
178
-				if($chunk_size)
178
+				if ($chunk_size)
179 179
 				{
180
-					$body .= fgets($sock, $chunk_size+1);
180
+					$body .= fgets($sock, $chunk_size + 1);
181 181
 				}
182 182
 			}
183 183
 			else
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
220 220
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
221 221
 
222
-		switch($method)
222
+		switch ($method)
223 223
 		{
224 224
 			case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true);
225 225
 				break;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		$arr_headers = array();
235
-		foreach($headers as $key => $value)
235
+		foreach ($headers as $key => $value)
236 236
 		{
237 237
 			$arr_headers[] = "$key: $value";
238 238
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers);
241 241
 
242 242
 		$body = curl_exec($ch);
243
-		if(curl_errno($ch))
243
+		if (curl_errno($ch))
244 244
 		{
245 245
 			return new Object(-1, 'socket_connect_failed');
246 246
 		}
Please login to merge, or discard this patch.
classes/mail/Mail.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 	/**
129 129
 	 * Constructor function
130 130
 	 *
131
-	 * @return void
131
+	 * @return string
132 132
 	 */
133 133
 	function Mail()
134 134
 	{
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
 		if($this->isVaildMailAddress($account_name))
152 152
 		{
153 153
 			$this->Username = $account_name;
154
-		}
155
-		else
154
+		} else
156 155
 		{
157 156
 			$this->Username = $account_name . '@gmail.com';
158 157
 		}
@@ -190,8 +189,7 @@  discard block
 block discarded – undo
190 189
 			$this->IsSMTP();
191 190
 			$this->AltBody = "To view the message, please use an HTML compatible email viewer!";
192 191
 			return TRUE;
193
-		}
194
-		else
192
+		} else
195 193
 		{
196 194
 			$this->IsMail();
197 195
 			return FALSE;
@@ -246,8 +244,7 @@  discard block
 block discarded – undo
246 244
 		{
247 245
 			$this->sender_name = $name;
248 246
 			$this->sender_email = $email;
249
-		}
250
-		else
247
+		} else
251 248
 		{
252 249
 			$this->SetFrom($email, $name);
253 250
 		}
@@ -280,8 +277,7 @@  discard block
 block discarded – undo
280 277
 		{
281 278
 			$this->receiptor_name = $name;
282 279
 			$this->receiptor_email = $email;
283
-		}
284
-		else
280
+		} else
285 281
 		{
286 282
 			$this->AddAddress($email, $name);
287 283
 		}
@@ -312,8 +308,7 @@  discard block
 block discarded – undo
312 308
 		if($this->Mailer == "mail")
313 309
 		{
314 310
 			$this->title = $title;
315
-		}
316
-		else
311
+		} else
317 312
 		{
318 313
 			$this->Subject = $title;
319 314
 		}
@@ -340,8 +335,7 @@  discard block
 block discarded – undo
340 335
 		if($this->Mailer == "mail")
341 336
 		{
342 337
 			$this->bcc = $bcc;
343
-		}
344
-		else
338
+		} else
345 339
 		{
346 340
 			$this->AddBCC($bcc);
347 341
 		}
@@ -380,8 +374,7 @@  discard block
 block discarded – undo
380 374
 		if($this->Mailer == "mail")
381 375
 		{
382 376
 			$this->replyTo = $replyTo;
383
-		}
384
-		else
377
+		} else
385 378
 		{
386 379
 			$this->AddReplyTo($replyTo);
387 380
 		}
@@ -399,8 +392,7 @@  discard block
 block discarded – undo
399 392
 		if($this->Mailer == "mail")
400 393
 		{
401 394
 			$this->content = $content;
402
-		}
403
-		else
395
+		} else
404 396
 		{
405 397
 			$this->MsgHTML($content);
406 398
 		}
@@ -486,8 +478,7 @@  discard block
 block discarded – undo
486 478
 				$this->body = implode("", $res);
487 479
 				$this->body .= "--" . $boundary . "--";
488 480
 			}
489
-		}
490
-		else
481
+		} else
491 482
 		{
492 483
 			if(count($this->attachments) > 0)
493 484
 			{
@@ -578,8 +569,7 @@  discard block
 block discarded – undo
578 569
 				return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params);
579 570
 			}
580 571
 			return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers);
581
-		}
582
-		else
572
+		} else
583 573
 		{
584 574
 			$this->procAttachments();
585 575
 			return parent::Send();
@@ -604,8 +594,7 @@  discard block
 block discarded – undo
604 594
 			if(checkdnsrr($host, "MX") || checkdnsrr($host, "A"))
605 595
 			{
606 596
 				return TRUE;
607
-			}
608
-			else
597
+			} else
609 598
 			{
610 599
 				return FALSE;
611 600
 			}
@@ -624,8 +613,7 @@  discard block
 block discarded – undo
624 613
 		if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address))
625 614
 		{
626 615
 			return $email_address;
627
-		}
628
-		else
616
+		} else
629 617
 		{
630 618
 			return '';
631 619
 		}
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php";
4
+require_once _XE_PATH_."libs/phpmailer/phpmailer.php";
5 5
 
6 6
 /**
7 7
  * Mailing class for XpressEngine
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
 		$this->SMTPSecure = "tls";
149 149
 		$this->Host = 'smtp.gmail.com';
150 150
 		$this->Port = '587';
151
-		if($this->isVaildMailAddress($account_name))
151
+		if ($this->isVaildMailAddress($account_name))
152 152
 		{
153 153
 			$this->Username = $account_name;
154 154
 		}
155 155
 		else
156 156
 		{
157
-			$this->Username = $account_name . '@gmail.com';
157
+			$this->Username = $account_name.'@gmail.com';
158 158
 		}
159 159
 		$this->Password = $account_passwd;
160 160
 		$this->IsSMTP();
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 		$this->Password = $pass;
181 181
 		$this->Port = $port;
182 182
 
183
-		if($secure == 'ssl' || $secure == 'tls')
183
+		if ($secure == 'ssl' || $secure == 'tls')
184 184
 		{
185 185
 			$this->SMTPSecure = $secure;
186 186
 		}
187 187
 
188
-		if(($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL))
188
+		if (($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL))
189 189
 		{
190 190
 			$this->IsSMTP();
191 191
 			$this->AltBody = "To view the message, please use an HTML compatible email viewer!";
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	function setSender($name, $email)
244 244
 	{
245
-		if($this->Mailer == "mail")
245
+		if ($this->Mailer == "mail")
246 246
 		{
247 247
 			$this->sender_name = $name;
248 248
 			$this->sender_email = $email;
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	function getSender()
262 262
 	{
263
-		if(!stristr(PHP_OS, 'win') && $this->sender_name)
263
+		if (!stristr(PHP_OS, 'win') && $this->sender_name)
264 264
 		{
265
-			return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->sender_name) . '?=', $this->sender_email);
265
+			return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->sender_name).'?=', $this->sender_email);
266 266
 		}
267 267
 		return $this->sender_email;
268 268
 	}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	function setReceiptor($name, $email)
278 278
 	{
279
-		if($this->Mailer == "mail")
279
+		if ($this->Mailer == "mail")
280 280
 		{
281 281
 			$this->receiptor_name = $name;
282 282
 			$this->receiptor_email = $email;
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	function getReceiptor()
296 296
 	{
297
-		if(!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email)
297
+		if (!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email)
298 298
 		{
299
-			return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->receiptor_name) . '?=', $this->receiptor_email);
299
+			return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->receiptor_name).'?=', $this->receiptor_email);
300 300
 		}
301 301
 		return $this->receiptor_email;
302 302
 	}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	function setTitle($title)
311 311
 	{
312
-		if($this->Mailer == "mail")
312
+		if ($this->Mailer == "mail")
313 313
 		{
314 314
 			$this->title = $title;
315 315
 		}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	function getTitle()
328 328
 	{
329
-		return '=?utf-8?b?' . base64_encode($this->title) . '?=';
329
+		return '=?utf-8?b?'.base64_encode($this->title).'?=';
330 330
 	}
331 331
 
332 332
 	/**
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	function setBCC($bcc)
339 339
 	{
340
-		if($this->Mailer == "mail")
340
+		if ($this->Mailer == "mail")
341 341
 		{
342 342
 			$this->bcc = $bcc;
343 343
 		}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	function setReplyTo($replyTo)
379 379
 	{
380
-		if($this->Mailer == "mail")
380
+		if ($this->Mailer == "mail")
381 381
 		{
382 382
 			$this->replyTo = $replyTo;
383 383
 		}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	function setContent($content)
397 397
 	{
398 398
 		$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
399
-		if($this->Mailer == "mail")
399
+		if ($this->Mailer == "mail")
400 400
 		{
401 401
 			$this->content = $content;
402 402
 		}
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	function replaceResourceRealPath($matches)
417 417
 	{
418
-		return preg_replace('/src=(["\']?)files/i', 'src=$1' . Context::getRequestUri() . 'files', $matches[0]);
418
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
419 419
 	}
420 420
 
421 421
 	/**
@@ -456,42 +456,42 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	function procAttachments()
458 458
 	{
459
-		if($this->Mailer == "mail")
459
+		if ($this->Mailer == "mail")
460 460
 		{
461
-			if(count($this->attachments) > 0)
461
+			if (count($this->attachments) > 0)
462 462
 			{
463
-				$this->body = $this->header . $this->body;
464
-				$boundary = '----==' . uniqid(rand(), TRUE);
465
-				$this->header = "Content-Type: multipart/mixed;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
466
-				$this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol;
463
+				$this->body = $this->header.$this->body;
464
+				$boundary = '----=='.uniqid(rand(), TRUE);
465
+				$this->header = "Content-Type: multipart/mixed;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
466
+				$this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol;
467 467
 				$res = array();
468 468
 				$res[] = $this->body;
469
-				foreach($this->attachments as $filename => $attachment)
469
+				foreach ($this->attachments as $filename => $attachment)
470 470
 				{
471 471
 					$type = $this->returnMIMEType($filename);
472 472
 					$file_handler = new FileHandler();
473 473
 					$file_str = $file_handler->readFile($attachment);
474 474
 					$chunks = chunk_split(base64_encode($file_str));
475 475
 					$tempBody = sprintf(
476
-							"--" . $boundary . $this->eol .
477
-							"Content-Type: %s;" . $this->eol .
478
-							"\tname=\"%s\"" . $this->eol .
479
-							"Content-Transfer-Encoding: base64" . $this->eol .
480
-							"Content-Description: %s" . $this->eol .
481
-							"Content-Disposition: attachment;" . $this->eol .
482
-							"\tfilename=\"%s\"" . $this->eol . $this->eol .
483
-							"%s" . $this->eol . $this->eol, $type, $filename, $filename, $filename, $chunks);
476
+							"--".$boundary.$this->eol.
477
+							"Content-Type: %s;".$this->eol.
478
+							"\tname=\"%s\"".$this->eol.
479
+							"Content-Transfer-Encoding: base64".$this->eol.
480
+							"Content-Description: %s".$this->eol.
481
+							"Content-Disposition: attachment;".$this->eol.
482
+							"\tfilename=\"%s\"".$this->eol.$this->eol.
483
+							"%s".$this->eol.$this->eol, $type, $filename, $filename, $filename, $chunks);
484 484
 					$res[] = $tempBody;
485 485
 				}
486 486
 				$this->body = implode("", $res);
487
-				$this->body .= "--" . $boundary . "--";
487
+				$this->body .= "--".$boundary."--";
488 488
 			}
489 489
 		}
490 490
 		else
491 491
 		{
492
-			if(count($this->attachments) > 0)
492
+			if (count($this->attachments) > 0)
493 493
 			{
494
-				foreach($this->attachments as $filename => $attachment)
494
+				foreach ($this->attachments as $filename => $attachment)
495 495
 				{
496 496
 					parent::AddAttachment($attachment);
497 497
 				}
@@ -506,33 +506,33 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	function procCidAttachments()
508 508
 	{
509
-		if(count($this->cidAttachments) > 0)
509
+		if (count($this->cidAttachments) > 0)
510 510
 		{
511
-			$this->body = $this->header . $this->body;
512
-			$boundary = '----==' . uniqid(rand(), TRUE);
513
-			$this->header = "Content-Type: multipart/relative;" . $this->eol . "\ttype=\"multipart/alternative\";" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
514
-			$this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol;
511
+			$this->body = $this->header.$this->body;
512
+			$boundary = '----=='.uniqid(rand(), TRUE);
513
+			$this->header = "Content-Type: multipart/relative;".$this->eol."\ttype=\"multipart/alternative\";".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
514
+			$this->body = "--".$boundary.$this->eol.$this->body.$this->eol.$this->eol;
515 515
 			$res = array();
516 516
 			$res[] = $this->body;
517
-			foreach($this->cidAttachments as $cid => $attachment)
517
+			foreach ($this->cidAttachments as $cid => $attachment)
518 518
 			{
519 519
 				$filename = basename($attachment);
520 520
 				$type = $this->returnMIMEType(FileHandler::getRealPath($attachment));
521 521
 				$file_str = FileHandler::readFile($attachment);
522 522
 				$chunks = chunk_split(base64_encode($file_str));
523 523
 				$tempBody = sprintf(
524
-						"--" . $boundary . $this->eol .
525
-						"Content-Type: %s;" . $this->eol .
526
-						"\tname=\"%s\"" . $this->eol .
527
-						"Content-Transfer-Encoding: base64" . $this->eol .
528
-						"Content-ID: <%s>" . $this->eol .
529
-						"Content-Description: %s" . $this->eol .
530
-						"Content-Location: %s" . $this->eol . $this->eol .
531
-						"%s" . $this->eol . $this->eol, $type, $filename, $cid, $filename, $filename, $chunks);
524
+						"--".$boundary.$this->eol.
525
+						"Content-Type: %s;".$this->eol.
526
+						"\tname=\"%s\"".$this->eol.
527
+						"Content-Transfer-Encoding: base64".$this->eol.
528
+						"Content-ID: <%s>".$this->eol.
529
+						"Content-Description: %s".$this->eol.
530
+						"Content-Location: %s".$this->eol.$this->eol.
531
+						"%s".$this->eol.$this->eol, $type, $filename, $cid, $filename, $filename, $chunks);
532 532
 				$res[] = $tempBody;
533 533
 			}
534 534
 			$this->body = implode("", $res);
535
-			$this->body .= "--" . $boundary . "--";
535
+			$this->body .= "--".$boundary."--";
536 536
 		}
537 537
 	}
538 538
 
@@ -543,37 +543,37 @@  discard block
 block discarded – undo
543 543
 	 */
544 544
 	function send()
545 545
 	{
546
-		if($this->Mailer == "mail")
546
+		if ($this->Mailer == "mail")
547 547
 		{
548
-			$boundary = '----==' . uniqid(rand(), TRUE);
548
+			$boundary = '----=='.uniqid(rand(), TRUE);
549 549
 			$this->eol = $GLOBALS['_qmail_compatibility'] == "Y" ? "\n" : "\r\n";
550
-			$this->header = "Content-Type: multipart/alternative;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol;
550
+			$this->header = "Content-Type: multipart/alternative;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol;
551 551
 			$this->body = sprintf(
552
-					"--%s" . $this->eol .
553
-					"Content-Type: text/plain; charset=utf-8; format=flowed" . $this->eol .
554
-					"Content-Transfer-Encoding: base64" . $this->eol .
555
-					"Content-Disposition: inline" . $this->eol . $this->eol .
556
-					"%s" .
557
-					"--%s" . $this->eol .
558
-					"Content-Type: text/html; charset=utf-8" . $this->eol .
559
-					"Content-Transfer-Encoding: base64" . $this->eol .
560
-					"Content-Disposition: inline" . $this->eol . $this->eol .
561
-					"%s" .
562
-					"--%s--" .
552
+					"--%s".$this->eol.
553
+					"Content-Type: text/plain; charset=utf-8; format=flowed".$this->eol.
554
+					"Content-Transfer-Encoding: base64".$this->eol.
555
+					"Content-Disposition: inline".$this->eol.$this->eol.
556
+					"%s".
557
+					"--%s".$this->eol.
558
+					"Content-Type: text/html; charset=utf-8".$this->eol.
559
+					"Content-Transfer-Encoding: base64".$this->eol.
560
+					"Content-Disposition: inline".$this->eol.$this->eol.
561
+					"%s".
562
+					"--%s--".
563 563
 					"", $boundary, $this->getPlainContent(), $boundary, $this->getHTMLContent(), $boundary
564 564
 			);
565 565
 			$this->procCidAttachments();
566 566
 			$this->procAttachments();
567 567
 			$headers = sprintf(
568
-					"From: %s" . $this->eol .
569
-					"%s" .
570
-					"%s" .
571
-					"%s" .
572
-					"%s" .
573
-					"MIME-Version: 1.0" . $this->eol . "", $this->getSender(), $this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol) : "", $this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol) : "", $this->bcc ? ("Bcc: " . $this->bcc . $this->eol) : "", $this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol) : ""
568
+					"From: %s".$this->eol.
569
+					"%s".
570
+					"%s".
571
+					"%s".
572
+					"%s".
573
+					"MIME-Version: 1.0".$this->eol."", $this->getSender(), $this->messageId ? ("Message-ID: <".$this->messageId.">".$this->eol) : "", $this->replyTo ? ("Reply-To: <".$this->replyTo.">".$this->eol) : "", $this->bcc ? ("Bcc: ".$this->bcc.$this->eol) : "", $this->references ? ("References: <".$this->references.">".$this->eol."In-Reply-To: <".$this->references.">".$this->eol) : ""
574 574
 			);
575 575
 			$headers .= $this->header;
576
-			if($this->additional_params)
576
+			if ($this->additional_params)
577 577
 			{
578 578
 				return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params);
579 579
 			}
@@ -594,14 +594,14 @@  discard block
 block discarded – undo
594 594
 	 */
595 595
 	function checkMailMX($email_address)
596 596
 	{
597
-		if(!Mail::isVaildMailAddress($email_address))
597
+		if (!Mail::isVaildMailAddress($email_address))
598 598
 		{
599 599
 			return FALSE;
600 600
 		}
601 601
 		list($user, $host) = explode("@", $email_address);
602
-		if(function_exists('checkdnsrr'))
602
+		if (function_exists('checkdnsrr'))
603 603
 		{
604
-			if(checkdnsrr($host, "MX") || checkdnsrr($host, "A"))
604
+			if (checkdnsrr($host, "MX") || checkdnsrr($host, "A"))
605 605
 			{
606 606
 				return TRUE;
607 607
 			}
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 */
622 622
 	function isVaildMailAddress($email_address)
623 623
 	{
624
-		if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address))
624
+		if (preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address))
625 625
 		{
626 626
 			return $email_address;
627 627
 		}
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 	function returnMIMEType($filename)
641 641
 	{
642 642
 		preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix);
643
-		switch(strtolower($fileSuffix[1]))
643
+		switch (strtolower($fileSuffix[1]))
644 644
 		{
645 645
 			case "js" :
646 646
 				return "application/x-javascript";
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			case "gif" :
655 655
 			case "bmp" :
656 656
 			case "tiff" :
657
-				return "image/" . strtolower($fileSuffix[1]);
657
+				return "image/".strtolower($fileSuffix[1]);
658 658
 			case "css" :
659 659
 				return "text/css";
660 660
 			case "xml" :
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 			case "swf" :
709 709
 				return "application/x-shockwave-flash";
710 710
 			default :
711
-				if(function_exists("mime_content_type"))
711
+				if (function_exists("mime_content_type"))
712 712
 				{
713 713
 					$fileSuffix = mime_content_type($filename);
714 714
 				}
715
-				return "unknown/" . trim($fileSuffix[0], ".");
715
+				return "unknown/".trim($fileSuffix[0], ".");
716 716
 		}
717 717
 	}
718 718
 
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 4 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
 	/**
114 114
 	 * Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action
115
-	 * @return boolean true: OK, false: redirected
115
+	 * @return string|boolean true: OK, false: redirected
116 116
 	 * */
117 117
 	function init()
118 118
 	{
@@ -1128,6 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 		return $GLOBALS['_loaded_module'][$module][$type][$kind];
1129 1129
 	}
1130 1130
 
1131
+	/**
1132
+	 * @param string $type
1133
+	 * @param string $kind
1134
+	 */
1131 1135
 	function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName)
1132 1136
 	{
1133 1137
 		$classPath = ModuleHandler::getModulePath($module);
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
63
-        {
64
-            $this->entry = Context::convertEncodingStr($entry);
65
-        }
62
+		if($entry = Context::get('entry'))
63
+		{
64
+			$this->entry = Context::convertEncodingStr($entry);
65
+		}
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
Please login to merge, or discard this patch.
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if(file_exists($addon_file)) {
119
+			include($addon_file);
120
+		}
119 121
 	}
120 122
 
121 123
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -257,8 +259,7 @@  discard block
 block discarded – undo
257 259
 			if(!$module_info)
258 260
 			{
259 261
 				unset($this->document_srl);
260
-			}
261
-			else
262
+			} else
262 263
 			{
263 264
 				// If it exists, compare mid based on the module information
264 265
 				// if mids are not matching, set it as the document's mid
@@ -270,8 +271,7 @@  discard block
 block discarded – undo
270 271
 						$this->mid = $module_info->mid;
271 272
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 273
 						return FALSE;
273
-					}
274
-					else
274
+					} else
275 275
 					{
276 276
 						$this->mid = $module_info->mid;
277 277
 						Context::set('mid', $this->mid);
@@ -322,15 +322,13 @@  discard block
 block discarded – undo
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
324 324
 				// If it's called from a virtual site, though it's not a module of the virtual site
325
-			}
326
-			else
325
+			} else
327 326
 			{
328 327
 				$db_info = Context::getDBInfo();
329 328
 				if(!$db_info->default_url)
330 329
 				{
331 330
 					return Context::getLang('msg_default_url_is_not_defined');
332
-				}
333
-				else
331
+				} else
334 332
 				{
335 333
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
336 334
 				}
@@ -355,8 +353,7 @@  discard block
 block discarded – undo
355 353
 			{
356 354
 				$oLayoutAdminModel = getAdminModel('layout');
357 355
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
358
-			}
359
-			else
356
+			} else
360 357
 			{
361 358
 				$layoutSrl = $module_info->{$targetSrl};
362 359
 			}
@@ -483,8 +480,7 @@  discard block
 block discarded – undo
483 480
 			if(!$allowedMethod)
484 481
 			{
485 482
 				$allowedMethodList[0] = 'POST';
486
-			}
487
-			else
483
+			} else
488 484
 			{
489 485
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 486
 			}
@@ -542,8 +538,7 @@  discard block
 block discarded – undo
542 538
 				Mobile::setMobile(FALSE);
543 539
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
544 540
 			}
545
-		}
546
-		else
541
+		} else
547 542
 		{
548 543
 			// create a module instance
549 544
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -596,8 +591,7 @@  discard block
 block discarded – undo
596 591
 					$forward->type = $xml_info->action->{$this->act}->type;
597 592
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
598 593
 					$forward->act = $this->act;
599
-				}
600
-				else
594
+				} else
601 595
 				{
602 596
 					$this->error = 'msg_invalid_request';
603 597
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -633,8 +627,7 @@  discard block
 block discarded – undo
633 627
 					if(!$allowedMethod)
634 628
 					{
635 629
 						$allowedMethodList[0] = 'POST';
636
-					}
637
-					else
630
+					} else
638 631
 					{
639 632
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
640 633
 					}
@@ -662,8 +655,7 @@  discard block
 block discarded – undo
662 655
 						Mobile::setMobile(FALSE);
663 656
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
664 657
 					}
665
-				}
666
-				else
658
+				} else
667 659
 				{
668 660
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
669 661
 				}
@@ -693,8 +685,7 @@  discard block
 block discarded – undo
693 685
 							$oModule->setLayoutPath("./modules/admin/tpl");
694 686
 							$oModule->setLayoutFile("layout.html");
695 687
 						}
696
-					}
697
-					else
688
+					} else
698 689
 					{
699 690
 						$this->_setInputErrorToContext();
700 691
 
@@ -718,8 +709,7 @@  discard block
 block discarded – undo
718 709
 						$oMessageObject->setMessage($this->error);
719 710
 						$oMessageObject->dispMessage();
720 711
 						return $oMessageObject;
721
-					}
722
-					else
712
+					} else
723 713
 					{
724 714
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
725 715
 						{
@@ -733,12 +723,10 @@  discard block
 block discarded – undo
733 723
 						}
734 724
 					}
735 725
 				}
736
-			}
737
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
726
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
738 727
 			{
739 728
 				$this->act = $xml_info->default_index_act;
740
-			}
741
-			else
729
+			} else
742 730
 			{
743 731
 				$this->error = 'msg_invalid_request';
744 732
 				$oModule->setError(-1);
@@ -836,7 +824,9 @@  discard block
 block discarded – undo
836 824
 			$message = $oModule->getMessage();
837 825
 			$messageType = $oModule->getMessageType();
838 826
 			$redirectUrl = $oModule->getRedirectUrl();
839
-			if($messageType == 'error') debugPrint($message, 'ERROR');
827
+			if($messageType == 'error') {
828
+				debugPrint($message, 'ERROR');
829
+			}
840 830
 
841 831
 			if(!$procResult)
842 832
 			{
@@ -846,8 +836,7 @@  discard block
 block discarded – undo
846 836
 					$redirectUrl = Context::get('error_return_url');
847 837
 				}
848 838
 				$this->_setInputValueToSession();
849
-			}
850
-			else
839
+			} else
851 840
 			{
852 841
 
853 842
 			}
@@ -995,8 +984,7 @@  discard block
 block discarded – undo
995 984
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
996 985
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
997 986
 					// Otherwise, set message instance as the target module
998
-				}
999
-				else
987
+				} else
1000 988
 				{
1001 989
 					$oModule = $oMessageObject;
1002 990
 				}
@@ -1008,8 +996,7 @@  discard block
 block discarded – undo
1008 996
 			if(Mobile::isFromMobilePhone())
1009 997
 			{
1010 998
 				$layout_srl = $oModule->module_info->mlayout_srl;
1011
-			}
1012
-			else
999
+			} else
1013 1000
 			{
1014 1001
 				$layout_srl = $oModule->module_info->layout_srl;
1015 1002
 			}
@@ -1068,8 +1055,7 @@  discard block
 block discarded – undo
1068 1055
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1069 1056
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1070 1057
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1071
-								}
1072
-								else
1058
+								} else
1073 1059
 								{
1074 1060
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1075 1061
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1106,8 +1092,7 @@  discard block
 block discarded – undo
1106 1092
 				if($kind == 'admin')
1107 1093
 				{
1108 1094
 					$oModule->setLayoutFile('popup_layout');
1109
-				}
1110
-				else
1095
+				} else
1111 1096
 				{
1112 1097
 					$oModule->setLayoutPath('common/tpl');
1113 1098
 					$oModule->setLayoutFile('default_layout');
@@ -1241,13 +1226,11 @@  discard block
 block discarded – undo
1241 1226
 		{
1242 1227
 			$instanceName = '%s';
1243 1228
 			$classFile = '%s%s.%s.php';
1244
-		}
1245
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1229
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1246 1230
 		{
1247 1231
 			$instanceName = '%sAdmin%s';
1248 1232
 			$classFile = '%s%s.admin.%s.php';
1249
-		}
1250
-		else
1233
+		} else
1251 1234
 		{
1252 1235
 			$instanceName = '%s%s';
1253 1236
 			$classFile = '%s%s.%s.php';
@@ -1310,7 +1293,9 @@  discard block
 block discarded – undo
1310 1293
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1311 1294
 			$slowlog->called = $module . '.' . $called_method;
1312 1295
 			$slowlog->called_extension = $module;
1313
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1296
+			if($trigger_name != 'XE.writeSlowlog') {
1297
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1298
+			}
1314 1299
 
1315 1300
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1316 1301
 			{
Please login to merge, or discard this patch.
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '')
36 36
 	{
37 37
 		// If XE has not installed yet, set module as install
38
-		if(!Context::isInstalled())
38
+		if (!Context::isInstalled())
39 39
 		{
40 40
 			$this->module = 'install';
41 41
 			$this->act = Context::get('act');
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 		}
44 44
 
45 45
 		$oContext = Context::getInstance();
46
-		if($oContext->isSuccessInit == FALSE)
46
+		if ($oContext->isSuccessInit == FALSE)
47 47
 		{
48 48
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// call a trigger before moduleHandler init
104 104
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
105
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
106 106
 		{
107
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110 110
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -115,40 +115,40 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if (file_exists($addon_file)) include($addon_file);
119 119
 	}
120 120
 
121 121
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
122 122
 	{
123
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
123
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
124 124
 		{
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		set_error_handler(function() { }, ~0);
129 129
 
130
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
131
-		if(!file_exists($debug_file))
130
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
131
+		if (!file_exists($debug_file))
132 132
 		{
133 133
 			$print[] = '<?php exit() ?>';
134 134
 		}
135 135
 
136 136
 		$errorname = self::getErrorType($errnumber);
137
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
137
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
138 138
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
139 139
 		$backtrace = debug_backtrace($backtrace_args);
140
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
140
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
141 141
 		{
142 142
 			array_shift($backtrace);
143 143
 		}
144 144
 
145
-		foreach($backtrace as $key => $value)
145
+		foreach ($backtrace as $key => $value)
146 146
 		{
147
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
147
+			$message = '    - '.$value['file'].' : '.$value['line'];
148 148
 			$print[] = $message;
149 149
 		}
150 150
 		$print[] = PHP_EOL;
151
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
151
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
152 152
 		restore_error_handler();
153 153
 
154 154
 		return true;
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 
165 165
 		set_error_handler(function() { }, ~0);
166 166
 
167
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
168
-		if(!file_exists($debug_file))
167
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
168
+		if (!file_exists($debug_file))
169 169
 		{
170 170
 			$print[] = '<?php exit() ?>';
171 171
 		}
172 172
 
173 173
 		$errorname = self::getErrorType($errinfo['type']);
174 174
 		$print[] = '['.date('Y-m-d H:i:s').']';
175
-		$print[] = $errorname . ' : ' . $errinfo['message'];
175
+		$print[] = $errorname.' : '.$errinfo['message'];
176 176
 
177
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
177
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
178 178
 		$print[] = $message;
179 179
 
180 180
 		$print[] = PHP_EOL;
181
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
181
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
182 182
 		set_error_handler(array($this, 'dummyHandler'), ~0);
183 183
 
184 184
 		return true;
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
223 223
 		$defaultHost = $defaultUrlInfo['host'];
224 224
 
225
-		foreach($urls as $url)
225
+		foreach ($urls as $url)
226 226
 		{
227
-			if(empty($url))
227
+			if (empty($url))
228 228
 			{
229 229
 				continue;
230 230
 			}
@@ -232,29 +232,29 @@  discard block
 block discarded – undo
232 232
 			$urlInfo = parse_url($url);
233 233
 			$host = $urlInfo['host'];
234 234
 
235
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
235
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
236 236
 			{
237 237
 				throw new Exception('msg_default_url_is_null');
238 238
 			}
239 239
 		}
240 240
 
241
-		if(!$this->document_srl && $this->mid && $this->entry)
241
+		if (!$this->document_srl && $this->mid && $this->entry)
242 242
 		{
243 243
 			$oDocumentModel = getModel('document');
244 244
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
245
-			if($this->document_srl)
245
+			if ($this->document_srl)
246 246
 			{
247 247
 				Context::set('document_srl', $this->document_srl);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		// Get module's information based on document_srl, if it's specified
252
-		if($this->document_srl)
252
+		if ($this->document_srl)
253 253
 		{
254 254
 
255 255
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
256 256
 			// If the document does not exist, remove document_srl
257
-			if(!$module_info)
257
+			if (!$module_info)
258 258
 			{
259 259
 				unset($this->document_srl);
260 260
 			}
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			{
263 263
 				// If it exists, compare mid based on the module information
264 264
 				// if mids are not matching, set it as the document's mid
265
-				if(!$this->mid || ($this->mid != $module_info->mid))
265
+				if (!$this->mid || ($this->mid != $module_info->mid))
266 266
 				{
267 267
 
268
-					if(Context::getRequestMethod() == 'GET')
268
+					if (Context::getRequestMethod() == 'GET')
269 269
 					{
270 270
 						$this->mid = $module_info->mid;
271
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
271
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 272
 						return FALSE;
273 273
 					}
274 274
 					else
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 				}
281 281
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
282
-				if($this->module && $module_info->module != $this->module)
282
+				if ($this->module && $module_info->module != $this->module)
283 283
 				{
284 284
 					unset($module_info);
285 285
 				}
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
291
-		if(!$module_info && $this->mid)
291
+		if (!$module_info && $this->mid)
292 292
 		{
293 293
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
294 294
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
295 295
 		}
296 296
 
297 297
 		// redirect, if module_site_srl and site_srl are different
298
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
298
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
299 299
 		{
300 300
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
301
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
301
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
302 302
 			return FALSE;
303 303
 		}
304 304
 
305 305
 		// If module_info is not set still, and $module does not exist, find the default module
306
-		if(!$module_info && !$this->module && !$this->mid)
306
+		if (!$module_info && !$this->module && !$this->mid)
307 307
 		{
308 308
 			$module_info = $site_module_info;
309 309
 		}
310 310
 
311
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
311
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316 316
 		// redirect, if site_srl of module_info is different from one of site's module_info
317
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
317
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
318 318
 		{
319 319
 			// If the module is of virtual site
320
-			if($module_info->site_srl)
320
+			if ($module_info->site_srl)
321 321
 			{
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			else
327 327
 			{
328 328
 				$db_info = Context::getDBInfo();
329
-				if(!$db_info->default_url)
329
+				if (!$db_info->default_url)
330 330
 				{
331 331
 					return Context::getLang('msg_default_url_is_not_defined');
332 332
 				}
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 					$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
336 336
 				}
337 337
 			}
338
-			header("location:" . $redirect_url);
338
+			header("location:".$redirect_url);
339 339
 			return FALSE;
340 340
 		}
341 341
 
342 342
 		// If module info was set, retrieve variables from the module information
343
-		if($module_info)
343
+		if ($module_info)
344 344
 		{
345 345
 			$this->module = $module_info->module;
346 346
 			$this->mid = $module_info->mid;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
352 352
 
353 353
 			// use the site default layout.
354
-			if($module_info->{$targetSrl} == -1)
354
+			if ($module_info->{$targetSrl} == -1)
355 355
 			{
356 356
 				$oLayoutAdminModel = getAdminModel('layout');
357 357
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// Set module and mid into module_info
372
-		if(!isset($this->module_info))
372
+		if (!isset($this->module_info))
373 373
 		{
374 374
 			$this->module_info = new stdClass();
375 375
 		}
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		$this->module_info->site_srl = $site_module_info->site_srl;
381 381
 
382 382
 		// Still no module? it's an error
383
-		if(!$this->module)
383
+		if (!$this->module)
384 384
 		{
385 385
 			$this->error = 'msg_module_is_not_exists';
386 386
 			$this->httpStatusCode = '404';
387 387
 		}
388 388
 
389 389
 		// If mid exists, set mid into context
390
-		if($this->mid)
390
+		if ($this->mid)
391 391
 		{
392 392
 			Context::set('mid', $this->mid, TRUE);
393 393
 		}
394 394
 
395 395
 		// Call a trigger after moduleHandler init
396 396
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
397
-		if(!$output->toBool())
397
+		if (!$output->toBool())
398 398
 		{
399 399
 			$this->error = $output->getMessage();
400 400
 			return TRUE;
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
417 417
 
418 418
 		// If error occurred while preparation, return a message instance
419
-		if($this->error)
419
+		if ($this->error)
420 420
 		{
421 421
 			$this->_setInputErrorToContext();
422 422
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
423 423
 			$oMessageObject->setError(-1);
424 424
 			$oMessageObject->setMessage($this->error);
425 425
 			$oMessageObject->dispMessage();
426
-			if($this->httpStatusCode)
426
+			if ($this->httpStatusCode)
427 427
 			{
428 428
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
429 429
 			}
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
435 435
 
436 436
 		// If not installed yet, modify act
437
-		if($this->module == "install")
437
+		if ($this->module == "install")
438 438
 		{
439
-			if(!$this->act || !$xml_info->action->{$this->act})
439
+			if (!$this->act || !$xml_info->action->{$this->act})
440 440
 			{
441 441
 				$this->act = $xml_info->default_index_act;
442 442
 			}
443 443
 		}
444 444
 
445 445
 		// if act exists, find type of the action, if not use default index act
446
-		if(!$this->act)
446
+		if (!$this->act)
447 447
 		{
448 448
 			$this->act = $xml_info->default_index_act;
449 449
 		}
450 450
 
451 451
 		// still no act means error
452
-		if(!$this->act)
452
+		if (!$this->act)
453 453
 		{
454 454
 			$this->error = 'msg_module_is_not_exists';
455 455
 			$this->httpStatusCode = '404';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 		$type = $xml_info->action->{$this->act}->type;
471 471
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
472 472
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
473
-		if(!$kind && $this->module == 'admin')
473
+		if (!$kind && $this->module == 'admin')
474 474
 		{
475 475
 			$kind = 'admin';
476 476
 		}
477 477
 
478 478
 		// check REQUEST_METHOD in controller
479
-		if($type == 'controller')
479
+		if ($type == 'controller')
480 480
 		{
481 481
 			$allowedMethod = $xml_info->action->{$this->act}->method;
482 482
 
483
-			if(!$allowedMethod)
483
+			if (!$allowedMethod)
484 484
 			{
485 485
 				$allowedMethodList[0] = 'POST';
486 486
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 490
 			}
491 491
 
492
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
492
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
493 493
 			{
494 494
 				$this->error = "msg_invalid_request";
495 495
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if($this->module_info->use_mobile != "Y")
503
+		if ($this->module_info->use_mobile != "Y")
504 504
 		{
505 505
 			Mobile::setMobile(FALSE);
506 506
 		}
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 
510 510
 		// check CSRF for non-GET actions
511 511
 		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
512
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
512
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
513 513
 		{
514 514
 			$this->error = 'msg_invalid_request';
515 515
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		}
521 521
 
522 522
 		// Admin ip
523
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
523
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
524 524
 		{
525 525
 			$this->_setInputErrorToContext();
526 526
 			$this->error = "msg_not_permitted_act";
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
 		}
533 533
 
534 534
 		// if(type == view, and case for using mobilephone)
535
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
535
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
536 536
 		{
537 537
 			$orig_type = "view";
538 538
 			$type = "mobile";
539 539
 			// create a module instance
540 540
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
541
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
541
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
542 542
 			{
543 543
 				$type = $orig_type;
544 544
 				Mobile::setMobile(FALSE);
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
552 552
 		}
553 553
 
554
-		if(!is_object($oModule))
554
+		if (!is_object($oModule))
555 555
 		{
556 556
 			$this->_setInputErrorToContext();
557 557
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
558 558
 			$oMessageObject->setError(-1);
559 559
 			$oMessageObject->setMessage($this->error);
560 560
 			$oMessageObject->dispMessage();
561
-			if($this->httpStatusCode)
561
+			if ($this->httpStatusCode)
562 562
 			{
563 563
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
564 564
 			}
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 		// If there is no such action in the module object
569
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
569
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
570 570
 		{
571 571
 
572
-			if(!Context::isInstalled())
572
+			if (!Context::isInstalled())
573 573
 			{
574 574
 				$this->_setInputErrorToContext();
575 575
 				$this->error = 'msg_invalid_request';
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 				$oMessageObject->setError(-1);
578 578
 				$oMessageObject->setMessage($this->error);
579 579
 				$oMessageObject->dispMessage();
580
-				if($this->httpStatusCode)
580
+				if ($this->httpStatusCode)
581 581
 				{
582 582
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
583 583
 				}
@@ -586,12 +586,12 @@  discard block
 block discarded – undo
586 586
 
587 587
 			$forward = NULL;
588 588
 			// 1. Look for the module with action name
589
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
589
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
590 590
 			{
591
-				$module = strtolower($matches[2] . $matches[3]);
591
+				$module = strtolower($matches[2].$matches[3]);
592 592
 				$xml_info = $oModuleModel->getModuleActionXml($module);
593 593
 
594
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
594
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
595 595
 				{
596 596
 					$forward = new stdClass();
597 597
 					$forward->module = $module;
@@ -611,12 +611,12 @@  discard block
 block discarded – undo
611 611
 				}
612 612
 			}
613 613
 
614
-			if(!$forward)
614
+			if (!$forward)
615 615
 			{
616 616
 				$forward = $oModuleModel->getActionForward($this->act);
617 617
 			}
618 618
 
619
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
619
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
620 620
 			{
621 621
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
622 622
 				$type = $forward->type;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
 				// check CSRF for non-GET actions
630 630
 				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
631
-				if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
631
+				if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
632 632
 				{
633 633
 					$this->error = 'msg_invalid_request';
634 634
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -640,11 +640,11 @@  discard block
 block discarded – undo
640 640
 
641 641
 				// SECISSUE also check foward act method
642 642
 				// check REQUEST_METHOD in controller
643
-				if($type == 'controller')
643
+				if ($type == 'controller')
644 644
 				{
645 645
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
646 646
 
647
-					if(!$allowedMethod)
647
+					if (!$allowedMethod)
648 648
 					{
649 649
 						$allowedMethodList[0] = 'POST';
650 650
 					}
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
654 654
 					}
655 655
 
656
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
656
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
657 657
 					{
658 658
 						$this->error = "msg_invalid_request";
659 659
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -664,13 +664,13 @@  discard block
 block discarded – undo
664 664
 					}
665 665
 				}
666 666
 
667
-				if($type == "view" && Mobile::isFromMobilePhone())
667
+				if ($type == "view" && Mobile::isFromMobilePhone())
668 668
 				{
669 669
 					$orig_type = "view";
670 670
 					$type = "mobile";
671 671
 					// create a module instance
672 672
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
673
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
673
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
674 674
 					{
675 675
 						$type = $orig_type;
676 676
 						Mobile::setMobile(FALSE);
@@ -682,25 +682,25 @@  discard block
 block discarded – undo
682 682
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
683 683
 				}
684 684
 
685
-				if(!is_object($oModule))
685
+				if (!is_object($oModule))
686 686
 				{
687 687
 					$this->_setInputErrorToContext();
688 688
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
689 689
 					$oMessageObject->setError(-1);
690 690
 					$oMessageObject->setMessage('msg_module_is_not_exists');
691 691
 					$oMessageObject->dispMessage();
692
-					if($this->httpStatusCode)
692
+					if ($this->httpStatusCode)
693 693
 					{
694 694
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
695 695
 					}
696 696
 					return $oMessageObject;
697 697
 				}
698 698
 
699
-				if($this->module == "admin" && $type == "view")
699
+				if ($this->module == "admin" && $type == "view")
700 700
 				{
701
-					if($logged_info->is_admin == 'Y')
701
+					if ($logged_info->is_admin == 'Y')
702 702
 					{
703
-						if($this->act != 'dispLayoutAdminLayoutModify')
703
+						if ($this->act != 'dispLayoutAdminLayoutModify')
704 704
 						{
705 705
 							$oAdminView = getAdminView('admin');
706 706
 							$oAdminView->makeGnbUrl($forward->module);
@@ -720,10 +720,10 @@  discard block
 block discarded – undo
720 720
 						return $oMessageObject;
721 721
 					}
722 722
 				}
723
-				if($kind == 'admin')
723
+				if ($kind == 'admin')
724 724
 				{
725 725
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
726
-					if(!$grant->manager)
726
+					if (!$grant->manager)
727 727
 					{
728 728
 						$this->_setInputErrorToContext();
729 729
 						$this->error = 'msg_is_not_manager';
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 					}
736 736
 					else
737 737
 					{
738
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
738
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
739 739
 						{
740 740
 							$this->_setInputErrorToContext();
741 741
 							$this->error = 'msg_is_not_administrator';
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 					}
749 749
 				}
750 750
 			}
751
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
751
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
752 752
 			{
753 753
 				$this->act = $xml_info->default_index_act;
754 754
 			}
@@ -762,16 +762,16 @@  discard block
 block discarded – undo
762 762
 		}
763 763
 
764 764
 		// ruleset check...
765
-		if(!empty($ruleset))
765
+		if (!empty($ruleset))
766 766
 		{
767 767
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
768 768
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
769
-			if(!empty($rulesetFile))
769
+			if (!empty($rulesetFile))
770 770
 			{
771
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
771
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
772 772
 				{
773 773
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
774
-					foreach($errorLang as $key => $val)
774
+					foreach ($errorLang as $key => $val)
775 775
 					{
776 776
 						Context::setLang($key, $val);
777 777
 					}
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
 				$Validator = new Validator($rulesetFile);
782 782
 				$result = $Validator->validate();
783
-				if(!$result)
783
+				if (!$result)
784 784
 				{
785 785
 					$lastError = $Validator->getLastError();
786 786
 					$returnUrl = Context::get('error_return_url');
@@ -812,26 +812,26 @@  discard block
 block discarded – undo
812 812
 				'dispLayoutPreviewWithModule' => 1
813 813
 		);
814 814
 		$db_use_mobile = Mobile::isMobileEnabled();
815
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
815
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
816 816
 		{
817 817
 			global $lang;
818 818
 			$header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>';
819
-			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>';
819
+			$footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>';
820 820
 			Context::addHtmlHeader($header);
821 821
 			Context::addHtmlFooter($footer);
822 822
 		}
823 823
 
824
-		if($type == "view" && $kind != 'admin')
824
+		if ($type == "view" && $kind != 'admin')
825 825
 		{
826 826
 			$module_config = $oModuleModel->getModuleConfig('module');
827
-			if($module_config->htmlFooter)
827
+			if ($module_config->htmlFooter)
828 828
 			{
829 829
 				Context::addHtmlFooter($module_config->htmlFooter);
830 830
 			}
831
-			if($module_config->siteTitle)
831
+			if ($module_config->siteTitle)
832 832
 			{
833 833
 				$siteTitle = Context::getBrowserTitle();
834
-				if(!$siteTitle)
834
+				if (!$siteTitle)
835 835
 				{
836 836
 					Context::setBrowserTitle($module_config->siteTitle);
837 837
 				}
@@ -844,18 +844,18 @@  discard block
 block discarded – undo
844 844
 		$procResult = $oModule->proc();
845 845
 
846 846
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
847
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
847
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
848 848
 		{
849 849
 			$error = $oModule->getError();
850 850
 			$message = $oModule->getMessage();
851 851
 			$messageType = $oModule->getMessageType();
852 852
 			$redirectUrl = $oModule->getRedirectUrl();
853
-			if($messageType == 'error') debugPrint($message, 'ERROR');
853
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
854 854
 
855
-			if(!$procResult)
855
+			if (!$procResult)
856 856
 			{
857 857
 				$this->error = $message;
858
-				if(!$redirectUrl && Context::get('error_return_url'))
858
+				if (!$redirectUrl && Context::get('error_return_url'))
859 859
 				{
860 860
 					$redirectUrl = Context::get('error_return_url');
861 861
 				}
@@ -868,13 +868,13 @@  discard block
 block discarded – undo
868 868
 
869 869
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
870 870
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
871
-			if($message != 'success')
871
+			if ($message != 'success')
872 872
 			{
873 873
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
874 874
 			}
875 875
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
876 876
 
877
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
877
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
878 878
 			{
879 879
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
880 880
 			}
@@ -890,27 +890,27 @@  discard block
 block discarded – undo
890 890
 	 * */
891 891
 	function _setInputErrorToContext()
892 892
 	{
893
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
893
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
894 894
 		{
895 895
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
896 896
 		}
897
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
897
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
898 898
 		{
899 899
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
900 900
 		}
901
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
901
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
902 902
 		{
903 903
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
904 904
 		}
905
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
905
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
906 906
 		{
907 907
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
908 908
 		}
909
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
909
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
910 910
 		{
911 911
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
912 912
 		}
913
-		if(count($_SESSION['INPUT_ERROR']))
913
+		if (count($_SESSION['INPUT_ERROR']))
914 914
 		{
915 915
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
916 916
 		}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	{
941 941
 		$requestVars = Context::getRequestVars();
942 942
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
943
-		foreach($requestVars AS $key => $value)
943
+		foreach ($requestVars AS $key => $value)
944 944
 		{
945 945
 			$_SESSION['INPUT_ERROR'][$key] = $value;
946 946
 		}
@@ -954,41 +954,41 @@  discard block
 block discarded – undo
954 954
 	function displayContent($oModule = NULL)
955 955
 	{
956 956
 		// If the module is not set or not an object, set error
957
-		if(!$oModule || !is_object($oModule))
957
+		if (!$oModule || !is_object($oModule))
958 958
 		{
959 959
 			$this->error = 'msg_module_is_not_exists';
960 960
 			$this->httpStatusCode = '404';
961 961
 		}
962 962
 
963 963
 		// If connection to DB has a problem even though it's not install module, set error
964
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
964
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
965 965
 		{
966 966
 			$this->error = 'msg_dbconnect_failed';
967 967
 		}
968 968
 
969 969
 		// Call trigger after moduleHandler proc
970 970
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
971
-		if(!$output->toBool())
971
+		if (!$output->toBool())
972 972
 		{
973 973
 			$this->error = $output->getMessage();
974 974
 		}
975 975
 
976 976
 		// Use message view object, if HTML call
977 977
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
978
-		if(!isset($methodList[Context::getRequestMethod()]))
978
+		if (!isset($methodList[Context::getRequestMethod()]))
979 979
 		{
980 980
 
981
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
981
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
982 982
 			{
983 983
 				$display_handler = new DisplayHandler();
984 984
 				$display_handler->_debugOutput();
985 985
 
986
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
986
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
987 987
 				return;
988 988
 			}
989 989
 
990 990
 			// If error occurred, handle it
991
-			if($this->error)
991
+			if ($this->error)
992 992
 			{
993 993
 				// display content with message module instance
994 994
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -997,14 +997,14 @@  discard block
 block discarded – undo
997 997
 				$oMessageObject->setMessage($this->error);
998 998
 				$oMessageObject->dispMessage();
999 999
 
1000
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1000
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1001 1001
 				{
1002 1002
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1003 1003
 					$oMessageObject->setTemplateFile('http_status_code');
1004 1004
 				}
1005 1005
 
1006 1006
 				// If module was called normally, change the templates of the module into ones of the message view module
1007
-				if($oModule)
1007
+				if ($oModule)
1008 1008
 				{
1009 1009
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1010 1010
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
 			}
1020 1020
 
1021 1021
 			// Check if layout_srl exists for the module
1022
-			if(Mobile::isFromMobilePhone())
1022
+			if (Mobile::isFromMobilePhone())
1023 1023
 			{
1024 1024
 				$layout_srl = $oModule->module_info->mlayout_srl;
1025 1025
 			}
@@ -1029,58 +1029,58 @@  discard block
 block discarded – undo
1029 1029
 			}
1030 1030
 
1031 1031
 			// if layout_srl is rollback by module, set default layout
1032
-			if($layout_srl == -1)
1032
+			if ($layout_srl == -1)
1033 1033
 			{
1034 1034
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1035 1035
 				$oLayoutAdminModel = getAdminModel('layout');
1036 1036
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1037 1037
 			}
1038 1038
 
1039
-			if($layout_srl && !$oModule->getLayoutFile())
1039
+			if ($layout_srl && !$oModule->getLayoutFile())
1040 1040
 			{
1041 1041
 
1042 1042
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1043 1043
 				$oLayoutModel = getModel('layout');
1044 1044
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1045
-				if($layout_info)
1045
+				if ($layout_info)
1046 1046
 				{
1047 1047
 
1048 1048
 					// Input extra_vars into $layout_info
1049
-					if($layout_info->extra_var_count)
1049
+					if ($layout_info->extra_var_count)
1050 1050
 					{
1051 1051
 
1052
-						foreach($layout_info->extra_var as $var_id => $val)
1052
+						foreach ($layout_info->extra_var as $var_id => $val)
1053 1053
 						{
1054
-							if($val->type == 'image')
1054
+							if ($val->type == 'image')
1055 1055
 							{
1056
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1056
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1057 1057
 								{
1058
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1058
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1059 1059
 								}
1060 1060
 							}
1061 1061
 							$layout_info->{$var_id} = $val->value;
1062 1062
 						}
1063 1063
 					}
1064 1064
 					// Set menus into context
1065
-					if($layout_info->menu_count)
1065
+					if ($layout_info->menu_count)
1066 1066
 					{
1067
-						foreach($layout_info->menu as $menu_id => $menu)
1067
+						foreach ($layout_info->menu as $menu_id => $menu)
1068 1068
 						{
1069 1069
 							// set default menu set(included home menu)
1070
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1070
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1071 1071
 							{
1072 1072
 								$oMenuAdminController = getAdminController('menu');
1073 1073
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1074 1074
 
1075
-								if(FileHandler::exists($homeMenuCacheFile))
1075
+								if (FileHandler::exists($homeMenuCacheFile))
1076 1076
 								{
1077 1077
 									include($homeMenuCacheFile);
1078 1078
 								}
1079 1079
 
1080
-								if(!$menu->menu_srl)
1080
+								if (!$menu->menu_srl)
1081 1081
 								{
1082
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1083
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1082
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1083
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1084 1084
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1085 1085
 								}
1086 1086
 								else
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 							}
1092 1092
 
1093 1093
 							$php_file = FileHandler::exists($menu->php_file);
1094
-							if($php_file)
1094
+							if ($php_file)
1095 1095
 							{
1096 1096
 								include($php_file);
1097 1097
 							}
@@ -1107,17 +1107,17 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 					// If layout was modified, use the modified version
1109 1109
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1110
-					if(file_exists($edited_layout))
1110
+					if (file_exists($edited_layout))
1111 1111
 					{
1112 1112
 						$oModule->setEditedLayoutFile($edited_layout);
1113 1113
 					}
1114 1114
 				}
1115 1115
 			}
1116 1116
 			$isLayoutDrop = Context::get('isLayoutDrop');
1117
-			if($isLayoutDrop)
1117
+			if ($isLayoutDrop)
1118 1118
 			{
1119 1119
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1120
-				if($kind == 'admin')
1120
+				if ($kind == 'admin')
1121 1121
 				{
1122 1122
 					$oModule->setLayoutFile('popup_layout');
1123 1123
 				}
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1156 1156
 	{
1157 1157
 
1158
-		if(__DEBUG__ == 3)
1158
+		if (__DEBUG__ == 3)
1159 1159
 		{
1160 1160
 			$start_time = getMicroTime();
1161 1161
 		}
@@ -1165,51 +1165,51 @@  discard block
 block discarded – undo
1165 1165
 		$type = strtolower($type);
1166 1166
 
1167 1167
 		$kinds = array('svc' => 1, 'admin' => 1);
1168
-		if(!isset($kinds[$kind]))
1168
+		if (!isset($kinds[$kind]))
1169 1169
 		{
1170 1170
 			$kind = 'svc';
1171 1171
 		}
1172 1172
 
1173
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1173
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1174 1174
 
1175
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1175
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1176 1176
 		{
1177 1177
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1178 1178
 		}
1179 1179
 
1180 1180
 		// if there is no instance of the module in global variable, create a new one
1181
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1181
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1182 1182
 		{
1183 1183
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1184 1184
 
1185
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1185
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1186 1186
 			{
1187 1187
 				$module = $parent_module;
1188 1188
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1189 1189
 			}
1190 1190
 
1191 1191
 			// Check if the base class and instance class exist
1192
-			if(!class_exists($module, true))
1192
+			if (!class_exists($module, true))
1193 1193
 			{
1194 1194
 				return NULL;
1195 1195
 			}
1196
-			if(!class_exists($instance_name, true))
1196
+			if (!class_exists($instance_name, true))
1197 1197
 			{
1198 1198
 				return NULL;
1199 1199
 			}
1200 1200
 
1201 1201
 			// Create an instance
1202 1202
 			$oModule = new $instance_name();
1203
-			if(!is_object($oModule))
1203
+			if (!is_object($oModule))
1204 1204
 			{
1205 1205
 				return NULL;
1206 1206
 			}
1207 1207
 
1208 1208
 			// Load language files for the class
1209
-			Context::loadLang($class_path . 'lang');
1210
-			if($extend_module)
1209
+			Context::loadLang($class_path.'lang');
1210
+			if ($extend_module)
1211 1211
 			{
1212
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1212
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1213 1213
 			}
1214 1214
 
1215 1215
 			// Set variables to the instance
@@ -1217,10 +1217,10 @@  discard block
 block discarded – undo
1217 1217
 			$oModule->setModulePath($class_path);
1218 1218
 
1219 1219
 			// If the module has a constructor, run it.
1220
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1220
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1221 1221
 			{
1222 1222
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1223
-				if(@method_exists($oModule, $instance_name))
1223
+				if (@method_exists($oModule, $instance_name))
1224 1224
 				{
1225 1225
 					$oModule->{$instance_name}();
1226 1226
 				}
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1231 1231
 		}
1232 1232
 
1233
-		if(__DEBUG__ == 3)
1233
+		if (__DEBUG__ == 3)
1234 1234
 		{
1235 1235
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1236 1236
 		}
@@ -1246,17 +1246,17 @@  discard block
 block discarded – undo
1246 1246
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1247 1247
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1248 1248
 
1249
-		$types = array('view','controller','model','api','wap','mobile','class');
1250
-		if(!in_array($type, $types))
1249
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1250
+		if (!in_array($type, $types))
1251 1251
 		{
1252 1252
 			$type = $types[0];
1253 1253
 		}
1254
-		if($type == 'class')
1254
+		if ($type == 'class')
1255 1255
 		{
1256 1256
 			$instanceName = '%s';
1257 1257
 			$classFile = '%s%s.%s.php';
1258 1258
 		}
1259
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1259
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1260 1260
 		{
1261 1261
 			$instanceName = '%sAdmin%s';
1262 1262
 			$classFile = '%s%s.admin.%s.php';
@@ -1281,26 +1281,26 @@  discard block
 block discarded – undo
1281 1281
 	function triggerCall($trigger_name, $called_position, &$obj)
1282 1282
 	{
1283 1283
 		// skip if not installed
1284
-		if(!Context::isInstalled())
1284
+		if (!Context::isInstalled())
1285 1285
 		{
1286 1286
 			return new Object();
1287 1287
 		}
1288 1288
 
1289 1289
 		$oModuleModel = getModel('module');
1290 1290
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1291
-		if(!$triggers || count($triggers) < 1)
1291
+		if (!$triggers || count($triggers) < 1)
1292 1292
 		{
1293 1293
 			return new Object();
1294 1294
 		}
1295 1295
 
1296 1296
 		//store before trigger call time
1297 1297
 		$before_trigger_time = NULL;
1298
-		if(__LOG_SLOW_TRIGGER__> 0)
1298
+		if (__LOG_SLOW_TRIGGER__ > 0)
1299 1299
 		{
1300 1300
 			$before_trigger_time = microtime(true);
1301 1301
 		}
1302 1302
 
1303
-		foreach($triggers as $item)
1303
+		foreach ($triggers as $item)
1304 1304
 		{
1305 1305
 			$module = $item->module;
1306 1306
 			$type = $item->type;
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
 			// todo why don't we call a normal class object ?
1310 1310
 			$oModule = getModule($module, $type);
1311
-			if(!$oModule || !method_exists($oModule, $called_method))
1311
+			if (!$oModule || !method_exists($oModule, $called_method))
1312 1312
 			{
1313 1313
 				continue;
1314 1314
 			}
@@ -1321,12 +1321,12 @@  discard block
 block discarded – undo
1321 1321
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1322 1322
 
1323 1323
 			$slowlog = new stdClass;
1324
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1325
-			$slowlog->called = $module . '.' . $called_method;
1324
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1325
+			$slowlog->called = $module.'.'.$called_method;
1326 1326
 			$slowlog->called_extension = $module;
1327
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1327
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1328 1328
 
1329
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1329
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1330 1330
 			{
1331 1331
 				return $output;
1332 1332
 			}
@@ -1411,9 +1411,9 @@  discard block
 block discarded – undo
1411 1411
 			'511' => 'Network Authentication Required',
1412 1412
 		);
1413 1413
 		$statusMessage = $statusMessageList[$code];
1414
-		if(!$statusMessage)
1414
+		if (!$statusMessage)
1415 1415
 		{
1416
-			$statusMessage = 'HTTP ' . $code;
1416
+			$statusMessage = 'HTTP '.$code;
1417 1417
 		}
1418 1418
 
1419 1419
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.