fontawesome und jeeede menge reworks
All checks were successful
Build and push / Pulling repo on server (push) Successful in 20s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 20s
This commit is contained in:
74
web/pages/admin/controller.php
Normal file
74
web/pages/admin/controller.php
Normal 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;}
|
||||
}
|
Reference in New Issue
Block a user