@@ -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 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $this->add('document_srl', $output->get('document_srl')); |
| 172 | 172 | |
| 173 | 173 | // alert a message |
| 174 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 174 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 175 | 175 | { |
| 176 | 176 | $this->setMessage($msg_code); |
| 177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $document_srl = Context::get('document_srl'); |
| 187 | 187 | |
| 188 | 188 | // if the document is not existed |
| 189 | - if(!$document_srl) |
|
| 189 | + if (!$document_srl) |
|
| 190 | 190 | { |
| 191 | 191 | return $this->doError('msg_invalid_document'); |
| 192 | 192 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $oDocumentModel = &getModel('document'); |
| 195 | 195 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 196 | 196 | // check protect content |
| 197 | - if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
|
| 197 | + if ($this->module_info->protect_content == "Y" && $oDocument->get('comment_count') > 0 && $this->grant->manager == false) |
|
| 198 | 198 | { |
| 199 | 199 | return new Object(-1, 'msg_protect_content'); |
| 200 | 200 | } |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | // delete the document |
| 206 | 206 | $output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); |
| 207 | - if(!$output->toBool()) |
|
| 207 | + if (!$output->toBool()) |
|
| 208 | 208 | { |
| 209 | 209 | return $output; |
| 210 | 210 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'), 'act', '', 'page', Context::get('page'), 'document_srl', '')); |
| 214 | 214 | $this->add('mid', Context::get('mid')); |
| 215 | 215 | $this->add('page', Context::get('page')); |
| 216 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 216 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 217 | 217 | { |
| 218 | 218 | $this->setMessage('success_deleted'); |
| 219 | 219 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | function procBoardInsertComment() |
| 238 | 238 | { |
| 239 | 239 | // check grant |
| 240 | - if(!$this->grant->write_comment) |
|
| 240 | + if (!$this->grant->write_comment) |
|
| 241 | 241 | { |
| 242 | 242 | return new Object(-1, 'msg_not_permitted'); |
| 243 | 243 | } |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | $obj = Context::getRequestVars(); |
| 248 | 248 | $obj->module_srl = $this->module_srl; |
| 249 | 249 | |
| 250 | - if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
| 251 | - if(!is_array($this->module_info->use_status)) |
|
| 250 | + if (!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; |
|
| 251 | + if (!is_array($this->module_info->use_status)) |
|
| 252 | 252 | { |
| 253 | 253 | $this->module_info->use_status = explode('|@|', $this->module_info->use_status); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - if(in_array('SECRET', $this->module_info->use_status)) |
|
| 256 | + if (in_array('SECRET', $this->module_info->use_status)) |
|
| 257 | 257 | { |
| 258 | 258 | $this->module_info->secret = 'Y'; |
| 259 | 259 | } |
@@ -266,17 +266,17 @@ discard block |
||
| 266 | 266 | // check if the doument is existed |
| 267 | 267 | $oDocumentModel = getModel('document'); |
| 268 | 268 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
| 269 | - if(!$oDocument->isExists()) |
|
| 269 | + if (!$oDocument->isExists()) |
|
| 270 | 270 | { |
| 271 | - return new Object(-1,'msg_not_founded'); |
|
| 271 | + return new Object(-1, 'msg_not_founded'); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // For anonymous use, remove writer's information and notifying information |
| 275 | - if($this->module_info->use_anonymous == 'Y') |
|
| 275 | + if ($this->module_info->use_anonymous == 'Y') |
|
| 276 | 276 | { |
| 277 | 277 | $this->module_info->admin_mail = ''; |
| 278 | 278 | $obj->notify_message = 'N'; |
| 279 | - $obj->member_srl = -1*$logged_info->member_srl; |
|
| 279 | + $obj->member_srl = -1 * $logged_info->member_srl; |
|
| 280 | 280 | $obj->email_address = $obj->homepage = $obj->user_id = ''; |
| 281 | 281 | $obj->user_name = $obj->nick_name = 'anonymous'; |
| 282 | 282 | $bAnonymous = true; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | // check the comment is existed |
| 296 | 296 | // if the comment is not existed, then generate a new sequence |
| 297 | - if(!$obj->comment_srl) |
|
| 297 | + if (!$obj->comment_srl) |
|
| 298 | 298 | { |
| 299 | 299 | $obj->comment_srl = getNextSequence(); |
| 300 | 300 | } else { |
@@ -302,14 +302,14 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // if comment_srl is not existed, then insert the comment |
| 305 | - if($comment->comment_srl != $obj->comment_srl) |
|
| 305 | + if ($comment->comment_srl != $obj->comment_srl) |
|
| 306 | 306 | { |
| 307 | 307 | |
| 308 | 308 | // parent_srl is existed |
| 309 | - if($obj->parent_srl) |
|
| 309 | + if ($obj->parent_srl) |
|
| 310 | 310 | { |
| 311 | 311 | $parent_comment = $oCommentModel->getComment($obj->parent_srl); |
| 312 | - if(!$parent_comment->comment_srl) |
|
| 312 | + if (!$parent_comment->comment_srl) |
|
| 313 | 313 | { |
| 314 | 314 | return new Object(-1, 'msg_invalid_request'); |
| 315 | 315 | } |
@@ -323,9 +323,9 @@ discard block |
||
| 323 | 323 | // update the comment if it is not existed |
| 324 | 324 | } else { |
| 325 | 325 | // check the grant |
| 326 | - if(!$comment->isGranted()) |
|
| 326 | + if (!$comment->isGranted()) |
|
| 327 | 327 | { |
| 328 | - return new Object(-1,'msg_not_permitted'); |
|
| 328 | + return new Object(-1, 'msg_not_permitted'); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | $obj->parent_srl = $comment->parent_srl; |
@@ -333,12 +333,12 @@ discard block |
||
| 333 | 333 | $comment_srl = $obj->comment_srl; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if(!$output->toBool()) |
|
| 336 | + if (!$output->toBool()) |
|
| 337 | 337 | { |
| 338 | 338 | return $output; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 341 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 342 | 342 | { |
| 343 | 343 | $this->setMessage('success_registed'); |
| 344 | 344 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | { |
| 355 | 355 | // get the comment_srl |
| 356 | 356 | $comment_srl = Context::get('comment_srl'); |
| 357 | - if(!$comment_srl) |
|
| 357 | + if (!$comment_srl) |
|
| 358 | 358 | { |
| 359 | 359 | return $this->doError('msg_invalid_request'); |
| 360 | 360 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $oCommentController = getController('comment'); |
| 364 | 364 | |
| 365 | 365 | $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager); |
| 366 | - if(!$output->toBool()) |
|
| 366 | + if (!$output->toBool()) |
|
| 367 | 367 | { |
| 368 | 368 | return $output; |
| 369 | 369 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $this->add('mid', Context::get('mid')); |
| 372 | 372 | $this->add('page', Context::get('page')); |
| 373 | 373 | $this->add('document_srl', $output->get('document_srl')); |
| 374 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 374 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 375 | 375 | { |
| 376 | 376 | $this->setMessage('success_deleted'); |
| 377 | 377 | } |
@@ -387,10 +387,10 @@ discard block |
||
| 387 | 387 | // generate trackback module controller object |
| 388 | 388 | $oTrackbackController = getController('trackback'); |
| 389 | 389 | |
| 390 | - if(!$oTrackbackController) return; |
|
| 390 | + if (!$oTrackbackController) return; |
|
| 391 | 391 | |
| 392 | 392 | $output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager); |
| 393 | - if(!$output->toBool()) |
|
| 393 | + if (!$output->toBool()) |
|
| 394 | 394 | { |
| 395 | 395 | return $output; |
| 396 | 396 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $this->add('mid', Context::get('mid')); |
| 399 | 399 | $this->add('page', Context::get('page')); |
| 400 | 400 | $this->add('document_srl', $output->get('document_srl')); |
| 401 | - if(Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 401 | + if (Context::get('xeVirtualRequestMethod') !== 'xml') |
|
| 402 | 402 | { |
| 403 | 403 | $this->setMessage('success_deleted'); |
| 404 | 404 | } |
@@ -417,18 +417,18 @@ discard block |
||
| 417 | 417 | $oMemberModel = getModel('member'); |
| 418 | 418 | |
| 419 | 419 | // if the comment exists |
| 420 | - if($comment_srl) |
|
| 420 | + if ($comment_srl) |
|
| 421 | 421 | { |
| 422 | 422 | // get the comment information |
| 423 | 423 | $oCommentModel = getModel('comment'); |
| 424 | 424 | $oComment = $oCommentModel->getComment($comment_srl); |
| 425 | - if(!$oComment->isExists()) |
|
| 425 | + if (!$oComment->isExists()) |
|
| 426 | 426 | { |
| 427 | 427 | return new Object(-1, 'msg_invalid_request'); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // compare the comment password and the user input password |
| 431 | - if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) |
|
| 431 | + if (!$oMemberModel->isValidPassword($oComment->get('password'), $password)) |
|
| 432 | 432 | { |
| 433 | 433 | return new Object(-1, 'msg_invalid_password'); |
| 434 | 434 | } |
@@ -438,13 +438,13 @@ discard block |
||
| 438 | 438 | // get the document information |
| 439 | 439 | $oDocumentModel = getModel('document'); |
| 440 | 440 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 441 | - if(!$oDocument->isExists()) |
|
| 441 | + if (!$oDocument->isExists()) |
|
| 442 | 442 | { |
| 443 | 443 | return new Object(-1, 'msg_invalid_request'); |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | // compare the document password and the user input password |
| 447 | - if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) |
|
| 447 | + if (!$oMemberModel->isValidPassword($oDocument->get('password'), $password)) |
|
| 448 | 448 | { |
| 449 | 449 | return new Object(-1, 'msg_invalid_password'); |
| 450 | 450 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $member_srl = Context::get('target_srl'); |
| 462 | 462 | $mid = Context::get('cur_mid'); |
| 463 | 463 | |
| 464 | - if(!$member_srl || !$mid) |
|
| 464 | + if (!$member_srl || !$mid) |
|
| 465 | 465 | { |
| 466 | 466 | return new Object(); |
| 467 | 467 | } |
@@ -473,13 +473,13 @@ discard block |
||
| 473 | 473 | $columnList = array('module'); |
| 474 | 474 | $cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList); |
| 475 | 475 | |
| 476 | - if($cur_module_info->module != 'board') |
|
| 476 | + if ($cur_module_info->module != 'board') |
|
| 477 | 477 | { |
| 478 | 478 | return new Object(); |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | // get the member information |
| 482 | - if($member_srl == $logged_info->member_srl) |
|
| 482 | + if ($member_srl == $logged_info->member_srl) |
|
| 483 | 483 | { |
| 484 | 484 | $member_info = $logged_info; |
| 485 | 485 | } else { |
@@ -487,13 +487,13 @@ discard block |
||
| 487 | 487 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - if(!$member_info->user_id) |
|
| 490 | + if (!$member_info->user_id) |
|
| 491 | 491 | { |
| 492 | 492 | return new Object(); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | //search |
| 496 | - $url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); |
|
| 496 | + $url = getUrl('', 'mid', $mid, 'search_target', 'nick_name', 'search_keyword', $member_info->nick_name); |
|
| 497 | 497 | $oMemberController = getController('member'); |
| 498 | 498 | $oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); |
| 499 | 499 | |