fixing some typos. also the File/Storage bug. also fixing the changelogs.

This commit is contained in:
Matthew Wilson 2006-01-03 05:12:51 +00:00
parent 21188e7949
commit e4bf3c60b0
6 changed files with 24 additions and 27 deletions

View file

@ -198,13 +198,13 @@ sub processPropertiesFromFormPost {
delete $self->{_storageLocation};
my $storage = $self->getStorageLocation;
my $filename = $storage->addFileFromFormPost("file",1);
if (defined $filename) {
if (defined $filename && $filename ne $self->get("filename")) {
my %data;
$data{filename} = $filename;
$data{storageId} = $storage->getId;
$data{title} = $filename unless ($self->session->form->process("title"));
$data{menuTitle} = $filename unless ($self->session->form->process("menuTitle"));
$data{url} = $self->getParent->get('url').'/'.$filename unless ($self->session->form->process("url"));
$data{title} = $filename unless ($session{form}{title});
$data{menuTitle} = $filename unless ($session{form}{menuTitle});
$data{url} = $self->getParent->get('url').'/'.$filename unless ($session{form}{url});
$self->update(\%data);
}
}

View file

@ -18,7 +18,6 @@ use DBI;
use Exporter;
use strict;
use Tie::IxHash;
use WebGUI::ErrorHandler;
use WebGUI::Id;
use WebGUI::Session;
use WebGUI::Utility;
@ -301,7 +300,8 @@ Returns an error code for the current handler.
=cut
sub errorCode {
return $self->dbh->err;
my $self = shift;
return $self->dbh->err;
}
@ -314,7 +314,8 @@ Returns a text error message for the current handler.
=cut
sub errorMessage {
return $self->dbh->errstr;
my $self = shift;
return $self->dbh->errstr;
}
@ -644,7 +645,7 @@ sub setRow {
my ($self, $table, $keyColumn, $data, $id) = @_;
if ($data->{$keyColumn} eq "new" || $id) {
$data->{$keyColumn} = $id || WebGUI::Id::generate();
$self->write("insert into $table ($keyColumn) values (".$self->quote($data->{$keyColumn}).")", $dbh);
$self->write("insert into $table ($keyColumn) values (".$self->quote($data->{$keyColumn}).")");
}
my (@pairs);
foreach my $key (keys %{$data}) {
@ -653,7 +654,7 @@ sub setRow {
}
}
if ($pairs[0] ne "") {
$self->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".$self->quote($data->{$keyColumn}), $dbh);
$self->write("update $table set ".join(", ", @pairs)." where ".$keyColumn."=".$self->quote($data->{$keyColumn}));
}
return $data->{$keyColumn};
}

View file

@ -39,7 +39,7 @@ Package WebGUI::Session
=head1 DESCRIPTION
This package is the heart and lifeblood of WebGUI; it is the glue that holds WebGUI together. When you create a session object, you'll immidiately have access to all sorts of other objects. By passing the session object around in code you'll have access to the default database connection, error handler, user and more without having to create it each time. The lends much speed to WebGUI.
This package is the heart and lifeblood of WebGUI; it is the glue that holds WebGUI together. When you create a session object, you'll immediately have access to all sorts of other objects. By passing the session object around in code you'll have access to the default database connection, error handler, user and more without having to create it each time. The lends much speed to WebGUI.
B<NOTE:> It is important to distinguish the difference between a WebGUI session and a user session. A user session is just part of a WebGUI session. A WebGUI session is all of the basic data the WebGUI needs to operate.
@ -204,7 +204,7 @@ sub errorHandler {
unless (exists $self->{_errorHandler}) {
$self->{_errorHandler} = WebGUI::Session::ErrorHandler->new($self);
}
return $self-{_errorHandler};
return $self->{_errorHandler};
}
#-------------------------------------------------------------------

View file

@ -203,14 +203,9 @@ sub addFileFromFormPost {
my $attachmentCount = 1;
foreach my $upload ($session{req}->upload($formVariableName)) {
return $filename if $attachmentCount > $attachmentLimit;
my $tempPath = $upload->tempname();
$filename = $upload->filename();
next unless $filename;
if ($tempPath =~ /([^\/\\]+)$/) {
$filename = $1;
} else {
$filename = $tempPath;
}
if ($filename =~ /([^\/\\]+)$/) { $filename = $1; }
my $type = $self->getFileExtension($filename);
if (isIn($type, qw(pl perl sh cgi php asp))) { # make us safe from malicious uploads
$filename =~ s/\./\_/g;
@ -233,7 +228,8 @@ sub addFileFromFormPost {
return undef;
}
}
return $filename;
return $filename if $filename;
return undef;
}