XoopsModules25x /
suico
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | You may not change or alter any portion of this comment or credits |
||
| 7 | of supporting developers from this source code or any supporting source code |
||
| 8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, |
||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @category Module |
||
| 17 | * @package yogurt |
||
| 18 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 19 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 20 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Yogurt; |
||
| 25 | |||
| 26 | $GLOBALS['xoopsOption']['template_main'] = 'yogurt_editgroup.tpl'; |
||
| 27 | require __DIR__ . '/header.php'; |
||
| 28 | |||
| 29 | $controller = new Yogurt\GroupController($xoopsDB, $xoopsUser); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Fetching numbers of groups friends videos pictures etc... |
||
| 33 | */ |
||
| 34 | $nbSections = $controller->getNumbersSections(); |
||
| 35 | |||
| 36 | $group_id = Request::getInt('group_id', 0, 'POST'); |
||
| 37 | $marker = Request::getInt('marker', 0, 'POST'); |
||
| 38 | $criteria = new Criteria('group_id', $group_id); |
||
| 39 | $groups = $controller->groupsFactory->getObjects($criteria); |
||
| 40 | $group = $groups[0]; |
||
| 41 | |||
| 42 | $uid = $xoopsUser->getVar('uid'); |
||
| 43 | |||
| 44 | if (1 === $marker && $group->getVar('owner_uid') === $uid) { |
||
| 45 | $title = Request::getString('title', '', 'POST'); |
||
| 46 | |||
| 47 | $desc = Request::getString('desc', '', 'POST'); |
||
| 48 | |||
| 49 | $img = Request::getString('img', '', 'POST'); |
||
| 50 | |||
| 51 | $updateImg = 1 === Request::getInt('flag_oldimg', 0, 'POST') ? 0 : 1; |
||
| 52 | |||
| 53 | $path_upload = XOOPS_ROOT_PATH . '/uploads/yogurt/images'; |
||
| 54 | |||
| 55 | $maxfilebytes = $helper->getConfig('maxfilesize'); |
||
| 56 | |||
| 57 | $maxfileheight = $helper->getConfig('max_original_height'); |
||
| 58 | |||
| 59 | $maxfilewidth = $helper->getConfig('max_original_width'); |
||
| 60 | |||
| 61 | $controller->groupsFactory->receiveGroup( |
||
| 62 | $title, |
||
| 63 | $desc, |
||
| 64 | $img, |
||
| 65 | $path_upload, |
||
| 66 | $maxfilebytes, |
||
| 67 | $maxfilewidth, |
||
| 68 | $maxfileheight, |
||
| 69 | $updateImg, |
||
| 70 | $group |
||
| 71 | ); |
||
| 72 | |||
| 73 | redirect_header('group.php?group_id=' . $group_id . '', 3, _MD_YOGURT_GROUPEDITED); |
||
| 74 | } else { |
||
| 75 | /** |
||
| 76 | * Render a form with the info of the user |
||
| 77 | */ |
||
| 78 | |||
| 79 | $group_members = $controller->relgroupusersFactory->getUsersFromGroup( |
||
| 80 | $group_id, |
||
| 81 | 0, |
||
| 82 | 50 |
||
| 83 | ); |
||
| 84 | |||
| 85 | $xoopsTpl->assign('group_members', $group_members); |
||
| 86 | |||
| 87 | $maxfilebytes = $helper->getConfig('maxfilesize'); |
||
| 88 | |||
| 89 | $xoopsTpl->assign('lang_savegroup', _MD_YOGURT_UPLOADGROUP); |
||
| 90 | |||
| 91 | $xoopsTpl->assign('maxfilesize', $maxfilebytes); |
||
| 92 | |||
| 93 | $xoopsTpl->assign('group_title', $group->getVar('group_title')); |
||
| 94 | |||
| 95 | $xoopsTpl->assign('group_desc', $group->getVar('group_desc')); |
||
| 96 | |||
| 97 | $xoopsTpl->assign('group_img', $group->getVar('group_img')); |
||
| 98 | |||
| 99 | $xoopsTpl->assign('group_id', $group->getVar('group_id')); |
||
| 100 | |||
| 101 | //permissions |
||
| 102 | |||
| 103 | $xoopsTpl->assign('allow_notes', $controller->checkPrivilegeBySection('notes')); |
||
| 104 | |||
| 105 | $xoopsTpl->assign('allow_friends', $controller->checkPrivilegeBySection('friends')); |
||
| 106 | |||
| 107 | $xoopsTpl->assign('allow_groups', $controller->checkPrivilegeBySection('groups')); |
||
| 108 | |||
| 109 | $xoopsTpl->assign('allow_pictures', $controller->checkPrivilegeBySection('pictures')); |
||
| 110 | |||
| 111 | $xoopsTpl->assign('allow_videos', $controller->checkPrivilegeBySection('videos')); |
||
| 112 | |||
| 113 | $xoopsTpl->assign('allow_audios', $controller->checkPrivilegeBySection('audio')); |
||
| 114 | |||
| 115 | $xoopsTpl->assign('allow_profile_contact', $controller->checkPrivilege('profile_contact') ? 1 : 0); |
||
|
0 ignored issues
–
show
|
|||
| 116 | |||
| 117 | $xoopsTpl->assign('allow_profile_general', $controller->checkPrivilege('profile_general') ? 1 : 0); |
||
| 118 | |||
| 119 | $xoopsTpl->assign('allow_profile_stats', $controller->checkPrivilege('profile_stats') ? 1 : 0); |
||
| 120 | |||
| 121 | $xoopsTpl->assign('lang_membersofgroup', _MD_YOGURT_MEMBERSDOFGROUP); |
||
|
0 ignored issues
–
show
|
|||
| 122 | |||
| 123 | $xoopsTpl->assign('lang_editgroup', _MD_YOGURT_EDIT_GROUP); |
||
| 124 | |||
| 125 | $xoopsTpl->assign('lang_groupimage', _MD_YOGURT_GROUP_IMAGE); |
||
| 126 | |||
| 127 | $xoopsTpl->assign('lang_keepimage', _MD_YOGURT_MAINTAIN_OLD_IMAGE); |
||
| 128 | |||
| 129 | $xoopsTpl->assign('lang_youcanupload', sprintf(_MD_YOGURT_YOU_CAN_UPLOAD, $maxfilebytes / 1024)); |
||
| 130 | |||
| 131 | $xoopsTpl->assign('lang_titlegroup', _MD_YOGURT_GROUP_TITLE); |
||
| 132 | |||
| 133 | $xoopsTpl->assign('lang_descgroup', _MD_YOGURT_GROUP_DESC); |
||
| 134 | |||
| 135 | //Owner data |
||
| 136 | |||
| 137 | $xoopsTpl->assign('uid_owner', $controller->uidOwner); |
||
| 138 | |||
| 139 | $xoopsTpl->assign('owner_uname', $controller->nameOwner); |
||
| 140 | |||
| 141 | $xoopsTpl->assign('isOwner', $controller->isOwner); |
||
| 142 | |||
| 143 | $xoopsTpl->assign('isAnonym', $controller->isAnonym); |
||
| 144 | |||
| 145 | //numbers |
||
| 146 | |||
| 147 | $xoopsTpl->assign('countGroups', $nbSections['countGroups']); |
||
| 148 | |||
| 149 | $xoopsTpl->assign('countPhotos', $nbSections['countPhotos']); |
||
| 150 | |||
| 151 | $xoopsTpl->assign('countVideos', $nbSections['countGroups']); |
||
| 152 | |||
| 153 | $xoopsTpl->assign('countNotes', $nbSections['countNotes']); |
||
| 154 | |||
| 155 | $xoopsTpl->assign('countFriends', $nbSections['countFriends']); |
||
| 156 | |||
| 157 | $xoopsTpl->assign('countAudio', $nbSections['countAudios']); |
||
| 158 | |||
| 159 | //navbar |
||
| 160 | |||
| 161 | $xoopsTpl->assign('module_name', $xoopsModule->getVar('name')); |
||
| 162 | |||
| 163 | $xoopsTpl->assign('lang_mysection', _MD_YOGURT_GROUPS . ' :: ' . _MD_YOGURT_EDIT_GROUP); |
||
| 164 | |||
| 165 | $xoopsTpl->assign('section_name', _MD_YOGURT_GROUPS . '> ' . _MD_YOGURT_EDIT_GROUP); |
||
| 166 | |||
| 167 | $xoopsTpl->assign('lang_home', _MD_YOGURT_HOME); |
||
| 168 | |||
| 169 | $xoopsTpl->assign('lang_photos', _MD_YOGURT_PHOTOS); |
||
| 170 | |||
| 171 | $xoopsTpl->assign('lang_friends', _MD_YOGURT_FRIENDS); |
||
| 172 | |||
| 173 | $xoopsTpl->assign('lang_videos', _MD_YOGURT_VIDEOS); |
||
| 174 | |||
| 175 | $xoopsTpl->assign('lang_notebook', _MD_YOGURT_NOTEBOOK); |
||
| 176 | |||
| 177 | $xoopsTpl->assign('lang_profile', _MD_YOGURT_PROFILE); |
||
| 178 | |||
| 179 | $xoopsTpl->assign('lang_groups', _MD_YOGURT_GROUPS); |
||
| 180 | |||
| 181 | $xoopsTpl->assign('lang_configs', _MD_YOGURT_CONFIGS_TITLE); |
||
| 182 | |||
| 183 | $xoopsTpl->assign('lang_audio', _MD_YOGURT_AUDIOS); |
||
| 184 | |||
| 185 | //xoopsToken |
||
| 186 | |||
| 187 | $xoopsTpl->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML()); |
||
| 188 | |||
| 189 | //page atributes |
||
| 190 | |||
| 191 | $xoopsTpl->assign( |
||
| 192 | 'xoops_pagetitle', |
||
| 193 | sprintf(_MD_YOGURT_PAGETITLE, $xoopsModule->getVar('name'), $controller->nameOwner) |
||
| 194 | ); |
||
| 195 | |||
| 196 | //$xoopsTpl->assign('path_yogurt_uploads',$helper->getConfig('link_path_upload')); |
||
| 197 | |||
| 198 | $xoopsTpl->assign( |
||
| 199 | 'lang_owner', |
||
| 200 | _MD_YOGURT_GROUPOWNER |
||
| 201 | ); |
||
| 202 | } |
||
| 203 | |||
| 204 | $xoTheme->addScript(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/js/yogurt.js'); |
||
| 205 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/yogurt.css'); |
||
| 206 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.tabs.css'); |
||
| 207 | // what browser they use if IE then add corrective script. |
||
| 208 | if (false !== mb_stripos($_SERVER['HTTP_USER_AGENT'], 'msie')) { |
||
| 209 | $xoTheme->addStylesheet( |
||
| 210 | XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/css/jquery.tabs-ie.css' |
||
| 211 | ); |
||
| 212 | } |
||
| 213 | |||
| 214 | require __DIR__ . '/footer.php'; |
||
| 215 | require dirname(__DIR__, 2) . '/footer.php'; |
||
| 216 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.