mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-11-01 02:17:52 +00:00
* Menu class does not depend on ClonOS
This commit is contained in:
163
php/clonos.php
163
php/clonos.php
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
require_once("cbsd.php");
|
require_once("cbsd.php");
|
||||||
require_once('config.php');
|
require_once('config.php');
|
||||||
|
require_once('locale.php');
|
||||||
require_once('db.php');
|
require_once('db.php');
|
||||||
require_once('forms.php');
|
require_once('forms.php');
|
||||||
require_once('menu.php');
|
require_once('utils.php');
|
||||||
|
|
||||||
class ClonOS {
|
class ClonOS {
|
||||||
public $server_name='';
|
public $server_name='';
|
||||||
@@ -16,15 +17,12 @@ class ClonOS {
|
|||||||
public $realpath_page='';
|
public $realpath_page='';
|
||||||
public $uri_chunks=array();
|
public $uri_chunks=array();
|
||||||
public $json_name='';
|
public $json_name='';
|
||||||
public $language='en';
|
|
||||||
public $language_file_loaded=false;
|
|
||||||
public $translate_arr=array();
|
|
||||||
public $table_templates=array();
|
public $table_templates=array();
|
||||||
public $url_hash='';
|
public $url_hash='';
|
||||||
public $media_import='';
|
public $media_import='';
|
||||||
public $json_req=false;
|
public $json_req=false;
|
||||||
public $sys_vars=array();
|
public $sys_vars=array();
|
||||||
|
private $_locale;
|
||||||
private $_post=false;
|
private $_post=false;
|
||||||
private $_db=null;
|
private $_db=null;
|
||||||
private $_client_ip='';
|
private $_client_ip='';
|
||||||
@@ -62,7 +60,6 @@ class ClonOS {
|
|||||||
|
|
||||||
$this->_post=($_SERVER['REQUEST_METHOD']=='POST');
|
$this->_post=($_SERVER['REQUEST_METHOD']=='POST');
|
||||||
$this->_vars=$_POST;
|
$this->_vars=$_POST;
|
||||||
if(isset($_COOKIE['lang'])) $this->language=$_COOKIE['lang'];
|
|
||||||
|
|
||||||
$this->workdir=getenv('WORKDIR'); # // /usr/jails
|
$this->workdir=getenv('WORKDIR'); # // /usr/jails
|
||||||
$this->environment=getenv('APPLICATION_ENV');
|
$this->environment=getenv('APPLICATION_ENV');
|
||||||
@@ -82,21 +79,11 @@ class ClonOS {
|
|||||||
$this->server_name=$_SERVER['SERVER_ADDR'];
|
$this->server_name=$_SERVER['SERVER_ADDR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($uri)){
|
$this->uri_chunks=Utils::gen_uri_chunks($uri);
|
||||||
$str=str_replace('/index.php','',$uri);
|
|
||||||
$this->uri_chunks=explode('/',$str);
|
|
||||||
}else if(isset($this->_vars['path'])){
|
|
||||||
$str=trim($this->_vars['path'],'/');
|
|
||||||
$this->uri_chunks=explode('/',$str);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->config=new Config();
|
$this->config=new Config();
|
||||||
|
|
||||||
/* determine lang */
|
$this->_locale = new Locale($this->realpath_public);
|
||||||
if(!array_key_exists($this->language, $this->config->languages)) $this->language='en';
|
|
||||||
include($this->realpath_public.'/lang/'.$this->language.'.php');
|
|
||||||
$this->translate_arr=$lang;
|
|
||||||
unset($lang);
|
|
||||||
|
|
||||||
$this->_client_ip=$_SERVER['REMOTE_ADDR'];
|
$this->_client_ip=$_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
@@ -121,8 +108,6 @@ class ClonOS {
|
|||||||
$this->_db_tasks=new Db('base','cbsdtaskd');
|
$this->_db_tasks=new Db('base','cbsdtaskd');
|
||||||
$this->_db_local=new Db('base','local');
|
$this->_db_local=new Db('base','local');
|
||||||
|
|
||||||
$this->menu=new Menu($this->config->menu,$this);
|
|
||||||
|
|
||||||
if(isset($this->_vars['mode'])) $this->mode=$this->_vars['mode'];
|
if(isset($this->_vars['mode'])) $this->mode=$this->_vars['mode'];
|
||||||
if(isset($this->_vars['form_data'])) $this->form=$this->_vars['form_data'];
|
if(isset($this->_vars['form_data'])) $this->form=$this->_vars['form_data'];
|
||||||
|
|
||||||
@@ -152,8 +137,6 @@ class ClonOS {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST);
|
|
||||||
|
|
||||||
// functions, running without parameters
|
// functions, running without parameters
|
||||||
$new_array=array();
|
$new_array=array();
|
||||||
$cfunc='ccmd_'.$this->mode;
|
$cfunc='ccmd_'.$this->mode;
|
||||||
@@ -264,6 +247,11 @@ class ClonOS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function translate($phrase)
|
||||||
|
{
|
||||||
|
return $this->_locale->translate($phrase);
|
||||||
|
}
|
||||||
|
|
||||||
function ccmd_getJsonPage(){
|
function ccmd_getJsonPage(){
|
||||||
$included_result_array=false;
|
$included_result_array=false;
|
||||||
if(file_exists($this->json_name)){
|
if(file_exists($this->json_name)){
|
||||||
@@ -291,15 +279,6 @@ class ClonOS {
|
|||||||
$res=$redis->publish($key,$message);
|
$res=$redis->publish($key,$message);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLang(){
|
|
||||||
return $this->language;
|
|
||||||
}
|
|
||||||
|
|
||||||
function translate($phrase){
|
|
||||||
if(isset($this->translate_arr[$phrase])) return $this->translate_arr[$phrase];
|
|
||||||
return $phrase;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTableChunk($table_name='',$tag){
|
function getTableChunk($table_name='',$tag){
|
||||||
if(empty($table_name)) return false;
|
if(empty($table_name)) return false;
|
||||||
if(isset($this->table_templates[$table_name][$tag])) return $this->table_templates[$table_name][$tag];
|
if(isset($this->table_templates[$table_name][$tag])) return $this->table_templates[$table_name][$tag];
|
||||||
@@ -466,23 +445,23 @@ class ClonOS {
|
|||||||
|
|
||||||
$ops_array=$this->_cmd_array;
|
$ops_array=$this->_cmd_array;
|
||||||
$stat_array=array(
|
$stat_array=array(
|
||||||
'jcreate'=>array($this->translate('Creating'),$this->translate('Created')),
|
'jcreate'=>array($this->_locale->translate('Creating'),$this->_locale->translate('Created')),
|
||||||
'jstart'=>array($this->translate('Starting'),$this->translate('Launched')),
|
'jstart'=>array($this->_locale->translate('Starting'),$this->_locale->translate('Launched')),
|
||||||
'jstop'=>array($this->translate('Stopping'),$this->translate('Stopped')),
|
'jstop'=>array($this->_locale->translate('Stopping'),$this->_locale->translate('Stopped')),
|
||||||
'jrestart'=>array($this->translate('Restarting'),$this->translate('Restarted')),
|
'jrestart'=>array($this->_locale->translate('Restarting'),$this->_locale->translate('Restarted')),
|
||||||
'jedit'=>array($this->translate('Saving'),$this->translate('Saved')),
|
'jedit'=>array($this->_locale->translate('Saving'),$this->_locale->translate('Saved')),
|
||||||
'jremove'=>array($this->translate('Removing'),$this->translate('Removed')),
|
'jremove'=>array($this->_locale->translate('Removing'),$this->_locale->translate('Removed')),
|
||||||
'jexport'=>array($this->translate('Exporting'),$this->translate('Exported')),
|
'jexport'=>array($this->_locale->translate('Exporting'),$this->_locale->translate('Exported')),
|
||||||
'jimport'=>array($this->translate('Importing'),$this->translate('Imported')),
|
'jimport'=>array($this->_locale->translate('Importing'),$this->_locale->translate('Imported')),
|
||||||
'jclone'=>array($this->translate('Cloning'),$this->translate('Cloned')),
|
'jclone'=>array($this->_locale->translate('Cloning'),$this->_locale->translate('Cloned')),
|
||||||
'madd'=>array($this->translate('Installing'),$this->translate('Installed')),
|
'madd'=>array($this->_locale->translate('Installing'),$this->_locale->translate('Installed')),
|
||||||
//'mremove'=>array('Removing','Removed'),
|
//'mremove'=>array('Removing','Removed'),
|
||||||
'sstart'=>array($this->translate('Starting'),$this->translate('Started')),
|
'sstart'=>array($this->_locale->translate('Starting'),$this->_locale->translate('Started')),
|
||||||
'sstop'=>array($this->translate('Stopping'),$this->translate('Stopped')),
|
'sstop'=>array($this->_locale->translate('Stopping'),$this->_locale->translate('Stopped')),
|
||||||
'vm_obtain'=>array($this->translate('Creating'),$this->translate('Created')),
|
'vm_obtain'=>array($this->_locale->translate('Creating'),$this->_locale->translate('Created')),
|
||||||
'srcup'=>array($this->translate('Updating'),$this->translate('Updated')),
|
'srcup'=>array($this->_locale->translate('Updating'),$this->_locale->translate('Updated')),
|
||||||
'world'=>array($this->translate('Compiling'),$this->translate('Compiled')),
|
'world'=>array($this->_locale->translate('Compiling'),$this->_locale->translate('Compiled')),
|
||||||
'repo'=>array($this->translate('Fetching'),$this->translate('Fetched')),
|
'repo'=>array($this->_locale->translate('Fetching'),$this->_locale->translate('Fetched')),
|
||||||
//'projremove'=>array('Removing','Removed'),
|
//'projremove'=>array('Removing','Removed'),
|
||||||
);
|
);
|
||||||
$stat_array['bcreate']=&$stat_array['jcreate'];
|
$stat_array['bcreate']=&$stat_array['jcreate'];
|
||||||
@@ -531,7 +510,7 @@ class ClonOS {
|
|||||||
$obj[$key]['txt_status']=$stat_array[$obj[$key]['operation']][$num];
|
$obj[$key]['txt_status']=$stat_array[$obj[$key]['operation']][$num];
|
||||||
if($stat['errcode']>0){
|
if($stat['errcode']>0){
|
||||||
$obj[$key]['errmsg']=file_get_contents($stat['logfile']);
|
$obj[$key]['errmsg']=file_get_contents($stat['logfile']);
|
||||||
$obj[$key]['txt_status']=$this->translate('Error');
|
$obj[$key]['txt_status']=$this->_locale->translate('Error');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return the IP of the cloned jail if it was assigned by DHCP
|
//Return the IP of the cloned jail if it was assigned by DHCP
|
||||||
@@ -605,14 +584,14 @@ class ClonOS {
|
|||||||
'node'=>'local', // TODO: actual data
|
'node'=>'local', // TODO: actual data
|
||||||
'ip4_addr'=>str_replace(',',',<wbr />',$form['ip4_addr']),
|
'ip4_addr'=>str_replace(',',',<wbr />',$form['ip4_addr']),
|
||||||
'jname'=>$form['jname'],
|
'jname'=>$form['jname'],
|
||||||
'jstatus'=>$this->translate('Cloning'),
|
'jstatus'=>$this->_locale->translate('Cloning'),
|
||||||
'icon'=>'spin6 animate-spin',
|
'icon'=>'spin6 animate-spin',
|
||||||
'desktop'=>' s-on',
|
'desktop'=>' s-on',
|
||||||
'maintenance'=>' maintenance',
|
'maintenance'=>' maintenance',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart jail'),
|
'reboot_title'=>$this->_locale->translate('Restart jail'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -639,14 +618,14 @@ class ClonOS {
|
|||||||
'node'=>'local',
|
'node'=>'local',
|
||||||
'ip4_addr'=>str_replace(',',',<wbr />',$jail['ip4_addr']),
|
'ip4_addr'=>str_replace(',',',<wbr />',$jail['ip4_addr']),
|
||||||
'jname'=>$jail['jname'],
|
'jname'=>$jail['jname'],
|
||||||
'jstatus'=>$this->translate($stats[$op]),
|
'jstatus'=>$this->_locale->translate($stats[$op]),
|
||||||
'icon'=>'spin6 animate-spin',
|
'icon'=>'spin6 animate-spin',
|
||||||
'desktop'=>' s-on',
|
'desktop'=>' s-on',
|
||||||
'maintenance'=>' maintenance',
|
'maintenance'=>' maintenance',
|
||||||
'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
'protected'=>($jail['protected']==1)?'icon-lock':'icon-cancel',
|
||||||
'protitle'=>($jail['protected']==1)?' title="'.$this->translate('Protected jail').'"':' title="'.$this->translate('Delete').'"',
|
'protitle'=>($jail['protected']==1)?' title="'.$this->_locale->translate('Protected jail').'"':' title="'.$this->_locale->translate('Delete').'"',
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart jail'),
|
'reboot_title'=>$this->_locale->translate('Restart jail'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -829,14 +808,14 @@ class ClonOS {
|
|||||||
'node'=>'local', // TODO: fix actual data!
|
'node'=>'local', // TODO: fix actual data!
|
||||||
'ip4_addr'=>str_replace(',',',<wbr />',$form['ip4_addr']),
|
'ip4_addr'=>str_replace(',',',<wbr />',$form['ip4_addr']),
|
||||||
'jname'=>$arr['jname'],
|
'jname'=>$arr['jname'],
|
||||||
'jstatus'=>$this->translate('Creating'),
|
'jstatus'=>$this->_locale->translate('Creating'),
|
||||||
'icon'=>'spin6 animate-spin',
|
'icon'=>'spin6 animate-spin',
|
||||||
'desktop'=>' s-off',
|
'desktop'=>' s-off',
|
||||||
'maintenance'=>' busy maintenance',
|
'maintenance'=>' busy maintenance',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart jail'),
|
'reboot_title'=>$this->_locale->translate('Restart jail'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -882,7 +861,7 @@ class ClonOS {
|
|||||||
|
|
||||||
if($err){
|
if($err){
|
||||||
$res['error']=true;
|
$res['error']=true;
|
||||||
$res['error_message']=$this->translate('Jail '.$form['jail_id'].' is not present.');
|
$res['error_message']=$this->_locale->translate('Jail '.$form['jail_id'].' is not present.');
|
||||||
$res['jail_id']=$form['jail_id'];
|
$res['jail_id']=$form['jail_id'];
|
||||||
$res['reload']=true;
|
$res['reload']=true;
|
||||||
return $res;
|
return $res;
|
||||||
@@ -912,7 +891,7 @@ class ClonOS {
|
|||||||
if(empty($res['vars'])) $err=true;
|
if(empty($res['vars'])) $err=true;
|
||||||
if($err){
|
if($err){
|
||||||
$res['error']=true;
|
$res['error']=true;
|
||||||
$res['error_message']=$this->translate('Jail '.$form['jail_id'].' is not present.');
|
$res['error_message']=$this->_locale->translate('Jail '.$form['jail_id'].' is not present.');
|
||||||
$res['jail_id']=$form['jail_id'];
|
$res['jail_id']=$form['jail_id'];
|
||||||
$res['reload']=true;
|
$res['reload']=true;
|
||||||
return $res;
|
return $res;
|
||||||
@@ -942,7 +921,7 @@ class ClonOS {
|
|||||||
|
|
||||||
if($err){
|
if($err){
|
||||||
$res['error']=true;
|
$res['error']=true;
|
||||||
$res['error_message']=$this->translate('Jail '.$form['jail_id'].' is not present.');
|
$res['error_message']=$this->_locale->translate('Jail '.$form['jail_id'].' is not present.');
|
||||||
$res['jail_id']=$form['jail_id'];
|
$res['jail_id']=$form['jail_id'];
|
||||||
$res['reload']=true;
|
$res['reload']=true;
|
||||||
return $res;
|
return $res;
|
||||||
@@ -1037,14 +1016,14 @@ class ClonOS {
|
|||||||
'vm_ram'=>$form['vm_ram'],
|
'vm_ram'=>$form['vm_ram'],
|
||||||
'vm_cpus'=>$form['vm_cpus'],
|
'vm_cpus'=>$form['vm_cpus'],
|
||||||
'vm_os_type'=>$form['vm_os_type'],
|
'vm_os_type'=>$form['vm_os_type'],
|
||||||
'jstatus'=>$this->translate('Cloning'),
|
'jstatus'=>$this->_locale->translate('Cloning'),
|
||||||
'icon'=>'spin6 animate-spin',
|
'icon'=>'spin6 animate-spin',
|
||||||
'desktop'=>' s-on',
|
'desktop'=>' s-on',
|
||||||
'maintenance'=>' maintenance',
|
'maintenance'=>' maintenance',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart VM'),
|
'reboot_title'=>$this->_locale->translate('Restart VM'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1076,13 +1055,13 @@ class ClonOS {
|
|||||||
'vm_ram'=>$this->fileSizeConvert($bhyve['vm_ram']),
|
'vm_ram'=>$this->fileSizeConvert($bhyve['vm_ram']),
|
||||||
'vm_cpus'=>$bhyve['vm_cpus'],
|
'vm_cpus'=>$bhyve['vm_cpus'],
|
||||||
'vm_os_type'=>$bhyve['vm_os_type'],
|
'vm_os_type'=>$bhyve['vm_os_type'],
|
||||||
'vm_status'=>$this->translate($statuses[$status]),
|
'vm_status'=>$this->_locale->translate($statuses[$status]),
|
||||||
'desktop'=>($status==0)?' s-off':' s-on',
|
'desktop'=>($status==0)?' s-off':' s-on',
|
||||||
'icon'=>($status==0)?'play':'stop',
|
'icon'=>($status==0)?'play':'stop',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>' title="'.$this->translate('Delete').'"',
|
'protitle'=>' title="'.$this->_locale->translate('Delete').'"',
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart bhyve'),
|
'reboot_title'=>$this->_locale->translate('Restart bhyve'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1115,7 +1094,7 @@ class ClonOS {
|
|||||||
|
|
||||||
if($err){
|
if($err){
|
||||||
$res['error']=true;
|
$res['error']=true;
|
||||||
$res['error_message']=$this->translate('Jail '.$form['jail_id'].' is not present.');
|
$res['error_message']=$this->_locale->translate('Jail '.$form['jail_id'].' is not present.');
|
||||||
$res['jail_id']=$form['jail_id'];
|
$res['jail_id']=$form['jail_id'];
|
||||||
$res['reload']=true;
|
$res['reload']=true;
|
||||||
return $res;
|
return $res;
|
||||||
@@ -1163,7 +1142,7 @@ class ClonOS {
|
|||||||
|
|
||||||
if($err){
|
if($err){
|
||||||
$res['error']=true;
|
$res['error']=true;
|
||||||
$res['error_message']=$this->translate('Jail '.$form['jail_id'].' is not present.'); // XSS
|
$res['error_message']=$this->_locale->translate('Jail '.$form['jail_id'].' is not present.'); // XSS
|
||||||
$res['jail_id']=$form['jail_id']; // Possible XSS
|
$res['jail_id']=$form['jail_id']; // Possible XSS
|
||||||
// $res['reload']=true;
|
// $res['reload']=true;
|
||||||
return $res;
|
return $res;
|
||||||
@@ -1321,7 +1300,7 @@ class ClonOS {
|
|||||||
'nth-num'=>'nth0', // TODO: actual data
|
'nth-num'=>'nth0', // TODO: actual data
|
||||||
'node'=>'local', // TODO: actual data
|
'node'=>'local', // TODO: actual data
|
||||||
'jname'=>$arr['jname'],
|
'jname'=>$arr['jname'],
|
||||||
'vm_status'=>$this->translate('Creating'),
|
'vm_status'=>$this->_locale->translate('Creating'),
|
||||||
'vm_cpus'=>$form['vm_cpus'],
|
'vm_cpus'=>$form['vm_cpus'],
|
||||||
'vm_ram'=>$vm_ram,
|
'vm_ram'=>$vm_ram,
|
||||||
'vm_os_type'=>$os_items['type'], //$os_name,
|
'vm_os_type'=>$os_items['type'], //$os_name,
|
||||||
@@ -1331,9 +1310,9 @@ class ClonOS {
|
|||||||
'desktop'=>' s-off',
|
'desktop'=>' s-off',
|
||||||
'maintenance'=>' maintenance',
|
'maintenance'=>' maintenance',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart VM'),
|
'reboot_title'=>$this->_locale->translate('Restart VM'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1424,7 +1403,7 @@ class ClonOS {
|
|||||||
'nth-num'=>'nth0', // TODO: actual data
|
'nth-num'=>'nth0', // TODO: actual data
|
||||||
'node'=>'local', // TODO: actual data
|
'node'=>'local', // TODO: actual data
|
||||||
'jname'=>$form['vm_name'],
|
'jname'=>$form['vm_name'],
|
||||||
'vm_status'=>$this->translate('Creating'),
|
'vm_status'=>$this->_locale->translate('Creating'),
|
||||||
'vm_cpus'=>$form['vm_cpus'],
|
'vm_cpus'=>$form['vm_cpus'],
|
||||||
'vm_ram'=>$vm_ram,
|
'vm_ram'=>$vm_ram,
|
||||||
'vm_os_type'=>$os_type,
|
'vm_os_type'=>$os_type,
|
||||||
@@ -1432,9 +1411,9 @@ class ClonOS {
|
|||||||
'desktop'=>' s-off',
|
'desktop'=>' s-off',
|
||||||
'maintenance'=>' maintenance',
|
'maintenance'=>' maintenance',
|
||||||
'protected'=>'icon-cancel',
|
'protected'=>'icon-cancel',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
'vnc_title'=>$this->translate('Open VNC'),
|
'vnc_title'=>$this->_locale->translate('Open VNC'),
|
||||||
'reboot_title'=>$this->translate('Restart VM'),
|
'reboot_title'=>$this->_locale->translate('Restart VM'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1490,7 +1469,7 @@ class ClonOS {
|
|||||||
'keyid'=>$res['lastID'],
|
'keyid'=>$res['lastID'],
|
||||||
'keyname'=>$this->form['keyname'],
|
'keyname'=>$this->form['keyname'],
|
||||||
'keysrc'=>$this->form['keysrc'],
|
'keysrc'=>$this->form['keysrc'],
|
||||||
'deltitle'=>$this->translate('Delete'),
|
'deltitle'=>$this->_locale->translate('Delete'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1531,7 +1510,7 @@ class ClonOS {
|
|||||||
'netid'=>$res['lastID'],
|
'netid'=>$res['lastID'],
|
||||||
'netname'=>$form['netname'],
|
'netname'=>$form['netname'],
|
||||||
'network'=>$form['network'],
|
'network'=>$form['network'],
|
||||||
'deltitle'=>$this->translate('Delete'),
|
'deltitle'=>$this->_locale->translate('Delete'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1621,8 +1600,8 @@ class ClonOS {
|
|||||||
'ver1'=>strlen(intval($res['ver']))<strlen($res['ver'])?'release':'stable',
|
'ver1'=>strlen(intval($res['ver']))<strlen($res['ver'])?'release':'stable',
|
||||||
'rev'=>$res['rev'],
|
'rev'=>$res['rev'],
|
||||||
'date'=>$res['date'],
|
'date'=>$res['date'],
|
||||||
'protitle'=>$this->translate('Update'),
|
'protitle'=>$this->_locale->translate('Update'),
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val) $html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
foreach($vars as $var=>$val) $html_tpl=str_replace('#'.$var.'#',$val,$html_tpl);
|
||||||
@@ -1683,7 +1662,7 @@ class ClonOS {
|
|||||||
$taskId=$res['message'];
|
$taskId=$res['message'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('errorMessage'=>'','jail_id'=>'base'.$bid,'taskId'=>$taskId,'html'=>$html,'mode'=>$this->mode,'txt_status'=>$this->translate('Compiling'));
|
return array('errorMessage'=>'','jail_id'=>'base'.$bid,'taskId'=>$taskId,'html'=>$html,'mode'=>$this->mode,'txt_status'=>$this->_locale->translate('Compiling'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillRepoTr($id,$only_td=false,$bsdsrc=true){
|
function fillRepoTr($id,$only_td=false,$bsdsrc=true){
|
||||||
@@ -1722,7 +1701,7 @@ class ClonOS {
|
|||||||
'elf'=>$res['elf'],
|
'elf'=>$res['elf'],
|
||||||
'date'=>$res['date'],
|
'date'=>$res['date'],
|
||||||
'maintenance'=>' busy',
|
'maintenance'=>' busy',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1768,7 +1747,7 @@ class ClonOS {
|
|||||||
'elf'=>'—',
|
'elf'=>'—',
|
||||||
'date'=>'—',
|
'date'=>'—',
|
||||||
'maintenance'=>' busy',
|
'maintenance'=>' busy',
|
||||||
'protitle'=>$this->translate('Delete'),
|
'protitle'=>$this->_locale->translate('Delete'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($vars as $var=>$val)
|
foreach($vars as $var=>$val)
|
||||||
@@ -1791,7 +1770,7 @@ class ClonOS {
|
|||||||
$taskId=$res['message'];
|
$taskId=$res['message'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('errorMessage'=>'','jail_id'=>'base'.$bid,'taskId'=>$taskId,'html'=>$html,'mode'=>$this->mode,'txt_status'=>$this->translate('Fetching'));
|
return array('errorMessage'=>'','jail_id'=>'base'.$bid,'taskId'=>$taskId,'html'=>$html,'mode'=>$this->mode,'txt_status'=>$this->_locale->translate('Fetching'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function ccmd_logLoad(){
|
function ccmd_logLoad(){
|
||||||
@@ -2644,7 +2623,7 @@ class ClonOS {
|
|||||||
$jres=$this->ccmd_getFreeJname(false,$type);
|
$jres=$this->ccmd_getFreeJname(false,$type);
|
||||||
if($jres['error']) return $this->messageError('Something wrong...');
|
if($jres['error']) return $this->messageError('Something wrong...');
|
||||||
$jname=$jres['freejname'];
|
$jname=$jres['freejname'];
|
||||||
$name_comment='* '.$this->translate('Since imported name already exist, we are change it');
|
$name_comment='* '.$this->_locale->translate('Since imported name already exist, we are change it');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2746,7 +2725,7 @@ class ClonOS {
|
|||||||
|
|
||||||
foreach($quer as $q=>$k){
|
foreach($quer as $q=>$k){
|
||||||
if(is_numeric($k) && ($k==0 || $k==1)) $k=($k==0)?'no':'yes';
|
if(is_numeric($k) && ($k==0 || $k==1)) $k=($k==0)?'no':'yes';
|
||||||
$html.='<tr><td>'.$this->translate($q).'</td><td>'.$this->translate($k).'</td></tr>';
|
$html.='<tr><td>'.$this->_locale->translate($q).'</td><td>'.$this->_locale->translate($k).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html.='</table>';
|
$html.='</table>';
|
||||||
@@ -2792,7 +2771,7 @@ class ClonOS {
|
|||||||
if($q=='vm_ram') $k=$this->fileSizeConvert($k);
|
if($q=='vm_ram') $k=$this->fileSizeConvert($k);
|
||||||
if($q=='state_time') $k=date('d.m.Y H:i:s',$k);
|
if($q=='state_time') $k=date('d.m.Y H:i:s',$k);
|
||||||
|
|
||||||
$html.='<tr><td>'.$this->translate($q).'</td><td>'.$this->translate($k).'</td></tr>';
|
$html.='<tr><td>'.$this->_locale->translate($q).'</td><td>'.$this->_locale->translate($k).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html.='</table>';
|
$html.='</table>';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ require_once("cbsd.php");
|
|||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
/* Список языков, используемых в проекте */
|
/* Список языков, используемых в проекте */
|
||||||
public $languages=array(
|
public static $languages=array(
|
||||||
'en'=>'English',
|
'en'=>'English',
|
||||||
'ru'=>'Russian',
|
'ru'=>'Russian',
|
||||||
);
|
);
|
||||||
@@ -20,14 +20,14 @@ class Config
|
|||||||
'windows'=>'Windows',
|
'windows'=>'Windows',
|
||||||
);
|
);
|
||||||
|
|
||||||
public $other_titles=array(
|
public static $other_titles=array(
|
||||||
'settings'=>'CBSD Settings',
|
'settings'=>'CBSD Settings',
|
||||||
'users'=>'CBSD Users',
|
'users'=>'CBSD Users',
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Меню проекта */
|
/* Меню проекта */
|
||||||
/* Так же можно использовать подменю (в menu.php есть пример) */
|
/* Так же можно использовать подменю (в menu.php есть пример) */
|
||||||
public $menu=array(
|
public static $menu=array(
|
||||||
'overview'=>array(
|
'overview'=>array(
|
||||||
'name'=>'Overview',
|
'name'=>'Overview',
|
||||||
'title'=>'Summary Overview', // заголовки лучше делать более полными, чем просто повторение пункта меню
|
'title'=>'Summary Overview', // заголовки лучше делать более полными, чем просто повторение пункта меню
|
||||||
|
|||||||
31
php/locale.php
Normal file
31
php/locale.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Locale()
|
||||||
|
{
|
||||||
|
public $language='en';
|
||||||
|
public $translate_arr=array();
|
||||||
|
|
||||||
|
function __construct($realpath_public)
|
||||||
|
{
|
||||||
|
(isset($_COOKIE['lang'])) $this->language=$_COOKIE['lang'];
|
||||||
|
(!array_key_exists($this->language, Config::languages)) $this->language='en';
|
||||||
|
include($realpath_public.'/lang/'.$this->language.'.php');
|
||||||
|
$this->translate_arr=$lang;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_lang()
|
||||||
|
{
|
||||||
|
return $this->language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_available_languages()
|
||||||
|
{
|
||||||
|
return Config::languages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function translate($phrase)
|
||||||
|
{
|
||||||
|
if(isset($this->translate_arr[$phrase])) return $this->translate_arr[$phrase];
|
||||||
|
return $phrase;
|
||||||
|
}
|
||||||
|
}
|
||||||
57
php/menu.php
57
php/menu.php
@@ -24,7 +24,6 @@
|
|||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class Menu
|
class Menu
|
||||||
{
|
{
|
||||||
public $html=array();
|
public $html=array();
|
||||||
@@ -32,30 +31,33 @@ class Menu
|
|||||||
public $title='Error';
|
public $title='Error';
|
||||||
public $path='';
|
public $path='';
|
||||||
public $first_key=array();
|
public $first_key=array();
|
||||||
|
|
||||||
function __construct($menu_config=array(),$parent)
|
function __construct($_REALPATH,$uri)
|
||||||
{
|
{
|
||||||
if(!empty($menu_config))
|
$realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/
|
||||||
{
|
$lang = new Locale($realpath_public);
|
||||||
|
$menu_config = Config::menu;
|
||||||
|
if(!empty($menu_config)){
|
||||||
reset($menu_config);
|
reset($menu_config);
|
||||||
$this->first_key=key($menu_config);
|
$this->first_key=key($menu_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($parent->environment!='development')
|
if(getenv('APPLICATION_ENV') != 'development'){
|
||||||
unset($menu_config['sqlite']);
|
unset($menu_config['sqlite']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->html='<ul class="menu">'.PHP_EOL;
|
$this->html='<ul class="menu">'.PHP_EOL;
|
||||||
|
|
||||||
//$qstr=trim($_SERVER['REQUEST_URI'],'/');
|
//$qstr=trim($_SERVER['REQUEST_URI'],'/');
|
||||||
$qstr='';
|
$qstr='';
|
||||||
if(isset($parent->uri_chunks[0]))
|
$uri_chunks=Utils::gen_uri_chunks($uri);
|
||||||
$qstr=trim($parent->uri_chunks[0],'/');
|
if(isset($uri_chunks[0]))
|
||||||
|
$qstr=trim($uri_chunks[0],'/');
|
||||||
$this->path=$qstr; //$_MENU_PATH
|
$this->path=$qstr; //$_MENU_PATH
|
||||||
if(!empty($menu_config))foreach($menu_config as $key=>$val)
|
if(!empty($menu_config))foreach($menu_config as $key=>$val){
|
||||||
{
|
$mname=$lang->translate($val['name']);
|
||||||
$mname=$parent->translate($val['name']);
|
$mtitle=$lang->translate($val['title']);
|
||||||
$mtitle=$parent->translate($val['title']);
|
|
||||||
|
|
||||||
$link=$key;
|
$link=$key;
|
||||||
$sel='';
|
$sel='';
|
||||||
if($qstr==$key){
|
if($qstr==$key){
|
||||||
@@ -63,19 +65,18 @@ class Menu
|
|||||||
$this->title=$mtitle; //$_TITLE
|
$this->title=$mtitle; //$_TITLE
|
||||||
$this->name=$mname; //$_MENU_NAME
|
$this->name=$mname; //$_MENU_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
$icon='empty';
|
$icon='empty';
|
||||||
if(isset($val['icon']) && !empty($val['icon'])) $icon=$val['icon'];
|
if(isset($val['icon']) && !empty($val['icon'])) $icon=$val['icon'];
|
||||||
$span='<span class="'.$icon.'"></span>';
|
$span='<span class="'.$icon.'"></span>';
|
||||||
$this->html.=' <li><a href="/'.$link.'/" title="'.$mtitle.'"'.$sel.'>'.$span.'<span class="mtxt">'.$mname.'</span></a>';
|
$this->html.=' <li><a href="/'.$link.'/" title="'.$mtitle.'"'.$sel.'>'.$span.'<span class="mtxt">'.$mname.'</span></a>';
|
||||||
if(!empty($val['submenu']))
|
if(!empty($val['submenu'])){
|
||||||
{
|
|
||||||
$this->html.= PHP_EOL.' <ul class="submenu">'.PHP_EOL;
|
$this->html.= PHP_EOL.' <ul class="submenu">'.PHP_EOL;
|
||||||
foreach($val['submenu'] as $k=>$s)
|
foreach($val['submenu'] as $k=>$s)
|
||||||
{
|
{
|
||||||
$sname=$parent->translate($s['name']);
|
$sname=$lang->translate($s['name']);
|
||||||
$stitle=$parent->translate($s['title']);
|
$stitle=$lang->translate($s['title']);
|
||||||
|
|
||||||
$slink=$link.'/'.$k;
|
$slink=$link.'/'.$k;
|
||||||
$sl=$link.'_'.$k;
|
$sl=$link.'_'.$k;
|
||||||
$ssel='';
|
$ssel='';
|
||||||
@@ -92,11 +93,11 @@ class Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->html.='</ul>';
|
$this->html.='</ul>';
|
||||||
|
|
||||||
if($this->title=='Error')
|
if($this->title=='Error'){
|
||||||
{
|
$other_titles = Config::other_titles;
|
||||||
if(isset($parent->config->other_titles[$qstr]))
|
if(isset($other_titles[$qstr]))
|
||||||
$this->title=$parent->translate($parent->config->other_titles[$qstr]);
|
$this->title=$lang->translate($other_titles[$qstr]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
php/utils.php
Normal file
17
php/utils.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Utils
|
||||||
|
{
|
||||||
|
public static gen_uri_chunks($uri)
|
||||||
|
{
|
||||||
|
$uri_chunks = [];
|
||||||
|
if(!empty($uri)){
|
||||||
|
$str=str_replace('/index.php','',$uri);
|
||||||
|
$uri_chunks=explode('/',$str);
|
||||||
|
}else if(isset($_POST['path'])){
|
||||||
|
$str=trim($_POST['path'],'/');
|
||||||
|
$uri_chunks=explode('/',$str);
|
||||||
|
}
|
||||||
|
return $uri_chunks;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,11 @@ if(preg_match('/(?i)msie [5-9]/',$_SERVER['HTTP_USER_AGENT']))
|
|||||||
$_REALPATH=realpath('../');
|
$_REALPATH=realpath('../');
|
||||||
$uri=trim($_SERVER['REQUEST_URI'],'/');
|
$uri=trim($_SERVER['REQUEST_URI'],'/');
|
||||||
include($_REALPATH.'/php/clonos.php');
|
include($_REALPATH.'/php/clonos.php');
|
||||||
|
include($_REALPATH.'/php/menu.php');
|
||||||
$clonos=new ClonOS($_REALPATH,$uri);
|
$clonos=new ClonOS($_REALPATH,$uri);
|
||||||
|
$menu=new Menu($this, $uri);
|
||||||
|
$realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/
|
||||||
|
$locale = new Locale($realpath_public);
|
||||||
//echo json_encode($clonos->config->os_types);exit;
|
//echo json_encode($clonos->config->os_types);exit;
|
||||||
if(isset($_GET['upload']))
|
if(isset($_GET['upload']))
|
||||||
{
|
{
|
||||||
@@ -23,7 +27,7 @@ if(isset($_GET['download']))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang=$clonos->getLang();
|
$lang=$locale->get_lang();
|
||||||
$root=trim($_SERVER['DOCUMENT_ROOT'],DIRECTORY_SEPARATOR);
|
$root=trim($_SERVER['DOCUMENT_ROOT'],DIRECTORY_SEPARATOR);
|
||||||
$_ds=DIRECTORY_SEPARATOR;
|
$_ds=DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
@@ -38,8 +42,7 @@ $json_name=$file_path.'a.json.php';
|
|||||||
|
|
||||||
if(empty($uri))
|
if(empty($uri))
|
||||||
{
|
{
|
||||||
$key=$clonos->menu->first_key;
|
header('Location: /'.$menu->first_key.'/',true);
|
||||||
header('Location: /'.$key.'/',true);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +60,7 @@ if(!$user_info['error'])
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>ClonOS — <?php echo $clonos->menu->title; ?></title>
|
<title>ClonOS — <?php echo $menu->title; ?></title>
|
||||||
<link href="/images/favicon.ico?" rel="shortcut icon" type="image/x-icon" />
|
<link href="/images/favicon.ico?" rel="shortcut icon" type="image/x-icon" />
|
||||||
<script src="/js/jquery.js" type="text/javascript"></script>
|
<script src="/js/jquery.js" type="text/javascript"></script>
|
||||||
<script src="/js/clonos.js" type="text/javascript"></script>
|
<script src="/js/clonos.js" type="text/javascript"></script>
|
||||||
@@ -98,7 +101,7 @@ if(!$user_info['error'])
|
|||||||
<?php
|
<?php
|
||||||
if(file_exists($file_name)) include($file_name); else
|
if(file_exists($file_name)) include($file_name); else
|
||||||
{
|
{
|
||||||
echo '<h1>'.$clonos->translate('Not implemented yet').'!</h1>';
|
echo '<h1>'.$locale->translate('Not implemented yet').'!</h1>';
|
||||||
}
|
}
|
||||||
$clonos->placeDialogs();
|
$clonos->placeDialogs();
|
||||||
?>
|
?>
|
||||||
@@ -110,16 +113,16 @@ $clonos->placeDialogs();
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<h2><?php echo $clonos->translate('CPU usage');?>, %:</h2>
|
<h2><?php echo $locale->translate('CPU usage');?>, %:</h2>
|
||||||
<div class="graph v-black g--summary-cpu l-cpu"></div>
|
<div class="graph v-black g--summary-cpu l-cpu"></div>
|
||||||
<br />
|
<br />
|
||||||
<h2><?php echo $clonos->translate('Memory usage');?>, %:</h2>
|
<h2><?php echo $locale->translate('Memory usage');?>, %:</h2>
|
||||||
<div class="graph v-black g--summary-mem l-mem"></div>
|
<div class="graph v-black g--summary-mem l-mem"></div>
|
||||||
<br />
|
<br />
|
||||||
<h2><?php echo $clonos->translate('I/O storage');?>, iops:</h2>
|
<h2><?php echo $locale->translate('I/O storage');?>, iops:</h2>
|
||||||
<div class="graph v-black g--summary-iops l-read,write pr-no te-iops"></div>
|
<div class="graph v-black g--summary-iops l-read,write pr-no te-iops"></div>
|
||||||
<br />
|
<br />
|
||||||
<h2><?php echo $clonos->translate('I/O storage');?>, bit per seconds:</h2>
|
<h2><?php echo $locale->translate('I/O storage');?>, bit per seconds:</h2>
|
||||||
<div class="graph v-black g--summary-bps l-read,write pr-no te-bps"></div>
|
<div class="graph v-black g--summary-bps l-read,write pr-no te-bps"></div>
|
||||||
</div>
|
</div>
|
||||||
</div></div></div></div></main>
|
</div></div></div></div></main>
|
||||||
@@ -127,40 +130,40 @@ $clonos->placeDialogs();
|
|||||||
<div class="menu"><div id="menu">
|
<div class="menu"><div id="menu">
|
||||||
<div class="closer"></div>
|
<div class="closer"></div>
|
||||||
<?php
|
<?php
|
||||||
echo $clonos->menu->html;
|
echo $menu->html;
|
||||||
?><div id="console"></div>
|
?><div id="console"></div>
|
||||||
</div></div>
|
</div></div>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class="top-right">
|
<div class="top-right">
|
||||||
<span class="txt">
|
<span class="txt">
|
||||||
<a href="https://www.bsdstore.ru/ru/donate.html" target="_blank"><?php echo $clonos->translate('DONATE'); ?></a>
|
<a href="https://www.bsdstore.ru/ru/donate.html" target="_blank"><?php echo $locale->translate('DONATE'); ?></a>
|
||||||
<span class="space"></span>
|
<span class="space"></span>
|
||||||
<?php echo $clonos->translate('VERSION'),': ',file_get_contents($clonos->realpath.'version'); ?>
|
<?php echo $locale->translate('VERSION'),': ',file_get_contents($clonos->realpath.'version'); ?>
|
||||||
<span class="space"></span>
|
<span class="space"></span>
|
||||||
<?php echo $clonos->translate('THEMES'); ?>:
|
<?php echo $locale->translate('THEMES'); ?>:
|
||||||
</span>
|
</span>
|
||||||
<span class="ch_theme">
|
<span class="ch_theme">
|
||||||
<span class="light"></span><span class="dark"></span>
|
<span class="light"></span><span class="dark"></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span id="title"><?php echo $clonos->menu->title; ?></span>
|
<span id="title"><?php echo $menu->title; ?></span>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="mhome"><a href="/">Home</a></li>
|
<li class="mhome"><a href="/">Home</a></li>
|
||||||
<?php if($clonos->environment=='development') { ?>
|
<?php if($clonos->environment=='development') { ?>
|
||||||
<li><a href="/settings/"><?php echo $clonos->translate('Settings'); ?></a></li>
|
<li><a href="/settings/"><?php echo $locale->translate('Settings'); ?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li><a href="/users/"><?php echo $clonos->translate('Users'); ?></a></li>
|
<li><a href="/users/"><?php echo $locale->translate('Users'); ?></a></li>
|
||||||
<!--
|
<!--
|
||||||
<li><a href="/profile/"><?php echo $clonos->translate('Profile'); ?></a></li>
|
<li><a href="/profile/"><?php echo $locale->translate('Profile'); ?></a></li>
|
||||||
<li><a href="/support/"><?php echo $clonos->translate('Support'); ?></a></li>
|
<li><a href="/support/"><?php echo $locale->translate('Support'); ?></a></li>
|
||||||
-->
|
-->
|
||||||
<li><a name="">
|
<li><a name="">
|
||||||
<select id="lng-sel">
|
<select id="lng-sel">
|
||||||
<?php
|
<?php
|
||||||
$_languages=$clonos->config->languages;
|
$_languages=$locale->get_available_languages();
|
||||||
if(isset($_languages))foreach($_languages as $lng=>$lngname)
|
foreach($_languages as $lng=>$lngname)
|
||||||
{
|
{
|
||||||
if($lang==$lng) $sel=' selected="selected"'; else $sel='';
|
if($lang==$lng) $sel=' selected="selected"'; else $sel='';
|
||||||
echo ' <option value="'.$lng.'"'.$sel.'>'.$lngname.'</option>'.PHP_EOL;
|
echo ' <option value="'.$lng.'"'.$sel.'>'.$lngname.'</option>'.PHP_EOL;
|
||||||
|
|||||||
Reference in New Issue
Block a user