diff --git a/source/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini b/source/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini
index ba58e3e..04e0136 100644
--- a/source/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini
+++ b/source/administrator/components/com_jedchecker/language/en-GB/en-GB.com_jedchecker.ini
@@ -48,4 +48,15 @@ COM_JEDCHECKER_WARNING="Warning"
COM_JEDCHECKER_OLD_RULE_X_INI_FILE_NOT_REMOVED="'ini' file for '%s' rule could not be removed, manual removal recommended."
COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_NOT_REMOVED="PHP file for '%s' rule could not be removed, manual removal recommended."
COM_JEDCHECKER_OLD_RULE_X_PHP_FILE_REMOVED="Removed PHP file for '%s' rule."
-COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED="Removed 'ini' file for '%s' rule."
\ No newline at end of file
+COM_JEDCHECKER_OLD_RULE_X_INI_FILE_REMOVED="Removed 'ini' file for '%s' rule."
+COM_JEDCHECKER_RULE_FRAMEWORK="Joomla framework deprecated and unsafe"
+COM_JEDCHECKER_RULE_FRAMEWORK_DESC="Warns about
- superglobals
- commonly used but deprecated functions
- highly unsafe functions
Find more info on Joomla backward compatibility for Joomla 3"
+COM_JEDCHECKER_ERROR_FRAMEWORK_SUPERGLOBALS="You shouldn't use superglobals"
+COM_JEDCHECKER_ERROR_FRAMEWORK_DIRECTDB="You are using direct db access"
+COM_JEDCHECKER_RULE_FRAMEWORK_NOTINJ3="Functions removed from Joomla 3"
+COM_JEDCHECKER_ERROR_FRAMEWORK_NOTINJ3="n/a in Joomla 3"
+COM_JEDCHECKER_ERROR_FRAMEWORK_DS="DS n/a in Joomla 3"
+COM_JEDCHECKER_ERROR_FRAMEWORK_JERR="JError is deprecated, you should use application->enqueueMessages()"
+COM_JEDCHECKER_ERROR_FRAMEWORK_ERRORLOG="error_log and var_dump"
+COM_JEDCHECKER_ERROR_FRAMEWORK_DEPRECATED="JRequest is deprecated and behaves funny with cache"
+COM_JEDCHECKER_ERROR_FRAMEWORK_TODO="Are we procrastinating?"
diff --git a/source/administrator/components/com_jedchecker/libraries/rules/framework.ini b/source/administrator/components/com_jedchecker/libraries/rules/framework.ini
new file mode 100755
index 0000000..e54e3a9
--- /dev/null
+++ b/source/administrator/components/com_jedchecker/libraries/rules/framework.ini
@@ -0,0 +1,37 @@
+; This is the configuration file of the noframework rule.
+;
+; @author Riccardo Zorn
+; @date 2014-02-22
+; @copyright Copyright (C) 2008 - 2014 fasterjoomla.com . All rights reserved.
+; @license GNU General Public License version 2 or later; see LICENSE
+; @site fasterjoomla.com
+
+; A different format for this rule's params. In order to provide accurate messages, we have four main keys
+; - error_groups
+; - warning_groups
+; - notice_groups
+; - compatibility_groups
+; each MUST contain the names of the sub-keys that should trigger a warning or a notice.
+; In case an offending string is found in the file, a warning/notice will be raised with an error message named
+; COM_JEDCHECKER_ERROR_NOFRAMEWORK_ followed by the offending key in uppercase e.g. COM_JEDCHECKER_ERROR_NOFRAMEWORK_SUPERGLOBALS
+;
+; ref: docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_3.0_and_Joomla_Platform_12.1
+
+
+
+error_groups="directdb"
+directdb="mysql_connect,mysql_query,mysql_close,mysql_escape_string"
+
+warning_groups="superglobals"
+superglobals="$_GET,$_POST,$_SESSION,$_COOKIE,$_FILES"
+
+notice_groups="errorlog,todo"
+errorlog="error_log,var_export,var_dump"
+todo="@TODO"
+
+compatibility_groups="notinj3,deprecated,jerr,DS,strict"
+notinj3="JUtility::isWinOS,JFTP,JLDAP,JWebClient,JloadResultArray,nameQuote,JRequest::checkToken,JParameter,JElement,JFormFieldEditors,JHtmlImage,JRules,JSimpleXML,JPane,$db->getEscaped,JDate::toMysql,JUtility::sendMail,JUtility::sendAdminMail,JUtility::getToken,JFactory::getDate,JFactory::getXMLParser,JDate::toMysql"
+deprecated="JHtmlBehavior::mootools,JRequest,::assignRef"
+jerr="JError"
+DS=" DS ,.DS., DS.,.DS "
+strict="&JFactory,&JModuleHelper"
diff --git a/source/administrator/components/com_jedchecker/libraries/rules/framework.php b/source/administrator/components/com_jedchecker/libraries/rules/framework.php
new file mode 100755
index 0000000..4f3379a
--- /dev/null
+++ b/source/administrator/components/com_jedchecker/libraries/rules/framework.php
@@ -0,0 +1,168 @@
+
+ * @date 23.02.2014
+ * @copyright Copyright (C) 2008 - 2014 fasterjoomla.com . All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE
+ */
+
+defined('_JEXEC') or die('Restricted access');
+
+// Include the rule base class
+require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php';
+
+/**
+ * JedcheckerRulesFramework
+ *
+ * @since 2014-02-23
+ * Attempts to identify deprecated code, unsafe code, leftover stuff
+ */
+class JedcheckerRulesFramework extends JEDcheckerRule
+{
+ /**
+ * The formal ID of this rule. For example: SE1.
+ *
+ * @var string
+ */
+ protected $id = 'Framework';
+
+ /**
+ * The title or caption of this rule.
+ *
+ * @var string
+ */
+ protected $title = 'COM_JEDCHECKER_RULE_FRAMEWORK';
+
+ /**
+ * The description of this rule.
+ *
+ * @var string
+ */
+ protected $description = 'COM_JEDCHECKER_RULE_FRAMEWORK_DESC';
+
+ protected $tests = false;
+
+ /**
+ * Initiates the file search and check
+ *
+ * @return void
+ */
+ public function check()
+ {
+ $files = JFolder::files($this->basedir, '.php$', true, true);
+
+ foreach ($files as $file)
+ {
+ // Process the file
+ if ($this->find($file))
+ {
+ // Error messages are set by find() based on the errors found.
+ }
+ }
+ }
+
+ /**
+ * reads a file and searches for any function defined in the params
+ *
+ * @param unknown_type $file The file object
+ *
+ * @return boolean True if the statement was found, otherwise False.
+ */
+ protected function find($file)
+ {
+ $content = (array) file($file);
+ $result = false;
+
+ foreach ($this->getTests() as $testObject)
+ {
+ if ($this->runTest($file, $content, $testObject))
+ {
+ $result = true;
+ }
+ }
+
+ return $result;
+ }
+
+ /**
+ * runs tests and reports to the appropriate function if strings match.
+ *
+ * @param unknown_type $file The file object
+ * @param unknown_type $content The file content
+ * @param unknown_type $testObject The test object generated by getTests()
+ *
+ * @return boolean
+ */
+ private function runTest($file, $content, $testObject)
+ {
+ $error_count = 0;
+
+ foreach ($content as $line_number => $line)
+ {
+ foreach ($testObject->tests AS $singleTest)
+ {
+ if (stripos($line, $singleTest) !== false)
+ {
+ $line = str_ireplace($singleTest, '' . $singleTest . '', $line);
+ $error_message = JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_' . strtoupper($testObject->group)) . ':' . $line . '
';
+
+ switch ($testObject->kind)
+ {
+ case 'error':$this->report->addError($file, $error_message, $line_number);
+ break;
+ case 'warning':$this->report->addWarning($file, $error_message, $line_number);
+ break;
+ case 'compatibility':$this->report->addCompat($file, $error_message, $line_number);
+ break;
+ default:
+ // Case 'notice':
+ $this->report->addInfo($file, $error_message, $line_number);
+ break;
+ }
+ }
+ // If you scored 10 errors on a single file, that's enough for now.
+ if ($error_count > 10)
+ {
+ return true;
+ }
+ }
+ }
+
+ return $error_count > 0;
+ }
+
+ /**
+ * Lazyloads the tests from the framework.ini params.
+ * The whole structure depends on the file. The vars
+ * error_groups, warning_groups, notice_groups, compatibility_groups
+ * serve as lists of other rules, which are grouped and show a different error message per rule.
+ * Please note: if you want to add more rules, simply do so in the .ini file
+ * BUT MAKE SURE that you add the relevant key to the translation files:
+ * COM_JEDCHECKER_ERROR_NOFRAMEWOR_SOMEKEY
+ *
+ * @return boolean
+ */
+ private function getTests()
+ {
+ if (!$this->tests)
+ {
+ // Build the test array. Please read the comments in the framework.ini file
+ $this->tests = array();
+ $testNames = array('error','warning','notice','compatibility');
+
+ foreach ($testNames as $test)
+ {
+ foreach ( explode(",", $this->params->get($test . '_groups')) as $group)
+ {
+ $newTest = new stdClass;
+ $newTest->group = $group;
+ $newTest->kind = $test;
+ $newTest->tests = explode(",", $this->params->get($group));
+ $this->tests[] = $newTest;
+ }
+ }
+ }
+
+ return $this->tests;
+ }
+}
diff --git a/source/administrator/components/com_jedchecker/models/report.php b/source/administrator/components/com_jedchecker/models/report.php
index ae06caf..ec324a1 100644
--- a/source/administrator/components/com_jedchecker/models/report.php
+++ b/source/administrator/components/com_jedchecker/models/report.php
@@ -211,7 +211,7 @@ class JEDcheckerReport extends JObject
// Go through the compat list
if ($compat_count > 0)
{
- $html[] = '' . $error_count . ' ' . JText::_('COM_JEDCHECKER_COMPAT_ISSUES') . '';
+ $html[] = '' . $compat_count . ' ' . JText::_('COM_JEDCHECKER_COMPAT_ISSUES') . '';
$html[] = '';
foreach ($this->data['compat'] AS $i => $item)
@@ -219,7 +219,7 @@ class JEDcheckerReport extends JObject
$num = $i + 1;
// Add the error count number
- $html[] = '#' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
+ $html[] = '
- #' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
$html[] = $item->location;
// Add line information if given
@@ -228,7 +228,7 @@ class JEDcheckerReport extends JObject
$html[] = ' ' . JText::_('COM_JEDCHECKER_IN_LINE') . ': ' . $item->line . '';
}
- $html[] = '';
+ $html[] = '
';
// Add text if given
if (!empty($item->text))
@@ -253,7 +253,7 @@ class JEDcheckerReport extends JObject
$num = $i + 1;
// Add the error count number
- $html[] = ' #' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
+ $html[] = '
- #' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
$html[] = $item->location;
// Add line information if given
@@ -262,7 +262,7 @@ class JEDcheckerReport extends JObject
$html[] = ' ' . JText::_('COM_JEDCHECKER_IN_LINE') . ': ' . $item->line . '';
}
- $html[] = '';
+ $html[] = '
';
// Add text if given
if (!empty($item->text))
@@ -287,7 +287,7 @@ class JEDcheckerReport extends JObject
$num = $i + 1;
// Add the warning count number
- $html[] = ' #' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
+ $html[] = '
- #' . str_pad($num, 3, '0', STR_PAD_LEFT) . ' ';
$html[] = $item->location;
// Add line information if given
@@ -296,7 +296,7 @@ class JEDcheckerReport extends JObject
$html[] = ' ' . JText::_('COM_JEDCHECKER_IN_LINE') . ': ' . $item->line . '';
}
- $html[] = '';
+ $html[] = '
';
// Add text if given
if (!empty($item->text))
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 a473673..db61f13 100644
--- a/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php
+++ b/source/administrator/components/com_jedchecker/views/uploads/tmpl/default.php
@@ -69,6 +69,7 @@ JHtml::script('media/com_jedchecker/js/police.js');
- Peter van Westen (NoNumber)
- Alain Rivest (Aldra.ca)
- OpenTranslators (opentranslators.org)
+ - Riccardo Zorn (fasterjoomla.com)
diff --git a/source/media/com_jedchecker/css/css.css b/source/media/com_jedchecker/css/css.css
index 4113089..2f18b0a 100644
--- a/source/media/com_jedchecker/css/css.css
+++ b/source/media/com_jedchecker/css/css.css
@@ -1,68 +1,97 @@
-.icon-32-unzip {
- background-image: url(../icons/unzip.png);
-}
-.icon-32-police-check {
- background-image: url(../icons/inspect.png);
-}
-
-#adminForm {
- background: #FFF;
-}
-#police-check-result {
- background: #F6F6F6;
- border: 1px solid #CCC;
-}
-
-#police-check-result div:nth-child(odd){
- border-bottom: 1px solid #CCCCCC;
-}
-
-#police-check-result div:nth-child(even){
- background: #EBF1F2;
-}
-
-#police-check-result div {
- padding: 5px 10px 5px;
-}
-
-.help {
- padding: 5px;
- border: 1px solid #CCCCCC;
- background: #FFF;
- margin-left: 10px;
-}
-
-.copyright {
- line-height: 160%;
- margin: 10px;
- text-align: center;
-}
-
-.rule {
- font-weight: bold;
-}
-
-.success {
- color: green;
- font-weight: bold;
-}
-
-.jedchecker-info-message {
- background-color: #D9EDF7;
- border: 1px solid #BCE8F1;
- color: #3A87AD;
- margin: 5px;
- padding: 5px;
- list-style:none;
-}
-
-.jedchecker-warning-message {
- background-color: #FCF8E3;
- border: 1px solid #FBEED5;
- border-radius: 4px;
- color: #C09853;
- margin: 5px;
- padding: 5px;
- text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
- list-style:none;
-}
\ No newline at end of file
+.icon-32-unzip {
+ background-image: url(../icons/unzip.png);
+}
+.icon-32-police-check {
+ background-image: url(../icons/inspect.png);
+}
+
+#adminForm {
+ background: #FFF;
+}
+#police-check-result {
+ background: #F6F6F6;
+ border: 1px solid #CCC;
+}
+
+#police-check-result div
+{
+ border-bottom: 1px solid #CCCCCC;
+}
+
+#police-check-result div:nth-child(even){
+ background: #EBF1F2;
+}
+
+#police-check-result div {
+ padding: 5px 10px 5px;
+}
+
+.help {
+ padding: 5px;
+ border: 1px solid #CCCCCC;
+ background: #FFF;
+ margin-left: 10px;
+}
+
+.copyright {
+ line-height: 160%;
+ margin: 10px;
+ text-align: center;
+}
+
+.rule {
+ font-weight: bold;
+}
+
+.success {
+ color: green;
+ font-weight: bold;
+}
+
+.jedchecker-info-message,
+.jedchecker-warning-message,
+.jedchecker-rule-compat,
+.jedchecker-rule-errors {
+ background: #ebf1f6;
+ background: linear-gradient(120deg, #EBF1F6 0%,#ABD3EE 50%,#89C3EB 51%,#D5EBFB 100%);
+ border: 1px solid #BCE8F1;
+ color: #1A678D;
+ margin: 5px;
+ padding: 5px;
+ list-style:none;
+}
+.jedchecker-rule-errors {
+ background: #FFFFFF;
+ background: linear-gradient(to right, #FFFFFF 0%,#FFFFFF 94%,#C72200 99%);
+ color:#BC0000;
+}
+.jedchecker-warning-message {
+ background: #FFB76B;
+ background: linear-gradient(120deg, #FFC77B 0%, #FFC75D 44%, #FF8930 55%, #FFBC40 68%, #FF9F24 100%);
+ color:black;
+}
+.jedchecker-rule-compat {
+ background: #FCECFC;
+ background: linear-gradient(120deg, #FCECFC 0%, #FFB6F1 50%, #FFA9F7 54%, #FFDCFF 100%);
+}
+
+small {
+ font-size: 110%;
+ padding: 0 0 0 30px;
+ white-space: nowrap;
+
+}
+#police-check-result li {
+ margin-bottom:0.7em;
+ overflow:hidden;
+}
+#police-check-result ul li pre {
+ display:inline-block;
+ padding-left:2em;
+ font-size: 110%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ vertical-align: middle;
+ white-space: nowrap;
+ margin:0;
+ }