Piping Mailman's HTML through PHP
I'm far from a Python guru, so that's why I'm asking the developer's list.
I want to integrate the Mailman web pages into the rest of my web page, but everything else is PHP. I've seen lots of posts about using PHP with Mailman, but not really any solutions (if I missed it, please point me in the right direction).
With that in mind, I thought I'd try to see how to do it myself. All I really need Mailman to do is after it generates it's HTML to pipe the output through /usr/bin/php before sending it to stdout where apache will get it.
I have a solution, but I but there's a better way within Mailman.
Right now I moved all the programs in /usr/local/mailman/cgi-bin to /usr/local/mailman/cgi-bin.orig, then created shell scripts in cgi-bin that look like this:
--- start file: listinfo --- #!/bin/sh
../cgi-bin.orig/listinfo | /usr/bin/php --- end file: listinfo ---
That's all there is to it. Now I can add PHP directives in Mailman's HTML code, and they get parsed.
Is there a better way?
Maybe you good folks could add some hooks into later releases so that the user could specify a "filter" program or something that Mailman will pipe all it's HTML output through. That's all that is needed.
Thanx for a great program!
- John
-- "Cat's motto: No matter what you've done wrong, always try to make it look like the dog did it." -- Unknown
http://GCFL.net (The Good, Clean Funnies List): Good, clean funnies five times a week, no ads, for free!
John Price wrote:
I'm far from a Python guru, so that's why I'm asking the developer's list.
I want to integrate the Mailman web pages into the rest of my web page, but everything else is PHP. I've seen lots of posts about using PHP with Mailman, but not really any solutions (if I missed it, please point me in the right direction).
With that in mind, I thought I'd try to see how to do it myself. All I really need Mailman to do is after it generates it's HTML to pipe the output through /usr/bin/php before sending it to stdout where apache will get it.
I have a solution, but I but there's a better way within Mailman.
Right now I moved all the programs in /usr/local/mailman/cgi-bin to /usr/local/mailman/cgi-bin.orig, then created shell scripts in cgi-bin that look like this:
--- start file: listinfo --- #!/bin/sh
../cgi-bin.orig/listinfo | /usr/bin/php --- end file: listinfo ---
That's all there is to it. Now I can add PHP directives in Mailman's HTML code, and they get parsed.
Is there a better way?
That seems pretty reasonable to me, though I've never though about it before. At some point it should be possible in Apache 2 to use PHP as a filter, so that Apache will redirect the output of Mailman to PHP (with a little configuration to that effect, of course). I believe using PHP as a filter is considered experimental now, but hopefully that use will mature. This seems like the best long-term solution -- then your PHP is running in the same environment for Mailman as for your other pages.
-- Ian Bicking / ianb@colorstudy.com / http://blog.ianbicking.org
Right now I moved all the programs in /usr/local/mailman/cgi-bin to /usr/local/mailman/cgi-bin.orig, then created shell scripts in cgi-bin that look like this:
--- start file: listinfo --- #!/bin/sh
../cgi-bin.orig/listinfo | /usr/bin/php --- end file: listinfo ---
That's all there is to it. Now I can add PHP directives in Mailman's HTML code, and they get parsed.
And what if I send an HTML file to your list with php code included? You get a security issue here.
Better way in my view is to write a wrapper script in php, that does the graphics and such things, then pushes the web page. You get the wrapper to work in lieu of the cgi by configuring Apache to do so (RewriteRule, or Alias).
-- Fil
On Fri, Jul 23, 2004 at 10:05:50AM +0200, Fil wrote:
And what if I send an HTML file to your list with php code included? You get a security issue here.
This only applies to the archive viewing scripts, right? It's an easy thing to disable PHP code when displaying user-generated text.
Still, you bring up a good point when considering adding this feature to the program.
Better way in my view is to write a wrapper script in php, that does the graphics and such things, then pushes the web page. You get the wrapper to work in lieu of the cgi by configuring Apache to do so (RewriteRule, or Alias).
This is an idea. Frames is another. But if you want to have access to the Mailman substitution tags as well as PHP then these ideas don't work.
-- "A dog is the only thing on earth that loves you more than he loves himself." -- Josh Billings
http://GCFL.net (The Good, Clean Funnies List): Good, clean funnies five times a week, no ads, for free!
Better way in my view is to write a wrapper script in php, that does the graphics and such things, then pushes the web page. You get the wrapper to work in lieu of the cgi by configuring Apache to do so (RewriteRule, or Alias).
This is an idea. Frames is another. But if you want to have access to the Mailman substitution tags as well as PHP then these ideas don't work.
Oh yes it can work: just use
<?php $page = file('http://localhost/cgi/pipermail.....'); ?>
and you'll get (through http) the file processed by Mailman's CGI, which you can then process by php. I do that, for example, to generate the list of lists at http://listes.rezo.net/listes.php
-- Fil
participants (3)
-
Fil
-
Ian Bicking
-
John Price