@@ -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 require_subfolder( $_dir = "./" ) { |
| 34 | 35 | $temp = subFolder_file($_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 = subFolder_file($_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,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) |
@@ -13,9 +13,9 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | function minify_output($_buffer) { |
| 16 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
| 17 | - $replace = array ( '>', '<', '\\1' ); |
|
| 18 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 16 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
| 17 | + $replace = array('>', '<', '\\1'); |
|
| 18 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
| 19 | 19 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
| 20 | 20 | return utf8_encode($_buffer); |
| 21 | 21 | } |
@@ -15,8 +15,9 @@ |
||
| 15 | 15 | function minify_output($_buffer) { |
| 16 | 16 | $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
| 17 | 17 | $replace = array ( '>', '<', '\\1' ); |
| 18 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 19 | - $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 18 | + if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) { |
|
| 19 | + $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
|
| 20 | + } |
|
| 20 | 21 | return utf8_encode($_buffer); |
| 21 | 22 | } |
| 22 | 23 | ?> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - function htmlParser( $_str) { |
|
| 2 | + function htmlParser($_str) { |
|
| 3 | 3 | return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
| 4 | 4 | } |
| 5 | 5 | ?> |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class Statistic extends Module { |
| 3 | - public function __construct( $_webApp ) { |
|
| 3 | + public function __construct($_webApp) { |
|
| 4 | 4 | parent::__construct(); |
| 5 | 5 | $pages = []; |
| 6 | 6 | $stats = []; |
| 7 | 7 | $pages = $_webApp->pages; |
| 8 | - foreach ( $pages as $k => $v ) { |
|
| 8 | + foreach ($pages as $k => $v) { |
|
| 9 | 9 | $temp = new $v[0]($v[1]); |
| 10 | 10 | $temp->addDipendences(); |
| 11 | 11 | $stats[$k] = []; |
| 12 | 12 | $stats[$k]["page"] = $v[0]; |
| 13 | 13 | $stats[$k]["css"] = $temp->data["css"]; |
| 14 | - $stats[$k]["js"] = $temp->data["js"]; |
|
| 14 | + $stats[$k]["js"] = $temp->data["js"]; |
|
| 15 | 15 | } |
| 16 | 16 | $this->data = $stats; |
| 17 | 17 | } |
@@ -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 | } |
@@ -23,33 +23,39 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | public function getJsVariables() { |
| 25 | 25 | $temp = []; |
| 26 | - foreach ($this->required as $i) |
|
| 27 | - if (is_array($i)) |
|
| 26 | + foreach ($this->required as $i) { |
|
| 27 | + if (is_array($i)) |
|
| 28 | 28 | array_push($temp,$i); |
| 29 | - foreach ($this->modules as $i) |
|
| 30 | - $temp = array_merge( $temp, $i->getJsVariables() ); |
|
| 31 | - foreach ($this->files as $i) |
|
| 32 | - if (is_array($i)) |
|
| 29 | + } |
|
| 30 | + foreach ($this->modules as $i) { |
|
| 31 | + $temp = array_merge( $temp, $i->getJsVariables() ); |
|
| 32 | + } |
|
| 33 | + foreach ($this->files as $i) { |
|
| 34 | + if (is_array($i)) |
|
| 33 | 35 | array_push($temp,$i); |
| 36 | + } |
|
| 34 | 37 | return $temp; |
| 35 | 38 | } |
| 36 | 39 | public function addModules( $_mods ) { |
| 37 | - foreach ($_mods as $value) |
|
| 38 | - $this->addModule($value); |
|
| 40 | + foreach ($_mods as $value) { |
|
| 41 | + $this->addModule($value); |
|
| 42 | + } |
|
| 39 | 43 | } |
| 40 | 44 | public function addModule( $_mod ) { |
| 41 | 45 | $this->modules[$_mod->name] = $_mod; |
| 42 | 46 | } |
| 43 | 47 | public function addFiles( $_files ) { |
| 44 | - foreach ($_files as $value) |
|
| 45 | - $this->addFile($value); |
|
| 48 | + foreach ($_files as $value) { |
|
| 49 | + $this->addFile($value); |
|
| 50 | + } |
|
| 46 | 51 | } |
| 47 | 52 | public function addFile( $_file ) { |
| 48 | 53 | array_push($this->files, $_file); |
| 49 | 54 | } |
| 50 | 55 | public function addFilesRequired( $_files ) { |
| 51 | - foreach ($_files as $value) |
|
| 52 | - $this->addFileRequired($value); |
|
| 56 | + foreach ($_files as $value) { |
|
| 57 | + $this->addFileRequired($value); |
|
| 58 | + } |
|
| 53 | 59 | } |
| 54 | 60 | public function addFileRequired( $_file ) { |
| 55 | 61 | array_push($this->required, $_file); |
@@ -61,14 +67,17 @@ discard block |
||
| 61 | 67 | } |
| 62 | 68 | protected function getRequire( $_function, $_extenction) { |
| 63 | 69 | $temp = []; |
| 64 | - foreach ($this->required as $i) |
|
| 65 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
| 70 | + foreach ($this->required as $i) { |
|
| 71 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
| 66 | 72 | array_push($temp,$i); |
| 67 | - foreach ($this->modules as $i) |
|
| 68 | - $temp = array_merge( $temp, $i->$_function() ); |
|
| 69 | - foreach ($this->files as $i) |
|
| 70 | - if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
| 73 | + } |
|
| 74 | + foreach ($this->modules as $i) { |
|
| 75 | + $temp = array_merge( $temp, $i->$_function() ); |
|
| 76 | + } |
|
| 77 | + foreach ($this->files as $i) { |
|
| 78 | + if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
|
| 71 | 79 | array_push($temp,$i); |
| 80 | + } |
|
| 72 | 81 | return $temp; |
| 73 | 82 | } |
| 74 | 83 | } |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | public $parameters; |
| 11 | 11 | public function __construct() { |
| 12 | 12 | $this->name = get_class($this); |
| 13 | - $this->modules = []; |
|
| 13 | + $this->modules = []; |
|
| 14 | 14 | $this->files = []; |
| 15 | - $this->required = []; |
|
| 15 | + $this->required = []; |
|
| 16 | 16 | $this->data = []; |
| 17 | 17 | $this->tags = []; |
| 18 | 18 | $this->connection = null; |
@@ -22,43 +22,43 @@ discard block |
||
| 22 | 22 | // abstract public function init(); |
| 23 | 23 | // abstract public function draw(); |
| 24 | 24 | public function getCss() { |
| 25 | - return $this->getRequire("getCss",".css"); |
|
| 25 | + return $this->getRequire("getCss", ".css"); |
|
| 26 | 26 | } |
| 27 | 27 | public function getJs() { |
| 28 | - return $this->getRequire("getJs",".js"); |
|
| 28 | + return $this->getRequire("getJs", ".js"); |
|
| 29 | 29 | } |
| 30 | 30 | public function getJsVariables() { |
| 31 | 31 | $temp = []; |
| 32 | 32 | foreach ($this->required as $i) |
| 33 | 33 | if (is_array($i)) |
| 34 | - array_push($temp,$i); |
|
| 34 | + array_push($temp, $i); |
|
| 35 | 35 | foreach ($this->modules as $i) |
| 36 | - $temp = array_merge( $temp, $i->getJsVariables() ); |
|
| 36 | + $temp = array_merge($temp, $i->getJsVariables()); |
|
| 37 | 37 | foreach ($this->files as $i) |
| 38 | 38 | if (is_array($i)) |
| 39 | - array_push($temp,$i); |
|
| 39 | + array_push($temp, $i); |
|
| 40 | 40 | return $temp; |
| 41 | 41 | } |
| 42 | - public function addModules( $_mods ) { |
|
| 42 | + public function addModules($_mods) { |
|
| 43 | 43 | foreach ($_mods as $value) |
| 44 | 44 | $this->addModule($value); |
| 45 | 45 | } |
| 46 | - public function addModule( $_mod ) { |
|
| 46 | + public function addModule($_mod) { |
|
| 47 | 47 | $this->modules[$_mod->name] = $_mod; |
| 48 | 48 | $this->modules[$_mod->name]->parameters = &$this->parameters; |
| 49 | 49 | } |
| 50 | - public function addFiles( $_files ) { |
|
| 50 | + public function addFiles($_files) { |
|
| 51 | 51 | foreach ($_files as $value) |
| 52 | 52 | $this->addFile($value); |
| 53 | 53 | } |
| 54 | - public function addFile( $_file ) { |
|
| 54 | + public function addFile($_file) { |
|
| 55 | 55 | array_push($this->files, $_file); |
| 56 | 56 | } |
| 57 | - public function addFilesRequired( $_files ) { |
|
| 57 | + public function addFilesRequired($_files) { |
|
| 58 | 58 | foreach ($_files as $value) |
| 59 | 59 | $this->addFileRequired($value); |
| 60 | 60 | } |
| 61 | - public function addFileRequired( $_file ) { |
|
| 61 | + public function addFileRequired($_file) { |
|
| 62 | 62 | array_push($this->required, $_file); |
| 63 | 63 | } |
| 64 | 64 | protected function addDipendences() { |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | $this->tags["js"] = $this->getJs(); |
| 67 | 67 | $this->tags["jsVariables"] = $this->getJsVariables(); |
| 68 | 68 | } |
| 69 | - protected function getRequire( $_function, $_extenction) { |
|
| 69 | + protected function getRequire($_function, $_extenction) { |
|
| 70 | 70 | $temp = []; |
| 71 | 71 | foreach ($this->required as $i) |
| 72 | 72 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
| 73 | - array_push($temp,$i); |
|
| 73 | + array_push($temp, $i); |
|
| 74 | 74 | foreach ($this->modules as $i) |
| 75 | - $temp = array_merge( $temp, $i->$_function() ); |
|
| 75 | + $temp = array_merge($temp, $i->$_function()); |
|
| 76 | 76 | foreach ($this->files as $i) |
| 77 | 77 | if (!is_array($i) && strpos($i, $_extenction) !== FALSE) |
| 78 | - array_push($temp,$i); |
|
| 78 | + array_push($temp, $i); |
|
| 79 | 79 | return $temp; |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -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"]; |