merging 5.4.3 changes
This commit is contained in:
parent
c1f4105699
commit
dc9a81080a
17 changed files with 106 additions and 51 deletions
|
|
@ -669,6 +669,7 @@ A hash reference containing the data you wish to persist to the filesystem.
|
|||
|
||||
sub saveFromHashref {
|
||||
my ($self, $hashref) = @_;
|
||||
$self->getNode->create();
|
||||
store $hashref, $self->getPath;
|
||||
return $self->getFilename;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,14 +112,17 @@ sub registrationFormSave {
|
|||
$ldap->bind;
|
||||
my $search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{'authLDAP.ldapId'});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = $search->entry(0)->get_value($session{setting}{ldapUserRDN});
|
||||
if ($session{setting}{ldapUserRDN} eq 'dn') {
|
||||
$connectDN = $search->entry(0)->dn;
|
||||
} else {
|
||||
$connectDN = $search->entry(0)->get_value($session{setting}{ldapUserRDN});
|
||||
}
|
||||
}
|
||||
$ldap->unbind;
|
||||
WebGUI::Authentication::saveParams($uid,'LDAP',
|
||||
{
|
||||
WebGUI::Authentication::saveParams($uid,'LDAP', {
|
||||
connectDN => $connectDN,
|
||||
ldapUrl => $session{setting}{ldapURL}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -130,7 +133,11 @@ sub registrationFormValidate {
|
|||
if ($ldap->bind) {
|
||||
$search = $ldap->search (base=>$uri->dn,filter=>$session{setting}{ldapId}."=".$session{form}{'authLDAP.ldapId'});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = $search->entry(0)->get_value($session{setting}{ldapUserRDN});
|
||||
if ($session{setting}{ldapUserRDN} eq 'dn') {
|
||||
$connectDN = $search->entry(0)->dn;
|
||||
} else {
|
||||
$connectDN = $search->entry(0)->get_value($session{setting}{ldapUserRDN});
|
||||
}
|
||||
$ldap->unbind;
|
||||
$ldap = Net::LDAP->new($uri->host, (port=>$uri->port)) or $error .= WebGUI::International::get(2,'Auth/LDAP');
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{'authLDAP.ldapPassword'});
|
||||
|
|
|
|||
|
|
@ -72,8 +72,10 @@ Delete's this collateral item.
|
|||
=cut
|
||||
|
||||
sub delete {
|
||||
$_[0]->deleteNode;
|
||||
WebGUI::SQL->write("delete from collateral where collateralId=".$_[0]->get("collateralId"));
|
||||
if ($_[0]->{_properties}->{collateralId} > 0) { # blocks deletion of all collateral in the event that no valid collateral id exists
|
||||
$_[0]->deleteNode;
|
||||
WebGUI::SQL->write("delete from collateral where collateralId=".$_[0]->get("collateralId"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ If specified the admin flag will be set to this value.
|
|||
=cut
|
||||
|
||||
sub userGroupAdmin {
|
||||
if ($_[2]) {
|
||||
if ($_[2] ne "") {
|
||||
WebGUI::SQL->write("update groupings set groupAdmin=$_[2] where groupId=$_[1] and userId=$_[0]");
|
||||
return $_[2];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -20,12 +20,11 @@ use WebGUI::SQL;
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my $collateralFolderId;
|
||||
my $collateralFolderId = 0;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
} else {
|
||||
$collateralFolderId = 0; #Root
|
||||
$collateralFolderId = 0 unless ($collateralFolderId);
|
||||
}
|
||||
my @images = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='image' and collateralFolderId=".$collateralFolderId);
|
||||
|
|
|
|||
|
|
@ -20,12 +20,11 @@ use WebGUI::SQL;
|
|||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = WebGUI::Macro::getParams($_[0]);
|
||||
my $collateralFolderId;
|
||||
my $collateralFolderId = 0;
|
||||
if ($param[0] ne "") {
|
||||
($collateralFolderId) = WebGUI::SQL->quickArray("select collateralFolderId from collateralFolder
|
||||
where name=".quote($param[0]));
|
||||
} else {
|
||||
$collateralFolderId = 0; #Root
|
||||
$collateralFolderId = 0 unless ($collateralFolderId);
|
||||
}
|
||||
my @snippets = WebGUI::SQL->buildArray("select collateralId from collateral
|
||||
where collateralType='snippet' and collateralFolderId=".$collateralFolderId);
|
||||
|
|
|
|||
|
|
@ -55,15 +55,18 @@ sub _submenu {
|
|||
$menu{WebGUI::URL::page('op=deleteCollateral&cid='.$session{form}{cid})} = WebGUI::International::get(765);
|
||||
}
|
||||
$menu{WebGUI::URL::page('op=editCollateralFolder')} = WebGUI::International::get(759);
|
||||
$menu{WebGUI::URL::page('op=emptyCollateralFolder')} = WebGUI::International::get(980);
|
||||
$menu{WebGUI::URL::page('op=deleteCollateralFolder')} = WebGUI::International::get(760);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$menu{WebGUI::URL::page('op=emptyCollateralFolder')} = WebGUI::International::get(980);
|
||||
$menu{WebGUI::URL::page('op=deleteCollateralFolder')} = WebGUI::International::get(760);
|
||||
}
|
||||
$menu{WebGUI::URL::page('op=listCollateral')} = WebGUI::International::get(766);
|
||||
return menuWrapper($_[0],\%menu);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateral {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
my $collateral = WebGUI::Collateral->new($session{form}{cid});
|
||||
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Privilege::isInGroup(3));
|
||||
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(774).'<p/><div align="center">';
|
||||
$output .= '<a href="'.WebGUI::URL::page('op=deleteCollateralConfirm&cid='.$session{form}{cid}).'">'
|
||||
|
|
@ -76,16 +79,25 @@ sub www_deleteCollateral {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateralConfirm {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
my $collateral = WebGUI::Collateral->new($session{form}{cid});
|
||||
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Privilege::isInGroup(3));
|
||||
$collateral->delete;
|
||||
WebGUI::Session::deleteScratch("collateralPageNumber");
|
||||
return www_listCollateral();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateralFile {
|
||||
my $collateral = WebGUI::Collateral->new($session{form}{cid});
|
||||
return WebGUI::Privilege::insufficient unless ($collateral->get("userId") == $session{user}{userId} || WebGUI::Privilege::isInGroup(3));
|
||||
my $collateral = WebGUI::Collateral->new($session{form}{cid});
|
||||
$collateral->deleteFile;
|
||||
return www_editCollateral($collateral);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateralFolder {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
|
||||
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(775).'<p/><div align="center">';
|
||||
|
|
@ -99,7 +111,7 @@ sub www_deleteCollateralFolder {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateralFolderConfirm {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
|
||||
my $folders = WebGUI::CollateralFolder->getTree({-minimumFields => 1});
|
||||
if (my $deadFolder = $folders->{$session{scratch}{collateralFolderId}}) {
|
||||
|
|
@ -112,7 +124,7 @@ sub www_deleteCollateralFolderConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_emptyCollateralFolder {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
|
||||
my $output = '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(979).'<p/><div align="center">';
|
||||
|
|
@ -126,21 +138,13 @@ sub www_emptyCollateralFolder {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_emptyCollateralFolderConfirm {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(3));
|
||||
return WebGUI::Privilege::vitalComponent() unless ($session{scratch}{collateralFolderId} > 999);
|
||||
my @collateralIds = WebGUI::SQL->buildArray("select collateralId from collateral where collateralFolderId=".$session{scratch}{collateralFolderId});
|
||||
WebGUI::Collateral->multiDelete(@collateralIds);
|
||||
return www_listCollateral();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteCollateralFile {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
my $collateral = WebGUI::Collateral->new($session{form}{cid});
|
||||
$collateral->deleteFile;
|
||||
return www_editCollateral($collateral);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editCollateral {
|
||||
return WebGUI::Privilege::insufficient unless (WebGUI::Privilege::isInGroup(4));
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ sub www_editGrouping {
|
|||
sub www_editGroupingSave {
|
||||
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
|
||||
WebGUI::Grouping::userGroupExpireDate($session{form}{uid},$session{form}{gid},setToEpoch($session{form}{expireDate}));
|
||||
WebGUI::Grouping::userGroupAdmin($session{form}{uid},$session{form}{gid},setToEpoch($session{form}{groupAdmin}));
|
||||
WebGUI::Grouping::userGroupAdmin($session{form}{uid},$session{form}{gid},$session{form}{groupAdmin});
|
||||
return www_editUserGroup();
|
||||
}
|
||||
|
||||
|
|
@ -429,7 +429,7 @@ sub www_editUserProfile {
|
|||
} elsif ($method) {
|
||||
if ($session{form}{$data{fieldName}}) {
|
||||
$default = $session{form}{$data{fieldName}};
|
||||
} elsif (exists $session{user}{$data{fieldName}}) {
|
||||
} elsif (exists $user{$data{fieldName}}) {
|
||||
$default = $user{$data{fieldName}};
|
||||
} else {
|
||||
$default = eval $data{dataDefault};
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ The unique identifier for the wobject that you wish to check the privileges on.
|
|||
sub canEditWobject {
|
||||
my (%wobject);
|
||||
tie %wobject, 'Tie::CPHash';
|
||||
return canEditPage() unless ($session{setting}{wobjectPrivileges} == 1);
|
||||
return canEditPage() if ($session{setting}{wobjectPrivileges} != 1 || $_[0] eq "new");
|
||||
%wobject = WebGUI::SQL->quickHash("select ownerId,groupIdEdit from wobject where wobjectId=".quote($_[0]));
|
||||
if ($session{user}{userId} == $wobject{ownerId}) {
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ use strict;
|
|||
use Tie::CPHash;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::URL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ These subroutines are available from this package:
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub _getSiteURL {
|
||||
my $site = $session{env}{HTTP_HOST} || $session{config}{sitename};
|
||||
my $site = $WebGUI::Session::session{env}{HTTP_HOST} || $WebGUI::Session::session{config}{sitename};
|
||||
my $proto = "http://";
|
||||
if ($session{env}{SERVER_PORT} == 443) {
|
||||
if ($WebGUI::Session::session{env}{SERVER_PORT} == 443) {
|
||||
$proto = "https://";
|
||||
}
|
||||
return $proto.$site;
|
||||
|
|
@ -137,11 +137,11 @@ Name value pairs to add to the URL in the form of:
|
|||
=cut
|
||||
|
||||
sub gateway {
|
||||
my $url = _getSiteURL().$session{config}{scripturl}.'/'.$_[0];
|
||||
my $url = _getSiteURL().$WebGUI::Session::session{config}{scripturl}.'/'.$_[0];
|
||||
if ($_[1]) {
|
||||
$url = append($url,$_[1]);
|
||||
}
|
||||
if ($session{setting}{preventProxyCache} == 1) {
|
||||
if ($WebGUI::Session::session{setting}{preventProxyCache} == 1) {
|
||||
$url = append($url,"noCache=".randint(0,1000).';'.time());
|
||||
}
|
||||
return $url;
|
||||
|
|
@ -195,11 +195,11 @@ Name value pairs to add to the URL in the form of:
|
|||
=cut
|
||||
|
||||
sub page {
|
||||
my $url = _getSiteURL().$session{page}{url};
|
||||
my $url = _getSiteURL().$WebGUI::Session::session{page}{url};
|
||||
if ($_[0]) {
|
||||
$url = append($url,$_[0]);
|
||||
}
|
||||
if ($session{setting}{preventProxyCache} == 1) {
|
||||
if ($WebGUI::Session::session{setting}{preventProxyCache} == 1) {
|
||||
$url = append($url,"noCache=".randint(0,1000).';'.time());
|
||||
}
|
||||
return $url;
|
||||
|
|
|
|||
|
|
@ -191,10 +191,14 @@ sub www_view {
|
|||
$var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId"));
|
||||
$var{"post.label"} = WebGUI::International::get(24,$_[0]->get("namespace"));
|
||||
}
|
||||
my $templateId = $_[0]->getValue("templateId");
|
||||
if ($session{form}{func} eq "editSave") {
|
||||
$templateId = $_[0]->get("templateId");
|
||||
}
|
||||
if ($session{form}{forumOp}) {
|
||||
return WebGUI::Forum::Web::forumOp(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")));
|
||||
} else {
|
||||
return $_[0]->processTemplate($_[0]->getValue("templateId"),\%var).WebGUI::Forum::Web::viewForum(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),1);
|
||||
return $_[0]->processTemplate($templateId,\%var).WebGUI::Forum::Web::viewForum(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,11 +197,12 @@ sub getRecordTemplateVars {
|
|||
my $sth = WebGUI::SQL->read("$select from DataForm_field as a $join $where order by a.sequenceNumber");
|
||||
while (%data = $sth->hash) {
|
||||
my $formValue = $session{form}{$data{name}};
|
||||
if (defined $formValue) {
|
||||
$data{value} = $formValue;
|
||||
} elsif (not exists $data{value}) {
|
||||
$data{value} = WebGUI::Macro::process($data{defaultValue});
|
||||
}
|
||||
if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) {
|
||||
$data{value} = $formValue;
|
||||
}
|
||||
if (not exists $data{value}) {
|
||||
$data{value} = WebGUI::Macro::process($data{defaultValue});
|
||||
}
|
||||
my $hidden = (($data{status} eq "hidden" || ($data{isMailField} && !$self->get("mailData"))) && !$session{var}{adminOn});
|
||||
push(@fields,{
|
||||
"field.form" => _createField(\%data),
|
||||
|
|
@ -389,7 +390,7 @@ sub www_editSave {
|
|||
label=>WebGUI::International::get(10,$_[0]->get("namespace")),
|
||||
status=>"editable",
|
||||
isMailField=>1,
|
||||
width=>45,
|
||||
width=>0,
|
||||
type=>"email"
|
||||
});
|
||||
$_[0]->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
|
|
@ -398,7 +399,7 @@ sub www_editSave {
|
|||
label=>WebGUI::International::get(11,$_[0]->get("namespace")),
|
||||
status=>"hidden",
|
||||
isMailField=>1,
|
||||
width=>45,
|
||||
width=>0,
|
||||
type=>"email",
|
||||
defaultValue=>$session{setting}{companyEmail}
|
||||
});
|
||||
|
|
@ -408,7 +409,7 @@ sub www_editSave {
|
|||
label=>WebGUI::International::get(12,$_[0]->get("namespace")),
|
||||
status=>"hidden",
|
||||
isMailField=>1,
|
||||
width=>45,
|
||||
width=>0,
|
||||
type=>"email"
|
||||
});
|
||||
$_[0]->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
|
|
@ -417,7 +418,7 @@ sub www_editSave {
|
|||
label=>WebGUI::International::get(13,$_[0]->get("namespace")),
|
||||
status=>"hidden",
|
||||
isMailField=>1,
|
||||
width=>45,
|
||||
width=>0,
|
||||
type=>"email"
|
||||
});
|
||||
$_[0]->setCollateral("DataForm_field","DataForm_fieldId",{
|
||||
|
|
@ -426,7 +427,7 @@ sub www_editSave {
|
|||
label=>WebGUI::International::get(14,$_[0]->get("namespace")),
|
||||
status=>"editable",
|
||||
isMailField=>1,
|
||||
width=>45,
|
||||
width=>0,
|
||||
type=>"text",
|
||||
defaultValue=>WebGUI::International::get(2,$_[0]->get("namespace"))
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue