Test Failed
Push — master ( 7d043f...96f4c4 )
by Federico
07:15
created
dist/jate/modules/Query/Query.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,42 +7,42 @@
 block discarded – undo
7 7
 			$this->connection = [];
8 8
 			$this->currentConnection = null;
9 9
 		}
10
-		public function addConnection( $_name, $_connection ) {
10
+		public function addConnection($_name, $_connection) {
11 11
 			$this->connection["$_name"] = $_connection;
12 12
 			$this->currentConnection = $_connection;
13 13
 
14 14
 			foreach ($this->modules as &$module)
15
-				if(isset($module->currentConnection))
15
+				if (isset($module->currentConnection))
16 16
 					$module->addConnection($_name, $_connection);
17 17
 		}
18
-		public function setConnection( $_name ) {
18
+		public function setConnection($_name) {
19 19
 			$this->currentConnection = $this->connection["$_name"];
20 20
 		}
21
-		public function query( $_query ) {
21
+		public function query($_query) {
22 22
 			$this->stdQuery($_query);
23 23
 			return true;
24 24
 		}
25
-		public function queryInsert( $_query ) {
25
+		public function queryInsert($_query) {
26 26
 			$temp = $this->stdQuery($_query);
27 27
 			return $this->currentConnection->database->lastInsertId();
28 28
 		}
29 29
 
30
-		public function queryFetch( $_query ) {
30
+		public function queryFetch($_query) {
31 31
 			$temp = $this->stdQuery($_query);
32 32
 			return $temp->fetchAll(PDO::FETCH_ASSOC);
33 33
 		}
34 34
 
35
-		public function queryArray( $_query ) {
35
+		public function queryArray($_query) {
36 36
 			$temp = $this->stdQuery($_query);
37 37
 			return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
38 38
 		}
39 39
 
40
-		protected function stdQuery( $_query ) {
40
+		protected function stdQuery($_query) {
41 41
 			$database = $this->currentConnection->database;
42 42
 			$error = "Error query [$_query]";
43 43
 			$query = $database->prepare($_query);
44 44
 			$_result = $query->execute();
45
-			if(!$_result) {
45
+			if (!$_result) {
46 46
 				echo "$_query<br>";
47 47
 				echo "Something wrong: $error";
48 48
 				var_dump($query->errorInfo());
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,10 @@
 block discarded – undo
11 11
 			$this->connection["$_name"] = $_connection;
12 12
 			$this->currentConnection = $_connection;
13 13
 
14
-			foreach ($this->modules as &$module)
15
-				if(isset($module->currentConnection))
14
+			foreach ($this->modules as &$module) {
15
+							if(isset($module->currentConnection))
16 16
 					$module->addConnection($_name, $_connection);
17
+			}
17 18
 		}
18 19
 		public function setConnection( $_name ) {
19 20
 			$this->currentConnection = $this->connection["$_name"];
Please login to merge, or discard this patch.
dist/jate/modules/JConfig/JConfig.php 2 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,11 @@  discard block
 block discarded – undo
17 17
 		public function import( $_path, $_type = "misc" ) {
18 18
 			$data = file_get_contents($_path);
19 19
 			$data = json_decode($data);
20
-			if( $_type == "connection" )
21
-				$this->overlayConnection($data);
22
-			else
23
-				$this->overlayMisc($data);
20
+			if( $_type == "connection" ) {
21
+							$this->overlayConnection($data);
22
+			} else {
23
+							$this->overlayMisc($data);
24
+			}
24 25
 		}
25 26
 		protected function overlayConnection( $_data ) {
26 27
 			$this->connection = $this->obj2array($_data);
@@ -40,8 +41,9 @@  discard block
 block discarded – undo
40 41
 			return $return;
41 42
 		}
42 43
 		protected function importObject( $_object ) {
43
-			foreach (get_object_vars($_object) as $key => $value)
44
-				$this->$key = $value;
44
+			foreach (get_object_vars($_object) as $key => $value) {
45
+							$this->$key = $value;
46
+			}
45 47
 		}
46 48
 	}
47 49
 ?>
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,45 +6,45 @@
 block discarded – undo
6 6
 		public $pages;
7 7
 		public $server;
8 8
 		public function __construct() {
9
-			$this->connection["enable"]		= false;
10
-			$this->connection["user"]			= "";
9
+			$this->connection["enable"] = false;
10
+			$this->connection["user"] = "";
11 11
 			$this->connection["password"] = "";
12 12
 			$this->connection["database"] = "";
13
-			$this->connection["server"]		= "";
14
-			$this->all		= "";
13
+			$this->connection["server"] = "";
14
+			$this->all = "";
15 15
 			$this->DEBUG	= 0;
16 16
 			$this->pages	= [];
17
-			$this->server	= [];
17
+			$this->server = [];
18 18
 			$this->server["HTTP_HOST"]		= $_SERVER["HTTP_HOST"];
19
-			$this->server["REQUEST_URI"]	= $_SERVER["REQUEST_URI"];
19
+			$this->server["REQUEST_URI"] = $_SERVER["REQUEST_URI"];
20 20
 			$this->server["PHP_SELF"]			= $_SERVER["PHP_SELF"];
21 21
 		}
22
-		public function import( $_path, $_type = "misc" ) {
22
+		public function import($_path, $_type = "misc") {
23 23
 			$data = file_get_contents($_path);
24 24
 			$data = json_decode($data);
25
-			if( $_type == "connection" )
25
+			if ($_type == "connection")
26 26
 				$this->overlayConnection($data);
27 27
 			else
28 28
 				$this->overlayMisc($data);
29 29
 		}
30
-		protected function overlayConnection( $_data ) {
30
+		protected function overlayConnection($_data) {
31 31
 			$this->connection = $this->obj2array($_data);
32 32
 		}
33
-		protected function overlayMisc( $_data ) {
33
+		protected function overlayMisc($_data) {
34 34
 			$this->importObject($_data);
35 35
 		}
36
-		protected function obj2array ( &$_instance ) {
37
-			$clone	= (array) $_instance;
36
+		protected function obj2array(&$_instance) {
37
+			$clone = (array) $_instance;
38 38
 			$return	= [];
39 39
 			$return['___SOURCE_KEYS_'] = $clone;
40
-			while ( list ($key, $value) = each ($clone) ) {
41
-				$temp		= explode ("\0", $key);
42
-				$newkey	= $temp[count($temp)-1];
40
+			while (list ($key, $value) = each($clone)) {
41
+				$temp		= explode("\0", $key);
42
+				$newkey = $temp[count($temp) - 1];
43 43
 				$return[$newkey] = &$return['___SOURCE_KEYS_'][$key];
44 44
 			}
45 45
 			return $return;
46 46
 		}
47
-		protected function importObject( $_object ) {
47
+		protected function importObject($_object) {
48 48
 			foreach (get_object_vars($_object) as $key => $value)
49 49
 				$this->$key = $value;
50 50
 		}
Please login to merge, or discard this patch.
dist/jate/functions/git.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2
-	function getGitLog( $_dir = "./" ) {
3
-		if(!file_exists($_dir))
2
+	function getGitLog($_dir = "./") {
3
+		if (!file_exists($_dir))
4 4
 			return [];
5 5
 		$currentDir = getcwd();
6 6
 		chdir($_dir);
7 7
 		$gitHistory	= [];
8 8
 		$gitLogs		= [];
9 9
 		$gitPath		= str_replace('\\', '/', exec("git rev-parse --show-toplevel"));
10
-		$rootPath		= str_replace('\\', '/', getcwd ());
10
+		$rootPath		= str_replace('\\', '/', getcwd());
11 11
 		$lastHash		= null;
12
-		if( $gitPath != $rootPath ) {
12
+		if ($gitPath != $rootPath) {
13 13
 			chdir($currentDir);
14 14
 			return [];
15 15
 		}
Please login to merge, or discard this patch.
Braces   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	function getGitLog( $_dir = "./" ) {
3
-		if(!file_exists($_dir))
4
-			return [];
3
+		if(!file_exists($_dir)) {
4
+					return [];
5
+		}
5 6
 		$currentDir = getcwd();
6 7
 		chdir($_dir);
7 8
 		$gitHistory	= [];
@@ -35,19 +36,17 @@  discard block
 block discarded – undo
35 36
 						$tag = trim($tag[0]);
36 37
 						$gitHistory[$lastHash]['tag'] = $tag;
37 38
 					}
38
-				}
39
-				else if (strpos($line, 'Author') === 0) {
39
+				} else if (strpos($line, 'Author') === 0) {
40 40
 					$author = explode(':', $line);
41 41
 					$author = trim(end($author));
42 42
 					$gitHistory[$lastHash]['author'] = $author;
43
-				}
44
-				else if (strpos($line, 'Date') === 0) {
43
+				} else if (strpos($line, 'Date') === 0) {
45 44
 					$date = explode(':', $line, 2);
46 45
 					$date = trim(end($date));
47 46
 					$gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date));
47
+				} else {
48
+									$gitHistory[$lastHash]['message'] .= "$line<br>";
48 49
 				}
49
-				else
50
-					$gitHistory[$lastHash]['message'] .= "$line<br>";
51 50
 			}
52 51
 		}
53 52
 		chdir($currentDir);
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,17 +26,20 @@
 block discarded – undo
26 26
 			$this->tags["js"]				= array_unique($this->tags["js"]);
27 27
 			$this->tags["pagePath"]	= json_encode($this->tags["pagePath"]);
28 28
 			$tempStr = "";
29
-			foreach ($this->tags["css"] as $i)
30
-				$tempStr .= "<link rel='stylesheet' href='$i'>";
29
+			foreach ($this->tags["css"] as $i) {
30
+							$tempStr .= "<link rel='stylesheet' href='$i'>";
31
+			}
31 32
 			$this->tags["css"] = $tempStr;
32 33
 			$tempStr = "";
33
-			foreach ($this->tags["js"] as $i)
34
-				$tempStr .= "<script src='$i'></script>";
34
+			foreach ($this->tags["js"] as $i) {
35
+							$tempStr .= "<script src='$i'></script>";
36
+			}
35 37
 			$this->tags["js"] = $tempStr;
36 38
 			$tempStr = "";
37 39
 			$tempStr .= "<script type='text/javascript'>";
38
-			foreach ($this->tags["jsVariables"] as $i)
39
-				$tempStr .= " $i[0] = $i[1];\n";
40
+			foreach ($this->tags["jsVariables"] as $i) {
41
+							$tempStr .= " $i[0] = $i[1];\n";
42
+			}
40 43
 			$tempStr .= "</script>";
41 44
 			$this->tags["jsVariables"] = $tempStr;
42 45
 		}
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@
 block discarded – undo
1 1
 <?php
2 2
 	requireComponent("../Query/Query.php");
3 3
 	class Html extends Query {
4
-		public function __construct( $_parameters = [ "app" => null, "page" => null] ) {
4
+		public function __construct($_parameters = ["app" => null, "page" => null]) {
5 5
 			parent::__construct();
6 6
 			$this->data["template"]					= "";
7 7
 			$this->tags["brand"]						= "";
8 8
 			$this->tags["brandImg"]					= "";
9 9
 			$this->tags["menu"]							= "";
10 10
 			$this->tags["title"]						= "";
11
-			$this->tags["subtitle"]		 			= "";
11
+			$this->tags["subtitle"] = "";
12 12
 			$this->tags["content"]				 	= "";
13
-			$this->tags["outContent"]		 		= "";
13
+			$this->tags["outContent"] = "";
14 14
 			$this->tags["footer"]		 				= "";
15 15
 			$this->tags["pagePath"]				 	= [];
16
-			$this->tags["css"]							= [];
17
-			$this->tags["js"]					 			= [];
16
+			$this->tags["css"] = [];
17
+			$this->tags["js"] = [];
18 18
 			$this->tags["jsVariables"]			= [];
19
-			$this->tags["metaDescription"]	= [];
20
-			$this->tags["metaKeywords"]			= [];
19
+			$this->tags["metaDescription"] = [];
20
+			$this->tags["metaKeywords"] = [];
21 21
 			$this->tags["metaAuthor"]				= [];
22
-			$this->parameters								= $_parameters;
23
-			$this->tags["base"]							= $_parameters["app"]->server["RELATIVE"]."/";
22
+			$this->parameters = $_parameters;
23
+			$this->tags["base"] = $_parameters["app"]->server["RELATIVE"]."/";
24 24
 		}
25 25
 		public function uniforma() {
26 26
 			$this->addDipendences();
27 27
 			$this->tags["css"]			= array_unique($this->tags["css"]);
28 28
 			$this->tags["js"]				= array_unique($this->tags["js"]);
29
-			$this->tags["pagePath"]	= json_encode($this->tags["pagePath"]);
29
+			$this->tags["pagePath"] = json_encode($this->tags["pagePath"]);
30 30
 			$tempStr = "";
31 31
 			foreach ($this->tags["css"] as $i)
32 32
 				$tempStr .= "<link rel='stylesheet' href='$i'>";
Please login to merge, or discard this patch.
dist/jate/coreEngine.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 
5 5
 	//JATE SUFF
6 6
 	require_once			(end($GLOBALS["JATEPath"])."jate/functions/requirer.php");
7
-	requireComponent	("functions/folder.php");
8
-	requireComponent	("modules/JConfig/JConfig.php");
9
-	requireComponent	("modules/Module/Module.php");
10
-	requireComponents	("functions");
11
-	requireModules		("modules");
7
+	requireComponent("functions/folder.php");
8
+	requireComponent("modules/JConfig/JConfig.php");
9
+	requireComponent("modules/Module/Module.php");
10
+	requireComponents("functions");
11
+	requireModules("modules");
12 12
 
13 13
 	//USER STUFF
14
-	requireComponent	("config.php",false);
15
-	requireModules		("modules",false);
16
-	requireComponents	("bundles/models",false);
17
-	requireComponents	("bundles/controllers",false);
14
+	requireComponent("config.php", false);
15
+	requireModules("modules", false);
16
+	requireComponents("bundles/models", false);
17
+	requireComponents("bundles/controllers", false);
18 18
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 2 patches
Braces   +20 added lines, -14 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
 				$path		= $_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
 				$path		= $_page;
25 26
 				$class	= $_page;
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 			$this->pages[$path] = [$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( $_stack ) {
34 36
 			$parameters = [];
@@ -42,10 +44,11 @@  discard block
 block discarded – undo
42 44
 					break;
43 45
 				}
44 46
 			}
45
-			if( isset($temp[1]) && is_array($temp[1]) )
46
-				$temp[1] = array_merge($temp[1], $parameters);
47
-			else
48
-				$temp[1] = $parameters;
47
+			if( isset($temp[1]) && is_array($temp[1]) ) {
48
+							$temp[1] = array_merge($temp[1], $parameters);
49
+			} else {
50
+							$temp[1] = $parameters;
51
+			}
49 52
 			$this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
50 53
 			return $this->currentPage;
51 54
 		}
@@ -65,15 +68,18 @@  discard block
 block discarded – undo
65 68
 			$pathLength = count($_path);
66 69
 			if($urlLength == $pathLength) {
67 70
 				while($cont < $urlLength) {
68
-					if( $_path[$cont] == $_url[$cont] )
69
-						$cont++;
70
-					else if( strpos($_path[$cont], "\$") !== false ) {
71
+					if( $_path[$cont] == $_url[$cont] ) {
72
+											$cont++;
73
+					} else if( strpos($_path[$cont], "\$") !== false ) {
71 74
 						$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
72 75
 						$cont++;
73
-					} else break;
76
+					} else {
77
+						break;
78
+					}
79
+				}
80
+				if($cont == $urlLength) {
81
+									return $variables;
74 82
 				}
75
-				if($cont == $urlLength)
76
-					return $variables;
77 83
 			}
78 84
 			return null;
79 85
 		}
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,48 +7,48 @@  discard block
 block discarded – undo
7 7
 		public function __construct() {
8 8
 			parent::__construct();
9 9
 			$this->pages = [];
10
-			$this->defaultPage	= ["Page404",[]];
10
+			$this->defaultPage	= ["Page404", []];
11 11
 			$this->currentPage	= null;
12
-			$this->jConfig			= null;
12
+			$this->jConfig = null;
13 13
 		}
14
-		public function addPage( $_page ) {
14
+		public function addPage($_page) {
15 15
 			$param	= [];
16 16
 			$path		= $_page;
17 17
 			$class	= $_page;
18
-			if(is_array($_page)) {
18
+			if (is_array($_page)) {
19 19
 				$path		= $_page[0];
20 20
 				$class	= $_page[1];
21
-				if(isset($_page[2]))
21
+				if (isset($_page[2]))
22 22
 					$param = $_page[2];
23 23
 			}
24 24
 			$this->pages[$path] = [$class, $param];
25 25
 		}
26
-		public function addPages( $_pages ) {
26
+		public function addPages($_pages) {
27 27
 			foreach ($_pages as $i)
28 28
 				$this->addPage($i);
29 29
 		}
30 30
 		public function fetchPage(  ) {
31 31
 			$router = new Router();
32
-			$router->parameters = [ "app" => &$this->jConfig, "page" => null];
32
+			$router->parameters = ["app" => &$this->jConfig, "page" => null];
33 33
 			$stack = $router->getPage();
34 34
 			$parameters = [];
35
-			$temp				= $this->defaultPage;
35
+			$temp = $this->defaultPage;
36 36
 			foreach ($this->pages as $key => $value) {
37 37
 				$variables = $this->pathSeeker(explode("/", $key), $stack);
38
-				if(is_array($variables)) {
38
+				if (is_array($variables)) {
39 39
 					$temp = $value;
40 40
 					$parameters = $variables;
41 41
 					break;
42 42
 				}
43 43
 			}
44
-			if( isset($temp[1]) && is_array($temp[1]) )
44
+			if (isset($temp[1]) && is_array($temp[1]))
45 45
 				$temp[1] = array_merge($temp[1], $parameters);
46 46
 			else
47 47
 				$temp[1] = $parameters;
48 48
 			$this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
49 49
 			return $this->currentPage;
50 50
 		}
51
-		public function setDefaultPage( $_page ) {
51
+		public function setDefaultPage($_page) {
52 52
 			$this->defaultPage = $_page;
53 53
 		}
54 54
 		public function draw() {
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 			$gui->init($this->currentPage);
58 58
 			$gui->draw($this->currentPage->data["template"]);
59 59
 		}
60
-		public function pathSeeker( $_path, $_url ) {
60
+		public function pathSeeker($_path, $_url) {
61 61
 			$urlLength = count($_url);
62 62
 			$cont = 0;
63 63
 			$variables = [];
64 64
 			$pathLength = count($_path);
65
-			if($urlLength == $pathLength) {
66
-				while($cont < $urlLength) {
67
-					if( $_path[$cont] == $_url[$cont] )
65
+			if ($urlLength == $pathLength) {
66
+				while ($cont < $urlLength) {
67
+					if ($_path[$cont] == $_url[$cont])
68 68
 						$cont++;
69
-					else if( strpos($_path[$cont], "\$") !== false ) {
69
+					else if (strpos($_path[$cont], "\$") !== false) {
70 70
 						$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
71 71
 						$cont++;
72 72
 					} else break;
73 73
 				}
74
-				if($cont == $urlLength)
74
+				if ($cont == $urlLength)
75 75
 					return $variables;
76 76
 			}
77 77
 			return null;
78 78
 		}
79
-		public function newConfig( $_path = "config/") {
79
+		public function newConfig($_path = "config/") {
80 80
 			$this->jConfig = new JConfig();
81
-			$this->jConfig->import("${_path}connection.json","connection");
81
+			$this->jConfig->import("${_path}connection.json", "connection");
82 82
 			$this->jConfig->import("${_path}misc.json");
83 83
 			$this->jConfig->import("${_path}router.json");
84 84
 		}
Please login to merge, or discard this patch.
dist/jate/modules/Router/Router.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 			parent::__construct();
5 5
 		}
6 6
 		public function getPage() {
7
-			$request	= $this->parameters["app"]->server["REQUEST_URI"];
8
-			$base			= $this->parameters["app"]->server["RELATIVE"];
7
+			$request = $this->parameters["app"]->server["REQUEST_URI"];
8
+			$base = $this->parameters["app"]->server["RELATIVE"];
9 9
 			$url			= str_replace($base, "", $request);
10 10
 			$url			= explode("/", $url);
11 11
 			return $url;
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 			$menu = $this->queryFetch("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`");
9 9
 			$temp = [];
10 10
 			foreach ($menu as $i) {
11
-				if($i["fk_menu"] == 0) {
11
+				if ($i["fk_menu"] == 0) {
12 12
 					$pk_menu = $i["pk_menu"];
13 13
 					array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false));
14 14
 					$submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
15
-					if($submenu)
15
+					if ($submenu)
16 16
 					foreach ($submenu as $j)
17
-						array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) );
17
+						array_push($temp[count($temp) - 1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false));
18 18
 				}
19 19
 			}
20 20
 			$this->tags["menu"] = $temp;
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 		public function draw() {
24 24
 			$temp = "";
25 25
 			$host = $this->parameters["app"]->server["HTTP_HOST"];
26
-			$uri	= $this->parameters["app"]->server["REQUEST_URI"];
27
-			$actualLink	= "http://$host$uri";
28
-			$relative		= $this->parameters["app"]->server["RELATIVE"];
26
+			$uri = $this->parameters["app"]->server["REQUEST_URI"];
27
+			$actualLink = "http://$host$uri";
28
+			$relative = $this->parameters["app"]->server["RELATIVE"];
29 29
 			foreach ($this->tags["menu"] as $i) {
30 30
 				$prePath = "";
31
-				if($i["relative"])
31
+				if ($i["relative"])
32 32
 					$prePath = $relative;
33 33
 				$active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
34
-				if( is_array($i["submenu"]) && count($i["submenu"])<1)
34
+				if (is_array($i["submenu"]) && count($i["submenu"]) < 1)
35 35
 						$temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
36 36
 				else {
37 37
 					$temp .= "<li class='dropdown $active'>";
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 						'<ul class="dropdown-menu">';
44 44
 					foreach ($i["submenu"] as $j) {
45 45
 						$prePath = "";
46
-						if($j["relative"])
46
+						if ($j["relative"])
47 47
 							$prePath = $relative;
48 48
 						$temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>";
49 49
 					}
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 			return $temp;
54 54
 		}
55
-		protected function isSubString( $_string, $_list) {
55
+		protected function isSubString($_string, $_list) {
56 56
 			$success = false;
57 57
 			foreach ($_list as $i)
58
-				if(strpos($_string,$i) !== false)
58
+				if (strpos($_string, $i) !== false)
59 59
 					$success = true;
60 60
 			return $success;
61 61
 		}
62 62
 		public function loginWithUser() {
63 63
 			$this->init();
64 64
 			$temp = [];
65
-			if(!isset($_SESSION["username"]))
66
-				$_SESSION["username"] ="guest";
65
+			if (!isset($_SESSION["username"]))
66
+				$_SESSION["username"] = "guest";
67 67
 			$user = $_SESSION["username"];
68 68
 			$blackList = $this->queryFetch(
69 69
 				"SELECT user.*,user_section.*
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 				$success = true;
79 79
 				$k = $i["label"];
80 80
 				foreach ($blackList as $j)
81
-					if( $j["section"] == $k)
81
+					if ($j["section"] == $k)
82 82
 						$success = false;
83
-				if($success)
84
-					array_push($temp,$i);
83
+				if ($success)
84
+					array_push($temp, $i);
85 85
 			}
86 86
 			$this->tags["menu"] = $temp;
87 87
 		}
Please login to merge, or discard this patch.
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,9 +12,10 @@  discard block
 block discarded – undo
12 12
 					$pk_menu = $i["pk_menu"];
13 13
 					array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false));
14 14
 					$submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
15
-					if($submenu)
16
-					foreach ($submenu as $j)
15
+					if($submenu) {
16
+										foreach ($submenu as $j)
17 17
 						array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) );
18
+					}
18 19
 				}
19 20
 			}
20 21
 			$this->tags["menu"] = $temp;
@@ -28,12 +29,13 @@  discard block
 block discarded – undo
28 29
 			$relative		= $this->parameters["app"]->server["RELATIVE"];
29 30
 			foreach ($this->tags["menu"] as $i) {
30 31
 				$prePath = "";
31
-				if($i["relative"])
32
-					$prePath = $relative;
32
+				if($i["relative"]) {
33
+									$prePath = $relative;
34
+				}
33 35
 				$active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
34
-				if( is_array($i["submenu"]) && count($i["submenu"])<1)
35
-						$temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
36
-				else {
36
+				if( is_array($i["submenu"]) && count($i["submenu"])<1) {
37
+										$temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
38
+				} else {
37 39
 					$temp .= "<li class='dropdown $active'>";
38 40
 					$temp .=
39 41
 						'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
@@ -43,8 +45,9 @@  discard block
 block discarded – undo
43 45
 						'<ul class="dropdown-menu">';
44 46
 					foreach ($i["submenu"] as $j) {
45 47
 						$prePath = "";
46
-						if($j["relative"])
47
-							$prePath = $relative;
48
+						if($j["relative"]) {
49
+													$prePath = $relative;
50
+						}
48 51
 						$temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>";
49 52
 					}
50 53
 					$temp .= "</ul></li>";
@@ -54,16 +57,18 @@  discard block
 block discarded – undo
54 57
 		}
55 58
 		protected function isSubString( $_string, $_list) {
56 59
 			$success = false;
57
-			foreach ($_list as $i)
58
-				if(strpos($_string,$i) !== false)
60
+			foreach ($_list as $i) {
61
+							if(strpos($_string,$i) !== false)
59 62
 					$success = true;
63
+			}
60 64
 			return $success;
61 65
 		}
62 66
 		public function loginWithUser() {
63 67
 			$this->init();
64 68
 			$temp = [];
65
-			if(!isset($_SESSION["username"]))
66
-				$_SESSION["username"] ="guest";
69
+			if(!isset($_SESSION["username"])) {
70
+							$_SESSION["username"] ="guest";
71
+			}
67 72
 			$user = $_SESSION["username"];
68 73
 			$blackList = $this->queryFetch(
69 74
 				"SELECT user.*,user_section.*
@@ -77,11 +82,13 @@  discard block
 block discarded – undo
77 82
 			foreach ($this->tags["menu"] as $i) {
78 83
 				$success = true;
79 84
 				$k = $i["label"];
80
-				foreach ($blackList as $j)
81
-					if( $j["section"] == $k)
85
+				foreach ($blackList as $j) {
86
+									if( $j["section"] == $k)
82 87
 						$success = false;
83
-				if($success)
84
-					array_push($temp,$i);
88
+				}
89
+				if($success) {
90
+									array_push($temp,$i);
91
+				}
85 92
 			}
86 93
 			$this->tags["menu"] = $temp;
87 94
 		}
Please login to merge, or discard this patch.
dist/jate/modules/GUI/GUI.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 		public function __construct() {
5 5
 			parent::__construct();
6 6
 		}
7
-		public function init( $_page ) {
7
+		public function init($_page) {
8 8
 			$this->tags = $_page->tags;
9 9
 		}
10
-		public function draw( $_template ) {
10
+		public function draw($_template) {
11 11
 			$page = "";
12
-			$extension = explode(".",$_template);
13
-			$extension = $extension[count($extension)-1];
14
-			if($extension == "pug" || $extension == "jade") {
12
+			$extension = explode(".", $_template);
13
+			$extension = $extension[count($extension) - 1];
14
+			if ($extension == "pug" || $extension == "jade") {
15 15
 				$pug = new Pug\Pug();
16 16
 				$page = $pug->render($_template);
17 17
 			} else
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 			$render = $this->overlayTag($page);
20 20
 			echo minifyOutput($render);
21 21
 		}
22
-		protected function overlayTag( $_page ) {
23
-			foreach($this->tags as $key => $value)
24
-				if(!is_array($value))
22
+		protected function overlayTag($_page) {
23
+			foreach ($this->tags as $key => $value)
24
+				if (!is_array($value))
25 25
 					$_page = str_replace("<_${key}_>", "$value", $_page);
26 26
 			return $_page;
27 27
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,15 +14,17 @@
 block discarded – undo
14 14
 			if($extension == "pug" || $extension == "jade") {
15 15
 				$pug = new Pug\Pug();
16 16
 				$page = $pug->render($_template);
17
-			} else
18
-				$page = file_get_contents($_template);
17
+			} else {
18
+							$page = file_get_contents($_template);
19
+			}
19 20
 			$render = $this->overlayTag($page);
20 21
 			echo minifyOutput($render);
21 22
 		}
22 23
 		protected function overlayTag( $_page ) {
23
-			foreach($this->tags as $key => $value)
24
-				if(!is_array($value))
24
+			foreach($this->tags as $key => $value) {
25
+							if(!is_array($value))
25 26
 					$_page = str_replace("<_${key}_>", "$value", $_page);
27
+			}
26 28
 			return $_page;
27 29
 		}
28 30
 	}
Please login to merge, or discard this patch.