The Mint Troubleshooting Forum was not the right place:
http://www.shauninman.com/plete/2006/05 … s-in-punbb
1 2006-05-19 16:45
Re: How to add multi colour forums? (Example inside) (6 replies, posted in PunBB 1.2 troubleshooting)
2 2005-09-23 02:59
Re: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Rod, the script you include cannot send any HTML to the browser. If you can view the page you are trying to include in a browser and you see any HTML then it's not going to work. All HTML must be added in string form to the $return variable. That $return variable is then inserted into the post text in place of the [inc] BBcode.
If you don't need the PunBB variables in your include script then you can create a proxy script that uses file_get_contents() to add the output of the script you are trying to include to the $return variable. My script piggybacks atop Pun's user permissions so I don't use this technique but it should work.
Example PunBB post:
This is my include:
[inc]/relative/path/to/proxy.php[/inc]
Example proxy.php script:
<?php $return = file_get_contents('http://www.yourdomain.com/path/to/include.php'); ?>
Example include.php:
I ? <?php echo 'PunBB'; ?>
Using this proxy should result in the your post looking like this:
This is my include:
I ? PunBB
Just make sure you use the full url for your include file in proxy.php. Using a relative one will result in the actual PHP source code being sent to the browser potentially exposing any database passwords contained within the script. Also, do not use a variable passed in by the query string to choose which file to include in proxy.php--that would open up a nasty security hole.
3 2005-09-22 22:45
Re: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
You guys might be interested in the "chip-list" I embedded into a thread using this mod: http://www.haveamint.com/forum/viewtopic.php?id=336 Or maybe not.
4 2005-09-21 16:34
Re: BBCode PHP Includes (3 replies, posted in PunBB 1.2 modifications, plugins and integrations)
The PHP include [...] should not output HTML directly. The result of the include should be returned as a string in the $return variable.
5 2005-09-21 15:29
Re: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Posted the mod here in case anyone is interested: http://punbb.org/forums/viewtopic.php?id=8862
6 2005-09-21 14:48
Topic: BBCode PHP Includes (3 replies, posted in PunBB 1.2 modifications, plugins and integrations)
##
##
## Mod title: BBCode PHP Includes
##
## Mod version: 1.0
## Works on PunBB: 1.2.7
## Release date: 2005-09-21
## Author: Shaun Inman
##
## Description: This mod adds a [inc][/inc] BBCode tag which allows admins
## to include PHP in posts. The PHP include has access to
## $lang_common, $pun_user, $cur_post and should not output
## HTML directly. The result of the include should be returned as
## a string in the $return variable.
##
## Affected files: /include/parser.php
##
## Affects DB: No
##
## Notes: Just a quick hack that I implemented to include a custom
## polling script. It's probably a terrible security hole and
## may not even work on your server configuration. I'm
## documenting this for myself so I'll know which changes
## to make when PunBB is next updated.
##
## Include paths are relative to the root of your site. eg:
##
## [inc]/includes/file.php[/inc]
##
## This mod is offered as-is. Use at your own risk.
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
I hacked this out real quick. It meets my needs, it may not meet yours. Feel free to modify it for the latter.
7 2005-09-21 14:31
Re: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Not anyone, just an Admin. I want to include a custom polling script. I'll be posting my mod in a few minutes. It's hairy but it works for me.
8 2005-09-21 14:06
Re: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Cool. So I take it a Mod like hasn't been created yet?
9 2005-09-21 12:53
Topic: Allow admin/moderators to embed PHP in posts? (13 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Is there a way to do this in PunBB? A BBCode [php] tag perhaps that only gets parsed if the user has certain permissions?