diff --git a/CHANGELOG b/CHANGELOG index 4c17897..c967504 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ Changelog: +~ code cleaup and joomla's phpcs compatibility (at least for the rules) +# Fixed unnecessary GPL checks in php files with no code - thanks to Peter van Westen +# Fixed unnecessary JEXEC checks in php files with no code - thanks to Peter van Westen ++ added rule to check for error_reporting(0) - thanks to Denis Delici # JFile not found \ No newline at end of file diff --git a/README.md b/README.md index d837df0..d2a156f 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,35 @@ This extension is able to check your components, modules or plugins for common e from publishing your extension on the JED (Joomla! Extensions Directory). Installing this extension -------------------------- -ZIP packages for installation in joomla can be found here: +ZIP packages with the latest stable version of the extension can be found here: https://compojoom.com/downloads/official-releases-stable/jedchecker -Alternatively, download the sources of this repository and use Phing to build the packages. +If you are developer and want to contribute to this extension you can fork this repo. -Uploading your package ----------------------- +## Building the zip package from this repository +In order to build the installation packages of this library you need to have +the following tools: + +- A command line environment. Bash under Linux / Mac OS X . On Windows + you will need to run most tools using an elevated privileges (administrator) + command prompt. +- The PHP CLI binary in your path + +- Command line Subversion and Git binaries(*) + +- PEAR and Phing installed, with the Net_FTP and VersionControl_SVN PEAR + packages installed + +You will also need the following path structure on your system + +- com_jedchecker - This repository +- buildtools - Compojoom build tools (https://github.com/compojoom/buildtools) + +## 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 ------------- +## 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`. @@ -26,8 +42,10 @@ The file `yourrule.php` needs to have a class `jedcheckerRulesYourrule` and that function that accepts the basedir as parameter. This is all - the component will automatically call your rule check function. -Checking on existing files and folders --------------------------------------- +If you are going to contribute your rule to the project, then make sure that it follows the joomla coding conventions +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. @@ -40,3 +58,13 @@ Example `tmp/jed_checker/local.txt` file: plugins/system +## COPYRIGHT AND DISCLAIMER +CMandrill - Copyright (c) 2008-2013 Compojoom.com + +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/. diff --git a/builds/component.xml b/builds/build.xml similarity index 90% rename from builds/component.xml rename to builds/build.xml index 987d0b7..698662a 100644 --- a/builds/component.xml +++ b/builds/build.xml @@ -10,12 +10,11 @@ - - - + + + - - + @@ -142,19 +141,6 @@ component="com_${component.name}" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/builds/phingext/GitVersionTask.php b/builds/phingext/GitVersionTask.php deleted file mode 100644 index e017fbb..0000000 --- a/builds/phingext/GitVersionTask.php +++ /dev/null @@ -1,55 +0,0 @@ -propertyName = $propertyName; - } - - /** - * Returns the name of the property to use - */ - function getPropertyName() - { - return $this->propertyName; - } - - /** - * Sets the path to the working copy - */ - function setWorkingCopy($wc) - { - $this->workingCopy = $wc; - } - - /** - * The main entry point - * - * @throws BuildException - */ - function main() - { - $this->setup('info'); - - - exec('git log -n 1 --no-decorate --pretty=format:"%h" '.escapeshellarg(realpath($this->workingCopy)), $out); - $version = $out[0]; - - $this->project->setProperty($this->getPropertyName(), $version); - } -} \ No newline at end of file diff --git a/builds/phingext/explodetask.php b/builds/phingext/explodetask.php deleted file mode 100644 index 11805d2..0000000 --- a/builds/phingext/explodetask.php +++ /dev/null @@ -1,56 +0,0 @@ -string = $string; - } - - public function setDelimiter($delimiter) { - $this->delimiter = $delimiter; - } - - public function setKey($key) { - $this->key = $key; - } - - /** - * Defines the name of a property to be set . - * - * @param string $name Name for the property to be set from input - */ - public function setPropertyName($name) { - $this->propertyName = $name; - } - - /** - * The init method: Do init steps. - */ - public function init() - { - // nothing to do here - } - - /** - * The main entry point method. - */ - public function main() - { - if ($this->propertyName === null) { - throw new BuildException("You must specify a value for propertyName attribute."); - } - - - $value = explode($this->delimiter, $this->string); - - if ($value !== null) { - $this->project->setUserProperty($this->propertyName, $value[$this->key]); - } - } - -} \ No newline at end of file diff --git a/builds/phingext/listjpackagefilestask.php b/builds/phingext/listjpackagefilestask.php deleted file mode 100644 index 412336a..0000000 --- a/builds/phingext/listjpackagefilestask.php +++ /dev/null @@ -1,310 +0,0 @@ -type = $type; - } - - public function setFile($str) - { - $this->file = $str; - } - - public function setSourceDir($dir) - { - $this->sourceDir = $dir; - } - - public function setComponent($name) - { - $this->component = $name; - } - - /** - * The init method: Do init steps. - */ - public function init() - { - // nothing to do here - } - - /** - * The main entry point method. - */ - public function main() - { - $content = file_get_contents($this->file); - - $content = preg_replace_callback('/##PACKAGEFILESPLUGIN##/', 'self::findPluginPackageFiles', $content); - - if (preg_match('/##PACKAGEFILESMODULE##/', $content)) { - $content = preg_replace('/##PACKAGEFILESMODULE##/', - call_user_func('self::findModulePackageFiles'), $content); - } - - if (preg_match('/##ADMINLANGUAGEFILES##/', $content)) { - $content = preg_replace('/##ADMINLANGUAGEFILES##/', - call_user_func('self::languageFiles', true), $content); - } - - if (preg_match('/##FRONTENDLANGUAGEFILES##/', $content)) { - $content = preg_replace('/##FRONTENDLANGUAGEFILES##/', - call_user_func('self::languageFiles', false), $content); - } - - if (preg_match('/##ADMINCOMPONENTPACKAGEFILES##/', $content)) { - $content = preg_replace('/##ADMINCOMPONENTPACKAGEFILES##/', - call_user_func('self::findComponentPackagefiles', true), $content); - } - - - if (preg_match('/##FRONTENDCOMPONENTPACKAGEFILES##/', $content)) { - $content = preg_replace('/##FRONTENDCOMPONENTPACKAGEFILES##/', - call_user_func('self::findComponentPackagefiles', false), $content); - } - - if (preg_match('/##MEDIAPACKAGEFILES##/', $content)) { - $content = preg_replace('/##MEDIAPACKAGEFILES##/', - call_user_func('self::findMediaPackagefiles', false), $content); - } - - file_put_contents($this->file, $content); - } - - public function languageFiles($admin = false) - { - - if($this->type == 'module') { - $this->sourceDir = $this->sourceDir . '/../../'; - } - if($this->type == 'plugin') { - $this->sourceDir = $this->sourceDir . '/../../../'; - } - $languageFolder = $this->sourceDir . '/language'; - if ($admin) { - $languageFolder = $this->sourceDir . '/administrator/language'; - } - $list = array(); - if (file_exists($languageFolder)) { - $dir = new DirectoryIterator($languageFolder); - - foreach ($dir as $element) { - if (!$element->isDot()) { - if ($element->isDir()) { - $langDir = new DirectoryIterator($element->getPath() . '/' . $element->getFileName()); - - foreach ($langDir as $langElement) { - if (!$langElement->isDot()) { - if ($langElement->isFile()) { - if ($this->component) { -// if(strstr($this->component,'sys')) - $name = explode('.', $langElement->getFileName()); - $name = $name[1]; - if ($name == $this->component) { - $list[] = '' - . $element->getFileName() . '/' . $langElement->getFileName() . ''; - } - } -// else { -// $list[] = '' -// . $element->getFileName() . '/' . $langElement->getFileName() . ''; -// } - // $packageMainFile = basename($this->file, '.xml'); - // if ($element->getFileName() == $packageMainFile . '.php') { - // . $element->getFileName() . '/' . $langElement->getFileName() . ''; - } - } - } - } - } - } - } else { - echo 'Folder ' . $languageFolder . ' doesn\'t exist'; - } - - return implode("\n", $list); - } - - public function findComponentPackagefiles($admin = false) - { - $list = array(); - $componentFolder = $this->sourceDir . '/components/' . $this->component; - if ($admin) { - $componentFolder = $this->sourceDir . '/administrator/components/' . $this->component; - } - - if (file_exists($componentFolder)) { - $dir = new DirectoryIterator($componentFolder); - foreach ($dir as $element) { - if (!$element->isDot()) { - if ($element->isDir()) { - $list[] = '' . $element->getFileName() . ''; - } - if ($element->isFile()) { - $list[] = '' . $element->getFileName() . ''; - } - } - - } - } else { - echo 'Folder ' . $componentFolder . ' doesn\'t exist'; - } - - return implode("\n", $list); - } - - public function findMediaPackagefiles() - { - $list = array(); - $source = $this->sourceDir; - if(strstr($source, '/administrator/')) { - if($this->type == 'module') { - $source = $source . '..'; - } - } - $mediaFolder = $source . '/media/' . $this->component; - if (file_exists($mediaFolder)) { - $dir = new DirectoryIterator($mediaFolder); - foreach ($dir as $element) { - if (!$element->isDot() && substr($element, 0, 1) != ".") { - if ($element->isDir()) { - $list[] = '' . $element->getFileName() . ''; - } - if ($element->isFile()) { - $list[] = '' . $element->getFileName() . ''; - } - } - - } - - } else { - echo 'Folder ' . $mediaFolder . ' doesn\'t exist'; - } - return implode("\n", $list); - } - - public function findPluginPackageFiles() - { - $list = array(); - if (file_exists($this->sourceDir)) { - $dir = new DirectoryIterator($this->sourceDir); - foreach ($dir as $element) { - if (!$element->isDot()) { - if ($element->isDir()) { - $skip = false; - if ($element->getFileName() == 'administrator') { - /** - * we need to handle the language folder in the plugin - * differently. If the administrator folder contains - * just the language folder we don't need to list it. - * Otherwise when the user installs the plugin he will have - * administrator/language in his plugi folder which is lame... - */ - $adminDir = new DirectoryIterator($this->sourceDir . '/administrator'); - $i = 0; - $language = false; - foreach ($adminDir as $adminElement) { - if ($adminElement->isDir() && !$adminElement->isDot()) { - if ($adminElement->getFileName() == 'language') { - $language = true; - } - $i++; - } - } - /** - * so we have just one folder and it is - * the language one??? - */ - if ($i == 1 && $language == true) { - $skip = true; - } - } - - if (!$skip) { - $list[] = '' . $element->getFileName() . ''; - } - } - if ($element->isFile()) { - $packageMainFile = basename($this->file, '.xml'); - if ($element->getFileName() == $packageMainFile . '.php') { - $list[] = '' . $element->getFilename() . ''; - } elseif ($element->getFileName() != basename($this->file)) { - $list[] = '' . $element->getFileName() . ''; - } - } - } - } - } else { - echo 'Folder ' . $this->sourceDir . ' doesn\'t exist'; - } - - return implode("\n", $list); - } - - - public function findModulePackageFiles() - { - $list = array(); - if (file_exists($this->sourceDir)) { - $dir = new DirectoryIterator($this->sourceDir); - foreach ($dir as $element) { - if (!$element->isDot()) { - if ($element->isDir()) { - $skip = false; - if ($element->getFileName() == 'administrator') { - /** - * we need to handle the language folder in the plugin - * differently. If the administrator folder contains - * just the language folder we don't need to list it. - * Otherwise when the user installs the plugin he will have - * administrator/language in his plugi folder which is lame... - */ - $adminDir = new DirectoryIterator($this->sourceDir . '/administrator'); - $i = 0; - $language = false; - foreach ($adminDir as $adminElement) { - if ($adminElement->isDir() && !$adminElement->isDot()) { - if ($adminElement->getFileName() == 'language') { - $language = true; - } - $i++; - } - } - /** - * so we have just one folder and it is - * the language one??? - */ - if ($i == 1 && $language == true) { - $skip = true; - } - } - - if (!$skip) { - $list[] = '' . $element->getFileName() . ''; - } - } - if ($element->isFile()) { - $packageMainFile = basename($this->file, '.xml'); - if ($element->getFileName() == $packageMainFile . '.php') { - $list[] = '' . $element->getFilename() . ''; - } elseif ($element->getFileName() != basename($this->file)) { - $list[] = '' . $element->getFileName() . ''; - } - } - } - } - } else { - echo 'Folder ' . $this->sourceDir . ' doesn\'t exist'; - } - - return implode("\n", $list); - } - -} \ No newline at end of file diff --git a/builds/plugin.xml b/builds/plugin.xml deleted file mode 100644 index 887270f..0000000 --- a/builds/plugin.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php b/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php index 8991d15..a473673 100644 --- a/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php +++ b/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php @@ -64,6 +64,8 @@ JHtml::script('media/com_jedchecker/js/police.js');

  • Tobias Kuhn (projectfork)
  • +
  • Jisse Reitsma (yireo)
  • +
  • Denis Dulici (mijosoft)
  • Peter van Westen (NoNumber)
  • Alain Rivest (Aldra.ca)
  • OpenTranslators (opentranslators.org)
  • diff --git a/source/administrator/language/en-GB/en-GB.com_jedchecker.ini b/source/administrator/language/en-GB/en-GB.com_jedchecker.ini index 792c391..66d3c65 100644 --- a/source/administrator/language/en-GB/en-GB.com_jedchecker.ini +++ b/source/administrator/language/en-GB/en-GB.com_jedchecker.ini @@ -9,7 +9,7 @@ COM_JEDCHECKER_STEP1="Upload your component/plugin/module zip file by using the COM_JEDCHECKER_STEP2="Click on unzip" COM_JEDCHECKER_STEP3="Click on check and review the results" COM_JEDCHECKER_WALL_OF_HONOR="Wall of honor" -COM_JEDCHECKER_PEOPLE_THAT_HAVE_HELPED_WITH_THE_DEVELOPMENT="People that have helped with the development of this component" +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_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 this way increases the security of your site."