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_editgroup.tpl'; |
||
26 | require __DIR__ . '/header.php'; |
||
27 | $controller = new Suico\GroupController($xoopsDB, $xoopsUser); |
||
28 | /** |
||
29 | * Fetching numbers of groups friends videos pictures etc... |
||
30 | */ |
||
31 | $nbSections = $controller->getNumbersSections(); |
||
32 | $group_id = Request::getInt('group_id', 0, 'POST'); |
||
33 | $marker = Request::getInt('marker', 0, 'POST'); |
||
34 | $criteria = new Criteria('group_id', $group_id); |
||
35 | $groups = $controller->groupsFactory->getObjects($criteria); |
||
36 | $group = $groups[0]; |
||
37 | $uid = $xoopsUser->getVar('uid'); |
||
38 | if (1 === $marker && $group->getVar('owner_uid') === $uid) { |
||
39 | $title = Request::getString('title', '', 'POST'); |
||
40 | $desc = Request::getString('desc', '', 'POST'); |
||
41 | $img = Request::getString('img', '', 'POST'); |
||
42 | $updateImg = 1 === Request::getInt('flag_oldimg', 0, 'POST') ? 0 : 1; |
||
43 | $path_upload = XOOPS_ROOT_PATH . '/uploads/suico/images'; |
||
44 | $maxfilebytes = $helper->getConfig('maxfilesize'); |
||
45 | $maxfileheight = $helper->getConfig('max_original_height'); |
||
46 | $maxfilewidth = $helper->getConfig('max_original_width'); |
||
47 | $controller->groupsFactory->receiveGroup( |
||
48 | $title, |
||
49 | $desc, |
||
50 | $img, |
||
51 | $path_upload, |
||
52 | $maxfilebytes, |
||
53 | $maxfilewidth, |
||
54 | $maxfileheight, |
||
55 | $updateImg, |
||
56 | $group |
||
57 | ); |
||
58 | redirect_header('group.php?group_id=' . $group_id . '', 3, _MD_SUICO_GROUPEDITED); |
||
59 | } else { |
||
60 | /** |
||
61 | * Render a form with the info of the user |
||
62 | */ |
||
63 | $group_members = $controller->relgroupusersFactory->getUsersFromGroup( |
||
64 | $group_id, |
||
65 | 0, |
||
66 | 50 |
||
67 | ); |
||
68 | $xoopsTpl->assign('group_members', $group_members); |
||
69 | $maxfilebytes = $helper->getConfig('maxfilesize'); |
||
70 | $xoopsTpl->assign('lang_savegroup', _MD_SUICO_UPLOADGROUP); |
||
71 | $xoopsTpl->assign('maxfilesize', $maxfilebytes); |
||
72 | $xoopsTpl->assign('group_title', $group->getVar('group_title')); |
||
73 | $xoopsTpl->assign('group_desc', $group->getVar('group_desc')); |
||
74 | $xoopsTpl->assign('group_img', $group->getVar('group_img')); |
||
75 | $xoopsTpl->assign('group_id', $group->getVar('group_id')); |
||
76 | //permissions |
||
77 | $xoopsTpl->assign('allow_notes', $controller->checkPrivilegeBySection('notes')); |
||
78 | $xoopsTpl->assign('allow_friends', $controller->checkPrivilegeBySection('friends')); |
||
79 | $xoopsTpl->assign('allow_groups', $controller->checkPrivilegeBySection('groups')); |
||
80 | $xoopsTpl->assign('allow_pictures', $controller->checkPrivilegeBySection('pictures')); |
||
81 | $xoopsTpl->assign('allow_videos', $controller->checkPrivilegeBySection('videos')); |
||
82 | $xoopsTpl->assign('allow_audios', $controller->checkPrivilegeBySection('audio')); |
||
83 | $xoopsTpl->assign('allow_profile_contact', $controller->checkPrivilege('profile_contact') ? 1 : 0); |
||
84 | $xoopsTpl->assign('allow_profile_general', $controller->checkPrivilege('profile_general') ? 1 : 0); |
||
85 | $xoopsTpl->assign('allow_profile_stats', $controller->checkPrivilege('profile_stats') ? 1 : 0); |
||
86 | $xoopsTpl->assign('lang_membersofgroup', _MD_SUICO_MEMBERSDOFGROUP); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
87 | $xoopsTpl->assign('lang_editgroup', _MD_SUICO_EDIT_GROUP); |
||
88 | $xoopsTpl->assign('lang_groupimage', _MD_SUICO_GROUP_IMAGE); |
||
89 | $xoopsTpl->assign('lang_keepimage', _MD_SUICO_MAINTAIN_OLD_IMAGE); |
||
90 | $xoopsTpl->assign('lang_youcanupload', sprintf(_MD_SUICO_YOU_CAN_UPLOAD, $maxfilebytes / 1024)); |
||
91 | $xoopsTpl->assign('lang_titlegroup', _MD_SUICO_GROUP_TITLE); |
||
92 | $xoopsTpl->assign('lang_descgroup', _MD_SUICO_GROUP_DESC); |
||
93 | //Owner data |
||
94 | $xoopsTpl->assign('uid_owner', $controller->uidOwner); |
||
95 | $xoopsTpl->assign('owner_uname', $controller->nameOwner); |
||
96 | $xoopsTpl->assign('isOwner', $controller->isOwner); |
||
97 | $xoopsTpl->assign('isAnonym', $controller->isAnonym); |
||
98 | //numbers |
||
99 | $xoopsTpl->assign('countGroups', $nbSections['countGroups']); |
||
100 | $xoopsTpl->assign('countPhotos', $nbSections['countPhotos']); |
||
101 | $xoopsTpl->assign('countVideos', $nbSections['countGroups']); |
||
102 | $xoopsTpl->assign('countNotes', $nbSections['countNotes']); |
||
103 | $xoopsTpl->assign('countFriends', $nbSections['countFriends']); |
||
104 | $xoopsTpl->assign('countAudio', $nbSections['countAudios']); |
||
105 | //navbar |
||
106 | $xoopsTpl->assign('module_name', $xoopsModule->getVar('name')); |
||
107 | $xoopsTpl->assign('lang_mysection', _MD_SUICO_GROUPS . ' :: ' . _MD_SUICO_EDIT_GROUP); |
||
108 | $xoopsTpl->assign('section_name', _MD_SUICO_GROUPS . '> ' . _MD_SUICO_EDIT_GROUP); |
||
109 | $xoopsTpl->assign('lang_home', _MD_SUICO_HOME); |
||
110 | $xoopsTpl->assign('lang_photos', _MD_SUICO_PHOTOS); |
||
111 | $xoopsTpl->assign('lang_friends', _MD_SUICO_FRIENDS); |
||
112 | $xoopsTpl->assign('lang_videos', _MD_SUICO_VIDEOS); |
||
113 | $xoopsTpl->assign('lang_notebook', _MD_SUICO_NOTEBOOK); |
||
114 | $xoopsTpl->assign('lang_profile', _MD_SUICO_PROFILE); |
||
115 | $xoopsTpl->assign('lang_groups', _MD_SUICO_GROUPS); |
||
116 | $xoopsTpl->assign('lang_configs', _MD_SUICO_CONFIGS_TITLE); |
||
117 | $xoopsTpl->assign('lang_audio', _MD_SUICO_AUDIOS); |
||
118 | //xoopsToken |
||
119 | $xoopsTpl->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML()); |
||
120 | //page atributes |
||
121 | $xoopsTpl->assign( |
||
122 | 'xoops_pagetitle', |
||
123 | sprintf(_MD_SUICO_PAGETITLE, $xoopsModule->getVar('name'), $controller->nameOwner) |
||
124 | ); |
||
125 | //$xoopsTpl->assign('path_suico_uploads',$helper->getConfig('link_path_upload')); |
||
126 | $xoopsTpl->assign( |
||
127 | 'lang_owner', |
||
128 | _MD_SUICO_GROUPOWNER |
||
129 | ); |
||
130 | } |
||
131 | |||
132 | require __DIR__ . '/footer.php'; |
||
133 | require dirname(__DIR__, 2) . '/footer.php'; |
||
134 |