1 | <?php declare(strict_types=1); |
||
2 | |||
3 | /* |
||
4 | You may not change or alter any portion of this comment or credits |
||
5 | of supporting developers from this source code or any supporting source code |
||
6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
7 | |||
8 | This program is distributed in the hope that it will be useful, |
||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
11 | */ |
||
12 | |||
13 | /** |
||
14 | * @copyright XOOPS Project https://xoops.org/ |
||
15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
16 | * @author Marcello Brandão aka Suico |
||
17 | * @author XOOPS Development Team |
||
18 | * @since |
||
19 | */ |
||
20 | |||
21 | use Xmf\Request; |
||
22 | use XoopsModules\Yogurt; |
||
23 | |||
24 | $GLOBALS['xoopsOption']['template_main'] = 'yogurt_friends.tpl'; |
||
25 | require __DIR__ . '/header.php'; |
||
26 | |||
27 | $controller = new Yogurt\FriendsController($xoopsDB, $xoopsUser); |
||
28 | |||
29 | /** |
||
30 | * Fetching numbers of groups friends videos pictures etc... |
||
31 | */ |
||
32 | $nbSections = $controller->getNumbersSections(); |
||
33 | |||
34 | $start = Request::getInt('start', 0, 'GET'); |
||
35 | |||
36 | /** |
||
37 | * Filter for new friend friendrequest |
||
38 | */ |
||
39 | $friendrequest = 0; |
||
40 | if (1 === $controller->isOwner) { |
||
41 | $criteria_uidfriendrequest = new Criteria('friendrequestto_uid', $controller->uidOwner); |
||
42 | $newFriendrequest = $controller->friendrequestFactory->getObjects($criteria_uidfriendrequest); |
||
43 | if ($newFriendrequest) { |
||
44 | $countFriendrequest = count($newFriendrequest); |
||
45 | $friendrequesterHandler = xoops_getHandler('member'); |
||
46 | $friendrequester = $friendrequesterHandler->getUser($newFriendrequest[0]->getVar('friendrequester_uid')); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
47 | $friendrequester_uid = $friendrequester->getVar('uid'); |
||
48 | $friendrequester_uname = $friendrequester->getVar('uname'); |
||
49 | $friendrequester_avatar = $friendrequester->getVar('user_avatar'); |
||
50 | $friendrequest_id = $newFriendrequest[0]->getVar('friendreq_id'); |
||
51 | $friendrequest = 1; |
||
52 | } |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Friends |
||
57 | */ |
||
58 | $criteria_friends = new Criteria('friend1_uid', (int)$controller->uidOwner); |
||
59 | $countFriends = $controller->friendshipsFactory->getCount($criteria_friends); |
||
60 | $criteria_friends->setLimit($helper->getConfig('friendsperpage')); |
||
61 | $criteria_friends->setStart($start); |
||
62 | $vetor = $controller->friendshipsFactory->getFriends('', $criteria_friends, 0); |
||
63 | if (0 === $countFriends) { |
||
64 | $xoopsTpl->assign('lang_nofriendsyet', _MD_YOGURT_NOFRIENDSYET); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Let's get the user name of the owner of the album |
||
69 | */ |
||
70 | $owner = new XoopsUser(); |
||
71 | $identifier = $owner::getUnameFromId($controller->uidOwner); |
||
72 | |||
73 | /** |
||
74 | * Creating the navigation bar if you have a lot of friends |
||
75 | */ |
||
76 | $navigationBar = new XoopsPageNav( |
||
77 | $nbSections['nbFriends'], $helper->getConfig('friendsperpage'), $start, 'start', 'uid=' . (int)$controller->uidOwner |
||
78 | ); |
||
79 | $navegacao = $navigationBar->renderImageNav(2); |
||
80 | |||
81 | //requests to become friend |
||
82 | if (1 === $friendrequest) { |
||
83 | $xoopsTpl->assign('lang_youhavexfriendrequests', sprintf(_MD_YOGURT_YOUHAVEXFRIENDREQUESTS, $countFriendrequest)); |
||
84 | $xoopsTpl->assign('friendrequester_uid', $friendrequester_uid); |
||
85 | $xoopsTpl->assign('friendrequester_uname', $friendrequester_uname); |
||
86 | $xoopsTpl->assign('friendrequester_avatar', $friendrequester_avatar); |
||
87 | $xoopsTpl->assign('friendrequest', $friendrequest); |
||
88 | $xoopsTpl->assign('friendrequest_id', $friendrequest_id); |
||
89 | $xoopsTpl->assign('lang_rejected', _MD_YOGURT_UNKNOWN_REJECTING); |
||
90 | $xoopsTpl->assign('lang_accepted', _MD_YOGURT_UNKNOWN_ACCEPTING); |
||
91 | $xoopsTpl->assign('lang_acquaintance', _MD_YOGURT_AQUAITANCE); |
||
92 | $xoopsTpl->assign('lang_friend', _MD_YOGURT_FRIEND); |
||
93 | $xoopsTpl->assign('lang_bestfriend', _MD_YOGURT_BESTFRIEND); |
||
94 | $linkedpetioner = '<a href="index.php?uid=' . $friendrequester_uid . '">' . $friendrequester_uname . '</a>'; |
||
95 | $xoopsTpl->assign('lang_askingfriend', sprintf(_MD_YOGURT_ASKINGFRIEND, $linkedpetioner)); |
||
96 | } |
||
97 | $xoopsTpl->assign('lang_askusertobefriend', _MD_YOGURT_ASKBEFRIEND); |
||
98 | $xoopsTpl->assign('lang_addfriend', _MD_YOGURT_ADDFRIEND); |
||
99 | $xoopsTpl->assign('lang_friendrequestpending', _MD_YOGURT_FRIENDREQUEST_PENDING); |
||
100 | $xoopsTpl->assign('lang_myfriend', _MD_YOGURT_MYFRIEND); |
||
101 | $xoopsTpl->assign('lang_friendrequestsent', _MD_YOGURT_FRIENDREQUEST_SENT); |
||
102 | $xoopsTpl->assign('lang_acceptfriend', _MD_YOGURT_FRIEND_ACCEPT); |
||
103 | $xoopsTpl->assign('lang_rejectfriend', _MD_YOGURT_FRIEND_REJECT); |
||
104 | $xoopsTpl->assign('lang_deletefriend', _MD_YOGURT_FRIENDSHIP_DELETE); |
||
105 | $xoopsTpl->assign('lang_friendshipsettings', _MD_YOGURT_FRIENDSHIP_SETTINGS); |
||
106 | |||
107 | //navbar |
||
108 | $xoopsTpl->assign('module_name', $xoopsModule->getVar('name')); |
||
109 | $xoopsTpl->assign('lang_mysection', _MD_YOGURT_MYFRIENDS); |
||
110 | $xoopsTpl->assign('lang_friendstitle', sprintf(_MD_YOGURT_FRIENDSTITLE, $identifier)); |
||
111 | //$xoopsTpl->assign('path_yogurt_uploads',$helper->getConfig('link_path_upload')); |
||
112 | |||
113 | $xoopsTpl->assign('friends', $vetor); |
||
114 | |||
115 | $xoopsTpl->assign('lang_delete', _MD_YOGURT_DELETE); |
||
116 | $xoopsTpl->assign('lang_evaluate', _MD_YOGURT_FRIENDSHIP_CONFIGS); |
||
117 | $xoopsTpl->assign('allow_friendshiplevel', $helper->getConfig('allow_friendshiplevel')); |
||
118 | $xoopsTpl->assign('allow_fanssevaluation', $helper->getConfig('allow_fanssevaluation')); |
||
119 | |||
120 | // Navigation |
||
121 | $xoopsTpl->assign('navegacao', $navegacao); |
||
122 | |||
123 | require __DIR__ . '/footer.php'; |
||
124 | require dirname(__DIR__, 2) . '/footer.php'; |
||
125 |