function send_msgc($msg, $isNotify = true) { global $db; if (!is_array($msg)) { return; } $uid = $sql = $mc_sql = array(); foreach ($msg as $k => $v) { if (is_array($v)) { $sql[] = array($v[0], $v[1], $v[2], $v[3], $v[4], $v[5]); $uid[] = $v[0]; } } if ($sql) { $db->update("INSERT INTO pw_msg(touid,fromuid,username,type,ifnew,mdate) VALUES " . pwSqlMulti($sql, false)); $mid = $db->insert_id(); foreach ($msg as $k => $v) { if (is_array($v)) { $mc_sql[] = array($mid++, $v[6], $v[7]); } } if ($mc_sql) { $db->update("REPLACE INTO pw_msgc(mid,title,content) VALUES " . pwSqlMulti($mc_sql, false)); } updateNewpm($uid, 'add'); } }
InitGP(array('delid'), 'P'); } !$delid && adminmsg('operate_error'); foreach ($delid as $value) { is_numeric($value) && ($delids[] = $value); } $delids = pwImplode($delids); $query = $db->query("SELECT touid FROM pw_msg WHERE mid IN({$delids})"); while ($rt = $db->fetch_array($query)) { $uiddb[] = $rt['touid']; } $uiddb = array_unique($uiddb); $db->update("DELETE FROM pw_msg WHERE mid IN ({$delids})"); require_once R_P . 'require/msg.php'; delete_msgc($delids); $type != 'public' && updateNewpm($uiddb, 'recount'); adminmsg('operate_success', "{$admin_file}?adminjob=superdel&admintype=message&action={$action}&type={$type}&keepnew={$keepnew}&msgdate={$msgdate}&fromuser="******"&touser="******"&lines={$lines}&page={$page}"); } } elseif ($action == 'msglog') { $pwServer['REQUEST_METHOD'] != 'POST' && PostCheck($verify); InitGP(array('msgdate', 'lines', 'delnum')); !$delnum && ($delnum = 0); $sql = "1"; if ($msgdate) { $schtime = $timestamp - $msgdate * 24 * 3600; $sql .= " AND mdate<" . pwEscape($schtime); } $lines < 1 && ($lines = 100); $delids = array(); $query = $db->query("SELECT DISTINCT mid FROM pw_msglog WHERE {$sql} LIMIT {$lines}"); while ($rt = $db->fetch_array($query)) {
$mc_sql[] = array($mid, $msg_title, $atc_content); if (isset($msglog[$i])) { $ml_sql[] = array($mid, $winduid, $msglog[$i], $timestamp, 'send'); $ml_sql[] = array($mid, $msglog[$i], $winduid, $timestamp, 'receive'); } $mid++; } if ($mc_sql) { $db->update("REPLACE INTO pw_msgc(mid,title,content) VALUES " . pwSqlMulti($mc_sql)); } if ($ml_sql) { $db->update("REPLACE INTO pw_msglog(mid,uid,withuid,mdate,mtype) VALUES " . pwSqlMulti($ml_sql)); } } if ($ifuids) { updateNewpm($ifuids, 'add'); } Showmsg('send_success'); } } elseif ($action == 'pcifalipay') { $trade = $db->get_one("SELECT tradeinfo FROM pw_memberinfo WHERE uid=" . pwEscape($winduid)); $trade = unserialize($trade['tradeinfo']); if (!$trade['alipay']) { echo 'fail'; } ajax_footer(); } elseif ($action == 'pcdelimg') { InitGP(array('fieldname', 'pctype')); InitGP(array('tid', 'id'), 2); if (!$tid || !$id || !$fieldname || !$pctype) { echo 'fail';
if (strpos($delmsg, ",{$val},") === false) { $delmsg .= $val . ','; } } $readmsg = msgsort(substr($readmsg, 1, -1)); $delmsg = msgsort(substr($delmsg, 1, -1)); $db->update("UPDATE pw_memberinfo SET " . pwSqlSingle(array('readmsg' => $readmsg, 'delmsg' => $delmsg)) . " WHERE uid=" . pwEscape($winduid)); } else { $delmsg = msgsort($delids); $db->update("INSERT INTO pw_memberinfo SET " . pwSqlSingle(array('uid' => $winduid, 'delmsg' => $delmsg))); } } if ($towhere == 'scout') { updateNewpm($touiddb, 'recount'); } else { updateNewpm($winduid, 'recount'); } if ($type) { $refreshto = "message.php?action={$towhere}&type={$type}"; } else { $refreshto = "message.php?action={$towhere}"; } refreshto($refreshto, 'operate_success'); } elseif ($action == 'down') { $downids = $pdownids = array(); InitGP(array('delid', 'pdelid', 'towhere')); if (is_array($delid)) { foreach ($delid as $value) { is_numeric($value) && ($downids[] = $value); } $downids && ($downids = pwImplode($downids));