Exemplo n.º 1
0
function updateForumCount($fid, $topic, $replies, $tpost = 0)
{
    global $db, $db_fcachenum;
    $fm = $db->get_one("SELECT fup,type,password,allowvisit,f_type FROM pw_forums WHERE fid=" . S::sqlEscape($fid));
    if ($fm['type'] == 'category') {
        return false;
    }
    delfcache($fid, $db_fcachenum);
    $topic = intval($topic);
    $article = $topic + intval($replies);
    $tpost = intval($tpost);
    $lastpost = '';
    $lt = $db->get_one("SELECT tid,author,postdate,lastpost,lastposter,subject FROM pw_threads WHERE fid=" . S::sqlEscape($fid) . " AND specialsort='0' AND ifcheck='1' AND lastpost>0 ORDER BY lastpost DESC LIMIT 1");
    if ($lt) {
        if ($lt['postdate'] == $lt['lastpost']) {
            $subject = substrs($lt['subject'], 26);
        } else {
            $subject = 'Re:' . substrs($lt['subject'], 26);
        }
        $lastpost = ",lastpost=" . S::sqlEscape($subject . "\t" . $lt['lastposter'] . "\t" . $lt['lastpost'] . "\t" . "read.php?tid={$lt['tid']}&page=e#a");
    }
    $db->update("UPDATE pw_forumdata SET article=article+'{$article}',topic=topic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid=" . S::sqlEscape($fid));
    Perf::gatherInfo('changeForumData', array('fid' => $fid));
    if (($fm['type'] == 'sub' || $fm['type'] == 'sub2') && ($fids = getUpFids($fid))) {
        if ($fm['password'] != '' || $fm['allowvisit'] != '' || $fm['f_type'] == 'hidden') {
            $lastpost = '';
        }
        $db->update("UPDATE pw_forumdata SET article=article+'{$article}',subtopic=subtopic+'{$topic}',tpost=tpost+'{$tpost}'{$lastpost} WHERE fid IN(" . S::sqlImplode($fids) . ')');
        Perf::gatherInfo('changeForumData', array('fid' => $fids));
    }
}
Exemplo n.º 2
0
@name:加亮道具
@type:帖子类
@effect:可以将自己的帖子标题加亮显示

****/
if ($tooldb['type'] != 1) {
    Showmsg('tooluse_type_error');
    // 判断道具类型是否设置错误
}
if (!$_POST['step']) {
    require_once uTemplate::PrintEot('profile_toolcenter');
    ajax_footer();
} else {
    if ($tpcdb['authorid'] != $winduid) {
        Showmsg('tool_authorlimit');
    }
    S::gp(array('title1', 'title2', 'title3', 'title4', 'title5', 'title6'));
    $titlefont = "{$title1}~{$title2}~{$title3}~{$title4}~{$title5}~{$title6}~";
    //$db->update("UPDATE pw_threads SET titlefont=".S::sqlEscape($titlefont).",toolinfo=".S::sqlEscape($tooldb['name'],false)."WHERE tid=".S::sqlEscape($tid));
    pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('titlefont' => $titlefont, 'toolinfo' => $tooldb['name']));
    $fid = $db->get_value("SELECT fid FROM pw_threads WHERE tid=" . S::sqlEscape($tid));
    //* $threads = L::loadClass('Threads', 'forum');
    //$threads->delThreads($tid);
    Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
    require_once R_P . 'require/updateforum.php';
    delfcache($fid, $db_fcachenum);
    $db->update("UPDATE pw_usertool SET nums=nums-1 WHERE uid=" . S::sqlEscape($winduid) . "AND toolid=" . S::sqlEscape($toolid));
    $logdata = array('type' => 'use', 'nums' => '', 'money' => '', 'descrip' => 'tool_3_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $tooldb['name'], 'subject' => substrs($tpcdb['subject'], 15), 'tid' => $tid);
    writetoollog($logdata);
    Showmsg('toolmsg_success');
}
Exemplo n.º 3
0
    Showmsg('tooluse_type_error');
    // 判断道具类型是否设置错误
}
if ($tpcdb['authorid'] != $winduid) {
    Showmsg('tool_authorlimit');
}
if ($tpcdb['topped'] == 3) {
    Showmsg('toolmsg_6_failed');
}
$toolfield = $timestamp + 3600 * 6;
//$db->update("UPDATE pw_threads SET topped='3',toolinfo=".S::sqlEscape($tooldb['name'],false).",toolfield=".S::sqlEscape($toolfield)."WHERE tid=".S::sqlEscape($tid));
pwQuery::update('pw_threads', 'tid=:tid', array($tid), array('topped' => 3, 'toolinfo' => $tooldb['name'], 'toolfield' => $toolfield));
$fid = $db->get_value("SELECT fid FROM pw_threads WHERE tid=" . intval($tid));
//* $threadList = L::loadClass("threadlist", 'forum');
//* $threadList->refreshThreadIdsByForumId($fid);
require_once R_P . 'require/updateforum.php';
setForumsTopped($tid, $fid, 3, $toolfield);
updatetop();
//* require_once pwCache::getPath(D_P.'data/bbscache/forum_cache.php');
pwCache::getData(D_P . 'data/bbscache/forum_cache.php');
$arr_forumkeys = array_keys($forum);
$total = count($arr_forumkeys);
$db_fcachenum = 20;
for ($j = 0; $j < $total; $j++) {
    delfcache($j, $db_fcachenum);
}
Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $fid));
$db->update("UPDATE pw_usertool SET nums=nums-1 WHERE uid=" . S::sqlEscape($winduid) . "AND toolid=" . S::sqlEscape($toolid));
$logdata = array('type' => 'use', 'nums' => '', 'money' => '', 'descrip' => 'tool_6_descrip', 'uid' => $winduid, 'username' => $windid, 'ip' => $onlineip, 'time' => $timestamp, 'toolname' => $tooldb['name'], 'subject' => substrs($tpcdb['subject'], 15), 'tid' => $tid);
writetoollog($logdata);
Showmsg('toolmsg_success');