mirror of https://github.com/itflow-org/itflow
Merge branch 'master' of https://github.com/johnnyq/itflow
This commit is contained in:
commit
b5cee625ce
|
|
@ -32,12 +32,12 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Issued By <strong class="text-danger">*</strong></label>
|
||||
<label>Issued By </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>
|
||||
<input type="text" class="form-control" name="issued_by" placeholder="Issued By">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -51,6 +51,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Public Key </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" name="public_key" placeholder="-----BEGIN CERTIFICATE-----"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$certificate_issued_by = $row['certificate_issued_by'];
|
||||
$certificate_expire = $row['certificate_expire'];
|
||||
$certificate_updated_at = $row['certificate_updated_at'];
|
||||
$certificate_public_key = $row['certificate_public_key'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
3
db.sql
3
db.sql
|
|
@ -186,6 +186,7 @@ CREATE TABLE `certificates` (
|
|||
`certificate_domain` varchar(200) DEFAULT NULL,
|
||||
`certificate_issued_by` varchar(200) NOT NULL,
|
||||
`certificate_expire` date DEFAULT NULL,
|
||||
`certificate_public_key` varchar(1500) DEFAULT NULL,
|
||||
`certificate_notes` text DEFAULT NULL,
|
||||
`certificate_created_at` datetime NOT NULL,
|
||||
`certificate_updated_at` datetime DEFAULT NULL,
|
||||
|
|
@ -1153,4 +1154,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2021-12-27 12:04:12
|
||||
-- Dump completed on 2022-01-04 11:34:48
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Issued By <strong class="text-danger">*</strong></label>
|
||||
<label>Issued By</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>
|
||||
<input type="text" class="form-control" name="issued_by" placeholder="Issued By" value="<?php echo $certificate_issued_by; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -51,6 +51,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Public Key </label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-key"></i></span>
|
||||
</div>
|
||||
<textarea class="form-control" name="public_key"><?php echo $certificate_public_key; ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
|
|
|
|||
26
post.php
26
post.php
|
|
@ -4567,11 +4567,22 @@ if(isset($_POST['add_certificate'])){
|
|||
$domain = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['domain'])));
|
||||
$issued_by = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['issued_by'])));
|
||||
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
|
||||
$public_key = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['public_key'])));
|
||||
|
||||
if (!empty($public_key)) {
|
||||
// Parse the public certificate key. If successful, set attributes from the certificate
|
||||
$public_key_obj = openssl_x509_parse($_POST['public_key']);
|
||||
if ($public_key_obj) {
|
||||
$expire = date('Y-m-d', $public_key_obj['validTo_time_t']);
|
||||
$issued_by = strip_tags($public_key_obj['issuer']['O']);
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($expire)){
|
||||
$expire = "0000-00-00";
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_created_at = NOW(), certificate_client_id = $client_id, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_created_at = NOW(), certificate_public_key = '$public_key', certificate_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, log_user_id = $session_user_id");
|
||||
|
|
@ -4589,11 +4600,22 @@ if(isset($_POST['edit_certificate'])){
|
|||
$domain = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['domain'])));
|
||||
$issued_by = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['issued_by'])));
|
||||
$expire = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['expire'])));
|
||||
$public_key = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['public_key'])));
|
||||
|
||||
if (!empty($public_key)) {
|
||||
// Parse the public certificate key. If successful, set attributes from the certificate
|
||||
$public_key_obj = openssl_x509_parse($_POST['public_key']);
|
||||
if ($public_key_obj) {
|
||||
$expire = date('Y-m-d', $public_key_obj['validTo_time_t']);
|
||||
$issued_by = strip_tags($public_key_obj['issuer']['O']);
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($expire)){
|
||||
$expire = "0000-00-00";
|
||||
}
|
||||
|
||||
mysqli_query($mysqli,"UPDATE certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_updated_at = NOW() WHERE certificate_id = $certificate_id AND company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE certificates SET certificate_name = '$name', certificate_domain = '$domain', certificate_issued_by = '$issued_by', certificate_expire = '$expire', certificate_updated_at = NOW(), certificate_public_key = '$public_key' 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, log_user_id = $session_user_id");
|
||||
|
|
|
|||
10
setup.php
10
setup.php
|
|
@ -329,6 +329,7 @@ $currencies_array = array(
|
|||
|
||||
if(isset($_POST['add_database'])){
|
||||
|
||||
// Check if database has been setup already. If it has, direct user to edit directly instead.
|
||||
if(file_exists('config.php')){
|
||||
$_SESSION['alert_message'] = "Database already configured. Any further changes should be made by editing the config.php file.";
|
||||
header("Location: setup.php?user");
|
||||
|
|
@ -951,6 +952,15 @@ if(isset($_POST['add_company_settings'])){
|
|||
<li>Get List of Emails in CSV to export to a mailing list</li>
|
||||
<li>Acquire balance can be useful for customer's to get their balance by phone</li>
|
||||
</ul>
|
||||
<?php
|
||||
// Check that there is access to write config.php
|
||||
if(!file_put_contents("config.php", "Test")){
|
||||
echo "<div class='alert alert-danger'>Warning: config.php is not writable. Ensure the webserver user has write access.</div>";
|
||||
}else{
|
||||
// Else, able to write. Tidy up
|
||||
unlink("config.php");
|
||||
}
|
||||
?>
|
||||
<center><a href="?database" class="btn btn-primary">Setup <i class="fa fa-fw fa-arrow-alt-circle-right"></i></a></center>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue