23e8d9b765
Applies the approved QRForge brand kit throughout the app: - New logo/icon SVGs, favicon set (ico/svg/png), apple-touch-icon, all copied from the approved brand kit into src/dist/img/brand/. Old Symbol_WhiteBlue.png/DynamicQRCode_Original.png removed (unused after the swap). - Sidebar brand image/text, login and change-password page logos, all <title> tags, manifest.json name/theme-color, and the PWA icons (dist/img/icon-192.png/icon-512.png, same filenames so no other reference needed to change) updated to QRForge branding and the #2563EB brand blue. - New about.php page (+ sidebar link): credits the original upstream fork (Giandonato Inverso) and chillerlan/php-qrcode, links to the free qr.ensembia.com try-out, the commercial www.qrforge.eu product page, and this GitHub repo for self-hosters. - Footer now reads "QRForge" + "About / credits" + "Version 3.0" (replaces the inherited "PHP Qrcode Generator by Giandonato Inverso" / "Version 2.3.0" line - full credit moved to the About page instead). - README.md rewritten: current feature set (all 16 static qr types, presets, scanner, PWA, location search, roles), qr.ensembia.com as the free try-out, www.qrforge.eu as the commercial product page, corrected Docker Compose setup steps (.env is required now, the old README still described the single-file demo setup from the original upstream fork). IMPORTANT: not pushed to origin/gitea. Per user instruction, no push until qrforge.eu domain registration is confirmed.
113 lines
3.5 KiB
PHP
113 lines
3.5 KiB
PHP
<?php
|
|
require_once 'includes/bootstrap.php';
|
|
require_once BASE_PATH . '/includes/auth_validate.php';
|
|
require_once BASE_PATH . '/lib/Users/Users.php';
|
|
|
|
$user_instance = new Users();
|
|
|
|
if (!in_array($_SESSION['type'], ['super', 'admin'], true))
|
|
$user_instance->failure('Only "super admin" and "admin" accounts can access the user management page', 'Location: index.php');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
csrf_verify_or_die();
|
|
}
|
|
|
|
$edit = false;
|
|
if($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["edit"]) && $_GET["edit"] == "true" && isset($_GET["id"])) {
|
|
$edit = true;
|
|
$user = $user_instance->getUser($_GET["id"]);
|
|
|
|
// An admin may only open the edit form for their own 'user' accounts.
|
|
if ($_SESSION['type'] === 'admin' && (
|
|
$user['type'] !== 'user' || (int) $user['owner_admin_id'] !== (int) $_SESSION['user_id']
|
|
)) {
|
|
$user_instance->failure('You are not allowed to edit this user', 'Location: users.php');
|
|
}
|
|
}
|
|
|
|
if($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["del_id"])) {
|
|
$user_instance->deleteUser($_POST["del_id"]);
|
|
}
|
|
|
|
if($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["edit"])) {
|
|
if(
|
|
isset($_POST["username"]) &&
|
|
isset($_POST["password"]) &&
|
|
isset($_POST["type"]) &&
|
|
isset($_POST["id"])
|
|
)
|
|
$user_instance->editUser($_POST);
|
|
}
|
|
|
|
if($_SERVER["REQUEST_METHOD"] === "POST" && !isset($_POST["edit"])) {
|
|
if(
|
|
isset($_POST["username"]) &&
|
|
isset($_POST["password"]) &&
|
|
isset($_POST["type"])
|
|
)
|
|
$user_instance->addUser($_POST);
|
|
}
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<title>QRForge</title>
|
|
<head>
|
|
<?php include './includes/head.php'; ?>
|
|
</head>
|
|
<body class="hold-transition sidebar-mini layout-fixed layout-navbar-fixed layout-footer-fixed">
|
|
<div class="wrapper">
|
|
<!-- Navbar -->
|
|
<?php include './includes/navbar.php'; ?>
|
|
<!-- /.navbar -->
|
|
|
|
<!-- Main Sidebar Container -->
|
|
<?php include './includes/sidebar.php'; ?>
|
|
<!-- /.Main Sidebar Container -->
|
|
|
|
<!-- Content Wrapper. Contains page content -->
|
|
<div class="content-wrapper">
|
|
<!-- Content Header (Page header) -->
|
|
<div class="content-header">
|
|
<div class="container-fluid">
|
|
<div class="row mb-2">
|
|
<div class="col-sm-6">
|
|
<h1 class="m-0 text-dark"><?php echo (!$edit) ? 'Add' : 'Update'; ?> User</h1>
|
|
</div><!-- /.col -->
|
|
</div><!-- /.row -->
|
|
</div><!-- /.container-fluid -->
|
|
</div>
|
|
<!-- /.content-header -->
|
|
|
|
<!-- Flash messages -->
|
|
<?php include BASE_PATH.'/includes/flash_messages.php'; ?>
|
|
<!-- /.Flash messages -->
|
|
|
|
<!-- Main content -->
|
|
<section class="content">
|
|
<div class="container-fluid">
|
|
|
|
<div class="card card-primary">
|
|
<div class="card-header">
|
|
<h3 class="card-title">Enter the requested data</h3>
|
|
</div>
|
|
<form class="well form-horizontal" action="" method="post" id="contact_form" enctype="multipart/form-data">
|
|
<?php echo csrf_field(); ?>
|
|
<div class="card-body">
|
|
<?php include BASE_PATH . '/forms/form_users.php'; ?>
|
|
</div>
|
|
<div class="card-footer">
|
|
<button type="submit" class="btn btn-primary">Submit</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
</div><!--/. container-fluid -->
|
|
</section><!-- /.content -->
|
|
</div><!-- /.content-wrapper -->
|
|
|
|
<!-- Footer and scripts -->
|
|
<?php include './includes/footer.php'; ?>
|
|
</body>
|
|
</html>
|