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 = Request::getCmd('op', 'form', 'POST'); |
||||
| 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 | if ('form' === $op) { |
||||
| 41 | $GLOBALS['xoopsOption']['template_main'] = 'suico_searchform.tpl'; |
||||
| 42 | require XOOPS_ROOT_PATH . '/header.php'; |
||||
| 43 | /** @var \XoopsMemberHandler $memberHandler */ |
||||
| 44 | $memberHandler = xoops_getHandler('member'); |
||||
| 45 | $total = $memberHandler->getUserCount(new Criteria('level', 0, '>')); |
||||
| 46 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
| 47 | $uname_text = new \XoopsFormText('', 'user_uname', 30, 60); |
||||
| 48 | $uname_match = new \XoopsFormSelectMatchOption('', 'user_uname_match'); |
||||
| 49 | $uname_tray = new \XoopsFormElementTray(_MD_SUICO_UNAME, ' '); |
||||
| 50 | $uname_tray->addElement($uname_match); |
||||
| 51 | $uname_tray->addElement($uname_text); |
||||
| 52 | $name_text = new \XoopsFormText('', 'user_name', 30, 60); |
||||
| 53 | $name_match = new \XoopsFormSelectMatchOption('', 'user_name_match'); |
||||
| 54 | $name_tray = new \XoopsFormElementTray(_MD_SUICO_REALNAME, ' '); |
||||
| 55 | $name_tray->addElement($name_match); |
||||
| 56 | $name_tray->addElement($name_text); |
||||
| 57 | $email_text = new \XoopsFormText('', 'user_email', 30, 60); |
||||
| 58 | $email_match = new \XoopsFormSelectMatchOption('', 'user_email_match'); |
||||
| 59 | $email_tray = new \XoopsFormElementTray(_MD_SUICO_EMAIL, ' '); |
||||
| 60 | $email_tray->addElement($email_match); |
||||
| 61 | $email_tray->addElement($email_text); |
||||
| 62 | $url_text = new \XoopsFormText(_MD_SUICO_URL_CONTAINS, 'user_url', 30, 100); |
||||
| 63 | $location_text = new \XoopsFormText(_MD_SUICO_LOCATION_CONTAINS, 'user_from', 30, 100); |
||||
| 64 | $occupation_text = new \XoopsFormText(_MD_SUICO_OCCUPATION_CONTAINS, 'user_occ', 30, 100); |
||||
| 65 | $interest_text = new \XoopsFormText(_MD_SUICO_INTEREST_CONTAINS, 'user_intrest', 30, 100); |
||||
| 66 | $extrainfo_text = new \XoopsFormText(_MD_SUICO_EXTRAINFO_CONTAINS, 'bio', 30, 100); |
||||
| 67 | $signature_text = new \XoopsFormText(_MD_SUICO_SIGNATURE_CONTAINS, 'user_sig', 30, 100); |
||||
| 68 | $lastlog_more = new \XoopsFormText( |
||||
| 69 | _MD_SUICO_LASTLOGMORE, |
||||
| 70 | 'user_lastlog_more', |
||||
| 71 | 10, |
||||
| 72 | 5 |
||||
| 73 | ); |
||||
| 74 | $lastlog_less = new \XoopsFormText(_MD_SUICO_LASTLOGLESS, 'user_lastlog_less', 10, 5); |
||||
| 75 | $reg_more = new \XoopsFormText(_MD_SUICO_REGMORE, 'user_reg_more', 10, 5); |
||||
| 76 | $reg_less = new \XoopsFormText(_MD_SUICO_REGLESS, 'user_reg_less', 10, 5); |
||||
| 77 | $posts_more = new \XoopsFormText(_MD_SUICO_POSTSMORE, 'user_posts_more', 10, 5); |
||||
| 78 | $posts_less = new \XoopsFormText(_MD_SUICO_POSTSLESS, 'user_posts_less', 10, 5); |
||||
| 79 | $sort_select = new \XoopsFormSelect(_MD_SUICO_SORT, 'user_sort'); |
||||
| 80 | $sort_select->addOptionArray( |
||||
| 81 | [ |
||||
| 82 | 'uname' => _MD_SUICO_UNAME, |
||||
| 83 | 'email' => _MD_SUICO_EMAIL, |
||||
| 84 | 'last_login' => _MD_SUICO_LASTLOGIN, |
||||
| 85 | 'user_regdate' => _MD_SUICO_REGDATE, |
||||
| 86 | 'posts' => _MD_SUICO_POSTS, |
||||
| 87 | ] |
||||
| 88 | ); |
||||
| 89 | $order_select = new \XoopsFormSelect(_MD_SUICO_ORDER, 'user_order'); |
||||
| 90 | $order_select->addOptionArray( |
||||
| 91 | [ |
||||
| 92 | 'ASC' => _MD_SUICO_ASC, |
||||
| 93 | 'DESC' => _MD_SUICO_DESC, |
||||
| 94 | ] |
||||
| 95 | ); |
||||
| 96 | $limit_text = new \XoopsFormText(_MD_SUICO_LIMIT, 'limit', 6, 2); |
||||
| 97 | $op_hidden = new \XoopsFormHidden('op', 'submit'); |
||||
| 98 | $submit_button = new \XoopsFormButton('', 'user_submit', _SUBMIT, 'submit'); |
||||
| 99 | $form = new \XoopsThemeForm('', 'searchform', 'searchmembers.php'); |
||||
| 100 | $form->addElement($uname_tray); |
||||
| 101 | $form->addElement($name_tray); |
||||
| 102 | $form->addElement($email_tray); |
||||
| 103 | if (1 == $xoopsModuleConfig['displayurl']) { |
||||
| 104 | $form->addElement($url_text); |
||||
| 105 | } |
||||
| 106 | if (1 == $xoopsModuleConfig['displayfrom']) { |
||||
| 107 | $form->addElement($location_text); |
||||
| 108 | } |
||||
| 109 | if (1 == $xoopsModuleConfig['displayoccupation']) { |
||||
| 110 | $form->addElement($occupation_text); |
||||
| 111 | } |
||||
| 112 | if (1 == $xoopsModuleConfig['displayinterest']) { |
||||
| 113 | $form->addElement($interest_text); |
||||
| 114 | } |
||||
| 115 | if (1 == $xoopsModuleConfig['displayextrainfo']) { |
||||
| 116 | $form->addElement($extrainfo_text); |
||||
| 117 | } |
||||
| 118 | if (1 == $xoopsModuleConfig['displaysignature']) { |
||||
| 119 | $form->addElement($signature_text); |
||||
| 120 | } |
||||
| 121 | if (1 == $xoopsModuleConfig['displaylastlogin']) { |
||||
| 122 | $form->addElement($lastlog_more); |
||||
| 123 | $form->addElement($lastlog_less); |
||||
| 124 | } |
||||
| 125 | if (1 == $xoopsModuleConfig['displayregdate']) { |
||||
| 126 | $form->addElement($reg_more); |
||||
| 127 | $form->addElement($reg_less); |
||||
| 128 | } |
||||
| 129 | if (1 == $xoopsModuleConfig['displayposts']) { |
||||
| 130 | $form->addElement($posts_more); |
||||
| 131 | $form->addElement($posts_less); |
||||
| 132 | } |
||||
| 133 | $form->addElement($sort_select); |
||||
| 134 | $form->addElement($order_select); |
||||
| 135 | $form->addElement($limit_text); |
||||
| 136 | $form->addElement($op_hidden); |
||||
| 137 | $form->addElement($submit_button); |
||||
| 138 | $form->assign($xoopsTpl); |
||||
| 139 | $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH); |
||||
| 140 | $xoopsTpl->assign( |
||||
| 141 | 'lang_totalusers', |
||||
| 142 | sprintf(_MD_SUICO_TOTALUSERS, '<span style="color:#ff0000;">' . $total . '</span>') |
||||
| 143 | ); |
||||
| 144 | $xoopsTpl->assign('totalmember', $total); |
||||
| 145 | } |
||||
| 146 | if ('submit' === $op) { |
||||
| 147 | $GLOBALS['xoopsOption']['template_main'] = 'suico_searchresults.tpl'; |
||||
| 148 | require XOOPS_ROOT_PATH . '/header.php'; |
||||
| 149 | $iamadmin = $xoopsUserIsAdmin; |
||||
| 150 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 151 | $criteria = new CriteriaCompo(); |
||||
| 152 | if (!empty($_POST['user_uname'])) { |
||||
| 153 | $match = !empty($_POST['user_uname_match']) ? Request::getInt('user_uname_match', 0, 'POST') : XOOPS_MATCH_START; |
||||
| 154 | switch ($match) { |
||||
| 155 | case XOOPS_MATCH_START: |
||||
| 156 | $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST') . '%', 'LIKE')); |
||||
| 157 | break; |
||||
| 158 | case XOOPS_MATCH_END: |
||||
| 159 | $criteria->add(new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST'), 'LIKE')); |
||||
| 160 | break; |
||||
| 161 | case XOOPS_MATCH_EQUAL: |
||||
| 162 | $criteria->add(new Criteria('uname', Request::getString('user_uname', '', 'POST'))); |
||||
| 163 | break; |
||||
| 164 | case XOOPS_MATCH_CONTAIN: |
||||
| 165 | $criteria->add( |
||||
| 166 | new Criteria('uname', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE') |
||||
| 167 | ); |
||||
| 168 | break; |
||||
| 169 | } |
||||
| 170 | } |
||||
| 171 | if (!empty($_POST['user_name'])) { |
||||
| 172 | $match = !empty($_POST['user_name_match']) ? Request::getInt('user_name_match', 0, 'POST') : XOOPS_MATCH_START; |
||||
| 173 | switch ($match) { |
||||
| 174 | case XOOPS_MATCH_START: |
||||
| 175 | $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST') . '%', 'LIKE')); |
||||
| 176 | break; |
||||
| 177 | case XOOPS_MATCH_END: |
||||
| 178 | $criteria->add( |
||||
| 179 | new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE') |
||||
| 180 | ); |
||||
| 181 | break; |
||||
| 182 | case XOOPS_MATCH_EQUAL: |
||||
| 183 | $criteria->add(new Criteria('name', Request::getString('user_uname', '', 'POST'))); |
||||
| 184 | break; |
||||
| 185 | case XOOPS_MATCH_CONTAIN: |
||||
| 186 | $criteria->add( |
||||
| 187 | new Criteria('name', '%' . Request::getString('user_uname', '', 'POST') . '%', 'LIKE') |
||||
| 188 | ); |
||||
| 189 | break; |
||||
| 190 | } |
||||
| 191 | } |
||||
| 192 | if (!empty($_POST['user_email'])) { |
||||
| 193 | $match = !empty($_POST['user_email_match']) ? Request::getInt('user_email_match', 0, 'POST') : XOOPS_MATCH_START; |
||||
| 194 | switch ($match) { |
||||
| 195 | case XOOPS_MATCH_START: |
||||
| 196 | $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST') . '%', 'LIKE')); |
||||
| 197 | break; |
||||
| 198 | case XOOPS_MATCH_END: |
||||
| 199 | $criteria->add(new Criteria('email', '%' . Request::getString('user_email', '', 'POST'), 'LIKE')); |
||||
| 200 | break; |
||||
| 201 | case XOOPS_MATCH_EQUAL: |
||||
| 202 | $criteria->add(new Criteria('email', Request::getString('user_email', '', 'POST'))); |
||||
| 203 | break; |
||||
| 204 | case XOOPS_MATCH_CONTAIN: |
||||
| 205 | $criteria->add( |
||||
| 206 | new Criteria('email', '%' . Request::getString('user_email', '', 'POST') . '%', 'LIKE') |
||||
| 207 | ); |
||||
| 208 | break; |
||||
| 209 | } |
||||
| 210 | if (!$iamadmin) { |
||||
| 211 | $criteria->add(new Criteria('user_viewemail', 1)); |
||||
| 212 | } |
||||
| 213 | } |
||||
| 214 | if (!empty($_POST['user_url'])) { |
||||
| 215 | // $url = Request::getUrl('user_url', '', 'POST'); |
||||
| 216 | $criteria->add(new Criteria('url', Request::getUrl('user_url', '', 'POST') . '%', 'LIKE')); |
||||
| 217 | } |
||||
| 218 | if (!empty($_POST['user_from'])) { |
||||
| 219 | $criteria->add(new Criteria('user_from', '%' . Request::getString('user_from', '', 'POST') . '%', 'LIKE')); |
||||
| 220 | } |
||||
| 221 | if (!empty($_POST['user_intrest'])) { |
||||
| 222 | $criteria->add( |
||||
| 223 | new Criteria('user_intrest', '%' . Request::getString('user_intrest', '', 'POST') . '%', 'LIKE') |
||||
| 224 | ); |
||||
| 225 | } |
||||
| 226 | if (!empty($_POST['user_occ'])) { |
||||
| 227 | $criteria->add(new Criteria('user_occ', '%' . Request::getString('user_occ', '', 'POST') . '%', 'LIKE')); |
||||
| 228 | } |
||||
| 229 | if (!empty($_POST['bio'])) { |
||||
| 230 | $criteria->add(new Criteria('bio', '%' . Request::getString('bio', '', 'POST') . '%', 'LIKE')); |
||||
| 231 | } |
||||
| 232 | if (!empty($_POST['user_sig'])) { |
||||
| 233 | $criteria->add(new Criteria('user_sig', '%' . Request::getString('user_sig', '', 'POST') . '%', 'LIKE')); |
||||
| 234 | } |
||||
| 235 | if (!empty($_POST['user_lastlog_more']) && is_numeric($_POST['user_lastlog_more'])) { |
||||
| 236 | $f_user_lastlog_more = Request::getInt('user_lastlog_more', 0, 'POST'); |
||||
| 237 | $time = time() - (60 * 60 * 24 * $f_user_lastlog_more); |
||||
| 238 | if ($time > 0) { |
||||
| 239 | $criteria->add(new Criteria('last_login', $time, '<')); |
||||
| 240 | } |
||||
| 241 | } |
||||
| 242 | if (!empty($_POST['user_lastlog_less']) && is_numeric($_POST['user_lastlog_less'])) { |
||||
| 243 | $f_user_lastlog_less = Request::getInt('user_lastlog_less', 0, 'POST'); |
||||
| 244 | $time = time() - (60 * 60 * 24 * $f_user_lastlog_less); |
||||
| 245 | if ($time > 0) { |
||||
| 246 | $criteria->add(new Criteria('last_login', $time, '>')); |
||||
| 247 | } |
||||
| 248 | } |
||||
| 249 | if (!empty($_POST['user_reg_more']) && is_numeric($_POST['user_reg_more'])) { |
||||
| 250 | $f_user_reg_more = Request::getInt('user_reg_more', 0, 'POST'); |
||||
| 251 | $time = time() - (60 * 60 * 24 * $f_user_reg_more); |
||||
| 252 | if ($time > 0) { |
||||
| 253 | $criteria->add(new Criteria('user_regdate', $time, '<')); |
||||
| 254 | } |
||||
| 255 | } |
||||
| 256 | if (!empty($_POST['user_reg_less']) && is_numeric($_POST['user_reg_less'])) { |
||||
| 257 | $f_user_reg_less = Request::getInt('user_reg_less', 0, 'POST'); |
||||
| 258 | $time = time() - (60 * 60 * 24 * $f_user_reg_less); |
||||
| 259 | if ($time > 0) { |
||||
| 260 | $criteria->add(new Criteria('user_regdate', $time, '>')); |
||||
| 261 | } |
||||
| 262 | } |
||||
| 263 | if (isset($_POST['user_posts_more']) && is_numeric($_POST['user_posts_more'])) { |
||||
| 264 | $criteria->add(new Criteria('posts', Request::getInt('user_posts_more', 0, 'POST'), '>')); |
||||
| 265 | } |
||||
| 266 | if (!empty($_POST['user_posts_less']) && is_numeric($_POST['user_posts_less'])) { |
||||
| 267 | $criteria->add(new Criteria('posts', Request::getInt('user_posts_less', 0, 'POST'), '<')); |
||||
| 268 | } |
||||
| 269 | $criteria->add(new Criteria('level', 0, '>')); |
||||
| 270 | $validsort = ['uname', 'email', 'last_login', 'user_regdate', 'posts']; |
||||
| 271 | $sort = !in_array(Request::getString('user_sort', 'uname', 'POST'), $validsort, true); |
||||
| 272 | $order = 'ASC'; |
||||
| 273 | if (isset($_POST['user_order']) && 'DESC' === Request::getString('user_order', '', 'POST')) { |
||||
| 274 | $order = 'DESC'; |
||||
| 275 | } |
||||
| 276 | $limit = Request::getInt('limit', 20, 'POST'); |
||||
| 277 | if (0 === $limit || $limit > 50) { |
||||
| 278 | $limit = 50; |
||||
| 279 | } |
||||
| 280 | $start = Request::getInt('start', 0, 'POST'); |
||||
| 281 | /** @var XoopsMemberHandler $memberHandler */ |
||||
| 282 | $memberHandler = xoops_getHandler('member'); |
||||
| 283 | $total = $memberHandler->getUserCount($criteria); |
||||
| 284 | $xoopsTpl->assign('lang_search', _MD_SUICO_SEARCH); |
||||
| 285 | $xoopsTpl->assign('lang_results', _MD_SUICO_RESULTS); |
||||
| 286 | $xoopsTpl->assign('total_found', $total); |
||||
| 287 | if (0 === $total) { |
||||
| 288 | $xoopsTpl->assign('lang_nonefound', _MD_SUICO_NOFOUND); |
||||
| 289 | } elseif ($start < $total) { |
||||
| 290 | $xoopsTpl->assign('lang_username', _MD_SUICO_UNAME); |
||||
| 291 | $xoopsTpl->assign('lang_realname', _MD_SUICO_REALNAME); |
||||
| 292 | $xoopsTpl->assign('lang_avatar', _MD_SUICO_AVATAR); |
||||
| 293 | $xoopsTpl->assign('lang_email', _MD_SUICO_EMAIL); |
||||
| 294 | $xoopsTpl->assign('lang_privmsg', _MD_SUICO_PM); |
||||
| 295 | $xoopsTpl->assign('lang_regdate', _MD_SUICO_REGDATE); |
||||
| 296 | $xoopsTpl->assign('lang_lastlogin', _MD_SUICO_LASTLOGIN); |
||||
| 297 | $xoopsTpl->assign('lang_posts', _MD_SUICO_POSTS); |
||||
| 298 | $xoopsTpl->assign('lang_url', _MD_SUICO_URL); |
||||
| 299 | $xoopsTpl->assign('lang_admin', _MD_SUICO_ADMIN); |
||||
| 300 | if ($iamadmin) { |
||||
| 301 | $xoopsTpl->assign('is_admin', true); |
||||
| 302 | } |
||||
| 303 | $criteria->setSort($sort); |
||||
| 304 | $criteria->setOrder($order); |
||||
| 305 | $criteria->setStart($start); |
||||
| 306 | $criteria->setLimit($limit); |
||||
| 307 | $foundusers = $memberHandler->getUsers($criteria, true); |
||||
| 308 | foreach (array_keys($foundusers) as $j) { |
||||
| 309 | $userdata['avatar'] = $foundusers[$j]->getVar('user_avatar'); |
||||
| 310 | $userdata['realname'] = $foundusers[$j]->getVar('name'); |
||||
| 311 | $userdata['name'] = $foundusers[$j]->getVar('uname'); |
||||
| 312 | $userdata['id'] = $foundusers[$j]->getVar('uid'); |
||||
| 313 | $userdata['uid'] = $foundusers[$j]->getVar('uid'); |
||||
| 314 | $criteria_friends = new Criteria('friend1_uid', $controller->uidOwner); |
||||
| 315 | $criteriaIsfriend = new CriteriaCompo(new Criteria('friend2_uid', $userdata['uid'])); |
||||
| 316 | $criteriaIsfriend->add($criteria_friends); |
||||
| 317 | $controller->isFriend = $controller->friendshipsFactory->getCount($criteriaIsfriend); |
||||
| 318 | $userdata['isFriend'] = $controller->isFriend; |
||||
| 319 | $friendrequestFactory = new FriendrequestHandler($xoopsDB); |
||||
| 320 | $criteria_selfrequest = new Criteria('friendrequester_uid', $controller->uidOwner); |
||||
| 321 | $criteria_isselfrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $userdata['uid'])); |
||||
| 322 | $criteria_isselfrequest->add($criteria_selfrequest); |
||||
| 323 | $controller->isSelfRequest = $friendrequestFactory->getCount($criteria_isselfrequest); |
||||
| 324 | $userdata['selffriendrequest'] = $controller->isSelfRequest; |
||||
| 325 | if ($controller->isSelfRequest > 0) { |
||||
| 326 | $xoopsTpl->assign('self_uid', $controller->uidOwner); |
||||
| 327 | } |
||||
| 328 | $xoopsTpl->assign('lang_myfriend', _MD_SUICO_MYFRIEND); |
||||
| 329 | $xoopsTpl->assign('lang_friendrequestsent', _MD_SUICO_FRIENDREQUEST_SENT); |
||||
| 330 | $xoopsTpl->assign('lang_friendshipstatus', _MD_SUICO_FRIENDSHIP_STATUS); |
||||
| 331 | $criteria_otherrequest = new Criteria('friendrequester_uid', $userdata['uid']); |
||||
| 332 | $criteria_isotherrequest = new CriteriaCompo(new Criteria('friendrequestto_uid', $controller->uidOwner)); |
||||
| 333 | $criteria_isotherrequest->add($criteria_otherrequest); |
||||
| 334 | $controller->isOtherRequest = $friendrequestFactory->getCount($criteria_isotherrequest); |
||||
| 335 | $userdata['otherfriendrequest'] = $controller->isOtherRequest; |
||||
| 336 | if ($controller->isOtherRequest > 0) { |
||||
| 337 | $xoopsTpl->assign('other_uid', $userdata['uid']); |
||||
| 338 | } |
||||
| 339 | if (1 === $foundusers[$j]->getVar('user_viewemail') || $iamadmin) { |
||||
| 340 | $userdata['email'] = "<a href='mailto:" . $foundusers[$j]->getVar( |
||||
| 341 | 'email' |
||||
| 342 | ) . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' border='0' alt='" . sprintf( |
||||
| 343 | _SENDEMAILTO, |
||||
| 344 | $foundusers[$j]->getVar('uname', 'E') |
||||
| 345 | ) . "'></a>"; |
||||
| 346 | $userdata['emailaddress'] = $foundusers[$j]->getVar('email'); |
||||
| 347 | } else { |
||||
| 348 | $userdata['email'] = ' '; |
||||
| 349 | } |
||||
| 350 | if ($xoopsUser) { |
||||
| 351 | $userdata['pmlink'] = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $foundusers[$j]->getVar( |
||||
| 352 | 'uid' |
||||
| 353 | ) . "\",\"pmlite\",450,370);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' border='0' alt='" . sprintf( |
||||
| 354 | _SENDPMTO, |
||||
| 355 | $foundusers[$j]->getVar( |
||||
| 356 | 'uname', |
||||
| 357 | 'E' |
||||
| 358 | ) |
||||
| 359 | ) . "'></a>"; |
||||
| 360 | $userdata['pm'] = $foundusers[$j]->getVar('uid'); |
||||
| 361 | } else { |
||||
| 362 | $userdata['pmlink'] = ' '; |
||||
| 363 | } |
||||
| 364 | if ('' !== $foundusers[$j]->getVar('url', 'E')) { |
||||
| 365 | $userdata['website'] = "<a href='" . $foundusers[$j]->getVar( |
||||
| 366 | 'url', |
||||
| 367 | 'E' |
||||
| 368 | ) . "' target='_blank'><img src='" . XOOPS_URL . "/images/icons/www.gif' border='0' alt='" . _VISITWEBSITE . "'></a>"; |
||||
| 369 | } else { |
||||
| 370 | $userdata['website'] = ' '; |
||||
| 371 | } |
||||
| 372 | $userdata['url'] = $foundusers[$j]->getVar('url', 'e'); |
||||
| 373 | $userdata['registerdate'] = formatTimestamp($foundusers[$j]->getVar('user_regdate'), 's'); |
||||
| 374 | if (0 !== $foundusers[$j]->getVar('last_login')) { |
||||
| 375 | $userdata['lastlogin'] = formatTimestamp($foundusers[$j]->getVar('last_login'), 'm'); |
||||
| 376 | } else { |
||||
| 377 | $userdata['lastlogin'] = _MD_SUICO_NEVERLOGIN; |
||||
| 378 | } |
||||
| 379 | $userdata['posts'] = $foundusers[$j]->getVar('posts'); |
||||
| 380 | if ($iamadmin) { |
||||
| 381 | $userdata['adminlink'] = "<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&uid=' . (int)$foundusers[$j]->getVar( |
||||
| 382 | 'uid' |
||||
| 383 | ) . "&op=modifyUser'>" . _EDIT . "</a> <a href='" . XOOPS_URL . '/modules/system/admin.php?fct=users&op=delUser&uid=' . (int)$foundusers[$j]->getVar( |
||||
| 384 | 'uid' |
||||
| 385 | ) . "'>" . _DELETE . '</a>'; |
||||
| 386 | } |
||||
| 387 | $userdata['location'] = $foundusers[$j]->getVar('user_from'); |
||||
| 388 | $userdata['occupation'] = $foundusers[$j]->getVar('user_occ'); |
||||
| 389 | $userdata['interest'] = $foundusers[$j]->getVar('user_intrest'); |
||||
| 390 | $userdata['extrainfo'] = $foundusers[$j]->getVar('bio'); |
||||
| 391 | $userdata['signature'] = $foundusers[$j]->getVar('user_sig'); |
||||
| 392 | $userdata['onlinestatus'] = $foundusers[$j]->isOnline(); |
||||
| 393 | $userrank = $foundusers[$j]->rank(); |
||||
| 394 | if ($userrank['image']) { |
||||
| 395 | $userdata['rankimage'] = '<img src="' . XOOPS_UPLOAD_URL . '/' . $userrank['image'] . '" alt="">'; |
||||
| 396 | } |
||||
| 397 | $userdata['ranktitle'] = $userrank['title']; |
||||
| 398 | $uid = $userdata['id']; |
||||
| 399 | $groups = $memberHandler->getGroupsByUser($uid, true); |
||||
| 400 | $usergroups = []; |
||||
| 401 | foreach ($groups as $group) { |
||||
| 402 | $usergroups[] = $group->getVar('name'); |
||||
| 403 | } |
||||
| 404 | $userdata['groups'] = implode(', ', $usergroups); |
||||
| 405 | $xoopsTpl->append('users', $userdata); |
||||
| 406 | } |
||||
| 407 | $totalpages = ceil($total / $limit); |
||||
| 408 | if ($totalpages > 1) { |
||||
| 409 | $hiddenform = "<form name='findnext' action='searchmembers.php' method='post'>"; |
||||
| 410 | foreach ($_POST as $k => $v) { |
||||
| 411 | $hiddenform .= "<input type='hidden' name='" . htmlspecialchars($k, ENT_QUOTES | ENT_HTML5) . "' value='" . htmlspecialchars($v, ENT_QUOTES | ENT_HTML5) . "'>\n"; |
||||
| 412 | } |
||||
| 413 | if (!isset($_POST['limit'])) { |
||||
| 414 | $hiddenform .= "<input type='hidden' name='limit' value='" . $limit . "'>\n"; |
||||
| 415 | } |
||||
| 416 | if (!isset($_POST['start'])) { |
||||
| 417 | $hiddenform .= "<input type='hidden' name='start' value='" . $start . "'>\n"; |
||||
| 418 | } |
||||
| 419 | $prev = $start - $limit; |
||||
| 420 | if ($start - $limit >= 0) { |
||||
| 421 | $hiddenform .= "<a href='#0' onclick='document.findnext.start.value=" . $prev . ";document.findnext.submit();'>" . _MD_SUICO_PREVIOUS . "</a> \n"; |
||||
| 422 | } |
||||
| 423 | $counter = 1; |
||||
| 424 | $currentpage = ($start + $limit) / $limit; |
||||
| 425 | while ($counter <= $totalpages) { |
||||
| 426 | if ($counter === $currentpage) { |
||||
| 427 | $hiddenform .= '<b>' . $counter . '</b> '; |
||||
| 428 | } elseif (($counter > $currentpage - 4 && $counter < $currentpage + 4) || 1 === $counter || $counter === $totalpages) { |
||||
| 429 | if ($counter === $totalpages && $currentpage < $totalpages - 4) { |
||||
| 430 | $hiddenform .= '... '; |
||||
| 431 | } |
||||
| 432 | $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...
|
|||||
| 433 | if (1 === $counter && $currentpage > 5) { |
||||
| 434 | $hiddenform .= '... '; |
||||
| 435 | } |
||||
| 436 | } |
||||
| 437 | $counter++; |
||||
| 438 | } |
||||
| 439 | $next = $start + $limit; |
||||
| 440 | if ($total > $next) { |
||||
| 441 | $hiddenform .= " <a href='#" . $total . "' onclick='document.findnext.start.value=" . $next . ";document.findnext.submit();'>" . _MD_SUICO_NEXT . "</a>\n"; |
||||
| 442 | } |
||||
| 443 | $hiddenform .= '</form>'; |
||||
| 444 | $xoopsTpl->assign('pagenav', $hiddenform); |
||||
| 445 | $xoopsTpl->assign('lang_numfound', sprintf(_MD_SUICO_USER_SFOUND, $total)); |
||||
| 446 | } |
||||
| 447 | } |
||||
| 448 | } |
||||
| 449 | //requests to become friend |
||||
| 450 | $xoopsTpl->assign('lang_askusertobefriend', _MD_SUICO_ASKBEFRIEND); |
||||
| 451 | $xoopsTpl->assign('lang_addfriend', _MD_SUICO_ADDFRIEND); |
||||
| 452 | $xoopsTpl->assign('lang_friendshippending', _MD_SUICO_FRIENDREQUEST_PENDING); |
||||
| 453 | $xoopsTpl->assign('lang_cancelfriendrequest', _MD_SUICO_FRIENDREQUEST_CANCEL); |
||||
| 454 | if (isset($_POST['addfriend'])) { |
||||
| 455 | $newFriendrequest = $friendrequestFactory->create(true); |
||||
| 456 | $newFriendrequest->setVar('friendrequester_uid', $controller->uidOwner); |
||||
| 457 | $newFriendrequest->setVar('friendrequestto_uid', 5, 0, 'POST'); |
||||
| 458 | $friendrequestFactory->insert2($newFriendrequest); |
||||
| 459 | redirect_header( |
||||
| 460 | XOOPS_URL . '/modules/suico/index.php?uid=' . Request::getInt('friendrequestfrom_uid', 0, 'POST'), |
||||
| 461 | 3, |
||||
| 462 | _MD_SUICO_FRIENDREQUEST_FROM |
||||
| 463 | ); |
||||
| 464 | } |
||||
| 465 | $memberHandler = xoops_getHandler('member'); |
||||
| 466 | $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...
|
|||||
| 467 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 468 | //navbar |
||||
| 469 | $xoopsTpl->assign('lang_mysection', _MD_SUICO_SEARCH); |
||||
| 470 | $xoopsTpl->assign('section_name', _MD_SUICO_SEARCH); |
||||
| 471 | // temporary solution for profile module integration |
||||
| 472 | if (xoops_isActiveModule('profile')) { |
||||
| 473 | $profileHandler = $helper->getHandler('Profile'); |
||||
| 474 | $uid = $controller->uidOwner; |
||||
| 475 | if ($uid <= 0) { |
||||
| 476 | if (is_object($xoopsUser)) { |
||||
| 477 | $profile = $profileHandler->get($uid); |
||||
| 478 | } else { |
||||
| 479 | header('location: ' . XOOPS_URL); |
||||
| 480 | exit(); |
||||
| 481 | } |
||||
| 482 | } else { |
||||
| 483 | $profile = $profileHandler->get($uid); |
||||
| 484 | } |
||||
| 485 | } |
||||
| 486 | require __DIR__ . '/footer.php'; |
||||
| 487 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 488 |
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: