grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* NetworkAlias Class
*
* @since version 0.84
**
*/
class NetworkAlias extends FQDNLabel {
// From CommonDBChild
static public $itemtype = 'NetworkName';
static public $items_id = 'networknames_id';
public $dohistory = true;
static public $checkParentRights = CommonDBConnexity::HAVE_SAME_RIGHT_ON_ITEM;
static function getTypeName($nb=0) {
return _n('Network alias', 'Network aliases', $nb);
}
function defineTabs($options=array()) {
$ong = array();
$this->addDefaultFormTab($ong);
return $ong;
}
/**
* Get the full name (internet name) of a NetworkName
*
* @param $ID ID of the NetworkName
*
* @return its internet name, or empty string if invalid NetworkName
**/
static function getInternetNameFromID($ID) {
$networkAlias = new self();
if ($networkalias->can($ID, READ))
return FQDNLabel::getInternetNameFromLabelAndDomainID($this->fields["name"],
$this->fields["fqdns_id"]);
return "";
}
/**
* Print the network alias form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate template or basic computer
*
* @return Nothing (display)
**/
function showForm ($ID, $options=array()) {
// Show only simple form to add / edit
$showsimple = false;
if (isset($options['parent'])) {
$showsimple = true;
$options['networknames_id'] = $options['parent']->getID();
}
$this->initForm($ID, $options);
$recursiveItems = $this->recursivelyGetItems();
if (count($recursiveItems) == 0) {
return false;
}
$lastItem = $recursiveItems[count($recursiveItems) - 1];
$options['entities_id'] = $lastItem->getField('entities_id');
$this->showFormHeader($options);
echo "
\n";
Session::initNavigateListItems($item->getType(),
//TRANS : %1$s is the itemtype name, %2$s is the name of the item (used for headings of a list)
sprintf(__('%1$s = %2$s'),
self::getTypeName(1), $item->fields['name']));
$query = "SELECT `glpi_networkaliases`.`id` AS alias_id,
`glpi_networkaliases`.`name` AS alias,
`glpi_networknames`.`id` AS address_id,
`glpi_networkaliases`.`comment` AS comment
FROM `glpi_networkaliases`, `glpi_networknames`
WHERE `glpi_networkaliases`.`fqdns_id` = '".$item->getID()."'
AND `glpi_networknames`.`id` = `glpi_networkaliases`.`networknames_id`
ORDER BY `$order`
LIMIT ".$_SESSION['glpilist_limit']."
OFFSET $start";
foreach ($DB->request($query) as $data) {
Session::addToNavigateListItems($alias->getType(),$data["alias_id"]);
if ($address->getFromDB($data["address_id"])) {
echo "