diff --git a/source/administrator/components/com_jedchecker/controllers/uploads.php b/source/administrator/components/com_jedchecker/controllers/uploads.php index c770488..23601f3 100644 --- a/source/administrator/components/com_jedchecker/controllers/uploads.php +++ b/source/administrator/components/com_jedchecker/controllers/uploads.php @@ -17,7 +17,7 @@ class jedcheckerControllerUploads extends JController public function __construct() { $this->path = JFactory::getConfig()->get('tmp_path') . '/jed_checker'; - $this->pathArchive = $this->path . '/arhives'; + $this->pathArchive = $this->path . '/archives'; $this->pathUnzipped = $this->path . '/unzipped'; parent::__construct(); } diff --git a/source/administrator/components/com_jedchecker/views/uploads/view.html.php b/source/administrator/components/com_jedchecker/views/uploads/view.html.php index f98b738..08b7c72 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/view.html.php +++ b/source/administrator/components/com_jedchecker/views/uploads/view.html.php @@ -34,8 +34,28 @@ class jedcheckerViewUploads extends JView public function setToolbar() { - JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); - JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false); + if($this->filesExist('archives')) { + JToolBarHelper::custom('uploads.unzip', 'unzip', 'unzip', 'unzip', false); + } + if($this->filesExist('unzipped')) { + JToolBarHelper::custom('police.check', 'police-check', 'police-check', 'check', false); + } + JToolBarHelper::title('JED checker'); } + + /** + * Checks if folder + files exist in the jed_checker tmp path + * @param $type + * @return bool + */ + private function filesExist($type) { + $path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/'.$type; + if(JFolder::exists($path)) { + if(JFolder::folders($path, '.', false) || JFolder::files($path, '.', false)) { + return true; + } + } + return false; + } } \ No newline at end of file