remove experimental shit
This commit is contained in:
parent
93e96334a6
commit
d7e339bada
15 changed files with 144 additions and 609 deletions
73
app/CSRF.php
73
app/CSRF.php
|
@ -1,73 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Holds the CSRF token handler.
|
|
||||||
* @package Sakura
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sakura;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to generate and validate CSRF tokens.
|
|
||||||
* @package Sakura
|
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
|
||||||
*/
|
|
||||||
class CSRF
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The prefix to prevent collisions in the $_SESSION variable.
|
|
||||||
*/
|
|
||||||
const ID_PREFIX = '_sakura_csrf_';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The size of the randomly generated string.
|
|
||||||
*/
|
|
||||||
const RANDOM_SIZE = 16;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new CSRF token.
|
|
||||||
* @param mixed $id
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function create($id)
|
|
||||||
{
|
|
||||||
// Generate a token
|
|
||||||
$token = self::generate();
|
|
||||||
|
|
||||||
// Make identifier
|
|
||||||
$id = strtoupper(self::ID_PREFIX . $id);
|
|
||||||
|
|
||||||
// Assign to session
|
|
||||||
$_SESSION[$id] = $token;
|
|
||||||
|
|
||||||
// Return the token
|
|
||||||
return $token;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a CSRF token.
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function generate()
|
|
||||||
{
|
|
||||||
return bin2hex(random_bytes(self::RANDOM_SIZE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a CSRF token.
|
|
||||||
* @param string $token
|
|
||||||
* @param string $id
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function validate($token, $id)
|
|
||||||
{
|
|
||||||
// Set id
|
|
||||||
$id = strtoupper(self::ID_PREFIX . $id);
|
|
||||||
|
|
||||||
// Check if the token exists
|
|
||||||
if (!array_key_exists($id, $_SESSION)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash_equals($token, $_SESSION[$id]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -283,7 +283,7 @@ class AuthController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user is already active
|
// Check if the user is already active
|
||||||
if (!$user->activated) {
|
if ($user->activated) {
|
||||||
$message = "Your account is already activated! Why are you here?";
|
$message = "Your account is already activated! Why are you here?";
|
||||||
return view('global/information', compact('message', 'redirect'));
|
return view('global/information', compact('message', 'redirect'));
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ class AuthController extends Controller
|
||||||
$user = User::construct($getUser[0]->user_id);
|
$user = User::construct($getUser[0]->user_id);
|
||||||
|
|
||||||
// Check if a user is activated
|
// Check if a user is activated
|
||||||
if (!$user->activated) {
|
if ($user->activated) {
|
||||||
$message = "Your account is already activated! Why are you here?";
|
$message = "Your account is already activated! Why are you here?";
|
||||||
return view('global/information', compact('message', 'redirect'));
|
return view('global/information', compact('message', 'redirect'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ use Phroute\Phroute\RouteCollector;
|
||||||
* @package Sakura
|
* @package Sakura
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
* @author Julian van de Groep <me@flash.moe>
|
||||||
*/
|
*/
|
||||||
class Routerv1
|
class Router
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Container for RouteCollector.
|
* Container for RouteCollector.
|
|
@ -1,92 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Holds the Route Collection object.
|
|
||||||
* @package Sakura
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sakura\Router;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A route collection.
|
|
||||||
* @package Sakura
|
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
|
||||||
*/
|
|
||||||
class Collection
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Contains the path list associated with the routes.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $paths = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains the names list associated with the routes.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $names = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add multiple routes.
|
|
||||||
* @param Route $routes
|
|
||||||
*/
|
|
||||||
public function add(Route...$routes)
|
|
||||||
{
|
|
||||||
foreach ($routes as $route) {
|
|
||||||
foreach ($route->methods as $method) {
|
|
||||||
$this->paths[$method][$route->path] = $route;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($route->name !== null) {
|
|
||||||
$this->names[$route->name] = $route;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($route->subroutes as $subroute) {
|
|
||||||
$subroute->setPath($route->path . '/' . $subroute->path);
|
|
||||||
|
|
||||||
if ($subroute->controller === null) {
|
|
||||||
$subroute->controller($route->controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->add($subroute);
|
|
||||||
}
|
|
||||||
|
|
||||||
$route->subroutes = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolve route by path and method.
|
|
||||||
* @param Request $request
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function resolve(Request $request)
|
|
||||||
{
|
|
||||||
$path = trim(parse_url($request->path, PHP_URL_PATH), '/');
|
|
||||||
|
|
||||||
if (!array_key_exists($request->method, $this->paths)
|
|
||||||
|| !array_key_exists($path, $this->paths[$request->method])) {
|
|
||||||
throw new \Exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->paths[$request->method][$path]->fire();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a route's url by name.
|
|
||||||
* @param string $name
|
|
||||||
* @param array $params
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function url($name, $params = [])
|
|
||||||
{
|
|
||||||
if (!array_key_exists($name, $this->names)) {
|
|
||||||
throw new \Exception;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($params)) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
return parse_url('/' . $this->names[$name]->path, PHP_URL_PATH);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Holds the request container.
|
|
||||||
* @package Sakura
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sakura\Router;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Request container.
|
|
||||||
* @package Sakura
|
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
|
||||||
*/
|
|
||||||
class Request
|
|
||||||
{
|
|
||||||
public $path;
|
|
||||||
public $method;
|
|
||||||
public $query;
|
|
||||||
public $data;
|
|
||||||
public $body;
|
|
||||||
public $ip;
|
|
||||||
public $accept;
|
|
||||||
public $charset;
|
|
||||||
public $language;
|
|
||||||
public $host;
|
|
||||||
public $referrer;
|
|
||||||
public $agent;
|
|
||||||
public $secure;
|
|
||||||
public $username;
|
|
||||||
public $password;
|
|
||||||
|
|
||||||
public static function fromServer($server, $get, $post)
|
|
||||||
{
|
|
||||||
$instance = new static;
|
|
||||||
|
|
||||||
$instance->path = $server['REQUEST_URI'];
|
|
||||||
$instance->method = $server['REQUEST_METHOD'];
|
|
||||||
$instance->query = $get ?? [];
|
|
||||||
$instance->data = $post ?? [];
|
|
||||||
$instance->body = file_get_contents('php://input');
|
|
||||||
$instance->ip = $server['REMOTE_ADDR'];
|
|
||||||
$instance->accept = self::parseAcceptHeader($server['HTTP_ACCEPT'] ?? '');
|
|
||||||
$instance->charset = $server['HTTP_ACCEPT_CHARSET'] ?? 'utf-8';
|
|
||||||
$instance->language = self::parseAcceptHeader($server['HTTP_ACCEPT_LANGUAGE'] ?? 'en');
|
|
||||||
$instance->host = $server['HTTP_HOST'];
|
|
||||||
$instance->referrer = $server['HTTP_REFERER'] ?? null;
|
|
||||||
$instance->agent = $server['HTTP_USER_AGENT'] ?? '';
|
|
||||||
$instance->secure = $server['HTTPS'] ?? null === '1';
|
|
||||||
$instance->username = $server['PHP_AUTH_USER'] ?? null;
|
|
||||||
$instance->password = $server['PHP_AUTH_PW'] ?? null;
|
|
||||||
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function parseAcceptHeader($header)
|
|
||||||
{
|
|
||||||
$accepted = [];
|
|
||||||
$header = explode(',', strtolower($header));
|
|
||||||
|
|
||||||
foreach ($header as $accepts) {
|
|
||||||
$quality = 1;
|
|
||||||
|
|
||||||
if (strpos($accepts, ';q=')) {
|
|
||||||
list($accepts, $quality) = explode(';q=', $accepts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the quality is 0 its not supported
|
|
||||||
if ($quality === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$accepted[$accepts] = $quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $accepted;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,186 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Holds the Route object.
|
|
||||||
* @package Sakura
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sakura\Router;
|
|
||||||
|
|
||||||
use Sakura\Exceptions\RouterInvalidMethodException;
|
|
||||||
use Sakura\Exceptions\RouterNonExistentControllerException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A route.
|
|
||||||
* @package Sakura
|
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
|
||||||
*/
|
|
||||||
class Route
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Collection of handled HTTP request types.
|
|
||||||
*/
|
|
||||||
const METHODS = [
|
|
||||||
'GET',
|
|
||||||
'POST',
|
|
||||||
'PUT',
|
|
||||||
'PATCH',
|
|
||||||
'DELETE',
|
|
||||||
'HEAD',
|
|
||||||
'OPTIONS',
|
|
||||||
'ANY',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method this route is intended for.
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $methods = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path of this route.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller class for this route.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Controller method for this route.
|
|
||||||
* @var string|Callable
|
|
||||||
*/
|
|
||||||
public $action;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name for this route.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Subroutes
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $subroutes = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an instance and set path.
|
|
||||||
* @param string $path
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public static function path($path)
|
|
||||||
{
|
|
||||||
$instance = new static;
|
|
||||||
$instance->setPath($path);
|
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set path.
|
|
||||||
* @param string $path
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function setPath($path)
|
|
||||||
{
|
|
||||||
$this->path = trim(parse_url($path, PHP_URL_PATH), '/');
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define subroutes.
|
|
||||||
* @param Route $routes
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function group(Route...$routes)
|
|
||||||
{
|
|
||||||
foreach ($routes as $route) {
|
|
||||||
if ($route->controller === null) {
|
|
||||||
$route->controller($this->controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->subroutes[] = $route;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set accepted methods.
|
|
||||||
* @param string|array $methods
|
|
||||||
* @throws RouterInvalidMethodException
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function methods($methods)
|
|
||||||
{
|
|
||||||
if (!is_array($methods)) {
|
|
||||||
$methods = [$methods];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($methods as $method) {
|
|
||||||
if (!in_array($method, static::METHODS)) {
|
|
||||||
throw new RouterInvalidMethodException;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($method, $this->methods)) {
|
|
||||||
$this->methods[] = $method;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set controller class.
|
|
||||||
* @param string $class
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function controller($class)
|
|
||||||
{
|
|
||||||
$this->controller = $class;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set action.
|
|
||||||
* @param string|Callable $action
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function action($action)
|
|
||||||
{
|
|
||||||
$this->action = $action;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set name.
|
|
||||||
* @param string $name
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function name($name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call the controller.
|
|
||||||
* @throws RouterNonExistentControllerException
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function fire($params = [])
|
|
||||||
{
|
|
||||||
if (is_callable($this->action)) {
|
|
||||||
return call_user_func_array($this->action, $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!class_exists($this->controller)
|
|
||||||
|| !method_exists($this->controller, $this->action)) {
|
|
||||||
throw new RouterNonExistentControllerException;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (new $this->controller)->{$this->action}(...$params);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Holds the a static referencer to Collection.
|
|
||||||
* @package Sakura
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sakura\Router;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Collection except static.
|
|
||||||
* @package Sakura
|
|
||||||
* @author Julian van de Groep <me@flash.moe>
|
|
||||||
*/
|
|
||||||
class Router
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Contains the collection.
|
|
||||||
* @var Collection
|
|
||||||
*/
|
|
||||||
protected static $instance = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does the referencing.
|
|
||||||
* @param string $method
|
|
||||||
* @param array $params
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public static function __callStatic($method, $params)
|
|
||||||
{
|
|
||||||
if (static::$instance === null) {
|
|
||||||
static::$instance = new Collection;
|
|
||||||
}
|
|
||||||
|
|
||||||
return static::$instance->$method(...$params);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -32,4 +32,4 @@ Template::vars([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Handle requests
|
// Handle requests
|
||||||
echo Routerv1::handle($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
|
echo Router::handle($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{% set paginationSeparator %}{% if '%3F' in paginationUrl|url_encode %}&{% else %}?{% endif %}{% endset %}
|
{% set paginationSeparator %}{% if '%3F' in paginationUrl|default('')|url_encode %}&{% else %}?{% endif %}{% endset %}
|
||||||
{% set paginationPage = get.page|default(1) %}
|
{% set paginationPage = get.page|default(1) %}
|
||||||
|
|
||||||
<div class="pagination{% if paginationClass %} {{ paginationClass }}{% endif %}">
|
<div class="pagination{% if paginationClass %} {{ paginationClass }}{% endif %}">
|
||||||
{% if paginationPages|length > 1 %}
|
{% if paginationPages is defined and paginationPages|length > 1 %}
|
||||||
{% if paginationPage > 1 %}
|
{% if paginationPage > 1 %}
|
||||||
{% if paginationPages|length > 2 %}
|
{% if paginationPages|length > 2 %}
|
||||||
<a href="{{ paginationUrl }}{{ paginationSeparator }}page=1" title="Jump to first page"><span class="fa fa-fast-backward"></span></a>
|
<a href="{{ paginationUrl }}{{ paginationSeparator }}page=1" title="Jump to first page"><span class="fa fa-fast-backward"></span></a>
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="content homepage forum viewtopic">
|
<div class="content homepage forum viewtopic">
|
||||||
<div class="content-column">
|
<div class="content-column">
|
||||||
<div class="head">{{ forum.name }} / <span id="topicTitle">{{ topic.title }}</span></div>
|
<div class="head">{{ forum.name }} / <span id="topicTitle">{{ topic.title|default(null) }}</span></div>
|
||||||
{% include 'forum/elements/forumBtns.twig' %}
|
{% include 'forum/elements/forumBtns.twig' %}
|
||||||
<table class="posts">
|
<table class="posts">
|
||||||
{% if topic is defined %}
|
{% if topic is defined %}
|
||||||
|
@ -151,8 +151,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set titleCache = session.replyText['f' ~ forum.id].title %}
|
{% set titleCache = session.replyText['f' ~ forum.id].title|default('') %}
|
||||||
{% set textCache = session.replyText['f' ~ forum.id].text %}
|
{% set textCache = session.replyText['f' ~ forum.id].text|default('') %}
|
||||||
{% set postingAction = route('forums.new', forum.id) %}
|
{% set postingAction = route('forums.new', forum.id) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if forumReplyLink is defined or topic is not defined %}
|
{% if forumReplyLink is defined or topic is not defined %}
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
<img src="{{ route('user.avatar', user.id) }}" alt="{{ user.username }}" class="avatar" style="box-shadow: 0 3px 7px #484;">
|
<img src="{{ route('user.avatar', user.id) }}" alt="{{ user.username }}" class="avatar" style="box-shadow: 0 3px 7px #484;">
|
||||||
<div class="userdata">
|
<div class="userdata">
|
||||||
<div class="usertitle">{{ user.title }}</div>
|
<div class="usertitle">{{ user.title }}</div>
|
||||||
<img src="/images/tenshi.png" alt="Tenshi"{% if not user.isPremium %} style="opacity: 0;"{% endif %}> <img src="/images/flags/{{ user.country|lower }}.png" alt="{{ user.country(true) }}">{% if user.id == (topic.posts|first).poster.id %} <img src="/images/op.png" alt="OP" title="Original Poster">{% endif %}
|
<img src="/images/tenshi.png" alt="Tenshi"{% if not user.isPremium %} style="opacity: 0;"{% endif %}> <img src="/images/flags/{{ user.country|lower }}.png" alt="{{ user.country(true) }}">{% if topic is defined and user.id == (topic.posts|first).poster.id %} <img src="/images/op.png" alt="OP" title="Original Poster">{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="post-content">
|
<td class="post-content">
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
{% extends 'master.twig' %}
|
|
|
@ -113,21 +113,21 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
Day: <select name="birthday_day">
|
Day: <select name="birthday_day">
|
||||||
<option value="0"{% if not birthday[2] %} selected="selected"{% endif %}>--</option>
|
<option value="0"{% if birthday[2] is not defined %} selected="selected"{% endif %}>--</option>
|
||||||
{% for i in 1..31 %}
|
{% for i in 1..31 %}
|
||||||
<option{% if birthday[2] == i %} selected="selected"{% endif %}>{{ i }}</option>
|
<option{% if birthday[2]|default(-1) == i %} selected="selected"{% endif %}>{{ i }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
Month: <select name="birthday_month">
|
Month: <select name="birthday_month">
|
||||||
<option value="0"{% if not birthday[1] %} selected="selected"{% endif %}>--</option>
|
<option value="0"{% if not birthday[1] is not defined %} selected="selected"{% endif %}>--</option>
|
||||||
{% for i in 1..12 %}
|
{% for i in 1..12 %}
|
||||||
<option value="{{ i }}"{% if birthday[1] == i %} selected="selected"{% endif %}>{{ months[i - 1] }}</option>
|
<option value="{{ i }}"{% if birthday[1]|default(-1) == i %} selected="selected"{% endif %}>{{ months[i - 1] }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
Year: <select name="birthday_year">
|
Year: <select name="birthday_year">
|
||||||
<option value="0"{% if not birthday[0] %} selected="selected"{% endif %}>----</option>
|
<option value="0"{% if not birthday[0] is not defined %} selected="selected"{% endif %}>----</option>
|
||||||
{% for i in "now"|date('Y')..("now"|date('Y') - 100) %}
|
{% for i in "now"|date('Y')..("now"|date('Y') - 100) %}
|
||||||
<option{% if birthday[0] == i %} selected="selected"{% endif %}>{{ i }}</option>
|
<option{% if birthday[0]|default(-1) == i %} selected="selected"{% endif %}>{{ i }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
248
routes.php
248
routes.php
|
@ -9,7 +9,7 @@ namespace Sakura;
|
||||||
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
use Phroute\Phroute\Exception\HttpRouteNotFoundException;
|
||||||
|
|
||||||
// Maintenance check
|
// Maintenance check
|
||||||
Routerv1::filter('maintenance', function () {
|
Router::filter('maintenance', function () {
|
||||||
if (config('general.maintenance')) {
|
if (config('general.maintenance')) {
|
||||||
CurrentSession::stop();
|
CurrentSession::stop();
|
||||||
http_response_code(503);
|
http_response_code(503);
|
||||||
|
@ -17,30 +17,30 @@ Routerv1::filter('maintenance', function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::group(['before' => 'maintenance'], function () {
|
Router::group(['before' => 'maintenance'], function () {
|
||||||
// Meta pages
|
// Meta pages
|
||||||
Routerv1::get('/', 'MetaController@index', 'main.index');
|
Router::get('/', 'MetaController@index', 'main.index');
|
||||||
Routerv1::get('/faq', 'MetaController@faq', 'main.faq');
|
Router::get('/faq', 'MetaController@faq', 'main.faq');
|
||||||
Routerv1::get('/search', 'MetaController@search', 'main.search');
|
Router::get('/search', 'MetaController@search', 'main.search');
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
Routerv1::get('/login', 'AuthController@login', 'auth.login');
|
Router::get('/login', 'AuthController@login', 'auth.login');
|
||||||
Routerv1::post('/login', 'AuthController@login', 'auth.login');
|
Router::post('/login', 'AuthController@login', 'auth.login');
|
||||||
Routerv1::get('/register', 'AuthController@register', 'auth.register');
|
Router::get('/register', 'AuthController@register', 'auth.register');
|
||||||
Routerv1::post('/register', 'AuthController@register', 'auth.register');
|
Router::post('/register', 'AuthController@register', 'auth.register');
|
||||||
Routerv1::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
Router::get('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
||||||
Routerv1::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
Router::post('/resetpassword', 'AuthController@resetPassword', 'auth.resetpassword');
|
||||||
Routerv1::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
Router::get('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
||||||
Routerv1::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
Router::post('/reactivate', 'AuthController@reactivate', 'auth.reactivate');
|
||||||
Routerv1::get('/activate', 'AuthController@activate', 'auth.activate');
|
Router::get('/activate', 'AuthController@activate', 'auth.activate');
|
||||||
Routerv1::get('/logout', 'AuthController@logout', 'auth.logout');
|
Router::get('/logout', 'AuthController@logout', 'auth.logout');
|
||||||
Routerv1::post('/logout', 'AuthController@logout', 'auth.logout');
|
Router::post('/logout', 'AuthController@logout', 'auth.logout');
|
||||||
|
|
||||||
// Link compatibility layer, prolly remove this in like a year
|
// Link compatibility layer, prolly remove this in like a year
|
||||||
Routerv1::get('/r/{id}', function ($id) {
|
Router::get('/r/{id}', function ($id) {
|
||||||
redirect("/p/{$id}");
|
redirect("/p/{$id}");
|
||||||
});
|
});
|
||||||
Routerv1::get('/p/{id}', function ($id) {
|
Router::get('/p/{id}', function ($id) {
|
||||||
$resolve = [
|
$resolve = [
|
||||||
'terms' => 'info.terms',
|
'terms' => 'info.terms',
|
||||||
'contact' => 'info.contact',
|
'contact' => 'info.contact',
|
||||||
|
@ -68,199 +68,199 @@ Routerv1::group(['before' => 'maintenance'], function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
Routerv1::group(['prefix' => 'info'], function () {
|
Router::group(['prefix' => 'info'], function () {
|
||||||
Routerv1::get('/terms', 'InfoController@terms', 'info.terms');
|
Router::get('/terms', 'InfoController@terms', 'info.terms');
|
||||||
Routerv1::get('/privacy', 'InfoController@privacy', 'info.privacy');
|
Router::get('/privacy', 'InfoController@privacy', 'info.privacy');
|
||||||
Routerv1::get('/contact', 'InfoController@contact', 'info.contact');
|
Router::get('/contact', 'InfoController@contact', 'info.contact');
|
||||||
Routerv1::get('/rules', 'InfoController@rules', 'info.rules');
|
Router::get('/rules', 'InfoController@rules', 'info.rules');
|
||||||
Routerv1::get('/welcome', 'InfoController@welcome', 'info.welcome');
|
Router::get('/welcome', 'InfoController@welcome', 'info.welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
Routerv1::group(['prefix' => 'status'], function () {
|
Router::group(['prefix' => 'status'], function () {
|
||||||
Routerv1::get('/', 'StatusController@index', 'status.index');
|
Router::get('/', 'StatusController@index', 'status.index');
|
||||||
});
|
});
|
||||||
|
|
||||||
// News
|
// News
|
||||||
Routerv1::group(['prefix' => 'news'], function () {
|
Router::group(['prefix' => 'news'], function () {
|
||||||
Routerv1::get('/{category:c}?', 'NewsController@category', 'news.category');
|
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
|
||||||
Routerv1::get('/post/{id:i}', 'NewsController@post', 'news.post');
|
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Chat
|
// Chat
|
||||||
Routerv1::group(['prefix' => 'chat'], function () {
|
Router::group(['prefix' => 'chat'], function () {
|
||||||
Routerv1::get('/redirect', 'ChatController@redirect', 'chat.redirect');
|
Router::get('/redirect', 'ChatController@redirect', 'chat.redirect');
|
||||||
Routerv1::get('/settings', 'ChatController@settings', 'chat.settings');
|
Router::get('/settings', 'ChatController@settings', 'chat.settings');
|
||||||
Routerv1::get('/auth', 'ChatController@auth', 'chat.auth');
|
Router::get('/auth', 'ChatController@auth', 'chat.auth');
|
||||||
Routerv1::get('/resolve', 'ChatController@resolve', 'chat.resolve');
|
Router::get('/resolve', 'ChatController@resolve', 'chat.resolve');
|
||||||
Routerv1::get('/irc', 'ChatController@irc', 'chat.irc');
|
Router::get('/irc', 'ChatController@irc', 'chat.irc');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Authentication for the "old" chat
|
// Authentication for the "old" chat
|
||||||
Routerv1::get('/web/sock-auth.php', 'ChatController@authLegacy');
|
Router::get('/web/sock-auth.php', 'ChatController@authLegacy');
|
||||||
|
|
||||||
// Forum
|
// Forum
|
||||||
Routerv1::group(['prefix' => 'forum'], function () {
|
Router::group(['prefix' => 'forum'], function () {
|
||||||
// Post
|
// Post
|
||||||
Routerv1::group(['prefix' => 'post'], function () {
|
Router::group(['prefix' => 'post'], function () {
|
||||||
Routerv1::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
|
Router::get('/{id:i}', 'Forum.PostController@find', 'forums.post');
|
||||||
Routerv1::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
|
Router::delete('/{id:i}', 'Forum.PostController@delete', 'forums.post.delete');
|
||||||
Routerv1::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
|
Router::get('/{id:i}/raw', 'Forum.PostController@raw', 'forums.post.raw');
|
||||||
Routerv1::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit');
|
Router::post('/{id:i}/edit', 'Forum.PostController@edit', 'forums.post.edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Topic
|
// Topic
|
||||||
Routerv1::group(['prefix' => 'topic'], function () {
|
Router::group(['prefix' => 'topic'], function () {
|
||||||
Routerv1::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic');
|
Router::get('/{id:i}', 'Forum.TopicController@view', 'forums.topic');
|
||||||
Routerv1::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky');
|
Router::get('/{id:i}/sticky', 'Forum.TopicController@sticky', 'forums.topic.sticky');
|
||||||
Routerv1::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce');
|
Router::get('/{id:i}/announce', 'Forum.TopicController@announce', 'forums.topic.announce');
|
||||||
Routerv1::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock');
|
Router::get('/{id:i}/lock', 'Forum.TopicController@lock', 'forums.topic.lock');
|
||||||
Routerv1::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete');
|
Router::get('/{id:i}/delete', 'Forum.TopicController@delete', 'forums.topic.delete');
|
||||||
Routerv1::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore');
|
Router::get('/{id:i}/restore', 'Forum.TopicController@restore', 'forums.topic.restore');
|
||||||
Routerv1::get('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move');
|
Router::get('/{id:i}/move', 'Forum.TopicController@move', 'forums.topic.move');
|
||||||
Routerv1::post('/{id:i}/reply', 'Forum.TopicController@reply', 'forums.topic.reply');
|
Router::post('/{id:i}/reply', 'Forum.TopicController@reply', 'forums.topic.reply');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Forum
|
// Forum
|
||||||
Routerv1::get('/', 'Forum.ForumController@index', 'forums.index');
|
Router::get('/', 'Forum.ForumController@index', 'forums.index');
|
||||||
Routerv1::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
|
Router::get('/{id:i}', 'Forum.ForumController@forum', 'forums.forum');
|
||||||
Routerv1::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
|
Router::get('/{id:i}/mark', 'Forum.ForumController@markRead', 'forums.mark');
|
||||||
Routerv1::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
Router::get('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
||||||
Routerv1::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
Router::post('/{id:i}/new', 'Forum.TopicController@create', 'forums.new');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
Routerv1::group(['prefix' => 'members'], function () {
|
Router::group(['prefix' => 'members'], function () {
|
||||||
Routerv1::get('/', 'UserController@members', 'members.index');
|
Router::get('/', 'UserController@members', 'members.index');
|
||||||
Routerv1::get('/{rank:i}', 'UserController@members', 'members.rank');
|
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
|
||||||
});
|
});
|
||||||
|
|
||||||
// User
|
// User
|
||||||
Routerv1::group(['prefix' => 'u'], function () {
|
Router::group(['prefix' => 'u'], function () {
|
||||||
Routerv1::get('/{id}', 'UserController@profile', 'user.profile');
|
Router::get('/{id}', 'UserController@profile', 'user.profile');
|
||||||
Routerv1::get('/{id}/report', 'UserController@report', 'user.report');
|
Router::get('/{id}/report', 'UserController@report', 'user.report');
|
||||||
|
|
||||||
Routerv1::get('/{id}/nowplaying', 'UserController@nowPlaying', 'user.nowplaying');
|
Router::get('/{id}/nowplaying', 'UserController@nowPlaying', 'user.nowplaying');
|
||||||
|
|
||||||
Routerv1::get('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
Router::get('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
||||||
Routerv1::post('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
Router::post('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
||||||
Routerv1::delete('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
Router::delete('/{id}/avatar', 'FileController@avatar', 'user.avatar');
|
||||||
|
|
||||||
Routerv1::get('/{id}/background', 'FileController@background', 'user.background');
|
Router::get('/{id}/background', 'FileController@background', 'user.background');
|
||||||
Routerv1::post('/{id}/background', 'FileController@background', 'user.background');
|
Router::post('/{id}/background', 'FileController@background', 'user.background');
|
||||||
Routerv1::delete('/{id}/background', 'FileController@background', 'user.background');
|
Router::delete('/{id}/background', 'FileController@background', 'user.background');
|
||||||
|
|
||||||
Routerv1::get('/{id}/header', 'FileController@header', 'user.header');
|
Router::get('/{id}/header', 'FileController@header', 'user.header');
|
||||||
Routerv1::post('/{id}/header', 'FileController@header', 'user.header');
|
Router::post('/{id}/header', 'FileController@header', 'user.header');
|
||||||
Routerv1::delete('/{id}/header', 'FileController@header', 'user.header');
|
Router::delete('/{id}/header', 'FileController@header', 'user.header');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
Routerv1::group(['prefix' => 'notifications'], function () {
|
Router::group(['prefix' => 'notifications'], function () {
|
||||||
Routerv1::get('/', 'NotificationsController@notifications', 'notifications.get');
|
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
|
||||||
Routerv1::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
|
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
Routerv1::group(['prefix' => 'comments'], function () {
|
Router::group(['prefix' => 'comments'], function () {
|
||||||
Routerv1::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
|
Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
|
||||||
Routerv1::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
|
Router::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
|
||||||
Routerv1::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
Router::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
Routerv1::group(['prefix' => 'friends'], function () {
|
Router::group(['prefix' => 'friends'], function () {
|
||||||
Routerv1::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
||||||
Routerv1::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Premium
|
// Premium
|
||||||
Routerv1::group(['prefix' => 'support'], function () {
|
Router::group(['prefix' => 'support'], function () {
|
||||||
Routerv1::get('/', 'PremiumController@index', 'premium.index');
|
Router::get('/', 'PremiumController@index', 'premium.index');
|
||||||
Routerv1::get('/error', 'PremiumController@error', 'premium.error');
|
Router::get('/error', 'PremiumController@error', 'premium.error');
|
||||||
Routerv1::get('/handle', 'PremiumController@handle', 'premium.handle');
|
Router::get('/handle', 'PremiumController@handle', 'premium.handle');
|
||||||
Routerv1::get('/complete', 'PremiumController@complete', 'premium.complete');
|
Router::get('/complete', 'PremiumController@complete', 'premium.complete');
|
||||||
Routerv1::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
|
Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
Routerv1::group(['prefix' => 'helper'], function () {
|
Router::group(['prefix' => 'helper'], function () {
|
||||||
// BBcode
|
// BBcode
|
||||||
Routerv1::group(['prefix' => 'bbcode'], function () {
|
Router::group(['prefix' => 'bbcode'], function () {
|
||||||
Routerv1::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Routerv1::group(['prefix' => 'settings'], function () {
|
Router::group(['prefix' => 'settings'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('settings.account.profile'));
|
redirect(route('settings.account.profile'));
|
||||||
}, 'settings.index');
|
}, 'settings.index');
|
||||||
|
|
||||||
// Account section
|
// Account section
|
||||||
Routerv1::group(['prefix' => 'account'], function () {
|
Router::group(['prefix' => 'account'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('settings.account.profile'));
|
redirect(route('settings.account.profile'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
Router::get('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
||||||
Routerv1::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
Router::post('/profile', 'Settings.AccountController@profile', 'settings.account.profile');
|
||||||
Routerv1::get('/details', 'Settings.AccountController@details', 'settings.account.details');
|
Router::get('/details', 'Settings.AccountController@details', 'settings.account.details');
|
||||||
Routerv1::post('/details', 'Settings.AccountController@details', 'settings.account.details');
|
Router::post('/details', 'Settings.AccountController@details', 'settings.account.details');
|
||||||
Routerv1::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
||||||
Routerv1::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
||||||
Routerv1::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
|
Router::get('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
|
||||||
Routerv1::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
|
Router::post('/userpage', 'Settings.AccountController@userpage', 'settings.account.userpage');
|
||||||
Routerv1::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
|
Router::get('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
|
||||||
Routerv1::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
|
Router::post('/signature', 'Settings.AccountController@signature', 'settings.account.signature');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Friends section
|
// Friends section
|
||||||
Routerv1::group(['prefix' => 'friends'], function () {
|
Router::group(['prefix' => 'friends'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('settings.account.listing'));
|
redirect(route('settings.account.listing'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
||||||
Routerv1::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
|
Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Notifications section
|
// Notifications section
|
||||||
Routerv1::group(['prefix' => 'notifications'], function () {
|
Router::group(['prefix' => 'notifications'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('settings.account.history'));
|
redirect(route('settings.account.history'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
Router::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advanced section
|
// Advanced section
|
||||||
Routerv1::group(['prefix' => 'advanced'], function () {
|
Router::group(['prefix' => 'advanced'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('settings.account.sessions'));
|
redirect(route('settings.account.sessions'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
Router::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
||||||
Routerv1::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
Router::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
||||||
Routerv1::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
||||||
Routerv1::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
Router::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
Routerv1::group(['prefix' => 'manage'], function () {
|
Router::group(['prefix' => 'manage'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('manage.overview.index'));
|
redirect(route('manage.overview.index'));
|
||||||
}, 'manage.index');
|
}, 'manage.index');
|
||||||
|
|
||||||
// Overview section
|
// Overview section
|
||||||
Routerv1::group(['prefix' => 'overview'], function () {
|
Router::group(['prefix' => 'overview'], function () {
|
||||||
Routerv1::get('/', function () {
|
Router::get('/', function () {
|
||||||
redirect(route('manage.overview.index'));
|
redirect(route('manage.overview.index'));
|
||||||
});
|
});
|
||||||
|
|
||||||
Routerv1::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
|
Router::get('/index', 'Manage.OverviewController@index', 'manage.overview.index');
|
||||||
Routerv1::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
|
Router::get('/data', 'Manage.OverviewController@data', 'manage.overview.data');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,5 +12,5 @@ ExceptionHandler::register();
|
||||||
Config::load(path('config/config.ini'));
|
Config::load(path('config/config.ini'));
|
||||||
DB::connect(config('database'));
|
DB::connect(config('database'));
|
||||||
|
|
||||||
Routerv1::init();
|
Router::init();
|
||||||
include_once path('routes.php');
|
include_once path('routes.php');
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Sakura\Config;
|
||||||
use Sakura\Exceptions\ConfigValueNotFoundException;
|
use Sakura\Exceptions\ConfigValueNotFoundException;
|
||||||
use Sakura\FileSystem;
|
use Sakura\FileSystem;
|
||||||
use Sakura\Net;
|
use Sakura\Net;
|
||||||
use Sakura\Routerv1;
|
use Sakura\Router;
|
||||||
use Sakura\Template;
|
use Sakura\Template;
|
||||||
|
|
||||||
// Sort of alias for Config::get
|
// Sort of alias for Config::get
|
||||||
|
@ -28,10 +28,10 @@ function config($value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alias for Routerv1::route
|
// Alias for Router::route
|
||||||
function route($name, $args = null, $full = false)
|
function route($name, $args = null, $full = false)
|
||||||
{
|
{
|
||||||
return ($full ? full_domain() : '') . Routerv1::route($name, $args);
|
return ($full ? full_domain() : '') . Router::route($name, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting the full domain (+protocol) of the current host, only works for http
|
// Getting the full domain (+protocol) of the current host, only works for http
|
||||||
|
|
Reference in a new issue