1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @category Module |
14
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
15
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
16
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
use Xmf\Request; |
|
|
|
|
20
|
|
|
use XoopsModules\Suico\{ |
21
|
|
|
FriendsController |
22
|
|
|
}; |
23
|
|
|
|
24
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'suico_fans.tpl'; |
25
|
|
|
require __DIR__ . '/header.php'; |
26
|
|
|
$controller = new FriendsController($xoopsDB, $xoopsUser); |
27
|
|
|
$start = Request::getInt('start', 0, 'GET'); |
28
|
|
|
/** |
29
|
|
|
* Fetching numbers of groups friends videos pictures etc... |
30
|
|
|
*/ |
31
|
|
|
$nbSections = $controller->getNumbersSections(); |
32
|
|
|
/** |
33
|
|
|
* Friends |
34
|
|
|
*/ |
35
|
|
|
$criteria_friends = new Criteria('friend2_uid', $controller->uidOwner); |
36
|
|
|
$criteria_fans = new Criteria('fan', 1); |
37
|
|
|
$criteria_compo_fans = new CriteriaCompo($criteria_friends); |
38
|
|
|
$criteria_compo_fans->add($criteria_fans); |
39
|
|
|
$countFriends = $controller->friendshipsFactory->getCount($criteria_compo_fans); |
40
|
|
|
$criteria_compo_fans->setLimit($helper->getConfig('friendsperpage')); |
41
|
|
|
$criteria_compo_fans->setStart($start); |
42
|
|
|
$vetor = $controller->friendshipsFactory->getFans('', $criteria_compo_fans, 0); |
43
|
|
|
if (0 === $countFriends) { |
44
|
|
|
$xoopsTpl->assign('lang_nofansyet', _MD_SUICO_NOFANSYET); |
45
|
|
|
} |
46
|
|
|
/** |
47
|
|
|
* Let's get the user name of the owner of the album |
48
|
|
|
*/ |
49
|
|
|
$owner = new \XoopsUser(); |
50
|
|
|
$identifier = $owner::getUnameFromId($controller->uidOwner); |
51
|
|
|
/** |
52
|
|
|
* Creating the navigation bar if you have a lot of friends |
53
|
|
|
*/ |
54
|
|
|
$navigationBar = new \XoopsPageNav( |
55
|
|
|
$countFriends, |
56
|
|
|
$helper->getConfig('friendsperpage'), |
57
|
|
|
$start, |
58
|
|
|
'start', |
59
|
|
|
'uid=' . (int)$controller->uidOwner |
60
|
|
|
); |
61
|
|
|
$navegacao = $navigationBar->renderImageNav(2); |
62
|
|
|
//navbar |
63
|
|
|
$xoopsTpl->assign('lang_mysection', _MD_SUICO_MYFANS); |
64
|
|
|
$xoopsTpl->assign('section_name', _MD_SUICO_FANS); |
65
|
|
|
//Navigation Bar |
66
|
|
|
$xoopsTpl->assign('navegacao', $navegacao); |
67
|
|
|
$xoopsTpl->assign('lang_fanstitle', sprintf(_MD_SUICO_FANSTITLE, $identifier)); |
68
|
|
|
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload')); |
69
|
|
|
$xoopsTpl->assign('friends', $vetor); |
70
|
|
|
$xoopsTpl->assign('lang_delete', _MD_SUICO_DELETE); |
71
|
|
|
$xoopsTpl->assign('lang_evaluate', _MD_SUICO_FRIENDSHIP_CONFIGS); |
72
|
|
|
require __DIR__ . '/footer.php'; |
73
|
|
|
require \dirname(__DIR__, 2) . '/footer.php'; |
74
|
|
|
|
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: