[BUGFIX] Check if TypoScript is loaded for indexed_search 01/50301/2
authorTomita Militaru <militarutomita@gmail.com>
Fri, 2 Sep 2016 20:08:17 +0000 (22:08 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 21 Oct 2016 08:34:44 +0000 (10:34 +0200)
Check if TypoScript is loaded for indexed_search, if not,
show an error message.

Resolves: #75866
Releases: master, 7.6
Change-Id: I0b5be9d959dd0d4fc4a5f4df1b287c4a0fca2885
Reviewed-on: https://review.typo3.org/50301
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php
typo3/sysext/indexed_search/Resources/Private/Language/locallang.xlf
typo3/sysext/indexed_search/Resources/Private/Templates/Search/NoTypoScript.html [new file with mode: 0644]
typo3/sysext/indexed_search/ext_localconf.php

index 47fa165..c0f702e 100644 (file)
@@ -161,6 +161,11 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
             $searchData = [];
         }
 
+        // check if TypoScript is loaded
+        if (!isset($this->settings['results'])) {
+            $this->redirect('noTypoScript');
+        }
+
         $this->loadSettings();
 
         // setting default values
@@ -930,6 +935,13 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
         $this->view->assign('searchParams', $searchData);
     }
 
+    /**
+     * TypoScript was not loaded
+     */
+    public function noTypoScriptAction()
+    {
+    }
+
     /****************************************
      * building together the available options for every dropdown
      ***************************************/
index 8574965..ff6868b 100644 (file)
@@ -475,6 +475,9 @@ All search words are converted to lowercase.
                        <trans-unit id="administration.noPageSelected">
                                <source>Please select a page from the page tree.</source>
                        </trans-unit>
+                       <trans-unit id="error.noTypoScript">
+                               <source>Error: Please check that TypoScript for the Indexed Search plugin is included.</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
diff --git a/typo3/sysext/indexed_search/Resources/Private/Templates/Search/NoTypoScript.html b/typo3/sysext/indexed_search/Resources/Private/Templates/Search/NoTypoScript.html
new file mode 100644 (file)
index 0000000..b33c523
--- /dev/null
@@ -0,0 +1 @@
+<f:translate key="error.noTypoScript" />
\ No newline at end of file
index 92234b2..b0b2ac0 100644 (file)
@@ -20,7 +20,7 @@ plugin.tx_indexedsearch.userFunc = ' . \TYPO3\CMS\IndexedSearch\Controller\Searc
 );
 
 // register extbase plugin
-\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('TYPO3.CMS.IndexedSearch', 'Pi2', ['Search' => 'form,search'], ['Search' => 'form,search']);
+\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin('TYPO3.CMS.IndexedSearch', 'Pi2', ['Search' => 'form,search,noTypoScript'], ['Search' => 'form,search']);
 
 // Attach to hooks:
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageIndexing'][] = \TYPO3\CMS\IndexedSearch\Indexer::class;