diff --git a/admin_mail_queue.php b/admin_mail_queue.php index a06c621dc..8d0e6364f 100644 --- a/admin_mail_queue.php +++ b/admin_mail_queue.php @@ -6,14 +6,6 @@ require_once "inc_all_admin.php"; - -//Initialize the HTML Purifier to prevent XSS -require "plugins/htmlpurifier/HTMLPurifier.standalone.php"; - -$purifier_config = HTMLPurifier_Config::createDefault(); -$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); -$purifier = new HTMLPurifier($purifier_config); - //Rebuild URL $url_query_strings_sort = http_build_query($get_copy); @@ -104,7 +96,6 @@ $email_recipient = nullable_htmlentities($row['email_recipient']); $email_recipient_name = nullable_htmlentities($row['email_recipient_name']); $email_subject = nullable_htmlentities($row['email_subject']); - $email_content = $purifier->purify($row['email_content']); $email_attempts = intval($row['email_attempts']); $email_queued_at = nullable_htmlentities($row['email_queued_at']); $email_failed_at = nullable_htmlentities($row['email_failed_at']); @@ -131,7 +122,9 @@ - + + + 3) { ?> @@ -146,22 +139,6 @@ - - diff --git a/admin_mail_queue_message_view.php b/admin_mail_queue_message_view.php new file mode 100644 index 000000000..ce44cd9e9 --- /dev/null +++ b/admin_mail_queue_message_view.php @@ -0,0 +1,77 @@ +set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); +$purifier = new HTMLPurifier($purifier_config); + +if (isset($_GET['email_id'])) { + $email_id = intval($_GET['email_id']); +} else { + echo "You dont belong here"; + exit(); +} + +$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id"); + +$row = mysqli_fetch_array($sql); + +$email_from = nullable_htmlentities($row['email_from']); +$email_from_name = nullable_htmlentities($row['email_from_name']); +$email_recipient = nullable_htmlentities($row['email_recipient']); +$email_recipient_name = nullable_htmlentities($row['email_recipient_name']); +$email_subject = nullable_htmlentities($row['email_subject']); +$email_content = $purifier->purify($row['email_content']); +$email_attempts = intval($row['email_attempts']); +$email_queued_at = nullable_htmlentities($row['email_queued_at']); +$email_failed_at = nullable_htmlentities($row['email_failed_at']); +$email_sent_at = nullable_htmlentities($row['email_sent_at']); +$email_status = intval($row['email_status']); +if ($email_status == 0) { + $email_status_display = "
Queued
"; +} elseif($email_status == 1) { + $email_status_display = "
Sending
"; +} elseif($email_status == 2) { + $email_status_display = "
Failed
$email_failed_at"; +} else { + $email_status_display = "
Sent
$email_sent_at"; +} + +?> + + + +
+ +
+
+
+
From: ($email_from)"; ?>
+
To: ($email_recipient)"; ?>
+
Subject:
+
+
+ +
+
+
+ +
+ + + +MAINTENANCE -
@@ -52,6 +49,16 @@ +
+ +
+
+ +
+ +
+
+
@@ -178,34 +185,7 @@
- - -
- -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
- -
-
-
+
diff --git a/client_software_edit_modal.php b/client_software_edit_modal.php index e379394d0..fcae235df 100644 --- a/client_software_edit_modal.php +++ b/client_software_edit_modal.php @@ -9,7 +9,6 @@
-
+
+ +
+
+ +
+ +
+
+
@@ -71,6 +80,10 @@
+ + +
+
@@ -203,34 +216,7 @@
- - -
- -
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
- -
-
-
+
diff --git a/client_vendors.php b/client_vendors.php index c07b44557..1807148b2 100644 --- a/client_vendors.php +++ b/client_vendors.php @@ -78,7 +78,6 @@ "> Vendor - Description Contact Website Action @@ -91,11 +90,6 @@ $vendor_id = intval($row['vendor_id']); $vendor_name = nullable_htmlentities($row['vendor_name']); $vendor_description = nullable_htmlentities($row['vendor_description']); - if (empty($vendor_description)) { - $vendor_description_display = "-"; - } else { - $vendor_description_display = $vendor_description; - } $vendor_account_number = nullable_htmlentities($row['vendor_account_number']); $vendor_contact_name = nullable_htmlentities($row['vendor_contact_name']); if (empty($vendor_contact_name)) { @@ -121,16 +115,18 @@ ?> - - - - -
- - - - + + +
+ +
+
+
+
+
+
+ + diff --git a/cron.php b/cron.php index f58781377..fbc1751f0 100644 --- a/cron.php +++ b/cron.php @@ -32,6 +32,7 @@ $config_invoice_from_name = sanitizeInput($row['config_invoice_from_name']); $config_invoice_late_fee_enable = intval($row['config_invoice_late_fee_enable']); $config_invoice_late_fee_percent = floatval($row['config_invoice_late_fee_percent']); +$config_timezone = sanitizeInput($row['config_timezone']); // Mail Settings $config_smtp_host = $row['config_smtp_host']; @@ -67,6 +68,9 @@ // Set Currency Format $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY); +// Set Timezone +date_default_timezone_set($config_timezone); + $argv = $_SERVER['argv']; // Check cron is enabled diff --git a/cron_certificate_refresher.php b/cron_certificate_refresher.php index ee92a51be..2b1cdc764 100644 --- a/cron_certificate_refresher.php +++ b/cron_certificate_refresher.php @@ -12,6 +12,10 @@ // Company Settings $config_enable_cron = intval($row['config_enable_cron']); $config_cron_key = $row['config_cron_key']; +$config_timezone = sanitizeInput($row['config_timezone']); + +// Set Timezone +date_default_timezone_set($config_timezone); $argv = $_SERVER['argv']; diff --git a/cron_domain_refresher.php b/cron_domain_refresher.php index 23def65dd..d76fc9199 100644 --- a/cron_domain_refresher.php +++ b/cron_domain_refresher.php @@ -12,6 +12,10 @@ // Company Settings $config_enable_cron = intval($row['config_enable_cron']); $config_cron_key = $row['config_cron_key']; +$config_timezone = sanitizeInput($row['config_timezone']); + +// Set Timezone +date_default_timezone_set($config_timezone); $argv = $_SERVER['argv']; diff --git a/cron_mail_queue.php b/cron_mail_queue.php index c2ce719a2..9ec952e8e 100644 --- a/cron_mail_queue.php +++ b/cron_mail_queue.php @@ -15,6 +15,10 @@ $config_smtp_password = $row['config_smtp_password']; $config_smtp_port = intval($row['config_smtp_port']); $config_smtp_encryption = $row['config_smtp_encryption']; +$config_timezone = sanitizeInput($row['config_timezone']); + +// Set Timezone +date_default_timezone_set($config_timezone); $argv = $_SERVER['argv']; diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index c70bf8047..2c9f14227 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -26,11 +26,15 @@ $config_ticket_prefix = sanitizeInput($config_ticket_prefix); $config_ticket_from_name = sanitizeInput($config_ticket_from_name); -// Get company name & phone -$sql = mysqli_query($mysqli, "SELECT company_name, company_phone FROM companies WHERE company_id = 1"); +// Get company name & phone & timezone +$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1"); $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); +$config_timezone = sanitizeInput($row['config_timezone']); + +// Set Timezone +date_default_timezone_set($config_timezone); // Check setting enabled if ($config_ticket_email_parse == 0) { diff --git a/global_search.php b/global_search.php index 418b8ca1c..14fceb2c2 100644 --- a/global_search.php +++ b/global_search.php @@ -2,6 +2,12 @@ require_once "inc_all.php"; +// Initialize the HTML Purifier to prevent XSS +require "plugins/htmlpurifier/HTMLPurifier.standalone.php"; + +$purifier_config = HTMLPurifier_Config::createDefault(); +$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]); +$purifier = new HTMLPurifier($purifier_config); if (isset($_GET['query'])) { @@ -93,14 +99,26 @@ ORDER BY asset_name DESC LIMIT 5" ); + $sql_ticket_replies = mysqli_query($mysqli,"SELECT * FROM ticket_replies + LEFT JOIN tickets ON ticket_reply_ticket_id = ticket_id + LEFT JOIN clients ON ticket_client_id = client_id + WHERE ticket_reply_archived_at IS NULL + AND (ticket_reply LIKE '%$query%') + ORDER BY ticket_id DESC, ticket_reply_id ASC LIMIT 20" + ); + $q = nullable_htmlentities($_GET['query']); ?> -

Search all things

-
+
+
+

Global Search

+
+
+ 0) { ?> @@ -617,11 +635,90 @@ -
+ 0) { ?> + + + +
+ +
+
+
Ticket Replies
+
+
+
'; + } + + $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); + $ticket_number = intval($row['ticket_number']); + $ticket_subject = nullable_htmlentities($row['ticket_subject']); + $client_id = intval($row['ticket_client_id']); + $client_name = nullable_htmlentities($row['client_name']); + + // Output the ticket header + ?> +
+
+

+ +

+
+ Open +
+
+
+ purify($row['ticket_reply']); + + // Output the ticket reply + ?> +
+ +
+ +
+
+
+
'; + } + ?> + +
- +
+ +
+ + + +
+ + \ No newline at end of file diff --git a/js/certificate_edit_modal.js b/js/certificate_edit_modal.js index 6ac93561f..4a64e321b 100644 --- a/js/certificate_edit_modal.js +++ b/js/certificate_edit_modal.js @@ -17,6 +17,7 @@ function populateCertificateEditModal(client_id, certificate_id) { document.getElementById("editCertificateHeader").innerText = certificate.certificate_name; document.getElementById("editCertificateId").value = certificate_id; document.getElementById("editCertificateName").value = certificate.certificate_name; + document.getElementById("editCertificateDescription").value = certificate.certificate_description; document.getElementById("editCertificateDomain").value = certificate.certificate_domain; document.getElementById("editCertificateIssuedBy").value = certificate.certificate_issued_by; document.getElementById("editCertificateExpire").value = certificate.certificate_expire; diff --git a/js/domain_edit_modal.js b/js/domain_edit_modal.js index c045869cd..e8a0b4d0f 100644 --- a/js/domain_edit_modal.js +++ b/js/domain_edit_modal.js @@ -17,6 +17,7 @@ function populateDomainEditModal(client_id, domain_id) { document.getElementById("editDomainHeader").innerText = domain.domain_name; document.getElementById("editDomainId").value = domain_id; document.getElementById("editDomainName").value = domain.domain_name; + document.getElementById("editDomainDescription").value = domain.domain_description; document.getElementById("editDomainExpire").value = domain.domain_expire; document.getElementById("editDomainNotes").value = domain.domain_notes; document.getElementById("editDomainIP").value = domain.domain_ip; diff --git a/js/network_edit_modal.js b/js/network_edit_modal.js index f3716fb64..f2ba62cac 100644 --- a/js/network_edit_modal.js +++ b/js/network_edit_modal.js @@ -17,6 +17,7 @@ function populateNetworkEditModal(client_id, network_id) { document.getElementById("editNetworkHeader").innerText = network.network_name; document.getElementById("editNetworkId").value = network_id; document.getElementById("editNetworkName").value = network.network_name; + document.getElementById("editNetworkDescription").value = network.network_description; document.getElementById("editNetworkVlan").value = network.network_vlan; document.getElementById("editNetworkCidr").value = network.network; document.getElementById("editNetworkGw").value = network.network_gateway; diff --git a/post/certificate.php b/post/certificate.php index ec933db0a..a177974b5 100644 --- a/post/certificate.php +++ b/post/certificate.php @@ -10,6 +10,7 @@ $client_id = intval($_POST['client_id']); $name = sanitizeInput($_POST['name']); + $description = sanitizeInput($_POST['description']); $domain = sanitizeInput($_POST['domain']); $issued_by = sanitizeInput($_POST['issued_by']); $expire = sanitizeInput($_POST['expire']); @@ -33,7 +34,7 @@ $expire = "'" . $expire . "'"; } - mysqli_query($mysqli,"INSERT INTO certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = $expire, certificate_public_key = '$public_key', certificate_notes = '$notes', certificate_domain_id = $domain_id, certificate_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO certificates SET certificate_name = '$name', certificate_description = '$description', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = $expire, certificate_public_key = '$public_key', certificate_notes = '$notes', certificate_domain_id = $domain_id, certificate_client_id = $client_id"); $certificate_id = mysqli_insert_id($mysqli); @@ -52,6 +53,7 @@ $certificate_id = intval($_POST['certificate_id']); $name = sanitizeInput($_POST['name']); + $description = sanitizeInput($_POST['description']); $domain = sanitizeInput($_POST['domain']); $issued_by = sanitizeInput($_POST['issued_by']); $expire = sanitizeInput($_POST['expire']); @@ -76,7 +78,7 @@ $expire = "'" . $expire . "'"; } - mysqli_query($mysqli,"UPDATE certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = $expire, certificate_public_key = '$public_key', certificate_notes = '$notes', certificate_domain_id = '$domain_id' WHERE certificate_id = $certificate_id"); + mysqli_query($mysqli,"UPDATE certificates SET certificate_name = '$name', certificate_description = '$description', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = $expire, certificate_public_key = '$public_key', certificate_notes = '$notes', certificate_domain_id = '$domain_id' WHERE certificate_id = $certificate_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Certificate', log_action = 'Modify', log_description = '$session_name modified certificate $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $certificate_id"); @@ -189,12 +191,12 @@ $f = fopen('php://memory', 'w'); //set column headers - $fields = array('Name', 'Domain', 'Issuer', 'Expiration Date'); + $fields = array('Name', 'Description', 'Domain', 'Issuer', 'Expiration Date'); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer while($row = $sql->fetch_assoc()) { - $lineData = array($row['certificate_name'], $row['certificate_domain'], $row['certificate_issued_by'], $row['certificate_expire']); + $lineData = array($row['certificate_name'], $row['certificate_description'], $row['certificate_domain'], $row['certificate_issued_by'], $row['certificate_expire']); fputcsv($f, $lineData, $delimiter); } diff --git a/post/domain.php b/post/domain.php index e1a2d9ede..1fd4c99c8 100644 --- a/post/domain.php +++ b/post/domain.php @@ -10,6 +10,7 @@ $client_id = intval($_POST['client_id']); $name = preg_replace("(^https?://)", "", sanitizeInput($_POST['name'])); + $description = sanitizeInput($_POST['description']); $registrar = intval($_POST['registrar']); $webhost = intval($_POST['webhost']); $extended_log_description = ''; @@ -38,7 +39,7 @@ $whois = sanitizeInput($records['whois']); // Add domain record - mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes', domain_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO domains SET domain_name = '$name', domain_description = '$description', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes', domain_client_id = $client_id"); // Get inserted ID (for linking certificate, if exists) $domain_id = mysqli_insert_id($mysqli); @@ -69,6 +70,7 @@ $domain_id = intval($_POST['domain_id']); $name = preg_replace("(^https?://)", "", sanitizeInput($_POST['name'])); + $description = sanitizeInput($_POST['description']); $registrar = intval($_POST['registrar']); $webhost = intval($_POST['webhost']); $expire = sanitizeInput($_POST['expire']); @@ -102,7 +104,7 @@ $txt = sanitizeInput($records['txt']); $whois = sanitizeInput($records['whois']); - mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes' WHERE domain_id = $domain_id"); + mysqli_query($mysqli,"UPDATE domains SET domain_name = '$name', domain_description = '$description', domain_registrar = $registrar, domain_webhost = $webhost, domain_expire = $expire, domain_ip = '$a', domain_name_servers = '$ns', domain_mail_servers = '$mx', domain_txt = '$txt', domain_raw_whois = '$whois', domain_notes = '$notes' WHERE domain_id = $domain_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Domain', log_action = 'Modify', log_description = '$session_name modified domain $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $domain_id"); @@ -191,12 +193,12 @@ $f = fopen('php://memory', 'w'); //set column headers - $fields = array('Domain', 'Registrar', 'Web Host', 'Expiration Date'); + $fields = array('Domain', 'Description', 'Registrar', 'Web Host', 'Expiration Date'); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer while($row = $sql->fetch_assoc()) { - $lineData = array($row['domain_name'], $row['domain_registrar'], $row['domain_webhost'], $row['domain_expire']); + $lineData = array($row['domain_name'], $row['domain_description'], $row['domain_registrar'], $row['domain_webhost'], $row['domain_expire']); fputcsv($f, $lineData, $delimiter); } diff --git a/post/network.php b/post/network.php index ca1e35bac..36bcbca7e 100644 --- a/post/network.php +++ b/post/network.php @@ -10,6 +10,7 @@ $client_id = intval($_POST['client_id']); $name = sanitizeInput($_POST['name']); + $description = sanitizeInput($_POST['description']); $vlan = intval($_POST['vlan']); $network = sanitizeInput($_POST['network']); $gateway = sanitizeInput($_POST['gateway']); @@ -17,7 +18,7 @@ $notes = sanitizeInput($_POST['notes']); $location_id = intval($_POST['location']); - mysqli_query($mysqli,"INSERT INTO networks SET network_name = '$name', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id, network_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id, network_client_id = $client_id"); $network_id = mysqli_insert_id($mysqli); @@ -36,6 +37,7 @@ $network_id = intval($_POST['network_id']); $name = sanitizeInput($_POST['name']); + $description = sanitizeInput($_POST['description']); $vlan = intval($_POST['vlan']); $network = sanitizeInput($_POST['network']); $gateway = sanitizeInput($_POST['gateway']); @@ -44,7 +46,7 @@ $location_id = intval($_POST['location']); $client_id = intval($_POST['client_id']); - mysqli_query($mysqli,"UPDATE networks SET network_name = '$name', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id WHERE network_id = $network_id"); + mysqli_query($mysqli,"UPDATE networks SET network_name = '$name', network_description = '$description', network_vlan = $vlan, network = '$network', network_gateway = '$gateway', network_dhcp_range = '$dhcp_range', network_notes = '$notes', network_location_id = $location_id WHERE network_id = $network_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Network', log_action = 'Modify', log_description = '$session_name modified network $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $network_id"); @@ -156,12 +158,12 @@ $f = fopen('php://memory', 'w'); //set column headers - $fields = array('Name', 'vLAN', 'Network', 'Gateway', 'DHCP Range'); + $fields = array('Name', 'Description', 'vLAN', 'Network', 'Gateway', 'DHCP Range'); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer while($row = $sql->fetch_assoc()) { - $lineData = array($row['network_name'], $row['network_vlan'], $row['network'], $row['network_gateway'], $row['network_dhcp_range']); + $lineData = array($row['network_name'], $row['network_description'], $row['network_vlan'], $row['network'], $row['network_gateway'], $row['network_dhcp_range']); fputcsv($f, $lineData, $delimiter); } diff --git a/post/quote.php b/post/quote.php index 69c2075a0..c0a4fa92b 100644 --- a/post/quote.php +++ b/post/quote.php @@ -407,10 +407,10 @@ addToMailQueue($mysqli, $data); // Logging - mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Emailed Quote!', history_quote_id = $quote_id"); + mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Email Quote Queued', history_quote_id = $quote_id"); mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Quote', log_action = 'Email', log_description = '$session_name emailed Quote $quote_prefix$quote_number to $contact_email Email ID: ', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $quote_id"); - $_SESSION['alert_message'] = "Quote has been sent"; + $_SESSION['alert_message'] = "Quote has been queued successfully! Check Admin > Mail queue"; //Don't change the status to sent if the status is anything but draft if ($quote_status == 'Draft') { diff --git a/post/setting.php b/post/setting.php index fa99eed19..303c74909 100644 --- a/post/setting.php +++ b/post/setting.php @@ -184,7 +184,7 @@ $mail = addToMailQueue($mysqli, $data); if ($mail === true) { - $_SESSION['alert_message'] = "Test email queued successfully - Check Admin > Mail queue"; + $_SESSION['alert_message'] = "Test email queued successfully! Check Admin > Mail queue"; } else { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Failed to add test mail to queue"; diff --git a/post/software.php b/post/software.php index 4d412dd23..57c518922 100644 --- a/post/software.php +++ b/post/software.php @@ -12,11 +12,12 @@ $name = sanitizeInput($_POST['name']); $version = sanitizeInput($_POST['version']); + $description = sanitizeInput($_POST['description']); $type = sanitizeInput($_POST['type']); $license_type = sanitizeInput($_POST['license_type']); $notes = sanitizeInput($_POST['notes']); - mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_template = 1, software_client_id = 0"); + mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_template = 1, software_client_id = 0"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software Template', log_action = 'Create', log_description = '$session_user_name created software template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); @@ -34,11 +35,12 @@ $software_id = intval($_POST['software_id']); $name = sanitizeInput($_POST['name']); $version = sanitizeInput($_POST['version']); + $description = sanitizeInput($_POST['description']); $type = sanitizeInput($_POST['type']); $license_type = sanitizeInput($_POST['license_type']); $notes = sanitizeInput($_POST['notes']); - mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes' WHERE software_id = $software_id"); + mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes' WHERE software_id = $software_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software Teplate', log_action = 'Modify', log_description = '$session_name modified software template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); @@ -60,14 +62,15 @@ $row = mysqli_fetch_array($sql_software); - $name = sanitizeInput($_POST['name']); - $version = sanitizeInput($_POST['version']); - $type = sanitizeInput($_POST['type']); - $license_type = sanitizeInput($_POST['license_type']); - $notes = sanitizeInput($_POST['notes']); + $name = sanitizeInput($row['software_name']); + $version = sanitizeInput($row['software_version']); + $description = sanitizeInput($row['software_description']); + $type = sanitizeInput($row['software_type']); + $license_type = sanitizeInput($row['software_license_type']); + $notes = sanitizeInput($row['software_notes']); // Software add query - mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_license_type = '$license_type', software_notes = '$notes', software_client_id = $client_id"); // Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software', log_action = 'Create', log_description = 'Software created from template $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id"); @@ -85,6 +88,7 @@ $client_id = intval($_POST['client_id']); $name = sanitizeInput($_POST['name']); $version = sanitizeInput($_POST['version']); + $description = sanitizeInput($_POST['description']); $type = sanitizeInput($_POST['type']); $license_type = sanitizeInput($_POST['license_type']); $notes = sanitizeInput($_POST['notes']); @@ -104,7 +108,7 @@ } $notes = sanitizeInput($_POST['notes']); - mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes', software_client_id = $client_id"); $software_id = mysqli_insert_id($mysqli); @@ -126,14 +130,6 @@ } } - if (!empty($_POST['username'])) { - $username = sanitizeInput(encryptLoginEntry($_POST['username'])); - $password = sanitizeInput(encryptLoginEntry($_POST['password'])); - - mysqli_query($mysqli,"INSERT INTO logins SET login_name = '$name', login_username = '$username', login_password = '$password', login_software_id = $software_id, login_client_id = $client_id"); - - } - //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software', log_action = 'Create', log_description = '$session_name created software $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $software_id"); @@ -148,10 +144,10 @@ validateTechRole(); $software_id = intval($_POST['software_id']); - $login_id = intval($_POST['login_id']); $client_id = intval($_POST['client_id']); $name = sanitizeInput($_POST['name']); $version = sanitizeInput($_POST['version']); + $description = sanitizeInput($_POST['description']); $type = sanitizeInput($_POST['type']); $license_type = sanitizeInput($_POST['license_type']); $notes = sanitizeInput($_POST['notes']); @@ -171,7 +167,7 @@ } $notes = sanitizeInput($_POST['notes']); - mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes' WHERE software_id = $software_id"); + mysqli_query($mysqli,"UPDATE software SET software_name = '$name', software_version = '$version', software_description = '$description', software_type = '$type', software_key = '$key', software_license_type = '$license_type', software_seats = $seats, software_purchase = $purchase, software_expire = $expire, software_notes = '$notes' WHERE software_id = $software_id"); // Update Asset Licenses @@ -192,23 +188,6 @@ } } - //If login exists then update the login - if ($login_id > 0) { - $username = encryptLoginEntry($_POST['username']); - $password = encryptLoginEntry($_POST['password']); - - mysqli_query($mysqli,"UPDATE logins SET login_name = '$name', login_username = '$username', login_password = '$password' WHERE login_id = $login_id"); - }else{ - //If Username is filled in then add a login - if (!empty($_POST['username'])) { - $username = encryptLoginEntry($_POST['username']); - $password = encryptLoginEntry($_POST['password']); - - mysqli_query($mysqli,"INSERT INTO logins SET login_name = '$name', login_username = '$username', login_password = '$password', login_software_id = $software_id, login_client_id = $client_id"); - - } - } - //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Software', log_action = 'Modify', log_description = '$session_name modified software $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $software_id"); @@ -298,7 +277,7 @@ $f = fopen('php://memory', 'w'); //set column headers - $fields = array('Name', 'Version', 'Type', 'License Type', 'Seats', 'Key', 'Assets', 'Contacts', 'Purchased', 'Expires', 'Notes'); + $fields = array('Name', 'Version', 'Description', 'Type', 'License Type', 'Seats', 'Key', 'Assets', 'Contacts', 'Purchased', 'Expires', 'Notes'); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer @@ -328,7 +307,7 @@ $assigned_to_contacts .= $contact_row['contact_name'] . ", "; } - $lineData = array($row['software_name'], $row['software_version'], $row['software_type'], $row['software_license_type'], $row['software_seats'], $row['software_key'], $assigned_to_assets, $assigned_to_contacts, $row['software_purchase'], $row['software_expire'], $row['software_notes']); + $lineData = array($row['software_name'], $row['software_version'], $row['software_description'], $row['software_type'], $row['software_license_type'], $row['software_seats'], $row['software_key'], $assigned_to_assets, $assigned_to_contacts, $row['software_purchase'], $row['software_expire'], $row['software_notes']); fputcsv($f, $lineData, $delimiter); } @@ -349,4 +328,3 @@ exit; } - diff --git a/vendor_add_modal.php b/vendor_add_modal.php index 327e9fad0..806228563 100644 --- a/vendor_add_modal.php +++ b/vendor_add_modal.php @@ -147,7 +147,7 @@
- +
diff --git a/vendor_edit_modal.php b/vendor_edit_modal.php index 9d67d6948..281c9e640 100644 --- a/vendor_edit_modal.php +++ b/vendor_edit_modal.php @@ -166,7 +166,7 @@
- +