mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
* some changes
* moved some admin html code from php to twig templates (.html files) * minimum PHP version required by installer is now 5.1.2, cause of spl_autoload_register functon. * depracated Twig to version 1.20.0 cause of Autoloader * removed unused admin stylish template
This commit is contained in:
@@ -29,82 +29,43 @@ $preview = isset($_REQUEST['preview']);
|
||||
|
||||
$preview_done = false;
|
||||
if($preview) {
|
||||
if(!empty($mail_content) && !empty($mail_subject))
|
||||
if(!empty($mail_content) && !empty($mail_subject)) {
|
||||
$preview_done = _mail($account_logged->getCustomField('email'), $mail_subject, $mail_content);
|
||||
|
||||
if(!$preview_done)
|
||||
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
|
||||
|
||||
if(!$preview_done)
|
||||
error('Error while sending preview mail: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "advanced",
|
||||
plugins: "safari,advimage,emotions,insertdatetime,preview,wordcount",
|
||||
|
||||
relative_urls : false,
|
||||
remove_script_host : false,
|
||||
document_base_url : "<?php echo BASE_URL; ?>",
|
||||
echo $twig->render('admin.mailer.html', array(
|
||||
'mail_subject' => $mail_subject,
|
||||
'mail_content' => $mail_content,
|
||||
'preview_done' => $preview_done
|
||||
));
|
||||
|
||||
theme_advanced_buttons3_add : "emotions,insertdate,inserttime,preview,|,forecolor,backcolor",
|
||||
if(empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
theme_advanced_resizing : true,
|
||||
});
|
||||
</script>
|
||||
<table width="800" cellspacing="1" cellpadding="2" border="0" align="center">
|
||||
<form method="post">
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<p class="note note-image" style="width: 80%;">Sending mails may take some time if there are much users in db.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="mail_subject">Subject:</label>
|
||||
</td>
|
||||
<td align="left">
|
||||
<input type="text" id="mail_subject" name="mail_subject" value="<?php echo $mail_subject; ?>" size="30" maxlength="30" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<textarea id="mail_content" name="mail_content" style="width: 100%" class="tinymce"><?php echo $mail_content; ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<input type="checkbox" name="preview" id="preview" value="1"/><label for="preview">Just send test email to me (preview)</label><?php echo ($preview_done ? ' - <b>Done.</b>' : ''); ?><br/><input type="submit" name="submit" value="Send" />
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<?php
|
||||
if(empty($mail_content) || empty($mail_subject) || $preview)
|
||||
return;
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
|
||||
$success = 0;
|
||||
$failed = 0;
|
||||
$add = '';
|
||||
if($config['account_mail_verify'])
|
||||
$add = ' AND ' . $db->fieldName('email_verified') . ' = 1';
|
||||
|
||||
$add = '';
|
||||
if($config['account_mail_verify'])
|
||||
$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)
|
||||
$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))
|
||||
$success++;
|
||||
else
|
||||
{
|
||||
if(_mail($email['email'], $mail_subject, $mail_content))
|
||||
$success++;
|
||||
else
|
||||
{
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. Error: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
$failed++;
|
||||
echo '<br />';
|
||||
error('An error occorred while sending email to <b>' . $email['email'] . '</b>. Error: ' . $mailer->ErrorInfo);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Mailing finished.<br/>
|
||||
<p class="success"><?php echo $success; ?> emails delivered.</p><br/>
|
||||
|
Reference in New Issue
Block a user