-
Notifications
You must be signed in to change notification settings - Fork 0
/
instance_jail.php
102 lines (82 loc) · 1.84 KB
/
instance_jail.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
<?php
require_once("auth.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CBSD Project</title>
<link type="text/css" href="./css/all.css" rel="stylesheet" />
<style>
body {font-size:80%;font-family:Tahoma,'Sans-Serif',Arial;}
thead {color:green;}
tbody {color:blue;}
</style>
</head>
<body>
<a href="javascript:location.reload(true)">[ Refresh Page ]</a>
<script>
</script>
<?php
$rp=realpath('');
include_once($rp.'/cbsd_cmd.php');
require('cbsd.php');
?>
<table class="images">
<thead>
<tr>
<th></th>
<th>instance</th>
<th>description</th>
</tr>
</thead>
<tbody align="center">
<?php
$res=cbsd_cmd('env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd imghelper header=0');
if ($res['retval'] != 0 ) {
if (!empty($res['error_message']))
echo $res['error_message'];
exit(1);
}
$lst=explode("\n",$res['message']);
$n=0;
$str="";
if(!empty($lst)) foreach($lst as $item) {
$dbfilepath=$workdir."/formfile/".$item.".sqlite";
$longdesc="unable to fetch desc";
if (file_exists($dbfilepath)) {
$db = new SQLite3($dbfilepath); $db->busyTimeout(5000);
$helpers = $db->query('SELECT longdesc FROM system');
if (!($helpers instanceof Sqlite3Result)) {
echo "Error: $dbfilepath";
} else {
while ($row = $helpers->fetchArray()) {
list( $longdesc ) = $row;
}
$db->close();
}
}
if (file_exists("img/logo/$item.svg")) {
$imgsrc="img/logo/$item.svg";
} else {
$imgsrc="img/logo/empty.svg";
}
$str .= <<<EOF
<tr>
<td>
<a href="/helper.php?helper=$item"><img src="$imgsrc" width="200" height="100" alt="$item.svg"></a>
</td>
<td>
<a href="/helper.php?helper=$item">$item</a>
</td>
<td>
$longdesc
</td>
</tr>
EOF;
}
$str .= <<<EOF
</tbody>
</table>
EOF;
echo $str;
echo "\n";