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."));
         }
     }
 }
<?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();
}
 $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;
Example #4
0
 /**
   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&amp;nid=' . $this->network_info->network_id . '&amp;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&amp;nid=' . $this->network_info->network_id . '&amp;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&amp;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&amp;uid=' . $uid), 'friends_gallery' => array('caption' => 'Friends gallery', 'url' => $this->base_url . '/' . FILE_MEDIA_GALLERY . '?view=friends&amp;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&amp;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&amp;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 . '&amp;action=join'), 'unjoin' => array('caption' => 'Unjoin', 'url' => $this->base_url . '/' . FILE_GROUP . '?gid=' . $group_id . '&amp;action=leave'), 'delete_group' => array('caption' => 'Delete', 'url' => $this->base_url . '/' . FILE_GROUP . '?action=delete&amp;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']);
             unset($group_specific['moderate_group']);
             if (Group::member_exists($group_id, $_SESSION['user']['id']) == TRUE) {
                 unset($group_specific['join']);
             } else {
                 if (Group::member_exists($group_id, $_SESSION['user']['id']) == FALSE) {
                     unset($group_specific['unjoin']);
                 }
             }
             unset($group_specific['group_customize_ui']);
         } else {
             if (!empty($group_id) && Group::is_admin($group_id, $_SESSION['user']['id'])) {
                 unset($group_specific['join']);
                 unset($group_specific['unjoin']);
             }
         }
     }
     ///EOF group specific menu children
     /// children of group
     $groups_children = array('groups_general' => $groups_general, 'group_specific' => $group_specific);
     ///EOF children of group
     //for network option at 3 level
     $network = array('configure_network' => array('caption' => 'Configure', 'url' => $this->base_url . '/' . FILE_NETWORK_STATS), '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'));
     //     'home' => array('caption'=>'Home',
     //                                   'url'=>$this->base_url.'/'.FILE_HOMEPAGE
     //                                   ),
     //                       'statistics' => array('caption'=>'Setting',
     //                                   'url'=>$this->base_url.'/'.FILE_NETWORK_STATS
     //                                   ),
     //                       'manage_user' => array('caption'=>'Manage',
     //                                   'url'=>$this->base_url.'/'.FILE_NETWORK_MANAGE_USER
     //                                   ),
     //                        'user_defaults' => array('caption'=>'Defaults',
     //                                   'url'=>$this->base_url.'/'.FILE_NEW_USER_BY_ADMIN
     //                                   ),
     //                        'email_notification' => array('caption'=>'Notify',
     //                                   'url'=>$this->base_url.'/'.FILE_EMAIL_NOTIFICATION
     //                                   ),
     //                       'meta_network' => array('caption'=>'Meta Network',
     //                                   'url'=>$this->base_url.'/'.FILE_NETWORK_FEATURE
     //                                   ),
     //                       'module_selector' => array('caption'=>'Module Selector',
     //                                                  'url'=>$this->base_url.'/'
     //                                                  .FILE_MODULE_SELECTOR.
     //                                                  '?page_id=home_page_id'
     //                                                  ),
     // 			     );
     $network_notify = array('email_notification' => array('caption' => 'Email Notification', 'url' => $this->base_url . '/' . FILE_EMAIL_NOTIFICATION), 'network_bulletins' => array('caption' => 'Bulletins', 'url' => $this->base_url . '/' . FILE_NETWORK_BULLETINS));
     $network_setting = array('network_feature' => array('caption' => 'Set Feature Network', 'url' => $this->base_url . '/' . FILE_NETWORK_FEATURE), 'manage_emblem' => array('caption' => 'Manage Emblem', 'url' => $this->base_url . '/' . FILE_MANAGE_EMBLEM), 'manage_taketour' => array('caption' => 'Personalized Video', 'url' => $this->base_url . '/' . FILE_MANAGE_TAKETOUR), 'splash_page' => array('caption' => 'Configure Splash Page', 'url' => $this->base_url . '/' . FILE_CONFIGURE_SPLASH_PAGE), 'top_bar' => array('caption' => 'Top Bar Enable/Disable', 'url' => '#'));
     $network_default = array('new_user_by_admin' => array('caption' => 'Create User', 'url' => $this->base_url . '/' . FILE_NEW_USER_BY_ADMIN), 'user_defaults' => array('caption' => 'User Defaults', 'url' => $this->base_url . '/' . FILE_NETWORK_USER_DEFAULTS), 'relationship_settings' => array('caption' => 'Relationships', 'url' => $this->base_url . '/' . FILE_RELATIONSHIP_SETTINGS));
     $manage_network = array('manage_user' => array('caption' => 'Manage Users', 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_USER), 'manage_content' => array('caption' => 'Manage Contents', 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_CONTENT), 'manage_links' => array('caption' => 'Manage Links', 'url' => $this->base_url . '/' . FILE_NETWORK_LINKS));
     $network_stats = array('statistics' => array('caption' => 'General', 'url' => $this->base_url . '/' . FILE_NETWORK_STATS), 'customize_ui' => array('caption' => 'Customize Ui', 'url' => $this->base_url . '/' . FILE_NETWORK_CUSTOMIZE_UI_PAGE));
     $network_module_selector = array('home_page_id' => array('caption' => 'Home Page', 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=home_page_id'), 'user_default_page_id' => array('caption' => 'User Default Page', 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=user_default_page_id'), 'group_directory_page_id' => array('caption' => 'Group Directory Page', 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=group_directory_page_id'), 'network_directory_page_id' => array('caption' => 'Network Directory Page', 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=network_directory_page_id'));
     if ($this->network_info->type != MOTHER_NETWORK_TYPE) {
         unset($network['meta_network']);
     }
     if ($this->network_info->type != MOTHER_NETWORK_TYPE) {
         unset($network['manage_taketour']);
         unset($network['manage_emblem']);
     }
     //end
     /// second level menu for network
     $level_3 = array('user' => @$user_children, 'people' => @$people_children, 'groups' => $groups_children, 'network' => $network, 'network_notify' => $network_notify, 'network_module_selector' => $network_module_selector, 'network_setting' => $network_setting, 'network_default' => $network_default, 'manage_network' => $manage_network, 'network_stats' => $network_stats);
     ///EOF second level menu children
     ///set level menu items
     $this->level_1 = $level_1;
     $this->level_2 = $level_2;
     $this->level_3 = $level_3;
 }
/** 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
Example #6
0
 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;
     }
 }
         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}";
Example #8
0
 /**
  * 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;
 }
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;
    }
}
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);
}
Example #11
0
    }
    ?>
				</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";
    }
    ?>
">
Example #12
0
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");
 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;
 }
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");
    /* Permalink and edit links for content */
    if ($content->parent_collection_id != -1) {
        $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id . '&ccid=' . $content->parent_collection_id;
    } else {
        $perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id;
    }
    $params = array('permissions' => 'edit_content', 'uid' => PA::$login_uid, 'cid' => $content->content_id);
    if (PermissionsHandler::can_user(PA::$login_uid, $params)) {
        if ($media_gallery_content) {
            $edit_link = PA::$url . '/edit_media.php?cid=' . $content->content_id;
        } else {
            $edit_link = PA::$url . "/cncontent_blog.php?cid=" . $content->content_id;
        }
        $delete_link = PA::$url . PA_ROUTE_CONTENT . "?action=deleteContent&cid=" . $content->content_id . '&amp;back_page=' . $back_page;
        // handle Event separately
        if ($type == "EventPermalink") {
            $edit_link = PA::$url . '/calendar.php?cid=' . $content->content_id;
            $delete_link = $edit_link . "&delete=1" . '&amp;back_page=' . $back_page;
        }
    } else {
        $edit_link = $delete_link = NULL;
    }
    $user_link = PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $content->author_id;
    /* Code for Approval and Denial links for a content */
    if ($moderateduser && $content->is_active == 2) {
        $approval_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&apv=1';
        $denial_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&dny=1';
    } else {
        $approval_link = $denial_link = NULL;
    }
    // Show comments form to logged in users, only if comments enabled.
    global $comments_disabled;
    // fix by Z.Hron; if group content - only members of group can comment it
    $can_user_comment = true;
    if (isset($_GET['gid']) && isset(PA::$login_uid)) {
        $can_user_comment = Group::member_exists((int) $_GET['gid'], PA::$login_uid);
    }
    if (!$comments_disabled && !empty(PA::$login_uid) && $can_user_comment) {
        $cnform_comment = $cnform_comment_tpl->fetch();
        $cnform_abuse = $cnform_abuse_tpl->fetch();
    } else {
        $cnform_comment = $cnform_abuse = NULL;
    }
    if (getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php")) {
        $middle_content = new Template(getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php"));
        $middle_content->set_object('contents', $content);
        $middle_content->set('editable', $editable);
        $middle_content->set('picture_name', $content_user->picture);
        //  to set picture name for diplaying in contets
        $middle_content->set('user_id', $content_user->user_id);
        $middle_content->set('user_name', $content_user->first_name . ' ' . $content_user->last_name);
        $middle_content->set('current_theme_path', PA::$theme_url);
        $middle_content->set('back_page', $back_page);
        $middle_content->set('comments', $comments_list);
        $middle_content->set('cnform_comment', $cnform_comment);
        $middle_content->set('cnform_abuse', $cnform_abuse);
        $middle_content->set('media_gallery_content', $media_gallery_content);
        if ($show == 1) {
            $middle_content->set('show', $show);
        }
        $middle_content->set('permalink', $perma_link);
        $middle_content->set('edit_link', $edit_link);
        $middle_content->set('approval_link', $approval_link);
        $middle_content->set('denial_link', $denial_link);
        $middle_content->set('delete_link', $delete_link);
        $middle_content->set('user_link', $user_link);
        $return_content = $middle_content->fetch();
    } else {
        $return_content = '<p>Content does not have a display template.</p><p>Create a ' . $type . '.php file to display this content type.</p>';
    }
    return $return_content;
}
Example #15
0
       $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;
function pageLoadGroup($group)
{
    $access = $group->access_type;
    $skip_group_modules = FALSE;
    $is_admin = FALSE;
    if ($group->access_type == $group->ACCESS_PRIVATE) {
        if (PA::$login_uid) {
            //if private group
            if (GROUP::member_exists($group->collection_id, PA::$login_uid)) {
                $skip_group_modules = FALSE;
            } else {
                // haha no way for non member of group
                $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) $group->collection_id, (int) PA::$login_uid)) {
        $is_admin = TRUE;
    }
    $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
    $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);
    $login_name = $user->login_name;
    $first_name = $user->first_name;
    $last_name = $user->last_name;
    $group_details['author_name'] = $login_name;
    $group_details['author_picture'] = $user->picture;
    $group_details['title'] = $group->title;
    $group_details['description'] = $group->description;
    $group_details['is_active'] = $group->is_active;
    $group_details['picture'] = $group->picture;
    $group_details['desktop_picture'] = @$group->desktop_picture;
    $group_details['created'] = PA::datetime($group->created, 'long', 'short');
    // date("F d, Y h:i A", $group->created);
    $group_details['changed'] = $group->changed;
    $group_details['category_id'] = $group->category_id;
    $cat_obj = new Category();
    $cat_obj->set_category_id($group->category_id);
    $cat_obj->load();
    $cat_name = stripslashes($cat_obj->name);
    $cat_description = stripslashes($cat_obj->description);
    $group_details['category_name'] = $cat_name;
    $group_details['category_description'] = $cat_description;
    $group_details['members'] = Group::get_member_count($group->collection_id);
    $group_details['access_type'] = $access_type;
    $group_details['is_admin'] = $is_admin;
    //////////////////get details of group EOF
    if (is_array($members)) {
        $count = count($members);
        foreach ($members as $member) {
            $count_relations = Relation::get_relations($member['user_id'], APPROVED, PA::$network_info->network_id);
            $user = new User();
            $user->load((int) $member['user_id']);
            $login_name = $user->login_name;
            $user_picture = $user->picture;
            $users_data[] = array('user_id' => $member['user_id'], 'picture' => $user_picture, 'login_name' => $login_name, 'no_of_relations' => count($count_relations));
        }
        $final_array = array('users_data' => $users_data, 'total_users' => $count);
    }
    $users = $final_array;
    $is_member = Group::member_exists((int) $group->collection_id, (int) PA::$login_uid) ? TRUE : FALSE;
    $group_details['is_member'] = $is_member;
    $group_details['skip_group_modules'] = $skip_group_modules;
    $group_details['users'] = $users;
    return $group_details;
}
Example #17
0
<?php

require_once "{$path_prefix}/web/group_functions.php";
global $login_uid;
$group_var = new Group();
$group_var->collection_id = $_form['gid'];
$group_info = $group_var->get_group_theme_detail();
$extra = NULL;
$extra = unserialize($group_info['extra']);
if (!empty($_form['gid'])) {
    $is_admin = Group::is_admin($_form['gid'], $login_uid);
}
// Saving the data
if ($_form && $is_admin) {
    switch ($_form['type']) {
        case 'style':
            $extra['style']['newcss'] = $_form['newcss'];
            $extra['style']['user_json'] = $_form['user_json'];
            if (isset($_form['restore_default'])) {
                unset($extra['style']);
            }
            $extra_param = serialize($extra);
            $ext = array('extra' => $extra_param);
            $group_var->save_group_theme($ext);
            break;
        case 'theme':
            $extra['theme'] = $_form['theme'];
            // When we select the theme than inline CSS will be empty
            unset($extra['style']);
            $extra_param = serialize($extra);
            $ext = array('extra' => $extra_param);
Example #18
0
    $img_path = $base_url . "/images/default.jpg";
}
$is_member = FALSE;
$is_admin = FALSE;
$is_invite = FALSE;
if ($_GET['gid']) {
    $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']);
    $pending = array();
    $accepted = array();
    if (Group::member_exists((int) $group->collection_id, (int) $_SESSION['user']['id'])) {
        $is_member = TRUE;
    }
    if ($group->reg_type == $group->REG_INVITE and Group::member_exists((int) $group->collection_id, (int) $_SESSION['user']['id'])) {
        $is_invite = TRUE;
    }
    if (Group::is_admin((int) $group->collection_id, (int) $_SESSION['user']['id'])) {
        $is_admin = TRUE;
        if ($group->is_moderated || $group->reg_type == $group->REG_MODERATED) {
            $total_in_mod_queue = count($group->get_moderation_queue('content')) + count($group->get_moderation_queue('user'));
        }
        $invs = Invitation::get_all((int) $_SESSION['user']['id'], $group->collection_id);
        foreach ($invs as $i) {
            if ($i['status'] == 0) {
                $pending[] = $i['id'];
            } elseif ($i['status'] == 1) {
                $accepted[] = $i['id'];
            }
        }
    } else {
        $pending = Invitation::get_pending_invitations($group->collection_id, $_SESSION['user']['id']);
        $accepted = Invitation::get_accepted_invitations($group->collection_id, $_SESSION['user']['id']);
Example #19
0
                                 $attempt = new Attempt('success', 'Group ' . $group->get_name() . ' removed permanently by ' . $user->get_name() . ".");
                             } catch (Exception $e) {
                                 Helpers::respond_json(new Attempt('error', $e->getMessage()));
                                 die;
                             }
                             // END of remove_group
                         } else {
                             if ($action == "am_admin") {
                                 try {
                                     $group_name = Helpers::require_variable('group', 'a group name');
                                     $user_name = Helpers::require_variable('user', 'a user to validate');
                                     $group = new Group(array("name" => $group_name));
                                     $user = new User(array("name" => $user_name, "admin" => true));
                                     $group->read();
                                     $user->read();
                                     $is_authorized = $group->is_admin($user) ? "yes" : "no";
                                     $attempt = new Attempt('success', $is_authorized);
                                 } catch (Exception $e) {
                                     Helpers::respond_json(new Attempt('error', $e->getMessage()));
                                     die;
                                 }
                             } else {
                                 // No action
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
   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&amp;nid=' . $this->network_info->network_id . '&amp;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&amp;nid=' . $this->network_info->network_id . '&amp;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&amp;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&amp;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);
     }
     ///EOF children of people 2nd level link
     $family_children = array('neighbors' => array('caption' => __("Neighbors"), 'url' => $this->base_url . PA_ROUTE_FAMILY_DIRECTORY), 'family_home' => array('caption' => __("Family Homepage"), 'url' => $this->base_url . PA_ROUTE_FAMILY . "/gid=" . $this->group_id), 'family_members' => array('caption' => __("Family Members"), 'url' => $this->base_url . PA_ROUTE_FAMILY_MEMBERS . "/gid=" . $this->group_id));
     /// group general children
     //    $users_first_group_id = $this->get_users_first_group_id();
     $groups_general = array('find_groups' => array('caption' => sprintf(__('Find %s'), __(PA::$group_noun_plural)), 'url' => $this->base_url . PA_ROUTE_GROUPS), 'create_group' => array('caption' => __('Create'), 'url' => $this->base_url . '/' . FILE_ADDGROUP), 'invite' => array('caption' => __('Invite'), 'url' => $this->base_url . '/' . FILE_GROUP_INVITATION));
     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
     $gid = $group_id = $this->get_group_id();
     $group_specific = array('group_home' => array('caption' => sprintf(__('%s Home'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id), 'group_forum' => array('caption' => sprintf(__('%s Forum'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_FORUMS . "/network_id=" . $this->network_info->network_id . '&gid=' . $group_id), 'group_members' => array('caption' => sprintf(__('%s Members'), __(PA::$group_noun)), 'url' => $this->base_url . '/' . FILE_VIEW_ALL_MEMBERS . '?gid=' . $group_id), 'group_gallery' => array('caption' => sprintf(__('%s Gallery'), __(PA::$group_noun)), 'url' => $this->base_url . PA_ROUTE_MEDIA_GALLEY_IMAGES . '/view=groups_media&amp;gid=' . $group_id), 'group_events' => array('caption' => sprintf(__('%s Events'), __(PA::$group_noun)), 'url' => $this->base_url . '/' . FILE_GROUP_CALENDAR . '?gid=' . $group_id));
     $group_member = FALSE;
     $group_may_post = FALSE;
     $group_may_invite = FALSE;
     $group_moderator = FALSE;
     $group_manange_ads = FALSE;
     $group_owner = FALSE;
     if (PA::$login_uid) {
         if (Group::member_exists($gid, PA::$login_uid)) {
             $group_member = TRUE;
             // TODO: split this out to it's own perm check
             $group_may_post = TRUE;
             $group_may_invite = TRUE;
         }
         if (PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_groups, manage_roles')) || Group::is_admin($gid, PA::$login_uid)) {
             $group_owner = TRUE;
             $group_moderator = TRUE;
         } else {
             if (PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_groups'))) {
                 $group_moderator = TRUE;
             }
         }
         // network level ad manager?
         $group_manange_ads = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => 'manage_ads'));
         // check for manageads of group permissions
         if (!$group_manange_ads) {
             // we do this check only if the user is not already permitted to manage ads
             $group_manange_ads = PermissionsHandler::can_group_user(PA::$login_uid, $gid, array('permissions' => 'manage_ads'));
         }
         if ($group_may_invite) {
             $group_specific = array('invite' => array('caption' => __("Invite a Friend"), 'url' => PA::$url . PA_ROUTE_GROUP_INVITE . '/gid=' . $gid)) + $group_specific;
         }
         if ($group_may_post) {
             // member get's a 'Create Post' link on top
             $group_specific = array('create_post' => array('caption' => __("Create post"), 'url' => PA::$url . '/post_content.php?ccid=' . $gid)) + $group_specific;
         }
         // admin / owner
         if ($group_owner) {
             $group_specific = $group_specific + array('settings' => array('caption' => __("Group Settings"), 'url' => PA::$url . '/addgroup.php?gid=' . $gid), 'group_poll_select' => array('caption' => sprintf(__('%s Poll Select'), __(PA::$group_noun)), 'url' => $this->base_url . '/group_poll.php?gid=' . $group_id . '&type=select'), 'group_poll_create' => array('caption' => sprintf(__('%s Poll Create'), __(PA::$group_noun)), 'url' => $this->base_url . '/group_poll.php?gid=' . $group_id . '&type=create'));
         }
         // admin / moderator
         if ($group_moderator) {
             $group_specific = $group_specific + array('bulletin' => array('caption' => __("Group Bulletin"), 'url' => PA::$url . PA_ROUTE_GROUP_BULLETINS . '?gid=' . $gid), 'moderate' => array('caption' => __("Moderate"), 'url' => PA::$url . PA_ROUTE_GROUP_MODERATION . '/view=members&amp;gid=' . $gid), 'manage_members' => array('caption' => __("Manage Content"), 'url' => PA::$url . '/manage_group_content.php?gid=' . $gid), 'group_customize_ui' => array('caption' => __('Group Appearance'), 'url' => $this->base_url . PA_ROUTE_CUSTOMIZE_GROUP_GUI . '/theme/gid=' . $group_id));
         }
         // ads
         if ($group_manange_ads) {
             $group_specific = $group_specific + array('ads' => array('caption' => __("Manage Ads"), 'url' => PA::$url . PA_ROUTE_GROUP_AD_CENTER . '?gid=' . $gid));
         }
         // the join/unjoin/delete go last
         if ($group_owner) {
             // only the owner can delete
             $group_specific = $group_specific + array('delete_group' => array('caption' => __('Delete'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/action=delete&amp;gid=' . $group_id, 'extra' => ' onclick ="return delete_confirmation_msg(\'' . __('Are you sure you want to delete this group') . '?\') "'));
         } else {
             // anyone else
             if ($group_member) {
                 $group_specific = $group_specific + array('unjoin' => array('caption' => __('Unjoin'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id . '&amp;action=leave'));
             } else {
                 $group_specific = $group_specific + array('join' => array('caption' => __('Join'), 'url' => $this->base_url . PA_ROUTE_GROUP . '/gid=' . $group_id . '&amp;action=join'));
             }
         }
     }
     ///EOF group specific menu children
     /// children of group
     $groups_children = array('groups_general' => $groups_general, 'group_specific' => $group_specific);
     ///EOF children of group
     //for network option at 3 level
     $network = array('configure_network' => array('caption' => __('Configure'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK)) + $level_2;
     $network_notify = array('email_notification' => array('caption' => __('Email Notification'), 'url' => $this->base_url . '/' . FILE_EMAIL_NOTIFICATION), 'network_bulletins' => array('caption' => __('Bulletins'), 'url' => $this->base_url . '/' . FILE_NETWORK_BULLETINS));
     $network_setting = array('network_feature' => array('caption' => __('Set Feature Network'), 'url' => $this->base_url . '/' . FILE_NETWORK_FEATURE), 'manage_emblem' => array('caption' => __('Manage Emblem'), 'url' => $this->base_url . '/' . FILE_MANAGE_EMBLEM), 'manage_taketour' => array('caption' => __('Personalized Video'), 'url' => $this->base_url . '/' . FILE_MANAGE_TAKETOUR), 'splash_page' => array('caption' => __('Configure Splash Page'), 'url' => $this->base_url . '/' . FILE_CONFIGURE_SPLASH_PAGE), 'top_bar' => array('caption' => __('Top Bar Enable/Disable'), 'url' => '#'));
     $network_default = array('new_user_by_admin' => array('caption' => __('Create User'), 'url' => $this->base_url . '/' . FILE_NEW_USER_BY_ADMIN), 'user_defaults' => array('caption' => __('User Defaults'), 'url' => $this->base_url . '/' . FILE_NETWORK_USER_DEFAULTS), 'relationship_settings' => array('caption' => __('Relationships'), 'url' => $this->base_url . '/' . FILE_RELATIONSHIP_SETTINGS));
     $manage_network = array('manage_user' => array('caption' => __('Manage Users'), 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_USER), 'manage_content' => array('caption' => __('Manage Contents'), 'url' => $this->base_url . '/' . FILE_NETWORK_MANAGE_CONTENT), 'manage_links' => array('caption' => __('Manage Links'), 'url' => $this->base_url . '/' . FILE_NETWORK_LINKS));
     $network_stats = array('statistics' => array('caption' => __('General'), 'url' => $this->base_url . PA_ROUTE_CONFIGURE_NETWORK), 'customize_ui' => array('caption' => __('Customize UI'), 'url' => $this->base_url . '/' . FILE_NETWORK_CUSTOMIZE_UI_PAGE));
     $network_module_selector = array('home_page_id' => array('caption' => __('Home Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=home_page_id'), 'user_default_page_id' => array('caption' => __('User Default Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=user_default_page_id'), 'group_directory_page_id' => array('caption' => __('Group Directory Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=group_directory_page_id'), 'network_directory_page_id' => array('caption' => __('Network Directory Page'), 'url' => $this->base_url . '/' . FILE_MODULE_SELECTOR . '?page_id=network_directory_page_id'));
     if ($this->network_info->type != MOTHER_NETWORK_TYPE) {
         unset($network['meta_network']);
     }
     if ($this->network_info->type != MOTHER_NETWORK_TYPE) {
         unset($network['manage_taketour']);
         unset($network['manage_emblem']);
     }
     //end
     /// second level menu for network
     $level_3 = array('user' => @$user_children, 'people' => @$people_children, 'family' => @$family_children, 'groups' => $groups_children, 'network' => $network, 'network_notify' => $network_notify, 'network_module_selector' => $network_module_selector, 'network_setting' => $network_setting, 'network_default' => $network_default, 'manage_network' => $manage_network, 'network_stats' => $network_stats);
     ///EOF second level menu children
     ///set level menu items
     $this->level_1 = $level_1;
     $this->level_2 = $level_2;
     $this->level_3 = $level_3;
 }
Example #21
0
 /**
  * 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)) {
         ModerationQueue::moderate_content($content_id, $this->collection_id);
     } else {
         $this->approve($content_id, 'content');
     }
     Logger::log("Exit: Group::moderate_content()");
     return;
 }