diff --git a/Classes/Controller/CategorycommentController.php b/Classes/Controller/CategorycommentController.php index 0a8d286..cdcf5f8 100644 --- a/Classes/Controller/CategorycommentController.php +++ b/Classes/Controller/CategorycommentController.php @@ -15,6 +15,7 @@ use Jp\Jpfaq\Service\SendMailService; use Jp\Jpfaq\Domain\Model\Categorycomment; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -104,7 +105,7 @@ public function addCommentAction(Categorycomment $newCategorycomment, array $cat if ($currentUid == $pluginUid) { // Set comment IP - $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jpfaq']); + $extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('jpfaq'); $anonymizeIpSetting = $extensionConfiguration['anonymizeIp']; $commentIp= (string)GeneralUtility::getIndpEnv('REMOTE_ADDR'); diff --git a/Classes/Controller/QuestioncommentController.php b/Classes/Controller/QuestioncommentController.php index f446ae5..c9ca211 100644 --- a/Classes/Controller/QuestioncommentController.php +++ b/Classes/Controller/QuestioncommentController.php @@ -16,6 +16,7 @@ use Jp\Jpfaq\Service\SendMailService; use Jp\Jpfaq\Domain\Model\Question; use Jp\Jpfaq\Domain\Model\Questioncomment; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -85,7 +86,7 @@ public function addCommentAction(Question $question, Questioncomment $newQuestio if ($currentUid == $pluginUid) { // Set comment IP - $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jpfaq']); + $extensionConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('jpfaq'); $anonymizeIpSetting = $extensionConfiguration['anonymizeIp']; $commentIp= (string)GeneralUtility::getIndpEnv('REMOTE_ADDR'); diff --git a/Classes/Domain/Model/Question.php b/Classes/Domain/Model/Question.php index 7278675..8dd8765 100644 --- a/Classes/Domain/Model/Question.php +++ b/Classes/Domain/Model/Question.php @@ -254,6 +254,16 @@ public function setNothelpful($nothelpful) $this->nothelpful = $nothelpful; } + /** + * Returns the Questioncomment + * + * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Jp\Jpfaq\Domain\Model\Questioncomment> + */ + public function getQuestioncomment() + { + return $this->questioncomment; + } + /** * Adds a questioncomment * diff --git a/Classes/Domain/Model/TtContent.php b/Classes/Domain/Model/TtContent.php index da1817b..5d0eb25 100644 --- a/Classes/Domain/Model/TtContent.php +++ b/Classes/Domain/Model/TtContent.php @@ -20,20 +20,6 @@ */ class TtContent extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity { - /** - * uid - * - * @var string - */ - protected $uid = ''; - - /** - * pid - * - * @var string - */ - protected $pid = ''; - /** * @var \DateTime */ @@ -617,23 +603,4 @@ public function getContentType() { public function setContentType($contentType) { $this->contentType = $contentType; } - - /** - * Gets the uid - * - * @return string $uid - */ - public function getUid() { - return $this->uid; - } - - /** - * Gets the pid - * - * @return string $pid - */ - public function getPid() { - return $this->pid; - } - } diff --git a/Classes/Service/SendMailService.php b/Classes/Service/SendMailService.php index 77d2dd2..6e1ec6d 100644 --- a/Classes/Service/SendMailService.php +++ b/Classes/Service/SendMailService.php @@ -29,7 +29,14 @@ public static function sendMail(string $receivers, array $sender, string $subjec $mail->setTo($receivers); $mail->setFrom($sender); $mail->setSubject($subject); - $mail->setBody('' . $body . ' ', 'text/html'); + + // TYPO3 10 uses Mailer whereas TYPO3 9 uses SwiftMailer + if (method_exists($mail, 'html')) { + $mail->html('' . $body . ' '); + } else { + $mail->setBody('' . $body . ' ', 'text/html'); + } + $mail->send(); return $mail->isSent(); diff --git a/Classes/ViewHelpers/ExcludeAlreadyDisplayedQuestionsViewHelper.php b/Classes/ViewHelpers/ExcludeAlreadyDisplayedQuestionsViewHelper.php index 468320b..f20e11a 100644 --- a/Classes/ViewHelpers/ExcludeAlreadyDisplayedQuestionsViewHelper.php +++ b/Classes/ViewHelpers/ExcludeAlreadyDisplayedQuestionsViewHelper.php @@ -11,8 +11,7 @@ * LICENSE file that was distributed with this source code. */ use Jp\Jpfaq\Domain\Model\Question; -use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface; -use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface; +use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; /** @@ -28,7 +27,7 @@ * * */ -class ExcludeAlreadyDisplayedQuestionsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper implements CompilableInterface +class ExcludeAlreadyDisplayedQuestionsViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper { use CompileWithRenderStatic; diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php new file mode 100644 index 0000000..1d89a0a --- /dev/null +++ b/Configuration/Extbase/Persistence/Classes.php @@ -0,0 +1,13 @@ + [ + 'tableName' => 'tt_content', + 'properties' => [ + 'contentType' => [ + 'fieldName' => 'CType' + ], + ], + ], +]; diff --git a/Configuration/TCA/tx_jpfaq_domain_model_category.php b/Configuration/TCA/tx_jpfaq_domain_model_category.php index 247fca2..9d8c4ed 100644 --- a/Configuration/TCA/tx_jpfaq_domain_model_category.php +++ b/Configuration/TCA/tx_jpfaq_domain_model_category.php @@ -7,7 +7,6 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', - 'dividers2tabs' => 1, 'sortby' => 'sorting', 'versioningWS' => true, 'languageField' => 'sys_language_uid', diff --git a/Configuration/TCA/tx_jpfaq_domain_model_question.php b/Configuration/TCA/tx_jpfaq_domain_model_question.php index 4c7eb47..69851de 100644 --- a/Configuration/TCA/tx_jpfaq_domain_model_question.php +++ b/Configuration/TCA/tx_jpfaq_domain_model_question.php @@ -7,7 +7,6 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', - 'dividers2tabs' => 1, 'sortby' => 'sorting', 'versioningWS' => true, 'languageField' => 'sys_language_uid', diff --git a/Configuration/TCA/tx_jpfaq_domain_model_questioncomment.php b/Configuration/TCA/tx_jpfaq_domain_model_questioncomment.php index 7d0d263..4200df3 100644 --- a/Configuration/TCA/tx_jpfaq_domain_model_questioncomment.php +++ b/Configuration/TCA/tx_jpfaq_domain_model_questioncomment.php @@ -6,6 +6,7 @@ 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', + 'sortby' => 'sorting', 'default_sortby' => 'crdate DESC', 'versioningWS' => true, 'languageField' => 'sys_language_uid', diff --git a/Configuration/TypoScript/TSconfig/Page/contentElementWizard.ts b/Configuration/TsConfig/Page/contentElementWizard.tsconfig similarity index 100% rename from Configuration/TypoScript/TSconfig/Page/contentElementWizard.ts rename to Configuration/TsConfig/Page/contentElementWizard.tsconfig diff --git a/Configuration/TypoScript/TSconfig/Page/pageTSconfig.ts b/Configuration/TsConfig/Page/pageTSconfig.tsconfig similarity index 100% rename from Configuration/TypoScript/TSconfig/Page/pageTSconfig.ts rename to Configuration/TsConfig/Page/pageTSconfig.tsconfig diff --git a/Configuration/TsConfig/includePageTSconfig.tsconfig b/Configuration/TsConfig/includePageTSconfig.tsconfig new file mode 100644 index 0000000..9723846 --- /dev/null +++ b/Configuration/TsConfig/includePageTSconfig.tsconfig @@ -0,0 +1 @@ + diff --git a/Configuration/TypoScript/TSconfig/includePageTSconfig.ts b/Configuration/TypoScript/TSconfig/includePageTSconfig.ts deleted file mode 100644 index 1ee75b1..0000000 --- a/Configuration/TypoScript/TSconfig/includePageTSconfig.ts +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Configuration/TypoScript/constants.ts b/Configuration/TypoScript/constants.typoscript similarity index 100% rename from Configuration/TypoScript/constants.ts rename to Configuration/TypoScript/constants.typoscript diff --git a/Configuration/TypoScript/setup.ts b/Configuration/TypoScript/setup.typoscript similarity index 100% rename from Configuration/TypoScript/setup.ts rename to Configuration/TypoScript/setup.typoscript diff --git a/README.md b/README.md index be39d05..1b57ee6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # jpfaq Frequently Asked Questions (FAQ) plugin. Optional features: categories, on-the-fly search, customer helpfulness tracking and comments. -For TYPO3 9.5 +For TYPO3 9.5 and TYPO3 10.4 -Install: composer require jvdp/jpfaq +## Install + +To install this extension, run `composer require jvdp/jpfaq`. diff --git a/composer.json b/composer.json index 46f9543..c7b2396 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "issues": "https://forge.typo3.org/projects/extension-jpfaq/" }, "require": { - "typo3/cms-core": "^9.5" + "typo3/cms-core": "^9.5 || ^10.4" }, "autoload": { "psr-4": { diff --git a/ext_emconf.php b/ext_emconf.php index 09cd409..e48b091 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -15,7 +15,7 @@ array( 'depends' => array( - 'typo3' => '9.5.0-9.5.99', + 'typo3' => '9.5.0-10.4.99', ), 'conflicts' => array(), diff --git a/ext_localconf.php b/ext_localconf.php index 5c442f0..1ec50ab 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -20,10 +20,10 @@ function ($extKey) { ] ); }, - $_EXTKEY + 'jpfaq' ); -\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(''); /** * Icon registry diff --git a/ext_tables.sql b/ext_tables.sql index 298c915..316738a 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -2,46 +2,13 @@ # Table structure for table 'tx_jpfaq_domain_model_question' # CREATE TABLE tx_jpfaq_domain_model_question ( - - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - question varchar(255) DEFAULT '' NOT NULL, answer text NOT NULL, additional_content_answer int(11) unsigned DEFAULT '0' NOT NULL, categories int(11) unsigned DEFAULT '0' NOT NULL, questioncomment int(11) unsigned DEFAULT '0' NOT NULL, helpful int(11) unsigned DEFAULT '0' NOT NULL, - nothelpful int(11) unsigned DEFAULT '0' NOT NULL, - - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, - hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, - - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state tinyint(4) DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, - sorting int(11) DEFAULT '0' NOT NULL, - - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY t3ver_oid (t3ver_oid,t3ver_wsid), - KEY language (l10n_parent,sys_language_uid) - + nothelpful int(11) unsigned DEFAULT '0' NOT NULL ); # IRRE Records @@ -53,42 +20,9 @@ CREATE TABLE tt_content ( # Table structure for table 'tx_jpfaq_domain_model_category' # CREATE TABLE tx_jpfaq_domain_model_category ( - - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - category varchar(255) DEFAULT '' NOT NULL, description text NOT NULL, - categorycomment int(11) unsigned DEFAULT '0' NOT NULL, - - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, - hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, - - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state tinyint(4) DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, - sorting int(11) DEFAULT '0' NOT NULL, - - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY t3ver_oid (t3ver_oid,t3ver_wsid), - KEY language (l10n_parent,sys_language_uid) - + categorycomment int(11) unsigned DEFAULT '0' NOT NULL ); # @@ -108,87 +42,24 @@ CREATE TABLE tx_jpfaq_question_category_mm ( # Table structure for table 'tx_jpfaq_domain_model_questioncomment' # CREATE TABLE tx_jpfaq_domain_model_questioncomment ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - question int(11) unsigned DEFAULT '0' NOT NULL, name varchar(255) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, comment text NOT NULL, ip varchar(255) DEFAULT 'local' NOT NULL, - finfo varchar(255) DEFAULT '' NOT NULL, - - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, - hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, - - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state tinyint(4) DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, - sorting int(11) DEFAULT '0' NOT NULL, - - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY t3ver_oid (t3ver_oid,t3ver_wsid), - KEY language (l10n_parent,sys_language_uid) + finfo varchar(255) DEFAULT '' NOT NULL ); - # # Table structure for table 'tx_jpfaq_domain_model_categorycomment' # CREATE TABLE tx_jpfaq_domain_model_categorycomment ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, - category int(11) unsigned DEFAULT '0' NOT NULL, name varchar(255) DEFAULT '' NOT NULL, email varchar(255) DEFAULT '' NOT NULL, comment text NOT NULL, ip varchar(255) DEFAULT 'local' NOT NULL, - finfo varchar(255) DEFAULT '' NOT NULL, - - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, - hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, - - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state tinyint(4) DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, - sorting int(11) DEFAULT '0' NOT NULL, - - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, - - PRIMARY KEY (uid), - KEY parent (pid), - KEY t3ver_oid (t3ver_oid,t3ver_wsid), - KEY language (l10n_parent,sys_language_uid) + finfo varchar(255) DEFAULT '' NOT NULL ); # @@ -202,4 +73,4 @@ CREATE TABLE tx_jpfaq_category_comment_mm ( KEY uid_local (uid_local), KEY uid_foreign (uid_foreign) -); \ No newline at end of file +);