replaced $session{cgi} with $session{req}
This commit is contained in:
parent
1b0adbb416
commit
c01d7e49d5
33 changed files with 76 additions and 66 deletions
|
|
@ -52,7 +52,7 @@ sub _createField {
|
||||||
if (isIn($data->{type},qw(selectList checkList))) {
|
if (isIn($data->{type},qw(selectList checkList))) {
|
||||||
my @defaultValues;
|
my @defaultValues;
|
||||||
if ($session{form}{$param{name}}) {
|
if ($session{form}{$param{name}}) {
|
||||||
@defaultValues = $session{cgi}->param($param{name});
|
@defaultValues = $session{req}->param($param{name});
|
||||||
} else {
|
} else {
|
||||||
foreach (split(/\n/, $data->{value})) {
|
foreach (split(/\n/, $data->{value})) {
|
||||||
s/\s+$//; # remove trailing spaces
|
s/\s+$//; # remove trailing spaces
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ sub view {
|
||||||
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's
|
||||||
$input_name =~ s/^HttpProxy_//;
|
$input_name =~ s/^HttpProxy_//;
|
||||||
|
|
||||||
my $uploadFile = $session{cgi}->tmpFileName($session{form}{'HttpProxy_'.$input_name});
|
my $uploadFile = $session{req}->tmpFileName($session{form}{'HttpProxy_'.$input_name});
|
||||||
if(-r $uploadFile) { # Found uploaded file
|
if(-r $uploadFile) { # Found uploaded file
|
||||||
@formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/);
|
@formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/);
|
||||||
$formdata{$input_name}=\@formUpload;
|
$formdata{$input_name}=\@formUpload;
|
||||||
|
|
|
||||||
|
|
@ -258,9 +258,9 @@ sub view {
|
||||||
|
|
||||||
# Deal with pagination
|
# Deal with pagination
|
||||||
my $url = "query=".WebGUI::URL::escape($var{query});
|
my $url = "query=".WebGUI::URL::escape($var{query});
|
||||||
map {$url .= "&users=".WebGUI::URL::escape($_)} $session{cgi}->param('users');
|
map {$url .= "&users=".WebGUI::URL::escape($_)} $session{req}->param('users');
|
||||||
map {$url .= "&namespaces=".WebGUI::URL::escape($_)} $session{cgi}->param('namespaces');
|
map {$url .= "&namespaces=".WebGUI::URL::escape($_)} $session{req}->param('namespaces');
|
||||||
map {$url .= "&contentTypes=".WebGUI::URL::escape($_)} $session{cgi}->param('contentTypes');
|
map {$url .= "&contentTypes=".WebGUI::URL::escape($_)} $session{req}->param('contentTypes');
|
||||||
$url .= "&paginateAfter=".$self->getValue("paginateAfter");
|
$url .= "&paginateAfter=".$self->getValue("paginateAfter");
|
||||||
my $p = WebGUI::Paginator->new(WebGUI::URL::page($url), $self->getValue("paginateAfter"));
|
my $p = WebGUI::Paginator->new(WebGUI::URL::page($url), $self->getValue("paginateAfter"));
|
||||||
$p->setDataByArrayRef($results);
|
$p->setDataByArrayRef($results);
|
||||||
|
|
@ -293,8 +293,8 @@ sub view {
|
||||||
my $namespaces = $self->_getNamespaces('restricted');
|
my $namespaces = $self->_getNamespaces('restricted');
|
||||||
foreach(keys %$namespaces) {
|
foreach(keys %$namespaces) {
|
||||||
my $selected = 0;
|
my $selected = 0;
|
||||||
if (scalar $session{cgi}->param('namespaces')) {
|
if (scalar $session{req}->param('namespaces')) {
|
||||||
$selected = isIn($_, $session{cgi}->param('namespaces'));
|
$selected = isIn($_, $session{req}->param('namespaces'));
|
||||||
} else {
|
} else {
|
||||||
$selected = ($session{form}{namespaces} =~ /$_/);
|
$selected = ($session{form}{namespaces} =~ /$_/);
|
||||||
}
|
}
|
||||||
|
|
@ -311,8 +311,8 @@ sub view {
|
||||||
my $contentTypes = $self->_getContentTypes('restricted');
|
my $contentTypes = $self->_getContentTypes('restricted');
|
||||||
foreach(keys %$contentTypes) {
|
foreach(keys %$contentTypes) {
|
||||||
my $selected = 0;
|
my $selected = 0;
|
||||||
if (scalar $session{cgi}->param('contentTypes')) {
|
if (scalar $session{req}->param('contentTypes')) {
|
||||||
$selected = isIn($_, $session{cgi}->param('contentTypes'));
|
$selected = isIn($_, $session{req}->param('contentTypes'));
|
||||||
} else {
|
} else {
|
||||||
$selected = ($session{form}{contentTypes} =~ /$_/);
|
$selected = ($session{form}{contentTypes} =~ /$_/);
|
||||||
}
|
}
|
||||||
|
|
@ -335,8 +335,8 @@ sub view {
|
||||||
my $users = $self->_getUsers('restricted');
|
my $users = $self->_getUsers('restricted');
|
||||||
foreach(keys %$users) {
|
foreach(keys %$users) {
|
||||||
my $selected = 0;
|
my $selected = 0;
|
||||||
if (scalar $session{cgi}->param('users')) {
|
if (scalar $session{req}->param('users')) {
|
||||||
$selected = isIn($_, $session{cgi}->param('users'));
|
$selected = isIn($_, $session{req}->param('users'));
|
||||||
} else {
|
} else {
|
||||||
$selected = ($session{form}{users} =~ /$_/);
|
$selected = ($session{form}{users} =~ /$_/);
|
||||||
}
|
}
|
||||||
|
|
@ -346,7 +346,7 @@ sub view {
|
||||||
# Create a loop with searchable page roots
|
# Create a loop with searchable page roots
|
||||||
my $rootData;
|
my $rootData;
|
||||||
my @roots = split(/\n/, $self->get('searchRoot'));
|
my @roots = split(/\n/, $self->get('searchRoot'));
|
||||||
my %checked = map {$_=>1} $session{cgi}->param("searchRoot");
|
my %checked = map {$_=>1} $session{req}->param("searchRoot");
|
||||||
#if (isIn('any', @roots)) {
|
#if (isIn('any', @roots)) {
|
||||||
# foreach $rootData (WebGUI::Page->getAnonymousRoot->daughters) {
|
# foreach $rootData (WebGUI::Page->getAnonymousRoot->daughters) {
|
||||||
# push (@{$var{searchRoots}}, {
|
# push (@{$var{searchRoots}}, {
|
||||||
|
|
@ -402,7 +402,7 @@ sub _buildPageList {
|
||||||
my ($self, @userSpecifiedRoots, @roots, @allowedRoots, $pageId, @pages);
|
my ($self, @userSpecifiedRoots, @roots, @allowedRoots, $pageId, @pages);
|
||||||
$self = shift;
|
$self = shift;
|
||||||
|
|
||||||
@userSpecifiedRoots = $session{cgi}->param("searchRoot");
|
@userSpecifiedRoots = $session{req}->param("searchRoot");
|
||||||
|
|
||||||
if ((scalar(@userSpecifiedRoots) == 0)
|
if ((scalar(@userSpecifiedRoots) == 0)
|
||||||
|| ($self->getValue("forceSearchRoots"))
|
|| ($self->getValue("forceSearchRoots"))
|
||||||
|
|
@ -438,11 +438,11 @@ sub _buildFilter {
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# content-types
|
# content-types
|
||||||
if($session{form}{contentTypes} && ! isIn('any', $session{cgi}->param('contentTypes'))) {
|
if($session{form}{contentTypes} && ! isIn('any', $session{req}->param('contentTypes'))) {
|
||||||
$filter{contentType} = [ $session{cgi}->param('contentTypes') ];
|
$filter{contentType} = [ $session{req}->param('contentTypes') ];
|
||||||
|
|
||||||
# contentType "content" is a shortcut for "page", "wobject" and "wobjectDetail"
|
# contentType "content" is a shortcut for "page", "wobject" and "wobjectDetail"
|
||||||
if (isIn('content', $session{cgi}->param('contentTypes'))) {
|
if (isIn('content', $session{req}->param('contentTypes'))) {
|
||||||
push(@{$filter{contentType}}, qw/Asset assetDetail/);
|
push(@{$filter{contentType}}, qw/Asset assetDetail/);
|
||||||
}
|
}
|
||||||
} elsif ($self->getValue('contentTypes') !~ /any/i) {
|
} elsif ($self->getValue('contentTypes') !~ /any/i) {
|
||||||
|
|
@ -450,9 +450,9 @@ sub _buildFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
# users
|
# users
|
||||||
if($session{form}{users} && ! isIn('any', $session{cgi}->param('users'))) {
|
if($session{form}{users} && ! isIn('any', $session{req}->param('users'))) {
|
||||||
$filter{ownerId} = [];
|
$filter{ownerId} = [];
|
||||||
foreach my $user ($session{cgi}->param('users')) {
|
foreach my $user ($session{req}->param('users')) {
|
||||||
if ($user =~ /\D/) {
|
if ($user =~ /\D/) {
|
||||||
$user =~ s/\*/%/g;
|
$user =~ s/\*/%/g;
|
||||||
($user) = WebGUI::SQL->buildArray("select userId from users where username like ".quote($user));
|
($user) = WebGUI::SQL->buildArray("select userId from users where username like ".quote($user));
|
||||||
|
|
@ -464,8 +464,8 @@ sub _buildFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
# namespaces
|
# namespaces
|
||||||
if($session{form}{namespaces} && ! isIn('any', $session{cgi}->param('namespaces'))) {
|
if($session{form}{namespaces} && ! isIn('any', $session{req}->param('namespaces'))) {
|
||||||
$filter{namespace} = [ $session{cgi}->param('namespaces') ];
|
$filter{namespace} = [ $session{req}->param('namespaces') ];
|
||||||
} elsif ($self->getValue('namespaces') !~ /any/i) {
|
} elsif ($self->getValue('namespaces') !~ /any/i) {
|
||||||
$filter{namespace} = [ split(/\n/, $self->getValue('namespaces')) ];
|
$filter{namespace} = [ split(/\n/, $self->getValue('namespaces')) ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ Copies to clipboard assets in a list, then returns self calling method www_manag
|
||||||
sub www_copyList {
|
sub www_copyList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
foreach my $assetId ($session{req}->param("assetId")) {
|
||||||
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
||||||
if ($asset->canEdit) {
|
if ($asset->canEdit) {
|
||||||
my $newAsset = $asset->duplicate;
|
my $newAsset = $asset->duplicate;
|
||||||
|
|
@ -258,7 +258,7 @@ Cuts assets in a list (removes to clipboard), then returns self calling method w
|
||||||
sub www_cutList {
|
sub www_cutList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
foreach my $assetId ($session{req}->param("assetId")) {
|
||||||
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
||||||
if ($asset->canEdit) {
|
if ($asset->canEdit) {
|
||||||
$asset->cut;
|
$asset->cut;
|
||||||
|
|
@ -384,7 +384,7 @@ Returns a www_manageAssets() method. Pastes a selection of assets. If canEdit is
|
||||||
sub www_pasteList {
|
sub www_pasteList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||||
foreach my $clipId ($session{cgi}->param("assetId")) {
|
foreach my $clipId ($session{req}->param("assetId")) {
|
||||||
$self->paste($clipId);
|
$self->paste($clipId);
|
||||||
}
|
}
|
||||||
return $self->www_manageAssets();
|
return $self->www_manageAssets();
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ Moves list of assets to trash, returns www_manageAssets() method of self if canE
|
||||||
sub www_deleteList {
|
sub www_deleteList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||||
foreach my $assetId ($session{cgi}->param("assetId")) {
|
foreach my $assetId ($session{req}->param("assetId")) {
|
||||||
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
my $asset = WebGUI::Asset->newByDynamicClass($assetId);
|
||||||
if ($asset->canEdit) {
|
if ($asset->canEdit) {
|
||||||
$asset->trash;
|
$asset->trash;
|
||||||
|
|
@ -245,7 +245,7 @@ Restores a piece of content from the trash back to it's original location.
|
||||||
sub www_restoreList {
|
sub www_restoreList {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
return WebGUI::Privilege::insufficient() unless $self->canEdit;
|
||||||
foreach my $id ($session{cgi}->param("assetId")) {
|
foreach my $id ($session{req}->param("assetId")) {
|
||||||
my $asset = WebGUI::Asset->newByDynamicClass($id);
|
my $asset = WebGUI::Asset->newByDynamicClass($id);
|
||||||
$asset->publish;
|
$asset->publish;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ Returns an array or a carriage return ("\n") separated scalar depending upon whe
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @data = $session{cgi}->param($self->{name});
|
my @data = $session{req}->param($self->{name});
|
||||||
return wantarray ? @data : join("\n",@data);
|
return wantarray ? @data : join("\n",@data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ Retrieves a value from a form GET or POST and returns it. If the value comes bac
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $formValue = $session{cgi}->param($self->{name});
|
my $formValue = $session{req}->param($self->{name});
|
||||||
if (defined $formValue) {
|
if (defined $formValue) {
|
||||||
return $formValue;
|
return $formValue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ Returns a hex color like "#000000". Returns undef if the return value is not a v
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $color = $session{cgi}->param($self->{name});
|
my $color = $session{req}->param($self->{name});
|
||||||
return undef unless $color =~ /\#\w{6}/;
|
return undef unless $color =~ /\#\w{6}/;
|
||||||
return $color;
|
return $color;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ Returns an array or a carriage return ("\n") separated scalar depending upon whe
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
if ($session{cgi}->param($self->{name}."_new")) {
|
if ($session{req}->param($self->{name}."_new")) {
|
||||||
return $session{cgi}->param($self->{name}."_new");
|
return $session{req}->param($self->{name}."_new");
|
||||||
}
|
}
|
||||||
return $self->SUPER::getValueFromPost;
|
return $self->SUPER::getValueFromPost;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Returns either what's posted or if nothing comes back it returns "mixed".
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $session{cgi}->param($self->{name}) || "mixed";
|
return $session{req}->param($self->{name}) || "mixed";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ Retrieves a value from a form GET or POST and returns it. If the value comes bac
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $formValue = $session{cgi}->param($self->{name});
|
my $formValue = $session{req}->param($self->{name});
|
||||||
if (defined $formValue) {
|
if (defined $formValue) {
|
||||||
return $formValue;
|
return $formValue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ Returns a validated form post result. If the result does not pass validation, it
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::DateTime::setToEpoch($session{cgi}->param($self->{name}));
|
return WebGUI::DateTime::setToEpoch($session{req}->param($self->{name}));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ Returns a validated form post result. If the result does not pass validation, it
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::DateTime::setToEpoch($session{cgi}->param($self->{name}));
|
return WebGUI::DateTime::setToEpoch($session{req}->param($self->{name}));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ Returns a validated email address. If the result does not pass validation, it re
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
if ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ Returns either what's posted or if nothing comes back it returns "text".
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $session{cgi}->param($self->{name}) || "text";
|
return $session{req}->param($self->{name}) || "text";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ Returns either what's posted or if nothing comes back it returns "most".
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $session{cgi}->param($self->{name}) || "most";
|
return $session{req}->param($self->{name}) || "most";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Returns the integer from the form post, or returns 0.0 if the post result is inv
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /^[\d\-\.]+$/) {
|
if ($value =~ /^[\d\-\.]+$/) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ Returns either what's posted or if nothing comes back it returns "2" the ID of t
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @data = $session{cgi}->param($self->{name});
|
my @data = $session{req}->param($self->{name});
|
||||||
if (scalar(@data)) {
|
if (scalar(@data)) {
|
||||||
return wantarray ? @data : join("\n",@data);
|
return wantarray ? @data : join("\n",@data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ Returns the integer from the form post, or returns 0 if the post result is inval
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /^[\d\-]+$/) {
|
if ($value =~ /^[\d\-]+$/) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ Returns either the interval that was posted (in seconds) or if nothing comes bac
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::DateTime::intervalToSeconds($session{cgi}->param($self->{name}."_interval"),$session{cgi}->param($self->{name}."_units")) || 0;
|
return WebGUI::DateTime::intervalToSeconds($session{req}->param($self->{name}."_interval"),$session{req}->param($self->{name}."_units")) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ Returns an array or a carriage return ("\n") separated scalar depending upon whe
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @data = $session{cgi}->param($self->{name});
|
my @data = $session{req}->param($self->{name});
|
||||||
return wantarray ? @data : join("\n",@data);
|
return wantarray ? @data : join("\n",@data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ Returns a string filtered to allow only digits, spaces, and these special charac
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /^[\d\s\-\+\(\)]+$/) {
|
if ($value =~ /^[\d\s\-\+\(\)]+$/) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ Returns an array or a carriage return ("\n") separated scalar depending upon whe
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @data = $session{cgi}->param($self->{name});
|
my @data = $session{req}->param($self->{name});
|
||||||
return wantarray ? @data : join("\n",@data);
|
return wantarray ? @data : join("\n",@data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ Returns the number of seconds since 00:00:00 on a 24 hour clock. Note, this will
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return WebGUI::DateTime::timeToSeconds($session{cgi}->param($self->{name}))-($session{user}{timeOffset}*3600);
|
return WebGUI::DateTime::timeToSeconds($session{req}->param($self->{name}))-($session{user}{timeOffset}*3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ Parses the posted value and tries to make corrections if necessary.
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /mailto:/) {
|
if ($value =~ /mailto:/) {
|
||||||
return $value;
|
return $value;
|
||||||
} elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
} elsif ($value =~ /^([A-Z0-9]+[._+-]?){1,}([A-Z0-9]+[_+-]?)+\@(([A-Z0-9]+[._-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i) {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ Returns either a 1 or 0 representing yes, no.
|
||||||
|
|
||||||
sub yesNo {
|
sub yesNo {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
if ($session{cgi}->param($self->{name}) > 0) {
|
if ($session{req}->param($self->{name}) > 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ Returns a validated form post result. If the result does not pass validation, it
|
||||||
|
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $value = $session{cgi}->param($self->{name});
|
my $value = $session{req}->param($self->{name});
|
||||||
if ($value =~ /^[A-Z\d\s\-]+$/) {
|
if ($value =~ /^[A-Z\d\s\-]+$/) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ sub walkGroups {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_addGroupsToGroupSave {
|
sub www_addGroupsToGroupSave {
|
||||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||||
my @groups = $session{cgi}->param('groups');
|
my @groups = $session{req}->param('groups');
|
||||||
WebGUI::Grouping::addGroupsToGroups(\@groups,[$session{form}{gid}]);
|
WebGUI::Grouping::addGroupsToGroups(\@groups,[$session{form}{gid}]);
|
||||||
return www_manageGroupsInGroup();
|
return www_manageGroupsInGroup();
|
||||||
}
|
}
|
||||||
|
|
@ -166,7 +166,7 @@ sub www_addGroupsToGroupSave {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_addUsersToGroupSave {
|
sub www_addUsersToGroupSave {
|
||||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3) || _hasSecondaryPrivilege($session{form}{gid}));
|
||||||
my @users = $session{cgi}->param('users');
|
my @users = $session{req}->param('users');
|
||||||
WebGUI::Grouping::addUsersToGroups(\@users,[$session{form}{gid}]);
|
WebGUI::Grouping::addUsersToGroups(\@users,[$session{form}{gid}]);
|
||||||
return www_manageUsersInGroup();
|
return www_manageUsersInGroup();
|
||||||
}
|
}
|
||||||
|
|
@ -226,8 +226,8 @@ sub www_deleteGrouping {
|
||||||
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
|
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
|
||||||
return WebGUI::Privilege::vitalComponent();
|
return WebGUI::Privilege::vitalComponent();
|
||||||
}
|
}
|
||||||
my @users = $session{cgi}->param('uid');
|
my @users = $session{req}->param('uid');
|
||||||
my @groups = $session{cgi}->param("gid");
|
my @groups = $session{req}->param("gid");
|
||||||
foreach my $user (@users) {
|
foreach my $user (@users) {
|
||||||
my $u = WebGUI::User->new($user);
|
my $u = WebGUI::User->new($user);
|
||||||
$u->deleteFromGroups(\@groups);
|
$u->deleteFromGroups(\@groups);
|
||||||
|
|
|
||||||
|
|
@ -560,7 +560,7 @@ sub www_listProductVariantsSave {
|
||||||
|
|
||||||
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(14));
|
||||||
|
|
||||||
my %availableVariants = map {$_ => 1} $session{cgi}->param('available');
|
my %availableVariants = map {$_ => 1} $session{req}->param('available');
|
||||||
|
|
||||||
my $product = WebGUI::Product->new($session{form}{productId});
|
my $product = WebGUI::Product->new($session{form}{productId});
|
||||||
my @variants = @{$product->getVariant};
|
my @variants = @{$product->getVariant};
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ sub www_createSubscriptionCodeBatch {
|
||||||
-options=> \%subscriptions,
|
-options=> \%subscriptions,
|
||||||
-multiple=>1,
|
-multiple=>1,
|
||||||
-size => 5,
|
-size => 5,
|
||||||
-value => [ ($session{cgi}->param('subscriptionId'))]
|
-value => [ ($session{req}->param('subscriptionId'))]
|
||||||
);
|
);
|
||||||
$f->textarea(
|
$f->textarea(
|
||||||
-name => 'description',
|
-name => 'description',
|
||||||
|
|
@ -136,7 +136,7 @@ sub www_createSubscriptionCodeBatchSave {
|
||||||
|
|
||||||
WebGUI::SQL->write("insert into subscriptionCode (batchId, code, status, dateCreated, dateUsed, expires, usedBy)".
|
WebGUI::SQL->write("insert into subscriptionCode (batchId, code, status, dateCreated, dateUsed, expires, usedBy)".
|
||||||
" values (".quote($batchId).",".quote($code).", 'Unused', ".quote($creationEpoch).", 0, ".quote($expires).", 0)");
|
" values (".quote($batchId).",".quote($code).", 'Unused', ".quote($creationEpoch).", 0, ".quote($expires).", 0)");
|
||||||
@subscriptions = $session{cgi}->param('subscriptionId');
|
@subscriptions = $session{req}->param('subscriptionId');
|
||||||
foreach (@subscriptions) {
|
foreach (@subscriptions) {
|
||||||
WebGUI::SQL->write("insert into subscriptionCodeSubscriptions (code, subscriptionId) values (".
|
WebGUI::SQL->write("insert into subscriptionCodeSubscriptions (code, subscriptionId) values (".
|
||||||
quote($code).", ".quote($_).")");
|
quote($code).", ".quote($_).")");
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ sub www_deleteGrouping {
|
||||||
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
|
if (($session{user}{userId} eq $session{form}{uid} || $session{form}{uid} eq '3') && $session{form}{gid} eq '3') {
|
||||||
return _submenu(WebGUI::Privilege::vitalComponent());
|
return _submenu(WebGUI::Privilege::vitalComponent());
|
||||||
}
|
}
|
||||||
my @users = $session{cgi}->param('uid');
|
my @users = $session{req}->param('uid');
|
||||||
my @groups = $session{cgi}->param("gid");
|
my @groups = $session{req}->param("gid");
|
||||||
foreach my $user (@users) {
|
foreach my $user (@users) {
|
||||||
my $u = WebGUI::User->new($user);
|
my $u = WebGUI::User->new($user);
|
||||||
$u->deleteFromGroups(\@groups);
|
$u->deleteFromGroups(\@groups);
|
||||||
|
|
@ -323,7 +323,7 @@ sub www_editUser {
|
||||||
$previousCategory = $category;
|
$previousCategory = $category;
|
||||||
}
|
}
|
||||||
$a->finish;
|
$a->finish;
|
||||||
my @groupsToAdd = $session{cgi}->param("groupsToAdd");
|
my @groupsToAdd = $session{req}->param("groupsToAdd");
|
||||||
my @exclude = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($u->userId));
|
my @exclude = WebGUI::SQL->buildArray("select groupId from groupings where userId=".quote($u->userId));
|
||||||
@exclude = (@exclude,"1","2","7");
|
@exclude = (@exclude,"1","2","7");
|
||||||
$tabform->getTab("groups")->group(
|
$tabform->getTab("groups")->group(
|
||||||
|
|
@ -345,7 +345,7 @@ sub www_editUser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
push (@include, "0");
|
push (@include, "0");
|
||||||
my @groupsToDelete = $session{cgi}->param("groupsToDelete");
|
my @groupsToDelete = $session{req}->param("groupsToDelete");
|
||||||
$tabform->getTab("groups")->selectList(
|
$tabform->getTab("groups")->selectList(
|
||||||
-name=>"groupsToDelete",
|
-name=>"groupsToDelete",
|
||||||
-options=>WebGUI::SQL->buildHashRef("select groupId, groupName from groups
|
-options=>WebGUI::SQL->buildHashRef("select groupId, groupName from groups
|
||||||
|
|
@ -385,9 +385,9 @@ sub www_editUserSave {
|
||||||
$u->profileField($field{fieldName},WebGUI::FormProcessor::process($field{fieldName},$field{dataType}));
|
$u->profileField($field{fieldName},WebGUI::FormProcessor::process($field{fieldName},$field{dataType}));
|
||||||
}
|
}
|
||||||
$a->finish;
|
$a->finish;
|
||||||
my @groups = $session{cgi}->param("groupsToAdd");
|
my @groups = $session{req}->param("groupsToAdd");
|
||||||
$u->addToGroups(\@groups);
|
$u->addToGroups(\@groups);
|
||||||
@groups = $session{cgi}->param("groupsToDelete");
|
@groups = $session{req}->param("groupsToDelete");
|
||||||
$u->deleteFromGroups(\@groups);
|
$u->deleteFromGroups(\@groups);
|
||||||
} else {
|
} else {
|
||||||
$error = '<ul><li>'.WebGUI::International::get(77).' '.$session{form}{username}.'Too or '.$session{form}{username}.'02</li></ul>';
|
$error = '<ul><li>'.WebGUI::International::get(77).' '.$session{form}{username}.'Too or '.$session{form}{username}.'02</li></ul>';
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ sub addFileFromFormPost {
|
||||||
return "" if (WebGUI::HTTP::getStatus() =~ /^413/);
|
return "" if (WebGUI::HTTP::getStatus() =~ /^413/);
|
||||||
my $filename;
|
my $filename;
|
||||||
my $attachmentCount = 1;
|
my $attachmentCount = 1;
|
||||||
foreach my $tempPath ($session{cgi}->upload($formVariableName)) {
|
foreach my $tempPath ($session{req}->upload($formVariableName)) {
|
||||||
last if $attachmentCount > $attachmentLimit;
|
last if $attachmentCount > $attachmentLimit;
|
||||||
if ($tempPath =~ /([^\/\\]+)$/) {
|
if ($tempPath =~ /([^\/\\]+)$/) {
|
||||||
$filename = $1;
|
$filename = $1;
|
||||||
|
|
|
||||||
18
www/index.pl
18
www/index.pl
|
|
@ -13,16 +13,26 @@
|
||||||
our ($webguiRoot, $configFile);
|
our ($webguiRoot, $configFile);
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
$configFile = "WebGUI.conf";
|
$configFile = "webgui.conf";
|
||||||
$webguiRoot = "/data/WebGUI";
|
$webguiRoot = "/data/WebGUI";
|
||||||
unshift (@INC, $webguiRoot."/lib");
|
unshift (@INC, $webguiRoot."/lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
#-----------------DO NOT MODIFY BELOW THIS LINE--------------------
|
#-----------------DO NOT MODIFY BELOW THIS LINE--------------------
|
||||||
|
#use Devel::Profiler bad_pkgs => [qw(UNIVERSAL Time::HiRes B Carp Exporter Cwd Config CORE DynaLoader XSLoader AutoLoader Safe)];
|
||||||
use CGI::Carp qw(fatalsToBrowser);
|
#use CGI::Carp qw(fatalsToBrowser);
|
||||||
use strict;
|
use strict;
|
||||||
use WebGUI;
|
use WebGUI;
|
||||||
|
|
||||||
print WebGUI::page($webguiRoot,$configFile);
|
print WebGUI::page($webguiRoot,$configFile);
|
||||||
|
|
||||||
|
# use Devel::DProfPP;
|
||||||
|
# my $pp = Devel::DProfPP->new;
|
||||||
|
#use Data::Dumper;
|
||||||
|
# print Devel::DProfPP->new(
|
||||||
|
# file => "tmon.out",
|
||||||
|
# enter => sub { my ($self, $sub_name) = shift;
|
||||||
|
# my $frame = ($self->stack)[-1];
|
||||||
|
# print "\t" x $frame->height, $frame->sub_name;
|
||||||
|
# }
|
||||||
|
# )->parse;
|
||||||
|
# print Dumper(\%hash);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue