first few updates in ages
This commit is contained in:
parent
a435d15339
commit
888b22f14a
24 changed files with 350 additions and 345 deletions
|
@ -39,6 +39,7 @@ class ActiveUser
|
||||||
->where('user_id', self::$user->id)
|
->where('user_id', self::$user->id)
|
||||||
->update([
|
->update([
|
||||||
'user_last_online' => time(),
|
'user_last_online' => time(),
|
||||||
|
'last_ip' => Net::pton(Net::ip()),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
self::$user = User::construct(0);
|
self::$user = User::construct(0);
|
||||||
|
|
|
@ -36,6 +36,7 @@ class ForumController extends Controller
|
||||||
{
|
{
|
||||||
// Get the most active threads
|
// Get the most active threads
|
||||||
$activeThreadsIds = DB::table('posts')
|
$activeThreadsIds = DB::table('posts')
|
||||||
|
->where('forum_id', '!=', Config::get('forum_trash_id'))
|
||||||
->groupBy('topic_id')
|
->groupBy('topic_id')
|
||||||
->orderByRaw('COUNT(*) DESC')
|
->orderByRaw('COUNT(*) DESC')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
|
@ -69,6 +70,7 @@ class ForumController extends Controller
|
||||||
|
|
||||||
// Get the latest posts
|
// Get the latest posts
|
||||||
$latestPostsIds = DB::table('posts')
|
$latestPostsIds = DB::table('posts')
|
||||||
|
->where('forum_id', '!=', Config::get('forum_trash_id'))
|
||||||
->orderBy('post_id', 'desc')
|
->orderBy('post_id', 'desc')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->get(['post_id']);
|
->get(['post_id']);
|
||||||
|
@ -100,6 +102,7 @@ class ForumController extends Controller
|
||||||
|
|
||||||
// Get the most active poster
|
// Get the most active poster
|
||||||
$activePosterId = DB::table('posts')
|
$activePosterId = DB::table('posts')
|
||||||
|
->where('forum_id', '!=', Config::get('forum_trash_id'))
|
||||||
->where('post_time', '>', time() - (24 * 60 * 60))
|
->where('post_time', '>', time() - (24 * 60 * 60))
|
||||||
->groupBy('poster_id')
|
->groupBy('poster_id')
|
||||||
->orderByRaw('COUNT(*) DESC')
|
->orderByRaw('COUNT(*) DESC')
|
||||||
|
|
|
@ -69,15 +69,15 @@ class MetaController extends Controller
|
||||||
'stats' => [
|
'stats' => [
|
||||||
'userCount' => DB::table('users')
|
'userCount' => DB::table('users')
|
||||||
->where('password_algo', '!=', 'disabled')
|
->where('password_algo', '!=', 'disabled')
|
||||||
->whereNotIn('rank_main', [1, 10])
|
->whereNotIn('rank_main', [Config::get('deactive_rank_id'), Config::get('restricted_rank_id')])
|
||||||
->count(),
|
->count(),
|
||||||
'newestUser' => $newestUser,
|
'newestUser' => $newestUser,
|
||||||
'lastRegDate' => date_diff(
|
'lastRegDate' => date_diff(
|
||||||
date_create(date('Y-m-d', $newestUser->registered)),
|
date_create(date('Y-m-d', $newestUser->registered)),
|
||||||
date_create(date('Y-m-d'))
|
date_create(date('Y-m-d'))
|
||||||
)->format('%a'),
|
)->format('%a'),
|
||||||
'topicCount' => DB::table('topics')->count(),
|
'topicCount' => DB::table('topics')->where('forum_id', '!=', Config::get('forum_trash_id'))->count(),
|
||||||
'postCount' => DB::table('posts')->count(),
|
'postCount' => DB::table('posts')->where('forum_id', '!=', Config::get('forum_trash_id'))->count(),
|
||||||
'onlineUsers' => $onlineUsers,
|
'onlineUsers' => $onlineUsers,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -82,8 +82,9 @@ class AdvancedController extends Controller
|
||||||
$sessions = DB::table('sessions')
|
$sessions = DB::table('sessions')
|
||||||
->where('user_id', ActiveUser::$user->id)
|
->where('user_id', ActiveUser::$user->id)
|
||||||
->get();
|
->get();
|
||||||
|
$active = ActiveUser::$session->sessionId;
|
||||||
|
|
||||||
Template::vars(compact('sessions'));
|
Template::vars(compact('sessions', 'active'));
|
||||||
|
|
||||||
return Template::render('settings/advanced/sessions');
|
return Template::render('settings/advanced/sessions');
|
||||||
}
|
}
|
||||||
|
|
18
libraries/Exception.php
Normal file
18
libraries/Exception.php
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Holds the Exception class.
|
||||||
|
*
|
||||||
|
* @package Sakura
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Sakura;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sakura Exception class.
|
||||||
|
*
|
||||||
|
* @package Sakura
|
||||||
|
* @author Julian van de Groep <me@flash.moe>
|
||||||
|
*/
|
||||||
|
class Exception extends \Exception
|
||||||
|
{
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ namespace Sakura\Forum;
|
||||||
use Sakura\BBcode;
|
use Sakura\BBcode;
|
||||||
use Sakura\Config;
|
use Sakura\Config;
|
||||||
use Sakura\DB;
|
use Sakura\DB;
|
||||||
|
use Sakura\Exception;
|
||||||
use Sakura\Net;
|
use Sakura\Net;
|
||||||
use Sakura\User;
|
use Sakura\User;
|
||||||
|
|
||||||
|
@ -124,13 +125,20 @@ class Post
|
||||||
$this->thread = $postRow->topic_id;
|
$this->thread = $postRow->topic_id;
|
||||||
$this->forum = $postRow->forum_id;
|
$this->forum = $postRow->forum_id;
|
||||||
$this->poster = User::construct($postRow->poster_id);
|
$this->poster = User::construct($postRow->poster_id);
|
||||||
$this->ip = $postRow->poster_ip;
|
|
||||||
$this->time = $postRow->post_time;
|
$this->time = $postRow->post_time;
|
||||||
$this->subject = $postRow->post_subject;
|
$this->subject = $postRow->post_subject;
|
||||||
$this->text = $postRow->post_text;
|
$this->text = $postRow->post_text;
|
||||||
$this->editTime = $postRow->post_edit_time;
|
$this->editTime = $postRow->post_edit_time;
|
||||||
$this->editReason = $postRow->post_edit_reason;
|
$this->editReason = $postRow->post_edit_reason;
|
||||||
$this->editUser = User::construct($postRow->post_edit_user);
|
$this->editUser = User::construct($postRow->post_edit_user);
|
||||||
|
|
||||||
|
// Temporary backwards compatible IP storage system
|
||||||
|
try {
|
||||||
|
$this->ip = Net::ntop($postRow->poster_ip);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->ip = $postRow->poster_ip;
|
||||||
|
$this->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the markup
|
// Parse the markup
|
||||||
|
@ -168,7 +176,7 @@ class Post
|
||||||
'topic_id' => $thread->id,
|
'topic_id' => $thread->id,
|
||||||
'forum_id' => $thread->forum,
|
'forum_id' => $thread->forum,
|
||||||
'poster_id' => $poster->id,
|
'poster_id' => $poster->id,
|
||||||
'poster_ip' => Net::ip(),
|
'poster_ip' => Net::pton(Net::ip()),
|
||||||
'post_time' => time(),
|
'post_time' => time(),
|
||||||
'post_subject' => $subject,
|
'post_subject' => $subject,
|
||||||
'post_text' => $text,
|
'post_text' => $text,
|
||||||
|
@ -235,6 +243,11 @@ class Post
|
||||||
*/
|
*/
|
||||||
public function unread($user)
|
public function unread($user)
|
||||||
{
|
{
|
||||||
|
// Return false if the user id is less than 1
|
||||||
|
if ($user < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to get track row from the database
|
// Attempt to get track row from the database
|
||||||
$track = DB::table('topics_track')
|
$track = DB::table('topics_track')
|
||||||
->where('user_id', $user)
|
->where('user_id', $user)
|
||||||
|
|
|
@ -347,6 +347,11 @@ class Thread
|
||||||
*/
|
*/
|
||||||
public function unread($user)
|
public function unread($user)
|
||||||
{
|
{
|
||||||
|
// Return false if the user id is less than 1
|
||||||
|
if ($user < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to get track row from the database
|
// Attempt to get track row from the database
|
||||||
$track = DB::table('topics_track')
|
$track = DB::table('topics_track')
|
||||||
->where('user_id', $user)
|
->where('user_id', $user)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Net
|
||||||
*
|
*
|
||||||
* @param string $ip Printable IP string.
|
* @param string $ip Printable IP string.
|
||||||
*
|
*
|
||||||
* @throws \Exception Thrown if an invalid IP is supplied.
|
* @throws Exception Thrown if an invalid IP is supplied.
|
||||||
*
|
*
|
||||||
* @return string Unpacked IP address.
|
* @return string Unpacked IP address.
|
||||||
*/
|
*/
|
||||||
|
@ -76,7 +76,7 @@ class Net
|
||||||
}
|
}
|
||||||
|
|
||||||
// Throw an exception if an invalid IP was supplied
|
// Throw an exception if an invalid IP was supplied
|
||||||
throw new \Exception("Invalid IP address supplied.");
|
throw new Exception("Invalid IP address supplied.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ class Net
|
||||||
*
|
*
|
||||||
* @param string $bin The unpacked IP.
|
* @param string $bin The unpacked IP.
|
||||||
*
|
*
|
||||||
* @throws \Exception Thrown if the unpacked IP is invalid.
|
* @throws Exception Thrown if the unpacked IP is invalid.
|
||||||
*
|
*
|
||||||
* @return string The packed IP.
|
* @return string The packed IP.
|
||||||
*/
|
*/
|
||||||
|
@ -95,7 +95,7 @@ class Net
|
||||||
|
|
||||||
// Throw an exception if it's not 4 or 16 bytes
|
// Throw an exception if it's not 4 or 16 bytes
|
||||||
if ($len !== 4 && $len !== 16) {
|
if ($len !== 4 && $len !== 16) {
|
||||||
throw new \Exception("Could not handle this IP type.");
|
throw new Exception("Could not handle this IP type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally pack the IP
|
// Finally pack the IP
|
||||||
|
|
|
@ -133,51 +133,8 @@ class Session
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IP Check
|
/* completely removed the code for ip checking because it only worked with IPv4
|
||||||
$ipCheck = false; // Forced disabled due to incompatibility with the Net class. -- Config::get('session_check');
|
good thing is i can probably do CIDR based checking */
|
||||||
|
|
||||||
// Origin checking
|
|
||||||
if ($ipCheck) {
|
|
||||||
// Split both IPs up
|
|
||||||
$sessionIP = explode('.', $session[0]->user_ip);
|
|
||||||
$userIP = explode('.', Net::ip());
|
|
||||||
|
|
||||||
// Take 1 off the ipCheck variable so it's equal to the array keys
|
|
||||||
$ipCheck = $ipCheck - 1;
|
|
||||||
|
|
||||||
// Check if the user's IP is similar to the session's registered IP
|
|
||||||
switch ($ipCheck) {
|
|
||||||
// 000.xxx.xxx.xxx
|
|
||||||
case 3:
|
|
||||||
if ($userIP[3] !== $sessionIP[3]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// xxx.000.xxx.xxx
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
if ($userIP[2] !== $sessionIP[2]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// xxx.xxx.000.xxx
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
if ($userIP[1] !== $sessionIP[1]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// xxx.xxx.xxx.000
|
|
||||||
case 0:
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
if ($userIP[0] !== $sessionIP[0]) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the remember flag is set extend the session time
|
// If the remember flag is set extend the session time
|
||||||
if ($session[0]->session_remember) {
|
if ($session[0]->session_remember) {
|
||||||
|
|
|
@ -316,8 +316,6 @@ class User
|
||||||
$this->email = $userRow->email;
|
$this->email = $userRow->email;
|
||||||
$this->mainRankId = $userRow->rank_main;
|
$this->mainRankId = $userRow->rank_main;
|
||||||
$this->colour = $userRow->user_colour;
|
$this->colour = $userRow->user_colour;
|
||||||
$this->registerIp = Net::ntop($userRow->register_ip);
|
|
||||||
$this->lastIp = Net::ntop($userRow->last_ip);
|
|
||||||
$this->title = $userRow->user_title;
|
$this->title = $userRow->user_title;
|
||||||
$this->registered = $userRow->user_registered;
|
$this->registered = $userRow->user_registered;
|
||||||
$this->lastOnline = $userRow->user_last_online;
|
$this->lastOnline = $userRow->user_last_online;
|
||||||
|
@ -328,6 +326,31 @@ class User
|
||||||
$this->header = $userRow->user_header;
|
$this->header = $userRow->user_header;
|
||||||
$this->page = $userRow->user_page;
|
$this->page = $userRow->user_page;
|
||||||
$this->signature = $userRow->user_signature;
|
$this->signature = $userRow->user_signature;
|
||||||
|
|
||||||
|
// Temporary backwards compatible IP storage system
|
||||||
|
try {
|
||||||
|
$this->registerIp = Net::ntop($userRow->register_ip);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->registerIp = $userRow->register_ip;
|
||||||
|
|
||||||
|
DB::table('users')
|
||||||
|
->where('user_id', $this->id)
|
||||||
|
->update([
|
||||||
|
'register_ip' => Net::pton($this->registerIp),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->lastIp = Net::ntop($userRow->last_ip);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->lastIp = $userRow->last_ip;
|
||||||
|
|
||||||
|
DB::table('users')
|
||||||
|
->where('user_id', $this->id)
|
||||||
|
->update([
|
||||||
|
'last_ip' => Net::pton($this->lastIp),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all ranks
|
// Get all ranks
|
||||||
|
|
373
routes.php
373
routes.php
|
@ -28,223 +28,239 @@ Router::filter('loginCheck', function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Meta pages
|
// Maintenance check
|
||||||
Router::get('/', 'MetaController@index', 'main.index');
|
Router::filter('maintenance', function () {
|
||||||
Router::get('/faq', 'MetaController@faq', 'main.faq');
|
if (Config::get('site_closed')) {
|
||||||
Router::get('/search', 'MetaController@search', 'main.search');
|
ActiveUser::$session->destroy();
|
||||||
Router::get('/p/{id}', 'MetaController@infoPage', 'main.infopage');
|
|
||||||
|
|
||||||
// Auth
|
http_response_code(503);
|
||||||
Router::group(['before' => 'logoutCheck'], function () {
|
|
||||||
Router::get('/login', 'AuthController@loginGet', 'auth.login');
|
$message = Config::get('site_closed_reason');
|
||||||
Router::post('/login', 'AuthController@loginPost', 'auth.login');
|
|
||||||
Router::get('/register', 'AuthController@registerGet', 'auth.register');
|
Template::vars(compact('message'));
|
||||||
Router::post('/register', 'AuthController@registerPost', 'auth.register');
|
|
||||||
Router::get('/resetpassword', 'AuthController@resetPasswordGet', 'auth.resetpassword');
|
return Template::render('global/maintenance');
|
||||||
Router::post('/resetpassword', 'AuthController@resetPasswordPost', 'auth.resetpassword');
|
}
|
||||||
Router::get('/reactivate', 'AuthController@reactivateGet', 'auth.reactivate');
|
|
||||||
Router::post('/reactivate', 'AuthController@reactivatePost', 'auth.reactivate');
|
|
||||||
Router::get('/activate', 'AuthController@activate', 'auth.activate');
|
|
||||||
});
|
|
||||||
Router::group(['before' => 'loginCheck'], function () {
|
|
||||||
Router::get('/logout', 'AuthController@logout', 'auth.logout');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// News
|
Router::group(['before' => 'maintenance'], function () {
|
||||||
Router::group(['prefix' => 'news'], function () {
|
// Meta pages
|
||||||
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
|
Router::get('/', 'MetaController@index', 'main.index');
|
||||||
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
|
Router::get('/faq', 'MetaController@faq', 'main.faq');
|
||||||
});
|
Router::get('/search', 'MetaController@search', 'main.search');
|
||||||
|
Router::get('/p/{id}', 'MetaController@infoPage', 'main.infopage');
|
||||||
|
|
||||||
// Forum
|
// Auth
|
||||||
Router::group(['prefix' => 'forum'], function () {
|
Router::group(['before' => 'logoutCheck'], function () {
|
||||||
// Post
|
Router::get('/login', 'AuthController@loginGet', 'auth.login');
|
||||||
Router::group(['prefix' => 'post'], function () {
|
Router::post('/login', 'AuthController@loginPost', 'auth.login');
|
||||||
Router::get('/{id:i}', 'ForumController@post', 'forums.post');
|
Router::get('/register', 'AuthController@registerGet', 'auth.register');
|
||||||
Router::group(['before' => 'loginCheck'], function () {
|
Router::post('/register', 'AuthController@registerPost', 'auth.register');
|
||||||
Router::get('/{id:i}/raw', 'ForumController@postRaw', 'forums.post.raw');
|
Router::get('/resetpassword', 'AuthController@resetPasswordGet', 'auth.resetpassword');
|
||||||
Router::get('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
|
Router::post('/resetpassword', 'AuthController@resetPasswordPost', 'auth.resetpassword');
|
||||||
Router::post('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
|
Router::get('/reactivate', 'AuthController@reactivateGet', 'auth.reactivate');
|
||||||
Router::post('/{id:i}/edit', 'ForumController@editPost', 'forums.post.edit');
|
Router::post('/reactivate', 'AuthController@reactivatePost', 'auth.reactivate');
|
||||||
});
|
Router::get('/activate', 'AuthController@activate', 'auth.activate');
|
||||||
|
});
|
||||||
|
Router::group(['before' => 'loginCheck'], function () {
|
||||||
|
Router::get('/logout', 'AuthController@logout', 'auth.logout');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Thread
|
// News
|
||||||
Router::group(['prefix' => 'thread'], function () {
|
Router::group(['prefix' => 'news'], function () {
|
||||||
Router::get('/{id:i}', 'ForumController@thread', 'forums.thread');
|
Router::get('/{category:c}?', 'NewsController@category', 'news.category');
|
||||||
Router::post('/{id:i}/mod', 'ForumController@threadModerate', 'forums.thread.mod');
|
Router::get('/post/{id:i}', 'NewsController@post', 'news.post');
|
||||||
Router::post('/{id:i}/reply', 'ForumController@threadReply', 'forums.thread.reply');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Forum
|
// Forum
|
||||||
Router::get('/', 'ForumController@index', 'forums.index');
|
Router::group(['prefix' => 'forum'], function () {
|
||||||
Router::get('/{id:i}', 'ForumController@forum', 'forums.forum');
|
// Post
|
||||||
Router::group(['before' => 'loginCheck'], function () {
|
Router::group(['prefix' => 'post'], function () {
|
||||||
Router::get('/{id:i}/mark', 'ForumController@markForumRead', 'forums.mark');
|
Router::get('/{id:i}', 'ForumController@post', 'forums.post');
|
||||||
Router::get('/{id:i}/new', 'ForumController@createThread', 'forums.new');
|
Router::group(['before' => 'loginCheck'], function () {
|
||||||
Router::post('/{id:i}/new', 'ForumController@createThread', 'forums.new');
|
Router::get('/{id:i}/raw', 'ForumController@postRaw', 'forums.post.raw');
|
||||||
|
Router::get('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
|
||||||
|
Router::post('/{id:i}/delete', 'ForumController@deletePost', 'forums.post.delete');
|
||||||
|
Router::post('/{id:i}/edit', 'ForumController@editPost', 'forums.post.edit');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Thread
|
||||||
|
Router::group(['prefix' => 'thread'], function () {
|
||||||
|
Router::get('/{id:i}', 'ForumController@thread', 'forums.thread');
|
||||||
|
Router::post('/{id:i}/mod', 'ForumController@threadModerate', 'forums.thread.mod');
|
||||||
|
Router::post('/{id:i}/reply', 'ForumController@threadReply', 'forums.thread.reply');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Forum
|
||||||
|
Router::get('/', 'ForumController@index', 'forums.index');
|
||||||
|
Router::get('/{id:i}', 'ForumController@forum', 'forums.forum');
|
||||||
|
Router::group(['before' => 'loginCheck'], function () {
|
||||||
|
Router::get('/{id:i}/mark', 'ForumController@markForumRead', 'forums.mark');
|
||||||
|
Router::get('/{id:i}/new', 'ForumController@createThread', 'forums.new');
|
||||||
|
Router::post('/{id:i}/new', 'ForumController@createThread', 'forums.new');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Members
|
// Members
|
||||||
Router::group(['prefix' => 'members', 'before' => 'loginCheck'], function () {
|
Router::group(['prefix' => 'members', 'before' => 'loginCheck'], function () {
|
||||||
Router::get('/', 'UserController@members', 'members.index');
|
Router::get('/', 'UserController@members', 'members.index');
|
||||||
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
|
Router::get('/{rank:i}', 'UserController@members', 'members.rank');
|
||||||
});
|
|
||||||
|
|
||||||
// User
|
|
||||||
Router::group(['prefix' => 'u'], function () {
|
|
||||||
Router::get('/{id}', 'UserController@profile', 'user.profile');
|
|
||||||
Router::get('/{id}/report', 'UserController@report', 'user.report');
|
|
||||||
Router::get('/{id}/header', 'FileController@header', 'user.header');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Notifications
|
|
||||||
Router::group(['prefix' => 'notifications'], function () {
|
|
||||||
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
|
|
||||||
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Comments
|
|
||||||
Router::group(['prefix' => 'comments', 'before' => 'loginCheck'], function () {
|
|
||||||
Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
|
|
||||||
Router::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
|
|
||||||
Router::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Comments
|
|
||||||
Router::group(['prefix' => 'friends', 'before' => 'loginCheck'], function () {
|
|
||||||
Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
|
||||||
Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Files
|
|
||||||
Router::get('/a/{id}', 'FileController@avatar', 'file.avatar');
|
|
||||||
Router::get('/bg/{id}', 'FileController@background', 'file.background');
|
|
||||||
|
|
||||||
// Premium
|
|
||||||
Router::group(['prefix' => 'support', 'before' => 'loginCheck'], function () {
|
|
||||||
Router::get('/', 'PremiumController@index', 'premium.index');
|
|
||||||
Router::get('/handle', 'PremiumController@handle', 'premium.handle');
|
|
||||||
Router::get('/complete', 'PremiumController@complete', 'premium.complete');
|
|
||||||
Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Helpers
|
|
||||||
Router::group(['prefix' => 'helper'], function () {
|
|
||||||
// BBcode
|
|
||||||
Router::group(['prefix' => 'bbcode', 'before' => 'loginCheck'], function () {
|
|
||||||
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Settings
|
// User
|
||||||
Router::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
|
Router::group(['prefix' => 'u'], function () {
|
||||||
Router::get('/', function () {
|
Router::get('/{id}', 'UserController@profile', 'user.profile');
|
||||||
$route = Router::route('settings.general.home');
|
Router::get('/{id}/report', 'UserController@report', 'user.report');
|
||||||
return header("Location: {$route}");
|
Router::get('/{id}/header', 'FileController@header', 'user.header');
|
||||||
}, 'settings.index');
|
});
|
||||||
|
|
||||||
// General section
|
// Notifications
|
||||||
Router::group(['prefix' => 'general'], function () {
|
Router::group(['prefix' => 'notifications'], function () {
|
||||||
|
Router::get('/', 'NotificationsController@notifications', 'notifications.get');
|
||||||
|
Router::get('/{id}/mark', 'NotificationsController@mark', 'notifications.mark');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Comments
|
||||||
|
Router::group(['prefix' => 'comments', 'before' => 'loginCheck'], function () {
|
||||||
|
Router::post('/{category:c}/post/{reply:i}?', 'CommentsController@post', 'comments.category.post');
|
||||||
|
Router::post('/{id:i}/delete', 'CommentsController@delete', 'comments.comment.delete');
|
||||||
|
Router::post('/{id:i}/vote', 'CommentsController@vote', 'comments.comment.vote');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Comments
|
||||||
|
Router::group(['prefix' => 'friends', 'before' => 'loginCheck'], function () {
|
||||||
|
Router::post('/{id:i}/add', 'FriendsController@add', 'friends.add');
|
||||||
|
Router::post('/{id:i}/remove', 'FriendsController@remove', 'friends.remove');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Files
|
||||||
|
Router::get('/a/{id}', 'FileController@avatar', 'file.avatar');
|
||||||
|
Router::get('/bg/{id}', 'FileController@background', 'file.background');
|
||||||
|
|
||||||
|
// Premium
|
||||||
|
Router::group(['prefix' => 'support', 'before' => 'loginCheck'], function () {
|
||||||
|
Router::get('/', 'PremiumController@index', 'premium.index');
|
||||||
|
Router::get('/handle', 'PremiumController@handle', 'premium.handle');
|
||||||
|
Router::get('/complete', 'PremiumController@complete', 'premium.complete');
|
||||||
|
Router::post('/purchase', 'PremiumController@purchase', 'premium.purchase');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Helpers
|
||||||
|
Router::group(['prefix' => 'helper'], function () {
|
||||||
|
// BBcode
|
||||||
|
Router::group(['prefix' => 'bbcode', 'before' => 'loginCheck'], function () {
|
||||||
|
Router::post('/parse', 'HelperController@bbcodeParse', 'helper.bbcode.parse');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Settings
|
||||||
|
Router::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
|
||||||
Router::get('/', function () {
|
Router::get('/', function () {
|
||||||
$route = Router::route('settings.general.home');
|
$route = Router::route('settings.general.home');
|
||||||
return header("Location: {$route}");
|
return header("Location: {$route}");
|
||||||
|
}, 'settings.index');
|
||||||
|
|
||||||
|
// General section
|
||||||
|
Router::group(['prefix' => 'general'], function () {
|
||||||
|
Router::get('/', function () {
|
||||||
|
$route = Router::route('settings.general.home');
|
||||||
|
return header("Location: {$route}");
|
||||||
|
});
|
||||||
|
|
||||||
|
Router::get('/home', 'Settings.GeneralController@home', 'settings.general.home');
|
||||||
|
Router::get('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
||||||
|
Router::post('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
||||||
|
Router::get('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
||||||
|
Router::post('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/home', 'Settings.GeneralController@home', 'settings.general.home');
|
// Friends section
|
||||||
Router::get('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
Router::group(['prefix' => 'friends'], function () {
|
||||||
Router::post('/profile', 'Settings.GeneralController@profile', 'settings.general.profile');
|
Router::get('/', function () {
|
||||||
Router::get('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
$route = Router::route('settings.friends.listing');
|
||||||
Router::post('/options', 'Settings.GeneralController@options', 'settings.general.options');
|
return header("Location: {$route}");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Friends section
|
Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
||||||
Router::group(['prefix' => 'friends'], function () {
|
Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
|
||||||
Router::get('/', function () {
|
|
||||||
$route = Router::route('settings.friends.listing');
|
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/listing', 'Settings.FriendsController@listing', 'settings.friends.listing');
|
// Groups section
|
||||||
Router::get('/requests', 'Settings.FriendsController@requests', 'settings.friends.requests');
|
Router::group(['prefix' => 'groups'], function () {
|
||||||
});
|
Router::get('/', function () {
|
||||||
|
$route = Router::route('settings.groups.listing');
|
||||||
|
return header("Location: {$route}");
|
||||||
|
});
|
||||||
|
|
||||||
// Groups section
|
Router::get('/listing', 'Settings.GroupsController@listing', 'settings.groups.listing');
|
||||||
Router::group(['prefix' => 'groups'], function () {
|
Router::get('/invites', 'Settings.GroupsController@invites', 'settings.groups.invites');
|
||||||
Router::get('/', function () {
|
|
||||||
$route = Router::route('settings.groups.listing');
|
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/listing', 'Settings.GroupsController@listing', 'settings.groups.listing');
|
// Notifications section
|
||||||
Router::get('/invites', 'Settings.GroupsController@invites', 'settings.groups.invites');
|
Router::group(['prefix' => 'notifications'], function () {
|
||||||
});
|
Router::get('/', function () {
|
||||||
|
$route = Router::route('settings.notifications.history');
|
||||||
|
return header("Location: {$route}");
|
||||||
|
});
|
||||||
|
|
||||||
// Notifications section
|
Router::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
||||||
Router::group(['prefix' => 'notifications'], function () {
|
|
||||||
Router::get('/', function () {
|
|
||||||
$route = Router::route('settings.notifications.history');
|
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/history', 'Settings.NotificationsController@history', 'settings.notifications.history');
|
// Appearance section
|
||||||
});
|
Router::group(['prefix' => 'appearance'], function () {
|
||||||
|
Router::get('/', function () {
|
||||||
|
$route = Router::route('settings.appearance.avatar');
|
||||||
|
return header("Location: {$route}");
|
||||||
|
});
|
||||||
|
|
||||||
// Appearance section
|
Router::get('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
||||||
Router::group(['prefix' => 'appearance'], function () {
|
Router::post('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
||||||
Router::get('/', function () {
|
Router::get('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
||||||
$route = Router::route('settings.appearance.avatar');
|
Router::post('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
||||||
return header("Location: {$route}");
|
Router::get('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
||||||
|
Router::post('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
||||||
|
Router::get('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
||||||
|
Router::post('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
||||||
|
Router::get('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
||||||
|
Router::post('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
// Account section
|
||||||
Router::post('/avatar', 'Settings.AppearanceController@avatar', 'settings.appearance.avatar');
|
Router::group(['prefix' => 'account'], function () {
|
||||||
Router::get('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
Router::get('/', function () {
|
||||||
Router::post('/background', 'Settings.AppearanceController@background', 'settings.appearance.background');
|
$route = Router::route('settings.account.email');
|
||||||
Router::get('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
return header("Location: {$route}");
|
||||||
Router::post('/header', 'Settings.AppearanceController@header', 'settings.appearance.header');
|
});
|
||||||
Router::get('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
|
||||||
Router::post('/userpage', 'Settings.AppearanceController@userpage', 'settings.appearance.userpage');
|
|
||||||
Router::get('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
|
||||||
Router::post('/signature', 'Settings.AppearanceController@signature', 'settings.appearance.signature');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Account section
|
Router::get('/email', 'Settings.AccountController@email', 'settings.account.email');
|
||||||
Router::group(['prefix' => 'account'], function () {
|
Router::post('/email', 'Settings.AccountController@email', 'settings.account.email');
|
||||||
Router::get('/', function () {
|
Router::get('/username', 'Settings.AccountController@username', 'settings.account.username');
|
||||||
$route = Router::route('settings.account.email');
|
Router::post('/username', 'Settings.AccountController@username', 'settings.account.username');
|
||||||
return header("Location: {$route}");
|
Router::get('/title', 'Settings.AccountController@title', 'settings.account.title');
|
||||||
|
Router::post('/title', 'Settings.AccountController@title', 'settings.account.title');
|
||||||
|
Router::get('/password', 'Settings.AccountController@password', 'settings.account.password');
|
||||||
|
Router::post('/password', 'Settings.AccountController@password', 'settings.account.password');
|
||||||
|
Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
||||||
|
Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/email', 'Settings.AccountController@email', 'settings.account.email');
|
// Advanced section
|
||||||
Router::post('/email', 'Settings.AccountController@email', 'settings.account.email');
|
Router::group(['prefix' => 'advanced'], function () {
|
||||||
Router::get('/username', 'Settings.AccountController@username', 'settings.account.username');
|
Router::get('/', function () {
|
||||||
Router::post('/username', 'Settings.AccountController@username', 'settings.account.username');
|
$route = Router::route('settings.advanced.sessions');
|
||||||
Router::get('/title', 'Settings.AccountController@title', 'settings.account.title');
|
return header("Location: {$route}");
|
||||||
Router::post('/title', 'Settings.AccountController@title', 'settings.account.title');
|
});
|
||||||
Router::get('/password', 'Settings.AccountController@password', 'settings.account.password');
|
|
||||||
Router::post('/password', 'Settings.AccountController@password', 'settings.account.password');
|
|
||||||
Router::get('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
|
||||||
Router::post('/ranks', 'Settings.AccountController@ranks', 'settings.account.ranks');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Advanced section
|
Router::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
||||||
Router::group(['prefix' => 'advanced'], function () {
|
Router::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
||||||
Router::get('/', function () {
|
Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
||||||
$route = Router::route('settings.advanced.sessions');
|
Router::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
||||||
return header("Location: {$route}");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Router::get('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
|
||||||
Router::post('/sessions', 'Settings.AdvancedController@sessions', 'settings.advanced.sessions');
|
|
||||||
Router::get('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
|
||||||
Router::post('/deactivate', 'Settings.AdvancedController@deactivate', 'settings.advanced.deactivate');
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Management
|
// Management
|
||||||
/*
|
/*
|
||||||
* General
|
* General
|
||||||
* - Dashboard
|
* - Dashboard
|
||||||
* - Info pages (possibly deprecate with wiki)
|
* - Info pages (possibly deprecate with wiki)
|
||||||
|
@ -274,3 +290,4 @@ Router::group(['prefix' => 'settings', 'before' => 'loginCheck'], function () {
|
||||||
* - Management
|
* - Management
|
||||||
* - Errors
|
* - Errors
|
||||||
*/
|
*/
|
||||||
|
});
|
||||||
|
|
38
sakura.php
38
sakura.php
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', 20160408);
|
define('SAKURA_VERSION', 20160425);
|
||||||
|
|
||||||
// Define Sakura Path
|
// Define Sakura Path
|
||||||
define('ROOT', __DIR__ . '/');
|
define('ROOT', __DIR__ . '/');
|
||||||
|
@ -25,12 +25,12 @@ mb_internal_encoding('utf-8');
|
||||||
|
|
||||||
// Stop the execution if the PHP Version is older than 7.0.0
|
// Stop the execution if the PHP Version is older than 7.0.0
|
||||||
if (version_compare(phpversion(), '7.0.0', '<')) {
|
if (version_compare(phpversion(), '7.0.0', '<')) {
|
||||||
throw new \Exception('Sakura requires at least PHP 7.0.0, please upgrade to a newer PHP version.');
|
throw new Exception('Sakura requires at least PHP 7.0.0, please upgrade to a newer PHP version.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the composer autoloader exists
|
// Check if the composer autoloader exists
|
||||||
if (!file_exists(ROOT . 'vendor/autoload.php')) {
|
if (!file_exists(ROOT . 'vendor/autoload.php')) {
|
||||||
throw new \Exception('Autoloader not found, did you run composer install?');
|
throw new Exception('Autoloader not found, did you run composer install?');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Require composer libraries
|
// Require composer libraries
|
||||||
|
@ -87,9 +87,10 @@ Router::init();
|
||||||
include_once ROOT . 'routes.php';
|
include_once ROOT . 'routes.php';
|
||||||
|
|
||||||
// Initialise the current session
|
// Initialise the current session
|
||||||
|
$cookiePrefix = Config::get('cookie_prefix');
|
||||||
ActiveUser::init(
|
ActiveUser::init(
|
||||||
intval($_COOKIE[Config::get('cookie_prefix') . 'id'] ?? 0),
|
intval($_COOKIE["{$cookiePrefix}id"] ?? 0),
|
||||||
$_COOKIE[Config::get('cookie_prefix') . 'session'] ?? ''
|
$_COOKIE["{$cookiePrefix}session"] ?? ''
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!defined('SAKURA_NO_TPL')) {
|
if (!defined('SAKURA_NO_TPL')) {
|
||||||
|
@ -98,32 +99,11 @@ if (!defined('SAKURA_NO_TPL')) {
|
||||||
|
|
||||||
// Set base page rendering data
|
// Set base page rendering data
|
||||||
Template::vars([
|
Template::vars([
|
||||||
'sakura' => [
|
|
||||||
'currentPage' => $_SERVER['REQUEST_URI'] ?? null,
|
|
||||||
'referrer' => $_SERVER['HTTP_REFERER'] ?? null,
|
|
||||||
],
|
|
||||||
|
|
||||||
'session' => array_merge([
|
|
||||||
'sessionId' => ActiveUser::$session->sessionId,
|
|
||||||
], $_SESSION),
|
|
||||||
|
|
||||||
'user' => ActiveUser::$user,
|
|
||||||
|
|
||||||
'get' => $_GET,
|
'get' => $_GET,
|
||||||
|
'user' => ActiveUser::$user,
|
||||||
'post' => $_POST,
|
'post' => $_POST,
|
||||||
'request' => $_REQUEST,
|
|
||||||
'server' => $_SERVER,
|
'server' => $_SERVER,
|
||||||
|
'request' => $_REQUEST,
|
||||||
|
'session' => $_SESSION,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Site closing
|
|
||||||
if (Config::get('site_closed')) {
|
|
||||||
// Set parse variables
|
|
||||||
Template::vars([
|
|
||||||
'message' => Config::get('site_closed_reason'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Print page contents
|
|
||||||
echo Template::render('global/information');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<li><a href="{{ urls.format('SETTING_CAT', ['messages']) }}">Private Messages</a></li>
|
<li><a href="{{ urls.format('SETTING_CAT', ['messages']) }}">Private Messages</a></li>
|
||||||
<li><a href="{{ urls.format('SETTINGS_INDEX') }}">User Settings</a></li>
|
<li><a href="{{ urls.format('SETTINGS_INDEX') }}">User Settings</a></li>
|
||||||
<li><a href="{{ urls.format('MANAGE_INDEX') }}">Site Management</a></li>
|
<li><a href="{{ urls.format('MANAGE_INDEX') }}">Site Management</a></li>
|
||||||
<li><a href="{{ urls.format('USER_LOGOUT', [date().timestamp, session_id(), sakura.currentPage]) }}">Logout</a></li>
|
<li><a href="{{ urls.format('USER_LOGOUT', [date().timestamp, session_id(), server['REQUEST_URI']]) }}">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
<li class="edit"><a title="Edit your profile" href="{{ urls.format('SETTING_MODE', ['general', 'profile']) }}">Edit</a></li>
|
<li class="edit"><a title="Edit your profile" href="{{ urls.format('SETTING_MODE', ['general', 'profile']) }}">Edit</a></li>
|
||||||
<li class="settings"><a title="Change your settings" href="{{ urls.format('SETTINGS_INDEX') }}">Settings</a></li>
|
<li class="settings"><a title="Change your settings" href="{{ urls.format('SETTINGS_INDEX') }}">Settings</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="{% if user.checkFriends(profile.id) == 2 %}mutualFriend{% elseif user.checkFriends(profile.id) == 1 %}pendingFriend{% else %}addFriend{% endif %}"><a href="{% if user.checkFriends(profile.id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.id, session_id(), date().timestamp, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.id, session_id(), date().timestamp, sakura.currentPage]) }}{% endif %}">{% if user.checkFriends(profile.id) == 0 %}Add friend{% else %}Friends{% endif %}</a></li>
|
<li class="{% if user.checkFriends(profile.id) == 2 %}mutualFriend{% elseif user.checkFriends(profile.id) == 1 %}pendingFriend{% else %}addFriend{% endif %}"><a href="{% if user.checkFriends(profile.id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.id, session_id(), date().timestamp, server['REQUEST_URI']]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.id, session_id(), date().timestamp, server['REQUEST_URI']]) }}{% endif %}">{% if user.checkFriends(profile.id) == 0 %}Add friend{% else %}Friends{% endif %}</a></li>
|
||||||
<li class="report"><a href="{{ route('user.report', profile.id) }}">Report</a></li>
|
<li class="report"><a href="{{ route('user.report', profile.id) }}">Report</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" class="box">
|
<form enctype="multipart/form-data" method="post" action="{{ server['REQUEST_URI'] }}" class="box">
|
||||||
<input type="hidden" name="sessid" value="{{ session_id() }}" />
|
<input type="hidden" name="sessid" value="{{ session_id() }}" />
|
||||||
<input type="hidden" name="timestamp" value="{{ date().timestamp }}" />
|
<input type="hidden" name="timestamp" value="{{ date().timestamp }}" />
|
||||||
<input type="hidden" name="mode" value="options" />
|
<input type="hidden" name="mode" value="options" />
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
Login
|
Login
|
||||||
</div>
|
</div>
|
||||||
<form method="post" action="{{ route('auth.login') }}" id="loginForm">
|
<form method="post" action="{{ route('auth.login') }}" id="loginForm">
|
||||||
<input type="hidden" name="redirect" value="{{ sakura.referrer ? sakura.referrer : route('main.index') }}" />
|
<input type="hidden" name="redirect" value="{{ server['HTTP_REFERER'] ? server['HTTP_REFERER'] : route('main.index') }}" />
|
||||||
<input type="hidden" name="session" value="{{ session_id() }}" />
|
|
||||||
<div class="leftAlign">
|
<div class="leftAlign">
|
||||||
<label for="loginUserName">Username:</label>
|
<label for="loginUserName">Username:</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,7 +29,7 @@
|
||||||
<input class="inputStyling" name="remember" type="checkbox" class="ignore-css" id="loginRemember" /><label for="loginRemember">Remember Me</a>
|
<input class="inputStyling" name="remember" type="checkbox" class="ignore-css" id="loginRemember" /><label for="loginRemember">Remember Me</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="centreAlign">
|
<div class="centreAlign">
|
||||||
<button class="inputStyling" id="loginButton"><i class="fa fa-sign-in"></i> Login</button>
|
<button class="inputStyling" id="loginButton" name="session" value="{{ session_id() }}"><i class="fa fa-sign-in"></i> Login</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="subLinks centreAlign" style="line-height: 1.5em;">
|
<div class="subLinks centreAlign" style="line-height: 1.5em;">
|
||||||
<p><a href="{{ route('auth.register') }}" class="default">I don't have an account yet!</a></p>
|
<p><a href="{{ route('auth.register') }}" class="default">I don't have an account yet!</a></p>
|
||||||
|
|
|
@ -10,21 +10,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
|
||||||
{% if config('lock_authentication') %}
|
|
||||||
<div class="head">Whoops!</div>
|
|
||||||
You caught the site at the wrong moment! Right now registration <i>and</i> logging in is disabled for unspecified reasons. Sorry for the inconvenience but please try again later!
|
|
||||||
<div class="indexSidePanelLinks">
|
|
||||||
<a class="fa fa-lock" href="#" title="Authentication is locked"></a>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="head">Welcome!</div>
|
|
||||||
Welcome to Flashii! This is a site for a bunch of friends to hang out, nothing special. Anyone is pretty much welcome to register so why not have a go?
|
|
||||||
<div class="indexSidePanelLinks">
|
|
||||||
<a class="fa fa-magic" href="{{ route('auth.register') }}" title="Register" id="indexSidePanelRegister"></a>
|
|
||||||
<a class="fa fa-sign-in" href="{{ route('auth.login') }}" title="Login" id="indexSidePanelLogin"></a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="head">Stats</div>
|
<div class="head">Stats</div>
|
||||||
We have <b>{{ stats.userCount }} user{% if stats.userCount != 1 %}s{% endif %}</b>,
|
We have <b>{{ stats.userCount }} user{% if stats.userCount != 1 %}s{% endif %}</b>,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<h1>{% block header %}Confirmation{% endblock %}</h1>
|
<h1>{% block header %}Confirmation{% endblock %}</h1>
|
||||||
<hr class="default" />
|
<hr class="default" />
|
||||||
{{ message }}
|
{{ message }}
|
||||||
<form method="post" action="{{ sakura.currentPage }}" id="confirmationForm">
|
<form method="post" action="{{ server['REQUEST_URI'] }}" id="confirmationForm">
|
||||||
<input type="hidden" name="sessionid" value="{{ session_id() }}" />
|
<input type="hidden" name="sessionid" value="{{ session_id() }}" />
|
||||||
<input type="hidden" name="timestamp" value="{{ date().timestamp }}" />
|
<input type="hidden" name="timestamp" value="{{ date().timestamp }}" />
|
||||||
{% for key,value in conditions %}
|
{% for key,value in conditions %}
|
||||||
|
|
28
templates/yuuno/global/maintenance.twig
Normal file
28
templates/yuuno/global/maintenance.twig
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Service unavailable</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ resource('css/error.css') }}" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="wrap">
|
||||||
|
<h1>
|
||||||
|
<img src="{{ resource('images/404-info.gif') }}" />
|
||||||
|
The page is currently unavailable
|
||||||
|
</h1>
|
||||||
|
<p>
|
||||||
|
The page you are looking for is temporarily unavailable.
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<h2>
|
||||||
|
{{ message }}
|
||||||
|
</h2>
|
||||||
|
<h3>
|
||||||
|
HTTP 503 - Service unavailable
|
||||||
|
<br />
|
||||||
|
Internet Explorer
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -111,13 +111,10 @@
|
||||||
{% if profile is defined ? profile.background : (user.permission(constant('Sakura\\Perms\\Site::CHANGE_BACKGROUND')) and user.optionFields.profileBackgroundSiteWide and user.background) %}
|
{% if profile is defined ? profile.background : (user.permission(constant('Sakura\\Perms\\Site::CHANGE_BACKGROUND')) and user.optionFields.profileBackgroundSiteWide and user.background) %}
|
||||||
<div id="userBackground" style="background-image: url('{{ route('file.background', (profile is defined ? profile : user).id) }}');"></div>
|
<div id="userBackground" style="background-image: url('{{ route('file.background', (profile is defined ? profile : user).id) }}');"></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not user.isActive and sakura.currentPage != route('auth.login') %}
|
{% if not user.isActive and server['REQUEST_URI'] != route('auth.login') %}
|
||||||
<div class="headerLoginContainer">
|
<div class="headerLoginContainer">
|
||||||
<form method="post" action="{{ route('auth.login') }}" id="headerLoginForm">
|
<form method="post" action="{{ route('auth.login') }}" id="headerLoginForm">
|
||||||
<input type="hidden" name="redirect" value="{{ sakura.currentPage }}" />
|
<input type="hidden" name="redirect" value="{{ server['REQUEST_URI'] }}" />
|
||||||
<input type="hidden" name="session" value="{{ session_id() }}" />
|
|
||||||
<input type="hidden" name="time" value="{{ date().timestamp }}" />
|
|
||||||
<input type="hidden" name="mode" value="login" />
|
|
||||||
<div>
|
<div>
|
||||||
<label for="headerLoginUserName">Username:</label>
|
<label for="headerLoginUserName">Username:</label>
|
||||||
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
<input type="text" id="headerLoginUserName" name="username" class="inputStyling" placeholder="Username" />
|
||||||
|
@ -131,12 +128,9 @@
|
||||||
<label for="headerLoginRemember">Remember me</label>
|
<label for="headerLoginRemember">Remember me</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input type="submit" id="headerLoginButton" name="submit" class="inputStyling small" value="Login" />
|
<button class="inputStyling small" name="session" value="{{ session_id() }}"><i class="fa fa-sign-in"></i> Login</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<form method="get" action="{{ route('auth.register') }}">
|
|
||||||
<button class="inputStyling small">Register</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}
|
{% if user.permission(constant('Sakura\\Perms\\Site::RESTRICTED')) %}
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
|
|
||||||
{% set persistentPremium = user.permission(constant('Sakura\\Perms\\Site::STATIC_PREMIUM')) %}
|
{% set persistentPremium = user.permission(constant('Sakura\\Perms\\Site::STATIC_PREMIUM')) %}
|
||||||
|
|
||||||
|
{% set features = {
|
||||||
|
"money": "Helping us pay for the bills to survive",
|
||||||
|
"certificate": "A <span style='font-weight: bold; color: #EE9400'>special</span> name colour to stand out in the crowd",
|
||||||
|
"magic": "The ability to change your username once a month",
|
||||||
|
"pencil": "You can set a custom user title",
|
||||||
|
"lock": "Access to some exclusive forums",
|
||||||
|
"picture-o": "You get the ability to set a profile background"
|
||||||
|
} %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if get.fail %}
|
{% if get.fail %}
|
||||||
<div class="headerNotify">
|
<div class="headerNotify">
|
||||||
|
@ -14,61 +23,28 @@
|
||||||
<div class="content support">
|
<div class="content support">
|
||||||
<div class="head">Support {{ config('sitename') }}</div>
|
<div class="head">Support {{ config('sitename') }}</div>
|
||||||
<div style="font-size: .9em; margin-bottom: 10px;">
|
<div style="font-size: .9em; margin-bottom: 10px;">
|
||||||
<p>In order to keep the site, its services and improvements on it going I need money but I'm not that big of a fan of asking for money without giving anything special in return thus Tenshi exists. Tenshi is the name for our supporter rank which gives you access to an extra set of features (which are listed further down on this page). With your help we can keep adding new stuff, get new hardware and keep the site awesome!</p>
|
<p>To keep the site and everything surrounding it running I need money to pay the bills, however instead of just having a donate button I decided on adding a premium system to the site which gives you a few extras. The premium rank is indentified on the site by Tenshi. More stuff that literally doesn't exist yet will be added to the list of featuring down the line but in order, the stuff that already exist can be seen further down on this page. With your help we can keep adding new stuff, get new hardware and keep the site awesome!</p>
|
||||||
</div>
|
</div>
|
||||||
{% if user.isPremium %}
|
{% if user.isPremium %}
|
||||||
<div class="sectionHeader">
|
<div class="sectionHeader">
|
||||||
Your current Tenshi tag
|
Your current Tenshi tag
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<h3>{% if persistentPremium %}Your rank has persistent Tenshi.{% else %}Your Tenshi tag is valid till {{ user.premiumInfo.expire|date(config('date_format')) }}.{% endif %}</h3>
|
<h3>{% if persistentPremium %}Your rank has persistent Tenshi.{% else %}Your Tenshi tag is valid till {{ user.premiumInfo.expire|date(config('date_format')) }}.{% endif %}</h3>
|
||||||
<progress value="{{ persistentPremium ? 100 : (100 - (((date().timestamp - user.premiumInfo.start) / (user.premiumInfo.expire - user.premiumInfo.start)) * 100)) }}" max="100" style="width: 100%"></progress>
|
<progress value="{{ persistentPremium ? 100 : (100 - (((date().timestamp - user.premiumInfo.start) / (user.premiumInfo.expire - user.premiumInfo.start)) * 100)) }}" max="100" style="width: 100%"></progress>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="sectionHeader">
|
<div class="sectionHeader">
|
||||||
Why should I get Tenshi?
|
Why should I get Tenshi?
|
||||||
</div>
|
</div>
|
||||||
<div class="featureParent">
|
<div class="featureParent">
|
||||||
<div class="featureBox">
|
{% for k,v in features %}
|
||||||
<div class="featureBoxIcon fa fa-money"></div>
|
<div class="featureBox">
|
||||||
<div class="featureBoxDesc">Helping us pay for the bills to survive</div>
|
<div class="featureBoxIcon fa fa-{{ k }}"></div>
|
||||||
<div class="clear"></div>
|
<div class="featureBoxDesc">{{ v|raw }}</div>
|
||||||
</div>
|
<div class="clear"></div>
|
||||||
<div class="featureBox">
|
</div>
|
||||||
<div class="featureBoxIcon fa fa-certificate"></div>
|
{% endfor %}
|
||||||
<div class="featureBoxDesc">A <span style="font-weight: bold; color: #EE9400">special</span> name colour to stand out in the crowd</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-magic"></div>
|
|
||||||
<div class="featureBoxDesc">The ability to change your username once a month</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-pencil"></div>
|
|
||||||
<div class="featureBoxDesc">You can set a custom user title</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-archive"></div>
|
|
||||||
<div class="featureBoxDesc">You'll be able to read the chat logs</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-eye-slash"></div>
|
|
||||||
<div class="featureBoxDesc">You can create temporary channels in the chat</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-users"></div>
|
|
||||||
<div class="featureBoxDesc">You get to create a user group</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox">
|
|
||||||
<div class="featureBoxIcon fa fa-picture-o"></div>
|
|
||||||
<div class="featureBoxDesc">You get the ability to set a profile background</div>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</div>
|
|
||||||
<div class="featureBox final">
|
<div class="featureBox final">
|
||||||
<div class="featureBoxIcon fa fa-heart"></div>
|
<div class="featureBoxIcon fa fa-heart"></div>
|
||||||
<div class="featureBoxIcon right fa fa-heart"></div>
|
<div class="featureBoxIcon right fa fa-heart"></div>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<a href="{{ route('members.rank', rank.id) }}" class="clean">{{ rank.name }}</a>
|
<a href="{{ route('members.rank', rank.id) }}" class="clean">{{ rank.name }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 90px;">
|
<td style="width: 90px;">
|
||||||
<form method="post" action="{{ sakura.currentPage }}">
|
<form method="post" action="{{ route('settings.account.ranks') }}">
|
||||||
<input type="hidden" name="session" value="{{ session_id() }}" />
|
<input type="hidden" name="session" value="{{ session_id() }}" />
|
||||||
<input type="hidden" name="rank" value="{{ rank.id }}" />
|
<input type="hidden" name="rank" value="{{ rank.id }}" />
|
||||||
<button class="inputStyling small" name="mode" value="main">Set as main</button>
|
<button class="inputStyling small" name="mode" value="main">Set as main</button>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for s in sessions %}
|
{% for s in sessions %}
|
||||||
<tr {% if s.session_key == session.sessionId %} class="current-session"{% endif %}>
|
<tr {% if s.session_key == active %} class="current-session"{% endif %}>
|
||||||
<td>
|
<td>
|
||||||
{{ s.user_ip }}
|
{{ s.user_ip }}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -75,6 +75,11 @@ function get_country_name($code)
|
||||||
return 'Anonymous Proxy';
|
return 'Anonymous Proxy';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Catch proxy
|
||||||
|
if (strtolower($code) === 'a2') {
|
||||||
|
return 'Satellite Provider';
|
||||||
|
}
|
||||||
|
|
||||||
return locale_get_display_region("-{$code}", 'en');
|
return locale_get_display_region("-{$code}", 'en');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue