bunch of bug fixes

This commit is contained in:
JT Smith 2005-03-14 21:55:01 +00:00
parent 04c0c8a542
commit 39ff1ea964
6 changed files with 61 additions and 23 deletions

View file

@ -729,7 +729,33 @@ sub www_unsubscribe {
sub www_view {
my $self = shift;
return WebGUI::Privilege::noAccess() unless $self->canView;
return $self->getParent->processStyle($self->view);
my $cache;
my $output;
my $useCache = (
$session{form}{op} eq "" &&
$session{form}{func} eq "" &&
$session{form}{layout} eq "" &&
(
( $self->getParent->get("cacheTimeout") > 10 && $session{user}{userId} ne '1') ||
( $self->getParent->get("cacheTimeoutVisitor") > 10 && $session{user}{userId} eq '1')
) &&
not $session{var}{adminOn}
);
if ($useCache) {
$cache = WebGUI::Cache->new("cspost_".$self->getId."_".$session{user}{userId});
$output = $cache->get;
}
unless ($output) {
$output = $self->getParent->processStyle($self->view);
my $ttl;
if ($session{user}{userId} eq '1') {
$ttl = $self->getParent->get("cacheTimeoutVisitor");
} else {
$ttl = $self->getParent->get("cacheTimeout");
}
$cache->set($output, $ttl) if ($useCache);
}
return $output;
}

View file

@ -972,9 +972,8 @@ sub www_search {
Post.status in ('approved','archived')";
$sql .= " or Post.status='pending'" if ($self->canModerate);
$sql .= " or (asset.ownerUserId=".quote($session{user}{userId})." and asset.ownerUserId<>'1')
)
and ";
$sql .= "($all) " if ($all ne "");
) ";
$sql .= " and ($all) " if ($all ne "");
$sql .= " and " if ($sql ne "" && $exactPhrase ne "");
$sql .= " ($exactPhrase) " if ($exactPhrase ne "");
$sql .= " and " if ($sql ne "" && $atLeastOne ne "");