Merge remote branch 'upstream/WebGUI8' into 8-merge
Conflicts: docs/gotcha.txt docs/previousVersion.sql lib/WebGUI/Asset/Wobject/GalleryAlbum.pm lib/WebGUI/Asset/Wobject/Navigation.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/Config.pm lib/WebGUI/Form/Template.pm lib/WebGUI/Group.pm lib/WebGUI/VersionTag.pm lib/WebGUI/Workflow/Activity/TrashExpiredEvents.pm t/AdSpace.t t/Asset/AssetExportHtml.t t/Asset/AssetLineage.t t/Asset/Story.t t/Asset/Template/HTMLTemplateExpr.t t/Asset/Wobject/Gallery/00base.t t/Asset/Wobject/GalleryAlbum/00base.t t/Asset/Wobject/GalleryAlbum/ajax.t t/Asset/Wobject/InOutBoard.t t/Asset/Wobject/StoryArchive.t t/Asset/Wobject/Survey/ExpressionEngine.t t/Asset/Wobject/Survey/Reports.t t/AssetAspect/RssFeed.t t/Auth/mech.t t/Group.t t/Mail/Send.t t/Operation/AdSpace.t t/Session/ErrorHandler.t t/Session/Scratch.t t/Session/Url.t t/Shop/Cart.t t/Shop/Pay.t t/Shop/Ship.t t/Shop/ShipDriver.t t/Shop/TaxDriver/Generic.t t/Shop/Vendor.t t/VersionTag.t t/lib/WebGUI/Test.pm
This commit is contained in:
commit
708b47d73c
165 changed files with 3199 additions and 5718 deletions
|
|
@ -697,7 +697,7 @@ sub processCommentEditForm {
|
|||
;
|
||||
|
||||
my $visitorIp = $session->user->isVisitor
|
||||
? $session->env->get("REMOTE_ADDR")
|
||||
? $session->request->remote_host
|
||||
: undef
|
||||
;
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ sub _fixReplyCount {
|
|||
orderByClause => 'assetData.revisionDate desc',
|
||||
limit => 1,
|
||||
} )->[0];
|
||||
|
||||
if (my $lastPost = WebGUI::Asset->newById( $self->session, $lastPostId ) ) {
|
||||
my $lastPost = eval { WebGUI::Asset->newById( $self->session, $lastPostId ); };
|
||||
if ( ! Exception::Class->caught() ) {
|
||||
$asset->incrementReplies( $lastPost->revisionDate, $lastPost->getId );
|
||||
}
|
||||
else {
|
||||
|
|
@ -293,23 +293,30 @@ the parent thread.
|
|||
=cut
|
||||
|
||||
override cut => sub {
|
||||
warn "post's cut";
|
||||
my $self = shift;
|
||||
|
||||
# Fetch the Thread and CS before cutting the asset.
|
||||
my $thread = $self->getThread;
|
||||
warn "got thread";
|
||||
my $cs = $thread->getParent;
|
||||
warn "got cs";
|
||||
|
||||
# Cut the asset
|
||||
my $result = super();
|
||||
warn "called super";
|
||||
|
||||
# If a post is being cut update the thread reply count first
|
||||
if ($thread->getId ne $self->getId) {
|
||||
warn "calling _fixReplyCount on thread";
|
||||
$self->_fixReplyCount( $thread );
|
||||
}
|
||||
|
||||
# Update the CS reply count. This step is also necessary when a Post is cut since the Thread's incrementReplies
|
||||
# also calls the CS's incrementReplies, possibly with the wrong last post Id.
|
||||
warn "calling _fixReplyCount on cs";
|
||||
$self->_fixReplyCount( $cs );
|
||||
warn "all should be well...?";
|
||||
|
||||
return $result;
|
||||
};
|
||||
|
|
@ -823,7 +830,7 @@ sub hasRated {
|
|||
return 1 if $self->isPoster;
|
||||
my $flag = 0;
|
||||
if ($self->session->user->isVisitor) {
|
||||
($flag) = $self->session->db->quickArray("select count(*) from Post_rating where assetId=? and ipAddress=?",[$self->getId, $self->session->env->getIp]);
|
||||
($flag) = $self->session->db->quickArray("select count(*) from Post_rating where assetId=? and ipAddress=?",[$self->getId, $self->session->request->address]);
|
||||
} else {
|
||||
($flag) = $self->session->db->quickArray("select count(*) from Post_rating where assetId=? and userId=?",[$self->getId, $self->session->user->userId]);
|
||||
}
|
||||
|
|
@ -888,7 +895,7 @@ sub insertUserPostRating {
|
|||
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (?,?,?,?,?)",
|
||||
[$self->getId,
|
||||
$self->session->user->userId,
|
||||
$self->session->env->getIp,
|
||||
$self->session->request->address,
|
||||
time(),
|
||||
$rating,]
|
||||
);
|
||||
|
|
@ -1367,7 +1374,7 @@ Updates the last post information in the parent Thread and CS if applicable.
|
|||
|
||||
sub setStatusUnarchived {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'approved'}) if ($self->get("status") eq "archived");
|
||||
$self->update({status=>'approved'}) if ($self->status eq "archived");
|
||||
$self->qualifyAsLastPost;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,8 +211,9 @@ sub appendTemplateVarsFileLoop {
|
|||
my $assetIds = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
for my $assetId (@$assetIds) {
|
||||
my $asset = WebGUI::Asset->newById($session, $assetId);
|
||||
ASSET: for my $assetId (@$assetIds) {
|
||||
my $asset = eval { WebGUI::Asset->newById($session, $assetId); };
|
||||
next ASSET if Exception::Class->caught();
|
||||
# Set the parent
|
||||
$asset->{_parent} = $self;
|
||||
push @{$var->{file_loop}}, $asset->getTemplateVars;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ sub _hasVoted {
|
|||
my $self = shift;
|
||||
my ($hasVoted) = $self->session->db->quickArray("select count(*) from Poll_answer
|
||||
where assetId=".$self->session->db->quote($self->getId)." and ((userId=".$self->session->db->quote($self->session->user->userId)."
|
||||
and userId<>'1') or (userId=".$self->session->db->quote($self->session->user->userId)." and ipAddress='".$self->session->env->getIp."'))");
|
||||
and userId<>'1') or (userId=".$self->session->db->quote($self->session->user->userId)." and ipAddress='".$self->session->request->address."'))");
|
||||
return $hasVoted;
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +545,7 @@ sub www_vote {
|
|||
my $self = shift;
|
||||
my $u;
|
||||
if ($self->session->form->process("answer") ne "" && $self->session->user->isInGroup($self->get("voteGroup")) && !($self->_hasVoted())) {
|
||||
$self->setVote($self->session->form->process("answer"),$self->session->user->userId,$self->session->env->getIp);
|
||||
$self->setVote($self->session->form->process("answer"),$self->session->user->userId,$self->session->request->address);
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
$self->session->user->karma($self->get("karmaPerVote"),"Poll (".$self->getId.")","Voted on this poll.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2045,7 +2045,7 @@ sub responseId {
|
|||
my $ignoreRevisionDate = $opts{ignoreRevisionDate};
|
||||
|
||||
my $user = WebGUI::User->new( $self->session, $userId );
|
||||
my $ip = $self->session->env->getIp;
|
||||
my $ip = $self->session->request->address;
|
||||
|
||||
my $responseId = $self->{responseId};
|
||||
return $responseId if $responseId;
|
||||
|
|
@ -2178,7 +2178,7 @@ sub canTakeSurvey {
|
|||
}
|
||||
|
||||
my $maxResponsesPerUser = $self->maxResponsesPerUser;
|
||||
my $ip = $self->session->env->getIp;
|
||||
my $ip = $self->session->request->address;
|
||||
my $userId = $self->session->user->userId();
|
||||
my $takenCount = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ sub editThingDataSave {
|
|||
if ($thingDataId eq "new"){
|
||||
$thingData{dateCreated} = time();
|
||||
$thingData{createdById} = $session->user->userId;
|
||||
$thingData{ipAddress} = $session->env->getIp;
|
||||
$thingData{ipAddress} = $session->request->address;
|
||||
}
|
||||
else {
|
||||
%thingData = $session->db->quickHash("select * from ".$session->db->dbh->quote_identifier("Thingy_".$thingId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue