Example #1
0
</tr>
EOS;
                    $userid = _getMemberID($_SESSION['valid_user']);
                    $im = new InternalMessages();
                    $msgs = $im->getOutgoingMessages($userid);
                    $i = 0;
                    $r = "";
                    foreach ($msgs as $msg) {
                        $res_msg = $msg['msg'];
                        _filter_res_var($res_msg);
                        $res_msg = nl2br($res_msg);
                        $res_counter = "";
                        $subj_username = _getMemberUsername($msg['to']);
                        $subj = new User($subj_username);
                        $res_counter = $subj->getEmail();
                        $res_date = getStyledDateDiff($msg['date'], date('Y-m-d'));
                        $i++;
                        if ($i % 2 == 0) {
                            $r = " style=\"background-color:#eee;\"";
                        } else {
                            $r = "";
                        }
                        $html .= <<<EOS

<tr{$r}>
<td valign="top">
<a href="javascript:void(popUp('msg.do?to={$subj_username}&toname={$res_counter}'))">{$subj_username}</a><br />{$res_date}
</td>
<td>
{$res_msg}
</td>
Example #2
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;
 }