Exemplo n.º 1
0
 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
                     $gContent->expungeInvitation($inviteId);
                     $gBitUser->loadGroups(TRUE);
                     // let them continue to email prefs page...
                 }
             }
             // the invite email address and the users email address do not match, so customize the error msg
         } else {
             if ($gBitUser->isRegistered()) {
                 $gBitSystem->fatalPermission(NULL, tra('Your user account email does not match the email address associated with the invitation you are responding to.') . "<br /><br />" . tra('Please check your invitation code, update your account to use the same email address as the invitation was sent to, or ask the group admin to send you an invitation to your user account email address.'));
             }
Exemplo n.º 2
0
/**
 * @param $pParamHash['connect_group_content_id']
 * @param $pParamHash['search_group_content_id']
 *
 * content_group_content_id is more often used in the editing process or viewing specific lists of group content
 * search_group_content_id is for generic search of group assoicated content and is utilized by the search_inc.tpl service
 * the reason to have the two params is so that search service requirements need not be triggered on regular list lookups
 **/
function group_content_list_sql(&$pObject, &$pParamHash = NULL)
{
    global $gBitSystem;
    $ret = array();
    $ret['where_sql'] = $ret['select_sql'] = $ret['join_sql'] = "";
    if ($gBitSystem->isPackageActive('group')) {
        // -------------------- Search and List Limiting -------------------- //
        // if search also populate connect value
        if (!empty($pParamHash['search_group_content_id'])) {
            $pParamHash['connect_group_content_id'] = $pParamHash['search_group_content_id'];
        }
        // sql required to list content associated with a group
        if (!empty($pParamHash['connect_group_content_id']) && $pObject->verifyId($pParamHash['connect_group_content_id'])) {
            // Comments add considerable expense. Don't do it unless we have to
            // sometimes content_type_guid is a string and sometimes its an array - deal with it.
            $content_types = array();
            if (!empty($pParamHash['content_type_guid'])) {
                $content_types = is_array($pParamHash['content_type_guid']) ? $pParamHash['content_type_guid'] : array($pParamHash['content_type_guid']);
            }
            if (!empty($pParamHash['search_group_content_id'])) {
                $ret['join_sql'] = " LEFT OUTER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm ON ( lc.`content_id` = gccm.`to_content_id` )" . " LEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_comments` gclcomm ON ( lc.`content_id` = gclcomm.`content_id`)" . " LEFT OUTER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm2 ON ( gclcomm.`root_id` = gccm2.`to_content_id` )";
                // join on the connection map
                $ret['where_sql'] .= " AND ( gccm.`group_content_id` = ? OR gccm2.`group_content_id` = ? ) ";
                $ret['bind_vars'][] = (int) $pParamHash['connect_group_content_id'];
                $ret['bind_vars'][] = (int) $pParamHash['connect_group_content_id'];
            } else {
                $ret['join_sql'] = " INNER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm ON ( lc.`content_id` = gccm.`to_content_id` )";
                // join on the connection map
                $ret['where_sql'] .= " AND gccm.`group_content_id` = ? ";
                $ret['bind_vars'][] = (int) $pParamHash['connect_group_content_id'];
            }
            // if its a list of boards join in the board_id to make things convenient
            if (isset($pParamHash['content_type_guid']) && $pParamHash['content_type_guid'] == "bitboard") {
                $ret['select_sql'] = " , brd.`board_id`";
                $ret['join_sql'] .= " INNER JOIN `" . BIT_DB_PREFIX . "boards` brd ON (lc.`content_id` = brd.`content_id`)";
            }
        }
        // if searching for content associated with a group we may want to know at least the group's name
        if (!empty($pParamHash['search_group_content_id'])) {
            global $gBitSmarty;
            $groupSearchTitle = @BitGroup::getTitle(NULL, $pParamHash['search_group_content_id']);
            // make it available to smarty for the search_inc.tpl
            $gBitSmarty->assign('groupSearchTitle', $groupSearchTitle);
            // return the values sent for pagination / url purposes
            $pParamHash['listInfo']['search_group_content_id'] = $pParamHash['search_group_content_id'];
            $pParamHash['listInfo']['ihash']['search_group_content_id'] = $pParamHash['search_group_content_id'];
            // @TODO move this to a liberty list_sql service
            if (!empty($pParamHash['include_comments'])) {
                $pParamHash['listInfo']['include_comments'] = $pParamHash['include_comments'];
                $pParamHash['listInfo']['ihash']['include_comments'] = $pParamHash['include_comments'];
            }
        }
        // if getting a list of a group's connected content the group_id is needed to make pagination work out nice
        if (!empty($pParamHash['content_type_guid']) && !empty($pParamHash['group_id'])) {
            $pParamHash['listInfo']['group_id'] = $pParamHash['group_id'];
            $pParamHash['listInfo']['ihash']['group_id'] = $pParamHash['group_id'];
        }
        // -------------------- End Search and List Limiting -------------------- //
        // -------------------- Generic Listing --------------------- //
        // if were getting a general list and content has a one to one relation with groups,  we may want to know the name of the group the object is mapped to
        $excludeContent = array(BITCOMMENT_CONTENT_TYPE_GUID, BITUSER_CONTENT_TYPE_GUID, BITGROUP_CONTENT_TYPE_GUID);
        if ($gBitSystem->isFeatureActive('group_admin_content') && (!method_exists($pObject, 'isValid') || (!$pObject->isValid() || !in_array($pObject->getContentType(), $excludeContent)))) {
            $ret['select_sql'] .= ", lcg.`title` AS group_title, lcg.`content_id` AS group_content_id";
            $ret['join_sql'] .= "LEFT OUTER JOIN `" . BIT_DB_PREFIX . "groups_content_cnxn_map` gccm3 ON lc.`content_id` = gccm3.`to_content_id`\n\t\t\t\t\t\t \t\tLEFT OUTER JOIN `" . BIT_DB_PREFIX . "liberty_content` lcg ON gccm3.`group_content_id` = lcg.`content_id`";
        }
    }
    return $ret;
}
Exemplo n.º 3
0
// Is package installed and enabled
$gBitSystem->verifyPackage('group');
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_group_view');
// A request to mass delete multiple groups may be made through the list interface - handle it
require_once GROUP_PKG_PATH . 'expunge_group_inc.php';
// A group may have been requested to just search its related content - try and look it up
require_once GROUP_PKG_PATH . 'lookup_group_inc.php';
if ($gContent->isValid()) {
    // service relies on a unique param name as content_id or group_id would be too generic
    $_REQUEST['search_group_content_id'] = $gContent->mContentId;
}
// Call gmap map view service if map mode requested
if (!empty($_REQUEST['display_mode']) && $_REQUEST['display_mode'] == 'map') {
    if (!empty($_REQUEST['search_group_content_id'])) {
        if ($groupTitle = @BitGroup::getTitle(NULL, $_REQUEST['search_group_content_id'])) {
            $pageTitle = tra("Search Group") . ": " . $groupTitle;
        } else {
            $gBitSystem->fatalError("The group you requested to search could not be found.");
        }
    } else {
        $_REQUEST['content_type_guid'] = BITGROUP_CONTENT_TYPE_GUID;
        $pageTitle = tra("Groups");
    }
    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';