32 return new BaseObject(-1,
'msg_invalid_request');
38 return new BaseObject(-1,
'msg_invalid_request');
41 $oCommentModel =
getModel(
'comment');
42 $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
46 return new BaseObject(-1,
'msg_invalid_request');
51 if($comment_config->use_vote_up ==
'N')
53 return new BaseObject(-1,
'msg_invalid_request');
58 $this->
add(
'voted_count',
$output->get(
'voted_count'));
70 return new BaseObject(-1,
'msg_invalid_request');
76 return new BaseObject(-1,
'msg_invalid_request');
79 $oCommentModel =
getModel(
'comment');
80 $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
84 return new BaseObject(-1,
'msg_invalid_request');
89 if($comment_config->use_vote_down ==
'N')
91 return new BaseObject(-1,
'msg_invalid_request');
96 $this->
add(
'blamed_count',
$output->get(
'blamed_count'));
108 return new BaseObject(-1,
'msg_invalid_request');
114 return new BaseObject(-1,
'msg_invalid_request');
148 return $oCommentController->deleteModuleComments(
$module_srl);
158 $_SESSION[
'own_comment'][$comment_srl] = TRUE;
177 $use_validation = FALSE;
178 if(isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation ==
"Y")
180 $use_validation = TRUE;
182 return $use_validation;
195 return new BaseObject(-1,
'msg_invalid_request');
200 $obj =
new stdClass();
206 if(!$manual_inserted)
226 if(!$using_validation)
241 $obj->__isupdate = FALSE;
254 return new BaseObject(-1,
'msg_invalid_document');
267 if(!$manual_inserted)
273 return new BaseObject(-1,
'msg_invalid_document');
275 if($oDocument->isLocked())
277 return new BaseObject(-1,
'msg_invalid_request');
283 if(!preg_match(
'/^[a-z]+:\/\//i',
$obj->homepage))
285 $obj->homepage =
'http://'.$obj->homepage;
307 return new BaseObject(-1,
'msg_invalid_request');
310 if(!
$obj->comment_srl)
316 return new BaseObject(-1,
'msg_not_permitted');
323 $obj->content = preg_replace(
'!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is',
'',
$obj->content);
327 if(
$obj->use_html !=
'Y')
329 $obj->content = htmlspecialchars(
$obj->content, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
331 $obj->content = nl2br(
$obj->content);
336 $obj->regdate = date(
"YmdHis");
345 if(!
$obj->notify_message)
347 $obj->notify_message =
'N';
352 $obj->is_secret =
'N';
360 $list_args =
new stdClass();
361 $list_args->comment_srl =
$obj->comment_srl;
362 $list_args->document_srl =
$obj->document_srl;
363 $list_args->module_srl =
$obj->module_srl;
364 $list_args->regdate =
$obj->regdate;
367 if(!
$obj->parent_srl)
369 $list_args->head = $list_args->arrange =
$obj->comment_srl;
370 $list_args->depth = 0;
376 $parent_args =
new stdClass();
377 $parent_args->comment_srl =
$obj->parent_srl;
378 $parent_output =
executeQuery(
'comment.getCommentListItem', $parent_args);
381 if(!$parent_output->toBool() || !$parent_output->data)
386 $parent = $parent_output->data;
388 $list_args->head = $parent->head;
389 $list_args->depth = $parent->depth + 1;
392 if($list_args->depth < 2)
394 $list_args->arrange =
$obj->comment_srl;
400 $p_args =
new stdClass();
401 $p_args->head = $parent->head;
402 $p_args->arrange = $parent->arrange;
403 $p_args->depth = $parent->depth;
408 $list_args->arrange =
$output->data->arrange;
413 $list_args->arrange =
$obj->comment_srl;
433 $oCommentModel =
getModel(
'comment');
436 $comment_count = $oCommentModel->getCommentCount(
$document_srl);
442 if(!$using_validation)
455 if(!$manual_inserted)
464 if(!$trigger_output->toBool())
467 return $trigger_output;
474 if(!$manual_inserted)
482 $oParent = $oCommentModel->getComment(
$obj->parent_srl);
483 if($oParent->get(
'member_srl') != $oDocument->get(
'member_srl'))
511 if(isset(
$obj->member_srl) && !is_null(
$obj->member_srl))
513 $member_info = $oMemberModel->getMemberInfoByMemberSrl(
$obj->member_srl);
517 $member_info =
new stdClass();
518 $member_info->is_admin =
"N";
519 $member_info->nick_name =
$obj->nick_name;
520 $member_info->user_name =
$obj->user_name;
521 $member_info->email_address =
$obj->email_address;
524 $oCommentModel =
getModel(
"comment");
525 $nr_comments_not_approved = $oCommentModel->getCommentAllCount(NULL, FALSE);
531 if(
$module_info->admin_mail && $member_info->is_admin !=
'Y')
534 $oMail->setSender(
$obj->email_address,
$obj->email_address);
535 $mail_title =
"[XE - " .
Context::get(
'mid') .
"] A new comment was posted on document: \"" . $oDocument->getTitleText() .
"\"";
536 $oMail->setTitle($mail_title);
537 $url_comment =
getFullUrl(
'',
'document_srl',
$obj->document_srl).
'#comment_'.
$obj->comment_srl;
538 if($using_validation)
540 $url_approve =
getFullUrl(
'',
'module',
'admin',
'act',
'procCommentAdminChangePublishedStatusChecked',
'cart[]',
$obj->comment_srl,
'will_publish',
'1',
'search_target',
'is_published',
'search_keyword',
'N');
541 $url_trash =
getFullUrl(
'',
'module',
'admin',
'act',
'procCommentAdminDeleteChecked',
'cart[]',
$obj->comment_srl,
'search_target',
'is_trash',
'search_keyword',
'true');
543 A new comment on the document \"" . $oDocument->getTitleText() .
"\" is waiting for your approval.
546 Author: " . $member_info->nick_name .
"
547 <br />Author e-mail: " . $member_info->email_address .
"
548 <br />From : <a href=\"" . $url_comment .
"\">" . $url_comment .
"</a>
550 <br />\"" .
$obj->content .
"\"
552 <br />\"" . $oDocument->getContentText().
"\"
555 Approve it: <a href=\"" . $url_approve .
"\">" . $url_approve .
"</a>
556 <br />Trash it: <a href=\"" . $url_trash .
"\">" . $url_trash .
"</a>
557 <br />Currently " . $nr_comments_not_approved .
" comments on \"" .
Context::get(
'mid') .
"\" module are waiting for approval. Please visit the moderation panel:
558 <br /><a href=\"" .
getFullUrl(
'',
'module',
'admin',
'act',
'dispCommentAdminList',
'search_target',
'module',
'search_keyword',
$obj->module_srl) .
"\">" .
getFullUrl(
'',
'module',
'admin',
'act',
'dispCommentAdminList',
'search_target',
'module',
'search_keyword',
$obj->module_srl) .
"</a>
560 $oMail->setContent($mail_content);
565 Author: " . $member_info->nick_name .
"
566 <br />Author e-mail: " . $member_info->email_address .
"
567 <br />From : <a href=\"" . $url_comment .
"\">" . $url_comment .
"</a>
569 <br />\"" .
$obj->content .
"\"
571 <br />\"" . $oDocument->getContentText().
"\"
573 $oMail->setContent($mail_content);
576 $document_author_email = $oDocument->variables[
'email_address'];
597 $target_mail = explode(
',', $admins_emails);
600 for($i = 0; $i < count($target_mail); $i++)
602 $email_address = trim($target_mail[$i]);
608 $oMail->setReceiptor($email_address, $email_address);
614 $comment_srl_list = array(0 =>
$obj->comment_srl);
651 return new BaseObject(-1,
'msg_invalid_request');
656 $obj =
new stdClass();
659 $obj->__isupdate = TRUE;
669 $oCommentModel =
getModel(
'comment');
672 $source_obj = $oCommentModel->getComment(
$obj->comment_srl);
673 if(!$source_obj->getMemberSrl())
675 $obj->member_srl = $source_obj->get(
'member_srl');
676 $obj->user_name = $source_obj->get(
'user_name');
677 $obj->nick_name = $source_obj->get(
'nick_name');
678 $obj->email_address = $source_obj->get(
'email_address');
679 $obj->homepage = $source_obj->get(
'homepage');
683 if(!$is_admin && !$source_obj->isGranted())
685 return new BaseObject(-1,
'msg_not_permitted');
696 if(!preg_match(
'/^[a-z]+:\/\//i',
$obj->homepage))
698 $obj->homepage =
'http://'.$obj->homepage;
717 if($source_obj->get(
'member_srl') && !
$obj->nick_name)
719 $obj->member_srl = $source_obj->get(
'member_srl');
720 $obj->user_name = $source_obj->get(
'user_name');
721 $obj->nick_name = $source_obj->get(
'nick_name');
722 $obj->email_address = $source_obj->get(
'email_address');
723 $obj->homepage = $source_obj->get(
'homepage');
728 $obj->content = $source_obj->get(
'content');
732 $obj->content = preg_replace(
'!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is',
'',
$obj->content);
736 if(
$obj->use_html !=
'Y')
738 $obj->content = htmlspecialchars(
$obj->content, ENT_COMPAT | ENT_HTML401,
'UTF-8',
false);
740 $obj->content = nl2br(
$obj->content);
765 if(!$trigger_output->toBool())
768 return $trigger_output;
787 function deleteComment($comment_srl, $is_admin = FALSE, $isMoveToTrash = FALSE)
790 $oCommentModel =
getModel(
'comment');
793 $comment = $oCommentModel->getComment($comment_srl);
794 if($comment->comment_srl != $comment_srl)
796 return new BaseObject(-1,
'msg_invalid_request');
809 if(!$is_admin && !$comment->isGranted())
811 return new BaseObject(-1,
'msg_not_permitted');
815 $childs = $oCommentModel->getChildComments($comment_srl);
816 if(count($childs) > 0)
818 $deleteAllComment = TRUE;
822 foreach($childs as $val)
826 $deleteAllComment = FALSE;
832 if(!$deleteAllComment)
834 return new BaseObject(-1,
'fail_to_delete_have_children');
838 foreach($childs as $val)
854 $args =
new stdClass();
855 $args->comment_srl = $comment_srl;
866 $comment_count = $oCommentModel->getCommentCount(
$document_srl);
869 if(isset($comment_count))
886 $comment->isMoveToTrash = $isMoveToTrash;
888 if(!$trigger_output->toBool())
891 return $trigger_output;
893 unset($comment->isMoveToTrash);
903 $args =
new stdClass();
904 $args->upload_target_srl = $comment_srl;
905 $args->isvalid =
'N';
937 $oCommentModel =
getModel(
'comment');
943 $oDocument->setAttribute(
$obj);
950 if(!$oDocument->isExists() || !$oDocument->isGranted())
952 return new BaseObject(-1,
'msg_not_permitted');
956 $args =
new stdClass();
961 $commentSrlList = array();
962 foreach($comments->data as $comment)
964 $commentSrlList[] = $comment->comment_srl;
994 if(is_array($commentSrlList) && count($commentSrlList) > 0)
996 $args =
new stdClass();
997 $args->comment_srl = join(
',', $commentSrlList);
1012 executeQuery(
'comment.deleteDeclaredComments', $commentSrls);
1013 executeQuery(
'comment.deleteCommentDeclaredLog', $commentSrls);
1023 executeQuery(
'comment.deleteCommentVotedLog', $commentSrls);
1036 $failed_voted =
'failed_voted';
1037 $success_message =
'success_voted';
1041 $failed_voted =
'failed_blamed';
1042 $success_message =
'success_blamed';
1046 if($_SESSION[
'voted_comment'][$comment_srl])
1051 $oCommentModel =
getModel(
'comment');
1052 $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
1055 if($oComment->get(
'ipaddress') == $_SERVER[
'REMOTE_ADDR'])
1057 $_SESSION[
'voted_comment'][$comment_srl] = TRUE;
1062 if($oComment->get(
'member_srl'))
1065 $oMemberModel =
getModel(
'member');
1066 $member_srl = $oMemberModel->getLoggedMemberSrl();
1069 if($member_srl && $member_srl == abs($oComment->get(
'member_srl')))
1071 $_SESSION[
'voted_comment'][$comment_srl] = TRUE;
1076 $args =
new stdClass();
1081 $args->member_srl = $member_srl;
1085 $args->ipaddress = $_SERVER[
'REMOTE_ADDR'];
1088 $args->comment_srl = $comment_srl;
1094 $_SESSION[
'voted_comment'][$comment_srl] = TRUE;
1099 $trigger_obj =
new stdClass;
1100 $trigger_obj->member_srl = $oComment->get(
'member_srl');
1101 $trigger_obj->module_srl = $oComment->get(
'module_srl');
1102 $trigger_obj->document_srl = $oComment->get(
'document_srl');
1103 $trigger_obj->comment_srl = $oComment->get(
'comment_srl');
1104 $trigger_obj->update_target = ($point < 0) ?
'blamed_count' :
'voted_count';
1105 $trigger_obj->point = $point;
1106 $trigger_obj->before_point = ($point < 0) ? $oComment->get(
'blamed_count') : $oComment->get(
'voted_count');
1107 $trigger_obj->after_point = $trigger_obj->before_point + $point;
1109 if(!$trigger_output->toBool())
1111 return $trigger_output;
1119 if($trigger_obj->update_target ===
'blamed_count')
1121 $args->blamed_count = $trigger_obj->after_point;
1126 $args->voted_count = $trigger_obj->after_point;
1131 $args->point = $trigger_obj->point;
1136 if(!$trigger_output->toBool())
1139 return $trigger_output;
1145 $_SESSION[
'voted_comment'][$comment_srl] = TRUE;
1149 if($trigger_obj->update_target ===
'voted_count')
1151 $output->add(
'voted_count', $trigger_obj->after_point);
1155 $output->add(
'blamed_count', $trigger_obj->after_point);
1169 if($_SESSION[
'declared_comment'][$comment_srl])
1171 return new BaseObject(-1,
'failed_declared');
1175 $args =
new stdClass();
1176 $args->comment_srl = $comment_srl;
1182 $declared_count = (
$output->data->declared_count) ?
$output->data->declared_count : 0;
1184 $trigger_obj =
new stdClass();
1185 $trigger_obj->comment_srl = $comment_srl;
1186 $trigger_obj->declared_count = $declared_count;
1190 if(!$trigger_output->toBool())
1192 return $trigger_output;
1196 $oCommentModel =
getModel(
'comment');
1197 $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
1200 if($oComment->get(
'ipaddress') == $_SERVER[
'REMOTE_ADDR'])
1202 $_SESSION[
'declared_comment'][$comment_srl] = TRUE;
1203 return new BaseObject(-1,
'failed_declared');
1207 if($oComment->get(
'member_srl'))
1210 $oMemberModel =
getModel(
'member');
1211 $member_srl = $oMemberModel->getLoggedMemberSrl();
1214 if($member_srl && $member_srl == abs($oComment->get(
'member_srl')))
1216 $_SESSION[
'declared_comment'][$comment_srl] = TRUE;
1217 return new BaseObject(-1,
'failed_declared');
1224 $args->member_srl = $member_srl;
1228 $args->ipaddress = $_SERVER[
'REMOTE_ADDR'];
1230 $args->comment_srl = $comment_srl;
1234 if($log_output->data->count)
1236 $_SESSION[
'declared_comment'][$comment_srl] = TRUE;
1237 return new BaseObject(-1,
'failed_declared');
1245 if(
$output->data->declared_count > 0)
1264 $trigger_obj->declared_count = $declared_count + 1;
1266 if(!$trigger_output->toBool())
1269 return $trigger_output;
1275 $_SESSION[
'declared_comment'][$comment_srl] = TRUE;
1290 $comment_popup_menu_list =
Context::get(
'comment_popup_menu_list');
1291 if(!is_array($comment_popup_menu_list))
1293 $comment_popup_menu_list = array();
1296 $obj =
new stdClass();
1300 $obj->target = $target;
1301 $comment_popup_menu_list[] =
$obj;
1303 Context::set(
'comment_popup_menu_list', $comment_popup_menu_list);
1322 $comment_config =
new stdClass();
1323 $comment_config->comment_count = (int)
Context::get(
'comment_count');
1324 if(!$comment_config->comment_count)
1326 $comment_config->comment_count = 50;
1329 $comment_config->use_vote_up =
Context::get(
'use_vote_up');
1330 if(!$comment_config->use_vote_up)
1332 $comment_config->use_vote_up =
'Y';
1335 $comment_config->use_vote_down =
Context::get(
'use_vote_down');
1336 if(!$comment_config->use_vote_down)
1338 $comment_config->use_vote_down =
'Y';
1341 $comment_config->use_comment_validation =
Context::get(
'use_comment_validation');
1342 if(!$comment_config->use_comment_validation)
1344 $comment_config->use_comment_validation =
'N';
1359 $this->
setMessage(
'success_updated',
'info');
1386 return new BaseObject(-1,
'msg_not_permitted');
1392 $commentSrlList = explode(
',', $commentSrls);
1395 if(count($commentSrlList) > 0)
1397 $oCommentModel =
getModel(
'comment');
1398 $commentList = $oCommentModel->getComments($commentSrlList);
1400 if(is_array($commentList))
1402 foreach($commentList as $value)
1404 $value->content = strip_tags($value->content);
1411 $commentList = array();
1415 $oSecurity =
new Security($commentList);
1416 $oSecurity->encodeHTML(
'..variables.',
'..');
1418 $this->
add(
'comment_list', $commentList);
1424 $commentConfig =
$oModuleModel->getModulePartConfig(
'comment',
$obj->originModuleSrl);
1427 if(is_array(
$obj->moduleSrlList))
1429 foreach(
$obj->moduleSrlList as $moduleSrl)
setMessage($message= 'success', $type=NULL)
getController($module_name)
set($key, $val, $set_to_get_vars=0)
$module_srl
integer value to represent a run-time instance of Module (XE Module)
$module_info
an object containing the module information
setRedirectUrl($url= './', $output=NULL)
getInstance($db_type=NULL)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
getAdminController($module_name)
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
triggerCall($trigger_name, $called_position, &$obj)
if(isset($_REQUEST['encode'])) if(isset($_REQUEST['decode'])) $lang