This is the historical archive of the now-inactive 'grubstreet' list.
Discussion on OpenGuides development has now moved to OpenGuides-Dev. Discussion on The Open Guide to London now takes place on OpenGuides-London.

[grubstreet] New page maker

[prev] [thread] [next] [lurker] [Date index for 2002/5/28]

From: Earle Martin
Subject: [grubstreet] New page maker
Date: 22:29 on 28 May 2002
I've whipped up a little script to let people easily create new wiki pages.

You can try it here:

(note that images and navlinks will work when it's in the main cgi-bin, not my
testing area)

Basic functionality seems to be OK, but in discussion with Kake she noted
that it would be nice for it to take you to the edit page if it didn't
already exist. I said that the problem is it would rely on you typing the
exact same name for the page as one that already exists, which could be
problematic (e.g. beginning with "The" or not?), so she mooted fuzzy

Also, I don't know how to do taint checking and other important security
stuff yet, which needs to be put in before this can go public, so perhaps
someone could give me a hand? The code follows.


We now know that the heart is the philosophers' stone
Our music is our alchemy                                 - Saul Williams

--------- code starts

#!/usr/bin/perl -w

use strict;
use CGI qw(:standard);

my $q = new CGI;
my $go = $q->param("go");
my $page = $q->param("page");

if (!$go) {
print "Content-type:text/html\n\n";
print <<HTMLstop
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title>New Page</title>
	<link rel="stylesheet" href="">;
<h1><a href=""><img src="/grubstreet/grubstreet.gif"
alt="[Home]" border=0 align="right"></a>Grubstreet: make a new page</H1><a
href="">HomePage</a> | <a
href="">RecentChanges</a> | <a
href="">Preferences</a> | <a
Please read <a
href="">Adding New
Pages</a> if you haven't done so already.
Note: Valid characters for page names are A-Z, a-z, 0-9, space, comma, full
stop, hyphen, apostrophe. If you enter an "&amp;" symbol here, it will be automatically
converted to "and".
<form action=""; method="post">
<input type="text" size="100" name="page"> <input type="submit">
<input type="hidden" name="go" value="1">

else {
	$page =~ s/ /_/g;
	$page =~ s/&/and/g;
	print $q->redirect("$page";);

--------- code finishes

grubstreet mailing list