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
2b8e01a1
Commit
2b8e01a1
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
admin: show a welcome message after install
parent
b70c0d24
No related branches found
No related tags found
1 merge request
!2
fix loop over config with missing regex section.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public_html/admin/index.php
+67
-46
67 additions, 46 deletions
public_html/admin/index.php
public_html/admin/main.css
+1
-0
1 addition, 0 deletions
public_html/admin/main.css
with
68 additions
and
46 deletions
public_html/admin/index.php
+
67
−
46
View file @
2b8e01a1
...
...
@@ -13,6 +13,7 @@
* ----------------------------------------------------------------------
* 2022-02-03 v0.1 <axel.hahn@iml.unibe.ch> initial version
* 2022-05-31 v0.2 <axel.hahn@iml.unibe.ch> optical changes; use debugredirect=1 if url is a local domain
* 2023-08-28 v1.0 <axel.hahn@unibe.ch> Welcome message if there is no config yet
* ----------------------------------------------------------------------
*/
...
...
@@ -37,6 +38,7 @@ $aIco=[
'type_alias'
=>
'◻️'
,
'url'
=>
'🌐'
,
'welcome'
=>
'🪄'
,
];
// ----------------------------------------------------------------------
...
...
@@ -99,32 +101,7 @@ if (!$oR->isEnabled()){
// ---------- LOOP OVER ALL ENTRIES
$sHtml
.
=
'
<!--
<h2>'
.
$aIco
[
'h2_head'
]
.
' Http head tester</h2>
<div class="content">
<form>
'
.
$aIco
[
'url'
]
.
' <input type="text" name="url" size="100" value="'
.
$sUrl
.
'" placeholder="Enter url or click a link in the table below."/>
<button>Http HEAD</button>
</form>
</div>
<br>
-->
<h2>'
.
$aIco
[
'h2_config'
]
.
' Domains and their redirects</h2>
<div class="content">
<table class="mydatatable"><thead>
<tr>
<th>Host</th>
<th>Ip address</th>
<th>Setup</th>
<th>Type</th>
<th>From</th>
<th>Code</th>
<th>Target</th>
</tr>
</thead><tbody>'
;
$sTable
=
''
;
foreach
(
$aHosts
as
$sHost
=>
$aCfg
){
$sTdFirst
=
'<tr class="cfgtype-'
.
$aCfg
[
'type'
]
.
'">'
.
'<td>'
...
...
@@ -159,7 +136,7 @@ if (!$oR->isEnabled()){
if
(
count
(
$aCfg
[
'redirects'
][
$sType
])){
foreach
(
$aCfg
[
'redirects'
][
$sType
]
as
$sFrom
=>
$aTo
){
$iCount
++
;
$s
Html
.
=
$sTdFirst
$s
Table
.
=
$sTdFirst
.
'<td class="type-'
.
$sType
.
'">'
.
$sType
.
'</td>'
.
'<td class="type-'
.
$sType
.
'">'
.
(
$sType
==
'direct'
...
...
@@ -177,29 +154,26 @@ if (!$oR->isEnabled()){
}
else
{
// type = alias
// $sHtml.='<tr>'.$sTdFirst.'<td></td><td></td><td></td><td>'.(isset($aCfg['target']) ? 'see config for <a href="#'.getId($aCfg['target']).'">'.$aCfg['target'].'</a>' : '').'</td></tr>';
$s
Html
.
=
$sTdFirst
.
'<td></td><td></td><td></td><td>'
.
(
isset
(
$aCfg
[
'target'
])
?
'see config for <em>'
.
$aCfg
[
'target'
]
.
'</em>'
:
''
)
.
'</td></tr>'
;
$s
Table
.
=
$sTdFirst
.
'<td></td><td></td><td></td><td>'
.
(
isset
(
$aCfg
[
'target'
])
?
'see config for <em>'
.
$aCfg
[
'target'
]
.
'</em>'
:
''
)
.
'</td></tr>'
;
}
}
$sHtml
.
=
'</tbody></table></div>'
/*
.'<h2>Config array</h2>
<pre>'.print_r($aHosts, 1).'</pre>'
*/
;
$sErrors
=
$sErrors
?
'<h2>'
.
$aIco
[
'h2_err'
]
.
' Found errors</h2>'
.
'<div class="content">'
.
'<ol class="error">'
.
$sErrors
.
'</ol>'
.
'</div>'
:
''
;
$sTable
=
''
;
$sHtml
.
=
''
.
'<br><br>'
$sTable
=
$sTable
?
'<table class="mydatatable"><thead>
<tr>
<th>Host</th>
<th>Ip address</th>
<th>Setup</th>
<th>Type</th>
<th>From</th>
<th>Code</th>
<th>Target</th>
</tr>
</thead><tbody>'
.
$sTable
.
'</tbody></table></div>'
.
'<br><br>'
.
'<div class="content legend">'
.
'<strong>Legend</strong>:<br>'
.
'<table><tbody>'
...
...
@@ -230,7 +204,54 @@ if (!$oR->isEnabled()){
.
'</tbody></table>'
.
'</div>'
.
'<footer><a href="'
.
$oR
->
urlRepo
.
'">Source</a> | <a href="'
.
$oR
->
urlDocs
.
'">Docs</a></footer>'
:
'<h3>'
.
$aIco
[
'welcome'
]
.
' Welcome!</h3>
<p>
Thank you for the installation!<br>
Now is a good moment to create your first config.
</p>
<ul>
<li>Go to the directory ./config/</li>
<li>Watch the *.dist files - make a copy of them to *.json (without .dist)</li>
<li>Relaod this page</li>
</ul>
<p>
See the <a href="'
.
$oR
->
urlDocs
.
'Configuration.html" target="_blank">Docs</a> for details.
</p>
'
;
$sHtml
.
=
'
<!--
<h2>'
.
$aIco
[
'h2_head'
]
.
' Http head tester</h2>
<div class="content">
<form>
'
.
$aIco
[
'url'
]
.
' <input type="text" name="url" size="100" value="'
.
$sUrl
.
'" placeholder="Enter url or click a link in the table below."/>
<button>Http HEAD</button>
</form>
</div>
<br>
-->
<h2>'
.
$aIco
[
'h2_config'
]
.
' Domains and their redirects</h2>
<div class="content">'
/*
.'<h2>Config array</h2>
<pre>'.print_r($aHosts, 1).'</pre>'
*/
.
$sTable
;
$sErrors
=
$sErrors
?
'<h2>'
.
$aIco
[
'h2_err'
]
.
' Found errors</h2>'
.
'<div class="content">'
.
'<ol class="error">'
.
$sErrors
.
'</ol>'
.
'</div>'
:
''
;
$sHtml
.
=
'<footer><a href="'
.
$oR
->
urlRepo
.
'">Source</a> | <a href="'
.
$oR
->
urlDocs
.
'">Docs</a></footer>'
;
}
...
...
This diff is collapsed.
Click to expand it.
public_html/admin/main.css
+
1
−
0
View file @
2b8e01a1
...
...
@@ -3,6 +3,7 @@ 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
:
#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
;
margin
:
0
0
1em
;}
h3
{
color
:
#ccc
;
font-size
:
250%
}
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
);}
...
...
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