Completed
Push — master ( a25af9...a12ace )
by Federico
02:41
created
dist/jate/modules/Query/Query.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -7,6 +7,11 @@  discard block
 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;
@@ -23,6 +28,9 @@  discard block
 block discarded – undo
23 28
 			return $this->currentConnection->database->lastInsertId();
24 29
 		}
25 30
 
31
+		/**
32
+		 * @param string $_query
33
+		 */
26 34
 		public function queryFetch( $_query ) {
27 35
 			$temp = $this->stdQuery($_query);
28 36
 			return $temp->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,28 +7,28 @@  discard block
 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
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			$error = "Errore 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.
examples/01essential/pages/Template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
 		public function makeConnection() {
20 20
 			global $jConfig;
21 21
 			$connection = null;
22
-			if($jConfig->connection["enable"])
22
+			if ($jConfig->connection["enable"])
23 23
 				$connection = new Connection(
24 24
 						$jConfig->connection["server"]
25 25
 					, $jConfig->connection["database"]
26 26
 					, $jConfig->connection["user"]
27 27
 					, $jConfig->connection["password"]
28 28
 				);
29
-			$this->addConnection("base",$connection);
29
+			$this->addConnection("base", $connection);
30 30
 		}
31 31
 	}
32 32
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,14 @@
 block discarded – undo
19 19
 		public function makeConnection() {
20 20
 			global $jConfig;
21 21
 			$connection = null;
22
-			if($jConfig->connection["enable"])
23
-				$connection = new Connection(
22
+			if($jConfig->connection["enable"]) {
23
+							$connection = new Connection(
24 24
 						$jConfig->connection["server"]
25 25
 					, $jConfig->connection["database"]
26 26
 					, $jConfig->connection["user"]
27 27
 					, $jConfig->connection["password"]
28 28
 				);
29
+			}
29 30
 			$this->addConnection("base",$connection);
30 31
 		}
31 32
 	}
Please login to merge, or discard this patch.
examples/05database/pages/Template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@
 block discarded – undo
19 19
 		public function makeConnection() {
20 20
 			global $jConfig;
21 21
 			$connection = null;
22
-			if($jConfig->connection["enable"])
22
+			if ($jConfig->connection["enable"])
23 23
 				$connection = new Connection(
24 24
 						$jConfig->connection["server"]
25 25
 					, $jConfig->connection["database"]
26 26
 					, $jConfig->connection["user"]
27 27
 					, $jConfig->connection["password"]
28 28
 				);
29
-			$this->addConnection("base",$connection);
29
+			$this->addConnection("base", $connection);
30 30
 		}
31 31
 	}
32 32
 ?>
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,14 @@
 block discarded – undo
19 19
 		public function makeConnection() {
20 20
 			global $jConfig;
21 21
 			$connection = null;
22
-			if($jConfig->connection["enable"])
23
-				$connection = new Connection(
22
+			if($jConfig->connection["enable"]) {
23
+							$connection = new Connection(
24 24
 						$jConfig->connection["server"]
25 25
 					, $jConfig->connection["database"]
26 26
 					, $jConfig->connection["user"]
27 27
 					, $jConfig->connection["password"]
28 28
 				);
29
+			}
29 30
 			$this->addConnection("base",$connection);
30 31
 		}
31 32
 	}
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 		public $data;
7 7
 		public function __construct() {
8 8
 			$this->name			= get_class($this);
9
-			$this->modules	= [];
9
+			$this->modules = [];
10 10
 			$this->files		= [];
11 11
 			$this->data			= [];
12 12
 		}
@@ -14,32 +14,32 @@  discard block
 block discarded – undo
14 14
 		// abstract public function init();
15 15
 		// abstract public function draw();
16 16
 		public function getCss() {
17
-			return $this->getRequire("getCss",".css");
17
+			return $this->getRequire("getCss", ".css");
18 18
 		}
19 19
 		public function getJs() {
20
-			return $this->getRequire("getJs",".js");
20
+			return $this->getRequire("getJs", ".js");
21 21
 		}
22 22
 		public function getJsVariables() {
23 23
 			$temp = [];
24 24
 			foreach ($this->files as $i)
25 25
 				if (is_array($i))
26
-					array_push($temp,$i);
26
+					array_push($temp, $i);
27 27
 			foreach ($this->modules as $i)
28
-				$temp = array_merge( $temp, $i->getJsVariables() );
28
+				$temp = array_merge($temp, $i->getJsVariables());
29 29
 			return $temp;
30 30
 		}
31
-		public function addModules( $_mods ) {
31
+		public function addModules($_mods) {
32 32
 			foreach ($_mods as $value)
33 33
 				$this->addModule($value);
34 34
 		}
35
-		public function addModule( $_mod ) {
35
+		public function addModule($_mod) {
36 36
 			$this->modules[$_mod->name] = $_mod;
37 37
 		}
38
-		public function addFiles( $_files ) {
38
+		public function addFiles($_files) {
39 39
 			foreach ($_files as $value)
40 40
 				$this->addFile($value);
41 41
 		}
42
-		public function addFile( $_file ) {
42
+		public function addFile($_file) {
43 43
 			array_push($this->files, $_file);
44 44
 		}
45 45
 		protected function addDipendences() {
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 			$this->data["js"] = $this->getJs();
48 48
 			$this->data["jsVariables"] = $this->getJsVariables();
49 49
 		}
50
-		protected function getRequire( $_function, $_extenction) {
50
+		protected function getRequire($_function, $_extenction) {
51 51
 			$temp = [];
52 52
 			foreach ($this->files as $i)
53 53
 				if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
54
-					array_push($temp,$i);
54
+					array_push($temp, $i);
55 55
 			foreach ($this->modules as $i)
56
-				$temp = array_merge( $temp, $i->$_function() );
56
+				$temp = array_merge($temp, $i->$_function());
57 57
 			return $temp;
58 58
 		}
59 59
 	}
Please login to merge, or discard this 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->files as $i)
25
-				if (is_array($i))
24
+			foreach ($this->files as $i) {
25
+							if (is_array($i))
26 26
 					array_push($temp,$i);
27
-			foreach ($this->modules as $i)
28
-				$temp = array_merge( $temp, $i->getJsVariables() );
27
+			}
28
+			foreach ($this->modules as $i) {
29
+							$temp = array_merge( $temp, $i->getJsVariables() );
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->files as $i)
53
-				if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
56
+			foreach ($this->files as $i) {
57
+							if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
54 58
 					array_push($temp,$i);
55
-			foreach ($this->modules as $i)
56
-				$temp = array_merge( $temp, $i->$_function() );
59
+			}
60
+			foreach ($this->modules as $i) {
61
+							$temp = array_merge( $temp, $i->$_function() );
62
+			}
57 63
 			return $temp;
58 64
 		}
59 65
 	}
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@  discard block
 block discarded – undo
4 4
 			parent::__construct();
5 5
 		}
6 6
 		public function init() {
7
-			$menu = c_query("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`","Menu,getMenu,menu");
7
+			$menu = c_query("SELECT * FROM menu WHERE flag_active = 1 ORDER BY `order`", "Menu,getMenu,menu");
8 8
 			$temp = [];
9 9
 			foreach ($menu as $i) {
10 10
 				$submenu = [];
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" => []));
14
-					$submenu = c_query("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`","Menu,getMenu,submenu");
15
-					if($submenu)
14
+					$submenu = c_query("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`", "Menu,getMenu,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"], []) );
17
+						array_push($temp[count($temp) - 1]["submenu"], array("label" => $j["label"], "link" => $j["link"], []));
18 18
 				}
19 19
 			}
20 20
 			$this->data["menu"] = $temp;
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 			$temp = "";
25 25
 			$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
26 26
 			foreach ($this->data["menu"] as $i) {
27
-				if( is_array($i["submenu"]) && count($i["submenu"])<1) {
27
+				if (is_array($i["submenu"]) && count($i["submenu"]) < 1) {
28 28
 					$temp .= '<li><a href="'.$i["link"].'">'.$i["label"].'</a></li>';
29 29
 				} else {
30
-					if($this->isSubString($actual_link,array_merge(array_column($i["submenu"], 'link'), array($i["link"]))))
30
+					if ($this->isSubString($actual_link, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))))
31 31
 						$temp .= '<li class="dropdown active">';
32 32
 					else
33 33
 						$temp .= '<li class="dropdown">';
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 			}
45 45
 			return $temp;
46 46
 		}
47
-		protected function isSubString( $_string, $_list) {
47
+		protected function isSubString($_string, $_list) {
48 48
 			$success = false;
49 49
 			foreach ($_list as $i)
50
-				if(strpos($_string,$i) !== false)
50
+				if (strpos($_string, $i) !== false)
51 51
 					$success = true;
52 52
 			return $success;
53 53
 		}
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 			$this->init();
56 56
 			$temp = [];
57 57
 			$user = "";
58
-			if(!isset($_SESSION["username"]))
59
-				$_SESSION["username"] ="guest";
58
+			if (!isset($_SESSION["username"]))
59
+				$_SESSION["username"] = "guest";
60 60
 			$user = $_SESSION["username"];
61 61
 			$blackList = c_query(
62 62
 				"SELECT user.*,user_section.*
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 				$success = true;
72 72
 				$k = $i["label"];
73 73
 				foreach ($blackList as $j)
74
-					if( $j["section"] == $k)
74
+					if ($j["section"] == $k)
75 75
 						$success = false;
76
-				if($success)
77
-					array_push($temp,$i);
76
+				if ($success)
77
+					array_push($temp, $i);
78 78
 			}
79 79
 			$this->data["menu"] = $temp;
80 80
 		}
Please login to merge, or discard this patch.
dist/jate/functions/array.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@
 block discarded – undo
1 1
 <?php
2 2
 	function utf8ize($_array) {
3
-		return travelStringArray($_array,"utf8_encode");
3
+		return travelStringArray($_array, "utf8_encode");
4 4
 	}
5 5
 	function unutf8ize($_array) {
6
-		return travelStringArray($_array,"utf8_decode");
6
+		return travelStringArray($_array, "utf8_decode");
7 7
 	}
8 8
 	function arraySlash($_array) {
9
-		return travelStringArray($_array,"addslashes");
9
+		return travelStringArray($_array, "addslashes");
10 10
 	}
11 11
 	function arrayHtmlParser($_array) {
12
-		return travelStringArray($_array,"htmlParser");
12
+		return travelStringArray($_array, "htmlParser");
13 13
 	}
14
-	function travelStringArray ( $_array, $_function ) {
14
+	function travelStringArray($_array, $_function) {
15 15
 		if (is_array($_array)) {
16 16
 			foreach ($_array as $k => $v) {
17 17
 				$_array[$k] = travelStringArray($v, $_function);
18 18
 			}
19
-		} else if (is_string ($_array)) {
20
-			return call_user_func($_function,$_array);
19
+		} else if (is_string($_array)) {
20
+			return call_user_func($_function, $_array);
21 21
 		}
22 22
 		return $_array;
23 23
 	}
24
-	function arrayDepth( $_array ) {
24
+	function arrayDepth($_array) {
25 25
 		$maxDepth = 1;
26 26
 		foreach ($_array as $value) {
27 27
 			if (is_array($value)) {
Please login to merge, or discard this patch.
dist/jate/functions/folder.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2
-	function subFolder( $_dir = "./" ) {
3
-		$temp = fetchInSubFolder($_dir, function( $_file ) {
2
+	function subFolder($_dir = "./") {
3
+		$temp = fetchInSubFolder($_dir, function($_file) {
4 4
 			return true;
5 5
 		});
6 6
 		return $temp;
7 7
 	}
8
-	function subFolderFile( $_dir = "./" ) {
9
-		$temp = fetchInSubFolder($_dir, function( $_file ) {
8
+	function subFolderFile($_dir = "./") {
9
+		$temp = fetchInSubFolder($_dir, function($_file) {
10 10
 			return !is_dir($_file);
11 11
 		});
12 12
 		return $temp;
13 13
 	}
14
-	function subFolderDir( $_dir = "./" ) {
15
-		$temp = fetchInSubFolder($_dir, function( $_file ) {
14
+	function subFolderDir($_dir = "./") {
15
+		$temp = fetchInSubFolder($_dir, function($_file) {
16 16
 			return !is_file($_file);
17 17
 		});
18 18
 		return $temp;
19 19
 	}
20
-	function fetchInSubFolder( $_dir = "./", $_function) {
20
+	function fetchInSubFolder($_dir = "./", $_function) {
21 21
 		$temp = [];
22 22
 		if (is_dir($_dir)) {
23 23
 				if ($dirOpened = opendir($_dir)) {
24 24
 						while (($file = readdir($dirOpened)) !== false)
25
-								if( ($file !='.')&&($file !='..') )
26
-									if($_function($file))
27
-										array_push($temp,$file);
25
+								if (($file != '.') && ($file != '..'))
26
+									if ($_function($file))
27
+										array_push($temp, $file);
28 28
 						closedir($dirOpened);
29 29
 				}
30 30
 		}
31 31
 		return $temp;
32 32
 	}
33
-	function requireSubfolder( $_dir = "./" ) {
33
+	function requireSubfolder($_dir = "./") {
34 34
 		$temp = subFolderFile($_dir);
35 35
 		foreach ($temp as $i)
36 36
 			jRequire($_dir."/".$i);
37 37
 	}
38
-	function require_js( $_dir = "./" ) {
38
+	function require_js($_dir = "./") {
39 39
 		$tempArray = [];
40 40
 		$temp = subFolderFile($_dir);
41 41
 		foreach ($temp as $i)
Please login to merge, or discard this patch.