fixed same bug

This commit is contained in:
2026-09-30 14:33:11 +07:00
parent bc95edbc0f
commit 8a758e5875
18 changed files with 162 additions and 433 deletions
+26 -16
View File
@@ -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 [];
}
}