Completed
Push — master ( 7f2391...b0dbdc )
by Federico
03:14
created
dist/jate/modules/WebApp/WebApp.php 1 patch
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.
dist/jate/modules/Menu/Menu.php 1 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 1 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 1 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.