Cheetah
ChGroupsModule.php
Go to the documentation of this file.
1 <?php
2 
8 function ch_groups_import ($sClassPostfix, $aModuleOverwright = array())
9 {
11  $a = $aModuleOverwright ? $aModuleOverwright : $aModule;
12  if (!$a || $a['uri'] != 'groups') {
13  $oMain = ChWsbModule::getInstance('ChGroupsModule');
14  $a = $oMain->_aModule;
15  }
16  ch_import ($sClassPostfix, $a) ;
17 }
18 
19 ch_import('ChWsbPaginate');
20 ch_import('ChWsbAlerts');
21 ch_import('ChWsbTwigModule');
22 
23 define ('CH_GROUPS_PHOTOS_CAT', 'Groups');
24 define ('CH_GROUPS_PHOTOS_TAG', 'groups');
25 
26 define ('CH_GROUPS_VIDEOS_CAT', 'Groups');
27 define ('CH_GROUPS_VIDEOS_TAG', 'groups');
28 
29 define ('CH_GROUPS_SOUNDS_CAT', 'Groups');
30 define ('CH_GROUPS_SOUNDS_TAG', 'groups');
31 
32 define ('CH_GROUPS_FILES_CAT', 'Groups');
33 define ('CH_GROUPS_FILES_TAG', 'groups');
34 
35 define ('CH_GROUPS_MAX_FANS', 1000);
36 
153 {
155  var $_aQuickCache = array ();
156 
158  {
159  parent::__construct($aModule);
160  $this->_sFilterName = 'ch_groups_filter';
161  $this->_sPrefix = 'ch_groups';
162 
163  ch_import ('Privacy', $aModule);
164  $this->_oPrivacy = new ChGroupsPrivacy($this);
165 
166  $GLOBALS['oChGroupsModule'] = &$this;
167  }
168 
169  function actionHome ()
170  {
171  parent::_actionHome(_t('_ch_groups_page_title_home'));
172  }
173 
174  function actionFiles ($sUri)
175  {
176  parent::_actionFiles ($sUri, _t('_ch_groups_page_title_files'));
177  }
178 
179  function actionSounds ($sUri)
180  {
181  parent::_actionSounds ($sUri, _t('_ch_groups_page_title_sounds'));
182  }
183 
184  function actionVideos ($sUri)
185  {
186  parent::_actionVideos ($sUri, _t('_ch_groups_page_title_videos'));
187  }
188 
189  function actionPhotos ($sUri)
190  {
191  parent::_actionPhotos ($sUri, _t('_ch_groups_page_title_photos'));
192  }
193 
194  function actionComments ($sUri)
195  {
196  parent::_actionComments ($sUri, _t('_ch_groups_page_title_comments'));
197  }
198 
199  function actionBrowseFans ($sUri)
200  {
201  parent::_actionBrowseFans ($sUri, 'isAllowedViewFans', 'getFansBrowse', $this->_oDb->getParam('ch_groups_perpage_browse_fans'), 'browse_fans/', _t('_ch_groups_page_title_fans'));
202  }
203 
204  function actionView ($sUri)
205  {
206  parent::_actionView ($sUri, _t('_ch_groups_msg_pending_approval'));
207  }
208 
209  function actionUploadPhotos ($sUri)
210  {
211  parent::_actionUploadMedia ($sUri, 'isAllowedUploadPhotos', 'images', array ('images_choice', 'images_upload'), _t('_ch_groups_page_title_upload_photos'));
212  }
213 
214  function actionUploadVideos ($sUri)
215  {
216  parent::_actionUploadMedia ($sUri, 'isAllowedUploadVideos', 'videos', array ('videos_choice', 'videos_upload'), _t('_ch_groups_page_title_upload_videos'));
217  }
218 
219  function actionUploadSounds ($sUri)
220  {
221  parent::_actionUploadMedia ($sUri, 'isAllowedUploadSounds', 'sounds', array ('sounds_choice', 'sounds_upload'), _t('_ch_groups_page_title_upload_sounds'));
222  }
223 
224  function actionUploadFiles ($sUri)
225  {
226  parent::_actionUploadMedia ($sUri, 'isAllowedUploadFiles', 'files', array ('files_choice', 'files_upload'), _t('_ch_groups_page_title_upload_files'));
227  }
228 
229  function actionBroadcast ($iEntryId)
230  {
231  parent::_actionBroadcast ($iEntryId, _t('_ch_groups_page_title_broadcast'), _t('_ch_groups_msg_broadcast_no_recipients'), _t('_ch_groups_msg_broadcast_message_sent'));
232  }
233 
234  function actionInvite ($iEntryId)
235  {
236  parent::_actionInvite ($iEntryId, 'ch_groups_invitation', $this->_oDb->getParam('ch_groups_max_email_invitations'), _t('_ch_groups_msg_invitation_sent'), _t('_ch_groups_msg_no_users_to_invite'), _t('_ch_groups_page_title_invite'));
237  }
238 
239  function _getInviteParams ($aDataEntry, $aInviter)
240  {
241  return array (
242  'GroupName' => $aDataEntry['title'],
243  'GroupLocation' => _t($GLOBALS['aPreValues']['Country'][$aDataEntry['country']]['LKey']) . (trim($aDataEntry['city']) ? ', '.$aDataEntry['city'] : '') . ', ' . $aDataEntry['zip'],
244  'GroupUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aDataEntry['uri'],
245  'InviterUrl' => $aInviter ? getProfileLink($aInviter['ID']) : 'javascript:void(0);',
246  'InviterNickName' => $aInviter ? getNickName($aInviter['ID']) : _t('_ch_groups_user_unknown'),
247  'InvitationText' => nl2br(process_pass_data(strip_tags($_POST['inviter_text']))),
248  );
249  }
250 
251  function actionCalendar ($iYear = '', $iMonth = '')
252  {
253  parent::_actionCalendar ($iYear, $iMonth, _t('_ch_groups_page_title_calendar'));
254  }
255 
256  function actionSearch ($sKeyword = '', $sCategory = '')
257  {
258  parent::_actionSearch ($sKeyword, $sCategory, _t('_ch_groups_page_title_search'));
259  }
260 
261  function actionAdd ()
262  {
263  parent::_actionAdd (_t('_ch_groups_page_title_add'));
264  }
265 
266  function actionEdit ($iEntryId)
267  {
268  parent::_actionEdit ($iEntryId, _t('_ch_groups_page_title_edit'));
269  }
270 
271  function actionDelete ($iEntryId)
272  {
273  parent::_actionDelete ($iEntryId, _t('_ch_groups_msg_group_was_deleted'));
274  }
275 
276  function actionMarkFeatured ($iEntryId)
277  {
278  parent::_actionMarkFeatured ($iEntryId, _t('_ch_groups_msg_added_to_featured'), _t('_ch_groups_msg_removed_from_featured'));
279  }
280 
281  function actionJoin ($iEntryId, $iProfileId)
282  {
283  parent::_actionJoin ($iEntryId, $iProfileId, _t('_ch_groups_msg_joined_already'), _t('_ch_groups_msg_joined_request_pending'), _t('_ch_groups_msg_join_success'), _t('_ch_groups_msg_join_success_pending'), _t('_ch_groups_msg_leave_success'));
284  }
285 
286  function actionSharePopup ($iEntryId)
287  {
288  parent::_actionSharePopup ($iEntryId, _t('_ch_groups_caption_share_group'));
289  }
290 
291  function actionManageFansPopup ($iEntryId)
292  {
293  parent::_actionManageFansPopup ($iEntryId, _t('_ch_groups_caption_manage_fans'), 'getFans', 'isAllowedManageFans', 'isAllowedManageAdmins', CH_GROUPS_MAX_FANS);
294  }
295 
296  function actionTags()
297  {
298  parent::_actionTags (_t('_ch_groups_page_title_tags'));
299  }
300 
301  function actionCategories()
302  {
303  parent::_actionCategories (_t('_ch_groups_page_title_categories'));
304  }
305 
306  function actionDownload ($iEntryId, $iMediaId)
307  {
308  $aFileInfo = $this->_oDb->getMedia ((int)$iEntryId, (int)$iMediaId, 'files');
309 
310  if (!$aFileInfo || !($aDataEntry = $this->_oDb->getEntryByIdAndOwner((int)$iEntryId, 0, true))) {
311  $this->_oTemplate->displayPageNotFound ();
312  exit;
313  }
314 
315  if (!$this->isAllowedView ($aDataEntry)) {
316  $this->_oTemplate->displayAccessDenied ();
317  exit;
318  }
319 
320  parent::_actionDownload($aFileInfo, 'media_id');
321  }
322 
323  // ================================== external actions
324 
330  {
331  if (!$this->_oDb->isAnyPublicContent())
332  return '';
333 
334  ch_import ('PageMain', $this->_aModule);
335  $o = new ChGroupsPageMain ($this);
336  $o->sUrlStart = CH_WSB_URL_ROOT . '?';
337 
338  $sDefaultHomepageTab = $this->_oDb->getParam('ch_groups_homepage_default_tab');
339  $sBrowseMode = $sDefaultHomepageTab;
340  switch ($_GET['ch_groups_filter']) {
341  case 'featured':
342  case 'recent':
343  case 'top':
344  case 'popular':
345  case $sDefaultHomepageTab:
346  $sBrowseMode = $_GET['ch_groups_filter'];
347  break;
348  }
349 
350  return $o->ajaxBrowse(
351  $sBrowseMode,
352  $this->_oDb->getParam('ch_groups_perpage_homepage'),
353  array(
354  _t('_ch_groups_tab_featured') => array('href' => CH_WSB_URL_ROOT . '?ch_groups_filter=featured', 'active' => 'featured' == $sBrowseMode, 'dynamic' => true),
355  _t('_ch_groups_tab_recent') => array('href' => CH_WSB_URL_ROOT . '?ch_groups_filter=recent', 'active' => 'recent' == $sBrowseMode, 'dynamic' => true),
356  _t('_ch_groups_tab_top') => array('href' => CH_WSB_URL_ROOT . '?ch_groups_filter=top', 'active' => 'top' == $sBrowseMode, 'dynamic' => true),
357  _t('_ch_groups_tab_popular') => array('href' => CH_WSB_URL_ROOT . '?ch_groups_filter=popular', 'active' => 'popular' == $sBrowseMode, 'dynamic' => true),
358  )
359  );
360  }
361 
368  {
369  $iProfileId = (int)$iProfileId;
371  ch_import ('PageMain', $this->_aModule);
372  $o = new ChGroupsPageMain ($this);
373  $o->sUrlStart = getProfileLink($aProfile['ID']) . '?';
374 
375  return $o->ajaxBrowse(
376  'user',
377  $this->_oDb->getParam('ch_groups_perpage_profile'),
378  array(),
380  true,
381  false
382  );
383  }
384 
391  {
392  $iProfileId = (int)$iProfileId;
394  ch_import ('PageMain', $this->_aModule);
395  $o = new ChGroupsPageMain ($this);
396  $o->sUrlStart = $_SERVER['PHP_SELF'] . '?' . ch_encode_url_params($_GET, array('page'));
397  return $o->ajaxBrowse(
398  'joined',
399  $this->_oDb->getParam('ch_groups_perpage_profile'),
400  array(),
402  true,
403  false
404  );
405  }
406 
408  {
409  return parent::_serviceGetMemberMenuItem (_t('_ch_groups'), _t('_ch_groups'), 'users');
410  }
411 
413  {
414  if (!$this->isAllowedAdd())
415  return '';
416  return parent::_serviceGetMemberMenuItem (_t('_ch_groups_group_single'), _t('_ch_groups_group_single'), 'users', false, '&ch_groups_filter=add_group');
417  }
418 
419  function serviceGetWallPost ($aEvent)
420  {
421  $aParams = array(
422  'icon' => 'users',
423  'txt_object' => '_ch_groups_wall_object',
424  'txt_added_new_single' => '_ch_groups_wall_added_new',
425  'txt_added_new_title_single' => '_ch_groups_wall_added_new_title',
426  'txt_added_new_plural' => '_ch_groups_wall_added_new_items',
427  'txt_added_new_title_plural' => '_ch_groups_wall_added_new_title_items',
428  'txt_privacy_view_event' => 'view_group',
429  'obj_privacy' => $this->_oPrivacy,
430  'fields' => array(
431  'owner' => 'author_id',
432  'date' => 'created'
433  )
434  );
435  return parent::_serviceGetWallPost ($aEvent, $aParams);
436  }
437 
438  function serviceGetWallAddComment($aEvent)
439  {
440  $aParams = array(
441  'txt_privacy_view_event' => 'view_group',
442  'obj_privacy' => $this->_oPrivacy
443  );
444  return parent::_serviceGetWallAddComment($aEvent, $aParams);
445  }
446 
450  function serviceGetWallPostComment($aEvent)
451  {
452  $aParams = array(
453  'txt_privacy_view_event' => 'view_group',
454  'obj_privacy' => $this->_oPrivacy
455  );
456  return parent::_serviceGetWallPostComment($aEvent, $aParams);
457  }
458 
459  function serviceGetWallPostOutline($aEvent)
460  {
461  $aParams = array(
462  'txt_privacy_view_event' => 'view_group',
463  'obj_privacy' => $this->_oPrivacy,
464  'templates' => array(
465  'grouped' => 'wall_outline_grouped'
466  )
467  );
468  return parent::_serviceGetWallPostOutline($aEvent, 'users', $aParams);
469  }
470 
471  function serviceGetSpyPost($sAction, $iObjectId = 0, $iSenderId = 0, $aExtraParams = array())
472  {
473  return parent::_serviceGetSpyPost($sAction, $iObjectId, $iSenderId, $aExtraParams, array(
474  'add' => '_ch_groups_spy_post',
475  'change' => '_ch_groups_spy_post_change',
476  'join' => '_ch_groups_spy_join',
477  'rate' => '_ch_groups_spy_rate',
478  'commentPost' => '_ch_groups_spy_comment',
479  ));
480  }
481 
483  {
484  $a = array (
485  'change' => _t('_ch_groups_sbs_change'),
486  'commentPost' => _t('_ch_groups_sbs_comment'),
487  'rate' => _t('_ch_groups_sbs_rate'),
488  'join' => _t('_ch_groups_sbs_join'),
489  );
490 
491  return parent::_serviceGetSubscriptionParams ($sAction, $iEntryId, $a);
492  }
493 
497  function serviceMapInstall()
498  {
499  if (!ChWsbModule::getInstance('ChWmapModule'))
500  return false;
501 
502  return ChWsbService::call('wmap', 'part_install', array('groups', array(
503  'part' => 'groups',
504  'title' => '_ch_groups',
505  'title_singular' => '_ch_groups_group_single',
506  'icon' => 'modules/cheetah/groups/|map_marker.png',
507  'icon_site' => 'users',
508  'join_table' => 'ch_groups_main',
509  'join_where' => "AND `p`.`status` = 'approved'",
510  'join_field_id' => 'id',
511  'join_field_country' => 'country',
512  'join_field_city' => 'city',
513  'join_field_state' => '',
514  'join_field_zip' => 'zip',
515  'join_field_address' => '',
516  'join_field_title' => 'title',
517  'join_field_uri' => 'uri',
518  'join_field_author' => 'author_id',
519  'join_field_privacy' => 'allow_view_group_to',
520  'permalink' => 'modules/?r=groups/view/',
521  )));
522  }
523 
524  // ================================== admin actions
525 
526  function actionAdministration ($sUrl = '')
527  {
528  if (!$this->isAdmin()) {
529  $this->_oTemplate->displayAccessDenied ();
530  return;
531  }
532 
533  $this->_oTemplate->pageStart();
534 
535  $aMenu = array(
536  'pending_approval' => array(
537  'title' => _t('_ch_groups_menu_admin_pending_approval'),
538  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/pending_approval',
539  '_func' => array ('name' => 'actionAdministrationManage', 'params' => array(false, 'administration/pending_approval')),
540  ),
541  'admin_entries' => array(
542  'title' => _t('_ch_groups_menu_admin_entries'),
543  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/admin_entries',
544  '_func' => array ('name' => 'actionAdministrationManage', 'params' => array(true, 'administration/admin_entries')),
545  ),
546  'create' => array(
547  'title' => _t('_ch_groups_menu_admin_add_entry'),
548  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/create',
549  '_func' => array ('name' => 'actionAdministrationCreateEntry', 'params' => array()),
550  ),
551  'settings' => array(
552  'title' => _t('_ch_groups_menu_admin_settings'),
553  'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() . 'administration/settings',
554  '_func' => array ('name' => 'actionAdministrationSettings', 'params' => array()),
555  ),
556  );
557 
558  if (empty($aMenu[$sUrl]))
559  $sUrl = 'pending_approval';
560 
561  $aMenu[$sUrl]['active'] = 1;
562  $sContent = call_user_func_array (array($this, $aMenu[$sUrl]['_func']['name']), $aMenu[$sUrl]['_func']['params']);
563 
564  echo $this->_oTemplate->adminBlock ($sContent, _t('_ch_groups_page_title_administration'), $aMenu);
565  $this->_oTemplate->addCssAdmin (array('admin.css', 'unit.css', 'twig.css', 'main.css', 'forms_extra.css', 'forms_adv.css'));
566  $this->_oTemplate->pageCodeAdmin (_t('_ch_groups_page_title_administration'));
567  }
568 
570  {
571  return parent::_actionAdministrationSettings ('Groups');
572  }
573 
574  function actionAdministrationManage ($isAdminEntries = false, $sUrl = '')
575  {
576  return parent::_actionAdministrationManage ($isAdminEntries, '_ch_groups_admin_delete', '_ch_groups_admin_activate', $sUrl);
577  }
578 
579  // ================================== events
580 
581 
582  function onEventJoinRequest ($iEntryId, $iProfileId, $aDataEntry)
583  {
584  parent::_onEventJoinRequest ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_join_request', CH_GROUPS_MAX_FANS);
585  }
586 
587  function onEventJoinReject ($iEntryId, $iProfileId, $aDataEntry)
588  {
589  parent::_onEventJoinReject ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_join_reject');
590  }
591 
592  function onEventFanRemove ($iEntryId, $iProfileId, $aDataEntry)
593  {
594  parent::_onEventFanRemove ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_fan_remove');
595  }
596 
597  function onEventFanBecomeAdmin ($iEntryId, $iProfileId, $aDataEntry)
598  {
599  parent::_onEventFanBecomeAdmin ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_fan_become_admin');
600  }
601 
602  function onEventAdminBecomeFan ($iEntryId, $iProfileId, $aDataEntry)
603  {
604  parent::_onEventAdminBecomeFan ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_admin_become_fan');
605  }
606 
607  function onEventJoinConfirm ($iEntryId, $iProfileId, $aDataEntry)
608  {
609  parent::_onEventJoinConfirm ($iEntryId, $iProfileId, $aDataEntry, 'ch_groups_join_confirm');
610  }
611 
612  // ================================== permissions
613 
614  function isAllowedView ($aDataEntry, $isPerformAction = false)
615  {
616  // admin and owner always have access
617  if ($this->isAdmin() || $aDataEntry['author_id'] == $this->_iProfileId)
618  return true;
619 
620  // check admin acl
621  $this->_defineActions();
622  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_VIEW_GROUP, $isPerformAction);
624  return false;
625 
626  // check user group
627  return $this->_oPrivacy->check('view_group', $aDataEntry['id'], $this->_iProfileId);
628  }
629 
630  function isAllowedBrowse ($isPerformAction = false)
631  {
632  if ($this->isAdmin())
633  return true;
634  $this->_defineActions();
635  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_BROWSE, $isPerformAction);
637  }
638 
639  function isAllowedSearch ($isPerformAction = false)
640  {
641  if ($this->isAdmin())
642  return true;
643  $this->_defineActions();
644  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_SEARCH, $isPerformAction);
646  }
647 
648  function isAllowedAdd ($isPerformAction = false)
649  {
650  if ($this->isAdmin())
651  return true;
652  if (!$GLOBALS['logged']['member'])
653  return false;
654  $this->_defineActions();
655  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_ADD_GROUP, $isPerformAction);
657  }
658 
659  function isAllowedEdit ($aDataEntry, $isPerformAction = false)
660  {
661  if ($this->isAdmin() || ($GLOBALS['logged']['member'] && $aDataEntry['author_id'] == $this->_iProfileId && isProfileActive($this->_iProfileId)))
662  return true;
663 
664  // check acl
665  $this->_defineActions();
666  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_EDIT_ANY_GROUP, $isPerformAction);
668  }
669 
670  function isAllowedMarkAsFeatured ($aDataEntry, $isPerformAction = false)
671  {
672  if ($this->isAdmin())
673  return true;
674  $this->_defineActions();
675  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_MARK_AS_FEATURED, $isPerformAction);
677  }
678 
679  function isAllowedBroadcast ($aDataEntry, $isPerformAction = false)
680  {
681  if ($this->isAdmin() || $this->isEntryAdmin($aDataEntry))
682  return true;
683  $this->_defineActions();
684  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_BROADCAST_MESSAGE, $isPerformAction);
686  }
687 
688  function isAllowedDelete (&$aDataEntry, $isPerformAction = false)
689  {
690  if ($this->isAdmin() || ($GLOBALS['logged']['member'] && $aDataEntry['author_id'] == $this->_iProfileId && isProfileActive($this->_iProfileId)))
691  return true;
692  $this->_defineActions();
693  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_DELETE_ANY_GROUP, $isPerformAction);
695  }
696 
697  function isAllowedActivate (&$aDataEntry, $isPerformAction = false)
698  {
699  if ($aDataEntry['status'] != 'pending')
700  return false;
701  if ($this->isAdmin())
702  return true;
703  $this->_defineActions();
704  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_APPROVE_GROUPS, $isPerformAction);
706  }
707 
708  function isAllowedJoin (&$aDataEntry)
709  {
710  if (!$this->_iProfileId)
711  return false;
712  return $this->_oPrivacy->check('join', $aDataEntry['id'], $this->_iProfileId);
713  }
714 
715  function isAllowedSendInvitation (&$aDataEntry)
716  {
717  return $this->isAdmin() || $this->isEntryAdmin($aDataEntry) ? true : false;
718  }
719 
720  function isAllowedShare (&$aDataEntry)
721  {
722  if($aDataEntry['allow_view_group_to'] != CH_WSB_PG_ALL)
723  return false;
724 
725  return true;
726  }
727 
728  function isAllowedPostInForum(&$aDataEntry, $iProfileId = -1)
729  {
730  if (-1 == $iProfileId)
732  return $this->isAdmin() || $this->isEntryAdmin($aDataEntry) || $this->_oPrivacy->check('post_in_forum', $aDataEntry['id'], $iProfileId);
733  }
734 
735  function isAllowedReadForum(&$aDataEntry, $iProfileId = -1)
736  {
737  if (-1 == $iProfileId)
739  return $this->isAdmin() || $this->isEntryAdmin($aDataEntry) || $this->_oPrivacy->check('view_forum', $aDataEntry['id'], $iProfileId);
740  }
741 
742  function isAllowedRate(&$aDataEntry)
743  {
744  if ($this->isAdmin())
745  return true;
746  return $this->_oPrivacy->check('rate', $aDataEntry['id'], $this->_iProfileId);
747  }
748 
749  function isAllowedComments(&$aDataEntry)
750  {
751  if ($this->isAdmin())
752  return true;
753  return $this->_oPrivacy->check('comment', $aDataEntry['id'], $this->_iProfileId);
754  }
755 
756  function isAllowedViewFans(&$aDataEntry)
757  {
758  if ($this->isAdmin())
759  return true;
760  return $this->_oPrivacy->check('view_fans', $aDataEntry['id'], $this->_iProfileId);
761  }
762 
763  function isAllowedUploadPhotos(&$aDataEntry)
764  {
765  if (!ChWsbRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader'))
766  return false;
767  if (!$this->_iProfileId)
768  return false;
769  if ($this->isAdmin())
770  return true;
771  if (!$this->isMembershipEnabledForImages())
772  return false;
773  return $this->_oPrivacy->check('upload_photos', $aDataEntry['id'], $this->_iProfileId);
774  }
775 
776  function isAllowedUploadVideos(&$aDataEntry)
777  {
778  if (!ChWsbRequest::serviceExists('videos', 'perform_video_upload', 'Uploader'))
779  return false;
780  if (!$this->_iProfileId)
781  return false;
782  if ($this->isAdmin())
783  return true;
784  if (!$this->isMembershipEnabledForVideos())
785  return false;
786  return $this->_oPrivacy->check('upload_videos', $aDataEntry['id'], $this->_iProfileId);
787  }
788 
789  function isAllowedUploadSounds(&$aDataEntry)
790  {
791  if (!ChWsbRequest::serviceExists('sounds', 'perform_music_upload', 'Uploader'))
792  return false;
793  if (!$this->_iProfileId)
794  return false;
795  if ($this->isAdmin())
796  return true;
797  if (!$this->isMembershipEnabledForSounds())
798  return false;
799  return $this->_oPrivacy->check('upload_sounds', $aDataEntry['id'], $this->_iProfileId);
800  }
801 
802  function isAllowedUploadFiles(&$aDataEntry)
803  {
804  if (!ChWsbRequest::serviceExists('files', 'perform_file_upload', 'Uploader'))
805  return false;
806  if (!$this->_iProfileId)
807  return false;
808  if ($this->isAdmin())
809  return true;
810  if (!$this->isMembershipEnabledForFiles())
811  return false;
812  return $this->_oPrivacy->check('upload_files', $aDataEntry['id'], $this->_iProfileId);
813  }
814 
815  function isAllowedCreatorCommentsDeleteAndEdit (&$aDataEntry, $isPerformAction = false)
816  {
817  if ($this->isAdmin())
818  return true;
819  if (getParam('ch_groups_author_comments_admin') && $this->isEntryAdmin($aDataEntry))
820  return true;
821  $this->_defineActions();
822  $aCheck = checkAction($this->_iProfileId, CH_GROUPS_COMMENTS_DELETE_AND_EDIT, $isPerformAction);
824  }
825 
826  function isAllowedManageAdmins($aDataEntry)
827  {
828  if (($GLOBALS['logged']['member'] || $GLOBALS['logged']['admin']) && $aDataEntry['author_id'] == $this->_iProfileId && isProfileActive($this->_iProfileId))
829  return true;
830  return false;
831  }
832 
833  function isAllowedManageFans($aDataEntry)
834  {
835  return $this->isEntryAdmin($aDataEntry);
836  }
837 
838  function isFan($aDataEntry, $iProfileId = 0, $isConfirmed = true)
839  {
840  if (!$iProfileId)
842  return $this->_oDb->isFan ($aDataEntry['id'], $iProfileId, $isConfirmed) ? true : false;
843  }
844 
845  function isEntryAdmin($aDataEntry, $iProfileId = 0)
846  {
847  if (!$iProfileId)
849  if (($GLOBALS['logged']['member'] || $GLOBALS['logged']['admin']) && $aDataEntry['author_id'] == $iProfileId && isProfileActive($iProfileId))
850  return true;
851  return $this->_oDb->isGroupAdmin ($aDataEntry['id'], $iProfileId) && isProfileActive($iProfileId);
852  }
853 
854  function _defineActions ()
855  {
856  defineMembershipActions(array('groups view group', 'groups browse', 'groups search', 'groups add group', 'groups comments delete and edit', 'groups edit any group', 'groups delete any group', 'groups mark as featured', 'groups approve groups', 'groups broadcast message'));
857  }
858 
859  function _browseMy (&$aProfile, $sTitle = null)
860  {
861  parent::_browseMy ($aProfile, _t('_ch_groups_page_title_my_groups'));
862  }
863 
864  function _formatLocation (&$aDataEntry, $isCountryLink = false, $isFlag = false)
865  {
866  $sFlag = $isFlag ? ' ' . genFlag($aDataEntry['country']) : '';
867  $sCountry = _t($GLOBALS['aPreValues']['Country'][$aDataEntry['country']]['LKey']);
868  if ($isCountryLink)
869  $sCountry = '<a href="' . $this->_oConfig->getBaseUri() . 'browse/country/' . strtolower($country['Country']) . '">' . $sCountry . '</a>';
870  return (trim($aDataEntry['city']) ? $aDataEntry['city'] . ', ' : '') . $sCountry . $sFlag;
871  }
872 
873  function _formatSnippetTextForOutline($aEntryData)
874  {
875  return $this->_oTemplate->parseHtmlByName('wall_outline_extra_info', array(
876  'desc' => $this->_formatSnippetText($aEntryData, 200),
877  'location' => $this->_formatLocation($aEntryData, false, false),
878  'fans_count' => $aEntryData['fans_count'],
879  ));
880  }
881 }
process_db_input
process_db_input($sText, $iStripTags=0)
Definition: utils.inc.php:256
ChGroupsModule\actionAdministration
actionAdministration($sUrl='')
Definition: ChGroupsModule.php:526
ChWsbTwigModule
Definition: ChWsbTwigModule.php:14
ChGroupsModule\isAllowedEdit
isAllowedEdit($aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:659
true
if(!defined("TRUE_VAL")) define("TRUE_VAL" true
Definition: constants.inc.php:8
ChGroupsModule\isAllowedActivate
isAllowedActivate(&$aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:697
ChWsbTwigModule\isMembershipEnabledForVideos
isMembershipEnabledForVideos()
Definition: ChWsbTwigModule.php:2020
ChGroupsModule\_browseMy
_browseMy(&$aProfile, $sTitle=null)
Definition: ChGroupsModule.php:859
ChGroupsModule\isAllowedMarkAsFeatured
isAllowedMarkAsFeatured($aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:670
ChGroupsModule\actionTags
actionTags()
Definition: ChGroupsModule.php:296
isProfileActive
isProfileActive($iId=0)
Definition: profiles.inc.php:236
ChWsbModule\getInstance
static getInstance($sClassName)
Definition: ChWsbModule.php:89
ChGroupsModule\_formatLocation
_formatLocation(&$aDataEntry, $isCountryLink=false, $isFlag=false)
Definition: ChGroupsModule.php:864
ChWsbRequest\serviceExists
static serviceExists($mixedModule, $sMethod, $sClass="Module")
Definition: ChWsbRequest.php:70
CHECK_ACTION_RESULT_ALLOWED
const CHECK_ACTION_RESULT_ALLOWED
Definition: membership_levels.inc.php:60
ChGroupsModule\isAllowedUploadVideos
isAllowedUploadVideos(&$aDataEntry)
Definition: ChGroupsModule.php:776
$aModule
$aModule
Definition: classifieds.php:21
ChGroupsModule\actionBroadcast
actionBroadcast($iEntryId)
Definition: ChGroupsModule.php:229
ChGroupsModule\actionPhotos
actionPhotos($sUri)
Definition: ChGroupsModule.php:189
ChWsbTwigModule\$_iProfileId
$_iProfileId
Definition: ChWsbTwigModule.php:15
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChGroupsModule
Definition: ChGroupsModule.php:153
CHECK_ACTION_RESULT
const CHECK_ACTION_RESULT
Definition: membership_levels.inc.php:54
ChWsbTwigModule\isMembershipEnabledForImages
isMembershipEnabledForImages()
Definition: ChWsbTwigModule.php:2015
ChGroupsModule\isAllowedSendInvitation
isAllowedSendInvitation(&$aDataEntry)
Definition: ChGroupsModule.php:715
ChGroupsModule\actionComments
actionComments($sUri)
Definition: ChGroupsModule.php:194
ChGroupsModule\actionView
actionView($sUri)
Definition: ChGroupsModule.php:204
ChGroupsModule\isAllowedManageFans
isAllowedManageFans($aDataEntry)
Definition: ChGroupsModule.php:833
$sUrl
$sUrl
Definition: cart.php:15
php
ch_groups_import
ch_groups_import($sClassPostfix, $aModuleOverwright=array())
Definition: ChGroupsModule.php:8
ChGroupsModule\actionUploadFiles
actionUploadFiles($sUri)
Definition: ChGroupsModule.php:224
ChGroupsPrivacy
Definition: ChGroupsPrivacy.php:11
ChGroupsModule\actionCategories
actionCategories()
Definition: ChGroupsModule.php:301
ChGroupsModule\isAllowedPostInForum
isAllowedPostInForum(&$aDataEntry, $iProfileId=-1)
Definition: ChGroupsModule.php:728
ChGroupsModule\isEntryAdmin
isEntryAdmin($aDataEntry, $iProfileId=0)
Definition: ChGroupsModule.php:845
ChGroupsModule\actionAdd
actionAdd()
Definition: ChGroupsModule.php:261
ChWsbTwigModule\isMembershipEnabledForSounds
isMembershipEnabledForSounds()
Definition: ChWsbTwigModule.php:2025
ChGroupsModule\isAllowedViewFans
isAllowedViewFans(&$aDataEntry)
Definition: ChGroupsModule.php:756
ChGroupsModule\onEventFanBecomeAdmin
onEventFanBecomeAdmin($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:597
ChGroupsModule\$_aQuickCache
$_aQuickCache
Definition: ChGroupsModule.php:155
CH_SLASHES_NO_ACTION
const CH_SLASHES_NO_ACTION
Definition: utils.inc.php:30
ChGroupsModule\actionDownload
actionDownload($iEntryId, $iMediaId)
Definition: ChGroupsModule.php:306
ChGroupsModule\actionAdministrationManage
actionAdministrationManage($isAdminEntries=false, $sUrl='')
Definition: ChGroupsModule.php:574
ChGroupsModule\serviceGetWallPostOutline
serviceGetWallPostOutline($aEvent)
Definition: ChGroupsModule.php:459
ChGroupsModule\actionJoin
actionJoin($iEntryId, $iProfileId)
Definition: ChGroupsModule.php:281
ChGroupsModule\isAllowedRate
isAllowedRate(&$aDataEntry)
Definition: ChGroupsModule.php:742
ChGroupsModule\serviceHomepageBlock
serviceHomepageBlock()
Definition: ChGroupsModule.php:329
ChGroupsModule\actionSearch
actionSearch($sKeyword='', $sCategory='')
Definition: ChGroupsModule.php:256
ChGroupsModule\isAllowedComments
isAllowedComments(&$aDataEntry)
Definition: ChGroupsModule.php:749
ChGroupsModule\serviceGetMemberMenuItemAddContent
serviceGetMemberMenuItemAddContent()
Definition: ChGroupsModule.php:412
ChGroupsModule\_getInviteParams
_getInviteParams($aDataEntry, $aInviter)
Definition: ChGroupsModule.php:239
ChGroupsModule\actionMarkFeatured
actionMarkFeatured($iEntryId)
Definition: ChGroupsModule.php:276
ChWsbTwigModule\isMembershipEnabledForFiles
isMembershipEnabledForFiles()
Definition: ChWsbTwigModule.php:2030
ChGroupsModule\isAllowedAdd
isAllowedAdd($isPerformAction=false)
Definition: ChGroupsModule.php:648
exit
exit
Definition: cart.php:21
$_GET
$_GET['debug']
Definition: index.php:67
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChGroupsModule\serviceGetMemberMenuItem
serviceGetMemberMenuItem()
Definition: ChGroupsModule.php:407
ChGroupsPageMain
Definition: ChGroupsPageMain.php:11
ChGroupsModule\actionVideos
actionVideos($sUri)
Definition: ChGroupsModule.php:184
$sTitle
$sTitle
Definition: actions.inc.php:13
$aProfile
$aProfile
Definition: flash.php:14
ChGroupsModule\serviceGetWallPost
serviceGetWallPost($aEvent)
Definition: ChGroupsModule.php:419
ChGroupsModule\actionFiles
actionFiles($sUri)
Definition: ChGroupsModule.php:174
getNickName
getNickName( $ID='')
Definition: profiles.inc.php:461
ChGroupsModule\onEventJoinReject
onEventJoinReject($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:587
ChGroupsModule\onEventAdminBecomeFan
onEventAdminBecomeFan($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:602
CH_TAGS_NO_ACTION
const CH_TAGS_NO_ACTION
Definition: utils.inc.php:21
ChGroupsModule\isAllowedJoin
isAllowedJoin(&$aDataEntry)
Definition: ChGroupsModule.php:708
ChGroupsModule\actionUploadSounds
actionUploadSounds($sUri)
Definition: ChGroupsModule.php:219
ChGroupsModule\onEventFanRemove
onEventFanRemove($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:592
ChGroupsModule\actionBrowseFans
actionBrowseFans($sUri)
Definition: ChGroupsModule.php:199
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
CH_GROUPS_MAX_FANS
const CH_GROUPS_MAX_FANS
Definition: ChGroupsModule.php:35
$sContent
$sContent
Definition: bottom_menu_compose.php:169
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
ChGroupsModule\isAllowedUploadFiles
isAllowedUploadFiles(&$aDataEntry)
Definition: ChGroupsModule.php:802
ChGroupsModule\actionAdministrationSettings
actionAdministrationSettings()
Definition: ChGroupsModule.php:569
ChGroupsModule\serviceGetSubscriptionParams
serviceGetSubscriptionParams($sAction, $iEntryId)
Definition: ChGroupsModule.php:482
CH_WSB_PG_ALL
const CH_WSB_PG_ALL
Definition: ChWsbPrivacy.php:12
ChGroupsModule\serviceGetSpyPost
serviceGetSpyPost($sAction, $iObjectId=0, $iSenderId=0, $aExtraParams=array())
Definition: ChGroupsModule.php:471
getProfileLink
getProfileLink( $iID, $sLinkAdd='')
Definition: profiles.inc.php:484
$aMenu
$aMenu
Definition: categories.php:257
ChGroupsModule\onEventJoinRequest
onEventJoinRequest($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:582
ChGroupsModule\isAllowedUploadSounds
isAllowedUploadSounds(&$aDataEntry)
Definition: ChGroupsModule.php:789
ChGroupsModule\serviceProfileBlockJoined
serviceProfileBlockJoined($iProfileId)
Definition: ChGroupsModule.php:390
checkAction
checkAction($iMemberId, $actionID, $performAction=false, $iForcedProfID=0, $isCheckMemberStatus=true)
Definition: membership_levels.inc.php:313
ChGroupsModule\serviceGetWallPostComment
serviceGetWallPostComment($aEvent)
Definition: ChGroupsModule.php:450
ChGroupsModule\isAllowedDelete
isAllowedDelete(&$aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:688
ChGroupsModule\serviceGetWallAddComment
serviceGetWallAddComment($aEvent)
Definition: ChGroupsModule.php:438
ChGroupsModule\actionCalendar
actionCalendar($iYear='', $iMonth='')
Definition: ChGroupsModule.php:251
defineMembershipActions
defineMembershipActions($aActionsAll, $sPrefix='CH_')
Definition: membership_levels.inc.php:744
ChGroupsModule\_formatSnippetTextForOutline
_formatSnippetTextForOutline($aEntryData)
Definition: ChGroupsModule.php:873
ChGroupsModule\serviceProfileBlock
serviceProfileBlock($iProfileId)
Definition: ChGroupsModule.php:367
ChWsbTwigModule\_formatSnippetText
_formatSnippetText($aEntryData, $iMaxLen=300)
Definition: ChWsbTwigModule.php:2044
ChGroupsModule\_defineActions
_defineActions()
Definition: ChGroupsModule.php:854
process_pass_data
process_pass_data($text, $strip_tags=0)
Definition: utils.inc.php:290
ChGroupsModule\actionDelete
actionDelete($iEntryId)
Definition: ChGroupsModule.php:271
ChWsbTwigModule\isAdmin
isAdmin()
Definition: ChWsbTwigModule.php:1715
ChGroupsModule\actionUploadVideos
actionUploadVideos($sUri)
Definition: ChGroupsModule.php:214
ChGroupsModule\isAllowedBroadcast
isAllowedBroadcast($aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:679
$sCountry
$sCountry
Definition: browse.php:26
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
ChGroupsModule\isAllowedCreatorCommentsDeleteAndEdit
isAllowedCreatorCommentsDeleteAndEdit(&$aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:815
ChGroupsModule\actionHome
actionHome()
Definition: ChGroupsModule.php:169
ChGroupsModule\isAllowedView
isAllowedView($aDataEntry, $isPerformAction=false)
Definition: ChGroupsModule.php:614
ChGroupsModule\actionUploadPhotos
actionUploadPhotos($sUri)
Definition: ChGroupsModule.php:209
ChGroupsModule\isAllowedBrowse
isAllowedBrowse($isPerformAction=false)
Definition: ChGroupsModule.php:630
ChGroupsModule\actionSharePopup
actionSharePopup($iEntryId)
Definition: ChGroupsModule.php:286
ChGroupsModule\serviceMapInstall
serviceMapInstall()
Definition: ChGroupsModule.php:497
ChGroupsModule\actionSounds
actionSounds($sUri)
Definition: ChGroupsModule.php:179
$sAction
$sAction
Definition: categories.php:274
ChGroupsModule\onEventJoinConfirm
onEventJoinConfirm($iEntryId, $iProfileId, $aDataEntry)
Definition: ChGroupsModule.php:607
ChGroupsModule\isAllowedSearch
isAllowedSearch($isPerformAction=false)
Definition: ChGroupsModule.php:639
genFlag
genFlag($country)
Definition: utils.inc.php:665
empty
Attr AllowedRel this is empty
Definition: Attr.AllowedRel.txt:7
$o
$o
Definition: cmd.php:193
ChWsbService\call
static call($mixed, $sMethod, $aParams=array(), $sClass='Module')
Definition: ChWsbService.php:32
ChGroupsModule\isAllowedShare
isAllowedShare(&$aDataEntry)
Definition: ChGroupsModule.php:720
ChGroupsModule\isAllowedReadForum
isAllowedReadForum(&$aDataEntry, $iProfileId=-1)
Definition: ChGroupsModule.php:735
ChGroupsModule\actionManageFansPopup
actionManageFansPopup($iEntryId)
Definition: ChGroupsModule.php:291
ChGroupsModule\isAllowedManageAdmins
isAllowedManageAdmins($aDataEntry)
Definition: ChGroupsModule.php:826
ChGroupsModule\actionEdit
actionEdit($iEntryId)
Definition: ChGroupsModule.php:266
ChGroupsModule\__construct
__construct(&$aModule)
Definition: ChGroupsModule.php:157
ChGroupsModule\actionInvite
actionInvite($iEntryId)
Definition: ChGroupsModule.php:234
$iProfileId
if( $sMembersList) $iProfileId
Definition: communicator.php:29
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
ChGroupsModule\isAllowedUploadPhotos
isAllowedUploadPhotos(&$aDataEntry)
Definition: ChGroupsModule.php:763
ch_encode_url_params
ch_encode_url_params($a, $aExcludeKeys=array(), $aOnlyKeys=false)
Definition: utils.inc.php:1675
ChGroupsModule\$_oPrivacy
$_oPrivacy
Definition: ChGroupsModule.php:154
ChGroupsModule\isFan
isFan($aDataEntry, $iProfileId=0, $isConfirmed=true)
Definition: ChGroupsModule.php:838