/** * @param unknown $name : PluginName * @param unknown $action : Possible actions => delete (0) and install (1) */ function exec_plugin_soap_client($name, $action) { $champs = array('OCS_SERVER_ADDRESS' => 'OCS_SERVER_ADDRESS'); $values = look_config_default_values($champs); $address = $values['tvalue']['OCS_SERVER_ADDRESS']; ini_set("safe_mode", "0"); $command = "perl " . MAIN_SECTIONS_DIR . "ms_plugins/client.pl " . $address . " " . $name . " " . $action; exec($command); ini_set("safe_mode", "1"); }
function plugin_soap_client($name, $action) { $champs = array('OCS_SERVER_ADDRESS' => 'OCS_SERVER_ADDRESS'); $values = look_config_default_values($champs); $address = $values['tvalue']['OCS_SERVER_ADDRESS']; if ($action == 1) { $method = "InstallPlugins"; } else { $method = "DeletePlugins"; } $client = new SoapClient(null, array('location' => "http://{$address}/ocsplugins", 'uri' => "http://{$address}/Apache/Ocsinventory/Plugins/Modules")); $request = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> \n\t\t<soap:Envelope \n \t\tsoap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'\n \t\txmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' \n \t\t\txmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'\n \t\txmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' \n \t\txmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n \t\t<soap:Body>\n\t\t\t<{$method} xmlns='http://{$address}/Apache/Ocsinventory/Plugins/Modules'><c-gensym3 xsi:type='xsd:string'>{$name}</c-gensym3></{$method}>\n\t\t</soap:Body>\n\t\t</soap:Envelope>"; $output = $client->__doRequest($request, "http://{$address}/ocsplugins", "http://{$address}/Apache/Ocsinventory/Plugins/Modules#{$method}", "1.1"); }
private function pacquet($Mac) { $packet = ""; $macAddr = ''; $addrByte = explode(':', $Mac); foreach ($addrByte as $v) { $macAddr .= chr(hexdec($v)); } for ($i = 0; $i < 6; $i++) { $packet .= chr(0xff); } for ($j = 0; $j < 16; $j++) { $packet .= $macAddr; } //use bios password? $wol_info = look_config_default_values('WOL_BIOS_PASSWD'); if (isset($wol_info['name']['WOL_BIOS_PASSWD'])) { $packet .= $wol_info['tvalue']['WOL_BIOS_PASSWD']; } return $packet; }
echo "<input type='hidden' name='document_root' value='" . $protectedPost['document_root'] . "'>\t \n\t <input type='hidden' id='timestamp' name='timestamp' value='" . $protectedPost['timestamp'] . "'>"; echo "<script language='javascript'>\n\t\tfunction verif()\n\t\t {\n\t\t\tvar msg = '';\n\t\t\tchamps = new Array('NAME','DESCRIPTION','OS','PROTOCOLE','PRIORITY','ACTION','ACTION_INPUT','REDISTRIB_USE');\n\t\t\tchamps_OS = new Array('NOTIFY_USER','NEED_DONE_ACTION');\n\t\t\tchamps_ACTION=new Array('teledeploy_file');\n\t\t\tchamps_REDISTRIB_USE=new Array('REDISTRIB_PRIORITY');\n\t\t\tchamps_NOTIFY_USER=new Array('NOTIFY_TEXT','NOTIFY_COUNTDOWN','NOTIFY_CAN_ABORT','NOTIFY_CAN_DELAY');\n\t\t\tchamps_NEED_DONE_ACTION=new Array('NEED_DONE_ACTION_TEXT');\n\t\t\t\n\n\n\t\t\n\t\t\tfor (var n = 0; n < champs.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById(champs[n]).value == ''){\n\t\t\t\t document.getElementById(champs[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_OS.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('OS').value == 'WINDOWS' && document.getElementById(champs_OS[n]).value == ''){\n\t\t\t\t document.getElementById(champs_OS[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_OS[n]).style.backgroundColor = '';\n\t\t\t}\n\t\t\tfor (var n = 0; n < champs_ACTION.length; n++)\n\t\t\t{\n\t\t\t\tvar name_file=document.getElementById(champs_ACTION[n]).value;\n\t\t\t\tname_file=name_file.toUpperCase();\n\t\t\t\tif (document.getElementById(\"OS\").value == 'WINDOWS')\n\t\t\t\t\tvar debut=name_file.length-3;\n\t\t\t\telse\n\t\t\t\t\tvar debut=name_file.length-6;\n\t\t\t\tif (document.getElementById('ACTION').value != 'EXECUTE' && document.getElementById(champs_ACTION[n]).value == ''){\n\t\t\t\t\talert('" . $l->g(602) . "');\n\t\t\t\t \tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t \tmsg='NULL';\n\t\t\t\t }\n\t\t\t\telse if (document.getElementById('ACTION').value != 'EXECUTE' && name_file.substring(debut,name_file.length) != 'ZIP' && document.getElementById(\"OS\").value == 'WINDOWS'){\n\t\t\t\t\talert('" . $l->g(1231) . "');\n\t\t\t\t\tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t\tmsg='NULL';\n\t\t\t\t}else if (document.getElementById('ACTION').value != 'EXECUTE' && name_file.substring(debut,name_file.length) != 'TAR.GZ' && document.getElementById(\"OS\").value != 'WINDOWS'){\n\t\t\t\t\talert('" . $l->g(1232) . "');\n\t\t\t\t\tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t\tmsg='NULL';\n\t\t\t\t}\n\t\t\t\t document.getElementById(champs_ACTION[n]).style.backgroundColor = '';\n\n\t\t\t}\n\t\t\t\n\t\t\tfor (var n = 0; n < champs_REDISTRIB_USE.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('REDISTRIB_USE').value == 1 && document.getElementById(champs_REDISTRIB_USE[n]).value == ''){\n\t\t\t\t document.getElementById(champs_REDISTRIB_USE[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_REDISTRIB_USE[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_NOTIFY_USER.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('NOTIFY_USER').value == 1 && document.getElementById(champs_NOTIFY_USER[n]).value == ''){\n\t\t\t\t document.getElementById(champs_NOTIFY_USER[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_NOTIFY_USER[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_NEED_DONE_ACTION.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('NEED_DONE_ACTION').value == 1 && document.getElementById(champs_NEED_DONE_ACTION[n]).value == ''){\n\t\t\t\t document.getElementById(champs_NEED_DONE_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_NEED_DONE_ACTION[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tif (msg != ''){\n\t\t\talert ('" . $l->g(1001) . "');\n\t\t\treturn false;\n\t\t\t}else\n\t\t\treturn true;\t\t\t\n\t\t}\n\t</script>"; echo "<div "; if ($protectedPost['valid']) { echo " style='display:none;'"; } echo ">"; printEnTete($l->g(434)); echo "<br>"; $activate = option_conf_activate('TELEDIFF_WK'); //If workflow for teledeploy is activated //We show only the package we can create if ($activate) { msg_info($l->g(1105) . "<br>" . $l->g(1106) . "<br>" . $l->g(1107)); //get all request with the status "Create a Package" $conf_creat_Wk = look_config_default_values(array('IT_SET_NIV_CREAT')); $info_dde_statut_creat = info_dde(find_dde_by_status($conf_creat_Wk['tvalue']['IT_SET_NIV_CREAT'])); if ($info_dde_statut_creat != '') { $array_id_fields = find_id_field(array('NAME_TELEDEPLOY', 'PRIORITY', 'NOTIF_USER', 'REPORT_USER', 'INFO_PACK')); //build the seach $id_name = "fields_" . $array_id_fields['NAME_TELEDEPLOY']->id; $id_description = "fields_" . $array_id_fields['INFO_PACK']->id; $id_priority = "fields_" . $array_id_fields['PRIORITY']->id; $id_notify_user = "******" . $array_id_fields['NOTIF_USER']->id; foreach ($info_dde_statut_creat as $id => $tab_value) { $list_dde_creat[$tab_value->ID] = $tab_value->{$id_name}; } echo "<br><b>" . $l->g(1183) . ":</b>" . show_modif($list_dde_creat, 'LIST_DDE_CREAT', 2, $form_name); if (!$protectedPost['LIST_DDE_CREAT'] or $protectedPost['LIST_DDE_CREAT'] == "") { echo close_form(); require_once FOOTER_HTML;
function add_mach($id_group, $list_mach) { $default_values = look_config_default_values(array('DOWNLOAD_SERVER_URI', 'DOWNLOAD_SERVER_DOCROOT')); if (is_array($list_mach)) { foreach ($list_mach as $key => $value) { $reqCache = "INSERT IGNORE INTO download_servers(hardware_id, url, add_rep,GROUP_ID) \n\t\t\t\t\t\tVALUES (%s,'%s','%s',%s)"; $argcache = array($value, $default_values['tvalue']['DOWNLOAD_SERVER_URI'], $default_values['tvalue']['DOWNLOAD_SERVER_DOCROOT'], $id_group); $cachedRes = mysql2_query_secure($reqCache, $_SESSION['OCS']["writeServer"], $argcache); } } else { $reqCache = "INSERT IGNORE INTO download_servers(hardware_id, url, add_rep,GROUP_ID) \n\t\t\t\t\t\tselect id,'%s','%s',%s\n\t\t\t\t\t from hardware where id in "; $argCache = array($default_values['tvalue']['DOWNLOAD_SERVER_URI'], $default_values['tvalue']['DOWNLOAD_SERVER_DOCROOT'], $id_group); $arg = mysql2_prepare($reqCache, $argCache, $list_mach); $cachedRes = mysql2_query_secure($arg['SQL'], $_SESSION['OCS']["writeServer"], $arg['ARG']); } return mysql_affected_rows($_SESSION['OCS']["writeServer"]); }
require_once 'require/function_telediff.php'; require_once 'require/function_search.php'; require_once 'require/function_telediff_wk.php'; //p($protectedPost); $form_name = "pack_affect"; $table_name = "LIST_PACK_SEARCH"; echo open_form($form_name); $list_id = multi_lot($form_name, $l->g(601)); //TELEDIFF_WK $activate = option_conf_activate('TELEDIFF_WK'); //use teledeploy workflow? if ($activate) { //yes $msg_wk = $l->g(1105) . "<br>" . $l->g(1110) . "<br>"; //find all config of workflow $conf_Wk = look_config_default_values(array('IT_SET_PERIM', 'IT_SET_NAME_TEST', 'IT_SET_NAME_LIMIT', 'IT_SET_TAG_NAME', 'IT_SET_NIV_TEST', 'IT_SET_NIV_REST', 'IT_SET_NIV_TOTAL')); //find id field of status $sql_status = "select ID from downloadwk_fields where FIELD='STATUS'"; $res_status = mysql2_query_secure($sql_status, $_SESSION['OCS']["readServer"]); $val_status = mysql_fetch_array($res_status); //find distinct id of status to affect a package $sql_id_stat = "select NAME,ID from downloadwk_statut_request where NAME= '%s' or NAME='%s' or NAME = '%s'"; $arg_id_stat = array($conf_Wk['tvalue']['IT_SET_NIV_TEST'], $conf_Wk['tvalue']['IT_SET_NIV_REST'], $conf_Wk['tvalue']['IT_SET_NIV_TOTAL']); $res_id_stat = mysql2_query_secure($sql_id_stat, $_SESSION['OCS']["readServer"], $arg_id_stat); while ($val_id_stat = mysql_fetch_array($res_id_stat)) { $id_stat[$val_id_stat['NAME']] = $val_id_stat['ID']; } //find all package can be affected TEST status $sql_affect_pack = "select fileid from download_available d_a \n\t\t\t\t\t\t\t\t\t\tleft join downloadwk_pack dwk_p\ton d_a.id_wk=dwk_p.id \n\t\t\t\t\t\t\t\t\t\tleft join downloadwk_statut_request dwk_stat on dwk_stat.id=dwk_p.fields_" . $val_status['ID'] . "\n\t\t\t\t\t\t\t\t\t\twhere d_a.id_wk = 0 or dwk_stat.name = '%s'"; $res_affect_pack = mysql2_query_secure($sql_affect_pack, $_SESSION['OCS']["readServer"], $conf_Wk['tvalue']['IT_SET_NIV_TEST']); while ($val_affect_pack = mysql_fetch_array($res_affect_pack)) {
if (!isset($_SESSION['OCS']["usecache"]) or !isset($_SESSION['OCS']["tabcache"])) { $conf_gui = array('usecache' => 'INVENTORY_CACHE_ENABLED', 'tabcache' => 'TAB_CACHE', 'USE_NEW_SOFT_TABLES' => 'USE_NEW_SOFT_TABLES'); $default_value_conf = array('INVENTORY_CACHE_ENABLED' => 1, 'TAB_CACHE' => 0, 'USE_NEW_SOFT_TABLES' => 0); $values = look_config_default_values($conf_gui); foreach ($conf_gui as $k => $v) { if (isset($values['ivalue'][$v])) { $_SESSION['OCS'][$k] = $values['ivalue'][$v]; } else { $_SESSION['OCS'][$k] = $default_value_conf[$v]; } } } /********************END GESTION CACHE******************/ /********************MANAGE DOWNLOAD REDISTRIBUTION******************/ if (!isset($_SESSION['OCS']["use_redistribution"])) { $values = look_config_default_values(array('DOWNLOAD_REDISTRIB')); $_SESSION['OCS']['use_redistribution'] = $values['ivalue']['DOWNLOAD_REDISTRIB']; if (!isset($_SESSION['OCS']["use_redistribution"])) { $_SESSION['OCS']["use_redistribution"] = 1; } } /********************END DOWNLOAD REDISTRIBUTION******************/ /*********************************************GESTION OF LBL_TAG*************************************/ if (!isset($_SESSION['OCS']['TAG_LBL'])) { require_once 'require/function_admininfo.php'; $all_tag_lbl = witch_field_more('COMPUTERS'); foreach ($all_tag_lbl['LIST_NAME'] as $key => $value) { $_SESSION['OCS']['TAG_LBL'][$value] = $all_tag_lbl['LIST_FIELDS'][$key]; $_SESSION['OCS']['TAG_ID'][$key] = $value; } }
function print_perso($systemid) { global $l, $td1, $td2, $td3, $td4, $pages_refs, $protectedGet; $i = 0; $queryDetails = "SELECT * FROM devices WHERE hardware_id={$systemid}"; $resultDetails = mysql_query($queryDetails, $_SESSION['OCS']["readServer"]) or die(mysql_error($_SESSION['OCS']["readServer"])); $form_name = 'config_group'; echo open_form($form_name); echo "<table BORDER='0' WIDTH = '95%' ALIGN = 'Center' CELLPADDING='0' BGCOLOR='#C7D9F5' BORDERCOLOR='#9894B5'>"; //echo "<tr><td> </td> $td1 "."Libell�"." </td> $td1 "."Valeur"." </td><td> </td></tr>"; while ($item = mysql_fetch_array($resultDetails, MYSQL_ASSOC)) { $optPerso[$item["NAME"]]["IVALUE"] = $item["IVALUE"]; $optPerso[$item["NAME"]]["TVALUE"] = $item["TVALUE"]; } $ii++; $td3 = $ii % 2 == 0 ? $td2 : $td4; //IPDISCOVER echo "<tr><td bgcolor='white' align='center' valign='center'>" . (isset($optPerso["IPDISCOVER"]) && $optPerso["IPDISCOVER"]["IVALUE"] != 1 ? "<img width='15px' src='image/red.png'>" : " ") . "</td> </td>"; echo $td3 . $l->g(489) . "</td>"; if (isset($optPerso["IPDISCOVER"])) { if ($optPerso["IPDISCOVER"]["IVALUE"] == 0) { echo $td3 . $l->g(490) . "</td>"; } else { if ($optPerso["IPDISCOVER"]["IVALUE"] == 2) { echo $td3 . $l->g(491) . " " . $optPerso["IPDISCOVER"]["TVALUE"] . "</td>"; } else { if ($optPerso["IPDISCOVER"]["IVALUE"] == 1) { echo $td3 . $l->g(492) . " " . $optPerso["IPDISCOVER"]["TVALUE"] . "</td>"; } } } } else { echo $td3 . $l->g(493) . "</td>"; } if ($_SESSION['OCS']['CONFIGURATION']['CONFIG'] == "YES") { echo "<td align=center rowspan=8><a href=# Onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_custom_param'] . "&head=1&idchecked=" . $systemid . "&origine=group\",\"rollo\",\"location=0,status=0,scrollbars=1,menubar=0,resizable=0,width=800,height=500\");>\n\t\t<img src='image/modif_a.png' title='" . $l->g(285) . "'></a></td></tr>"; } $ii++; $td3 = $ii % 2 == 0 ? $td2 : $td4; $field_name = array('DOWNLOAD', 'DOWNLOAD_CYCLE_LATENCY', 'DOWNLOAD_PERIOD_LENGTH', 'DOWNLOAD_FRAG_LATENCY', 'DOWNLOAD_PERIOD_LATENCY', 'DOWNLOAD_TIMEOUT', 'PROLOG_FREQ', 'SNMP'); $optdefault = look_config_default_values($field_name); //FREQUENCY echo "<tr><td bgcolor='white' align='center' valign='center'>" . (isset($optPerso["FREQUENCY"]) ? "<img width='15px' src='image/red.png'>" : " ") . "</td>"; echo $td3 . $l->g(494) . "</td>"; if (isset($optPerso["FREQUENCY"])) { if ($optPerso["FREQUENCY"]["IVALUE"] == 0) { echo $td3 . $l->g(485) . "</td>"; } else { if ($optPerso["FREQUENCY"]["IVALUE"] == -1) { echo $td3 . $l->g(486) . "</td>"; } else { echo $td3 . $l->g(495) . " " . $optPerso["FREQUENCY"]["IVALUE"] . " " . $l->g(496) . "</td>"; } } } else { echo $td3 . $l->g(497) . "</td>"; } echo "</tr>"; //DOWNLOAD_SWITCH echo "<tr><td bgcolor='white' align='center' valign='center'>" . (isset($optPerso["DOWNLOAD_SWITCH"]) ? "<img width='15px' src='image/red.png'>" : " ") . "</td>"; echo $td3 . $l->g(417) . " <font color=green size=1><i>DOWNLOAD</i></font> </td>"; if (isset($optPerso["DOWNLOAD_SWITCH"])) { if ($optPerso["DOWNLOAD_SWITCH"]["IVALUE"] == 0) { echo $td3 . $l->g(733) . "</td>"; } else { if ($optPerso["DOWNLOAD_SWITCH"]["IVALUE"] == 1) { echo $td3 . $l->g(205) . "</td>"; } else { echo $td3 . "</td>"; } } } else { echo $td3 . $l->g(488) . "("; if ($optdefault['ivalue']["DOWNLOAD"] == 1) { echo $l->g(205); } else { echo $l->g(733); } echo ")</td>"; } echo "</tr>"; //DOWNLOAD_CYCLE_LATENCY optperso("DOWNLOAD_CYCLE_LATENCY", $l->g(720) . " <font color=green size=1><i>DOWNLOAD_CYCLE_LATENCY</i></font>", $optPerso, 1, $optdefault['ivalue']["DOWNLOAD_CYCLE_LATENCY"], $l->g(511)); //DOWNLOAD_FRAG_LATENCY optperso("DOWNLOAD_FRAG_LATENCY", $l->g(721) . " <font color=green size=1><i>DOWNLOAD_FRAG_LATENCY</i></font>", $optPerso, 1, $optdefault['ivalue']["DOWNLOAD_FRAG_LATENCY"], $l->g(511)); //DOWNLOAD_PERIOD_LATENCY optperso("DOWNLOAD_PERIOD_LATENCY", $l->g(722) . " <font color=green size=1><i>DOWNLOAD_PERIOD_LATENCY</i></font>", $optPerso, 1, $optdefault['ivalue']["DOWNLOAD_PERIOD_LATENCY"], $l->g(511)); //DOWNLOAD_PERIOD_LENGTH optperso("DOWNLOAD_PERIOD_LENGTH", $l->g(723) . " <font color=green size=1><i>DOWNLOAD_PERIOD_LENGTH</i></font>", $optPerso, 1, $optdefault['ivalue']["DOWNLOAD_PERIOD_LENGTH"]); //PROLOG_FREQ optperso("PROLOG_FREQ", $l->g(724) . " <font color=green size=1><i>PROLOG_FREQ</i></font>", $optPerso, 1, $optdefault['ivalue']["PROLOG_FREQ"], $l->g(730)); //SNMP_SWITCH echo "<tr><td bgcolor='white' align='center' valign='center'>" . (isset($optPerso["SNMP_SWITCH"]) ? "<img width='15px' src='image/red.png'>" : " ") . "</td>"; echo $td3 . $l->g(1197) . " <font color=green size=1><i>SNMP_SWITCH</i></font></td>"; if (isset($optPerso["SNMP_SWITCH"])) { if ($optPerso["SNMP_SWITCH"]["IVALUE"] == 0) { echo $td3 . $l->g(733) . "</td>"; } else { if ($optPerso["SNMP_SWITCH"]["IVALUE"] == 1) { echo $td3 . $l->g(205) . "</td>"; } else { echo $td3 . "</td>"; } } } else { echo $td3 . $l->g(488) . "("; if ($optdefault['ivalue']["SNMP"] == 1) { echo $l->g(205); } else { echo $l->g(733); } echo ")</td>"; } echo "</tr>"; //TELEDEPLOY require_once 'require/function_machine.php'; show_packages($systemid, "ms_group_show"); if ($_SESSION['OCS']['CONFIGURATION']['TELEDIFF'] == "YES") { echo "<tr>\n\t\t<td colspan='10' align='right'>\n\t\t<a href=# Onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_custom_pack'] . "&head=1&idchecked=" . $systemid . "&origine=group\",\"rollo\",\"location=0,status=0,scrollbars=1,menubar=0,resizable=0,width=800,height=500\");>" . $l->g(501) . "\n\t\t</a>\n\t\t</td></tr>"; } echo "</table><br>"; echo close_form(); }
} } if (!$protectedPost['SHOW_SELECT']) { $protectedPost['SHOW_SELECT'] = 'download'; $tab_options['SHOW_SELECT'] = 'download'; } echo "<BR>" . show_modif(array('download' => $l->g(990), 'server' => $l->g(991)), 'SHOW_SELECT', 2, $form_name) . "<BR><BR>"; //only for profils who can activate packet if (!$cant_active) { //where packets are created? if ($protectedPost['SHOW_SELECT'] == 'download') { $config_document_root = "DOWNLOAD_PACK_DIR"; } else { $config_document_root = "DOWNLOAD_REP_CREAT"; } $info_document_root = look_config_default_values($config_document_root); $document_root = $info_document_root["tvalue"][$config_document_root]; //if no directory in base, take $_SERVER["DOCUMENT_ROOT"] if (!isset($document_root)) { $document_root = VARLIB_DIR . '/download'; if ($protectedPost['SHOW_SELECT'] == "server") { $document_root .= "server/"; } } else { //can we have the zip? $document_root .= "/download"; } if (is_readable($document_root) && is_dir($document_root)) { $dir = @opendir($document_root); while ($f = readdir($dir)) { if (is_numeric($f)) {
function find_limit_values() { $arg = look_config_default_values('GUI_REPORT_%', 1); return $arg['ivalue']; }
ob_start(); $ajax = true; } else { $ajax = false; } $tab_options = $protectedPost; require_once 'require/function_files.php'; require_once 'require/function_ipdiscover.php'; $form_name = 'ipdiscover_analyse'; $table_name = $form_name; $tab_options['form_name'] = $form_name; $tab_options['table_name'] = $table_name; echo open_form($form_name); $pas = $protectedGet['rzo']; //$rez = $nomRez; $values = look_config_default_values(array('IPDISCOVER_IPD_DIR'), '', array('IPDISCOVER_IPD_DIR' => array('TVALUE' => VARLIB_DIR))); $fname = $values['tvalue']['IPDISCOVER_IPD_DIR']; $file_name = $fname . "/ipd/" . $pas . ".ipd"; //reset cache? if (isset($protectedPost['reset']) and $protectedPost['reset'] != '') { unlink($file_name); reloadform_closeme('', true); } else { if (!is_readable($file_name)) { runCommand("-cache -net=" . $pas, $fname); } $tabBalises = array($l->g(34) => "IP", $l->g(95) => "MAC", $l->g(49) => "NAME", $l->g(232) => "DATE", $l->g(66) => "TYPE"); $ret = array(); $ret = parse_xml_file($file_name, $tabBalises, "HOST"); if ($ret != array()) { $sql = "select ";
function find_value_in_field($tag, $value_2_find, $type = 'COMPUTERS') { $p = find_info_accountinfo($tag, $type); $values = look_config_default_values('ACCOUNT_VALUE_' . $p[$tag]['name'] . "_%", true); if (is_array($values['tvalue'])) { foreach ($values['tvalue'] as $key => $value) { if (stristr($value, $value_2_find)) { $decoup = explode('_', $key); $fr = array_pop($decoup); $list_tag_id[] = $fr; } } return $list_tag_id; } else { return false; } }
} } elseif ($_POST["supp"] == "ALL") { $verif[0]['sql'] = "select fileid from download_enable,devices\n\t\t\t\twhere download_enable.id=devices.ivalue\n\t\t\t\tand GROUP_ID=" . $systemid; $verif[0]['condition'] = 'EXIST'; $verif[0]['MSG_ERROR'] = $l->g(688) . " " . $l->g(690); $ok = verification($verif); if (isset($ok)) { mysqli_query($_SESSION['OCS']["writeServer"], "delete from download_enable where GROUP_ID=" . $systemid); $sql = "delete from download_servers where GROUP_ID = " . $systemid; mysqli_query($_SESSION['OCS']["writeServer"], $sql); } } } //Modif server's machine if (isset($_POST['Valid_modif']) and isset($_POST['modif']) and $_POST['modif'] != "") { $default_values = look_config_default_values(array('DOWNLOAD_SERVER_URI', 'DOWNLOAD_SERVER_DOCROOT')); if (trim($_POST['URL']) == "") { $_POST['URL'] = $default_values['tvalue']['DOWNLOAD_SERVER_URI']; } if (trim($_POST['REP_STORE']) == "") { $_POST['REP_STORE'] = $default_values['tvalue']['DOWNLOAD_SERVER_DOCROOT']; } if ($_POST['modif'] != "ALL") { $sql = "update download_servers set URL='" . $_POST['URL'] . "' ,ADD_REP='" . $_POST['REP_STORE'] . "' where hardware_id=" . $_POST['modif']; mysqli_query($_SESSION['OCS']["writeServer"], $sql); $sql = "update download_enable set pack_loc='" . $_POST['URL'] . "' where SERVER_ID=" . $_POST['modif']; mysqli_query($_SESSION['OCS']["writeServer"], $sql); } else { $sql = "update download_servers set URL='" . $_POST['URL'] . "' ,ADD_REP='" . $_POST['REP_STORE'] . "' where GROUP_ID=" . $systemid; mysqli_query($_SESSION['OCS']["writeServer"], $sql); $sql = "update download_enable set pack_loc='" . $_POST['URL'] . "' where GROUP_ID=" . $systemid;
function admin_user($id_user = null, $is_my_account = false) { global $protectedPost, $l, $pages_refs; $tab_hidden = array(); $list_groups = array(); if ($id_user) { $update = 3; } else { $update = 0; } if ($_SESSION['OCS']['profile']->getConfigValue('CHANGE_USER_GROUP') == 'YES') { //search all profil type $list_profil = get_profile_labels(); $list_groups_result = look_config_default_values("USER_GROUP_%", 'LIKE'); if (is_array($list_groups_result['name'])) { foreach ($list_groups_result['name'] as $key => $value) { $list_groups[$list_groups_result['ivalue'][$key]] = $list_groups_result['tvalue'][$key]; } } $name_field = array("ID", "ACCESSLVL", "USER_GROUP"); $tab_name = array($l->g(995) . " :", $l->g(66) . " :", $l->g(607) . " :"); $type_field = array($update, 2, 2); } $name_field[] = "FIRSTNAME"; $name_field[] = "LASTNAME"; $name_field[] = "EMAIL"; $name_field[] = "COMMENTS"; //$name_field[]="USER_GROUP"; $tab_name[] = $l->g(1366) . " :"; $tab_name[] = $l->g(996) . " :"; $tab_name[] = $l->g(1117) . " :"; $tab_name[] = $l->g(51) . " :"; //$tab_name[]="Groupe de l'utilisateur: "; $type_field[] = 0; $type_field[] = 0; $type_field[] = 0; $type_field[] = 0; //$type_field[]= 2; $tab_hidden['MODIF'] = $id_user; $sql = "select ID,NEW_ACCESSLVL,USER_GROUP,FIRSTNAME,LASTNAME,EMAIL,COMMENTS from operators where id= '%s'"; $arg = $id_user; $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $row = mysqli_fetch_object($res); if ($_SESSION['OCS']['profile']->getConfigValue('CHANGE_USER_GROUP') == 'YES') { $protectedPost['ACCESSLVL'] = $row->NEW_ACCESSLVL; $protectedPost['USER_GROUP'] = $row->USER_GROUP; $value_field = array($row->ID, $list_profil, $list_groups); } $value_field[] = $row->FIRSTNAME; $value_field[] = $row->LASTNAME; $value_field[] = $row->EMAIL; $value_field[] = $row->COMMENTS; if ($_SESSION['OCS']['cnx_origine'] == "LOCAL") { $name_field[] = "PASSWORD"; $type_field[] = 0; $tab_name[] = $l->g(217) . " :"; $value_field[] = $protectedPost['PASSWORD']; } $tab_typ_champ = show_field($name_field, $type_field, $value_field); foreach ($tab_typ_champ as $id => $values) { $tab_typ_champ[$id]['CONFIG']['SIZE'] = 40; } if ($_SESSION['OCS']['profile']->getConfigValue('MANAGE_USER_GROUP') == 'YES') { $tab_typ_champ[2]["CONFIG"]['DEFAULT'] = "YES"; // $tab_typ_champ[1]['COMMENT_AFTER']="<a href=# onclick=window.open(\"index.php?".PAG_INDEX."=".$pages_refs['ms_admin_profil']."&head=1\",\"admin_profil\",\"location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=550,height=450\")><img src=image/plus.png></a>"; $tab_typ_champ[2]['COMMENT_AFTER'] = "<a href=\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_adminvalues'] . "&head=1&tag=USER_GROUP\",\"admin_user_group\",\"location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=550,height=450\")><img src=image/plus.png></a>"; } if (isset($tab_typ_champ)) { tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, array('title' => $id_user ? $is_my_account ? $l->g(1365) : $l->g(1385) : $l->g(1386), 'form_name' => 'my_account')); } }
$lbl_new_field = $l->g($protectedGet['new_field']); } else { $lbl_new_field = $l->g(80); } //if no tab selected if (!isset($protectedPost['onglet']) or $protectedPost['onglet'] == '') { $protectedPost['onglet'] = 1; } $tab_options = $protectedPost; $tab_options['form_name'] = $form_name; $tab_options['table_name'] = $table_name; //faire la vérif sur le tag en get //for update name if (isset($protectedPost['MODIF']) and is_numeric($protectedPost['MODIF']) and !isset($protectedPost['Valid_modif'])) { $protectedPost['onglet'] = 2; $val_info = look_config_default_values(array($protectedGet['tag'] . "_" . $protectedPost['MODIF'])); $protectedPost['newfield'] = $val_info['tvalue'][$protectedGet['tag'] . "_" . $protectedPost['MODIF']]; if (isset($protectedGet['nb_field']) and is_numeric($protectedGet['nb_field'])) { $protectedPost['2newfield'] = $val_info['comments'][$protectedGet['tag'] . "_" . $protectedPost['MODIF']]; } $hidden = $protectedPost['MODIF']; } echo open_form($form_name); onglet($data_on, $form_name, "onglet", 2); echo '<div class="mlt_bordure" >'; if ($protectedPost['onglet'] == 1) { $tab_options['CACHE'] = 'RESET'; //delete few fields if (isset($protectedPost['del_check']) and $protectedPost['del_check'] != '') { $list = $protectedPost['del_check']; $sql_delete = "DELETE FROM config WHERE name like '%s' and ivalue in (%s)";
function pagesdev($form_name) { global $l, $numeric, $sup1, $pages_refs; $champs = array('USE_NEW_SOFT_TABLES' => 'USE_NEW_SOFT_TABLES'); $values = look_config_default_values($champs); debut_tab(); ligne('USE_NEW_SOFT_TABLES', 'Utilisation tables de soft OCS v2.1', 'radio', array(1 => 'ON', 0 => 'OFF', 'VALUE' => $values['ivalue']['USE_NEW_SOFT_TABLES'])); fin_tab($form_name); }
function del_pack($fileid) { global $l; //find all activate package $reqEnable = "SELECT id FROM download_enable WHERE FILEID='%s'"; $argEnable = $fileid; $resEnable = mysql2_query_secure($reqEnable, $_SESSION['OCS']["readServer"], $argEnable); while ($valEnable = mysqli_fetch_array($resEnable)) { $list_id[] = $valEnable["id"]; } //delete packet in DEVICES table if ($list_id != "") { foreach ($list_id as $k => $v) { desactive_packet('', $v); } } //delete activation of this pack $reqDelEnable = "DELETE FROM download_enable WHERE FILEID='%s'"; $argDelEnable = $fileid; mysql2_query_secure($reqDelEnable, $_SESSION['OCS']["writeServer"], $argDelEnable); //delete info of this pack $reqDelAvailable = "DELETE FROM download_available WHERE FILEID='%s'"; $argDelAvailable = $fileid; mysql2_query_secure($reqDelAvailable, $_SESSION['OCS']["writeServer"], $argDelAvailable); //what is the directory of this package? $info = look_config_default_values('DOWNLOAD_PACK_DIR'); $document_root = $info['tvalue']['DOWNLOAD_PACK_DIR']; //if no directory in base, take $_SERVER["DOCUMENT_ROOT"] if (!isset($document_root)) { $document_root = VARLIB_DIR; } if (@opendir($document_root . "/download/" . $fileid)) { //delete all files from this package if (!@recursive_remove_directory($document_root . "/download/" . $fileid)) { msg_error($l->g(472) . " " . $document_root . "/download/" . $fileid); } } // delete redistribution package $dl_rep_redist = look_config_default_values('DOWNLOAD_REP_CREAT'); $document_root = $dl_rep_redist['tvalue']['DOWNLOAD_REP_CREAT']; if (!$document_root) { $document_root = VARLIB_DIR . '/download/server'; } $redist_package = realpath($document_root . "/" . $fileid); if ($redist_package and @opendir($redist_package)) { //delete all files from this package if (!@recursive_remove_directory($redist_package)) { msg_error($l->g(472) . " " . $redist_package); } } addLog($l->g(512), $l->g(888) . " " . $fileid); }
echo "<input type='hidden' name='LOCK' id='LOCK' value=''>"; echo close_form(); } } echo '</div>'; if (isset($_SESSION['OCS']["loggeduser"]) && $_SESSION['OCS']['profile']->getConfigValue('ALERTE_MSG') == 'YES') { /************************************************** ALERT MESSAGES ********************************************************/ $msg_header_error = array(); $msg_header_error_sol = array(); //install.php already exist ? if (is_readable("install.php")) { $msg_header_error[] = $l->g(2020); $msg_header_error_sol[] = $l->g(2023); } // OCS update available ? and warn update on yes ? $need_display = look_config_default_values("WARN_UPDATE"); if ($need_display['ivalue']['WARN_UPDATE'] == '1') { $data = get_update_json(); if (GUI_VER_SHOW < $data->version) { $txt = $l->g(2118) . " " . $data->version . " " . $l->g(2119); $txt .= "<br><a href=" . $data->download . ">" . $l->g(2120) . "</a>"; msg_warning($txt, true); } } //defaut user already exist on databases? try { $link_read = mysqli_connect(SERVER_READ, DFT_DB_CMPT, DFT_DB_PSWD); $link_write = mysqli_connect(SERVER_WRITE, DFT_DB_CMPT, DFT_DB_PSWD); mysqli_select_db($link_read, DB_NAME); mysqli_select_db($link_write, DB_NAME); $msg_header_error[] = $l->g(2024) . ' ' . DB_NAME;
// Copyleft Erwan GOALOU 2010 (erwan(at)ocsinventory-ng(pt)org) // Web: http://www.ocsinventory-ng.org // // 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 //==================================================================================== require_once 'require/function_telediff.php'; $info_id = found_info_pack($protectedGet["active"]); if (!isset($info_id['ERROR'])) { $form_name = "form_active"; //ouverture du formulaire echo open_form($form_name); if (!isset($protectedPost['FILE_SERV']) and $protectedPost['choix_activ'] == 'MAN' or !isset($protectedPost['FILE_SERV_REDISTRIB']) and $protectedPost['choix_activ'] == 'AUTO' or !isset($protectedPost['HTTPS_SERV'])) { $default = $_SERVER["SERVER_ADDR"] . "/download"; $values = look_config_default_values(array('DOWNLOAD_URI_INFO', 'DOWNLOAD_URI_FRAG')); $protectedPost['FILE_SERV'] = $values['tvalue']['DOWNLOAD_URI_FRAG']; $protectedPost['HTTPS_SERV'] = $values['tvalue']['DOWNLOAD_URI_INFO']; if ($protectedPost['FILE_SERV'] == "") { $protectedPost['FILE_SERV'] = $default; } if ($protectedPost['HTTPS_SERV'] == "") { $protectedPost['HTTPS_SERV'] = $default; } } //use redistribution servers? if ($_SESSION['OCS']["use_redistribution"] == 1) { $reqGroupsServers = "SELECT DISTINCT name,id FROM hardware WHERE deviceid='_DOWNLOADGROUP_'"; $resGroupsServers = mysql2_query_secure($reqGroupsServers, $_SESSION['OCS']["readServer"]); while ($valGroupsServers = mysqli_fetch_array($resGroupsServers)) { $groupListServers[$valGroupsServers["id"]] = $valGroupsServers["name"];
function get_redistrib_distant_download_root() { $document_root_conf = look_config_default_values(array('DOWNLOAD_SERVER_DOCROOT')); return $document_root_conf["tvalue"]['DOWNLOAD_SERVER_DOCROOT']; }
<?php //==================================================================================== // OCS INVENTORY REPORTS // Copyleft Erwan GOALOU 2010 (erwan(at)ocsinventory-ng(pt)org) // Web: http://www.ocsinventory-ng.org // // 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 //==================================================================================== $values = look_config_default_values(array('EXPORT_SEP')); if (isset($values['tvalue']['EXPORT_SEP']) and $values['tvalue']['EXPORT_SEP'] != '') { $separator = $values['tvalue']['EXPORT_SEP']; } else { $separator = ';'; } $link = $_SESSION['OCS']["readServer"]; $toBeWritten = ""; //log directory if (isset($protectedGet['log']) and !preg_match("/([^A-Za-z0-9.])/", $protectedGet['log'])) { $Directory = $_SESSION['OCS']['LOG_DIR'] . "/"; } if (isset($Directory) and file_exists($Directory . $protectedGet['log'])) { $tab = file($Directory . $protectedGet['log']); while (list($cle, $val) = each($tab)) { $toBeWritten .= $val . "\r\n"; } $filename = $protectedGet['log']; } elseif (isset($_SESSION['OCS']['csv']['SQL'][$protectedGet['tablename']])) { $toBeWritten = "";
function dde_form($form_name) { global $l, $protectedPost, $protectedGet, $pages_refs; //cas of dde modification if (isset($protectedPost['MODIF'])) { $item_modif_values = info_dde($protectedPost['MODIF']); if (is_object($item_modif_values)) { foreach ($item_modif_values as $key => $value) { if (substr_count($key, 'fields_')) { if (substr_count($value, '**&&&**')) { $array_value = explode('**&&&**', $value); foreach ($array_value as $nb => $value_tab) { //if this field is readonly //we sow all values $value_list[substr($key, 7)] .= $value_tab . ". "; $protectedPost[substr($key, 7) . '_' . $nb] = $value_tab; } } elseif (substr_count($value, '**check&check**')) { $array_value = explode('**check&check**', $value); foreach ($array_value as $nb => $value_tab) { //if this field is readonly //we sow all values $value_list[substr($key, 7)] .= $value_tab . ". "; $protectedPost[substr($key, 7) . '_' . $value_tab] = 'on'; } } else { $protectedPost[substr($key, 7)] = $value; } } elseif ($key == 'ID') { $protectedPost['OLD_MODIF'] = $value; } elseif ($key == 'STATUT') { $protectedPost['STATUS'] = $value; } elseif ($key == 'LOGIN_USER') { $protectedPost['LOGIN_USER'] = $value; } } unset($protectedPost['MODIF']); } if ($protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser'] and is_array($value_list)) { foreach ($value_list as $key => $value) { $protectedPost[$key] = $value; } } } //search all tab of this form $sql_TAB = "select VALUE,LBL,ID,DEFAULT_FIELD from downloadwk_tab_values where FIELD = 'TAB'"; $result_TAB = mysql_query($sql_TAB, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); while ($item = mysql_fetch_object($result_TAB)) { if (!isset($protectedPost['cat']) or $protectedPost['cat'] == '') { $protectedPost['cat'] = $item->ID; } $lbl = define_lbl($item->LBL, $item->DEFAULT_FIELD); $cat_value[$item->ID] = $lbl; } //show all tab onglet($cat_value, $form_name, "cat", 5); //search all fields of the form $sql_fields = "select TAB,FIELD,TYPE,LBL,MUST_COMPLETED,ID,VALUE,DEFAULT_FIELD,RESTRICTED,LINK_STATUS from downloadwk_fields"; $result_fields = mysql_query($sql_fields, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); while ($item = mysql_fetch_object($result_fields)) { unset($value); if ($item->RESTRICTED == 1 and $_SESSION['OCS']['RESTRICTION']['TELEDIFF_WK_FIELDS'] == 'YES' or isset($protectedPost['OLD_MODIF']) and $item->TYPE != 8 and $item->TYPE != 10 and $protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser']) { $grise = 3; //cas of status if ($item->FIELD == "STATUS") { //It's the only field witch admin can modify when request is create by someone else if ($_SESSION['OCS']['RESTRICTION']['TELEDIFF_WK_FIELDS'] == 'YES') { $val_field = $item->VALUE; $sql_service = "select id, lbl as value from downloadwk_statut_request where id='" . $val_field . "'"; $resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); $item_conf_values = mysql_fetch_object($resultSERV); $value = $item_conf_values->value; } else { $grise = $item->TYPE; } } else { //cas of list and checkbox if (isset($protectedPost[$item->ID])) { $list_id = explode('.', $protectedPost[$item->ID]); $p = 0; $ok_num = true; while ($list_id[$p]) { if (!is_numeric($list_id[$p]) and trim($list_id[$p]) != "") { $ok_num = false; } if (trim($list_id[$p]) == "") { unset($list_id[$p]); } $p++; } if ($ok_num and implode(',', $list_id)) { $sql_service = "select field, value from downloadwk_conf_values where id in (%s)"; $arg_service = array(implode(',', $list_id)); $resultSERV = mysql2_query_secure($sql_service, $_SESSION['OCS']["readServer"], $arg_service); $value = ""; while ($item_conf_values = mysql_fetch_object($resultSERV)) { $value .= $item_conf_values->value . ' '; } } // echo $value; } if (!isset($value) or $value == "") { $value = $protectedPost[$item->ID]; } if ($value == "") { $value = $value_list[$item->ID]; } /*$val_field=$item->ID; $sql_service="select field, value from downloadwk_conf_values where field='".$val_field."'"; echo $sql_service."<br>"; $resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); $item_conf_values = mysql_fetch_object($resultSERV); if (isset($item_conf_values)) $value=$item_conf_values->value;*/ } } elseif (isset($protectedPost['OLD_MODIF']) and $item->TYPE == 8 and $protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser']) { $grise = 9; } else { $grise = $item->TYPE; } //echo $item->FIELD."=>".$grise."<br>"; // print_r($item); //si le champs n'est pas restraint, on l'affiche //$item->LINK_STATUS if (!(is_numeric($item->LINK_STATUS) and $protectedPost['STATUS'] != $item->LINK_STATUS and $item->LINK_STATUS != 0)) { $lbl = define_lbl($item->LBL, $item->DEFAULT_FIELD); $name_field[$item->TAB][$item->ID] = $item->ID; $oblig_field[$item->TAB][$item->ID] = $item->MUST_COMPLETED; $tab_name[$item->TAB][$item->ID] = $lbl; $type_field[$item->TAB][$item->ID] = $grise; $type_field_temp[$item->ID] = $grise; $restricted_field[$item->TAB][$item->ID] = $item->RESTRICTED; $link_status[$item->TAB][$item->ID] = $item->LINK_STATUS; //si une valeur par défaut est donnée au champ //mais que l'on n'est dans un champ type multi lignes if (!isset($value)) { if ($item->VALUE != '' and $grise != 6) { if (isset($_SESSION['OCS'][$item->VALUE])) { $value = $_SESSION['OCS'][$item->VALUE]; } else { $value = $item->VALUE; } } else { $value = $protectedPost[$item->ID]; } } //cas du champ multi ligne => on récupère le nbre de champ a afficher if ($grise == 6) { if (!is_numeric($item->VALUE)) { $nb_fields[$item->TAB][$item->ID] = 6; } else { $nb_fields[$item->TAB][$item->ID] = $item->VALUE; } //ajout des champs a prendre en compte quand on passe d'onglet en onglet $k = 0; while ($k < $nb_fields[$item->TAB][$item->ID]) { $name_field[$item->TAB][$item->ID . '_' . $k] = $item->ID . '_' . $k; $k++; } } //unset($value_field[$item->TAB][$item->ID]); if ($grise == 2 or $grise == 5) { //echo $item->FIELD."<br>"; //GESTION DU STATUT DE LA DEMANDE if ($item->FIELD == "STATUS") { $list_status = list_status(); $sql_service = "select id, lbl as value from downloadwk_statut_request where id in (" . implode(',', $list_status['ID_TAB']) . ")"; } else { $add_values_admin[$item->TAB][$item->ID] = $item->ID; $sql_service = "select field,value,id,default_field FROM downloadwk_conf_values where field=" . $item->ID; } //echo $item->FIELD."<br>"; $resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); while ($item_conf_values = mysql_fetch_object($resultSERV)) { if (!isset($List[$item_conf_values->field]) and $grise == 2) { $value_field[$item->TAB][$item->ID][''] = ''; } if ($grise == 5) { $name_field[$item->TAB][$item->ID . '_' . $item_conf_values->id] = $item->ID . '_' . $item_conf_values->id; } $value_field[$item->TAB][$item->ID][$item_conf_values->id] = $item_conf_values->value; //echo $value_field[$item->TAB][$item->ID][$item_conf_values->id]."<br>"; } } elseif ($grise == 9) { $sql_files = "select id,file_name from temp_files where fields_name='fields_" . $item->ID . "' and id_dde='" . $protectedPost['OLD_MODIF'] . "'"; $result_files = mysql_query($sql_files, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); while ($item_files = mysql_fetch_object($result_files)) { $value_field[$item->TAB][$item->ID][$item_files->id] = $item_files->file_name; } } elseif ($grise == 8) { $nb_dde[$item->TAB][$item->ID] = $protectedPost['OLD_MODIF']; } else { $value_field[$item->TAB][$item->ID] = $value; } } } /*********************END initialisation***********************/ //echo "<br><hr><br>"; //DDE POST if ($protectedPost['SUBMIT_FORM'] == "SUBMIT_FORM") { foreach ($oblig_field as $key => $array_value) { foreach ($array_value as $id => $value) { //les champs en lecture seule ne sont pas à mettre à jour if ($type_field[$key][$id] != 3) { //si on est à l'insertion de fichier dans la demande if ($type_field[$key][$id] == 8 or $type_field[$key][$id] == 9) { // //recherche des fichiers disponibles pour ce champ $sql = "select id from temp_files where fields_name = 'fields_" . $id . "' \n\t\t\t\t\t\t\t\t\t\t\tand AUTHOR='" . $_SESSION['OCS']['loggeduser'] . "'\n\t\t\t\t\t\t\t\t\t\t\tand (ID_DDE is null or ID_DDE='" . $protectedPost['OLD_MODIF'] . "')"; $result = mysql_query($sql, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]); unset($id_files_value); while ($item_values = mysql_fetch_object($result)) { $id_files_value[] = $item_values->id; $list_id_files_to_update[] = $item_values->id; } //on ajoute les id des fichiers aux posts pour les insérer en base if (isset($id_files_value)) { $protectedPost[$id] = implode(',', $id_files_value); } } //si le post n'existe pas ou qu'il est vide mais que ce champ est obligatoire if ((!isset($protectedPost[$id]) or $protectedPost[$id] == '') and $value == 1) { //cas of checkbox unset($check); if ($type_field[$key][$id] == 5) { foreach ($name_field[$key] as $id_check) { if ($protectedPost[$id_check]) { $check = true; } } } //traitement des multi listes if ($type_field[$key][$id] == 6) { foreach ($protectedPost as $key2 => $value2) { if (strstr($key2, $id . '_') and $value2 != '') { $value_list[$id] .= $value2 . '**&&&**'; $check = true; } } } if (!isset($check)) { $msg_empty .= $tab_name[$key][$id] . "<br>"; } } //si le champ est en lecture seule, on ne prend pas en compte la valeur //du post /*if ($type_field[$key][$id] == 3) unset($protectedPost[$id]); */ } } } // $msg_empty="STOP"; //print_r($type_field_temp); if (isset($msg_empty)) { msg_error($l->g(684) . ":<br>" . $msg_empty); unset($protectedPost['SUBMIT_FORM']); } else { //on récupère l'id du champ status $item_id_STATUS = find_id_field(); if (isset($item_id_STATUS['STATUS']->id) and $item_id_STATUS['STATUS']->id != '') { foreach ($protectedPost as $key => $value) { //cas of checkbox $checkbox = explode('_', $key); if ($type_field_temp[$key] != 9) { if (isset($protectedPost['OLD_MODIF']) and is_numeric($protectedPost['OLD_MODIF']) and $type_field_temp[$key] != 3 and $type_field_temp[$checkbox[0]] != 3 or !isset($protectedPost['OLD_MODIF'])) { //echo $key."=>".$type_field_temp[$key]."<br>"; if (is_numeric($checkbox[0]) and is_numeric($checkbox[1]) and !isset($value_list[$checkbox[0]])) { $check_on[$checkbox[0]] .= $checkbox[1] . "**check&check**"; } elseif (isset($value_list[$checkbox[0]]) and $value_list[$checkbox[0]] != '') { $array_fields_form[] = "fields_" . $checkbox[0]; $array_value_form[] = $value_list[$checkbox[0]]; $value_list[$checkbox[0]] = ''; } if (is_numeric($key)) { $array_fields_form[] = "fields_" . $key; //gestion du statut. La demande est faite => statut=2 if ($item_id_STATUS['STATUS']->id == $key and $value == '' or $item_id_STATUS['STATUS']->id == $key and !is_numeric($value)) { $array_value_form[] = "2"; } else { $array_value_form[] = $value; } } } } } if (isset($check_on)) { foreach ($check_on as $key => $value) { $array_fields_form[] = "fields_" . $key; $array_value_form[] = $value; } } if (isset($protectedPost['OLD_MODIF']) and is_numeric($protectedPost['OLD_MODIF'])) { //search old parameters $sql_old_param = "select * from downloadwk_pack where id = '%s'"; $arg = array($protectedPost['OLD_MODIF']); $result_old_param = mysql2_query_secure($sql_old_param, $_SESSION['OCS']["readServer"], $arg); $item_old_param = mysql_fetch_object($result_old_param); $sql_wk_dde = "UPDATE downloadwk_pack set "; $i = 0; $arg = array(); while ($array_fields_form[$i]) { $sql_wk_dde .= $array_fields_form[$i] . "='%s', "; $arg_wk_dde[] = $array_value_form[$i]; if ($item_old_param->{$array_fields_form}[$i] != $array_value_form[$i]) { $id_field = explode('_', $array_fields_form[$i]); $sql_fields_modif = "select lbl from downloadwk_fields where id = '%s'"; $arg_lbl = array($id_field[1]); $result_fields_modif = mysql2_query_secure($sql_fields_modif, $_SESSION['OCS']["readServer"], $arg_lbl); $item_fields_modif = mysql_fetch_object($result_fields_modif); if (is_numeric($item_fields_modif->lbl)) { $modif_field = $l->g($item_fields_modif->lbl); } else { $modif_field = $item_fields_modif->lbl; } $list_fields_modif[] = $modif_field; } $i++; } $sql_wk_dde = substr($sql_wk_dde, 0, -2) . " WHERE ID='%s'"; $arg_wk_dde[] = $protectedPost['OLD_MODIF']; $subjet_mail = $l->g(1053) . ": " . $protectedPost['OLD_MODIF']; $body = $_SESSION['OCS']['loggeduser'] . $l->g(1090) . $protectedPost['OLD_MODIF']; //LOGS MODIF if (isset($list_fields_modif) and is_array($list_fields_modif)) { $sql_log_modif = "INSERT INTO downloadwk_history (ID_DDE,AUTHOR,DATE,ACTION) \n\t\t\t\t\t\t\t\t\t\t\tVALUES ('%s','%s',sysdate(),'%s')"; $arg = array($protectedPost['OLD_MODIF'], $_SESSION['OCS']['loggeduser'], implode(',', $list_fields_modif)); mysql2_query_secure($sql_log_modif, $_SESSION['OCS']["writeServer"], $arg); $body .= "Champs modifiés: <br>" . implode('<br>', $list_fields_modif); } $msg_popup = $l->g(1053); } else { $sql_wk_dde = "INSERT INTO downloadwk_pack (LOGIN_USER,GROUP_USER,Q_DATE,"; $sql_wk_dde .= implode(",", $array_fields_form); $sql_wk_dde .= ") VALUES ('%s','%s',UNIX_TIMESTAMP(),"; $arg_wk_dde = array($_SESSION['OCS']['loggeduser'], $_SESSION['OCS']['user_group']); foreach ($array_value_form as $key_form => $value_form) { $sql_wk_dde .= "'%s',"; $arg_wk_dde[] = $value_form; } $sql_wk_dde = substr($sql_wk_dde, 0, -1) . ")"; $msg_popup = $l->g(1054); $subjet_mail = $l->g(1091); $body = $_SESSION['OCS']['loggeduser'] . $l->g(1092); } /*echo "<br><hr><br>"; echo $sql_wk_dde; echo "<br><hr><br>";*/ //print_r($array_value_form); //$sql_insert= substr($sql_insert,0,-1); //$list_value= substr($list_value,0,-2); mysql2_query_secure($sql_wk_dde, $_SESSION['OCS']["writeServer"], $arg_wk_dde); //mise à jour des blobs insérés if (isset($list_id_files_to_update)) { if (mysql_insert_id($_SESSION['OCS']["writeServer"])) { $id_dde = mysql_insert_id($_SESSION['OCS']["writeServer"]); } elseif (isset($protectedPost['OLD_MODIF'])) { $id_dde = $protectedPost['OLD_MODIF']; } if (isset($id_dde)) { $sql_up = "update temp_files \n\t\t\t\t\t\t\t\t\tset ID_DDE='%s' \n\t\t\t\t\t\t\t\t\twhere ID in (%s)"; $arg = array($id_dde, implode(",", $list_id_files_to_update)); mysql2_query_secure($sql_up, $_SESSION['OCS']["writeServer"], $arg); } } $tab = $protectedPost['cat']; unset($protectedPost); $protectedPost['cat'] = $tab; msg_success($msg_popup); //TODO: envoi de mail au group admin + soit à l'utilisateur soit à son groupe (voir la conf du profil) $mail_active = option_conf_activate('IT_SET_MAIL'); if ($mail_active) { //mail for admin of workflow $group_admin_mail = look_config_default_values(array('IT_SET_MAIL_ADMIN')); if (isset($group_admin_mail['ivalue']['IT_SET_MAIL_ADMIN'])) { $sql_mail = "select email \n\t\t\t\t\t\t\t\t\t\tfrom operators \n\t\t\t\t\t\t\t\t\t\twhere user_group='%s'"; $arg = array($group_admin_mail['ivalue']['IT_SET_MAIL_ADMIN']); $result_mail = mysql2_query_secure($sql_mail, $_SESSION['OCS']["readServer"], $arg); $mail_list = array(); while ($item_mail = mysql_fetch_object($result_mail)) { if (VerifyMailadd($item_mail->email)) { $mail_list[] = $item_mail->email; } } } //mail for other $sql_mail = "select email,user_group \n\t\t\t\t\t\t\t\t from operators \n\t\t\t\t\t\t\t\t where ID='%s'"; $arg = array($_SESSION['OCS']['loggeduser']); $result_mail = mysql2_query_secure($sql_mail, $_SESSION['OCS']["readServer"], $arg); $item_mail = mysql_fetch_object($result_mail); if (!VerifyMailadd($item_mail->email)) { msg_error($l->g(1055) . " " . $l->g(1056)); } if ($_SESSION['OCS']['TELEDIFF_WK'] == 'LOGIN') { if (VerifyMailadd($item_mail->email)) { $mail_list[] = $item_mail->email; } } elseif ($_SESSION['OCS']['TELEDIFF_WK'] == 'USER_GROUP') { $sql_mail_group = "select email from operators \n\t\t\t\t\t\t\t\t\t\t\t where USER_GROUP='%s'"; $arg = array($item_mail->user_group); $result_mail_group = mysql2_query_secure($sql_mail_group, $_SESSION['OCS']["readServer"], $arg); while ($item_mail_group = mysql_fetch_object($result_mail_group)) { if (VerifyMailadd($item_mail_group->email)) { $mail_list[] = $item_mail_group->email; } } } if (isset($mail_list[0])) { send_mail($mail_list, $subjet, $body); } else { msg_error($l->g(1058)); } } unset($_SESSION['OCS']['DATA_CACHE'], $_SESSION['OCS']['NUM_ROW']); } else { msg_error($l->g(1093) . ".<br> " . $l->g(1094)); unset($protectedPost['SUBMIT_FORM']); } } } /***************BEGIN Show fields*************/ if ($name_field[$protectedPost['cat']]) { //print_r($type_field[$protectedPost['cat']]); $tab_typ_champ = show_field($name_field[$protectedPost['cat']], $type_field[$protectedPost['cat']], $value_field[$protectedPost['cat']]); if (isset($nb_fields[$protectedPost['cat']])) { foreach ($nb_fields[$protectedPost['cat']] as $key => $value) { $tab_typ_champ[$key]['CONFIG']['NB_FIELD'] = $value; } } if (isset($nb_dde[$protectedPost['cat']])) { foreach ($nb_dde[$protectedPost['cat']] as $key => $value) { $tab_typ_champ[$key]['CONFIG']['DDE'] = $value; } } //add * before the lbl if this field must be completed foreach ($tab_name[$protectedPost['cat']] as $key => $value) { if ($oblig_field[$protectedPost['cat']][$key] == 1) { $tab_name[$protectedPost['cat']][$key] = '*' . $value; } } ksort($tab_name[$protectedPost['cat']]); //print_r($add_values[$protectedPost['cat']]); if ($_SESSION['OCS']['CONFIGURATION']['TELEDIFF_WK'] == 'YES') { if (isset($add_values_admin[$protectedPost['cat']])) { foreach ($add_values_admin[$protectedPost['cat']] as $key => $value) { $tab_typ_champ[$value]['COMMENT_BEHING'] = "<a href=# onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_admin_management'] . "&head=1&value=" . $value . "&form=" . $form_name . "\",\"admin_management\",\"location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=550,height=450\")><img src=image/plus.png></a>"; } } } } else { echo "NOT DEFINE"; } /***************END Show fields*************/ if (isset($msg)) { msg_success($msg); } if (isset($tab_typ_champ)) { //print_r($name_field); $tab_hidden = hidden($protectedPost, $name_field[$protectedPost['cat']]); tab_modif_values($tab_name[$protectedPost['cat']], $tab_typ_champ, $tab_hidden, $title = "", $comment = "", $name_button = "modif", $showbutton = false, 'NO_FORM'); if (isset($protectedPost['OLD_MODIF'])) { $lbl = $l->g(115); } else { $lbl = $l->g(114); } echo "<input type=button name='VALID' id='VALID' value='" . $lbl . "' OnClick='pag(\"SUBMIT_FORM\",\"SUBMIT_FORM\",\"" . $form_name . "\");'>"; echo "<input type='hidden' name='SUBMIT_FORM' id='SUBMIT_FORM' value=''>"; } }
if (!isset($protectedPost['ID_NAME'])) { $protectedPost['ID_NAME'] = $result->ID; } if (!isset($protectedPost['ADD_IP'])) { $protectedPost['ADD_IP'] = $result->NETID; } if (!isset($protectedPost['ADD_SX_RSX'])) { $protectedPost['ADD_SX_RSX'] = $result->MASK; } if (isset($protectedGet['value']) and $protectedGet['value'] != '') { $protectedPost['ADD_IP'] = $protectedGet['value']; } } else { $title = $l->g(303); } $list_id_subnet = look_config_default_values('ID_IPDISCOVER_%', 'LIKE'); if (isset($list_id_subnet)) { foreach ($list_id_subnet['tvalue'] as $key => $value) { $list_subnet[$value] = $value; } } else { $list_subnet = array(); } $list_subnet = array(0 => "") + $list_subnet; $default_values = array('RSX_NAME' => $protectedPost['RSX_NAME'], 'ID_NAME' => $list_subnet, 'ADD_IP' => $protectedPost['ADD_IP'], 'ADD_SX_RSX' => $protectedPost['ADD_SX_RSX']); form_add_subnet($title, $default_values, $form_name); } else { $sql = "select NETID,NAME,ID,MASK from subnet"; $list_fields = array('NETID' => 'NETID', $l->g(49) => 'NAME', 'ID' => 'ID', 'MASK' => 'MASK', 'MODIF' => 'NETID', 'SUP' => 'NETID'); //$list_fields['SUP']='ID'; $default_fields = $list_fields;
$queryDetails = $sql['SQL'] . " from hardware h \n\t\t\t\t\t\tRIGHT JOIN officepack n ON n.hardware_id=h.id \n\t\t\t\t\t\tLEFT JOIN accountinfo a ON a.hardware_id=h.id \n\t\t\t\t\t\t"; if (isset($_SESSION['OCS']["mesmachines"]) and $_SESSION['OCS']["mesmachines"] != '') { $queryDetails .= "WHERE " . $_SESSION['OCS']["mesmachines"]; } $result_exist = tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $queryDetails, $form_name, 95, $tab_options); } elseif ($protectedPost["onglet"] == 'REPART_LICENCES') { $list_fields = array($l->g(66) => 'officeversion', $l->g(55) => 'NB', "PERCENT_BAR" => 'POURC'); $list_col_cant_del = $list_fields; $default_fields = $list_fields; $tab_options['LBL']['PERCENT_BAR'] = $l->g(1125); $queryDetails = "select count(id) NB,officeversion,round(count(id)*100/(select count(id) from officepack)) POURC from officepack group by officeversion"; tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $queryDetails, $form_name, 80, $tab_options); } elseif ($protectedPost["onglet"] == 'NB_BY_LICENCES') { if (isset($protectedPost["Valid_modif_x"]) and $protectedPost["Valid_modif_x"] != '') { if (isset($protectedPost["nb_total"]) and is_numeric($protectedPost["nb_total"])) { $val = look_config_default_values('PLUGIN_MS_OFF%', 1); $insert = true; $i = 0; if (isset($val['name'])) { foreach ($val['name'] as $name) { if ($val['tvalue'][$name] == $protectedPost["NUM_OFF"]) { $name_to_update = $name; $insert = false; } $explo_name = explode('_', $name); if (isset($explo_name[3]) and $explo_name[3] >= $i) { $i = $explo_name[3]; } } } $i++;
$td4 = "<td height=20px bgcolor='#F0F0F0' align='center'>"; $i = 0; $queryDetails = "SELECT * FROM devices WHERE hardware_id=%s"; $argDetail = $systemid; $resultDetails = mysql2_query_secure($queryDetails, $_SESSION['OCS']["readServer"], $argDetail); $form_name = 'config_mach'; echo open_form($form_name); echo "<table BORDER='1' WIDTH = '95%' ALIGN = 'Center' CELLPADDING='0' BGCOLOR='#C7D9F5' BORDERCOLOR='#9894B5'>"; while ($item = mysql_fetch_array($resultDetails, MYSQL_ASSOC)) { $optPerso[$item["NAME"]]["IVALUE"] = $item["IVALUE"]; $optPerso[$item["NAME"]]["TVALUE"] = $item["TVALUE"]; } $ii++; $td3 = $ii % 2 == 0 ? $td2 : $td4; $field_name = array('DOWNLOAD', 'DOWNLOAD_CYCLE_LATENCY', 'DOWNLOAD_PERIOD_LENGTH', 'DOWNLOAD_FRAG_LATENCY', 'DOWNLOAD_PERIOD_LATENCY', 'DOWNLOAD_TIMEOUT', 'PROLOG_FREQ', 'SNMP'); $optdefault = look_config_default_values($field_name); //IPDISCOVER echo "<tr><td bgcolor='white' align='center' valign='center'>" . (isset($optPerso["IPDISCOVER"]) && $optPerso["IPDISCOVER"]["IVALUE"] != 1 ? "<img width='15px' src='image/red.png'>" : " ") . "</td> </td>"; echo $td3 . $l->g(489) . "</td>"; if (isset($optPerso["IPDISCOVER"])) { if ($optPerso["IPDISCOVER"]["IVALUE"] == 0) { echo $td3 . $l->g(490) . "</td>"; } else { if ($optPerso["IPDISCOVER"]["IVALUE"] == 2) { echo $td3 . $l->g(491) . " " . $optPerso["IPDISCOVER"]["TVALUE"] . "</td>"; } else { if ($optPerso["IPDISCOVER"]["IVALUE"] == 1) { echo $td3 . $l->g(492) . " " . $optPerso["IPDISCOVER"]["TVALUE"] . "</td>"; } } }
$tab_options['ARG_SQL_COUNT'] = array($protectedGet['value']); $tab_options['FILTRE']['h.name'] = $l->g(49); $tab_options['FILTRE']['h.userid'] = $l->g(24); $tab_options['FILTRE']['h.osname'] = $l->g(25); $tab_options['FILTRE']['h.ipaddr'] = $l->g(34); } printEnTete($title); echo "<br><br>"; $tab_options['LBL']['MAC'] = $l->g(95); $list_col_cant_del = array($l->g(66) => $l->g(66), 'SUP' => 'SUP', 'MODIF' => 'MODIF'); $table_name = "IPDISCOVER_" . $protectedGet['prov']; $form_name = $table_name; echo open_form($form_name); $result_exist = tab_req($table_name, $list_fields, $default_fields, $list_col_cant_del, $sql, $form_name, 80, $tab_options); $fipdisc = "ipdiscover-util.pl"; $values = look_config_default_values(array('IPDISCOVER_IPD_DIR')); $IPD_DIR = $values['tvalue']['IPDISCOVER_IPD_DIR'] . "/ipd"; if ($scriptPresent = @stat($fipdisc)) { $filePresent = true; if (!is_executable($fipdisc)) { $msg_info = $fipdisc . " " . $l->g(341); } else { if (!is_writable($IPD_DIR)) { $msg_info = $l->g(342) . " " . $fipdisc . " (" . $IPD_DIR . ")"; } } if (!isset($msg_info)) { echo "<br><input type='button' onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_ipdiscover_analyse'] . "&head=1&rzo=" . $protectedGet['value'] . "\",\"analyse\",\"location=0,status=0,scrollbars=1,menubar=0,resizable=0,width=800,height=650\") name='analyse' value='" . $l->g(317) . "'>"; } else { msg_info($msg_info); }
//==================================================================================== //Modified on $Date: 2010 Erwan Goalou require_once 'require/function_files.php'; $form_name = "insert_computers"; $data_on['FILE'] = $l->g(288); $data_on['MANUEL'] = $l->g(1258); echo open_form($form_name); //$protectedPost['onglet']='FILE'; onglet($data_on, $form_name, "onglet", 4); echo "<div class='mlt_bordure' >"; if ($protectedPost['onglet'] == 'FILE') { echo "<script language='javascript'> \n\t \n\t function getext(filename){\n\t \t var parts = filename.split('.');\n\t \t\treturn(parts[(parts.length-1)]); \n\t }\n\t \n\t function namefile(filename){\n\t \tvar parts = filename.split('.');\n\t \treturn(parts[0]); \n\t } \n\t\n\t function verif_file_format(champ){\n\t var ExtList=new Array('ocs','OCS','xml','XML');\n\t\t\tfilename = document.getElementById(champ).value.toLowerCase();\n\t\t\tfileExt = getext(filename);\n\t\t\tfor (i=0; i<ExtList.length; i++)\n\t\t\t{\n\t\t\t\tif ( fileExt == ExtList[i] ) \n\t\t\t\t{\n\t\t\t\t\treturn (true);\n\t\t\t\t}\n\t\t\t}\n\t\t\talert('" . mysql_real_escape_string($l->g(559)) . "');\n\t\t\treturn (false);\n\t }\n\t \n\t</script>"; // $css = "mvt_bordure"; $form_name1 = "SEND_FILE"; $data_config = look_config_default_values(array('LOCAL_URI_SERVER'), '', array('TVALUE' => array('LOCAL_URI_SERVER' => 'http://localhost:80/ocsinventory'))); $server = $data_config['tvalue']['LOCAL_URI_SERVER']; $array_port = explode(':', $server); $port_trait = array_pop($array_port); $array_port = explode('/', $port_trait); $port = $array_port[0]; if (is_uploaded_file($_FILES['file_upload']['tmp_name'])) { $fd = fopen($_FILES['file_upload']['tmp_name'], "r"); if ($_FILES['file_upload']['size'] != 0) { $contents = fread($fd, filesize($_FILES['file_upload']['tmp_name'])); fclose($fd); $result = post_ocs_file_to_server($contents, $server, $port); if (isset($result["errno"])) { $errno = $result["errno"]; $errstr = $result["errstr"]; msg_error($l->g(344) . " " . $errno . " / " . $errstr);
$tab_options['SQL_COUNT'] = "select %s from %s %s"; $tab_options['ARG_SQL_COUNT'] = array("count(distinct " . implode(',', $recup_list_add_field) . ") count_nb_ligne", $sql_field[$protectedPost["SHOW_ME"]]['ARG'][1], $sql_field[$protectedPost["SHOW_ME"]]['ARG'][2]); $list_col_cant_del = $list_fields; $default_fields = $list_fields; $tab_options['ARG_SQL'] = $sql_field[$protectedPost["SHOW_ME"]]['ARG']; if (isset($multi_search[$protectedPost["SHOW_ME"]])) { $tab_options['LIEN_LBL'][$l->g(1120)] = 'index.php?' . PAG_INDEX . '=' . $pages_refs['ms_multi_search'] . '&fields='; $tab_options['LIEN_LBL'][$l->g(1120)] .= $multi_search[$protectedPost["SHOW_ME"]]['FIELD'] . "&comp=" . $multi_search[$protectedPost["SHOW_ME"]]['COMP'] . "&values="; $tab_options['LIEN_CHAMP'][$l->g(1120)] = $array_fields[0]; } ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del); } echo close_form(); //show messages if ($_SESSION['OCS']['profile']->getRestriction('GUI') == "YES") { $info_msg = look_config_default_values('GUI_REPORT_MSG%', 'LIKE'); if (is_array($info_msg['ivalue'])) { $list_id_groups = implode(',', $info_msg['ivalue']); } if ($list_id_groups != "") { $sql_my_msg = "select distinct g_c.group_id groups \n\t\t\t\t\tfrom accountinfo a ,groups_cache g_c\n\t\t\t\t\twhere g_c.HARDWARE_ID=a.HARDWARE_ID\n\t\t\t\t\t\tand\tg_c.GROUP_ID in (" . $list_id_groups . ")"; if (isset($_SESSION['OCS']['mesmachines']) and $_SESSION['OCS']['mesmachines'] != "") { $sql_my_msg .= " and " . $_SESSION['OCS']['mesmachines']; } $result_my_msg = mysqli_query($_SESSION['OCS']["readServer"], $sql_my_msg); while ($item_my_msg = mysqli_fetch_object($result_my_msg)) { foreach ($info_msg['ivalue'] as $key => $value) { if ($value == $item_my_msg->groups) { $msg_group[$key] = $info_msg['tvalue'][$key]; } }
} $MAJ = $l->g(711); msg_success($MAJ . $add_lbl); if (isset($protectedGet['origine']) and $protectedGet['origine'] == 'machine') { $form_to_reload = 'config_mach'; } elseif (isset($protectedGet['origine']) and $protectedGet['origine'] == 'group') { $form_to_reload = 'config_group'; } if (isset($form_to_reload)) { echo "<script language='javascript'> window.opener.document." . $form_to_reload . ".submit();</script>"; } } else { echo "<script>alert('" . $l->g(983) . "')</script>"; } } $default = look_config_default_values(array('DOWNLOAD', 'DOWNLOAD_CYCLE_LATENCY', 'DOWNLOAD_PERIOD_LENGTH', 'DOWNLOAD_FRAG_LATENCY', 'DOWNLOAD_PERIOD_LATENCY', 'DOWNLOAD_TIMEOUT', 'PROLOG_FREQ')); $optdefault = $default["ivalue"]; //not a sql query if (isset($protectedGet['origine']) and is_numeric($protectedGet['idchecked'])) { //looking for value of systemid $sql_value_idhardware = "select NAME,IVALUE,TVALUE from devices where name != 'DOWNLOAD' and hardware_id=%s"; $arg_value_idhardware = $protectedGet['idchecked']; $result_value = mysql2_query_secure($sql_value_idhardware, $_SESSION['OCS']["readServer"], $arg_value_idhardware); while ($value = mysqli_fetch_array($result_value)) { $optvalue[$value["NAME"]] = $value["IVALUE"]; $optvalueTvalue[$value["NAME"]] = $value["TVALUE"]; } $champ_ignored = 0; } elseif ($list_id) { $tab_hadware_id = explode(",", $list_id); $champ_ignored = 1;
echo "</table>"; echo "<br><input type='button' name='TEST_END' id='TEST_END' OnClick='" . $java_script . "' value='" . $l->g(13) . "'>"; echo "<input type='hidden' name='digest' value='" . $digest . "'>"; echo "<input type='hidden' name='VALID_END' id='VALID_END' value=''>"; echo "<input type='hidden' name='SIZE' value='" . $size . "'>"; } } //check default values $default_value = array('OS' => 'WINDOWS', 'PROTOCOLE' => 'HTTP', 'PRIORITY' => '5', 'ACTION' => 'STORE', 'REDISTRIB_PRIORITY' => '5'); if (!$protectedPost) { //get timestamp $protectedPost['timestamp'] = time(); foreach ($default_value as $key => $value) { $protectedPost[$key] = $value; } $val_document_root = look_config_default_values(array('DOWNLOAD_PACK_DIR')); if (isset($val_document_root["tvalue"]['DOWNLOAD_PACK_DIR'])) { $document_root = $val_document_root["tvalue"]['DOWNLOAD_PACK_DIR'] . "/download/"; } else { //if no directory in base, take $_SERVER["DOCUMENT_ROOT"] $document_root = VARLIB_DIR . '/download/'; } $rep_exist = file_exists($document_root); //create directory if it's not exist if (!$rep_exist) { $creat = @mkdir($document_root); if (!$creat) { msg_error($document_root . "<br>" . $l->g(1004) . ".<br>" . $l->g(1005)); return; } }