Complete rewrite of and , wrapper functions added, see bug #101
[mailer.git] / inc / modules / admin / what-send_newsletter.php
index f18caeab52bc8b1655e30476b0564937543ee700..98f17236698cf97f61604f1310d12c7f52789287 100644 (file)
@@ -40,7 +40,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (isset($_POST['ok'])) {
+if (IS_FORM_SENT()) {
        $result = SQL_QUERY("SELECT userid, email
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE `status`='CONFIRMED' AND nl_receive='Y'
@@ -52,22 +52,22 @@ ORDER BY userid ASC", __FILE__, __LINE__);
                        $template = "newsletter";
 
                        // Check for extension and sending-mode
-                       if (!EXT_IS_ACTIVE("html_mail", true) && ($_POST['mode'] == "html")) {
+                       if (!EXT_IS_ACTIVE("html_mail", true) && (REQUEST_POST('mode') == "html")) {
                                // Set mode to text mode
-                               $_POST['mode'] == "text";
-                       } elseif ($_POST['mode'] == "html") {
+                               REQUEST_POST('mode') == "text";
+                       } elseif (REQUEST_POST('mode') == "html") {
                                // Set HTML templates
                                $template = "newsletter_html";
                        }
 
                        // Compile message
-                       $_POST['text'] = COMPILE_CODE($_POST['text']);
+                       REQUEST_SET_POST('text', COMPILE_CODE(REQUEST_POST('text')));
 
                        // Load template
-                       $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => $_POST['text']), $id);
+                       $msg = LOAD_EMAIL_TEMPLATE($template, array('text' => REQUEST_POST('text')), $id);
 
                        // ... and send it away!
-                       SEND_NEWSLETTER($email, $_POST['subject'], $msg, $_POST['mode']);
+                       SEND_NEWSLETTER($email, REQUEST_POST('subject'), $msg, REQUEST_POST('mode'));
                }
 
                // Free memory