<?php
/*
[UCenter] (C)2001-2099 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: pm.php 1059 2011-03-01 07:25:09Z monkey $
*/
!defined('IN_UC') && exit('Access Denied');
define('PMINBALCKLIST_ERROR', -6);
define('PMSENDSELF_ERROR', -8);
define('PMSENDNONE_ERROR', -9);
define('PMSENDCHATNUM_ERROR', -10);
define('PMTHREADNONE_ERROR', -11);
define('PMPRIVILEGENONE_ERROR', -12);
define('PMCHATTYPE_ERROR', -13);
define('PMUIDTYPE_ERROR', -14);
define('PMDATA_ERROR', -15);
class pmmodel {
var $db;
var $base;
function __construct(&$base) {
$this->pmmodel($base);
}
function pmmodel(&$base) {
$this->base = $base;
$this->db = $base->db;
}
function pmintval($pmid) {
return @is_numeric($pmid) ? $pmid : 0;
}
function getpmbypmid($uid, $pmid) {
if(!$pmid) {
return array();
}
$arr = array();
$pm = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pm_indexes i LEFT JOIN ".UC_DBTABLEPRE."pm_lists t ON t.plid=i.plid WHERE i.pmid='$pmid'");
if($this->isprivilege($pm['plid'], $uid)) {
$pms = $this->db->fetch_all("SELECT t.*, p.*, t.authorid as founderuid, t.dateline as founddateline FROM ".UC_DBTABLEPRE.$this->getposttablename($pm['plid'])." p LEFT JOIN ".UC_DBTABLEPRE."pm_lists t ON t.plid=p.plid WHERE p.pmid='$pm[pmid]'");
$arr = $this->getpostlist($pms);
}
return $arr;
}
function isprivilege($plid, $uid) {
if(!$plid || !$uid) {
return true;
}
$query = $this->db->query("SELECT * FROM ".UC_DBTABLEPRE."pm_members WHERE plid='$plid' AND uid='$uid'");
if($this->db->fetch_array($query)) {
return true;
} else {
return false;
}
}
function getpmbyplid($uid, $plid, $starttime, $endtime, $start, $ppp, $type = 0) {
if(!$type) {
$pm = $this->getprivatepmbyplid($uid, $plid, $starttime, $endtime, $start, $ppp);
} else {
$pm = $this->getchatpmbyplid($uid, $plid, $starttime, $endtime, $start, $ppp);
}
return $this->getpostlist($pm);
}
function getpostlist($list) {
if(empty($list)) {
return array();
}
$authoridarr = $authorarr = array();
foreach($list as $key => $value) {
$authoridarr[$value['authorid']] = $value['authorid'];
}
if($authoridarr) {
$this->base->load('user');
$authorarr = $_ENV['user']->id2name($authoridarr);
}
foreach($list as $key => $value) {
if($value['pmtype'] == 1) {
$users = explode('_', $value['min_max']);
if($value['authorid'] == $users[0]) {
$value['touid'] = $users[1];
} else {
$value['touid'] = $users[0];
}
} else {
$value['touid'] = 0;
}
$value['author'] = $authorarr[$value['authorid']];
$value['msgfromid'] = $value['authorid'];
$value['msgfrom'] = $value['author'];
$value['msgtoid'] = $value['touid'];
unset($value['min_max']);
unset($value['delstatus']);
unset($value['lastmessage']);
$list[$key] = $value;
}
return $list;
}
function setpmstatus($uid, $touids, $plids, $status = 0) {
if(!$uid) {
return false;
}
if(!$status) {
$oldstatus = 1;
$newstatus = 0;
} else {
$oldstatus = 0;
$newstatus = 1;
}
if($touids) {
foreach($touids as $key => $value) {
if($uid == $value || !$value) {
return false;
}
$relastionship[] = $this->relationship($uid, $value);
}
$plid = $plidpostarr = array();
$query = $this->db->query("SELECT plid FROM ".UC_DBTABLEPRE."pm_lists WHERE min_max IN (".$this->base->implode($relationship).")");
while($thread = $this->db->fetch_array($query)) {
$plidarr[] = $thread['plid'];
}
if($plidarr) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew='$newstatus' WHERE plid IN (".$this->base->implode($plidarr).") AND uid='$uid' AND isnew='$oldstatus'");
}
}
if($plids) {
$this->db->query("UPDATE ".UC_DBTABLEPRE."pm_members SET isnew='$newstatus' WHERE plid IN (".$this->base->implode($plids).") AND uid='$uid' AND isnew='$oldstatus'");
}
return true;
}
function set_ignore($uid) {
return $this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");
}
function isnewpm($uid) {
return $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");
}
function lastpm($uid) {
$lastpm = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pm_members m LEFT JOIN ".UC_DBTABLEPRE."pm_lists t ON m.plid=t.plid WHERE m.uid='$uid' ORDER BY m.lastdateline DESC LIMIT 1");
$lastmessage = unserialize($lastpm['lastmessage']);
if($lastmessage['lastauthorid']) {
$lastpm['lastauthorid'] = $lastmessage['lastauthorid'];
$lastpm['lastauthor'] = $lastmessage['lastauthor'];
$lastpm['lastsummary'] = $lastmessage['lastsummary'];
} else {
$lastpm['lastauthorid'] = $lastmessage['firstauthorid'];
$lastpm['lastauthor'] = $lastmessage['firstauthor'];
$lastpm['lastsummary'] = $lastmessage['firstsummary'];
}
return $lastpm;
}
function getpmnum($uid, $type = 0, $isnew = 0) {
$newsql = '';
$newnum = 0;
if($isnew) {
$newsql = 'AND m.isnew=1';
}
if(!$type) {
$newnum = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pm_members m WHERE m.uid='$uid' $newsql");
} else {
$newnum = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pm_members m LEFT JOIN ".UC_DBTABLEPRE."pm_lists t ON t.plid=m.plid WHERE m.uid='$uid' $newsql AND t.pmtype='$type'");
}
return $newnum;
}
function getpmnumbyplid($uid, $plid) {
return $this->db->result_first("SELECT pmnum FROM ".UC_DBTABLEPRE."pm_members WHERE plid='$plid' AND uid='$uid'");
}
function sendpm($fromuid, $fromusername, $touids, $subject, $message, $type = 0) {
if(!$fromuid || !$fromusername || !$touids || !$message) {
return 0;
}
$touids = array_unique($touids);
$relationship = $existplid = $pm_member_insertsql = array();
$this->base->load('user');
$tmptouidarr = $touids;
$blackls = $this->get_blackls($fromuid, $touids);
foreach($tmptouidarr as $key => $value) {
if($fromuid == $value || !$value) {
return PMSENDSELF_ERROR;
}
if(in_array('{ALL}', $blackls[$value])) {
unset($touids[$key]);
continue;
}
$blackls[$value] = $_ENV['user']->name2id($blackls[$value]);
if(!(isset($blackls[$value]) && !in_array($fromuid, $blackls[$value]))) {
unset($touids[$key]);
} else {
$relationship[$value] = $this->relationship($fromuid, $value);
}
}
if(empty($touids)) {
return PMSENDNONE_ERROR;
}
if($type == 1 && count($touids) < 2) {
return PMSENDCHATNUM_ERROR;
}
$_CACHE['badwords'] = $this->base->cache('badwords');
if($_CACHE['badwords']['findpattern']) {
$subject = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $subject);
$message = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $message);
}
if(!$subject) {
$subject = $this->removecode(trim($message), 80);
} else {
$subject = htmlspecialchars($subject);
}
$lastsummary = $this->removecode(trim($message), 150);
if(!$type) {
$query = $this->db->query("SELECT plid, min_max FROM ".UC_DBTABLEPRE."pm_lists WHERE min_max IN (".$this->base->implode($relationship).")");
while($thread = $this->db->fetch_array($query)) {
$existplid[$thread['min_max']] = $thread['plid'];
}
$lastmessage = array('lastauthorid' => $fromuid, 'lastauthor' => $fromusername, 'lastsummary' => $lastsummary);
$lastmessage = addslashes(serialize($lastmessage));
foreach($relationship as $key => $value) {
if(!isset($existplid[$value])) {
$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pm_lists(authorid, pmtype, subject, members, min_max, dateline, lastmessage) VALUES('$fromuid', '1', '$subject', 2, '$value', '".$this->base->time."', '$lastmessage')");
$plid = $thi
没有合适的资源?快使用搜索试试~ 我知道了~
Discuz模板 艺佰地方门户GBK4.0 整站带演示数据+模板.zip
共2000个文件
htm:850个
png:422个
gif:368个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 8 浏览量
2023-11-20
11:05:22
上传
评论
收藏 24.79MB ZIP 举报
温馨提示
1.整站安装是建立新站的会员,直接放到主机内运行http://您的域名/install安装即可,然后到后台的工具-数据库-恢复数据库,恢复一下数据库即可,然后再去后台的系统配置里面配置一下站点名称,域名等等,超级简单吧! 2.模板的话,先把template文件夹覆盖到你的已经安装好的discuz站点上,然后再用diy导入功能把diy文件夹里面的xml文件导入到对应的页面即可;
资源推荐
资源详情
资源评论
收起资源包目录
Discuz模板 艺佰地方门户GBK4.0 整站带演示数据+模板.zip (2000个子文件)
style_2_module.css 138KB
module.css 116KB
common.css 92KB
style_1_module.css 91KB
style_2_common.css 78KB
style_1_common.css 68KB
style_2_forum_viewthread.css 59KB
extend_module.css 52KB
extend_module.css 52KB
style_2_forum_forumdisplay.css 41KB
admincp.css 32KB
page.css 26KB
style_2_home_space.css 26KB
style_1_forum_forumdisplay.css 19KB
style.css 18KB
public.css 17KB
style_2_portal_view.css 15KB
chanpin.css 14KB
css_diy.css 12KB
tipbox.css 11KB
style_2_home_spacecp.css 11KB
taxincome.css 11KB
style_2_portal_index.css 11KB
style_2_css_diy.css 11KB
style_1_css_diy.css 11KB
discuzindex.css 11KB
extend_common.css 11KB
extend_common.css 11KB
admincp.css 10KB
result.css 10KB
index.css 10KB
zuhejsq.css 10KB
style_2_forum_index.css 9KB
style.css 9KB
public.css 9KB
style.css 8KB
qqgroup.css 8KB
style_2_portal_list.css 7KB
style_2_forum_post.css 7KB
editor.css 6KB
jisuanqi.css 6KB
list.css 6KB
home.css 6KB
style_2_editor.css 5KB
style_1_editor.css 5KB
switch_city.css 5KB
style_2_forum_guide.css 5KB
style.css 5KB
style_2_portal_portalcp.css 4KB
style.css 4KB
style.css 4KB
css_space.css 4KB
style.css 4KB
style_1_forum_index.css 4KB
style.css 4KB
forum_moderator.css 4KB
style.css 3KB
style.css 3KB
style.css 3KB
style.css 3KB
style_2_css_space.css 3KB
style_1_css_space.css 3KB
style.css 3KB
style_2_forum_moderator.css 3KB
style_1_forum_moderator.css 3KB
style.css 3KB
base.css 2KB
widthauto.css 2KB
extend_module.css 2KB
forum_calendar.css 1KB
style_2_widthauto.css 1KB
style_1_widthauto.css 1KB
cloud.css 1KB
wysiwyg.css 1KB
rss.css 1KB
style_2_wysiwyg.css 1KB
style.css 1KB
style_1_wysiwyg.css 1KB
style_1_forum_calendar.css 1KB
style_2_forum_calendar.css 1KB
style_1_rss.css 1KB
style_2_rss.css 1KB
style.css 1KB
style.css 876B
style.css 849B
style.css 761B
style.css 753B
style.css 679B
style.css 655B
style.css 562B
style.css 516B
style.css 480B
apply.css 475B
extend_module.css 210B
extend_module.css 192B
extend_common.css 68B
style.css 53B
extstyle_none.css 1B
extstyle_none.css 1B
extstyle_none.css 1B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
智慧浩海
- 粉丝: 1w+
- 资源: 5431
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功