Added Global Views for Licenses, Credentials and Certificates

This commit is contained in:
johnnyq 2025-02-20 14:58:25 -05:00
parent 7628fc2643
commit 2795b4e15e
22 changed files with 322 additions and 126 deletions

View File

@ -4,7 +4,16 @@
$sort = "certificate_name";
$order = "ASC";
require_once "includes/inc_all_client.php";
// If client_id is in URI then show client Side Bar and client header
if (isset($_GET['client_id'])) {
require_once "includes/inc_all_client.php";
$client_query = "AND certificate_client_id = $client_id";
$client_url = "client_id=$client_id&";
} else {
require_once "includes/inc_client_overview_all.php";
$client_query = '';
$client_url = '';
}
// Perms
enforceUserPermission('module_support');
@ -12,11 +21,13 @@ enforceUserPermission('module_support');
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates
WHERE certificate_archived_at IS NULL
AND certificate_client_id = $client_id
AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%')
ORDER BY $sort $order LIMIT $record_from, $record_to");
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates
LEFT JOIN clients ON client_id = certificate_client_id
WHERE certificate_archived_at IS NULL
AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%' OR client_name LIKE '%$q%')
$client_query
ORDER BY $sort $order LIMIT $record_from, $record_to"
);
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@ -41,7 +52,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="card-body">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="row">
<div class="col-md-4">
@ -105,6 +118,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Expire <?php if ($sort == 'certificate_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
@ -112,6 +132,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
$certificate_id = intval($row['certificate_id']);
$certificate_name = nullable_htmlentities($row['certificate_name']);
$certificate_description = nullable_htmlentities($row['certificate_description']);
@ -170,7 +192,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div><?php echo $certificate_expire; ?></div>
<div><small><?php echo $certificate_expire_ago; ?></small></div>
</td>
<?php if (!$client_url) { ?>
<td><a href="certificates.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
@ -214,8 +238,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php
require_once "modals/client_certificate_add_modal.php";
require_once "modals/client_certificate_export_modal.php";
require_once "modals/certificate_add_modal.php";
require_once "modals/certificate_export_modal.php";
?>
<script src="js/bulk_actions.js"></script>

View File

@ -66,7 +66,7 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS contacts.*, clients.*,
LEFT JOIN tags ON tags.tag_id = contact_tags.tag_id
WHERE contact_$archive_query
$tag_query
AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%' OR tag_name LIKE '%$q%')
AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%')
$client_query
$location_query
GROUP BY contact_id
@ -263,7 +263,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>

View File

@ -4,14 +4,24 @@
$sort = "login_name";
$order = "ASC";
require_once "includes/inc_all_client.php";
// If client_id is in URI then show client Side Bar and client header
if (isset($_GET['client_id'])) {
require_once "includes/inc_all_client.php";
$client_query = "AND login_client_id = $client_id";
$client_url = "client_id=$client_id&";
// Log when users load the Credentials/Logins page
logAction("Credential", "View", "$session_name viewed the Credentials page for client", $client_id);
} else {
require_once "includes/inc_client_overview_all.php";
$client_query = '';
$client_url = '';
// Log when users load the Credentials/Logins page
logAction("Credential", "View", "$session_name viewed the All Credentials page");
}
// Perms
enforceUserPermission('module_credential');
// Log when users load the Credentials/Logins page
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Credential', log_action = 'View', log_description = '$session_name viewed the Credentials page for client', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id");
// Tags Filter
if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) {
// Sanitize each element of the status array
@ -28,34 +38,46 @@ if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) {
$tag_query = '';
}
// Location Filter
if (isset($_GET['location']) & !empty($_GET['location'])) {
$location_query = 'AND (a.asset_location_id = ' . intval($_GET['location']) . ')';
$location_query_innerjoin = 'INNER JOIN assets a on a.asset_id = l.login_asset_id ';
$location_filter = intval($_GET['location']);
} else {
// Default - any
$location_query_innerjoin = '';
$location_query = '';
$location_filter = '';
if (!$client_url) {
// Client Filter
if (isset($_GET['client']) & !empty($_GET['client'])) {
$client_query = 'AND (login_client_id = ' . intval($_GET['client']) . ')';
$client = intval($_GET['client']);
} else {
// Default - any
$client_query = '';
$client = '';
}
}
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
if ($client_url) {
// Location Filter
if (isset($_GET['location']) & !empty($_GET['location'])) {
$location_query = 'AND (a.asset_location_id = ' . intval($_GET['location']) . ')';
$location_query_innerjoin = 'INNER JOIN assets a on a.asset_id = l.login_asset_id ';
$location_filter = intval($_GET['location']);
} else {
// Default - any
$location_query_innerjoin = '';
$location_query = '';
$location_filter = '';
}
}
$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS l.login_id AS l_login_id, l.*, login_tags.*, tags.*
"SELECT SQL_CALC_FOUND_ROWS l.login_id AS l_login_id, l.*, login_tags.*, tags.*, clients.*
FROM logins l
LEFT JOIN login_tags ON login_tags.login_id = l.login_id
LEFT JOIN tags ON tags.tag_id = login_tags.tag_id
LEFT JOIN clients ON client_id = login_client_id
$location_query_innerjoin
WHERE l.login_client_id = $client_id
WHERE l.login_$archive_query
$tag_query
AND l.login_$archive_query
AND (l.login_name LIKE '%$q%' OR l.login_description LIKE '%$q%' OR l.login_uri LIKE '%$q%' OR tag_name LIKE '%$q%')
AND (l.login_name LIKE '%$q%' OR l.login_description LIKE '%$q%' OR l.login_uri LIKE '%$q%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%')
$location_query
$client_query
GROUP BY l.login_id
ORDER BY l.login_important DESC, $sort $order LIMIT $record_from, $record_to"
);
@ -91,7 +113,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="card-body">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="row">
<div class="col-md-4">
@ -102,7 +126,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<?php if ($client_url) { ?>
<div class="col-md-2">
<div class="input-group">
<select class="form-control select2" name="location" onchange="this.form.submit()">
@ -122,6 +147,27 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</select>
</div>
</div>
<?php } else { ?>
<div class="col-md-2">
<div class="input-group">
<select class="form-control select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
<?php
$sql_clients_filter = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql_clients_filter)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
?>
<option <?php if ($client == $client_id) { echo "selected"; } ?> value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
<?php
}
?>
</select>
</div>
</div>
<?php } ?>
<div class="col-md-3">
<div class="form-group">
@ -141,7 +187,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-3">
<div class="btn-group float-right">
<a href="?client_id=<?php echo $client_id; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
<a href="?<?php echo $client_url; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive mr-2"></i>Archived
</a>
@ -204,6 +250,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</a>
</th>
<th></th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
@ -211,6 +264,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
$login_id = intval($row['l_login_id']);
$login_name = nullable_htmlentities($row['login_name']);
$login_description = nullable_htmlentities($row['login_description']);
@ -303,7 +358,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</td>
<td>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">
<a class="text-dark" href="#"
data-toggle="ajax-modal"
data-ajax-url="ajax/ajax_credential_edit.php"
data-ajax-id="<?php echo $login_id; ?>"
>
<div class="media">
<i class="fa fa-fw fa-2x fa-key mr-3"></i>
<div class="media-body">
@ -336,6 +395,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="credentials.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<?php } ?>
<td class="text-center">
<div class="btn-group">
<?php if ( !empty($login_uri) || !empty($login_uri_2) ) { ?>
@ -366,7 +428,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<a class="dropdown-item" href="#"
data-toggle="ajax-modal"
data-ajax-url="ajax/ajax_credential_edit.php"
data-ajax-id="<?php echo $login_id; ?>">
data-ajax-id="<?php echo $login_id; ?>"
>
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
@ -406,7 +469,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</tbody>
</table>
</div>
<?php require_once "modals/client_login_bulk_assign_tags_modal.php"; ?>
<?php require_once "modals/credential_bulk_assign_tags_modal.php"; ?>
</form>
<?php require_once "includes/filter_footer.php";
?>
@ -414,15 +477,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<!-- Include script to get TOTP code via the login ID -->
<script src="js/logins_show_otp_via_id.js"></script>
<script src="js/credential_show_otp_via_id.js"></script>
<!-- Include script to generate readable passwords for login entries -->
<script src="js/logins_generate_password.js"></script>
<script src="js/generate_password.js"></script>
<script src="js/bulk_actions.js"></script>
<?php
require_once "modals/client_login_add_modal.php";
require_once "modals/credential_add_modal.php";
require_once "modals/share_modal.php";
require_once "modals/client_login_import_modal.php";
require_once "modals/client_login_export_modal.php";
require_once "modals/credential_import_modal.php";
require_once "modals/credential_export_modal.php";
require_once "includes/footer.php";

View File

@ -33,7 +33,7 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS domains.*, clients.*,
LEFT JOIN vendors AS mailhost ON domains.domain_mailhost = mailhost.vendor_id
LEFT JOIN vendors AS webhost ON domains.domain_webhost = webhost.vendor_id
AND domain_$archive_query
AND (domains.domain_name LIKE '%$q%' OR domains.domain_description LIKE '%$q%' OR registrar.vendor_name LIKE '%$q%' OR dnshost.vendor_name LIKE '%$q%' OR mailhost.vendor_name LIKE '%$q%' OR webhost.vendor_name LIKE '%$q%')
AND (domains.domain_name LIKE '%$q%' OR domains.domain_description LIKE '%$q%' OR registrar.vendor_name LIKE '%$q%' OR dnshost.vendor_name LIKE '%$q%' OR mailhost.vendor_name LIKE '%$q%' OR webhost.vendor_name LIKE '%$q%' OR client_name LIKE '%$q%')
$client_query
ORDER BY $sort $order LIMIT $record_from, $record_to");
@ -61,7 +61,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="card-body">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="row">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">

View File

@ -141,22 +141,22 @@ if (isset($_GET['query'])) {
?>
<div class="col-sm-12">
<div class="card card-body mb-3">
<h4 class="text-center"><i class="fas fa-fw fa-search mr-2"></i>Global Search</h4>
</div>
<div class="card card-dark">
<div class="card-header mb-3">
<h4 class="card-title text-center"><i class="fas fa-fw fa-search mr-2"></i>Global Search</h4>
</div>
<div class="card-body">
<div class="row">
<?php if (mysqli_num_rows($sql_clients) > 0) { ?>
<!-- Clients-->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-users mr-2"></i>Clients</h6>
<h6 class="card-title"><i class="fas fa-fw fa-users mr-2"></i>Clients</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -196,9 +196,9 @@ if (isset($_GET['query'])) {
<!-- Contacts-->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-users mr-2"></i>Contacts</h6>
<h6 class="card-title"><i class="fas fa-fw fa-users mr-2"></i>Contacts</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -252,9 +252,9 @@ if (isset($_GET['query'])) {
<!-- Vendors -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-building mr-2"></i>Vendors</h6>
<h6 class="card-title"><i class="fas fa-fw fa-building mr-2"></i>Vendors</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -299,9 +299,9 @@ if (isset($_GET['query'])) {
<!-- Domains -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-globe mr-2"></i>Domains</h6>
<h6 class="card-title"><i class="fas fa-fw fa-globe mr-2"></i>Domains</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -343,9 +343,9 @@ if (isset($_GET['query'])) {
<!-- Products -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-box mr-2"></i>Products</h6>
<h6 class="card-title"><i class="fas fa-fw fa-box mr-2"></i>Products</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -382,9 +382,9 @@ if (isset($_GET['query'])) {
<!-- Documents -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-file-alt mr-2"></i>Documents</h6>
<h6 class="card-title"><i class="fas fa-fw fa-file-alt mr-2"></i>Documents</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -426,9 +426,9 @@ if (isset($_GET['query'])) {
<!-- Files -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-paperclip mr-2"></i>Files</h6>
<h6 class="card-title"><i class="fas fa-fw fa-paperclip mr-2"></i>Files</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -476,9 +476,9 @@ if (isset($_GET['query'])) {
<!-- Tickets -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-life-ring mr-2"></i>Tickets</h6>
<h6 class="card-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Tickets</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -526,9 +526,9 @@ if (isset($_GET['query'])) {
<!-- Recurring Tickets -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-undo-alt mr-2"></i>Recurring Tickets</h6>
<h6 class="card-title"><i class="fas fa-fw fa-undo-alt mr-2"></i>Recurring Tickets</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -575,9 +575,9 @@ if (isset($_GET['query'])) {
<!-- Logins -->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-key mr-2"></i>Credentials</h6>
<h3 class="card-title"><i class="fas fa-fw fa-key mr-2"></i>Credentials</h3>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -604,12 +604,12 @@ if (isset($_GET['query'])) {
?>
<tr>
<td><a href="client_logins.php?client_id=<?php echo $login_client_id ?>&q=<?php echo $q ?>"><?php echo $login_name; ?></a></td>
<td><a href="credentials.php?client_id=<?php echo $login_client_id ?>&q=<?php echo $q ?>"><?php echo $login_name; ?></a></td>
<td><?php echo $login_description; ?></td>
<td><?php echo $login_username; ?></td>
<td><a tabindex="0" class="btn btn-sm" data-toggle="popover" data-trigger="focus" data-placement="left" data-content="<?php echo $login_password; ?>"><i class="far fa-eye text-secondary"></i></a><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
</td>
<td><a href="client_logins.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<td><a href="credentials.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
</tr>
<?php } ?>
@ -628,9 +628,9 @@ if (isset($_GET['query'])) {
<!-- Contacts-->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoices</h6>
<h6 class="card-title"><i class="fas fa-fw fa-file-invoice mr-2"></i>Invoices</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -679,9 +679,9 @@ if (isset($_GET['query'])) {
<!-- Contacts-->
<div class="col-sm-6">
<div class="card mb-3">
<div class="card card-dark mb-3">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-desktop mr-2"></i>Assets</h6>
<h6 class="card-title"><i class="fas fa-fw fa-desktop mr-2"></i>Assets</h6>
</div>
<div class="card-body">
<table class="table table-striped table-borderless">
@ -771,9 +771,9 @@ if (isset($_GET['query'])) {
<div class="col-sm-6">
<div class="card">
<div class="card card-dark">
<div class="card-header">
<h6 class="mt-1"><i class="fas fa-fw fa-reply mr-2"></i>Ticket Replies</h6>
<h6 class="card-title"><i class="fas fa-fw fa-reply mr-2"></i>Ticket Replies</h6>
</div>
<div class="card-body">
@ -838,11 +838,16 @@ if (isset($_GET['query'])) {
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php
}

View File

@ -34,6 +34,24 @@
<p><strong>ALL</strong> Domains</p>
</a>
</li>
<li class="nav-item">
<a href="software.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "software.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-cube"></i>
<p><strong>ALL</strong> Licenses</p>
</a>
</li>
<li class="nav-item">
<a href="credentials.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "credentials.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-key"></i>
<p><strong>ALL</strong> Credentials</p>
</a>
</li>
<li class="nav-item">
<a href="certificates.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "certificates.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-lock"></i>
<p><strong>ALL</strong> Certificates</p>
</a>
</li>
<?php } ?>
</ul>

View File

@ -129,7 +129,7 @@
</li>
<li class="nav-item">
<a href="client_software.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_software.php") { echo "active"; } ?>">
<a href="software.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "software.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-cube"></i>
<p>
Licenses
@ -142,7 +142,7 @@
</li>
<li class="nav-item">
<a href="client_logins.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_logins.php") { echo "active"; } ?>">
<a href="credentials.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "credentials.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-key"></i>
<p>
Credentials
@ -181,7 +181,7 @@
</li>
<li class="nav-item">
<a href="client_certificates.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_certificates.php") { echo "active"; } ?>">
<a href="certificates.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "certificates.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-lock"></i>
<p>
Certificates

View File

@ -8,12 +8,14 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="modal-body bg-white">
</div>
<div class="modal-footer bg-white">
<button type="submit" name="export_client_certificates_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="submit" name="export_certificates_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
</div>
</form>

View File

@ -8,7 +8,6 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white">
@ -16,9 +15,11 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="pill" href="#pills-details">Details</a>
</li>
<?php if ($client_url) { ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-relation">Relation</a>
</li>
<?php } ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
</li>
@ -30,6 +31,33 @@
<div class="tab-pane fade show active" id="pills-details">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } else { ?>
<div class="form-group">
<label>Client <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<select class="form-control select2" name="client_id" required>
<option value="">- Select Client -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
<option value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
<div class="form-group">
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Important?</span></label>
<div class="input-group">
@ -116,6 +144,7 @@
</div>
<?php if ($client_url) { ?>
<div class="tab-pane fade" id="pills-relation">
<div class="form-group">
@ -222,6 +251,7 @@
</div>
</div>
<?php } ?>
<div class="tab-pane fade" id="pills-notes">

View File

@ -8,12 +8,14 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="modal-body bg-white">
</div>
<div class="modal-footer bg-white">
<button type="submit" name="export_client_logins_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="submit" name="export_credentials_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
</div>
</form>

View File

@ -8,7 +8,9 @@
</button>
</div>
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="modal-body bg-white">
<p><strong>Format csv file with headings & data:</strong><br>Name, Description, Username, Password, URL</p>
<hr>
@ -16,10 +18,10 @@
<input type="file" class="form-control-file" name="file" accept=".csv" required>
</div>
<hr>
<div>Download <a class="text-bold" href="post.php?download_client_logins_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
<div>Download <a class="text-bold" href="post.php?download_credentials_csv_template">sample csv template</a></div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="import_client_logins_csv" class="btn btn-primary"><i class="fa fa-upload mr-2"></i>Import</button>
<button type="submit" name="import_credentials_csv" class="btn btn-primary"><i class="fa fa-upload mr-2"></i>Import</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
</div>
</form>

View File

@ -8,7 +8,6 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white">
<ul class="nav nav-pills nav-justified mb-3">
@ -18,12 +17,14 @@
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-licensing">Licensing</a>
</li>
<?php if ($client_url) { // Dont show these when in global mode ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-device-licenses">Devices</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-user-licenses">Users</a>
</li>
<?php } ?>
<li class="nav-item">
<a class="nav-link" data-toggle="pill" href="#pills-notes">Notes</a>
</li>
@ -35,6 +36,33 @@
<div class="tab-pane fade show active" id="pills-details">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } else { ?>
<div class="form-group">
<label>Client <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<select class="form-control select2" name="client_id" required>
<option value="">- Select Client -</option>
<?php
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
<option value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
<div class="form-group">
<label>Software Name <strong class="text-danger">*</strong></label>
<div class="input-group">
@ -141,6 +169,8 @@
</div>
<?php if ($client_url) { // Dont show these when in global mode ?>
<div class="tab-pane fade" id="pills-device-licenses">
<ul class="list-group">
@ -215,6 +245,8 @@
</div>
<?php } ?>
<div class="tab-pane fade" id="pills-notes">
<textarea class="form-control" rows="12" placeholder="Enter some notes" name="notes"></textarea>

View File

@ -160,25 +160,24 @@ if (isset($_POST['bulk_delete_certificates'])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_POST['export_client_certificates_csv'])) {
if (isset($_POST['export_certificates_csv'])) {
enforceUserPermission('module_support');
$client_id = intval($_POST['client_id']);
if (isset($_POST['client_id'])) {
$client_id = intval($_POST['client_id']);
$client_query = "AND certificate_client_id = $client_id";
} else {
$client_query = '';
}
//get records from database
$sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id");
$row = mysqli_fetch_array($sql);
$client_name = $row['client_name'];
$sql = mysqli_query($mysqli,"SELECT * FROM certificates WHERE certificate_client_id = $client_id ORDER BY certificate_name ASC");
$sql = mysqli_query($mysqli,"SELECT * FROM certificates WHERE certificate_archived_at IS NULL $client_query ORDER BY certificate_name ASC");
$num_rows = mysqli_num_rows($sql);
if ($num_rows > 0) {
$delimiter = ",";
$filename = $client_name . "-Certificates-" . date('Y-m-d') . ".csv";
$filename = "Certificates-" . date('Y-m-d') . ".csv";
//create a file pointer
$f = fopen('php://memory', 'w');
@ -205,7 +204,7 @@ if (isset($_POST['export_client_certificates_csv'])) {
}
// Logging
logAction("Certificate", "Export", "$session_name exported $num_rows certificate(s) to a CSV file", $client_id);
logAction("Certificate", "Export", "$session_name exported $num_rows certificate(s) to a CSV file");
exit;

View File

@ -325,23 +325,26 @@ if (isset($_POST['bulk_delete_logins'])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_POST['export_client_logins_csv'])) {
if (isset($_POST['export_credentials_csv'])) {
enforceUserPermission('module_credential');
$client_id = intval($_POST['client_id']);
if (isset($_POST['client_id'])) {
$client_id = intval($_POST['client_id']);
$client_query = "AND login_client_id = $client_id";
} else {
$client_query = '';
}
//get records from database
$sql = mysqli_query($mysqli,"SELECT * FROM logins LEFT JOIN clients ON client_id = login_client_id WHERE login_client_id = $client_id ORDER BY login_name ASC");
$sql = mysqli_query($mysqli,"SELECT * FROM logins LEFT JOIN clients ON client_id = login_client_id WHERE login_archived_at IS NULL $client_query ORDER BY login_name ASC");
$row = mysqli_fetch_array($sql);
$client_name = $row['client_name'];
$num_rows = mysqli_num_rows($sql);
if ($num_rows > 0) {
$delimiter = ",";
$filename = strtoAZaz09($client_name) . "-Credentials-" . date('Y-m-d') . ".csv";
$filename = "Credentials-" . date('Y-m-d') . ".csv";
//create a file pointer
$f = fopen('php://memory', 'w');
@ -351,7 +354,7 @@ if (isset($_POST['export_client_logins_csv'])) {
fputcsv($f, $fields, $delimiter);
//output each row of the data, format line as csv and write to file pointer
while($row = $sql->fetch_assoc()) {
while($row = mysqli_fetch_assoc($sql)){
$login_username = decryptLoginEntry($row['login_username']);
$login_password = decryptLoginEntry($row['login_password']);
$lineData = array($row['login_name'], $row['login_description'], $login_username, $login_password, $row['login_uri']);
@ -370,13 +373,13 @@ if (isset($_POST['export_client_logins_csv'])) {
}
// Logging
logAction("Credential", "Export", "$session_name exported $num_rows credential(s) to a CSV file", $client_id);
logAction("Credential", "Export", "$session_name exported $num_rows credential(s) to a CSV file");
exit;
}
if (isset($_POST["import_client_logins_csv"])) {
if (isset($_POST["import_credentials_csv"])) {
enforceUserPermission('module_credential', 2);
@ -465,17 +468,10 @@ if (isset($_POST["import_client_logins_csv"])) {
}
}
if (isset($_GET['download_client_logins_csv_template'])) {
$client_id = intval($_GET['download_client_logins_csv_template']);
//get records from database
$sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id");
$row = mysqli_fetch_array($sql);
$client_name = $row['client_name'];
if (isset($_GET['download_credentials_csv_template'])) {
$delimiter = ",";
$filename = strtoAZaz09($client_name) . "-Logins-Template.csv";
$filename = "Credentials-Template.csv";
//create a file pointer
$f = fopen('php://memory', 'w');

View File

@ -94,7 +94,7 @@ if (isset($_POST['export_trips_csv'])) {
if ($count > 0) {
$delimiter = ",";
$filename = "$session_company_name-Trips-$file_name_date.csv";
$filename = "Trips-$file_name_date.csv";
//create a file pointer
$f = fopen('php://memory', 'w');

View File

@ -4,21 +4,28 @@
$sort = "software_name";
$order = "ASC";
require_once "includes/inc_all_client.php";
// If client_id is in URI then show client Side Bar and client header
if (isset($_GET['client_id'])) {
require_once "includes/inc_all_client.php";
$client_query = "AND software_client_id = $client_id";
$client_url = "client_id=$client_id&";
} else {
require_once "includes/inc_client_overview_all.php";
$client_query = '';
$client_url = '';
}
// Perms
enforceUserPermission('module_support');
//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);
$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM software
WHERE software_client_id = $client_id
AND software_template = 0
LEFT JOIN clients ON client_id = software_client_id
WHERE software_template = 0
AND software_$archive_query
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%')
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%' OR client_name LIKE '%$q%')
$client_query
ORDER BY $sort $order LIMIT $record_from, $record_to");
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@ -50,7 +57,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="card-body">
<form autocomplete="off">
<?php if($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
<div class="row">
@ -65,7 +74,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-8">
<div class="float-right">
<a href="?client_id=<?php echo $client_id; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
<a href="?<?php echo $client_url; ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive mr-2"></i>Archived
</a>
@ -104,6 +113,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Expire <?php if ($sort == 'software_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
@ -111,6 +127,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
$software_id = intval($row['software_id']);
$software_name = nullable_htmlentities($row['software_name']);
$software_description = nullable_htmlentities($row['software_description']);
@ -192,6 +210,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<td><?php echo $software_license_type; ?></td>
<td><?php echo "$seat_count / $software_seats"; ?></td>
<td><?php echo $software_expire_display; ?></td>
<?php if (!$client_url) { ?>
<td><a href="software.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" data-toggle="dropdown">
@ -236,7 +257,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php
require_once "modals/client_software_add_modal.php";
require_once "modals/client_software_add_from_template_modal.php";
require_once "modals/client_software_export_modal.php";
require_once "modals/software_add_modal.php";
require_once "modals/software_add_from_template_modal.php";
require_once "modals/software_export_modal.php";
require_once "includes/footer.php";