-
Notifications
You must be signed in to change notification settings - Fork 10
/
text.php
executable file
·50 lines (46 loc) · 1.32 KB
/
text.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
<?php
// This include will generate an array named 'result' with formatted informations about your devices and external modules
require_once( 'inc' . DIRECTORY_SEPARATOR . 'global.inc.php' );
header( 'Content-type: text/plain; charset=UTF-8' );
// Only parse informations if 'result' is an array
if ( is_array( $result ) )
{
// Only parse informations if 'result' is not empty
if ( count( $result ) > 0 )
{
// Uncomment the line below to see the structure of the 'result' array in your browser
// var_dump($result); die();
// For all devices -> in my case, I have 3 netamos : at home, at office and at my parents home
foreach ( $result as $data )
{
// get all external modules for the current device
if ( isset( $data[ 'm' ] ) && is_array( $data[ 'm' ] ) )
{
foreach ( $data[ 'm' ] as $moduleid => $datam )
{
echo "id|" . $moduleid . "\n";
echo "name|" . @$datam[ 'name' ] . "\n";
echo "time|" . @$datam[ 'time' ] . "\n";
foreach ( array( 'dashboard' , 'results' , 'misc' ) as $key )
{
if ( ( isset( $datam[ $key ] ) ) && is_array( $datam[ $key ] ) )
{
foreach ( $datam[ $key ] as $k => $v )
{
echo $k . "|" . $v . "\n";
}
}
}
}
}
}
}
else
{
echo __( 'No device' );
}
}
else
{
echo $result->result[ 'error' ][ 'message' ];
}