@@ -432,21 +432,27 @@ function syslog_stats_filter() {
432432 <option value='-1'<?php if (get_request_var ('host ' ) == '-1 ' ) { ?> selected<?php } ?> ><?php print __ ('All ' , 'syslog ' );?> </option>
433433 <option value='-2'<?php if (get_request_var ('host ' ) == '-2 ' ) { ?> selected<?php } ?> ><?php print __ ('None ' , 'syslog ' );?> </option>
434434 <?php
435- $ hosts = syslog_db_fetch_assoc ('SELECT DISTINCT sh.host_id, sh.host, h.id
436- FROM ` ' . $ syslogdb_default . '`.`syslog_hosts` AS sh
437- LEFT JOIN host AS h
438- ON sh.host = h.hostname
439- OR sh.host = h.description
440- OR sh.host LIKE substring_index(h.hostname, ".", 1)
441- OR sh.host LIKE substring_index(h.description, ".", 1)
442- ORDER BY host ' );
435+ if (syslog_db_table_exists ('host ' , false )) {
436+ $ hosts = syslog_db_fetch_assoc ('SELECT DISTINCT sh.host_id, sh.host, h.id
437+ FROM ` ' . $ syslogdb_default . '`.`syslog_hosts` AS sh
438+ LEFT JOIN host AS h
439+ ON sh.host = h.hostname
440+ OR sh.host = h.description
441+ OR sh.host LIKE substring_index(h.hostname, ".", 1)
442+ OR sh.host LIKE substring_index(h.description, ".", 1)
443+ ORDER BY host ' );
444+ } else {
445+ $ hosts = syslog_db_fetch_assoc ('SELECT DISTINCT sh.host_id, sh.host, "0" AS id
446+ FROM ` ' . $ syslogdb_default . '`.`syslog_hosts` AS sh
447+ ORDER BY host ' );
448+ }
443449
444450 if (cacti_sizeof ($ hosts )) {
445451 foreach ($ hosts as $ host ) {
446452 if (!empty ($ host ['id ' ])) {
447453 $ class = get_device_leaf_class ($ host ['id ' ]);
448454 } else {
449- $ class = 'deviceUnknown ' ;
455+ $ class = 'deviceUp ' ;
450456 }
451457
452458 print '<option class=" ' . $ class . '" value=" ' . $ host ['host_id ' ] . '" ' ; if (get_request_var ('host ' ) == $ host ['host_id ' ]) { print ' selected ' ; } print '> ' . $ host ['host ' ] . '</option> ' ;
@@ -1315,15 +1321,22 @@ function timeshiftFilterRight() {
13151321 $ hosts_where = '' ;
13161322 $ hosts_where = api_plugin_hook_function ('syslog_hosts_where ' , $ hosts_where );
13171323
1318- $ hosts = syslog_db_fetch_assoc ("SELECT sh.host_id, sh.host, h.id
1319- FROM ` " . $ syslogdb_default . "`.`syslog_hosts` AS sh
1320- LEFT JOIN host AS h
1321- ON sh.host = h.hostname
1322- OR sh.host = h.description
1323- OR sh.host LIKE substring_index(h.hostname, '.', 1)
1324- OR sh.host LIKE substring_index(h.description, '.', 1)
1325- $ hosts_where
1326- ORDER BY host " );
1324+ if (syslog_db_table_exists ('host ' , false )) {
1325+ $ hosts = syslog_db_fetch_assoc ('SELECT DISTINCT sh.host_id, sh.host, h.id
1326+ FROM ` ' . $ syslogdb_default . "`.`syslog_hosts` AS sh
1327+ LEFT JOIN host AS h
1328+ ON sh.host = h.hostname
1329+ OR sh.host = h.description
1330+ OR sh.host LIKE substring_index(h.hostname, '.', 1)
1331+ OR sh.host LIKE substring_index(h.description, '.', 1)
1332+ $ hosts_where
1333+ ORDER BY host " );
1334+ } else {
1335+ $ hosts = syslog_db_fetch_assoc ('SELECT DISTINCT sh.host_id, sh.host, "0" AS id
1336+ FROM ` ' . $ syslogdb_default . "`.`syslog_hosts` AS sh
1337+ $ hosts_where
1338+ ORDER BY host " );
1339+ }
13271340
13281341 $ selected = explode (', ' , get_request_var ('host ' ));
13291342
@@ -1337,7 +1350,7 @@ function timeshiftFilterRight() {
13371350 if (!empty ($ host ['id ' ])) {
13381351 $ class = get_device_leaf_class ($ host ['id ' ]);
13391352 } else {
1340- $ class = 'deviceUnknown ' ;
1353+ $ class = 'deviceUp ' ;
13411354 }
13421355
13431356 print "<option class=' $ class' value=' " . $ host ['host_id ' ] . "' " ;
0 commit comments