Feature: Ability to remove Company Logo, also small UI touch up in company details
This commit is contained in:
+17
-11
@@ -31,6 +31,20 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
||||
<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="row">
|
||||
<div class="col-md-3 text-center">
|
||||
<?php if(file_exists("uploads/settings/$company_logo")) { ?>
|
||||
<img class="img-thumbnail" src="<?php echo "uploads/settings/$company_logo"; ?>">
|
||||
<a href="post.php?remove_company_logo" class="btn btn-outline-danger btn-block">Remove Logo</a>
|
||||
<hr>
|
||||
<?php } ?>
|
||||
<div class="form-group">
|
||||
<label>Upload company logo</label>
|
||||
<input type="file" class="form-control-file" name="file" accept=".jpg, .jpeg, .png">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
@@ -41,16 +55,6 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card col-md-2">
|
||||
<div class="card-body">
|
||||
<img class="img-fluid" src="<?php echo "uploads/settings/$company_logo"; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control-file" name="file" accept=".jpg, .jpeg, .png">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
<div class="input-group">
|
||||
@@ -139,7 +143,9 @@ $company_initials = nullable_htmlentities(initials($company_name));
|
||||
<hr>
|
||||
|
||||
<button type="submit" name="edit_company" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Save</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,3 +50,21 @@ if (isset($_POST['edit_company'])) {
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['remove_company_logo'])) {
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT company_logo FROM companies");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$company_logo = $row['company_logo']; // FileSystem Operation Logo is already sanitized
|
||||
|
||||
unlink("uploads/settings/$company_logo");
|
||||
|
||||
// Logging
|
||||
logAction("Settings", "Edit", "$session_name deleted company logo");
|
||||
|
||||
$_SESSION['alert_type'] = "error";
|
||||
$_SESSION['alert_message'] = "Removed company logo";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user