Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
phpipam
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
phpipam
Commits
80124aa5
Commit
80124aa5
authored
Jul 17, 2019
by
Gary Allan
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: Bandwidth calculator - 400 Bad Request. Fixes #1807 #2648
parent
2052f321
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/sections/menu/menu-tools-admin.php
+1
-2
1 addition, 2 deletions
app/sections/menu/menu-tools-admin.php
functions/global_functions.php
+26
-39
26 additions, 39 deletions
functions/global_functions.php
with
27 additions
and
41 deletions
app/sections/menu/menu-tools-admin.php
+
1
−
2
View file @
80124aa5
...
...
@@ -136,8 +136,7 @@ if($User->is_admin(false)) {
}
else
{
$active
=
""
;
}
list
(
$l0
,
$l1
)
=
explode
(
'/'
,
$i
[
'href'
]);
print
"<li class='
$active
'><a href='"
.
create_link
(
"tools"
,
$l0
,
$l1
)
.
"'>"
.
_
(
$i
[
'name'
])
.
"</a></li>"
;
print
"<li class='
$active
'><a href='"
.
create_link
(
"tools"
,
$i
[
'href'
])
.
"'>"
.
_
(
$i
[
'name'
])
.
"</a></li>"
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
functions/global_functions.php
+
26
−
39
View file @
80124aa5
...
...
@@ -59,54 +59,41 @@ function create_link ($l0 = null, $l1 = null, $l2 = null, $l3 = null, $l4 = null
# get settings
global
$User
;
$parts
=
[];
for
(
$i
=
0
;
$i
<=
6
;
$i
++
)
{
if
(
is_null
(
$
{
"l
$i
"
}))
continue
;
foreach
(
explode
(
'/'
,
$
{
"l
$i
"
})
as
$p
)
{
// url encode all
if
(
!
is_null
(
$l6
))
{
$l6
=
urlencode
(
$l6
);
}
if
(
!
is_null
(
$l5
))
{
$l5
=
urlencode
(
$l5
);
}
if
(
!
is_null
(
$l4
))
{
$l4
=
urlencode
(
$l4
);
}
if
(
!
is_null
(
$l3
))
{
$l3
=
urlencode
(
$l3
);
}
if
(
!
is_null
(
$l2
))
{
$l2
=
urlencode
(
$l2
);
}
if
(
!
is_null
(
$l1
))
{
$l1
=
urlencode
(
$l1
);
}
if
(
!
is_null
(
$l0
))
{
$l0
=
urlencode
(
$l0
);
}
$parts
[]
=
urlencode
(
$p
);
}
}
if
(
empty
(
$parts
))
return
BASE
;
# Pretty Links
if
(
$User
->
settings
->
prettyLinks
==
"Yes"
)
{
$link
=
BASE
.
implode
(
'/'
,
$parts
);
# IP search fix
if
(
!
is_null
(
$parts
[
6
])
||
(
$parts
[
0
]
==
"tools"
&&
$parts
[
1
]
==
"search"
&&
isset
(
$parts
[
2
])))
return
$link
;
return
$link
.
'/'
;
}
#
set n
ormal link
array
#
N
ormal link
s
$el
=
array
(
"page"
,
"section"
,
"subnetId"
,
"sPage"
,
"ipaddrid"
,
"tab"
);
// override for search
if
(
$l0
==
"tools"
&&
$l1
==
"search"
)
$el
=
array
(
"page"
,
"section"
,
"ip"
,
"addresses"
,
"subnets"
,
"vlans"
,
"ip"
);
# set rewrite
if
(
$User
->
settings
->
prettyLinks
==
"Yes"
)
{
if
(
!
is_null
(
$l6
))
{
$link
=
"
$l0
/
$l1
/
$l2
/
$l3
/
$l4
/
$l5
/
$l6
"
;
}
elseif
(
!
is_null
(
$l5
))
{
$link
=
"
$l0
/
$l1
/
$l2
/
$l3
/
$l4
/
$l5
/"
;
}
elseif
(
!
is_null
(
$l4
))
{
$link
=
"
$l0
/
$l1
/
$l2
/
$l3
/
$l4
/"
;
}
elseif
(
!
is_null
(
$l3
))
{
$link
=
"
$l0
/
$l1
/
$l2
/
$l3
/"
;
}
elseif
(
!
is_null
(
$l2
))
{
$link
=
"
$l0
/
$l1
/
$l2
/"
;
}
elseif
(
!
is_null
(
$l1
))
{
$link
=
"
$l0
/
$l1
/"
;
}
elseif
(
!
is_null
(
$l0
))
{
$link
=
"
$l0
/"
;
}
else
{
$link
=
""
;
}
# IP search fix
if
(
$l0
==
"tools"
&&
$l1
==
"search"
&&
isset
(
$l2
)
&&
substr
(
$link
,
-
1
)
==
"/"
)
{
$link
=
substr
(
$link
,
0
,
-
1
);
}
foreach
(
$parts
as
$i
=>
$p
)
{
$parts
[
$i
]
=
"
$el[$i]
=
$p
"
;
}
# normal
else
{
if
(
!
is_null
(
$l6
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]=$l1&$el[2]=$l2&$el[3]=$l3&$el[4]=$l4&$el[5]=$l5&$el[6]
=
$l6
"
;
}
elseif
(
!
is_null
(
$l5
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]=$l1&$el[2]=$l2&$el[3]=$l3&$el[4]=$l4&$el[5]
=
$l5
"
;
}
elseif
(
!
is_null
(
$l4
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]=$l1&$el[2]=$l2&$el[3]=$l3&$el[4]
=
$l4
"
;
}
elseif
(
!
is_null
(
$l3
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]=$l1&$el[2]=$l2&$el[3]
=
$l3
"
;
}
elseif
(
!
is_null
(
$l2
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]=$l1&$el[2]
=
$l2
"
;
}
elseif
(
!
is_null
(
$l1
))
{
$link
=
"index.php?
$el[0]=$l0&$el[1]
=
$l1
"
;
}
elseif
(
!
is_null
(
$l0
))
{
$link
=
"index.php?
$el[0]
=
$l0
"
;
}
else
{
$link
=
""
;
}
}
# prepend base
$link
=
BASE
.
$link
;
# result
return
$link
;
return
BASE
.
"index.php?"
.
implode
(
'&'
,
$parts
);
}
/**
...
...
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