Skip to content

Commit

Permalink
Merge branch '0.2.0.0-functionalizing' of https://github.com/twetech/…
Browse files Browse the repository at this point in the history
…itflow into 0.2.0.0-functionalizing
  • Loading branch information
o-psi committed Mar 22, 2024
2 parents d70a5a4 + 6aacaa2 commit 5754ffa
Show file tree
Hide file tree
Showing 45 changed files with 741 additions and 492 deletions.
29 changes: 3 additions & 26 deletions admin_mail_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

require_once "inc_all_admin.php";


//Initialize the HTML Purifier to prevent XSS
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";

$purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
$purifier = new HTMLPurifier($purifier_config);

//Rebuild URL
$url_query_strings_sort = http_build_query($get_copy);

Expand Down Expand Up @@ -104,7 +96,6 @@
$email_recipient = nullable_htmlentities($row['email_recipient']);
$email_recipient_name = nullable_htmlentities($row['email_recipient_name']);
$email_subject = nullable_htmlentities($row['email_subject']);
$email_content = $purifier->purify($row['email_content']);
$email_attempts = intval($row['email_attempts']);
$email_queued_at = nullable_htmlentities($row['email_queued_at']);
$email_failed_at = nullable_htmlentities($row['email_failed_at']);
Expand All @@ -131,7 +122,9 @@
<td><?php echo $email_status_display; ?></td>
<td><?php echo $email_attempts; ?></td>
<td>
<button class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#viewEmailModal<?php echo $email_id; ?>"><i class="fas fa-fw fa-eye"></i></button>
<a class="btn btn-sm btn-secondary" href="admin_mail_queue_message_view.php?email_id=<?php echo $email_id; ?>">
<i class="fas fa-fw fa-eye"></i>
</a>

<!-- Show force resend if all retries have failed -->
<?php if ($email_status == 2 && $email_attempts > 3) { ?>
Expand All @@ -146,22 +139,6 @@
</td>
</tr>

<div class="modal" id="viewEmailModal<?php echo $email_id; ?>" tabindex="-1">
<div class="modal-dialog modal-xl ">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-envelope-open mr-2"></i>ID: <?php echo "$email_id - $email_subject"; ?></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body bg-white">
<?php echo $email_content; ?>
</div>
</div>
</div>
</div>

<?php
}
?>
Expand Down
77 changes: 77 additions & 0 deletions admin_mail_queue_message_view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

require_once "inc_all_admin.php";

//Initialize the HTML Purifier to prevent XSS
require "plugins/htmlpurifier/HTMLPurifier.standalone.php";

$purifier_config = HTMLPurifier_Config::createDefault();
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
$purifier = new HTMLPurifier($purifier_config);

if (isset($_GET['email_id'])) {
$email_id = intval($_GET['email_id']);
} else {
echo "You dont belong here";
exit();
}

$sql = mysqli_query($mysqli, "SELECT * FROM email_queue WHERE email_id = $email_id");

$row = mysqli_fetch_array($sql);

$email_from = nullable_htmlentities($row['email_from']);
$email_from_name = nullable_htmlentities($row['email_from_name']);
$email_recipient = nullable_htmlentities($row['email_recipient']);
$email_recipient_name = nullable_htmlentities($row['email_recipient_name']);
$email_subject = nullable_htmlentities($row['email_subject']);
$email_content = $purifier->purify($row['email_content']);
$email_attempts = intval($row['email_attempts']);
$email_queued_at = nullable_htmlentities($row['email_queued_at']);
$email_failed_at = nullable_htmlentities($row['email_failed_at']);
$email_sent_at = nullable_htmlentities($row['email_sent_at']);
$email_status = intval($row['email_status']);
if ($email_status == 0) {
$email_status_display = "<div class='text-primary'>Queued</div>";
} elseif($email_status == 1) {
$email_status_display = "<div class='text-warning'>Sending</div>";
} elseif($email_status == 2) {
$email_status_display = "<div class='text-danger'>Failed</div><small class='text-secondary'>$email_failed_at</small>";
} else {
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary'>$email_sent_at</small>";
}

?>

<ol class="breadcrumb d-print-none">
<li class="breadcrumb-item">
<a href="admin_users.php"><i class="fas fa-fw fa-user-shield mr-2"></i>Admin</a>
</li>
<li class="breadcrumb-item">
<a href="admin_mail_queue.php"><i class="fas fa-fw fa-mail-bulk mr-2"></i>Mail Queue</a>
</li>
<li class="breadcrumb-item active"><i class="fas fa-fw fa-envelope-open mr-2"></i><?php echo $email_subject; ?></li>
</ol>

<div class="row">

<div class="col-md-12">
<div class="card">
<div class="card-header bg-dark">
<div>From: <?php echo "$email_from_name <small>($email_from)</small>"; ?></div>
<div>To: <?php echo "$email_recipient_name <small>($email_recipient)</small>"; ?></div>
<div>Subject: <?php echo $email_subject; ?></div>
</div>
<div class="card-body prettyContent">
<?php echo $email_content; ?>
</div>
</div>
</div>

</div>

<script src="js/pretty_content.js"></script>

<?php

require_once "footer.php";
2 changes: 1 addition & 1 deletion admin_side_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<li class="nav-header mt-3">MAINTENANCE</li>

<li class="nav-item">
<a href="admin_mail_queue.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_mail_queue.php") {
<a href="admin_mail_queue.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "admin_mail_queue.php" || basename($_SERVER["PHP_SELF"]) == "admin_mail_queue_message_view.php") {
echo "active";
} ?>">
<i class="nav-icon fas fa-mail-bulk"></i>
Expand Down
14 changes: 12 additions & 2 deletions admin_software_template_add_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-rocket mr-2"></i>New License Template</h5>
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>New License Template</h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
Expand Down Expand Up @@ -30,6 +30,16 @@
</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" name="description" placeholder="Short description">
</div>
</div>

<div class="form-group">
<label>Type <strong class="text-danger">*</strong></label>
<div class="input-group">
Expand Down Expand Up @@ -64,7 +74,7 @@

</div>
<div class="modal-footer bg-white">
<button type="submit" name="add_software_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Create Template</button>
<button type="submit" name="add_software_template" 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="fa fa-times mr-2"></i>Cancel</button>
</div>
</form>
Expand Down
14 changes: 12 additions & 2 deletions admin_software_template_edit_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-rocket mr-2"></i>Editing template: <strong><?php echo $software_name; ?></strong></h5>
<h5 class="modal-title"><i class="fa fa-fw fa-cube mr-2"></i>Editing template: <strong><?php echo $software_name; ?></strong></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
Expand Down Expand Up @@ -31,6 +31,16 @@
</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" name="description" placeholder="Short description" value="<?php echo $software_description; ?>">
</div>
</div>

<div class="form-group">
<label>Type <strong class="text-danger">*</strong></label>
<div class="input-group">
Expand Down Expand Up @@ -64,7 +74,7 @@

</div>
<div class="modal-footer bg-white">
<button type="submit" name="edit_software_template" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save Template</button>
<button type="submit" name="edit_software_template" 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>
Expand Down
28 changes: 16 additions & 12 deletions admin_software_templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS * FROM software
LEFT JOIN logins ON login_software_id = software_id
"SELECT SQL_CALC_FOUND_ROWS * FROM software
WHERE software_template = 1
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%')
AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%')
ORDER BY $sort $order LIMIT $record_from, $record_to"
);

Expand All @@ -25,7 +24,7 @@

<div class="card card-dark">
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-rocket mr-2"></i>License Templates</h3>
<h3 class="card-title mt-2"><i class="fas fa-fw fa-cube mr-2"></i>License Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addSoftwareTemplateModal"><i class="fas fa-plus mr-2"></i>New License Template</button>
</div>
Expand All @@ -36,7 +35,7 @@

<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search Licenses">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(nullable_htmlentities($q)); } ?>" placeholder="Search License Templates">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
Expand All @@ -56,7 +55,6 @@
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=software_name&order=<?php echo $disp; ?>">Template</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 class="text-center">Action</th>
</tr>
</thead>
Expand All @@ -67,20 +65,26 @@
$software_id = intval($row['software_id']);
$software_name = nullable_htmlentities($row['software_name']);
$software_version = nullable_htmlentities($row['software_version']);
$software_description = nullable_htmlentities($row['software_description']);
$software_type = nullable_htmlentities($row['software_type']);
$software_license_type = nullable_htmlentities($row['software_license_type']);
$software_key = nullable_htmlentities($row['software_key']);
$software_seats = nullable_htmlentities($row['software_seats']);
$software_purchase = nullable_htmlentities($row['software_purchase']);
$software_expire = nullable_htmlentities($row['software_expire']);
$software_notes = nullable_htmlentities($row['software_notes']);

?>
<tr>
<td><a class="text-dark text-bold" href="#" data-toggle="modal" data-target="#editSoftwareTemplateModal<?php echo $software_id; ?>"><?php echo "$software_name<br><span class='text-secondary'>$software_version</span>"; ?></a></td>
<td>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editSoftwareTemplateModal<?php echo $software_id; ?>">
<div class="media">
<i class="fa fa-fw fa-2x fa-cube mr-3"></i>
<div class="media-body">
<div><?php echo "$software_name <span>$software_version</span>"; ?></div>
<div><small class="text-secondary"><?php echo $software_description; ?></small></div>
</div>
</div>
</a>
</td>
<td><?php echo $software_type; ?></td>
<td><?php echo $software_license_type; ?></td>
<td><?php echo $software_seats; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" data-toggle="dropdown">
Expand Down
3 changes: 3 additions & 0 deletions check_login.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
// 2024-02-08 JQ - The option to set the timezone in PHP was disabled to prevent inconsistencies with MariaDB/MySQL, which utilize the system's timezone, It is now consdered best practice to set the timezone on system itself
//date_default_timezone_set($session_timezone);

// 2024-03-21 JQ - Re-Enabled Timezone setting as new PHP update does not respect System Time but defaulted to UTC
date_default_timezone_set($session_timezone);

//Set Currency Format
$currency_format = numfmt_create($session_company_locale, NumberFormatter::CURRENCY);

Expand Down
11 changes: 4 additions & 7 deletions client_assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
$asset_ip = implode(", ", $asset_ip);
}
if (empty($asset_ip)) {
$asset_ip_display = "DHCP";
$asset_ip_display = "-";
} else {
$asset_ip_display = $asset_ip;
}
Expand Down Expand Up @@ -286,15 +286,12 @@
</div>
</td>
<td>
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>" class="text-secondary">
<a href="client_asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>" class="text-dark">
<div class="media">
<i class="fa fa-fw fa-2x fa-<?php echo $device_icon; ?> mr-3 mt-1"></i>
<div class="media-body">
<p>
<strong><?php echo $asset_name; ?></strong>
<br>
<small><?php echo $asset_description; ?></small>
</p>
<div><?php echo $asset_name; ?></div>
<div><small class="text-secondary"><?php echo $asset_description; ?></small></div>
</div>
</div>
</a>
Expand Down
Loading

0 comments on commit 5754ffa

Please sign in to comment.