merging 6.2.10 and 6.2.11 changes
This commit is contained in:
parent
486b96d94d
commit
d47830aceb
28 changed files with 139 additions and 59 deletions
|
|
@ -29,7 +29,7 @@ sub _hasVoted {
|
|||
my $self = shift;
|
||||
my ($hasVoted) = WebGUI::SQL->quickArray("select count(*) from Poll_answer
|
||||
where assetId=".quote($self->getId)." and ((userId=".quote($session{user}{userId})."
|
||||
and userId<>1) or (userId=1 and ipAddress='$session{env}{REMOTE_ADDR}'))");
|
||||
and userId<>'1') or (userId='1' and ipAddress='$session{env}{REMOTE_ADDR}'))");
|
||||
return $hasVoted;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ sub getResponseCount {
|
|||
my $ipAddress = $self->getIp;
|
||||
my $userId = $self->getUserId;
|
||||
my ($count) = WebGUI::SQL->quickArray("select count(*) from Survey_response where Survey_id=".quote($self->get("Survey_id"))." and
|
||||
((userId<>1 and userId=".quote($userId).") or ( userId=1 and ipAddress=".quote($ipAddress)."))");
|
||||
((userId<>'1' and userId=".quote($userId).") or ( userId='1' and ipAddress=".quote($ipAddress)."))");
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ sub view {
|
|||
if ($constraints ne "") {
|
||||
$constraints = "USS_submission.status='Approved' and ".$constraints;
|
||||
} else {
|
||||
$constraints = "(USS_submission.status='Approved' or (USS_submission.userId=".quote($session{user}{userId})." and USS_submission.userId<>1)";
|
||||
$constraints = "(USS_submission.status='Approved' or (USS_submission.userId=".quote($session{user}{userId})." and USS_submission.userId<>'1')";
|
||||
if ($var{canModerate}) {
|
||||
$constraints .= " or USS_submission.status='Pending'";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ sub createAccountSave {
|
|||
|
||||
|
||||
#Check that username is valid and not a duplicate in the system.
|
||||
$error .= $self->error if($self->validUsername($username));
|
||||
$error .= $self->error if(!$self->validUsername($username));
|
||||
#Validate profile data.
|
||||
my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData();
|
||||
$error .= $temp;
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ A string representing the output format for the date. Defaults to '%z %Z'. You c
|
|||
%m = A two digit month.
|
||||
%M = A variable digit month.
|
||||
%n = A two digit minute.
|
||||
%o = Offset from GMT represented as an integer.
|
||||
%o = Offset from local time represented as an integer.
|
||||
%O = Offset from GMT represented in four digit form with a sign. Example: -0600
|
||||
%p = A lower-case am/pm.
|
||||
%P = An upper-case AM/PM.
|
||||
|
|
@ -265,9 +265,11 @@ sub epochToHuman {
|
|||
my ($year,$month,$day,$hour,$min,$sec) = epochToArray($temp);
|
||||
$output = $_[1] || "%z %Z";
|
||||
#---GMT Offsets
|
||||
$temp = $session{user}{timeOffset}*100;
|
||||
$temp = sprintf('%+05d',$temp);
|
||||
$output =~ s/\%O/$temp/g;
|
||||
if ($output =~ /\%O/) {
|
||||
$temp = $session{user}{timeOffset}*100;
|
||||
$temp = sprintf("%+05d",Date::Manip::UnixDate("now","%z")+$temp);
|
||||
$output =~ s/\%O/$temp/g;
|
||||
}
|
||||
$temp = $session{user}{timeOffset}+0;
|
||||
$output =~ s/\%o/$temp/g;
|
||||
#---dealing with percent symbol
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ sub process {
|
|||
$type = "text" if ($type eq "");
|
||||
$value = &$type($name);
|
||||
unless (defined $value) {
|
||||
$value = $default;
|
||||
return $default;
|
||||
}
|
||||
if ($value =~ /^[\s]+$/) {
|
||||
return undef;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ sub hasRated {
|
|||
return 1 if ($userId != 1 && $userId eq $self->get("userId")); # is poster
|
||||
$ipAddress = $session{env}{REMOTE_ADDR} unless ($ipAddress);
|
||||
my ($flag) = WebGUI::SQL->quickArray("select count(*) from forumPostRating where forumPostId="
|
||||
.quote($self->get("forumPostId"))." and ((userId=".quote($userId)." and userId<>1) or (userId=1 and
|
||||
.quote($self->get("forumPostId"))." and ((userId=".quote($userId)." and userId<>1) or (userId='1' and
|
||||
ipAddress=".quote($ipAddress)."))");
|
||||
return $flag;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1393,8 +1393,11 @@ The unique id of the post that was selected by the user in this thread.
|
|||
|
||||
sub getFlatThread {
|
||||
my ($post, $thread, $forum, $caller, $currentPost) = @_;
|
||||
my (@post_loop, @posts);
|
||||
@posts = WebGUI::SQL->buildArray("SELECT forumPostId FROM forumPost WHERE forumThreadId=".quote($thread->get("forumThreadId"))." ORDER BY dateOfPost");
|
||||
my (@post_loop, @posts, $OR);
|
||||
unless ($post->getThread->getForum->isModerator) {
|
||||
$OR = "OR status='denied' OR status='pending'";
|
||||
}
|
||||
@posts = WebGUI::SQL->buildArray("SELECT forumPostId FROM forumPost WHERE forumThreadId=".quote($thread->get("forumThreadId"))." AND NOT (status='deleted' $OR) ORDER BY dateOfPost");
|
||||
foreach my $postId (@posts){
|
||||
my $post = WebGUI::Forum::Post->new($postId);
|
||||
push (@post_loop, getPostTemplateVars($post,$thread, $forum, $caller, {
|
||||
|
|
@ -1829,7 +1832,7 @@ sub www_postPreview {
|
|||
$newPost->{_properties}->{userId} = $session{user}{userId};
|
||||
$newPost->{_properties}->{username} = ($session{form}{visitorName} || $session{user}{alias});
|
||||
$newPost->{_properties}->{dateOfPost} = WebGUI::DateTime::time();
|
||||
|
||||
my $forum = WebGUI::Forum->new($forumId);
|
||||
|
||||
my $var = getPostTemplateVars($newPost, WebGUI::Forum::Thread->new($threadId), WebGUI::Forum->new($forumId), $caller);
|
||||
$var->{'newpost.header'} = WebGUI::International::get('Forum, Preview Heading');
|
||||
|
|
@ -1851,7 +1854,7 @@ sub www_postPreview {
|
|||
$var->{'form.begin'} .= WebGUI::Form::hidden({name=>'forumOp', value=>"postSave"});
|
||||
$var->{'form.submit'} = WebGUI::Form::submit();
|
||||
$var->{'form.end'} = WebGUI::Form::formFooter();
|
||||
return WebGUI::Template::process(1,"Forum/PostPreview", $var);
|
||||
return WebGUI::Template::process($forum->get("postPreviewTemplateId"),"Forum/PostPreview", $var);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -349,7 +349,8 @@ The name of the group you wish to instanciate.
|
|||
=cut
|
||||
|
||||
sub find {
|
||||
my ($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($_[1]));
|
||||
my $name = shift;
|
||||
my ($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($name));
|
||||
return WebGUI::Group->new($groupId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,9 @@ sub process {
|
|||
if ($@) {
|
||||
WebGUI::ErrorHandler::warn("Processing failed on macro: $macro: ".$@);
|
||||
} else {
|
||||
if ($result =~ /\Q$macro/) {
|
||||
$result = "Endless macro loop detected. Stopping recursion.";
|
||||
}
|
||||
$content =~ s/\Q$macro/$result/ges;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ sub process {
|
|||
my ($collateralIdent,$width,$height,$parameters) = WebGUI::Macro::getParams($_[0]);
|
||||
my ($collateral,$url);
|
||||
|
||||
if ($collateralIdent =~ /^\d+$/) {
|
||||
if ($collateralIdent =~ /[\w|\-]{22}/) {
|
||||
$collateral = WebGUI::Collateral->new($collateralIdent);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use strict;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Macro;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -28,7 +28,10 @@ sub process {
|
|||
}
|
||||
$temp = WebGUI::URL::append($session{env}{REQUEST_URI},$append);
|
||||
if ($param[1] ne "") {
|
||||
$temp = WebGUI::URL::append($temp,'styleId='.$param[1]);
|
||||
($styleId) = WebGUI::Template::getIdByName($param[1],"style");
|
||||
if ($styleId != 0) {
|
||||
$temp = WebGUI::URL::append($temp,'styleId='.$styleId);
|
||||
}
|
||||
}
|
||||
if ($param[0] ne "linkonly") {
|
||||
my %var;
|
||||
|
|
@ -38,11 +41,7 @@ sub process {
|
|||
} else {
|
||||
$var{'printable.text'} = WebGUI::International::get(53);
|
||||
}
|
||||
if ($param[2]) {
|
||||
$temp = WebGUI::Asset::Template->newByUrl($param[2])->process(\%var);
|
||||
} else {
|
||||
$temp = WebGUI::Asset::Template->new("PBtmpl0000000000000109")->process(\%var);
|
||||
}
|
||||
$temp = WebGUI::Template::process(WebGUI::Template::getIdByName($param[2],"Macro/r_printable"), "Macro/r_printable", \%var);
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ sub send {
|
|||
$message .= "BCC: $_[5]\n" if ($_[5]);
|
||||
$message .= "Subject: ".$_[1]."\n";
|
||||
$message .= "Date: ".WebGUI::DateTime::epochToHuman("","%W, %d %C %y %j:%n:%s %O")."\n";
|
||||
$message .= "Content-Type: text/plain; charset=UTF-8","charset")."\n";
|
||||
$message .= "\n";
|
||||
$message = WebGUI::Macro::process($message);
|
||||
#body
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ sub addEntry {
|
|||
unless ($url =~ /^http/ || !defined $url) {
|
||||
$url = WebGUI::URL::getSiteURL().$url;
|
||||
}
|
||||
unless ($url =~ /op=/ || !defined $url) {
|
||||
$url = WebGUI::URL::append($url, "op=viewMessageLogMessage");
|
||||
}
|
||||
$status = $_[5];
|
||||
$from = $_[6];
|
||||
if ($groupId ne "") {
|
||||
|
|
@ -189,6 +192,9 @@ sub addInternationalizedEntry {
|
|||
unless ($url =~ /^http/ || !defined $url) {
|
||||
$url = WebGUI::URL::getSiteURL().$url;
|
||||
}
|
||||
unless ($url =~ /op=/ || !defined $url) {
|
||||
$url = WebGUI::URL::append($url, "op=viewMessageLogMessage");
|
||||
}
|
||||
$internationalId = $_[3];
|
||||
$namespace = $_[4] || "WebGUI";
|
||||
$status = $_[5] || 'notice';
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ sub validateProfileData {
|
|||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
while (%field = $a->hash) {
|
||||
$data{$field{fieldName}} = WebGUI::Macro::negate(WebGUI::FormProcessor::process($field{fieldName},$field{dataType}));
|
||||
$data{$field{fieldName}} = WebGUI::Macro::negate(WebGUI::FormProcessor::process($field{fieldName},$field{dataType},""));
|
||||
if ($field{required} && $data{$field{fieldName}} eq "") {
|
||||
$error .= '<li>'.(eval $field{fieldLabel}).' '.WebGUI::International::get(451);
|
||||
}elsif($field{fieldName} eq "email" && isDuplicateEmail($data{$field{fieldName}})){
|
||||
|
|
@ -150,8 +150,13 @@ sub www_editProfile {
|
|||
$label = eval $data->{fieldLabel};
|
||||
$default = eval $data->{dataDefault};
|
||||
|
||||
if ($method eq "selectList") {
|
||||
$values = eval $data->{dataValues};
|
||||
if ($method eq "selectList" || $method eq "checkList" || $method eq "radioList") {
|
||||
$values = eval $data->{dataValues};
|
||||
my $orderedValues = {};
|
||||
tie %{$orderedValues}, 'Tie::IxHash';
|
||||
foreach my $ov (sort keys %{$values}) {
|
||||
$orderedValues->{$ov} = $values->{$ov};
|
||||
}
|
||||
# note: this big if statement doesn't look elegant, but doing regular ORs caused problems with the array reference.
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = [$session{form}{$data->{fieldName}}];
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ sub www_deleteProfileCategoryConfirm {
|
|||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() if ($session{form}{cid} < 1000 && $session{form}{cid} > 0);
|
||||
WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=".quote($session{form}{cid}));
|
||||
WebGUI::SQL->write("update userProfileField set profileCategoryId=1 where profileCategoryId=".quote($session{form}{cid}));
|
||||
WebGUI::SQL->write("update userProfileField set profileCategoryId='1' where profileCategoryId=".quote($session{form}{cid}));
|
||||
return www_editProfileSettings();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ sub www_viewStatistics {
|
|||
$version = '<a href="http://files.plainblack.com/downloads/'.$rev[0].'.x.x/webgui-'.$version.'.tar.gz">'.$version.'</a>';
|
||||
}
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(349).':</td><td class="tableData">'.$version.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId<>3");
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId<>'3'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(147).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId=0");
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId='0'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(795).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId=5");
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where parentId='5'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(794).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from wobject where pageId<>3");
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from wobject where pageId<>'3'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(148).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from template where namespace='style'");
|
||||
$output .= '<tr><td align="right" class="tableHeader">'.WebGUI::International::get(427).':</td><td class="tableData">'.$data.'</td></tr>';
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ Builds a hash of data from a series of rows.
|
|||
|
||||
=head3 sql
|
||||
|
||||
An SQL query. The query must select at least two columns of data, the first being the key for the hash, the second being the value. If the query selects more than two columns, then the last column will be the value and the remaining columns will be joined together by an underscore "_" to form a complex key.
|
||||
An SQL query. The query must select at least two columns of data, the first being the key for the hash, the second being the value. If the query selects more than two columns, then the last column will be the value and the remaining columns will be joined together by a colon ":" to form a complex key.
|
||||
|
||||
=head3 dbh
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ sub buildHash {
|
|||
$sth = WebGUI::SQL->read($_[1],$_[2]);
|
||||
while (@data = $sth->array) {
|
||||
my $value = pop @data;
|
||||
my $key = join("_",@data);
|
||||
my $key = join(":",@data);
|
||||
$hash{$key} = $value;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ use File::Copy qw(cp);
|
|||
use FileHandle;
|
||||
use File::Path;
|
||||
use POSIX;
|
||||
use Storable qw(nstore retrieve);
|
||||
use strict;
|
||||
use warnings;
|
||||
use WebGUI::ErrorHandler;
|
||||
|
|
@ -241,7 +242,8 @@ sub addFileFromHashref {
|
|||
my $self = shift;
|
||||
my $filename = WebGUI::URL::makeCompliant(shift);
|
||||
my $hashref = shift;
|
||||
store $hashref, $self->getPath($filename) or $self->_addError("Couldn't create file ".$self->getPath($filename)." because ".$!);
|
||||
bless $hashref;
|
||||
nstore $hashref, $self->getPath($filename) or $self->_addError("Couldn't create file ".$self->getPath($filename)." because ".$!);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -408,9 +408,9 @@ sub www_view {
|
|||
} elsif ($_[0]->get("endMonth") eq "after6") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,6,0);
|
||||
} elsif ($_[0]->get("endMonth") eq "after3") {
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,3,0);
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,3,0);
|
||||
} elsif ($_[0]->get("endMonth") eq "current") { # a hack that we need to get the default month to be end month. probably a better way to do it
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,1,0);
|
||||
$maxDate = WebGUI::DateTime::addToDate($minDate,0,1,0);
|
||||
}
|
||||
|
||||
$maxDate = $maxDate || WebGUI::DateTime::time();
|
||||
|
|
@ -434,32 +434,28 @@ sub www_view {
|
|||
# get event information
|
||||
my $query = "select * from EventsCalendar_event where ";
|
||||
$query .= " wobjectId=".quote($_[0]->get("wobjectId"))." and " unless ($_[0]->get("isMaster"));
|
||||
$query .= " (endDate>=$monthStart and endDate<=$monthEnd) and (startDate>=$monthStart and startDate<=$monthEnd) order by startDate,endDate";
|
||||
$query .= " ((endDate>=$monthStart and endDate<=$monthEnd) or (startDate>=$monthStart and startDate<=$monthEnd)) order by startDate,endDate";
|
||||
my %events;
|
||||
my %previous;
|
||||
my $sth = WebGUI::SQL->read($query,WebGUI::SQL->getSlave);
|
||||
while (my $event = $sth->hashRef) {
|
||||
my $eventLength = WebGUI::DateTime::getDaysInInterval($event->{startDate},$event->{endDate});
|
||||
my $startYear = epochToHuman($event->{startDate},"%y");
|
||||
my $startMonth = epochToHuman($event->{startDate},"%c");
|
||||
my $startDay = epochToHuman($event->{startDate},"%D");
|
||||
my $endYear = epochToHuman($event->{endDate},"%y");
|
||||
my $endMonth = epochToHuman($event->{endDate},"%c");
|
||||
my $endDay = epochToHuman($event->{endDate},"%D");
|
||||
my ($startYear, $startMonth, $startDay, $startDate, $startTime) = split " ", WebGUI::DateTime::epochToHuman($event->{startDate}, "%y %c %D %z %Z");
|
||||
my ($endYear, $endMonth, $endDay, $endDate, $endTime) = split " ", WebGUI::DateTime::epochToHuman($event->{endDate}, "%y %c %D %z %Z");
|
||||
for (my $i=0; $i<=$eventLength; $i++) {
|
||||
my @date = WebGUI::DateTime::epochToArray(WebGUI::DateTime::addToDate($event->{startDate},0,0,$i));
|
||||
if ($date[1] == $thisMonthDate[1]) {
|
||||
push(@{$events{$date[2]}}, {
|
||||
description=>$event->{description},
|
||||
name=>$event->{name},
|
||||
'start.date.human'=>WebGUI::DateTime::epochToHuman($event->{startDate},"%z"),
|
||||
'start.time.human'=>WebGUI::DateTime::epochToHuman($event->{startDate},"%Z"),
|
||||
'start.date.human'=>$startDate,
|
||||
'start.time.human'=>$startTime,
|
||||
'start.date.epoch'=>$event->{startDate},
|
||||
'start.year'=>$startYear,
|
||||
'start.month'=>$startMonth,
|
||||
'start.day'=>$startDay,
|
||||
'end.date.human'=>WebGUI::DateTime::epochToHuman($event->{endDate},"%z"),
|
||||
'end.time.human'=>WebGUI::DateTime::epochToHuman($event->{endDate},"%Z"),
|
||||
'end.date.human'=>$endDate,
|
||||
'end.time.human'=>$endTime,
|
||||
'end.date.epoch'=>$event->{endDate},
|
||||
'end.year'=>$endYear,
|
||||
'end.month'=>$endMonth,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue