Пример #1
0
 $agree = param('agree', 0);
 $message = param('message', '', FALSE);
 !trim(str_replace(array(' ', '&nbsp;', '<br>', '<br/>', '<br />'), '', $message)) and message(2, '内容不能为空');
 $gid != 1 and $message = xn_html_safe($message);
 $gid != 1 and $message = badword_filter($message, $badword);
 $message === FALSE and message(2, '内容中包含敏感关键词: ' . $badword);
 mb_strlen($message, 'UTF-8') > 2048000 and message('内容太长');
 $quick and $message = nl2br(str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $message));
 // 检测是否灌水
 post_check_flood($gid, $tid, $message) and message(2, '系统检测到您可能在灌水');
 // 检测是否超过最大回复数
 $thread['posts'] >= 1000 and message(-1, '该主题已经达到最大回复数 1000,不能再回复,请另起主题。');
 $thread['top'] > 0 and thread_top_cache_delete();
 # 论坛帖子数据,一页显示,不分页。
 $post = array('tid' => $tid, 'uid' => $uid, 'create_date' => $time, 'userip' => $longip, 'sid' => $sid, 'isfirst' => 0, 'message' => $message);
 $pid = post_create($post, $fid);
 empty($pid) and message(1, '创建帖子失败');
 // 喜欢,不通过服务端,客户端 ajax 发起请求更简洁
 //if($agree) {
 //	$r = agree_update($thread['uid'], $thread['firstpid'], $tid, $fid, 1);
 //}
 // 最新发帖
 // thread_top_create($fid, $tid);
 $post = post_read($pid);
 $post['floor'] = $thread['posts'] + 1;
 $postlist = array($post);
 $allowpost = forum_access_user($fid, $gid, 'allowpost');
 $allowupdate = forum_access_mod($fid, $gid, 'allowupdate');
 $allowdelete = forum_access_mod($fid, $gid, 'allowdelete');
 ob_start();
 include './flarum/view/post_list_body.inc.htm';
Пример #2
0
             thread_set_closed($t_tid, true);
         } else {
             thread_set_closed($t_tid, false);
         }
         if (isset($t_sticky) && $t_sticky == "Y") {
             thread_set_sticky($t_tid, true);
         } else {
             thread_set_sticky($t_tid, false);
         }
     }
 }
 if ($t_tid > 0) {
     if ($allow_sig == true && strlen(trim($t_sig)) > 0) {
         $t_content .= "<div class=\"sig\">{$t_sig}</div>";
     }
     $new_pid = post_create($t_fid, $t_tid, $t_rpid, $uid, $t_to_uid, $t_content);
     if ($new_pid > -1) {
         $user_rel = user_get_relationship($t_to_uid, $uid);
         if ($high_interest == "Y") {
             thread_set_high_interest($t_tid);
         }
         if (!session::check_perm(USER_PERM_WORMED, 0) && !($user_rel & USER_IGNORED_COMPLETELY)) {
             $exclude_user_array = array($t_to_uid, $uid);
             $thread_modified = isset($thread_data['MODIFIED']) && is_numeric($thread_data['MODIFIED']) ? $thread_data['MODIFIED'] : 0;
             email_sendnotification($t_to_uid, $uid, $t_tid, $new_pid);
             email_send_folder_subscription($uid, $t_fid, $t_tid, $new_pid, $thread_modified, $exclude_user_array);
             email_send_thread_subscription($uid, $t_tid, $new_pid, $thread_modified, $exclude_user_array);
         }
         post_save_attachment_id($t_tid, $new_pid, $aid);
     }
 }
Пример #3
0
                            if ($close_poll == POLL_CLOSE_NEVER) {
                                $poll_closes = false;
                            }
                        }
                    }
                }
            }
            $tid = post_create_thread($fid, $uid, $thread_title, 'Y', 'N');
            $pid = post_create($fid, $tid, 0, $uid, 0, '');
            poll_create($tid, $poll_questions_array, $poll_closes, $change_vote, $poll_type, $show_results, $poll_vote_type, $option_type, $allow_guests);
            post_save_attachment_id($tid, $pid, $aid);
            if (strlen($message_text) > 0) {
                if ($allow_sig == true && strlen(trim($sig_text)) > 0) {
                    $message_text .= "<div class=\"sig\">{$sig_text}</div>";
                }
                post_create($fid, $tid, 1, $uid, $uid, $message_text);
            }
            if ($high_interest == "Y") {
                thread_set_high_interest($tid);
            }
        }
        if (isset($tid) && $tid > 0) {
            $uri = "discussion.php?webtag={$webtag}&msg={$tid}.1";
        } else {
            $uri = "discussion.php?webtag={$webtag}";
        }
        header_redirect($uri);
    } else {
        $error_msg_array[] = sprintf(gettext("You can only post once every %s seconds. Please try again later."), forum_get_setting('minimum_post_frequency', null, 0));
    }
}
Пример #4
0
if ($valid && isset($_POST['post'])) {
    if (post_check_frequency()) {
        if (post_check_ddkey($dedupe)) {
            if ($new_thread) {
                $tid = post_create_thread($fid, $_SESSION['UID'], $threadtitle, 'N', 'N', false);
                $reply_to_pid = 0;
            } else {
                if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
                    light_html_draw_error(gettext("This thread is closed, you cannot post in it!"));
                }
            }
            if (isset($tid) && is_numeric($tid)) {
                if ($allow_sig == true && strlen(trim($sig)) > 0) {
                    $content .= "<div class=\"sig\">{$sig}</div>";
                }
                if (($new_pid = post_create($fid, $tid, $reply_to_pid, $_SESSION['UID'], $to_logon_array, $content)) !== false) {
                    if ($high_interest == "Y") {
                        thread_set_high_interest($tid);
                    }
                    email_send_notification($tid, $new_pid);
                    email_send_thread_subscription($tid, $new_pid);
                    email_send_folder_subscription($fid, $tid);
                    if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $_SESSION['UID']) && !perm_is_moderator($_SESSION['UID'], $fid)) {
                        admin_send_post_approval_notification($fid);
                    }
                    if (sizeof($attachments) > 0 && ($attachments_array = attachments_get($_SESSION['UID'], $attachments)) !== false) {
                        foreach ($attachments_array as $attachment) {
                            post_add_attachment($tid, $new_pid, $attachment['aid']);
                        }
                    }
                }
Пример #5
0
                 email_send_notification($tid, $new_pid);
                 email_send_thread_subscription($tid, $new_pid);
                 email_send_folder_subscription($fid, $tid);
                 if (perm_check_folder_permissions($fid, USER_PERM_POST_APPROVAL, $_SESSION['UID']) && !perm_is_moderator($_SESSION['UID'], $fid)) {
                     admin_send_post_approval_notification($fid);
                 }
                 if (sizeof($attachments) > 0 && ($attachments_array = attachments_get($_SESSION['UID'], $attachments)) !== false) {
                     foreach ($attachments_array as $attachment) {
                         post_add_attachment($tid, $new_pid, $attachment['aid']);
                     }
                 }
                 if (strlen($message_text) > 0) {
                     if ($allow_sig == true && strlen(trim($sig_text)) > 0) {
                         $message_text .= "<div class=\"sig\">{$sig_text}</div>";
                     }
                     post_create($fid, $tid, 1, $_SESSION['UID'], array(), $message_text);
                 }
                 if ($high_interest == "Y") {
                     thread_set_high_interest($tid);
                 }
             }
         }
     }
     if (isset($tid) && $tid > 0) {
         $uri = "discussion.php?webtag={$webtag}&msg={$tid}.1";
     } else {
         $uri = "discussion.php?webtag={$webtag}";
     }
     header_redirect($uri);
 } else {
     $error_msg_array[] = sprintf(gettext("You can only post once every %s seconds. Please try again later."), forum_get_setting('minimum_post_frequency', 'is_numeric', 0));
Пример #6
0
    	));*/
    $setting = array('sitebrief' => '', 'seo_title' => '', 'seo_keywords' => '', 'seo_description' => '', 'footer_code' => '');
    kv_set('setting', $setting);
    // 写测试数据
    if ($test_data == 1) {
        runtime_truncate();
        runtime_init();
        online_init();
        for ($i = 0; $i < 5; $i++) {
            $subject = '欢迎使用 Xiuno BBS 3.0 新一代论坛系统。' . $i;
            $message = '祝您使用愉快!';
            $thread = array('fid' => 1, 'uid' => 1, 'subject' => $subject, 'message' => $message, 'seo_url' => '', 'time' => $time, 'longip' => $longip);
            $tid = thread_create($thread, $pid);
            for ($j = 0; $j < 2; $j++) {
                $post = array('tid' => $tid, 'uid' => 1, 'create_date' => $time, 'userip' => $longip, 'isfirst' => 0, 'message' => $message . rand(1, 10000));
                $pid = post_create($post, 1);
            }
        }
    }
    message(0, '安装成功。');
}
// 写数据库
function write_database($filename, $echo = FALSE)
{
    global $db;
    $s = file_get_contents($filename);
    $s = str_replace("\r\n", "\n", $s);
    $s = preg_replace('#\\n\\#[^\\n]*?\\n#is', "\n", $s);
    $sqlarr = explode(";\n", $s);
    foreach ($sqlarr as $sql) {
        if (!trim($sql)) {
Пример #7
0
function blog_posts_create()
{
    if ($post_id = post_create($_POST['post'])) {
        redirect_to('posts', $post_id);
        # redirects to the show page of this newly created post
    } else {
        halt(SERVER_ERROR, "AN error occured while trying to create a new post");
        # raises error / renders an error page
    }
}
Пример #8
0
function rss_feed_check_feeds()
{
    if (($rss_feed = rss_feed_fetch()) !== false) {
        if (($rss_data = rss_feed_read_database($rss_feed['URL'])) !== false) {
            $max_item_count = min(10, $rss_feed['MAX_ITEM_COUNT']);
            foreach ($rss_data as $item_index => $rss_feed_item) {
                if ($item_index + 1 > $max_item_count) {
                    return;
                }
                if (!rss_feed_thread_exist($rss_feed['RSSID'], $rss_feed_item->link)) {
                    $rss_title = htmlentities_decode_array($rss_feed_item->title);
                    $rss_title = htmlentities_array(strip_tags($rss_title));
                    $rss_feed_name = htmlentities_array($rss_feed['NAME']);
                    $rss_quote_source = "{$rss_feed_name} {$rss_title}";
                    if (isset($rss_feed['PREFIX']) && strlen(trim($rss_feed['PREFIX'])) > 0) {
                        $rss_feed_prefix = htmlentities_array($rss_feed['PREFIX']);
                        $rss_title = "{$rss_feed_prefix} {$rss_title}";
                    }
                    if (mb_strlen($rss_title) > 64) {
                        $rss_title = mb_substr($rss_title, 0, 60);
                        if (($pos = mb_strrpos($rss_title, ' ')) !== false) {
                            $rss_title = trim(mb_substr($rss_title, 0, $pos));
                        }
                        $rss_title .= "...";
                    }
                    if (strlen($rss_feed_item->description) > 1) {
                        $rss_feed_item_description = htmlentities_decode_array($rss_feed_item->description);
                        $rss_content = fix_html(sprintf('<div class="quotetext"><b>%s:</b> <a href="%s">%s</a></div>
                             <div class="quote">%s</div>', gettext('quote'), $rss_feed_item->link, $rss_quote_source, $rss_feed_item_description));
                    } else {
                        $rss_content = fix_html(sprintf('<p>%s</p><a href=\\"%s\\" target=\\"_blank\\">%s</a>', $rss_quote_source, $rss_feed_item->link, gettext("Click here to read this article")));
                    }
                    $tid = post_create_thread($rss_feed['FID'], $rss_feed['UID'], $rss_title);
                    post_create($rss_feed['FID'], $tid, 0, $rss_feed['UID'], array(), $rss_content);
                    rss_feed_create_history($rss_feed['RSSID'], $rss_feed_item->link);
                }
            }
        }
    }
}