mirror of
				https://github.com/optim-enterprises-bv/control-pane.git
				synced 2025-10-31 01:47:52 +00:00 
			
		
		
		
	sync code, fix PHP8 warning
This commit is contained in:
		
							
								
								
									
										5
									
								
								composer.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								composer.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |     "require": { | ||||||
|  |         "sentry/sdk": "^3.0" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -1,5 +1,11 @@ | |||||||
| <?php | <?php | ||||||
| //include_once($_REALPATH.'/forms.php'); | //include_once($_REALPATH.'/forms.php'); | ||||||
|  | // Sentry | ||||||
|  | //if($clonos->environment=='development') { | ||||||
|  | require ('../vendor/autoload.php'); | ||||||
|  | Sentry\init(['dsn' => 'https://MASK' ]); | ||||||
|  | //} | ||||||
|  |  | ||||||
|  |  | ||||||
| class ClonOS { | class ClonOS { | ||||||
| 	public $server_name=''; | 	public $server_name=''; | ||||||
| @@ -17,6 +23,8 @@ class ClonOS { | |||||||
| 	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 $sys_vars=array(); | ||||||
| 	 | 	 | ||||||
| 	private $_post=false; | 	private $_post=false; | ||||||
| 	private $_db=null; | 	private $_db=null; | ||||||
| @@ -152,12 +160,15 @@ class ClonOS { | |||||||
| 		if(isset($this->_vars['form_data'])) $this->form=$this->_vars['form_data']; | 		if(isset($this->_vars['form_data'])) $this->form=$this->_vars['form_data']; | ||||||
| 		 | 		 | ||||||
| 		$ures=$this->userAutologin(); | 		$ures=$this->userAutologin(); | ||||||
|  | 		$this->sys_vars['authorized']=false; | ||||||
| 		if($ures!==false){ | 		if($ures!==false){ | ||||||
| 			if(isset($ures['id']) && is_numeric($ures['id']) && $ures['id']>0){ | 			if(isset($ures['id']) && is_numeric($ures['id']) && $ures['id']>0){ | ||||||
| 				$this->_user_info=$ures; | 				$this->_user_info=$ures; | ||||||
| 				$this->_user_info['unregistered']=false; | 				$this->_user_info['unregistered']=false; | ||||||
|  | 				$this->sys_vars['authorized']=true; | ||||||
| 			}else{ | 			}else{ | ||||||
| 				$this->_user_info['unregistered']=true; | 				$this->_user_info['unregistered']=true; | ||||||
|  | 				if($this->json_req) exit; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| @@ -169,7 +180,22 @@ class ClonOS { | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
|  | 			if($this->_user_info['unregistered'] && $this->mode!='login') | ||||||
|  | 			{ | ||||||
|  | 				echo json_encode(array('error'=>true,'unregistered_user'=>true)); | ||||||
|  | 				exit; | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			unset($_POST); | 			unset($_POST); | ||||||
|  | 			$cfunc='ccmd_'.$this->mode; | ||||||
|  | 			if(method_exists($this,$cfunc)) | ||||||
|  | 			{ | ||||||
|  | 				$ccmd_res=array(); | ||||||
|  | 				$ccmd_res=$this->$cfunc(); | ||||||
|  | 				//print_r($ccmd_res); | ||||||
|  | 				//return; | ||||||
|  | 			} | ||||||
|  | 			 | ||||||
| 			switch($this->mode){ | 			switch($this->mode){ | ||||||
| 				case 'login':	 		echo json_encode($this->login()); return; | 				case 'login':	 		echo json_encode($this->login()); return; | ||||||
| 				case 'getTasksStatus':		echo json_encode($this->_getTasksStatus($this->form['jsonObj'])); return; | 				case 'getTasksStatus':		echo json_encode($this->_getTasksStatus($this->form['jsonObj'])); return; | ||||||
| @@ -245,6 +271,9 @@ class ClonOS { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
|  | 	function ccmd_login(){ | ||||||
|  | 		return array('hi'=>'hello'); | ||||||
|  | 	} | ||||||
| 	function login(){ | 	function login(){ | ||||||
| 		$form=$this->_vars['form_data']; | 		$form=$this->_vars['form_data']; | ||||||
| 		 | 		 | ||||||
| @@ -775,7 +804,7 @@ class ClonOS { | |||||||
| 		$sysrc=array(); | 		$sysrc=array(); | ||||||
| 		if(isset($form['serv-ftpd'])) $sysrc[]=$form['serv-ftpd']; | 		if(isset($form['serv-ftpd'])) $sysrc[]=$form['serv-ftpd']; | ||||||
| 		if(isset($form['serv-sshd'])) $sysrc[]=$form['serv-sshd']; | 		if(isset($form['serv-sshd'])) $sysrc[]=$form['serv-sshd']; | ||||||
| 		$arr['sysrc_enable']=join($sysrc,' '); | 		$arr['sysrc_enable']=implode(' ',$sysrc); | ||||||
| 		 | 		 | ||||||
| 		/* create jail */ | 		/* create jail */ | ||||||
| 		$file_name='/tmp/'.$arr['jname'].'.conf'; | 		$file_name='/tmp/'.$arr['jname'].'.conf'; | ||||||
|   | |||||||
| @@ -201,6 +201,7 @@ class Config | |||||||
| 	} | 	} | ||||||
| 	function create_bhyve_profiles($info) | 	function create_bhyve_profiles($info) | ||||||
| 	{ | 	{ | ||||||
|  | 		$array1=array(); | ||||||
| 		$res=json_decode($info['message'],true); | 		$res=json_decode($info['message'],true); | ||||||
| 		if(!empty($res))foreach($res as $item) | 		if(!empty($res))foreach($res as $item) | ||||||
| 		{ | 		{ | ||||||
|   | |||||||
| @@ -43,6 +43,7 @@ if(empty($uri)) | |||||||
| 	exit; | 	exit; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| error_reporting(E_ALL); | error_reporting(E_ALL); | ||||||
|  |  | ||||||
| $user_info=$clonos->userAutologin(); | $user_info=$clonos->userAutologin(); | ||||||
|   | |||||||
| @@ -4,6 +4,7 @@ var clonos={ | |||||||
| 	manual_close_menu:false, | 	manual_close_menu:false, | ||||||
| 	lastX:0, | 	lastX:0, | ||||||
| 	oldHash:'', | 	oldHash:'', | ||||||
|  | 	authorized:false, | ||||||
| 	commands: | 	commands: | ||||||
| 	{ | 	{ | ||||||
| 		'jstart':{stat:['Not launched','Starting','Launched'],cmd:'jailStart'}, | 		'jstart':{stat:['Not launched','Starting','Launched'],cmd:'jailStart'}, | ||||||
| @@ -913,6 +914,7 @@ var clonos={ | |||||||
| 		 | 		 | ||||||
| 		if(typeof data['unregistered_user']!='undefined') | 		if(typeof data['unregistered_user']!='undefined') | ||||||
| 		{ | 		{ | ||||||
|  | 			this.authorized=false; | ||||||
| 			this.loginFadeIn(); | 			this.loginFadeIn(); | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| @@ -926,6 +928,14 @@ var clonos={ | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
|  | 		if(typeof(data['username'])=='string' && typeof(data['errorCode']!='undefined')) | ||||||
|  | 		{ | ||||||
|  | 			if(data.errorCode==0 && data.username!='') | ||||||
|  | 			{ | ||||||
|  | 				this.authorized=true; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 		return_func(data); | 		return_func(data); | ||||||
| 	}, | 	}, | ||||||
| 	 | 	 | ||||||
| @@ -1641,6 +1651,7 @@ var clonos={ | |||||||
| 	bodyClick:function(event) | 	bodyClick:function(event) | ||||||
| 	{ | 	{ | ||||||
| 		//debugger; | 		//debugger; | ||||||
|  | 		//if(!this.authorized) location.reload(); | ||||||
| 		var target=event.target; | 		var target=event.target; | ||||||
| 		if($(target).parents('form').length>0) | 		if($(target).parents('form').length>0) | ||||||
| 		{ | 		{ | ||||||
| @@ -2099,6 +2110,15 @@ var clonos={ | |||||||
| 	}, | 	}, | ||||||
| 	loginFadeIn:function() | 	loginFadeIn:function() | ||||||
| 	{ | 	{ | ||||||
|  | 		if($('#login').length==0) | ||||||
|  | 		{ | ||||||
|  | 			location.reload(); | ||||||
|  | 			return; | ||||||
|  | 			/* | ||||||
|  | 			alert('I think, you are delete login area from code. Are you a hacker?'+"\nPlease, reload the page and don't do magick with code!"); | ||||||
|  | 			*/ | ||||||
|  | 			//$('#unregistered_user').show(); | ||||||
|  | 		} | ||||||
| 		$('#login').show(); | 		$('#login').show(); | ||||||
| 		$('.login-wait').hide(); | 		$('.login-wait').hide(); | ||||||
| 		$('.login-area').fadeIn(200); | 		$('.login-area').fadeIn(200); | ||||||
|   | |||||||
							
								
								
									
										106
									
								
								public/js/matrix.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								public/js/matrix.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,106 @@ | |||||||
|  | /* | ||||||
|  | <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.12/p5.min.js" type="text/javascript"></script> | ||||||
|  | */ | ||||||
|  | /* | ||||||
|  | cool matrix effect | ||||||
|  | http://creativetier.com/code-rain-js/templates/rain-message/index.php?n=1 | ||||||
|  | */ | ||||||
|  | /* | ||||||
|  | one more | ||||||
|  | https://dev.to/gnsp/making-the-matrix-effect-in-javascript-din | ||||||
|  | */ | ||||||
|  | var streams = []; | ||||||
|  | var fadeInterval = 1.6; | ||||||
|  | var symbolSize = 14; | ||||||
|  |  | ||||||
|  | function setup() { | ||||||
|  |   createCanvas( | ||||||
|  |     window.innerWidth, | ||||||
|  |     window.innerHeight | ||||||
|  |   ); | ||||||
|  |   background(0); | ||||||
|  |   var x = 0; | ||||||
|  |   for (var i = 0; i <= width / symbolSize; i++) { | ||||||
|  |     var stream = new Stream(); | ||||||
|  |     stream.generateSymbols(x, random(-2000, 0)); | ||||||
|  |     streams.push(stream); | ||||||
|  |     x += symbolSize | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   textFont('Consolas'); | ||||||
|  |   textSize(symbolSize); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function draw() { | ||||||
|  |   background(0, 150); | ||||||
|  |   streams.forEach(function(stream) { | ||||||
|  |     stream.render(); | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function Symbol(x, y, speed, first, opacity) { | ||||||
|  |   this.x = x; | ||||||
|  |   this.y = y; | ||||||
|  |   this.value; | ||||||
|  |   this.speed = speed; | ||||||
|  |   this.first = first; | ||||||
|  |   this.opacity = opacity; | ||||||
|  |   this.switchInterval = round(random(2, 25)); | ||||||
|  |   this.setToRandomSymbol = function() { | ||||||
|  |     var charType = round(random(0, 5)); | ||||||
|  |     if (frameCount % this.switchInterval == 0) { | ||||||
|  |       if (charType > 1) { | ||||||
|  |         // set it to Katakana | ||||||
|  |         this.value = String.fromCharCode( | ||||||
|  |           0x30A0 + round(random(0, 96)) | ||||||
|  |         ); | ||||||
|  |       } else { | ||||||
|  |         // set it to numeric | ||||||
|  |         this.value = round(random(0,9)); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   this.rain = function() { | ||||||
|  |     this.y = (this.y >= height) ? 0 : this.y += this.speed; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function Stream() { | ||||||
|  |   this.symbols = []; | ||||||
|  |   this.totalSymbols = round(random(5, 35)); | ||||||
|  |   this.speed = random(5, 22); | ||||||
|  |  | ||||||
|  |   this.generateSymbols = function(x, y) { | ||||||
|  |     var opacity = 255; | ||||||
|  |     var first = round(random(0, 4)) == 1; | ||||||
|  |     for (var i =0; i <= this.totalSymbols; i++) { | ||||||
|  |       symbol = new Symbol( | ||||||
|  |         x, | ||||||
|  |         y, | ||||||
|  |         this.speed, | ||||||
|  |         first, | ||||||
|  |         opacity | ||||||
|  |       ); | ||||||
|  |       symbol.setToRandomSymbol(); | ||||||
|  |       this.symbols.push(symbol); | ||||||
|  |       opacity -= (255 / this.totalSymbols) / fadeInterval; | ||||||
|  |       y -= symbolSize; | ||||||
|  |       first = false; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   this.render = function() { | ||||||
|  |     this.symbols.forEach(function(symbol) { | ||||||
|  |       if (symbol.first) { | ||||||
|  |         fill(140, 255, 170, symbol.opacity); | ||||||
|  |       } else { | ||||||
|  |         fill(0, 255, 70, symbol.opacity); | ||||||
|  |       } | ||||||
|  |       text(symbol.value, symbol.x, symbol.y); | ||||||
|  |       symbol.rain(); | ||||||
|  |       symbol.setToRandomSymbol(); | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -10,6 +10,7 @@ $path=trim($_POST['path'],$_ds); | |||||||
| $_REALPATH=realpath('../'); | $_REALPATH=realpath('../'); | ||||||
| include($_REALPATH.'/php/clonos.php'); | include($_REALPATH.'/php/clonos.php'); | ||||||
| $clonos=new ClonOS($_REALPATH); | $clonos=new ClonOS($_REALPATH); | ||||||
|  | $clonos->json_req=true; | ||||||
|  |  | ||||||
| //$file_path=$_REALPATH.$_ds.'public/pages'.$_ds.$path.$_ds; | //$file_path=$_REALPATH.$_ds.'public/pages'.$_ds.$path.$_ds; | ||||||
| //$clonos->json_name=$file_path.'a.json.php'; | //$clonos->json_name=$file_path.'a.json.php'; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 root
					root