template-›_tpl_load_file() Ошибка PHPBB

Итак, я пытаюсь создать сообщение на внешней странице на моей странице WordPress. Я пытаюсь опубликовать новую тему в определенном разделе форума. После долгих попыток поместить части posting.php из PHPBB внутрь скрипта, он у меня пока показывает страницу, но не форму шаблона публикации. Теперь это моя ошибка:

template->_tpl_load_file(): Файл /posting_body.html не существует или пуст

Я пытался добавить ./ или /forum/styles и т. д. и т. д. до этого, но ничего не работает. Я также пробовал решение этого вопроса: ошибка API шаблона phpBB, но это также не сработало.

Теперь это полный скрипт:

    define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);



// Grab only parameters needed here
$post_id    = request_var('p', 0);
$topic_id   = request_var('t', 0);
$forum_id   = request_var('f', 0);
$draft_id   = request_var('d', 0);
$lastclick  = request_var('lastclick', 0);

$submit     = (isset($_POST['post'])) ? true : false;
$preview    = (isset($_POST['preview'])) ? true : false;
$save       = (isset($_POST['save'])) ? true : false;
$load       = (isset($_POST['load'])) ? true : false;
$delete     = (isset($_POST['delete'])) ? true : false;
$cancel     = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;

$refresh    = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['full_editor']) || isset($_POST['cancel_unglobalise']) || $save || $load) ? true : false;
$mode       = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', '');

$error = $post_data = array();
$current_time = time();

// Was cancel pressed? If so then redirect to the appropriate page
if ($cancel || ($current_time - $lastclick < 2 && $submit))
{
    $f = ($forum_id) ? 'f=' . $forum_id . '&amp;' : '';
    $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx")));
    redirect($redirect);
}

if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$forum_id)
{
    trigger_error('NO_FORUM');
}
// MAIN POSTING PAGE BEGINS HERE

// Forum moderators?
$moderators = array();
if ($config['load_moderators'])
{
    get_moderators($moderators, $forum_id);
}

// Generate smiley listing
generate_smilies('inline', $forum_id);

// Generate inline attachment select box
posting_gen_inline_attachments($attachment_data);

// Do show topic type selection only in first post.
$topic_type_toggle = false;

if ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']))
{
    $topic_type_toggle = posting_gen_topic_types($forum_id, $post_data['topic_type']);
}

$s_topic_icons = false;
if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id))
{
    $s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']);
}

$bbcode_checked     = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : (($config['allow_bbcode']) ? !$user->optionget('bbcode') : 1);
$smilies_checked    = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : (($config['allow_smilies']) ? !$user->optionget('smilies') : 1);
$urls_checked       = (isset($post_data['enable_urls'])) ? !$post_data['enable_urls'] : 0;
$sig_checked        = $post_data['enable_sig'];
$lock_topic_checked = (isset($topic_lock) && $topic_lock) ? $topic_lock : (($post_data['topic_status'] == ITEM_LOCKED) ? 1 : 0);
$lock_post_checked  = (isset($post_lock)) ? $post_lock : $post_data['post_edit_locked'];

// If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting
$notify_set         = ($mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) ? $user->data['user_notify'] : $post_data['notify_set'];
$notify_checked     = (isset($notify)) ? $notify : (($mode == 'post') ? $user->data['user_notify'] : $notify_set);

// Page title & action URL
$s_action = append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode&amp;f=$forum_id");
$s_action .= ($topic_id) ? "&amp;t=$topic_id" : '';
$s_action .= ($post_id) ? "&amp;p=$post_id" : '';

switch ($mode)
{
    case 'post':
        $page_title = $user->lang['POST_TOPIC'];
    break;

    case 'quote':
    case 'reply':
        $page_title = $user->lang['POST_REPLY'];
    break;

    case 'delete':
    case 'edit':
        $page_title = $user->lang['EDIT_POST'];
    break;
}

// Build Navigation Links
generate_forum_nav($post_data);

// Build Forum Rules
generate_forum_rules($post_data);

// Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed.
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
{

    $template->assign_vars(array(
        'S_CONFIRM_CODE'            => true,
        'CAPTCHA_TEMPLATE'          => $captcha->get_template(),
    ));
}

$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';
$s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';

if ($mode == 'edit')
{
    $s_hidden_fields .= build_hidden_fields(array(
        'edit_post_message_checksum'    => $post_data['post_checksum'],
        'edit_post_subject_checksum'    => $post_data['post_subject_md5'],
    ));
}

// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false)
{
    $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
}

$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
add_form_key('posting');


// Start assigning vars for main posting page ...
$template->assign_vars(array(
    'L_POST_A'                  => $page_title,
    'L_ICON'                    => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'],
    'L_MESSAGE_BODY_EXPLAIN'    => (intval($config['max_post_chars'])) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '',

    'FORUM_NAME'            => $post_data['forum_name'],
    'FORUM_DESC'            => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '',
    'TOPIC_TITLE'           => censor_text($post_data['topic_title']),
    'MODERATORS'            => (sizeof($moderators)) ? implode(', ', $moderators[$forum_id]) : '',
    'USERNAME'              => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '',
    'SUBJECT'               => $post_data['post_subject'],
    'MESSAGE'               => $post_data['post_text'],
    'BBCODE_STATUS'         => ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
    'IMG_STATUS'            => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
    'FLASH_STATUS'          => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
    'SMILIES_STATUS'        => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
    'URL_STATUS'            => ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
    'MAX_FONT_SIZE'         => (int) $config['max_post_font_size'],
    'MINI_POST_IMG'         => $user->img('icon_post_target', $user->lang['POST']),
    'POST_DATE'             => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '',
    'ERROR'                 => (sizeof($error)) ? implode('<br />', $error) : '',
    'TOPIC_TIME_LIMIT'      => (int) $post_data['topic_time_limit'],
    'EDIT_REASON'           => $post_data['post_edit_reason'],
    'U_VIEW_FORUM'          => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"),
    'U_VIEW_TOPIC'          => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id") : '',
    'U_PROGRESS_BAR'        => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&amp;mode=popup"),
    'UA_PROGRESS_BAR'       => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&amp;mode=popup")),

    'S_PRIVMSGS'                => false,
    'S_CLOSE_PROGRESS_WINDOW'   => (isset($_POST['add_file'])) ? true : false,
    'S_EDIT_POST'               => ($mode == 'edit') ? true : false,
    'S_EDIT_REASON'             => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
    'S_DISPLAY_USERNAME'        => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false,
    'S_SHOW_TOPIC_ICONS'        => $s_topic_icons,
    'S_DELETE_ALLOWED'          => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false,
    'S_BBCODE_ALLOWED'          => ($bbcode_status) ? 1 : 0,
    'S_BBCODE_CHECKED'          => ($bbcode_checked) ? ' checked="checked"' : '',
    'S_SMILIES_ALLOWED'         => $smilies_status,
    'S_SMILIES_CHECKED'         => ($smilies_checked) ? ' checked="checked"' : '',
    'S_SIG_ALLOWED'             => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered']) ? true : false,
    'S_SIGNATURE_CHECKED'       => ($sig_checked) ? ' checked="checked"' : '',
    'S_NOTIFY_ALLOWED'          => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true,
    'S_NOTIFY_CHECKED'          => ($notify_checked) ? ' checked="checked"' : '',
    'S_LOCK_TOPIC_ALLOWED'      => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false,
    'S_LOCK_TOPIC_CHECKED'      => ($lock_topic_checked) ? ' checked="checked"' : '',
    'S_LOCK_POST_ALLOWED'       => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
    'S_LOCK_POST_CHECKED'       => ($lock_post_checked) ? ' checked="checked"' : '',
    'S_LINKS_ALLOWED'           => $url_status,
    'S_MAGIC_URL_CHECKED'       => ($urls_checked) ? ' checked="checked"' : '',
    'S_TYPE_TOGGLE'             => $topic_type_toggle,
    'S_SAVE_ALLOWED'            => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $mode != 'edit') ? true : false,
    'S_HAS_DRAFTS'              => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $post_data['drafts']) ? true : false,
    'S_FORM_ENCTYPE'            => $form_enctype,

    'S_BBCODE_IMG'          => $img_status,
    'S_BBCODE_URL'          => $url_status,
    'S_BBCODE_FLASH'        => $flash_status,
    'S_BBCODE_QUOTE'        => $quote_status,

    'S_POST_ACTION'         => $s_action,
    'S_HIDDEN_FIELDS'       => $s_hidden_fields)
);

// Build custom bbcodes array
display_custom_bbcodes();

// Poll entry
if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/))
    && $auth->acl_get('f_poll', $forum_id))
{
    $template->assign_vars(array(
        'S_SHOW_POLL_BOX'       => true,
        'S_POLL_VOTE_CHANGE'    => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)),
        'S_POLL_DELETE'         => ($mode == 'edit' && sizeof($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
        'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false,

        'L_POLL_OPTIONS_EXPLAIN'    => sprintf($user->lang['POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN'], $config['max_poll_options']),

        'VOTE_CHANGE_CHECKED'   => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '',
        'POLL_TITLE'            => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '',
        'POLL_OPTIONS'          => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '',
        'POLL_MAX_OPTIONS'      => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1,
        'POLL_LENGTH'           => $post_data['poll_length'])
    );
}

// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype);

// Attachment entry
posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);

// Output page ...
//page_header($page_title, false);

$template->set_filenames(array(
    'body' => 'posting_body.html')
);

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));

// Topic review
if ($mode == 'reply' || $mode == 'quote')
{
    if (topic_review($topic_id, $forum_id))
    {
        $template->assign_var('S_DISPLAY_REVIEW', true);
    }
}

page_footer();

И часть, о которой я думаю, я говорю:

    $template->set_filenames(array(
    'body' => 'posting_body.html')
);

person Kev30    schedule 18.07.2014    source источник
comment
Просто к вашему сведению, это: $submit = (isset($_POST['post'])) ? true : false; избыточно. Вы можете просто сделать $submit = isset($_POST['post']);   -  person nickb    schedule 18.07.2014


Ответы (1)


Ваш файл PHP ищет forum/styles/yourstyle/template/posting_body.html, которого не существует.

person Eeji    schedule 21.07.2014