summaryrefslogtreecommitdiff
path: root/utils/admin_newsletter.php
blob: 29275ab6b493322996a2d9705b12743b222a5d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<h2>Newsletter</h2>
<?php
include_once($UTIL_DIR . "/newsletter.php");
include_once($UTIL_DIR . "/convert.php");

if($task == "confirm") {
	$testmail = new Email($testaddr, time());
	$testmail->send(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message)));
	echo "A testmail has been sent to " . $testaddr . ". Check this email to berify the correctness of the contents.";

?>
Is the newsmail correct?<br/>
<form method="post" action="?page=admin&amp;module=newsletter&amp;task=send">
  <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/>
  <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/>
  <input name="message" type="hidden" value="<?php echo convert($message) ?>"/>
  <button type="submit">Yes</button>
</form>
<form method="post" action="?page=admin&amp;module=newsletter">
  <input name="testaddr" type="hidden" value="<?php echo convert($testaddr) ?>"/>
  <input name="subject" type="hidden" value="<?php echo convert($subject) ?>"/>
  <input name="message" type="hidden" value="<?php echo convert($message) ?>"/>
  <button type="submit">No</button>
</form>
<?php
	$subject = "";
  $message = ""; 
}
?>

<?php
if($task == "send") {
	$list = new Mailinglist($DATA_DIR . "/mailinglist.xml");
	$list->post(utf8_decode(stripslashes($subject)), utf8_decode(stripslashes($message)));
}
?>

<div class="small_header">Post newsletter</div>
<form method="post" action="?page=admin&amp;module=newsletter&amp;task=confirm">
  <p>
    Test address:
    <input name="testaddr" value="<?php echo convert($testaddr) ?>"/>
  </p>
  <p>
    Subject:
    <input name="subject" value="<?php echo convert($subject) ?>"/>
  </p>
  <p>
    Message:<br/>
    <textarea name="message"><?php echo convert($message) ?></textarea>
  </p>
  <p>
    <button type="submit">Post news</button>
  </p>
</form>