当前位置: 首页>>代码示例>>PHP>>正文


PHP elgg_group_gatekeeper函数代码示例

本文整理汇总了PHP中elgg_group_gatekeeper函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_group_gatekeeper函数的具体用法?PHP elgg_group_gatekeeper怎么用?PHP elgg_group_gatekeeper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了elgg_group_gatekeeper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: messageboard_page_handler

/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    $vars = [];
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            $vars['page_owner_guid'] = $owner->guid;
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                $vars['history_username'] = $username;
            }
            echo elgg_view_resource('messageboard/owner', $vars);
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            $vars['page_owner_guid'] = $owner_guid;
            echo elgg_view_resource('messageboard/owner', $vars);
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:elgg,项目名称:elgg,代码行数:40,代码来源:start.php

示例2: messageboard_page_handler

/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    $pages = dirname(__FILE__) . '/pages/messageboard';
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            include "{$pages}/owner.php";
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            include "{$pages}/add.php";
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            include "{$pages}/owner.php";
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:ibou77,项目名称:elgg,代码行数:45,代码来源:start.php

示例3: messageboard_page_handler

/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            echo elgg_view('resources/messageboard/owner');
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            echo elgg_view('resources/messageboard/add');
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            echo elgg_view('resources/messageboard/owner');
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:elgg,项目名称:messageboard,代码行数:44,代码来源:start.php

示例4: questions_page_handler

/**
 * Handles all question pages
 *
 * @param array $segments
 *
 * @return bool
 */
function questions_page_handler($segments)
{
    elgg_push_breadcrumb(elgg_echo('questions'), 'questions/all');
    $pages = dirname(dirname(__FILE__)) . '/pages/questions';
    switch ($segments[0]) {
        case 'all':
            include "{$pages}/all.php";
            break;
        case 'todo':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                set_input('group_guid', $segments[1]);
            }
            include "{$pages}/todo.php";
            break;
        case 'owner':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                elgg_set_page_owner_guid($segments[1]);
            }
            include "{$pages}/owner.php";
            break;
        case 'view':
            set_input('guid', $segments[1]);
            include "{$pages}/view.php";
            break;
        case 'add':
            elgg_gatekeeper();
            include "{$pages}/add.php";
            break;
        case 'edit':
            elgg_gatekeeper();
            set_input('guid', $segments[1]);
            include "{$pages}/edit.php";
            break;
        case 'group':
            elgg_group_gatekeeper();
            include "{$pages}/owner.php";
            break;
        case 'experts':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                elgg_set_page_owner_guid($segments[1]);
            }
            include "{$pages}/experts.php";
            break;
        default:
            forward('questions/all');
            return false;
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:56,代码来源:page_handlers.php

示例5: blog_get_page_content_list

/**
 * Get page components to list a user's or all blogs.
 *
 * @param int $container_guid The GUID of the page owner or NULL for all blogs
 * @return array
 */
function blog_get_page_content_list($container_guid = NULL)
{
    $return = array();
    $return['filter_context'] = $container_guid ? 'mine' : 'all';
    $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'no_results' => elgg_echo('blog:none'));
    $current_user = elgg_get_logged_in_user_entity();
    if ($container_guid) {
        // access check for closed groups
        elgg_group_gatekeeper();
        $options['container_guid'] = $container_guid;
        $container = get_entity($container_guid);
        if (!$container) {
        }
        $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name));
        $crumbs_title = $container->name;
        elgg_push_breadcrumb($crumbs_title);
        if ($current_user && $container_guid == $current_user->guid) {
            $return['filter_context'] = 'mine';
        } else {
            if (elgg_instanceof($container, 'group')) {
                $return['filter'] = false;
            } else {
                // do not show button or select a tab when viewing someone else's posts
                $return['filter_context'] = 'none';
            }
        }
    } else {
        $return['filter_context'] = 'all';
        $return['title'] = elgg_echo('blog:title:all_blogs');
        elgg_pop_breadcrumb();
        elgg_push_breadcrumb(elgg_echo('blog:blogs'));
    }
    elgg_register_title_button();
    // show all posts for admin or users looking at their own blogs
    // show only published posts for other users.
    $show_only_published = true;
    if ($current_user) {
        if ($current_user->guid == $container_guid || $current_user->isAdmin()) {
            $show_only_published = false;
        }
    }
    if ($show_only_published) {
        $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'));
    }
    $return['content'] = elgg_list_entities_from_metadata($options);
    return $return;
}
开发者ID:tjcaverly,项目名称:Elgg,代码行数:53,代码来源:blog.php

示例6: news_get_page_content_list

/**
 * Get page components to list a user's or all news.
 *
 * @param int $container_guid The GUID of the page owner or null for all news
 * @return array
 */
function news_get_page_content_list($container_guid = null)
{
    $return = array();
    $return['filter_context'] = $container_guid ? 'mine' : 'all';
    $return['filter'] = '';
    $options = array('type' => 'object', 'subtype' => 'news', 'full_view' => false, 'no_results' => elgg_echo('news:none'), 'preload_owners' => true, 'distinct' => false);
    $current_user = elgg_get_logged_in_user_entity();
    if ($container_guid) {
        // access check for closed groups
        elgg_group_gatekeeper();
        $container = get_entity($container_guid);
        if ($container instanceof ElggGroup) {
            $options['container_guid'] = $container_guid;
        } else {
            $options['owner_guid'] = $container_guid;
        }
        $return['title'] = elgg_echo('news:title:user_news', array($container->name));
        $crumbs_title = $container->name;
        elgg_push_breadcrumb($crumbs_title);
        if ($current_user && $container_guid == $current_user->guid) {
            $return['filter_context'] = 'mine';
        } else {
            if (elgg_instanceof($container, 'group')) {
                $return['filter'] = false;
            } else {
                // do not show button or select a tab when viewing someone else's posts
                $return['filter_context'] = 'none';
            }
        }
    } else {
        $options['preload_containers'] = true;
        $return['filter_context'] = 'all';
        $return['title'] = elgg_echo('news:title:all_news');
        elgg_pop_breadcrumb();
        elgg_push_breadcrumb(elgg_echo('news:news'));
    }
    if (elgg_is_admin_logged_in() || $container_guid && elgg_instanceof($container, 'group') && ($container->owner_guid == $current_user->guid || check_entity_relationship($current_user->guid, "group_admin", $container->guid))) {
        elgg_register_title_button();
    }
    $return['content'] = elgg_list_entities($options);
    return $return;
}
开发者ID:hypeJunction,项目名称:news,代码行数:48,代码来源:news.php

示例7: blog_get_page_content_list

/**
 * Get page components to list a user's or all blogs.
 *
 * @param int $container_guid The GUID of the page owner or NULL for all blogs
 * @return array
 */
function blog_get_page_content_list($container_guid = NULL)
{
    $return = array();
    $return['filter_context'] = $container_guid ? 'mine' : 'all';
    $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'no_results' => elgg_echo('blog:none'), 'preload_owners' => true, 'distinct' => false);
    $current_user = elgg_get_logged_in_user_entity();
    if ($container_guid) {
        // access check for closed groups
        elgg_group_gatekeeper();
        $options['container_guid'] = $container_guid;
        $container = get_entity($container_guid);
        if (!$container) {
        }
        $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name));
        $crumbs_title = $container->name;
        elgg_push_breadcrumb($crumbs_title);
        if ($current_user && $container_guid == $current_user->guid) {
            $return['filter_context'] = 'mine';
        } else {
            if (elgg_instanceof($container, 'group')) {
                $return['filter'] = false;
            } else {
                // do not show button or select a tab when viewing someone else's posts
                $return['filter_context'] = 'none';
            }
        }
    } else {
        $options['preload_containers'] = true;
        $return['filter_context'] = 'all';
        $return['title'] = elgg_echo('blog:title:all_blogs');
        elgg_pop_breadcrumb();
        elgg_push_breadcrumb(elgg_echo('blog:blogs'));
    }
    elgg_register_title_button();
    $return['content'] = elgg_list_entities($options);
    return $return;
}
开发者ID:ibou77,项目名称:elgg,代码行数:43,代码来源:blog.php

示例8: elgg_gatekeeper

<?php

/**
 * Album sort page
 *
 * This displays a listing of all the photos so that they can be sorted
 */
elgg_gatekeeper();
elgg_group_gatekeeper();
// get the album entity
$album_guid = elgg_extract('guid', $vars);
$album = get_entity($album_guid);
// panic if we can't get it
if (!$album) {
    forward();
}
// container should always be set, but just in case
$owner = $album->getContainerEntity();
elgg_set_page_owner_guid($owner->getGUID());
$title = elgg_echo('tidypics:sort', array($album->getTitle()));
// set up breadcrumbs
elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
if (elgg_instanceof($owner, 'group')) {
    elgg_push_breadcrumb($owner->name, "photos/group/{$owner->guid}/all");
} else {
    elgg_push_breadcrumb($owner->name, "photos/owner/{$owner->username}");
}
elgg_push_breadcrumb($album->getTitle(), $album->getURL());
elgg_push_breadcrumb(elgg_echo('album:sort'));
if ($album->getSize()) {
开发者ID:juho-jaakkola,项目名称:tidypics,代码行数:31,代码来源:sort.php

示例9: elgg_extract

<?php

$target_guid = elgg_extract('target_guid', $vars);
$post_guids = elgg_extract('post_guids', $vars);
elgg_entity_gatekeeper($target_guid);
elgg_group_gatekeeper(true, $target_guid);
$target = get_entity($target_guid);
elgg_set_page_owner_guid($target->guid);
elgg_push_breadcrumb(elgg_echo('wall'), hypeWall()->router->getPageHandlerId());
if (is_callable(array($target, 'getDisplayName'))) {
    $name = $target->getDisplayName();
} else {
    $name = $target instanceof ElggObject ? $target->title : $target->name;
}
$title = elgg_echo('wall:owner', array($name));
elgg_push_breadcrumb($title, hypeWall()->router->normalize($target->guid));
$content = elgg_view('lists/wall', array('entity' => $target, 'post_guids' => $post_guids));
if (elgg_is_xhr()) {
    echo $content;
} else {
    $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false));
    echo elgg_view_page($title, $layout);
}
开发者ID:justangel,项目名称:hypeWall,代码行数:23,代码来源:wall.php

示例10: elgg_extract

<?php

/**
 * Search for content in this group
 *
 * @uses vars['entity'] ElggGroup
 */
$entity = elgg_extract('entity', $vars, elgg_get_page_owner_entity());
if (!elgg_group_gatekeeper(false, $entity->guid)) {
    return;
}
$identifier = is_callable('group_subtypes_get_identifier') ? group_subtypes_get_identifier($entity) : 'groups';
$url = elgg_get_site_url() . 'search';
$body = elgg_view_form('groups/search', array('action' => $url, 'method' => 'get', 'disable_security' => true), $vars);
echo elgg_view_module('aside', elgg_echo("{$identifier}:search_in_group"), $body);
开发者ID:hypeJunction,项目名称:Elgg-group_profile,代码行数:15,代码来源:search.php

示例11: elgg_get_page_owner_entity

<?php

$page_owner = elgg_get_page_owner_entity();
if (!elgg_group_gatekeeper(false, $page_owner->guid)) {
    echo elgg_format_element('p', ['class' => 'elgg-no-results'], elgg_echo('groups:opengroup:membersonly'));
    return;
}
echo elgg_view('lists/groups/members', array('pagination' => false, 'show_rel' => false, 'show_sort' => false));
echo elgg_format_element('span', ['class' => 'elgg-widget-more'], elgg_view('output/url', array('text' => elgg_echo('groups:members:more'), 'href' => "groups/members/{$entity->guid}")));
开发者ID:hypeJunction,项目名称:Elgg-group_membership,代码行数:9,代码来源:content.php

示例12: groups_handle_members_page

/**
 * Group members page
 *
 * @param int $guid Group entity GUID
 */
function groups_handle_members_page($guid)
{
    elgg_entity_gatekeeper($guid, 'group');
    $group = get_entity($guid);
    elgg_set_page_owner_guid($guid);
    elgg_group_gatekeeper();
    $title = elgg_echo('groups:members:title', array($group->name));
    elgg_push_breadcrumb($group->name, $group->getURL());
    elgg_push_breadcrumb(elgg_echo('groups:members'));
    $db_prefix = elgg_get_config('dbprefix');
    $content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
    $params = array('content' => $content, 'title' => $title, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:n8b,项目名称:VMN,代码行数:20,代码来源:groups.php

示例13: elgg_extract

<?php

$guid = elgg_extract('guid', $vars);
// turn this into a core function
global $autofeed;
$autofeed = true;
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_push_breadcrumb($group->name);
groups_register_profile_buttons($group);
$content = elgg_view('groups/profile/layout', array('entity' => $group));
$sidebar = '';
if (elgg_group_gatekeeper(false)) {
    if (elgg_is_active_plugin('search')) {
        $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group));
    }
    $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group));
    $subscribed = false;
    if (elgg_is_active_plugin('notifications')) {
        $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal();
        foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
            $relationship = check_entity_relationship(elgg_get_logged_in_user_guid(), 'notify' . $method, $guid);
            if ($relationship) {
                $subscribed = true;
                break;
            }
        }
    }
    $sidebar .= elgg_view('groups/sidebar/my_status', array('entity' => $group, 'subscribed' => $subscribed));
}
$params = array('content' => $content, 'sidebar' => $sidebar, 'title' => $group->name);
开发者ID:iXuZhang,项目名称:Project_Curia,代码行数:31,代码来源:profile.php

示例14: discussion_handle_view_page

/**
 * View a discussion topic
 *
 * @param int $guid GUID of topic
 */
function discussion_handle_view_page($guid)
{
    // We now have RSS on topics
    global $autofeed;
    $autofeed = true;
    elgg_entity_gatekeeper($guid, 'object', 'groupforumtopic');
    $topic = get_entity($guid);
    $group = $topic->getContainerEntity();
    if (!elgg_instanceof($group, 'group')) {
        register_error(elgg_echo('group:notfound'));
        forward();
    }
    elgg_load_js('elgg.discussion');
    elgg_set_page_owner_guid($group->getGUID());
    elgg_group_gatekeeper();
    elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}");
    elgg_push_breadcrumb($topic->title);
    $params = array('topic' => $topic, 'show_add_form' => false);
    $content = elgg_view_entity($topic, array('full_view' => true));
    if ($topic->status == 'closed') {
        $content .= elgg_view('discussion/replies', $params);
        $content .= elgg_view('discussion/closed');
    } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) {
        $params['show_add_form'] = true;
        $content .= elgg_view('discussion/replies', $params);
    } else {
        $content .= elgg_view('discussion/replies', $params);
    }
    $params = array('content' => $content, 'title' => $topic->title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($topic->title, $body);
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:37,代码来源:discussion.php

示例15: group_gatekeeper

/**
 * May the current user access item(s) on this page? If the page owner is a group,
 * membership, visibility, and logged in status are taken into account.
 *
 * @param bool $forward         If set to true (default), will forward the page;
 *                              if set to false, will return true or false.
 *
 * @param int  $page_owner_guid The current page owner guid. If not set, this
 *                              will be pulled from elgg_get_page_owner_guid().
 *
 * @return bool Will return if $forward is set to false.
 */
function group_gatekeeper($forward = true, $page_owner_guid = null)
{
    return elgg_group_gatekeeper($forward, $page_owner_guid);
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:16,代码来源:pagehandler.php


注:本文中的elgg_group_gatekeeper函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。