Passed
Branch master (a25af9)
by Federico
02:36
created
dist/jate/functions/requirer.php 1 patch
Braces   +20 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,29 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	function requireComponent( $_path, $_local = true, $_stack = null ) {
3 3
 		$path = getJFolder($_path, $_local, debug_backtrace());
4
-		if(file_exists($path) && isPhp($path))
5
-			jRequire($path, false, 0);
6
-		else
7
-			requireError($_path);
4
+		if(file_exists($path) && isPhp($path)) {
5
+					jRequire($path, false, 0);
6
+		} else {
7
+					requireError($_path);
8
+		}
8 9
 	}
9 10
 	function requireComponents( $_path, $_local = true, $_stack = null ) {
10 11
 		$path = getJFolder($_path, $_local, debug_backtrace());
11 12
 		if(file_exists($path)) {
12 13
 			$files = subFolder_file($path);
13 14
 			foreach ($files as $i) {
14
-				if(isPhp($path."/".$i))
15
-					requireComponent($path."/".$i, false, 0);
15
+				if(isPhp($path."/".$i)) {
16
+									requireComponent($path."/".$i, false, 0);
17
+				}
16 18
 			}
17
-		} else
18
-			requireError($_path);
19
+		} else {
20
+					requireError($_path);
21
+		}
19 22
 	}
20 23
 	function requireError( $_path ) {
21 24
 		global $jConfig;
22
-		if( $jConfig->DEBUG == 1 )
23
-			echo "Error load ($_path)<br>";
25
+		if( $jConfig->DEBUG == 1 ) {
26
+					echo "Error load ($_path)<br>";
27
+		}
24 28
 	}
25 29
 	function isPhp ( $_file ) {
26
-		if(!is_file($_file)) return false;
30
+		if(!is_file($_file)) {
31
+			return false;
32
+		}
27 33
 		$info = pathinfo($_file);
28 34
 		return ($info["extension"] == "php") || ($info["extension"] == "PHP");
29 35
 	}
@@ -43,8 +49,9 @@  discard block
 block discarded – undo
43 49
 			$stackInfo = $_stack;
44 50
 			$folder = dirname($stackInfo[0]["file"]);
45 51
 			$file = "$folder/$_path";
46
-		} else
47
-			$file = $_path;
52
+		} else {
53
+					$file = $_path;
54
+		}
48 55
 		return $file;
49 56
 	}
50 57
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/block.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 	function minify_output($_buffer) {
16 16
 		$search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
17 17
 		$replace = array ( '>', '<', '\\1' );
18
-		if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
19
-			$_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
18
+		if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) {
19
+					$_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
20
+		}
20 21
 		return utf8_encode($_buffer);
21 22
 	}
22 23
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 			if(is_array($_page)) {
19 19
 				$label = $_page[0];
20 20
 				$class = $_page[1];
21
-				if(isset($_page[2]))
22
-					$param = $_page[2];
21
+				if(isset($_page[2])) {
22
+									$param = $_page[2];
23
+				}
23 24
 			} else {
24 25
 				$label = $_page;
25 26
 				$class = $_page;
@@ -27,13 +28,15 @@  discard block
 block discarded – undo
27 28
 			$this->pages[$label] = [$class,$param];
28 29
 		}
29 30
 		public function addPages( $_pages ) {
30
-			foreach ($_pages as $i)
31
-				$this->addPage($i);
31
+			foreach ($_pages as $i) {
32
+							$this->addPage($i);
33
+			}
32 34
 		}
33 35
 		public function fetchPage( $_label ) {
34 36
 			$temp = $this->defaultPage;
35
-			if(isset($this->pages[$_label]))
36
-				$temp = $this->pages[$_label];
37
+			if(isset($this->pages[$_label])) {
38
+							$temp = $this->pages[$_label];
39
+			}
37 40
 			$this->currentPage = new $temp[0]($temp[1]);
38 41
 			return $this->currentPage;
39 42
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,9 +11,10 @@  discard block
 block discarded – undo
11 11
 				if($i["fk_menu"] == 0) {
12 12
 					array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => []));
13 13
 					$submenu = c_query("SELECT * FROM menu WHERE fk_menu = ".$i["pk_menu"],"Menu,getMenu,submenu");
14
-					if($submenu)
15
-					foreach ($submenu as $j)
14
+					if($submenu) {
15
+										foreach ($submenu as $j)
16 16
 						array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []) );
17
+					}
17 18
 				}
18 19
 			}
19 20
 			$this->data["menu"] = $temp;
@@ -26,18 +27,20 @@  discard block
 block discarded – undo
26 27
 				if( is_array($i["submenu"]) && count($i["submenu"])<1) {
27 28
 					$temp .= '<li><a href="'.$i["link"].'">'.$i["label"].'</a></li>';
28 29
 				} else {
29
-					if($this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"]))))
30
-						$temp .= '<li class="dropdown active">';
31
-					else
32
-						$temp .= '<li class="dropdown">';
30
+					if($this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"])))) {
31
+											$temp .= '<li class="dropdown active">';
32
+					} else {
33
+											$temp .= '<li class="dropdown">';
34
+					}
33 35
 					$temp .=
34 36
 						'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
35 37
 						$i["label"].
36 38
 						'<span class="caret"></span>'.
37 39
 						'</a>'.
38 40
 						'<ul class="dropdown-menu">';
39
-					foreach ($i["submenu"] as $j)
40
-						$temp .= '<li><a href="'.$j["link"].'">'.$j["label"].'</a></li>';
41
+					foreach ($i["submenu"] as $j) {
42
+											$temp .= '<li><a href="'.$j["link"].'">'.$j["label"].'</a></li>';
43
+					}
41 44
 					$temp .= '</ul></li>';
42 45
 				}
43 46
 			}
@@ -45,17 +48,19 @@  discard block
 block discarded – undo
45 48
 		}
46 49
 		protected function isSubString( $_string, $_list) {
47 50
 			$success = false;
48
-			foreach ($_list as $i)
49
-				if(strpos($_string,$i) !== false)
51
+			foreach ($_list as $i) {
52
+							if(strpos($_string,$i) !== false)
50 53
 					$success = true;
54
+			}
51 55
 			return $success;
52 56
 		}
53 57
 		public function loginWithUser() {
54 58
 			$this->init();
55 59
 			$temp = [];
56 60
 			$user = "";
57
-			if(!isset($_SESSION["username"]))
58
-				$_SESSION["username"] ="guest";
61
+			if(!isset($_SESSION["username"])) {
62
+							$_SESSION["username"] ="guest";
63
+			}
59 64
 			$user = $_SESSION["username"];
60 65
 			$blackList = c_query(
61 66
 				"SELECT user.*,user_section.*
@@ -69,11 +74,13 @@  discard block
 block discarded – undo
69 74
 			foreach ($this->data["menu"] as $i) {
70 75
 				$success = true;
71 76
 				$k = $i["label"];
72
-				foreach ($blackList as $j)
73
-					if( $j["section"] == $k)
77
+				foreach ($blackList as $j) {
78
+									if( $j["section"] == $k)
74 79
 						$success = false;
75
-				if($success)
76
-					array_push($temp,$i);
80
+				}
81
+				if($success) {
82
+									array_push($temp,$i);
83
+				}
77 84
 			}
78 85
 			$this->data["menu"] = $temp;
79 86
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -21,23 +21,27 @@  discard block
 block discarded – undo
21 21
 		}
22 22
 		public function getJsVariables() {
23 23
 			$temp = [];
24
-			foreach ($this->modules as $i)
25
-				$temp = array_merge( $temp, $i->getJsVariables() );
26
-			foreach ($this->files as $i)
27
-				if (is_array($i))
24
+			foreach ($this->modules as $i) {
25
+							$temp = array_merge( $temp, $i->getJsVariables() );
26
+			}
27
+			foreach ($this->files as $i) {
28
+							if (is_array($i))
28 29
 					array_push($temp,$i);
30
+			}
29 31
 			return $temp;
30 32
 		}
31 33
 		public function addModules( $_mods ) {
32
-			foreach ($_mods as $value)
33
-				$this->addModule($value);
34
+			foreach ($_mods as $value) {
35
+							$this->addModule($value);
36
+			}
34 37
 		}
35 38
 		public function addModule( $_mod ) {
36 39
 			$this->modules[$_mod->name] = $_mod;
37 40
 		}
38 41
 		public function addFiles( $_files ) {
39
-			foreach ($_files as $value)
40
-				$this->addFile($value);
42
+			foreach ($_files as $value) {
43
+							$this->addFile($value);
44
+			}
41 45
 		}
42 46
 		public function addFile( $_file ) {
43 47
 			array_push($this->files, $_file);
@@ -49,11 +53,13 @@  discard block
 block discarded – undo
49 53
 		}
50 54
 		protected function getRequire( $_function, $_extenction) {
51 55
 			$temp = [];
52
-			foreach ($this->modules as $i)
53
-				$temp = array_merge( $temp, $i->$_function() );
54
-			foreach ($this->files as $i)
55
-				if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
56
+			foreach ($this->modules as $i) {
57
+							$temp = array_merge( $temp, $i->$_function() );
58
+			}
59
+			foreach ($this->files as $i) {
60
+							if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
56 61
 					array_push($temp,$i);
62
+			}
57 63
 			return $temp;
58 64
 		}
59 65
 	}
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@
 block discarded – undo
7 7
 			parent::__construct();
8 8
 			$args = func_get_args();
9 9
 			$count = func_num_args();
10
-			if (method_exists($this,$func='__construct'.$count))
11
-				call_user_func_array(array($this,$func),$args);
10
+			if (method_exists($this,$func='__construct'.$count)) {
11
+							call_user_func_array(array($this,$func),$args);
12
+			}
12 13
 		}
13 14
 		public function __construct0() {
14 15
 			$this->connection = null;
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,17 +25,20 @@
 block discarded – undo
25 25
 			$this->data["js"]				= array_unique($this->data["js"]);
26 26
 			$this->data["pagePath"]	= json_encode($this->data["pagePath"]);
27 27
 			$tempStr = "";
28
-			foreach ($this->data["css"] as $i)
29
-				$tempStr .= '<link rel="stylesheet" href="'.$i.'">';
28
+			foreach ($this->data["css"] as $i) {
29
+							$tempStr .= '<link rel="stylesheet" href="'.$i.'">';
30
+			}
30 31
 			$this->data["css"] = $tempStr;
31 32
 			$tempStr = "";
32
-			foreach ($this->data["js"] as $i)
33
-				$tempStr .= '<script src="'.$i.'"></script>';
33
+			foreach ($this->data["js"] as $i) {
34
+							$tempStr .= '<script src="'.$i.'"></script>';
35
+			}
34 36
 			$this->data["js"] = $tempStr;
35 37
 			$tempStr = "";
36 38
 			$tempStr .= '<script type="text/javascript">';
37
-			foreach ($this->data["jsVariables"] as $i)
38
-				$tempStr .= " ".$i[0]." = ".$i[1].";\n";
39
+			foreach ($this->data["jsVariables"] as $i) {
40
+							$tempStr .= " ".$i[0]." = ".$i[1].";\n";
41
+			}
39 42
 			$tempStr .= '</script>';
40 43
 			$this->data["jsVariables"] = $tempStr;
41 44
 		}
Please login to merge, or discard this patch.
dist/status.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 					$percent;
23 23
 					foreach (getGitLog() as $i) {
24 24
 						$cont++;
25
-						if($cont % $nPerCol == 1)
26
-							echo '<div class="row">';
25
+						if($cont % $nPerCol == 1) {
26
+													echo '<div class="row">';
27
+						}
27 28
 						if(isset($i["tag"])) {
28 29
 							$percent = explode(".",$i["tag"]);
29 30
 							$percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]);
@@ -32,7 +33,8 @@  discard block
 block discarded – undo
32 33
 						<div class="col-lg-<?=$dim?>">
33 34
 							<div class="well well-sm miniblock">
34 35
 								<div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div>
35
-								<div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div>
36
+								<div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) {
37
+	echo $i["tag"]?><br></div>
36 38
 								<div class="date"><b>Date:</b> <?=$i["date"]?><br></div>
37 39
 								<div class="message"><b>Message:</b> <?=$i["message"]?><br></div>
38 40
 								<div class="progress">
@@ -46,6 +48,7 @@  discard block
 block discarded – undo
46 48
 					<?php
47 49
 					if($cont % $nPerCol == 0)
48 50
 						echo '</div>';
51
+}
49 52
 					} ?>
50 53
 				</div>
51 54
 			</div>
Please login to merge, or discard this patch.
dist/jate.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,14 +1,16 @@
 block discarded – undo
1 1
 <?php
2
-	if(isset($GLOBALS["JATEPath"]))
3
-		$GLOBALS["JATEPath"] = [];
2
+	if(isset($GLOBALS["JATEPath"])) {
3
+			$GLOBALS["JATEPath"] = [];
4
+	}
4 5
 	$commonLocations = array(
5 6
 		"bower_components/JATE/dist/",
6 7
 		"vendor/xaberr/jate/dist/",
7 8
 		"../../dist/"
8 9
 	);
9
-	foreach ($commonLocations as $i)
10
-		if(file_exists($i."jate/coreEngine.php")) {
10
+	foreach ($commonLocations as $i) {
11
+			if(file_exists($i."jate/coreEngine.php")) {
11 12
 			array_push($GLOBALS["JATEPath"], $i);
13
+	}
12 14
 			require_once($i."jate/coreEngine.php");
13 15
 			break;
14 16
 		}
Please login to merge, or discard this patch.