2012-06-02 21:18:29 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Daniel Dimitrov - compojoom.com
|
|
|
|
* @date: 02.06.12
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
jimport('joomla.application.component.view');
|
|
|
|
|
2012-06-09 13:34:32 +00:00
|
|
|
class jedcheckerViewUploads extends JView
|
|
|
|
{
|
2012-06-02 21:18:29 +00:00
|
|
|
|
2012-06-09 13:34:32 +00:00
|
|
|
public function display($tpl = null)
|
|
|
|
{
|
2012-06-02 21:18:29 +00:00
|
|
|
$this->setToolbar();
|
2012-06-09 13:34:32 +00:00
|
|
|
$this->jsOptions['url'] = JURI::base();
|
|
|
|
$this->jsOptions['rules'] = $this->getRules();
|
2012-06-02 21:18:29 +00:00
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
2012-06-09 13:34:32 +00:00
|
|
|
public function getRules()
|
|
|
|
{
|
2012-07-06 23:45:06 +00:00
|
|
|
$rules = array();
|
|
|
|
$files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '.php$', false, false);
|
|
|
|
JLoader::discover('jedcheckerRules',JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');
|
|
|
|
|
|
|
|
foreach ($files as $file)
|
|
|
|
{
|
|
|
|
$rules[] = substr($file, 0, -4);
|
2012-06-09 13:34:32 +00:00
|
|
|
}
|
2012-07-06 23:45:06 +00:00
|
|
|
|
2012-06-09 13:34:32 +00:00
|
|
|
return $rules;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setToolbar()
|
|
|
|
{
|
2012-06-24 07:50:50 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-06-23 14:12:44 +00:00
|
|
|
JToolBarHelper::title('JED checker');
|
2012-06-02 21:18:29 +00:00
|
|
|
}
|
2012-06-24 07:50:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|
2012-06-02 21:18:29 +00:00
|
|
|
}
|