Skip to content

Commit db8e2a5

Browse files
committed
feat(custum-pages): added admin section to create, update and delete pages (#3015)
1 parent 37120b3 commit db8e2a5

39 files changed

+2097
-295
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
1313
- added API for glossary definitions (Thorsten)
1414
- added admin log CSV export feature (Thorsten)
1515
- added pagination, sorting, and filtering for APIs (Thorsten)
16-
- WIP: added support for custom pages in the frontend (Thorsten)
16+
- added support for custom pages with WYSIWYG editor, SEO features, and multi-language support (Thorsten)
1717
- improved audit and activity log with comprehensive security event tracking (Thorsten)
1818
- improved API errors with formatted RFC 7807 Problem Details JSON responses (Thorsten)
1919
- migrated codebase to use PHP 8.4 language features (Thorsten)
@@ -637,7 +637,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
637637
- removed bundled SyntaxHighlighter (Thorsten)
638638
- dropped support for ext/mysql (Thorsten)
639639
- dropped support for SQLite2 (Thorsten)
640-
- dropped support for Zeus Webserver, IIS 6 and lighttpd (Thorsten)
640+
- dropped support for Zeus Webserver, IIS 6, and lighttpd (Thorsten)
641641
- fixed a lot of minor bugs (Thorsten)
642642

643643
### phpMyFAQ v2.8.29 - 2016-05-31
@@ -863,7 +863,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
863863
- improved CSS development with LESS (Thorsten)
864864
- improved minified CSS output (Thorsten)
865865
- simplified the link verification (Thorsten)
866-
- dropped support for IBM DB2, Interbase/Firebird and Sybase (Thorsten)
866+
- dropped support for IBM DB2, Interbase/Firebird, and Sybase (Thorsten)
867867
- dropped support for PHP register_globals and magic_quotes_gpc (Thorsten)
868868
- dropped support for Google Translate API v1 (Thorsten)
869869
- removed Delicious support (Thorsten)
@@ -1903,7 +1903,7 @@ This is a log of major user-visible changes in each phpMyFAQ release.
19031903

19041904
- phpMyFAQ is now Open Source software
19051905
- template system for free layouts
1906-
- fully compatible with PHP 4.1, PHP 4.2 and PHP 4.3 (register_globals = off)
1906+
- fully compatible with PHP 4.1, PHP 4.2, and PHP 4.3 (register_globals = off)
19071907
- all color and font definitions with CSS
19081908
- better SQL queries
19091909
- better category navigation

composer.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpmyfaq/admin/assets/src/api/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export * from './markdown';
1212
export * from './media-browser';
1313
export * from './news';
1414
export * from './opensearch';
15+
export * from './page';
1516
export * from './question';
1617
export * from './statistics';
1718
export * from './stop-words';
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/**
2+
* Fetch data for custom pages
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public License,
5+
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
6+
* obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* @package phpMyFAQ
9+
* @author Thorsten Rinne <[email protected]>
10+
* @copyright 2026 phpMyFAQ Team
11+
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
12+
* @link https://www.phpmyfaq.de
13+
* @since 2026-01-15
14+
*/
15+
16+
export const addPage = async (data: Record<string, unknown> = {}): Promise<unknown> => {
17+
const response = await fetch('api/page/create', {
18+
method: 'POST',
19+
cache: 'no-cache',
20+
headers: {
21+
'Content-Type': 'application/json',
22+
},
23+
redirect: 'follow',
24+
referrerPolicy: 'no-referrer',
25+
body: JSON.stringify(data),
26+
});
27+
28+
return await response.json();
29+
};
30+
31+
export const deletePage = async (csrfToken: string, id: string, lang: string): Promise<unknown> => {
32+
const response = await fetch('api/page/delete', {
33+
method: 'DELETE',
34+
cache: 'no-cache',
35+
headers: {
36+
'Content-Type': 'application/json',
37+
},
38+
redirect: 'follow',
39+
referrerPolicy: 'no-referrer',
40+
body: JSON.stringify({
41+
csrfToken: csrfToken,
42+
id: id,
43+
lang: lang,
44+
}),
45+
});
46+
47+
return await response.json();
48+
};
49+
50+
export const updatePage = async (data: Record<string, unknown> = {}): Promise<unknown> => {
51+
const response = await fetch('api/page/update', {
52+
method: 'PUT',
53+
cache: 'no-cache',
54+
headers: {
55+
'Content-Type': 'application/json',
56+
},
57+
redirect: 'follow',
58+
referrerPolicy: 'no-referrer',
59+
body: JSON.stringify(data),
60+
});
61+
62+
return await response.json();
63+
};
64+
65+
export const activatePage = async (id: string, status: boolean, csrfToken: string): Promise<unknown> => {
66+
const response = await fetch('api/page/activate', {
67+
method: 'POST',
68+
cache: 'no-cache',
69+
headers: {
70+
'Content-Type': 'application/json',
71+
},
72+
redirect: 'follow',
73+
referrerPolicy: 'no-referrer',
74+
body: JSON.stringify({
75+
id: id,
76+
status: status,
77+
csrfToken: csrfToken,
78+
}),
79+
});
80+
81+
return await response.json();
82+
};
83+
84+
export const checkSlug = async (
85+
slug: string,
86+
lang: string,
87+
csrfToken: string,
88+
excludeId?: string
89+
): Promise<unknown> => {
90+
const response = await fetch('api/page/check-slug', {
91+
method: 'POST',
92+
cache: 'no-cache',
93+
headers: {
94+
'Content-Type': 'application/json',
95+
},
96+
redirect: 'follow',
97+
referrerPolicy: 'no-referrer',
98+
body: JSON.stringify({
99+
slug: slug,
100+
lang: lang,
101+
csrfToken: csrfToken,
102+
excludeId: excludeId,
103+
}),
104+
});
105+
106+
return await response.json();
107+
};

0 commit comments

Comments
 (0)