-
-
Notifications
You must be signed in to change notification settings - Fork 94
/
setup88.php
119 lines (96 loc) · 5.13 KB
/
setup88.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/*******************************************************************************
*
* Author ......... Howard Jones
* Contact ........ [email protected]
* Home Site ...... http://wotsit.thingy.com/haj/
* Program ........ Network Weathermap for Cacti
* Version ........ See code below
* Purpose ........ Network Usage Overview
*******************************************************************************/
/**
* This file now contains only the functions for registering the plugin and doing plugin-admin stuff
*
* All the real work is in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php
* and lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php
*/
// Load our autoloader
require_once dirname(__FILE__) . "/lib/all.php";
// These four are not classes which can be autoloaded. They're the global functions that Cacti is looking
// for to use as plugin hook functions
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/database.php";
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php";
require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php";
// and the old (to be replaced) Giant Function Of Everything for drawing maps
require_once dirname(__FILE__) . "/lib/Weathermap/Poller/poller-common.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/database.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/Cacti/CactiApplicationInterface.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Integrations/MapManager.php";
//require_once dirname(__FILE__) . "/lib/Weathermap/Core/constants.php";
function plugin_weathermap_version()
{
return array(
'name' => 'weathermap',
'version' => '1.0.0',
'longname' => 'PHP Network Weathermap for Cacti 0.8.x',
'author' => 'Howard Jones',
'homepage' => 'http://www.network-weathermap.com/',
'webpage' => 'http://www.network-weathermap.com/',
'email' => '[email protected]',
'url' => 'http://www.network-weathermap.com/versions.php'
);
}
function plugin_weathermap_install()
{
\api_plugin_register_hook('weathermap', 'config_arrays', 'weathermap_config_arrays', 'setup88.php');
\api_plugin_register_hook('weathermap', 'config_settings', 'weathermap_config_settings', 'setup88.php');
\api_plugin_register_hook('weathermap', 'top_header_tabs', 'weathermap_show_tab', 'setup88.php');
\api_plugin_register_hook('weathermap', 'top_graph_header_tabs', 'weathermap_show_tab', 'setup88.php');
\api_plugin_register_hook('weathermap', 'draw_navigation_text', 'weathermap_draw_navigation_text', 'setup88.php');
\api_plugin_register_hook('weathermap', 'top_graph_refresh', 'weathermap_top_graph_refresh', 'setup88.php');
\api_plugin_register_hook('weathermap', 'page_title', 'weathermap_page_title', 'setup88.php');
\api_plugin_register_hook('weathermap', 'page_head', 'weathermap_page_head', 'setup88.php');
\api_plugin_register_hook('weathermap', 'poller_top', 'weathermap_poller_top', 'setup88.php');
\api_plugin_register_hook('weathermap', 'poller_output', 'weathermap_poller_output', 'setup88.php');
\api_plugin_register_hook('weathermap', 'poller_bottom', 'weathermap_poller_bottom', 'setup88.php');
weathermap_setup_table();
}
function plugin_init_weathermap()
{
global $plugin_hooks;
$plugin_hooks['top_header_tabs']['weathermap'] = 'weathermap_show_tab';
$plugin_hooks['top_graph_header_tabs']['weathermap'] = 'weathermap_show_tab';
$plugin_hooks['config_arrays']['weathermap'] = 'weathermap_config_arrays';
$plugin_hooks['draw_navigation_text']['weathermap'] = 'weathermap_draw_navigation_text';
$plugin_hooks['config_settings']['weathermap'] = 'weathermap_config_settings';
$plugin_hooks['poller_bottom']['weathermap'] = 'weathermap_poller_bottom';
$plugin_hooks['poller_top']['weathermap'] = 'weathermap_poller_top';
$plugin_hooks['poller_output']['weathermap'] = 'weathermap_poller_output';
$plugin_hooks['top_graph_refresh']['weathermap'] = 'weathermap_top_graph_refresh';
$plugin_hooks['page_title']['weathermap'] = 'weathermap_page_title';
$plugin_hooks['page_head']['weathermap'] = 'weathermap_page_head';
}
function plugin_weathermap_uninstall()
{
// This function doesn't seem to ever be called, in Cacti 0.8.8b
// on the assumption that it will one day work, clear the stored version number from the settings
// so that an uninstall/reinstall on the plugin would force the db schema to be checked
$pdo = weathermap_get_pdo();
$pdo->query("REPLACE INTO settings VALUES('weathermap_version','')");
}
/* somehow this function is still required in PA 3.x, even though it checks for plugin_weathermap_version() */
function weathermap_version()
{
return plugin_weathermap_version();
}
function plugin_weathermap_check_config()
{
return true;
}
function plugin_weathermap_upgrade()
{
return false;
}
// vim:ts=4:sw=4: