11 $a = $aModuleOverwright ? $aModuleOverwright :
$aModule;
12 if (!$a || $a[
'uri'] !=
'groups') {
14 $a = $oMain->_aModule;
23 define (
'CH_GROUPS_PHOTOS_CAT',
'Groups');
24 define (
'CH_GROUPS_PHOTOS_TAG',
'groups');
26 define (
'CH_GROUPS_VIDEOS_CAT',
'Groups');
27 define (
'CH_GROUPS_VIDEOS_TAG',
'groups');
29 define (
'CH_GROUPS_SOUNDS_CAT',
'Groups');
30 define (
'CH_GROUPS_SOUNDS_TAG',
'groups');
32 define (
'CH_GROUPS_FILES_CAT',
'Groups');
33 define (
'CH_GROUPS_FILES_TAG',
'groups');
35 define (
'CH_GROUPS_MAX_FANS', 1000);
160 $this->_sFilterName =
'ch_groups_filter';
161 $this->_sPrefix =
'ch_groups';
166 $GLOBALS[
'oChGroupsModule'] = &$this;
171 parent::_actionHome(
_t(
'_ch_groups_page_title_home'));
176 parent::_actionFiles ($sUri,
_t(
'_ch_groups_page_title_files'));
181 parent::_actionSounds ($sUri,
_t(
'_ch_groups_page_title_sounds'));
186 parent::_actionVideos ($sUri,
_t(
'_ch_groups_page_title_videos'));
191 parent::_actionPhotos ($sUri,
_t(
'_ch_groups_page_title_photos'));
196 parent::_actionComments ($sUri,
_t(
'_ch_groups_page_title_comments'));
201 parent::_actionBrowseFans ($sUri,
'isAllowedViewFans',
'getFansBrowse', $this->_oDb->getParam(
'ch_groups_perpage_browse_fans'),
'browse_fans/',
_t(
'_ch_groups_page_title_fans'));
206 parent::_actionView ($sUri,
_t(
'_ch_groups_msg_pending_approval'));
211 parent::_actionUploadMedia ($sUri,
'isAllowedUploadPhotos',
'images', array (
'images_choice',
'images_upload'),
_t(
'_ch_groups_page_title_upload_photos'));
216 parent::_actionUploadMedia ($sUri,
'isAllowedUploadVideos',
'videos', array (
'videos_choice',
'videos_upload'),
_t(
'_ch_groups_page_title_upload_videos'));
221 parent::_actionUploadMedia ($sUri,
'isAllowedUploadSounds',
'sounds', array (
'sounds_choice',
'sounds_upload'),
_t(
'_ch_groups_page_title_upload_sounds'));
226 parent::_actionUploadMedia ($sUri,
'isAllowedUploadFiles',
'files', array (
'files_choice',
'files_upload'),
_t(
'_ch_groups_page_title_upload_files'));
231 parent::_actionBroadcast ($iEntryId,
_t(
'_ch_groups_page_title_broadcast'),
_t(
'_ch_groups_msg_broadcast_no_recipients'),
_t(
'_ch_groups_msg_broadcast_message_sent'));
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'));
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']))),
253 parent::_actionCalendar ($iYear, $iMonth,
_t(
'_ch_groups_page_title_calendar'));
258 parent::_actionSearch ($sKeyword, $sCategory,
_t(
'_ch_groups_page_title_search'));
263 parent::_actionAdd (
_t(
'_ch_groups_page_title_add'));
268 parent::_actionEdit ($iEntryId,
_t(
'_ch_groups_page_title_edit'));
273 parent::_actionDelete ($iEntryId,
_t(
'_ch_groups_msg_group_was_deleted'));
278 parent::_actionMarkFeatured ($iEntryId,
_t(
'_ch_groups_msg_added_to_featured'),
_t(
'_ch_groups_msg_removed_from_featured'));
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'));
288 parent::_actionSharePopup ($iEntryId,
_t(
'_ch_groups_caption_share_group'));
293 parent::_actionManageFansPopup ($iEntryId,
_t(
'_ch_groups_caption_manage_fans'),
'getFans',
'isAllowedManageFans',
'isAllowedManageAdmins',
CH_GROUPS_MAX_FANS);
298 parent::_actionTags (
_t(
'_ch_groups_page_title_tags'));
303 parent::_actionCategories (
_t(
'_ch_groups_page_title_categories'));
308 $aFileInfo = $this->_oDb->getMedia ((
int)$iEntryId, (
int)$iMediaId,
'files');
310 if (!$aFileInfo || !($aDataEntry = $this->_oDb->getEntryByIdAndOwner((
int)$iEntryId, 0,
true))) {
311 $this->_oTemplate->displayPageNotFound ();
316 $this->_oTemplate->displayAccessDenied ();
320 parent::_actionDownload($aFileInfo,
'media_id');
331 if (!$this->_oDb->isAnyPublicContent())
336 $o->sUrlStart = CH_WSB_URL_ROOT .
'?';
338 $sDefaultHomepageTab = $this->_oDb->getParam(
'ch_groups_homepage_default_tab');
339 $sBrowseMode = $sDefaultHomepageTab;
340 switch (
$_GET[
'ch_groups_filter']) {
345 case $sDefaultHomepageTab:
346 $sBrowseMode =
$_GET[
'ch_groups_filter'];
350 return $o->ajaxBrowse(
352 $this->_oDb->getParam(
'ch_groups_perpage_homepage'),
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),
375 return $o->ajaxBrowse(
377 $this->_oDb->getParam(
'ch_groups_perpage_profile'),
397 return $o->ajaxBrowse(
399 $this->_oDb->getParam(
'ch_groups_perpage_profile'),
409 return parent::_serviceGetMemberMenuItem (
_t(
'_ch_groups'),
_t(
'_ch_groups'),
'users');
416 return parent::_serviceGetMemberMenuItem (
_t(
'_ch_groups_group_single'),
_t(
'_ch_groups_group_single'),
'users',
false,
'&ch_groups_filter=add_group');
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,
431 'owner' =>
'author_id',
435 return parent::_serviceGetWallPost ($aEvent, $aParams);
441 'txt_privacy_view_event' =>
'view_group',
442 'obj_privacy' => $this->_oPrivacy
444 return parent::_serviceGetWallAddComment($aEvent, $aParams);
453 'txt_privacy_view_event' =>
'view_group',
454 'obj_privacy' => $this->_oPrivacy
456 return parent::_serviceGetWallPostComment($aEvent, $aParams);
462 'txt_privacy_view_event' =>
'view_group',
463 'obj_privacy' => $this->_oPrivacy,
464 'templates' => array(
465 'grouped' =>
'wall_outline_grouped'
468 return parent::_serviceGetWallPostOutline($aEvent,
'users', $aParams);
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',
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'),
491 return parent::_serviceGetSubscriptionParams (
$sAction, $iEntryId, $a);
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/',
529 $this->_oTemplate->displayAccessDenied ();
533 $this->_oTemplate->pageStart();
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')),
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')),
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()),
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()),
559 $sUrl =
'pending_approval';
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'));
571 return parent::_actionAdministrationSettings (
'Groups');
576 return parent::_actionAdministrationManage ($isAdminEntries,
'_ch_groups_admin_delete',
'_ch_groups_admin_activate',
$sUrl);
589 parent::_onEventJoinReject ($iEntryId,
$iProfileId, $aDataEntry,
'ch_groups_join_reject');
594 parent::_onEventFanRemove ($iEntryId,
$iProfileId, $aDataEntry,
'ch_groups_fan_remove');
599 parent::_onEventFanBecomeAdmin ($iEntryId,
$iProfileId, $aDataEntry,
'ch_groups_fan_become_admin');
604 parent::_onEventAdminBecomeFan ($iEntryId,
$iProfileId, $aDataEntry,
'ch_groups_admin_become_fan');
609 parent::_onEventJoinConfirm ($iEntryId,
$iProfileId, $aDataEntry,
'ch_groups_join_confirm');
617 if ($this->
isAdmin() || $aDataEntry[
'author_id'] == $this->_iProfileId)
622 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_VIEW_GROUP, $isPerformAction);
627 return $this->_oPrivacy->check(
'view_group', $aDataEntry[
'id'], $this->_iProfileId);
635 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_BROWSE, $isPerformAction);
644 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_SEARCH, $isPerformAction);
655 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_ADD_GROUP, $isPerformAction);
666 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_EDIT_ANY_GROUP, $isPerformAction);
675 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_MARK_AS_FEATURED, $isPerformAction);
684 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_BROADCAST_MESSAGE, $isPerformAction);
693 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_DELETE_ANY_GROUP, $isPerformAction);
699 if ($aDataEntry[
'status'] !=
'pending')
704 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_APPROVE_GROUPS, $isPerformAction);
710 if (!$this->_iProfileId)
712 return $this->_oPrivacy->check(
'join', $aDataEntry[
'id'], $this->_iProfileId);
746 return $this->_oPrivacy->check(
'rate', $aDataEntry[
'id'], $this->_iProfileId);
753 return $this->_oPrivacy->check(
'comment', $aDataEntry[
'id'], $this->_iProfileId);
760 return $this->_oPrivacy->check(
'view_fans', $aDataEntry[
'id'], $this->_iProfileId);
767 if (!$this->_iProfileId)
773 return $this->_oPrivacy->check(
'upload_photos', $aDataEntry[
'id'], $this->_iProfileId);
780 if (!$this->_iProfileId)
786 return $this->_oPrivacy->check(
'upload_videos', $aDataEntry[
'id'], $this->_iProfileId);
793 if (!$this->_iProfileId)
799 return $this->_oPrivacy->check(
'upload_sounds', $aDataEntry[
'id'], $this->_iProfileId);
806 if (!$this->_iProfileId)
812 return $this->_oPrivacy->check(
'upload_files', $aDataEntry[
'id'], $this->_iProfileId);
822 $aCheck =
checkAction($this->_iProfileId, CH_GROUPS_COMMENTS_DELETE_AND_EDIT, $isPerformAction);
828 if ((
$GLOBALS[
'logged'][
'member'] ||
$GLOBALS[
'logged'][
'admin']) && $aDataEntry[
'author_id'] == $this->_iProfileId &&
isProfileActive($this->_iProfileId))
842 return $this->_oDb->isFan ($aDataEntry[
'id'],
$iProfileId, $isConfirmed) ?
true :
false;
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'));
861 parent::_browseMy (
$aProfile,
_t(
'_ch_groups_page_title_my_groups'));
866 $sFlag = $isFlag ?
' ' .
genFlag($aDataEntry[
'country']) :
'';
869 $sCountry =
'<a href="' . $this->_oConfig->getBaseUri() .
'browse/country/' . strtolower($country[
'Country']) .
'">' .
$sCountry .
'</a>';
870 return (trim($aDataEntry[
'city']) ? $aDataEntry[
'city'] .
', ' :
'') .
$sCountry . $sFlag;
875 return $this->_oTemplate->parseHtmlByName(
'wall_outline_extra_info', array(
878 'fans_count' => $aEntryData[
'fans_count'],