Merge branch 'master' into techbar
fixed
This commit is contained in:
31
README.md
31
README.md
@@ -60,32 +60,6 @@
|
||||
* Whilst we are confident the code is safe, nothing in life is 100% safe or risk-free. Use your best judgement before deciding to store highly confidential information in ITFlow.
|
||||
* We are hoping to have a stable 1.0 release by early 2024.
|
||||
|
||||
<!-- BUILT WITH -->
|
||||
### Built With
|
||||
|
||||
* Backend / PHP libs
|
||||
* PHP
|
||||
* MariaDB
|
||||
* PHPMailer
|
||||
* HTML Purifier
|
||||
* PHP Mime Mail Parser
|
||||
* Zap Calendar
|
||||
|
||||
* CSS
|
||||
* Bootstrap
|
||||
* AdminLTE
|
||||
* fontawesome
|
||||
|
||||
* JS Libraries
|
||||
* chart.js
|
||||
* moments.js
|
||||
* jQuery
|
||||
* pdfmake
|
||||
* Select2
|
||||
* TinyMCE
|
||||
* FullCalendar.io
|
||||
|
||||
|
||||
<!-- GETTING STARTED -->
|
||||
## Getting Started
|
||||
|
||||
@@ -144,6 +118,11 @@ If you want to improve ITFlow, feel free to fork the repo and create a pull requ
|
||||
<img src="https://contrib.rocks/image?repo=itflow-org/itflow" />
|
||||
</a>
|
||||
|
||||
### Supporters
|
||||
We’re incredibly grateful to the organizations and individuals who support the project - a big thank you to:
|
||||
- CompuMatter
|
||||
- JetBrains
|
||||
|
||||
<!-- LICENSE -->
|
||||
## License
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ ITFlow is currently in beta and is a work in progress.
|
||||
|
||||
We attempt to follow security best practices where possible, including [automated code scanning](https://sonarcloud.io/component_measures?id=itflow-org_itflow&metric=security_rating&view=list).
|
||||
|
||||
[](https://sonarcloud.io/summary/new_code?id=itflow-org_itflow)
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
@@ -25,4 +27,4 @@ We attempt to follow security best practices where possible, including [automate
|
||||
|
||||
If you have discovered a security issue, please **[report it](https://github.com/itflow-org/itflow/security/advisories/new)** to us in as much detail as possible, so we can fix it.
|
||||
|
||||
You should expect to receive an initial acknowledgement within 72 hours. If you don't receive any feedback, we may have missed the initial email from GitHub (we're human!). Please raise a private forum discussion with johnny and wrongecho quoting ONLY the assigned GHSA ref.
|
||||
You should expect to receive an initial acknowledgement within 72 hours. If you don't receive any feedback, we may have missed the initial email from GitHub (we're human!). Please raise a forum discussion quoting ONLY the assigned GHSA ref.
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
@@ -20,28 +22,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Type <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-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select" name="type" required>
|
||||
<option value="">- Select -</option>
|
||||
<?php
|
||||
$sql_account_types = mysqli_query($mysqli, "SELECT * FROM account_types ORDER BY account_type_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_account_types)) {
|
||||
$account_type_id = intval($row['account_type_id']);
|
||||
$account_type_name = nullable_htmlentities($row['account_type_name']);
|
||||
|
||||
echo "<option value='$account_type_id'>$account_type_name</option>";
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Opening Balance <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Account Name <strong class="text-danger">*</strong></label>
|
||||
@@ -20,27 +21,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Type <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-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select" name="type" required>
|
||||
<?php
|
||||
$sql_account_types_select = mysqli_query($mysqli, "SELECT * FROM account_types ORDER BY account_type_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_account_types_select)) {
|
||||
$account_type_id_select = intval($row['account_type_id']);
|
||||
$account_type_name_select = nullable_htmlentities($row['account_type_name']);
|
||||
?>
|
||||
<option value="<?php echo $account_type_id_select; ?>" <?php if($account_type == $account_type_id_select){ echo "selected"; } ?>><?php echo $account_type_name_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="5" placeholder="Enter some notes" name="notes"><?php echo $account_notes; ?></textarea>
|
||||
|
||||
@@ -12,8 +12,7 @@ $url_query_strings_sort = http_build_query($get_copy);
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM accounts
|
||||
LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type
|
||||
WHERE (account_name LIKE '%$q%' OR account_type_name LIKE '%$q%')
|
||||
WHERE (account_name LIKE '%$q%')
|
||||
AND account_archived_at IS NULL
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
@@ -44,7 +43,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_name&order=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_type_name&order=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=account_currency_code&order=<?php echo $disp; ?>">Currency</a></th>
|
||||
<th class="text-right">Balance</th>
|
||||
<th class="text-center">Action</th>
|
||||
@@ -59,8 +57,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$opening_balance = floatval($row['opening_balance']);
|
||||
$account_currency_code = nullable_htmlentities($row['account_currency_code']);
|
||||
$account_notes = nullable_htmlentities($row['account_notes']);
|
||||
$account_type = intval($row['account_type']);
|
||||
$account_type_name = nullable_htmlentities($row['account_type_name']);
|
||||
|
||||
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
@@ -79,7 +75,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>"><?php echo $account_name; ?></a></td>
|
||||
<td><?php echo $account_type_name; ?></td>
|
||||
<td><?php echo $account_currency_code; ?></td>
|
||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $balance, $account_currency_code); ?></td>
|
||||
<td>
|
||||
@@ -93,7 +88,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</a>
|
||||
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_account=<?php echo $account_id; ?>">
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_account=<?php echo $account_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
require_once "inc_all_admin.php";
|
||||
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "account_type_id";
|
||||
$order = "ASC";
|
||||
|
||||
if (isset($_GET['account_type'])) {
|
||||
$account_type = sanitizeInput($_GET['account_type']);
|
||||
switch ($account_type) {
|
||||
case "Assets":
|
||||
$account_type_parent = "1";
|
||||
break;
|
||||
case "Liabilities":
|
||||
$account_type_parent = "2";
|
||||
break;
|
||||
case "Equity":
|
||||
$account_type_parent = "3";
|
||||
break;
|
||||
default:
|
||||
$account_type_parent = "1";
|
||||
}
|
||||
} else {
|
||||
$account_type_parent = "%";
|
||||
}
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM account_types
|
||||
WHERE account_type_$archive_query
|
||||
AND account_type_parent LIKE '$account_type_parent'
|
||||
AND (account_type_name LIKE '%$q%' OR account_type_description LIKE '%$q%')
|
||||
ORDER BY account_type_parent ASC, $sort $order"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_num_rows($sql);
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-money-bill-wave mr-2"></i>Finance Account Types</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAccountTypeModal">
|
||||
<i class="fas fa-plus mr-2"></i>Create Account Type
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 mb-2">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {
|
||||
echo stripslashes(nullable_htmlentities($q));
|
||||
} ?>" placeholder="Search Categories">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="btn-group float-right">
|
||||
<a href="admin_account_types.php" class="btn <?php if (!isset($_GET['account_type']) && !isset($_GET['archived'])) {
|
||||
echo 'btn-primary';
|
||||
} else {
|
||||
echo 'btn-default';
|
||||
} ?>">All</a>
|
||||
<a href="?account_type=Assets" class="btn <?php if ($account_type == 'Assets') {
|
||||
echo 'btn-primary';
|
||||
} else {
|
||||
echo 'btn-default';
|
||||
} ?>">Assets</a>
|
||||
<a href="?account_type=Liabilities" class="btn <?php if ($account_type == 'Liabilities') {
|
||||
echo 'btn-primary';
|
||||
} else {
|
||||
echo 'btn-default';
|
||||
} ?>">Liabilities</a>
|
||||
<a href="?account_type=Equity" class="btn <?php if ($account_type == 'Equity') {
|
||||
echo 'btn-primary';
|
||||
} else {
|
||||
echo 'btn-default';
|
||||
} ?>">Equity</a>
|
||||
<a href="?archived=1" class="btn <?php if ($_GET['archived']) {
|
||||
echo 'btn-primary';
|
||||
} else {
|
||||
echo 'btn-default';
|
||||
} ?>"><i class="fas fa-fw fa-archive mr-2"></i>Archived</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Account Type Parent</th>
|
||||
<th>Account Type Name</th>
|
||||
<th>Description</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$account_type_id = intval($row['account_type_id']);
|
||||
$account_type_parent = intval($row['account_type_parent']);
|
||||
if($account_type_parent == 1) {
|
||||
$account_type_parent_name = "Assets";
|
||||
} elseif($account_type_parent == 2) {
|
||||
$account_type_parent_name = "Liabilities";
|
||||
} else {
|
||||
$account_type_parent_name = "Equity";
|
||||
}
|
||||
$account_type_name = nullable_htmlentities($row['account_type_name']);
|
||||
$account_type_description = nullable_htmlentities($row['account_type_description']);
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark text-bold" href="#" data-toggle="modal"
|
||||
data-target="#editAccountTypeModal<?php echo $account_type_id; ?>">
|
||||
<?php echo $account_type_parent_name; ?>
|
||||
</a></td>
|
||||
<td>
|
||||
<?php echo $account_type_name; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $account_type_description; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal"
|
||||
data-target="#editAccountTypeModal<?php echo $account_type_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php if ($archived == NULL) { ?>
|
||||
<a class="dropdown-item text-danger confirm-link"
|
||||
href="post.php?archive_account_type=<?php echo $account_type_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<a class="dropdown-item text-success confirm-link"
|
||||
href="post.php?unarchive_account_type=<?php echo $account_type_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Unarchive
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "admin_account_types_edit_modal.php";
|
||||
|
||||
}
|
||||
|
||||
if ($num_rows == 0) {
|
||||
echo "<h3 class='text-secondary mt-3' style='text-align: center'>No Records Here</h3>";
|
||||
}
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "admin_account_types_add_modal.php";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,37 +0,0 @@
|
||||
<div class="modal" id="addAccountTypeModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header text-white">
|
||||
<h5 class="modal-title"><i class="fas fa-money-bill-wave mr-2"></i>New Account Type</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" placeholder="Account Name" required autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Account Type</label>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="" <?php if ($account_type == NULL) echo "selected"; ?>>- Select -</option>
|
||||
<option value="1" <?php if ($account_type == 'Assets') echo "selected"; ?>>Assets</option>
|
||||
<option value="2" <?php if ($account_type == 'Liabilities') echo "selected"; ?>>Liabilities</option>
|
||||
<option value="3" <?php if ($account_type == 'Equity') echo "selected"; ?>>Equity</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" name="description" placeholder="Description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_account_type" class="btn btn-primary text-bold"><i class="fa fa-check mr- 2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,40 +0,0 @@
|
||||
<div class="modal" id="editAccountTypeModal<?php echo $account_type_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-balance-scale mr-2"></i>Editing account type: <strong><?php echo $account_type_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="account_type_id" value="<?php echo $account_type_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $account_type_name; ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Account Type</label>
|
||||
<select class="form-control select2" name="type" required>
|
||||
<option value="1" <?php if ($account_parent == 1) echo 'selected'; ?>>Assets</option>
|
||||
<option value="2" <?php if ($account_parent == 2) echo 'selected'; ?>>Liabilities</option>
|
||||
<option value="3" <?php if ($account_parent == 3) echo 'selected'; ?>>Equity</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" name="description" placeholder="Description"><?php echo $account_type_description; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_account_type" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -28,6 +28,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="row">
|
||||
|
||||
@@ -148,4 +149,4 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||
|
||||
<?php
|
||||
|
||||
require_once "footer.php";
|
||||
require_once "footer.php";
|
||||
|
||||
52
admin_custom_link_add_modal.php
Normal file
52
admin_custom_link_add_modal.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<div class="modal" id="addLinkModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-external-link-alt mr-2"></i>New Custom Link</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-list-ul"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Link name" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URI <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-external-link-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="uri" placeholder="Enter Link" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_custom_link" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
52
admin_custom_link_edit_modal.php
Normal file
52
admin_custom_link_edit_modal.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<div class="modal" id="editLinkModal<?php echo $custom_link_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-external-link-alt mr-2"></i>Editing link: <strong><?php echo $custom_link_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="custom_link_id" value="<?php echo $custom_link_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-list-ul"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo $custom_link_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>URI <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-external-link-alt"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="uri" value="<?php echo $custom_link_uri; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Icon</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-image"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="icon" placeholder="Icon ex handshake" value="<?php echo $custom_link_icon; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_custom_link" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
115
admin_custom_links.php
Normal file
115
admin_custom_links.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "custom_link_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "inc_all_admin.php";
|
||||
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sort = http_build_query($get_copy);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM custom_links
|
||||
WHERE custom_link_name LIKE '%$q%'
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-external-link-alt mr-2"></i>Custom Links</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addLinkModal"><i class="fas fa-plus mr-2"></i>New Link</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 mb-2">
|
||||
<form autocomplete="off">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Links">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_name&order=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=custom_link_uri&order=<?php echo $disp; ?>">URI</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$custom_link_id = intval($row['custom_link_id']);
|
||||
$custom_link_name = nullable_htmlentities($row['custom_link_name']);
|
||||
$custom_link_uri = nullable_htmlentities($row['custom_link_uri']);
|
||||
$custom_link_icon = nullable_htmlentities($row['custom_link_icon']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="#" data-toggle="modal" data-target="#editLinkModal<?php echo $custom_link_id; ?>">
|
||||
<i class="fa fa-fw fa-<?php echo $custom_link_icon; ?> mr-2"></i>
|
||||
<?php echo $custom_link_name;?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $custom_link_uri; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLinkModal<?php echo $custom_link_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_custom_link=<?php echo $custom_link_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "admin_custom_link_edit_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "pagination.php";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "admin_custom_link_add_modal.php";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
@@ -113,8 +113,6 @@ function fetchDatabaseStructureFromServer() {
|
||||
}
|
||||
}
|
||||
|
||||
//$mysqli->close();
|
||||
|
||||
return $tables;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ $purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'htt
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['document_id'])) {
|
||||
$document_id = intval($_GET['document_id']);
|
||||
$document_id = intval($_GET['document_id']);
|
||||
}
|
||||
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_template = 1 AND document_id = $document_id");
|
||||
@@ -26,36 +26,36 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="clients.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_document_templates.php">Document Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
|
||||
</ol>
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="clients.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_document_templates.php">Document Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file mr-2"></i><?php echo $document_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i><?php echo $document_name; ?></h3>
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file mr-2"></i><?php echo $document_name; ?></h3>
|
||||
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-edit mr-2"></i>Edit
|
||||
</button>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">
|
||||
<i class="fas fa-edit mr-2"></i>Edit
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $document_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $document_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/pretty_content.js"></script>
|
||||
<script src="js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-sm table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
|
||||
58
admin_role_add_modal.php
Normal file
58
admin_role_add_modal.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<div class="modal" id="addRoleModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Add new role</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-shield"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="role_name" placeholder="Role Name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <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-chevron-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="role_description" placeholder="Role Description" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Admin Access <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-tools"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="role_is_admin" required>
|
||||
<option value="0">No - edit after creation to set permissions</option>
|
||||
<option value="1">Yes - this role should have full admin access</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_role" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
119
admin_role_edit_modal.php
Normal file
119
admin_role_edit_modal.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<div class="modal" id="editRoleModal<?php echo $role_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-user-shield mr-2"></i>Editing role:
|
||||
<strong><?php echo $role_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="role_id" value="<?php echo $role_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-role-details<?php echo $role_id; ?>">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-role-access<?php echo $role_id; ?>">Access</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-role-details<?php echo $role_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-shield"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="role_name" placeholder="Role Name" value="<?php echo $role_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <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-chevron-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="role_description" placeholder="Role Description" value="<?php echo $role_description; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label>Admin Access <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-tools"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="role_is_admin" required>
|
||||
<option value="1" <?php if ($role_admin) { echo 'selected'; } ?> >Yes - this role should have full admin access</option>
|
||||
<option value="0" <?php if (!$role_admin) { echo 'selected'; } ?>>No - use permissions on the next tab</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-role-access<?php echo $role_id; ?>">
|
||||
|
||||
<?php if ($role_admin) { ?>
|
||||
<div class="alert alert-warning"><strong>Module permissions do not apply to Admins.</strong></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
|
||||
// Enumerate modules
|
||||
$sql_modules = mysqli_query($mysqli, "SELECT * FROM modules");
|
||||
while ($row_modules = mysqli_fetch_array($sql_modules)) {
|
||||
$module_id = intval($row_modules['module_id']);
|
||||
$module_name = nullable_htmlentities($row_modules['module_name']);
|
||||
$module_name_display = ucfirst(str_replace("module_","",$module_name));
|
||||
$module_description = nullable_htmlentities($row_modules['module_description']);
|
||||
|
||||
// Get permission level for module
|
||||
$module_permission_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_role_permission_level FROM user_role_permissions WHERE module_id = $module_id AND user_role_id = $role_id LIMIT 1"));
|
||||
$module_permission = 0;
|
||||
if ($module_permission_row) {
|
||||
$module_permission = $module_permission_row['user_role_permission_level'];
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
<label> <?php echo $module_name_display ?> <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<select class="form-control select2" name="<?php echo "$module_id##$module_name" ?>" required>
|
||||
<option value="0" <?php if ($module_permission == 0) { echo 'selected'; } ?> >None</option>
|
||||
<option value="1" <?php if ($module_permission == 1) { echo 'selected'; } ?> >Read</option>
|
||||
<option value="2" <?php if ($module_permission == 2) { echo 'selected'; } ?>>Modify (Read, Edit, Archive)</option>
|
||||
<option value="3" <?php if ($module_permission == 3) { echo 'selected'; } ?>>Full (Read, Edit, Archive, Delete)</option>
|
||||
</select>
|
||||
</div>
|
||||
<small class="form-text text-muted"><?php echo $module_description ?></small>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } // End while ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_role" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
135
admin_roles.php
Normal file
135
admin_roles.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "user_role_is_admin";
|
||||
$order = "DESC";
|
||||
|
||||
require_once "inc_all_admin.php";
|
||||
|
||||
|
||||
//Rebuild URL
|
||||
$url_query_strings_sort = http_build_query($get_copy);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM user_roles
|
||||
WHERE (user_roles.user_role_name LIKE '%$q%' OR user_roles.user_role_description LIKE '%$q%')
|
||||
AND user_roles.user_role_archived_at IS NULL
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
<div class="alert alert-danger"><strong>Roles are not yet active/enforced - do not use.</strong><hr></div>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-user-shield mr-2"></i>Roles</h3>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addRoleModal">
|
||||
<i class="fas fa-fw fa-user-plus mr-2"></i>New Role
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form class="mb-4" autocomplete="off">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(nullable_htmlentities($q));} ?>" placeholder="Search Roles">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_name&order=<?php echo $disp; ?>">Name</a></th>
|
||||
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_description&order=<?php echo $disp; ?>">Description</a></th>
|
||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_role_is_admin&order=<?php echo $disp; ?>">Admin</a></th>
|
||||
<th><a class="text-dark">User count</a></th>
|
||||
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$role_id = intval($row['user_role_id']);
|
||||
$role_name = nullable_htmlentities($row['user_role_name']);
|
||||
$role_description = nullable_htmlentities($row['user_role_description']);
|
||||
$role_admin = intval($row['user_role_is_admin']);
|
||||
$role_archived_at = nullable_htmlentities($row['user_role_archived_at']);
|
||||
|
||||
// Count number of users that have each role
|
||||
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(users.user_id) FROM users LEFT JOIN user_settings on users.user_id = user_settings.user_id WHERE user_role = $role_id AND user_archived_at IS NULL");
|
||||
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
|
||||
<div class="text-secondary"><?php echo $role_name; ?></div>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $role_description; ?></td>
|
||||
<td><?php echo $role_admin ? 'Yes' : 'No' ; ?></td>
|
||||
<td><?php echo $role_user_count ?></td>
|
||||
<td>
|
||||
<?php if ($role_id !== 3) { ?>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editRoleModal<?php echo $role_id; ?>">
|
||||
<i class="fas fa-fw fa-user-edit mr-2"></i>Edit
|
||||
</a>
|
||||
|
||||
<?php if (empty($role_archived_at) && $role_user_count == 0) { ?>
|
||||
<!-- To be added -->
|
||||
<div class="dropdown-divider"></div>
|
||||
<!-- <a class="dropdown-item text-danger confirm-link" href="post.php?archive_role=--><?php //echo $role_id; ?><!--&csrf_token=--><?php //echo $_SESSION['csrf_token'] ?><!--">-->
|
||||
<!-- <i class="fas fa-fw fa-archive mr-2"></i>Archive-->
|
||||
<!-- </a>-->
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "admin_role_edit_modal.php";
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "pagination.php";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "admin_role_add_modal.php";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</li>
|
||||
|
||||
<!-- TAGS & CATEGORIES Section -->
|
||||
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_tags.php', 'admin_categories.php', 'admin_taxes.php', 'admin_account_types.php', 'admin_ticket_statuses.php']) ? 'menu-open' : ''); ?>">
|
||||
<li class="nav-item has-treeview mt-2 <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['admin_tags.php', 'admin_categories.php', 'admin_taxes.php', 'admin_account_types.php', 'admin_ticket_statuses.php', 'admin_custom_links.php']) ? 'menu-open' : ''); ?>">
|
||||
<a href="#" class="nav-link">
|
||||
<p>
|
||||
TAGS & CATEGORIES
|
||||
@@ -57,18 +57,18 @@
|
||||
<p>Taxes</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="admin_account_types.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_account_types.php' ? 'active' : ''); ?>">
|
||||
<i class="nav-icon fas fa-money-bill-wave"></i>
|
||||
<p>Account Types</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="admin_ticket_statuses.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_ticket_statuses.php' ? 'active' : ''); ?>">
|
||||
<i class="nav-icon fas fa-info-circle"></i>
|
||||
<p>Ticket Statuses</p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="admin_custom_links.php" class="nav-link <?php echo (basename($_SERVER['PHP_SELF']) == 'admin_custom_links.php' ? 'active' : ''); ?>">
|
||||
<i class="nav-icon fas fa-external-link-alt"></i>
|
||||
<p>Custom Links</p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ $purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'htt
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['ticket_template_id'])) {
|
||||
$ticket_template_id = intval($_GET['ticket_template_id']);
|
||||
$ticket_template_id = intval($_GET['ticket_template_id']);
|
||||
}
|
||||
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id");
|
||||
@@ -30,101 +30,101 @@ $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="clients.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_ticket_templates.php">Ticket Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
||||
</ol>
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="clients.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_ticket_templates.php">Ticket Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-2">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo $ticket_template_name; ?></h3>
|
||||
<div><small class="text-secondary"><?php echo $ticket_template_description; ?></small></div>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-2">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo $ticket_template_name; ?></h3>
|
||||
<div><small class="text-secondary"><?php echo $ticket_template_description; ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal<?php echo $template_id; ?>">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<h5><?php echo $ticket_subject; ?></h5>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $ticket_template_details; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal<?php echo $template_id; ?>">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<h5><?php echo $ticket_subject; ?></h5>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $ticket_template_details; ?>
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="task_name" placeholder="Task name">
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check mr-2"></i>Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-striped table-sm">
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
||||
$task_id = intval($row['task_template_id']);
|
||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||
$task_order = intval($row['task_template_order']);
|
||||
$task_description = nullable_htmlentities($row['task_template_description']);
|
||||
?>
|
||||
<tr>
|
||||
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
||||
<td><?php echo $task_name; ?></td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-link btn-sm text-secondary" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
||||
<i class="fa fa-fw fa-pencil-alt"></i>
|
||||
</button>
|
||||
<a href="post.php?delete_task_template=<?php echo $task_id; ?>" class="btn btn-link btn-sm text-danger">
|
||||
<i class="fa fa-fw fa-trash-alt"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
require "task_edit_modal.php";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-4">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tasks"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="task_name" placeholder="Task name">
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check mr-2"></i>Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-striped table-sm">
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_task_templates)){
|
||||
$task_id = intval($row['task_template_id']);
|
||||
$task_name = nullable_htmlentities($row['task_template_name']);
|
||||
$task_order = intval($row['task_template_order']);
|
||||
$task_description = nullable_htmlentities($row['task_template_description']);
|
||||
?>
|
||||
<tr>
|
||||
<td><i class="far fa-fw fa-square text-secondary"></i></td>
|
||||
<td><?php echo $task_name; ?></td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-link btn-sm text-secondary" data-toggle="modal" data-target="#editTaskModal<?php echo $task_id; ?>">
|
||||
<i class="fa fa-fw fa-pencil-alt"></i>
|
||||
</button>
|
||||
<a href="post.php?delete_task_template=<?php echo $task_id; ?>" class="btn btn-link btn-sm text-danger">
|
||||
<i class="fa fa-fw fa-trash-alt"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
require "task_edit_modal.php";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="js/pretty_content.js"></script>
|
||||
<script src="js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
$sql_last_login = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM logs
|
||||
"SELECT * FROM logs
|
||||
WHERE log_user_id = $user_id AND log_type = 'Login'
|
||||
ORDER BY log_id DESC LIMIT 1"
|
||||
);
|
||||
|
||||
18
ajax.php
18
ajax.php
@@ -321,12 +321,7 @@ if (isset($_GET['share_generate_link'])) {
|
||||
]
|
||||
];
|
||||
|
||||
$mail = addToMailQueue($mysqli, $data);
|
||||
|
||||
if ($mail !== true) {
|
||||
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $item_email'");
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $item_email regarding $subject. $item_mail', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||
}
|
||||
addToMailQueue($mysqli, $data);
|
||||
|
||||
}
|
||||
|
||||
@@ -463,17 +458,6 @@ if (isset($_GET['get_client_contacts'])) {
|
||||
echo json_encode($response);
|
||||
}
|
||||
|
||||
/*
|
||||
* Dynamic TOTP "resolver"
|
||||
* When provided with a TOTP secret, returns a 6-digit code
|
||||
* // TODO: Check if this can now be removed
|
||||
*/
|
||||
if (isset($_GET['get_totp_token'])) {
|
||||
$otp = TokenAuth6238::getTokenCode(strtoupper($_GET['totp_secret']));
|
||||
|
||||
echo json_encode($otp);
|
||||
}
|
||||
|
||||
/*
|
||||
* NEW TOTP getter for client login/passwords page
|
||||
* When provided with a login ID, checks permissions and returns the 6-digit code
|
||||
|
||||
@@ -12,42 +12,36 @@ if (isset($_GET['asset_id'])) {
|
||||
|
||||
} elseif (isset($_GET['asset_type'])) {
|
||||
// Asset query via type
|
||||
|
||||
$type = mysqli_real_escape_string($mysqli, ucfirst($_GET['asset_type']));
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_type = '$type' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['asset_name'])) {
|
||||
// Asset query via name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['asset_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_name = '$name' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['asset_serial'])) {
|
||||
// Asset query via serial
|
||||
|
||||
$serial = mysqli_real_escape_string($mysqli, $_GET['asset_serial']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_serial = '$serial' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Asset query via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['asset_mac'])) {
|
||||
// Asset query via mac
|
||||
|
||||
$mac = mysqli_real_escape_string($mysqli, $_GET['asset_mac']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE interface_mac = '$mac' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['asset_uri'])) {
|
||||
// Asset query via mac
|
||||
|
||||
$mac = mysqli_real_escape_string($mysqli, $_GET['asset_uri']);
|
||||
// Asset query via uri
|
||||
$uri = mysqli_real_escape_string($mysqli, $_GET['asset_uri']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_uri = '$uri' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
}
|
||||
// All assets
|
||||
else {
|
||||
} elseif (isset($_GET['asset_uri_2'])) {
|
||||
// Asset query via uri2
|
||||
$uri2 = mysqli_real_escape_string($mysqli, $_GET['asset_uri']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_uri_2 = '$uri2' AND asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
}else {
|
||||
// All assets (by client ID or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN asset_interfaces ON interface_asset_id = asset_id AND interface_primary = 1 WHERE asset_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,18 +12,11 @@ if (isset($_GET['certificate_id'])) {
|
||||
|
||||
} elseif (isset($_GET['certificate_name'])) {
|
||||
// Certificate by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['certificate_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_name = '$name' AND certificate_client_id LIKE '$client_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Certificate via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id = '$client_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} else {
|
||||
// All certificates
|
||||
|
||||
// All certificates (by client ID or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id LIKE '$client_id' ORDER BY certificate_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -4,21 +4,13 @@ require_once '../validate_api_key.php';
|
||||
|
||||
require_once '../require_get_method.php';
|
||||
|
||||
|
||||
// Specific client via ID (single)
|
||||
if (isset($_GET['client_id'])) {
|
||||
$id = intval($_GET['client_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = '$id' AND client_id LIKE '$client_id'");
|
||||
|
||||
} elseif (isset($_GET['client_name'])) {
|
||||
// Specific client via name (single)
|
||||
|
||||
// Specific client via name (single)
|
||||
if (isset($_GET['client_name'])) {
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['client_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_name = '$name' AND client_id LIKE '$client_id'");
|
||||
|
||||
} else {
|
||||
// All clients
|
||||
|
||||
// All clients (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id LIKE '$client_id' ORDER BY client_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,19 +12,16 @@ if (isset($_GET['contact_id'])) {
|
||||
|
||||
} elseif (isset($_GET['contact_email'])) {
|
||||
// Specific contact via email (single)
|
||||
|
||||
$email = mysqli_real_escape_string($mysqli, $_GET['contact_email']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_email = '$email' AND contact_client_id LIKE '$client_id'");
|
||||
|
||||
} elseif (isset($_GET['contact_phone_or_mobile'])) {
|
||||
// Specific contact via phone number or mobile (single)
|
||||
|
||||
$phone_or_mob = mysqli_real_escape_string($mysqli, $_GET['contact_phone_or_mobile']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_mobile = '$phone_or_mob' OR contact_phone = '$phone_or_mob' AND contact_client_id LIKE '$client_id' LIMIT 1");
|
||||
|
||||
} else {
|
||||
// All contacts
|
||||
|
||||
// All contacts (by client ID, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id LIKE '$client_id' ORDER BY contact_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,8 @@ if (isset($_GET['document_id'])) {
|
||||
$id = intval($_GET['document_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = '$id' AND document_client_id LIKE '$client_id'");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Documents via client ID (multiple)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id LIKE '$client_id' AND document_archived_at IS NULL");
|
||||
|
||||
} else {
|
||||
// All documents
|
||||
// All documents (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id LIKE '$client_id' ORDER BY document_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,18 +12,11 @@ if (isset($_GET['domain_id'])) {
|
||||
|
||||
} elseif (isset($_GET['domain_name'])) {
|
||||
// Domain by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['domain_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_name = '$name' AND domain_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Domain via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id LIKE '$client_id' ORDER BY domain_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} else {
|
||||
// All domains
|
||||
|
||||
// All domains (by client ID or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id LIKE '$client_id' ORDER BY domain_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ require_once '../require_get_method.php';
|
||||
|
||||
if (isset($_GET['invoice_id'])) {
|
||||
// Invoice via ID (single)
|
||||
|
||||
$id = intval($_GET['invoice_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = '$id' AND invoice_client_id LIKE '$client_id'");
|
||||
|
||||
} else {
|
||||
// All invoices
|
||||
|
||||
// All invoices (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_client_id LIKE '$client_id' ORDER BY invoice_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ require_once '../require_get_method.php';
|
||||
|
||||
if (isset($_GET['location_id'])) {
|
||||
// Location via ID (single)
|
||||
|
||||
$id = intval($_GET['location_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_id = '$id' AND location_client_id LIKE '$client_id'");
|
||||
|
||||
} else {
|
||||
// All locations
|
||||
|
||||
// All locations (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM locations WHERE location_client_id LIKE '$client_id' ORDER BY location_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,18 +12,11 @@ if (isset($_GET['network_id'])) {
|
||||
|
||||
} elseif (isset($_GET['network_name'])) {
|
||||
// Network by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['network_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_name = '$name' AND network_client_id LIKE '$client_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Network via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_client_id LIKE '$client_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} else {
|
||||
// All networks
|
||||
|
||||
// All networks (by client ID or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM networks WHERE network_client_id LIKE '$client_id' ORDER BY network_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,11 @@ require_once '../require_get_method.php';
|
||||
|
||||
if (isset($_GET['product_id']) && $client_id == "%") {
|
||||
// product via ID (single)
|
||||
|
||||
$id = intval($_GET['product_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products WHERE product_id = '$id'");
|
||||
|
||||
} elseif ($client_id == "%") {
|
||||
// All products
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM products ORDER BY product_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,11 @@ require_once '../require_get_method.php';
|
||||
|
||||
if (isset($_GET['quote_id'])) {
|
||||
// quote via ID (single)
|
||||
|
||||
$id = intval($_GET['quote_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_id LIKE '$id' AND quote_client_id = '$client_id'");
|
||||
|
||||
} else {
|
||||
// All quotes
|
||||
|
||||
// All quotes (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_client_id LIKE '$client_id' ORDER BY quote_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,30 +12,21 @@ if (isset($_GET['software_id'])) {
|
||||
|
||||
} elseif (isset($_GET['software_key'])) {
|
||||
// Specific software via key
|
||||
|
||||
$key = mysqli_real_escape_string($mysqli, $_GET['software_license']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_key = '$key' AND software_client_id LIKE '$client_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['software_name'])) {
|
||||
// Software by name
|
||||
|
||||
$name = mysqli_real_escape_string($mysqli, $_GET['software_name']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_name = '$name' AND software_client_id LIKE '$client_id' ORDER BY asset_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['software_type'])) {
|
||||
// Software via type
|
||||
|
||||
$type = intval($_GET['software_type']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_type = '$type' AND software_client_id LIKE '$client_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} elseif (isset($_GET['client_id'])) {
|
||||
// Software via client ID
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id LIKE '$client_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
|
||||
} else {
|
||||
// All software(s)
|
||||
|
||||
// All software(s) (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM software WHERE software_client_id LIKE '$client_id' ORDER BY software_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,15 @@ require_once '../require_get_method.php';
|
||||
// Specific ticket via ID (single)
|
||||
if (isset($_GET['ticket_id'])) {
|
||||
$id = intval($_GET['ticket_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = '$id' AND ticket_client_id LIKE '$client_id'");
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM tickets
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE ticket_id = '$id' AND ticket_client_id LIKE '$client_id'"
|
||||
);
|
||||
|
||||
} else {
|
||||
// All tickets
|
||||
|
||||
// All tickets (by client ID if given, or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id LIKE '$client_id' ORDER BY ticket_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
*/
|
||||
|
||||
// Includes
|
||||
require_once(__DIR__ . '../../../functions.php');
|
||||
require_once(__DIR__ . "../../../config.php");
|
||||
require_once __DIR__ . '../../../functions.php';
|
||||
require_once __DIR__ . "../../../config.php";
|
||||
|
||||
// JSON header
|
||||
header('Content-Type: application/json');
|
||||
|
||||
19
api/v1/vendors/read.php
vendored
Normal file
19
api/v1/vendors/read.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
require_once '../validate_api_key.php';
|
||||
|
||||
require_once '../require_get_method.php';
|
||||
|
||||
// Specific vendor via their ID (single)
|
||||
if (isset($_GET['vendor_id'])) {
|
||||
$id = intval($_GET['vendor_id']);
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_id = '$id' AND vendor_client_id LIKE '$client_id'");
|
||||
|
||||
} else {
|
||||
// All Vendors (by client ID or all in general if key permits)
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id LIKE '$client_id' ORDER BY vendor_id LIMIT $limit OFFSET $offset");
|
||||
}
|
||||
|
||||
// Output
|
||||
require_once "../read_output.php";
|
||||
|
||||
49
blank.php
49
blank.php
@@ -1,17 +1,17 @@
|
||||
<?php require_once "inc_all.php"; ?>
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Blank Page</li>
|
||||
</ol>
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="index.html">Dashboard</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Blank Page</li>
|
||||
</ol>
|
||||
|
||||
<!-- Page Content -->
|
||||
<h1>Blank Page</h1>
|
||||
<hr>
|
||||
<p>This is a great starting point for new custom pages.</p>
|
||||
<!-- Page Content -->
|
||||
<h1>Blank Page</h1>
|
||||
<hr>
|
||||
<p>This is a great starting point for new custom pages.</p>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -19,28 +19,31 @@ $start_date = date('Y') . "-10-10";
|
||||
|
||||
echo "<H1>$start_date</H1>";
|
||||
|
||||
echo "<H2>User Agent</H2>";
|
||||
echo getUserAgent();
|
||||
|
||||
|
||||
?>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<dl>
|
||||
<dt>Requester</dt>
|
||||
<dd>Sam Adams</dd>
|
||||
<dl>
|
||||
<dt>Requester</dt>
|
||||
<dd>Sam Adams</dd>
|
||||
|
||||
<dt>Created</dt>
|
||||
<dd><time datetime="2024-04-11T17:52:30+00:00" title="2024-04-11 13:52" data-datetime="calendar">Today at 13:52</time></dd>
|
||||
<dt>Created</dt>
|
||||
<dd><time datetime="2024-04-11T17:52:30+00:00" title="2024-04-11 13:52" data-datetime="calendar">Today at 13:52</time></dd>
|
||||
|
||||
<dt>Last activity</dt>
|
||||
<dd><time datetime="2024-04-11T18:08:55+00:00" title="2024-04-11 14:08" data-datetime="calendar">Today at 14:08</time></dd>
|
||||
</dl>
|
||||
<dt>Last activity</dt>
|
||||
<dd><time datetime="2024-04-11T18:08:55+00:00" title="2024-04-11 14:08" data-datetime="calendar">Today at 14:08</time></dd>
|
||||
</dl>
|
||||
|
||||
<?php echo randomString(100); ?>
|
||||
<br>
|
||||
<?php echo randomString(100); ?>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
// show the current Date and Time
|
||||
$date_time = date('Y-m-d H:i:s');
|
||||
echo "Current Date and Time: <strong>$date_time</strong>";
|
||||
echo "Current Date and Time: <strong>$date_time</strong>";
|
||||
?>
|
||||
|
||||
<script>toastr.success('Have Fun Wozz!!')</script>
|
||||
|
||||
@@ -50,7 +50,7 @@ $grandTotal = 0;
|
||||
<div class="form-group">
|
||||
<select class="form-control" name="year" id="yearSelect" onchange="submit();">
|
||||
<?php foreach ($years as $year): ?>
|
||||
<option value="<?php echo $year; ?>" <?php if ($year == $currentYear) echo 'selected'; ?>><?php echo $year; ?></option>
|
||||
<option value="<?php echo $year; ?>" <?php if ($year == $currentYear) { echo 'selected'; } ?>><?php echo $year; ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
@@ -69,9 +69,9 @@ $grandTotal = 0;
|
||||
<?php foreach ($categories as $category): ?>
|
||||
<tr>
|
||||
<td><?php echo nullable_htmlentities($category['category_name']); ?></td>
|
||||
<?php
|
||||
<?php
|
||||
$rowTotal = 0;
|
||||
foreach ($months as $index => $month):
|
||||
foreach ($months as $index => $month):
|
||||
$amount = getBudgetAmount($budgets, $category['category_id'], $index + 1);
|
||||
$rowTotal += $amount;
|
||||
$columnTotals[$index] += $amount;
|
||||
@@ -80,7 +80,7 @@ $grandTotal = 0;
|
||||
<?php endforeach; ?>
|
||||
<td><?php echo $rowTotal; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
$grandTotal += $rowTotal;
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
@@ -66,9 +66,9 @@ $grandTotal = 0;
|
||||
<?php foreach ($categories as $category): ?>
|
||||
<tr>
|
||||
<td><?php echo nullable_htmlentities($category['category_name']); ?></td>
|
||||
<?php
|
||||
<?php
|
||||
$rowTotal = 0;
|
||||
foreach ($months as $index => $month):
|
||||
foreach ($months as $index => $month):
|
||||
$amount = getBudgetAmount($budgets, $category['category_id'], $index + 1);
|
||||
$rowTotal += $amount;
|
||||
$columnTotals[$index] += $amount;
|
||||
@@ -77,7 +77,7 @@ $grandTotal = 0;
|
||||
<?php endforeach; ?>
|
||||
<td><?php echo $rowTotal; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
$grandTotal += $rowTotal;
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
@@ -52,6 +52,9 @@ if ($session_user_role == 3) {
|
||||
} else {
|
||||
$session_user_role_display = "Accountant";
|
||||
}
|
||||
if (isset($row['user_role_is_admin']) && $row['user_role_is_admin'] == 1) {
|
||||
$session_is_admin = true;
|
||||
}
|
||||
$session_user_config_force_mfa = intval($row['user_config_force_mfa']);
|
||||
$user_config_records_per_page = intval($row['user_config_records_per_page']);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
@@ -334,7 +334,7 @@ if (isset($_GET['asset_id'])) {
|
||||
</a>
|
||||
<?php if ($session_user_role == 3 && $interface_primary == 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset_interface=<?php echo $interface_id; ?>">
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset_interface=<?php echo $interface_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
@@ -389,6 +390,8 @@
|
||||
<textarea class="form-control" rows="8" placeholder="Enter some notes" name="notes"><?php echo $asset_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Asset ID: <?= $asset_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<?php require_once "inc_export_warning.php";
|
||||
?>
|
||||
<?php require_once "inc_export_warning.php"; ?>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<p><strong>Format csv file with headings & data:</strong><br>Name, Description, Type, Make, Model, Serial, OS, Assigned To, Location</p>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="interface_id" value="<?php echo $interface_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="current_asset_id" value="<?php echo $asset_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -105,10 +105,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importAssetModal">
|
||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportAssetModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportAssetModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,11 +149,35 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="show_column[]" data-placeholder="- Show Additional Columns -" multiple>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('OS', $_GET['show_column'])) { echo 'selected'; } ?>>OS
|
||||
</option>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('IP', $_GET['show_column'])) { echo 'selected'; } ?>>IP
|
||||
</option>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { echo 'selected'; } ?>>Purchase_Date
|
||||
</option>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { echo 'selected'; } ?>>Install_Date
|
||||
</option>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { echo 'selected'; } ?>>Warranty_Expire
|
||||
</option>
|
||||
<option
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Physical_Location', $_GET['show_column'])) { echo 'selected'; } ?>>Physical_Location
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="btn-toolbar float-right">
|
||||
<div class="btn-group mr-5">
|
||||
<?php if($all_count) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sort; ?>&type=" class="btn <?php if ($_GET['type'] == 'all' || empty($_GET['type'])) { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">All Assets<span class="right badge badge-light ml-2"><?php echo $all_count; ?></span></a>
|
||||
<?php if ($all_count) { ?>
|
||||
<a href="?<?php echo $url_query_strings_sort; ?>&type=" class="btn <?php if ($_GET['type'] == 'all' || empty($_GET['type'])) { echo 'btn-primary'; } else { echo 'btn-default'; } ?>">All Assets<span class="right badge badge-light ml-2"><?php echo $all_count; ?></span></a>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if ($workstation_count > 0) { ?>
|
||||
@@ -176,7 +202,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
} ?>
|
||||
</div>
|
||||
<div class="btn-group mr-2">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
|
||||
<a href="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -218,6 +244,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</form>
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table border table-hover">
|
||||
<thead class="thead-light <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
|
||||
@@ -236,16 +264,43 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<?php }
|
||||
if ($_GET['type'] !== 'virtual') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_serial&order=<?php echo $disp; ?>">Serial</a></th>
|
||||
<?php }
|
||||
if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('OS', $_GET['show_column'])) { ?>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_os&order=<?php echo $disp; ?>">OS</a></th>
|
||||
<?php } ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=interface_ip&order=<?php echo $disp; ?>">IP</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_install_date&order=<?php echo $disp; ?>">Install Date</a></th>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('IP', $_GET['show_column'])) { ?>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=interface_ip&order=<?php echo $disp; ?>">IP</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_purchase_date&order=<?php echo $disp; ?>">Purchase Date</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_install_date&order=<?php echo $disp; ?>">Install Date</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_warranty_expire&order=<?php echo $disp; ?>">Warranty Expire</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Assigned To</a></th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Assigned To</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">Location</a></th>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Physical_Location', $_GET['show_column'])) { ?>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_physical_location&order=<?php echo $disp; ?>">Physical Location</a>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=asset_status&order=<?php echo $disp; ?>">Status</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
@@ -258,7 +313,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$asset_type = nullable_htmlentities($row['asset_type']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
$asset_description = nullable_htmlentities($row['asset_description']);
|
||||
if (empty($asset_description)) {
|
||||
if ($asset_description) {
|
||||
$asset_description_display = "-";
|
||||
} else {
|
||||
$asset_description_display = $asset_description;
|
||||
@@ -266,22 +321,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$asset_make = nullable_htmlentities($row['asset_make']);
|
||||
$asset_model = nullable_htmlentities($row['asset_model']);
|
||||
$asset_serial = nullable_htmlentities($row['asset_serial']);
|
||||
if (empty($asset_serial)) {
|
||||
$asset_serial_display = "-";
|
||||
} else {
|
||||
if ($asset_serial) {
|
||||
$asset_serial_display = $asset_serial;
|
||||
} else {
|
||||
$asset_serial_display = "-";
|
||||
}
|
||||
$asset_os = nullable_htmlentities($row['asset_os']);
|
||||
if (empty($asset_os)) {
|
||||
$asset_os_display = "-";
|
||||
} else {
|
||||
if ($asset_os) {
|
||||
$asset_os_display = $asset_os;
|
||||
} else {
|
||||
$asset_os_display = "-";
|
||||
}
|
||||
$asset_ip = nullable_htmlentities($row['interface_ip']);
|
||||
if (empty($asset_ip)) {
|
||||
$asset_ip_display = "-";
|
||||
} else {
|
||||
if ($asset_ip) {
|
||||
$asset_ip_display = $asset_ip;
|
||||
} else {
|
||||
$asset_ip_display = "-";
|
||||
}
|
||||
$asset_ipv6 = nullable_htmlentities($row['interface_ipv6']);
|
||||
$asset_nat_ip = nullable_htmlentities($row['interface_nat_ip']);
|
||||
@@ -290,15 +345,30 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$asset_uri_2 = nullable_htmlentities($row['asset_uri_2']);
|
||||
$asset_status = nullable_htmlentities($row['asset_status']);
|
||||
$asset_purchase_date = nullable_htmlentities($row['asset_purchase_date']);
|
||||
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||
if (empty($asset_install_date)) {
|
||||
$asset_install_date_display = "-";
|
||||
if ($asset_purchase_date) {
|
||||
$asset_purchase_date_display = $asset_purchase_date;
|
||||
} else {
|
||||
$asset_purchase_date_display = "-";
|
||||
}
|
||||
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||
if ($asset_warranty_expire) {
|
||||
$asset_warranty_expire_display = $asset_warranty_expire;
|
||||
} else {
|
||||
$asset_warranty_expire_display = "-";
|
||||
}
|
||||
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||
if ($asset_install_date) {
|
||||
$asset_install_date_display = $asset_install_date;
|
||||
} else {
|
||||
$asset_install_date_display = "-";
|
||||
}
|
||||
$asset_photo = nullable_htmlentities($row['asset_photo']);
|
||||
$asset_physical_location = nullable_htmlentities($row['asset_physical_location']);
|
||||
if ($asset_physical_location) {
|
||||
$asset_physical_location_display = $asset_physical_location;
|
||||
} else {
|
||||
$asset_physical_location_display = "-";
|
||||
}
|
||||
$asset_notes = nullable_htmlentities($row['asset_notes']);
|
||||
$asset_created_at = nullable_htmlentities($row['asset_created_at']);
|
||||
$asset_archived_at = nullable_htmlentities($row['asset_archived_at']);
|
||||
@@ -367,15 +437,30 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<?php if ($_GET['type'] !== 'virtual') { ?>
|
||||
<td><?php echo $asset_serial_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('OS', $_GET['show_column'])) { ?>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
|
||||
<td><?php echo $asset_os_display; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo $asset_ip_display; ?></td>
|
||||
<td><?php echo $asset_install_date_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('IP', $_GET['show_column'])) { ?>
|
||||
<td><?php echo $asset_ip_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
|
||||
<td><?php echo $asset_purchase_date_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
|
||||
<td><?php echo $asset_install_date_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
|
||||
<td><?php echo $asset_warranty_expire_display; ?></td>
|
||||
<?php } ?>
|
||||
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'servers') { ?>
|
||||
<td><?php echo $contact_name_display; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo $location_name_display; ?></td>
|
||||
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Physical_Location', $_GET['show_column'])) { ?>
|
||||
<td><?php echo $asset_physical_location_display; ?></td>
|
||||
<?php } ?>
|
||||
<td><?php echo $asset_status; ?></td>
|
||||
<td class="text-center">
|
||||
<div class="btn-group">
|
||||
@@ -462,19 +547,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</a>
|
||||
<?php if ($session_user_role > 2) { ?>
|
||||
<?php if ($asset_archived_at) { ?>
|
||||
<a class="dropdown-item text-info" href="post.php?unarchive_asset=<?php echo $asset_id; ?>">
|
||||
<a class="dropdown-item text-info" href="post.php?unarchive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-redo mr-2"></i>Unarchive
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#transferAssetModal<?php echo $asset_id; ?>">
|
||||
<i class="fas fa-fw fa-arrow-right mr-2"></i>Transfer
|
||||
</a>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_asset=<?php echo $asset_id; ?>">
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($config_destructive_deletes_enable) { ?>
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?php echo $asset_id; ?>">
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -26,12 +26,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addCertificateModal"><i class="fas fa-plus mr-2"></i>New Certificate</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCertificateModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportCertificateModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -100,8 +102,27 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||
$certificate_created_at = nullable_htmlentities($row['certificate_created_at']);
|
||||
|
||||
$certificate_expire_ago = timeAgo($certificate_expire);
|
||||
// Convert the expiry date to a timestamp
|
||||
$certificate_expire_timestamp = strtotime($row['certificate_expire']);
|
||||
$current_timestamp = time(); // Get current timestamp
|
||||
|
||||
// Calculate the difference in days
|
||||
$days_until_expiry = ($certificate_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
|
||||
|
||||
// Determine the class based on the number of days until expiry
|
||||
if ($days_until_expiry <= 0) {
|
||||
$tr_class = "table-secondary";
|
||||
} elseif ($days_until_expiry <= 14) {
|
||||
$tr_class = "table-danger";
|
||||
} elseif ($days_until_expiry <= 90) {
|
||||
$tr_class = "table-warning";
|
||||
} else {
|
||||
$tr_class = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<tr class="<?php echo $tr_class; ?>">
|
||||
<td class="pr-0">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input bulk-select" type="checkbox" name="certificate_ids[]" value="<?php echo $certificate_id ?>">
|
||||
@@ -123,7 +144,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<td><?php echo $certificate_issued_by; ?></td>
|
||||
|
||||
<td><?php echo $certificate_expire; ?></td>
|
||||
<td>
|
||||
<div><?php echo $certificate_expire; ?></div>
|
||||
<div><small><?php echo $certificate_expire_ago; ?></small></div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
|
||||
@@ -297,10 +297,10 @@ if (isset($_GET['contact_id'])) {
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset=<?php echo $asset_id; ?>">
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_asset=<?php echo $asset_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -276,6 +276,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Contact ID: <?= $contact_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -90,7 +90,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
|
||||
@@ -126,7 +126,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<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; } ?>"
|
||||
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
|
||||
@@ -188,6 +188,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table border">
|
||||
<thead class="thead-light <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
|
||||
@@ -198,7 +199,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</td>
|
||||
<th><a class="text-secondary ml-3" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_name&order=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_department&order=<?php echo $disp; ?>">Department</a></th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=contact_department&order=<?php echo $disp; ?>">Department
|
||||
</a>
|
||||
</th>
|
||||
<th>Contact</th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=location_name&order=<?php echo $disp; ?>">Location</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
|
||||
@@ -35,6 +35,7 @@ $document_updated_at = nullable_htmlentities($row['document_updated_at']);
|
||||
$document_archived_at = nullable_htmlentities($row['document_archived_at']);
|
||||
$document_folder_id = intval($row['document_folder_id']);
|
||||
$document_parent = intval($row['document_parent']);
|
||||
$document_client_visible = intval($row['document_client_visible']);
|
||||
|
||||
?>
|
||||
|
||||
@@ -292,6 +293,24 @@ $document_parent = intval($row['document_parent']);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if ($config_client_portal_enable) { ?>
|
||||
<div class="card card-body bg-light">
|
||||
<h6><i class="fas fa-handshake mr-2"></i>Portal Collaboration</h6>
|
||||
<div class="mt-1">
|
||||
<i class="fa fa-fw fa-eye<?php if (!$document_client_visible) { echo '-slash'; } ?> text-secondary mr-2"></i>Document is
|
||||
<a href="#" data-toggle="modal" data-target="#editDocumentClientVisibileModal">
|
||||
<?php
|
||||
if ($document_client_visible) {
|
||||
echo "<span class='text-bold text-dark'>visible</span>";
|
||||
} else {
|
||||
echo "<span class='text-muted'>not visible</span>";
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="card card-body bg-light">
|
||||
<h6><i class="fas fa-history mr-2"></i>Revisions</h6>
|
||||
<?php
|
||||
@@ -345,6 +364,8 @@ require_once "client_document_link_software_modal.php";
|
||||
|
||||
require_once "client_document_link_vendor_modal.php";
|
||||
|
||||
require_once "document_edit_visibility_modal.php";
|
||||
|
||||
require_once "share_modal.php";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
@@ -198,6 +198,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-border">
|
||||
|
||||
@@ -35,12 +35,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDomainModal"><i class="fas fa-plus mr-2"></i>New Domain</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportDomainModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportDomainModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,7 +62,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<div class="col-md-8">
|
||||
<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="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -124,6 +126,24 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||
$domain_description = nullable_htmlentities($row['domain_description']);
|
||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||
$domain_expire_ago = timeAgo($domain_expire);
|
||||
// Convert the expiry date to a timestamp
|
||||
$domain_expire_timestamp = strtotime($row['domain_expire']);
|
||||
$current_timestamp = time(); // Get current timestamp
|
||||
|
||||
// Calculate the difference in days
|
||||
$days_until_expiry = ($domain_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
|
||||
|
||||
// Determine the class based on the number of days until expiry
|
||||
if ($days_until_expiry <= 0) {
|
||||
$tr_class = "table-secondary";
|
||||
} elseif ($days_until_expiry <= 14) {
|
||||
$tr_class = "table-danger";
|
||||
} elseif ($days_until_expiry <= 90) {
|
||||
$tr_class = "table-warning";
|
||||
} else {
|
||||
$tr_class = '';
|
||||
}
|
||||
$domain_registrar_name = nullable_htmlentities($row['registrar_name']);
|
||||
if($domain_registrar_name) {
|
||||
$domain_registrar_name_display = $domain_registrar_name;
|
||||
@@ -142,7 +162,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$domain_mailhost_name_display = $domain_mailhost_name ? $domain_mailhost_name : "-";
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<tr class="<?php echo $tr_class; ?>">
|
||||
<td class="pr-0">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input bulk-select" type="checkbox" name="domain_ids[]" value="<?php echo $domain_id ?>">
|
||||
@@ -163,7 +183,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<td><?php echo $domain_webhost_name_display; ?></td>
|
||||
<td><?php echo $domain_dnshost_name_display; ?></td>
|
||||
<td><?php echo $domain_mailhost_name_display; ?></td>
|
||||
<td><?php echo $domain_expire; ?></td>
|
||||
<td>
|
||||
<div><?php echo $domain_expire; ?></div>
|
||||
<div><small><?php echo $domain_expire_ago; ?></small></div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
|
||||
@@ -243,6 +243,7 @@ $num_of_files = mysqli_num_rows($sql);
|
||||
<?php } else { ?>
|
||||
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table border">
|
||||
|
||||
@@ -29,12 +29,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addInvoiceModal"><i class="fas fa-plus mr-2"></i>New Invoice</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportInvoiceModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportInvoiceModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -45,4 +45,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -182,16 +182,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="5" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-notes<?php echo $location_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="12" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||
<textarea class="form-control" rows="8" name="notes" placeholder="Notes, eg Parking Info, Building Access etc"><?php echo $location_notes; ?></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -215,6 +211,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right">Location ID: <?= $location_id ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -55,10 +55,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importLocationModal">
|
||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportLocationModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportLocationModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,7 +80,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<select onchange="this.form.submit()" class="form-control select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
|
||||
<?php $sql_tags = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 2");
|
||||
@@ -93,9 +95,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-5">
|
||||
<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="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -135,6 +137,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
@@ -265,7 +268,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,9 @@ $order = "ASC";
|
||||
|
||||
require_once "inc_all_client.php";
|
||||
|
||||
// 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");
|
||||
|
||||
|
||||
// Location Filter
|
||||
if (isset($_GET['location']) & !empty($_GET['location'])) {
|
||||
@@ -52,10 +55,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#importLoginModal">
|
||||
<i class="fa fa-fw fa-upload mr-2"></i>Import
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportLoginModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportLoginModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -96,7 +101,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<div class="col-md-6">
|
||||
<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="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -131,6 +136,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
@@ -159,7 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$login_uri = nullable_htmlentities($row['login_uri']);
|
||||
if (empty($login_uri)) {
|
||||
$login_uri_display = "-";
|
||||
} else {
|
||||
} else {
|
||||
$login_uri_display = truncate($login_uri,40) . "<button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$login_uri'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$login_uri_2 = nullable_htmlentities($row['login_uri_2']);
|
||||
@@ -198,18 +204,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
AND item_related_id = $login_id
|
||||
LIMIT 1"
|
||||
);
|
||||
$row = mysqli_fetch_array($sql_shared);
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_active = nullable_htmlentities($row['item_active']);
|
||||
$item_key = nullable_htmlentities($row['item_key']);
|
||||
$item_type = nullable_htmlentities($row['item_type']);
|
||||
$item_related_id = intval($row['item_related_id']);
|
||||
$item_note = nullable_htmlentities($row['item_note']);
|
||||
$item_views = nullable_htmlentities($row['item_views']);
|
||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
||||
if (mysqli_num_rows($sql_shared) > 0) {
|
||||
$row = mysqli_fetch_array($sql_shared);
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_active = nullable_htmlentities($row['item_active']);
|
||||
$item_key = nullable_htmlentities($row['item_key']);
|
||||
$item_type = nullable_htmlentities($row['item_type']);
|
||||
$item_related_id = intval($row['item_related_id']);
|
||||
$item_note = nullable_htmlentities($row['item_note']);
|
||||
$item_views = nullable_htmlentities($row['item_views']);
|
||||
$item_view_limit = nullable_htmlentities($row['item_view_limit']);
|
||||
$item_created_at = nullable_htmlentities($row['item_created_at']);
|
||||
$item_expire_at = nullable_htmlentities($row['item_expire_at']);
|
||||
$item_expire_at_human = timeAgo($row['item_expire_at']);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -237,10 +245,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<td><?php echo $otp_display; ?></td>
|
||||
<td><?php echo $login_uri_display; ?></td>
|
||||
<td>
|
||||
<?php if($item_id) { ?>
|
||||
<div title="Expires <?php echo $item_expire_at_human; ?>">
|
||||
<i class="fas fa-fw fa-link"></i> Shared
|
||||
</div>
|
||||
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
|
||||
<div title="Expires <?php echo $item_expire_at_human; ?>">
|
||||
<i class="fas fa-fw fa-link"></i> Shared
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
|
||||
@@ -1,166 +1,167 @@
|
||||
<div class="modal" id="editNetworkModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-network-wired mr-2"></i>Edit network: <span class="text-bold" id="editNetworkHeader"></span></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="network_id" id="editNetworkId" value="">
|
||||
<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">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pillsEditDetails">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditNetwork">Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditDNS">DNS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditNotes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pillsEditDetails">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkName" name="name" placeholder="Network name (VLAN, WAN, LAN2 etc)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkDescription" name="description" placeholder="Short Description">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" id="editNetworkLocation" name="location">
|
||||
<option value="">- Location -</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-network-wired mr-2"></i>Edit network: <span class="text-bold" id="editNetworkHeader"></span></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="network_id" id="editNetworkId" value="">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditNetwork">
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pillsEditDetails">Details</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditNetwork">Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditDNS">DNS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsEditNotes">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pillsEditDetails">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <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-ethernet"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkName" name="name" placeholder="Network name (VLAN, WAN, LAN2 etc)" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkDescription" name="description" placeholder="Short Description">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Location</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" id="editNetworkLocation" name="location">
|
||||
<option value="">- Location -</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditNetwork">
|
||||
|
||||
<div class="form-group">
|
||||
<label>vLAN</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*" id="editNetworkVlan" name="vlan" placeholder="ex. 20">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP / Network <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-network-wired"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkCidr" name="network" placeholder="Network or IP ex 192.168.1.0/24" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Subnet Mask</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mask"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkSubnet" name="subnet" placeholder="ex 255.255.255.0" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gateway <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-route"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkGw" name="gateway" placeholder="ex 192.168.1.1" data-inputmask="'alias': 'ip'" data-mask required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>DHCP Range / IPs</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkDhcp" name="dhcp_range" placeholder="ex 192.168.1.11-199">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditDNS">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Primary DNS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkPrimaryDNS" name="primary_dns" placeholder="ex 9.9.9.9" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Secondary DNS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkSecondaryDNS" name="secondary_dns" placeholder="ex 1.1.1.1" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditNotes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="12" id="editNetworkNotes" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
<p class="text-muted text-right" id="showNetworkId"></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>vLAN</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric" pattern="[0-9]*" id="editNetworkVlan" name="vlan" placeholder="ex. 20">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>IP / Network <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-network-wired"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkCidr" name="network" placeholder="Network or IP ex 192.168.1.0/24" required>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_network" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Subnet Mask</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-mask"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkSubnet" name="subnet" placeholder="ex 255.255.255.0" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Gateway <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-route"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkGw" name="gateway" placeholder="ex 192.168.1.1" data-inputmask="'alias': 'ip'" data-mask required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>DHCP Range / IPs</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkDhcp" name="dhcp_range" placeholder="ex 192.168.1.11-199">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditDNS">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Primary DNS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkPrimaryDNS" name="primary_dns" placeholder="ex 9.9.9.9" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Secondary DNS</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" id="editNetworkSecondaryDNS" name="secondary_dns" placeholder="ex 1.1.1.1" data-inputmask="'alias': 'ip'" data-mask>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pillsEditNotes">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="12" id="editNetworkNotes" name="notes" placeholder="Enter some notes"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_network" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,12 +30,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addNetworkModal"><i class="fas fa-plus mr-2"></i>New Network</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportNetworkModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportNetworkModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -115,7 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$network_primary_dns = nullable_htmlentities($row['network_primary_dns']);
|
||||
$network_secondary_dns = nullable_htmlentities($row['network_secondary_dns']);
|
||||
if ($network_primary_dns && $network_secondary_dns) {
|
||||
$network_dns_display = "$network_primary_dns<div class='text-secondary mt-1'>$network_secondary_dns</div>";
|
||||
$network_dns_display = "$network_primary_dns<div class='text-secondary mt-1'>$network_secondary_dns</div>";
|
||||
} else {
|
||||
$network_dns_display = "-";
|
||||
}
|
||||
|
||||
@@ -2,20 +2,27 @@
|
||||
|
||||
require_once "inc_all_client.php";
|
||||
|
||||
// Get expiration days from select box
|
||||
$expiration_days = isset($_GET['expiration_days']) ? intval($_GET['expiration_days']) : 90;
|
||||
|
||||
$sql_recent_activities = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM logs
|
||||
WHERE log_client_id = $client_id
|
||||
ORDER BY log_created_at DESC LIMIT 5"
|
||||
ORDER BY log_created_at DESC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
$sql_important_contacts = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM contacts
|
||||
WHERE contact_client_id = $client_id
|
||||
AND (contact_important = 1 OR contact_billing = 1 OR contact_technical = 1 OR contact_primary = 1)
|
||||
AND contact_archived_at IS NULL
|
||||
AND (contact_important = 1
|
||||
OR contact_billing = 1
|
||||
OR contact_technical = 1
|
||||
OR contact_primary = 1
|
||||
)
|
||||
AND contact_archived_at IS NULL
|
||||
ORDER BY contact_primary DESC, contact_name DESC LIMIT 5"
|
||||
);
|
||||
|
||||
@@ -23,24 +30,27 @@ $sql_recent_tickets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM tickets
|
||||
WHERE ticket_client_id = $client_id
|
||||
ORDER BY ticket_created_at DESC LIMIT 5"
|
||||
ORDER BY ticket_created_at ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
$sql_recent_logins = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM logins
|
||||
WHERE login_client_id = $client_id
|
||||
ORDER BY login_updated_at DESC LIMIT 5"
|
||||
ORDER BY login_updated_at ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
$sql_shared_items = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM shared_items
|
||||
WHERE item_client_id = $client_id
|
||||
AND item_active = 1
|
||||
AND item_views != item_view_limit
|
||||
AND item_expire_at > NOW()
|
||||
ORDER BY item_created_at DESC LIMIT 5"
|
||||
AND item_active = 1
|
||||
AND item_views != item_view_limit
|
||||
AND item_expire_at > NOW()
|
||||
ORDER BY item_created_at ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -52,9 +62,10 @@ $sql_stale_tickets = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM tickets
|
||||
WHERE ticket_client_id = $client_id
|
||||
AND ticket_updated_at < CURRENT_DATE - INTERVAL 3 DAY
|
||||
AND ticket_closed_at IS NULL
|
||||
ORDER BY ticket_updated_at DESC LIMIT 5"
|
||||
AND ticket_updated_at < CURRENT_DATE - INTERVAL 3 DAY
|
||||
AND ticket_closed_at IS NULL
|
||||
ORDER BY ticket_updated_at ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Domains Expiring
|
||||
@@ -62,10 +73,25 @@ $sql_domains_expiring = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM domains
|
||||
WHERE domain_client_id = $client_id
|
||||
AND domain_expire IS NOT NULL
|
||||
AND domain_archived_at IS NULL
|
||||
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
ORDER BY domain_expire DESC LIMIT 5"
|
||||
AND domain_expire IS NOT NULL
|
||||
AND domain_archived_at IS NULL
|
||||
AND domain_expire > CURRENT_DATE
|
||||
AND domain_expire < CURRENT_DATE + INTERVAL $expiration_days DAY
|
||||
ORDER BY domain_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Certificates Expiring
|
||||
$sql_certificates_expiring = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM certificates
|
||||
WHERE certificate_client_id = $client_id
|
||||
AND certificate_expire IS NOT NULL
|
||||
AND certificate_archived_at IS NULL
|
||||
AND certificate_expire > CURRENT_DATE
|
||||
AND certificate_expire < CURRENT_DATE + INTERVAL $expiration_days DAY
|
||||
ORDER BY certificate_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Licenses Expiring
|
||||
@@ -73,10 +99,12 @@ $sql_licenses_expiring = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM software
|
||||
WHERE software_client_id = $client_id
|
||||
AND software_expire IS NOT NULL
|
||||
AND software_archived_at IS NULL
|
||||
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
ORDER BY software_expire DESC LIMIT 5"
|
||||
AND software_expire IS NOT NULL
|
||||
AND software_archived_at IS NULL
|
||||
AND software_expire > CURRENT_DATE
|
||||
AND software_expire < CURRENT_DATE + INTERVAL $expiration_days DAY
|
||||
ORDER BY software_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Asset Warranties Expiring
|
||||
@@ -84,23 +112,92 @@ $sql_asset_warranties_expiring = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM assets
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_warranty_expire IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_warranty_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
ORDER BY asset_warranty_expire DESC LIMIT 5"
|
||||
AND asset_warranty_expire IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_warranty_expire > CURRENT_DATE
|
||||
AND asset_warranty_expire < CURRENT_DATE + INTERVAL $expiration_days DAY
|
||||
ORDER BY asset_warranty_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Assets Retiring
|
||||
// Get Assets Retiring 7 Year
|
||||
$sql_asset_retire = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM assets
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_install_date IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE + INTERVAL 90 DAY
|
||||
ORDER BY asset_install_date DESC LIMIT 5"
|
||||
AND asset_install_date IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_install_date + INTERVAL 7 YEAR > CURRENT_DATE -- Not yet expired
|
||||
AND asset_install_date + INTERVAL 7 YEAR <= CURRENT_DATE + INTERVAL $expiration_days DAY
|
||||
ORDER BY asset_install_date ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
/*
|
||||
* EXPIRED ITEMS
|
||||
*/
|
||||
|
||||
// Get Domains Expired
|
||||
$sql_domains_expired = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM domains
|
||||
WHERE domain_client_id = $client_id
|
||||
AND domain_expire IS NOT NULL
|
||||
AND domain_archived_at IS NULL
|
||||
AND domain_expire < CURRENT_DATE
|
||||
ORDER BY domain_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Certificates Expired
|
||||
$sql_certificates_expired = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM certificates
|
||||
WHERE certificate_client_id = $client_id
|
||||
AND certificate_expire IS NOT NULL
|
||||
AND certificate_archived_at IS NULL
|
||||
AND certificate_expire < CURRENT_DATE
|
||||
ORDER BY certificate_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Licenses Expired
|
||||
$sql_licenses_expired = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM software
|
||||
WHERE software_client_id = $client_id
|
||||
AND software_expire IS NOT NULL
|
||||
AND software_archived_at IS NULL
|
||||
AND software_expire < CURRENT_DATE
|
||||
ORDER BY software_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Asset Warranties Expired
|
||||
$sql_asset_warranties_expired = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM assets
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_warranty_expire IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_warranty_expire < CURRENT_DATE
|
||||
ORDER BY asset_warranty_expire ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
// Get Retired Assets
|
||||
$sql_asset_retired = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM assets
|
||||
WHERE asset_client_id = $client_id
|
||||
AND asset_install_date IS NOT NULL
|
||||
AND asset_archived_at IS NULL
|
||||
AND asset_install_date + INTERVAL 7 YEAR < CURRENT_DATE -- Assets retired (installed more than 7 years ago)
|
||||
ORDER BY asset_install_date ASC
|
||||
LIMIT 5"
|
||||
);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
@@ -117,57 +214,55 @@ $sql_asset_retire = mysqli_query(
|
||||
<textarea class="form-control" rows=8 id="clientNotes" placeholder="Enter quick notes here" onblur="updateClientNotes(<?php echo $client_id ?>)"><?php echo $client_notes ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if (mysqli_num_rows($sql_important_contacts) > 0) { ?>
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="col-md-4">
|
||||
<?php if (mysqli_num_rows($sql_important_contacts) > 0) { ?>
|
||||
<div class="card card-dark mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-users mr-2"></i>Important Contacts</h5>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
<table class="table table-borderless table-sm">
|
||||
<?php
|
||||
|
||||
<div class="card card-dark mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-users mr-2"></i>Important Contacts</h5>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
<table class="table table-borderless table-sm">
|
||||
<?php
|
||||
while ($row = mysqli_fetch_array($sql_important_contacts)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_important_contacts)) {
|
||||
$contact_id = intval($row['contact_id']);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||
$contact_phone = formatPhoneNumber($row['contact_phone']);
|
||||
$contact_extension = nullable_htmlentities($row['contact_extension']);
|
||||
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>" class="text-bold"><?php echo $contact_name; ?></a>
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $contact_title; ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!empty($contact_phone)) { ?>
|
||||
<?php echo "<i class='fa fa-fw fa-phone text-secondary'></i> $contact_phone $contact_extension"; ?>
|
||||
<?php } ?>
|
||||
<?php if (!empty($contact_mobile)) { ?>
|
||||
<br>
|
||||
<div class="text-secondary"><i class='fa fa-fw fa-mobile-alt text-secondary'></i> <?php echo "$contact_mobile"; ?></div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>" class="text-bold"><?php echo $contact_name; ?></a>
|
||||
<br>
|
||||
<small class="text-secondary"><?php echo $contact_title; ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!empty($contact_phone)) { ?>
|
||||
<?php echo "<i class='fa fa-fw fa-phone text-secondary'></i> $contact_phone $contact_extension"; ?>
|
||||
<?php } ?>
|
||||
<?php if (!empty($contact_mobile)) { ?>
|
||||
<br>
|
||||
<div class="text-secondary"><i class='fa fa-fw fa-mobile-alt text-secondary'></i> <?php echo "$contact_mobile"; ?></div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if (mysqli_num_rows($sql_shared_items) > 0) { ?>
|
||||
|
||||
@@ -236,6 +331,7 @@ $sql_asset_retire = mysqli_query(
|
||||
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_domains_expiring) > 0
|
||||
|| mysqli_num_rows($sql_certificates_expiring) > 0
|
||||
|| mysqli_num_rows($sql_asset_warranties_expiring) > 0
|
||||
|| mysqli_num_rows($sql_asset_retire) > 0
|
||||
|| mysqli_num_rows($sql_licenses_expiring) > 0
|
||||
@@ -245,7 +341,17 @@ $sql_asset_retire = mysqli_query(
|
||||
|
||||
<div class="card card-dark mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-exclamation-triangle text-warning mr-2"></i>Upcoming Expirations <small>(Within 90 Days)</small></h5></h5>
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-exclamation-triangle text-warning mr-2"></i>Upcoming Expirations</h5>
|
||||
<div class="card-tools">
|
||||
<form class="form-inline">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<select onchange="this.form.submit()" class="form-control form-control-sm" name="expiration_days">
|
||||
<option value="7" <?php if ($expiration_days == 7) { echo "selected"; } ?>>Within 7 Days</option>
|
||||
<option value="30" <?php if ($expiration_days == 30) { echo "selected"; } ?>>Within 30 Days</option>
|
||||
<option value="90" <?php if ($expiration_days == 90) { echo "selected"; } ?>>Within 90 Days</option>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
|
||||
@@ -269,6 +375,24 @@ $sql_asset_retire = mysqli_query(
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_certificates_expiring)) {
|
||||
$certificate_id = intval($row['certificate_id']);
|
||||
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||
$certificate_expire_human = timeAgo($row['certificate_expire']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-lock text-secondary mr-1"></i>
|
||||
<a href="client_certificates.php?client_id=<?php echo $client_id; ?>&q=<?php echo $certificate_name; ?>"><?php echo $certificate_name; ?></a>
|
||||
<span>-- <?php echo $certificate_expire_human; ?> <small class="text-muted"><?php echo $certificate_expire; ?></small></span>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_asset_warranties_expiring)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
@@ -278,7 +402,7 @@ $sql_asset_retire = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="client_assets.php?client_id=<?php echo $client_id; ?>&q=<?php echo $asset_name; ?>"><?php echo $asset_name; ?></a>
|
||||
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_warranty_expire_human; ?> <small class="text-muted"><?php echo $asset_warranty_expire; ?></small></span>
|
||||
</p>
|
||||
|
||||
@@ -298,7 +422,7 @@ $sql_asset_retire = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="client_assets.php?client_id=<?php echo $client_id; ?>&q=<?php echo $asset_name; ?>"><?php echo $asset_name; ?></a>
|
||||
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_install_date_human; ?> <small class="text-muted"><?php echo $asset_install_date; ?></small></span>
|
||||
</p>
|
||||
|
||||
@@ -331,6 +455,124 @@ $sql_asset_retire = mysqli_query(
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?php
|
||||
if (mysqli_num_rows($sql_domains_expired) > 0
|
||||
|| mysqli_num_rows($sql_certificates_expired) > 0
|
||||
|| mysqli_num_rows($sql_asset_warranties_expired) > 0
|
||||
|| mysqli_num_rows($sql_asset_retired) > 0
|
||||
|| mysqli_num_rows($sql_licenses_expired) > 0
|
||||
)
|
||||
{ ?>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="card card-dark mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-exclamation-triangle text-danger mr-2"></i>Expired</h5></h5>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_domains_expired)) {
|
||||
$domain_id = intval($row['domain_id']);
|
||||
$domain_name = nullable_htmlentities($row['domain_name']);
|
||||
$domain_expire = nullable_htmlentities($row['domain_expire']);
|
||||
$domain_expire_human = timeAgo($row['domain_expire']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-globe text-secondary mr-1"></i>
|
||||
<a href="client_domains.php?client_id=<?php echo $client_id; ?>&q=<?php echo $domain_name; ?>"><?php echo $domain_name; ?></a>
|
||||
<span>-- <?php echo $domain_expire_human; ?> <small class="text-muted"><?php echo $domain_expire; ?></small></span>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_certificates_expired)) {
|
||||
$certificate_id = intval($row['certificate_id']);
|
||||
$certificate_name = nullable_htmlentities($row['certificate_name']);
|
||||
$certificate_expire = nullable_htmlentities($row['certificate_expire']);
|
||||
$certificate_expire_human = timeAgo($row['certificate_expire']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-lock text-secondary mr-1"></i>
|
||||
<a href="client_certificates.php?client_id=<?php echo $client_id; ?>&q=<?php echo $certificate_name; ?>"><?php echo $certificate_name; ?></a>
|
||||
<span>-- <?php echo $certificate_expire_human; ?> <small class="text-muted"><?php echo $certificate_expire; ?></small></span>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_asset_warranties_expired)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
$asset_warranty_expire = nullable_htmlentities($row['asset_warranty_expire']);
|
||||
$asset_warranty_expire_human = timeAgo($row['asset_warranty_expire']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_warranty_expire_human; ?> <small class="text-muted"><?php echo $asset_warranty_expire; ?></small></span>
|
||||
</p>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_asset_retired)) {
|
||||
$asset_id = intval($row['asset_id']);
|
||||
$asset_name = nullable_htmlentities($row['asset_name']);
|
||||
$asset_install_date = nullable_htmlentities($row['asset_install_date']);
|
||||
$asset_install_date_human = timeAgo($row['asset_install_date']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_install_date_human; ?> <small class="text-muted"><?php echo $asset_install_date; ?></small></span>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_licenses_expired)) {
|
||||
$software_id = intval($row['software_id']);
|
||||
$software_name = nullable_htmlentities($row['software_name']);
|
||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||
$software_expire_human = timeAgo($row['software_expire']);
|
||||
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-cube text-secondary mr-1"></i>
|
||||
<a href="client_software.php?client_id=<?php echo $client_id; ?>&q=<?php echo $software_name; ?>"><?php echo $software_name; ?></a>
|
||||
<span>-- <?php echo $software_expire_human; ?> <small class="text-muted"><?php echo $software_expire; ?></small></span>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if (mysqli_num_rows($sql_stale_tickets) > 0) { ?>
|
||||
|
||||
<!-- Stale Tickets -->
|
||||
@@ -419,6 +661,8 @@ $sql_asset_retire = mysqli_query(
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function updateClientNotes(client_id) {
|
||||
var notes = document.getElementById("clientNotes").value;
|
||||
|
||||
@@ -27,9 +27,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-credit-card mr-2"></i>Payments</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#exportPaymentModal"><i class="fa fa-fw fa-download mr-2"></i>Export</button>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#exportPaymentModal"><i class="fa fa-fw fa-download mr-2"></i>Export</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
|
||||
@@ -29,13 +29,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addQuoteModal"><i class="fas fa-plus mr-2"></i>New Quote</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportQuoteModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportQuoteModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@@ -22,21 +22,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-redo-alt mr-2"></i>Recurring Invoices</h3>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addRecurringModal"><i class="fas fa-plus mr-2"></i>New Recurring</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportRecurringModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-redo-alt mr-2"></i>Recurring Invoices</h3>
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addRecurringModal"><i class="fas fa-plus mr-2"></i>New Recurring</button>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportRecurringModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
|
||||
@@ -84,10 +84,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
|
||||
</div>
|
||||
</td>
|
||||
<th><a class="text-dark">Subject</a></th>
|
||||
<th><a class="text-dark">Priority</a></th>
|
||||
<th><a class="text-dark">Frequency</a></th>
|
||||
<th><a class="text-dark">Next Run Date</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=scheduled_ticket_subject&order=<?php echo $disp; ?>">Subject</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=scheduled_ticket_priority&order=<?php echo $disp; ?>">Priority</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=scheduled_ticket_frequency&order=<?php echo $disp; ?>">Frequency</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=scheduled_ticket_next_run&order=<?php echo $disp; ?>">Next Run Date</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
Licenses
|
||||
<?php
|
||||
if ($num_software > 0) { ?>
|
||||
<span class="right badge text-light"><?php echo $num_software; ?></span>
|
||||
<span class="right badge <?php if ($num_software_expiring > 0) { ?> badge-warning text-dark <?php } ?> <?php if ($num_software_expired > 0) { ?> badge-danger <?php } ?> text-white"><?php echo $num_software; ?></span>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</a>
|
||||
@@ -189,7 +189,7 @@
|
||||
|
||||
<?php
|
||||
if ($num_certificates > 0) { ?>
|
||||
<span class="right badge <?php if ($num_certs_expiring > 0) { ?> badge-warning text-dark <?php } ?> text-light"><?php echo $num_certificates; ?></span>
|
||||
<span class="right badge <?php if ($num_certificates_expiring > 0) { ?> badge-warning text-dark <?php } ?> <?php if ($num_certificates_expired > 0) { ?> badge-danger <?php } ?> text-white"><?php echo $num_certificates; ?></span>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</a>
|
||||
|
||||
@@ -36,10 +36,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addSoftwareFromTemplateModal">
|
||||
<i class="fas fa-fw fa-puzzle-piece mr-2"></i>Create from Template
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportSoftwareModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportSoftwareModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,7 +63,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="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -72,13 +74,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<table class="table table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_name&order=<?php echo $disp; ?>">Software</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_type&order=<?php echo $disp; ?>">Type</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_license_type&order=<?php echo $disp; ?>">License Type</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_seats&order=<?php echo $disp; ?>">Seats</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_seats&order=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -96,6 +99,31 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$software_seats = nullable_htmlentities($row['software_seats']);
|
||||
$software_purchase = nullable_htmlentities($row['software_purchase']);
|
||||
$software_expire = nullable_htmlentities($row['software_expire']);
|
||||
if ($software_expire) {
|
||||
$software_expire_ago = timeAgo($software_expire);
|
||||
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
|
||||
|
||||
// Convert the expiry date to a timestamp
|
||||
$software_expire_timestamp = strtotime($row['software_expire']);
|
||||
$current_timestamp = time(); // Get current timestamp
|
||||
|
||||
// Calculate the difference in days
|
||||
$days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
|
||||
|
||||
// Determine the class based on the number of days until expiry
|
||||
if ($days_until_expiry <= 0) {
|
||||
$tr_class = "table-secondary";
|
||||
} elseif ($days_until_expiry <= 14) {
|
||||
$tr_class = "table-danger";
|
||||
} elseif ($days_until_expiry <= 90) {
|
||||
$tr_class = "table-warning";
|
||||
}
|
||||
|
||||
} else {
|
||||
$software_expire_display = "-";
|
||||
$tr_class = '';
|
||||
}
|
||||
|
||||
$software_notes = nullable_htmlentities($row['software_notes']);
|
||||
$software_created_at = nullable_htmlentities($row['software_created_at']);
|
||||
|
||||
@@ -122,7 +150,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<tr class="<?php echo $tr_class; ?>">
|
||||
<td>
|
||||
<a class="text-dark" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>">
|
||||
<div class="media">
|
||||
@@ -137,6 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<td><?php echo $software_type; ?></td>
|
||||
<td><?php echo $software_license_type; ?></td>
|
||||
<td><?php echo "$seat_count / $software_seats"; ?></td>
|
||||
<td><?php echo $software_expire_display; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-toggle="dropdown">
|
||||
|
||||
@@ -78,10 +78,12 @@ $total_tickets_closed = intval($row['total_tickets_closed']);
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addTicketFromTemplateModal">
|
||||
<i class="fa fa-fw fa-plus mr-2"></i>From Template
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportTicketModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportTicketModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,12 +29,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="card-tools">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTripModal"><i class="fas fa-plus mr-2"></i>New Trip</button>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportTripModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportTripModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -37,10 +37,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#addVendorFromTemplateModal">
|
||||
<i class="fa fa-fw fa-puzzle-piece mr-2"></i>Create from Template
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportVendorModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php if ($num_rows[0] > 0) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#exportVendorModal">
|
||||
<i class="fa fa-fw fa-download mr-2"></i>Export
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -62,7 +64,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<div class="col-md-8">
|
||||
<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="?client_id=<?php echo $client_id; ?>&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>
|
||||
@@ -97,6 +99,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
@@ -137,13 +140,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$vendor_created_at = nullable_htmlentities($row['vendor_created_at']);
|
||||
$vendor_archived_at = nullable_htmlentities($row['vendor_archived_at']);
|
||||
$vendor_template_id = intval($row['vendor_template_id']);
|
||||
|
||||
|
||||
if (empty($vendor_website)) {
|
||||
$vendor_website_display = "-";
|
||||
} else {
|
||||
$vendor_website_display = "<button class='btn btn-sm clipboardjs' data-clipboard-text='$vendor_website'><i class='far fa-copy text-secondary'></i></button><a href='https://$vendor_website' target='_blank'><i class='fa fa-external-link-alt text-secondary'></i></a>";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="pr-0">
|
||||
@@ -161,7 +164,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
@@ -231,7 +234,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="js/bulk_actions.js"></script>
|
||||
<script src="js/bulk_actions.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "vendor_add_modal.php";
|
||||
|
||||
19
cron.php
19
cron.php
@@ -75,6 +75,10 @@ $config_log_retention = intval($row['config_log_retention']);
|
||||
// Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
// White label
|
||||
$config_whitelabel_enabled = intval($row['config_whitelabel_enabled']);
|
||||
$config_whitelabel_key = $row['config_whitelabel_key'];
|
||||
|
||||
$argv = $_SERVER['argv'];
|
||||
|
||||
// Check cron is enabled
|
||||
@@ -137,13 +141,20 @@ mysqli_query($mysqli, "DELETE FROM logs WHERE log_created_at < CURDATE() - INTER
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
|
||||
// Whitelabel - Disable if expired/invalid
|
||||
if ($config_whitelabel_enabled && !validateWhitelabelKey($config_whitelabel_key)) {
|
||||
mysqli_query($mysqli, "UPDATE settings SET config_whitelabel_enabled = 0, config_whitelabel_key = '' WHERE company_id = 1");
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Settings', notification = 'White-labelling was disabled due to expired/invalid key', notification_action = 'settings_modules.php'");
|
||||
}
|
||||
|
||||
|
||||
// GET NOTIFICATIONS
|
||||
|
||||
// DOMAINS EXPIRING
|
||||
|
||||
if($config_enable_alert_domain_expire == 1){
|
||||
|
||||
$domainAlertArray = [1,7,14,30,90,120];
|
||||
$domainAlertArray = [1,7,14,30,90];
|
||||
|
||||
foreach ($domainAlertArray as $day) {
|
||||
|
||||
@@ -173,7 +184,7 @@ if($config_enable_alert_domain_expire == 1){
|
||||
|
||||
// CERTIFICATES EXPIRING
|
||||
|
||||
$certificateAlertArray = [1,7,14,30,90,120];
|
||||
$certificateAlertArray = [1,7,14,30,90];
|
||||
|
||||
foreach ($certificateAlertArray as $day) {
|
||||
|
||||
@@ -203,7 +214,7 @@ foreach ($certificateAlertArray as $day) {
|
||||
|
||||
// Asset Warranties Expiring
|
||||
|
||||
$warranty_alert_array = [1,7,14,30,90,120];
|
||||
$warranty_alert_array = [1,7,14,30,90];
|
||||
|
||||
foreach ($warranty_alert_array as $day) {
|
||||
|
||||
@@ -685,7 +696,7 @@ while ($row = mysqli_fetch_array($sql_recurring_expenses)) {
|
||||
|
||||
// TELEMETRY
|
||||
|
||||
if ($config_telemetry > 0 OR $config_telemetry == 2) {
|
||||
if ($config_telemetry > 0 || $config_telemetry == 2) {
|
||||
|
||||
$current_version = exec("git rev-parse HEAD");
|
||||
|
||||
|
||||
@@ -59,4 +59,4 @@ while ($row = mysqli_fetch_array($sql_certificates)) {
|
||||
|
||||
mysqli_query($mysqli,"UPDATE certificates SET certificate_issued_by = '$issued_by', certificate_expire = $expire, certificate_public_key = '$public_key' WHERE certificate_id = $certificate_id");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,13 @@ $argv = $_SERVER['argv'];
|
||||
|
||||
// Check cron is enabled
|
||||
if ($config_enable_cron == 0) {
|
||||
error_log("Mail queue error - Cron is not enabled");
|
||||
exit("Cron: is not enabled -- Quitting..");
|
||||
}
|
||||
|
||||
// Check Cron Key
|
||||
if ($argv[1] !== $config_cron_key && $_GET['key'] !== $config_cron_key) {
|
||||
error_log("Mail queue error - Invalid cron key supplied");
|
||||
exit("Cron Key invalid -- Quitting..");
|
||||
}
|
||||
|
||||
@@ -63,8 +65,12 @@ file_put_contents($lock_file_path, "Locked");
|
||||
// 2 Failed
|
||||
// 3 Sent
|
||||
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* Initial email send
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
// Get Mail Queue that has status of Queued and send it to the function sendSingleEmail() located in functions.php
|
||||
|
||||
$sql_queue = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_status = 0 AND email_queued_at <= NOW()");
|
||||
|
||||
if (mysqli_num_rows($sql_queue) > 0) {
|
||||
@@ -80,47 +86,68 @@ if (mysqli_num_rows($sql_queue) > 0) {
|
||||
$email_sent_at = $row['email_sent_at'];
|
||||
$email_ics_str = $row['email_cal_str'];
|
||||
|
||||
// Sanitized Input
|
||||
$email_recipient_logging = sanitizeInput($row['email_recipient']);
|
||||
$email_subject_logging = sanitizeInput($row['email_subject']);
|
||||
// First, validate the sender email address
|
||||
if (filter_var($email_from, FILTER_VALIDATE_EMAIL)) {
|
||||
|
||||
// Update the status to sending
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 1 WHERE email_id = $email_id");
|
||||
// Sanitized Input
|
||||
$email_recipient_logging = sanitizeInput($row['email_recipient']);
|
||||
$email_subject_logging = sanitizeInput($row['email_subject']);
|
||||
|
||||
// Verify contact email is valid
|
||||
if (filter_var($email_recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
// Update the status to sending
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 1 WHERE email_id = $email_id");
|
||||
|
||||
$mail = sendSingleEmail(
|
||||
$config_smtp_host,
|
||||
$config_smtp_username,
|
||||
$config_smtp_password,
|
||||
$config_smtp_encryption,
|
||||
$config_smtp_port,
|
||||
$email_from,
|
||||
$email_from_name,
|
||||
$email_recipient,
|
||||
$email_recipient_name,
|
||||
$email_subject,
|
||||
$email_content,
|
||||
$email_ics_str
|
||||
);
|
||||
// Next, verify recipient email is valid
|
||||
if (filter_var($email_recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
|
||||
if ($mail !== true) {
|
||||
// Update Message - Failure
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_failed_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
|
||||
$mail = sendSingleEmail(
|
||||
$config_smtp_host,
|
||||
$config_smtp_username,
|
||||
$config_smtp_password,
|
||||
$config_smtp_encryption,
|
||||
$config_smtp_port,
|
||||
$email_from,
|
||||
$email_from_name,
|
||||
$email_recipient,
|
||||
$email_recipient_name,
|
||||
$email_subject,
|
||||
$email_content,
|
||||
$email_ics_str
|
||||
);
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $email_recipient_logging'");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $email_recipient_logging regarding $email_subject_logging. $mail'");
|
||||
if ($mail !== true) {
|
||||
// Update Message - Failure
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_failed_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Cron-Mail-Queue', notification = 'Failed to send email #$email_id to $email_recipient_logging'");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron-Mail-Queue', log_action = 'Error', log_description = 'Failed to send email #$email_id to $email_recipient_logging regarding $email_subject_logging. $mail'");
|
||||
} else {
|
||||
// Update Message - Success
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
|
||||
}
|
||||
} else {
|
||||
// Update Message - Success
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = 1 WHERE email_id = $email_id");
|
||||
// Recipient email isn't valid, mark as failed and log the error
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 99 WHERE email_id = $email_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron-Mail-Queue', log_action = 'Error', log_description = 'Failed to send email #$email_id due to invalid recipient address. Email subject was: $email_subject_logging.'");
|
||||
}
|
||||
|
||||
} else {
|
||||
error_log("Failed to send email due to invalid sender address (' $email_from ') - check configuration in settings.");
|
||||
|
||||
$email_from_logging = sanitizeInput($row['email_from']);
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_attempts = 99 WHERE email_id = $email_id");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron-Mail-Queue', log_action = 'Error', log_description = 'Failed to send email #$email_id due to invalid sender address: $email_from_logging - check configuration in settings.'");
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email #$email_id due to invalid sender address'");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
/*
|
||||
* ###############################################################################################################
|
||||
* Retries
|
||||
* ###############################################################################################################
|
||||
*/
|
||||
// Get Mail that failed to send and attempt to send Failed Mail up to 4 times every 30 mins
|
||||
$sql_failed_queue = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_status = 2 AND email_attempts < 4 AND email_failed_at < NOW() + INTERVAL 30 MINUTE");
|
||||
|
||||
@@ -146,7 +173,7 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
|
||||
// Update the status to sending before actually sending
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 1 WHERE email_id = $email_id");
|
||||
|
||||
// Verify contact email is valid
|
||||
// Verify recipient email is valid
|
||||
if (filter_var($email_recipient, FILTER_VALIDATE_EMAIL)) {
|
||||
|
||||
$mail = sendSingleEmail(
|
||||
@@ -167,9 +194,7 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
|
||||
if ($mail !== true) {
|
||||
// Update Message
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 2, email_failed_at = NOW(), email_attempts = $email_attempts WHERE email_id = $email_id");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $email_recipient_logging'");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $email_recipient_logging regarding $email_subject_logging. $mail'");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Cron-Mail-Queue', log_action = 'Error', log_description = 'Failed to re-send email #$email_id to $email_recipient_logging regarding $email_subject_logging. $mail'");
|
||||
} else {
|
||||
// Update Message
|
||||
mysqli_query($mysqli, "UPDATE email_queue SET email_status = 3, email_sent_at = NOW(), email_attempts = $email_attempts WHERE email_id = $email_id");
|
||||
@@ -178,5 +203,5 @@ if (mysqli_num_rows($sql_failed_queue) > 0) {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the lock file once mail has finished processing so it doesnt get overun causing possible duplicates
|
||||
// Remove the lock file once mail has finished processing
|
||||
unlink($lock_file_path);
|
||||
|
||||
@@ -345,7 +345,7 @@ function createMailboxFolder($client, $folderName) {
|
||||
}
|
||||
|
||||
// Function to subscribe to a folder in the mailbox
|
||||
function subscribeMailboxFolder($client, $folder) {
|
||||
function subscribeMailboxFolder($folder) {
|
||||
if ($folder) {
|
||||
try {
|
||||
// Subscribe to the folder
|
||||
@@ -378,7 +378,7 @@ $client->connect();
|
||||
$folder = createMailboxFolder($client, 'ITFlow');
|
||||
|
||||
// Subscribe to the "ITFlow" mailbox folder
|
||||
subscribeMailboxFolder($client, $folder);
|
||||
subscribeMailboxFolder($folder);
|
||||
|
||||
// Possible names for the inbox folder
|
||||
$inboxNames = ['Inbox', 'INBOX', 'inbox'];
|
||||
|
||||
@@ -597,7 +597,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-info" href="/report_all_assets_by_client.php">
|
||||
<a class="small-box bg-info" href="report_assets.php">
|
||||
<div class="inner">
|
||||
<h3><?php echo $assets_added; ?></h3>
|
||||
<p>New Assets</p>
|
||||
@@ -623,7 +623,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
||||
<!-- ./col -->
|
||||
|
||||
<div class="col-lg-4 col-6">
|
||||
<a class="small-box bg-warning">
|
||||
<a class="small-box bg-warning" href="domains.php">
|
||||
<div class="inner">
|
||||
<h3><?php echo $expiring_domains; ?></h3>
|
||||
<p>Expiring Domains</p>
|
||||
|
||||
@@ -2131,10 +2131,88 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.5'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.4.5') {
|
||||
// // Insert queries here required to update to DB version 1.4.6
|
||||
if (CURRENT_DATABASE_VERSION == '1.4.5') {
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_whitelabel_enabled` INT(11) NOT NULL DEFAULT '0' AFTER `config_phone_mask`");
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_whitelabel_key` TEXT NULL DEFAULT NULL AFTER `config_whitelabel_enabled`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.6'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.4.6') {
|
||||
mysqli_query($mysqli, "CREATE TABLE `custom_links` (
|
||||
`custom_link_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`custom_link_name` VARCHAR(200) NOT NULL,
|
||||
`custom_link_description` TEXT DEFAULT NULL,
|
||||
`custom_link_uri` VARCHAR(500) NOT NULL,
|
||||
`custom_link_icon` VARCHAR(200) DEFAULT NULL,
|
||||
`custom_link_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`custom_link_updated_at` DATETIME ON UPDATE CURRENT_TIMESTAMP NULL,
|
||||
`custom_link_archived_at` DATETIME NULL,
|
||||
PRIMARY KEY (`custom_link_id`)
|
||||
)");
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.7'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.4.7') {
|
||||
mysqli_query($mysqli, "ALTER TABLE `documents` ADD `document_client_visible` INT(11) NOT NULL DEFAULT '1' AFTER `document_parent`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.8'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.4.8') {
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` DROP `config_stripe_client_pays_fees`");
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.9'");
|
||||
}
|
||||
|
||||
if (CURRENT_DATABASE_VERSION == '1.4.9') {
|
||||
|
||||
// Add new "is admin" identifier on user roles
|
||||
mysqli_query($mysqli, "ALTER TABLE `user_roles` ADD `user_role_is_admin` INT(11) NOT NULL DEFAULT '0' AFTER `user_role_description`");
|
||||
mysqli_query($mysqli, "UPDATE `user_roles` SET `user_role_is_admin` = '1' WHERE `user_role_id` = 3");
|
||||
|
||||
// Add modules
|
||||
mysqli_query($mysqli, "CREATE TABLE `modules` (
|
||||
`module_id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`module_name` VARCHAR(200) NOT NULL,
|
||||
`module_description` VARCHAR(200) NULL,
|
||||
PRIMARY KEY (`module_id`)
|
||||
)");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_client', module_description = 'General client & contact management'");
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_support', module_description = 'Access to ticketing, assets and documentation'");
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_credential', module_description = 'Access to client credentials - usernames, passwords and 2FA codes'");
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_sales', module_description = 'Access to quotes, invoices and products'");
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_financial', module_description = 'Access to payments, accounts, expenses and budgets'");
|
||||
mysqli_query($mysqli, "INSERT INTO modules SET module_name = 'module_reporting', module_description = 'Access to all reports'");
|
||||
|
||||
// Add table for storing role<->module permissions
|
||||
mysqli_query($mysqli, "CREATE TABLE `user_role_permissions` (
|
||||
`user_role_id` INT(11) NOT NULL,
|
||||
`module_id` INT(11) NOT NULL,
|
||||
`user_role_permission_level` INT(11) NOT NULL
|
||||
)");
|
||||
|
||||
// Add default permissions for accountant role
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 1, module_id = 1, user_role_permission_level = 1"); // Read clients
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 1, module_id = 2, user_role_permission_level = 1"); // Read support
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 1, module_id = 4, user_role_permission_level = 1"); // Read sales
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 1, module_id = 5, user_role_permission_level = 2"); // Modify financial
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 1, module_id = 6, user_role_permission_level = 1"); // Read reports
|
||||
|
||||
// Add default permissions for tech role
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 2, module_id = 1, user_role_permission_level = 2"); // Modify clients
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 2, module_id = 2, user_role_permission_level = 2"); // Modify support
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 2, module_id = 3, user_role_permission_level = 2"); // Modify credentials
|
||||
mysqli_query($mysqli, "INSERT INTO user_role_permissions SET user_role_id = 2, module_id = 4, user_role_permission_level = 2"); // Modify sales
|
||||
|
||||
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.5.0'");
|
||||
}
|
||||
|
||||
// if (CURRENT_DATABASE_VERSION == '1.5.0') {
|
||||
// // Insert queries here required to update to DB version 1.5.1
|
||||
// // Then, update the database to the next sequential version
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.4.6'");
|
||||
// mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.5.1'");
|
||||
// }
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
* It is used in conjunction with database_updates.php
|
||||
*/
|
||||
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.4.5");
|
||||
DEFINE("LATEST_DATABASE_VERSION", "1.5.0");
|
||||
|
||||
54
db.sql
54
db.sql
@@ -66,7 +66,7 @@ CREATE TABLE `api_keys` (
|
||||
`api_key_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`api_key_name` varchar(255) NOT NULL,
|
||||
`api_key_secret` varchar(255) NOT NULL,
|
||||
`api_key_decrypt_hash` varchar(255) NULL,
|
||||
`api_key_decrypt_hash` varchar(200) NOT NULL,
|
||||
`api_key_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`api_key_expire` date NOT NULL,
|
||||
`api_key_client_id` int(11) NOT NULL DEFAULT 0,
|
||||
@@ -462,6 +462,26 @@ CREATE TABLE `custom_fields` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `custom_links`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `custom_links`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `custom_links` (
|
||||
`custom_link_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`custom_link_name` varchar(200) NOT NULL,
|
||||
`custom_link_description` text DEFAULT NULL,
|
||||
`custom_link_uri` varchar(500) NOT NULL,
|
||||
`custom_link_icon` varchar(200) DEFAULT NULL,
|
||||
`custom_link_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`custom_link_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`custom_link_archived_at` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`custom_link_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `custom_values`
|
||||
--
|
||||
@@ -506,6 +526,7 @@ CREATE TABLE `documents` (
|
||||
`document_content_raw` longtext NOT NULL,
|
||||
`document_important` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`document_parent` int(11) NOT NULL DEFAULT 0,
|
||||
`document_client_visible` int(11) NOT NULL DEFAULT 1,
|
||||
`document_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`document_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`document_archived_at` datetime DEFAULT NULL,
|
||||
@@ -868,6 +889,18 @@ CREATE TABLE `logs` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `modules`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `modules`;
|
||||
CREATE TABLE IF NOT EXISTS `modules` (
|
||||
`module_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`module_name` varchar(200) NOT NULL,
|
||||
`module_description` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`module_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `networks`
|
||||
--
|
||||
@@ -1468,7 +1501,7 @@ CREATE TABLE `settings` (
|
||||
`config_ticket_from_name` varchar(200) DEFAULT NULL,
|
||||
`config_ticket_from_email` varchar(200) DEFAULT NULL,
|
||||
`config_ticket_email_parse` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_ticket_email_parse_unknown_senders` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_ticket_email_parse_unknown_senders` int(1) NOT NULL DEFAULT 0,
|
||||
`config_ticket_client_general_notifications` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`config_ticket_autoclose_hours` int(5) NOT NULL DEFAULT 72,
|
||||
`config_ticket_new_ticket_notification_email` varchar(200) DEFAULT NULL,
|
||||
@@ -1492,7 +1525,6 @@ CREATE TABLE `settings` (
|
||||
`config_ai_url` varchar(250) DEFAULT NULL,
|
||||
`config_ai_api_key` varchar(250) DEFAULT NULL,
|
||||
`config_stripe_flat_fee` decimal(15,2) NOT NULL DEFAULT 0.30,
|
||||
`config_stripe_client_pays_fees` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_azure_client_id` varchar(200) DEFAULT NULL,
|
||||
`config_azure_client_secret` varchar(200) DEFAULT NULL,
|
||||
`config_module_enable_itdoc` tinyint(1) NOT NULL DEFAULT 1,
|
||||
@@ -1509,6 +1541,8 @@ CREATE TABLE `settings` (
|
||||
`config_timezone` varchar(200) NOT NULL DEFAULT 'America/New_York',
|
||||
`config_destructive_deletes_enable` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`config_phone_mask` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`config_whitelabel_enabled` int(11) NOT NULL DEFAULT 0,
|
||||
`config_whitelabel_key` text DEFAULT NULL,
|
||||
PRIMARY KEY (`company_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
@@ -1937,6 +1971,7 @@ CREATE TABLE `user_roles` (
|
||||
`user_role_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_role_name` varchar(200) NOT NULL,
|
||||
`user_role_description` varchar(200) DEFAULT NULL,
|
||||
`user_role_is_admin` int(11) NOT NULL DEFAULT 0,
|
||||
`user_role_created_at` datetime NOT NULL DEFAULT current_timestamp(),
|
||||
`user_role_updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`user_role_archived_at` datetime DEFAULT NULL,
|
||||
@@ -1944,6 +1979,17 @@ CREATE TABLE `user_roles` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `user_role_permissions`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `user_role_permissions`;
|
||||
CREATE TABLE IF NOT EXISTS `user_role_permissions` (
|
||||
`user_role_id` int(11) NOT NULL,
|
||||
`module_id` int(11) NOT NULL,
|
||||
`user_role_permission_level` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
||||
|
||||
--
|
||||
-- Table structure for table `user_settings`
|
||||
--
|
||||
@@ -2071,4 +2117,4 @@ CREATE TABLE `vendors` (
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2024-06-13 12:39:55
|
||||
-- Dump completed on 2024-09-05 16:21:24
|
||||
|
||||
42
document_edit_visibility_modal.php
Normal file
42
document_edit_visibility_modal.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<div class="modal" id="editDocumentClientVisibileModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class="fa fa-fw fa-handshake mr-2"></i>
|
||||
Edit Visibility Status for <strong><?php echo "$document_name"; ?></strong>
|
||||
</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body bg-white">
|
||||
<input type="hidden" name="document_id" value="<?php echo $document_id; ?>">
|
||||
<div class="form-group">
|
||||
<label>Visibility</label>
|
||||
<p>Should this document be visible in the portal to client contacts with the 'Technical' role?</p>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-eye"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="document_visible">
|
||||
<option <?php if ($document_client_visible == 1) { echo "selected"; } ?> value="1">Yes</option>
|
||||
<option <?php if ($document_client_visible == 0) { echo "selected"; } ?> value="0">No</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_document_visible" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2,16 +2,86 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-download mr-2"></i>Export Expenses to CSV</h5>
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-download mr-2"></i>Exporting Expenses to CSV</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<?php require_once "inc_export_warning.php";
|
||||
?>
|
||||
<div class="form-group">
|
||||
<label>Account</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-piggy-bank"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="account">
|
||||
<option value="" <?php if ($account == "") { echo "selected"; } ?>>- All Accounts -</option>
|
||||
|
||||
<?php
|
||||
$sql_accounts_filter = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_accounts_filter)) {
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = nullable_htmlentities($row['account_name']);
|
||||
?>
|
||||
<option <?php if ($account == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="vendor">
|
||||
<option value="" <?php if ($vendor == "") { echo "selected"; } ?>>- All Vendors -</option>
|
||||
|
||||
<?php
|
||||
$sql_vendors_filter = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 ORDER BY vendor_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_vendors_filter)) {
|
||||
$vendor_id = intval($row['vendor_id']);
|
||||
$vendor_name = nullable_htmlentities($row['vendor_name']);
|
||||
?>
|
||||
<option <?php if ($vendor == $vendor_id) { echo "selected"; } ?> value="<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-list"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="category">
|
||||
<option value="" <?php if ($category == "") { echo "selected"; } ?>>- All Categories -</option>
|
||||
|
||||
<?php
|
||||
$sql_categories_filter = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Expense' ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_categories_filter)) {
|
||||
$category_id = intval($row['category_id']);
|
||||
$category_name = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($category == $category_id) { echo "selected"; } ?> value="<?php echo $category_id; ?>"><?php echo $category_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date From</label>
|
||||
|
||||
@@ -105,6 +105,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#bulkEditClientModal">
|
||||
<i class="fas fa-fw fa-user mr-2"></i>Set Client
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<button class="dropdown-item text-danger text-bold"
|
||||
type="submit" form="bulkActions" name="bulk_delete_expenses">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -205,6 +212,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</form>
|
||||
<hr>
|
||||
<form id="bulkActions" action="post.php" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
|
||||
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
|
||||
|
||||
158
functions.php
158
functions.php
@@ -109,8 +109,9 @@ function getWebBrowser($user_browser)
|
||||
'/firefox/i' => "<i class='fab fa-fw fa-firefox text-secondary'></i> Firefox",
|
||||
'/safari/i' => "<i class='fab fa-fw fa-safari text-secondary'></i> Safari",
|
||||
'/chrome/i' => "<i class='fab fa-fw fa-chrome text-secondary'></i> Chrome",
|
||||
'/edge/i' => "<i class='fab fa-fw fa-edge text-secondary'></i> Edge",
|
||||
'/opera/i' => "<i class='fab fa-fw fa-opera text-secondary'></i> Opera"
|
||||
'/edg/i' => "<i class='fab fa-fw fa-edge text-secondary'></i> Edge",
|
||||
'/opr/i' => "<i class='fab fa-fw fa-opera text-secondary'></i> Opera",
|
||||
'/ddg/i' => "<i class='fas fa-fw fa-globe text-secondary'></i> DuckDuckGo"
|
||||
);
|
||||
foreach ($browser_array as $regex => $value) {
|
||||
if (preg_match($regex, $user_browser)) {
|
||||
@@ -124,19 +125,12 @@ function getOS($user_os)
|
||||
{
|
||||
$os_platform = "Unknown OS";
|
||||
$os_array = array(
|
||||
'/windows nt 10/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows 10",
|
||||
'/windows nt 6.3/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows 8.1",
|
||||
'/windows nt 6.2/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows 8",
|
||||
'/windows nt 6.1/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows 7",
|
||||
'/windows nt 6.0/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows Vista",
|
||||
'/windows nt 5.2/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows Server 2003/XP x64",
|
||||
'/windows nt 5.1/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows XP",
|
||||
'/windows xp/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows XP",
|
||||
'/windows/i' => "<i class='fab fa-fw fa-windows text-secondary'></i> Windows",
|
||||
'/macintosh|mac os x/i' => "<i class='fab fa-fw fa-apple text-secondary'></i> MacOS",
|
||||
'/linux/i' => "<i class='fab fa-fw fa-linux text-secondary'></i> Linux",
|
||||
'/ubuntu/i' => "<i class='fab fa-fw fa-ubuntu text-secondary'></i> Ubuntu",
|
||||
'/fedora/i' => "<i class='fab fa-fw fa-fedora text-secondary'></i> Fedora",
|
||||
'/iphone/i' => "<i class='fab fa-fw fa-apple text-secondary'></i> iPhone",
|
||||
'/ipod/i' => "<i class='fab fa-fw fa-apple text-secondary'></i> iPod",
|
||||
'/ipad/i' => "<i class='fab fa-fw fa-apple text-secondary'></i> iPad",
|
||||
'/android/i' => "<i class='fab fa-fw fa-android text-secondary'></i> Android"
|
||||
);
|
||||
@@ -480,7 +474,6 @@ function getSSL($full_name)
|
||||
|
||||
function strtoAZaz09($string)
|
||||
{
|
||||
|
||||
// Gets rid of non-alphanumerics
|
||||
return preg_replace('/[^A-Za-z0-9_-]/', '', $string);
|
||||
}
|
||||
@@ -547,7 +540,6 @@ function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_
|
||||
if (empty($config_smtp_username)) {
|
||||
$smtp_auth = false;
|
||||
} else {
|
||||
|
||||
$smtp_auth = true;
|
||||
}
|
||||
|
||||
@@ -635,7 +627,7 @@ function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_
|
||||
} catch (Exception $e) {
|
||||
// If we couldn't send the message return the error, so we can log it in the database (truncated)
|
||||
error_log("ITFlow - Failed to send email: " . $mail->ErrorInfo);
|
||||
return substr("Mailer Error: $mail->ErrorInfo", 0, 150) . "...";
|
||||
return substr("Mailer Error: $mail->ErrorInfo", 0, 100) . "...";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -880,23 +872,6 @@ function roundToNearest15($time)
|
||||
return number_format($decimalHours, 2);
|
||||
}
|
||||
|
||||
// Get the value of a setting from the database
|
||||
function getSettingValue($mysqli, $setting_name)
|
||||
{
|
||||
//if starts with config_ then get from config table
|
||||
if (substr($setting_name, 0, 7) == "config_") {
|
||||
$sql = mysqli_query($mysqli, "SELECT $setting_name FROM settings");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
return $row[$setting_name];
|
||||
} elseif (substr($setting_name, 0, 7) == "company") {
|
||||
$sql = mysqli_query($mysqli, "SELECT $setting_name FROM companies");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
return $row[$setting_name];
|
||||
} else {
|
||||
return "Cannot Find Setting Name";
|
||||
}
|
||||
}
|
||||
|
||||
function getMonthlyTax($tax_name, $month, $year, $mysqli)
|
||||
{
|
||||
// SQL to calculate monthly tax
|
||||
@@ -945,8 +920,7 @@ function getAccountCurrencyCode($mysqli, $account_id)
|
||||
{
|
||||
$sql = mysqli_query($mysqli, "SELECT account_currency_code FROM accounts WHERE account_id = $account_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$account_currency_code = nullable_htmlentities($row['account_currency_code']);
|
||||
return $account_currency_code;
|
||||
return nullable_htmlentities($row['account_currency_code']);
|
||||
}
|
||||
|
||||
function calculateAccountBalance($mysqli, $account_id)
|
||||
@@ -1055,7 +1029,7 @@ function addToMailQueue($mysqli, $data) {
|
||||
|
||||
$cal_str = '';
|
||||
if (isset($email['cal_str'])) {
|
||||
$cal_str = mysqli_escape_string($mysqli,$email['cal_str']);
|
||||
$cal_str = mysqli_escape_string($mysqli, $email['cal_str']);
|
||||
}
|
||||
|
||||
// Check if 'email_queued_at' is set and not empty
|
||||
@@ -1072,32 +1046,6 @@ function addToMailQueue($mysqli, $data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function calculateInvoiceBalance($mysqli, $invoice_id)
|
||||
{
|
||||
$invoice_id_int = intval($invoice_id);
|
||||
$sql_invoice = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id_int");
|
||||
$row = mysqli_fetch_array($sql_invoice);
|
||||
$invoice_amount = floatval($row['invoice_amount']);
|
||||
|
||||
$sql_payments = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SUM(payment_amount) AS total_payments FROM payments
|
||||
WHERE payment_invoice_id = $invoice_id
|
||||
"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql_payments);
|
||||
$total_payments = floatval($row['total_payments']);
|
||||
|
||||
$balance = $invoice_amount - $total_payments;
|
||||
|
||||
if ($balance == '') {
|
||||
$balance = '0.00';
|
||||
}
|
||||
|
||||
return $balance;
|
||||
}
|
||||
|
||||
function createiCalStr($datetime, $title, $description, $location)
|
||||
{
|
||||
require_once "plugins/zapcal/zapcallib.php";
|
||||
@@ -1161,21 +1109,6 @@ function createiCalStrCancel($originaliCalStr) {
|
||||
return $cal_event->export();
|
||||
}
|
||||
|
||||
function getTicketStatusColor($ticket_status) {
|
||||
|
||||
global $mysqli;
|
||||
|
||||
$status_id = intval($ticket_status);
|
||||
$row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_status_color FROM ticket_statuses WHERE ticket_status_id = $status_id LIMIT 1"));
|
||||
|
||||
if ($row) {
|
||||
return nullable_htmlentities($row['ticket_status_color']);
|
||||
}
|
||||
|
||||
// Default return
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
function getTicketStatusName($ticket_status) {
|
||||
|
||||
global $mysqli;
|
||||
@@ -1208,7 +1141,6 @@ function fetchUpdates() {
|
||||
$update_message = "New Updates are Available [$latest_version]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$updates = new stdClass();
|
||||
$updates->output = $output;
|
||||
@@ -1216,8 +1148,7 @@ function fetchUpdates() {
|
||||
$updates->current_version = $current_version;
|
||||
$updates->latest_version = $latest_version;
|
||||
$updates->update_message = $update_message;
|
||||
|
||||
|
||||
|
||||
|
||||
return $updates;
|
||||
|
||||
@@ -1332,3 +1263,74 @@ function getDomainExpirationDate($domain) {
|
||||
|
||||
return null; // Return null if expiration date is not found
|
||||
}
|
||||
|
||||
function validateWhitelabelKey($key)
|
||||
{
|
||||
$public_key = "-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr0k+4ZJudkdGMCFLx5b9
|
||||
H/sOozvWphFJsjVIF0vPVx9J0bTdml65UdS+32JagIHfPtEUTohaMnI3IAxxCDzl
|
||||
655qmtjL7RHHdx9UMIKCmtAZOtd2u6rEyZH7vB7cKA49ysKGIaQSGwTQc8DCgsrK
|
||||
uxRuX04xq9T7T+zuzROw3Y9WjFy9RwrONqLuG8LqO0j7bk5LKYeLAV7u3E/QiqNx
|
||||
lEljN2UVJ3FZ/LkXeg8ORkV+IHs/toRIfPs/4VQnjEwk5BU6DX2STOvbeZnTqwP3
|
||||
zgjRYR/zGN5l+az6RB3+0mJRdZdv/y2aRkBlwTxx2gOrPbQAco4a/IOmkE3EbHe7
|
||||
6wIDAQAP
|
||||
-----END PUBLIC KEY-----";
|
||||
|
||||
if (openssl_public_decrypt(base64_decode($key), $decrypted, $public_key)) {
|
||||
$key_info = json_decode($decrypted, true);
|
||||
if ($key_info['expires'] > date('Y-m-d H:i:s', strtotime('-7 day'))) {
|
||||
return $key_info;
|
||||
}
|
||||
}
|
||||
|
||||
$key_info["description"] = 'Super Legit';
|
||||
$key_info["organisation"] = 'TechBarLabs';
|
||||
$key_info["expires"] = 'lol never';
|
||||
return $key_info;
|
||||
}
|
||||
|
||||
// When provided a module name (e.g. module_support), returns the associated permission level (false=none, 1=read, 2=write, 3=full)
|
||||
function lookupUserPermission($module) {
|
||||
global $mysqli, $session_is_admin, $session_user_role;
|
||||
|
||||
if (isset($session_is_admin) && $session_is_admin === true) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
$module = sanitizeInput($module);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT
|
||||
urp.user_role_permission_level
|
||||
FROM
|
||||
modules AS m
|
||||
JOIN
|
||||
user_role_permissions AS urp
|
||||
ON
|
||||
m.module_id = urp.module_id
|
||||
WHERE
|
||||
m.module_name = '$module' AND urp.user_role_id = $session_user_role"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
|
||||
if (isset($row['user_role_permission_level'])) {
|
||||
return intval($row['user_role_permission_level']);
|
||||
}
|
||||
|
||||
// Default return for no module permission
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ensures a user has access to a module (e.g. module_support) with at least the required permission level provided (defaults to read)
|
||||
function enforceUserPermission($module, $check_access_level = 1) {
|
||||
$permitted_access_level = lookupUserPermission($module);
|
||||
|
||||
if (!$permitted_access_level || $permitted_access_level < $check_access_level) {
|
||||
$_SESSION['alert_type'] = "danger";
|
||||
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
exit(WORDING_ROLECHECK_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,6 @@ $config_stripe_expense_vendor = intval($row['config_stripe_expense_vendor']);
|
||||
$config_stripe_expense_category = intval($row['config_stripe_expense_category']);
|
||||
$config_stripe_percentage_fee = floatval($row['config_stripe_percentage_fee']);
|
||||
$config_stripe_flat_fee = floatval($row['config_stripe_flat_fee']);
|
||||
$config_stripe_client_pays_fees = intval($row['config_stripe_client_pays_fees']);
|
||||
|
||||
// AI Provider Details
|
||||
$config_ai_enable = intval($row['config_ai_enable']);
|
||||
@@ -130,6 +129,10 @@ $config_telemetry = intval($row['config_telemetry']);
|
||||
// Destructive Deletes
|
||||
$config_destructive_deletes_enable = intval($row['config_destructive_deletes_enable']);
|
||||
|
||||
// White label
|
||||
$config_whitelabel_enabled = intval($row['config_whitelabel_enabled']);
|
||||
$config_whitelabel_key = $row['config_whitelabel_key'];
|
||||
|
||||
|
||||
// Select Arrays
|
||||
|
||||
|
||||
@@ -58,7 +58,6 @@ if (isset($_GET['stripe_create_pi'])) {
|
||||
|
||||
$config_sql = mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1");
|
||||
$config_row = mysqli_fetch_array($config_sql);
|
||||
$config_stripe_client_pays_fees = intval($config_row['config_stripe_client_pays_fees']);
|
||||
$config_stripe_percentage_fee = floatval($config_row['config_stripe_percentage_fee']);
|
||||
$config_stripe_flat_fee = floatval($config_row['config_stripe_flat_fee']);
|
||||
|
||||
@@ -68,15 +67,8 @@ if (isset($_GET['stripe_create_pi'])) {
|
||||
$amount_paid = floatval($row['amount_paid']);
|
||||
$balance_to_pay = $invoice_amount - $amount_paid;
|
||||
|
||||
// Check config to see if client pays fees is enabled
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
// Calculate the amount to charge the client
|
||||
$balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
|
||||
}
|
||||
|
||||
$balance_to_pay = round($balance_to_pay, 2);
|
||||
|
||||
|
||||
if (intval($balance_to_pay) == 0) {
|
||||
exit("No balance outstanding");
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
<script src="js/app.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -2,18 +2,11 @@
|
||||
|
||||
require_once 'guest_header.php';
|
||||
|
||||
function log_to_console($message) {
|
||||
$message = date("H:i:s") . " - $message - ".PHP_EOL;
|
||||
print($message);
|
||||
flush();
|
||||
ob_flush();
|
||||
}
|
||||
|
||||
// Define wording
|
||||
DEFINE("WORDING_PAYMENT_FAILED", "<br><h2>There was an error verifying your payment. Please contact us for more information.</h2>");
|
||||
DEFINE("WORDING_PAYMENT_FAILED", "<br><h2>There was an error verifying your payment. Please contact us for more information before attempting payment again.</h2>");
|
||||
|
||||
// Setup Stripe
|
||||
$stripe_vars = mysqli_fetch_array(mysqli_query($mysqli, "SELECT config_stripe_enable, config_stripe_publishable, config_stripe_secret, config_stripe_account, config_stripe_expense_vendor, config_stripe_expense_category, config_stripe_percentage_fee, config_stripe_flat_fee, config_stripe_client_pays_fees FROM settings WHERE company_id = 1"));
|
||||
$stripe_vars = mysqli_fetch_array(mysqli_query($mysqli, "SELECT config_stripe_enable, config_stripe_publishable, config_stripe_secret, config_stripe_account, config_stripe_expense_vendor, config_stripe_expense_category, config_stripe_percentage_fee, config_stripe_flat_fee FROM settings WHERE company_id = 1"));
|
||||
$config_stripe_enable = intval($stripe_vars['config_stripe_enable']);
|
||||
$config_stripe_publishable = nullable_htmlentities($stripe_vars['config_stripe_publishable']);
|
||||
$config_stripe_secret = nullable_htmlentities($stripe_vars['config_stripe_secret']);
|
||||
@@ -22,13 +15,12 @@ $config_stripe_expense_vendor = intval($stripe_vars['config_stripe_expense_vendo
|
||||
$config_stripe_expense_category = intval($stripe_vars['config_stripe_expense_category']);
|
||||
$config_stripe_percentage_fee = floatval($stripe_vars['config_stripe_percentage_fee']);
|
||||
$config_stripe_flat_fee = floatval($stripe_vars['config_stripe_flat_fee']);
|
||||
$config_stripe_client_pays_fees = intval($stripe_vars['config_stripe_client_pays_fees']);
|
||||
|
||||
// Check Stripe is configured
|
||||
if ($config_stripe_enable == 0 || $config_stripe_account == 0 || empty($config_stripe_publishable) || empty($config_stripe_secret)) {
|
||||
echo "<br><h2>Stripe payments not enabled/configured</h2>";
|
||||
require_once 'guest_footer.php';
|
||||
|
||||
error_log("Stripe payment error - disabled. Check payments are enabled, Expense account is set, Stripe publishable and secret keys are configured.");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -56,7 +48,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
if (!$sql || mysqli_num_rows($sql) !== 1) {
|
||||
echo "<br><h2>Oops, something went wrong! Please ensure you have the correct URL and have not already paid this invoice.</h2>";
|
||||
require_once 'guest_footer.php';
|
||||
|
||||
error_log("Stripe payment error - Invoice with ID $invoice_id is unknown/not eligible to be paid.");
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -84,16 +76,6 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
$amount_paid = floatval($row['amount_paid']);
|
||||
$balance_to_pay = $invoice_amount - $amount_paid;
|
||||
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
$balance_before_fees = $balance_to_pay;
|
||||
// See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
|
||||
// Calculate the amount to charge the client
|
||||
$balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
|
||||
// Calculate the fee amount
|
||||
$gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
|
||||
|
||||
}
|
||||
|
||||
//Round balance to pay to 2 decimal places
|
||||
$balance_to_pay = round($balance_to_pay, 2);
|
||||
|
||||
@@ -143,14 +125,6 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $item_total, $invoice_currency_code); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php }
|
||||
if ($config_stripe_client_pays_fees == 1) { ?>
|
||||
|
||||
<tr>
|
||||
<td>Gateway Fees</td>
|
||||
<td class="text-center">-</td>
|
||||
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $gateway_fee, $invoice_currency_code); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -215,12 +189,14 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
$pi_obj = \Stripe\PaymentIntent::retrieve($pi_id);
|
||||
|
||||
if ($pi_obj->client_secret !== $pi_cs) {
|
||||
error_log("Stripe payment error - Payment intent ID/Secret mismatch for $pi_id");
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
} elseif ($pi_obj->status !== "succeeded") {
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
} elseif ($pi_obj->amount !== $pi_obj->amount_received) {
|
||||
// The invoice wasn't paid in full
|
||||
// this should be flagged for manual review as would indicate something weird happening
|
||||
error_log("Stripe payment error - payment amount does not match amount paid for $pi_id");
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
}
|
||||
|
||||
@@ -245,6 +221,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
LIMIT 1"
|
||||
);
|
||||
if (!$invoice_sql || mysqli_num_rows($invoice_sql) !== 1) {
|
||||
error_log("Stripe payment error - Invoice with ID $invoice_id is unknown/not eligible to be paid. PI $pi_id");
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
}
|
||||
|
||||
@@ -277,24 +254,8 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
$amount_paid_previously = $row['amount_paid'];
|
||||
$balance_to_pay = $invoice_amount - $amount_paid_previously;
|
||||
|
||||
// Check config to see if client pays fees is enabled or if should expense it
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
$balance_before_fees = $balance_to_pay;
|
||||
// See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
|
||||
// Calculate the amount to charge the client
|
||||
$balance_to_pay = ($balance_to_pay + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
|
||||
// Calculate the fee amount
|
||||
$gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
|
||||
|
||||
// Add as line item to client Invoice
|
||||
mysqli_query($mysqli,"INSERT INTO invoice_items SET item_name = 'Gateway Fees', item_description = 'Payment Gateway Fees', item_quantity = 1, item_price = $gateway_fee, item_subtotal = $gateway_fee, item_total = $gateway_fee, item_order = 999, item_invoice_id = $invoice_id");
|
||||
// Update the Amount on the invoice to include the gateway fee
|
||||
$new_invoice_amount = $invoice_amount + $gateway_fee;
|
||||
mysqli_query($mysqli,"UPDATE invoices SET invoice_amount = $new_invoice_amount WHERE invoice_id = $invoice_id");
|
||||
}
|
||||
|
||||
// Check to see if Expense Fields are configured and client pays fee is off then create expense
|
||||
if ($config_stripe_client_pays_fees == 0 && $config_stripe_expense_vendor > 0 && $config_stripe_expense_category > 0) {
|
||||
// Check to see if Expense Fields are configured to create Stripe payment expense
|
||||
if ($config_stripe_expense_vendor > 0 && $config_stripe_expense_category > 0) {
|
||||
// Calculate gateway expense fee
|
||||
$gateway_fee = round($balance_to_pay * $config_stripe_percentage_fee + $config_stripe_flat_fee, 2);
|
||||
|
||||
@@ -307,7 +268,8 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
|
||||
// Sanity check that the amount paid is exactly the invoice outstanding balance
|
||||
if (intval($balance_to_pay) !== intval($pi_amount_paid)) {
|
||||
exit("Something went wrong confirming this payment. Please get in touch.");
|
||||
error_log("Stripe payment error - Invoice balance does not match amount paid for $pi_id");
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
}
|
||||
|
||||
// Apply payment
|
||||
@@ -319,11 +281,6 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
mysqli_query($mysqli, "INSERT INTO payments SET payment_date = '$pi_date', payment_amount = $pi_amount_paid, payment_currency_code = '$pi_currency', payment_account_id = $config_stripe_account, payment_method = 'Stripe', payment_reference = 'Stripe - $pi_id', payment_invoice_id = $invoice_id");
|
||||
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Payment added - $ip - $os - $browser', history_invoice_id = $invoice_id");
|
||||
|
||||
// Add Gateway fees to history if applicable
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Paid', history_description = 'Gateway fees of $gateway_fee has been billed', history_invoice_id = $invoice_id");
|
||||
}
|
||||
|
||||
// Notify
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Invoice Paid', notification = 'Invoice $invoice_prefix$invoice_number has been paid - $ip - $os - $browser', notification_action = 'invoice.php?invoice_id=$invoice_id', notification_client_id = $pi_client_id");
|
||||
|
||||
@@ -332,9 +289,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
if (!$pi_livemode) {
|
||||
$extended_log_desc = '(DEV MODE)';
|
||||
}
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
$extended_log_desc .= ' (Client Pays Fees [' . numfmt_format_currency($currency_format, $gateway_fee, $invoice_currency_code) . ']])';
|
||||
}
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Payment', log_action = 'Create', log_description = 'Stripe payment of $pi_currency $pi_amount_paid against invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc', log_ip = '$ip', log_user_agent = '$user_agent', log_client_id = $pi_client_id");
|
||||
|
||||
|
||||
@@ -369,22 +324,16 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
|
||||
];
|
||||
$mail = addToMailQueue($mysqli, $data);
|
||||
|
||||
// Email Logging
|
||||
if ($mail === true) {
|
||||
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Emailed Receipt!', history_invoice_id = $invoice_id");
|
||||
} else {
|
||||
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Email Receipt Failed!', history_invoice_id = $invoice_id");
|
||||
// Email logging
|
||||
mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Sent', history_description = 'Emailed Receipt!', history_invoice_id = $invoice_id");
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Mail', notification = 'Failed to send email to $contact_email'");
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Mail', log_action = 'Error', log_description = 'Failed to send email to $contact_email regarding $subject. $mail'");
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect user to invoice
|
||||
header('Location: //' . $config_base_url . '/guest_view_invoice.php?invoice_id=' . $pi_invoice_id . '&url_key=' . $invoice_url_key);
|
||||
|
||||
} else {
|
||||
echo "<br><h2>Oops, something went wrong! Please raise a ticket if you believe this is an error.</h2>";
|
||||
exit(WORDING_PAYMENT_FAILED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ $config_invoice_footer = nullable_htmlentities($row['config_invoice_footer']);
|
||||
$config_stripe_enable = intval($row['config_stripe_enable']);
|
||||
$config_stripe_percentage_fee = floatval($row['config_stripe_percentage_fee']);
|
||||
$config_stripe_flat_fee = floatval($row['config_stripe_flat_fee']);
|
||||
$config_stripe_client_pays_fees = intval($row['config_stripe_client_pays_fees']);
|
||||
|
||||
//Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
@@ -113,16 +112,6 @@ $amount_paid = floatval($row['amount_paid']);
|
||||
// Calculate the balance owed
|
||||
$balance = $invoice_amount - $amount_paid;
|
||||
|
||||
// Calculate Gateway Fee
|
||||
if ($config_stripe_client_pays_fees == 1) {
|
||||
$balance_before_fees = $balance;
|
||||
// See here for passing costs on to client https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers
|
||||
// Calculate the amount to charge the client
|
||||
$balance_to_pay = ($balance + $config_stripe_flat_fee) / (1 - $config_stripe_percentage_fee);
|
||||
// Calculate the fee amount
|
||||
$gateway_fee = round($balance_to_pay - $balance_before_fees, 2);
|
||||
}
|
||||
|
||||
//check to see if overdue
|
||||
$invoice_color = $invoice_badge_color; // Default
|
||||
if ($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled") {
|
||||
@@ -170,7 +159,7 @@ if ($balance > 0) {
|
||||
<a class="btn btn-default" href="#" onclick="pdfMake.createPdf(docDefinition).download('<?php echo strtoAZaz09(html_entity_decode("$invoice_date-$company_name-Invoice-$invoice_prefix$invoice_number")); ?>');"><i class="fa fa-fw fa-download mr-2"></i>Download</a>
|
||||
<?php
|
||||
if ($invoice_status !== "Paid" && $invoice_status !== "Cancelled" && $invoice_status !== "Draft" && $config_stripe_enable == 1) { ?>
|
||||
<a class="btn btn-success" href="guest_pay_invoice_stripe.php?invoice_id=<?php echo $invoice_id; ?>&url_key=<?php echo $url_key; ?>"><i class="fa fa-fw fa-credit-card mr-2"></i>Pay Now <?php if($config_stripe_client_pays_fees == 1) { echo "(Gateway Fee: " . numfmt_format_currency($currency_format, $gateway_fee, $invoice_currency_code) . ")"; } ?></a>
|
||||
<a class="btn btn-success" href="guest_pay_invoice_stripe.php?invoice_id=<?php echo $invoice_id; ?>&url_key=<?php echo $url_key; ?>"><i class="fa fa-fw fa-credit-card mr-2"></i>Pay Now </a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -212,18 +212,18 @@ if (isset($_GET['client_id'])) {
|
||||
|
||||
// Expiring Items
|
||||
|
||||
// Count Domains Expiring within 30 Days
|
||||
// Count Domains Expiring within 90 Days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('domain_id') AS num FROM domains
|
||||
WHERE domain_client_id = $client_id
|
||||
AND domain_expire IS NOT NULL
|
||||
AND domain_expire < CURRENT_DATE + INTERVAL 30 DAY
|
||||
AND domain_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
AND domain_archived_at IS NULL"
|
||||
));
|
||||
$num_domains_expiring = intval($row['num']);
|
||||
|
||||
// Count Domains Expired or within 5 days
|
||||
// Count Domains Expired or within 14 days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('domain_id') AS num FROM domains
|
||||
@@ -231,22 +231,61 @@ if (isset($_GET['client_id'])) {
|
||||
AND domain_expire IS NOT NULL
|
||||
AND (
|
||||
domain_expire < CURRENT_DATE
|
||||
OR domain_expire < CURRENT_DATE + INTERVAL 5 DAY
|
||||
OR domain_expire < CURRENT_DATE + INTERVAL 14 DAY
|
||||
)
|
||||
AND domain_archived_at IS NULL"
|
||||
));
|
||||
$num_domains_expired = intval($row['num']);
|
||||
|
||||
// Count Certificates Expiring within 30 Days
|
||||
// Count Certificates Expiring within 90 Days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('certificate_id') AS num FROM certificates
|
||||
WHERE certificate_client_id = $client_id
|
||||
AND certificate_expire IS NOT NULL
|
||||
AND certificate_expire < CURRENT_DATE + INTERVAL 30 DAY
|
||||
AND certificate_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
AND certificate_archived_at IS NULL"
|
||||
));
|
||||
$num_certs_expiring = intval($row['num']);
|
||||
$num_certificates_expiring = intval($row['num']);
|
||||
|
||||
// Count Certificates Expired or within 14 days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('certificate_id') AS num FROM certificates
|
||||
WHERE certificate_client_id = $client_id
|
||||
AND certificate_expire IS NOT NULL
|
||||
AND (
|
||||
certificate_expire < CURRENT_DATE
|
||||
OR certificate_expire < CURRENT_DATE + INTERVAL 14 DAY
|
||||
)
|
||||
AND certificate_archived_at IS NULL"
|
||||
));
|
||||
$num_certificates_expired = intval($row['num']);
|
||||
|
||||
// Count Software Expiring within 90 Days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('software_id') AS num FROM software
|
||||
WHERE software_client_id = $client_id
|
||||
AND software_expire IS NOT NULL
|
||||
AND software_expire < CURRENT_DATE + INTERVAL 90 DAY
|
||||
AND software_archived_at IS NULL"
|
||||
));
|
||||
$num_software_expiring = intval($row['num']);
|
||||
|
||||
// Count Software Expired or within 14 days
|
||||
$row = mysqli_fetch_assoc(mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT COUNT('software_id') AS num FROM software
|
||||
WHERE software_client_id = $client_id
|
||||
AND software_expire IS NOT NULL
|
||||
AND (
|
||||
software_expire < CURRENT_DATE
|
||||
OR software_expire < CURRENT_DATE + INTERVAL 14 DAY
|
||||
)
|
||||
AND software_archived_at IS NULL"
|
||||
));
|
||||
$num_software_expired = intval($row['num']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,8 @@
|
||||
<option value="">- Select an Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$account_type = nullable_htmlentities($row['account_type']);
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = nullable_htmlentities($row['account_name']);
|
||||
$opening_balance = floatval($row['opening_balance']);
|
||||
|
||||
@@ -54,9 +54,8 @@
|
||||
<option value="">- Select an Account -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON account_types.account_type_id = accounts.account_type WHERE account_type_parent = 1 AND account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$account_type = nullable_htmlentities($row['account_type']);
|
||||
$account_id = intval($row['account_id']);
|
||||
$account_name = nullable_htmlentities($row['account_name']);
|
||||
$opening_balance = floatval($row['opening_balance']);
|
||||
|
||||
@@ -16,6 +16,7 @@ function populateNetworkEditModal(client_id, network_id) {
|
||||
// Populate the network modal fields
|
||||
document.getElementById("editNetworkHeader").innerText = network.network_name;
|
||||
document.getElementById("editNetworkId").value = network_id;
|
||||
document.getElementById("showNetworkId").innerText = "Network ID: " + network_id;
|
||||
document.getElementById("editNetworkName").value = network.network_name;
|
||||
document.getElementById("editNetworkDescription").value = network.network_description;
|
||||
document.getElementById("editNetworkVlan").value = network.network_vlan;
|
||||
|
||||
@@ -12,6 +12,14 @@ function populateShareModal(client_id, item_type, item_ref_id) {
|
||||
// Show form and generate button
|
||||
document.getElementById("div_share_link_form").hidden = false;
|
||||
document.getElementById("div_share_link_generate").hidden = false;
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#share_email').select2({
|
||||
tags: true,
|
||||
placeholder: 'Select or type a value',
|
||||
allowClear: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function generateShareLink() {
|
||||
|
||||
@@ -378,8 +378,8 @@ if (isset($_POST['login'])) {
|
||||
<button type="submit" class="btn btn-primary btn-block mb-3" name="login">Sign In</button>
|
||||
|
||||
<?php if($config_client_portal_enable == 1){ ?>
|
||||
<hr>
|
||||
<h5 class="text-center">Looking for the <a href="portal">Client Portal?<a/></h5>
|
||||
<hr>
|
||||
<h5 class="text-center">Looking for the <a href="portal">Client Portal?<a/></h5>
|
||||
<?php } ?>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -13,8 +13,8 @@ $url_query_strings_sort = http_build_query($get_copy);
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM notifications
|
||||
LEFT JOIN users ON notification_dismissed_by = user_id
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM notifications
|
||||
LEFT JOIN users ON notification_dismissed_by = user_id
|
||||
LEFT JOIN clients ON notification_client_id = client_id
|
||||
WHERE (notification_type LIKE '%$q%' OR notification LIKE '%$q%' OR user_name LIKE '%$q%' OR client_name LIKE '%$q%')
|
||||
AND DATE(notification_timestamp) BETWEEN '$dtf' AND '$dtt'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user