summaryrefslogtreecommitdiff
path: root/pages/news.php
blob: 9d2f857b5e16fc28e5cb761ec7e50dd3dba72403 (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
56
57
58
<div class="header">
  <div class="header_news">
    <div class="header_text">News</div>
  </div>
</div>
<a href="rss.xml" class="rss"></a>
<a href="rss.xml" class="rsstitle">Syndicate</a>
<?php

include_once($UTIL_DIR . "/newsletter.php");

if($action == "subscribe") {

	$regexp = "^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$";

	if($email != "your@email.here" &&
		 ereg($regexp, $email, $regs)) {
		$mailinglist = new Mailinglist($DATA_DIR . "/mailinglist.xml");
		$mailinglist->subscribe($email);
		echo "<p>You have now been subscribed to the DIE newsletter...</p>\n";
	} else {
		echo "<p><strong><em>" . $email . "</em> is not a valid email address...</strong></p>\n";
	}
}

if($action == "unsubscribe") {
	$mailinglist = new Mailinglist($DATA_DIR . "/mailinglist.xml");
	$mailinglist->unsubscribe($email);
	echo "<p>You have now been unsubscribed from the DIE newsletter...</p>\n";
}

?>
<div class="news_form">
<form action="?page=news&amp;action=subscribe" method="post">
<p style="text-align: center;">
Subscribe to low-traffic mailinglist:<br/>
Email: <input name="email" value="your@email.here"/>
<button type="submit">Subscribe</button>
</p>
</form>
</div>
<?php
include_once($UTIL_DIR."/news.php");

$news = new News($DATA_DIR."/news.xml");

if($show == "all") {
	$news->show(-1, "all");
} else {
	$news->show(4, "main");
?>

<div class="more">
<a href="?page=news&amp;show=all">more &gt;&gt;</a>
</div>
<?php
}
?>