コード例 #1
0
<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
require_once $phpbb_root_path . 'includes/openkore.' . $phpEx;
// Obtain initial var settings
$forum_id = OUtils::getIntSetting(POST_FORUM_URL);
$post_id = OUtils::getIntSetting(POST_POST_URL);
$topic_id = OUtils::getIntSetting(POST_TOPIC_URL);
// Start session management
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
// session id check
if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid'])) {
    $sid = !empty($HTTP_POST_VARS['sid']) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
} else {
    $sid = '';
}
// session id check
if ($sid == '' || $sid != $userdata['session_id']) {
    message_die(GENERAL_ERROR, 'Invalid_session');
}
// Obtain relevant data
if (!empty($topic_id)) {
    $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics\n\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f\n\t\tWHERE t.topic_id = " . $topic_id . "\n\t\t\tAND f.forum_id = t.forum_id";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');