fontawesome und jeeede menge reworks
All checks were successful
Build and push / Pulling repo on server (push) Successful in 20s

This commit is contained in:
2023-10-22 01:46:22 +02:00
parent fc9de5b15c
commit 004e38b3bb
72 changed files with 53087 additions and 83 deletions

View File

@ -0,0 +1,74 @@
<?php
class Admin extends Page {
function loginas()
{
$user = $_REQUEST['email'];
$u = new User();
if($u->load($user))
{
$u->login();
$this->redirect('/');
}
else
{
$this->set('message', 'User '.escape($user).' not found');
$this->set('template', 'notfound.html');
}
}
function edituser()
{
$user = $_REQUEST['email'];
$u = new User();
if($u->load($user))
{
$data = $u->data;
$this->set('userdata', $data);
$this->set('userid', $user);
$this->set('template', 'edituser.html');
}
else
{
$this->set('message', 'User '.escape($user).' not found');
$this->set('template', 'notfound.html');
}
}
function edituserdata()
{
$user = $_REQUEST['email'];
$u = new User();
if(!$u->load($user))
{
$this->set('message', 'User '.escape($user).' not found');
$this->set('template', '/templates/notfound.html');
return;
}
foreach($_REQUEST as $key => $value)
{
if($key == 'email') continue;
$u->$key = $value;
}
try{
$u->save();
}
catch(Exception $e)
{
$this->set('message', $e->getMessage());
$this->set('template', '/templates/error.html');
return;
}
$this->set('message', 'Speichern erfolgreich');
$this->set('template', '/templates/success.html');
}
function maySeeThisPage(){return true;}
}

View File

@ -0,0 +1,37 @@
<form hx-post="/admin/edituserdata" hx-target="#response">
<div id="defaultModal" tabindex="-1" aria-hidden="true" class="z-50 w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
<div class="relative w-full max-w-2xl max-h-full">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<!-- Modal header -->
<div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
Edit user <?= $userid ?>
</h3>
</div>
<!-- Modal body -->
<div class="p-6 space-y-6">
<div class="flex flex-col">
<label for="id" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
ID
</label>
<input type="text" name="id" disabled id="id" value="<?= $userid ?>" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
</div>
<?php foreach (array_keys($userdata) as $key) : ?>
<div class="flex flex-col">
<label for="<?= $key ?>" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
<?= $key ?>
</label>
<input type="text" name="<?= $key ?>" id="<?= $key ?>" value="<?= $userdata[$key] ?>" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
</div>
<?php endforeach; ?>
</div>
<!-- Modal footer -->
<div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
<button type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Save</button>
<div id="response"></div>
</div>
</div>
</div>
</div>
</form>