1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Suico; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
use Criteria; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @category Module |
19
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
20
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
21
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
22
|
|
|
*/ |
23
|
|
|
require_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
24
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
25
|
|
|
require_once XOOPS_ROOT_PATH . '/class/criteria.php'; |
26
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class FriendsController |
30
|
|
|
*/ |
31
|
|
|
class FriendsController extends Controller |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @return bool|void |
35
|
|
|
*/ |
36
|
|
|
public function checkPrivilege() |
37
|
|
|
{ |
38
|
|
|
if (0 === $this->helper->getConfig('enable_friends')) { |
39
|
|
|
\redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 3, \_MD_SUICO_FRIENDS_ENABLED_NOT); |
40
|
|
|
} |
41
|
|
|
$criteria = new Criteria('config_uid', $this->owner->getVar('uid')); |
|
|
|
|
42
|
|
|
if (1 === $this->configsFactory->getCount($criteria)) { |
43
|
|
|
$configs = $this->configsFactory->getObjects($criteria); |
44
|
|
|
$config = $configs[0]->getVar('friends'); |
|
|
|
|
45
|
|
|
/* |
46
|
|
|
if (!$this->checkPrivilegeLevel($config)) { |
47
|
|
|
//mb temporary fix for self-loop |
48
|
|
|
// \redirect_header('index.php?uid=' . $this->owner->getVar('uid'), 10, sprintf(_MD_SUICO_NOPRIVILEGE,'Friends')); |
49
|
|
|
redirect_header('/', 10, sprintf(_MD_SUICO_NOPRIVILEGE,'Friends')); |
50
|
|
|
} |
51
|
|
|
*/ |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
return true; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|