szurubooru/src/Controllers/UserController.php

42 lines
821 B
PHP
Raw Normal View History

2013-10-05 19:24:08 +02:00
<?php
2013-10-05 21:24:20 +02:00
class UserController
2013-10-05 19:24:08 +02:00
{
/**
* @route /users
*/
public function listAction()
{
2013-10-05 21:22:28 +02:00
$this->context->subTitle = 'users';
2013-10-12 22:37:18 +02:00
throw new SimpleException('Not implemented');
2013-10-05 19:24:08 +02:00
}
/**
* @route /user/{name}
* @validate name [^\/]+
*/
2013-10-12 10:46:15 +02:00
public function viewAction($name)
2013-10-05 19:24:08 +02:00
{
2013-10-05 21:22:28 +02:00
$this->context->subTitle = $name;
2013-10-12 22:37:18 +02:00
throw new SimpleException('Not implemented');
2013-10-05 19:24:08 +02:00
}
2013-10-14 00:25:40 +02:00
/**
* @route /user/toggle-safety/{safety}
*/
public function toggleSafetyAction($safety)
{
if (!$this->context->loggedIn)
throw new SimpleException('Not logged in');
if (!in_array($safety, PostSafety::getAll()))
throw new SimpleExcetpion('Invalid safety');
$this->context->user->enableSafety($safety,
!$this->context->user->hasEnabledSafety($safety));
R::store($this->context->user);
$this->context->transport->success = true;
}
2013-10-05 19:24:08 +02:00
}