@@ -11,6 +11,10 @@ |
||
| 11 | 11 | function arrayHtmlParser($_array) { |
| 12 | 12 | return travelStringArray($_array,"htmlParser"); |
| 13 | 13 | } |
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * @param string $_function |
|
| 17 | + */ |
|
| 14 | 18 | function travelStringArray ( $_array, $_function ) { |
| 15 | 19 | if (is_array($_array)) { |
| 16 | 20 | foreach ($_array as $k => $v) { |
@@ -36,10 +36,12 @@ |
||
| 36 | 36 | function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
| 37 | 37 | $position = preg_replace('/ /', '', $_tab, 1); |
| 38 | 38 | echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>"; |
| 39 | - foreach ($_array as $k => $i) |
|
| 40 | - if(is_array($i)) |
|
| 39 | + foreach ($_array as $k => $i) { |
|
| 40 | + if(is_array($i)) |
|
| 41 | 41 | arrayDump( $i, $k, " $_tab" ); |
| 42 | - else |
|
| 43 | - echo "$_tab<b>$k:</b> $i<br>"; |
|
| 42 | + } |
|
| 43 | + else { |
|
| 44 | + echo "$_tab<b>$k:</b> $i<br>"; |
|
| 45 | + } |
|
| 44 | 46 | } |
| 45 | 47 | ?> |
@@ -17,6 +17,10 @@ |
||
| 17 | 17 | }); |
| 18 | 18 | return $temp; |
| 19 | 19 | } |
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @param Closure $_function |
|
| 23 | + */ |
|
| 20 | 24 | function fetchInSubFolder( $_dir = "./", $_function) { |
| 21 | 25 | $temp = []; |
| 22 | 26 | if (is_dir($_dir)) { |
@@ -21,10 +21,11 @@ discard block |
||
| 21 | 21 | $temp = []; |
| 22 | 22 | if (is_dir($_dir)) { |
| 23 | 23 | if ($dirOpened = opendir($_dir)) { |
| 24 | - while (($file = readdir($dirOpened)) !== false) |
|
| 25 | - if( ($file !='.')&&($file !='..') ) |
|
| 24 | + while (($file = readdir($dirOpened)) !== false) { |
|
| 25 | + if( ($file !='.')&&($file !='..') ) |
|
| 26 | 26 | if($_function($file)) |
| 27 | 27 | array_push($temp,$file); |
| 28 | + } |
|
| 28 | 29 | closedir($dirOpened); |
| 29 | 30 | } |
| 30 | 31 | } |
@@ -32,14 +33,16 @@ discard block |
||
| 32 | 33 | } |
| 33 | 34 | function requireSubfolder( $_dir = "./" ) { |
| 34 | 35 | $temp = subFolderFile($_dir); |
| 35 | - foreach ($temp as $i) |
|
| 36 | - jRequire($_dir."/".$i); |
|
| 36 | + foreach ($temp as $i) { |
|
| 37 | + jRequire($_dir."/".$i); |
|
| 38 | + } |
|
| 37 | 39 | } |
| 38 | 40 | function require_js( $_dir = "./" ) { |
| 39 | 41 | $tempArray = []; |
| 40 | 42 | $temp = subFolderFile($_dir); |
| 41 | - foreach ($temp as $i) |
|
| 42 | - array_push($tempArray, $_dir."/".$i); |
|
| 43 | + foreach ($temp as $i) { |
|
| 44 | + array_push($tempArray, $_dir."/".$i); |
|
| 45 | + } |
|
| 43 | 46 | return $tempArray; |
| 44 | 47 | } |
| 45 | 48 | ?> |
@@ -1,4 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | + /** |
|
| 3 | + * @param string $_path |
|
| 4 | + */ |
|
| 2 | 5 | function requireComponent( $_path, $_local = true ) { |
| 3 | 6 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 4 | 7 | if(file_exists($path) && isPhp($path)) |
@@ -6,6 +9,10 @@ discard block |
||
| 6 | 9 | else |
| 7 | 10 | requireError($_path); |
| 8 | 11 | } |
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param string $_path |
|
| 15 | + */ |
|
| 9 | 16 | function requireComponents( $_path, $_local = true ) { |
| 10 | 17 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 11 | 18 | if(file_exists($path)) { |
@@ -38,6 +45,10 @@ discard block |
||
| 38 | 45 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 39 | 46 | require_once( $path ); |
| 40 | 47 | } |
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @param boolean $_local |
|
| 51 | + */ |
|
| 41 | 52 | function getJFolder( $_path, $_local, $_stack ) { |
| 42 | 53 | if($_local) { |
| 43 | 54 | $stackInfo = $_stack; |
@@ -1,29 +1,35 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function requireComponent( $_path, $_local = true ) { |
| 3 | 3 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 4 | - if(file_exists($path) && isPhp($path)) |
|
| 5 | - jRequire($path, false, 0); |
|
| 6 | - else |
|
| 7 | - requireError($_path); |
|
| 4 | + if(file_exists($path) && isPhp($path)) { |
|
| 5 | + jRequire($path, false, 0); |
|
| 6 | + } else { |
|
| 7 | + requireError($_path); |
|
| 8 | + } |
|
| 8 | 9 | } |
| 9 | 10 | function requireComponents( $_path, $_local = true ) { |
| 10 | 11 | $path = getJFolder($_path, $_local, debug_backtrace()); |
| 11 | 12 | if(file_exists($path)) { |
| 12 | 13 | $files = subFolderFile($path); |
| 13 | 14 | foreach ($files as $i) { |
| 14 | - if(isPhp($path."/".$i)) |
|
| 15 | - requireComponent($path."/".$i, false, 0); |
|
| 15 | + if(isPhp($path."/".$i)) { |
|
| 16 | + requireComponent($path."/".$i, false, 0); |
|
| 17 | + } |
|
| 16 | 18 | } |
| 17 | - } else |
|
| 18 | - requireError($_path); |
|
| 19 | + } else { |
|
| 20 | + requireError($_path); |
|
| 21 | + } |
|
| 19 | 22 | } |
| 20 | 23 | function requireError( $_path ) { |
| 21 | 24 | global $DEBUG; |
| 22 | - if( $DEBUG == 1 ) |
|
| 23 | - echo "Error load ($_path)<br>"; |
|
| 25 | + if( $DEBUG == 1 ) { |
|
| 26 | + echo "Error load ($_path)<br>"; |
|
| 27 | + } |
|
| 24 | 28 | } |
| 25 | 29 | function isPhp ( $_file ) { |
| 26 | - if(!is_file($_file)) return false; |
|
| 30 | + if(!is_file($_file)) { |
|
| 31 | + return false; |
|
| 32 | + } |
|
| 27 | 33 | $info = pathinfo($_file); |
| 28 | 34 | return ($info["extension"] == "php") || ($info["extension"] == "PHP"); |
| 29 | 35 | } |
@@ -43,8 +49,9 @@ discard block |
||
| 43 | 49 | $stackInfo = $_stack; |
| 44 | 50 | $folder = dirname($stackInfo[0]["file"]); |
| 45 | 51 | $file = "$folder/$_path"; |
| 46 | - } else |
|
| 47 | - $file = $_path; |
|
| 52 | + } else { |
|
| 53 | + $file = $_path; |
|
| 54 | + } |
|
| 48 | 55 | return $file; |
| 49 | 56 | } |
| 50 | 57 | ?> |
@@ -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"]; |
@@ -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 | ?> |
@@ -1,7 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | function getGitLog( $_dir = "./" ) { |
| 3 | - if(!file_exists($_dir)) |
|
| 4 | - return []; |
|
| 3 | + if(!file_exists($_dir)) { |
|
| 4 | + return []; |
|
| 5 | + } |
|
| 5 | 6 | $currentDir = getcwd(); |
| 6 | 7 | chdir($_dir); |
| 7 | 8 | $gitHistory = []; |
@@ -35,19 +36,17 @@ discard block |
||
| 35 | 36 | $tag = trim($tag[0]); |
| 36 | 37 | $gitHistory[$lastHash]['tag'] = $tag; |
| 37 | 38 | } |
| 38 | - } |
|
| 39 | - else if (strpos($line, 'Author') === 0) { |
|
| 39 | + } else if (strpos($line, 'Author') === 0) { |
|
| 40 | 40 | $author = explode(':', $line); |
| 41 | 41 | $author = trim(end($author)); |
| 42 | 42 | $gitHistory[$lastHash]['author'] = $author; |
| 43 | - } |
|
| 44 | - else if (strpos($line, 'Date') === 0) { |
|
| 43 | + } else if (strpos($line, 'Date') === 0) { |
|
| 45 | 44 | $date = explode(':', $line, 2); |
| 46 | 45 | $date = trim(end($date)); |
| 47 | 46 | $gitHistory[$lastHash]['date'] = date('d/m/Y H:i:s A', strtotime($date)); |
| 47 | + } else { |
|
| 48 | + $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
| 48 | 49 | } |
| 49 | - else |
|
| 50 | - $gitHistory[$lastHash]['message'] .= "$line<br>"; |
|
| 51 | 50 | } |
| 52 | 51 | } |
| 53 | 52 | chdir($currentDir); |
@@ -12,9 +12,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -9,6 +9,10 @@ |
||
| 9 | 9 | public function drawFile( $_template ) { |
| 10 | 10 | return $this->draw($_template); |
| 11 | 11 | } |
| 12 | + |
|
| 13 | + /** |
|
| 14 | + * @param string $_template |
|
| 15 | + */ |
|
| 12 | 16 | public function drawText( $_template ) { |
| 13 | 17 | return $this->draw(trim($_template)); |
| 14 | 18 | } |
@@ -16,6 +16,9 @@ |
||
| 16 | 16 | return jBlockFileMan($_path, $extension, $_parameters); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $_type |
|
| 21 | + */ |
|
| 19 | 22 | function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
| 20 | 23 | $temp = file_get_contents($_path); |
| 21 | 24 | return jBlockParsing($_type, $temp, $_parameters); |
@@ -51,8 +51,9 @@ |
||
| 51 | 51 | function minifyOutput($_buffer) { |
| 52 | 52 | $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
| 53 | 53 | $replace = array ( '>', '<', '\\1' ); |
| 54 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 55 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 54 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) { |
|
| 55 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 56 | + } |
|
| 56 | 57 | return utf8_encode($_buffer); |
| 57 | 58 | } |
| 58 | 59 | ?> |