Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
e77ef6d0
Commit
e77ef6d0
authored
6 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
fix(DateAttribute) Do not alter LDAP value if we cannot parse it
issue #5908
parent
be783fc2
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/simpleplugin/attributes/class_DateAttribute.inc
+5
-15
include/simpleplugin/attributes/class_DateAttribute.inc
with
5 additions
and
15 deletions
+5
-15
include/simpleplugin/attributes/class_DateAttribute.inc
+
5
−
15
View file @
e77ef6d0
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2012-201
6
FusionDirectory
Copyright (C) 2012-201
8
FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -73,11 +73,7 @@ class DateAttribute extends Attribute
try
{
return
$this
->
getDateValue
()
->
format
(
'd.m.Y'
);
}
catch
(
Exception
$e
)
{
if
(
$this
->
isTemplate
()
&&
preg_match
(
'/%/'
,
$this
->
value
))
{
return
$this
->
value
;
}
else
{
return
''
;
}
return
$this
->
value
;
}
}
}
...
...
@@ -88,8 +84,7 @@ class DateAttribute extends Attribute
if
(
$date
!==
FALSE
)
{
return
$date
;
}
else
{
trigger_error
(
'LDAP value for '
.
$this
->
getLdapName
()
.
' was not in the right date format.'
);
return
new
DateTime
(
$ldapValue
,
new
DateTimeZone
(
'UTC'
));
return
$ldapValue
;
}
}
...
...
@@ -115,11 +110,7 @@ class DateAttribute extends Attribute
try
{
$this
->
setValue
(
$this
->
getDateValue
());
}
catch
(
Exception
$e
)
{
if
(
$this
->
isTemplate
()
&&
preg_match
(
'/%/'
,
$this
->
value
))
{
return
$this
->
value
;
}
else
{
throw
$e
;
}
return
$this
->
value
;
}
}
return
$this
->
dateToLdap
(
$this
->
value
);
...
...
@@ -194,8 +185,7 @@ class GeneralizedTimeDateAttribute extends DateAttribute
try
{
return
LdapGeneralizedTime
::
fromString
(
$ldapValue
);
}
catch
(
LdapGeneralizedTimeBadFormatException
$e
)
{
trigger_error
(
'LDAP value "'
.
$ldapValue
.
'" for '
.
$this
->
getLdapName
()
.
' is not in the right date format.'
);
return
new
DateTime
(
$ldapValue
,
timezone
::
utc
());
return
$ldapValue
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets