?> > <span title='<?php echo $map_title; ?> ' <?php echo can_i_edit_maps($conn, $perms[$n]) ? "class='editInPlace'" : ""; ?> ><?php echo $map_name; ?> </span> </th> <?php //Checking the permission to edit a map: If we have permissions to edit it, an icon will be shown to edit the map. if (can_i_edit_maps($conn, $perms[$n])) { ?> <td style="text-align:right" align="right" <?php echo $headerclass; ?> > <a href='javascript:;' title='<?php echo _("Map Options"); ?> ' class='menumaps'><img src='images/edit.png' height='18px' border=0></a> </td> <?php } ?> </tr> </table>
} break; case "icon": if (getimagesize("pixmaps/uploaded/" . $erase_element)) { unlink("pixmaps/uploaded/" . $erase_element); } break; } } $query = "SELECT hex(map) AS map, perm, name FROM risk_maps"; $result = $conn->Execute($query); while (!$result->EOF) { $perms[$result->fields['map']] = $result->fields['perm']; $result->MoveNext(); } if (strlen($perms[$map]) > 0 && !can_i_edit_maps($conn, $perms[$map])) { echo ossim_error(_("You don't have permission to edit Map {$map}."), AV_NOTICE); exit; } //Autocomplete - JQuery $autocomplete_keys = array('hosts', 'nets', 'host_groups', 'net_groups', 'sensors'); $assets = Autocomplete::get_autocomplete($conn, $autocomplete_keys); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo _("Risk Maps"); ?> - <?php echo _("Edit");
function get_map($conn, $map, $edit = FALSE) { $filename = "maps/map" . $map . ".jpg"; if (file_exists($filename)) { return $map; } $query = "SELECT HEX(map) AS map, perm, name FROM risk_maps"; $result = $conn->Execute($query); while (!$result->EOF) { if ($edit) { if (file_exists("maps/map" . $result->fields['map'] . ".jpg") && can_i_edit_maps($conn, $result->fields['perm'])) { return $result->fields['map']; } } else { if (file_exists("maps/map" . $result->fields['map'] . ".jpg") && is_map_allowed($result->fields['perm'])) { return $result->fields['map']; } } $result->MoveNext(); } return ''; }