|
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
|
|
|
GroupController |
|
22
|
|
|
}; |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'suico_group.tpl'; |
|
26
|
|
|
require __DIR__ . '/header.php'; |
|
27
|
|
|
$helper->loadLanguage('main'); |
|
28
|
|
|
$controller = new GroupController($xoopsDB, $xoopsUser); |
|
29
|
|
|
/** |
|
30
|
|
|
* Fetching numbers of groups friends videos pictures etc... |
|
31
|
|
|
*/ |
|
32
|
|
|
$nbSections = $controller->getNumbersSections(); |
|
33
|
|
|
$group_id = Request::getInt('group_id', 0, 'GET'); |
|
34
|
|
|
$criteria = new Criteria('group_id', $group_id); |
|
35
|
|
|
$groups = $controller->groupsFactory->getObjects($criteria); |
|
36
|
|
|
$group = $groups[0]; |
|
37
|
|
|
/** |
|
38
|
|
|
* Fetching rel_id |
|
39
|
|
|
*/ |
|
40
|
|
|
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('suico_relgroupuser') . ' WHERE rel_group_id=' . $group_id . ' AND rel_user_uid=' . $controller->uidOwner . ''; |
|
41
|
|
|
$result = $GLOBALS['xoopsDB']->query($sql); |
|
42
|
|
|
$myrow = $GLOBALS['xoopsDB']->fetchArray($result); |
|
43
|
|
|
$mygroup['rel_id'] = $myrow['rel_id']; |
|
44
|
|
|
$xoopsTpl->assign('group_rel_id', $mygroup['rel_id']); |
|
45
|
|
|
/** |
|
46
|
|
|
* Render a form with the info of the user |
|
47
|
|
|
*/ |
|
48
|
|
|
$group_members = $controller->relgroupusersFactory->getUsersFromGroup( |
|
49
|
|
|
$group_id, |
|
50
|
|
|
0, |
|
51
|
|
|
50 |
|
52
|
|
|
); |
|
53
|
|
|
if (!empty($uids)) { |
|
54
|
|
|
if ($xoopsUser) { |
|
55
|
|
|
$uid = (int)$xoopsUser->getVar('uid'); |
|
56
|
|
|
if (in_array($uid, $uids, true)) { |
|
57
|
|
|
$xoopsTpl->assign('memberOfGroup', 1); |
|
58
|
|
|
} |
|
59
|
|
|
$xoopsTpl->assign('useruid', $uid); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
/** |
|
63
|
|
|
* Get Total Members for Group */ |
|
64
|
|
|
$group_total_members = $controller->groupsFactory->getGroupTotalMembers($group_id); |
|
65
|
|
|
if ($group_total_members > 0) { |
|
66
|
|
|
if (1 == $group_total_members) { |
|
67
|
|
|
$xoopsTpl->assign('group_total_members', '' . _MD_SUICO_ONEMEMBER . ' '); |
|
68
|
|
|
} else { |
|
69
|
|
|
$xoopsTpl->assign('group_total_members', '' . $group_total_members . ' ' . _MD_SUICO_GROUPMEMBERS . ' '); |
|
70
|
|
|
} |
|
71
|
|
|
} else { |
|
72
|
|
|
$xoopsTpl->assign('group_total_members', '' . _MD_SUICO_NO_MEMBER . ' '); |
|
73
|
|
|
} |
|
74
|
|
|
/** |
|
75
|
|
|
* Get Total Comment for Group */ |
|
76
|
|
|
$group_total_comments = $controller->groupsFactory->getComment($group_id); |
|
77
|
|
|
if ($group_total_comments > 0) { |
|
78
|
|
|
if (1 == $group_total_comments) { |
|
79
|
|
|
$xoopsTpl->assign('group_total_comments', '' . _MD_SUICO_ONECOMMENT . ' '); |
|
80
|
|
|
} else { |
|
81
|
|
|
$xoopsTpl->assign('group_total_comments', '' . $group_total_comments . ' ' . _MD_SUICO_COMMENTS . ' '); |
|
82
|
|
|
} |
|
83
|
|
|
} else { |
|
84
|
|
|
$xoopsTpl->assign('group_total_comments', '' . _MD_SUICO_NO_COMMENTS . ' '); |
|
85
|
|
|
} |
|
86
|
|
|
$owner_uid = $group->getVar('owner_uid'); |
|
87
|
|
|
$group_ownername = XoopsUser::getUnameFromId($owner_uid); |
|
88
|
|
|
$xoopsTpl->assign('group_members', $group_members); |
|
89
|
|
|
$maxfilebytes = $helper->getConfig('maxfilesize'); |
|
90
|
|
|
$xoopsTpl->assign('lang_savegroup', _MD_SUICO_UPLOADGROUP); |
|
91
|
|
|
$xoopsTpl->assign('maxfilesize', $maxfilebytes); |
|
92
|
|
|
$xoopsTpl->assign('group_title', $group->getVar('group_title')); |
|
93
|
|
|
$xoopsTpl->assign('group_desc', $group->getVar('group_desc')); |
|
94
|
|
|
$xoopsTpl->assign('group_img', $group->getVar('group_img')); |
|
95
|
|
|
$xoopsTpl->assign('group_id', $group->getVar('group_id')); |
|
96
|
|
|
$xoopsTpl->assign('group_date_created', formatTimestamp($group->getVar('date_created'))); |
|
97
|
|
|
$xoopsTpl->assign('group_date_updated', formatTimestamp($group->getVar('date_updated'))); |
|
98
|
|
|
$xoopsTpl->assign('group_owneruid', $group->getVar('owner_uid')); |
|
99
|
|
|
$xoopsTpl->assign('group_ownername', $group_ownername); |
|
100
|
|
|
$xoopsTpl->assign('lang_groupmembers', _MD_SUICO_GROUPMEMBERS); |
|
101
|
|
|
$xoopsTpl->assign('lang_membersofgroup', _MD_SUICO_MEMBERSOFGROUP); |
|
102
|
|
|
$xoopsTpl->assign('lang_editgroup', _MD_SUICO_EDIT_GROUP); |
|
103
|
|
|
$xoopsTpl->assign('lang_groupimage', _MD_SUICO_GROUP_IMAGE); |
|
104
|
|
|
$xoopsTpl->assign('lang_keepimage', _MD_SUICO_MAINTAIN_OLD_IMAGE); |
|
105
|
|
|
$xoopsTpl->assign('lang_youcanupload', sprintf(_MD_SUICO_YOU_CAN_UPLOAD, $maxfilebytes / 1024)); |
|
106
|
|
|
$xoopsTpl->assign('lang_titlegroup', _MD_SUICO_GROUP_TITLE); |
|
107
|
|
|
$xoopsTpl->assign('lang_descgroup', _MD_SUICO_GROUP_DESC); |
|
108
|
|
|
$xoopsTpl->assign('lang_abandongroup', _MD_SUICO_GROUP_ABANDON); |
|
109
|
|
|
$xoopsTpl->assign('lang_joingroup', _MD_SUICO_GROUP_JOIN); |
|
110
|
|
|
$xoopsTpl->assign('lang_ownerofgroup', _MD_SUICO_OWNEROFGROUP); |
|
111
|
|
|
$xoopsTpl->assign('lang_removemember', _MD_SUICO_KICKOUT); |
|
112
|
|
|
//$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload')); |
|
113
|
|
|
$xoopsTpl->assign( |
|
114
|
|
|
'lang_owner', |
|
115
|
|
|
_MD_SUICO_GROUPOWNER |
|
116
|
|
|
); |
|
117
|
|
|
$xoopsTpl->assign('lang_mysection', _MD_SUICO_GROUPS . ' :: ' . $group->getVar('group_title')); |
|
118
|
|
|
$xoopsTpl->assign('section_name', _MD_SUICO_GROUPS . '> ' . $group->getVar('group_title')); |
|
119
|
|
|
require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
|
120
|
|
|
require __DIR__ . '/footer.php'; |
|
121
|
|
|
require \dirname(__DIR__, 2) . '/footer.php'; |
|
122
|
|
|
|
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare 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.phpHowever, as
OtherDir/Foo.phpdoes 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: