Exemplo n.º 1
0
        $r = post_update($pid, array('message' => $message));
        $r === FALSE and message(-1, '更新帖子失败');
        message(0, array('pid' => $pid, 'subject' => $subject, 'message' => $message));
    }
} elseif ($action == 'delete') {
    $pid = param(2, 0);
    if ($method != 'POST') {
        message(-1, '方法不对');
    }
    $post = post_read($pid);
    empty($post) and message(-1, '帖子不存在:' . $pid);
    $tid = $post['tid'];
    $thread = thread_read($tid);
    empty($thread) and message(-1, '主题不存在:' . $tid);
    $fid = $thread['fid'];
    $forum = forum_read($fid);
    empty($forum) and message(-1, '板块不存在:' . $fid);
    $isfirst = $post['isfirst'];
    !forum_access_user($fid, $gid, 'allowpost') and message(-1, '您(' . $user['groupname'] . ')无权限在此版块回帖');
    $allowdelete = forum_access_mod($fid, $gid, 'allowdelete');
    !$allowdelete and !$post['allowdelete'] and message(-1, '无权删除该帖');
    if ($isfirst) {
        // 清除所有的回复。喜欢。还有相关资源
        thread_delete($tid);
    } else {
        post_delete($pid);
        post_list_cache_delete($tid);
    }
    message(0, '删除成功');
    // 接受 base64 文件上传
} elseif ($action == 'upload') {
Exemplo n.º 2
0
    }
} elseif ($action == 'move') {
    $tids = param(2);
    $arr = explode('_', $tids);
    $tidarr = param_force($arr, array(0));
    empty($tidarr) and message(-1, '请选择主题');
    $header['title'] = '移动';
    if ($method == 'GET') {
        // 选中第一个
        $tid = $tidarr[0];
        $thread = thread_read($tid);
        include './pc/view/mod_move.htm';
    } else {
        if ($method == 'POST') {
            $newfid = param('newfid', 0);
            !forum_read($newfid) and message(1, '板块不存在');
            $threadlist = thread_find_by_tids($tidarr, 1, 1000);
            // 设置置顶
            foreach ($threadlist as &$thread) {
                $fid = $thread['fid'];
                $tid = $thread['tid'];
                if (forum_access_mod($fid, $gid, 'allowmove')) {
                    thread_update($tid, array('fid' => $newfid));
                    $arr = array('uid' => $uid, 'tid' => $thread['tid'], 'pid' => $thread['firstpid'], 'subject' => $thread['subject'], 'comment' => '', 'create_date' => $time, 'action' => 'move');
                    modlog_create($arr);
                }
            }
            message(0, '移动完成');
        }
    }
} elseif ($action == 'deleteuser') {