2013-05-16 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/module_manager_editor_common.php: disabled
	autocomplete for the field name to avoid javascript problems.
	
	Fixes: #2215
	
	* include/db/oracle.php, include/functions.php: improved the source
	code style.
	
	* include/functions_html.php: fixed the lost parameter $alt for
	the function html_print_input_text_extended from
	html_print_input_text.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8145 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-16 15:43:16 +00:00
parent c2ebd6ebdf
commit 3b2fc6cb88
5 changed files with 101 additions and 72 deletions

View File

@ -1,3 +1,17 @@
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor_common.php: disabled
autocomplete for the field name to avoid javascript problems.
Fixes: #2215
* include/db/oracle.php, include/functions.php: improved the source
code style.
* include/functions_html.php: fixed the lost parameter $alt for
the function html_print_input_text_extended from
html_print_input_text.
2013-05-16 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_networkmap.php, include/functions_reporting.php,

View File

@ -128,7 +128,10 @@ $table_simple->colspan[5][1] = 3;
$table_simple->colspan[6][1] = 3;
$table_simple->data[0][0] = __('Name');
$table_simple->data[0][1] = html_print_input_text ('name', io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
$table_simple->data[0][1] = html_print_input_text_extended ('name',
io_safe_output($name), 'text-'.$name, '', 45, 100, $disabledBecauseInPolicy, '', 'autocomplete="off"', true);
//$table_simple->data[0][1] = html_print_input_text ('name',
// io_safe_output($name), '', 45, 100, true, $disabledBecauseInPolicy);
if (!empty($id_agent_module) && isset($id_agente)) {
$table_simple->data[0][1] .= '&nbsp;<a href="index.php?sec=gagente&tab=module&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'&delete_module='.$id_agent_module.'"

View File

@ -67,16 +67,22 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null,
function oracle_db_get_value ($field, $table, $field_search = 1, $condition = 1, $search_history_db = false) {
if (is_int ($condition)) {
$sql = sprintf ("SELECT * FROM (SELECT %s FROM %s WHERE %s = %d) WHERE rownum < 2",
$field, $table, $field_search, $condition);
$sql = sprintf ("SELECT *
FROM (SELECT %s FROM %s WHERE %s = %d)
WHERE rownum < 2",
$field, $table, $field_search, $condition);
}
else if (is_float ($condition) || is_double ($condition)) {
$sql = sprintf ("SELECT * FROM (SELECT %s FROM %s WHERE %s = %f) WHERE rownum < 2",
$field, $table, $field_search, $condition);
$sql = sprintf ("SELECT *
FROM (SELECT %s FROM %s WHERE %s = %f)
WHERE rownum < 2",
$field, $table, $field_search, $condition);
}
else {
$sql = sprintf ("SELECT * FROM (SELECT %s FROM %s WHERE %s = '%s') WHERE rownum < 2",
$field, $table, $field_search, $condition);
$sql = sprintf ("SELECT *
FROM (SELECT %s FROM %s WHERE %s = '%s')
WHERE rownum < 2",
$field, $table, $field_search, $condition);
}
$result = db_get_all_rows_sql ($sql, $search_history_db);
@ -355,12 +361,17 @@ function oracle_db_get_all_rows_in_table($table, $order_field = "", $order = 'AS
if ($order_field != "") {
// Clob fields are not allowed in ORDER BY statements, they need cast to varchar2 datatype
$type = db_get_value_filter ('data_type', 'user_tab_columns', array ('table_name' => strtoupper($table), 'column_name' => strtoupper($order_field)), 'AND');
$type = db_get_value_filter ('data_type', 'user_tab_columns',
array ('table_name' => strtoupper($table), 'column_name' => strtoupper($order_field)), 'AND');
if ($type == 'CLOB') {
return db_get_all_rows_sql ('SELECT * FROM ' . $table . ' ORDER BY dbms_lob.substr(' . $order_field . ',4000,1) ' . $order);
return db_get_all_rows_sql ('SELECT *
FROM ' . $table . '
ORDER BY dbms_lob.substr(' . $order_field . ',4000,1) ' . $order);
}
else {
return db_get_all_rows_sql ('SELECT * FROM ' . $table . ' ORDER BY ' . $order_field . ' ' . $order);
return db_get_all_rows_sql ('SELECT *
FROM ' . $table . '
ORDER BY ' . $order_field . ' ' . $order);
}
}
else {
@ -405,7 +416,7 @@ function oracle_db_process_sql_insert($table, $values, $autocommit = true) {
else if (is_float ($value) || is_double ($value)) {
$values_str .= sprintf("%f", $value);
}
else if (substr($value,0,1) == '#'){
else if (substr($value,0,1) == '#') {
$values_str .= sprintf("%s", substr($value,1));
}
else {
@ -434,7 +445,7 @@ function oracle_db_process_sql_insert($table, $values, $autocommit = true) {
* @return string String cleaned.
*/
function oracle_escape_string_sql($string) {
return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string);
return str_replace(array('"', "'", '\\'), array('\\"', '\\\'', '\\\\'), $string);
}
/**
@ -951,7 +962,7 @@ function oracle_db_get_all_rows_filter ($table, $filter = array(), $fields = fal
$fields = '*';
}
elseif (is_array($fields)) {
$fields = implode(' , ', $fields) ;
$fields = implode(' , ', $fields);
}
elseif (!is_string($fields)) {
return false;
@ -1153,6 +1164,7 @@ function oracle_db_process_sql_update($table, $values, $where = false, $where_jo
}
}
$status = '';
return db_process_sql ($query, "affected_rows", '', true, $status, $autocommit);
}
@ -1242,7 +1254,7 @@ function oracle_db_process_sql_delete_temp ($table, $where, $where_join = 'AND')
function oracle_db_get_all_row_by_steps_sql($new = true, &$result, $sql = null) {
global $config;
if ($new == true){
if ($new == true) {
$result = oci_parse($config['dbconnection'], $sql);
oci_execute($result);
}
@ -1250,7 +1262,7 @@ function oracle_db_get_all_row_by_steps_sql($new = true, &$result, $sql = null)
$result_temp = array();
if ($row) {
foreach ($row as $key => $value){
foreach ($row as $key => $value) {
$column_type = oci_field_type($result, $key);
// Support for Clob field larger than 4000bytes
if ($column_type == 'CLOB') {
@ -1270,7 +1282,7 @@ function oracle_db_get_all_row_by_steps_sql($new = true, &$result, $sql = null)
}
}
if (!$row){
if (!$row) {
oci_free_statement($result);
}
@ -1366,7 +1378,8 @@ function oracle_get_system_time() {
function oracle_db_get_type_field_table($table, $field) {
global $config;
$query = oci_parse($config['dbconnection'], "SELECT * FROM " . $table . " WHERE rownum < 2");
$query = oci_parse($config['dbconnection'],
"SELECT * FROM " . $table . " WHERE rownum < 2");
oci_execute($query);
$type = oci_field_type($query, $field+1);
@ -1385,30 +1398,30 @@ function oracle_db_get_type_field_table($table, $field) {
* @return mixed Return an array/string of table fields or false if something goes wrong.
*/
function oracle_list_all_field_table($table_name, $return_mode = 'array'){
if (empty($table_name)){
if (empty($table_name)) {
return false;
}
$fields_info = db_get_all_rows_field_filter('user_tab_columns', 'table_name', strtoupper($table_name));
if (empty($fields_info)){
if (empty($fields_info)) {
return false;
}
$field_list = array();
foreach ($fields_info as $field){
if ($field['data_type'] == 'CLOB'){
foreach ($fields_info as $field) {
if ($field['data_type'] == 'CLOB') {
$new_field = 'dbms_lob.substr(' . $field['table_name'] . '.' . $field['column_name'] . ', 4000, 1) as ' . strtolower($field['column_name']);
$field_list[] = $new_field;
}
else{
else {
$field_list[] = strtolower($field['table_name'] . '.' . $field['column_name']);
}
}
// Return as comma separated string
if ($return_mode == 'string'){
if ($return_mode == 'string') {
return implode(',', $field_list);
}
// Return as array
else{
else {
return $field_list;
}
}
@ -1448,5 +1461,4 @@ function oracle_db_get_table_count($sql, $search_history_db = false) {
return $count;
}
?>

View File

@ -1723,19 +1723,19 @@ function copy_dir($src, $dst) {
* Looks for two or more carriage returns.
*/
function is_snapshot_data ($data){
function is_snapshot_data ($data) {
// TODO IDEA: In the future, we can set a variable in setup
// to define how many \n must have a snapshot to define it's
// a snapshot. I think two or three is a good value anyway.
// TODO IDEA: In the future, we can set a variable in setup
// to define how many \n must have a snapshot to define it's
// a snapshot. I think two or three is a good value anyway.
$temp = array();
$count = preg_match_all ("/\n/", $data, $temp);
$temp = array();
$count = preg_match_all ("/\n/", $data, $temp);
if ($count > 2)
return 1;
else
return 0;
if ($count > 2)
return 1;
else
return 0;
}
/**

View File

@ -927,7 +927,7 @@ function html_print_input_text ($name, $value, $alt = '', $size = 50, $maxlength
if ($size == 0)
$size = 10;
return html_print_input_text_extended ($name, $value, 'text-'.$name, '', $size, $maxlength, $disabled, '', '', $return);
return html_print_input_text_extended ($name, $value, 'text-'.$name, $alt, $size, $maxlength, $disabled, '', '', $return);
}
/**