.
* ---------------------------------------------------------------------
*/
$AJAX_INCLUDE = 1;
include ('../inc/includes.php');
// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
if (isset($_POST["table"])
&& isset($_POST["value"])) {
// Security
if (!$DB->tableExists($_POST['table'])) {
exit();
}
switch ($_POST["table"]) {
case "glpi_users" :
if ($_POST['value'] == 0) {
$tmpname = [
'link' => $CFG_GLPI['root_doc']."/front/user.php",
'comment' => "",
];
} else {
if (is_array($_POST["value"])) {
$comments = [];
foreach ($_POST["value"] as $users_id) {
$username = getUserName($users_id, 2);
$comments[] = $username['comment'] ?? "";
}
$tmpname = [
'comment' => implode("
", $comments),
];
unset($_POST['withlink']);
} else {
$tmpname = getUserName($_POST["value"], 2);
}
}
echo $tmpname["comment"];
if (isset($_POST['withlink'])) {
echo "\n";
}
break;
default :
if ($_POST["value"] > 0) {
$tmpname = Dropdown::getDropdownName($_POST["table"], $_POST["value"], 1);
if (is_array($tmpname) && isset($tmpname["comment"])) {
echo $tmpname["comment"];
}
if (isset($_POST['withlink'])) {
$itemtype = getItemTypeForTable($_POST["table"]);
echo "\n";
}
}
}
}