本文整理汇总了PHP中set_page_owner函数的典型用法代码示例。如果您正苦于以下问题:PHP set_page_owner函数的具体用法?PHP set_page_owner怎么用?PHP set_page_owner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_page_owner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: group_leave
/**
* Web service for leaving a group
*
* @param string $username username of author
* @param string $groupid GUID of the group
*
* @return bool
*/
function group_leave($username, $groupid)
{
$user = get_user_by_username($username);
if (!$user) {
throw new InvalidParameterException('registration:usernamenotvalid');
}
$group = get_entity($groupid);
$return['success'] = false;
set_page_owner($group->guid);
if ($user instanceof ElggUser && $group instanceof ElggGroup) {
if ($group->getOwnerGUID() != elgg_get_logged_in_user_guid()) {
if ($group->leave($user)) {
$return['success'] = true;
$return['message'] = elgg_echo("groups:left");
} else {
$return['message'] = elgg_echo("groups:cantleave");
}
} else {
$return['message'] = elgg_echo("groups:cantleave");
}
} else {
$return['message'] = elgg_echo("groups:cantleave");
}
return $return;
}
示例2: page_owner
/**
* Gets the page owner for the current page.
* @uses $CONFIG
* @return int|false The current page owner guid (0 if none).
*/
function page_owner()
{
global $CONFIG;
$setpageowner = set_page_owner();
if ($setpageowner !== false) {
return $setpageowner;
}
if ($username = get_input("username")) {
//if (substr_count($username,'group:')) {
if (substr_count($username, 'group_')) {
//preg_match('/group\:([0-9]+)/i',$username,$matches);
preg_match('/group\\_([0-9]+)/i', $username, $matches);
$guid = $matches[1];
if ($entity = get_entity($guid)) {
return $entity->getGUID();
}
}
if ($user = get_user_by_username($username)) {
return $user->getGUID();
}
}
if ($owner = get_input("owner_guid")) {
if ($user = get_entity($owner)) {
return $user->getGUID();
}
}
if (!empty($CONFIG->page_owner_handlers) && is_array($CONFIG->page_owner_handlers)) {
foreach ($CONFIG->page_owner_handlers as $handler) {
if ($guid = $handler()) {
return $guid;
}
}
}
return 0;
}
示例3: 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);
}
示例4: blog_page_handler
/**
* Dispatches blog pages.
* To maintain URL backward compatibility, expects old-style URLs like:
* pg/blog/[username/[read|edit|archive|new/[time_start|guid/[time_end|title]]]]
*
* Without a username, show all blogs
* Without an action (read|edit|archive|new), forward to pg/blog/username/read.
* Without a guid, show all post for that user.
* Title is ignored
*
* If archive, uses time_start/end
*
* @todo There is no way to say "show me archive view for all blog posts" with the
* current URL scheme because $param[0] is the username instead of an action.
* Could do something hideous like make '*' mean "all users" (since a username can't be *).
* Can't change the URL scheme because of URL compatibility.
*
* @param array $page
* @return NULL
*/
function blog_page_handler($page)
{
global $CONFIG;
elgg_push_breadcrumb(elgg_echo('blog:blogs'), "{$CONFIG->site->url}pg/blog");
// see if we're showing all or just a user's
if (isset($page[0]) && !empty($page[0])) {
$username = $page[0];
// forward away if invalid user.
if (!($user = get_user_by_username($username))) {
register_error('blog:error:unknown_username');
forward($_SERVER['HTTP_REFERER']);
}
set_page_owner($user->getGUID());
$crumbs_title = sprintf(elgg_echo('blog:owned_blogs'), $user->name);
$crumbs_url = "{$CONFIG->site->url}pg/blog/{$username}/read";
elgg_push_breadcrumb($crumbs_title, $crumbs_url);
$action = isset($page[1]) ? $page[1] : FALSE;
// yeah these are crap names, but they're used for different things.
$page2 = isset($page[2]) ? $page[2] : FALSE;
$page3 = isset($page[3]) ? $page[3] : FALSE;
switch ($action) {
case 'read':
$title = sprintf(elgg_echo('blog:title:user_blogs'), $user->name);
$content_info = blog_get_page_content_read($user->getGUID(), $page2);
break;
case 'new':
case 'edit':
//$sidebar = elgg_view('blog/sidebar_edit', array('blog_guid' => $page2));
$content_info = blog_get_page_content_edit($page2, $page3);
break;
case 'archives':
$content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog'));
$content .= blog_get_page_content_archive($user->getGUID(), $page2, $page3);
break;
case 'friends':
$content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog'));
$content .= blog_get_page_content_archive($user->getGUID());
break;
default:
forward("pg/blog/{$username}/read/");
break;
}
} else {
$title = elgg_echo('blog:title:all_blogs');
$content_info = blog_get_page_content_read();
}
$sidebar .= elgg_view('blog/sidebar_menu');
if (isset($content_info['sidebar'])) {
$sidebar .= $content_info['sidebar'];
}
$content = elgg_view('navigation/breadcrumbs') . $content_info['content'];
$body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar);
page_draw($title, $body);
}
示例5: page_owner
/**
* Gets the page owner for the current page.
* @uses $CONFIG
* @return int|false The current page owner guid (0 if none).
*/
function page_owner()
{
global $CONFIG;
$returnval = NULL;
$setpageowner = set_page_owner();
if ($setpageowner !== false) {
return $setpageowner;
}
if (!isset($returnval) && ($username = get_input("username"))) {
if (substr_count($username, 'group:')) {
preg_match('/group\\:([0-9]+)/i', $username, $matches);
$guid = $matches[1];
if ($entity = get_entity($guid)) {
$returnval = $entity->getGUID();
}
}
if (!isset($returnval) && ($user = get_user_by_username($username))) {
$returnval = $user->getGUID();
}
}
if (!isset($returnval) && ($owner = get_input("owner_guid"))) {
if ($user = get_entity($owner)) {
$returnval = $user->getGUID();
}
}
if (!isset($returnval) && (!empty($CONFIG->page_owner_handlers) && is_array($CONFIG->page_owner_handlers))) {
foreach ($CONFIG->page_owner_handlers as $handler) {
if (!isset($returnval) && ($guid = $handler())) {
$returnval = $guid;
}
}
}
if (isset($returnval)) {
// Check if this is obtainable, forwarding if not.
/*
* If the owner entity has been set, but is inaccessible then we forward to the dashboard. This
* catches a bunch of WSoDs. It doesn't have much of a performance hit since 99.999% of the time the next thing
* a page does after calling this function is to retrieve the owner entity - which is of course cashed.
*/
$owner_entity = get_entity($returnval);
if (!$owner_entity) {
// Log an error
error_log(sprintf(elgg_echo('pageownerunavailable'), $returnval));
// Forward
forward();
}
// set the page owner so if we're called again we don't have to think.
set_page_owner($returnval);
return $returnval;
}
return 0;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:57,代码来源:pageowner.php
示例6: collections_page_handler
/**
* Page handler for friends collections
*
* @param array $page_elements Page elements
*
* @return void
*/
function collections_page_handler($page_elements)
{
elgg_set_context('friends');
$base = elgg_get_config('path');
if (isset($page_elements[0])) {
if ($page_elements[0] == "add") {
set_page_owner(elgg_get_logged_in_user_guid());
collections_submenu_items();
require_once "{$base}pages/friends/collections/add.php";
} else {
$user = get_user_by_username($page_elements[0]);
if ($user) {
set_page_owner($user->getGUID());
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
collections_submenu_items();
}
require_once "{$base}pages/friends/collections/view.php";
}
}
}
}
示例7: dirname
* Elgg Pages
*
* @package ElggPages
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*/
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
gatekeeper();
$page_guid = get_input('page_guid');
$pages = get_entity($page_guid);
if ($pages->container_guid) {
set_page_owner($pages->container_guid);
} else {
set_page_owner($pages->owner_guid);
}
if (is_callable('group_gatekeeper')) {
group_gatekeeper();
}
$limit = (int) get_input('limit', 20);
$offset = (int) get_input('offset');
$page_guid = get_input('page_guid');
$pages = get_entity($page_guid);
add_submenu_item(sprintf(elgg_echo("pages:user"), page_owner_entity()->name), $CONFIG->url . "pg/pages/owned/" . page_owner_entity()->username, 'pageslinksgeneral');
$title = $pages->title . ": " . elgg_echo("pages:history");
$area2 = elgg_view_title($title);
$context = get_context();
set_context('search');
$area2 .= list_annotations($page_guid, 'page', $limit, false);
set_context($context);
示例8: dirname
* Elgg messages inbox page
*
* @package ElggMessages
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*/
// Load Elgg engine
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
// You need to be logged in!
gatekeeper();
// Get offset
$offset = get_input('offset', 0);
// Set limit
$limit = 10;
// Get the logged in user, you can't see other peoples messages so use session id
$page_owner = $_SESSION['user'];
set_page_owner($page_owner->getGUID());
// Get the user's inbox, this will be all messages where the 'toId' field matches their guid
$messages = get_entities_from_metadata("toId", $page_owner->getGUID(), "object", "messages", $page_owner->guid, $limit + 1, $offset);
// Set the page title
$area2 = elgg_view_title(elgg_echo("messages:inbox"));
// Display them. The last variable 'page_view' is to allow the view page to know where this data is coming from,
// in this case it is the inbox, this is necessary to ensure the correct display
// $area2 .= elgg_view("messages/view",array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
$area2 .= elgg_view("messages/forms/view", array('entity' => $messages, 'page_view' => "inbox", 'limit' => $limit, 'offset' => $offset));
// format
$body = elgg_view_layout("two_column_left_sidebar", '', $area2);
// Draw page
page_draw(sprintf(elgg_echo('messages:user'), $page_owner->name), $body);
示例9: get_input
/**
* Full group profile
*
* @package ElggGroups
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2010
* @link http://elgg.com/
*/
$group_guid = get_input('group_guid');
set_context('groups');
global $autofeed;
$autofeed = true;
$group = get_entity($group_guid);
if ($group) {
set_page_owner($group_guid);
$title = $group->name;
// Hide some items from closed groups when the user is not logged in.
$view_all = true;
$groupaccess = group_gatekeeper(false);
if (!$groupaccess) {
$view_all = false;
}
$area2 = elgg_view_title($title);
$area2 .= elgg_view('group/group', array('entity' => $group, 'user' => $_SESSION['user'], 'full' => true));
if ($view_all) {
//group profile 'items' - these are not real widgets, just contents to display
$area2 .= elgg_view('groups/profileitems', array('entity' => $group));
//group members
$area3 = elgg_view('groups/members', array('entity' => $group));
} else {
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:groupprofile.php
示例10: dirname
<?php
/**
* Elgg flexprofile extended profile
*
* @package FlexProfile
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Kevin Jardine <kevin@radagast.biz>
* @copyright Radagast Solutions 2008
* @link http://radagast.biz/
*/
// Load Elgg engine
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
global $CONFIG;
// Define context
set_context('groups');
set_page_owner(get_input('group_guid', 0));
$group = page_owner_entity();
$title = friendly_title($group->name);
add_submenu_item(elgg_echo('form:main_profile_link_text'), $group->getUrl(), '0extendedprofile');
$body = elgg_view('flexgroupprofile/extended', array('entity' => $group));
$title = sprintf(elgg_echo('form:extended_profile_title'), $group->name);
page_draw($title, elgg_view_layout("two_column_left_sidebar", '', elgg_view_title($title) . $body));
示例11: dirname
* Elgg file saver
*
* @package ElggFile
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2010
* @link http://elgg.com/
*/
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
gatekeeper();
// Render the file upload page
$file_guid = (int) get_input('file_guid');
$file = get_entity($file_guid);
if (!$file) {
forward();
}
// Set the page owner
$page_owner = page_owner_entity();
if (!$page_owner) {
$container_guid = $file->container_guid;
if ($container_guid) {
set_page_owner($container_guid);
}
}
if (!$file->canEdit()) {
forward();
}
$title = elgg_echo('file:edit');
$area1 = elgg_view_title($title);
$area1 .= elgg_view("file/upload", array('entity' => $file));
$body = elgg_view_layout('one_column_with_sidebar', $area1);
page_draw($title, $body);
示例12: dirname
<?php
/**
* Friends of friends.
*
* @package friends_of_friends
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Pedro Prez
* @copyright 2009
* @link http://www.pedroprez.com.ar/
*/
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
gatekeeper();
set_context('friendsoffriends');
// Get the current page's owner
$page_owner = page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
$page_owner = get_loggedin_user();
set_page_owner(get_loggedin_userid());
}
$title = elgg_view_title(elgg_echo('friendsoffriends'));
// Display main admin menu
$body = friends_of_friends_list_entities($page_owner->getGUID(), 10, true);
page_draw(elgg_echo('friendsoffriends'), elgg_view_layout("two_column_left_sidebar", '', $title . $body));
示例13: gatekeeper
<?php
/**
* Elgg user account settings.
*
* @package Elgg
* @subpackage Core
*/
// Only logged in users
gatekeeper();
// Make sure we don't open a security hole ...
if (!elgg_get_page_owner_entity() || !elgg_get_page_owner_entity()->canEdit()) {
set_page_owner(elgg_get_logged_in_user_guid());
}
$title = elgg_echo('usersettings:user');
$content = elgg_view('core/settings/account');
$params = array('content' => $content, 'title' => $title);
$body = elgg_view_layout('one_sidebar', $params);
echo elgg_view_page($title, $body);
示例14: gatekeeper
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Foobar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with groups-invite-any. If not, see <http://www.gnu.org/licenses/>.
*/
gatekeeper();
action_gatekeeper();
$group = get_entity(get_input('entity'));
set_page_owner($group->getGUID());
set_context('groups');
$name = get_input('name');
if ($name) {
$users = search_for_user($name, get_plugin_setting('maxusers', 'groupsfrommembers'));
$nusers = search_for_user($name, 0, 0, '', true);
}
$title = elgg_echo("groups:invite");
$area2 = elgg_view_title($title);
$context = get_context();
set_context('groupsfrommembers');
if ($group && $group->canEdit()) {
$area2 .= elgg_view('forms/groups/invite', array('entity' => $group, 'users' => $users, 'nusers' => $nusers));
} else {
$area2 .= elgg_echo("groups:noaccess");
}
示例15: groups_page_handler
/**
* Group page handler
*
* @param array $page Array of page elements, forwarded by the page handling mechanism
*/
function groups_page_handler($page)
{
global $CONFIG;
if (isset($page[0])) {
// See what context we're using
switch ($page[0]) {
case "new":
include $CONFIG->pluginspath . "groups/new.php";
break;
case "world":
set_context('groups');
set_page_owner(0);
include $CONFIG->pluginspath . "groups/all.php";
break;
case "forum":
set_input('group_guid', $page[1]);
include $CONFIG->pluginspath . "groups/forum.php";
break;
case "owned":
// Owned by a user
if (isset($page[1])) {
set_input('username', $page[1]);
}
include $CONFIG->pluginspath . "groups/index.php";
break;
case "member":
// User is a member of
if (isset($page[1])) {
set_input('username', $page[1]);
}
include $CONFIG->pluginspath . "groups/membership.php";
break;
case "mine":
// User is a member of
set_input('username', $_SESSION['user']->username);
include $CONFIG->pluginspath . "groups/membership.php";
break;
default:
set_input('group_guid', $page[0]);
include $CONFIG->pluginspath . "groups/groupprofile.php";
break;
}
}
}