|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright https://yawik.org/COPYRIGHT.php |
|
7
|
|
|
* @author cbleek |
|
8
|
|
|
* @author Miroslav Fedeleš <[email protected]> |
|
9
|
|
|
* @license MIT |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Applications\Options; |
|
13
|
|
|
|
|
14
|
|
|
use Laminas\Stdlib\AbstractOptions; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ModuleOptions |
|
18
|
|
|
* |
|
19
|
|
|
* Default options of the Applications Module |
|
20
|
|
|
* |
|
21
|
|
|
* @package Applications\Options |
|
22
|
|
|
*/ |
|
23
|
|
|
class ModuleOptions extends AbstractOptions |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* maximum size in bytes of an attachment. Default 5MB |
|
28
|
|
|
* |
|
29
|
|
|
* @var int $attachmentsMaxSize |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $attachmentsMaxSize = 5000000; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* valid Mime-Types of attachments |
|
35
|
|
|
* |
|
36
|
|
|
* @var array $attachmentsMimeType |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $attachmentsMimeType = array( |
|
39
|
|
|
'image', |
|
40
|
|
|
'application/pdf', |
|
41
|
|
|
'applications/pdf', |
|
42
|
|
|
'application/x-pdf', |
|
43
|
|
|
'application/acrobat', |
|
44
|
|
|
'applications/vnd.pdf', |
|
45
|
|
|
'text/pdf', |
|
46
|
|
|
'text/x-pdf' |
|
47
|
|
|
); |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* maximum number of attachments. Default 3 |
|
51
|
|
|
* |
|
52
|
|
|
* @var int $attachmentsCount |
|
53
|
|
|
*/ |
|
54
|
|
|
protected $attachmentsCount = 3; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* maximum size of an user image. Default 200 kB |
|
58
|
|
|
* |
|
59
|
|
|
* @var int $contactImageMaxSize |
|
60
|
|
|
*/ |
|
61
|
|
|
protected $contactImageMaxSize = 200000; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* allowed Mime-Type of a user image |
|
65
|
|
|
* |
|
66
|
|
|
* @var array $contactImageMimeType |
|
67
|
|
|
*/ |
|
68
|
|
|
protected $contactImageMimeType = array('image'); |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Generally allowed Mime Types |
|
72
|
|
|
* |
|
73
|
|
|
* @var array $allowedMimeTypes |
|
74
|
|
|
*/ |
|
75
|
|
|
protected $allowedMimeTypes = array('image', |
|
76
|
|
|
'applications/pdf', |
|
77
|
|
|
'application/x-pdf', |
|
78
|
|
|
'application/acrobat', |
|
79
|
|
|
'applications/vnd.pdf', |
|
80
|
|
|
'text/pdf', |
|
81
|
|
|
'text/x-pdf', |
|
82
|
|
|
'text'); |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
protected $workflow = [ |
|
86
|
|
|
|
|
87
|
|
|
'recruiter', |
|
88
|
|
|
]; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Flag indicating whether subsequent attachment uploads are allowed |
|
92
|
|
|
* |
|
93
|
|
|
* @var bool |
|
94
|
|
|
*/ |
|
95
|
|
|
protected $allowSubsequentAttachmentUpload = false; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @var int |
|
99
|
|
|
*/ |
|
100
|
|
|
protected $delayApplicantRejectMail = 0; |
|
101
|
|
|
|
|
102
|
3 |
|
/** |
|
103
|
|
|
* Gets the maximum size of attachments in bytes |
|
104
|
3 |
|
* |
|
105
|
|
|
* @return int |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getAttachmentsMaxSize() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->attachmentsMaxSize; |
|
110
|
|
|
} |
|
111
|
|
|
/** |
|
112
|
2 |
|
* Sets the maximum size of attachments in bytes |
|
113
|
|
|
* |
|
114
|
2 |
|
* @param int $size |
|
115
|
2 |
|
* @return ModuleOptions |
|
116
|
|
|
*/ |
|
117
|
|
|
public function setAttachmentsMaxSize($size) |
|
118
|
|
|
{ |
|
119
|
|
|
$this->attachmentsMaxSize = $size; |
|
120
|
|
|
return $this; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
1 |
|
/** |
|
124
|
|
|
* Gets the the allowed Mime-Types for attachments |
|
125
|
1 |
|
* |
|
126
|
|
|
* @return array |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getAttachmentsMimeType() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->attachmentsMimeType; |
|
131
|
|
|
} |
|
132
|
|
|
/** |
|
133
|
1 |
|
* Sets the maximum size of attachments in bytes |
|
134
|
|
|
* |
|
135
|
1 |
|
* @param array $mime |
|
136
|
1 |
|
* @return ModuleOptions |
|
137
|
|
|
*/ |
|
138
|
|
|
public function setAttachmentsMimeType(array $mime) |
|
139
|
|
|
{ |
|
140
|
|
|
$this->attachmentsMimeType = $mime; |
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
1 |
|
/** |
|
145
|
|
|
* Gets the the maximum number of allowed attachments |
|
146
|
1 |
|
* |
|
147
|
|
|
* @return string |
|
148
|
|
|
*/ |
|
149
|
|
|
public function getAttachmentsCount() |
|
150
|
|
|
{ |
|
151
|
|
|
return $this->attachmentsCount; |
|
152
|
|
|
} |
|
153
|
|
|
/** |
|
154
|
1 |
|
* Sets the maximum number of allowed attachments |
|
155
|
|
|
* |
|
156
|
1 |
|
* @param string $number |
|
157
|
1 |
|
* @return ModuleOptions |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setAttachmentsCount($number) |
|
160
|
|
|
{ |
|
161
|
|
|
$this->attachmentsCount = $number; |
|
|
|
|
|
|
162
|
|
|
return $this; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
2 |
|
/** |
|
166
|
|
|
* Gets the the maximum size of contact images in bytes |
|
167
|
2 |
|
* |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getContactImageMaxSize() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->contactImageMaxSize; |
|
173
|
|
|
} |
|
174
|
|
|
/** |
|
175
|
1 |
|
* Sets the maximum size of contact images in bytes |
|
176
|
|
|
* |
|
177
|
1 |
|
* @param string $size |
|
178
|
1 |
|
* @return ModuleOptions |
|
179
|
|
|
*/ |
|
180
|
|
|
public function setContactImageMaxSize($size) |
|
181
|
|
|
{ |
|
182
|
|
|
$this->contactImageMaxSize = $size; |
|
|
|
|
|
|
183
|
|
|
return $this; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
2 |
|
/** |
|
187
|
|
|
* Gets the allowed Mime-Types for contact images |
|
188
|
2 |
|
* |
|
189
|
|
|
* @return array |
|
190
|
|
|
*/ |
|
191
|
|
|
public function getContactImageMimeType() |
|
192
|
|
|
{ |
|
193
|
|
|
return $this->contactImageMimeType; |
|
194
|
|
|
} |
|
195
|
|
|
/** |
|
196
|
1 |
|
* Sets the allowed Mime-Types for contact images |
|
197
|
|
|
* |
|
198
|
1 |
|
* @param array $mime |
|
199
|
1 |
|
* @return ModuleOptions |
|
200
|
|
|
*/ |
|
201
|
|
|
public function setContactImageMimeType($mime) |
|
202
|
|
|
{ |
|
203
|
|
|
$this->contactImageMimeType = $mime; |
|
204
|
|
|
return $this; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
1 |
|
/** |
|
208
|
|
|
* Gets the allowed Mime-Types for contact images |
|
209
|
1 |
|
* |
|
210
|
|
|
* @return string |
|
211
|
|
|
*/ |
|
212
|
|
|
public function getAllowedMimeTypes() |
|
213
|
|
|
{ |
|
214
|
|
|
return $this->allowedMimeTypes; |
|
|
|
|
|
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
/** |
|
218
|
1 |
|
* Sets the allowed Mime-Types |
|
219
|
|
|
* |
|
220
|
1 |
|
* @param array $array |
|
221
|
1 |
|
* @return ModuleOptions |
|
222
|
|
|
*/ |
|
223
|
|
|
public function setAllowedMimeTypes($array) |
|
224
|
|
|
{ |
|
225
|
|
|
$this->allowedMimeTypes = $array; |
|
226
|
|
|
return $this; |
|
227
|
|
|
} |
|
228
|
1 |
|
|
|
229
|
|
|
/** |
|
230
|
1 |
|
* @return boolean |
|
231
|
|
|
* @since 0.27 |
|
232
|
|
|
*/ |
|
233
|
|
|
public function getAllowSubsequentAttachmentUpload() |
|
234
|
|
|
{ |
|
235
|
|
|
return $this->allowSubsequentAttachmentUpload; |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
1 |
|
/** |
|
239
|
|
|
* @param boolean $allowSubsequentAttachmentUpload |
|
240
|
1 |
|
* @return ModuleOptions |
|
241
|
|
|
* @since 0.27 |
|
242
|
1 |
|
*/ |
|
243
|
|
|
public function setAllowSubsequentAttachmentUpload($allowSubsequentAttachmentUpload) |
|
244
|
|
|
{ |
|
245
|
|
|
$this->allowSubsequentAttachmentUpload = (bool)$allowSubsequentAttachmentUpload; |
|
246
|
|
|
|
|
247
|
|
|
return $this; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* Get delayApplicantRejectMail |
|
252
|
|
|
* |
|
253
|
|
|
* @return int |
|
254
|
|
|
*/ |
|
255
|
|
|
public function getDelayApplicantRejectMail(): int |
|
256
|
|
|
{ |
|
257
|
|
|
return $this->delayApplicantRejectMail; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* Set the delay in seconds to wait before send the rejection mail. |
|
262
|
|
|
* |
|
263
|
|
|
* @param int $delayApplicantRejectMail |
|
264
|
|
|
*/ |
|
265
|
|
|
public function setDelayApplicantRejectMail(int $delayApplicantRejectMail): void |
|
266
|
|
|
{ |
|
267
|
|
|
$this->delayApplicantRejectMail = $delayApplicantRejectMail; |
|
268
|
|
|
} |
|
269
|
|
|
} |
|
270
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.