add the roadmap .dia file for 2019Q2
[racktables-contribs] / oneshot.php
1 <?php
2 /*
3 This is a version of local.php file, which implements 'oneshot'
4 extension for RackTables. This extension makes it possible to
5 forward a user to a RackTables object page without knowing the
6 internal ID of that object. This is mainly intended to be used
7 together with other systems like Nagios, which only share
8 object's name in common with RackTables. For example:
9
10 http://example.com/racktables/index.php?page=oneshot&realm=object&q=myserver
11
12 (This would instantly redirect the user to myserver's page in
13 RackTables, if "myserver" exists.)
14
15 This revision of extension has been tested to work with RackTables
16 versions 0.18.x and 0.19.x.
17
18 */
19
20 $page['oneshot']['handler'] = 'handleOneShotRequest';
21
22 function handleOneShotRequest ()
23 {
24 assertStringArg ('realm');
25 assertStringArg ('q');
26 switch ($_REQUEST['realm'])
27 {
28 case 'object':
29 if (NULL === ($id = lookupEntityByString ($_REQUEST['realm'], $_REQUEST['q'])))
30 echo "<h2>Nothing found for '${_REQUEST['q']}'</h2>";
31 else
32 echo "<script language='Javascript'>document.location='index.php?page=object&object_id=${id}';//</script>";
33 break;
34 default:
35 dragon();
36 break;
37 }
38 }