function setAttribute($attribute)
 {
     // 부모 함수 먼저 실행하고
     parent::setAttribute($attribute);
     // 소셜 정보를 추가한다.
     $oSocialxeModel =& getModel('socialxe');
     $this->add('link', $oSocialxeModel->getAuthorLink($this->get('provider'), $this->get('id'), $this->get('social_nick_name')));
     // 대댓글 개수
     if ($this->get('sub_comment_count') === null) {
         $this->add('sub_comment_count', 0);
     }
     // 리플 형식
     if ($this->get('member_srl')) {
         if ($this->get('provider') == 'xe') {
             $this->add('reply_prefix', $oSocialxeModel->getReplyPrefix('xe', null, $this->get('nick_name')));
         } else {
             $this->add('reply_prefix', $oSocialxeModel->getReplyPrefix($this->get('provider'), $this->get('id'), $this->getSocialNickName()));
         }
     } else {
         $this->add('reply_prefix', $oSocialxeModel->getReplyPrefix($this->get('provider'), $this->get('id'), $this->getSocialNickName()));
     }
     // 권한 설정
     // 우선 부모 함수 먼저
     $grant = $this->isGranted();
     // 권한이 없으면 소셜 권한이 있는지 확인
     $provider = $this->get('provider');
     $id = $this->get('id');
     if (!$grant && $id) {
         $oSocialxeModel =& getModel('socialxe');
         $logged_id = $oSocialxeModel->getProviderID($provider);
         if ($id == $logged_id) {
             $this->setGrant();
         }
     }
 }
 function setAttribute($attribute)
 {
     parent::setAttribute($attribute);
     $oMobileexModel =& getModel('mobileex');
     $document_srl = $this->get('document_srl');
     $comment_srl = $this->get('comment_srl');
     // 대댓글 개수
     $sub_comment_count = $oMobileexModel->getMobileexSubCommentCount($document_srl, $comment_srl);
     $this->add('sub_comment_count', $sub_comment_count);
     $grant = $this->isGranted();
 }
Beispiel #3
0
 function getComments()
 {
     if (!$this->getCommentCount()) {
         return;
     }
     if (!$this->isGranted() && $this->isSecret()) {
         return;
     }
     // cpage is a number of comment pages
     $cpageStr = sprintf('%d_cpage', $this->document_srl);
     $cpage = Context::get($cpageStr);
     if (!$cpage) {
         $cpage = Context::get('cpage');
     }
     // Get a list of comments
     $oCommentModel = getModel('comment');
     $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
     if (!$output->toBool() || !count($output->data)) {
         return;
     }
     // Create commentItem object from a comment list
     // If admin priviledge is granted on parent posts, you can read its child posts.
     $accessible = array();
     $comment_list = array();
     foreach ($output->data as $key => $val) {
         $oCommentItem = new commentItem();
         $oCommentItem->setAttribute($val);
         // If permission is granted to the post, you can access it temporarily
         if ($oCommentItem->isGranted()) {
             $accessible[$val->comment_srl] = true;
         }
         // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
         if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) {
             $oCommentItem->setAccessible();
         }
         $comment_list[$val->comment_srl] = $oCommentItem;
     }
     // Variable setting to be displayed on the skin
     Context::set($cpageStr, $output->page_navigation->cur_page);
     Context::set('cpage', $output->page_navigation->cur_page);
     if ($output->total_page > 1) {
         $this->comment_page_navigation = $output->page_navigation;
     }
     return $comment_list;
 }
Beispiel #4
0
 /**
  * @brief wap procedure method
  **/
 function procWAP(&$oMobile)
 {
     // check grant
     if (!$this->grant->list || $this->module_info->consultation == 'Y') {
         return $oMobile->setContent(lang('msg_not_permitted'));
     }
     // generate document model object
     $oDocumentModel = getModel('document');
     // if the doument is existed
     $document_srl = Context::get('document_srl');
     if ($document_srl) {
         $oDocument = $oDocumentModel->getDocument($document_srl);
         if ($oDocument->isExists()) {
             // check the grant
             if (!$this->grant->view) {
                 return $oMobile->setContent(lang('msg_not_permitted'));
             }
             // setup the browser title
             Context::setBrowserTitle($oDocument->getTitleText());
             // if the act is display comment list
             if ($this->act == 'dispBoardContentCommentList') {
                 $oCommentModel = getModel('comment');
                 $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
                 $content = '';
                 if (count($output->data)) {
                     foreach ($output->data as $key => $val) {
                         $oComment = new commentItem();
                         $oComment->setAttribute($val);
                         if (!$oComment->isAccessible()) {
                             continue;
                         }
                         $content .= "<b>" . $oComment->getNickName() . "</b> (" . $oComment->getRegdate("Y-m-d") . ")<br>\r\n" . $oComment->getContent(false, false) . "<br>\r\n";
                     }
                 }
                 // setup mobile contents
                 $oMobile->setContent($content);
                 // setup upper URL
                 $oMobile->setUpperUrl(getUrl('act', ''), lang('cmd_go_upper'));
                 // display the document if the act is not display the comment list
             } else {
                 // setup contents (strip all html tags)
                 $content = strip_tags(str_replace('<p>', '<br>&nbsp;&nbsp;&nbsp;', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>');
                 // setup content information(include the comments link)
                 $content = lang('replies') . ' : <a href="' . getUrl('act', 'dispBoardContentCommentList') . '">' . $oDocument->getCommentCount() . '</a><br>' . "\r\n" . $content;
                 $content = '<b>' . $oDocument->getNickName() . '</b> (' . $oDocument->getRegdate("Y-m-d") . ")<br>\r\n" . $content;
                 // setup mobile contents
                 $oMobile->setContent($content);
                 // setup upper URL
                 $oMobile->setUpperUrl(getUrl('document_srl', ''), lang('cmd_list'));
             }
             return;
         }
     }
     // board index
     $args = new stdClass();
     $args->module_srl = $this->module_srl;
     $args->page = Context::get('page');
     $args->list_count = 9;
     $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order';
     $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc';
     $output = $oDocumentModel->getDocumentList($args, $this->except_notice);
     $document_list = $output->data;
     $page_navigation = $output->page_navigation;
     $childs = array();
     if ($document_list && count($document_list)) {
         foreach ($document_list as $key => $val) {
             $href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl);
             $obj = null;
             $obj['href'] = $val->getPermanentUrl();
             $title = htmlspecialchars($val->getTitleText());
             if ($val->getCommentCount()) {
                 $title .= ' [' . $val->getCommentCount() . ']';
             }
             $obj['link'] = $obj['text'] = '[' . $val->getNickName() . '] ' . $title;
             $childs[] = $obj;
         }
         $oMobile->setChilds($childs);
     }
     $totalPage = $page_navigation->last_page;
     $page = (int) Context::get('page');
     if (!$page) {
         $page = 1;
     }
     // next/prevUrl specification
     if ($page > 1) {
         $oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', lang('cmd_prev'), $page - 1, $totalPage));
     }
     if ($page < $totalPage) {
         $oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', lang('cmd_next'), $page + 1, $totalPage));
     }
     $oMobile->mobilePage = $page;
     $oMobile->totalPage = $totalPage;
 }
Beispiel #5
0
 /**
  * @brief wap procedure method
  **/
 function procWAP(&$oMobile)
 {
     // 권한 체크
     if (!$this->grant->list || $this->module_info->consultation == 'Y') {
         return $oMobile->setContent(Context::getLang('msg_not_permitted'));
     }
     // document model 객체 생성
     $oDocumentModel =& getModel('document');
     // 선택된 게시글이 있을 경우
     $document_srl = Context::get('document_srl');
     if ($document_srl) {
         $oDocument = $oDocumentModel->getDocument($document_srl);
         if ($oDocument->isExists()) {
             // 권한 확인
             if (!$this->grant->view) {
                 return $oMobile->setContent(Context::getLang('msg_not_permitted'));
             }
             // 글 제목 설정
             Context::setBrowserTitle($oDocument->getTitleText());
             // 댓글 보기 일 경우
             if ($this->act == 'dispBoardContentCommentList') {
                 $oCommentModel =& getModel('comment');
                 $output = $oCommentModel->getCommentList($oDocument->document_srl, 0, false, $oDocument->getCommentCount());
                 $content = '';
                 if (count($output->data)) {
                     foreach ($output->data as $key => $val) {
                         $oComment = new commentItem();
                         $oComment->setAttribute($val);
                         if (!$oComment->isAccessible()) {
                             continue;
                         }
                         $content .= "<b>" . $oComment->getNickName() . "</b> (" . $oComment->getRegdate("Y-m-d") . ")<br>\r\n" . $oComment->getContent(false, false) . "<br>\r\n";
                     }
                 }
                 // 내용 설정
                 $oMobile->setContent($content);
                 // 상위 페이지를 목록으로 돌아가기로 지정
                 $oMobile->setUpperUrl(getUrl('act', ''), Context::getLang('cmd_go_upper'));
                 // 댓글 보기가 아니면 글 보여줌
             } else {
                 // 내용 지정 (태그를 모두 제거한 내용을 설정)
                 $content = strip_tags(str_replace('<p>', '<br>&nbsp;&nbsp;&nbsp;', $oDocument->getContent(false, false, false)), '<br><b><i><u><em><small><strong><big>');
                 // 내용 상단에 정보 출력 (댓글 보기 링크 포함)
                 $content = Context::getLang('replies') . ' : <a href="' . getUrl('act', 'dispBoardContentCommentList') . '">' . $oDocument->getCommentCount() . '</a><br>' . "\r\n" . $content;
                 $content = '<b>' . $oDocument->getNickName() . '</b> (' . $oDocument->getRegdate("Y-m-d") . ")<br>\r\n" . $content;
                 // 내용 설정
                 $oMobile->setContent($content);
                 // 상위 페이지를 목록으로 돌아가기로 지정
                 $oMobile->setUpperUrl(getUrl('document_srl', ''), Context::getLang('cmd_list'));
             }
             return;
         }
     }
     // 게시글 목록
     $args->module_srl = $this->module_srl;
     $args->page = Context::get('page');
     $args->list_count = 9;
     $args->sort_index = $this->module_info->order_target ? $this->module_info->order_target : 'list_order';
     $args->order_type = $this->module_info->order_type ? $this->module_info->order_type : 'asc';
     $output = $oDocumentModel->getDocumentList($args, $this->except_notice);
     $document_list = $output->data;
     $page_navigation = $output->page_navigation;
     $childs = array();
     if ($document_list && count($document_list)) {
         foreach ($document_list as $key => $val) {
             $href = getUrl('mid', $_GET['mid'], 'document_srl', $val->document_srl);
             $obj = null;
             $obj['href'] = $val->getPermanentUrl();
             $title = htmlspecialchars($val->getTitleText());
             if ($val->getCommentCount()) {
                 $title .= ' [' . $val->getCommentCount() . ']';
             }
             $obj['link'] = $obj['text'] = '[' . $val->getNickName() . '] ' . $title;
             $childs[] = $obj;
         }
         $oMobile->setChilds($childs);
     }
     $totalPage = $page_navigation->last_page;
     $page = (int) Context::get('page');
     if (!$page) {
         $page = 1;
     }
     // next/prevUrl 지정
     if ($page > 1) {
         $oMobile->setPrevUrl(getUrl('mid', $_GET['mid'], 'page', $page - 1), sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $page - 1, $totalPage));
     }
     if ($page < $totalPage) {
         $oMobile->setNextUrl(getUrl('mid', $_GET['mid'], 'page', $page + 1), sprintf('%s (%d/%d)', Context::getLang('cmd_next'), $page + 1, $totalPage));
     }
     $oMobile->mobilePage = $page;
     $oMobile->totalPage = $totalPage;
 }
Beispiel #6
0
 /**
  * @brief get the comment in corresponding with mid.
  **/
 function getNewestCommentList($obj, $columnList = array())
 {
     if ($obj->mid) {
         $oModuleModel = getModel('module');
         $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
         unset($obj->mid);
     }
     // check if module_srl is an arrary.
     $args = new stdClass();
     if (is_array($obj->module_srl)) {
         $args->module_srl = implode(',', $obj->module_srl);
     } else {
         $args->module_srl = $obj->module_srl;
     }
     $args->list_count = $obj->list_count;
     // cache controll
     $oCacheHandler =& CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         $object_key = 'object_newest_comment_list:' . $obj->module_srl;
         $cache_key = $oCacheHandler->getGroupKey('commentList', $object_key);
         $output = $oCacheHandler->get($cache_key);
     }
     if (!$output) {
         $output = executeQuery('comment.getNewestCommentList', $args, $columnList);
         if ($oCacheHandler->isSupport()) {
             $oCacheHandler->put($cache_key, $output);
         }
     }
     if (!$output->toBool()) {
         return $output;
     }
     $comment_list = $output->data;
     if ($comment_list) {
         if (!is_array($comment_list)) {
             $comment_list = array($comment_list);
         }
         $comment_count = count($comment_list);
         foreach ($comment_list as $key => $attribute) {
             if (!$attribute->comment_srl) {
                 continue;
             }
             $oComment = null;
             $oComment = new commentItem();
             $oComment->setAttribute($attribute);
             $result[$key] = $oComment;
         }
         $output->data = $result;
     }
     return $result;
 }
 /**
  * Empty comment in trash, called by trash module
  * this method is passived
  * @return object
  */
 function emptyTrash($originObject)
 {
     $originObject = unserialize($originObject);
     if (is_array($originObject)) {
         $originObject = (object) $originObject;
     }
     $oComment = new commentItem();
     $oComment->setAttribute($originObject);
     //already comment deleted, therefore only comment log delete
     $oCommentController = getController('comment');
     $output = $oCommentController->deleteCommentLog($oComment->get('comment_srl'));
     return $output;
 }
 function getCommentList($document_srl)
 {
     $oCommentModel =& getModel('comment');
     $oCommentList = array();
     $args->document_srl = $document_srl;
     $output = executeQueryArray('textyle.getExportCommentList', $args);
     if ($output->data) {
         foreach ($output->data as $attribute) {
             $oComment = new commentItem();
             $oComment->setAttribute($attribute);
             $oCommentList[$attribute->comment_srl] = $oComment;
         }
     }
     return $this->_arrayCommentList($oCommentList);
 }
Beispiel #9
0
 function getComments()
 {
     if (!$this->allowComment() || !$this->getCommentCount()) {
         return;
     }
     if (!$this->isGranted() && $this->isSecret()) {
         return;
     }
     // cpage는 댓글페이지의 번호
     $cpage = Context::get('cpage');
     // 댓글 목록을 구해옴
     $oCommentModel =& getModel('comment');
     $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
     if (!$output->toBool() || !count($output->data)) {
         return;
     }
     // 구해온 목록을 commentItem 객체로 만듬
     // 계층구조에 따라 부모글에 관리권한이 있으면 자식글에는 보기 권한을 줌
     $accessible = array();
     foreach ($output->data as $key => $val) {
         $oCommentItem = new commentItem();
         $oCommentItem->setAttribute($val);
         // 권한이 있는 글에 대해 임시로 권한이 있음을 설정
         if ($oCommentItem->isGranted()) {
             $accessible[$val->comment_srl] = true;
         }
         // 현재 댓글이 비밀글이고 부모글이 있는 답글이고 부모글에 대해 관리 권한이 있으면 보기 가능하도록 수정
         if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) {
             $oCommentItem->setAccessible();
         }
         $comment_list[$val->comment_srl] = $oCommentItem;
     }
     // 스킨에서 출력하기 위한 변수 설정
     Context::set('cpage', $output->page_navigation->cur_page);
     if ($output->total_page > 1) {
         $this->comment_page_navigation = $output->page_navigation;
     }
     return $comment_list;
 }
Beispiel #10
0
 /**
  * Get the comment in corresponding with mid.
  * @todo add commentItems to cache too
  * @param object $obj
  * @param array $columnList
  * @return array
  */
 function getNewestCommentList($obj, $columnList = array())
 {
     if ($obj->mid) {
         $oModuleModel =& getModel('module');
         $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
         unset($obj->mid);
     }
     // check if module_srl is an arrary.
     if (is_array($obj->module_srl)) {
         $args->module_srl = implode(',', $obj->module_srl);
     } else {
         $args->module_srl = $obj->module_srl;
     }
     $args->list_count = $obj->list_count;
     // cache controll
     $oCacheHandler =& CacheHandler::getInstance('object');
     if ($oCacheHandler->isSupport()) {
         $object_key = 'object_newest_comment_list:' . $obj->module_srl;
         $cache_key = $oCacheHandler->getGroupKey('newestCommentsList', $object_key);
         $output = $oCacheHandler->get($cache_key);
     }
     if (!$output) {
         if (strpos($args->module_srl, ",") === false) {
             // check if module is using comment validation system
             $oCommentController =& getController("comment");
             $is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
             if ($is_using_validation) {
                 $args->status = 1;
             }
         }
         $output = executeQuery('comment.getNewestCommentList', $args, $columnList);
         if ($oCacheHandler->isSupport()) {
             $oCacheHandler->put($cache_key, $output);
         }
     }
     if (!$output->toBool()) {
         return $output;
     }
     $comment_list = $output->data;
     if ($comment_list) {
         if (!is_array($comment_list)) {
             $comment_list = array($comment_list);
         }
         $comment_count = count($comment_list);
         foreach ($comment_list as $key => $attribute) {
             if (!$attribute->comment_srl) {
                 continue;
             }
             $oComment = null;
             $oComment = new commentItem();
             $oComment->setAttribute($attribute);
             $result[$key] = $oComment;
         }
         $output->data = $result;
     }
     return $result;
 }
Beispiel #11
0
 function getComments()
 {
     if (!$this->getCommentCount()) {
         return;
     }
     if (!$this->isGranted() && $this->isSecret()) {
         return;
     }
     // cpage is a number of comment pages
     $cpageStr = sprintf('%d_cpage', $this->document_srl);
     $cpage = Context::get($cpageStr);
     if (!$cpage) {
         $cpage = Context::get('cpage');
     }
     // Get a list of comments
     $oCommentModel = getModel('comment');
     $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
     if (!$output->toBool() || !count($output->data)) {
         return;
     }
     // Create commentItem object from a comment list
     // If admin priviledge is granted on parent posts, you can read its child posts.
     $accessible = array();
     $comment_list = array();
     $setAccessibleComments = Context::getSessionStatus();
     foreach ($output->data as $key => $val) {
         $oCommentItem = new commentItem();
         $oCommentItem->setAttribute($val);
         // If permission is granted to the post, you can access it temporarily
         if ($oCommentItem->isGranted()) {
             $accessible[$val->comment_srl] = true;
         }
         // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
         if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true) {
             if ($setAccessibleComments) {
                 $oCommentItem->setAccessible();
             }
         }
         $comment_list[$val->comment_srl] = $oCommentItem;
     }
     // Cache the vote log for all comments.
     $logged_info = Context::get('logged_info');
     if ($logged_info->member_srl) {
         $comment_srls = array();
         foreach ($comment_list as $comment_srl => $comment) {
             if (!isset($_SESSION['voted_comment'][$comment_srl])) {
                 $comment_srls[] = $comment_srl;
             }
         }
         if (count($comment_srls)) {
             $output = executeQuery('comment.getCommentVotedLogMulti', (object) array('comment_srls' => $comment_srls, 'member_srl' => $logged_info->member_srl));
             foreach ($output->data as $data) {
                 $_SESSION['voted_comment'][$data->comment_srl] = $data->point;
             }
             foreach ($comment_srls as $comment_srl) {
                 if (!isset($_SESSION['voted_comment'][$comment_srl])) {
                     $_SESSION['voted_comment'][$comment_srl] = false;
                 }
             }
         }
     }
     // Variable setting to be displayed on the skin
     Context::set($cpageStr, $output->page_navigation->cur_page);
     Context::set('cpage', $output->page_navigation->cur_page);
     if ($output->total_page > 1) {
         $this->comment_page_navigation = $output->page_navigation;
     }
     return $comment_list;
 }
Beispiel #12
0
 /** 
  * @brief mid 에 해당하는 댓글을 가져옴
  **/
 function getNewestCommentList($obj)
 {
     if ($obj->mid) {
         $oModuleModel =& getModel('module');
         $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
         unset($obj->mid);
     }
     // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
     if (is_array($obj->module_srl)) {
         $args->module_srl = implode(',', $obj->module_srl);
     } else {
         $args->module_srl = $obj->module_srl;
     }
     $args->list_count = $obj->list_count;
     $output = executeQuery('comment.getNewestCommentList', $args);
     if (!$output->toBool()) {
         return $output;
     }
     $comment_list = $output->data;
     if ($comment_list) {
         if (!is_array($comment_list)) {
             $comment_list = array($comment_list);
         }
         $comment_count = count($comment_list);
         foreach ($comment_list as $key => $attribute) {
             if (!$attribute->comment_srl) {
                 continue;
             }
             $oComment = null;
             $oComment = new commentItem();
             $oComment->setAttribute($attribute);
             $result[$key] = $oComment;
         }
         $output->data = $result;
     }
     return $result;
 }
Beispiel #13
0
 /**
  * Get the comment in corresponding with mid.
  * @todo add commentItems to cache too
  * @param object $obj
  * @param array $columnList
  * @return array
  */
 function getNewestCommentList($obj, $columnList = array())
 {
     $args = new stdClass();
     if (!is_object($obj)) {
         $obj = new stdClass();
     }
     if ($obj->mid) {
         $oModuleModel = getModel('module');
         $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
         unset($obj->mid);
     }
     // check if module_srl is an arrary.
     if (is_array($obj->module_srl)) {
         $args->module_srl = implode(',', $obj->module_srl);
     } else {
         $args->module_srl = $obj->module_srl;
     }
     $args->document_srl = $obj->document_srl;
     $args->list_count = $obj->list_count;
     if (strpos($args->module_srl, ",") === false) {
         if ($args->module_srl) {
             // check if module is using comment validation system
             $oCommentController = getController("comment");
             $is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
             if ($is_using_validation) {
                 $args->status = 1;
             }
         }
     }
     $output = executeQuery('comment.getNewestCommentList', $args, $columnList);
     if (!$output->toBool()) {
         return $output;
     }
     $comment_list = $output->data;
     if ($comment_list) {
         if (!is_array($comment_list)) {
             $comment_list = array($comment_list);
         }
         $comment_count = count($comment_list);
         foreach ($comment_list as $key => $attribute) {
             if (!$attribute->comment_srl) {
                 continue;
             }
             $oComment = NULL;
             $oComment = new commentItem();
             $oComment->setAttribute($attribute);
             $result[$key] = $oComment;
         }
         $output->data = $result;
     }
     return $result;
 }