コード例 #1
0
function guest_agree_delete($sid, $pid, $touid, $tid)
{
    $pid = intval($pid);
    $sid = addslashes($sid);
    $r = db_exec("DELETE FROM `bbs_guest_agree` WHERE sid='{$sid}' AND pid='{$pid}'");
    if ($r !== FALSE) {
        user_update($touid, array('agrees-' => 1));
        post_update($pid, array('agrees-' => 1));
        $tid and thread_update($tid, array('agrees-' => 1));
        // 改变用户组
        user_update_group($touid);
        return TRUE;
        // 0
    } else {
        return FALSE;
    }
}
コード例 #2
0
function myagree_delete($uid, $pid, $isfirst)
{
    $agree = myagree_read($pid, $uid);
    if (empty($agree)) {
        return 0;
    }
    $fromuid = $agree['uid'];
    $touid = $agree['touid'];
    $tid = $agree['tid'];
    $r = db_exec("DELETE FROM `bbs_myagree` WHERE uid='{$uid}' AND pid='{$pid}' LIMIT 1");
    db_exec("DELETE FROM `bbs_post_agree` WHERE pid='{$pid}' AND uid='{$uid}' LIMIT 1");
    if ($r !== FALSE) {
        user_update($fromuid, array('myagrees-' => 1));
        user_update($touid, array('agrees-' => 1));
        post_update($pid, array('agrees-' => 1));
        $isfirst and thread_update($tid, array('agrees-' => 1));
        // 改变用户组
        user_update_group($touid);
        return $r;
        // 0
    } else {
        return FALSE;
    }
}
コード例 #3
0
ファイル: post.php プロジェクト: jarryyen/xiuno-theme-flarum
                $post['uid'] != $uid and !forum_access_mod($fid, $gid, 'allowupdate') and message(-1, '您(' . $user['groupname'] . ')无权限在此版块编辑帖子');
                $arr['fid'] = $newfid;
            }
            if ($seo_url != $thread['seo_url'] && $conf['seo_url_rewrite'] && $group['allowcustomurl']) {
                $seo_url = preg_replace('#[\\W]#', '-', $seo_url);
                // 只允许英文和 -
                $seo_url and thread_read_by_seo_url($seo_url) and message(4, '自定义的 URL 已经存在,请修改。');
                // 这里可能有并发问题,seo_url 并非 UNIQUE KEY
                strlen($seo_url) > 128 and message(3, '自定义 URL 太长');
                $arr['seo_url'] = $seo_url;
            }
            if ($subject != $thread['subject']) {
                mb_strlen($subject, 'UTF-8') > 80 and message(1, '标题最长80个字符');
                $arr['subject'] = $subject;
            }
            $arr and thread_update($tid, $arr) === FALSE and message(-1, '更新主题失败');
        }
        $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);
コード例 #4
0
ファイル: mod.php プロジェクト: xianyuxmu/alinkagarden-xiuno
    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') {
    $_uid = param(2, 0);
    $method != 'POST' and message(-1, 'Method error');
    empty($group['allowdeleteuser']) and message(-1, '您无权删除用户');
    $u = user_read($_uid);
    empty($u) and message(-1, '用户不存在或者已经被删除。');
    $u['gid'] < 6 and message(-1, '不允许删除管理组,请先调整用户用户组。');
    $r = user_delete($_uid);
コード例 #5
0
ファイル: web_index.php プロジェクト: jingyexu/ezcast
/**
 * Used to update a thread informations
 * @global type $input
 * @return boolean
 */
function thread_edit()
{
    global $input;
    $thread_id = $input['thread_id'];
    $thread_message = surround_url($input['thread_message'] . edited_on());
    $thread_timecode = intval($input['thread_timecode']);
    $thread_title = htmlspecialchars($input['thread_title']);
    $album = $input['thread_album'];
    $asset = $input['thread_asset'];
    $_SESSION['current_thread '] = $thread_id;
    // remove php and javascript tags
    $thread_message = safe_text($thread_message);
    thread_update($thread_id, $thread_title, $thread_message, $thread_timecode, $album, $_SESSION['user_full_name']);
    cache_asset_threads_unset($album, $asset);
    cache_album_threads_unset($album);
    trace_append(array('3', 'thread_edit', $album, $asset, $thread_timecode, $thread_id));
    return thread_details_update();
}