Changeset 6717
- Timestamp:
- 10/03/08 20:00:36 (2 months ago)
- Files:
-
- 1 modified
-
trunk/centreon/www/include/common/common-Func.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/www/include/common/common-Func.php
r6646 r6717 305 305 if (!$host_id) return; 306 306 global $pearDB; 307 while (1) {307 while (1) { 308 308 $DBRESULT =& $pearDB->query("SELECT ".$field.", host_template_model_htm_id FROM host WHERE host_id = '".$host_id."' LIMIT 1"); 309 309 if (PEAR::isError($DBRESULT)) 310 310 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 311 311 $row =& $DBRESULT->fetchRow(); 312 //$field_result = $row[$field];313 312 if (isset($row[$field]) && $row[$field]) 314 313 return $row[$field]; … … 318 317 break; 319 318 } 319 } 320 321 function getMyHostFieldOnHost($host_id = NULL, $field) { 322 global $pearDB; 323 324 if (!$host_id) 325 return; 326 327 $DBRESULT =& $pearDB->query("SELECT ".$field.", host_template_model_htm_id FROM host WHERE host_id = '".$host_id."' LIMIT 1"); 328 if (PEAR::isError($DBRESULT)) 329 print "DB Error : ".$DBRESULT->getDebugInfo()."<br />"; 330 $row =& $DBRESULT->fetchRow(); 331 if (isset($row[$field]) && $row[$field]) 332 return $row[$field]; 333 else 334 return 0; 320 335 } 321 336 … … 531 546 532 547 function getMyHostGroupHosts($hg_id = NULL) { 533 if (!$hg_id) return; 534 global $pearDB; 548 global $pearDB; 549 550 if (!$hg_id) 551 return; 535 552 $hosts = array(); 536 // $DBRESULT =& $pearDB->query("SELECT host_host_id FROM hostgroup_relation WHERE hostgroup_hg_id = '".$hg_id."'");537 553 $DBRESULT =& $pearDB->query("SELECT hgr.host_host_id FROM hostgroup_relation hgr, host h WHERE hgr.hostgroup_hg_id = '".$hg_id."' AND h.host_id = hgr.host_host_id ORDER by h.host_name"); 538 554 if (PEAR::isError($DBRESULT)) … … 541 557 $hosts[$elem["host_host_id"]] = $elem["host_host_id"]; 542 558 $DBRESULT->free(); 559 unset($elem); 543 560 return $hosts; 544 561 } 545 562 546 563 function getMyHostGroupCommunity($hg_id = NULL) { 547 if (!$hg_id) return; 548 global $pearDB; 564 global $pearDB; 565 566 if (!$hg_id) 567 return; 549 568 $DBRESULT =& $pearDB->query("SELECT hg_snmp_community FROM hostgroup WHERE hg_id = '".$hg_id."' LIMIT 1"); 550 569 if (PEAR::isError($DBRESULT)) … … 557 576 558 577 function getMyHostGroupVersion($hg_id = NULL) { 559 if (!$hg_id) return; 560 global $pearDB; 578 global $pearDB; 579 580 if (!$hg_id) 581 return; 561 582 $DBRESULT =& $pearDB->query("SELECT hg_snmp_version FROM hostgroup WHERE hg_id = '".$hg_id."' LIMIT 1"); 562 583 if (PEAR::isError($DBRESULT))
