@@ -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> |
@@ -7,51 +7,51 @@ discard block |
||
7 | 7 | public $data; |
8 | 8 | public function __construct() { |
9 | 9 | $this->name = get_class($this); |
10 | - $this->modules = []; |
|
10 | + $this->modules = []; |
|
11 | 11 | $this->files = []; |
12 | - $this->required = []; |
|
12 | + $this->required = []; |
|
13 | 13 | $this->data = []; |
14 | 14 | } |
15 | 15 | // abstract public function config(); |
16 | 16 | // abstract public function init(); |
17 | 17 | // abstract public function draw(); |
18 | 18 | public function getCss() { |
19 | - return $this->getRequire("getCss",".css"); |
|
19 | + return $this->getRequire("getCss", ".css"); |
|
20 | 20 | } |
21 | 21 | public function getJs() { |
22 | - return $this->getRequire("getJs",".js"); |
|
22 | + return $this->getRequire("getJs", ".js"); |
|
23 | 23 | } |
24 | 24 | public function getJsVariables() { |
25 | 25 | $temp = []; |
26 | 26 | foreach ($this->required as $i) |
27 | 27 | if (is_array($i)) |
28 | - array_push($temp,$i); |
|
28 | + array_push($temp, $i); |
|
29 | 29 | foreach ($this->modules as $i) |
30 | - $temp = array_merge( $temp, $i->getJsVariables() ); |
|
30 | + $temp = array_merge($temp, $i->getJsVariables()); |
|
31 | 31 | foreach ($this->files as $i) |
32 | 32 | if (is_array($i)) |
33 | - array_push($temp,$i); |
|
33 | + array_push($temp, $i); |
|
34 | 34 | return $temp; |
35 | 35 | } |
36 | - public function addModules( $_mods ) { |
|
36 | + public function addModules($_mods) { |
|
37 | 37 | foreach ($_mods as $value) |
38 | 38 | $this->addModule($value); |
39 | 39 | } |
40 | - public function addModule( $_mod ) { |
|
40 | + public function addModule($_mod) { |
|
41 | 41 | $this->modules[$_mod->name] = $_mod; |
42 | 42 | } |
43 | - public function addFiles( $_files ) { |
|
43 | + public function addFiles($_files) { |
|
44 | 44 | foreach ($_files as $value) |
45 | 45 | $this->addFile($value); |
46 | 46 | } |
47 | - public function addFile( $_file ) { |
|
47 | + public function addFile($_file) { |
|
48 | 48 | array_push($this->files, $_file); |
49 | 49 | } |
50 | - public function addFilesRequired( $_files ) { |
|
50 | + public function addFilesRequired($_files) { |
|
51 | 51 | foreach ($_files as $value) |
52 | 52 | $this->addFileRequired($value); |
53 | 53 | } |
54 | - public function addFileRequired( $_file ) { |
|
54 | + public function addFileRequired($_file) { |
|
55 | 55 | array_push($this->required, $_file); |
56 | 56 | } |
57 | 57 | protected function addDipendences() { |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | $this->data["js"] = $this->getJs(); |
60 | 60 | $this->data["jsVariables"] = $this->getJsVariables(); |
61 | 61 | } |
62 | - protected function getRequire( $_function, $_extenction) { |
|
62 | + protected function getRequire($_function, $_extenction) { |
|
63 | 63 | $temp = []; |
64 | 64 | foreach ($this->required as $i) |
65 | 65 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
66 | - array_push($temp,$i); |
|
66 | + array_push($temp, $i); |
|
67 | 67 | foreach ($this->modules as $i) |
68 | - $temp = array_merge( $temp, $i->$_function() ); |
|
68 | + $temp = array_merge($temp, $i->$_function()); |
|
69 | 69 | foreach ($this->files as $i) |
70 | 70 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
71 | - array_push($temp,$i); |
|
71 | + array_push($temp, $i); |
|
72 | 72 | return $temp; |
73 | 73 | } |
74 | 74 | } |
@@ -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 | } |
@@ -1,45 +1,45 @@ |
||
1 | 1 | <?php |
2 | - function requireComponent( $_path, $_local = true ) { |
|
2 | + function requireComponent($_path, $_local = true) { |
|
3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
4 | - if(file_exists($path) && isPhp($path)) |
|
4 | + if (file_exists($path) && isPhp($path)) |
|
5 | 5 | jRequire($path, false, 0); |
6 | 6 | else |
7 | 7 | requireError($_path); |
8 | 8 | } |
9 | - function requireComponents( $_path, $_local = true ) { |
|
9 | + function requireComponents($_path, $_local = true) { |
|
10 | 10 | $path = getJFolder($_path, $_local, debug_backtrace()); |
11 | - if(file_exists($path)) { |
|
11 | + if (file_exists($path)) { |
|
12 | 12 | $files = subFolderFile($path); |
13 | 13 | foreach ($files as $i) { |
14 | - if(isPhp($path."/".$i)) |
|
14 | + if (isPhp($path."/".$i)) |
|
15 | 15 | requireComponent($path."/".$i, false, 0); |
16 | 16 | } |
17 | 17 | } else |
18 | 18 | requireError($_path); |
19 | 19 | } |
20 | - function requireError( $_path ) { |
|
20 | + function requireError($_path) { |
|
21 | 21 | global $jConfig; |
22 | - if( $jConfig->DEBUG == 1 ) |
|
22 | + if ($jConfig->DEBUG == 1) |
|
23 | 23 | echo "Error load ($_path)<br>"; |
24 | 24 | } |
25 | - function isPhp ( $_file ) { |
|
26 | - if(!is_file($_file)) return false; |
|
25 | + function isPhp($_file) { |
|
26 | + if (!is_file($_file)) return false; |
|
27 | 27 | $info = pathinfo($_file); |
28 | 28 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
29 | 29 | } |
30 | - function requireModules( $_path, $_local = true ) { |
|
30 | + function requireModules($_path, $_local = true) { |
|
31 | 31 | $path = getJFolder($_path, $_local, debug_backtrace()); |
32 | 32 | $subFolders = subFolderDir($path); |
33 | 33 | foreach ($subFolders as $i) { |
34 | 34 | requireComponents($path."/".$i, false, 0); |
35 | 35 | } |
36 | 36 | } |
37 | - function jRequire( $_path, $_local = true ) { |
|
37 | + function jRequire($_path, $_local = true) { |
|
38 | 38 | $path = getJFolder($_path, $_local, debug_backtrace()); |
39 | - require_once( $path ); |
|
39 | + require_once($path); |
|
40 | 40 | } |
41 | - function getJFolder( $_path, $_local, $_stack ) { |
|
42 | - if($_local) { |
|
41 | + function getJFolder($_path, $_local, $_stack) { |
|
42 | + if ($_local) { |
|
43 | 43 | $stackInfo = $_stack; |
44 | 44 | $folder = dirname($stackInfo[0]["file"]); |
45 | 45 | $file = "$folder/$_path"; |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php |
2 | - function subFolder( $_dir = "./" ) { |
|
2 | + function subFolder($_dir = "./") { |
|
3 | 3 | $temp = fetchInSubFolder($_dir, function() { |
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) |
@@ -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()); |
@@ -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 | } |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | - function getGitLog( $_dir = "./" ) { |
|
3 | - if(!file_exists($_dir)) |
|
2 | + function getGitLog($_dir = "./") { |
|
3 | + if (!file_exists($_dir)) |
|
4 | 4 | return []; |
5 | 5 | $currentDir = getcwd(); |
6 | 6 | chdir($_dir); |
7 | 7 | $gitHistory = []; |
8 | 8 | $gitLogs = []; |
9 | 9 | $gitPath = str_replace('\\', '/', exec("git rev-parse --show-toplevel")); |
10 | - $rootPath = str_replace('\\', '/', getcwd ()); |
|
10 | + $rootPath = str_replace('\\', '/', getcwd()); |
|
11 | 11 | $lastHash = null; |
12 | - if( $gitPath != $rootPath ) { |
|
12 | + if ($gitPath != $rootPath) { |
|
13 | 13 | chdir($currentDir); |
14 | 14 | return []; |
15 | 15 | } |
@@ -3,17 +3,17 @@ |
||
3 | 3 | public function __construct() { |
4 | 4 | parent::__construct(); |
5 | 5 | } |
6 | - public function init( $_page ) { |
|
6 | + public function init($_page) { |
|
7 | 7 | $this->tags = $_page->tags; |
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->tags as $key => $value) |
|
16 | - if(!is_array($value)) |
|
14 | + protected function overlayTag($_page) { |
|
15 | + foreach ($this->tags as $key => $value) |
|
16 | + if (!is_array($value)) |
|
17 | 17 | $_page = str_replace("<_${key}_>", "$value", $_page); |
18 | 18 | return $_page; |
19 | 19 | } |