@@ -21,176 +21,176 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class EmailTemplate extends DataObject |
23 | 23 | { |
24 | - /** Note, also used in template-table.tpl */ |
|
25 | - const CREATED = "created"; |
|
26 | - /** Note, also used in template-table.tpl */ |
|
27 | - const NOT_CREATED = "not created"; |
|
28 | - /** Note, also used in template-table.tpl */ |
|
29 | - const NONE = null; |
|
30 | - /** @var string the name of the template */ |
|
31 | - private $name; |
|
32 | - private $text; |
|
33 | - /** @var string|null */ |
|
34 | - private $jsquestion; |
|
35 | - private $active = 1; |
|
36 | - private $preloadonly = 0; |
|
37 | - private $defaultaction = self::NOT_CREATED; |
|
38 | - |
|
39 | - /** |
|
40 | - * Gets active non-preload templates |
|
41 | - * |
|
42 | - * @param string $defaultAction Default action to take (EmailTemplate::CREATED or EmailTemplate::NOT_CREATED) |
|
43 | - * @param PdoDatabase $database |
|
44 | - * |
|
45 | - * @return array|false |
|
46 | - */ |
|
47 | - public static function getActiveTemplates($defaultAction, PdoDatabase $database) |
|
48 | - { |
|
49 | - global $createdid; |
|
50 | - |
|
51 | - $statement = $database->prepare(<<<SQL |
|
24 | + /** Note, also used in template-table.tpl */ |
|
25 | + const CREATED = "created"; |
|
26 | + /** Note, also used in template-table.tpl */ |
|
27 | + const NOT_CREATED = "not created"; |
|
28 | + /** Note, also used in template-table.tpl */ |
|
29 | + const NONE = null; |
|
30 | + /** @var string the name of the template */ |
|
31 | + private $name; |
|
32 | + private $text; |
|
33 | + /** @var string|null */ |
|
34 | + private $jsquestion; |
|
35 | + private $active = 1; |
|
36 | + private $preloadonly = 0; |
|
37 | + private $defaultaction = self::NOT_CREATED; |
|
38 | + |
|
39 | + /** |
|
40 | + * Gets active non-preload templates |
|
41 | + * |
|
42 | + * @param string $defaultAction Default action to take (EmailTemplate::CREATED or EmailTemplate::NOT_CREATED) |
|
43 | + * @param PdoDatabase $database |
|
44 | + * |
|
45 | + * @return array|false |
|
46 | + */ |
|
47 | + public static function getActiveTemplates($defaultAction, PdoDatabase $database) |
|
48 | + { |
|
49 | + global $createdid; |
|
50 | + |
|
51 | + $statement = $database->prepare(<<<SQL |
|
52 | 52 | SELECT * FROM `emailtemplate` |
53 | 53 | WHERE defaultaction = :forcreated AND active = 1 AND preloadonly = 0 AND id != :createdid; |
54 | 54 | SQL |
55 | - ); |
|
56 | - $statement->bindValue(":createdid", $createdid); |
|
57 | - $statement->bindValue(":forcreated", $defaultAction); |
|
58 | - |
|
59 | - $statement->execute(); |
|
60 | - |
|
61 | - $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
62 | - |
|
63 | - /** @var EmailTemplate $t */ |
|
64 | - foreach ($resultObject as $t) { |
|
65 | - $t->setDatabase($database); |
|
66 | - } |
|
67 | - |
|
68 | - return $resultObject; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * Gets active non-preload and preload templates, optionally filtered by the default action. |
|
73 | - * |
|
74 | - * @param null|bool|string $defaultAction Default action to take (EmailTemplate::CREATED, |
|
75 | - * EmailTemplate::NOT_CREATED, or EmailTemplate::NONE), or optionally null to |
|
76 | - * just get everything. |
|
77 | - * @param PdoDatabase $database |
|
78 | - * |
|
79 | - * @return array|false |
|
80 | - */ |
|
81 | - public static function getAllActiveTemplates($defaultAction, PdoDatabase $database) |
|
82 | - { |
|
83 | - $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE defaultaction = :forcreated AND active = 1;"); |
|
84 | - |
|
85 | - if ($defaultAction === false) { |
|
86 | - $statement = $database->prepare( |
|
87 | - "SELECT * FROM `emailtemplate` WHERE defaultaction NOT IN ('created', 'not created') AND active = 1;"); |
|
88 | - } |
|
89 | - |
|
90 | - if ($defaultAction === null) { |
|
91 | - $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE active = 1;"); |
|
92 | - } |
|
93 | - |
|
94 | - $statement->bindValue(":forcreated", $defaultAction); |
|
95 | - |
|
96 | - $statement->execute(); |
|
97 | - |
|
98 | - $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
99 | - |
|
100 | - /** @var EmailTemplate $t */ |
|
101 | - foreach ($resultObject as $t) { |
|
102 | - $t->setDatabase($database); |
|
103 | - } |
|
104 | - |
|
105 | - return $resultObject; |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Gets all the unactive templates |
|
110 | - * |
|
111 | - * @param PdoDatabase $database |
|
112 | - * |
|
113 | - * @return array |
|
114 | - */ |
|
115 | - public static function getAllInactiveTemplates(PdoDatabase $database) |
|
116 | - { |
|
117 | - $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE active = 0;"); |
|
118 | - $statement->execute(); |
|
119 | - |
|
120 | - $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
121 | - |
|
122 | - /** @var EmailTemplate $t */ |
|
123 | - foreach ($resultObject as $t) { |
|
124 | - $t->setDatabase($database); |
|
125 | - } |
|
126 | - |
|
127 | - return $resultObject; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @param string $name |
|
132 | - * @param PdoDatabase $database |
|
133 | - * |
|
134 | - * @return EmailTemplate|false |
|
135 | - */ |
|
136 | - public static function getByName($name, PdoDatabase $database) |
|
137 | - { |
|
138 | - $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE name = :name LIMIT 1;"); |
|
139 | - $statement->bindValue(":name", $name); |
|
140 | - |
|
141 | - $statement->execute(); |
|
142 | - |
|
143 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
144 | - |
|
145 | - if ($resultObject != false) { |
|
146 | - $resultObject->setDatabase($database); |
|
147 | - } |
|
148 | - |
|
149 | - return $resultObject; |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * @return EmailTemplate |
|
154 | - */ |
|
155 | - public static function getDroppedTemplate() |
|
156 | - { |
|
157 | - $t = new EmailTemplate(); |
|
158 | - $t->id = 0; |
|
159 | - $t->active = 1; |
|
160 | - $t->name = 'Dropped'; |
|
161 | - |
|
162 | - return $t; |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @throws Exception |
|
167 | - */ |
|
168 | - public function save() |
|
169 | - { |
|
170 | - if ($this->isNew()) { |
|
171 | - // insert |
|
172 | - $statement = $this->dbObject->prepare(<<<SQL |
|
55 | + ); |
|
56 | + $statement->bindValue(":createdid", $createdid); |
|
57 | + $statement->bindValue(":forcreated", $defaultAction); |
|
58 | + |
|
59 | + $statement->execute(); |
|
60 | + |
|
61 | + $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
62 | + |
|
63 | + /** @var EmailTemplate $t */ |
|
64 | + foreach ($resultObject as $t) { |
|
65 | + $t->setDatabase($database); |
|
66 | + } |
|
67 | + |
|
68 | + return $resultObject; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * Gets active non-preload and preload templates, optionally filtered by the default action. |
|
73 | + * |
|
74 | + * @param null|bool|string $defaultAction Default action to take (EmailTemplate::CREATED, |
|
75 | + * EmailTemplate::NOT_CREATED, or EmailTemplate::NONE), or optionally null to |
|
76 | + * just get everything. |
|
77 | + * @param PdoDatabase $database |
|
78 | + * |
|
79 | + * @return array|false |
|
80 | + */ |
|
81 | + public static function getAllActiveTemplates($defaultAction, PdoDatabase $database) |
|
82 | + { |
|
83 | + $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE defaultaction = :forcreated AND active = 1;"); |
|
84 | + |
|
85 | + if ($defaultAction === false) { |
|
86 | + $statement = $database->prepare( |
|
87 | + "SELECT * FROM `emailtemplate` WHERE defaultaction NOT IN ('created', 'not created') AND active = 1;"); |
|
88 | + } |
|
89 | + |
|
90 | + if ($defaultAction === null) { |
|
91 | + $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE active = 1;"); |
|
92 | + } |
|
93 | + |
|
94 | + $statement->bindValue(":forcreated", $defaultAction); |
|
95 | + |
|
96 | + $statement->execute(); |
|
97 | + |
|
98 | + $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
99 | + |
|
100 | + /** @var EmailTemplate $t */ |
|
101 | + foreach ($resultObject as $t) { |
|
102 | + $t->setDatabase($database); |
|
103 | + } |
|
104 | + |
|
105 | + return $resultObject; |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * Gets all the unactive templates |
|
110 | + * |
|
111 | + * @param PdoDatabase $database |
|
112 | + * |
|
113 | + * @return array |
|
114 | + */ |
|
115 | + public static function getAllInactiveTemplates(PdoDatabase $database) |
|
116 | + { |
|
117 | + $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE active = 0;"); |
|
118 | + $statement->execute(); |
|
119 | + |
|
120 | + $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class()); |
|
121 | + |
|
122 | + /** @var EmailTemplate $t */ |
|
123 | + foreach ($resultObject as $t) { |
|
124 | + $t->setDatabase($database); |
|
125 | + } |
|
126 | + |
|
127 | + return $resultObject; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @param string $name |
|
132 | + * @param PdoDatabase $database |
|
133 | + * |
|
134 | + * @return EmailTemplate|false |
|
135 | + */ |
|
136 | + public static function getByName($name, PdoDatabase $database) |
|
137 | + { |
|
138 | + $statement = $database->prepare("SELECT * FROM `emailtemplate` WHERE name = :name LIMIT 1;"); |
|
139 | + $statement->bindValue(":name", $name); |
|
140 | + |
|
141 | + $statement->execute(); |
|
142 | + |
|
143 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
144 | + |
|
145 | + if ($resultObject != false) { |
|
146 | + $resultObject->setDatabase($database); |
|
147 | + } |
|
148 | + |
|
149 | + return $resultObject; |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * @return EmailTemplate |
|
154 | + */ |
|
155 | + public static function getDroppedTemplate() |
|
156 | + { |
|
157 | + $t = new EmailTemplate(); |
|
158 | + $t->id = 0; |
|
159 | + $t->active = 1; |
|
160 | + $t->name = 'Dropped'; |
|
161 | + |
|
162 | + return $t; |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @throws Exception |
|
167 | + */ |
|
168 | + public function save() |
|
169 | + { |
|
170 | + if ($this->isNew()) { |
|
171 | + // insert |
|
172 | + $statement = $this->dbObject->prepare(<<<SQL |
|
173 | 173 | INSERT INTO `emailtemplate` (name, text, jsquestion, defaultaction, active, preloadonly) |
174 | 174 | VALUES (:name, :text, :jsquestion, :defaultaction, :active, :preloadonly); |
175 | 175 | SQL |
176 | - ); |
|
177 | - $statement->bindValue(":name", $this->name); |
|
178 | - $statement->bindValue(":text", $this->text); |
|
179 | - $statement->bindValue(":jsquestion", $this->jsquestion); |
|
180 | - $statement->bindValue(":defaultaction", $this->defaultaction); |
|
181 | - $statement->bindValue(":active", $this->active); |
|
182 | - $statement->bindValue(":preloadonly", $this->preloadonly); |
|
183 | - |
|
184 | - if ($statement->execute()) { |
|
185 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
186 | - } |
|
187 | - else { |
|
188 | - throw new Exception($statement->errorInfo()); |
|
189 | - } |
|
190 | - } |
|
191 | - else { |
|
192 | - // update |
|
193 | - $statement = $this->dbObject->prepare(<<<SQL |
|
176 | + ); |
|
177 | + $statement->bindValue(":name", $this->name); |
|
178 | + $statement->bindValue(":text", $this->text); |
|
179 | + $statement->bindValue(":jsquestion", $this->jsquestion); |
|
180 | + $statement->bindValue(":defaultaction", $this->defaultaction); |
|
181 | + $statement->bindValue(":active", $this->active); |
|
182 | + $statement->bindValue(":preloadonly", $this->preloadonly); |
|
183 | + |
|
184 | + if ($statement->execute()) { |
|
185 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
186 | + } |
|
187 | + else { |
|
188 | + throw new Exception($statement->errorInfo()); |
|
189 | + } |
|
190 | + } |
|
191 | + else { |
|
192 | + // update |
|
193 | + $statement = $this->dbObject->prepare(<<<SQL |
|
194 | 194 | UPDATE `emailtemplate` |
195 | 195 | SET name = :name, |
196 | 196 | text = :text, |
@@ -202,130 +202,130 @@ discard block |
||
202 | 202 | WHERE id = :id AND updateversion = :updateversion |
203 | 203 | LIMIT 1; |
204 | 204 | SQL |
205 | - ); |
|
206 | - $statement->bindValue(':id', $this->id); |
|
207 | - $statement->bindValue(':updateversion', $this->updateversion); |
|
208 | - |
|
209 | - $statement->bindValue(':name', $this->name); |
|
210 | - $statement->bindValue(":text", $this->text); |
|
211 | - $statement->bindValue(":jsquestion", $this->jsquestion); |
|
212 | - $statement->bindValue(":defaultaction", $this->defaultaction); |
|
213 | - $statement->bindValue(":active", $this->active); |
|
214 | - $statement->bindValue(":preloadonly", $this->preloadonly); |
|
215 | - |
|
216 | - if (!$statement->execute()) { |
|
217 | - throw new Exception($statement->errorInfo()); |
|
218 | - } |
|
219 | - |
|
220 | - if ($statement->rowCount() !== 1) { |
|
221 | - throw new OptimisticLockFailedException(); |
|
222 | - } |
|
223 | - |
|
224 | - $this->updateversion++; |
|
225 | - } |
|
226 | - } |
|
227 | - |
|
228 | - /** |
|
229 | - * Override delete() from DataObject |
|
230 | - */ |
|
231 | - public function delete() |
|
232 | - { |
|
233 | - throw new Exception("You shouldn't be doing that, you'll break logs."); |
|
234 | - } |
|
235 | - |
|
236 | - /** |
|
237 | - * @return string |
|
238 | - */ |
|
239 | - public function getName() |
|
240 | - { |
|
241 | - return $this->name; |
|
242 | - } |
|
243 | - |
|
244 | - /** |
|
245 | - * @param string $name |
|
246 | - */ |
|
247 | - public function setName($name) |
|
248 | - { |
|
249 | - $this->name = $name; |
|
250 | - } |
|
251 | - |
|
252 | - /** |
|
253 | - * @return string |
|
254 | - */ |
|
255 | - public function getText() |
|
256 | - { |
|
257 | - return $this->text; |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
261 | - * @param string $text |
|
262 | - */ |
|
263 | - public function setText($text) |
|
264 | - { |
|
265 | - $this->text = $text; |
|
266 | - } |
|
267 | - |
|
268 | - /** |
|
269 | - * @return string|null |
|
270 | - */ |
|
271 | - public function getJsquestion() |
|
272 | - { |
|
273 | - return $this->jsquestion; |
|
274 | - } |
|
275 | - |
|
276 | - /** |
|
277 | - * @param string $jsquestion |
|
278 | - */ |
|
279 | - public function setJsquestion($jsquestion) |
|
280 | - { |
|
281 | - $this->jsquestion = $jsquestion; |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * @return string |
|
286 | - */ |
|
287 | - public function getDefaultAction() |
|
288 | - { |
|
289 | - return $this->defaultaction; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * @param string $defaultAction |
|
294 | - */ |
|
295 | - public function setDefaultAction($defaultAction) |
|
296 | - { |
|
297 | - $this->defaultaction = $defaultAction; |
|
298 | - } |
|
299 | - |
|
300 | - /** |
|
301 | - * @return bool |
|
302 | - */ |
|
303 | - public function getActive() |
|
304 | - { |
|
305 | - return $this->active == 1; |
|
306 | - } |
|
307 | - |
|
308 | - /** |
|
309 | - * @param bool $active |
|
310 | - */ |
|
311 | - public function setActive($active) |
|
312 | - { |
|
313 | - $this->active = $active ? 1 : 0; |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * @return bool |
|
318 | - */ |
|
319 | - public function getPreloadOnly() |
|
320 | - { |
|
321 | - return $this->preloadonly == 1; |
|
322 | - } |
|
323 | - |
|
324 | - /** |
|
325 | - * @param bool $preloadonly |
|
326 | - */ |
|
327 | - public function setPreloadOnly($preloadonly) |
|
328 | - { |
|
329 | - $this->preloadonly = $preloadonly ? 1 : 0; |
|
330 | - } |
|
205 | + ); |
|
206 | + $statement->bindValue(':id', $this->id); |
|
207 | + $statement->bindValue(':updateversion', $this->updateversion); |
|
208 | + |
|
209 | + $statement->bindValue(':name', $this->name); |
|
210 | + $statement->bindValue(":text", $this->text); |
|
211 | + $statement->bindValue(":jsquestion", $this->jsquestion); |
|
212 | + $statement->bindValue(":defaultaction", $this->defaultaction); |
|
213 | + $statement->bindValue(":active", $this->active); |
|
214 | + $statement->bindValue(":preloadonly", $this->preloadonly); |
|
215 | + |
|
216 | + if (!$statement->execute()) { |
|
217 | + throw new Exception($statement->errorInfo()); |
|
218 | + } |
|
219 | + |
|
220 | + if ($statement->rowCount() !== 1) { |
|
221 | + throw new OptimisticLockFailedException(); |
|
222 | + } |
|
223 | + |
|
224 | + $this->updateversion++; |
|
225 | + } |
|
226 | + } |
|
227 | + |
|
228 | + /** |
|
229 | + * Override delete() from DataObject |
|
230 | + */ |
|
231 | + public function delete() |
|
232 | + { |
|
233 | + throw new Exception("You shouldn't be doing that, you'll break logs."); |
|
234 | + } |
|
235 | + |
|
236 | + /** |
|
237 | + * @return string |
|
238 | + */ |
|
239 | + public function getName() |
|
240 | + { |
|
241 | + return $this->name; |
|
242 | + } |
|
243 | + |
|
244 | + /** |
|
245 | + * @param string $name |
|
246 | + */ |
|
247 | + public function setName($name) |
|
248 | + { |
|
249 | + $this->name = $name; |
|
250 | + } |
|
251 | + |
|
252 | + /** |
|
253 | + * @return string |
|
254 | + */ |
|
255 | + public function getText() |
|
256 | + { |
|
257 | + return $this->text; |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * @param string $text |
|
262 | + */ |
|
263 | + public function setText($text) |
|
264 | + { |
|
265 | + $this->text = $text; |
|
266 | + } |
|
267 | + |
|
268 | + /** |
|
269 | + * @return string|null |
|
270 | + */ |
|
271 | + public function getJsquestion() |
|
272 | + { |
|
273 | + return $this->jsquestion; |
|
274 | + } |
|
275 | + |
|
276 | + /** |
|
277 | + * @param string $jsquestion |
|
278 | + */ |
|
279 | + public function setJsquestion($jsquestion) |
|
280 | + { |
|
281 | + $this->jsquestion = $jsquestion; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * @return string |
|
286 | + */ |
|
287 | + public function getDefaultAction() |
|
288 | + { |
|
289 | + return $this->defaultaction; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * @param string $defaultAction |
|
294 | + */ |
|
295 | + public function setDefaultAction($defaultAction) |
|
296 | + { |
|
297 | + $this->defaultaction = $defaultAction; |
|
298 | + } |
|
299 | + |
|
300 | + /** |
|
301 | + * @return bool |
|
302 | + */ |
|
303 | + public function getActive() |
|
304 | + { |
|
305 | + return $this->active == 1; |
|
306 | + } |
|
307 | + |
|
308 | + /** |
|
309 | + * @param bool $active |
|
310 | + */ |
|
311 | + public function setActive($active) |
|
312 | + { |
|
313 | + $this->active = $active ? 1 : 0; |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * @return bool |
|
318 | + */ |
|
319 | + public function getPreloadOnly() |
|
320 | + { |
|
321 | + return $this->preloadonly == 1; |
|
322 | + } |
|
323 | + |
|
324 | + /** |
|
325 | + * @param bool $preloadonly |
|
326 | + */ |
|
327 | + public function setPreloadOnly($preloadonly) |
|
328 | + { |
|
329 | + $this->preloadonly = $preloadonly ? 1 : 0; |
|
330 | + } |
|
331 | 331 | } |
@@ -21,110 +21,110 @@ |
||
21 | 21 | */ |
22 | 22 | class GeoLocation extends DataObject |
23 | 23 | { |
24 | - private $address; |
|
25 | - private $data; |
|
26 | - private $creation; |
|
27 | - |
|
28 | - /** |
|
29 | - * @param string $address |
|
30 | - * @param PdoDatabase $database |
|
31 | - * |
|
32 | - * @return GeoLocation |
|
33 | - */ |
|
34 | - public static function getByAddress($address, PdoDatabase $database) |
|
35 | - { |
|
36 | - $statement = $database->prepare("SELECT * FROM geolocation WHERE address = :id LIMIT 1;"); |
|
37 | - $statement->bindValue(":id", $address); |
|
38 | - |
|
39 | - $statement->execute(); |
|
40 | - |
|
41 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
42 | - |
|
43 | - if ($resultObject != false) { |
|
44 | - $resultObject->setDatabase($database); |
|
45 | - } |
|
46 | - |
|
47 | - return $resultObject; |
|
48 | - } |
|
49 | - |
|
50 | - public function save() |
|
51 | - { |
|
52 | - if ($this->isNew()) { |
|
53 | - // insert |
|
54 | - $statement = $this->dbObject->prepare(<<<SQL |
|
24 | + private $address; |
|
25 | + private $data; |
|
26 | + private $creation; |
|
27 | + |
|
28 | + /** |
|
29 | + * @param string $address |
|
30 | + * @param PdoDatabase $database |
|
31 | + * |
|
32 | + * @return GeoLocation |
|
33 | + */ |
|
34 | + public static function getByAddress($address, PdoDatabase $database) |
|
35 | + { |
|
36 | + $statement = $database->prepare("SELECT * FROM geolocation WHERE address = :id LIMIT 1;"); |
|
37 | + $statement->bindValue(":id", $address); |
|
38 | + |
|
39 | + $statement->execute(); |
|
40 | + |
|
41 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
42 | + |
|
43 | + if ($resultObject != false) { |
|
44 | + $resultObject->setDatabase($database); |
|
45 | + } |
|
46 | + |
|
47 | + return $resultObject; |
|
48 | + } |
|
49 | + |
|
50 | + public function save() |
|
51 | + { |
|
52 | + if ($this->isNew()) { |
|
53 | + // insert |
|
54 | + $statement = $this->dbObject->prepare(<<<SQL |
|
55 | 55 | INSERT INTO `geolocation` (address, data) VALUES (:address, :data); |
56 | 56 | SQL |
57 | - ); |
|
58 | - $statement->bindValue(":address", $this->address); |
|
59 | - $statement->bindValue(":data", $this->data); |
|
60 | - |
|
61 | - if ($statement->execute()) { |
|
62 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
63 | - } |
|
64 | - else { |
|
65 | - throw new Exception($statement->errorInfo()); |
|
66 | - } |
|
67 | - } |
|
68 | - else { |
|
69 | - // update |
|
70 | - $statement = $this->dbObject->prepare(<<<SQL |
|
57 | + ); |
|
58 | + $statement->bindValue(":address", $this->address); |
|
59 | + $statement->bindValue(":data", $this->data); |
|
60 | + |
|
61 | + if ($statement->execute()) { |
|
62 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
63 | + } |
|
64 | + else { |
|
65 | + throw new Exception($statement->errorInfo()); |
|
66 | + } |
|
67 | + } |
|
68 | + else { |
|
69 | + // update |
|
70 | + $statement = $this->dbObject->prepare(<<<SQL |
|
71 | 71 | UPDATE `geolocation` |
72 | 72 | SET address = :address, data = :data, updateversion = updateversion + 1 |
73 | 73 | WHERE id = :id AND updateversion = :updateversion |
74 | 74 | LIMIT 1; |
75 | 75 | SQL |
76 | - ); |
|
77 | - |
|
78 | - $statement->bindValue(":id", $this->id); |
|
79 | - $statement->bindValue(":updateversion", $this->updateversion); |
|
80 | - |
|
81 | - $statement->bindValue(":address", $this->address); |
|
82 | - $statement->bindValue(":data", $this->data); |
|
83 | - |
|
84 | - if (!$statement->execute()) { |
|
85 | - throw new Exception($statement->errorInfo()); |
|
86 | - } |
|
87 | - |
|
88 | - if ($statement->rowCount() !== 1) { |
|
89 | - throw new OptimisticLockFailedException(); |
|
90 | - } |
|
91 | - |
|
92 | - $this->updateversion++; |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - public function getAddress() |
|
97 | - { |
|
98 | - return $this->address; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @param string $address |
|
103 | - */ |
|
104 | - public function setAddress($address) |
|
105 | - { |
|
106 | - $this->address = $address; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @return array |
|
111 | - */ |
|
112 | - public function getData() |
|
113 | - { |
|
114 | - return unserialize($this->data); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @param array $data |
|
119 | - */ |
|
120 | - public function setData($data) |
|
121 | - { |
|
122 | - $this->data = serialize($data); |
|
123 | - } |
|
124 | - |
|
125 | - /** @return DateTimeImmutable */ |
|
126 | - public function getCreation() |
|
127 | - { |
|
128 | - return new DateTimeImmutable($this->creation); |
|
129 | - } |
|
76 | + ); |
|
77 | + |
|
78 | + $statement->bindValue(":id", $this->id); |
|
79 | + $statement->bindValue(":updateversion", $this->updateversion); |
|
80 | + |
|
81 | + $statement->bindValue(":address", $this->address); |
|
82 | + $statement->bindValue(":data", $this->data); |
|
83 | + |
|
84 | + if (!$statement->execute()) { |
|
85 | + throw new Exception($statement->errorInfo()); |
|
86 | + } |
|
87 | + |
|
88 | + if ($statement->rowCount() !== 1) { |
|
89 | + throw new OptimisticLockFailedException(); |
|
90 | + } |
|
91 | + |
|
92 | + $this->updateversion++; |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + public function getAddress() |
|
97 | + { |
|
98 | + return $this->address; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @param string $address |
|
103 | + */ |
|
104 | + public function setAddress($address) |
|
105 | + { |
|
106 | + $this->address = $address; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @return array |
|
111 | + */ |
|
112 | + public function getData() |
|
113 | + { |
|
114 | + return unserialize($this->data); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @param array $data |
|
119 | + */ |
|
120 | + public function setData($data) |
|
121 | + { |
|
122 | + $this->data = serialize($data); |
|
123 | + } |
|
124 | + |
|
125 | + /** @return DateTimeImmutable */ |
|
126 | + public function getCreation() |
|
127 | + { |
|
128 | + return new DateTimeImmutable($this->creation); |
|
129 | + } |
|
130 | 130 | } |
@@ -17,151 +17,151 @@ |
||
17 | 17 | */ |
18 | 18 | class Log extends DataObject |
19 | 19 | { |
20 | - /** @var int */ |
|
21 | - private $objectid; |
|
22 | - /** @var string */ |
|
23 | - private $objecttype; |
|
24 | - /** @var int */ |
|
25 | - private $user; |
|
26 | - /** @var string */ |
|
27 | - private $action; |
|
28 | - private $timestamp; |
|
29 | - /** @var string|null */ |
|
30 | - private $comment; |
|
31 | - |
|
32 | - /** |
|
33 | - * @throws Exception |
|
34 | - */ |
|
35 | - public function save() |
|
36 | - { |
|
37 | - if ($this->isNew()) { |
|
38 | - $statement = $this->dbObject->prepare(<<<SQL |
|
20 | + /** @var int */ |
|
21 | + private $objectid; |
|
22 | + /** @var string */ |
|
23 | + private $objecttype; |
|
24 | + /** @var int */ |
|
25 | + private $user; |
|
26 | + /** @var string */ |
|
27 | + private $action; |
|
28 | + private $timestamp; |
|
29 | + /** @var string|null */ |
|
30 | + private $comment; |
|
31 | + |
|
32 | + /** |
|
33 | + * @throws Exception |
|
34 | + */ |
|
35 | + public function save() |
|
36 | + { |
|
37 | + if ($this->isNew()) { |
|
38 | + $statement = $this->dbObject->prepare(<<<SQL |
|
39 | 39 | INSERT INTO log (objectid, objecttype, user, action, timestamp, comment) |
40 | 40 | VALUES (:id, :type, :user, :action, CURRENT_TIMESTAMP(), :comment); |
41 | 41 | SQL |
42 | - ); |
|
43 | - |
|
44 | - $statement->bindValue(":id", $this->objectid); |
|
45 | - $statement->bindValue(":type", $this->objecttype); |
|
46 | - $statement->bindValue(":user", $this->user); |
|
47 | - $statement->bindValue(":action", $this->action); |
|
48 | - $statement->bindValue(":comment", $this->comment); |
|
49 | - |
|
50 | - if ($statement->execute()) { |
|
51 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
52 | - } |
|
53 | - else { |
|
54 | - throw new Exception($statement->errorInfo()); |
|
55 | - } |
|
56 | - } |
|
57 | - else { |
|
58 | - throw new Exception("Updating logs is not available"); |
|
59 | - } |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * @throws Exception |
|
64 | - */ |
|
65 | - public function delete() |
|
66 | - { |
|
67 | - throw new Exception("Deleting logs is not available."); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @return int |
|
72 | - */ |
|
73 | - public function getObjectId() |
|
74 | - { |
|
75 | - return $this->objectid; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Summary of setObjectId |
|
80 | - * |
|
81 | - * @param int $objectId |
|
82 | - */ |
|
83 | - public function setObjectId($objectId) |
|
84 | - { |
|
85 | - $this->objectid = $objectId; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - public function getObjectType() |
|
92 | - { |
|
93 | - return $this->objecttype; |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Summary of setObjectType |
|
98 | - * |
|
99 | - * @param string $objectType |
|
100 | - */ |
|
101 | - public function setObjectType($objectType) |
|
102 | - { |
|
103 | - $this->objecttype = $objectType; |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @return int |
|
108 | - */ |
|
109 | - public function getUser() |
|
110 | - { |
|
111 | - return $this->user; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Summary of setUser |
|
116 | - * |
|
117 | - * @param User $user |
|
118 | - */ |
|
119 | - public function setUser(User $user) |
|
120 | - { |
|
121 | - $this->user = $user->getId(); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - public function getAction() |
|
128 | - { |
|
129 | - return $this->action; |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Summary of setAction |
|
134 | - * |
|
135 | - * @param string $action |
|
136 | - */ |
|
137 | - public function setAction($action) |
|
138 | - { |
|
139 | - $this->action = $action; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @return DateTimeImmutable |
|
144 | - */ |
|
145 | - public function getTimestamp() |
|
146 | - { |
|
147 | - return new DateTimeImmutable($this->timestamp); |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * @return string|null |
|
152 | - */ |
|
153 | - public function getComment() |
|
154 | - { |
|
155 | - return $this->comment; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * Summary of setComment |
|
160 | - * |
|
161 | - * @param string $comment |
|
162 | - */ |
|
163 | - public function setComment($comment) |
|
164 | - { |
|
165 | - $this->comment = $comment; |
|
166 | - } |
|
42 | + ); |
|
43 | + |
|
44 | + $statement->bindValue(":id", $this->objectid); |
|
45 | + $statement->bindValue(":type", $this->objecttype); |
|
46 | + $statement->bindValue(":user", $this->user); |
|
47 | + $statement->bindValue(":action", $this->action); |
|
48 | + $statement->bindValue(":comment", $this->comment); |
|
49 | + |
|
50 | + if ($statement->execute()) { |
|
51 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
52 | + } |
|
53 | + else { |
|
54 | + throw new Exception($statement->errorInfo()); |
|
55 | + } |
|
56 | + } |
|
57 | + else { |
|
58 | + throw new Exception("Updating logs is not available"); |
|
59 | + } |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * @throws Exception |
|
64 | + */ |
|
65 | + public function delete() |
|
66 | + { |
|
67 | + throw new Exception("Deleting logs is not available."); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @return int |
|
72 | + */ |
|
73 | + public function getObjectId() |
|
74 | + { |
|
75 | + return $this->objectid; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Summary of setObjectId |
|
80 | + * |
|
81 | + * @param int $objectId |
|
82 | + */ |
|
83 | + public function setObjectId($objectId) |
|
84 | + { |
|
85 | + $this->objectid = $objectId; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + public function getObjectType() |
|
92 | + { |
|
93 | + return $this->objecttype; |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Summary of setObjectType |
|
98 | + * |
|
99 | + * @param string $objectType |
|
100 | + */ |
|
101 | + public function setObjectType($objectType) |
|
102 | + { |
|
103 | + $this->objecttype = $objectType; |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @return int |
|
108 | + */ |
|
109 | + public function getUser() |
|
110 | + { |
|
111 | + return $this->user; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Summary of setUser |
|
116 | + * |
|
117 | + * @param User $user |
|
118 | + */ |
|
119 | + public function setUser(User $user) |
|
120 | + { |
|
121 | + $this->user = $user->getId(); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + public function getAction() |
|
128 | + { |
|
129 | + return $this->action; |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Summary of setAction |
|
134 | + * |
|
135 | + * @param string $action |
|
136 | + */ |
|
137 | + public function setAction($action) |
|
138 | + { |
|
139 | + $this->action = $action; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @return DateTimeImmutable |
|
144 | + */ |
|
145 | + public function getTimestamp() |
|
146 | + { |
|
147 | + return new DateTimeImmutable($this->timestamp); |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * @return string|null |
|
152 | + */ |
|
153 | + public function getComment() |
|
154 | + { |
|
155 | + return $this->comment; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * Summary of setComment |
|
160 | + * |
|
161 | + * @param string $comment |
|
162 | + */ |
|
163 | + public function setComment($comment) |
|
164 | + { |
|
165 | + $this->comment = $comment; |
|
166 | + } |
|
167 | 167 | } |
@@ -19,167 +19,167 @@ |
||
19 | 19 | */ |
20 | 20 | class WelcomeTemplate extends DataObject |
21 | 21 | { |
22 | - /** @var string */ |
|
23 | - private $usercode; |
|
24 | - /** @var string */ |
|
25 | - private $botcode; |
|
26 | - private $usageCache; |
|
27 | - private $deleted = 0; |
|
28 | - |
|
29 | - /** |
|
30 | - * Summary of getAll |
|
31 | - * |
|
32 | - * @param PdoDatabase $database |
|
33 | - * |
|
34 | - * @return WelcomeTemplate[] |
|
35 | - */ |
|
36 | - public static function getAll(PdoDatabase $database) |
|
37 | - { |
|
38 | - $statement = $database->prepare("SELECT * FROM welcometemplate WHERE deleted = 0;"); |
|
39 | - |
|
40 | - $statement->execute(); |
|
41 | - |
|
42 | - $result = array(); |
|
43 | - /** @var WelcomeTemplate $v */ |
|
44 | - foreach ($statement->fetchAll(PDO::FETCH_CLASS, self::class) as $v) { |
|
45 | - $v->setDatabase($database); |
|
46 | - $result[] = $v; |
|
47 | - } |
|
48 | - |
|
49 | - return $result; |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * @throws Exception |
|
54 | - */ |
|
55 | - public function save() |
|
56 | - { |
|
57 | - if ($this->isNew()) { |
|
58 | - // insert |
|
59 | - $statement = $this->dbObject->prepare(<<<SQL |
|
22 | + /** @var string */ |
|
23 | + private $usercode; |
|
24 | + /** @var string */ |
|
25 | + private $botcode; |
|
26 | + private $usageCache; |
|
27 | + private $deleted = 0; |
|
28 | + |
|
29 | + /** |
|
30 | + * Summary of getAll |
|
31 | + * |
|
32 | + * @param PdoDatabase $database |
|
33 | + * |
|
34 | + * @return WelcomeTemplate[] |
|
35 | + */ |
|
36 | + public static function getAll(PdoDatabase $database) |
|
37 | + { |
|
38 | + $statement = $database->prepare("SELECT * FROM welcometemplate WHERE deleted = 0;"); |
|
39 | + |
|
40 | + $statement->execute(); |
|
41 | + |
|
42 | + $result = array(); |
|
43 | + /** @var WelcomeTemplate $v */ |
|
44 | + foreach ($statement->fetchAll(PDO::FETCH_CLASS, self::class) as $v) { |
|
45 | + $v->setDatabase($database); |
|
46 | + $result[] = $v; |
|
47 | + } |
|
48 | + |
|
49 | + return $result; |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * @throws Exception |
|
54 | + */ |
|
55 | + public function save() |
|
56 | + { |
|
57 | + if ($this->isNew()) { |
|
58 | + // insert |
|
59 | + $statement = $this->dbObject->prepare(<<<SQL |
|
60 | 60 | INSERT INTO welcometemplate (usercode, botcode) VALUES (:usercode, :botcode); |
61 | 61 | SQL |
62 | - ); |
|
63 | - $statement->bindValue(":usercode", $this->usercode); |
|
64 | - $statement->bindValue(":botcode", $this->botcode); |
|
65 | - |
|
66 | - if ($statement->execute()) { |
|
67 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
68 | - } |
|
69 | - else { |
|
70 | - throw new Exception($statement->errorInfo()); |
|
71 | - } |
|
72 | - } |
|
73 | - else { |
|
74 | - // update |
|
75 | - $statement = $this->dbObject->prepare(<<<SQL |
|
62 | + ); |
|
63 | + $statement->bindValue(":usercode", $this->usercode); |
|
64 | + $statement->bindValue(":botcode", $this->botcode); |
|
65 | + |
|
66 | + if ($statement->execute()) { |
|
67 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
68 | + } |
|
69 | + else { |
|
70 | + throw new Exception($statement->errorInfo()); |
|
71 | + } |
|
72 | + } |
|
73 | + else { |
|
74 | + // update |
|
75 | + $statement = $this->dbObject->prepare(<<<SQL |
|
76 | 76 | UPDATE `welcometemplate` |
77 | 77 | SET usercode = :usercode, botcode = :botcode, updateversion = updateversion + 1 |
78 | 78 | WHERE id = :id AND updateversion = :updateversion |
79 | 79 | LIMIT 1; |
80 | 80 | SQL |
81 | - ); |
|
82 | - |
|
83 | - $statement->bindValue(':id', $this->id); |
|
84 | - $statement->bindValue(':updateversion', $this->updateversion); |
|
85 | - |
|
86 | - $statement->bindValue(':usercode', $this->usercode); |
|
87 | - $statement->bindValue(':botcode', $this->botcode); |
|
88 | - |
|
89 | - if (!$statement->execute()) { |
|
90 | - throw new Exception($statement->errorInfo()); |
|
91 | - } |
|
92 | - |
|
93 | - if ($statement->rowCount() !== 1) { |
|
94 | - throw new OptimisticLockFailedException(); |
|
95 | - } |
|
96 | - |
|
97 | - $this->updateversion++; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @return string |
|
103 | - */ |
|
104 | - public function getUserCode() |
|
105 | - { |
|
106 | - return $this->usercode; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @param string $usercode |
|
111 | - */ |
|
112 | - public function setUserCode($usercode) |
|
113 | - { |
|
114 | - $this->usercode = $usercode; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - public function getBotCode() |
|
121 | - { |
|
122 | - return $this->botcode; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @param string $botcode |
|
127 | - */ |
|
128 | - public function setBotCode($botcode) |
|
129 | - { |
|
130 | - $this->botcode = $botcode; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * @return User[] |
|
135 | - */ |
|
136 | - public function getUsersUsingTemplate() |
|
137 | - { |
|
138 | - if ($this->usageCache === null) { |
|
139 | - $statement = $this->dbObject->prepare("SELECT * FROM user WHERE welcome_template = :id;"); |
|
140 | - |
|
141 | - $statement->execute(array(":id" => $this->id)); |
|
142 | - |
|
143 | - $result = array(); |
|
144 | - /** @var WelcomeTemplate $v */ |
|
145 | - foreach ($statement->fetchAll(PDO::FETCH_CLASS, User::class) as $v) { |
|
146 | - $v->setDatabase($this->dbObject); |
|
147 | - $result[] = $v; |
|
148 | - } |
|
149 | - |
|
150 | - $this->usageCache = $result; |
|
151 | - } |
|
152 | - |
|
153 | - return $this->usageCache; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Deletes the object from the database |
|
158 | - */ |
|
159 | - public function delete() |
|
160 | - { |
|
161 | - if ($this->id === null) { |
|
162 | - // wtf? |
|
163 | - return; |
|
164 | - } |
|
165 | - |
|
166 | - $deleteQuery = "UPDATE welcometemplate SET deleted = 1 WHERE id = :id AND updateversion = :updateversion;"; |
|
167 | - $statement = $this->dbObject->prepare($deleteQuery); |
|
168 | - |
|
169 | - $statement->bindValue(":id", $this->id); |
|
170 | - $statement->bindValue(":updateversion", $this->updateversion); |
|
171 | - $statement->execute(); |
|
172 | - |
|
173 | - if ($statement->rowCount() !== 1) { |
|
174 | - throw new OptimisticLockFailedException(); |
|
175 | - } |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @return bool |
|
180 | - */ |
|
181 | - public function isDeleted() |
|
182 | - { |
|
183 | - return ((int)$this->deleted) === 1; |
|
184 | - } |
|
81 | + ); |
|
82 | + |
|
83 | + $statement->bindValue(':id', $this->id); |
|
84 | + $statement->bindValue(':updateversion', $this->updateversion); |
|
85 | + |
|
86 | + $statement->bindValue(':usercode', $this->usercode); |
|
87 | + $statement->bindValue(':botcode', $this->botcode); |
|
88 | + |
|
89 | + if (!$statement->execute()) { |
|
90 | + throw new Exception($statement->errorInfo()); |
|
91 | + } |
|
92 | + |
|
93 | + if ($statement->rowCount() !== 1) { |
|
94 | + throw new OptimisticLockFailedException(); |
|
95 | + } |
|
96 | + |
|
97 | + $this->updateversion++; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @return string |
|
103 | + */ |
|
104 | + public function getUserCode() |
|
105 | + { |
|
106 | + return $this->usercode; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @param string $usercode |
|
111 | + */ |
|
112 | + public function setUserCode($usercode) |
|
113 | + { |
|
114 | + $this->usercode = $usercode; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + public function getBotCode() |
|
121 | + { |
|
122 | + return $this->botcode; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @param string $botcode |
|
127 | + */ |
|
128 | + public function setBotCode($botcode) |
|
129 | + { |
|
130 | + $this->botcode = $botcode; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * @return User[] |
|
135 | + */ |
|
136 | + public function getUsersUsingTemplate() |
|
137 | + { |
|
138 | + if ($this->usageCache === null) { |
|
139 | + $statement = $this->dbObject->prepare("SELECT * FROM user WHERE welcome_template = :id;"); |
|
140 | + |
|
141 | + $statement->execute(array(":id" => $this->id)); |
|
142 | + |
|
143 | + $result = array(); |
|
144 | + /** @var WelcomeTemplate $v */ |
|
145 | + foreach ($statement->fetchAll(PDO::FETCH_CLASS, User::class) as $v) { |
|
146 | + $v->setDatabase($this->dbObject); |
|
147 | + $result[] = $v; |
|
148 | + } |
|
149 | + |
|
150 | + $this->usageCache = $result; |
|
151 | + } |
|
152 | + |
|
153 | + return $this->usageCache; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Deletes the object from the database |
|
158 | + */ |
|
159 | + public function delete() |
|
160 | + { |
|
161 | + if ($this->id === null) { |
|
162 | + // wtf? |
|
163 | + return; |
|
164 | + } |
|
165 | + |
|
166 | + $deleteQuery = "UPDATE welcometemplate SET deleted = 1 WHERE id = :id AND updateversion = :updateversion;"; |
|
167 | + $statement = $this->dbObject->prepare($deleteQuery); |
|
168 | + |
|
169 | + $statement->bindValue(":id", $this->id); |
|
170 | + $statement->bindValue(":updateversion", $this->updateversion); |
|
171 | + $statement->execute(); |
|
172 | + |
|
173 | + if ($statement->rowCount() !== 1) { |
|
174 | + throw new OptimisticLockFailedException(); |
|
175 | + } |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @return bool |
|
180 | + */ |
|
181 | + public function isDeleted() |
|
182 | + { |
|
183 | + return ((int)$this->deleted) === 1; |
|
184 | + } |
|
185 | 185 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | final protected function setUpSmarty() |
55 | 55 | { |
56 | 56 | $this->smarty = new Smarty(); |
57 | - $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath() . '/smarty-plugins'); |
|
57 | + $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath().'/smarty-plugins'); |
|
58 | 58 | |
59 | 59 | $this->assign('currentUser', User::getCommunity()); |
60 | 60 | $this->assign('loggedIn', false); |
@@ -15,89 +15,89 @@ |
||
15 | 15 | |
16 | 16 | trait TemplateOutput |
17 | 17 | { |
18 | - /** @var Smarty */ |
|
19 | - private $smarty; |
|
20 | - /** @var string Extra JavaScript to include at the end of the page's execution */ |
|
21 | - private $tailScript; |
|
18 | + /** @var Smarty */ |
|
19 | + private $smarty; |
|
20 | + /** @var string Extra JavaScript to include at the end of the page's execution */ |
|
21 | + private $tailScript; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @return SiteConfiguration |
|
25 | - */ |
|
26 | - protected abstract function getSiteConfiguration(); |
|
23 | + /** |
|
24 | + * @return SiteConfiguration |
|
25 | + */ |
|
26 | + protected abstract function getSiteConfiguration(); |
|
27 | 27 | |
28 | - /** |
|
29 | - * Include extra JavaScript at the end of the page's execution |
|
30 | - * |
|
31 | - * @param $script string JavaScript to include at the end of the page |
|
32 | - */ |
|
33 | - final protected function setTailScript($script) |
|
34 | - { |
|
35 | - $this->tailScript = $script; |
|
36 | - } |
|
28 | + /** |
|
29 | + * Include extra JavaScript at the end of the page's execution |
|
30 | + * |
|
31 | + * @param $script string JavaScript to include at the end of the page |
|
32 | + */ |
|
33 | + final protected function setTailScript($script) |
|
34 | + { |
|
35 | + $this->tailScript = $script; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Assigns a Smarty variable |
|
40 | - * |
|
41 | - * @param array|string $name the template variable name(s) |
|
42 | - * @param mixed $value the value to assign |
|
43 | - */ |
|
44 | - final protected function assign($name, $value) |
|
45 | - { |
|
46 | - $this->smarty->assign($name, $value); |
|
47 | - } |
|
38 | + /** |
|
39 | + * Assigns a Smarty variable |
|
40 | + * |
|
41 | + * @param array|string $name the template variable name(s) |
|
42 | + * @param mixed $value the value to assign |
|
43 | + */ |
|
44 | + final protected function assign($name, $value) |
|
45 | + { |
|
46 | + $this->smarty->assign($name, $value); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Sets up the variables used by the main Smarty base template. |
|
51 | - * |
|
52 | - * This list is getting kinda long. |
|
53 | - */ |
|
54 | - final protected function setUpSmarty() |
|
55 | - { |
|
56 | - $this->smarty = new Smarty(); |
|
57 | - $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath() . '/smarty-plugins'); |
|
49 | + /** |
|
50 | + * Sets up the variables used by the main Smarty base template. |
|
51 | + * |
|
52 | + * This list is getting kinda long. |
|
53 | + */ |
|
54 | + final protected function setUpSmarty() |
|
55 | + { |
|
56 | + $this->smarty = new Smarty(); |
|
57 | + $this->smarty->addPluginsDir($this->getSiteConfiguration()->getFilePath() . '/smarty-plugins'); |
|
58 | 58 | |
59 | - $this->assign('currentUser', User::getCommunity()); |
|
60 | - $this->assign('loggedIn', false); |
|
61 | - $this->assign('baseurl', $this->getSiteConfiguration()->getBaseUrl()); |
|
62 | - $this->assign('mediawikiScriptPath', $this->getSiteConfiguration()->getMediawikiScriptPath()); |
|
59 | + $this->assign('currentUser', User::getCommunity()); |
|
60 | + $this->assign('loggedIn', false); |
|
61 | + $this->assign('baseurl', $this->getSiteConfiguration()->getBaseUrl()); |
|
62 | + $this->assign('mediawikiScriptPath', $this->getSiteConfiguration()->getMediawikiScriptPath()); |
|
63 | 63 | |
64 | - $this->assign('siteNoticeText', ''); |
|
65 | - $this->assign('toolversion', Environment::getToolVersion()); |
|
64 | + $this->assign('siteNoticeText', ''); |
|
65 | + $this->assign('toolversion', Environment::getToolVersion()); |
|
66 | 66 | |
67 | - // default these |
|
68 | - $this->assign('onlineusers', array()); |
|
69 | - $this->assign('typeAheadBlock', ''); |
|
70 | - $this->assign('extraJs', array()); |
|
71 | - $this->assign('extraCss', array()); |
|
67 | + // default these |
|
68 | + $this->assign('onlineusers', array()); |
|
69 | + $this->assign('typeAheadBlock', ''); |
|
70 | + $this->assign('extraJs', array()); |
|
71 | + $this->assign('extraCss', array()); |
|
72 | 72 | |
73 | - // nav menu access control |
|
74 | - $this->assign('nav__canRequests', false); |
|
75 | - $this->assign('nav__canLogs', false); |
|
76 | - $this->assign('nav__canUsers', false); |
|
77 | - $this->assign('nav__canSearch', false); |
|
78 | - $this->assign('nav__canStats', false); |
|
79 | - $this->assign('nav__canBan', false); |
|
80 | - $this->assign('nav__canEmailMgmt', false); |
|
81 | - $this->assign('nav__canWelcomeMgmt', false); |
|
82 | - $this->assign('nav__canSiteNoticeMgmt', false); |
|
83 | - $this->assign('nav__canUserMgmt', false); |
|
84 | - $this->assign('nav__canViewRequest', false); |
|
85 | - $this->assign('nav__canJobQueue', false); |
|
73 | + // nav menu access control |
|
74 | + $this->assign('nav__canRequests', false); |
|
75 | + $this->assign('nav__canLogs', false); |
|
76 | + $this->assign('nav__canUsers', false); |
|
77 | + $this->assign('nav__canSearch', false); |
|
78 | + $this->assign('nav__canStats', false); |
|
79 | + $this->assign('nav__canBan', false); |
|
80 | + $this->assign('nav__canEmailMgmt', false); |
|
81 | + $this->assign('nav__canWelcomeMgmt', false); |
|
82 | + $this->assign('nav__canSiteNoticeMgmt', false); |
|
83 | + $this->assign('nav__canUserMgmt', false); |
|
84 | + $this->assign('nav__canViewRequest', false); |
|
85 | + $this->assign('nav__canJobQueue', false); |
|
86 | 86 | |
87 | - $this->assign('page', $this); |
|
88 | - } |
|
87 | + $this->assign('page', $this); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Fetches a rendered Smarty template |
|
92 | - * |
|
93 | - * @param $template string Template file path, relative to /templates/ |
|
94 | - * |
|
95 | - * @return string Templated HTML |
|
96 | - */ |
|
97 | - final protected function fetchTemplate($template) |
|
98 | - { |
|
99 | - $this->assign("tailScript", $this->tailScript); |
|
90 | + /** |
|
91 | + * Fetches a rendered Smarty template |
|
92 | + * |
|
93 | + * @param $template string Template file path, relative to /templates/ |
|
94 | + * |
|
95 | + * @return string Templated HTML |
|
96 | + */ |
|
97 | + final protected function fetchTemplate($template) |
|
98 | + { |
|
99 | + $this->assign("tailScript", $this->tailScript); |
|
100 | 100 | |
101 | - return $this->smarty->fetch($template); |
|
102 | - } |
|
101 | + return $this->smarty->fetch($template); |
|
102 | + } |
|
103 | 103 | } |
@@ -17,25 +17,25 @@ |
||
17 | 17 | */ |
18 | 18 | class Session |
19 | 19 | { |
20 | - public static function start() |
|
21 | - { |
|
22 | - ini_set('session.cookie_httponly', 1); |
|
20 | + public static function start() |
|
21 | + { |
|
22 | + ini_set('session.cookie_httponly', 1); |
|
23 | 23 | |
24 | - if (WebRequest::isHttps()) { |
|
25 | - ini_set('session.cookie_secure', 1); |
|
26 | - } |
|
24 | + if (WebRequest::isHttps()) { |
|
25 | + ini_set('session.cookie_secure', 1); |
|
26 | + } |
|
27 | 27 | |
28 | - session_start(); |
|
29 | - } |
|
28 | + session_start(); |
|
29 | + } |
|
30 | 30 | |
31 | - public static function destroy() |
|
32 | - { |
|
33 | - session_destroy(); |
|
34 | - } |
|
31 | + public static function destroy() |
|
32 | + { |
|
33 | + session_destroy(); |
|
34 | + } |
|
35 | 35 | |
36 | - public static function restart() |
|
37 | - { |
|
38 | - self::destroy(); |
|
39 | - self::start(); |
|
40 | - } |
|
36 | + public static function restart() |
|
37 | + { |
|
38 | + self::destroy(); |
|
39 | + self::start(); |
|
40 | + } |
|
41 | 41 | } |
@@ -21,141 +21,141 @@ |
||
21 | 21 | */ |
22 | 22 | class SessionAlert |
23 | 23 | { |
24 | - private $message; |
|
25 | - private $title; |
|
26 | - private $type; |
|
27 | - private $closable; |
|
28 | - private $block; |
|
29 | - |
|
30 | - /** |
|
31 | - * @param string $message |
|
32 | - * @param string $title |
|
33 | - * @param string $type |
|
34 | - * @param bool $closable |
|
35 | - * @param bool $block |
|
36 | - */ |
|
37 | - public function __construct($message, $title, $type = "alert-info", $closable = true, $block = true) |
|
38 | - { |
|
39 | - $this->message = $message; |
|
40 | - $this->title = $title; |
|
41 | - $this->type = $type; |
|
42 | - $this->closable = $closable; |
|
43 | - $this->block = $block; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Shows a quick one-liner message |
|
48 | - * |
|
49 | - * @param string $message |
|
50 | - * @param string $type |
|
51 | - */ |
|
52 | - public static function quick($message, $type = "alert-info") |
|
53 | - { |
|
54 | - self::append(new SessionAlert($message, "", $type, true, false)); |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * @param SessionAlert $alert |
|
59 | - */ |
|
60 | - public static function append(SessionAlert $alert) |
|
61 | - { |
|
62 | - $data = WebRequest::getSessionAlertData(); |
|
63 | - $data[] = serialize($alert); |
|
64 | - WebRequest::setSessionAlertData($data); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Shows a quick one-liner success message |
|
69 | - * |
|
70 | - * @param string $message |
|
71 | - */ |
|
72 | - public static function success($message) |
|
73 | - { |
|
74 | - self::append(new SessionAlert($message, "", "alert-success", true, true)); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Shows a quick one-liner warning message |
|
79 | - * |
|
80 | - * @param string $message |
|
81 | - * @param string $title |
|
82 | - */ |
|
83 | - public static function warning($message, $title = "Warning!") |
|
84 | - { |
|
85 | - self::append(new SessionAlert($message, $title, "alert-warning", true, true)); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Shows a quick one-liner error message |
|
90 | - * |
|
91 | - * @param string $message |
|
92 | - * @param string $title |
|
93 | - */ |
|
94 | - public static function error($message, $title = "Error!") |
|
95 | - { |
|
96 | - self::append(new SessionAlert($message, $title, "alert-error", true, true)); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Retrieves the alerts which have been saved to the session |
|
101 | - * @return array |
|
102 | - */ |
|
103 | - public static function getAlerts() |
|
104 | - { |
|
105 | - $alertData = array(); |
|
106 | - |
|
107 | - foreach (WebRequest::getSessionAlertData() as $a) { |
|
108 | - $alertData[] = unserialize($a); |
|
109 | - } |
|
110 | - |
|
111 | - return $alertData; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Clears the alerts from the session |
|
116 | - */ |
|
117 | - public static function clearAlerts() |
|
118 | - { |
|
119 | - WebRequest::clearSessionAlertData(); |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @return boolean |
|
124 | - */ |
|
125 | - public function isBlock() |
|
126 | - { |
|
127 | - return $this->block; |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @return boolean |
|
132 | - */ |
|
133 | - public function isClosable() |
|
134 | - { |
|
135 | - return $this->closable; |
|
136 | - } |
|
137 | - |
|
138 | - /** |
|
139 | - * @return string |
|
140 | - */ |
|
141 | - public function getType() |
|
142 | - { |
|
143 | - return $this->type; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @return string |
|
148 | - */ |
|
149 | - public function getTitle() |
|
150 | - { |
|
151 | - return $this->title; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
157 | - public function getMessage() |
|
158 | - { |
|
159 | - return $this->message; |
|
160 | - } |
|
24 | + private $message; |
|
25 | + private $title; |
|
26 | + private $type; |
|
27 | + private $closable; |
|
28 | + private $block; |
|
29 | + |
|
30 | + /** |
|
31 | + * @param string $message |
|
32 | + * @param string $title |
|
33 | + * @param string $type |
|
34 | + * @param bool $closable |
|
35 | + * @param bool $block |
|
36 | + */ |
|
37 | + public function __construct($message, $title, $type = "alert-info", $closable = true, $block = true) |
|
38 | + { |
|
39 | + $this->message = $message; |
|
40 | + $this->title = $title; |
|
41 | + $this->type = $type; |
|
42 | + $this->closable = $closable; |
|
43 | + $this->block = $block; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Shows a quick one-liner message |
|
48 | + * |
|
49 | + * @param string $message |
|
50 | + * @param string $type |
|
51 | + */ |
|
52 | + public static function quick($message, $type = "alert-info") |
|
53 | + { |
|
54 | + self::append(new SessionAlert($message, "", $type, true, false)); |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * @param SessionAlert $alert |
|
59 | + */ |
|
60 | + public static function append(SessionAlert $alert) |
|
61 | + { |
|
62 | + $data = WebRequest::getSessionAlertData(); |
|
63 | + $data[] = serialize($alert); |
|
64 | + WebRequest::setSessionAlertData($data); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Shows a quick one-liner success message |
|
69 | + * |
|
70 | + * @param string $message |
|
71 | + */ |
|
72 | + public static function success($message) |
|
73 | + { |
|
74 | + self::append(new SessionAlert($message, "", "alert-success", true, true)); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Shows a quick one-liner warning message |
|
79 | + * |
|
80 | + * @param string $message |
|
81 | + * @param string $title |
|
82 | + */ |
|
83 | + public static function warning($message, $title = "Warning!") |
|
84 | + { |
|
85 | + self::append(new SessionAlert($message, $title, "alert-warning", true, true)); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Shows a quick one-liner error message |
|
90 | + * |
|
91 | + * @param string $message |
|
92 | + * @param string $title |
|
93 | + */ |
|
94 | + public static function error($message, $title = "Error!") |
|
95 | + { |
|
96 | + self::append(new SessionAlert($message, $title, "alert-error", true, true)); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Retrieves the alerts which have been saved to the session |
|
101 | + * @return array |
|
102 | + */ |
|
103 | + public static function getAlerts() |
|
104 | + { |
|
105 | + $alertData = array(); |
|
106 | + |
|
107 | + foreach (WebRequest::getSessionAlertData() as $a) { |
|
108 | + $alertData[] = unserialize($a); |
|
109 | + } |
|
110 | + |
|
111 | + return $alertData; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Clears the alerts from the session |
|
116 | + */ |
|
117 | + public static function clearAlerts() |
|
118 | + { |
|
119 | + WebRequest::clearSessionAlertData(); |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @return boolean |
|
124 | + */ |
|
125 | + public function isBlock() |
|
126 | + { |
|
127 | + return $this->block; |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @return boolean |
|
132 | + */ |
|
133 | + public function isClosable() |
|
134 | + { |
|
135 | + return $this->closable; |
|
136 | + } |
|
137 | + |
|
138 | + /** |
|
139 | + * @return string |
|
140 | + */ |
|
141 | + public function getType() |
|
142 | + { |
|
143 | + return $this->type; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @return string |
|
148 | + */ |
|
149 | + public function getTitle() |
|
150 | + { |
|
151 | + return $this->title; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | + public function getMessage() |
|
158 | + { |
|
159 | + return $this->message; |
|
160 | + } |
|
161 | 161 | } |
@@ -17,17 +17,17 @@ |
||
17 | 17 | */ |
18 | 18 | interface IApiAction extends IRoutedTask |
19 | 19 | { |
20 | - /** |
|
21 | - * Method that runs API action |
|
22 | - * |
|
23 | - * @param DOMElement $apiDocument |
|
24 | - * |
|
25 | - * @return DOMElement The modified API document |
|
26 | - */ |
|
27 | - public function executeApiAction(DOMElement $apiDocument); |
|
20 | + /** |
|
21 | + * Method that runs API action |
|
22 | + * |
|
23 | + * @param DOMElement $apiDocument |
|
24 | + * |
|
25 | + * @return DOMElement The modified API document |
|
26 | + */ |
|
27 | + public function executeApiAction(DOMElement $apiDocument); |
|
28 | 28 | |
29 | - /** |
|
30 | - * @return string the XML, or false if an error occurred. |
|
31 | - */ |
|
32 | - public function runApiPage(); |
|
29 | + /** |
|
30 | + * @return string the XML, or false if an error occurred. |
|
31 | + */ |
|
32 | + public function runApiPage(); |
|
33 | 33 | } |
@@ -18,34 +18,34 @@ |
||
18 | 18 | */ |
19 | 19 | class HelpAction extends ApiPageBase implements IApiAction |
20 | 20 | { |
21 | - public function executeApiAction(DOMElement $apiDocument) |
|
22 | - { |
|
23 | - $helpElement = $this->getHelpElement(); |
|
24 | - $apiDocument->appendChild($helpElement); |
|
25 | - |
|
26 | - return $apiDocument; |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * Gets the help information |
|
31 | - * @return DOMElement |
|
32 | - */ |
|
33 | - protected function getHelpElement() |
|
34 | - { |
|
35 | - $helpInfo = "Help info goes here!"; |
|
36 | - |
|
37 | - $help = $this->document->createElement("help"); |
|
38 | - $helptext = $this->document->createElement("info", $helpInfo); |
|
39 | - $helpactions = $this->document->createElement("actions"); |
|
40 | - |
|
41 | - foreach (ApiRequestRouter::getActionList() as $action) { |
|
42 | - $actionElement = $this->document->createElement("action", $action); |
|
43 | - $helpactions->appendChild($actionElement); |
|
44 | - } |
|
45 | - |
|
46 | - $help->appendChild($helptext); |
|
47 | - $help->appendChild($helpactions); |
|
48 | - |
|
49 | - return $help; |
|
50 | - } |
|
21 | + public function executeApiAction(DOMElement $apiDocument) |
|
22 | + { |
|
23 | + $helpElement = $this->getHelpElement(); |
|
24 | + $apiDocument->appendChild($helpElement); |
|
25 | + |
|
26 | + return $apiDocument; |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * Gets the help information |
|
31 | + * @return DOMElement |
|
32 | + */ |
|
33 | + protected function getHelpElement() |
|
34 | + { |
|
35 | + $helpInfo = "Help info goes here!"; |
|
36 | + |
|
37 | + $help = $this->document->createElement("help"); |
|
38 | + $helptext = $this->document->createElement("info", $helpInfo); |
|
39 | + $helpactions = $this->document->createElement("actions"); |
|
40 | + |
|
41 | + foreach (ApiRequestRouter::getActionList() as $action) { |
|
42 | + $actionElement = $this->document->createElement("action", $action); |
|
43 | + $helpactions->appendChild($actionElement); |
|
44 | + } |
|
45 | + |
|
46 | + $help->appendChild($helptext); |
|
47 | + $help->appendChild($helpactions); |
|
48 | + |
|
49 | + return $help; |
|
50 | + } |
|
51 | 51 | } |