60 lines
1.9 KiB
Plaintext
60 lines
1.9 KiB
Plaintext
<?php
|
|
|
|
/*******************************************************************
|
|
|
|
Desc. : Konfigurasi Parameter Utama Aplikasi
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : November 23rd, 2019.
|
|
Last Modified : September 2nd, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
use flight\Engine;
|
|
use flight\Session;
|
|
use flight\database\SimplePdo;
|
|
use Webapp\App\Register;
|
|
|
|
/** @var Engine $app
|
|
* @var Session $session
|
|
* @var SimplePdo $db
|
|
*/
|
|
|
|
$apps = [
|
|
'APP_CODE' => "-",
|
|
'APP_NAME' => "-",
|
|
'APP_NAMES' => "-",
|
|
'APP_VER' => "-",
|
|
'APP_UPDATED' => "-",
|
|
'APP_SID' => $session->id(),
|
|
'APP_LOCALE' => [ 'id' => "Indonesia", 'en' => "English" ],
|
|
'DEF_LOCALE' => "id",
|
|
'AUTH_OVER' => false,
|
|
'AUTH_LEVEL' => 9,
|
|
'USER_LEVEL' => [ 0 => "Administrator", 1 => "Supervisor", 9 => "Operator" ],
|
|
'CREATOR_YEAR' => 0,
|
|
'CREATOR_NAME' => "3FONIA Software",
|
|
'CREATOR_WEBSITE' => "https://www.3fonia.com",
|
|
'PARENT_SITE' => "https://localhost",
|
|
'PARENT_CODE' => "-",
|
|
'PARENT_SUB' => false,
|
|
'SERVER_ID' => "0",
|
|
];
|
|
|
|
$_apps = $session->get('WEB_APP', []);
|
|
|
|
if (count($_apps) > 0 && ($_apps['APP_CODE'] ?? "") !== $apps['APP_CODE']) {
|
|
$session->clear();
|
|
}
|
|
|
|
// config web_app
|
|
if (empty($session->get('WEB_APP'))) {
|
|
$row = $app->db()->fetchRow("SELECT * FROM app_config WHERE REG_ID = ?", [$apps['APP_CODE']]);
|
|
if ($row) $apps = array_merge($apps, $row->getData());
|
|
if ($apps['APP_BUILD'] ?? "" !== "") $apps['APP_VER'] = $apps['APP_BUILD'];
|
|
$apps['CREATOR_YEARS'] = ($apps['CREATOR_YEAR'] !== date('Y')) ? $apps['CREATOR_YEAR']." - ".date('Y') : $apps['CREATOR_YEAR'];
|
|
$apps = array_merge($apps, Register::reg_status($db, $apps));
|
|
$session->set('WEB_APP', $apps);
|
|
}
|