From 877bf082a0f4223e5a050a483dc5d3404484d3dc Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 12 Jan 2006 17:24:06 +0000 Subject: [PATCH] migrating paginator api to new session system fixed a few old style session vars --- docs/migration.txt | 24 ++-- lib/WebGUI/Asset.pm | 8 +- lib/WebGUI/Asset/File.pm | 6 +- lib/WebGUI/Asset/Post.pm | 6 +- lib/WebGUI/Asset/Post/Thread.pm | 2 +- lib/WebGUI/Asset/Shortcut.pm | 4 +- lib/WebGUI/Asset/Wobject/Article.pm | 2 +- lib/WebGUI/Asset/Wobject/Collaboration.pm | 48 +++---- lib/WebGUI/Asset/Wobject/DataForm.pm | 8 +- lib/WebGUI/Asset/Wobject/HttpProxy.pm | 8 +- lib/WebGUI/Asset/Wobject/InOutBoard.pm | 4 +- lib/WebGUI/Asset/Wobject/IndexedSearch.pm | 2 +- lib/WebGUI/Asset/Wobject/Matrix.pm | 14 +- lib/WebGUI/Asset/Wobject/Navigation.pm | 4 +- lib/WebGUI/Asset/Wobject/SQLReport.pm | 6 +- lib/WebGUI/Asset/Wobject/Survey.pm | 24 ++-- lib/WebGUI/Asset/Wobject/WSClient.pm | 12 +- lib/WebGUI/AssetBranch.pm | 2 +- lib/WebGUI/AssetVersioning.pm | 2 +- lib/WebGUI/Auth/LDAP.pm | 24 ++-- lib/WebGUI/Auth/WebGUI.pm | 2 +- lib/WebGUI/Mail.pm | 107 ++++++++-------- lib/WebGUI/MessageLog.pm | 148 +++++++++++----------- lib/WebGUI/Operation/ActiveSessions.pm | 2 +- lib/WebGUI/Operation/Commerce.pm | 8 +- lib/WebGUI/Operation/Group.pm | 6 +- lib/WebGUI/Operation/LDAPLink.pm | 2 +- lib/WebGUI/Operation/LoginHistory.pm | 2 +- lib/WebGUI/Operation/MessageLog.pm | 2 +- lib/WebGUI/Operation/Settings.pm | 2 +- lib/WebGUI/Operation/Subscription.pm | 8 +- lib/WebGUI/Operation/User.pm | 2 +- lib/WebGUI/Paginator.pm | 33 ++++- lib/WebGUI/ProfileField.pm | 8 +- 34 files changed, 280 insertions(+), 262 deletions(-) diff --git a/docs/migration.txt b/docs/migration.txt index d31547eed..bf81cff4d 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -576,28 +576,28 @@ Fix $session{config} perl -pi.bak -e 's!\$session{config}{webguiRoot}!\$self->session->config->getWebguiRoot!g' fileNameGoesHere perl -pi.bak -e 's!\$session{config}{configFile}!\$self->session->config->getFilename!g' fileNameGoesHere -perl -pi.bak -e 's!\$session{config}{(\w+)}!\$self->session->config->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{config}{(.*)}!\$self->session->config->get("$1")!g' fileNameGoesHere Fix $session{setting} -perl -pi.bak -e 's!\$session{setting}{(\w+)}!\$self->session->setting->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{setting}{(.*)}!\$self->session->setting->get("$1")!g' fileNameGoesHere Fix $session{user} perl -pi.bak -e 's!\$session{user}{(username|userId)}!\$self->session->user->$1!g' fileNameGoesHere -perl -pi.bak -e 's!\$session{user}{(\w+)}!\$self->session->user->profileField("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{user}{(.*)}!\$self->session->user->profileField("$1")!g' fileNameGoesHere Fix $session{env} -perl -pi.bak -e 's!\$session{env}{(\w+)}!\$self->session->env->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{env}{(.*)}!\$self->session->env->get("$1")!g' fileNameGoesHere Fix $session{os} -perl -pi.bak -e 's!\$session{os}{(\w+)}!\$self->session->os->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{os}{(.*)}!\$self->session->os->get("$1")!g' fileNameGoesHere Fix $session{var} -perl -pi.bak -e 's!\$session{var}{(\w+)}!\$self->session->var->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{var}{(.*)}!\$self->session->var->get("$1")!g' fileNameGoesHere Fix $session{req} @@ -613,7 +613,7 @@ perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteAllScratch!\$self->session->scratc perl -pi.bak -e 's!WebGUI\:\:Session\:\:deleteScratch!\$self->session->scratch->delete!g' fileNameGoesHere perl -pi.bak -e 's!WebGUI\:\:Session\:\:setScratch!\$self->session->scratch->set!g' fileNameGoesHere perl -pi.bak -e 's!WebGUI\:\:Session\:\:getScratch!\$self->session->scratch->get!g' fileNameGoesHere -perl -pi.bak -e 's!\$session{scratch}{(\w+)}!\$self->session->scratch->get("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{scratch}{(.*)}!\$self->session->scratch->get("$1")!g' fileNameGoesHere 5.23.1 WebGUI::SQL API Refactored @@ -636,7 +636,7 @@ perl -pi.bak -e 's!quote\(!\$self->session->db->quote(!g' fileNameGoesHere Instead of accessing $session{form} or WebGUI::FormProcessor getting form data is done through the new session system via $session->form->process("param","Text"); -perl -pi.bak -e 's!\$session{form}{(\w+)}!\$self->session->form->process("$1")!g' fileNameGoesHere +perl -pi.bak -e 's!\$session{form}{(.*)}!\$self->session->form->process("$1")!g' fileNameGoesHere perl -pi.bak -e 's!WebGUI\:\:FormProcessor\:\:!\$self->session->form->!g' fileNameGoesHere @@ -789,6 +789,14 @@ perl -pi.bak -e 's!WebGUI\:\:LDAPLink\:\:getList\(!WebGUI::LDAPLink->getList(\$s perl -pi.bak -e 's!WebGUI\:\:LDAPLink\:\:get\((.*)\)!WebGUI::LDAPLink->new(\$self->session,$1)->get!g' fileNameGoesHere +5.23.18 WebGUI::Paginator API Refactored + +WebGUI::Paginator API was changed to use the new session API. + +perl -pi.bak -e 's!WebGUI\:\:Paginator\-\>new\(!WebGUI::Paginator->new(\$self->session,!g' fileNameGoesHere + + + 6. Automatic list of Assets in Help System. ------------------------------------- 6.1 Starting in WebGUI 6.7, there is now an automatic list of all Assets diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 60dce8166..95c867871 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -364,7 +364,7 @@ sub getAssetAdderLinks { my $addToUrl = shift; my $type = shift || "assets"; my %links; - foreach my $class (@{$session{config}{$type}}) { + foreach my $class (@{$self->session->config->get("$type}")) { next unless $class; my $load = "use ".$class; eval ($load); @@ -964,7 +964,7 @@ sub getValue { my $self = shift; my $key = shift; if (defined $key) { - # return $session{form}{$key} if (exists $session{form}{$key}); # Security Hazard! + # return $self->session->form->process("$key} if (exists $session{form}{$key")); # Security Hazard! my $storedValue = $self->get($key); return $storedValue if (defined $storedValue); unless (exists $self->{_propertyDefinitions}) { # check to see if the definitions have been merged and cached @@ -1201,7 +1201,7 @@ sub processPropertiesFromFormPost { } foreach my $form (keys %{$session{form}}) { if ($form =~ /^metadata_(.*)$/) { - $self->updateMetaData($1,$session{form}{$form}); + $self->updateMetaData($1,$self->session->form->process("$form")); } } $data{title} = "Untitled" unless ($data{title}); @@ -1416,7 +1416,7 @@ sub www_add { $self->session->errorHandler->security("tried to call an invalid class ".$class); return ""; } - if ($session{form}{'prototype'}) { + if ($self->session->form->process("'prototype'")) { my $prototype = WebGUI::Asset->new($self->session->form->process("prototype"),$class); foreach my $definition (@{$prototype->definition}) { # cycle through rather than copying properties to avoid grabbing stuff we shouldn't grab foreach my $property (keys %{$definition->{properties}}) { diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index ee6b3df7d..232577dd3 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -202,9 +202,9 @@ sub processPropertiesFromFormPost { my %data; $data{filename} = $filename; $data{storageId} = $storage->getId; - $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}); + $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")); $self->update(\%data); } } diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 2220968d9..e68fe7ce8 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -660,7 +660,7 @@ sub processPropertiesFromFormPost { ); $data{url} = $self->fixUrl($self->getThread->get("url")."/1") if ($self->isReply); if ($self->getThread->getParent->canModerate) { - $self->getThread->lock if ($session{form}{'lock'}); + $self->getThread->lock if ($self->session->form->process("'lock'")); $self->getThread->stick if ($self->session->form->process("stick")); } } @@ -1002,7 +1002,7 @@ sub www_edit { }); $var{'lock.form'} = WebGUI::Form::yesNo({ name=>'lock', - value=>$session{form}{'lock'} + value=>$self->session->form->process("'lock'") }); } $var{'subscribe.form'} = WebGUI::Form::yesNo({ @@ -1035,7 +1035,7 @@ sub www_edit { ($var{'preview.synopsis'}, $var{'preview.content'}) = $self->getSynopsisAndContentFromFormPost; $var{'preview.content'} = $self->formatContent($var{'preview.content'},$self->session->form->process("contentType")); for my $i (1..5) { - $var{'preview.userDefined'.$i} = WebGUI::HTML::filter($session{form}{'userDefined'.$i},"macros"); + $var{'preview.userDefined'.$i} = WebGUI::HTML::filter($self->session->form->process("'userDefined'.$i"),"macros"); } } $var{'form.footer'} = WebGUI::Form::formFooter($self->session,); diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index c9247f162..55caba324 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -647,7 +647,7 @@ sub view { $var->{'lock.url'} = $self->getLockUrl; $var->{'unlock.url'} = $self->getUnlockUrl; - my $p = WebGUI::Paginator->new($self->getUrl,$self->getParent->get("postsPerPage")); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->getParent->get("postsPerPage")); my $sql = "select asset.assetId, asset.className, assetData.revisionDate as revisionDate from asset left join assetData on assetData.assetId=asset.assetId left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index c64dc7f28..0862c8121 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -463,8 +463,8 @@ sub getShortcutByCriteria { my $scratchId; if ($assetId) { $scratchId = "Shortcut_" . $assetId; - if($session{scratch}{$scratchId} && !$self->getValue("disableContentLock")) { - return $session{scratch}{$scratchId} unless ($self->session->var->get("adminOn")); + if($self->session->scratch->get("$scratchId") && !$self->getValue("disableContentLock")) { + return $self->session->scratch->get("$scratchId") unless ($self->session->var->get("adminOn")); } } diff --git a/lib/WebGUI/Asset/Wobject/Article.pm b/lib/WebGUI/Asset/Wobject/Article.pm index d337cd5aa..c99566a61 100644 --- a/lib/WebGUI/Asset/Wobject/Article.pm +++ b/lib/WebGUI/Asset/Wobject/Article.pm @@ -172,7 +172,7 @@ sub view { $var{"description.first.2sentences"} =~ s/^((.*?\.){2}).*/$1/s; $var{"description.first.sentence"} = $var{"description.first.2sentences"}; $var{"description.first.sentence"} =~ s/^(.*?\.).*/$1/s; - my $p = WebGUI::Paginator->new($self->getUrl,1); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl,1); if ($self->session->form->process("makePrintable") || $var{description} eq "") { $var{description} =~ s/\^\-\;//g; $p->setDataByArrayRef([$var{description}]); diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index a3b7542a2..b1cd18cfa 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -894,9 +894,9 @@ sub view { my $self = shift; my $scratchSortBy = $self->getId."_sortBy"; my $scratchSortOrder = $self->getId."_sortDir"; - my $sortBy = $self->session->form->process("sortBy") || $session{scratch}{$scratchSortBy} || $self->get("sortBy"); - my $sortOrder = $session{scratch}{$scratchSortOrder} || $self->get("sortOrder"); - if ($sortBy ne $session{scratch}{$scratchSortBy} && $self->session->form->process("func") ne "editSave") { + my $sortBy = $self->session->form->process("sortBy") || $self->session->scratch->get("$scratchSortBy") || $self->get("sortBy"); + my $sortOrder = $self->session->scratch->get("$scratchSortOrder") || $self->get("sortOrder"); + if ($sortBy ne $self->session->scratch->get("$scratchSortBy") && $self->session->form->process("func") ne "editSave") { $self->session->scratch->set($scratchSortBy,$self->session->form->process("sortBy")); } elsif ($self->session->form->process("sortBy") && $self->session->form->process("func") ne "editSave") { if ($sortOrder eq "asc") { @@ -938,7 +938,7 @@ sub view { left join assetData on assetData.assetId=Thread.assetId and Thread.revisionDate = assetData.revisionDate where asset.parentId=".$self->session->db->quote($self->getId)." and asset.state='published' and asset.className='WebGUI::Asset::Post::Thread' and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId) and $constraints group by assetData.assetId order by Thread.isSticky desc, ".$sortBy." ".$sortOrder; - my $p = WebGUI::Paginator->new($self->getUrl,$self->get("threadsPerPage")); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl,$self->get("threadsPerPage")); $self->appendPostListTemplateVars(\%var, $sql, $p); $self->appendTemplateLabels(\%var); return $self->processTemplate(\%var,$self->get("collaborationTemplateId")); @@ -965,28 +965,28 @@ sub www_search { .WebGUI::Form::hidden($self->session,{ name=>"doit", value=>1 }); $var{'all.form'} = WebGUI::Form::text({ name=>'all', - value=>$session{scratch}{$self->getId."_all"}, + value=>$self->session->scratch->get("$self->getId."_all""), size=>($self->session->setting->get("textBoxSize")-5) }); $var{'exactphrase.form'} = WebGUI::Form::text({ name=>'exactPhrase', - value=>$session{scratch}{$self->getId."_exactPhrase"}, + value=>$self->session->scratch->get("$self->getId."_exactPhrase""), size=>($self->session->setting->get("textBoxSize")-5) }); $var{'atleastone.form'} = WebGUI::Form::text({ name=>'atLeastOne', - value=>$session{scratch}{$self->getId."_atLeastOne"}, + value=>$self->session->scratch->get("$self->getId."_atLeastOne""), size=>($self->session->setting->get("textBoxSize")-5) }); $var{'without.form'} = WebGUI::Form::text({ name=>'without', - value=>$session{scratch}{$self->getId."_without"}, + value=>$self->session->scratch->get("$self->getId."_without""), size=>($self->session->setting->get("textBoxSize")-5) }); my %results; tie %results, 'Tie::IxHash'; %results = (10=>'10', 25=>'25', 50=>'50', 100=>'100'); - my $numResults = $session{scratch}{$self->getId."_numResults"} || $self->get("threadsPerPage"); + my $numResults = $self->session->scratch->get("$self->getId."_numResults"") || $self->get("threadsPerPage"); $var{'results.form'} = WebGUI::Form::selectBox({ name=>"numResults", options=>\%results, @@ -1000,10 +1000,10 @@ sub www_search { if ($self->session->form->process("doit")) { my @fieldsToSearch = qw(assetData.title assetData.synopsis Post.content Post.username Post.userDefined1 Post.userDefined2 Post.userDefined3 Post.userDefined4 Post.userDefined5); my $all; - if ($session{scratch}{$self->getId."_all"} ne "") { - $session{scratch}{$self->getId."_all"} =~ s/,/ /g; - $session{scratch}{$self->getId."_all"} =~ s/\s+/ /g; - my @words = split(/ /,$session{scratch}{$self->getId."_all"}); + if ($self->session->scratch->get("$self->getId."_all"") ne "") { + $self->session->scratch->get("$self->getId."_all"") =~ s/,/ /g; + $self->session->scratch->get("$self->getId."_all"") =~ s/\s+/ /g; + my @words = split(/ /,$self->session->scratch->get("$self->getId."_all"")); foreach my $word (@words) { $all .= " and " if ($all ne ""); $all .= "("; @@ -1018,17 +1018,17 @@ sub www_search { } } my $exactPhrase; - if ($session{scratch}{$self->getId."_exactPhrase"} ne "") { + if ($self->session->scratch->get("$self->getId."_exactPhrase"") ne "") { foreach my $field (@fieldsToSearch) { $exactPhrase .= " or " if ($exactPhrase ne ""); - $exactPhrase .= " $field like ".$self->session->db->quote("%".$session{scratch}{$self->getId."_exactPhrase"}."%"); + $exactPhrase .= " $field like ".$self->session->db->quote("%".$self->session->scratch->get("$self->getId."_exactPhrase"")."%"); } } my $atLeastOne; - if ($session{scratch}{$self->getId."_atLeastOne"} ne "") { - $session{scratch}{$self->getId."_atLeastOne"} =~ s/,/ /g; - $session{scratch}{$self->getId."_atLeastOne"} =~ s/\s+/ /g; - my @words = split(/ /,$session{scratch}{$self->getId."_atLeastOne"}); + if ($self->session->scratch->get("$self->getId."_atLeastOne"") ne "") { + $self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/,/ /g; + $self->session->scratch->get("$self->getId."_atLeastOne"") =~ s/\s+/ /g; + my @words = split(/ /,$self->session->scratch->get("$self->getId."_atLeastOne"")); foreach my $word (@words) { foreach my $field (@fieldsToSearch) { $atLeastOne .= " or " if ($atLeastOne ne ""); @@ -1037,10 +1037,10 @@ sub www_search { } } my $without; - if ($session{scratch}{$self->getId."_without"} ne "") { - $session{scratch}{$self->getId."_without"} =~ s/,/ /g; - $session{scratch}{$self->getId."_without"} =~ s/\s+/ /g; - my @words = split(/ /,$session{scratch}{$self->getId."_without"}); + if ($self->session->scratch->get("$self->getId."_without"") ne "") { + $self->session->scratch->get("$self->getId."_without"") =~ s/,/ /g; + $self->session->scratch->get("$self->getId."_without"") =~ s/\s+/ /g; + my @words = split(/ /,$self->session->scratch->get("$self->getId."_without"")); foreach my $word (@words) { foreach my $field (@fieldsToSearch) { $without .= " and " if ($without ne ""); @@ -1071,7 +1071,7 @@ sub www_search { $sql .= " and " if ($sql ne "" && $without ne ""); $sql .= " ($without) " if ($without ne ""); $sql .= " group by assetData.assetId order by Post.dateSubmitted desc"; - my $p = WebGUI::Paginator->new($self->getUrl("func=search;doit=1"),$numResults); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl("func=search;doit=1"),$numResults); $self->appendPostListTemplateVars(\%var, $sql, $p); } return $self->processStyle($self->processTemplate(\%var, $self->get("searchTemplateId"))); diff --git a/lib/WebGUI/Asset/Wobject/DataForm.pm b/lib/WebGUI/Asset/Wobject/DataForm.pm index eab4445b4..f2fdc7592 100644 --- a/lib/WebGUI/Asset/Wobject/DataForm.pm +++ b/lib/WebGUI/Asset/Wobject/DataForm.pm @@ -40,7 +40,7 @@ sub _createField { my %param; $param{name} = $data->{name}; $param{name} = "field_".$data->{sequenceNumber} if ($param{name} eq ""); # Empty fieldname not allowed - $session{form}{$param{name}} =~ s/\^.*?\;//gs ; # remove macro's from user input + $self->session->form->process("$param{name}") =~ s/\^.*?\;//gs ; # remove macro's from user input $param{value} = $data->{value}; $param{size} = $data->{width}; $param{rows} = $data->{rows} || 5; @@ -53,7 +53,7 @@ sub _createField { } if (isIn($data->{type},qw(selectList checkList))) { my @defaultValues; - if ($session{form}{$param{name}}) { + if ($self->session->form->process("$param{name}")) { @defaultValues = $self->session->form->selectList($param{name}); } else { foreach (split(/\n/, $data->{value})) { @@ -426,7 +426,7 @@ sub getRecordTemplateVars { my @fields; my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId=".$self->session->db->quote($tab{DataForm_tabId})." order by a.sequenceNumber"); while (%data = $sth->hash) { - my $formValue = $session{form}{$data{name}}; + my $formValue = $self->session->form->process("$data{name}"); if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) { $data{value} = $formValue; $data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date"); @@ -470,7 +470,7 @@ sub getRecordTemplateVars { my @fields; my $sth = $self->session->db->read("$select from DataForm_field as a $join $where and a.DataForm_tabId = 0 order by a.sequenceNumber"); while (%data = $sth->hash) { - my $formValue = $session{form}{$data{name}}; + my $formValue = $self->session->form->process("$data{name}"); if ((not exists $data{value}) && $self->session->form->process("func") ne "editSave" && $self->session->form->process("func") ne "editFieldSave" && defined $formValue) { $data{value} = $formValue; $data{value} = $self->session->datetime->setToEpoch($data{value}) if ($data{type} eq "date"); diff --git a/lib/WebGUI/Asset/Wobject/HttpProxy.pm b/lib/WebGUI/Asset/Wobject/HttpProxy.pm index eaf2fb96c..e72e168ad 100644 --- a/lib/WebGUI/Asset/Wobject/HttpProxy.pm +++ b/lib/WebGUI/Asset/Wobject/HttpProxy.pm @@ -232,7 +232,7 @@ sub view { foreach my $input_name (keys %{$session{form}}) { next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's $input_name =~ s/^HttpProxy_//; - $proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=$session{form}{'HttpProxy_'.$input_name}"); + $proxiedUrl=$self->session->url->append($proxiedUrl,"$input_name=$self->session->form->process("'HttpProxy_'.$input_name")"); } } $request = HTTP::Request->new(GET => $proxiedUrl, $header) || return "wrong url"; # Create GET request @@ -245,13 +245,13 @@ sub view { next if ($input_name !~ /^HttpProxy_/); # Skip non proxied form var's $input_name =~ s/^HttpProxy_//; - my $uploadFile = $self->session->request->tmpFileName($session{form}{'HttpProxy_'.$input_name}); + my $uploadFile = $self->session->request->tmpFileName($self->session->form->process("'HttpProxy_'.$input_name")); if(-r $uploadFile) { # Found uploaded file - @formUpload=($uploadFile, qq/$session{form}{'HttpProxy_'.$input_name}/); + @formUpload=($uploadFile, qq/$self->session->form->process("'HttpProxy_'.$input_name")/); $formdata{$input_name}=\@formUpload; $contentType = 'form-data'; # Different Content Type header for file upload } else { - $formdata{$input_name}=qq/$session{form}{'HttpProxy_'.$input_name}/; + $formdata{$input_name}=qq/$self->session->form->process("'HttpProxy_'.$input_name")/; } } # Create POST request diff --git a/lib/WebGUI/Asset/Wobject/InOutBoard.pm b/lib/WebGUI/Asset/Wobject/InOutBoard.pm index 16d66ace7..3130ba4b5 100644 --- a/lib/WebGUI/Asset/Wobject/InOutBoard.pm +++ b/lib/WebGUI/Asset/Wobject/InOutBoard.pm @@ -214,7 +214,7 @@ sub view { my $lastDepartment = "_nothing_"; - my $p = WebGUI::Paginator->new($url, $self->getValue("paginateAfter")); + my $p = WebGUI::Paginator->new($self->session,$url, $self->getValue("paginateAfter")); my $sql = "select users.username, users.userId, @@ -433,7 +433,7 @@ sub www_viewReport { $var{showReport} = 1; $endDate = $self->session->datetime->addToTime($endDate,24,0,0); my $lastDepartment = "_none_"; - my $p = WebGUI::Paginator->new($url, $pageReportAfter); + my $p = WebGUI::Paginator->new($self->session,$url, $pageReportAfter); my $sql = "select users.username, users.userId, diff --git a/lib/WebGUI/Asset/Wobject/IndexedSearch.pm b/lib/WebGUI/Asset/Wobject/IndexedSearch.pm index 65b60e9ff..f83e859de 100644 --- a/lib/WebGUI/Asset/Wobject/IndexedSearch.pm +++ b/lib/WebGUI/Asset/Wobject/IndexedSearch.pm @@ -260,7 +260,7 @@ sub view { map {$url .= "&namespaces=".$self->session->url->escape($_)} $self->session->request->param('namespaces'); map {$url .= "&contentTypes=".$self->session->url->escape($_)} $self->session->request->param('contentTypes'); $url .= "&paginateAfter=".$self->getValue("paginateAfter"); - my $p = WebGUI::Paginator->new($self->session->url->page($url), $self->getValue("paginateAfter")); + my $p = WebGUI::Paginator->new($self->session,$self->session->url->page($url), $self->getValue("paginateAfter")); $p->setDataByArrayRef($results); $var{startNr} = 1; if($self->session->form->process("pn")) { diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 33a9990d3..f75b38390 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -749,11 +749,11 @@ sub www_rate { if ($first) { $first=0; } else { - if ($lastRating != $session{form}{$category}) { + if ($lastRating != $self->session->form->process("$category")) { $sameRating = 0; } } - $lastRating = $session{form}{$category}; + $lastRating = $self->session->form->process("$category"); } return $self->www_viewDetail("",1) if ($hasRated || $sameRating); # Throw out ratings that are all the same number, or if the user rates twice. $self->setRatings($self->session->form->process("listingId"),$session{form}); @@ -773,14 +773,14 @@ sub www_search { } my $sth = $self->session->db->read("select name,fieldType from Matrix_field"); while (my ($name,$fieldType) = $sth->array) { - next unless ($session{form}{$name}); + next unless ($self->session->form->process("$name")); push(@list,0); my $where; if ($fieldType ne "goodBad") { $where = "(" - ."a.value like ".$self->session->db->quote("%".$session{form}{$name}."%") + ."a.value like ".$self->session->db->quote("%".$self->session->form->process("$name")."%") ." or a.value='Any'" - #." or a.value<".$self->session->db->quote($session{form}{$name}) + #." or a.value<".$self->session->db->quote($self->session->form->process("$name")) ." or a.value='Free'" .")"; } else { @@ -832,13 +832,13 @@ sub www_search { if ($data->{fieldType} ne "goodBad") { $data->{form} = WebGUI::Form::text({ name=>$data->{name}, - value=>$session{form}{$data->{name}} + value=>$self->session->form->process("$data->{name}") }); } else { $data->{form} = WebGUI::Form::checkbox({ name=>$data->{name}, value=>"1", - checked=>$session{form}{$data->{name}} + checked=>$self->session->form->process("$data->{name}") }); } push(@loop,$data); diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index f2d8dbe5a..074edb815 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -459,7 +459,7 @@ sub www_preview { showSystemPages=>$self->session->form->process("showSystemPages"), showHiddenPages=>$self->session->form->process("showHiddenPages"), showUnprivilegedPages=>$self->session->form->process("showUnprivilegedPages"), - 'reverse'=>$session{form}{'reverse'}, + 'reverse'=>$self->session->form->process("'reverse'"), ); my $output = qq( @@ -474,7 +474,7 @@ sub www_preview { stopAtLevel: $self->session->form->process("stopAtLevel")
depth: $self->session->form->process("depth")
templateId: $self->session->form->process("templateId")
- reverse: $session{form}{'reverse'}
+ reverse: $self->session->form->process("'reverse'")
showSystemPages: $self->session->form->process("showSystemPages")
showHiddenPages: $self->session->form->process("showHiddenPages")
showUnprivilegedPages: $self->session->form->process("showUnprivilegedPages")
diff --git a/lib/WebGUI/Asset/Wobject/SQLReport.pm b/lib/WebGUI/Asset/Wobject/SQLReport.pm index 007234779..dae142d03 100644 --- a/lib/WebGUI/Asset/Wobject/SQLReport.pm +++ b/lib/WebGUI/Asset/Wobject/SQLReport.pm @@ -289,7 +289,7 @@ sub _parsePlaceholderParams { my ($type,$field) = split(/:/,$row); my $param; if($type =~ /^form/) { - $param = $session{form}{$field}; + $param = $self->session->form->process("$field"); } elsif ($type =~ /^query(\d)/) { $param = $self->{_query}{$1}{rowData}{$field}; } @@ -332,12 +332,12 @@ sub _processQuery { foreach (keys %{$session{form}}) { unless ($_ eq "pn" || $_ eq "func" || $_ =~ /identifier/i || $_ =~ /password/i) { $url = $self->session->url->append($url, $self->session->url->escape($_) - .'='.$self->session->url->escape($session{form}{$_})); + .'='.$self->session->url->escape($self->session->form->process("$_"))); } } my $paginateAfter = $self->get("paginateAfter"); $paginateAfter = 1000 if($nr > 1); - my $p = WebGUI::Paginator->new($url,$paginateAfter); + my $p = WebGUI::Paginator->new($self->session,$url,$paginateAfter); my $error = $p->setDataByQuery($query,$dbh,1,$placeholderParams); if ($error ne "") { $self->session->errorHandler->warn("There was a problem with the query: ".$error); diff --git a/lib/WebGUI/Asset/Wobject/Survey.pm b/lib/WebGUI/Asset/Wobject/Survey.pm index b768344bf..4dddbd1c8 100644 --- a/lib/WebGUI/Asset/Wobject/Survey.pm +++ b/lib/WebGUI/Asset/Wobject/Survey.pm @@ -187,7 +187,7 @@ sub duplicate { sub generateResponseId { my $self = shift; my $varname = $self->getResponseIdString; - if ($session{scratch}{$varname}) { + if ($self->session->scratch->get("$varname")) { $self->completeResponse; } my $ipAddress = $self->getIp; @@ -532,7 +532,7 @@ sub getSectionDrivenQuestionIds { #------------------------------------------------------------------- sub getResponseId { my $self = shift; - return $session{scratch}{$self->getResponseIdString}; + return $self->session->scratch->get("$self->getResponseIdString"); } #------------------------------------------------------------------- @@ -1161,31 +1161,31 @@ sub www_respond { my $self = shift; return "" unless ($self->session->user->isInGroup($self->get("groupToTakeSurvey"))); my $varname = $self->getResponseIdString; - return "" unless ($session{scratch}{$varname}); + return "" unless ($self->session->scratch->get("$varname")); my $userId = ($self->get("anonymous")) ? substr(md5_hex($self->session->user->profileField("userId")),0,8) : $self->session->user->profileField("userId"); my $terminate = 0; foreach my $key (keys %{$session{form}}) { if ($key =~ /^answerId_(.+)$/) { my $id = $1; my ($previousResponse) = $self->session->db->quickArray("select count(*) from Survey_questionResponse - where Survey_answerId=".$self->session->db->quote($session{form}{"answerId_".$id})." and Survey_responseId=".$self->session->db->quote($session{scratch}{$varname})); + where Survey_answerId=".$self->session->db->quote($self->session->form->process(""answerId_".$id"))." and Survey_responseId=".$self->session->db->quote($self->session->scratch->get("$varname"))); next if ($previousResponse); - my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{"answerId_".$id}); + my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$self->session->form->process(""answerId_".$id")); if ($self->get("questionOrder") eq "response" && $answer->{gotoQuestion} eq "") { $terminate = 1; } - my $response = $session{form}{"textResponse_".$id} || $answer->{answer}; + my $response = $self->session->form->process(""textResponse_".$id} || $answer->{answer"); $self->session->db->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values ( - ".$self->session->db->quote($answer->{Survey_answerId}).", ".$self->session->db->quote($answer->{Survey_questionId}).", ".$self->session->db->quote($session{scratch}{$varname}).", ".$self->session->db->quote($answer->{Survey_id}).", - ".$self->session->db->quote($session{form}{"comment_".$id}).", ".$self->session->db->quote($response).", ".$self->session->datetime->time().")"); + ".$self->session->db->quote($answer->{Survey_answerId}).", ".$self->session->db->quote($answer->{Survey_questionId}).", ".$self->session->db->quote($self->session->scratch->get("$varname}).", ".$self->session->db->quote($answer->{Survey_id")).", + ".$self->session->db->quote($self->session->form->process(""comment_".$id")).", ".$self->session->db->quote($response).", ".$self->session->datetime->time().")"); } } - my $responseCount = $self->getQuestionResponseCount($session{scratch}{$varname}); + my $responseCount = $self->getQuestionResponseCount($self->session->scratch->get("$varname")); if ($terminate || $responseCount >= $self->getValue("questionsPerResponse") || $responseCount >= $self->getQuestionCount) { $self->session->db->setRow("Survey_response","Survey_responseId",{ isComplete=>1, endDate=>$self->session->datetime->time(), - Survey_responseId=>$session{scratch}{$varname} + Survey_responseId=>$self->session->scratch->get("$varname") }); } $self->logView() if ($self->session->setting->get("passiveProfilingEnabled")); @@ -1212,7 +1212,7 @@ sub www_viewGradebook { $self->logView() if ($self->session->setting->get("passiveProfilingEnabled")); my $var = $self->getMenuVars; $var->{title} = WebGUI::International::get(71,'Asset_Survey'); - my $p = WebGUI::Paginator->new($self->getUrl('func=viewGradebook')); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewGradebook')); $p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by username,ipAddress,startDate"); my $users = $p->getPageData; @@ -1308,7 +1308,7 @@ sub www_viewStatisticalOverview { $self->logView() if ($self->session->setting->get("passiveProfilingEnabled")); my $var = $self->getMenuVars; $var->{title} = WebGUI::International::get(58,'Asset_Survey'); - my $p = WebGUI::Paginator->new($self->getUrl('func=viewStatisticalOverview')); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl('func=viewStatisticalOverview')); $p->setDataByQuery("select Survey_questionId,question,answerFieldType,allowComment from Survey_question where Survey_id=".$self->session->db->quote($self->get("Survey_id"))." order by sequenceNumber"); my $questions = $p->getPageData; diff --git a/lib/WebGUI/Asset/Wobject/WSClient.pm b/lib/WebGUI/Asset/Wobject/WSClient.pm index 3d8aad253..bca4d75c1 100644 --- a/lib/WebGUI/Asset/Wobject/WSClient.pm +++ b/lib/WebGUI/Asset/Wobject/WSClient.pm @@ -419,7 +419,7 @@ sub view { # this case hasn't ever happened running against my dev SOAP::Lite # services, but let's assume it might. If our results array has # more than one element, let's hope if contains scalars - $p = WebGUI::Paginator->new($url, $self->get('paginateAfter')); + $p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter')); $p->setDataByArrayRef(\@result); @result = (); @result = @$p; @@ -431,7 +431,7 @@ sub view { if (my $aref = $result[0]->{$self->get('paginateVar')}) { $var{'numResults'} = scalar @$aref; - $p = WebGUI::Paginator->new($url, $self->get('paginateAfter')); + $p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter')); $p->setDataByArrayRef($aref); $result[0]->{$self->get('paginateVar')} = $p->getPageData; @@ -443,21 +443,21 @@ sub view { # prevent the wobject from dying for (keys %{$result[0]}) { if ((ref $result[0]->{$_}) =~ /ARRAY/) { - $p = WebGUI::Paginator->new($url, $self->get('paginateAfter')); + $p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter')); $p->setDataByArrayRef($result[0]->{$_}); last; } } - $p ||= WebGUI::Paginator->new($url); + $p ||= WebGUI::Paginator->new($self->session,$url); $result[0]->{$_} = $p->getPageData; } elsif ((ref $result[0]) =~ /ARRAY/) { - $p = WebGUI::Paginator->new($url, $self->get('paginateAfter')); + $p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter')); $p->setDataByArrayRef($result[0]); $result[0] = $p->getPageData; } else { - $p = WebGUI::Paginator->new($url, $self->get('paginateAfter')); + $p = WebGUI::Paginator->new($self->session,$url, $self->get('paginateAfter')); $p->setDataByArrayRef([$result[0]]); $result[0] = $p->getPageData; } diff --git a/lib/WebGUI/AssetBranch.pm b/lib/WebGUI/AssetBranch.pm index fdd870b9d..04afb9193 100644 --- a/lib/WebGUI/AssetBranch.pm +++ b/lib/WebGUI/AssetBranch.pm @@ -337,7 +337,7 @@ sub www_editBranchSave { if ($form =~ /^metadata_(.*)$/) { my $fieldName = $1; if ($self->session->form->yesNo("change_metadata_".$fieldName)) { - $newRevision->updateMetaData($fieldName,$session{form}{$form}); + $newRevision->updateMetaData($fieldName,$self->session->form->process("$form")); } } } diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 6d9e70de3..36bd24d44 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -522,7 +522,7 @@ sub www_manageRevisionsInTag { $ac->addSubmenuItem($self->getUrl('func=manageVersions'), $i18n->get("manage versions")); my $output = '
'; - my $p = WebGUI::Paginator->new($self->getUrl("func=manageRevisionsInTag;tagId=".$self->session->form->process("tagId"))); + my $p = WebGUI::Paginator->new($self->session,$self->getUrl("func=manageRevisionsInTag;tagId=".$self->session->form->process("tagId"))); $p->setDataByQuery("select assetData.revisionDate, users.username, asset.assetId, asset.className from assetData left join asset on assetData.assetId=asset.assetId left join users on assetData.revisedBy=users.userId where assetData.tagId=".$self->session->db->quote($self->session->form->process("tagId"))); diff --git a/lib/WebGUI/Auth/LDAP.pm b/lib/WebGUI/Auth/LDAP.pm index 745c91c09..60371a615 100644 --- a/lib/WebGUI/Auth/LDAP.pm +++ b/lib/WebGUI/Auth/LDAP.pm @@ -47,7 +47,7 @@ sub _isValidLDAPUser { $auth = $ldap->bind; } if ($auth) { - $search = $ldap->search ( base=>$uri->dn, filter=>$connection->{ldapIdentity}."=".$session{form}{'authLDAP_ldapId'}); + $search = $ldap->search ( base=>$uri->dn, filter=>$connection->{ldapIdentity}."=".$self->session->form->process("'authLDAP_ldapId'")); if (defined $search->entry(0)) { if ($connection->{ldapUserRDN} eq 'dn') { $connectDN = $search->entry(0)->dn; @@ -56,10 +56,10 @@ sub _isValidLDAPUser { } $ldap->unbind; $ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= WebGUI::International::get(2,'AuthLDAP'); - $auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{'authLDAP_identifier'}); + $auth = $ldap->bind(dn=>$connectDN, password=>$self->session->form->process("'authLDAP_identifier'")); if ($auth->code == 48 || $auth->code == 49) { $error .= '
  • '.WebGUI::International::get(68).'
  • '; - $self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{'authLDAP_ldapId'}); + $self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'")); } elsif ($auth->code > 0) { $error .= '
  • LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69).'
  • '; $self->session->errorHandler->error("LDAP error: ".$ldapStatusCode{$auth->code}); @@ -67,7 +67,7 @@ sub _isValidLDAPUser { $ldap->unbind; } else { $error .= '
  • '.WebGUI::International::get(68).'
  • '; - $self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{'authLDAP_ldapId'}); + $self->session->errorHandler->warn("Invalid LDAP information for registration of LDAP ID: ".$self->session->form->process("'authLDAP_ldapId'")); } } else { $error = WebGUI::International::get(2,'AuthLDAP'); @@ -92,9 +92,9 @@ sub addUserForm { my $self = shift; my $userData = $self->getParams; my $connection = $self->{_connection}; - my $ldapUrl = $session{form}{'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL}; - my $connectDN = $session{form}{'authLDAP_connectDN'} || $userData->{connectDN}; - my $ldapConnection = $session{form}{'authLDAP_ldapConnection'} || $userData->{ldapConnection}; + my $ldapUrl = $self->session->form->process("'authLDAP_ldapUrl'} || $userData->{ldapUrl} || $connection->{ldapURL"); + my $connectDN = $self->session->form->process("'authLDAP_connectDN'} || $userData->{connectDN"); + my $ldapConnection = $self->session->form->process("'authLDAP_ldapConnection'} || $userData->{ldapConnection"); my $ldapLinks = $self->session->db->buildHashRef("select ldapLinkId,ldapUrl from ldapLink"); my $f = WebGUI::HTMLForm->new($self->session); my $jscript = ""; @@ -146,9 +146,9 @@ sub addUserForm { sub addUserFormSave { my $self = shift; my $properties; - $properties->{connectDN} = $session{form}{'authLDAP_connectDN'}; - $properties->{ldapUrl} = $session{form}{'authLDAP_ldapUrl'}; - $properties->{ldapConnection} = $session{form}{'authLDAP_ldapConnection'}; + $properties->{connectDN} = $self->session->form->process("'authLDAP_connectDN'"); + $properties->{ldapUrl} = $self->session->form->process("'authLDAP_ldapUrl'"); + $properties->{ldapConnection} = $self->session->form->process("'authLDAP_ldapConnection'"); $self->SUPER::addUserFormSave($properties); } @@ -222,9 +222,9 @@ sub createAccount { value=>[$connection->{ldapLinkId}], extras=>qq|onchange="location.href='$url'+this.options[this.selectedIndex].value"| }); - $vars->{'create.form.ldapId'} = WebGUI::Form::text($self->session,{"name"=>"authLDAP_ldapId","value"=>$session{form}{"authLDAP_ldapId"}}); + $vars->{'create.form.ldapId'} = WebGUI::Form::text($self->session,{"name"=>"authLDAP_ldapId","value"=>$self->session->form->process(""authLDAP_ldapId"}")); $vars->{'create.form.ldapId.label'} = $connection->{ldapIdentityName}; - $vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authLDAP_identifier","value"=>$session{form}{"authLDAP_identifier"}}); + $vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authLDAP_identifier","value"=>$self->session->form->process(""authLDAP_identifier"}")); $vars->{'create.form.password.label'} = $connection->{ldapPasswordName}; $vars->{'create.form.hidden'} = WebGUI::Form::hidden($self->session,{"name"=>"confirm","value"=>$self->session->form->process("confirm")}); diff --git a/lib/WebGUI/Auth/WebGUI.pm b/lib/WebGUI/Auth/WebGUI.pm index a6c64a3c8..3282a548b 100644 --- a/lib/WebGUI/Auth/WebGUI.pm +++ b/lib/WebGUI/Auth/WebGUI.pm @@ -174,7 +174,7 @@ sub createAccount { .'captcha'; $vars->{'create.form.captcha.label'} = WebGUI::International::get("captcha label","AuthWebGUI"); } - $vars->{'create.form.username'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.username","value"=>$session{form}{"authWebGUI.username"}}); + $vars->{'create.form.username'} = WebGUI::Form::text($self->session,{"name"=>"authWebGUI.username","value"=>$self->session->form->process(""authWebGUI.username"}")); $vars->{'create.form.username.label'} = WebGUI::International::get(50); $vars->{'create.form.password'} = WebGUI::Form::password($self->session,{"name"=>"authWebGUI.identifier"}); $vars->{'create.form.password.label'} = WebGUI::International::get(51); diff --git a/lib/WebGUI/Mail.pm b/lib/WebGUI/Mail.pm index 6fc2bc89a..00113f9fc 100644 --- a/lib/WebGUI/Mail.pm +++ b/lib/WebGUI/Mail.pm @@ -16,10 +16,7 @@ http://www.plainblack.com info@plainblack.com use Net::SMTP; use strict; -use WebGUI::DateTime; -use WebGUI::ErrorHandler; use WebGUI::Macro; -use WebGUI::Session; =head1 NAME @@ -75,60 +72,60 @@ The email address for the BCC line. =cut sub send { - my ($smtp, $message, $from); - foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) { - if(${$option}) { - if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) { - use WebGUI::ErrorHandler; - return $self->session->errorHandler->security("pass a malicious value to the mail header."); - } - } - } - $from = $_[4] || $self->session->setting->get("companyEmail"); - #header - my $to = $self->session->config->get("emailOverride") || $_[0]; - $message = "To: $to\n"; - $message .= "From: $from\n"; - $message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride")); - $message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride")); - $message .= "Subject: ".$_[1]."\n"; - $message .= "Date: ".$self->session->datetime->epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n"; - if (($_[2] =~ m//i) || ($_[2] =~ m/session,\$message); +# my ($smtp, $message, $from); +# foreach my $option (\$_[0], \$_[1], \$_[3], \$_[4], \$_[5]) { +# if(${$option}) { +# if (${$option} =~ /(?:From|To|Date|X-Mailer|Subject|Received|Message-Id)\s*:/is) { +# use WebGUI::ErrorHandler; +# return $self->session->errorHandler->security("pass a malicious value to the mail header."); +# } +# } +# } +# $from = $_[4] || $self->session->setting->get("companyEmail"); +# #header +# my $to = $self->session->config->get("emailOverride") || $_[0]; +# $message = "To: $to\n"; +# $message .= "From: $from\n"; +# $message .= "CC: $_[3]\n" if ($_[3] && !$self->session->config->get("emailOverride")); +# $message .= "BCC: $_[5]\n" if ($_[5] && !$self->session->config->get("emailOverride")); +# $message .= "Subject: ".$_[1]."\n"; +# $message .= "Date: ".$self->session->datetime->epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n"; +# if (($_[2] =~ m//i) || ($_[2] =~ m/session,\$message); #body - $message .= $_[2]."\n"; +# $message .= $_[2]."\n"; #footer - my $footer = "\n".$self->session->setting->get("mailFooter"); - WebGUI::Macro::process($self->session,\$footer); - $message .= $footer; - $message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n" if ($self->session->config->get("emailOverride")); - if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) { - if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) { - print MAIL $message; - close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer")); - } else { - $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); - } - } else { - $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server - if (defined $smtp) { - $smtp->mail($from); # use the sender's address here - $smtp->to($to); # recipient's address - $smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride")); - $smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride")); - $smtp->data(); # Start the mail - $smtp->datasend($message); - $smtp->dataend(); # Finish sending the mail - $smtp->quit; # Close the SMTP connection - } else { - $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); - } - } +# my $footer = "\n".$self->session->setting->get("mailFooter"); +# WebGUI::Macro::process($self->session,\$footer); +# $message .= $footer; +# $message .= "\n\n\nThis message was intended for ".$_[0].", but was overridden in the config file.\n\n\n" if ($self->session->config->get("emailOverride")); +# if ($self->session->setting->get("smtpServer") =~ /\/sendmail/) { +# if (open(MAIL,"| $self->session->setting->get("smtpServer") -t -oi")) { +# print MAIL $message; +# close(MAIL) or $self->session->errorHandler->warn("Couldn't close connection to mail server: ".$self->session->setting->get("smtpServer")); +# } else { +# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); +# } +# } else { +# $smtp = Net::SMTP->new($self->session->setting->get("smtpServer")); # connect to an SMTP server +# if (defined $smtp) { +# $smtp->mail($from); # use the sender's address here +# $smtp->to($to); # recipient's address +# $smtp->cc($_[3]) if ($_[3] && !$self->session->config->get("emailOverride")); +# $smtp->bcc($_[5]) if ($_[5] && !$self->session->config->get("emailOverride")); +# $smtp->data(); # Start the mail +# $smtp->datasend($message); +# $smtp->dataend(); # Finish sending the mail +# $smtp->quit; # Close the SMTP connection +# } else { +# $self->session->errorHandler->warn("Couldn't connect to mail server: ".$self->session->setting->get("smtpServer")); +# } +# } } 1; diff --git a/lib/WebGUI/MessageLog.pm b/lib/WebGUI/MessageLog.pm index 03407150a..80026ca23 100644 --- a/lib/WebGUI/MessageLog.pm +++ b/lib/WebGUI/MessageLog.pm @@ -17,14 +17,8 @@ package WebGUI::MessageLog; use strict; use Tie::CPHash; -use WebGUI::DateTime; -use WebGUI::Id; -use WebGUI::International; use WebGUI::Macro; use WebGUI::Mail; -use WebGUI::Session; -use WebGUI::SQL; -use WebGUI::URL; use WebGUI::User; use WebGUI::Utility; @@ -114,37 +108,37 @@ The addressee email address. Defaults to company email. =cut sub addEntry { - my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from); - $messageLogId = $self->session->id->generate(); - $userId = $_[0]; - $groupId = $_[1]; - $subject = $_[2]; - $message = $_[3]; - $url = $_[4]; - if ($url && !$url =~ /^http/) { - $url = $self->session->url->getSiteURL().$url; - } - if ($url && !($url =~ /func=/ || $url =~ /op=/)) { - $url = $self->session->url->append($url, "op=viewMessageLogMessage"); - } - $status = $_[5]; - $from = $_[6]; - if ($groupId ne "") { - @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId)); - } - @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users)); - foreach $user (@users) { - $u = WebGUI::User->new($user); - if ($u->userId ne "") { - $self->session->db->write("insert into messageLog (messageLogId, userId, message, url, dateOfEntry, - subject, status) values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).", - ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($subject).", ".$self->session->db->quote($status).")"); - if ($url ne "") { - $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId); - } - _notify($u,$subject,$message,$from); - } - } +# my ($u, @users, $messageLogId, $sth, $userId, $groupId, $subject, $message, $url, $status, $user, $from); +# $messageLogId = $self->session->id->generate(); +# $userId = $_[0]; +# $groupId = $_[1]; +# $subject = $_[2]; +# $message = $_[3]; +# $url = $_[4]; +# if ($url && !$url =~ /^http/) { +# $url = $self->session->url->getSiteURL().$url; +# } +# if ($url && !($url =~ /func=/ || $url =~ /op=/)) { +# $url = $self->session->url->append($url, "op=viewMessageLogMessage"); +# } +# $status = $_[5]; +# $from = $_[6]; +# if ($groupId ne "") { +# @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId)); +# } +# @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users)); +# foreach $user (@users) { +# $u = WebGUI::User->new($user); +# if ($u->userId ne "") { +# $self->session->db->write("insert into messageLog (messageLogId, userId, message, url, dateOfEntry, +# subject, status) values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).", +# ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($subject).", ".$self->session->db->quote($status).")"); +# if ($url ne "") { +# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId); +# } +# _notify($u,$subject,$message,$from); +# } +# } } #------------------------------------------------------------------- @@ -184,45 +178,45 @@ Defaults to 'notice'. Can be 'pending', 'notice', or 'completed'. =cut sub addInternationalizedEntry { - my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status); - $messageLogId = $self->session->id->generate(); - $userId = $_[0]; - $groupId = $_[1]; - $url = $_[2]; - if ($url && !$url =~ /^http/) { - $url = $self->session->url->getSiteURL().$url; - } - if ($url && !($url =~ /func=/ || $url =~ /op=/)) { - $url = $self->session->url->append($url, "op=viewMessageLogMessage"); - } - $internationalId = $_[3]; - $namespace = $_[4] || "WebGUI"; - $status = $_[5] || 'notice'; - my $languages = WebGUI::International::getLanguages(); - foreach my $language (keys %{$languages}) { - $message{$language} = WebGUI::International::get($internationalId,$namespace,$language); - $subject{$language} = WebGUI::International::get(523,"WebGUI",$language); - } - if ($groupId ne "") { - @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId)); - } - @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users)); - foreach $user (@users) { - $u = WebGUI::User->new($user); - if ($u->userId ne "") { - $subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq ""); - $subject = $subject{$u->profileField("language")}; - $message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq ""); - $message = $message{$u->profileField("language")}; - WebGUI::Macro::process($self->session,\$message); - $self->session->db->write("insert into messageLog values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).", - ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")"); - if ($url ne "") { - $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId); - } - _notify($u,$subject,$message); - } - } + # my ($u, $userId, $url, $groupId, $internationalId, @users, $messageLogId,$sth, $user, %message, %subject, $message, $subject, $namespace, $status); + # $messageLogId = $self->session->id->generate(); +# $userId = $_[0]; +# $groupId = $_[1]; +# $url = $_[2]; +# if ($url && !$url =~ /^http/) { +# $url = $self->session->url->getSiteURL().$url; +# } +# if ($url && !($url =~ /func=/ || $url =~ /op=/)) { +# $url = $self->session->url->append($url, "op=viewMessageLogMessage"); +# } +# $internationalId = $_[3]; +# $namespace = $_[4] || "WebGUI"; +# $status = $_[5] || 'notice'; +# my $languages = WebGUI::International::getLanguages(); +# foreach my $language (keys %{$languages}) { +# $message{$language} = WebGUI::International::get($internationalId,$namespace,$language); +# $subject{$language} = WebGUI::International::get(523,"WebGUI",$language); +# } +# if ($groupId ne "") { +# @users = $self->session->db->buildArray("select userId from groupings where groupId=".$self->session->db->quote($groupId)); +# } +# @users = ($userId,@users) if ($userId ne "" && !isIn($userId, @users)); +# foreach $user (@users) { +# $u = WebGUI::User->new($user); +# if ($u->userId ne "") { +# $subject{$u->profileField("language")} = $subject{1} if ($subject{$u->profileField("language")} eq ""); +# $subject = $subject{$u->profileField("language")}; +# $message{$u->profileField("language")} = $message{1} if ($message{$u->profileField("language")} eq ""); +# $message = $message{$u->profileField("language")}; +# WebGUI::Macro::process($self->session,\$message); +# $self->session->db->write("insert into messageLog values (".$self->session->db->quote($messageLogId).",".$self->session->db->quote($u->userId).", +# ".$self->session->db->quote($message).",".$self->session->db->quote($url).","$self->session->datetime->time().",".$self->session->db->quote($message).",".$self->session->db->quote($status).")"); +# if ($url ne "") { +# $message .= "\n".$self->session->url->append($url,'mlog='.$messageLogId); +# } +# _notify($u,$subject,$message); +# } +# } } #------------------------------------------------------------------- @@ -238,7 +232,7 @@ The id of the message to complete. =cut sub completeEntry { - $self->session->db->write("update messageLog set status='completed', dateOfEntry="$self->session->datetime->time()." where messageLogId=".$self->session->db->quote($_[0])); +# $self->session->db->write("update messageLog set status='completed', dateOfEntry="$self->session->datetime->time()." where messageLogId=".$self->session->db->quote($_[0])); } diff --git a/lib/WebGUI/Operation/ActiveSessions.pm b/lib/WebGUI/Operation/ActiveSessions.pm index ac2450d80..63089b26b 100644 --- a/lib/WebGUI/Operation/ActiveSessions.pm +++ b/lib/WebGUI/Operation/ActiveSessions.pm @@ -76,7 +76,7 @@ sub www_viewActiveSessions { $i++; } $sth->finish; - $p = WebGUI::Paginator->new($session->url->page('op=viewActiveSessions')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=viewActiveSessions')); $p->setDataByArrayRef(\@row); $output .= '
    TitleTypeRevision DateRevised By
    '; $output .= ''; diff --git a/lib/WebGUI/Operation/Commerce.pm b/lib/WebGUI/Operation/Commerce.pm index a56bcfffc..707c1fc1e 100644 --- a/lib/WebGUI/Operation/Commerce.pm +++ b/lib/WebGUI/Operation/Commerce.pm @@ -527,10 +527,10 @@ sub www_editCommerceSettingsSave { type => $1, namespace => $2, fieldName => $3, - fieldValue => $session{form}{$_} + fieldValue => $session->form->process("$_") }); } elsif ($_ ne 'op') { - WebGUI::Setting::set($_,$session{form}{$_}); + WebGUI::Setting::set($_,$session->form->process("$_")); } } @@ -545,7 +545,7 @@ sub www_listPendingTransactions { $i18n = WebGUI::International->new("Commerce"); - $p = WebGUI::Paginator->new($session->url->page('op=listPendingTransactions')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listPendingTransactions')); $p->setDataByArrayRef(WebGUI::Commerce::Transaction->pendingTransactions); $transactions = $p->getPageData; @@ -776,7 +776,7 @@ my $shoppingCart = WebGUI::Commerce::ShoppingCart->new; foreach my $formElement (keys(%{$session{form}})) { if ($formElement =~ m/^quantity~([^~]*)~([^~]*)$/) { - $shoppingCart->setQuantity($2, $1, $session{form}{$formElement}); + $shoppingCart->setQuantity($2, $1, $session->form->process("$formElement")); } } diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm index 0e77ed10a..98d06cca4 100644 --- a/lib/WebGUI/Operation/Group.pm +++ b/lib/WebGUI/Operation/Group.pm @@ -87,7 +87,7 @@ sub doGroupSearch { my $sql = "select groupId,groupName,description from groups where isEditable=1 and (groupName like $keyword or description like $keyword) and groupId not in (".$session->db->quoteAndJoin($groupFilter).") order by groupName"; if ($returnPaginator) { - my $p = WebGUI::Paginator->new($session->url->page($op)); + my $p = WebGUI::Paginator->new($session,$session->url->page($op)); $p->setDataByQuery($sql); return $p; } else { @@ -579,7 +579,7 @@ sub www_listGroups { $i++; } $sth->finish; - $p = WebGUI::Paginator->new($session->url->page('op=listGroups')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listGroups')); $p->setDataByArrayRef(\@row); $output .= '
    '.WebGUI::International::get(428).'
    '; $output .= ''; - my $p = WebGUI::Paginator->new($session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid"))); + my $p = WebGUI::Paginator->new($session,$session->url->page("op=manageUsersInGroup;gid=".$session->form->process("gid"))); $p->setDataByQuery("select users.username,users.userId,groupings.expireDate from groupings,users where groupings.groupId=".$session->db->quote($session->form->process("gid"))." and groupings.userId=users.userId order by users.username"); diff --git a/lib/WebGUI/Operation/LDAPLink.pm b/lib/WebGUI/Operation/LDAPLink.pm index 0d14d6447..e42972ad8 100644 --- a/lib/WebGUI/Operation/LDAPLink.pm +++ b/lib/WebGUI/Operation/LDAPLink.pm @@ -243,7 +243,7 @@ sub www_listLDAPLinks { $i++; } $sth->finish; - $p = WebGUI::Paginator->new($session->url->page('op=listLDAPLinks')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listLDAPLinks')); $p->setDataByArrayRef(\@row); $output .= '
    '.WebGUI::International::get(84).'' @@ -642,7 +642,7 @@ sub www_manageUsersInGroup { .WebGUI::Icon::_getBaseURL().'delete.gif" border="0"> '.WebGUI::International::get(50).' '.WebGUI::International::get(369).'
    '; $output .= $p->getPage; diff --git a/lib/WebGUI/Operation/LoginHistory.pm b/lib/WebGUI/Operation/LoginHistory.pm index 516c0c91c..12386f327 100644 --- a/lib/WebGUI/Operation/LoginHistory.pm +++ b/lib/WebGUI/Operation/LoginHistory.pm @@ -53,7 +53,7 @@ sub www_viewLoginHistory { $i++; } $sth->finish; - $p = WebGUI::Paginator->new($session->url->page('op=viewLoginHistory')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=viewLoginHistory')); $p->setDataByArrayRef(\@row); $output .= '
    '; $output .= ''; diff --git a/lib/WebGUI/Operation/MessageLog.pm b/lib/WebGUI/Operation/MessageLog.pm index 08bc12d91..3ac2e2fa6 100644 --- a/lib/WebGUI/Operation/MessageLog.pm +++ b/lib/WebGUI/Operation/MessageLog.pm @@ -61,7 +61,7 @@ sub www_viewMessageLog { my (@msg, $vars); return $session->privilege->insufficient() unless ($session->user->isInGroup(2,$session->user->profileField("userId"))); $vars->{displayTitle} = '

    '.WebGUI::International::get(159).'

    '; - my $p = WebGUI::Paginator->new($session->url->page('op=viewMessageLog')); + my $p = WebGUI::Paginator->new($session,$session->url->page('op=viewMessageLog')); my $query = "select messageLogId,subject,url,dateOfEntry,status from messageLog where userId=".$session->db->quote($session->user->profileField("userId"))." order by dateOfEntry desc"; $p->setDataByQuery($query); diff --git a/lib/WebGUI/Operation/Settings.pm b/lib/WebGUI/Operation/Settings.pm index a9e7208f1..7d9c5fb56 100644 --- a/lib/WebGUI/Operation/Settings.pm +++ b/lib/WebGUI/Operation/Settings.pm @@ -300,7 +300,7 @@ sub www_saveSettings { return $session->privilege->adminOnly() unless ($session->user->isInGroup(3)); my ($key, $value); foreach $key (keys %{$session{form}}) { - $value = $session{form}{$key}; + $value = $session->form->process("$key"); if ($key =~ m/(.*)_interval/) { $value = $session->form->interval($1); $key = $1; diff --git a/lib/WebGUI/Operation/Subscription.pm b/lib/WebGUI/Operation/Subscription.pm index f137423b8..558a12577 100644 --- a/lib/WebGUI/Operation/Subscription.pm +++ b/lib/WebGUI/Operation/Subscription.pm @@ -271,7 +271,7 @@ sub www_editSubscriptionSave { return $session->privilege->adminOnly() unless ($session->user->isInGroup(3)); @relevantFields = qw(subscriptionId name price description subscriptionGroup duration executeOnSubscription karma); - WebGUI::Subscription->new($session->form->process("sid"))->set({map {$_ => $session{form}{$_}} @relevantFields}); + WebGUI::Subscription->new($session->form->process("sid"))->set({map {$_ => $session->form->process("$_}} @relevantFields")); return www_listSubscriptions(); } @@ -284,7 +284,7 @@ sub www_listSubscriptionCodeBatches { my $i18n = WebGUI::International->new("Subscription"); - $p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodeBatches')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptionCodeBatches')); $p->setDataByQuery("select * from subscriptionCodeBatch"); $batches = $p->getPageData; @@ -359,7 +359,7 @@ sub www_listSubscriptionCodes { return _submenu($output, 'listSubscriptionCodes title', 'subscription codes manage'); } - $p = WebGUI::Paginator->new($session->url->page('op=listSubscriptionCodes'.$ops)); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptionCodes'.$ops)); $p->setDataByQuery("select t1.*, t2.* from subscriptionCode as t1, subscriptionCodeBatch as t2 where t1.batchId=t2.batchId ".$where); $codes = $p->getPageData; @@ -396,7 +396,7 @@ sub www_listSubscriptions { my $i18n = WebGUI::International->new("Subscription"); - $p = WebGUI::Paginator->new($session->url->page('op=listSubscriptions')); + $p = WebGUI::Paginator->new($session,$session->url->page('op=listSubscriptions')); $p->setDataByQuery('select subscriptionId, name from subscription where deleted != 1'); $subscriptions = $p->getPageData; diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 2595d610f..23e6d00e6 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -139,7 +139,7 @@ sub doUserSearch { where $selectedStatus and (users.username like ".$keyword." or useralias.fieldData like ".$keyword." or email.fieldData like ".$keyword.") and users.userId not in (".$session->db->quoteAndJoin($userFilter).") order by users.username"; if ($returnPaginator) { - my $p = WebGUI::Paginator->new($session->url->page("op=".$op)); + my $p = WebGUI::Paginator->new($session,$session->url->page("op=".$op)); $p->setDataByQuery($sql); return $p; } else { diff --git a/lib/WebGUI/Paginator.pm b/lib/WebGUI/Paginator.pm index b4c06317c..32f580539 100644 --- a/lib/WebGUI/Paginator.pm +++ b/lib/WebGUI/Paginator.pm @@ -29,7 +29,7 @@ Package that paginates rows of arbitrary data for display on the web. =head1 SYNOPSIS use WebGUI::Paginator; - $p = WebGUI::Paginator->new("/index.pl/page_name?this=that"); + $p = WebGUI::Paginator->new($self->session,"/index.pl/page_name?this=that"); $p->setDataByArrayRef(\@array); $p->setDataByQuery($sql); @@ -421,10 +421,14 @@ sub getRowCount { #------------------------------------------------------------------- -=head2 new ( currentURL [, paginateAfter, pageNumber, formVar ] ) +=head2 new ( session, currentURL [, paginateAfter, pageNumber, formVar ] ) Constructor. +=head3 session + +A reference to the current session. + =head3 currentURL The URL of the current page including attributes. The page number will be appended to this in all links generated by the paginator. @@ -445,13 +449,28 @@ Specify the form variable the paginator should use in it's links. Defaults to " sub new { my $class = shift; + my $session = shift; my $currentURL = shift; my $rowsPerPage = shift || 25; my $formVar = shift || "pn"; - my $pn = shift || $session{form}{$formVar} || 1; - bless {_url => $currentURL, _rpp => $rowsPerPage, _formVar => $formVar, _pn => $pn}, $class; + my $pn = shift || $session->form->process($formVar) || 1; + bless {_session=>$session, _url => $currentURL, _rpp => $rowsPerPage, _formVar => $formVar, _pn => $pn}, $class; } +#------------------------------------------------------------------- + +=head2 session ( ) + +Returns a reference to the current session. + +=cut + +sub session { + my $self = shift; + $self->{_session}; +} + + #------------------------------------------------------------------- =head2 setDataByArrayRef ( arrayRef ) @@ -486,7 +505,7 @@ An SQL query that will retrieve a data set. =head3 dbh -A DBI-style database handler. Defaults to the WebGUI site handler. +A WebGUI::SQL database handler. Defaults to the WebGUI site handler. =head3 unconditional @@ -511,10 +530,10 @@ sub setDataByQuery { my ($self, $sql, $dbh, $unconditional, $placeholders, $dynamicPageNumberKey, $dynamicPageNumberValue) = @_; $dbh ||= $self->session->db->getSlave; if ($unconditional) { - $sth = $self->session->db->unconditionalRead($sql,$dbh,$placeholders); + $sth = $dbh->unconditionalRead($sql,$placeholders); return $sth->errorMessage if ($sth->errorCode > 0); } else { - $sth = $self->session->db->read($sql,$dbh,$placeholders); + $sth = $dbh->read($sql,$placeholders); } my $defaultPageNumber = $self->getPageNumber; $self->{_totalRows} = $sth->rows; diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 1d8f72cc1..21670e9d8 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -140,12 +140,12 @@ sub formField { } $properties->{options} = $orderedValues; my $default; - if ($session{form}{$properties->{name}}) { - $default = $session{form}{$properties->{name}}; + if ($self->session->form->process("$properties->{name}")) { + $default = $self->session->form->process("$properties->{name}"); } elsif (defined $u && $u->profileField($properties->{name})) { $default = $u->profileField($properties->{name}); - } elsif (!defined $u && $session{user}{$properties->{name}}) { - $default = $session{user}{$properties->{name}}; + } elsif (!defined $u && $self->session->user->profileField("$properties->{name}")) { + $default = $self->session->user->profileField("$properties->{name}"); } else { $default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault}); }
    '.WebGUI::International::get(428).'