@@ -5,11 +5,11 @@ discard block |
||
| 5 | 5 | return ob_start(); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - function jBlockClose( $_type = "html", $_parameters = [] ) { |
|
| 8 | + function jBlockClose($_type = "html", $_parameters = []) { |
|
| 9 | 9 | return jBlockEnd($_type, $_parameters); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | - function jBlockFile( $_path, $_parameters = [] ) { |
|
| 12 | + function jBlockFile($_path, $_parameters = []) { |
|
| 13 | 13 | try { |
| 14 | 14 | $temp = Parser::parseFile($_path, $_parameters); |
| 15 | 15 | } catch (Exception $e) { |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | return $temp; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - function jBlockFileMan( $_path, $_type, $_parameters = [] ) { |
|
| 21 | + function jBlockFileMan($_path, $_type, $_parameters = []) { |
|
| 22 | 22 | try { |
| 23 | 23 | $temp = Parser::parseFileMan($_path, $_parameters, $_type); |
| 24 | 24 | } catch (Exception $e) { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $temp; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - function jBlockEnd( $_type = "html", $_parameters = [] ) { |
|
| 30 | + function jBlockEnd($_type = "html", $_parameters = []) { |
|
| 31 | 31 | $text = ob_get_clean(); |
| 32 | 32 | try { |
| 33 | 33 | $temp = Parser::parseText($text, $_parameters, $_type); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | function minifyOutput($_buffer) { |
| 41 | - $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' ); |
|
| 42 | - $replace = array ( '>', '<', '\\1' ); |
|
| 43 | - if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1) |
|
| 41 | + $search = array('/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); |
|
| 42 | + $replace = array('>', '<', '\\1'); |
|
| 43 | + if (preg_match("/\<html/i", $_buffer) == 1 && preg_match("/\<\/html\>/i", $_buffer) == 1) |
|
| 44 | 44 | $_buffer = preg_replace($search, $replace, utf8_decode($_buffer)); |
| 45 | 45 | return utf8_encode($_buffer); |
| 46 | 46 | } |
@@ -1,27 +1,27 @@ discard block |
||
| 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)) { |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | return $maxDepth; |
| 35 | 35 | } |
| 36 | - function arrayDump( $_array, $_name = "Array", $_tab = " " ) { |
|
| 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 | 39 | foreach ($_array as $k => $i) |
| 40 | - if(is_array($i)) |
|
| 41 | - arrayDump( $i, $k, " $_tab" ); |
|
| 42 | - else if(is_object($i)) |
|
| 40 | + if (is_array($i)) |
|
| 41 | + arrayDump($i, $k, " $_tab"); |
|
| 42 | + else if (is_object($i)) |
|
| 43 | 43 | echo "$_tab<b>object:</b> [Object]<br>"; |
| 44 | 44 | else |
| 45 | 45 | echo "$_tab<b>$k:</b> $i<br>"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - function htmlParser( $_str) { |
|
| 48 | + function htmlParser($_str) { |
|
| 49 | 49 | return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8"); |
| 50 | 50 | } |
| 51 | 51 | ?> |
@@ -4,11 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | //JATE SUFF |
| 6 | 6 | require_once (end($GLOBALS["JATEPath"])."jate/functions/requirer.php"); |
| 7 | - requireComponent ("modules/JException/JException.php"); |
|
| 8 | - requireComponent ("functions/folder.php"); |
|
| 9 | - requireComponent ("modules/JConfig/JConfig.php"); |
|
| 7 | + requireComponent("modules/JException/JException.php"); |
|
| 8 | + requireComponent("functions/folder.php"); |
|
| 9 | + requireComponent("modules/JConfig/JConfig.php"); |
|
| 10 | 10 | requireComponents("functions"); |
| 11 | - requireModules ("modules"); |
|
| 11 | + requireModules("modules"); |
|
| 12 | 12 | |
| 13 | 13 | //USER STUFF |
| 14 | 14 | requireModulesList("config/loader.json"); |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | class Connection { |
| 4 | 4 | public $database; |
| 5 | 5 | public $info; |
| 6 | - public function __construct( $_object ) { |
|
| 7 | - if(!is_object($_object)) |
|
| 6 | + public function __construct($_object) { |
|
| 7 | + if (!is_object($_object)) |
|
| 8 | 8 | throw new InvalidArgumentException("Parameter must be an object."); |
| 9 | 9 | $this->setConnection( |
| 10 | 10 | $_object->server, |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $this->getConnectionType($_object->engine) |
| 15 | 15 | ); |
| 16 | 16 | } |
| 17 | - protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) { |
|
| 17 | + protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) { |
|
| 18 | 18 | switch ($_type) { |
| 19 | 19 | case "mysqli": |
| 20 | 20 | $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass); |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | break; |
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - protected function getConnectionType( $_type ) { |
|
| 35 | - $array = (array)$_type; |
|
| 34 | + protected function getConnectionType($_type) { |
|
| 35 | + $array = (array) $_type; |
|
| 36 | 36 | foreach ($array as $key => $value) |
| 37 | - if($value) |
|
| 37 | + if ($value) |
|
| 38 | 38 | return $key; |
| 39 | 39 | return "pdo"; |
| 40 | 40 | } |
@@ -2,35 +2,35 @@ |
||
| 2 | 2 | jRequire("ConnectionInterface.php"); |
| 3 | 3 | class PdoAdapter implements ConnectionAdapterInterface { |
| 4 | 4 | public $connection; |
| 5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
| 5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
| 6 | 6 | try { |
| 7 | 7 | $connection = "mysql:host=$_srv;dbname=$_db"; |
| 8 | - $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] ); |
|
| 9 | - } catch( Exception $e ) { |
|
| 8 | + $this->connection = new PDO($connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]); |
|
| 9 | + } catch (Exception $e) { |
|
| 10 | 10 | throw new JException($e->getMessage()); |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | - public function query( $_query ) { |
|
| 13 | + public function query($_query) { |
|
| 14 | 14 | $this->stdQuery($_query); |
| 15 | 15 | return true; |
| 16 | 16 | } |
| 17 | - public function queryInsert( $_query ) { |
|
| 17 | + public function queryInsert($_query) { |
|
| 18 | 18 | $this->stdQuery($_query); |
| 19 | 19 | return $this->connection->lastInsertId(); |
| 20 | 20 | } |
| 21 | - public function queryFetch( $_query ) { |
|
| 21 | + public function queryFetch($_query) { |
|
| 22 | 22 | $temp = $this->stdQuery($_query); |
| 23 | 23 | return $temp->fetchAll(PDO::FETCH_ASSOC); |
| 24 | 24 | } |
| 25 | - public function queryArray( $_query ) { |
|
| 25 | + public function queryArray($_query) { |
|
| 26 | 26 | $temp = $this->stdQuery($_query); |
| 27 | 27 | return $temp->fetchAll(PDO::FETCH_COLUMN, 0); |
| 28 | 28 | } |
| 29 | - protected function stdQuery( $_query ) { |
|
| 29 | + protected function stdQuery($_query) { |
|
| 30 | 30 | $database = $this->connection; |
| 31 | 31 | $query = $database->prepare($_query); |
| 32 | 32 | $result = $query->execute(); |
| 33 | - if(!$result) |
|
| 33 | + if (!$result) |
|
| 34 | 34 | throw new JException(json_encode([ |
| 35 | 35 | "query" => $_query, |
| 36 | 36 | "error" => [ |
@@ -2,39 +2,39 @@ |
||
| 2 | 2 | jRequire("ConnectionInterface.php"); |
| 3 | 3 | class MysqliAdapter implements ConnectionAdapterInterface { |
| 4 | 4 | public $connection; |
| 5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
| 5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
| 6 | 6 | try { |
| 7 | - $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db ); |
|
| 8 | - } catch( Exception $e ) { |
|
| 7 | + $this->connection = new mysqli($_srv, $_usr, $_pass, $_db); |
|
| 8 | + } catch (Exception $e) { |
|
| 9 | 9 | throw new JException($e->getMessage()); |
| 10 | 10 | } |
| 11 | 11 | } |
| 12 | - public function query( $_query ) { |
|
| 12 | + public function query($_query) { |
|
| 13 | 13 | $this->stdQuery($_query); |
| 14 | 14 | return true; |
| 15 | 15 | } |
| 16 | - public function queryInsert( $_query ) { |
|
| 16 | + public function queryInsert($_query) { |
|
| 17 | 17 | $this->stdQuery($_query); |
| 18 | 18 | return $this->connection->insert_id; |
| 19 | 19 | } |
| 20 | - public function queryFetch( $_query ) { |
|
| 20 | + public function queryFetch($_query) { |
|
| 21 | 21 | $result = $this->stdQuery($_query); |
| 22 | 22 | $rows = []; |
| 23 | - while($row = $result->fetch_assoc()) |
|
| 23 | + while ($row = $result->fetch_assoc()) |
|
| 24 | 24 | $rows[] = $row; |
| 25 | 25 | return $rows; |
| 26 | 26 | } |
| 27 | - public function queryArray( $_query ) { |
|
| 27 | + public function queryArray($_query) { |
|
| 28 | 28 | $result = $this->stdQuery($_query); |
| 29 | 29 | $rows = []; |
| 30 | - while($row = $result->fetch_array()) |
|
| 30 | + while ($row = $result->fetch_array()) |
|
| 31 | 31 | $rows[] = $row; |
| 32 | 32 | return $rows; |
| 33 | 33 | } |
| 34 | - protected function stdQuery( $_query ) { |
|
| 34 | + protected function stdQuery($_query) { |
|
| 35 | 35 | $database = $this->connection; |
| 36 | 36 | $result = $database->query($_query); |
| 37 | - if(!$result) |
|
| 37 | + if (!$result) |
|
| 38 | 38 | throw new JException(json_encode([ |
| 39 | 39 | "query" => $_query, |
| 40 | 40 | "error" => $database->error |
@@ -2,42 +2,42 @@ |
||
| 2 | 2 | jRequire("ConnectionInterface.php"); |
| 3 | 3 | class PostgresqlAdapter implements ConnectionAdapterInterface { |
| 4 | 4 | public $connection; |
| 5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
| 5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
| 6 | 6 | try { |
| 7 | 7 | $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass") |
| 8 | 8 | or die('Could not connect: '.pg_last_error()); |
| 9 | - } catch( Exception $e ) { |
|
| 9 | + } catch (Exception $e) { |
|
| 10 | 10 | throw new JException($e->getMessage()); |
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | - public function query( $_query ) { |
|
| 13 | + public function query($_query) { |
|
| 14 | 14 | $this->stdQuery($_query); |
| 15 | 15 | return true; |
| 16 | 16 | } |
| 17 | - public function queryInsert( $_query ) { |
|
| 17 | + public function queryInsert($_query) { |
|
| 18 | 18 | $this->stdQuery($_query); |
| 19 | 19 | return $this->stdQuery("SELECT lastval()"); |
| 20 | 20 | } |
| 21 | - public function queryFetch( $_query ) { |
|
| 21 | + public function queryFetch($_query) { |
|
| 22 | 22 | $result = $this->stdQuery($_query); |
| 23 | 23 | $rows = []; |
| 24 | - while($row = pg_fetch_assoc($result)) |
|
| 24 | + while ($row = pg_fetch_assoc($result)) |
|
| 25 | 25 | $rows[] = $row; |
| 26 | 26 | pg_free_result($result); |
| 27 | 27 | return $rows; |
| 28 | 28 | } |
| 29 | - public function queryArray( $_query ) { |
|
| 29 | + public function queryArray($_query) { |
|
| 30 | 30 | $result = $this->stdQuery($_query); |
| 31 | 31 | $rows = []; |
| 32 | - while($row = pg_fetch_array($result)) |
|
| 32 | + while ($row = pg_fetch_array($result)) |
|
| 33 | 33 | $rows[] = $row; |
| 34 | 34 | pg_free_result($result); |
| 35 | 35 | return $rows; |
| 36 | 36 | } |
| 37 | - protected function stdQuery( $_query ) { |
|
| 37 | + protected function stdQuery($_query) { |
|
| 38 | 38 | $database = $this->connection; |
| 39 | 39 | $result = pg_query($database, $_query); |
| 40 | - if(!$result) |
|
| 40 | + if (!$result) |
|
| 41 | 41 | throw new JException(json_encode([ |
| 42 | 42 | "query" => $_query, |
| 43 | 43 | "error" => pg_last_error() |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | jRequire("PdoAdapter.php"); |
| 3 | 3 | class PdoMemoryAdapter extends PdoAdapter { |
| 4 | 4 | public $connection; |
| 5 | - public function __construct( $_srv, $_db, $_usr, $_pass ) { |
|
| 5 | + public function __construct($_srv, $_db, $_usr, $_pass) { |
|
| 6 | 6 | try { |
| 7 | 7 | $this->connection = new PDO("sqlite::memory:"); |
| 8 | - } catch( Exception $e ) { |
|
| 8 | + } catch (Exception $e) { |
|
| 9 | 9 | throw new JException($e->getMessage()); |
| 10 | 10 | } |
| 11 | 11 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | use Pug as Pug; |
| 3 | 3 | jRequire("ParserAbstract.php"); |
| 4 | 4 | class PugAdapter extends ParserAbstract { |
| 5 | - public function draw( $_text, $_parameters = [] ) { |
|
| 5 | + public function draw($_text, $_parameters = []) { |
|
| 6 | 6 | $pug = new Pug\Pug(); |
| 7 | 7 | $page = $pug->render($_text, $_parameters); |
| 8 | 8 | return $page; |