change namespace to Webapp\
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
class Button {
|
||||
private $__abutton =[];
|
||||
|
||||
+12
-12
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
@@ -33,7 +33,7 @@ final class Form {
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function option(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null, bool $multi=false, bool $group=false): string {
|
||||
public function option(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null, bool $multi=false, bool $group=false): string {
|
||||
$_opsi = '';
|
||||
if (!empty($change)) $_opsi .= ' ochan="'.$change.'"';
|
||||
if ($enable===false) $_opsi .= ' disabled=true';
|
||||
@@ -69,7 +69,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function option_db(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, ?string $table=null, ?array $afield=null, ?string $where=null, ?array $aarray=null, ?string $help=null, ?string $change=null, bool $multi=false): string {
|
||||
public function option_db(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, ?string $table=null, ?array $afield=null, ?string $where=null, ?array $aarray=null, ?string $help=null, ?string $change=null, bool $multi=false): string {
|
||||
$_twhere = '';
|
||||
if (!is_array($afield)) $afield = ["ID", "Nama", "Label"];
|
||||
if (!empty($where)) {
|
||||
@@ -87,7 +87,7 @@ final class Form {
|
||||
return $this->option($label, $field, $value, $enable, $req, $ahasil, $help, $change, $multi);
|
||||
}
|
||||
|
||||
public function option_que(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, ?string $query=null, ?array $afield=null, ?array $aarray=null, ?string $help=null, ?string $change=null): string {
|
||||
public function option_que(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, ?string $query=null, ?array $afield=null, ?array $aarray=null, ?string $help=null, ?string $change=null): string {
|
||||
if (!is_array($afield)) $afield = ["ID", "Nama", "Label"];
|
||||
$ahasil = [];
|
||||
if (is_array($aarray)) $ahasil[$aarray[0]] = (!isset($afield[2])) ? $aarray[1] : [$aarray[1], $aarray[2]];
|
||||
@@ -100,7 +100,7 @@ final class Form {
|
||||
return $this->option($label, $field, $value, $enable, $req, $ahasil, $help, $change);
|
||||
}
|
||||
|
||||
public function option_jkl(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, ?string $help=null, ?string $change=null): string {
|
||||
public function option_jkl(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, ?string $help=null, ?string $change=null): string {
|
||||
return $this->option($label, $field, $value, $enable, $req, ["L" => "Laki-Laki", "P" => "Perempuan"], $help, $change);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ final class Form {
|
||||
return $this->option($label, $field, $value, $enable, $req, $this->session->get('__WEB_APP')['USER_LEVEL'], $help, $change);
|
||||
}
|
||||
|
||||
public function radio(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
public function radio(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[0];
|
||||
$_opsi = '';
|
||||
@@ -136,7 +136,7 @@ final class Form {
|
||||
return $this->radio($label, $field, $value, $enable, $req, ["A"=>"A", "B"=>"B", "AB"=>"AB", "O"=>"O", "X"=>"NONE"], $help, $change);
|
||||
}
|
||||
|
||||
public function checkbox(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
public function checkbox(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[1];
|
||||
$_opsi = ' odata="'.htmlspecialchars(json_encode($arr)).'"';
|
||||
@@ -150,7 +150,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function switch(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
public function switch(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, array $arr=[], ?string $help=null, ?string $change=null): string {
|
||||
$_val = array_values($arr);
|
||||
if (empty($value)) $value = $_val[1];
|
||||
$_opsi = ' odata="'.htmlspecialchars(json_encode($arr)).'"';
|
||||
@@ -164,7 +164,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textbox(string $label, string $field, string|int|null $value=null, bool $enable=true, bool $req=false, string $type="text", ?string $holdtxt=null, ?int $maxsize=null, ?string $help=null, ?string $keyup=null, ?string $blur=null): string {
|
||||
public function textbox(string $label, string $field, mixed $value=null, bool $enable=true, bool $req=false, string $type="text", ?string $holdtxt=null, ?int $maxsize=null, ?string $help=null, ?string $keyup=null, ?string $blur=null): string {
|
||||
$_opsi = '';
|
||||
if (!empty($keyup)) $_opsi .= ' okyup="'.$keyup.'"';
|
||||
if (!empty($blur)) $_opsi .= ' oblur="'.$blur.'"';
|
||||
@@ -178,7 +178,7 @@ final class Form {
|
||||
if ($type === 'double') $value = uang2($value);
|
||||
$type = "text";
|
||||
}
|
||||
$tout = '<input type="'.$type.'" class="form-control'.$_tclass.'" id="'.$field.'" name="'.$field.'" value="'.$value.'"'.$_opsi.' />';
|
||||
$tout = '<input type="'.$type.'" class="form-control'.$_tclass.'" id="'.$field.'" name="'.$field.'" value="'.(string)$value.'"'.$_opsi.' />';
|
||||
$this->__aform[$field] = [ 'label' => $label, 'help' => $help, 'form' => $tout ];
|
||||
return $tout;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function plaintext(string $label, string $field, string|int|null $value=null): string {
|
||||
public function plaintext(string $label, string $field, mixed $value=null): string {
|
||||
$tout = '<input type="text" class="form-control-plaintext" id="'.$field.'" name="'.$field.'" value="'.$value.'" readonly />';
|
||||
$this->__aform[$field] = ['label' => $label, 'help' => "", 'form' => $tout];
|
||||
return $tout;
|
||||
@@ -239,7 +239,7 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function hidden(string $field, string|int|null $value=null, string $class="text"): string {
|
||||
public function hidden(string $field, mixed $value=null, string $class="text"): string {
|
||||
$tout = '<input type="hidden" id="'.$field.'" value="'.$value.'" class="'.$class.'" />';
|
||||
$this->__ahide[$field] = $tout;
|
||||
return $tout;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
|
||||
@@ -30,7 +30,7 @@ final class Param {
|
||||
if (empty($app)) $app = \Flight::app();
|
||||
$_asumber = array_merge($app->request()->query->getData(), $app->request()->data->getData());
|
||||
foreach ($_asumber as $__key => $__val) {
|
||||
self::$__ahasil[$__key] = self::safeSQL($__val);
|
||||
self::$__ahasil[$__key] = is_string($__val) ? self::safeSQL($__val) : $__val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-23
@@ -6,50 +6,40 @@
|
||||
Desc. : Class Registrasi Aplikasi
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : November 23th, 2011.
|
||||
Last Modified : August 11th, 2026.
|
||||
Last Modified : August 22nd, 2026.
|
||||
|
||||
(c) 2011 - 2026, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
//OK
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\Session;
|
||||
use flight\database\SimplePdo;
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
use \flight\database\SimplePdo;
|
||||
|
||||
final class Register {
|
||||
protected Engine $app;
|
||||
protected SimplePdo $db;
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Engine $app, SimplePdo $db, Session $session){
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->session = $session;
|
||||
public function __construct(){
|
||||
}
|
||||
|
||||
public static function reg_id() {
|
||||
$webapp = (array)\Flight::app()->session()->get('__WEB_APP');
|
||||
$id = (string)$webapp['REG_ID'] ?? '';
|
||||
public static function reg_id(Session $session) {
|
||||
$id = (string)$session->get('__WEB_APP', ['REG_ID'=>''])['REG_ID'];
|
||||
return (substr($id,0,3).".".substr($id,3,3).".".substr($id,6));
|
||||
}
|
||||
|
||||
public static function reg_code() {
|
||||
$webapp = (array)\Flight::app()->session()->get('__WEB_APP');
|
||||
$id = (string)$webapp['REG_CODE'] ?? '';
|
||||
public static function reg_code(Session $session) {
|
||||
$id = (string)$session->get('__WEB_APP', ['REG_CODE'=>''])['REG_CODE'];
|
||||
return (substr($id,0,6)."-".substr($id,6,5)."-".substr($id,11,5)."-".substr($id,16,5)."-".substr($id,21,5)."-".substr($id,26,6));
|
||||
}
|
||||
|
||||
static function reg_check(Session $session) {//oke
|
||||
public static function reg_check(Session $session) {
|
||||
$webapp = $session->get('__WEB_APP');
|
||||
return (bool)(isset($webapp['REG_STATUS']) && $webapp['REG_STATUS']) ?? false;
|
||||
}
|
||||
|
||||
static function reg_status(SimplePdo $db, array $apps) {//oke
|
||||
public static function reg_status(SimplePdo $db, array $apps) {
|
||||
$kode_db = (bool)$db->fetchField('SELECT UPPER(CONVERT(MD5(CONCAT(REG_YEAR,CONVERT(MD5(CONCAT(REG_ID,REG_NAME)) using latin1),REG_ID,REG_NAME)) using latin1))=REG_CODE FROM app_config WHERE REG_ID=?', [$apps['APP_CODE'] ?? '']);
|
||||
return [ 'REG_STATUS' => $kode_db === true ];
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\database\SimplePdo;
|
||||
@@ -81,7 +81,7 @@ final class Table {
|
||||
}
|
||||
|
||||
public function set_row_color(string $field = "", string $val = "", string $css = ""): void {
|
||||
if (epmty($field)) return;
|
||||
if (empty($field)) return;
|
||||
$this->__arowcol[] = [ 'F' => $field, 'V' => $val, 'C' => $css ];
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
final class Terbilang {
|
||||
private $numb = ["","Satu","Dua","Tiga","Empat","Lima","Enam","Tujuh","Delapan","Sembilan"];
|
||||
|
||||
+10
-13
@@ -14,14 +14,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace siaupheng\webapp\Web;
|
||||
namespace Webapp\Web;
|
||||
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
|
||||
final class Update {
|
||||
protected Array $__conf = [];
|
||||
protected Bool $is_git = false;
|
||||
private Array $__conf = [];
|
||||
private Bool $is_git = false;
|
||||
protected Engine $app;
|
||||
|
||||
public function __construct(Engine $app, Session $session){
|
||||
@@ -30,10 +30,8 @@ final class Update {
|
||||
$this->current();
|
||||
}
|
||||
|
||||
public function current() {
|
||||
$_target = $this->__conf['REAL_PATH'];
|
||||
if (isset($_target)) chdir($_target);
|
||||
|
||||
public function current(): void {
|
||||
if (defined('PROJECT_ROOT')) chdir(PROJECT_ROOT);
|
||||
try {
|
||||
$output = shell_exec("git log -1 --pretty=format:\"%H||%s||%ci\" --abbrev-commit 2>&1");
|
||||
if ($output) {
|
||||
@@ -57,7 +55,7 @@ final class Update {
|
||||
}
|
||||
}
|
||||
|
||||
public function check() {
|
||||
public function check(): array {
|
||||
$_ainfo['cur_version'] = $this->__conf['APP_BUILD'];
|
||||
$_ainfo['cur_sha'] = substr($this->__conf['GIT_SHA1'], 0, 10);
|
||||
$_ainfo['cur_sha1'] = $this->__conf['GIT_SHA1'];
|
||||
@@ -89,14 +87,13 @@ final class Update {
|
||||
return $_ainfo;
|
||||
}
|
||||
|
||||
public function go() {
|
||||
$_target = $this->__conf['REAL_PATH'];
|
||||
public function go(): array {
|
||||
$_branch = $this->__conf['GIT_BRANCH'] ?? "main";
|
||||
if (isset($_target)) {
|
||||
chdir($_target);
|
||||
if (defined('PROJECT_ROOT')) {
|
||||
chdir(PROJECT_ROOT);
|
||||
$output = shell_exec("git reset --hard HEAD && git pull origin {$_branch} 2>&1");
|
||||
return ['success'=>true,'message'=>$output];
|
||||
} else return ['success'=>false,'message'=>"Tanpa REAL_PATH !"];
|
||||
} else return ['success'=>false,'message'=>"Tanpa PROJECT_ROOT !"];
|
||||
}
|
||||
|
||||
public function mysql() {
|
||||
|
||||
Reference in New Issue
Block a user