function thread_top_change($tid, $top = 0)
{
    $thread = thread__read($tid);
    if (empty($thread)) {
        return FALSE;
    }
    if ($top != $thread['top']) {
        thread__update($tid, array('top' => $top));
        $fid = $thread['fid'];
        $tid = $thread['tid'];
        thread_top_cache_delete();
        thread_tids_cache_delete($fid);
        thread_new_cache_delete();
        return db_exec("REPLACE INTO `bbs_thread_top` SET fid='{$fid}', tid='{$tid}', top='{$top}'");
    }
    return FALSE;
}
Ejemplo n.º 2
0
function post_delete($pid)
{
    global $conf;
    $post = post_read_cache($pid);
    if (empty($post)) {
        return TRUE;
    }
    // 已经不存在了。
    $tid = $post['tid'];
    $uid = $post['uid'];
    $thread = thread_read_cache($tid);
    $fid = $thread['fid'];
    $r = post__delete($pid);
    if ($r === FALSE) {
        return FALSE;
    }
    !$post['isfirst'] and thread__update($tid, array('posts-' => 1));
    !$post['isfirst'] and $uid and user__update($uid, array('posts-' => 1));
    !$post['isfirst'] and runtime_set('posts-', 1);
    // 清理赞同
    $uid and myagree_delete($uid, $pid, $post['isfirst']);
    // 清理缓存
    $post['isfirst'] and post_list_cache_delete($tid);
    $post['images'] || $post['files'] and attach_delete_by_pid($pid);
    return $r;
}
Ejemplo n.º 3
0
function thread_url_update($tid, $url)
{
    $tid = intval($tid);
    $r = db_exec("UPDATE bbs_thread_url SET url='{$url}' WHERE tid='{$tid}'");
    $r !== FALSE and thread__update($tid, array('url_on' => $url ? 1 : 0));
    return $r;
}