fixed same bug
This commit is contained in:
+26
-16
@@ -5,7 +5,7 @@
|
||||
Module : /Web/Param.php
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 14th, 2013.
|
||||
Last Modified : August 22nd, 2026.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -38,40 +38,50 @@ final class Param {
|
||||
private static function __data(): void {
|
||||
global $app;
|
||||
if (empty($app)) $app = \Flight::app();
|
||||
//$_asumber = array_merge($app->request()->query->getData(), $app->request()->data->getData());
|
||||
$_asumber = $app->request()->query->getData() + $app->request()->data->getData();
|
||||
foreach ($_asumber as $__key => $__val) {
|
||||
self::$__ahasil[$__key] = is_string($__val) ? self::safeSQL($__val) : $__val;
|
||||
if (in_array($__val, ['true','false'])) { $__val = ($__val === 'true'); }
|
||||
else if (is_string($__val)) $__val = urldecode(self::safeSQL($__val));
|
||||
self::$__ahasil[$__key] = $__val;
|
||||
}
|
||||
}
|
||||
|
||||
public static function safeSQL(string $str = ""): string {
|
||||
$_se = array("\\","\0","\n","\r","\x1a","'",'"');
|
||||
$_re = array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
|
||||
$_se = ["\\","\0","\n","\r","\x1a","'",'"'];
|
||||
$_re = ["\\\\","\\0","\\n","\\r","\Z","\'",'\"'];
|
||||
return str_replace($_se, $_re, $str);
|
||||
}
|
||||
|
||||
public static function Get(string $key = "", mixed $def = null): mixed {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
if (isset(self::$__ahasil[$key]) && self::$__ahasil[$key]) return self::$__ahasil[$key];
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_Text(string $key, mixed $def = null): mixed {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
$_str = (isset(self::$__ahasil[$key])) ? self::$__ahasil[$key] : $def;
|
||||
$_str = str_replace("\\r", "", $_str);
|
||||
$_str = str_replace("\\n", " ", $_str);
|
||||
$_str = str_replace("\\t", " ", $_str);
|
||||
return (trim($_str));
|
||||
public static function Int(string $key = "", int $def = 0): int {
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return (int) self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_Array(): array {
|
||||
public static function Float(string $key = "", float $def = 0): float {
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return (float) self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_All(): array {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
return self::$__ahasil;
|
||||
}
|
||||
|
||||
public static function Get_ArrayCBOX() {//delete
|
||||
//delete
|
||||
public static function Get_Text(string $key, mixed $def = null): mixed {
|
||||
return self::Get($key, $def);
|
||||
}
|
||||
|
||||
//delete
|
||||
public static function Get_ArrayCBOX() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
Module : /Web/Table.php
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 16th, 2008.
|
||||
Last Modified : August 27th, 2026.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -208,6 +208,11 @@ final class Table {
|
||||
$tval = $row[$col['a']];
|
||||
if (is_array($col['f'])) {
|
||||
$tval = $col['f'][$tval];
|
||||
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
|
||||
$tclass = explode("::", $col['f']);
|
||||
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
}
|
||||
} else if (!is_null($col['f']) && function_exists($col['f'])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
} else if (is_string($tval)) {
|
||||
@@ -291,6 +296,11 @@ final class Table {
|
||||
$tval = $row[$col['a']];
|
||||
if (is_array($col['f'])) {
|
||||
$tval = $col['f'][$tval];
|
||||
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
|
||||
$tclass = explode("::", $col['f']);
|
||||
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
}
|
||||
} else if (!is_null($col['f']) && function_exists($col['f'])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
} else if (is_string($tval)) {
|
||||
|
||||
Reference in New Issue
Block a user