Fix styles and scripts in header
This commit is contained in:
parent
c500face92
commit
be9610cd98
|
@ -1,27 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
IP Reg, a PHP/MySQL IPAM tool
|
IP Reg, a PHP/MySQL IPAM tool
|
||||||
Copyright (C) 2007-2009 Wietse Warendorff
|
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||||
|
Copyright (C) 2011-2023 Thomas Hooge
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
it under the terms of the GNU General Public License as published by
|
*****************************************************************************/
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
// strip mac address to 12 char string
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
function strip_mac($mac) {
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
|
||||||
or contact me at wietsew@users.sourceforge.net
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
// strip mac address to 12 char string
|
|
||||||
function strip_mac($mac) {
|
|
||||||
// strip chars we don't need
|
// strip chars we don't need
|
||||||
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
|
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
|
||||||
|
|
||||||
|
@ -30,17 +17,17 @@
|
||||||
|
|
||||||
// and return
|
// and return
|
||||||
return ($mac);
|
return ($mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rebuild mac address
|
// rebuild mac address
|
||||||
function write_mac($mac) {
|
function write_mac($mac) {
|
||||||
// check string length
|
// check string length
|
||||||
if (strlen($mac)!=12) {
|
if (strlen($mac)!=12) {
|
||||||
// if the MAC is empty, or for whatever reason incorrect, just return
|
// if the MAC is empty, or for whatever reason incorrect, just return
|
||||||
return $mac;
|
return $mac;
|
||||||
} else {
|
} else {
|
||||||
// count to 12...
|
// count to 12...
|
||||||
for($i=0;$i<12;$i++) {
|
for ($i=0; $i<12; $i++) {
|
||||||
// ... and strip mac to pieces
|
// ... and strip mac to pieces
|
||||||
${"mac".$i} = $mac{$i};
|
${"mac".$i} = $mac{$i};
|
||||||
}
|
}
|
||||||
|
@ -49,7 +36,7 @@
|
||||||
$user_mac = $_SESSION['suser_mac'];
|
$user_mac = $_SESSION['suser_mac'];
|
||||||
|
|
||||||
// count to 12 again...
|
// count to 12 again...
|
||||||
for($i=0;$i<12;$i++) {
|
for($i=0; $i<12; $i++) {
|
||||||
// ... and replace user preference with pieces
|
// ... and replace user preference with pieces
|
||||||
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
|
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
|
||||||
}
|
}
|
||||||
|
@ -57,19 +44,19 @@
|
||||||
// and return
|
// and return
|
||||||
return $user_mac;
|
return $user_mac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect page
|
// redirect page
|
||||||
function header_location($location) {
|
function header_location($location) {
|
||||||
// send header
|
// send header
|
||||||
header("location: " . $location);
|
header("location: " . $location);
|
||||||
|
|
||||||
// exit to be sure
|
// exit to be sure
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanitize input
|
// sanitize input
|
||||||
function sanitize($input) {
|
function sanitize($input) {
|
||||||
global $dblink;
|
global $dblink;
|
||||||
|
|
||||||
// trim whitespaces
|
// trim whitespaces
|
||||||
|
@ -92,17 +79,17 @@
|
||||||
|
|
||||||
// and return
|
// and return
|
||||||
return $input;
|
return $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mysql_nullstring($input) {
|
function mysql_nullstring($input) {
|
||||||
if (isset($input)) {
|
if (isset($input)) {
|
||||||
return $input;
|
return $input;
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
|
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
|
||||||
if ($lang_variable === null) {
|
if ($lang_variable === null) {
|
||||||
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||||
}
|
}
|
||||||
|
@ -139,9 +126,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $current_lang;
|
return $current_lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_tree_rec($tree, $level) {
|
function print_tree_rec($tree, $level) {
|
||||||
$output = '<ul class="treelvl' . $level. '">' . "\n";
|
$output = '<ul class="treelvl' . $level. '">' . "\n";
|
||||||
foreach ($tree as $node) {
|
foreach ($tree as $node) {
|
||||||
$output .= '<li><a href="' . $node['href'] . '">' . $node['value'] . '</a>';
|
$output .= '<li><a href="' . $node['href'] . '">' . $node['value'] . '</a>';
|
||||||
|
@ -152,9 +139,9 @@
|
||||||
}
|
}
|
||||||
$output .= "</ul>\n";
|
$output .= "</ul>\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_tree ($params, &$smarty) {
|
function print_tree($params, &$smarty) {
|
||||||
if (empty($params['level'])) {
|
if (empty($params['level'])) {
|
||||||
$level = 0;
|
$level = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,6 +152,6 @@
|
||||||
} else {
|
} else {
|
||||||
return print_tree_rec($params['tree'], $level);
|
return print_tree_rec($params['tree'], $level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -6,12 +6,16 @@
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
<link rel="shortcut icon" href="images/shield.ico">
|
<link rel="shortcut icon" href="images/shield.ico">
|
||||||
<link rel="stylesheet" href="tpl/style.css" type="text/css">
|
<link rel="stylesheet" href="tpl/style.css" type="text/css">
|
||||||
|
{if isset($styles)}
|
||||||
{foreach item=style from=$styles}
|
{foreach item=style from=$styles}
|
||||||
<link rel="stylesheet" href="css/{$style[0]}" type="text/css" media="{$style[1]}" />
|
<link rel="stylesheet" href="css/{$style[0]}" type="text/css" media="{$style[1]}" />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
{if isset($scripts)}
|
||||||
{foreach item=script from=$scripts}
|
{foreach item=script from=$scripts}
|
||||||
<script type="text/javascript" src="lib/{$script}"></script>
|
<script type="text/javascript" src="lib/{$script}"></script>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
{/if}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in New Issue