BREAKING CRON CHANGES: must generate a cron key before using cron. Cron will need updated like so php /full/path/to/cron.php [KEY] and same with cron_ticket_parse.php
This commit is contained in:
@@ -20,6 +20,7 @@ $company_currency = $row['company_currency'];
|
||||
|
||||
// Company Settings
|
||||
$config_enable_cron = intval($row['config_enable_cron']);
|
||||
$config_cron_key = $row['config_cron_key'];
|
||||
$config_invoice_overdue_reminders = $row['config_invoice_overdue_reminders'];
|
||||
$config_invoice_prefix = $row['config_invoice_prefix'];
|
||||
$config_invoice_from_email = $row['config_invoice_from_email'];
|
||||
@@ -39,6 +40,7 @@ $config_ticket_next_number = intval($row['config_ticket_next_number']);
|
||||
$config_ticket_from_name = $row['config_ticket_from_name'];
|
||||
$config_ticket_from_email = $row['config_ticket_from_email'];
|
||||
$config_ticket_client_general_notifications = intval($row['config_ticket_client_general_notifications']);
|
||||
$config_ticket_autoclose = intval($row['config_ticket_autoclose']);
|
||||
|
||||
//Get Config for Telemetry
|
||||
$config_theme = $row['config_theme'];
|
||||
@@ -51,98 +53,107 @@ $config_telemetry = intval($row['config_telemetry']);
|
||||
// Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
// Check cron is enabled
|
||||
if ($config_enable_cron == 1) {
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
/*
|
||||
// Check cron is enabled
|
||||
if ($config_enable_cron == 0) {
|
||||
exit("Cron: is not enabled -- Quitting..");
|
||||
}
|
||||
|
||||
// Check Cron Key
|
||||
if ($argv[1] !== $config_cron_key) {
|
||||
exit("Cron Key invalid -- Quitting..");
|
||||
}
|
||||
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* STARTUP ACTIONS
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Started', log_description = 'Cron started for $company_name'");
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Started', log_description = 'Cron started for $company_name'");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* CLEAN UP (OLD) DATA
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
|
||||
// Clean-up ticket views table used for collision detection
|
||||
mysqli_query($mysqli, "TRUNCATE TABLE ticket_views");
|
||||
// Clean-up ticket views table used for collision detection
|
||||
mysqli_query($mysqli, "TRUNCATE TABLE ticket_views");
|
||||
|
||||
// Clean-up shared items that have been used
|
||||
mysqli_query($mysqli, "DELETE FROM shared_items WHERE item_views = item_view_limit");
|
||||
// Clean-up shared items that have been used
|
||||
mysqli_query($mysqli, "DELETE FROM shared_items WHERE item_views = item_view_limit");
|
||||
|
||||
// Clean-up shared items that have expired
|
||||
mysqli_query($mysqli, "DELETE FROM shared_items WHERE item_expire_at < NOW()");
|
||||
// Clean-up shared items that have expired
|
||||
mysqli_query($mysqli, "DELETE FROM shared_items WHERE item_expire_at < NOW()");
|
||||
|
||||
// Invalidate any password reset links
|
||||
mysqli_query($mysqli, "UPDATE contacts SET contact_password_reset_token = NULL WHERE contact_archived_at IS NULL");
|
||||
// Invalidate any password reset links
|
||||
mysqli_query($mysqli, "UPDATE contacts SET contact_password_reset_token = NULL WHERE contact_archived_at IS NULL");
|
||||
|
||||
// Clean-up old dismissed notifications
|
||||
mysqli_query($mysqli, "DELETE FROM notifications WHERE notification_dismissed_at < CURDATE() - INTERVAL 90 DAY");
|
||||
// Clean-up old dismissed notifications
|
||||
mysqli_query($mysqli, "DELETE FROM notifications WHERE notification_dismissed_at < CURDATE() - INTERVAL 90 DAY");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron cleaned up old data'");
|
||||
//Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron cleaned up old data'");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* REFRESH DATA
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
// 2023-02-20 JQ Commenting this code out as its intermitently breaking cron executions, investigating
|
||||
// ERROR
|
||||
// php cron.php
|
||||
// PHP Fatal error: Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in cron.php:141
|
||||
// Stack trace:
|
||||
//#0 cron.php(141): mysqli_fetch_array()
|
||||
//#1 {main}
|
||||
// thrown in cron.php on line 141
|
||||
// END ERROR
|
||||
// REFRESH DOMAIN WHOIS DATA (1 a day)
|
||||
// Get the oldest updated domain (MariaDB shows NULLs first when ordering by default)
|
||||
//$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT domain_id, domain_name FROM `domains` ORDER BY domain_updated_at LIMIT 1"));
|
||||
// 2023-02-20 JQ Commenting this code out as its intermitently breaking cron executions, investigating
|
||||
// ERROR
|
||||
// php cron.php
|
||||
// PHP Fatal error: Uncaught TypeError: mysqli_fetch_array(): Argument #1 ($result) must be of type mysqli_result, bool given in cron.php:141
|
||||
// Stack trace:
|
||||
//#0 cron.php(141): mysqli_fetch_array()
|
||||
//#1 {main}
|
||||
// thrown in cron.php on line 141
|
||||
// END ERROR
|
||||
// REFRESH DOMAIN WHOIS DATA (1 a day)
|
||||
// Get the oldest updated domain (MariaDB shows NULLs first when ordering by default)
|
||||
//$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT domain_id, domain_name FROM `domains` ORDER BY domain_updated_at LIMIT 1"));
|
||||
|
||||
//if ($row) {
|
||||
// $domain_id = intval($row['domain_id']);
|
||||
// $domain_name = sanitizeInput($row['domain_name']);
|
||||
//if ($row) {
|
||||
// $domain_id = intval($row['domain_id']);
|
||||
// $domain_name = sanitizeInput($row['domain_name']);
|
||||
|
||||
// $expire = getDomainExpirationDate($domain_name);
|
||||
// $records = getDomainRecords($domain_name);
|
||||
// $a = sanitizeInput($records['a']);
|
||||
// $ns = sanitizeInput($records['ns']);
|
||||
// $mx = sanitizeInput($records['mx']);
|
||||
// $txt = sanitizeInput($records['txt']);
|
||||
// $whois = sanitizeInput($records['whois']);
|
||||
// $expire = getDomainExpirationDate($domain_name);
|
||||
// $records = getDomainRecords($domain_name);
|
||||
// $a = sanitizeInput($records['a']);
|
||||
// $ns = sanitizeInput($records['ns']);
|
||||
// $mx = sanitizeInput($records['mx']);
|
||||
// $txt = sanitizeInput($records['txt']);
|
||||
// $whois = sanitizeInput($records['whois']);
|
||||
|
||||
// Update the domain
|
||||
// mysqli_query($mysqli, "UPDATE domains SET domain_name = '$domain_name', domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois' WHERE domain_id = $domain_id");
|
||||
//}
|
||||
// mysqli_query($mysqli, "UPDATE domains SET domain_name = '$domain_name', domain_expire = '$expire', domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois' WHERE domain_id = $domain_id");
|
||||
//}
|
||||
|
||||
|
||||
// TODO: Re-add the cert refresher
|
||||
// TODO: Re-add the cert refresher
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* ACTION DATA
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
|
||||
// GET NOTIFICATIONS
|
||||
// GET NOTIFICATIONS
|
||||
|
||||
// DOMAINS EXPIRING
|
||||
// DOMAINS EXPIRING
|
||||
|
||||
$domainAlertArray = [1,7,14,30,90,120];
|
||||
$domainAlertArray = [1,7,14,30,90,120];
|
||||
|
||||
foreach ($domainAlertArray as $day) {
|
||||
foreach ($domainAlertArray as $day) {
|
||||
|
||||
//Get Domains Expiring
|
||||
$sql = mysqli_query(
|
||||
@@ -163,15 +174,15 @@ if ($config_enable_cron == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for domain expiring'");
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for domain expiring'");
|
||||
|
||||
// CERTIFICATES EXPIRING
|
||||
// CERTIFICATES EXPIRING
|
||||
|
||||
$certificateAlertArray = [1,7,14,30,90,120];
|
||||
$certificateAlertArray = [1,7,14,30,90,120];
|
||||
|
||||
foreach ($certificateAlertArray as $day) {
|
||||
foreach ($certificateAlertArray as $day) {
|
||||
|
||||
//Get Certs Expiring
|
||||
$sql = mysqli_query(
|
||||
@@ -193,15 +204,15 @@ if ($config_enable_cron == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for certificates expiring'");
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for certificates expiring'");
|
||||
|
||||
// Asset Warranties Expiring
|
||||
// Asset Warranties Expiring
|
||||
|
||||
$warranty_alert_array = [1,7,14,30,90,120];
|
||||
$warranty_alert_array = [1,7,14,30,90,120];
|
||||
|
||||
foreach ($warranty_alert_array as $day) {
|
||||
foreach ($warranty_alert_array as $day) {
|
||||
|
||||
//Get Asset Warranty Expiring
|
||||
$sql = mysqli_query(
|
||||
@@ -222,20 +233,20 @@ if ($config_enable_cron == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for asset warranties expiring'");
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for asset warranties expiring'");
|
||||
|
||||
// Scheduled tickets
|
||||
// Scheduled tickets
|
||||
|
||||
// Get date for search
|
||||
$today = new DateTime();
|
||||
$today_text = $today->format('Y-m-d');
|
||||
// Get date for search
|
||||
$today = new DateTime();
|
||||
$today_text = $today->format('Y-m-d');
|
||||
|
||||
// Get scheduled tickets for today
|
||||
$sql_scheduled_tickets = mysqli_query($mysqli, "SELECT * FROM scheduled_tickets WHERE scheduled_ticket_next_run = '$today_text'");
|
||||
// Get scheduled tickets for today
|
||||
$sql_scheduled_tickets = mysqli_query($mysqli, "SELECT * FROM scheduled_tickets WHERE scheduled_ticket_next_run = '$today_text'");
|
||||
|
||||
if (mysqli_num_rows($sql_scheduled_tickets) > 0) {
|
||||
if (mysqli_num_rows($sql_scheduled_tickets) > 0) {
|
||||
while ($row = mysqli_fetch_array($sql_scheduled_tickets)) {
|
||||
$schedule_id = intval($row['scheduled_ticket_id']);
|
||||
$subject = sanitizeInput($row['scheduled_ticket_subject']);
|
||||
@@ -331,14 +342,17 @@ if ($config_enable_cron == 1) {
|
||||
$a = mysqli_query($mysqli, "UPDATE scheduled_tickets SET scheduled_ticket_next_run = '$next_run' WHERE scheduled_ticket_id = $schedule_id");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created sent out scheduled tickets'");
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created sent out scheduled tickets'");
|
||||
|
||||
|
||||
// AUTO CLOSE TICKET - CLOSE
|
||||
// Automatically silently closes tickets 22 hrs after the last chase
|
||||
// AUTO CLOSE TICKET - CLOSE
|
||||
// Automatically silently closes tickets 22 hrs after the last chase
|
||||
|
||||
// Check to make sure autoclose is enabled
|
||||
if ($config_ticket_autoclose == 1) {
|
||||
$sql_tickets_to_chase = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM tickets
|
||||
@@ -407,13 +421,14 @@ if ($config_enable_cron == 1) {
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket Reply', log_action = 'Create', log_description = 'Auto close chaser email sent to $contact_email for ticket $ticket_prefix$ticket_number - $ticket_subject', log_client_id = $client_id");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PAST DUE INVOICE Notifications
|
||||
//$invoiceAlertArray = [$config_invoice_overdue_reminders];
|
||||
$invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620];
|
||||
// PAST DUE INVOICE Notifications
|
||||
//$invoiceAlertArray = [$config_invoice_overdue_reminders];
|
||||
$invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620];
|
||||
|
||||
foreach ($invoiceAlertArray as $day) {
|
||||
foreach ($invoiceAlertArray as $day) {
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
@@ -474,16 +489,16 @@ if ($config_enable_cron == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for past due invoices and sent out notifications to the primary contacts email'");
|
||||
}
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created notifications for past due invoices and sent out notifications to the primary contacts email'");
|
||||
|
||||
//Send Recurring Invoices that match todays date and are active
|
||||
//Send Recurring Invoices that match todays date and are active
|
||||
|
||||
//Loop through all recurring that match today's date and is active
|
||||
$sql_recurring = mysqli_query($mysqli, "SELECT * FROM recurring LEFT JOIN clients ON client_id = recurring_client_id WHERE recurring_next_date = CURDATE() AND recurring_status = 1");
|
||||
//Loop through all recurring that match today's date and is active
|
||||
$sql_recurring = mysqli_query($mysqli, "SELECT * FROM recurring LEFT JOIN clients ON client_id = recurring_client_id WHERE recurring_next_date = CURDATE() AND recurring_status = 1");
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_recurring)) {
|
||||
while ($row = mysqli_fetch_array($sql_recurring)) {
|
||||
$recurring_id = intval($row['recurring_id']);
|
||||
$recurring_scope = sanitizeInput($row['recurring_scope']);
|
||||
$recurring_frequency = sanitizeInput($row['recurring_frequency']);
|
||||
@@ -593,14 +608,14 @@ if ($config_enable_cron == 1) {
|
||||
}
|
||||
|
||||
} //End if Autosend is on
|
||||
} //End Recurring Invoices Loop
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created invoices from recurring invoices and sent emails out'");
|
||||
} //End Recurring Invoices Loop
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Task', log_description = 'Cron created invoices from recurring invoices and sent emails out'");
|
||||
|
||||
|
||||
// TELEMETRY
|
||||
// TELEMETRY
|
||||
|
||||
if ($config_telemetry == 1) {
|
||||
if ($config_telemetry == 1) {
|
||||
|
||||
$current_version = exec("git rev-parse HEAD");
|
||||
|
||||
@@ -838,22 +853,18 @@ if ($config_enable_cron == 1) {
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Telemetry', log_description = 'Cron sent telemetry results to ITFlow Developers'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* FINISH UP
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
|
||||
// Send Alert to inform Cron was run
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Cron.php successfully executed'");
|
||||
// Send Alert to inform Cron was run
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron', notification = 'Cron.php successfully executed'");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Ended', log_description = 'Cron executed successfully for $company_name'");
|
||||
|
||||
|
||||
}
|
||||
// End Cron enabled check
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron', log_action = 'Ended', log_description = 'Cron executed successfully for $company_name'");
|
||||
|
||||
@@ -29,6 +29,13 @@ if ($config_ticket_email_parse == 0) {
|
||||
exit("Email Parser: Feature is not enabled - check Settings > Ticketing > Email-to-ticket parsing. See https://docs.itflow.org/ticket_email_parse -- Quitting..");
|
||||
}
|
||||
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
// Check Cron Key
|
||||
if ($argv[1] !== $config_cron_key) {
|
||||
exit("Cron Key invalid -- Quitting..");
|
||||
}
|
||||
|
||||
// Check IMAP extension works/installed
|
||||
if (!function_exists('imap_open')) {
|
||||
exit("Email Parser: PHP IMAP extension is not installed. See https://docs.itflow.org/ticket_email_parse -- Quitting..");
|
||||
|
||||
+13
-3
@@ -969,11 +969,21 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.1'");
|
||||
}
|
||||
|
||||
//if (CURRENT_DATABASE_VERSION == '0.5.1') {
|
||||
// Insert queries here required to update to DB version 0.5.2
|
||||
if (CURRENT_DATABASE_VERSION == '0.5.1') {
|
||||
//Insert queries here required to update to DB version 0.5.2
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_autoclose` TINYINT(1) NOT NULL DEFAULT 0 AFTER `config_ticket_client_general_notifications`");
|
||||
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_cron_key` VARCHAR(255) NULL DEFAULT NULL AFTER `config_enable_cron`");
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.2'");
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.2'");
|
||||
}
|
||||
|
||||
//if (CURRENT_DATABASE_VERSION == '0.5.2') {
|
||||
//Insert queries here required to update to DB version 0.5.3
|
||||
|
||||
// Then, update the database to the next sequential version
|
||||
//mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.5.3'");
|
||||
//}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.5.1");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "0.5.2");
|
||||
|
||||
+4
-1
@@ -59,10 +59,13 @@ $config_ticket_from_name = $row['config_ticket_from_name'];
|
||||
$config_ticket_from_email = $row['config_ticket_from_email'];
|
||||
$config_ticket_email_parse = intval($row['config_ticket_email_parse']);
|
||||
$config_ticket_client_general_notifications = intval($row['config_ticket_client_general_notifications']);
|
||||
$config_ticket_autoclose = intval($row['config_ticket_autoclose']);
|
||||
|
||||
// Alerts
|
||||
// Cron
|
||||
$config_enable_cron = intval($row['config_enable_cron']);
|
||||
$config_cron_key = $row['config_cron_key'];
|
||||
|
||||
// Alerts & Notifications
|
||||
$config_recurring_auto_send_invoice = intval($row['config_recurring_auto_send_invoice']);
|
||||
$config_enable_alert_domain_expire = intval($row['config_enable_alert_domain_expire']);
|
||||
$config_send_invoice_reminders = intval($row['config_send_invoice_reminders']);
|
||||
|
||||
@@ -682,8 +682,9 @@ if(isset($_POST['edit_ticket_settings'])){
|
||||
$config_ticket_from_name = sanitizeInput($_POST['config_ticket_from_name']);
|
||||
$config_ticket_email_parse = intval($_POST['config_ticket_email_parse']);
|
||||
$config_ticket_client_general_notifications = intval($_POST['config_ticket_client_general_notifications']);
|
||||
$config_ticket_autoclose = intval($_POST['config_ticket_autoclose']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_ticket_prefix = '$config_ticket_prefix', config_ticket_next_number = $config_ticket_next_number, config_ticket_from_email = '$config_ticket_from_email', config_ticket_from_name = '$config_ticket_from_name', config_ticket_email_parse = '$config_ticket_email_parse', config_ticket_client_general_notifications = $config_ticket_client_general_notifications WHERE company_id = 1");
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_ticket_prefix = '$config_ticket_prefix', config_ticket_next_number = $config_ticket_next_number, config_ticket_from_email = '$config_ticket_from_email', config_ticket_from_name = '$config_ticket_from_name', config_ticket_email_parse = '$config_ticket_email_parse', config_ticket_client_general_notifications = $config_ticket_client_general_notifications , config_ticket_autoclose = $config_ticket_autoclose WHERE company_id = 1");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified ticket settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
@@ -739,6 +740,7 @@ if(isset($_POST['edit_alert_settings'])){
|
||||
validateAdminRole();
|
||||
|
||||
$config_enable_cron = intval($_POST['config_enable_cron']);
|
||||
$config_cron_key = sanitizeInput($_POST['config_cron_key']);
|
||||
$config_enable_alert_domain_expire = intval($_POST['config_enable_alert_domain_expire']);
|
||||
$config_send_invoice_reminders = intval($_POST['config_send_invoice_reminders']);
|
||||
$config_invoice_overdue_reminders = sanitizeInput($_POST['config_invoice_overdue_reminders']);
|
||||
@@ -754,6 +756,22 @@ if(isset($_POST['edit_alert_settings'])){
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['generate_cron_key'])){
|
||||
validateAdminRole();
|
||||
|
||||
$key = randomString(32);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE settings SET config_cron_key = '$key' WHERE company_id = 1");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name regenerated cron key', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Cron key regenerated!";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_online_payment_settings'])){
|
||||
|
||||
validateAdminRole();
|
||||
|
||||
@@ -15,6 +15,19 @@ require_once("inc_all_settings.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Cron Key</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="config_cron_key" placeholder="Generate a CRON Key" value="<?php echo htmlentities($config_cron_key); ?>" readonly>
|
||||
<div class="input-group-append">
|
||||
<a href="post.php?generate_cron_key" class="btn btn-secondary"><i class="fas fa-fw fa-sync mr-2"></i>Generate</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="config_enable_alert_domain_expire" <?php if ($config_enable_alert_domain_expire == 1) { echo "checked"; } ?> value="1" id="alertDomainExpireSwitch">
|
||||
|
||||
@@ -62,6 +62,14 @@ require_once("inc_all_settings.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" name="config_ticket_autoclose" <?php if($config_ticket_autoclose == 1){ echo "checked"; } ?> value="1" id="ticketAutoCloseSwitch">
|
||||
<label class="custom-control-label" for="ticketAutoCloseSwitch">Enable Autoclose Tickets <small class="text-secondary">(If no response is received after 48 hrs, a chaser email is sent mentioning "This is an automatic friendly reminder that your ticket regarding "Test ticket" will be closed, unless you respond", including the last public technician response for reference
|
||||
If no response is received after a further 22 hrs (70 total since ticket was put in auto close), the ticket is silently closed. (Note: I chose 70 hrs to help prevent situations where the chaser email is sent twice - feel free to adjust as needed))</small></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<button type="submit" name="edit_ticket_settings" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
|
||||
Reference in New Issue
Block a user