Skip to content
GitLab
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
1c807f3f
Commit
1c807f3f
authored
Oct 20, 2010
by
Richard Mansfield
Browse files
Fix first access of secret url view (bug #661613)
Signed-off-by:
Richard Mansfield
<
richard.mansfield@catalyst.net.nz
>
parent
0d89a21c
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/mahara.php
View file @
1c807f3f
...
...
@@ -1718,17 +1718,17 @@ function get_view_from_token($token, $visible=true) {
);
if
(
$order
)
{
if
(
$token
!=
get_cookie
(
'caccess:'
.
$order
[
0
]
->
collection
))
{
set_cookie
(
'caccess:'
.
$order
[
0
]
->
collection
,
$token
);
set_cookie
(
'caccess:'
.
$order
[
0
]
->
collection
,
$token
,
0
,
true
);
}
return
$order
[
0
]
->
view
;
}
}
$viewid
=
$viewids
[
0
];
if
(
!
$visible
&&
$token
!=
get_cookie
(
'mviewaccess:'
.
$viewid
))
{
set_cookie
(
'mviewaccess:'
.
$viewid
,
$token
);
set_cookie
(
'mviewaccess:'
.
$viewid
,
$token
,
0
,
true
);
}
if
(
$visible
&&
$token
!=
get_cookie
(
'viewaccess:'
.
$viewid
))
{
set_cookie
(
'viewaccess:'
.
$viewid
,
$token
);
set_cookie
(
'viewaccess:'
.
$viewid
,
$token
,
0
,
true
);
}
return
$viewid
;
}
...
...
htdocs/lib/web.php
View file @
1c807f3f
...
...
@@ -1333,10 +1333,13 @@ function get_cookies($prefix) {
* @param int $expires The unix timestamp of the time the cookie should expire
* @todo path/domain/secure: should be set automatically by this function if possible (?)
*/
function
set_cookie
(
$name
,
$value
=
''
,
$expires
=
0
)
{
function
set_cookie
(
$name
,
$value
=
''
,
$expires
=
0
,
$access
=
false
)
{
$name
=
get_config
(
'cookieprefix'
)
.
$name
;
$url
=
parse_url
(
get_config
(
'wwwroot'
));
setcookie
(
$name
,
$value
,
$expires
,
$url
[
'path'
],
$url
[
'host'
],
false
);
if
(
$access
)
{
// View access cookies may be needed on this request
$_COOKIE
[
$name
]
=
$value
;
}
}
/**
...
...
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!
Cancel
Please
register
or
sign in
to comment