2013-02-28 Miguel de Dios <miguel.dedios@artica.es>

* godmode/admin_access_logs.php: cleaned source code style.
	
	* include/functions_db.php: fixed the set ip in the function
	"db_pandora_audit".
	
	Fixes: #3606276




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7756 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-28 16:07:54 +00:00
parent 38cd6399c0
commit fafb8f2d5f
3 changed files with 34 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
* godmode/admin_access_logs.php: cleaned source code style.
* include/functions_db.php: fixed the set ip in the function
"db_pandora_audit".
Fixes: #3606276
2013-02-28 Miguel de Dios <miguel.dedios@artica.es> 2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
* operation/events/events.php: fixed the javascript to use the * operation/events/events.php: fixed the javascript to use the

View File

@ -44,16 +44,17 @@ echo '<tr><td class="datost">';
echo '<div style="float: left; width: 400px;">'; echo '<div style="float: left; width: 400px;">';
echo '<b>'.__('Filter').'</b><br><br>'; echo '<b>'.__('Filter').'</b><br><br>';
$rows = db_get_all_rows_sql ("SELECT DISTINCT(accion) FROM tsesion"); $rows = db_get_all_rows_sql ("SELECT DISTINCT(accion)
FROM tsesion");
if (empty ($rows)) { if (empty ($rows)) {
$rows = array (); $rows = array ();
} }
$actions = array (); $actions = array ();
foreach ($rows as $row) { foreach ($rows as $row) {
$actions[$row["accion"]] = $row["accion"]; $actions[$row["accion"]] = $row["accion"];
} }
echo '<form name="query_sel" method="post" action="index.php?sec=godmode&sec2=godmode/admin_access_logs">'; echo '<form name="query_sel" method="post" action="index.php?sec=glog&sec2=godmode/admin_access_logs">';
$table = null; $table = null;
$table->width = '100%'; $table->width = '100%';
$table->data = array(); $table->data = array();
@ -92,9 +93,9 @@ switch ($config['dbtype']) {
if ($user_filter != 'all') { if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = "%s"', $user_filter); $filter .= sprintf(' AND id_usuario = "%s"', $user_filter);
} }
$filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")'; $filter .= ' AND (accion LIKE "%' . $filter_text . '%" OR descripcion LIKE "%' . $filter_text . '%")';
if ($filter_ip != '') { if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip); $filter .= sprintf(' AND ip_origen LIKE "%s"', $filter_ip);
} }
@ -104,9 +105,9 @@ switch ($config['dbtype']) {
if ($user_filter != 'all') { if ($user_filter != 'all') {
$filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter); $filter .= sprintf(' AND id_usuario = \'%s\'', $user_filter);
} }
$filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')'; $filter .= ' AND (accion LIKE \'%' . $filter_text . '%\' OR descripcion LIKE \'%' . $filter_text . '%\')';
if ($filter_ip != '') { if ($filter_ip != '') {
$filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip); $filter .= sprintf(' AND ip_origen LIKE \'%s\'', $filter_ip);
} }
@ -135,16 +136,27 @@ ui_pagination ($count, $url);
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d, %d", $filter, $offset, $config["block_size"]); $sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC
LIMIT %d, %d", $filter, $offset, $config["block_size"]);
break; break;
case "postgresql": case "postgresql":
$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset); $sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC
LIMIT %d OFFSET %d", $filter, $config["block_size"], $offset);
break; break;
case "oracle": case "oracle":
$set = array(); $set = array();
$set['limit'] = $config["block_size"]; $set['limit'] = $config["block_size"];
$set['offset'] = $offset; $set['offset'] = $offset;
$sql = sprintf ("SELECT * FROM tsesion %s ORDER BY fecha DESC", $filter); $sql = sprintf ("SELECT *
FROM tsesion
%s
ORDER BY fecha DESC", $filter);
$result = oracle_recode_query ($sql, $set); $result = oracle_recode_query ($sql, $set);
break; break;
} }
@ -154,7 +166,7 @@ $result = db_get_all_rows_sql ($sql);
// Delete rnum row generated by oracle_recode_query() function // Delete rnum row generated by oracle_recode_query() function
if (($config["dbtype"] == 'oracle') && ($result !== false)){ if (($config["dbtype"] == 'oracle') && ($result !== false)){
for ($i=0; $i < count($result); $i++) { for ($i=0; $i < count($result); $i++) {
unset($result[$i]['rnum']); unset($result[$i]['rnum']);
} }
} }
@ -219,7 +231,7 @@ foreach ($result as $row) {
$table->rowclass[$iterator] = 'rowOdd'; $table->rowclass[$iterator] = 'rowOdd';
$rowPair = !$rowPair; $rowPair = !$rowPair;
$iterator++; $iterator++;
$data = array (); $data = array ();
switch ($config['dbtype']) { switch ($config['dbtype']) {
case "mysql": case "mysql":

View File

@ -118,7 +118,7 @@ function db_escape_string_sql($string) {
* *
* @return int Return the id of row in tsesion or false in case of fail. * @return int Return the id of row in tsesion or false in case of fail.
*/ */
function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = false, $info = '') { function db_pandora_audit($accion, $descripcion, $user_id = false, $ip = true, $info = '') {
global $config; global $config;
if ($ip !== false) { if ($ip !== false) {