diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..c542bb0e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml index 3389016d..7494b984 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -1,5 +1,15 @@ + + + + + + @@ -14,7 +24,13 @@ - + + + + + \ No newline at end of file diff --git a/.idea/phpnuxbill.iml b/.idea/phpnuxbill.iml new file mode 100644 index 00000000..10e4516d --- /dev/null +++ b/.idea/phpnuxbill.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/system/controllers/settings.php b/system/controllers/settings.php index 739b2051..a81cbb15 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -216,6 +216,9 @@ switch ($action) { $_POST['man_fields_custom'] = isset($_POST['man_fields_custom']) ? 'yes' : 'no'; $enable_session_timeout = isset($_POST['enable_session_timeout']) ? 1 : 0; $_POST['enable_session_timeout'] = $enable_session_timeout; + $_POST['notification_reminder_1day'] = isset($_POST['notification_reminder_1day']) ? 'yes' : 'no'; + $_POST['notification_reminder_3days'] = isset($_POST['notification_reminder_3days']) ? 'yes' : 'no'; + $_POST['notification_reminder_7days'] = isset($_POST['notification_reminder_7days']) ? 'yes' : 'no'; // hide dashboard $_POST['hide_mrc'] = _post('hide_mrc', 'no'); diff --git a/system/cron_reminder.php b/system/cron_reminder.php index 437f77f5..7ff97386 100644 --- a/system/cron_reminder.php +++ b/system/cron_reminder.php @@ -23,7 +23,7 @@ run_hook('cronjob_reminder'); #HOOK echo "PHP Time\t" . date('Y-m-d H:i:s') . "\n"; $res = ORM::raw_execute('SELECT NOW() AS WAKTU;'); $statement = ORM::get_last_statement(); -$rows = array(); +$rows = []; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { echo "MYSQL Time\t" . $row['WAKTU'] . "\n"; } @@ -39,22 +39,35 @@ foreach ($d as $ds) { $p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one(); $c = ORM::for_table('tbl_customers')->where('id', $ds['customer_id'])->find_one(); if ($p['validity_unit'] == 'Period') { - // Postpaid price from field - $add_inv = User::getAttribute("Invoice", $ds['customer_id']); - if (empty ($add_inv) or $add_inv == 0) { - $price = $p['price']; - } else { - $price = $add_inv; - } - } else { + // Postpaid price from field + $add_inv = User::getAttribute("Invoice", $ds['customer_id']); + if (empty($add_inv) or $add_inv == 0) { $price = $p['price']; + } else { + $price = $add_inv; + } + } else { + $price = $p['price']; } - if ($ds['expiration'] == $day7) { - echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n"; - } else if ($ds['expiration'] == $day3) { - echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n"; - } else if ($ds['expiration'] == $day1) { - echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n"; + if ($ds['expiration'] == $day7 && $config['notification_reminder_7day'] == 'yes') { + try { + echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_7_day'), $config['user_notification_reminder']) . "\n"; + } catch (Exception $e) { + sendTelegram("Cron Reminder failed to send 7-day reminder to " . $ds['username'] . " Error: " . $e->getMessage()); + } + } else if ($ds['expiration'] == $day3 && $config['notification_reminder_3day'] == 'yes') { + try { + echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_3_day'), $config['user_notification_reminder']) . "\n"; + } catch (Exception $e) { + sendTelegram("Cron Reminder failed to send 3-day reminder to " . $ds['username'] . " Error: " . $e->getMessage()); + } + } else if ($ds['expiration'] == $day1 && $config['notification_reminder_1day'] == 'yes') { + try { + echo Message::sendPackageNotification($c, $p['name_plan'], $price, Lang::getNotifText('reminder_1_day'), $config['user_notification_reminder']) . "\n"; + } catch (Exception $e) { + sendTelegram("Cron Reminder failed to send 1-day reminder to " . $ds['username'] . " Error: " . $e->getMessage()); + } } + } } \ No newline at end of file diff --git a/system/lan/english.json b/system/lan/english.json index 4ab90dad..8d17c61f 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -1055,5 +1055,64 @@ "Structure": "Structure", "Dashboard_Widgets": "Dashboard Widgets", "User": "User", - "Save_sequence": "Save sequence" + "Save_sequence": "Save sequence", + "Captive_Portal_Dashboard": "Captive Portal Dashboard", + "Manage_Sliders": "Manage Sliders", + "Mailcruise_API_Settings": "Mailcruise API Settings", + "Slider_Settings": "Slider Settings", + "Advertisement_Settings": "Advertisement Settings", + "Trial_Authorization_Settings": "Trial Authorization Settings", + "Pages_Settings": "Pages Settings", + "Allow_Free_Trial": "Allow Free Trial", + "Allow_Member_Login": "Allow Member Login", + "Allow_Randomized_MAC": "Allow Randomized MAC", + "Mailcruise_API_Token": "Mailcruise API Token", + "Hotspot_Vouchers_Overview": "Hotspot Vouchers Overview", + "Transaction_History": "Transaction History", + "Mac_Address": "Mac Address", + "Mac_Status": "Mac Status", + "Block_Mac_Address": "Block Mac Address", + "Unblock_Mac_Address": "Unblock Mac Address", + "Captive_Portal_Sliders": "Captive Portal Sliders", + "Captive_Portal_Slider": "Captive Portal Slider", + "Image": "Image", + "Link": "Link", + "Button": "Button", + "Edit_Slider": "Edit Slider", + "Are_you_Sure_you_want_to_Delete_this_Slider_": "Are you Sure you want to Delete this Slider?", + "Settings_Saved": "Settings Saved", + "Add_Product": "Add Product", + "SN": "SN", + "Version": "Version", + "Upload_New_Version": "Upload New Version", + "Generate_Voucher": "Generate Voucher", + "Product_Name": "Product Name", + "Enter_Product_Name": "Enter Product Name", + "Product_Version": "Product Version", + "Enter_Product_Version": "Enter Product Version", + "Disable_Future_Updates": "Disable Future Updates", + "Mailcruise_Settings_Saved_Successfully": "Mailcruise Settings Saved Successfully", + "Location_Router_Name": "Location\/Router Name", + "License_Key": "License Key", + "New_Router_Name": "New Router Name", + "Invalid_plan_selected_": "Invalid plan selected.", + "Slider_Updated_Successfully": "Slider Updated Successfully", + "An_error_occurred__Please_report_issue_to_administrator__Thanks": "An error occurred, Please report issue to administrator. Thanks", + "This_will_export_to_CSV": "This will export to CSV", + "Order_": "Order ", + "This_will_deactivate_Customer_Plan__and_make_it_expired": "This will deactivate Customer Plan, and make it expired", + "This_will_sync_Customer_to_Mikrotik": "This will sync Customer to Mikrotik", + "Keep_Logs": "Keep Logs", + "Clear_old_logs_": "Clear old logs?", + "Clean_up_Logs": "Clean up Logs", + "Also_Working_for_freeradius": "Also Working for freeradius", + "Send_welcome_message": "Send welcome message", + "Notification_via": "Notification via", + "Continue_the_process_of_adding_Customer_Data_": "Continue the process of adding Customer Data?", + "Intervals": "Intervals", + "1_Day": "1 Day", + "3_Days": "3 Days", + "7_Days": "7 Days", + "Reminder_Notification_Intervals": "Reminder Notification Intervals", + "Reminder_Notify_Intervals": "Reminder Notify Intervals" } \ No newline at end of file diff --git a/ui/compiled/index.html b/ui/compiled/index.html deleted file mode 100644 index e69de29b..00000000 diff --git a/ui/ui/admin/settings/app.tpl b/ui/ui/admin/settings/app.tpl index c053ce39..5954d0bc 100644 --- a/ui/ui/admin/settings/app.tpl +++ b/ui/ui/admin/settings/app.tpl @@ -927,6 +927,24 @@ +
+
+ + + +