-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.inc.php
92 lines (63 loc) · 1.99 KB
/
utilities.inc.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
interface iBase {
public function __construct();
public function debugMode($switch);
}
interface iPreset {
public function eMailHeader($header);
public function send();
}
interface iRequest {
public function method($method);
public function recipient($recipient);
public function confirm($suc, $fail);
public function getName();
}
interface iNews {
public function __construct();
public function eMailDB($servername, $username, $password, $database);
public function signature($sig);
}
trait Fields {
protected
$fields = array(
"subject" => null, "content" => null, // email input
"title" => null, "name" => null, // names
"firstname" => null, "middlename" => null,
"lastname" => null,
"birth" => null, // birth
"address" => null, "location" => null, // location
"country" => null, "zip" => null,
"bic" => null,
"phone" => null, "mobile" => null, // contact
"fax" => null, "email" => null,
"company" => null, "website" => null, // socials
"facebook" => null, "twitter" => null
);
}
trait Debugger {
protected $debug = "off";
public function debugMode($switch) {
switch ($switch) {
case "on" :
$this->debug = $switch;
$this->msg(2, "debugMode is on."); break;
case "off": $this->debug = $switch; break;
default : echo "<span style=\"color:red\">[ERROR] </span>: Unknown parameter > ".$switch;
}
}
protected function msg($const, $msg) {
if ($this->debug == "on") {
$mask = function($kind, $col) use ($msg) {
echo "<span style='color:".$col."'>".$kind."</span>".$msg."<br>";
};
switch ($const) {
case 0: $mask("[ERROR] ", "red", $msg); break;
case 1: $mask("[SUCCESS] ", "yellow", $msg); break;
case 2: $mask("[NOTICE] ", "lightblue", $msg); break;
case 3: $mask("[DEBUG] ", "lightblue", $msg); break;
}
}
}
}
?>