* Moved register_media under CBSD

This commit is contained in:
Momchil Bozhinov
2021-02-23 23:24:28 +02:00
parent 9ad42d0b84
commit b43aab5a10
3 changed files with 16 additions and 15 deletions

View File

@@ -54,5 +54,18 @@ class CBSD {
}
}
function register_media($path,$file,$ext)
{
$cmd='cbsd media mode=register name=%s path=%s type=%s';
$res=self::run($cmd, array($file, $path.$file, $ext));
if($res['error']){
$arr['error']=true;
$arr['error_message']='File image not registered!';
} else {
$arr['error']=false;
}
echo json_encode($arr);
}
}

View File

@@ -2239,19 +2239,6 @@ class ClonOS {
return '<span class="cbsd-str">'.$cmd_string.'</span>';
}
function register_media($path,$file,$ext){
$cmd='cbsd media mode=register name=%s path=%s type=%s';
$res=CBSD::run($cmd, array($file, $path.$file, $ext));
if($res['error']){
$arr['error']=true;
$arr['error_message']='File image not registered!';
} else {
$arr['error']=false;
}
echo json_encode($arr);
}
function media_iso_list_html(){
// $form=$this->form;
$db=new Db('base','storage_media');

View File

@@ -11,17 +11,18 @@ require_once($_real_path.'/php/clonos.php');
require_once($_real_path.'/php/menu.php');
$chunks=Utils::gen_uri_chunks($uri);
$clonos=new ClonOS($_real_path, $chunks);
$cbsd = new CBSD();
$locale = new Locale($_real_path.'/public/'); # /usr/home/web/cp/clonos/public/
$menu=new Menu($locale, $chunks);
if(isset($_GET['upload'])){
include('upload.php');
$clonos->register_media($path,$file,$ext);
$cbsd->register_media($path,$file,$ext);
exit;
}
if(isset($_GET['download'])){
include('download.php');
$clonos->register_media($path,$file,$ext);
$cbsd->register_media($path,$file,$ext);
exit;
}