XoopsModules25x /
suico
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php declare(strict_types=1); |
||||
| 2 | // ------------------------------------------------------------------------ // |
||||
| 3 | // XOOPS - PHP Content Management System // |
||||
| 4 | // Copyright (c) 2000 XOOPS.org // |
||||
| 5 | // <https://xoops.org> // |
||||
| 6 | // ------------------------------------------------------------------------- // |
||||
| 7 | // This program is free software; you can redistribute it and/or modify // |
||||
| 8 | // it under the terms of the GNU General Public License as published by // |
||||
| 9 | // the Free Software Foundation; either version 2 of the License, or // |
||||
| 10 | // (at your option) any later version. // |
||||
| 11 | // // |
||||
| 12 | // You may not change or alter any portion of this comment or credits // |
||||
| 13 | // of supporting developers from this source code or any supporting // |
||||
| 14 | // source code which is considered copyrighted (c) material of the // |
||||
| 15 | // original comment or credit authors. // |
||||
| 16 | // // |
||||
| 17 | // This program is distributed in the hope that it will be useful, // |
||||
| 18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||||
| 19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||||
| 20 | // GNU General Public License for more details. // |
||||
| 21 | // // |
||||
| 22 | // You should have received a copy of the GNU General Public License // |
||||
| 23 | // along with this program; if not, write to the Free Software // |
||||
| 24 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||||
| 25 | // ------------------------------------------------------------------------ // |
||||
| 26 | use Xmf\Request; |
||||
|
0 ignored issues
–
show
|
|||||
| 27 | use XoopsModules\Suico\{ |
||||
| 28 | FriendrequestHandler, |
||||
| 29 | IndexController |
||||
| 30 | }; |
||||
| 31 | |||||
| 32 | require __DIR__ . '/header.php'; |
||||
| 33 | $op = 'form'; |
||||
| 34 | //require_once __DIR__ . '/class/suico_controller.php'; |
||||
| 35 | $controller = new IndexController($xoopsDB, $xoopsUser); |
||||
| 36 | /** |
||||
| 37 | * Fetching numbers of groups friends videos pictures etc... |
||||
| 38 | */ |
||||
| 39 | $nbSections = $controller->getNumbersSections(); |
||||
| 40 | $GLOBALS['xoopsOption']['template_main'] = 'suico_memberslist_datatables.tpl'; |
||||
| 41 | require XOOPS_ROOT_PATH . '/header.php'; |
||||
| 42 | $iamadmin = $xoopsUserIsAdmin; |
||||
| 43 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 44 | $criteria = new CriteriaCompo(); |
||||
| 45 | $criteria->add(new Criteria('level', 0, '>')); |
||||
| 46 | $validsort = ['uname', 'email', 'last_login', 'user_regdate', 'posts']; |
||||
| 47 | $sort = (!in_array($xoopsModuleConfig['sortmembers'], $validsort, true)) ? 'uname' : $xoopsModuleConfig['sortmembers']; |
||||
| 48 | $order = 'ASC'; |
||||
| 49 | if (isset($xoopsModuleConfig['membersorder']) && 'DESC' == $xoopsModuleConfig['membersorder']) { |
||||
| 50 | $order = 'DESC'; |
||||
| 51 | } |
||||
| 52 | if ('normal' == $xoopsModuleConfig['memberslisttemplate']) { |
||||
| 53 | $limit = (!empty($xoopsModuleConfig['membersperpage'])) ? (int)$xoopsModuleConfig['membersperpage'] : 20; |
||||
| 54 | if (0 === $limit || $limit > 50) { |
||||
| 55 | $limit = 50; |
||||
| 56 | } |
||||
| 57 | } |
||||
| 58 | $start = Request::getInt('start', 0, 'POST'); |
||||
| 59 | /** @var \XoopsMemberHandler $memberHandler */ |
||||
| 60 | $memberHandler = xoops_getHandler('member'); |
||||
| 61 | $total = $memberHandler->getUserCount($criteria); |
||||
| 62 | $xoopsTpl->assign('totalmember', $total); |
||||
| 63 | //Show last member |
||||
| 64 | $result = $GLOBALS['xoopsDB']->query('SELECT uid, uname FROM ' . $GLOBALS['xoopsDB']->prefix('users') . ' WHERE level > 0 ORDER BY uid DESC', 1, 0); |
||||
| 65 | [$latestuid, $latestuser] = $GLOBALS['xoopsDB']->fetchRow($result); |
||||
| 66 | $xoopsTpl->assign('latestmember', " <a href='" . XOOPS_URL . '/modules/suico/index.php?uid=' . $latestuid . "'>" . $latestuser . '</a>'); |
||||
| 67 | $xoopsTpl->assign('welcomemessage', $xoopsModuleConfig['welcomemessage']); |
||||
| 68 | $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH); |
||||
| 69 | $xoopsTpl->assign('lang_results', _MD_SUICO_RESULTS); |
||||
| 70 | if (0 === $total) { |
||||
| 71 | $xoopsTpl->assign('lang_nonefound', _MD_SUICO_NOFOUND); |
||||
| 72 | } elseif ($start < $total) { |
||||
| 73 | $xoopsTpl->assign('lang_username', _MD_SUICO_UNAME); |
||||
| 74 | $xoopsTpl->assign('lang_realname', _MD_SUICO_REALNAME); |
||||
| 75 | $xoopsTpl->assign('lang_avatar', _MD_SUICO_AVATAR); |
||||
| 76 | $xoopsTpl->assign('lang_email', _MD_SUICO_EMAIL); |
||||
| 77 | $xoopsTpl->assign('lang_privmsg', _MD_SUICO_PM); |
||||
| 78 | $xoopsTpl->assign('lang_regdate', _MD_SUICO_REGDATE); |
||||
| 79 | $xoopsTpl->assign('lang_lastlogin', _MD_SUICO_LASTLOGIN); |
||||
| 80 | $xoopsTpl->assign('lang_posts', _MD_SUICO_POSTS); |
||||
| 81 | $xoopsTpl->assign('lang_url', _MD_SUICO_URL); |
||||
| 82 | $xoopsTpl->assign('lang_admin', _MD_SUICO_ADMIN); |
||||
| 83 | if ($iamadmin) { |
||||
| 84 | $xoopsTpl->assign('is_admin', true); |
||||
| 85 | } |
||||
| 86 | $criteria->setSort($sort); |
||||
| 87 | $criteria->setOrder($order); |
||||
| 88 | $criteria->setStart($start); |
||||
| 89 | if ('normal' == $xoopsModuleConfig['memberslisttemplate']) { |
||||
| 90 | $criteria->setLimit($limit); |
||||
| 91 | } |
||||
| 92 | $foundusers = $memberHandler->getUsers($criteria, true); |
||||
| 93 | foreach (array_keys($foundusers) as $j) { |
||||
| 94 | $userdata['avatar'] = $foundusers[$j]->getVar('user_avatar'); |
||||
| 95 | $userdata['realname'] = $foundusers[$j]->getVar('name'); |
||||
| 96 | $userdata['name'] = $foundusers[$j]->getVar('uname'); |
||||
| 97 | $userdata['id'] = $foundusers[$j]->getVar('uid'); |
||||
| 98 | $userdata['uid'] = $foundusers[$j]->getVar('uid'); |
||||
| 99 | $criteria_friends = new Criteria('friend1_uid', $controller->uidOwner); |
||||
| 100 | $criteriaIsfriend = new CriteriaCompo(new Criteria('friend2_uid', $userdata['uid'])); |
||||
| 101 | $criteriaIsfriend->add($criteria_friends); |
||||
| 102 | $controller->isFriend = $controller->friendshipsFactory->getCount($criteriaIsfriend); |
||||
| 103 | $userdata['isFriend'] = $controller->isFriend; |
||||
| 104 | $friendrequestFactory = new FriendrequestHandler($xoopsDB); |
||||
| 105 | $criteria_selfrequest = new Criteria('friendrequester_uid', $controller->uidOwner); |
||||
| 106 | $criteria_isselfrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $userdata['uid'])); |
||||
| 107 | $criteria_isselfrequest->add($criteria_selfrequest); |
||||
| 108 | $controller->isSelfRequest = $friendrequestFactory->getCount($criteria_isselfrequest); |
||||
| 109 | $userdata['selffriendrequest'] = $controller->isSelfRequest; |
||||
| 110 | if ($controller->isSelfRequest > 0) { |
||||
| 111 | $xoopsTpl->assign('self_uid', $controller->uidOwner); |
||||
| 112 | } |
||||
| 113 | $xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND); |
||||
| 114 | $xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT); |
||||
| 115 | $xoopsTpl->assign('lang_friendshipstatus', _MD_SUICO_FRIENDSHIP_STATUS); |
||||
| 116 | $criteria_otherrequest = new Criteria('friendrequester_uid', $userdata['uid']); |
||||
| 117 | $criteria_isotherrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $controller->uidOwner)); |
||||
| 118 | $criteria_isotherrequest->add($criteria_otherrequest); |
||||
| 119 | $controller->isOtherRequest = $friendrequestFactory->getCount($criteria_isotherrequest); |
||||
| 120 | $userdata['otherfriendrequest'] = $controller->isOtherRequest; |
||||
| 121 | if ($controller->isOtherRequest > 0) { |
||||
| 122 | $xoopsTpl->assign('other_uid', $userdata['uid']); |
||||
| 123 | } |
||||
| 124 | if (1 === $foundusers[$j]->getVar('user_viewemail') || $iamadmin) { |
||||
| 125 | $userdata['email'] = "<a href='mailto:" . $foundusers[$j]->getVar( |
||||
| 126 | 'email' |
||||
| 127 | ) . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='" . sprintf( |
||||
| 128 | _SENDEMAILTO, |
||||
| 129 | $foundusers[$j]->getVar('uname', 'E') |
||||
| 130 | ) . "'></a>"; |
||||
| 131 | $userdata['emailaddress'] = $foundusers[$j]->getVar('email'); |
||||
| 132 | } else { |
||||
| 133 | $userdata['email'] = ' '; |
||||
| 134 | } |
||||
| 135 | if ($xoopsUser) { |
||||
| 136 | $userdata['pmlink'] = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $foundusers[$j]->getVar( |
||||
| 137 | 'uid' |
||||
| 138 | ) . "\",\"pmlite\",450,370);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' border='0' alt='" . sprintf( |
||||
| 139 | _SENDPMTO, |
||||
| 140 | $foundusers[$j]->getVar( |
||||
| 141 | 'uname', |
||||
| 142 | 'E' |
||||
| 143 | ) |
||||
| 144 | ) . "'></a>"; |
||||
| 145 | $userdata['pm'] = $foundusers[$j]->getVar('uid'); |
||||
| 146 | } else { |
||||
| 147 | $userdata['pmlink'] = ' '; |
||||
| 148 | } |
||||
| 149 | if ('' !== $foundusers[$j]->getVar('url', 'E')) { |
||||
| 150 | $userdata['website'] = "<a href='" . $foundusers[$j]->getVar( |
||||
| 151 | 'url', |
||||
| 152 | 'E' |
||||
| 153 | ) . "' target='_blank'><img src='" . XOOPS_URL . "/images/icons/www.gif' border='0' alt='" . _VISITWEBSITE . "'></a>"; |
||||
| 154 | } else { |
||||
| 155 | $userdata['website'] = ' '; |
||||
| 156 | } |
||||
| 157 | $userdata['url'] = $foundusers[$j]->getVar('url', 'e'); |
||||
| 158 | $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's'); |
||||
| 159 | if (0 !== $foundusers[$j]->getVar('last_login')) { |
||||
| 160 | $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm'); |
||||
| 161 | } else { |
||||
| 162 | $userdata['lastlogin'] = _MD_SUICO_NEVERLOGIN; |
||||
| 163 | } |
||||
| 164 | $userdata['posts'] = $foundusers[$j]->getVar('posts'); |
||||
| 165 | if ($iamadmin) { |
||||
| 166 | $userdata['adminlink'] = "<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&uid=' . (int)$foundusers[$j]->getVar( |
||||
| 167 | 'uid' |
||||
| 168 | ) . "&op=modifyUser'>" . _EDIT . "</a> <a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&op=delUser&uid=' . (int)$foundusers[$j]->getVar( |
||||
| 169 | 'uid' |
||||
| 170 | ) . "'>" . _DELETE . '</a>'; |
||||
| 171 | } |
||||
| 172 | $userdata['location'] = $foundusers[$j]->getVar('user_from'); |
||||
| 173 | $userdata['occupation'] = $foundusers[$j]->getVar('user_occ'); |
||||
| 174 | $userdata['interest'] = $foundusers[$j]->getVar('user_intrest'); |
||||
| 175 | $userdata['extrainfo'] = $foundusers[$j]->getVar('bio'); |
||||
| 176 | $userdata['signature'] = $foundusers[$j]->getVar('user_sig'); |
||||
| 177 | $userdata['onlinestatus'] = $foundusers[$j]->isOnline(); |
||||
| 178 | $userrank = $foundusers[$j]->rank(); |
||||
| 179 | if ($userrank['image']) { |
||||
| 180 | $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">'; |
||||
| 181 | } |
||||
| 182 | $userdata['ranktitle'] = $userrank['title']; |
||||
| 183 | $uid = $userdata['id']; |
||||
| 184 | $groups = $memberHandler->getGroupsByUser($uid, true); |
||||
| 185 | $usergroups = []; |
||||
| 186 | foreach ($groups as $group) { |
||||
| 187 | $usergroups[] = $group->getVar('name'); |
||||
| 188 | } |
||||
| 189 | $userdata['groups'] = implode(', ', $usergroups); |
||||
| 190 | $xoopsTpl->append('users', $userdata); |
||||
| 191 | } |
||||
| 192 | if ('normal' == $xoopsModuleConfig['memberslisttemplate']) { |
||||
| 193 | $totalpages = ceil($total / $limit); |
||||
| 194 | if ($totalpages > 1) { |
||||
| 195 | $hiddenform = "<form name='findnext' action='memberslist.php' method='post'>"; |
||||
| 196 | foreach ($_POST as $k => $v) { |
||||
| 197 | $hiddenform .= "<input type='hidden' name='" . htmlspecialchars($k, ENT_QUOTES | ENT_HTML5) . "' value='" . htmlspecialchars($v, ENT_QUOTES | ENT_HTML5) . "'>\n"; |
||||
| 198 | } |
||||
| 199 | if (!isset($_POST['limit'])) { |
||||
| 200 | $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "'>\n"; |
||||
| 201 | } |
||||
| 202 | if (!isset($_POST['start'])) { |
||||
| 203 | $hiddenform .= "<input type='hidden' name='start' value='" . $start . "'>\n"; |
||||
| 204 | } |
||||
| 205 | $prev = $start - $limit; |
||||
| 206 | if ($start - $limit >= 0) { |
||||
| 207 | $hiddenform .= "<a href='#0' onclick='document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _MD_SUICO_PREVIOUS . "</a> \n"; |
||||
| 208 | } |
||||
| 209 | $counter = 1; |
||||
| 210 | $currentpage = ($start + $limit) / $limit; |
||||
| 211 | while ($counter <= $totalpages) { |
||||
| 212 | if ($counter === $currentpage) { |
||||
| 213 | $hiddenform .= '<b>' . $counter . '</b> '; |
||||
| 214 | } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 === $counter || $counter === $totalpages) { |
||||
| 215 | if ($counter === $totalpages && $currentpage < $totalpages - 4) { |
||||
| 216 | $hiddenform .= '... '; |
||||
| 217 | } |
||||
| 218 | $hiddenform .= "<a href='#" . $counter . "' onclick='document.findnext.start.value=" . ($counter - 1) * $limit . ";document.findnext.submit();'>" . $counter . '</a> '; |
||||
|
0 ignored issues
–
show
Are you sure
$counter of type void can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 219 | if (1 === $counter && $currentpage > 5) { |
||||
| 220 | $hiddenform .= '... '; |
||||
| 221 | } |
||||
| 222 | } |
||||
| 223 | $counter++; |
||||
| 224 | } |
||||
| 225 | $next = $start + $limit; |
||||
| 226 | if ($total > $next) { |
||||
| 227 | $hiddenform .= " <a href='#" . $total . "' onclick='document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _MD_SUICO_NEXT . "</a>\n"; |
||||
| 228 | } |
||||
| 229 | $hiddenform .= '</form>'; |
||||
| 230 | $xoopsTpl->assign('pagenav', $hiddenform); |
||||
| 231 | $xoopsTpl->assign('lang_numfound', sprintf(_MD_SUICO_USER_SFOUND, $total)); |
||||
| 232 | } |
||||
| 233 | } |
||||
| 234 | } |
||||
| 235 | $xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND); |
||||
| 236 | $xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND); |
||||
| 237 | $xoopsTpl->assign('lang_friendshippending', _MD_SUICO_FRIENDREQUEST_PENDING); |
||||
| 238 | $xoopsTpl->assign('lang_cancelfriendrequest', _MD_SUICO_FRIENDREQUEST_CANCEL); |
||||
| 239 | if (isset($_POST['addfriend'])) { |
||||
| 240 | $newFriendrequest = $friendrequestFactory->create(true); |
||||
| 241 | $newFriendrequest->setVar('friendrequester_uid', $controller->uidOwner); |
||||
| 242 | $newFriendrequest->setVar('friendrequestto_uid', 5, 0); |
||||
| 243 | $friendrequestFactory->insert2($newFriendrequest); |
||||
| 244 | redirect_header( |
||||
| 245 | XOOPS_URL . '/modules/suico/index.php?uid=' . Request::getInt('friendrequestfrom_uid', 0, 'POST'), |
||||
| 246 | 3, |
||||
| 247 | _MD_SUICO_FRIENDREQUEST_FROM |
||||
| 248 | ); |
||||
| 249 | } |
||||
| 250 | $memberHandler = xoops_getHandler('member'); |
||||
| 251 | $thisUser = $memberHandler->getUser($controller->uidOwner); |
||||
|
0 ignored issues
–
show
The method
getUser() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsAvatarHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 252 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 253 | //navbar |
||||
| 254 | $xoopsTpl->assign('lang_mysection', _MD_SUICO_MEMBERSLIST); |
||||
| 255 | $xoopsTpl->assign('section_name', _MD_SUICO_MEMBERSLIST); |
||||
| 256 | // temporary solution for profile module integration |
||||
| 257 | if (xoops_isActiveModule('profile')) { |
||||
| 258 | $profileHandler = $helper->getHandler('Profile'); |
||||
| 259 | $uid = $controller->uidOwner; |
||||
| 260 | if ($uid <= 0) { |
||||
| 261 | if (is_object($xoopsUser)) { |
||||
| 262 | $profile = $profileHandler->get($uid); |
||||
| 263 | } else { |
||||
| 264 | header('location: ' . XOOPS_URL); |
||||
| 265 | exit(); |
||||
| 266 | } |
||||
| 267 | } else { |
||||
| 268 | $profile = $profileHandler->get($uid); |
||||
| 269 | } |
||||
| 270 | } |
||||
| 271 | require __DIR__ . '/footer.php'; |
||||
| 272 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 273 |
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: