Skip to content

Commit

Permalink
refactor: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Sep 4, 2023
1 parent f7400f3 commit 8beb76c
Show file tree
Hide file tree
Showing 21 changed files with 7 additions and 27 deletions.
5 changes: 5 additions & 0 deletions phpmyfaq/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

use phpMyFAQ\Captcha\Captcha;
use phpMyFAQ\Captcha\Helper\CaptchaHelper;
use phpMyFAQ\Configuration;
use phpMyFAQ\Filter;
use phpMyFAQ\Helper\CategoryHelper as HelperCategory;
use phpMyFAQ\Question;
use phpMyFAQ\Strings;
use phpMyFAQ\System;
use phpMyFAQ\Translation;
use phpMyFAQ\User\CurrentUser;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -34,6 +36,9 @@
$request = Request::createFromGlobals();
$faqSystem = new System();

$faqConfig = Configuration::getConfigurationInstance();
$user = CurrentUser::getCurrentUser($faqConfig);

// Check user permissions
if (-1 === $user->getUserId() && !$faqConfig->get('records.allowNewFaqsForGuests')) {
$response = new RedirectResponse($faqSystem->getSystemUri($faqConfig) . '?action=login');
Expand Down
10 changes: 2 additions & 8 deletions phpmyfaq/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*
* @deprecated will be migrated to api/index.php
*
* @package phpMyFAQ
* @author Thorsten Rinne <[email protected]>
* @copyright 2009-2023 phpMyFAQ Team
Expand All @@ -17,31 +19,23 @@

const IS_VALID_PHPMYFAQ = null;

use phpMyFAQ\Attachment\AttachmentException;
use phpMyFAQ\Attachment\AttachmentFactory;
use phpMyFAQ\Category;
use phpMyFAQ\Category\CategoryPermission;
use phpMyFAQ\Comments;
use phpMyFAQ\Configuration;
use phpMyFAQ\Entity\CategoryEntity;
use phpMyFAQ\Entity\CommentType;
use phpMyFAQ\Entity\FaqEntity;
use phpMyFAQ\Faq;
use phpMyFAQ\Faq\FaqMetaData;
use phpMyFAQ\Filter;
use phpMyFAQ\Helper\QuestionHelper;
use phpMyFAQ\Helper\RegistrationHelper;
use phpMyFAQ\Language;
use phpMyFAQ\News;
use phpMyFAQ\Permission\MediumPermission;
use phpMyFAQ\Question;
use phpMyFAQ\Search;
use phpMyFAQ\Services;
use phpMyFAQ\Strings;
use phpMyFAQ\Tags;
use phpMyFAQ\Translation;
use phpMyFAQ\User\CurrentUser;
use phpMyFAQ\User\UserAuthentication;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_bn.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Activate mod_rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Do you want to enable LDAP support? (default: disabled)");
$LANG_CONF["main.referenceURL"] = array("input", "Base URL for link verification (e.g.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Interval between AJAX link verification (in seconds)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_bs.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Broj prikazanih tema po stranici");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Broj &#269;lanaka vesti");
$LANG_CONF['security.bannedIPs'] = array("area", "Banuj ove IP");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Uklju&#269;i mod_rewrite podr&#269;ku? (isklju&#269;eno)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Da li &#382;elite LDAP podr&scaron;ku? (isklju&#269;eno)");

$PMF_LANG["ad_categ_new_main_cat"] = "kao nova glavna kategorija";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_cy.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", " Nifer y pynciau a ddangosir fesul tudalen");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", " Nifer yr erthyglau newyddion");
$LANG_CONF['security.bannedIPs'] = array("area", " Gwahardd yr Ips hyn");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", " Actifadu mod_ailysgrifennu’r gefnogaeth? (diofyn: analluogi)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", " Hoffech chi osod cefnogaeth LDAP? (default: disabled)");

$PMF_LANG["ad_categ_new_main_cat"] = "fel prif gategori newydd";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_en.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = ["input", "Number of displayed topics per page"];
$LANG_CONF["records.numberOfShownNewsEntries"] = ["input", "Number of news articles"];
$LANG_CONF['security.bannedIPs'] = ["area", "Ban these IPs"];
$LANG_CONF["main.enableRewriteRules"] = ["checkbox", "Enable URL rewrite support? (default: disabled)"];
$LANG_CONF["ldap.ldapSupport"] = ["checkbox", "Enable LDAP support? (default: disabled)"];
$LANG_CONF["main.referenceURL"] = ["input", "URL of your FAQ (e.g.: https://www.example.org/faq/)"];
$LANG_CONF["main.urlValidateInterval"] = ["input", "Interval between AJAX link verification (in seconds)"];
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_eu.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Erakutsitako item-en kopurua orriko");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Artikulu berrien kopurua");
$LANG_CONF['security.bannedIPs'] = array("area", "IP hauek blokeatu");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Mod_rewrite-rentzat euskarria aktibatu? (besterik esan ezean, desaktibatua)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "LDAPrentzat euskarria gaitu nahi al duzu? (besterik esan ezean, desaktibatua)");

$PMF_LANG["ad_categ_new_main_cat"] = "Atal nagusi berri gisa";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = ["input", "Nombre de sujets affichés par page"];
$LANG_CONF["records.numberOfShownNewsEntries"] = ["input", "Nombre de nouveaux articles"];
$LANG_CONF["security.bannedIPs"] = ["area", "Bannir ces adresses IP"];
$LANG_CONF["main.enableRewriteRules"] = ["checkbox", "Activer le support de mod_rewrite? (défaut : désactivé)"];
$LANG_CONF["ldap.ldapSupport"] = ["checkbox", "Activer le support de LDAP (défaut : désactivé)"];
$LANG_CONF["main.referenceURL"] = ["input", "URL de votre FAQ (e.g. : http://www.example.org/faq/)"];
$LANG_CONF["main.urlValidateInterval"] = ["input", "Intervalle entre la vérification des liens AJAX (en secondes)"];
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_hi.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "एक पृष्ठ पर कितने विषय दिखायें");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "समाचार लेखों की संख्या");
$LANG_CONF['security.bannedIPs'] = array("area", "इन IPs को प्रतिबंधित करें");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "mod_rewrite को सक्रिय करें? (पूर्वनिर्धारित: असक्रिय)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "क्या आप LDAP को सक्रिय करना चाहते हैं? (पूर्वनिर्धारित: असक्रिय)");
$LANG_CONF["main.referenceURL"] = array("input", "कड़ी सत्यापन के लिए आधार URL (e.g.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "AJAX कड़ी सत्यापन के मध्य समय अवधि (in seconds)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_id.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Jumlah topik yang ditampilkan per halaman");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Jumlah artikel berita");
$LANG_CONF['security.bannedIPs'] = array("area", "Blokir IP ini");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Aktifkan dukungan mod_rewrite? (default: non-aktif)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Aktifkan dukungan LDAP? (default: non-aktif)");
$LANG_CONF["main.referenceURL"] = array("input", "URL dasar untuk verifikasi link (mis.: https://www.situsanda.com/faq)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Interval antara verifikasi link AJAX (dalam detik)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_ko.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "페이지당 표시할 글의 수");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "공지사항 표시 개수");
$LANG_CONF['security.bannedIPs'] = array("area", "해당 IP주소로 부터 사용 금지");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "mod_rewrite 기능을 사용하시겠습니까? (기본값: 사용안함)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "LDAP을 지원하도록 하시겠습니까? (기본값: 사용안함)");

$PMF_LANG["ad_categ_new_main_cat"] = "새로운 메인 카테고리로";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_lt.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Puslapyje rodomų temų skaičius");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Naujienų straipsnių skaičius");
$LANG_CONF['security.bannedIPs'] = array("area", "Drausti šiuos IP adresus");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Aktyvinti „mod_rewrite“ palaikymą? (numatyta r.: išjungta)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Ar įjungti LDAP palaikymą? (numatyta r.: išjungta)");
$LANG_CONF["main.referenceURL"] = array("input", "Bazinis URL saitų tikrinimui (pvz., https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Intervalas tarp AJAX saitų tikrinimo (sekundėmis)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_lv.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Activate mod_rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Do you want to enable LDAP support? (default: disabled)");

$PMF_LANG["ad_categ_new_main_cat"] = "as new main category";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_mn.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Нэг хуудсанд хэдэн сэдвийн нэр харуулах");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Enable URL rewrite support? (үндсэн: идэвхгүй)");
$LANG_CONF["security.ldapSupport"] = array("checkbox", "Enable LDAP support? (үндсэн: идэвхгүй)");
$LANG_CONF["main.referenceURL"] = array("input", "URL for link verification (e.g.: https://www.example.org/faq)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Interval between AJAX link verification (in seconds)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_sk.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Počet tém na stránku");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Počet článkov");
$LANG_CONF['security.bannedIPs'] = array("area", "Zakázať tieto IP");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Aktivovať mód_podporu prepisovania? (prednastavené: nepovoliť)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Chcete povoliť LDAP podporu? (Prednastavené: nepovoliť)");
$LANG_CONF["main.referenceURL"] = array("input", "Overiť URL (e.g.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Interval medzi AJAX overením (v sekundách)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_sl.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Activate mod_rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Do you want to enable LDAP support? (default: disabled)");

$PMF_LANG["ad_categ_new_main_cat"] = "as new main category";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_sr.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Broj prikazanih tema po stranici");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Broj &#269;lanaka vesti");
$LANG_CONF['security.bannedIPs'] = array("area", "Banuj ove IP");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Uklju&#269;i mod_rewrite podr&#269;ku? (isklju&#269;eno)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Da li &#382;elite LDAP podr&scaron;ku? (isklju&#269;eno)");

$PMF_LANG["ad_categ_new_main_cat"] = "kao nova glavna kategorija";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Enable URL rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Enable LDAP support? (default: disabled)");
$LANG_CONF["main.referenceURL"] = array("input", "URL of your FAQ (e.g.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Interval between AJAX link verification (in seconds)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_tw.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "每頁顯示主題數 Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "新聞文章數目 Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "禁止訪問 IPs 位置 Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "啟用 URL 覆寫支援? (預設: 關閉) <br> Enable URL rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "啟用 LDAP 支援? (預設: 關閉) <br> Enable LDAP support? (default: disabled)");
$LANG_CONF["main.referenceURL"] = array("input", "URL 網址確認 (舉例: https://www.example.org/faq/) <br>URL for link verification (e.g.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "AJAX 連結確認時間(以秒計時) <br>Interval between AJAX link verification (in seconds)");
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_uk.php
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Number of displayed topics per page");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Number of news articles");
$LANG_CONF['security.bannedIPs'] = array("area", "Ban these IPs");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Activate mod_rewrite support? (default: disabled)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Do you want to enable LDAP support? (default: disabled)");

$PMF_LANG["ad_categ_new_main_cat"] = "as new main category";
Expand Down
1 change: 0 additions & 1 deletion phpmyfaq/translations/language_vi.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@
$LANG_CONF["records.numberOfRecordsPerPage"] = array("input", "Số lượng nội dung hiện trên mỗi trang");
$LANG_CONF["records.numberOfShownNewsEntries"] = array("input", "Số lượng bài mới");
$LANG_CONF['security.bannedIPs'] = array("area", "Loại bỏ các IP này");
$LANG_CONF["main.enableRewriteRules"] = array("checkbox", "Kích hoạt hỗ trợ mod_rewrite? (mặc định: không kích hoạt)");
$LANG_CONF["ldap.ldapSupport"] = array("checkbox", "Bạn có muốn kích hoạt hỗ trợ LDAP? (mặc định: không kích hoạt)");
$LANG_CONF["main.referenceURL"] = array("input", "Tham chiếu URL để kiểm tra đường dẫn (vd.: https://www.example.org/faq/)");
$LANG_CONF["main.urlValidateInterval"] = array("input", "Khoảng cách giữa các lần kiểm tra đường dẫn AJAX (tính bằng giây)");
Expand Down

0 comments on commit 8beb76c

Please sign in to comment.