97 lines
3.4 KiB
PHP
97 lines
3.4 KiB
PHP
<?php
|
|
/**
|
|
* Holds the base settings controller.
|
|
* @package Sakura
|
|
*/
|
|
|
|
namespace Sakura\Controllers\Settings;
|
|
|
|
use Sakura\ActiveUser;
|
|
use Sakura\Controllers\Controller as BaseController;
|
|
use Sakura\Perms\Site;
|
|
use Sakura\Router;
|
|
use Sakura\Template;
|
|
|
|
/**
|
|
* Base controller (which other controllers should extend on).
|
|
* @package Sakura
|
|
* @author Julian van de Groep <me@flash.moe>
|
|
*/
|
|
class Controller extends BaseController
|
|
{
|
|
/**
|
|
* Constructor.
|
|
*/
|
|
public function __construct()
|
|
{
|
|
Template::vars(['navigation' => $this->navigation()]);
|
|
}
|
|
|
|
/**
|
|
* Generates the navigation.
|
|
* @return array
|
|
*/
|
|
public function navigation()
|
|
{
|
|
$nav = [];
|
|
|
|
// Account
|
|
if (ActiveUser::$user->permission(Site::ALTER_PROFILE)) {
|
|
$nav["Account"]["Profile"] = Router::route('settings.account.profile');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_EMAIL)) {
|
|
$nav["Account"]["E-mail address"] = Router::route('settings.account.email');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_USERNAME)) {
|
|
$nav["Account"]["Username"] = Router::route('settings.account.username');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_USERTITLE)) {
|
|
$nav["Account"]["Title"] = Router::route('settings.account.title');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_PASSWORD)) {
|
|
$nav["Account"]["Password"] = Router::route('settings.account.password');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::ALTER_RANKS)) {
|
|
$nav["Account"]["Ranks"] = Router::route('settings.account.ranks');
|
|
}
|
|
|
|
// Friends
|
|
if (ActiveUser::$user->permission(Site::MANAGE_FRIENDS)) {
|
|
$nav["Friends"]["Listing"] = Router::route('settings.friends.listing');
|
|
$nav["Friends"]["Requests"] = Router::route('settings.friends.requests');
|
|
}
|
|
|
|
// Notifications
|
|
$nav["Notifications"]["History"] = Router::route('settings.notifications.history');
|
|
|
|
// Appearance
|
|
if (ActiveUser::$user->permission(Site::CHANGE_AVATAR)) {
|
|
$nav["Appearance"]["Avatar"] = Router::route('settings.appearance.avatar');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_BACKGROUND)) {
|
|
$nav["Appearance"]["Background"] = Router::route('settings.appearance.background');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_HEADER)) {
|
|
$nav["Appearance"]["Header"] = Router::route('settings.appearance.header');
|
|
}
|
|
if ((
|
|
ActiveUser::$user->page
|
|
&& ActiveUser::$user->permission(Site::CHANGE_USERPAGE)
|
|
) || ActiveUser::$user->permission(Site::CREATE_USERPAGE)) {
|
|
$nav["Appearance"]["Userpage"] = Router::route('settings.appearance.userpage');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::CHANGE_SIGNATURE)) {
|
|
$nav["Appearance"]["Signature"] = Router::route('settings.appearance.signature');
|
|
}
|
|
|
|
// Advanced
|
|
if (ActiveUser::$user->permission(Site::MANAGE_SESSIONS)) {
|
|
$nav["Advanced"]["Sessions"] = Router::route('settings.advanced.sessions');
|
|
}
|
|
if (ActiveUser::$user->permission(Site::DEACTIVATE_ACCOUNT)) {
|
|
$nav["Advanced"]["Deactivate"] = Router::route('settings.advanced.deactivate');
|
|
}
|
|
|
|
return $nav;
|
|
}
|
|
}
|