Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalsanchez committed Mar 9, 2019
1 parent ce7ea93 commit b34cb44
Show file tree
Hide file tree
Showing 42 changed files with 779 additions and 366 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?php defined('_JEXEC') or die(); ?>

=====================================================================
JED Checker 2.1.0 - Released 9-March-2019
=====================================================================
+ Compatibility with Joomla 4
+ Rule INFO_XML
+ Update Server Requirement
~ Copyright updated to Joomla! / OSM

=====================================================================
JED Checker 2.0 - Released 2-April-2017
=====================================================================
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
JED Checker
==========
# JED Checker

This extension is able to check your components, modules or plugins for common errors that will prevent you
from publishing your extension on the JED (Joomla! Extensions Directory).

If you are a developer and want to contribute to this extension you can fork this repo.

## Uploading your package

After installing this extension in your Joomla! backend, you can use it by uploading a Joomla! extension-package using
the upload-button. Once uploaded, the contents of the package (your files) will be checked against JED-rules.

## Adding rules

If you want to write a rule have a look a the `administrator/components/com_jedchecker/library/rules` folder.

You just need to add a new file with your rule, for example `yourrule.php`.
Expand All @@ -23,25 +24,24 @@ If you are going to contribute your rule to the project, then make sure that it
and that it passes the code sniffer: http://docs.joomla.org/Joomla_CodeSniffer

## Checking on existing files and folders

The extension also supports a scan of a pre-defined set of existing files and folders.
For this to work, add a list of folders to a textfile `tmp/jed_checker/local.txt`.
There should be a folder on each line.
There should be a folder on each line.
Once the file exists, a "Check" button becomes visible in the jedchecker-toolbar. Just hit it.

Example `tmp/jed_checker/local.txt` file:

components/com_weblinks
administrator/components/com_weblinks
components/com_jedchecker
administrator/components/com_jedchecker
plugins/system


## COPYRIGHT AND DISCLAIMER
Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.

Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

This extension was previously maintained by Compojoom.
7 changes: 3 additions & 4 deletions administrator/components/com_jedchecker/controller.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
/**
* @author Daniel Dimitrov <[email protected]>
* @date 26.10.15
* @package Joomla.JEDChecker
*
* @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die ('Restricted access');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
/**
* @author Daniel Dimitrov <[email protected]>
* @date 26.10.15
* @package Joomla.JEDChecker
*
* @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');
Expand All @@ -28,7 +27,7 @@ class JedcheckerControllerPolice extends JControllerLegacy
*/
public function check()
{
$rule = JRequest::getString('rule');
$rule = JFactory::getApplication()->input->get('rule', null);

JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');

Expand Down
85 changes: 72 additions & 13 deletions administrator/components/com_jedchecker/controllers/uploads.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php
/**
* @author Daniel Dimitrov <[email protected]>
* @date 26.10.15
* @package Joomla.JEDChecker
*
* @copyright Copyright (C) 2008 - 2015 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');
Expand All @@ -13,13 +12,20 @@
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.archive');

use Joomla\Archive\Archive;

/**
* Class JedcheckerControllerUploads
*
* @since 1.0
*/
class JedcheckerControllerUploads extends JControllerlegacy
{

var $path = null;
var $pathArchive = null;
var $pathUnzipped = null;

/**
* Constructor.
*
Expand All @@ -41,14 +47,14 @@ public function upload()
{
$appl = JFactory::getApplication();
$input = JFactory::getApplication()->input;

// Check the sent token by the form
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Gets the uploaded file from the sent form
$file = $input->files->get('extension', null, 'raw');

if ($file['tmp_name'])
if ( $file['tmp_name'] )
{
$path = $this->pathArchive;

Expand Down Expand Up @@ -83,14 +89,21 @@ public function upload()
{
// Error in upload - redirect back with an error notice
JFactory::getApplication()->enqueueMessage(JText::_('COM_JEDCHECKER_ERROR_UNABLE_TO_UPLOAD_FILE'), 'error');
$this->setRedirect('index.php?option=com_jedchecker&view=uploads');
$appl->redirect('index.php?option=com_jedchecker&view=uploads');

return false;
}

$appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_('COM_JEDCHECKER_UPLOAD_WAS_SUCCESSFUL'));
// Unzip uploaded files
$unzip_result = $this->unzip();

$this->setRedirect( 'index.php?option=com_jedchecker&view=uploads' );


return true;
} else {

$this->setRedirect('index.php?option=com_jedchecker&view=uploads');
}

return false;
Expand All @@ -104,7 +117,7 @@ public function upload()
public function unzip()
{
$appl = JFactory::getApplication();

// Form check token
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

Expand All @@ -125,22 +138,36 @@ public function unzip()
}

$file = JFolder::files($this->pathArchive);
$result = JArchive::extract($this->pathArchive . '/' . $file[0], $this->pathUnzipped . '/' . $file[0]);

$origin = $this->pathArchive . DIRECTORY_SEPARATOR . $file[0];
$destination = $this->pathUnzipped . DIRECTORY_SEPARATOR . $file[0];

try
{
$archive = new Archive;
$result = $archive->extract($origin, $destination);
}
catch (\Exception $e)
{
$result = false;
}

if ($result)
{
// Scan unzipped folders if we find zip file -> unzip them as well
$this->unzipAll($this->pathUnzipped . '/' . $file[0]);
$message = 'COM_JEDCHECKER_UNZIP_SUCCESS';
JFactory::getApplication()->enqueueMessage(JText::_($message));
}
else
{
$message = 'COM_JEDCHECKER_UNZIP_FAILED';
}

$appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message));
//$appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message));
$message = 'COM_JEDCHECKER_UNZIP_FAILED';

return $result;
return $message;
}

/**
Expand All @@ -163,7 +190,15 @@ public function unzipAll($start)
if ($extension == 'zip')
{
$unzip = $file->getPath() . '/' . $file->getBasename('.' . $extension);
$result = JArchive::extract($file->getPathname(), $unzip);
try
{
$archive = new Archive;
$result = $archive->extract($file->getPathname(), $unzip);
}
catch (\Exception $e)
{
$result = false;
}

// Delete the archive once we extract it
if ($result)
Expand All @@ -181,4 +216,28 @@ public function unzipAll($start)
}
}
}

/**
* clear tmp folders
*
*/
public function clear()
{
if ( file_exists($this->path) )
{
$result = JFolder::delete($this->path);

if (!$result)
{
echo 'could not delete ' . $this->path;
$message = 'COM_JEDCHECKER_DELETE_FAILED';
}

$message = 'COM_JEDCHECKER_DELETE_SUCCESS';

//JFactory::getApplication()->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message));
$this->setRedirect( 'index.php?option=com_jedchecker&view=uploads' );

}
}
}
9 changes: 4 additions & 5 deletions administrator/components/com_jedchecker/jedchecker.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<?php
/**
* @author Daniel Dimitrov - compojoom.com
* @date : 02.06.12
* @package Joomla.JEDChecker
*
* @copyright Copyright (C) 2008 - 2012 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerlegacy');

if (!JFactory::getUser()->authorise('core.manage', 'com_jedchecker'))
if (!JFactory::getUser()->authorise('core.manage', 'com_jedchecker'))
{
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
}
Expand Down
26 changes: 0 additions & 26 deletions administrator/components/com_jedchecker/jedchecker.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ COM_JEDCHECKER_STEP1="Upload din komponent /plugin /modul zip-fil ved hjælp af
COM_JEDCHECKER_STEP2="Klik på Unzip"
COM_JEDCHECKER_STEP3="Klik på Kontroller og gennemgå resultaterne"
COM_JEDCHECKER_WALL_OF_HONOR="Wall of Honour"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Folk, der har hjulpet med udviklingen af ​​denne komponent. (I nogen bestemt rækkefølge!)"
COM_JEDCHECKER_CONTRIBUTORS="Contributors"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Folk, der har hjulpet med udviklingen af ​​denne komponent."
COM_JEDCHECKER_HOW_TO_INTERPRET_RESULTS="Sådan fortolke resultaterne"
COM_JEDCHECKER_RULE_PH2="PHP filer mangler JEXEC sikkerhed"
COM_JEDCHECKER_RULE_PH2_DESC="Alle PHP-filer i din udvidelse skal have en defined('_JEXEC') or die(); erklæring i begyndelsen af ​​hver fil. Dette sikrer, at filen ikke kan åbnes uden for installation Joomla og øger sikkerheden for dit websted."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ COM_JEDCHECKER_CONGRATS="Congratulations! If you use this component then you've
COM_JEDCHECKER_CODE_STANDARDS="However, this is not the only goal. We also aim to have code standards checks, such as those that the JPlatform has. This would ensure that Joomla extension developers are aware of the JPlatform coding standards and this could raise the quality bar in our Joomla community even higher. For this we will need you - have a look at the <a href='%s' target='_blank'>Github project page</a>. Fork the component, add your code checks and send us your pull requests!"
COM_JEDCHECKER_HOW_TO_USE="How to check your extension using the JED Checker:"
COM_JEDCHECKER_STEP1="Upload your component/plugin/module zip file by using the upload form below"
COM_JEDCHECKER_STEP2="Click on Unzip"
COM_JEDCHECKER_STEP3="Click on Check and review the results"
COM_JEDCHECKER_STEP2="Click on Check and review the results"
COM_JEDCHECKER_WALL_OF_HONOR="Wall of Honour"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="People that have helped with the development of this component. (in no particular order!)"
COM_JEDCHECKER_CONTRIBUTORS="Contributors"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="People that have helped with the development of this component."
COM_JEDCHECKER_HOW_TO_INTERPRET_RESULTS="How to Interpret the Results"
COM_JEDCHECKER_RULE_PH2="PHP Files missing JEXEC security"
COM_JEDCHECKER_RULE_PH2_DESC="All the PHP files in your extension needs to have a defined('_JEXEC') or die(); statement in the beginning of each file. This ensures that the file cannot be opened outside of the joomla installation and increases the security of your site."
COM_JEDCHECKER_RULE_PH3="License tag missing or incorrect in XML install file"
COM_JEDCHECKER_RULE_PH3_DESC="An install file should include the license information in a license-tag. The license must be GPL or GPL compatible."
COM_JEDCHECKER_EVERYTHING_SEEMS_TO_BE_FINE_WITH_THAT_RULE="Congratulations, everything seems to be fine with that rule!"
COM_JEDCHECKER_DEVELOPED_BY="JED Checker is primary developed by <a href='%s'>compojoom.com</a>"
COM_JEDCHECKER_DEVELOPED_BY="JED Checker is a JED proyect."
COM_JEDCHECKER_PHP_VERSION_INCOMPATIBLE="JED Checker is incompatible with the PHP version that you run on this site: %s. You would need at least PHP Version %s. Aborting installation"
COM_JEDCHECKER_ERROR_HTML_INDEX_NOT_FOUND="Missing index.html in this directory."
COM_JEDCHECKER_ERROR_JEXEC_NOT_FOUND="The JEXEC security check was not found in this file."
Expand All @@ -40,7 +40,7 @@ COM_JEDCHECKER_LEAVE_A_REVIEW_JED="If you use this component, please post a rati
COM_JEDCHECKER_INFO="Info"
COM_JEDCHECKER_INFO_XML="Information about extension xml files"
COM_JEDCHECKER_INFO_XML_DESC="The install name of your extension must match your listing name on JED. We scan the xml files and find the value of the name tag. Useful information for the &quot;filename and install as&quot; fields in the jed submission form"
COM_JEDCHECKER_INFO_XML_NAME_XML="The name tag in this file is: %s"
COM_JEDCHECKER_INFO_XML_NAME_XML="The name tag in this file is: <b>%s</b>"
COM_JEDCHECKER_INFO_XML_VERSION_XML="Version tag has the value: %s"
COM_JEDCHECKER_INFO_XML_CREATIONDATE_XML="The creationDate tag has the value: %s"
COM_JEDCHECKER_RULE_PH1="PHP Headers missing GPL License Notice"
Expand Down Expand Up @@ -75,3 +75,6 @@ COM_JEDCHECKER_RULE_US1_DESC="The use of Update Servers is now required by JED."
COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_NOT_FOUND="Update Server tag missing or incorrect in this XML file"
COM_JEDCHECKER_ERROR_XML_UPDATE_SERVER_LINK_NOT_FOUND="Update Server link not found in this XML file"
COM_JEDCHECKER_INFO_XML_UPDATE_SERVER_LINK="The Update Server link in this XML file is: %s"
COM_JEDCHECKER_DELETE_FAILED="Can't delete temporary folder"
COM_JEDCHECKER_DELETE_SUCCESS="Temporary folder deleted!"
COM_JEDCHECKER_EMPTY_UPLOAD_FIELD="Please, select a zipped file to be uploaded"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ COM_JEDCHECKER_STEP1="Cargue su archivo zip componente / plugin / módulo usando
COM_JEDCHECKER_STEP2="Haga clic en Unzip"
COM_JEDCHECKER_STEP3="Haga clic en Verificar y revisar los resultados"
COM_JEDCHECKER_WALL_OF_HONOR="Muro de Honor"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Personas que han ayudado con el desarrollo de este componente (¡en ningún orden particular!)"
COM_JEDCHECKER_CONTRIBUTORS="Contribuidores"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Personas que han ayudado con el desarrollo de este componente."
COM_JEDCHECKER_HOW_TO_INTERPRET_RESULTS="Cómo interpretar los resultados"
COM_JEDCHECKER_RULE_PH2="Archivos PHP que carecen de seguridad JEXEC"
COM_JEDCHECKER_RULE_PH2_DESC="Todos los archivos PHP de su extensión necesitan tener una sentencia defined('_JEXEC') or die(); en el principio de cada archivo. Esto asegura que el archivo no se puede abrir fuera de la instalación joomla e incrementa la seguridad De su sitio. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ COM_JEDCHECKER_STEP1="Carica il tuo / / file zip modulo plug componente utilizza
COM_JEDCHECKER_STEP2="Fare clic su Unzip"
COM_JEDCHECKER_STEP3="Fare clic su Verifica e rivedere i risultati"
COM_JEDCHECKER_WALL_OF_HONOR="Wall of Honour"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Le persone che hanno contribuito allo sviluppo di questo componente. (In nessun ordine particolare!)"
COM_JEDCHECKER_CONTRIBUTORS="Contributori"
COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="Le persone che hanno contribuito allo sviluppo di questo componente."
COM_JEDCHECKER_HOW_TO_INTERPRET_RESULTS="Come interpretare i risultati"
COM_JEDCHECKER_RULE_PH2="PHP file di sicurezza mancante jexec"
COM_JEDCHECKER_RULE_PH2_DESC="Tutti i file PHP in proprio interno ha bisogno di avere un defined('_JEXEC') or die(); Dichiarazione all'inizio di ogni file Questo assicura che il file non può essere aperto al di fuori dell'impianto di joomla e aumenta la sicurezza del tuo sito. "
Expand Down
Loading

0 comments on commit b34cb44

Please sign in to comment.