@@ -478,6 +478,7 @@ |
||
478 | 478 | |
479 | 479 | /** |
480 | 480 | * @brief Set points |
481 | + * @param string $mode |
|
481 | 482 | */ |
482 | 483 | function setPoint($member_srl, $point, $mode = null) |
483 | 484 | { |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $point = $config->signup_point; |
32 | 32 | // Increase the point |
33 | 33 | $cur_point += $point; |
34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
35 | 35 | |
36 | 36 | return new Object(); |
37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if (!$member_srl) return new Object(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object(); |
|
48 | 48 | // Get the point module information |
49 | 49 | $oModuleModel = getModel('module'); |
50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $point = $config->login_point; |
56 | 56 | // Increase the point |
57 | 57 | $cur_point += $point; |
58 | - $this->setPoint($member_srl,$cur_point); |
|
58 | + $this->setPoint($member_srl, $cur_point); |
|
59 | 59 | |
60 | 60 | return new Object(); |
61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | function triggerInsertDocument(&$obj) |
67 | 67 | { |
68 | 68 | $oDocumentModel = getModel('document'); |
69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
70 | 70 | { |
71 | 71 | $module_srl = $obj->module_srl; |
72 | 72 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
73 | + if (!$module_srl || !$member_srl) return new Object(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
75 | + if ($module_srl == $member_srl) return new Object(); |
|
76 | 76 | // Get the point module information |
77 | 77 | $oModuleModel = getModel('module'); |
78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
80 | 80 | // Get the points of the member |
81 | 81 | $oPointModel = getModel('point'); |
82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 83 | |
84 | 84 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
86 | 86 | $cur_point += $point; |
87 | 87 | // Add points for attaching a file |
88 | 88 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
91 | 91 | // Increase the point |
92 | - $this->setPoint($member_srl,$cur_point); |
|
92 | + $this->setPoint($member_srl, $cur_point); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return new Object(); |
@@ -106,24 +106,24 @@ discard block |
||
106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
107 | 107 | |
108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
110 | 110 | { |
111 | 111 | $oModuleModel = getModel('module'); |
112 | 112 | |
113 | 113 | // Get the point module information |
114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
116 | 116 | // Get the points of the member |
117 | 117 | $oPointModel = getModel('point'); |
118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 119 | |
120 | 120 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
122 | 122 | $cur_point += $point; |
123 | 123 | // Add points for attaching a file |
124 | 124 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
127 | 127 | // Increase the point |
128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
141 | 141 | |
142 | 142 | $oDocumentModel = getModel('document'); |
143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
144 | + if (!$oDocument->isExists()) return new Object(); |
|
145 | 145 | // Get the point module information |
146 | 146 | $oModuleModel = getModel('module'); |
147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
149 | 149 | // The process related to clearing the post comments |
150 | 150 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
152 | 152 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
153 | + if ($comment_point > 0) return new Object(); |
|
154 | 154 | // Get all the comments related to this post |
155 | 155 | $cp_args = new stdClass(); |
156 | 156 | $cp_args->document_srl = $document_srl; |
157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 158 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
159 | + if (!$output->data) return new Object(); |
|
160 | 160 | // Organize the member number |
161 | 161 | $member_srls = array(); |
162 | 162 | $cnt = count($output->data); |
163 | - for($i=0;$i<$cnt;$i++) |
|
163 | + for ($i = 0; $i < $cnt; $i++) |
|
164 | 164 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 167 | } |
168 | 168 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new Object(); |
|
171 | 171 | // Remove all the points for each member |
172 | 172 | $oPointModel = getModel('point'); |
173 | 173 | // Get the points |
174 | 174 | $point = $module_config['download_file']; |
175 | - foreach($member_srls as $member_srl => $cnt) |
|
175 | + foreach ($member_srls as $member_srl => $cnt) |
|
176 | 176 | { |
177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
178 | 178 | $cur_point -= $cnt * $comment_point; |
179 | - $this->setPoint($member_srl,$cur_point); |
|
179 | + $this->setPoint($member_srl, $cur_point); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return new Object(); |
@@ -189,15 +189,15 @@ discard block |
||
189 | 189 | { |
190 | 190 | $oDocumentModel = getModel('document'); |
191 | 191 | |
192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
193 | 193 | { |
194 | 194 | $module_srl = $obj->module_srl; |
195 | 195 | $member_srl = $obj->member_srl; |
196 | 196 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
197 | + if (!$module_srl || !$member_srl) return new Object(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
200 | + if (!$logged_info->member_srl) return new Object(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 208 | |
209 | 209 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
212 | + if ($point < 0) return new Object(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Add points related to deleting an attachment |
215 | 215 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
218 | 218 | // Increase the point |
219 | - $this->setPoint($member_srl,$cur_point); |
|
219 | + $this->setPoint($member_srl, $cur_point); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return new Object(); |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | { |
230 | 230 | $module_srl = $obj->module_srl; |
231 | 231 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
232 | + if (!$module_srl || !$member_srl) return new Object(); |
|
233 | 233 | // Do not increase the points if the member is the author of the post |
234 | 234 | $document_srl = $obj->document_srl; |
235 | 235 | $oDocumentModel = getModel('document'); |
236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object(); |
|
238 | 238 | // Get the point module information |
239 | 239 | $oModuleModel = getModel('module'); |
240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 245 | |
246 | 246 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
248 | 248 | // Increase the point |
249 | 249 | $cur_point += $point; |
250 | - $this->setPoint($member_srl,$cur_point); |
|
250 | + $this->setPoint($member_srl, $cur_point); |
|
251 | 251 | |
252 | 252 | return new Object(); |
253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
264 | 264 | $module_srl = $obj->module_srl; |
265 | 265 | $member_srl = abs($obj->member_srl); |
266 | 266 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
267 | + if (!$module_srl || !$member_srl) return new Object(); |
|
268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
270 | + if (!$oDocument->isExists()) return new Object(); |
|
271 | + if ($oDocument->get('member_srl') == $member_srl) return new Object(); |
|
272 | 272 | // Get the point module information |
273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 277 | |
278 | 278 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
281 | + if ($point < 0) return new Object(); |
|
282 | 282 | // Increase the point |
283 | 283 | $cur_point -= $point; |
284 | - $this->setPoint($member_srl,$cur_point); |
|
284 | + $this->setPoint($member_srl, $cur_point); |
|
285 | 285 | |
286 | 286 | return new Object(); |
287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
301 | 301 | */ |
302 | 302 | function triggerDeleteFile(&$obj) |
303 | 303 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
304 | + if ($obj->isvalid != 'Y') return new Object(); |
|
305 | 305 | |
306 | 306 | $module_srl = $obj->module_srl; |
307 | 307 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
308 | + if (!$module_srl || !$member_srl) return new Object(); |
|
309 | 309 | // Get the point module information |
310 | 310 | $oModuleModel = getModel('module'); |
311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 316 | |
317 | 317 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
319 | 319 | // Increase the point |
320 | 320 | $cur_point -= $point; |
321 | - $this->setPoint($member_srl,$cur_point); |
|
321 | + $this->setPoint($member_srl, $cur_point); |
|
322 | 322 | |
323 | 323 | return new Object(); |
324 | 324 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | $logged_info = Context::get('logged_info'); |
332 | 332 | $member_srl = $logged_info->member_srl; |
333 | 333 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
334 | + if (!$module_srl) return new Object(); |
|
335 | 335 | // Pass if it is your file |
336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
336 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
337 | 337 | |
338 | 338 | $oModuleModel = getModel('module'); |
339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
341 | 341 | // If it is set not to allow downloading for non-logged in users, do not permit |
342 | - if(!Context::get('is_logged')) |
|
342 | + if (!Context::get('is_logged')) |
|
343 | 343 | { |
344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
344 | + if ($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1, 'msg_not_permitted_download'); |
|
345 | 345 | else return new Object(); |
346 | 346 | } |
347 | 347 | // Get the points of the member |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | $cur_point = $oPointModel->getPoint($member_srl, true); |
350 | 350 | // Get the points |
351 | 351 | $point = $module_config['download_file']; |
352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
352 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
353 | 353 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
354 | + if ($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1, 'msg_cannot_download'); |
|
355 | 355 | |
356 | 356 | return new Object(); |
357 | 357 | } |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | { |
364 | 364 | // Run only when logged in |
365 | 365 | $logged_info = Context::get('logged_info'); |
366 | - if(!$logged_info->member_srl) return new Object(); |
|
366 | + if (!$logged_info->member_srl) return new Object(); |
|
367 | 367 | $module_srl = $obj->module_srl; |
368 | 368 | $member_srl = $logged_info->member_srl; |
369 | - if(!$module_srl) return new Object(); |
|
369 | + if (!$module_srl) return new Object(); |
|
370 | 370 | // Pass if it is your file |
371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
371 | + if (abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
372 | 372 | // Get the point module information |
373 | 373 | $oModuleModel = getModel('module'); |
374 | 374 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | $cur_point = $oPointModel->getPoint($member_srl, true); |
379 | 379 | // Get the points |
380 | 380 | $point = $module_config['download_file']; |
381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
381 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
382 | 382 | // Increase the point |
383 | 383 | $cur_point += $point; |
384 | - $this->setPoint($member_srl,$cur_point); |
|
384 | + $this->setPoint($member_srl, $cur_point); |
|
385 | 385 | |
386 | 386 | return new Object(); |
387 | 387 | } |
@@ -400,22 +400,22 @@ discard block |
||
400 | 400 | // Get the original author number |
401 | 401 | $target_member_srl = abs($obj->get('member_srl')); |
402 | 402 | // Pass without increasing the hits if the viewer is the same as the author |
403 | - if($target_member_srl == $member_srl) return new Object(); |
|
403 | + if ($target_member_srl == $member_srl) return new Object(); |
|
404 | 404 | // Get the point information for each module |
405 | 405 | $config = $oModuleModel->getModuleConfig('point'); |
406 | 406 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
407 | 407 | // Get hits points |
408 | 408 | $point = $module_config['read_document']; |
409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
409 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
410 | 410 | // Pass if there are no requested points |
411 | - if(!$point) return new Object(); |
|
411 | + if (!$point) return new Object(); |
|
412 | 412 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
413 | - if($member_srl) |
|
413 | + if ($member_srl) |
|
414 | 414 | { |
415 | 415 | $args->member_srl = $member_srl; |
416 | 416 | $args->document_srl = $obj->document_srl; |
417 | 417 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
418 | - if($output->data->count) return new Object(); |
|
418 | + if ($output->data->count) return new Object(); |
|
419 | 419 | $cur_point = $oPointModel->getPoint($member_srl, true); |
420 | 420 | } |
421 | 421 | else |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $config = $oModuleModel->getModuleConfig('point'); |
427 | 427 | // When the requested points are negative, compared it with the current point |
428 | 428 | $_SESSION['banned_document'][$obj->document_srl] = false; |
429 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
429 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
430 | 430 | { |
431 | 431 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
432 | 432 | $obj->add('content', $message); |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | return new Object(-1, $message); |
435 | 435 | } |
436 | 436 | // If not logged in, pass |
437 | - if(!$logged_info->member_srl) return new Object(); |
|
437 | + if (!$logged_info->member_srl) return new Object(); |
|
438 | 438 | // Pass, if there are no requested points |
439 | - if(!$point) return new Object(); |
|
439 | + if (!$point) return new Object(); |
|
440 | 440 | // If the read record is missing, leave it |
441 | 441 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
442 | 442 | // Increase the point |
443 | 443 | $cur_point += $point; |
444 | - $this->setPoint($member_srl,$cur_point); |
|
444 | + $this->setPoint($member_srl, $cur_point); |
|
445 | 445 | |
446 | 446 | return new Object(); |
447 | 447 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | { |
454 | 454 | $module_srl = $obj->module_srl; |
455 | 455 | $member_srl = $obj->member_srl; |
456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
456 | + if (!$module_srl || !$member_srl) return new Object(); |
|
457 | 457 | |
458 | 458 | $oModuleModel = getModel('module'); |
459 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -462,21 +462,21 @@ discard block |
||
462 | 462 | $oPointModel = getModel('point'); |
463 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
464 | 464 | |
465 | - if( $obj->point > 0 ) |
|
465 | + if ($obj->point > 0) |
|
466 | 466 | { |
467 | 467 | $point = $module_config['voted']; |
468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
468 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
469 | 469 | } |
470 | 470 | else |
471 | 471 | { |
472 | 472 | $point = $module_config['blamed']; |
473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
473 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
474 | 474 | } |
475 | 475 | |
476 | - if(!$point) return new Object(); |
|
476 | + if (!$point) return new Object(); |
|
477 | 477 | // Increase the point |
478 | 478 | $cur_point += $point; |
479 | - $this->setPoint($member_srl,$cur_point); |
|
479 | + $this->setPoint($member_srl, $cur_point); |
|
480 | 480 | |
481 | 481 | return new Object(); |
482 | 482 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | { |
489 | 489 | $member_srl = abs($member_srl); |
490 | 490 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
491 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
492 | 492 | |
493 | 493 | // Get configuration information |
494 | 494 | $oMemberModel = getModel('member'); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $args->member_srl = $member_srl; |
506 | 506 | $args->point = $current_point; |
507 | 507 | |
508 | - switch($mode) |
|
508 | + switch ($mode) |
|
509 | 509 | { |
510 | 510 | case 'add' : |
511 | 511 | $args->point += $point; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $args->point = $point; |
519 | 519 | break; |
520 | 520 | } |
521 | - if($args->point < 0) $args->point = 0; |
|
521 | + if ($args->point < 0) $args->point = 0; |
|
522 | 522 | $point = $args->point; |
523 | 523 | |
524 | 524 | // Call a trigger (before) |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $trigger_obj->current_level = $current_level; |
530 | 530 | $trigger_obj->set_point = $point; |
531 | 531 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
532 | - if(!$trigger_output->toBool()) |
|
532 | + if (!$trigger_output->toBool()) |
|
533 | 533 | { |
534 | 534 | return $trigger_output; |
535 | 535 | } |
@@ -540,19 +540,19 @@ discard block |
||
540 | 540 | |
541 | 541 | // If there are points, update, if no, insert |
542 | 542 | $oPointModel = getModel('point'); |
543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
543 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
544 | 544 | else executeQuery("point.insertPoint", $args); |
545 | 545 | |
546 | 546 | // Get a new level |
547 | 547 | $level = $oPointModel->getLevel($point, $config->level_step); |
548 | 548 | |
549 | 549 | // If existing level and a new one are different attempt to set a point group |
550 | - if($level != $current_level) |
|
550 | + if ($level != $current_level) |
|
551 | 551 | { |
552 | 552 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
553 | 553 | $point_group = $config->point_group; |
554 | 554 | // If the point group exists |
555 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
555 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
556 | 556 | { |
557 | 557 | // Get the default group |
558 | 558 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -562,29 +562,29 @@ discard block |
||
562 | 562 | |
563 | 563 | asort($point_group); |
564 | 564 | // Reset group after initialization |
565 | - if($config->group_reset != 'N') |
|
565 | + if ($config->group_reset != 'N') |
|
566 | 566 | { |
567 | 567 | // If the new level is in the right group |
568 | - if(in_array($level, $point_group)) |
|
568 | + if (in_array($level, $point_group)) |
|
569 | 569 | { |
570 | 570 | // Delete all groups except the one which the current level belongs to |
571 | - foreach($point_group as $group_srl => $target_level) |
|
571 | + foreach ($point_group as $group_srl => $target_level) |
|
572 | 572 | { |
573 | 573 | $del_group_list[] = $group_srl; |
574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
574 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
575 | 575 | } |
576 | 576 | } |
577 | 577 | // Otherwise, in case the level is reduced, add the recent group |
578 | 578 | else |
579 | 579 | { |
580 | 580 | $i = $level; |
581 | - while($i > 0) |
|
581 | + while ($i > 0) |
|
582 | 582 | { |
583 | - if(in_array($i, $point_group)) |
|
583 | + if (in_array($i, $point_group)) |
|
584 | 584 | { |
585 | - foreach($point_group as $group_srl => $target_level) |
|
585 | + foreach ($point_group as $group_srl => $target_level) |
|
586 | 586 | { |
587 | - if($target_level == $i) |
|
587 | + if ($target_level == $i) |
|
588 | 588 | { |
589 | 589 | $new_group_list[] = $group_srl; |
590 | 590 | } |
@@ -595,9 +595,9 @@ discard block |
||
595 | 595 | } |
596 | 596 | } |
597 | 597 | // Delete the group of a level which is higher than the current level |
598 | - foreach($point_group as $group_srl => $target_level) |
|
598 | + foreach ($point_group as $group_srl => $target_level) |
|
599 | 599 | { |
600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
600 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
601 | 601 | } |
602 | 602 | $del_group_list[] = $default_group->group_srl; |
603 | 603 | } |
@@ -605,16 +605,16 @@ discard block |
||
605 | 605 | else |
606 | 606 | { |
607 | 607 | // Check until the current level by rotating setting the configurations of the point groups |
608 | - foreach($point_group as $group_srl => $target_level) |
|
608 | + foreach ($point_group as $group_srl => $target_level) |
|
609 | 609 | { |
610 | 610 | $del_group_list[] = $group_srl; |
611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
611 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | // If there is no a new group, granted the default group |
615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
615 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
616 | 616 | // Remove linkage group |
617 | - if($del_group_list && count($del_group_list)) |
|
617 | + if ($del_group_list && count($del_group_list)) |
|
618 | 618 | { |
619 | 619 | $del_group_args = new stdClass; |
620 | 620 | $del_group_args->member_srl = $member_srl; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
623 | 623 | } |
624 | 624 | // Grant a new group |
625 | - foreach($new_group_list as $group_srl) |
|
625 | + foreach ($new_group_list as $group_srl) |
|
626 | 626 | { |
627 | 627 | $new_group_args = new stdClass; |
628 | 628 | $new_group_args->member_srl = $member_srl; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $trigger_obj->del_group_list = $del_group_list; |
638 | 638 | $trigger_obj->new_level = $level; |
639 | 639 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
640 | - if(!$trigger_output->toBool()) |
|
640 | + if (!$trigger_output->toBool()) |
|
641 | 641 | { |
642 | 642 | $oDB->rollback(); |
643 | 643 | return $trigger_output; |
@@ -653,17 +653,17 @@ discard block |
||
653 | 653 | FileHandler::writeFile($cache_filename, $point); |
654 | 654 | |
655 | 655 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
656 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
656 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
657 | 657 | { |
658 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
658 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
659 | 659 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
660 | 660 | $oCacheHandler->delete($cache_key); |
661 | 661 | } |
662 | 662 | |
663 | 663 | $oCacheHandler = CacheHandler::getInstance('object'); |
664 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
664 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
665 | 665 | { |
666 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
666 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
667 | 667 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
668 | 668 | $oCacheHandler->delete($cache_key); |
669 | 669 | } |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
678 | 678 | |
679 | 679 | $oModuleController = getController('module'); |
680 | - if(is_array($obj->moduleSrlList)) |
|
680 | + if (is_array($obj->moduleSrlList)) |
|
681 | 681 | { |
682 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
682 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
683 | 683 | { |
684 | 684 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
685 | 685 | } |
@@ -42,9 +42,13 @@ discard block |
||
42 | 42 | function triggerAfterLogin(&$obj) |
43 | 43 | { |
44 | 44 | $member_srl = $obj->member_srl; |
45 | - if(!$member_srl) return new Object(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new Object(); |
|
47 | + } |
|
46 | 48 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new Object(); |
|
51 | + } |
|
48 | 52 | // Get the point module information |
49 | 53 | $oModuleModel = getModel('module'); |
50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
70 | 74 | { |
71 | 75 | $module_srl = $obj->module_srl; |
72 | 76 | $member_srl = $obj->member_srl; |
73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new Object(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new Object(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new Object(); |
|
83 | + } |
|
76 | 84 | // Get the point module information |
77 | 85 | $oModuleModel = getModel('module'); |
78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
83 | 91 | |
84 | 92 | $point = $module_config['insert_document']; |
85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
94 | + $point = $config->insert_document; |
|
95 | + } |
|
86 | 96 | $cur_point += $point; |
87 | 97 | // Add points for attaching a file |
88 | 98 | $point = $module_config['upload_file']; |
89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
100 | + $point = $config->upload_file; |
|
101 | + } |
|
102 | + if($obj->uploaded_count) { |
|
103 | + $cur_point += $point * $obj->uploaded_count; |
|
104 | + } |
|
91 | 105 | // Increase the point |
92 | 106 | $this->setPoint($member_srl,$cur_point); |
93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
119 | 133 | |
120 | 134 | $point = $module_config['insert_document']; |
121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
136 | + $point = $config->insert_document; |
|
137 | + } |
|
122 | 138 | $cur_point += $point; |
123 | 139 | // Add points for attaching a file |
124 | 140 | $point = $module_config['upload_file']; |
125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
142 | + $point = $config->upload_file; |
|
143 | + } |
|
144 | + if($obj->uploaded_count) { |
|
145 | + $cur_point += $point * $obj->uploaded_count; |
|
146 | + } |
|
127 | 147 | // Increase the point |
128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
141 | 161 | |
142 | 162 | $oDocumentModel = getModel('document'); |
143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
144 | - if(!$oDocument->isExists()) return new Object(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new Object(); |
|
166 | + } |
|
145 | 167 | // Get the point module information |
146 | 168 | $oModuleModel = getModel('module'); |
147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
149 | 171 | // The process related to clearing the post comments |
150 | 172 | $comment_point = $module_config['insert_comment']; |
151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
174 | + $comment_point = $config->insert_comment; |
|
175 | + } |
|
152 | 176 | // If there are comment points, attempt to deduct |
153 | - if($comment_point>0) return new Object(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new Object(); |
|
179 | + } |
|
154 | 180 | // Get all the comments related to this post |
155 | 181 | $cp_args = new stdClass(); |
156 | 182 | $cp_args->document_srl = $document_srl; |
157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
158 | 184 | // Return if there is no object |
159 | - if(!$output->data) return new Object(); |
|
185 | + if(!$output->data) { |
|
186 | + return new Object(); |
|
187 | + } |
|
160 | 188 | // Organize the member number |
161 | 189 | $member_srls = array(); |
162 | 190 | $cnt = count($output->data); |
163 | 191 | for($i=0;$i<$cnt;$i++) |
164 | 192 | { |
165 | - if($output->data[$i]->member_srl<1) continue; |
|
193 | + if($output->data[$i]->member_srl<1) { |
|
194 | + continue; |
|
195 | + } |
|
166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
167 | 197 | } |
168 | 198 | // Remove the member number who has written the original post |
169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | - if(!count($member_srls)) return new Object(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new Object(); |
|
204 | + } |
|
171 | 205 | // Remove all the points for each member |
172 | 206 | $oPointModel = getModel('point'); |
173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
194 | 228 | $module_srl = $obj->module_srl; |
195 | 229 | $member_srl = $obj->member_srl; |
196 | 230 | // The process related to clearing the post object |
197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new Object(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new Object(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new Object(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
208 | 246 | |
209 | 247 | $point = $module_config['insert_document']; |
210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
249 | + $point = $config->insert_document; |
|
250 | + } |
|
211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
212 | - if($point < 0) return new Object(); |
|
252 | + if($point < 0) { |
|
253 | + return new Object(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Add points related to deleting an attachment |
215 | 257 | $point = $module_config['upload_file']; |
216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
259 | + $point = $config->upload_file; |
|
260 | + } |
|
261 | + if($obj->uploaded_count) { |
|
262 | + $cur_point -= $point * $obj->uploaded_count; |
|
263 | + } |
|
218 | 264 | // Increase the point |
219 | 265 | $this->setPoint($member_srl,$cur_point); |
220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
229 | 275 | { |
230 | 276 | $module_srl = $obj->module_srl; |
231 | 277 | $member_srl = $obj->member_srl; |
232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
278 | + if(!$module_srl || !$member_srl) { |
|
279 | + return new Object(); |
|
280 | + } |
|
233 | 281 | // Do not increase the points if the member is the author of the post |
234 | 282 | $document_srl = $obj->document_srl; |
235 | 283 | $oDocumentModel = getModel('document'); |
236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
286 | + return new Object(); |
|
287 | + } |
|
238 | 288 | // Get the point module information |
239 | 289 | $oModuleModel = getModel('module'); |
240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
245 | 295 | |
246 | 296 | $point = $module_config['insert_comment']; |
247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
298 | + $point = $config->insert_comment; |
|
299 | + } |
|
248 | 300 | // Increase the point |
249 | 301 | $cur_point += $point; |
250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
264 | 316 | $module_srl = $obj->module_srl; |
265 | 317 | $member_srl = abs($obj->member_srl); |
266 | 318 | $document_srl = $obj->document_srl; |
267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
319 | + if(!$module_srl || !$member_srl) { |
|
320 | + return new Object(); |
|
321 | + } |
|
268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
270 | - if(!$oDocument->isExists()) return new Object(); |
|
271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
324 | + if(!$oDocument->isExists()) { |
|
325 | + return new Object(); |
|
326 | + } |
|
327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
328 | + return new Object(); |
|
329 | + } |
|
272 | 330 | // Get the point module information |
273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
277 | 335 | |
278 | 336 | $point = $module_config['insert_comment']; |
279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
338 | + $point = $config->insert_comment; |
|
339 | + } |
|
280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
281 | - if($point < 0) return new Object(); |
|
341 | + if($point < 0) { |
|
342 | + return new Object(); |
|
343 | + } |
|
282 | 344 | // Increase the point |
283 | 345 | $cur_point -= $point; |
284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
301 | 363 | */ |
302 | 364 | function triggerDeleteFile(&$obj) |
303 | 365 | { |
304 | - if($obj->isvalid != 'Y') return new Object(); |
|
366 | + if($obj->isvalid != 'Y') { |
|
367 | + return new Object(); |
|
368 | + } |
|
305 | 369 | |
306 | 370 | $module_srl = $obj->module_srl; |
307 | 371 | $member_srl = $obj->member_srl; |
308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
372 | + if(!$module_srl || !$member_srl) { |
|
373 | + return new Object(); |
|
374 | + } |
|
309 | 375 | // Get the point module information |
310 | 376 | $oModuleModel = getModel('module'); |
311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
316 | 382 | |
317 | 383 | $point = $module_config['upload_file']; |
318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
385 | + $point = $config->upload_file; |
|
386 | + } |
|
319 | 387 | // Increase the point |
320 | 388 | $cur_point -= $point; |
321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,9 +399,13 @@ discard block |
||
331 | 399 | $logged_info = Context::get('logged_info'); |
332 | 400 | $member_srl = $logged_info->member_srl; |
333 | 401 | $module_srl = $obj->module_srl; |
334 | - if(!$module_srl) return new Object(); |
|
402 | + if(!$module_srl) { |
|
403 | + return new Object(); |
|
404 | + } |
|
335 | 405 | // Pass if it is your file |
336 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
406 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
407 | + return new Object(); |
|
408 | + } |
|
337 | 409 | |
338 | 410 | $oModuleModel = getModel('module'); |
339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -341,17 +413,24 @@ discard block |
||
341 | 413 | // If it is set not to allow downloading for non-logged in users, do not permit |
342 | 414 | if(!Context::get('is_logged')) |
343 | 415 | { |
344 | - if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) return new Object(-1,'msg_not_permitted_download'); |
|
345 | - else return new Object(); |
|
416 | + if($config->disable_download == 'Y' && strlen($module_config['download_file']) == 0 && !is_int($module_config['download_file'])) { |
|
417 | + return new Object(-1,'msg_not_permitted_download'); |
|
418 | + } else { |
|
419 | + return new Object(); |
|
420 | + } |
|
346 | 421 | } |
347 | 422 | // Get the points of the member |
348 | 423 | $oPointModel = getModel('point'); |
349 | 424 | $cur_point = $oPointModel->getPoint($member_srl, true); |
350 | 425 | // Get the points |
351 | 426 | $point = $module_config['download_file']; |
352 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
427 | + if(strlen($point) == 0 && !is_int($point)) { |
|
428 | + $point = $config->download_file; |
|
429 | + } |
|
353 | 430 | // If points are less than 0, and if downloading a file is not allowed in this case, give an errors |
354 | - if($cur_point + $point < 0 && $config->disable_download == 'Y') return new Object(-1,'msg_cannot_download'); |
|
431 | + if($cur_point + $point < 0 && $config->disable_download == 'Y') { |
|
432 | + return new Object(-1,'msg_cannot_download'); |
|
433 | + } |
|
355 | 434 | |
356 | 435 | return new Object(); |
357 | 436 | } |
@@ -363,12 +442,18 @@ discard block |
||
363 | 442 | { |
364 | 443 | // Run only when logged in |
365 | 444 | $logged_info = Context::get('logged_info'); |
366 | - if(!$logged_info->member_srl) return new Object(); |
|
445 | + if(!$logged_info->member_srl) { |
|
446 | + return new Object(); |
|
447 | + } |
|
367 | 448 | $module_srl = $obj->module_srl; |
368 | 449 | $member_srl = $logged_info->member_srl; |
369 | - if(!$module_srl) return new Object(); |
|
450 | + if(!$module_srl) { |
|
451 | + return new Object(); |
|
452 | + } |
|
370 | 453 | // Pass if it is your file |
371 | - if(abs($obj->member_srl) == abs($member_srl)) return new Object(); |
|
454 | + if(abs($obj->member_srl) == abs($member_srl)) { |
|
455 | + return new Object(); |
|
456 | + } |
|
372 | 457 | // Get the point module information |
373 | 458 | $oModuleModel = getModel('module'); |
374 | 459 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -378,7 +463,9 @@ discard block |
||
378 | 463 | $cur_point = $oPointModel->getPoint($member_srl, true); |
379 | 464 | // Get the points |
380 | 465 | $point = $module_config['download_file']; |
381 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->download_file; |
|
466 | + if(strlen($point) == 0 && !is_int($point)) { |
|
467 | + $point = $config->download_file; |
|
468 | + } |
|
382 | 469 | // Increase the point |
383 | 470 | $cur_point += $point; |
384 | 471 | $this->setPoint($member_srl,$cur_point); |
@@ -400,25 +487,32 @@ discard block |
||
400 | 487 | // Get the original author number |
401 | 488 | $target_member_srl = abs($obj->get('member_srl')); |
402 | 489 | // Pass without increasing the hits if the viewer is the same as the author |
403 | - if($target_member_srl == $member_srl) return new Object(); |
|
490 | + if($target_member_srl == $member_srl) { |
|
491 | + return new Object(); |
|
492 | + } |
|
404 | 493 | // Get the point information for each module |
405 | 494 | $config = $oModuleModel->getModuleConfig('point'); |
406 | 495 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
407 | 496 | // Get hits points |
408 | 497 | $point = $module_config['read_document']; |
409 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
498 | + if(strlen($point) == 0 && !is_int($point)) { |
|
499 | + $point = $config->read_document; |
|
500 | + } |
|
410 | 501 | // Pass if there are no requested points |
411 | - if(!$point) return new Object(); |
|
502 | + if(!$point) { |
|
503 | + return new Object(); |
|
504 | + } |
|
412 | 505 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
413 | 506 | if($member_srl) |
414 | 507 | { |
415 | 508 | $args->member_srl = $member_srl; |
416 | 509 | $args->document_srl = $obj->document_srl; |
417 | 510 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
418 | - if($output->data->count) return new Object(); |
|
511 | + if($output->data->count) { |
|
512 | + return new Object(); |
|
513 | + } |
|
419 | 514 | $cur_point = $oPointModel->getPoint($member_srl, true); |
420 | - } |
|
421 | - else |
|
515 | + } else |
|
422 | 516 | { |
423 | 517 | $cur_point = 0; |
424 | 518 | } |
@@ -434,9 +528,13 @@ discard block |
||
434 | 528 | return new Object(-1, $message); |
435 | 529 | } |
436 | 530 | // If not logged in, pass |
437 | - if(!$logged_info->member_srl) return new Object(); |
|
531 | + if(!$logged_info->member_srl) { |
|
532 | + return new Object(); |
|
533 | + } |
|
438 | 534 | // Pass, if there are no requested points |
439 | - if(!$point) return new Object(); |
|
535 | + if(!$point) { |
|
536 | + return new Object(); |
|
537 | + } |
|
440 | 538 | // If the read record is missing, leave it |
441 | 539 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
442 | 540 | // Increase the point |
@@ -453,7 +551,9 @@ discard block |
||
453 | 551 | { |
454 | 552 | $module_srl = $obj->module_srl; |
455 | 553 | $member_srl = $obj->member_srl; |
456 | - if(!$module_srl || !$member_srl) return new Object(); |
|
554 | + if(!$module_srl || !$member_srl) { |
|
555 | + return new Object(); |
|
556 | + } |
|
457 | 557 | |
458 | 558 | $oModuleModel = getModel('module'); |
459 | 559 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -465,15 +565,20 @@ discard block |
||
465 | 565 | if( $obj->point > 0 ) |
466 | 566 | { |
467 | 567 | $point = $module_config['voted']; |
468 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
469 | - } |
|
470 | - else |
|
568 | + if(strlen($point) == 0 && !is_int($point)) { |
|
569 | + $point = $config->voted; |
|
570 | + } |
|
571 | + } else |
|
471 | 572 | { |
472 | 573 | $point = $module_config['blamed']; |
473 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
574 | + if(strlen($point) == 0 && !is_int($point)) { |
|
575 | + $point = $config->blamed; |
|
576 | + } |
|
474 | 577 | } |
475 | 578 | |
476 | - if(!$point) return new Object(); |
|
579 | + if(!$point) { |
|
580 | + return new Object(); |
|
581 | + } |
|
477 | 582 | // Increase the point |
478 | 583 | $cur_point += $point; |
479 | 584 | $this->setPoint($member_srl,$cur_point); |
@@ -488,7 +593,9 @@ discard block |
||
488 | 593 | { |
489 | 594 | $member_srl = abs($member_srl); |
490 | 595 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
491 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
596 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
597 | + $mode = 'update'; |
|
598 | + } |
|
492 | 599 | |
493 | 600 | // Get configuration information |
494 | 601 | $oMemberModel = getModel('member'); |
@@ -518,7 +625,9 @@ discard block |
||
518 | 625 | $args->point = $point; |
519 | 626 | break; |
520 | 627 | } |
521 | - if($args->point < 0) $args->point = 0; |
|
628 | + if($args->point < 0) { |
|
629 | + $args->point = 0; |
|
630 | + } |
|
522 | 631 | $point = $args->point; |
523 | 632 | |
524 | 633 | // Call a trigger (before) |
@@ -540,8 +649,11 @@ discard block |
||
540 | 649 | |
541 | 650 | // If there are points, update, if no, insert |
542 | 651 | $oPointModel = getModel('point'); |
543 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
544 | - else executeQuery("point.insertPoint", $args); |
|
652 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
653 | + executeQuery("point.updatePoint", $args); |
|
654 | + } else { |
|
655 | + executeQuery("point.insertPoint", $args); |
|
656 | + } |
|
545 | 657 | |
546 | 658 | // Get a new level |
547 | 659 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -571,7 +683,9 @@ discard block |
||
571 | 683 | foreach($point_group as $group_srl => $target_level) |
572 | 684 | { |
573 | 685 | $del_group_list[] = $group_srl; |
574 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
686 | + if($target_level == $level) { |
|
687 | + $new_group_list[] = $group_srl; |
|
688 | + } |
|
575 | 689 | } |
576 | 690 | } |
577 | 691 | // Otherwise, in case the level is reduced, add the recent group |
@@ -597,7 +711,9 @@ discard block |
||
597 | 711 | // Delete the group of a level which is higher than the current level |
598 | 712 | foreach($point_group as $group_srl => $target_level) |
599 | 713 | { |
600 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
714 | + if($target_level > $level) { |
|
715 | + $del_group_list[] = $group_srl; |
|
716 | + } |
|
601 | 717 | } |
602 | 718 | $del_group_list[] = $default_group->group_srl; |
603 | 719 | } |
@@ -608,11 +724,15 @@ discard block |
||
608 | 724 | foreach($point_group as $group_srl => $target_level) |
609 | 725 | { |
610 | 726 | $del_group_list[] = $group_srl; |
611 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
727 | + if($target_level <= $level) { |
|
728 | + $new_group_list[] = $group_srl; |
|
729 | + } |
|
612 | 730 | } |
613 | 731 | } |
614 | 732 | // If there is no a new group, granted the default group |
615 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
733 | + if(!$new_group_list[0]) { |
|
734 | + $new_group_list[0] = $default_group->group_srl; |
|
735 | + } |
|
616 | 736 | // Remove linkage group |
617 | 737 | if($del_group_list && count($del_group_list)) |
618 | 738 | { |
@@ -85,6 +85,7 @@ |
||
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @brief Delete the poll (when several questions are registered in one poll, delete this question) |
88 | + * @param string $poll_index_srl |
|
88 | 89 | */ |
89 | 90 | function deletePollTitle($poll_index_srl) |
90 | 91 | { |
@@ -40,22 +40,22 @@ discard block |
||
40 | 40 | // Display an error no post is selected |
41 | 41 | $cart = Context::get('cart'); |
42 | 42 | |
43 | - if(is_array($cart)) $poll_srl_list = $cart; |
|
44 | - else $poll_srl_list= explode('|@|', $cart); |
|
43 | + if (is_array($cart)) $poll_srl_list = $cart; |
|
44 | + else $poll_srl_list = explode('|@|', $cart); |
|
45 | 45 | |
46 | 46 | $poll_count = count($poll_srl_list); |
47 | - if(!$poll_count) return $this->stop('msg_cart_is_null'); |
|
47 | + if (!$poll_count) return $this->stop('msg_cart_is_null'); |
|
48 | 48 | // Delete the post |
49 | - for($i=0;$i<$poll_count;$i++) |
|
49 | + for ($i = 0; $i < $poll_count; $i++) |
|
50 | 50 | { |
51 | 51 | $poll_index_srl = trim($poll_srl_list[$i]); |
52 | - if(!$poll_index_srl) continue; |
|
52 | + if (!$poll_index_srl) continue; |
|
53 | 53 | |
54 | 54 | $output = $this->deletePollTitle($poll_index_srl, true); |
55 | - if(!$output->toBool()) return $output; |
|
55 | + if (!$output->toBool()) return $output; |
|
56 | 56 | } |
57 | 57 | |
58 | - $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) ); |
|
58 | + $this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count)); |
|
59 | 59 | |
60 | 60 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList'); |
61 | 61 | $this->setRedirectUrl($returnUrl); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | function procPollAdminAddCart() |
65 | 65 | { |
66 | - $poll_index_srl = (int)Context::get('poll_index_srl'); |
|
66 | + $poll_index_srl = (int) Context::get('poll_index_srl'); |
|
67 | 67 | |
68 | 68 | $oPollAdminModel = getAdminModel('poll'); |
69 | 69 | //$columnList = array('comment_srl'); |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | $output = $oPollAdminModel->getPollList($args); |
75 | 75 | |
76 | - if(is_array($output->data)) |
|
76 | + if (is_array($output->data)) |
|
77 | 77 | { |
78 | - foreach($output->data AS $key=>$value) |
|
78 | + foreach ($output->data AS $key=>$value) |
|
79 | 79 | { |
80 | - if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
80 | + if ($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
81 | 81 | else $_SESSION['poll_management'][$value->poll_index_srl] = true; |
82 | 82 | } |
83 | 83 | } |
@@ -97,36 +97,36 @@ discard block |
||
97 | 97 | $oDB->begin(); |
98 | 98 | |
99 | 99 | $output = executeQueryArray('poll.getPollByDeletePollTitle', $args); |
100 | - if($output->toBool() && $output->data && $output->data[0]->count == 1) |
|
100 | + if ($output->toBool() && $output->data && $output->data[0]->count == 1) |
|
101 | 101 | { |
102 | 102 | $dargs->poll_srl = $output->data[0]->poll_srl; |
103 | 103 | } |
104 | 104 | |
105 | 105 | $output = $oDB->executeQuery('poll.deletePollTitle', $args); |
106 | - if(!$output) |
|
106 | + if (!$output) |
|
107 | 107 | { |
108 | 108 | $oDB->rollback(); |
109 | 109 | return $output; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $output = $oDB->executeQuery('poll.deletePollItem', $args); |
113 | - if(!$output) |
|
113 | + if (!$output) |
|
114 | 114 | { |
115 | 115 | $oDB->rollback(); |
116 | 116 | return $output; |
117 | 117 | } |
118 | 118 | |
119 | - if($dargs->poll_srl) |
|
119 | + if ($dargs->poll_srl) |
|
120 | 120 | { |
121 | 121 | $output = executeQuery('poll.deletePoll', $dargs); |
122 | - if(!$output) |
|
122 | + if (!$output) |
|
123 | 123 | { |
124 | 124 | $oDB->rollback(); |
125 | 125 | return $output; |
126 | 126 | } |
127 | 127 | |
128 | 128 | $output = executeQuery('poll.deletePollLog', $dargs); |
129 | - if(!$output) |
|
129 | + if (!$output) |
|
130 | 130 | { |
131 | 131 | $oDB->rollback(); |
132 | 132 | return $output; |
@@ -149,21 +149,21 @@ discard block |
||
149 | 149 | $oDB->begin(); |
150 | 150 | |
151 | 151 | $output = $oDB->executeQuery('poll.deletePoll', $args); |
152 | - if(!$output) |
|
152 | + if (!$output) |
|
153 | 153 | { |
154 | 154 | $oDB->rollback(); |
155 | 155 | return $output; |
156 | 156 | } |
157 | 157 | |
158 | 158 | $output = $oDB->executeQuery('poll.deletePollTitle', $args); |
159 | - if(!$output) |
|
159 | + if (!$output) |
|
160 | 160 | { |
161 | 161 | $oDB->rollback(); |
162 | 162 | return $output; |
163 | 163 | } |
164 | 164 | |
165 | 165 | $output = $oDB->executeQuery('poll.deletePollItem', $args); |
166 | - if(!$output) |
|
166 | + if (!$output) |
|
167 | 167 | { |
168 | 168 | $oDB->rollback(); |
169 | 169 | return $output; |
@@ -40,19 +40,28 @@ discard block |
||
40 | 40 | // Display an error no post is selected |
41 | 41 | $cart = Context::get('cart'); |
42 | 42 | |
43 | - if(is_array($cart)) $poll_srl_list = $cart; |
|
44 | - else $poll_srl_list= explode('|@|', $cart); |
|
43 | + if(is_array($cart)) { |
|
44 | + $poll_srl_list = $cart; |
|
45 | + } else { |
|
46 | + $poll_srl_list= explode('|@|', $cart); |
|
47 | + } |
|
45 | 48 | |
46 | 49 | $poll_count = count($poll_srl_list); |
47 | - if(!$poll_count) return $this->stop('msg_cart_is_null'); |
|
50 | + if(!$poll_count) { |
|
51 | + return $this->stop('msg_cart_is_null'); |
|
52 | + } |
|
48 | 53 | // Delete the post |
49 | 54 | for($i=0;$i<$poll_count;$i++) |
50 | 55 | { |
51 | 56 | $poll_index_srl = trim($poll_srl_list[$i]); |
52 | - if(!$poll_index_srl) continue; |
|
57 | + if(!$poll_index_srl) { |
|
58 | + continue; |
|
59 | + } |
|
53 | 60 | |
54 | 61 | $output = $this->deletePollTitle($poll_index_srl, true); |
55 | - if(!$output->toBool()) return $output; |
|
62 | + if(!$output->toBool()) { |
|
63 | + return $output; |
|
64 | + } |
|
56 | 65 | } |
57 | 66 | |
58 | 67 | $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) ); |
@@ -77,8 +86,11 @@ discard block |
||
77 | 86 | { |
78 | 87 | foreach($output->data AS $key=>$value) |
79 | 88 | { |
80 | - if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
81 | - else $_SESSION['poll_management'][$value->poll_index_srl] = true; |
|
89 | + if($_SESSION['poll_management'][$value->poll_index_srl]) { |
|
90 | + unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
91 | + } else { |
|
92 | + $_SESSION['poll_management'][$value->poll_index_srl] = true; |
|
93 | + } |
|
82 | 94 | } |
83 | 95 | } |
84 | 96 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | /** |
111 | 111 | * RSS Module configurations |
112 | 112 | * |
113 | - * @return void |
|
113 | + * @return Object|null |
|
114 | 114 | */ |
115 | 115 | function procRssAdminInsertModuleConfig() |
116 | 116 | { |
@@ -29,8 +29,12 @@ discard block |
||
29 | 29 | $config_vars = Context::getRequestVars(); |
30 | 30 | $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
31 | 31 | |
32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
32 | + if(!$config_vars->use_total_feed) { |
|
33 | + $alt_message = 'msg_invalid_request'; |
|
34 | + } |
|
35 | + if(!in_array($config_vars->use_total_feed, array('Y','N'))) { |
|
36 | + $config_vars->open_rss = 'Y'; |
|
37 | + } |
|
34 | 38 | |
35 | 39 | if($config_vars->image || $config_vars->del_image) |
36 | 40 | { |
@@ -49,20 +53,23 @@ discard block |
||
49 | 53 | // Ignore if the file is not an image (swf is accepted ~) |
50 | 54 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
51 | 55 | |
52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
53 | - else |
|
56 | + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { |
|
57 | + $alt_message = 'msg_rss_invalid_image_format'; |
|
58 | + } else |
|
54 | 59 | { |
55 | 60 | // Upload the file to a path |
56 | 61 | $path = './files/attach/images/rss/'; |
57 | 62 | // Create a directory |
58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
59 | - else |
|
63 | + if(!FileHandler::makeDir($path)) { |
|
64 | + $alt_message = 'msg_error_occured'; |
|
65 | + } else |
|
60 | 66 | { |
61 | 67 | $filename = $path.$image_obj['name']; |
62 | 68 | |
63 | 69 | // Move the file |
64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
65 | - else |
|
70 | + if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { |
|
71 | + $alt_message = 'msg_error_occured'; |
|
72 | + } else |
|
66 | 73 | { |
67 | 74 | $config_vars->image = $filename; |
68 | 75 | } |
@@ -70,11 +77,15 @@ discard block |
||
70 | 77 | } |
71 | 78 | } |
72 | 79 | } |
73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
80 | + if(!$config_vars->image && $config_vars->del_image != 'Y') { |
|
81 | + $config_vars->image = $total_config->image; |
|
82 | + } |
|
74 | 83 | |
75 | 84 | $output = $this->setFeedConfig($config_vars); |
76 | 85 | |
77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
86 | + if(!$alt_message) { |
|
87 | + $alt_message = 'success_updated'; |
|
88 | + } |
|
78 | 89 | |
79 | 90 | $alt_message = Context::getLang($alt_message); |
80 | 91 | $this->setMessage($alt_message, 'info'); |
@@ -139,7 +150,9 @@ discard block |
||
139 | 150 | return new Object(-1, 'msg_invalid_request'); |
140 | 151 | } |
141 | 152 | |
142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
153 | + if(!in_array($open_rss, array('Y','H','N'))) { |
|
154 | + $open_rss = 'N'; |
|
155 | + } |
|
143 | 156 | |
144 | 157 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
145 | 158 | } |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | $total_config = $oModuleModel->getModuleConfig('rss'); |
28 | 28 | |
29 | 29 | $config_vars = Context::getRequestVars(); |
30 | - $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
|
30 | + $config_vars->feed_document_count = (int) $config_vars->feed_document_count; |
|
31 | 31 | |
32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
32 | + if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | + if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y'; |
|
34 | 34 | |
35 | - if($config_vars->image || $config_vars->del_image) |
|
35 | + if ($config_vars->image || $config_vars->del_image) |
|
36 | 36 | { |
37 | 37 | $image_obj = $config_vars->image; |
38 | 38 | $config_vars->image = $total_config->image; |
39 | 39 | // Get a variable for the delete request |
40 | - if($config_vars->del_image == 'Y' || $image_obj) |
|
40 | + if ($config_vars->del_image == 'Y' || $image_obj) |
|
41 | 41 | { |
42 | 42 | FileHandler::removeFile($config_vars->image); |
43 | 43 | $config_vars->image = ''; |
44 | 44 | $total_config->image = ''; |
45 | 45 | } |
46 | 46 | // Ignore if the file is not the one which has been successfully uploaded |
47 | - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
47 | + if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
48 | 48 | { |
49 | 49 | // Ignore if the file is not an image (swf is accepted ~) |
50 | 50 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
51 | 51 | |
52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
52 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
53 | 53 | else |
54 | 54 | { |
55 | 55 | // Upload the file to a path |
56 | 56 | $path = './files/attach/images/rss/'; |
57 | 57 | // Create a directory |
58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
58 | + if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
59 | 59 | else |
60 | 60 | { |
61 | 61 | $filename = $path.$image_obj['name']; |
62 | 62 | |
63 | 63 | // Move the file |
64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
64 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
65 | 65 | else |
66 | 66 | { |
67 | 67 | $config_vars->image = $filename; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
73 | + if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
74 | 74 | |
75 | 75 | $output = $this->setFeedConfig($config_vars); |
76 | 76 | |
77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
77 | + if (!$alt_message) $alt_message = 'success_updated'; |
|
78 | 78 | |
79 | 79 | $alt_message = Context::getLang($alt_message); |
80 | 80 | $this->setMessage($alt_message, 'info'); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $originConfig = $oModuleModel->getModuleConfig('rss'); |
97 | 97 | |
98 | 98 | // Get a variable for the delete request |
99 | - if($delImage == 'Y') |
|
99 | + if ($delImage == 'Y') |
|
100 | 100 | { |
101 | 101 | FileHandler::removeFile($originConfig->image); |
102 | 102 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $feedCopyrightList = $config_vars->feed_copyright; |
123 | 123 | $targetModuleSrl = $config_vars->target_module_srl; |
124 | 124 | |
125 | - if($targetModuleSrl && !is_array($openRssList)) |
|
125 | + if ($targetModuleSrl && !is_array($openRssList)) |
|
126 | 126 | { |
127 | 127 | $openRssList = array($targetModuleSrl => $openRssList); |
128 | 128 | $openTotalFeedList = array($targetModuleSrl => $openTotalFeedList); |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | $feedCopyrightList = array($targetModuleSrl => $feedCopyrightList); |
131 | 131 | } |
132 | 132 | |
133 | - if(is_array($openRssList)) |
|
133 | + if (is_array($openRssList)) |
|
134 | 134 | { |
135 | - foreach($openRssList AS $module_srl=>$open_rss) |
|
135 | + foreach ($openRssList AS $module_srl=>$open_rss) |
|
136 | 136 | { |
137 | - if(!$module_srl || !$open_rss) |
|
137 | + if (!$module_srl || !$open_rss) |
|
138 | 138 | { |
139 | 139 | return new Object(-1, 'msg_invalid_request'); |
140 | 140 | } |
141 | 141 | |
142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
142 | + if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N'; |
|
143 | 143 | |
144 | 144 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
145 | 145 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | function setFeedConfig($config) |
162 | 162 | { |
163 | 163 | $oModuleController = getController('module'); |
164 | - $oModuleController->insertModuleConfig('rss',$config); |
|
164 | + $oModuleController->insertModuleConfig('rss', $config); |
|
165 | 165 | return new Object(); |
166 | 166 | } |
167 | 167 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $config = new stdClass; |
182 | 182 | $config->open_rss = $open_rss; |
183 | 183 | $config->open_total_feed = $open_total_feed; |
184 | - if($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
185 | - if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
186 | - $oModuleController->insertModulePartConfig('rss',$module_srl,$config); |
|
184 | + if ($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
185 | + if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
186 | + $oModuleController->insertModulePartConfig('rss', $module_srl, $config); |
|
187 | 187 | return new Object(); |
188 | 188 | } |
189 | 189 | } |
@@ -98,6 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @brief Delete IP |
100 | 100 | * Remove the IP address which was previously registered as a spammers |
101 | + * @param string $ipaddress |
|
101 | 102 | */ |
102 | 103 | function deleteIP($ipaddress) |
103 | 104 | { |
@@ -111,6 +112,7 @@ discard block |
||
111 | 112 | /** |
112 | 113 | * @brief Register the spam word |
113 | 114 | * The post, which contains the newly registered spam word, should be considered as a spam |
115 | + * @param string $word_list |
|
114 | 116 | */ |
115 | 117 | function insertWord($word_list) |
116 | 118 | { |
@@ -141,6 +143,7 @@ discard block |
||
141 | 143 | /** |
142 | 144 | * @brief Remove the spam word |
143 | 145 | * Remove the word which was previously registered as a spam word |
146 | + * @param string $word |
|
144 | 147 | */ |
145 | 148 | function deleteWord($word) |
146 | 149 | { |
@@ -20,12 +20,18 @@ discard block |
||
20 | 20 | $argsConfig = Context::gets('limits','check_trackback'); |
21 | 21 | $flag = Context::get('flag'); |
22 | 22 | //interval, limit_count |
23 | - if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N'; |
|
24 | - if($argsConfig->limits!='Y') $argsConfig->limits = 'N'; |
|
23 | + if($argsConfig->check_trackback!='Y') { |
|
24 | + $argsConfig->check_trackback = 'N'; |
|
25 | + } |
|
26 | + if($argsConfig->limits!='Y') { |
|
27 | + $argsConfig->limits = 'N'; |
|
28 | + } |
|
25 | 29 | // Create and insert the module Controller object |
26 | 30 | $oModuleController = getController('module'); |
27 | 31 | $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig); |
28 | - if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
32 | + if(!$moduleConfigOutput->toBool()) { |
|
33 | + return $moduleConfigOutput; |
|
34 | + } |
|
29 | 35 | |
30 | 36 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock'); |
31 | 37 | $this->setRedirectUrl($returnUrl); |
@@ -39,9 +45,13 @@ discard block |
||
39 | 45 | if($ipaddress_list) |
40 | 46 | { |
41 | 47 | $output = $oSpamfilterController->insertIP($ipaddress_list); |
42 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
48 | + if(!$output->toBool() && !$output->get('fail_list')) { |
|
49 | + return $output; |
|
50 | + } |
|
43 | 51 | |
44 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
52 | + if($output->get('fail_list')) { |
|
53 | + $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
54 | + } |
|
45 | 55 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
46 | 56 | } |
47 | 57 | |
@@ -57,9 +67,13 @@ discard block |
||
57 | 67 | if($word_list) |
58 | 68 | { |
59 | 69 | $output = $this->insertWord($word_list); |
60 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
70 | + if(!$output->toBool() && !$output->get('fail_list')) { |
|
71 | + return $output; |
|
72 | + } |
|
61 | 73 | |
62 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
74 | + if($output->get('fail_list')) { |
|
75 | + $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
76 | + } |
|
63 | 77 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
64 | 78 | } |
65 | 79 | |
@@ -73,7 +87,9 @@ discard block |
||
73 | 87 | function procSpamfilterAdminDeleteDeniedIP() |
74 | 88 | { |
75 | 89 | $ipAddressList = Context::get('ipaddress'); |
76 | - if($ipAddressList) $this->deleteIP($ipAddressList); |
|
90 | + if($ipAddressList) { |
|
91 | + $this->deleteIP($ipAddressList); |
|
92 | + } |
|
77 | 93 | |
78 | 94 | $this->setMessage(Context::getLang('success_deleted')); |
79 | 95 | |
@@ -101,7 +117,9 @@ discard block |
||
101 | 117 | */ |
102 | 118 | function deleteIP($ipaddress) |
103 | 119 | { |
104 | - if(!$ipaddress) return; |
|
120 | + if(!$ipaddress) { |
|
121 | + return; |
|
122 | + } |
|
105 | 123 | |
106 | 124 | $args = new stdClass; |
107 | 125 | $args->ipaddress = $ipaddress; |
@@ -130,9 +148,13 @@ discard block |
||
130 | 148 | foreach($word_list as $word) |
131 | 149 | { |
132 | 150 | $args = new stdClass; |
133 | - if(trim($word)) $args->word = $word; |
|
151 | + if(trim($word)) { |
|
152 | + $args->word = $word; |
|
153 | + } |
|
134 | 154 | $output = executeQuery('spamfilter.insertDeniedWord', $args); |
135 | - if(!$output->toBool()) $fail_word .= $word.'<br />'; |
|
155 | + if(!$output->toBool()) { |
|
156 | + $fail_word .= $word.'<br />'; |
|
157 | + } |
|
136 | 158 | } |
137 | 159 | $output->add('fail_list',$fail_word); |
138 | 160 | return $output; |
@@ -144,7 +166,9 @@ discard block |
||
144 | 166 | */ |
145 | 167 | function deleteWord($word) |
146 | 168 | { |
147 | - if(!$word) return; |
|
169 | + if(!$word) { |
|
170 | + return; |
|
171 | + } |
|
148 | 172 | $args = new stdClass; |
149 | 173 | $args->word = $word; |
150 | 174 | return executeQuery('spamfilter.deleteDeniedWord', $args); |
@@ -17,15 +17,15 @@ discard block |
||
17 | 17 | function procSpamfilterAdminInsertConfig() |
18 | 18 | { |
19 | 19 | // Get the default information |
20 | - $argsConfig = Context::gets('limits','check_trackback'); |
|
20 | + $argsConfig = Context::gets('limits', 'check_trackback'); |
|
21 | 21 | $flag = Context::get('flag'); |
22 | 22 | //interval, limit_count |
23 | - if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N'; |
|
24 | - if($argsConfig->limits!='Y') $argsConfig->limits = 'N'; |
|
23 | + if ($argsConfig->check_trackback != 'Y') $argsConfig->check_trackback = 'N'; |
|
24 | + if ($argsConfig->limits != 'Y') $argsConfig->limits = 'N'; |
|
25 | 25 | // Create and insert the module Controller object |
26 | 26 | $oModuleController = getController('module'); |
27 | - $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig); |
|
28 | - if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
27 | + $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $argsConfig); |
|
28 | + if (!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
29 | 29 | |
30 | 30 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock'); |
31 | 31 | $this->setRedirectUrl($returnUrl); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | //스팸IP 추가 |
37 | 37 | $ipaddress_list = Context::get('ipaddress_list'); |
38 | 38 | $oSpamfilterController = getController('spamfilter'); |
39 | - if($ipaddress_list) |
|
39 | + if ($ipaddress_list) |
|
40 | 40 | { |
41 | 41 | $output = $oSpamfilterController->insertIP($ipaddress_list); |
42 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
42 | + if (!$output->toBool() && !$output->get('fail_list')) return $output; |
|
43 | 43 | |
44 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
44 | + if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>'; |
|
45 | 45 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
46 | 46 | } |
47 | 47 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | { |
55 | 55 | //스팸 키워드 추가 |
56 | 56 | $word_list = Context::get('word_list'); |
57 | - if($word_list) |
|
57 | + if ($word_list) |
|
58 | 58 | { |
59 | 59 | $output = $this->insertWord($word_list); |
60 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
60 | + if (!$output->toBool() && !$output->get('fail_list')) return $output; |
|
61 | 61 | |
62 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
62 | + if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>'; |
|
63 | 63 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
64 | 64 | } |
65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | function procSpamfilterAdminDeleteDeniedIP() |
74 | 74 | { |
75 | 75 | $ipAddressList = Context::get('ipaddress'); |
76 | - if($ipAddressList) $this->deleteIP($ipAddressList); |
|
76 | + if ($ipAddressList) $this->deleteIP($ipAddressList); |
|
77 | 77 | |
78 | 78 | $this->setMessage(Context::getLang('success_deleted')); |
79 | 79 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $this->setMessage(Context::getLang('success_deleted')); |
93 | 93 | |
94 | - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word'); |
|
94 | + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList', 'active', 'word'); |
|
95 | 95 | return $this->setRedirectUrl($returnUrl); |
96 | 96 | } |
97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | function deleteIP($ipaddress) |
103 | 103 | { |
104 | - if(!$ipaddress) return; |
|
104 | + if (!$ipaddress) return; |
|
105 | 105 | |
106 | 106 | $args = new stdClass; |
107 | 107 | $args->ipaddress = $ipaddress; |
@@ -115,26 +115,26 @@ discard block |
||
115 | 115 | function insertWord($word_list) |
116 | 116 | { |
117 | 117 | |
118 | - $word_list = str_replace("\r","",$word_list); |
|
119 | - $word_list = explode("\n",$word_list); |
|
118 | + $word_list = str_replace("\r", "", $word_list); |
|
119 | + $word_list = explode("\n", $word_list); |
|
120 | 120 | |
121 | - foreach($word_list as $word) |
|
121 | + foreach ($word_list as $word) |
|
122 | 122 | { |
123 | - if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word)) |
|
123 | + if (!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word)) |
|
124 | 124 | { |
125 | 125 | return new Object(-1, 'msg_invalid'); |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | 129 | $fail_word = ''; |
130 | - foreach($word_list as $word) |
|
130 | + foreach ($word_list as $word) |
|
131 | 131 | { |
132 | 132 | $args = new stdClass; |
133 | - if(trim($word)) $args->word = $word; |
|
133 | + if (trim($word)) $args->word = $word; |
|
134 | 134 | $output = executeQuery('spamfilter.insertDeniedWord', $args); |
135 | - if(!$output->toBool()) $fail_word .= $word.'<br />'; |
|
135 | + if (!$output->toBool()) $fail_word .= $word.'<br />'; |
|
136 | 136 | } |
137 | - $output->add('fail_list',$fail_word); |
|
137 | + $output->add('fail_list', $fail_word); |
|
138 | 138 | return $output; |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | function deleteWord($word) |
146 | 146 | { |
147 | - if(!$word) return; |
|
147 | + if (!$word) return; |
|
148 | 148 | $args = new stdClass; |
149 | 149 | $args->word = $word; |
150 | 150 | return executeQuery('spamfilter.deleteDeniedWord', $args); |
@@ -161,6 +161,8 @@ |
||
161 | 161 | /** |
162 | 162 | * @brief IP registration |
163 | 163 | * The registered IP address is considered as a spammer |
164 | + * @param string $ipaddress_list |
|
165 | + * @param string $description |
|
164 | 166 | */ |
165 | 167 | function insertIP($ipaddress_list, $description = null) |
166 | 168 | { |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function triggerInsertDocument(&$obj) |
29 | 29 | { |
30 | - if($_SESSION['avoid_log']) return new Object(); |
|
30 | + if($_SESSION['avoid_log']) { |
|
31 | + return new Object(); |
|
32 | + } |
|
31 | 33 | // Check the login status, login information, and permission |
32 | 34 | $is_logged = Context::get('is_logged'); |
33 | 35 | $logged_info = Context::get('logged_info'); |
@@ -35,31 +37,40 @@ discard block |
||
35 | 37 | // In case logged in, check if it is an administrator |
36 | 38 | if($is_logged) |
37 | 39 | { |
38 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
39 | - if($grant->manager) return new Object(); |
|
40 | + if($logged_info->is_admin == 'Y') { |
|
41 | + return new Object(); |
|
42 | + } |
|
43 | + if($grant->manager) { |
|
44 | + return new Object(); |
|
45 | + } |
|
40 | 46 | } |
41 | 47 | |
42 | 48 | $oFilterModel = getModel('spamfilter'); |
43 | 49 | // Check if the IP is prohibited |
44 | 50 | $output = $oFilterModel->isDeniedIP(); |
45 | - if(!$output->toBool()) return $output; |
|
51 | + if(!$output->toBool()) { |
|
52 | + return $output; |
|
53 | + } |
|
46 | 54 | // Check if there is a ban on the word |
47 | 55 | $text = ''; |
48 | 56 | if($is_logged) |
49 | 57 | { |
50 | 58 | $text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags; |
51 | - } |
|
52 | - else |
|
59 | + } else |
|
53 | 60 | { |
54 | 61 | $text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags; |
55 | 62 | } |
56 | 63 | $output = $oFilterModel->isDeniedWord($text); |
57 | - if(!$output->toBool()) return $output; |
|
64 | + if(!$output->toBool()) { |
|
65 | + return $output; |
|
66 | + } |
|
58 | 67 | // Check the specified time beside the modificaiton time |
59 | 68 | if($obj->document_srl == 0) |
60 | 69 | { |
61 | 70 | $output = $oFilterModel->checkLimited(); |
62 | - if(!$output->toBool()) return $output; |
|
71 | + if(!$output->toBool()) { |
|
72 | + return $output; |
|
73 | + } |
|
63 | 74 | } |
64 | 75 | // Save a log |
65 | 76 | $this->insertLog(); |
@@ -72,7 +83,9 @@ discard block |
||
72 | 83 | */ |
73 | 84 | function triggerInsertComment(&$obj) |
74 | 85 | { |
75 | - if($_SESSION['avoid_log']) return new Object(); |
|
86 | + if($_SESSION['avoid_log']) { |
|
87 | + return new Object(); |
|
88 | + } |
|
76 | 89 | // Check the login status, login information, and permission |
77 | 90 | $is_logged = Context::get('is_logged'); |
78 | 91 | $logged_info = Context::get('logged_info'); |
@@ -80,31 +93,40 @@ discard block |
||
80 | 93 | // In case logged in, check if it is an administrator |
81 | 94 | if($is_logged) |
82 | 95 | { |
83 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
84 | - if($grant->manager) return new Object(); |
|
96 | + if($logged_info->is_admin == 'Y') { |
|
97 | + return new Object(); |
|
98 | + } |
|
99 | + if($grant->manager) { |
|
100 | + return new Object(); |
|
101 | + } |
|
85 | 102 | } |
86 | 103 | |
87 | 104 | $oFilterModel = getModel('spamfilter'); |
88 | 105 | // Check if the IP is prohibited |
89 | 106 | $output = $oFilterModel->isDeniedIP(); |
90 | - if(!$output->toBool()) return $output; |
|
107 | + if(!$output->toBool()) { |
|
108 | + return $output; |
|
109 | + } |
|
91 | 110 | // Check if there is a ban on the word |
92 | 111 | $text = ''; |
93 | 112 | if($is_logged) |
94 | 113 | { |
95 | 114 | $text = $obj->content; |
96 | - } |
|
97 | - else |
|
115 | + } else |
|
98 | 116 | { |
99 | 117 | $text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage; |
100 | 118 | } |
101 | 119 | $output = $oFilterModel->isDeniedWord($text); |
102 | - if(!$output->toBool()) return $output; |
|
120 | + if(!$output->toBool()) { |
|
121 | + return $output; |
|
122 | + } |
|
103 | 123 | // If the specified time check is not modified |
104 | 124 | if(!$obj->__isupdate) |
105 | 125 | { |
106 | 126 | $output = $oFilterModel->checkLimited(); |
107 | - if(!$output->toBool()) return $output; |
|
127 | + if(!$output->toBool()) { |
|
128 | + return $output; |
|
129 | + } |
|
108 | 130 | } |
109 | 131 | unset($obj->__isupdate); |
110 | 132 | // Save a log |
@@ -118,20 +140,28 @@ discard block |
||
118 | 140 | */ |
119 | 141 | function triggerInsertTrackback(&$obj) |
120 | 142 | { |
121 | - if($_SESSION['avoid_log']) return new Object(); |
|
143 | + if($_SESSION['avoid_log']) { |
|
144 | + return new Object(); |
|
145 | + } |
|
122 | 146 | |
123 | 147 | $oFilterModel = getModel('spamfilter'); |
124 | 148 | // Confirm if the trackbacks have been added more than once to your document |
125 | 149 | $output = $oFilterModel->isInsertedTrackback($obj->document_srl); |
126 | - if(!$output->toBool()) return $output; |
|
150 | + if(!$output->toBool()) { |
|
151 | + return $output; |
|
152 | + } |
|
127 | 153 | |
128 | 154 | // Check if the IP is prohibited |
129 | 155 | $output = $oFilterModel->isDeniedIP(); |
130 | - if(!$output->toBool()) return $output; |
|
156 | + if(!$output->toBool()) { |
|
157 | + return $output; |
|
158 | + } |
|
131 | 159 | // Check if there is a ban on the word |
132 | 160 | $text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url; |
133 | 161 | $output = $oFilterModel->isDeniedWord($text); |
134 | - if(!$output->toBool()) return $output; |
|
162 | + if(!$output->toBool()) { |
|
163 | + return $output; |
|
164 | + } |
|
135 | 165 | // Start Filtering |
136 | 166 | $oTrackbackModel = getModel('trackback'); |
137 | 167 | $oTrackbackController = getController('trackback'); |
@@ -165,7 +195,9 @@ discard block |
||
165 | 195 | function insertIP($ipaddress_list, $description = null) |
166 | 196 | { |
167 | 197 | $regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/"; |
168 | - if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
198 | + if(!preg_match($regExr,$ipaddress_list)) { |
|
199 | + return new Object(-1, 'msg_invalid'); |
|
200 | + } |
|
169 | 201 | $ipaddress_list = str_replace("\r","",$ipaddress_list); |
170 | 202 | $ipaddress_list = explode("\n",$ipaddress_list); |
171 | 203 | foreach($ipaddress_list as $ipaddressValue) |
@@ -175,11 +207,16 @@ discard block |
||
175 | 207 | if($ipaddress=trim($matches[1])) |
176 | 208 | { |
177 | 209 | $args->ipaddress = $ipaddress; |
178 | - if(!$description && $matches[4]) $args->description = $matches[4]; |
|
179 | - else $args->description = $description; |
|
210 | + if(!$description && $matches[4]) { |
|
211 | + $args->description = $matches[4]; |
|
212 | + } else { |
|
213 | + $args->description = $description; |
|
214 | + } |
|
180 | 215 | } |
181 | 216 | $output = executeQuery('spamfilter.insertDeniedIP', $args); |
182 | - if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
217 | + if(!$output->toBool()) { |
|
218 | + $fail_list .= $ipaddress.'<br/>'; |
|
219 | + } |
|
183 | 220 | } |
184 | 221 | |
185 | 222 | $output->add('fail_list',$fail_list); |
@@ -191,22 +228,32 @@ discard block |
||
191 | 228 | */ |
192 | 229 | function triggerSendMessage(&$obj) |
193 | 230 | { |
194 | - if($_SESSION['avoid_log']) return new Object(); |
|
231 | + if($_SESSION['avoid_log']) { |
|
232 | + return new Object(); |
|
233 | + } |
|
195 | 234 | |
196 | 235 | $logged_info = Context::get('logged_info'); |
197 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
236 | + if($logged_info->is_admin == 'Y') { |
|
237 | + return new Object(); |
|
238 | + } |
|
198 | 239 | |
199 | 240 | $oFilterModel = getModel('spamfilter'); |
200 | 241 | // Check if the IP is prohibited |
201 | 242 | $output = $oFilterModel->isDeniedIP(); |
202 | - if(!$output->toBool()) return $output; |
|
243 | + if(!$output->toBool()) { |
|
244 | + return $output; |
|
245 | + } |
|
203 | 246 | // Check if there is a ban on the word |
204 | 247 | $text = $obj->title . ' ' . $obj->content; |
205 | 248 | $output = $oFilterModel->isDeniedWord($text); |
206 | - if(!$output->toBool()) return $output; |
|
249 | + if(!$output->toBool()) { |
|
250 | + return $output; |
|
251 | + } |
|
207 | 252 | // Check the specified time |
208 | 253 | $output = $oFilterModel->checkLimited(TRUE); |
209 | - if(!$output->toBool()) return $output; |
|
254 | + if(!$output->toBool()) { |
|
255 | + return $output; |
|
256 | + } |
|
210 | 257 | // Save a log |
211 | 258 | $this->insertLog(); |
212 | 259 |
@@ -27,39 +27,39 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function triggerInsertDocument(&$obj) |
29 | 29 | { |
30 | - if($_SESSION['avoid_log']) return new Object(); |
|
30 | + if ($_SESSION['avoid_log']) return new Object(); |
|
31 | 31 | // Check the login status, login information, and permission |
32 | 32 | $is_logged = Context::get('is_logged'); |
33 | 33 | $logged_info = Context::get('logged_info'); |
34 | 34 | $grant = Context::get('grant'); |
35 | 35 | // In case logged in, check if it is an administrator |
36 | - if($is_logged) |
|
36 | + if ($is_logged) |
|
37 | 37 | { |
38 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
39 | - if($grant->manager) return new Object(); |
|
38 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
39 | + if ($grant->manager) return new Object(); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $oFilterModel = getModel('spamfilter'); |
43 | 43 | // Check if the IP is prohibited |
44 | 44 | $output = $oFilterModel->isDeniedIP(); |
45 | - if(!$output->toBool()) return $output; |
|
45 | + if (!$output->toBool()) return $output; |
|
46 | 46 | // Check if there is a ban on the word |
47 | 47 | $text = ''; |
48 | - if($is_logged) |
|
48 | + if ($is_logged) |
|
49 | 49 | { |
50 | - $text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags; |
|
50 | + $text = $obj->title.' '.$obj->content.' '.$obj->tags; |
|
51 | 51 | } |
52 | 52 | else |
53 | 53 | { |
54 | - $text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags; |
|
54 | + $text = $obj->title.' '.$obj->content.' '.$obj->nick_name.' '.$obj->homepage.' '.$obj->tags; |
|
55 | 55 | } |
56 | 56 | $output = $oFilterModel->isDeniedWord($text); |
57 | - if(!$output->toBool()) return $output; |
|
57 | + if (!$output->toBool()) return $output; |
|
58 | 58 | // Check the specified time beside the modificaiton time |
59 | - if($obj->document_srl == 0) |
|
59 | + if ($obj->document_srl == 0) |
|
60 | 60 | { |
61 | 61 | $output = $oFilterModel->checkLimited(); |
62 | - if(!$output->toBool()) return $output; |
|
62 | + if (!$output->toBool()) return $output; |
|
63 | 63 | } |
64 | 64 | // Save a log |
65 | 65 | $this->insertLog(); |
@@ -72,39 +72,39 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function triggerInsertComment(&$obj) |
74 | 74 | { |
75 | - if($_SESSION['avoid_log']) return new Object(); |
|
75 | + if ($_SESSION['avoid_log']) return new Object(); |
|
76 | 76 | // Check the login status, login information, and permission |
77 | 77 | $is_logged = Context::get('is_logged'); |
78 | 78 | $logged_info = Context::get('logged_info'); |
79 | 79 | $grant = Context::get('grant'); |
80 | 80 | // In case logged in, check if it is an administrator |
81 | - if($is_logged) |
|
81 | + if ($is_logged) |
|
82 | 82 | { |
83 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
84 | - if($grant->manager) return new Object(); |
|
83 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
84 | + if ($grant->manager) return new Object(); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $oFilterModel = getModel('spamfilter'); |
88 | 88 | // Check if the IP is prohibited |
89 | 89 | $output = $oFilterModel->isDeniedIP(); |
90 | - if(!$output->toBool()) return $output; |
|
90 | + if (!$output->toBool()) return $output; |
|
91 | 91 | // Check if there is a ban on the word |
92 | 92 | $text = ''; |
93 | - if($is_logged) |
|
93 | + if ($is_logged) |
|
94 | 94 | { |
95 | 95 | $text = $obj->content; |
96 | 96 | } |
97 | 97 | else |
98 | 98 | { |
99 | - $text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage; |
|
99 | + $text = $obj->content.' '.$obj->nick_name.' '.$obj->homepage; |
|
100 | 100 | } |
101 | 101 | $output = $oFilterModel->isDeniedWord($text); |
102 | - if(!$output->toBool()) return $output; |
|
102 | + if (!$output->toBool()) return $output; |
|
103 | 103 | // If the specified time check is not modified |
104 | - if(!$obj->__isupdate) |
|
104 | + if (!$obj->__isupdate) |
|
105 | 105 | { |
106 | 106 | $output = $oFilterModel->checkLimited(); |
107 | - if(!$output->toBool()) return $output; |
|
107 | + if (!$output->toBool()) return $output; |
|
108 | 108 | } |
109 | 109 | unset($obj->__isupdate); |
110 | 110 | // Save a log |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function triggerInsertTrackback(&$obj) |
120 | 120 | { |
121 | - if($_SESSION['avoid_log']) return new Object(); |
|
121 | + if ($_SESSION['avoid_log']) return new Object(); |
|
122 | 122 | |
123 | 123 | $oFilterModel = getModel('spamfilter'); |
124 | 124 | // Confirm if the trackbacks have been added more than once to your document |
125 | 125 | $output = $oFilterModel->isInsertedTrackback($obj->document_srl); |
126 | - if(!$output->toBool()) return $output; |
|
126 | + if (!$output->toBool()) return $output; |
|
127 | 127 | |
128 | 128 | // Check if the IP is prohibited |
129 | 129 | $output = $oFilterModel->isDeniedIP(); |
130 | - if(!$output->toBool()) return $output; |
|
130 | + if (!$output->toBool()) return $output; |
|
131 | 131 | // Check if there is a ban on the word |
132 | - $text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url; |
|
132 | + $text = $obj->blog_name.' '.$obj->title.' '.$obj->excerpt.' '.$obj->url; |
|
133 | 133 | $output = $oFilterModel->isDeniedWord($text); |
134 | - if(!$output->toBool()) return $output; |
|
134 | + if (!$output->toBool()) return $output; |
|
135 | 135 | // Start Filtering |
136 | 136 | $oTrackbackModel = getModel('trackback'); |
137 | 137 | $oTrackbackController = getController('trackback'); |
138 | 138 | |
139 | - list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']); |
|
139 | + list($ipA, $ipB, $ipC, $ipD) = explode('.', $_SERVER['REMOTE_ADDR']); |
|
140 | 140 | $ipaddress = $ipA.'.'.$ipB.'.'.$ipC; |
141 | 141 | // In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it. |
142 | - if($obj->title == $obj->excerpt) |
|
142 | + if ($obj->title == $obj->excerpt) |
|
143 | 143 | { |
144 | - $oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt); |
|
144 | + $oTrackbackController->deleteTrackbackSender(60 * 60 * 6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt); |
|
145 | 145 | $this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback'); |
146 | - return new Object(-1,'msg_alert_trackback_denied'); |
|
146 | + return new Object(-1, 'msg_alert_trackback_denied'); |
|
147 | 147 | } |
148 | 148 | // If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts |
149 | 149 | /* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리 |
@@ -165,24 +165,24 @@ discard block |
||
165 | 165 | function insertIP($ipaddress_list, $description = null) |
166 | 166 | { |
167 | 167 | $regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/"; |
168 | - if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
169 | - $ipaddress_list = str_replace("\r","",$ipaddress_list); |
|
170 | - $ipaddress_list = explode("\n",$ipaddress_list); |
|
171 | - foreach($ipaddress_list as $ipaddressValue) |
|
168 | + if (!preg_match($regExr, $ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
169 | + $ipaddress_list = str_replace("\r", "", $ipaddress_list); |
|
170 | + $ipaddress_list = explode("\n", $ipaddress_list); |
|
171 | + foreach ($ipaddress_list as $ipaddressValue) |
|
172 | 172 | { |
173 | 173 | $args = new stdClass(); |
174 | - preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches); |
|
175 | - if($ipaddress=trim($matches[1])) |
|
174 | + preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/", $ipaddressValue, $matches); |
|
175 | + if ($ipaddress = trim($matches[1])) |
|
176 | 176 | { |
177 | 177 | $args->ipaddress = $ipaddress; |
178 | - if(!$description && $matches[4]) $args->description = $matches[4]; |
|
178 | + if (!$description && $matches[4]) $args->description = $matches[4]; |
|
179 | 179 | else $args->description = $description; |
180 | 180 | } |
181 | 181 | $output = executeQuery('spamfilter.insertDeniedIP', $args); |
182 | - if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
182 | + if (!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
183 | 183 | } |
184 | 184 | |
185 | - $output->add('fail_list',$fail_list); |
|
185 | + $output->add('fail_list', $fail_list); |
|
186 | 186 | return $output; |
187 | 187 | } |
188 | 188 | |
@@ -191,22 +191,22 @@ discard block |
||
191 | 191 | */ |
192 | 192 | function triggerSendMessage(&$obj) |
193 | 193 | { |
194 | - if($_SESSION['avoid_log']) return new Object(); |
|
194 | + if ($_SESSION['avoid_log']) return new Object(); |
|
195 | 195 | |
196 | 196 | $logged_info = Context::get('logged_info'); |
197 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
197 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
198 | 198 | |
199 | 199 | $oFilterModel = getModel('spamfilter'); |
200 | 200 | // Check if the IP is prohibited |
201 | 201 | $output = $oFilterModel->isDeniedIP(); |
202 | - if(!$output->toBool()) return $output; |
|
202 | + if (!$output->toBool()) return $output; |
|
203 | 203 | // Check if there is a ban on the word |
204 | - $text = $obj->title . ' ' . $obj->content; |
|
204 | + $text = $obj->title.' '.$obj->content; |
|
205 | 205 | $output = $oFilterModel->isDeniedWord($text); |
206 | - if(!$output->toBool()) return $output; |
|
206 | + if (!$output->toBool()) return $output; |
|
207 | 207 | // Check the specified time |
208 | 208 | $output = $oFilterModel->checkLimited(TRUE); |
209 | - if(!$output->toBool()) return $output; |
|
209 | + if (!$output->toBool()) return $output; |
|
210 | 210 | // Save a log |
211 | 211 | $this->insertLog(); |
212 | 212 |
@@ -49,6 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @brief document_srl the import tag |
52 | + * @param stdClass $obj |
|
52 | 53 | */ |
53 | 54 | function getDocumentSrlByTag($obj) |
54 | 55 | { |
@@ -70,6 +71,7 @@ discard block |
||
70 | 71 | |
71 | 72 | /** |
72 | 73 | * @brief document used in the import tag |
74 | + * @param stdClass $obj |
|
73 | 75 | */ |
74 | 76 | function getDocumentsTagList($obj) |
75 | 77 | { |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | function getTagList($obj) |
22 | 22 | { |
23 | - if($obj->mid) |
|
23 | + if ($obj->mid) |
|
24 | 24 | { |
25 | 25 | $oModuleModel = getModel('module'); |
26 | 26 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | // Module_srl passed the array may be a check whether the array |
31 | 31 | $args = new stdClass; |
32 | - if(is_array($obj->module_srl)) |
|
32 | + if (is_array($obj->module_srl)) |
|
33 | 33 | { |
34 | 34 | $args->module_srl = implode(',', $obj->module_srl); |
35 | 35 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $args->count = $obj->sort_index; |
43 | 43 | |
44 | 44 | $output = executeQueryArray('tag.getTagList', $args); |
45 | - if(!$output->toBool()) return $output; |
|
45 | + if (!$output->toBool()) return $output; |
|
46 | 46 | |
47 | 47 | return $output; |
48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function getDocumentSrlByTag($obj) |
54 | 54 | { |
55 | 55 | $args = new stdClass; |
56 | - if(is_array($obj->module_srl)) |
|
56 | + if (is_array($obj->module_srl)) |
|
57 | 57 | { |
58 | 58 | $args->module_srl = implode(',', $obj->module_srl); |
59 | 59 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | function getDocumentsTagList($obj) |
75 | 75 | { |
76 | 76 | $args = new stdClass; |
77 | - if(is_array($obj->document_srl)) |
|
77 | + if (is_array($obj->document_srl)) |
|
78 | 78 | { |
79 | 79 | $args->document_srl = implode(',', $obj->document_srl); |
80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $output = executeQueryArray('tag.getDocumentsTagList', $args); |
87 | - if(!$output->toBool()) return $output; |
|
87 | + if (!$output->toBool()) return $output; |
|
88 | 88 | |
89 | 89 | return $output; |
90 | 90 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | function getTagWithUsedList($obj) |
96 | 96 | { |
97 | 97 | $args = new stdClass; |
98 | - if(is_array($obj->module_srl)) |
|
98 | + if (is_array($obj->module_srl)) |
|
99 | 99 | { |
100 | 100 | $args->module_srl = implode(',', $obj->module_srl); |
101 | 101 | } |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | $output = $this->getDocumentSrlByTag($args); |
109 | 109 | $document_srl = array(); |
110 | 110 | |
111 | - if($output->data) |
|
111 | + if ($output->data) |
|
112 | 112 | { |
113 | - foreach($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
113 | + foreach ($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
114 | 114 | } |
115 | 115 | unset($args); |
116 | 116 |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | if(is_array($obj->module_srl)) |
33 | 33 | { |
34 | 34 | $args->module_srl = implode(',', $obj->module_srl); |
35 | - } |
|
36 | - else |
|
35 | + } else |
|
37 | 36 | { |
38 | 37 | $args->module_srl = $obj->module_srl; |
39 | 38 | } |
@@ -42,7 +41,9 @@ discard block |
||
42 | 41 | $args->count = $obj->sort_index; |
43 | 42 | |
44 | 43 | $output = executeQueryArray('tag.getTagList', $args); |
45 | - if(!$output->toBool()) return $output; |
|
44 | + if(!$output->toBool()) { |
|
45 | + return $output; |
|
46 | + } |
|
46 | 47 | |
47 | 48 | return $output; |
48 | 49 | } |
@@ -56,8 +57,7 @@ discard block |
||
56 | 57 | if(is_array($obj->module_srl)) |
57 | 58 | { |
58 | 59 | $args->module_srl = implode(',', $obj->module_srl); |
59 | - } |
|
60 | - else |
|
60 | + } else |
|
61 | 61 | { |
62 | 62 | $args->module_srl = $obj->module_srl; |
63 | 63 | } |
@@ -77,14 +77,15 @@ discard block |
||
77 | 77 | if(is_array($obj->document_srl)) |
78 | 78 | { |
79 | 79 | $args->document_srl = implode(',', $obj->document_srl); |
80 | - } |
|
81 | - else |
|
80 | + } else |
|
82 | 81 | { |
83 | 82 | $args->document_srl = $obj->document_srl; |
84 | 83 | } |
85 | 84 | |
86 | 85 | $output = executeQueryArray('tag.getDocumentsTagList', $args); |
87 | - if(!$output->toBool()) return $output; |
|
86 | + if(!$output->toBool()) { |
|
87 | + return $output; |
|
88 | + } |
|
88 | 89 | |
89 | 90 | return $output; |
90 | 91 | } |
@@ -98,8 +99,7 @@ discard block |
||
98 | 99 | if(is_array($obj->module_srl)) |
99 | 100 | { |
100 | 101 | $args->module_srl = implode(',', $obj->module_srl); |
101 | - } |
|
102 | - else |
|
102 | + } else |
|
103 | 103 | { |
104 | 104 | $args->module_srl = $obj->module_srl; |
105 | 105 | } |
@@ -110,7 +110,9 @@ discard block |
||
110 | 110 | |
111 | 111 | if($output->data) |
112 | 112 | { |
113 | - foreach($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
113 | + foreach($output->data as $k => $v) { |
|
114 | + $document_srl[] = $v->document_srl; |
|
115 | + } |
|
114 | 116 | } |
115 | 117 | unset($args); |
116 | 118 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * Empty trash |
41 | 41 | * @param array trashSrls |
42 | - * @return Object |
|
42 | + * @return Object|null |
|
43 | 43 | */ |
44 | 44 | function procTrashAdminEmptyTrash() |
45 | 45 | { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Restore content object |
130 | - * @return void|Object |
|
130 | + * @return Object|null |
|
131 | 131 | */ |
132 | 132 | function procTrashAdminRestore() |
133 | 133 | { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Set trash list to Context |
186 | - * @return void|Object |
|
186 | + * @return Object|null |
|
187 | 187 | */ |
188 | 188 | function procTrashAdminGetList() |
189 | 189 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function insertTrash($obj) |
19 | 19 | { |
20 | - if(!Context::get('is_logged')) |
|
20 | + if (!Context::get('is_logged')) |
|
21 | 21 | { |
22 | 22 | return new Object(-1, 'msg_not_permitted'); |
23 | 23 | } |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | $oTrashVO = new TrashVO(); |
28 | 28 | $oTrashVO = &$obj; |
29 | 29 | |
30 | - if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | - if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
30 | + if (!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | + if (!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
32 | 32 | $oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']); |
33 | 33 | $oTrashVO->setRemoverSrl($logged_info->member_srl); |
34 | 34 | $oTrashVO->setRegdate(date('YmdHis')); |
@@ -49,17 +49,17 @@ discard block |
||
49 | 49 | $tmpTrashSrls = Context::get('cart'); |
50 | 50 | |
51 | 51 | $trashSrls = array(); |
52 | - if($isAll != 'true') |
|
52 | + if ($isAll != 'true') |
|
53 | 53 | { |
54 | - if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
54 | + if (is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
55 | 55 | else $trashSrls = explode('|@|', $tmpTrashSrls); |
56 | 56 | } |
57 | 57 | |
58 | 58 | //module relation data delete... |
59 | 59 | $output = $this->_relationDataDelete($isAll, $trashSrls); |
60 | - if(!$output->toBool()) return new Object(-1, $output->message); |
|
60 | + if (!$output->toBool()) return new Object(-1, $output->message); |
|
61 | 61 | |
62 | - if(!$this->_emptyTrash($trashSrls)) return new Object(-1, $lang->fail_empty); |
|
62 | + if (!$this->_emptyTrash($trashSrls)) return new Object(-1, $lang->fail_empty); |
|
63 | 63 | |
64 | 64 | $this->setMessage('success_deleted', 'info'); |
65 | 65 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | function _relationDataDelete($isAll, &$trashSrls) |
77 | 77 | { |
78 | 78 | $oTrashModel = getModel('trash'); |
79 | - if($isAll == 'true') |
|
79 | + if ($isAll == 'true') |
|
80 | 80 | { |
81 | 81 | $output = $oTrashModel->getTrashAllList(array()); |
82 | - if(!$output->toBool()) |
|
82 | + if (!$output->toBool()) |
|
83 | 83 | { |
84 | 84 | return new Object(-1, $output->message); |
85 | 85 | } |
86 | 86 | |
87 | - if(is_array($output->data)) |
|
87 | + if (is_array($output->data)) |
|
88 | 88 | { |
89 | - foreach($output->data as $value) |
|
89 | + foreach ($output->data as $value) |
|
90 | 90 | { |
91 | 91 | $trashSrls[] = $value->getTrashSrl(); |
92 | 92 | } |
@@ -97,29 +97,29 @@ discard block |
||
97 | 97 | $args = new stdClass(); |
98 | 98 | $args->trashSrl = $trashSrls; |
99 | 99 | $output = $oTrashModel->getTrashList($args); |
100 | - if(!$output->toBool()) |
|
100 | + if (!$output->toBool()) |
|
101 | 101 | { |
102 | 102 | return new Object(-1, $output->message); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - if(is_array($output->data)) |
|
106 | + if (is_array($output->data)) |
|
107 | 107 | { |
108 | - foreach($output->data as $oTrashVO) |
|
108 | + foreach ($output->data as $oTrashVO) |
|
109 | 109 | { |
110 | 110 | //class file check |
111 | 111 | $classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule()); |
112 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
112 | + if (!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
113 | 113 | |
114 | 114 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule()); |
115 | 115 | $classFile = FileHandler::getRealPath($classFile); |
116 | - if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
116 | + if (!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
117 | 117 | |
118 | 118 | $oAdminController = getAdminController($oTrashVO->getOriginModule()); |
119 | - if(!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
119 | + if (!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
120 | 120 | |
121 | 121 | $output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject()); |
122 | - if(!$output2->toBool()) return new Object(-1, $output2->message); |
|
122 | + if (!$output2->toBool()) return new Object(-1, $output2->message); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | return new Object(0, $lang->success_deleted); |
@@ -134,33 +134,33 @@ discard block |
||
134 | 134 | global $lang; |
135 | 135 | $trashSrlList = Context::get('cart'); |
136 | 136 | |
137 | - if(is_array($trashSrlList)) |
|
137 | + if (is_array($trashSrlList)) |
|
138 | 138 | { |
139 | 139 | // begin transaction |
140 | 140 | $oDB = &DB::getInstance(); |
141 | 141 | $oDB->begin(); |
142 | 142 | // eache restore method call in each classfile |
143 | - foreach($trashSrlList as $value) |
|
143 | + foreach ($trashSrlList as $value) |
|
144 | 144 | { |
145 | 145 | $oTrashModel = getModel('trash'); |
146 | 146 | $output = $oTrashModel->getTrash($value); |
147 | - if(!$output->toBool()) return new Object(-1, $output->message); |
|
147 | + if (!$output->toBool()) return new Object(-1, $output->message); |
|
148 | 148 | |
149 | 149 | //class file check |
150 | 150 | $classPath = ModuleHandler::getModulePath($output->data->getOriginModule()); |
151 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
151 | + if (!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
152 | 152 | |
153 | 153 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule()); |
154 | 154 | $classFile = FileHandler::getRealPath($classFile); |
155 | - if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
155 | + if (!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
156 | 156 | |
157 | 157 | $oAdminController = getAdminController($output->data->getOriginModule()); |
158 | - if(!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
158 | + if (!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
159 | 159 | |
160 | 160 | $originObject = unserialize($output->data->getSerializedObject()); |
161 | 161 | $output = $oAdminController->restoreTrash($originObject); |
162 | 162 | |
163 | - if(!$output->toBool()) |
|
163 | + if (!$output->toBool()) |
|
164 | 164 | { |
165 | 165 | $oDB->rollback(); |
166 | 166 | return new Object(-1, $output->message); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | // restore object delete in trash box |
171 | - if(!$this->_emptyTrash($trashSrlList)) { |
|
171 | + if (!$this->_emptyTrash($trashSrlList)) { |
|
172 | 172 | $oDB->rollback(); |
173 | 173 | return new Object(-1, $lang->fail_empty); |
174 | 174 | } |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function procTrashAdminGetList() |
189 | 189 | { |
190 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
190 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
191 | 191 | $trashSrls = Context::get('trash_srls'); |
192 | - if($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
192 | + if ($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
193 | 193 | |
194 | - if(count($trashSrlList) > 0) |
|
194 | + if (count($trashSrlList) > 0) |
|
195 | 195 | { |
196 | 196 | $oTrashModel = getModel('trash'); |
197 | 197 | $args = new stdClass(); |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function _emptyTrash($trashSrls) |
220 | 220 | { |
221 | - if(!is_array($trashSrls)) return false; |
|
221 | + if (!is_array($trashSrls)) return false; |
|
222 | 222 | $args = new stdClass(); |
223 | 223 | $args->trashSrls = $trashSrls; |
224 | 224 | $output = executeQuery('trash.deleteTrash', $args); |
225 | - if(!$output->toBool()) return false; |
|
225 | + if (!$output->toBool()) return false; |
|
226 | 226 | |
227 | 227 | return true; |
228 | 228 | } |
@@ -27,8 +27,12 @@ discard block |
||
27 | 27 | $oTrashVO = new TrashVO(); |
28 | 28 | $oTrashVO = &$obj; |
29 | 29 | |
30 | - if(!$oTrashVO->getTrashSrl()) $oTrashVO->setTrashSrl(getNextSequence()); |
|
31 | - if(!is_string($oTrashVO->getSerializedObject())) $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
30 | + if(!$oTrashVO->getTrashSrl()) { |
|
31 | + $oTrashVO->setTrashSrl(getNextSequence()); |
|
32 | + } |
|
33 | + if(!is_string($oTrashVO->getSerializedObject())) { |
|
34 | + $oTrashVO->setSerializedObject(serialize($oTrashVO->getSerializedObject())); |
|
35 | + } |
|
32 | 36 | $oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']); |
33 | 37 | $oTrashVO->setRemoverSrl($logged_info->member_srl); |
34 | 38 | $oTrashVO->setRegdate(date('YmdHis')); |
@@ -51,15 +55,22 @@ discard block |
||
51 | 55 | $trashSrls = array(); |
52 | 56 | if($isAll != 'true') |
53 | 57 | { |
54 | - if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls; |
|
55 | - else $trashSrls = explode('|@|', $tmpTrashSrls); |
|
58 | + if(is_array($tmpTrashSrls)) { |
|
59 | + $trashSrls = $tmpTrashSrls; |
|
60 | + } else { |
|
61 | + $trashSrls = explode('|@|', $tmpTrashSrls); |
|
62 | + } |
|
56 | 63 | } |
57 | 64 | |
58 | 65 | //module relation data delete... |
59 | 66 | $output = $this->_relationDataDelete($isAll, $trashSrls); |
60 | - if(!$output->toBool()) return new Object(-1, $output->message); |
|
67 | + if(!$output->toBool()) { |
|
68 | + return new Object(-1, $output->message); |
|
69 | + } |
|
61 | 70 | |
62 | - if(!$this->_emptyTrash($trashSrls)) return new Object(-1, $lang->fail_empty); |
|
71 | + if(!$this->_emptyTrash($trashSrls)) { |
|
72 | + return new Object(-1, $lang->fail_empty); |
|
73 | + } |
|
63 | 74 | |
64 | 75 | $this->setMessage('success_deleted', 'info'); |
65 | 76 | |
@@ -91,8 +102,7 @@ discard block |
||
91 | 102 | $trashSrls[] = $value->getTrashSrl(); |
92 | 103 | } |
93 | 104 | } |
94 | - } |
|
95 | - else |
|
105 | + } else |
|
96 | 106 | { |
97 | 107 | $args = new stdClass(); |
98 | 108 | $args->trashSrl = $trashSrls; |
@@ -109,17 +119,25 @@ discard block |
||
109 | 119 | { |
110 | 120 | //class file check |
111 | 121 | $classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule()); |
112 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
122 | + if(!is_dir(FileHandler::getRealPath($classPath))) { |
|
123 | + return new Object(-1, 'not exist restore module directory'); |
|
124 | + } |
|
113 | 125 | |
114 | 126 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule()); |
115 | 127 | $classFile = FileHandler::getRealPath($classFile); |
116 | - if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
128 | + if(!file_exists($classFile)) { |
|
129 | + return new Object(-1, 'not exist restore module class file'); |
|
130 | + } |
|
117 | 131 | |
118 | 132 | $oAdminController = getAdminController($oTrashVO->getOriginModule()); |
119 | - if(!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
133 | + if(!method_exists($oAdminController, 'emptyTrash')) { |
|
134 | + return new Object(-1, 'not exist restore method in module class file'); |
|
135 | + } |
|
120 | 136 | |
121 | 137 | $output2 = $oAdminController->emptyTrash($oTrashVO->getSerializedObject()); |
122 | - if(!$output2->toBool()) return new Object(-1, $output2->message); |
|
138 | + if(!$output2->toBool()) { |
|
139 | + return new Object(-1, $output2->message); |
|
140 | + } |
|
123 | 141 | } |
124 | 142 | } |
125 | 143 | return new Object(0, $lang->success_deleted); |
@@ -144,18 +162,26 @@ discard block |
||
144 | 162 | { |
145 | 163 | $oTrashModel = getModel('trash'); |
146 | 164 | $output = $oTrashModel->getTrash($value); |
147 | - if(!$output->toBool()) return new Object(-1, $output->message); |
|
165 | + if(!$output->toBool()) { |
|
166 | + return new Object(-1, $output->message); |
|
167 | + } |
|
148 | 168 | |
149 | 169 | //class file check |
150 | 170 | $classPath = ModuleHandler::getModulePath($output->data->getOriginModule()); |
151 | - if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory'); |
|
171 | + if(!is_dir(FileHandler::getRealPath($classPath))) { |
|
172 | + return new Object(-1, 'not exist restore module directory'); |
|
173 | + } |
|
152 | 174 | |
153 | 175 | $classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule()); |
154 | 176 | $classFile = FileHandler::getRealPath($classFile); |
155 | - if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file'); |
|
177 | + if(!file_exists($classFile)) { |
|
178 | + return new Object(-1, 'not exist restore module class file'); |
|
179 | + } |
|
156 | 180 | |
157 | 181 | $oAdminController = getAdminController($output->data->getOriginModule()); |
158 | - if(!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file'); |
|
182 | + if(!method_exists($oAdminController, 'restoreTrash')) { |
|
183 | + return new Object(-1, 'not exist restore method in module class file'); |
|
184 | + } |
|
159 | 185 | |
160 | 186 | $originObject = unserialize($output->data->getSerializedObject()); |
161 | 187 | $output = $oAdminController->restoreTrash($originObject); |
@@ -187,9 +213,13 @@ discard block |
||
187 | 213 | */ |
188 | 214 | function procTrashAdminGetList() |
189 | 215 | { |
190 | - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); |
|
216 | + if(!Context::get('is_logged')) { |
|
217 | + return new Object(-1,'msg_not_permitted'); |
|
218 | + } |
|
191 | 219 | $trashSrls = Context::get('trash_srls'); |
192 | - if($trashSrls) $trashSrlList = explode(',', $trashSrls); |
|
220 | + if($trashSrls) { |
|
221 | + $trashSrlList = explode(',', $trashSrls); |
|
222 | + } |
|
193 | 223 | |
194 | 224 | if(count($trashSrlList) > 0) |
195 | 225 | { |
@@ -198,8 +228,7 @@ discard block |
||
198 | 228 | $args->trashSrl = $trashSrlList; |
199 | 229 | $output = $oTrashModel->getTrashList($args); |
200 | 230 | $trashList = $output->data; |
201 | - } |
|
202 | - else |
|
231 | + } else |
|
203 | 232 | { |
204 | 233 | global $lang; |
205 | 234 | $trashList = array(); |
@@ -218,11 +247,15 @@ discard block |
||
218 | 247 | */ |
219 | 248 | function _emptyTrash($trashSrls) |
220 | 249 | { |
221 | - if(!is_array($trashSrls)) return false; |
|
250 | + if(!is_array($trashSrls)) { |
|
251 | + return false; |
|
252 | + } |
|
222 | 253 | $args = new stdClass(); |
223 | 254 | $args->trashSrls = $trashSrls; |
224 | 255 | $output = executeQuery('trash.deleteTrash', $args); |
225 | - if(!$output->toBool()) return false; |
|
256 | + if(!$output->toBool()) { |
|
257 | + return false; |
|
258 | + } |
|
226 | 259 | |
227 | 260 | return true; |
228 | 261 | } |
@@ -696,6 +696,9 @@ |
||
696 | 696 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
697 | 697 | } |
698 | 698 | |
699 | + /** |
|
700 | + * @param boolean $javascript_mode |
|
701 | + */ |
|
699 | 702 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
700 | 703 | { |
701 | 704 | if(!$widgetStyle) return $widget_content_body; |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if(count($colorset_list)) { |
|
44 | + $colorsets = implode("\n", $colorset_list); |
|
45 | + } |
|
44 | 46 | $this->add('colorset_list', $colorsets); |
45 | 47 | } |
46 | 48 | |
@@ -50,8 +52,12 @@ discard block |
||
50 | 52 | function procWidgetGenerateCode() |
51 | 53 | { |
52 | 54 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
55 | + if(!$widget) { |
|
56 | + return new Object(-1,'msg_invalid_request'); |
|
57 | + } |
|
58 | + if(!Context::get('skin')) { |
|
59 | + return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
60 | + } |
|
55 | 61 | |
56 | 62 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 63 | |
@@ -66,9 +72,13 @@ discard block |
||
66 | 72 | function procWidgetGenerateCodeInPage() |
67 | 73 | { |
68 | 74 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
75 | + if(!$widget) { |
|
76 | + return new Object(-1,'msg_invalid_request'); |
|
77 | + } |
|
70 | 78 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
79 | + if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) { |
|
80 | + return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
81 | + } |
|
72 | 82 | |
73 | 83 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 84 | // Wanted results |
@@ -107,14 +117,20 @@ discard block |
||
107 | 117 | $err = 0; |
108 | 118 | $oLayoutModel = getModel('layout'); |
109 | 119 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
120 | + if(!$layout_info || $layout_info->type != 'faceoff') { |
|
121 | + $err++; |
|
122 | + } |
|
111 | 123 | // Destination Information Wanted page module |
112 | 124 | $oModuleModel = getModel('module'); |
113 | 125 | $columnList = array('module_srl', 'module'); |
114 | 126 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
115 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
127 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
128 | + $err++; |
|
129 | + } |
|
116 | 130 | |
117 | - if($err > 1) return new Object(-1,'msg_invalid_request'); |
|
131 | + if($err > 1) { |
|
132 | + return new Object(-1,'msg_invalid_request'); |
|
133 | + } |
|
118 | 134 | // Check permissions |
119 | 135 | $is_logged = Context::get('is_logged'); |
120 | 136 | $logged_info = Context::get('logged_info'); |
@@ -125,10 +141,14 @@ discard block |
||
125 | 141 | $manager_group = $page_info->grants['manager']; |
126 | 142 | foreach($user_group as $group_srl => $group_info) |
127 | 143 | { |
128 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
144 | + if(in_array($group_srl, $manager_group)) { |
|
145 | + $is_admin = true; |
|
146 | + } |
|
129 | 147 | } |
130 | 148 | } |
131 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
149 | + if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) { |
|
150 | + return new Object(-1,'msg_not_permitted'); |
|
151 | + } |
|
132 | 152 | // Enter post |
133 | 153 | $oDocumentModel = getModel('document'); |
134 | 154 | $oDocumentController = getController('document'); |
@@ -142,14 +162,15 @@ discard block |
||
142 | 162 | if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
143 | 163 | { |
144 | 164 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | - } |
|
146 | - else |
|
165 | + } else |
|
147 | 166 | { |
148 | 167 | $output = $oDocumentController->insertDocument($obj); |
149 | 168 | $obj->document_srl = $output->get('document_srl'); |
150 | 169 | } |
151 | 170 | // Stop when an error occurs |
152 | - if(!$output->toBool()) return $output; |
|
171 | + if(!$output->toBool()) { |
|
172 | + return $output; |
|
173 | + } |
|
153 | 174 | // Return results |
154 | 175 | $this->add('document_srl', $obj->document_srl); |
155 | 176 | } |
@@ -167,13 +188,17 @@ discard block |
||
167 | 188 | $oDocumentAdminController = getAdminController('document'); |
168 | 189 | |
169 | 190 | $oDocument = $oDocumentModel->getDocument($document_srl, true); |
170 | - if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); |
|
191 | + if(!$oDocument->isExists()) { |
|
192 | + return new Object(-1,'msg_invalid_request'); |
|
193 | + } |
|
171 | 194 | $module_srl = $oDocument->get('module_srl'); |
172 | 195 | // Destination Information Wanted page module |
173 | 196 | $oModuleModel = getModel('module'); |
174 | 197 | $columnList = array('module_srl', 'module'); |
175 | 198 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
176 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
199 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
200 | + return new Object(-1,'msg_invalid_request'); |
|
201 | + } |
|
177 | 202 | // Check permissions |
178 | 203 | $is_logged = Context::get('is_logged'); |
179 | 204 | $logged_info = Context::get('logged_info'); |
@@ -184,13 +209,19 @@ discard block |
||
184 | 209 | $manager_group = $page_info->grants['manager']; |
185 | 210 | foreach($user_group as $group_srl => $group_info) |
186 | 211 | { |
187 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
212 | + if(in_array($group_srl, $manager_group)) { |
|
213 | + $is_admin = true; |
|
214 | + } |
|
188 | 215 | } |
189 | 216 | } |
190 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
217 | + if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) { |
|
218 | + return new Object(-1,'msg_not_permitted'); |
|
219 | + } |
|
191 | 220 | |
192 | 221 | $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
193 | - if(!$output->toBool()) return $output; |
|
222 | + if(!$output->toBool()) { |
|
223 | + return $output; |
|
224 | + } |
|
194 | 225 | // Return results |
195 | 226 | $copied_srls = $output->get('copied_srls'); |
196 | 227 | $this->add('document_srl', $copied_srls[$oDocument->get('document_srl')]); |
@@ -208,12 +239,16 @@ discard block |
||
208 | 239 | $oDocumentController = getController('document'); |
209 | 240 | |
210 | 241 | $oDocument = $oDocumentModel->getDocument($document_srl, true); |
211 | - if(!$oDocument->isExists()) return new Object(); |
|
242 | + if(!$oDocument->isExists()) { |
|
243 | + return new Object(); |
|
244 | + } |
|
212 | 245 | $module_srl = $oDocument->get('module_srl'); |
213 | 246 | // Destination Information Wanted page module |
214 | 247 | $oModuleModel = getModel('module'); |
215 | 248 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
216 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
249 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
250 | + return new Object(-1,'msg_invalid_request'); |
|
251 | + } |
|
217 | 252 | // Check permissions |
218 | 253 | $is_logged = Context::get('is_logged'); |
219 | 254 | $logged_info = Context::get('logged_info'); |
@@ -224,13 +259,19 @@ discard block |
||
224 | 259 | $manager_group = $page_info->grants['manager']; |
225 | 260 | foreach($user_group as $group_srl => $group_info) |
226 | 261 | { |
227 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
262 | + if(in_array($group_srl, $manager_group)) { |
|
263 | + $is_admin = true; |
|
264 | + } |
|
228 | 265 | } |
229 | 266 | } |
230 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
267 | + if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) { |
|
268 | + return new Object(-1,'msg_not_permitted'); |
|
269 | + } |
|
231 | 270 | |
232 | 271 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl'), true); |
233 | - if(!$output->toBool()) return $output; |
|
272 | + if(!$output->toBool()) { |
|
273 | + return $output; |
|
274 | + } |
|
234 | 275 | } |
235 | 276 | |
236 | 277 | /** |
@@ -247,7 +288,9 @@ discard block |
||
247 | 288 | */ |
248 | 289 | function triggerWidgetCompile(&$content) |
249 | 290 | { |
250 | - if(Context::getResponseMethod()!='HTML') return new Object(); |
|
291 | + if(Context::getResponseMethod()!='HTML') { |
|
292 | + return new Object(); |
|
293 | + } |
|
251 | 294 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
252 | 295 | return new Object(); |
253 | 296 | } |
@@ -280,11 +323,16 @@ discard block |
||
280 | 323 | $oXmlParser = new XmlParser(); |
281 | 324 | $xml_doc = $oXmlParser->parse(trim($buff)); |
282 | 325 | |
283 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
284 | - else $vars = $xml_doc->attrs; |
|
326 | + if($xml_doc->img) { |
|
327 | + $vars = $xml_doc->img->attrs; |
|
328 | + } else { |
|
329 | + $vars = $xml_doc->attrs; |
|
330 | + } |
|
285 | 331 | |
286 | 332 | $widget = $vars->widget; |
287 | - if(!$widget) return $matches[0]; |
|
333 | + if(!$widget) { |
|
334 | + return $matches[0]; |
|
335 | + } |
|
288 | 336 | unset($vars->widget); |
289 | 337 | |
290 | 338 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -301,7 +349,9 @@ discard block |
||
301 | 349 | |
302 | 350 | $vars = $xml_doc->div->attrs; |
303 | 351 | $widget = $vars->widget; |
304 | - if(!$widget) return $matches[0]; |
|
352 | + if(!$widget) { |
|
353 | + return $matches[0]; |
|
354 | + } |
|
305 | 355 | unset($vars->widget); |
306 | 356 | |
307 | 357 | $vars->widgetbox_content = $matches[3]; |
@@ -328,22 +378,30 @@ discard block |
||
328 | 378 | $xml_doc = $oXmlParser->parse(trim($buff)); |
329 | 379 | |
330 | 380 | $args = $xml_doc->img->attrs; |
331 | - if(!$args) continue; |
|
381 | + if(!$args) { |
|
382 | + continue; |
|
383 | + } |
|
332 | 384 | // If you are not caching path |
333 | 385 | $widget = $args->widget; |
334 | 386 | $sequence = $args->widget_sequence; |
335 | 387 | $cache = $args->widget_cache; |
336 | - if(!$sequence || !$cache) continue; |
|
388 | + if(!$sequence || !$cache) { |
|
389 | + continue; |
|
390 | + } |
|
337 | 391 | |
338 | 392 | if(count($args)) |
339 | 393 | { |
340 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
394 | + foreach($args as $k => $v) { |
|
395 | + $args->{$k} = urldecode($v); |
|
396 | + } |
|
341 | 397 | } |
342 | 398 | // If the cache file for each language widget regeneration |
343 | 399 | foreach($lang_list as $lang_type => $val) |
344 | 400 | { |
345 | 401 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
346 | - if(!file_exists($cache_file)) continue; |
|
402 | + if(!file_exists($cache_file)) { |
|
403 | + continue; |
|
404 | + } |
|
347 | 405 | $this->getCache($widget, $args, $lang_type, true); |
348 | 406 | } |
349 | 407 | } |
@@ -355,7 +413,9 @@ discard block |
||
355 | 413 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
356 | 414 | { |
357 | 415 | // If the specified language specifies the current language |
358 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
416 | + if(!$lang_type) { |
|
417 | + $lang_type = Context::getLangType(); |
|
418 | + } |
|
359 | 419 | // widget, the cache number and cache values are set |
360 | 420 | $widget_sequence = $args->widget_sequence; |
361 | 421 | $widget_cache = $args->widget_cache; |
@@ -366,7 +426,9 @@ discard block |
||
366 | 426 | if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
367 | 427 | { |
368 | 428 | $oWidget = $this->getWidgetObject($widget); |
369 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
429 | + if(!$oWidget || !method_exists($oWidget, 'proc')) { |
|
430 | + return; |
|
431 | + } |
|
370 | 432 | |
371 | 433 | $widget_content = $oWidget->proc($args); |
372 | 434 | $oModuleController = getController('module'); |
@@ -386,8 +448,7 @@ discard block |
||
386 | 448 | if($cache_body) |
387 | 449 | { |
388 | 450 | return $cache_body; |
389 | - } |
|
390 | - else |
|
451 | + } else |
|
391 | 452 | { |
392 | 453 | /** |
393 | 454 | * Cache number and cache values are set so that the cache file should call |
@@ -415,7 +476,9 @@ discard block |
||
415 | 476 | } |
416 | 477 | |
417 | 478 | $oWidget = $this->getWidgetObject($widget); |
418 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
479 | + if(!$oWidget || !method_exists($oWidget,'proc')) { |
|
480 | + return; |
|
481 | + } |
|
419 | 482 | |
420 | 483 | $widget_content = $oWidget->proc($args); |
421 | 484 | $oModuleController = getController('module'); |
@@ -423,8 +486,7 @@ discard block |
||
423 | 486 | if($oCacheHandler->isSupport()) |
424 | 487 | { |
425 | 488 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
426 | - } |
|
427 | - else |
|
489 | + } else |
|
428 | 490 | { |
429 | 491 | FileHandler::writeFile($cache_file, $widget_content); |
430 | 492 | } |
@@ -442,7 +504,9 @@ discard block |
||
442 | 504 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
443 | 505 | { |
444 | 506 | // Save for debug run-time widget |
445 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
507 | + if(__DEBUG__==3) { |
|
508 | + $start = getMicroTime(); |
|
509 | + } |
|
446 | 510 | $before = microtime(true); |
447 | 511 | // urldecode the value of args haejum |
448 | 512 | $object_vars = get_object_vars($args); |
@@ -450,8 +514,12 @@ discard block |
||
450 | 514 | { |
451 | 515 | foreach($object_vars as $key => $val) |
452 | 516 | { |
453 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
454 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
517 | + if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) { |
|
518 | + continue; |
|
519 | + } |
|
520 | + if($escaped) { |
|
521 | + $args->{$key} = utf8RawUrlDecode($val); |
|
522 | + } |
|
455 | 523 | } |
456 | 524 | } |
457 | 525 | |
@@ -462,7 +530,9 @@ discard block |
||
462 | 530 | $widget_content = ''; |
463 | 531 | if($widget != 'widgetContent' && $widget != 'widgetBox') |
464 | 532 | { |
465 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
533 | + if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) { |
|
534 | + return; |
|
535 | + } |
|
466 | 536 | // Hold the contents of the widget parameter |
467 | 537 | $widget_content = $this->getCache($widget, $args); |
468 | 538 | } |
@@ -494,7 +564,9 @@ discard block |
||
494 | 564 | // If general call is given on page styles should return immediately dreamin ' |
495 | 565 | if(!$javascript_mode) |
496 | 566 | { |
497 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
567 | + if($args->id) { |
|
568 | + $args->id = ' id="'.$args->id.'" '; |
|
569 | + } |
|
498 | 570 | switch($widget) |
499 | 571 | { |
500 | 572 | // If a direct orthogonal addition information |
@@ -504,8 +576,7 @@ discard block |
||
504 | 576 | $oDocumentModel = getModel('document'); |
505 | 577 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
506 | 578 | $body = $oDocument->getContent(false,false,false, false); |
507 | - } |
|
508 | - else |
|
579 | + } else |
|
509 | 580 | { |
510 | 581 | $body = base64_decode($args->body); |
511 | 582 | } |
@@ -532,8 +603,7 @@ discard block |
||
532 | 603 | break; |
533 | 604 | } |
534 | 605 | // Edit page is called when a widget if you add the code for handling |
535 | - } |
|
536 | - else |
|
606 | + } else |
|
537 | 607 | { |
538 | 608 | switch($widget) |
539 | 609 | { |
@@ -544,8 +614,7 @@ discard block |
||
544 | 614 | $oDocumentModel = getModel('document'); |
545 | 615 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
546 | 616 | $body = $oDocument->getContent(false,false,false); |
547 | - } |
|
548 | - else |
|
617 | + } else |
|
549 | 618 | { |
550 | 619 | $body = base64_decode($args->body); |
551 | 620 | } |
@@ -555,8 +624,12 @@ discard block |
||
555 | 624 | { |
556 | 625 | foreach($args as $key => $val) |
557 | 626 | { |
558 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
559 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
627 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
628 | + continue; |
|
629 | + } |
|
630 | + if(strpos($val,'|@|')>0) { |
|
631 | + $val = str_replace('|@|',',',$val); |
|
632 | + } |
|
560 | 633 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
561 | 634 | } |
562 | 635 | } |
@@ -590,9 +663,15 @@ discard block |
||
590 | 663 | { |
591 | 664 | foreach($args as $key => $val) |
592 | 665 | { |
593 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
594 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
595 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
666 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
667 | + continue; |
|
668 | + } |
|
669 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
670 | + continue; |
|
671 | + } |
|
672 | + if(strpos($val,'|@|')>0) { |
|
673 | + $val = str_replace('|@|',',',$val); |
|
674 | + } |
|
596 | 675 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
597 | 676 | } |
598 | 677 | } |
@@ -615,9 +694,15 @@ discard block |
||
615 | 694 | $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
616 | 695 | foreach($args as $key => $val) |
617 | 696 | { |
618 | - if(in_array($key, $allowed_key)) continue; |
|
619 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
620 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
697 | + if(in_array($key, $allowed_key)) { |
|
698 | + continue; |
|
699 | + } |
|
700 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
701 | + continue; |
|
702 | + } |
|
703 | + if(strpos($val,'|@|')>0) { |
|
704 | + $val = str_replace('|@|',',',$val); |
|
705 | + } |
|
621 | 706 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
622 | 707 | } |
623 | 708 | } |
@@ -637,11 +722,15 @@ discard block |
||
637 | 722 | } |
638 | 723 | } |
639 | 724 | // Compile the widget style. |
640 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
725 | + if($args->widgetstyle) { |
|
726 | + $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
727 | + } |
|
641 | 728 | |
642 | 729 | $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
643 | 730 | // Debug widget creation time information added to the results |
644 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
731 | + if(__DEBUG__==3) { |
|
732 | + $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
733 | + } |
|
645 | 734 | |
646 | 735 | $after = microtime(true); |
647 | 736 | |
@@ -674,7 +763,9 @@ discard block |
||
674 | 763 | $path = $oWidgetModel->getWidgetPath($widget); |
675 | 764 | // If you do not find the class file error output widget (html output) |
676 | 765 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
677 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
766 | + if(!file_exists($class_file)) { |
|
767 | + return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
768 | + } |
|
678 | 769 | // Widget classes include |
679 | 770 | require_once($class_file); |
680 | 771 | |
@@ -685,9 +776,13 @@ discard block |
||
685 | 776 | } |
686 | 777 | |
687 | 778 | $oWidget = new $widget(); |
688 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
779 | + if(!is_object($oWidget)) { |
|
780 | + return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
781 | + } |
|
689 | 782 | |
690 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
783 | + if(!method_exists($oWidget, 'proc')) { |
|
784 | + return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
785 | + } |
|
691 | 786 | |
692 | 787 | $oWidget->widget_path = $path; |
693 | 788 | |
@@ -698,12 +793,16 @@ discard block |
||
698 | 793 | |
699 | 794 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
700 | 795 | { |
701 | - if(!$widgetStyle) return $widget_content_body; |
|
796 | + if(!$widgetStyle) { |
|
797 | + return $widget_content_body; |
|
798 | + } |
|
702 | 799 | |
703 | 800 | $oWidgetModel = getModel('widget'); |
704 | 801 | // Bring extra_var widget style tie |
705 | 802 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
706 | - if(!$widgetstyle_info) return $widget_content_body; |
|
803 | + if(!$widgetstyle_info) { |
|
804 | + return $widget_content_body; |
|
805 | + } |
|
707 | 806 | |
708 | 807 | $widgetstyle_extra_var = new stdClass(); |
709 | 808 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
@@ -721,8 +820,7 @@ discard block |
||
721 | 820 | if($javascript_mode && $widget=='widgetBox') |
722 | 821 | { |
723 | 822 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
724 | - } |
|
725 | - else |
|
823 | + } else |
|
726 | 824 | { |
727 | 825 | Context::set('widget_content', $widget_content_body); |
728 | 826 | } |
@@ -791,7 +889,9 @@ discard block |
||
791 | 889 | FileHandler::removeFile($cache_file); |
792 | 890 | } |
793 | 891 | |
794 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
892 | + if($vars->widget_cache>0) { |
|
893 | + $vars->widget_sequence = getNextSequence(); |
|
894 | + } |
|
795 | 895 | |
796 | 896 | $attribute = array(); |
797 | 897 | foreach($vars as $key => $val) |
@@ -801,7 +901,9 @@ discard block |
||
801 | 901 | unset($vars->{$key}); |
802 | 902 | continue; |
803 | 903 | } |
804 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
904 | + if(strpos($val,'|@|') > 0) { |
|
905 | + $val = str_replace('|@|', ',', $val); |
|
906 | + } |
|
805 | 907 | $vars->{$key} = Context::convertEncodingStr($val); |
806 | 908 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
807 | 909 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | $oModuleModel = getModel('module'); |
35 | 35 | $skin_info = $oModuleModel->loadSkinInfo($path, $skin); |
36 | 36 | |
37 | - for($i=0;$i<count($skin_info->colorset);$i++) |
|
37 | + for ($i = 0; $i < count($skin_info->colorset); $i++) |
|
38 | 38 | { |
39 | 39 | $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); |
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if (count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
44 | 44 | $this->add('colorset_list', $colorsets); |
45 | 45 | } |
46 | 46 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function procWidgetGenerateCode() |
51 | 51 | { |
52 | 52 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
53 | + if (!$widget) return new Object(-1, 'msg_invalid_request'); |
|
54 | + if (!Context::get('skin')) return new Object(-1, Context::getLang('msg_widget_skin_is_null')); |
|
55 | 55 | |
56 | 56 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 57 | |
58 | - $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute)); |
|
58 | + $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute)); |
|
59 | 59 | // Code output |
60 | 60 | $this->add('widget_code', $widget_code); |
61 | 61 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | function procWidgetGenerateCodeInPage() |
67 | 67 | { |
68 | 68 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new Object(-1,'msg_invalid_request'); |
|
69 | + if (!$widget) return new Object(-1, 'msg_invalid_request'); |
|
70 | 70 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new Object(-1,Context::getLang('msg_widget_skin_is_null')); |
|
71 | + if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new Object(-1, Context::getLang('msg_widget_skin_is_null')); |
|
72 | 72 | |
73 | 73 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 74 | // Wanted results |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | $err = 0; |
108 | 108 | $oLayoutModel = getModel('layout'); |
109 | 109 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
110 | + if (!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
111 | 111 | // Destination Information Wanted page module |
112 | 112 | $oModuleModel = getModel('module'); |
113 | 113 | $columnList = array('module_srl', 'module'); |
114 | 114 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
115 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
115 | + if (!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
116 | 116 | |
117 | - if($err > 1) return new Object(-1,'msg_invalid_request'); |
|
117 | + if ($err > 1) return new Object(-1, 'msg_invalid_request'); |
|
118 | 118 | // Check permissions |
119 | 119 | $is_logged = Context::get('is_logged'); |
120 | 120 | $logged_info = Context::get('logged_info'); |
121 | 121 | $user_group = $logged_info->group_list; |
122 | 122 | $is_admin = false; |
123 | - if(count($user_group)&&count($page_info->grants['manager'])) |
|
123 | + if (count($user_group) && count($page_info->grants['manager'])) |
|
124 | 124 | { |
125 | 125 | $manager_group = $page_info->grants['manager']; |
126 | - foreach($user_group as $group_srl => $group_info) |
|
126 | + foreach ($user_group as $group_srl => $group_info) |
|
127 | 127 | { |
128 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
128 | + if (in_array($group_srl, $manager_group)) $is_admin = true; |
|
129 | 129 | } |
130 | 130 | } |
131 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
131 | + if (!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1, 'msg_not_permitted'); |
|
132 | 132 | // Enter post |
133 | 133 | $oDocumentModel = getModel('document'); |
134 | 134 | $oDocumentController = getController('document'); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $obj->document_srl = $document_srl; |
140 | 140 | |
141 | 141 | $oDocument = $oDocumentModel->getDocument($obj->document_srl, true); |
142 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
142 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
143 | 143 | { |
144 | 144 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | 145 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $obj->document_srl = $output->get('document_srl'); |
150 | 150 | } |
151 | 151 | // Stop when an error occurs |
152 | - if(!$output->toBool()) return $output; |
|
152 | + if (!$output->toBool()) return $output; |
|
153 | 153 | // Return results |
154 | 154 | $this->add('document_srl', $obj->document_srl); |
155 | 155 | } |
@@ -167,30 +167,30 @@ discard block |
||
167 | 167 | $oDocumentAdminController = getAdminController('document'); |
168 | 168 | |
169 | 169 | $oDocument = $oDocumentModel->getDocument($document_srl, true); |
170 | - if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); |
|
170 | + if (!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request'); |
|
171 | 171 | $module_srl = $oDocument->get('module_srl'); |
172 | 172 | // Destination Information Wanted page module |
173 | 173 | $oModuleModel = getModel('module'); |
174 | 174 | $columnList = array('module_srl', 'module'); |
175 | 175 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
176 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
176 | + if (!$page_info->module_srl || $page_info->module != 'page') return new Object(-1, 'msg_invalid_request'); |
|
177 | 177 | // Check permissions |
178 | 178 | $is_logged = Context::get('is_logged'); |
179 | 179 | $logged_info = Context::get('logged_info'); |
180 | 180 | $user_group = $logged_info->group_list; |
181 | 181 | $is_admin = false; |
182 | - if(count($user_group)&&count($page_info->grants['manager'])) |
|
182 | + if (count($user_group) && count($page_info->grants['manager'])) |
|
183 | 183 | { |
184 | 184 | $manager_group = $page_info->grants['manager']; |
185 | - foreach($user_group as $group_srl => $group_info) |
|
185 | + foreach ($user_group as $group_srl => $group_info) |
|
186 | 186 | { |
187 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
187 | + if (in_array($group_srl, $manager_group)) $is_admin = true; |
|
188 | 188 | } |
189 | 189 | } |
190 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
190 | + if (!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1, 'msg_not_permitted'); |
|
191 | 191 | |
192 | - $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
|
193 | - if(!$output->toBool()) return $output; |
|
192 | + $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0); |
|
193 | + if (!$output->toBool()) return $output; |
|
194 | 194 | // Return results |
195 | 195 | $copied_srls = $output->get('copied_srls'); |
196 | 196 | $this->add('document_srl', $copied_srls[$oDocument->get('document_srl')]); |
@@ -208,29 +208,29 @@ discard block |
||
208 | 208 | $oDocumentController = getController('document'); |
209 | 209 | |
210 | 210 | $oDocument = $oDocumentModel->getDocument($document_srl, true); |
211 | - if(!$oDocument->isExists()) return new Object(); |
|
211 | + if (!$oDocument->isExists()) return new Object(); |
|
212 | 212 | $module_srl = $oDocument->get('module_srl'); |
213 | 213 | // Destination Information Wanted page module |
214 | 214 | $oModuleModel = getModel('module'); |
215 | 215 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
216 | - if(!$page_info->module_srl || $page_info->module != 'page') return new Object(-1,'msg_invalid_request'); |
|
216 | + if (!$page_info->module_srl || $page_info->module != 'page') return new Object(-1, 'msg_invalid_request'); |
|
217 | 217 | // Check permissions |
218 | 218 | $is_logged = Context::get('is_logged'); |
219 | 219 | $logged_info = Context::get('logged_info'); |
220 | 220 | $user_group = $logged_info->group_list; |
221 | 221 | $is_admin = false; |
222 | - if(count($user_group)&&count($page_info->grants['manager'])) |
|
222 | + if (count($user_group) && count($page_info->grants['manager'])) |
|
223 | 223 | { |
224 | 224 | $manager_group = $page_info->grants['manager']; |
225 | - foreach($user_group as $group_srl => $group_info) |
|
225 | + foreach ($user_group as $group_srl => $group_info) |
|
226 | 226 | { |
227 | - if(in_array($group_srl, $manager_group)) $is_admin = true; |
|
227 | + if (in_array($group_srl, $manager_group)) $is_admin = true; |
|
228 | 228 | } |
229 | 229 | } |
230 | - if(!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1,'msg_not_permitted'); |
|
230 | + if (!$is_admin && !$is_logged && $logged_info->is_admin != 'Y' && !$oModuleModel->isSiteAdmin($logged_info) && !(is_array($page_info->admin_id) && in_array($logged_info->user_id, $page_info->admin_id))) return new Object(-1, 'msg_not_permitted'); |
|
231 | 231 | |
232 | 232 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl'), true); |
233 | - if(!$output->toBool()) return $output; |
|
233 | + if (!$output->toBool()) return $output; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | */ |
248 | 248 | function triggerWidgetCompile(&$content) |
249 | 249 | { |
250 | - if(Context::getResponseMethod()!='HTML') return new Object(); |
|
250 | + if (Context::getResponseMethod() != 'HTML') return new Object(); |
|
251 | 251 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
252 | 252 | return new Object(); |
253 | 253 | } |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | // Check whether to include information about editing |
264 | 264 | $this->javascript_mode = $javascript_mode; |
265 | 265 | // Widget code box change |
266 | - $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content); |
|
266 | + $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content); |
|
267 | 267 | // Widget code information byeogyeong |
268 | - $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content); |
|
268 | + $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content); |
|
269 | 269 | |
270 | 270 | return $content; |
271 | 271 | } |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | $oXmlParser = new XmlParser(); |
281 | 281 | $xml_doc = $oXmlParser->parse(trim($buff)); |
282 | 282 | |
283 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
283 | + if ($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
284 | 284 | else $vars = $xml_doc->attrs; |
285 | 285 | |
286 | 286 | $widget = $vars->widget; |
287 | - if(!$widget) return $matches[0]; |
|
287 | + if (!$widget) return $matches[0]; |
|
288 | 288 | unset($vars->widget); |
289 | 289 | |
290 | 290 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -295,13 +295,13 @@ discard block |
||
295 | 295 | */ |
296 | 296 | function transWidgetBox($matches) |
297 | 297 | { |
298 | - $buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]); |
|
298 | + $buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]); |
|
299 | 299 | $oXmlParser = new XmlParser(); |
300 | 300 | $xml_doc = $oXmlParser->parse($buff); |
301 | 301 | |
302 | 302 | $vars = $xml_doc->div->attrs; |
303 | 303 | $widget = $vars->widget; |
304 | - if(!$widget) return $matches[0]; |
|
304 | + if (!$widget) return $matches[0]; |
|
305 | 305 | unset($vars->widget); |
306 | 306 | |
307 | 307 | $vars->widgetbox_content = $matches[3]; |
@@ -322,28 +322,28 @@ discard block |
||
322 | 322 | $oXmlParser = new XmlParser(); |
323 | 323 | |
324 | 324 | $cnt = count($matches[1]); |
325 | - for($i=0;$i<$cnt;$i++) |
|
325 | + for ($i = 0; $i < $cnt; $i++) |
|
326 | 326 | { |
327 | 327 | $buff = $matches[0][$i]; |
328 | 328 | $xml_doc = $oXmlParser->parse(trim($buff)); |
329 | 329 | |
330 | 330 | $args = $xml_doc->img->attrs; |
331 | - if(!$args) continue; |
|
331 | + if (!$args) continue; |
|
332 | 332 | // If you are not caching path |
333 | 333 | $widget = $args->widget; |
334 | 334 | $sequence = $args->widget_sequence; |
335 | 335 | $cache = $args->widget_cache; |
336 | - if(!$sequence || !$cache) continue; |
|
336 | + if (!$sequence || !$cache) continue; |
|
337 | 337 | |
338 | - if(count($args)) |
|
338 | + if (count($args)) |
|
339 | 339 | { |
340 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
340 | + foreach ($args as $k => $v) $args->{$k} = urldecode($v); |
|
341 | 341 | } |
342 | 342 | // If the cache file for each language widget regeneration |
343 | - foreach($lang_list as $lang_type => $val) |
|
343 | + foreach ($lang_list as $lang_type => $val) |
|
344 | 344 | { |
345 | 345 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
346 | - if(!file_exists($cache_file)) continue; |
|
346 | + if (!file_exists($cache_file)) continue; |
|
347 | 347 | $this->getCache($widget, $args, $lang_type, true); |
348 | 348 | } |
349 | 349 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
356 | 356 | { |
357 | 357 | // If the specified language specifies the current language |
358 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
358 | + if (!$lang_type) $lang_type = Context::getLangType(); |
|
359 | 359 | // widget, the cache number and cache values are set |
360 | 360 | $widget_sequence = $args->widget_sequence; |
361 | 361 | $widget_cache = $args->widget_cache; |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * Even if the cache number and value of the cache and return it to extract data |
365 | 365 | */ |
366 | - if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
366 | + if (!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
367 | 367 | { |
368 | 368 | $oWidget = $this->getWidgetObject($widget); |
369 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
369 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
370 | 370 | |
371 | 371 | $widget_content = $oWidget->proc($args); |
372 | 372 | $oModuleController = getController('module'); |
@@ -375,15 +375,15 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | $oCacheHandler = CacheHandler::getInstance('template'); |
378 | - if($oCacheHandler->isSupport()) |
|
378 | + if ($oCacheHandler->isSupport()) |
|
379 | 379 | { |
380 | - $key = 'widget_cache:' . $widget_sequence; |
|
380 | + $key = 'widget_cache:'.$widget_sequence; |
|
381 | 381 | |
382 | 382 | $cache_body = $oCacheHandler->get($key); |
383 | 383 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
384 | 384 | } |
385 | 385 | |
386 | - if($cache_body) |
|
386 | + if ($cache_body) |
|
387 | 387 | { |
388 | 388 | return $cache_body; |
389 | 389 | } |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | // Wanted cache file |
397 | 397 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type); |
398 | 398 | // If the file exists in the cache, the file validation |
399 | - if(!$ignore_cache && file_exists($cache_file)) |
|
399 | + if (!$ignore_cache && file_exists($cache_file)) |
|
400 | 400 | { |
401 | 401 | $filemtime = filemtime($cache_file); |
402 | 402 | // Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache |
403 | - if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
403 | + if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
404 | 404 | { |
405 | 405 | $cache_body = FileHandler::readFile($cache_file); |
406 | 406 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
@@ -409,18 +409,18 @@ discard block |
||
409 | 409 | } |
410 | 410 | } |
411 | 411 | // cache update and cache renewal of the file mtime |
412 | - if(!$oCacheHandler->isSupport()) |
|
412 | + if (!$oCacheHandler->isSupport()) |
|
413 | 413 | { |
414 | 414 | touch($cache_file); |
415 | 415 | } |
416 | 416 | |
417 | 417 | $oWidget = $this->getWidgetObject($widget); |
418 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
418 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
419 | 419 | |
420 | 420 | $widget_content = $oWidget->proc($args); |
421 | 421 | $oModuleController = getController('module'); |
422 | 422 | $oModuleController->replaceDefinedLangCode($widget_content); |
423 | - if($oCacheHandler->isSupport()) |
|
423 | + if ($oCacheHandler->isSupport()) |
|
424 | 424 | { |
425 | 425 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
426 | 426 | } |
@@ -442,16 +442,16 @@ discard block |
||
442 | 442 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
443 | 443 | { |
444 | 444 | // Save for debug run-time widget |
445 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
445 | + if (__DEBUG__ == 3) $start = getMicroTime(); |
|
446 | 446 | $before = microtime(true); |
447 | 447 | // urldecode the value of args haejum |
448 | 448 | $object_vars = get_object_vars($args); |
449 | - if(count($object_vars)) |
|
449 | + if (count($object_vars)) |
|
450 | 450 | { |
451 | - foreach($object_vars as $key => $val) |
|
451 | + foreach ($object_vars as $key => $val) |
|
452 | 452 | { |
453 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
454 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
453 | + if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue; |
|
454 | + if ($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
@@ -460,14 +460,14 @@ discard block |
||
460 | 460 | * Widgets widgetContent/widgetBox Wanted If you are not content |
461 | 461 | */ |
462 | 462 | $widget_content = ''; |
463 | - if($widget != 'widgetContent' && $widget != 'widgetBox') |
|
463 | + if ($widget != 'widgetContent' && $widget != 'widgetBox') |
|
464 | 464 | { |
465 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
465 | + if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return; |
|
466 | 466 | // Hold the contents of the widget parameter |
467 | 467 | $widget_content = $this->getCache($widget, $args); |
468 | 468 | } |
469 | 469 | |
470 | - if($widget == 'widgetBox') |
|
470 | + if ($widget == 'widgetBox') |
|
471 | 471 | { |
472 | 472 | $widgetbox_content = $args->widgetbox_content; |
473 | 473 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * Wanted specified by the administrator of the widget style |
477 | 477 | */ |
478 | 478 | // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed |
479 | - $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style); |
|
479 | + $style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style); |
|
480 | 480 | // Find a style statement that based on the internal margin dropping pre-change |
481 | 481 | $widget_padding_left = $args->widget_padding_left; |
482 | 482 | $widget_padding_right = $args->widget_padding_right; |
@@ -492,18 +492,18 @@ discard block |
||
492 | 492 | $widget_content_body = ''; |
493 | 493 | $widget_content_footer = ''; |
494 | 494 | // If general call is given on page styles should return immediately dreamin ' |
495 | - if(!$javascript_mode) |
|
495 | + if (!$javascript_mode) |
|
496 | 496 | { |
497 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
498 | - switch($widget) |
|
497 | + if ($args->id) $args->id = ' id="'.$args->id.'" '; |
|
498 | + switch ($widget) |
|
499 | 499 | { |
500 | 500 | // If a direct orthogonal addition information |
501 | 501 | case 'widgetContent' : |
502 | - if($args->document_srl) |
|
502 | + if ($args->document_srl) |
|
503 | 503 | { |
504 | 504 | $oDocumentModel = getModel('document'); |
505 | 505 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
506 | - $body = $oDocument->getContent(false,false,false, false); |
|
506 | + $body = $oDocument->getContent(false, false, false, false); |
|
507 | 507 | } |
508 | 508 | else |
509 | 509 | { |
@@ -513,21 +513,21 @@ discard block |
||
513 | 513 | $oEditorController = getController('editor'); |
514 | 514 | $body = $oEditorController->transComponent($body); |
515 | 515 | |
516 | - $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
516 | + $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
517 | 517 | $widget_content_body = $body; |
518 | 518 | $widget_content_footer = '</div></div>'; |
519 | 519 | |
520 | 520 | break; |
521 | 521 | // If the widget box; it could |
522 | 522 | case 'widgetBox' : |
523 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
523 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
524 | 524 | $widget_content_body = $widgetbox_content; |
525 | 525 | |
526 | 526 | break; |
527 | 527 | // If the General wijetil |
528 | 528 | default : |
529 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style); |
|
530 | - $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content); |
|
529 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style); |
|
530 | + $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content); |
|
531 | 531 | $widget_content_footer = '</div>'; |
532 | 532 | break; |
533 | 533 | } |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | } |
536 | 536 | else |
537 | 537 | { |
538 | - switch($widget) |
|
538 | + switch ($widget) |
|
539 | 539 | { |
540 | 540 | // If a direct orthogonal addition information |
541 | 541 | case 'widgetContent' : |
542 | - if($args->document_srl) |
|
542 | + if ($args->document_srl) |
|
543 | 543 | { |
544 | 544 | $oDocumentModel = getModel('document'); |
545 | 545 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
546 | - $body = $oDocument->getContent(false,false,false); |
|
546 | + $body = $oDocument->getContent(false, false, false); |
|
547 | 547 | } |
548 | 548 | else |
549 | 549 | { |
@@ -551,12 +551,12 @@ discard block |
||
551 | 551 | } |
552 | 552 | // by args |
553 | 553 | $attribute = array(); |
554 | - if($args) |
|
554 | + if ($args) |
|
555 | 555 | { |
556 | - foreach($args as $key => $val) |
|
556 | + foreach ($args as $key => $val) |
|
557 | 557 | { |
558 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
559 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
558 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
559 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
560 | 560 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
561 | 561 | } |
562 | 562 | } |
@@ -564,44 +564,44 @@ discard block |
||
564 | 564 | $oWidgetController = getController('widget'); |
565 | 565 | |
566 | 566 | $widget_content_header = sprintf( |
567 | - '<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
567 | + '<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
568 | 568 | '<div class="widgetResize"></div>'. |
569 | 569 | '<div class="widgetResizeLeft"></div>'. |
570 | 570 | '<div class="widgetBorder">'. |
571 | - '<div style="%s">',$args->widgetstyle, |
|
571 | + '<div style="%s">', $args->widgetstyle, |
|
572 | 572 | $style, |
573 | 573 | $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, |
574 | 574 | $args->document_srl, |
575 | - implode(' ',$attribute), |
|
575 | + implode(' ', $attribute), |
|
576 | 576 | $inner_style); |
577 | 577 | |
578 | 578 | $widget_content_body = $body; |
579 | 579 | $widget_content_footer = sprintf('</div>'. |
580 | 580 | '</div>'. |
581 | 581 | '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'. |
582 | - '</div>',base64_encode($body)); |
|
582 | + '</div>', base64_encode($body)); |
|
583 | 583 | |
584 | 584 | break; |
585 | 585 | // If the widget box; it could |
586 | 586 | case 'widgetBox' : |
587 | 587 | // by args |
588 | 588 | $attribute = array(); |
589 | - if($args) |
|
589 | + if ($args) |
|
590 | 590 | { |
591 | - foreach($args as $key => $val) |
|
591 | + foreach ($args as $key => $val) |
|
592 | 592 | { |
593 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
594 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
595 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
593 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
594 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
595 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
596 | 596 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | 600 | $widget_content_header = sprintf( |
601 | - '<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
601 | + '<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
602 | 602 | '<div class="widgetBoxResize"></div>'. |
603 | 603 | '<div class="widgetBoxResizeLeft"></div>'. |
604 | - '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style); |
|
604 | + '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style); |
|
605 | 605 | |
606 | 606 | $widget_content_body = $widgetbox_content; |
607 | 607 | |
@@ -610,26 +610,26 @@ discard block |
||
610 | 610 | default : |
611 | 611 | // by args |
612 | 612 | $attribute = array(); |
613 | - if($args) |
|
613 | + if ($args) |
|
614 | 614 | { |
615 | - $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
|
616 | - foreach($args as $key => $val) |
|
615 | + $allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget'); |
|
616 | + foreach ($args as $key => $val) |
|
617 | 617 | { |
618 | - if(in_array($key, $allowed_key)) continue; |
|
619 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
620 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
618 | + if (in_array($key, $allowed_key)) continue; |
|
619 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
620 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
621 | 621 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | - $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
625 | + $widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
626 | 626 | '<div class="widgetResize"></div>'. |
627 | 627 | '<div class="widgetResizeLeft"></div>'. |
628 | - '<div class="widgetBorder">',$args->widgetstyle,$style, |
|
628 | + '<div class="widgetBorder">', $args->widgetstyle, $style, |
|
629 | 629 | $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, |
630 | - $widget, implode(' ',$attribute)); |
|
630 | + $widget, implode(' ', $attribute)); |
|
631 | 631 | |
632 | - $widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content); |
|
632 | + $widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content); |
|
633 | 633 | |
634 | 634 | $widget_content_footer = '</div></div>'; |
635 | 635 | |
@@ -637,11 +637,11 @@ discard block |
||
637 | 637 | } |
638 | 638 | } |
639 | 639 | // Compile the widget style. |
640 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
640 | + if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode); |
|
641 | 641 | |
642 | - $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
|
642 | + $output = $widget_content_header.$widget_content_body.$widget_content_footer; |
|
643 | 643 | // Debug widget creation time information added to the results |
644 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
644 | + if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
645 | 645 | |
646 | 646 | $after = microtime(true); |
647 | 647 | |
@@ -662,32 +662,32 @@ discard block |
||
662 | 662 | */ |
663 | 663 | function getWidgetObject($widget) |
664 | 664 | { |
665 | - if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
665 | + if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
666 | 666 | { |
667 | 667 | return Context::getLang('msg_invalid_request'); |
668 | 668 | } |
669 | 669 | |
670 | - if(!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
670 | + if (!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
671 | 671 | { |
672 | 672 | // Finding the location of a widget |
673 | 673 | $oWidgetModel = getModel('widget'); |
674 | 674 | $path = $oWidgetModel->getWidgetPath($widget); |
675 | 675 | // If you do not find the class file error output widget (html output) |
676 | 676 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
677 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
677 | + if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
678 | 678 | // Widget classes include |
679 | 679 | require_once($class_file); |
680 | 680 | |
681 | 681 | // Creating Objects |
682 | - if(!class_exists($widget, false)) |
|
682 | + if (!class_exists($widget, false)) |
|
683 | 683 | { |
684 | 684 | return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
685 | 685 | } |
686 | 686 | |
687 | 687 | $oWidget = new $widget(); |
688 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
688 | + if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
689 | 689 | |
690 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
690 | + if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
691 | 691 | |
692 | 692 | $oWidget->widget_path = $path; |
693 | 693 | |
@@ -696,29 +696,29 @@ discard block |
||
696 | 696 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
697 | 697 | } |
698 | 698 | |
699 | - function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
|
699 | + function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode) |
|
700 | 700 | { |
701 | - if(!$widgetStyle) return $widget_content_body; |
|
701 | + if (!$widgetStyle) return $widget_content_body; |
|
702 | 702 | |
703 | 703 | $oWidgetModel = getModel('widget'); |
704 | 704 | // Bring extra_var widget style tie |
705 | 705 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
706 | - if(!$widgetstyle_info) return $widget_content_body; |
|
706 | + if (!$widgetstyle_info) return $widget_content_body; |
|
707 | 707 | |
708 | 708 | $widgetstyle_extra_var = new stdClass(); |
709 | 709 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
710 | - if(count($widgetstyle_extra_var_key['extra_var'])) |
|
710 | + if (count($widgetstyle_extra_var_key['extra_var'])) |
|
711 | 711 | { |
712 | - foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
712 | + foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
713 | 713 | { |
714 | - $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
714 | + $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | Context::set('widgetstyle_extra_var', $widgetstyle_extra_var); |
718 | 718 | // #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated |
719 | 719 | Context::set('widgetstyle_extar_var', $widgetstyle_extra_var); |
720 | 720 | |
721 | - if($javascript_mode && $widget=='widgetBox') |
|
721 | + if ($javascript_mode && $widget == 'widgetBox') |
|
722 | 722 | { |
723 | 723 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
724 | 724 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $oWidgetModel = getModel('widget'); |
743 | 743 | $widget_info = $oWidgetModel->getWidgetInfo($widget); |
744 | 744 | |
745 | - if(!$vars) |
|
745 | + if (!$vars) |
|
746 | 746 | { |
747 | 747 | $vars = new stdClass(); |
748 | 748 | } |
@@ -753,31 +753,31 @@ discard block |
||
753 | 753 | |
754 | 754 | $vars->skin = trim($request_vars->skin); |
755 | 755 | $vars->colorset = trim($request_vars->colorset); |
756 | - $vars->widget_sequence = (int)($request_vars->widget_sequence); |
|
757 | - $vars->widget_cache = (int)($request_vars->widget_cache); |
|
756 | + $vars->widget_sequence = (int) ($request_vars->widget_sequence); |
|
757 | + $vars->widget_cache = (int) ($request_vars->widget_cache); |
|
758 | 758 | $vars->style = trim($request_vars->style); |
759 | 759 | $vars->widget_padding_left = trim($request_vars->widget_padding_left); |
760 | 760 | $vars->widget_padding_right = trim($request_vars->widget_padding_right); |
761 | 761 | $vars->widget_padding_top = trim($request_vars->widget_padding_top); |
762 | 762 | $vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom); |
763 | - $vars->document_srl= trim($request_vars->document_srl); |
|
763 | + $vars->document_srl = trim($request_vars->document_srl); |
|
764 | 764 | |
765 | - if(count($widget_info->extra_var)) |
|
765 | + if (count($widget_info->extra_var)) |
|
766 | 766 | { |
767 | - foreach($widget_info->extra_var as $key=>$val) |
|
767 | + foreach ($widget_info->extra_var as $key=>$val) |
|
768 | 768 | { |
769 | 769 | $vars->{$key} = trim($request_vars->{$key}); |
770 | 770 | } |
771 | 771 | } |
772 | 772 | // If the widget style |
773 | - if($request_vars->widgetstyle) |
|
773 | + if ($request_vars->widgetstyle) |
|
774 | 774 | { |
775 | 775 | $widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle); |
776 | - if(count($widgetStyle_info->extra_var)) |
|
776 | + if (count($widgetStyle_info->extra_var)) |
|
777 | 777 | { |
778 | - foreach($widgetStyle_info->extra_var as $key=>$val) |
|
778 | + foreach ($widgetStyle_info->extra_var as $key=>$val) |
|
779 | 779 | { |
780 | - if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea') |
|
780 | + if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea') |
|
781 | 781 | { |
782 | 782 | $vars->{$key} = trim($request_vars->{$key}); |
783 | 783 | } |
@@ -785,23 +785,23 @@ discard block |
||
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | - if($vars->widget_sequence) |
|
788 | + if ($vars->widget_sequence) |
|
789 | 789 | { |
790 | 790 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType()); |
791 | 791 | FileHandler::removeFile($cache_file); |
792 | 792 | } |
793 | 793 | |
794 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
794 | + if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence(); |
|
795 | 795 | |
796 | 796 | $attribute = array(); |
797 | - foreach($vars as $key => $val) |
|
797 | + foreach ($vars as $key => $val) |
|
798 | 798 | { |
799 | - if(!$val) |
|
799 | + if (!$val) |
|
800 | 800 | { |
801 | 801 | unset($vars->{$key}); |
802 | 802 | continue; |
803 | 803 | } |
804 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
804 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
805 | 805 | $vars->{$key} = Context::convertEncodingStr($val); |
806 | 806 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
807 | 807 | } |
@@ -27,6 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | // recursive glob |
29 | 29 | // On Windows glob() is case-sensitive. |
30 | + |
|
31 | + /** |
|
32 | + * @param string $sDir |
|
33 | + * @param integer $nFlags |
|
34 | + */ |
|
30 | 35 | public function globr($sDir, $sPattern, $nFlags = NULL) |
31 | 36 | { |
32 | 37 | // Get the list of all matching files currently in the |
@@ -129,6 +134,9 @@ discard block |
||
129 | 134 | $this->markTestIncomplete('XML Schema Language files should be fixed first.'); |
130 | 135 | } |
131 | 136 | |
137 | + /** |
|
138 | + * @param integer $err_code |
|
139 | + */ |
|
132 | 140 | public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '') |
133 | 141 | { |
134 | 142 | $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename); |
@@ -166,6 +174,9 @@ discard block |
||
166 | 174 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS); |
167 | 175 | } |
168 | 176 | |
177 | + /** |
|
178 | + * @param string $dir_name |
|
179 | + */ |
|
169 | 180 | public function getDirFilesList($dir_name) |
170 | 181 | { |
171 | 182 | $output = array(); |
@@ -2,33 +2,33 @@ discard block |
||
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | 4 | if (!defined('__DIR__')) |
5 | - define('__DIR__', realpath(dirname(__FILE__))); |
|
5 | + define('__DIR__', realpath(dirname(__FILE__))); |
|
6 | 6 | |
7 | 7 | /** The tests here are meant only for the built-in checks in validator.php, |
8 | 8 | and not for the entire syntax expressed by the .xsd files. */ |
9 | 9 | class XmlQueriesTest extends PHPUnit_Framework_TestCase |
10 | 10 | { |
11 | - // taken from validator.php |
|
11 | + // taken from validator.php |
|
12 | 12 | |
13 | - const RETCODE_VALIDATOR_INTERNAL = 60; |
|
14 | - const RETCODE_GENERIC_XML_SYNTAX = 50; |
|
15 | - const RETCODE_QUERY_ELEMENT = 40; |
|
16 | - const RETCODE_XSD_VALIDATION = 30; |
|
17 | - const RETCODE_BUILTIN_CHECKS = 20; |
|
18 | - const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented. |
|
19 | - const RETCODE_SUCCESS = 0; |
|
13 | + const RETCODE_VALIDATOR_INTERNAL = 60; |
|
14 | + const RETCODE_GENERIC_XML_SYNTAX = 50; |
|
15 | + const RETCODE_QUERY_ELEMENT = 40; |
|
16 | + const RETCODE_XSD_VALIDATION = 30; |
|
17 | + const RETCODE_BUILTIN_CHECKS = 20; |
|
18 | + const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented. |
|
19 | + const RETCODE_SUCCESS = 0; |
|
20 | 20 | |
21 | - public $validator_cmd; |
|
21 | + public $validator_cmd; |
|
22 | 22 | |
23 | - public function setUp() |
|
24 | - { |
|
23 | + public function setUp() |
|
24 | + { |
|
25 | 25 | $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " "; |
26 | - } |
|
26 | + } |
|
27 | 27 | |
28 | - // recursive glob |
|
29 | - // On Windows glob() is case-sensitive. |
|
30 | - public function globr($sDir, $sPattern, $nFlags = NULL) |
|
31 | - { |
|
28 | + // recursive glob |
|
29 | + // On Windows glob() is case-sensitive. |
|
30 | + public function globr($sDir, $sPattern, $nFlags = NULL) |
|
31 | + { |
|
32 | 32 | // Get the list of all matching files currently in the |
33 | 33 | // directory. |
34 | 34 | |
@@ -41,25 +41,25 @@ discard block |
||
41 | 41 | |
42 | 42 | foreach ($aDirs as $sSubDir) |
43 | 43 | { |
44 | - if ($sSubDir != '.' && $sSubDir != '..') |
|
45 | - { |
|
44 | + if ($sSubDir != '.' && $sSubDir != '..') |
|
45 | + { |
|
46 | 46 | $aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags); |
47 | 47 | $aFiles = array_merge($aFiles, $aSubFiles); |
48 | - } |
|
48 | + } |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // return merged array with all (recursive) files |
52 | 52 | return $aFiles; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */ |
|
56 | - public function invoke_testReleasedXMLLangFiles |
|
55 | + /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */ |
|
56 | + public function invoke_testReleasedXMLLangFiles |
|
57 | 57 | ( |
58 | - $released_files, |
|
59 | - $expected_return_code, |
|
60 | - $validator_args = '' |
|
58 | + $released_files, |
|
59 | + $expected_return_code, |
|
60 | + $validator_args = '' |
|
61 | 61 | ) |
62 | - { |
|
62 | + { |
|
63 | 63 | // this file is in tools/dbxml_validator/tests |
64 | 64 | $xe_dir = __DIR__ . '/../../..'; |
65 | 65 | |
@@ -70,67 +70,67 @@ discard block |
||
70 | 70 | $xml_files = array(); |
71 | 71 | |
72 | 72 | foreach ($released_files as $released_file_mask) |
73 | - $xml_files = |
|
73 | + $xml_files = |
|
74 | 74 | array_merge |
75 | 75 | ( |
76 | - $xml_files, |
|
77 | - $this->globr |
|
76 | + $xml_files, |
|
77 | + $this->globr |
|
78 | 78 | ( |
79 | - $xe_dir, |
|
80 | - $released_file_mask, |
|
81 | - GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR |
|
79 | + $xe_dir, |
|
80 | + $released_file_mask, |
|
81 | + GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR |
|
82 | 82 | ) |
83 | 83 | ); |
84 | 84 | |
85 | 85 | while ($cnt < count($xml_files)) |
86 | 86 | { |
87 | - $cmd = $this->validator_cmd . $validator_args; |
|
87 | + $cmd = $this->validator_cmd . $validator_args; |
|
88 | 88 | |
89 | - // Validate 50 files at once |
|
90 | - foreach (array_slice($xml_files, $cnt, 50) as $xml_file) |
|
89 | + // Validate 50 files at once |
|
90 | + foreach (array_slice($xml_files, $cnt, 50) as $xml_file) |
|
91 | 91 | $cmd .= " " . escapeshellarg($xml_file); |
92 | 92 | |
93 | - exec($cmd . ' 2>&1', $validator_output, $return_code); |
|
93 | + exec($cmd . ' 2>&1', $validator_output, $return_code); |
|
94 | 94 | |
95 | - $output_text = trim(trim(implode("\n", $validator_output)), "\n"); |
|
95 | + $output_text = trim(trim(implode("\n", $validator_output)), "\n"); |
|
96 | 96 | |
97 | - // Validator should not crash/exit-with-an-error. |
|
98 | - $this->assertLessThanOrEqual |
|
97 | + // Validator should not crash/exit-with-an-error. |
|
98 | + $this->assertLessThanOrEqual |
|
99 | 99 | ( |
100 | - $expected_return_code, |
|
101 | - $return_code, |
|
102 | - "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." |
|
100 | + $expected_return_code, |
|
101 | + $return_code, |
|
102 | + "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." |
|
103 | 103 | ); |
104 | 104 | |
105 | - $cnt += 50; |
|
105 | + $cnt += 50; |
|
106 | + } |
|
106 | 107 | } |
107 | - } |
|
108 | 108 | |
109 | - public function testReleasedXMLQueryLangFiles() |
|
110 | - { |
|
109 | + public function testReleasedXMLQueryLangFiles() |
|
110 | + { |
|
111 | 111 | $this->invoke_testReleasedXMLLangFiles |
112 | - ( |
|
112 | + ( |
|
113 | 113 | array('queries/*.xml', 'xml_query/*.xml'), |
114 | 114 | self::RETCODE_QUERY_ELEMENT |
115 | - ); |
|
115 | + ); |
|
116 | 116 | |
117 | 117 | $this->markTestIncomplete('XML Query Language files should be fixed first.'); |
118 | - } |
|
118 | + } |
|
119 | 119 | |
120 | - public function testReleasedXMLSchemaLangFiles() |
|
121 | - { |
|
120 | + public function testReleasedXMLSchemaLangFiles() |
|
121 | + { |
|
122 | 122 | $this->invoke_testReleasedXMLLangFiles |
123 | - ( |
|
123 | + ( |
|
124 | 124 | array('schemas/*.xml'), |
125 | 125 | self::RETCODE_BUILTIN_CHECKS, |
126 | 126 | ' --schema-language' |
127 | - ); |
|
127 | + ); |
|
128 | 128 | |
129 | 129 | $this->markTestIncomplete('XML Schema Language files should be fixed first.'); |
130 | - } |
|
130 | + } |
|
131 | 131 | |
132 | - public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '') |
|
133 | - { |
|
132 | + public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '') |
|
133 | + { |
|
134 | 134 | $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename); |
135 | 135 | $validator_output = array(); |
136 | 136 | $return_code = 0; |
@@ -141,88 +141,88 @@ discard block |
||
141 | 141 | |
142 | 142 | // Validator should not crash/exit-with-an-error. |
143 | 143 | $this->assertEquals |
144 | - ( |
|
144 | + ( |
|
145 | 145 | $err_code, |
146 | 146 | $return_code, |
147 | 147 | "{$cmd}\n{$output_text}\nValidator returned code {$return_code}." |
148 | - ); |
|
148 | + ); |
|
149 | 149 | |
150 | 150 | // Validator should output some error on the test files |
151 | 151 | $basefilename = basename($filename); |
152 | 152 | $this->assertNotEmpty($output_text, "Error reporting failed for {$basefilename} validation."); |
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | - public function testInvalidQueryId() |
|
157 | - { |
|
156 | + public function testInvalidQueryId() |
|
157 | + { |
|
158 | 158 | return $this->invoke_testInvalidXmlFiles(__DIR__.'/data/wrongQueryId.xml', self::RETCODE_QUERY_ELEMENT); |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - /** |
|
162 | - * @dataProvider getFilesList |
|
163 | - */ |
|
164 | - public function testInvalidXMLQueryFiles($filename) |
|
165 | - { |
|
161 | + /** |
|
162 | + * @dataProvider getFilesList |
|
163 | + */ |
|
164 | + public function testInvalidXMLQueryFiles($filename) |
|
165 | + { |
|
166 | 166 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS); |
167 | - } |
|
167 | + } |
|
168 | 168 | |
169 | - public function getDirFilesList($dir_name) |
|
170 | - { |
|
169 | + public function getDirFilesList($dir_name) |
|
170 | + { |
|
171 | 171 | $output = array(); |
172 | 172 | |
173 | 173 | $dir = opendir(__DIR__ . '/' . $dir_name); |
174 | 174 | |
175 | 175 | if ($dir) |
176 | 176 | { |
177 | - $entry = readdir($dir); |
|
177 | + $entry = readdir($dir); |
|
178 | 178 | |
179 | - while ($entry !== FALSE) |
|
180 | - { |
|
179 | + while ($entry !== FALSE) |
|
180 | + { |
|
181 | 181 | $fname = __DIR__ . '/' . $dir_name .'/' . $entry; |
182 | 182 | |
183 | 183 | if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') |
184 | - $output[] = array($fname); |
|
184 | + $output[] = array($fname); |
|
185 | 185 | |
186 | 186 | $entry = readdir($dir); |
187 | - } |
|
187 | + } |
|
188 | 188 | |
189 | - closedir($dir); |
|
189 | + closedir($dir); |
|
190 | 190 | } |
191 | 191 | else |
192 | - $this->assertFalse(TRUE); |
|
192 | + $this->assertFalse(TRUE); |
|
193 | 193 | |
194 | - return $output; |
|
195 | - } |
|
194 | + return $output; |
|
195 | + } |
|
196 | 196 | |
197 | - public function getFilesList() |
|
198 | - { |
|
197 | + public function getFilesList() |
|
198 | + { |
|
199 | 199 | return $this->getDirFilesList('data'); |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - public function getSchemaFilesList() |
|
203 | - { |
|
202 | + public function getSchemaFilesList() |
|
203 | + { |
|
204 | 204 | return $this->getDirFilesList('data/schema'); |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | - public function getSchemaWarningFilesList() |
|
208 | - { |
|
207 | + public function getSchemaWarningFilesList() |
|
208 | + { |
|
209 | 209 | return $this->getDirFilesList('data/schema/warnings'); |
210 | - } |
|
210 | + } |
|
211 | 211 | |
212 | - /** |
|
213 | - * @dataProvider getSchemaFilesList |
|
214 | - */ |
|
215 | - public function testInvalidXMLSchemaFiles($filename) |
|
216 | - { |
|
212 | + /** |
|
213 | + * @dataProvider getSchemaFilesList |
|
214 | + */ |
|
215 | + public function testInvalidXMLSchemaFiles($filename) |
|
216 | + { |
|
217 | 217 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS, '--schema-language'); |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - /** |
|
221 | - * @dataProvider getSchemaWarningFilesList |
|
222 | - */ |
|
223 | - public function testWarningXMLSchemaFiles($filename) |
|
224 | - { |
|
220 | + /** |
|
221 | + * @dataProvider getSchemaWarningFilesList |
|
222 | + */ |
|
223 | + public function testWarningXMLSchemaFiles($filename) |
|
224 | + { |
|
225 | 225 | return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_SUCCESS, '--schema-language'); |
226 | - } |
|
226 | + } |
|
227 | 227 | } |
228 | 228 |
@@ -1,8 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | |
4 | -if (!defined('__DIR__')) |
|
5 | - define('__DIR__', realpath(dirname(__FILE__))); |
|
4 | +if (!defined('__DIR__')) { |
|
5 | + define('__DIR__', realpath(dirname(__FILE__))); |
|
6 | +} |
|
6 | 7 | |
7 | 8 | /** The tests here are meant only for the built-in checks in validator.php, |
8 | 9 | and not for the entire syntax expressed by the .xsd files. */ |
@@ -69,8 +70,8 @@ discard block |
||
69 | 70 | $cmd = $this->validator_cmd; |
70 | 71 | $xml_files = array(); |
71 | 72 | |
72 | - foreach ($released_files as $released_file_mask) |
|
73 | - $xml_files = |
|
73 | + foreach ($released_files as $released_file_mask) { |
|
74 | + $xml_files = |
|
74 | 75 | array_merge |
75 | 76 | ( |
76 | 77 | $xml_files, |
@@ -80,15 +81,17 @@ discard block |
||
80 | 81 | $released_file_mask, |
81 | 82 | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR |
82 | 83 | ) |
83 | - ); |
|
84 | + ); |
|
85 | + } |
|
84 | 86 | |
85 | 87 | while ($cnt < count($xml_files)) |
86 | 88 | { |
87 | 89 | $cmd = $this->validator_cmd . $validator_args; |
88 | 90 | |
89 | 91 | // Validate 50 files at once |
90 | - foreach (array_slice($xml_files, $cnt, 50) as $xml_file) |
|
91 | - $cmd .= " " . escapeshellarg($xml_file); |
|
92 | + foreach (array_slice($xml_files, $cnt, 50) as $xml_file) { |
|
93 | + $cmd .= " " . escapeshellarg($xml_file); |
|
94 | + } |
|
92 | 95 | |
93 | 96 | exec($cmd . ' 2>&1', $validator_output, $return_code); |
94 | 97 | |
@@ -180,16 +183,17 @@ discard block |
||
180 | 183 | { |
181 | 184 | $fname = __DIR__ . '/' . $dir_name .'/' . $entry; |
182 | 185 | |
183 | - if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') |
|
184 | - $output[] = array($fname); |
|
186 | + if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') { |
|
187 | + $output[] = array($fname); |
|
188 | + } |
|
185 | 189 | |
186 | 190 | $entry = readdir($dir); |
187 | 191 | } |
188 | 192 | |
189 | 193 | closedir($dir); |
190 | - } |
|
191 | - else |
|
192 | - $this->assertFalse(TRUE); |
|
194 | + } else { |
|
195 | + $this->assertFalse(TRUE); |
|
196 | + } |
|
193 | 197 | |
194 | 198 | return $output; |
195 | 199 | } |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | const RETCODE_GENERIC_XML_SYNTAX = 50; |
15 | 15 | const RETCODE_QUERY_ELEMENT = 40; |
16 | 16 | const RETCODE_XSD_VALIDATION = 30; |
17 | - const RETCODE_BUILTIN_CHECKS = 20; |
|
18 | - const RETCODE_DB_SCHEMA_MATCH =10; // no schema match is currently implemented. |
|
17 | + const RETCODE_BUILTIN_CHECKS = 20; |
|
18 | + const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented. |
|
19 | 19 | const RETCODE_SUCCESS = 0; |
20 | 20 | |
21 | 21 | public $validator_cmd; |
22 | 22 | |
23 | 23 | public function setUp() |
24 | 24 | { |
25 | - $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " "; |
|
25 | + $this->validator_cmd = "php ".escapeshellarg(__DIR__.'/../validate.php')." "; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // recursive glob |
@@ -53,17 +53,16 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */ |
56 | - public function invoke_testReleasedXMLLangFiles |
|
57 | - ( |
|
56 | + public function invoke_testReleasedXMLLangFiles( |
|
58 | 57 | $released_files, |
59 | 58 | $expected_return_code, |
60 | 59 | $validator_args = '' |
61 | 60 | ) |
62 | 61 | { |
63 | 62 | // this file is in tools/dbxml_validator/tests |
64 | - $xe_dir = __DIR__ . '/../../..'; |
|
63 | + $xe_dir = __DIR__.'/../../..'; |
|
65 | 64 | |
66 | - $this->assertTrue(file_exists($xe_dir . '/index.php'), 'XE directory not found'); |
|
65 | + $this->assertTrue(file_exists($xe_dir.'/index.php'), 'XE directory not found'); |
|
67 | 66 | |
68 | 67 | $cnt = 0; |
69 | 68 | $cmd = $this->validator_cmd; |
@@ -71,11 +70,9 @@ discard block |
||
71 | 70 | |
72 | 71 | foreach ($released_files as $released_file_mask) |
73 | 72 | $xml_files = |
74 | - array_merge |
|
75 | - ( |
|
73 | + array_merge( |
|
76 | 74 | $xml_files, |
77 | - $this->globr |
|
78 | - ( |
|
75 | + $this->globr( |
|
79 | 76 | $xe_dir, |
80 | 77 | $released_file_mask, |
81 | 78 | GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR |
@@ -84,19 +81,18 @@ discard block |
||
84 | 81 | |
85 | 82 | while ($cnt < count($xml_files)) |
86 | 83 | { |
87 | - $cmd = $this->validator_cmd . $validator_args; |
|
84 | + $cmd = $this->validator_cmd.$validator_args; |
|
88 | 85 | |
89 | 86 | // Validate 50 files at once |
90 | 87 | foreach (array_slice($xml_files, $cnt, 50) as $xml_file) |
91 | - $cmd .= " " . escapeshellarg($xml_file); |
|
88 | + $cmd .= " ".escapeshellarg($xml_file); |
|
92 | 89 | |
93 | - exec($cmd . ' 2>&1', $validator_output, $return_code); |
|
90 | + exec($cmd.' 2>&1', $validator_output, $return_code); |
|
94 | 91 | |
95 | 92 | $output_text = trim(trim(implode("\n", $validator_output)), "\n"); |
96 | 93 | |
97 | 94 | // Validator should not crash/exit-with-an-error. |
98 | - $this->assertLessThanOrEqual |
|
99 | - ( |
|
95 | + $this->assertLessThanOrEqual( |
|
100 | 96 | $expected_return_code, |
101 | 97 | $return_code, |
102 | 98 | "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}." |
@@ -108,8 +104,7 @@ discard block |
||
108 | 104 | |
109 | 105 | public function testReleasedXMLQueryLangFiles() |
110 | 106 | { |
111 | - $this->invoke_testReleasedXMLLangFiles |
|
112 | - ( |
|
107 | + $this->invoke_testReleasedXMLLangFiles( |
|
113 | 108 | array('queries/*.xml', 'xml_query/*.xml'), |
114 | 109 | self::RETCODE_QUERY_ELEMENT |
115 | 110 | ); |
@@ -119,8 +114,7 @@ discard block |
||
119 | 114 | |
120 | 115 | public function testReleasedXMLSchemaLangFiles() |
121 | 116 | { |
122 | - $this->invoke_testReleasedXMLLangFiles |
|
123 | - ( |
|
117 | + $this->invoke_testReleasedXMLLangFiles( |
|
124 | 118 | array('schemas/*.xml'), |
125 | 119 | self::RETCODE_BUILTIN_CHECKS, |
126 | 120 | ' --schema-language' |
@@ -131,17 +125,16 @@ discard block |
||
131 | 125 | |
132 | 126 | public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '') |
133 | 127 | { |
134 | - $cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename); |
|
128 | + $cmd = $this->validator_cmd.' '.$args.' '.escapeshellarg($filename); |
|
135 | 129 | $validator_output = array(); |
136 | 130 | $return_code = 0; |
137 | 131 | |
138 | - exec($cmd . '2>&1', $validator_output, $return_code); |
|
132 | + exec($cmd.'2>&1', $validator_output, $return_code); |
|
139 | 133 | |
140 | 134 | $output_text = trim(trim(implode("\n", $validator_output)), "\n"); |
141 | 135 | |
142 | 136 | // Validator should not crash/exit-with-an-error. |
143 | - $this->assertEquals |
|
144 | - ( |
|
137 | + $this->assertEquals( |
|
145 | 138 | $err_code, |
146 | 139 | $return_code, |
147 | 140 | "{$cmd}\n{$output_text}\nValidator returned code {$return_code}." |
@@ -170,7 +163,7 @@ discard block |
||
170 | 163 | { |
171 | 164 | $output = array(); |
172 | 165 | |
173 | - $dir = opendir(__DIR__ . '/' . $dir_name); |
|
166 | + $dir = opendir(__DIR__.'/'.$dir_name); |
|
174 | 167 | |
175 | 168 | if ($dir) |
176 | 169 | { |
@@ -178,9 +171,9 @@ discard block |
||
178 | 171 | |
179 | 172 | while ($entry !== FALSE) |
180 | 173 | { |
181 | - $fname = __DIR__ . '/' . $dir_name .'/' . $entry; |
|
174 | + $fname = __DIR__.'/'.$dir_name.'/'.$entry; |
|
182 | 175 | |
183 | - if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') |
|
176 | + if (!is_dir($fname) && $entry != 'wrongQueryId.xml') |
|
184 | 177 | $output[] = array($fname); |
185 | 178 | |
186 | 179 | $entry = readdir($dir); |