2011-08-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/db/oracle.php
        include/functions_config.php
        operation/agentes/estado_ultimopaquete.php
        godmode/agentes/agent_manager.php: Changed some queries in order to make
        them compatible with Oracle.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4748 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2011-08-17 09:59:35 +00:00
parent f4f8d74255
commit c072065905
5 changed files with 47 additions and 16 deletions

View File

@ -1,3 +1,11 @@
2011-08-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/db/oracle.php
include/functions_config.php
operation/agentes/estado_ultimopaquete.php
godmode/agentes/agent_manager.php: Changed some queries in order to make
them compatible with Oracle.
2011-08-17 Dario Rodriguez <dario.rodriguez@artica.es>
* pandoradb_data.sql, images/os_icons/so_vmware.png,

View File

@ -14,6 +14,9 @@
// GNU General Public License for more details.
if (is_ajax ()) {
global $config;
$search_parents = (bool) get_parameter ('search_parents');
if ($search_parents) {
@ -23,7 +26,16 @@ if (is_ajax ()) {
$string = (string) get_parameter ('q'); /* q is what autocomplete plugin gives */
$filter = array ();
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
switch ($config['db_type']){
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%" OR comentarios LIKE "%'.$string.'%")';
break;
case "oracle":
$filter[] = '(upper(nombre) LIKE upper("%'.$string.'%") OR upper(direccion) LIKE upper("%'.$string.'%") OR upper(comentarios) LIKE upper("%'.$string.'%"))';
break;
}
$filter[] = 'id_agente != '.$id_agent;
$agents = agents_get_agents ($filter, array ('nombre', 'direccion'));

View File

@ -468,7 +468,6 @@ function oracle_db_get_value_filter ($field, $table, $filter, $where_join = 'AND
$sql = sprintf ("SELECT * FROM (SELECT %s FROM %s WHERE %s) WHERE rownum < 2",
$field, $table,
db_format_array_where_clause_sql ($filter, $where_join));
$result = db_get_all_rows_sql ($sql);
if ($result === false)
@ -574,8 +573,20 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
if ($i == 1) {
$query .= ' ( ';
}
if ($field == '1' AND $value == '1'){
$query .= sprintf("'%s' = '%s'", $field, $value);
if (is_numeric ($field)) {
if ($i < $max) {
$query .= ' '.$join.' ';
}
if ($i == $max) {
$query .= ' ) ';
}
$i++;
continue;
}
else if (is_numeric ($field)) {
/* User provide the exact operation to do */
$query .= $value;
@ -619,7 +630,7 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
else if ($value[0] == '%') {
$query .= sprintf ("%s LIKE '%s'", $field, $value);
}
else {
else{
$query .= sprintf ("%s = '%s'", $field, $value);
}
}
@ -632,7 +643,6 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
}
$i++;
}
return (! empty ($query) ? $prefix: '').$query.$limit.$group.$order;
}
@ -688,7 +698,6 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
* clause of an SQL sentence.
**/
function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
$fields = array ();
if (! is_array ($values) || empty($sql)) {

View File

@ -679,7 +679,8 @@ function config_check (){
}
// Get remote file dir.
$remote_config = db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'remote_config'");
$remote_config = db_get_value_filter('value', 'tconfig', array('token' => 'remote_config'));
if (defined ('PANDORA_ENTERPRISE')){
if (!is_writable ($remote_config)){
@ -711,8 +712,7 @@ function config_check (){
}
// Check database maintance
$db_maintance = db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'db_maintance'");
$db_maintance = db_get_value_filter ('value', 'tconfig', array('token' => 'db_maintance'));
$now = date("U");
// First action in order to know if it's a new installation or db maintenance never have been executed
@ -727,7 +727,7 @@ function config_check (){
$_SESSION["alert_msg"] .= __('Your database is not well maintained. Seems that it have more than 48hr without a proper maintance. Please review Pandora FMS documentation about how to execute this maintance process (pandora_db.pl) and enable it as soon as possible').'</h3>';
}
$fontpath = db_get_sql ("SELECT `value` FROM tconfig WHERE `token` = 'fontpath'");
$fontpath = db_get_value_filter('value', 'tconfig', array('token' => 'fontpath'));
if (($fontpath == "") OR (!file_exists ($fontpath))) {
$config["alert_cnt"]++;
$_SESSION["alert_msg"] .= '<h3 class="error">'.__("Default font doesnt exist").'</h3>';

View File

@ -342,6 +342,9 @@ foreach ($modules as $module) {
}
echo "</td>";
}
else{
echo "<td></td>";
}
if ($module["id_tipo_modulo"] == 24) { // Log4x
echo "<td class='".$tdcolor."f9' colspan='1'>&nbsp;</td>";
@ -394,7 +397,6 @@ foreach ($modules as $module) {
$link ="winopeng('operation/agentes/stat_win.php?type=$graph_type&period=3600&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=60','hour_".$win_handle."')";
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_h.png", true, array("border" => '0', "alt" => "")) . '</a>';
}