Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42a964c4b8 | |||
| f0d187b4c3 | |||
| 0b2da1f00f | |||
| ac074eb944 | |||
| db26ffa611 | |||
| 26e9c89405 | |||
| 42e327776c | |||
| 6c9a169600 | |||
| 02b3cfd23f | |||
| 0696a16030 | |||
| e74bde2d14 | |||
| b144555e46 | |||
| 7d6450706f | |||
| cb7f8ef649 | |||
| 08c6d42b3c | |||
| c13c7494bf | |||
| 7c300e0a8f | |||
| a4ecd1bff7 | |||
| be9610cd98 | |||
| c500face92 | |||
| 37f4bd4185 | |||
| 808ae831bf | |||
| 6df7a3f6a8 | |||
| ed33c0553d | |||
| 23b73a387b |
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*~
|
||||
tpl_c/*.php
|
||||
config.php
|
||||
51
about.php
@@ -1,43 +1,16 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup page
|
||||
// set vars
|
||||
$smarty->assign("config_version", $config_version);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("about.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
$smarty->display("about.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
121
asset.php
@@ -1,84 +1,47 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// create letter links
|
||||
// build query
|
||||
$query = "SELECT
|
||||
SUBSTRING(UPPER(asset.asset_name),1,1) AS asset_letter
|
||||
FROM
|
||||
asset
|
||||
GROUP BY
|
||||
asset_letter
|
||||
ORDER BY
|
||||
asset_letter";
|
||||
|
||||
// run query
|
||||
$alphabet = $db->db_select($query);
|
||||
$smarty->assign("alphabet", $alphabet);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup asset
|
||||
// setup current letter
|
||||
if(isset($_GET['asset_letter'])) {
|
||||
$asset_letter = sanitize($_GET['asset_letter']);
|
||||
} else {
|
||||
$asset_letter = $alphabet[0]['asset_letter'];
|
||||
}
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
IF(LENGTH(asset.asset_name)>0, asset.asset_name, '...') AS asset_name,
|
||||
asset.asset_info AS asset_info,
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
asset,
|
||||
assetclass
|
||||
WHERE
|
||||
SUBSTRING(asset.asset_name,1,1) = '" . $asset_letter . "'
|
||||
AND assetclass.assetclass_id=asset.assetclass_id
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("assets", $assets);
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("asset.tpl");
|
||||
include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
|
||||
// create letter links
|
||||
$sql = "SELECT DISTINCT SUBSTRING(UPPER(asset_name),1,1) AS asset_letter
|
||||
FROM asset
|
||||
ORDER BY asset_letter";
|
||||
$sth = $dbh->query($sql);
|
||||
|
||||
$alphabet = $sth->fetchAll();
|
||||
$smarty->assign("alphabet", $alphabet);
|
||||
|
||||
// total asset count
|
||||
$sth = $dbh->query("SELECT COUNT(*) FROM asset");
|
||||
$smarty->assign("assetcount", $sth->fetchColumn());
|
||||
|
||||
// assets for current letter
|
||||
if (isset($_GET['asset_letter'])) {
|
||||
$asset_letter = sanitize($_GET['asset_letter']);
|
||||
} else {
|
||||
$asset_letter = $alphabet[0]['asset_letter'];
|
||||
}
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
$sql = "SELECT a.asset_id, IF(LENGTH(a.asset_name)>0, a.asset_name, '...') AS asset_name,
|
||||
a.asset_info, c.assetclass_id, c.assetclass_name
|
||||
FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
|
||||
WHERE SUBSTRING(a.asset_name,1,1)=?
|
||||
ORDER BY a.asset_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$asset_letter]);
|
||||
$smarty->assign("assets", $sth->fetchAll());
|
||||
|
||||
$smarty->display("asset.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
89
assetadd.php
@@ -1,59 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclass_id'])) ? $assetclass_id = sanitize($_GET['assetclass_id']) : $assetclass_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
foreach ($assetclasses as $assetclass) {
|
||||
$assetclass_options[$assetclass['assetclass_id']] = $assetclass['assetclass_name'];
|
||||
}
|
||||
$smarty->assign("assetclass_options", $assetclass_options);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
if((isset($_GET['assetclass_id'])) ? $assetclass_id = sanitize($_GET['assetclass_id']) : $assetclass_id = "");
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclass_id, assetclass_name
|
||||
FROM assetclass
|
||||
ORDER BY assetclass_name";
|
||||
$sth = $dbh->query($sql);
|
||||
|
||||
$types = db_load_enum('asset','asset_type');
|
||||
|
||||
$smarty->assign("type_ids", $types);
|
||||
$smarty->assign("type_names", $types);
|
||||
$smarty->assign("type_selected", $types[0]);
|
||||
|
||||
$assetclass_options = array();
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$assetclass_options[$rec[0]] = $rec[1];
|
||||
}
|
||||
|
||||
$smarty->assign("assetclass_options", $assetclass_options);
|
||||
$smarty->display("assetadd.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
@@ -1,61 +1,23 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name,
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclass,
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("assetclasses", $assetclasses);
|
||||
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclass.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
|
||||
g.assetclassgroup_name, g.assetclassgroup_color
|
||||
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
|
||||
ORDER BY a.assetclass_name";
|
||||
$sth = $dbh->query($sql);
|
||||
$smarty->assign("assetclasses", $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
$smarty->display("assetclass.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,45 +1,20 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']) : $assetclassgroup_id = "");
|
||||
|
||||
include("header.php");
|
||||
|
||||
$smarty->assign("assetclassgroup_options", db_get_options_assetclassgroup());
|
||||
$smarty->display("assetclassadd.tpl");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']) : $assetclassgroup_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
$smarty->assign("assetclassgroup_options", $db->options_assetclassgroup());
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
@@ -1,59 +1,26 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id;
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassdel.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclass_id AS id, assetclass_name AS name
|
||||
FROM assetclass
|
||||
WHERE assetclass_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclass_id]);
|
||||
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("assetclassdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,65 +1,29 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name,
|
||||
assetclass.assetclassgroup_id AS assetclassgroup_id
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id;
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
include("header.php");
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
$sql = "SELECT assetclass_id AS id, assetclass_name AS name,
|
||||
assetclassgroup_id AS group_id
|
||||
FROM assetclass
|
||||
WHERE assetclass_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclass_id]);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
$smarty->assign("assetclassgroup_id", $assetclass[0]['assetclassgroup_id']);
|
||||
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$smarty->assign("assetclassgroup_options", $db->options_assetclassgroup());
|
||||
$smarty->assign("assetclassgroup_options", db_get_options_assetclass());
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassedit.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$smarty->display("assetclassedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,54 +1,23 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color
|
||||
FROM
|
||||
assetclassgroup
|
||||
ORDER BY
|
||||
assetclassgroup.assetclassgroup_name";
|
||||
|
||||
// run query
|
||||
$assetclassgroups = $db->db_select($query);
|
||||
$smarty->assign("assetclassgroups", $assetclassgroups);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassgroup.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name,
|
||||
assetclassgroup_color AS color, assetclassgroup_description AS description
|
||||
FROM assetclassgroup
|
||||
ORDER BY assetclassgroup_name";
|
||||
$sth = $dbh->query($sql);
|
||||
$smarty->assign('assetclassgroups', $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
$smarty->display("assetclassgroup.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
@@ -1,39 +1,18 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
$smarty->assign("scripts", 'jscolor.js');
|
||||
include("header.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$smarty->display("assetclassgroupadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassgroupadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,59 +1,26 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassgroupdel.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("includes.php");
|
||||
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name
|
||||
FROM assetclassgroup
|
||||
WHERE assetclassgroup_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclassgroup_id]);
|
||||
$smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("assetclassgroupdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,62 +1,30 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// start output
|
||||
$smarty->assign("scripts", 'jscolor.js');
|
||||
include("header.php");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
$smarty->assign("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassgroupedit.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
$smarty->assign("scripts", 'jscolor.js');
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name,
|
||||
assetclassgroup_color AS color,
|
||||
assetclassgroup_description AS description
|
||||
FROM assetclassgroup
|
||||
WHERE assetclassgroup_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclassgroup_id]);
|
||||
|
||||
$smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("assetclassgroupedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,77 +1,37 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
$smarty->assign("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclassgroup_id=" . $assetclassgroup_id . "
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
$smarty->assign("assetclasses", $assetclasses);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassgroupview.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT assetclassgroup_id AS id,
|
||||
assetclassgroup_name AS name,
|
||||
assetclassgroup_color AS color,
|
||||
assetclassgroup_description AS description
|
||||
FROM assetclassgroup
|
||||
WHERE assetclassgroup_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclassgroup_id]);
|
||||
$smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$sql = "SELECT assetclass_id, assetclass_name
|
||||
FROM assetclass
|
||||
WHERE assetclassgroup_id=?
|
||||
ORDER BY assetclass_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclassgroup_id]);
|
||||
$smarty->assign("assetclasses", $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
$smarty->display("assetclassgroupview.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,85 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
include("header.php");
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
$sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
|
||||
g.assetclassgroup_name, g.assetclassgroup_color
|
||||
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
|
||||
WHERE a.assetclass_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclass_id]);
|
||||
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
$sql = "SELECT asset_id, asset_name,
|
||||
CONCAT(LEFT(asset_info, 80), IF(CHAR_LENGTH(asset_info)>80,'...','')) AS asset_info
|
||||
FROM asset
|
||||
WHERE assetclass_id=?
|
||||
ORDER BY asset_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$assetclass_id]);
|
||||
$smarty->assign("assets", $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$smarty->display("assetclassview.tpl");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id,
|
||||
assetclass.assetclass_name,
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclass,
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id . "
|
||||
AND assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id";
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
$smarty->assign("assetclass_selected", "");
|
||||
|
||||
$smarty->assign("assetclassgroup_id", $assetclass[0]['assetclassgroup_id']);
|
||||
$smarty->assign("assetclassgroup_name", $assetclass[0]['assetclassgroup_name']);
|
||||
|
||||
// send to tpl
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset_id,
|
||||
asset_name,
|
||||
CONCAT(LEFT(asset_info, 80), IF(CHAR_LENGTH(asset_info)>80,'...','')) AS asset_info
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
assetclass_id='" . $assetclass_id . "'
|
||||
ORDER BY
|
||||
asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
$smarty->assign("assets", $assets);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetclassview.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
99
assetdel.php
@@ -1,74 +1,31 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id;
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("asset_id", $asset_id);
|
||||
$smarty->assign("asset_name", $asset[0]['asset_name']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.asset_id=" . $asset_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetdel.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
include("includes.php");
|
||||
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
// asset to delete
|
||||
$sth = $dbh->prepare("SELECT asset_name FROM asset WHERE asset_id=?");
|
||||
$sth->execute([$asset_id]);
|
||||
$smarty->assign("asset_id", $asset_id);
|
||||
$smarty->assign("asset_name", $sth->fetchColumn());
|
||||
|
||||
// nodes to delete
|
||||
$sql = "SELECT node_id, node_ip FROM node WHERE asset_id=? ORDER BY INET_ATON(node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$asset_id]);
|
||||
$smarty->assign("nodes", $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
$smarty->display("assetdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,62 +1,33 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset_id,
|
||||
asset.asset_name AS asset_name,
|
||||
asset.asset_hostname AS asset_hostname,
|
||||
asset.asset_info AS asset_info,
|
||||
asset.assetclass_id AS assetclass_id
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id;
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
$smarty->assign("asset", $asset[0]);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup assetclass
|
||||
$smarty->assign("assetclass_options", $db->options_assetclass());
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetedit.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT asset_id, asset_name, asset_hostname, asset_info, asset_intf,
|
||||
assetclass_id, asset_type
|
||||
FROM asset
|
||||
WHERE asset_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$asset_id]);
|
||||
$smarty->assign("asset", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// Type selection
|
||||
$smarty->assign("type_ids", ['active', 'passive']);
|
||||
$smarty->assign("type_names", ['Active', 'Passive']);
|
||||
|
||||
$smarty->assign("assetclass_options", db_get_options_assetclass());
|
||||
|
||||
$smarty->display("assetedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
102
assetview.php
@@ -1,86 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
include("header.php");
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
$sql = "SELECT a.asset_id, a.asset_name, a.asset_hostname, a.asset_info,
|
||||
a.asset_intf, a.asset_type, c.assetclass_id, c.assetclass_name
|
||||
FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
|
||||
WHERE a.asset_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$asset_id]);
|
||||
$asset = $sth->fetch(PDO::FETCH_OBJ);
|
||||
$smarty->assign("asset", $asset);
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
$sql = "SELECT node_id, node_ip, LEFT(node_info, 40) as node_info
|
||||
FROM node
|
||||
WHERE asset_id=?
|
||||
ORDER BY INET_ATON(node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$asset_id]);
|
||||
$smarty->assign("nodes", $sth->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$smarty->display("assetview.tpl");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name,
|
||||
asset.asset_hostname,
|
||||
asset.asset_info,
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
asset,
|
||||
assetclass
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id . "
|
||||
AND assetclass.assetclass_id=asset.assetclass_id";
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("asset_id", $asset_id);
|
||||
$smarty->assign("asset_name", $asset[0]['asset_name']);
|
||||
$smarty->assign("asset_hostname", $asset[0]['asset_hostname']);
|
||||
$smarty->assign("asset_info", nl2br($asset[0]['asset_info']));
|
||||
|
||||
$smarty->assign("assetclass_id", $asset[0]['assetclass_id']);
|
||||
$smarty->assign("assetclass_name", $asset[0]['assetclass_name']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node_id,
|
||||
node_ip,
|
||||
LEFT(node_info, 40) as node_info
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.asset_id=" . $asset_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assetview.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,61 +1,29 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
include("includes.php");
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assigniptonode.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
|
||||
$smarty->display("assigniptonode.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,79 +1,28 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup asset
|
||||
$smarty->assign("asset_id", $asset_id);
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
foreach ($assets as $asset) {
|
||||
$asset_options[$asset['asset_id']] = $asset['asset_name'];
|
||||
}
|
||||
$smarty->assign("asset_options", $asset_options);
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT subnet_id,
|
||||
CONCAT_WS('/', subnet_address, subnet_mask) AS subnet_name
|
||||
FROM subnet
|
||||
ORDER BY INET_ATON(subnet_address)";
|
||||
include("includes.php");
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
foreach ($subnets as $subnet) {
|
||||
$subnet_options[$subnet['subnet_id']] = $subnet['subnet_name'];
|
||||
}
|
||||
$smarty->assign("subnet_options", $subnet_options);
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("assignnodetoasset.tpl");
|
||||
include("header.php");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
$smarty->assign("asset_id", $asset_id);
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
|
||||
$smarty->assign("asset_options", db_get_options_asset());
|
||||
$smarty->assign("subnet_options", db_get_options_subnet());
|
||||
|
||||
$smarty->display("assignnodetoasset.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
161
cable.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
if ($_SESSION['suser_role_admin'] == 0) {
|
||||
header_location('comments.php?comments=accessdenied');
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$id = (int) $_REQUEST['id'] or $id = 0;
|
||||
}
|
||||
|
||||
$ctypes = array('copper' => 'Copper', 'fibre' => 'Fibre',
|
||||
'laser' => 'Laserlink', 'radio' => 'Radiolink');
|
||||
|
||||
// ========== ACTIONS START ===================================================
|
||||
|
||||
switch ($submit = form_get_action()) {
|
||||
|
||||
case NULL: break;
|
||||
|
||||
case 'add': $action = ACT_ADD; break;
|
||||
case 'view': $action = ACT_VIEW; break;
|
||||
case 'edit': $action = ACT_EDIT; break;
|
||||
case 'del': $action = ACT_DELETE; break;
|
||||
|
||||
case 'insert':
|
||||
$description = sanitize($_POST['description']);
|
||||
$color = sanitize($_POST['color']);
|
||||
$info = sanitize($_POST['info']);
|
||||
$sql = "INSERT INTO cable
|
||||
(cable_description, cable_color, cable_info)
|
||||
VALUES
|
||||
(:description, :color, :info)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindValue(':description', $description, PDO::PARAM_STR);
|
||||
$sth->bindValue(':color', $color, PDO::PARAM_STR);
|
||||
$sth->bindValue(':info', $info, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
$id = $dbh->lastInsertId();
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
$description = sanitize($_POST['description']);
|
||||
$color = sanitize($_POST['color']);
|
||||
$length = sanitize($_POST['length']);
|
||||
$type = sanitize($_POST['cable_type']);
|
||||
$info = sanitize($_POST['info']);
|
||||
$sql = "UPDATE cable
|
||||
SET cable_description=:desc,
|
||||
cable_color=:color,
|
||||
cable_length=:length,
|
||||
cable_type=:type,
|
||||
cable_info=:info
|
||||
WHERE cable_id=:id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$sth->bindValue(':desc', $description, PDO::PARAM_STR);
|
||||
$sth->bindValue(':length', $length, PDO::PARAM_INT);
|
||||
$sth->bindValue(':color', $color, PDO::PARAM_STR);
|
||||
$sth->bindValue(':type', $type, PDO::PARAM_STR);
|
||||
$sth->bindValue(':info', $info, PDO::PARAM_STR);
|
||||
$sth->execute();
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$sth = $dbh->prepare("DELETE FROM cable WHERE cable_id=?");
|
||||
$sth->execute([$id]);
|
||||
$action = ACT_DEFAULT;
|
||||
break;
|
||||
|
||||
default:
|
||||
$g_error->Add(submit_error($submit));
|
||||
$valid = FALSE;
|
||||
}
|
||||
|
||||
// ========== ACTIONS END =====================================================
|
||||
|
||||
$smarty->assign("scripts", 'jscolor.js');
|
||||
include("header.php");
|
||||
|
||||
// ========== PAGE CONTENT ====================================================
|
||||
|
||||
if ($action == ACT_DEFAULT):
|
||||
// ========== VARIANT: default behavior =======================================
|
||||
|
||||
$sql = "SELECT cable_id AS id, cable_description AS description,
|
||||
cable_from_id, cable_to_id, cable_length, cable_links,
|
||||
cable_type, cable_color,
|
||||
CONCAT(LEFT(cable_info, 60), IF(CHAR_LENGTH(cable_info)>60,'...','')) AS info
|
||||
FROM cable
|
||||
ORDER BY cable_description";
|
||||
$sth = $dbh->query($sql);
|
||||
$smarty->assign("cables", $sth->fetchAll());
|
||||
|
||||
$smarty->display("cable.tpl");
|
||||
|
||||
elseif ($action == ACT_ADD):
|
||||
// ========== VARIANT: add record =============================================
|
||||
|
||||
$smarty->assign('type_options', $ctypes);
|
||||
$smarty->display('cableadd.tpl');
|
||||
|
||||
elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$sql = "SELECT cable_id AS id, cable_description AS description,
|
||||
cable_from_id, cable_to_id, cable_length, cable_links,
|
||||
cable_type, cable_color AS color, cable_info AS info
|
||||
FROM cable
|
||||
WHERE cable_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
$smarty->assign('cable', $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display('cableview.tpl');
|
||||
|
||||
elseif ($action == ACT_EDIT):
|
||||
// ========== VARIANT: edit single record =====================================
|
||||
|
||||
$sql = "SELECT cable_id AS id, cable_description AS description,
|
||||
cable_from_id, cable_to_id, cable_length, cable_links,
|
||||
cable_type, cable_color AS color, cable_info AS info
|
||||
FROM cable
|
||||
WHERE cable_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$id]);
|
||||
$smarty->assign('cable', $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->assign('type_options', $ctypes);
|
||||
$smarty->display('cableedit.tpl');
|
||||
|
||||
elseif ($action == ACT_DELETE):
|
||||
// ========== VARIANT: delete record ==========================================
|
||||
|
||||
$sth = $dbh->prepare("SELECT cable_description FROM cable WHERE cable_id=?");
|
||||
$sth->execute([$id]);
|
||||
$smarty->assign('id', $id);
|
||||
$smarty->assign('description', $sth->fetchColumn());
|
||||
|
||||
$smarty->display('cabledel.tpl');
|
||||
|
||||
else:
|
||||
// ========== ERROR UNKNOWN VARIANT ===========================================
|
||||
|
||||
echo "<p>Unknown function call: Please report to system development!</p>\n";
|
||||
|
||||
endif; // $action == ...
|
||||
// ========== END OF VARIANTS =================================================
|
||||
|
||||
$smarty->display('footer.tpl');
|
||||
?>
|
||||
62
comments.php
@@ -1,42 +1,22 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// get error
|
||||
$comments = sanitize($_GET['comments']);
|
||||
|
||||
// set veriables
|
||||
$smarty->assign("comments", $lang['lang_comments_' . $comments]);
|
||||
|
||||
// output
|
||||
$smarty->display("comments.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
|
||||
$comments = sanitize($_GET['comments']);
|
||||
|
||||
$smarty->assign("comments", $lang['lang_comments_' . $comments]);
|
||||
|
||||
$smarty->display("comments.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
41
config.php
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// version
|
||||
$config_version = 'v0.7';
|
||||
|
||||
// db connection
|
||||
$config_mysql_host = 'localhost';
|
||||
$config_mysql_username = 'ipreg';
|
||||
$config_mysql_password = 'changeme!';
|
||||
$config_mysql_dbname = 'ipreg';
|
||||
|
||||
// default values for IP blocks
|
||||
$config_color_blocked = 'dcdcdc';
|
||||
$config_color_unused = 'ffffff';
|
||||
$config_color_dynamic = 'e0e0e0';
|
||||
|
||||
// language
|
||||
$config_lang = array('de', 'en');
|
||||
$config_lang_default = 'en';
|
||||
|
||||
?>
|
||||
36
config.php-sample
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// db connection
|
||||
$config_mysql_host = 'localhost';
|
||||
$config_mysql_username = 'ipreg';
|
||||
$config_mysql_password = 'changeme!';
|
||||
$config_mysql_dbname = 'ipreg';
|
||||
|
||||
// default values for IP blocks
|
||||
$config_color_blocked = 'dcdcdc';
|
||||
$config_color_unused = 'ffffff';
|
||||
$config_color_dynamic = 'e0e0e0';
|
||||
|
||||
// language
|
||||
$config_lang_default = 'en';
|
||||
|
||||
// auth
|
||||
$config_auth_ldap = false;
|
||||
$config_ldap_host = array('localhost', 'otherhost.example.com');
|
||||
$config_ldap_port = 389;
|
||||
$config_ldap_v3 = true;
|
||||
$config_ldap_base_dn = 'ou=organizationalunit,dc=example,dc=com';
|
||||
$config_ldap_login_attr = 'uid';
|
||||
|
||||
// ldap search user
|
||||
$config_ldap_bind_dn = 'cn=dummy,ou=organizationalunit,dc=example,dc=com';
|
||||
$config_ldap_bind_pass = 'secret';
|
||||
|
||||
?>
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// build connection
|
||||
$dblink = mysqli_connect($config_mysql_host,$config_mysql_username,$config_mysql_password);
|
||||
|
||||
// select db
|
||||
mysqli_select_db($dblink, $config_mysql_dbname);
|
||||
?>
|
||||
38
footer.php
@@ -1,31 +1,13 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
$smarty->assign("config_version", $config_version);
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
|
||||
// get version for the footer-stamp
|
||||
$smarty->assign("config_version", $config_version);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("footer.tpl");
|
||||
$smarty->display("footer.tpl");
|
||||
?>
|
||||
126
header.php
@@ -1,69 +1,61 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// include language file
|
||||
include('lang/' . $_SESSION['suser_language'] . '.php');
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// search box
|
||||
// new search?
|
||||
if (isset($_POST['search'])) {
|
||||
// set var
|
||||
$search = sanitize($_POST['search']);
|
||||
|
||||
// store var
|
||||
$_SESSION['search'] = $search;
|
||||
} else {
|
||||
// check for stored var
|
||||
if(isset($_SESSION['search'])) {
|
||||
// set var
|
||||
$search = $_SESSION['search'];
|
||||
} else {
|
||||
// empty var
|
||||
$search = '';
|
||||
}
|
||||
}
|
||||
|
||||
// to tpl
|
||||
// set global template vars
|
||||
$smarty->assign("config_version", $config_version);
|
||||
$smarty->assign("suser_name", $_SESSION['suser_displayname']);
|
||||
$smarty->assign("search", $search);
|
||||
|
||||
// menu
|
||||
$smarty->assign("menu_assets", $_SESSION['suser_menu_assets']=='on');
|
||||
$smarty->assign("menu_assetclasses", $_SESSION['suser_menu_assetclasses']=='on');
|
||||
$smarty->assign("menu_assetclassgroups", $_SESSION['suser_menu_assetclassgroups']=='on');
|
||||
$smarty->assign("menu_locations", $_SESSION['suser_menu_locations']=='on');
|
||||
$smarty->assign("menu_nodes", $_SESSION['suser_menu_nodes']=='on');
|
||||
$smarty->assign("menu_subnets", $_SESSION['suser_menu_subnets']=='on');
|
||||
$smarty->assign("menu_users", $_SESSION['suser_menu_users']=='on');
|
||||
$smarty->assign("menu_vlans", $_SESSION['suser_menu_vlans']=='on');
|
||||
$smarty->assign("menu_zones", $_SESSION['suser_menu_zones']=='on');
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("header.tpl");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include('lang/' . $_SESSION['suser_language'] . '.php');
|
||||
$smarty->assign($lang);
|
||||
|
||||
// search box
|
||||
if (isset($_POST['search'])) {
|
||||
$search = sanitize($_POST['search']);
|
||||
$_SESSION['search'] = $search;
|
||||
} else {
|
||||
if (isset($_SESSION['search'])) {
|
||||
$search = $_SESSION['search'];
|
||||
} else {
|
||||
$search = '';
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("config_version", $config_version);
|
||||
$smarty->assign("suser_name", $_SESSION['suser_displayname']);
|
||||
$smarty->assign("search", $search);
|
||||
|
||||
// menu
|
||||
$menu = array();
|
||||
if ($_SESSION['suser_menu_assets']) {
|
||||
$menu[] = '<a href="asset.php">' . $lang['lang_assets'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_assetclasses']) {
|
||||
$menu[] = '<a href="assetclass.php">' . $lang['lang_assetclasses'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_assetclassgroups']) {
|
||||
$menu[] = '<a href="assetclassgroup.php">' . $lang['lang_assetclassgroups'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_locations']) {
|
||||
$menu[] = '<a href="location.php">' . $lang['lang_locations'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_nodes']) {
|
||||
$menu[] = '<a href="node.php">' . $lang['lang_nodes'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_subnets']) {
|
||||
$menu[] = '<a href="subnet.php">' . $lang['lang_subnets'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_vlans']) {
|
||||
$menu[] = '<a href="vlan.php">' . $lang['lang_vlans'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_cables']) {
|
||||
$menu[] = '<a href="cable.php">' . $lang['lang_cables'] . "</a>\n";
|
||||
}
|
||||
if ($_SESSION['suser_menu_zones']) {
|
||||
$menu[] = '<a href="zone.php">' . $lang['lang_zones'] . "</a>\n";
|
||||
}
|
||||
$smarty->assign("menu", implode(' | ', $menu));
|
||||
|
||||
$smarty->display("header.tpl");
|
||||
?>
|
||||
|
||||
174
image.php
@@ -1,109 +1,81 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
if(isset($_GET['icon'])) {
|
||||
$icon = sanitize($_GET['icon']);
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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.
|
||||
switch($icon) {
|
||||
case ("add") :
|
||||
$png = 'page_add';
|
||||
break;
|
||||
case ("back") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("cancel") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("comment") :
|
||||
$png = 'comment';
|
||||
break;
|
||||
case ("delete") :
|
||||
$png = 'page_delete';
|
||||
break;
|
||||
case ("shred") :
|
||||
$png = 'bin';
|
||||
break;
|
||||
case ("edit") :
|
||||
$png = 'page_edit';
|
||||
break;
|
||||
case ("error") :
|
||||
$png = 'error';
|
||||
break;
|
||||
case ("help") :
|
||||
$png = 'help';
|
||||
break;
|
||||
case ("logo") :
|
||||
$png = 'logo';
|
||||
break;
|
||||
case ("next") :
|
||||
$png = 'control_fastforward_blue';
|
||||
break;
|
||||
case ("save") :
|
||||
$png = 'page_save';
|
||||
break;
|
||||
case ("search") :
|
||||
$png = 'magnifier';
|
||||
break;
|
||||
}
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
$image = imagecreatefrompng("images/" . $png . ".png");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
imagealphablending($image, true);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
imagesavealpha($image, true);
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
|
||||
if(isset($_GET['color'])) {
|
||||
$color = sanitize($_GET['color']);
|
||||
|
||||
// icon image
|
||||
if(isset($_GET['icon'])) {
|
||||
// get desired image
|
||||
$icon = sanitize($_GET['icon']);
|
||||
|
||||
// switch selected
|
||||
switch($icon) {
|
||||
case ("add") :
|
||||
$png = 'page_add';
|
||||
break;
|
||||
case ("back") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("cancel") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("comment") :
|
||||
$png = 'comment';
|
||||
break;
|
||||
case ("delete") :
|
||||
$png = 'page_delete';
|
||||
break;
|
||||
case ("shred") :
|
||||
$png = 'bin';
|
||||
break;
|
||||
case ("edit") :
|
||||
$png = 'page_edit';
|
||||
break;
|
||||
case ("error") :
|
||||
$png = 'error';
|
||||
break;
|
||||
case ("help") :
|
||||
$png = 'help';
|
||||
break;
|
||||
case ("logo") :
|
||||
$png = 'logo';
|
||||
break;
|
||||
case ("next") :
|
||||
$png = 'control_fastforward_blue';
|
||||
break;
|
||||
case ("save") :
|
||||
$png = 'page_save';
|
||||
break;
|
||||
case ("search") :
|
||||
$png = 'magnifier';
|
||||
break;
|
||||
}
|
||||
|
||||
// get image
|
||||
$image = imagecreatefrompng("images/" . $png . ".png");
|
||||
|
||||
// alpha blending
|
||||
imagealphablending($image, true);
|
||||
|
||||
// save alphablending setting
|
||||
imagesavealpha($image, true);
|
||||
|
||||
// display image
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
$image = imagecreatetruecolor($_SESSION['suser_imagesize'], $_SESSION['suser_imagesize']);
|
||||
|
||||
// colored block
|
||||
if(isset($_GET['color'])) {
|
||||
// get desired color
|
||||
$color = sanitize($_GET['color']);
|
||||
|
||||
// create base image
|
||||
$image = imagecreatetruecolor($_SESSION['suser_imagesize'], $_SESSION['suser_imagesize']);
|
||||
|
||||
// build color
|
||||
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
|
||||
|
||||
// fill image with color
|
||||
imagefill($image, 0, 0, $color);
|
||||
|
||||
// display image
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
?>
|
||||
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
|
||||
|
||||
imagefill($image, 0, 0, $color);
|
||||
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
?>
|
||||
|
||||
BIN
images/admin.png
Normal file
|
After Width: | Height: | Size: 748 B |
BIN
images/arrow_left.png
Normal file
|
After Width: | Height: | Size: 388 B |
BIN
images/arrow_right.png
Normal file
|
After Width: | Height: | Size: 379 B |
BIN
images/asset.png
Normal file
|
After Width: | Height: | Size: 574 B |
BIN
images/brick.png
Normal file
|
After Width: | Height: | Size: 696 B |
BIN
images/bricks.png
Normal file
|
After Width: | Height: | Size: 884 B |
BIN
images/cancel.png
Normal file
|
After Width: | Height: | Size: 587 B |
BIN
images/disconnect.png
Normal file
|
After Width: | Height: | Size: 883 B |
BIN
images/information.png
Normal file
|
After Width: | Height: | Size: 778 B |
BIN
images/manage.png
Normal file
|
After Width: | Height: | Size: 801 B |
BIN
images/note.png
Normal file
|
After Width: | Height: | Size: 500 B |
BIN
images/plugin.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
images/settings.png
Normal file
|
After Width: | Height: | Size: 812 B |
BIN
images/tag-blue.png
Normal file
|
After Width: | Height: | Size: 665 B |
65
includes.php
@@ -1,50 +1,31 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// session
|
||||
// start session
|
||||
session_name('ipreg');
|
||||
session_start();
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// check for user_id, if unnkown, redirect to login
|
||||
if(empty($_SESSION['suser_id'])) {
|
||||
// redirect
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// headers
|
||||
// raw http headers
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
session_name('ipreg');
|
||||
session_start();
|
||||
|
||||
// check for user_id, if unnkown, redirect to login
|
||||
if (empty($_SESSION['suser_id'])) {
|
||||
$_SESSION['prelogin'] = $_SERVER['REQUEST_URI'];
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// includes
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
include("config.php");
|
||||
|
||||
// connect to database
|
||||
$dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charset=utf8", $config_mysql_username, $config_mysql_password);
|
||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
|
||||
// load lib
|
||||
include("lib.php");
|
||||
include("lib.php");
|
||||
|
||||
// set language
|
||||
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
||||
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
||||
|
||||
?>
|
||||
149
index.php
@@ -1,118 +1,43 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(asset.asset_id) AS asset_counter
|
||||
FROM
|
||||
asset";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("asset_counter", $assets[0]['asset_counter']);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(location.location_id) AS location_counter
|
||||
FROM
|
||||
location";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("location_counter", $locations[0]['location_counter']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(node.node_id) AS node_counter
|
||||
FROM
|
||||
node";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("node_counter", $nodes[0]['node_counter']);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(subnet.subnet_id) AS subnet_counter
|
||||
FROM
|
||||
subnet";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("subnet_counter", $subnets[0]['subnet_counter']);
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(vlan.vlan_id) AS vlan_counter
|
||||
FROM
|
||||
vlan";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("vlan_counter", $vlans[0]['vlan_counter']);
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// setup zone
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(zone_id) AS zone_counter
|
||||
FROM
|
||||
zone";
|
||||
|
||||
// run query
|
||||
$zones = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("zone_counter", $zones[0]['zone_counter']);
|
||||
include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("index.tpl");
|
||||
// Statistics
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
// asset
|
||||
$sth = $dbh->query("SELECT COUNT(asset_id) AS asset_counter FROM asset");
|
||||
$smarty->assign("asset_counter", $sth->fetchColumn());
|
||||
|
||||
// location
|
||||
$sth = $dbh->query("SELECT COUNT(location_id) AS location_counter FROM location");
|
||||
$smarty->assign("location_counter", $sth->fetchColumn());
|
||||
|
||||
// node
|
||||
$sth = $dbh->query("SELECT COUNT(node_id) AS node_counter FROM node");
|
||||
$smarty->assign("node_counter", $sth->fetchColumn());
|
||||
|
||||
// subnet
|
||||
$sth = $dbh->query("SELECT COUNT(subnet_id) AS subnet_counter FROM subnet");
|
||||
$smarty->assign("subnet_counter", $sth->fetchColumn());
|
||||
|
||||
// vlan
|
||||
$sth = $dbh->query("SELECT COUNT(vlan_id) AS vlan_counter FROM vlan");
|
||||
$smarty->assign("vlan_counter", $sth->fetchColumn());
|
||||
|
||||
// zone
|
||||
$sth = $dbh->query("SELECT COUNT(zone_id) AS zone_counter FROM zone");
|
||||
$smarty->assign("zone_counter", $sth->fetchColumn());
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
IP Reg Installation
|
||||
|
||||
1. Install requirements
|
||||
Minimum PHP version is 7.4, we are using arrow functions introduced
|
||||
in that version.
|
||||
IP Reg version 0.6 and up depends on smarty template engine.
|
||||
In Debian install ist with: "apt-get install smarty3".
|
||||
The GHP-GD module is also required: "apt-get install php-gd".
|
||||
In Debian install it with: "apt-get install smarty3".
|
||||
The PHP-GD module is also required: "apt-get install php-gd".
|
||||
|
||||
|
||||
2. Create database
|
||||
Create a database for IP Reg on your web server, as well as a MySQL user who
|
||||
@@ -16,27 +19,39 @@ Create database-user for application with minimum necessary rights.
|
||||
CREATE USER 'ipreg'@'localhost' IDENTIFIED BY '********';
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON ipreg.* TO 'ipreg'@'localhost';
|
||||
|
||||
3. Run import
|
||||
|
||||
3. Run database import
|
||||
Import the mysql.sql file into your database, which will create the tables
|
||||
and some sample data.
|
||||
|
||||
mysql ipreg < mysql.sql
|
||||
|
||||
4. Edit config file
|
||||
Open config.php in a text editor and fill in your database details.
|
||||
Optional import some sample data
|
||||
|
||||
5. Upload files
|
||||
Upload all files and directory's (except the install directory) to your
|
||||
mysql ipreg < mysql_sample.sql
|
||||
|
||||
|
||||
4. Upload files
|
||||
Upload all files and directories (except the install directory) to your
|
||||
webserver.
|
||||
|
||||
|
||||
5. Create and edit config file
|
||||
Rename sample configfile config.php-sample:
|
||||
mv config.php-sample config.php
|
||||
|
||||
Open config.php in a text editor and fill in your database details.
|
||||
|
||||
|
||||
6. Check file access rights for security
|
||||
Only directory tpl_c should be writeble by webserver
|
||||
Only directory tpl_c should be writeble by webserver.
|
||||
Configfile should be readable by webserver but not writeable.
|
||||
|
||||
chmod 640 config.php
|
||||
chgrp www-data config.php
|
||||
|
||||
chown www-data tpl_c
|
||||
|
||||
|
||||
7. Start using IP Reg
|
||||
Start your browser and login to IP Reg with the default username/password:
|
||||
admin/admin
|
||||
|
||||
@@ -4,57 +4,85 @@ CREATE TABLE asset (
|
||||
asset_hostname varchar(100) DEFAULT NULL,
|
||||
assetclass_id int(10) NOT NULL,
|
||||
asset_info text DEFAULT NULL,
|
||||
PRIMARY KEY (asset_id)
|
||||
asset_intf smallint(5) UNSIGNED NOT NULL DEFAULT 1,
|
||||
asset_location int(10) DEFAULT NULL,
|
||||
asset_type enum ('active','passive') NOT NULL DEFAULT 'active',
|
||||
PRIMARY KEY (asset_id),
|
||||
INDEX ix_asset_name (asset_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO asset (asset_name, assetclass_id) VALUES
|
||||
('My Computer', 1),
|
||||
('My Server', 2);
|
||||
|
||||
|
||||
CREATE TABLE assetclass (
|
||||
assetclass_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
assetclassgroup_id int(10) NOT NULL,
|
||||
assetclass_name varchar(100) NOT NULL,
|
||||
PRIMARY KEY (assetclass_id)
|
||||
PRIMARY KEY (assetclass_id),
|
||||
INDEX ix_assetclass_name (assetclass_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
|
||||
(1, 'PC'),
|
||||
(2, 'Server');
|
||||
|
||||
|
||||
CREATE TABLE assetclassgroup (
|
||||
assetclassgroup_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
assetclassgroup_name varchar(100) NOT NULL,
|
||||
assetclassgroup_color varchar(6) NOT NULL DEFAULT '000000',
|
||||
PRIMARY KEY (assetclassgroup_id)
|
||||
assetclassgroup_color char(6) NOT NULL DEFAULT '000000',
|
||||
assetclassgroup_description varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (assetclassgroup_id),
|
||||
INDEX ix_assetclassgroup_name (assetclassgroup_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
|
||||
('Workstations', '000000'),
|
||||
('Servers', '0000CC');
|
||||
-- WIP
|
||||
CREATE TABLE cable (
|
||||
cable_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
cable_description varchar(100) NOT NULL,
|
||||
cable_from_id int(10) DEFAULT NULL,
|
||||
cable_to_id int(10) DEFAULT NULL,
|
||||
cable_length smallint(5) UNSIGNED DEFAULT NULL,
|
||||
cable_links smallint(5) UNSIGNED DEFAULT 1,
|
||||
cable_type enum('copper','fibre','laser','radio') DEFAULT NULL,
|
||||
cable_color char(6) NOT NULL DEFAULT '000000',
|
||||
cable_info text DEFAULT NULL,
|
||||
PRIMARY KEY (cable_id),
|
||||
UNIQUE INDEX ix_cable_description (cable_description)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- WIP
|
||||
CREATE TABLE cablevlan (
|
||||
cablevlan_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
cable_id int(10) NOT NULL,
|
||||
vlan_id int(10) NOT NULL,
|
||||
PRIMARY KEY (cablevlan_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- WIP
|
||||
-- Reference to external systems
|
||||
CREATE TABLE extlink (
|
||||
extlink_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
asset_id int(10) NOT NULL,
|
||||
extlink_type enum('cdb','zabbix', 'topdesk') NOT NULL DEFAULT 'cdb',
|
||||
extlink_refid int(10) DEFAULT NULL,
|
||||
extlink_uid varchar(65) DEFAULT NULL,
|
||||
PRIMARY KEY (extlink_id),
|
||||
INDEX ix_extlink_asset_id (asset_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE location (
|
||||
location_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
location_name varchar(100) NOT NULL,
|
||||
location_parent int(10) NOT NULL DEFAULT 0,
|
||||
location_info text DEFAULT NULL,
|
||||
location_sort int(11) NOT NULL DEFAULT 0,
|
||||
location_type enum('location', 'building','room','rack') NOT NULL DEFAULT 'location',
|
||||
location_sort smallint(6) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (location_id),
|
||||
KEY location_sort (location_sort)
|
||||
INDEX ix_location_sort (location_sort),
|
||||
INDEX ix_location_name (location_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO location (location_name, location_parent) VALUES
|
||||
('Main Office', 0);
|
||||
|
||||
|
||||
CREATE TABLE nat (
|
||||
nat_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
nat_type int(1) NOT NULL,
|
||||
nat_ext int(10) NOT NULL,
|
||||
nat_int int(10) NOT NULL,
|
||||
nat_ext_port smallint(5) UNSIGNED DEFAULT NULL,
|
||||
nat_int_port smallint(5) UNSIGNED DEFAULT NULL,
|
||||
nat_description varchar(100) DEFAULT NULL,
|
||||
PRIMARY KEY (nat_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -69,14 +97,11 @@ CREATE TABLE node (
|
||||
zone_id int(10) DEFAULT NULL,
|
||||
node_info text DEFAULT NULL,
|
||||
node_type enum('v4','v6') NOT NULL DEFAULT 'v4',
|
||||
PRIMARY KEY (node_id)
|
||||
PRIMARY KEY (node_id),
|
||||
INDEX ix_ip (node_ip),
|
||||
INDEX ix_mac (node_mac)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
|
||||
('192.168.1.2', '001122334455', 1, 1),
|
||||
('192.168.1.1', 'aabbccddeeff', 1, 2);
|
||||
|
||||
|
||||
CREATE TABLE subnet (
|
||||
subnet_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
subnet_address varchar(45) NOT NULL,
|
||||
@@ -86,13 +111,10 @@ CREATE TABLE subnet (
|
||||
subnet_info text DEFAULT NULL,
|
||||
protocol_version tinyint(1) NOT NULL DEFAULT 4,
|
||||
ntp_server varchar(45) DEFAULT NULL,
|
||||
PRIMARY KEY (subnet_id)
|
||||
PRIMARY KEY (subnet_id),
|
||||
UNIQUE INDEX ix_subnet (subnet_address, subnet_mask)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
|
||||
('192.168.0.0', 24);
|
||||
|
||||
|
||||
CREATE TABLE subnetlocation (
|
||||
subnetlocation_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
subnet_id int(10) NOT NULL,
|
||||
@@ -100,7 +122,6 @@ CREATE TABLE subnetlocation (
|
||||
PRIMARY KEY (subnetlocation_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
CREATE TABLE subnetvlan (
|
||||
subnetvlan_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
subnet_id int(10) NOT NULL,
|
||||
@@ -108,14 +129,11 @@ CREATE TABLE subnetvlan (
|
||||
PRIMARY KEY (subnetvlan_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO subnetvlan (subnet_id, vlan_id) VALUES
|
||||
(1, 1);
|
||||
|
||||
|
||||
CREATE TABLE user (
|
||||
user_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
user_realm enum ('local','ldap') NOT NULL DEFAULT 'local',
|
||||
user_name varchar(100) NOT NULL,
|
||||
user_pass varchar(32) NOT NULL,
|
||||
user_pass binary(60) NOT NULL,
|
||||
user_displayname varchar(100) NOT NULL,
|
||||
user_language char(2) NOT NULL DEFAULT 'en',
|
||||
user_imagesize int(3) NOT NULL DEFAULT 6,
|
||||
@@ -124,54 +142,44 @@ CREATE TABLE user (
|
||||
user_dateformat varchar(10) NOT NULL DEFAULT 'd M Y H:i',
|
||||
user_dns1suffix varchar(100) DEFAULT NULL,
|
||||
user_dns2suffix varchar(100) DEFAULT NULL,
|
||||
user_menu_assets varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_assetclasses varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_assetclassgroups varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_locations varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_nodes varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_subnets varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_users varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_vlans varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_menu_zones varchar(2) NOT NULL DEFAULT 'on',
|
||||
user_tooltips varchar(2) NOT NULL DEFAULT 'on',
|
||||
PRIMARY KEY (user_id)
|
||||
user_menu set('asset','cable','class','group','location','nat','node',
|
||||
'subnet','vlan','zone') NOT NULL DEFAULT 'asset,class,group,location,node,subnet,vlan',
|
||||
user_role set('add','edit','delete','manage','admin') DEFAULT NULL,
|
||||
user_flags set('deleted','locked'),
|
||||
PRIMARY KEY (user_id),
|
||||
UNIQUE INDEX ix_username (user_name)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO user (user_name, user_pass, user_displayname, user_imagesize, user_imagecount, user_mac, user_dateformat, user_menu_assets, user_menu_assetclasses, user_menu_assetclassgroups, user_menu_locations, user_menu_nodes, user_menu_subnets, user_menu_users, user_menu_vlans) VALUES
|
||||
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator', 6, 64, 'xxxxxxxxxxxx', 'd M Y H:i', 'on', 'on', 'on', 'on', 'on', 'on', 'on', 'on');
|
||||
|
||||
INSERT INTO user (user_name, user_pass, user_displayname, user_role) VALUES
|
||||
('admin', '$2y$10$HTs0lSaFrfr.q4Gmy5zWfeDg3jhYZkqEGZEnDkMiHZ641nso38mt6', 'Administrator', 'admin');
|
||||
|
||||
CREATE TABLE vlan (
|
||||
vlan_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
vlan_number int(3) NOT NULL,
|
||||
vlan_name varchar(100) NOT NULL,
|
||||
vlan_color char(6) NOT NULL DEFAULT '000000',
|
||||
vlan_info text DEFAULT NULL,
|
||||
PRIMARY KEY (vlan_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO vlan (vlan_number, vlan_name) VALUES
|
||||
(1, 'DEFAULT_VLAN');
|
||||
|
||||
|
||||
CREATE TABLE zone (
|
||||
zone_id int(10) NOT NULL AUTO_INCREMENT,
|
||||
zone_soa varchar(40) CHARACTER SET utf8 NOT NULL,
|
||||
zone_hostmaster varchar(40) CHARACTER SET utf8 NOT NULL,
|
||||
zone_origin varchar(40) CHARACTER SET utf8 NOT NULL,
|
||||
zone_ttl_default varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '3D',
|
||||
zone_refresh varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '8H',
|
||||
zone_retry varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '2H',
|
||||
zone_expire varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '4W',
|
||||
zone_ttl varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '1D',
|
||||
zone_soa varchar(40) NOT NULL,
|
||||
zone_hostmaster varchar(40) NOT NULL,
|
||||
zone_origin varchar(40) NOT NULL,
|
||||
zone_ttl_default varchar(10) NOT NULL DEFAULT '3D',
|
||||
zone_refresh varchar(10) NOT NULL DEFAULT '8H',
|
||||
zone_retry varchar(10) NOT NULL DEFAULT '2H',
|
||||
zone_expire varchar(10) NOT NULL DEFAULT '4W',
|
||||
zone_ttl varchar(10) NOT NULL DEFAULT '1D',
|
||||
zone_serial int(10) unsigned NOT NULL,
|
||||
zone_ns1 varchar(20) CHARACTER SET utf8 NOT NULL,
|
||||
zone_ns2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
|
||||
zone_ns3 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
|
||||
zone_mx1 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
|
||||
zone_mx2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
|
||||
zone_info text CHARACTER SET utf8 DEFAULT NULL,
|
||||
PRIMARY KEY (zone_id)
|
||||
zone_ns1 varchar(20) NOT NULL,
|
||||
zone_ns2 varchar(20) DEFAULT NULL,
|
||||
zone_ns3 varchar(20) DEFAULT NULL,
|
||||
zone_mx1 varchar(20) DEFAULT NULL,
|
||||
zone_mx2 varchar(20) DEFAULT NULL,
|
||||
zone_info text DEFAULT NULL,
|
||||
PRIMARY KEY (zone_id),
|
||||
UNIQUE INDEX ix_zone_origin (zone_origin)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
INSERT INTO zone (zone_soa, zone_origin, zone_hostmaster, zone_serial, zone_ns1) VALUES
|
||||
('ns1.example.com.', 'example.com.', 'hostmaster@example.com', '2023021301', 'ns1.example.com');
|
||||
|
||||
60
install/mysql_sample.sql
Normal file
@@ -0,0 +1,60 @@
|
||||
INSERT INTO asset (asset_name, assetclass_id) VALUES
|
||||
('Computer', 1),
|
||||
('Server', 3),
|
||||
('Printer', 4),
|
||||
('Firewall', 6);
|
||||
|
||||
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
|
||||
(1, 'Desktop'),
|
||||
(1, 'Notebook'),
|
||||
(2, 'Server'),
|
||||
(3, 'Printer'),
|
||||
(4, 'Switch'),
|
||||
(4, 'Firewall'),
|
||||
(5, 'Scanner');
|
||||
|
||||
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
|
||||
('Personal Computer', '000000'),
|
||||
('Servers', '0000CC'),
|
||||
('Periphery', '00CC00'),
|
||||
('Network', 'CCCC00'),
|
||||
('Miscellaneous', 'CC0000');
|
||||
|
||||
INSERT INTO location (location_name, location_parent) VALUES
|
||||
('Main Office', 0),
|
||||
('Branch Office A', 1),
|
||||
('Branch Office B', 1);
|
||||
|
||||
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
|
||||
('192.168.0.10', '001122334455', 1, 1),
|
||||
('192.168.0.11', 'aabbccddeeff', 1, 2),
|
||||
('192.168.0.12', '775544881199', 1, 3),
|
||||
('192.168.0.1', '667755441122', 1, 4),
|
||||
('192.168.1.1', '667755441123', 2, 4),
|
||||
('192.168.10.1', '667755441124', 3, 4),
|
||||
('192.168.20.1', '667755441125', 4, 4);
|
||||
|
||||
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
|
||||
('192.168.0.0', 24),
|
||||
('192.168.1.0', 24),
|
||||
('192.168.10.0', 24),
|
||||
('192.168.20.0', 24);
|
||||
|
||||
INSERT INTO subnetlocation (subnet_id, location_id) VALUES
|
||||
(1, 1),
|
||||
(2, 1),
|
||||
(3, 2),
|
||||
(4, 3);
|
||||
|
||||
INSERT INTO subnetvlan (subnet_id, vlan_id) VALUES
|
||||
(1, 1);
|
||||
|
||||
INSERT INTO user (user_name, user_pass, user_displayname) VALUES
|
||||
('alice', '$2y$10$CTq04qodeKZBgeuShC3E..cEzfh.SDlaoOEUWcCXXHPDvXJ51nGdq', 'Alice'),
|
||||
('bob', '$2y$10$hl4NN4lOyuz7KN0ZjLHbOuCqGi08GVaTvl/RiMcL1mbFqGmtzDN76', 'Bob');
|
||||
|
||||
INSERT INTO vlan (vlan_number, vlan_name) VALUES
|
||||
(1, 'DEFAULT_VLAN');
|
||||
|
||||
INSERT INTO zone (zone_soa, zone_origin, zone_hostmaster, zone_serial, zone_ns1) VALUES
|
||||
('ns1.example.com.', 'example.com.', 'hostmaster.example.com.', '2023021301', 'ns1.example.com');
|
||||
24
install/upgrade.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
IP Reg Upgrading
|
||||
|
||||
This version has still not reached version 1.0 (feature complete).
|
||||
As such, there may be changes at any time.
|
||||
|
||||
There is no database upgrade logic so the database structure has
|
||||
to be compared manually.
|
||||
|
||||
1. Check and upgrade database schema
|
||||
Compare current database schema with the contents of the database
|
||||
creation script "mysql.sql".
|
||||
Create missing objects in your current database.
|
||||
|
||||
2. Install new version
|
||||
Install the new application in a new location.
|
||||
Copy the configuration file "config.php" to new installation.
|
||||
Compare the configuration to the sample config.
|
||||
There may be additional settings that you want to customize.
|
||||
|
||||
3. Switch to new version
|
||||
Rename the old and new directory.
|
||||
|
||||
4. Done
|
||||
If everything works fine you could remove the old directory.
|
||||
45
lang/de.php
@@ -9,6 +9,8 @@ $lang = array(
|
||||
'lang_assetclasses' => 'Objektklassen',
|
||||
'lang_assetclassgroup' => 'Objektklassengruppe',
|
||||
'lang_assetclassgroups' => 'Objektklassengruppen',
|
||||
'lang_cable' => 'Kabel',
|
||||
'lang_cables' => 'Kabel',
|
||||
'lang_location' => 'Standort',
|
||||
'lang_locations' => 'Standorte',
|
||||
'lang_menu' => 'Menü',
|
||||
@@ -27,7 +29,7 @@ $lang = array(
|
||||
'lang_vlans' => 'VLANs',
|
||||
|
||||
'lang_about' => 'Über',
|
||||
'lang_all' => 'Allw',
|
||||
'lang_all' => 'Alle',
|
||||
'lang_cancel' => 'Abbruch',
|
||||
'lang_color' => 'Farbe',
|
||||
'lang_error' => 'Fehler',
|
||||
@@ -44,6 +46,11 @@ $lang = array(
|
||||
'lang_submit' => 'Absenden',
|
||||
'lang_unassigned' => 'Nicht zugeordnet',
|
||||
'lang_warning' => 'Warnung',
|
||||
'lang_description' => 'Beschreibung',
|
||||
'lang_empty' => 'leer',
|
||||
'lang_source' => 'Quelle',
|
||||
'lang_target' => 'Ziel',
|
||||
'lang_length' => 'Länge',
|
||||
|
||||
'lang_asset_add' => 'Objekt hinzufügen',
|
||||
'lang_asset_del' => 'Objekt löschen',
|
||||
@@ -52,6 +59,8 @@ $lang = array(
|
||||
'lang_asset_name' => 'Objektname',
|
||||
'lang_asset_hostname' => 'Hostname',
|
||||
'lang_asset_none' => 'Es sind keine Objekte vorhanden',
|
||||
'lang_asset_intf' => 'Anzahl Schnittstellen',
|
||||
'lang_asset_type' => 'Objekttyp',
|
||||
|
||||
'lang_assetclass_add' => 'Objektklasse hinzufügen',
|
||||
'lang_assetclass_del' => 'Objektklasse löschen',
|
||||
@@ -88,14 +97,20 @@ $lang = array(
|
||||
'lang_location_name' => 'Standortname',
|
||||
'lang_location_parent' => 'Übergeordneter Standort',
|
||||
'lang_sublocation_add' => 'Unterstandort hinzufügen',
|
||||
'lang_location_none' => 'Es sind keine Standorte vorhanden',
|
||||
|
||||
'lang_locationsubnet' => 'Standort/Subnetz',
|
||||
'lang_locationsubnet_edit' => 'Standort/Subnetz bearbeiten',
|
||||
|
||||
'lang_cable_info' => 'Kabelinfo',
|
||||
'lang_cable_type' => 'Kabeltyp',
|
||||
'lang_cable_none' => 'Es sind keine Kabel vorhanden',
|
||||
|
||||
'lang_node_add' => 'Knoten hinzufügen',
|
||||
'lang_node_del' => 'Knoten löschen',
|
||||
'lang_node_edit' => 'Knoten ändern',
|
||||
'lang_node_info' => 'Knoteninfo',
|
||||
'lang_node_none' => 'Es sind keine Knoten vorhanden',
|
||||
'lang_dns1' => 'DNS-Name',
|
||||
'lang_dns2' => 'DNS-Alias',
|
||||
'lang_ip' => 'IP-Adresse',
|
||||
@@ -128,6 +143,7 @@ $lang = array(
|
||||
'lang_subnet_dhcpstart' => 'DHCP Anfang',
|
||||
'lang_subnet_dhcpend' => 'DHCP Ende',
|
||||
'lang_subnet_ntp_server' => 'NTP-Server',
|
||||
'lang_subnet_none' => 'Es sind keine Subnetze vorhanden',
|
||||
|
||||
'lang_subnetlocation' => 'Subnetz/Ort',
|
||||
'lang_subnetlocation_edit' => 'Subnetz/Ort bearbeiten',
|
||||
@@ -141,11 +157,18 @@ $lang = array(
|
||||
'lang_user_name' => 'Benutzername',
|
||||
'lang_user_password' => 'Kennwort',
|
||||
'lang_user_language' => 'Sprache',
|
||||
'lang_user_realm' => 'Realm',
|
||||
'lang_user_roles' => 'Rechte',
|
||||
'lang_user_role_add' => 'Anlegen',
|
||||
'lang_user_role_edit' => 'Bearbeiten',
|
||||
'lang_user_role_delete' => 'Löschen',
|
||||
'lang_user_role_manage' => 'Konfigurieren',
|
||||
'lang_user_role_admin' => 'Adminstration',
|
||||
|
||||
'lang_zone_add' => 'Zone hinzufügen',
|
||||
'lang_zone_del' => 'Zone löschen',
|
||||
'lang_zone_edit' => 'Zone bearbeiten',
|
||||
|
||||
'lang_zone_none' => 'Es sind keine Zonen vorhanden',
|
||||
|
||||
'lang_vlan_add' => 'VLAN hinzufügen',
|
||||
'lang_vlan_del' => 'VLAN löschen',
|
||||
@@ -154,6 +177,7 @@ $lang = array(
|
||||
'lang_vlan_info' => 'VLAN Info',
|
||||
'lang_vlan_new' => 'VLAN Info',
|
||||
'lang_vlan_name' => 'VLAN Name',
|
||||
'lang_vlan_none' => 'Es sind keine VLANs vorhanden',
|
||||
|
||||
'lang_vlansubnet' => 'VLAN/Subnetz',
|
||||
'lang_vlansubnet_edit' => 'VLAN/Subnetz bearbeiten',
|
||||
@@ -167,8 +191,10 @@ $lang = array(
|
||||
'lang_comments_usernameinuse' => 'Benutzername wird bereits verwendet',
|
||||
'lang_comments_invalidpass' => 'Das Kennwort ist falsch',
|
||||
'lang_comments_invalidnewpass' => 'Das neue Kennwort wurde nicht korrekt eingegeben',
|
||||
'lang_comments_accessdenied' => 'Zugriff verweigert. Keine Berechtigung.',
|
||||
|
||||
'lang_options_ipreg' => 'IP Reg Optionen',
|
||||
'lang_options_profile' => 'Aktuelles Benutzerprofil',
|
||||
'lang_options_display' => 'Anzeigeeinstellungen',
|
||||
'lang_options_password' => 'Kennwort ändern',
|
||||
'lang_options_imagesize' => 'Bildgröße',
|
||||
@@ -181,9 +207,9 @@ $lang = array(
|
||||
'lang_options_dateformat' => 'Datumsformat',
|
||||
'lang_options_dateformat_help' => 'Format in which dates are displayed using the php-date-format (see http://www.php.net/date for more info)',
|
||||
'lang_options_dns1suffix' => 'DNS Name suffix',
|
||||
'lang_options_dns1suffix_help' => 'Default DNS Name suffix f<EFBFBD>r neue Knoten',
|
||||
'lang_options_dns1suffix_help' => 'Standard DNS Name Suffix für neue Knoten',
|
||||
'lang_options_dns2suffix' => 'DNS Alias suffix',
|
||||
'lang_options_dns2suffix_help' => 'Default DNS Alias suffix f<EFBFBD>r neue Knoten',
|
||||
'lang_options_dns2suffix_help' => 'Standard DNS Alias Suffix für neue Knoten',
|
||||
'lang_options_currentpassword' => 'Aktuelles Kennwort',
|
||||
'lang_options_currentpassword_help' => 'Bitte geben Sie hier Ihr bisheriges Kennwort ein',
|
||||
'lang_options_newpassword1' => 'Neues Kennwort',
|
||||
@@ -193,7 +219,8 @@ $lang = array(
|
||||
'lang_options_tooltips_help' => 'Tooltips anzeigen',
|
||||
'lang_options_language_help' => 'Sprache für diesen Benutzer',
|
||||
|
||||
'lang_about_sfprojectpage' => 'Sourceforge Project Page',
|
||||
'lang_about_projectpage' => 'Aktuelle Projektseite',
|
||||
'lang_about_sfprojectpage' => 'Sourceforge Projektseite',
|
||||
'lang_about_license' => 'Lizenz',
|
||||
'lang_about_gpl' => 'GNU General Public License (GPL)',
|
||||
'lang_about_smarty' => 'Smarty Template Engine',
|
||||
@@ -202,12 +229,16 @@ $lang = array(
|
||||
'lang_about_license_ext' => 'Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)<br>Copyright (C) 2011-2023 Thomas Hooge<p>This program is free software: you can redistribute it and/or modify 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.<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<p> You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.',
|
||||
|
||||
'lang_about_changelog' => 'Changelog (major changes only)',
|
||||
'lang_about_changelog_v09' => 'v0.9 (mar 2023)',
|
||||
'lang_about_changelog_v09_ext' => '- Changed database interface to PDO / prepared statements<br>- LDAP authentication<br>- User rights<br>- Improved internal menu system',
|
||||
'lang_about_changelog_v08' => 'v0.8 (feb 2023)',
|
||||
'lang_about_changelog_v08_ext' => '- Some small improvements and bugfixing<br>- Code simplification as preparation for big refactoring',
|
||||
'lang_about_changelog_v07' => 'v0.7 (oct 2018)',
|
||||
'lang_about_changelog_v07_ext' => '- Added support for PHP7, switched to mysqli',
|
||||
'lang_about_changelog_v06' => 'v0.6 (may 2011)',
|
||||
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- language support finalized<br />- added german language<br />- some small bug fixes',
|
||||
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- Language support finalized<br>- Added german language<br>- Some small bug fixes',
|
||||
'lang_about_changelog_v05' => 'v0.5 (dec 2009)',
|
||||
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>More user options',
|
||||
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>- More user options',
|
||||
'lang_about_changelog_v04' => 'v0.4 (jun 2008)',
|
||||
'lang_about_changelog_v04_ext' => '- SQL vulnerability fixed<br>- PHP-generated images in subnet overview',
|
||||
'lang_about_changelog_v03' => 'v0.3 (dec 2007)',
|
||||
|
||||
40
lang/en.php
@@ -9,6 +9,8 @@ $lang = array(
|
||||
'lang_assetclasses' => 'Assetclasses',
|
||||
'lang_assetclassgroup' => 'Assetclassgroup',
|
||||
'lang_assetclassgroups' => 'Assetclassgroups',
|
||||
'lang_cable' => 'Cable',
|
||||
'lang_cables' => 'Cables',
|
||||
'lang_location' => 'Location',
|
||||
'lang_locations' => 'Locations',
|
||||
'lang_menu' => 'Menu',
|
||||
@@ -44,6 +46,11 @@ $lang = array(
|
||||
'lang_submit' => 'Submit',
|
||||
'lang_unassigned' => 'Unassigned',
|
||||
'lang_warning' => 'Warning',
|
||||
'lang_description' => 'Description',
|
||||
'lang_empty' => 'empty',
|
||||
'lang_source' => 'Source',
|
||||
'lang_target' => 'Target',
|
||||
'lang_length' => 'Length',
|
||||
|
||||
'lang_asset_add' => 'Add asset',
|
||||
'lang_asset_del' => 'Delete asset',
|
||||
@@ -52,6 +59,8 @@ $lang = array(
|
||||
'lang_asset_name' => 'Asset name',
|
||||
'lang_asset_hostname' => 'Hostname',
|
||||
'lang_asset_none' => 'There are no assets defined',
|
||||
'lang_asset_intf' => 'Number of interfaces',
|
||||
'lang_asset_type' => 'Asset type',
|
||||
|
||||
'lang_assetclass_add' => 'Add assetclass',
|
||||
'lang_assetclass_del' => 'Delete assetclass',
|
||||
@@ -62,7 +71,7 @@ $lang = array(
|
||||
'lang_assetclassgroup_add' => 'Add assetclassgroup',
|
||||
'lang_assetclassgroup_del' => 'Delete assetclassgroup',
|
||||
'lang_assetclassgroup_edit' => 'Modify assetclassgroup',
|
||||
'lang_assetclassgroup_name' => 'Assetclass Groupname',
|
||||
'lang_assetclassgroup_name' => 'Assetclassgroup Name',
|
||||
'lang_assetclassgroup_none' => 'There are no assetclassegroups defined',
|
||||
|
||||
'lang_assignnodetoasset' => 'Assign node to asset',
|
||||
@@ -88,14 +97,20 @@ $lang = array(
|
||||
'lang_location_name' => 'Location name',
|
||||
'lang_location_parent' => 'Parent',
|
||||
'lang_sublocation_add' => 'Add Sub-location',
|
||||
'lang_location_none' => 'There are no locations defined',
|
||||
|
||||
'lang_locationsubnet' => 'Location/Subnet',
|
||||
'lang_locationsubnet_edit' => 'Edit Location/Subnet',
|
||||
|
||||
'lang_cable_info' => 'Cable info',
|
||||
'lang_cable_type' => 'Cable type',
|
||||
'lang_cable_none' => 'There are no cables defined',
|
||||
|
||||
'lang_node_add' => 'Add node',
|
||||
'lang_node_del' => 'Delete node',
|
||||
'lang_node_edit' => 'Modify node',
|
||||
'lang_node_info' => 'Node info',
|
||||
'lang_node_none' => 'There are no nodes defined',
|
||||
'lang_dns1' => 'DNS name',
|
||||
'lang_dns2' => 'DNS Alias',
|
||||
'lang_ip' => 'IP Address',
|
||||
@@ -128,6 +143,7 @@ $lang = array(
|
||||
'lang_subnet_dhcpstart' => 'DHCP Start',
|
||||
'lang_subnet_dhcpend' => 'DHCP End',
|
||||
'lang_subnet_ntp_server' => 'NTP Server',
|
||||
'lang_subnet_none' => 'There are no subnets defined',
|
||||
|
||||
'lang_subnetlocation' => 'Subnet/Location',
|
||||
'lang_subnetlocation_edit' => 'Edit Subnet/Location',
|
||||
@@ -140,10 +156,19 @@ $lang = array(
|
||||
'lang_user_edit' => 'Mofidy user',
|
||||
'lang_user_name' => 'Username',
|
||||
'lang_user_password' => 'Password',
|
||||
'lang_user_language' => 'Language',
|
||||
'lang_user_realm' => 'Realm',
|
||||
'lang_user_roles' => 'Roles',
|
||||
'lang_user_role_add' => 'Add',
|
||||
'lang_user_role_edit' => 'Edit',
|
||||
'lang_user_role_delete' => 'Delete',
|
||||
'lang_user_role_manage' => 'Manage',
|
||||
'lang_user_role_admin' => 'Adminstration',
|
||||
|
||||
'lang_zone_add' => 'Add zone',
|
||||
'lang_zone_del' => 'Delete zone',
|
||||
'lang_zone_edit' => 'Mofidy zone',
|
||||
'lang_zone_none' => 'There are no zones defined',
|
||||
|
||||
'lang_vlan_add' => 'Add VLAN',
|
||||
'lang_vlan_del' => 'Delete VLAN',
|
||||
@@ -152,7 +177,7 @@ $lang = array(
|
||||
'lang_vlan_info' => 'VLAN info',
|
||||
'lang_vlan_new' => 'VLAN info',
|
||||
'lang_vlan_name' => 'VLAN name',
|
||||
'lang_user_language' => 'Language',
|
||||
'lang_vlan_none' => 'There are no VLANs defined',
|
||||
|
||||
'lang_vlansubnet' => 'VLAN/Subnet',
|
||||
'lang_vlansubnet_edit' => 'Edit VLAN/Subnet',
|
||||
@@ -166,8 +191,10 @@ $lang = array(
|
||||
'lang_comments_usernameinuse' => 'Username in use',
|
||||
'lang_comments_invalidpass' => 'Invalid password',
|
||||
'lang_comments_invalidnewpass' => 'Invalid new password',
|
||||
'lang_comments_accessdenied' => 'Access denied',
|
||||
|
||||
'lang_options_ipreg' => 'IP Reg options',
|
||||
'lang_options_profile' => 'Current user profile',
|
||||
'lang_options_display' => 'Display options',
|
||||
'lang_options_password' => 'Change password',
|
||||
'lang_options_imagesize' => 'Imagesize',
|
||||
@@ -192,6 +219,7 @@ $lang = array(
|
||||
'lang_options_tooltips_help' => 'Show tooltips',
|
||||
'lang_options_language_help' => 'Language for this user',
|
||||
|
||||
'lang_about_projectpage' => 'Current Project Page',
|
||||
'lang_about_sfprojectpage' => 'Sourceforge Project Page',
|
||||
'lang_about_license' => 'License',
|
||||
'lang_about_gpl' => 'GNU General Public License (GPL)',
|
||||
@@ -201,12 +229,16 @@ $lang = array(
|
||||
'lang_about_license_ext' => 'Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)<br>Copyright (C) 2011-2023 Thomas Hooge<p>This program is free software: you can redistribute it and/or modify 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.<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<p> You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.',
|
||||
|
||||
'lang_about_changelog' => 'Changelog (major changes only)',
|
||||
'lang_about_changelog_v09' => 'v0.9 (mar 2023)',
|
||||
'lang_about_changelog_v09_ext' => '- Changed database interface to PDO / prepared statements<br>- LDAP authentication<br>- User rights<br>- Improved internal menu system',
|
||||
'lang_about_changelog_v08' => 'v0.8 (feb 2023)',
|
||||
'lang_about_changelog_v08_ext' => '- Some small improvements and bugfixing<br>- Code simplification as preparation for big refactoring',
|
||||
'lang_about_changelog_v07' => 'v0.7 (oct 2018)',
|
||||
'lang_about_changelog_v07_ext' => '- Added support for PHP7, switched to mysqli',
|
||||
'lang_about_changelog_v06' => 'v0.6 (may 2011)',
|
||||
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- language support finalized<br />- added german language<br />- some small bug fixes',
|
||||
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- Language support finalized<br>- Added german language<br>- Some small bug fixes',
|
||||
'lang_about_changelog_v05' => 'v0.5 (dec 2009)',
|
||||
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>More user options',
|
||||
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>- More user options',
|
||||
'lang_about_changelog_v04' => 'v0.4 (jun 2008)',
|
||||
'lang_about_changelog_v04_ext' => '- SQL vulnerability fixed<br>- PHP-generated images in subnet overview',
|
||||
'lang_about_changelog_v03' => 'v0.3 (dec 2007)',
|
||||
|
||||
283
lib.php
@@ -1,48 +1,259 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
// ========== CONSTANT DEFINITIONS ============================================
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// page actions
|
||||
define ('ACT_DEFAULT', 0);
|
||||
define ('ACT_ADD', 1);
|
||||
define ('ACT_VIEW', 2);
|
||||
define ('ACT_EDIT', 3);
|
||||
define ('ACT_DELETE', 4);
|
||||
define ('ACT_COPY', 5);
|
||||
define ('ACT_JOIN', 6);
|
||||
define ('ACT_LEAVE', 7);
|
||||
define ('ACT_EDIT_DETAIL', 8);
|
||||
define ('ACT_DEL_DETAIL', 9);
|
||||
define ('ACT_LINK', 10);
|
||||
define ('ACT_UNLINK', 11);
|
||||
define ('ACT_MAIL', 12);
|
||||
define ('ACT_VIEW_LIST', 13);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
// ========== GLOBAL PAGE START CODE ==========================================
|
||||
|
||||
// functions
|
||||
include("lib/functions.php");
|
||||
// global version string
|
||||
$config_version = 'v0.9';
|
||||
|
||||
// classes
|
||||
// db
|
||||
// load class
|
||||
require("lib/db.class.php");
|
||||
// available languages
|
||||
$config_lang = array('de', 'en');
|
||||
|
||||
// create instance
|
||||
$db = new Db($dblink);
|
||||
include("lib/functions.php");
|
||||
|
||||
// user
|
||||
// load class
|
||||
require("lib/user.class.php");
|
||||
require_once('smarty3/Smarty.class.php');
|
||||
$smarty = new Smarty();
|
||||
$smarty->template_dir = 'tpl';
|
||||
$smarty->compile_dir = 'tpl_c';
|
||||
$smarty->registerPlugin('function', 'treelist', 'print_tree');
|
||||
$smarty->registerPlugin('function', 'msgout', 'msgout');
|
||||
$smarty->assign("suser_name", $_SESSION['suser_displayname']);
|
||||
$smarty->assign("suser_tooltips", $_SESSION['suser_tooltips'] ?? 'off');
|
||||
$smarty->assign("suser_add", $_SESSION['suser_role_add']);
|
||||
$smarty->assign("suser_edit", $_SESSION['suser_role_edit']);
|
||||
$smarty->assign("suser_delete", $_SESSION['suser_role_delete']);
|
||||
$smarty->assign("suser_manage", $_SESSION['suser_role_manage']);
|
||||
$smarty->assign("suser_admin", $_SESSION['suser_role_admin']);
|
||||
|
||||
// create instance
|
||||
$user = new User();
|
||||
// prepare global message system
|
||||
$g_message = new Message;
|
||||
$g_warning = new MessageWarning;
|
||||
$g_error = new MessageError;
|
||||
|
||||
$action = ACT_DEFAULT;
|
||||
|
||||
// ========== FEEDBACK FUNCTIONS ==============================================
|
||||
|
||||
class Message {
|
||||
|
||||
var $count = 0;
|
||||
var $text = array();
|
||||
var $caption;
|
||||
|
||||
function Message() {
|
||||
$this->caption = 'Information';
|
||||
}
|
||||
|
||||
function SetCaption($str) {
|
||||
$this->caption = $str;
|
||||
}
|
||||
|
||||
function Add($msg) {
|
||||
$this->count++;
|
||||
$this->text[$this->count] = $msg;
|
||||
}
|
||||
|
||||
function GetCount() {
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
function PrintOut() {
|
||||
if ($this->count > 0) {
|
||||
echo '<div class="info">', "\n";
|
||||
echo '<h3>', $this->caption, "</h3>\n";
|
||||
echo "<ul>\n";
|
||||
for ($i=1; $i<=$this->count; $i++) {
|
||||
echo "\t<li>", $this->text[$i],"</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MessageWarning extends Message {
|
||||
function MessageWarning() {
|
||||
$this->caption = 'Warning';
|
||||
}
|
||||
function PrintOut() {
|
||||
if ($this->count > 0) {
|
||||
echo '<div class="warning">', "\n";
|
||||
echo '<h3>', $this->caption, "</h3>\n";
|
||||
echo "<ul>\n";
|
||||
for ($i=1; $i<=$this->count; $i++) {
|
||||
echo "\t<li>", $this->text[$i],"</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MessageError extends Message {
|
||||
function MessageError() {
|
||||
$this->caption = 'Error';
|
||||
}
|
||||
function PrintOut() {
|
||||
if ($this->count > 0) {
|
||||
echo '<div class="error">', "\n";
|
||||
echo '<h3>', $this->caption, "</h3>\n";
|
||||
echo "<ul>\n";
|
||||
for ($i=1; $i<=$this->count; $i++) {
|
||||
echo "\t<li>", $this->text[$i],"</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========== FORM FUNCTIONS ==================================================
|
||||
|
||||
function form_get_action() {
|
||||
if (!isset($_POST['submit'])) {
|
||||
if (isset($_GET['f'])) {
|
||||
$submit = $_GET['f'];
|
||||
} else {
|
||||
$submit = NULL;
|
||||
}
|
||||
} else {
|
||||
$submit = $_POST['submit'];
|
||||
}
|
||||
if (is_array($submit)) {
|
||||
$submit = key($submit);
|
||||
}
|
||||
return strtolower($submit);
|
||||
}
|
||||
|
||||
function submit_error($action) {
|
||||
/* Submit buttons that return an unknown value end up in this
|
||||
function by default. An exit() is conscious here *not* installed,
|
||||
since it could be that despite such an error the program
|
||||
execution should be continued. */
|
||||
return sprintf('The action "%s" is unknown. It is probably a program error.<br /> Please inform your administrator of the exact circumstances of how this situation came about.', strtoupper($action));
|
||||
}
|
||||
|
||||
// ========== DATABASE FUCTIONS ===============================================
|
||||
|
||||
function db_load_enum($table, $column) {
|
||||
// returns array of enum-values as defined in database
|
||||
global $dbh;
|
||||
$sql = "SELECT TRIM(TRAILING ')' FROM SUBSTRING(column_type,6))
|
||||
FROM information_schema.columns
|
||||
WHERE table_name=? AND column_name=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$table, $column]);
|
||||
return array_map(fn($x) => trim($x, "'"), explode(',', $sth->fetchColumn()));
|
||||
}
|
||||
|
||||
function db_get_options_asset() {
|
||||
global $dbh;
|
||||
$sql = "SELECT asset_id, asset_name FROM asset ORDER BY asset_name";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_assetclass() {
|
||||
global $dbh;
|
||||
$sql = "SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_assetclassgroup() {
|
||||
global $dbh;
|
||||
$sql = "SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_location($default = NULL) {
|
||||
global $dbh;
|
||||
$options = array();
|
||||
if ($default != NULL) {
|
||||
$options[0] = $default;
|
||||
}
|
||||
$sql = "SELECT location_id, location_name FROM location ORDER BY location_name";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_subnet() {
|
||||
global $dbh;
|
||||
$sql = "SELECT subnet_id,
|
||||
CONCAT_WS('/', subnet_address, subnet_mask) AS subnet_name
|
||||
FROM subnet
|
||||
ORDER BY INET_ATON(subnet_address)";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_vlan($default = NULL) {
|
||||
global $dbh;
|
||||
$options = array();
|
||||
if ($default != NULL) {
|
||||
$options[0] = $default;
|
||||
}
|
||||
$sql = "SELECT vlan_id, vlan_name FROM vlan ORDER BY vlan_name";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function db_get_options_zone($default = NULL) {
|
||||
global $dbh;
|
||||
$options = array();
|
||||
if ($default != NULL) {
|
||||
$options[0] = $default;
|
||||
}
|
||||
$sql = "SELECT zone_id, zone_origin FROM zone ORDER BY zone_origin";
|
||||
$sth = $dbh->query($sql);
|
||||
foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
|
||||
$options[$rec[0]] = $rec[1];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
// tpl
|
||||
require_once('smarty3/Smarty.class.php');
|
||||
$smarty = new Smarty();
|
||||
$smarty->template_dir = 'tpl';
|
||||
$smarty->compile_dir = 'tpl_c';
|
||||
$smarty->registerPlugin('function', 'treelist', 'print_tree');
|
||||
$smarty->assign("suser_tooltips", $_SESSION['suser_tooltips']);
|
||||
?>
|
||||
|
||||
173
lib/db.class.php
@@ -1,173 +0,0 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
class Db {
|
||||
|
||||
protected $dblink;
|
||||
|
||||
public function __construct ($dblink) {
|
||||
$this->dblink = $dblink;
|
||||
}
|
||||
|
||||
function db_delete($query) {
|
||||
// run query
|
||||
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
|
||||
}
|
||||
|
||||
function db_insert($query) {
|
||||
// run query
|
||||
echo "<pre>$query</pre>";
|
||||
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
|
||||
|
||||
// return result
|
||||
return mysqli_insert_id($this->dblink);
|
||||
}
|
||||
|
||||
function db_select($query) {
|
||||
// run query
|
||||
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
|
||||
|
||||
// loop results
|
||||
$result = array();
|
||||
while($record = mysqli_fetch_assoc($sql)) {
|
||||
$result[] = $record;
|
||||
}
|
||||
|
||||
// return array
|
||||
return $result;
|
||||
}
|
||||
|
||||
function db_update($query) {
|
||||
// run query
|
||||
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
|
||||
}
|
||||
|
||||
function options_asset($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT asset_id, asset_name
|
||||
FROM asset
|
||||
ORDER BY asset_name";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['asset_id']] = $rec['asset_name'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_assetclass($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT assetclass_id, assetclass_name
|
||||
FROM assetclass
|
||||
ORDER BY assetclass_name";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['assetclass_id']] = $rec['assetclass_name'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_assetclassgroup($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT assetclassgroup_id, assetclassgroup_name
|
||||
FROM assetclassgroup
|
||||
ORDER BY assetclassgroup_name";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['assetclassgroup_id']] = $rec['assetclassgroup_name'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_location($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT location_id,
|
||||
location_name
|
||||
FROM location
|
||||
ORDER BY location_name";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['location_id']] = $rec['location_name'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_subnet($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT subnet_id,
|
||||
CONCAT_WS('/', subnet_address, subnet_mask) AS subnet_name
|
||||
FROM subnet
|
||||
ORDER BY INET_ATON(subnet_address)";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['subnet_id']] = $rec['subnet_name'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_vlan($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT vlan_id,
|
||||
CONCAT_WS(' - ', vlan_number, vlan_name) AS vlan_option
|
||||
FROM vlan
|
||||
ORDER BY vlan_number";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['vlan_id']] = $rec['vlan_option'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_zone($null_value=NULL) {
|
||||
$options = array();
|
||||
if (isset($null_value)) {
|
||||
$options[0] = $null_value;
|
||||
}
|
||||
$sql = "SELECT zone_id, zone_origin
|
||||
FROM zone
|
||||
ORDER BY zone_origin";
|
||||
$records = $this->db_select($sql);
|
||||
foreach ($records as $rec) {
|
||||
$options[$rec['zone_id']] = $rec['zone_origin'];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,170 +1,163 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
// strip mac address to 12 char string
|
||||
function strip_mac($mac) {
|
||||
// strip chars we don't need
|
||||
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// capitalize (just because it looks better eh)
|
||||
$mac = strtoupper($mac);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
// and return
|
||||
return ($mac);
|
||||
}
|
||||
|
||||
// strip mac address to 12 char string
|
||||
function strip_mac($mac) {
|
||||
// strip chars we don't need
|
||||
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
|
||||
|
||||
// capitalize (just because it looks better eh)
|
||||
$mac = strtoupper($mac);
|
||||
|
||||
// and return
|
||||
return ($mac);
|
||||
}
|
||||
|
||||
// rebuild mac address
|
||||
function write_mac($mac) {
|
||||
// check string length
|
||||
if (strlen($mac)!=12) {
|
||||
// if the MAC is empty, or for whatever reason incorrect, just return
|
||||
return $mac;
|
||||
} else {
|
||||
// count to 12...
|
||||
for($i=0;$i<12;$i++) {
|
||||
// ... and strip mac to pieces
|
||||
${"mac".$i} = $mac{$i};
|
||||
}
|
||||
|
||||
// get user preference
|
||||
$user_mac = $_SESSION['suser_mac'];
|
||||
|
||||
// count to 12 again...
|
||||
for($i=0;$i<12;$i++) {
|
||||
// ... and replace user preference with pieces
|
||||
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
|
||||
}
|
||||
|
||||
// and return
|
||||
return $user_mac;
|
||||
}
|
||||
}
|
||||
|
||||
// redirect page
|
||||
function header_location($location) {
|
||||
// send header
|
||||
header("location: " . $location);
|
||||
|
||||
// exit to be sure
|
||||
exit;
|
||||
}
|
||||
|
||||
// sanitize input
|
||||
function sanitize($input) {
|
||||
global $dblink;
|
||||
|
||||
// trim whitespaces
|
||||
$input = @trim($input);
|
||||
|
||||
// magic quotes enabled?
|
||||
if(get_magic_quotes_gpc()) {
|
||||
// strip slashes
|
||||
$input = stripslashes($input);
|
||||
// rebuild mac address
|
||||
function write_mac($mac) {
|
||||
// check string length
|
||||
if (strlen($mac)!=12) {
|
||||
// if the MAC is empty, or for whatever reason incorrect, just return
|
||||
return $mac;
|
||||
} else {
|
||||
// count to 12...
|
||||
for ($i=0; $i<12; $i++) {
|
||||
// ... and strip mac to pieces
|
||||
${"mac".$i} = $mac{$i};
|
||||
}
|
||||
|
||||
// convert to utf-8
|
||||
iconv("UTF-8", "UTF-8", $input);
|
||||
// get user preference
|
||||
$user_mac = $_SESSION['suser_mac'];
|
||||
|
||||
// convert special chars
|
||||
$input = htmlentities($input,ENT_QUOTES,'UTF-8');
|
||||
|
||||
// make sql ready
|
||||
$input = mysqli_real_escape_string($dblink, $input);
|
||||
// count to 12 again...
|
||||
for($i=0; $i<12; $i++) {
|
||||
// ... and replace user preference with pieces
|
||||
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
|
||||
}
|
||||
|
||||
// and return
|
||||
return $user_mac;
|
||||
}
|
||||
}
|
||||
|
||||
// redirect page
|
||||
function header_location($location) {
|
||||
// send header
|
||||
header("location: " . $location);
|
||||
|
||||
// exit to be sure
|
||||
exit;
|
||||
}
|
||||
|
||||
// sanitize input
|
||||
function sanitize($input) {
|
||||
global $dblink;
|
||||
|
||||
// trim whitespaces
|
||||
$input = @trim($input);
|
||||
|
||||
// magic quotes enabled?
|
||||
if(get_magic_quotes_gpc()) {
|
||||
// strip slashes
|
||||
$input = stripslashes($input);
|
||||
}
|
||||
|
||||
// convert to utf-8
|
||||
iconv("UTF-8", "UTF-8", $input);
|
||||
|
||||
// convert special chars
|
||||
$input = htmlentities($input,ENT_QUOTES,'UTF-8');
|
||||
|
||||
// and return
|
||||
return $input;
|
||||
}
|
||||
|
||||
function mysql_nullstring($input) {
|
||||
if (isset($input)) {
|
||||
return $input;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function mysql_nullstring($input) {
|
||||
if (isset($input)) {
|
||||
return $input;
|
||||
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
|
||||
if ($lang_variable === null) {
|
||||
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
}
|
||||
if (empty($lang_variable)) {
|
||||
return $default_language;
|
||||
}
|
||||
$accepted_languages = preg_split('/,\s*/', $lang_variable);
|
||||
$current_lang = $default_language;
|
||||
$current_q = 0;
|
||||
foreach ($accepted_languages as $accepted_language) {
|
||||
$res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
|
||||
$accepted_language, $matches);
|
||||
if (!$res) {
|
||||
continue;
|
||||
}
|
||||
$lang_code = explode ('-', $matches[1]);
|
||||
if (isset($matches[2])) {
|
||||
$lang_quality = (float)$matches[2];
|
||||
} else {
|
||||
return '';
|
||||
$lang_quality = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
|
||||
if ($lang_variable === null) {
|
||||
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
|
||||
}
|
||||
if (empty($lang_variable)) {
|
||||
return $default_language;
|
||||
}
|
||||
$accepted_languages = preg_split('/,\s*/', $lang_variable);
|
||||
$current_lang = $default_language;
|
||||
$current_q = 0;
|
||||
foreach ($accepted_languages as $accepted_language) {
|
||||
$res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
|
||||
$accepted_language, $matches);
|
||||
if (!$res) {
|
||||
continue;
|
||||
}
|
||||
$lang_code = explode ('-', $matches[1]);
|
||||
if (isset($matches[2])) {
|
||||
$lang_quality = (float)$matches[2];
|
||||
} else {
|
||||
$lang_quality = 1.0;
|
||||
}
|
||||
while (count ($lang_code)) {
|
||||
if (in_array (strtolower (join ('-', $lang_code)), $allowed_languages)) {
|
||||
if ($lang_quality > $current_q) {
|
||||
$current_lang = strtolower (join ('-', $lang_code));
|
||||
$current_q = $lang_quality;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($strict_mode) {
|
||||
while (count ($lang_code)) {
|
||||
if (in_array (strtolower (join ('-', $lang_code)), $allowed_languages)) {
|
||||
if ($lang_quality > $current_q) {
|
||||
$current_lang = strtolower (join ('-', $lang_code));
|
||||
$current_q = $lang_quality;
|
||||
break;
|
||||
}
|
||||
array_pop ($lang_code);
|
||||
}
|
||||
}
|
||||
return $current_lang;
|
||||
}
|
||||
|
||||
function print_tree_rec($tree, $level) {
|
||||
$output = '<ul class="treelvl' . $level. '">' . "\n";
|
||||
foreach ($tree as $node) {
|
||||
$output .= '<li><a href="' . $node['href'] . '">' . $node['value'] . '</a>';
|
||||
if ($node['children']) {
|
||||
$output .= "\n" . print_tree_rec($node['children'], $level+1);
|
||||
if ($strict_mode) {
|
||||
break;
|
||||
}
|
||||
$output .= "</li>\n";
|
||||
array_pop ($lang_code);
|
||||
}
|
||||
$output .= "</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
return $current_lang;
|
||||
}
|
||||
|
||||
function print_tree ($params, &$smarty) {
|
||||
if (empty($params['level'])) {
|
||||
$level = 0;
|
||||
} else {
|
||||
$level = $params['level'];
|
||||
}
|
||||
if (empty($params['tree'])) {
|
||||
return '';
|
||||
} else {
|
||||
return print_tree_rec($params['tree'], $level);
|
||||
function print_tree_rec($tree, $level) {
|
||||
$output = '<ul class="treelvl' . $level. '">' . "\n";
|
||||
foreach ($tree as $node) {
|
||||
$output .= '<li><a href="' . $node['href'] . '">' . $node['value'] . '</a>';
|
||||
if ($node['children']) {
|
||||
$output .= "\n" . print_tree_rec($node['children'], $level+1);
|
||||
}
|
||||
$output .= "</li>\n";
|
||||
}
|
||||
$output .= "</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
//function print_tree($params, &$smarty) {
|
||||
function print_tree($params, Smarty_Internal_Template $template) {
|
||||
if (empty($params['level'])) {
|
||||
$level = 0;
|
||||
} else {
|
||||
$level = $params['level'];
|
||||
}
|
||||
if (empty($params['tree'])) {
|
||||
return '';
|
||||
} else {
|
||||
return print_tree_rec($params['tree'], $level);
|
||||
}
|
||||
}
|
||||
|
||||
function msgout(array $parameters, Smarty_Internal_Template $smarty)
|
||||
{
|
||||
// This is just a quick hack around missing {php} in Smarty3
|
||||
$GLOBALS['g_error']->PrintOut();
|
||||
$GLOBALS['g_warning']->PrintOut();
|
||||
$GLOBALS['g_message']->PrintOut();
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
class User {
|
||||
function check_strlen($string) {
|
||||
// check length
|
||||
if(strlen($string)<1) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function user_login($user_name, $user_pass) {
|
||||
global $dblink;
|
||||
// check user_name length
|
||||
if($this->check_strlen($user_name)==FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// check user_pass length
|
||||
if($this->check_strlen($user_pass)==FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// get user data
|
||||
// initiate class
|
||||
$db = new Db($dblink);
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
user.user_id,
|
||||
user.user_pass,
|
||||
user.user_displayname,
|
||||
user.user_language,
|
||||
user.user_imagesize,
|
||||
user.user_imagecount,
|
||||
user.user_mac,
|
||||
user.user_dateformat,
|
||||
user.user_dns1suffix,
|
||||
user.user_dns2suffix,
|
||||
user.user_menu_assets,
|
||||
user.user_menu_assetclasses,
|
||||
user.user_menu_assetclassgroups,
|
||||
user.user_menu_locations,
|
||||
user.user_menu_nodes,
|
||||
user.user_menu_subnets,
|
||||
user.user_menu_users,
|
||||
user.user_menu_vlans,
|
||||
user.user_menu_zones,
|
||||
user.user_tooltips
|
||||
FROM
|
||||
user
|
||||
WHERE
|
||||
user.user_name='" . $user_name . "'";
|
||||
|
||||
// run query
|
||||
$users = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$user_counter = count($users);
|
||||
|
||||
// any users?
|
||||
if ($user_counter>0) {
|
||||
// compare passwords
|
||||
if(!strcmp(md5($user_pass), $users[0]['user_pass'])) {
|
||||
// all ok: user is logged in, register session data
|
||||
$_SESSION['suser_id'] = $users[0]['user_id'];
|
||||
$_SESSION['suser_displayname'] = $users[0]['user_displayname'];
|
||||
$_SESSION['suser_language'] = $users[0]['user_language'];
|
||||
$_SESSION['suser_imagesize'] = $users[0]['user_imagesize'];
|
||||
$_SESSION['suser_imagecount'] = $users[0]['user_imagecount'];
|
||||
$_SESSION['suser_mac'] = $users[0]['user_mac'];
|
||||
$_SESSION['suser_dateformat'] = $users[0]['user_dateformat'];
|
||||
$_SESSION['suser_dns1suffix'] = $users[0]['user_dns1suffix'];
|
||||
$_SESSION['suser_dns2suffix'] = $users[0]['user_dns2suffix'];
|
||||
$_SESSION['suser_menu_assets'] = $users[0]['user_menu_assets'];
|
||||
$_SESSION['suser_menu_assetclasses'] = $users[0]['user_menu_assetclasses'];
|
||||
$_SESSION['suser_menu_assetclassgroups'] = $users[0]['user_menu_assetclassgroups'];
|
||||
$_SESSION['suser_menu_locations'] = $users[0]['user_menu_locations'];
|
||||
$_SESSION['suser_menu_nodes'] = $users[0]['user_menu_nodes'];
|
||||
$_SESSION['suser_menu_subnets'] = $users[0]['user_menu_subnets'];
|
||||
$_SESSION['suser_menu_users'] = $users[0]['user_menu_users'];
|
||||
$_SESSION['suser_menu_vlans'] = $users[0]['user_menu_vlans'];
|
||||
$_SESSION['suser_menu_zones'] = $users[0]['user_menu_zones'];
|
||||
$_SESSION['suser_tooltips'] = $users[0]['user_tooltips'];
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// no errors found, return
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function user_logout() {
|
||||
// clear and destroy session
|
||||
$_SESSION = array();
|
||||
}
|
||||
}
|
||||
?>
|
||||
96
location.php
@@ -1,70 +1,42 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$sql = "SELECT location_id AS id, location_name AS value, location_parent AS parent_id
|
||||
FROM location
|
||||
ORDER BY location_parent, location_sort, location_name";
|
||||
$sth = $dbh->query($sql);
|
||||
$locations = $sth->fetchAll();
|
||||
|
||||
// start location
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location_id AS id,
|
||||
location_name AS value,
|
||||
location_parent AS parent_id
|
||||
FROM
|
||||
location
|
||||
ORDER BY location_parent, location_sort, location_name";
|
||||
// function for recursion
|
||||
function build_tree($parent_id, $level) {
|
||||
global $locations;
|
||||
$children = array();
|
||||
foreach ($locations as $key => $location) {
|
||||
if ($location['parent_id'] == $parent_id) {
|
||||
unset($location['parent_id']);
|
||||
$location['children'] = build_tree($location['id'], $level+1);
|
||||
$location['level'] = $level;
|
||||
$location['href'] = 'locationview.php?location_id=' . $location['id'];
|
||||
$children[] = $location;
|
||||
}
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
$tree = build_tree(0, 0);
|
||||
$smarty->assign("locations", $tree);
|
||||
|
||||
function build_tree($parent_id, $level) {
|
||||
global $locations;
|
||||
$children = array();
|
||||
foreach ($locations as $key => $location) {
|
||||
if ($location['parent_id'] == $parent_id) {
|
||||
unset($location['parent_id']);
|
||||
$location['children'] = build_tree($location['id'], $level+1);
|
||||
$location['level'] = $level;
|
||||
$location['href'] = 'locationview.php?location_id=' . $location['id'];
|
||||
$children[] = $location;
|
||||
}
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
$tree = build_tree(0, 0);
|
||||
$smarty->assign("locations", $tree);
|
||||
$smarty->display("location.tpl");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("location.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
154
locationadd.php
@@ -1,109 +1,75 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_parent = sanitize($_GET['location_parent']);
|
||||
$location_parent = sanitize($_GET['location_parent']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
include("header.php");
|
||||
|
||||
|
||||
// ************* <option value="0">{$lang_option_none}</option>
|
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name,
|
||||
location_parent AS parent, location_sort AS sort
|
||||
FROM location
|
||||
ORDER BY location_parent, location_sort, location_name";
|
||||
$sth = $dbh->query($sql);
|
||||
$locations = $sth->fetchAll();
|
||||
|
||||
// start parent
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT location_id, location_name, location_parent, location_sort
|
||||
FROM location
|
||||
ORDER BY location_parent, location_sort, location_name";
|
||||
if (count($locations) > 0) {
|
||||
foreach ($locations AS $location) {
|
||||
$location_names[$location['id']] = $location['name'];
|
||||
$parents[$location['parent']][] = $location['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
foreach ($parents[$parent] as $child) {
|
||||
if (isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
global $location_options;
|
||||
global $location_names;
|
||||
global $location_parent;
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
global $location_options;
|
||||
global $location_names;
|
||||
global $location_parent;
|
||||
|
||||
foreach ($locations as $parent=>$child) {
|
||||
$row = str_repeat("- ", $level) . $location_names[$parent];
|
||||
$location_options[$parent] = $row;
|
||||
if(isset($child)) {
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
foreach ($locations as $parent=>$child) {
|
||||
$row = str_repeat("- ", $level) . $location_names[$parent];
|
||||
$location_options[$parent] = $row;
|
||||
if (isset($child)) {
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tree = location($parents);
|
||||
$location_options = array(0 => '-');
|
||||
checkchildren($tree, 0);
|
||||
$smarty->assign("location_options", $location_options);
|
||||
$smarty->assign("location_parent", $location_parent);
|
||||
$tree = location($parents);
|
||||
|
||||
// create tree option list
|
||||
$location_options = array(0 => '-');
|
||||
checkchildren($tree, 0);
|
||||
|
||||
$smarty->assign("location_options", $location_options);
|
||||
$smarty->assign("location_parent", $location_parent);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationadd.tpl");
|
||||
$smarty->display("locationadd.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,58 +1,24 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationdel.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name FROM location WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("locationdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
221
locationedit.php
@@ -1,137 +1,98 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location_name,
|
||||
location_parent,
|
||||
location_info,
|
||||
location_sort
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// get parent
|
||||
$location_parent = $location[0]['location_parent'];
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
$smarty->assign("location_info", $location[0]['location_info']);
|
||||
$smarty->assign("location_sort", $location[0]['location_sort']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup parent location
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$smarty->assign("location_counter", $location_counter);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
global $location_options;
|
||||
global $location_names;
|
||||
global $location_parent;
|
||||
|
||||
foreach ($locations as $parent=>$child) {
|
||||
$row = str_repeat("- ", $level) . $location_names[$parent];
|
||||
$location_options[$parent] = $row;
|
||||
if(isset($child)) {
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tree = location($parents);
|
||||
$location_options = array(0 => '-');
|
||||
checkchildren($tree, 0);
|
||||
$smarty->assign("location_options", $location_options);
|
||||
$smarty->assign("location_parent", $location_parent);
|
||||
include("header.php");
|
||||
|
||||
// location
|
||||
$sql = "SELECT location_id AS id, location_name AS name, location_parent AS parent,
|
||||
location_info AS info, location_sort AS sort
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$location = $sth->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationedit.tpl");
|
||||
$location_parent = $location->parent;
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$smarty->assign("location", $location);
|
||||
|
||||
/*$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
$smarty->assign("location_info", $location[0]['location_info']);
|
||||
$smarty->assign("location_sort", $location[0]['location_sort']); */
|
||||
|
||||
// parent location
|
||||
$sql = "SELECT location_id, location_name, location_parent
|
||||
FROM location
|
||||
WHERE location_id != ?
|
||||
ORDER BY location_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
|
||||
$locations = $sth->fetchAll();
|
||||
|
||||
$location_counter = count($locations);
|
||||
|
||||
$smarty->assign("location_counter", $location_counter);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
foreach($locations AS $location) {
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
global $location_options;
|
||||
global $location_names;
|
||||
global $location_parent;
|
||||
|
||||
foreach ($locations as $parent=>$child) {
|
||||
$row = str_repeat("- ", $level) . $location_names[$parent];
|
||||
$location_options[$parent] = $row;
|
||||
if(isset($child)) {
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tree = location($parents);
|
||||
$location_options = array(0 => '-');
|
||||
checkchildren($tree, 0);
|
||||
$smarty->assign("location_options", $location_options);
|
||||
$smarty->assign("location_parent", $location_parent);
|
||||
|
||||
$smarty->display("locationedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,60 +1,28 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup subnet
|
||||
$smarty->assign("subnet_options", $db->options_subnet());
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationsubnetadd.tpl");
|
||||
include("includes.php");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->assign("subnet_options", db_get_options_subnet());
|
||||
|
||||
$smarty->display("locationsubnetadd.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,76 +1,44 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnetlocation,
|
||||
subnet
|
||||
WHERE
|
||||
subnetlocation.location_id=" . $location_id . "
|
||||
AND subnet.subnet_id=subnetlocation.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
$smarty->assign($subnets);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationsubnetdel.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
// location
|
||||
$sql = "SELECT location_id AS id, location_name AS name
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
|
||||
// subnet
|
||||
$sql = "SELECT
|
||||
s.subnet_id,
|
||||
s.subnet_address,
|
||||
s.subnet_mask
|
||||
FROM
|
||||
subnetlocation AS l LEFT JOIN subnet AS s USING (subnet_id)
|
||||
WHERE
|
||||
l.location_id=?
|
||||
ORDER BY
|
||||
INET_ATON(s.subnet_address)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
|
||||
$smarty->assign($sth->fetchAll());
|
||||
|
||||
$smarty->display("locationsubnetdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,58 +1,26 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_name", $location[0]['location_name']);
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT location_id AS id, location_name AS name
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("location", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationsubnetedit.tpl");
|
||||
$smarty->display("locationsubnetedit.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
157
locationview.php
@@ -1,110 +1,67 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
if ((isset($_GET['id'])) ? $id = sanitize($_GET['id']) : $id = '');
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// start locationcrumb
|
||||
// get location crumbs
|
||||
// base location
|
||||
$sql = "SELECT location_id AS id, location_name AS name,
|
||||
location_parent AS parent_id, location_info AS info,
|
||||
CONCAT('locationview.php?location_id=', location_id) AS url
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$location = $sth->fetch(PDO::FETCH_OBJ);
|
||||
$smarty->assign("location", $location);
|
||||
|
||||
$query = "SELECT location_id AS id,
|
||||
location_name AS name,
|
||||
location_parent AS parent_id,
|
||||
location_info
|
||||
FROM location
|
||||
WHERE location_id=" . $location_id;
|
||||
$location = $db->db_select($query);
|
||||
$location[0]['url'] = 'locationview.php?location_id=' . $location[0]['id'];
|
||||
$crumbs[] = $location[0];
|
||||
$level = 1;
|
||||
while ($crumbs[0]['parent_id'] != 0) {
|
||||
$query = "SELECT location_id AS id,
|
||||
location_name AS name,
|
||||
location_parent AS parent_id
|
||||
FROM location
|
||||
WHERE location_id=" . $crumbs[0]['parent_id'];
|
||||
$result = $db->db_select($query);
|
||||
$result[0]['url'] = 'locationview.php?location_id=' . $result[0]['id'];
|
||||
array_unshift($crumbs, $result[0]);
|
||||
$level++;
|
||||
}
|
||||
// crumbs
|
||||
$crumbs[] = $location;
|
||||
$sql = "SELECT location_id AS id, location_name AS name,
|
||||
location_parent AS parent_id,
|
||||
CONCAT('locationview.php?location_id=', location_id) AS url
|
||||
FROM location
|
||||
WHERE location_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
while ($crumbs[0]->parent_id != 0) {
|
||||
$sth->execute([$crumbs[0]->parent_id]);
|
||||
$result = $sth->fetch(PDO::FETCH_OBJ);
|
||||
array_unshift($crumbs, $result);
|
||||
}
|
||||
$smarty->assign("crumbs", $crumbs);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("location_id", $location_id);
|
||||
$smarty->assign("location_info", nl2br($location[0]['location_info']));
|
||||
$smarty->assign("crumbs", $crumbs);
|
||||
|
||||
|
||||
// setup sublocations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location_id AS sublocation_id,
|
||||
location_name AS sublocation_name,
|
||||
LEFT(location_info, 40) AS info_short,
|
||||
CHAR_LENGTH(location_info) AS info_length
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location_parent=" . $location_id . "
|
||||
ORDER BY
|
||||
location_name";
|
||||
|
||||
// run query
|
||||
$sublocations = $db->db_select($query);
|
||||
$smarty->assign("sublocations", $sublocations);
|
||||
// sublocations
|
||||
$sql = "SELECT location_id AS sublocation_id, location_name AS sublocation_name,
|
||||
LEFT(location_info, 40) AS info_short,
|
||||
CHAR_LENGTH(location_info) AS info_length
|
||||
FROM location
|
||||
WHERE location_parent=?
|
||||
ORDER BY location_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("sublocations", $sth->fetchAll());
|
||||
|
||||
// setup subnets
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet,
|
||||
subnetlocation
|
||||
WHERE
|
||||
subnetlocation.location_id=" . $location_id . "
|
||||
AND subnetlocation.subnet_id=subnet.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
// subnets
|
||||
$sql = "SELECT s.subnet_id, s.subnet_address, s.subnet_mask
|
||||
FROM subnet AS s LEFT JOIN subnetlocation AS l USING (subnet_id)
|
||||
WHERE l.location_id=?
|
||||
ORDER BY INET_ATON(s.subnet_address)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$location_id]);
|
||||
$smarty->assign("subnets", $sth->fetchAll());
|
||||
|
||||
$smarty->display("locationview.tpl");
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
$smarty->assign("subnets", $subnets);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("locationview.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
191
login.php
@@ -1,77 +1,120 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// session
|
||||
// start session
|
||||
session_name('ipreg');
|
||||
session_start();
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// headers
|
||||
// raw http headers
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
|
||||
// includes
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
|
||||
// load lib
|
||||
include("lib.php");
|
||||
|
||||
// include language file
|
||||
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
||||
include('lang/' . $language . '.php');
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// try login?
|
||||
// check for submit
|
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||||
/// get post info
|
||||
$user_name = sanitize($_POST['user_name']);
|
||||
$user_pass = sanitize($_POST['user_pass']);
|
||||
|
||||
// login
|
||||
$login = $user->user_login($user_name, $user_pass);
|
||||
|
||||
if($login==TRUE) {
|
||||
// redirect
|
||||
header_location("index.php");
|
||||
} else {
|
||||
// not ok, break session
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// start output
|
||||
// get version for the footer-stamp
|
||||
$smarty->assign("config_version", $config_version);
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("login.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
session_name('ipreg');
|
||||
session_start();
|
||||
|
||||
if (! include("config.php")) {
|
||||
echo "<!DOCTYPE html><html><head><title>IP Reg</title></head><body><h1>IP Reg</h1><h2>No configuration</h2><p>Error loading configuration. Please check your installation.</p></body></html>\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// connect to database
|
||||
$dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charset=utf8", $config_mysql_username, $config_mysql_password);
|
||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||
|
||||
include("lib.php"); // only for get_language from browser. TODO: simplify
|
||||
|
||||
function user_login ($user_name, $user_pass) {
|
||||
global $dbh;
|
||||
|
||||
if (strlen($user_name) < 1) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strlen($user_pass) < 1) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$sql = "SELECT user_id, user_pass, user_displayname, user_language,
|
||||
user_imagesize, user_imagecount, user_mac, user_dateformat,
|
||||
user_dns1suffix, user_dns2suffix, user_tooltips,
|
||||
user_menu, user_role, user_flags
|
||||
FROM user
|
||||
WHERE user_name=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$user_name]);
|
||||
|
||||
if (!$user = $sth->fetch(PDO::FETCH_OBJ)) {
|
||||
// no user record found
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strcmp(md5($user_pass), rtrim($user->user_pass)) != 0) {
|
||||
// password does not match with md5, check if new hash matches
|
||||
// For future expansion: $pwd_peppered = hash_hmac('sha256', $user_pass, $config_pepper);
|
||||
if (! password_verify($user_pass, $user->user_pass)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
// md5 match but outdated. rewrite with new algo
|
||||
$sth = $dbh->prepare("UPDATE user SET user_pass=? WHERE user_id=?");
|
||||
$newhash = password_hash($user_pass, PASSWORD_BCRYPT);
|
||||
$sth->execute([$newhash, $user->user_id]);
|
||||
}
|
||||
|
||||
|
||||
// all ok: user is logged in, register session data
|
||||
$_SESSION['suser_id'] = $user->user_id;
|
||||
$_SESSION['suser_displayname'] = $user->user_displayname;
|
||||
$_SESSION['suser_language'] = $user->user_language;
|
||||
$_SESSION['suser_imagesize'] = $user->user_imagesize;
|
||||
$_SESSION['suser_imagecount'] = $user->user_imagecount;
|
||||
$_SESSION['suser_mac'] = $user->user_mac;
|
||||
$_SESSION['suser_dateformat'] = $user->user_dateformat;
|
||||
$_SESSION['suser_dns1suffix'] = $user->user_dns1suffix;
|
||||
$_SESSION['suser_dns2suffix'] = $user->user_dns2suffix;
|
||||
$_SESSION['suser_tooltips'] = $user->user_tooltips;
|
||||
|
||||
$roles = explode(',', $user->user_role);
|
||||
$_SESSION['suser_role_add'] = in_array('add', $roles);
|
||||
$_SESSION['suser_role_edit'] = in_array('edit', $roles);
|
||||
$_SESSION['suser_role_delete'] = in_array('delete', $roles);
|
||||
$_SESSION['suser_role_manage'] = in_array('manage', $roles);
|
||||
$_SESSION['suser_role_admin'] = in_array('admin', $roles);
|
||||
|
||||
$menu = explode(',', $user->user_menu);
|
||||
$_SESSION['suser_menu_assets'] = in_array('asset', $menu);
|
||||
$_SESSION['suser_menu_assetclasses'] = in_array('class', $menu);
|
||||
$_SESSION['suser_menu_assetclassgroups'] = in_array('group', $menu);
|
||||
$_SESSION['suser_menu_cables'] = in_array('cable', $menu);
|
||||
$_SESSION['suser_menu_locations'] = in_array('location', $menu);
|
||||
$_SESSION['suser_menu_nodes'] = in_array('node', $menu);
|
||||
$_SESSION['suser_menu_subnets'] = in_array('subnet', $menu);
|
||||
$_SESSION['suser_menu_vlans'] = in_array('vlan', $menu);
|
||||
$_SESSION['suser_menu_zones'] = in_array('zone', $menu);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// No header included, this page has no menu
|
||||
|
||||
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
||||
include('lang/' . $language . '.php');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST" ) {
|
||||
|
||||
$user_name = sanitize($_POST['user_name']);
|
||||
$user_pass = sanitize($_POST['user_pass']);
|
||||
|
||||
if (user_login($user_name, $user_pass) == TRUE) {
|
||||
header_location($_SESSION['prelogin'] ?? 'index.php');
|
||||
} else {
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
$smarty->assign("config_version", $config_version);
|
||||
$smarty->assign($lang);
|
||||
$smarty->display("login.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
48
logout.php
@@ -1,33 +1,17 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// logout
|
||||
// user logout
|
||||
$user->user_logout();
|
||||
|
||||
// redirect
|
||||
header("Location: index.php");
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// user logout: clear session
|
||||
$_SESSION = array();
|
||||
|
||||
// redirect to start page
|
||||
header("Location: index.php");
|
||||
?>
|
||||
28
nat.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT n.nat_id AS id, n.nat_type, n.nat_ext, n.nat_int,
|
||||
n.nat_ext_port AS port_ext, n.nat_int_port AS port_int,
|
||||
n.nat_description AS description,
|
||||
n1.node_ip AS node_ip_int, n2.node_ip AS node_ip_ext
|
||||
FROM nat AS n
|
||||
LEFT JOIN node AS n1 ON (n.nat_int=n1.node_id)
|
||||
LEFT JOIN node AS n2 ON (n.nat_ext=n2.node_id)
|
||||
ORDER BY INET_ATON(nat_ext)";
|
||||
$sth = $dbh->query($sql);
|
||||
$smarty->assign("nats", $sth->fetchAll());
|
||||
|
||||
$smarty->display("nat.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
137
natadd.php
@@ -1,92 +1,65 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// setup node_ext
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip_ext
|
||||
include("header.php");
|
||||
|
||||
// node_ext
|
||||
$sql = "SELECT node_ip AS node_ip_ext
|
||||
FROM node
|
||||
WHERE node_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
|
||||
$node = $sth->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
$smarty->assign("node_id_ext", $node_id);
|
||||
$smarty->assign("node_ip_ext", $node->node_ip_ext);
|
||||
|
||||
// node_int
|
||||
$sql = "SELECT
|
||||
a.asset_name,
|
||||
n.node_id AS node_id_int,
|
||||
n.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset AS a LEFT JOIN node AS n USING (asset_id)
|
||||
WHERE
|
||||
n.node_id NOT IN (
|
||||
SELECT
|
||||
nat_int
|
||||
FROM
|
||||
node
|
||||
nat
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
nat_ext=?
|
||||
)
|
||||
AND n.node_id!=?
|
||||
ORDER BY
|
||||
INET_ATON(n.node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id, $node_id]);
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
$nodes = $sth->fetchAll();
|
||||
|
||||
$smarty->assign("node_id_ext", $node_id);
|
||||
$smarty->assign("node_ip_ext", $node[0]['node_ip_ext']);
|
||||
foreach ($nodes as $rec) {
|
||||
$node_options[$rec['node_id_int']] = $rec['node_ip_int'] . '/' . $rec['asset_name'];
|
||||
}
|
||||
$smarty->assign("node_options", $node_options);
|
||||
|
||||
// setup node_int
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id_int,
|
||||
node.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset,
|
||||
node
|
||||
WHERE
|
||||
node.node_id NOT IN (
|
||||
SELECT
|
||||
nat_int
|
||||
FROM
|
||||
nat
|
||||
WHERE
|
||||
nat_ext=" . $node_id . "
|
||||
)
|
||||
AND node.node_id!=" . $node_id . "
|
||||
AND asset.asset_id=node.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
foreach ($nodes as $rec) {
|
||||
$node_options[$rec['node_id_int']] = $rec['node_ip_int'] . '/' . $rec['asset_name'];
|
||||
}
|
||||
$smarty->assign("node_options", $node_options);
|
||||
$nat_type_options[1] = $lang['lang_nat_type_1'];
|
||||
$nat_type_options[2] = $lang['lang_nat_type_2'];
|
||||
$nat_type_options[3] = $lang['lang_nat_type_3'];
|
||||
$smarty->assign("nat_type_options", $nat_type_options);
|
||||
|
||||
$nat_type_options[1] = $lang['lang_nat_type_1'];
|
||||
$nat_type_options[2] = $lang['lang_nat_type_2'];
|
||||
$nat_type_options[3] = $lang['lang_nat_type_3'];
|
||||
$smarty->assign("nat_type_options", $nat_type_options);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("natadd.tpl");
|
||||
$smarty->display("natadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
112
natdel.php
@@ -1,80 +1,40 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup node_ext
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip_ext
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
$smarty->assign("node_id_ext", $node_id);
|
||||
$smarty->assign("node_ip_ext", $node[0]['node_ip_ext']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id_int,
|
||||
node.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset,
|
||||
nat,
|
||||
node
|
||||
WHERE
|
||||
nat.nat_ext=" . $node_id . "
|
||||
AND node.node_id=nat.nat_int
|
||||
AND asset.asset_id=node.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// *** <option value="{node_id_int}">{node_ip_int}/{asset_name}</option>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("natdel.tpl");
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("header.php");
|
||||
|
||||
// node_ext
|
||||
$sth = $dbh->prepare("SELECT node_id AS id_ext, node_ip AS ip_ext FROM node WHERE node_id=?");
|
||||
$sth->execute([$node_id]);
|
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// options
|
||||
$sql = "SELECT x.nat_id, n.node_ip, a.asset_name
|
||||
FROM nat AS x
|
||||
LEFT JOIN node AS n ON (x.nat_int=n.node_id)
|
||||
LEFT JOIN asset AS a USING (asset_id)
|
||||
WHERE x.nat_ext=?
|
||||
ORDER BY INET_ATON(n.node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
$nats = $sth->fetchAll();
|
||||
|
||||
$options = array();
|
||||
foreach ($nats as $rec) {
|
||||
$options[$rec['nat_id']] = $rec['node_ip'] . '/' . $rec['asset_name'];
|
||||
}
|
||||
$smarty->assign("nat_options", $options);
|
||||
$smarty->display("natdel.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
77
natedit.php
@@ -1,57 +1,24 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
$smarty->assign("node_id", $node_id);
|
||||
$smarty->assign("node_ip", $node[0]['node_ip']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("natedit.tpl");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip FROM node WHERE node.node_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("natedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
108
node.php
@@ -1,78 +1,52 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// filter preparation
|
||||
$p = array();
|
||||
$w = array();
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
if(isset($_GET['subnet_id'])) {
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$w[] = "n.subnet_id=?";
|
||||
$p[] = $subnet_id;
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
// get subnet details for title
|
||||
$sql = "SELECT CONCAT_WS('/',subnet_address,subnet_mask) AS subnet
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetchColumn());
|
||||
} else {
|
||||
$smarty->assign("subnet_id", '');
|
||||
}
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// create sql with optional filter
|
||||
$where = join(' AND ', $w);
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$sql = "SELECT a.asset_id, a.asset_info,
|
||||
REPLACE(a.asset_name, ' ', ' ') AS asset_name,
|
||||
n.node_id, n.node_ip
|
||||
FROM node AS n LEFT JOIN asset AS a USING (asset_id)";
|
||||
if ($where) {
|
||||
$sql .= ' WHERE ' . $where;
|
||||
}
|
||||
$sql .= "GROUP BY n.node_id ORDER BY INET_ATON(n.node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute($p);
|
||||
$smarty->assign("nodes", $sth->fetchAll());
|
||||
|
||||
// start node
|
||||
// setup view
|
||||
// subnet
|
||||
if(isset($_GET['subnet_id'])) {
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$smarty->display("node.tpl");
|
||||
|
||||
// build query part
|
||||
$subnet_view = "AND node.subnet_id=" . $subnet_id;
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
} else {
|
||||
// to tpl
|
||||
$smarty->assign("subnet_id", "");
|
||||
}
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id,
|
||||
REPLACE(asset.asset_name, ' ', ' ') AS asset_name,
|
||||
asset.asset_info,
|
||||
node.node_id,
|
||||
node.node_ip
|
||||
FROM
|
||||
asset,
|
||||
node
|
||||
WHERE
|
||||
asset.asset_id=node.asset_id
|
||||
" . $subnet_view . "
|
||||
GROUP BY
|
||||
node.node_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("node.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
67
nodeadd.php
@@ -1,54 +1,27 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// check for set ip and/or subnet_id
|
||||
if ((isset($_GET['node_ip'])) ? $node_ip = sanitize($_GET['node_ip']) : $node_ip = '');
|
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = sanitize($_GET['subnet_id']) : $subnet_id = '');
|
||||
if ((isset($_GET['node_ip'])) ? $node_ip = sanitize($_GET['node_ip']) : $node_ip = '');
|
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = sanitize($_GET['subnet_id']) : $subnet_id = '');
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// set vars
|
||||
$smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
$smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$smarty->assign("node_ip", $node_ip);
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
|
||||
// setup subnet
|
||||
$smarty->assign("subnet_options", $db->options_subnet());
|
||||
$smarty->assign("subnet_options", db_get_options_subnet());
|
||||
$smarty->assign("assetclass_options", db_get_options_assetclass());
|
||||
$smarty->display("nodeadd.tpl");
|
||||
|
||||
// setup assetclass
|
||||
$smarty->assign("assetclass_options", $db->options_assetclass());
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("nodeadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
72
nodedel.php
@@ -1,60 +1,24 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip, asset_id FROM node WHERE node_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.asset_id AS asset_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
$smarty->display("nodedel.tpl");
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("node_id", $node_id);
|
||||
$smarty->assign("asset_id", $node[0]['asset_id']);
|
||||
$smarty->assign("node_ip", $node[0]['node_ip']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("nodedel.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
112
nodeedit.php
@@ -1,86 +1,32 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip,
|
||||
node.node_mac AS node_mac,
|
||||
node.node_dns1 AS node_dns1,
|
||||
node.node_dns2 AS node_dns2,
|
||||
node.node_info AS node_info,
|
||||
subnet.subnet_id AS subnet_id,
|
||||
node.zone_id AS zone_id
|
||||
FROM
|
||||
asset,
|
||||
node,
|
||||
subnet
|
||||
WHERE
|
||||
asset.asset_id=node.asset_id
|
||||
AND node.node_id=" . $node_id . "
|
||||
AND subnet.subnet_id=node.subnet_id";
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("node_id", $node[0]['node_id']);
|
||||
$smarty->assign("node_ip", $node[0]['node_ip']);
|
||||
$smarty->assign("node_mac", write_mac($node[0]['node_mac']));
|
||||
$smarty->assign("node_dns1", $node[0]['node_dns1']);
|
||||
$smarty->assign("node_dns2", $node[0]['node_dns2']);
|
||||
$smarty->assign("node_info", $node[0]['node_info']);
|
||||
$smarty->assign("asset_id", $node[0]['asset_id']);
|
||||
$smarty->assign("subnet_id", $node[0]['subnet_id']);
|
||||
$smarty->assign("zone_id", $node[0]['zone_id']);
|
||||
|
||||
// setup asset
|
||||
$smarty->assign("asset_options", $db->options_asset());
|
||||
|
||||
// setup subnet
|
||||
$smarty->assign("subnet_options", $db->options_subnet());
|
||||
|
||||
// setup zone
|
||||
$smarty->assign("zone_options", $db->options_zone("(keine)"));
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("nodeedit.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip, node_mac AS mac,
|
||||
node_dns1 AS dns1, node_dns2 AS dns2, node_info AS info,
|
||||
zone_id, asset_id, subnet_id
|
||||
FROM node
|
||||
WHERE node_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
$smarty->assign("node", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->assign("asset_options", db_get_options_asset());
|
||||
$smarty->assign("subnet_options", db_get_options_subnet());
|
||||
$smarty->assign("zone_options", db_get_options_zone('(keine)'));
|
||||
|
||||
$smarty->display("nodeedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
168
nodeview.php
@@ -1,105 +1,89 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
if (isset($_GET['node_id']) && (!empty($_GET['node_id']))) {
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
} else {
|
||||
// redirect to error page
|
||||
header_location("comments.php?comments=error");
|
||||
exit;
|
||||
}
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
include("header.php");
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
// node
|
||||
$sql = "SELECT
|
||||
asset.asset_id,
|
||||
asset.asset_name,
|
||||
node.node_id AS id,
|
||||
node.node_ip AS ip,
|
||||
node.node_mac AS mac,
|
||||
node.node_dns1 AS dns1,
|
||||
node.node_dns2 AS dns2,
|
||||
node.node_info AS info,
|
||||
node.node_type AS type,
|
||||
subnet.subnet_id,
|
||||
subnet.subnet_address,
|
||||
subnet.subnet_mask,
|
||||
zone.zone_origin
|
||||
FROM
|
||||
node
|
||||
JOIN asset USING (asset_id)
|
||||
JOIN subnet USING (subnet_id)
|
||||
LEFT JOIN zone USING (zone_id)
|
||||
WHERE
|
||||
node.node_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$node_id]);
|
||||
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
$node = $sth->fetch(PDO::FETCH_OBJ);
|
||||
$node->mac = write_mac($node->mac);
|
||||
$smarty->assign("node", $node);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// nat
|
||||
$sql = "SELECT
|
||||
asset_ext.asset_id AS asset_id_ext,
|
||||
asset_int.asset_id AS asset_id_int,
|
||||
asset_ext.asset_name AS asset_name_ext,
|
||||
asset_int.asset_name AS asset_name_int,
|
||||
nat.nat_id AS nat_id,
|
||||
nat.nat_type AS nat_type,
|
||||
nat.nat_ext AS nat_ext,
|
||||
nat.nat_int AS nat_int,
|
||||
node_ext.node_ip AS node_ip_ext,
|
||||
node_int.node_ip AS node_ip_int,
|
||||
node_int.node_id AS node_id_int,
|
||||
node_ext.node_id AS node_id_ext
|
||||
FROM
|
||||
asset AS asset_ext,
|
||||
asset AS asset_int,
|
||||
nat,
|
||||
node AS node_ext,
|
||||
node AS node_int
|
||||
WHERE
|
||||
(nat.nat_ext=:node_id OR nat.nat_int=:node_id)
|
||||
AND node_ext.node_id=nat.nat_ext
|
||||
AND node_int.node_id=nat.nat_int
|
||||
AND asset_ext.asset_id=node_ext.asset_id
|
||||
AND asset_int.asset_id=node_int.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node_ext.node_ip),
|
||||
INET_ATON(node_int.node_ip)";
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['node_id' => $node_id]);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id,
|
||||
asset.asset_name,
|
||||
node.node_id,
|
||||
node.node_ip,
|
||||
node.node_mac,
|
||||
node.node_dns1,
|
||||
node.node_dns2,
|
||||
node.node_info,
|
||||
node.node_type,
|
||||
subnet.subnet_id,
|
||||
subnet.subnet_address,
|
||||
subnet.subnet_mask,
|
||||
zone.zone_origin
|
||||
FROM
|
||||
node
|
||||
JOIN asset USING (asset_id)
|
||||
JOIN subnet USING (subnet_id)
|
||||
LEFT JOIN zone USING (zone_id)
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
$smarty->assign("natrules", $sth->fetchAll());
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
$node[0]['node_mac'] = write_mac($node[0]['node_mac']);
|
||||
$smarty->assign("node", $node[0]);
|
||||
$smarty->display("nodeview.tpl");
|
||||
|
||||
// setup nat
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset_ext.asset_id AS asset_id_ext,
|
||||
asset_int.asset_id AS asset_id_int,
|
||||
asset_ext.asset_name AS asset_name_ext,
|
||||
asset_int.asset_name AS asset_name_int,
|
||||
nat.nat_id AS nat_id,
|
||||
nat.nat_type AS nat_type,
|
||||
nat.nat_ext AS nat_ext,
|
||||
nat.nat_int AS nat_int,
|
||||
node_ext.node_ip AS node_ip_ext,
|
||||
node_int.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset asset_ext,
|
||||
asset asset_int,
|
||||
nat,
|
||||
node node_ext,
|
||||
node node_int
|
||||
WHERE
|
||||
(nat.nat_ext=" . $node_id . "
|
||||
OR nat.nat_int=" . $node_id . ")
|
||||
AND node_ext.node_id=nat.nat_ext
|
||||
AND node_int.node_id=nat.nat_int
|
||||
AND asset_ext.asset_id=node_ext.asset_id
|
||||
AND asset_int.asset_id=node_int.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node_ext.node_ip),
|
||||
INET_ATON(node_int.node_ip)";
|
||||
|
||||
// run query
|
||||
$natrules = $db->db_select($query);
|
||||
// counter to tpl
|
||||
$smarty->assign("natrules", $natrules);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("nodeview.tpl");
|
||||
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
50
options.php
@@ -1,39 +1,21 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$smarty->assign('role_add', $_SESSION['suser_role_add']);
|
||||
$smarty->assign('role_edit', $_SESSION['suser_role_edit']);
|
||||
$smarty->assign('role_delete', $_SESSION['suser_role_delete']);
|
||||
$smarty->assign('role_manage', $_SESSION['suser_role_manage']);
|
||||
$smarty->assign('role_admin', $_SESSION['suser_role_admin']);
|
||||
$smarty->display("options.tpl");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("options.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,123 +1,99 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$smarty->assign("language", $language);
|
||||
|
||||
// setup options
|
||||
// set menu checkboxes
|
||||
// assets
|
||||
if($_SESSION['suser_menu_assets']=='on') {
|
||||
$user_menu_assets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assets_checked = '';
|
||||
}
|
||||
// assetclasses
|
||||
if($_SESSION['suser_menu_assetclasses']=='on') {
|
||||
$user_menu_assetclasses_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclasses_checked = '';
|
||||
}
|
||||
// assetclassgroups
|
||||
if($_SESSION['suser_menu_assetclassgroups']=='on') {
|
||||
$user_menu_assetclassgroups_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclassgroups_checked = '';
|
||||
}
|
||||
// locations
|
||||
if($_SESSION['suser_menu_locations']=='on') {
|
||||
$user_menu_locations_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_locations_checked = '';
|
||||
}
|
||||
// nodes
|
||||
if($_SESSION['suser_menu_nodes']=='on') {
|
||||
$user_menu_nodes_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_nodes_checked = '';
|
||||
}
|
||||
// subnets
|
||||
if($_SESSION['suser_menu_subnets']=='on') {
|
||||
$user_menu_subnets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_subnets_checked = '';
|
||||
}
|
||||
// users
|
||||
if($_SESSION['suser_menu_users']=='on') {
|
||||
$user_menu_users_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_users_checked = '';
|
||||
}
|
||||
// vlans
|
||||
if($_SESSION['suser_menu_vlans']=='on') {
|
||||
$user_menu_vlans_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_vlans_checked = '';
|
||||
}
|
||||
// zones
|
||||
if($_SESSION['suser_menu_zones']=='on') {
|
||||
$user_menu_zones_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_zones_checked = '';
|
||||
}
|
||||
// tooltips
|
||||
if($_SESSION['suser_tooltips']=='on') {
|
||||
$user_tooltips_checked = 'checked';
|
||||
} else {
|
||||
$user_tooltips_checked = '';
|
||||
}
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("user_id", $_SESSION['suser_id']);
|
||||
$smarty->assign("user_imagesize", $_SESSION['suser_imagesize']);
|
||||
$smarty->assign("user_imagecount", $_SESSION['suser_imagecount']);
|
||||
$smarty->assign("user_mac", $_SESSION['suser_mac']);
|
||||
$smarty->assign("user_dateformat", $_SESSION['suser_dateformat']);
|
||||
$smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$smarty->assign("user_language", $_SESSION['suser_language']);
|
||||
$smarty->assign("user_menu_assets_checked", $user_menu_assets_checked);
|
||||
$smarty->assign("user_menu_assetclasses_checked", $user_menu_assetclasses_checked);
|
||||
$smarty->assign("user_menu_assetclassgroups_checked", $user_menu_assetclassgroups_checked);
|
||||
$smarty->assign("user_menu_locations_checked", $user_menu_locations_checked);
|
||||
$smarty->assign("user_menu_nodes_checked", $user_menu_nodes_checked);
|
||||
$smarty->assign("user_menu_subnets_checked", $user_menu_subnets_checked);
|
||||
$smarty->assign("user_menu_users_checked", $user_menu_users_checked);
|
||||
$smarty->assign("user_menu_vlans_checked", $user_menu_vlans_checked);
|
||||
$smarty->assign("user_menu_zones_checked", $user_menu_zones_checked);
|
||||
$smarty->assign("user_tooltips_checked", $user_tooltips_checked);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("optionseditdisplay.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
$smarty->assign("language", $language);
|
||||
|
||||
|
||||
if($_SESSION['suser_menu_assets']=='on') {
|
||||
$user_menu_assets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assets_checked = '';
|
||||
}
|
||||
// assetclasses
|
||||
if($_SESSION['suser_menu_assetclasses']=='on') {
|
||||
$user_menu_assetclasses_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclasses_checked = '';
|
||||
}
|
||||
// assetclassgroups
|
||||
if($_SESSION['suser_menu_assetclassgroups']=='on') {
|
||||
$user_menu_assetclassgroups_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclassgroups_checked = '';
|
||||
}
|
||||
// cables
|
||||
if($_SESSION['suser_menu_cables']=='on') {
|
||||
$user_menu_cables_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_cables_checked = '';
|
||||
}
|
||||
// locations
|
||||
if($_SESSION['suser_menu_locations']=='on') {
|
||||
$user_menu_locations_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_locations_checked = '';
|
||||
}
|
||||
// nodes
|
||||
if($_SESSION['suser_menu_nodes']=='on') {
|
||||
$user_menu_nodes_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_nodes_checked = '';
|
||||
}
|
||||
// subnets
|
||||
if($_SESSION['suser_menu_subnets']=='on') {
|
||||
$user_menu_subnets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_subnets_checked = '';
|
||||
}
|
||||
// vlans
|
||||
if($_SESSION['suser_menu_vlans']=='on') {
|
||||
$user_menu_vlans_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_vlans_checked = '';
|
||||
}
|
||||
// zones
|
||||
if($_SESSION['suser_menu_zones']=='on') {
|
||||
$user_menu_zones_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_zones_checked = '';
|
||||
}
|
||||
// tooltips
|
||||
if($_SESSION['suser_tooltips']=='on') {
|
||||
$user_tooltips_checked = 'checked';
|
||||
} else {
|
||||
$user_tooltips_checked = '';
|
||||
}
|
||||
|
||||
$smarty->assign("user_id", $_SESSION['suser_id']);
|
||||
$smarty->assign("user_imagesize", $_SESSION['suser_imagesize']);
|
||||
$smarty->assign("user_imagecount", $_SESSION['suser_imagecount']);
|
||||
$smarty->assign("user_mac", $_SESSION['suser_mac']);
|
||||
$smarty->assign("user_dateformat", $_SESSION['suser_dateformat']);
|
||||
$smarty->assign("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$smarty->assign("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$smarty->assign("user_language", $_SESSION['suser_language']);
|
||||
$smarty->assign("user_menu_assets_checked", $user_menu_assets_checked);
|
||||
$smarty->assign("user_menu_assetclasses_checked", $user_menu_assetclasses_checked);
|
||||
$smarty->assign("user_menu_assetclassgroups_checked", $user_menu_assetclassgroups_checked);
|
||||
$smarty->assign("user_menu_cables_checked", $user_menu_cables_checked);
|
||||
$smarty->assign("user_menu_locations_checked", $user_menu_locations_checked);
|
||||
$smarty->assign("user_menu_nodes_checked", $user_menu_nodes_checked);
|
||||
$smarty->assign("user_menu_subnets_checked", $user_menu_subnets_checked);
|
||||
$smarty->assign("user_menu_vlans_checked", $user_menu_vlans_checked);
|
||||
$smarty->assign("user_menu_zones_checked", $user_menu_zones_checked);
|
||||
$smarty->assign("user_tooltips_checked", $user_tooltips_checked);
|
||||
|
||||
$smarty->display("optionseditdisplay.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,39 +1,16 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("optionseditpassword.tpl");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
$smarty->display("optionseditpassword.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
247
search.php
@@ -1,178 +1,115 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
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
|
||||
*****************************************************************************/
|
||||
// get string that was searched for ($search is already set in header.php)
|
||||
if (empty($search)) {
|
||||
// parse nosearch box
|
||||
$smarty->assign("nosearch", TRUE);
|
||||
$smarty->display("search.tpl");
|
||||
include("footer.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
// hide nosearch box
|
||||
$smarty->assign("nosearch", FALSE);
|
||||
$smarty->assign("search", $search);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$needle = '%' . $search . '%';
|
||||
$resultcounter = 0;
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
// asset
|
||||
$sql = "SELECT asset_id AS id, asset_name AS name, asset_info AS description
|
||||
FROM asset
|
||||
WHERE asset_name LIKE :needle OR asset_hostname LIKE :needle
|
||||
OR asset_info LIKE :needle
|
||||
ORDER BY asset_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// get string that was searched for ($search is already set in header.php)
|
||||
if (empty($search)) {
|
||||
// parse nosearch box
|
||||
$smarty->assign("nosearch", TRUE);
|
||||
} else {
|
||||
// hide nosearch box
|
||||
$smarty->assign("nosearch", FALSE);
|
||||
$smarty->assign("search", $search);
|
||||
$assets = $sth->fetchAll();
|
||||
$resultcounter += count($assets);
|
||||
$smarty->assign("assets", $assets);
|
||||
|
||||
// set needle
|
||||
$needle = '%' . $search . '%';
|
||||
// location
|
||||
$sql = "SELECT location_id AS id, location_name AS name
|
||||
FROM location
|
||||
WHERE location_name LIKE :needle OR location_info LIKE :needle
|
||||
ORDER BY location_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// set counter
|
||||
$resultcounter = 0;
|
||||
$locations = $sth->fetchAll();
|
||||
$resultcounter += count($locations);
|
||||
$smarty->assign("locations", $locations);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS id,
|
||||
asset.asset_name AS name,
|
||||
asset.asset_info AS description
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.asset_name LIKE '" . $needle . "'
|
||||
OR asset.asset_hostname LIKE '" . $needle . "'
|
||||
OR asset.asset_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
// node
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip
|
||||
FROM node
|
||||
WHERE node_ip LIKE :needle OR node_mac LIKE :needle
|
||||
OR node_dns1 LIKE :needle OR node_dns2 LIKE :needle
|
||||
OR node_info LIKE :needle
|
||||
ORDER BY node_ip";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
$resultcounter += count($assets);
|
||||
$smarty->assign("assets", $assets);
|
||||
$nodes = $sth->fetchAll();
|
||||
$resultcounter += count($nodes);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS id,
|
||||
location.location_name AS name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_name LIKE '" . $needle . "'
|
||||
OR location.location_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
// subnet
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address
|
||||
FROM subnet
|
||||
WHERE subnet_address LIKE :needle OR subnet_info LIKE :needle
|
||||
ORDER BY subnet_address";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
$resultcounter += count($locations);
|
||||
$smarty->assign("locations", $locations);
|
||||
$subnets = $sth->fetchAll();
|
||||
$resultcounter += count($subnets);
|
||||
$smarty->assign("subnets", $subnets);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS id,
|
||||
node.node_ip AS ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_ip LIKE '" . $needle . "'
|
||||
OR node.node_mac LIKE '" . $needle . "'
|
||||
OR node.node_dns1 LIKE '" . $needle . "'
|
||||
OR node.node_dns2 LIKE '" . $needle . "'
|
||||
OR node.node_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
node.node_ip";
|
||||
// vlan
|
||||
$sql = "SELECT vlan_id AS id, vlan_name AS name
|
||||
FROM vlan
|
||||
WHERE vlan_name LIKE :needle OR vlan_info LIKE :needle
|
||||
ORDER BY vlan_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$resultcounter += count($nodes);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
$vlans = $sth->fetchAll();
|
||||
$resultcounter += count($vlans);
|
||||
$smarty->assign("vlans", $vlans);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS id,
|
||||
subnet.subnet_address AS address
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_address LIKE '" . $needle . "'
|
||||
OR subnet.subnet_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
subnet.subnet_address";
|
||||
// setup zone
|
||||
$sql = "SELECT zone_id AS id, zone_origin AS origin
|
||||
FROM zone
|
||||
WHERE zone_origin LIKE :needle OR zone_soa LIKE :needle
|
||||
OR zone_hostmaster LIKE :needle OR zone_ns1 LIKE :needle
|
||||
OR zone_ns2 LIKE :needle OR zone_ns3 LIKE :needle
|
||||
OR zone_mx1 LIKE :needle OR zone_mx2 LIKE :needle
|
||||
OR zone_info LIKE :needle
|
||||
ORDER BY zone_origin";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute(['needle' => $needle]);
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
$resultcounter += count($subnets);
|
||||
$smarty->assign("subnets", $subnets);
|
||||
$zones = $sth->fetchAll();
|
||||
$resultcounter += count($zones);
|
||||
$smarty->assign("zones", $zones);
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS id,
|
||||
vlan.vlan_name AS name
|
||||
FROM
|
||||
vlan
|
||||
WHERE
|
||||
vlan.vlan_name LIKE '" . $needle . "'
|
||||
OR vlan.vlan_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
vlan.vlan_name";
|
||||
// grand totals
|
||||
$smarty->assign("resultcounter", $resultcounter);
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
$resultcounter += count($vlans);
|
||||
$smarty->assign("vlans", $vlans);
|
||||
$smarty->display("search.tpl");
|
||||
|
||||
// setup zone
|
||||
// build query
|
||||
$query = "SELECT
|
||||
zone_id AS id,
|
||||
zone_origin AS origin
|
||||
FROM
|
||||
zone
|
||||
WHERE
|
||||
zone_origin LIKE '" . $needle . "'
|
||||
OR zone_soa LIKE '" . $needle . "'
|
||||
OR zone_hostmaster LIKE '" . $needle . "'
|
||||
OR zone_ns1 LIKE '" . $needle . "'
|
||||
OR zone_ns2 LIKE '" . $needle . "'
|
||||
OR zone_ns3 LIKE '" . $needle . "'
|
||||
OR zone_mx1 LIKE '" . $needle . "'
|
||||
OR zone_mx2 LIKE '" . $needle . "'
|
||||
OR zone_info LIKE '" . $needle . "'
|
||||
ORDER BY
|
||||
zone_origin";
|
||||
|
||||
// run query
|
||||
$zones = $db->db_select($query);
|
||||
$resultcounter += count($zones);
|
||||
$smarty->assign("zones", $zones);
|
||||
|
||||
// grand totals
|
||||
$smarty->assign("resultcounter", $resultcounter);
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("search.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
2103
submit.php
75
subnet.php
@@ -1,64 +1,27 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
include("header.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$sql = "SELECT s.subnet_id, s.subnet_address, s.subnet_mask,
|
||||
s.ntp_server, LEFT(s.subnet_info, 40) AS subnet_info,
|
||||
CHAR_LENGTH(s.subnet_info) AS subnet_length,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM subnet AS s LEFT JOIN node USING (subnet_id)
|
||||
GROUP BY s.subnet_id
|
||||
ORDER BY INET_ATON(s.subnet_address)";
|
||||
$sth = $dbh->query($sql);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
$smarty->assign("subnets", $sth->fetchAll());
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
$smarty->display("subnet.tpl");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
s.subnet_id,
|
||||
s.subnet_address,
|
||||
s.subnet_mask,
|
||||
s.ntp_server,
|
||||
LEFT(s.subnet_info, 40) AS subnet_info,
|
||||
CHAR_LENGTH(s.subnet_info) AS subnet_length,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet AS s
|
||||
LEFT JOIN
|
||||
node
|
||||
ON
|
||||
node.subnet_id=s.subnet_id
|
||||
GROUP BY
|
||||
s.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(s.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
$smarty->assign("subnets", $subnets);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnet.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,61 +1,21 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['vlan_id'])) ? $vlan_id = sanitize($_GET['vlan_id']) : $vlan_id = "");
|
||||
if((isset($_GET['vlan_id'])) ? $vlan_id = sanitize($_GET['vlan_id']) : $vlan_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$smarty->assign("vlan_options", db_get_options_vlan($lang['lang_option_none']));
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_number AS vlan_number,
|
||||
vlan.vlan_name AS vlan_name
|
||||
FROM
|
||||
vlan
|
||||
ORDER BY
|
||||
vlan.vlan_name";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
$vlan_options[0] = $lang['lang_option_none'];
|
||||
foreach ($vlans as $vlan) {
|
||||
$vlan_options[$vlan['vlan_id']] = $vlan['vlan_name'];
|
||||
}
|
||||
$smarty->assign("vlan_options", $vlan_options);
|
||||
$smarty->display("subnetadd.tpl");
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetadd.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
100
subnetdel.php
@@ -1,76 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
include("header.php");
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
// subnet
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// node
|
||||
$sql = "SELECT node_id AS id, node_ip AS ip
|
||||
FROM node
|
||||
WHERE subnet_id=?
|
||||
ORDER BY INET_ATON(node_ip)";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("nodes", $sth->fetchAll());
|
||||
|
||||
$smarty->display("subnetdel.tpl");
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.subnet_id=" . $subnet_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetdel.tpl");
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,70 +1,29 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
include("header.php");
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask,
|
||||
protocol_version AS proto_vers, subnet_dhcp_start AS dhcp_start,
|
||||
subnet_dhcp_end AS dhcp_end, ntp_server, subnet_info AS info
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$smarty->display("subnetedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet_address,
|
||||
subnet_mask,
|
||||
protocol_version,
|
||||
subnet_dhcp_start,
|
||||
subnet_dhcp_end,
|
||||
ntp_server,
|
||||
subnet_info AS subnet_info
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
$smarty->assign("subnet_proto_vers", $subnet[0]['protocol_version']);
|
||||
$smarty->assign("subnet_dhcpstart", $subnet[0]['subnet_dhcp_start']);
|
||||
$smarty->assign("subnet_dhcpend", $subnet[0]['subnet_dhcp_end']);
|
||||
$smarty->assign("subnet_ntp_server", $subnet[0]['ntp_server']);
|
||||
$smarty->assign("subnet_info", $subnet[0]['subnet_info']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetedit.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,63 +1,28 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// start parent
|
||||
// build query
|
||||
$smarty->assign("location_options", $db->options_location());
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetlocationadd.tpl");
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->assign("location_options", db_get_options_location());
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$smarty->display("subnetlocationadd.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,82 +1,42 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
include("header.php");
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
// subnet
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
// locations for subnet
|
||||
$sql = "SELECT l.location_id, l.location_name
|
||||
FROM subnetlocation AS s LEFT JOIN location USING (location_id)
|
||||
WHERE s.subnet_id=?
|
||||
ORDER BY l.location_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]
|
||||
$records = $sth->fetchAll();
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
$locations = array();
|
||||
foreach ($records as $rec) {
|
||||
$locations[$rec['location_id']] = $rec['location_name'];
|
||||
}
|
||||
$smarty->assign("location_options", $locations);
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$smarty->display("subnetlocationdel.tpl");
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
subnetlocation,
|
||||
location
|
||||
WHERE
|
||||
subnetlocation.subnet_id=" . $subnet_id . "
|
||||
AND location.location_id=subnetlocation.location_id
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$records = $db->db_select($query);
|
||||
$locations = array();
|
||||
foreach ($records as $rec) {
|
||||
$locations[$rec['location_id']] = $rec['location_name'];
|
||||
}
|
||||
$smarty->assign("location_options", $locations);
|
||||
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetlocationdel.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,59 +1,27 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetlocationedit.tpl");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("subnetlocationedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
702
subnetview.php
@@ -1,440 +1,364 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
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
|
||||
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.
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
include("includes.php");
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
For more information, visit http://sourceforge.net/projects/ipreg,
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
if(isset($_GET['page'])) {
|
||||
$page = sanitize($_GET['page']);
|
||||
}
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
$smarty->assign("scripts",'changetext.js');
|
||||
include("header.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
// subnet
|
||||
$sql = "SELECT
|
||||
s.subnet_id AS id,
|
||||
s.subnet_address AS address,
|
||||
s.subnet_mask AS mask,
|
||||
s.subnet_dhcp_start AS dhcp_start,
|
||||
s.subnet_dhcp_end AS dhcp_end,
|
||||
s.subnet_info AS info,
|
||||
s.protocol_version AS proto_vers,
|
||||
s.ntp_server,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet AS s LEFT JOIN node USING (subnet_id)
|
||||
WHERE
|
||||
s.subnet_id=?
|
||||
GROUP BY
|
||||
s.subnet_id";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
// get page
|
||||
if(isset($_GET['page'])) {
|
||||
$page = sanitize($_GET['page']);
|
||||
$subnet = $sth->fetch(PDO::FETCH_OBJ);
|
||||
|
||||
$smarty->assign("subnet", $subnet);
|
||||
|
||||
// set counters
|
||||
$host_counter = pow(2, (32-$subnet->mask));
|
||||
$node_counter = $subnet->node_counter;
|
||||
$subnet_usedpercentage = round((($node_counter/($host_counter-2))*100), 1);
|
||||
|
||||
$smarty->assign("node_counter", $node_counter);
|
||||
$smarty->assign("subnet_usedpercentage", $subnet_usedpercentage);
|
||||
$smarty->assign("config_color_unused", $config_color_unused);
|
||||
$smarty->assign("host_counter", $host_counter-2);
|
||||
$smarty->assign("free_counter", (($host_counter-2)-$node_counter));
|
||||
|
||||
// subnet
|
||||
|
||||
// split up the range
|
||||
$iprange = explode('.', $subnet->address);
|
||||
$iprange1 = $iprange[0];
|
||||
$iprange2 = $iprange[1];
|
||||
$iprange3 = $iprange[2];
|
||||
$iprange4 = $iprange[3];
|
||||
|
||||
// create empty subnet-array
|
||||
$subnetdata = array();
|
||||
|
||||
// determine range (Class A/B/C)
|
||||
if ($subnet->mask >= 24) {
|
||||
// Class C
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0; $i<$host_counter; $i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i);
|
||||
|
||||
// fill subnet-array
|
||||
$subnetdata[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i-1);
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
$smarty->assign("iprange3", $iprange3);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 255);
|
||||
$smarty->assign("subnetmask3", 255);
|
||||
$smarty->assign("subnetmask4", 256-$host_counter);
|
||||
|
||||
// no pagination needed
|
||||
$smarty->assign("noselect", TRUE);
|
||||
$smarty->assign("one_select", FALSE);
|
||||
$smarty->assign("two_select", FALSE);
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = $host_counter;
|
||||
|
||||
} else if ($subnet->mask >= 16) {
|
||||
// Class B
|
||||
// which part do we want to see?
|
||||
if ((empty($page)) ? $page = $subnet->address : $page = $page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[2];
|
||||
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0; $i<256; $i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $page2 . '.' . $i;
|
||||
|
||||
// fill subnet-array
|
||||
$subnetdata[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$i-1) . '.255';
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
|
||||
// loop addresses in range3
|
||||
for ($i=$iprange3; $i<(pow(2,(32-$subnet->mask))/256); $i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("iprange3", $i);
|
||||
$smarty->assign("iprange4", 0);
|
||||
|
||||
// set select box
|
||||
if ($i == $page2) {
|
||||
$smarty->assign("row_selected", "selected");
|
||||
|
||||
} else {
|
||||
$smarty->assign("row_selected", "");
|
||||
}
|
||||
|
||||
// start output
|
||||
$smarty->assign("scripts",'changetext.js');
|
||||
include("header.php");
|
||||
}
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 255);
|
||||
$smarty->assign("subnetmask3", 256-($host_counter/256));
|
||||
$smarty->assign("subnetmask4", 0);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address,
|
||||
subnet.subnet_mask,
|
||||
subnet.subnet_dhcp_start,
|
||||
subnet.subnet_dhcp_end,
|
||||
subnet.subnet_info,
|
||||
subnet.protocol_version,
|
||||
subnet.ntp_server,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet
|
||||
LEFT JOIN
|
||||
node
|
||||
ON
|
||||
node.subnet_id=subnet.subnet_id
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id . "
|
||||
GROUP BY
|
||||
subnet.subnet_id";
|
||||
// one select box
|
||||
$smarty->assign("noselect", FALSE);
|
||||
$smarty->assign("one_select", TRUE);
|
||||
$smarty->assign("two_select", FALSE);
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
} else {
|
||||
// Class A
|
||||
// which part do we want to see?
|
||||
if ((empty($page)) ? $page = $subnet->address : $page = $page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[1];
|
||||
$page3 = $page[2];
|
||||
|
||||
// set needed variables
|
||||
$subnet_address = $subnet[0]['subnet_address'];
|
||||
$subnet_mask = $subnet[0]['subnet_mask'];
|
||||
$subnet_dhcpstart = $subnet[0]['subnet_dhcp_start'];
|
||||
$subnet_dhcpend = $subnet[0]['subnet_dhcp_end'];
|
||||
$subnet_proto_vers = $subnet[0]['protocol_version'];
|
||||
$subnet_ntp_server = $subnet[0]['ntp_server'];
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0; $i<256; $i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $page2 . '.' . $page3 . '.' . $i;
|
||||
|
||||
// set counters
|
||||
$host_counter = pow(2,(32-$subnet_mask));
|
||||
$node_counter = $subnet[0]['node_counter'];
|
||||
$subnet_usedpercentage = round((($node_counter/($host_counter-2))*100), 1);
|
||||
// fill subnet-array
|
||||
$subnetdata[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . ($iprange2+$i-1) . '.255.255';
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
|
||||
// loop addresses in range 2
|
||||
for ($i=$iprange2; $i<(pow(2,(24-$subnet->mask))/256); $i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet_address);
|
||||
$smarty->assign("subnet_mask", $subnet_mask);
|
||||
$smarty->assign("subnet_dhcpstart", $subnet_dhcpstart);
|
||||
$smarty->assign("subnet_dhcpend", $subnet_dhcpend);
|
||||
$smarty->assign("subnet_info", nl2br($subnet[0]['subnet_info']));
|
||||
$smarty->assign("subnet_proto_vers", $subnet_proto_vers);
|
||||
$smarty->assign("subnet_ntp_server", $subnet_ntp_server);
|
||||
$smarty->assign("node_counter", $node_counter);
|
||||
$smarty->assign("subnet_usedpercentage", $subnet_usedpercentage);
|
||||
$smarty->assign("config_color_unused", $config_color_unused);
|
||||
$smarty->assign("host_counter", $host_counter-2);
|
||||
$smarty->assign("free_counter", (($host_counter-2)-$node_counter));
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $i);
|
||||
$smarty->assign("iprange3", $page3);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
|
||||
// setup subnet
|
||||
// split up the range
|
||||
$iprange = explode('.', $subnet_address);
|
||||
$iprange1 = $iprange[0];
|
||||
$iprange2 = $iprange[1];
|
||||
$iprange3 = $iprange[2];
|
||||
$iprange4 = $iprange[3];
|
||||
// set select box
|
||||
if($i == $page2) {
|
||||
$smarty->assign("row1_selected", "selected");
|
||||
|
||||
// create empty subnet-array
|
||||
$subnet = array();
|
||||
} else {
|
||||
$smarty->assign("row1_selected", "");
|
||||
}
|
||||
|
||||
// determine range (Class A/B/C)
|
||||
if ($subnet_mask>=24) {
|
||||
// Class C
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<$host_counter;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i);
|
||||
}
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
// loop addresses in range 3
|
||||
for ($i=0; $i<256; $i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $page2);
|
||||
$smarty->assign("iprange3", $i);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i-1);
|
||||
// set select box
|
||||
if($i==$page3) {
|
||||
$smarty->assign("row2_selected", "selected");
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
$smarty->assign("iprange3", $iprange3);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 255);
|
||||
$smarty->assign("subnetmask3", 255);
|
||||
$smarty->assign("subnetmask4", 256-$host_counter);
|
||||
} else {
|
||||
$smarty->assign("row2_selected", "");
|
||||
}
|
||||
|
||||
// no pagination needed
|
||||
$smarty->assign("noselect", TRUE);
|
||||
$smarty->assign("one_select", FALSE);
|
||||
$smarty->assign("two_select", FALSE);
|
||||
}
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = $host_counter;
|
||||
} else if ($subnet_mask>=16) {
|
||||
// Class B
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[2];
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 256-($host_counter/65536));
|
||||
$smarty->assign("subnetmask3", 0);
|
||||
$smarty->assign("subnetmask4", 0);
|
||||
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $page2 . '.' . $i;
|
||||
// one select box
|
||||
$smarty->assign("noselect", FALSE);
|
||||
$smarty->assign("one_select", FALSE);
|
||||
$smarty->assign("two_select", TRUE);
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$i-1) . '.255';
|
||||
// get nodes for this subnetview and implement the values into the array
|
||||
$sql = "SELECT a.asset_name, g.assetclassgroup_color, n.node_id, n.node_ip
|
||||
FROM
|
||||
asset AS a,
|
||||
assetclass AS c,
|
||||
assetclassgroup AS g,
|
||||
node AS n
|
||||
WHERE
|
||||
n.node_ip IN ('".implode("','",array_keys($subnetdata))."')
|
||||
AND n.subnet_id=?
|
||||
AND a.asset_id=n.asset_id
|
||||
AND c.assetclass_id=a.assetclass_id
|
||||
AND g.assetclassgroup_id=c.assetclassgroup_id";
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
// loop addresses in range3
|
||||
for($i=$iprange3;$i<(pow(2,(32-$subnet_mask))/256);$i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("iprange3", $i);
|
||||
$smarty->assign("iprange4", 0);
|
||||
$nodes = $sth->fetchAll();
|
||||
$smarty->assign("nodes", $nodes);
|
||||
|
||||
// set select box
|
||||
if($i==$page2) {
|
||||
$smarty->assign("row_selected", "selected");
|
||||
if (count($nodes) > 0) {
|
||||
foreach ($nodes AS $node) {
|
||||
$subnetdata[$node['node_ip']] = $node;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$smarty->assign("row_selected", "");
|
||||
}
|
||||
// replace ip's in subnet-array (if necessary)
|
||||
// check for subnet address
|
||||
if (array_key_exists($subnet->address, $subnet)) {
|
||||
// replace
|
||||
$subnetdata[$subnet->address] = array("subnet_address");
|
||||
}
|
||||
|
||||
}
|
||||
// check for broadcast address
|
||||
if (array_key_exists($broadcast_address, $subnet)) {
|
||||
// replace
|
||||
$subnetdata[$broadcast_address] = array("broadcast_address");
|
||||
}
|
||||
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 255);
|
||||
$smarty->assign("subnetmask3", 256-($host_counter/256));
|
||||
$smarty->assign("subnetmask4", 0);
|
||||
|
||||
// one select box
|
||||
$smarty->assign("noselect", FALSE);
|
||||
$smarty->assign("one_select", TRUE);
|
||||
$smarty->assign("two_select", FALSE);
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
} else {
|
||||
// Class A
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[1];
|
||||
$page3 = $page[2];
|
||||
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $page2 . '.' . $page3 . '.' . $i;
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . ($iprange2+$i-1) . '.255.255';
|
||||
|
||||
// to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $iprange2);
|
||||
|
||||
// loop addresses in range 2
|
||||
for($i=$iprange2;$i<(pow(2,(24-$subnet_mask))/256);$i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $i);
|
||||
$smarty->assign("iprange3", $page3);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
|
||||
// set select box
|
||||
if($i==$page2) {
|
||||
$smarty->assign("row1_selected", "selected");
|
||||
|
||||
} else {
|
||||
$smarty->assign("row1_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("two_select_row1");
|
||||
}
|
||||
|
||||
// loop addresses in range 3
|
||||
for($i=0;$i<256;$i++) {
|
||||
// send to tpl
|
||||
$smarty->assign("iprange1", $iprange1);
|
||||
$smarty->assign("iprange2", $page2);
|
||||
$smarty->assign("iprange3", $i);
|
||||
$smarty->assign("iprange4", $iprange4);
|
||||
|
||||
// set select box
|
||||
if($i==$page3) {
|
||||
$smarty->assign("row2_selected", "selected");
|
||||
|
||||
} else {
|
||||
$smarty->assign("row2_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("two_select_row2");
|
||||
}
|
||||
|
||||
$smarty->assign("subnetmask1", 255);
|
||||
$smarty->assign("subnetmask2", 256-($host_counter/65536));
|
||||
$smarty->assign("subnetmask3", 0);
|
||||
$smarty->assign("subnetmask4", 0);
|
||||
|
||||
// one select box
|
||||
$smarty->assign("noselect", FALSE);
|
||||
$smarty->assign("one_select", FALSE);
|
||||
$smarty->assign("two_select", TRUE);
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
}
|
||||
|
||||
// get nodes for this subnetview and implement the values into the array
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name,
|
||||
assetclassgroup.assetclassgroup_color,
|
||||
node.node_id,
|
||||
node.node_ip
|
||||
FROM
|
||||
asset,
|
||||
assetclass,
|
||||
assetclassgroup,
|
||||
node
|
||||
WHERE
|
||||
node.node_ip IN ('".implode("','",array_keys($subnet))."')
|
||||
AND node.subnet_id='$subnet_id'
|
||||
AND asset.asset_id=node.asset_id
|
||||
AND assetclass.assetclass_id=asset.assetclass_id
|
||||
AND assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// add node-values to ip in subnet-array
|
||||
$subnet[$node['node_ip']] = $node;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// replace ip's in subnet-array (if necessary)
|
||||
// check for subnet address
|
||||
if(array_key_exists($subnet_address, $subnet)) {
|
||||
// replace
|
||||
$subnet[$subnet_address] = array("subnet_address");
|
||||
}
|
||||
|
||||
// check for broadcast address
|
||||
if(array_key_exists($broadcast_address, $subnet)) {
|
||||
// replace
|
||||
$subnet[$broadcast_address] = array("broadcast_address");
|
||||
}
|
||||
|
||||
$dhcpstart = 0;
|
||||
if ($subnet_dhcpstart && $subnet_dhcpend) {
|
||||
$dhcpstart = ip2long($subnet_dhcpstart);
|
||||
$dhcpend = ip2long($subnet_dhcpend);
|
||||
}
|
||||
$dhcpstart = 0;
|
||||
if ($subnet->dhcp_start && $subnet->dhcp_end) {
|
||||
$dhcpstart = ip2long($subnet->dhcp_start);
|
||||
$dhcpend = ip2long($subnet->dhcp_end);
|
||||
}
|
||||
|
||||
// loop subnet-array and send to template
|
||||
// start counter
|
||||
// $i=1;
|
||||
// loop subnet-array
|
||||
foreach($subnet AS $node_ip => $node) {
|
||||
foreach ($subnetdata AS $node_ip => $node) {
|
||||
|
||||
// make new line?
|
||||
// if(($i%$_SESSION['suser_imagecount']==0 && $i!=$nodes_displayed) ? $tr="</tr><tr>" : $tr="");
|
||||
// make new line?
|
||||
// if(($i%$_SESSION['suser_imagecount']==0 && $i!=$nodes_displayed) ? $tr="</tr><tr>" : $tr="");
|
||||
|
||||
// check if node-ip in DHCP-area
|
||||
$subnet[$node_ip]["dynamic"] = False;
|
||||
if ($dhcpstart > 0) {
|
||||
$ipval = ip2long($node_ip);
|
||||
if (($ipval >= $dhcpstart) and ($ipval <= $dhcpend)) {
|
||||
$subnet[$node_ip]["dynamic"] = True;
|
||||
}
|
||||
}
|
||||
// check if node-ip in DHCP-area
|
||||
$subnetdata[$node_ip]["dynamic"] = false;
|
||||
if ($dhcpstart > 0) {
|
||||
$ipval = ip2long($node_ip);
|
||||
if (($ipval >= $dhcpstart) and ($ipval <= $dhcpend)) {
|
||||
$subnetdata[$node_ip]["dynamic"] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// check node
|
||||
if (empty($node)) {
|
||||
// empty node to tpl
|
||||
$subnet[$node_ip]["url"] = 'assigniptonode.php?subnet_id=' . $subnet_id . '&node_ip='. $node_ip;
|
||||
$subnet[$node_ip]["remotetext"] = $node_ip;
|
||||
if ($subnet[$node_ip]["dynamic"]) {
|
||||
$subnet[$node_ip]["assetclassgroup_color"] = $config_color_dynamic;
|
||||
} else {
|
||||
$subnet[$node_ip]["assetclassgroup_color"] = $config_color_unused;
|
||||
}
|
||||
// check node
|
||||
if (empty($node)) {
|
||||
// empty node to tpl
|
||||
$subnetdata[$node_ip]["url"] = 'assigniptonode.php?subnet_id=' . $subnet_id . '&node_ip='. $node_ip;
|
||||
$subnetdata[$node_ip]["remotetext"] = $node_ip;
|
||||
if ($subnetdata[$node_ip]["dynamic"]) {
|
||||
$subnetdata[$node_ip]["assetclassgroup_color"] = $config_color_dynamic;
|
||||
} else {
|
||||
$subnetdata[$node_ip]["assetclassgroup_color"] = $config_color_unused;
|
||||
}
|
||||
} else if (array_key_exists(0, $node) && $node[0]=="subnet_address") {
|
||||
// subnet address to tpl
|
||||
$subnetdata[$node_ip]["url"] = "";
|
||||
$subnetdata[$node_ip]["remotetext"] = $node_ip . ' ' . $lang['lang_subnet_subnetaddress'];
|
||||
$subnetdata[$node_ip]["assetclassgroup_color"] = $config_color_blocked;
|
||||
} else if (array_key_exists(0, $node) && $node[0]=="broadcast_address") {
|
||||
// broadcast address to tpl
|
||||
$subnetdata[$node_ip]["url"] = "";
|
||||
$subnetdata[$node_ip]["remotetext"] = $node_ip . ' ' . $lang['lang_subnet_broadcastaddress'];
|
||||
$subnetdata[$node_ip]["assetclassgroup_color"] = $config_color_blocked;
|
||||
} else {
|
||||
// node to tpl
|
||||
$subnetdata[$node_ip]["url"] = 'nodeview.php?node_id=' . $node['node_id'];
|
||||
$subnetdata[$node_ip]["remotetext"] = $node_ip . ' ' . $node['asset_name'];
|
||||
$subnetdata[$node_ip]["assetclassgroup_color"] = $node['assetclassgroup_color'];
|
||||
}
|
||||
|
||||
} else if (array_key_exists(0, $node) && $node[0]=="subnet_address") {
|
||||
// subnet address to tpl
|
||||
$subnet[$node_ip]["url"] = "";
|
||||
$subnet[$node_ip]["remotetext"] = $node_ip . ' ' . $lang['lang_subnet_subnetaddress'];
|
||||
$subnet[$node_ip]["assetclassgroup_color"] = $config_color_blocked;
|
||||
} else if (array_key_exists(0, $node) && $node[0]=="broadcast_address") {
|
||||
// broadcast address to tpl
|
||||
$subnet[$node_ip]["url"] = "";
|
||||
$subnet[$node_ip]["remotetext"] = $node_ip . ' ' . $lang['lang_subnet_broadcastaddress'];
|
||||
$subnet[$node_ip]["assetclassgroup_color"] = $config_color_blocked;
|
||||
} else {
|
||||
// node to tpl
|
||||
$subnet[$node_ip]["url"] = 'nodeview.php?node_id=' . $node['node_id'];
|
||||
$subnet[$node_ip]["remotetext"] = $node_ip . ' ' . $node['asset_name'];
|
||||
$subnet[$node_ip]["assetclassgroup_color"] = $node['assetclassgroup_color'];
|
||||
}
|
||||
// update counter
|
||||
// $i++;
|
||||
|
||||
} // foreach
|
||||
|
||||
// update counter
|
||||
// $i++;
|
||||
}
|
||||
$smarty->assign("subnetdata", $subnetdata);
|
||||
$smarty->assign("imagewrap", $_SESSION['suser_imagecount']);
|
||||
|
||||
$smarty->assign("subnet", $subnet);
|
||||
$smarty->assign("imagewrap", $_SESSION['suser_imagecount']);
|
||||
// vlans
|
||||
$sql = "SELECT v.vlan_id AS id, v.vlan_name AS name,
|
||||
v.vlan_number AS number
|
||||
FROM subnetvlan AS s JOIN vlan AS v USING (vlan_id)
|
||||
WHERE s.subnet_id=?
|
||||
ORDER BY v.vlan_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("vlans", $sth->fetchAll());
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_name AS vlan_name,
|
||||
vlan.vlan_number AS vlan_number
|
||||
FROM
|
||||
subnetvlan,
|
||||
vlan
|
||||
WHERE
|
||||
subnetvlan.subnet_id=" . $subnet_id . "
|
||||
AND vlan.vlan_id=subnetvlan.vlan_id
|
||||
ORDER BY
|
||||
vlan.vlan_name";
|
||||
// locations
|
||||
$sql = "SELECT l.location_id, l.location_name
|
||||
FROM location AS l LEFT JOIN subnetlocation AS s USING (location_id)
|
||||
WHERE s.subnet_id=?
|
||||
ORDER BY l.location_name";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("locations", $sth->fetchAll());
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
$smarty->assign("vlans", $vlans);
|
||||
// assetclassgroups
|
||||
$sql = "SELECT
|
||||
assetclassgroup_id AS id,
|
||||
assetclassgroup_name AS name,
|
||||
assetclassgroup_color AS color,
|
||||
COUNT(assetclass_id) AS counter
|
||||
FROM subnet
|
||||
LEFT JOIN node USING (subnet_id)
|
||||
LEFT JOIN asset USING (asset_id)
|
||||
LEFT JOIN assetclass USING (assetclass_id)
|
||||
LEFT JOIN assetclassgroup USING (assetclassgroup_id)
|
||||
WHERE subnet_id=?
|
||||
GROUP BY assetclass_id
|
||||
ORDER BY counter DESC";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("assetclassgroups", $sth->fetchAll());
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id,
|
||||
location.location_name
|
||||
FROM
|
||||
location
|
||||
LEFT JOIN
|
||||
subnetlocation
|
||||
ON
|
||||
subnetlocation.location_id=location.location_id
|
||||
WHERE
|
||||
subnetlocation.subnet_id=". $subnet_id . "
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
$smarty->display("subnetview.tpl");
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
$smarty->assign("locations", $locations);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup_id AS id,
|
||||
assetclassgroup_name AS name,
|
||||
assetclassgroup_color AS color,
|
||||
COUNT(assetclass_id) AS counter
|
||||
FROM subnet
|
||||
LEFT JOIN node USING (subnet_id)
|
||||
LEFT JOIN asset USING (asset_id)
|
||||
LEFT JOIN assetclass USING (assetclass_id)
|
||||
LEFT JOIN assetclassgroup USING (assetclassgroup_id)
|
||||
WHERE subnet_id=" . $subnet_id . "
|
||||
GROUP BY assetclass_id
|
||||
ORDER BY counter DESC";
|
||||
|
||||
// run query
|
||||
$assetclassgroups = $db->db_select($query);
|
||||
$smarty->assign("assetclassgroups", $assetclassgroups);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetview.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,89 +1,43 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = " SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_number AS vlan_number,
|
||||
vlan.vlan_name AS vlan_name
|
||||
FROM
|
||||
vlan
|
||||
WHERE
|
||||
vlan.vlan_id NOT IN (
|
||||
SELECT
|
||||
vlan_id
|
||||
FROM
|
||||
subnetvlan
|
||||
WHERE
|
||||
subnet_id=" . $subnet_id . "
|
||||
)
|
||||
ORDER BY
|
||||
vlan.vlan_number";
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
foreach ($vlans as $vlan) {
|
||||
$vlan_options[$vlan['vlan_id']] = $vlan['vlan_name'];
|
||||
}
|
||||
$smarty->assign("vlan_options", $vlan_options);
|
||||
|
||||
// $smarty->assign("vlans", $vlans);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
include("header.php");
|
||||
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetvlanadd.tpl");
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
// vlan
|
||||
$sql = "SELECT vlan_id, vlan_number, vlan_name
|
||||
FROM vlan
|
||||
WHERE vlan_id NOT IN (
|
||||
SELECT vlan_id FROM subnetvlan WHERE subnet_id=?
|
||||
)
|
||||
ORDER BY vlan_number";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
|
||||
$vlans = $sth->fetchAll();
|
||||
foreach ($vlans as $vlan) {
|
||||
$vlan_options[$vlan['vlan_id']] = $vlan['vlan_name'] . ' (' . $vlan['vlan_number']. ')';
|
||||
}
|
||||
$smarty->assign("vlan_options", $vlan_options);
|
||||
|
||||
$smarty->display("subnetvlanadd.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,78 +1,36 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// subnet
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
// vlan
|
||||
$sql = "SELECT v.vlan_id, v.vlan_number, v.vlan_name
|
||||
FROM subnetvlan AS s LEFT JOIN vlan AS v USING (vlan_id)
|
||||
WHERE s.subnet_id=?
|
||||
ORDER BY v.vlan_number";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("vlans", $sth->fetchAll());
|
||||
|
||||
$smarty->display("subnetvlandel.tpl");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_number AS vlan_number,
|
||||
vlan.vlan_name AS vlan_name
|
||||
FROM
|
||||
subnetvlan,
|
||||
vlan
|
||||
WHERE
|
||||
subnetvlan.subnet_id=" . $subnet_id . "
|
||||
AND vlan.vlan_id=subnetvlan.vlan_id
|
||||
ORDER BY
|
||||
vlan.vlan_number";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
$smarty->assign("vlans", $vlans);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetvlandel.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
@@ -1,59 +1,26 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
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
|
||||
*****************************************************************************/
|
||||
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
|
||||
Copyright (C) 2011-2023 Thomas Hooge
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*****************************************************************************/
|
||||
|
||||
include("includes.php");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
include("header.php");
|
||||
|
||||
// set language variables
|
||||
$smarty->assign($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$smarty->assign("subnet_id", $subnet_id);
|
||||
$smarty->assign("subnet_address", $subnet[0]['subnet_address']);
|
||||
$smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$smarty->display("subnetvlanedit.tpl");
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
||||
$sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
|
||||
FROM subnet
|
||||
WHERE subnet_id=?";
|
||||
$sth = $dbh->prepare($sql);
|
||||
$sth->execute([$subnet_id]);
|
||||
$smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
|
||||
|
||||
$smarty->display("subnetvlanedit.tpl");
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
|
||||
288
tpl/about.tpl
@@ -1,132 +1,156 @@
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_ipreg} {$config_version}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_sfprojectpage}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://sourceforge.net/projects/ipreg">http://sourceforge.net/projects/ipreg</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_license}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="gpl-3.0.txt">{$lang_about_gpl}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_smarty}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://www.smarty.net/">http://www.smarty.net</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_iconset}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about_ipreg_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_license_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about_changelog}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v07}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v07_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v06}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v06_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v05}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v05_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v04}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v04_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v03}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v03_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v02}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v02_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v01}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v01_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_ipreg} {$config_version}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_projectpage}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="https://git.piratenpartei-sh.de/thooge/ipreg">https://git.piratenpartei-sh.de/thooge/ipreg</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_sfprojectpage}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://sourceforge.net/projects/ipreg">http://sourceforge.net/projects/ipreg</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_license}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="gpl-3.0.txt">{$lang_about_gpl}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_smarty}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://www.smarty.net/">http://www.smarty.net</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_iconset}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about_ipreg_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_license_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_about_changelog}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v09}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v09_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v08}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v08_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v07}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v07_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v06}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v06_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v05}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v05_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v04}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v04_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v03}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v03_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v02}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v02_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_about_changelog_v01}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$lang_about_changelog_v01_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
109
tpl/asset.tpl
@@ -1,53 +1,56 @@
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assets} ({$assets|@count})
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="assetadd.php"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="submenu initials">
|
||||
<tr>
|
||||
{foreach item=letter from=$alphabet}
|
||||
<td>
|
||||
<a href="asset.php?asset_letter={$letter.asset_letter}">{$letter.asset_letter}</a>
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_asset_info}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=asset from=$assets}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<a href="assetview.php?asset.id={$asset.asset_id}">{$asset.asset_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassview.php?assetclass_id={$asset.assetclass_id}">{$asset.assetclass_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
{$asset.asset_info}
|
||||
</td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$lang_asset_none}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
<img class="icon" src="images/asset.png" alt="" />
|
||||
{$lang_assets} ({$assets|@count} / {$assetcount})
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $suser_add}
|
||||
<a href="assetadd.php"><img src="image.php?icon=add" alt="{$lang_asset_add}" {if $suser_tooltips}title="{$lang_asset_add}" {/if}/></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="submenu initials">
|
||||
<tr>
|
||||
{foreach item=letter from=$alphabet}
|
||||
<td>
|
||||
<a href="asset.php?asset_letter={$letter.asset_letter}">{$letter.asset_letter}</a>
|
||||
</td>
|
||||
{/foreach}
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_asset_info}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=asset from=$assets}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<a href="assetview.php?asset_id={$asset.asset_id}">{$asset.asset_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassview.php?assetclass_id={$asset.assetclass_id}">{$asset.assetclass_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
{$asset.asset_info}
|
||||
</td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
{$lang_asset_none}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
156
tpl/assetadd.tpl
@@ -1,70 +1,86 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="asset">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="asset_name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_hostname}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="asset_hostname">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_info}
|
||||
</td>
|
||||
<td class="value">
|
||||
<textarea name="asset_info" cols="30" rows="10"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclass_id options=$assetclass_options}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="asset">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_asset}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="asset_name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_hostname}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="asset_hostname">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_info}
|
||||
</td>
|
||||
<td class="value">
|
||||
<textarea name="asset_info" cols="30" rows="10"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_intf}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" size="6" maxlength="6" name="asset_intf" value="1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_asset_type}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_radios name=asset_type values=$type_ids output=$type_names selected=$type_selected}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclass_id options=$assetclass_options}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclasses} ({$assetclasses|@count})
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="assetclassadd.php"><img src="image.php?icon=add" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_assetclass_add}" {/if}/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=assetclass from=$assetclasses}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclass.assetclassgroup_id}">{$assetclass.assetclassgroup_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
<img class="icon" src="images/brick.png" alt="" />
|
||||
{$lang_assetclasses} ({$assetclasses|@count})
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $suser_add || $suser_admin}
|
||||
<a href="assetclassadd.php"><img src="image.php?icon=add" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_assetclass_add}" {/if}/></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=assetclass from=$assetclasses}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a>
|
||||
</td>
|
||||
<td class="value">
|
||||
<img src="image.php?color={$assetclass.assetclassgroup_color}" alt="#{$assetclass.assetclassgroup_color}">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclass.assetclassgroup_id}">{$assetclass.assetclassgroup_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
{$lang_assetclass_none}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="assetclass">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclass_name">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclassgroup_id options=$assetclassgroup_options}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="assetclass">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclass_name">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclassgroup_id options=$assetclassgroup_options}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="del" value="assetclass">
|
||||
<input type="hidden" name="assetclass_id" value="{$assetclass_id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass_del}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=shred" alt="{$lang_assetclass_del}" {if $suser_tooltips}title="{$lang_assetclass_del}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass_id}">{$assetclass_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="del" value="assetclass">
|
||||
<input type="hidden" name="assetclass_id" value="{$assetclass->id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass_del}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=shred" alt="{$lang_assetclass_del}" {if $suser_tooltips}title="{$lang_assetclass_del}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass->id}">{$assetclass->name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="edit" value="assetclass">
|
||||
<input type="hidden" name="assetclass_id" value="{$assetclass_id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclass_name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclass_name" value="{$assetclass_name}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclassgroup_id options=$assetclassgroup_options selected=$assetclassgroup_id}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="edit" value="assetclass">
|
||||
<input type="hidden" name="assetclass_id" value="{$assetclass->id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclass->name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclass_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclass_name" value="{$assetclass->name}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="value">
|
||||
{html_options name=assetclassgroup_id options=$assetclassgroup_options selected=$assetclassgroup_id}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,26 +1,41 @@
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroups} ({$assetclassgroups|@count})
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="assetclassgroupadd.php"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=assetclassgroup from=$assetclassgroups}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<img src="image.php?color={$assetclassgroup.assetclassgroup_color}" alt="#{$assetclassgroup.assetclassgroup_color}">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup.assetclassgroup_id}">{$assetclassgroup.assetclassgroup_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
<img class="icon" src="images/bricks.png" alt="" />
|
||||
{$lang_assetclassgroups} ({$assetclassgroups|@count})
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $suser_add || $suser_admin}
|
||||
<a href="assetclassgroupadd.php"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{$lang_description}
|
||||
</td>
|
||||
</tr>
|
||||
{foreach item=acg from=$assetclassgroups}
|
||||
<tr>
|
||||
<td class="label">
|
||||
<img src="image.php?color={$acg.color}" alt="#{$acg.color}">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$acg.id}">{$acg.name}</a>
|
||||
</td>
|
||||
<td>
|
||||
{$acg.description}
|
||||
</td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{$lang_assetclassgroup_none}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
@@ -1,42 +1,50 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="assetclassgroup">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclassgroup_name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclassgroup_color">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="add" value="assetclassgroup">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_add}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="acg_name">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_description}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="acg_description" size="80" maxlength="100">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
#<input type="text" {literal}class="color {pickerPosition:'right'}"{/literal} name="acg_color" size="6" maxlength="6" value="{$assetclassgroup->color}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="del" value="assetclassgroup">
|
||||
<input type="hidden" name="assetclassgroup_id" value="{$assetclassgroup_id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclassgroup_name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_del}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup_id}">{$assetclassgroup_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="del" value="assetclassgroup">
|
||||
<input type="hidden" name="assetclassgroup_id" value="{$assetclassgroup->id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclassgroup->name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=cancel" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup_del}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup->id}">{$assetclassgroup->name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,44 +1,52 @@
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="edit" value="assetclassgroup">
|
||||
<input type="hidden" name="assetclassgroup_id" value="{$assetclassgroup_id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclassgroup_name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="assetclassgroup_name" value="{$assetclassgroup_name}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
#<input type="text" {literal}class="color {pickerPosition:'right'}"{/literal} name="assetclassgroup_color" size="6" maxlength="6" value="{$assetclassgroup_color}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<form method="POST" action="submit.php">
|
||||
<input type="hidden" name="edit" value="assetclassgroup">
|
||||
<input type="hidden" name="acg_id" value="{$assetclassgroup->id}">
|
||||
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclassgroup->name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="#" onClick="history.go(-1)"><img src="image.php?icon=back" alt="{$lang_cancel}" {if $suser_tooltips}title="{$lang_cancel}" {/if}/></a>
|
||||
<input type="image" src="image.php?icon=save" alt="{$lang_submit}" {if $suser_tooltips}title="{$lang_submit}" {/if}/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="acg_name" value="{$assetclassgroup->name}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_description}
|
||||
</td>
|
||||
<td class="value">
|
||||
<input type="text" name="acg_description" size="80" maxlength="100" value="{$assetclassgroup->description}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
#<input type="text" {literal}class="color {pickerPosition:'right'}"{/literal} name="acg_color" size="6" maxlength="6" value="{$assetclassgroup->color}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -1,60 +1,76 @@
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$assetclassgroup_name}
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="assetclassgroupadd.php?assetclassgroup_id={$assetclassgroup_id}"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a>
|
||||
<a href="assetclassgroupedit.php?assetclassgroup_id={$assetclassgroup_id}"><img src="image.php?icon=edit" alt="{$lang_assetclassgroup_edit}" {if $suser_tooltips}title="{$lang_assetclassgroup_edit}" {/if}/></a>
|
||||
<a href="assetclassgroupdel.php?assetclassgroup_id={$assetclassgroup_id}"><img src="image.php?icon=delete" alt="{$lang_assetclassgroup_del}" {if $suser_tooltips}title="{$lang_assetclassgroup_del}" {/if}/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup_id}">{$assetclassgroup_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
<img src="image.php?color={$assetclassgroup_color}" alt="{$assetclassgroup_color}">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclasses} ({$assetclasses|@count})
|
||||
</td>
|
||||
<td class="value">
|
||||
{foreach item=assetclass from=$assetclasses}
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a><br>
|
||||
{/foreach}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td class="header">
|
||||
<img class="icon" src="images/bricks.png" alt="" />
|
||||
{$assetclassgroup->name}
|
||||
</td>
|
||||
<td align="right">
|
||||
{if $suser_add}
|
||||
<a href="assetclassgroupadd.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=add" alt="{$lang_assetclassgroup_add}" {if $suser_tooltips}title="{$lang_assetclassgroup_add}" {/if}/></a>
|
||||
{/if}
|
||||
{if $suser_edit}
|
||||
<a href="assetclassgroupedit.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=edit" alt="{$lang_assetclassgroup_edit}" {if $suser_tooltips}title="{$lang_assetclassgroup_edit}" {/if}/></a>
|
||||
{/if}
|
||||
{if $suser_del}
|
||||
<a href="assetclassgroupdel.php?assetclassgroup_id={$assetclassgroup->id}"><img src="image.php?icon=delete" alt="{$lang_assetclassgroup_del}" {if $suser_tooltips}title="{$lang_assetclassgroup_del}" {/if}/></a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclassgroup}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclassgroup_name}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="assetclassgroupview.php?assetclassgroup_id={$assetclassgroup->id}">{$assetclassgroup->name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_description}
|
||||
</td>
|
||||
<td class="value">
|
||||
{$assetclassgroup->description}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_color}
|
||||
</td>
|
||||
<td class="value">
|
||||
<img src="image.php?color={$assetclassgroup->color}" alt="{$assetclassgroup->color}">
|
||||
#{$assetclassgroup->color}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{$lang_assetclass}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{$lang_assetclasses} ({$assetclasses|@count})
|
||||
</td>
|
||||
<td class="value">
|
||||
{foreach item=assetclass from=$assetclasses}
|
||||
<a href="assetclassview.php?assetclass_id={$assetclass.assetclass_id}">{$assetclass.assetclass_name}</a><br>
|
||||
{/foreach}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||