コード例 #1
0
ファイル: Notifications.php プロジェクト: NaturalWill/UCQA
 function get($uId)
 {
     global $_SGLOBAL;
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     //通知
     $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('notification') . "  WHERE uid='{$uId}' AND new='1' ORDER BY id DESC");
     $i = 0;
     while ($value = $_SGLOBAL['db']->fetch_array($query)) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     //短消息
     include_once S_ROOT . './uc_client/client.php';
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     // 好友
     $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('friend') . "  WHERE fuid='{$uId}' AND status='0' ORDER BY dateline DESC");
     $fIds = array();
     while ($value = $_SGLOBAL['db']->fetch_array($query)) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return new APIResponse($result);
 }
コード例 #2
0
	function get($uId) {
		$notify = $result = array();
		$result = array(
			'message' => array(
				'unread' => 0,
				'mostRecent' => 0
			),
			'notification'   => array(
				'unread' => 0 ,
				'mostRecent' => 0
			),
			'friendRequest' => array(
				'uIds' => array()
			)
		);

		$query = $GLOBALS['db']->query("SELECT * FROM ".$GLOBALS['tablepre']."notification WHERE uid='$uId' AND new='1' ORDER BY id DESC");
		$i = 0;
		while($value = $GLOBALS['db']->fetch_array($query)) {
			$i++;
			if(!$result['notification']['mostRecent']) $result['notification']['mostRecent'] = $value['dateline'];
		}
		$result['notification']['unread'] = $i;

		$pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
		if($pmarr['count']) {
			$result['message']['unread'] = $pmarr['count'];
			$result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
		}


		return new APIResponse($result);
	}
コード例 #3
0
ファイル: Notifications.php プロジェクト: softhui/discuz
 public function onNotificationsGet($uId)
 {
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     $i = 0;
     foreach (C::t('home_notification')->fetch_all_by_uid($uId, 1) as $value) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     loaducenter();
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     $fIds = array();
     foreach (C::t('home_friend_request')->fetch_all_by_uid($uId) as $value) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return $result;
 }
コード例 #4
0
ファイル: HeartAction.php プロジェクト: caidongyun/CS
 private function _getPmInfos($uid)
 {
     $pmInfos = array();
     loaducenter();
     $pmList = uc_pm_list($uid, 1, 10000, 'inbox', 'newpm', 200);
     $pmList = (array) $pmList['data'];
     foreach ($pmList as $pm) {
         // 目前只要两人对话的列表
         if ($pm['members'] > 2 || $pm['pmtype'] != 1) {
             continue;
         }
         $pmInfos[] = array('fromUid' => (int) $pm['touid'], 'plid' => (int) $pm['plid'], 'pmid' => (int) $pm['pmid'], 'time' => $pm['lastdateline'] . '000');
     }
     return $pmInfos;
 }
コード例 #5
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;
 }
コード例 #6
0
ファイル: space_pm.php プロジェクト: v998/discuzx-en
        $page = 1;
    }
    $newannouncepm = array();
    if ($filter == 'privatepm' && $page == 1) {
        $result = uc_pm_list($_G['uid'], 1, 1, 'inbox', 'announcepm', 100);
        if (!empty($result['data'][0]) && is_array($result['data'][0]) && $result['data'][0]['pmid'] != $_G['cookie']['viewannouncepmid']) {
            $newannouncepm = $result['data'][0];
        }
    }
    $result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 100);
    $count = $result['count'];
    $list = $result['data'];
    if ($_G['member']['newpm']) {
        if ($filter == 'privatepm' && !$count) {
            $filter = 'systempm';
            $result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 100);
            $count = $result['count'];
            $list = $result['data'];
        }
        DB::update('common_member', array('newpm' => 0), array('uid' => $_G['uid']));
        uc_pm_ignore($_G['uid']);
    }
    $multi = multi($count, $perpage, $page, "home.php?mod=space&do=pm&filter={$filter}");
    $actives = array($filter => ' class="a"');
}
if ($list) {
    $today = $_G['timestamp'] - ($_G['timestamp'] + $_G['setting']['timeoffset'] * 3600) % 86400;
    foreach ($list as $key => $value) {
        $value['message'] = str_replace('&', '&', $value['message']);
        $value['message'] = preg_replace("/&[a-z]+\\;/i", '', $value['message']);
        $value['daterange'] = 5;
コード例 #7
0
ファイル: pmlist.php プロジェクト: healthguo/PHP
	<a href=\"$phpself\">短消息</a>
	<a href=\"$phpself&filter=newpm\">未读消息</a>
	<a href=\"$phpself&filter=announcepm\">公共消息</a>
	<a href=\"$phpself&action=send\">发送短消息</a>
	<a href=\"$phpself&action=viewblackls\">黑名单</a>
	<hr>
".print_r($newdata, 1);

switch($action) {
	case '':
		$_GET['page'] =  max(1, intval($_GET['page']));
		
		$_GET['folder'] = !empty($_GET['folder']) ? $_GET['folder'] : 'inbox';
		$_GET['filter'] = !empty($_GET['filter']) ? $_GET['filter'] : '';
		
		$data = uc_pm_list($Example_uid, $_GET['page'], $ppp, $_GET['folder'], $_GET['filter'], 100);

		foreach($data['data'] as $pm) {
			if($_GET['filter'] != 'announcepm') {
				$output .= "<li>[$pm[msgfrom]]<a href=\"$phpself&action=view&touid=$pm[touid]\">$pm[subject] (".gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600).")</a>";
				$pm['new'] && $output .= " New! ";
				$output .= "<br />$pm[message]";
			} else {
				$output .= "<li><a href=\"$phpself&action=view&pmid=$pm[pmid]\">$pm[subject]</a>";
			}			
		}
		break;
	case 'view':
		$pmid = !empty($_GET['pmid']) ? $_GET['pmid'] : '';
		$data = uc_pm_view($Example_uid, $pmid, $_GET['touid']);
		
コード例 #8
0
ファイル: space_pm.php プロジェクト: shiyake/php-ihome
        $list = uc_pm_view($_SGLOBAL['supe_uid'], $pmid);
    }
    $actives = array($daterange => ' class="active"');
} elseif ($_GET['subop'] == 'ignore') {
    $ignorelist = uc_pm_blackls_get($_SGLOBAL['supe_uid']);
    $actives = array('ignore' => ' class="active"');
} else {
    $filter = in_array($_GET['filter'], array('newpm', 'privatepm', 'systempm', 'announcepm')) ? $_GET['filter'] : ($space['newpm'] ? 'newpm' : 'privatepm');
    //分页
    $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) {
コード例 #9
0
ファイル: discuz.php プロジェクト: shenhua4286/gxw
function API_ListMsg()
{
    global $userid;
    include_once ONEZ_ROOT . './uc_client/client.php';
    return uc_pm_list($userid);
}
コード例 #10
0
ファイル: do_getmessages.php プロジェクト: shiyake/php-ihome
include_once '../data_oauth_check.php';
$userid = intval(oauth_check());
include_once '../../../common.php';
include_once S_ROOT . './uc_client/client.php';
//$filter = in_array($_GET['filter'], array('newpm', 'privatepm', 'systempm', 'announcepm'))?$_GET['filter']:($space['newpm']?'newpm':'privatepm');
$filter = 'privatepm';
//分页
$perpage = 10;
//$perpage = mob_perpage($perpage);
$page = empty($_POST['page']) ? 0 : intval($_POST['page']);
if ($page < 1) {
    $page = 1;
}
//$userid=3;
//获取私信收件箱信息
$result = uc_pm_list($userid, $page, $perpage, 'inbox', $filter, 50);
$count = $result['count'];
$list = $result['data'];
$result = array();
//$result['count'] = $count;
//获取姓名
foreach ($list as $values) {
    realname_set($values['msgfromid'], $values['msgfrom']);
}
realname_get();
//生成数组
foreach ($list as $values) {
    //将公告中的图片进行绝对路径化。  start<img src=\"image\/face\/24.gif\" class=\"face\">
    preg_match_all("#[<]img\\s+src[=]\"(.*)\".*[>]#U", $value['message'], $matches, PREG_SET_ORDER);
    foreach ($matches as $item) {
        $TmpString = $item[1];
コード例 #11
0
ファイル: my.php プロジェクト: yunsite/cyaskuc
    unset($query);
    $page_front = $page - 1;
    $page_next = $page + 1;
    $pagelinks = get_pages($page, $pagecount, 'command=' . $command);
} elseif ($command == 'mymessage') {
    $page = intval($_GET['page']);
    $msgtype = empty($_GET['msgtype']) ? 'receive' : $_GET['msgtype'];
    if ($page < 1) {
        $page = 1;
    }
    $pagerow = 10;
    $msg_list = array();
    if ($msgtype == 'receive') {
        $msg_list = uc_pm_list($cyask_uid, $page, $pagerow, 'inbox', '');
    } else {
        $msg_list = uc_pm_list($cyask_uid, $page, $pagerow, 'outbox', '');
    }
    foreach ($msg_list['data'] as $k => $v) {
        $msg_list['data'][$k]['dateline'] = date("Y-m-d H:i:s", $msg_list['data'][$k]['dateline']);
    }
    $page_front = $page - 1;
    $page_next = $page + 1;
    $parameter = 'command=' . $command . '&msgtype=' . $msgtype;
    $pagelinks = get_pages($page, $pagecount, $parameter);
} elseif ($command == 'myinfo') {
    $query = $dblink->query("select username,gender,email,bday from {$dbprefix}members where uid={$cyask_uid}");
    $members = $dblink->fetch_array($query);
    $member_username = $members['username'];
    $member_email = $members['email'];
    $member_gender = $members['gender'];
    $member_bday = $members['bday'];
コード例 #12
0
ファイル: my.php プロジェクト: Kingson4Wu/php_demo
 function onNotificationsGet($uId)
 {
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     $query = DB::query("SELECT * FROM " . DB::table('home_notification') . "  WHERE uid='{$uId}' AND new='1' ORDER BY id DESC");
     $i = 0;
     while ($value = DB::fetch($query)) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     loaducenter();
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     $query = DB::query("SELECT * FROM " . DB::table('home_friend_request') . "  WHERE uid='{$uId}' ORDER BY dateline DESC");
     $fIds = array();
     while ($value = DB::fetch($query)) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return $result;
 }
コード例 #13
0
ファイル: pm.php プロジェクト: BGCX067/f2cont-svn-to-git
        } elseif ($pm['dateline'] >= $today - 86400) {
            $pm['daterange'] = 2;
        } elseif ($pm['dateline'] >= $today - 172800) {
            $pm['daterange'] = 3;
        }
        $pm['date'] = gmdate($dateformat, $pm['dateline'] + $timeoffset * 3600);
        $pm['time'] = gmdate($timeformat, $pm['dateline'] + $timeoffset * 3600);
        $pmlist[] = $pm;
    }
} elseif ($action == 'viewnew') {
    $newpmnum = uc_pm_checknew($discuz_uid);
    $pmlist = array();
    if ($newpmnum) {
        $num = min(5, $newpmnum);
        $morenum = max(0, $newpmnum - 5);
        $ucdata = uc_pm_list($discuz_uid, 1, $num, 'inbox', 'newpm', 0);
        $today = $timestamp - ($timestamp + $timeoffset * 3600) % 86400;
        foreach ($ucdata['data'] as $pm) {
            $pm['daterange'] = 5;
            if ($pm['dateline'] >= $today) {
                $pm['daterange'] = 1;
            } elseif ($pm['dateline'] >= $today - 86400) {
                $pm['daterange'] = 2;
            } elseif ($pm['dateline'] >= $today - 172800) {
                $pm['daterange'] = 3;
            }
            $pmlist[] = $pm;
        }
        $db->query("UPDATE {$tablepre}members SET prompt=prompt^1 WHERE uid='{$discuz_uid}' AND prompt=prompt|1", 'UNBUFFERED');
    }
    include template('pm_viewnew');
コード例 #14
0
ファイル: pm.php プロジェクト: pan289091315/Discuz
require_once './common.php';
$send_result = '';
$act = $_GET['act'];
$filter = $_GET['filter'];
// 跳轉到查看短信得頁面
if (!empty($filter) && in_array($filter, array('systempm', 'privatepm', 'announcepm'))) {
    $pm->view_pm($filter);
    exit;
}
if ($act == 'list') {
    @(include_once B_ROOT . './uc_client/client.php');
    $page = intval($_GET['page']);
    if ($page == 0) {
        $page = 1;
    }
    $pm_notices = uc_pm_list($_G['uid'], $page, 5, '', 'systempm', 0);
    $url = 'pm.php?act=list&msgtype=systempm';
    if ($_GET['inajax'] == 1) {
        $url .= '&inajax=1';
    }
    $multi = multi($pm_notices['count'], 5, $page, $url);
} elseif ($act == 'view') {
    @(include_once B_ROOT . './uc_client/client.php');
    $pm = uc_pm_viewnode($_G['uid'], 'systempm', intval($_GET['pmid']));
    uc_pm_readstatus($_G['uid'], null, intval($_GET['pmid']), 0);
    if (!empty($_SERVER['HTTP_REFERER'])) {
        $return_url = $_SERVER['HTTP_REFERER'];
    } else {
        $return_url = 'pm.php?act=list&msgtype=systempm';
        if ($_GET['inajax'] == 1) {
            $return_url .= '&inajax=1';
コード例 #15
0
ファイル: pm.php プロジェクト: BGCX262/zyyhong-svn-to-git
		updatesettings();
		$s .= updateprompt('announcepm', $discuz_uid, $ucnewpm['announcepm'], 0);
	}
	dsetcookie('checkpm', 1, 30, 0);
	include_once template('pm_checknew');
	exit;
}

$page = max($page, 1);
$action = !empty($action) ? $action : (isset($uid) || !empty($pmid) ? 'view' : '');

if(!$action) {

	$pmstatus = uc_pm_checknew($discuz_uid, 4);
	$filter = !empty($filter) && in_array($filter, array('newpm', 'privatepm', 'announcepm')) ? $filter : ($pmstatus['newpm'] ? 'newpm' : 'privatepm');
	$ucdata = uc_pm_list($discuz_uid, $page, $ppp, !isset($search) ? 'inbox' : 'searchbox', !isset($search) ? $filter : $srchtxt, 200);
	if(!empty($search) && $srchtxt !== '') {
		$filter = '';
		$srchtxtinput = htmlspecialchars(stripslashes($srchtxt));
		$srchtxtenc = rawurlencode($srchtxt);
	} else {
		$multipage = multi($ucdata['count'], $ppp, $page, 'pm.php?filter='.$filter);
	}
	$_COOKIE['checkpm'] && setcookie('checkpm', '', -86400 * 365);

	$pmlist = array();
	$today = $timestamp - ($timestamp + $timeoffset * 3600) % 86400;
	foreach($ucdata['data'] as $pm) {
		$pm['msgfromurl'] = $pm['fromappid'] && $ucapp[$pm['fromappid']]['viewprourl'] ? sprintf($ucapp[$pm['fromappid']]['viewprourl'], $pm['msgfromid']) : 'space.php?uid='.$pm['msgfromid'];
		$pm['daterange'] = 5;
		if($pm['dateline'] >= $today) {
コード例 #16
0
<?php

include_once 'common.php';
include_once S_ROOT . './uc_client/client.php';
$page = max($page, 1);
$action = !empty($action) ? $action : (isset($uid) || !empty($pmid) ? 'view' : '');
$ppp = 10;
$pmstatus = uc_pm_checknew($_SGLOBAL['supe_uid'], 4);
$systemnewpm = $pmstatus['newpm'] - $pmstatus['newprivatepm'];
$filter = 'newpm';
$ucdata = uc_pm_list($_SGLOBAL['supe_uid'], $page, $ppp, !isset($search) ? 'inbox' : 'searchbox', !isset($search) ? $filter : $srchtxt, 200);
if (!empty($search) && $srchtxt !== '') {
    $filter = '';
    $srchtxtinput = htmlspecialchars(stripslashes($srchtxt));
    $srchtxtenc = rawurlencode($srchtxt);
} else {
    $multipage = multi($ucdata['count'], $ppp, $page, 'pm.php?filter=' . $filter);
}
$_COOKIE['checkpm'] && setcookie('checkpm', '', -86400 * 365);
$pmlist = array();
$today = $timestamp - ($timestamp + $timeoffset * 3600) % 86400;
foreach ($ucdata['data'] as $pm) {
    $pm['msgfromurl'] = $pm['fromappid'] && $ucapp[$pm['fromappid']]['viewprourl'] ? sprintf($ucapp[$pm['fromappid']]['viewprourl'], $pm['msgfromid']) : 'space.php?uid=' . $pm['msgfromid'];
    $pm['daterange'] = 5;
    if ($pm['dateline'] >= $today) {
        $pm['daterange'] = 1;
    } elseif ($pm['dateline'] >= $today - 86400) {
        $pm['daterange'] = 2;
    } elseif ($pm['dateline'] >= $today - 172800) {
        $pm['daterange'] = 3;
    }
コード例 #17
0
ファイル: pmuc.inc.php プロジェクト: polarlight1989/08cms
            mcmessage(lang('pmdatamiss'), M_REFERER);
        }
        $tos = array_filter(explode(',', $pmnew['tonames']));
        $count = 0;
        $pmnew['title'] = $pmnew['title'] ? $pmnew['title'] : ($pmnew['content'] ? $pmnew['content'] : '');
        foreach ($tos as $to) {
            if (uc_pm_send($uid, $to, $pmnew['title'], $pmnew['content'], 1, 0, 1)) {
                $count++;
            }
        }
        $count ? mcmessage($count . lang('pmsendfinish'), "?action=pmbox&box={$box}&page={$page}") : mcmessage(lang('pmsenderr'), M_REFERER);
    }
} elseif (empty($fid) && empty($pmid)) {
    if (!submitcheck('bpmbox')) {
        //各收件箱
        $ucpm = uc_pm_list($uid, $page, $mrowpp, 'inbox', $box, 30);
        tabheader(lang('pmlist'), 'pmsedit', "?action=pmbox&box={$box}&page={$page}", 6);
        trcategory(array($box == 'announcepm' ? '' : "<input class=\"checkbox\" type=\"checkbox\" name=\"chkall\" class=\"category\" onclick=\"checkall(this.form, '', 'chkall')\">" . lang('del'), array(lang('title'), 'left'), lang('senduser'), lang('state'), lang('senddate'), lang('content')));
        if ($ucpm['data']) {
            foreach ($ucpm['data'] as $pm) {
                echo "<tr title=\"" . mhtmlspecialchars($pm['message']) . "\">\n<td align=\"left\" width=\"40\">" . ($box == 'announcepm' ? '' : "<input class=\"checkbox\" type=\"checkbox\" name=\"" . ($pm['msgformid'] ? "fids[{$pm['msgformid']}]\" value=\"{$pm['msgform']}" : "pmids[{$pm['pmid']}]\" value=\"{$pm['pmid']}") . '">') . "</td>\n" . "<td class=\"item2\">" . mhtmlspecialchars($pm['subject']) . "</td>\n" . "<td align=\"center\" width=\"120\">" . ($pm['msgfromid'] ? $pm['msgfrom'] : lang('syspm')) . "</td>\n" . "<td align=\"center\" width=\"40\">" . ($box == 'announcepm' ? '-' : lang($pm['new'] ? 'noread' : 'read')) . "</td>\n" . "<td align=\"center\" width=\"80\">" . date($dateformat, $pm['dateline']) . "</td>\n" . "<td align=\"center\" width=\"40\"><a href=\"?action=pmbox&box={$box}&page={$page}&" . ($pm['msgfromid'] ? "fid={$pm['msgfromid']}" : "pmid={$pm['pmid']}") . "\">" . lang('look') . "</a></td></tr>\n";
            }
        } else {
            echo '<tr class="item2" height="50"><td align="center" colspan="6">' . lang('nonepm') . '</td></tr>';
        }
        echo multi($ucpm['count'], $mrowpp, $page, "?action=pmbox");
        $box == 'announcepm' ? tabfooter() : tabfooter('bpmbox', lang('delete'));
    } else {
        //删除
        empty($fids) && empty($pmids) && mcmessage(lang('choosedeltem'), "?action=pmbox&box={$box}&page={$page}");
        is_array($fids) || ($fids = array($fids));
コード例 #18
0
ファイル: ucenter.php プロジェクト: hotmob/likedome
 function submenu_mail_box()
 {
     echo '<div class=wrap>';
     echo '<h2>' . __('Mail Box', 'ucenter') . '</h2>';
     global $current_user;
     wp_get_current_user();
     list($uid, $_, $_) = uc_get_user($current_user->user_login);
     $timeoffset = get_option('gmt_offset');
     $pm_per_page = 10;
     $max_msg_length = 100;
     $handler = $_SERVER['PHP_SELF'] . '?page=' . $_GET['page'];
     $current_handler = $handler . '&tab=' . $_GET['tab'];
     $action = !empty($_GET['action']) ? $_GET['action'] : '';
     $_GET['tab'] = !empty($_GET['tab']) ? $_GET['tab'] : 'inbox';
     $menu = array(array('inbox', '', __('Inbox', 'ucenter')), array('uread', 'filter=newpm', __('Unread Mail', 'ucenter')), array('announcepm', 'filter=announcepm', __('Public Message', 'ucenter')), array('systempm', 'filter=systempm', __('System Message', 'ucenter')), array('send', 'action=send', __('Send Message', 'ucenter')), array('blacklist', 'action=blacklist', __('Black List', 'ucenter')));
     echo '<ul class="ucenter-ul">';
     foreach ($menu as $item) {
         printf("<li><a href='{$handler}&tab={$item['0']}&{$item['1']}' %s>{$item['2']}</a></li>", $_GET['tab'] == $item[0] ? 'class="current"' : '');
     }
     echo '</ul><br /><hr />';
     switch ($action) {
         case '':
             $_GET['pageid'] = max(1, intval($_GET['pageid']));
             $_GET['filter'] = !empty($_GET['filter']) ? $_GET['filter'] : '';
             $data = uc_pm_list($uid, $_GET['pageid'], $pm_per_page, $_GET['folder'], $_GET['filter'], $max_msg_length);
             foreach ($data['data'] as $pm) {
                 if ($_GET['filter'] == 'announcepm' || $_GET['filter'] == 'systempm') {
                     $output .= "<li><a href='{$current_handler}&action=view&subtab=within3days&daterange=3&pmid={$pm['pmid']}'>{$pm['subject']}</a>";
                     $output .= '<br /> ' . __('Content:', 'ucenter') . $pm[message] . '</li>';
                 } else {
                     $output .= "<li><a href='{$current_handler}&action=view&subtab=within3days&daterange=3&touid={$pm['touid']}'>[{$pm['msgfrom']}]</a> (" . gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600) . ')';
                     $pm['new'] && ($output .= " New! ");
                     $output .= '<br /> ' . __('Content: ', 'ucenter') . $pm[message] . '</li>';
                 }
             }
             $page_n = $data['count'] / $pm_per_page;
             if ($page_n > 1) {
                 $output .= '<hr / ><br />';
                 $output .= __('Page ', 'ucenter');
                 for ($i = 1; $i <= $page_n; $i++) {
                     $output .= " <a href='{$current_handler}&pageid={$i}'>{$i}</a> ";
                 }
             }
             break;
         case 'view':
             $pmid = !empty($_GET['pmid']) ? $_GET['pmid'] : '';
             $daterange = !empty($_GET['daterange']) ? $_GET['daterange'] : '1';
             $data = uc_pm_view($uid, $pmid, $_GET['touid'], $daterange);
             $dateranges = array(array('within3days', '3', __('Within 3 Days', 'ucenter')), array('within1week', '4', __('Within This Week', 'ucenter')), array('all', '5', __('All', 'ucenter')));
             echo '<ul class="ucenter-ul">';
             foreach ($dateranges as $item) {
                 printf("<li><a href='{$current_handler}&action=view&touid={$_GET['touid']}&pmid={$pmid}&subtab={$item['0']}&daterange={$item['1']}' %s>{$item['2']}</a></li>", $_GET['subtab'] == $item[0] ? 'class="current"' : '');
             }
             echo '</ul><br /><hr />';
             foreach ($data as $pm) {
                 $output .= "<b>{$pm['msgfrom']}</b>";
                 if ($_GET['touid'] == $pm['msgfromid']) {
                     $output .= "<a href='{$current_handler}&action=addblacklist&user={$pm['msgfrom']}'>" . __(' [ Ban This User ] ', 'ucenter') . "</a>";
                 }
                 $output .= ' ( ' . gmdate('Y-m-d H:i:s', $pm['dateline'] + $timeoffset * 3600) . ' ) ';
                 $output .= "<br />{$pm['message']}<br /><br />";
             }
             if (empty($_GET['pmid'])) {
                 $output .= "\n\t\t\t\t\t\t<a href='{$current_handler}&action=delete&uid={$_GET['touid']}'>" . __('Delete All Message From This user', 'ucenter') . "</a><br />\n\t\t\t\t\t\tReply:\n\t\t\t\t\t\t<form method='post' action='{$current_handler}&action=send'>\n\t\t\t\t\t\t<input name='touid' type='hidden' value='{$_GET['touid']}'>\n\t\t\t\t\t\t<textarea name='message' cols='30' rows='5'></textarea><br />\n\t\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t\t";
             }
             break;
         case 'delete':
             if (uc_pm_deleteuser($uid, array($_GET['uid']))) {
                 $output .= __('Deleted', 'ucenter');
             }
             break;
         case 'addblacklist':
             $user = !empty($_GET['user']) ? $_GET['user'] : (!empty($_POST['user']) ? $_POST['user'] : '');
             if (uc_pm_blackls_add($uid, $user)) {
                 $output .= $_GET['user'] . __('has been added to your black list', 'ucenter');
             }
             break;
         case 'deleteblacklist':
             if (uc_pm_blackls_delete($uid, $_GET['user'])) {
                 $output .= $_GET['user'] . __('has been removed from your black list', 'ucenter');
             }
             break;
         case 'blacklist':
             $data = explode(',', uc_pm_blackls_get($uid));
             foreach ($data as $ls) {
                 $ls && ($output .= "{$ls} <a href='{$current_handler}&action=deleteblacklist&user={$ls}'>" . __('Remove', 'ucenter') . "</a>");
             }
             $output .= "\n\t\t\t\t\t<form method='post' action='{$current_handler}&action=addblacklist'>\n\t\t\t\t\t<input type='input' name='user' value=''>\n\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t</form>\n\t\t\t\t\t";
             break;
         case 'send':
             if (!empty($_POST)) {
                 if (!empty($_POST['touser'])) {
                     $msgto = $_POST['touser'];
                     $isusername = 1;
                 } else {
                     $msgto = $_POST['touid'];
                     $isusername = 0;
                 }
                 if (uc_pm_send($uid, $msgto, $_POST['subject'], $_POST['message'], 1, 0, $isusername)) {
                     $output .= __('Sended', 'ucenter');
                 } else {
                     $output .= __('Failed', 'ucenter');
                 }
             } else {
                 $output .= "\n\t\t\t\t\t\t<form method='post' action='{$current_handler}&action=send'>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr><td>" . __('to', 'ucenter') . ":</td><td><input name='touser' value='{$_GET['touser']}'></td></tr>\n\t\t\t\t\t\t<tr><td>" . __('subject', 'ucenter') . ":</td><td><input name='subject' value=''><br></td></tr>\n\t\t\t\t\t\t<tr><td>" . __('content', 'ucenter') . ":</td><td><textarea name='message' cols='30' rows='5'></textarea></td></tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<input type='submit'>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t\t";
             }
             break;
     }
     echo $output;
     echo '</div>';
 }
コード例 #19
0
ファイル: spacecp_pm.php プロジェクト: Kingson4Wu/php_demo
    $touid = empty($_GET['touid']) ? 0 : intval($_GET['touid']);
}
$daterange = empty($_GET['daterange']) ? 1 : intval($_GET['daterange']);
loaducenter();
if ($_GET['op'] == 'checknewpm') {
    if ($_G['uid']) {
        $ucnewpm = uc_pm_checknew($_G['uid']);
        if ($_G['member']['newpm'] != $ucnewpm) {
            DB::query("UPDATE " . DB::table('common_member') . " SET newpm='{$ucnewpm}' WHERE uid='{$_G['uid']}'");
        }
    }
    dsetcookie('checkpm', 1, 30);
    exit;
} elseif ($_GET['op'] == 'getpmuser') {
    $otherpm = $json = array();
    $result = uc_pm_list($_G['uid'], 1, 30, 'inbox', 'privatepm');
    foreach ($result['data'] as $key => $value) {
        $value['msgfrom'] = daddslashes($value['msgfrom']);
        $value['avatar'] = avatar($value['msgfromid'], 'small', true);
        if ($value['new']) {
            $json[$value['msgfromid']] = "{$value['msgfromid']}:{'uid':{$value['msgfromid']}, 'username':'******'msgfrom']}', 'avatar':'{$value['avatar']}', 'pmid':{$value['pmid']}, 'new':{$value['new']}, 'daterange':{$value['daterange']}}";
        } else {
            $otherpm[$value['msgfromid']] = "{$value['msgfromid']}:{'uid':{$value['msgfromid']}, 'username':'******'msgfrom']}', 'avatar':'{$value['avatar']}', 'pmid':{$value['pmid']}, 'new':{$value['new']}, 'daterange':{$value['daterange']}}";
        }
    }
    if (!empty($otherpm)) {
        $json = array_merge($json, $otherpm);
    }
    $jsstr = "{'userdata':{" . implode(',', $json) . "}}";
} elseif ($_GET['op'] == 'showmsg') {
    $msgonly = empty($_G['gp_msgonly']) ? 0 : intval($_G['gp_msgonly']);
コード例 #20
0
     $data = uc_pm_view($_GET['uid'], 0, $_GET['touid'], 5);
     //print_r($data);
     $data = array_reverse($data);
     showtableheaders(dstripslashes($_GET['username']) . $toolslang['uc_pmhis']);
     showsubtitle(array($toolslang['uc_pmfrom'], $toolslang['uc_pmtoer'], $toolslang['uc_pmcontent'], $toolslang['uc_pmtime']));
     foreach ($data as $key => $value) {
         $showdata[1] = DB::result_first("SELECT username FROM " . DB::table('common_member') . " WHERE uid = {$value['authorid']}");
         $showdata[2] = DB::result_first("SELECT username FROM " . DB::table('common_member') . " WHERE uid = {$value['touid']}");
         $showdata[3] = $value['message'];
         $showdata[4] = date('Y-m-d H:i', $value['dateline']);
         showtablerow('', array(), $showdata);
     }
     showtablerow('', array('class="td25"'), array('', '', '', '', $multipage));
     showtablefooter();
 } else {
     $data = uc_pm_list($msgfromid, $page, $ppp, 'inbox', 'privatepm', '', 100);
     $count = $data['count'];
     $multipage = multi($count, $ppp, $page, ADMINSCRIPT . "?action=plugins&pmod=maintain&cp=aboutucenter&operation={$operation}&do={$do}&mod=pm&username={$_GET['username']}&submit=yes");
     $data = $data[data];
     //print_r($data);
     showtableheaders(dstripslashes($_GET['username']) . $toolslang['uc_pmhli']);
     showsubtitle(array($toolslang['uc_pmusername'], $toolslang['uc_relausername'], $toolslang['uc_pmlastcontent'], $toolslang['uc_pmtime']));
     if (is_array($data)) {
         foreach ($data as $key => $value) {
             $showdata[1] = DB::result_first("SELECT username FROM " . DB::table('common_member') . " WHERE uid = {$value['uid']}");
             $showdata[2] = $value['tousername'];
             $showdata[3] = $value['message'] . "<a href=" . ADMINSCRIPT . "?action=plugins&pmod=maintain&cp=aboutucenter&operation={$operation}&do={$do}&mod=pm&uid={$value['uid']}&touid={$value['touid']}&submit=yes> (detail)</a>";
             $showdata[4] = date('Y-m-d H:i', $value['dateline']);
             showtablerow('', array(), $showdata);
         }
     }