Follow-up to bug #17157: htmlArea RTE: Not enabled in various browser/system combinations
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 21 Jan 2011 19:13:10 +0000 (19:13 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 21 Jan 2011 19:13:10 +0000 (19:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10223 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/class.tx_rtehtmlarea_base.php

index adb9b28..3da639f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
        * Fixed bug #17140: htmlArea RTE: In WebKit, RTE inserts incorrect link if text is double-clicked
        * Updated htmlArea RTE version to 2.1.5
        * Fixed bug #16975: htmlArea RTE: Use parentNode rather than parentElement
+       * Follow-up to bug #17157: htmlArea RTE: Not enabled in various browser/system combinations
 
 2011-01-21  Susanne Moog  <typo3@susanne-moog.de>
 
index adb4022..305cbe5 100644 (file)
@@ -1,6 +1,7 @@
 2011-01-21  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16975: htmlArea RTE: Use parentNode rather than parentElement
+       * Follow-up to bug #17157: htmlArea RTE: Not enabled in various browser/system combinations
 
 2011-01-20  Stanislas Rolland  <typo3@sjbr.ca>
 
index 22ac99f..face17a 100644 (file)
@@ -41,59 +41,34 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                        'msie' => array (
                                array (
                                        'version' => 6.0,
+                                       'system' => array(
+                                               'allowed' => array(
+                                                       'winNT',
+                                                       'win98',
+                                                       'win95',
+                                               ),
+                                       ),
                                ),
                        ),
                        'gecko' => array (
                                array (
-                                       'version' => 1.8
+                                       'version' => 1.8,
                                ),
                        ),
                        'webkit' => array (
                                array (
                                        'version' => 523,
-                                       'system' => 'mac'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'linux'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'win7'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'winVista'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'winXP'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'win2k'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'winNT'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'win98'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'win95'
-                               ),
-                               array (
-                                       'version' => 523,
-                                       'system' => 'chrome'
+                                       'system' => array(
+                                               'disallowed' => array(
+                                                       'iOS',
+                                               ),
+                                       ),
                                ),
                        ),
                        'opera' => array (
                                array (
-                                       'version' => 9.62
-                               )
+                                       'version' => 9.62,
+                               ),
                        )
                );
 
@@ -168,32 +143,54 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
         *
         * @return      boolean         TRUE if this RTE object offers an RTE in the current browser environment
         */
-
        function isAvailable()  {
-               global $TYPO3_CONF_VARS;
 
                $this->client = $this->clientInfo();
                $this->errorLog = array();
                if (!$this->debugMode)  {       // If debug-mode, let any browser through
-                       $rteIsAvailable = 0;
+                       $rteIsAvailable = FALSE;
                        $rteConfBrowser = $this->conf_supported_browser;
                        if (is_array($rteConfBrowser)) {
                                foreach ($rteConfBrowser as $browser => $browserConf) {
                                        if ($browser == $this->client['browser']) {
                                                        // Config for Browser found, check it:
                                                if (is_array($browserConf)) {
-                                                       foreach ($browserConf as $browserConfNr => $browserConfSub) {
+                                                       foreach ($browserConf as $browserConfSub) {
                                                                if ($browserConfSub['version'] <= $this->client['version'] || empty($browserConfSub['version'])) {
-                                                                       // Version is correct
-                                                                       if ($browserConfSub['system'] == $this->client['system'] || empty($browserConfSub['system'])) {
-                                                                                       // System is correctly
-                                                                               $rteIsAvailable = 1;
+                                                                               // Version is supported
+                                                                       if (is_array($browserConfSub['system'])) {
+                                                                                       // Check against allowed systems
+                                                                               if (is_array($browserConfSub['system']['allowed'])) {
+                                                                                       foreach ($browserConfSub['system']['allowed'] as $system) {
+                                                                                               if (in_array($system, $this->client['all_systems'])) {
+                                                                                                       $rteIsAvailable = TRUE;
+                                                                                                       break;
+                                                                                               }
+                                                                                       }
+                                                                               } else {
+                                                                                               // All allowed
+                                                                                       $rteIsAvailable = TRUE;
+                                                                               }
+                                                                                       // Check against disallowed systems
+                                                                               if (is_array($browserConfSub['system']['disallowed'])) {
+                                                                                       foreach ($browserConfSub['system']['disallowed'] as $system) {
+                                                                                               if (in_array($system, $this->client['all_systems'])) {
+                                                                                                       $rteIsAvailable = FALSE;
+                                                                                                       break;
+                                                                                               }
+                                                                                       }
+                                                                               }
+                                                                       } else {                
+                                                                                       // No system config: system is supported
+                                                                               $rteIsAvailable = TRUE;
+                                                                               break;
                                                                        }// End of System
                                                                }// End of Version
                                                        }// End of foreach-BrowserSubpart
                                                } else {
                                                        // no config for this browser found, so all versions or system with this browsers are allow
-                                                       $rteIsAvailable = 1;
+                                                       $rteIsAvailable = TRUE;
+                                                       break;
                                                }
                                        } // End of Browser Check
                                } // foreach: Browser Check
@@ -201,14 +198,14 @@ class tx_rtehtmlarea_base extends t3lib_rteapi {
                                // no Browser config for this RTE-Editor, so all Clients are allow
                        }
                        if (!$rteIsAvailable) {
-                               $this->errorLog[] = 'rte: Browser not supported. Only msie Version 5 or higher and Mozilla based client 1. and higher.';
+                               $this->errorLog[] = 'RTE: Browser not supported.';
                        }
                        if (t3lib_div::int_from_ver(TYPO3_version) < 4000000) {
-                               $rteIsAvailable = 0;
+                               $rteIsAvailable = FALSE;
                                $this->errorLog[] = 'rte: This version of htmlArea RTE cannot run under this version of TYPO3.';
                        }
                }
-               if ($rteIsAvailable)    return true;
+               return $rteIsAvailable;
        }
 
        /**