diff --git a/nginx.conf b/nginx.conf index 26d22b8842..af6ccee955 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|category|comments|configuration|elasticsearch|export|glossary|group|import|instance|instances|news|password|questions|session-keep-alive|statistics|sticky-faqs|stopwords|system|tags|update|user) /admin/front.php last; + rewrite admin/(attachments|backup|category|comments|configuration|elasticsearch|export|faq|faqs|glossary|group|import|instance|instances|news|password|questions|session-keep-alive|statistics|sticky-faqs|stopwords|system|tags|update|user) /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 d9cdc31d13..be8e3c05a5 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|category|comments|configuration|elasticsearch|export|glossary|group|import|instance|instances|news|password|questions|session-keep-alive|statistics|sticky-faqs|stopwords|system|tags|update|user) admin/front.php [L,QSA] + RewriteRule ^admin/(attachments|backup|category|comments|configuration|elasticsearch|export|faq|faqs|glossary|group|import|instance|instances|news|password|questions|session-keep-alive|statistics|sticky-faqs|stopwords|system|tags|update|user) 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/faqs.overview.php b/phpmyfaq/admin/faqs.overview.php deleted file mode 100644 index f7a2150b47..0000000000 --- a/phpmyfaq/admin/faqs.overview.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2020-2024 phpMyFAQ Team - * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 - * @link https://www.phpmyfaq.de - * @since 2020-11-21 - */ - -use phpMyFAQ\Category; -use phpMyFAQ\Category\Relation; -use phpMyFAQ\Comments; -use phpMyFAQ\Configuration; -use phpMyFAQ\Session\Token; -use phpMyFAQ\Template\TwigWrapper; -use phpMyFAQ\Translation; -use phpMyFAQ\User\CurrentUser; - -if (!defined('IS_VALID_PHPMYFAQ')) { - http_response_code(400); - exit(); -} - -$faqConfig = Configuration::getConfigurationInstance(); -$user = CurrentUser::getCurrentUser($faqConfig); - -[ $currentAdminUser, $currentAdminGroups ] = CurrentUser::getCurrentUserGroupId($user); - -$category = new Category($faqConfig, $currentAdminGroups, true); -$category->setUser($currentAdminUser); -$category->setGroups($currentAdminGroups); -$category->buildCategoryTree(); - -$categoryRelation = new Relation($faqConfig, $category); -$categoryRelation->setGroups($currentAdminGroups); - -$comments = new Comments($faqConfig); - -$twig = new TwigWrapper(PMF_ROOT_DIR . '/assets/templates'); -$template = $twig->loadTemplate('@admin/content/faq.overview.twig'); - -$templateVars = [ - 'csrfTokenSearch' => Token::getInstance($container->get('session'))->getTokenInput('edit-faq'), - 'csrfTokenOverview' => Token::getInstance($container->get('session'))->getTokenString('faq-overview'), - 'categories' => $category->getCategoryTree(), - 'numberOfRecords' => $categoryRelation->getNumberOfFaqsPerCategory(), - 'numberOfComments' => $comments->getNumberOfCommentsByCategory(), - 'msgComments' => Translation::get('ad_start_comments'), - 'msgQuestion' => Translation::get('ad_entry_theme'), - 'msgDate' => Translation::get('ad_entry_date'), - 'msgSticky' => Translation::get('ad_entry_sticky'), - 'msgActive' => Translation::get('ad_record_active'), -]; - -echo $template->render($templateVars); diff --git a/phpmyfaq/admin/header.php b/phpmyfaq/admin/header.php index 3e75945f09..abc3413bc1 100644 --- a/phpmyfaq/admin/header.php +++ b/phpmyfaq/admin/header.php @@ -73,7 +73,8 @@ $secLevelEntries['content'] .= $adminHelper->addMenuEntry( 'edit_faq+delete_faq', 'faqs-overview', - 'msgHeaderFAQOverview' + 'msgHeaderFAQOverview', + 'faqs' ); $secLevelEntries['content'] .= $adminHelper->addMenuEntry( PermissionType::FAQ_EDIT->value, @@ -180,7 +181,6 @@ $secLevelEntries['config'] .= $adminHelper->addMenuEntry('editconfig', 'system', 'ad_system_info', 'system'); switch ($action) { - case 'faqs-overview': case 'editentry': case 'copyentry': case 'question': diff --git a/phpmyfaq/admin/index.php b/phpmyfaq/admin/index.php index 8df8c94b42..f5a8af58fd 100755 --- a/phpmyfaq/admin/index.php +++ b/phpmyfaq/admin/index.php @@ -257,11 +257,6 @@ // the various sections of the admin area switch ($action) { // functions for content administration - case 'faqs-overview': - require 'faqs.overview.php'; - break; - case 'viewinactive': - case 'viewactive': case 'takequestion': case 'editentry': case 'copyentry': diff --git a/phpmyfaq/assets/templates/admin/content/faq.overview.twig b/phpmyfaq/assets/templates/admin/content/faq.overview.twig index 47c4d973c6..91f5a766f4 100644 --- a/phpmyfaq/assets/templates/admin/content/faq.overview.twig +++ b/phpmyfaq/assets/templates/admin/content/faq.overview.twig @@ -1,92 +1,96 @@ -