@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | function procBoardInsertDocument() |
24 | 24 | { |
25 | 25 | // check grant |
26 | - if($this->module_info->module != "board") |
|
26 | + if ($this->module_info->module != "board") |
|
27 | 27 | { |
28 | 28 | return new Object(-1, "msg_invalid_request"); |
29 | 29 | } |
30 | - if(!$this->grant->write_document) |
|
30 | + if (!$this->grant->write_document) |
|
31 | 31 | { |
32 | 32 | return new Object(-1, 'msg_not_permitted'); |
33 | 33 | } |
@@ -36,16 +36,16 @@ discard block |
||
36 | 36 | // setup variables |
37 | 37 | $obj = Context::getRequestVars(); |
38 | 38 | $obj->module_srl = $this->module_srl; |
39 | - if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N'; |
|
39 | + if ($obj->is_notice != 'Y' || !$this->grant->manager) $obj->is_notice = 'N'; |
|
40 | 40 | $obj->commentStatus = $obj->comment_status; |
41 | 41 | |
42 | 42 | settype($obj->title, "string"); |
43 | - if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); |
|
43 | + if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...'); |
|
44 | 44 | //setup dpcument title tp 'Untitled' |
45 | - if($obj->title == '') $obj->title = 'Untitled'; |
|
45 | + if ($obj->title == '') $obj->title = 'Untitled'; |
|
46 | 46 | |
47 | 47 | // unset document style if the user is not the document manager |
48 | - if(!$this->grant->manager) |
|
48 | + if (!$this->grant->manager) |
|
49 | 49 | { |
50 | 50 | unset($obj->title_color); |
51 | 51 | unset($obj->title_bold); |
@@ -62,24 +62,24 @@ discard block |
||
62 | 62 | |
63 | 63 | // update the document if it is existed |
64 | 64 | $is_update = false; |
65 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
65 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
66 | 66 | { |
67 | 67 | $is_update = true; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // if use anonymous is true |
71 | - if($this->module_info->use_anonymous == 'Y') |
|
71 | + if ($this->module_info->use_anonymous == 'Y') |
|
72 | 72 | { |
73 | 73 | $this->module_info->admin_mail = ''; |
74 | 74 | $obj->notify_message = 'N'; |
75 | - if($is_update===false) |
|
75 | + if ($is_update === false) |
|
76 | 76 | { |
77 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
77 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
78 | 78 | } |
79 | 79 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
80 | 80 | $obj->user_name = $obj->nick_name = 'anonymous'; |
81 | 81 | $bAnonymous = true; |
82 | - if($is_update===false) |
|
82 | + if ($is_update === false) |
|
83 | 83 | { |
84 | 84 | $oDocument->add('member_srl', $obj->member_srl); |
85 | 85 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | $bAnonymous = false; |
90 | 90 | } |
91 | 91 | |
92 | - if($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
92 | + if ($obj->is_secret == 'Y' || strtoupper($obj->status == 'SECRET')) |
|
93 | 93 | { |
94 | 94 | $use_status = explode('|@|', $this->module_info->use_status); |
95 | - if(!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
95 | + if (!is_array($use_status) || !in_array('SECRET', $use_status)) |
|
96 | 96 | { |
97 | 97 | unset($obj->is_secret); |
98 | 98 | $obj->status = 'PUBLIC'; |
@@ -100,24 +100,24 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | // update the document if it is existed |
103 | - if($is_update) |
|
103 | + if ($is_update) |
|
104 | 104 | { |
105 | - if(!$oDocument->isGranted()) |
|
105 | + if (!$oDocument->isGranted()) |
|
106 | 106 | { |
107 | - return new Object(-1,'msg_not_permitted'); |
|
107 | + return new Object(-1, 'msg_not_permitted'); |
|
108 | 108 | } |
109 | 109 | |
110 | - if($this->module_info->use_anonymous == 'Y') { |
|
110 | + if ($this->module_info->use_anonymous == 'Y') { |
|
111 | 111 | $obj->member_srl = abs($oDocument->get('member_srl')) * -1; |
112 | 112 | $oDocument->add('member_srl', $obj->member_srl); |
113 | 113 | } |
114 | 114 | |
115 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
115 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
116 | 116 | { |
117 | - return new Object(-1,'msg_protect_content'); |
|
117 | + return new Object(-1, 'msg_protect_content'); |
|
118 | 118 | } |
119 | 119 | |
120 | - if(!$this->grant->manager) |
|
120 | + if (!$this->grant->manager) |
|
121 | 121 | { |
122 | 122 | // notice & document style same as before if not manager |
123 | 123 | $obj->is_notice = $oDocument->get('is_notice'); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | // modify list_order if document status is temp |
129 | - if($oDocument->get('status') == 'TEMP') |
|
129 | + if ($oDocument->get('status') == 'TEMP') |
|
130 | 130 | { |
131 | 131 | $obj->last_update = $obj->regdate = date('YmdHis'); |
132 | 132 | $obj->update_order = $obj->list_order = (getNextSequence() * -1); |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | $obj->document_srl = $output->get('document_srl'); |
143 | 143 | |
144 | 144 | // send an email to admin user |
145 | - if($output->toBool() && $this->module_info->admin_mail) |
|
145 | + if ($output->toBool() && $this->module_info->admin_mail) |
|
146 | 146 | { |
147 | 147 | $oMail = new Mail(); |
148 | 148 | $oMail->setTitle($obj->title); |
149 | - $oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content)); |
|
149 | + $oMail->setContent(sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('', 'document_srl', $obj->document_srl), getFullUrl('', 'document_srl', $obj->document_srl), $obj->content)); |
|
150 | 150 | $oMail->setSender($obj->user_name, $obj->email_address); |
151 | 151 | |
152 | - $target_mail = explode(',',$this->module_info->admin_mail); |
|
153 | - for($i=0;$i<count($target_mail);$i++) |
|
152 | + $target_mail = explode(',', $this->module_info->admin_mail); |
|
153 | + for ($i = 0; $i < count($target_mail); $i++) |
|
154 | 154 | { |
155 | 155 | $email_address = trim($target_mail[$i]); |
156 | - if(!$email_address) continue; |
|
156 | + if (!$email_address) continue; |
|
157 | 157 | $oMail->setReceiptor($email_address, $email_address); |
158 | 158 | $oMail->send(); |
159 | 159 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | // if there is an error |
164 | - if(!$output->toBool()) |
|
164 | + if (!$output->toBool()) |
|
165 | 165 | { |
166 | 166 | return $output; |
167 | 167 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $document_srl = Context::get('document_srl'); |
184 | 184 | |
185 | 185 | // if the document is not existed |
186 | - if(!$document_srl) |
|
186 | + if (!$document_srl) |
|
187 | 187 | { |
188 | 188 | return $this->doError('msg_invalid_document'); |
189 | 189 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $oDocumentModel = &getModel('document'); |
192 | 192 | $oDocument = $oDocumentModel->getDocument($document_srl); |
193 | 193 | // check protect content |
194 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
194 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
195 | 195 | { |
196 | 196 | return new Object(-1, 'msg_protect_content'); |
197 | 197 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | // delete the document |
203 | 203 | $output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); |
204 | - if(!$output->toBool()) |
|
204 | + if (!$output->toBool()) |
|
205 | 205 | { |
206 | 206 | return $output; |
207 | 207 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | function procBoardInsertComment() |
232 | 232 | { |
233 | 233 | // check grant |
234 | - if(!$this->grant->write_comment) |
|
234 | + if (!$this->grant->write_comment) |
|
235 | 235 | { |
236 | 236 | return new Object(-1, 'msg_not_permitted'); |
237 | 237 | } |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | $obj = Context::getRequestVars(); |
242 | 242 | $obj->module_srl = $this->module_srl; |
243 | 243 | |
244 | - if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
245 | - if(!is_array($this->module_info->use_status)) |
|
244 | + if (!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
245 | + if (!is_array($this->module_info->use_status)) |
|
246 | 246 | { |
247 | 247 | $this->module_info->use_status = explode('|@|', $this->module_info->use_status); |
248 | 248 | } |
249 | 249 | |
250 | - if(in_array('SECRET', $this->module_info->use_status)) |
|
250 | + if (in_array('SECRET', $this->module_info->use_status)) |
|
251 | 251 | { |
252 | 252 | $this->module_info->secret = 'Y'; |
253 | 253 | } |
@@ -260,17 +260,17 @@ discard block |
||
260 | 260 | // check if the doument is existed |
261 | 261 | $oDocumentModel = getModel('document'); |
262 | 262 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
263 | - if(!$oDocument->isExists()) |
|
263 | + if (!$oDocument->isExists()) |
|
264 | 264 | { |
265 | - return new Object(-1,'msg_not_founded'); |
|
265 | + return new Object(-1, 'msg_not_founded'); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | // For anonymous use, remove writer's information and notifying information |
269 | - if($this->module_info->use_anonymous == 'Y') |
|
269 | + if ($this->module_info->use_anonymous == 'Y') |
|
270 | 270 | { |
271 | 271 | $this->module_info->admin_mail = ''; |
272 | 272 | $obj->notify_message = 'N'; |
273 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
273 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
274 | 274 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
275 | 275 | $obj->user_name = $obj->nick_name = 'anonymous'; |
276 | 276 | $bAnonymous = true; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | // check the comment is existed |
290 | 290 | // if the comment is not existed, then generate a new sequence |
291 | - if(!$obj->comment_srl) |
|
291 | + if (!$obj->comment_srl) |
|
292 | 292 | { |
293 | 293 | $obj->comment_srl = getNextSequence(); |
294 | 294 | } else { |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | } |
297 | 297 | |
298 | 298 | // if comment_srl is not existed, then insert the comment |
299 | - if($comment->comment_srl != $obj->comment_srl) |
|
299 | + if ($comment->comment_srl != $obj->comment_srl) |
|
300 | 300 | { |
301 | 301 | |
302 | 302 | // parent_srl is existed |
303 | - if($obj->parent_srl) |
|
303 | + if ($obj->parent_srl) |
|
304 | 304 | { |
305 | 305 | $parent_comment = $oCommentModel->getComment($obj->parent_srl); |
306 | - if(!$parent_comment->comment_srl) |
|
306 | + if (!$parent_comment->comment_srl) |
|
307 | 307 | { |
308 | 308 | return new Object(-1, 'msg_invalid_request'); |
309 | 309 | } |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | // update the comment if it is not existed |
318 | 318 | } else { |
319 | 319 | // check the grant |
320 | - if(!$comment->isGranted()) |
|
320 | + if (!$comment->isGranted()) |
|
321 | 321 | { |
322 | - return new Object(-1,'msg_not_permitted'); |
|
322 | + return new Object(-1, 'msg_not_permitted'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | $obj->parent_srl = $comment->parent_srl; |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | $comment_srl = $obj->comment_srl; |
328 | 328 | } |
329 | 329 | |
330 | - if(!$output->toBool()) |
|
330 | + if (!$output->toBool()) |
|
331 | 331 | { |
332 | 332 | return $output; |
333 | 333 | } |
334 | 334 | |
335 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
335 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
336 | 336 | { |
337 | 337 | $this->setMessage('success_registed'); |
338 | 338 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | { |
349 | 349 | // get the comment_srl |
350 | 350 | $comment_srl = Context::get('comment_srl'); |
351 | - if(!$comment_srl) |
|
351 | + if (!$comment_srl) |
|
352 | 352 | { |
353 | 353 | return $this->doError('msg_invalid_request'); |
354 | 354 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $oCommentController = getController('comment'); |
358 | 358 | |
359 | 359 | $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager); |
360 | - if(!$output->toBool()) |
|
360 | + if (!$output->toBool()) |
|
361 | 361 | { |
362 | 362 | return $output; |
363 | 363 | } |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | // generate trackback module controller object |
379 | 379 | $oTrackbackController = getController('trackback'); |
380 | 380 | |
381 | - if(!$oTrackbackController) return; |
|
381 | + if (!$oTrackbackController) return; |
|
382 | 382 | |
383 | 383 | $output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager); |
384 | - if(!$output->toBool()) |
|
384 | + if (!$output->toBool()) |
|
385 | 385 | { |
386 | 386 | return $output; |
387 | 387 | } |
@@ -405,18 +405,18 @@ discard block |
||
405 | 405 | $oMemberModel = getModel('member'); |
406 | 406 | |
407 | 407 | // if the comment exists |
408 | - if($comment_srl) |
|
408 | + if ($comment_srl) |
|
409 | 409 | { |
410 | 410 | // get the comment information |
411 | 411 | $oCommentModel = getModel('comment'); |
412 | 412 | $oComment = $oCommentModel->getComment($comment_srl); |
413 | - if(!$oComment->isExists()) |
|
413 | + if (!$oComment->isExists()) |
|
414 | 414 | { |
415 | 415 | return new Object(-1, 'msg_invalid_request'); |
416 | 416 | } |
417 | 417 | |
418 | 418 | // compare the comment password and the user input password |
419 | - if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) |
|
419 | + if (!$oMemberModel->isValidPassword($oComment->get('password'), $password)) |
|
420 | 420 | { |
421 | 421 | return new Object(-1, 'msg_invalid_password'); |
422 | 422 | } |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | // get the document information |
427 | 427 | $oDocumentModel = getModel('document'); |
428 | 428 | $oDocument = $oDocumentModel->getDocument($document_srl); |
429 | - if(!$oDocument->isExists()) |
|
429 | + if (!$oDocument->isExists()) |
|
430 | 430 | { |
431 | 431 | return new Object(-1, 'msg_invalid_request'); |
432 | 432 | } |
433 | 433 | |
434 | 434 | // compare the document password and the user input password |
435 | - if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) |
|
435 | + if (!$oMemberModel->isValidPassword($oDocument->get('password'), $password)) |
|
436 | 436 | { |
437 | 437 | return new Object(-1, 'msg_invalid_password'); |
438 | 438 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $member_srl = Context::get('target_srl'); |
450 | 450 | $mid = Context::get('cur_mid'); |
451 | 451 | |
452 | - if(!$member_srl || !$mid) |
|
452 | + if (!$member_srl || !$mid) |
|
453 | 453 | { |
454 | 454 | return new Object(); |
455 | 455 | } |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | $columnList = array('module'); |
462 | 462 | $cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList); |
463 | 463 | |
464 | - if($cur_module_info->module != 'board') |
|
464 | + if ($cur_module_info->module != 'board') |
|
465 | 465 | { |
466 | 466 | return new Object(); |
467 | 467 | } |
468 | 468 | |
469 | 469 | // get the member information |
470 | - if($member_srl == $logged_info->member_srl) |
|
470 | + if ($member_srl == $logged_info->member_srl) |
|
471 | 471 | { |
472 | 472 | $member_info = $logged_info; |
473 | 473 | } else { |
@@ -475,13 +475,13 @@ discard block |
||
475 | 475 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
476 | 476 | } |
477 | 477 | |
478 | - if(!$member_info->user_id) |
|
478 | + if (!$member_info->user_id) |
|
479 | 479 | { |
480 | 480 | return new Object(); |
481 | 481 | } |
482 | 482 | |
483 | 483 | //search |
484 | - $url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); |
|
484 | + $url = getUrl('', 'mid', $mid, 'search_target', 'nick_name', 'search_keyword', $member_info->nick_name); |
|
485 | 485 | $oMemberController = getController('member'); |
486 | 486 | $oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); |
487 | 487 |