//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(); $mail->AddAddress($row_notify['email'], $sender); $mail->FromName = $_config['site_name']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('group_invitation'); $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } //TODO, move the following function from friends.inc.php to the SocialGroup.class object addGroupInvitation($k, $gid); }
/** * 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; }
echo $sender_id; ?> "><img src="<?php echo $_base_href . AT_SOCIAL_BASENAME; ?> images/b_drop.png" alt="<?php echo _AT('reject_request'); ?> " title="<?php echo _AT('reject_request'); ?> " border="0"/></a> </div> <ul> <li id="activity"><?php echo _AT('has_requested_to', $name, '<a href="' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $gobj->getID()) . '">' . $gobj->getName() . '</a>'); ?> </li> </ul> </div> <?php } ?> <?php } ?> </div><br /> <?php }
/** * 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; }
$msg->addError('JOIN_REQUEST_FAILED'); } } else { /*private*/ $result = $group_obj->addRequest(); if ($result) { $sql = "SELECT member_id from " . TABLE_PREFIX . "social_groups WHERE id = '{$gid}'"; $result_sender = mysql_query($sql, $db); $grpadmins = mysql_fetch_row($result_sender); $grpadmin = $grpadmins['0']; require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; $sql_notify = "SELECT first_name, last_name, email FROM " . TABLE_PREFIX . "members WHERE member_id={$grpadmin}"; $result_notify = mysql_query($sql_notify, $db); $row_notify = mysql_fetch_assoc($result_notify); if ($row_notify['email'] != '') { $body = _AT('notification_group_request', $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']; $mail->From = $_config['contact_email']; $mail->Subject = _AT('group_request'); $mail->Body = $body; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } unset($mail); } $msg->addFeedback('JOIN_REQUEST_SENT'); } else { $msg->addError('JOIN_REQUEST_FAILED');
header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/index.php', AT_PRETTY_URL_HEADER)); exit; } //submit message if (isset($_POST['submit'])) { $body = $_POST['msg_body']; if ($body != '') { $group_obj->addMessage($body); } } // delete group if ($_GET['delete'] == "confirm") { //$msg->addConfirm('DELETE_GROUP', $group_obj->getName()); //$msg->addConfirm('DELETE_GROUP', ); $hidden_vars['id'] = $gid; $msg->addConfirm(array('DELETE_GROUP', $group_obj->getName()), $hidden_vars); header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . "groups/view.php?id=" . $gid, AT_PRETTY_URL_HEADER)); exit; } else { if ($_POST['submit_yes']) { header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . "groups/delete.php?id=" . $gid, AT_PRETTY_URL_HEADER)); exit; } else { if ($_POST['submit_no']) { $msg->addFeedback('CANCELLED'); header('Location: ' . url_rewrite(AT_SOCIAL_BASENAME . "groups/view.php?id=" . $gid, AT_PRETTY_URL_HEADER)); exit; } } } //Display
<div class="box"> <div style="float:left;"> <?php echo $grp_obj->getLogo(); ?> </div> <div style="float:left; padding-left:0.5em;"> <h4><a href="<?php echo url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $grp); ?> "><?php echo $grp_obj->getName(); ?> </a></h4><br/> <?php echo _AT('group_type') . ': ' . $grp_obj->getGroupType(); ?> <br/> <?php echo _AT('access') . ': ' . ($grp_obj->getPrivacy() ? _AT('private') : _AT('public')); ?> <br/> <?php echo _AT('description') . ': <br/>' . $grp_obj->getDescription(); ?> <br/> </div>