Skip to content

Commit

Permalink
Also fix the credential tagging in client asset details page
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyq committed Nov 1, 2024
1 parent 5215ff9 commit eb70aba
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions client_asset_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@

// Related Logins Query
$sql_related_logins = mysqli_query($mysqli, "SELECT * FROM logins
LEFT JOIN login_tags ON login_tags.login_id = logins.login_id
LEFT JOIN tags ON tags.tag_id = login_tags.tag_id
WHERE login_asset_id = $asset_id
AND login_archived_at IS NULL
GROUP BY logins.login_id
ORDER BY login_name DESC"
);
$login_count = mysqli_num_rows($sql_related_logins);
Expand Down Expand Up @@ -410,6 +413,28 @@
$login_asset_id = intval($row['login_asset_id']);
$login_software_id = intval($row['login_software_id']);

// Tags
$login_tag_name_display_array = array();
$login_tag_id_array = array();
$sql_login_tags = mysqli_query($mysqli, "SELECT * FROM login_tags LEFT JOIN tags ON login_tags.tag_id = tags.tag_id WHERE login_id = $login_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_array($sql_login_tags)) {

$login_tag_id = intval($row['tag_id']);
$login_tag_name = nullable_htmlentities($row['tag_name']);
$login_tag_color = nullable_htmlentities($row['tag_color']);
if (empty($login_tag_color)) {
$login_tag_color = "dark";
}
$login_tag_icon = nullable_htmlentities($row['tag_icon']);
if (empty($login_tag_icon)) {
$login_tag_icon = "tag";
}

$login_tag_id_array[] = $login_tag_id;
$login_tag_name_display_array[] = "<a href='client_logins.php?client_id=$client_id&tags[]=$login_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $login_tag_color;'><i class='fa fa-fw fa-$login_tag_icon mr-2'></i>$login_tag_name</span></a>";
}
$login_tags_display = implode('', $login_tag_name_display_array);

?>
<tr>
<td>
Expand Down

0 comments on commit eb70aba

Please sign in to comment.