function add_update_key($form_values, $update = false) { global $l; foreach ($form_values as $key => $value) { if (trim($value) == "") { msg_error($l->g(988)); return FALSE; } } if ($update) { $req = "UPDATE regconfig SET " . "NAME='%s'," . "REGTREE='%s'," . "REGKEY='%s'," . "REGVALUE='%s' " . "where ID='%s'"; $arg_req = array($form_values["NAME"], $form_values["REGTREE"], $form_values["REGKEY"], $form_values["REGVALUE"], $update); } else { $sql_verif = "select ID from regconfig \n\t\t\t\t\t\twhere REGTREE='%s' \n\t\t\t\t\t\t\tand REGKEY='%s'\n\t\t\t\t\t\t\tand REGVALUE='%s'"; $arg_verif = array($form_values["REGTREE"], $form_values["REGKEY"], $form_values["REGVALUE"]); $res = mysql2_query_secure($sql_verif, $_SESSION['OCS']["readServer"], $arg_verif); $row = mysql_fetch_object($res); if (!is_numeric($row->ID)) { $req = "INSERT INTO regconfig (NAME,REGTREE,REGKEY,REGVALUE)\n\t\t\t\t\tVALUES('%s','%s','%s','%s')"; $arg_req = array($form_values["NAME"], $form_values["REGTREE"], $form_values["REGKEY"], $form_values["REGVALUE"]); } else { msg_error($l->g(987)); return FALSE; } } if (isset($req)) { mysql2_query_secure($req, $_SESSION['OCS']["writeServer"], $arg_req); if ($update) { msg_success($l->g(1185)); } else { msg_success($l->g(1184)); } return TRUE; } }
function create_pack($sql_details, $info_details) { global $l; $info_details = xml_escape_string($info_details); //get temp file $fname = $sql_details['document_root'] . $sql_details['timestamp'] . "/tmp"; //cut this package if ($size = @filesize($fname)) { $handle = fopen($fname, "rb"); $read = 0; for ($i = 1; $i < $sql_details['nbfrags']; $i++) { $contents = fread($handle, $size / $sql_details['nbfrags']); $read += strlen($contents); $handfrag = fopen($sql_details['document_root'] . $sql_details['timestamp'] . "/" . $sql_details['timestamp'] . "-" . $i, "w+b"); fwrite($handfrag, $contents); fclose($handfrag); } $contents = fread($handle, $size - $read); $read += strlen($contents); $handfrag = fopen($sql_details['document_root'] . $sql_details['timestamp'] . "/" . $sql_details['timestamp'] . "-" . $i, "w+b"); fwrite($handfrag, $contents); fclose($handfrag); fclose($handle); unlink($sql_details['document_root'] . $sql_details['timestamp'] . "/tmp"); } else { if (!file_exists($sql_details['document_root'] . $sql_details['timestamp'])) { mkdir($sql_details['document_root'] . $sql_details['timestamp']); } } //if $info_details['DIGEST'] is null => no file to deploy, only execute commande in info file // so nb_frag=0 if (!isset($info_details['DIGEST']) or $info_details['DIGEST'] == "") { $sql_details['nbfrags'] = 0; } //create info $info = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $info .= "<DOWNLOAD ID=\"" . $sql_details['timestamp'] . "\" " . "PRI=\"" . $info_details['PRI'] . "\" " . "ACT=\"" . $info_details['ACT'] . "\" " . "DIGEST=\"" . $info_details['DIGEST'] . "\" " . "PROTO=\"" . $info_details['PROTO'] . "\" " . "FRAGS=\"" . $sql_details['nbfrags'] . "\" " . "DIGEST_ALGO=\"" . $info_details['DIGEST_ALGO'] . "\" " . "DIGEST_ENCODE=\"" . $info_details['DIGEST_ENCODE'] . "\" "; if ($info_details['ACT'] == 'STORE') { $info .= "PATH=\"" . $info_details['PATH'] . "\" "; } if ($info_details['ACT'] == 'LAUNCH') { $info .= "NAME=\"" . $info_details['NAME'] . "\" "; } if ($info_details['ACT'] == 'EXECUTE') { $info .= "COMMAND=\"" . $info_details['COMMAND'] . "\" "; } $info .= "NOTIFY_USER=\"" . $info_details['NOTIFY_USER'] . "\" " . "NOTIFY_TEXT=\"" . $info_details['NOTIFY_TEXT'] . "\" " . "NOTIFY_COUNTDOWN=\"" . $info_details['NOTIFY_COUNTDOWN'] . "\" " . "NOTIFY_CAN_ABORT=\"" . $info_details['NOTIFY_CAN_ABORT'] . "\" " . "NOTIFY_CAN_DELAY=\"" . $info_details['NOTIFY_CAN_DELAY'] . "\" " . "NEED_DONE_ACTION=\"" . $info_details['NEED_DONE_ACTION'] . "\" " . "NEED_DONE_ACTION_TEXT=\"" . $info_details['NEED_DONE_ACTION_TEXT'] . "\" " . "GARDEFOU=\"" . $info_details['GARDEFOU'] . "\" />\n"; $handinfo = fopen($sql_details['document_root'] . $sql_details['timestamp'] . "/info", "w+"); fwrite($handinfo, utf8_decode($info)); fclose($handinfo); //delete all package with the same id mysql2_query_secure("DELETE FROM download_available WHERE FILEID='%s'", $_SESSION['OCS']["writeServer"], $sql_details['timestamp']); //insert new package $req = "INSERT INTO download_available(FILEID, NAME, PRIORITY, FRAGMENTS, SIZE, OSNAME, COMMENT,ID_WK) VALUES\n\t\t( '%s', '%s','%s', '%s','%s', '%s', '%s','%s' )"; $arg = array($sql_details['timestamp'], $sql_details['name'], $info_details['PRI'], $sql_details['nbfrags'], $sql_details['size'], $sql_details['os'], $sql_details['description'], $sql_details['id_wk']); mysql2_query_secure($req, $_SESSION['OCS']["writeServer"], $arg); addLog($l->g(512), $l->g(617) . " " . $sql_details['timestamp']); //info message msg_success($l->g(437) . " " . $sql_details['document_root'] . $sql_details['timestamp']); //delete cache for activation unset($_SESSION['OCS']['DATA_CACHE']['LIST_PACK']); unset($_SESSION['OCS']['NUM_ROW']['LIST_PACK']); }
function update_config($name, $field, $value, $msg = true) { global $l; $sql = "update config set %s='%s' where name='%s'"; $arg = array($field, $value, $name); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); if ($msg) { msg_success($l->g(1200)); } }
$id = mysql_insert_id($_SESSION['OCS']["writeServer"]); if (is_numeric($id)) { if ($protectedPost["newtype"] == 1) { $type = "LONGTEXT"; } elseif ($protectedPost["newtype"] == 8) { $type = "BLOB"; } else { $type = "VARCHAR(255)"; } $sql_add_column = "ALTER TABLE downloadwk_pack ADD COLUMN fields_" . $id . " " . $type . " default NULL"; mysql2_query_secure($sql_add_column, $_SESSION['OCS']["writeServer"]); } else { msg_error("mysql_insert_id() problem"); } } msg_success($l->g(1069)); reloadform_closeme($protectedGet['form']); if ($protectedPost['Valid_modif_x'] != "") { unset($protectedPost['newfield'], $protectedPost['newlbl']); } } else { msg_error($ERROR); } } //NAME FIELD $name_field = array("newfield"); $tab_name = array($l->g(1070) . ": "); $type_field = array(0); $value_field = array($protectedPost['newfield']); $config['JAVASCRIPT'][0] = $sql_field; if (isset($protectedGet['admin'])) {
function admin_serveur($action, $name_server, $descr, $mach) { global $l; if ($action == "") { return $l->g(663); } //intern problem if (trim($name_server) == "") { return $l->g(638); } //name of server is empty if ($mach == "") { return $l->g(665); } //no mach selected. group not creat if (is_numeric($name_server)) { $idGroupServer = $name_server; } else { //verification group not have the same name $reqGetId = "SELECT id FROM hardware WHERE name='%s'"; $arg = $name_server; $resGetId = mysql2_query_secure($reqGetId, $_SESSION['OCS']["readServer"], $arg); if ($valGetId = mysql_fetch_array($resGetId)) { $idGroupServer = $valGetId['id']; } } //if we are in creat new server if ($action == 'new_serv') { //if the name not exist in the base if (!isset($idGroupServer)) { $deviceid = '_DOWNLOADGROUP_'; $sql = "INSERT INTO hardware(deviceid,name,description,lastdate) VALUES( '%s' , '%s', '%s', NOW() )"; $arg = array($deviceid, $name_server, $descr); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); //Getting hardware id $insertId = mysql_insert_id($_SESSION['OCS']["writeServer"]); exist_server($mach); $nb_mach = add_mach($insertId, $mach); msg_success($l->g(880) . "<br>" . $nb_mach . " " . $l->g(881)); return ''; } else { return $l->g(621); } //this name allready exist } elseif ($action == 'add_serv' or $action == 'replace_serv') { if ($action == 'replace_serv') { $sql = "DELETE FROM download_servers WHERE GROUP_ID=%s"; $arg = $idGroupServer; mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } exist_server($mach); $nb_mach = add_mach($idGroupServer, $mach); msg_success($l->g(879) . "<br>" . $nb_mach . " " . $l->g(881)); return ''; } elseif ($action == 'del_serv') { $nb_mach = remove_list_serv($idGroupServer, $mach); msg_success($nb_mach . " " . $l->g(882)); return ''; } }
// code is always made freely available. // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt //==================================================================================== /* * Page des groupes * */ require_once 'require/function_groups.php'; require_once 'require/function_computers.php'; //ADD new static group if ($protectedPost['Valid_modif_x']) { $result = creat_group($protectedPost['NAME'], $protectedPost['DESCR'], '', '', 'STATIC'); if ($result['RESULT'] == "ERROR") { msg_error($result['LBL']); } elseif ($result['RESULT'] == "OK") { msg_success($result['LBL']); unset($protectedPost['add_static_group']); } $tab_options['CACHE'] = 'RESET'; } //reset add static group if ($protectedPost['Reset_modif_x'] or $protectedPost['onglet'] != $protectedPost['old_onglet']) { unset($protectedPost['add_static_group']); } //view only your computers if ($_SESSION['OCS']['RESTRICTION']['GUI'] == 'YES') { $mycomputers = computer_list_by_tag(); if ($mycomputers == "ERROR") { msg_error($l->g(893)); require_once FOOTER_HTML; die;
} if (isset($protectedPost['DOWNLOAD_POSTCMD']) and $protectedPost['DOWNLOAD_POSTCMD'] != '') { active_option('DOWNLOAD_POSTCMD', $list_id, $protectedPost['SELECT'], $protectedPost['DOWNLOAD_POSTCMD']); } if ($protectedGet['origine'] == "group") { $form_to_reload = 'config_group'; } elseif ($protectedGet['origine'] == "mach") { $form_to_reload = 'config_mach'; } if ($protectedPost['onglet'] == 'MACH') { $nb_affect = active_option('DOWNLOAD', $list_id, $protectedPost['SELECT']); } if ($protectedPost['onglet'] == 'SERV_GROUP') { $nb_affect = active_serv($list_id, $protectedPost['SELECT'], $protectedPost['rule_choise']); } msg_success($nb_affect . " " . $l->g(604)); if (isset($form_to_reload)) { //add this $var => not delete this package on computer detail $_SESSION['OCS']["justAdded"] = true; echo "<script language='javascript'> window.opener.document." . $form_to_reload . ".submit();</script>"; } } if ($protectedPost['sens_' . $table_name] == "") { $protectedPost['sens_' . $table_name] = 'DESC'; } if ($protectedPost['onglet'] == "") { $protectedPost['onglet'] = 'MACH'; } $def_onglets['MACH'] = $l->g(980); $def_onglets['SERV_GROUP'] = $l->g(981); //show tab
unset($protectedPost['MODIF'], $protectedPost['ADD_COMM']); $msg_ok = $msg_result['SUCCESS']; $tab_options['CACHE'] = 'RESET'; } else { $msg_error = $msg_result['ERROR']; } } if (isset($protectedPost['Reset_modif'])) { unset($protectedPost['MODIF'], $protectedPost['ADD_COMM']); } if (isset($protectedPost['SUP_PROF']) and is_numeric($protectedPost['SUP_PROF'])) { del_community($protectedPost['SUP_PROF']); $msg_ok = $l->g(1212); } if (isset($msg_ok)) { msg_success($msg_ok); } if (isset($msg_error)) { msg_error($msg_error); } if ($protectedPost['ADD_COMM'] == $l->g(116) or is_numeric($protectedPost['MODIF'])) { $list_version = array('-1' => '2c', '1' => '1', '2' => '2', '3' => '3'); $title = $l->g(1207); if (isset($protectedPost['MODIF']) and is_numeric($protectedPost['MODIF']) and !isset($protectedPost['NAME'])) { $info_com = find_community_info($protectedPost['MODIF']); $default_values = array('ID' => $protectedPost['MODIF'], 'NAME' => $info_com->NAME, 'VERSION' => $list_version, 'USERNAME' => $info_com->USERNAME, 'AUTHKEY' => $info_com->AUTHKEY, 'AUTHPASSWD' => $info_com->AUTHPASSWD); if ($info_com->VERSION == "2c") { $protectedPost['VERSION'] = -1; } else { $protectedPost['VERSION'] = $info_com->VERSION; }
function insert_blacklist_table($table, $field, $field_value) { global $l; $i = 1; $sql = "insert into %s "; $arg = array($table); $sql = mysql2_prepare($sql, $arg, $field, true); $sql['SQL'] .= " value "; $sql = mysql2_prepare($sql['SQL'], $sql['ARG'], $field_value); // //no error mysql2_query_secure($sql['SQL'], $_SESSION['OCS']["writeServer"], $sql['ARG']); msg_success($l->g(655)); }
$protectedPost['default_value'] = $accountinfo_detail[$protectedPost['MODIF']]['default_value']; $hidden = $protectedPost['MODIF']; } if (isset($protectedPost['MODIF_OLD']) and is_numeric($protectedPost['MODIF_OLD']) and $protectedPost['Valid_modif'] != "") { //UPDATE VALUE $msg = update_accountinfo($protectedPost['MODIF_OLD'], array('TYPE' => $protectedPost['newtype'], 'NAME' => $protectedPost['newfield'], 'COMMENT' => $protectedPost['newlbl'], 'ID_TAB' => $protectedPost['account_tab'], 'DEFAULT_VALUE' => $protectedPost['default_value']), $protectedPost['accountinfo']); $hidden = $protectedPost['MODIF_OLD']; } elseif ($protectedPost['Valid_modif'] != "") { //ADD NEW VALUE $msg = add_accountinfo($protectedPost['newfield'], $protectedPost['newtype'], $protectedPost['newlbl'], $protectedPost['account_tab'], $protectedPost['accountinfo'], $protectedPost['default_value']); } if (isset($msg['ERROR'])) { msg_error($msg['ERROR']); } if (isset($msg['SUCCESS'])) { msg_success($msg['SUCCESS']); $protectedPost['onglet'] = 1; } echo open_form($form_name); show_tabs($data_on, $form_name, "onglet", 2); echo '<div class="right-content mlt_bordure" >'; $table = "accountinfo"; if (isset($protectedPost['ACCOUNTINFO_CHOISE']) and $protectedPost['ACCOUNTINFO_CHOISE'] == 'SNMP' and $protectedPost['onglet'] == 1 or isset($protectedPost['accountinfo']) and $protectedPost['accountinfo'] == 'SNMP' and $protectedPost['onglet'] == 2) { $array_tab_account = find_all_account_tab('TAB_ACCOUNTSNMP'); $account_field = "TAB_ACCOUNTSNMP"; } else { $array_tab_account = find_all_account_tab('TAB_ACCOUNTAG'); $account_field = "TAB_ACCOUNTAG"; } if ($protectedPost['onglet'] == 1) { echo $l->g(56) . ": " . show_modif($accountinfo_choise, 'ACCOUNTINFO_CHOISE', 2, $form_name, array('DEFAULT' => "NO"));
function admin_profil($form) { global $protectedPost, $l, $pages_refs; $yes_no = array('YES' => $l->g(455), 'NO' => $l->g(454)); $info_field = array('NAME' => array('INFO' => array('LBL' => $l->g(1153) . ": ", 'VALUE' => '')), 'GUI' => array('RESTRICTION' => array('LBL' => $l->g(1154) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF_ACTIVATE' => array('RESTRICTION' => array('LBL' => $l->g(1158) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF_VISIBLE' => array('RESTRICTION' => array('LBL' => $l->g(1301) . ": ", 'VALUE' => $yes_no)), 'EXPORT_XML' => array('RESTRICTION' => array('LBL' => $l->g(1305), 'VALUE' => $yes_no)), 'WOL' => array('RESTRICTION' => array('LBL' => $l->g(1281) . ": ", 'VALUE' => $yes_no)), 'MACADD' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1159) . ": ", 'VALUE' => $yes_no)), 'SERIAL' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1160) . ": ", 'VALUE' => $yes_no)), 'IPDISCOVER' => array('ADMIN_BLACKLIST' => array('LBL' => $l->g(1161) . ": ", 'VALUE' => $yes_no), 'CONFIGURATION' => array('LBL' => $l->g(1172) . ": ", 'VALUE' => $yes_no)), 'TELEDIFF' => array('CONFIGURATION' => array('LBL' => $l->g(1162) . ": ", 'VALUE' => $yes_no)), 'CONFIG' => array('CONFIGURATION' => array('LBL' => $l->g(1163) . ": ", 'VALUE' => $yes_no)), 'GROUPS' => array('CONFIGURATION' => array('LBL' => $l->g(1164) . ": ", 'VALUE' => $yes_no)), 'CONSOLE' => array('CONFIGURATION' => array('LBL' => $l->g(1165) . ": ", 'VALUE' => $yes_no)), 'ALERTE_MSG' => array('CONFIGURATION' => array('LBL' => $l->g(1166) . ": ", 'VALUE' => $yes_no)), 'ACCOUNTINFO' => array('CONFIGURATION' => array('LBL' => $l->g(1167) . ": ", 'VALUE' => $yes_no)), 'CHANGE_ACCOUNTINFO' => array('CONFIGURATION' => array('LBL' => $l->g(1168) . ": ", 'VALUE' => $yes_no)), 'CHANGE_USER_GROUP' => array('CONFIGURATION' => array('LBL' => $l->g(1169) . ": ", 'VALUE' => $yes_no)), 'MANAGE_PROFIL' => array('CONFIGURATION' => array('LBL' => $l->g(1170) . ": ", 'VALUE' => $yes_no)), 'MANAGE_USER_GROUP' => array('CONFIGURATION' => array('LBL' => $l->g(1171) . ": ", 'VALUE' => $yes_no)), 'MANAGE_SMTP_COMMUNITIES' => array('CONFIGURATION' => array('LBL' => $l->g(1205) . ": ", 'VALUE' => $yes_no)), 'DELETE_COMPUTERS' => array('CONFIGURATION' => array('LBL' => $l->g(1272) . ": ", 'VALUE' => $yes_no))); $lbl_cat = array('INFO' => $l->g(1173), 'PAGE_PROFIL' => $l->g(1174), 'RESTRICTION' => $l->g(1175), 'ADMIN_BLACKLIST' => $l->g(1176), 'CONFIGURATION' => $l->g(1177)); if ($protectedPost['Valid_modif_profil']) { //read profil file $forprofil = read_profil_file($protectedPost['PROFILS']); //read all profil value $forall = read_config_file(); //build new tab with new values foreach ($info_field as $if_name => $if_value) { foreach ($if_value as $if_cat => $if_val) { if (isset($protectedPost[$if_name]) and $protectedPost['cat'] == $if_cat) { $new_value[$if_cat][$if_name] = $protectedPost[$if_name]; } else { $new_value[$if_cat][$if_name] = $forprofil[$if_cat][$if_name]; } } } foreach ($forall['URL'] as $name => $value) { if (isset($protectedPost[$name]) and $protectedPost['cat'] == "PAGE_PROFIL") { $new_value["PAGE_PROFIL"][$name] = ''; } } if (!isset($new_value['PAGE_PROFIL'])) { $new_value['PAGE_PROFIL'] = $forprofil['PAGE_PROFIL']; } update_config_file($protectedPost['PROFILS'], $new_value); msg_success($l->g(1274)); } $array_profil = get_profile_labels(); echo $l->g(1196) . ": " . show_modif($array_profil, "PROFILS", 2, $form); echo "<a href=\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_new_profil'] . "&head=1&form=" . $form . "\"><img src=image/plus.png></a>"; if (isset($protectedPost['PROFILS']) and $protectedPost['PROFILS'] != '') { $forall = read_config_file(); $forprofil = read_profil_file($protectedPost['PROFILS'], 'WRITE'); if (is_array($forprofil) and is_array($forall)) { foreach ($forprofil as $key => $value) { if (isset($lbl_cat[$key])) { $data_on[$key] = $lbl_cat[$key]; } } onglet($data_on, $form, "cat", 10); if (isset($forprofil[$protectedPost['cat']]) and $protectedPost['cat'] != 'PAGE_PROFIL') { $name_field = array(); $type_field = array(); $tab_name = array(); $value_field = array(); foreach ($info_field as $if_name => $if_value) { foreach ($if_value as $if_cat => $if_val) { if ($protectedPost['cat'] == $if_cat) { if (isset($forprofil[$if_cat][$if_name])) { $protectedPost[$if_name] = $forprofil[$if_cat][$if_name]; } array_push($name_field, $if_name); array_push($tab_name, $if_val['LBL']); if (is_array($if_val['VALUE'])) { array_push($type_field, 2); if (!isset($protectedPost[$if_name])) { array_push($if_val['VALUE'], ''); } array_push($value_field, $if_val['VALUE']); } else { array_push($type_field, 0); array_push($value_field, replace_language($forprofil[$if_cat][$if_name])); } } } } $tab_typ_champ = show_field($name_field, $type_field, $value_field); tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, array('button_name' => 'modif_profil')); } elseif ($protectedPost['cat'] == 'PAGE_PROFIL') { $champs = "<table align=center><tr><td align=center>"; $i = 0; ksort($forall['URL']); foreach ($forall['URL'] as $key => $value) { $champs .= "<input type='checkbox' name='" . $key . "' id='" . $key . "' "; if (isset($forprofil[$protectedPost['cat']][$key])) { $champs .= " checked "; } $champs .= " ></td><td>" . $key . "</td><td align=center>"; $i++; if ($i == 4) { $champs .= "</td></tr><tr><td align=center>"; $i = 0; } } $champs .= "</td></tr></table>"; tab_modif_values($champs, array(), array(), array('button_name' => 'modif_profil')); } } } }
$msg .= $l->g(1178) . ': <i>' . substr($tab_name[0], 0, -2) . "</i> " . $l->g(363) . " <br>"; } $i = 0; while ($name_field[$i]) { if (trim($protectedPost[$name_field[$i]]) == '') { // $msg .= $l->g(1178).': <i>' . $tab_name[$i] . "</i> " . $l->g(1180) . " <br>"; $msg .= $l->g(1178) . ': <i>' . substr($tab_name[$i], 0, -2) . "</i> " . $l->g(1180) . " <br>"; } $i++; } if ($msg != '') { msg_error($msg); } else { msg_success($l->g(1276)); create_profil($protectedPost['new_profil'], $protectedPost['lbl_profil'], $protectedPost['ref_profil']); if ($protectedGet['form']) { reloadform_closeme($protectedGet['form'], true); } else { msg_success($l->g(1274)); } } } $value_field = array($protectedPost['new_profil'], $protectedPost['lbl_profil'], search_profil()); $config['JAVASCRIPT'][0] = $sql_field; $tab_typ_champ = show_field($name_field, $type_field, $value_field, $config); $tab_typ_champ[0]['CONFIG']['SIZE'] = 20; $tab_typ_champ[1]['CONFIG']['SIZE'] = 20; tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, $title, $comment = "", $name_button = "modif", $showbutton); } echo "</div>"; echo close_form();
$platform = "windows"; $filename = $_FILES['file_upload']['tmp_name']; $fd = fopen($filename, "r"); $contents = fread($fd, filesize($filename)); fclose($fd); $binary = $contents; $sql = "DELETE FROM deploy where name='%s'"; $arg = $fname; mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); $sql = "INSERT INTO deploy values ('%s','%s')"; $arg = array($fname, $binary); $result = mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); if (!$result) { msg_error($l->g(2003) . mysqli_errno($_SESSION['OCS']["writeServer"]) . "<br>" . mysqli_error($_SESSION['OCS']["writeServer"])); } else { msg_success($l->g(137) . " " . $_FILES['file_upload']['name'] . " " . $l->g(234)); $tab_options['CACHE'] = 'RESET'; } } else { msg_error($l->g(920)); } } if (isset($protectedPost['SUP_PROF']) and $protectedPost['SUP_PROF'] != '') { $sql = "DELETE FROM deploy where name='%s'"; $arg = $protectedPost['SUP_PROF']; mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } if (!isset($protectedPost['ADD_FILE'])) { echo open_form($form_name); $list_fields = array($l->g(283) => 'function', $l->g(49) => 'name', 'SUP' => 'name'); $list_col_cant_del = $list_fields;
function fusionne($afus) { global $l; $i = 0; $maxStamp = 0; $minStamp = mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")); //demain foreach ($afus as $a) { $d = $a["lastcome"]; $a["stamp"] = mktime($d[11] . $d[12], $d[14] . $d[15], $d[17] . $d[18], $d[5] . $d[6], $d[8] . $d[9], $d[0] . $d[1] . $d[2] . $d[3]); //echo "stamp:".$a["stamp"]."== mktime($d[11]$d[12],$d[14]$d[15],$d[17]$d[18],$d[5]$d[6],$d[8]$d[9],$d[0]$d[1]$d[2]$d[3]);<br>"; if ($maxStamp < $a["stamp"]) { $maxStamp = $a["stamp"]; $maxInd = $i; } if ($minStamp > $a["stamp"]) { $minStamp = $a["stamp"]; $minInd = $i; } $i++; } if ($afus[$minInd]["deviceid"] != "") { $okLock = true; foreach ($afus as $a) { if (!($okLock = $okLock && lock($a["id"]))) { break; } else { $locked[] = $a["id"]; } } if ($okLock) { //TRACE_DELETED if (mysqli_num_rows(mysql2_query_secure("SELECT * FROM config WHERE IVALUE>0 AND NAME='TRACE_DELETED'", $_SESSION['OCS']["readServer"]))) { foreach ($afus as $a) { if ($afus[$maxInd]["deviceid"] == $a["deviceid"]) { continue; } $sql = "insert into deleted_equiv(DELETED,EQUIVALENT) values('%s','%s')"; $arg = array($a["deviceid"], $afus[$maxInd]["deviceid"]); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } } //KEEP OLD QUALITY,FIDELITY AND CHECKSUM $sql = "SELECT CHECKSUM,QUALITY,FIDELITY FROM hardware WHERE ID='%s'"; $persistent_req = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $afus[$minInd]["id"]); $reqDelAccount = "DELETE FROM accountinfo WHERE hardware_id='%s'"; mysql2_query_secure($reqDelAccount, $_SESSION['OCS']["writeServer"], $afus[$maxInd]["id"]); msg_success($l->g(190) . " " . $afus[$maxInd]["deviceid"] . " " . $l->g(191)); $keep = array("accountinfo", "devices", "groups_cache"); foreach ($keep as $tableToBeKept) { $reqRecupAccount = "UPDATE %s SET hardware_id='%s' WHERE hardware_id='%s'"; $argRecupAccount = array($tableToBeKept, $afus[$maxInd]["id"], $afus[$minInd]["id"]); mysql2_query_secure($reqRecupAccount, $_SESSION['OCS']["writeServer"], $argRecupAccount); } msg_success($l->g(190) . " " . $afus[$minInd]["deviceid"] . " " . $l->g(206) . " " . $afus[$maxInd]["deviceid"]); $i = 0; foreach ($afus as $a) { if ($i != $maxInd) { deleteDid($a["id"], false, false, false); $lesDel .= $a["deviceid"] . "/"; } $i++; } //RESTORE PERSISTENT VALUES $persistent_values = mysqli_fetch_row($persistent_req); $sql = "UPDATE hardware SET QUALITY=%s,FIDELITY=%s,CHECKSUM=CHECKSUM|%s WHERE id='%s'"; $arg = array($persistent_values[1], $persistent_values[2], $persistent_values[0], $afus[$maxInd]["id"]); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); } else { errlock(); } foreach ($locked as $a) { unlock($a); } } $lesDel .= " => " . $afus[$maxInd]["deviceid"]; AddLog("FUSION", $lesDel); }
$result = mysql_query($sql_up_accesslvl) or die(mysql_error()); while ($value = mysql_fetch_array($result)) { unset($new_lvl); if ($value['accesslvl'] == 1) { $new_lvl = 'sadmin'; } elseif ($value['accesslvl'] == 2) { $new_lvl = 'ladmin'; } elseif ($value['accesslvl'] == 3) { $new_lvl = 'admin'; } if (isset($new_lvl)) { $sql = "UPDATE operators SET new_accesslvl='" . $new_lvl . "' where ID='" . $value['id'] . "'"; mysql_query($sql); } } msg_success($l->g(2055)); } } //$keepuser=1; // Provided user not MySQL Administror // Keep the account used for migration //echo "toto"; fwrite($ch, "<?php\n"); fwrite($ch, "define(\"DB_NAME\", \"" . $_POST['database'] . "\");\n"); fwrite($ch, "define(\"SERVER_READ\",\"" . $_POST["host"] . "\");\n"); fwrite($ch, "define(\"SERVER_WRITE\",\"" . $_POST["host"] . "\");\n"); fwrite($ch, "define(\"COMPTE_BASE\",\"" . $name_connect . "\");\n"); fwrite($ch, "define(\"PSWD_BASE\",\"" . $pass_connect . "\");\n"); fwrite($ch, "?>"); fclose($ch); echo "<br><center><font color=green><b>" . $l->g(2056) . " (" . $l->g(2017) . " " . $name_connect . " " . $l->g(2007) . ")</b></font></center>";
if ($protectedPost['SUP_PROF'] != "") { delete_rule($protectedPost['SUP_PROF']); $tab_options['CACHE'] = 'RESET'; } //ADD new rule if ($protectedPost['ADD_RULE']) { add_rule($protectedPost['RULE_NAME'], $protectedPost); $tab_options['CACHE'] = 'RESET'; } //modif rule if ($protectedPost['MODIF_RULE']) { $name_exist = verify_name($protectedPost['RULE_NAME'], "and rule != " . $protectedPost['OLD_MODIF']); if ($name_exist == 'NAME_NOT_EXIST') { delete_rule($protectedPost['OLD_MODIF']); add_rule($protectedPost['RULE_NAME'], $protectedPost, $protectedPost['OLD_MODIF']); echo msg_success($l->g(711)); $tab_options['CACHE'] = 'RESET'; } else { msg_error($l->g(670)); } } //form name $form_name = "rules"; //show all rules echo open_form($form_name); $list_fields = array('ID_RULE' => 'RULE', 'RULE_NAME' => 'RULE_NAME', 'SUP' => 'RULE', 'MODIF' => 'RULE'); $table_name = "DOWNLOAD_AFFECT_RULES"; $default_fields = array('ID_RULE' => 'ID_RULE', 'RULE_NAME' => 'RULE_NAME', 'SUP' => 'SUP', 'MODIF' => 'MODIF'); $list_col_cant_del = array('ID_RULE' => 'ID_RULE', 'SUP' => 'SUP', 'MODIF' => 'MODIF'); $sql = prepare_sql_tab($list_fields, array('SUP')); $sql['SQL'] .= " from download_affect_rules ";
fwrite($ch, "define(\"SERVER_WRITE\",\"" . $_POST["host"] . "\");\n"); fwrite($ch, "define(\"COMPTE_BASE\",\"" . $name_connect . "\");\n"); fwrite($ch, "define(\"PSWD_BASE\",\"" . $pass_connect . "\");\n"); fwrite($ch, "?>"); fclose($ch); if (!mysqli_connect($_POST["host"], $name_connect, $pass_connect)) { if (mysqli_connect_errno() == 0) { echo "<br><center><font color=red><b>" . $l->g(2043) . " " . $l->g(2044) . "</b><br></font></center>"; die; } else { echo "<br><center><font color=red><b>" . $l->g(2043) . " (" . $l->g(2017) . " " . $l->g(2010) . "=" . $_POST["host"] . " " . $l->g(2011) . "=ocs " . $l->g(2014) . "=ocs)" . "</b><br></font></center>"; } echo "<br><center><font color=red><b>" . $l->g(2065) . "</b></font></center>"; unlink(CONF_MYSQL); } else { msg_success("<b>" . $l->g(2050) . "</b><br><br><b><a href='index.php'>" . $l->g(2051) . "</a></b>"); unset($_SESSION['OCS']['SQL_BASE_VERS']); } die; } else { msg_error($l->g(2115)); } } //die(); } //use values in mysql config file if (is_readable(CONF_MYSQL)) { require CONF_MYSQL; if (defined('COMPTE_BASE')) { $valNme = COMPTE_BASE; } else {
<?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 //==================================================================================== require_once 'require/function_users.php'; if (isset($protectedPost['Valid_modif'])) { $protectedPost['ACCESSLVL'] = $_SESSION['OCS']['lvluser']; $protectedPost['ID'] = $_SESSION['OCS']["loggeduser"]; $protectedPost['MODIF'] = $_SESSION['OCS']["loggeduser"]; $msg = add_user($_POST, get_profile_labels()); if ($msg != $l->g(374)) { msg_error($msg); } else { msg_success($l->g(1186)); } } $form_name = "pass"; echo open_form($form_name); admin_user($_SESSION['OCS']["loggeduser"], true); echo close_form();
//==================================================================================== //Modified on $Date: 2010 $$Author: Erwan Goalou //UPDATE/DELETE if ($protectedPost['Valid_modif_x']) { $sql = "DELETE FROM deploy WHERE name='%s'"; $arg = "label"; $msg = $l->g(261); if (trim($protectedPost['lbl']) != "") { $protectedPost["lbl"] = str_replace(array("\t", "\n", "\r"), array("", "", ""), $protectedPost["lbl"]); mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); $sql = "INSERT INTO deploy VALUES('%s','%s')"; $arg = array('label', $protectedPost["lbl"]); $msg = $l->g(260); } mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); msg_success($msg); } //Looking for the label $reqL = "SELECT content FROM deploy WHERE name='%s'"; $arg = "label"; $resL = mysql2_query_secure($reqL, $_SESSION['OCS']["readServer"], $arg); $val = mysql_fetch_object($resL); printEntete($l->g(263)); $form_name = 'admin_info'; echo "<br>"; echo open_form($form_name); $name_field = array("lbl"); $tab_name = array($l->g(262) . ": "); $type_field = array(1); $value_field = array($val->content); $tab_typ_champ = show_field($name_field, $type_field, $value_field);
if (isset($protectedPost['del_check']) and $protectedPost['del_check'] != '') { delete_list_user($protectedPost['del_check']); $tab_options['CACHE'] = 'RESET'; } //suppression d'un user if (isset($protectedPost['SUP_PROF']) and $protectedPost['SUP_PROF'] != '') { delete_list_user($protectedPost['SUP_PROF']); $tab_options['CACHE'] = 'RESET'; } //ajout d'un user if (isset($protectedPost['Valid_modif_x'])) { $ok = add_user($protectedPost, $list_profil); if ($ok == $l->g(373) or $ok == $l->g(374)) { unset($_SESSION['OCS']['DATA_CACHE'], $protectedPost['ID'], $protectedPost['FIRSTNAME'], $protectedPost['LASTNAME'], $protectedPost['ACCESSLVL'], $protectedPost['COMMENTS'], $protectedPost['PASSWORD'], $protectedPost['MODIF']); $tab_options['CACHE'] = 'RESET'; msg_success($ok); } else { msg_error($ok); } } echo '<div class="mlt_bordure" >'; //add user or modif if ($protectedPost['onglet'] == 4 or isset($protectedPost['MODIF']) and $protectedPost['MODIF'] != '') { admin_user($protectedPost['MODIF']); } elseif ($protectedPost['onglet'] == 5 and $_SESSION['OCS']['CONFIGURATION']['MANAGE_PROFIL'] == 'YES') { admin_profil($form_name); } else { echo "<tr><td align=center>"; //affichage $list_fields = array('ID' => 'ID', $l->g(49) => 'FIRSTNAME', $l->g(996) => 'LASTNAME', $l->g(66) => 'NEW_ACCESSLVL', $l->g(51) => 'COMMENTS', $l->g(1117) => 'EMAIL', $l->g(607) => 'USER_GROUP', 'SUP' => 'ID', 'MODIF' => 'ID', 'CHECK' => 'ID'); $list_col_cant_del = array('ID' => 'ID', 'SUP' => 'SUP', 'MODIF' => 'MODIF', 'CHECK' => 'CHECK');
$version_database++; if (in_array($version_database . ".sql", $list_fichier['name'])) { if ($_SESSION['OCS']['DEBUG'] == 'ON') { msg_success("Mise à jour effectuée: " . $version_database . ".sql"); } exec_fichier_sql($rep_maj . '/' . $version_database . ".sql"); $sql = "update config set tvalue='%s' where name='GUI_VERSION'"; $arg = $version_database; $res_column = mysql2_query_secure($sql, $_SESSION['OCS']["writeServer"], $arg); $_SESSION['OCS']['SQL_BASE_VERS'] = $version_database; } else { msg_error($l->g(2114) . " " . $version_database); die; } } msg_success($l->g(1121)); echo "<br><br><br><b><a href='index.php'>" . $l->g(2051) . "</a></b>"; //Logout after update(s) //Contrib of FranciX (http://forums.ocsinventory-ng.org/viewtopic.php?pid=41923#p41923) if ($_SESSION['OCS']['cnx_origine'] == "CAS") { require_once PHPCAS; require_once BACKEND . 'require/cas.config.php'; $cas = new phpCas(); $cas->client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_uri); $cas->logout(); } //end contrib unset($_SESSION['OCS']); unset($_GET); } echo "</form>";
} if (isset($data_fields_account)) { updateinfo_computer($list_id, $data_fields_account, 'LIST'); unset($_SESSION['OCS']['DATA_CACHE']['TAB_MULTICRITERE']); echo "<script language='javascript'> window.opener.document.multisearch.submit();</script>"; } } //CAS OF TELEDEPLOY if (isset($protectedPost['RAZ']) and $protectedPost['RAZ'] != "" and $protectedPost['pack_list'] != "") { $sql = "select ID from download_enable \n\t\t\t\twhere fileid='%s'"; $arg = $protectedPost['pack_list']; $result = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); $item = mysqli_fetch_object($result); require_once 'require/function_telediff.php'; $nb_line_affected = desactive_packet($list_id, $item->ID); msg_success($nb_line_affected . " " . $l->g(1026)); } //CAS OF WOL if (isset($protectedPost['WOL']) and $protectedPost['WOL'] != '') { require_once 'require/function_wol.php'; $wol = new Wol(); $sql = "select IPADDRESS,MACADDR from networks WHERE status='Up' and hardware_id in "; $arg = array(); $tab_result = mysql2_prepare($sql, $arg, $list_id); $resultDetails = mysql2_query_secure($tab_result['SQL'], $_SESSION['OCS']["writeServer"], $tab_result['ARG']); $msg = ""; while ($item = mysqli_fetch_object($resultDetails)) { $wol->wake($item->MACADDR, $item->IPADDRESS); $msg .= "<br>" . $wol->wol_send . "=>" . $item->MACADDR . "/" . $item->IPADDRESS; } msg_info($msg);
$values_fields[] = $value; } } /*if ($protectedPost['NB_COMPUTERS'] === 1) $protectedPost['NB_COMPUTERS']='';*/ $i = 0; while ($i < $protectedPost['NB_COMPUTERS']) { $id_computer = insert_manual_computer($protectedPost, $protectedPost['NB_COMPUTERS']); if (!is_array($fields)) { $fields[] = 'TAG'; $values_fields[] = ''; } insertinfo_computer($id_computer, $fields, $values_fields); $i++; } msg_success($l->g(881)); } else { msg_error($l->g(684) . "<br>" . $error); } } $i = 0; $info_form['FIELDS']['name_field'][$i] = 'NB_COMPUTERS'; $info_form['FIELDS']['type_field'][$i] = 0; $info_form['FIELDS']['value_field'][$i] = $protectedPost['NB_COMPUTERS'] != '' ? $protectedPost['NB_COMPUTERS'] : '1'; $info_form['FIELDS']['tab_name'][$i] = $l->g(28); $config[$i]['CONFIG']['SIZE'] = 4; $config[$i]['CONFIG']['MAXLENGTH'] = 4; $other_data['COMMENT_BEHING'][$i] = ''; $config[$i]['CONFIG']['JAVASCRIPT'] = $chiffres; foreach ($form_fields_typeinput as $key => $value) { $i++;
function dde_conf($form_name) { global $l, $protectedPost, $protectedGet, $pages_refs, $infos_status; if ($_SESSION['OCS']['CONFIGURATION']['TELEDIFF_WK'] == 'YES') { //sous onglets if ($infos_status['NIV_BIS'] != '') { $conf_value['GENERAL'] = $l->g(107); $conf_value['GUI'] = $l->g(84); } $conf_value['STATUS'] = $l->g(1095); //$conf_value['ADMIN']='Administration'; onglet($conf_value, $form_name, "conf", 7); if ($protectedPost['Valid'] == $l->g(103)) { $etat = verif_champ(); if ($etat == "") { $MAJ = update_default_value($protectedPost); } else { $msg = ""; foreach ($etat as $name => $value) { $msg .= $name . " " . $l->g(759) . " " . $value . "<br>"; } msg_error($msg); } } if (!isset($protectedPost['conf']) or $protectedPost['conf'] == "GENERAL") { pageTELEDIFF_WK($form_name); } if ($protectedPost['conf'] == "GUI") { //mise a jour des données demandée par l'utilisateur if ($protectedPost['Valid_fields_x'] != "") { //si la mise a jour est limitée à certain champs if (isset($protectedPost['DEFAULT_FIELD'])) { $fields = explode(',', $protectedPost['DEFAULT_FIELD']); } else { $fields = array('type', 'field', 'lbl', 'must_completed', 'value', 'restricted', 'link_status'); //si le type est TEXTAREA, il faut aussi changer le type de la colonne en longtext if ($protectedPost['type'] == 1) { $type_modif = "longtext"; } else { $type_modif = "varchar(255)"; } $sql_modify_type = 'ALTER TABLE downloadwk_pack change fields_%1$s fields_%1$s ' . $type_modif . ' default null;'; $arg = array($protectedPost['FIELDS']); mysql2_query_secure($sql_modify_type, $_SESSION['OCS']["writeServer"], $arg); //echo $sql_modify_type; } //création de la requête $sql_update = 'UPDATE downloadwk_fields set '; $arg = array(); foreach ($fields as $key => $value) { $sql_update .= $value . "='%s' ,"; $arg[] = $protectedPost[$value]; } $sql_update = substr($sql_update, 0, -1) . "where id='%s'"; $arg[] = $protectedPost['FIELDS']; mysql2_query_secure($sql_update, $_SESSION['OCS']["writeServer"], $arg); //print_r //echo $sql_update; } $sql_service = "select id,field,value,lbl,default_field \n\t\t\t\t\t\t\t FROM downloadwk_tab_values"; $resultSERV = mysql2_query_secure($sql_service, $_SESSION['OCS']["readServer"]); $List_tab[] = ''; while ($item = mysql_fetch_object($resultSERV)) { $lbl = define_lbl($item->lbl, $item->default_field); $List_tab[$item->id] = $lbl; } $name_field = array("TAB"); //$oblig_field['INFO_VALID']=$name_field['INFO_VALID']; $tab_name = array($l->g(1097) . ":"); $type_field = array(2); $value_field = array($List_tab); if (isset($protectedPost['TAB']) and $protectedPost['TAB'] != 0) { $sql_service = "select id,lbl,default_field \n\t\t\t\t\t\t\t\t FROM downloadwk_fields \n\t\t\t\t\t\t\t\t where TAB='%s'"; $arg = array($protectedPost['TAB']); $resultSERV = mysql2_query_secure($sql_service, $_SESSION['OCS']["readServer"], $arg); $List_fields[] = ''; while ($item = mysql_fetch_object($resultSERV)) { $lbl = define_lbl($item->lbl, $item->default_field); $List_fields[$item->id] = $lbl; $default_field[$item->id] = $item->default_field; } array_push($name_field, "FIELDS"); array_push($tab_name, $l->g(1096) . ":"); array_push($type_field, 2); array_push($value_field, $List_fields); } $tab_typ_champ = show_field($name_field, $type_field, $value_field); $tab_typ_champ[0]['COMMENT_BEHING'] = "<a href=# onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_admin_management'] . "&head=1&admin=tab&value=TAB&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>"; $tab_typ_champ[0]['RELOAD'] = $form_name; $tab_typ_champ[1]['RELOAD'] = $form_name; $tab_typ_champ[1]['COMMENT_BEHING'] = "<a href=# onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_admin_management'] . "&head=1&admin=fields&value=" . $protectedPost['TAB'] . "&form=" . $form_name . "\",\"admin_management\",\"location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=700,height=650\")><img src=image/plus.png></a>"; tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, $title = "", $comment = "", $name_button = "modif", $showbutton = false, $form_name = 'NO_FORM'); if (isset($protectedPost['FIELDS']) and $protectedPost['FIELDS'] != 0) { echo "<br>"; $sql_status = "SELECT id,lbl FROM downloadwk_statut_request"; $res_status = mysql2_query_secure($sql_status, $_SESSION['OCS']["readServer"]); $status['0'] = $l->g(454); while ($val_status = mysql_fetch_array($res_status)) { $status[$val_status['id']] = $val_status['lbl']; } //print_r($status); $list_type = array('TEXT', 'TEXTAREA', 'SELECT', 'SHOW DATA', 'PASSWORD', 'CHECKBOX', 'LIST', 'HIDDEN', 'BLOB (FILE)', 'LINK LIST', 'TABLE'); $yes_no = array($l->g(454), $l->g(455)); $sql_detailField = "select type,field,lbl,must_completed,\n\t\t\t\t\t\t\t\t\t\tvalue,restricted,link_status \n\t\t\t\t\t\t\t\t\t FROM downloadwk_fields \n\t\t\t\t\t\t\t\t\t where id='%s' and tab='%s' "; $arg = array($protectedPost['FIELDS'], $protectedPost['TAB']); $result_detailField = mysql2_query_secure($sql_detailField, $_SESSION['OCS']["readServer"], $arg); $item_detailField = mysql_fetch_object($result_detailField); //if there is no result or more than 1, don't show update table $num_row = mysql_numrows($result_detailField); if ($num_row == 1) { $protectedPost['type'] = $item_detailField->type; $protectedPost['must_completed'] = $item_detailField->must_completed; $protectedPost['restricted'] = $item_detailField->restricted; $protectedPost['link_status'] = $item_detailField->link_status; $name_field = array('type', 'field', 'lbl', 'must_completed', 'value', 'restricted', 'link_status'); $tab_name = array($l->g(1071) . ':', $l->g(1098) . ':', $l->g(1063) . ':', $l->g(1064) . ':', $l->g(1099) . ':', $l->g(1065) . ':', $l->g(1066) . ':'); if ($default_field[$protectedPost['FIELDS']]) { $title = $l->g(1101); //$showbutton=false; $type_field = array(3, 3, 3, 3, 0, 3, 3, 7); $value_field = array($list_type[$item_detailField->type], $item_detailField->field, $l->g($item_detailField->lbl), $yes_no[$item_detailField->must_completed], $item_detailField->value, $yes_no[$item_detailField->restricted], $status[$item_detailField->link_status], 'value'); if ($item_detailField->field == "STATUS") { $type_field[4] = 2; unset($status[0]); $value_field[4] = $status; $protectedPost['value'] = $item_detailField->value; } $name_field[7] = 'DEFAULT_FIELD'; $tab_name[7] = ''; } else { $title = ""; //$showbutton=true; $type_field = array(2, 0, 0, 2, 0, 2, 2); $value_field = array($list_type, $item_detailField->field, $item_detailField->lbl, $yes_no, $item_detailField->value, $yes_no, $status); } $tab_typ_champ = show_field($name_field, $type_field, $value_field); tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, $title, $comment = "", $name_button = "fields", $showbutton = true, $form_name = 'NO_FORM'); } } } elseif ($protectedPost['conf'] == "STATUS") { //mise à jour des valeurs de statuts if ($protectedPost['Valid_fields_x'] != '') { if (trim($protectedPost['lbl']) != '') { $sql_update = "UPDATE downloadwk_statut_request\n\t\t\t\t\t\t\t\t\t\tset LBL='%s' , ACTIF='%s'\n\t\t\t\t\t\t\t\t\t\twhere ID='%s'"; $arg = array($protectedPost['lbl'], $protectedPost['actif'], $protectedPost['id']); mysql2_query_secure($sql_update, $_SESSION['OCS']["writeServer"], $arg); msg_success($l->g(1121)); } else { msg_error($l->g(988)); } } $infos_status = list_status(false); $name_field = array("STATUS"); $tab_name = array($l->g(1100) . ":"); $type_field = array(2); $value_field = array($infos_status['STAT']); if (isset($protectedPost['STATUS']) and $protectedPost['STATUS'] != 0) { //delete old post if you change status if (isset($protectedPost['OLD_STATUS']) and $protectedPost['OLD_STATUS'] != $protectedPost['STATUS']) { unset($protectedPost['actif'], $protectedPost['lbl'], $protectedPost['name']); } $yes_no = array($l->g(454), $l->g(455)); if (!isset($protectedPost['actif'])) { $protectedPost['actif'] = $infos_status['ACTIF'][$protectedPost['STATUS']]; } if (!isset($protectedPost['lbl'])) { $protectedPost['lbl'] = $infos_status['STAT_BIS'][$protectedPost['STATUS']]; } if (!isset($protectedPost['name'])) { $protectedPost['name'] = $infos_status['NIV'][$protectedPost['STATUS']]; } $protectedPost['id'] = $protectedPost['STATUS']; array_push($name_field, 'actif', 'id', 'lbl', 'name', 'OLD_STATUS'); array_push($tab_name, $l->g(1102) . ':', $l->g(1103) . ':', $l->g(1063) . ':', $l->g(1064) . ':', ''); array_push($type_field, 2, 3, 0, 3, 7); array_push($value_field, $yes_no, $protectedPost['id'], $protectedPost['lbl'], $protectedPost['name'], $protectedPost['STATUS']); $showbutton = true; } else { $showbutton = false; } $tab_typ_champ = show_field($name_field, $type_field, $value_field); $tab_typ_champ[0]['RELOAD'] = $form_name; tab_modif_values($tab_name, $tab_typ_champ, $tab_hidden, $title, $comment = "", $name_button = "fields", $showbutton, $form_name = 'NO_FORM'); } } }
insert($key, $protectedPost[$key . '_edit']); } elseif ($value == "ALWAYS") { insert($key, 0); } elseif ($value == "NEVER") { insert($key, -1); } elseif ($value == "ON") { insert($key, 1); } elseif ($value == "OFF") { insert($key, 0); } elseif ($key == "IPDISCOVER" and $value != "des" and $value != "OFF" or $key == "SNMP_NETWORK") { insert($key, 2, $value); } } } $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
$msg .= $name . " " . $l->g(759) . " " . $value . "<br>"; } else { if (isset($value['FILE_NOT_EXIST'])) { if ($name == 'DOWNLOAD_REP_CREAT') { $msg .= $name . ": " . $l->g(1004) . " (" . $value['FILE_NOT_EXIST'] . ")<br>"; } else { $msg .= $name . ": " . $l->g(920) . " " . $value['FILE_NOT_EXIST'] . "<br>"; } } } } msg_error($msg); } } if (isset($MAJ) and $MAJ != '') { msg_success($MAJ); } $form_name = 'modif_onglet'; echo open_form($form_name); onglet($def_onglets, $form_name, 'onglet', 8); echo '<div class="mlt_bordure" >'; switch ($protectedPost['onglet']) { case 'CNX': pageConnexion($form_name); break; case 'GUI': pageGUI($form_name); break; case 'INVENTORY': pageinventory($form_name); break;
} else { $field_value_complement[$i] = " AND LETTER = '" . $field_value_complement[$i] . "' "; } break; case "REGISTRY": $field_value_complement[$i] = " AND NAME = '" . $field_value_complement[$i] . "' "; break; case "DEVICES": $field_value_complement[$i] = " AND IVALUE " . $field_value_complement[$i] . $tvalue; break; default: $ERROR = $l->g(5015) . $table[$i]; } } if ($_SESSION['OCS']['DEBUG'] == 'ON') { msg_success($l->g(5016) . $table[$i] . "<br>" . $l->g(5017) . $field[$i] . "<br>" . $l->g(5018) . $field_compar[$i] . "<br>" . $l->g(5019) . $field_value[$i] . "<br>" . $l->g(5020) . $field_value_complement[$i] . "<br>" . $l->g(5021) . $field_and_or[$i]); } //si une erreur a été rencontrée //le traitement est arrêté (gain de temps) if (isset($ERROR)) { msg_error($ERROR); break; } //si on est dans le cas d'une recherche sur "différent", //on va créer les requêtes dans le tableau $sql_seach['DIFF'] if ($field_compar_origine[$i] == "diff") { $operation = "DIFF"; } else { //autremant dans les autres cas, on va créer le tableau de requête dans $sql_seach['NORMAL'] $operation = "NORMAL"; }
} $msg_success = $l->g(880); } //ecrasement d'un groupe if ($protectedPost['NEW_RAZ'] == "RAZ") { $nb_mach = replace_group($protectedPost['group_list'], $list_id, $_SESSION['OCS']['SEARCH_SQL_GROUP'], $group_type); $msg_success = $l->g(879); } if ($nb_mach == "ERROR") { $msg_error = $result['LBL']; } elseif (isset($nb_mach) and $protectedPost['NEW_RAZ'] != "DEL") { $msg_success .= "<br>" . $nb_mach . " " . $l->g(974); } } if (isset($msg_success) and $msg_success != '') { msg_success($msg_success); } if (isset($msg_error) and $msg_error != '') { msg_error($msg_error); } } /*********************************************CALCUL DES CHAMPS A AFFICHER*************************************/ if ($list_id) { //d�finition des onglets //for all $def_onglets[$l->g(809)] = $l->g(809); //GROUPES STATIQUES } if ($_SESSION['OCS']['CONFIGURATION']['GROUPS'] == "YES") { $def_onglets[$l->g(810)] = $l->g(810); //GROUPES DYNAMIQUES