//====================================================================================
// OCS INVENTORY REPORTS
// Copyleft Pierre LEMMET 2005
// Web: http://ocsinventory.sourceforge.net
//
// This code is open source and may be copied and modified as long as the source
// code is always made freely available.
// Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
//====================================================================================
//Modified on 9/30/2005
require ('fichierConf.class.php');
printEnTete($l->g(107));
$lesEdits = array("IPDISCOVER_MAX_ALIVE","DOWNLOAD_CYCLE_LATENCY","DOWNLOAD_FRAG_LATENCY","DOWNLOAD_PERIOD_LATENCY",
"DOWNLOAD_PERIOD_LENGTH","DOWNLOAD_TIMEOUT","PROLOG_FREQ");
if( isset($_POST["FREQUENCY"] ) ) {
switch($_POST["FREQUENCY"]) {
case "NEVER" : setOpt("FREQUENCY", -1); break;
case "ALWAYS": setOpt("FREQUENCY", 0); break;
default: setOpt("FREQUENCY", $_POST["FREQUENCY_edit"]);
}
switch($_POST["IPDISCOVER"]) {
case "OFF": setOpt("IPDISCOVER", 0); break;
default: setOpt("IPDISCOVER", $_POST["IPDISCOVER_edit"]);
}
$autoDupLvl = isset($_POST["AUTO_DUPLICATE_LVL_serial"])?$_POST["AUTO_DUPLICATE_LVL_serial"]:0;
$autoDupLvl += isset($_POST["AUTO_DUPLICATE_LVL_host"])?$_POST["AUTO_DUPLICATE_LVL_host"]:0;
$autoDupLvl += isset($_POST["AUTO_DUPLICATE_LVL_mac"])?$_POST["AUTO_DUPLICATE_LVL_mac"]:0;
setOpt("AUTO_DUPLICATE_LVL", $autoDupLvl);
$lesOnOff = array("REGISTRY","UPDATE","DEPLOY","TRACE_DELETED","LOGLEVEL","DOWNLOAD","INVENTORY_DIFF","INVENTORY_TRANSACTION");
foreach($lesOnOff as $oo)
setOpt($oo, ($_POST[$oo]=="ON"?1:0));
foreach($lesEdits as $ee)
setOpt($ee, $_POST[$ee."_edit"]);
}
?>
";
function showOption($nme, $val) {
switch($nme) {
case "REGISTRY":
case "UPDATE":
case "DEPLOY":
case "TRACE_DELETED":
case "LOGLEVEL":
case "DOWNLOAD":
case "INVENTORY_DIFF":
case "INVENTORY_TRANSACTION":
echo "";
break;
case "AUTO_DUPLICATE_LVL":
echo "";
break;
case "IPDISCOVER":
echo "";
break;
case "FREQUENCY":
echo "";
break;
default:
echo edit($nme,$val);
break;
}
}
function edit($nme, $val) {
$enabled = true;
$valInit = $val;
if( $nme == "FREQUENCY" && $val < 1 ) {
$enabled = false;
$valInit = 1;
}
else if( $nme == "IPDISCOVER" && $val <= 0 )
$enabled = false;
return "";
}
function setOpt($nme, $ivalue) {
mysql_query("UPDATE config SET IVALUE=$ivalue WHERE name='$nme'", $_SESSION["writeServer"]) or die(mysql_error());
}