本文整理汇总了PHP中Network::member_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Network::member_exists方法的具体用法?PHP Network::member_exists怎么用?PHP Network::member_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network::member_exists方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leave
/**
* let the user leave network
* @access public
* @param id of the network,uid of user
* @return flag for joining request moderated or success message
*/
static function leave($network_id, $uid)
{
Logger::log("Enter: static function Network leave");
// if (Network::is_mother_network($network_id)) {
// throw new PAException(OPERATION_NOT_PERMITTED, "You cant delete mother network.");
// }
if (!Network::member_exists($network_id, $uid)) {
throw new PAException(OPERATION_NOT_PERMITTED, "You are not member of this network.");
}
$user_type = Network::get_user_type($network_id, $uid);
if ($user_type == NETWORK_OWNER) {
throw new PAException(OPERATION_NOT_PERMITTED, "You cant leave your own network!!.");
}
$res = Dal::query("DELETE FROM {networks_users} WHERE network_id = ? AND user_id = ? ", array($network_id, $uid));
// delete all user roles for this network
Roles::delete_user_roles($uid, -1);
// -1 means: all user roles will be deleted
// Update cached member count
Network::update_network_member_count($network_id);
Logger::log("Exit: static function Network leave");
return TRUE;
}
示例2: set_group_id
/**
Purpose : this function is core funtion of this Navigation class. It is used to make links level_1,level_2,level_3
Some links need extra parameters
append them here but first set them in their methods
e.g.
public function set_group_id($group_id){
$this->group_id = $group_id;
}
public function get_group_id() {
return $this->group_id();
}
Scope : public
@param - it needs no direct input
@return - it sets class variables level_1,level_2,level_3 which can be used further.
**/
function make_links()
{
$user_id = isset($_SESSION['user']['id']) ? $_SESSION['user']['id'] : 0;
////These are level 1 links shown in top navigation bar
$level_1 = array('home_network' => array('caption' => __('Return to home network'), 'url' => $this->mothership_info['url']));
// Display network directory, if network operation is enabled.
if (PA::$network_capable) {
$level_1['networks_directory'] = array('caption' => __('Network directory'), 'url' => $this->base_url . '/' . FILE_NETWORKS_HOME);
}
$owner = Network::is_admin($this->network_info->network_id, $user_id);
//is_member will be true when user is registered member of the nework.
$is_member = Network::member_exists($this->network_info->network_id, $this->get_uid());
if (!$this->is_anonymous && $this->network_info && !$is_member && $this->network_info->type != MOTHER_NETWORK_TYPE) {
$level_1['join_network'] = array('caption' => __('JOIN Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=join&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id);
} else {
if (!$this->is_anonymous && $is_member && !$owner && $this->network_info->type != MOTHER_NETWORK_TYPE) {
$level_1['unjoin_network'] = array('caption' => __('Unjoin Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=leave&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id);
} else {
if (Network::is_admin($this->network_info->network_id, (int) $user_id)) {
$level_1['configure_network'] = array('caption' => __('Configure'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK);
}
}
}
if ($this->network_info->type == MOTHER_NETWORK_TYPE) {
unset($level_1['home_network']);
}
if (PA::$config->enable_network_spawning) {
$level_1['create_network'] = array('caption' => __('Create a network'), 'url' => $this->mothership_info['extra']['links']['create_network']);
}
////END OF These are level 1 links shown in top navigation bar
////These are level 2 links shown in second navigation bar
$level_2 = array('home' => array('caption' => __('Home'), 'url' => $this->base_url . PA_ROUTE_HOME_PAGE), 'user' => array('caption' => __(PA::$mypage_noun), 'url' => $this->base_url . PA_ROUTE_USER_PRIVATE), 'people' => array('caption' => __(PA::$people_noun), 'url' => $this->base_url . PA_ROUTE_PEOPLES_PAGE), 'groups' => array('caption' => __(PA::$group_noun_plural), 'url' => $this->base_url . PA_ROUTE_GROUPS));
if (!empty(PA::$config->useTypedGroups)) {
$level_2 = $level_2 + array('directory' => array('caption' => __('Orgs'), 'url' => $this->base_url . PA_ROUTE_TYPED_DIRECTORY));
if (!empty(PA::$config->simple['use_families'])) {
$level_2 = $level_2 + array('families' => array('caption' => __('Neighbors'), 'url' => $this->base_url . PA_ROUTE_FAMILY_DIRECTORY));
}
}
$level_2 = $level_2 + array('forum' => array('caption' => __('Forum'), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id), 'search' => array('caption' => __('Search'), 'url' => $this->base_url . PA_ROUTE_SEARCH_HOME . '/btn_searchContent=Search+Content'));
////END OF These are level 2 links shown in second navigation bar
/// children of user 2nd level link
$uid = $this->get_uid();
//we need uid for some links
$user_children = array();
$user_children = $user_children + array('user_private' => array('caption' => __('My Page'), 'url' => $this->base_url . PA_ROUTE_USER_PRIVATE));
$user_children = $user_children + array('user_widgets' => array('caption' => __('My Widgets'), 'url' => $this->base_url . '/' . FILE_WIDGET));
$user_children = $user_children + array('messages' => array('caption' => __('My Messages'), 'url' => $this->base_url . PA_ROUTE_MYMESSAGE));
$user_children = $user_children + array('my_gallery' => array('caption' => __('My Gallery'), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$uid}"));
$user_children = $user_children + array('my_events' => array('caption' => __('My Events'), 'url' => $this->base_url . '/' . FILE_USER_CALENDAR), 'my_friends' => array('caption' => __('My Friends'), 'url' => $this->base_url . "/view_all_members.php?view_type=in_relations&uid={$uid}"));
$user_children = $user_children + array('my_forum' => array('caption' => __('My Forum'), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id . '&user_id=' . $uid));
$user_children = $user_children + array('my_points' => array('caption' => __('My Points'), 'url' => $this->base_url . PA_ROUTE_POINTS_DIRECTORY . "?uid={$uid}"));
if (!empty(PA::$config->simple['use_families'])) {
// get this users Family or Families
require_once "api/Entity/TypedGroupEntityRelation.php";
$userfamilyRelations = TypedGroupEntityRelation::get_relation_for_user($uid, 'family');
if (count($userfamilyRelations) == 1) {
$user_children = $user_children + array('my_family' => array('caption' => __('My Family'), 'url' => $this->base_url . PA_ROUTE_FAMILY . "?gid=" . $userfamilyRelations[0]->object_id));
} else {
$html = "<ul>";
foreach ($userfamilyRelations as $i => $relation) {
$group = ContentCollection::load_collection((int) $relation->object_id, PA::$login_uid);
$html .= "<li>";
$html .= "<a href=\"" . $this->base_url . PA_ROUTE_FAMILY . "?gid=" . $relation->object_id . "\">" . $group->title . "</a>";
$html .= "</li>";
}
$html .= "</ul>";
$user_children = $user_children + array('my_family' => array('caption' => __('My Families'), 'html' => $html));
}
}
// end of !empty(PA::$config->simple['use_families'])
$user_children = $user_children + array('settings' => array('caption' => __('Edit My Account'), 'url' => $this->base_url . PA_ROUTE_EDIT_PROFILE));
$user_children = $user_children + array('customize_ui' => array('caption' => __('Themes'), 'url' => $this->base_url . PA_ROUTE_CUSTOMIZE_USER_GUI . "/theme/uid={$uid}"));
if ($this->is_anonymous) {
//these links are not for anonymous
unset($user_children);
}
///END OF children of user 2nd level link
/// children of people 2nd level link
//required friend id in some places
$friend_id = $this->get_friend_uid();
$people_children = array('find_people' => array('caption' => sprintf(__('Find %s'), __(PA::$people_noun)), 'url' => $this->base_url . PA_ROUTE_PEOPLES_PAGE), 'my_friends' => array('caption' => __('My friends'), 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=relations&uid=' . $uid), 'friends_gallery' => array('caption' => __('Friends gallery'), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid={$friend_id}&view=friends"));
if ($this->is_anonymous) {
//these links are not for anonymous
unset($people_children);
}
//.........这里部分代码省略.........
示例3: header
* [description including history]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* @author [creator, or "Original Author"]
* @license http://bit.ly/aVWqRV PayAsYouGo License
* @copyright Copyright (c) 2010 Broadband Mechanics
* @package PeopleAggregator
*/
$login_required = FALSE;
include_once "web/includes/page.php";
//require_once "web/includes/functions/auto_email_notify.php";
require_once "api/Messaging/MessageDispatcher.class.php";
require_once "api/Roles/Roles.php";
if ($_GET['action'] == 'join') {
$nid = (int) $_GET['nid'];
// here we check that user is already join or not
if ($_SESSION['user']['id'] && Network::member_exists($nid, $_SESSION['user']['id'])) {
$redirect_url = "http://" . PA::$network_info->address . "." . PA::$domain_suffix . BASE_URL_REL . PA_ROUTE_HOME_PAGE . "/msg=7021";
header("Location:{$redirect_url}");
exit;
}
$error = 0;
if (!$nid) {
$error = 1;
}
if ($_SESSION['user']['id']) {
try {
$suc = Network::join($nid, $_SESSION['user']['id']);
if ($suc) {
// adding default relation
if ($_SESSION['user']['id'] != SUPER_USER_ID) {
uihelper_add_default_relation($_SESSION['user']['id']);
示例4: Invitation
$invitation_id = $_GET['InvID'];
try {
$new_invite = new Invitation();
$new_invite->inv_id = $invitation_id;
$new_invite->inv_user_id = $_SESSION['user']['id'];
$new_invite->accept();
$inv_obj = Invitation::load($invitation_id);
$user_obj = new User();
$user_obj->load((int) $inv_obj->user_id);
$user_accepting_inv_obj = new User();
$user_accepting_inv_obj->load((int) $_SESSION['user']['id']);
$relation_type_id = Relation::get_relation((int) $inv_obj->user_id, (int) $user_accepting_inv_obj->user_id, PA::$network_info->network_id);
$relation_type = Relation::lookup_relation_type($relation_type_id);
$new_invite->inv_relation_type = $relation_type;
PANotify::send("invitation_accept", $user_obj, $user_accepting_inv_obj, $new_invite);
if (!Network::member_exists(PA::$network_info->network_id, (int) $_SESSION['user']['id'])) {
Network::join(PA::$network_info->network_id, $_SESSION['user']['id']);
PANotify::send("network_join", PA::$network_info, $user_accepting_inv_obj, array());
}
header("Location: " . PA::$url . PA_ROUTE_USER_PRIVATE . '/' . "msg_id=7016");
exit;
} catch (CNException $e) {
$msg = $e->message;
}
}
} else {
$msg = $token_arr[0] == FALSE ? $token_arr[1] : 7018;
header("Location: " . PA_ROUTE_HOME_PAGE . "/msg={$msg}");
exit;
}
}
示例5: array
$found = array();
$found_name = array();
$user_names = explode(",", $_POST['user_friends']);
foreach ($user_names as $name) {
$n = trim($name);
if (!empty($n)) {
if (!in_array($n, $found_name)) {
//check for repeated login names
try {
$related_user_id_array = User::map_logins_to_ids($n);
//getting login_name=>user_id array
foreach ($related_user_id_array as $key => $values) {
$related_user_id = $values;
//getting user_id
}
if (Network::member_exists((int) PA::$network_info->network_id, (int) $related_user_id)) {
//if user_id exist for this network
$found[] = (int) $related_user_id;
$found_name[] = $n;
} else {
$not_found[] = $n;
}
} catch (CNException $e) {
$not_found[] = $n;
}
}
}
}
if (sizeof($found)) {
$related = implode(",", $found_name);
}
示例6: delete_users
/**
* @author Z.Hron
* @name delete_users
* @brief This function delete array of users
* @return array of error messages
*
*
*/
function delete_users($params, $true_delete = FALSE)
{
$message_array = array();
$user_id_array = $params['user_id_array'];
foreach ($user_id_array as $user_id) {
if (PA::$network_info->type == MOTHER_NETWORK_TYPE) {
if (!Network::member_exists(PA::$network_info->network_id, (int) $user_id)) {
$message_array[] = "UserID {$user_id} does not exists.";
continue;
}
//deleting user data from mothership
try {
User::delete_user($user_id);
Activities::delete_for_user($user_id);
} catch (CNException $e) {
$message_array[] = $e->message;
}
$user_networks = Network::get_user_networks($user_id);
if (count($user_networks)) {
foreach ($user_networks as $network) {
if ($network->user_type != NETWORK_OWNER) {
$network_prefix = $network->address;
try {
User::delete_user($user_id);
Activities::delete_for_user($user_id);
Network::leave($network->network_id, $user_id);
//leave
} catch (CNException $e) {
$message_array[] = $e->message;
}
} else {
try {
Network::delete($network->network_id);
} catch (CNException $e) {
$message_array[] = $e->message;
}
}
}
}
//deleting user
try {
User::delete($user_id, $true_delete);
} catch (CNException $e) {
Logger::log('User has been already deleted');
}
} else {
//user delete for network owner
if (!Network::member_exists(PA::$network_info->network_id, (int) $user_id)) {
$message_array[] = "UserID {$user_id} does not exists.";
continue;
}
$network_prefix = PA::$network_info->address;
try {
User::delete_user($user_id);
Activities::delete_for_user($user_id);
Network::leave(PA::$network_info->network_id, $user_id);
//network leave
} catch (CNException $e) {
$message_array[] = $e->message;
}
}
}
return $message_array;
}
示例7: set_group_id
/**
Purpose : this function is core funtion of this Navigation class. It is used to make links level_1,level_2,level_3
Some links need extra parameters
append them here but first set them in their methods
e.g.
public function set_group_id($group_id){
$this->group_id = $group_id;
}
public function get_group_id() {
return $this->group_id();
}
Scope : public
@param - it needs no direct input
@return - it sets class variables level_1,level_2,level_3 which can be used further.
**/
function make_links()
{
global $_PA;
////These are level 1 links shown in top navigation bar
$level_1 = array('home_network' => array('caption' => __('Return to home network'), 'url' => $this->mothership_info['url']));
// Display network directory, if network operation is enabled.
if (PA::$network_capable) {
$level_1['networks_directory'] = array('caption' => __('Network directory'), 'url' => $this->base_url . '/' . FILE_NETWORKS_HOME);
}
$owner = Network::is_admin($this->network_info->network_id, @$_SESSION['user']['id']);
//is_member will be true when user is registered member of the nework.
$is_member = Network::member_exists($this->network_info->network_id, $this->get_uid());
if (!$this->is_anonymous && $this->network_info && !$is_member && $this->network_info->type != MOTHER_NETWORK_TYPE) {
$level_1['join_network'] = array('caption' => 'JOIN Network', 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=join&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id);
} else {
if (!$this->is_anonymous && $is_member && !$owner && $this->network_info->type != MOTHER_NETWORK_TYPE) {
$level_1['unjoin_network'] = array('caption' => 'Unjoin Network', 'url' => $this->base_url . '/' . FILE_NETWORK_ACTION . '?action=leave&nid=' . $this->network_info->network_id . '&cid=' . $this->network_info->category_id);
} else {
if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) {
$level_1['configure_network'] = array('caption' => __('Configure'), 'url' => $this->base_url . '/' . FILE_NETWORK_STATS);
}
}
}
if ($this->network_info->type == MOTHER_NETWORK_TYPE) {
unset($level_1['home_network']);
}
if ($_PA->enable_network_spawning) {
$level_1['create_network'] = array('caption' => __('Create a network'), 'url' => $this->mothership_info['extra']['links']['create_network']);
}
////END OF These are level 1 links shown in top navigation bar
////These are level 2 links shown in second navigation bar
$level_2 = array('home' => array('caption' => __('Home'), 'url' => $this->base_url . '/' . FILE_HOMEPAGE), 'user' => array('caption' => __('Me'), 'url' => $this->base_url . '/' . FILE_USER), 'people' => array('caption' => __('People'), 'url' => $this->base_url . '/' . FILE_PEOPLES), 'groups' => array('caption' => __('Groups'), 'url' => $this->base_url . '/' . FILE_GROUPS_HOME), 'search' => array('caption' => __('Search'), 'url' => $this->base_url . '/' . FILE_SEARCH_HOME . '?btn_searchContent=Search+Content'));
////END OF These are level 2 links shown in second navigation bar
/// children of user 2nd level link
$uid = $this->get_uid();
//we need uid for some links
$user_children = array('user_private' => array('caption' => __('My Page'), 'url' => $this->base_url . '/' . FILE_USER), 'user_widgets' => array('caption' => __('My Widgets'), 'url' => $this->base_url . '/' . FILE_WIDGET), 'messages' => array('caption' => __('My Messages'), 'url' => $this->base_url . '/' . FILE_MYMESSAGE), 'my_gallery' => array('caption' => __('My Gallery'), 'url' => $this->base_url . '/' . FILE_MEDIA_GALLERY), 'my_events' => array('caption' => __('My Events'), 'url' => $this->base_url . '/' . FILE_USER_CALENDAR), 'settings' => array('caption' => __('Edit My Account'), 'url' => $this->base_url . '/' . FILE_EDIT_PROFILE), 'customize_ui' => array('caption' => __('Themes'), 'url' => $this->base_url . '/' . FILE_CUSTOMIZE_UI));
if ($this->is_anonymous) {
//these links are not for anonymous
unset($user_children);
}
///END OF children of user 2nd level link
/// children of people 2nd level link
//required friend id in some places
$friend_id = $this->get_friend_uid();
$people_children = array('find_people' => array('caption' => 'Find people', 'url' => $this->base_url . '/' . FILE_PEOPLES), 'my_friends' => array('caption' => 'My friends', 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=relations&uid=' . $uid), 'people_who_call_me_friend' => array('caption' => 'People who call me friend', 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?view_type=in_relations&uid=' . $uid), 'friends_gallery' => array('caption' => 'Friends gallery', 'url' => $this->base_url . '/' . FILE_MEDIA_GALLERY . '?view=friends&uid=' . $friend_id));
if ($this->is_anonymous) {
//these links are not for anonymous
unset($people_children);
}
///EOF children of people 2nd level link
/// group general children
// $users_first_group_id = $this->get_users_first_group_id();
$groups_general = array('find_groups' => array('caption' => 'Find groups', 'url' => $this->base_url . '/' . FILE_GROUPS_HOME), 'create_group' => array('caption' => 'Create', 'url' => $this->base_url . '/' . FILE_ADDGROUP), 'invite' => array('caption' => 'Invite', 'url' => $this->base_url . '/' . FILE_GROUP_INVITATION));
/* if ($users_first_group_id) {
$groups_general['group_media_gallery'] = array(
'caption'=>'Groups gallery',
'url'=>$this->base_url.'/'.FILE_GROUP_MEDIA_GALLERY.'?view=groups_media&gid='.$users_first_group_id
);
}*/
if ($this->is_anonymous) {
//these links are not for anonymous
unset($groups_general['create_group']);
unset($groups_general['invite']);
unset($groups_general['group_media_gallery']);
}
/// EOF group general children
///group specific menu children
$group_id = $this->get_group_id();
$group_specific = array('group_home' => array('caption' => 'Group Home', 'url' => $this->base_url . '/' . FILE_GROUP . '?gid=' . $group_id), 'group_forum' => array('caption' => 'Forum', 'url' => $this->base_url . '/' . FILE_FORUM_HOME . '?gid=' . $group_id), 'group_members' => array('caption' => 'Members', 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?gid=' . $group_id), 'group_gallery' => array('caption' => 'Group gallery', 'url' => $this->base_url . '/' . FILE_GROUP_MEDIA_GALLERY . '?view=groups_media&gid=' . $group_id), 'group_events' => array('caption' => 'Group Events', 'url' => $this->base_url . '/' . FILE_GROUP_CALENDAR . '?gid=' . $group_id), 'join' => array('caption' => 'Join', 'url' => $this->base_url . '/' . FILE_GROUP . '?gid=' . $group_id . '&action=join'), 'unjoin' => array('caption' => 'Unjoin', 'url' => $this->base_url . '/' . FILE_GROUP . '?gid=' . $group_id . '&action=leave'), 'delete_group' => array('caption' => 'Delete', 'url' => $this->base_url . '/' . FILE_GROUP . '?action=delete&gid=' . $group_id, 'extra' => ' onclick ="return delete_confirmation_msg(\'Are you sure you want to delete this group?\') "'), 'group_customize_ui' => array('caption' => 'Themes', 'url' => $this->base_url . '/' . FILE_CUSTOMIZE_GROUP . '?gid=' . $group_id));
/// group links are having some more complicated logic
// following links are not visible to anonymous
if ($this->is_anonymous) {
unset($group_specific['create_group']);
unset($group_specific['join']);
unset($group_specific['unjoin']);
unset($group_specific['edit_group']);
unset($group_specific['invite']);
unset($group_specific['delete_group']);
unset($group_specific['moderate_group']);
unset($group_specific['group_customize_ui']);
} else {
if (!empty($group_id) && !Group::is_admin($group_id, $_SESSION['user']['id'])) {
unset($group_specific['edit_group']);
unset($group_specific['delete_group']);
//.........这里部分代码省略.........
示例8: checkUser
private function checkUser($request_data)
{
$this->login_user = PA::$login_user;
if (PA::$login_uid && is_object($this->board)) {
$member = null;
$members = PaForumsUsers::listPaForumsUsers("user_id = " . PA::$login_uid . " AND board_id = " . $this->board->get_id());
if (isset($members[0])) {
$member = $members[0];
}
if ($member) {
// check is user a member
$this->forum_user = $member;
$user_status = $this->forum_user->get_user_status();
$this->shared_data['board_member'] = $this->forum_user;
} else {
// logged user but not member of this board!
$is_member = false;
switch ($this->board_type) {
case PaForumBoard::network_board:
$is_member = Network::member_exists($this->shared_data['network_id'], PA::$login_uid);
break;
case PaForumBoard::group_board:
$is_member = Group::member_exists($this->gid, PA::$login_uid);
break;
case PaForumBoard::personal_board:
$is_member = false;
break;
default:
$is_member = false;
}
if ($is_member) {
$user_status = PaForumsUsers::_allowed;
try {
$params = array("user_id" => PA::$login_uid, "board_id" => $this->board->get_id(), "user_status" => $user_status, "is_active" => 1, "date_join" => date("Y-m-d H:i:s"));
PaForumsUsers::insertPaForumsUsers($params);
$members = PaForumsUsers::listPaForumsUsers("user_id = " . PA::$login_uid . " AND board_id = " . $this->board->get_id());
if (isset($members[0])) {
$this->forum_user = $members[0];
}
} catch (Exception $e) {
$error_msg = "Exception in ForumModule, function checkUser();<br />Message: " . $e->getMessage();
}
} else {
$user_status = PaForumsUsers::_notmember | PaForumsUsers::_anonymous;
$this->forum_user = null;
}
}
$params = array('permissions' => 'manage_forum', 'board' => $this->board, 'gid' => !empty($this->gid) ? $this->gid : null);
if (PermissionsHandler::can_user(PA::$login_uid, $params)) {
$user_status = $user_status | PaForumsUsers::_admin;
}
if ($user_status & PaForumsUsers::_banned) {
$board = $this->getDefaultBoard($request_data, false);
$this->setupBoard($board);
$user = new User();
$user->load((int) $this->forum_user->get_user_id());
$this->title = __('Banned User');
$this->set_inner_template('cnmodule_content_banned_user.php');
$this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'forum_user' => $user, 'user_status' => $user_status, 'board_settings' => $this->board_settings));
return false;
}
} else {
$this->forum_user = null;
$user_status = PaForumsUsers::_anonymous;
}
return $user_status;
}
示例9: array
// creating message basic folders
Message::create_basic_folders($newuser->user_id);
// adding default relation
if ($newuser->user_id != SUPER_USER_ID) {
User_Registration::add_default_relation($newuser->user_id, PA::$network_info);
}
// adding default media as well as album
User_Registration::add_default_media($newuser->user_id, '', PA::$network_info);
User_Registration::add_default_media($newuser->user_id, '_audio', PA::$network_info);
User_Registration::add_default_media($newuser->user_id, '_video', PA::$network_info);
User_Registration::add_default_blog($newuser->user_id);
//adding default link categories & links
User_Registration::add_default_links($newuser->user_id);
// Making user member of a network if he is registering to PA from a network
if (!empty(PA::$network_info)) {
if (!Network::member_exists(PA::$network_info->network_id, $newuser->user_id)) {
// check is waiting member
Network::join(PA::$network_info->network_id, $newuser->user_id);
// no - join to network
} else {
Network::approve(PA::$network_info->network_id, $newuser->user_id);
// yes - approve membership
}
}
// register session
register_session($newuser->login_name, $newuser->user_id, $newuser->role, $newuser->first_name, $newuser->last_name, $newuser->email, $newuser->picture);
PA::$login_user = $newuser;
PA::$login_uid = $newuser->user_id;
// send welcome message
PAMail::send("welcome_message", $newuser, PA::$network_info, array());
if (!empty($_GET['InvID'])) {
示例10: Invitation
$user_accepting_inv_obj->load((int) $u);
try {
// check token before accepting invitation
$new_invite = new Invitation();
$new_invite->inv_id = $invitation_id;
$new_invite->inv_user_id = $u;
$new_invite->accept();
$inv_obj = Invitation::load($invitation_id);
$user_obj = new User();
$user_obj->load((int) $inv_obj->user_id);
$relation_type_id = Relation::get_relation((int) $inv_obj->user_id, (int) $user_accepting_inv_obj->user_id, PA::$network_info->network_id);
$relation_type = Relation::lookup_relation_type($relation_type_id);
$new_invite->inv_relation_type = $relation_type;
PANotify::send("invitation_accept", $user_obj, $user_accepting_inv_obj, $new_invite);
if (!empty(PA::$network_info) && PA::$network_info->type != MOTHER_NETWORK_TYPE) {
if (!Network::member_exists(PA::$network_info->network_id, $u)) {
if (PA::$network_info->type == PRIVATE_NETWORK_TYPE && $inv_obj->user_id == PA::$network_info->owner_id) {
$user_type = NETWORK_MEMBER;
}
Network::join(PA::$network_info->network_id, $u, $user_type);
PANotify::send("network_join", PA::$network_info, $user_accepting_inv_obj, array());
}
}
} catch (CNException $e) {
$msg = "{$e->message}";
$error_inv = TRUE;
}
if ($error_inv == TRUE) {
// if error occured
$location = CNUrlHelper::url_for(PA::$url . '/cnuser_login.php', array('msg' => $msg, 'return' => $return_url), 'https');
header("Location: {$location}");
示例11: header
$login_required = FALSE;
$use_theme = 'Beta';
include "includes/page.php";
require_once "{$path_prefix}/api/User/User.php";
require_once "{$path_prefix}/api/Relation/Relation.php";
require_once "{$path_prefix}/api/Testimonials/Testimonials.php";
require_once "{$path_prefix}/api/ExternalFeed/ExternalFeed.php";
require_once "{$path_prefix}/ext/UserProfileFeed/UserProfileFeed.php";
require_once "./includes/classes/file_uploader.php";
require_once "user_page_functions.php";
// user_blog.php requires a user ID to be specified - so give a 404 page if no user is specified
if (empty(PA::$page_user)) {
header("HTTP/1.0 404 Not Found");
throw new PAException(INVALID_ID, "No user ID specified.");
}
if ($network_info->type != MOTHER_NETWORK_TYPE && !Network::member_exists($network_info->network_id, $page_user->user_id)) {
if (PA::$page_uid != PA::$login_uid) {
throw new PAException(NON_MEMBER_ACCESS_TO_NETWORK, "{$page_user->login_name} is not a member of {$network_info->name} network");
} else {
throw new PAException(NON_MEMBER_ACCESS_TO_NETWORK, "you are not a member of {$network_info->name} network");
}
}
// save view counts for this profile
if (PA::$page_uid != PA::$login_uid) {
// if current blog is not user's blog
// FIXME: this will be incredibly slow as implemented. We should
// have some sort of 'counters' table which we can increment easily.
// The following should do it: --Phil
//Counters::increment(PA::$page_uid, "profile_view"); // # of times PA::$page_user's profile has been viewed
//if (!empty(PA::$login_uid)) {
// Counters::increment(PA::$page_uid, "profile_view_login"); // # of times PA::$page_user's profile has been viewed by logged-in users