Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
3d2946e3
Commit
3d2946e3
authored
Jul 13, 2009
by
Richard Mansfield
Browse files
More checking on view access date formatting (bug 3072)
parent
9e74277a
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lang/en.utf8/view.php
View file @
3d2946e3
...
...
@@ -41,6 +41,7 @@ $string['description'] = 'View Description';
$string
[
'startdate'
]
=
'Access Start Date/Time'
;
$string
[
'stopdate'
]
=
'Access End Date/Time'
;
$string
[
'startdatemustbebeforestopdate'
]
=
'The start date must be before the stop date'
;
$string
[
'unrecogniseddateformat'
]
=
'Unrecognised date format'
;
$string
[
'ownerformat'
]
=
'Name display format'
;
$string
[
'ownerformatdescription'
]
=
'How do you want people who look at your View to see your name?'
;
$string
[
'profileviewtitle'
]
=
'Profile view'
;
...
...
htdocs/view/access.php
View file @
3d2946e3
...
...
@@ -243,13 +243,21 @@ function editaccess_validate(Pieform $form, $values) {
}
$loggedinaccess
=
false
;
if
(
$values
[
'accesslist'
])
{
foreach
(
$values
[
'accesslist'
]
as
$item
)
{
foreach
(
$values
[
'accesslist'
]
as
&
$item
)
{
if
(
!
isset
(
$item
[
'startdate'
]))
{
$item
[
'startdate'
]
=
null
;
}
else
if
(
!
$item
[
'startdate'
]
=
strtotime
(
$item
[
'startdate'
]))
{
$form
->
set_error
(
'accesslist'
,
get_string
(
'unrecogniseddateformat'
,
'view'
));
break
;
}
if
(
!
isset
(
$item
[
'stopdate'
]))
{
$item
[
'stopdate'
]
=
null
;
}
else
if
(
!
$item
[
'stopdate'
]
=
strtotime
(
$item
[
'stopdate'
]))
{
$form
->
set_error
(
'accesslist'
,
get_string
(
'invaliddate'
,
'view'
));
break
;
}
if
(
$item
[
'type'
]
==
'loggedin'
&&
!
$item
[
'startdate'
]
&&
!
$item
[
'stopdate'
])
{
$loggedinaccess
=
true
;
}
...
...
@@ -287,6 +295,16 @@ function editaccess_submit(Pieform $form, $values) {
redirect
(
'/view/blocks.php?id='
.
$view
->
get
(
'id'
)
.
'&new='
.
$new
);
}
if
(
$values
[
'accesslist'
])
{
foreach
(
$values
[
'accesslist'
]
as
&
$item
)
{
if
(
isset
(
$item
[
'startdate'
]))
{
$item
[
'startdate'
]
=
strtotime
(
$item
[
'startdate'
]);
}
if
(
isset
(
$item
[
'stopdate'
]))
{
$item
[
'stopdate'
]
=
strtotime
(
$item
[
'stopdate'
]);
}
}
}
$view
->
set_access
(
$values
[
'accesslist'
]);
$view
->
set
(
'startdate'
,
$values
[
'startdate'
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment