//Webservice $def_onglets['GUI'] = $l->g(84); //GUI $def_onglets['CNX'] = $l->g(1108); //connexion $def_onglets['SNMP'] = $l->g(1136); //SNMP $def_onglets['WOL'] = $l->g(1279); //WOL if (DEV_OPTION) { $def_onglets['DEV'] = $l->g(1302); } if ($protectedPost['Valid'] == $l->g(103)) { $etat = verif_champ(); if ($etat == "") { update_default_value($protectedPost); //function in function_config_generale.php $MAJ = $l->g(1121); } else { $msg = ""; foreach ($etat as $name => $value) { if (!is_array($value)) { $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>"; } }
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'); } } }