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


PHP admin_gatekeeper函数代码示例

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


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

示例1: __construct

 public function __construct($page)
 {
     admin_gatekeeper();
     global $CONFIG;
     $cshop = new stdClass();
     $this->controller = GLOBAL_IZAP_CURRENT_CONTROLLER;
     $this->action = 'action' . ucfirst($page[0]);
     $this->_page = $page;
     $this->url_vars = $this->_page;
     $this->page_layout = $this->page_shell = 'admin';
     $cshop->view = $this->_view = 'admin/' . implode('/', $page);
     $this->page_elements['title'] = elgg_echo("admin:{$page[0]}");
     if (count($page) > 1) {
         $this->page_elements['title'] .= ' : ' . elgg_echo('admin:' . implode(':', $page));
     }
     if (method_exists($this, $this->action)) {
         elgg_admin_add_plugin_settings_menu();
         elgg_set_context('admin');
         elgg_unregister_css('elgg');
         $url = elgg_get_simplecache_url('js', 'admin');
         elgg_register_js('elgg.admin', $url);
         elgg_load_js('elgg.admin');
         elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js');
         elgg_load_js('jquery.jeditable');
     }
     $CONFIG->cshop = $cshop;
 }
开发者ID:socialweb,项目名称:PiGo,代码行数:27,代码来源:IzapAdminController.php

示例2: 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

示例3: advanced_statistics_page_handler

/**
 * Handles the advanced statistics pages
 *
 * @param array $page requested page
 *
 * @return boolean
 */
function advanced_statistics_page_handler($page)
{
    admin_gatekeeper();
    switch ($page[0]) {
        case 'users':
            echo advanced_statistics_get_users_data($page[1]);
            break;
        case 'groups':
            echo advanced_statistics_get_groups_data($page[1]);
            break;
        case 'activity':
            echo advanced_statistics_get_activity_data($page[1]);
            break;
        case 'content':
            echo advanced_statistics_get_content_data($page[1]);
            break;
        case 'system':
            echo advanced_statistics_get_system_data($page[1]);
            break;
        case 'widgets':
            echo advanced_statistics_get_widgets_data($page[1]);
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:coldtrick,项目名称:advanced_statistics,代码行数:34,代码来源:start.php

示例4: group_tools_route_groups_handler

function group_tools_route_groups_handler($hook, $type, $return_value, $params)
{
    /**
     * $return_value contains:
     * $return_value['handler'] => requested handler
     * $return_value['segments'] => url parts ($page)
     */
    $result = $return_value;
    if (!empty($return_value) && is_array($return_value)) {
        $page = $return_value['segments'];
        switch ($page[0]) {
            case "all":
                $filter = get_input("filter");
                if (empty($filter) && ($default_filter = elgg_get_plugin_setting("group_listing", "group_tools"))) {
                    $filter = $default_filter;
                    set_input("filter", $default_filter);
                }
                if (in_array($filter, array("open", "closed", "alpha"))) {
                    // we will handle the output
                    $result = false;
                    include dirname(dirname(__FILE__)) . "/pages/groups/all.php";
                }
                break;
            case "requests":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/groups/membershipreq.php";
                break;
            case "invite":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/groups/invite.php";
                break;
            case "mail":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/mail.php";
                break;
            case "group_invite_autocomplete":
                $result = false;
                include dirname(dirname(__FILE__)) . "/procedures/group_invite_autocomplete.php";
                break;
            case "add":
                if (group_tools_is_group_creation_limited()) {
                    admin_gatekeeper();
                }
                break;
            default:
                // check if we have an old group profile link
                if (isset($page[0]) && is_numeric($page[0])) {
                    if (($group = get_entity($page[0])) && elgg_instanceof($group, "group", null, "ElggGroup")) {
                        register_error(elgg_echo("changebookmark"));
                        forward($group->getURL());
                    }
                }
                break;
        }
    }
    return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:60,代码来源:hooks.php

示例5: elgg_modifications_generate_digischool_menu_page_handler

function elgg_modifications_generate_digischool_menu_page_handler($page)
{
    admin_gatekeeper();
    if (elgg_is_active_plugin("menu_builder")) {
        // remove current menu items
        $current_options = array("type" => "object", "subtype" => "menu_builder_menu_item", "limit" => false);
        if ($current_items = elgg_get_entities($current_options)) {
            foreach ($current_items as $current_item) {
                $current_item->delete();
            }
        }
        // 			var_dump($current_items);
        // 			exit();
        // add the new ones
        $site = elgg_get_site_entity();
        $site_acl = $site->getACL();
        $menu_items = array(array("title" => "Voorpagina", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Alle blogs", "url" => "[wwwroot]blog/all", "access_id" => ACCESS_PUBLIC), array("title" => "Alle activiteiten", "url" => "[wwwroot]activity", "access_id" => ACCESS_LOGGED_IN))), array("title" => "Statische pagina's", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_LOGGED_IN), array("title" => "Archief", "url" => "Zelf in te vullen", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelen", "url" => "#", "access_id" => ACCESS_PUBLIC, "children" => array(array("title" => "Vakpagina", "url" => "hier de link naar uw vakp", "access_id" => ACCESS_PUBLIC), array("title" => "Leermiddelenbank Digischool", "url" => "[wwwroot]", "access_id" => ACCESS_PUBLIC), array("title" => "Leden keurmerkgroepen", "url" => "zelf te vullen", "access_id" => ACCESS_PUBLIC))), array("title" => "Leden", "url" => "#", "access_id" => ACCESS_LOGGED_IN, "children" => array(array("title" => "Mijn groepen", "url" => "[wwwroot]groups/member/[username]", "access_id" => $site_acl), array("title" => "Mijn profielpagina", "url" => "[wwwroot]profile/[username]", "access_id" => $site_acl), array("title" => "Alle groepen", "url" => "[wwwroot]groups/all/?filter=pop", "access_id" => $site_acl), array("title" => "Lid worden", "url" => "[wwwroot]lidworden", "access_id" => ACCESS_PUBLIC), array("title" => "Content toevoegen", "url" => "[wwwroot]add", "access_id" => $site_acl), array("title" => "Mijn dashboard", "url" => "[wwwroot]dashboard", "access_id" => $site_acl), array("title" => "Zoeken leden", "url" => "[wwwroot]members", "access_id" => $site_acl), array("title" => "Mijn contacten", "url" => "[wwwroot]friends/[username]", "access_id" => $site_acl), array("title" => "Contactverzoeken", "url" => "[wwwroot]friend_request/", "access_id" => $site_acl), array("title" => "Mijn instellingen", "url" => "[wwwroot]settings", "access_id" => $site_acl), array("title" => "Nieuwe groep maken", "url" => "[wwwroot]groups/add", "access_id" => $site_acl))), array("title" => "Beheer", "url" => "[wwwroot]admin", "access_id" => ACCESS_PRIVATE, "children" => array(array("title" => "Gebruikersbeheer", "url" => "[wwwroot]admin/users/newest", "access_id" => ACCESS_PRIVATE), array("title" => "Nodig leden uit", "url" => "[wwwroot]admin/users/invite", "access_id" => ACCESS_PRIVATE), array("title" => "Pluginbeheer", "url" => "[wwwroot]admin/plugins", "access_id" => ACCESS_PRIVATE), array("title" => "Beheer template", "url" => "[wwwroot]admin/appearance/template", "access_id" => ACCESS_PRIVATE))));
        $i = 0;
        foreach ($menu_items as $main_item) {
            $item = new ElggObject();
            $item->subtype = "menu_builder_menu_item";
            $item->owner_guid = $site->getGUID();
            $item->container_guid = $site->getGUID();
            $item->site_guid = $site->getGUID();
            $item->access_id = $main_item["access_id"];
            $item->parent_guid = 0;
            $item->title = $main_item["title"];
            $item->url = $main_item["url"];
            $item->order = $i;
            $i++;
            $item->save();
            if (array_key_exists("children", $main_item)) {
                foreach ($main_item["children"] as $sub_item) {
                    $submenu_item = new ElggObject();
                    $submenu_item->subtype = "menu_builder_menu_item";
                    $submenu_item->owner_guid = $site->getGUID();
                    $submenu_item->container_guid = $site->getGUID();
                    $submenu_item->site_guid = $site->getGUID();
                    $submenu_item->access_id = $sub_item["access_id"];
                    $submenu_item->parent_guid = $item->getGUID();
                    $submenu_item->title = $sub_item["title"];
                    $submenu_item->url = $sub_item["url"];
                    $submenu_item->order = $i;
                    $i++;
                    $submenu_item->save();
                }
            }
        }
        system_message("menu created");
    } else {
        register_error("plugin menu_builder not activated");
    }
    forward();
}
开发者ID:pleio,项目名称:elgg_modifications,代码行数:54,代码来源:page_handlers.php

示例6: pagesetup

/**
 * page setup - protect anon user owned pages
 */
function pagesetup()
{
    $user = get_anon_user();
    $page_owner = elgg_get_page_owner_entity();
    if ($user->guid == $page_owner->guid) {
        // admin could log in as the anon user to set some things
        if ($user->guid != elgg_get_logged_in_user_guid()) {
            admin_gatekeeper();
        }
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:14,代码来源:events.php

示例7: group_tools_route_groups_handler

function group_tools_route_groups_handler($hook, $type, $return_value, $params)
{
    /**
     * $return_value contains:
     * $return_value['handler'] => requested handler
     * $return_value['segments'] => url parts ($page)
     */
    $result = $return_value;
    if (!empty($return_value) && is_array($return_value)) {
        $page = $return_value['segments'];
        switch ($page[0]) {
            case "all":
                $filter = get_input("filter");
                if (empty($filter) && ($default_filter = elgg_get_plugin_setting("group_listing", "group_tools"))) {
                    $filter = $default_filter;
                    set_input("filter", $default_filter);
                }
                if (in_array($filter, array("open", "closed", "alpha"))) {
                    // we will handle the output
                    $result = false;
                    include dirname(dirname(__FILE__)) . "/pages/groups/all.php";
                }
                break;
            case "requests":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/groups/membershipreq.php";
                break;
            case "invite":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/groups/invite.php";
                break;
            case "mail":
                $result = false;
                set_input("group_guid", $page[1]);
                include dirname(dirname(__FILE__)) . "/pages/mail.php";
                break;
            case "group_invite_autocomplete":
                $result = false;
                include dirname(dirname(__FILE__)) . "/procedures/group_invite_autocomplete.php";
                break;
            case "add":
                if (group_tools_is_group_creation_limited()) {
                    admin_gatekeeper();
                }
                break;
        }
    }
    return $result;
}
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:51,代码来源:hooks.php

示例8: importUsersPageHandler

function importUsersPageHandler($page)
{
    admin_gatekeeper();
    elgg_admin_add_plugin_settings_menu();
    elgg_set_context('admin');
    elgg_unregister_css('elgg');
    elgg_load_js('elgg.admin');
    elgg_load_js('jquery.jeditable');
    $vars = array('page' => $page);
    $view = 'import/' . implode('/', $page);
    $title = "Import Users";
    $content = elgg_view($view);
    $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
    echo elgg_view_page($title, $body, 'admin');
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:16,代码来源:start.php

示例9: admin_notes_pagehandler

/**
 * Shows notes on users.
 *
 * @param array $page URL segments
 * @return bool
 */
function admin_notes_pagehandler($page)
{
    admin_gatekeeper();
    $username = isset($page[0]) ? $page[0] : NULL;
    if ($username && !($user = get_user_by_username($username))) {
        // invalid username passed. emit error and forward to all.
        register_error(elgg_echo('admin_notes:unknown_user'));
        forward('admin_notes');
    }
    // for owner blocks
    if ($user) {
        elgg_set_page_owner_guid($user->getGUID());
    } else {
        elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
    }
    include dirname(__FILE__) . '/pages/list_notes.php';
    return true;
}
开发者ID:ewinslow,项目名称:Admin-Notes,代码行数:24,代码来源:start.php

示例10: group_requests_page_handler

/**
 * Serve pages related to group requests
 *
 * @param array $page The URL segments
 */
function group_requests_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'add';
    }
    $params = array('filter' => false);
    switch ($page[0]) {
        case 'all':
            admin_gatekeeper();
            $requests = elgg_list_entities(array('type' => 'object', 'subtype' => \Groups\Requests\Request::SUBTYPE, 'no_results' => elgg_echo('group_requests:none')));
            $params['title'] = elgg_echo('group_requests:requests');
            $params['content'] = $requests;
            break;
        case 'add':
        default:
            gatekeeper();
            $params['title'] = elgg_echo('group_requests:request');
            $params['content'] = elgg_view_form('groups/request', array(), array('user_guid' => elgg_get_logged_in_user_guid()));
            break;
    }
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
开发者ID:juho-jaakkola,项目名称:elgg-group_requests,代码行数:28,代码来源:start.php

示例11: group_tools_route_groups_handler

/**
 * Take over the groups page handler in some cases
 *
 * @param string $hook         the 'route' hook
 * @param string $type         for the 'groups' page handler
 * @param bool   $return_value tells which page is handled, contains:
 *    $return_value['handler'] => requested handler
 *    $return_value['segments'] => url parts ($page)
 * @param null   $params       no params provided
 *
 * @return bool false if we take over the page handler
 */
function group_tools_route_groups_handler($hook, $type, $return_value, $params)
{
    $result = $return_value;
    if (empty($return_value) || !is_array($return_value)) {
        return;
    }
    $page = $return_value['segments'];
    switch ($page[0]) {
        case "all":
            $filter = get_input("filter");
            $default_filter = elgg_get_plugin_setting("group_listing", "group_tools");
            if (empty($filter) && !empty($default_filter)) {
                $filter = $default_filter;
                set_input("filter", $default_filter);
            } elseif (empty($filter)) {
                $filter = "newest";
                set_input("filter", $filter);
            }
            if (in_array($filter, array("yours", "open", "closed", "alpha", "ordered", "suggested"))) {
                // we will handle the output
                $result = false;
                include dirname(dirname(__FILE__)) . "/pages/groups/all.php";
            }
            break;
        case "suggested":
            $result = false;
            include dirname(dirname(__FILE__)) . "/pages/groups/suggested.php";
            break;
        case "search":
            $result = false;
            include dirname(dirname(__FILE__)) . "/pages/groups/search.php";
            break;
        case "requests":
            $result = false;
            set_input("group_guid", $page[1]);
            if (isset($page[2])) {
                set_input("subpage", $page[2]);
            }
            include dirname(dirname(__FILE__)) . "/pages/groups/membershipreq.php";
            break;
        case "invite":
            $result = false;
            set_input("group_guid", $page[1]);
            include dirname(dirname(__FILE__)) . "/pages/groups/invite.php";
            break;
        case "mail":
            $result = false;
            set_input("group_guid", $page[1]);
            include dirname(dirname(__FILE__)) . "/pages/mail.php";
            break;
        case 'members':
            $result = false;
            set_input('group_guid', $page[1]);
            include dirname(dirname(__FILE__)) . "/pages/groups/members.php";
            break;
        case "group_invite_autocomplete":
            $result = false;
            include dirname(dirname(__FILE__)) . "/procedures/group_invite_autocomplete.php";
            break;
        case "add":
            if (group_tools_is_group_creation_limited()) {
                admin_gatekeeper();
            }
            break;
        case "invitations":
            $result = false;
            if (isset($page[1])) {
                set_input("username", $page[1]);
            }
            include dirname(dirname(__FILE__)) . "/pages/groups/invitations.php";
            break;
        case "related":
            $result = false;
            if (isset($page[1])) {
                set_input("group_guid", $page[1]);
            }
            include dirname(dirname(__FILE__)) . "/pages/groups/related.php";
            break;
        case "profile":
            if (isset($page[1]) && is_numeric($page[1])) {
                $group = get_entity($page[1]);
                if (empty($group)) {
                    // is this a hidden group
                    $ia = elgg_set_ignore_access(true);
                    $group = get_entity($page[1]);
                    if (!empty($group) && elgg_instanceof($group, "group")) {
                        // report to the user
                        if (!elgg_is_logged_in()) {
//.........这里部分代码省略.........
开发者ID:lorea,项目名称:Hydra-dev,代码行数:101,代码来源:hooks.php

示例12: userManagementPageHandler

function userManagementPageHandler($page)
{
    switch ($page[0]) {
        case 'users':
            include elgg_get_plugins_path() . 'userManagement/pages/users.php';
            break;
        case 'deactivate':
            $userMgmt = new UserManagement();
            $userMgmt->getInactiveUsers();
            $userMgmt->deactivateUsers();
            break;
            //activate account form
        //activate account form
        case 'activate':
            $userMgmt = new UserManagement();
            //check if user doesnt have forces email send them to different form
            if ($userMgmt->validEmail(get_input('email'))) {
                include elgg_get_plugins_path() . 'userManagement/pages/activate.php';
            } else {
                include elgg_get_plugins_path() . 'userManagement/pages/changeEmail.php';
            }
            break;
            //activate account action
        //activate account action
        case 'activation':
            $userMgmt = new UserManagement();
            $userGuid = get_input('u');
            $code = get_input('c');
            $user = get_entity($userGuid);
            if (!$user) {
                register_error(elgg_echo('activate:error'));
                forward(REFERER);
            }
            $userMgmt->setUser($user);
            if (!$userMgmt->validateCode($code)) {
                register_error(elgg_echo('activate:error'));
                forward(REFERER);
            }
            //activate user
            if ($userMgmt->activateUser()) {
                system_message(elgg_echo('activate:success'));
                forward(REFERER);
            }
            break;
        case 'import':
            admin_gatekeeper();
            elgg_admin_add_plugin_settings_menu();
            elgg_set_context('admin');
            elgg_unregister_css('elgg');
            elgg_load_js('elgg.admin');
            elgg_load_js('jquery.jeditable');
            $vars = array('page' => $page);
            $view = 'usermanagement/' . implode('/', $page);
            $title = "Import Users";
            $content = elgg_view($view);
            $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
            echo elgg_view_page($title, $body, 'admin');
            break;
        case 'resetPassword':
            set_input('guid', $_SESSION['userId']);
            include elgg_get_plugins_path() . "userManagement/pages/resetPassword.php";
            break;
        case 'registerEmails':
            include elgg_get_plugins_path() . "userManagement/pages/registerEmails.php";
            break;
        case 'admin':
            if ($page[1] == activate) {
                include elgg_get_plugins_path() . "userManagement/pages/admin/activate.php";
            }
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:75,代码来源:start.php

示例13: page_handler

/**
 * Handle pages
 *
 * @param array $page		URL segments
 * @param string $handler	Pagehandler name
 * @return boolean
 */
function page_handler($page, $handler)
{
    elgg_load_js('lightbox');
    elgg_load_css('lightbox');
    elgg_push_breadcrumb(elgg_echo('mechanics:points'), 'points');
    switch ($page[0]) {
        case 'leaderboard':
        default:
            $title = elgg_echo('mechanics:leaderboard');
            $filter = elgg_view('framework/mechanics/filter', array('filter_context' => 'leaderboard'));
            $sidebar = elgg_view('framework/mechanics/sidebar', array('filter_context' => 'leaderboard'));
            $content = elgg_view('framework/mechanics/leaderboard/list');
            break;
        case 'all':
        case 'badges':
            if (elgg_is_admin_logged_in()) {
                elgg_register_menu_item('title', array('name' => 'add_badge', 'text' => elgg_echo('mechanics:badges:add'), 'href' => "{$handler}/badge/edit", 'class' => 'elgg-button elgg-button-action'));
            }
            $title = elgg_echo('mechanics:badges:site');
            $filter = elgg_view('framework/mechanics/filter', array('filter_context' => 'badges'));
            $sidebar = elgg_view('framework/mechanics/sidebar', array('filter_context' => 'badges'));
            $content = elgg_view('framework/mechanics/badges');
            break;
        case 'badge':
            elgg_push_breadcrumb(elgg_echo('mechanics:badges:site'), "{$handler}/badges");
            switch ($page[1]) {
                case 'edit':
                    admin_gatekeeper();
                    $entity = get_entity($page[2]);
                    $title = $entity ? elgg_echo('mechanics:badges:edit', array($entity->title)) : elgg_echo('mechanics:badges:add');
                    $filter = false;
                    $sidebar = elgg_view('framework/mechanics/sidebar', array('entity' => $entity));
                    $content = elgg_view('framework/mechanics/badge/edit', array('entity' => $entity));
                    break;
                case 'view':
                    $entity = get_entity($page[2]);
                    if (!elgg_instanceof($entity, 'object', HYPEGAMEMECHANICS_BADGE_SUBTYPE)) {
                        return false;
                    }
                    $title = $entity->title;
                    $filter = false;
                    $sidebar = elgg_view('framework/mechanics/sidebar', array('entity' => $entity));
                    $content = elgg_view('framework/mechanics/badge/view', array('entity' => $entity));
                    break;
            }
            break;
        case 'clearSesh':
            //clear session badges
            $_SESSION['badges_check'] = 1;
            unset($_SESSION['badges']);
            break;
        case 'award':
            if (elgg_is_xhr()) {
                //get array of new badges and put them in the slider
                $content = "<ul class='rslides clearfix' id='badge-slider'>";
                foreach (array_reverse($_SESSION['badges']) as $index => $badge) {
                    $entity = get_entity($badge->guid);
                    $icon = elgg_view_entity_icon($entity, '', array("width" => '125px', 'height' => "125px"));
                    $content .= "<li>";
                    $content .= "<h2>" . elgg_echo('mechanics:badge:claim:success', array($badge->title)) . "</h2>";
                    $content .= "<div class='badge-icon'>" . $icon . "</div>";
                    $content .= "<h3>" . $badge->description . "</h3>";
                    $content .= "</li>";
                }
                $content .= "</ul>";
                echo $content;
                exit;
            } else {
                $entity = get_entity($page[1]);
                if (!elgg_instanceof($entity, 'user') || !$entity->canAnnotate(0, 'gm_score_award')) {
                    return false;
                }
                elgg_set_page_owner_guid($entity->guid);
                $title = elgg_echo('mechanics:admin:award_to', array($entity->name));
                $filter = false;
                $sidebar = elgg_view('framework/mechanics/sidebar', array('entity' => $entity));
                $content = elgg_view('framework/mechanics/points/award', array('entity' => $entity));
            }
            break;
        case 'owner':
            gatekeeper();
            $user = get_user_by_username($page[1]);
            if (elgg_instanceof($user, 'user')) {
                elgg_set_page_owner_guid($user->guid);
            } else {
                $user = elgg_get_logged_in_user_entity();
                forward("{$handler}/owner/{$user->username}");
            }
            if (!$user || !$user->canEdit()) {
                return false;
            }
            if ($user->guid == elgg_get_logged_in_user_guid()) {
                $title = elgg_echo('mechanics:badges:mine');
//.........这里部分代码省略.........
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:101,代码来源:page_handlers.php

示例14: admin_plugin_screenshot_page_handler

/**
 * Serves up screenshots for plugins from
 * admin_plugin_screenshot/<plugin_id>/<size>/<ss_name>.<ext>
 *
 * @param array $pages The pages array
 * @return true
 */
function admin_plugin_screenshot_page_handler($pages)
{
    admin_gatekeeper();
    // only admins can use this - security feature
    $plugin_id = elgg_extract(0, $pages);
    // only thumbnail or full.
    $size = elgg_extract(1, $pages, 'thumbnail');
    // the rest of the string is the filename
    $filename_parts = array_slice($pages, 2);
    $filename = implode('/', $filename_parts);
    $filename = sanitise_filepath($filename, false);
    $plugin = new ElggPlugin($plugin_id);
    if (!$plugin) {
        $file = elgg_get_root_path() . '_graphics/icons/default/medium.png';
    } else {
        $file = $plugin->getPath() . $filename;
        if (!file_exists($file)) {
            $file = elgg_get_root_path() . '_graphics/icons/default/medium.png';
        }
    }
    header("Content-type: image/jpeg");
    // resize to 100x100 for thumbnails
    switch ($size) {
        case 'thumbnail':
            echo get_resized_image_from_existing_file($file, 100, 100, true);
            break;
        case 'full':
        default:
            echo file_get_contents($file);
            break;
    }
    return true;
}
开发者ID:rasul,项目名称:Elgg,代码行数:40,代码来源:admin.php

示例15: faq_page_handler

function faq_page_handler($page)
{
    if (!isset($page[0])) {
        $page[0] = 'index';
    }
    elgg_push_breadcrumb(elgg_echo('faq:shorttitle'), 'faq/');
    $title = elgg_echo('faq:title');
    $page_type = $page[0];
    switch ($page_type) {
        case 'index':
            $area = elgg_view('faq/search');
            $area .= elgg_view('faq/stats');
            break;
        case 'list':
            $catId = (int) get_input("categoryId");
            if (!empty($catId)) {
                $cats = getCategories();
                $cat = get_metastring($catId);
                if (in_array($cat, $cats)) {
                    elgg_push_breadcrumb(elgg_echo("faq:list:category_title") . $cat);
                }
            }
            $area = elgg_view('faq/list');
            break;
        case 'ask':
            gatekeeper();
            elgg_push_breadcrumb(elgg_echo('faq:ask:title'));
            $area = elgg_view('faq/forms/ask');
            break;
        case 'asked':
            admin_gatekeeper();
            elgg_push_breadcrumb(elgg_echo('faq:asked:title'));
            $area = elgg_view('faq/asked');
            break;
        case 'add':
            admin_gatekeeper();
            elgg_push_breadcrumb(elgg_echo('faq:add:title'));
            $area = elgg_view('faq/forms/add');
            break;
        case 'edit':
            admin_gatekeeper();
            elgg_push_breadcrumb(elgg_echo('faq:edit:title'));
            $area = elgg_view('faq/forms/add');
            break;
        default:
            return false;
    }
    $sidebar = elgg_view('faq/sidebar');
    // Format page
    $body = elgg_view_layout('content', array('content' => $area, 'filter' => '', 'title' => $title, 'sidebar' => $sidebar));
    // Draw it
    echo elgg_view_page(elgg_echo('faq:title'), $body);
    return true;
}
开发者ID:HundredHandsAlliance,项目名称:Elgg_1.8_faq,代码行数:54,代码来源:start.php


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