private function can_view_content($params, $type) { global $app; if (PAGE_USER_PUBLIC == $app->getRequestParam('page_id') && PA::$page_user->has_role_id(CHILD_MEMBER_ROLE)) { if (!empty(PA::$login_user)) { if (PA::$login_uid == PA::$page_uid) { return true; // page owner always should be able to view its own public page } $user_dob = PA::$page_user->get_profile_field(GENERAL, 'dob_year'); $own_age = date('Y') - $user_dob; if ($own_age < CHILD_LOWER_AGES) { // page owner is a child below the age $is_in_family = FamilyTypedGroupEntity::in_same_family(PA::$login_uid, PA::$page_uid); if (count($is_in_family) > 0) { // so, check whether the visitor is a member of family return true; } else { return false; } } else { return true; // the child is over age - allow visitors to view page } } else { return false; // anonymous users should not be able to see a Child page } } else { $user_permiss = $this->get_available_permiss_by_type($params, 'user'); if (in_array('view_content', $user_permiss)) { return true; } $group_permiss = $this->get_available_permiss_by_type($params, 'groups'); if (in_array('view_content', $group_permiss)) { return true; } $network_permiss = $this->get_available_permiss_by_type($params, 'network'); if (in_array('view_content', $network_permiss)) { return true; } } return false; }
* @author Cyberspace Networks <*****@*****.**> * @license GNU General Public License * @copyright Copyright (c) 2000-2014 Cyberspace Networks * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * The lastest version of Cyberspace Networks CoreSystem can be obtained from: * http://developer.cyberspace-networks.com/ * For questions, help, comments, discussion, etc. please visit * https://github.com/CyberspaceNetworks/CoreSystem * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ if (!empty($families[0])) { if (0) { // Testcode for on_same_family if (PA::$login_uid != PA::$page_uid) { require_once "api/CNEntity/CNFamilyTypedGroupEntity.php"; echo "<pre>" . print_r(FamilyTypedGroupEntity::in_same_family(PA::$login_uid, PA::$page_uid), 1) . "</pre>"; } } // end test code ?> <div class="module_icon_list"> <ul class="members"> <?php foreach ($families as $family) { ?> <li> <a href="<?php echo PA::$url . PA_ROUTE_FAMILY . "/gid=" . $family['id']; ?> "> <?php