Added editing function for pages (using tinymce).

Added editing pages for footer, banner, aside.
Added page overview.
Added public page.
Added settings page.
Added generator for embed pseudocodes.
This commit is contained in:
2018-06-13 20:07:24 +02:00
committed by Stefan Rohde-Enslin
parent 227c91963e
commit a49746ab10
114 changed files with 4422 additions and 47 deletions

View File

@ -15,13 +15,14 @@ require_once __DIR__ . "/inc/functions.php";
ensureEnvironment(); // Ensure existence of system files.
$translations = loadLanguage(); // Load translations.
ensureBackendEnv(); // Ensure session is started etc.
$pages = loadPages(); // Load overview of pages.
/*
* Load data.
*/
// Check for vars.
loadHttpToGlobals(["task", "username", "realName", "email", "password", "passwordVerify"]);
loadHttpToGlobals(["task", "username", "realName", "email", "password", "passwordVerify", "admin"]);
if (!isset($users)) {
$users = json_decode(file_get_contents(__DIR__ . "/../data/users.json"), true);
@ -29,7 +30,9 @@ if (!isset($users)) {
if (isset($task) and $task == "insert") { // Adding new users.
$redirectURL = "./users.php?" . write_common_vars(["username", "realName", "email"]) . "#addUser";
$redirectURL = "./users.php?" . write_common_vars(["username", "realName", "email", "admin"]) . "#addUser";
if (!isset($admin)) $admin = false;
// Ensure all required values are set.
foreach (["username", "realName", "email", "password", "passwordVerify"] as $var) {
@ -61,6 +64,7 @@ if (isset($task) and $task == "insert") { // Adding new users.
"realName" => $realName,
"email" => $email,
"password" => password_hash("$password", PASSWORD_BCRYPT, ['cost' => 12]),
"admin" => $admin,
"created" => date("Y-m-d H:i:s"),
);
@ -80,7 +84,7 @@ if (isset($task) and $task == "insert") { // Adding new users.
* Output
*/
echo printBackendHead($translations['start']);
echo printBackendHead($translations['start'], $translations['start'], $settings['logo']);
echo printBackendHeader($translations['usersOverview'], $translations['helpUsers']);
echo '
@ -138,6 +142,17 @@ echo ' required /></td>
<td></td>
</tr>
<tr>
<th><label for="admin">' . $translations['admin'] . '</label></th>
<td>
<label class="switch">
<input name="admin" id="admin" type="checkbox"'; if (isset($admin) and $admin) echo ' checked'; echo '>
<span class="slider round"></span>
</label>
</td>
<td>' . generateHelpToolTip("helpAdmin", $translations['admin'], $translations['helpAdmin']) . '</td>
</tr>
<tr>
<th></th>
<td><button type="submit">' . $translations['submit'] . '</button></td>
@ -159,6 +174,7 @@ echo ' required /></td>
<th>' . $translations['username'] . '</th>
<th>' . $translations['realName'] . '</th>
<th>' . $translations['email'] . '</th>
<th>' . $translations['admin'] . '</th>
<th>' . $translations['options'] . '</th>
</tr>
</thead>
@ -172,6 +188,7 @@ foreach ($users as $user) {
<td><a href="user.php?t=' . urlencode($user['username']) . '">' . $user['username'] . '</a></td>
<td>' . $user['realName'] . '</td>
<td>' . $user['email'] . '</td>
<td>' . $user['admin'] . '</td>
<td></td>
</tr>
';