Completed
Push — master ( 7f2391...b0dbdc )
by Federico
03:14
created
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.
examples/05database/bundles/models/Template.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	class Template extends Html {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5 5
 			$this->makeConnection();
6 6
 			$this->tags["brand"]		= "JATE";
7 7
 			$this->tags["brandImg"] = "";
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 				, "https://code.jquery.com/jquery-1.11.3.min.js"
13 13
 				, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
14 14
 			]);
15
-			$this->tags["metaDescription"]	= "Beautiful description .";
16
-			$this->tags["metaKeywords"]			= "JATE,PHP,JS,CSS";
17
-			$this->tags["metaAuthor"]				= "XaBerr";
18
-			$this->tags["menu"]							= $this->makeMenu();
15
+			$this->tags["metaDescription"] = "Beautiful description .";
16
+			$this->tags["metaKeywords"] = "JATE,PHP,JS,CSS";
17
+			$this->tags["metaAuthor"] = "XaBerr";
18
+			$this->tags["menu"] = $this->makeMenu();
19 19
 		}
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
23
+			if ($jConfig != null && $jConfig->connection["enable"])
24 24
 				$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
-			$this->addConnection("base",$connection);
30
+			$this->addConnection("base", $connection);
31 31
 		}
32 32
 		public function makeMenu() {
33 33
 			jBlock();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,14 @@
 block discarded – undo
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
24
-				$connection = new Connection(
23
+			if( $jConfig != null && $jConfig->connection["enable"]) {
24
+							$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
+			}
30 31
 			$this->addConnection("base",$connection);
31 32
 		}
32 33
 		public function makeMenu() {
Please login to merge, or discard this patch.
examples/01essential/bundles/models/Template.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	class Template extends Html {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5 5
 			$this->makeConnection();
6 6
 			$this->tags["brand"]		= "JATE";
7 7
 			$this->tags["brandImg"] = "";
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 				, "https://code.jquery.com/jquery-1.11.3.min.js"
13 13
 				, "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"
14 14
 			]);
15
-			$this->tags["metaDescription"]	= "Beautiful description .";
16
-			$this->tags["metaKeywords"]			= "JATE,PHP,JS,CSS";
17
-			$this->tags["metaAuthor"]				= "XaBerr";
18
-			$this->tags["menu"]							= $this->makeMenu();
15
+			$this->tags["metaDescription"] = "Beautiful description .";
16
+			$this->tags["metaKeywords"] = "JATE,PHP,JS,CSS";
17
+			$this->tags["metaAuthor"] = "XaBerr";
18
+			$this->tags["menu"] = $this->makeMenu();
19 19
 		}
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
23
+			if ($jConfig != null && $jConfig->connection["enable"])
24 24
 				$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
-			$this->addConnection("base",$connection);
30
+			$this->addConnection("base", $connection);
31 31
 		}
32 32
 		public function makeMenu() {
33 33
 			jBlock();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,13 +20,14 @@
 block discarded – undo
20 20
 		public function makeConnection() {
21 21
 			$jConfig = $this->parameters["app"];
22 22
 			$connection = null;
23
-			if( $jConfig != null && $jConfig->connection["enable"])
24
-				$connection = new Connection(
23
+			if( $jConfig != null && $jConfig->connection["enable"]) {
24
+							$connection = new Connection(
25 25
 						$jConfig->connection["server"]
26 26
 					, $jConfig->connection["database"]
27 27
 					, $jConfig->connection["user"]
28 28
 					, $jConfig->connection["password"]
29 29
 				);
30
+			}
30 31
 			$this->addConnection("base",$connection);
31 32
 		}
32 33
 		public function makeMenu() {
Please login to merge, or discard this patch.
examples/01essential/bundles/controllers/Home.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Home extends Template {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
5
-			$this->tags["title"]		= "JATE - Home";
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5
+			$this->tags["title"] = "JATE - Home";
6 6
 			$this->tags["content"] = $this->makePage();
7 7
 		}
8 8
 		public function makePage() {
Please login to merge, or discard this patch.
examples/01essential/bundles/controllers/Page01.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Page01 extends Template {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
5
-			$this->tags["title"]		= "JATE - Page01";
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5
+			$this->tags["title"] = "JATE - Page01";
6 6
 			$this->tags["content"] = $this->makePage();
7 7
 		}
8 8
 		public function makePage() {
Please login to merge, or discard this patch.
examples/01essential/bundles/controllers/Page404.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Page404 extends Template {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
5
-			$this->tags["title"]		= "JATE - 404";
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5
+			$this->tags["title"] = "JATE - 404";
6 6
 			$this->tags["content"] = $this->makePage();
7 7
 		}
8 8
 		public function makePage() {
Please login to merge, or discard this patch.
examples/03pageParameters/bundles/controllers/Page404.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 	class Page404 extends Template {
3
-		public function __construct( $_parameters ) {
4
-			parent::__construct( $_parameters );
5
-			$this->tags["title"]		= "JATE - 404";
3
+		public function __construct($_parameters) {
4
+			parent::__construct($_parameters);
5
+			$this->tags["title"] = "JATE - 404";
6 6
 			$this->tags["content"] = $this->makePage();
7 7
 		}
8 8
 		public function makePage() {
Please login to merge, or discard this patch.