/**
  * Get the relationship between Session[member_id] and the given id.
  * Relationship can be friends, friends of friends, network, family, aquaintance, etc.
  * TODO: Confirm that the order of checks is not important.  Draw a control flow diagram to check this.
  *		 For now, Friends of friends > Groups
  * @param	int		the member that we want to find the relationship to the session[member]
  * @return	relationship status
  */
 function getRelationship($id)
 {
     //if id = self, always true (cause i should be able to see my own profile)
     if (isset($_SESSION['member_id'])) {
         if ($id == $_SESSION['member_id']) {
             return AT_SOCIAL_OWNER_VISIBILITY;
         }
         //is friend of friend?
         if (isFriendOfFriend($id, $_SESSION['member_id']) == true) {
             return AT_SOCIAL_FRIENDS_OF_FRIENDS_VISIBILITY;
         }
         //is in some of the groups together?
         $social_groups = new SocialGroups();
         $my_group = $social_groups->getMemberGroups($_SESSION['member_id']);
         $person_group = $social_groups->getMemberGroups($id);
         $groups_intersection = array_intersect($my_group, $person_group);
         //groups intersection
         //If it is not empty or not null, then these 2 people share a group
         if (!empty($groups_intersection) > 0) {
             return AT_SOCIAL_GROUPS_VISIBILITY;
         }
         $sql = "SELECT relationship FROM %ssocial_friends WHERE (member_id=%d AND friend_id=%d) OR (member_id=%d AND friend_id=%d)";
         $relationship = queryDB($sql, array(TABLE_PREFIX, $id, $_SESSION['member_id'], $_SESSION['member_id'], $id));
     }
     // NOT SURE IF THIS IS WORKING WITH QUERYDB
     //		if (isset($result)){
     //			list($relationship) = mysql_fetch_row($result);
     //		}
     //If the relationship is not set, this implies that it's not in the table,
     //implying that the user has never set its privacy settings, meaning a default is needed
     if (!isset($relationship)) {
         return AT_SOCIAL_NETWORK_VISIBILITY;
     }
     return $relationship;
 }
Beispiel #2
0
}

//paginator settings
$page = intval($_GET['p']);
if (!$page) {
	$page = 1;
}	
$count  = (($page-1) * SOCIAL_GROUP_MAX) + 1;
$offset = ($page-1) * SOCIAL_GROUP_MAX;

// Get activities	
$act_obj = new Activity();
$activities = $act_obj->getActivities($id);

// Get social group class
$social_group = new SocialGroups();
$my_groups = $social_group->getMemberGroups($_SESSION['member_id']);	//to get the size
$num_pages = sizeof($my_groups)/SOCIAL_GROUP_MAX;
$my_groups = $social_group->getMemberGroups($_SESSION['member_id'], $offset);

//Display
include(AT_INCLUDE_PATH.'header.inc.php');
$savant->display('social/pubmenu.tmpl.php');

if($num_pages > 1){
?>
<div class="pageinator_box">
<?php
print_paginator($page, $num_pages, '', 1); 
?>
</div>
Beispiel #3
0
/* as published by the Free Software Foundation.				*/
/****************************************************************/
// $Id$
$_user_location	= 'public';

define('AT_INCLUDE_PATH', '../../../../include/');
require(AT_INCLUDE_PATH.'vitals.inc.php');
require(AT_SOCIAL_INCLUDE.'constants.inc.php');
require(AT_SOCIAL_INCLUDE.'friends.inc.php');
require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroup.class.php');
require(AT_SOCIAL_INCLUDE.'classes/SocialGroups/SocialGroups.class.php');
$_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css'; // use a custom stylesheet


// Get social group class
$social_groups = new SocialGroups();

// Get this group
$id = intval($_REQUEST['id']);  //make sure $_GET and $_POST don't overlap the use of 'id'
$group = new SocialGroup($id);

//validate if this user is the administrator of the group
if ($group->getUser() != $_SESSION['member_id']){
	$msg->addError('CANT_EDIT_GROUP');
	header('Location: index.php');
	exit;
}

//TODO
//validate the group_admin is indeed a group member
Beispiel #4
0
" border="0" /></a>
				</div>
			</div>
		<?php 
    }
    ?>
		</div>
	</div>
	<?php 
}
?>
	<!-- groups --><br /><br /><br />
	<div class="my-network-groups"><br />
	<?php 
//if my groups array is not empty.
$social_group = new SocialGroups();
$my_groups = $social_group->getMemberGroups($_SESSION['member_id']);
$random_groups = array();
for ($i = 0; sizeof($random_groups) < SOCIAL_GROUP_HOMEPAGE_MAX && $i < sizeof($my_groups); $i++) {
    $grp = $my_groups[rand(0, sizeof($my_groups) - 1)];
    if (in_array($grp, $random_groups)) {
        continue;
    } else {
        $random_groups[] = $grp;
    }
}
//assign
$savant->assign('my_groups', $random_groups);
$savant->assign('randomize_groups', true);
$savant->display('social/tiny_sgroups.tmpl.php');
?>
Beispiel #5
0
/* This program is free software. You can redistribute it and/or*/
/* modify it under the terms of the GNU General Public License  */
/* as published by the Free Software Foundation.				*/
/****************************************************************/
// $Id$
$_user_location = 'public';
define('AT_INCLUDE_PATH', '../../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require AT_SOCIAL_INCLUDE . 'constants.inc.php';
require AT_SOCIAL_INCLUDE . 'friends.inc.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroup.class.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroups.class.php';
$_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css';
// use a custom stylesheet
// Get social group class
$social_groups = new SocialGroups();
//validate if this script is being run by the group admin
//validate the group_admin is indeed a group member
//TODO
if (isset($_POST['create'])) {
    //handles group logo
    if ($_FILES['logo']['name'] != '') {
        $gd_info = gd_info();
        $supported_images = array();
        if ($gd_info['GIF Create Support']) {
            $supported_images[] = 'gif';
        }
        if ($gd_info['JPG Support'] || $gd_info['JPEG Support']) {
            $supported_images[] = 'jpg';
        }
        if ($gd_info['PNG Support']) {
Beispiel #6
0
require AT_INCLUDE_PATH . 'vitals.inc.php';
require AT_SOCIAL_INCLUDE . 'constants.inc.php';
require AT_SOCIAL_INCLUDE . 'friends.inc.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroup.class.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroups.class.php';
$_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css';
// use a custom stylesheet
if (!$_SESSION['valid_user']) {
    require AT_INCLUDE_PATH . 'header.inc.php';
    $info = array('INVALID_USER', $_SESSION['course_id']);
    $msg->printInfos($info);
    require AT_INCLUDE_PATH . 'footer.inc.php';
    exit;
}
//social groups init
$social_groups = new SocialGroups();
$rand_key = $addslashes($_REQUEST['rand_key']);
//should we excape?
//if $_GET['q'] is set, handle Ajax.
if (isset($_GET['q'])) {
    $query = $addslashes($_GET['q']);
    $search_result = $social_groups->search($query);
    if (!empty($search_result)) {
        echo '<div style="border:1px solid #a50707; margin-left:50px; width:45%;">Suggestion:<br/>';
        $counter = 0;
        foreach ($search_result as $group_id => $group_array) {
            //display 10 suggestions
            if ($counter > 10) {
                break;
            }
            $group_obj = $group_array['obj'];
Beispiel #7
0
/****************************************************************/
// $Id$
$_user_location = 'public';
define('AT_INCLUDE_PATH', '../../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require AT_SOCIAL_INCLUDE . 'constants.inc.php';
require AT_SOCIAL_INCLUDE . 'friends.inc.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroup.class.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroups.class.php';
// Get social group class
$social_groups = new SocialGroups();
// Get this group
$id = intval($_REQUEST['id']);
//make sure $_GET and $_POST don't overlap the use of 'id'
$sg = new SocialGroup($id);
$sgs = new SocialGroups();
//validate if this user is the administrator of the group
if ($sg->getUser() != $_SESSION['member_id']) {
    $msg->addError('CANT_DELETE_GROUP');
    header('Location: index.php');
    exit;
}
//delete group
$msg->addFeedback('GROUP_DELETED');
$sgs->removeGroup($id);
header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/index.php', AT_PRETTY_URL_HEADER));
exit;
//Display
/*
include(AT_INCLUDE_PATH.'header.inc.php');
$savant->assign('group_obj', $group);