1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
/* |
5
|
|
|
You may not change or alter any portion of this comment or credits |
6
|
|
|
of supporting developers from this source code or any supporting source code |
7
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
|
9
|
|
|
This program is distributed in the hope that it will be useful, |
10
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @category Module |
16
|
|
|
* @package suico |
17
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
18
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
19
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
use XoopsModules\Suico\{ |
23
|
|
|
Helper |
24
|
|
|
}; |
25
|
|
|
/** @var Helper $helper */ |
26
|
|
|
|
27
|
|
|
if (!defined('XOOPS_ROOT_PATH')) { |
28
|
|
|
exit(); |
29
|
|
|
} |
30
|
|
|
//include_once(XOOPS_ROOT_PATH."/class/criteria.php"); |
31
|
|
|
//require_once XOOPS_ROOT_PATH . '/modules/suico/class/Friendship.php'; |
32
|
|
|
/** |
33
|
|
|
* @param $options |
34
|
|
|
* @return array |
35
|
|
|
*/ |
36
|
|
|
function b_suico_friends_show($options) |
37
|
|
|
{ |
38
|
|
|
global $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsUser; |
39
|
|
|
|
40
|
|
|
/** @var Helper $helper */ |
41
|
|
|
if (!class_exists(Helper::class)) { |
42
|
|
|
return false; |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$helper = Helper::getInstance(); |
46
|
|
|
$helper->loadLanguage('main'); |
47
|
|
|
|
48
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
49
|
|
|
$block = []; |
50
|
|
|
if ($xoopsUser) { |
51
|
|
|
/** |
52
|
|
|
* Filter for fetch votes ishot and isnothot |
53
|
|
|
*/ |
54
|
|
|
$criteria2 = new Criteria( |
55
|
|
|
'friend1_uid', $xoopsUser->getVar( |
56
|
|
|
'uid' |
57
|
|
|
) |
58
|
|
|
); |
59
|
|
|
/** |
60
|
|
|
* Creating factories of pictures and votes |
61
|
|
|
*/ |
62
|
|
|
//$albumFactory = new ImagesHandler($xoopsDB); |
63
|
|
|
$friendsFactory = new \XoopsModules\Suico\FriendshipHandler($xoopsDB); |
64
|
|
|
$block['friends'] = $friendsFactory->getFriends($options[0], $criteria2); |
65
|
|
|
$block['lang_allfriends'] = _MB_SUICO_ALLFRIENDS; |
66
|
|
|
$block['lang_nofriends'] = _MB_SUICO_NOFRIENDSYET; |
67
|
|
|
$block['enablepm'] = $options[1] ?? ''; |
68
|
|
|
return $block; |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param array $options |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
function b_suico_friends_edit($options) |
77
|
|
|
{ |
78
|
|
|
$form .= _MB_SUICO_TOTALFRIENDSTOSHOW . ' '; |
|
|
|
|
79
|
|
|
$form .= "<input type='text' name='options[0]' value='" . $options[0] . "'><br>"; |
80
|
|
|
$form .= _MB_SUICO_ENABLEPM . ' '; |
81
|
|
|
if (isset($options[1]) && 1 === $options[1]) { |
82
|
|
|
$chk = ' checked'; |
83
|
|
|
} |
84
|
|
|
$form .= "<input type='radio' name='options[1]' value='1'" . $chk . '> ' . _YES . ''; |
|
|
|
|
85
|
|
|
$chk = ''; |
86
|
|
|
if (!isset($options[1]) || 0 === $options[1]) { |
87
|
|
|
$chk = ' checked'; |
88
|
|
|
} |
89
|
|
|
$form .= " <input type='radio' name='options[1]' value='0'" . $chk . '>' . _NO . '<br>'; |
90
|
|
|
return $form; |
91
|
|
|
} |
92
|
|
|
|