Refactor PoleDisplay class and update Auth user_log method

- Converted PoleDisplay from a function-based structure to a class-based structure for improved readability and maintainability.
- Simplified the Open and Close methods to handle port state more clearly.
- Enhanced the Send method to support both string and array inputs for sending data.
- Updated the cd_Text method to use modern JavaScript features for padding calculations.
- Modified the user_log method in Auth class to streamline database fetch and update logic.
This commit is contained in:
2026-11-01 15:55:28 +07:00
parent cf100a86e2
commit 929f3af79a
4 changed files with 992 additions and 1195 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
Module : /App/Auth.php
Created By : Siau Pheng ([email protected]).
Created Date : March 16th, 2008.
Last Modified : October 21st, 2026.
Last Modified : October 31st, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
@@ -86,8 +86,8 @@ final class Auth {
public function user_log(): void {
$_user_id = $this->session->get('WEB_USER')['UserID'] ?? 0;
if ($_user_id === 0) return;
$a_hasil = $this->db->fetchRow('SELECT * FROM app_logs WHERE UserID=? ORDER BY Last_Date DESC LIMIT 1', [$_user_id])->getData();
if (count($a_hasil) > 0) {
$a_hasil = $this->db->fetchRow('SELECT * FROM app_logs WHERE UserID=? ORDER BY Last_Date DESC LIMIT 1', [$_user_id]);
if ($a_hasil) {
$this->db->update('app_operator', [ 'Last_IP' => $a_hasil['Last_IP'], 'Last_Date' => $a_hasil['Last_Date'] ], 'UserID=?', [$_user_id]);
}
$this->db->runQuery('INSERT IGNORE INTO app_logs SELECT UserID,Token,IP,DateStamp FROM app_token WHERE Token=?', [$this->session->get('APP_TOKEN')]);