Example #1
0
 //find all package can be affected REST status
 $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)) {
    $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);
        } else {
            $arg = str_replace(array("*", "?"), array("%", "_"), $protectedPost["newtag"]);
            $sql = "select distinct TAG from accountinfo where TAG like '%s'";
    $ajax = false;
}
require_once 'require/function_computers.php';
require_once 'require/function_admininfo.php';
//intégration des fonctions liées à la recherche multicritère
require_once 'require/function_search.php';
//show mac address on the tab
$show_mac_addr = true;
$tab_options = $protectedPost;
$tab_options['form_name'] = "show_all";
$form_name = $tab_options['form_name'];
$tab_options['table_name'] = "list_show_all";
//$tab_options['DRAW']=$draw;
if (isset($protectedGet['filtre']) and !isset($protectedPost['FILTRE'])) {
    if (substr($protectedGet['filtre'], 0, 9) == "a.fields_") {
        $values_accountinfo = accountinfo_tab(substr($protectedGet['filtre'], 9));
        if (is_array($values_accountinfo)) {
            $protectedPost['FILTRE_VALUE'] = $values_accountinfo[$protectedGet['value']];
        }
    }
    $protectedPost['FILTRE'] = $protectedGet['filtre'];
    if (!isset($protectedPost['FILTRE_VALUE'])) {
        $protectedPost['FILTRE_VALUE'] = $protectedGet['value'];
    }
}
//del the selection
if ($protectedPost['DEL_ALL'] != '') {
    foreach ($protectedPost as $key => $value) {
        $checkbox = explode('check', $key);
        if (isset($checkbox[1])) {
            deleteDid($checkbox[1]);
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);
}