Exemple #1
0
function b_mp_cont_show($options)
{
    global $xoopsDB, $xoopsUser, $xoopsModuleConfig, $HTTP_SERVER_VARS;
    if (is_object($xoopsUser)) {
        $uid = $xoopsUser->getVar('uid');
        $uname = $xoopsUser->getVar('uname');
    } else {
        $uid = 0;
        $uname = '';
    }
    $block = array();
    if (!is_object($xoopsUser)) {
        $block['lang_none'] = _MP_BL_YOUDONTHAVE;
    } else {
        $online = 0;
        $offline = 0;
        $user = '';
        $cont_handler =& xoops_gethandler('priv_msgscont');
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('ct_userid', $xoopsUser->getVar('uid')));
        $amount = $cont_handler->getCount($criteria);
        $criteria->setSort('ct_uname');
        $criteria->setOrder('desc');
        $pm_cont =& $cont_handler->getObjects($criteria);
        foreach (array_keys($pm_cont) as $i) {
            $poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact'));
            /* Online poster */
            if ($poster->isOnline()) {
                $user .= "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/pmlite.php?send2=1&to_userid=" . $pm_cont[$i]->getVar('ct_contact') . "\",\"pmlite\", 450, 380)'>" . $poster->getVar('uname') . "</a>, &nbsp;";
                $online++;
            } else {
                $offline++;
            }
        }
        $block['online_total'] = $amount;
        $block['online'] = $online;
        $block['offline'] = $offline;
        $block['user'] = $user;
        $block['lang_online'] = _MP_BLOCK_ONLINE;
        $block['lang_offline'] = _MP_BLOCK_OFFLINE;
        $block['lang_contact'] = _MP_BLOCK_CONTACT;
    }
    return $block;
}
Exemple #2
0
 function getShouts($online, $bbcode, $limit)
 {
     global $xoopsUser;
     $shouts = array();
     $myts =& MyTextSanitizer::getInstance();
     $objs = $this->handler->getShouts($limit);
     $i = 0;
     foreach ($objs as $obj) {
         $uid = $obj->getVar('uid');
         $shouts[$i]['uid'] = $uid;
         $shouts[$i]['online'] = 0;
         $shouts[$i]['url'] = '';
         $shouts[$i]['email'] = '';
         $shouts[$i]['avatar'] = $this->getDefaultAvatar();
         $shouts[$i]['uname'] = $obj->getVar('uname');
         $shouts[$i]['time'] = $obj->time(shoutbox_getOption('stamp_format'));
         $shouts[$i]['ip'] = $obj->getVar('ip');
         $obj->setVar('doxcode', $bbcode);
         $shouts[$i]['message'] = $myts->censorString($obj->getVar('message'));
         if ($wordwrap = shoutbox_getOption('wordwrap_setting')) {
             $shouts[$i]['message'] = wordwrap($shouts[$i]['message'], $wordwrap, "\r\n", true);
         }
         if ($uid != 0) {
             $thisUser = new XoopsUser($uid);
             if ($thisUser->isOnline()) {
                 $shouts[$i]['online'] = 1;
             }
             if ($thisUser->getVar("url") != "") {
                 $shouts[$i]['url'] = $thisUser->getVar("url");
             }
             if ($thisUser->getVar("user_viewemail") == 1 || $xoopsUser && $xoopsUser->isAdmin()) {
                 $shouts[$i]['email'] = $thisUser->getVar("email");
             }
             $shouts[$i]['avatar'] = XOOPS_URL . '/uploads/' . $thisUser->getVar("user_avatar");
         }
         $i++;
     }
     return $shouts;
 }
Exemple #3
0
 }
 $i = $start + 0;
 foreach (array_keys($pm_cont) as $i) {
     $poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact'));
     $mp['msg_id'] = $pm_cont[$i]->getVar('ct_contact');
     $postername = $poster->getVar('uname') . "<br />" . $poster->getVar('name');
     $userrank =& $poster->rank();
     /* No need to show deleted users */
     if ($postername) {
         $mp['msg_poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $pm_cont[$i]->getVar('ct_contact') . "'>" . $postername . "</a>";
     } else {
         $mp['msg_poster'] = $xoopsConfig['anonymous'];
     }
     $mp['msg_joindate'] = formatTimestamp($poster->getVar("user_regdate"));
     /* Online poster */
     if ($poster->isOnline()) {
         $mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/online.png" title="' . _MP_ONLINE . '" style="width: 20px; height: 20px;"/>';
     } else {
         $mp['msg_online'] = '<img src="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/images/offline.png" title="' . _MP_OFFLINE . '" style="width: 20px; height: 20px;"/>';
     }
     /**/
     $mp['msg_last'] = formatTimestamp($poster->getVar("last_login"));
     $mp['msg_com'] = $poster->getVar('posts');
     if ($userrank['image']) {
         $mp['msg_groupe'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="" /><br />' . $userrank['title'];
     } else {
         $mp['msg_groupe'] = '<img src="' . XOOPS_UPLOAD_URL . '/blank.gif" alt="" /><br />' . $userrank['title'];
     }
     if (is_file(XOOPS_UPLOAD_PATH . "/" . $poster->getVar('user_avatar'))) {
         $mp['msg_avatar'] = '<img class="comUserImg" src="' . XOOPS_UPLOAD_URL . "/" . $poster->getVar("user_avatar") . '" alt=""/>';
     } else {
 $status = sanitize($row['com_status']);
 $params = sanitize($row['com_exparams']);
 $dohtml = sanitize($row['dohtml']);
 $dosmiley = sanitize($row['dosmiley']);
 $xcode = sanitize($row['doxcode']);
 $doimage = sanitize($row['doimage']);
 $linebreak = sanitize($row['dobr']);
 $user = new XoopsUser($row['com_uid']);
 $avatar = $user->user_avatar($row['com_uid']);
 $rank = $user->rank($row['com_uid']);
 $rank_title = $rank['title'];
 $rank_image = XOOPS_UPLOAD_URL . "/" . $rank['image'];
 $regdate = date("d-m-Y", $user->user_regdate($row['com_uid']));
 $userLocation = $user->user_from($row['com_uid']);
 $numposts = $user->getVar("posts");
 $checkstatus = $user->isOnline();
 if ($checkstatus > 0) {
     $status = "Online";
 } else {
     $status = "Offline";
 }
 if ($icon = '') {
     $comment_image = '';
 } else {
     $comment_image = '<img src="' . XOOPS_UPLOAD_URL . "/" . $icon . '" alt=""></img>';
 }
 if ($avatar == '') {
     $avatar = 'blank.gif';
 }
 $uname = $user->getVar('uname');
 $userinfo = "<a href='" . XOOPS_URL . "/modules/profile/userinfo.php?uid=" . $userid . "' title='" . $uname . "'>" . $uname . "</a>";
 foreach ($postsArray as $eachpost) {
     $post_text = $eachpost->text();
     $posterarr = array();
     if (0 != $eachpost->uid()) {
         if (!isset($foundusers['user' . $eachpost->uid()])) {
             $eachposter = new XoopsUser($eachpost->uid());
             $foundusers['user' . $eachpost->uid()] =& $eachposter;
         } else {
             $eachposter =& $foundusers['user' . $eachpost->uid()];
         }
         $poster_rank = $eachposter->rank();
         if (!empty($poster_rank['image'])) {
             $poster_rank['image'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $poster_rank['image'] . '" alt="" />';
         }
         if ($eachposter->isActive()) {
             $poster_status = $eachposter->isOnline() ? _MD_XHNEWBB_ONLINE : '';
             $posterarr = array('poster_uid' => $eachposter->getVar('uid'), 'poster_uname' => '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $eachposter->getVar('uid') . '">' . $eachposter->getVar('uname') . '</a>', 'poster_avatar' => $eachposter->getVar('user_avatar'), 'poster_from' => $eachposter->getVar('user_from'), 'poster_regdate' => formatTimestamp($eachposter->getVar('user_regdate'), 's'), 'poster_postnum' => $eachposter->getVar('posts'), 'poster_sendpmtext' => sprintf(_SENDPMTO, $eachposter->getVar('uname')), 'poster_rank_title' => $poster_rank['title'], 'poster_rank_image' => @$poster_rank['image'], 'poster_status' => $poster_status);
             if (1 == $forumdata['allow_sig'] && $eachpost->attachsig() == 1 && $eachposter->attachsig() == 1) {
                 $myts =& MytextSanitizer::getInstance();
                 $post_text .= '<p><br />----------------<br />' . $myts->displayTarea($eachposter->getVar('user_sig', 'N'), 0, 1, 1, $xoopsModuleConfig['xhnewbb_allow_sigimg']) . '</p>';
             }
             if (is_object(@$xoopsUser)) {
                 $can_edit = $isadminormod || $eachpost->uid() == $xoopsUser->getVar('uid') && time() < $eachpost->posttime() + $xoopsModuleConfig['xhnewbb_selfeditlimit'] ? true : false;
                 $can_delete = $isadminormod || $eachpost->uid() == $xoopsUser->getVar('uid') && time() < $eachpost->posttime() + $xoopsModuleConfig['xhnewbb_selfdellimit'] ? true : false;
             } else {
                 $can_edit = $can_delete = false;
             }
             $can_reply = $can_post;
         }
     }
     // this is a post from guests or quitted users