Some more bugfixing
This commit is contained in:
parent
5e605692dd
commit
6e4c4236aa
|
@ -21,7 +21,7 @@ $sth->execute([$assetclass_id]);
|
||||||
|
|
||||||
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
|
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
|
||||||
|
|
||||||
$smarty->assign("assetclassgroup_options", db_get_options_assetclass());
|
$smarty->assign("assetclassgroup_options", db_get_options_assetclassgroup());
|
||||||
|
|
||||||
$smarty->display("assetclassedit.tpl");
|
$smarty->display("assetclassedit.tpl");
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
include("includes.php");
|
include("includes.php");
|
||||||
|
|
||||||
$asset_id = sanitize($_GET['asset_id']);
|
if (isset($_GET['asset_id']) && (!empty($_GET['asset_id']))) {
|
||||||
|
$asset_id = sanitize($_GET['asset_id']);
|
||||||
|
} else {
|
||||||
|
header_location("comments.php?comments=error");
|
||||||
|
}
|
||||||
|
|
||||||
include("header.php");
|
include("header.php");
|
||||||
|
|
||||||
|
|
16
lib.php
16
lib.php
|
@ -41,13 +41,15 @@ $smarty->template_dir = 'tpl';
|
||||||
$smarty->compile_dir = 'tpl_c';
|
$smarty->compile_dir = 'tpl_c';
|
||||||
$smarty->registerPlugin('function', 'treelist', 'print_tree');
|
$smarty->registerPlugin('function', 'treelist', 'print_tree');
|
||||||
$smarty->registerPlugin('function', 'msgout', 'msgout');
|
$smarty->registerPlugin('function', 'msgout', 'msgout');
|
||||||
$smarty->assign("suser_name", $_SESSION['suser_displayname']);
|
if (!empty($_SESSION['suser_id'])) {
|
||||||
$smarty->assign("suser_tooltips", $_SESSION['suser_tooltips'] ?? 'off');
|
$smarty->assign("suser_name", $_SESSION['suser_displayname']);
|
||||||
$smarty->assign("suser_add", $_SESSION['suser_role_add']);
|
$smarty->assign("suser_tooltips", $_SESSION['suser_tooltips'] ?? 'off');
|
||||||
$smarty->assign("suser_edit", $_SESSION['suser_role_edit']);
|
$smarty->assign("suser_add", $_SESSION['suser_role_add']);
|
||||||
$smarty->assign("suser_delete", $_SESSION['suser_role_delete']);
|
$smarty->assign("suser_edit", $_SESSION['suser_role_edit']);
|
||||||
$smarty->assign("suser_manage", $_SESSION['suser_role_manage']);
|
$smarty->assign("suser_delete", $_SESSION['suser_role_delete']);
|
||||||
$smarty->assign("suser_admin", $_SESSION['suser_role_admin']);
|
$smarty->assign("suser_manage", $_SESSION['suser_role_manage']);
|
||||||
|
$smarty->assign("suser_admin", $_SESSION['suser_role_admin']);
|
||||||
|
}
|
||||||
|
|
||||||
// prepare global message system
|
// prepare global message system
|
||||||
$g_message = new Message;
|
$g_message = new Message;
|
||||||
|
|
10
login.php
10
login.php
|
@ -20,7 +20,9 @@ $dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charse
|
||||||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
$dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
include("lib.php"); // only for get_language from browser. TODO: simplify
|
include("lib.php"); // for smarty e.g.
|
||||||
|
|
||||||
|
// ========== LOGIN FUNCTIONS =================================================
|
||||||
|
|
||||||
function check_ldap_bind($user_name, $user_pass) {
|
function check_ldap_bind($user_name, $user_pass) {
|
||||||
global $config_ldap_host;
|
global $config_ldap_host;
|
||||||
|
@ -40,7 +42,7 @@ function check_ldap_bind($user_name, $user_pass) {
|
||||||
if ($res) {
|
if ($res) {
|
||||||
$info = ldap_get_entries($ldap_conn, $res);
|
$info = ldap_get_entries($ldap_conn, $res);
|
||||||
$user_dn = $info[0]['dn'];
|
$user_dn = $info[0]['dn'];
|
||||||
$res = ldap_bind($ldap_conn, $user_dn, $user_pass);
|
$res = @ldap_bind($ldap_conn, $user_dn, $user_pass);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +85,7 @@ function user_login ($user_name, $user_pass) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// TODO sync LDAP data to local
|
// TODO sync LDAP data to local
|
||||||
{ else {
|
} else {
|
||||||
// compare local passwords
|
// compare local passwords
|
||||||
if (strcmp(md5($user_pass), rtrim($user->user_pass)) != 0) {
|
if (strcmp(md5($user_pass), rtrim($user->user_pass)) != 0) {
|
||||||
// password does not match with md5, check if new hash matches
|
// password does not match with md5, check if new hash matches
|
||||||
|
@ -135,6 +137,8 @@ function user_login ($user_name, $user_pass) {
|
||||||
|
|
||||||
// No header included, this page has no menu
|
// No header included, this page has no menu
|
||||||
|
|
||||||
|
// ========== LOGIN: HERE BE DRAGONS ==========================================
|
||||||
|
|
||||||
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
$language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
|
||||||
include('lang/' . $language . '.php');
|
include('lang/' . $language . '.php');
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ $sql = "SELECT
|
||||||
zone.zone_origin
|
zone.zone_origin
|
||||||
FROM
|
FROM
|
||||||
node
|
node
|
||||||
JOIN asset USING (asset_id)
|
LEFT JOIN asset USING (asset_id)
|
||||||
JOIN subnet USING (subnet_id)
|
LEFT JOIN subnet USING (subnet_id)
|
||||||
LEFT JOIN zone USING (zone_id)
|
LEFT JOIN zone USING (zone_id)
|
||||||
WHERE
|
WHERE
|
||||||
node.node_id=?";
|
node.node_id=?";
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
{$lang_assetclassgroup}
|
{$lang_assetclassgroup}
|
||||||
</td>
|
</td>
|
||||||
<td class="value">
|
<td class="value">
|
||||||
{html_options name=assetclassgroup_id options=$assetclassgroup_options selected=$assetclassgroup_id}
|
{html_options name=assetclassgroup_id options=$assetclassgroup_options selected=$assetclass->group_id}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{if $suser_edit}
|
{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>
|
<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}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<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>
|
<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}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="assetclassedit.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a>
|
<a href="assetclassedit.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=edit" alt="{$lang_assetclass_edit}" {if $suser_tooltips}title="{$lang_asset_edit}" {/if}/></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="assetclassdel.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a>
|
<a href="assetclassdel.php?assetclass_id={$assetclass->assetclass_id}"><img src="image.php?icon=delete" alt="{$lang_assetclass_add}" {if $suser_tooltips}title="{$lang_asset_delete}" {/if}/></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="assetedit.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_asset_edit}"></a>
|
<a href="assetedit.php?asset_id={$asset->asset_id}"><img src="image.php?icon=edit" alt="{$lang_asset_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="assetdel.php?asset_id={$asset->asset_id}"><img src="image.php?icon=delete" alt="{$lang_asset_edit}"></a>
|
<a href="assetdel.php?asset_id={$asset->asset_id}"><img src="image.php?icon=delete" alt="{$lang_asset_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="locationedit.php?location_id={$location->id}"><img src="images/building_edit.png" alt="{$lang_location_edit}"></a>
|
<a href="locationedit.php?location_id={$location->id}"><img src="images/building_edit.png" alt="{$lang_location_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="locationdel.php?location_id={$location->id}"><img src="images/building_delete.png" alt="{$lang_location_del}"></a>
|
<a href="locationdel.php?location_id={$location->id}"><img src="images/building_delete.png" alt="{$lang_location_del}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="nodeedit.php?node_id={$node->id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a>
|
<a href="nodeedit.php?node_id={$node->id}"><img src="image.php?icon=edit" alt="{$lang_node_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="nodedel.php?node_id={$node->id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a>
|
<a href="nodedel.php?node_id={$node->id}"><img src="image.php?icon=delete" alt="{$lang_node_del}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="subnetedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnet_edit}"></a>
|
<a href="subnetedit.php?subnet_id={$subnet->id}"><img src="image.php?icon=edit" alt="{$lang_subnet_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="subnetdel.php?subnet_id={$subnet->id}"><img src="image.php?icon=delete" alt="{$lang_subnet_del}"></a>
|
<a href="subnetdel.php?subnet_id={$subnet->id}"><img src="image.php?icon=delete" alt="{$lang_subnet_del}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{if $suser_edit}
|
{if $suser_edit}
|
||||||
<a href="vlanedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_vlan_edit}"></a>
|
<a href="vlanedit.php?vlan_id={$vlan->id}"><img src="image.php?icon=edit" alt="{$lang_vlan_edit}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del}
|
{if $suser_delete}
|
||||||
<a href="vlandel.php?vlan_id={$vlan->id}"><img src="image.php?icon=delete" alt="{$lang_vlan_del}"></a>
|
<a href="vlandel.php?vlan_id={$vlan->id}"><img src="image.php?icon=delete" alt="{$lang_vlan_del}"></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{if $suser_edit || $suser_admin}
|
{if $suser_edit || $suser_admin}
|
||||||
<a href="zoneedit.php?zone_id={$zone->zone_id}"><img src="images/table_edit.png" alt="{$lang_zone_edit}" /></a>
|
<a href="zoneedit.php?zone_id={$zone->zone_id}"><img src="images/table_edit.png" alt="{$lang_zone_edit}" /></a>
|
||||||
{/if}
|
{/if}
|
||||||
{if $suser_del || $suser_admin}
|
{if $suser_delete || $suser_admin}
|
||||||
<a href="zonedel.php?zone_id={$zone->zone_id}"><img src="images/table_delete.png" alt="{$lang_zone_del}" /></a>
|
<a href="zonedel.php?zone_id={$zone->zone_id}"><img src="images/table_delete.png" alt="{$lang_zone_del}" /></a>
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue