Remove Session::Env, migrate code to Plack::Request object in Session, and WebGUI::Session::Request

This commit is contained in:
Colin Kuskie 2010-07-01 17:40:12 -07:00
parent 005b9da1ac
commit e0177dc666
27 changed files with 131 additions and 285 deletions

View file

@ -697,7 +697,7 @@ sub processCommentEditForm {
;
my $visitorIp = $session->user->isVisitor
? $session->env->get("REMOTE_ADDR")
? $session->request->remote_host
: undef
;

View file

@ -350,7 +350,7 @@ sub hasRated {
my $hasRated = $self->session->db->quickScalar("select count(*) from MatrixListing_rating where
((userId=? and userId<>'1') or (userId='1' and ipAddress=?)) and listingId=?",
[$session->user->userId,$session->env->get("HTTP_X_FORWARDED_FOR"),$self->getId]);
[$session->user->userId,$session->request->env->{"HTTP_X_FORWARDED_FOR"}, $self->getId]);
return $hasRated;
}
@ -372,7 +372,7 @@ sub incrementCounter {
my $db = $self->session->db;
my $counter = shift;
my $currentIp = $self->session->env->get("HTTP_X_FORWARDED_FOR");
my $currentIp = $self->session->request->env->{"HTTP_X_FORWARDED_FOR"};
unless ($self->get($counter."LastIp") && ($self->get($counter."LastIp") eq $currentIp)) {
$self->update({
@ -528,7 +528,7 @@ sub setRatings {
$db->write("insert into MatrixListing_rating
(userId, category, rating, timeStamp, listingId, ipAddress, assetId) values (?,?,?,?,?,?,?)",
[$session->user->userId,$category,$ratings->{$category},time(),$self->getId,
$session->env->get("HTTP_X_FORWARDED_FOR"),$matrixId]);
$session->request->env->{"HTTP_X_FORWARDED_FOR"}, $matrixId]);
}
my $sql = "from MatrixListing_rating where listingId=? and category=?";
my $sum = $db->quickScalar("select sum(rating) $sql", [$self->getId,$category]);

View file

@ -310,7 +310,7 @@ sub view {
return $self->processTemplate({},$self->templateId)
unless ($proxiedUrl ne "");
my $requestMethod = $self->session->env->get("REQUEST_METHOD") || "GET";
my $requestMethod = $self->session->request->method || "GET";
### Do we have cached content to get?
my $cache = $self->session->cache;
@ -328,7 +328,7 @@ sub view {
REDIRECT: for my $redirect (0..4) { # We follow max 5 redirects to prevent bouncing/flapping
my $userAgent = new LWP::UserAgent;
$userAgent->agent($self->session->env->get("HTTP_USER_AGENT"));
$userAgent->agent($self->session->request->user_agent);
$userAgent->timeout($self->timeout);
$userAgent->env_proxy;

View file

@ -1044,7 +1044,7 @@ sub www_drawGanttChart {
}
#Adjust top for MSIE
my $isMSIE = ($session->env->get("HTTP_USER_AGENT") =~ /msie/i);
my $isMSIE = ($session->env->request->user_agent =~ /msie/i);
my $divTop = $isMSIE ? 45 : 45;
#Start at 45 px and add 20px as the start of the new task
#Set the propert mutiplier