Merge branch 'master' of git@github.com:plainblack/webgui

Conflicts:

	docs/upgrades/upgrade_7.8.0-7.8.1.pl
This commit is contained in:
daviddelikat 2009-10-05 09:13:21 -05:00
commit f26d9f4570
78 changed files with 521 additions and 226 deletions

View file

@ -2344,7 +2344,7 @@ sub publish {
my $assetIds = $self->session->db->buildArrayRef("select assetId from asset where lineage like ".$self->session->db->quote($self->get("lineage").'%')." $where");
my $idList = $self->session->db->quoteAndJoin($assetIds);
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".$self->session->datetime->time()." where assetId in (".$idList.")");
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".time()." where assetId in (".$idList.")");
my $cache = WebGUI::Cache->new($self->session);
foreach my $id (@{$assetIds}) {
# we do the purge directly cuz it's a lot faster than instantiating all these assets

View file

@ -174,7 +174,7 @@ sub getEditForm {
$tabform->getTab("properties")->readOnly(
-label=>$i18n->get('thumbnail'),
-hoverHelp=>$i18n->get('Thumbnail description'),
-value=>'<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.$self->session->datetime->time().'" alt="thumbnail" /></a>'
-value=>'<a href="'.$self->getFileUrl.'"><img src="'.$self->getThumbnailUrl.'?noCache='.time().'" alt="thumbnail" /></a>'
);
my ($x, $y) = $self->getStorageLocation->getSizeInPixels($self->get("filename"));
$tabform->getTab("properties")->readOnly(

View file

@ -597,7 +597,7 @@ sub setRatings {
if ($ratings->{$category}) {
$db->write("insert into MatrixListing_rating
(userId, category, rating, timeStamp, listingId, ipAddress, assetId) values (?,?,?,?,?,?,?)",
[$session->user->userId,$category,$ratings->{$category},$session->datetime->time(),$self->getId,
[$session->user->userId,$category,$ratings->{$category},time(),$self->getId,
$session->env->get("HTTP_X_FORWARDED_FOR"),$matrixId]);
}
my $sql = "from MatrixListing_rating where listingId=? and category=?";

View file

@ -710,30 +710,31 @@ Returns a hash reference of template variables for this Post.
=cut
sub getTemplateVars {
my $self = shift;
my $self = shift;
my $session = $self->session;
my %var = %{$self->get};
my %var = %{$self->get};
my $postUser = WebGUI::User->new($session, $self->get("ownerUserId"));
$var{"userId"} = $self->get("ownerUserId");
$var{"user.isPoster"} = $self->isPoster;
$var{"avatar.url"} = $self->getAvatarUrl;
$var{"userProfile.url"} = $postUser->getProfileUrl($self->getUrl());
$var{"dateSubmitted.human"} =$self->session->datetime->epochToHuman($self->get("creationDate"));
$var{"dateUpdated.human"} =$self->session->datetime->epochToHuman($self->get("revisionDate"));
$var{'title.short'} = $self->chopTitle;
$var{content} = $self->formatContent if ($self->getThread);
$var{'user.canEdit'} = $self->canEdit if ($self->getThread);
$var{"delete.url"} = $self->getDeleteUrl;
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
$var{'url.raw'} = $self->getUrl;
$var{'rating.value'} = $self->get("rating")+0;
$var{'rate.url.thumbsUp'} = $self->getRateUrl(1);
$var{'rate.url.thumbsDown'} = $self->getRateUrl(-1);
$var{'hasRated'} = $self->hasRated;
$var{"userId"} = $self->get("ownerUserId");
$var{"user.isPoster"} = $self->isPoster;
$var{"avatar.url"} = $self->getAvatarUrl;
$var{"userProfile.url"} = $postUser->getProfileUrl($self->getUrl());
$var{"hideProfileUrl" } = $self->get('ownerUserId') eq '1' || $session->user->isVisitor;
$var{"dateSubmitted.human"} = $self->session->datetime->epochToHuman($self->get("creationDate"));
$var{"dateUpdated.human"} = $self->session->datetime->epochToHuman($self->get("revisionDate"));
$var{'title.short'} = $self->chopTitle;
$var{content} = $self->formatContent if ($self->getThread);
$var{'user.canEdit'} = $self->canEdit if ($self->getThread);
$var{"delete.url"} = $self->getDeleteUrl;
$var{"edit.url"} = $self->getEditUrl;
$var{"status"} = $self->getStatus;
$var{"reply.url"} = $self->getReplyUrl;
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
$var{'url'} = $self->getUrl.'#id'.$self->getId;
$var{'url.raw'} = $self->getUrl;
$var{'rating.value'} = $self->get("rating")+0;
$var{'rate.url.thumbsUp'} = $self->getRateUrl(1);
$var{'rate.url.thumbsDown'} = $self->getRateUrl(-1);
$var{'hasRated'} = $self->hasRated;
my $gotImage;
my $gotAttachment;
@{$var{'attachment_loop'}} = ();
@ -890,7 +891,7 @@ sub insertUserPostRating {
[$self->getId,
$self->session->user->userId,
$self->session->env->getIp,
$self->session->datetime->time(),
time(),
$rating,]
);
}

View file

@ -100,14 +100,16 @@ A reference to a WebGUI::Paginator object.
=cut
sub appendPostListTemplateVars {
my $self = shift;
my $var = shift;
my $p = shift;
my $page = $p->getPageData;
my $i = 0;
my ($icon, $datetime) = $self->session->quick(qw(icon datetime));
my $self = shift;
my $session = $self->session;
my $var = shift;
my $p = shift;
my $page = $p->getPageData;
my $i = 0;
my ($icon, $datetime) = $session->quick(qw(icon datetime));
my $isVisitor = $session->user->isVisitor;
foreach my $row (@$page) {
my $post = WebGUI::Asset->new($self->session,$row->{assetId}, $row->{className}, $row->{revisionDate});
my $post = WebGUI::Asset->new($session,$row->{assetId}, $row->{className}, $row->{revisionDate});
$post->{_parent} = $self; # caching parent for efficiency
my $controls = $icon->delete('func=delete',$post->get("url"),"Delete") . $icon->edit('func=edit',$post->get("url"));
if ($self->get("sortBy") eq "lineage") {
@ -132,6 +134,7 @@ sub appendPostListTemplateVars {
"lastReply.title" => $lastPost->get("title"),
"lastReply.user.isVisitor" => $lastPost->get("ownerUserId") eq "1",
"lastReply.username" => $lastPost->get("username"),
"lastReply.hideProfileUrl" => $lastPost->get("ownerUserId") eq "1" || $isVisitor,
"lastReply.userProfile.url" => $lastPost->getPosterProfileUrl(),
"lastReply.dateSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%z"),
"lastReply.timeSubmitted.human" => $datetime->epochToHuman($lastPost->get("creationDate"),"%Z"),
@ -158,6 +161,7 @@ sub appendPostListTemplateVars {
"dateUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%z"),
"timeSubmitted.human" => $datetime->epochToHuman($post->get("creationDate"),"%Z"),
"timeUpdated.human" => $datetime->epochToHuman($post->get("revisionDate"),"%Z"),
"hideProfileUrl" => $post->get('ownerUserId') eq '1' || $isVisitor,
"userProfile.url" => $post->getPosterProfileUrl,
"user.isVisitor" => $post->get("ownerUserId") eq "1",
"edit.url" => $post->getEditUrl,
@ -175,7 +179,7 @@ sub appendPostListTemplateVars {
if ($row->{className} =~ m/^WebGUI::Asset::Post::Thread/) {
$postVars{'rating'} = $post->get('threadRating');
}
push(@{$var->{post_loop}}, \%postVars );
push(@{$var->{post_loop}}, \%postVars );
$i++;
}
$p->appendTemplateVars($var);
@ -1222,10 +1226,10 @@ sub getViewTemplateVars {
my %var;
$var{'user.canPost'} = $self->canPost;
$var{'user.canStartThread'} = $self->canStartThread;
$var{"add.url"} = $self->getNewThreadUrl;
$var{"rss.url"} = $self->getRssFeedUrl;
$var{'user.isModerator'} = $self->canModerate;
$var{'user.isVisitor'} = ($self->session->user->isVisitor);
$var{"add.url"} = $self->getNewThreadUrl;
$var{"rss.url"} = $self->getRssFeedUrl;
$var{'user.isModerator'} = $self->canModerate;
$var{'user.isVisitor'} = ($self->session->user->isVisitor);
$var{'user.isSubscribed'} = $self->isSubscribed;
$var{'sortby.title.url'} = $self->getSortByUrl("title");
$var{'sortby.username.url'} = $self->getSortByUrl("username");

View file

@ -27,6 +27,7 @@ use WebGUI::Asset::Wobject;
use WebGUI::Pluggable;
use WebGUI::DateTime;
use WebGUI::User;
use WebGUI::Utility;
use WebGUI::Group;
use WebGUI::AssetCollateral::DataForm::Entry;
use WebGUI::Form::SelectRichEditor;
@ -225,7 +226,8 @@ an entry is being viewed, bypass caching altogether.
sub getContentLastModified {
my $self = shift;
if ($self->currentView eq 'list' || $self->session->form->process('entryId')) {
my $hasCaptcha = isIn('Captcha', map { $_->{type} } map { $self->getFieldConfig($_) } @{ $self->getFieldOrder });
if ($self->currentView eq 'list' || $self->session->form->process('entryId') || $hasCaptcha) {
return time;
}
return $self->SUPER::getContentLastModified;
@ -1597,7 +1599,7 @@ sub www_editFieldSave {
$newSelf->createField($newName, \%field);
}
WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session);
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session);
my $freshSelf = $newSelf->cloneFromDb();
if ($form->process("proceed") eq "editField") {
return $freshSelf->www_editField('new');

View file

@ -414,11 +414,11 @@ sub www_setStatus {
$db->write("delete from InOutBoard_status where userId=? and assetId=?", [ $sessionUserId, $self->getId ]);
$db->write(
"insert into InOutBoard_status (assetId,userId,status,dateStamp,message) values (?,?,?,?,?)",
[$self->getId, $sessionUserId, $status, $session->datetime->time(), $message ],
[$self->getId, $sessionUserId, $status, time(), $message ],
);
$db->write(
"insert into InOutBoard_statusLog (assetId,userId,createdBy,status,dateStamp,message) values (?,?,?,?,?,?)",
[$self->getId, $sessionUserId, $session->user->userId, $status, $session->datetime->time(), $message ],
[$self->getId, $sessionUserId, $session->user->userId, $status, time(), $message ],
);
}
else {
@ -452,7 +452,7 @@ sub www_viewReport {
-name=>"doit",
-value=>"1"
);
my $startDate = $self->session->datetime->addToDate($self->session->datetime->time(),0,0,-15);
my $startDate = $self->session->datetime->addToDate(time(),0,0,-15);
$startDate = $self->session->form->date("startDate") if ($self->session->form->process("doit"));
$f->date(
-name=>"startDate",

View file

@ -380,7 +380,7 @@ sub getKeywordStaticURL {
my $url = $self->getUrl;
my @parts = split /\//, $url;
my $lastPart = pop @parts;
if (index $lastPart, '.' == -1) {
if (index( $lastPart, '.' ) == -1) {
return join '/', $self->getUrl, $self->getKeywordFilename($keyword);
}
else {

View file

@ -24,6 +24,7 @@ use WebGUI::Form::Country;
use WebGUI::VersionTag;
use Text::CSV_XS;
use Params::Validate qw(:all);
use WebGUI::Macro;
Params::Validate::validation_options( on_fail => sub { WebGUI::Error::InvalidParam->throw( error => shift ) } );
my $TAP_PARSER_MISSING = <<END_WARN;
@ -1256,6 +1257,8 @@ sub www_loadSurvey {
$editHtml = $self->processTemplate( $var, $self->get('answerEditTemplateId') );
}
WebGUI::Macro::process($self->session, \$editHtml);
# Generate the list of valid goto targets
my $gotoTargets = $self->surveyJSON->getGotoTargets;

View file

@ -266,7 +266,8 @@ sub getTemplateVariables {
$item{author} = WebGUI::HTML::filter(scalar $object->author, 'javascript');
$item{guid} = WebGUI::HTML::filter(scalar $object->guid, 'javascript');
$item{link} = WebGUI::HTML::filter(scalar $object->link, 'javascript');
$item{description} = WebGUI::HTML::filter(scalar($object->description), 'javascript');
my $description = WebGUI::HTML::filter(scalar($object->description), 'javascript');
$item{description} = defined $description ? $description : '';
$item{descriptionFirst100words} = $item{description};
$item{descriptionFirst100words} =~ s/(((\S+)\s+){100}).*/$1/s;
$item{descriptionFirst75words} = $item{descriptionFirst100words};

View file

@ -64,7 +64,7 @@ sub cut {
return undef if ($self->getId eq $session->setting->get("defaultPage") || $self->getId eq $session->setting->get("notFoundPage"));
$session->db->beginTransaction;
$session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
$session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$session->user->userId, $session->datetime->time(), $self->getId]);
$session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$session->user->userId, time(), $self->getId]);
$session->db->commit;
$self->{_properties}{state} = "clipboard";
foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) {

View file

@ -204,7 +204,7 @@ sub exportAsHtml {
my $i18n = WebGUI::International->new($self->session, 'Asset');
# take down when we started to tell the user how long the process took.
my $startTime = $session->datetime->time;
my $startTime = time;
# get the export path and ensure it is valid.
my $exportPath = $self->exportCheckPath;
@ -298,7 +298,7 @@ sub exportAsHtml {
}
# we're done. give the user a status report.
my $timeRequired = $session->datetime->time - $startTime;
my $timeRequired = time - $startTime;
my $message = sprintf $i18n->get('export information'), $exportedCount, $timeRequired;
return $message;
}
@ -791,14 +791,15 @@ sub exportWriteFile {
my $dest = $self->exportGetUrlAsPath;
my $parent = $dest->parent;
eval { $parent->absolute->mkpath };
if($@) {
WebGUI::Error->throw(error => "could not make directory " . $parent->absolute->stringify);
$parent->absolute->mkpath( {error => \my $err} );
if (@$err) {
(undef, my $message) = %{ $err->[0] };
WebGUI::Error->throw(error => "Could not make directory " . $parent->absolute->stringify . ": " . $message);
}
# next, get the contents, open the file, and write the contents to the file.
my $fh = eval { $dest->open('>:utf8') };
if($@) {
if(! $fh) {
WebGUI::Error->throw(error => "can't open " . $dest->absolute->stringify . " for writing: $!");
}
$self->session->asset($self);

View file

@ -68,7 +68,7 @@ sub addChild {
my $self = shift;
my $properties = shift;
my $id = shift || $self->session->id->generate();
my $now = shift || $self->session->datetime->time();
my $now = shift || time();
my $options = shift;
# Check if it is possible to add a child to this asset. If not add it as a sibling of this asset.
@ -85,7 +85,8 @@ sub addChild {
$properties->{assetId} = $id;
$properties->{parentId} = $self->getId;
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,$properties) || croak "Couldn't create a new $properties->{className} asset!";
$temp->{_parent} = $self;
# Do not set the parent here, since it could be stale and poison the child
#$temp->{_parent} = $self;
my $newAsset = $temp->addRevision($properties, $now, $options);
$self->updateHistory("added child ".$id);
$self->session->http->setStatus(201,"Asset Creation Successful");

View file

@ -137,7 +137,7 @@ sub importAssetData {
my $error = $self->session->errorHandler;
my $id = $data->{properties}{assetId};
my $class = $data->{properties}{className};
my $version = $options->{overwriteLatest} ? 0 : $data->{properties}{revisionDate};
my $version = $options->{overwriteLatest} ? time : $data->{properties}{revisionDate};
# Load the class
WebGUI::Asset->loadModule( $self->session, $class );

View file

@ -289,7 +289,7 @@ sub trash {
$db->beginTransaction;
$outputSub->($i18n->get('Clearing asset tables'));
$db->write("update asset set state='trash-limbo' where lineage like ?",[$self->get("lineage").'%']);
$db->write("update asset set state='trash', stateChangedBy=?, stateChanged=? where assetId=?",[$session->user->userId, $session->datetime->time(), $self->getId]);
$db->write("update asset set state='trash', stateChangedBy=?, stateChanged=? where assetId=?",[$session->user->userId, time(), $self->getId]);
$db->commit;
# Update ourselves since we didn't use update()

View file

@ -65,7 +65,7 @@ A hash reference containing a list of properties to associate with the child.
=head3 revisionDate
An epoch date representing the date/time stamp that this revision was
created. Defaults to $self->session->datetime->time().
created. Defaults to time().
=head3 options
@ -87,7 +87,7 @@ Posts) will know not to send them under certain conditions.
sub addRevision {
my $self = shift;
my $properties = shift || {};
my $now = shift || $self->session->datetime->time();
my $now = shift || time();
my $options = shift;
my $autoCommitId = $self->getAutoCommitWorkflowId() unless ($options->{skipAutoCommitWorkflows});
@ -101,7 +101,16 @@ sub addRevision {
} );
}
else {
$workingTag = WebGUI::VersionTag->getWorking($self->session);
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $self->session );
}
else {
$workingTag = WebGUI::VersionTag->new( $self->session, $parentAsset->get('tagId') );
}
}
#Create a dummy revision to be updated with real data later
@ -564,7 +573,7 @@ sub updateHistory {
my $session = $self->session;
my $action = shift;
my $userId = shift || $session->user->userId || '3';
my $dateStamp =$session->datetime->time();
my $dateStamp =time();
$session->db->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp, url) values (?,?,?,?,?)", [$self->getId, $userId, $action, $dateStamp, $self->get('url')]);
}

View file

@ -64,7 +64,7 @@ sub _isDuplicateUsername {
my ($otherUser) = $self->session->db->quickArray("select count(*) from users where username=".$self->session->db->quote($username));
return 0 if !$otherUser;
my $i18n = WebGUI::International->new($self->session);
$self->error('<li>'.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman($self->session->datetime->time(),"%y")).'</li>');
$self->error('<li>'.sprintf($i18n->get(77), $username,$username,$username,$self->session->datetime->epochToHuman(time(),"%y")).'</li>');
return 1;
}
@ -108,11 +108,11 @@ sub _logLogin {
[
$_[0],
$_[1],
$self->session->datetime->time(),
time(),
$self->session->env->getIp,
$self->session->env->get("HTTP_USER_AGENT"),
$self->session->getId,
$self->session->datetime->time(),
time(),
]
);
}

View file

@ -266,7 +266,7 @@ sub createAccountSave {
$properties->{ changeUsername } = $setting->get("webguiChangeUsername");
$properties->{ changePassword } = $setting->get("webguiChangePassword");
$properties->{ identifier } = $self->hashPassword($password);
$properties->{ passwordLastUpdated } = $session->datetime->time();
$properties->{ passwordLastUpdated } = time();
$properties->{ passwordTimeout } = $setting->get("webguiPasswordTimeout");
$properties->{ status } = 'Deactivated' if ($setting->get("webguiValidateEmail"));
@ -433,16 +433,16 @@ sub editUserFormSave {
unless (!$identifier || $identifier eq "password") {
$properties->{identifier} = $self->hashPassword($self->session->form->process('authWebGUI.identifier'));
if($userData->{identifier} ne $properties->{identifier}){
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
}
}
$properties->{passwordTimeout} = $self->session->form->interval('authWebGUI.passwordTimeout');
$properties->{changeUsername} = $self->session->form->process('authWebGUI.changeUsername');
$properties->{changePassword} = $self->session->form->process('authWebGUI.changePassword');
if($userId eq "new") {
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
if ($self->session->setting->get("webguiExpirePasswordOnCreation")){
$properties->{passwordLastUpdated} =$self->session->datetime->time() - $properties->{passwordTimeout};
$properties->{passwordLastUpdated} =time() - $properties->{passwordTimeout};
}
}
@ -753,7 +753,7 @@ sub login {
my $userData = $self->getParams;
if($self->getSetting("passwordTimeout") && $userData->{passwordTimeout}){
my $expireTime = $userData->{passwordLastUpdated} + $userData->{passwordTimeout};
if ($self->session->datetime->time() >= $expireTime){
if (time() >= $expireTime){
my $userId = $self->userId;
$self->logout;
return $self->resetExpiredPassword($userId);
@ -1031,7 +1031,7 @@ sub profileRecoverPasswordFinish {
$self->user( $user );
$self->saveParams($userId, $self->authMethod,
{ identifier => $self->hashPassword($password),
passwordLastUpdated => $self->session->datetime->time });
passwordLastUpdated => time });
$self->_logSecurityMessage;
return $self->SUPER::login;
} else {
@ -1182,7 +1182,7 @@ sub emailResetPasswordFinish {
$self->user(WebGUI::User->new($self->session, $userId));
$self->saveParams($userId, $self->authMethod,
{ identifier => $self->hashPassword($password),
passwordLastUpdated => $self->session->datetime->time });
passwordLastUpdated => time });
$self->_logSecurityMessage;
# delete the emailRecoverPasswordVerificationNumber
@ -1236,7 +1236,7 @@ sub resetExpiredPasswordSave {
return $self->resetExpiredPassword($u->userId, "<h1>".$i18n->get(70)."</h1><ul>".$error.'</ul>') if ($error);
$properties->{identifier} = $self->hashPassword($self->session->form->process("identifier"));
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
$self->saveParams($u->userId,$self->authMethod,$properties);
$self->_logSecurityMessage();
@ -1314,7 +1314,7 @@ sub updateAccount {
$properties->{identifier} = $self->hashPassword($password);
$self->_logSecurityMessage();
if($userData->{identifier} ne $properties->{identifier}){
$properties->{passwordLastUpdated} =$self->session->datetime->time();
$properties->{passwordLastUpdated} =time();
}
}
}

View file

@ -82,7 +82,7 @@ sub definition {
push(@{$definition}, {
defaultValue=>{
defaultValue=>$session->datetime->time()
defaultValue=>time()
},
maxlength=>{
defaultValue=> 10

View file

@ -84,7 +84,7 @@ sub definition {
my $definition = shift || [];
push(@{$definition}, {
defaultValue=>{
defaultValue=>$session->datetime->time()
defaultValue=>time()
},
maxlength=>{
defaultValue=> 19

View file

@ -92,7 +92,7 @@ sub _defaults {
my $self = shift;
return {
groupId=>"new",
dateCreated=>$self->session->datetime->time(),
dateCreated=>time(),
expireOffset=>314496000,
karmaThreshold=>1000000000,
groupName=>"New Group",
@ -101,7 +101,7 @@ sub _defaults {
expireNotify=>0,
databaseLinkId=>0,
groupCacheTimeout=>3600,
lastUpdated=>$self->session->datetime->time(),
lastUpdated=>time(),
autoAdd=>0,
autoDelete=>0,
isEditable=>1,
@ -168,10 +168,10 @@ sub addUsers {
foreach my $uid (@{$users}) {
my ($isIn) = $self->session->db->quickArray("select count(*) from groupings where groupId=? and userId=?", [$self->getId, $uid]);
unless ($isIn) {
$self->session->db->write("insert into groupings (groupId,userId,expireDate) values (?,?,?)", [$self->getId, $uid, ($self->session->datetime->time()+$expireOffset)]);
$self->session->db->write("insert into groupings (groupId,userId,expireDate) values (?,?,?)", [$self->getId, $uid, (time()+$expireOffset)]);
$self->session->stow->delete("gotGroupsForUser");
} else {
$self->userGroupExpireDate($uid,($self->session->datetime->time()+$expireOffset));
$self->userGroupExpireDate($uid,(time()+$expireOffset));
}
}
}
@ -732,14 +732,14 @@ sub getIpUsers {
my $IpFilter;
return [] unless $IpFilter = $self->ipFilter();
my $time = $self->session->datetime->time();
my $time = time();
$IpFilter =~ s/\s//g;
my @filters = split /;/, $IpFilter;
my $query = "select userId,lastIP from userSession where expires > ?";
my $sth = $self->session->db->read($query, [ $self->session->datetime->time() ]);
my $sth = $self->session->db->read($query, [ time() ]);
my %localCache = ();
my @ipUsers = ();
while (my ($userId, $lastIP) = $sth->array() ) {
@ -837,7 +837,7 @@ sub getScratchUsers {
my $scratchFilter;
return [] unless $scratchFilter = $self->scratchFilter();
my $time = $self->session->datetime->time();
my $time = time();
$scratchFilter =~ s/\s//g;
my @filters = split /;/, $scratchFilter;
@ -878,7 +878,7 @@ sub getUserList {
my $withoutExpired = shift;
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
return $self->session->db->buildHashRef("select users.userId, users.username from users join groupings using(userId) where expireDate > ? and groupId = ? order by username asc", [$expireTime, $self->getId]);
}
@ -903,7 +903,7 @@ sub getUsers {
my $withoutExpired = shift;
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
my @users = $self->session->db->buildArray("select userId from groupings where expireDate > ? and groupId = ?", [$expireTime, $self->getId]);
return \@users;
@ -938,7 +938,7 @@ sub getUsersNotIn {
my $expireTime = 0;
if ($withoutExpired) {
$expireTime = $self->session->datetime->time();
$expireTime = time();
}
my $sql = q{
@ -1496,7 +1496,7 @@ sub set {
my $value = shift;
$self->get("groupId") unless ($self->{_group}); # precache group stuff
$self->{_group}{$name} = $value;
$self->session->db->setRow("groups","groupId",{groupId=>$self->getId, $name=>$value, lastUpdated=>$self->session->datetime->time()});
$self->session->db->setRow("groups","groupId",{groupId=>$self->getId, $name=>$value, lastUpdated=>time()});
$self->clearCaches;
}

View file

@ -103,7 +103,9 @@ our $HELP = {
{ 'name' => 'timeSubmitted.human' },
{ 'name' => 'timeUpdated.human' },
{ 'name' => 'userProfile.url' },
{ 'name' => 'user.isVisitor' },
{ 'name' => 'hideProfileUrl' },
{ 'name' => 'user.isVisitor',
'description' => 'post_loop_user.isVisitor' },
{ 'name' => 'edit.url' },
{ 'name' => 'controls' },
{ 'name' => 'isSecond' },
@ -116,6 +118,7 @@ our $HELP = {
{ 'name' => 'lastReply.url' },
{ 'name' => 'lastReply.title' },
{ 'name' => 'lastReply.user.isVisitor' },
{ 'name' => 'lastReply.hideProfileUrl' },
{ 'name' => 'lastReply.username' },
{ 'name' => 'lastReply.userProfile.url' },
{ 'name' => 'lastReply.dateSubmitted.human' },

View file

@ -40,7 +40,7 @@ sub process {
my $session = shift;
my (@param, $temp, $time);
@param = @_;
$time = $param[1] ||$session->datetime->time();
$time = $param[1] ||time();
$temp =$session->datetime->epochToHuman($time,$param[0]);
return $temp;
}

View file

@ -840,7 +840,7 @@ sub www_editUserSave {
}
# Display an error telling them the username they are trying to use is not available and suggest alternatives
} else {
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman($session->datetime->time(),"%y")).'</ul>';
$error = '<ul>' . sprintf($i18n->get(77), $postedUsername, $postedUsername, $postedUsername, $session->datetime->epochToHuman(time(),"%y")).'</ul>';
}
if ($isSecondary) {
return _submenu($session,{workarea => $i18n->get(978)});

View file

@ -61,7 +61,7 @@ sub add {
[
$session->id->generate(), $session->user->userId,
$session->var->get("sessionId"), $assetId,
$session->datetime->time(),
time(),
]);
return undef;
}

View file

@ -950,7 +950,7 @@ sub setToEpoch {
}
unless ($dt) {
$self->session->errorHandler->warn("Could not format date $set for epoch. Returning current time");
return $self->time();
return time();
}
return $dt->epoch;
}
@ -959,7 +959,8 @@ sub setToEpoch {
=head2 time ( )
Returns an epoch date for now.
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the perl built in function time().
=cut

View file

@ -193,7 +193,7 @@ sub gateway {
my $url = $self->session->config->get("gateway").'/'.$pageUrl;
$url =~ s/\/+/\//g;
if ($self->session->setting->get("preventProxyCache") == 1 and !$skipPreventProxyCache) {
$url = $self->append($url,"noCache=".randint(0,1000).':'.$self->session->datetime->time());
$url = $self->append($url,"noCache=".randint(0,1000).':'.time());
}
if ($pairs) {
$url = $self->append($url,$pairs);

View file

@ -184,14 +184,14 @@ sub new {
$self->session->{_sessionId} = $self->{_var}{sessionId};
return $self;
}
if ($self->{_var}{expires} && $self->{_var}{expires} < $session->datetime->time()) { ##Session expired, start a new one with the same Id
if ($self->{_var}{expires} && $self->{_var}{expires} < time()) { ##Session expired, start a new one with the same Id
$self->end;
$self->start(1,$sessionId);
}
elsif ($self->{_var}{sessionId} ne "") { ##Fetched an existing session. Update variables with recent data.
$self->{_var}{lastPageView} = $session->datetime->time();
$self->{_var}{lastPageView} = time();
$self->{_var}{lastIP} = $session->env->getIp;
$self->{_var}{expires} = $session->datetime->time() + $session->setting->get("sessionTimeout");
$self->{_var}{expires} = time() + $session->setting->get("sessionTimeout");
$self->session->{_sessionId} = $self->{_var}{sessionId};
$session->db->setRow("userSession","sessionId",$self->{_var});
return $self;
@ -241,7 +241,7 @@ sub start {
$userId = 1 if ($userId eq "");
my $sessionId = shift;
$sessionId = $self->session->id->generate if ($sessionId eq "");
my $time = $self->session->datetime->time();
my $time = time();
$self->{_var} = {
expires => $time + $self->session->setting->get("sessionTimeout"),
lastPageView => $time,

View file

@ -544,9 +544,9 @@ sub friends {
$myFriends->isEditable(0);
$self->uncache;
$self->{_user}{"friendsGroup"} = $myFriends->getId;
$self->{_user}{"lastUpdated"} = $self->session->datetime->time();
$self->{_user}{"lastUpdated"} = time();
$self->session->db->write("update users set friendsGroup=?, lastUpdated=? where userId=?",
[$myFriends->getId, $self->session->datetime->time(), $self->userId]);
[$myFriends->getId, time(), $self->userId]);
$self->{_friendsGroup} = $myFriends;
}
@ -642,7 +642,7 @@ sub getGroups {
my $withoutExpired = shift;
my $clause = "";
if ($withoutExpired) {
$clause = "and expireDate>".$self->session->datetime->time();
$clause = "and expireDate>".time();
}
my $gotGroupsForUser = $self->session->stow->get("gotGroupsForUser");
if (exists $gotGroupsForUser->{$self->userId}) {
@ -1016,7 +1016,7 @@ sub karma {
$self->uncache;
$self->{_user}{karma} += $amount;
$self->session->db->write("update users set karma=karma+? where userId=?", [$amount, $self->userId]);
$self->session->db->write("insert into karmaLog values (?,?,?,?,?)",[$self->userId, $amount, $source, $description, $self->session->datetime->time()]);
$self->session->db->write("insert into karmaLog values (?,?,?,?,?)",[$self->userId, $amount, $source, $description, time()]);
}
return $self->{_user}{karma};
}

View file

@ -137,7 +137,7 @@ sub create {
my $properties = shift;
my $tagId = $session->db->setRow("assetVersionTag","tagId",{
tagId=>"new",
creationDate=>$session->datetime->time(),
creationDate=>time(),
createdBy=>$session->user->userId
});
my $tag = $class->new($session, $tagId);
@ -178,7 +178,7 @@ sub commit {
if ($finished) {
$self->{_data}{isCommitted} = 1;
$self->{_data}{committedBy} = $self->session->user->userId unless ($self->{_data}{committedBy});
$self->{_data}{commitDate} = $self->session->datetime->time();
$self->{_data}{commitDate} = time();
$self->session->db->setRow("assetVersionTag", "tagId", $self->{_data});
$self->clearWorking;
return 1;
@ -674,7 +674,7 @@ sub set {
my $self = shift;
my $properties = shift;
my $now = $self->session->datetime->time();
my $now = time();
my $startTime = WebGUI::DateTime->new($self->session,$now)->toDatabase;
my $endTime = WebGUI::DateTime->new($self->session,'2036-01-01 00:00:00')->toDatabase;

View file

@ -71,7 +71,7 @@ See WebGUI::Workflow::Activity::execute() for details.
sub execute {
my $self = shift;
my $session = $self->session;
my $epoch = $self->session->datetime->time();
my $epoch = time();
my $getAnArchive = WebGUI::Asset::Wobject::StoryArchive->getIsa($session);
ARCHIVE: while (my $archive = $getAnArchive->()) {
next ARCHIVE unless $archive && $archive->get("archiveAfter");

View file

@ -69,7 +69,7 @@ See WebGUI::Workflow::Activity::execute() for details.
sub execute {
my $self = shift;
my $epoch = $self->session->datetime->time();
my $epoch = time();
my $a = $self->session->db->read("select assetId from asset where className='WebGUI::Asset::Wobject::Collaboration'");
while (my ($assetId) = $a->array) {
my $cs = WebGUI::Asset->new($self->session, $assetId, "WebGUI::Asset::Wobject::Collaboration");

View file

@ -81,7 +81,7 @@ sub execute {
return $self->COMPLETE;
}
my @userIds = $self->session->db->buildArray("SELECT a.userId FROM authentication AS a INNER JOIN users AS u ON a.userId = u.userId WHERE a.authMethod = 'WebGUI' AND a.fieldName = 'emailValidationKey' AND u.status = 'Deactivated' AND u.dateCreated < ?", [$self->session->datetime->time - $self->get('interval')]);
my @userIds = $self->session->db->buildArray("SELECT a.userId FROM authentication AS a INNER JOIN users AS u ON a.userId = u.userId WHERE a.authMethod = 'WebGUI' AND a.fieldName = 'emailValidationKey' AND u.status = 'Deactivated' AND u.dateCreated < ?", [time - $self->get('interval')]);
foreach my $userId (@userIds) {
WebGUI::User->new($self->session, $userId)->delete;
}

View file

@ -84,7 +84,7 @@ sub execute {
my $urlOfSingleAsset = "";
#By default, we'll make it so that things happen now.
my $time = $session->datetime->time();
my $time = time();
#If the type is startTime, we'll wait until the version tag starttime to proceed
if($self->get("type") eq "startTime") {
@ -98,7 +98,7 @@ sub execute {
my $dt = WebGUI::DateTime->new($session,$time);
#Get the current UTC time
my $now = WebGUI::DateTime->new($session,$session->datetime->time());
my $now = WebGUI::DateTime->new($session,time());
#Workflow is complete if the time has passed.
if($now->epoch >= $dt->epoch) {

View file

@ -1293,11 +1293,21 @@ the preview is displayed, the Post can either be edited or canceled.|,
lastUpdated => 1149655722,
},
'user.isVisitor' => {
'post_loop_user.isVisitor' => {
message => q|A conditional that is true if the poster is a visitor.|,
lastUpdated => 1149655722,
},
'user.isVisitor' => {
message => q|A conditional that is true if the current user is a visitor.|,
lastUpdated => 1149655722,
},
'hideProfileUrl' => {
message => q|A conditional that is true if the poster is a visitor, or the current user is a visitor. In the first case, Visitor's profile is not visible to any user. In the second case, Visitor is not allowed to view any user's profile|,
lastUpdated => 1254506340,
},
'edit.url' => {
message => q|The URL to edit this Post.|,
lastUpdated => 1149655722,
@ -1359,6 +1369,11 @@ user has an avatar.|,
lastUpdated => 1149655722,
},
'lastReply.hideProfileUrl' => {
message => q|A conditional that is true if the poster of the last reply is a visitor, or the current user is a visitor. In the first case, Visitor's profile is not visible to any user. In the second case, Visitor is not allowed to view any user's profile|,
lastUpdated => 1254506340,
},
'lastReply.username' => {
message => q|The name of user who submitted the last reply.|,
lastUpdated => 1149655722,

View file

@ -33,9 +33,9 @@ our $I18N = {
},
'template error' => {
message => q|There is a syntax error in this template, %s, %s. Please correct.|,
message => q|There is a syntax error in this template, %s, %s, %s. Please correct.|,
context => q|Error when executing template|,
lastUpdated => 1244476530,
lastUpdated => 1254512327,
},
'namespace description' => {