Esempio n. 1
0
 /**
  *
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function onRegisterBeforeSave(&$post, SocialGroup $group)
 {
     // We need to know if the news app is published
     if (!$this->appEnabled()) {
         return;
     }
     // Get the posted value
     $value = isset($post[$this->inputName]) ? $post[$this->inputName] : $this->params->get('default', true);
     $value = (bool) $value;
     $registry = $group->getParams();
     $registry->set('news', $value);
     $group->params = $registry->toString();
 }
 /**
  * Removing a group, invovles removing everything related to this group.
  * @param	int		the group id
  */
 function removeGroup($id)
 {
     $social_group = new SocialGroup($id);
     //remove group activities
     $status = $social_group->removeGroupActivities();
     //remove group forums
     $status &= $social_group->removeGroupForums();
     //remove group members
     $status &= $social_group->removeGroupMembers();
     //remove group requests
     $status &= $social_group->removeGroupRequests();
     //remove group invitations
     $status &= $social_group->removeGroupInvitations();
     //remove message board
     $status &= $social_group->removeAllMessages();
     //remove group logo
     $status &= $social_group->removeGroupLogo();
     //remove groups
     $sql = 'DELETE FROM %ssocial_groups WHERE id=%d';
     $status &= queryDB($sql, array(TABLE_PREFIX, $id));
 }
Esempio n. 3
0
 /**
  * Removing a group, invovles removing everything related to this group.
  * @param	int		the group id
  */
 function removeGroup($id)
 {
     global $db;
     $social_group = new SocialGroup($id);
     //remove group activities
     $status = $social_group->removeGroupActivities();
     //remove group forums
     $status &= $social_group->removeGroupForums();
     //remove group members
     $status &= $social_group->removeGroupMembers();
     //remove group requests
     $status &= $social_group->removeGroupRequests();
     //remove group invitations
     $status &= $social_group->removeGroupInvitations();
     //remove message board
     $status &= $social_group->removeAllMessages();
     //remove group logo
     $status &= $social_group->removeGroupLogo();
     //remove groups
     $sql = 'DELETE FROM ' . TABLE_PREFIX . 'social_groups WHERE id=' . $id;
     $status &= mysql_query($sql, $db);
 }
Esempio n. 4
0
 /**
  * Notify site admins that a group is created and it is pending moderation.
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function notifyAdminsModeration(SocialGroup $group)
 {
     // Push arguments to template variables so users can use these arguments
     $params = array('title' => $group->getName(), 'creatorName' => $group->getCreator()->getName(), 'categoryTitle' => $group->getCategory()->get('title'), 'avatar' => $group->getAvatar(SOCIAL_AVATAR_LARGE), 'permalink' => JURI::root() . 'administrator/index.php?option=com_easysocial&view=groups&layout=pending', 'reject' => FRoute::controller('groups', array('external' => true, 'task' => 'rejectGroup', 'id' => $group->id, 'key' => $group->key)), 'approve' => FRoute::controller('groups', array('external' => true, 'task' => 'approveGroup', 'id' => $group->id, 'key' => $group->key)), 'alerts' => false);
     // Set the e-mail title
     $title = JText::sprintf('COM_EASYSOCIAL_EMAILS_GROUP_CREATED_MODERATOR_EMAIL_TITLE', $group->getName());
     // Get a list of super admins on the site.
     $usersModel = FD::model('Users');
     $admins = $usersModel->getSiteAdmins();
     foreach ($admins as $admin) {
         // Ensure that the user is a site admin or the Receive System email is turned off
         if (!$admin->isSiteAdmin() || !$admin->sendEmail) {
             continue;
         }
         // Immediately send out emails
         $mailer = FD::mailer();
         // Set the admin's name.
         $params['adminName'] = $admin->getName();
         // Get the email template.
         $mailTemplate = $mailer->getTemplate();
         // Set recipient
         $mailTemplate->setRecipient($admin->getName(), $admin->email);
         // Set title
         $mailTemplate->setTitle($title);
         // Set the template
         $mailTemplate->setTemplate('site/group/moderate', $params);
         // Set the priority. We need it to be sent out immediately since this is user registrations.
         $mailTemplate->setPriority(SOCIAL_MAILER_PRIORITY_IMMEDIATE);
         // Try to send out email to the admin now.
         $state = $mailer->create($mailTemplate);
     }
     return true;
 }
/* 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 . 'classes/SocialGroups/SocialGroup.class.php';
require AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroups.class.php';
require AT_SOCIAL_INCLUDE . 'friends.inc.php';
if (isset($_GET['invitation']) || isset($_GET['request'])) {
    $id = intval($_GET['id']);
    $sender_id = intval($_GET['sender_id']);
    $status = -1;
    $group_obj = new SocialGroup($id);
    if ($id > 0) {
        //handle invitations
        if ($_GET['invitation'] == 'accept') {
            $sql = "SELECT sender_id from %ssocial_groups_invitations WHERE  member_id = %d AND group_id = %d";
            $sender = queryDB($sql, array(TABLE_PREFIX, $_SESSION[member_id], $id));
            require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
            foreach ($sender as $sid) {
                $sql_notify = "SELECT first_name, last_name, email FROM %smembers WHERE member_id=%d";
                $row_notify = queryDB($sql_notify, array(TABLE_PREFIX, $sid), TRUE);
                if ($row_notify['email'] != '') {
                    $body = _AT('notification_group_invite_accepted', get_display_name($_SESSION['member_id']), $group_obj->getName(), $_base_href . AT_SOCIAL_BASENAME . 'index_mystart.php');
                    $sender = get_display_name($_SESSION['member_id']);
                    $mail = new ATutorMailer();
                    $mail->AddAddress($row_notify['email'], $sender);
                    $mail->FromName = $_config['site_name'];
Esempio n. 6
0
 private function prepareCreateStream(SocialStreamItem &$item, SocialGroup $group)
 {
     if (!$group->canViewItem()) {
         return;
     }
     $params = FD::registry($item->params);
     $data = $params->get('news');
     // Load the group
     $group = FD::group($data->cluster_id);
     $news = FD::table('GroupNews');
     $news->load($data->id);
     // Get the permalink
     $permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->getApp()->getAlias(), 'newsId' => $news->id), false);
     // Get the app params
     $appParams = $this->getApp()->getParams();
     // Format the content
     $this->format($news, $appParams->get('stream_length'));
     // Attach actions to the stream
     $this->attachActions($item, $news, $permalink, $appParams);
     $this->set('group', $group);
     $this->set('appParams', $appParams);
     $this->set('permalink', $permalink);
     $this->set('news', $news);
     $this->set('actor', $item->actor);
     // Load up the contents now.
     $item->title = parent::display('streams/create.title');
     $item->content = parent::display('streams/create.content');
 }
Esempio n. 7
0
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

function resize_image($src, $dest, $src_h, $src_w, $dest_h, $dest_w, $type) {
	$thumbnail_img = imagecreatetruecolor($dest_w, $dest_h);

	if ($type == 'gif') {
}
?>

<?php 
//Group requests
if (!empty($this->group_requests)) {
    ?>

<div class="headingbox"><h3><?php 
    echo _AT('new_group_requests');
    ?>
</h3></div>
<div class="contentbox">
<?php 
    foreach ($this->group_requests as $id => $senders) {
        $gobj = new SocialGroup($id);
        foreach ($senders as $index => $sender_id) {
            $name = printSocialName($sender_id);
            ?>
	<div class="box" style="border:thin solid black;">
		<div style="float:right;">
			<a href="<?php 
            echo AT_SOCIAL_BASENAME;
            ?>
groups/invitation_handler.php?request=accept<?php 
            echo SEP;
            ?>
id=<?php 
            echo $gobj->getID() . SEP;
            ?>
sender_id=<?php 
Esempio n. 9
0
 private function prepareCreateStream(SocialStreamItem &$item)
 {
     $groupId = $item->contextId;
     $params = FD::registry($item->params);
     $obj = $params->get('group');
     $group = new SocialGroup();
     $group->bind($obj);
     if (!$group) {
         return;
     }
     // We don't want to display groups that are invitation only.
     if ($group->type == SOCIAL_GROUPS_INVITE_TYPE) {
         return;
     }
     $actor = $item->actor;
     $this->set('group', $group);
     $this->set('actor', $actor);
     $item->title = parent::display('streams/create.title');
     $item->content = parent::display('streams/create.content');
     $item->opengraph->addDescription(JText::sprintf('APP_GROUP_GROUPS_STREAM_CREATED_GROUP', $actor->getName(), $group->getName()));
 }
Esempio n. 10
0
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/PrivacyControl/PrivacyObject.class.php');
//require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyController.class.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
$id = intval($_REQUEST['id']);
if ($id < 1) {
    exit;
}
// default display all group members
$grp_obj = new SocialGroup($id);
$grp_members = $grp_obj->getGroupMembers();
$rand_key = $addslashes($_POST['rand_key']);
//should we excape?
//if $_GET['q'] is set, handle Ajax.
if (isset($_GET['q'])) {
    $query = $addslashes($_GET['q']);
    $search_result = $grp_obj->searchMembers($query);
    if (!empty($search_result)) {
        echo '<div class="suggestions">' . _AT('suggestions') . ':<br/>';
        $counter = 0;
        foreach ($search_result as $member_id => $member_obj) {
            //display 10 suggestions
            if ($counter > 10) {
                break;
            }
Esempio n. 11
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';
//Get group
$gid = intval($_GET['id']);
$group_obj = new SocialGroup($gid);
/** If public 
 * allow anyone to join the group without approval
 */
if ($group_obj->getPrivacy() == 0) {
    /*public*/
    $result = $group_obj->addMember($_SESSION['member_id']);
    //adding "myself" into the group
    if ($result) {
        $msg->addFeedback('GROUP_JOINED');
    } else {
        $msg->addError('JOIN_REQUEST_FAILED');
    }
} else {
    /*private*/
    $result = $group_obj->addRequest();
Esempio n. 12
0
/* 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 group
$gid = intval($_REQUEST['id']);
$group_obj = new SocialGroup($gid);
//check if this group is valid
if (!$group_obj->isValid()) {
    $msg->addError('GROUP_HAS_BEEN_REMOVED');
    header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/index.php', AT_PRETTY_URL_HEADER));
    exit;
}
//remove group member
if (isset($_GET['remove']) && $_GET['remove'] == 1) {
    $group_obj->removeMember($_SESSION['member_id']);
    $msg->addFeedback('LEFT_GROUP_SUCCESSFULLY');
    header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/index.php', AT_PRETTY_URL_HEADER));
    exit;
}
//submit message
if (isset($_POST['submit'])) {
Esempio n. 13
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$
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';
include AT_SOCIAL_INCLUDE . 'classes/SocialGroups/SocialGroup.class.php';
//handles message deletion
$gid = intval($_REQUEST['gid']);
$mid = intval($_REQUEST['delete']);
// delete group's messages
if ($gid > 0 && $mid > 0) {
    $group = new SocialGroup($gid);
    if ($_POST['submit_yes']) {
        $result = $group->removeMessage($mid, $_SESSION['member_id']);
        if ($result) {
            $msg->addFeedback('MESSAGE_DELETE_SUCCESSFULLY');
        } else {
            $msg->addError('CANT_DELETE_MESSAGE');
        }
        header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $gid, AT_PRETTY_URL_HEADER));
        exit;
    } elseif ($_POST['submit_no']) {
        $msg->addFeedback('CANCELLED');
        header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $gid, AT_PRETTY_URL_HEADER));
        exit;
    }
    $hidden_vars['gid'] = $gid;
Esempio n. 14
0
	<div class="headingbox"><h3><a href="<?php 
echo url_rewrite(AT_SOCIAL_BASENAME . 'groups/index.php');
?>
"><?php 
echo _AT('my_groups');
?>
</a></h3></div>
	<div class="contentbox">
		<?php 
foreach ($this->my_groups as $i => $grp) {
    $grp_obj = new SocialGroup($grp);
    ?>
		<div class="contact_mini">
			<?php 
    if ($grp_obj->getUser() == $_SESSION['member_id']) {
        ?>
				<div style="float:right;margin:1em;"><a href="<?php 
        echo $_base_href . AT_SOCIAL_BASENAME;
        ?>
groups/edit.php?id=<?php 
        echo $grp;
        ?>
"><img src="<?php 
        echo $_base_href . AT_SOCIAL_BASENAME;
        ?>
images/icon-settings.png" alt="<?php 
        echo _AT('settings');
        ?>
" title="<?php 
        echo _AT('settings');
        ?>
Esempio n. 15
0
    if ($missing_fields) {
        $missing_fields = implode(', ', $missing_fields);
        $msg->addError(array('EMPTY_FIELDS', $missing_fields));
    } else {
        if ($_POST['group_privacy'] == "private") {
            $privacy = 1;
        } else {
            if ($_POST['group_privacy'] == "public") {
                $privacy = 0;
            }
        }
        $group_id = $social_groups->addGroup($_POST['group_type'], $_POST['group_name'], $_POST['description'], $privacy);
        if ($group_id) {
            //Add the logo in now that we have the group id. And rename the old one.
            if ($thumbnail_img != '') {
                $new_group = new SocialGroup($group_id);
                $new_group->updateGroupLogo($group_id . '.' . $extension);
                $new_location = AT_CONTENT_DIR . 'social/' . $group_id . '.' . $extension;
                copy($thumbnail_img, $new_location);
                unlink($thumbnail_img);
            }
            $msg->addFeedback('GROUP_CREATED');
            header('Location: index.php');
            exit;
        } else {
            //Something went bad in the backend, contact admin?
            $msg->addError('GROUP_CREATION_FAILED');
        }
    }
}
//Display
Esempio n. 16
0
 public function prepareCreateMilestoneStream(SocialStreamItem $item, $includePrivacy = true)
 {
     $params = FD::registry($item->params);
     $milestone = FD::table('Milestone');
     $milestone->bind($params->get('milestone'));
     // Get the group data
     FD::load('group');
     $group = new SocialGroup();
     $group->bind($params->get('group'));
     // Get the actor
     $actor = $item->actor;
     // We need to get the task app for the group
     $app = Foundry::table('App');
     $app->load(array('element' => 'tasks', 'group' => 'group'));
     $permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id));
     $this->set('permalink', $permalink);
     $this->set('milestone', $milestone);
     $this->set('actor', $actor);
     $this->set('group', $group);
     $item->title = parent::display('streams/tasks/create.milestone.title');
     $item->content = parent::display('streams/tasks/create.milestone.content');
 }
Esempio n. 17
0
 /** 
  * Accept the group request
  * @param	int		group id
  * @param	int		member that made this request
  */
 function acceptGroupRequest($group_id, $sender_id){
	global $db;
	
	//will only add member if the group_id is valid.
	if ($group_id <= 0){
		return;
	}

	$sg = new SocialGroup($group_id);
	$isSucceeded = $sg->addMember($sender_id);

	if ($isSucceeded){
		removeGroupRequest($group_id, $sender_id);
	}
 }
Esempio n. 18
0
 /**
  * Alias for FD::get( 'Group' )
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	SocialUser		The user's object
  */
 public static function group($ids = null, $debug = false)
 {
     // Load the group library
     FD::load('group');
     if (is_null($ids)) {
         return new SocialGroup();
     }
     $state = SocialGroup::factory($ids, $debug);
     if ($state === false) {
         return new SocialGroup();
     }
     return $state;
 }
Esempio n. 19
0
 /**
  * Before the form is saved, we need to store these data into the group properties
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return  
  */
 public function onBeforeSave(&$post, SocialGroup &$group)
 {
     $value = !empty($post['stream_moderation']) ? $post['stream_moderation'] : array();
     // Set it into the group params so that we can retrieve this later
     $params = $group->getParams();
     $params->set('stream_moderation', $value);
     $group->params = $params->toString();
     unset($post['stream_moderation']);
 }
Esempio n. 20
0
/* 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 group
$gid = intval($_REQUEST['id']);
$group_obj = new SocialGroup($gid);
//handles submit
if (isset($_POST['inviteMember']) && isset($_POST['new_members'])) {
    //	debug($_POST['new_members']);
    //add to request table
    foreach ($_POST['new_members'] as $k => $v) {
        $k = intval($k);
        if ($gid != '') {
            $sql_notify = "SELECT first_name, last_name, email FROM " . TABLE_PREFIX . "members WHERE member_id={$k}";
            $result_notify = mysql_query($sql_notify, $db);
            $row_notify = mysql_fetch_assoc($result_notify);
            if ($row_notify['email'] != '') {
                require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php';
                $body = _AT('notification_group_invite', get_display_name($_SESSION['member_id']), $group_obj->getName(), $_base_href . AT_SOCIAL_BASENAME . 'index_mystart.php');
                $sender = get_display_name($_SESSION['member_id']);
                $mail = new ATutorMailer();
Esempio n. 21
0
 /**
  * Prepares the upload avatar stream for a group
  *
  * @since	1.2
  * @access	public
  * @param	SocialStream
  * @return
  */
 public function prepareGroupUploadAvatarStream(&$item, $privacy, $includePrivacy = true)
 {
     $element = $item->context;
     $uid = $item->contextId;
     // Load the photo
     $photo = $this->getPhotoFromParams($item);
     // Get the data of the group
     $registry = Foundry::registry($item->params);
     $group = new SocialGroup();
     $group->bind($registry->get($item->cluster_type));
     $this->set('group', $group);
     $this->set('photo', $photo);
     $this->set('actor', $item->actor);
     $item->title = parent::display('streams/group/upload.avatar.title');
     $item->content = parent::display('streams/group/upload.avatar.content');
     if ($includePrivacy) {
         $item->privacy = $privacy->form($uid, $element, $item->actor->id, 'core.view', false, $item->uid);
     }
 }
Esempio n. 22
0
 /**
  * Processes mentions in a stream object
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function formatMentions(SocialStreamItem &$stream)
 {
     // Get the current view
     $view = JRequest::getCmd('view', '');
     // Get the stream's content
     $content = $stream->content;
     // Get tags for the stream
     $tags = isset($stream->tags) ? $stream->tags : array();
     // If there is no tags, just skip this and escape the content
     if (!$tags) {
         return FD::string()->escape($content);
     }
     // We need to store the changes in an array and replace it accordingly based on the counter.
     $items = array();
     // We need to merge the mentions and hashtags since we are based on the offset.
     $i = 0;
     foreach ($tags as $tag) {
         if ($tag->type == 'user') {
             $replace = '<a href="' . $tag->user->getPermalink() . '" data-popbox="module://easysocial/profile/popbox" data-popbox-position="top-left" data-user-id="' . $tag->user->id . '" class="mentions-user">' . $tag->user->getName() . '</a>';
         }
         if ($tag->type == 'hashtag') {
             // $alias = JFilterOutput::stringURLSafe($tag->title);
             $alias = $tag->title;
             $url = '';
             if ($view == 'groups') {
                 $clusterReg = FD::registry($stream->params);
                 $object = $clusterReg->get($stream->cluster_type);
                 switch ($stream->cluster_type) {
                     case SOCIAL_TYPE_GROUP:
                         // for now we assume all is group type.
                         $group = new SocialGroup();
                         $group->bind($object);
                         $url = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'tag' => $alias));
                         break;
                     case SOCIAL_TYPE_EVENT:
                         $event = new SocialEvent();
                         $event->bind($object);
                         $url = FRoute::events(array('layout' => 'item', 'id' => $event->getAlias(), 'tag' => $alias));
                         break;
                     default:
                         FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
                         break;
                 }
             } else {
                 $url = FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $alias));
             }
             $replace = '<a href="' . $url . '" class="mentions-hashtag">#' . $tag->title . '</a>';
         }
         $links[$i] = $replace;
         $replace = '[si:mentions]' . $i . '[/si:mentions]';
         $content = JString::substr_replace($content, $replace, $tag->offset, $tag->length);
         $i++;
     }
     // Once we have the content, escape it
     $content = FD::string()->escape($content);
     if ($links) {
         for ($x = 0; $x < count($links); $x++) {
             $content = str_ireplace('[si:mentions]' . $x . '[/si:mentions]', $links[$x], $content);
         }
     }
     return $content;
 }
Esempio n. 23
0
 /**
  * Post process after the group avatar is removed
  *
  * @since	1.2
  * @access	public
  * @param	SocialGroup
  */
 public function removeAvatar(SocialGroup $group)
 {
     FD::info()->set($this->getMessage());
     $permalink = $group->getPermalink(false);
     $this->redirect($permalink);
 }
Esempio n. 24
0
 /**
  * Adds opengraph data for the group
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function addGroup(SocialGroup $group)
 {
     $config = FD::config();
     // Only proceed when opengraph is enabled
     if (!$config->get('oauth.facebook.opengraph.enabled')) {
         return;
     }
     $this->properties['type'] = 'profile';
     $this->properties['title'] = $group->getName();
     $description = strip_tags($group->getDescription());
     $this->addDescription($description);
     $this->addImage($group->getAvatar(SOCIAL_AVATAR_MEDIUM), SOCIAL_AVATAR_MEDIUM_WIDTH, SOCIAL_AVATAR_MEDIUM_HEIGHT);
     $this->addUrl($group->getPermalink(true, true));
     return $this;
 }
Esempio n. 25
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';
// 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');