在线查看源代码php源码,pm.php 源代码在线查看 - Discuz功能源码(开源) 资源下载 虫虫电子下载站...

$sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'");if(!$sessionexist) {$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')");$lastpmid = $this->db->insert_id();} else {$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET subject='$subject', message='$message', dateline='".$this->base->time."', new='1', fromappid='".$this->base->app['appid']."'WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'");}if(!$savebox) {$sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgto' AND msgtoid='$msgfrom[uid]' AND folder='inbox' AND related='0'");if($msgfrom['uid'] && !$sessionexist) {$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES('".$msgfrom['username']."','$msgto','".$msgfrom['uid']."','$box','0','$subject','".$this->base->time."','0','$message','0')");}$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','1','$message','".$this->base->app['appid']."')");$lastpmid = $this->db->insert_id();}} else {$this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')");$lastpmid = $this->db->insert_id();}$this->db->query("REPLACE INTO ".UC_DBTABLEPRE."newpm (uid) VALUES ('$msgto')");return $lastpmid;}function set_ignore($uid) {$this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");}function check_newpm($uid, $more) {if($more < 2) {$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'");if($newpm) {$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'");if($more) {$newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'");return array('newpm' => $newpm, 'newprivatepm' => $newprvpm);} else {return $newpm;}}} else {$newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'");$newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'");if($more == 2 || $more == 3) {$annpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='0' AND folder='inbox'");$syspm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='$uid' AND folder='inbox' AND msgfromid='0'");}if($more == 2) {return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm);} if($more == 4) {return array('newpm' => $newpm, 'newprivatepm' => $newprvpm);} else {$pm = $this->db->fetch_first("SELECT pm.dateline,pm.msgfromid,m.username as msgfrom,pm.message FROM ".UC_DBTABLEPRE."pms pm LEFT JOIN ".UC_DBTABLEPRE."members m ON pm.msgfromid = m.uid WHERE (pm.related='0' OR pm.msgfromid='0') AND pm.msgtoid='$uid' AND pm.folder='inbox' ORDER BY pm.dateline DESC LIMIT 1");return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm, 'lastdate' => $pm['dateline'], 'lastmsgfromid' => $pm['msgfromid'], 'lastmsgfrom' => $pm['msgfrom'], 'lastmsg' => $pm['message']);}}}function deletepm($uid, $pmids) {$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' AND pmid IN (".$this->base->implode($pmids).")");$delnum = $this->db->affected_rows();return $delnum;}function deleteuidpm($uid, $ids) {$delnum = 0;if($ids) {$delnum = 1;$deluids = $this->base->implode($ids);$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pmsWHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND related='0'", 'UNBUFFERED');$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=2WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED');$this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=1WHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED');$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pmsWHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND delstatus=1 AND folder='inbox'", 'UNBUFFERED');$this->db->query("DELETE FROM ".UC_DBTABLEPRE."pmsWHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND delstatus=2 AND folder='inbox'", 'UNBUFFERED');}return $delnum;}function get_blackls($uid, $uids = array()) {if(!$uids) {$blackls = $this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'");} else {$uids = $this->base->implode($uids);$blackls = array();$query = $this->db->query("SELECT uid, blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid IN ($uids)");while($data = $this->db->fetch_array($query)) {$blackls[$data['uid']] = explode(',', $data['blacklist']);}}return $blackls;}function set_blackls($uid, $blackls) {$this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'");return $this->db->affected_rows();}function update_blackls($uid, $username, $action = 1) {$username = !is_array($username) ? array($username) : $username;if($action == 1) {if(!in_array('{ALL}', $username)) {$usernames = $this->base->implode($username);$query = $this->db->query("SELECT username FROM ".UC_DBTABLEPRE."members WHERE username IN ($usernames)");$usernames = array();while($data = $this->db->fetch_array($query)) {$usernames[addslashes($data['username'])] = addslashes($data['username']);}if(!$usernames) {return 0;}$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));if($blackls) {$list = explode(',', $blackls);foreach($list as $k => $v) {if(in_array($v, $usernames)) {unset($usernames[$v]);}}}if(!$usernames) {return 1;}$listnew = implode(',', $usernames);$blackls .= $blackls !== '' ? ','.$listnew : $listnew;} else {$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));$blackls .= ',{ALL}';}} else {$blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"));$list = $blackls = explode(',', $blackls);foreach($list as $k => $v) {if(in_array($v, $username)) {unset($blackls[$k]);}}$blackls = implode(',', $blackls);}$this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'");return 1;}function removecode($str, $length) {$bbcodes = 'b|i|u|color|size|font|align|list|indent|url|email|code|img|float';$str = $this->base->cutstr(preg_replace(array("/\[quote].*\[\/quote]/siU","/\[($bbcodes)=?.*\].*\[\/($bbcodes)\]/siU",), '', $str), $length);return trim($str);}function count_pm_by_fromuid($uid, $timeoffset = 86400) {$dateline = $this->base->time - intval($timeoffset);return $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' AND dateline>'$dateline'");}function is_reply_pm($uid, $touids) {$touid_str = implode("', '", $touids);$pm_reply = $this->db->fetch_all("SELECT msgfromid, msgtoid FROM ".UC_DBTABLEPRE."pms WHERE msgfromid IN ('$touid_str') AND msgtoid='$uid' AND related=1", 'msgfromid');foreach($touids as $val) {if(!isset($pm_reply[$val])) {return false;}}return true;}}function pm_datelinesort($a, $b) {if ($a['dateline'] == $b['dateline']) {return 0;}return ($a['dateline'] < $b['dateline']) ? -1 : 1;}?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值