Running PHP code from within the wiki via a plugin

Added by Chris Peterson over 8 years ago

First of all lets get the obvious huge security hole out of the way. I know that and understand that. This is meant to run on an internal server with no external access. Security could be improved by running a different thread with SAFE=4. I have an internal request to be able to run PHP code from within the wiki. Such that one will be able to specify a new tag in the wiki such as

<run PHP>code</run>

which will run the supplied PHP code and output the result to the wiki. I have done some research and came across Executing PHP code in Rails. I think I would want to wrap the function:
def textilizable(*args)

At this point I am at a loss. I see that I need to pass a file into the php system command, but all I have is a bunch of text. I know that I need to extract the tag from the text variable, write it to a file and then pass that file into the parser. Any ideas? Is this the best way to do this?

Replies (1)

RE: Running PHP code from within the wiki via a plugin - Added by Andrew Chaika over 8 years ago

Chris, It's very bad idea to use PHP and write code in wiki too. Try learn Ruby instead and write wiki macroses/plugins for Redmine :)
If you need to integrate your existing PHP code - use IFRAME or system exec function

(1-1/1)