本文整理汇总了PHP中Group::is_admin方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::is_admin方法的具体用法?PHP Group::is_admin怎么用?PHP Group::is_admin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::is_admin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleGET_delete
private function handleGET_delete($request_data)
{
global $error_msg;
if (PA::$login_uid && !empty($this->shared_data['group_info']) && @$_POST['content_type'] != 'media') {
$group = $this->shared_data['group_info'];
$user = PA::$login_user;
if (Group::is_admin((int) $request_data['gid'], (int) PA::$login_uid)) {
$group->delete();
// Deleting all the activities of this group from activities table for rivers of people module
Activities::delete_for_group($request_data['gid']);
if (!empty(PA::$config->useTypedGroups)) {
require_once 'api/Entity/TypedGroupEntity.php';
require_once "api/Entity/TypedGroupEntityRelation.php";
TypedGroupEntityRelation::delete_all_relations($request_data['gid']);
TypedGroupEntity::delete_for_group($request_data['gid']);
}
$this->controller->redirect(PA::$url . PA_ROUTE_GROUPS . "?error_msg=" . __("Group sucessfully deleted."));
}
}
}
示例2: redirect_to
<?php
require_once "../includes/init.php";
if (!$session->is_logged_in()) {
redirect_to("login.php");
}
if (isset($_GET['id']) && $_GET['group_id']) {
$group_id = $database->escape_value($_GET['group_id']);
$user_id = $database->escape_value($_GET['id']);
if (Group::is_admin($group_id, $session->user_id) || $session->user_id === $_GET['id']) {
$group = Group::find_by_id($group_id);
if ($group->remove_member($user_id)) {
$session->message("Member removed.");
redirect_to("index.php?msg=group&group_id={$group_id}");
} else {
$session->message("Member removal failed.");
redirect_to("index.php?msg=group&group_id={$group_id}");
}
}
}
if (isset($database)) {
$database->close_connection();
}
示例3: array
$is_invite = FALSE;
//$gid = (int)$_REQUEST['gid']; gid changed to ccid
$gid = (int) $_REQUEST['gid'];
$group = ContentCollection::load_collection((int) $gid, $login_uid);
$access = $group->access_type;
if ($group->access_type == $group->ACCESS_PRIVATE) {
$access_type = 'Private';
} else {
$access_type = 'Public';
}
if ($group->reg_type == $group->REG_OPEN) {
$access_type .= ' Open';
} else {
$access_type .= ' Moderated';
}
if (Group::is_admin((int) $_REQUEST['gid'], (int) $login_uid)) {
$is_admin = TRUE;
}
$members = $group->get_members();
$group_details = array();
$group_details['collection_id'] = $group->collection_id;
$group_details['type'] = $group->type;
$group_details['author_id'] = $group->author_id;
$user = new User();
$user->load((int) $group->author_id);
$first_name = $user->first_name;
$last_name = $user->last_name;
$login_name = $user->login_name;
$group_details['author_name'] = $login_name;
$group_details['author_picture'] = $user->picture;
$group_details['title'] = $group->title;
示例4: 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']);
//.........这里部分代码省略.........
示例5:
/** This file is used to change the skin of the network.
* Anonymous user can not access this page;
*/
$login_required = TRUE;
//including necessary files
$use_theme = 'Beta';
//TODO : Remove this when new UI is completely implemented.
include "includes/page.php";
require_once "{$path_prefix}/web/includes/network.inc.php";
require_once "{$path_prefix}/web/group_functions.php";
global $login_uid;
$msg = '';
$gid = (int) $_GET['gid'];
if (!empty($gid)) {
$group_data = ContentCollection::load_collection($gid, $login_uid);
$is_admin = Group::is_admin($gid, $login_uid);
}
$type = @$_GET['type'];
$page_id = PAGE_GROUP;
$parameter .= js_includes('common.js ');
if (!empty($_GET['msg_id'])) {
$msg_id = $_GET['msg_id'];
}
if ($type == 'style') {
// load all support code
// these should eventually be collapsed into one file
$parameter .= js_includes('iutil.js');
$parameter .= js_includes('json.js');
$parameter .= js_includes('idrag.js');
$parameter .= js_includes('isortables.js');
// for style editor
示例6: remove_member
public function remove_member($user_id = 0)
{
global $database;
if (Group::is_admin($this->id, $user_id)) {
$sql = "UPDATE " . static::$table_name . " SET is_admin = 1 WHERE (user_id != 1 AND group_id = {$this->id}) LIMIT 1";
$database->query($sql);
}
$sql = "DELETE FROM " . static::$table_name . " WHERE (group_id = {$this->id} AND user_id = {$user_id}) LIMIT 1";
$database->query($sql);
if ($database->affected_rows() == 1) {
$num_users = $this->num_users;
$num_users--;
$database->escape_value($num_users);
$query = "UPDATE " . static::$extra_table . " SET num_users = {$num_users} WHERE id={$this->id} LIMIT 1";
$database->query($query);
if ($database->affected_rows() == 1) {
if ($num_users === 0) {
$this->delete();
} else {
return true;
}
} else {
return false;
}
} else {
return false;
}
}
示例7: header
header("Location: {$location}");
// header("Location:login.php?msg=$msg&return=$return_url");
exit;
}
$location = PA::$after_login_page . '/msg=7016';
// if no exception yet, set a success msg
}
// code for invitation accept ends here
if ($group_invitation_id) {
// accept group invitation
$is_valid_ginv = Invitation::validate_group_invitation_id($group_invitation_id);
if (!$is_valid_ginv) {
throw new CNException(INVALID_INV, "Sorry you cant join this group. May be group no longer exists or you are using old invitation.");
}
$gid_invite = Invitation::load($group_invitation_id);
if (Group::is_admin($gid_invite->inv_collection_id, $logged_user->user_id)) {
$msg = "You are the moderator, you can not accept invitation of same group";
$location = CNUrlHelper::url_for(PA::$url . '/cnuser_login.php', array('msg' => $msg, 'return' => $return_url), 'https');
header("Location: {$location}");
// header("Location:login.php?msg=$msg&return=$return_url");exit;
}
try {
$new_invite = new Invitation();
$new_invite->inv_id = $group_invitation_id;
$new_invite->inv_user_id = $u;
$new_invite->accept();
//get collection_id
$Ginv = Invitation::load($group_invitation_id);
$gid = $Ginv->inv_collection_id;
} catch (CNException $e) {
$msg = "{$e->message}";
示例8: moderate_content
/**
* flag a content to be moderated
* @access public
* @param int content_id ID of content to be moderated
*/
public function moderate_content($content_id)
{
Logger::log("Enter: Group::moderate_content() | Args: \$content_id = {$content_id}");
$c = Content::load_content($content_id, $_SESSION['user']['id']);
if (!Group::is_admin($this->collection_id, $c->author_id)) {
$res = Dal::query("INSERT INTO {moderation_queue} (collection_id, item_id, type) VALUES (?, ?, ?)", array($this->collection_id, $content_id, "content"));
Content::update_content_status($content_id, 2);
} else {
$this->approve($content_id, 'content');
}
Logger::log("Exit: Group::moderate_content()");
return;
}
示例9: setup_module
function setup_module($column, $moduleName, $obj)
{
global $request_info, $title, $body, $name, $email, $paging, $msg;
global $group_details, $users, $param;
switch ($moduleName) {
case 'GroupAccessModule':
case 'GroupStatsModule':
$obj->group_details = $group_details;
break;
case 'MembersFacewallModule':
$obj->group_details = $group_details;
$obj->mode = PRI;
$obj->block_type = HOMEPAGE;
$obj->links = $users;
$obj->gid = $_REQUEST['ccid'];
break;
case 'RecentPostModule':
$obj->block_type = HOMEPAGE;
$obj->type = 'group';
$obj->mode = PRI;
$obj->gid = $_REQUEST['ccid'];
$obj->group_details = $group_details;
break;
case 'GroupForumPermalinkModule':
global $group_top_mesg;
$gid = $_REQUEST['ccid'];
$group = ContentCollection::load_collection((int) $gid, $_SESSION['user']['id']);
$is_member = Group::member_exists((int) $gid, $_SESSION['user']['id']);
$is_admin = Group::is_admin((int) $gid, $_SESSION['user']['id']);
if ($group->reg_type == REG_INVITE && !$is_member && !$is_admin && !user_can($param)) {
$msg = 9005;
return "skip";
}
$obj->parent_id = $request_info['parent_id'];
$obj->parent_name_hidden = $request_info['parent_name_hidden'];
$obj->parent_type = $request_info['parent_type'];
$obj->header_title = $request_info['header_title'];
$obj->title_form = $title;
$obj->body = $body;
$obj->name = $name;
$obj->email = $email;
$obj->Paging["page"] = $paging["page"];
$obj->Paging["show"] = 5;
//five records
if ($error) {
$obj->msg = $msg;
}
break;
}
}
示例10: peopleaggregator_leaveGroup
function peopleaggregator_leaveGroup($args)
{
$user = User::from_auth_token($args['authToken']);
$ccid = api_parse_group_id($args['id']);
// not a member?
if (!Group::member_exists($ccid, $user->user_id)) {
throw new PAException(OPERATION_NOT_PERMITTED, "User {$user->login_name} is not a member of that group");
}
// trying to leave own group?
if (Group::is_admin($ccid, $user->user_id)) {
throw new PAException(OPERATION_NOT_PERMITTED, "Group leader cannot leave the group");
}
// find group
$g = ContentCollection::load_collection($ccid, $user->user_id);
// remove user from group
if (!$g->leave($user->user_id)) {
throw new PAException(OPERATION_NOT_PERMITTED, "Unable to leave group");
}
return array('success' => TRUE);
}
示例11:
}
?>
</div>
<div id="user_mail" class="user_mail">
<h2>Mail-Id</h2>
<span><?php
if (isset($from)) {
echo $from->mail_id;
}
?>
</span>
</div>
<?php
}
if ($type === "group") {
if (isset($group_id) && Group::is_admin($group_id, $session->user_id)) {
$is_admin = 1;
} else {
$is_admin = 0;
}
?>
<div id="group_image" class="user_image">
<img class="user_profile_pic" src="
<?php
if (isset($group_selected) && $group_selected->group_picture !== NULL) {
echo $group_selected->group_picture;
} else {
echo "images/group.svg";
}
?>
">
示例12: redirect_to
if (!$session->is_logged_in()) {
redirect_to("login.php");
}
$page = 1;
if (isset($_GET['update']) && $_GET['update'] == 1 && isset($_GET['group_id'])) {
global $page;
$page = 2;
$group_id = $database->escape_value($_GET['group_id']);
$group = Group::find_by_id($group_id);
$group_name = $group->group_name;
}
if (isset($_GET['user_id']) && isset($_GET['group_id'])) {
global $page;
$group_id = $database->escape_value($_GET['group_id']);
//check if he is the admin
if (Group::is_admin($group_id, $session->user_id)) {
$group = Group::find_by_id($group_id);
$user_id = $database->escape_value($_GET['user_id']);
if ($group->add_group_member($user_id)) {
$page = 2;
$message = "Member added successfull.";
} else {
$page = 2;
$message = "Try again.";
}
}
}
if (isset($_POST['next_page'])) {
global $page;
$upload_errors = array(UPLOAD_ERR_OK => "No errors.", UPLOAD_ERR_INI_SIZE => "Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE => "Larger than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL => "Partial upload.", UPLOAD_ERR_NO_FILE => "No file.", UPLOAD_ERR_NO_TMP_DIR => "No temporary directory.", UPLOAD_ERR_CANT_WRITE => "Cant write to disk.", UPLOAD_ERR_EXTENSION => "file upload stopped by extension.");
$image_types = array("image/gif", "image/jpeg", "image/pjpeg", "image/png");
示例13: render
function render()
{
global $login_uid;
if ($this->type == 'group') {
$this->outer_template = 'outer_show_content_group_module.tpl';
$group = new Group();
$group->collection_id = $this->gid;
if ($this->content_type == NULL) {
$this->content_type = 'all';
}
//$type = 'all',$cnt=FALSE, $show='ALL', $page=0, $sort_by='created', $direction='DESC'
if (!empty($this->content_type)) {
$this->Paging["count"] = $this->links = $group->get_contents_for_collection($this->content_type, TRUE, 10, 1, 'created', 'DESC', TRUE);
$this->contents = $group->get_contents_for_collection($this->content_type, FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC', TRUE);
} else {
$this->Paging["count"] = $this->links = $group->get_contents_for_collection($type = 'all', $cnt = TRUE, 'all', 0, $sort_by = 'created', $direction = 'DESC');
$this->contents = $group->get_contents_for_collection($type = 'all', $cnt = FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC');
}
$this->group_owner = FALSE;
if (Group::is_admin($group->collection_id, $login_uid)) {
$this->group_owner = TRUE;
}
$this->group_member = FALSE;
if (Group::member_exists($group->collection_id, $login_uid)) {
$this->group_member = TRUE;
}
/*
if($this->html_block_id_flag == 1) {
$this->Paging["count"] = $this->links = $group->get_contents_for_collection($type = 'all',$cnt=TRUE,'all' , 0, $sort_by='created', $direction='DESC');
$this->contents = $group->get_contents_for_collection($type = 'all', $cnt=FALSE, $this->Paging["show"], $this->Paging["page"],'created','DESC');
} else {
$this->contents = $group->get_contents_for_collection($this->content_type,FALSE, 10, 1, 'created', 'DESC',TRUE);
}*/
$this->title = $this->group_details['title'] . '\'s Group Blog';
} else {
if ($this->type == "tag") {
$this->Paging["count"] = Tag::get_associated_content_ids((int) $this->tag_id, $cnt = TRUE);
$this->contents = Tag::get_associated_content_ids((int) $this->tag_id, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
} else {
if ($this->type == "search") {
$this->Paging["count"] = Content::content_search($this->search_string_array, $cnt = TRUE);
$this->contents = Content::content_search($this->search_string_array, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
} else {
//print $this->content_type; exit;
$this->Paging["count"] = Content::load_content_id_array($this->uid, $this->content_type, $cnt = TRUE);
$contents = Content::load_content_id_array($this->uid, $this->content_type, $cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
$this->contents = $contents;
}
}
}
$this->orientation = LEFT;
if ($this->type == 'user') {
$this->block_type = 'ShowContentUserBlock';
$this->do_pagination = TRUE;
} else {
if ($this->type == 'group') {
if ($this->html_block_id_flag == 1) {
$this->block_type = 'ShowAllContent';
$this->do_pagination = TRUE;
} else {
$this->block_type = 'ShowContentGroupBlock';
}
} else {
if ($this->type == "tag") {
$this->block_type = 'ShowAllContent';
$this->do_pagination = TRUE;
} else {
if ($this->type == "search") {
$this->block_type = 'ShowAllContent';
$this->do_pagination = TRUE;
} else {
if ($this->show_all == 1) {
$this->block_type = 'ShowAllContent';
$this->do_pagination = TRUE;
} else {
$this->block_type = 'ShowContentBlock';
$this->do_pagination = TRUE;
}
}
}
}
}
$this->inner_HTML = $this->generate_inner_html($this->contents, $this->type);
$Pagination = new Pagination();
$Pagination->setPaging($this->Paging);
$this->page_first = $Pagination->getFirstPage();
$this->page_last = $Pagination->getLastPage();
$this->page_links = $Pagination->getPageLinks();
$content = parent::render();
return $content;
}
示例14: uihelper_generate_center_content_permalink
function uihelper_generate_center_content_permalink($cid, $show = 0)
{
global $app;
$image_media_gallery = FALSE;
$back_page = PA::$url . $app->current_route;
$content = CNContent::load_content((int) $cid, (int) PA::$login_uid);
// filter content fields for output
$content->title = _out($content->title);
$content->body = _out($content->body);
if (strstr($back_page, PA_ROUTE_CONTENT) || strstr($back_page, PA_ROUTE_PERMALINK)) {
if ($content->parent_collection_id > 0) {
$collection = ContentCollection::load_collection((int) $content->parent_collection_id, PA::$login_uid);
if ($collection->type == GROUP_COLLECTION_TYPE) {
$back_page = PA::$url . PA_ROUTE_GROUP . "/gid=" . $content->parent_collection_id;
} else {
$back_page = PA::$url . PA_ROUTE_MEDIA_GALLEY_IMAGES . "/uid=" . $content->author_id;
}
// IF permalink content is a group content redirect to group homepage
} else {
//if coming from permalink page then redirect to user page
$back_page = PA::$url . PA_ROUTE_USER_PRIVATE;
}
}
$moderateduser = Group::is_admin((int) $content->parent_collection_id, (int) PA::$login_uid) ? 1 : 0;
$back_page = urlencode($back_page);
if (!$content->is_html) {
$content->body = nl2br($content->body);
}
$media_gallery_content = NULL;
$media_gallery_content = in_array(trim($content->type), array('Image', 'Audio', 'Video'));
$editable = PA::$login_uid == $content->author_id || $moderateduser;
$comments = Comment::get_comment_for_content($cid, '', 'ASC');
$number_of_comments = count($comments);
$content->no_of_comments = $number_of_comments;
$trackback = CNContent::get_trackbacks_for_content($cid);
$number_of_trackbacks = count($trackback);
$content->no_of_trackbacks = $number_of_trackbacks;
$content->trackback_url = PA::$url . "/pa_trackback.php?cid=" . $cid;
$content_user = new User();
$content_user->load((int) $content->author_id);
$content->create_time = PA::date($content->changed, 'long');
// date("l, F d, Y", $content->changed);
$tags = Tag::load_tags_for_content($cid);
if ($tags) {
$t = array();
for ($i = 0; $i < count($tags); $i++) {
$name = _out($tags[$i]['name']);
$uid = PA::$login_uid;
$url = PA::$url . '/' . FILE_TAG_SEARCH . '?name_string=content_tag&keyword=' . $tags[$i]["name"];
$t[] = "<a href={$url}>" . $name . "</a>";
}
$tag_string = "<b>Tags : </b>" . implode(", ", $t);
} else {
$tag_string = "";
}
$content->tag_entry = $tag_string;
if (property_exists($content, 'sbname')) {
if (substr($content->sbname, 0, 5) == 'event') {
$content->type = 'SBEvent';
} elseif (substr($content->sbname, 0, 6) == 'review') {
$content->type = 'Review';
} elseif (substr($content->sbname, 0, 11) == 'media/audio') {
$content->type = 'Audio';
} elseif (substr($content->sbname, 0, 11) == 'media/video') {
$content->type = 'Video';
} elseif (substr($content->sbname, 0, 11) == 'media/image') {
$content->type = 'Image';
} elseif (substr($content->sbname, 0, 14) == 'showcase/group') {
$content->type = 'GroupShowCase';
} elseif (substr($content->sbname, 0, 15) == 'showcase/person') {
$content->type = 'PersonShowCase';
}
}
// replace magic strings
$content->replace_percent_strings(PA::$url);
$type = $content->type;
$type = $type . 'Permalink';
// comments
$comments_list_tpl = new Template(CURRENT_THEME_FSPATH . "/cncontent_comments.php");
$comments_list_tpl->set('current_theme_path', PA::$theme_url);
$comments_list_tpl->set('comments', $comments);
$comments_list_tpl->set('author_id', $content->author_id);
// Setting the variable for the abuse form ...
$comments_list = $comments_list_tpl->fetch();
//comment form
$cnform_comment_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_comment.php");
$cnform_comment_tpl->set('current_theme_path', PA::$theme_url);
if (isset(PA::$login_uid)) {
$user = new User();
$user->load((int) PA::$login_uid);
$login_name = $user->login_name;
$cnform_comment_tpl->set('name', $login_name);
$cnform_comment_tpl->set('login_name', $user->login_name);
}
$cnform_comment_tpl->set('cid', $cid);
if ($content->parent_collection_id > 0) {
$cnform_comment_tpl->set('ccid', $content->parent_collection_id);
}
// abuse form
$cnform_abuse_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_abuse.php");
//.........这里部分代码省略.........
示例15: array
$skip_group_modules = TRUE;
}
} else {//haha no way for anonymous user
$skip_group_modules = TRUE;
}
$access_type = 'Private';
} else {
$access_type = 'Public';
}
if( $group->reg_type == $group->REG_OPEN ) {
$access_type.= ' Open';
} else {
$access_type.= ' Moderated';
}
if (Group::is_admin((int)$gid, (int)$_SESSION['user']['id'])){
$is_admin = TRUE;
}
$members = $group->get_members($cnt=FALSE, 5, 1, 'created', 'DESC',FALSE);
//$members = $group->get_members();
$group_details = array();
$group_details['collection_id'] = $group->collection_id;
$group_details['type'] = $group->type;
$group_details['author_id'] = $group->author_id;
$user = new User();
$user->load((int)$group->author_id);
$first_name = $user->first_name;
$last_name = $user->last_name;
$login_name = $user->login_name;
$group_details['author_name'] = $login_name;