コード例 #1
0
ファイル: PMSessionListAction.php プロジェクト: caidongyun/CS
 private function _getPMList($page, $pageSize)
 {
     $pmList = array('list' => array(), 'count' => 0);
     global $_G;
     // 在DISCUZ_ROOT/source/include/space/space_pm.php基础上二次开发
     loaducenter();
     $filter = 'privatepm';
     $perpage = $pageSize;
     $count = 0;
     $list = array();
     if ($filter == 'privatepm' || $filter == 'newpm') {
         $result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 200);
         $count = $result['count'];
         $list = $result['data'];
     }
     if ($_G['member']['newpm']) {
         if ($newpm && $_G['setting']['cloud_status']) {
             $msgService = Cloud::loadClass('Cloud_Service_Client_Message');
             $msgService->setMsgFlag($_G['uid'], $_G['timestamp']);
         }
         C::t('common_member')->update($_G['uid'], array('newpm' => 0));
         uc_pm_ignore($_G['uid']);
     }
     $tempPMList = array();
     foreach ($list as $pm) {
         // 目前只要两人对话的列表
         if ($pm['members'] > 2 || $pm['pmtype'] != 1) {
             $count--;
             continue;
         }
         $tempPm = array();
         $tempPm['plid'] = (int) $pm['plid'];
         $tempPm['pmid'] = (int) $pm['pmid'];
         $tempPm['lastUserId'] = (int) $pm['lastauthorid'];
         $tempPm['lastUserName'] = (string) $pm['lastauthor'];
         $tempPm['lastSummary'] = (string) $pm['lastsummary'];
         $tempPm['lastDateline'] = $pm['lastdateline'] . '000';
         $tempPm['toUserId'] = (int) $pm['touid'];
         $tempPm['toUserAvatar'] = UserUtils::getUserAvatar($pm['touid']);
         $tempPm['toUserName'] = (string) $pm['tousername'];
         $tempPm['toUserIsBlack'] = UserUtils::isBlacklist($_G['uid'], $pm['touid']) ? 1 : 0;
         $tempPm['isNew'] = $pm['new'] ? 1 : 0;
         $tempPMList[] = $tempPm;
     }
     $pmList['list'] = $tempPMList;
     $pmList['count'] = $count;
     return $pmList;
 }
コード例 #2
0
ファイル: spacecp_pm.php プロジェクト: Kingson4Wu/php_demo
 foreach ($result as $key => $value) {
     if ($value['msgfromid'] != $_G['uid']) {
         $msguser = $value['msgfrom'];
     }
     $daykey = dgmdate($value['dateline'], 'Y-m-d');
     $msglist[$daykey][$key] = $value;
 }
 if ($touid && empty($msguser)) {
     $member = DB::fetch_first("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$touid}' LIMIT 1");
     $msguser = $member['username'];
 }
 if (!$msgonly) {
     $online = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('common_session') . " b WHERE uid='{$touid}'"), 0);
     if ($_G['member']['newpm']) {
         DB::update('common_member', array('newpm' => 0), array('uid' => $_G['uid']));
         uc_pm_ignore($_G['uid']);
     }
 }
 if (!empty($_G['gp_tradeid'])) {
     $trade = DB::fetch_first("SELECT tid, subject, pid FROM " . DB::table('forum_trade') . " WHERE pid='{$_G['gp_tradeid']}'");
     if ($trade) {
         $messageappend = htmlspecialchars('[url=' . $_G['siteurl'] . 'forum.php?mod=viewthread&tid=' . $trade['tid'] . '&do=tradeinfo&pid=' . $trade['pid'] . '][b]' . $trade['subject'] . '[/b][/url]');
     }
 } elseif (!empty($_G['gp_commentid'])) {
     $comment = DB::fetch_first("SELECT comment, tid, pid FROM " . DB::table('forum_postcomment') . " WHERE id='{$_G['gp_commentid']}'");
     if ($comment) {
         $comment['comment'] = str_replace(array('[b]', '[/b]', '[/color]'), array(''), preg_replace("/\\[color=([#\\w]+?)\\]/i", '', strip_tags($comment['comment'])));
         $messageappend = htmlspecialchars('[url=' . $_G['siteurl'] . 'forum.php?mod=redirect&goto=findpost&pid=' . $comment['pid'] . '&ptid=' . $comment['tid'] . '][b]' . lang('spacecp', 'pm_comment') . '[/b][/url][quote]' . $comment['comment'] . '[/quote]');
     }
 } elseif (!empty($_G['gp_pid'])) {
     $thread = DB::fetch_first("SELECT t.tid, t.subject, p.pid FROM " . DB::table('forum_post') . " p\n\t\t\tLEFT JOIN " . DB::table('forum_thread') . " t ON t.tid=p.tid WHERE p.pid='{$_G['gp_pid']}'");
コード例 #3
0
ファイル: space_pm.php プロジェクト: shiyake/php-ihome
    //分页
    $perpage = 10;
    $perpage = mob_perpage($perpage);
    $page = empty($_GET['page']) ? 0 : intval($_GET['page']);
    if ($page < 1) {
        $page = 1;
    }
    $result = uc_pm_list($_SGLOBAL['supe_uid'], $page, $perpage, 'inbox', $filter, 100);
    $count = $result['count'];
    $list = $result['data'];
    $multi = multi($count, $perpage, $page, "space.php?do=pm&filter={$filter}");
    if ($_SGLOBAL['member']['newpm']) {
        //取消新短消息提示
        updatetable('space', array('newpm' => 0), array('uid' => $_SGLOBAL['supe_uid']));
        //UCenter
        uc_pm_ignore($_SGLOBAL['supe_uid']);
    }
    $actives = array($filter => ' class="active"');
}
//实名
if ($list) {
    $today = $_SGLOBAL['timestamp'] - ($_SGLOBAL['timestamp'] + $_SCONFIG['timeoffset'] * 3600) % 86400;
    foreach ($list as $key => $value) {
        realname_set($value['msgfromid'], $value['msgfrom']);
        $value['daterange'] = 5;
        if ($value['dateline'] >= $today) {
            $value['daterange'] = 1;
        } elseif ($value['dateline'] >= $today - 86400) {
            $value['daterange'] = 2;
        } elseif ($value['dateline'] >= $today - 172800) {
            $value['daterange'] = 3;
コード例 #4
0
ファイル: pmlist.php プロジェクト: ablozhou/hairnet
/**
 * UCenter 应用程序开发 Example
 *
 * 自制短消息平台的 Example 代码
 */
$timeoffset = 8;
$ppp = 10;
if (!empty($_GET['pmdel']) && !empty($_POST['delete'])) {
    if (uc_pm_delete($Example_uid, $_GET['folder'], $_POST['delete'])) {
        echo '<br />短消息已删除<br />';
    }
}
$_GET['folder'] = !empty($_GET['folder']) ? $_GET['folder'] : 'inbox';
if (!empty($_GET['pmignore'])) {
    uc_pm_ignore($Example_uid);
    $newpm = 0;
}
echo ($newpm ? '<font color="red">New!</font> <a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&pmignore=yes">忽略提示</a><br />' : '') . '<br />
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=inbox">收件箱</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=outbox">发件箱</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=newbox&filter=newpm">未读消息</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=inbox&filter=newpm">未读收件箱</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=outbox&filter=newpm">未读发件箱</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=inbox&filter=systempm">系统消息</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&folder=inbox&filter=announcepm">公共消息</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&pmsend=yes">发送消息</a>
	<a href="' . $_SERVER['PHP_SELF'] . '?example=pmlist&blackls=yes">黑名单</a><br />';
if (!empty($_GET['pmsend'])) {
    if (empty($_POST)) {
        echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?example=pmlist&pmsend=yes">