示例#1
0
 $res_affect_pack = mysql2_query_secure($sql_affect_pack, $_SESSION['OCS']["readServer"], $conf_Wk['tvalue']['IT_SET_NIV_REST']);
 while ($val_affect_pack = mysql_fetch_array($res_affect_pack)) {
     $fileid_rest[$val_affect_pack["fileid"]] = $val_affect_pack["fileid"];
 }
 //find all package can be affected TOTAL status
 $res_affect_pack = mysql2_query_secure($sql_affect_pack, $_SESSION['OCS']["readServer"], $conf_Wk['tvalue']['IT_SET_NIV_TOTAL']);
 while ($val_affect_pack = mysql_fetch_array($res_affect_pack)) {
     $fileid_total[$val_affect_pack["fileid"]] = $val_affect_pack["fileid"];
 }
 $fileid_show = array();
 //can affect on groups or tag?
 if ($conf_Wk['ivalue']['IT_SET_PERIM'] == 1) {
     $perim = 'TAG';
     require_once 'require/function_admininfo.php';
     $allvalue_multi = accountinfo_tab($conf_Wk['tvalue']['IT_SET_TAG_NAME']);
     $info = find_info_accountinfo($conf_Wk['tvalue']['IT_SET_TAG_NAME']);
     if ($conf_Wk['tvalue']['IT_SET_TAG_NAME'] == 1) {
         $field_acc = 'TAG';
     } else {
         $field_acc = 'fields_' . $conf_Wk['tvalue']['IT_SET_TAG_NAME'];
     }
     if (is_array($allvalue_multi)) {
         $conf_Wk['tvalue']['IT_SET_NAME_TEST'] = array_search($conf_Wk['tvalue']['IT_SET_NAME_TEST'], $allvalue_multi);
         $conf_Wk['tvalue']['IT_SET_NAME_LIMIT'] = array_search($conf_Wk['tvalue']['IT_SET_NAME_LIMIT'], $allvalue_multi);
     }
     if ($list_id != '') {
         $sql = "select %s,hardware_id from accountinfo where hardware_id in (%s)";
         $arg = array($field_acc, $list_id);
         $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg);
         while ($val = mysql_fetch_array($res)) {
             $fileid_show = array_merge($fileid_total, $fileid_show);
function interprete_accountinfo($list_fields, $tab_options)
{
    global $l;
    $info_tag = find_info_accountinfo('', 'COMPUTERS');
    if (is_array($info_tag)) {
        foreach ($info_tag as $key => $value) {
            $value['comment'] = $l->g(1210) . " " . $value['comment'];
            $info_value_tag = accountinfo_tab($value['id']);
            if (is_array($info_value_tag)) {
                $tab_options['REPLACE_VALUE'][$value['comment']] = $info_value_tag;
            }
            if ($value['name'] != 'TAG' and $info_value_tag) {
                $list_fields[$value['comment']] = 'a.fields_' . $value['id'];
            } elseif ($value['name'] == 'TAG') {
                $list_fields[$value['comment']] = 'a.TAG';
                $default_value[$value['comment']] = $value['comment'];
            }
        }
    }
    return array('TAB_OPTIONS' => $tab_options, 'LIST_FIELDS' => $list_fields, 'DEFAULT_VALUE' => $default_value);
}
    parse_str($protectedPost['ocs']['0'], $params);
    $protectedPost += $params;
    ob_start();
    $ajax = true;
} else {
    $ajax = false;
}
$form_name = 'taguser';
$table_name = $form_name;
$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
//BEGIN SHOW ACCOUNTINFO
require_once 'require/function_commun.php';
require_once 'require/function_admininfo.php';
$info_tag = find_info_accountinfo('1', 'COMPUTERS');
if (is_array($info_tag)) {
    foreach ($info_tag as $key => $value) {
        $info_value_tag = accountinfo_tab($value['id']);
        if (is_array($info_value_tag)) {
            $tab_options['REPLACE_VALUE'][$value['comment']] = $info_value_tag;
        }
    }
}
//END SHOW ACCOUNTINFO
printEnTete($l->g(616) . " " . $protectedGet["id"]);
if ($protectedPost['newtag'] != "") {
    if (isset($protectedPost['use_generic_0'])) {
        if (is_array($info_value_tag)) {
            $arg = str_replace(array("*", "?"), "", $protectedPost["newtag"]);
            $array_result = find_value_in_field(1, $arg);
$accountinfo_choise['COMPUTERS'] = $l->g(729);
$accountinfo_choise['SNMP'] = $l->g(1136);
if (!isset($protectedPost['onglet']) or $protectedPost['onglet'] == '') {
    $protectedPost['onglet'] = 1;
}
$form_name = 'admin_info';
$table_name = $form_name;
$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
$data_on[1] = $l->g(1059);
$data_on[2] = $l->g(1060);
//$yes_no=array($l->g(454),$l->g(455));
if (isset($protectedPost['MODIF']) and is_numeric($protectedPost['MODIF']) and !isset($protectedPost['Valid_modif'])) {
    $protectedPost['onglet'] = 2;
    $accountinfo_detail = find_info_accountinfo($protectedPost['MODIF']);
    $protectedPost['newfield'] = $accountinfo_detail[$protectedPost['MODIF']]['name'];
    $protectedPost['newlbl'] = $accountinfo_detail[$protectedPost['MODIF']]['comment'];
    $protectedPost['newtype'] = $accountinfo_detail[$protectedPost['MODIF']]['type'];
    $protectedPost['account_tab'] = $accountinfo_detail[$protectedPost['MODIF']]['id_tab'];
    $protectedPost['accountinfo'] = $accountinfo_detail[$protectedPost['MODIF']]['account_type'];
    $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']);