diff --git a/admin_side_nav.php b/admin_side_nav.php
index 8a93b86c..22293061 100644
--- a/admin_side_nav.php
+++ b/admin_side_nav.php
@@ -112,6 +112,14 @@
+
diff --git a/ajax.php b/ajax.php
new file mode 100644
index 00000000..07a56ad8
--- /dev/null
+++ b/ajax.php
@@ -0,0 +1,122 @@
+ array("capture_peer_cert" => TRUE, "verify_peer" => FALSE,)));
+ $read = stream_socket_client($socket, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
+ $cert = stream_context_get_params($read);
+ $cert_public_key_obj = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
+ openssl_x509_export($cert['options']['ssl']['peer_certificate'], $export);
+
+ // Process data
+ if($cert_public_key_obj){
+ $response['success'] = "TRUE";
+ $response['expire'] = date('Y-m-d', $cert_public_key_obj['validTo_time_t']);
+ $response['issued_by'] = strip_tags($cert_public_key_obj['issuer']['O']);
+ $response['public_key'] = $export; //nl2br
+ }
+ else{
+ $response['success'] = "FALSE";
+ }
+
+ echo json_encode($response);
+
+}
+
+/*
+ * Looks up info for a given certificate ID from the database, used to dynamically populate modal fields
+ */
+if(isset($_GET['certificate_get_json_details'])){
+ $certificate_id = intval($_GET['certificate_id']);
+ $client_id = intval($_GET['client_id']);
+
+ // Individual certificate lookup
+ $cert_sql = mysqli_query($mysqli,"SELECT * FROM certificates WHERE certificate_id = $certificate_id AND certificate_client_id = $client_id");
+ while($row = mysqli_fetch_array($cert_sql)){
+ $response['certificate'][] = $row;
+ }
+
+ // Get all domains for this client that could be linked to this certificate
+ $domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name FROM domains WHERE domain_client_id = '$client_id' AND company_id = '$session_company_id'");
+ while($row = mysqli_fetch_array($domains_sql)){
+ $response['domains'][] = $row;
+ }
+
+ echo json_encode($response);
+}
+
+/*
+ * Looks up info on the ticket number provided, used to populate the ticket merge modal
+ */
+if(isset($_GET['merge_ticket_get_json_details'])){
+ $merge_into_ticket_number = intval($_GET['merge_into_ticket_number']);
+
+ $sql = mysqli_query($mysqli,"SELECT * FROM tickets
+ LEFT JOIN clients ON ticket_client_id = client_id
+ LEFT JOIN contacts ON ticket_contact_id = contact_id
+ WHERE ticket_number = '$merge_into_ticket_number' AND tickets.company_id = '$session_company_id'");
+
+ if(mysqli_num_rows($sql) == 0){
+ //Do nothing.
+ }
+ else {
+ //Return ticket, client and contact details for the given ticket number
+ $response = mysqli_fetch_array($sql);
+ echo json_encode($response);
+ }
+}
+
+/*
+ * Looks up info for a given network ID from the database, used to dynamically populate modal fields
+ */
+if(isset($_GET['network_get_json_details'])){
+ $network_id = intval($_GET['network_id']);
+ $client_id = intval($_GET['client_id']);
+
+ // Individual network lookup
+ $network_sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_id = $network_id AND network_client_id = $client_id");
+ while($row = mysqli_fetch_array($network_sql)){
+ $response['network'][] = $row;
+ }
+
+ // Lookup all client locations, as networks can be associated with any client location
+ $locations_sql = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations
+ WHERE location_client_id = '$client_id' AND company_id = '$session_company_id'"
+ );
+ while($row = mysqli_fetch_array($locations_sql)){
+ $response['locations'][] = $row;
+ }
+
+ echo json_encode($response);
+}
\ No newline at end of file
diff --git a/client_certificates.php b/client_certificates.php
index 08d689b8..df820aa0 100644
--- a/client_certificates.php
+++ b/client_certificates.php
@@ -140,7 +140,7 @@ include("client_certificate_add_modal.php");
// Send a GET request to post.php as post.php?certificate_get_json_details=true&client_id=NUM&certificate_id=NUM
jQuery.get(
- "post.php",
+ "ajax.php",
{certificate_get_json_details: 'true', client_id: client_id, certificate_id: certificate_id},
function(data){
@@ -203,10 +203,10 @@ include("client_certificate_add_modal.php");
var publicKey = document.getElementById("editPublicKey");
}
- //Send a GET request to post.php as post.php?fetch_certificate=TRUE&domain=DOMAIN
+ //Send a GET request to post.php as post.php?certificate_fetch_parse_json_details=TRUE&domain=DOMAIN
jQuery.get(
- "post.php",
- {fetch_certificate: 'TRUE', domain: domain},
+ "ajax.php",
+ {certificate_fetch_parse_json_details: 'TRUE', domain: domain},
function(data){
//If we get a response from post.php, parse it as JSON
const ssl_data = JSON.parse(data);
diff --git a/client_contacts.php b/client_contacts.php
index 4683459c..7cf65359 100644
--- a/client_contacts.php
+++ b/client_contacts.php
@@ -139,7 +139,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
if($contact_id == $primary_contact){
$primary_contact_display = "Primary Contact";
}else{
- $primary_contact_display = "Needs approval";
+ $primary_contact_display = FALSE;
}
$contact_location_id = $row['contact_location_id'];
$location_name = $row['location_name'];
diff --git a/client_networks.php b/client_networks.php
index bf2b1e6c..dbf9218a 100644
--- a/client_networks.php
+++ b/client_networks.php
@@ -170,7 +170,7 @@ function populateNetworkEditModal(client_id, network_id) {
// Send a GET request to post.php as post.php?network_get_json_details=true&client_id=NUM&network_id=NUM
jQuery.get(
- "post.php",
+ "ajax.php",
{network_get_json_details: 'true', client_id: client_id, network_id: network_id},
function(data){
diff --git a/invoice.php b/invoice.php
index ee5fbba4..5dd6f7cd 100644
--- a/invoice.php
+++ b/invoice.php
@@ -299,7 +299,7 @@ if(isset($_GET['invoice_id'])){
|
|
|
- |
+ |
|