Пример #1
0
function setup_module($column, $moduleName, $obj)
{
    global $content_type, $users, $post_type_message, $post_type, $network_info, $paging;
    switch ($moduleName) {
        case 'ImagesModule':
            $obj->block_type = 'Gallery';
            $obj->page = "homepage";
            $obj->title = __("Recent Media");
            break;
        case 'EventCalendarSidebarModule':
            $obj->assoc_type = "network";
            $obj->assoc_id = $network_info->network_id;
            $obj->title = 'Events';
            if (isset($_SESSION['user']['id'])) {
                $is_admin = Network::is_admin($network_info->network_id, (int) $_SESSION['user']['id']);
            } else {
                $is_admin = FALSE;
            }
            if ($is_admin) {
                $obj->may_edit = true;
            } else {
                $obj->may_edit = false;
            }
            break;
        case 'ShowContentModule':
            //not sure why this is being used here
            // TODO : find out reason of using this and fix it
            $obj->cid = @$_GET['cid'];
            $obj->mode = PUB;
            $obj->block_type = HOMEPAGE;
            $obj->content_type = $content_type;
            $obj->uid = 0;
            $obj->message = $post_type_message[$post_type];
            // This message array is defined in config.inc
            $obj->Paging["page"] = $paging["page"];
            $obj->Paging["show"] = 10;
            break;
        case 'AdsByGoogleModule':
            $obj->block_type = HOMEPAGE;
            break;
        case 'NewestGroupsModule':
            $obj->block_type = HOMEPAGE_SORTBY;
            $obj->sort_by = TRUE;
            break;
        case 'RecentPostModule':
            $obj->type = 'homepage';
            break;
    }
}
 function generate_inner_html()
 {
     if (PA::$network_info->type == MOTHER_NETWORK_TYPE) {
         if (PA::$login_uid == SUPER_USER_ID) {
             $this->set_perms('all');
         } else {
             $tasks = $this->get_user_task_permissions(PA::$login_uid);
             if (count($tasks) == 0) {
                 $this->set_perms('none');
             } else {
                 $this->set_perms($tasks);
             }
         }
     } else {
         //spawned networks admin has all permissions
         if (Network::is_admin(PA::$network_info->network_id, PA::$login_uid) || PA::$login_uid == SUPER_USER_ID) {
             //owner of network
             $this->set_perms('all');
             //todo - quick fix here
             $this->task_perms['meta_networks'] = FALSE;
         } else {
             $tasks = $this->get_user_task_permissions(PA::$login_uid);
             if (count($tasks) == 0) {
                 $this->set_perms('none');
             } else {
                 $this->set_perms($tasks);
             }
         }
     }
     $extra = unserialize(PA::$network_info->extra);
     $network_content_moderation = FALSE;
     if (@$extra['network_content_moderation'] == NET_YES) {
         // this can be empty or not set
         $network_content_moderation = TRUE;
     }
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_private.tpl';
     }
     $obj_inner_template = new Template($inner_template);
     $obj_inner_template->set('task_perms', $this->task_perms);
     $obj_inner_template->set('network_content_moderation', $network_content_moderation);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
Пример #3
0
function current_user_can($action)
{
    global $network_info;
    //TODO write call back functions for each action
    if ('configure_network' == $action || 'delete_network' == $action || 'network_announcement' == $action || 'network_bulletins' == $action || 'manage_user' == $action || 'manage_content' == $action || 'new_user_create' == $action || 'network_links' == $action || 'change_skin' == $action || 'configure_splash_page' == $action || 'customize_ui' == $action || 'moderate_content' == $action) {
        if ($network_info) {
            if (!Network::is_admin($network_info->network_id, $_SESSION['user']['id'])) {
                return FALSE;
            } else {
                return TRUE;
            }
        } else {
            //right now return true simply
            //TODO: write code for mother network check
            return TRUE;
        }
    }
}
 function generate_inner_html()
 {
     global $current_theme_path, $base_url, $network_info, $login_uid;
     if ($network_info->type == MOTHER_NETWORK_TYPE) {
         if ($login_uid == SUPER_USER_ID) {
             $this->set_perms('all');
         } else {
             $role_obj = Roles::get_user_role($login_uid);
             if (empty($role_obj)) {
                 $this->set_perms('none');
             } else {
                 $tasks = Roles::get_tasks_of_role($role_obj->role_id);
                 $this->set_perms($tasks);
             }
         }
     } else {
         //spawned networks only admin roles
         if (Network::is_admin($network_info->network_id, $login_uid) || $login_uid == SUPER_USER_ID) {
             //owner of network
             $this->set_perms('all');
             //todo - quick fix here
             $this->task_perms['meta_networks'] = FALSE;
         } else {
             $this->set_perms('none');
         }
     }
     $extra = unserialize($network_info->extra);
     $network_content_moderation = FALSE;
     if (@$extra['network_content_moderation'] == NET_YES) {
         // this can be empty or not set
         $network_content_moderation = TRUE;
     }
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = dirname(__FILE__) . '/center_inner_private.tpl';
     }
     $obj_inner_template =& new Template($inner_template);
     $obj_inner_template->set('base_url', $base_url);
     $obj_inner_template->set('task_perms', $this->task_perms);
     $obj_inner_template->set('network_content_moderation', $network_content_moderation);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
function setup_module($column, $module, $obj)
{
    global $login_uid;
    switch ($module) {
        case 'EventCalendarModule':
            $obj->title = 'Network Events';
            $obj->assoc_type = 'network';
            $obj->assoc_id = PA::$network_info->network_id;
            $obj->assoc_title = PA::$network_info->name;
            $is_admin = Network::is_admin(PA::$network_info->network_id, $login_uid);
            if ($is_admin) {
                $obj->may_edit = true;
            } else {
                $obj->may_edit = false;
            }
            break;
    }
    $obj->mode = PUB;
}
Пример #6
0
function setup_module($column, $module, $obj)
{
    global $network_info, $login_uid, $configure_permission;
    switch ($module) {
        case 'EventCalendarModule':
            if (!$configure_permission) {
                return 'skip';
            }
            $obj->title = 'Network Events';
            $obj->assoc_type = 'network';
            $obj->assoc_id = $network_info->network_id;
            $obj->assoc_title = $network_info->name;
            $is_admin = Network::is_admin($network_info->network_id, $login_uid);
            if ($is_admin) {
                $obj->may_edit = true;
            } else {
                $obj->may_edit = false;
            }
            break;
    }
    $obj->mode = PUB;
}
 /**
   Purpose : this function is used to get navigation links for the whole page.
   Scope : public
   @param - it needs no direct input. But works only on the basis of current page initialized in __construct()
   @return - array of links
   **/
 public function get_links($optional = NULL)
 {
     //initialization
     global $dynamic_page;
     if (isset($_SESSION['user']['id'])) {
         $extra = unserialize($this->network_info->extra);
         if (@$extra['reciprocated_relationship'] == NET_YES) {
             $status = APPROVED;
         } else {
             $status = FALSE;
         }
         $relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status, PA::$network_info->network_id);
         $user_groups = Group::get_user_groups((int) $_SESSION['user']['id']);
         /* $gid isn't defined in this function, so the following call
          * will probably always return FALSE.  To get rid of the warning
          * under E_ALL, I've replaced the following expression with
          * FALSE.  Maybe $gid should be get_group_id()? */
         $is_owner_of_group = FALSE;
         //Group::is_admin($gid,(int)$_SESSION['user']['id']) ;
     }
     if (isset($relations_ids) && sizeof($relations_ids)) {
         $this->set_friend_uid($relations_ids[0]);
     }
     if (isset($user_groups) && sizeof($user_groups)) {
         $this->users_first_group_id($user_groups[0]['gid']);
     }
     if (PA::$login_uid) {
         $this->set_uid(PA::$login_uid);
     } else {
         $this->set_anonymous();
     }
     $is_group_content = FALSE;
     if (@$_GET['gid']) {
         $this->set_group_id($_GET['gid']);
     } else {
         if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid']) && $_REQUEST['ccid'] > 0) {
             $this->set_group_id($_REQUEST['ccid']);
             $is_group_content = TRUE;
         } else {
             if (PAGE_PERMALINK == $this->current_page && !empty($_GET['cid'])) {
                 try {
                     $content_data = Content::load_content($_GET['cid'], $this->get_uid());
                 } catch (PAException $e) {
                     if ($e->getCode() != CONTENT_NOT_FOUND) {
                         throw $e;
                     }
                 }
                 if (isset($content_data)) {
                     if ($content_data->parent_collection_id > 0) {
                         $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
                         if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
                             $this->set_group_id($content_data->parent_collection_id);
                             $is_group_content = TRUE;
                         }
                     }
                 }
             }
         }
     }
     //test
     //$this->current_page='test.php';
     // make links for current page
     $this->make_links();
     $level_1 = $this->get_level_1();
     $level_2 = $this->get_level_2();
     $level_3 = NULL;
     $left_user_public_links = NULL;
     if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) {
         $level_3 = $this->get_level_3('network');
     } else {
         if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) {
             $level_3 = $this->get_level_3('network');
         }
     }
     $level_3 = NULL;
     switch ($this->current_page) {
         /*----------------------------------------------------*/
         case PAGE_HOMEPAGE:
             $level_3 = NULL;
             $level_2['highlight'] = 'home';
             break;
         case FILE_LOGIN:
             $level_2['highlight'] = 'home';
             break;
         case PAGE_SEARCH:
             //fix by Zoran Hron: constants FILE_SEARCH_HOME and FILE_SHOWCONTENT points to the same value !!!
             if (!empty($_GET['gid'])) {
                 $level_2['highlight'] = 'groups';
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             } else {
                 if (!empty($_GET['btn_searchContent'])) {
                     $level_2['highlight'] = 'search';
                 } else {
                     $level_3 = NULL;
                     $level_2['highlight'] = 'home';
                 }
             }
             break;
         case FILE_TAG_SEARCH:
             $level_2['highlight'] = 'tag_search';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_USER_PRIVATE:
             global $app;
             $app->setRequestParam('uid', PA::$login_uid, 'POST');
         case PAGE_USER_PUBLIC:
         case PAGE_USER_PRIVATE:
             if (!PA::$page_uid && !PA::$login_uid) {
                 throw new PAException("", "Invalid page access");
             }
             if (PA::$page_uid) {
                 //uid get variable set
                 //these links are to be added in front
                 $def_relations_term = 'Friend';
                 if (isset($extra['relationship_show_mode']['term'])) {
                     $def_relations_term = $extra['relationship_show_mode']['term'];
                 }
                 $relation_already_exists_links = array('send_message' => array('caption' => __('Send a message'), 'url' => $this->base_url . PA_ROUTE_ADDMESSAGE . '/uid=' . PA::$page_uid), 'change_relationship' => array('caption' => __('Change Relation'), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/uid=' . PA::$page_uid . '&do=change&action=EditRelation'), 'delete_relationship' => array('caption' => sprintf(__('Delete as %s'), __($def_relations_term)), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/do=delete&uid=' . PA::$page_uid . '&action=EditRelation', 'extra' => ' onclick ="return delete_confirmation_msg(\'' . __('Are you sure you want to delete this Relationship?') . '\') "'));
                 $relation_does_not_exists_links = array('send_message' => array('caption' => __('Send a message'), 'url' => $this->base_url . PA_ROUTE_ADDMESSAGE . '/uid=' . PA::$page_uid), 'make_connection' => array('caption' => sprintf(__('Add as %s'), __($def_relations_term)), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/uid=' . PA::$page_uid . '&do=add&action=EditRelation'));
                 if (PA::$page_uid == PA::$login_uid) {
                     //login and get uid same means user's public page
                     $level_2['highlight'] = 'user';
                     $level_3 = $this->get_level_3('user');
                 } else {
                     // make left and right links
                     //user's public page requires different link rendering
                     if (!empty($relations_ids)) {
                         if (in_array(PA::$page_uid, $relations_ids)) {
                             $left_user_public_links = $relation_already_exists_links;
                         } else {
                             $left_user_public_links = $relation_does_not_exists_links;
                         }
                     } else {
                         $left_user_public_links = $relation_does_not_exists_links;
                     }
                 }
             } else {
                 //means user's private page
                 $level_2['highlight'] = 'user';
                 $level_3 = $this->get_level_3('user');
                 $level_3['highlight'] = 'user_private';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_PEOPLES:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'find_people';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_FAMILY:
         case PAGE_FAMILY_EDIT:
             $level_3 = $this->get_level_3('family');
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_VIEW_ALL_MEMBERS:
             if (@$_GET['gid']) {
                 $level_2['highlight'] = 'groups';
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'group_members';
             } else {
                 $level_2['highlight'] = 'people';
                 if (PA::$page_uid == PA::$login_uid) {
                     $level_3 = $this->get_level_3('people');
                     if (!empty($_GET['view_type']) && $_GET['view_type'] == 'relations') {
                         $level_3['highlight'] = 'my_friends';
                     } else {
                         if (!empty($_GET['view_type']) && $_GET['view_type'] == 'in_relations') {
                             $level_3['highlight'] = 'people_who_call_me_friend';
                         } else {
                             $level_3['highlight'] = 'find_people';
                         }
                     }
                 }
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_INVITATION:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'invite';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_UPLOAD_MEDIA:
         case PAGE_MEDIA_GALLERY:
             if (PA::$login_uid) {
                 if (isset($_GET['view']) && 'groups_media' == $_GET['view']) {
                     //user is viewing group gallery
                     $level_2['highlight'] = 'groups';
                     $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                     $level_3['highlight'] = 'group_gallery';
                 } else {
                     if (isset($_GET['view']) && 'friends' == $_GET['view']) {
                         //user is viewing his friends gallery
                         $level_2['highlight'] = 'people';
                         $level_3 = $this->get_level_3('people');
                         $level_3['highlight'] = 'friends_gallery';
                     } else {
                         if (PA::$page_uid != PA::$login_uid && PA::$page_uid != '') {
                             //user is viewing his private page gallery
                             $level_2['highlight'] = 'people';
                         } else {
                             if (PA::$page_uid == PA::$login_uid || !PA::$page_uid) {
                                 $level_2['highlight'] = 'user';
                                 $level_3 = $this->get_level_3('user');
                                 $level_3['highlight'] = 'my_gallery';
                             }
                         }
                     }
                 }
             } else {
                 if (!empty(PA::$page_uid)) {
                     // for anonymous user
                     $level_2['highlight'] = 'people';
                 }
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_USER_CUSTOMIZE_UI:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'customize_ui';
             break;
         case FILE_USER_CALENDAR:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'my_events';
             break;
         case PAGE_EDIT_PROFILE:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'settings';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_EDIT_RELATIONS:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'find_people';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_GROUPS_HOME:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             $level_3['highlight'] = 'find_groups';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUPS_CATEGORY:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             $level_3['highlight'] = 'find_groups';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_ADDGROUP:
             $level_2['highlight'] = 'groups';
             if (!empty($_GET['gid'])) {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'edit_group';
             } else {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                 $level_3['highlight'] = 'create_group';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_GROUP:
         case PAGE_GROUP_AD_CENTER:
         case FILE_GROUP_MEDIA_GALLERY:
         case FILE_GROUP_CALENDAR:
         case FILE_GROUP_INVITATION:
         case PAGE_GROUP_THEME:
         case PAGE_GROUP_MODERATION:
         case FILE_MANAGE_GROUP_CONTENTS:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             break;
         case FILE_ADDGROUP:
             $level_2['highlight'] = 'group';
             if ($_GET['gid']) {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'edit_group';
             } else {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                 $level_3['highlight'] = 'create_group';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_WIDGET:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'user_widgets';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case PAGE_MESSAGE:
         case PAGE_ADDMESSAGE:
         case PAGE_VIEW_MESSAGE:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'messages';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_POST_CONTENT:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'create_post';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_CONTENT_MANAGEMENT:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'manage_posts';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_NETWORKS_HOME:
         case FILE_NETWORKS_CATEGORY:
             $level_1['highlight'] = 'networks_directory';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_NETWORK_USER_DEFAULTS:
         case FILE_RELATIONSHIP_SETTINGS:
         case FILE_EMAIL_NOTIFICATION:
         case FILE_MANAGE_TAKETOUR:
         case FILE_MANAGE_EMBLEM:
         case FILE_CONFIGURE_SPLASH_PAGE:
         case FILE_NETWORK_FEATURE:
         case FILE_NETWORK_CUSTOMIZE_UI_PAGE:
         case FILE_NETWORK_STATS:
         case FILE_NETWORK_LINKS:
         case FILE_NEW_USER_BY_ADMIN:
         case FILE_NETWORK_MANAGE_CONTENT:
         case FILE_MODULE_SELECTOR:
         case FILE_NETWORK_BULLETINS:
         case FILE_NETWORK_MANAGE_USER:
         case FILE_NETWORK_CALENDAR:
         case FILE_MANAGE_AD_CENTER:
         case FILE_MANAGE_GROUP_FORUM:
         case FILE_MANAGE_COMMENTS:
         case FILE_RANKING:
         case FILE_MISREPORTS:
         case PAGE_ROLE_MANAGE:
         case FILE_ASSIGN_TASK:
             $level_2 = $this->get_level_3('network');
             $level_1['highlight'] = 'configure_network';
             $level_2['highlight'] = 'configure_network';
             break;
         case FILE_CREATENETWORK:
             $level_1['highlight'] = 'create_network';
             $level_3['highlight'] = 'statistics';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_SHOWCONTENT:
             // remark by Zoran Hron: this never will be executed because
             // constants FILE_SEARCH_HOME and FILE_SHOWCONTENT points to the same value !!!
             if (!empty($_GET['gid'])) {
                 $level_2['highlight'] = 'groups';
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_LINKS_MANAGEMENT:
             $level_2['highlight'] = 'user';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_MEDIA_FULL_VIEW:
             if (!empty($_GET['gid'])) {
                 $level_2['highlight'] = 'groups';
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             } else {
                 $level_2['highlight'] = 'user';
                 $level_3 = $this->get_level_3('user');
             }
             break;
         case FILE_REGISTER:
             $level_2['highlight'] = 'home';
             break;
         case FILE_EDIT_MEDIA:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'my_gallery';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_EDITNETWORK:
         case PAGE_PERMALINK:
             if ($is_group_content == TRUE) {
                 if ($this->get_uid()) {
                     $is_group_content = FALSE;
                     $level_2['highlight'] = 'groups';
                     $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                     $level_3['highlight'] = 'group_home';
                 } else {
                     $is_group_content = FALSE;
                     $level_2['highlight'] = 'groups';
                     $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                     $level_3['highlight'] = 'group_home';
                 }
             } elseif (!empty($_GET['cid'])) {
                 try {
                     $content_data = Content::load_content($_GET['cid'], $this->get_uid());
                     if ($content_data->parent_collection_id != -1 && $content_data->parent_collection_id != 0) {
                         $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
                         if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
                             $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                         }
                     } else {
                         $level_3 = $this->get_level_3('user');
                     }
                 } catch (PAException $e) {
                 }
             }
             break;
         default:
             break;
     }
     //--end of switch
     /* moved this code outside of the switch statement...
     			we wabt this to run in any case, so that xml files can override default navigation!
     			-Martin
     		*/
     if (isset($dynamic_page) && !empty($dynamic_page->navigation_code)) {
         if (false == eval($dynamic_page->navigation_code . "return true;")) {
             echo "<b>Evaluation of navigation links code for page ID={$dynamic_page->page_name} failed" . "Please check your dynamic page configuration file. Page ID: {$dynamic_page->page_id}";
         }
     }
     /* ------- */
     $menu = array('level_1' => $level_1, 'level_2' => $level_2, 'level_3' => $level_3, 'left_user_public_links' => $left_user_public_links);
     //    echo '<pre>'.print_r($menu,1).'</pre>';
     return $menu;
 }
Пример #8
0
<?php

$login_required = TRUE;
include "includes/page.php";
require "{$path_prefix}/ext/Album/Album.php";
require "{$path_prefix}/ext/Image/Image.php";
require "{$path_prefix}/ext/Audio/Audio.php";
require "{$path_prefix}/ext/Video/Video.php";
require_once "{$path_prefix}/api/Activities/Activities.php";
$location = $base_url . '/manage_user.php';
$permission = FALSE;
if (Network::is_admin($network_info->network_id, $_SESSION['user']['id'])) {
    $permission = TRUE;
}
if (!empty($_GET['msg']) && $_GET['msg'] == 'own_delete') {
    $permission = TRUE;
    $user_id = $_SESSION['user']['id'];
    $location = $base_url . '/homepage.php';
} else {
    if (!($user_id = $_GET['uid'])) {
        $location .= '?msg=7005';
    }
}
if ($user_id && $permission) {
    $message_array = array();
    if ($network_info->type == MOTHER_NETWORK_TYPE) {
        //user delete for SU
        //deleting user data from mothership
        try {
            User::delete_user($user_id);
            Activities::delete_for_user($user_id);
 private function can_manage_forum($params, $type)
 {
     $board_type = $params['board']->get_type();
     if ($board_type == 'group' && !empty($params['gid'])) {
         // it is a group forum
         $user_type = Group::get_user_type($params['user_id'], $params['gid']);
         if ($user_type == MODERATOR || $user_type == OWNER) {
             return true;
         }
         $group_permiss = @$this->user_permissions['groups'][$params['gid']];
         if (!empty($group_permiss)) {
             if (in_array('manage_content', $group_permiss)) {
                 return true;
             }
         }
     }
     if ($board_type == 'network') {
         $is_net_admin = Network::is_admin($params['board']->get_network_id(), $params['user_id']);
         if ($is_net_admin) {
             return true;
         }
         $net_permiss = @$this->user_permissions['network'];
         if (!empty($net_permiss)) {
             if (in_array('manage_content', $net_permiss)) {
                 return true;
             }
         }
     }
     if ($board_type == 'user') {
         if ($params['user_id'] == $params['board']->get_owner_id()) {
             return true;
         }
     }
     return false;
 }
Пример #10
0
 /**
   Purpose : this function is used to get navigation links for the whole page.
   Scope : public
   @param - it needs no direct input. But works only on the basis of current page initialized in __construct()
   @return - array of links
   **/
 public function get_links($optional = NULL)
 {
     //initialization
     global $page_uid, $login_uid;
     if (isset($_SESSION['user']['id'])) {
         $extra = unserialize($this->network_info->extra);
         if (@$extra['reciprocated_relationship'] == NET_YES) {
             $status = APPROVED;
         } else {
             $status = FALSE;
         }
         $relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status);
         $user_groups = Group::get_user_groups((int) $_SESSION['user']['id']);
         /* $gid isn't defined in this function, so the following call
          * will probably always return FALSE.  To get rid of the warning
          * under E_ALL, I've replaced the following expression with
          * FALSE.  Maybe $gid should be get_group_id()? */
         $is_owner_of_group = FALSE;
         //Group::is_admin($gid,(int)$_SESSION['user']['id']) ;
     }
     if (isset($relations_ids) && sizeof($relations_ids)) {
         $this->set_friend_uid($relations_ids[0]);
     }
     if (isset($user_groups) && sizeof($user_groups)) {
         $this->users_first_group_id($user_groups[0]['gid']);
     }
     if ($login_uid) {
         $this->set_uid($login_uid);
     } else {
         $this->set_anonymous();
     }
     $is_group_content = FALSE;
     if (@$_GET['gid']) {
         $this->set_group_id($_GET['gid']);
     } else {
         if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid'])) {
             $this->set_group_id($_REQUEST['ccid']);
             $is_group_content = TRUE;
         } else {
             if (FILE_CONTENT == $this->current_page && !empty($_GET['cid'])) {
                 try {
                     $content_data = Content::load_content($_GET['cid'], $this->get_uid());
                 } catch (PAException $e) {
                     if ($e->getCode() != CONTENT_NOT_FOUND) {
                         throw $e;
                     }
                 }
                 if (isset($content_data)) {
                     if ($content_data->parent_collection_id > 0) {
                         $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
                         if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
                             $this->set_group_id($content_data->parent_collection_id);
                             $is_group_content = TRUE;
                         }
                     }
                 }
             }
         }
     }
     //test
     //$this->current_page='test.php';
     // make links for current page
     $this->make_links();
     $level_1 = $this->get_level_1();
     $level_2 = $this->get_level_2();
     $level_3 = NULL;
     $left_user_public_links = NULL;
     if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) {
         $level_3 = $this->get_level_3('network');
     } else {
         if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) {
             $level_3 = $this->get_level_3('network');
         }
     }
     $level_3 = NULL;
     switch ($this->current_page) {
         /*----------------------------------------------------*/
         case FILE_HOMEPAGE:
             $level_3 = NULL;
             $level_2['highlight'] = 'home';
             break;
         case FILE_LOGIN:
             $level_2['highlight'] = 'home';
             break;
         case FILE_SEARCH_HOME:
             $level_2['highlight'] = 'search';
             break;
         case FILE_TAG_SEARCH:
             $level_2['highlight'] = 'tag_search';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_USER:
         case FILE_USER_BLOG:
             if (!$page_uid && !$login_uid) {
                 throw new PAException("", "Invalid page access");
             }
             if ($page_uid) {
                 //uid get variable set
                 //these links are to be added in front
                 $relation_already_exists_links = array('send_message' => array('caption' => 'Send a message', 'url' => $this->base_url . '/' . FILE_ADDMESSAGE . '?uid=' . $page_uid), 'change_relationship' => array('caption' => 'Change Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?uid=' . $page_uid . '&amp;action=change'), 'delete_relationship' => array('caption' => 'Delete Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?action=delete&amp;uid=' . $page_uid . '', 'extra' => ' onclick ="return delete_confirmation_msg(\'Are you sure you want to delete this Relationship?\') "'), 'send_testimonial' => array('caption' => 'Write Testimonial', 'url' => $this->base_url . '/' . FILE_WRITE_TESTIMONIAL . '?uid=' . $page_uid), 'user_comment' => array('caption' => 'Write Comment', 'url' => $this->base_url . '/' . FILE_WRITE_USER_COMMENT . '?uid=' . $page_uid));
                 $relation_does_not_exists_links = array('send_message' => array('caption' => 'Send a message', 'url' => $this->base_url . '/' . FILE_ADDMESSAGE . '?uid=' . $page_uid), 'make_connection' => array('caption' => 'Add a Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?uid=' . $page_uid . '&amp;action=add'), 'send_testimonial' => array('caption' => 'Write Testimonial', 'url' => $this->base_url . '/' . FILE_WRITE_TESTIMONIAL . '?uid=' . $page_uid), 'user_comment' => array('caption' => 'Write Comment', 'url' => $this->base_url . '/' . FILE_WRITE_USER_COMMENT . '?uid=' . $page_uid));
                 if ($page_uid == $login_uid) {
                     //login and get uid same means user's public page
                     $level_2['highlight'] = 'user';
                     $level_3 = $this->get_level_3('user');
                 } else {
                     // make left and right links
                     //user's public page requires different link rendering
                     if (!empty($relations_ids)) {
                         if (in_array($page_uid, $relations_ids)) {
                             $left_user_public_links = $relation_already_exists_links;
                         } else {
                             $left_user_public_links = $relation_does_not_exists_links;
                         }
                     } else {
                         $left_user_public_links = $relation_does_not_exists_links;
                     }
                 }
             } else {
                 //means user's private page
                 $level_2['highlight'] = 'user';
                 $level_3 = $this->get_level_3('user');
                 $level_3['highlight'] = 'user_private';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_PEOPLES:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'find_people';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_VIEW_ALL_MEMBERS:
             if (@$_GET['gid']) {
                 $level_2['highlight'] = 'groups';
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'group_members';
             } else {
                 $level_2['highlight'] = 'people';
                 if ($page_uid == $login_uid) {
                     $level_3 = $this->get_level_3('people');
                     if (!empty($_GET['view_type']) && $_GET['view_type'] == 'relations') {
                         $level_3['highlight'] = 'my_friends';
                     } else {
                         if (!empty($_GET['view_type']) && $_GET['view_type'] == 'in_relations') {
                             $level_3['highlight'] = 'people_who_call_me_friend';
                         } else {
                             $level_3['highlight'] = 'find_people';
                         }
                     }
                 }
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_INVITATION:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'invite';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_UPLOAD_MEDIA:
         case FILE_MEDIA_GALLERY:
             if ($login_uid) {
                 if (isset($_GET['view']) && 'friends' == $_GET['view']) {
                     //user is viewing his friends gallery
                     $level_2['highlight'] = 'people';
                     $level_3 = $this->get_level_3('people');
                     $level_3['highlight'] = 'friends_gallery';
                 } else {
                     if ($page_uid != $login_uid && $page_uid != '') {
                         //user is viewing his private page gallery
                         $level_2['highlight'] = 'people';
                     } else {
                         if ($page_uid == $login_uid || !$page_uid) {
                             $level_2['highlight'] = 'user';
                             $level_3 = $this->get_level_3('user');
                             $level_3['highlight'] = 'my_gallery';
                         }
                     }
                 }
             } else {
                 if (!empty($page_uid)) {
                     // for anonymous user
                     $level_2['highlight'] = 'people';
                 }
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_CUSTOMIZE_UI:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'customize_ui';
             break;
         case FILE_USER_CALENDAR:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'my_events';
             break;
         case FILE_EDIT_PROFILE:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'settings';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_EDIT_RELATIONS:
             $level_2['highlight'] = 'people';
             $level_3 = $this->get_level_3('people');
             $level_3['highlight'] = 'find_people';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUPS_HOME:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             $level_3['highlight'] = 'find_groups';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUPS_CATEGORY:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             $level_3['highlight'] = 'find_groups';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_ADDGROUP:
             $level_2['highlight'] = 'groups';
             if (!empty($_GET['gid'])) {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'edit_group';
             } else {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                 $level_3['highlight'] = 'create_group';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUP:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'group_home';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_FORUM_MESSAGES:
         case FILE_FORUM_HOME:
         case FILE_CREATE_FORUM:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'group_forum';
             break;
         case FILE_GROUP_CALENDAR:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'group_events';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUP_INVITATION:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             $level_3['highlight'] = 'invite';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUP_MEDIA_GALLERY:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'group_gallery';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_EDIT_FORUM:
         case FILE_FORUM_MESSAGES:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_WIDGET:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'user_widgets';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_MYMESSAGE:
         case FILE_ADDMESSAGE:
         case FILE_VIEW_MESSAGE:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'messages';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_POST_CONTENT:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'create_post';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_CONTENT_MANAGEMENT:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'manage_posts';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_ADDGROUP:
             $level_2['highlight'] = 'group';
             if ($_GET['gid']) {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                 $level_3['highlight'] = 'edit_group';
             } else {
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                 $level_3['highlight'] = 'create_group';
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_GROUP_MODERATION:
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             if ('members' == $_GET['view']) {
                 $level_3['highlight'] = 'moderate_users';
             }
             if ('content' == $_GET['view']) {
                 $level_3['highlight'] = 'moderate_posts';
             }
             if ('users' == $_GET['view']) {
                 $level_3['highlight'] = 'moderate_membership_requests';
             }
             break;
         case FILE_MANAGE_GROUP_CONTENTS:
             $level_1['highlight'] = 'networks_directory';
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'manage_group_content';
             break;
         case FILE_CUSTOMIZE_GROUP:
             $level_1['highlight'] = 'networks_directory';
             $level_2['highlight'] = 'groups';
             $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             $level_3['highlight'] = 'group_customize_ui';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_NETWORKS_HOME:
         case FILE_NETWORKS_CATEGORY:
             $level_1['highlight'] = 'networks_directory';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_NETWORK_USER_DEFAULTS:
         case FILE_RELATIONSHIP_SETTINGS:
         case FILE_EMAIL_NOTIFICATION:
         case FILE_MANAGE_TAKETOUR:
         case FILE_MANAGE_EMBLEM:
         case FILE_CONFIGURE_SPLASH_PAGE:
         case FILE_NETWORK_FEATURE:
         case FILE_NETWORK_CUSTOMIZE_UI_PAGE:
         case FILE_NETWORK_STATS:
         case FILE_NETWORK_LINKS:
         case FILE_NEW_USER_BY_ADMIN:
         case FILE_NETWORK_MANAGE_CONTENT:
         case FILE_MODULE_SELECTOR:
         case FILE_NETWORK_BULLETINS:
         case FILE_NETWORK_MANAGE_USER:
         case FILE_NETWORK_CALENDAR:
         case FILE_MANAGE_AD_CENTER:
         case FILE_MANAGE_GROUP_FORUM:
         case FILE_MANAGE_COMMENTS:
         case FILE_RANKING:
         case FILE_MISREPORTS:
         case FILE_ROLES:
         case FILE_ASSIGN_TASK:
             $level_2 = $this->get_level_3('network');
             //         $level_3 = $this->get_level_3('manage_network');
             $level_1['highlight'] = 'configure_network';
             $level_2['highlight'] = 'configure_network';
             /*       $level_3['highlight'] = 'manage_user'*/
             break;
         case FILE_CREATENETWORK:
             $level_1['highlight'] = 'create_network';
             $level_3['highlight'] = 'statistics';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_SHOWCONTENT:
             if ($_GET['gid']) {
                 $level_2['highlight'] = groups;
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
             }
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_LINKS_MANAGEMENT:
             $level_2['highlight'] = 'user';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_MEDIA_FULL_VIEW:
             if (!empty($_GET['gid'])) {
                 $level_2['highlight'] = groups;
                 $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
             } else {
                 $level_2['highlight'] = 'user';
                 $level_3 = $this->get_level_3('user');
             }
             break;
         case FILE_REGISTER:
             $level_2['highlight'] = 'home';
             break;
         case FILE_EDIT_MEDIA:
             $level_2['highlight'] = 'user';
             $level_3 = $this->get_level_3('user');
             $level_3['highlight'] = 'my_gallery';
             break;
             /*----------------------------------------------------*/
         /*----------------------------------------------------*/
         case FILE_EDITNETWORK:
         case FILE_CONTENT:
             if ($is_group_content == TRUE) {
                 if ($this->get_uid()) {
                     $is_group_content = FALSE;
                     $level_2['highlight'] = 'groups';
                     $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                     $level_3['highlight'] = 'group_home';
                 } else {
                     $is_group_content = FALSE;
                     $level_2['highlight'] = 'groups';
                     $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general'));
                     $level_3['highlight'] = 'group_home';
                 }
             } elseif (!empty($_GET['cid'])) {
                 try {
                     $content_data = Content::load_content($_GET['cid'], $this->get_uid());
                     if ($content_data->parent_collection_id != -1 && $content_data->parent_collection_id != 0) {
                         $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid());
                         if ($content_collection_data->type == GROUP_COLLECTION_TYPE) {
                             $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific'));
                         }
                     } else {
                         $level_3 = $this->get_level_3('user');
                     }
                 } catch (PAException $e) {
                 }
             }
             break;
             /*----------------------------------------------------*/
     }
     //--end of switch
     $menu = array('level_1' => $level_1, 'level_2' => $level_2, 'level_3' => $level_3, 'left_user_public_links' => $left_user_public_links);
     return $menu;
 }
Пример #11
0
/**
* function used to check permissions for user to do an activity
* @param $params is array of parameters like $params['action'], $param['uid']..
*/
function user_can($params)
{
    global $network_info, $login_uid;
    $action = $params['action'];
    switch ($action) {
        case 'edit_content':
        case 'delete_content':
            if ($params['uid'] && $params['cid']) {
                //super admin can edit/ delete any content
                if ($params['uid'] == SUPER_USER_ID) {
                    return true;
                }
                // network owner can edit / delete any content in a network
                if (Network::is_admin($network_info->network_id, $params['uid'])) {
                    return true;
                }
                //Loading content
                $content_obj = Content::load_content((int) $params['cid'], $params['uid']);
                //author of the content can perform the action
                if ($content_obj->author_id == $params['uid']) {
                    return true;
                }
                if ($content_obj->parent_collection_id != -1) {
                    // content is a part of some collection
                    // Loading collection
                    $collection_obj = ContentCollection::load_collection((int) $content_obj->parent_collection_id, $params['uid']);
                    // owner of collection can also edit the content
                    if ($collection_obj->author_id == $params['uid']) {
                        return true;
                    }
                }
            }
            break;
        case 'delete_comment':
            //network owner can delete any comment
            $comment = $params['comment_info'];
            //array having the comment details
            if ($login_uid == SUPER_USER_ID) {
                //Super user can delete any comment
                return true;
            } else {
                if ($network_info->owner_id == $login_uid) {
                    //Network owner can delete the comment
                    return true;
                } else {
                    if ($comment['user_id'] == $login_uid) {
                        //Author of comment can delete the comment
                        return true;
                    } else {
                        if ($comment['recipient_id'] == $login_uid) {
                            return true;
                        }
                    }
                }
            }
            $content = Content::load_content((int) $comment['content_id'], $login_uid);
            if ($content->author_id == $login_uid) {
                //Author of the content can delete the comment.
                return true;
            } else {
                if ($content->parent_collection_id != -1) {
                    // means content belongs to some collection
                    $collection = ContentCollection::load_collection($content->parent_collection_id, $login_id);
                    if ($collection->author_id == $login_uid) {
                        //If content on which comment has been posted belongs to some collection then author of that collection can delete the comment
                        return true;
                    }
                }
            }
            return false;
            // return false in all the other cases
            break;
        case 'edit_forum':
            $perm_array = array($network_info->owner_id, SUPER_USER_ID, $params['group_owner'], $params['forum_owner']);
            return in_array($login_uid, $perm_array);
            break;
        case 'delete_rep':
            // Delete the Replies of forum
            $perm_array = array($network_info->owner_id, SUPER_USER_ID, $params['group_owner'], $params['forum_owner'], $params['rep_owner']);
            return in_array($login_uid, $perm_array);
            break;
        case 'view_group_content':
            if ($params['allow_anonymous']) {
                return true;
            }
            $perm_array = array($network_info->owner_id, SUPER_USER_ID, $params['group_owner']);
            $member_type = array(MEMBER, MODERATOR, OWNER);
            if (in_array($login_uid, $perm_array) || in_array($params['member_type'], $member_type)) {
                return true;
            }
            break;
        case 'view_abuse_report_form':
            if (empty($login_uid)) {
                return false;
            }
            $extra = unserialize($network_info->extra);
            $pram = $extra['notify_owner']['report_abuse_on_content']['value'];
            if (isset($pram) && $pram > 0) {
                return true;
            }
            return false;
            break;
        case 'delete_comment_authorization':
            $perm_array = array($network_info->owner_id, SUPER_USER_ID, $params['group_owner'], $params['content_owner'], $params['comment_owner']);
            return in_array($login_uid, $perm_array);
            break;
    }
    return false;
}