diff --git a/LDP/lampadas/www/document_edit.pl b/LDP/lampadas/www/document_edit.pl index e8a7704c..2d068571 100755 --- a/LDP/lampadas/www/document_edit.pl +++ b/LDP/lampadas/www/document_edit.pl @@ -99,7 +99,7 @@ print "\n"; print "\n"; print "\n"; print "\n"; -print "\n"; +print "\n"; print "\n"; print ""; @@ -185,6 +185,7 @@ if ( $format eq "XML" ) { print ''; } else { print if ( $format eq "TEXT" ) { print ''; } else { print '' } if ( $format eq "LaTeX" ) { print ''; } else { print '' } if ( $format eq "PDF" ) { print ''; } else { print '' } +if ( $format eq "WIKI" ) { print ''; } else { print '' } print ""; print "\n"; print "
Document Details
Title:Edit (test)
Wiki Editing (beta)
Filename:
DTD:"; @@ -249,6 +250,69 @@ print ""; +$test = 'x'; + +if ($test) { +print "


"; + + + + +print "

Versions

"; + +$rev_result = $conn->exec("SELECT rev_id, version, pub_date, initials, notes FROM document_rev WHERE doc_id=$doc_id ORDER BY pub_date, version"); +die $conn->errorMessage unless PGRES_TUPLES_OK eq $rev_result->resultStatus; + +print "

\n"; +print ""; +while (@row = $rev_result->fetchrow) { + $rev_id = $row[0]; + $rev_version = $row[1]; + $rev_version =~ s/\s+$//; + $rev_date = $row[2]; + $rev_init = $row[3]; + $rev_note = $row[4]; + print ""; + print ""; + print ""; + print ""; + print ""; + + print "\n"; + print "\n"; + print "\n"; + print ""; + print "\n"; + print ""; + print "\n"; +} + +# For creating a new version +#print ""; +print ""; +print ""; +print ""; +print ""; + +print "\n"; +print "\n"; +print "\n"; +print "\n"; +print "\n"; +print ""; +print "\n"; + +print "
VersionDateWho?Notes
\n"; + + print "Del
New Version
\n"; + +print "
\n"; +} + + + + + diff --git a/LDP/lampadas/www/document_editor_add.pl b/LDP/lampadas/www/document_editor_add.pl index 0cdb143e..d0f543e6 100755 --- a/LDP/lampadas/www/document_editor_add.pl +++ b/LDP/lampadas/www/document_editor_add.pl @@ -23,7 +23,7 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { + if ($row[1] ne 't') { print $query->redirect("../wrongpermission.html"); exit; } diff --git a/LDP/lampadas/www/document_list.pl b/LDP/lampadas/www/document_list.pl index 15c222a4..201b45a8 100755 --- a/LDP/lampadas/www/document_list.pl +++ b/LDP/lampadas/www/document_list.pl @@ -51,6 +51,15 @@ if ( $SORT3 ) { $SORT3 = ", $SORT3"; } $strSTATUS = param('strSTATUS'); +$mydocuments = param("MyDocuments"); +$reload = param('Reload'); + +# if we're not reloading, the default is to show only Active ('N') documents. +unless (($reload eq 'Reload') or ($mydocuments eq 'MyDocuments')) { + $strSTATUS = 'N'; +} + + # Clear $BACKGROUNDER = ""; $HOWTO = ""; @@ -107,6 +116,11 @@ if ( $chkFILENAME eq "on" ) { $FILENAME = "checked "; } # connect to the database $conn=Pg::connectdb("dbname=$dbmain"); +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +$admin = $row[1]; + # print the page print header(-expires=>'now'); print "\n"; @@ -200,7 +214,7 @@ print "\n"; print "

\n"; -print "\n"; +print "\n"; $username=$query->remote_user(); $result=$conn->exec("SELECT count(*) FROM username WHERE username='$username'"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; @@ -222,7 +236,7 @@ if ($row[0] > 0) { } $doc_id_sql .= ")"; } - print "\n"; + print "\n"; } @@ -260,8 +274,7 @@ $sql .= " AND document.pub_status=pub_status.pub_status"; $sql .= " AND document.review_status = lr.review_status"; $sql .= " AND document.tech_review_status = tr.review_status"; if ( $strSTATUS ) { $sql = $sql . " AND document.pub_status='" . $strSTATUS . "'" }; -$MyDocuments = param("MyDocuments"); -if (($doc_id_sql) and ($MyDocuments)) { $sql .= " AND $doc_id_sql" } +if (($doc_id_sql) and ($mydocuments)) { $sql .= " AND $doc_id_sql" } $sql = $sql . " ORDER BY $SORT1"; #print "$sql"; @@ -321,64 +334,67 @@ print "\n"; print "

Count: $count"; -print "


"; +if ($admin eq 't') { + print "


"; -print "

New Document

\n"; + print "

New Document

\n"; -print "

\n"; -print "\n"; -print "\n"; -print "\n"; + print "

\n"; + print "\n"; + print "

Title:
\n"; + print "\n"; -print "\n"; + print "\n"; -print "\n"; + print "\n"; -print "\n"; + print "\n"; -print "\n"; - -print "\n"; -print "
Title:
Status:"; -print "\n"; -print "
Status:"; + print "\n"; + print "
Class:"; -print "\n"; -print "
Class:"; + print "\n"; + print "
Format:"; -print "\n"; -print "
Format:"; + print "\n"; + print "
DTD:"; -print "\n"; -print "
\n"; + print "DTD:"; + print "\n"; + print "\n"; + + print "\n"; + print "\n"; +} print end_html; diff --git a/LDP/lampadas/www/document_maintainer_add.pl b/LDP/lampadas/www/document_maintainer_add.pl index dbd23a16..f4c2092c 100755 --- a/LDP/lampadas/www/document_maintainer_add.pl +++ b/LDP/lampadas/www/document_maintainer_add.pl @@ -24,9 +24,14 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { - print $query->redirect("../wrongpermission.html"); - exit; + if ($row[1] ne 't') { + $user_maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$user_maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } } } diff --git a/LDP/lampadas/www/document_maintainer_save.pl b/LDP/lampadas/www/document_maintainer_save.pl index 90d350d5..42825a90 100755 --- a/LDP/lampadas/www/document_maintainer_save.pl +++ b/LDP/lampadas/www/document_maintainer_save.pl @@ -25,9 +25,14 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { - print $query->redirect("../wrongpermission.html"); - exit; + if ($row[1] ne 't') { + $user_maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$user_maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } } } diff --git a/LDP/lampadas/www/document_rev_add.pl b/LDP/lampadas/www/document_rev_add.pl new file mode 100755 index 00000000..a265709f --- /dev/null +++ b/LDP/lampadas/www/document_rev_add.pl @@ -0,0 +1,59 @@ +#! /usr/bin/perl + +use CGI qw(:standard); +use Pg; + +$query = new CGI; +$dbmain = "ldp"; +@row; + +# Read parameters +$caller = param('caller'); +$doc_id = param('doc_id'); +$rev_version = param('rev_version'); +$rev_date = param('rev_date'); +$rev_init = param('rev_init'); +$rev_note = param('rev_note'); + +while ($rev_note =~ /\'/) { + $rev_note =~ s/\'/a1s2d3f4/; +} +while ($rev_note =~ /a1s2d3f4/) { + $rev_note =~ s/a1s2d3f4/\'\'/; +} + +$conn=Pg::connectdb("dbname=$dbmain"); + +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +if ($username ne $row[0]) { + print $query->redirect("../newaccount.html"); + exit; +} else { + if ($row[1] ne 't') { + $user_maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$user_maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } + } +} + +$sql = "SELECT max(rev_id) FROM document_rev WHERE doc_id = $doc_id"; +$result=$conn->exec($sql); +@row = $result->fetchrow; +$rev_id = $row[0] + 1; + +$sql = "INSERT INTO document_rev(rev_id, doc_id, version, pub_date, initials, notes) VALUES ($rev_id, $doc_id, '$rev_version', '$rev_date', '$rev_init', '$rev_note')"; +$result=$conn->exec($sql); + +#print "Content-Type: text/plain\n\n"; +#print "$sql\n"; + +print $query->redirect($caller) + + + diff --git a/LDP/lampadas/www/document_rev_save.pl b/LDP/lampadas/www/document_rev_save.pl new file mode 100755 index 00000000..cafcfd90 --- /dev/null +++ b/LDP/lampadas/www/document_rev_save.pl @@ -0,0 +1,60 @@ +#! /usr/bin/perl + +use CGI qw(:standard); +use Pg; + +$query = new CGI; +$dbmain = "ldp"; +@row; + +# Read parameters +$caller = param('caller'); +$rev_id = param('rev_id'); +$doc_id = param('doc_id'); +$rev_version = param('rev_version'); +$rev_date = param('rev_date'); +$rev_init = param('rev_init'); +$rev_note = param('rev_note'); +while ($rev_note =~ /\'/) { + $rev_note =~ s/\'/a1s2d3f4/; +} +while ($rev_note =~ /a1s2d3f4/) { + $rev_note =~ s/a1s2d3f4/\'\'/; +} +$chkDel = param('chkDel'); + +$conn=Pg::connectdb("dbname=$dbmain"); + +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +if ($username ne $row[0]) { + print $query->redirect("../newaccount.html"); + exit; +} else { + if ($row[1] ne 't') { + $user_maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$user_maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } + } +} + +if ( $chkDel eq 'on' ) { + $sql = "DELETE FROM document_rev WHERE rev_id = $rev_id"; + $result=$conn->exec($sql); +} +else { + $result=$conn->exec("UPDATE document_rev SET version = '$rev_version' WHERE rev_id = $rev_id"); + $result=$conn->exec("UPDATE document_rev SET pub_date = '$rev_date' WHERE rev_id = $rev_id"); + $result=$conn->exec("UPDATE document_rev SET initials = '$rev_init' WHERE rev_id = $rev_id"); + $result=$conn->exec("UPDATE document_rev SET notes = '$rev_note' WHERE rev_id = $rev_id"); +} + +print $query->redirect($caller) + + + diff --git a/LDP/lampadas/www/document_save.pl b/LDP/lampadas/www/document_save.pl index 28241743..45c0fe05 100755 --- a/LDP/lampadas/www/document_save.pl +++ b/LDP/lampadas/www/document_save.pl @@ -49,9 +49,14 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { - print $query->redirect("../wrongpermission.html"); - exit; + if ($row[1] ne 't') { + $maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } } } diff --git a/LDP/lampadas/www/document_wiki.pl b/LDP/lampadas/www/document_wiki.pl index b0ae449c..74472a46 100755 --- a/LDP/lampadas/www/document_wiki.pl +++ b/LDP/lampadas/www/document_wiki.pl @@ -224,9 +224,12 @@ if ($preview or $docbook) { } if ($docbook) { - &printheader; - print "


\n"; - print "
\n";
+#	&printheader;
+#	print "


\n"; +# print "
\n";
+
+	print "Content-Type: text/plain; charset=ISO-8859-1\n\n";
+
 	while ($sgml =~ /\/>/;
 	}
 	print $sgml;
-	print "
\n"; - print "\n"; +# print "
\n"; +# print "\n"; + } if ($preview) { diff --git a/LDP/lampadas/www/document_wiki_big.pl b/LDP/lampadas/www/document_wiki_big.pl new file mode 100755 index 00000000..ac127a89 --- /dev/null +++ b/LDP/lampadas/www/document_wiki_big.pl @@ -0,0 +1,355 @@ +#! /usr/bin/perl + +$editcols = 80; +$editrows = 25; + +use CGI qw(:standard); +use Pg; + +$query = new CGI; +$dbmain = "ldp"; +@row; +$section_max = 25; + +# Read parameters +$doc_id = param('doc_id'); +$notes = param('notes'); +$revision = param('revision'); + +$section = 0; +while ($section <= $section_max) { + $section++; + $wiki_section = param("wiki$section"); + if ($wiki_section) { + if ($wiki) { + $wiki .= "\n"; + } + $wiki .= $wiki_section; + } +} +$section = 0; + +$save = param('Save'); +$preview = param('Preview'); +$docbook = param('DocBook'); + +$conn=Pg::connectdb("dbname=$dbmain"); +die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status; + +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +if ($username ne $row[0]) { + print $query->redirect("../newaccount.html"); + exit; +} else { + if ($row[1] ne 't') { + $maintainer_id = $row[2]; + $result=$conn->exec("SELECT count(*) FROM document_maintainer WHERE maintainer_id=$maintainer_id AND doc_id=$doc_id AND active='t'"); + @row = $result->fetchrow; + unless ($row[0]) { + print $query->redirect("../wrongpermission.html"); + exit; + } + } +} + +if ($save) { + while ($wiki =~ /\\/) { + $wiki =~ s/\\/a1s2d3f4/; + } + while ($wiki =~ /a1s2d3f4/) { + $wiki =~ s/a1s2d3f4/\\\\/; + } + while ($wiki =~ /&/) { + $wiki =~ s/&/a1s2d3f4/; + } + while ($wiki =~ /a1s2d3f4/) { + $wiki =~ s/a1s2d3f4/&/; + } + while ($wiki =~ /\'/) { + $wiki =~ s/\'/a1s2d3f4/; + } + while ($wiki =~ /a1s2d3f4/) { + $wiki =~ s/a1s2d3f4/\'\'/; + } + while ($notes =~ /\'/) { + $notes =~ s/\'/a1s2d3f4/; + } + while ($notes =~ /a1s2d3f4/) { + $notes =~ s/a1s2d3f4/\'\'/; + } + + #find out how many prior revisions there were + $result = $conn->exec("SELECT count(*) FROM document_wiki WHERE doc_id = $doc_id"); + die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; + @row = $result->fetchrow; + $revisions = $row[0]; + +# &printheader; +# print $wiki; +# print end_html; +# exit; + + if ($revisions >= $revision ) { + &printheader; + print "

Edit conflict!\n"; + print "

You were editing version $revisions, but trying to save to version $revision\n"; + print end_html; + } elsif ($wiki eq '') { + &printheader; + print "

No content to save!\n"; + print end_html; + } else { + $revision = $revisions + 1; + $sql = "INSERT INTO document_wiki(doc_id, revision, date_entered, wiki, notes, username) VALUES ($doc_id, $revision, now(), '$wiki', '$notes', '$username')"; + $result=$conn->exec($sql); + print $query->redirect("document_edit.pl?doc_id=$doc_id"); + } + exit; +} + +#load document meta-data +$result = $conn->exec("SELECT title, filename, class FROM document WHERE doc_id = $doc_id"); +die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; +@row = $result->fetchrow; +$title = $row[0]; +$title =~ s/\s+$//; +$filename = $row[1]; +$class = $row[2]; +$class =~ s/\s+$//; + +#find out how many prior revisions there were +$result = $conn->exec("SELECT count(*) FROM document_wiki WHERE doc_id = $doc_id"); +die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; +@row = $result->fetchrow; +$revisions = $row[0]; + +#if we're not previewing, load data from database and determine version +unless ($preview or $docbook) { + $result = $conn->exec("SELECT wiki FROM document_wiki WHERE doc_id = $doc_id ORDER BY revision DESC LIMIT 1, 0"); + die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; + @row = $result->fetchrow; + $revision = $revisions + 1; + $wiki = $row[0]; + $wiki =~ s/\s+$//; + while ($wiki =~ //) { + $wiki =~ s/>/>/; + } + + &printheader; + print "

\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + + $tempfile = "/tmp/document_wiki_big" . rand(); + open (TMP, "> $tempfile"); + print TMP $wiki; + close(TMP); + + open (TMP, $tempfile); + $wiki = ""; + $section = 0; + while ($line = ) { + if ($line =~ /^===/) { + } elsif ($line =~ /^==/) { + } elsif ($line =~ /^=/) { + &printwiki; + } else { + } + $wiki .= $line; + } + close TMP; + unlink $tempfile; + &printwiki; + $section++; + print "\n"; + print "\n"; + if ($revisions == 0) { + print "\n"; + } else { + print "\n"; + } + print "
Document Text
Comments:
There are no previous versions of this document. Your changes will be saved as version $revision
You are editing version $revisions. Your changes will be saved as version $revision
\n"; + print "\n"; + print "\n"; + print "\n"; + print "
\n"; + print end_html; +} + +if ($preview or $docbook) { + $txtfile = "/tmp/" . rand() . ".txt"; + $sgmlfile = $txtfile; + $sgmlfile =~ s/\.txt/\.sgml/; + $htmlfile = $txtfile; + $htmlfile =~ s/\.txt/\.html/; + $abstractfile = $txtfile; + $abstractfile =~ s/\./abs\./; + $abstractsgmlfile = $sgmlfile; + $abstractsgmlfile =~ s/\./abs\./; + system("rm $sgmlfile"); + + open(TXT, "> $txtfile"); + print TXT $wiki; + close(TXT); + + $cmd = "/usr/lib/cgi-bin/gldp.org/txt2db.pl -o $sgmlfile $txtfile"; + system($cmd); + + $sgml = '' . "\n"; + if ($class eq 'FAQ') { + $sgml .= "
\n"; + } else { + $sgml .= "
\n"; + } + $sgml .= "\n"; + + $result = $conn->exec("SELECT title, last_update, abstract FROM document WHERE doc_id = $doc_id"); + die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; + while (@row = $result->fetchrow) { + $title = $row[0]; + $date = $row[1]; + + #insert paragraphs in the abstract where appropriate. + $abstract = $row[2]; + open(ABSTRACT, "> $abstractfile"); + print ABSTRACT $abstract; + close(ABSTRACT); + + $cmd = "/usr/lib/cgi-bin/gldp.org/txt2db.pl -o $abstractsgmlfile $abstractfile"; + system($cmd); + + $abstract = ""; + open(ABSTRACTSGML, $abstractsgmlfile); + while () { + $abstract .= $_; + } + + #build the document header. + $sgml .= "$title\n"; + $sgml .= "$date\n"; + $sgml .= "$date\n"; + $sgml .= "$abstract\n"; + } + + $result = $conn->exec("SELECT m.maintainer_name, dm.email FROM document_maintainer dm, maintainer m WHERE doc_id = $doc_id AND dm.maintainer_id = m.maintainer_id AND active='t'"); + die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; + while (@row = $result->fetchrow) { + $name = $row[0]; + $email = $row[1]; + $sgml .= "\n"; + $sgml .= "\n"; + $sgml .= "
\n"; + $sgml .= "$name\n"; + $sgml .= "
\n"; + $sgml .= "
\n"; + $sgml .= "
\n"; + } + + $sgml .= "
\n"; + + open(SGML, $sgmlfile); + while () { + $line = $_; + $sgml .= $line; + while ($line =~ //) { + $line =~ s/>/>/; + } + $buf .= "
$line"; + } + close(SGML); + + $sgml .= "
\n"; + + open(SGML, "> $sgmlfile"); + print SGML $sgml; + close(SGML); +} + +if ($docbook) { +# &printheader; +# print "


\n"; +# print "
\n";
+
+	print "Content-Type: text/plain; charset=ISO-8859-1\n\n";
+
+#	while ($sgml =~ //) {
+#		$sgml =~ s/>/>/;
+#	}
+	print $sgml;
+#	print "
\n"; +# print "\n"; +} + +if ($preview) { + $cmd = "xsltproc --docbook /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl $sgmlfile > $htmlfile"; + system($cmd); + + print header(-expires=>'now'); + open(HTML, "$htmlfile"); + $i = 0; + while () { + $line = $_; + $i += 1; +# if ($i > 8) { + print $line; +# } + } + close(HTML); + +} + +sub printheader { + print header(-expires=>'now'); + print "$title Wiki"; + print ""; + print ""; + print ""; + + print "

$title Wiki

\n"; + + print "

Index | "; + print "Documents | "; + print "Topics | "; + print "Maintainers | "; + print "Editors | "; + print "Statistics | "; + print "Help | "; + print "Page Help"; + + print "

"; + print "Meta-Data\n"; + print " | "; + print "Version History\n"; +} + +sub printwiki { + if ($wiki) { + $section++; + print "Section $section\n"; + print "\n"; + +# print "Section: $section\n"; +# print "$wiki\n\n"; +# print "-----------------------------\n\n"; + if ($section == $section_max) { + print "Aborting due to loop control.\n"; + last; + } + $wiki = ""; + } +} + diff --git a/LDP/lampadas/www/editor_list.pl b/LDP/lampadas/www/editor_list.pl index c2fe1893..603bc4ab 100755 --- a/LDP/lampadas/www/editor_list.pl +++ b/LDP/lampadas/www/editor_list.pl @@ -7,8 +7,16 @@ $dbmain='ldp'; @row; $count = 0; -# Connect and load the tuples +$query = new CGI; + +# Connect to database $conn=Pg::connectdb("dbname=$dbmain"); + +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +$admin = $row[1]; + $result=$conn->exec("SELECT editor_id, editor_name, email FROM editor ORDER BY editor_name"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; @@ -46,17 +54,19 @@ print "\n"; print "

Count: $count"; -print "


\n"; +if ($admin eq 't') { + print "


\n"; -print "

New Editor

\n"; + print "

New Editor

\n"; -print "

\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "
Name:
Email:
\n"; + print "

\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "
Name:
Email:
\n"; +} print end_html; diff --git a/LDP/lampadas/www/maintainer_add.pl b/LDP/lampadas/www/maintainer_add.pl index f734e82a..38e90dd2 100755 --- a/LDP/lampadas/www/maintainer_add.pl +++ b/LDP/lampadas/www/maintainer_add.pl @@ -22,7 +22,7 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { + if ($row[1] ne 't') { print $query->redirect("../wrongpermission.html"); exit; } diff --git a/LDP/lampadas/www/maintainer_list.pl b/LDP/lampadas/www/maintainer_list.pl index 397e53e1..55a4ac17 100755 --- a/LDP/lampadas/www/maintainer_list.pl +++ b/LDP/lampadas/www/maintainer_list.pl @@ -7,8 +7,16 @@ $dbmain='ldp'; @row; $count = 0; -# Connect and load the tuples +$query = new CGI; + +# Connect to the database $conn=Pg::connectdb("dbname=$dbmain"); + +$username = $query->remote_user(); +$result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); +@row = $result->fetchrow; +$admin = $row[1]; + $result=$conn->exec("SELECT maintainer_id, maintainer_name, email FROM maintainer ORDER BY maintainer_name"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; @@ -48,17 +56,19 @@ print "\n"; print "

Count: $count"; -print "


\n"; +if ($admin eq 't') { + print "


\n"; -print "

New Maintainer

\n"; + print "

New Maintainer

\n"; -print "

\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "
Name:
Email:
\n"; + print "

\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "
Name:
Email:
\n"; +} print end_html; diff --git a/LDP/lampadas/www/maintainer_save.pl b/LDP/lampadas/www/maintainer_save.pl index 83083e00..256137a0 100755 --- a/LDP/lampadas/www/maintainer_save.pl +++ b/LDP/lampadas/www/maintainer_save.pl @@ -22,9 +22,12 @@ if ($username ne $row[0]) { print $query->redirect("../newaccount.html"); exit; } else { - if (($row[1] ne 't') and ($row[2] != $doc_id)) { - print $query->redirect("../wrongpermission.html"); - exit; + if ($row[1] ne 't') { + $user_maintainer_id = $row[2]; + unless ($user_maintainer_id == $maintainer_id) { + print $query->redirect("../wrongpermission.html"); + exit; + } } }