Example #1
0
 function getComments($member_id)
 {
     _filter_var($member_id);
     // keeps track of duplicate entries
     // because we don't delete old entries, but show only
     // one of them, actually the last one
     $has_comment = array();
     $comments_res = array();
     // we'll return this
     $comments =& $this->Database->getAll("SELECT author_id, comment, added_on,comment_id FROM comments WHERE member_id = '{$member_id}' ORDER BY added_on DESC", array(), 2);
     if (PEAR::isError($comments)) {
         die($comments->getMessage());
     }
     if (sizeof($comments) > 0) {
         $_now = date('Y-m-d H:i:s');
         foreach ($comments as $i => $comment) {
             $user_id = $comment["author_id"];
             // multiple comments allowed now,
             // because this is wall now
             //if(!in_array($user_id,$has_comment)) {
             $has_comment[] = $user_id;
             $username = _getMemberUsername($user_id);
             $user = new User($username);
             $usersnamesurname = $user->getNameSurname();
             $usersicon = $user->getMiniIcon();
             // from GeneralFunctions.php
             $timediff = getStyledDateDiff($comment['added_on'], $_now);
             $comments_res[$i]["author"] = $usersnamesurname;
             $comments_res[$i]["author_username"] = $username;
             $comments_res[$i]["comment"] = $comment["comment"];
             $comments_res[$i]["icon"] = $usersicon;
             $comments_res[$i]["date"] = $timediff;
             $comments_res[$i]["id"] = $comment["comment_id"];
             //}
         }
     }
     return $comments_res;
 }
Example #2
0
 }
 $pg->setLayout($pg->FullColumn);
 if (isset($_GET['obj1']) && $_GET['obj1'] == "search" && isset($_POST['psq'])) {
     $searched = $_POST['psq'];
     $members = $group->searchMembers($searched);
 } else {
     $members = $group->getMembers(false, false, $page_starts, $page_ends, "activity");
 }
 $html = "";
 $sm = sizeof($members);
 $maxsm = floor(($sm - 1) / 2);
 include_once "includes/User.class.php";
 foreach ($members as $i => $m) {
     $member_name = _getMemberUsername($m['member_id']);
     $u = new User($member_name);
     $uuname = $u->getNameSurname();
     $a = $u->getAvatarAsHTML(0, false);
     if (!isset($_SESSION['valid_user']) || $member_name != $_SESSION['valid_user']) {
         if ($group->isAdmin($m['member_id'])) {
             $bg = "background:lightyellow;";
         } else {
             $bg = "";
         }
     } else {
         $bg = "background:#eee;";
     }
     $borderright = "";
     $borderbottom = "border-bottom:1px #ccc dotted;";
     $avatar = "<a href=\"{$service_host}people/person/{$member_name}\">{$a}</a>";
     $wallnum = $u->getWallPostsNum($m['member_id']);
     if ($i % 2 == 0) {
Example #3
0
 /**
  * This function differs from others;
  * it does not use default to_name and to_email
  * functions.
  * It first tries to find out the admins of the group
  * because the mail will be sent to them..
  */
 function notifyJoining($group_title)
 {
     /**
      * First let's notify the admins
      */
     $g = new Group($this->groupname);
     $admins = $g->getAdmins();
     $skipper = false;
     if (!$admins || sizeof($admins) == 0) {
         $skipper = true;
     }
     if (!$skipper) {
         foreach ($admins as $admin) {
             $admins_user_id = $admin['member_id'];
             $admin_username = _getMemberUsername($admins_user_id);
             $admin_obj = new User($admin_username);
             $tmp_name = $admin_obj->getNameSurname($this->groupname);
             $tmp_email = $admin_obj->getEmail();
             $this->AddAddress($tmp_email, $tmp_name);
         }
         $msg = "";
         $msg .= "<p>Dear administrator of {$group_title},</p>";
         $msg .= "\r\n\r\n";
         $msg .= "<p>A new user <u>{$this->to_email}</u> has joined your group - <a href=\"http://grou.ps/{$this->groupname}\">http://grou.ps/{$this->groupname}</a></p>";
         $msg .= $this->thanks;
         $this->Subject = "New Member";
         $this->Body = $msg;
     }
     // TODO: Add logging features
     if (!$skipper && !$this->Send()) {
         $this->ClearAddresses();
         return false;
         // an error has occurred
     } else {
         /**
          * Success, so it's time to 
          * notify the user 
          */
         $this->ClearAddresses();
         // no need to filter $group_title
         $nmsg = "";
         $nmsg .= "<p>{$this->to_email}</p>";
         $nmsg .= "\r\n\r\n";
         $nmsg .= "<p>You have sucessfuly joined <u>{$group_title}</u>.</p>";
         $nmsg .= $this->thanks;
         $this->Subject = "Your Joining Request APPROVED!";
         $this->Body = $nmsg;
         $this->AddAddress($this->to_email, $this->to_name);
         // TODO: Add logging features
         if (!$this->Send()) {
             $this->ClearAddresses();
             return false;
         } else {
             $this->ClearAddresses();
             return true;
         }
     }
 }