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: http://downlode.org/perl/newpage.pl

(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
matching.

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.

Cheers,
Earle.

-- 
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">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title>New Page</title>
	<link rel="stylesheet" href="http://grault.net/grubstreet/grubstreet.css">;
</head>
<h1><a href="grubstreet.pl?HomePage"><img src="/grubstreet/grubstreet.gif"
alt="[Home]" border=0 align="right"></a>Grubstreet: make a new page</H1><a
href="grubstreet.pl?HomePage">HomePage</a> | <a
href="grubstreet.pl?RecentChanges">RecentChanges</a> | <a
href="grubstreet.pl?action=editprefs">Preferences</a> | <a
href="grubstreet.pl?Utilities">Utilities</a><br>
<hr>
<p>
Please read <a
href="http://grault.net/cgi-bin/grubstreet.pl?Adding_New_Pages">Adding New
Pages</a> if you haven't done so already.
</p>
<p>
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".
</p>
<form action="http://downlode.org/perl/newpage.pl"; method="post">
<input type="text" size="100" name="page"> <input type="submit">
<input type="hidden" name="go" value="1">
</form>
</body>
</html>

HTMLstop
}
else {
	$page =~ s/ /_/g;
	$page =~ s/&/and/g;
	print $q->redirect("http://grault.net/cgi-bin/grubstreet.pl?$page";);
}

--------- code finishes

-- 
grubstreet mailing list
http://london.openguides.org/old-list-archives/