Exemplo n.º 1
0
} elseif ($action == 'update') {
    $pid = param(2);
    $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'] . ')无权限在此版块回帖');
    $allowupdate = forum_access_mod($fid, $gid, 'allowupdate');
    !$allowupdate and !$post['allowupdate'] and message(-1, '无权编辑该贴');
    if ($method == 'GET') {
        $forumlist_allowthread = forum_list_access_filter($forumlist, $gid, 'allowthread');
        $forumarr = xn_json_encode(arrlist_key_values($forumlist_allowthread, 'fid', 'name'));
        $post['message'] = htmlspecialchars($post['message']);
        // 将未插入帖子的附件加入到末尾。
        $attachlist = $imagelist = $filelist = array();
        if ($post['images'] || $post['files']) {
            $attachlist = attach_find_by_pid($post['pid']);
            list($imagelist, $filelist) = attach_list_not_in_message($attachlist, $post['message']);
            $post['message'] .= post_attach_list_add($imagelist, $filelist);
        }
        check_standard_browser();
        include './flarum/view/post_update.htm';
    } elseif ($method == 'POST') {
        $subject = htmlspecialchars(param('subject', '', FALSE));
        $message = param('message', '', FALSE);
        $seo_url = strtolower(param('seo_url'));
Exemplo n.º 2
0
// 支持 SAE
include './xiunophp/xiunophp.php';
include './model.inc.php';
// 测试数据库连接
db_connect($err) or message(-1, $err);
$grouplist = group_list_cache();
$forumlist = forum_list_cache();
$user = user_token_get('', 'bbs');
// 全局的 user,全局变量除了 $conf, 其他全部加下划线
$uid = $user['uid'];
// 全局的 uid
$gid = $user['gid'];
// 全局的 gid
$group = $grouplist[$gid];
// 全局的 user,全局变量除了 $conf, 其他全部加下划线
$forumlist_show = forum_list_access_filter($forumlist, $gid);
// 有权限查看的板块
$header['title'] = $conf['sitename'];
// 网站标题
$header['keywords'] = $conf['sitename'];
// 关键词
$header['description'] = $conf['sitename'];
// 描述
// 启动在线,将清理函数注册,不能写日志。
$runtime = runtime_init();
$sid = online_init();
$fid = 0;
// 检测浏览器
$browser = get__browser();
check_browser($browser);
// 检测站点运行级别