function groups_moderation_callback(&$pModeration) { global $gBitUser, $gBitSystem; if ($pModeration['type'] == 'join') { if ($pModeration['status'] == MODERATION_APPROVED) { // Add the user to the group $gBitUser->addUserToGroup($pModeration['source_user_id'], $pModeration['moderator_group_id']); // Store the users notification preference if ($gBitSystem->isPackageActive('switchboard') && !empty($pModeration['data']['notice'])) { if ($pModeration['data']['notice'] == 'email' || $pModeration['data']['notice'] == 'digest') { global $gSwitchboardSystem; $gSwitchboardSystem->storeUserPref($pModeration['source_user_id'], 'group', 'message', $pModeration['content_id'], $pModeration['data']['notice']); } } } } else { if ($pModeration['type'] == 'invite') { if ($pModeration['status'] == MODERATION_APPROVED) { // Add the user to the group $group = new BitGroup(NULL, $pModeration['content_id']); $group->load(); $gBitUser->addUserToGroup($pModeration['moderator_id'], $group->mGroupId); } } else { if ($pModeration['type'] == 'add_content') { if ($pModeration['status'] == MODERATION_APPROVED) { if (!empty($pModeration['data']['map_content_id'])) { $group = new BitGroup(NULL, $pModeration['content_id']); $group->load(); $group->linkContent(array("content_id" => $pModeration['data']['map_content_id'])); } // @TODO would be nice to be able to kick an error or msg back to the moderation system } } } } return TRUE; }
*/ if (isset($_REQUEST["submit_mult"]) && isset($_REQUEST["checked"]) && $_REQUEST["submit_mult"] == "remove_groups") { // Now check permissions to remove the selected groups $gBitSystem->verifyPermission('p_group_remove'); if (!empty($_REQUEST['cancel'])) { // user cancelled - just continue on, doing nothing } elseif (empty($_REQUEST['confirm'])) { $formHash['delete'] = TRUE; $formHash['submit_mult'] = 'remove_groups'; foreach ($_REQUEST["checked"] as $del) { $tmpPage = new BitGroup($del); if ($tmpPage->load() && !empty($tmpPage->mInfo['title'])) { $info = $tmpPage->mInfo['title']; } else { $info = $del; } $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>' . $info; } $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete these groups?') . ' (' . tra('Count: ') . count($_REQUEST["checked"]) . ')', 'error' => tra('This cannot be undone!'))); } else { foreach ($_REQUEST["checked"] as $deleteId) { $tmpPage = new BitGroup($deleteId); if (!$tmpPage->load() || !$tmpPage->expunge()) { array_merge($errors, array_values($tmpPage->mErrors)); } } if (!empty($errors)) { $gBitSmarty->assign_by_ref('errors', $errors); } } }
function group_content_expunge(&$pObject, &$pParamHash) { global $gBitSystem, $gBitDb; $errors = NULL; if ($gBitSystem->isPackageActive('group')) { $groups = $gBitDb->getArray("SELECT g.`group_id` FROM `" . BIT_DB_PREFIX . "groups` g INNER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm ON ( gccm.`group_content_id` = g.`content_id` ) WHERE gccm.`to_content_id` = ?", array($pObject->mContentId)); foreach ($groups as $group) { $group = new BitGroup($group['group_id']); $group->load(); $unlinkHash = array("content_id" => $pObject->mContentId); if (!$group->unlinkContent($unlinkHash)) { $errors = $group->mErrors; } } } return $errors; }
function diasalsa_content_edit(&$pObject, &$pParamHash) { global $gBitSystem, $gBitSmarty, $gBitUser, $gBitThemes; $excludeContent = array(SALSAACTION_CONTENT_TYPE_GUID, BITCOMMENT_CONTENT_TYPE_GUID, BITUSER_CONTENT_TYPE_GUID, BITGROUP_CONTENT_TYPE_GUID, BITBOARD_CONTENT_TYPE_GUID); if ($gBitSystem->isPackageActive('diasalsa') && !in_array($pObject->getContentType(), $excludeContent)) { $action = new SalsaAction(); if (!empty($_REQUEST['connect_group_content_id'])) { $connect_group_content_id = $_REQUEST['connect_group_content_id']; } if (!empty($_REQUEST['link_action_content_id'])) { // for preview we override any current link - we might be changing it $action_content_id = $_REQUEST['link_action_content_id']; } elseif ($pObject->isValid()) { // get the current linked action if it exists $action_content_id = $action->getActionLink($pObject->mContentId); } if (!empty($action_content_id)) { $action2 = new SalsaAction(NULL, $action_content_id); $action2->load(); $gBitSmarty->assign('linkedAction', $action2->mInfo); } if ($pObject->isValid()) { /* redundant to groups too bad */ if (empty($contect_group_content_id)) { $listHash['mapped_content_id'] = $pObject->mContentId; $listHash['offset'] = 0; $group = new BitGroup(); $groups = $group->getList($listHash); if (count($groups) == 1) { $connect_group_content_id = $groups[0]['content_id']; } } } if (!empty($connect_group_content_id)) { $actionOptions = $action->getActionsByGroupId($connect_group_content_id); $options[''] = "Select one"; foreach ($actionOptions as $opt) { $options[$opt['content_id']] = $opt['title']; } $gBitSmarty->assign('actionOptions', $options); } $gBitThemes->loadAjax('mochikit', array('Iter.js', 'DOM.js')); $gBitThemes->loadJavascript(DIASALSA_PKG_PATH . 'scripts/DIASalsa.js', TRUE); } }
if (empty($lookupHash)) { $lookupHash =& $_REQUEST; } // if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up. if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) { // if someone gives us a group_name we try to find it if (!empty($lookupHash['group_name'])) { global $gBitDb; $lookupHash['group_id'] = $gBitDb->getOne("SELECT group_id FROM `" . BIT_DB_PREFIX . "groups` g LEFT JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON (g.`content_id` = lc.`content_id`) WHERE lc.`title` = ?", array($lookupHash['group_name'])); if (empty($lookupHash['group_id'])) { $gBitSystem->fatalError(tra('No group found with the name: ') . $lookupHash['group_name']); } } // if group_id supplied, use that if (@BitBase::verifyId($lookupHash['group_id'])) { $gContent = new BitGroup($lookupHash['group_id']); // if content_id supplied, use that } elseif (@BitBase::verifyId($lookupHash['content_id'])) { $gContent = new BitGroup(NULL, $lookupHash['content_id']); } elseif (@BitBase::verifyId($lookupHash['group']['group_id'])) { $gContent = new BitGroup($lookupHash['group']['group_id']); // otherwise create new object } else { $gContent = new BitGroup(); } $gContent->load(); $gBitSmarty->assign_by_ref("gContent", $gContent); // ControlGroupInfo is for customizing layouts in other parts of the site (see BitGroup::group_content_display) // but we need it here too if we want to apply layout features consistently while browsing groups/ too and keep our tpls simple $gBitSmarty->assign_by_ref("controlGroupInfo", $gContent->mInfo); }
$gBitSystem->verifyPackage('group'); require_once GROUP_PKG_PATH . 'lookup_group_inc.php'; // lets see if the user is trying to respond to an invitation if (!empty($_REQUEST['invite_id'])) { $inviteId = $_REQUEST['invite_id']; // get the invite $invite = $gContent->getInvitation($inviteId); // is the invite valid if (isset($invite['invite_id'])) { // is the invite attached to a registered user? if (isset($invite['login'])) { // is the user logged in if ($gBitUser->isRegistered()) { // does the invite email match the users email account? if ($gBitUser->mInfo['email'] == $invite['email']) { $gContent = new BitGroup($invite['group_id']); $gContent->load(); // user cancelled if (!empty($_REQUEST['cancel'])) { // send them to group home page - we leave the invite intact in case they chain their mind an so admin can see they have not joined header("Location: " . BIT_ROOT_URL . "group"); die; // have they confirmed they want to join } elseif (empty($_REQUEST['confirm'])) { // ask them to confirm they want to joinn $gBitSystem->confirmDialog($invite, array('warning' => tra('Do you wish to join this group?') . ' ' . $gContent->getTitle())); // they want to join } else { // sign them up if ($gBitUser->addUserToGroup($gBitUser->mUserId, $gContent->mGroupId)) { // delete invite
} if (empty($_REQUEST['content_type_guid'])) { // maps needs a signal to get a default list $_REQUEST['content_type_guid'] = 'Any'; // force comments inclusion since it would be stupid not to include comments (discussions) $_REQUEST['include_comments'] = 'y'; } include_once GMAP_PKG_PATH . 'map_content_list_inc.php'; // end } elseif (!empty($_REQUEST['search_group_content_id'])) { // override group content type param if coupled with a search_group_content_id if (!empty($_REQUEST['content_type_guid']) && $_REQUEST['content_type_guid'] == 'bitgroup') { $_REQUEST['content_type_guid'] = NULL; } if (empty($_REQUEST['content_type_guid'])) { // force comments inclusion since it would be stupid not to include comments (discussions) $_REQUEST['include_comments'] = 'y'; } // we use the group list.tpl not liberty's so just give us the results $_REQUEST['output'] = 'raw'; include_once LIBERTY_PKG_PATH . 'list_content.php'; $gBitSmarty->assign_by_ref('contentList', $contentList); } else { $group = new BitGroup(); $groupsList = $group->getList($_REQUEST); $gBitSmarty->assign_by_ref('contentList', $groupsList); // getList() has now placed all the pagination information in $_REQUEST['listInfo'] $gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']); } // Display the list template $gBitSystem->display('bitpackage:group/search_groups.tpl', tra('Groups'), array('display_mode' => 'list'));