mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-17 19:23:27 +02:00
Code clean up + datatables (#64)
* Reformat Code Reformat Code - spaces + tabs * Code cleanup removed duplicated datatables code * Datatables replace spells, monsters tables with JavaScript Sortable Tables (DataTables?)
This commit is contained in:
@@ -10,14 +10,12 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Mailer';
|
||||
|
||||
if(!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin())
|
||||
{
|
||||
if (!hasFlag(FLAG_CONTENT_MAILER) && !superAdmin()) {
|
||||
echo 'Access denied.';
|
||||
return;
|
||||
}
|
||||
|
||||
if(!$config['mail_enabled'])
|
||||
{
|
||||
if (!$config['mail_enabled']) {
|
||||
echo 'Mail support disabled.';
|
||||
return;
|
||||
}
|
||||
@@ -27,11 +25,11 @@ $mail_subject = isset($_POST['mail_subject']) ? stripslashes($_POST['mail_subjec
|
||||
$preview = isset($_REQUEST['preview']);
|
||||
|
||||
$preview_done = false;
|
||||
if($preview) {
|
||||
if(!empty($mail_content) && !empty($mail_subject)) {
|
||||
if ($preview) {
|
||||
if (!empty($mail_content) && !empty($mail_subject)) {
|
||||
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
|
||||
|
||||
if(!$preview_done)
|
||||
if (!$preview_done)
|
||||
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
@@ -43,31 +41,29 @@ $twig->display('admin.mailer.html.twig', array(
|
||||
'preview_done' => $preview_done
|
||||
));
|
||||
|
||||
if(empty($mail_content) || empty($mail_subject) || $preview)
|
||||
if (empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$add = '';
|
||||
if($config['account_mail_verify']) {
|
||||
if ($config['account_mail_verify']) {
|
||||
note('Note: Sending only to users with verified E-Mail.');
|
||||
$add = ' AND ' . $db->fieldName('email_verified') . ' = 1';
|
||||
}
|
||||
|
||||
$query = $db->query('SELECT ' . $db->fieldName('email') . ' FROM ' . $db->tableName('accounts') . ' WHERE ' . $db->fieldName('email') . ' != ""' . $add);
|
||||
foreach($query as $email)
|
||||
{
|
||||
if(_mail($email['email'], $mail_subject, $mail_content))
|
||||
foreach ($query as $email) {
|
||||
if (_mail($email['email'], $mail_subject, $mail_content))
|
||||
$success++;
|
||||
else
|
||||
{
|
||||
else {
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. Error: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
success('Mailing finished.');
|
||||
success("$success emails delivered.");
|
||||
warning("$failed emails failed.");
|
||||
|
Reference in New Issue
Block a user