Пример #1
0
    /**
     * delete post
     * @param $post_id		post id
     * @param $topic_id		topic id
     * @param $forum_id		forum id 
     */
    function deletePostXML($post_id, $topic_id, $forum_id)
    {
        $no_access = true;
        $fdb = new DbForum();
        $f_type = $fdb->getForumTypeByPostId($post_id);
        if ($this->_checkUserPerm('', $f_type, 'del')) {
            $no_access = false;
        }
        if ($no_access && $fdb->getPostUser((int) $post_id) == $this->_getLoginUserName()) {
            if ($this->_checkUserPerm('', 'own', 'del')) {
                $no_access = false;
            }
        }
        if ($no_access) {
            return <<<EOF
<html>
<body>
<script language="javascript" type="text/javascript">
\twindow.parent.document.f.accessDenied();
</script>
</body>
</html>
EOF;
        }
        // delete post here
        $fdb->deletePost($post_id);
        $exists = $fdb->getTopic($topic_id) ? 1 : 0;
        return <<<EOF
<html>
<body>
<script language="javascript" type="text/javascript">
\twindow.parent.document.f.deleteSuccess({$forum_id}, {$topic_id}, {$exists});
</script>
</body>
</html>
EOF;
    }