-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreset.class.php
73 lines (64 loc) · 1.88 KB
/
preset.class.php
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
<?php
abstract class Preset extends eMM implements iPreset {
public function eMailHeader($header) {
$this->m_header = $header."\r\n";
}
protected function assignData($method, $debugMsg) {
if (isset($_POST["send"])) {
if ($this->method[$method]) {
foreach ($this->inputFields() as $field => $name) {
foreach (array_keys($this->fields) as $same) {
if ($name == $same) {
$this->fields[$name] = $this->send->$name;
}
}
}
if ($this->debug == "on") {
$this->msg(3, $debugMsg);
foreach ($this->inputFields() as $field) {
echo $field."<br>";
}
}
$this->message = $this->assign();
} else {
$this->msg(0, __METHOD__.": No method is set.");
}
} else {
$this->msg(0, __METHOD__.": No data received.");
}
}
public function send() {
$errMsg = function($prop) {
$this->msg(0, __METHOD__.": ".$prop." currently not set.");
echo "Error - Could not send Email: '".$prop."' is not defined.<br>";
};
if (isset($_POST["send"])) {
if ($this->debug == "on") {
$this->msg(3, "Total Input Fields:");
echo "<pre>";
print_r($this->fields);
echo "</pre>";
}
if (count($this->inputFields()) != 0) {
if (!is_null($this->fields["subject"]) && !is_null($this->message)) {
if (!is_null($this->recipient) || !is_null($this->customers)) {
$this->setMail();
} elseif (is_null($this->recipient)) {
$errMsg("Recipient");
} elseif (is_null($this->customers)) {
$errMsg("Users");
}
} elseif (is_null($this->fields["subject"])) {
$errMsg("Subject");
} elseif (is_null($this->message)) {
$errMsg("Message");
}
}
} else {
$this->msg(0, __METHOD__.": No data received.");
}
}
abstract protected function assign();
abstract protected function setMail();
}
?>