$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'"; $res = mysql2_query_secure($sql, $_SESSION['OCS']["readServer"], $arg); while ($val_account_data = mysqli_fetch_array($res)) { $array_result[] = $val_account_data['TAG']; } } } else { $array_result[] = $protectedPost["newtag"]; } $tab_options['CACHE'] = 'RESET'; $sql = "insert into tags (tag,login) values ('%s','%s')"; $i = 0; while (isset($array_result[$i])) {
function filtre($tab_field, $form_name, $query, $arg = '', $arg_count = '') { global $protectedPost, $l; // if ($protectedPost['RAZ_FILTRE'] == "RAZ") // unset($protectedPost['FILTRE_VALUE'],$protectedPost['FILTRE']); if ($protectedPost['FILTRE_VALUE'] and $protectedPost['FILTRE']) { $temp_query = explode("GROUP BY", $query); if ($temp_query[0] == $query) { $temp_query = explode("group by", $query); } if (substr_count(mb_strtoupper($temp_query[0]), "WHERE") > 0) { $t_query = explode("WHERE", $temp_query[0]); if ($t_query[0] == $temp_query[0]) { $t_query = explode("where", $temp_query[0]); } $temp_query[0] = $t_query[0] . " WHERE (" . $t_query[1] . ") and "; } else { $temp_query[0] .= " where "; } if (substr($protectedPost['FILTRE'], 0, 2) == 'a.') { require_once 'require/function_admininfo.php'; $id_tag = explode('_', substr($protectedPost['FILTRE'], 2)); if (!isset($id_tag[1])) { $tag = 1; } else { $tag = $id_tag[1]; } $list_tag_id = find_value_in_field($tag, $protectedPost['FILTRE_VALUE']); } if ($list_tag_id) { $query_end = " in (" . implode(',', $list_tag_id) . ")"; } else { if ($arg == '') { $query_end = " like '%" . $protectedPost['FILTRE_VALUE'] . "%' "; } else { $query_end = " like '%s' "; array_push($arg, '%' . $protectedPost['FILTRE_VALUE'] . '%'); if (is_array($arg_count)) { array_push($arg_count, '%' . $protectedPost['FILTRE_VALUE'] . '%'); } else { $arg_count[] = '%' . $protectedPost['FILTRE_VALUE'] . '%'; } } } $query = $temp_query[0] . $protectedPost['FILTRE'] . $query_end; if (isset($temp_query[1])) { $query .= "GROUP BY " . $temp_query[1]; } } $view = show_modif($tab_field, 'FILTRE', 2); $view .= show_modif($protectedPost['FILTRE_VALUE'], 'FILTRE_VALUE', 0); echo $l->g(883) . ": " . $view . "<input type='submit' value='" . $l->g(1109) . "' name='SUB_FILTRE'><a href=# onclick='return pag(\"RAZ\",\"RAZ_FILTRE\",\"" . $form_name . "\");'><img src=image/delete-small.png></a></td></tr><tr><td align=center>"; echo "<input type=hidden name='RAZ_FILTRE' id='RAZ_FILTRE' value=''>"; return array('SQL' => $query, 'ARG' => $arg, 'ARG_COUNT' => $arg_count); }