diff --git a/nginx.conf b/nginx.conf index 2c52227973..3d8ca11e65 100644 --- a/nginx.conf +++ b/nginx.conf @@ -129,7 +129,7 @@ server { rewrite admin/api/(.*) /admin/api/index.php last; # Administration pages - rewrite admin/(attachments|backup|backup/export|backup/restore|configuration|elasticsearch|instance/edit|instance/update|instances|session-keep-alive|stopwords|system|update) /admin/front.php last; + rewrite admin/(attachments|backup|backup/export|backup/restore|configuration|elasticsearch|export|instance/edit|instance/update|instances|session-keep-alive|stopwords|system|update) /admin/front.php last; # REST API v3.0 and v3.1 rewrite ^api/v3\.[01]/(.*) /api/index.php last; diff --git a/phpmyfaq/.htaccess b/phpmyfaq/.htaccess index 5663c12801..2a5007d3ed 100644 --- a/phpmyfaq/.htaccess +++ b/phpmyfaq/.htaccess @@ -143,7 +143,7 @@ Header set Access-Control-Allow-Headers "Content-Type, Authorization" # Administration API RewriteRule ^admin/api/(.*) admin/api/index.php [L,QSA] # Administration pages - RewriteRule ^admin/(attachments|backup|backup/export|backup/restore|configuration|elasticsearch|instance/edit|instance/update|instances|session-keep-alive|stopwords|system|update) admin/front.php [L,QSA] + RewriteRule ^admin/(attachments|backup|backup/export|backup/restore|configuration|elasticsearch|export|instance/edit|instance/update|instances|session-keep-alive|stopwords|system|update) admin/front.php [L,QSA] # Private APIs RewriteRule ^api/(autocomplete|bookmark/delete|bookmark/create|user/data/update|user/password/update|user/request-removal|user/remove-twofactor|contact|voting|register|captcha|share|comment/create|faq/create|question/create|webauthn/prepare|webauthn/register|webauthn/prepare-login|webauthn/login) api/index.php [L,QSA] # Setup APIs diff --git a/phpmyfaq/admin/export.php b/phpmyfaq/admin/export.php deleted file mode 100644 index 15d2d510cc..0000000000 --- a/phpmyfaq/admin/export.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @author Matteo Scaramuccia - * @copyright 2003-2024 phpMyFAQ Team - * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 - * @link https://www.phpmyfaq.de - * @since 2003-04-17 - */ - -use phpMyFAQ\Category; -use phpMyFAQ\Configuration; -use phpMyFAQ\Database; -use phpMyFAQ\Enums\PermissionType; -use phpMyFAQ\Helper\CategoryHelper; -use phpMyFAQ\Template\TwigWrapper; -use phpMyFAQ\Translation; -use phpMyFAQ\User\CurrentUser; -use Symfony\Component\HttpFoundation\HeaderUtils; - -if (!defined('IS_VALID_PHPMYFAQ')) { - http_response_code(400); - exit(); -} - -$faqConfig = Configuration::getConfigurationInstance(); -$user = CurrentUser::getCurrentUser($faqConfig); -[$currentAdminUser, $currentAdminGroups] = CurrentUser::getCurrentUserGroupId($user); - -$twig = new TwigWrapper(PMF_ROOT_DIR . '/assets/templates'); -$template = $twig->loadTemplate('@admin/import-export/export.twig'); - -if ($user->perm->hasPermission($user->getUserId(), PermissionType::EXPORT->value)) { - $category = new Category($faqConfig, [], false); - $category->setUser($currentAdminUser); - $category->setGroups($currentAdminGroups); - $category->buildCategoryTree(); - - $categoryHelper = new CategoryHelper(); - $categoryHelper->setCategory($category); - $templateVars = [ - 'adminHeaderExport' => Translation::get('ad_menu_export'), - 'hasNoFaqs' => Database::checkOnEmptyTable('faqdata'), - 'errorMessageNoFaqs' => Translation::get('msgErrorNoRecords'), - 'hasCategories' => !Database::checkOnEmptyTable('faqcategories'), - 'headerCategories' => Translation::get('ad_export_which_cat'), - 'msgCategory' => Translation::get('ad_entry_category'), - 'msgAllCategories' => Translation::get('msgShowAllCategories'), - 'categoryOptions' => $categoryHelper->renderOptions(0), - 'msgWithSubCategories' => Translation::get('ad_export_cat_downwards'), - 'headerExportType' => Translation::get('ad_export_type'), - 'msgChooseExportType' => Translation::get('ad_export_type_choose'), - 'msgViewType' => Translation::get('ad_export_download_view'), - 'msgDownloadType' => HeaderUtils::DISPOSITION_ATTACHMENT, - 'msgDownload' => Translation::get('ad_export_download'), - 'msgInlineType' => HeaderUtils::DISPOSITION_INLINE, - 'msgInline' => Translation::get('ad_export_view'), - 'buttonReset' => Translation::get('ad_config_reset'), - 'buttonExport' => Translation::get('ad_menu_export'), - ]; - - echo $template->render($templateVars); -} else { - require __DIR__ . '/no-permission.php'; -} - diff --git a/phpmyfaq/admin/header.php b/phpmyfaq/admin/header.php index 380e8607dd..42aa83bd43 100644 --- a/phpmyfaq/admin/header.php +++ b/phpmyfaq/admin/header.php @@ -128,7 +128,7 @@ 'importcsv', 'msgImportRecords' ); -$secLevelEntries['imports_exports'] .= $adminHelper->addMenuEntry('export', 'export', 'ad_menu_export'); +$secLevelEntries['imports_exports'] .= $adminHelper->addMenuEntry('export', 'export', 'ad_menu_export', 'export'); $secLevelEntries['backup'] = $adminHelper->addMenuEntry('editconfig', 'backup', 'ad_menu_backup', 'backup'); diff --git a/phpmyfaq/admin/index.php b/phpmyfaq/admin/index.php index 97ebca6e4c..d6029e64bf 100755 --- a/phpmyfaq/admin/index.php +++ b/phpmyfaq/admin/index.php @@ -364,9 +364,6 @@ case 'importcsv': require 'import.csv.php'; break; - case 'export': - require 'export.php'; - break; // Config administration case 'forms': require 'forms.php'; diff --git a/phpmyfaq/assets/templates/admin/header.twig b/phpmyfaq/assets/templates/admin/header.twig index 3d223f46d8..02e9e06647 100644 --- a/phpmyfaq/assets/templates/admin/header.twig +++ b/phpmyfaq/assets/templates/admin/header.twig @@ -154,7 +154,7 @@ {% if secondLevelEntries['imports_exports'] != '' %} -