/** * 添加 * * @param array $fieldsData 数据数组,以数据库字段为key * @return int 新增id */ function insert($fieldsData) { if (S::isArray($fieldsData)) { pwQuery::insert($this->_tableName, $fieldsData); return $this->_db->insert_id(); } }
function addRewardRecord($data) { $data = $this->_checkAllowField($data, $this->_allowFields); if (!S::isArray($data)) { return false; } return pwQuery::insert($this->_tableName, $data); }
/** * 添加 * * @param array $fieldsData 数据数组,以数据库字段为key */ function insertMemberTags($fieldsData) { if (!S::isArray($fieldsData)) { return false; } pwQuery::insert($this->_tableName, $fieldsData); return true; }
function insert($fieldData) { $fieldData = $this->_checkData($fieldData); if (!$fieldData) { return false; } if (!$fieldData['uid'] || !$fieldData['behavior']) { return false; } return pwQuery::insert($this->_tableName, $fieldData); }
function add($username, $pwd, $email) { $this->db->update("INSERT INTO pw_members SET " . UC::sqlSingle(array('username' => $username, 'password' => $pwd, 'email' => $email, 'groupid' => 0, 'regdate' => $this->base->time))); $uid = $this->db->insert_id(); /** $this->db->update("INSERT INTO pw_memberdata SET " . $this->base->sqlSingle(array( 'uid' => $uid, 'lastvisit' => $this->base->time, 'thisvisit' => $this->base->time, 'onlineip' => $this->base->onlineip ))); **/ pwQuery::insert('pw_memberdata', array('uid' => $uid, 'lastvisit' => $this->base->time, 'thisvisit' => $this->base->time, 'onlineip' => $this->base->onlineip)); return $uid; }
(!$atc_content || strlen($atc_content) == 0) && Showmsg('annouce_content'); /** $pwSQL = S::sqlSingle(array( 'fid' => $fid, 'ifopen' => $ifopen, 'vieworder' => $vieworder, 'author' => $windid, 'startdate' => $startdate, 'enddate' => $enddate, 'url' => $url, 'subject' => $atc_title, 'content' => $atc_content )); $db->update("INSERT INTO pw_announce SET $pwSQL"); **/ pwQuery::insert('pw_announce', array('fid' => $fid, 'ifopen' => $ifopen, 'vieworder' => $vieworder, 'author' => $windid, 'startdate' => $startdate, 'enddate' => $enddate, 'url' => $url, 'subject' => $atc_title, 'content' => $atc_content)); if ($ifopen && (!$enddate || $enddate >= $timestamp)) { require_once R_P . 'require/updatenotice.php'; updatecache_i_i($fid); } } else { $rt = $db->get_one('SELECT aid,fid,content FROM pw_announce WHERE aid=' . S::sqlEscape($aid)); !$atc_title && Showmsg('annouce_title'); !$atc_content && Showmsg('annouce_content'); (!$rt['aid'] || $rt['fid'] != $fid) && Showmsg('data_error'); $pwSQL = array('ifopen' => $ifopen, 'vieworder' => $vieworder, 'startdate' => $startdate, 'enddate' => $enddate, 'url' => $url, 'subject' => $atc_title, 'content' => $atc_content); //* $db->update("UPDATE pw_announce SET $pwSQL WHERE aid=".S::sqlEscape($aid)); pwQuery::update('pw_announce', 'aid=:aid', array($aid), $pwSQL); require_once R_P . 'require/updatenotice.php'; updatecache_i_i($fid); }
function updateForumPostTop($fidArr) { global $db; if (!is_array($fidArr)) { return false; } $postTopData = array(); $query = $db->query("SELECT * FROM pw_poststopped WHERE floor = 3 GROUP BY tid "); while ($row = $db->fetch_array($query)) { $postTopData[] = $row; } foreach ($postTopData as $key => $value) { foreach ($fidArr as $fid) { pwQuery::insert('pw_poststopped', array('fid' => $fid, 'tid' => $value['tid'], 'pid' => $value['pid'], 'floor' => $value['floor'], 'uptime' => $value['uptime'], 'overtime' => $value['overtime'])); } } updatetop(); }
$pwSQL = S::sqlSingle(array( 'uid' => $winduid, 'dtid' => $dtid, 'username' => $windid, 'privacy' => $privacy, 'subject' => $diary['subject'], // 'content' => $diary['content'], 'copyurl' => $diary['copyurl'], 'ifcopy' => $diary['ifcopy'], 'ifconvert' => $diary['ifconvert'], 'ifwordsfb' => $diary['ifwordsfb'], 'postdate' => $timestamp, )); $db->update("INSERT INTO pw_diary SET $pwSQL");****/ $pwSQL = array('uid' => $winduid, 'dtid' => $dtid, 'username' => $windid, 'privacy' => $privacy, 'subject' => $diary['subject'], 'copyurl' => $diary['copyurl'], 'ifcopy' => $diary['ifcopy'], 'ifconvert' => $diary['ifconvert'], 'ifwordsfb' => $diary['ifwordsfb'], 'postdate' => $timestamp); pwQuery::insert('pw_diary', $pwSQL); $did = $db->insert_id(); $db->update("UPDATE pw_diarytype SET num=num+1 WHERE uid=" . S::sqlEscape($winduid) . " AND dtid=" . S::sqlEscape($dtid)); //更新分类日志数 //*=======拷贝图片待优化===========*// $diaryAttachs = $diary['aid'] ? unserialize($diary['aid']) : array(); L::loadClass('upload', '', false); require_once R_P . 'require/imgfunc.php'; $uploadSerivce = new PwUpload(); $ifthumb = 0; if ($o_attachdir) { if ($o_attachdir == 1) { $savedir = "Type_{$attach_ext}"; } elseif ($o_attachdir == 2) { $savedir = 'Mon_' . date('ym'); } elseif ($o_attachdir == 3) {
function doPing($cid, $addpoint, $params = array()) { global $credit, $winddb, $winduid, $windid, $timestamp, $onlineip, $gp_gptype; require_once R_P . 'require/credit.php'; $add_c = $tmp = $pingLog = array(); if (is_array($cid)) { foreach ($cid as $k => $v) { if ($v && isset($credit->cType[$v]) && is_numeric($addpoint[$k]) && $addpoint[$k] != 0) { if (!isset($this->markset[$v])) { return 'masigle_credit_right'; } $tmp[$v] += intval($addpoint[$k]); } } foreach ($tmp as $k => $v) { if (!$v) { continue; } if ($v > $this->markset[$k]['maxper'] || $v < $this->markset[$k]['minper']) { $GLOBALS['limitCreditType'] = $k; //GLOBAL $GLOBALS['markset'] = $this->markset; //GLOBAL return 'masigle_creditlimit'; } $add_c[$k] = $v; } } if (empty($add_c)) { return 'member_credit_error'; } if (strlen($params['atc_content']) > 100) { return 'showping_content_too_long'; } $count = count($this->postData); foreach ($add_c as $k => $v) { $allpoint = abs($v) * $count; if ($allpoint > $this->markset[$k]['leavepoint']) { $GLOBALS['leavepoint'] = $this->markset[$k]['leavepoint']; return 'masigle_point'; } if (isset($this->userCreditInfo[$k])) { $this->userCreditInfo[$k]['pingdate'] = $timestamp; $this->userCreditInfo[$k]['pingnum'] += $allpoint; } else { $this->userCreditInfo[$k] = array('pingdate' => $timestamp, 'pingnum' => $allpoint, 'pingtype' => $k); } //需扣除积分 if ($this->markset[$k]['markdt'] && $allpoint > 0) { if ($credit->get($winduid, $k) < $allpoint) { return 'credit_enough'; } $credit->set($winduid, $k, -$allpoint, false); } } $newcreditdb = ''; foreach ($this->userCreditInfo as $v) { $newcreditdb .= ($newcreditdb ? '|' : '') . implode("\t", $v); } //更新用户评分信息 $userService = L::loadClass('UserService', 'user'); /* @var $this->userService PW_UserService */ $userService->update($winduid, array(), array(), array('credit' => $newcreditdb)); $singlepoint = array_sum($add_c); require_once R_P . 'require/showimg.php'; //* $threadService = L::loadClass("threads", 'forum'); foreach ($this->postData as $pid => $atc) { !$atc['subject'] && ($atc['subject'] = substrs(strip_tags(convert($atc['content'])), 35)); /*积分日志*/ $credit->addLog('credit_showping', $add_c, array('uid' => $atc['authorid'], 'username' => $atc['author'], 'ip' => $onlineip, 'operator' => $windid, 'tid' => $this->tid, 'subject' => $atc['subject'], 'reason' => $params['atc_content'])); //为被评用户增加积分 $credit->sets($atc['authorid'], $add_c, false); if (!is_numeric($pid)) { //主题时,更新总评分数 //* $this->db->update("UPDATE pw_threads SET ifmark=ifmark+" . S::sqlEscape($singlepoint)." WHERE tid=" . S::sqlEscape($tid)); $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET ifmark=ifmark+:ifmark WHERE tid=:tid", array('pw_threads', $singlepoint, $this->tid))); $rpid = 0; } else { $rpid = $pid; } $pwSQL = $ping = array(); $affect = ''; list($ping['pingtime'], $ping['pingdate']) = getLastDate($timestamp - 1); //list($face) = showfacedesign($winddb['icon'],1,'m'); foreach ($add_c as $key => $value) { /*记录评分日志*/ $pwSQL = array('fid' => $this->fid, 'tid' => $this->tid, 'pid' => $rpid, 'name' => $key, 'point' => $value, 'pinger' => $windid, 'record' => $params['atc_content'], 'pingdate' => $timestamp); $affect .= ($affect ? ',' : '') . $credit->cType[$key] . ':' . $value; //$this->db->update("INSERT INTO pw_pinglog SET " . S::sqlSingle($pwSQL)); //$pingLogId = $this->db->insert_id(); $pingLogId = pwQuery::insert('pw_pinglog', $pwSQL); $pingLog[$pid][$key] = array('fid' => $this->fid, 'tid' => $this->tid, 'pid' => $pid, 'name' => $credit->cType[$key], 'point' => $value > 0 ? "+{$value}" : $value, 'pinger' => $windid, 'pingeruid' => $winduid, 'record' => $params['atc_content'] ? $params['atc_content'] : '-', 'pingtime' => $ping['pingtime'], 'pingdate' => $ping['pingdate'], 'pingLogId' => $pingLogId); } $this->update_markinfo($this->tid, $rpid); //* $threadService->clearTmsgsByThreadId($this->tid); Perf::gatherInfo('changeTmsgWithThreadIds', array('tid' => $this->tid)); $this->postData[$pid]['ifmark'] = $ifmark; if ($params['ifmsg'] && !$atc['anonymous'] && $atc['author'] != $windid) { //发消息 $title = getLangInfo('writemsg', 'ping_title', array('sender' => $windid, 'receiver' => $atc['author'])); $content = getLangInfo('writemsg', 'ping_content', array('manager' => $windid, 'fid' => $atc['fid'], 'tid' => $this->tid, 'pid' => $pid, 'subject' => $atc['subject'], 'postdate' => get_date($atc['postdate']), 'forum' => strip_tags($this->forum->foruminfo['name']), 'affect' => $affect, 'admindate' => get_date($timestamp), 'reason' => stripslashes($params['atc_content']), 'sender' => $windid, 'receiver' => $atc['author'])); $this->sendMessage($atc['author'], $title, $content); } if ($gp_gptype == 'system') { require_once R_P . 'require/writelog.php'; $log = array('type' => 'credit', 'username1' => $atc['author'], 'username2' => $windid, 'field1' => $this->fid, 'field2' => '', 'field3' => '', 'descrip' => 'credit_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $this->tid, 'forum' => strip_tags($this->forum->foruminfo['name']), 'subject' => $atc['subject'], 'affect' => $affect, 'reason' => $params['atc_content']); writelog($log); } } $credit->runsql(); defined('AJAX') && ($GLOBALS['pingLog'] = $pingLog); /*评分内容作为回复*/ if ($params['ifpost'] && $params['atc_content']) { $replyReturn = $this->addPost($this->tid, $params['atc_content']); } if ($GLOBALS['db_autoban'] && $singlepoint < 0) { require_once R_P . 'require/autoban.php'; foreach ($this->postData as $pid => $atc) { autoban($atc['authorid']); } } if ($this->forum->foruminfo['allowhtm'] && $_REQUEST['page'] == 1) { $StaticPage = L::loadClass('StaticPage'); $StaticPage->update($this->tid); } if (isset($replyReturn) && $replyReturn !== true) { $replyReturn = getLangInfo('msg', $replyReturn); return '评分已完成!回复失败,可能的原因是:' . $replyReturn; } return true; }
//* $pid = $db->insert_id(); $uniqueService = L::loadClass('unique', 'utility'); $pid = $uniqueService->getUnique('post'); } else { $pid = ''; } /*$pwSQL = S::sqlSingle(array('pid' => $pid, 'fid' => $fid, 'tid' => $totid, 'aid' => $fromdb['aid'], 'author' => $fromdb['author'], 'authorid' => $fromdb['authorid'], 'icon' => $fromdb['icon'], 'postdate' => $fromdb['postdate'], 'subject' => $fromdb['subject'], 'userip' => $fromdb['userip'], 'ifsign' => $fromdb['ifsign'], 'alterinfo' => $fromdb['alterinfo'], 'ipfrom' => $fromdb['ipfrom'], 'ifconvert' => $fromdb['ifconvert'], 'ifcheck' => $fromdb['ifcheck'], 'content' => $fromdb['content'], 'ifmark' => $fromdb['ifmark'], 'ifshield' => $fromdb['ifshield']), false); $db->update("INSERT INTO $pw_posts SET $pwSQL"); */ $pwSQL = array('pid' => $pid, 'fid' => $fid, 'tid' => $totid, 'aid' => $fromdb['aid'], 'author' => $fromdb['author'], 'authorid' => $fromdb['authorid'], 'icon' => $fromdb['icon'], 'postdate' => $fromdb['postdate'], 'subject' => $fromdb['subject'], 'userip' => $fromdb['userip'], 'ifsign' => $fromdb['ifsign'], 'alterinfo' => $fromdb['alterinfo'], 'ipfrom' => $fromdb['ipfrom'], 'ifconvert' => $fromdb['ifconvert'], 'ifcheck' => $fromdb['ifcheck'], 'content' => $fromdb['content'], 'ifmark' => $fromdb['ifmark'], 'ifshield' => $fromdb['ifshield']); pwQuery::insert($pw_posts, $pwSQL); !$pid && ($pid = $db->insert_id()); $replies += $fromdb['replies'] + 1; # $db->update('DELETE FROM pw_threads WHERE tid='.S::sqlEscape($fromdb['tid'])); # ThreadManager //* $threadManager = L::loadClass("threadmanager", 'forum'); //* $threadManager->deleteByThreadId($fromdb['fid'], $fromdb['tid']); $threadService = L::loadclass('threads', 'forum'); $threadService->deleteByThreadId($fromdb['tid']); Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fromdb['fid'])); $pw_tmsgsf = GetTtable($fromdb['tid']); //* $db->update("DELETE FROM $pw_tmsgsf WHERE tid=" . S::sqlEscape($fromdb['tid'])); pwQuery::delete($pw_tmsgsf, 'tid=:tid', array($fromdb['tid'])); if ($db_guestread) { require_once R_P . 'require/guestfunc.php'; clearguestcache($fromdb['tid'], $replies);
function add($uid, $cid, $value, $isAdd = true) { $cid == 'rvrc' && ($value *= 10); $value = intval($value); if (is_numeric($cid)) { $rt = $this->db->get_one("SELECT uid,value FROM pw_membercredit WHERE uid=" . UC::escape($uid) . ' AND cid=' . UC::escape($cid)); if ($rt) { if ($isAdd) { //* $this->db->update("UPDATE pw_membercredit SET value=value+" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid) . ' AND cid=' . UC::escape($cid)); $this->db->update(pwQuery::buildClause('UPDATE :pw_table SET value=value+:value WHERE uid=:uid AND cid=:cid', array('pw_membercredit', $value, intval($uid), $cid))); return $rt['value'] + $value; } else { //* $this->db->update("UPDATE pw_membercredit SET value=" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid) . ' AND cid=' . UC::escape($cid)); pwQuery::update('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)); return $value; } } else { //* $this->db->update("INSERT INTO pw_membercredit SET " . UC::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))); pwQuery::insert('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)); return $value; } } elseif ($this->isAllow($cid)) { if ($isAdd) { //* $this->db->update("UPDATE pw_memberdata SET $cid=$cid+" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid)); $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET {$cid}={$cid}+" . UC::escape($value) . ' WHERE uid=:uid', array('pw_memberdata', intval($uid)))); $cid == 'rvrc' && ($cid = "FLOOR(rvrc/10)"); return $this->db->get_value("SELECT {$cid} FROM pw_memberdata WHERE uid=" . UC::escape($uid)); } else { //* $this->db->update("UPDATE pw_memberdata SET $cid=" . UC::escape($value) . ' WHERE uid=' . UC::escape($uid)); $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET {$cid}=" . UC::escape($value) . ' WHERE uid=:uid', array('pw_memberdata', intval($uid)))); $cid == 'rvrc' && ($value /= 10); return $value; } } return null; }
function addColonyUser($uid, $username, $frombbs = false) { global $credit; require_once R_P . 'require/credit.php'; //积分变动 $o_groups_creditset = L::config('o_groups_creditset', 'o_config'); if (!empty($o_groups_creditset['Joingroup'])) { require_once R_P . 'u/require/core.php'; $credit->appendLogSet(L::config('o_groups_creditlog', 'o_config'), 'groups'); $creditset = getCreditset($o_groups_creditset['Joingroup'], false); $credit->addLog('groups_Joingroup', $creditset, array('uid' => $uid, 'username' => $username, 'ip' => $GLOBALS['onlineip'])); $credit->sets($uid, $creditset); } /** $this->_db->update("INSERT INTO pw_cmembers SET " . S::sqlSingle(array( 'uid' => $uid, 'username' => $username, 'ifadmin' => $this->info['ifcheck'] == 2 ? '0' : '-1', 'colonyid' => $this->cyid, 'addtime' => $GLOBALS['timestamp'] ))); **/ pwQuery::insert('pw_cmembers', array('uid' => $uid, 'username' => $username, 'ifadmin' => $this->info['ifcheck'] == 2 ? '0' : '-1', 'colonyid' => $this->cyid, 'addtime' => $GLOBALS['timestamp'])); if ($this->info['ifcheck'] == 2) { $this->updateInfoCount(array('members' => 1)); } $this->_sendJoinMsg($frombbs); if ($this->info['ifcheck'] == 2) { updateUserAppNum($uid, 'group'); return 'colony_joinsuccess'; } return 'colony_joinsuccess_check'; }
$pw_posts_tid = GetPtable('N', $tid); //post表 if ($splittype == 0) { //新帖操作 if (strlen($splittitle) == 0) { Showmsg('split_title_not_null'); } if (strlen($splittitle) > 100) { Showmsg('split_title_not_big'); } //拆分 $threadId = $pids[0]; $postInfo = $db->get_one("SELECT * FROM {$pw_posts_tid} WHERE pid = " . S::sqlEscape($threadId)); $threadInfo = array('fid' => $fid, 'author' => $postInfo['author'], 'authorid' => $postInfo['authorid'], 'subject' => $splittitle, 'ifcheck' => $postInfo['ifcheck'], 'postdate' => $postInfo['postdate'], 'lastpost' => $postInfo['postdate'], 'ptable' => $db_ptable, 'lastposter' => $postInfo['author']); //$db->update("INSERT INTO pw_threads SET " . S::sqlSingle($threadInfo)); $newId = pwQuery::insert("pw_threads", $threadInfo); $newId = $db->insert_id(); $pw_tmsgs = GetTtable($newId); //获取分表表名 $pwtmsgInfo = array('userip' => $postInfo['userip'], 'content' => $postInfo['content'], 'ipfrom' => $postInfo['ipfrom'], 'ifsign' => $postInfo['ifsign'], 'ifconvert' => $postInfo['ifconvert'], 'ifwordsfb' => $postInfo['ifwordsfb'], 'tid' => $newId); $db->update("INSERT INTO {$pw_tmsgs} SET " . S::sqlSingle($pwtmsgInfo)); $db->query("DELETE FROM {$pw_posts_tid} WHERE pid = " . S::sqlEscape($threadId)); $splitid = $newId; //更新板块数据表 //* $db->update("UPDATE pw_forumdata SET topic = topic + 1 WHERE fid = " . S::sqlEscape($fid)); $db->update(pwQuery::buildClause("UPDATE :pw_table SET topic=topic+1 WHERE fid=:fid", array('pw_forumdata', $fid))); } else { //合并帖子操作 !$splitid && Showmsg('split_no_splitid'); $splitid = (int) $splitid; if ($tid == $splitid) {
function execute($postdata) { global $db_cvtime, $db_ptable, $onlineip, $db_plist; $this->setPostData($postdata); $ipTable = L::loadClass('IPTable', 'utility'); $ipfrom = $ipTable->getIpFrom($onlineip); $timestamp = time(); $db_cvtime != 0 && ($timestamp += $db_cvtime * 60); $pwSQL = array('fid' => $this->data['fid'], 'tid' => $this->tid, 'aid' => $this->data['aid'], 'author' => $this->data['author'], 'authorid' => $this->data['authorid'], 'icon' => $this->data['icon'], 'postdate' => $timestamp, 'subject' => $this->data['title'], 'userip' => $onlineip, 'ifsign' => $this->data['ifsign'], 'ipfrom' => $ipfrom, 'ifconvert' => $this->data['convert'], 'ifwordsfb' => $this->data['ifwordsfb'], 'ifcheck' => $this->data['ifcheck'], 'content' => $this->data['content'], 'anonymous' => $this->data['anonymous'], 'ifhide' => $this->data['hideatt'], 'frommob' => $this->data['frommob']); $pw_posts = GetPtable($this->tpcArr['ptable']); if ($db_plist && count($db_plist) > 1) { //* $this->db->update("INSERT INTO pw_pidtmp(pid) VALUES(null)"); //* $pid = $this->db->insert_id(); $uniqueService = L::loadClass('unique', 'utility'); $pid = $uniqueService->getUnique('post'); } else { $pid = ''; } $pwSQL['pid'] = $pid; //$pwSQL = S::sqlSingle($pwSQL); //$this->db->update("INSERT INTO $pw_posts SET $pwSQL"); pwQuery::insert($pw_posts, $pwSQL); !$pid && ($pid = $this->db->insert_id()); $this->tpcArr['openIndex'] && ($floor = $this->setPostFloor($pid)); if (getstatus($this->tpcArr['tpcstatus'], 7)) { $robbuildService = L::loadClass("robbuild", 'forum'); $robbuildService->setRobbuilds($pid, $floor, $this->tid); } $this->pid = $pid; if (is_object($this->att) && ($aids = $this->att->getAids())) { $this->db->update("UPDATE pw_attachs SET " . S::sqlSingle(array('tid' => $this->tid, 'pid' => $this->pid)) . ' WHERE aid IN(' . S::sqlImplode($aids) . ')'); //tucool $imgNum = $this->att->getUploadImgNum(); if ($this->forum->forumset['iftucool'] && $this->forum->forumset['tucoolpic'] && $imgNum) { $tucoolService = L::loadClass('tucool', 'forum'); $tucoolService->setForum($this->forum->foruminfo); $tucoolService->updateTucoolImageNum($this->tid); } } if ($this->data['ifcheck'] == 1) { $sqladd1 = ''; $sqladd = array('lastposter' => $this->data['lastposter']); $this->tpcArr['locked'] < 3 && ($sqladd['lastpost'] = $timestamp); $this->data['ifupload'] && ($sqladd['ifupload'] = $this->data['ifupload']); $ret = $this->sendMail(); if ($ret & 2) { $sqladd['ifmail'] = 4; } elseif ($ret & 1) { $sqladd1 = "ifmail=ifmail-1,"; } $this->db->update("UPDATE pw_threads SET {$sqladd1}replies=replies+1,hits=hits+1," . S::sqlSingle($sqladd) . " WHERE tid=" . S::sqlEscape($this->tid)); Perf::gatherInfo('changeThreads', array('tid' => $this->tid)); $userCache = L::loadClass('Usercache', 'user'); $userCache->delete($this->data['authorid'], 'reply'); } //weibo $weiboService = L::loadClass('weibo', 'sns'); /* @var $weiboService PW_Weibo */ $weiboContent = substrs(stripWindCode($weiboService->escapeStr(strip_tags($this->data['content']))), 125); $weiboExtra = array('title' => stripslashes($this->tpcArr['subject']), 'fid' => $this->forum->fid, 'fname' => $this->forum->name, 'atusers' => $this->data['atusers'], 'pid' => $this->pid); $weiboService->send($this->post->uid, $weiboContent, 'article', $this->tid, $weiboExtra); $threadService = L::loadClass('threads', 'forum'); $threadService->setAtUsers($this->tid, $this->pid, $this->data['atusers']); //end weibo if ($this->data['ifcheck'] == 1) { $this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']); } $this->afterReply(); if ($this->extraBehavior) { $this->extraBehavior->replyPost($this->pid, $this->tid, $this->data); } }
function execute(&$postdata) { global $timestamp, $db_ptable, $onlineip; $this->setPostData($postdata); /* $pwSQL = S::sqlSingle(array( 'fid' => $this->data['fid'], 'icon' => $this->data['icon'], 'author' => $this->data['author'], 'authorid' => $this->data['authorid'], 'subject' => $this->data['title'], 'ifcheck' => $this->data['ifcheck'], 'type' => $this->data['w_type'], 'postdate' => $timestamp, 'lastpost' => $timestamp, 'lastposter' => $this->data['lastposter'], 'hits' => 1, 'replies' => 0, 'topped' => $this->data['topped'], 'digest' => $this->data['digest'], 'special ' => $this->data['special'], 'state' => 0, 'ifupload' => $this->data['ifupload'], 'ifmail' => $this->data['ifmail'], 'anonymous' => $this->data['anonymous'], 'ptable' => $db_ptable, 'ifmagic' => $this->data['ifmagic'], 'ifhide' => $this->data['hideatt'], 'tpcstatus' => $this->data['tpcstatus'], 'modelid' => $this->data['modelid'] ));*/ //$this->db->update("INSERT INTO pw_threads SET $pwSQL"); $pwSQL = array('fid' => $this->data['fid'], 'icon' => $this->data['icon'], 'author' => $this->data['author'], 'authorid' => $this->data['authorid'], 'subject' => $this->data['title'], 'ifcheck' => $this->data['ifcheck'], 'type' => $this->data['w_type'], 'postdate' => $timestamp, 'lastpost' => $timestamp, 'lastposter' => $this->data['lastposter'], 'hits' => 1, 'replies' => 0, 'topped' => $this->data['topped'], 'digest' => $this->data['digest'], 'special ' => $this->data['special'], 'state' => 0, 'ifupload' => $this->data['ifupload'], 'ifmail' => $this->data['ifmail'], 'anonymous' => $this->data['anonymous'], 'ptable' => $db_ptable, 'ifmagic' => $this->data['ifmagic'], 'ifhide' => $this->data['hideatt'], 'tpcstatus' => $this->data['tpcstatus'], 'modelid' => $this->data['modelid'], 'frommob' => $this->data['frommob']); $this->tid = pwQuery::insert('pw_threads', $pwSQL); //* $this->tid = $this->db->insert_id(); # memcache refresh // $threadList = L::loadClass("threadlist", 'forum'); // $threadList->updateThreadIdsByForumId($this->data['fid'], $this->tid); //* Perf::gatherInfo('changeThreadWithForumIds', array('fid'=>$this->data['fid'])); //pwQuery::insert已经执行清理缓存 $pw_tmsgs = GetTtable($this->tid); if (is_object($postdata->tag)) { $postdata->tag->insert($this->tid); $this->data['tags'] .= "\t" . $postdata->tag->relate($this->data['title'], $this->data['content']); } if (is_object($this->att) && ($aids = $this->att->getAids())) { $this->att->pw_attachs->updateById($aids, array('tid' => $this->tid)); $topicImgNum = $this->att->getUploadImgNum(); if ($this->forum->forumset['iftucool'] && $this->forum->forumset['tucoolpic'] && $topicImgNum >= $this->forum->forumset['tucoolpic']) { $tucoolService = L::loadClass('tucool', 'forum'); $tucoolService->add(array('fid' => $this->data['fid'], 'tid' => $this->tid, 'tpcnum' => $topicImgNum)); } } $ipTable = L::loadClass('IPTable', 'utility'); $pwSQL = S::sqlSingle(array('tid' => $this->tid, 'aid' => $this->data['aid'], 'userip' => $onlineip, 'ifsign' => $this->data['ifsign'], 'buy' => '', 'ipfrom' => $ipTable->getIpFrom($onlineip), 'tags' => $this->data['tags'], 'ifconvert' => $this->data['convert'], 'ifwordsfb' => $this->data['ifwordsfb'], 'content' => $this->data['content'], 'magic' => $this->data['magic'])); $this->db->update("INSERT INTO {$pw_tmsgs} SET {$pwSQL}"); if ($this->data['digest']) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userService->updateByIncrement($this->data['authorid'], array(), array('digests' => 1)); $this->post->user['digests']++; } if ($this->data['replyreward']) { $replyRewardService = L::loadClass('ReplyReward', 'forum'); /* @var $replyRewardService PW_ReplyReward */ $this->data['replyreward']['tid'] = $this->tid; $replyRewardService->addNewReward($this->data['authorid'], $this->data['replyreward']); } $this->post->updateUserInfo($this->type, $this->userCreidtSet(), $this->data['content']); $this->afterpost(); if ($this->extraBehavior) { $this->extraBehavior->topicPost($this->tid, $this->data); } }
adminmsg('user_not_exists'); } if ($rt['ifcyer']) { //* $db->update("UPDATE pw_cmembers SET ifadmin=1 WHERE colonyid=" . S::sqlEscape($cyid) . ' AND uid=' . S::sqlEscape($rt['uid'])); pwQuery::update('pw_cmembers', 'colonyid=:colonyid AND uid=:uid', array($cyid, $rt['uid']), array('ifadmin' => 1)); } else { /** $db->update("INSERT INTO pw_cmembers SET " . S::sqlSingle(array( 'uid' => $rt['uid'], 'username' => $admin, 'ifadmin' => 1, 'colonyid' => $cyid, 'addtime' => $timestamp ))); **/ pwQuery::insert('pw_cmembers', array('uid' => $rt['uid'], 'username' => $admin, 'ifadmin' => 1, 'colonyid' => $cyid, 'addtime' => $timestamp)); } $pwSQL['admin'] = $admin; } require_once A_P . 'lib/colonys.class.php'; $colonyServer = new PW_Colony(); if ($cid != $colony['classid']) { $cid = isset($o_classdb[$cid]) ? $cid : 0; $colonyServer->changeTopicToForum($cyid, $iftopicshowinforum, $cid, $colony['classid']); $pwSQL['classid'] = $cid; } elseif ($iftopicshowinforum != $colony['iftopicshowinforum'] && $colony['classid'] > 0) { $colonyServer->changeTopicShowInForum($cyid, $iftopicshowinforum, $colony['classid']); } $pwSQL['styleid'] = $styleid; //* $db->update("UPDATE pw_colonys SET " . S::sqlSingle($pwSQL) . ' WHERE id=' . S::sqlEscape($cyid)); pwQuery::update('pw_colonys', 'id=:id', array($cyid), $pwSQL);
/** * 基础增加数据查询语句 * @param $fieldData * @return unknown_type */ function _insert($fieldData) { if (!$this->_check() || !$fieldData) { return false; } //* $this->_db->update("INSERT INTO " . $this->_tableName . " SET " . $this->_getUpdateSqlString($fieldData)); return pwQuery::insert($this->_tableName, $fieldData); }
function createForum($name, $fup = 0, $descrip = '', $linkurl = '') { //创建版块 if (!$name) { return new ApiResponse(false); } //* @include_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php'); extract(pwCache::getData(D_P . 'data/bbscache/forum_cache.php', false)); $forumtype = $forum[$fup]['type'] == 'category' ? 'forum' : ($forum[$fup]['type'] == 'forum' ? 'sub' : 'sub2'); /* $this->db->update("INSERT INTO pw_forums SET " . S::sqlSingle(array( 'fup' => $fup, 'type' => $forumtype, 'name' => $name, 'descrip' => $descrip, 'cms' => 0, 'ifhide' => 1, 'allowtype' => 3 ))); */ pwQuery::insert('pw_forums', array('fup' => $fup, 'type' => $forumtype, 'name' => $name, 'descrip' => $descrip, 'cms' => 0, 'ifhide' => 1, 'allowtype' => 3)); $fid = $this->db->insert_id(); $this->db->update("INSERT INTO pw_forumdata SET fid=" . S::sqlEscape($fid)); $forumset = array('lock' => 0, 'cutnums' => 0, 'threadnum' => 0, 'readnum' => 0, 'newtime' => 0, 'orderway' => 'lastpost', 'asc' => 'DESC', 'allowencode' => 0, 'anonymous' => 0, 'rate' => 0, 'dig' => 0, 'inspect' => 0, 'watermark' => 0, 'commend' => 0, 'autocommend' => 0, 'commendlist' => '', 'commendnum' => 0, 'commendlength' => 0, 'commendtime' => 0, 'addtpctype' => 0, 'ifrelated' => 0, 'relatednums' => 0, 'relatedcon' => 'ownpost', 'relatedcustom' => array(), 'rvrcneed' => 0, 'moneyneed' => 0, 'creditneed' => 0, 'postnumneed' => 0, 'sellprice' => array(), 'uploadset' => 'money 0', 'rewarddb' => '', 'allowtime' => ''); $forumset['link'] = $linkurl; $forumset = serialize($forumset); $this->db->update("INSERT INTO pw_forumsextra SET " . S::sqlSingle(array('fid' => $fid, 'forumset' => $forumset))); //* P_unlink(D_P.'data/bbscache/c_cache.php'); pwCache::deleteData(D_P . 'data/bbscache/c_cache.php'); require_once R_P . 'admin/cache.php'; updatecache_f(); require_once R_P . 'require/updateforum.php'; $forumtype != 'category' && updatetop(); return new ApiResponse($fid); }