-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
a.json.php
126 lines (100 loc) · 2.68 KB
/
a.json.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
120
121
122
123
124
125
126
<?php
if(!empty($this->_vars['hash']))
{
Utils::clonos_syslog("instance_jail a.json.php: hash not empty:". $this->_vars['hash']);
include('helpers.php');
// $html=str_replace(array("\n","\r","\t"),'',$html);
// $html=str_replace(array("\n","\r","\t"),'',$html);
// Utils::clonos_syslog("instance_jail a.json.php: HTML:". $html);
// echo $html;
// $html=str_replace(array("\n","\r","\t"),'',$html);
// Utils::clonos_syslog("instance_jail a.json.php: HTML:". $html);
// echo $html;
return;
}
require_once("../php/cbsd.php");
$sys_helpers=array();
// 'network','cbsd','bhyvenet','general','zfsinstall','userspw','natcfg','jconstruct',
//);
$db=new Db('clonos');
if($db!==false)
{
$query="select module from sys_helpers_list";
if(!$db->error)
{
$res=$db->select($query, []);
if(!empty($res))
{
foreach($res as $r) $sys_helpers[]=$r['module'];
}
}
}
$html='';
$arr=array();
$res=CBSD::run('forms header=0', []);
if($res['retval']==0)
{
$empty_logo='/images/logo/empty.png';
$lst=explode("\n",$res['message']);
$n=0;
if(!empty($lst)) foreach($lst as $item)
{
if(in_array($item,$sys_helpers))
{
$description='';
$db=new Db('helper',$item);
if($db!==false)
{
if($db->error)
{
$file_name=$db->getFileName();
if(!file_exists($file_name))
{
$res=CBSD::run('forms module=%s inter=0',[$item]);
if($res['retval']==0)
{
$db=new Db('helper',$item);
}
}
}
if($db!==false && !$db->error) $res=$db->selectOne("select longdesc from system", []);
if(isset($res['longdesc'])) $description=$res['longdesc']; else $description=$this->translate('no data').'… ('.$file_name.')';
}else{
$description='helper connection error!';
}
$hres=$this->getTableChunk('instances','tbody');
if($hres!==false)
{
$html_tpl=$hres[1];
$logo_file='images/logo/'.$item.'.png';
$logo=file_exists($this->realpath_public.$logo_file)?'/'.$logo_file:$empty_logo;
$vars=array(
'nth-num'=>'nth0',
'logo'=>$logo,
'name'=>$item,
'description'=>$description,
'opentitle'=>$this->translate('Open'),
);
foreach($vars as $var=>$val)
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
$html.=$html_tpl;
}
}
}
}
$html=str_replace(array("\n","\r","\t"),'',$html);
//Utils::clonos_syslog("instance_jail a.json.php: HTML:". $html);
/*
echo json_encode(array(
'tbody'=>$html,
'error'=>false,
'func'=>'fillTable',
'id'=>'instanceslist',
));
*/
$included_result_array=array(
'tbody'=>$html,
'error'=>false,
'func'=>'fillTable',
'id'=>'instanceslist',
);