Changeset 6721

Show
Ignore:
Timestamp:
10/06/08 09:33:44 (2 months ago)
Author:
shotamchay
Message:

development progress on action log

Location:
trunk/centreon/www/include
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/centreon/www/include/configuration/configObject/host/DB-Func.php

    r6649 r6721  
    8383         
    8484        function enableHostInDB ($host_id = null, $host_arr = array())  { 
    85                 global $pearDB; 
     85                global $pearDB, $oreon; 
    8686                 
    8787                if (!$host_id && !count($host_arr))  
     
    9494                        if (PEAR::isError($DBRESULT)) 
    9595                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     96                                 
     97                        $DBRESULT2 =& $pearDB->query("SELECT host_name FROM `host` WHERE host_id = '".$key."' LIMIT 1"); 
     98                        if (PEAR::isError($DBRESULT2)) 
     99                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     100                        $row = $DBRESULT2->fetchRow();  
     101                        $oreon->CentreonLogAction->insertLog("host", $key, $row['host_name'], "enable"); 
    96102                } 
    97103        } 
    98104         
    99105        function disableHostInDB ($host_id = null, $host_arr = array()) { 
    100                 global $pearDB; 
     106                global $pearDB, $oreon; 
    101107                if (!$host_id && !count($host_arr))  
    102108                        return; 
     
    108114                        if (PEAR::isError($DBRESULT)) 
    109115                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     116                        $DBRESULT2 =& $pearDB->query("SELECT host_name FROM `host` WHERE host_id = '".$key."' LIMIT 1"); 
     117                        if (PEAR::isError($DBRESULT2)) 
     118                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     119                        $row = $DBRESULT2->fetchRow();  
     120                        $oreon->CentreonLogAction->insertLog("host", $key, $row['host_name'], "disable"); 
    110121                } 
    111122        } 
     
    119130                        if (PEAR::isError($DBRESULT)) 
    120131                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     132                         
     133                        $DBRESULT3 =& $pearDB->query("SELECT host_name FROM `host` WHERE `host_id` = '".$key."' LIMIT 1"); 
     134                        if (PEAR::isError($DBRESULT3)) 
     135                                print "DB Error : ".$DBRESULT3->getDebugInfo()."<br />"; 
     136                        $hostname = $DBRESULT3->fetchRow(); 
     137                         
    121138                        while ($row =& $DBRESULT->fetchRow()) 
    122139                                if ($row["nbr"] == 1)   { 
     140                                        $DBRESULT4 =& $pearDB->query("SELECT service_description FROM `service` WHERE `service_id` = '".$row["service_service_id"]."' LIMIT 1"); 
     141                                        if (PEAR::isError($DBRESULT4)) 
     142                                                print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 
     143                                        $svcname = $DBRESULT4->fetchRow(); 
     144                                         
    123145                                        $DBRESULT2 =& $pearDB->query("DELETE FROM service WHERE service_id = '".$row["service_service_id"]."'"); 
    124146                                        if (PEAR::isError($DBRESULT2)) 
    125147                                                print "DB Error : ".$DBRESULT2->getDebugInfo()."<br />"; 
     148                                        $oreon->CentreonLogAction->insertLog("service", $row["service_service_id"], $hostname['host_name']."/".$svcname["service_description"], "d"); 
    126149                                } 
     150                         
     151                         
    127152                        $DBRESULT =& $pearDB->query("DELETE FROM host WHERE host_id = '".$key."'"); 
    128153                        if ($oreon->user->get_version() >= 3) { 
     
    131156                                $DBRESULT =& $pearDB->query("DELETE FROM contact_host_relation WHERE host_host_id = '".$key."'"); 
    132157                        } 
     158                        $oreon->CentreonLogAction->insertLog("host", $key, $hostname['host_name'], "d"); 
    133159                        if (PEAR::isError($DBRESULT)) 
    134160                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     
    153179                                        $key2 == "host_name" ? ($host_name = $value2 = $value2."_".$i) : null; 
    154180                                        $val ? $val .= ($value2!=NULL?(", '".$value2."'"):", NULL") : $val .= ($value2!=NULL?("'".$value2."'"):"NULL"); 
     181                                        if ($key2 != "host_id") 
     182                                                $fields[$key2] = $value2; 
     183                                        $fields["host_name"] = $host_name; 
    155184                                } 
    156185                                if (testHostExistence($host_name))      { 
     
    184213                                                if (PEAR::isError($DBRESULT)) 
    185214                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     215                                                $fields["host_parents"] = ""; 
    186216                                                while($host =& $DBRESULT->fetchRow()){ 
    187217                                                        $DBRESULT1 =& $pearDB->query("INSERT INTO host_hostparent_relation VALUES ('', '".$host["host_parent_hp_id"]."', '".$maxId["MAX(host_id)"]."')");        
    188218                                                        if (PEAR::isError($DBRESULT1)) 
    189219                                                                print "DB Error : ".$DBRESULT1->getDebugInfo()."<br />"; 
     220                                                        $fields["host_parents"] .= $host["host_parent_hp_id"] . ","; 
    190221                                                } 
     222                                                $fields["host_parents"] = trim($fields["host_parents"], ","); 
    191223                                                # We need to duplicate the entire Service and not only create a new relation for it in the DB / Need Service functions 
    192224                                                if (file_exists($path."../service/DB-Func.php")) 
     
    234266                                                if (PEAR::isError($DBRESULT)) 
    235267                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     268                                                $fields["host_cgs"] = ""; 
    236269                                                while($Cg =& $DBRESULT->fetchRow()){ 
    237270                                                        $DBRESULT1 =& $pearDB->query("INSERT INTO contactgroup_host_relation VALUES ('', '".$maxId["MAX(host_id)"]."', '".$Cg["contactgroup_cg_id"]."')"); 
    238271                                                        if (PEAR::isError($DBRESULT1)) 
    239272                                                                print "DB Error : ".$DBRESULT1->getDebugInfo()."<br />"; 
     273                                                        $fields["host_cgs"] .= $Cg["contactgroup_cg_id"] . ","; 
    240274                                                } 
     275                                                $fields["host_cgs"] = trim($fields["host_cgs"], ","); 
    241276                                                $DBRESULT =& $pearDB->query("SELECT DISTINCT hostgroup_hg_id FROM hostgroup_relation WHERE host_host_id = '".$key."'"); 
    242277                                                if (PEAR::isError($DBRESULT)) 
     
    254289                                                        $ehi["host_host_id"] = $maxId["MAX(host_id)"]; 
    255290                                                        $ehi["ehi_id"] = NULL; 
    256                                                         foreach ($ehi as $key2=>$value2) 
     291                                                        foreach ($ehi as $key2=>$value2) { 
    257292                                                                $val ? $val .= ($value2!=NULL?(", '".$value2."'"):", NULL") : $val .= ($value2!=NULL?("'".$value2."'"):"NULL"); 
     293                                                                if ($key2 != "ehi_id") 
     294                                                                        $fields[$key2] = $value2; 
     295                                                        } 
    258296                                                        $val ? $rq = "INSERT INTO extended_host_information VALUES (".$val.")" : $rq = null; 
    259297                                                        $DBRESULT2 =& $pearDB->query($rq); 
     
    264302                                                if (PEAR::isError($DBRESULT)) 
    265303                                                        print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     304                                                $fields["nagios_server_id"] = ""; 
    266305                                                while($Hg =& $DBRESULT->fetchRow()){ 
    267306                                                        $DBRESULT1 =& $pearDB->query("INSERT INTO ns_host_relation VALUES ('".$Hg["nagios_server_id"]."', '".$maxId["MAX(host_id)"]."')"); 
    268307                                                        if (PEAR::isError($DBRESULT1)) 
    269308                                                                print "DB Error : ".$DBRESULT1->getDebugInfo()."<br />"; 
     309                                                        $fields["nagios_server_id"] .= $Hg["nagios_server_id"] . ","; 
    270310                                                } 
     311                                                $fields["nagios_server_id"] = trim($fields["nagios_server_id"], ","); 
    271312                                                /* 
    272313                                                 *  multiple templates & on demand macros 
     
    281322                                                        if (PEAR::isError($DBRESULT3)) 
    282323                                                                print "DB Error : ".$DBRESULT3->getDebugInfo()."<br />"; 
     324                                                        $multiTP_logStr = ""; 
    283325                                                        while ($hst =& $DBRESULT3->fetchRow()) { 
    284326                                                                $mTpRq2 = "INSERT INTO `host_template_relation` (`host_host_id`, `host_tpl_id`, `order`) VALUES" . 
    285327                                                                                        "('".$maxId["MAX(host_id)"]."', '".$hst['host_tpl_id']."', '". $hst['order'] ."')"; 
    286328                                                                $DBRESULT4 =& $pearDB->query($mTpRq2); 
     329                                                                $multiTP_logStr .= $hst['host_tpl_id'] . ","; 
    287330                                                                if (PEAR::isError($DBRESULT4)) 
    288331                                                                        print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 
    289332                                                        } 
     333                                                        $multiTP_logStr = trim($multiTP_logStr, ","); 
     334                                                        $fields["templates"] = $multiTP_logStr; 
    290335                                                        /* 
    291336                                                         * on demand macros 
     
    302347                                                                if (PEAR::isError($DBRESULT4)) 
    303348                                                                        print "DB Error : ".$DBRESULT4->getDebugInfo()."<br />"; 
     349                                                                $fields["_".$macName."_"] = $hst['host_macro_value']; 
    304350                                                        } 
    305351                                                 } 
     352                                                 $oreon->CentreonLogAction->insertLog("host", $maxId["MAX(host_id)"], $host_name, "a", $fields); 
    306353                                        } 
    307354                                } 
     
    513560                **  Insert multiple templates 
    514561                */ 
     562                $multiTP_logStr = ""; 
    515563                if (isset($ret["use"]) && $ret["use"]){ 
    516564                        $already_stored = array(); 
     
    525573                                        if (PEAR::isError($DBRESULT)) 
    526574                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     575                                        $multiTP_logStr .= $tplId . ","; 
    527576                                        $j++; 
    528577                                        $already_stored[$tplId] = 1; 
     
    539588                                        if (PEAR::isError($DBRESULT)) 
    540589                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     590                                        $multiTP_logStr .= $_POST[$tpSelect] . ","; 
    541591                                        $j++; 
    542592                                        $already_stored[$_POST[$tpSelect]] = 1; 
     
    544594                        } 
    545595                } 
     596                if ($multiTP_logStr != "") 
     597                        $multiTP_logStr = trim($multiTP_logStr, ","); 
    546598                 
    547599                /* 
     
    560612                                        $DBRESULT =& $pearDB->query($rq); 
    561613                                        if (PEAR::isError($DBRESULT)) 
    562                                                 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />";                          
     614                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     615                                        $fields["_".$_POST[$macInput]."_"] = $_POST[$macValue];  
    563616                                        $already_stored[$_POST[$macInput]] = 1; 
    564617                                }                        
     
    582635                } 
    583636                # 
     637                /* 
     638                 *  Logs 
     639                 */ 
     640                $fields["command_command_id"] = $ret["command_command_id"]; 
     641                $fields["command_command_id_arg1"] = $ret["command_command_id_arg1"]; 
     642                $fields["timeperiod_tp_id"] = $ret["timeperiod_tp_id"]; 
     643                $fields["timeperiod_tp_id2"] = $ret["timeperiod_tp_id2"]; 
     644                $fields["command_command_id2"] = $ret["command_command_id2"]; 
     645                $fields["command_command_id_arg2"] = $ret["command_command_id_arg2"]; 
     646                $fields["host_name"] = htmlentities($ret["host_name"], ENT_QUOTES); 
     647                $fields["host_alias"] = htmlentities($ret["host_alias"], ENT_QUOTES); 
     648                $fields["host_address"] = htmlentities($ret["host_address"], ENT_QUOTES); 
     649                $fields["host_max_check_attempts"] = $ret["host_max_check_attempts"]; 
     650                $fields["host_check_interval"] = $ret["host_check_interval"]; 
     651                $fields["host_active_checks_enabled"] = $ret["host_active_checks_enabled"]["host_active_checks_enabled"]; 
     652                $fields["host_passive_checks_enabled"] = $ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]; 
     653                $fields["host_checks_enabled"] = $ret["host_checks_enabled"]["host_checks_enabled"]; 
     654                $fields["host_obsess_over_host"] = $ret["host_obsess_over_host"]["host_obsess_over_host"]; 
     655                $fields["host_check_freshness"] = $ret["host_check_freshness"]["host_check_freshness"]; 
     656                $fields["host_freshness_threshold"] = $ret["host_freshness_threshold"]; 
     657                $fields["host_event_handler_enabled"] = $ret["host_event_handler_enabled"]["host_event_handler_enabled"]; 
     658                $fields["host_low_flap_threshold"] = $ret["host_low_flap_threshold"]; 
     659                $fields["host_high_flap_threshold"] = $ret["host_high_flap_threshold"]; 
     660                $fields["host_flap_detection_enabled"] = $ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]; 
     661                $fields["host_process_perf_data"] = $ret["host_process_perf_data"]["host_process_perf_data"]; 
     662                $fields["host_retain_status_information"] = $ret["host_retain_status_information"]["host_retain_status_information"]; 
     663                $fields["host_retain_nonstatus_information"] = $ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]; 
     664                $fields["host_notification_interval"] = $ret["host_notification_interval"]; 
     665                $fields["host_notifOpts"] = ""; 
     666                if (isset($ret["host_notifOpts"])) 
     667                        $fields["host_notifOpts"] = implode(",", $ret["host_notifOpts"]); 
     668                $fields["host_notifications_enabled"] = $ret["host_notifications_enabled"]["host_notifications_enabled"]; 
     669                $fields["host_first_notification_delay"] = $ret["host_first_notification_delay"]; 
     670                $fields["host_stalOpts"] = ""; 
     671                if (isset($ret["host_stalOpts"])) 
     672                        $fields["host_stalOpts"] = implode(",", $ret["host_stalOpts"]); 
     673                $fields["host_snmp_community"] = htmlentities($ret["host_snmp_community"], ENT_QUOTES); 
     674                $fields["host_snmp_version"] = htmlentities($ret["host_snmp_version"], ENT_QUOTES); 
     675                $fields["host_location"] = htmlentities($ret["host_location"], ENT_QUOTES); 
     676                $fields["host_comment"] = htmlentities($ret["host_comment"], ENT_QUOTES); 
     677                $fields["host_register"] = $ret["host_register"]["host_register"]; 
     678                $fields["host_activate"] = $ret["host_activate"]["host_activate"]; 
     679                $fields["templates"] = $multiTP_logStr; 
     680                $fields["ehi_notes"] = htmlentities($ret["ehi_notes"], ENT_QUOTES); 
     681                $fields["ehi_notes_url"] = htmlentities($ret["ehi_notes_url"], ENT_QUOTES); 
     682                $fields["ehi_action_url"] = htmlentities($ret["ehi_action_url"], ENT_QUOTES); 
     683                $fields["ehi_icon_image"] = htmlentities($ret["ehi_icon_image"], ENT_QUOTES); 
     684                $fields["ehi_icon_image_alt"] = htmlentities($ret["ehi_icon_image_alt"], ENT_QUOTES); 
     685                $fields["ehi_vrml_image"] = htmlentities($ret["ehi_vrml_image"], ENT_QUOTES); 
     686                $fields["ehi_statusmap_image"] = htmlentities($ret["ehi_statusmap_image"], ENT_QUOTES); 
     687                $fields["ehi_2d_coords"] = htmlentities($ret["ehi_2d_coords"], ENT_QUOTES); 
     688                $fields["ehi_3d_coords"] = htmlentities($ret["ehi_3d_coords"], ENT_QUOTES); 
     689                $fields["host_parents"] = ""; 
     690                if (isset($ret["host_parents"])) 
     691                        $fields["host_parents"] = implode(",", $ret["host_parents"]); 
     692                $fields["host_childs"] = ""; 
     693                if (isset($ret["host_childs"])) 
     694                        $fields["host_childs"] = implode(",", $ret["host_childs"]); 
     695                $fields["host_cgs"] = ""; 
     696                if (isset($ret["host_cgs"])) 
     697                        $fields["host_cgs"] = implode(",", $ret["host_cgs"]); 
     698                $fields["host_cs"] = ""; 
     699                if (isset($ret["host_cs"])) 
     700                        $fields["host_cs"] = implode(",", $ret["host_cs"]); 
     701                $fields["host_svTpls"] = ""; 
     702                if (isset($ret["host_svTpls"])) 
     703                        $fields["host_svTpls"] = implode(",", $ret["host_svTpls"]); 
     704                $fields["nagios_server_id"] = ""; 
     705                if (isset($ret["nagios_server_id"])) 
     706                        $fields["nagios_server_id"] = $ret["nagios_server_id"]; 
     707                $oreon->CentreonLogAction->insertLog("host", $host_id["MAX(host_id)"], htmlentities($ret["host_name"], ENT_QUOTES), "a", $fields); 
    584708                return ($host_id["MAX(host_id)"]); 
    585709        }        
     
    741865        function updateHost($host_id = null, $from_MC = false)  { 
    742866                if (!$host_id) return; 
    743                 global $form, $pearDB; 
     867                global $form, $pearDB, $oreon; 
    744868                $ret = array(); 
    745869                $ret = $form->getSubmitValues();                 
     
    8841008                        if (PEAR::isError($DBRESULT)) 
    8851009                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     1010                        $multiTP_logStr = ""; 
    8861011                        for ($i=0, $j = 1;$i <= $_POST['nbOfSelect']; $i++){ 
    8871012                                $tpSelect = "tpSelect_" . $i; 
     
    8921017                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
    8931018                                        $j++; 
     1019                                        $multiTP_logStr .= $_POST[$tpSelect] . ","; 
    8941020                                        $already_stored[$_POST[$tpSelect]] = 1; 
    8951021                                }                        
    8961022                        } 
     1023                        $multiTP_logStr = trim($multiTP_logStr, ","); 
    8971024                } 
    8981025                /* 
     
    9121039                                        $DBRESULT =& $pearDB->query($rq); 
    9131040                                        if (PEAR::isError($DBRESULT)) 
    914                                                 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />";                          
     1041                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     1042                                        $fields["_".$_POST[$macInput]."_"] = $_POST[$macValue];  
    9151043                                        $already_stored[$_POST[$macInput]] = 1; 
    9161044                                }                        
    9171045                        } 
    9181046                } 
     1047                 
     1048                /* 
     1049                 *  Logs 
     1050                 */ 
     1051                $fields["command_command_id"] = $ret["command_command_id"]; 
     1052                $fields["command_command_id_arg1"] = $ret["command_command_id_arg1"]; 
     1053                $fields["timeperiod_tp_id"] = $ret["timeperiod_tp_id"]; 
     1054                $fields["timeperiod_tp_id2"] = $ret["timeperiod_tp_id2"]; 
     1055                $fields["command_command_id2"] = $ret["command_command_id2"]; 
     1056                $fields["command_command_id_arg2"] = $ret["command_command_id_arg2"]; 
     1057                $fields["host_name"] = htmlentities($ret["host_name"], ENT_QUOTES); 
     1058                $fields["host_alias"] = htmlentities($ret["host_alias"], ENT_QUOTES); 
     1059                $fields["host_address"] = htmlentities($ret["host_address"], ENT_QUOTES); 
     1060                $fields["host_max_check_attempts"] = $ret["host_max_check_attempts"]; 
     1061                $fields["host_check_interval"] = $ret["host_check_interval"]; 
     1062                $fields["host_active_checks_enabled"] = $ret["host_active_checks_enabled"]["host_active_checks_enabled"]; 
     1063                $fields["host_passive_checks_enabled"] = $ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]; 
     1064                $fields["host_checks_enabled"] = $ret["host_checks_enabled"]["host_checks_enabled"]; 
     1065                $fields["host_obsess_over_host"] = $ret["host_obsess_over_host"]["host_obsess_over_host"]; 
     1066                $fields["host_check_freshness"] = $ret["host_check_freshness"]["host_check_freshness"]; 
     1067                $fields["host_freshness_threshold"] = $ret["host_freshness_threshold"]; 
     1068                $fields["host_event_handler_enabled"] = $ret["host_event_handler_enabled"]["host_event_handler_enabled"]; 
     1069                $fields["host_low_flap_threshold"] = $ret["host_low_flap_threshold"]; 
     1070                $fields["host_high_flap_threshold"] = $ret["host_high_flap_threshold"]; 
     1071                $fields["host_flap_detection_enabled"] = $ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]; 
     1072                $fields["host_process_perf_data"] = $ret["host_process_perf_data"]["host_process_perf_data"]; 
     1073                $fields["host_retain_status_information"] = $ret["host_retain_status_information"]["host_retain_status_information"]; 
     1074                $fields["host_retain_nonstatus_information"] = $ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]; 
     1075                $fields["host_notification_interval"] = $ret["host_notification_interval"]; 
     1076                $fields["host_notifOpts"] = ""; 
     1077                if (isset($ret["host_notifOpts"])) 
     1078                        $fields["host_notifOpts"] = implode(",", $ret["host_notifOpts"]); 
     1079                $fields["host_notifications_enabled"] = $ret["host_notifications_enabled"]["host_notifications_enabled"]; 
     1080                $fields["host_first_notification_delay"] = $ret["host_first_notification_delay"]; 
     1081                $fields["host_stalOpts"] = ""; 
     1082                if (isset($ret["host_stalOpts"])) 
     1083                        $fields["host_stalOpts"] = implode(",", $ret["host_stalOpts"]); 
     1084                $fields["host_snmp_community"] = htmlentities($ret["host_snmp_community"], ENT_QUOTES); 
     1085                $fields["host_snmp_version"] = htmlentities($ret["host_snmp_version"], ENT_QUOTES); 
     1086                $fields["host_location"] = htmlentities($ret["host_location"], ENT_QUOTES); 
     1087                $fields["host_comment"] = htmlentities($ret["host_comment"], ENT_QUOTES); 
     1088                $fields["host_register"] = $ret["host_register"]["host_register"]; 
     1089                $fields["host_activate"] = $ret["host_activate"]["host_activate"]; 
     1090                $fields["templates"] = $multiTP_logStr; 
     1091                $fields["ehi_notes"] = htmlentities($ret["ehi_notes"], ENT_QUOTES); 
     1092                $fields["ehi_notes_url"] = htmlentities($ret["ehi_notes_url"], ENT_QUOTES); 
     1093                $fields["ehi_action_url"] = htmlentities($ret["ehi_action_url"], ENT_QUOTES); 
     1094                $fields["ehi_icon_image"] = htmlentities($ret["ehi_icon_image"], ENT_QUOTES); 
     1095                $fields["ehi_icon_image_alt"] = htmlentities($ret["ehi_icon_image_alt"], ENT_QUOTES); 
     1096                $fields["ehi_vrml_image"] = htmlentities($ret["ehi_vrml_image"], ENT_QUOTES); 
     1097                $fields["ehi_statusmap_image"] = htmlentities($ret["ehi_statusmap_image"], ENT_QUOTES); 
     1098                $fields["ehi_2d_coords"] = htmlentities($ret["ehi_2d_coords"], ENT_QUOTES); 
     1099                $fields["ehi_3d_coords"] = htmlentities($ret["ehi_3d_coords"], ENT_QUOTES); 
     1100                $fields["host_parents"] = ""; 
     1101                if (isset($ret["host_parents"])) 
     1102                        $fields["host_parents"] = implode(",", $ret["host_parents"]); 
     1103                $fields["host_childs"] = ""; 
     1104                if (isset($ret["host_childs"])) 
     1105                        $fields["host_childs"] = implode(",", $ret["host_childs"]); 
     1106                $fields["host_cgs"] = ""; 
     1107                if (isset($ret["host_cgs"])) 
     1108                        $fields["host_cgs"] = implode(",", $ret["host_cgs"]); 
     1109                $fields["host_cs"] = ""; 
     1110                if (isset($ret["host_cs"])) 
     1111                        $fields["host_cs"] = implode(",", $ret["host_cs"]); 
     1112                $fields["host_svTpls"] = ""; 
     1113                if (isset($ret["host_svTpls"])) 
     1114                        $fields["host_svTpls"] = implode(",", $ret["host_svTpls"]); 
     1115                $fields["nagios_server_id"] = ""; 
     1116                if (isset($ret["nagios_server_id"])) 
     1117                        $fields["nagios_server_id"] = $ret["nagios_server_id"]; 
     1118                $oreon->CentreonLogAction->insertLog("host", $host_id, htmlentities($ret["host_name"], ENT_QUOTES), "c", $fields); 
    9191119        } 
    9201120         
    9211121        function updateHost_MC($host_id = null) { 
    9221122                if (!$host_id) return; 
    923                 global $form, $pearDB; 
     1123                global $form, $pearDB, $oreon; 
    9241124                $ret = array(); 
    9251125                $ret = $form->getSubmitValues();                 
     
    9511151                 
    9521152                $rq = "UPDATE host SET "; 
    953                 if (isset($ret["host_template_model_htm_id"]) && $ret["host_template_model_htm_id"] != NULL) $rq .= "host_template_model_htm_id = '".$ret["host_template_model_htm_id"]."', "; 
    954                 if (isset($ret["command_command_id"]) && $ret["command_command_id"] != NULL) $rq .= "command_command_id = '".$ret["command_command_id"]."', ";           
    955                 if (isset($ret["command_command_id_arg1"]) && $ret["command_command_id_arg1"] != NULL) $rq .= "command_command_id_arg1 = '".$ret["command_command_id_arg1"]."', "; 
    956                 if (isset($ret["timeperiod_tp_id"]) && $ret["timeperiod_tp_id"] != NULL) $rq .= "timeperiod_tp_id = '".$ret["timeperiod_tp_id"]."', "; 
    957                 if (isset($ret["timeperiod_tp_id2"]) && $ret["timeperiod_tp_id2"] != NULL) $rq .= "timeperiod_tp_id2 = '".$ret["timeperiod_tp_id2"]."', "; 
    958                 if (isset($ret["command_command_id2"]) && $ret["command_command_id2"] != NULL) $rq .= "command_command_id2 = '".$ret["command_command_id2"]."', "; 
    959                 if (isset($ret["command_command_id_arg2"]) && $ret["command_command_id_arg2"] != NULL) $rq .= "command_command_id_arg2 = '".$ret["command_command_id_arg2"]."', "; 
    960                 if (isset($ret["host_address"]) && $ret["host_address"] != NULL) $rq .= "host_address = '".htmlentities($ret["host_address"], ENT_QUOTES)."', "; 
    961                 if (isset($ret["host_max_check_attempts"]) && $ret["host_max_check_attempts"] != NULL) $rq .= "host_max_check_attempts = '".$ret["host_max_check_attempts"]."', " ; 
    962                 if (isset($ret["host_check_interval"]) && $ret["host_check_interval"]!= NULL) $rq .= "host_check_interval = '".$ret["host_check_interval"]."', "; 
    963                 if (isset($ret["host_active_checks_enabled"]["host_active_checks_enabled"])) $rq .= "host_active_checks_enabled = '".$ret["host_active_checks_enabled"]["host_active_checks_enabled"]."', "; 
    964                 if (isset($ret["host_passive_checks_enabled"]["host_passive_checks_enabled"])) $rq .= "host_passive_checks_enabled = '".$ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]."', "; 
    965                 if (isset($ret["host_checks_enabled"]["host_checks_enabled"])) $rq .= "host_checks_enabled = '".$ret["host_checks_enabled"]["host_checks_enabled"]."', "; 
    966                 if (isset($ret["host_obsess_over_host"]["host_obsess_over_host"])) $rq .= "host_obsess_over_host = '".$ret["host_obsess_over_host"]["host_obsess_over_host"]."', "; 
    967                 if (isset($ret["host_check_freshness"]["host_check_freshness"])) $rq .= "host_check_freshness = '".$ret["host_check_freshness"]["host_check_freshness"]."', "; 
    968                 if (isset($ret["host_freshness_threshold"]) && $ret["host_freshness_threshold"] != NULL) $rq .= "host_freshness_threshold = '".$ret["host_freshness_threshold"]."', "; 
    969                 if (isset($ret["host_event_handler_enabled"]["host_event_handler_enabled"])) $rq .= "host_event_handler_enabled = '".$ret["host_event_handler_enabled"]["host_event_handler_enabled"]."', "; 
    970                 if (isset($ret["host_low_flap_threshold"]) && $ret["host_low_flap_threshold"]!= NULL) $rq .= "host_low_flap_threshold = '".$ret["host_low_flap_threshold"]."', "; 
    971                 if (isset($ret["host_high_flap_threshold"]) && $ret["host_high_flap_threshold"] != NULL) $rq .= "host_high_flap_threshold = '".$ret["host_high_flap_threshold"]."', "; 
    972                 if (isset($ret["host_flap_detection_enabled"]["host_flap_detection_enabled"])) $rq .= "host_flap_detection_enabled = '".$ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]."', "; 
    973                 if (isset($ret["host_process_perf_data"]["host_process_perf_data"])) $rq .= "host_process_perf_data = '".$ret["host_process_perf_data"]["host_process_perf_data"]."', "; 
    974                 if (isset($ret["host_retain_status_information"]["host_retain_status_information"])) $rq .= "host_retain_status_information = '".$ret["host_retain_status_information"]["host_retain_status_information"]."', "; 
    975                 if (isset($ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"])) $rq .= "host_retain_nonstatus_information = '".$ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]."', "; 
    976                 if (isset($ret["host_notification_interval"]) && $ret["host_notification_interval"] != NULL) $rq .= "host_notification_interval = '".$ret["host_notification_interval"]."', "; 
    977                 if (isset($ret["host_notifOpts"]) && $ret["host_notifOpts"] != NULL) $rq .= "host_notification_options = '".implode(",", array_keys($ret["host_notifOpts"]))."', "; 
    978                 if (isset($ret["host_notifications_enabled"]["host_notifications_enabled"])) $rq .= "host_notifications_enabled = '".$ret["host_notifications_enabled"]["host_notifications_enabled"]."', "; 
    979                 if (isset($ret["host_stalOpts"]) && $ret["host_stalOpts"] != NULL) $rq .= "host_stalking_options = '".implode(",", array_keys($ret["host_stalOpts"]))."', "; 
    980                 if (isset($ret["host_snmp_community"]) && $ret["host_snmp_community"] != NULL) $rq .= "host_snmp_community = '".htmlentities($ret["host_snmp_community"], ENT_QUOTES)."', "; 
    981                 if (isset($ret["host_snmp_version"]) && $ret["host_snmp_version"] != NULL) $rq .= "host_snmp_version = '".htmlentities($ret["host_snmp_version"], ENT_QUOTES)."', "; 
    982                 if (isset($ret["host_comment"]) && $ret["host_comment"] != NULL) $rq .= "host_comment = '".htmlentities($ret["host_comment"], ENT_QUOTES)."', "; 
    983                 if (isset($ret["host_register"]["host_register"]) && $ret["host_register"]["host_register"] != NULL) $rq .= "host_register = '".$ret["host_register"]["host_register"]."', "; 
    984                 if (isset($ret["host_activate"]["host_activate"]) && $ret["host_activate"]["host_activate"] != NULL) $rq .= "host_activate = '".$ret["host_activate"]["host_activate"]."', "; 
     1153                if (isset($ret["host_template_model_htm_id"]) && $ret["host_template_model_htm_id"] != NULL) { 
     1154                        $rq .= "host_template_model_htm_id = '".$ret["host_template_model_htm_id"]."', ";