5 Commits
8 changed files with 116 additions and 92 deletions
+5 -5
View File
@@ -18,12 +18,12 @@
], ],
"require": { "require": {
"php": ">=8.3", "php": ">=8.3",
"flightphp/core": "^3.18", "flightphp/core": "^3.19",
"flightphp/session": "^0.3", "flightphp/session": "^0.3",
"mpdf/mpdf": ">=8.0", "mpdf/mpdf": "^8.3",
"avadim/fast-excel-writer": "^6.17", "avadim/fast-excel-writer": "^6.19",
"matthiasmullie/minify": ">=1.3", "matthiasmullie/minify": "^1.3",
"endroid/qr-code": ">=4.4" "endroid/qr-code": "^6.1"
}, },
"autoload": { "autoload": {
"classmap": ["src/"], "classmap": ["src/"],
+24 -34
View File
@@ -5,7 +5,7 @@
Module : /App/Auth.php Module : /App/Auth.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : March 16th, 2008. Created Date : March 16th, 2008.
Last Modified : September 10th, 2026. Last Modified : October 21st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -43,61 +43,39 @@ final class Auth {
$this->app = $app; $this->app = $app;
$this->db = $app->db(); $this->db = $app->db();
$this->session = $app->session(); $this->session = $app->session();
$this->id_reg = (int) $this->session->get('WEB_APP', ['REG_ID'=>0])['REG_ID']; $this->id_reg = (int) $this->session->get('WEB_APP', ['PARENT_CODE'=>0])['PARENT_CODE'];
}
public function set_id_reg(int|string $id = 0): void {
if ((int) $id > 0) $this->id_reg = (int) $id;
} }
public function user_check(string $user, string $pass): bool { public function user_check(string $user, string $pass): bool {
$i_hasil = (int) $this->db->fetchField('SELECT COUNT(*) FROM app_operator WHERE Username=? AND Password=MD5(?) AND Aktif=1', [$user, $pass]); $i_hasil = (int) $this->db->fetchField('SELECT COUNT(*) FROM app_operator WHERE Username=? AND Password=MD5(?) AND Aktif=1', [$user, $pass]) ?? 0;
return ($i_hasil > 0 ? true : false); return ($i_hasil > 0 ? true : false);
} }
public function user_data(string $user): array { public function user_data(string $user, bool $gen_module=true): array {
$adata = [ 'Grup_MenuID' => 0 ]; $adata = [ 'Grup_MenuID' => 0 ];
$xdata = $this->db->fetchRow('SELECT *,DECODE(Menu,?) Menu2 FROM app_operator WHERE Username=?', [$this->id_reg, $user]); $xdata = $this->db->fetchRow('SELECT UserID,Grup_MenuID,Username,Nama,Posisi,Email,HP,Level,Last_IP,Last_Date FROM app_operator WHERE Username=?', [$user]);
if ($xdata) { if ($xdata) $adata = $xdata->getData();
$adata = $xdata->getData();
$adata['Menu'] = $adata['Menu2'];
unset($adata['Menu2'], $adata['Password']);
}
if (empty($this->session->get('APP_TOKEN'))) { if (empty($this->session->get('APP_TOKEN'))) {
$_token = $this->genToken(60); $_token = $this->genToken(60);
$this->session->set('APP_TOKEN', $_token); $this->session->set('APP_TOKEN', $_token);
$this->db->insert('app_token', [ 'Token' => $_token, 'UserID' => $adata['UserID'], 'IP' => $this->app->request()->ip ]); $this->db->insert('app_token', [ 'Token' => $_token, 'UserID' => $adata['UserID'], 'IP' => $this->app->request()->ip ]);
} }
if ((int) $adata['Grup_MenuID'] > 0) $adata['Menu_Grup'] = $this->user_allmenu((int) $adata['Grup_MenuID']);
$adata['UNIX'] = time(); $adata['UNIX'] = time();
$adata['LOCALE'] = $this->session->get('WEB_APP', ['DEF_LOCALE'=>'id'])['DEF_LOCALE']; $adata['LOCALE'] = $this->session->get('WEB_APP', ['DEF_LOCALE'=>'id'])['DEF_LOCALE'];
$adata['MENU_MODUL'] = []; $adata['MENU_MODUL'] = [];
return $adata; if ($gen_module === true && !empty($this->session->get('WEB_APP')['APP_MODULE'])) {
} $tallow = $this->db->fetchField('SELECT Modul_Akses FROM app_menu_grup WHERE Grup_MenuID=?', [$adata['Grup_MenuID']]) ?? '';
public function gen_module_menu(): void {
$amodul = []; $aallow = []; $tallow = '';
if ($this->session->get('WEB_APP', ['APP_MODULE'=>0])['APP_MODULE']) {
$tallow = $this->db->fetchField('SELECT Modul_Akses FROM app_menu_grup WHERE Grup_MenuID=?', [$this->session->get('WEB_USER', ['Grup_MenuID'=>0])['Grup_MenuID']]);
$aallow = explode(",", $tallow); $aallow = explode(",", $tallow);
if (count($aallow) > 0) { if (count($aallow) > 0) {
$stat = $this->db->runQuery('SELECT * FROM (SELECT APP_MODULE,APP_PATH FROM app_config) A LEFT JOIN (SELECT Modul,Urut,Judul,Icon FROM app_menu WHERE Level=0) B ON (A.APP_MODULE=B.Modul) ORDER BY B.Urut'); $stat = $this->db->runQuery('SELECT * FROM (SELECT APP_MODULE,APP_PATH FROM app_config) A LEFT JOIN (SELECT Modul,Urut,Judul,Icon FROM app_menu WHERE Level=0) B ON (A.APP_MODULE=B.Modul) ORDER BY B.Urut');
while ($row = $stat->fetch()) { while ($row = $stat->fetch()) {
if (!in_array($row['Modul'], $aallow) || $row['Modul']==$this->session->get('WEB_APP')['APP_MODULE']) continue; if (!in_array($row['Modul'], $aallow) || $row['Modul'] === $this->session->get('WEB_APP')['APP_MODULE']) continue;
$amodul[] = $row; $adata['MENU_MODUL'][] = $row;
} }
} }
} }
$auser = $this->session->get('WEB_USER', []); return $adata;
$auser['MENU_MODUL'] = $amodul;
$this->session->set('WEB_USER', $auser);
}
public function user_allmenu(int $id_grup = 0): string {
$allmenu = $this->db->fetchField('SELECT DECODE(Menu,?) MenuX FROM app_menu_grup WHERE Grup_MenuID=?', [$this->id_reg, $id_grup]);
return $allmenu;
} }
public function user_check_level(string $user, int $level = 9): bool { public function user_check_level(string $user, int $level = 9): bool {
@@ -143,9 +121,21 @@ final class Auth {
} }
public function getUserByToken(string $token): string { public function getUserByToken(string $token): string {
$hasil = $this->db->fetchField('SELECT Username FROM app_operator WHERE UserID IN (SELECT UserID FROM app_token WHERE Token=?) LIMIT 1', [$token ?? $this->session->get('APP_TOKEN')]); $hasil = $this->db->fetchField('SELECT Username FROM app_operator WHERE UserID IN (SELECT UserID FROM app_token WHERE Token=?) LIMIT 1', [$token ?? $this->session->get('APP_TOKEN')]) ?? '';
return $hasil; return $hasil;
} }
public function pos_login(int $id_cab, int $id_user, int $unix, string $ip): void {
if (empty($id_cab) || empty($id_user) || empty($ip)) return;
$this->db->delete('disp_login', 'CabID=? AND UserID=?', [$id_cab, $id_user]);
$this->db->runQuery('INSERT INTO disp_login (IP, CabID, UserID, Unix, Date) VALUES (?, ?, ?, ?, NOW())', [ $ip, $id_cab, $id_user, $unix ?? 0 ]);
}
public function pos_logout(int $id_cab, int $id_user, int $unix, string $ip): void {
if (empty($id_cab) || empty($id_user) || empty($ip)) return;
$this->db->delete('disp_login', 'CabID=? AND UserID=? AND IP=? AND Unix=?', [$id_cab, $id_user, $ip, $unix ?? 0 ]);
}
} }
?> ?>
+13 -9
View File
@@ -5,7 +5,7 @@
Module : /Data/Cache.php Module : /Data/Cache.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : March 16th, 2008. Created Date : March 16th, 2008.
Last Modified : September 3rd, 2026. Last Modified : October 12th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -43,6 +43,7 @@ final class Cache {
private array $ini; private array $ini;
private array $web_app; private array $web_app;
private array $web_user; private array $web_user;
private array $my_menu = [];
private bool $is_login; private bool $is_login;
private bool $IS_DEV = false; private bool $IS_DEV = false;
protected Engine $app; protected Engine $app;
@@ -72,7 +73,7 @@ final class Cache {
$this->ini = [ $this->ini = [
'login' => [ 'css' => "", 'js' => "", 'app' => "", ], 'login' => [ 'css' => "", 'js' => "", 'app' => "", ],
'index' => [ 'css' => "", 'js' => "", 'app' => "", ], 'index' => [ 'css' => "", 'js' => "", 'app' => "", ],
'display' => [ 'css' => "", 'js' => "", 'app' => "", ], 'monitor' => [ 'css' => "", 'js' => "", 'app' => "", ],
]; ];
$this->save_ini(); $this->save_ini();
} else $this->ini = parse_ini_file($this->cachedir . "cache.ini", true); } else $this->ini = parse_ini_file($this->cachedir . "cache.ini", true);
@@ -134,7 +135,7 @@ final class Cache {
} }
if ($mode === 'index') { if ($mode === 'index') {
$_ajs = ['system/profile', 'system/chpasswd']; $_ajs = ['system/profile', 'system/chpasswd'];
$amenu = array_values($this->web_user['Merge_Menu'] ?? []); $amenu = array_values($this->my_menu ?? []);
$_ops = $this->db->fetchColumn("SELECT Link FROM app_menu WHERE Kode IN (?) AND Link<>'' ORDER BY Kode", [$amenu]); $_ops = $this->db->fetchColumn("SELECT Link FROM app_menu WHERE Kode IN (?) AND Link<>'' ORDER BY Kode", [$amenu]);
if ($_ops) $_ajs = array_merge($_ajs, $_ops); if ($_ops) $_ajs = array_merge($_ajs, $_ops);
$dirIterator = new \RecursiveDirectoryIterator($this->jsapp, \RecursiveDirectoryIterator::SKIP_DOTS); $dirIterator = new \RecursiveDirectoryIterator($this->jsapp, \RecursiveDirectoryIterator::SKIP_DOTS);
@@ -142,7 +143,7 @@ final class Cache {
$iterator = new \RecursiveIteratorIterator($dirFilter); $iterator = new \RecursiveIteratorIterator($dirFilter);
foreach ($iterator as $_file) { foreach ($iterator as $_file) {
if ($_file->isFile() && if ($_file->isFile() &&
!in_array($_file->getFilename(), ['login.js','index.js','display.js']) && !in_array($_file->getFilename(), ['login.js','index.js','monitor.js']) &&
array_any($_ajs, fn($js) => str_ends_with(str_replace(['_','\\'],['','/'],$_file->getRealPath()), $js.'.js'))) { array_any($_ajs, fn($js) => str_ends_with(str_replace(['_','\\'],['','/'],$_file->getRealPath()), $js.'.js'))) {
$afile[] = $_file->getRealPath(); $afile[] = $_file->getRealPath();
$itime += $_file->getMTime(); $itime += $_file->getMTime();
@@ -194,7 +195,10 @@ final class Cache {
public function Cache(string $mode = "index"): array { public function Cache(string $mode = "index"): array {
if ($mode === 'index') { if ($mode === 'index') {
$this->ini['index']['app'] = (string) $this->db->fetchField("SELECT JS FROM app_operator_profile WHERE UserID=?", [$this->web_user['UserID']]) ?? ''; $this->ini['index']['app'] = (string) $this->db->fetchField("SELECT JS FROM app_operator_profile WHERE UserID=?", [$this->web_user['UserID']]) ?? '';
$this->web_user['Merge_Menu'] = array_filter(array_unique(explode(",", $this->web_user['Menu_Grup'] .",". $this->web_user['Menu']))); $_menu = $this->db->fetchField("SELECT CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_operator WHERE UserID=?", [$this->web_app['PARENT_CODE'], $this->web_user['UserID']]) ?? '';
$_gmenu = '';
if ($this->web_user['Grup_MenuID'] > 0) $_gmenu = $this->db->fetchField('SELECT CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_menu_grup WHERE Grup_MenuID=?', [$this->web_app['PARENT_CODE'], $this->web_user['Grup_MenuID']]) ?? '';
$this->my_menu = array_filter(array_unique(explode(",", $_gmenu .",". $_menu)));
} }
$is_modif = false; $is_modif = false;
@@ -235,7 +239,7 @@ final class Cache {
return $acache; return $acache;
} }
public function Make_Cache(array $amode = ['login', 'index', 'display']): array { public function Make_Cache(array $amode = ['login', 'index', 'monitor']): array {
$is_modif = false; $is_modif = false;
foreach ($amode as $mode) { foreach ($amode as $mode) {
foreach (['css','js','app'] as $type) { foreach (['css','js','app'] as $type) {
@@ -252,11 +256,11 @@ final class Cache {
if ($is_modif === true) $this->save_ini(); if ($is_modif === true) $this->save_ini();
if (in_array('index', $amode)) { if (in_array('index', $amode)) {
$agrup = $this->db->fetchAll('SELECT Grup_MenuID,DECODE(Menu,?) Menu FROM app_menu_grup', [$this->web_app['PARENT_CODE']]); $agrup = $this->db->fetchAll('SELECT Grup_MenuID,CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_menu_grup', [$this->web_app['PARENT_CODE']]);
$auser = $this->db->fetchAll("SELECT A.*,IFNULL(B.JS,'') JS FROM (SELECT UserID,Grup_MenuID,DECODE(Menu,?) Menu FROM app_operator) A LEFT JOIN app_operator_profile B ON (A.UserID=B.UserID)", [$this->web_app['PARENT_CODE']]); $auser = $this->db->fetchAll("SELECT A.*,IFNULL(B.JS,'') JS FROM (SELECT UserID,Grup_MenuID,CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_operator) A LEFT JOIN app_operator_profile B ON (A.UserID=B.UserID)", [$this->web_app['PARENT_CODE']]);
foreach ($auser as $user) { foreach ($auser as $user) {
if (empty($user['JS']) || !file_exists($this->cachedir . $user['JS'])) { if (empty($user['JS']) || !file_exists($this->cachedir . $user['JS'])) {
$this->web_user['Merge_Menu'] = array_filter(array_unique(explode(",", $user['Menu'] .",". ($agrup[$user['Grup_MenuID']]['Menu'] ?? '')))); $this->my_menu = array_filter(array_unique(explode(",", $user['Menu'] .",". ($agrup[$user['Grup_MenuID']]['Menu'] ?? ''))));
[ $afile, $lastmod ] = $this->gen_file('index', 'app'); [ $afile, $lastmod ] = $this->gen_file('index', 'app');
$cachefile = md5('index-app-' . (string) $user['UserID'] . $lastmod) . '.js'; $cachefile = md5('index-app-' . (string) $user['UserID'] . $lastmod) . '.js';
+4 -4
View File
@@ -2,10 +2,10 @@
/******************************************************************* /*******************************************************************
PHP Class : /Data/Xls.php PHP Class : /Data/Xlsx.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : November 18th, 2012. Created Date : November 18th, 2012.
Last Modified : October 1st, 2026. Last Modified : October 24th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -130,8 +130,8 @@ final class Xlsx {
$this->sheet->writeTo('A'.(string) $this->baris, ''); $this->sheet->writeTo('A'.(string) $this->baris, '');
} }
public function show_headers(): void { public function show_headers(bool $is_hide=false): void {
$this->sheet->writeHeader(array_column($this->atabel, 'n')) if (!$is_hide) $this->sheet->writeHeader(array_column($this->atabel, 'n'))
->applyFontStyleBold() ->applyFontStyleBold()
->applyTextCenter() ->applyTextCenter()
->applyBorder(Style::BORDER_STYLE_THIN); ->applyBorder(Style::BORDER_STYLE_THIN);
+39 -1
View File
@@ -6,7 +6,7 @@
Desc. : Fungsi Custom Lain Lain Desc. : Fungsi Custom Lain Lain
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : January 27th, 2008. Created Date : January 27th, 2008.
Last Modified : August 21st, 2026. Last Modified : October 27th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -362,3 +362,41 @@ if (!function_exists('random_color')) {
return "rgba(".$col_r.",".$col_g.",".$col_b.",".$trans.")"; return "rgba(".$col_r.",".$col_g.",".$col_b.",".$trans.")";
} }
} }
if (!function_exists('gen_uuidv4')) {
function gen_uuidv4(): string {
$data = random_bytes(16);
// Set version to 0100 (UUID v4)
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
// Set bits 6-7 to 10
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
}
if (!function_exists('gen_uuidv7')) {
function gen_uuidv7(int $time=0): string {
// Get timestamp in milliseconds (48 bits)
if (empty($time)) $time = (int) floor(microtime(true) * 1000);
// Generate 16 bytes of random data
$randomBytes = random_bytes(16);
// Pack the 48-bit timestamp into the first 6 bytes
$timeHex = str_pad(dechex($time), 12, '0', STR_PAD_LEFT);
$bytes = hex2bin($timeHex);
// Append 10 bytes of randomness (we need 16 total bytes)
$bytes .= substr($randomBytes, 0, 10);
// Apply the version bits (Version 7 -> 0b0111) onto byte 6
$bytes[6] = chr((ord($bytes[6]) & 0x0f) | 0x70);
// Apply the variant bits (Variant 1 -> 0b10xx) onto byte 8
$bytes[8] = chr((ord($bytes[8]) & 0x3f) | 0x80);
// Unpack to hex string and format with hyphens
$hex = bin2hex($bytes);
return sprintf('%08s-%04s-%04s-%04s-%012s',
substr($hex, 0, 8),
substr($hex, 8, 4),
substr($hex, 12, 4),
substr($hex, 16, 4),
substr($hex, 20, 12)
);
}
}
+4 -4
View File
@@ -5,7 +5,7 @@
Module : /Printer/PrintHTML.php Module : /Printer/PrintHTML.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : June 15th, 2008. Created Date : June 15th, 2008.
Last Modified : October 2nd, 2026. Last Modified : October 24th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -119,16 +119,16 @@ final class PrintHTML {
echo '<br />'; echo '<br />';
} }
public function show_headers(): void { public function show_headers(bool $is_hide=false): void {
vprintf('<table class="%s"><thead>', [$this->css]); vprintf('<table class="%s"><thead>', [$this->css]);
// 0-n, 1=l, 2-f, 3-a, 4-k // 0-n, 1=l, 2-f, 3-a, 4-k
$head_out = "<tr>"; $head_out = "<tr>";
foreach ($this->atabel as $tabel) { foreach ($this->atabel as $tabel) {
if ($tabel['k'] === 0) continue; if ($tabel['k'] === 0) continue;
$head_out .= $this->set_align($tabel['n'], $tabel['l'], "C", false, true, $tabel['k']); $head_out .= $this->set_align($tabel['n'], $tabel['l'], "C", false, true, $tabel['k'], ($is_hide?'d-none':''));
} }
$head_out .= "</tr>"; $head_out .= "</tr>";
echo "</thead>".$head_out."<tbody>"; echo $head_out."</thead><tbody>";
// start content row // start content row
} }
+23 -22
View File
@@ -5,7 +5,7 @@
Module : /Web/Menu.php Module : /Web/Menu.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : January 16th, 2008. Created Date : January 16th, 2008.
Last Modified : August 22nd, 2026. Last Modified : October 30th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -31,8 +31,9 @@ use \flight\database\SimplePdo;
*/ */
final class Menu { final class Menu {
private array $webapp; private array $web_app;
private array $webuser; private array $web_user;
private array $my_menu;
protected Engine $app; protected Engine $app;
protected SimplePdo $db; protected SimplePdo $db;
protected Session $session; protected Session $session;
@@ -44,27 +45,28 @@ final class Menu {
$this->app = $app; $this->app = $app;
$this->db = $app->db(); $this->db = $app->db();
$this->session = $app->session(); $this->session = $app->session();
$this->webapp = $this->session->get('WEB_APP', ['APP_MODULE'=>'', 'PARENT_SITE'=>'', 'PARENT_SUB'=>false]); $this->web_app = $this->session->get('WEB_APP', ['APP_MODULE'=>'', 'PARENT_SITE'=>'', 'PARENT_SUB'=>false]);
$this->webuser = $this->session->get('WEB_USER', ['Menu'=>'', 'Menu_Grup'=>'', 'MENU_MODUL'=>[]]); $this->web_user = $this->session->get('WEB_USER', ['Menu'=>'', 'Menu_Grup'=>'', 'MENU_MODUL'=>[]]);
$_gmenu = '';
$_umenu = $this->db->fetchField("SELECT CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_operator WHERE UserID=?", [$this->web_app['PARENT_CODE'], $this->web_user['UserID']]) ?? '';
if ($this->web_user['Grup_MenuID'] > 0) $_gmenu = $this->db->fetchField('SELECT CONVERT(DECODE(Menu,?) USING UTF8MB4) Menu FROM app_menu_grup WHERE Grup_MenuID=?', [$this->web_app['PARENT_CODE'], $this->web_user['Grup_MenuID']]) ?? '';
$this->my_menu = array_unique(array_filter(explode(",", $_gmenu.",".$_umenu)));
} }
public function Sidebar(): string { public function Sidebar(): string {
$a_modul = []; $a_modul = [];
$is_modul = ($this->webapp['APP_MODULE'] !== '') ? true : false; $is_modul = !empty($this->web_app['APP_MODULE']);
if ($is_modul == true) { if ($is_modul === true) {
$a_modul[] = $this->webapp['APP_MODULE']; $a_modul[] = $this->web_app['APP_MODULE'];
} else { } else {
$atmp = $this->db->fetchAll('SELECT * FROM app_menu WHERE Level=0 AND Aktif=1 AND Modul<>"IND" ORDER BY Urut'); $atmp = $this->db->fetchAll('SELECT * FROM app_menu WHERE Level=0 AND Aktif=1 AND Modul<>"IND" ORDER BY Urut');
foreach ($atmp as $tmp) { foreach ($atmp as $tmp) $a_modul[] = $tmp['Modul'];
$a_modul[] = $tmp['Modul'];
}
} }
$my_menu = array_unique(array_filter(explode(",", $this->webuser['Menu_Grup'].",".$this->webuser['Menu'])));
$tsql = 'SELECT * FROM app_menu WHERE Aktif=1 AND Modul IN (?) AND Kode IN (?)'; $tsql = 'SELECT * FROM app_menu WHERE Aktif=1 AND Modul IN (?) AND Kode IN (?)';
if ($is_modul == true) $tsql .= ' AND Level>0'; if ($is_modul == true) $tsql .= ' AND Level>0';
$amodul = $this->db->fetchAll($tsql . ' ORDER BY Kode', [$a_modul, $my_menu]); $amodul = $this->db->fetchAll($tsql . ' ORDER BY Kode', [$a_modul, $this->my_menu]);
$thasil = ''; $thasil = '';
$last_level = 0; $last_level = 0;
@@ -88,10 +90,10 @@ final class Menu {
public function Header(): string { public function Header(): string {
$a_modul = []; $a_modul = [];
$is_modul = ($this->webapp['APP_MODULE'] !== '') ? true : false; $is_modul = !empty($this->web_app['APP_MODULE']);
$mulai_level = 0; $mulai_level = 0;
if ($is_modul == true) { if ($is_modul === true) {
$a_modul[] = $this->webapp['APP_MODULE']; $a_modul[] = $this->web_app['APP_MODULE'];
$mulai_level = 1; $mulai_level = 1;
} else { } else {
$atmp = $this->db->fetchAll('SELECT * FROM app_menu WHERE Level=0 AND Aktif=1 AND Modul<>"IND" ORDER BY Urut'); $atmp = $this->db->fetchAll('SELECT * FROM app_menu WHERE Level=0 AND Aktif=1 AND Modul<>"IND" ORDER BY Urut');
@@ -100,11 +102,10 @@ final class Menu {
} }
} }
$my_menu = array_unique(array_filter(explode(",", $this->webuser['Menu_Grup'].",".$this->webuser['Menu'])));
$tsql = 'SELECT * FROM app_menu WHERE Aktif=1 AND Modul IN (?) AND Kode IN (?)'; $tsql = 'SELECT * FROM app_menu WHERE Aktif=1 AND Modul IN (?) AND Kode IN (?)';
if ($is_modul == true) $tsql .= ' AND Level>0'; if ($is_modul == true) $tsql .= ' AND Level>0';
$amodul = $this->db->fetchAll($tsql . ' ORDER BY Kode', [$a_modul, $my_menu]); $amodul = $this->db->fetchAll($tsql . ' ORDER BY Kode', [$a_modul, $this->my_menu]);
$thasil = ''; $thasil = '';
$last_level = 0; $last_level = 0;
@@ -134,15 +135,15 @@ final class Menu {
public function Modul(): string { public function Modul(): string {
$t_modul = ''; $t_modul = '';
if (is_array($this->webuser['MENU_MODUL']) && count($this->webuser['MENU_MODUL'])>0) { if (is_array($this->web_user['MENU_MODUL']) && count($this->web_user['MENU_MODUL'])>0) {
$t_modul = '<div class="dropdown-divider"></div>'; $t_modul = '<div class="dropdown-divider"></div>';
if ($this->app->request()->getVar('SERVER_ADDR') === '127.0.0.1') { if ($this->app->request()->getVar('SERVER_ADDR') === '127.0.0.1') {
$href1 = '//127.0.0.1/'; $href1 = '//127.0.0.1/';
$href2 = ""; $href2 = "";
} else { } else {
$_host = $this->app->request()->getVar('HTTP_ORIGIN') ?? $this->app->request()->getVar('HTTP_HOST') ?? $this->webapp['PARENT_SITE']; $_host = $_SERVER['HTTP_ORIGIN'] ?? $_SERVER['HTTP_HOST'] ?? $this->web_app['PARENT_SITE'];
$_host = str_replace(['http://','https://'], "", $_host); $_host = str_replace(['http://','https://'], "", $_host);
if ($this->webapp['PARENT_SUB'] === true) { if ($this->web_app['PARENT_SUB'] === true) {
$_subs = explode('.', $_host); $_subs = explode('.', $_host);
if (count($_subs) > 2) array_shift($_subs); if (count($_subs) > 2) array_shift($_subs);
$href1 = "//"; $href1 = "//";
@@ -152,7 +153,7 @@ final class Menu {
$href2 = ""; $href2 = "";
} }
} }
foreach ($this->webuser['MENU_MODUL'] as $modul) { foreach ($this->web_user['MENU_MODUL'] as $modul) {
$href = $href1 . $modul['APP_PATH'] . $href2 . '/' . $this->session->get('APP_TOKEN'); $href = $href1 . $modul['APP_PATH'] . $href2 . '/' . $this->session->get('APP_TOKEN');
$t_modul .= '<a class="dropdown-item slink" href="'.$href.'"><i class="'.$modul['Icon'].' me-2"></i> '.$modul['Judul'].'</a>'; $t_modul .= '<a class="dropdown-item slink" href="'.$href.'"><i class="'.$modul['Icon'].' me-2"></i> '.$modul['Judul'].'</a>';
} }
+1 -10
View File
@@ -5,7 +5,7 @@
Module : /Web/Param.php Module : /Web/Param.php
Created By : Siau Pheng ([email protected]). Created By : Siau Pheng ([email protected]).
Created Date : November 14th, 2013. Created Date : November 14th, 2013.
Last Modified : September 16th, 2026. Last Modified : October 16th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM. (c) 3FONIA Software; WWW.3FONIA.COM.
@@ -75,15 +75,6 @@ final class Param {
return self::$__ahasil; return self::$__ahasil;
} }
//delete
public static function Get_Text(string $key, mixed $def = null): mixed {
return self::Get($key, $def);
}
//delete
public static function Get_ArrayCBOX() {
return [];
}
} }
?> ?>