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-03-31 20:03:25 +00:00
|
|
|
use Sakura\Perms\Site;
|
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-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::ALTER_PROFILE)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Account"]["Profile"] = route('settings.account.profile');
|
2016-08-02 20:35:12 +00:00
|
|
|
}
|
2016-09-08 21:32:33 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::CHANGE_EMAIL)
|
|
|
|
|| CurrentSession::$user->permission(Site::CHANGE_USERNAME)
|
|
|
|
|| CurrentSession::$user->permission(Site::CHANGE_USERTITLE)
|
|
|
|
|| CurrentSession::$user->permission(Site::CHANGE_PASSWORD)) {
|
|
|
|
$nav["Account"]["Details"] = route('settings.account.details');
|
2016-08-02 20:35:12 +00:00
|
|
|
}
|
2016-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::ALTER_RANKS)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Account"]["Ranks"] = route('settings.account.ranks');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Friends
|
2016-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::MANAGE_FRIENDS)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Friends"]["Listing"] = route('settings.friends.listing');
|
|
|
|
$nav["Friends"]["Requests"] = route('settings.friends.requests');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Appearance
|
|
|
|
if ((
|
2016-08-07 14:10:27 +00:00
|
|
|
CurrentSession::$user->page
|
|
|
|
&& CurrentSession::$user->permission(Site::CHANGE_USERPAGE)
|
|
|
|
) || CurrentSession::$user->permission(Site::CREATE_USERPAGE)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Appearance"]["Userpage"] = route('settings.appearance.userpage');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
2016-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::CHANGE_SIGNATURE)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Appearance"]["Signature"] = route('settings.appearance.signature');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Advanced
|
2016-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::MANAGE_SESSIONS)) {
|
2016-09-08 21:32:33 +00:00
|
|
|
$nav["Advanced"]["Sessions"] = route('settings.advanced.sessions');
|
2016-03-31 20:03:25 +00:00
|
|
|
}
|
2016-08-07 14:10:27 +00:00
|
|
|
if (CurrentSession::$user->permission(Site::DEACTIVATE_ACCOUNT)) {
|
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
|
|
|
}
|