2013-01-29 Miguel de Dios <miguel.dedios@artica.es>

* godmode/menu.php, include/db/oracle.php, include/db/mysql.php,
	include/functions_categories.php, include/functions_db.php,
	include/functions_menu.php: improved the code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7544 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-29 15:50:45 +00:00
parent e68a23b6cb
commit 752fb3ae6f
7 changed files with 55 additions and 47 deletions

View File

@ -1,3 +1,9 @@
2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/menu.php, include/db/oracle.php, include/db/mysql.php,
include/functions_categories.php, include/functions_db.php,
include/functions_menu.php: improved the code style.
2013-01-29 Miguel de Dios <miguel.dedios@artica.es> 2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.wizard.php, * godmode/reporting/visual_console_builder.wizard.php,

View File

@ -179,7 +179,9 @@ function mysql_db_get_row ($table, $field_search, $condition, $fields = false) {
*/ */
function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') { function mysql_db_get_all_rows_in_table($table, $order_field = "", $order = 'ASC') {
if ($order_field != "") { if ($order_field != "") {
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 { else {
return db_get_all_rows_sql ("SELECT * FROM `".$table."`"); return db_get_all_rows_sql ("SELECT * FROM `".$table."`");

View File

@ -229,14 +229,14 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
$start = microtime (true); $start = microtime (true);
if ($dbconnection !== '') { if ($dbconnection !== '') {
if ($type[0] == 'INSERT'){ if ($type[0] == 'INSERT') {
$query = oci_parse($dbconnection, 'begin insert_id(:table_name, :sql, :out); end;'); $query = oci_parse($dbconnection, 'begin insert_id(:table_name, :sql, :out); end;');
} }
// Prevent execution of insert_id stored procedure // Prevent execution of insert_id stored procedure
else if ($type[0] == '/INSERT'){ else if ($type[0] == '/INSERT') {
$query = oci_parse($dbconnection, substr($sql,1)); $query = oci_parse($dbconnection, substr($sql,1));
} }
else{ else {
$query = oci_parse($dbconnection, $sql); $query = oci_parse($dbconnection, $sql);
} }
} }
@ -259,10 +259,10 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
oci_bind_by_name($query,":out", $id, 32); oci_bind_by_name($query,":out", $id, 32);
} }
if (!$autocommit){ if (!$autocommit) {
$result = oci_execute($query, OCI_NO_AUTO_COMMIT); $result = oci_execute($query, OCI_NO_AUTO_COMMIT);
} }
else{ else {
$result = oci_execute($query); $result = oci_execute($query);
} }
$time = microtime (true) - $start; $time = microtime (true) - $start;
@ -295,7 +295,7 @@ function oracle_db_process_sql($sql, $rettype = "affected_rows", $dbconnection =
$result = $rows; $result = $rows;
} }
db_add_database_debug_trace ($sql, $result, $rows, db_add_database_debug_trace ($sql, $result, $rows,
array ('time' => $time)); array ('time' => $time));
return $result; return $result;
} }
@ -824,12 +824,12 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
} }
$result = $pre_query.$sql.$query.$limit.$group.$order.$post_query; $result = $pre_query.$sql.$query.$limit.$group.$order.$post_query;
if ($return){ if ($return) {
return $result; return $result;
} }
else{ else {
$result = oracle_db_process_sql($result); $result = oracle_db_process_sql($result);
if ($result !== false){ if ($result !== false) {
for ($i=0; $i < count($result); $i++) { for ($i=0; $i < count($result); $i++) {
unset($result[$i]['RNUM']); unset($result[$i]['RNUM']);
} }

View File

@ -27,7 +27,7 @@
* *
* @return bool True or false if something goes wrong. * @return bool True or false if something goes wrong.
*/ */
function categories_delete_category ($id_category){ function categories_delete_category ($id_category) {
// Change the elements of this category to "without category" // Change the elements of this category to "without category"
db_process_sql_update('tagente_modulo', array('id_category' => 0), array('id_category' => $id_category)); db_process_sql_update('tagente_modulo', array('id_category' => 0), array('id_category' => $id_category));
db_process_sql_update('tnetwork_component', array('id_category' => 0), array('id_category' => $id_category)); db_process_sql_update('tnetwork_component', array('id_category' => 0), array('id_category' => $id_category));
@ -44,7 +44,7 @@ function categories_delete_category ($id_category){
* *
* @return mixed Int with the tag's count. * @return mixed Int with the tag's count.
*/ */
function categories_get_category_count(){ function categories_get_category_count() {
return (int)db_get_value('count(*)', 'tcategory'); return (int)db_get_value('count(*)', 'tcategory');
} }

View File

@ -148,7 +148,7 @@ function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = false,
$accion = io_safe_input($accion); $accion = io_safe_input($accion);
$descripcion = io_safe_input($descripcion); $descripcion = io_safe_input($descripcion);
switch ($config['dbtype']){ switch ($config['dbtype']) {
case "mysql": case "mysql":
case "postgresql": case "postgresql":
$values = array('id_usuario' => $id, $values = array('id_usuario' => $id,