mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-30 01:22:24 +00:00
@@ -1,46 +1,35 @@
|
||||
<?php
|
||||
|
||||
$db=new Db('base','authkey');
|
||||
$res=$db->select('SELECT idx,name,authkey FROM authkey;', []);
|
||||
$db = new Db('base','authkey');
|
||||
$res = $db->select('SELECT idx,name,authkey FROM authkey;', []);
|
||||
$html = '';
|
||||
|
||||
$html='';
|
||||
if($res!==false)
|
||||
{
|
||||
$nth=0;
|
||||
$num=$nth & 1;
|
||||
if($res !== false){
|
||||
$nth = 0;
|
||||
$num = $nth & 1;
|
||||
|
||||
if(!empty($res)) foreach($res as $item)
|
||||
{
|
||||
$hres=$this->getTableChunk('authkeyslist','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tmp=$hres[1];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'keyid'=>$item['idx'],
|
||||
'keyname'=>$item['name'],
|
||||
'keysrc'=>$item['authkey'],
|
||||
'deltitle'=>' title="'.$this->translate('Delete').'"',
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tmp=str_replace('#'.$var.'#',$val,$html_tmp);
|
||||
|
||||
$html.=$html_tmp;
|
||||
foreach($res as $item){
|
||||
$hres = $this->getTableChunk('authkeyslist', 'tbody');
|
||||
if($hres !== false){
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'keyid' => $item['idx'],
|
||||
'keyname' => $item['name'],
|
||||
'keysrc' => $item['authkey'],
|
||||
'deltitle' => ' title="'.$this->translate('Delete').'"'
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tmp = str_replace('#'.$var.'#', $val, $hres[1]);
|
||||
}
|
||||
$html .= $html_tmp;
|
||||
}
|
||||
}
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'authkeyslist',
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'authkeyslist',
|
||||
);
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'authkeyslist'
|
||||
];
|
||||
}
|
||||
@@ -1,108 +1,88 @@
|
||||
<?php
|
||||
$html='';
|
||||
|
||||
$db=new Db('base','nodes');
|
||||
$nodes=$db->select('select nodename,ip from nodelist order by nodename desc', []);
|
||||
$nodes[]=array('nodename'=>'local');
|
||||
$nodes=array_reverse($nodes);
|
||||
$db = new Db('base','nodes');
|
||||
$nodes = $db->select('select nodename,ip from nodelist order by nodename desc', []);
|
||||
$nodes[] = ['nodename' => 'local'];
|
||||
$nodes = array_reverse($nodes);
|
||||
|
||||
$ids=array();
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('baseslist','tbody');
|
||||
if(!empty($nodes))foreach($nodes as $node)
|
||||
{
|
||||
$db1=new Db('base',$node['nodename']);
|
||||
if($db1!==false)
|
||||
{
|
||||
$bases=$db1->select("SELECT idx,platform,name,arch,targetarch,ver,stable,elf,date FROM bsdbase order by cast(ver AS int)", []);
|
||||
|
||||
$num=$nth & 1;
|
||||
if(!empty($bases)) foreach($bases as $base)
|
||||
{
|
||||
$idle=1;
|
||||
//print_r($node);exit;
|
||||
if($node['nodename']!='local')
|
||||
{
|
||||
$idle=$this->check_locktime($node['ip']);
|
||||
$ids = [];
|
||||
$nth = 0;
|
||||
$html = '';
|
||||
$html_tpl = '';
|
||||
$hres = $this->getTableChunk('baseslist','tbody');
|
||||
|
||||
foreach($nodes as $node){
|
||||
|
||||
$db1 = new Db('base', $node['nodename']);
|
||||
if(!$db1->error){
|
||||
|
||||
$bases = $db1->select("SELECT idx,platform,name,arch,targetarch,ver,stable,elf,date FROM bsdbase order by cast(ver AS int)", []);
|
||||
$num = $nth & 1;
|
||||
|
||||
foreach($bases as $base){
|
||||
$idle = 1;
|
||||
if($node['nodename'] != 'local'){
|
||||
$idle = $this->check_locktime($node['ip']);
|
||||
}
|
||||
|
||||
$ids[] = $base['idx'];
|
||||
$id = 'base'.$base['ver'].'-'.$base['arch'].'-'.$base['stable'];
|
||||
|
||||
$ids[]=$base['idx'];
|
||||
$id='base'.$base['ver'].'-'.$base['arch'].'-'.$base['stable'];
|
||||
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tpl=$hres[1];
|
||||
$vars=array(
|
||||
'id'=>$id,
|
||||
'nth-num'=>'nth'.$num,
|
||||
'node'=>$node['nodename'],
|
||||
'name'=>$base['name'],
|
||||
'platform'=>$base['platform'],
|
||||
'arch'=>$base['arch'],
|
||||
'targetarch'=>$base['targetarch'],
|
||||
'version'=>$base['ver'],
|
||||
'version1'=>($base['stable']==1)?'stable':'release',
|
||||
'elf'=>$base['elf'],
|
||||
'date'=>$base['date'],
|
||||
'jstatus'=>'',
|
||||
'maintenance'=>($idle==0)?' maintenance':'',
|
||||
'deltitle'=>$this->translate('Delete'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
|
||||
$html.=$html_tpl;
|
||||
if($hres !== false){
|
||||
$vars = [
|
||||
'id' => $id,
|
||||
'nth-num' => 'nth'.$num,
|
||||
'node' => $node['nodename'],
|
||||
'name' => $base['name'],
|
||||
'platform' => $base['platform'],
|
||||
'arch' => $base['arch'],
|
||||
'targetarch' => $base['targetarch'],
|
||||
'version' => $base['ver'],
|
||||
'version1' => ($base['stable']==1) ? 'stable' : 'release',
|
||||
'elf' => $base['elf'],
|
||||
'date' => $base['date'],
|
||||
'jstatus' => '',
|
||||
'maintenance' => ($idle == 0) ? ' maintenance' : '',
|
||||
'deltitle' => $this->translate('Delete')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $hres[1]);
|
||||
}
|
||||
$html .= $html_tpl;
|
||||
}
|
||||
|
||||
//$ids[]='#base'.$bid;
|
||||
|
||||
$ids[]='#'.$id;
|
||||
}
|
||||
|
||||
$nth++;
|
||||
}
|
||||
}
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
$tasks = (empty($ids)) ? '' : $tasks = $this->getRunningTasks($ids);
|
||||
|
||||
$tasks='';
|
||||
if(!empty($ids))
|
||||
{
|
||||
$tasks=$this->getRunningTasks($ids);
|
||||
if($hres !== false){
|
||||
$html_tpl = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'status' => '',
|
||||
//'jstatus' => $this->translate('Updating'),
|
||||
//'icon' => 'spin6 animate-spin',
|
||||
'desktop' => ' s-off',
|
||||
'maintenance' => ' maintenance busy',
|
||||
'updtitle' => $this->translate('Update'),
|
||||
'deltitle' => $this->translate('Delete')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
}
|
||||
}
|
||||
|
||||
$html_tpl=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||
if($hres!==false)
|
||||
{
|
||||
$vars=array(
|
||||
'nth-num'=>'nth0',
|
||||
'status'=>'',
|
||||
//'jstatus'=>$this->translate('Updating'),
|
||||
//'icon'=>'spin6 animate-spin',
|
||||
'desktop'=>' s-off',
|
||||
'maintenance'=>' maintenance busy',
|
||||
'updtitle'=>$this->translate('Update'),
|
||||
'deltitle'=>$this->translate('Delete'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
}
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'baseslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl,
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'baseslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl,
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'baseslist',
|
||||
'tasks' => $tasks,
|
||||
'template' => $html_tpl
|
||||
];
|
||||
@@ -1,146 +1,125 @@
|
||||
<?php
|
||||
$html='';
|
||||
|
||||
//$hres=$this->getTableChunk('jailslist','thead');
|
||||
//if($hres!==false) $thead=$hres[1];
|
||||
|
||||
$db=new Db('base','nodes');
|
||||
$res=$db->select('select nodename from nodelist', []);
|
||||
$nodes=array('local');
|
||||
if(!empty($res))foreach($res as $val) $nodes[]=$val['nodename'];
|
||||
$db = new Db('base','nodes');
|
||||
$res = $db->select('select nodename from nodelist', []);
|
||||
$nodes = ['local'];
|
||||
foreach($res as $val){
|
||||
$nodes[] = $val['nodename'];
|
||||
}
|
||||
|
||||
$statuses=array('Not Launched','Launched','unknown-1','Maintenance','unknown-3','unknown-4','unknown-5','unknown-6');
|
||||
$allnodes=array();
|
||||
$statuses = ['Not Launched','Launched','unknown-1','Maintenance','unknown-3','unknown-4','unknown-5','unknown-6'];
|
||||
$allnodes = [];
|
||||
$jail_ids = [];
|
||||
$nth = 0;
|
||||
$html = '';
|
||||
$html_tpl_1 = '';
|
||||
$hres = $this->getTableChunk('bhyveslist','tbody');
|
||||
|
||||
$jail_ids=array();
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('bhyveslist','tbody');
|
||||
if(!empty($nodes))foreach($nodes as $node)
|
||||
{
|
||||
$db1=new Db('base',$node);
|
||||
if($db1!==false)
|
||||
{
|
||||
$bhyves=$db1->select("SELECT jname,vm_ram,vm_cpus,vm_os_type,hidden,protected,bhyve_vnc_tcp_bind FROM bhyve where hidden!=1 order by jname asc;", []);
|
||||
foreach($nodes as $node){
|
||||
$db1 = new Db('base', $node);
|
||||
if(!$db1->error){
|
||||
$bhyves = $db1->select("SELECT jname,vm_ram,vm_cpus,vm_os_type,hidden,protected,bhyve_vnc_tcp_bind FROM bhyve where hidden!=1 order by jname asc;", []);
|
||||
//$allnodes[$node]=$bhyves;
|
||||
|
||||
$num=$nth & 1;
|
||||
if(!empty($bhyves)) foreach($bhyves as $bhyve)
|
||||
{
|
||||
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tpl=$hres[1];
|
||||
$status=$this->check_vmonline($bhyve['jname']);
|
||||
$num = $nth & 1;
|
||||
foreach($bhyves as $bhyve){
|
||||
if($hres !== false){
|
||||
|
||||
$jname=$bhyve['jname'];
|
||||
$vnc_port_status='grey';
|
||||
$vnc_ip=$bhyve['bhyve_vnc_tcp_bind'];
|
||||
if($status==1)
|
||||
{
|
||||
$vnc_port_file=$this->workdir.'/jails-system/'.$jname.'/vnc_port';
|
||||
if(file_exists($vnc_port_file))
|
||||
{
|
||||
$vnc_port=trim(file_get_contents($vnc_port_file));
|
||||
$status = $this->check_vmonline($bhyve['jname']);
|
||||
$vnc_port_status = 'grey';
|
||||
|
||||
if($status == 1){
|
||||
$vnc_port_file = $this->workdir.'/jails-system/'.$bhyve['jname'].'/vnc_port';
|
||||
if(file_exists($vnc_port_file)){
|
||||
$vnc_port = trim(file_get_contents($vnc_port_file));
|
||||
}
|
||||
}else{
|
||||
$vnc_port='';
|
||||
} else {
|
||||
$vnc_port = '';
|
||||
}
|
||||
if($vnc_ip!='127.0.0.1') $vnc_port_status='black';
|
||||
|
||||
$vars=array(
|
||||
'jname'=>$bhyve['jname'],
|
||||
'nth-num'=>'nth'.$num,
|
||||
'desktop'=>'',
|
||||
'maintenance'=>'',
|
||||
'node'=>$node,
|
||||
'vm_name'=>'',
|
||||
'vm_ram'=>$this->fileSizeConvert($bhyve['vm_ram']),
|
||||
'vm_cpus'=>$bhyve['vm_cpus'],
|
||||
'vm_os_type'=>$bhyve['vm_os_type'],
|
||||
'vm_status'=>$this->translate($statuses[$status]),
|
||||
'desktop'=>($status==0)?' s-off':' s-on',
|
||||
'icon'=>($status==0)?'play':'stop',
|
||||
'protected'=>($bhyve['protected']==1)?'icon-lock':'icon-cancel',
|
||||
'protitle'=>' title="'.$this->translate('Delete').'"',
|
||||
// 'maintenance'=>($status==3)?' maintenance':'',
|
||||
// 'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
||||
// 'protitle'=>($jail['protected']==1)?' title="'.$this->translate('Protected jail').'"':' title="'.$this->translate('Delete').'"',
|
||||
'vnc_title'=>$this->translate('Open VNC'),
|
||||
'reboot_title'=>$this->translate('Restart bhyve'),
|
||||
'vnc_port'=>$vnc_port,
|
||||
'vnc_port_status'=>$vnc_port_status,
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
|
||||
if($node!='local') $html_tpl=str_replace('<span class="icon-cog"></span>','',$html_tpl);
|
||||
|
||||
$html.=$html_tpl;
|
||||
|
||||
if($bhyve['bhyve_vnc_tcp_bind'] != '127.0.0.1'){
|
||||
$vnc_port_status = 'black';
|
||||
}
|
||||
|
||||
$vars = [
|
||||
'jname' => $bhyve['jname'],
|
||||
'nth-num' => 'nth'.$num,
|
||||
'desktop' => '',
|
||||
'maintenance' => '',
|
||||
'node' => $node,
|
||||
'vm_name' => '',
|
||||
'vm_ram' => $this->fileSizeConvert($bhyve['vm_ram']),
|
||||
'vm_cpus' => $bhyve['vm_cpus'],
|
||||
'vm_os_type' => $bhyve['vm_os_type'],
|
||||
'vm_status' => $this->translate($statuses[$status]),
|
||||
'desktop' => ($status == 0) ? ' s-off' : ' s-on',
|
||||
'icon' => ($status == 0) ? 'play' : 'stop',
|
||||
'protected' => ($bhyve['protected'] == 1) ? 'icon-lock' : 'icon-cancel',
|
||||
'protitle' => ' title="'.$this->translate('Delete').'"',
|
||||
// 'maintenance' => ($status == 3) ? ' maintenance' : '',
|
||||
// 'protected' => ($jail['protected'] == 1 ) ? 'icon-lock' : 'icon-cancel',
|
||||
// 'protitle' => ($jail['protected'] == 1) ? ' title="'.$this->translate('Protected jail').'"' : ' title="'.$this->translate('Delete').'"',
|
||||
'vnc_title' => $this->translate('Open VNC'),
|
||||
'reboot_title' => $this->translate('Restart bhyve'),
|
||||
'vnc_port' => $vnc_port,
|
||||
'vnc_port_status' => $vnc_port_status
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $hres[1]);
|
||||
}
|
||||
if($node != 'local'){
|
||||
$html_tpl = str_replace('<span class="icon-cog"></span>', '', $html_tpl);
|
||||
}
|
||||
$html .= $html_tpl;
|
||||
}
|
||||
|
||||
$bhyve_ids[]=$bhyve['jname'];
|
||||
|
||||
$bhyve_ids[] = $bhyve['jname'];
|
||||
}
|
||||
|
||||
$nth++;
|
||||
}
|
||||
}
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
$tasks = (empty($bhyve_ids)) ? '' : $this->getRunningTasks($bhyve_ids);
|
||||
|
||||
$tasks='';
|
||||
if(!empty($bhyve_ids))
|
||||
{
|
||||
$tasks=$this->getRunningTasks($bhyve_ids);
|
||||
if($hres !== false){
|
||||
$html_tpl_1 = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'vm_status' => $this->translate('Creating'),
|
||||
'icon' => 'spin6 animate-spin',
|
||||
'desktop' => ' s-off',
|
||||
'maintenance' => ' maintenance busy',
|
||||
'protected' => 'icon-cancel',
|
||||
'protitle' => '',
|
||||
'vnc_title' => $this->translate('Open VNC'),
|
||||
'reboot_title' => $this->translate('Restart jail')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl_1 = str_replace('#'.$var.'#', $val, $html_tpl_1);
|
||||
}
|
||||
}
|
||||
|
||||
$html_tpl_1=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||
if($hres!==false)
|
||||
{
|
||||
$vars=array(
|
||||
'nth-num'=>'nth0',
|
||||
'vm_status'=>$this->translate('Creating'),
|
||||
'icon'=>'spin6 animate-spin',
|
||||
'desktop'=>' s-off',
|
||||
'maintenance'=>' maintenance busy',
|
||||
'protected'=>'icon-cancel',
|
||||
'protitle'=>'',
|
||||
'vnc_title'=>$this->translate('Open VNC'),
|
||||
'reboot_title'=>$this->translate('Restart jail'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl_1=str_replace('#'.$var.'#',$val,$html_tpl_1);
|
||||
}
|
||||
$protected = [
|
||||
0 => [
|
||||
'icon' => 'icon-cancel',
|
||||
'title' => $this->translate('Delete')
|
||||
],
|
||||
1 => [
|
||||
'icon' => 'icon-lock',
|
||||
'title' => $this->translate('Protected bhyve')
|
||||
]
|
||||
];
|
||||
|
||||
$protected=array(
|
||||
0=>array(
|
||||
'icon'=>'icon-cancel',
|
||||
'title'=>$this->translate('Delete')
|
||||
),
|
||||
1=>array(
|
||||
'icon'=>'icon-lock',
|
||||
'title'=>$this->translate('Protected bhyve')
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'bhyveslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl_1,
|
||||
'protected'=>$protected,
|
||||
));
|
||||
*/
|
||||
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'bhyveslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl_1,
|
||||
'protected'=>$protected,
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'bhyveslist',
|
||||
'tasks' => $tasks,
|
||||
'template' => $html_tpl_1,
|
||||
'protected' => $protected
|
||||
];
|
||||
|
||||
@@ -1,110 +1,85 @@
|
||||
<?php
|
||||
|
||||
$res=array(
|
||||
// 'item'=>array(
|
||||
0=>array(
|
||||
'id'=>1,
|
||||
'name'=>'test',
|
||||
'path'=>'test/test/',
|
||||
'type'=>'клетка',
|
||||
)
|
||||
// )
|
||||
);
|
||||
|
||||
$images=$this->getImportedImages();
|
||||
|
||||
$html='';
|
||||
$nth=0;
|
||||
$num=$nth & 1;
|
||||
$html_tpl='';
|
||||
|
||||
$hres=$this->getTableChunk('impslist','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tmp=$hres[1];
|
||||
$html_tmp=replaceVars($html_tmp,array(
|
||||
'deltitle'=>' title="'.$this->translate('Delete').'"',
|
||||
'dnldtitle'=>' title="'.$this->translate('Download').'"',
|
||||
'imptitle'=>' title="'.$this->translate('Create').'"')
|
||||
);
|
||||
$html_tpl_1=$html_tmp;
|
||||
}
|
||||
|
||||
if(!empty($images)) foreach($images as $item)
|
||||
{
|
||||
if(!isset($item['type'])) $item['type']='unknown';
|
||||
//$hres=$this->getTableChunk('impslist','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
/*
|
||||
$html_tmp=$hres[1];
|
||||
$html_tmp=replaceVars($html_tmp,array(
|
||||
'deltitle'=>' title="'.$this->translate('Delete').'"',
|
||||
'dnldtitle'=>' title="'.$this->translate('Download').'"',
|
||||
'imptitle'=>' title="'.$this->translate('Create').'"')
|
||||
);
|
||||
$html_tpl=$html_tmp;
|
||||
*/
|
||||
$html_tpl=$html_tmp;
|
||||
$filename=$this->media_import.$item['name'];
|
||||
$sizefilename=$filename.'.size';
|
||||
if(file_exists($sizefilename))
|
||||
{
|
||||
$size=file_get_contents($sizefilename);
|
||||
}else{
|
||||
$size=filesize($filename);
|
||||
}
|
||||
$filesize=$this->fileSizeConvert($size,1024,true);
|
||||
|
||||
$query="select count(*) as busy from taskd where status<2 and jname='${item['jname']}'";
|
||||
$busy=$this->_db_tasks->selectOne($query, []);
|
||||
$jstatus='';
|
||||
$jbusy='';
|
||||
if($busy['busy']==1)
|
||||
{
|
||||
$jstatus=$this->translate('Exporting');
|
||||
$jbusy='busy';
|
||||
}
|
||||
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'id'=>$item['name'],
|
||||
'jname'=>$item['name'],
|
||||
'impsize'=>$filesize,
|
||||
'jstatus'=>$jstatus,
|
||||
'busy'=>$jbusy,
|
||||
'imptype'=>$this->translate($item['type']),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
// $html_tmp=str_replace('#'.$var.'#',$val,$html_tmp);
|
||||
|
||||
$html.=$html_tpl;
|
||||
function replaceVars($tpl,$vars){
|
||||
foreach($vars as $var => $val){
|
||||
$tpl = str_replace('#'.$var.'#', $val, $tpl);
|
||||
}
|
||||
}
|
||||
|
||||
function replaceVars($tpl,$vars)
|
||||
{
|
||||
foreach($vars as $var=>$val)
|
||||
$tpl=str_replace('#'.$var.'#',$val,$tpl);
|
||||
return $tpl;
|
||||
}
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'impslist',
|
||||
'template'=>$html_tpl_1,
|
||||
));
|
||||
*/
|
||||
$res = [
|
||||
// 'item' => [
|
||||
0 => [
|
||||
'id' => 1,
|
||||
'name' => 'test',
|
||||
'path' => 'test/test/',
|
||||
'type' => 'клетка'
|
||||
]
|
||||
// ]
|
||||
];
|
||||
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'impslist',
|
||||
'template'=>$html_tpl_1,
|
||||
);
|
||||
$images = $this->getImportedImages();
|
||||
|
||||
$html = '';
|
||||
$html_tpl_1 = '';
|
||||
$nth = 0;
|
||||
$num = $nth & 1;
|
||||
$html_tpl = '';
|
||||
|
||||
$hres = $this->getTableChunk('impslist','tbody');
|
||||
if($hres !== false){
|
||||
$html_tpl_1 = replaceVars($hres[1], [
|
||||
'deltitle' => ' title="'.$this->translate('Delete').'"',
|
||||
'dnldtitle' => ' title="'.$this->translate('Download').'"',
|
||||
'imptitle' => ' title="'.$this->translate('Create').'"'
|
||||
]);
|
||||
}
|
||||
|
||||
foreach($images as $item){
|
||||
if(!isset($item['type'])){
|
||||
$item['type'] = 'unknown';
|
||||
}
|
||||
//$hres=$this->getTableChunk('impslist','tbody');
|
||||
if($hres !== false){
|
||||
$html_tpl = $html_tpl_1;
|
||||
$filename = $this->media_import.$item['name'];
|
||||
$sizefilename = $filename.'.size';
|
||||
if(file_exists($sizefilename)){
|
||||
$size = file_get_contents($sizefilename);
|
||||
} else {
|
||||
$size = filesize($filename);
|
||||
}
|
||||
$filesize = $this->fileSizeConvert($size, 1024, true);
|
||||
$query = "select count(*) as busy from taskd where status<2 and jname='".$item['jname']."'";
|
||||
$busy = $this->_db_tasks->selectOne($query, []);
|
||||
$jstatus = '';
|
||||
$jbusy = '';
|
||||
if($busy['busy'] == 1){
|
||||
$jstatus = $this->translate('Exporting');
|
||||
$jbusy = 'busy';
|
||||
}
|
||||
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'id' => $item['name'],
|
||||
'jname' => $item['name'],
|
||||
'impsize' => $filesize,
|
||||
'jstatus' => $jstatus,
|
||||
'busy' => $jbusy,
|
||||
'imptype' => $this->translate($item['type'])
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
}
|
||||
$html .= $html_tpl;
|
||||
}
|
||||
}
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'impslist',
|
||||
'template' => $html_tpl_1
|
||||
];
|
||||
@@ -1,83 +1,72 @@
|
||||
<?php
|
||||
$jail_name='';
|
||||
if(isset($this->uri_chunks[1])) $jail_name=$this->uri_chunks[1];
|
||||
if(!empty($jail_name))
|
||||
{
|
||||
|
||||
if(isset($this->uri_chunks[1])){
|
||||
$jail_name = $this->uri_chunks[1];
|
||||
include('helpers.json.php');
|
||||
return;
|
||||
}
|
||||
|
||||
$db = new Db('base','nodes');
|
||||
$res = $db->select('select nodename from nodelist', []);
|
||||
$nodes = ['local'];
|
||||
foreach($res as $val){
|
||||
$nodes[] = $val['nodename'];
|
||||
}
|
||||
|
||||
$html='';
|
||||
//$hres=$this->getTableChunk('jailslist','thead');
|
||||
//if($hres!==false) $thead=$hres[1];
|
||||
$html = '';
|
||||
$html_tpl_1 = '';
|
||||
$statuses = ['Not Launched','Launched','unknown-1','Maintenance','unknown-3','unknown-4','unknown-5','unknown-6'];
|
||||
$allnodes = [];
|
||||
$jail_ids = [];
|
||||
$nth = 0;
|
||||
$hres = $this->getTableChunk('jailslist','tbody');
|
||||
|
||||
$db=new Db('base','nodes');
|
||||
$res=$db->select('select nodename from nodelist', []);
|
||||
$nodes=array('local');
|
||||
if(!empty($res))foreach($res as $val) $nodes[]=$val['nodename'];
|
||||
foreach($nodes as $node){
|
||||
$db1 = new Db('base', $node);
|
||||
if(!$db1->error){
|
||||
|
||||
$statuses=array('Not Launched','Launched','unknown-1','Maintenance','unknown-3','unknown-4','unknown-5','unknown-6');
|
||||
$allnodes=array();
|
||||
$jails = $db1->select("SELECT jname,ip4_addr,status,protected FROM jails WHERE emulator!='bhyve' and hidden!=1 order by jname asc;", []);
|
||||
$allnodes[$node] = $jails;
|
||||
$num = $nth & 1;
|
||||
|
||||
$jail_ids=array();
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('jailslist','tbody');
|
||||
if(!empty($nodes))foreach($nodes as $node)
|
||||
{
|
||||
$db1=new Db('base',$node);
|
||||
if($db1!==false)
|
||||
{
|
||||
$jails=$db1->select("SELECT jname,ip4_addr,status,protected FROM jails WHERE emulator!='bhyve' and hidden!=1 order by jname asc;", []);
|
||||
|
||||
Utils::clonos_syslog("jailscontainers a.json.php:" . "SELECT jname,ip4_addr,status,protected FROM jails WHERE emulator!='bhyve' and hidden!=1 order by jname asc;");
|
||||
|
||||
$allnodes[$node]=$jails;
|
||||
|
||||
$num=$nth & 1;
|
||||
if(!empty($jails)) foreach($jails as $jail)
|
||||
{
|
||||
if($hres!==false)
|
||||
{
|
||||
$jname=$jail['jname'];
|
||||
$vnc_port_status='grey';
|
||||
$vnc_port='';
|
||||
$vnc_port_file=$this->workdir.'/jails-system/'.$jname.'/vnc_port';
|
||||
if(file_exists($vnc_port_file))
|
||||
{
|
||||
$vnc_port=trim(file_get_contents($vnc_port_file));
|
||||
foreach($jails as $jail){
|
||||
if($hres !== false){
|
||||
$vnc_port = '';
|
||||
$vnc_port_file = $this->workdir.'/jails-system/'.$jail['jname'].'/vnc_port';
|
||||
if(file_exists($vnc_port_file)){
|
||||
$vnc_port = trim(file_get_contents($vnc_port_file));
|
||||
}
|
||||
|
||||
$html_tpl=$hres[1];
|
||||
$status=$jail['status'];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'node'=>$node,
|
||||
'ip4_addr'=>str_replace(',',',<wbr />',$jail['ip4_addr']),
|
||||
'jname'=>$jname,
|
||||
'vnc_port'=>$vnc_port,
|
||||
'vnc_port_status'=>$vnc_port_status,
|
||||
'status'=>$status,
|
||||
'jstatus'=>$this->translate($statuses[$status]),
|
||||
'icon'=>($status==0)?'play':'stop',
|
||||
'desktop'=>($status==0)?' s-off':' s-on',
|
||||
'maintenance'=>($status==3)?' maintenance':'',
|
||||
'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
||||
'protitle'=>($jail['protected']==1)?' title="'.$this->translate('Protected jail').'"':' title="'.$this->translate('Delete').'"',
|
||||
'vnc_title'=>$this->translate('Open VNC'),
|
||||
'reboot_title'=>$this->translate('Restart jail'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
|
||||
if($node!='local') $html_tpl=str_replace('<span class="icon-cog"></span>','',$html_tpl);
|
||||
|
||||
$html.=$html_tpl;
|
||||
$html_tpl = $hres[1];
|
||||
$status = $jail['status'];
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'node' => $node,
|
||||
'ip4_addr' => str_replace(',',',<wbr />', $jail['ip4_addr']),
|
||||
'jname' => $jail['jname'],
|
||||
'vnc_port' => $vnc_port,
|
||||
'vnc_port_status' => 'grey',
|
||||
'status' => $status,
|
||||
'jstatus' => $this->translate($statuses[$status]),
|
||||
'icon' => ($status == 0) ? 'play' : 'stop',
|
||||
'desktop' => ($status == 0) ? ' s-off' : ' s-on',
|
||||
'maintenance' => ($status == 3) ? ' maintenance' : '',
|
||||
'protected' => ($jail['protected'] == 1) ? 'icon-lock' : 'icon-cancel',
|
||||
'protitle' => ($jail['protected'] == 1) ? ' title="'.$this->translate('Protected jail').'"' : ' title="'.$this->translate('Delete').'"',
|
||||
'vnc_title' => $this->translate('Open VNC'),
|
||||
'reboot_title' => $this->translate('Restart jail'),
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
}
|
||||
if($node != 'local'){
|
||||
$html_tpl = str_replace('<span class="icon-cog"></span>', '', $html_tpl);
|
||||
}
|
||||
$html .= $html_tpl;
|
||||
}
|
||||
|
||||
$jail_ids[]=$jail['jname'];
|
||||
|
||||
|
||||
$jail_ids[] = $jail['jname'];
|
||||
|
||||
/*
|
||||
$jname=$jail['jname'];
|
||||
$jail_ids[]=$jname;
|
||||
@@ -93,7 +82,7 @@ if(!empty($nodes))foreach($nodes as $node)
|
||||
$reboot_title=$this->translate('Restart jail');
|
||||
$html.=
|
||||
<<<EOT
|
||||
<tr class="nth{$num}{$desktop}{$maintenance}" id="{$jname}">
|
||||
<tr class="nth{$num}{$desktop}{$maintenance}" id="{$jail['jname']}">
|
||||
<td>{$node}</td>
|
||||
<td class="txtleft">{$jail['jname']}</td>
|
||||
<td class="txtleft jname">{$jail['ip4_addr']}</td>
|
||||
@@ -107,70 +96,51 @@ if(!empty($nodes))foreach($nodes as $node)
|
||||
EOT;
|
||||
*/
|
||||
}
|
||||
|
||||
$nth++;
|
||||
} else {
|
||||
Utils::clonos_syslog("jailscontainers a.json.php: DB1 FALSE");
|
||||
}
|
||||
}
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
$tasks = (empty($jail_ids)) ? '' : $this->getRunningTasks($jail_ids);
|
||||
|
||||
$tasks='';
|
||||
if(!empty($jail_ids))
|
||||
{
|
||||
$tasks=$this->getRunningTasks($jail_ids);
|
||||
}
|
||||
//echo '<pre>';print_r($tasks);exit;
|
||||
$html_tpl_1=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||
if($hres!==false)
|
||||
{
|
||||
$vars=array(
|
||||
'nth-num'=>'nth0',
|
||||
'status'=>'',
|
||||
'jstatus'=>$this->translate('Creating'),
|
||||
'icon'=>'spin6 animate-spin',
|
||||
'desktop'=>' s-off',
|
||||
'maintenance'=>' maintenance busy',
|
||||
'protected'=>'icon-cancel',
|
||||
'protitle'=>'',
|
||||
'vnc_title'=>$this->translate('Open VNC'),
|
||||
'reboot_title'=>$this->translate('Restart jail'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl_1=str_replace('#'.$var.'#',$val,$html_tpl_1);
|
||||
if($hres !== false){
|
||||
$html_tpl_1 = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'status' => '',
|
||||
'jstatus' => $this->translate('Creating'),
|
||||
'icon' => 'spin6 animate-spin',
|
||||
'desktop' => ' s-off',
|
||||
'maintenance' => ' maintenance busy',
|
||||
'protected' => 'icon-cancel',
|
||||
'protitle' => '',
|
||||
'vnc_title' => $this->translate('Open VNC'),
|
||||
'reboot_title' => $this->translate('Restart jail')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl_1 = str_replace('#'.$var.'#', $val, $html_tpl_1);
|
||||
}
|
||||
}
|
||||
|
||||
$protected=array(
|
||||
0=>array(
|
||||
'icon'=>'icon-cancel',
|
||||
'title'=>$this->translate('Delete')
|
||||
),
|
||||
1=>array(
|
||||
'icon'=>'icon-lock',
|
||||
'title'=>$this->translate('Protected jail')
|
||||
)
|
||||
);
|
||||
$protected = [
|
||||
0 => [
|
||||
'icon' => 'icon-cancel',
|
||||
'title' => $this->translate('Delete')
|
||||
],
|
||||
1 => [
|
||||
'icon' => 'icon-lock',
|
||||
'title' => $this->translate('Protected jail')
|
||||
]
|
||||
];
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
// 'thead'=>$thead,
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'jailslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl_1,
|
||||
'protected'=>$protected,
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'jailslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl_1,
|
||||
'protected'=>$protected,
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'jailslist',
|
||||
'tasks' => $tasks,
|
||||
'template' => $html_tpl_1,
|
||||
'protected' => $protected
|
||||
];
|
||||
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
if(isset($clonos->uri_chunks[1]))
|
||||
{
|
||||
if(isset($clonos->uri_chunks[1])){
|
||||
include('helpers.php');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$clonos->useDialogs(array(
|
||||
$clonos->useDialogs([
|
||||
'vnc',
|
||||
'jail-settings',
|
||||
'jail-settings-config-menu',
|
||||
'jail-import',
|
||||
'jail-clone',
|
||||
'jail-rename',
|
||||
));
|
||||
]);
|
||||
|
||||
?>
|
||||
<h1>Jail containers:</h1>
|
||||
|
||||
@@ -1,113 +1,95 @@
|
||||
<?php
|
||||
$hash=$this->url_hash;
|
||||
if(empty($hash))
|
||||
{
|
||||
$hash = $this->url_hash;
|
||||
if(empty($hash)){
|
||||
# Узнаём список хелперов
|
||||
$jails_helpers=array();
|
||||
$db=new Db('clonos');
|
||||
if($db!==false)
|
||||
{
|
||||
$query="select module from jails_helpers_list";
|
||||
if(!$db->error)
|
||||
{
|
||||
$res=$db->select($query, []);
|
||||
if(!empty($res))
|
||||
{
|
||||
foreach($res as $r) $jails_helpers[]=$r['module'];
|
||||
$jails_helpers = [];
|
||||
$db = new Db('clonos');
|
||||
if (!$db->error){
|
||||
$res = $db->select("select module from jails_helpers_list", []);
|
||||
if(!empty($res)){
|
||||
foreach($res as $r){
|
||||
$jails_helpers[] = $r['module'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lst=array();
|
||||
if(!empty($jails_helpers)) foreach($jails_helpers as $helper)
|
||||
{
|
||||
$db=new Db('helper',array('jname'=>$jail_name,'helper'=>$helper));
|
||||
$lst = [];
|
||||
foreach($jails_helpers as $helper){
|
||||
$db = new Db('helper', ['jname' => $jail_name, 'helper' => $helper]);
|
||||
if(!$db->error) // !error — значит хелпер установлен
|
||||
{
|
||||
$res=$db->selectOne("select longdesc from system", []);
|
||||
if(isset($res['longdesc'])) $description=$res['longdesc']; else $description=$this->translate('no data').'… ('.$file_name.')';
|
||||
$lst[]=array('helper'=>$helper,'description'=>$description);
|
||||
}else{
|
||||
$hlst[]=$helper;
|
||||
$res = $db->selectOne("select longdesc from system", []);
|
||||
if(isset($res['longdesc'])){
|
||||
$description = $res['longdesc'];
|
||||
} else {
|
||||
$description = $this->translate('no data').'… ('.$file_name.')';
|
||||
}
|
||||
$lst[] = ['helper' => $helper, 'description' => $description];
|
||||
} else {
|
||||
$hlst[] = $helper;
|
||||
}
|
||||
}
|
||||
|
||||
$html='';
|
||||
$html_tpl='';
|
||||
$empty_logo='/images/logo/empty.png';
|
||||
$hres=$this->getTableChunk('helpers','tbody');
|
||||
if($hres!==false) $html_tpl=$hres[1];
|
||||
|
||||
if(!empty($lst) && !empty($html_tpl))
|
||||
{
|
||||
foreach($lst as $item)
|
||||
{
|
||||
$tpl=$html_tpl;
|
||||
$logo_file='images/logo/'.$item['helper'].'.png';
|
||||
$logo=file_exists($this->realpath_public.$logo_file)?'/'.$logo_file:$empty_logo;
|
||||
$vars=array(
|
||||
'nth-num'=>'nth0',
|
||||
'logo'=>$logo,
|
||||
'name'=>$item['helper'],
|
||||
'description'=>$item['description'],
|
||||
'opentitle'=>$this->translate('Open'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$tpl=str_replace('#'.$var.'#',$val,$tpl);
|
||||
|
||||
$html.=$tpl;
|
||||
}
|
||||
}else{
|
||||
$html='<tr><td colspan="3">'.$this->translate('No installed helpers').'</td></tr>';
|
||||
}
|
||||
|
||||
// Определяем список хелперов, доступных для установки в клетку
|
||||
$helpers_list_html='<ul class="helpers-list">';
|
||||
if(!empty($hlst)) foreach($hlst as $item)
|
||||
{
|
||||
$logo_file='images/logo/'.$item.'.png';
|
||||
$logo=file_exists($this->realpath_public.$logo_file)?'/'.$logo_file:$empty_logo;
|
||||
$helpers_list_html.='<li><input type="checkbox" name="'.$item.'" id="'.$item.'"><label for="'.$item.'"><img src="'.$logo.'" /> '.$item.'</label></li>';
|
||||
}
|
||||
$helpers_list_html.='</ul>';
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'helperslist',
|
||||
'helpers_list'=>$helpers_list_html,
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'helperslist',
|
||||
'helpers_list'=>$helpers_list_html,
|
||||
);
|
||||
$html = '';
|
||||
$html_tpl = '';
|
||||
$empty_logo = '/images/logo/empty.png';
|
||||
$hres = $this->getTableChunk('helpers','tbody');
|
||||
if($hres !== false){
|
||||
$html_tpl = $hres[1];
|
||||
}
|
||||
if(!empty($lst) && !empty($html_tpl)){
|
||||
foreach($lst as $item){
|
||||
$tpl = $html_tpl;
|
||||
$logo_file = 'images/logo/'.$item['helper'].'.png';
|
||||
$logo = file_exists($this->realpath_public.$logo_file) ? '/'.$logo_file : $empty_logo;
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'logo' => $logo,
|
||||
'name' => $item['helper'],
|
||||
'description' => $item['description'],
|
||||
'opentitle' => $this->translate('Open')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$tpl = str_replace('#'.$var.'#', $val, $tpl);
|
||||
}
|
||||
$html .= $tpl;
|
||||
}
|
||||
} else {
|
||||
$html = '<tr><td colspan="3">'.$this->translate('No installed helpers').'</td></tr>';
|
||||
}
|
||||
|
||||
// Определяем список хелперов, доступных для установки в клетку
|
||||
$helpers_list_html = '<ul class="helpers-list">';
|
||||
foreach($hlst as $item){
|
||||
$logo_file = 'images/logo/'.$item.'.png';
|
||||
$logo = file_exists($this->realpath_public.$logo_file) ? '/'.$logo_file : $empty_logo;
|
||||
$helpers_list_html .= '<li><input type="checkbox" name="'.$item.'" id="'.$item.'"><label for="'.$item.'"><img src="'.$logo.'" /> '.$item.'</label></li>';
|
||||
}
|
||||
$helpers_list_html .= '</ul>';
|
||||
$html = str_replace(["\n","\r","\t"], '', $html);
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'helperslist',
|
||||
'helpers_list' => $helpers_list_html
|
||||
];
|
||||
return;
|
||||
}else{
|
||||
} else {
|
||||
# Открываем настройки хелпера
|
||||
$db=new Db('helper',array('jname'=>$jail_name,'helper'=>$hash));
|
||||
if($db->error)
|
||||
{
|
||||
//echo json_encode(array('error'=>true,'errorMessage'=>'No helper database!'));
|
||||
$included_result_array=array('error'=>true,'errorMessage'=>'No helper database!');
|
||||
$db = new Db('helper', ['jname' => $jail_name, 'helper' => $hash]);
|
||||
if($db->error){
|
||||
$included_result_array = ['error' => true,'errorMessage' => 'No helper database!'];
|
||||
return;
|
||||
}
|
||||
|
||||
$db_path=$db->getFileName();
|
||||
$res_html=(new Forms($jail_name,$hash,$db_path))->generate();
|
||||
$res_html='<h1>'.$this->translate('Helper settings: '.$hash).'</h1>'.$res_html;
|
||||
$db_path = $db->getFileName();
|
||||
$res_html = (new Forms($jail_name, $hash, $db_path))->generate();
|
||||
$res_html = '<h1>'.$this->translate('Helper settings: '.$hash).'</h1>'.$res_html;
|
||||
}
|
||||
|
||||
//echo json_encode(array('html'=>$res_html,'func'=>'fillTab'));
|
||||
$included_result_array=array(
|
||||
'html'=>$res_html,
|
||||
'func'=>'fillTab'
|
||||
);
|
||||
$included_result_array = [
|
||||
'html' => $res_html,
|
||||
'func' => 'fillTab'
|
||||
];
|
||||
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
$clonos->useDialogs(array(
|
||||
'helpers-add',
|
||||
));
|
||||
$clonos->useDialogs(['helpers-add']);
|
||||
?>
|
||||
|
||||
<h1><?php echo $clonos->translate('Helpers list for jail'),': ',$clonos->uri_chunks[1]; ?></h1>
|
||||
<h1><?php echo $clonos->translate('Helpers list for jail'), ': ', $clonos->uri_chunks[1]; ?></h1>
|
||||
|
||||
<div id="tab1">
|
||||
<p><span class="top-button icon-plus id:helpers-add"><?php echo $clonos->translate('Add helper'); ?></span></p>
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<?php
|
||||
if(isset($clonos->uri_chunks[1]))
|
||||
{
|
||||
if(isset($clonos->uri_chunks[1])){
|
||||
include('helpers.php');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$clonos->useDialogs(array(
|
||||
$clonos->useDialogs([
|
||||
'vnc',
|
||||
'jail-settings',
|
||||
'jail-settings-config-menu',
|
||||
'jail-import',
|
||||
'jail-clone',
|
||||
'jail-rename',
|
||||
));
|
||||
'jail-rename'
|
||||
]);
|
||||
|
||||
?>
|
||||
<h1>Контейнеры:</h1>
|
||||
|
||||
@@ -2,86 +2,83 @@
|
||||
|
||||
/* hardcode API ip. Change it later */
|
||||
//$api_ip='https://bitclouds.convectix.com:1443';
|
||||
$api_ip='http://144.76.225.238';
|
||||
$api_ip = 'http://144.76.225.238';
|
||||
|
||||
function getSslPage($url) {
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_REFERER, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
$file=getSslPage($api_ip.'/clusters');
|
||||
|
||||
$html='';
|
||||
|
||||
$res=json_decode($file,true);
|
||||
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('k8slist','tbody');
|
||||
|
||||
if(!empty($res) && isset($res['clusters']))foreach($res['clusters'] as $cluster)
|
||||
{
|
||||
$num=$nth & 1;
|
||||
$html_tpl=$hres[1];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'name'=>$cluster['name'],
|
||||
'cluster'=>$cluster['cluster'],
|
||||
'masters'=>$cluster['masters'],
|
||||
'workers'=>$cluster['workers'],
|
||||
'bhyves'=>join('; ',$cluster['bhyves']),
|
||||
//'jstatus'=>$this->translate($statuses[$status]),
|
||||
//'icon'=>($status==0)?'play':'stop',
|
||||
//'desktop'=>($status==0)?' s-off':' s-on',
|
||||
//'maintenance'=>($status==3)?' maintenance':'',
|
||||
//'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
||||
//'protitle'=>($jail['protected']==1)?' title="'.$this->translate('Protected jail').'"':' title="'.$this->translate('Delete').'"',
|
||||
//'vnc_title'=>$this->translate('Open VNC'),
|
||||
//'reboot_title'=>$this->translate('Restart jail'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||
|
||||
// if($node!='local') $html_tpl=str_replace('<span class="icon-cog"></span>','',$html_tpl);
|
||||
|
||||
$html.=$html_tpl;
|
||||
|
||||
$nth++;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_REFERER, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
|
||||
$html_tpl_1=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||
if($hres!==false)
|
||||
{
|
||||
$vars=array(
|
||||
'nth-num'=>'nth0',
|
||||
'status'=>'',
|
||||
'jstatus'=>$this->translate('Creating'),
|
||||
'icon'=>'spin6 animate-spin',
|
||||
'desktop'=>' s-off',
|
||||
'maintenance'=>' maintenance busy',
|
||||
'protected'=>'icon-cancel',
|
||||
'protitle'=>'',
|
||||
'vnc_title'=>$this->translate('Open VNC'),
|
||||
'reboot_title'=>$this->translate('Restart jail'),
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl_1=str_replace('#'.$var.'#',$val,$html_tpl_1);
|
||||
$file = getSslPage($api_ip.'/clusters');
|
||||
$html = '';
|
||||
$res = json_decode($file, true);
|
||||
$nth = 0;
|
||||
$hres = $this->getTableChunk('k8slist','tbody');
|
||||
|
||||
if(!empty($res) && isset($res['clusters'])){
|
||||
foreach($res['clusters'] as $cluster){
|
||||
$num = $nth & 1;
|
||||
$html_tpl = $hres[1];
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'name' => $cluster['name'],
|
||||
'cluster' => $cluster['cluster'],
|
||||
'masters' => $cluster['masters'],
|
||||
'workers' => $cluster['workers'],
|
||||
'bhyves' => join('; ',$cluster['bhyves']),
|
||||
//'jstatus'=>$this->translate($statuses[$status]),
|
||||
//'icon'=>($status==0)?'play':'stop',
|
||||
//'desktop'=>($status==0)?' s-off':' s-on',
|
||||
//'maintenance'=>($status==3)?' maintenance':'',
|
||||
//'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
||||
//'protitle'=>($jail['protected']==1)?' title="'.$this->translate('Protected jail').'"':' title="'.$this->translate('Delete').'"',
|
||||
//'vnc_title'=>$this->translate('Open VNC'),
|
||||
//'reboot_title'=>$this->translate('Restart jail'),
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
}
|
||||
// if($node!='local') $html_tpl=str_replace('<span class="icon-cog"></span>','',$html_tpl);
|
||||
$html .= $html_tpl;
|
||||
$nth++;
|
||||
}
|
||||
}
|
||||
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'k8slist',
|
||||
$html_tpl_1 = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||
if($hres !== false){
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'status' => '',
|
||||
'jstatus' => $this->translate('Creating'),
|
||||
'icon' => 'spin6 animate-spin',
|
||||
'desktop' => ' s-off',
|
||||
'maintenance' => ' maintenance busy',
|
||||
'protected' => 'icon-cancel',
|
||||
'protitle' => '',
|
||||
'vnc_title' => $this->translate('Open VNC'),
|
||||
'reboot_title' => $this->translate('Restart jail')
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl_1 = str_replace('#'.$var.'#', $val, $html_tpl_1);
|
||||
}
|
||||
}
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'k8slist',
|
||||
//'tasks'=>$tasks,
|
||||
'template'=>$html_tpl_1,
|
||||
'template' => $html_tpl_1,
|
||||
//'protected'=>$protected,
|
||||
);
|
||||
];
|
||||
@@ -1,16 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
if(isset($clonos->uri_chunks[1]))
|
||||
{
|
||||
include('helpers.php');
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
$clonos->useDialogs(array(
|
||||
'k8s-new',
|
||||
));
|
||||
|
||||
$clonos->useDialogs(['k8s-new']);
|
||||
?>
|
||||
<h1>K8S Сlusters:</h1>
|
||||
<p><span class="top-button icon-plus id:k8s-new">Создать Kubernetes</span></p>
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
<?php
|
||||
/*
|
||||
if(isset($clonos->uri_chunks[1]))
|
||||
{
|
||||
include('helpers.php');
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
$clonos->useDialogs(array(
|
||||
'k8s-new',
|
||||
));
|
||||
$clonos->useDialogs(['k8s-new']);
|
||||
|
||||
/*
|
||||
Модуль kubernetes использует в работе преднастроенный образ Linux, который не входит в базовую установку ClonOS.
|
||||
|
||||
@@ -1,48 +1,37 @@
|
||||
<?php
|
||||
|
||||
$db=new Db('base','storage_media');
|
||||
$res=$db->select('SELECT idx,name,path,jname FROM media where type="iso"', []);
|
||||
$db = new Db('base', 'storage_media');
|
||||
$res = $db->select('SELECT idx,name,path,jname FROM media where type="iso"', []);
|
||||
|
||||
$html='';
|
||||
if($res!==false)
|
||||
{
|
||||
$nth=0;
|
||||
$num=$nth & 1;
|
||||
$html = '';
|
||||
if($res !== false){
|
||||
$nth = 0;
|
||||
$num = $nth & 1;
|
||||
|
||||
if(!empty($res)) foreach($res as $item)
|
||||
{
|
||||
$hres=$this->getTableChunk('mediaslist','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tmp=$hres[1];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'mediaid'=>$item['idx'],
|
||||
'medianame'=>$item['name'],
|
||||
'mediapath'=>$item['path'],
|
||||
'jname'=>$item['jname'],
|
||||
'deltitle'=>' title="'.$this->translate('Delete').'"',
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tmp=str_replace('#'.$var.'#',$val,$html_tmp);
|
||||
|
||||
$html.=$html_tmp;
|
||||
foreach($res as $item){
|
||||
$hres = $this->getTableChunk('mediaslist','tbody');
|
||||
if($hres !== false){
|
||||
$html_tmp = $hres[1];
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'mediaid' => $item['idx'],
|
||||
'medianame' => $item['name'],
|
||||
'mediapath' => $item['path'],
|
||||
'jname' => $item['jname'],
|
||||
'deltitle' => ' title="'.$this->translate('Delete').'"'
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tmp = str_replace('#'.$var.'#', $val, $html_tmp);
|
||||
}
|
||||
$html .= $html_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'mediaslist',
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'mediaslist',
|
||||
);
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'mediaslist'
|
||||
];
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
//echo '{}';
|
||||
//$ips=$db1->select("select group_concat(ip,'; ') from nodelist", []); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> nodes.php
|
||||
$included_result_array=array();
|
||||
$included_result_array = [];
|
||||
@@ -1,62 +1,57 @@
|
||||
<?php
|
||||
$res_array=array(
|
||||
'num-nodes'=>1,
|
||||
'online-nodes'=>1,
|
||||
'offline-nodes'=>0,
|
||||
'num-jails'=>0,
|
||||
'num-cores'=>0,
|
||||
'average'=>0,
|
||||
'sum-ram'=>0,
|
||||
'sum-storage'=>'Unknown',
|
||||
'error'=>false,
|
||||
'error_message'=>'',
|
||||
);
|
||||
$res_array = [
|
||||
'num-nodes' => 1,
|
||||
'online-nodes' => 1,
|
||||
'offline-nodes' => 0,
|
||||
'num-jails' => 0,
|
||||
'num-cores' => 0,
|
||||
'average' => 0,
|
||||
'sum-ram' => 0,
|
||||
'sum-storage' => 'Unknown',
|
||||
'error' => false,
|
||||
'error_message' => ''
|
||||
];
|
||||
|
||||
$nodenames=array('local');
|
||||
$db=new Db('base','nodes');
|
||||
$nodes=$db->select('select nodename,ip from nodelist', []);
|
||||
if(!empty($nodes))foreach($nodes as $node)
|
||||
{
|
||||
$idle=$this->check_locktime($node['ip']);
|
||||
if($idle==0) $res_array['offline-nodes']++; else $res_array['online-nodes']++;
|
||||
|
||||
$nodenames[]=$node['nodename'];
|
||||
$nodenames = ['local'];
|
||||
$db = new Db('base','nodes');
|
||||
$nodes = $db->select('select nodename,ip from nodelist', []);
|
||||
foreach($nodes as $node){
|
||||
$idle = $this->check_locktime($node['ip']);
|
||||
if($idle == 0){
|
||||
$res_array['offline-nodes']++;
|
||||
} else {
|
||||
$res_array['online-nodes']++;
|
||||
}
|
||||
$nodenames[] = $node['nodename'];
|
||||
}
|
||||
|
||||
|
||||
// extra+1: мы предполагаем, что сервер с WEB интерфейсом
|
||||
// также играет роль ноды - ее можно использовать полноценно со
|
||||
// всеми ресурсами
|
||||
$res_array['num-nodes']=count($nodes)+1;
|
||||
$res_array['num-nodes'] = count($nodes) + 1;
|
||||
|
||||
if(!empty($nodenames))foreach($nodenames as $name)
|
||||
{
|
||||
$ndb=new Db('base',trim($name));
|
||||
if($ndb===false)
|
||||
{
|
||||
//echo json_encode(array('error'=>true,'error_message'=>$ndb->error_message));
|
||||
$included_result_array=array('error'=>true,'error_message'=>$ndb->error_message);
|
||||
foreach($nodenames as $name){
|
||||
$ndb = new Db('base', trim($name));
|
||||
if($ndb->error){
|
||||
$included_result_array = ['error' => true, 'error_message' => $ndb->error_message];
|
||||
exit;
|
||||
}
|
||||
|
||||
$jcounts=$ndb->selectOne('SELECT COUNT(*) as count FROM jails;', []);
|
||||
$res_array['num-jails']+=$jcounts['count'];
|
||||
|
||||
$counts=$ndb->select('SELECT ncpu,physmem,cpufreq FROM local;', []);
|
||||
if(!empty($counts))foreach($counts as $cel)
|
||||
{
|
||||
$res_array['num-cores']+=$cel['ncpu'];
|
||||
$res_array['sum-ram']+=$cel['physmem'];
|
||||
$res_array['average']+=$cel['cpufreq'];
|
||||
|
||||
$jcounts = $ndb->selectOne('SELECT COUNT(*) as count FROM jails;', []);
|
||||
$res_array['num-jails'] += $jcounts['count'];
|
||||
|
||||
$counts = $ndb->select('SELECT ncpu,physmem,cpufreq FROM local;', []);
|
||||
foreach($counts as $cel){
|
||||
$res_array['num-cores'] += $cel['ncpu'];
|
||||
$res_array['sum-ram'] += $cel['physmem'];
|
||||
$res_array['average'] += $cel['cpufreq'];
|
||||
}
|
||||
}
|
||||
|
||||
if($res_array['average']>0)
|
||||
{
|
||||
$res_array['average']=$this->GhzConvert($res_array['average']/($res_array['num-nodes']?:1));
|
||||
if($res_array['average'] > 0){
|
||||
$res_array['average'] = $this->GhzConvert($res_array['average']/($res_array['num-nodes']?:1));
|
||||
}
|
||||
|
||||
$res_array['sum-ram']=$this->fileSizeConvert((int) $res_array['sum-ram'],1024,true);
|
||||
$res_array['sum-ram'] = $this->fileSizeConvert((int) $res_array['sum-ram'], 1024, true);
|
||||
|
||||
//echo json_encode($res_array);
|
||||
$included_result_array=$res_array;
|
||||
$included_result_array = $res_array;
|
||||
@@ -16,7 +16,7 @@ $hres_set = ($hres !== false);
|
||||
foreach($nodes as $node){
|
||||
|
||||
$db1 = new Db('base', $node['nodename']);
|
||||
if($db1->error !== false){
|
||||
if(!$db1->error){
|
||||
|
||||
$bases = $db1->select("SELECT idx,name,platform,ver,rev,date FROM bsdsrc ORDER BY CAST(ver AS int)", []);
|
||||
$num = $nth & 1;
|
||||
|
||||
@@ -1,84 +1,67 @@
|
||||
<?php
|
||||
|
||||
$username=$this->_user_info['username'];
|
||||
|
||||
$db=new Db('base','cbsdtaskd');
|
||||
|
||||
$res=$db->select("SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner=? ORDER BY id DESC", array([$username]));
|
||||
|
||||
$username = $this->_user_info['username'];
|
||||
$db = new Db('base','cbsdtaskd');
|
||||
$res = $db->select("SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner=? ORDER BY id DESC", array([$username]));
|
||||
$html='';
|
||||
if($res!==false)
|
||||
{
|
||||
$nth=0;
|
||||
$num=$nth & 1;
|
||||
|
||||
if(!empty($res)) foreach($res as $item)
|
||||
{
|
||||
if(!$db->error){
|
||||
$nth = 0;
|
||||
$num = $nth & 1;
|
||||
|
||||
foreach($res as $item){
|
||||
//Utils::clonos_syslog("tasklog: HTML");
|
||||
|
||||
$hres=$this->getTableChunk('tasklog','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tmp=$hres[1];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'logid'=>$item['id'],
|
||||
'logcmd'=>$this->colorizeCmd($item['cmd']),
|
||||
'logstarttime'=>date("d.m.Y H:i",strtotime($item['st_time'])),
|
||||
'logendtime'=>date("d.m.Y H:i",strtotime($item['end_time'])),
|
||||
'logstatus'=>$item['status'],
|
||||
'logerrcode'=>$item['errcode'],
|
||||
'logsize'=>'0 B',
|
||||
);
|
||||
|
||||
$logsize=0;
|
||||
$logfile=$item['logfile'];
|
||||
if(file_exists($logfile))
|
||||
{
|
||||
$logsize=filesize($logfile);
|
||||
$vars['logsize']=$this->fileSizeConvert($logsize,1024,true);
|
||||
$hres = $this->getTableChunk('tasklog','tbody');
|
||||
if($hres !== false){
|
||||
$html_tmp = $hres[1];
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'logid' => $item['id'],
|
||||
'logcmd' => $this->colorizeCmd($item['cmd']),
|
||||
'logstarttime' => date("d.m.Y H:i", strtotime($item['st_time'])),
|
||||
'logendtime' => date("d.m.Y H:i", strtotime($item['end_time'])),
|
||||
'logstatus' => $item['status'],
|
||||
'logerrcode' => $item['errcode'],
|
||||
'logsize'=>'0 B'
|
||||
];
|
||||
|
||||
$logsize = 0;
|
||||
$logfile = $item['logfile'];
|
||||
if(file_exists($logfile)){
|
||||
$logsize = filesize($logfile);
|
||||
$vars['logsize'] = $this->fileSizeConvert($logsize,1024,true);
|
||||
}
|
||||
|
||||
//if($logsize>0) $vars['logfile']='<span class="link openlog" title="'.$this->translate('Open log').'">'.$vars['logfile'].'</span>';
|
||||
|
||||
$vars['buttvalue']=$this->translate('Open');
|
||||
|
||||
$disabled='disabled';
|
||||
$vars['buttvalue'] = $this->translate('Open');
|
||||
$disabled = 'disabled';
|
||||
if($logsize>0) // && $logsize<204800
|
||||
{
|
||||
$disabled='';
|
||||
}
|
||||
$vars['disabled']=$disabled;
|
||||
|
||||
$status='';
|
||||
if($item['status']==1) $status=' progress';
|
||||
if($item['status']==2 && $item['errcode']==0) $status=' ok';
|
||||
if($item['status']==2 && $item['errcode']!=0) $status=' error';
|
||||
$vars['status']=$status;
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tmp=str_replace('#'.$var.'#',$val,$html_tmp);
|
||||
|
||||
$html.=$html_tmp;
|
||||
$vars['disabled'] = $disabled;
|
||||
$status = '';
|
||||
if($item['status'] == 1) $status=' progress';
|
||||
if($item['status'] == 2 && $item['errcode'] == 0) $status=' ok';
|
||||
if($item['status'] == 2 && $item['errcode'] != 0) $status=' error';
|
||||
$vars['status'] = $status;
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tmp = str_replace('#'.$var.'#', $val, $html_tmp);
|
||||
}
|
||||
$html .= $html_tmp;
|
||||
//Utils::clonos_syslog("tasklog: HTML: ". $html);
|
||||
}
|
||||
} else {
|
||||
Utils::clonos_syslog("tasklog: \$res query empty result:". "SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner='". $username."' ORDER BY id DESC;");
|
||||
}
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'taskloglist',
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'taskloglist',
|
||||
);
|
||||
} else {
|
||||
Utils::clonos_syslog("tasklog: \$res query failed:". "SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner='". $username."' ORDER BY id DESC;");
|
||||
}
|
||||
} //else {
|
||||
// Utils::clonos_syslog("tasklog: \$res query empty result:". "SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner='". $username."' ORDER BY id DESC;");
|
||||
//}
|
||||
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'taskloglist'
|
||||
];
|
||||
}// else {
|
||||
// Utils::clonos_syslog("tasklog: \$res query failed:". "SELECT id,st_time,end_time,cmd,status,errcode,logfile FROM taskd WHERE owner='". $username."' ORDER BY id DESC;");
|
||||
//}
|
||||
|
||||
@@ -12,53 +12,36 @@ date_joined TIMESTAMP DATE DEFAULT (datetime('now','localtime'))
|
||||
);
|
||||
*/
|
||||
|
||||
$html='';
|
||||
$db=new Db('clonos');
|
||||
if($db!==false)
|
||||
{
|
||||
$res=$db->select("select id,username,first_name,last_name,date_joined,last_login,is_active from auth_user order by date_joined desc", []);
|
||||
$db = new Db('clonos');
|
||||
if(!$db->error){
|
||||
$res = $db->select("select id,username,first_name,last_name,date_joined,last_login,is_active from auth_user order by date_joined desc", []);
|
||||
}
|
||||
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('users','tbody');
|
||||
$html = '';
|
||||
$hres = $this->getTableChunk('users','tbody');
|
||||
|
||||
$html_tpl=$hres[1];
|
||||
if(!empty($res))foreach($res as $r)
|
||||
{
|
||||
$html_tpl1=$html_tpl;
|
||||
$vars=array(
|
||||
'id'=>$r['id'],
|
||||
'login'=>$r['username'],
|
||||
'first_name'=>$r['first_name'],
|
||||
'last_name'=>$r['last_name'],
|
||||
'date_joined'=>$r['date_joined'],
|
||||
'last_login'=>$r['last_login'],
|
||||
'is_active'=>($r['is_active']==1)?'icon-ok':'',
|
||||
'edit_title'=>$this->translate('edit_title'),
|
||||
'delete_title'=>$this->translate('delete_title'),
|
||||
);
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl1=str_replace('#'.$var.'#',$val,$html_tpl1);
|
||||
$html.=$html_tpl1;
|
||||
foreach($res as $r){
|
||||
$html_tpl1 = $hres[1];
|
||||
$vars = [
|
||||
'id' => $r['id'],
|
||||
'login' => $r['username'],
|
||||
'first_name' => $r['first_name'],
|
||||
'last_name' => $r['last_name'],
|
||||
'date_joined' => $r['date_joined'],
|
||||
'last_login' => $r['last_login'],
|
||||
'is_active' => ($r['is_active']==1) ? 'icon-ok' : '',
|
||||
'edit_title' => $this->translate('edit_title'),
|
||||
'delete_title' => $this->translate('delete_title'),
|
||||
];
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl1 = str_replace('#'.$var.'#', $val, $html_tpl1);
|
||||
}
|
||||
$html .= $html_tpl1;
|
||||
}
|
||||
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'userslist',
|
||||
//'tasks'=>$tasks,
|
||||
//'template'=>$html_tpl_1,
|
||||
//'protected'=>$protected,
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'userslist',
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'userslist'
|
||||
];
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
$clonos->useDialogs(array(
|
||||
'users-new',
|
||||
));
|
||||
$clonos->useDialogs(['users-new']);
|
||||
?>
|
||||
|
||||
<h1>User management</h1>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
$clonos->useDialogs(array(
|
||||
'users-new',
|
||||
));
|
||||
$clonos->useDialogs(['users-new']);
|
||||
?>
|
||||
|
||||
<h1>Пользователи CBSD</h1>
|
||||
|
||||
@@ -1,49 +1,36 @@
|
||||
<?php
|
||||
|
||||
$html='';
|
||||
$db=new Db('base','local');
|
||||
if($db!==false)
|
||||
{
|
||||
$res=$db->select("select id,name,description,pkg_vm_ram,pkg_vm_disk,pkg_vm_cpus,owner from vmpackages order by name asc", []);
|
||||
$db = new Db('base','local');
|
||||
if(!$db->error){
|
||||
$res = $db->select("select id,name,description,pkg_vm_ram,pkg_vm_disk,pkg_vm_cpus,owner from vmpackages order by name asc", []);
|
||||
}
|
||||
|
||||
$nth=0;
|
||||
$hres=$this->getTableChunk('packages','tbody');
|
||||
$html = '';
|
||||
$hres = $this->getTableChunk('packages','tbody');
|
||||
$html_tpl = $hres[1];
|
||||
|
||||
$html_tpl=$hres[1];
|
||||
if(!empty($res))foreach($res as $r)
|
||||
{
|
||||
$html_tpl1=$html_tpl;
|
||||
$vars=array(
|
||||
'id'=>$r['id'],
|
||||
'name'=>$r['name'],
|
||||
'description'=>$r['description'],
|
||||
'pkg_vm_ram'=>$r['pkg_vm_ram'],
|
||||
'pkg_vm_disk'=>$r['pkg_vm_disk'],
|
||||
'pkg_vm_cpus'=>$r['pkg_vm_cpus'],
|
||||
'owner'=>$r['owner'],
|
||||
'edit_title'=>$this->translate('edit_title'),
|
||||
'delete_title'=>$this->translate('delete_title'),
|
||||
);
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tpl1=str_replace('#'.$var.'#',$val,$html_tpl1);
|
||||
$html.=$html_tpl1;
|
||||
foreach($res as $r){
|
||||
$html_tpl1 = $html_tpl;
|
||||
$vars = [
|
||||
'id' => $r['id'],
|
||||
'name' => $r['name'],
|
||||
'description' => $r['description'],
|
||||
'pkg_vm_ram' => $r['pkg_vm_ram'],
|
||||
'pkg_vm_disk' => $r['pkg_vm_disk'],
|
||||
'pkg_vm_cpus' => $r['pkg_vm_cpus'],
|
||||
'owner' => $r['owner'],
|
||||
'edit_title' => $this->translate('edit_title'),
|
||||
'delete_title' => $this->translate('delete_title')
|
||||
];
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl1 = str_replace('#'.$var.'#', $val, $html_tpl1);
|
||||
}
|
||||
$html .= $html_tpl1;
|
||||
}
|
||||
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'packageslist',
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'packageslist',
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'packageslist'
|
||||
];
|
||||
@@ -1,47 +1,36 @@
|
||||
<?php
|
||||
|
||||
$db=new Db('base','vpnet');
|
||||
$res=$db->select('SELECT idx,name,vpnet FROM vpnet', []);
|
||||
$db = new Db('base','vpnet');
|
||||
$res = $db->select('SELECT idx,name,vpnet FROM vpnet', []);
|
||||
$html = '';
|
||||
|
||||
$html='';
|
||||
if($res!==false)
|
||||
{
|
||||
$nth=0;
|
||||
$num=$nth & 1;
|
||||
if(!$db->error){
|
||||
$nth = 0;
|
||||
$num = $nth & 1;
|
||||
|
||||
if(!empty($res)) foreach($res as $item)
|
||||
{
|
||||
$hres=$this->getTableChunk('vpnetslist','tbody');
|
||||
if($hres!==false)
|
||||
{
|
||||
$html_tmp=$hres[1];
|
||||
$vars=array(
|
||||
'nth-num'=>'nth'.$num,
|
||||
'netid'=>$item['idx'],
|
||||
'netname'=>$item['name'],
|
||||
'network'=>$item['vpnet'],
|
||||
'deltitle'=>' title="'.$this->translate('Delete').'"',
|
||||
);
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
$html_tmp=str_replace('#'.$var.'#',$val,$html_tmp);
|
||||
|
||||
$html.=$html_tmp;
|
||||
foreach($res as $item){
|
||||
$hres = $this->getTableChunk('vpnetslist','tbody');
|
||||
if($hres !== false){
|
||||
$html_tmp = $hres[1];
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'netid' => $item['idx'],
|
||||
'netname' => $item['name'],
|
||||
'network'=> $item['vpnet'],
|
||||
'deltitle' => ' title="'.$this->translate('Delete').'"'
|
||||
];
|
||||
|
||||
foreach($vars as $var => $val){
|
||||
$html_tmp = str_replace('#'.$var.'#', $val, $html_tmp);
|
||||
}
|
||||
$html .= $html_tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'vpnetslist',
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'vpnetslist',
|
||||
);
|
||||
$included_result_array = [
|
||||
'tbody' => $html,
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'vpnetslist'
|
||||
];
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
$clonos->useDialogs(array(
|
||||
'vpnet',
|
||||
));
|
||||
$clonos->useDialogs(['vpnet']);
|
||||
?>
|
||||
<h1>Subnet list</h1>
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
$clonos->useDialogs(array(
|
||||
'vpnet',
|
||||
));
|
||||
$clonos->useDialogs(['vpnet']);
|
||||
?>
|
||||
<h1>Список подсетей</h1>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user