diff --git a/.gitattributes b/.gitattributes index 60e3063a..5adc456c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,6 +34,7 @@ bureau/admin/adm_donosu.php -text bureau/admin/adm_dorenew.php -text bureau/admin/adm_dosu.php -text bureau/admin/adm_edit.php -text +bureau/admin/adm_email.php -text bureau/admin/adm_list.php -text bureau/admin/adm_login.php -text bureau/admin/adm_mxaccount.php -text diff --git a/bureau/admin/adm_email.php b/bureau/admin/adm_email.php new file mode 100644 index 00000000..e542422c --- /dev/null +++ b/bureau/admin/adm_email.php @@ -0,0 +1,88 @@ +enabled) { + __("This page is restricted to authorized staff"); + exit(); +} + +$fields = array ( + "subject" => array ("post", "string", ""), + "message" => array ("post", "string", ""), + "from" => array ("post", "string", ""), + "submit" => array ("post", "string", ""), +); +getFields($fields); + +?> + + +

+mailallmembers($subject,$message,$from)) { + $error=_("The email was successfully sent"); + } else { + $error=_("There was an error"); + } +} + +if (isset($error) && $error) { + echo "

$error

"; +} + +?> +
+ + + + + + + + + + + + + + + +
" />
+ +
" name="submit" />
+ +
+ + diff --git a/bureau/admin/adm_panel.php b/bureau/admin/adm_panel.php index af5bc5e8..bdb4bb06 100644 --- a/bureau/admin/adm_panel.php +++ b/bureau/admin/adm_panel.php @@ -53,6 +53,7 @@ if (isset($error) && $error) {
  • +
  • diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index f1a79f18..386bac50 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -216,6 +216,37 @@ class m_admin { } + function mailallmembers($subject,$message,$from) { + global $err,$mem,$cuid,$db; + $err->log("admin","mailallmembers"); + if (!$this->enabled) { + $err->raise("admin",1); + return false; + } + $subject=trim($subject); + $message=trim($message); + $from=trim($from); + + if (empty($subject) || empty($message) || empty($from) ){ + $err->raise("admin",16); + return false; + } + + if (checkmail($from) != 0) { + $err->raise("admin",17); + return false; + } + + @set_time_limit(1200); + $db->query("select distinct mail from membres;"); + while ($db->next_record()) { + // Can't do BCC due to postfix limitation + mail($db->f('mail'), $subject, $message, null, "-f$from"); + } + + return true; + } + /** * Returns an array with the known information about resellers (uid, login, number of accounts) * Does not include account 2000 in the list.