~ubuntu-branches/debian/stretch/cacti/stretch

« back to all changes in this revision

Viewing changes to utilities.php

  • Committer: Package Import Robot
  • Author(s): Paul Gevers
  • Date: 2015-06-22 19:59:13 UTC
  • mfrom: (1.1.16) (36.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20150622195913-40twdt0k4ondnuvz
Tags: 0.8.8d+ds1-1
* Upload to unstable
* New upstream release
  - CVE-2015-2665 Cross-site scripting (XSS) vulnerability in Cacti
    before 0.8.8d allows remote attackers to inject arbitrary web script
    or HTML via unspecified vectors.
  - CVE-2015-4342 SQL Injection and Location header injection from cdef id
  - CVE-2015-4454 SQL injection vulnerability in the
    get_hash_graph_template function in lib/functions.php in Cacti before
    0.8.8d allows remote attackers to execute arbitrary SQL commands via
    the graph_template_id parameter to graph_templates.php.
  - Unassigned CVE VN:JVN#78187936 / TN:JPCERT#98968540 Fixed SQL injection
* Remove Sean from the list of uploaders. Thanks for all the fish
  (Closes: #773436)
* Fix d/p/07_cli-include-path.patch (LP: #1433665)
* Update debian/patches/fix_php_strict_warning_in_ping.patch for partial
  upstream fix
* Include the virtual alternative for the recommends on mysql-server
  (Closes: #781982)
* Upstream dropped unused javascripts, remove them from d/copyright
* Add patch to have upgrade script mention version 0.8.8d i.s.o. 0.8.8c

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/*
3
3
 +-------------------------------------------------------------------------+
4
 
 | Copyright (C) 2004-2013 The Cacti Group                                 |
 
4
 | Copyright (C) 2004-2015 The Cacti Group                                 |
5
5
 |                                                                         |
6
6
 | This program is free software; you can redistribute it and/or           |
7
7
 | modify it under the terms of the GNU General Public License             |
201
201
 
202
202
 
203
203
function utilities_view_tech($php_info = "") {
204
 
        global $database_default, $colors, $config, $rrdtool_versions, $poller_options, $input_types;
 
204
        global $database_default, $config, $rrdtool_versions, $poller_options, $input_types;
205
205
 
206
206
        /* Get table status */
207
207
        $tables = db_fetch_assoc("SHOW TABLES");
285
285
        }
286
286
 
287
287
        /* Display tech information */
288
 
        html_start_box("<strong>Technical Support</strong>", "100%", $colors["header"], "3", "center", "");
 
288
        html_start_box("<strong>Technical Support</strong>", "100%", "", "3", "center", "");
289
289
        html_header(array("General Information"), 2);
290
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
290
        print "<tr class='odd'>\n";
291
291
        print "         <td class='textArea'>Date</td>\n";
292
292
        print "         <td class='textArea'>" . date("r") . "</td>\n";
293
293
        print "</tr>\n";
294
294
        api_plugin_hook_function('custom_version_info');
295
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
295
        print "<tr class='even'>\n";
296
296
        print "         <td class='textArea'>Cacti Version</td>\n";
297
297
        print "         <td class='textArea'>" . $config["cacti_version"] . "</td>\n";
298
298
        print "</tr>\n";
299
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
299
        print "<tr class='odd'>\n";
300
300
        print "         <td class='textArea'>Cacti OS</td>\n";
301
301
        print "         <td class='textArea'>" . $config["cacti_server_os"] . "</td>\n";
302
302
        print "</tr>\n";
303
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
303
        print "<tr class='even'>\n";
304
304
        print "         <td class='textArea'>SNMP Version</td>\n";
305
305
        print "         <td class='textArea'>" . $snmp_version . "</td>\n";
306
306
        print "</tr>\n";
307
307
 
308
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
308
        print "<tr class='odd'>\n";
309
309
        print "         <td class='textArea'>RRDTool Version</td>\n";
310
310
        print "         <td class='textArea'>" . $rrdtool_versions[$rrdtool_version] . " " . $rrdtool_error . "</td>\n";
311
311
        print "</tr>\n";
312
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
312
        print "<tr class='even'>\n";
313
313
        print "         <td class='textArea'>Hosts</td>\n";
314
314
        print "         <td class='textArea'>" . $host_count . "</td>\n";
315
315
        print "</tr>\n";
316
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
316
        print "<tr class='odd'>\n";
317
317
        print "         <td class='textArea'>Graphs</td>\n";
318
318
        print "         <td class='textArea'>" . $graph_count . "</td>\n";
319
319
        print "</tr>\n";
320
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
320
        print "<tr class='even'>\n";
321
321
        print "         <td class='textArea'>Data Sources</td>\n";
322
322
        print "         <td class='textArea'>";
323
323
        $data_total = 0;
334
334
        print "</tr>\n";
335
335
 
336
336
        html_header(array("Poller Information"), 2);
337
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
337
        print "<tr class='odd'>\n";
338
338
        print "         <td class='textArea'>Interval</td>\n";
339
339
        print "         <td class='textArea'>" . read_config_option("poller_interval") . "</td>\n";
340
340
        if (file_exists(read_config_option("path_spine")) && $poller_options[read_config_option("poller_type")] == 'spine') {
343
343
                $type = $poller_options[read_config_option("poller_type")];
344
344
        }
345
345
        print "</tr>\n";
346
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
346
        print "<tr class='even'>\n";
347
347
        print "         <td class='textArea'>Type</td>\n";
348
348
        print "         <td class='textArea'>" . $type . "</td>\n";
349
349
        print "</tr>\n";
350
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
350
        print "<tr class='odd'>\n";
351
351
        print "         <td class='textArea'>Items</td>\n";
352
352
        print "         <td class='textArea'>";
353
353
        $total = 0;
363
363
        print "</td>\n";
364
364
        print "</tr>\n";
365
365
 
366
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
366
        print "<tr class='even'>\n";
367
367
        print "         <td class='textArea'>Concurrent Processes</td>\n";
368
368
        print "         <td class='textArea'>" . read_config_option("concurrent_processes") . "</td>\n";
369
369
        print "</tr>\n";
370
370
 
371
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
371
        print "<tr class='odd'>\n";
372
372
        print "         <td class='textArea'>Max Threads</td>\n";
373
373
        print "         <td class='textArea'>" . read_config_option("max_threads") . "</td>\n";
374
374
        print "</tr>\n";
375
375
 
376
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
376
        print "<tr class='even'>\n";
377
377
        print "         <td class='textArea'>PHP Servers</td>\n";
378
378
        print "         <td class='textArea'>" . read_config_option("php_servers") . "</td>\n";
379
379
        print "</tr>\n";
380
380
 
381
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
381
        print "<tr class='odd'>\n";
382
382
        print "         <td class='textArea'>Script Timeout</td>\n";
383
383
        print "         <td class='textArea'>" . read_config_option("script_timeout") . "</td>\n";
384
384
        print "</tr>\n";
385
385
 
386
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
386
        print "<tr class='even'>\n";
387
387
        print "         <td class='textArea'>Max OID</td>\n";
388
388
        print "         <td class='textArea'>" . read_config_option("max_get_size") . "</td>\n";
389
389
        print "</tr>\n";
390
390
 
391
391
 
392
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
392
        print "<tr class='odd'>\n";
393
393
        print "         <td class='textArea'>Last Run Statistics</td>\n";
394
394
        print "         <td class='textArea'>" . read_config_option("stats_poller") . "</td>\n";
395
395
        print "</tr>\n";
396
396
 
397
397
 
398
398
        html_header(array("PHP Information"), 2);
399
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
399
        print "<tr class='odd'>\n";
400
400
        print "         <td class='textArea'>PHP Version</td>\n";
401
401
        print "         <td class='textArea'>" . phpversion() . "</td>\n";
402
402
        print "</tr>\n";
403
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
403
        print "<tr class='even'>\n";
404
404
        print "         <td class='textArea'>PHP OS</td>\n";
405
405
        print "         <td class='textArea'>" . PHP_OS . "</td>\n";
406
406
        print "</tr>\n";
407
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
407
        print "<tr class='odd'>\n";
408
408
        print "         <td class='textArea'>PHP uname</td>\n";
409
409
        print "         <td class='textArea'>";
410
410
        if (function_exists("php_uname")) {
414
414
        }
415
415
        print "</td>\n";
416
416
        print "</tr>\n";
417
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
417
        print "<tr class='even'>\n";
418
418
        print "         <td class='textArea'>PHP SNMP</td>\n";
419
419
        print "         <td class='textArea'>";
420
420
        if (function_exists("snmpget")) {
424
424
        }
425
425
        print "</td>\n";
426
426
        print "</tr>\n";
427
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
427
        print "<tr class='odd'>\n";
428
428
        print "         <td class='textArea'>max_execution_time</td>\n";
429
429
        print "         <td class='textArea'>" . ini_get("max_execution_time") . "</td>\n";
430
430
        print "</tr>\n";
431
 
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'>\n";
 
431
        print "<tr class='even'>\n";
432
432
        print "         <td class='textArea'>memory_limit</td>\n";
433
433
        print "         <td class='textArea'>" . ini_get("memory_limit");
434
434
 
457
457
        print "</tr>\n";
458
458
 
459
459
        html_header(array("MySQL Table Information"), 2);
460
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
460
        print "<tr class='odd'>\n";
461
461
        print "         <td class='textArea' colspan='2' align='center'>";
462
462
        if (sizeof($table_status) > 0) {
463
463
                print "<table border='1' cellpadding='2' cellspacing='0'>\n";
501
501
        print "</tr>\n";
502
502
 
503
503
        html_header(array("PHP Module Information"), 2);
504
 
        print "<tr bgcolor='#" . $colors["form_alternate1"] . "'>\n";
 
504
        print "<tr class='odd'>\n";
505
505
        print "         <td class='textArea' colspan='2'>" . $php_info . "</td>\n";
506
506
        print "</tr>\n";
507
507
 
511
511
 
512
512
 
513
513
function utilities_view_user_log() {
514
 
        global $colors, $auth_realms;
 
514
        global $auth_realms;
515
515
 
516
516
        define("MAX_DISPLAY_PAGES", 21);
517
517
 
583
583
        </script>
584
584
        <?php
585
585
 
586
 
        html_start_box("<strong>User Login History</strong>", "100%", $colors["header"], "3", "center", "");
 
586
        html_start_box("<strong>User Login History</strong>", "100%", "", "3", "center", "");
587
587
 
588
588
        ?>
589
 
        <tr bgcolor="#<?php print $colors["panel"];?>">
 
589
        <tr class='even noprint'>
590
590
                <td>
591
591
                <form name="form_userlog" action="utilities.php">
592
592
                        <table cellpadding="0" cellspacing="0">
672
672
                }
673
673
        }
674
674
 
675
 
        html_start_box("", "100%", $colors["header"], "3", "center", "");
 
675
        html_start_box("", "100%", "", "3", "center", "");
676
676
 
677
677
        $total_rows = db_fetch_cell("SELECT
678
678
                COUNT(*)
695
695
                ORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . "
696
696
                LIMIT " . (read_config_option("num_rows_data_source")*(get_request_var_request("page")-1)) . "," . read_config_option("num_rows_data_source");
697
697
 
698
 
//      print $user_log_sql;
699
 
 
700
698
        $user_log = db_fetch_assoc($user_log_sql);
701
699
 
702
 
        /* generate page list */
703
 
        $url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "utilities.php?action=view_user_log&username=" . get_request_var_request("username") . "&filter=" . get_request_var_request("filter"));
704
 
 
705
 
        $nav = "<tr bgcolor='#" . $colors["header"] . "'>
706
 
                        <td colspan='7'>
707
 
                                <table width='100%' cellspacing='0' cellpadding='0' border='0'>
708
 
                                        <tr>
709
 
                                                <td align='left' class='textHeaderDark'>
710
 
                                                        <strong>&lt;&lt; "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_user_log&username=" . get_request_var_request("username") . "&filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")-1)) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong>
711
 
                                                </td>\n
712
 
                                                <td align='center' class='textHeaderDark'>
713
 
                                                        Showing Rows " . ((read_config_option("num_rows_data_source")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_data_source")) || ($total_rows < (read_config_option("num_rows_data_source")*get_request_var_request("page")))) ? $total_rows : (read_config_option("num_rows_data_source")*get_request_var_request("page"))) . " of $total_rows [$url_page_select]
714
 
                                                </td>\n
715
 
                                                <td align='right' class='textHeaderDark'>
716
 
                                                        <strong>"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_user_log&username=" . get_request_var_request("username") . "&filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")+1)) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "</a>"; } $nav .= " &gt;&gt;</strong>
717
 
                                                </td>\n
718
 
                                        </tr>
719
 
                                </table>
720
 
                        </td>
721
 
                </tr>\n";
 
700
        $nav = html_nav_bar("utilities.php?action=view_user_log&username=" . get_request_var_request("username") . "&filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), read_config_option("num_rows_data_source"), $total_rows, 6);
722
701
 
723
702
        print $nav;
724
703
 
732
711
 
733
712
        html_header_sort($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"));
734
713
 
735
 
        $i = 0;
736
714
        if (sizeof($user_log) > 0) {
737
715
                foreach ($user_log as $item) {
738
 
                        if (isset($item["full_name"])) {
739
 
                                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
740
 
                        }else{
741
 
                                form_alternate_row_color("FF9D9D","FFAFAF",$i);
742
 
                        }
 
716
                        form_alternate_row('', true);
743
717
                        ?>
744
718
                        <td style='white-space:nowrap;'>
745
719
                                <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["username"])) : $item["username"]);?>
771
745
                        </td>
772
746
                        </tr>
773
747
                        <?php
774
 
                        $i++;
775
748
                }
 
749
 
 
750
                print $nav;
776
751
        }
777
752
 
778
753
        html_end_box();
798
773
}
799
774
 
800
775
function utilities_view_logfile() {
801
 
        global $colors, $log_tail_lines, $page_refresh_interval, $refresh;
 
776
        global $log_tail_lines, $page_refresh_interval, $refresh;
802
777
 
803
778
        $logfile = read_config_option("path_cactilog");
804
779
 
861
836
        </script>
862
837
        <?php
863
838
 
864
 
        html_start_box("<strong>Log File Filters</strong>", "100%", $colors["header"], "3", "center", "");
 
839
        html_start_box("<strong>Log File Filters</strong>", "100%", "", "3", "center", "");
865
840
 
866
841
        ?>
867
 
        <tr bgcolor="#<?php print $colors["panel"];?>">
 
842
        <tr class='even noprint'>
868
843
                <td>
869
844
                <form name="form_logfile" action="utilities.php">
870
845
                        <table cellpadding="1" cellspacing="0">
956
931
                $start_string = "<strong>Log File</strong> [Total Lines: " . sizeof($logcontents) . " - All Items Shown]";
957
932
        }
958
933
 
959
 
        html_start_box($start_string, "100%", $colors["header"], "3", "center", "");
 
934
        html_start_box($start_string, "100%", "", "3", "center", "");
960
935
 
961
936
        $i = 0;
962
937
        $j = 0;
1039
1014
}
1040
1015
 
1041
1016
function utilities_clear_logfile() {
1042
 
        global $colors;
1043
 
 
1044
1017
        load_current_session_value("refresh", "sess_logfile_refresh", read_config_option("log_refresh_interval"));
1045
1018
 
1046
1019
        $refresh["seconds"] = get_request_var_request("refresh");
1054
1027
                $logfile = "./log/cacti.log";
1055
1028
        }
1056
1029
 
1057
 
        html_start_box("<strong>Clear Cacti Log File</strong>", "100%", $colors["header"], "1", "center", "");
 
1030
        html_start_box("<strong>Clear Cacti Log File</strong>", "100%", "", "1", "center", "");
1058
1031
        if (file_exists($logfile)) {
1059
1032
                if (is_writable($logfile)) {
1060
1033
                        $timestamp = date("m/d/Y h:i:s A");
1072
1045
}
1073
1046
 
1074
1047
function utilities_view_snmp_cache() {
1075
 
        global $colors, $poller_actions;
 
1048
        global $poller_actions;
1076
1049
 
1077
1050
        define("MAX_DISPLAY_PAGES", 21);
1078
1051
 
1126
1099
        </script>
1127
1100
        <?php
1128
1101
 
1129
 
        html_start_box("<strong>SNMP Cache Items</strong>", "100%", $colors["header"], "3", "center", "");
 
1102
        html_start_box("<strong>SNMP Cache Items</strong>", "100%", "", "3", "center", "");
1130
1103
 
1131
1104
        ?>
1132
 
        <tr bgcolor="#<?php print $colors["panel"];?>">
 
1105
        <tr class='even noprint'>
1133
1106
                <td>
1134
1107
                <form name="form_snmpcache" action="utilities.php">
1135
1108
                        <table cellpadding="0" cellspacing="0">
1251
1224
                        OR host_snmp_cache.oid LIKE '%%" . get_request_var_request("filter") . "%%')";
1252
1225
        }
1253
1226
 
1254
 
        html_start_box("", "100%", $colors["header"], "3", "center", "");
 
1227
        html_start_box("", "100%", "", "3", "center", "");
1255
1228
 
1256
1229
        $total_rows = db_fetch_cell("SELECT
1257
1230
                COUNT(*)
1270
1243
                $sql_where
1271
1244
                LIMIT " . (read_config_option("num_rows_data_source")*(get_request_var_request("page")-1)) . "," . read_config_option("num_rows_data_source");
1272
1245
 
1273
 
//      print $snmp_cache_sql;
1274
 
 
1275
1246
        $snmp_cache = db_fetch_assoc($snmp_cache_sql);
1276
1247
 
1277
 
        /* generate page list */
1278
 
        $url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "utilities.php?action=view_snmp_cache&host_id=" . get_request_var_request("host_id") . "&filter=" . get_request_var_request("filter"));
1279
 
 
1280
 
        $nav = "<tr bgcolor='#" . $colors["header"] . "'>
1281
 
                        <td colspan='7'>
1282
 
                                <table width='100%' cellspacing='0' cellpadding='0' border='0'>
1283
 
                                        <tr>
1284
 
                                                <td align='left' class='textHeaderDark'>
1285
 
                                                        <strong>&lt;&lt; "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_snmp_cache&host_id=" . get_request_var_request("host_id") . "&filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")-1)) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong>
1286
 
                                                </td>\n
1287
 
                                                <td align='center' class='textHeaderDark'>
1288
 
                                                        Showing Rows " . ((read_config_option("num_rows_data_source")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_data_source")) || ($total_rows < (read_config_option("num_rows_data_source")*get_request_var_request("page")))) ? $total_rows : (read_config_option("num_rows_data_source")*get_request_var_request("page"))) . " of $total_rows [$url_page_select]
1289
 
                                                </td>\n
1290
 
                                                <td align='right' class='textHeaderDark'>
1291
 
                                                        <strong>"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_snmp_cache&host_id=" . get_request_var_request("host_id") . "&filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page")+1)) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "</a>"; } $nav .= " &gt;&gt;</strong>
1292
 
                                                </td>\n
1293
 
                                        </tr>
1294
 
                                </table>
1295
 
                        </td>
1296
 
                </tr>\n";
 
1248
        $nav = html_nav_bar("utilities.php?action=view_snmp_cache&host_id=" . get_request_var_request("host_id") . "&filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), read_config_option("num_rows_data_source"), $total_rows, 3);
1297
1249
 
1298
1250
        print $nav;
1299
1251
 
1301
1253
 
1302
1254
        $i = 0;
1303
1255
        if (sizeof($snmp_cache) > 0) {
1304
 
        foreach ($snmp_cache as $item) {
1305
 
                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
1306
 
                ?>
1307
 
                <td>
1308
 
                        Host: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["description"])) : $item["description"]);?>
1309
 
                        , SNMP Query: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["name"])) : $item["name"]);?>
1310
 
                </td>
1311
 
                </tr>
1312
 
                <?php
1313
 
                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
1314
 
                ?>
1315
 
                <td>
1316
 
                        Index: <?php print $item["snmp_index"];?>
1317
 
                        , Field Name: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["field_name"])) : $item["field_name"]);?>
1318
 
                        , Field Value: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["field_value"])) : $item["field_value"]);?>
1319
 
                </td>
1320
 
                </tr>
1321
 
                <?php
1322
 
                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++;
1323
 
                ?>
1324
 
                <td>
1325
 
                        OID: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["oid"])) : $item["oid"]);?>
1326
 
                </td>
1327
 
                </tr>
1328
 
                <?php
1329
 
        }
1330
 
        }
 
1256
                foreach ($snmp_cache as $item) {
 
1257
                        form_alternate_row();
 
1258
                        ?>
 
1259
                        <td>
 
1260
                                Host: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["description"])) : $item["description"]);?>
 
1261
                                , SNMP Query: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["name"])) : $item["name"]);?>
 
1262
                        </td>
 
1263
                        </tr>
 
1264
                        <?php
 
1265
                        form_alternate_row();
 
1266
                        ?>
 
1267
                        <td>
 
1268
                                Index: <?php print $item["snmp_index"];?>
 
1269
                                , Field Name: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["field_name"])) : $item["field_name"]);?>
 
1270
                                , Field Value: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["field_value"])) : $item["field_value"]);?>
 
1271
                        </td>
 
1272
                        </tr>
 
1273
                        <?php
 
1274
                        form_alternate_row();
 
1275
                        ?>
 
1276
                        <td>
 
1277
                                OID: <?php print (strlen(get_request_var_request("filter")) ? (preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["oid"])) : $item["oid"]);?>
 
1278
                        </td>
 
1279
                        </tr>
 
1280
                        <?php
 
1281
                }
1331
1282
 
1332
 
        print $nav;
 
1283
                print $nav;
 
1284
        }
1333
1285
 
1334
1286
        html_end_box();
1335
1287
}
1336
1288
 
1337
1289
function utilities_view_poller_cache() {
1338
 
        global $colors, $poller_actions;
 
1290
        global $poller_actions;
1339
1291
 
1340
1292
        define("MAX_DISPLAY_PAGES", 21);
1341
1293
 
1406
1358
        </script>
1407
1359
        <?php
1408
1360
 
1409
 
        html_start_box("<strong>Poller Cache Items</strong>", "100%", $colors["header"], "3", "center", "");
 
1361
        html_start_box("<strong>Poller Cache Items</strong>", "100%", "", "3", "center", "");
1410
1362
 
1411
1363
        ?>
1412
 
        <tr bgcolor="#<?php print $colors["panel"];?>">
 
1364
        <tr class='even noprint'>
1413
1365
                <td>
1414
1366
                <form name="form_pollercache" action="utilities.php">
1415
1367
                        <table cellpadding="0" cellspacing="0">
1487
1439
                        OR poller_item.rrd_path  LIKE '%%" . get_request_var_request("filter") . "%%')";
1488
1440
        }
1489
1441
 
1490
 
        html_start_box("", "100%", $colors["header"], "3", "center", "");
 
1442
        html_start_box("", "100%", "", "3", "center", "");
1491
1443
 
1492
1444
        $total_rows = db_fetch_cell("SELECT
1493
1445
                COUNT(*)
1511
1463
                ORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . ", action ASC
1512
1464
                LIMIT " . (read_config_option("num_rows_data_source")*(get_request_var_request("page")-1)) . "," . read_config_option("num_rows_data_source");
1513
1465
 
1514
 
//      print $poller_sql;
1515
 
 
1516
1466
        $poller_cache = db_fetch_assoc($poller_sql);
1517
1467
 
1518
 
        /* generate page list */
1519
 
        $url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "utilities.php?action=view_poller_cache&host_id=" . get_request_var_request("host_id") . "&poller_action=" . get_request_var_request("poller_action"));
1520
 
 
1521
 
        $nav = "<tr bgcolor='#" . $colors["header"] . "'>
1522
 
                        <td colspan='7'>
1523
 
                                <table width='100%' cellspacing='0' cellpadding='0' border='0'>
1524
 
                                        <tr>
1525
 
                                                <td align='left' class='textHeaderDark'>
1526
 
                                                        <strong>&lt;&lt; "; if (get_request_var_request("page") > 1) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_poller_cache&host_id=" . get_request_var_request("host_id") . "&poller_action=" . get_request_var_request("poller_action") . "&page=" . (get_request_var_request("page")-1)) . "'>"; } $nav .= "Previous"; if (get_request_var_request("page") > 1) { $nav .= "</a>"; } $nav .= "</strong>
1527
 
                                                </td>\n
1528
 
                                                <td align='center' class='textHeaderDark'>
1529
 
                                                        Showing Rows " . ((read_config_option("num_rows_data_source")*(get_request_var_request("page")-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_data_source")) || ($total_rows < (read_config_option("num_rows_data_source")*get_request_var_request("page")))) ? $total_rows : (read_config_option("num_rows_data_source")*get_request_var_request("page"))) . " of $total_rows [$url_page_select]
1530
 
                                                </td>\n
1531
 
                                                <td align='right' class='textHeaderDark'>
1532
 
                                                        <strong>"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("utilities.php?action=view_poller_cache&host_id=" . get_request_var_request("host_id") . "&poller_action=" . get_request_var_request("poller_action") . "&page=" . (get_request_var_request("page")+1)) . "'>"; } $nav .= "Next"; if ((get_request_var_request("page") * read_config_option("num_rows_data_source")) < $total_rows) { $nav .= "</a>"; } $nav .= " &gt;&gt;</strong>
1533
 
                                                </td>\n
1534
 
                                        </tr>
1535
 
                                </table>
1536
 
                        </td>
1537
 
                </tr>\n";
 
1468
        $nav = html_nav_bar("utilities.php?action=view_poller_cache&host_id=" . get_request_var_request("host_id") . "&poller_action=" . get_request_var_request("poller_action"), MAX_DISPLAY_PAGES, get_request_var_request("page"), read_config_option("num_rows_data_source"), $total_rows, 3);
1538
1469
 
1539
1470
        print $nav;
1540
1471
 
1547
1478
        $i = 0;
1548
1479
        if (sizeof($poller_cache) > 0) {
1549
1480
        foreach ($poller_cache as $item) {
1550
 
                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
 
1481
                form_alternate_row();
1551
1482
                        ?>
1552
1483
                        <td width="375">
1553
1484
                                <a class="linkEditMain" href="<?php print htmlspecialchars("data_sources.php?action=ds_edit&id=" . $item["local_data_id"]);?>"><?php print (strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $item["name_cache"]):$item["name_cache"]);?></a>
1578
1509
                </tr>
1579
1510
                <?php
1580
1511
 
1581
 
                form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i);
 
1512
                form_alternate_row();
1582
1513
                ?>
1583
1514
                        <td>
1584
1515
                        </td>
1597
1528
}
1598
1529
 
1599
1530
function utilities() {
1600
 
        global $colors;
1601
 
 
1602
 
        html_start_box("<strong>Cacti System Utilities</strong>", "100%", $colors["header"], "3", "center", "");
 
1531
        html_start_box("<strong>Cacti System Utilities</strong>", "100%", "", "3", "center", "");
1603
1532
 
1604
1533
        ?>
1605
1534
        <colgroup span="3">
1607
1536
                <col valign="top" width="80%"></col>
1608
1537
        </colgroup>
1609
1538
 
1610
 
        <?php html_header(array("Technical Support"), 2); ?>
1611
 
        <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
 
1539
        <?php html_header(array("Technical Support"), 2); form_alternate_row(); ?>
1612
1540
                <td class="textArea">
1613
1541
                        <a href='<?php print htmlspecialchars("utilities.php?action=view_tech");?>'>Technical Support</a>
1614
1542
                </td>
1617
1545
                </td>
1618
1546
        </tr>
1619
1547
 
1620
 
        <?php html_header(array("Log Administration"), 2);?>
1621
 
 
1622
 
        <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
 
1548
        <?php html_header(array("Log Administration"), 2); form_alternate_row(); ?>
1623
1549
                <td class="textArea">
1624
1550
                        <a href='<?php print htmlspecialchars("utilities.php?action=view_logfile");?>'>View Cacti Log File</a>
1625
1551
                </td>
1627
1553
                        The Cacti Log File stores statistic, error and other message depending on system settings.  This information can be used to identify problems with the poller and application.
1628
1554
                </td>
1629
1555
        </tr>
1630
 
        <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
 
1556
        <?php form_alternate_row(); ?>
1631
1557
                <td class="textArea">
1632
1558
                        <a href='<?php print htmlspecialchars("utilities.php?action=view_user_log");?>'>View User Log</a>
1633
1559
                </td>
1636
1562
                </td>
1637
1563
        </tr>
1638
1564
 
1639
 
        <?php html_header(array("Poller Cache Administration"), 2); ?>
1640
 
 
1641
 
        <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
 
1565
        <?php html_header(array("Poller Cache Administration"), 2); form_alternate_row(); ?>
1642
1566
                <td class="textArea">
1643
1567
                        <a href='<?php print htmlspecialchars("utilities.php?action=view_poller_cache");?>'>View Poller Cache</a>
1644
1568
                </td>
1646
1570
                        This is the data that is being passed to the poller each time it runs. This data is then in turn executed/interpreted and the results are fed into the rrd files for graphing or the database for display.
1647
1571
                </td>
1648
1572
        </tr>
1649
 
        <tr bgcolor="#<?php print $colors["form_alternate2"];?>">
 
1573
        <?php form_alternate_row(); ?>
1650
1574
                <td class="textArea">
1651
1575
                        <a href='<?php print htmlspecialchars("utilities.php?action=view_snmp_cache");?>'>View SNMP Cache</a>
1652
1576
                </td>
1654
1578
                        The SNMP cache stores information gathered from SNMP queries. It is used by cacti to determine the OID to use when gathering information from an SNMP-enabled host.
1655
1579
                </td>
1656
1580
        </tr>
1657
 
        <tr bgcolor="#<?php print $colors["form_alternate1"];?>">
 
1581
        <?php form_alternate_row(); ?>
1658
1582
                <td class="textArea">
1659
1583
                        <a href='<?php print htmlspecialchars("utilities.php?action=clear_poller_cache");?>'>Rebuild Poller Cache</a>
1660
1584
                </td>