Show
Ignore:
Timestamp:
07/23/08 16:20:57 (4 months ago)
Author:
shotamchay
Message:

there is no more error when loading configuration files

Files:
1 modified

Legend:

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

    r5844 r5850  
    389389        function insertHostInDB ($ret = array())        { 
    390390                global $oreon; 
     391                 
    391392                $host_id = insertHost($ret); 
    392393                updateHostHostParent($host_id, $ret); 
     
    428429                // For Centreon 2, we no longer need "host_template_model_htm_id" in Nagios 3 
    429430                // but we try to keep it compatible with Nagios 2 which needs "host_template_model_htm_id"  
    430                 if (isset($_POST['nbOfSelect'])) { 
     431                if (isset($_POST['nbOfSelect']) || $oreon->user->get_version() >= 3) { 
    431432                        $DBRESULT =& $pearDB->query("SELECT host_id FROM `host` WHERE host_register='0' LIMIT 1"); 
    432433                        if (PEAR::isError($DBRESULT)) 
     
    490491                **  Insert multiple templates 
    491492                */ 
    492                 if (isset($_POST['nbOfSelect'])) {  
     493                if (isset($ret["use"]) && $ret["use"]){ 
     494                        $already_stored = array(); 
     495                        $tplTab = split(",", $ret["use"]); 
     496                        $j = 0; 
     497                        foreach ($tplTab as $val) { 
     498                                $tplId = getMyHostID($val);  
     499                                         
     500                                if (!isset($already_stored[$tplId]) && $tplId) { 
     501                                        $rq = "INSERT INTO host_template_relation (`host_host_id`, `host_tpl_id`, `order`) VALUES (". $host_id['MAX(host_id)'] .", ". $tplId .", ". $j .")"; 
     502                                        $DBRESULT =& $pearDB->query($rq); 
     503                                        if (PEAR::isError($DBRESULT)) 
     504                                                print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 
     505                                        $j++; 
     506                                        $already_stored[$tplId] = 1; 
     507                                } 
     508                        } 
     509                }                
     510                elseif (isset($_POST['nbOfSelect']) || $oreon->user->get_version() >= 3) {                       
    493511                        $already_stored = array(); 
    494512                        for ($i=0, $j = 1;$i <= $_POST['nbOfSelect']; $i++) 
     
    509527                 *  Insert on demand macros 
    510528                 */ 
    511                 if (isset($_POST['nbOfMacro'])) {                        
     529                if (isset($_POST['nbOfMacro']) || $oreon->user->get_version() >= 3) {                    
    512530                        $already_stored = array();               
    513531                        for ($i=0; $i <= $_POST['nbOfMacro']; $i++)