mirror of https://github.com/itflow-org/itflow
Use the bulk mail function in bulk mailers for standardization, also fix unused vars in smtp settings form
This commit is contained in:
parent
1c50a0e314
commit
c3c9da0c71
|
|
@ -15,18 +15,18 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="post.php" method="post">
|
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-envelope-open mr-2"></i>Bulk Mail</h3>
|
<h3 class="card-title mt-2"><i class="fa fa-fw fa-envelope-open mr-2"></i>Bulk Mail</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="submit" class="btn btn-primary" name="send_bulk_mail_now">
|
<button id="bulkActionButton" hidden class="btn btn-primary" type="submit" form='bulkActions' name="send_bulk_mail_now">
|
||||||
<i class="fas fa-paper-plane mr-2"></i>Send Now
|
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Now (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<form id="bulkActions" action="post.php" method="post">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" class="form-check-input" id="selectAllCheckbox" onchange="toggleCheckboxes()">
|
<input type="checkbox" class="form-check-input" id="selectAllCheckbox" onclick="checkAll(this)">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
|
@ -109,7 +109,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input type="checkbox" class="form-check-input" name="contact[]" value="<?php echo $contact_id; ?>">
|
<input type="checkbox" class="form-check-input bulk-select" name="contact_ids[]" value="<?php echo $contact_id; ?>">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
@ -130,23 +130,13 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
<script src="js/bulk_actions.js"></script>
|
||||||
function toggleCheckboxes() {
|
|
||||||
// Get the state of the 'selectAllCheckbox'
|
|
||||||
var selectAllChecked = document.getElementById('selectAllCheckbox').checked;
|
|
||||||
|
|
||||||
// Find all checkboxes with the name 'contact[]' and set their state
|
|
||||||
var checkboxes = document.querySelectorAll('input[type="checkbox"][name="contact[]"]');
|
|
||||||
checkboxes.forEach(function(checkbox) {
|
|
||||||
checkbox.checked = selectAllChecked;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,147 +11,137 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form action="post.php" method="post">
|
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-envelope-open mr-2"></i>Bulk Mail to Special Contacts</h3>
|
<h3 class="card-title mt-2 mb-2"><i class="fa fa-fw fa-envelope-open mr-2"></i>Bulk Mail to Special Contacts</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<button type="submit" class="btn btn-primary" name="send_bulk_mail_now">
|
<button id="bulkActionButton" hidden class="btn btn-primary" type="submit" form='bulkActions' name="send_bulk_mail_now">
|
||||||
<i class="fas fa-paper-plane mr-2"></i>Send Now
|
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send Now (<span id="selectedCount">0</span>)
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<form id="bulkActions" action="post.php" method="post">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
||||||
<h5>Email Message</h5>
|
<h5>Email Message</h5>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<select type="text" class="form-control select2" name="mail_from">
|
<select type="text" class="form-control select2" name="mail_from">
|
||||||
<option value="<?php echo $config_mail_from_email; ?>">
|
<option value="<?php echo $config_mail_from_email; ?>">
|
||||||
<?php echo $config_mail_from_email; ?></option>
|
<?php echo $config_mail_from_email; ?></option>
|
||||||
<option value="<?php echo $config_invoice_from_email; ?>">
|
<option value="<?php echo $config_invoice_from_email; ?>">
|
||||||
<?php echo $config_invoice_from_email; ?></option>
|
<?php echo $config_invoice_from_email; ?></option>
|
||||||
<option value="<?php echo $config_quote_from_email; ?>">
|
<option value="<?php echo $config_quote_from_email; ?>">
|
||||||
<?php echo $config_quote_from_email; ?></option>
|
<?php echo $config_quote_from_email; ?></option>
|
||||||
<option value="<?php echo $config_ticket_from_email; ?>">
|
<option value="<?php echo $config_ticket_from_email; ?>">
|
||||||
<?php echo $config_ticket_from_email; ?></option>
|
<?php echo $config_ticket_from_email; ?></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" name="mail_from_name" placeholder="From Name"
|
<input type="text" class="form-control" name="mail_from_name" placeholder="From Name"
|
||||||
value="<?php echo nullable_htmlentities($config_mail_from_name); ?>" required>
|
value="<?php echo nullable_htmlentities($config_mail_from_name); ?>" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" name="subject" placeholder="Subject" required>
|
<input type="text" class="form-control" name="subject" placeholder="Subject" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea class="form-control tinymce" name="body"
|
<textarea class="form-control tinymce" name="body"
|
||||||
placeholder="Type an email in here"></textarea>
|
placeholder="Type an email in here"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="datetime-local" class="form-control" name="queued_at">
|
||||||
</div>
|
</div>
|
||||||
<input type="datetime-local" class="form-control" name="queued_at">
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<div class="col">
|
||||||
|
|
||||||
<div class="col">
|
<h5>Select Contacts</h5>
|
||||||
|
<hr>
|
||||||
|
<div class="card">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input" id="selectAllCheckbox"
|
||||||
|
onclick="checkAll(this)">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Email</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
<h5>Select Contacts</h5>
|
<?php
|
||||||
<hr>
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
<div class="card">
|
$contact_id = intval($row['contact_id']);
|
||||||
<div class="table-responsive">
|
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||||
<table class="table">
|
$contact_title = nullable_htmlentities($row['contact_title']);
|
||||||
<thead>
|
if (empty($contact_title)) {
|
||||||
<tr>
|
$contact_title_display = "-";
|
||||||
<td>
|
} else {
|
||||||
<div class="form-check">
|
$contact_title_display = "$contact_title";
|
||||||
<input type="checkbox" class="form-check-input" id="selectAllCheckbox"
|
}
|
||||||
onchange="toggleCheckboxes()">
|
$contact_email = nullable_htmlentities($row['contact_email']);
|
||||||
</div>
|
$contact_primary = intval($row['contact_primary']);
|
||||||
</td>
|
$contact_important = intval($row['contact_important']);
|
||||||
<th>Name</th>
|
$contact_billing = intval($row['contact_billing']);
|
||||||
<th>Title</th>
|
$contact_technical = intval($row['contact_technical']);
|
||||||
<th>Email</th>
|
?>
|
||||||
</tr>
|
<tr>
|
||||||
</thead>
|
<td class="pr-0 bg-light">
|
||||||
<tbody>
|
<div class="form-check">
|
||||||
|
<input type="checkbox" class="form-check-input bulk-select" name="contact_ids[]"
|
||||||
|
value="<?php echo $contact_id; ?>">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>"
|
||||||
|
target="_blank">
|
||||||
|
<?php echo $contact_name; ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $contact_title_display; ?></td>
|
||||||
|
<td><?php echo $contact_email; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$contact_id = intval($row['contact_id']);
|
|
||||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
|
||||||
$contact_title = nullable_htmlentities($row['contact_title']);
|
|
||||||
if (empty($contact_title)) {
|
|
||||||
$contact_title_display = "-";
|
|
||||||
} else {
|
|
||||||
$contact_title_display = "$contact_title";
|
|
||||||
}
|
|
||||||
$contact_email = nullable_htmlentities($row['contact_email']);
|
|
||||||
$contact_primary = intval($row['contact_primary']);
|
|
||||||
$contact_important = intval($row['contact_important']);
|
|
||||||
$contact_billing = intval($row['contact_billing']);
|
|
||||||
$contact_technical = intval($row['contact_technical']);
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<div class="form-check">
|
|
||||||
<input type="checkbox" class="form-check-input" name="contact[]"
|
|
||||||
value="<?php echo $contact_id; ?>">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>"
|
|
||||||
target="_blank">
|
|
||||||
<?php echo $contact_name; ?>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $contact_title_display; ?></td>
|
|
||||||
<td><?php echo $contact_email; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php } ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script src="js/bulk_actions.js"></script>
|
||||||
function toggleCheckboxes() {
|
|
||||||
// Get the state of the 'selectAllCheckbox'
|
|
||||||
var selectAllChecked = document.getElementById('selectAllCheckbox').checked;
|
|
||||||
|
|
||||||
// Find all checkboxes with the name 'contact[]' and set their state
|
|
||||||
var checkboxes = document.querySelectorAll('input[type="checkbox"][name="contact[]"]');
|
|
||||||
checkboxes.forEach(function(checkbox) {
|
|
||||||
checkbox.checked = selectAllChecked;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "footer.php";
|
require_once "footer.php";
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
if (isset($_POST['send_bulk_mail_now'])) {
|
if (isset($_POST['send_bulk_mail_now'])) {
|
||||||
|
|
||||||
if ($_POST['contact']) {
|
if ($_POST['contact_ids']) {
|
||||||
|
|
||||||
$mail_from = sanitizeInput($_POST['mail_from']);
|
$mail_from = sanitizeInput($_POST['mail_from']);
|
||||||
$mail_from_name = sanitizeInput($_POST['mail_from_name']);
|
$mail_from_name = sanitizeInput($_POST['mail_from_name']);
|
||||||
|
|
@ -15,7 +15,7 @@ if (isset($_POST['send_bulk_mail_now'])) {
|
||||||
$queued_at = sanitizeInput($_POST['queued_at']);
|
$queued_at = sanitizeInput($_POST['queued_at']);
|
||||||
|
|
||||||
// Add Emails
|
// Add Emails
|
||||||
foreach($_POST['contact'] as $contact_id) {
|
foreach($_POST['contact_ids'] as $contact_id) {
|
||||||
$contact_id = intval($contact_id);
|
$contact_id = intval($contact_id);
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_id = $contact_id");
|
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_id = $contact_id");
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ if (isset($_POST['edit_mail_smtp_settings'])) {
|
||||||
$config_smtp_username = sanitizeInput($_POST['config_smtp_username']);
|
$config_smtp_username = sanitizeInput($_POST['config_smtp_username']);
|
||||||
$config_smtp_password = sanitizeInput($_POST['config_smtp_password']);
|
$config_smtp_password = sanitizeInput($_POST['config_smtp_password']);
|
||||||
|
|
||||||
mysqli_query($mysqli,"UPDATE settings SET config_smtp_host = '$config_smtp_host', config_smtp_port = $config_smtp_port, config_smtp_encryption = '$config_smtp_encryption', config_smtp_username = '$config_smtp_username', config_smtp_password = '$config_smtp_password', config_mail_from_email = '$config_mail_from_email', config_mail_from_name = '$config_mail_from_name' WHERE company_id = 1");
|
mysqli_query($mysqli,"UPDATE settings SET config_smtp_host = '$config_smtp_host', config_smtp_port = $config_smtp_port, config_smtp_encryption = '$config_smtp_encryption', config_smtp_username = '$config_smtp_username', config_smtp_password = '$config_smtp_password' WHERE company_id = 1");
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified SMTP mail settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Settings', log_action = 'Modify', log_description = '$session_name modified SMTP mail settings', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue