~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002110857

« back to all changes in this revision

Viewing changes to frontends/php/include/config.inc.php

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-06-04 09:22:37 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080604092237-zgwq7kmraj1oohoz
Tags: 1:1.4.5-1ubuntu1
* Merge from debian unstable, remaining changes: 
  + fixing missing pid directory in /var/run
* Added the same patch to debian/zabbix-server-{mysql,pgsql}.zabbix-server.init
  (LP: #172775)

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        require_once("include/classes/ciframe.inc.php");
61
61
        require_once("include/classes/cpumenu.inc.php");
62
62
        require_once("include/classes/graph.inc.php");
63
 
require_once('include/classes/ctree.inc.php');
 
63
        require_once('include/classes/ctree.inc.php');
64
64
 
65
65
// Include Tactical Overview modules
66
66
 
71
71
        include_once("include/classes/cserverinfo.mod.php");
72
72
        include_once("include/classes/cflashclock.mod.php");
73
73
 
74
 
        require_once    "include/db.inc.php";
75
74
        require_once    "include/perm.inc.php";
76
75
        require_once    "include/audit.inc.php";
77
76
        require_once    "include/js.inc.php";
103
102
        if(file_exists($ZBX_CONFIGURATION_FILE) && !isset($_COOKIE['ZBX_CONFIG']))
104
103
        {
105
104
                include $ZBX_CONFIGURATION_FILE;
106
 
 
 
105
                require_once    "include/db.inc.php";
 
106
                
107
107
                $error = '';
108
108
                if(!DBconnect($error))
109
109
                {
137
137
        }
138
138
        else
139
139
        {
140
 
                if(file_exists($ZBX_CONFIGURATION_FILE))
 
140
                if(file_exists($ZBX_CONFIGURATION_FILE)){
141
141
                        include $ZBX_CONFIGURATION_FILE;
142
 
 
 
142
                }
 
143
                
 
144
                require_once("include/db.inc.php");
 
145
                
143
146
                define('ZBX_PAGE_NO_AUTHERIZATION', true);
144
147
                define('ZBX_DISTRIBUTED', false);
145
148
                $show_setup = true;
146
149
        }
147
 
 
 
150
        
 
151
        
148
152
        if(!defined('ZBX_PAGE_NO_AUTHERIZATION'))
149
153
        {
150
154
                check_authorisation();
223
227
                        {
224
228
                                for (   $curr_node = &$node_data;
225
229
                                        $curr_node['masterid'] != 0 &&
226
 
                                        $curr_node['masterid'] != $ZBX_CURRENT_NODEID;
 
230
                                        (bccomp($curr_node['masterid'] , $ZBX_CURRENT_NODEID) != 0);
227
231
                                        $curr_node = &$ZBX_NODES[$curr_node['masterid']]
228
232
                                );
229
233
 
230
 
                                if ( $curr_node['masterid'] == $ZBX_CURRENT_NODEID )
 
234
                                if (bccomp($curr_node['masterid'],$ZBX_CURRENT_NODEID) == 0 )
231
235
                                {
232
236
                                        $ZBX_CURRENT_SUBNODES[$nodeid] = $nodeid;
233
237
                                }
254
258
                global  $ZBX_CURRENT_NODEID, $ZBX_CURRENT_SUBNODES, $ZBX_WITH_SUBNODES;
255
259
 
256
260
                if ( !isset($ZBX_CURRENT_NODEID) )      init_nodes();
257
 
 
258
261
                $result = ( is_show_subnodes($forse_with_subnodes) ? $ZBX_CURRENT_SUBNODES : $ZBX_CURRENT_NODEID );
259
 
 
 
262
                
260
263
                if ( !is_null($perm) )
261
264
                {
262
265
                        global $USER_DETAILS;
305
308
                include_once "include/page_footer.php";
306
309
        }
307
310
 
 
311
        function uint_in_array($needle,$haystack){
 
312
                foreach($haystack as $id => $value)
 
313
                        if(bccomp($needle,$value) == 0) return true;
 
314
        return false;
 
315
        }
 
316
 
 
317
        function str_in_array($needle,$haystack,$strict=false){
 
318
                if(is_array($needle)){
 
319
                        return in_array($needle,$haystack,$strict);
 
320
                }
 
321
                else if($strict){
 
322
                        foreach($haystack as $id => $value) 
 
323
                                if($needle === $value) return true;
 
324
                }
 
325
                else{
 
326
                        foreach($haystack as $id => $value)
 
327
                                if(strcmp($needle,$value) == 0) return true;
 
328
                }
 
329
        return false;
 
330
        }
308
331
 
309
332
        function zbx_stripslashes($value){
310
333
                if(is_array($value)){
352
375
                $ZBX_MESSAGES = null;
353
376
        }
354
377
 
355
 
        function &asort_by_key(&$array, $key)
 
378
        function asort_by_key(&$array, $key)
356
379
        {
357
380
                if(!is_array($array)) {
358
381
                        error('Incorrect type of asort_by_key');
360
383
                }
361
384
                $key = htmlspecialchars($key);
362
385
                uasort($array, create_function('$a,$b', 'return $a[\''.$key.'\'] - $b[\''.$key.'\'];'));
363
 
                return $array;
 
386
        return $array;
364
387
        }
365
388
 
366
389
        function fatal_error($msg)
400
423
        {
401
424
                list($usec, $sec) = explode(" ",microtime()); 
402
425
                return ((float)$usec + (float)$sec); 
403
 
        } 
 
426
        }
404
427
 
 
428
        /* Do not forget to sync it with add_value_suffix in evalfunc.c! */ 
405
429
        function        convert_units($value,$units)
406
430
        {
407
431
// Special processing for unix timestamps
600
624
 
601
625
        function        select_config()
602
626
        {
603
 
                $row=DBfetch(DBselect("select * from config"));
 
627
                $row=DBfetch(DBselect("select * from config where ".DBin_node("configid", get_current_nodeid(false))));
604
628
                if($row)
605
629
                {
606
630
                        return  $row;
1670
1694
         *
1671
1695
         * author: Eugene Grigorjev
1672
1696
         */
1673
 
        function        get_cookie($name, $default_value=null)
1674
 
        {
1675
 
                global $_COOKIE;
 
1697
        function        get_cookie($name, $default_value=null){
1676
1698
                if(isset($_COOKIE[$name]))      return $_COOKIE[$name];
1677
1699
                // else
1678
1700
                return $default_value;
1686
1708
         *
1687
1709
         * author: Eugene Grigorjev
1688
1710
         */
1689
 
        function        zbx_setcookie($name, $value, $time=null)
1690
 
        {
1691
 
                global $_COOKIE;
1692
 
 
 
1711
        function        zbx_setcookie($name, $value, $time=null){
1693
1712
                setcookie($name, $value, isset($time) ? $time : (0));
1694
1713
                $_COOKIE[$name] = $value;
1695
1714
        }
1802
1821
        {
1803
1822
                return ($timestamp==0)?S_NEVER:date($format,$timestamp);
1804
1823
        }
1805
 
                
1806
1824
 
 
1825
        function        encode_log($data)
 
1826
        {
 
1827
                if(defined('ZBX_LOG_ENCODING_DEFAULT') && function_exists('mb_convert_encoding'))
 
1828
                {
 
1829
                        $new=mb_convert_encoding($data, S_HTML_CHARSET, ZBX_LOG_ENCODING_DEFAULT);
 
1830
                }
 
1831
                else
 
1832
                {
 
1833
                        $new = $data;
 
1834
                }
 
1835
                return $new;
 
1836
        }
1807
1837
?>