";
if (file_exists($htmlfile)) {
include($htmlfile);
} else {
print
"
This map hasn't been created yet.";
global $config, $user_auth_realms, $user_auth_realm_filenames;
$realm_id2 = 0;
if (isset($user_auth_realm_filenames[basename(
'weathermap-cacti-plugin.php')])) {
$realm_id2 = $user_auth_realm_filenames[basename(
'weathermap-cacti-plugin.php')];
}
$userid = (isset($_SESSION["sess_user_id"])
? intval($_SESSION["sess_user_id"]) : 1);
if ((db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.us
er_id='" . $userid . "' and user_auth_realm.realm_id='$realm_id2'"))
|| (empty($realm_id2))) {
print
" (If this message stays here for more than one poller cycle, then check your cacti.log file for errors!)";
}
print "
";
}
print "
";
html_graph_end_box();
}
}
function weathermap_show_manage_tab()
{
global $config, $user_auth_realms, $user_auth_realm_filenames;
$realm_id2 = 0;
if (isset($user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'])) {
$realm_id2 = $user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'];
}
$userid = (isset($_SESSION["sess_user_id"]) ? intval($_SESSION["sess_user_id"]) : 1);
if ((db_fetch_assoc(
"select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='"
. $userid . "' and user_auth_realm.realm_id='$realm_id2'"))
|| (empty($realm_id2))) {
print 'Manage Maps';
}
}
function weathermap_thumbview($limit_to_group = -1)
{
global $colors;
$userid = (isset($_SESSION["sess_user_id"]) ? intval($_SESSION["sess_user_id"]) : 1);
$maplist_SQL =
"select distinct weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and ";
if ($limit_to_group > 0)
$maplist_SQL .= " weathermap_maps.group_id=" . $limit_to_group . " and ";
$maplist_SQL .= " (userid=" . $userid . " or userid=0) order by sortorder, id";
$maplist = db_fetch_assoc($maplist_SQL);
// if there's only one map, ignore the thumbnail setting and show it fullsize
if (sizeof($maplist) == 1) {
$pagetitle = "Network Weathermap";
weathermap_fullview(FALSE, FALSE, $limit_to_group);
} else {
$pagetitle = "Network Weathermaps";
html_graph_start_box(2, true);
?>
';
}
if ($cycle) {
$refreshtime = read_config_option("weathermap_cycle_refresh");
// OK, so the Cycle plugin does all this with a tag at the bottom of the body
// that overrides the one at the top (that Cacti puts there). Unfortunately, that
// isn't valid HTML! So here's a Javascript driven way to do it
// It has the advantage that the image switching is cleaner, too.
// We also do a nice thing of taking the poller-period (5 mins), and the
// available maps, and making sure each one gets equal time in the 5 minute period.
?>
You Have No Maps\n";
}
}
function weathermap_translate_id($idname)
{
$SQL = "select id from weathermap_maps where configfile='"
. mysql_real_escape_string($idname) . "' or filehash='"
. mysql_real_escape_string($idname) . "'";
$map = db_fetch_assoc($SQL);
return ($map[0]['id']);
}
function weathermap_versionbox()
{
global $WEATHERMAP_VERSION, $colors;
global $config, $user_auth_realms, $user_auth_realm_filenames;
$pagefoot =
"Powered by PHP Weathermap version $WEATHERMAP_VERSION";
$realm_id2 = 0;
if (isset($user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'])) {
$realm_id2 = $user_auth_realm_filenames['weathermap-cacti-plugin-mgmt.php'];
}
$userid = (isset($_SESSION["sess_user_id"]) ? intval($_SESSION["sess_user_id"]) : 1);
if ((db_fetch_assoc(
"select user_auth_realm.realm_id from user_auth_realm where user_auth_realm.user_id='"
. $userid . "' and user_auth_realm.realm_id='$realm_id2'"))
|| (empty($realm_id2))) {
$pagefoot
.= " --- Weathermap Management";
$pagefoot .= " | Local Documentation";
$pagefoot .= " | Editor";
}
html_graph_start_box(1, true);
?>