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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
<?php
/**
<?xml version="1.0" encoding="UTF-8"?>
<mailinglist>
<email name="HeavyMetal.dk" url="http://www.heavymetal.dk/" email="info@heavymetal.dk"/>
<email name="Blabbermouth.net" url="http://www.blabbermouth.net" email="bmouth@bellatlantic.net"/>
<email name="Power Metal.dk" url="http://www.powermetal.dk/" email="kenn@powermetal.dk"/>
<email name="Revolution Music" url="http://www.revolution-music.dk" email="heavybear@revolution-music.dk "/>
<email name="Antenna" url="http://www.antenna.nu" email="lolk@antenna.nu"/>
<email name="Supreme Brutality" url="http://www.supremebrutality.net" email="contact@supremebrutality.net"/>
<email name="Vampire Magazine" url="http://www.vampire-magazine.com" email="Ricardo@vampire-magazine.com"/>
<email name="Danish Metal" url="http://www.danishmetal.dk" email="martin@danishmetal.dk"/>
<email name="Revelationz" url="http://www.revelationz.net" email="mail@revelationz.net"/>
</mailinglist>
**/
/**
* CONFIG
*/
$subject_prefix = "DIE Pressrelease";
$sender = "DIE <info@executionroom.com>";
$replyto = $sender;
$footer = "
Stay Brutal!
// DIE
http://www.executionroom.com
info@executionroom.com
";
class Email {
public $name;
public $url;
public $email;
public function Email($name, $url, $email)
{
$this->name = $name;
$this->url = $url;
$this->email = $email;
}
function send($subject, $message) {
global $subject_prefix;
global $sender;
global $replyto;
global $footer;
$message .= $footer;
$headers = "From: " . $sender . "\r\n";
$headers .= "Reply-To: " . $replyto . "\r\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$subject = "[".$subject_prefix."] " . $subject;
$ret = mail($this->email, $subject, $message, $headers);
if(!$ret) echo "Fail(".$this->email.")";
//usleep(100000);
}
}
class PressRelease {
private $file;
private $mailinglist = array();
public function add($email) {
$key = $email->email;
$this->mailinglist[$key] = $email;
}
public function remove($email) {
if(array_key_exists($email, $this->mailinglist)) {
unset($this->mailinglist[$email]);
}
}
public function write()
{
/*
$fp = fopen($this->file, "w");
fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fwrite($fp, "<mailinglist>\n");
foreach($this->mailinglist as $email) {
fwrite($fp, " <email email=\"" .
htmlspecialchars($email->email, ENT_QUOTES, "UTF-8") . "\"\n");
fwrite($fp, " timestamp=\"" . $email->timestamp . "\">\n");
fwrite($fp, " </email>\n");
}
fwrite($fp, "</mailinglist>\n");
fclose($fp);
*/
}
private function read()
{
$dom = new DomDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->load($this->file);
$params = $dom->getElementsByTagName('email');
foreach ($params as $param) {
$email = new Email($param->getAttribute('name'),
$param->getAttribute('url'),
$param->getAttribute('email'));
$this->add($email);
}
}
/*
public function subscribe($email)
{
$email = new EMail($email, time());
$this->add($email);
$this->write();
}
public function unsubscribe($email)
{
$this->remove($email);
$this->write();
}
*/
public function post($subject, $message)
{
$sz = sizeof($this->mailinglist);
echo "<div style=\"text-align: center; padding-top: 120px; padding-bottom: 100px; position: absolute; top: 25%; left: 0px; width: 99.4%; height: 150px; border: solid #0000ff 3px; background: #fff; color: #000;\">Sending ". $sz ." mails <br/>\n<";
ob_flush();
flush();
$num = 0;
$lvl = 0;
$steps = floor($sz / 10) + 1;
foreach($this->mailinglist as $email) {
$email->send($subject, $message);
$pct = $num / $sz * 100;
if($pct >= $lvl) {
printf("<font style=\"font-size: 9px;\">%.0f%%</font>", $lvl);
$lvl += 100/$steps;
} else {
echo ".";
}
ob_flush();
flush();
$num++;
}
echo "<font style=\"font-size: 9px;\">[100%]</font>>\n<br/>done<br/>\n";
echo "<a style=\"font-size: 20px; font-weight: bold;\" href=\"?page=admin&module=pressrelease\">[CLOSE]</a>";
echo "</div>\n";
ob_flush();
flush();
}
public function PressRelease($file)
{
$this->file = $file;
$this->read();
}
}
?>
|