1: <?php
2:
3: namespace webfilesframework\core\datastore\types\mail;
4:
5: use webfilesframework\core\datasystem\file\format\MWebfile;
6:
7: /**
8: * Representation of a mail used in the imap datastore.
9: *
10: * @author Sebastian Monzel < mail@sebastianmonzel.de >
11: * @since 0.1.7
12: */
13: class MMail extends MWebfile
14: {
15:
16: private $m_sFrom;
17: private $m_sTo;
18:
19: private $m_dDate;
20:
21: private $m_sSubject;
22: private $m_lMessage;
23:
24: private $m_bIsAnswered;
25: private $m_bIsDeleted;
26: private $m_bIsSeen;
27: private $m_bIsDraft;
28:
29: public function __construct()
30: {
31:
32: }
33:
34: public static function isMailAddressValid($p_sEmail)
35: {
36: return (preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $p_sEmail));
37: }
38:
39: public function getTime()
40: {
41: return $this->m_dDate;
42: }
43:
44: public function getGeograficPosition()
45: {
46: return NULL;
47: }
48:
49: public function getFrom()
50: {
51: return $this->m_sFrom;
52: }
53:
54: public function setFrom($from)
55: {
56: $this->m_sFrom = $from;
57: }
58:
59: public function getTo()
60: {
61: return $this->m_sTo;
62: }
63:
64: public function setTo($to)
65: {
66: $this->m_sTo = $to;
67: }
68:
69: public function getDate()
70: {
71: return $this->m_dDate;
72: }
73:
74: public function setDate($date)
75: {
76: $this->m_dDate = $date;
77: }
78:
79: public function getSubject()
80: {
81: return $this->m_sSubject;
82: }
83:
84: public function setSubject($subject)
85: {
86: $this->m_sSubject = $subject;
87: }
88:
89: public function getMessage()
90: {
91: return $this->m_lMessage;
92: }
93:
94: public function setMessage($message)
95: {
96: $this->m_lMessage = $message;
97: }
98:
99: /**
100: * @return bool
101: */
102: public function isAnswered()
103: {
104: return $this->m_bIsAnswered;
105: }
106:
107: /**
108: * @param bool $answered
109: */
110: public function setAnswered($answered)
111: {
112: $this->m_bIsAnswered = $answered;
113: }
114:
115: /**
116: * @return bool
117: */
118: public function isDeleted()
119: {
120: return $this->m_bIsDeleted;
121: }
122:
123: /**
124: * @param bool $deleted
125: */
126: public function setDeleted($deleted)
127: {
128: $this->m_bIsDeleted = $deleted;
129: }
130:
131: /**
132: * @return bool
133: */
134: public function isSeen()
135: {
136: return $this->m_bIsSeen;
137: }
138:
139: /**
140: * @param mixed $seen
141: */
142: public function setSeen($seen)
143: {
144: $this->m_bIsSeen = $seen;
145: }
146:
147: /**
148: * @return bool
149: */
150: public function isDraft()
151: {
152: return $this->m_bIsDraft;
153: }
154:
155: /**
156: * @param bool $draft
157: */
158: public function setDraft($draft)
159: {
160: $this->m_bIsDraft = $draft;
161: }
162:
163:
164: /**
165: * @return string
166: */
167: public function __toString()
168: {
169: return $this->getDate() . "<br /><b>" . $this->m_sFrom . "</b><br />" . $this->m_sSubject . "<br /><br />
170: <div style=\"text-align:left; width:500px;margin-left: auto ;margin-right: auto ;\">" . $this->getMessage() . "</div>";
171: }
172: }