-
Notifications
You must be signed in to change notification settings - Fork 0
/
bases.php
78 lines (62 loc) · 1.32 KB
/
bases.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
<?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>arch</th>
<th>target_arch</th>
<th>ver</th>
</tr>
</thead>
<tbody align="center">
<?php
$res=cbsd_cmd('env NOCOLOR=1 /usr/local/bin/sudo /usr/local/bin/cbsd basels 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) {
$msg = preg_replace('/\s\s+/', ' ',$item);
list($base, $arch, $target_arch, $ver ) = explode(' ', $msg );
if (!isset($arch)) $arch="unknown";
if (!isset($target_arch)) $target_arch="unknown";
if (!isset($ver)) $ver="unknown";
$str .= <<<EOF
<tr>
<td>$arch</td>
<td>$target_arch</td>
<td>$ver</td>
</tr>
EOF;
}
$str .= <<<EOF
</tbody>
</table>
EOF;
echo $str;
echo "\n";