Refactor code formatting and improve readability in gdb.min.php and grid.php; update cache sizes in ftp-kr.sync.cache.json

This commit is contained in:
2024-11-10 21:08:30 +01:00
parent 4acdddcabf
commit 35f6ff9bbb
3 changed files with 30 additions and 37 deletions

View File

@@ -47,20 +47,20 @@
"layout": {
"style.css": {
"type": "-",
"size": 14963,
"lmtime": 1731233991810,
"size": 15759,
"lmtime": 1731246911854,
"modified": false
},
"style.css.map": {
"type": "-",
"size": 26778,
"lmtime": 1731233991810,
"size": 28396,
"lmtime": 1731246911854,
"modified": false
},
"style.scss": {
"type": "-",
"size": 18665,
"lmtime": 1731233991666,
"size": 19740,
"lmtime": 1731246911704,
"modified": false
}
},
@@ -82,8 +82,8 @@
},
"main-view.php": {
"type": "-",
"size": 14418,
"lmtime": 1731233950425,
"size": 14294,
"lmtime": 1731246739957,
"modified": false
},
"operation-edit.php": {

View File

@@ -3,7 +3,7 @@
* Medoo database framework
* http://medoo.in
* Version 0.9.7
*
*
* Copyright 2014, Angel Lai
* Released under the MIT license
*/
@@ -33,7 +33,7 @@ class gdb
protected $option = array();
// Variable
// Variable
protected $logs = array();
public function __construct($options = null)
@@ -131,7 +131,7 @@ class gdb
}
$this->pdo = new PDO(
$dsn,
$dsn,
$this->username,
$this->password,
$this->option
@@ -199,7 +199,10 @@ class gdb
}
}
return implode($stack, ',');
if ( is_array( $stack ) )
return implode( ',', $stack );
else
return $stack;
}
protected function array_quote($array)
@@ -318,11 +321,11 @@ class gdb
}
$value = '%' . $value . '%';
$wheres[] = $column . ' LIKE ' . $this->fn_quote($key, $value);
}
}
if (in_array($operator, array('>', '>=', '<', '<=')))
{
if (is_numeric($value))
@@ -719,7 +722,7 @@ class gdb
}
}
$this->exec('INSERT INTO "' . $table . '" (' . implode(', ', $columns) . ') VALUES (' . implode($values, ', ') . ')');
$this->exec('INSERT INTO "' . $table . '" (' . implode(', ', $columns) . ') VALUES (' . implode(', ',$values) . ')');
$lastId[] = $this->pdo->lastInsertId();
}
@@ -829,13 +832,13 @@ class gdb
}
$where['LIMIT'] = 1;
$data = $this->query($this->select_context($table, $join, $column, $where))->fetchAll(PDO::FETCH_ASSOC);
if (isset($data[0]))
{
$column = $where == null ? $join : $column;
if (is_string($column) && $column != '*')
{
return $data[ 0 ][ $column ];

View File

@@ -36,8 +36,6 @@ class grid
public $sql = null;
public $sql_count = null;
public $context_menu = true;
public $include_plugins = true;
public $gdb_opt = array(
@@ -80,8 +78,9 @@ class grid
$this -> name ? $g_table = $this -> name : $g_table = $this -> table;
if ( is_array( $_SESSION ) ) foreach ( $_SESSION as $key => $val )
{
if ( $key != 'g' . $g_table and @get_class( $val ) == '__PHP_Incomplete_Class' )
unset( $_SESSION[ $key ] );
if ($key != 'g' . $g_table && is_object($val) && get_class($val) == '__PHP_Incomplete_Class') {
unset($_SESSION[$key]);
}
}
}
}
@@ -124,10 +123,9 @@ class grid
$this -> hidden_columns = $results['hidden_columns'];
(int)$_SESSION[ 'g' . $g_table . 'cp' ] ? $this -> cp = (int)$_SESSION[ 'g' . $g_table . 'cp' ] : $this -> cp = 1;
if ( !empty( $_SESSION[ 'g' . $g_table . 'order' ] ) )
$this -> order = $_SESSION[ 'g' . $g_table . 'order' ];
(int)$_SESSION[ 'g' . $g_table . 'cp' ] ? $this -> cp = (int)$_SESSION[ 'g' . $g_table . 'cp' ] : $this -> cp = 1;
$_SESSION[ 'g' . $g_table ] = $this;
@@ -147,7 +145,7 @@ class grid
'server' => $this -> gdb_opt['server'],
'username' => $this -> gdb_opt['username'],
'password' => $this -> gdb_opt['password'],
'port' => $this -> gdb_opt['port'],
'port' => isset( $this -> gdb_opt['port'] ) ? $this -> gdb_opt['port'] : 3306,
'charset' => 'utf8'
] );
}
@@ -156,8 +154,6 @@ class grid
{
if ( is_array( $this -> src ) )
$results = $this -> getDataSrc();
else if ( isset( $this -> sql ) and isset( $this -> sql_count ) )
$results = $this -> get_data_sql();
else
$results = $this -> getData( true );
@@ -183,7 +179,7 @@ class grid
{
/* podmiana na wartości tablicy */
if ( is_array( $column['replace']['array'] ) )
$array_row[] = strip_tags( $this -> convertString( $column['replace']['array'][ $row[ $column['db'] ] ], $row ) );
$array_row[] = $this -> convertString( $column['replace']['array'][ $row[ $column['db'] ] ], $row );
else if ( $column['replace']['sql'] )
{
@@ -386,14 +382,7 @@ class grid
$where['AND'] = array_merge( $where['AND'], [ $key . '[~]' => $val['value'] ] );
if ( $val['type'] == 'equal' )
{
if ( $val['value'] == 'isnull' )
$where['AND'] = array_merge( $where['AND'], [ $key => null ] );
elseif ( $val['value'] == 'isnotnull' )
$where['AND'] = array_merge( $where['AND'], [ $key . '[!]' => null ] );
else
$where['AND'] = array_merge( $where['AND'], [ $key => $val['value'] ] );
}
$where['AND'] = array_merge( $where['AND'], [ $key => $val['value'] ] );
if ( $val['type'] == 'date_range' )
{
@@ -448,6 +437,7 @@ class grid
public function getDataSummary()
{
$summary = [];
$where = self::getWhereCondition();
if ( is_array( $this -> summary ) ) foreach ( $this -> summary as $key )
@@ -522,7 +512,7 @@ class grid
public function saveElement( $values )
{
if ( !$values[ $this -> id ] )
if ( !isset( $values[ $this -> id ] ) or !$values[ $this -> id ] )
{
unset( $values[ $this -> id ] );
return $this -> connectToDb() -> insert( $this -> table, $values );