Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redirect-handler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
IML Open Source
redirect-handler
Commits
8d9f54b8
Commit
8d9f54b8
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
update admin
parent
0726b442
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
public_html/admin/index.php
+6
-4
6 additions, 4 deletions
public_html/admin/index.php
public_html/admin/main.css
+7
-5
7 additions, 5 deletions
public_html/admin/main.css
public_html/classes/redirect.admin.class.php
+2
-6
2 additions, 6 deletions
public_html/classes/redirect.admin.class.php
with
15 additions
and
15 deletions
public_html/admin/index.php
+
6
−
4
View file @
8d9f54b8
...
...
@@ -12,6 +12,7 @@
* admin: list all defined redirections
* ----------------------------------------------------------------------
* 2022-02-03 v0.1 <axel.hahn@iml.unibe.ch> initial version
* 2022-05-21 v0.2 <axel.hahn@iml.unibe.ch> optical changes; use debugredirect=1 if url is a local domain
* ----------------------------------------------------------------------
*/
...
...
@@ -61,7 +62,7 @@ if (!$oR->isEnabled()){
$sUrl
=
(
isset
(
$_GET
[
'url'
])
&&
$_GET
[
'url'
])
?
$_GET
[
'url'
]
:
''
;
if
(
$sUrl
){
$sResult
=
$oR
->
httpGet
(
$sUrl
.
'?debugredirect=1'
,
1
);
$sResult
=
$oR
->
httpGet
(
$sUrl
,
1
);
echo
'<h2>Response of a http HEAD request to '
.
$aIco
[
'url'
]
.
' <a href="'
.
$sUrl
.
'">'
.
$sUrl
.
'</a></h2>'
.
$oR
->
renderHttpResponseHeader
(
$sResult
,
1
)
;
...
...
@@ -80,7 +81,6 @@ if (!$oR->isEnabled()){
exit
(
0
);
}
$sMyIp
=
gethostbyname
(
$_SERVER
[
'SERVER_NAME'
]);
if
(
!
$sMyIp
){
$sErrors
.
=
'<li>Ip address of current host ['
.
$_SERVER
[
'SERVER_NAME'
]
.
'] was not found.</li>'
;
...
...
@@ -130,7 +130,9 @@ if (!$oR->isEnabled()){
.
'<td>'
.
'<span style="display: none">'
.
$sHost
.
'</span>'
.
$aIco
[
'type_'
.
$aCfg
[
'type'
]]
.
' <a href="?url=http://'
.
$sHost
.
'/" title="click to test http://'
.
$sHost
.
'/" onclick="showInOverlay(this); return false;">'
.
$sHost
.
'</a></td>'
.
' <a href="?url=http://'
.
$sHost
.
'/'
.
(
$aCfg
[
'ip'
]
===
$sMyIp
?
'?debugredirect=1'
:
''
)
.
'" title="click to test http://'
.
$sHost
.
'/" onclick="showInOverlay(this); return false;">'
.
$sHost
.
'</a></td>'
.
'<td>'
.
(
$aCfg
[
'ip'
]
?
(
$aCfg
[
'ip'
]
===
$sMyIp
...
...
@@ -142,7 +144,7 @@ if (!$oR->isEnabled()){
.
'<td>'
.
(
$aCfg
[
'type'
]
==
"config"
?
'<a href="?cfgfile=redirects_'
.
$sHost
.
'.json" onclick="showInOverlay(this); return false;" title="show config for host '
.
$sHost
.
'">'
.
$aCfg
[
'type'
]
.
'</a> '
:
$aCfg
[
'type'
]
:
'<a href="?cfgfile=redirects_'
.
$aCfg
[
'target'
]
.
'.json" onclick="showInOverlay(this); return false;" title="show config for alias '
.
$sHost
.
' pointing to host '
.
$aCfg
[
'target'
]
.
'">'
.
$aCfg
[
'type'
]
.
'</a> '
)
.
'</td>'
;
...
...
This diff is collapsed.
Click to expand it.
public_html/admin/main.css
+
7
−
5
View file @
8d9f54b8
...
...
@@ -2,14 +2,15 @@ a{color:royalblue;}
body
{
background
:
#f8f8f8
;
color
:
#234
;
font-family
:
arial
;
margin
:
0
;}
h1
{
background
:
rgba
(
0
,
0
,
0
,
0.05
);
margin
:
0
0
1em
;
;
padding
:
0.5em
;}
h1
a
{
color
:
#234
;
text-decoration
:
none
;}
h2
{
background
:
rgba
(
0
,
0
,
0
,
0.02
)
;
color
:
#458
;
margin
:
1em
0
0.5em
;
border-top
:
2px
solid
#fff
;
border-left
:
5px
solid
#fff
;
border-top-left-radius
:
0.5em
;
padding
:
0.5em
;
}
h2
{
background
:
#d0e0e8
;
color
:
#458
;
margin
:
1em
0
0.5em
;
border-top
:
2px
solid
#fff
;
border-left
:
5px
solid
#fff
;
border-top-left-radius
:
0.5em
;
padding
:
0.5em
;
}
pre
{
background
:
rgba
(
0
,
0
,
0
,
0.02
);
padding
:
0.3em
1em
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.1
);
margin
-bottom
:
2em
;}
pre
{
background
:
rgba
(
0
,
0
,
0
,
0.02
);
padding
:
0.3em
1em
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.1
);
margin
:
2em
0
3em
;
;
border-bottom
:
2px
solid
rgba
(
0
,
0
,
0
,
0.2
)
;}
tr
:hover
{
background
:
#f4f0f8
!important
;}
.content
{
margin
:
0
1em
;}
.error
{
background
:
#fcc
;}
.warning
{
color
:
#651
;
background
:
#fec
;}
.cfgtype-alias
{
color
:
#89a
;}
.http-301
::after
{
color
:
#a55
;
content
:
' (Moved Permanently)'
}
...
...
@@ -18,14 +19,15 @@ tr:hover{background: #f4f0f8 !important;}
.type-direct
{
color
:
#383
;
}
.type-regex
{
color
:
#838
;
}
.status
{
padding
:
0.5em
1em
;
position
:
relative
;
top
:
-0.8em
;
border
:
2px
solid
;
border-left
:
1.5em
solid
;}
.status
{
padding
:
0.5em
1em
;
position
:
relative
;
top
:
-0.8em
;
border
-left
:
2px
solid
;
border-left
_
:
1.5em
solid
;
font-size
:
125%
;
}
.status-ok
{
color
:
#080
;
background
:
#cec
;
}
.status-redirect
{
color
:
#651
;
background
:
#fec
;}
.status-error
{
color
:
#800
;
background
:
#ecc
;}
.location
{
background
:
#fec
;}
.location
{
background
:
#cde
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.2
);
font-size
:
125%
;
color
:
#236
;}
.location
::before
{
content
:
' > '
;
color
:
#800
;
background-color
:
#fff
;}
.debug
{
color
:
#197
;}
.overlay
{
position
:
fixed
;
margin
:
0
;
width
:
100%
;
height
:
100%
;
top
:
0
;
left
:
0
;
background
:
rgba
(
0
,
0
,
0
,
0.3
);
overflow
:
scroll
;
display
:
none
;}
.overlay
>
div
{
margin
:
3%
10%
;
background
:
#f
ff
;
padding
:
1em
;
box-shadow
:
0
0
3em
#000
;
}
.overlay
>
div
{
margin
:
3%
10%
;
background
:
#f
8f8f8
;
padding
:
1em
;
box-shadow
:
0
0
3em
#000
;
}
This diff is collapsed.
Click to expand it.
public_html/classes/redirect.admin.class.php
+
2
−
6
View file @
8d9f54b8
...
...
@@ -16,6 +16,7 @@ require_once 'redirect.class.php';
* 2020-05-11 v1.4 ah rewrite as class
* 2022-02-03 v1.5 ah add method isEnabled
* 2022-05-23 v1.6 ah add http head check+render output;
* 2022-05-31 v1.7 ah optical changes
*/
/**
...
...
@@ -31,7 +32,6 @@ class redirectadmin extends redirect {
CURLOPT_FOLLOWLOCATION
=>
true
,
CURLOPT_RETURNTRANSFER
=>
true
,
CURLOPT_USERAGENT
=>
strip_tags
(
$this
->
sAbout
),
// CURLOPT_USERPWD => isset($this->aProfileEffective['userpwd']) ? $this->aProfileEffective['userpwd'] : false,
CURLOPT_VERBOSE
=>
false
,
CURLOPT_ENCODING
=>
'gzip, deflate'
,
// to fetch encoding
CURLOPT_HTTPHEADER
=>
array
(
...
...
@@ -43,10 +43,6 @@ class redirectadmin extends redirect {
// TODO: this is unsafe .. better: let the user configure it
CURLOPT_SSL_VERIFYHOST
=>
false
,
CURLOPT_SSL_VERIFYPEER
=>
false
,
// CURLOPT_SSL_VERIFYSTATUS => false,
// v0.22 cookies
CURLOPT_COOKIEJAR
=>
$this
->
sCcookieFilename
,
CURLOPT_COOKIEFILE
=>
$this
->
sCcookieFilename
,
CURLOPT_TIMEOUT
=>
5
,
);
return
$aReturn
;
...
...
@@ -102,7 +98,7 @@ class redirectadmin extends redirect {
$sReturn
=
(
$iHops
>
0
?
'Found hops: <strong>'
.
$iHops
.
'</strong>'
.
(
$iHops
>
1
?
' ⚠️ Verify your redirect to skip unneeded hops.'
:
''
)
.
'<br><br>'
.
(
$iHops
>
1
?
'
<span class="warning">
⚠️ Verify your redirect to skip unneeded hops.
</span>
'
:
''
)
.
'<br><br>'
:
''
)
.
$sReturn
;
...
...
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