@@ -73,9 +73,17 @@ class FirmwareController extends ApiControllerBase
...
@@ -73,9 +73,17 @@ class FirmwareController extends ApiControllerBase
$response['status']='ok';
$response['status']='ok';
if($response['updates']==1){
if($response['updates']==1){
/* keep this dynamic for template translation even though %s is always '1' */
/* keep this dynamic for template translation even though %s is always '1' */
$response['status_msg']=sprintf(gettext('There is %s update available, total download size is %s.'),$response['updates'],$response['download_size']);
$response['status_msg']=sprintf(
gettext('There is %s update available, total download size is %s.'),
$response['updates'],
$response['download_size']
);
}else{
}else{
$response['status_msg']=sprintf(gettext('There are %s updates available, total download size is %s.'),$response['updates'],$response['download_size']);
$response['status_msg']=sprintf(
gettext('There are %s updates available, total download size is %s.'),
$response['updates'],
$response['download_size']
);
}
}
if($response['upgrade_needs_reboot']==1){
if($response['upgrade_needs_reboot']==1){
$response['status_msg']=sprintf(
$response['status_msg']=sprintf(
...
@@ -131,7 +139,7 @@ class FirmwareController extends ApiControllerBase
...
@@ -131,7 +139,7 @@ class FirmwareController extends ApiControllerBase
$response['status']='ok';
$response['status']='ok';
// sanitize package name
// sanitize package name
$filter=new\Phalcon\Filter();
$filter=new\Phalcon\Filter();
$filter->add('pkgname',function($value){
$filter->add('pkgname',function($value){
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
});
});
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
...
@@ -159,7 +167,7 @@ class FirmwareController extends ApiControllerBase
...
@@ -159,7 +167,7 @@ class FirmwareController extends ApiControllerBase
$response['status']='ok';
$response['status']='ok';
// sanitize package name
// sanitize package name
$filter=new\Phalcon\Filter();
$filter=new\Phalcon\Filter();
$filter->add('pkgname',function($value){
$filter->add('pkgname',function($value){
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
});
});
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
...
@@ -181,13 +189,13 @@ class FirmwareController extends ApiControllerBase
...
@@ -181,13 +189,13 @@ class FirmwareController extends ApiControllerBase
publicfunctionremoveAction($pkg_name)
publicfunctionremoveAction($pkg_name)
{
{
$backend=newBackend();
$backend=newBackend();
$response=array();
$response=array();
if($this->request->isPost()){
if($this->request->isPost()){
$response['status']='ok';
$response['status']='ok';
// sanitize package name
// sanitize package name
$filter=new\Phalcon\Filter();
$filter=new\Phalcon\Filter();
$filter->add('pkgname',function($value){
$filter->add('pkgname',function($value){
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
});
});
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
...
@@ -209,13 +217,13 @@ class FirmwareController extends ApiControllerBase
...
@@ -209,13 +217,13 @@ class FirmwareController extends ApiControllerBase
publicfunctionlockAction($pkg_name)
publicfunctionlockAction($pkg_name)
{
{
$backend=newBackend();
$backend=newBackend();
$response=array();
$response=array();
if($this->request->isPost()){
if($this->request->isPost()){
$response['status']='ok';
$response['status']='ok';
// sanitize package name
// sanitize package name
$filter=new\Phalcon\Filter();
$filter=new\Phalcon\Filter();
$filter->add('pkgname',function($value){
$filter->add('pkgname',function($value){
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
returnpreg_replace('/[^0-9a-zA-Z-_]/','',$value);
});
});
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
$pkg_name=$filter->sanitize($pkg_name,"pkgname");
...
@@ -237,13 +245,13 @@ class FirmwareController extends ApiControllerBase
...
@@ -237,13 +245,13 @@ class FirmwareController extends ApiControllerBase