mirror of https://github.com/tLDP/LDP
bugfixes
This commit is contained in:
parent
4af4d894d7
commit
d023731e4e
|
@ -34,19 +34,16 @@ databases.
|
|||
Required Perl Modules
|
||||
---------------------
|
||||
|
||||
Lampadas requires the following Perl modules to be installed and working
|
||||
Lampadas requires several Perl modules to be installed and working
|
||||
properly. All of these modules are available from the Comprehensive Perl
|
||||
Archive Network (CPAN) at http://www.cpan.org.
|
||||
|
||||
See Makefile.PL for a list of required modules.
|
||||
|
||||
To install a Perl module, type 'perl -MCPAN -e shell' to get a CPAN shell,
|
||||
then type 'install <module>' to install each module. For more information, see
|
||||
CPAN's website or your Perl documentation.
|
||||
|
||||
Mail::Sendmail
|
||||
String::Random
|
||||
Pg
|
||||
CGI
|
||||
|
||||
|
||||
System Variables
|
||||
----------------
|
||||
|
|
|
@ -8,6 +8,7 @@ GRANT ALL ON document TO "www-data";
|
|||
GRANT SELECT ON document TO root;
|
||||
GRANT ALL ON document_audience TO "www-data";
|
||||
GRANT ALL ON document_error TO "www-data";
|
||||
GRANT ALL ON document_file TO "www-data";
|
||||
GRANT ALL ON document_rev TO "www-data";
|
||||
GRANT SELECT on document_rev to root;
|
||||
GRANT ALL ON document_topic TO "www-data";
|
||||
|
|
|
@ -59,6 +59,7 @@ use Exporter;
|
|||
SaveSubtopic,
|
||||
Formats,
|
||||
DTDs,
|
||||
Errors,
|
||||
|
||||
DocCount,
|
||||
DocCountByClass,
|
||||
|
@ -67,7 +68,7 @@ use Exporter;
|
|||
StartPage,
|
||||
EndPage,
|
||||
|
||||
ErrorsTable,
|
||||
MessagesTable,
|
||||
NavBar,
|
||||
|
||||
RoleCombo,
|
||||
|
@ -89,6 +90,7 @@ use Exporter;
|
|||
DocsTable,
|
||||
DocTable,
|
||||
DocVersionsTable,
|
||||
DocErrorsTable,
|
||||
DocFilesTable,
|
||||
DocUsersTable,
|
||||
DocTopicsTable,
|
||||
|
@ -123,7 +125,7 @@ use Exporter;
|
|||
Logout,
|
||||
AddUser,
|
||||
SaveUser,
|
||||
AddError,
|
||||
AddMessage,
|
||||
Mail,
|
||||
);
|
||||
|
||||
|
@ -137,7 +139,7 @@ $currentuser_id = 0;
|
|||
%currentuser = ();
|
||||
&ReadCookie;
|
||||
|
||||
@errors = (); # System errors, displayed on the next page
|
||||
@messages = (); # System messages, displayed on the next page
|
||||
$debug = 0; # Set this to 1 to get debugging messages
|
||||
|
||||
sub new {
|
||||
|
@ -676,7 +678,7 @@ sub SaveSubtopic {
|
|||
|
||||
sub Formats {
|
||||
my %formats = ();
|
||||
my $sql = "select format, format_name from format";
|
||||
my $sql = "SELECT format, format_name FROM format";
|
||||
my $recordset = $DB->Recordset($sql);
|
||||
while (@row = $recordset->fetchrow) {
|
||||
$format = &trim($row[0]);
|
||||
|
@ -688,7 +690,7 @@ sub Formats {
|
|||
|
||||
sub DTDs {
|
||||
my %dtds = ();
|
||||
my $sql = "select dtd from dtd";
|
||||
my $sql = "SELECT dtd FROM dtd";
|
||||
my $recordset = $DB->Recordset($sql);
|
||||
while (@row = $recordset->fetchrow) {
|
||||
$dtd = &trim($row[0]);
|
||||
|
@ -697,6 +699,21 @@ sub DTDs {
|
|||
return %dtds;
|
||||
}
|
||||
|
||||
sub Errors {
|
||||
my %errors = ();
|
||||
my $sql = "SELECT doc_id, error FROM document_error";
|
||||
my $recordset = $DB->Recordset($sql);
|
||||
my $count = 0;
|
||||
while (@row = $recordset->fetchrow) {
|
||||
$doc_id = &trim($row[0]);
|
||||
$error = &trim($row[1]);
|
||||
$count++;
|
||||
$errors{$count}{doc_id} = $doc_id;
|
||||
$errors{$count}{error} = $error;
|
||||
}
|
||||
return %errors;
|
||||
}
|
||||
|
||||
sub DocCount {
|
||||
return $DB->Value("SELECT COUNT(*) FROM document");
|
||||
}
|
||||
|
@ -724,7 +741,7 @@ sub StartPage {
|
|||
|
||||
if ($cookie) {
|
||||
print $CGI->header(-cookie=>$cookie,-expires=>'now');
|
||||
push @errors, "cookie: $cookie" if ($debug);
|
||||
push @messages, "cookie: $cookie" if ($debug);
|
||||
} else {
|
||||
print $CGI->header(-expires=>'now');
|
||||
}
|
||||
|
@ -736,17 +753,17 @@ sub StartPage {
|
|||
print "<body><a name='top'>\n";
|
||||
|
||||
if ($debug) {
|
||||
push @errors, "UserID: $currentuser_id";
|
||||
push @errors, "UserName: " . $currentuser{username};
|
||||
push @messages, "UserID: $currentuser_id";
|
||||
push @messages, "UserName: " . $currentuser{username};
|
||||
}
|
||||
|
||||
print "<table style='width:100%' class='layout'>\n";
|
||||
print "<tr><td colspan=2>\n";
|
||||
HeaderBox($foo, $title);
|
||||
print "</td></tr>\n";
|
||||
if (scalar @errors) {
|
||||
if (scalar @messages) {
|
||||
print "<tr><td colspan=2>\n";
|
||||
ErrorsTable();
|
||||
MessagesTable();
|
||||
print "</td><tr>\n";
|
||||
}
|
||||
print "<tr><td valign=top width='200'>\n";
|
||||
|
@ -1090,6 +1107,7 @@ sub DocsTable {
|
|||
my %classes = Classes();
|
||||
my %pubstatuses = PubStatuses();
|
||||
my %reviewstatuses = ReviewStatuses();
|
||||
|
||||
|
||||
my $mypub_status = Param($foo,'strSTATUS');
|
||||
$mypub_status = "N" unless ($mypub_status);
|
||||
|
@ -1707,7 +1725,6 @@ sub MiscStatsTable {
|
|||
}
|
||||
my $table = "<table class='box'>\n";
|
||||
$table .= "<tr><th colspan=2>Miscellaneous Statistics</th></tr>";
|
||||
$table .= "<tr><th>Statistic</th><th>Value</th></tr>";
|
||||
$table .= "<tr><th>Average Age Since Last Update</th><td> ";
|
||||
$table .= sprintf("%i", $avg_age);
|
||||
$table .= " days</td></tr>";
|
||||
|
@ -2110,12 +2127,12 @@ sub TopicDocsTable {
|
|||
return $table;
|
||||
}
|
||||
|
||||
sub ErrorsTable {
|
||||
sub MessagesTable {
|
||||
my $message = '';
|
||||
if (scalar @errors) {
|
||||
if (scalar @messages) {
|
||||
print "<table><tr><td>\n";
|
||||
while (scalar @errors) {
|
||||
my $error = pop @errors;
|
||||
while (scalar @messages) {
|
||||
my $error = pop @messages;
|
||||
$message = $error . "<p>" . $message;
|
||||
}
|
||||
print "<p>$message\n";
|
||||
|
@ -2239,16 +2256,16 @@ sub Login {
|
|||
my $self = shift;
|
||||
my $title = shift;
|
||||
my $username = $CGI->param('username');
|
||||
push @errors, "Param('username'): " . $username if ($debug);
|
||||
push @messages, "Param('username'): " . $username if ($debug);
|
||||
my $password = $CGI->param('password');
|
||||
push @errors, "Param('password'): " . $password if ($debug);
|
||||
push @messages, "Param('password'): " . $password if ($debug);
|
||||
my $count = $DB->Value("SELECT COUNT(*) FROM username WHERE username='$username'");
|
||||
if ($count) {
|
||||
push @errors, "Found the user" if ($debug);
|
||||
push @messages, "Found the user" if ($debug);
|
||||
my $foundpw = $DB->Value("SELECT password FROM username WHERE username='$username'");
|
||||
if ($password eq $foundpw) {
|
||||
|
||||
push @errors, "Password matched" if ($debug);
|
||||
push @messages, "Password matched" if ($debug);
|
||||
# Load settings, since cookie won't be read until the next page
|
||||
#
|
||||
$currentuser_id = $DB->Value("SELECT user_id FROM username WHERE username='$username'");
|
||||
|
@ -2346,9 +2363,9 @@ sub SaveUser {
|
|||
}
|
||||
}
|
||||
|
||||
sub AddError {
|
||||
my ($self, $error) = @_;
|
||||
push @errors, $error;
|
||||
sub AddMessage {
|
||||
my ($self, $message) = @_;
|
||||
push @messages, $message;
|
||||
}
|
||||
|
||||
sub Redirect {
|
||||
|
@ -2375,7 +2392,7 @@ sub Mail {
|
|||
message => $message,
|
||||
smtp => $smtp);
|
||||
unless (&Mail::Sendmail::sendmail(%mail)) {
|
||||
push @errors, "Error sending mail"
|
||||
push @messages, "Error sending mail"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ ReviewStatusCombo();
|
|||
#TopicDocsTable();
|
||||
#Lintadas();
|
||||
#DocErrorsTable(1);
|
||||
Errors();
|
||||
|
||||
print "All tests run.\n\n";
|
||||
|
||||
|
@ -430,3 +431,11 @@ sub DocErrorsTable {
|
|||
my $doc_id = shift;
|
||||
print $L->DocErrorsTable($doc_id);
|
||||
}
|
||||
|
||||
sub Errors {
|
||||
my %errors = $L->Errors();
|
||||
foreach $key (keys %errors) {
|
||||
print "doc_id: $errors{$key}{doc_id}, error: $errors{$key}{error}\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Used to jump immediately to editing a document by doc_id.
|
||||
# Only available for Administrators and Maintainers.
|
||||
#
|
||||
use Lampadas;
|
||||
$L = new Lampadas;
|
||||
|
||||
unless ($L->Maintainer()) or $L->Admin()) {
|
||||
$L->Redirect("wrongpermission.pl");
|
||||
}
|
||||
|
||||
# Read parameters
|
||||
$doc_id = $L->Param(doc_id);
|
||||
$L->Redirect("document_edit.pl?doc_id=$doc_id");
|
||||
|
||||
|
||||
# Holding onto this just in case I discover something was using it.
|
||||
# But I don't think so. :-)
|
||||
#
|
||||
#$conn=Pg::connectdb("dbname=$dbmain");
|
||||
#die $conn->errorMessage unless PGRES_CONNECTION_OK eq $conn->status;
|
||||
#
|
||||
#$result = $conn->exec("SELECT url FROM document WHERE doc_id=$doc_id");
|
||||
#die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus;
|
||||
#
|
||||
#@row = $result->fetchrow;
|
||||
#
|
||||
## Load from db
|
||||
#$url = $row[0] =~ s/\s+$//;
|
||||
#
|
||||
#print $query->redirect("$url");
|
||||
|
|
|
@ -4,6 +4,6 @@ use Lampadas;
|
|||
$L = new Lampadas;
|
||||
$L->StartPage("Running Lintadas...");
|
||||
$L->Lintadas();
|
||||
print "<p>Ran Lampadas on all documents.";
|
||||
print "<p>Ran Lintadas on all documents.";
|
||||
$L->EndPage();
|
||||
|
||||
|
|
Loading…
Reference in New Issue