} $params["papi"] = $p_api; $params["name"] = $hostname; $params["hostname"] = $hostname; $params["uuid"] = $uuid; $params["gid"] = $gid; $params["from"] = $from; $params["pid"] = $pid; $params["ltitle"] = get_def_package_label($name, $version); $params["create_directory"] = 'on'; $params["start_script"] = 'on'; $params["clean_on_success"] = 'on'; $params["do_reboot"] = getPackageHasToReboot($p_api, $_GET["pid"]) == 1 ? 'on' : ''; $params["do_wol"] = web_def_awake() == 1 ? 'on' : ''; $params["do_inventory"] = web_def_inventory() == 1 ? 'on' : ''; $params["next_connection_delay"] = web_def_delay(); $params["max_connection_attempt"] = web_def_attempts(); $params["maxbw"] = web_def_maxbw(); $params["deployment_intervals"] = web_def_deployment_intervals(); $prefix = ''; if (strlen($_POST["gid"])) { $prefix = 'group'; } $params['tab'] = $prefix . 'tablaunch'; $halt_to = array(); foreach ($_POST as $p => $v) { if (preg_match('/^issue_halt_to_/', $p)) { $p = preg_replace('/^issue_halt_to_/', '', $p); if ($v == 'on') { $halt_to[] = $p; }
function action($action, $target, $is_advanced) { $from = $_GET['from']; $path = explode('|', $from); $module = $path[0]; $submod = $path[1]; $page = $path[2]; $tab = $path[3]; /* Handle posting of quick actions */ if ($_SESSION["lang"] == "C") { $current_lang = ""; } else { $current_lang = substr($_SESSION["lang"], 0, 2); } if (count($_GET["gid"]) > 0) { $type = 'group'; } else { $type = ''; } if ($is_advanced) { $params = array('from'=> 'base|computers|msctabs|tablaunch'); foreach (array('gid', 'uuid', 'hostname') as $param) { $params[$param] = $_GET[$param]; } $qa = msc_script_detailled_info($action); if ($qa[0]) { $qa = $qa[1]; $params['badvanced'] = True; if (isset($qa['title'.$current_lang])) { $params['ltitle'] = trim('[QA] '.$qa['title'.$current_lang]); } else { $params['ltitle'] = trim('[QA] '.$qa['title']); } if ($action == '007wake_on_lan.msc') { # this is a very special case for WOL, it's not a command as we usualy understand it... $params['failure'] = '1'; $params['create_directory'] = 'off'; $params['start_script'] = 'off'; $params['clean_on_success'] = 'off'; $params['do_reboot'] = 'off'; $params['do_wol'] = 'on'; $params['do_inventory'] = 'off'; $params['issue_halt'] = 'off'; $params['next_connection_delay'] = 0; $params['max_connection_attempt'] = 1; $params['attempts_left'] = 1; foreach (array('create_directory', 'start_script', 'clean_on_success', 'do_reboot', 'do_wol', 'next_connection_delay', 'max_connection_attempt', 'do_inventory', 'copy_mode', 'deployment_intervals', 'issue_halt', 'parameters', 'local_proxy', 'maxbw') as $p) { $params['hide_'.$p] = True; } } else { $params['do_reboot'] = ''; $params["next_connection_delay"] = web_def_delay(); $params["max_connection_attempt"] = web_def_attempts(); $params["maxbw"] = web_def_maxbw(); $params["copy_mode"] = web_def_mode(); $params["deployment_intervals"] = web_def_deployment_intervals(); $halt = web_def_issue_halt_to(); foreach ($halt as $h) { $params["issue_halt_to_".$h] = 'on'; } } $params['launchAction'] = $action; header("Location: ".urlStrRedirect("base/computers/".$type."msctabs", $params)); exit; } else { new NotifyWidgetFailure(_T('Failed to retrieve this quick action.', 'msc')); } } else { $id = add_command_quick_with_id($action, $target, $current_lang, $_GET["gid"]); if ($id != -1) { scheduler_start_these_commands("", array($id)); // if on a single computer if (count($_GET["gid"]) > 0) { $actionpage = 'groupmsctabs'; $tab = 'grouptablogs'; } else { $actionpage = 'msctabs'; $tab = 'tablogs'; } header("Location: ".urlStrRedirect("base/computers/$actionpage", array('tab'=>$tab, 'uuid'=>$_GET['uuid'], 'hostname'=>$_GET['hostname'], 'cmd_id'=>$id, 'gid'=>$_GET['gid']))); exit; } } }