@@ -7,20 +7,20 @@ |
||
7 | 7 | parent::__construct(); |
8 | 8 | $args = func_get_args(); |
9 | 9 | $count = func_num_args(); |
10 | - if (method_exists($this,$func='__construct'.$count)) |
|
11 | - call_user_func_array(array($this,$func),$args); |
|
10 | + if (method_exists($this, $func = '__construct'.$count)) |
|
11 | + call_user_func_array(array($this, $func), $args); |
|
12 | 12 | } |
13 | 13 | public function __construct0() { |
14 | 14 | $this->connection = null; |
15 | 15 | $this->database = null; |
16 | 16 | } |
17 | - public function __construct4( $_srv, $_db, $_usr, $_pass) { |
|
17 | + public function __construct4($_srv, $_db, $_usr, $_pass) { |
|
18 | 18 | $this->connection = "mysql:host=$_srv;dbname=$_db"; |
19 | - $this->database = new PDO( $this->connection, $_usr, $_pass,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); |
|
19 | + $this->database = new PDO($this->connection, $_usr, $_pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); |
|
20 | 20 | $this->info = []; |
21 | - $this->info["server"] = $_srv; |
|
21 | + $this->info["server"] = $_srv; |
|
22 | 22 | $this->info["database"] = $_db; |
23 | - $this->info["user"] = $_usr; |
|
23 | + $this->info["user"] = $_usr; |
|
24 | 24 | $this->info["password"] = $_pass; |
25 | 25 | } |
26 | 26 | } |
@@ -7,8 +7,9 @@ |
||
7 | 7 | parent::__construct(); |
8 | 8 | $args = func_get_args(); |
9 | 9 | $count = func_num_args(); |
10 | - if (method_exists($this,$func='__construct'.$count)) |
|
11 | - call_user_func_array(array($this,$func),$args); |
|
10 | + if (method_exists($this,$func='__construct'.$count)) { |
|
11 | + call_user_func_array(array($this,$func),$args); |
|
12 | + } |
|
12 | 13 | } |
13 | 14 | public function __construct0() { |
14 | 15 | $this->connection = null; |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
25 | + if ($cont % $nPerCol == 1) |
|
26 | 26 | echo '<div class="row">'; |
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
27 | + if (isset($i["tag"])) { |
|
28 | + $percent = explode(".", $i["tag"]); |
|
29 | 29 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
30 | 30 | } |
31 | 31 | ?> |
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
35 | + <div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | 36 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 37 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 38 | <div class="progress"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
47 | + if ($cont % $nPerCol == 0) |
|
48 | 48 | echo '</div>'; |
49 | 49 | } ?> |
50 | 50 | </div> |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
26 | - echo '<div class="row">'; |
|
25 | + if($cont % $nPerCol == 1) { |
|
26 | + echo '<div class="row">'; |
|
27 | + } |
|
27 | 28 | if(isset($i["tag"])) { |
28 | 29 | $percent = explode(".",$i["tag"]); |
29 | 30 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | <div class="col-lg-<?=$dim?>"> |
33 | 34 | <div class="well well-sm miniblock"> |
34 | 35 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | + <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) { |
|
37 | + echo $i["tag"]?><br></div> |
|
36 | 38 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 39 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 40 | <div class="progress"> |
@@ -46,6 +48,7 @@ discard block |
||
46 | 48 | <?php |
47 | 49 | if($cont % $nPerCol == 0) |
48 | 50 | echo '</div>'; |
51 | +} |
|
49 | 52 | } ?> |
50 | 53 | </div> |
51 | 54 | </div> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(isset($GLOBALS["JATEPath"])) |
|
2 | + if (isset($GLOBALS["JATEPath"])) |
|
3 | 3 | $GLOBALS["JATEPath"] = []; |
4 | 4 | $commonLocations = array( |
5 | 5 | "bower_components/JATE/dist/", |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | "../../dist/" |
8 | 8 | ); |
9 | 9 | foreach ($commonLocations as $i) |
10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
10 | + if (file_exists($i."jate/coreEngine.php")) { |
|
11 | 11 | array_push($GLOBALS["JATEPath"], $i); |
12 | 12 | require_once($i."jate/coreEngine.php"); |
13 | 13 | break; |
@@ -1,14 +1,16 @@ |
||
1 | 1 | <?php |
2 | - if(isset($GLOBALS["JATEPath"])) |
|
3 | - $GLOBALS["JATEPath"] = []; |
|
2 | + if(isset($GLOBALS["JATEPath"])) { |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | + } |
|
4 | 5 | $commonLocations = array( |
5 | 6 | "bower_components/JATE/dist/", |
6 | 7 | "vendor/xaberr/jate/dist/", |
7 | 8 | "../../dist/" |
8 | 9 | ); |
9 | - foreach ($commonLocations as $i) |
|
10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
10 | + foreach ($commonLocations as $i) { |
|
11 | + if(file_exists($i."jate/coreEngine.php")) { |
|
11 | 12 | array_push($GLOBALS["JATEPath"], $i); |
13 | + } |
|
12 | 14 | require_once($i."jate/coreEngine.php"); |
13 | 15 | break; |
14 | 16 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
2 | + if (!isset($GLOBALS["JATEPath"])) |
|
3 | 3 | $GLOBALS["JATEPath"] = []; |
4 | 4 | $commonLocations = array( |
5 | 5 | "bower_components/JATE/dist/", |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | "../../dist/" |
8 | 8 | ); |
9 | 9 | foreach ($commonLocations as $i) |
10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
10 | + if (file_exists($i."jate/coreEngine.php")) { |
|
11 | 11 | array_push($GLOBALS["JATEPath"], $i); |
12 | 12 | require_once($i."jate/coreEngine.php"); |
13 | 13 | break; |
@@ -1,14 +1,16 @@ |
||
1 | 1 | <?php |
2 | - if(!isset($GLOBALS["JATEPath"])) |
|
3 | - $GLOBALS["JATEPath"] = []; |
|
2 | + if(!isset($GLOBALS["JATEPath"])) { |
|
3 | + $GLOBALS["JATEPath"] = []; |
|
4 | + } |
|
4 | 5 | $commonLocations = array( |
5 | 6 | "bower_components/JATE/dist/", |
6 | 7 | "vendor/xaberr/jate/dist/", |
7 | 8 | "../../dist/" |
8 | 9 | ); |
9 | - foreach ($commonLocations as $i) |
|
10 | - if(file_exists($i."jate/coreEngine.php")) { |
|
10 | + foreach ($commonLocations as $i) { |
|
11 | + if(file_exists($i."jate/coreEngine.php")) { |
|
11 | 12 | array_push($GLOBALS["JATEPath"], $i); |
13 | + } |
|
12 | 14 | require_once($i."jate/coreEngine.php"); |
13 | 15 | break; |
14 | 16 | } |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
25 | + if ($cont % $nPerCol == 1) |
|
26 | 26 | echo '<div class="row">'; |
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
27 | + if (isset($i["tag"])) { |
|
28 | + $percent = explode(".", $i["tag"]); |
|
29 | 29 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
30 | 30 | } |
31 | 31 | ?> |
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
35 | + <div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | 36 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 37 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 38 | <div class="progress"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
47 | + if ($cont % $nPerCol == 0) |
|
48 | 48 | echo '</div>'; |
49 | 49 | } ?> |
50 | 50 | </div> |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
26 | - echo '<div class="row">'; |
|
25 | + if($cont % $nPerCol == 1) { |
|
26 | + echo '<div class="row">'; |
|
27 | + } |
|
27 | 28 | if(isset($i["tag"])) { |
28 | 29 | $percent = explode(".",$i["tag"]); |
29 | 30 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | <div class="col-lg-<?=$dim?>"> |
33 | 34 | <div class="well well-sm miniblock"> |
34 | 35 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | + <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) { |
|
37 | + echo $i["tag"]?><br></div> |
|
36 | 38 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 39 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 40 | <div class="progress"> |
@@ -46,6 +48,7 @@ discard block |
||
46 | 48 | <?php |
47 | 49 | if($cont % $nPerCol == 0) |
48 | 50 | echo '</div>'; |
51 | +} |
|
49 | 52 | } ?> |
50 | 53 | </div> |
51 | 54 | </div> |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
25 | + if ($cont % $nPerCol == 1) |
|
26 | 26 | echo '<div class="row">'; |
27 | - if(isset($i["tag"])) { |
|
28 | - $percent = explode(".",$i["tag"]); |
|
27 | + if (isset($i["tag"])) { |
|
28 | + $percent = explode(".", $i["tag"]); |
|
29 | 29 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
30 | 30 | } |
31 | 31 | ?> |
32 | 32 | <div class="col-lg-<?=$dim?>"> |
33 | 33 | <div class="well well-sm miniblock"> |
34 | 34 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
35 | + <div class="tag"><b>Tag:</b> <?php if (isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | 36 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 37 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 38 | <div class="progress"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | </div> |
46 | 46 | <?php |
47 | - if($cont % $nPerCol == 0) |
|
47 | + if ($cont % $nPerCol == 0) |
|
48 | 48 | echo '</div>'; |
49 | 49 | } ?> |
50 | 50 | </div> |
@@ -22,8 +22,9 @@ discard block |
||
22 | 22 | $percent; |
23 | 23 | foreach (getGitLog() as $i) { |
24 | 24 | $cont++; |
25 | - if($cont % $nPerCol == 1) |
|
26 | - echo '<div class="row">'; |
|
25 | + if($cont % $nPerCol == 1) { |
|
26 | + echo '<div class="row">'; |
|
27 | + } |
|
27 | 28 | if(isset($i["tag"])) { |
28 | 29 | $percent = explode(".",$i["tag"]); |
29 | 30 | $percent = 100 * intval($percent[0]) + 10 * intval($percent[1]) + intval($percent[2]); |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | <div class="col-lg-<?=$dim?>"> |
33 | 34 | <div class="well well-sm miniblock"> |
34 | 35 | <div class="autor"><b>Autor:</b> <?=$i["author"]?><br></div> |
35 | - <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) echo $i["tag"]?><br></div> |
|
36 | + <div class="tag"><b>Tag:</b> <?php if(isset($i["tag"])) { |
|
37 | + echo $i["tag"]?><br></div> |
|
36 | 38 | <div class="date"><b>Date:</b> <?=$i["date"]?><br></div> |
37 | 39 | <div class="message"><b>Message:</b> <?=$i["message"]?><br></div> |
38 | 40 | <div class="progress"> |
@@ -46,6 +48,7 @@ discard block |
||
46 | 48 | <?php |
47 | 49 | if($cont % $nPerCol == 0) |
48 | 50 | echo '</div>'; |
51 | +} |
|
49 | 52 | } ?> |
50 | 53 | </div> |
51 | 54 | </div> |
@@ -7,6 +7,11 @@ |
||
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; |
@@ -7,42 +7,42 @@ |
||
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()); |
@@ -11,9 +11,10 @@ |
||
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"]; |
@@ -9,13 +9,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -13,9 +13,10 @@ discard block |
||
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->tags["menu"] = $temp; |
@@ -26,9 +27,9 @@ discard block |
||
26 | 27 | $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
27 | 28 | foreach ($this->tags["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 |
||
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 |
||
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 |
||
69 | 73 | foreach ($this->tags["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->tags["menu"] = $temp; |
79 | 85 | } |
@@ -5,41 +5,41 @@ |
||
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, $_type = "misc" ) { |
|
17 | + public function import($_path, $_type = "misc") { |
|
18 | 18 | $data = file_get_contents($_path); |
19 | 19 | $data = json_decode($data); |
20 | - if( $_type == "connection" ) |
|
20 | + if ($_type == "connection") |
|
21 | 21 | $this->overlayConnection($data); |
22 | 22 | else |
23 | 23 | $this->overlayMisc($data); |
24 | 24 | } |
25 | - protected function overlayConnection( $_data ) { |
|
25 | + protected function overlayConnection($_data) { |
|
26 | 26 | $this->connection = $this->obj2array($_data); |
27 | 27 | } |
28 | - protected function overlayMisc( $_data ) { |
|
28 | + protected function overlayMisc($_data) { |
|
29 | 29 | $this->importObject($_data); |
30 | 30 | } |
31 | - protected function obj2array ( &$_instance ) { |
|
32 | - $clone = (array) $_instance; |
|
31 | + protected function obj2array(&$_instance) { |
|
32 | + $clone = (array) $_instance; |
|
33 | 33 | $return = []; |
34 | 34 | $return['___SOURCE_KEYS_'] = $clone; |
35 | - while ( list ($key, $value) = each ($clone) ) { |
|
36 | - $temp = explode ("\0", $key); |
|
37 | - $newkey = $temp[count($temp)-1]; |
|
35 | + while (list ($key, $value) = each($clone)) { |
|
36 | + $temp = explode("\0", $key); |
|
37 | + $newkey = $temp[count($temp) - 1]; |
|
38 | 38 | $return[$newkey] = &$return['___SOURCE_KEYS_'][$key]; |
39 | 39 | } |
40 | 40 | return $return; |
41 | 41 | } |
42 | - protected function importObject( $_object ) { |
|
42 | + protected function importObject($_object) { |
|
43 | 43 | foreach (get_object_vars($_object) as $key => $value) |
44 | 44 | $this->$key = $value; |
45 | 45 | } |
@@ -17,10 +17,11 @@ discard block |
||
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 |
||
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 | ?> |