From 9f20c90c320140dbcaa9acfa6a58fea3e40f6806 Mon Sep 17 00:00:00 2001 From: arf20 Date: Sun, 28 Apr 2024 04:30:56 +0200 Subject: [PATCH] Add PHP script for mailing list announcement --- admin.php | 1 + config.php.example | 2 + publishannouncement.php | 95 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 publishannouncement.php diff --git a/admin.php b/admin.php index b0b37c3..55d5870 100644 --- a/admin.php +++ b/admin.php @@ -161,6 +161,7 @@ function getorderbyid($id) {

Manage orders

Manage tickets

Manage invoices

+

Publish announcement

diff --git a/config.php.example b/config.php.example index b476a5d..ef5d0d1 100644 --- a/config.php.example +++ b/config.php.example @@ -13,6 +13,8 @@ define('MAIL_USER', 'user'); define('MAIL_PASSWORD', 'password'); define('MAIL_FROM', 'system@example.com'); +define('MAIL_ANNOUNCE_ADDRESS', 'announce@example.com'); + define('DOMAIN', 'dash.example.com'); /* Attempt to connect to MySQL database */ diff --git a/publishannouncement.php b/publishannouncement.php new file mode 100644 index 0000000..76c934a --- /dev/null +++ b/publishannouncement.php @@ -0,0 +1,95 @@ +fetch_all(MYSQLI_ASSOC); + +/* + * Announce to + * - mailing list (hereby the announcement archive at lists.arf20.com) + * - discord webhook + * - irc (bridged) announcement notice + * - NNTP? + * - phpBB? + * - another, custom, archive ARFNET-ly + */ + +// POST actions +if ($_SERVER["REQUEST_METHOD"] == "POST") { + /* Send email */ + $mailer->addAddress(MAIL_ANNOUNCE_ADDRESS); + $mailer->addReplyTo(getuserbyid($id)["email"]); + $mailer->Subject = "[ARFNET Announcement] ".$_POST["subject"]; + $mailer->Body = $_POST["body"]; + + if (!$mailer->send()) { + echo 'Mailer Error [ask arf20]: ' . $mailer->ErrorInfo; + } else header("location: ".$_SERVER['SCRIPT_NAME']); +} + + +function getuserbyid($id) { + global $users; + foreach ($users as $user) { + if ($user["id"] == $id) { + return $user; + } + } +} + +?> + + + + + + + ARFNET CSTIMS + + +
+ ARFNET +
+
+
+
+
+

ARFNET Client Service Ticket and Invoice Management System

+

panel

+

Publish announcement

+
" method="post"> +
+
+

+
+
+
+
+
+

Logged as

+

Logout

+

Back to admin panel

+
+
+
+ + +