Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
987845c3
Commit
987845c3
authored
13 years ago
by
Bart Visscher
Browse files
Options
Downloads
Patches
Plain Diff
Move the redirect_url from linkTo function to the checkLoggedIn function
parent
21f8d099
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/helper.php
+4
-10
4 additions, 10 deletions
lib/helper.php
lib/util.php
+4
-3
4 additions, 3 deletions
lib/util.php
with
8 additions
and
13 deletions
lib/helper.php
+
4
−
10
View file @
987845c3
...
...
@@ -29,12 +29,11 @@ class OC_Helper {
* @brief Creates an url
* @param $app app
* @param $file file
* @param $redirect_url redirect_url variable is appended to the URL
* @returns the url
*
* Returns a url to the given app and file.
*/
public
static
function
linkTo
(
$app
,
$file
,
$redirect_url
=
NULL
,
$absolute
=
false
){
public
static
function
linkTo
(
$app
,
$file
){
if
(
$app
!=
''
){
$app
.
=
'/'
;
// Check if the app is in the app folder
...
...
@@ -54,24 +53,19 @@ class OC_Helper {
}
}
if
(
$redirect_url
)
return
$urlLinkTo
.
'?redirect_url='
.
urlencode
(
$_SERVER
[
"REQUEST_URI"
]);
else
return
$urlLinkTo
;
return
$urlLinkTo
;
}
/**
* @brief Creates an absolute url
* @param $app app
* @param $file file
* @param $redirect_url redirect_url variable is appended to the URL
* @returns the url
*
* Returns a absolute url to the given app and file.
*/
public
static
function
linkToAbsolute
(
$app
,
$file
,
$redirect_url
=
NULL
)
{
$urlLinkTo
=
self
::
linkTo
(
$app
,
$file
,
$redirect_url
);
public
static
function
linkToAbsolute
(
$app
,
$file
)
{
$urlLinkTo
=
self
::
linkTo
(
$app
,
$file
);
// Checking if the request was made through HTTPS. The last in line is for IIS
$protocol
=
isset
(
$_SERVER
[
'HTTPS'
])
&&
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
(
$_SERVER
[
'HTTPS'
]
!=
'off'
);
$urlLinkTo
=
(
$protocol
?
'https'
:
'http'
)
.
'://'
.
$_SERVER
[
'HTTP_HOST'
]
.
$urlLinkTo
;
...
...
This diff is collapsed.
Click to expand it.
lib/util.php
+
4
−
3
View file @
987845c3
...
...
@@ -240,7 +240,7 @@ class OC_Util {
/**
* Check if the app is enabled,
send json error msg
if not
* Check if the app is enabled,
redirects to home
if not
*/
public
static
function
checkAppEnabled
(
$app
){
if
(
!
OC_App
::
isEnabled
(
$app
)){
...
...
@@ -250,12 +250,13 @@ class OC_Util {
}
/**
* Check if the user is logged in, redirects to home if not
* Check if the user is logged in, redirects to home if not. With
* redirect URL parameter to the request URI.
*/
public
static
function
checkLoggedIn
(){
// Check if we are a user
if
(
!
OC_User
::
isLoggedIn
()){
header
(
'Location: '
.
OC_Helper
::
linkToAbsolute
(
''
,
'index.php'
,
TRUE
));
header
(
'Location: '
.
OC_Helper
::
linkToAbsolute
(
''
,
'index.php'
)
.
'?redirect_url='
.
urlencode
(
$_SERVER
[
"REQUEST_URI"
]
));
exit
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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