new NotifyWidgetFailure(sprintf(_T("A profile already exists with name '%s'", "dyngroup"), $name)); } else { $list = $group->members(); $members = array(); foreach ($list as $member) { $members[$member['hostname'] . "##" . $member['uuid']] = $member['hostname']; $listOfMembers[$member['uuid']] = $member; } if (!$members) { $members = array(); } if (!$listOfMembers) { $listOfMembers = array(); } $truncate_limit = getMaxElementsForStaticList(); $listOfMachines = getRestrictedComputersList(0, $truncate_limit, array('get' => array('cn', 'objectUUID'), 'imaging_server' => $imaging_server), False); $count = getRestrictedComputersListLen(array('imaging_server' => $imaging_server)); if ($truncate_limit < $count) { new NotifyWidgetWarning(sprintf(_T("Computers list has been truncated at %d computers", "dyngroup"), $truncate_limit)); } $machines = array(); foreach ($listOfMachines as $machine) { $machines[$machine['cn'] . "##" . $machine['objectUUID']] = $machine['cn']; } } ksort($members); reset($members); ksort($machines); $diff = array_diff_assoc($machines, $members); natcasesort($diff); if (isset($_GET['pieGroupStatus'])) {
<?php include 'modules/imaging/includes/includes.php'; include 'modules/imaging/includes/xmlrpc.inc.php'; if (isset($_GET['gid'])) { $nb = extract($_GET); } else { header("Location: " . urlStrRedirect("imaging/manage/index")); exit; } $label = urldecode($_GET['itemlabel']); $params = getParams(); if ($_POST) { $nb = extract($_POST); $location = getCurrentLocation(); $list = getRestrictedComputersList(0, -1, array('gid' => $gid, 'hostname' => '', 'location' => $location), False); list($count, $masters) = xmlrpc_getLocationImages($location); if (count($list) == 0) { $msg = _T("Multicast menu has not been created : there are no computers in the group", "imaging"); new NotifyWidgetFailure($msg); header("Location: " . urlStrRedirect("imaging/manage/list_profiles")); exit; } if (!isset($numbercomputer)) { $msg = sprintf(_T("Multicast menu has not been created : number of computers missing")); new NotifyWidgetFailure($msg); header("Location: " . urlStrRedirect("imaging/manage/list_profiles")); exit; } else { $numbercomputer = intval($numbercomputer); }
foreach ($_POST["members"] as $member) { $ma = preg_split("/##/", $member); unset($right[$member]); } } } elseif (isset($_POST["baddmachine_x"])) { if (isset($_POST["machines"])) { foreach ($_POST["machines"] as $machine) { $ma = preg_split("/##/", $machine); $right[$machine] = $ma[0]; } } } else { /* Computers list to diplay on the left */ if ($group->isRequest()) { $list = getRestrictedComputersList(0, -1, array('gid' => $id), False); $list = array_map(format, $list); } else { $list = $group->members(); } /* all computers of the group */ $machines = array(); foreach ($list as $machine) { $machines[$machine['hostname'] . "##" . $machine['uuid']] = $machine['hostname']; } $right = array(); } reset($right); ksort($machines); $left = array_diff_assoc($machines, $right); natcasesort($left);
if (isset($_GET['imaging_server'])) { $filter['imaging_server'] = $_GET['imaging_server']; } if (in_array("dyngroup", $_SESSION["modulesList"])) { require_once("modules/pulse2/includes/groups_xmlrpc.inc.php"); require_once("modules/dyngroup/includes/dyngroup.php"); if (isset($_GET['gid'])) { $filter['gid'] = $_GET['gid']; $canbedeletedfromgroup = true; $canbedeleted = false; $is_group = true; if (isrequest_group($_GET['gid'])) { $canbedeletedfromgroup = false; } } } $cl = getRestrictedComputersList($start, $start + $maxperpage, $filter, False); $cl1 = array(); foreach ($cl as $k => $v) { $cl1[$v[1]['cn'][0].$k] = $k; } $names = array(); function my_cmp($a, $b) { return strcmp(strtolower($a), strtolower($b)); } uksort($cl1, "my_cmp"); foreach ($cl1 as $k1 =>$k) { $names[] = join_value($cl[$k]); } $count = getComputerCount($filter); /* Check:
function get_first($val) { return $val[0]; } function get_second($val) { return _T($val[1], "base"); } function get_values($h, $values) { $ret = array(); foreach ($h as $k) { if (is_array($values[$k])) { $ret[] = implode('/', $values[$k]); } else { $ret[] = $values[$k]; } } return $ret; } $headers = getComputersListHeaders(); print "\"" . implode('","', array_map("get_second", $headers)) . "\"\n"; $datum = getRestrictedComputersList(0, -1, array('gid' => $gid, 'location' => $location), False); foreach ($datum as $machine) { print "\"" . implode('","', get_values(array_map("get_first", $headers), $machine[1])) . "\"\n"; } exit; ?>