mirror of https://github.com/itflow-org/itflow
Added SSL Certicicate Documentation to Client Documentation Updated DB as well
This commit is contained in:
parent
4324391e83
commit
4fec4dd36b
|
|
@ -0,0 +1,51 @@
|
|||
<div class="modal" id="addCertificateModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header text-white">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-lock mr-2"></i>New Certificate</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">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Certificate 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-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Certificate name" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Issued By <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-building"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="issued_by" placeholder="Issued By" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="expire">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_certificate" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -78,6 +78,9 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('domain_id') AS num FROM domains WHERE client_id = $client_id"));
|
||||
$num_domains = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('certificate_id') AS num FROM certificates WHERE client_id = $client_id"));
|
||||
$num_certificates = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('software_id') AS num FROM software WHERE client_id = $client_id"));
|
||||
$num_software = $row['num'];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
//Rebuild URL
|
||||
|
||||
$url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o)));
|
||||
|
||||
//Paging
|
||||
if(isset($_GET['p'])){
|
||||
$p = intval($_GET['p']);
|
||||
$record_from = (($p)-1)*$config_records_per_page;
|
||||
$record_to = $config_records_per_page;
|
||||
}else{
|
||||
$record_from = 0;
|
||||
$record_to = $config_records_per_page;
|
||||
$p = 1;
|
||||
}
|
||||
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
}else{
|
||||
$q = "";
|
||||
}
|
||||
|
||||
if(!empty($_GET['sb'])){
|
||||
$sb = mysqli_real_escape_string($mysqli,$_GET['sb']);
|
||||
}else{
|
||||
$sb = "certificate_name";
|
||||
}
|
||||
|
||||
if(isset($_GET['o'])){
|
||||
if($_GET['o'] == 'ASC'){
|
||||
$o = "ASC";
|
||||
$disp = "DESC";
|
||||
}else{
|
||||
$o = "DESC";
|
||||
$disp = "ASC";
|
||||
}
|
||||
}else{
|
||||
$o = "ASC";
|
||||
$disp = "DESC";
|
||||
}
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM certificates
|
||||
WHERE client_id = $client_id AND (certificate_name LIKE '%$q%' OR certificate_issued_by LIKE '%$q%')
|
||||
ORDER BY $sb $o LIMIT $record_from, $record_to");
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
$total_found_rows = $num_rows[0];
|
||||
$total_pages = ceil($total_found_rows / 10);
|
||||
|
||||
?>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-dark text-white">
|
||||
<h6 class="float-left mt-1"><i class="fa fa-lock"></i> Certificates</h6>
|
||||
<button class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addCertificateModal"><i class="fa fa-plus"></i></button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="tab" value="<?php echo $_GET['tab']; ?>">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search <?php echo ucwords($_GET['tab']); ?>">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<div class="table-responsive">
|
||||
<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-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_name&o=<?php echo $disp; ?>">Name</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_issued_by&o=<?php echo $disp; ?>">Issued By</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_expire&o=<?php echo $disp; ?>">Expire</a></th>
|
||||
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_updated_at&o=<?php echo $disp; ?>">Updated</a></th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$certificate_id = $row['certificate_id'];
|
||||
$certificate_name = $row['certificate_name'];
|
||||
$certificate_issued_by = $row['certificate_issued_by'];
|
||||
$certificate_expire = $row['certificate_expire'];
|
||||
$certificate_updated_at = $row['certificate_updated_at'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a class="text-dark" href="#" data-toggle="modal" data-target="#editCertificateModal<?php echo $certificate_id; ?>"><?php echo $certificate_name; ?></a></td>
|
||||
<td><?php echo $certificate_issued_by; ?></td>
|
||||
<td><?php echo $certificate_expire; ?></td>
|
||||
<td><?php echo $certificate_updated_at; ?></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="#editCertificateModal<?php echo $certificate_id; ?>">Edit</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="post.php?delete_certificate=<?php echo $certificate_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("edit_certificate_modal.php"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php include("pagination.php"); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_certificate_modal.php"); ?>
|
||||
|
|
@ -25,6 +25,9 @@ if(isset($_GET['tab'])){
|
|||
elseif($_GET['tab'] == "domains"){
|
||||
include("client_domains.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "certificates"){
|
||||
include("client_certificates.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "software"){
|
||||
include("client_software.php");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,6 +95,19 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&tab=certificates" class="nav-link <?php if($_GET['tab'] == "certificates") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-lock"></i>
|
||||
<p>
|
||||
Certificates
|
||||
<?php
|
||||
if($num_certificates > 0){ ?>
|
||||
<span class="right badge badge-light"><?php echo $num_certificates; ?></span>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&tab=domains" class="nav-link <?php if($_GET['tab'] == "domains") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-globe"></i>
|
||||
|
|
|
|||
41
db.sql
41
db.sql
|
|
@ -123,6 +123,27 @@ CREATE TABLE `categories` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `certificates`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `certificates`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `certificates` (
|
||||
`certificate_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`certificate_name` varchar(200) NOT NULL,
|
||||
`certificate_issued_by` varchar(200) NOT NULL,
|
||||
`certificate_expire` date DEFAULT NULL,
|
||||
`certificate_notes` text DEFAULT NULL,
|
||||
`certificate_created_at` datetime NOT NULL,
|
||||
`certificate_updated_at` datetime DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`certificate_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `clients`
|
||||
--
|
||||
|
|
@ -215,7 +236,7 @@ CREATE TABLE `domains` (
|
|||
`domain_updated_at` datetime DEFAULT NULL,
|
||||
`domain_registrar` int(11) DEFAULT NULL,
|
||||
`domain_webhost` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) DEFAULT NULL,
|
||||
`client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`domain_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
@ -822,6 +843,22 @@ CREATE TABLE `user_companies` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `user_keys`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `user_keys`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `user_keys` (
|
||||
`user_key_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_key_name` varchar(200) DEFAULT NULL,
|
||||
`user_public_key` varchar(250) NOT NULL,
|
||||
`user_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`user_key_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
|
@ -883,4 +920,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-01-22 18:05:30
|
||||
-- Dump completed on 2021-01-26 16:07:08
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<div class="modal" id="editCertificateModal<?php echo $certificate_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-lock mr-2"></i><?php echo $certificate_name ?></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">
|
||||
<input type="hidden" name="certificate_id" value="<?php echo $certificate_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Certificate 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-lock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Certificate name" value="<?php echo $certificate_name; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Issued By <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-building"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="issued_by" placeholder="Issued By" value="<?php echo $certificate_issued_by; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Expire Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="expire" value="<?php echo $certificate_expire; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_certificate" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
56
post.php
56
post.php
|
|
@ -3566,6 +3566,62 @@ if(isset($_GET['delete_domain'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_certificate'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$issued_by = strip_tags(mysqli_real_escape_string($mysqli,$_POST['issued_by']));
|
||||
$expire = strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire']));
|
||||
if(empty($expire)){
|
||||
$expire = "0000-00-00";
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO certificates SET certificate_name = '$name', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_created_at = NOW(), client_id = $client_id, company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Certificate', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Certificate added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_certificate'])){
|
||||
|
||||
$certificate_id = intval($_POST['certificate_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$issued_by = strip_tags(mysqli_real_escape_string($mysqli,$_POST['issued_by']));
|
||||
$expire = strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire']));
|
||||
if(empty($expire)){
|
||||
$expire = "0000-00-00";
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"UPDATE certificates SET certificate_name = '$name', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_updated_at = NOW() WHERE certificate_id = $certificate_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Certificate', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Certificate updated";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_certificate'])){
|
||||
$certificate_id = intval($_GET['delete_certificate']);
|
||||
|
||||
mysqli_query($mysqli,"DELETE FROM certificates WHERE certificate_id = $certificate_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Certificate', log_action = 'Deleted', log_description = '$certificate_id', log_created_at = NOW(), company_id = $session_company_id, user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Certificate deleted";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_software'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
|
|
|
|||
Loading…
Reference in New Issue