8 require_once(CH_DIRECTORY_PATH_INC .
'header.inc.php');
9 require_once(CH_DIRECTORY_PATH_INC .
'admin.inc.php');
10 require_once(CH_DIRECTORY_PATH_INC .
'design.inc.php');
11 require_once(CH_DIRECTORY_PATH_INC .
'profiles.inc.php');
19 require_once(
'ChBlogsPrivacy.php');
21 if (!defined(
'CH_BLOGS_IMAGES_PATH')) {
22 define(
'CH_BLOGS_IMAGES_PATH', CH_DIRECTORY_PATH_ROOT .
"media/images/blog/");
25 if (!defined(
'CH_BLOGS_IMAGES_URL')) {
26 define(
'CH_BLOGS_IMAGES_URL', CH_WSB_URL_ROOT .
"media/images/blog/");
36 parent::__construct(
'ch_blogs');
41 return $this->oBlogs->getActionsBlock();
46 return $this->oBlogs->getRateBlock();
51 return array($this->oBlogs->getPostOverviewBlock());
56 return $this->oBlogs->getPostCategoriesBlock();
61 return $this->oBlogs->getPostFeatureBlock();
66 return $this->oBlogs->getPostTagsBlock();
71 return $this->oBlogs->getCommentsBlock();
76 return $this->oBlogs->getBlogPostBlock();
81 return $this->oBlogs->getPostSocialSharingBlock();
223 $this->iIconSize = (int)
getParam(
'ch_blogs_iconsize');
224 $this->iThumbSize = (int)
getParam(
'ch_blogs_thumbsize');
225 $this->iBigThumbSize = (int)
getParam(
'ch_blogs_bigthumbsize');
226 $this->iImgSize = (int)
getParam(
'ch_blogs_imagesize');
228 $this->sHomeUrl = $this->_oConfig->getHomeUrl();
229 $this->sHomePath = $this->_oConfig->getHomePath();
234 $this->bAdminMode = $this->
isAdmin() ==
true;
236 $this->iPostViewType = 1;
237 $this->iViewingPostID = -1;
238 $this->iLastPostedPostID = -1;
239 $this->aViewingPostInfo = array();
243 $this->_sPageHeader =
'';
262 switch (
ch_get(
'action')) {
278 case 'popular_posts':
281 case 'featured_posts':
287 case 'show_calendar':
290 case 'show_calendar_day' :
292 $aDate = explode(
'/', $sDate);
294 $iValue1 = (int)
$aDate[0];
295 $iValue2 = (int)
$aDate[1];
296 $iValue3 = (int)
$aDate[2];
299 .
getLocaleDate(strtotime(
"{$iValue1}-{$iValue2}-{$iValue3}")
308 case 'show_member_blog':
312 $GLOBALS[
'oTopMenu']->setCustomSubHeader(
_t(
'_sys_request_page_not_found_cpt'));
313 $GLOBALS[
'oSysTemplate']->displayPageNotFound();
316 $sAsBlog =
_t(
'_ch_blog_Members_blog',
$sUser);
323 if (
false !==
ch_get(
'EditPostID')) {
324 $iPostID = (int)
ch_get(
'EditPostID');
325 $sCaption = htmlspecialchars($this->_oDb->getPostCaptionByID($iPostID));
328 case 'show_member_post':
330 if (
false !==
ch_get(
'postUri')) {
332 $sPostCapt = $this->_oDb->getPostCaptionByUri($sPostUri);
333 } elseif (
false !==
ch_get(
'post_id')) {
334 $iPostID = (int)
ch_get(
'post_id');
335 $sPostCapt = $this->_oDb->getPostCaptionByID($iPostID);
337 if ($sPostCapt !=
'') {
338 $sCaption = htmlspecialchars($sPostCapt);
341 case 'search_by_tag':
376 $this->_oTemplate->addJs(
'main.js');
382 if (($aBlogPost[
'OwnerID'] == $this->_iVisitorID &&
isMember()) || $this->
isAdmin()) {
386 return $this->oPrivacy->check(
'comment', $aBlogPost[
'PostID'], $this->_iVisitorID);
394 if (!
isMember() || $aBlogPost[
'OwnerID'] != $this->_iVisitorID) {
398 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POSTS_COMMENTS_DELETE_AND_EDIT, $isPerformAction);
405 if ($this->
isAdmin() || $iOwnerID == $this->_iVisitorID) {
409 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_VIEW, $isPerformAction);
416 if ($this->
isAdmin() || $iOwnerID == $this->_iVisitorID) {
420 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POST_VIEW, $isPerformAction);
431 $aCheck =
checkAction($this->_iVisitorID, CH_BLOGS_BROWSE, $isPerformAction);
442 $aCheck =
checkAction($this->_iVisitorID, CH_BLOGS_POSTS_BROWSE, $isPerformAction);
453 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POST_SEARCH, $isPerformAction);
467 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POST_ADD, $isPerformAction);
474 if ($this->
isAdmin() || (
isMember() && $iOwnerID == $this->_iVisitorID)) {
478 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POSTS_EDIT_ANY_POST, $isPerformAction);
485 if ($this->
isAdmin() || (
isMember() && $iOwnerID == $this->_iVisitorID)) {
489 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POSTS_DELETE_ANY_POST, $isPerformAction);
503 $aCheck =
checkAction($this->_iVisitorID, CH_BLOG_POSTS_APPROVING, $isPerformAction);
528 'blogs posts browse',
531 'blog posts edit any post',
532 'blog posts delete any post',
533 'blog posts approving',
534 'blog posts comments delete and edit'
540 if ($this->bAdminMode) {
542 if (
ch_get(
'action_approve') && is_array(
ch_get(
'bposts'))) {
543 foreach (
ch_get(
'bposts')
as $iBPostID) {
544 if ($this->_oDb->setPostStatus((
int)$iBPostID,
'approval')) {
548 } elseif (
ch_get(
'action_disapprove') && is_array(
ch_get(
'bposts'))) {
549 foreach (
ch_get(
'bposts')
as $iBPostID) {
550 if ($this->_oDb->setPostStatus((
int)$iBPostID)) {
554 } elseif (
ch_get(
'action_delete') && is_array(
ch_get(
'bposts'))) {
555 foreach (
ch_get(
'bposts')
as $iBPostID) {
560 $sPostLink = $this->sHomeUrl . $this->_oConfig->sAdminExFile;
562 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
564 $oBlogSearch->PerformObligatoryInit($this, 4);
565 $oBlogSearch->aCurrent[
'restriction'][
'activeStatus'] = array(
566 'value' =>
'disapproval',
567 'field' =>
'PostStatus',
570 $oBlogSearch->bShowCheckboxes =
true;
571 $oBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage();
572 $sPosts = $oBlogSearch->displayResultBlock();
573 $sPosts = ($oBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_ch_blog_No_blogs_available')) : $sPosts;
575 $sAdmPanel = $oBlogSearch->showAdminActionsPanel(
'bposts_box', array(
576 'action_approve' =>
'_Approve',
577 'action_disapprove' =>
'_Disapprove',
578 'action_delete' =>
'_Delete'
581 $oBlogSearch->aCurrent[
'paginate'][
'page_url'] = $sPostLink;
582 $sPostPagination = $oBlogSearch->showPagination3();
585 'admin_page' => $sPostLink,
587 'paginate' => $sPostPagination,
588 'admin_panel' => $sAdmPanel,
591 return $this->_oTemplate->parseHtmlByTemplateName(
'admin_page', $aVariables);
600 return $oHomePageView->getCode();
612 return $this->_oTemplate->displayAccessDenied();
616 $sPostsC =
_t(
'_ch_blog_Posts');
617 $sNoBlogsC =
_t(
'_Empty');
618 $sAllBlogsC =
_t(
'_ch_blog_All_Blogs');
619 $sTopBlogsC =
_t(
'_ch_blog_Top_Blogs');
636 $sqlLimit =
"LIMIT {$sLimitFrom}, {$iPerPage}";
640 $sStatusFilter = ($this->
isAdmin() ==
true
644 :
"`PostStatus`='approval'";
648 $vBlogsRes = $this->_oDb->getTopBlogs($sStatusFilter, $sqlLimit);
653 $vBlogsRes = $this->_oDb->getLastBlogs($sStatusFilter, $sqlLimit);
657 $iTotalBlogs = $this->_oDb->getAllBlogsCnt($sStatusFilter);
668 while ($aBlogsRes = $vBlogsRes->fetch()) {
669 if ($aBlogsRes[
'PostCount'] == 0 &&
$sType ==
'top')
675 $sOwnerNickname =
getNickName($aBlogsRes[
'OwnerID']);
676 if ($aBlogsRes[
'OwnerID'] == 0) {
677 $sOwnerNickname =
_t(
'_Admin');
679 if ($sOwnerNickname) {
681 $sBlogOwnerLink = $this->
genBlogLink(
'show_member_blog',
682 array(
'Permalink' => $aOwnerInfo[
'NickName'],
'Link' => $aBlogsRes[
'OwnerID']));
683 $sDescription = htmlspecialchars(strip_tags($aBlogsRes[
'Description']));
685 $aBlogUnitVariables = array(
686 'owner_thumbnail' =>
$sCont,
687 'owner_nickname' => $sOwnerNickname .
' ' .
_t(
'_ch_blog_Blog'),
688 'posts_count' => $aBlogsRes[
'PostCount'] .
' ' . $sPostsC,
689 'blog_link' => $sBlogOwnerLink,
690 'blog_description' => $sDescription
692 $sRetHtml .= $this->_oTemplate->parseHtmlByTemplateName(
'blog_unit', $aBlogUnitVariables);
700 $sRequest =
ch_html_attribute($_SERVER[
'PHP_SELF']) .
'?action=top_blogs&page={page}&per_page={per_page}';
702 $sRequest = (
ch_get(
'action') ==
'top_blogs')
703 ? CH_WSB_URL_ROOT .
'blogs/top/'
704 : CH_WSB_URL_ROOT .
'blogs/all/';
706 $sRequest .=
'{per_page}/{page}' . $sPaginAddon;
713 'page_url' => $sRequest,
714 'count' => $iTotalBlogs,
720 $sPagination = $oPaginate->getPaginate();
722 $sRetHtmlVal = <<<EOF
723 <div
class=
"ch-def-bc-padding">
741 if ($this->_iVisitorID)
748 $oMobileTemplate->pageStart();
749 echo $oMobileTemplate->addCss(
'blogs_common.css', 1);
757 $this->iPostViewType = 4;
760 $sMobileWrapper =
'mobile_row.html';
765 if (!$this->oPrivacy->check(
'view', (
int)
ch_get(
'id'),
768 $oMobileTemplate->displayAccessDenied(
$sCaption);
772 $this->iPostViewType = 3;
773 $aParams = array(
'id' => (
int)
ch_get(
'id'));
775 $sMobileWrapper =
'mobile_box.html';
776 echo $oMobileTemplate->addCss(
'blogs.css', 1);
779 $aParams = array(
'id' => (
int)
ch_get(
'id'));
800 $oMobileTemplate->displayAccessDenied(
$sCaption);
805 $oTmpBlogSearch =
false;
808 if (!
$sCode || $oBlogSearchResults->aCurrent[
'paginate'][
'totalNum'] == 0) {
809 $oMobileTemplate->displayNoData(
$sCaption);
820 'count' => $oBlogSearchResults->aCurrent[
'paginate'][
'totalNum'],
824 echo $oPaginate->getMobilePaginate();
827 $oMobileTemplate->pageCode(
$sCaption,
false);
842 $sDisplayMode =
'last';
845 $sDisplayMode =
'popular';
848 $sTypeMode =
'featured';
849 $sDisplayMode =
'last';
853 $sDisplayMode =
'top';
857 $this->iPostViewType = 4;
859 $sCaption = ($this->_sPageHeader !=
'') ? $this->_sPageHeader :
_t(
'_ch_blog_Top_Posts');
865 $oTmpBlogSearch =
false;
866 $sCode = $this->
_GenPosts($this->iPostViewType, $this->_oConfig->getPerPage(), $sTypeMode,
false, $sDisplayMode,
868 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
872 $oTmpBlogSearch->aCurrent[
'paginate'][
'page_url'] = $oTmpBlogSearch->getCurrentUrl(
$sType .
'_posts', 0,
'');
873 $sPagination = $oTmpBlogSearch->showPagination3();
875 $sRetHtmlVal = <<<EOF
876 <div
class=
"ch-def-bc-padding">
897 ch_import(
'SearchUnit', $this->_aModule);
900 $oTmpBlogSearch->PerformObligatoryInit($this,
$iPostViewType, $sMobileWrapper);
901 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] =
$iPerPage;
902 $oTmpBlogSearch->aCurrent[
'sorting'] = $sOrder;
906 $oTmpBlogSearch->aCurrent[
'restriction'][
'owner'][
'value'] = (int)$aParams[
'id'];
909 $oTmpBlogSearch->aCurrent[
'restriction'][
'id'][
'value'] = $aParams[
'id'];
910 if (($this->aViewingPostInfo[
'OwnerID'] == $this->_iVisitorID && $this->aViewingPostInfo[
'OwnerID'] > 0) ||
$this->bAdminMode) {
911 $oTmpBlogSearch->aCurrent[
'restriction'][
'activeStatus'] =
'';
913 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = 1;
916 $oTmpBlogSearch->aCurrent[
'restriction'][
'featuredStatus'][
'value'] = 1;
919 $oTmpBlogSearch->aCurrent[
'restriction'][
'category_uri'][
'value'] = $aParams[
'cat_uri'];
923 $oTmpBlogSearch->aCurrent[
'restriction'][
'allow_view'][
'value'] = $this->_iVisitorID ? array(
929 $oSearchResult = $oTmpBlogSearch;
931 return $oTmpBlogSearch->displayResultBlock();
938 $this->iPostViewType = 4;
941 $oTmpBlogSearch =
false;
942 $sCode = $this->
_GenPosts($this->iPostViewType, $this->_oConfig->getPerPage(),
'category',
943 array(
'cat_uri' => $sCatUri),
'last', $oTmpBlogSearch);
944 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
948 $sRetHtmlVal =
'<div class="ch-def-bc-padding">' .
$sCode .
'</div>';
963 $sSureC =
_t(
'_Are_you_sure');
964 $sApplyChangesC =
_t(
'_Submit');
966 $iMemberID = (int)$aBlogsRes[
'OwnerID'];
969 $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID);
970 $this->aViewingPostInfo = $aBlogInfo;
972 if ($this->iViewingPostID == -1) {
974 $aBlogID = (int)$aBlogInfo[
'ID'];
978 $aBlogActionKeys = array(
979 'visitor_id' => $this->_iVisitorID,
980 'owner_id' => $iMemberID,
981 'owner_name' => $sOwnerNickname,
982 'blog_owner_link' =>
'',
983 'admin_mode' =>
"'" . $this->bAdminMode .
"'",
984 'sure_label' => $sSureC,
985 'work_url' => $sProcessingFile,
986 'site_url' => CH_WSB_URL_ROOT,
987 'blog_id' => $aBlogID,
988 'blog_description_js' => $sDescrAct,
991 $sBlogActionsVal =
$GLOBALS[
'oFunctions']->genObjectsActions($aBlogActionKeys,
'ch_blogs_m',
false);
993 if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->bAdminMode ==
true) {
994 $aBlogDesc = $aBlogInfo[
'Description'];
998 $sBlogActionsVal .= <<<EOF
999 <div
id=
"edited_blog_div" style=
"display: none; position:relative;">
1000 <div
class=
"ch-def-bc-padding" style=
"padding-top:0;">
1002 <input
type=
"hidden" name=
"action" id=
"action" value=
"edit_blog" />
1003 <input
type=
"hidden" name=
"EditBlogID" id=
"EditBlogID" value=
"" />
1004 <input
type=
"hidden" name=
"EOwnerID" id=
"EOwnerID" value=
"" />
1005 <textarea
name=
"Description" rows=
"3" cols=
"3" style=
"width:99%;height:50px;" onkeyup=
"if( this.value.length > 255 ) this.value = this.value.substr( 0, 255 );" value=
"{$sBlogDescription}">{$sBlogDescription}</textarea>
1006 <div
class=
"ch-def-margin-sec-top">
1007 <input
type=
"submit" value=
"{$sApplyChangesC}" class=
"form_input_submit ch-btn ch-btn-small" />
1009 <div
class=
"clear_both"></div>
1016 $sBlogActionsSect = ($sBlogActionsVal !=
'') ?
DesignBoxContent(
_t(
'_Actions'), $sBlogActionsVal, 1) :
'';
1023 $sFeaturedSect = ($sFeaturedSectCont) ?
DesignBoxContent(
_t(
'_ch_blog_Featured_Posts'),
1026 return $sBlogActionsSect . $sActionsSect . $sDescriptionSect . $sCategoriesSect . $sFeaturedSect . $sTagsSect;
1044 $iMemberID = $iUserID;
1047 $GLOBALS[
'oTopMenu']->setCurrentProfileID($iMemberID);
1051 $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
1054 if (($iMemberID == $iCheckedMemberID && $iCheckedMemberID > 0) || $this->
isAdmin()) {
1061 $iOwnerID = $aBlogsRes[
'OwnerID'];
1063 if(
isBlocked($iOwnerID, $this->_iVisitorID)) {
1064 return MsgBox(
_t(
'_sys_txt_error_you_are_blocked'));
1067 if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->
isAllowedBlogView($iOwnerID,
true)) {
1068 return $this->_oTemplate->displayAccessDenied();
1071 if ($aBlogsRes[
'OwnerID'] > 0) {
1076 $aUserInfo = array(
'NickName' =>
_t(
'_Admin'));
1078 $sOwnerBlogLink = $this->
genBlogLink(
'show_member_blog_home',
1079 array(
'Permalink' => $aUserInfo[
'NickName'],
'Link' => $aBlogsRes[
'OwnerID']));
1080 $sAsBlog =
_t(
'_ch_blog_Members_blog',
$sUser);
1083 $sCurCategory = $sCategoryName;
1085 $sBreadCrumb = ($sCurCategory !=
'') ? $sCurCategory :
_t(
'_ch_blog_Latest_posts');
1088 $sBlogPostsHtmlVal = $this->_oTemplate->displayAccessDenied();
1090 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
1092 $oTmpBlogSearch->PerformObligatoryInit($this, 4);
1093 $oTmpBlogSearch->aCurrent[
'sorting'] =
'last';
1094 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage();
1095 $oTmpBlogSearch->aCurrent[
'restriction'][
'owner'][
'value'] = $iMemberID;
1097 if ($sCategoryName !=
'') {
1099 $oTmpBlogSearch->aCurrent[
'join'][
'category'] = array(
1101 'table' =>
'sys_categories',
1102 'mainField' =>
'PostID',
1104 'joinFields' => array(
'Category')
1106 $oTmpBlogSearch->aCurrent[
'restriction'][
'category'] = array(
1107 'field' =>
'Category',
1109 'table' =>
'sys_categories',
1110 'value' => $sCategoryName
1112 $oTmpBlogSearch->aCurrent[
'restriction'][
'category_type'] = array(
1115 'table' =>
'sys_categories',
1116 'value' =>
'ch_blogs',
1118 $oTmpBlogSearch->aCurrent[
'restriction'][
'category_owner'] = array(
1121 'table' =>
'sys_categories',
1122 'value' => $iMemberID,
1125 if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->
isAdmin() ==
true) {
1126 $oTmpBlogSearch->aCurrent[
'restriction'][
'activeStatus'] =
'';
1128 $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1129 $sBlogPostsVal = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) : $sBlogPostsVal;
1132 if ($this->bUseFriendlyLinks ==
false || $this->bAdminMode ==
true) {
1133 $sCategUrlAdd = $sCategoryName ?
"category={$sCategoryName}" :
'';
1134 $sRequest =
ch_append_url_params($sOwnerBlogLink, $sCategUrlAdd .
'&page={page}&per_page={per_page}');
1136 $sCategUrlAdd = $sCategoryName ?
"/category/{$sCategoryName}" :
'';
1137 $sRequest =
ch_append_url_params($sOwnerBlogLink . $sCategUrlAdd,
'page={page}&per_page={per_page}');
1141 $oTmpBlogSearch->aCurrent[
'paginate'][
'page_url'] = $sRequest;
1143 $sPagination = $oTmpBlogSearch->showPagination3();
1144 $sBlogPostsHtmlVal = <<<EOF
1145 <div
class=
"ch-def-bc-padding">
1154 $sRetHtml = $this->
Templater($sPostsSect, $sRightSect);
1163 $sSuccUpdPost =
_t(
'_ch_blog_Post_succ_updated');
1164 $sFailUpdPost =
_t(
'_ch_blog_Post_fail_updated');
1166 $iPostID = (int)
ch_get(
'post_id');
1167 $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
1169 if ((($this->_iVisitorID == $iPostOwnerID && $iPostOwnerID > 0) || $this->bAdminMode) && $iPostID > 0) {
1171 $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
1172 if ($sFileName ==
'') {
1173 $sFileName =
'blog_' . $iPostID;
1175 $sDFilePath = CH_BLOGS_IMAGES_PATH .
"small_{$sFileName}";
1176 @unlink($sDFilePath);
1177 $sDFilePath = CH_BLOGS_IMAGES_PATH .
"big_{$sFileName}";
1178 @unlink($sDFilePath);
1179 $sDFilePath = CH_BLOGS_IMAGES_PATH .
"orig_{$sFileName}";
1180 @unlink($sDFilePath);
1182 $vSqlRes = $this->_oDb->performUpdatePostWithPhoto($iPostID);
1187 } elseif ($this->_iVisitorID != $iPostOwnerID) {
1188 print
MsgBox(
_t(
'_Access denied'));
1190 return MsgBox(
_t(
'_Access denied'));
1192 print
MsgBox(
_t(
'_Error Occured'));
1194 return MsgBox(
_t(
'_Error Occured'));
1205 if (!$this->bAdminMode) {
1209 if ($iPostID == 0) {
1210 $iPostID = (int)
ch_get(
'DeletePostID');
1213 $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
1216 return $this->_oTemplate->displayAccessDenied();
1220 $oCmts =
new ChWsbCmts($this->_oConfig->getCommentSystemName(), (
int)$iPostID);
1221 $oCmts->onObjectDelete();
1225 $oVoting =
new ChTemplVotingView ($this->_oConfig->getRateSystemName(), $iPostID);
1226 $oVoting->deleteVotings($iPostID);
1228 $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
1229 $sFilePathPost =
'big_' . $sFileName;
1230 if ($sFilePathPost !=
'' && file_exists(CH_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(CH_BLOGS_IMAGES_PATH . $sFilePathPost)) {
1231 @unlink(CH_BLOGS_IMAGES_PATH . $sFilePathPost);
1233 $sFilePathPost =
'small_' . $sFileName;
1234 if ($sFilePathPost !=
'' && file_exists(CH_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(CH_BLOGS_IMAGES_PATH . $sFilePathPost)) {
1235 @unlink(CH_BLOGS_IMAGES_PATH . $sFilePathPost);
1237 $sFilePathPost =
'orig_' . $sFileName;
1238 if ($sFilePathPost !=
'' && file_exists(CH_BLOGS_IMAGES_PATH . $sFilePathPost) && is_file(CH_BLOGS_IMAGES_PATH . $sFilePathPost)) {
1239 @unlink(CH_BLOGS_IMAGES_PATH . $sFilePathPost);
1242 $vSqlRes = $this->_oDb->deletePost($iPostID);
1243 $sRet = (
db_affected_rows($vSqlRes) > 0) ?
_t(
'_post_successfully_deleted') :
_t(
'_failed_to_delete_post');
1250 $oTags->reparseObjTags(
'blog', $iPostID);
1254 $oCategories->reparseObjTags(
'ch_blogs', $iPostID);
1258 $oViews =
new ChWsbViews($this->_oConfig->getViewSystemName(), $iPostID,
false);
1259 $oViews->onObjectDelete();
1263 $oSubscription->unsubscribe(array(
'type' =>
'object_id',
'unit' =>
'ch_blogs',
'object_id' => $iPostID));
1266 $oZ =
new ChWsbAlerts(
'ch_blogs',
'delete_post', $iPostID, $iPostOwnerID);
1271 return MsgBox(
_t(
'_Error Occured'));
1277 if ($this->iViewingPostID < 0) {
1278 if (
false !==
ch_get(
'postUri')) {
1280 $this->iViewingPostID = (int)$this->_oDb->getPostIDByUri($sPostUri);
1281 } elseif (
false !==
ch_get(
'post_id')) {
1282 $this->iViewingPostID = (int)
ch_get(
'post_id');
1285 if ($this->iViewingPostID) {
1286 $this->aViewingPostInfo = $this->_oDb->getPostInfo($this->iViewingPostID);
1289 $iOwnerID = (int)$this->aViewingPostInfo[
'OwnerID'];
1291 $bPossibleToView = $this->oPrivacy->check(
'view', $this->iViewingPostID, $this->_iVisitorID);
1295 DesignBoxContent($this->_sPageHeader, $this->_oTemplate->displayAccessDenied(), 1),
1300 $this->iPostViewType = 3;
1303 new ChWsbViews($this->_oConfig->getViewSystemName(), $this->iViewingPostID);
1306 $oZ =
new ChWsbAlerts(
'ch_blogs',
'view_post', $this->iViewingPostID, $this->_iVisitorID);
1309 if ($this->aViewingPostInfo[
'PostPhoto'] !=
'' && file_exists(CH_BLOGS_IMAGES_PATH .
'small_' . $this->aViewingPostInfo[
'PostPhoto'])) {
1310 $GLOBALS[
'oTopMenu']->setCustomSubIconUrl(CH_BLOGS_IMAGES_URL .
'small_' . $this->aViewingPostInfo[
'PostPhoto']);
1312 $GLOBALS[
'oTopMenu']->setCustomSubIconUrl(
'book');
1315 $sPostCaption = htmlspecialchars($this->aViewingPostInfo[
'PostCaption']);
1316 $GLOBALS[
'oTopMenu']->setCustomSubHeader($sPostCaption);
1318 $GLOBALS[
'oTopMenu']->setCustomBreadcrumbs(array(
1320 $sPostCaption =>
'',
1323 return array(
'',
true);
1332 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
1334 $oTmpBlogSearch->PerformObligatoryInit($this, 3);
1336 if (($this->aViewingPostInfo[
'OwnerID'] == $this->_iVisitorID && $this->aViewingPostInfo[
'OwnerID'] > 0) || $this->bAdminMode) {
1337 $oTmpBlogSearch->aCurrent[
'restriction'][
'activeStatus'] =
'';
1339 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = 1;
1340 $sPostStringVal = $oTmpBlogSearch->displayResultBlock();
1343 $iOwnerID = (int)$this->aViewingPostInfo[
'OwnerID'];
1346 $sCategoryUrlAdd = ($sCategoryName !=
'') ?
"&category=" . $sCategoryName :
'';
1347 $sStatusFilter = ($this->
isAdmin() ==
true) ?
'1' :
"`PostStatus`='approval'";
1348 $aPostsInCategory = $this->_oDb->getPostsInCategory($sStatusFilter, $sCategoryName, $iOwnerID);
1350 reset($aPostsInCategory);
1351 $iCurKey = array_search($this->iViewingPostID, $aPostsInCategory);
1354 $sMoreIcon = $this->_oTemplate->getIconUrl(
'more.png');
1355 if (isset($aPostsInCategory[$iCurKey - 1]) && $aPostsInCategory[$iCurKey - 1] > 0) {
1356 $iPrevUnitID = (int)$aPostsInCategory[$iCurKey - 1];
1357 $aPrevPostInfo = $this->_oDb->getPostCaptionAndUriByID($iPrevUnitID);
1358 $sPrevPostCaption = $aPrevPostInfo[
'PostCaption'];
1359 $sPrevPostUri = $aPrevPostInfo[
'PostUri'];
1360 $sUnitUrl = $this->
genUrl($iPrevUnitID, $sPrevPostUri) . $sCategoryUrlAdd;
1361 $sBackNextNav .= <<<EOF
1362 <i
class=
"bot_icon_left sys-icon arrow-left"></i>
1363 <
a title=
"{$sPrevPostCaption}" href=
"{$sUnitUrl}" class=
"backMembers ch-def-margin-thd-left">
1368 if (isset($aPostsInCategory[$iCurKey + 1]) && $aPostsInCategory[$iCurKey + 1] > 0) {
1369 $iNextUnitID = (int)$aPostsInCategory[$iCurKey + 1];
1370 $aNextPostInfo = $this->_oDb->getPostCaptionAndUriByID($iNextUnitID);
1371 $sNextPostCaption = $aNextPostInfo[
'PostCaption'];
1372 $sNextPostUri = $aNextPostInfo[
'PostUri'];
1373 $sUnitUrl = $this->
genUrl($iNextUnitID, $sNextPostUri) . $sCategoryUrlAdd;
1374 $sBackNextNav .= <<<EOF
1375 <i
class=
"bot_icon_right sys-icon arrow-right"></i>
1376 <
a title=
"{$sNextPostCaption}" href=
"{$sUnitUrl}" class=
"moreMembers ch-def-margin-thd-right">
1382 $sSPaginate = <<<EOF
1383 <div
class=
"dbBottomMenu">
1384 <div
class=
"pages_section">
1392 return DesignBoxContent(
_t(
'_ch_blog_post_view'), $sPostStringVal, 11,
'', $sSPaginate);
1401 $sUrl = $this->
genUrl($this->aViewingPostInfo[
'PostID'], $this->aViewingPostInfo[
'PostUri']);
1402 $sTitle = $this->aViewingPostInfo[
'PostCaption'];
1404 $aCustomParams =
false;
1405 if ($this->aViewingPostInfo[
'PostPhoto']) {
1406 $sImgUrl = CH_BLOGS_IMAGES_URL .
'orig_' . $this->aViewingPostInfo[
'PostPhoto'];
1407 $aCustomParams = array(
1408 'img_url' => $sImgUrl,
1409 'img_url_encoded' => rawurlencode($sImgUrl)
1416 return array(
$sCode, array(), array(),
false);
1421 require_once($this->_oConfig->getClassPath() .
'ChBlogsCmts.php');
1422 $_oCmtsView =
new ChBlogsCmts($this->_oConfig->getCommentSystemName(), $this->iViewingPostID);
1423 $sPostComm = $_oCmtsView->getExtraCss();
1424 $sPostComm .= $_oCmtsView->getExtraJs();
1425 $sPostComm .= (!$_oCmtsView->isEnabled()) ?
MsgBox(
_t(
'_ch_blog_Comments_is_disabled')) : $_oCmtsView->getCommentsFirst();
1432 if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
1434 $iMemberID = (int)$this->aViewingPostInfo[
'OwnerID'];
1437 $aUser = array(
'Permalink' => $aOwnerInfo[
'NickName'],
'Link' => $iMemberID);
1439 $sOwnerBlogLinkSub = $this->
genBlogLink(
'show_member_blog_home',
$aUser,
'',
'',
'',
true);
1441 $sApproveC =
_t(
'_Approve');
1442 $sDisApproveC =
_t(
'_Disapprove');
1443 $sFeatureItC =
_t(
'_Feature it');
1444 $sDeFeatureItC =
_t(
'_De-Feature it');
1448 if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->bAdminMode || $bApproveAllowed) {
1449 $iFeaturedStatus = $this->_oDb->getFeaturedStatus($this->iViewingPostID);
1450 $sFeatureC = ((int)$iFeaturedStatus == 1) ? $sDeFeatureItC : $sFeatureItC;
1452 if ($this->bAdminMode || $bApproveAllowed ==
'true') {
1454 if (
ch_get(
'sa') ==
'approve') {
1455 $this->_oDb->setPostStatus($this->iViewingPostID,
'approval');
1459 if (
ch_get(
'sa') ==
'disapprove') {
1460 $this->_oDb->setPostStatus($this->iViewingPostID);
1465 $sCurPostStatus = $this->_oDb->getActiveStatus($this->iViewingPostID);
1466 switch ($iApproved) {
1468 $sSAAction = ($sCurPostStatus ==
'disapproval') ?
'approve' :
'disapprove';
1469 $sSACaption = ($sCurPostStatus ==
'disapproval') ? $sApproveC : $sDisApproveC;
1472 $sSAAction =
'disapprove';
1473 $sSACaption = $sDisApproveC;
1476 $sSAAction =
'approve';
1477 $sSACaption = $sApproveC;
1485 $sViewingPostUri = $this->_oDb->getPostUriByID($this->iViewingPostID);
1486 $aViewingPost = array(
'Permalink' => $sViewingPostUri,
'Link' => $this->iViewingPostID);
1487 $sViewingPostLink = $this->
genBlogLink(
'show_member_post',
$aUser,
'', $aViewingPost);
1488 $sLink = $this->
genBlogLink(
'show_member_post',
$aUser,
'', $aViewingPost,
'',
true);
1494 $aButton =
$oSubscription->getButton($this->_iVisitorID,
'ch_' . $this->_oConfig->getUri(),
'',
1495 $this->iViewingPostID);
1498 $aActionKeys = array(
1500 'visitor_id' => $this->_iVisitorID,
1501 'owner_id' => $iMemberID,
1502 'blog_owner_link' => $sOwnerBlogLinkSub,
1503 'owner_title' => $sOwnerNickname,
1504 'owner_name' => $aOwnerInfo[
'NickName'],
1505 'admin_mode' =>
"'" . $this->bAdminMode .
"'",
1506 'post_id' => $this->iViewingPostID,
1507 'post_featured' => (
int)$iFeaturedStatus,
1508 'sure_label' =>
_t(
'_Are_you_sure'),
1509 'post_entry_url' => $sLink,
1510 'post_inside_entry_url' => $sViewingPostLink,
1511 'sSACaption' => $sSACaption,
1512 'sSAAction' => $sSAAction,
1513 'work_url' => $sProcessingFile,
1515 'sbs_blogs_title' => $aButton[
'title'],
1516 'sbs_blogs_script' => $aButton[
'script'],
1517 'site_url' => CH_WSB_URL_ROOT,
1518 'allow_approve' => $bApproveAllowed,
1519 'base_url' => $this->sHomeUrl,
1520 'TitleShare' => $this->
isAllowedShare($this->aViewingPostInfo) ?
_t(
'_Share') :
'',
1523 $aActionKeys[
'repostCpt'] = $aActionKeys[
'repostScript'] =
'';
1527 $aActionKeys[
'repostCpt'] =
_t(
'_Repost');
1528 $aActionKeys[
'repostScript'] =
ChWsbService::call(
'wall',
'get_repost_js_click', array($this->_iVisitorID,
'ch_blogs',
'create', $this->iViewingPostID));
1531 $sActionsVal =
$GLOBALS[
'oFunctions']->genObjectsActions($aActionKeys,
'ch_blogs',
false);
1533 return $sSubsAddon . $sActionsVal;
1539 $aPostInfo = $this->_oDb->getPostInfo($iEntryId);
1540 if ($aPostInfo[
'OwnerID']) {
1541 $sEntryUrl = $this->
genUrl($iEntryId, $aPostInfo[
'PostUri']);
1542 $sEntryCaption = $aPostInfo[
'PostCaption'];
1544 return array(
'skip' =>
true);
1547 $aActionList = array(
1548 'commentPost' =>
'_ch_blog_sbs_comments'
1551 $sActionName = isset($aActionList[
$sAction]) ?
' (' .
_t($aActionList[
$sAction]) .
')' :
'';
1555 'template' => array(
1556 'Subscription' => $sEntryCaption . $sActionName,
1557 'ViewLink' => $sEntryUrl,
1564 if ($this->iPostViewType != 3 || !$this->iViewingPostID) {
1569 $bPossibleToRate = $this->oPrivacy->check(
'rate', $this->iViewingPostID, $this->_iVisitorID);
1570 $oVotingView =
new ChTemplVotingView ($this->_oConfig->getRateSystemName(), $this->iViewingPostID);
1571 if ($oVotingView && $oVotingView->isEnabled() && $bPossibleToRate) {
1572 $sVotePostRating = $oVotingView->getBigVoting(1);
1574 $sVotePostRating = $oVotingView->getBigVoting(0);
1576 $aVars = array(
'content' => $sVotePostRating);
1578 return $this->_oTemplate->parseHtmlByName(
'default_padding.html',
$aVars);
1583 $iMemberID = (int)$this->aViewingPostInfo[
'OwnerID'];
1584 $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID);
1585 $sBlogDescription =
'<div class="blog_desc ch-def-margin-sec-top">' .
process_html_output($aBlogInfo[
'Description']) .
'</div>';
1590 'fields' => $sBlogDescription,
1593 if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
1594 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
1603 $aCategories = $oCategories->explodeTags($this->aViewingPostInfo[
'Categories']);
1604 $aCatLinks = array();
1605 if (count($aCategories) > 0) {
1606 foreach ($aCategories
as $iKey => $sCatValue) {
1607 $sCatLink = $oBlogSearch->getCurrentUrl(
'category',
title2uri(trim($sCatValue)),
1609 array(
'ownerId' => $iMemberID,
'blogOwnerName' => $aAuthor[
'NickName']));
1610 $aCatLinks[] =
'<a href="' . $sCatLink .
'" rel="nofollow">' . $sCatValue .
'</a>';
1612 $sCats = implode(
", ", $aCatLinks);
1616 $aTags = $oTags->explodeTags($this->aViewingPostInfo[
'Tags']);
1617 $aTagLinks = array();
1618 if (count($aTags) > 0) {
1619 foreach ($aTags
as $sTagKey) {
1620 if ($sTagKey !=
'') {
1621 $sTagLink = $oBlogSearch->getCurrentUrl(
'tag', $iPostID,
title2uri(trim($sTagKey)));
1622 $aTagLinks[] =
'<a href="' . $sTagLink .
'" title="' . $sTagKey .
'" rel="nofollow">' . $sTagKey .
'</a>';
1625 $sTags = implode(
", ", $aTagLinks);
1634 return $this->_oTemplate->parseHtmlByName(
'entry_view_block_info.html',
$aVars);
1637 return $this->_oTemplate->parseHtmlByName(
'entry_view_empty_block_info.html',
$aVars);
1642 $iMemberID = (int)$this->aViewingPostInfo[
'OwnerID'];
1646 $sOwnerAddAp = ($iMemberID == $this->_iVisitorID
1650 :
"AND `PostStatus`='approval'";
1652 $sStatusFilter = ($this->
isAdmin() ==
true) ?
'' : $sOwnerAddAp;
1654 $aTagsPost = array();
1657 $vTags = $this->_oDb->getTagsInfo($iMemberID, $sStatusFilter,
'');
1659 $aTagsPost = array();
1660 while ($aPost = $vTags->fetch()) {
1661 $sTagsCommas = trim($aPost[
'Tags']);
1662 $aTags = explode(
',', $sTagsCommas);
1663 foreach ($aTags
as $sTagKeyVal) {
1664 $sTagKey = trim($sTagKeyVal);
1665 if ($sTagKey !=
'') {
1666 if (isset($aTagsPost[$sTagKey])) {
1667 $aTagsPost[$sTagKey]++;
1669 $aTagsPost[$sTagKey] = 1;
1675 $aTagsPost = array_slice($aTagsPost, 0, $this->_oConfig->iTopTagsCnt);
1677 if (count($aTagsPost)) {
1678 $iMinFontSize =
$GLOBALS[
'oTemplConfig']->iTagsMinFontSize;
1679 $iMaxFontSize =
$GLOBALS[
'oTemplConfig']->iTagsMaxFontSize;
1680 $iFontDiff = $iMaxFontSize - $iMinFontSize;
1682 $iMinRating = min($aTagsPost);
1683 $iMaxRating = max($aTagsPost);
1685 $iRatingDiff = $iMaxRating - $iMinRating;
1686 $iRatingDiff = ($iRatingDiff == 0) ? 1 : $iRatingDiff;
1689 $aProf = array(
'Permalink' => $aOwnerInfo[
'NickName'],
'Link' => $iMemberID);
1691 foreach ($aTagsPost
as $sTag => $iCount) {
1692 $iTagSize = $iMinFontSize + round($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff));
1693 $href = str_replace(
'{tag}', urlencode($sTag), $sCrtHrefTmpl);
1696 $sTagsVals .=
'<span class="one_tag" style="font-size:' . $iTagSize .
'px;">
1697 <a href="' . $sTagLink .
'" title="' .
_t(
'_Count') .
':' . $iCount .
'">' .
htmlspecialchars_adv($sTag) .
'</a>
1701 $sTagsVals = ($sTagsVals ==
'') ?
MsgBox(
_t(
'_Empty')) : $sTagsVals;
1704 <div
class=
"ch-def-bc-padding">
1706 <div
class=
"clear_both"></div>
1713 $iMemberID = (int)$this->aViewingPostInfo[
'OwnerID'];
1716 $aProf = array(
'Permalink' => $aOwnerInfo[
'NickName'],
'Link' => $iMemberID);
1718 $sOwnerAddAp = ($iMemberID == $this->_iVisitorID
1722 :
"AND `PostStatus`='approval'";
1724 $sStatusFilter = ($this->
isAdmin() ==
true) ?
'' : $sOwnerAddAp;
1726 $sNewC = ucfirst(
_t(
'_new'));
1727 $sCategoriesC =
_t(
'_ch_blog_Categories');
1728 $sPostsCL = mb_strtolower(
_t(
'_ch_blog_Posts'));
1733 $aAllCategories = $oCategories->getCategoriesList(
'ch_blogs', $iMemberID);
1735 if (is_array($aAllCategories) && count($aAllCategories) > 0) {
1736 foreach ($aAllCategories
as $iCatID => $sCategoryName) {
1737 $sCategoryNameS = addslashes($sCategoryName);
1738 $iCountCatPost = $this->_oDb->getPostsCntInCategory($sCategoryNameS, $sStatusFilter, $iMemberID);
1740 if ($iCountCatPost == 0) {
1747 $aCat = array(
'Permalink' =>
title2uri($sCategoryName),
'Link' =>
title2uri($sCategoryName));
1748 $sCatLink = $this->
genBlogLink(
'show_member_blog', $aProf, $aCat);
1750 $sCategories .= <<<EOF
1751 <div
class=
"cls_result_row ch-def-margin-sec-top-auto">
1752 <div
class=
"cls_categ_name">
1753 <i
class=
"sys-icon folder"></i>
1754 <
a href=
"{$sCatLink}">{$sCatName}</
a> <span
class=
"blog_author ch-def-font-grayed ch-def-font-small">({$iCountCatPost} {$sPostsCL})</span>
1766 $iMemberID = (int)$this->aViewingPostInfo[
'OwnerID'];
1768 $aUser = array(
'Permalink' => $aOwnerInfo[
'NickName'],
'Link' => $iMemberID);
1770 $sFeaturedSect =
'';
1771 $vFeaturedPosts = $this->_oDb->getFeaturedPosts($iMemberID);
1772 if ($vFeaturedPosts->rowCount()) {
1774 while ($aFeaturedPost = $vFeaturedPosts->fetch()) {
1775 $iPostID = (int)$aFeaturedPost[
'PostID'];
1776 $aPost = array(
'Permalink' => $aFeaturedPost[
'PostUri'],
'Link' => $iPostID);
1780 $sFeatured .= <<<EOF
1781 <div
class=
"cls_result_row ch-def-margin-sec-top-auto">
1782 <div
class=
"cls_categ_name">
1783 <i
class=
"sys-icon star-o"></i>
1784 <
a href=
"{$sPostLink}" title=
"{$sFeaturedPostTitle}">{$sFeaturedPostTitle}</
a>
1791 <div
class=
"ch-def-bc-padding">
1805 $this->iViewingPostID = ($iParamPostID > 0) ? $iParamPostID : $this->iViewingPostID;
1808 if (
empty($this->aViewingPostInfo)) {
1809 header(
"HTTP/1.1 404 Not Found");
1810 $sMsg =
_t(
'_sys_request_page_not_found_cpt');
1816 if(
isBlocked($this->aViewingPostInfo[
'OwnerID'], $this->_iVisitorID)) {
1817 return MsgBox(
_t(
'_sys_txt_error_you_are_blocked'));
1820 $iBlogLimitChars = (int)
getParam(
'max_blog_preview');
1821 $sPostText =
htmlspecialchars_adv(mb_substr(trim(strip_tags($this->aViewingPostInfo[
'PostText'])), 0,
1823 $this->_oTemplate->setPageDescription($sPostText);
1825 if (mb_strlen($this->aViewingPostInfo[
'Tags']) > 0) {
1826 $this->_oTemplate->addPageKeywords($this->aViewingPostInfo[
'Tags']);
1832 $sRetHtml .= $oBPV->getCode();
1842 $sMainC =
_t(
'_ch_blog_Manage_main');
1843 $sAddC =
_t(
'_ch_blog_Add');
1844 $sManageC =
_t(
'_ch_blog_Manage');
1845 $sPendingC =
_t(
'_ch_blog_pending_approval');
1846 $sAdministrationC =
_t(
'_ch_blog_Administration');
1847 $sMyBlogC =
_t(
'_ch_blog_My_blog');
1848 $sPendApprC =
_t(
'_ch_blog_pending_approval');
1849 $sMyPostsC =
_t(
'_ch_blog_My_posts');
1853 $sBlogMainLink = ($bUseFriendlyLinks) ?
'blogs/my_page/' :
"{$sLink}?action=my_page";
1854 $sBlogAddLink = ($bUseFriendlyLinks) ?
'blogs/my_page/add/' :
"{$sLink}?action=my_page&mode=add";
1855 $sBlogManageLink = ($bUseFriendlyLinks) ?
'blogs/my_page/manage/' :
"{$sLink}?action=my_page&mode=manage";
1856 $sBlogPendingLink = ($bUseFriendlyLinks) ?
'blogs/my_page/pending/' :
"{$sLink}?action=my_page&mode=pending";
1858 if (
ch_get(
'action_delete') && is_array(
ch_get(
'bposts'))) {
1859 foreach (
ch_get(
'bposts')
as $iBPostID) {
1864 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
1866 $oTmpBlogSearch->PerformObligatoryInit($this, 4);
1867 $oTmpBlogSearch->bShowCheckboxes =
false;
1868 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage();
1871 $GLOBALS[
'oTopMenu']->setCurrentProfileID($this->_iVisitorID);
1874 $sMyBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1875 $sMyPosts = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) : $sMyBlogPostsVal;
1877 $oTmpBlogSearch->aCurrent[
'paginate'][
'page_url'] = $sBlogMainLink;
1878 $sMyPostsPagination = $oTmpBlogSearch->showPagination3();
1881 $sMainTabClass = $sAddTabClass = $sManageTabClass = $sPendingTabClass = 0;
1886 $aBlogsRes = $this->_oDb->getBlogInfo($this->_iVisitorID);
1889 $sAdmContent = $sNewPostForm;
1893 $sManageTabClass = 1;
1895 $oTmpBlogSearch->bShowCheckboxes =
true;
1896 $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1897 $sActivePosts = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) : $sBlogPostsVal;
1899 $sManagePostsPagination = $oTmpBlogSearch->showPaginationAjax(
'ch_blogs_user_form', $sBlogManageLink);
1901 $sAdmPanel = $oTmpBlogSearch->showAdminActionsPanel(
'bposts_box', array(
'action_delete' =>
'_Delete'),
1903 $sManagePostsUnits = <<<EOF
1904 <div
id=
"bposts_box" class=
"ch-def-bc-padding">
1906 <div
class=
"clear_both"></div>
1908 {$sManagePostsPagination}
1911 $sAjaxContent = $sManagePostsUnits;
1912 $sAdmContent =
'<form id="ch_blogs_user_form" method="post">' . $sManagePostsUnits .
'</form>';
1915 $sPendingTabClass = 1;
1917 $oTmpBlogSearch->aCurrent[
'restriction'][
'activeStatus'][
'value'] =
'disapproval';
1918 $sDisPostsVal = $oTmpBlogSearch->displayResultBlock();
1919 $sDisPostsVal = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) : $sDisPostsVal;
1921 $sPendingPostsPagination = $oTmpBlogSearch->showPaginationAjax(
'ch_blogs_pending', $sBlogPendingLink);
1923 $sPendingPostsUnits = <<<EOF
1924 <div
id=
"bposts_box" class=
"ch-def-bc-padding">
1926 <div
class=
"clear_both"></div>
1928 $sPendingPostsPagination
1930 $sAjaxContent = $sPendingPostsUnits;
1931 $sAdmContent =
'<div id="ch_blogs_pending">' . $sPendingPostsUnits .
'</div>';
1937 $iMyPostsCnt = $this->_oDb->getMemberPostsCnt($this->_iVisitorID);
1938 $sAdmContent =
'<div class="ch-def-font-large" style="text-align: center;">' .
_t(
'_ch_blog_admin_box_desc',
1939 $iMyPostsCnt, $sBlogManageLink, $sBlogAddLink) .
'</div>';
1940 $aVars = array(
'content' => $sAdmContent);
1941 $sAdmContent = $this->_oTemplate->parseHtmlByName(
'default_padding.html',
$aVars);
1946 'blogs_main' => array(
'href' => $sBlogMainLink,
'title' => $sMainC,
'active' => $sMainTabClass),
1947 'blogs_add' => array(
'href' => $sBlogAddLink,
'title' => $sAddC,
'active' => $sAddTabClass),
1948 'blogs_manage' => array(
'href' => $sBlogManageLink,
'title' => $sManageC,
'active' => $sManageTabClass),
1949 'blogs_pending' => array(
'href' => $sBlogPendingLink,
'title' => $sPendingC,
'active' => $sPendingTabClass)
1952 if ($sAjaxContent &&
ch_get(
'ajax')) {
1953 header(
'Content-type:text/html;charset=utf-8');
1958 $sAdministrationUnitsSect =
DesignBoxContent($sAdministrationC, $sAdmContent, 1, $sAdmPost);
1960 $sMyPostsBox =
DesignBoxContent($sMyPostsC, $sMyPosts, 11,
false, $sMyPostsPagination);
1962 return $sAdministrationUnitsSect . $sMyPostsBox;
1975 if ($iPostID == 0) {
1977 return $this->_oTemplate->displayAccessDenied();
1980 $iOwnerID = (int)$this->_oDb->getPostOwnerByID($iPostID);
1982 return $this->_oTemplate->displayAccessDenied();
1986 $sPostCaptionC =
_t(
'_Title');
1987 $sPostTextC =
_t(
'_Text');
1988 $sAssociatedImageC =
_t(
'_associated_image');
1989 $sAddBlogC = ($iPostID) ?
_t(
'_Submit') :
_t(
'_Add Post');
1990 $sTagsC =
_t(
'_Tags');
1991 $sNewPostC =
_t(
'_New Post');
1992 $sEditPostC =
_t(
'_ch_blog_Edit_post');
1993 $sDelImgC =
_t(
'_Delete image');
1994 $sErrorC =
_t(
'_Error Occured');
1995 $sCaptionErrorC =
_t(
'_ch_blog_Caption_error');
1996 $sTextErrorC =
_t(
'_ch_blog_Text_error');
1997 $sTagsInfoC =
_t(
'_sys_tags_note');
2004 $oCategories->getTagObjectConfig();
2006 $aAllowView = $this->oPrivacy->getGroupChooser($this->_iVisitorID,
'blogs',
'view', array(),
2007 _t(
'_ch_blog_privacy_view'));
2008 $aAllowRate = $this->oPrivacy->getGroupChooser($this->_iVisitorID,
'blogs',
'rate', array(),
2009 _t(
'_ch_blog_privacy_rate'));
2010 $aAllowComment = $this->oPrivacy->getGroupChooser($this->_iVisitorID,
'blogs',
'comment', array(),
2011 _t(
'_ch_blog_privacy_comment'));
2013 $sAction = ($iPostID == 0) ?
'new_post' :
'edit_post';
2017 'form_attrs' => array(
2018 'name' =>
'CreateBlogPostForm',
2021 'enctype' =>
'multipart/form-data',
2025 'table' => $this->_oConfig->sSQLPostsTable,
2027 'submit_name' =>
'add_button',
2031 'PostCaption' => array(
2033 'name' =>
'PostCaption',
2034 'caption' => $sPostCaptionC,
2038 'params' => array(3, 255),
2039 'error' => $sCaptionErrorC,
2048 'caption' => $sTagsC,
2049 'info' => $sTagsInfoC,
2050 'required' =>
false,
2055 'PostText' => array(
2056 'type' =>
'textarea',
2058 'name' =>
'PostText',
2059 'caption' => $sPostTextC,
2063 'params' => array(3, 65535),
2064 'error' => $sTextErrorC,
2067 'pass' =>
'XssHtml',
2070 'Categories' => $oCategories->getGroupChooser(
'ch_blogs', $this->_iVisitorID,
true),
2073 'name' =>
'BlogPic[]',
2074 'caption' => $sAssociatedImageC,
2076 'AssociatedImage' => array(
2079 'allowView' => $aAllowView,
2080 'allowRate' => $aAllowRate,
2081 'allowComment' => $aAllowComment,
2082 'hidden_action' => array(
2087 'add_button' => array(
2089 'name' =>
'add_button',
2090 'value' => $sAddBlogC,
2096 $aBlogPost = $this->_oDb->getJustPostInfo($iPostID);
2097 $sPostCaption = $aBlogPost[
'PostCaption'];
2098 $sPostText = $aBlogPost[
'PostText'];
2099 $sPostTags = $aBlogPost[
'Tags'];
2100 $sPostPicture = $aBlogPost[
'PostPhoto'];
2101 if ($sPostPicture !=
'') {
2102 $sBlogsImagesUrl = CH_BLOGS_IMAGES_URL;
2103 $sPostPictureTag = <<<EOF
2104 <div
class=
"blog_edit_image" id=
"edit_post_image_{$iPostID}">
2105 <img
class=
"ch-def-shadow ch-def-round-corners ch-def-margin-sec-right" style=
"max-width:{$this->iThumbSize}px; max-height:{$this->iThumbSize}px;" src=
"{$sBlogsImagesUrl}big_{$sPostPicture}" />
2106 <
a href=
"{$sLink}?action=del_img&post_id={$iPostID}" onclick=
"BlogpostImageDelete('{$sLink}?action=del_img&post_id={$iPostID}&mode=ajax', 'edit_post_image_{$iPostID}');return false;" >{$sDelImgC}</
a>
2110 $aForm[
'inputs'][
'AssociatedImage'][
'type'] =
'custom';
2111 $aForm[
'inputs'][
'AssociatedImage'][
'content'] = $sPostPictureTag;
2112 $aForm[
'inputs'][
'AssociatedImage'][
'caption'] = $sAssociatedImageC;
2115 $aCategories = explode(
';', $aBlogPost[
'Categories']);
2117 $aForm[
'inputs'][
'PostCaption'][
'value'] = $sPostCaption;
2118 $aForm[
'inputs'][
'PostText'][
'value'] = $sPostText;
2119 $aForm[
'inputs'][
'Tags'][
'value'] = $sPostTags;
2120 $aForm[
'inputs'][
'Categories'][
'value'] = $aCategories;
2122 $aForm[
'inputs'][
'allowView'][
'value'] = $aBlogPost[
'allowView'];
2123 $aForm[
'inputs'][
'allowRate'][
'value'] = $aBlogPost[
'allowRate'];
2124 $aForm[
'inputs'][
'allowComment'][
'value'] = $aBlogPost[
'allowComment'];
2126 $aForm[
'inputs'][
'hidden_postid'] = array(
2128 'name' =>
'EditPostID',
2129 'value' => $iPostID,
2132 if ($aBlogPost[
'PostPhoto'] !=
'' && file_exists(CH_BLOGS_IMAGES_PATH .
'small_' . $aBlogPost[
'PostPhoto'])) {
2133 $GLOBALS[
'oTopMenu']->setCustomSubIconUrl(CH_BLOGS_IMAGES_URL .
'small_' . $aBlogPost[
'PostPhoto']);
2135 $GLOBALS[
'oTopMenu']->setCustomSubIconUrl(
'book');
2137 $GLOBALS[
'oTopMenu']->setCustomSubHeader($sPostCaption);
2140 if (
empty(
$aForm[
'inputs'][
'allowView'][
'value']) || !
$aForm[
'inputs'][
'allowView'][
'value']) {
2143 if (
empty(
$aForm[
'inputs'][
'allowRate'][
'value']) || !
$aForm[
'inputs'][
'allowRate'][
'value']) {
2146 if (
empty(
$aForm[
'inputs'][
'allowComment'][
'value']) || !
$aForm[
'inputs'][
'allowComment'][
'value']) {
2152 if (
$oForm->isSubmittedAndValid()) {
2157 $sPostUri =
uriGenerate(
ch_get(
'PostCaption'), $this->_oConfig->sSQLPostsTable,
'PostUri');
2158 $sAutoApprovalVal = (
getParam(
'blogAutoApproval') ==
'on') ?
"approval" :
"disapproval";
2161 'PostDate' => $sCurTime,
2162 'PostStatus' => $sAutoApprovalVal
2164 if ($iPostID == 0) {
2165 $aValsAdd[
'OwnerID'] = $iOwnID;
2166 $aValsAdd[
'PostUri'] = $sPostUri;
2172 unset($aValsAdd[
'PostDate']);
2173 $oForm->update($iPostID, $aValsAdd);
2175 $iBlogPostID = $iPostID;
2177 $iBlogPostID =
$oForm->insert($aValsAdd);
2182 $this->iLastPostedPostID = $iBlogPostID;
2185 for ($i = 0; $i < count($_FILES[
'BlogPic'][
'tmp_name']); $i++) {
2186 if ($_FILES[
'BlogPic'][
'error'][$i]) {
2189 if (0 < $_FILES[
'BlogPic'][
'size'][$i] && 0 < strlen($_FILES[
'BlogPic'][
'name'][$i]) && 0 < $iBlogPostID) {
2190 $sTmpFile = $_FILES[
'BlogPic'][
'tmp_name'][$i];
2191 if (file_exists($sTmpFile) ==
false) {
2195 $aSize = getimagesize($sTmpFile);
2201 switch ($aSize[2]) {
2202 case IMAGETYPE_JPEG:
2206 $sOriginalFilename = $_FILES[
'BlogPic'][
'name'][$i];
2207 $sExt = strrchr($sOriginalFilename,
'.');
2209 $sFileName =
'blog_' . $iBlogPostID .
'_' . $i;
2210 @unlink($sFileName);
2212 move_uploaded_file($sTmpFile, CH_BLOGS_IMAGES_PATH . $sFileName .
$sExt);
2215 if (strlen(
$sExt)) {
2216 $sPathSrc = CH_BLOGS_IMAGES_PATH . $sFileName .
$sExt;
2217 $sPathDst = CH_BLOGS_IMAGES_PATH .
'%s_' . $sFileName .
$sExt;
2219 imageResize($sPathSrc, sprintf($sPathDst,
'small'), $this->iIconSize / 1,
2220 $this->iIconSize / 1);
2221 imageResize($sPathSrc, sprintf($sPathDst,
'big'), $this->iThumbSize,
2223 imageResize($sPathSrc, sprintf($sPathDst,
'browse'), $this->iBigThumbSize,
2225 imageResize($sPathSrc, sprintf($sPathDst,
'orig'), $this->iImgSize,
2228 chmod(sprintf($sPathDst,
'small'), 0644);
2229 chmod(sprintf($sPathDst,
'big'), 0644);
2230 chmod(sprintf($sPathDst,
'browse'), 0644);
2231 chmod(sprintf($sPathDst,
'orig'), 0644);
2233 $this->_oDb->performUpdatePostWithPhoto($iBlogPostID, $sFileName .
$sExt);
2239 @unlink($sTempFileName);
2250 $oTags->reparseObjTags(
'blog', $iBlogPostID);
2254 $oCategories->reparseObjTags(
'ch_blogs', $iBlogPostID);
2256 $sAlertAction = ($iPostID == 0) ?
'create' :
'edit_post';
2258 $oZ =
new ChWsbAlerts(
'ch_blogs', $sAlertAction, $iBlogPostID, $this->_iVisitorID);
2261 header(
"X-XSS-Protection: 0");
2267 $sAddingForm =
$oForm->getCode();
2270 $sCaption = ($iPostID) ? $sEditPostC : $sNewPostC;
2271 $sAddingFormVal =
'<div class="blogs-view ch-def-bc-padding">' . $sAddingForm .
'</div>';
2274 '<div class="blogs-view ch-def-bc-padding">' . $sAddingForm .
'</div>', 1) : $sAddingFormVal;
2279 if (strlen($sTagList)) {
2280 $aTags = explode($sDivider, $sTagList);
2281 foreach ($aTags
as $iKey => $sValue) {
2282 $sValue = trim($sValue,
',');
2285 $aRes[$sValue] = $sValue;
2301 $aBlogsRes = $this->_oDb->getBlogInfo($this->_iVisitorID);
2306 $iOwnerID = (int)$aBlogsRes[
'OwnerID'];
2307 if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->
isAllowedBlogView($iOwnerID)) {
2308 return $this->_oTemplate->displayAccessDenied();
2311 $sAddCategoryC =
_t(
'_Add Category');
2314 if (($this->_iVisitorID == $aBlogsRes[
'OwnerID'] && $this->_iVisitorID > 0) || $this->bAdminMode ==
true) {
2315 $sCategoryCaptionC =
_t(
'_Title');
2316 $sErrorC =
_t(
'_Error Occured');
2322 'form_attrs' => array(
2323 'name' =>
'CreateBlogPostForm',
2329 'table' =>
'sys_categories',
2331 'submit_name' =>
'add_button',
2337 'name' =>
'Category',
2338 'caption' => $sCategoryCaptionC,
2342 'params' => array(3, 128),
2343 'error' => $sErrorC,
2349 'hidden_action' => array(
2352 'value' =>
'add_category',
2354 'add_button' => array(
2356 'name' =>
'add_button',
2357 'value' => $sAddCategoryC,
2364 if (
$oForm->isSubmittedAndValid()) {
2369 'Type' =>
'ch_blogs',
2370 'Owner' => $this->_iVisitorID
2373 $iInsertedCategoryID =
$oForm->insert($aValsAdd);
2375 if ($iInsertedCategoryID >= 0) {
2381 $sRetHtml =
$oForm->getCode();
2385 $sRetHtml = $this->_oTemplate->displayAccessDenied();
2388 return DesignBoxContent($sAddCategoryC,
'<div class="blogs-view ch-def-bc-padding">' . $sRetHtml .
'</div>', 1);
2398 $iPostID = (int)
ch_get(
'id');
2400 $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
2401 $iFeaturedStatus = $this->_oDb->getFeaturedStatus($iPostID);
2403 if ((($this->_iVisitorID == $iPostOwnerID && $iPostOwnerID > 0) || $this->bAdminMode) && $iPostID > 0) {
2404 $iNewStatus = ((int)$iFeaturedStatus == 1) ?
'0' :
'1';
2405 $aUpdatingParams = array(
2406 'postID' => $iPostID,
2407 'status' => $iNewStatus
2409 $this->_oDb->performUpdateFeatureStatus($aUpdatingParams);
2410 } elseif ($this->_iVisitorID != $iPostOwnerID) {
2411 return MsgBox(
_t(
'_Access denied'));
2413 return MsgBox(
_t(
'_Error Occured'));
2425 return $this->_oTemplate->displayAccessDenied();
2430 $bNoProfileMode = (
false !==
ch_get(
'ownerID') ||
false !==
ch_get(
'blogOwnerName')) ?
false :
true;
2436 $sTagsC =
_t(
'_Tags');
2437 $sNoBlogC =
_t(
'_ch_blog_No_blogs_available');
2439 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
2441 $oTmpBlogSearch->PerformObligatoryInit($this, 4);
2442 $oTmpBlogSearch->aCurrent[
'restriction'][
'tag2'][
'value'] = $sSearchedTag;
2443 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage();
2444 if ($iMemberID > 0) {
2445 $oTmpBlogSearch->aCurrent[
'restriction'][
'owner'][
'value'] = $iMemberID;
2447 if (($iMemberID != 0 && $iMemberID == $iCheckedMemberID) || $this->
isAdmin() ==
true) {
2448 $oTmpBlogSearch->aCurrent[
'restriction'][
'activeStatus'] =
'';
2450 $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
2451 $sBlogPostsVal =
'<div class="blogs-view ch-def-bc-padding">' . $sBlogPostsVal .
'</div>';
2453 $oTmpBlogSearch->aCurrent[
'paginate'][
'page_url'] = $oTmpBlogSearch->getCurrentUrl(
'tag', 0,
2455 $sBlogPostsVal .= $oTmpBlogSearch->showPagination3();
2457 $sBlogPosts = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) : $sBlogPostsVal;
2459 $sContentSect =
DesignBoxContent($sTagsC .
' - ' . $sSearchedTag, $sBlogPostsVal, 1);
2461 if ($bNoProfileMode ==
false) {
2463 if ($iMemberID > -1) {
2464 $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
2466 $sNoBlogC =
MsgBox($sNoBlogC);
2468 <div
class=
"{$sWidthClass}">
2471 <div
class=
"clear_both"></div>
2475 $sWidthClass = ($iMemberID > 0) ?
'cls_info_left' :
'cls_res_thumb';
2477 $sRetHtml = $this->
Templater($sContentSect, $sRightSect, $sWidthClass);
2480 $sRetHtml =
MsgBox(
_t(
'_Profile Not found Ex'));
2484 <div
class=
"{$sWidthClass}">
2487 <div
class=
"clear_both"></div>
2496 $aDateParams = array();
2499 $aDateParams = explode(
'/', $sDate);
2502 require_once($this->_oConfig->getClassPath() .
'ChBlogsCalendar.php');
2503 $oCalendar =
new ChBlogsCalendar ((
int)$aDateParams[0], (
int)$aDateParams[1], $this);
2504 $oCalendar->setBlockId($iBlockID);
2505 $oCalendar->setDynamicUrl($sDynamicUrl);
2506 $sBlogPostsCalendar = $oCalendar->display($isMiniMode);
2521 $aDate = explode(
'/', $sDate);
2523 $iValue1 = (int)
$aDate[0];
2524 $iValue2 = (int)
$aDate[1];
2525 $iValue3 = (int)
$aDate[2];
2527 if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) {
2529 $this->iPostViewType = 4;
2538 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
2541 $oTmpBlogSearch->PerformObligatoryInit($this, $this->iPostViewType);
2542 $oTmpBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage();
2543 $oTmpBlogSearch->aCurrent[
'sorting'] =
'last';
2545 $oTmpBlogSearch->aCurrent[
'restriction'][
'calendar-min'] = array(
2546 'value' =>
"UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')",
2547 'field' =>
'PostDate',
2549 'no_quote_value' =>
true
2551 $oTmpBlogSearch->aCurrent[
'restriction'][
'calendar-max'] = array(
2552 'value' =>
"UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')",
2553 'field' =>
'PostDate',
2555 'no_quote_value' =>
true
2558 $sCode = $oTmpBlogSearch->displayResultBlock();
2559 $sCode = ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) ?
MsgBox(
_t(
'_Empty')) :
$sCode;
2561 $sRequest = CH_WSB_URL_ROOT .
'modules/cheetah/blogs/blogs.php?action=show_calendar_day&date=' .
"{$iValue1}/{$iValue2}/{$iValue3}" .
'&page={page}&per_page={per_page}';
2562 $oTmpBlogSearch->aCurrent[
'paginate'][
'page_url'] = $sRequest;
2564 $sPagination = $oTmpBlogSearch->showPagination3();
2567 $sRetHtmlVal = <<<EOF
2568 <div
class=
"ch-def-bc-padding">
2587 return $this->_oTemplate->displayAccessDenied();
2590 $sRetHtml = $sCreateForm =
'';
2591 $sActionsC =
_t(
'_Actions');
2592 $sPleaseCreateBlogC =
_t(
'_ch_blog_Please_create_blog');
2593 $sNoBlogC =
_t(
'_ch_blog_No_blogs_available');
2594 $sMyBlogC =
_t(
'_ch_blog_My_blog');
2595 $sNewBlogDescC =
_t(
'_ch_blog_description');
2596 $sErrorC =
_t(
'_ch_blog_create_blog_form_error');
2597 $sSubmitC =
_t(
'_Submit');
2599 $sRetHtml .=
MsgBox($sNoBlogC);
2601 if ($this->_iVisitorID || $this->
isAdmin()) {
2602 $sRetHtml =
MsgBox($sPleaseCreateBlogC);
2609 'form_attrs' => array(
2610 'name' =>
'CreateBlogForm',
2616 'table' => $this->_oConfig->sSQLBlogsTable,
2618 'submit_name' =>
'add_button',
2622 'Description' => array(
2623 'type' =>
'textarea',
2625 'name' =>
'Description',
2626 'caption' => $sNewBlogDescC,
2630 'params' => array(3, 255),
2631 'error' => $sErrorC,
2634 'pass' =>
'XssHtml',
2637 'hidden_action' => array(
2640 'value' =>
'create_blog',
2642 'add_button' => array(
2644 'name' =>
'add_button',
2645 'value' => $sSubmitC,
2652 if (
$oForm->isSubmittedAndValid()) {
2656 $aBlogsRes = $this->_oDb->getBlogInfo($iOwnID);
2659 'OwnerID' => $iOwnID
2661 $iBlogID =
$oForm->insert($aValsAdd);
2665 $sBlogAddLink = ($bUseFriendlyLinks)
2666 ? CH_WSB_URL_ROOT .
'blogs/my_page/add/'
2669 header(
'Location:' . $sBlogAddLink);
2676 $sAddingForm =
$oForm->getCode();
2679 $aVars = array(
'content' => $sAddingForm);
2680 $sAddingForm = $this->_oTemplate->parseHtmlByName(
'default_padding.html',
$aVars);
2681 $sCreateForm = ($bBox) ?
DesignBoxContent($sActionsC, $sAddingForm, 1) : $sAddingForm;
2684 $sMyBlogResult = ($bBox) ?
DesignBoxContent($sMyBlogC, $sRetHtml, 1) : $sRetHtml;
2686 return $sMyBlogResult . $sCreateForm;
2691 $sTitleC =
_t(
'_ch_blog_Administration');
2692 $sPendingC =
_t(
'_ch_blog_pending_approval');
2693 $sSettingsC =
_t(
'_Settings');
2707 $iId = $this->_oDb->getSettingsCategory();
2709 return MsgBox(
_t(
'_sys_request_page_not_found_cpt'));
2715 if (isset($_POST[
'save']) && isset($_POST[
'cat'])) {
2717 $mixedResult =
$oSettings->saveChanges($_POST);
2723 if ($mixedResult !==
true && !
empty($mixedResult)) {
2738 $iBlogID = (int)
ch_get(
'EditBlogID');
2740 $iBlogOwner = $this->_oDb->getOwnerByBlogID($iBlogID);
2741 if ((($this->_iVisitorID == $iBlogOwner && $iBlogOwner > 0) || $this->bAdminMode) && $iBlogID > 0) {
2744 $aUpdateParams = array(
2745 'blogID' => $iBlogID,
2746 'description' => $sDescription
2748 $this->_oDb->performUpdateBlog($aUpdateParams);
2750 $sBlogOwnerLink = $this->
genBlogLink(
'show_member_blog',
2751 array(
'Permalink' =>
getUsername($this->_iVisitorID),
'Link' => $this->_iVisitorID));
2752 header(
'Location:' . $sBlogOwnerLink);
2753 } elseif ($this->_iVisitorID != $iBlogOwner) {
2754 return MsgBox(
_t(
'_Access denied'));
2756 return MsgBox(
_t(
'_Error Occured'));
2768 $iBlogID = (int)
ch_get(
'DeleteBlogID');
2770 $iBlogOwner = $this->_oDb->getOwnerByBlogID($iBlogID);
2772 if ((($this->_iVisitorID == $iBlogOwner && $iBlogOwner > 0) || $this->bAdminMode) && $iBlogID > 0) {
2773 $aPostsInCategory = $this->_oDb->getPostsInCategory(1,
'', $iBlogOwner);
2774 foreach ($aPostsInCategory
as $iKeyID => $iPostID) {
2778 $this->_oDb->deleteBlog($iBlogID);
2779 } elseif ($this->_iVisitorID != $iBlogOwner) {
2780 return MsgBox(
_t(
'_Access denied'));
2782 return MsgBox(
_t(
'_Error Occured'));
2796 $iPostId = (int)$iPostId;
2798 $sViewingPostUri = $this->_oDb->getPostUriByID($iPostId);
2799 $aViewingPost = array(
'Permalink' => $sViewingPostUri,
'Link' => $this->$iPostId);
2800 $sViewingPostLink = $this->
genBlogLink(
'show_member_post',
$aUser,
'', $aViewingPost);
2801 $sEntryUrl = $this->
genBlogLink(
'show_member_post',
$aUser,
'', $aViewingPost,
'',
true);
2803 require_once(CH_DIRECTORY_PATH_INC .
'shared_sites.inc.php');
2804 header(
'Content-type:text/html;charset=utf-8');
2812 $sResJSHTML = addslashes(htmlspecialchars($sInput));
2813 $sResJSHTML = str_replace(
"\r\n",
'', $sResJSHTML);
2822 if (
false !==
ch_get(
'blogOwnerName')) {
2824 $iMemberId = $this->_oDb->getMemberIDByNickname($sNickName);
2825 } elseif (
ch_get(
'ownerID')) {
2831 $iPostID = $this->_oDb->getPostIDByUri($sPostUri);
2833 $iMemberId = $this->_oDb->getPostOwnerByID($iPostID);
2843 if (
false !==
ch_get(
'categoryUri')) {
2845 } elseif (
false !==
ch_get(
'category')) {
2854 $bEnabled = isset($this->_isPermalinkEnabled) ? $this->_isPermalinkEnabled : ($this->_isPermalinkEnabled = (
getParam(
'permalinks_blogs') ==
'on'));
2862 $sMainLink = $this->sHomeUrl . $this->_oConfig->sUserExFile;
2865 $sLink = $this->
isPermalinkEnabled() ? CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink : $sMainLink;
2873 $sMainFile = $this->_oConfig->sUserExFile;
2875 return CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink;
2878 return $this->sHomeUrl . $sMainFile;
2884 $aCategory = array(),
2890 $aService = array();
2892 $sKey =
'Permalink';
2894 $aService[
'User'] =
'';
2895 $aService[
'Category'] =
'category/';
2896 $aService[
'Post'] =
'';
2897 $aService[
'Tag'] =
'';
2901 $aService[
'User'] =
'ownerID=';
2902 $aService[
'Category'] =
'category=';
2903 $aService[
'Post'] =
'post_id=';
2904 $aService[
'Tag'] =
'tagKey=';
2911 $aAction = array(
'Permalink' =>
'home/',
'Link' =>
'?action=home');
2913 case 'show_member_blog_home':
2914 $aAction = array(
'Permalink' =>
'posts/{User}',
'Link' =>
'?action=show_member_blog&{User}');
2916 case 'show_member_blog':
2918 'Permalink' =>
'posts/{User}/{Category}',
2919 'Link' =>
'?action=show_member_blog&{User}&{Category}'
2922 case 'show_member_post':
2923 $aAction = array(
'Permalink' =>
'entry/{Post}',
'Link' =>
'?action=show_member_post&{User}&{Post}');
2925 case 'search_by_tag':
2928 'Permalink' =>
'posts/{User}/tag/{Tag}',
2929 'Link' =>
'?action=search_by_tag&{Tag}&{User}'
2932 $aAction = array(
'Permalink' =>
'tag/{Tag}',
'Link' =>
'?action=search_by_tag&{Tag}');
2940 $aFinal[
'User'] =
$aUser ? $aService[
'User'] .
$aUser[$sKey] :
'';
2941 $aFinal[
'Category'] = $aCategory ? $aService[
'Category'] . $aCategory[$sKey] :
'';
2942 $aFinal[
'Post'] = $aPost ? $aService[
'Post'] . $aPost[$sKey] :
'';
2943 $aFinal[
'Tag'] = strlen($sTag) > 0 ? $aService[
'Tag'] . $sTag :
'';
2945 $sLink = $aAction[$sKey];
2947 foreach ($aFinal
as $sKey => $sVal) {
2948 $sLink = str_replace(
'{' . $sKey .
'}', $sVal, $sLink);
2951 return $sMainLink . trim($sLink,
'/&');
2958 $sUrl = CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink .
"{$sType}/{$sEntryUri}";
2960 $sUrl = $this->sHomeUrl . $this->_oConfig->sUserExFile .
"?action=show_member_post&post_id={$iEntryId}";
2968 $aBlogVariables = array(
2969 'member_section' => $sRightSect,
2970 'post_section' => $sPostsSect
2972 $sRetHtml = $this->_oTemplate->parseHtmlByTemplateName(
'blog', $aBlogVariables);
2987 'orderby' =>
'popular'
2989 $sLink = $this->
isPermalinkEnabled() ? CH_WSB_URL_ROOT .
'blogs/' .
'tags' : CH_WSB_URL_ROOT .
'modules/cheetah/blogs/blogs.php?action=tags';
2992 return $oTags->getCode();
3003 return $this->_oTemplate->displayAccessDenied();
3017 return $this->_oTemplate->displayAccessDenied();
3020 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
3022 $oBlogSearch->PerformObligatoryInit($this, 4);
3023 $oBlogSearch->aCurrent[
'paginate'][
'perPage'] = (
$iPerPage > 0 ?
$iPerPage : $this->_oConfig->getPerPage(
'index'));
3028 $oBlogSearch->aCurrent[
'restriction'][
'allow_view'][
'value'] = $aVis;
3029 $sCode = $oBlogSearch->displayResultBlock();
3030 $sPostPagination = $oBlogSearch->showPagination2(
false, $this->
genBlogLink(
'home'), $bShortPgn);
3032 if ($oBlogSearch->aCurrent[
'paginate'][
'totalNum'] > 0) {
3035 return array($sCodeBlock,
false, $sPostPagination);
3049 return $this->_oTemplate->displayAccessDenied();
3052 $GLOBALS[
'oTopMenu']->setCurrentProfileID($_iProfileID);
3054 require_once($this->_oConfig->getClassPath() .
'ChBlogsSearchUnit.php');
3056 $oBlogSearch->PerformObligatoryInit($this, 4);
3057 $oBlogSearch->aCurrent[
'paginate'][
'perPage'] = $this->_oConfig->getPerPage(
'profile');
3058 $oBlogSearch->aCurrent[
'restriction'][
'owner'][
'value'] = $_iProfileID;
3060 $sCode = $oBlogSearch->displayResultBlock();
3062 if ($oBlogSearch->aCurrent[
'paginate'][
'totalNum']) {
3064 <div
class=
"ch-def-bc-padding">
3080 $iPID = (int)
ch_get(
'pid');
3081 $aRssUnits = $this->_oDb->getMemberPostsRSS($iPID);
3082 if (is_array($aRssUnits) && count($aRssUnits) > 0) {
3084 foreach ($aRssUnits
as $iUnitID => $aUnitInfo) {
3085 $iPostID = (int)$aUnitInfo[
'UnitID'];
3086 $aPost = array(
'Permalink' => $aUnitInfo[
'UnitUri'],
'Link' => $iPostID);
3089 $aRssUnits[$iUnitID][
'UnitLink'] = $sPostLink;
3091 $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
3092 $sPostPhoto = ($sFileName !=
'') ? CH_BLOGS_IMAGES_URL .
'orig_' . $sFileName :
'';
3093 $aRssUnits[$iUnitID][
'UnitIcon'] = $sPostPhoto;
3096 $sUnitTitleC =
_t(
'_ch_blog_Blogs');
3097 $sMainLink =
'rss_factory.php?action=blogs&pid=' . $iPID;
3101 $oRssFactory->SetRssHeader();
3102 echo $oRssFactory->GenRssByData($aRssUnits, $sUnitTitleC, $sMainLink);
3114 $this->_oTemplate->addCss(
'blogs_common.css');
3126 $sPostsCnt = $this->_oDb->getMemberPostsCnt($this->_iVisitorID);
3131 'item_img_src' =>
'book',
3132 'item_img_alt' =>
_t(
'_ch_blog_Posts'),
3133 'item_link' => $this->
genBlogLink(
'show_member_blog_home',
$aUser,
'',
'',
'',
true),
3134 'item_title' =>
_t(
'_ch_blog_Posts'),
3135 'extra_info' => $sPostsCnt,
3154 'item_img_src' =>
'book',
3155 'item_img_alt' =>
_t(
'_ch_blog_post'),
3156 'item_link' => CH_WSB_URL_ROOT . (
getParam(
'permalinks_blogs') ==
'on' ?
'blogs/my_page/add/' :
'modules/cheetah/blogs/blogs.php?action=my_page&mode=add'),
3157 'item_title' =>
_t(
'_ch_blog_post'),
3170 return $this->_oDb->getMemberPostsCnt((
int)
$iMemberId);
3182 $this->bAdminMode =
true;
3183 $aPostsInCategory = $this->_oDb->getPostsInCategory(1,
'',
$iProfileId);
3184 foreach ($aPostsInCategory
as $iKeyID => $iPostID) {
3187 $aBlogInfo = $this->_oDb->getBlogInfo(
$iProfileId);
3188 $this->_oDb->deleteBlog((
int)$aBlogInfo[
'ID']);
3195 $sUri = $this->_oConfig->getUri();
3199 'handlers' => array(
3202 'alert_action' =>
'create',
3203 'module_uri' => $sUri,
3204 'module_class' =>
'Module',
3205 'module_method' =>
'get_wall_post',
3213 'alert_action' =>
'comment_add',
3214 'module_uri' => $sUri,
3215 'module_class' =>
'Module',
3216 'module_method' =>
'get_wall_add_comment',
3226 'alert_action' =>
'commentPost',
3227 'module_uri' => $sUri,
3228 'module_class' =>
'Module',
3229 'module_method' =>
'get_wall_post_comment',
3237 array(
'unit' =>
$sName,
'action' =>
'create')
3248 $aObjectIds = strpos($aEvent[
'object_id'],
',') !==
false ? explode(
',',
3249 $aEvent[
'object_id']) : array($aEvent[
'object_id']);
3254 foreach ($aObjectIds
as $iId) {
3255 $aItem = $this->_oDb->getPostInfo(
$iId);
3256 if (
empty($aItem)) {
3259 if ($aItem[
'PostStatus'] ==
'approval' && $this->oPrivacy->check(
'view', $aItem[
'PostID'],
3267 if ($iDeleted == count($aObjectIds)) {
3268 return array(
'perform_delete' =>
true);
3272 if(!
empty($aEvent[
'owner_id']))
3273 $iOwner = (int)$aEvent[
'owner_id'];
3276 if(!
empty($aEvent[
'date']))
3277 $iDate = (
int)$aEvent[
'date'];
3279 $bItems = !
empty($aItems) && is_array($aItems);
3280 if($iOwner == 0 && $bItems && !
empty($aItems[0][
'OwnerID']))
3281 $iOwner = (int)$aItems[0][
'OwnerID'];
3283 if(
$iDate == 0 && $bItems && !
empty($aItems[0][
'PostDate']))
3284 $iDate = (
int)$aItems[0][
'PostDate'];
3286 if($iOwner == 0 ||
empty($aItems))
3290 if ($aEvent[
'js_mode']) {
3291 $sCss = $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'),
true);
3293 $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'));
3296 $iItems = count($aItems);
3302 $aItems = array_slice($aItems, 0, 4);
3305 $aTmplItems = array();
3306 foreach ($aItems
as $aItem) {
3307 $oTmpBlogSearch =
false;
3308 $sPostUnit = $this->
_GenPosts(5, 1,
'post', array(
'id' => $aItem[
'PostID']),
'last', $oTmpBlogSearch);
3309 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
3313 $aTmplItems[] = array(
'unit' => $sPostUnit);
3317 'owner_id' => $iOwner,
3318 'title' =>
_t(
'_ch_blog_wall_added_new_title_items', $sOwner, $iItems),
3319 'description' =>
'',
3320 'content' => $sCss . $this->_oTemplate->parseHtmlByName(
'wall_post_grouped.html', array(
3321 'cpt_user_name' => $sOwner,
3322 'cpt_added_new' =>
_t(
'_ch_blog_wall_added_new_items', $iItems),
3323 'ch_repeat:items' => $aTmplItems,
3324 'post_id' => $aEvent[
'id']
3331 $aItem = $aItems[0];
3332 $aItem[
'url'] = $this->
genUrl($aItem[
'PostID'], $aItem[
'PostUri'],
'entry');
3334 $oTmpBlogSearch =
false;
3335 $sPostUnit = $this->
_GenPosts(5, 1,
'post', array(
'id' => $aItem[
'PostID']),
'last', $oTmpBlogSearch);
3336 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
3340 $sTextWallObject =
_t(
'_ch_blog_wall_object');
3343 'owner_id' => $iOwner,
3344 'title' =>
_t(
'_ch_blog_wall_added_new_title', $sOwner, $sTextWallObject),
3345 'description' => $aItem[
'PostText'],
3346 'content' => $sCss . $this->_oTemplate->parseHtmlByName(
'wall_post.html', array(
3347 'cpt_user_name' => $sOwner,
3348 'cpt_added_new' =>
_t(
'_ch_blog_wall_added_new'),
3349 'cpt_object' => $sTextWallObject,
3350 'cpt_item_url' => $aItem[
'url'],
3351 'unit' => $sPostUnit,
3352 'post_id' => $aEvent[
'id'],
3360 $iId = (int)$aEvent[
'object_id'];
3361 $iOwner = (int)$aEvent[
'owner_id'];
3362 $sOwner = $iOwner != 0 ?
getNickName($iOwner) :
_t(
'_Anonymous');
3364 $aContent = unserialize($aEvent[
'content']);
3365 if (
empty($aContent) ||
empty($aContent[
'object_id'])) {
3369 $iItem = (int)$aContent[
'object_id'];
3370 $aItem = $this->_oDb->getPostInfo($iItem);
3371 if (
empty($aItem) || !is_array($aItem)) {
3372 return array(
'perform_delete' =>
true);
3375 if (!$this->oPrivacy->check(
'view', $iItem, $this->_iVisitorID)) {
3380 $oCmts =
new ChBlogsCmts($this->_oConfig->getCommentSystemName(), $iItem);
3381 if (!$oCmts->isEnabled()) {
3385 $aComment = $oCmts->getCommentRow(
$iId);
3386 if(
empty($aComment) || !is_array($aComment))
3387 return array(
'perform_delete' =>
true);
3390 if ($aEvent[
'js_mode']) {
3391 $sCss = $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'),
true);
3393 $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'));
3396 $oTmpBlogSearch =
false;
3397 $sPostUnit = $this->
_GenPosts(5, 1,
'post', array(
'id' => $aItem[
'PostID']),
'last', $oTmpBlogSearch);
3398 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
3402 $aItem[
'url'] = $this->
genUrl($aItem[
'ID'], $aItem[
'PostUri'],
'entry');
3404 $sTextWallObject =
_t(
'_ch_blog_wall_object');
3407 'title' =>
_t(
'_ch_blog_wall_added_new_title_comment', $sOwner, $sTextWallObject),
3408 'description' => $aComment[
'cmt_text'],
3409 'content' => $sCss . $this->_oTemplate->parseHtmlByName(
'wall_post_comment.html', array(
3410 'cpt_user_name' => $sOwner,
3411 'cpt_added_new' =>
_t(
'_ch_blog_wall_added_new_comment'),
3412 'cpt_object' => $sTextWallObject,
3413 'cpt_item_url' => $aItem[
'url'],
3414 'cnt_comment_text' => $aComment[
'cmt_text'],
3415 'unit' => $sPostUnit,
3416 'post_id' => $aEvent[
'id'],
3426 $iId = (int)$aEvent[
'object_id'];
3427 $iOwner = (int)$aEvent[
'owner_id'];
3430 $aItem = $this->_oDb->getPostInfo(
$iId);
3431 if (
empty($aItem) || !is_array($aItem)) {
3432 return array(
'perform_delete' =>
true);
3435 if (!$this->oPrivacy->check(
'view',
$iId, $this->_iVisitorID)) {
3439 $aContent = unserialize($aEvent[
'content']);
3440 if (
empty($aContent) || !isset($aContent[
'comment_id'])) {
3445 $oCmts =
new ChBlogsCmts($this->_oConfig->getCommentSystemName(),
$iId);
3446 if (!$oCmts->isEnabled()) {
3450 $aItem[
'url'] = $this->
genUrl($aItem[
'ID'], $aItem[
'PostUri'],
'entry');
3451 $aComment = $oCmts->getCommentRow((
int)$aContent[
'comment_id']);
3452 if(
empty($aComment) || !is_array($aComment))
3453 return array(
'perform_delete' =>
true);
3456 if ($aEvent[
'js_mode']) {
3457 $sCss = $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'),
true);
3459 $this->_oTemplate->addCss(array(
'wall_post.css',
'wall_post_phone.css',
'blogs_common.css'));
3462 $oTmpBlogSearch =
false;
3463 $sPostUnit = $this->
_GenPosts(5, 1,
'post', array(
'id' => $aItem[
'PostID']),
'last', $oTmpBlogSearch);
3464 if ($oTmpBlogSearch->aCurrent[
'paginate'][
'totalNum'] == 0) {
3468 $sTextWallObject =
_t(
'_ch_blog_wall_object');
3471 'title' =>
_t(
'_ch_blog_wall_added_new_title_comment', $sOwner, $sTextWallObject),
3472 'description' => $aComment[
'cmt_text'],
3473 'content' => $sCss . $this->_oTemplate->parseHtmlByName(
'wall_post_comment.html', array(
3474 'cpt_user_name' => $sOwner,
3475 'cpt_added_new' =>
_t(
'_ch_blog_wall_added_new_comment'),
3476 'cpt_object' => $sTextWallObject,
3477 'cpt_item_url' => $aItem[
'url'],
3478 'cnt_comment_text' => $aComment[
'cmt_text'],
3479 'unit' => $sPostUnit,
3480 'post_id' => $aEvent[
'id'],
3487 $sPrefix =
'ch_' . $this->_oConfig->getUri();
3493 $aObjectIds = strpos($aEvent[
'object_id'],
',') !==
false ? explode(
',',
3494 $aEvent[
'object_id']) : array($aEvent[
'object_id']);
3497 $iItems = count($aObjectIds);
3499 if ($iItems > $iItemsLimit) {
3500 $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
3504 $aContent = array();
3505 if (!
empty($aEvent[
'content'])) {
3506 $aContent = unserialize($aEvent[
'content']);
3509 if (!isset($aContent[
'idims'])) {
3510 $aContent[
'idims'] = array();
3514 $aItems = $aTmplItems = array();
3515 foreach ($aObjectIds
as $iId) {
3516 $aItem = $this->_oDb->getPostInfo(
$iId);
3517 if (
empty($aItem)) {
3520 if ($aItem[
'PostStatus'] ==
'approval' && $this->oPrivacy->check(
'view', $aItem[
'PostID'],
3523 $aItem[
'thumb_file'] =
'';
3524 $aItem[
'thumb_dims'] = array();
3525 if (!
empty($aItem[
'PostPhoto'])) {
3526 $aItem[
'thumb_file'] = CH_BLOGS_IMAGES_URL .
'browse_' . $aItem[
'PostPhoto'];
3527 $aItem[
'thumb_file_path'] = CH_BLOGS_IMAGES_PATH .
'browse_' . $aItem[
'PostPhoto'];
3528 if (!file_exists($aItem[
'thumb_file_path'])) {
3529 $aItem[
'thumb_file'] = CH_BLOGS_IMAGES_URL .
'big_' . $aItem[
'PostPhoto'];
3530 $aItem[
'thumb_file_path'] = CH_BLOGS_IMAGES_PATH .
'big_' . $aItem[
'PostPhoto'];
3533 if (!isset($aContent[
'idims'][
$iId])) {
3534 $sPath = file_exists($aItem[
'thumb_file_path']) ? $aItem[
'thumb_file_path'] : $aItem[
'thumb_file'];
3539 $aItem[
'thumb_dims'] = $aContent[
'idims'][
$iId];
3541 $aItem[
'thumb_file_2x'] = CH_BLOGS_IMAGES_URL .
'orig_' . $aItem[
'PostPhoto'];
3542 $aItem[
'thumb_file_2x_path'] = CH_BLOGS_IMAGES_PATH .
'orig_' . $aItem[
'PostPhoto'];
3545 $aItem[
'PostUrl'] = $this->
genUrl($aItem[
'PostID'], $aItem[
'PostUri'],
'entry');
3548 $aTmplItems[] = array(
3549 'mod_prefix' => $sPrefix,
3550 'item_width' => isset($aItem[
'thumb_dims'][
'w']) ? $aItem[
'thumb_dims'][
'w'] : $this->iThumbSize,
3551 'item_height' => isset($aItem[
'thumb_dims'][
'h']) ? $aItem[
'thumb_dims'][
'h'] : $this->iThumbSize,
3552 'item_icon' => $aItem[
'thumb_file'],
3553 'item_icon_2x' => $aItem[
'thumb_file_2x'],
3554 'item_page' => $aItem[
'PostUrl'],
3555 'item_title' => $aItem[
'PostCaption'],
3556 'item_description' =>
strmaxtextlen($aItem[
'PostText'], 300),
3562 if ($iDeleted == count($aObjectIds)) {
3563 return array(
'perform_delete' =>
true);
3566 if (
empty($aItems)) {
3572 $aResult[
'save'][
'content'] = serialize($aContent);
3576 if ($aEvent[
'js_mode']) {
3577 $sCss = $this->_oTemplate->addCss(array(
'wall_outline.css'),
true);
3579 $this->_oTemplate->addCss(array(
'wall_outline.css'));
3582 $iItems = count($aItems);
3583 $iOwner = (int)$aEvent[
'owner_id'];
3588 $iItems = count($aItems);
3590 $sTmplName =
'wall_outline_grouped.html';
3591 $aResult[
'content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array(
3592 'mod_prefix' => $sPrefix,
3593 'mod_icon' =>
'book',
3594 'user_name' => $sOwner,
3595 'user_link' => $sOwnerLink,
3596 'ch_repeat:items' => $aTmplItems,
3597 'item_comments' => 0 ?
_t(
'_wall_n_comments', 0) :
_t(
'_wall_no_comments'),
3598 'item_comments_link' =>
'',
3599 'post_id' => $aEvent[
'id'],
3600 'post_ago' => $aEvent[
'ago']
3607 $aItem = $aItems[0];
3608 $aTmplItem = $aTmplItems[0];
3610 $sTmplName =
empty($aItem[
'thumb_file']) ?
'modules/cheetah/wall/|outline_item_text.html' :
'modules/cheetah/wall/|outline_item_image.html';
3611 $aResult[
'content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array(
3612 'mod_prefix' => $sPrefix,
3613 'mod_icon' =>
'book',
3614 'user_name' => $sOwner,
3615 'user_link' => $sOwnerLink,
3616 'item_comments' => (
int)$aItem[
'CommentsCount'] > 0 ?
_t(
'_wall_n_comments',
3617 $aItem[
'CommentsCount']) :
_t(
'_wall_no_comments'),
3618 'item_comments_link' => $aItem[
'PostUrl'] .
'#cmta-' . $sPrefix .
'-' . $aItem[
'PostID'],
3619 'post_id' => $aEvent[
'id'],
3620 'post_ago' => $aEvent[
'ago']
3634 'handlers' => array(
3636 'alert_unit' =>
'ch_blogs',
3637 'alert_action' =>
'create',
3638 'module_uri' =>
'blogs',
3639 'module_class' =>
'Module',
3640 'module_method' =>
'get_spy_post'
3643 'alert_unit' =>
'ch_blogs',
3644 'alert_action' =>
'rate',
3645 'module_uri' =>
'blogs',
3646 'module_class' =>
'Module',
3647 'module_method' =>
'get_spy_post'
3650 'alert_unit' =>
'ch_blogs',
3651 'alert_action' =>
'commentPost',
3652 'module_uri' =>
'blogs',
3653 'module_class' =>
'Module',
3654 'module_method' =>
'get_spy_post'
3658 array(
'unit' =>
'ch_blogs',
'action' =>
'create'),
3659 array(
'unit' =>
'ch_blogs',
'action' =>
'rate'),
3660 array(
'unit' =>
'ch_blogs',
'action' =>
'delete_post'),
3661 array(
'unit' =>
'ch_blogs',
'action' =>
'commentPost'),
3662 array(
'unit' =>
'ch_blogs',
'action' =>
'commentRemoved')
3680 $aPostInfo = $this->_oDb->getPostInfo($iObjectId);
3681 if (!$aPostInfo[
'OwnerID']) {
3685 $sRecipientNickName =
getNickName($aPostInfo[
'OwnerID']);
3687 $sSenderNickName = $iSenderId ?
getNickName($iSenderId) :
_t(
'_Guest');
3688 $sSenderProfileLink = $iSenderId ?
getProfileLink($iSenderId) :
'javascript:void(0)';
3690 $sEntryUrl = $this->
genUrl($iObjectId, $aPostInfo[
'PostUri']);
3696 $sLangKey =
'_ch_blog_added_spy';
3701 $sLangKey =
'_ch_blog_rated_spy';
3702 $iRecipientId = $aPostInfo[
'OwnerID'];
3705 case 'commentPost' :
3706 $sLangKey =
'_ch_blog_commented_spy';
3707 $iRecipientId = $aPostInfo[
'OwnerID'];
3712 'lang_key' => $sLangKey,
3714 'recipient_p_link' => $sRecipientProfileLink,
3715 'recipient_p_nick' => $sRecipientNickName,
3716 'profile_nick' => $sSenderNickName,
3717 'profile_link' => $sSenderProfileLink,
3718 'post_url' => $sEntryUrl,
3721 'recipient_id' => $iRecipientId,
3722 'spy_type' =>
'content_activity',
3731 $aPostInfo = $this->_oDb->getPostInfo($iBPostID);
3739 $oTags->reparseObjTags(
'blog', $iBPostID);
3744 $oCategories->reparseObjTags(
'ch_blogs', $iBPostID);
3746 $oZ =
new ChWsbAlerts(
'ch_blogs', $isApprove ?
'approve' :
'disapprove', $iBPostID, $this->_iVisitorID);