Passed
Push — master ( 998a95...21763d )
by Federico
02:41
created
dist/jate/modules/Query/Query.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -7,6 +7,11 @@
 block discarded – undo
7 7
 			$this->connection = [];
8 8
 			$this->currentConnection = null;
9 9
 		}
10
+
11
+		/**
12
+		 * @param string $_name
13
+		 * @param Connection|null $_connection
14
+		 */
10 15
 		public function addConnection( $_name, $_connection ) {
11 16
 			$this->connection["$_name"] = $_connection;
12 17
 			$this->currentConnection = $_connection;
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@
 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
-		public function setConnection( $_name ) {
14
+		public function setConnection($_name) {
15 15
 			$this->currentConnection = $this->connection["$_name"];
16 16
 		}
17
-		public function query( $_query ) {
17
+		public function query($_query) {
18 18
 			$this->stdQuery($_query);
19 19
 			return true;
20 20
 		}
21
-		public function queryInsert( $_query ) {
21
+		public function queryInsert($_query) {
22 22
 			$temp = $this->stdQuery($_query);
23 23
 			return $this->currentConnection->database->lastInsertId();
24 24
 		}
25 25
 
26
-		public function queryFetch( $_query ) {
26
+		public function queryFetch($_query) {
27 27
 			$temp = $this->stdQuery($_query);
28 28
 			return $temp->fetchAll(PDO::FETCH_ASSOC);
29 29
 		}
30 30
 
31
-		public function queryArray( $_query ) {
31
+		public function queryArray($_query) {
32 32
 			$temp = $this->stdQuery($_query);
33 33
 			return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
34 34
 		}
35 35
 
36
-		protected function stdQuery( $_query ) {
36
+		protected function stdQuery($_query) {
37 37
 			$database = $this->currentConnection->database;
38 38
 			$error = "Error query [$_query]";
39 39
 			$query = $database->prepare($_query);
40 40
 			$_result = $query->execute();
41
-			if(!$_result) {
41
+			if (!$_result) {
42 42
 				echo "$_query<br>";
43 43
 				echo "Something wrong: $error";
44 44
 				var_dump($query->errorInfo());
Please login to merge, or discard this patch.
dist/jate/modules/JConfig/JConfig.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,27 +5,27 @@
 block discarded – undo
5 5
 		public $DEBUG;
6 6
 		public $pages;
7 7
 		public function __construct() {
8
-			$this->connection["enable"]		= false;
9
-			$this->connection["user"]			= "";
8
+			$this->connection["enable"] = false;
9
+			$this->connection["user"] = "";
10 10
 			$this->connection["password"] = "";
11 11
 			$this->connection["database"] = "";
12
-			$this->connection["server"]		= "";
13
-			$this->all		= "";
12
+			$this->connection["server"] = "";
13
+			$this->all = "";
14 14
 			$this->DEBUG	= 0;
15 15
 			$this->pages	= [];
16 16
 		}
17
-		public function import( $_path ) {
17
+		public function import($_path) {
18 18
 			$data = file_get_contents($_path);
19 19
 			$data = json_decode($data);
20 20
 			$this->overlay($data);
21 21
 		}
22
-		protected function overlay( $_data ) {
23
-			$this->connection["enable"]		= $_data->connection->enable;
24
-			$this->connection["user"]			= $_data->connection->user;
22
+		protected function overlay($_data) {
23
+			$this->connection["enable"] = $_data->connection->enable;
24
+			$this->connection["user"] = $_data->connection->user;
25 25
 			$this->connection["password"] = $_data->connection->password;
26 26
 			$this->connection["database"] = $_data->connection->database;
27
-			$this->connection["server"]		= $_data->connection->server;
28
-			$this->all		= $_data->all;
27
+			$this->connection["server"] = $_data->connection->server;
28
+			$this->all = $_data->all;
29 29
 			$this->DEBUG	= $_data->DEBUG;
30 30
 			$this->pages	= $_data->pages;
31 31
 		}
Please login to merge, or discard this patch.
dist/jate/modules/GUI/GUI.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@
 block discarded – undo
3 3
 		public function __construct() {
4 4
 			parent::__construct();
5 5
 		}
6
-		public function init( $_page ) {
6
+		public function init($_page) {
7 7
 			$this->data = $_page->data;
8 8
 		}
9
-		public function draw( $_template ) {
9
+		public function draw($_template) {
10 10
 			$page = file_get_contents($_template);
11 11
 			$render = $this->overlayTag($page);
12 12
 			echo minifyOutput($render);
13 13
 		}
14
-		protected function overlayTag( $_page ) {
15
-			foreach($this->data as $key => $value)
16
-				if(!is_array($value))
14
+		protected function overlayTag($_page) {
15
+			foreach ($this->data as $key => $value)
16
+				if (!is_array($value))
17 17
 					$_page = str_replace("<_${key}_>", "$value", $_page);
18 18
 			return $_page;
19 19
 		}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,10 @@
 block discarded – undo
12 12
 			echo minifyOutput($render);
13 13
 		}
14 14
 		protected function overlayTag( $_page ) {
15
-			foreach($this->data as $key => $value)
16
-				if(!is_array($value))
15
+			foreach($this->data as $key => $value) {
16
+							if(!is_array($value))
17 17
 					$_page = str_replace("<_${key}_>", "$value", $_page);
18
+			}
18 19
 			return $_page;
19 20
 		}
20 21
 	}
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
 			$temp = [];
10 10
 			foreach ($menu as $i) {
11 11
 				$submenu = [];
12
-				if($i["fk_menu"] == 0) {
12
+				if ($i["fk_menu"] == 0) {
13 13
 					$pk_menu = $i["pk_menu"];
14 14
 					array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => []));
15 15
 					$submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
16
-					if($submenu)
16
+					if ($submenu)
17 17
 					foreach ($submenu as $j)
18
-						array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []) );
18
+						array_push($temp[count($temp) - 1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []));
19 19
 				}
20 20
 			}
21 21
 			$this->data["menu"] = $temp;
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 			$temp = "";
26 26
 			$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
27 27
 			foreach ($this->data["menu"] as $i) {
28
-				$active = $this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"])))? "active" : "";
29
-				if( is_array($i["submenu"]) && count($i["submenu"])<1)
28
+				$active = $this->isSubString($actual_link, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
29
+				if (is_array($i["submenu"]) && count($i["submenu"]) < 1)
30 30
 						$temp .= "<li class='$active'><a href='".$i["link"]."'>".$i["label"]."</a></li>";
31 31
 				else {
32 32
 					$temp .= "<li class='dropdown $active'>";
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 			}
44 44
 			return $temp;
45 45
 		}
46
-		protected function isSubString( $_string, $_list) {
46
+		protected function isSubString($_string, $_list) {
47 47
 			$success = false;
48 48
 			foreach ($_list as $i)
49
-				if(strpos($_string,$i) !== false)
49
+				if (strpos($_string, $i) !== false)
50 50
 					$success = true;
51 51
 			return $success;
52 52
 		}
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 			$this->init();
55 55
 			$temp = [];
56 56
 			$user = "";
57
-			if(!isset($_SESSION["username"]))
58
-				$_SESSION["username"] ="guest";
57
+			if (!isset($_SESSION["username"]))
58
+				$_SESSION["username"] = "guest";
59 59
 			$user = $_SESSION["username"];
60 60
 			$blackList = $this->queryFetch(
61 61
 				"SELECT user.*,user_section.*
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 				$success = true;
71 71
 				$k = $i["label"];
72 72
 				foreach ($blackList as $j)
73
-					if( $j["section"] == $k)
73
+					if ($j["section"] == $k)
74 74
 						$success = false;
75
-				if($success)
76
-					array_push($temp,$i);
75
+				if ($success)
76
+					array_push($temp, $i);
77 77
 			}
78 78
 			$this->data["menu"] = $temp;
79 79
 		}
Please login to merge, or discard this patch.
Braces   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,9 +13,10 @@  discard block
 block discarded – undo
13 13
 					$pk_menu = $i["pk_menu"];
14 14
 					array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => []));
15 15
 					$submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
16
-					if($submenu)
17
-					foreach ($submenu as $j)
16
+					if($submenu) {
17
+										foreach ($submenu as $j)
18 18
 						array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []) );
19
+					}
19 20
 				}
20 21
 			}
21 22
 			$this->data["menu"] = $temp;
@@ -26,9 +27,9 @@  discard block
 block discarded – undo
26 27
 			$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
27 28
 			foreach ($this->data["menu"] as $i) {
28 29
 				$active = $this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"])))? "active" : "";
29
-				if( is_array($i["submenu"]) && count($i["submenu"])<1)
30
-						$temp .= "<li class='$active'><a href='".$i["link"]."'>".$i["label"]."</a></li>";
31
-				else {
30
+				if( is_array($i["submenu"]) && count($i["submenu"])<1) {
31
+										$temp .= "<li class='$active'><a href='".$i["link"]."'>".$i["label"]."</a></li>";
32
+				} else {
32 33
 					$temp .= "<li class='dropdown $active'>";
33 34
 					$temp .=
34 35
 						'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
@@ -36,8 +37,9 @@  discard block
 block discarded – undo
36 37
 						'<span class="caret"></span>'.
37 38
 						'</a>'.
38 39
 						'<ul class="dropdown-menu">';
39
-					foreach ($i["submenu"] as $j)
40
-						$temp .= '<li><a href="'.$j["link"].'">'.$j["label"].'</a></li>';
40
+					foreach ($i["submenu"] as $j) {
41
+											$temp .= '<li><a href="'.$j["link"].'">'.$j["label"].'</a></li>';
42
+					}
41 43
 					$temp .= '</ul></li>';
42 44
 				}
43 45
 			}
@@ -45,17 +47,19 @@  discard block
 block discarded – undo
45 47
 		}
46 48
 		protected function isSubString( $_string, $_list) {
47 49
 			$success = false;
48
-			foreach ($_list as $i)
49
-				if(strpos($_string,$i) !== false)
50
+			foreach ($_list as $i) {
51
+							if(strpos($_string,$i) !== false)
50 52
 					$success = true;
53
+			}
51 54
 			return $success;
52 55
 		}
53 56
 		public function loginWithUser() {
54 57
 			$this->init();
55 58
 			$temp = [];
56 59
 			$user = "";
57
-			if(!isset($_SESSION["username"]))
58
-				$_SESSION["username"] ="guest";
60
+			if(!isset($_SESSION["username"])) {
61
+							$_SESSION["username"] ="guest";
62
+			}
59 63
 			$user = $_SESSION["username"];
60 64
 			$blackList = $this->queryFetch(
61 65
 				"SELECT user.*,user_section.*
@@ -69,11 +73,13 @@  discard block
 block discarded – undo
69 73
 			foreach ($this->data["menu"] as $i) {
70 74
 				$success = true;
71 75
 				$k = $i["label"];
72
-				foreach ($blackList as $j)
73
-					if( $j["section"] == $k)
76
+				foreach ($blackList as $j) {
77
+									if( $j["section"] == $k)
74 78
 						$success = false;
75
-				if($success)
76
-					array_push($temp,$i);
79
+				}
80
+				if($success) {
81
+									array_push($temp,$i);
82
+				}
77 83
 			}
78 84
 			$this->data["menu"] = $temp;
79 85
 		}
Please login to merge, or discard this patch.