Completed
Push — 1.10.x ( 986d2b...f19030 )
by Angel Fernando Quiroz
69:29 queued 19:50
created
main/inc/lib/kses-0.2.2/oop/test.oop.kses.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,12 +8,10 @@  discard block
 block discarded – undo
8 8
 	if(substr(phpversion(), 0, 1) < 4)
9 9
 	{
10 10
 		define('KSESTEST_VER', 0);
11
-	}
12
-	elseif(substr(phpversion(), 0, 1) >= 5)
11
+	} elseif(substr(phpversion(), 0, 1) >= 5)
13 12
 	{
14 13
 		define('KSESTEST_VER', 5);
15
-	}
16
-	else
14
+	} else
17 15
 	{
18 16
 		define('KSESTEST_VER', 4);
19 17
 	}
@@ -22,8 +20,7 @@  discard block
 block discarded – undo
22 20
 	if($_SERVER["DOCUMENT_ROOT"] == "")
23 21
 	{
24 22
 		define('KSESTEST_ENV', 'CLI');
25
-	}
26
-	else
23
+	} else
27 24
 	{
28 25
 		define('KSESTEST_ENV', 'WEB');
29 26
 	}
@@ -48,8 +45,7 @@  discard block
 block discarded – undo
48 45
 	if(file_exists($include_file) && is_readable($include_file))
49 46
 	{
50 47
 		include_once($include_file);
51
-	}
52
-	else
48
+	} else
53 49
 	{
54 50
 		$message = array(
55 51
 			"Error:  Unable to find '" . $include_file . "'.",
@@ -126,8 +122,7 @@  discard block
 block discarded – undo
126 122
 		if(KSESTEST_ENV == 'CLI')
127 123
 		{
128 124
 			return $text;
129
-		}
130
-		else
125
+		} else
131 126
 		{
132 127
 			return "<code>\n$text<code>\n";
133 128
 		}
@@ -138,8 +133,7 @@  discard block
 block discarded – undo
138 133
 		if(KSESTEST_ENV == 'CLI')
139 134
 		{
140 135
 			return $text;
141
-		}
142
-		else
136
+		} else
143 137
 		{
144 138
 			return htmlentities($text);
145 139
 		}
@@ -150,14 +144,12 @@  discard block
 block discarded – undo
150 144
 		if(KSESTEST_ENV == 'CLI')
151 145
 		{
152 146
 			return '[' . $text . ']';
153
-		}
154
-		else
147
+		} else
155 148
 		{
156 149
 			if($pass == true)
157 150
 			{
158 151
 				return '<span style="color: green;">[' . $text . ']</span>';
159
-			}
160
-			else
152
+			} else
161 153
 			{
162 154
 				return '<span style="color: red;">[' . $text . ']</span>';
163 155
 			}
@@ -169,8 +161,7 @@  discard block
 block discarded – undo
169 161
 		if(KSESTEST_ENV == 'WEB')
170 162
 		{
171 163
 			$out = "&nbsp;&nbsp;&nbsp;";
172
-		}
173
-		else
164
+		} else
174 165
 		{
175 166
 			$out = "   ";
176 167
 		}
@@ -183,8 +174,7 @@  discard block
 block discarded – undo
183 174
 		if(KSESTEST_ENV == 'WEB')
184 175
 		{
185 176
 			$out = "<br />\n";
186
-		}
187
-		else
177
+		} else
188 178
 		{
189 179
 			$out = "\n";
190 180
 		}
@@ -207,8 +197,7 @@  discard block
 block discarded – undo
207 197
 				$out .= "\t\t<p>\n";
208 198
 				$out .= "\t\t\t$text\n";
209 199
 				$out .= "\t\t</p>\n";
210
-			}
211
-			else
200
+			} else
212 201
 			{
213 202
 				$header = "$title\n" . str_repeat('-', 60) . "\n\n";
214 203
 				$out .= "\t$text\n\n";
@@ -226,8 +215,7 @@  discard block
 block discarded – undo
226 215
 			echo $out;
227 216
 			echo "\t</body>\n";
228 217
 			echo "</html>\n";
229
-		}
230
-		else
218
+		} else
231 219
 		{
232 220
 			echo $header;
233 221
 			echo $out;
@@ -239,8 +227,7 @@  discard block
 block discarded – undo
239 227
 		if(KSESTEST_ENV == 'WEB')
240 228
 		{
241 229
 			return "\t\t\t<hr />\n";
242
-		}
243
-		else
230
+		} else
244 231
 		{
245 232
 			return str_repeat(60, '-') . "\n";
246 233
 		}
@@ -262,8 +249,7 @@  discard block
 block discarded – undo
262 249
 				$text .= "\t\t\t\t<li>$li</li>\n";
263 250
 			}
264 251
 			$text .= "\t\t\t</ul>\n";
265
-		}
266
-		else
252
+		} else
267 253
 		{
268 254
 			foreach($data as $li)
269 255
 			{
Please login to merge, or discard this patch.
main/inc/lib/kses-0.2.2/oop/php4.class.kses.php 1 patch
Braces   +26 added lines, -22 removed lines patch added patch discarded remove patch
@@ -165,13 +165,11 @@  discard block
 block discarded – undo
165 165
 						$this->AddProtocol($protocol);
166 166
 					}
167 167
 					return true;
168
-				}
169
-				elseif(is_string($protocol_data))
168
+				} elseif(is_string($protocol_data))
170 169
 				{
171 170
 					$this->AddProtocol($protocol_data);
172 171
 					return true;
173
-				}
174
-				else
172
+				} else
175 173
 				{
176 174
 					trigger_error("kses4::AddProtocols() did not receive a string or an array.", E_USER_WARNING);
177 175
 					return false;
@@ -273,14 +271,12 @@  discard block
 block discarded – undo
273 271
 						$this->AddProtocol($protocol);
274 272
 					}
275 273
 					return true;
276
-				}
277
-				elseif(is_string($protocol_data))
274
+				} elseif(is_string($protocol_data))
278 275
 				{
279 276
 					$this->allowed_protocols = array();
280 277
 					$this->AddProtocol($protocol_data);
281 278
 					return true;
282
-				}
283
-				else
279
+				} else
284 280
 				{
285 281
 					trigger_error("kses4::SetProtocols() did not receive a string or an array.", E_USER_WARNING);
286 282
 					return false;
@@ -451,13 +447,11 @@  discard block
 block discarded – undo
451 447
 					{
452 448
 						$this->RemoveProtocol($protocol);
453 449
 					}
454
-				}
455
-				elseif(is_string($protocol_data))
450
+				} elseif(is_string($protocol_data))
456 451
 				{
457 452
 					$this->RemoveProtocol($protocol_data);
458 453
 					return true;
459
-				}
460
-				else
454
+				} else
461 455
 				{
462 456
 					trigger_error("kses4::RemoveProtocols() did not receive a string or an array.", E_USER_WARNING);
463 457
 					return false;
@@ -740,8 +734,7 @@  discard block
 block discarded – undo
740 734
 						{
741 735
 							# there are no checks
742 736
 							$attr2 .= ' '.$arreach['whole'];
743
-						}
744
-						else
737
+						} else
745 738
 						{
746 739
 							# there are some checks
747 740
 							$ok = true;
@@ -810,16 +803,20 @@  discard block
 block discarded – undo
810 803
 							}
811 804
 							break;
812 805
 						case 1:	# equals sign or valueless ("selected")
813
-							if (preg_match('/^\s*=\s*/', $attr)) # equals sign
806
+							if (preg_match('/^\s*=\s*/', $attr)) {
807
+							    # equals sign
814 808
 							{
815 809
 								$working = 1;
810
+							}
816 811
 								$mode    = 2;
817 812
 								$attr    = preg_replace('/^\s*=\s*/', '', $attr);
818 813
 								break;
819 814
 							}
820
-							if (preg_match('/^\s+/', $attr)) # valueless
815
+							if (preg_match('/^\s+/', $attr)) {
816
+							    # valueless
821 817
 							{
822 818
 								$working   = 1;
819
+							}
823 820
 								$mode      = 0;
824 821
 								$attrarr[] = array(
825 822
 									'name'  => $attrname,
@@ -831,9 +828,11 @@  discard block
 block discarded – undo
831 828
 							}
832 829
 							break;
833 830
 						case 2: # attribute value, a URL after href= for instance
834
-							if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) # "value"
831
+							if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match)) {
832
+							    # "value"
835 833
 							{
836 834
 								$thisval   = $this->_bad_protocol($match[1]);
835
+							}
837 836
 								$attrarr[] = array(
838 837
 									'name'  => $attrname,
839 838
 									'value' => $thisval,
@@ -845,9 +844,11 @@  discard block
 block discarded – undo
845 844
 								$attr      = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
846 845
 								break;
847 846
 							}
848
-							if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) # 'value'
847
+							if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match)) {
848
+							    # 'value'
849 849
 							{
850 850
 								$thisval   = $this->_bad_protocol($match[1]);
851
+							}
851 852
 								$attrarr[] = array(
852 853
 									'name'  => $attrname,
853 854
 									'value' => $thisval,
@@ -859,9 +860,11 @@  discard block
 block discarded – undo
859 860
 								$attr      = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
860 861
 								break;
861 862
 							}
862
-							if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) # value
863
+							if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match)) {
864
+							    # value
863 865
 							{
864 866
 								$thisval   = $this->_bad_protocol($match[1]);
867
+							}
865 868
 								$attrarr[] = array(
866 869
 									'name'  => $attrname,
867 870
 									'value' => $thisval,
@@ -876,9 +879,11 @@  discard block
 block discarded – undo
876 879
 							break;
877 880
 					}
878 881
 
879
-					if ($working == 0) # not well formed, remove and try again
882
+					if ($working == 0) {
883
+					    # not well formed, remove and try again
880 884
 					{
881 885
 						$attr = $this->_html_error($attr);
886
+					}
882 887
 						$mode = 0;
883 888
 					}
884 889
 				}
@@ -985,8 +990,7 @@  discard block
 block discarded – undo
985 990
 				if ($allowed)
986 991
 				{
987 992
 					return "$string:";
988
-				}
989
-				else
993
+				} else
990 994
 				{
991 995
 					return '';
992 996
 				}
Please login to merge, or discard this patch.
main/inc/lib/fileDisplay.lib.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -213,16 +213,19 @@
 block discarded – undo
213 213
     if (is_dir($dir)) {
214 214
         while(($entry = $dir->read()) !== false)
215 215
         {
216
-            if ($entry != '.' && $entry != '..')
217
-                continue;
216
+            if ($entry != '.' && $entry != '..') {
217
+                            continue;
218
+            }
218 219
 
219
-            if (!is_dir($dir_name.'/'.$entry))
220
-                $current_modified = filemtime($dir_name.'/'.$entry);
221
-            elseif ($do_recursive)
222
-                $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true);
220
+            if (!is_dir($dir_name.'/'.$entry)) {
221
+                            $current_modified = filemtime($dir_name.'/'.$entry);
222
+            } elseif ($do_recursive) {
223
+                            $current_modified = recent_modified_file_time($dir_name.'/'.$entry, true);
224
+            }
223 225
 
224
-            if ($current_modified > $last_modified)
225
-                $last_modified = $current_modified;
226
+            if ($current_modified > $last_modified) {
227
+                            $last_modified = $current_modified;
228
+            }
226 229
         }
227 230
 
228 231
         $dir->close();
Please login to merge, or discard this patch.
main/inc/lib/fileUpload.lib.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -993,7 +993,9 @@
 block discarded – undo
993 993
                     if ($file != '.' && $file != '..') {
994 994
 
995 995
                         $filetype = 'file';
996
-                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
996
+                        if (is_dir($base_work_dir.$upload_path.'/'.$file)) {
997
+                            $filetype = 'folder';
998
+                        }
997 999
 
998 1000
                         $safe_file = api_replace_dangerous_char($file, 'strict');
999 1001
                         @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
Please login to merge, or discard this patch.
main/inc/lib/usergroup.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1906,8 +1906,9 @@
 block discarded – undo
1906 1906
                 $new_relation_type[] ="'$rel'";
1907 1907
             }
1908 1908
             $relation_type = implode(',', $new_relation_type);
1909
-            if (!empty($relation_type))
1910
-                $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1909
+            if (!empty($relation_type)) {
1910
+                            $where_relation_condition = "AND gu.relation_type IN ($relation_type) ";
1911
+            }
1911 1912
         }
1912 1913
 
1913 1914
         $sql = "SELECT picture_uri as image, u.id, u.firstname, u.lastname, relation_type
Please login to merge, or discard this patch.
main/inc/lib/agenda.lib.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3122,8 +3122,9 @@
 block discarded – undo
3122 3122
         global $DaysShort, $course_path;
3123 3123
         //Handle leap year
3124 3124
         $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
3125
-        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
3126
-            $numberofdays[2] = 29;
3125
+        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
3126
+                    $numberofdays[2] = 29;
3127
+        }
3127 3128
         //Get the first day of the month
3128 3129
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
3129 3130
         //Start the week on monday
Please login to merge, or discard this patch.
main/inc/lib/xajax/xajax.inc.php 1 patch
Braces   +84 added lines, -86 removed lines patch added patch discarded remove patch
@@ -173,8 +173,9 @@  discard block
 block discarded – undo
173 173
 		$this->aObjects = array();
174 174
 		$this->aFunctionIncludeFiles = array();
175 175
 		$this->sRequestURI = $sRequestURI;
176
-		if ($this->sRequestURI == "")
177
-			$this->sRequestURI = $this->_detectURI();
176
+		if ($this->sRequestURI == "") {
177
+					$this->sRequestURI = $this->_detectURI();
178
+		}
178 179
 		$this->sWrapperPrefix = $sWrapperPrefix;
179 180
 		$this->bDebug = $bDebug;
180 181
 		$this->bStatusMessages = false;
@@ -399,8 +400,7 @@  discard block
 block discarded – undo
399 400
 			$this->aFunctions[$mFunction[0]] = 1;
400 401
 			$this->aFunctionRequestTypes[$mFunction[0]] = $sRequestType;
401 402
 			$this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
402
-		}
403
-		else {
403
+		} else {
404 404
 			$this->aFunctions[$mFunction] = 1;
405 405
 			$this->aFunctionRequestTypes[$mFunction] = $sRequestType;
406 406
 		}
@@ -426,8 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
 		if (is_array($mFunction)) {
428 428
 			$this->aFunctionIncludeFiles[$mFunction[0]] = $sIncludeFile;
429
-		}
430
-		else {
429
+		} else {
431 430
 			$this->aFunctionIncludeFiles[$mFunction] = $sIncludeFile;
432 431
 		}
433 432
 	}
@@ -451,8 +450,7 @@  discard block
 block discarded – undo
451 450
 		if (is_array($mFunction)) {
452 451
 			$this->sCatchAllFunction = $mFunction[0];
453 452
 			$this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
454
-		}
455
-		else {
453
+		} else {
456 454
 			$this->sCatchAllFunction = $mFunction;
457 455
 		}
458 456
 	}
@@ -477,8 +475,7 @@  discard block
 block discarded – undo
477 475
 		if (is_array($mFunction)) {
478 476
 			$this->sPreFunction = $mFunction[0];
479 477
 			$this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
480
-		}
481
-		else {
478
+		} else {
482 479
 			$this->sPreFunction = $mFunction;
483 480
 		}
484 481
 	}
@@ -492,7 +489,9 @@  discard block
 block discarded – undo
492 489
 	 */
493 490
 	function canProcessRequests()
494 491
 	{
495
-		if ($this->getRequestMode() != -1) return true;
492
+		if ($this->getRequestMode() != -1) {
493
+		    return true;
494
+		}
496 495
 		return false;
497 496
 	}
498 497
 
@@ -504,11 +503,13 @@  discard block
 block discarded – undo
504 503
 	 */
505 504
 	function getRequestMode()
506 505
 	{
507
-		if (!empty($_GET["xajax"]))
508
-			return XAJAX_GET;
506
+		if (!empty($_GET["xajax"])) {
507
+					return XAJAX_GET;
508
+		}
509 509
 
510
-		if (!empty($_POST["xajax"]))
511
-			return XAJAX_POST;
510
+		if (!empty($_POST["xajax"])) {
511
+					return XAJAX_POST;
512
+		}
512 513
 
513 514
 		return -1;
514 515
 	}
@@ -535,16 +536,18 @@  discard block
 block discarded – undo
535 536
 		$sResponse = "";
536 537
 
537 538
 		$requestMode = $this->getRequestMode();
538
-		if ($requestMode == -1) return;
539
+		if ($requestMode == -1) {
540
+		    return;
541
+		}
539 542
 
540 543
 		if ($requestMode == XAJAX_POST)
541 544
 		{
542 545
 			$sFunctionName = $_POST["xajax"];
543 546
 
544
-			if (!empty($_POST["xajaxargs"]))
545
-				$aArgs = $_POST["xajaxargs"];
546
-		}
547
-		else
547
+			if (!empty($_POST["xajaxargs"])) {
548
+							$aArgs = $_POST["xajaxargs"];
549
+			}
550
+		} else
548 551
 		{
549 552
 			header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
550 553
 			header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -553,8 +556,9 @@  discard block
 block discarded – undo
553 556
 
554 557
 			$sFunctionName = $_GET["xajax"];
555 558
 
556
-			if (!empty($_GET["xajaxargs"]))
557
-				$aArgs = $_GET["xajaxargs"];
559
+			if (!empty($_GET["xajaxargs"])) {
560
+							$aArgs = $_GET["xajaxargs"];
561
+			}
558 562
 		}
559 563
 
560 564
 		// Use xajax error handler if necessary
@@ -586,15 +590,13 @@  discard block
 block discarded – undo
586 590
 				if ($this->sCatchAllFunction) {
587 591
 					$sFunctionName = $this->sCatchAllFunction;
588 592
 					$bFunctionIsCatchAll = true;
589
-				}
590
-				else {
593
+				} else {
591 594
 					$bFoundFunction = false;
592 595
 					$objResponse = new xajaxResponse();
593 596
 					$objResponse->addAlert("Unknown Function $sFunctionName.");
594 597
 					$sResponse = $objResponse->getXML();
595 598
 				}
596
-			}
597
-			else if ($this->aFunctionRequestTypes[$sFunctionName] != $requestMode)
599
+			} else if ($this->aFunctionRequestTypes[$sFunctionName] != $requestMode)
598 600
 			{
599 601
 				$bFoundFunction = false;
600 602
 				$objResponse = new xajaxResponse();
@@ -615,12 +617,10 @@  discard block
 block discarded – undo
615 617
 				if (stristr($aArgs[$i],"<xjxobj>") != false)
616 618
 				{
617 619
 					$aArgs[$i] = $this->_xmlToArray("xjxobj",$aArgs[$i]);
618
-				}
619
-				else if (stristr($aArgs[$i],"<xjxquery>") != false)
620
+				} else if (stristr($aArgs[$i],"<xjxquery>") != false)
620 621
 				{
621 622
 					$aArgs[$i] = $this->_xmlToArray("xjxquery",$aArgs[$i]);
622
-				}
623
-				else if ($this->bDecodeUTF8Input)
623
+				} else if ($this->bDecodeUTF8Input)
624 624
 				{
625 625
 					$aArgs[$i] = $this->_decodeUTF8Data($aArgs[$i]);
626 626
 				}
@@ -631,14 +631,15 @@  discard block
 block discarded – undo
631 631
 				if (is_array($mPreResponse) && $mPreResponse[0] === false) {
632 632
 					$bEndRequest = true;
633 633
 					$sPreResponse = $mPreResponse[1];
634
-				}
635
-				else {
634
+				} else {
636 635
 					$sPreResponse = $mPreResponse;
637 636
 				}
638 637
 				if (is_a($sPreResponse, "xajaxResponse")) {
639 638
 					$sPreResponse = $sPreResponse->getXML();
640 639
 				}
641
-				if ($bEndRequest) $sResponse = $sPreResponse;
640
+				if ($bEndRequest) {
641
+				    $sResponse = $sPreResponse;
642
+				}
642 643
 			}
643 644
 
644 645
 			if (!$bEndRequest) {
@@ -646,8 +647,7 @@  discard block
 block discarded – undo
646 647
 					$objResponse = new xajaxResponse();
647 648
 					$objResponse->addAlert("The Registered Function $sFunctionName Could Not Be Found.");
648 649
 					$sResponse = $objResponse->getXML();
649
-				}
650
-				else {
650
+				} else {
651 651
 					if ($bFunctionIsCatchAll) {
652 652
 						$aArgs = array($sFunctionNameForSpecial, $aArgs);
653 653
 					}
@@ -660,8 +660,7 @@  discard block
 block discarded – undo
660 660
 					$objResponse = new xajaxResponse();
661 661
 					$objResponse->addAlert("No XML Response Was Returned By Function $sFunctionName.");
662 662
 					$sResponse = $objResponse->getXML();
663
-				}
664
-				else if ($sPreResponse != "") {
663
+				} else if ($sPreResponse != "") {
665 664
 					$sNewResponse = new xajaxResponse($this->sEncoding, $this->bOutputEntities);
666 665
 					$sNewResponse->loadXML($sPreResponse);
667 666
 					$sNewResponse->loadXML($sResponse);
@@ -671,8 +670,9 @@  discard block
 block discarded – undo
671 670
 		}
672 671
 
673 672
 		$sContentHeader = "Content-type: text/xml;";
674
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
675
-			$sContentHeader .= " charset=".$this->sEncoding;
673
+		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0) {
674
+					$sContentHeader .= " charset=".$this->sEncoding;
675
+		}
676 676
 		header($sContentHeader);
677 677
 		if ($this->bErrorHandler && !empty( $GLOBALS['xajaxErrorHandlerText'] )) {
678 678
 			$sErrorResponse = new xajaxResponse();
@@ -681,8 +681,7 @@  discard block
 block discarded – undo
681 681
 				$fH = @fopen($this->sLogFile, "a");
682 682
 				if (!$fH) {
683 683
 					$sErrorResponse->addAlert("** Logging Error **\n\nxajax was unable to write to the error log file:\n" . $this->sLogFile);
684
-				}
685
-				else {
684
+				} else {
686 685
 					fwrite($fH, "** xajax Error Log - " . strftime("%b %e %Y %I:%M:%S %p") . " **" . $GLOBALS['xajaxErrorHandlerText'] . "\n\n\n");
687 686
 					fclose($fH);
688 687
 				}
@@ -692,12 +691,17 @@  discard block
 block discarded – undo
692 691
 			$sResponse = $sErrorResponse->getXML();
693 692
 
694 693
 		}
695
-		if ($this->bCleanBuffer) while (@ob_end_clean());
694
+		if ($this->bCleanBuffer) {
695
+		    while (@ob_end_clean());
696
+		}
696 697
 		print $sResponse;
697
-		if ($this->bErrorHandler) restore_error_handler();
698
+		if ($this->bErrorHandler) {
699
+		    restore_error_handler();
700
+		}
698 701
 
699
-		if ($this->bExitAllowed)
700
-			exit();
702
+		if ($this->bExitAllowed) {
703
+					exit();
704
+		}
701 705
 	}
702 706
 
703 707
 	/**
@@ -806,9 +810,13 @@  discard block
 block discarded – undo
806 810
 	 */
807 811
 	function getJavascriptInclude($sJsURI="", $sJsFile=NULL)
808 812
 	{
809
-		if ($sJsFile == NULL) $sJsFile = "xajax_js/xajax.js";
813
+		if ($sJsFile == NULL) {
814
+		    $sJsFile = "xajax_js/xajax.js";
815
+		}
810 816
 
811
-		if ($sJsURI != "" && substr($sJsURI, -1) != "/") $sJsURI .= "/";
817
+		if ($sJsURI != "" && substr($sJsURI, -1) != "/") {
818
+		    $sJsURI .= "/";
819
+		}
812 820
 
813 821
 		$html = "\t<script type=\"text/javascript\" src=\"" . $sJsURI . $sJsFile . "\"></script>\n";
814 822
 		$html .= "\t<script type=\"text/javascript\">\n";
@@ -831,8 +839,7 @@  discard block
 block discarded – undo
831 839
 
832 840
 		if ($sJsFullFilename) {
833 841
 			$realJsFile = $sJsFullFilename;
834
-		}
835
-		else {
842
+		} else {
836 843
 			$realPath = realpath(dirname(__FILE__));
837 844
 			$realJsFile = $realPath . "/". $sJsFile;
838 845
 		}
@@ -849,8 +856,7 @@  discard block
 block discarded – undo
849 856
 			$fH = @fopen($realJsFile, "w");
850 857
 			if (!$fH) {
851 858
 				trigger_error("The xajax compressed javascript file could not be written in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
852
-			}
853
-			else {
859
+			} else {
854 860
 				fwrite($fH, $compressedScript);
855 861
 				fclose($fH);
856 862
 			}
@@ -950,7 +956,9 @@  discard block
 block discarded – undo
950 956
 	 */
951 957
 	function _isObjectCallback($sFunction)
952 958
 	{
953
-		if (array_key_exists($sFunction, $this->aObjects)) return true;
959
+		if (array_key_exists($sFunction, $this->aObjects)) {
960
+		    return true;
961
+		}
954 962
 		return false;
955 963
 	}
956 964
 
@@ -967,12 +975,10 @@  discard block
 block discarded – undo
967 975
 		if ($this->_isObjectCallback($sFunction)) {
968 976
 			if (is_object($this->aObjects[$sFunction][0])) {
969 977
 				return method_exists($this->aObjects[$sFunction][0], $this->aObjects[$sFunction][1]);
970
-			}
971
-			else {
978
+			} else {
972 979
 				return is_callable($this->aObjects[$sFunction]);
973 980
 			}
974
-		}
975
-		else {
981
+		} else {
976 982
 			return function_exists($sFunction);
977 983
 		}
978 984
 	}
@@ -990,8 +996,7 @@  discard block
 block discarded – undo
990 996
 	{
991 997
 		if ($this->_isObjectCallback($sFunction)) {
992 998
 			$mReturn = call_user_func_array($this->aObjects[$sFunction], $aArgs);
993
-		}
994
-		else {
999
+		} else {
995 1000
 			$mReturn = call_user_func_array($sFunction, $aArgs);
996 1001
 		}
997 1002
 		return $mReturn;
@@ -1086,8 +1091,7 @@  discard block
 block discarded – undo
1086 1091
 								{
1087 1092
 									$value = $this->_parseObjXml("xjxobj");
1088 1093
 									$this->iPos++;
1089
-								}
1090
-								else
1094
+								} else
1091 1095
 								{
1092 1096
 									$value .= $this->aObjArray[$this->iPos];
1093 1097
 									if ($this->bDecodeUTF8Input)
@@ -1134,10 +1138,11 @@  discard block
 block discarded – undo
1134 1138
 			if (get_magic_quotes_gpc() == 1) {
1135 1139
 				$newArray = array();
1136 1140
 				foreach ($aArray as $sKey => $sValue) {
1137
-					if (is_string($sValue))
1138
-						$newArray[$sKey] = stripslashes($sValue);
1139
-					else
1140
-						$newArray[$sKey] = $sValue;
1141
+					if (is_string($sValue)) {
1142
+											$newArray[$sKey] = stripslashes($sValue);
1143
+					} else {
1144
+											$newArray[$sKey] = $sValue;
1145
+					}
1141 1146
 				}
1142 1147
 				$aArray = $newArray;
1143 1148
 			}
@@ -1166,20 +1171,18 @@  discard block
 block discarded – undo
1166 1171
 				$sFuncToUse = "api_convert_encoding";
1167 1172
 			}
1168 1173
 			//if (function_exists('iconv'))
1169
-			elseif (function_exists('iconv'))
1170
-			//
1174
+			elseif (function_exists('iconv')) {
1175
+						//
1171 1176
 			{
1172 1177
 				$sFuncToUse = "iconv";
1173 1178
 			}
1174
-			else if (function_exists('mb_convert_encoding'))
1179
+			} else if (function_exists('mb_convert_encoding'))
1175 1180
 			{
1176 1181
 				$sFuncToUse = "mb_convert_encoding";
1177
-			}
1178
-			else if ($this->sEncoding == "ISO-8859-1")
1182
+			} else if ($this->sEncoding == "ISO-8859-1")
1179 1183
 			{
1180 1184
 				$sFuncToUse = "utf8_decode";
1181
-			}
1182
-			else
1185
+			} else
1183 1186
 			{
1184 1187
 				trigger_error("The incoming xajax data could not be converted from UTF-8", E_USER_NOTICE);
1185 1188
 			}
@@ -1191,8 +1194,7 @@  discard block
 block discarded – undo
1191 1194
 					if ($sFuncToUse == "iconv")
1192 1195
 					{
1193 1196
 						$sValue = iconv("UTF-8", $this->sEncoding.'//TRANSLIT', $sValue);
1194
-					}
1195
-					else if ($sFuncToUse == "mb_convert_encoding")
1197
+					} else if ($sFuncToUse == "mb_convert_encoding")
1196 1198
 					{
1197 1199
 						$sValue = mb_convert_encoding($sValue, $this->sEncoding, "UTF-8");
1198 1200
 					}
@@ -1221,27 +1223,23 @@  discard block
 block discarded – undo
1221 1223
 function xajaxErrorHandler($errno, $errstr, $errfile, $errline)
1222 1224
 {
1223 1225
 	$errorReporting = error_reporting();
1224
-	if (($errno & $errorReporting) == 0) return;
1226
+	if (($errno & $errorReporting) == 0) {
1227
+	    return;
1228
+	}
1225 1229
 
1226 1230
 	if ($errno == E_NOTICE) {
1227 1231
 		$errTypeStr = "NOTICE";
1228
-	}
1229
-	else if ($errno == E_WARNING) {
1232
+	} else if ($errno == E_WARNING) {
1230 1233
 		$errTypeStr = "WARNING";
1231
-	}
1232
-	else if ($errno == E_USER_NOTICE) {
1234
+	} else if ($errno == E_USER_NOTICE) {
1233 1235
 		$errTypeStr = "USER NOTICE";
1234
-	}
1235
-	else if ($errno == E_USER_WARNING) {
1236
+	} else if ($errno == E_USER_WARNING) {
1236 1237
 		$errTypeStr = "USER WARNING";
1237
-	}
1238
-	else if ($errno == E_USER_ERROR) {
1238
+	} else if ($errno == E_USER_ERROR) {
1239 1239
 		$errTypeStr = "USER FATAL ERROR";
1240
-	}
1241
-	else if ($errno == E_STRICT) {
1240
+	} else if ($errno == E_STRICT) {
1242 1241
 		return;
1243
-	}
1244
-	else {
1242
+	} else {
1245 1243
 		$errTypeStr = "UNKNOWN: $errno";
1246 1244
 	}
1247 1245
 	$GLOBALS['xajaxErrorHandlerText'] .= "\n----\n[$errTypeStr] $errstr\nerror in line $errline of file $errfile";
Please login to merge, or discard this patch.
main/inc/lib/xajax/xajaxResponse.inc.php 1 patch
Braces   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -258,8 +258,9 @@  discard block
 block discarded – undo
258 258
 		{
259 259
 			$queryStart++;
260 260
 			$queryEnd = strpos($sURL, '#', $queryStart);
261
-			if ($queryEnd === FALSE)
262
-				$queryEnd = strlen($sURL);
261
+			if ($queryEnd === FALSE) {
262
+							$queryEnd = strlen($sURL);
263
+			}
263 264
 			$queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
264 265
             $queryParts = array();
265 266
 			parse_str($queryPart, $queryParts);
@@ -487,8 +488,9 @@  discard block
 block discarded – undo
487 488
 	function getXML()
488 489
 	{
489 490
 		$sXML = "<?xml version=\"1.0\"";
490
-		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
491
-			$sXML .= " encoding=\"".$this->sEncoding."\"";
491
+		if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0) {
492
+					$sXML .= " encoding=\"".$this->sEncoding."\"";
493
+		}
492 494
 		$sXML .= " ?"."><xjx>" . $this->xml . "</xjx>";
493 495
 
494 496
 		return $sXML;
@@ -538,20 +540,21 @@  discard block
 block discarded – undo
538 540
 			elseif (function_exists('mb_convert_encoding')) {
539 541
 			//
540 542
 				$sData = call_user_func_array('mb_convert_encoding', array(&$sData, 'HTML-ENTITIES', $this->sEncoding));
541
-			}
542
-			else {
543
+			} else {
543 544
 				trigger_error("The xajax XML response output could not be converted to HTML entities because the mb_convert_encoding function is not available", E_USER_NOTICE);
544 545
 			}
545 546
 		}
546 547
 		$xml = "<cmd";
547
-		foreach($aAttributes as $sAttribute => $sValue)
548
-			$xml .= " $sAttribute=\"$sValue\"";
549
-		if ($sData !== null && !stristr($sData,'<![CDATA['))
550
-			$xml .= "><![CDATA[$sData]]></cmd>";
551
-		else if ($sData !== null)
552
-			$xml .= ">$sData</cmd>";
553
-		else
554
-			$xml .= "></cmd>";
548
+		foreach($aAttributes as $sAttribute => $sValue) {
549
+					$xml .= " $sAttribute=\"$sValue\"";
550
+		}
551
+		if ($sData !== null && !stristr($sData,'<![CDATA[')) {
552
+					$xml .= "><![CDATA[$sData]]></cmd>";
553
+		} else if ($sData !== null) {
554
+					$xml .= ">$sData</cmd>";
555
+		} else {
556
+					$xml .= "></cmd>";
557
+		}
555 558
 
556 559
 		return $xml;
557 560
 	}
@@ -566,11 +569,12 @@  discard block
 block discarded – undo
566 569
 	 * @return string serialized XML
567 570
 	 */
568 571
 	function _buildObjXml($var) {
569
-		if (gettype($var) == "object") $var = get_object_vars($var);
572
+		if (gettype($var) == "object") {
573
+		    $var = get_object_vars($var);
574
+		}
570 575
 		if (!is_array($var)) {
571 576
 			return "<![CDATA[$var]]>";
572
-		}
573
-		else {
577
+		} else {
574 578
 			$data = "<xjxobj>";
575 579
 			foreach ($var as $key => $value) {
576 580
 				$data .= "<e>";
Please login to merge, or discard this patch.
main/inc/lib/xajax/xajaxCompress.php 1 patch
Braces   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 					$escaped = false;
81 81
 					$quoteChar = $c;
82 82
 					$literal = $c;
83
-				}
84
-				else if($d=="/*" && !$inNormalComment)
83
+				} else if($d=="/*" && !$inNormalComment)
85 84
 				{
86 85
 					$inQuote = false;
87 86
 					$inComment = true;
@@ -89,18 +88,17 @@  discard block
 block discarded – undo
89 88
 					$quoteChar = $d;
90 89
 					$literal = $d;
91 90
 					$j++;
92
-				}
93
-				else if($d=="//") //ignore string markers that are found inside comments
91
+				} else if($d=="//") {
92
+				    //ignore string markers that are found inside comments
94 93
 				{
95 94
 					$inNormalComment = true;
96
-					$clean .= $c;
97 95
 				}
98
-				else
96
+					$clean .= $c;
97
+				} else
99 98
 				{
100 99
 					$clean .= $c;
101 100
 				}
102
-			}
103
-			else //allready in a string so find end quote
101
+			} else //allready in a string so find end quote
104 102
 			{
105 103
 				if($c == $quoteChar && !$escaped && !$inComment)
106 104
 				{
@@ -113,8 +111,7 @@  discard block
 block discarded – undo
113 111
 					//push the string onto our array
114 112
 					array_push($literal_strings,$literal);
115 113
 
116
-				}
117
-				else if($inComment && $d=="*/")
114
+				} else if($inComment && $d=="*/")
118 115
 				{
119 116
 					$inComment = false;
120 117
 					$literal .= $d;
@@ -126,16 +123,18 @@  discard block
 block discarded – undo
126 123
 					array_push($literal_strings,$literal);
127 124
 
128 125
 					$j++;
126
+				} else if($c == "\\" && !$escaped) {
127
+									$escaped = true;
128
+				} else {
129
+									$escaped = false;
129 130
 				}
130
-				else if($c == "\\" && !$escaped)
131
-					$escaped = true;
132
-				else
133
-					$escaped = false;
134 131
 
135 132
 				$literal .= $c;
136 133
 			}
137 134
 		}
138
-		if($inComment) $literal .= "\n";
135
+		if($inComment) {
136
+		    $literal .= "\n";
137
+		}
139 138
 		$clean .= "\n";
140 139
 	}
141 140
 	//explode the clean string into lines again
@@ -174,8 +173,9 @@  discard block
 block discarded – undo
174 173
 	$sJS = preg_replace("/[\n]*\{[\n]*/","{",$sJS);
175 174
 
176 175
 	//finally loop through and replace all the literal strings:
177
-	for($i=0;$i<count($literal_strings);$i++)
178
-		$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
176
+	for($i=0;$i<count($literal_strings);$i++) {
177
+			$sJS = str_replace("___".$i."___",$literal_strings[$i],$sJS);
178
+	}
179 179
 
180 180
 	return $sJS;
181 181
 }
Please login to merge, or discard this patch.