User Inbox

This commit is contained in:
Ibnu Maksum
2024-08-05 10:05:10 +07:00
parent 150f9a5c41
commit be507a013a
6 changed files with 130 additions and 69 deletions

View File

@ -44,16 +44,17 @@ class Text
return $result;
}
public static function maskText($text){
public static function maskText($text)
{
$len = strlen($text);
if($len < 3){
if ($len < 3) {
return "***";
}else if($len<5){
return substr($text,0,1)."***".substr($text,-1,1);
}else if($len<8){
return substr($text,0,2)."***".substr($text,-2,2);
}else{
return substr($text,0,4)."******".substr($text,-3,3);
} else if ($len < 5) {
return substr($text, 0, 1) . "***" . substr($text, -1, 1);
} else if ($len < 8) {
return substr($text, 0, 2) . "***" . substr($text, -2, 2);
} else {
return substr($text, 0, 4) . "******" . substr($text, -3, 3);
}
}
@ -61,4 +62,9 @@ class Text
{
return preg_replace("/[^A-Za-z0-9]/", '_', $str);;
}
public static function is_html($string)
{
return preg_match("/<[^<]+>/", $string, $m) != 0;
}
}

View File

@ -20,11 +20,26 @@ switch ($action) {
$mail->date_read = date('Y-m-d H:i:s');
$mail->save();
}
$next = ORM::for_table('tbl_customers_inbox')->select("id")->where('customer_id', $user['id'])->where_gt("id", $routes['2'])->order_by_asc("id")->find_one();
$prev = ORM::for_table('tbl_customers_inbox')->select("id")->where('customer_id', $user['id'])->where_lt("id", $routes['2'])->order_by_desc("id")->find_one();
$ui->assign('next', $next['id']);
$ui->assign('prev', $prev['id']);
$ui->assign('mail', $mail);
$ui->assign('tipe', 'view');
$ui->assign('_system_menu', 'inbox');
$ui->assign('_title', Lang::T('Inbox'));
$ui->display('user-inbox.tpl');
break;
case 'delete':
if($routes['2']){
if(ORM::for_table('tbl_customers_inbox')->where('customer_id', $user['id'])->where('id', $routes['2'])->find_one()->delete()){
r2(U. 'mail', 's', Lang::T('Mail Deleted Successfully'));
}else{
r2(U. 'home', 'e', Lang::T('Failed to Delete Message'));
}
break;
}
default:
$q = _req('q');
$limit = 40;

View File

@ -685,6 +685,8 @@
"Channel": "Channel",
"Payment_Link": "Payment Link",
"Created": "Created",
"2": "2",
"_": "-"
"Previous": "Previous",
"Share": "Share",
"Mail_Deleted_Successfully": "Mail Deleted Successfully",
"Message_Not_Found": "Message Not Found"
}

View File

@ -135,6 +135,6 @@
"ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';"
],
"2024.8.2" : [
"CREATE TABLE IF NOT EXISTS `tbl_customers_inbox` (`id` int UNSIGNED NOT NULL AUTO_INCREMENT, `customer_id` int NOT NULL, `date_created` datetime NOT NULL, `date_read` datetime DEFAULT NULL, `subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL, `body` varchar(512) COLLATE utf8mb4_general_ci NOT NULL, `from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"
"CREATE TABLE IF NOT EXISTS `tbl_customers_inbox` (`id` int UNSIGNED NOT NULL AUTO_INCREMENT, `customer_id` int NOT NULL, `date_created` datetime NOT NULL, `date_read` datetime DEFAULT NULL, `subject` varchar(64) COLLATE utf8mb4_general_ci NOT NULL, `body` TEXT NULL DEFAULT NULL, `from` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'System' COMMENT 'System or Admin or Else',`admin_id` int NOT NULL DEFAULT '0' COMMENT 'other than admin is 0', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;"
]
}