"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "inc/fqdnlabel.class.php" between
glpi-9.3.3.tgz and glpi-9.4.0.tgz

About: GLPI is an IT and asset management software (Information Resource Manager).

fqdnlabel.class.php  (glpi-9.3.3.tgz):fqdnlabel.class.php  (glpi-9.4.0.tgz)
skipping to change at line 148 skipping to change at line 148
static function getIDsByLabelAndFQDNID($label, $fqdns_id, $wildcard_search = false) { static function getIDsByLabelAndFQDNID($label, $fqdns_id, $wildcard_search = false) {
global $DB; global $DB;
$label = strtolower($label); $label = strtolower($label);
if ($wildcard_search) { if ($wildcard_search) {
$count = 0; $count = 0;
$label = str_replace('*', '%', $label, $count); $label = str_replace('*', '%', $label, $count);
if ($count == 0) { if ($count == 0) {
$label = '%'.$label.'%'; $label = '%'.$label.'%';
} }
$relation = "LIKE '$label'"; $relation = ['LIKE', $label];
} else { } else {
$relation = "= '$label'"; $relation = $label;
} }
$IDs = []; $IDs = [];
foreach (['NetworkName' => 'glpi_networknames', foreach (['NetworkName' => 'glpi_networknames',
'NetworkAlias' => 'glpi_networkaliases'] as $class => $tabl e) { 'NetworkAlias' => 'glpi_networkaliases'] as $class => $tabl e) {
$query = "SELECT `id` $criteria = [
FROM `$table` 'SELECT' => 'id',
WHERE `name` $relation "; 'FROM' => $table,
'WHERE' => ['name' => $relation]
];
if ((is_array($fqdns_id)) && (count($fqdns_id) > 0)) { if (is_array($fqdns_id) && count($fqdns_id) > 0
$query .= " AND `fqdns_id` IN ('". implode('\', \'', $fqdns_id). "') || is_int($fqdns_id) && $fqdns_id > 0
"; ) {
} else if ((is_int($fqdns_id)) && ($fqdns_id > 0)) { $criteria['WHERE']['fqdns_id'] = $fqdns_id;
$query .= " AND `fqdns_id` = '$fqdns_id'";
} }
foreach ($DB->request($query) as $element) { $iterator = $DB->request($criteria);
while ($element = $iterator->next()) {
$IDs[$class][] = $element['id']; $IDs[$class][] = $element['id'];
} }
} }
return $IDs; return $IDs;
} }
/** /**
* Look for "computer name" inside all databases * Look for "computer name" inside all databases
* *
* @param $fqdn name to search (for instance : forge.inde pnet.net) * @param $fqdn name to search (for instance : forge.inde pnet.net)
 End of changes. 5 change blocks. 
11 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)