Cheetah
ChBlogsModule.php
Go to the documentation of this file.
1 <?php
2 
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');
12 
13 ch_import('ChTemplCmtsView');
14 ch_import('ChWsbPaginate');
15 ch_import('ChWsbCategories');
16 ch_import('ChWsbModule');
17 ch_import('ChWsbPageView');
18 
19 require_once('ChBlogsPrivacy.php');
20 
21 if (!defined('CH_BLOGS_IMAGES_PATH')) {
22  define('CH_BLOGS_IMAGES_PATH', CH_DIRECTORY_PATH_ROOT . "media/images/blog/");
23 }
24 
25 if (!defined('CH_BLOGS_IMAGES_URL')) {
26  define('CH_BLOGS_IMAGES_URL', CH_WSB_URL_ROOT . "media/images/blog/");
27 }
28 
30 {
31  var $oBlogs;
32 
33  function __construct(&$oBlogs)
34  {
35  $this->oBlogs = &$oBlogs;
36  parent::__construct('ch_blogs');
37  }
38 
40  {
41  return $this->oBlogs->getActionsBlock();
42  }
43 
45  {
46  return $this->oBlogs->getRateBlock();
47  }
48 
50  {
51  return array($this->oBlogs->getPostOverviewBlock());
52  }
53 
55  {
56  return $this->oBlogs->getPostCategoriesBlock();
57  }
58 
60  {
61  return $this->oBlogs->getPostFeatureBlock();
62  }
63 
65  {
66  return $this->oBlogs->getPostTagsBlock();
67  }
68 
70  {
71  return $this->oBlogs->getCommentsBlock();
72  }
73 
75  {
76  return $this->oBlogs->getBlogPostBlock();
77  }
78 
80  {
81  return $this->oBlogs->getPostSocialSharingBlock();
82  }
83 }
84 
190 {
191  //variables
192 
193  //max sizes of pictures for resizing during upload
198 
199  //admin mode, can All actions
201 
202  //path to spacer image
204 
206 
210 
213 
217 
218  // Constructor
220  {
221  parent::__construct($aModule);
222 
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');
227 
228  $this->sHomeUrl = $this->_oConfig->getHomeUrl();
229  $this->sHomePath = $this->_oConfig->getHomePath();
230 
231  $this->_iVisitorID = isLogged() ? getLoggedId() : 0;
232 
233  //temple
234  $this->bAdminMode = $this->isAdmin() == true;
235 
236  $this->iPostViewType = 1;
237  $this->iViewingPostID = -1;
238  $this->iLastPostedPostID = -1;
239  $this->aViewingPostInfo = array();
240 
241  $this->sSpacerPath = getTemplateIcon('spacer.gif');
242 
243  $this->_sPageHeader = '';
244 
245  $this->oPrivacy = new ChBlogsPrivacy($this);
246  }
247 
248  function CheckLogged()
249  {
250  if (!getLoggedId()) {
251  member_auth(0);
252  }
253  }
254 
260  function GetHeaderString()
261  {
262  switch (ch_get('action')) {
263  case 'home':
264  $sCaption = _t('_ch_blog_Blogs_Home');
265  break;
266  case 'all':
267  $sCaption = _t('_ch_blog_All_Blogs');
268  break;
269  case 'tags':
270  $sCaption = _t('_Tags');
271  break;
272  case 'all_posts':
273  $sCaption = _t('_ch_blog_All_Posts');
274  break;
275  case 'top_posts':
276  $sCaption = _t('_ch_blog_Top_Posts');
277  break;
278  case 'popular_posts':
279  $sCaption = _t('_ch_blog_Popular_Posts');
280  break;
281  case 'featured_posts':
282  $sCaption = _t('_ch_blog_Featured_Posts');
283  break;
284  /*case 'show_categories':
285  $sCaption = _t('_ch_blog_Categories');
286  break;*/
287  case 'show_calendar':
288  $sCaption = _t('_ch_blog_Calendar');
289  break;
290  case 'show_calendar_day' :
291  $sDate = ch_get('date');
292  $aDate = explode('/', $sDate);
293 
294  $iValue1 = (int)$aDate[0];
295  $iValue2 = (int)$aDate[1];
296  $iValue3 = (int)$aDate[2];
297 
298  $sCaption = _t('_ch_blog_caption_browse_by_day')
299  . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}")
301  break;
302  case 'add_category':
303  $sCaption = _t('_Add Category');
304  break;
305  case 'new_post':
306  $sCaption = _t('_Add Post');
307  break;
308  case 'show_member_blog':
309  $sCaption = _t('_ch_blog_My_blog');
310  $iMemberID = $this->defineUserId();
311  if (!$iMemberID) {
312  $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_sys_request_page_not_found_cpt'));
313  $GLOBALS['oSysTemplate']->displayPageNotFound();
314  } else {
315  $sUser = getNickName($iMemberID);
316  $sAsBlog = _t('_ch_blog_Members_blog', $sUser);
317  }
318  //$GLOBALS['oTopMenu']->setCustomSubHeader($sAsBlog);
319  $sCaption = $sAsBlog;
320  break;
321  case 'edit_post':
322  $sCaption = _t('_Post');
323  if (false !== ch_get('EditPostID')) {
324  $iPostID = (int)ch_get('EditPostID');
325  $sCaption = htmlspecialchars($this->_oDb->getPostCaptionByID($iPostID));
326  }
327  break;
328  case 'show_member_post':
329  $sCaption = _t('_Post');
330  if (false !== ch_get('postUri')) {
331  $sPostUri = process_db_input(ch_get('postUri'), CH_TAGS_STRIP);
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);
336  }
337  if ($sPostCapt != '') {
338  $sCaption = htmlspecialchars($sPostCapt);
339  }
340  break;
341  case 'search_by_tag':
342  $sCaption = _t('_Search result');
343  break;
344  case 'my_page':
345  switch (ch_get('mode')) {
346  case 'add':
347  $sCaption = _t('_ch_blog_Add') . ' ' . _t('_Post');
348  break;
349  case 'manage':
350  $sCaption = _t('_ch_blog_Manage');
351  break;
352  case 'pending':
353  $sCaption = _t('_ch_blog_pending_approval');
354  break;
355  default:
356  $sCaption = _t('_ch_blog_My_blog');
357  break;
358  }
359  break;
360  default:
361  $sCaption = _t('_ch_blog_Blogs');
362  break;
363  }
364  $this->_sPageHeader = $sCaption;
365 
366  return $sCaption;
367  }
368 
374  function GenCommandForms()
375  {
376  $this->_oTemplate->addJs('main.js');
377  }
378 
379  // ================================== permissions
380  function isAllowedComments(&$aBlogPost)
381  {
382  if (($aBlogPost['OwnerID'] == $this->_iVisitorID && isMember()) || $this->isAdmin()) {
383  return true;
384  }
385 
386  return $this->oPrivacy->check('comment', $aBlogPost['PostID'], $this->_iVisitorID);
387  }
388 
389  function isAllowedCreatorCommentsDeleteAndEdit(&$aBlogPost, $isPerformAction = false)
390  {
391  if ($this->isAdmin()) {
392  return true;
393  }
394  if (!isMember() || $aBlogPost['OwnerID'] != $this->_iVisitorID) {
395  return false;
396  }
397  $this->_defineActions();
398  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POSTS_COMMENTS_DELETE_AND_EDIT, $isPerformAction);
399 
401  }
402 
403  function isAllowedBlogView($iOwnerID, $isPerformAction = false)
404  {
405  if ($this->isAdmin() || $iOwnerID == $this->_iVisitorID) {
406  return true;
407  }
408  $this->_defineActions();
409  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_VIEW, $isPerformAction);
410 
412  }
413 
414  function isAllowedBlogPostView($iOwnerID, $isPerformAction = false)
415  {
416  if ($this->isAdmin() || $iOwnerID == $this->_iVisitorID) {
417  return true;
418  }
419  $this->_defineActions();
420  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POST_VIEW, $isPerformAction);
421 
423  }
424 
425  function isAllowedBlogsBrowse($isPerformAction = false)
426  {
427  if ($this->isAdmin()) {
428  return true;
429  }
430  $this->_defineActions();
431  $aCheck = checkAction($this->_iVisitorID, CH_BLOGS_BROWSE, $isPerformAction);
432 
434  }
435 
436  function isAllowedBlogsPostsBrowse($isPerformAction = false)
437  {
438  if ($this->isAdmin()) {
439  return true;
440  }
441  $this->_defineActions();
442  $aCheck = checkAction($this->_iVisitorID, CH_BLOGS_POSTS_BROWSE, $isPerformAction);
443 
445  }
446 
447  function isAllowedBlogPostSearch($isPerformAction = false)
448  {
449  if ($this->isAdmin()) {
450  return true;
451  }
452  $this->_defineActions();
453  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POST_SEARCH, $isPerformAction);
454 
456  }
457 
458  function isAllowedPostAdd($isPerformAction = false)
459  {
460  if ($this->isAdmin()) {
461  return true;
462  }
463  if (isMember() == false) {
464  return false;
465  }
466  $this->_defineActions();
467  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POST_ADD, $isPerformAction);
468 
470  }
471 
472  function isAllowedPostEdit($iOwnerID, $isPerformAction = false)
473  {
474  if ($this->isAdmin() || (isMember() && $iOwnerID == $this->_iVisitorID)) {
475  return true;
476  }
477  $this->_defineActions();
478  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POSTS_EDIT_ANY_POST, $isPerformAction);
479 
481  }
482 
483  function isAllowedPostDelete($iOwnerID, $isPerformAction = false)
484  {
485  if ($this->isAdmin() || (isMember() && $iOwnerID == $this->_iVisitorID)) {
486  return true;
487  }
488  $this->_defineActions();
489  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POSTS_DELETE_ANY_POST, $isPerformAction);
490 
492  }
493 
494  function isAllowedApprove($isPerformAction = false)
495  {
496  if ($this->isAdmin()) {
497  return true;
498  }
499  if (isMember() == false) {
500  return false;
501  }
502  $this->_defineActions();
503  $aCheck = checkAction($this->_iVisitorID, CH_BLOG_POSTS_APPROVING, $isPerformAction);
504 
506  }
507 
508  function isAllowedShare(&$aDataEntry)
509  {
510  if ($aDataEntry['allowView'] != CH_WSB_PG_ALL) {
511  return false;
512  }
513 
514  return true;
515  }
516 
517  function isAdmin()
518  {
519  return isAdmin($this->_iVisitorID) || isModerator($this->_iVisitorID);
520  }
521 
522  function _defineActions()
523  {
525  'blog view',
526  'blog post view',
527  'blogs browse',
528  'blogs posts browse',
529  'blog post search',
530  'blog post add',
531  'blog posts edit any post',
532  'blog posts delete any post',
533  'blog posts approving',
534  'blog posts comments delete and edit'
535  ));
536  }
537 
538  function GenBlogAdminIndex()
539  {
540  if ($this->bAdminMode) {
541  //actions
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')) {
545  $this->onPostApproveDisapprove($iBPostID, true);
546  }
547  }
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)) {
551  $this->onPostApproveDisapprove($iBPostID, false);
552  }
553  }
554  } elseif (ch_get('action_delete') && is_array(ch_get('bposts'))) {
555  foreach (ch_get('bposts') as $iBPostID) {
556  $this->ActionDeletePost((int)$iBPostID);
557  }
558  }
559 
560  $sPostLink = $this->sHomeUrl . $this->_oConfig->sAdminExFile;
561 
562  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
563  $oBlogSearch = new ChBlogsSearchUnit();
564  $oBlogSearch->PerformObligatoryInit($this, 4);
565  $oBlogSearch->aCurrent['restriction']['activeStatus'] = array(
566  'value' => 'disapproval',
567  'field' => 'PostStatus',
568  'operator' => '='
569  );
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;
574 
575  $sAdmPanel = $oBlogSearch->showAdminActionsPanel('bposts_box', array(
576  'action_approve' => '_Approve',
577  'action_disapprove' => '_Disapprove',
578  'action_delete' => '_Delete'
579  ), 'bposts');
580 
581  $oBlogSearch->aCurrent['paginate']['page_url'] = $sPostLink;
582  $sPostPagination = $oBlogSearch->showPagination3();
583 
584  $aVariables = array(
585  'admin_page' => $sPostLink,
586  'units' => $sPosts,
587  'paginate' => $sPostPagination,
588  'admin_panel' => $sAdmPanel,
589  );
590 
591  return $this->_oTemplate->parseHtmlByTemplateName('admin_page', $aVariables);
592  }
593  }
594 
595  function GenBlogHome()
596  {
597  ch_import('PageHome', $this->_aModule);
598  $oHomePageView = new ChBlogsPageHome($this);
599 
600  return $oHomePageView->getCode();
601  }
602 
609  function GenBlogLists($sType = '', $bBlock = true)
610  {
611  if (!$this->isAllowedBlogsBrowse()) {
612  return $this->_oTemplate->displayAccessDenied();
613  }
614 
615  // lang keys
616  $sPostsC = _t('_ch_blog_Posts');
617  $sNoBlogsC = _t('_Empty');
618  $sAllBlogsC = _t('_ch_blog_All_Blogs');
619  $sTopBlogsC = _t('_ch_blog_Top_Blogs');
620 
621  $iCheckedMemberID = $this->_iVisitorID;
622 
624  //number elements for per page
625  $iPerPage = (false !== ch_get('per_page')) ? (int)ch_get('per_page') : 10;
626 
627  if ($iPerPage > 100) {
628  $iPerPage = 100;
629  }
630 
631  $iCurPage = (false !== ch_get('page')) ? (int)ch_get('page') : 1;
632  if ($iCurPage < 1) {
633  $iCurPage = 1;
634  }
635  $sLimitFrom = ($iCurPage - 1) * $iPerPage;
636  $sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
638  $sCaption = $sAllBlogsC;
639 
640  $sStatusFilter = ($this->isAdmin() == true
641  || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1)
642  || $this->isAllowedPostDelete(-1))
643  ? '1'
644  : "`PostStatus`='approval'";
645 
646  switch ($sType) {
647  case 'top':
648  $vBlogsRes = $this->_oDb->getTopBlogs($sStatusFilter, $sqlLimit);
649  $sCaption = $sTopBlogsC;
650  break;
651  case 'last':
652  default:
653  $vBlogsRes = $this->_oDb->getLastBlogs($sStatusFilter, $sqlLimit);
654  break;
655  }
656 
657  $iTotalBlogs = $this->_oDb->getAllBlogsCnt($sStatusFilter);
658 
659  // process database queries
660  $iTotalNum = $vBlogsRes->rowCount();
661  if ($iTotalNum == 0) {
662  $sCode = MsgBox($sNoBlogsC);
663 
664  return $bBlock ? DesignBoxContent($sCaption, $sCode, 1) : $sCode;
665  }
666 
667  $iGenPostsCnt = 0;
668  while ($aBlogsRes = $vBlogsRes->fetch()) {
669  if ($aBlogsRes['PostCount'] == 0 && $sType == 'top') //in Top blogs skip posts with 0 comments
670  {
671  continue;
672  }
673 
674  $aOwnerInfo = getProfileInfo($aBlogsRes['OwnerID']);
675  $sOwnerNickname = getNickName($aBlogsRes['OwnerID']);
676  if ($aBlogsRes['OwnerID'] == 0) {
677  $sOwnerNickname = _t('_Admin');
678  }
679  if ($sOwnerNickname) {
680  $sCont = get_member_thumbnail($aBlogsRes['OwnerID'], 'left');
681  $sBlogOwnerLink = $this->genBlogLink('show_member_blog',
682  array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $aBlogsRes['OwnerID']));
683  $sDescription = htmlspecialchars(strip_tags($aBlogsRes['Description']));
684 
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
691  );
692  $sRetHtml .= $this->_oTemplate->parseHtmlByTemplateName('blog_unit', $aBlogUnitVariables);
693 
694  $iGenPostsCnt++;
695  }
696  }
697 
699  if ($this->isPermalinkEnabled() == false) {
700  $sRequest = ch_html_attribute($_SERVER['PHP_SELF']) . '?action=top_blogs&page={page}&per_page={per_page}';
701  } else {
702  $sRequest = (ch_get('action') == 'top_blogs')
703  ? CH_WSB_URL_ROOT . 'blogs/top/'
704  : CH_WSB_URL_ROOT . 'blogs/all/';
705 
706  $sRequest .= '{per_page}/{page}' . $sPaginAddon;
707  }
709  $oPaginate = new ChWsbPaginate
710  (
711  array
712  (
713  'page_url' => $sRequest,
714  'count' => $iTotalBlogs,
715  'per_page' => $iPerPage,
716  'page' => $iCurPage,
717  )
718  );
719 
720  $sPagination = $oPaginate->getPaginate();
721 
722  $sRetHtmlVal = <<<EOF
723 <div class="ch-def-bc-padding">
724  {$sRetHtml}
725 </div>
726 {$sPagination}
727 EOF;
728 
729  return $bBlock ? DesignBoxContent($sCaption, $sRetHtmlVal, 1) : $sRetHtmlVal;
730  }
731 
739  function GenPostListMobile($iAuthor = 0, $sMode = false)
740  {
741  if ($this->_iVisitorID) // some workaround for mobile apps, to force login
742  {
743  ch_login($this->_iVisitorID);
744  }
745 
746  ch_import('ChWsbMobileTemplate');
747  $oMobileTemplate = new ChWsbMobileTemplate($this->_oConfig, $this->_oDb);
748  $oMobileTemplate->pageStart();
749  echo $oMobileTemplate->addCss('blogs_common.css', 1);
750 
751  $iPerPage = 10;
752  $iPage = (int)ch_get('page');
753  if ($iPage < 1) {
754  $iPage = 1;
755  }
756 
757  $this->iPostViewType = 4;
758 
759  $sOrder = 'last';
760  $sMobileWrapper = 'mobile_row.html';
761  $aParams = array();
762  switch ($sMode) {
763  case 'post':
764  $aViewingPostInfo = $this->_oDb->getPostInfo((int)ch_get('id'));
765  if (!$this->oPrivacy->check('view', (int)ch_get('id'),
766  $this->_iVisitorID) || !$this->isAllowedBlogPostView($aViewingPostInfo['OwnerID'], true)
767  ) {
768  $oMobileTemplate->displayAccessDenied($sCaption);
769 
770  return;
771  }
772  $this->iPostViewType = 3;
773  $aParams = array('id' => (int)ch_get('id'));
774  $sCaption = _t('_ch_blog_post_view');
775  $sMobileWrapper = 'mobile_box.html';
776  echo $oMobileTemplate->addCss('blogs.css', 1);
777  break;
778  case 'user':
779  $aParams = array('id' => (int)ch_get('id'));
780  $sCaption = _t('_ch_blog_Members_blog', getNickName((int)ch_get('id')));
781  break;
782  case 'featured':
783  $sCaption = _t('_ch_blog_Featured_Posts');
784  break;
785  case 'top':
786  $sOrder = 'top';
787  $sCaption = _t('_ch_blog_Top_Posts');
788  break;
789  case 'popular':
790  $sOrder = 'popular';
791  $sCaption = _t('_ch_blog_Popular_Posts');
792  break;
793  case 'last':
794  default:
795  $sMode = 'last';
796  $sCaption = _t('_ch_blog_Latest_posts');
797  }
798 
799  if ('post' != $sMode && !$this->isAllowedBlogsPostsBrowse()) {
800  $oMobileTemplate->displayAccessDenied($sCaption);
801 
802  return;
803  }
804 
805  $oTmpBlogSearch = false;
806  $sCode = $this->_GenPosts($this->iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, $oBlogSearchResults,
807  $sMobileWrapper);
808  if (!$sCode || $oBlogSearchResults->aCurrent['paginate']['totalNum'] == 0) {
809  $oMobileTemplate->displayNoData($sCaption);
810 
811  return;
812  }
813 
814  echo $sCode;
815 
816  if ($sMode != 'post') {
817  ch_import('ChWsbPaginate');
818  $oPaginate = new ChWsbPaginate(array(
819  'page_url' => $this->genBlogSubUrl() . '?action=mobile&mode=' . $sMode . '&page={page}',
820  'count' => $oBlogSearchResults->aCurrent['paginate']['totalNum'],
821  'per_page' => $iPerPage,
822  'page' => $iPage,
823  ));
824  echo $oPaginate->getMobilePaginate();
825  }
826 
827  $oMobileTemplate->pageCode($sCaption, false);
828  }
829 
836  function GenPostLists($sType = '', $bBlock = true)
837  {
838  $sDisplayMode = '';
839  $sTypeMode = '';
840  switch ($sType) {
841  case 'last':
842  $sDisplayMode = 'last';
843  break;
844  case 'popular':
845  $sDisplayMode = 'popular';
846  break;
847  case 'featured':
848  $sTypeMode = 'featured';
849  $sDisplayMode = 'last';
850  break;
851  case 'top':
852  default:
853  $sDisplayMode = 'top';
854  break;
855  }
856 
857  $this->iPostViewType = 4;
858 
859  $sCaption = ($this->_sPageHeader != '') ? $this->_sPageHeader : _t('_ch_blog_Top_Posts');
860 
861  if (!$this->isAllowedBlogsPostsBrowse()) {
862  return DesignBoxContent($sCaption, $this->_oTemplate->displayAccessDenied(), 1);
863  }
864 
865  $oTmpBlogSearch = false;
866  $sCode = $this->_GenPosts($this->iPostViewType, $this->_oConfig->getPerPage(), $sTypeMode, false, $sDisplayMode,
867  $oTmpBlogSearch);
868  if ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) {
869  $sCode = MsgBox(_t('_Empty'));
870  }
871 
872  $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $oTmpBlogSearch->getCurrentUrl($sType . '_posts', 0, '');
873  $sPagination = $oTmpBlogSearch->showPagination3();
874 
875  $sRetHtmlVal = <<<EOF
876 <div class="ch-def-bc-padding">
877  {$sCode}
878 </div>
879 {$sPagination}
880 EOF;
881 
882  return $bBlock ? DesignBoxContent($sCaption, $sRetHtmlVal, 1) : $sRetHtmlVal;
883  }
884 
885 
895  function _GenPosts($iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, &$oSearchResult, $sMobileWrapper = false)
896  {
897  ch_import('SearchUnit', $this->_aModule);
898 
899  $oTmpBlogSearch = new ChBlogsSearchUnit($this);
900  $oTmpBlogSearch->PerformObligatoryInit($this, $iPostViewType, $sMobileWrapper);
901  $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $iPerPage;
902  $oTmpBlogSearch->aCurrent['sorting'] = $sOrder;
903 
904  switch ($sMode) {
905  case 'user':
906  $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = (int)$aParams['id'];
907  break;
908  case 'post':
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'] = '';
912  }
913  $oTmpBlogSearch->aCurrent['paginate']['perPage'] = 1;
914  break;
915  case 'featured':
916  $oTmpBlogSearch->aCurrent['restriction']['featuredStatus']['value'] = 1;
917  break;
918  case 'category':
919  $oTmpBlogSearch->aCurrent['restriction']['category_uri']['value'] = $aParams['cat_uri'];
920  break;
921  case 'last':
922  default:
923  $oTmpBlogSearch->aCurrent['restriction']['allow_view']['value'] = $this->_iVisitorID ? array(
926  ) : array(CH_WSB_PG_ALL);
927  }
928 
929  $oSearchResult = $oTmpBlogSearch;
930 
931  return $oTmpBlogSearch->displayResultBlock();
932  }
933 
935  {
936  $sCatUri = process_db_input(ch_get('uri'), CH_TAGS_STRIP);
937  if ($sCatUri) {
938  $this->iPostViewType = 4;
939  $sCaption = $GLOBALS['MySQL']->unescape($sCatUri);
940 
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) {
945  $sCode = MsgBox(_t('_Empty'));
946  }
947 
948  $sRetHtmlVal = '<div class="ch-def-bc-padding">' . $sCode . '</div>';
949 
950  return DesignBoxContent($sCaption, $sRetHtmlVal, 1);
951  }
952  }
953 
961  function GenMemberDescrAndCat($aBlogsRes, $sCategoryName = '')
962  {
963  $sSureC = _t('_Are_you_sure');
964  $sApplyChangesC = _t('_Submit');
965 
966  $iMemberID = (int)$aBlogsRes['OwnerID'];
967  $sOwnerNickname = getNickName($iMemberID);
968 
969  $aBlogInfo = $this->_oDb->getBlogInfo($iMemberID);
970  $this->aViewingPostInfo = $aBlogInfo;
971 
972  if ($this->iViewingPostID == -1) {
973 
974  $aBlogID = (int)$aBlogInfo['ID'];
975  $sWorkLink = $this->genBlogFormUrl();
976  $sProcessingFile = $this->genBlogSubUrl();
977 
978  $aBlogActionKeys = array(
979  'visitor_id' => $this->_iVisitorID,
980  'owner_id' => $iMemberID,
981  'owner_name' => $sOwnerNickname,
982  'blog_owner_link' => '',//$sOwnerBlogLink,
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,
989  );
990 
991  $sBlogActionsVal = $GLOBALS['oFunctions']->genObjectsActions($aBlogActionKeys, 'ch_blogs_m', false);
992 
993  if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->bAdminMode == true) {
994  $aBlogDesc = $aBlogInfo['Description'];
995  $sDescrAct = $this->ActionPrepareForEdit($aBlogDesc);
996  $sBlogDescription = process_html_output($aBlogDesc);
997 
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;">
1001  <form action="{$sWorkLink}" method="post" name="EditBlogForm">
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" />
1008  </div>
1009  <div class="clear_both"></div>
1010  </form>
1011  </div>
1012 </div>
1013 EOF;
1014  }
1015  }
1016  $sBlogActionsSect = ($sBlogActionsVal != '') ? DesignBoxContent(_t('_Actions'), $sBlogActionsVal, 1) : '';
1017 
1018  $sDescriptionSect = DesignBoxContent(_t('_Overview'), $this->getPostOverviewBlock(), 1);
1019  $sCategoriesSect = $this->getPostCategoriesBlock();
1020  $sTagsSect = DesignBoxContent(_t('_Tags'), $this->getPostTagsBlock(), 1);
1021 
1022  $sFeaturedSectCont = $this->getPostFeatureBlock();
1023  $sFeaturedSect = ($sFeaturedSectCont) ? DesignBoxContent(_t('_ch_blog_Featured_Posts'),
1024  $this->getPostFeatureBlock(), 1) : '';
1025 
1026  return $sBlogActionsSect . $sActionsSect . $sDescriptionSect . $sCategoriesSect . $sFeaturedSect . $sTagsSect;
1027  }
1028 
1035  function GenMemberBlog($iUserID = 0)
1036  {
1037  $iCheckedMemberID = $this->_iVisitorID;
1038 
1039  $sRetHtml = '';
1040  $sBlogPosts = '';
1041  $iMemberID = $this->defineUserId();
1042 
1043  if ($iUserID > 0) {
1044  $iMemberID = $iUserID;
1045  }
1046 
1047  $GLOBALS['oTopMenu']->setCurrentProfileID($iMemberID);
1048 
1049  $sCategoryName = $this->defineCategoryName();
1050 
1051  $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
1052 
1053  if (!$aBlogsRes) {
1054  if (($iMemberID == $iCheckedMemberID && $iCheckedMemberID > 0) || $this->isAdmin()) {
1055  return $this->GenCreateBlogForm();
1056  } else {
1057  return DesignBoxContent($this->_sPageHeader, MsgBox(_t('_Empty')), 1);
1058  }
1059  }
1060 
1061  $iOwnerID = $aBlogsRes['OwnerID'];
1062 
1063  if(isBlocked($iOwnerID, $this->_iVisitorID)) {
1064  return MsgBox(_t('_sys_txt_error_you_are_blocked'));
1065  }
1066 
1067  if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->isAllowedBlogView($iOwnerID, true)) {
1068  return $this->_oTemplate->displayAccessDenied();
1069  }
1070 
1071  if ($aBlogsRes['OwnerID'] > 0) {
1072  $sUser = getNickName($aBlogsRes['OwnerID']);
1073  $aUserInfo = getProfileInfo($aBlogsRes['OwnerID']);
1074  } else {
1075  $sUser = _t('_Admin');
1076  $aUserInfo = array('NickName' => _t('_Admin'));
1077  }
1078  $sOwnerBlogLink = $this->genBlogLink('show_member_blog_home',
1079  array('Permalink' => $aUserInfo['NickName'], 'Link' => $aBlogsRes['OwnerID']));
1080  $sAsBlog = _t('_ch_blog_Members_blog', $sUser);
1081 
1082  $sHome = $this->genBlogFormUrl();
1083  $sCurCategory = $sCategoryName;
1084 
1085  $sBreadCrumb = ($sCurCategory != '') ? $sCurCategory : _t('_ch_blog_Latest_posts');
1086 
1087  if (!$this->isAllowedBlogsPostsBrowse()) {
1088  $sBlogPostsHtmlVal = $this->_oTemplate->displayAccessDenied();
1089  } else {
1090  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
1091  $oTmpBlogSearch = new ChBlogsSearchUnit($this);
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;
1096 
1097  if ($sCategoryName != '') {
1098 
1099  $oTmpBlogSearch->aCurrent['join']['category'] = array(
1100  'type' => 'left',
1101  'table' => 'sys_categories',
1102  'mainField' => 'PostID',
1103  'onField' => 'ID',
1104  'joinFields' => array('Category')
1105  );
1106  $oTmpBlogSearch->aCurrent['restriction']['category'] = array(
1107  'field' => 'Category',
1108  'operator' => '=',
1109  'table' => 'sys_categories',
1110  'value' => $sCategoryName
1111  );
1112  $oTmpBlogSearch->aCurrent['restriction']['category_type'] = array(
1113  'field' => 'Type',
1114  'operator' => '=',
1115  'table' => 'sys_categories',
1116  'value' => 'ch_blogs',
1117  );
1118  $oTmpBlogSearch->aCurrent['restriction']['category_owner'] = array(
1119  'field' => 'Owner',
1120  'operator' => '=',
1121  'table' => 'sys_categories',
1122  'value' => $iMemberID,
1123  );
1124  }
1125  if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->isAdmin() == true) {
1126  $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = '';
1127  }
1128  $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1129  $sBlogPostsVal = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sBlogPostsVal;
1130 
1131  // Prepare link to pagination
1132  if ($this->bUseFriendlyLinks == false || $this->bAdminMode == true) { //old variant
1133  $sCategUrlAdd = $sCategoryName ? "category={$sCategoryName}" : '';
1134  $sRequest = ch_append_url_params($sOwnerBlogLink, $sCategUrlAdd . '&page={page}&per_page={per_page}');
1135  } else {
1136  $sCategUrlAdd = $sCategoryName ? "/category/{$sCategoryName}" : '';
1137  $sRequest = ch_append_url_params($sOwnerBlogLink . $sCategUrlAdd, 'page={page}&per_page={per_page}');
1138  }
1139 
1140  // End of prepare link to pagination
1141  $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $sRequest;
1142 
1143  $sPagination = $oTmpBlogSearch->showPagination3();
1144  $sBlogPostsHtmlVal = <<<EOF
1145 <div class="ch-def-bc-padding">
1146  {$sBlogPostsVal}
1147 </div>
1148 {$sPagination}
1149 EOF;
1150  }
1151 
1152  $sPostsSect = DesignBoxContent($sBreadCrumb, $sBlogPostsHtmlVal, 1);
1153  $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes, $sCategoryName);
1154  $sRetHtml = $this->Templater($sPostsSect, $sRightSect);
1155 
1156  return $sRetHtml;
1157  }
1158 
1159  function ActionDelImg()
1160  {
1161  $this->CheckLogged();
1162 
1163  $sSuccUpdPost = _t('_ch_blog_Post_succ_updated');
1164  $sFailUpdPost = _t('_ch_blog_Post_fail_updated');
1165 
1166  $iPostID = (int)ch_get('post_id');
1167  $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
1168 
1169  if ((($this->_iVisitorID == $iPostOwnerID && $iPostOwnerID > 0) || $this->bAdminMode) && $iPostID > 0) {
1170  $sFileNameExt = '';
1171  $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
1172  if ($sFileName == '') {
1173  $sFileName = 'blog_' . $iPostID;
1174  }
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);
1181 
1182  $vSqlRes = $this->_oDb->performUpdatePostWithPhoto($iPostID);
1183  $sRet = (db_affected_rows($vSqlRes) > 0) ? _t($sSuccUpdPost) : _t($sFailUpdPost);
1184  print 1;
1185 
1186  return MsgBox($sRet);
1187  } elseif ($this->_iVisitorID != $iPostOwnerID) {
1188  print MsgBox(_t('_Access denied'));
1189 
1190  return MsgBox(_t('_Access denied'));
1191  } else {
1192  print MsgBox(_t('_Error Occured'));
1193 
1194  return MsgBox(_t('_Error Occured'));
1195  }
1196  }
1197 
1203  function ActionDeletePost($iPostID = 0)
1204  {
1205  if (!$this->bAdminMode) {
1206  $this->CheckLogged();
1207  }
1208 
1209  if ($iPostID == 0) {
1210  $iPostID = (int)ch_get('DeletePostID');
1211  }
1212 
1213  $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
1214 
1215  if (!$this->isAllowedPostDelete($iPostOwnerID)) {
1216  return $this->_oTemplate->displayAccessDenied();
1217  }
1218 
1219  if ($iPostID > 0) {
1220  $oCmts = new ChWsbCmts($this->_oConfig->getCommentSystemName(), (int)$iPostID);
1221  $oCmts->onObjectDelete();
1222 
1223  // delete votings
1224  ch_import('ChTemplVotingView');
1225  $oVoting = new ChTemplVotingView ($this->_oConfig->getRateSystemName(), $iPostID);
1226  $oVoting->deleteVotings($iPostID);
1227 
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);
1232  }
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);
1236  }
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);
1240  }
1241 
1242  $vSqlRes = $this->_oDb->deletePost($iPostID);
1243  $sRet = (db_affected_rows($vSqlRes) > 0) ? _t('_post_successfully_deleted') : _t('_failed_to_delete_post');
1244 
1245  $this->isAllowedPostDelete($iPostOwnerID, true); // perform action
1246 
1247  //reparse tags
1248  ch_import('ChWsbTags');
1249  $oTags = new ChWsbTags();
1250  $oTags->reparseObjTags('blog', $iPostID);
1251 
1252  //reparse categories
1253  $oCategories = new ChWsbCategories();
1254  $oCategories->reparseObjTags('ch_blogs', $iPostID);
1255 
1256  // delete views
1257  ch_import('ChWsbViews');
1258  $oViews = new ChWsbViews($this->_oConfig->getViewSystemName(), $iPostID, false);
1259  $oViews->onObjectDelete();
1260 
1261  //delete all subscriptions
1263  $oSubscription->unsubscribe(array('type' => 'object_id', 'unit' => 'ch_blogs', 'object_id' => $iPostID));
1264 
1265  ch_import('ChWsbAlerts');
1266  $oZ = new ChWsbAlerts('ch_blogs', 'delete_post', $iPostID, $iPostOwnerID);
1267  $oZ->alert();
1268 
1269  return MsgBox($sRet);
1270  } else {
1271  return MsgBox(_t('_Error Occured'));
1272  }
1273  }
1274 
1276  {
1277  if ($this->iViewingPostID < 0) {
1278  if (false !== ch_get('postUri')) {
1279  $sPostUri = process_db_input(ch_get('postUri'), CH_TAGS_STRIP);
1280  $this->iViewingPostID = (int)$this->_oDb->getPostIDByUri($sPostUri);
1281  } elseif (false !== ch_get('post_id')) {
1282  $this->iViewingPostID = (int)ch_get('post_id');
1283  }
1284  }
1285  if ($this->iViewingPostID) {
1286  $this->aViewingPostInfo = $this->_oDb->getPostInfo($this->iViewingPostID);
1287 
1288  if (is_array($this->aViewingPostInfo) && $this->aViewingPostInfo) {
1289  $iOwnerID = (int)$this->aViewingPostInfo['OwnerID'];
1290 
1291  $bPossibleToView = $this->oPrivacy->check('view', $this->iViewingPostID, $this->_iVisitorID);
1292 
1293  if ($this->isAllowedBlogPostView($iOwnerID, true) == false || $bPossibleToView == false) {
1294  return array(
1295  DesignBoxContent($this->_sPageHeader, $this->_oTemplate->displayAccessDenied(), 1),
1296  false
1297  );
1298  }
1299 
1300  $this->iPostViewType = 3;
1301 
1302  ch_import('ChWsbViews');
1303  new ChWsbViews($this->_oConfig->getViewSystemName(), $this->iViewingPostID);
1304 
1305  ch_import('ChWsbAlerts');
1306  $oZ = new ChWsbAlerts('ch_blogs', 'view_post', $this->iViewingPostID, $this->_iVisitorID);
1307  $oZ->alert();
1308 
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']);
1311  } else {
1312  $GLOBALS['oTopMenu']->setCustomSubIconUrl('book');
1313  }
1314 
1315  $sPostCaption = htmlspecialchars($this->aViewingPostInfo['PostCaption']);
1316  $GLOBALS['oTopMenu']->setCustomSubHeader($sPostCaption);
1317 
1318  $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(
1319  _t('_ch_blog_Blogs') => $this->genBlogLink('home'),
1320  $sPostCaption => '',
1321  ));
1322 
1323  return array('', true);
1324  }
1325  }
1326 
1327  return array(DesignBoxContent($this->_sPageHeader, MsgBox(_t('_Empty')), 1), false);
1328  }
1329 
1330  function getBlogPostBlock()
1331  {
1332  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
1333  $oTmpBlogSearch = new ChBlogsSearchUnit($this);
1334  $oTmpBlogSearch->PerformObligatoryInit($this, 3);
1335  $oTmpBlogSearch->aCurrent['restriction']['id']['value'] = $this->iViewingPostID;
1336  if (($this->aViewingPostInfo['OwnerID'] == $this->_iVisitorID && $this->aViewingPostInfo['OwnerID'] > 0) || $this->bAdminMode) {
1337  $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = '';
1338  }
1339  $oTmpBlogSearch->aCurrent['paginate']['perPage'] = 1;
1340  $sPostStringVal = $oTmpBlogSearch->displayResultBlock();
1341 
1342  // back - forward func
1343  $iOwnerID = (int)$this->aViewingPostInfo['OwnerID'];
1344 
1345  $sCategoryName = $this->defineCategoryName();
1346  $sCategoryUrlAdd = ($sCategoryName != '') ? "&category=" . $sCategoryName : '';
1347  $sStatusFilter = ($this->isAdmin() == true) ? '1' : "`PostStatus`='approval'";
1348  $aPostsInCategory = $this->_oDb->getPostsInCategory($sStatusFilter, $sCategoryName, $iOwnerID);
1349 
1350  reset($aPostsInCategory);
1351  $iCurKey = array_search($this->iViewingPostID, $aPostsInCategory);
1352 
1353  $sBackNextNav = '';
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">
1364  {$sPrevPostCaption}
1365 </a>
1366 EOF;
1367  }
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">
1377  {$sNextPostCaption}
1378 </a>
1379 EOF;
1380  }
1381 
1382  $sSPaginate = <<<EOF
1383 <div class="dbBottomMenu">
1384  <div class="pages_section">
1385  {$sBackNextNav}
1386  </div>
1387 </div>
1388 EOF;
1389 
1390  // end of back - forward func
1391 
1392  return DesignBoxContent(_t('_ch_blog_post_view'), $sPostStringVal, 11, '', $sSPaginate);
1393  }
1394 
1396  {
1397  if (!$this->isAllowedShare($this->aViewingPostInfo)) {
1398  return '';
1399  }
1400 
1401  $sUrl = $this->genUrl($this->aViewingPostInfo['PostID'], $this->aViewingPostInfo['PostUri']);
1402  $sTitle = $this->aViewingPostInfo['PostCaption'];
1403  $sImgUrl = false;
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)
1410  );
1411  }
1412 
1413  ch_import('ChTemplSocialSharing');
1414  $sCode = ChTemplSocialSharing::getInstance()->getCode($sUrl, $sTitle, $aCustomParams);
1415 
1416  return array($sCode, array(), array(), false);
1417  }
1418 
1419  function getCommentsBlock()
1420  {
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();
1426 
1427  return $sPostComm;
1428  }
1429 
1430  function getActionsBlock()
1431  {
1432  if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
1433 
1434  $iMemberID = (int)$this->aViewingPostInfo['OwnerID'];
1435  $aOwnerInfo = getProfileInfo($iMemberID);
1436  $sOwnerNickname = getNickName($iMemberID);
1437  $aUser = array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $iMemberID);
1438 
1439  $sOwnerBlogLinkSub = $this->genBlogLink('show_member_blog_home', $aUser, '', '', '', true);
1440 
1441  $sApproveC = _t('_Approve');
1442  $sDisApproveC = _t('_Disapprove');
1443  $sFeatureItC = _t('_Feature it');
1444  $sDeFeatureItC = _t('_De-Feature it');
1445 
1446  $bApproveAllowed = $this->isAllowedApprove() ? 'true' : 'false';
1447 
1448  if (($this->_iVisitorID == $iMemberID && $iMemberID > 0) || $this->bAdminMode || $bApproveAllowed) {
1449  $iFeaturedStatus = $this->_oDb->getFeaturedStatus($this->iViewingPostID);
1450  $sFeatureC = ((int)$iFeaturedStatus == 1) ? $sDeFeatureItC : $sFeatureItC;
1451 
1452  if ($this->bAdminMode || $bApproveAllowed == 'true') {
1453  $iApproved = 0; //0 = not changed; 1 = app; 2 = disapp;
1454  if (ch_get('sa') == 'approve') { //approve this post
1455  $this->_oDb->setPostStatus($this->iViewingPostID, 'approval');
1456  $this->onPostApproveDisapprove($this->iViewingPostID, true);
1457  $iApproved = 1;
1458  }
1459  if (ch_get('sa') == 'disapprove') { //disapprove this post
1460  $this->_oDb->setPostStatus($this->iViewingPostID);
1461  $this->onPostApproveDisapprove($this->iViewingPostID, false);
1462  $iApproved = 2;
1463  }
1464 
1465  $sCurPostStatus = $this->_oDb->getActiveStatus($this->iViewingPostID);
1466  switch ($iApproved) {
1467  case 0:
1468  $sSAAction = ($sCurPostStatus == 'disapproval') ? 'approve' : 'disapprove';
1469  $sSACaption = ($sCurPostStatus == 'disapproval') ? $sApproveC : $sDisApproveC;
1470  break;
1471  case 1:
1472  $sSAAction = 'disapprove';
1473  $sSACaption = $sDisApproveC;
1474  break;
1475  case 2:
1476  $sSAAction = 'approve';
1477  $sSACaption = $sApproveC;
1478  break;
1479  }
1480  }
1481  }
1482 
1483  $sLink = $this->genBlogLink('show_member_blog_home', $aUser);
1484 
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);
1489 
1490  $sProcessingFile = $this->genBlogSubUrl();
1491 
1492  ch_import('ChWsbSubscription');
1494  $aButton = $oSubscription->getButton($this->_iVisitorID, 'ch_' . $this->_oConfig->getUri(), '',
1495  $this->iViewingPostID);
1496  $sSubsAddon = $oSubscription->getData();
1497 
1498  $aActionKeys = array(
1499  'edit_allowed' => $this->isAllowedPostEdit(-1) ? 'true' : 'false',
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,
1514  'only_menu' => 0,
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') : '',
1521  );
1522 
1523  $aActionKeys['repostCpt'] = $aActionKeys['repostScript'] = '';
1524  if(ChWsbRequest::serviceExists('wall', 'get_repost_js_click')) {
1525  $sSubsAddon .= ChWsbService::call('wall', 'get_repost_js_script');
1526 
1527  $aActionKeys['repostCpt'] = _t('_Repost');
1528  $aActionKeys['repostScript'] = ChWsbService::call('wall', 'get_repost_js_click', array($this->_iVisitorID, 'ch_blogs', 'create', $this->iViewingPostID));
1529  }
1530 
1531  $sActionsVal = $GLOBALS['oFunctions']->genObjectsActions($aActionKeys, 'ch_blogs', false);
1532 
1533  return $sSubsAddon . $sActionsVal;
1534  }
1535  }
1536 
1538  {
1539  $aPostInfo = $this->_oDb->getPostInfo($iEntryId);
1540  if ($aPostInfo['OwnerID']) {
1541  $sEntryUrl = $this->genUrl($iEntryId, $aPostInfo['PostUri']);
1542  $sEntryCaption = $aPostInfo['PostCaption'];
1543  } else {
1544  return array('skip' => true);
1545  }
1546 
1547  $aActionList = array(
1548  'commentPost' => '_ch_blog_sbs_comments'
1549  );
1550 
1551  $sActionName = isset($aActionList[$sAction]) ? ' (' . _t($aActionList[$sAction]) . ')' : '';
1552 
1553  return array(
1554  'skip' => false,
1555  'template' => array(
1556  'Subscription' => $sEntryCaption . $sActionName,
1557  'ViewLink' => $sEntryUrl,
1558  ),
1559  );
1560  }
1561 
1562  function getRateBlock()
1563  {
1564  if ($this->iPostViewType != 3 || !$this->iViewingPostID) {
1565  return false;
1566  }
1567 
1568  ch_import('ChTemplVotingView');
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);
1573  } else {
1574  $sVotePostRating = $oVotingView->getBigVoting(0);
1575  }
1576  $aVars = array('content' => $sVotePostRating);
1577 
1578  return $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars);
1579  }
1580 
1582  {
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>';
1586  $aAuthor = getProfileInfo($iMemberID);
1587 
1588  $aVars = array(
1589  'author_unit' => get_member_thumbnail($aAuthor['ID'], 'none', true),
1590  'fields' => $sBlogDescription,
1591  );
1592 
1593  if ($this->iPostViewType == 3 && $this->iViewingPostID > 0) {
1594  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
1595  $oBlogSearch = new ChBlogsSearchUnit();
1596 
1597  ch_import('ChWsbCategories');
1598  ch_import('ChWsbTags');
1599  $oCategories = new ChWsbCategories();
1600  $oTags = new ChWsbTags();
1601 
1602  $sCats = '';
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)),
1608  title2uri(trim($sCatValue)),
1609  array('ownerId' => $iMemberID, 'blogOwnerName' => $aAuthor['NickName']));
1610  $aCatLinks[] = '<a href="' . $sCatLink . '" rel="nofollow">' . $sCatValue . '</a>';
1611  }
1612  $sCats = implode(", ", $aCatLinks);
1613  }
1614 
1615  $sTags = '';
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>';
1623  }
1624  }
1625  $sTags = implode(", ", $aTagLinks);
1626  }
1627 
1628  $aVars['date'] = getLocaleDate($this->aViewingPostInfo['PostDate'], CH_WSB_LOCALE_DATE_SHORT);
1629  $aVars['date_ago'] = defineTimeInterval($this->aViewingPostInfo['PostDate'], false);
1630  $aVars['cats'] = $sCats;
1631  $aVars['tags'] = $sTags;
1632  $aVars['fields'] = '';
1633 
1634  return $this->_oTemplate->parseHtmlByName('entry_view_block_info.html', $aVars);
1635  }
1636 
1637  return $this->_oTemplate->parseHtmlByName('entry_view_empty_block_info.html', $aVars);
1638  }
1639 
1640  function getPostTagsBlock()
1641  {
1642  $iMemberID = (int)$this->aViewingPostInfo['OwnerID'];
1643  $sOwnerNickname = getNickName($iMemberID);
1644  $aOwnerInfo = getProfileInfo($iMemberID);
1645 
1646  $sOwnerAddAp = ($iMemberID == $this->_iVisitorID
1647  || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1)
1648  || $this->isAllowedPostDelete(-1))
1649  ? ''
1650  : "AND `PostStatus`='approval'";
1651 
1652  $sStatusFilter = ($this->isAdmin() == true) ? '' : $sOwnerAddAp;
1653 
1654  $aTagsPost = array();
1655  $sTagsVals = '';
1656 
1657  $vTags = $this->_oDb->getTagsInfo($iMemberID, $sStatusFilter, '');
1658 
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]++;
1668  } else {
1669  $aTagsPost[$sTagKey] = 1;
1670  }
1671  }
1672  }
1673  }
1674  ksort($aTagsPost);
1675  $aTagsPost = array_slice($aTagsPost, 0, $this->_oConfig->iTopTagsCnt);
1676 
1677  if (count($aTagsPost)) {
1678  $iMinFontSize = $GLOBALS['oTemplConfig']->iTagsMinFontSize;
1679  $iMaxFontSize = $GLOBALS['oTemplConfig']->iTagsMaxFontSize;
1680  $iFontDiff = $iMaxFontSize - $iMinFontSize;
1681 
1682  $iMinRating = min($aTagsPost);
1683  $iMaxRating = max($aTagsPost);
1684 
1685  $iRatingDiff = $iMaxRating - $iMinRating;
1686  $iRatingDiff = ($iRatingDiff == 0) ? 1 : $iRatingDiff;
1687  }
1688 
1689  $aProf = array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $iMemberID);
1690 
1691  foreach ($aTagsPost as $sTag => $iCount) {
1692  $iTagSize = $iMinFontSize + round($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff));
1693  $href = str_replace('{tag}', urlencode($sTag), $sCrtHrefTmpl);
1694  $sTagLink = $this->genBlogLink('search_by_tag', $aProf, '', '', title2uri($sTag));
1695 
1696  $sTagsVals .= '<span class="one_tag" style="font-size:' . $iTagSize . 'px;">
1697  <a href="' . $sTagLink . '" title="' . _t('_Count') . ':' . $iCount . '">' . htmlspecialchars_adv($sTag) . '</a>
1698  </span>';
1699  }
1700 
1701  $sTagsVals = ($sTagsVals == '') ? MsgBox(_t('_Empty')) : $sTagsVals;
1702 
1703  return <<<EOF
1704 <div class="ch-def-bc-padding">
1705  {$sTagsVals}
1706  <div class="clear_both"></div>
1707 </div>
1708 EOF;
1709  }
1710 
1712  {
1713  $iMemberID = (int)$this->aViewingPostInfo['OwnerID'];
1714  $aOwnerInfo = getProfileInfo($iMemberID);
1715  $sOwnerNickname = getNickName($iMemberID);
1716  $aProf = array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $iMemberID);
1717 
1718  $sOwnerAddAp = ($iMemberID == $this->_iVisitorID
1719  || $this->isAllowedApprove() || $this->isAllowedPostEdit(-1)
1720  || $this->isAllowedPostDelete(-1))
1721  ? ''
1722  : "AND `PostStatus`='approval'";
1723 
1724  $sStatusFilter = ($this->isAdmin() == true) ? '' : $sOwnerAddAp;
1725 
1726  $sNewC = ucfirst(_t('_new'));
1727  $sCategoriesC = _t('_ch_blog_Categories');
1728  $sPostsCL = mb_strtolower(_t('_ch_blog_Posts'));
1729 
1730  $sCategories = '';
1731 
1732  $oCategories = new ChWsbCategories();
1733  $aAllCategories = $oCategories->getCategoriesList('ch_blogs', $iMemberID);
1734 
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);
1739 
1740  if ($iCountCatPost == 0) {
1741  continue;
1742  }
1743 
1744  $sCatName = process_line_output($sCategoryName);
1745  $sSpacerName = $this->sSpacerPath;
1746 
1747  $aCat = array('Permalink' => title2uri($sCategoryName), 'Link' => title2uri($sCategoryName));
1748  $sCatLink = $this->genBlogLink('show_member_blog', $aProf, $aCat);
1749 
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>&nbsp;<span class="blog_author ch-def-font-grayed ch-def-font-small">({$iCountCatPost} {$sPostsCL})</span>
1755  </div>
1756 </div>
1757 EOF;
1758  }
1759  }
1760 
1761  return DesignBoxContent($sCategoriesC, $sCategories, 11);
1762  }
1763 
1765  {
1766  $iMemberID = (int)$this->aViewingPostInfo['OwnerID'];
1767  $aOwnerInfo = getProfileInfo($iMemberID);
1768  $aUser = array('Permalink' => $aOwnerInfo['NickName'], 'Link' => $iMemberID);
1769 
1770  $sFeaturedSect = '';
1771  $vFeaturedPosts = $this->_oDb->getFeaturedPosts($iMemberID);
1772  if ($vFeaturedPosts->rowCount()) {
1773  $sFeatured = '';
1774  while ($aFeaturedPost = $vFeaturedPosts->fetch()) {
1775  $iPostID = (int)$aFeaturedPost['PostID'];
1776  $aPost = array('Permalink' => $aFeaturedPost['PostUri'], 'Link' => $iPostID);
1777  $sPostLink = $this->genBlogLink('show_member_post', $aUser, '', $aPost);
1778  $sFeaturedPostTitle = process_line_output($aFeaturedPost['PostCaption']);
1779 
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>
1785  </div>
1786 </div>
1787 EOF;
1788  }
1789 
1790  return <<<EOF
1791 <div class="ch-def-bc-padding">
1792  {$sFeatured}
1793 </div>
1794 EOF;
1795  }
1796  }
1797 
1803  function GenPostPage($iParamPostID = 0)
1804  {
1805  $this->iViewingPostID = ($iParamPostID > 0) ? $iParamPostID : $this->iViewingPostID;
1806 
1807  list($sCode, $bShowBlocks) = $this->getViewingPostInfo();
1808  if (empty($this->aViewingPostInfo)) {
1809  header("HTTP/1.1 404 Not Found");
1810  $sMsg = _t('_sys_request_page_not_found_cpt');
1811  $GLOBALS['oTopMenu']->setCustomSubHeader($sMsg);
1812 
1813  return DesignBoxContent($sMsg, MsgBox($sMsg), 1);
1814  }
1815 
1816  if(isBlocked($this->aViewingPostInfo['OwnerID'], $this->_iVisitorID)) {
1817  return MsgBox(_t('_sys_txt_error_you_are_blocked'));
1818  }
1819 
1820  $iBlogLimitChars = (int)getParam('max_blog_preview');
1821  $sPostText = htmlspecialchars_adv(mb_substr(trim(strip_tags($this->aViewingPostInfo['PostText'])), 0,
1822  $iBlogLimitChars));
1823  $this->_oTemplate->setPageDescription($sPostText);
1824 
1825  if (mb_strlen($this->aViewingPostInfo['Tags']) > 0) {
1826  $this->_oTemplate->addPageKeywords($this->aViewingPostInfo['Tags']);
1827  }
1828 
1829  $sRetHtml .= $sCode;
1830  if ($bShowBlocks) {
1831  $oBPV = new ChWsbBlogsPageView($this);
1832  $sRetHtml .= $oBPV->getCode();
1833  }
1834 
1835  return $sRetHtml;
1836  }
1837 
1838  function GenMyPageAdmin($sMode = '')
1839  {
1840  $this->CheckLogged();
1841 
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');
1850 
1851  $bUseFriendlyLinks = $this->isPermalinkEnabled();
1852  $sLink = $this->genBlogFormUrl();
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";
1857 
1858  if (ch_get('action_delete') && is_array(ch_get('bposts'))) {
1859  foreach (ch_get('bposts') as $iBPostID) {
1860  $this->ActionDeletePost((int)$iBPostID);
1861  }
1862  }
1863 
1864  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
1865  $oTmpBlogSearch = new ChBlogsSearchUnit();
1866  $oTmpBlogSearch->PerformObligatoryInit($this, 4);
1867  $oTmpBlogSearch->bShowCheckboxes = false;
1868  $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage();
1869  $oTmpBlogSearch->aCurrent['restriction']['owner']['value'] = $this->_iVisitorID;
1870 
1871  $GLOBALS['oTopMenu']->setCurrentProfileID($this->_iVisitorID);
1872 
1873  if (!ch_get('ajax')) {
1874  $sMyBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1875  $sMyPosts = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sMyBlogPostsVal;
1876 
1877  $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $sBlogMainLink;
1878  $sMyPostsPagination = $oTmpBlogSearch->showPagination3();
1879  }
1880 
1881  $sMainTabClass = $sAddTabClass = $sManageTabClass = $sPendingTabClass = 0;
1882  switch ($sMode) {
1883  case 'add':
1884  $sAddTabClass = 1;
1885 
1886  $aBlogsRes = $this->_oDb->getBlogInfo($this->_iVisitorID);
1887  $sNewPostForm = (!$aBlogsRes) ? $this->GenCreateBlogForm(false) : $this->AddNewPostForm(0, false);
1888 
1889  $sAdmContent = $sNewPostForm;
1890 
1891  break;
1892  case 'manage':
1893  $sManageTabClass = 1;
1894 
1895  $oTmpBlogSearch->bShowCheckboxes = true;
1896  $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
1897  $sActivePosts = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sBlogPostsVal;
1898 
1899  $sManagePostsPagination = $oTmpBlogSearch->showPaginationAjax('ch_blogs_user_form', $sBlogManageLink);
1900 
1901  $sAdmPanel = $oTmpBlogSearch->showAdminActionsPanel('bposts_box', array('action_delete' => '_Delete'),
1902  'bposts');
1903  $sManagePostsUnits = <<<EOF
1904 <div id="bposts_box" class="ch-def-bc-padding">
1905  {$sActivePosts}
1906  <div class="clear_both"></div>
1907 </div>
1908 {$sManagePostsPagination}
1909 {$sAdmPanel}
1910 EOF;
1911  $sAjaxContent = $sManagePostsUnits;
1912  $sAdmContent = '<form id="ch_blogs_user_form" method="post">' . $sManagePostsUnits . '</form>';
1913  break;
1914  case 'pending':
1915  $sPendingTabClass = 1;
1916 
1917  $oTmpBlogSearch->aCurrent['restriction']['activeStatus']['value'] = 'disapproval';
1918  $sDisPostsVal = $oTmpBlogSearch->displayResultBlock();
1919  $sDisPostsVal = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sDisPostsVal;
1920 
1921  $sPendingPostsPagination = $oTmpBlogSearch->showPaginationAjax('ch_blogs_pending', $sBlogPendingLink);
1922 
1923  $sPendingPostsUnits = <<<EOF
1924 <div id="bposts_box" class="ch-def-bc-padding">
1925  {$sDisPostsVal}
1926  <div class="clear_both"></div>
1927 </div>
1928 $sPendingPostsPagination
1929 EOF;
1930  $sAjaxContent = $sPendingPostsUnits;
1931  $sAdmContent = '<div id="ch_blogs_pending">' . $sPendingPostsUnits . '</div>';
1932  break;
1933  case 'main':
1934  default:
1935  $sMainTabClass = 1;
1936 
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);
1942  break;
1943  }
1944 
1945  $sAdmPost = ChWsbPageView::getBlockCaptionMenu(time(), array(
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)
1950  ));
1951 
1952  if ($sAjaxContent && ch_get('ajax')) {
1953  header('Content-type:text/html;charset=utf-8');
1954  echo $sAjaxContent;
1955  exit;
1956  }
1957 
1958  $sAdministrationUnitsSect = DesignBoxContent($sAdministrationC, $sAdmContent, 1, $sAdmPost);
1959 
1960  $sMyPostsBox = DesignBoxContent($sMyPostsC, $sMyPosts, 11, false, $sMyPostsPagination);
1961 
1962  return $sAdministrationUnitsSect . $sMyPostsBox;
1963  }
1964 
1971  function AddNewPostForm($iPostID = 0, $bBox = true)
1972  {
1973  $this->CheckLogged();
1974 
1975  if ($iPostID == 0) {
1976  if (!$this->isAllowedPostAdd()) {
1977  return $this->_oTemplate->displayAccessDenied();
1978  }
1979  } else {
1980  $iOwnerID = (int)$this->_oDb->getPostOwnerByID($iPostID);
1981  if (!$this->isAllowedPostEdit($iOwnerID)) {
1982  return $this->_oTemplate->displayAccessDenied();
1983  }
1984  }
1985 
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');
1998 
1999  $sLink = $this->genBlogFormUrl();
2000 
2001  $sAddingForm = '';
2002 
2003  $oCategories = new ChWsbCategories();
2004  $oCategories->getTagObjectConfig();
2005 
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'));
2012 
2013  $sAction = ($iPostID == 0) ? 'new_post' : 'edit_post';
2014 
2015  //adding form
2016  $aForm = array(
2017  'form_attrs' => array(
2018  'name' => 'CreateBlogPostForm',
2019  'action' => $sLink,
2020  'method' => 'post',
2021  'enctype' => 'multipart/form-data',
2022  ),
2023  'params' => array(
2024  'db' => array(
2025  'table' => $this->_oConfig->sSQLPostsTable,
2026  'key' => 'PostID',
2027  'submit_name' => 'add_button',
2028  ),
2029  ),
2030  'inputs' => array(
2031  'PostCaption' => array(
2032  'type' => 'text',
2033  'name' => 'PostCaption',
2034  'caption' => $sPostCaptionC,
2035  'required' => true,
2036  'checker' => array(
2037  'func' => 'length',
2038  'params' => array(3, 255),
2039  'error' => $sCaptionErrorC,
2040  ),
2041  'db' => array(
2042  'pass' => 'Xss',
2043  ),
2044  ),
2045  'Tags' => array(
2046  'type' => 'text',
2047  'name' => 'Tags',
2048  'caption' => $sTagsC,
2049  'info' => $sTagsInfoC,
2050  'required' => false,
2051  'db' => array(
2052  'pass' => 'Xss',
2053  ),
2054  ),
2055  'PostText' => array(
2056  'type' => 'textarea',
2057  'html' => 2,
2058  'name' => 'PostText',
2059  'caption' => $sPostTextC,
2060  'required' => true,
2061  'checker' => array(
2062  'func' => 'length',
2063  'params' => array(3, 65535),
2064  'error' => $sTextErrorC,
2065  ),
2066  'db' => array(
2067  'pass' => 'XssHtml',
2068  ),
2069  ),
2070  'Categories' => $oCategories->getGroupChooser('ch_blogs', $this->_iVisitorID, true),
2071  'File' => array(
2072  'type' => 'file',
2073  'name' => 'BlogPic[]',
2074  'caption' => $sAssociatedImageC,
2075  ),
2076  'AssociatedImage' => array(
2077  'type' => 'hidden',
2078  ),
2079  'allowView' => $aAllowView,
2080  'allowRate' => $aAllowRate,
2081  'allowComment' => $aAllowComment,
2082  'hidden_action' => array(
2083  'type' => 'hidden',
2084  'name' => 'action',
2085  'value' => $sAction,
2086  ),
2087  'add_button' => array(
2088  'type' => 'submit',
2089  'name' => 'add_button',
2090  'value' => $sAddBlogC,
2091  ),
2092  ),
2093  );
2094 
2095  if ($iPostID > 0) {
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&amp;post_id={$iPostID}" onclick="BlogpostImageDelete('{$sLink}?action=del_img&post_id={$iPostID}&mode=ajax', 'edit_post_image_{$iPostID}');return false;" >{$sDelImgC}</a>
2107 </div>
2108 EOF;
2109 
2110  $aForm['inputs']['AssociatedImage']['type'] = 'custom';
2111  $aForm['inputs']['AssociatedImage']['content'] = $sPostPictureTag;
2112  $aForm['inputs']['AssociatedImage']['caption'] = $sAssociatedImageC;
2113  }
2114 
2115  $aCategories = explode(';', $aBlogPost['Categories']);
2116 
2117  $aForm['inputs']['PostCaption']['value'] = $sPostCaption;
2118  $aForm['inputs']['PostText']['value'] = $sPostText;
2119  $aForm['inputs']['Tags']['value'] = $sPostTags;
2120  $aForm['inputs']['Categories']['value'] = $aCategories;
2121 
2122  $aForm['inputs']['allowView']['value'] = $aBlogPost['allowView'];
2123  $aForm['inputs']['allowRate']['value'] = $aBlogPost['allowRate'];
2124  $aForm['inputs']['allowComment']['value'] = $aBlogPost['allowComment'];
2125 
2126  $aForm['inputs']['hidden_postid'] = array(
2127  'type' => 'hidden',
2128  'name' => 'EditPostID',
2129  'value' => $iPostID,
2130  );
2131 
2132  if ($aBlogPost['PostPhoto'] != '' && file_exists(CH_BLOGS_IMAGES_PATH . 'small_' . $aBlogPost['PostPhoto'])) {
2133  $GLOBALS['oTopMenu']->setCustomSubIconUrl(CH_BLOGS_IMAGES_URL . 'small_' . $aBlogPost['PostPhoto']);
2134  } else {
2135  $GLOBALS['oTopMenu']->setCustomSubIconUrl('book');
2136  }
2137  $GLOBALS['oTopMenu']->setCustomSubHeader($sPostCaption);
2138  }
2139 
2140  if (empty($aForm['inputs']['allowView']['value']) || !$aForm['inputs']['allowView']['value']) {
2141  $aForm['inputs']['allowView']['value'] = CH_WSB_PG_ALL;
2142  }
2143  if (empty($aForm['inputs']['allowRate']['value']) || !$aForm['inputs']['allowRate']['value']) {
2144  $aForm['inputs']['allowRate']['value'] = CH_WSB_PG_ALL;
2145  }
2146  if (empty($aForm['inputs']['allowComment']['value']) || !$aForm['inputs']['allowComment']['value']) {
2147  $aForm['inputs']['allowComment']['value'] = CH_WSB_PG_ALL;
2148  }
2149 
2150  $oForm = new ChTemplFormView($aForm);
2151  $oForm->initChecker();
2152  if ($oForm->isSubmittedAndValid()) {
2153  $this->CheckLogged();
2154 
2155  $iOwnID = $this->_iVisitorID;
2156  $sCurTime = time();
2157  $sPostUri = uriGenerate(ch_get('PostCaption'), $this->_oConfig->sSQLPostsTable, 'PostUri');
2158  $sAutoApprovalVal = (getParam('blogAutoApproval') == 'on') ? "approval" : "disapproval";
2159 
2160  $aValsAdd = array(
2161  'PostDate' => $sCurTime,
2162  'PostStatus' => $sAutoApprovalVal
2163  );
2164  if ($iPostID == 0) {
2165  $aValsAdd['OwnerID'] = $iOwnID;
2166  $aValsAdd['PostUri'] = $sPostUri;
2167  }
2168 
2169  $iBlogPostID = -1;
2170 
2171  if ($iPostID > 0) {
2172  unset($aValsAdd['PostDate']);
2173  $oForm->update($iPostID, $aValsAdd);
2174  $this->isAllowedPostEdit($iOwnerID, true);
2175  $iBlogPostID = $iPostID;
2176  } else {
2177  $iBlogPostID = $oForm->insert($aValsAdd);
2178  $this->isAllowedPostAdd(true);
2179  }
2180 
2181  if ($iBlogPostID) {
2182  $this->iLastPostedPostID = $iBlogPostID;
2183 
2184  if ($_FILES) {
2185  for ($i = 0; $i < count($_FILES['BlogPic']['tmp_name']); $i++) {
2186  if ($_FILES['BlogPic']['error'][$i]) {
2187  continue;
2188  }
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) {
2192  break;
2193  }
2194 
2195  $aSize = getimagesize($sTmpFile);
2196  if (!$aSize) {
2197  @unlink($sTmpFile);
2198  break;
2199  }
2200 
2201  switch ($aSize[2]) {
2202  case IMAGETYPE_JPEG:
2203  case IMAGETYPE_GIF:
2204  case IMAGETYPE_PNG:
2205 
2206  $sOriginalFilename = $_FILES['BlogPic']['name'][$i];
2207  $sExt = strrchr($sOriginalFilename, '.');
2208 
2209  $sFileName = 'blog_' . $iBlogPostID . '_' . $i;
2210  @unlink($sFileName);
2211 
2212  move_uploaded_file($sTmpFile, CH_BLOGS_IMAGES_PATH . $sFileName . $sExt);
2213  @unlink($sTmpFile);
2214 
2215  if (strlen($sExt)) {
2216  $sPathSrc = CH_BLOGS_IMAGES_PATH . $sFileName . $sExt;
2217  $sPathDst = CH_BLOGS_IMAGES_PATH . '%s_' . $sFileName . $sExt;
2218 
2219  imageResize($sPathSrc, sprintf($sPathDst, 'small'), $this->iIconSize / 1,
2220  $this->iIconSize / 1);
2221  imageResize($sPathSrc, sprintf($sPathDst, 'big'), $this->iThumbSize,
2222  $this->iThumbSize);
2223  imageResize($sPathSrc, sprintf($sPathDst, 'browse'), $this->iBigThumbSize,
2224  null);
2225  imageResize($sPathSrc, sprintf($sPathDst, 'orig'), $this->iImgSize,
2226  $this->iImgSize);
2227 
2228  chmod(sprintf($sPathDst, 'small'), 0644);
2229  chmod(sprintf($sPathDst, 'big'), 0644);
2230  chmod(sprintf($sPathDst, 'browse'), 0644);
2231  chmod(sprintf($sPathDst, 'orig'), 0644);
2232 
2233  $this->_oDb->performUpdatePostWithPhoto($iBlogPostID, $sFileName . $sExt);
2234  @unlink($sPathSrc);
2235  }
2236 
2237  break;
2238  default:
2239  @unlink($sTempFileName);
2240 
2241  return false;
2242  }
2243  }
2244  }
2245  }
2246 
2247  //reparse tags
2248  ch_import('ChWsbTags');
2249  $oTags = new ChWsbTags();
2250  $oTags->reparseObjTags('blog', $iBlogPostID);
2251 
2252  //reparse categories
2253  $oCategories = new ChWsbCategories();
2254  $oCategories->reparseObjTags('ch_blogs', $iBlogPostID);
2255 
2256  $sAlertAction = ($iPostID == 0) ? 'create' : 'edit_post';
2257  ch_import('ChWsbAlerts');
2258  $oZ = new ChWsbAlerts('ch_blogs', $sAlertAction, $iBlogPostID, $this->_iVisitorID);
2259  $oZ->alert();
2260 
2261  header("X-XSS-Protection: 0"); // to prevent browser's security audit to block youtube embeds(and others), just after post creation
2262  return $this->GenPostPage($iBlogPostID);
2263  } else {
2264  return MsgBox($sErrorC);
2265  }
2266  } else {
2267  $sAddingForm = $oForm->getCode();
2268  }
2269 
2270  $sCaption = ($iPostID) ? $sEditPostC : $sNewPostC;
2271  $sAddingFormVal = '<div class="blogs-view ch-def-bc-padding">' . $sAddingForm . '</div>';
2272 
2273  return ($bBox) ? DesignBoxContent($sCaption,
2274  '<div class="blogs-view ch-def-bc-padding">' . $sAddingForm . '</div>', 1) : $sAddingFormVal;
2275  }
2276 
2277  function getTagLinks($sTagList, $sType = 'tag', $sDivider = ' ')
2278  {
2279  if (strlen($sTagList)) {
2280  $aTags = explode($sDivider, $sTagList);
2281  foreach ($aTags as $iKey => $sValue) {
2282  $sValue = trim($sValue, ',');
2283  // $sLink = $this->getCurrentUrl($sType, 0, $sValue);
2284  // $aRes[$sValue] = $sLink;
2285  $aRes[$sValue] = $sValue;
2286  }
2287  }
2288 
2289  return $aRes;
2290  }
2291 
2298  {
2299  $this->CheckLogged();
2300 
2301  $aBlogsRes = $this->_oDb->getBlogInfo($this->_iVisitorID);
2302  if (!$aBlogsRes) {
2303  return $this->GenCreateBlogForm();
2304  }
2305 
2306  $iOwnerID = (int)$aBlogsRes['OwnerID'];
2307  if ((!$this->_iVisitorID || $iOwnerID != $this->_iVisitorID) && !$this->isAllowedBlogView($iOwnerID)) {
2308  return $this->_oTemplate->displayAccessDenied();
2309  }
2310 
2311  $sAddCategoryC = _t('_Add Category');
2312 
2313  $sRetHtml = '';
2314  if (($this->_iVisitorID == $aBlogsRes['OwnerID'] && $this->_iVisitorID > 0) || $this->bAdminMode == true) {
2315  $sCategoryCaptionC = _t('_Title');
2316  $sErrorC = _t('_Error Occured');
2317 
2318  $sLink = $this->genBlogFormUrl();
2319 
2320  //adding form
2321  $aForm = array(
2322  'form_attrs' => array(
2323  'name' => 'CreateBlogPostForm',
2324  'action' => $sLink,
2325  'method' => 'post'
2326  ),
2327  'params' => array(
2328  'db' => array(
2329  'table' => 'sys_categories',
2330  /*'key' => 'PostID',*/
2331  'submit_name' => 'add_button',
2332  ),
2333  ),
2334  'inputs' => array(
2335  'Caption' => array(
2336  'type' => 'text',
2337  'name' => 'Category',
2338  'caption' => $sCategoryCaptionC,
2339  'required' => true,
2340  'checker' => array(
2341  'func' => 'length',
2342  'params' => array(3, 128),
2343  'error' => $sErrorC,
2344  ),
2345  'db' => array(
2346  'pass' => 'Xss',
2347  ),
2348  ),
2349  'hidden_action' => array(
2350  'type' => 'hidden',
2351  'name' => 'action',
2352  'value' => 'add_category',
2353  ),
2354  'add_button' => array(
2355  'type' => 'submit',
2356  'name' => 'add_button',
2357  'value' => $sAddCategoryC,
2358  ),
2359  ),
2360  );
2361 
2362  $oForm = new ChTemplFormView($aForm);
2363  $oForm->initChecker();
2364  if ($oForm->isSubmittedAndValid()) {
2365  $this->CheckLogged();
2366 
2367  $aValsAdd = array(
2368  'ID' => '0',
2369  'Type' => 'ch_blogs',
2370  'Owner' => $this->_iVisitorID
2371  );
2372 
2373  $iInsertedCategoryID = $oForm->insert($aValsAdd);
2374 
2375  if ($iInsertedCategoryID >= 0) {
2376  return $this->GenMemberBlog($this->_iVisitorID);
2377  } else {
2378  return MsgBox($sErrorC);
2379  }
2380  } else {
2381  $sRetHtml = $oForm->getCode();
2382  }
2383 
2384  } else {
2385  $sRetHtml = $this->_oTemplate->displayAccessDenied();
2386  }
2387 
2388  return DesignBoxContent($sAddCategoryC, '<div class="blogs-view ch-def-bc-padding">' . $sRetHtml . '</div>', 1);
2389  }
2390 
2392  {
2393  if (false == ch_get('do') || ch_get('do') != 'cfs') {
2394  return;
2395  }
2396 
2397  $this->CheckLogged();
2398  $iPostID = (int)ch_get('id');
2399 
2400  $iPostOwnerID = $this->_oDb->getPostOwnerByID($iPostID);
2401  $iFeaturedStatus = $this->_oDb->getFeaturedStatus($iPostID);
2402 
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
2408  );
2409  $this->_oDb->performUpdateFeatureStatus($aUpdatingParams);
2410  } elseif ($this->_iVisitorID != $iPostOwnerID) {
2411  return MsgBox(_t('_Access denied'));
2412  } else {
2413  return MsgBox(_t('_Error Occured'));
2414  }
2415  }
2416 
2422  function GenSearchResult()
2423  {
2424  if (!$this->isAllowedBlogPostSearch(true)) {
2425  return $this->_oTemplate->displayAccessDenied();
2426  }
2427 
2428  $iCheckedMemberID = $this->_iVisitorID;
2429 
2430  $bNoProfileMode = (false !== ch_get('ownerID') || false !== ch_get('blogOwnerName')) ? false : true;
2431 
2432  $sRetHtml = '';
2433  $sSearchedTag = uri2title(process_db_input(ch_get('tagKey'), CH_TAGS_STRIP));
2434  $iMemberID = $this->defineUserId();
2435 
2436  $sTagsC = _t('_Tags');
2437  $sNoBlogC = _t('_ch_blog_No_blogs_available');
2438 
2439  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
2440  $oTmpBlogSearch = new ChBlogsSearchUnit($this);
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;
2446  }
2447  if (($iMemberID != 0 && $iMemberID == $iCheckedMemberID) || $this->isAdmin() == true) {
2448  $oTmpBlogSearch->aCurrent['restriction']['activeStatus'] = '';
2449  }
2450  $sBlogPostsVal = $oTmpBlogSearch->displayResultBlock();
2451  $sBlogPostsVal = '<div class="blogs-view ch-def-bc-padding">' . $sBlogPostsVal . '</div>';
2452 
2453  $oTmpBlogSearch->aCurrent['paginate']['page_url'] = $oTmpBlogSearch->getCurrentUrl('tag', 0,
2454  title2uri($sSearchedTag));
2455  $sBlogPostsVal .= $oTmpBlogSearch->showPagination3();
2456 
2457  $sBlogPosts = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sBlogPostsVal;
2458 
2459  $sContentSect = DesignBoxContent($sTagsC . ' - ' . $sSearchedTag, $sBlogPostsVal, 1);
2460 
2461  if ($bNoProfileMode == false) {
2462  $sRightSect = '';
2463  if ($iMemberID > -1) {
2464  $aBlogsRes = $this->_oDb->getBlogInfo($iMemberID);
2465  if (!$aBlogsRes) {
2466  $sNoBlogC = MsgBox($sNoBlogC);
2467  $sRetHtml = <<<EOF
2468 <div class="{$sWidthClass}">
2469  {$sNoBlogC}
2470 </div>
2471 <div class="clear_both"></div>
2472 EOF;
2473  } else {
2474  $sRightSect = $this->GenMemberDescrAndCat($aBlogsRes);
2475  $sWidthClass = ($iMemberID > 0) ? 'cls_info_left' : 'cls_res_thumb';
2476 
2477  $sRetHtml = $this->Templater($sContentSect, $sRightSect, $sWidthClass);
2478  }
2479  } else {
2480  $sRetHtml = MsgBox(_t('_Profile Not found Ex'));
2481  }
2482  } else {
2483  $sRetHtml = <<<EOF
2484 <div class="{$sWidthClass}">
2485  {$sContentSect}
2486 </div>
2487 <div class="clear_both"></div>
2488 EOF;
2489  }
2490 
2491  return $sRetHtml;
2492  }
2493 
2494  function GenBlogCalendar($isMiniMode = false, $iBlockID = 0, $sDynamicUrl = '')
2495  {
2496  $aDateParams = array();
2497  $sDate = ch_get('date');
2498  if ($sDate) {
2499  $aDateParams = explode('/', $sDate);
2500  }
2501 
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);
2507 
2508  return DesignBoxContent(_t('_ch_blog_Calendar'), $sBlogPostsCalendar, 1);
2509  }
2510 
2517  { // date=2009/3/18
2518  $sCode = MsgBox(_t('_Empty'));
2519 
2520  $sDate = ch_get('date');
2521  $aDate = explode('/', $sDate);
2522 
2523  $iValue1 = (int)$aDate[0];
2524  $iValue2 = (int)$aDate[1];
2525  $iValue3 = (int)$aDate[2];
2526 
2527  if ($iValue1 > 0 && $iValue2 > 0 && $iValue3 > 0) {
2528 
2529  $this->iPostViewType = 4;
2530 
2531  $sCaption = _t('_ch_blog_caption_browse_by_day')
2532  . getLocaleDate(strtotime("{$iValue1}-{$iValue2}-{$iValue3}"), CH_WSB_LOCALE_DATE_SHORT);
2533 
2534  if (!$this->isAllowedBlogsPostsBrowse()) {
2535  return DesignBoxContent($sCaption, $this->_oTemplate->displayAccessDenied(), 1);
2536  }
2537 
2538  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
2539 
2540  $oTmpBlogSearch = new ChBlogsSearchUnit($this);
2541  $oTmpBlogSearch->PerformObligatoryInit($this, $this->iPostViewType);
2542  $oTmpBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage();
2543  $oTmpBlogSearch->aCurrent['sorting'] = 'last';
2544 
2545  $oTmpBlogSearch->aCurrent['restriction']['calendar-min'] = array(
2546  'value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 00:00:00')",
2547  'field' => 'PostDate',
2548  'operator' => '>=',
2549  'no_quote_value' => true
2550  );
2551  $oTmpBlogSearch->aCurrent['restriction']['calendar-max'] = array(
2552  'value' => "UNIX_TIMESTAMP('{$iValue1}-{$iValue2}-{$iValue3} 23:59:59')",
2553  'field' => 'PostDate',
2554  'operator' => '<=',
2555  'no_quote_value' => true
2556  );
2557 
2558  $sCode = $oTmpBlogSearch->displayResultBlock();
2559  $sCode = ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) ? MsgBox(_t('_Empty')) : $sCode;
2560 
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;
2563 
2564  $sPagination = $oTmpBlogSearch->showPagination3();
2565  }
2566 
2567  $sRetHtmlVal = <<<EOF
2568 <div class="ch-def-bc-padding">
2569  {$sCode}
2570 </div>
2571 {$sPagination}
2572 EOF;
2573 
2574  return DesignBoxContent($sCaption, $sRetHtmlVal, 1);
2575  }
2576 
2582  function GenCreateBlogForm($bBox = true)
2583  {
2584  $this->CheckLogged();
2585 
2586  if (!$this->isAllowedPostAdd()) {
2587  return $this->_oTemplate->displayAccessDenied();
2588  }
2589 
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');
2598 
2599  $sRetHtml .= MsgBox($sNoBlogC);
2600 
2601  if ($this->_iVisitorID || $this->isAdmin()) {
2602  $sRetHtml = MsgBox($sPleaseCreateBlogC);
2603  $sLink = $this->genBlogFormUrl();
2604 
2605  $sAddingForm = '';
2606 
2607  //adding form
2608  $aForm = array(
2609  'form_attrs' => array(
2610  'name' => 'CreateBlogForm',
2611  'action' => $sLink,
2612  'method' => 'post',
2613  ),
2614  'params' => array(
2615  'db' => array(
2616  'table' => $this->_oConfig->sSQLBlogsTable,
2617  'key' => 'ID',
2618  'submit_name' => 'add_button',
2619  ),
2620  ),
2621  'inputs' => array(
2622  'Description' => array(
2623  'type' => 'textarea',
2624  'html' => 0,
2625  'name' => 'Description',
2626  'caption' => $sNewBlogDescC,
2627  'required' => true,
2628  'checker' => array(
2629  'func' => 'length',
2630  'params' => array(3, 255),
2631  'error' => $sErrorC,
2632  ),
2633  'db' => array(
2634  'pass' => 'XssHtml',
2635  ),
2636  ),
2637  'hidden_action' => array(
2638  'type' => 'hidden',
2639  'name' => 'action',
2640  'value' => 'create_blog',
2641  ),
2642  'add_button' => array(
2643  'type' => 'submit',
2644  'name' => 'add_button',
2645  'value' => $sSubmitC,
2646  ),
2647  ),
2648  );
2649 
2650  $oForm = new ChTemplFormView($aForm);
2651  $oForm->initChecker();
2652  if ($oForm->isSubmittedAndValid()) {
2653  $this->CheckLogged();
2654 
2655  $iOwnID = $this->_iVisitorID;
2656  $aBlogsRes = $this->_oDb->getBlogInfo($iOwnID);
2657  if (!$aBlogsRes) {
2658  $aValsAdd = array(
2659  'OwnerID' => $iOwnID
2660  );
2661  $iBlogID = $oForm->insert($aValsAdd);
2662 
2663  //return $this->GenMemberBlog($iOwnID, false);
2664  $bUseFriendlyLinks = $this->isPermalinkEnabled();
2665  $sBlogAddLink = ($bUseFriendlyLinks)
2666  ? CH_WSB_URL_ROOT . 'blogs/my_page/add/'
2667  : $this->genBlogFormUrl() . '?action=my_page&mode=add';
2668 
2669  header('Location:' . $sBlogAddLink);
2670 
2671  return $this->GenMyPageAdmin('add');
2672  } else {
2673  return MsgBox($sErrorC);
2674  }
2675  } else {
2676  $sAddingForm = $oForm->getCode();
2677  }
2678 
2679  $aVars = array('content' => $sAddingForm);
2680  $sAddingForm = $this->_oTemplate->parseHtmlByName('default_padding.html', $aVars);
2681  $sCreateForm = ($bBox) ? DesignBoxContent($sActionsC, $sAddingForm, 1) : $sAddingForm;
2682  }
2683 
2684  $sMyBlogResult = ($bBox) ? DesignBoxContent($sMyBlogC, $sRetHtml, 1) : $sRetHtml;
2685 
2686  return $sMyBlogResult . $sCreateForm;
2687  }
2688 
2690  {
2691  $sTitleC = _t('_ch_blog_Administration');
2692  $sPendingC = _t('_ch_blog_pending_approval');
2693  $sSettingsC = _t('_Settings');
2694 
2695  $sPendingTab = $this->GenBlogAdminIndex();
2696  $sSettingsTab = $this->getAdministrationSettings();
2697 
2698  $sContent = '';
2699  $sContent .= DesignBoxAdmin($sSettingsC, $sSettingsTab, '', '', 11);
2700  $sContent .= DesignBoxAdmin($sPendingC, $sPendingTab);
2701 
2702  return $sContent;
2703  }
2704 
2706  {
2707  $iId = $this->_oDb->getSettingsCategory();
2708  if (empty($iId)) {
2709  return MsgBox(_t('_sys_request_page_not_found_cpt'));
2710  }
2711 
2712  ch_import('ChWsbAdminSettings');
2713 
2714  $mixedResult = '';
2715  if (isset($_POST['save']) && isset($_POST['cat'])) {
2717  $mixedResult = $oSettings->saveChanges($_POST);
2718  }
2719 
2721  $sResult = $oSettings->getForm();
2722 
2723  if ($mixedResult !== true && !empty($mixedResult)) {
2724  $sResult = $mixedResult . $sResult;
2725  }
2726 
2727  return $sResult;
2728  }
2729 
2735  function ActionEditBlog()
2736  {
2737  $this->CheckLogged();
2738  $iBlogID = (int)ch_get('EditBlogID');
2739 
2740  $iBlogOwner = $this->_oDb->getOwnerByBlogID($iBlogID);
2741  if ((($this->_iVisitorID == $iBlogOwner && $iBlogOwner > 0) || $this->bAdminMode) && $iBlogID > 0) {
2742  $sDescription = process_db_input(ch_get('Description'), CH_TAGS_VALIDATE);
2743 
2744  $aUpdateParams = array(
2745  'blogID' => $iBlogID,
2746  'description' => $sDescription
2747  );
2748  $this->_oDb->performUpdateBlog($aUpdateParams);
2749 
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'));
2755  } else {
2756  return MsgBox(_t('_Error Occured'));
2757  }
2758  }
2759 
2766  {
2767  $this->CheckLogged();
2768  $iBlogID = (int)ch_get('DeleteBlogID');
2769 
2770  $iBlogOwner = $this->_oDb->getOwnerByBlogID($iBlogID);
2771 
2772  if ((($this->_iVisitorID == $iBlogOwner && $iBlogOwner > 0) || $this->bAdminMode) && $iBlogID > 0) {
2773  $aPostsInCategory = $this->_oDb->getPostsInCategory(1, '', $iBlogOwner);
2774  foreach ($aPostsInCategory as $iKeyID => $iPostID) {
2775  $this->ActionDeletePost((int)$iPostID);
2776  }
2777 
2778  $this->_oDb->deleteBlog($iBlogID);
2779  } elseif ($this->_iVisitorID != $iBlogOwner) {
2780  return MsgBox(_t('_Access denied'));
2781  } else {
2782  return MsgBox(_t('_Error Occured'));
2783  }
2784  }
2785 
2790  {
2791  $this->ActionDeleteBlogSQL();
2792  }
2793 
2794  function ActionSharePopup($iPostId)
2795  {
2796  $iPostId = (int)$iPostId;
2797  if ($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);
2802 
2803  require_once(CH_DIRECTORY_PATH_INC . 'shared_sites.inc.php');
2804  header('Content-type:text/html;charset=utf-8');
2805  echo getSitesHtml($sEntryUrl, _t('_Share'));
2806  }
2807  exit;
2808  }
2809 
2810  function ActionPrepareForEdit($sInput)
2811  {
2812  $sResJSHTML = addslashes(htmlspecialchars($sInput));
2813  $sResJSHTML = str_replace("\r\n", '', $sResJSHTML);
2814 
2815  return $sResJSHTML;
2816  }
2817 
2818  function defineUserId()
2819  {
2820  $iMemberId = 0;
2821 
2822  if (false !== ch_get('blogOwnerName')) {
2823  $sNickName = process_db_input(ch_get('blogOwnerName'), CH_TAGS_STRIP);
2824  $iMemberId = $this->_oDb->getMemberIDByNickname($sNickName);
2825  } elseif (ch_get('ownerID')) {
2826  $iMemberId = (int)ch_get('ownerID');
2827  }
2828 
2829  if ($this->isPermalinkEnabled() && $iMemberId == 0 && ch_get('action') == 'show_member_post') {
2830  $sPostUri = process_db_input(ch_get('postUri'), CH_TAGS_STRIP);
2831  $iPostID = $this->_oDb->getPostIDByUri($sPostUri);
2832 
2833  $iMemberId = $this->_oDb->getPostOwnerByID($iPostID);
2834  }
2835 
2836  return $iMemberId;
2837  }
2838 
2840  {
2841  $sCat = '';
2842 
2843  if (false !== ch_get('categoryUri')) {
2844  $sCat = uri2title(process_db_input(ch_get('categoryUri'), CH_TAGS_STRIP));
2845  } elseif (false !== ch_get('category')) {
2846  $sCat = uri2title(process_db_input(ch_get('category'), CH_TAGS_STRIP));
2847  }
2848 
2849  return $sCat;
2850  }
2851 
2853  {
2854  $bEnabled = isset($this->_isPermalinkEnabled) ? $this->_isPermalinkEnabled : ($this->_isPermalinkEnabled = (getParam('permalinks_blogs') == 'on'));
2855 
2856  //if ($this->bAdminMode) $bEnabled = false;
2857  return $bEnabled;
2858  }
2859 
2860  function genBlogFormUrl()
2861  {
2862  $sMainLink = $this->sHomeUrl . $this->_oConfig->sUserExFile;
2863  //if ($this->bAdminMode) $sMainLink = $this->sHomeUrl . $this->_oConfig->sAdminExFile;
2864 
2865  $sLink = $this->isPermalinkEnabled() ? CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink : $sMainLink;
2866 
2867  return $sLink;
2868  }
2869 
2870  function genBlogSubUrl()
2871  {
2872  //$sMainFile = ($this->bAdminMode) ? $this->_oConfig->sAdminExFile : $this->_oConfig->sUserExFile;
2873  $sMainFile = $this->_oConfig->sUserExFile;
2874  if ($this->isPermalinkEnabled()) {
2875  return CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink;
2876  }
2877 
2878  return $this->sHomeUrl . $sMainFile;
2879  }
2880 
2881  function genBlogLink(
2882  $sAction,
2883  $aUser = array(),
2884  $aCategory = array(),
2885  $aPost = array(),
2886  $sTag = '',
2887  $bSubUrl = false
2888  ) {
2889  $sKey = '';
2890  $aService = array();
2891  if ($this->isPermalinkEnabled()) {
2892  $sKey = 'Permalink';
2893 
2894  $aService['User'] = '';
2895  $aService['Category'] = 'category/';
2896  $aService['Post'] = '';
2897  $aService['Tag'] = '';
2898  } else {
2899  $sKey = 'Link';
2900 
2901  $aService['User'] = 'ownerID=';
2902  $aService['Category'] = 'category=';
2903  $aService['Post'] = 'post_id=';
2904  $aService['Tag'] = 'tagKey=';
2905  }
2906 
2907  $sMainLink = (!$bSubUrl) ? $this->genBlogFormUrl() : $this->genBlogSubUrl();
2908 
2909  switch ($sAction) {
2910  case 'home':
2911  $aAction = array('Permalink' => 'home/', 'Link' => '?action=home');
2912  break;
2913  case 'show_member_blog_home':
2914  $aAction = array('Permalink' => 'posts/{User}', 'Link' => '?action=show_member_blog&{User}');
2915  break;
2916  case 'show_member_blog':
2917  $aAction = array(
2918  'Permalink' => 'posts/{User}/{Category}',
2919  'Link' => '?action=show_member_blog&{User}&{Category}'
2920  );
2921  break;
2922  case 'show_member_post':
2923  $aAction = array('Permalink' => 'entry/{Post}', 'Link' => '?action=show_member_post&{User}&{Post}');
2924  break;
2925  case 'search_by_tag':
2926  if ($aUser) {
2927  $aAction = array(
2928  'Permalink' => 'posts/{User}/tag/{Tag}',
2929  'Link' => '?action=search_by_tag&{Tag}&{User}'
2930  );
2931  } else {
2932  $aAction = array('Permalink' => 'tag/{Tag}', 'Link' => '?action=search_by_tag&{Tag}');
2933  }
2934  break;
2935  default :
2936  break;
2937  }
2938  $aFinal = array();
2939 
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 : '';
2944 
2945  $sLink = $aAction[$sKey];
2946 
2947  foreach ($aFinal as $sKey => $sVal) {
2948  $sLink = str_replace('{' . $sKey . '}', $sVal, $sLink);
2949  }
2950 
2951  return $sMainLink . trim($sLink, '/&');
2952  }
2953 
2954  //For RSS generator
2955  function genUrl($iEntryId, $sEntryUri, $sType = 'entry')
2956  {
2957  if ($this->isPermalinkEnabled()) {
2958  $sUrl = CH_WSB_URL_ROOT . $this->_oConfig->sUserExPermalink . "{$sType}/{$sEntryUri}";
2959  } else {
2960  $sUrl = $this->sHomeUrl . $this->_oConfig->sUserExFile . "?action=show_member_post&post_id={$iEntryId}";
2961  }
2962 
2963  return $sUrl;
2964  }
2965 
2966  function Templater($sPostsSect, $sRightSect)
2967  {
2968  $aBlogVariables = array(
2969  'member_section' => $sRightSect,
2970  'post_section' => $sPostsSect
2971  );
2972  $sRetHtml = $this->_oTemplate->parseHtmlByTemplateName('blog', $aBlogVariables);
2973 
2974  return $sRetHtml;
2975  }
2976 
2982  function GenTagsPage()
2983  {
2984  ch_import('ChTemplTagsModule');
2985  $aParam = array(
2986  'type' => 'blog',
2987  'orderby' => 'popular'
2988  );
2989  $sLink = $this->isPermalinkEnabled() ? CH_WSB_URL_ROOT . 'blogs/' . 'tags' : CH_WSB_URL_ROOT . 'modules/cheetah/blogs/blogs.php?action=tags';
2990  $oTags = new ChTemplTagsModule($aParam, _t('_all'), $sLink);
2991 
2992  return $oTags->getCode();
2993  }
2994 
3000  function serviceBlogsCalendarIndexPage($iBlockID)
3001  {
3002  if (!$this->isAllowedBlogsPostsBrowse()) {
3003  return $this->_oTemplate->displayAccessDenied();
3004  }
3005 
3006  return $this->GenBlogCalendar(true, $iBlockID, CH_WSB_URL_ROOT);
3007  }
3008 
3014  function serviceBlogsIndexPage($bShortPgn = true, $iPerPage = 0)
3015  {
3016  if (!$this->isAllowedBlogsPostsBrowse()) {
3017  return $this->_oTemplate->displayAccessDenied();
3018  }
3019 
3020  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
3021  $oBlogSearch = new ChBlogsSearchUnit();
3022  $oBlogSearch->PerformObligatoryInit($this, 4);
3023  $oBlogSearch->aCurrent['paginate']['perPage'] = ($iPerPage > 0 ? $iPerPage : $this->_oConfig->getPerPage('index'));
3024  $aVis = array(CH_WSB_PG_ALL);
3025  if ($this->getUserId()) {
3026  $aVis[] = CH_WSB_PG_MEMBERS;
3027  }
3028  $oBlogSearch->aCurrent['restriction']['allow_view']['value'] = $aVis;
3029  $sCode = $oBlogSearch->displayResultBlock();
3030  $sPostPagination = $oBlogSearch->showPagination2(false, $this->genBlogLink('home'), $bShortPgn);
3031 
3032  if ($oBlogSearch->aCurrent['paginate']['totalNum'] > 0) {
3033  $sCodeBlock = $sCode;
3034 
3035  return array($sCodeBlock, false, $sPostPagination);
3036  }
3037  }
3038 
3046  function serviceBlogsProfilePage($_iProfileID)
3047  {
3048  if (!$this->isAllowedBlogsPostsBrowse()) {
3049  return $this->_oTemplate->displayAccessDenied();
3050  }
3051 
3052  $GLOBALS['oTopMenu']->setCurrentProfileID($_iProfileID);
3053 
3054  require_once($this->_oConfig->getClassPath() . 'ChBlogsSearchUnit.php');
3055  $oBlogSearch = new ChBlogsSearchUnit();
3056  $oBlogSearch->PerformObligatoryInit($this, 4);
3057  $oBlogSearch->aCurrent['paginate']['perPage'] = $this->_oConfig->getPerPage('profile');
3058  $oBlogSearch->aCurrent['restriction']['owner']['value'] = $_iProfileID;
3059  //$oBlogSearch->aCurrent['restriction']['publicStatus']['value'] = 'public';
3060  $sCode = $oBlogSearch->displayResultBlock();
3061 
3062  if ($oBlogSearch->aCurrent['paginate']['totalNum']) {
3063  return <<<EOF
3064 <div class="ch-def-bc-padding">
3065  {$sCode}
3066 </div>
3067 EOF;
3068  }
3069  }
3070 
3078  function serviceBlogsRss()
3079  {
3080  $iPID = (int)ch_get('pid');
3081  $aRssUnits = $this->_oDb->getMemberPostsRSS($iPID);
3082  if (is_array($aRssUnits) && count($aRssUnits) > 0) {
3083 
3084  foreach ($aRssUnits as $iUnitID => $aUnitInfo) {
3085  $iPostID = (int)$aUnitInfo['UnitID'];
3086  $aPost = array('Permalink' => $aUnitInfo['UnitUri'], 'Link' => $iPostID);
3087  $sPostLink = $this->genBlogLink('show_member_post', $aUser, '', $aPost);
3088 
3089  $aRssUnits[$iUnitID]['UnitLink'] = $sPostLink;
3090 
3091  $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
3092  $sPostPhoto = ($sFileName != '') ? CH_BLOGS_IMAGES_URL . 'orig_' . $sFileName : '';
3093  $aRssUnits[$iUnitID]['UnitIcon'] = $sPostPhoto;
3094  }
3095 
3096  $sUnitTitleC = _t('_ch_blog_Blogs');
3097  $sMainLink = 'rss_factory.php?action=blogs&amp;pid=' . $iPID;
3098 
3099  ch_import('ChWsbRssFactory');
3100  $oRssFactory = new ChWsbRssFactory();
3101  $oRssFactory->SetRssHeader();
3102  echo $oRssFactory->GenRssByData($aRssUnits, $sUnitTitleC, $sMainLink);
3103  exit;
3104  }
3105  }
3106 
3113  {
3114  $this->_oTemplate->addCss('blogs_common.css');
3115  }
3116 
3123  {
3124  $oMemberMenu = ch_instance('ChWsbMemberMenu');
3125 
3126  $sPostsCnt = $this->_oDb->getMemberPostsCnt($this->_iVisitorID);
3127 
3128  $aUser = array('Permalink' => getUsername($iMemberID), 'Link' => $iMemberID);
3129 
3130  $aLinkInfo = array(
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,
3136  );
3137 
3138  return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
3139  }
3140 
3147  {
3148  if (!$this->isAllowedPostAdd()) {
3149  return '';
3150  }
3151 
3152  $oMemberMenu = ch_instance('ChWsbMemberMenu');
3153  $aLinkInfo = array(
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'),
3158  );
3159 
3160  return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
3161  }
3162 
3169  {
3170  return $this->_oDb->getMemberPostsCnt((int)$iMemberId);
3171  }
3172 
3173  /*
3174  * Service - response profile delete
3175  */
3177  {
3178  if (!($iProfileId = (int)$oAlert->iObject)) {
3179  return false;
3180  }
3181 
3182  $this->bAdminMode = true;
3183  $aPostsInCategory = $this->_oDb->getPostsInCategory(1, '', $iProfileId);
3184  foreach ($aPostsInCategory as $iKeyID => $iPostID) {
3185  $this->ActionDeletePost((int)$iPostID);
3186  }
3187  $aBlogInfo = $this->_oDb->getBlogInfo($iProfileId);
3188  $this->_oDb->deleteBlog((int)$aBlogInfo['ID']);
3189 
3190  return true;
3191  }
3192 
3194  {
3195  $sUri = $this->_oConfig->getUri();
3196  $sName = 'ch_' . $sUri;
3197 
3198  return array(
3199  'handlers' => array(
3200  array(
3201  'alert_unit' => $sName,
3202  'alert_action' => 'create',
3203  'module_uri' => $sUri,
3204  'module_class' => 'Module',
3205  'module_method' => 'get_wall_post',
3206  'groupable' => 0,
3207  'group_by' => '',
3208  'timeline' => 1,
3209  'outline' => 1
3210  ),
3211  array(
3212  'alert_unit' => $sName,
3213  'alert_action' => 'comment_add',
3214  'module_uri' => $sUri,
3215  'module_class' => 'Module',
3216  'module_method' => 'get_wall_add_comment',
3217  'groupable' => 0,
3218  'group_by' => '',
3219  'timeline' => 1,
3220  'outline' => 0
3221  ),
3222 
3223  //DEPRICATED, saved for backward compatibility
3224  array(
3225  'alert_unit' => $sName,
3226  'alert_action' => 'commentPost',
3227  'module_uri' => $sUri,
3228  'module_class' => 'Module',
3229  'module_method' => 'get_wall_post_comment',
3230  'groupable' => 0,
3231  'group_by' => '',
3232  'timeline' => 1,
3233  'outline' => 0
3234  )
3235  ),
3236  'alerts' => array(
3237  array('unit' => $sName, 'action' => 'create')
3238  )
3239  );
3240  }
3241 
3242  function serviceGetWallPost($aEvent)
3243  {
3244  if (!($aProfile = getProfileInfo($aEvent['owner_id']))) {
3245  return '';
3246  }
3247 
3248  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',',
3249  $aEvent['object_id']) : array($aEvent['object_id']);
3250  rsort($aObjectIds);
3251 
3252  $iDeleted = 0;
3253  $aItems = array();
3254  foreach ($aObjectIds as $iId) {
3255  $aItem = $this->_oDb->getPostInfo($iId);
3256  if (empty($aItem)) {
3257  $iDeleted++;
3258  } else {
3259  if ($aItem['PostStatus'] == 'approval' && $this->oPrivacy->check('view', $aItem['PostID'],
3260  $this->_iVisitorID)
3261  ) {
3262  $aItems[] = $aItem;
3263  }
3264  }
3265  }
3266 
3267  if ($iDeleted == count($aObjectIds)) {
3268  return array('perform_delete' => true);
3269  }
3270 
3271  $iOwner = 0;
3272  if(!empty($aEvent['owner_id']))
3273  $iOwner = (int)$aEvent['owner_id'];
3274 
3275  $iDate = 0;
3276  if(!empty($aEvent['date']))
3277  $iDate = (int)$aEvent['date'];
3278 
3279  $bItems = !empty($aItems) && is_array($aItems);
3280  if($iOwner == 0 && $bItems && !empty($aItems[0]['OwnerID']))
3281  $iOwner = (int)$aItems[0]['OwnerID'];
3282 
3283  if($iDate == 0 && $bItems && !empty($aItems[0]['PostDate']))
3284  $iDate = (int)$aItems[0]['PostDate'];
3285 
3286  if($iOwner == 0 || empty($aItems))
3287  return '';
3288 
3289  $sCss = '';
3290  if ($aEvent['js_mode']) {
3291  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'), true);
3292  } else {
3293  $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'));
3294  }
3295 
3296  $iItems = count($aItems);
3297  $sOwner = getNickName($iOwner);
3298 
3299  //--- Grouped events
3300  if ($iItems > 1) {
3301  if ($iItems > 4) {
3302  $aItems = array_slice($aItems, 0, 4);
3303  }
3304 
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) {
3310  continue;
3311  }
3312 
3313  $aTmplItems[] = array('unit' => $sPostUnit);
3314  }
3315 
3316  return array(
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']
3325  )),
3326  'date' => $iDate
3327  );
3328  }
3329 
3330  //--- Single public event
3331  $aItem = $aItems[0];
3332  $aItem['url'] = $this->genUrl($aItem['PostID'], $aItem['PostUri'], 'entry');
3333 
3334  $oTmpBlogSearch = false;
3335  $sPostUnit = $this->_GenPosts(5, 1, 'post', array('id' => $aItem['PostID']), 'last', $oTmpBlogSearch);
3336  if ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) {
3337  return '';
3338  }
3339 
3340  $sTextWallObject = _t('_ch_blog_wall_object');
3341 
3342  return array(
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'],
3353  )),
3354  'date' => $iDate
3355  );
3356  }
3357 
3358  function serviceGetWallAddComment($aEvent)
3359  {
3360  $iId = (int)$aEvent['object_id'];
3361  $iOwner = (int)$aEvent['owner_id'];
3362  $sOwner = $iOwner != 0 ? getNickName($iOwner) : _t('_Anonymous');
3363 
3364  $aContent = unserialize($aEvent['content']);
3365  if (empty($aContent) || empty($aContent['object_id'])) {
3366  return '';
3367  }
3368 
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);
3373  }
3374 
3375  if (!$this->oPrivacy->check('view', $iItem, $this->_iVisitorID)) {
3376  return;
3377  }
3378 
3379  ch_import('Cmts', $this->_aModule);
3380  $oCmts = new ChBlogsCmts($this->_oConfig->getCommentSystemName(), $iItem);
3381  if (!$oCmts->isEnabled()) {
3382  return '';
3383  }
3384 
3385  $aComment = $oCmts->getCommentRow($iId);
3386  if(empty($aComment) || !is_array($aComment))
3387  return array('perform_delete' => true);
3388 
3389  $sCss = '';
3390  if ($aEvent['js_mode']) {
3391  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'), true);
3392  } else {
3393  $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'));
3394  }
3395 
3396  $oTmpBlogSearch = false;
3397  $sPostUnit = $this->_GenPosts(5, 1, 'post', array('id' => $aItem['PostID']), 'last', $oTmpBlogSearch);
3398  if ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) {
3399  return '';
3400  }
3401 
3402  $aItem['url'] = $this->genUrl($aItem['ID'], $aItem['PostUri'], 'entry');
3403 
3404  $sTextWallObject = _t('_ch_blog_wall_object');
3405 
3406  return array(
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'],
3417  ))
3418  );
3419  }
3420 
3424  function serviceGetWallPostComment($aEvent)
3425  {
3426  $iId = (int)$aEvent['object_id'];
3427  $iOwner = (int)$aEvent['owner_id'];
3428  $sOwner = getNickName($iOwner);
3429 
3430  $aItem = $this->_oDb->getPostInfo($iId);
3431  if (empty($aItem) || !is_array($aItem)) {
3432  return array('perform_delete' => true);
3433  }
3434 
3435  if (!$this->oPrivacy->check('view', $iId, $this->_iVisitorID)) {
3436  return;
3437  }
3438 
3439  $aContent = unserialize($aEvent['content']);
3440  if (empty($aContent) || !isset($aContent['comment_id'])) {
3441  return '';
3442  }
3443 
3444  ch_import('Cmts', $this->_aModule);
3445  $oCmts = new ChBlogsCmts($this->_oConfig->getCommentSystemName(), $iId);
3446  if (!$oCmts->isEnabled()) {
3447  return '';
3448  }
3449 
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);
3454 
3455  $sCss = '';
3456  if ($aEvent['js_mode']) {
3457  $sCss = $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'), true);
3458  } else {
3459  $this->_oTemplate->addCss(array('wall_post.css', 'wall_post_phone.css', 'blogs_common.css'));
3460  }
3461 
3462  $oTmpBlogSearch = false;
3463  $sPostUnit = $this->_GenPosts(5, 1, 'post', array('id' => $aItem['PostID']), 'last', $oTmpBlogSearch);
3464  if ($oTmpBlogSearch->aCurrent['paginate']['totalNum'] == 0) {
3465  return '';
3466  }
3467 
3468  $sTextWallObject = _t('_ch_blog_wall_object');
3469 
3470  return array(
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'],
3481  ))
3482  );
3483  }
3484 
3485  function serviceGetWallPostOutline($aEvent)
3486  {
3487  $sPrefix = 'ch_' . $this->_oConfig->getUri();
3488  $aProfile = getProfileInfo($aEvent['owner_id']);
3489  if (!$aProfile) {
3490  return '';
3491  }
3492 
3493  $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',',
3494  $aEvent['object_id']) : array($aEvent['object_id']);
3495  rsort($aObjectIds);
3496 
3497  $iItems = count($aObjectIds);
3498  $iItemsLimit = 3;
3499  if ($iItems > $iItemsLimit) {
3500  $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit);
3501  }
3502 
3503  $bSave = false;
3504  $aContent = array();
3505  if (!empty($aEvent['content'])) {
3506  $aContent = unserialize($aEvent['content']);
3507  }
3508 
3509  if (!isset($aContent['idims'])) {
3510  $aContent['idims'] = array();
3511  }
3512 
3513  $iDeleted = 0;
3514  $aItems = $aTmplItems = array();
3515  foreach ($aObjectIds as $iId) {
3516  $aItem = $this->_oDb->getPostInfo($iId);
3517  if (empty($aItem)) {
3518  $iDeleted++;
3519  } else {
3520  if ($aItem['PostStatus'] == 'approval' && $this->oPrivacy->check('view', $aItem['PostID'],
3521  $this->_iVisitorID)
3522  ) {
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'];
3531  }
3532 
3533  if (!isset($aContent['idims'][$iId])) {
3534  $sPath = file_exists($aItem['thumb_file_path']) ? $aItem['thumb_file_path'] : $aItem['thumb_file'];
3535  $aContent['idims'][$iId] = ChWsbImageResize::instance()->getImageSize($sPath);
3536  $bSave = true;
3537  }
3538 
3539  $aItem['thumb_dims'] = $aContent['idims'][$iId];
3540 
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'];
3543  }
3544 
3545  $aItem['PostUrl'] = $this->genUrl($aItem['PostID'], $aItem['PostUri'], 'entry');
3546  $aItems[] = $aItem;
3547 
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),
3557  );
3558  }
3559  }
3560  }
3561 
3562  if ($iDeleted == count($aObjectIds)) {
3563  return array('perform_delete' => true);
3564  }
3565 
3566  if (empty($aItems)) {
3567  return '';
3568  }
3569 
3570  $aResult = array();
3571  if ($bSave) {
3572  $aResult['save']['content'] = serialize($aContent);
3573  }
3574 
3575  $sCss = '';
3576  if ($aEvent['js_mode']) {
3577  $sCss = $this->_oTemplate->addCss(array('wall_outline.css'), true);
3578  } else {
3579  $this->_oTemplate->addCss(array('wall_outline.css'));
3580  }
3581 
3582  $iItems = count($aItems);
3583  $iOwner = (int)$aEvent['owner_id'];
3584  $sOwner = getNickName($iOwner);
3585  $sOwnerLink = getProfileLink($iOwner);
3586 
3587  //--- Grouped events
3588  $iItems = count($aItems);
3589  if ($iItems > 1) {
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']
3601  ));
3602 
3603  return $aResult;
3604  }
3605 
3606  //--- Single public event
3607  $aItem = $aItems[0];
3608  $aTmplItem = $aTmplItems[0];
3609 
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']
3621  )));
3622 
3623  return $aResult;
3624  }
3625 
3632  {
3633  return array(
3634  'handlers' => array(
3635  array(
3636  'alert_unit' => 'ch_blogs',
3637  'alert_action' => 'create',
3638  'module_uri' => 'blogs',
3639  'module_class' => 'Module',
3640  'module_method' => 'get_spy_post'
3641  ),
3642  array(
3643  'alert_unit' => 'ch_blogs',
3644  'alert_action' => 'rate',
3645  'module_uri' => 'blogs',
3646  'module_class' => 'Module',
3647  'module_method' => 'get_spy_post'
3648  ),
3649  array(
3650  'alert_unit' => 'ch_blogs',
3651  'alert_action' => 'commentPost',
3652  'module_uri' => 'blogs',
3653  'module_class' => 'Module',
3654  'module_method' => 'get_spy_post'
3655  )
3656  ),
3657  'alerts' => array(
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')
3663  )
3664  );
3665  }
3666 
3676  function serviceGetSpyPost($sAction, $iObjectId = 0, $iSenderId = 0, $aExtraParams = array())
3677  {
3678  $aRet = array();
3679 
3680  $aPostInfo = $this->_oDb->getPostInfo($iObjectId);
3681  if (!$aPostInfo['OwnerID']) {
3682  return $aRet;
3683  }
3684 
3685  $sRecipientNickName = getNickName($aPostInfo['OwnerID']);
3686  $sRecipientProfileLink = getProfileLink($aPostInfo['OwnerID']);
3687  $sSenderNickName = $iSenderId ? getNickName($iSenderId) : _t('_Guest');
3688  $sSenderProfileLink = $iSenderId ? getProfileLink($iSenderId) : 'javascript:void(0)';
3689  $sCaption = $aPostInfo['PostCaption'];
3690  $sEntryUrl = $this->genUrl($iObjectId, $aPostInfo['PostUri']);
3691 
3692  $sLangKey = '';
3693  $iRecipientId = 0;
3694  switch ($sAction) {
3695  case 'create' :
3696  $sLangKey = '_ch_blog_added_spy';
3697  $iRecipientId = 0;
3698  break;
3699 
3700  case 'rate' :
3701  $sLangKey = '_ch_blog_rated_spy';
3702  $iRecipientId = $aPostInfo['OwnerID'];
3703  break;
3704 
3705  case 'commentPost' :
3706  $sLangKey = '_ch_blog_commented_spy';
3707  $iRecipientId = $aPostInfo['OwnerID'];
3708  break;
3709  }
3710 
3711  return array(
3712  'lang_key' => $sLangKey,
3713  'params' => array(
3714  'recipient_p_link' => $sRecipientProfileLink,
3715  'recipient_p_nick' => $sRecipientNickName,
3716  'profile_nick' => $sSenderNickName,
3717  'profile_link' => $sSenderProfileLink,
3718  'post_url' => $sEntryUrl,
3719  'post_caption' => $sCaption,
3720  ),
3721  'recipient_id' => $iRecipientId,
3722  'spy_type' => 'content_activity',
3723  );
3724  }
3725 
3729  function onPostApproveDisapprove($iBPostID, $isApprove)
3730  {
3731  $aPostInfo = $this->_oDb->getPostInfo($iBPostID);
3732  if (!$aPostInfo) {
3733  return;
3734  }
3735 
3736  //reparse tags
3737  ch_import('ChWsbTags');
3738  $oTags = new ChWsbTags();
3739  $oTags->reparseObjTags('blog', $iBPostID);
3740 
3741  //reparse categories
3742  ch_import('ChWsbCategories');
3743  $oCategories = new ChWsbCategories($aPostInfo['OwnerID']);
3744  $oCategories->reparseObjTags('ch_blogs', $iBPostID);
3745 
3746  $oZ = new ChWsbAlerts('ch_blogs', $isApprove ? 'approve' : 'disapprove', $iBPostID, $this->_iVisitorID);
3747  $oZ->alert();
3748  }
3749 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChBlogsModule\serviceGetSpyData
serviceGetSpyData()
Definition: ChBlogsModule.php:3631
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
$oSettings
$oSettings
Definition: advanced_settings.php:20
ChBlogsModule\isAllowedPostEdit
isAllowedPostEdit($iOwnerID, $isPerformAction=false)
Definition: ChBlogsModule.php:472
ChBlogsPageHome
Definition: ChBlogsPageHome.php:10
ChBlogsModule\$iBigThumbSize
$iBigThumbSize
Definition: ChBlogsModule.php:196
ChBlogsModule\serviceGetCommonCss
serviceGetCommonCss()
Definition: ChBlogsModule.php:3112
ChBlogsModule\serviceGetSubscriptionParams
serviceGetSubscriptionParams($sAction, $iEntryId)
Definition: ChBlogsModule.php:1537
ch_login
ch_login($iId, $bRememberMe=false, $bAlert=true)
Definition: profiles.inc.php:514
ChWsbSocialSharing\getInstance
static getInstance()
Definition: ChWsbSocialSharing.php:50
$iMemberId
$iMemberId
Definition: profile.php:91
ChWsbBlogsPageView\$oBlogs
$oBlogs
Definition: ChBlogsModule.php:31
ChTemplFormView
Definition: ChTemplFormView.php:11
ChBlogsModule\GenAdminTabbedPage
GenAdminTabbedPage()
Definition: ChBlogsModule.php:2689
$sMode
else $sMode
Definition: antispam.php:362
ChTemplTagsModule
Definition: ChTemplTagsModule.php:11
ChBlogsModule\isAdmin
isAdmin()
Definition: ChBlogsModule.php:517
ChBlogsModule\GenBlogLists
GenBlogLists($sType='', $bBlock=true)
Definition: ChBlogsModule.php:609
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbBlogsPageView\getBlockCode_PostTags
getBlockCode_PostTags()
Definition: ChBlogsModule.php:64
ChBlogsModule\ActionChangeFeatureStatus
ActionChangeFeatureStatus()
Definition: ChBlogsModule.php:2391
$sLimitFrom
$sLimitFrom
Definition: post_mod_crss.php:49
ChBlogsModule\ActionPrepareForEdit
ActionPrepareForEdit($sInput)
Definition: ChBlogsModule.php:2810
ChWsbPageView
Definition: ChWsbPageView.php:99
ChWsbModule\isLogged
isLogged()
Definition: ChWsbModule.php:113
ChBlogsModule\GenTagsPage
GenTagsPage()
Definition: ChBlogsModule.php:2982
ChWsbRequest\serviceExists
static serviceExists($mixedModule, $sMethod, $sClass="Module")
Definition: ChWsbRequest.php:70
ChBlogsModule\$iPostViewType
$iPostViewType
Definition: ChBlogsModule.php:207
ChBlogsModule\isAllowedPostAdd
isAllowedPostAdd($isPerformAction=false)
Definition: ChBlogsModule.php:458
ChBlogsModule\GenCreateBlogForm
GenCreateBlogForm($bBox=true)
Definition: ChBlogsModule.php:2582
defineTimeInterval
defineTimeInterval($iTime, $bAutoDateConvert=true, $bShort=false)
Definition: utils.inc.php:831
ChBlogsModule\$iThumbSize
$iThumbSize
Definition: ChBlogsModule.php:195
uriGenerate
uriGenerate($s, $sTable, $sField, $iMaxLen=255)
Definition: utils.inc.php:900
name
Core AllowHostnameUnderscore underscores are not permitted in host most browsers do the right thing when faced with an underscore in the host name
Definition: Core.AllowHostnameUnderscore.txt:11
$sCode
$sCode
Definition: explanation.php:19
CHECK_ACTION_RESULT_ALLOWED
const CHECK_ACTION_RESULT_ALLOWED
Definition: membership_levels.inc.php:60
$sResult
$sResult
Definition: advanced_settings.php:26
ChBlogsModule\ActionSharePopup
ActionSharePopup($iPostId)
Definition: ChBlogsModule.php:2794
ChBlogsModule\$iImgSize
$iImgSize
Definition: ChBlogsModule.php:197
ChWsbModule\getUserId
getUserId()
Definition: ChWsbModule.php:122
ChBlogsModule\serviceBlogsRss
serviceBlogsRss()
Definition: ChBlogsModule.php:3078
CH_TAGS_VALIDATE
const CH_TAGS_VALIDATE
Definition: utils.inc.php:24
$aModule
$aModule
Definition: classifieds.php:21
ChBlogsModule
Definition: ChBlogsModule.php:190
ChWsbBlogsPageView\__construct
__construct(&$oBlogs)
Definition: ChBlogsModule.php:33
ChBlogsModule\isAllowedBlogsPostsBrowse
isAllowedBlogsPostsBrowse($isPerformAction=false)
Definition: ChBlogsModule.php:436
ChBlogsModule\_GenPosts
_GenPosts($iPostViewType, $iPerPage, $sMode, $aParams, $sOrder, &$oSearchResult, $sMobileWrapper=false)
Definition: ChBlogsModule.php:895
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
$aResult
$aResult
Definition: index.php:19
ChWsbBlogsPageView\getBlockCode_PostCategories
getBlockCode_PostCategories()
Definition: ChBlogsModule.php:54
ch_get
ch_get($sName)
Definition: utils.inc.php:1664
$oAlert
$oAlert
Definition: embed.php:15
$iCurPage
$iCurPage
Definition: post_mod_crss.php:46
ChWsbPageView\getBlockCaptionMenu
static getBlockCaptionMenu( $iBlockID, $aLinks)
Definition: ChWsbPageView.php:586
CHECK_ACTION_RESULT
const CHECK_ACTION_RESULT
Definition: membership_levels.inc.php:54
ChBlogsModule\GenCommandForms
GenCommandForms()
Definition: ChBlogsModule.php:374
ChBlogsModule\getPostSocialSharingBlock
getPostSocialSharingBlock()
Definition: ChBlogsModule.php:1395
$sCont
$sCont
Definition: get_rss_feed.php:36
uri2title
uri2title($sValue)
Definition: utils.inc.php:51
$sUrl
$sUrl
Definition: cart.php:15
ChBlogsModule\GenBlogHome
GenBlogHome()
Definition: ChBlogsModule.php:595
php
$oZ
$oZ
Definition: db.php:20
ChWsbTags
Definition: ChWsbTags.php:15
$iId
$iId
Definition: license.php:15
ChBlogsModule\serviceGetWallPost
serviceGetWallPost($aEvent)
Definition: ChBlogsModule.php:3242
ChBlogsModule\isAllowedApprove
isAllowedApprove($isPerformAction=false)
Definition: ChBlogsModule.php:494
$sMsg
$sMsg
Definition: actions.inc.php:22
ChBlogsModule\_defineActions
_defineActions()
Definition: ChBlogsModule.php:522
ChBlogsModule\serviceGetWallData
serviceGetWallData()
Definition: ChBlogsModule.php:3193
ChBlogsModule\__construct
__construct($aModule)
Definition: ChBlogsModule.php:219
$sExt
$sExt
Definition: get_file.php:14
ChWsbSubscription\getInstance
static getInstance()
Definition: ChWsbSubscription.php:67
ChBlogsModule\GenMyPageAdmin
GenMyPageAdmin($sMode='')
Definition: ChBlogsModule.php:1838
ChBlogsModule\isPermalinkEnabled
isPermalinkEnabled()
Definition: ChBlogsModule.php:2852
ChBlogsModule\$_iVisitorID
$_iVisitorID
Definition: ChBlogsModule.php:215
ChBlogsModule\$aViewingPostInfo
$aViewingPostInfo
Definition: ChBlogsModule.php:209
ChBlogsModule\CheckLogged
CheckLogged()
Definition: ChBlogsModule.php:248
$iPerPage
else $iPerPage
Definition: browse.php:61
ChBlogsModule\serviceGetMemberMenuItem
serviceGetMemberMenuItem()
Definition: ChBlogsModule.php:3122
ChWsbCategories
Definition: ChWsbCategories.php:13
process_html_output
process_html_output($text, $maxwordlen=100)
Definition: utils.inc.php:333
ChBlogsModule\isAllowedComments
isAllowedComments(&$aBlogPost)
Definition: ChBlogsModule.php:380
ChBlogsModule\getActionsBlock
getActionsBlock()
Definition: ChBlogsModule.php:1430
ChBlogsModule\GenBlogCalendar
GenBlogCalendar($isMiniMode=false, $iBlockID=0, $sDynamicUrl='')
Definition: ChBlogsModule.php:2494
ChBlogsModule\GenPostsOfCategory
GenPostsOfCategory()
Definition: ChBlogsModule.php:934
isModerator
isModerator($iId=0)
Definition: profiles.inc.php:58
$aDate
$aDate
Definition: cron.php:133
a
Filter ExtractStyleBlocks Scope FilterParam ExtractStyleBlocksScope DESCRIPTION< p > If you would like users to be able to define external but only allow them to specify CSS declarations for a specific node and prevent them from fiddling with other use this directive It accepts any valid CSS and will prepend this to any CSS declaration extracted from the document For if this directive is set to< code > selector< code > a
Definition: Filter.ExtractStyleBlocks.Scope.txt:15
ch_html_attribute
ch_html_attribute($mixedInput)
Definition: utils.inc.php:1324
ChWsbMobileTemplate
Definition: ChWsbMobileTemplate.php:11
ChBlogsModule\serviceGetMemberMenuItemAddContent
serviceGetMemberMenuItemAddContent()
Definition: ChBlogsModule.php:3146
ChWsbCmts
Definition: ChWsbCmts.php:99
ChBlogsModule\$oPrivacy
$oPrivacy
Definition: ChBlogsModule.php:214
$oForm
$oForm
Definition: host_tools.php:42
ChBlogsModule\serviceBlogsIndexPage
serviceBlogsIndexPage($bShortPgn=true, $iPerPage=0)
Definition: ChBlogsModule.php:3014
ChBlogsModule\$bAdminMode
$bAdminMode
Definition: ChBlogsModule.php:200
DesignBoxAdmin
DesignBoxAdmin($sTitle, $sContent, $mixedTopItems='', $sBottomItems='', $iIndex=1)
Definition: admin_design.inc.php:50
ChBlogsModule\GenMemberDescrAndCat
GenMemberDescrAndCat($aBlogsRes, $sCategoryName='')
Definition: ChBlogsModule.php:961
ChWsbAlerts
Definition: ChWsbAlerts.php:39
getSitesHtml
getSitesHtml($sLink, $sTitle=false)
Definition: shared_sites.inc.php:37
exit
exit
Definition: cart.php:21
ChBlogsSearchUnit
Definition: ChBlogsSearchUnit.php:20
ChBlogsModule\defineCategoryName
defineCategoryName()
Definition: ChBlogsModule.php:2839
ChBlogsModule\AddNewPostForm
AddNewPostForm($iPostID=0, $bBox=true)
Definition: ChBlogsModule.php:1971
$sType
$sType
Definition: actions.inc.php:11
ChBlogsModule\ActionDeletePost
ActionDeletePost($iPostID=0)
Definition: ChBlogsModule.php:1203
ChBlogsCmts
Definition: ChBlogsCmts.php:11
$oMemberMenu
$oMemberMenu
Definition: member_menu_queries.php:20
ChBlogsModule\serviceGetWallPostComment
serviceGetWallPostComment($aEvent)
Definition: ChBlogsModule.php:3424
ChWsbImageResize\instance
static instance()
Definition: ChWsbImageResize.php:60
ChBlogsModule\GenPostLists
GenPostLists($sType='', $bBlock=true)
Definition: ChBlogsModule.php:836
ChBlogsModule\getPostTagsBlock
getPostTagsBlock()
Definition: ChBlogsModule.php:1640
ChBlogsModule\getCommentsBlock
getCommentsBlock()
Definition: ChBlogsModule.php:1419
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChBlogsModule\getBlogPostBlock
getBlogPostBlock()
Definition: ChBlogsModule.php:1330
ChBlogsModule\genBlogSubUrl
genBlogSubUrl()
Definition: ChBlogsModule.php:2870
ChBlogsModule\$sSpacerPath
$sSpacerPath
Definition: ChBlogsModule.php:203
ChBlogsModule\ActionEditBlog
ActionEditBlog()
Definition: ChBlogsModule.php:2735
ChWsbRssFactory
Definition: ChWsbRssFactory.php:9
get_member_thumbnail
get_member_thumbnail($ID, $float, $bGenProfLink=false, $sForceSex='visitor', $aOnline=array())
Definition: design.inc.php:165
getLoggedId
getLoggedId()
Definition: profiles.inc.php:32
ChBlogsModule\serviceResponseProfileDelete
serviceResponseProfileDelete($oAlert)
Definition: ChBlogsModule.php:3176
$sTitle
$sTitle
Definition: actions.inc.php:13
ChBlogsModule\isAllowedBlogsBrowse
isAllowedBlogsBrowse($isPerformAction=false)
Definition: ChBlogsModule.php:425
ChBlogsModule\defineUserId
defineUserId()
Definition: ChBlogsModule.php:2818
ChBlogsModule\ActionDeleteBlogSQL
ActionDeleteBlogSQL()
Definition: ChBlogsModule.php:2765
getTemplateIcon
getTemplateIcon($sFileName)
Definition: design.inc.php:193
$aProfile
$aProfile
Definition: flash.php:14
ChBlogsModule\getAdministrationSettings
getAdministrationSettings()
Definition: ChBlogsModule.php:2705
ch_append_url_params
ch_append_url_params($sUrl, $mixedParams)
Definition: utils.inc.php:1697
ChBlogsModule\$iIconSize
$iIconSize
Definition: ChBlogsModule.php:194
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
strmaxtextlen
strmaxtextlen($sInput, $iMaxLen=60)
Definition: utils.inc.php:207
htmlspecialchars_adv
htmlspecialchars_adv($string)
Definition: utils.inc.php:302
ChWsbBlogsPageView\getBlockCode_PostComments
getBlockCode_PostComments()
Definition: ChBlogsModule.php:69
title2uri
title2uri($sValue)
Definition: utils.inc.php:42
ChBlogsModule\serviceActionDeleteBlog
serviceActionDeleteBlog()
Definition: ChBlogsModule.php:2789
ChBlogsModule\Templater
Templater($sPostsSect, $sRightSect)
Definition: ChBlogsModule.php:2966
ChWsbViews
Definition: ChWsbViews.php:38
$sTags
$sTags
Definition: actions.inc.php:12
ChBlogsModule\serviceGetWallPostOutline
serviceGetWallPostOutline($aEvent)
Definition: ChBlogsModule.php:3485
ChBlogsModule\getTagLinks
getTagLinks($sTagList, $sType='tag', $sDivider=' ')
Definition: ChBlogsModule.php:2277
type
if(!defined("USER_STATUS_TYPE")) define("USER_STATUS_TYPE" type
Definition: constants.inc.php:13
src
img src
Definition: URI.MungeResources.txt:8
ChBlogsModule\GenBlogAdminIndex
GenBlogAdminIndex()
Definition: ChBlogsModule.php:538
ch_instance
ch_instance($sClassName, $aParams=array(), $aModule=array())
Definition: utils.inc.php:1264
getUsername
getUsername( $ID='')
Definition: profiles.inc.php:443
ChWsbPaginate
Definition: ChWsbPaginate.php:69
ChBlogsCalendar
Definition: ChBlogsCalendar.php:11
ChWsbModule
Definition: ChWsbModule.php:41
ChBlogsModule\serviceGetSpyPost
serviceGetSpyPost($sAction, $iObjectId=0, $iSenderId=0, $aExtraParams=array())
Definition: ChBlogsModule.php:3676
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
time
that in the case of a Adaptation or at a minimum such credit will if a credit for all contributing authors of the Adaptation or Collection then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors For the avoidance of You may only use the credit required by this Section for the purpose of attribution in the manner set out above by exercising Your rights under this You may not implicitly or explicitly assert or imply any connection sponsorship or endorsement by the Original Licensor and or Attribution as of You or Your use of the without the express prior written permission of the Original Licensor and or Attribution Parties Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable if You Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or You must not modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author s honor or reputation Licensor agrees that in those in which any exercise of the right granted in modification or other derogatory action prejudicial to the Original Author s honor and the Licensor will waive or not as this to the fullest extent permitted by the applicable national to enable You to reasonably exercise Your right under Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN LICENSOR OFFERS THE WORK AS IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE STATUTORY OR WITHOUT WARRANTIES OF FITNESS FOR A PARTICULAR OR THE ABSENCE OF LATENT OR OTHER OR THE PRESENCE OF ABSENCE OF WHETHER OR NOT DISCOVERABLE SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED SO SUCH EXCLUSION MAY NOT APPLY TO YOU Limitation on Liability EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Termination This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License Individuals or entities who have received Adaptations or Collections from You under this will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses and will survive any termination of this License Subject to the above terms and the license granted here is Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time
Definition: license.txt:56
value
URI Base such as when URI MakeAbsolute is on You may use a non absolute URI for this value
Definition: URI.Base.txt:11
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
$iDate
$iDate
Definition: cron.php:130
member_auth
member_auth($member=0, $error_handle=true, $bAjx=false)
Definition: admin.inc.php:262
getProfileLink
getProfileLink( $iID, $sLinkAdd='')
Definition: profiles.inc.php:484
method
and that you are informed that you can do these things To protect your we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it For if you distribute copies of the whether gratis or for a you must give the recipients all the rights that we gave you You must make sure that receive or can get the source code If you link other code with the you must provide complete object files to the so that they can relink them with the library after making changes to the library and recompiling it And you must show them these terms so they know their rights We protect your rights with a two step method
Definition: license.txt:49
db_affected_rows
db_affected_rows($oStmt=null)
Definition: db.inc.php:56
CH_WSB_LOCALE_DATE_SHORT
const CH_WSB_LOCALE_DATE_SHORT
Definition: utils.inc.php:15
ChBlogsModule\isAllowedCreatorCommentsDeleteAndEdit
isAllowedCreatorCommentsDeleteAndEdit(&$aBlogPost, $isPerformAction=false)
Definition: ChBlogsModule.php:389
ChBlogsModule\$iViewingPostID
$iViewingPostID
Definition: ChBlogsModule.php:208
ChBlogsModule\GenPostCalendarDay
GenPostCalendarDay()
Definition: ChBlogsModule.php:2516
ChWsbBlogsPageView\getBlockCode_PostSocialSharing
getBlockCode_PostSocialSharing()
Definition: ChBlogsModule.php:79
ChBlogsModule\serviceGetWallAddComment
serviceGetWallAddComment($aEvent)
Definition: ChBlogsModule.php:3358
ChWsbAdminSettings
Definition: ChWsbAdminSettings.php:35
ChBlogsModule\GenSearchResult
GenSearchResult()
Definition: ChBlogsModule.php:2422
ChBlogsModule\getPostFeatureBlock
getPostFeatureBlock()
Definition: ChBlogsModule.php:1764
ChBlogsModule\GenPostPage
GenPostPage($iParamPostID=0)
Definition: ChBlogsModule.php:1803
ChBlogsModule\GenAddCategoryForm
GenAddCategoryForm()
Definition: ChBlogsModule.php:2297
checkAction
checkAction($iMemberId, $actionID, $performAction=false, $iForcedProfID=0, $isCheckMemberStatus=true)
Definition: membership_levels.inc.php:313
process_line_output
process_line_output($text, $maxwordlen=100)
Definition: utils.inc.php:328
CH_TAGS_STRIP
const CH_TAGS_STRIP
Definition: utils.inc.php:22
ChBlogsModule\GenPostListMobile
GenPostListMobile($iAuthor=0, $sMode=false)
Definition: ChBlogsModule.php:739
ChBlogsModule\$sHomeUrl
$sHomeUrl
Definition: ChBlogsModule.php:211
ChBlogsModule\GenMemberBlog
GenMemberBlog($iUserID=0)
Definition: ChBlogsModule.php:1035
ChBlogsModule\isAllowedPostDelete
isAllowedPostDelete($iOwnerID, $isPerformAction=false)
Definition: ChBlogsModule.php:483
ChBlogsModule\serviceBlogsCalendarIndexPage
serviceBlogsCalendarIndexPage($iBlockID)
Definition: ChBlogsModule.php:3000
$aVars
$aVars
Definition: license.php:101
ChWsbBlogsPageView\getBlockCode_PostActions
getBlockCode_PostActions()
Definition: ChBlogsModule.php:39
isBlocked
isBlocked($iFirstProfile, $iSecondProfile)
Definition: utils.inc.php:128
defineMembershipActions
defineMembershipActions($aActionsAll, $sPrefix='CH_')
Definition: membership_levels.inc.php:744
ChBlogsModule\$iLastPostedPostID
$iLastPostedPostID
Definition: ChBlogsModule.php:205
ChWsbBlogsPageView\getBlockCode_PostOverview
getBlockCode_PostOverview()
Definition: ChBlogsModule.php:49
$aUser
$aUser
Definition: profiles.inc.php:74
$iPage
$iPage
Definition: browse.php:50
ChBlogsModule\genBlogLink
genBlogLink( $sAction, $aUser=array(), $aCategory=array(), $aPost=array(), $sTag='', $bSubUrl=false)
Definition: ChBlogsModule.php:2881
ChBlogsModule\serviceBlogsProfilePage
serviceBlogsProfilePage($_iProfileID)
Definition: ChBlogsModule.php:3046
ChBlogsModule\isAllowedBlogPostView
isAllowedBlogPostView($iOwnerID, $isPerformAction=false)
Definition: ChBlogsModule.php:414
default
Attr AllowedFrameTargets _parent and _top Values should be as validation will be done in a case sensitive manner despite W3C s recommendation XHTML Strict does not permit the target attribute so this directive will have no effect in that doctype XHTML does not enable the Target module by default
Definition: Attr.AllowedFrameTargets.txt:10
ChBlogsModule\genUrl
genUrl($iEntryId, $sEntryUri, $sType='entry')
Definition: ChBlogsModule.php:2955
ChWsbBlogsPageView\getBlockCode_PostRate
getBlockCode_PostRate()
Definition: ChBlogsModule.php:44
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChBlogsModule\ActionDelImg
ActionDelImg()
Definition: ChBlogsModule.php:1159
$aForm
$aForm
Definition: forgot.php:43
CH_WSB_PG_MEMBERS
const CH_WSB_PG_MEMBERS
Definition: ChWsbPrivacy.php:13
ChBlogsModule\isAllowedBlogView
isAllowedBlogView($iOwnerID, $isPerformAction=false)
Definition: ChBlogsModule.php:403
$sCaption
$sCaption
Definition: tellfriend.php:39
ChBlogsModule\getRateBlock
getRateBlock()
Definition: ChBlogsModule.php:1562
ChBlogsModule\onPostApproveDisapprove
onPostApproveDisapprove($iBPostID, $isApprove)
Definition: ChBlogsModule.php:3729
$sAction
$sAction
Definition: categories.php:274
$iTotalNum
if(isset($_POST['crsss']) &&is_array($_POST['crsss'])) $iTotalNum
Definition: post_mod_crss.php:40
ChWsbBlogsPageView
Definition: ChBlogsModule.php:30
DesignBoxContent
DesignBoxContent($title, $content, $db_num=0, $caption_item='', $bottom_item='')
Definition: design.inc.php:78
ChWsbBlogsPageView\getBlockCode_PostView
getBlockCode_PostView()
Definition: ChBlogsModule.php:74
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
ChWsbBlogsPageView\getBlockCode_PostFeature
getBlockCode_PostFeature()
Definition: ChBlogsModule.php:59
imageResize
imageResize( $srcFilename, $dstFilename, $sizeX, $sizeY, $forceJPGOutput=false, $isSquare=false)
Definition: images.inc.php:29
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
getLocaleDate
getLocaleDate($sTimestamp='', $iCode=CH_WSB_LOCALE_DATE_SHORT)
Definition: utils.inc.php:70
ChBlogsPrivacy
Definition: ChBlogsPrivacy.php:11
ChBlogsModule\isAllowedShare
isAllowedShare(&$aDataEntry)
Definition: ChBlogsModule.php:508
as
as
Definition: Filter.ExtractStyleBlocks.Escaping.txt:10
ChBlogsModule\GetHeaderString
GetHeaderString()
Definition: ChBlogsModule.php:260
ChBlogsModule\serviceGetPostsCountForMember
serviceGetPostsCountForMember($iMemberId)
Definition: ChBlogsModule.php:3168
ChBlogsModule\getViewingPostInfo
getViewingPostInfo()
Definition: ChBlogsModule.php:1275
$sName
$sName
Definition: ChWsbAdminTools.php:853
ChBlogsModule\getPostCategoriesBlock
getPostCategoriesBlock()
Definition: ChBlogsModule.php:1711
ChBlogsModule\isAllowedBlogPostSearch
isAllowedBlogPostSearch($isPerformAction=false)
Definition: ChBlogsModule.php:447
ChBlogsModule\$sHomePath
$sHomePath
Definition: ChBlogsModule.php:212
ChBlogsModule\getPostOverviewBlock
getPostOverviewBlock()
Definition: ChBlogsModule.php:1581
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
form
iii in the case of the organization that transmits the broadcast Work means the literary and or artistic work offered under the terms of this License including without limitation any production in the scientific and artistic whatever may be the mode or form of its expression including digital form
Definition: license.txt:19
ChTemplVotingView
Definition: ChTemplVotingView.php:14
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ChBlogsModule\genBlogFormUrl
genBlogFormUrl()
Definition: ChBlogsModule.php:2860
isMember
isMember($iId=0)
Definition: profiles.inc.php:44
$sUser
$sUser
Definition: r.php:13
$oSubscription
$oSubscription
Definition: notifies.php:28
ChBlogsModule\$_sPageHeader
$_sPageHeader
Definition: ChBlogsModule.php:216