diff --git a/app/Controller/ApiController.php b/app/Controller/ApiController.php old mode 100644 new mode 100755 diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 4ca4c25..757538f 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -37,6 +37,7 @@ class AppController extends Controller { 'Session', 'DebugKit.Toolbar', 'Image', + 'CheckCmd', 'Paginator', 'Auth' => array( 'authenticate' => array( diff --git a/app/Controller/Component/CheckCmdComponent.php b/app/Controller/Component/CheckCmdComponent.php new file mode 100644 index 0000000..bbfb2ec --- /dev/null +++ b/app/Controller/Component/CheckCmdComponent.php @@ -0,0 +1,13 @@ +CheckCmd->is_shell_exec_available($cmd); $cmd = '/usr/bin/convert -gravity Center -quality '.self::$quality.' -crop '.$width.'x'.$height.'+0+0 -page '.$width.'x'.$height.' "'.$to.'" "'.$to.'"'; - shell_exec($cmd); + $this->CheckCmd->is_shell_exec_available($cmd); } return TRUE; } diff --git a/app/Controller/InstallersController.php b/app/Controller/InstallersController.php old mode 100644 new mode 100755 index b1b4229..202bce6 --- a/app/Controller/InstallersController.php +++ b/app/Controller/InstallersController.php @@ -4,6 +4,7 @@ App::uses('File', 'Utility'); App::uses('ConnectionManager', 'Model'); App::uses('SchemaShell', 'Console/Command'); +App::uses('Component', 'Controller'); /** * Class InstallationsController @@ -16,6 +17,8 @@ class InstallersController extends AppController { var $uses = array(); var $layout = 'installer'; + public $components = array('CheckCmd'); + public function beforeFilter() { parent::beforeFilter(); $this->Auth->allow(); @@ -29,7 +32,7 @@ public function beforeFilter() { public function index() { $this->view = "index"; $gd = extension_loaded('gd'); - $libavtools = shell_exec('which avconv') != ''; + $libavtools = $this->CheckCmd->is_shell_exec_available('which avconv') != ''; $is_config_writable = is_writable(APP.'Config'); $is_core_writable = is_writable(APP.'Config'.DS.'core.php'); diff --git a/app/Controller/PlaylistMembershipsController.php b/app/Controller/PlaylistMembershipsController.php old mode 100644 new mode 100755 diff --git a/app/Controller/PlaylistsController.php b/app/Controller/PlaylistsController.php old mode 100644 new mode 100755 diff --git a/app/Controller/SettingsController.php b/app/Controller/SettingsController.php index b219430..94d49e6 100755 --- a/app/Controller/SettingsController.php +++ b/app/Controller/SettingsController.php @@ -11,6 +11,7 @@ class SettingsController extends AppController { public $helpers = array('FileSize'); + public $components = array('CheckCmd'); /** * This function manages the Sonerezh settings panel. @@ -56,7 +57,7 @@ public function index(){ } // Check if avconv shell command is available - $cmd = shell_exec("which avconv"); + $cmd = $this->CheckCmd->is_shell_exec_available('which avconv'); $avconv = empty($cmd) ? false : true; if (empty($this->request->data)) {