From 234e5e3967c3395a380e109b2c8578adc2d023c7 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Thu, 17 Oct 2024 13:38:50 +0700 Subject: [PATCH] add try catch to handle invalid value --- system/controllers/home.php | 23 +++++++++++++++++++---- system/lan/english.json | 3 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/system/controllers/home.php b/system/controllers/home.php index 9242d832..25feace1 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -333,10 +333,25 @@ $unpaid = ORM::for_table('tbl_payment_gateway') ->find_one(); // check expired payments -if($unpaid && (strtotime($unpaid['expired_date']) < time() || strtotime($unpaid['created_date'], "+24 HOUR") < time())){ - $unpaid->status = 4; - $unpaid->save(); - $unpaid = []; +if ($unpaid) { + try { + if (strtotime($unpaid['expired_date']) < time()) { + $unpaid->status = 4; + $unpaid->save(); + $unpaid = []; + } + } catch (Throwable $e) { + } catch (Exception $e) { + } + try { + if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) { + $unpaid->status = 4; + $unpaid->save(); + $unpaid = []; + } + } catch (Throwable $e) { + } catch (Exception $e) { + } } $ui->assign('unpaid', $unpaids); diff --git a/system/lan/english.json b/system/lan/english.json index e719719e..bd424ffa 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -846,5 +846,6 @@ "If_you_just_update_PHPNuxBill_from_upload_files__try_click_Update": "If you just update PHPNuxBill from upload files, try click Update", "Update_PHPNuxBill": "Update PHPNuxBill", "Ask_Github_Community": "Ask Github Community", - "Ask_Telegram_Community": "Ask Telegram Community" + "Ask_Telegram_Community": "Ask Telegram Community", + "Transaction_History_List": "Transaction History List" } \ No newline at end of file