From 602bc238d5bb21c563d8347f65eff5b26a26b823 Mon Sep 17 00:00:00 2001 From: wilsonge Date: Sun, 15 Mar 2020 13:51:52 +0000 Subject: [PATCH 01/68] Fix missing assigns variable. Fixes #28349 --- libraries/src/Form/FormField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php index 75240bc16c6e1..fdeb5f8f96a49 100644 --- a/libraries/src/Form/FormField.php +++ b/libraries/src/Form/FormField.php @@ -1131,7 +1131,7 @@ public function validate($value, $group = null, Registry $input = null) if ($valid !== false && $this instanceof SubformField) { // Load the subform validation rule. - FormHelper::loadRuleType('SubForm'); + $rule = FormHelper::loadRuleType('SubForm'); try { From b475126e0dbfd145e841c59978266cf5165341c9 Mon Sep 17 00:00:00 2001 From: Astrid Date: Sun, 15 Mar 2020 16:06:11 +0100 Subject: [PATCH 02/68] [4.0] Set default Site and Admin languages in installer (#28328) --- installation/language/en-GB/joomla.ini | 26 +- installation/language/en-US/joomla.ini | 26 +- .../src/Controller/InstallationController.php | 11 - .../src/Controller/LanguageController.php | 125 --- installation/src/Model/LanguagesModel.php | 926 ------------------ installation/src/View/Remove/HtmlView.php | 10 +- installation/template/js/remove.js | 38 + installation/tmpl/remove/default.php | 93 ++ 8 files changed, 145 insertions(+), 1110 deletions(-) diff --git a/installation/language/en-GB/joomla.ini b/installation/language/en-GB/joomla.ini index b44bad00eeebe..543fb977158de 100644 --- a/installation/language/en-GB/joomla.ini +++ b/installation/language/en-GB/joomla.ini @@ -139,39 +139,19 @@ INSTL_LANGUAGES_WARNING_NO_INTERNET2="Note: You will be able to install language INSTL_LANGUAGES_WARNING_BACK_BUTTON="Return to last installation step" ;Default language view -INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE="Activate the multilingual feature" -INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE_DESC="If active, your Joomla site will have the multilingual feature active with localised menus for each installed language." -INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN="Enable the language code plugin" -INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN_DESC="If enabled, the language code plugin will add the ability to change the language code in the generated HTML document to improve SEO." INSTL_DEFAULTLANGUAGE_ADMINISTRATOR="Default Administrator language" INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT="Joomla was unable to set the language as default. English will be used as default language for the Backend Administrator." INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Joomla has set %s as your default ADMINISTRATOR language." INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Select" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Language" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Tag" -INSTL_DEFAULTLANGUAGE_COULD_NOT_ADD_ASSOCIATIONS="Joomla was unable to automatically create the language associations." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE="Joomla was unable to automatically create the %s content language." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU="Joomla was unable to automatically create the %s menu." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM="Joomla was unable to automatically create the %s home menu item." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE="Joomla was unable to automatically create the %s menu module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY="Joomla was unable to automatically create the %s content category." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE="Joomla was unable to automatically create the %s localised article." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Joomla was unable to automatically publish the language switcher module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Joomla was unable to automatically enable the Language Code Plugin." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Joomla was unable to automatically enable the Language Filter Plugin." INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language." -INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG="Joomla was unable to install the multilingual sample data as only one language is installed. To activate the multilingual feature, you need to install more languages, press the 'Previous' button and choose the desired languages from the list." -INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Joomla was unable to automatically publish the language status module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Joomla was unable to automatically unpublish the default menu module." -INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla Administrator." -INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla Frontend." +INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla Administrator." +INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla Frontend." INSTL_DEFAULTLANGUAGE_FRONTEND="Default Site language" INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT="Joomla was unable to set the language as default. English will be used as default language for the Frontend SITE." INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT="Joomla has set %s as your default SITE language." -INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT="Install localised content" -INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT_DESC="If active, Joomla will automatically create one content category per each installed language. Also, one featured article with dummy content will be created in each category." -INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_TITLE="Multilingual" -INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_DESC="This section allows you to automatically activate the Joomla multilingual feature." +INSTL_DEFAULTLANGUAGE_SET_DEFAULT_LANGUAGE="Set default language" INSTL_DEFAULTLANGUAGE_TRY_LATER="You will be able to install it later using the Joomla Administrator" ; IMPORTANT NOTE FOR TRANSLATORS: Do not literally translate this line, instead add the localised name of the language. For example Spanish will be Español diff --git a/installation/language/en-US/joomla.ini b/installation/language/en-US/joomla.ini index b54926c0e5ef6..301b21442b775 100644 --- a/installation/language/en-US/joomla.ini +++ b/installation/language/en-US/joomla.ini @@ -139,39 +139,19 @@ INSTL_LANGUAGES_WARNING_NO_INTERNET2="Note: You will be able to install language INSTL_LANGUAGES_WARNING_BACK_BUTTON="Return to last installation step" ;Default language view -INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE="Activate the multilingual feature" -INSTL_DEFAULTLANGUAGE_ACTIVATE_MULTILANGUAGE_DESC="If active, your Joomla site will have the multilingual feature active with localised menus for each installed language." -INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN="Enable the language code plugin" -INSTL_DEFAULTLANGUAGE_ACTIVATE_LANGUAGE_CODE_PLUGIN_DESC="If enabled, the language code plugin will add the ability to change the language code in the generated HTML document to improve SEO." INSTL_DEFAULTLANGUAGE_ADMINISTRATOR="Default Administrator language" INSTL_DEFAULTLANGUAGE_ADMIN_COULDNT_SET_DEFAULT="Joomla was unable to set the language as default. English will be used as default language for the Backend Administrator." INSTL_DEFAULTLANGUAGE_ADMIN_SET_DEFAULT="Joomla has set %s as your default ADMINISTRATOR language." INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_SELECT="Select" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_LANGUAGE="Language" INSTL_DEFAULTLANGUAGE_COLUMN_HEADER_TAG="Tag" -INSTL_DEFAULTLANGUAGE_COULD_NOT_ADD_ASSOCIATIONS="Joomla was unable to automatically create the language associations." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE="Joomla was unable to automatically create the %s content language." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU="Joomla was unable to automatically create the %s menu." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM="Joomla was unable to automatically create the %s home menu item." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE="Joomla was unable to automatically create the %s menu module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY="Joomla was unable to automatically create the %s content category." -INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE="Joomla was unable to automatically create the %s localised article." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Joomla was unable to automatically publish the language switcher module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Joomla was unable to automatically enable the Language Code Plugin." -INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Joomla was unable to automatically enable the Language Filter Plugin." INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language." -INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG="Joomla was unable to install the multilingual sample data as only one language is installed. To activate the multilingual feature, you need to install more languages, press the 'Previous' button and choose the desired languages from the list." -INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Joomla was unable to automatically publish the language status module." -INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Joomla was unable to automatically unpublish the default menu module." -INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla Administrator." -INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla Frontend." +INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla Administrator." +INSTL_DEFAULTLANGUAGE_DESC_FRONTEND="Joomla has installed the following languages. Please select your desired default language for the Joomla Frontend." INSTL_DEFAULTLANGUAGE_FRONTEND="Default Site language" INSTL_DEFAULTLANGUAGE_FRONTEND_COULDNT_SET_DEFAULT="Joomla was unable to set the language as default. English will be used as default language for the Frontend SITE." INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT="Joomla has set %s as your default SITE language." -INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT="Install localised content" -INSTL_DEFAULTLANGUAGE_INSTALL_LOCALISED_CONTENT_DESC="If active, Joomla will automatically create one content category per each installed language. Also, one featured article with dummy content will be created in each category." -INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_TITLE="Multilingual" -INSTL_DEFAULTLANGUAGE_MULTILANGUAGE_DESC="This section allows you to automatically activate the Joomla multilingual feature." +INSTL_DEFAULTLANGUAGE_SET_DEFAULT_LANGUAGE="Set default language" INSTL_DEFAULTLANGUAGE_TRY_LATER="You will be able to install it later using the Joomla Administrator" ; IMPORTANT NOTE FOR TRANSLATORS: Do not literally translate this line, instead add the localised name of the language. For example Spanish will be Español diff --git a/installation/src/Controller/InstallationController.php b/installation/src/Controller/InstallationController.php index 3ca8fdcca8ccb..53e97bb81bd41 100644 --- a/installation/src/Controller/InstallationController.php +++ b/installation/src/Controller/InstallationController.php @@ -191,17 +191,6 @@ public function languages() // Install selected languages $model->install($lids); - - // Publish the Content Languages. - $failedLanguages = $model->publishContentLanguages(); - - if (!empty($failedLanguages)) - { - foreach ($failedLanguages as $failedLanguage) - { - $this->app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CONTENT_LANGUAGE', $failedLanguage), 'warning'); - } - } } // Redirect to the page. diff --git a/installation/src/Controller/LanguageController.php b/installation/src/Controller/LanguageController.php index d69546efe4aa3..75f7cdabb4f6c 100644 --- a/installation/src/Controller/LanguageController.php +++ b/installation/src/Controller/LanguageController.php @@ -14,9 +14,7 @@ use Joomla\CMS\Factory; use Joomla\CMS\Installation\Model\SetupModel; use Joomla\CMS\Language\Language; -use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; -use Joomla\CMS\Table\Table; /** * Language controller class for the Joomla Installer. @@ -134,129 +132,6 @@ public function setdefault() $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_FRONTEND_SET_DEFAULT', $frontend_lang), 'message'); } - // Check if user has activated the multilingual site - $data = $this->input->post->get('jform', array(), 'array'); - - if ((int) $data['activateMultilanguage']) - { - if (count(LanguageHelper::getInstalledLanguages(0)) < 2) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG'), 'warning'); - $r = new \stdClass; - - // Redirect to the same page. - $r->view = 'defaultlanguage'; - $this->sendJsonResponse($r); - } - - if (!$model->enablePlugin('plg_system_languagefilter')) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER', $frontend_lang), 'warning'); - } - - // Activate optional ISO code Plugin - $activatePluginIsoCode = (int) $data['activatePluginLanguageCode']; - - if ($activatePluginIsoCode && !$model->enablePlugin('plg_system_languagecode')) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE'), 'warning'); - } - - if (!$model->addModuleLanguageSwitcher()) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE'), 'warning'); - } - - // Add menus - Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables/'); - - $siteLanguages = $model->getInstalledlangsFrontend(); - $groupedAssociations = array(); - - foreach ($siteLanguages as $siteLang) - { - if (!$model->addMenuGroup($siteLang)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU', $siteLang->name), 'warning'); - - continue; - } - - if (!$data['installLocalisedContent']) - { - if (!$tableMenuItem = $model->addFeaturedMenuItem($siteLang)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning'); - - continue; - } - - $groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id; - } - - if (!$tableMenuItem = $model->addAllCategoriesMenuItem($siteLang)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning'); - - continue; - } - - $groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id; - - if (!$model->addModuleMenu($siteLang)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_MODULE', $frontend_lang), 'warning'); - - continue; - } - - if ((int) $data['installLocalisedContent']) - { - if (!$tableCategory = $model->addCategory($siteLang)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_CATEGORY', $frontend_lang), 'warning'); - - continue; - } - - $groupedAssociations['com_categories.item'][$siteLang->language] = $tableCategory->id; - - if (!$tableMenuItem = $model->addBlogMenuItem($siteLang, $tableCategory->id)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_MENU_ITEM', $siteLang->name), 'warning'); - - continue; - } - - $groupedAssociations['com_menus.item'][$siteLang->language] = $tableMenuItem->id; - - if (!$tableArticle = $model->addArticle($siteLang, $tableCategory->id)) - { - $app->enqueueMessage(Text::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_CREATE_ARTICLE', $frontend_lang), 'warning'); - - continue; - } - - $groupedAssociations['com_content.item'][$siteLang->language] = $tableArticle->id; - } - } - - if (!$model->addAssociations($groupedAssociations)) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_ADD_ASSOCIATIONS'), 'warning'); - } - - if (!$model->disableModuleMainMenu()) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU'), 'warning'); - } - - if (!$model->enableModule('mod_multilangstatus')) - { - $app->enqueueMessage(Text::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS'), 'warning'); - } - } - $r = new \stdClass; // Redirect to the final page. diff --git a/installation/src/Model/LanguagesModel.php b/installation/src/Model/LanguagesModel.php index 00ba747e1f761..60c7c700a3cc4 100644 --- a/installation/src/Model/LanguagesModel.php +++ b/installation/src/Model/LanguagesModel.php @@ -17,13 +17,11 @@ use Joomla\CMS\Form\Form; use Joomla\CMS\Installer\Installer; use Joomla\CMS\Installer\InstallerHelper; -use Joomla\CMS\Language\Language; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Table\Table; use Joomla\CMS\Updater\Update; use Joomla\CMS\Updater\Updater; -use Joomla\Database\Exception\ExecutionFailureException; /** * Language Installer model for the Joomla Core Installer. @@ -561,928 +559,4 @@ public function getForm($view = null) return $form; } - - /** - * Enable a Joomla plugin. - * - * @param string $pluginName The name of plugin. - * - * @return boolean - * - * @since 3.2 - */ - public function enablePlugin($pluginName) - { - // Create a new db object. - $db = Factory::getDbo(); - $query = $db->getQuery(true); - - $query - ->clear() - ->update($db->quoteName('#__extensions')) - ->set($db->quoteName('enabled') . ' = 1') - ->where($db->quoteName('name') . ' = ' . $db->quote($pluginName)) - ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')); - - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (ExecutionFailureException $e) - { - return false; - } - - // Store language filter plugin parameters. - if ($pluginName == 'plg_system_languagefilter') - { - $params = '{' - . '"detect_browser":"0",' - . '"automatic_change":"1",' - . '"item_associations":"1",' - . '"remove_default_prefix":"0",' - . '"lang_cookie":"0",' - . '"alternate_meta":"1"' - . '}'; - $query - ->clear() - ->update($db->quoteName('#__extensions')) - ->set($db->quoteName('params') . ' = ' . $db->quote($params)) - ->where($db->quoteName('name') . ' = ' . $db->quote('plg_system_languagefilter')) - ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')); - - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (ExecutionFailureException $e) - { - return false; - } - } - - return true; - } - - /** - * Enable the Language Switcher Module. - * - * @return boolean - * - * @since 3.2 - */ - public function addModuleLanguageSwitcher() - { - Table::addIncludePath(JPATH_LIBRARIES . '/legacy/table/'); - $tableModule = Table::getInstance('Module', 'JTable'); - - $moduleData = array( - 'id' => 0, - 'title' => 'Language Switcher', - 'note' => '', - 'content' => '', - 'position' => 'position-0', - 'module' => 'mod_languages', - 'access' => 1, - 'showtitle' => 0, - 'params' => - '{"header_text":"","footer_text":"","dropdown":"0","image":"1","inline":"1","show_active":"1",' - . '"full_name":"1","layout":"_:default","moduleclass_sfx":"","cache":"0","cache_time":"900","cachemode":"itemid",' - . '"module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":"","style":"0"}', - 'client_id' => 0, - 'language' => '*', - 'published' => 1, - 'rules' => array(), - ); - - // Bind the data. - if (!$tableModule->bind($moduleData)) - { - return false; - } - - // Check the data. - if (!$tableModule->check()) - { - return false; - } - - // Store the data. - if (!$tableModule->store()) - { - return false; - } - - return $this->addModuleInModuleMenu((int) $tableModule->id); - } - - /** - * Add a Module in Module menus. - * - * @param integer $moduleId The Id of module. - * - * @return boolean - * - * @since 3.2 - */ - public function addModuleInModuleMenu($moduleId) - { - // Create a new db object. - $db = Factory::getDbo(); - $query = $db->getQuery(true); - - // Add Module in Module menus. - $query->clear() - ->insert($db->quoteName('#__modules_menu')) - ->columns(array($db->quoteName('moduleid'), $db->quoteName('menuid'))) - ->values($moduleId . ', 0'); - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (\RuntimeException $e) - { - return false; - } - - return true; - } - - /** - * Publish the Installed Content Languages. - * - * @return array List of languages that failed to be published. Empty array if all successful - * - * @since 3.7.0 - */ - public function publishContentLanguages() - { - // Publish the Content Languages. - $tableLanguage = Table::getInstance('Language'); - $siteLanguages = $this->getInstalledlangs('site'); - $failedLanguages = []; - - // For each content language. - foreach ($siteLanguages as $siteLang) - { - if ($tableLanguage->load(array('lang_code' => $siteLang->language, 'published' => 0)) && !$tableLanguage->publish()) - { - $failedLanguages[] = $siteLang->name; - - continue; - } - } - - return $failedLanguages; - } - - /** - * Gets a unique language SEF string. - * - * This function checks other existing language with the same code, if they exist provides a unique SEF name. - * For instance: en-GB, en-US and en-AU will share the same SEF code by default: www.mywebsite.com/en/ - * To avoid this conflict, this function creates a specific SEF in case of existing conflict: - * For example: www.mywebsite.com/en-au/ - * - * @param \stdClass $itemLanguage Language Object. - * @param \stdClass[] $siteLanguages All Language Objects. - * - * @return string - * - * @since 3.2 - * @depreacted 4.0 Not used anymore. - */ - public function getSefString($itemLanguage, $siteLanguages) - { - $langs = explode('-', $itemLanguage->language); - $prefixToFind = $langs[0]; - - $numberPrefixesFound = 0; - - foreach ($siteLanguages as $siteLang) - { - $langs = explode('-', $siteLang->language); - $lang = $langs[0]; - - if ($lang == $prefixToFind) - { - ++$numberPrefixesFound; - } - } - - if ($numberPrefixesFound == 1) - { - return $prefixToFind; - } - - return strtolower($itemLanguage->language); - } - - /** - * Add a Content Language. - * - * @param \stdClass $itemLanguage Language Object. - * @param string $sefLangString String to use for SEF so it doesn't conflict. - * - * @return boolean - * - * @since 3.2 - * @depreacted 4.0 Not used anymore. - */ - public function addLanguage($itemLanguage, $sefLangString) - { - $tableLanguage = Table::getInstance('Language'); - - $flag = strtolower(str_replace('-', '_', $itemLanguage->language)); - - // Load the native language name. - $installationLocalisedIni = new Language($itemLanguage->language, false); - $nativeLanguageName = $installationLocalisedIni->_('INSTL_DEFAULTLANGUAGE_NATIVE_LANGUAGE_NAME'); - - // If the local name do not exist in the translation file we use the international standard name. - if ($nativeLanguageName == 'INSTL_DEFAULTLANGUAGE_NATIVE_LANGUAGE_NAME') - { - $nativeLanguageName = $itemLanguage->name; - } - - $langData = array( - 'lang_id' => 0, - 'lang_code' => $itemLanguage->language, - 'title' => $itemLanguage->name, - 'title_native' => $nativeLanguageName, - 'sef' => $sefLangString, - 'image' => $flag, - 'published' => 1, - 'ordering' => 0, - 'description' => '', - 'metadesc' => '', - ); - - // Bind the data. - if (!$tableLanguage->bind($langData)) - { - return false; - } - - // Check the data. - if (!$tableLanguage->check()) - { - return false; - } - - // Store the data. - if (!$tableLanguage->store()) - { - return false; - } - - // Reorder the data. - if (!$tableLanguage->reorder()) - { - return false; - } - - return true; - } - - /** - * Add Menu Group. - * - * @param \stdClass $itemLanguage Language Object. - * - * @return boolean - * - * @since 3.2 - */ - public function addMenuGroup($itemLanguage) - { - // Add menus. - Table::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_menus/tables/'); - - // Add Menu Group. - $tableMenu = Table::getInstance('Type', 'JTableMenu'); - - $menuData = array( - 'id' => 0, - 'menutype' => 'mainmenu-' . strtolower($itemLanguage->language), - 'title' => 'Main Menu (' . $itemLanguage->language . ')', - 'description' => 'The main menu for the site in language ' . $itemLanguage->name, - ); - - // Bind the data. - if (!$tableMenu->bind($menuData)) - { - return false; - } - - // Check the data. - if (!$tableMenu->check()) - { - return false; - } - - // Store the data. - if (!$tableMenu->store()) - { - return false; - } - - return true; - } - - /** - * Add Featured Menu Item. - * - * @param \stdClass $itemLanguage Language Object. - * - * @return Table|boolean Menu Item Object. False otherwise. - * - * @since 3.2 - */ - public function addFeaturedMenuItem($itemLanguage) - { - // Add Menu Item. - $tableItem = Table::getInstance('Menu', 'MenusTable'); - - $newlanguage = new Language($itemLanguage->language, false); - $newlanguage->load('com_languages', JPATH_ADMINISTRATOR, $itemLanguage->language, true); - $title = $newlanguage->_('COM_LANGUAGES_HOMEPAGE'); - $alias = 'home_' . $itemLanguage->language; - - $menuItem = array( - 'title' => $title, - 'alias' => $alias, - 'menutype' => 'mainmenu-' . strtolower($itemLanguage->language), - 'type' => 'component', - 'link' => 'index.php?option=com_content&view=featured', - 'component_id' => 22, - 'published' => 1, - 'parent_id' => 1, - 'level' => 1, - 'home' => 1, - 'params' => '{"featured_categories":[""],"layout_type":"blog","num_leading_articles":"1",' - . '"num_intro_articles":"3","num_links":"0","orderby_pri":"","orderby_sec":"front",' - . '"order_date":"","show_pagination":"2","show_pagination_results":"1","show_noauth":"",' - . '"article-allow_ratings":"","article-allow_comments":"","show_feed_link":"1","feed_summary":"",' - . '"show_title":"","link_titles":"","show_intro":"","show_category":"","link_category":"",' - . '"show_parent_category":"","link_parent_category":"","show_author":"","show_create_date":"",' - . '"show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_readmore":"",' - . '"show_hits":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","show_page_heading":1,' - . '"page_title":"","page_heading":"","pageclass_sfx":"","menu-meta_description":"",' - . '"robots":"","secure":0}', - 'language' => $itemLanguage->language, - ); - - // Bind the data. - if (!$tableItem->bind($menuItem)) - { - return false; - } - - $tableItem->setLocation($menuItem['parent_id'], 'last-child'); - - // Check the data. - if (!$tableItem->check()) - { - return false; - } - - // Store the data. - if (!$tableItem->store()) - { - return false; - } - - // Rebuild the tree path. - if (!$tableItem->rebuildPath($tableItem->id)) - { - return false; - } - - return $tableItem; - } - - /** - * Add AllCategories Menu Item for new router. - * - * @param \stdClass $itemLanguage Language Object. - * - * @return Table|boolean Menu Item Object. False otherwise. - * - * @since 3.8.0 - */ - public function addAllCategoriesMenuItem($itemLanguage) - { - // Add Menu Item. - $tableItem = Table::getInstance('Menu', 'MenusTable'); - - $newlanguage = new Language($itemLanguage->language, false); - $newlanguage->load('joomla', JPATH_ADMINISTRATOR, $itemLanguage->language, true); - $title = $newlanguage->_('JCATEGORIES'); - $alias = 'allcategories_' . $itemLanguage->language; - - $menuItem = array( - 'title' => $title, - 'alias' => $alias, - 'menutype' => 'mainmenu-' . strtolower($itemLanguage->language), - 'type' => 'component', - 'link' => 'index.php?option=com_content&view=categories&id=0', - 'component_id' => 22, - 'published' => 1, - 'parent_id' => 1, - 'level' => 1, - 'home' => 0, - 'params' => '{"show_base_description":"","categories_description":"","maxLevelcat":"",' - . '"show_empty_categories_cat":"","show_subcat_desc_cat":"","show_cat_num_articles_cat":"",' - . '"show_category_title":"","show_description":"","show_description_image":"","maxLevel":"",' - . '"show_empty_categories":"","show_no_articles":"","show_subcat_desc":"","show_cat_num_articles":"",' - . '"num_leading_articles":"","num_intro_articles":"","num_links":"",' - . '"show_subcategory_content":"","orderby_pri":"","orderby_sec":"",' - . '"order_date":"","show_pagination_limit":"","filter_field":"","show_headings":"",' - . '"list_show_date":"","date_format":"","list_show_hits":"","list_show_author":"","display_num":"10",' - . '"show_pagination":"","show_pagination_results":"","show_title":"","link_titles":"",' - . '"show_intro":"","show_category":"","link_category":"","show_parent_category":"",' - . '"link_parent_category":"","show_author":"","link_author":"","show_create_date":"",' - . '"show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_vote":"",' - . '"show_readmore":"","show_readmore_title":"","show_hits":"","show_noauth":"","show_feed_link":"",' - . '"feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"","menu_image_css":"",' - . '"menu_text":1,"menu_show":0,"page_title":"","show_page_heading":"","page_heading":"",' - . '"pageclass_sfx":"","menu-meta_description":"","robots":"","secure":0}', - 'language' => $itemLanguage->language, - ); - - // Bind the data. - if (!$tableItem->bind($menuItem)) - { - return false; - } - - $tableItem->setLocation($menuItem['parent_id'], 'last-child'); - - // Check the data. - if (!$tableItem->check()) - { - return false; - } - - // Store the data. - if (!$tableItem->store()) - { - return false; - } - - // Rebuild the tree path. - if (!$tableItem->rebuildPath($tableItem->id)) - { - return false; - } - - return $tableItem; - } - - /** - * Add Module Menu. - * - * @param \stdClass $itemLanguage Language Object. - * - * @return boolean - * - * @since 3.2 - */ - public function addModuleMenu($itemLanguage) - { - $tableModule = Table::getInstance('Module', 'JTable'); - $title = 'Main menu ' . $itemLanguage->language; - - $moduleData = array( - 'id' => 0, - 'title' => $title, - 'note' => '', - 'content' => '', - 'position' => 'sidebar-right', - 'module' => 'mod_menu', - 'access' => 1, - 'showtitle' => 1, - 'params' => '{"menutype":"mainmenu-' . strtolower($itemLanguage->language) - . '","startLevel":"0","endLevel":"0","showAllChildren":"0","tag_id":"","class_sfx":"","window_open":"",' - . '"layout":"","moduleclass_sfx":"","cache":"1","cache_time":"900","cachemode":"itemid"}', - 'client_id' => 0, - 'language' => $itemLanguage->language, - 'published' => 1, - 'rules' => array(), - ); - - // Bind the data. - if (!$tableModule->bind($moduleData)) - { - return false; - } - - // Check the data. - if (!$tableModule->check()) - { - return false; - } - - // Store the data. - if (!$tableModule->store()) - { - return false; - } - - return $this->addModuleInModuleMenu((int) $tableModule->id); - } - - /** - * Disable Default Main Menu Module. - * - * @return boolean - * - * @since 3.2 - */ - public function disableModuleMainMenu() - { - // Create a new db object. - $db = Factory::getDbo(); - $query = $db->getQuery(true); - - // Add Module in Module menus. - $query - ->clear() - ->update($db->quoteName('#__modules')) - ->set($db->quoteName('published') . ' = 0') - ->where($db->quoteName('module') . ' = ' . $db->quote('mod_menu')) - ->where($db->quoteName('language') . ' = ' . $db->quote('*')) - ->where($db->quoteName('client_id') . ' = 0') - ->where($db->quoteName('position') . ' = ' . $db->quote('sidebar-right')); - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (ExecutionFailureException $e) - { - return false; - } - - return true; - } - - /** - * Enable a module. - * - * @param string $moduleName The Name of the module to activate. - * - * @return boolean - * - * @since 3.2 - */ - public function enableModule($moduleName) - { - // Create a new db object. - $db = Factory::getDbo(); - $query = $db->getQuery(true); - - $query - ->clear() - ->update($db->quoteName('#__modules')) - ->set($db->quoteName('published') . ' = 1') - ->where($db->quoteName('module') . ' = ' . $db->quote($moduleName)); - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (ExecutionFailureException $e) - { - return false; - } - - return true; - } - - /** - * Method create a category for a specific language. - * - * @param \stdClass $itemLanguage Language Object. - * - * @return Table|boolean Category Object. False otherwise. - * - * @since 3.2 - */ - public function addCategory($itemLanguage) - { - $newlanguage = new Language($itemLanguage->language, false); - $newlanguage->load('joomla', JPATH_ADMINISTRATOR, $itemLanguage->language, true); - $title = $newlanguage->_('JCATEGORY'); - - // Initialize a new category. - $category = Table::getInstance('Category'); - - $data = array( - 'extension' => 'com_content', - 'title' => $title . ' (' . strtolower($itemLanguage->language) . ')', - 'description' => '', - 'published' => 1, - 'access' => 1, - 'params' => '{"target":"","image":""}', - 'metadesc' => '', - 'metadata' => '{"page_title":"","author":"","robots":""}', - 'created_time' => Factory::getDate()->toSql(), - 'created_user_id' => (int) $this->getAdminId(), - 'language' => $itemLanguage->language, - 'rules' => array(), - 'parent_id' => 1, - ); - - // Set the location in the tree. - $category->setLocation(1, 'last-child'); - - // Bind the data to the table - if (!$category->bind($data)) - { - return false; - } - - // Check to make sure our data is valid. - if (!$category->check()) - { - return false; - } - - // Store the category. - if (!$category->store(true)) - { - return false; - } - - // Build the path for our category. - $category->rebuildPath($category->id); - - return $category; - } - - /** - * Create an article in a specific language. - * - * @param \stdClass $itemLanguage Language Object. - * @param integer $categoryId The id of the category where we want to add the article. - * - * @return Table|boolean Article Object. False otherwise. - * - * @since 3.2 - */ - public function addArticle($itemLanguage, $categoryId) - { - $db = Factory::getDbo(); - - $newlanguage = new Language($itemLanguage->language, false); - $newlanguage->load('com_content.sys', JPATH_ADMINISTRATOR, $itemLanguage->language, true); - $title = $newlanguage->_('COM_CONTENT_CONTENT_TYPE_ARTICLE'); - $currentDate = Factory::getDate()->toSql(); - - // Initialize a new article. - $article = Table::getInstance('Content'); - - $data = array( - 'title' => $title . ' (' . strtolower($itemLanguage->language) . ')', - 'introtext' => '

Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis' - . ' in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit' - . ' ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit' - . 'definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat' - . ' affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine' - . 'equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat' - . 'per. Ius id vidit volumus mandamus, vide veritus democritum te nec, ei eos' - . 'debet libris consulatu.

', - 'images' => json_encode(array()), - 'urls' => json_encode(array()), - 'state' => 1, - 'created' => $currentDate, - 'created_by' => (int) $this->getAdminId(), - 'created_by_alias' => 'Joomla', - 'publish_up' => $currentDate, - 'publish_down' => $db->getNullDate(), - 'version' => 1, - 'catid' => $categoryId, - 'metadata' => '{"page_title":"","author":"","robots":""}', - 'metadesc' => '', - 'language' => $itemLanguage->language, - 'featured' => 1, - 'attribs' => array(), - 'rules' => array(), - ); - - // Bind the data to the table - if (!$article->bind($data)) - { - return false; - } - - // Check to make sure our data is valid. - if (!$article->check()) - { - return false; - } - - // Now store the category. - if (!$article->store(true)) - { - return false; - } - - // Get the new item ID. - $newId = $article->get('id'); - - $query = $db->getQuery(true) - ->insert($db->quoteName('#__content_frontpage')) - ->values($newId . ', 0'); - - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (ExecutionFailureException $e) - { - return false; - } - - return $article; - } - - /** - * Add Blog Menu Item. - * - * @param \stdClass $itemLanguage Language Object. - * @param integer $categoryId The id of the category displayed by the blog. - * - * @return Table|boolean Menu Item Object. False otherwise. - * - * @since 3.8.0 - */ - public function addBlogMenuItem($itemLanguage, $categoryId) - { - // Add Menu Item. - $tableItem = Table::getInstance('Menu', 'MenusTable'); - - $newlanguage = new Language($itemLanguage->language, false); - $newlanguage->load('com_languages', JPATH_ADMINISTRATOR, $itemLanguage->language, true); - $title = $newlanguage->_('COM_LANGUAGES_HOMEPAGE'); - $alias = 'home_' . $itemLanguage->language; - - $menuItem = array( - 'title' => $title, - 'alias' => $alias, - 'menutype' => 'mainmenu-' . strtolower($itemLanguage->language), - 'type' => 'component', - 'link' => 'index.php?option=com_content&view=category&layout=blog&id=' . $categoryId, - 'component_id' => 22, - 'published' => 1, - 'parent_id' => 1, - 'level' => 1, - 'home' => 1, - 'params' => '{"layout_type":"blog","show_category_heading_title_text":"","show_category_title":"",' - . '"show_description":"","show_description_image":"","maxLevel":"","show_empty_categories":"",' - . '"show_no_articles":"","show_subcat_desc":"","show_cat_num_articles":"","show_cat_tags":"",' - . '"page_subheading":"","num_leading_articles":"1","num_intro_articles":"3",' - . '"num_links":"0","show_subcategory_content":"","orderby_pri":"",' - . '"orderby_sec":"front","order_date":"","show_pagination":"2","show_pagination_results":"1",' - . '"show_featured":"","show_title":"","link_titles":"","show_intro":"","info_block_position":"",' - . '"info_block_show_title":"","show_category":"","link_category":"","show_parent_category":"",' - . '"link_parent_category":"","show_associations":"","show_author":"","link_author":"",' - . '"show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"",' - . '"show_vote":"","show_readmore":"","show_readmore_title":"","show_hits":"","show_tags":"","show_noauth":"",' - . '"show_feed_link":"1","feed_summary":"","menu-anchor_title":"","menu-anchor_css":"","menu_image":"",' - . '"menu_image_css":"","menu_text":1,"menu_show":1,"page_title":"","show_page_heading":"1",' - . '"page_heading":"","pageclass_sfx":"","menu-meta_description":"","robots":""}', - 'language' => $itemLanguage->language, - ); - - // Bind the data. - if (!$tableItem->bind($menuItem)) - { - return false; - } - - $tableItem->setLocation($menuItem['parent_id'], 'last-child'); - - // Check the data. - if (!$tableItem->check()) - { - return false; - } - - // Store the data. - if (!$tableItem->store()) - { - return false; - } - - // Rebuild the tree path. - if (!$tableItem->rebuildPath($tableItem->id)) - { - return false; - } - - return $tableItem; - } - - /** - * Create the language associations. - * - * @param array $groupedAssociations Array of language associations for all items. - * - * @return boolean True on success. - * - * @since 3.6.1 - */ - public function addAssociations($groupedAssociations) - { - $db = Factory::getDbo(); - - foreach ($groupedAssociations as $context => $associations) - { - $key = md5(json_encode($associations)); - $query = $db->getQuery(true) - ->insert('#__associations'); - - foreach ($associations as $language => $id) - { - $query->values(((int) $id) . ',' . $db->quote($context) . ',' . $db->quote($key)); - } - - $db->setQuery($query); - - try - { - $db->execute(); - } - catch (\RuntimeException $e) - { - return false; - } - } - - return true; - } - - /** - * Retrieve the admin user id. - * - * @return integer|boolean One Administrator ID. - * - * @since 3.2 - */ - private function getAdminId() - { - if ($this->adminId) - { - // Return local cached admin ID. - return $this->adminId; - } - - $db = Factory::getDbo(); - $query = $db->getQuery(true); - - // Select the admin user ID - $query - ->clear() - ->select($db->quoteName('u') . '.' . $db->quoteName('id')) - ->from($db->quoteName('#__users', 'u')) - ->join( - 'LEFT', - $db->quoteName('#__user_usergroup_map', 'map') - . ' ON ' . $db->quoteName('map') . '.' . $db->quoteName('user_id') - . ' = ' . $db->quoteName('u') . '.' . $db->quoteName('id') - ) - ->join( - 'LEFT', - $db->quoteName('#__usergroups', 'g') - . ' ON ' . $db->quoteName('map') . '.' . $db->quoteName('group_id') - . ' = ' . $db->quoteName('g') . '.' . $db->quoteName('id') - ) - ->where( - $db->quoteName('g') . '.' . $db->quoteName('title') - . ' = ' . $db->quote('Super Users') - ); - - $db->setQuery($query); - $id = $db->loadResult(); - - if (!$id || $id instanceof \Exception) - { - return false; - } - - return $id; - } } diff --git a/installation/src/View/Remove/HtmlView.php b/installation/src/View/Remove/HtmlView.php index cae6aa8ac2f99..0b0c15867782a 100644 --- a/installation/src/View/Remove/HtmlView.php +++ b/installation/src/View/Remove/HtmlView.php @@ -65,8 +65,14 @@ class HtmlView extends DefaultView public function display($tpl = null) { $this->development = (new Version)->isInDevelopmentState(); - $this->items = $this->get('Items', 'Languages'); - $this->phpoptions = $this->get('PhpOptions', 'Checks'); + + $this->items = $this->get('Items', 'Languages'); + + $this->installed_languages = new \stdClass; + $this->installed_languages->administrator = $this->get('InstalledlangsAdministrator', 'Languages'); + $this->installed_languages->frontend = $this->get('InstalledlangsFrontend', 'Languages'); + + $this->phpoptions = $this->get('PhpOptions', 'Checks'); $this->phpsettings = $this->get('PhpSettings', 'Checks'); return parent::display($tpl); diff --git a/installation/template/js/remove.js b/installation/template/js/remove.js index 286e69cf716a2..5f569ab393979 100644 --- a/installation/template/js/remove.js +++ b/installation/template/js/remove.js @@ -66,3 +66,41 @@ if (document.getElementById('installLanguagesButton')) { } }) } + +if (document.getElementById('defaultLanguagesButton')) { + document.getElementById('defaultLanguagesButton') + .addEventListener('click', (e) => { + let frontendlang = 'en-GB'; + if (document.querySelector('input[name="frontendlang"]:checked')) { + frontendlang = document.querySelector('input[name="frontendlang"]:checked').value; + } + + let administratorlang = 'en-GB'; + if (document.querySelector('input[name="administratorlang"]:checked')) { + administratorlang = document.querySelector('input[name="administratorlang"]:checked').value; + } + + e.preventDefault(); + + Joomla.request({ + method: 'POST', + url: `${Joomla.installationBaseUrl}?view=setup&frontendlang=${frontendlang}&administratorlang=${administratorlang}&task=language.setdefault&format=json`, + perform: true, + token: true, + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + onSuccess(response) { + const successresponse = JSON.parse(response); + if (successresponse.messages) { + Joomla.renderMessages(successresponse.messages, '#system-message-container'); + } + }, + onError(xhr) { + Joomla.renderMessages({ error: [xhr] }, '#system-message-container'); + }, + }); + + if (document.getElementById('header')) { + document.getElementById('header').scrollIntoView(); + } + }); +} diff --git a/installation/tmpl/remove/default.php b/installation/tmpl/remove/default.php index 11794eb897683..8e887eba95a16 100644 --- a/installation/tmpl/remove/default.php +++ b/installation/tmpl/remove/default.php @@ -27,6 +27,99 @@ + + installed_languages->administrator) > 1) : ?> +
+ +
+ +

+ + + + + + + + + + installed_languages->administrator as $i => $lang) : ?> + + + + + + + +
+ + + + + +
+ published) echo 'checked="checked"'; ?> + /> + + + + language; ?> +
+

+ + + + + + + + + + installed_languages->frontend as $i => $lang) : ?> + + + + + + + +
+ + + + + +
+ published) echo 'checked="checked"'; ?> + /> + + + + language; ?> +
+ + +
From d00587930e9f3c612a253586b4d23eae29e6289c Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Sun, 15 Mar 2020 23:06:56 +0200 Subject: [PATCH 03/68] Correct syntax (#28357) --- plugins/system/httpheaders/httpheaders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/system/httpheaders/httpheaders.php b/plugins/system/httpheaders/httpheaders.php index b6ee90b96602b..f2b821dd18ebb 100644 --- a/plugins/system/httpheaders/httpheaders.php +++ b/plugins/system/httpheaders/httpheaders.php @@ -323,7 +323,7 @@ private function setCspHeader(): void if ($frameAncestorsSelfEnabled && !$frameAncestorsSet) { - $newCspValues[] = 'frame-ancestors "self"'; + $newCspValues[] = 'frame-ancestors \'self\''; } if (empty($newCspValues)) From 8cf990821bf3e8328ea4fe03067a064d81e36b56 Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 16 Mar 2020 14:13:03 +0000 Subject: [PATCH 04/68] Cleanup formvalidation behaviour (#28352) --- .../components/com_associations/tmpl/association/edit.php | 2 +- .../components/com_banners/tmpl/download/default.php | 3 +++ .../components/com_config/tmpl/application/default.php | 2 +- .../components/com_config/tmpl/component/default.php | 2 +- administrator/components/com_media/tmpl/file/default.php | 6 ++---- .../components/com_messages/tmpl/config/default.php | 2 +- .../components/com_privacy/tmpl/request/default.php | 4 ++-- administrator/components/com_privacy/tmpl/request/edit.php | 2 +- components/com_config/tmpl/config/default.php | 2 +- components/com_config/tmpl/modules/default.php | 2 +- components/com_config/tmpl/templates/default.php | 2 +- components/com_privacy/tmpl/confirm/default.php | 2 +- components/com_privacy/tmpl/remind/default.php | 2 +- components/com_privacy/tmpl/request/default.php | 2 +- installation/tmpl/preinstall/default.php | 2 ++ installation/tmpl/remove/default.php | 2 ++ installation/tmpl/setup/default.php | 2 ++ 17 files changed, 24 insertions(+), 17 deletions(-) diff --git a/administrator/components/com_associations/tmpl/association/edit.php b/administrator/components/com_associations/tmpl/association/edit.php index 4f7799079f373..1f8997fac1ab9 100644 --- a/administrator/components/com_associations/tmpl/association/edit.php +++ b/administrator/components/com_associations/tmpl/association/edit.php @@ -37,7 +37,7 @@ data-hide-reference=""> -
+
diff --git a/administrator/components/com_banners/tmpl/download/default.php b/administrator/components/com_banners/tmpl/download/default.php index 69edc21d47392..6633425eebed4 100644 --- a/administrator/components/com_banners/tmpl/download/default.php +++ b/administrator/components/com_banners/tmpl/download/default.php @@ -9,10 +9,13 @@ defined('_JEXEC') or die; +use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Router\Route; /** @var \Joomla\Component\Banners\Administrator\View\Download\HtmlView $this */ +HTMLHelper::_('behavior.formvalidator'); + ?>
- +
'; ?> diff --git a/administrator/components/com_messages/tmpl/config/default.php b/administrator/components/com_messages/tmpl/config/default.php index a88dc80353375..db8bb7a9f2730 100644 --- a/administrator/components/com_messages/tmpl/config/default.php +++ b/administrator/components/com_messages/tmpl/config/default.php @@ -16,7 +16,7 @@ HTMLHelper::_('behavior.keepalive'); ?>
- +
form->renderField('lock'); ?> form->renderField('mail_on_new'); ?> diff --git a/administrator/components/com_privacy/tmpl/request/default.php b/administrator/components/com_privacy/tmpl/request/default.php index 065aa82e676d1..4713b27194528 100644 --- a/administrator/components/com_privacy/tmpl/request/default.php +++ b/administrator/components/com_privacy/tmpl/request/default.php @@ -14,13 +14,13 @@ use Joomla\CMS\Router\Route; use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper; -/** @var PrivacyViewRequest $this */ +/** @var \Joomla\Component\Privacy\Administrator\View\Request\HtmlView $this */ HTMLHelper::_('behavior.formvalidator'); HTMLHelper::_('behavior.keepalive'); ?> - +
diff --git a/administrator/components/com_privacy/tmpl/request/edit.php b/administrator/components/com_privacy/tmpl/request/edit.php index d8aca0ef78abc..75c7fbfddc42b 100644 --- a/administrator/components/com_privacy/tmpl/request/edit.php +++ b/administrator/components/com_privacy/tmpl/request/edit.php @@ -12,7 +12,7 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Router\Route; -/** @var PrivacyViewRequest $this */ +/** @var \Joomla\Component\Privacy\Administrator\View\Request\HtmlView $this */ HTMLHelper::_('behavior.formvalidator'); HTMLHelper::_('behavior.keepalive'); diff --git a/components/com_config/tmpl/config/default.php b/components/com_config/tmpl/config/default.php index 922508f39b510..62468225bbb86 100644 --- a/components/com_config/tmpl/config/default.php +++ b/components/com_config/tmpl/config/default.php @@ -18,7 +18,7 @@ HTMLHelper::_('script', 'com_config/config-default.js', ['version' => 'auto', 'relative' => true]); ?> - +