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 Xmf\Request; |
||
23 | use XoopsModules\Suico; |
||
24 | |||
25 | $GLOBALS['xoopsOption']['template_main'] = 'suico_friends.tpl'; |
||
26 | require __DIR__ . '/header.php'; |
||
27 | $controller = new Suico\FriendsController($xoopsDB, $xoopsUser); |
||
28 | /** |
||
29 | * Fetching numbers of groups friends videos pictures etc... |
||
30 | */ |
||
31 | $nbSections = $controller->getNumbersSections(); |
||
32 | $start = Request::getInt('start', 0, 'GET'); |
||
33 | /** |
||
34 | * Filter for new friend friendrequest |
||
35 | */ |
||
36 | $friendrequest = 0; |
||
37 | if (1 === $controller->isOwner) { |
||
38 | $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $controller->uidOwner); |
||
39 | $newFriendrequest = $controller->friendrequestFactory->getObjects($criteria_uidfriendrequest); |
||
40 | if ($newFriendrequest) { |
||
41 | $countFriendrequest = count($newFriendrequest); |
||
42 | $friendrequesterHandler = xoops_getHandler('member'); |
||
43 | $friendrequester = $friendrequesterHandler->getUser($newFriendrequest[0]->getVar('friendrequester_uid')); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
44 | $friendrequester_uid = $friendrequester->getVar('uid'); |
||
45 | $friendrequester_uname = $friendrequester->getVar('uname'); |
||
46 | $friendrequester_avatar = $friendrequester->getVar('user_avatar'); |
||
47 | $friendrequest_id = $newFriendrequest[0]->getVar('friendreq_id'); |
||
48 | $friendrequest = 1; |
||
49 | } |
||
50 | } |
||
51 | /** |
||
52 | * Friends |
||
53 | */ |
||
54 | $criteria_friends = new Criteria('friend1_uid', (int)$controller->uidOwner); |
||
55 | $countFriends = $controller->friendshipsFactory->getCount($criteria_friends); |
||
56 | $criteria_friends->setLimit($helper->getConfig('friendsperpage')); |
||
57 | $criteria_friends->setStart($start); |
||
58 | $vetor = $controller->friendshipsFactory->getFriends('', $criteria_friends, 0); |
||
59 | if (0 === $countFriends) { |
||
60 | $xoopsTpl->assign('lang_nofriendsyet', _MD_SUICO_NOFRIENDSYET); |
||
61 | } |
||
62 | /** |
||
63 | * Let's get the user name of the owner of the album |
||
64 | */ |
||
65 | $owner = new XoopsUser(); |
||
66 | $identifier = $owner::getUnameFromId($controller->uidOwner); |
||
67 | /** |
||
68 | * Creating the navigation bar if you have a lot of friends |
||
69 | */ |
||
70 | $navigationBar = new XoopsPageNav( |
||
71 | $nbSections['countFriends'], $helper->getConfig('friendsperpage'), $start, 'start', 'uid=' . (int)$controller->uidOwner |
||
72 | ); |
||
73 | $navegacao = $navigationBar->renderImageNav(2); |
||
74 | //requests to become friend |
||
75 | if (1 === $friendrequest) { |
||
76 | $xoopsTpl->assign('lang_you_have_x_friendrequests', sprintf(_MD_SUICO_YOU_HAVE_X_FRIENDREQUESTS, $countFriendrequest)); |
||
77 | $xoopsTpl->assign('friendrequester_uid', $friendrequester_uid); |
||
78 | $xoopsTpl->assign('friendrequester_uname', $friendrequester_uname); |
||
79 | $xoopsTpl->assign('friendrequester_avatar', $friendrequester_avatar); |
||
80 | $xoopsTpl->assign('friendrequest', $friendrequest); |
||
81 | $xoopsTpl->assign('friendrequest_id', $friendrequest_id); |
||
82 | $xoopsTpl->assign('lang_rejected', _MD_SUICO_UNKNOWN_REJECTING); |
||
83 | $xoopsTpl->assign('lang_accepted', _MD_SUICO_UNKNOWN_ACCEPTING); |
||
84 | $xoopsTpl->assign('lang_acquaintance', _MD_SUICO_AQUAITANCE); |
||
85 | $xoopsTpl->assign('lang_friend', _MD_SUICO_FRIEND); |
||
86 | $xoopsTpl->assign('lang_bestfriend', _MD_SUICO_BESTFRIEND); |
||
87 | $linkedpetioner = '<a href="index.php?uid=' . $friendrequester_uid . '">' . $friendrequester_uname . '</a>'; |
||
88 | $xoopsTpl->assign('lang_askingfriend', sprintf(_MD_SUICO_ASKINGFRIEND, $linkedpetioner)); |
||
89 | } |
||
90 | $xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND); |
||
91 | $xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND); |
||
92 | $xoopsTpl->assign('lang_friendrequestpending', _MD_SUICO_FRIENDREQUEST_PENDING); |
||
93 | $xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND); |
||
94 | $xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT); |
||
95 | $xoopsTpl->assign('lang_acceptfriend', _MD_SUICO_FRIEND_ACCEPT); |
||
96 | $xoopsTpl->assign('lang_rejectfriend', _MD_SUICO_FRIEND_REJECT); |
||
97 | $xoopsTpl->assign('lang_deletefriend', _MD_SUICO_FRIENDSHIP_DELETE); |
||
98 | $xoopsTpl->assign('lang_friendshipsettings', _MD_SUICO_FRIENDSHIP_SETTINGS); |
||
99 | //navbar |
||
100 | $xoopsTpl->assign('module_name', $xoopsModule->getVar('name')); |
||
101 | $xoopsTpl->assign('lang_mysection', _MD_SUICO_MYFRIENDS); |
||
102 | $xoopsTpl->assign('lang_friendstitle', sprintf(_MD_SUICO_FRIENDSTITLE, $identifier)); |
||
103 | //$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload')); |
||
104 | $xoopsTpl->assign('friends', $vetor); |
||
105 | $xoopsTpl->assign('lang_delete', _MD_SUICO_DELETE); |
||
106 | $xoopsTpl->assign('lang_evaluate', _MD_SUICO_FRIENDSHIP_CONFIGS); |
||
107 | $xoopsTpl->assign('allow_friendshiplevel', $helper->getConfig('allow_friendshiplevel')); |
||
108 | $xoopsTpl->assign('allow_fanssevaluation', $helper->getConfig('allow_fanssevaluation')); |
||
109 | // Navigation |
||
110 | $xoopsTpl->assign('navegacao', $navegacao); |
||
111 | require __DIR__ . '/footer.php'; |
||
112 | require dirname(__DIR__, 2) . '/footer.php'; |
||
113 |