2016-03-28 01:18:59 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Holds the friends section controller.
|
|
|
|
* @package Sakura
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Sakura\Controllers\Settings;
|
|
|
|
|
2016-08-07 14:10:27 +00:00
|
|
|
use Sakura\CurrentSession;
|
2016-04-03 21:29:46 +00:00
|
|
|
use Sakura\Perms\Site;
|
2016-04-01 21:44:31 +00:00
|
|
|
|
2016-03-28 01:18:59 +00:00
|
|
|
/**
|
|
|
|
* Friends settings.
|
|
|
|
* @package Sakura
|
|
|
|
* @author Julian van de Groep <me@flash.moe>
|
|
|
|
*/
|
|
|
|
class FriendsController extends Controller
|
|
|
|
{
|
2016-08-05 02:35:37 +00:00
|
|
|
/**
|
|
|
|
* Gets friends listing
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-03-28 01:18:59 +00:00
|
|
|
public function listing()
|
|
|
|
{
|
2016-04-03 21:29:46 +00:00
|
|
|
// Check permission
|
2016-08-07 14:10:27 +00:00
|
|
|
if (!CurrentSession::$user->permission(Site::MANAGE_FRIENDS)) {
|
2016-04-03 21:29:46 +00:00
|
|
|
$message = "You aren't allowed to manage friends.";
|
2016-08-02 20:35:12 +00:00
|
|
|
$redirect = route('settings.index');
|
|
|
|
return view('global/information', compact('message', 'redirect'));
|
2016-04-03 21:29:46 +00:00
|
|
|
}
|
|
|
|
|
2016-08-02 20:35:12 +00:00
|
|
|
return view('settings/friends/listing');
|
2016-03-28 01:18:59 +00:00
|
|
|
}
|
|
|
|
|
2016-08-05 02:35:37 +00:00
|
|
|
/**
|
|
|
|
* Gets friend requests listing
|
|
|
|
* @return string
|
|
|
|
*/
|
2016-03-28 01:18:59 +00:00
|
|
|
public function requests()
|
|
|
|
{
|
2016-04-03 21:29:46 +00:00
|
|
|
// Check permission
|
2016-08-07 14:10:27 +00:00
|
|
|
if (!CurrentSession::$user->permission(Site::MANAGE_FRIENDS)) {
|
2016-04-03 21:29:46 +00:00
|
|
|
$message = "You aren't allowed to manage friends.";
|
2016-08-02 20:35:12 +00:00
|
|
|
$redirect = route('settings.index');
|
|
|
|
return view('global/information', compact('message', 'redirect'));
|
2016-04-03 21:29:46 +00:00
|
|
|
}
|
|
|
|
|
2016-08-02 20:35:12 +00:00
|
|
|
return view('settings/friends/requests');
|
2016-03-28 01:18:59 +00:00
|
|
|
}
|
|
|
|
}
|