mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-30 17:37:59 +00:00
@@ -1,36 +1,36 @@
|
||||
<?php
|
||||
$html='';
|
||||
|
||||
$db = new Db('base','nodes');
|
||||
$nodes = $db->select('select nodename,ip from nodelist order by nodename desc', []);
|
||||
$nodes[]=array('nodename'=>'local');
|
||||
$nodes[] = ['nodename'=>'local'];
|
||||
$nodes = array_reverse($nodes);
|
||||
|
||||
$ids=array();
|
||||
$ids = [];
|
||||
$nth = 0;
|
||||
$hres=$this->getTableChunk('srcslist','tbody');
|
||||
if(!empty($nodes))foreach($nodes as $node)
|
||||
{
|
||||
$db1=new Db('base',$node['nodename']);
|
||||
if($db1!==false)
|
||||
{
|
||||
$bases=$db1->select("SELECT idx,name,platform,ver,rev,date FROM bsdsrc ORDER BY CAST(ver AS int)", []);
|
||||
$html = '';
|
||||
$html_tpl = '';
|
||||
|
||||
$hres = $this->getTableChunk('srcslist','tbody');
|
||||
$hres_set = ($hres !== false);
|
||||
|
||||
foreach($nodes as $node){
|
||||
|
||||
$db1 = new Db('base', $node['nodename']);
|
||||
if($db1->error !== false){
|
||||
|
||||
$bases = $db1->select("SELECT idx,name,platform,ver,rev,date FROM bsdsrc ORDER BY CAST(ver AS int)", []);
|
||||
$num = $nth & 1;
|
||||
if(!empty($bases)) foreach($bases as $base)
|
||||
{
|
||||
|
||||
foreach($bases as $base){
|
||||
$idle = 1;
|
||||
//print_r($node);exit;
|
||||
if($node['nodename']!='local')
|
||||
{
|
||||
if($node['nodename'] != 'local'){
|
||||
$idle = $this->check_locktime($node['ip']);
|
||||
}
|
||||
|
||||
if($hres!==false)
|
||||
{
|
||||
if($hres_set){
|
||||
$html_tpl = $hres[1];
|
||||
$vers = (preg_match('#\.\d#',$base['ver']))?'release':'stable';
|
||||
$vars=array(
|
||||
$vars = [
|
||||
'nth-num' => 'nth'.$num,
|
||||
'node' => $node['nodename'],
|
||||
'name' => $base['name'],
|
||||
@@ -43,34 +43,24 @@ if(!empty($nodes))foreach($nodes as $node)
|
||||
'icon' => '',
|
||||
'maintenance' => ($idle==0) ? ' maintenance' : '',
|
||||
'deltitle' => $this->translate('Delete'),
|
||||
'updtitle'=>$this->translate('Update'),
|
||||
);
|
||||
'updtitle' => $this->translate('Update')
|
||||
];
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
foreach($vars as $var => $val){
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
|
||||
}
|
||||
$html .= $html_tpl;
|
||||
}
|
||||
$ids[] = '#src'.$base['ver'];
|
||||
|
||||
}
|
||||
|
||||
$nth++;
|
||||
}
|
||||
}
|
||||
|
||||
$html=str_replace(array("\n","\r","\t"),'',$html);
|
||||
|
||||
$tasks='';
|
||||
if(!empty($ids))
|
||||
{
|
||||
if(!empty($ids)){
|
||||
$tasks = $this->getRunningTasks($ids);
|
||||
}
|
||||
|
||||
$html_tpl=str_replace(array("\n","\r","\t"),'',$hres[1]);
|
||||
if($hres!==false)
|
||||
{
|
||||
$vars=array(
|
||||
$html_tpl = str_replace(["\n","\r","\t"], '', $hres[1]);
|
||||
$vars = [
|
||||
'nth-num' => 'nth0',
|
||||
'status' => '',
|
||||
'jstatus' => $this->translate('Updating'),
|
||||
@@ -78,28 +68,19 @@ if($hres!==false)
|
||||
'desktop' => ' s-off',
|
||||
'maintenance' => ' maintenance busy',
|
||||
'updtitle' => $this->translate('Update'),
|
||||
'deltitle'=>$this->translate('Delete'),
|
||||
);
|
||||
'deltitle' => $this->translate('Delete')
|
||||
];
|
||||
|
||||
foreach($vars as $var=>$val)
|
||||
foreach($vars as $var => $val) {
|
||||
$html_tpl = str_replace('#'.$var.'#', $val, $html_tpl);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
echo json_encode(array(
|
||||
'tbody'=>$html,
|
||||
$included_result_array = [
|
||||
'tbody' => str_replace(["\n","\r","\t"], '', $html),
|
||||
'error' => false,
|
||||
'func' => 'fillTable',
|
||||
'id' => 'srcslist',
|
||||
'tasks' => $tasks,
|
||||
'template'=>$html_tpl,
|
||||
));
|
||||
*/
|
||||
$included_result_array=array(
|
||||
'tbody'=>$html,
|
||||
'error'=>false,
|
||||
'func'=>'fillTable',
|
||||
'id'=>'srcslist',
|
||||
'tasks'=>$tasks,
|
||||
'template'=>$html_tpl,
|
||||
);
|
||||
'template' => $html_tpl
|
||||
];
|
||||
Reference in New Issue
Block a user