1 (edited by h4ever 2020-03-01 08:01)

Topic: How to get punbb_bbcode on report page?

I am trying to get the bar of punbb_bbcode on misc.php report page. This is for one reason. I want that user can mark the bad words which are in a post. So first I SELECT the posts.message of the post id to report the post. Then I add the message to TEXTAREA.

Then I want to use the hook

($hook = get_hook('mi_report_output_start')) ? eval($hook) : null;

So I added it to manifest.xml and I try to use a copy of bar.php as report-bar.php (this is for the reason I would like to disable some buttons of the bar which I will not use on the report page).

        <hook id="mi_report_output_start"><![CDATA[
            if ($forum_user['pun_bbcode_enabled'] == '1')
            include $ext_info['path'].'/report-bar.php';
        ]]></hook>

So I have reinstalled the extension. But then errors occures ...

There are some warnings on the page:
Warning: array_unique() expects parameter 1 to be array, null given in P:\DATABASE\www\punbb\extensions\punbb_bbcode\report-bar.php on line 87

{main}( )    in ..\misc.php:0

eval( '$GLOBALS['ext_info_stack'][] = array( 'id' => 'punbb_bbcode', 'path' => FORUM_ROOT.'extensions/punbb_bbcode', 'url' => $GLOBALS['base_url'].'/extensions/punbb_bbcode', 'dependencies' => array ( ) ); $ext_info = $GLOBALS['ext_info_stack'][count($GLOBALS['ext_info_stack']) - 1]; if ($forum_user['pun_bbcode_enabled'] == '1') include $ext_info['path'].'/report-bar.php'; array_pop($GLOBALS['ext_info_stack']); $ext_info = empty($GLOBALS['ext_info_stack']) ? array() : $GLOBALS['ext_info_stack'][count($GLOBALS['ext_info_stack']) - 1]; ' )

include( 'P:\DATABASE\www\punbb\extensions\punbb_bbcode\report-bar.php' )    ..\misc.php(513) : eval()'d code:11

Also I print

die(get_hook('mi_report_output_start'));

and see this output:

 $GLOBALS['ext_info_stack'][] = array( 'id' => 'punbb_bbcode', 'path' => FORUM_ROOT.'extensions/punbb_bbcode', 'url' => $GLOBALS['base_url'].'/extensions/punbb_bbcode', 'dependencies' => array ( ) ); $ext_info = $GLOBALS['ext_info_stack'][count($GLOBALS['ext_info_stack']) - 1]; if ($forum_user['pun_bbcode_enabled'] == '1') include $ext_info['path'].'/report-bar.php'; array_pop($GLOBALS['ext_info_stack']); $ext_info = empty($GLOBALS['ext_info_stack']) ? array() : $GLOBALS['ext_info_stack'][count($GLOBALS['ext_info_stack']) - 1]; 

Do you have idea what I have missed?

2 (edited by h4ever 2020-03-01 10:27)

Re: How to get punbb_bbcode on report page?

I have solved the problem.

The problem is that the parser.php is not loaded. Only solution I have found now is to modify the page misc.php:

    define('PUNBB_BBCODE_FORM_ON',1);
  if (!defined('FORUM_PARSER_LOADED'))
        require FORUM_ROOT.'include/parser.php';
  ($hook = get_hook('mi_report_output_start')) ? eval($hook) : null;

And parser.php on #10:

// Make sure no one attempts to run this script "directly"
if (!defined('FORUM') AND PUNBB_BBCODE_FORM_ON)
    exit;

Edit:
To make all things working I needed to modify header too... something like:

    <hooks>
        <hook id="hd_head"><![CDATA[
            if ( PUNBB_BBCODE_FORM_ON || ...