2016-03-28 01:18:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Holds the base settings controller.
|
|
|
|
* @package Sakura
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Sakura\Controllers\Settings;
|
|
|
|
|
|
|
|
use Sakura\Controllers\Controller as BaseController;
|
2016-08-07 14:10:27 +00:00
|
|
|
use Sakura\CurrentSession;
|
2016-04-01 21:44:31 +00:00
|
|
|
use Sakura\Template;
|
2016-03-28 01:18:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base controller (which other controllers should extend on).
|
|
|
|
* @package Sakura
|
|
|
|
* @author Julian van de Groep <me@flash.moe>
|
|
|
|
*/
|
|
|
|
class Controller extends BaseController
|
|
|
|
{
|
2016-08-05 02:35:37 +00:00
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*/
|
2016-03-28 01:18:59 +00:00
|
|
|
public function __construct()
|
|
|
|
{
|
2016-08-02 20:35:12 +00:00
|
|
|
Template::vars(['navigation' => $this->navigation()]);
|
2016-03-28 01:18:59 +00:00
|
|
|
}
|
|
|
|
|
2016-08-05 02:35:37 +00:00
|
|
|
/**
|
|
|
|
* Generates the navigation.
|
|
|
|
* @return array
|
|
|
|
*/
|
2016-03-31 20:03:25 +00:00
|
|
|
public function navigation()
|
|
|
|
{
|
|
|
|
$nav = [];
|
|
|
|
|
2016-08-02 20:35:12 +00:00
|
|
|
// Account
|
2016-11-01 21:14:02 +00:00
|
|
|
if (CurrentSession::$user->perms->changeProfile) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Account"]["Profile"] = route('settings.account.profile');
|
2016-08-02 20:35:12 +00:00
|
|
|
}
|
2016-11-01 21:14:02 +00:00
|
|
|
$nav["Account"]["Details"] = route('settings.account.details');
|
|
|
|
if (CurrentSession::$user->perms->manageRanks) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Account"]["Ranks"] = route('settings.account.ranks');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
2016-11-01 21:14:02 +00:00
|
|
|
if (CurrentSession::$user->perms->changeUserpage) {
|
2016-09-16 20:18:59 +00:00
|
|
|
$nav["Account"]["Userpage"] = route('settings.account.userpage');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
2016-11-01 21:14:02 +00:00
|
|
|
if (CurrentSession::$user->perms->changeSignature) {
|
2016-09-16 20:18:59 +00:00
|
|
|
$nav["Account"]["Signature"] = route('settings.account.signature');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Friends
|
2016-11-01 21:14:02 +00:00
|
|
|
if (CurrentSession::$user->perms->manageFriends) {
|
2016-09-16 20:18:59 +00:00
|
|
|
$nav["Friends"]["Listing"] = route('settings.friends.listing');
|
|
|
|
$nav["Friends"]["Requests"] = route('settings.friends.requests');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Advanced
|
2016-11-01 21:14:02 +00:00
|
|
|
$nav["Advanced"]["Sessions"] = route('settings.advanced.sessions');
|
|
|
|
if (CurrentSession::$user->perms->deactivateAccount) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Advanced"]["Deactivate"] = route('settings.advanced.deactivate');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return $nav;
|
|
|
|
}
|
2016-03-28 01:18:59 +00:00
|
|
|
}
|