• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP gatekeeper函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: customstyle_page_handler

function customstyle_page_handler($page)
{
    gatekeeper();
    elgg_set_context('customstyle');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('customstyle');
    $base_dir = elgg_get_plugins_path() . 'customstyle/pages/customstyle';
    switch ($page[0]) {
        case 'colors':
            $body = elgg_view('customstyle/colors');
            break;
        case 'background':
            $body = elgg_view('customstyle/background');
            break;
        case 'personalize':
            $body = elgg_view('customstyle/default');
            break;
        default:
            $body = elgg_view('customstyle/default');
            break;
    }
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:Ruthkaveke,项目名称:tumchat,代码行数:26,代码来源:start.php


示例2: stripe_page_handler

/**
 * Stripe related pages
 *
 * @param array $page
 * @param string $handler
 * @return boolean
 */
function stripe_page_handler($page, $handler)
{
    gatekeeper();
    $username = elgg_extract(0, $page, false);
    if ($username) {
        $user = get_user_by_username($username);
    }
    if (!elgg_instanceof($user) || !$user->canEdit()) {
        $user = elgg_get_logged_in_user_entity();
        forward("{$handler}/{$user->username}");
    }
    elgg_set_context('settings');
    elgg_set_page_owner_guid($user->guid);
    elgg_push_breadcrumb(elgg_echo('stripe:billing'), 'billing');
    $context = elgg_extract(1, $page, 'cards');
    $action = elgg_extract(2, $page, 'all');
    $view = "stripe/pages/{$context}/{$action}";
    if (elgg_view_exists($view)) {
        $params = array('entity' => $user, 'id' => elgg_extract(3, $page, false), 'context' => $page);
        $title = elgg_echo("stripe:{$context}:{$action}");
        $content = elgg_view($view, $params);
        $sidebar = elgg_view('stripe/sidebar', $params);
        $filter = elgg_view("stripe/filters/{$context}/{$action}", $params);
    }
    if ($content) {
        if (elgg_is_xhr()) {
            echo $content;
        } else {
            $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'sidebar' => $sidebar, 'filter' => $filter));
            echo elgg_view_page($title, $layout);
        }
        return true;
    }
    return false;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:42,代码来源:page_handlers.php


示例3: whoviewedme_page_handler

/**
 * whoviewedme page handler
 *
 * @param array $page url segments
 * @return bool
 */
function whoviewedme_page_handler($page)
{
    gatekeeper();
    $base = elgg_get_plugins_path() . 'whoviewedme/pages/whoviewedme';
    require_once "{$base}/index.php";
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:13,代码来源:start.php


示例4: twitter_api_pagehandler

/**
 * Serves pages for twitter.
 *
 * @param array $page
 */
function twitter_api_pagehandler($page)
{
    if (!isset($page[0])) {
        forward();
    }
    switch ($page[0]) {
        case 'authorize':
            twitter_api_authorize();
            break;
        case 'revoke':
            twitter_api_revoke();
            break;
        case 'forward':
            twitter_api_forward();
            break;
        case 'login':
            twitter_api_login();
            break;
        case 'interstitial':
            gatekeeper();
            // only let twitter users do this.
            $guid = elgg_get_logged_in_user_guid();
            $twitter_name = elgg_get_plugin_user_setting('twitter_name', $guid, 'twitter_api');
            if (!$twitter_name) {
                register_error(elgg_echo('twitter_api:invalid_page'));
                forward();
            }
            $pages = dirname(__FILE__) . '/pages/twitter_api';
            include "{$pages}/interstitial.php";
            break;
        default:
            forward();
            break;
    }
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:40,代码来源:start.php


示例5: set_notifier_page_handler

function set_notifier_page_handler($page, $identifier)
{
    // select page based on first URL segment after /set_notifier/
    switch ($page[0]) {
        case 'set':
            gatekeeper();
            $num_users = 1;
            $limit = 100;
            $offset = 0;
            while ($num_users != 0) {
                $users = elgg_get_entities(array('types' => 'user', 'limit' => $limit, 'offset' => $offset));
                if ($users != 0) {
                    foreach ($users as $user) {
                        $prefix = "notification:method:notifier";
                        $user->{$prefix} = true;
                        $user->collections_notifications_preferences_notifier = '-1';
                        $user->save();
                    }
                }
                $num_users = count($users);
                $offset += $limit;
            }
            forward(REFERER);
            break;
        default:
            echo "request for {$identifier} {$page['0']}";
            break;
    }
    // return true to let Elgg know that a page was sent to browser
    return true;
}
开发者ID:rtugores,项目名称:set_notifier,代码行数:31,代码来源:start.php


示例6: notifications_page_handler

/**
 * Route page requests
 *
 * @param array $page Array of url parameters
 * @return bool
 */
function notifications_page_handler($page)
{
    gatekeeper();
    $current_user = elgg_get_logged_in_user_entity();
    // default to personal notifications
    if (!isset($page[0])) {
        $page[0] = 'personal';
    }
    if (!isset($page[1])) {
        forward("notifications/{$page[0]}/{$current_user->username}");
    }
    $user = get_user_by_username($page[1]);
    if ($user->guid != $current_user->guid && !$current_user->isAdmin()) {
        forward();
    }
    $base = elgg_get_plugins_path() . 'notifications';
    // note: $user passed in
    switch ($page[0]) {
        case 'group':
            require "{$base}/groups.php";
            break;
        case 'personal':
            require "{$base}/index.php";
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:nogsus,项目名称:Elgg,代码行数:35,代码来源:start.php


示例7: page_handler

/**
 * Serve pages. URLs in the form:
 *
 * pg/block_users/blocked_users/<username> - Users blocked by <username>. If not set, defaults to logged in.
 * pg/block_users/blocked - The page to display when a user is blocked. 
 *
 * @param array $page
 * @return bool Depending on success
 */
function page_handler($page)
{
    gatekeeper();
    if (!isset($page[0])) {
        $page[0] = 'blocked_users';
    }
    switch ($page[0]) {
        case 'blocked_user_content':
            $site = elgg_get_site_entity();
            elgg_set_page_owner_guid($site->guid);
            include dirname(__FILE__) . '/pages/block_users/blocked_user_content.php';
            break;
        case 'blocked_content':
            $site = elgg_get_site_entity();
            elgg_set_page_owner_guid($site->guid);
            include dirname(__FILE__) . '/pages/block_users/blocked_content.php';
            break;
        default:
        case 'blocked_users':
            $logged_in_user = elgg_get_logged_in_user_entity();
            if (!isset($page[1])) {
                $page[1] = $logged_in_user->username;
            }
            set_input('blocking_username', $page[1]);
            // only admins can see another user's block list
            if ($page[1] != $logged_in_user->username) {
                admin_gatekeeper();
            }
            include dirname(__FILE__) . '/pages/block_users/blocked_users.php';
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:41,代码来源:start.php


示例8: staticsites_page_handler

/**
 * Page handler for static sites
 * 
 * This page handler will behave like a REST-ful api endpoint for GET request
 * Since static sites 'containers' are groups, the resource naming and endpoints
 * will look like:
 * 
 * GET  - {elgg_url}/staticsites/{group_guid}/page/{id}
 * GET  - {elgg_url}/staticsites/{group_guid}/pages
 *
 */
function staticsites_page_handler($params)
{
    // Logged in only
    gatekeeper();
    $is_xhr = elgg_is_xhr();
    $is_xhr = 1;
    // Debug
    if ($is_xhr && $params[0]) {
        // Check for container_guid as first param
        if (is_numeric($params[0])) {
            $container_guid = $params[0];
            unset($params[0]);
            $params = array_values($params);
        }
        switch ($params[0]) {
            case "page":
                staticsites_handle_page_request($params, $container_guid);
                break;
            case "pages":
                staticsites_handle_pages_request($params, $container_guid);
                break;
            default:
                return FALSE;
                break;
        }
    } else {
        return FALSE;
    }
    return TRUE;
}
开发者ID:THINKGlobalSchool,项目名称:staticsites,代码行数:41,代码来源:start.php


示例9: loginrequired_init

function loginrequired_init()
{
    global $CONFIG;
    // No need to do all the checking below if the user is already logged in... performance is key :)
    //  if (elgg_is_logged_in()) return;
    elgg_extend_view('css/elgg', 'loginrequired/css');
    //  elgg_unextend_view('page/elements/header', 'search/header');
    elgg_register_plugin_hook_handler('index', 'system', 'loginrequired_index', 1);
    elgg_register_plugin_hook_handler('login_required', 'login_required', 'login_required_default_allowed_list');
    // Get the current page URL without any ? & parameters... this is required for the registration page to work properly
    $current_url = current_page_url();
    $parameters_start = strrpos($current_url, '?');
    if ($parameters_start) {
        $current_url = substr($current_url, 0, $parameters_start);
    }
    // Always allow index page
    if ($current_url == $CONFIG->url) {
        return;
    }
    $allow = array();
    // Allow should have pages
    $allow[] = '_graphics';
    $allow[] = 'action/login';
    $allow[] = 'register';
    $allow[] = 'action/register';
    $allow[] = 'forgotpassword';
    $allow[] = 'resetpassword';
    $allow[] = 'action/user/requestnewpassword';
    $allow[] = 'action/user/passwordreset';
    $allow[] = 'action/security/refreshtoken';
    $allow[] = 'ajax/view/js/languages';
    $allow[] = 'upgrade\\.php';
    $allow[] = 'xml-rpc\\.php';
    $allow[] = 'mt/mt-xmlrpc\\.cgi';
    $allow[] = 'css/.*';
    $allow[] = 'js/.*';
    $allow[] = 'cache/css/.*';
    $allow[] = 'cache/js/.*';
    // Allow other plugin developers to edit the array values
    $add_allow = elgg_trigger_plugin_hook('login_required', 'login_required');
    // If more URL's are added... merge both with original list
    if (is_array($add_allow)) {
        $allow = array_merge($allow, $add_allow);
    }
    // Any public_pages defined via Elgg's walled garden plugin hook?
    $plugins = elgg_trigger_plugin_hook('public_pages', 'walled_garden', NULL, array());
    // If more URL's are added... merge both with original list
    if (is_array($plugins)) {
        $allow = array_merge($allow, $plugins);
    }
    // Check if current page is in allowed list... otherwise redirect to login
    foreach ($allow as $public) {
        $pattern = "`^{$CONFIG->url}{$public}/*\$`i";
        if (preg_match($pattern, $current_url)) {
            return;
        }
    }
    gatekeeper();
}
开发者ID:remy40,项目名称:gvrs,代码行数:59,代码来源:start.php


示例10: logout

 public function logout()
 {
     gatekeeper();
     // Logout and redirect to frontpage
     $this->Member_model->logout();
     message('Successfully signed out.');
     redirect('auth/login');
 }
开发者ID:johusman,项目名称:internal,代码行数:8,代码来源:auth.php


示例11: admin_gatekeeper

function admin_gatekeeper()
{
    gatekeeper();
    $CI =& get_instance();
    if (!$CI->Group_model->member_of_group(member_id(), 'admins')) {
        error('You have to be logged in as an administrator to access this page.');
        redirect();
    }
}
开发者ID:johusman,项目名称:internal,代码行数:9,代码来源:makerspace_helper.php


示例12: hj_framework_page_handlers

/**
 * Page handlers for hypeFramework
 *
 *
 * @param type $page
 * @return type
 */
function hj_framework_page_handlers($page)
{
    if (!isset($page[0])) {
        forward();
    }
    $path_pages = elgg_get_root_path() . 'mod/hypeFramework/pages/';
    switch ($page[0]) {
        case 'edit':
            set_input('guid', $page[1]);
            include $path_pages . 'edit/object.php';
            break;
        case 'icon':
            set_input('guid', $page[1]);
            set_input('size', $page[2]);
            include $path_pages . "icon/icon.php";
            break;
        case 'download':
            set_input('guid', $page[1]);
            include $path_pages . "file/download.php";
            break;
        case 'file':
            switch ($page[1]) {
                case 'create':
                    gatekeeper();
                    $container_guid = elgg_extract(2, $page, false);
                    if (!$container_guid) {
                        $container_guid = elgg_get_logged_in_user_guid();
                    }
                    elgg_set_page_owner_guid($container_guid);
                    set_input('container_guid', $container_guid);
                    include "{$path_pages}create/file.php";
                    break;
                case 'edit':
                    gatekeeper();
                    set_input('guid', $page[2]);
                    include "{$path_pages}edit/object.php";
                    break;
                case 'view':
                    if (!isset($page[2])) {
                        return false;
                    }
                    $entity = get_entity($page[2]);
                    if (!$entity) {
                        return false;
                    }
                    $sidebar = elgg_view('framework/file/dashboard/sidebar', array('entity' => $entity));
                    echo elgg_view_page($entity->title, elgg_view_layout('framework/entity', array('entity' => $entity, 'sidebar' => $sidebar)));
                    break;
            }
            break;
        default:
            return false;
            break;
    }
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:63,代码来源:page_handlers.php


示例13: poll_get_page_edit

function poll_get_page_edit($page_type, $guid = 0)
{
    gatekeeper();
    // Get the current page's owner
    $page_owner = elgg_get_page_owner_entity();
    if ($page_owner === false || is_null($page_owner)) {
        $page_owner = elgg_get_logged_in_user_entity();
        elgg_set_page_owner_guid($page_owner->guid);
    }
    $form_vars = array('id' => 'poll-edit-form');
    // Get the post, if it exists
    if ($page_type == 'edit') {
        $poll = get_entity($guid);
        if ($poll instanceof Poll) {
            $container_guid = $poll->container_guid;
            elgg_set_page_owner_guid($container_guid);
            $title = elgg_echo('poll:editpost', array($poll->title));
            $body_vars = array('fd' => poll_prepare_edit_body_vars($poll), 'entity' => $poll);
            if ($poll->canEdit()) {
                $content = elgg_view_form("poll/edit", $form_vars, $body_vars);
            } else {
                $content = elgg_echo('poll:permission_error');
            }
            $container = get_entity($container_guid);
            if (elgg_instanceof($container, 'group')) {
                elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID());
            } else {
                elgg_push_breadcrumb($container->name, 'poll/owner/' . $container->username);
            }
            elgg_push_breadcrumb(elgg_echo("poll:edit"));
        } else {
            $title = elgg_echo('poll:error_title');
            $content = elgg_echo('poll:no_such_poll');
        }
    } else {
        if ($guid) {
            elgg_set_page_owner_guid($guid);
            $container = get_entity($guid);
            elgg_push_breadcrumb($container->name, 'poll/group/' . $container->getGUID());
        } else {
            $user = elgg_get_logged_in_user_entity();
            elgg_set_page_owner_guid($user->getGUID());
            elgg_push_breadcrumb($user->name, 'poll/owner/' . $user->username);
        }
        elgg_push_breadcrumb(elgg_echo('poll:add'));
        $title = elgg_echo('poll:addpost');
        $body_vars = array('fd' => poll_prepare_edit_body_vars(), 'container_guid' => $guid);
        $content = elgg_view_form("poll/edit", $form_vars, $body_vars);
    }
    $params = array('title' => $title, 'content' => $content, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    // Display page
    return elgg_view_page($title, $body);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:54,代码来源:model.php


示例14: invitefriends_page_handler

/**
 * Page handler function
 * 
 * @param array $page Page URL segments
 */
function invitefriends_page_handler($page)
{
    gatekeeper();
    elgg_set_context('friends');
    set_page_owner(elgg_get_logged_in_user_guid());
    $title = elgg_echo('friends:invite');
    $body = elgg_view('invitefriends/form');
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:16,代码来源:start.php


示例15: reportedcontent_page_handler

/**
 * Reported content page handler
 *
 * Serves the add report page
 *
 * @param array $page Array of page routing elements
 */
function reportedcontent_page_handler($page)
{
    // only logged in users can report things
    gatekeeper();
    $content .= elgg_view_title(elgg_echo('reportedcontent:this'));
    $content .= elgg_view_form('reportedcontent/add');
    $sidebar = elgg_echo('reportedcontent:instructions');
    $params = array('content' => $content, 'sidebar' => $sidebar);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page(elgg_echo('reportedcontent:this'), $body);
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:18,代码来源:start.php


示例16: importer_page_handler

function importer_page_handler($page)
{
    gatekeeper();
    elgg_set_context('friends');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('import:contacts');
    $body = elgg_view('importer/form');
    $params = array('content' => $body, 'title' => $title);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:12,代码来源:start.php


示例17: donation_page_handler

function donation_page_handler($page)
{
    gatekeeper();
    $title = elgg_echo('donation:title:everyone', array(elgg_get_config('sitename')));
    $content = elgg_view('donation/everyone');
    if (elgg_get_plugin_setting('sidebar_donation', 'donation') != 'yes') {
        $sidebar = elgg_view("donation/sidebar");
    }
    $params = array('content' => $content, 'title' => $title, 'sidebar' => $sidebar);
    $body = elgg_view_layout('one_sidebar', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:12,代码来源:start.php


示例18: isegoria_page_handler

/**
 * GV isegoria page handler.
 */
function isegoria_page_handler()
{
    // Ensure that only logged-in users can see this page
    gatekeeper();
    // Set context and title
    elgg_set_context('dashboard');
    elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    $title = elgg_echo('dashboard');
    $params = array('num_columns' => 3, 'show_access' => false);
    $widgets = elgg_view_layout('widgets', $params);
    $body = elgg_view_layout('one_column', array('content' => $widgets));
    echo elgg_view_page($title, $body);
    return true;
}
开发者ID:remy40,项目名称:gvrs,代码行数:17,代码来源:start.php


示例19: chat_page_handler

/**
 * Dispatche chat pages.
 *
 * @param array $page
 * @return bool
 */
function chat_page_handler($page)
{
    elgg_load_library('chat');
    if (!isset($page[0])) {
        elgg_push_breadcrumb(elgg_echo('chat'));
        $page[0] = 'all';
    } else {
        elgg_push_breadcrumb(elgg_echo('chat'), 'chat/all');
    }
    switch ($page[0]) {
        case 'messages':
            include __DIR__ . '/messages.php';
            return true;
        case 'notifier':
            include __DIR__ . '/notifier.php';
            return true;
        case 'owner':
            $user = get_user_by_username($page[1]);
            $params = chat_all($user->guid);
            break;
        case 'friends':
            $user = get_user_by_username($page[1]);
            $params = chat_friends($user->guid);
            break;
        case 'add':
            gatekeeper();
            $params = chat_edit();
            break;
        case 'edit':
            gatekeeper();
            $params = chat_edit($page[1]);
            break;
        case 'view':
            $params = chat_view($page[1]);
            break;
        case 'members':
            gatekeeper();
            $params = chat_add_members($page[1]);
            break;
        case 'all':
        default:
            $params = chat_all();
            break;
    }
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page('test', $body);
    return true;
}
开发者ID:juho-jaakkola,项目名称:elgg-chat,代码行数:54,代码来源:start.php


示例20: notifier_page_handler

/**
 * Dispatches notifier pages
 *
 * URLs take the form of
 *  All notifications:          notifier/all
 *  Subjects of a notification: notifier/subjects/<notification guid>
 *
 * @param array $segments Array of URL segments
 * @return bool Was the page handled successfully
 */
function notifier_page_handler($segments)
{
    gatekeeper();
    $page = array_shift($segments);
    switch ($page) {
        default:
        case 'all':
        case 'popup':
            echo elgg_view_resource('notifier/list');
            return true;
        case 'subjects':
            $guid = array_shift($segments);
            echo elgg_view_resource('notifier/subjects', array('guid' => $guid));
            return true;
    }
    return false;
}
开发者ID:juho-jaakkola,项目名称:elgg-notifier,代码行数:27,代码来源:start.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gateway_apply_smsc_config函数代码示例发布时间:2022-05-15
下一篇:
PHP garbage_collection函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap