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
d44064c4
Commit
d44064c4
authored
Jan 21, 2007
by
Nigel McNie
Committed by
Nigel McNie
Jan 21, 2007
Browse files
Fix queries to not get empty rowsets when there's no results. Rather,
just get nothing. Prevents random accesslist items being inserted
parent
bc6df40f
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/view/editaccess.php
View file @
d44064c4
...
...
@@ -40,16 +40,19 @@ $smarty = smarty(array('tablerenderer'), pieform_element_calendar_get_headdata(p
$viewid
=
param_integer
(
'viewid'
);
$prefix
=
get_config
(
'dbprefix'
);
if
(
!
$data
=
get_records_sql_array
(
'SELECT va.accesstype AS type, va.startdate, va.stopdate
FROM '
.
$prefix
.
'view v
LEFT JOIN '
.
$prefix
.
'view_access va ON (va.view = v.id)
if
(
!
get_field
(
'view'
,
'COUNT(*)'
,
'id'
,
$viewid
,
'owner'
,
$USER
->
get
(
'id'
)))
{
$SESSION
->
add_error_msg
(
get_string
(
'canteditdontown'
,
'view'
));
redirect
(
'view/'
);
}
$data
=
get_records_sql_array
(
'SELECT va.accesstype AS type, va.startdate, va.stopdate
FROM '
.
$prefix
.
'view_access va
LEFT JOIN '
.
$prefix
.
'view v ON (va.view = v.id)
WHERE v.id = ?
AND v.owner = ?
ORDER BY va.accesstype'
,
array
(
$viewid
,
$USER
->
get
(
'id'
)))
)
{
$SESSION
->
add_error_msg
(
get_string
(
'canteditdontown'
,
'view'
));
redirect
(
get_config
(
'wwwroot'
)
.
'view/'
);
ORDER BY va.accesstype'
,
array
(
$viewid
,
$USER
->
get
(
'id'
)))
;
if
(
!
$data
)
{
$data
=
array
(
);
}
foreach
(
$data
as
&
$item
)
{
$item
=
(
array
)
$item
;
}
...
...
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