Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 86 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 86 Revision 115
Zeile 2... Zeile 2...
2
 
2
 
3
    /**
3
    /**
4
     * @package nagios-php
4
     * @package nagios-php
5
     * @author Lars Tiefland <ltiefland@gmail.com>
5
     * @author Lars Tiefland <ltiefland@gmail.com>
6
     * @copyright 2013
6
     * @copyright 2013
7
     * @version $Rev: 86 $
7
     * @version $Rev: 115 $
Zeile 8... Zeile 8...
8
     */
8
     */
Zeile 9... Zeile 9...
9
 
9
 
10
    // $Id: host.php 86 2013-01-02 13:28:36Z lars $
10
    // $Id: host.php 115 2013-01-05 19:05:29Z lars $
11
 
11
 
12
    /**
12
    /**
13
     * host
13
     * host
14
     * 
14
     * 
15
     * @package nagios-php   
15
     * @package nagios-php   
16
     * @author Lars Tiefland
16
     * @author Lars Tiefland
17
     * @copyright 2012
17
     * @copyright 2012
18
     * @version $Rev: 86 $
18
     * @version $Rev: 115 $
19
     * @access public
19
     * @access public
20
     */
20
     */
Zeile 29... Zeile 29...
29
         * host::__construct()
29
         * host::__construct()
30
         * 
30
         * 
31
         * @param mixed $id
31
         * @param mixed $id
32
         * @return
32
         * @return
33
         */
33
         */
34
        public function __construct( $id )
34
        public function __construct( $id, $is_host_object_id = false )
35
        {
35
        {
-
 
36
            if ( $is_host_object_id )
-
 
37
            {
-
 
38
                $id_where = "host_object_id = $id";
-
 
39
            }
-
 
40
            else
-
 
41
            {
-
 
42
                $id_where = "host_id = $id";
-
 
43
            }
36
            $sql = "SELECT
44
            $sql = "SELECT
37
                    host_id,
45
                    host_id,
38
                    display_name,
46
                    display_name,
39
                    host_object_id
47
                    host_object_id
40
                FROM
48
                FROM
41
                    hosts
49
                    hosts
42
                WHERE
50
                WHERE
43
                    host_id = $id
51
                    " . $id_where . "
44
                AND
52
                AND
45
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
53
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
46
            ";
54
            ";
47
            $res = $GLOBALS["db"]->query( $sql );
55
            $res = $GLOBALS["db"]->query( $sql );
48
            $row = $res->fetchRow();
56
            $row = $res->fetchRow();