XoopsModules25x /
wfdownloads
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 |
||
| 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 | * Wfdownloads module |
||
| 14 | * |
||
| 15 | * @copyright XOOPS Project (https://xoops.org) |
||
| 16 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 17 | * @package wfdownload |
||
| 18 | * @since 3.23 |
||
| 19 | * @author Xoops Development Team |
||
| 20 | */ |
||
| 21 | |||
| 22 | use Xmf\Module\Admin; |
||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Wfdownloads\{ |
||
| 25 | Helper, |
||
| 26 | Utility, |
||
| 27 | ObjectTree, |
||
| 28 | MulticolumnsThemeForm |
||
| 29 | }; |
||
| 30 | /** @var Helper $helper */ |
||
| 31 | /** @var Utility $utility */ |
||
| 32 | |||
| 33 | $currentFile = basename(__FILE__); |
||
| 34 | require_once __DIR__ . '/admin_header.php'; |
||
| 35 | |||
| 36 | /** @var \XoopsMemberHandler $memberHandler */ |
||
| 37 | $memberHandler = xoops_getHandler('member'); |
||
| 38 | |||
| 39 | $op = Request::getString('op', 'reports.modifications.list'); |
||
| 40 | switch ($op) { |
||
| 41 | case 'reports.update': |
||
| 42 | $lid = Request::getInt('lid', 0); |
||
| 43 | $criteria = new Criteria('lid', $lid); |
||
| 44 | if (Request::hasVar('ack', 'GET')) { |
||
| 45 | $acknowledged = (isset($_GET['ack']) && 0 == $_GET['ack']) ? 1 : 0; |
||
| 46 | $helper->getHandler('Report')->updateAll('acknowledged', $acknowledged, $criteria, true); |
||
| 47 | $update_mess = _AM_WFDOWNLOADS_BROKEN_NOWACK; |
||
| 48 | } |
||
| 49 | if (Request::hasVar('con', 'GET')) { |
||
| 50 | $confirmed = (isset($_GET['con']) && 0 == $_GET['con']) ? 1 : 0; |
||
| 51 | $helper->getHandler('Report')->updateAll('confirmed', $confirmed, $criteria, true); |
||
| 52 | $update_mess = _AM_WFDOWNLOADS_BROKEN_NOWCON; |
||
| 53 | } |
||
| 54 | redirect_header($currentFile, 1, $update_mess); |
||
| 55 | break; |
||
| 56 | case 'report.delete': |
||
| 57 | $lid = Request::getInt('lid', 0); |
||
| 58 | $criteria = new Criteria('lid', $lid); |
||
| 59 | $reportObjs = $helper->getHandler('Report')->getObjects($criteria); |
||
| 60 | if (isset($reportObjs[0])) { |
||
| 61 | $helper->getHandler('Report')->delete($reportObjs[0], true); |
||
| 62 | } |
||
| 63 | $downloadObj = $helper->getHandler('Download')->get($lid); |
||
| 64 | $helper->getHandler('Download')->delete($downloadObj, true); |
||
| 65 | redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKENFILEDELETED); |
||
| 66 | break; |
||
| 67 | case 'report.ignore': |
||
| 68 | $lid = Request::getInt('lid', 0); |
||
| 69 | $criteria = new Criteria('lid', $lid); |
||
| 70 | $reportObjs = $helper->getHandler('Report')->getObjects($criteria); |
||
| 71 | if (isset($reportObjs[0])) { |
||
| 72 | $helper->getHandler('Report')->delete($reportObjs[0], true); |
||
| 73 | } |
||
| 74 | redirect_header($currentFile, 1, _AM_WFDOWNLOADS_BROKEN_FILEIGNORED); |
||
| 75 | break; |
||
| 76 | case 'modification.show': |
||
| 77 | $requestid = Request::getInt('requestid', 0); |
||
| 78 | |||
| 79 | $modificationObj = $helper->getHandler('Modification')->get($requestid); |
||
| 80 | $modify_user = new XoopsUser($modificationObj->getVar('modifysubmitter')); |
||
| 81 | $modifyname = XoopsUserUtility::getUnameFromId((int)$modify_user->getVar('uid')); |
||
| 82 | $modifyemail = $modify_user->getVar('email'); |
||
| 83 | |||
| 84 | $downloadObj = $helper->getHandler('Download')->get($modificationObj->getVar('lid')); |
||
| 85 | $orig_user = new XoopsUser($downloadObj->getVar('submitter')); |
||
| 86 | $submittername = XoopsUserUtility::getUnameFromId($downloadObj->getVar('submitter')); // $orig_user->getvar("uname"); |
||
| 87 | $submitteremail = $orig_user->getVar('email'); |
||
| 88 | |||
| 89 | $categoryObjs = $helper->getHandler('Category')->getObjects(); |
||
| 90 | $categoryObjsTree = new ObjectTree($categoryObjs, 'cid', 'pid'); |
||
| 91 | |||
| 92 | Utility::getCpHeader(); |
||
| 93 | |||
| 94 | // IN PROGRESS |
||
| 95 | // IN PROGRESS |
||
| 96 | // IN PROGRESS |
||
| 97 | // IN PROGRESS NEW FROM HERE |
||
| 98 | |||
| 99 | echo '<div><b>' . _AM_WFDOWNLOADS_MOD_MODPOSTER . "</b> $submittername</div>"; |
||
| 100 | echo '<div><b>' . _AM_WFDOWNLOADS_MOD_MODIFYSUBMITTER . "</b> $modifyname</div>"; |
||
| 101 | |||
| 102 | $mcform = new MulticolumnsThemeForm('', 'modificationform', $currentFile); |
||
| 103 | |||
| 104 | // Get download keys |
||
| 105 | $downloadVars = $downloadObj->getVars(); |
||
| 106 | $downloadKeys = array_keys($downloadVars); |
||
| 107 | // Get modification keys |
||
| 108 | $modificationVars = $modificationObj->getVars(); |
||
| 109 | $modificationKeys = array_keys($modificationVars); |
||
| 110 | // Get common keys |
||
| 111 | $commonKeys = array_intersect($downloadKeys, $modificationKeys); |
||
| 112 | // Set not allowed keys |
||
| 113 | $notAllowedKeys = [ |
||
| 114 | 'lid', |
||
| 115 | 'submitter', |
||
| 116 | 'publisher', |
||
| 117 | 'requestid', |
||
| 118 | 'forumid', |
||
| 119 | 'modifysubmitter', |
||
| 120 | 'paypalemail', |
||
| 121 | ]; |
||
| 122 | |||
| 123 | $i = 0; |
||
| 124 | $mcform->addElement(null, false, null, null); |
||
| 125 | $mcform->setTitles(['', _AM_WFDOWNLOADS_MOD_ORIGINAL, _AM_WFDOWNLOADS_MOD_PROPOSED]); |
||
| 126 | $i = 1; |
||
| 127 | foreach ($commonKeys as $key) { |
||
| 128 | if (in_array($key, $notAllowedKeys)) { |
||
| 129 | continue; |
||
| 130 | } |
||
| 131 | $caption = constant('_AM_WFDOWNLOADS_MOD_' . mb_strtoupper($key)); |
||
| 132 | $downloadContent = $downloadObj->getVar($key); |
||
| 133 | $modificationContent = $modificationObj->getVar($key); |
||
| 134 | // Extra jobs for some keys |
||
| 135 | switch ($key) { |
||
| 136 | case 'title': |
||
| 137 | case 'url': |
||
| 138 | // NOP |
||
| 139 | break; |
||
| 140 | case 'size': |
||
| 141 | $downloadContent = Utility::bytesToSize1024($downloadContent); |
||
| 142 | |||
| 143 | $modificationContent = Utility::bytesToSize1024($modificationContent); |
||
| 144 | break; |
||
| 145 | case 'date': |
||
| 146 | case 'published': |
||
| 147 | case 'expired': |
||
| 148 | case 'updated': |
||
| 149 | $downloadContent = (false !== $downloadContent) ? XoopsLocal::formatTimestamp($downloadContent, 'l') : _NO; |
||
| 150 | |||
| 151 | $modificationContent = (false !== $modificationContent) ? XoopsLocal::formatTimestamp($modificationContent, 'l') : _NO; |
||
| 152 | break; |
||
| 153 | case 'platform': |
||
| 154 | case 'license': |
||
| 155 | case 'limitations': |
||
| 156 | case 'versiontypes': |
||
| 157 | $tempArray = $helper->getConfig($key); |
||
| 158 | $downloadContent = $tempArray[$downloadObj->getVar($key)] ?? ''; |
||
| 159 | |||
| 160 | $modificationContent = $tempArray[$modificationObj->getVar($key)] ?? ''; |
||
| 161 | break; |
||
| 162 | case 'cid': |
||
| 163 | $category_list = $helper->getHandler('Category')->getObjects(new Criteria('cid', $downloadObj->getVar($key))); |
||
| 164 | if (!isset($category_list[0])) { |
||
| 165 | continue 2; |
||
| 166 | } |
||
| 167 | $downloadContent = $category_list[0]->getVar('title', 'e'); |
||
| 168 | |||
| 169 | $category_list = $helper->getHandler('Category')->getObjects(new Criteria('cid', $modificationObj->getVar($key))); |
||
| 170 | if (!isset($category_list[0])) { |
||
| 171 | continue 2; |
||
| 172 | } |
||
| 173 | $modificationContent = $category_list[0]->getVar('title', 'e'); |
||
| 174 | break; |
||
| 175 | case 'screenshot': |
||
| 176 | case 'screenshot2': |
||
| 177 | case 'screenshot3': |
||
| 178 | case 'screenshot4': |
||
| 179 | if ('' != $downloadContent) { |
||
| 180 | $downloadContent = "<img src='" . XOOPS_URL . "/{$helper->getConfig('screenshots')}/{$downloadContent}' width='{$helper->getConfig('shotwidth')}' alt='' title=''>"; |
||
| 181 | } |
||
| 182 | |||
| 183 | if ('' != $modificationContent) { |
||
| 184 | $modificationContent = "<img src='" . XOOPS_URL . "/{$helper->getConfig('screenshots')}/{$modificationContent}' width='{$helper->getConfig('shotwidth')}' alt='' title=''>"; |
||
| 185 | } |
||
| 186 | break; |
||
| 187 | case 'screenshots': |
||
| 188 | $downloadScreenshots = $downloadContent; |
||
| 189 | $modificationScreenshots = $modificationContent; |
||
| 190 | unset($downloadContent, $modificationContent); |
||
| 191 | $downloadContent = ''; |
||
| 192 | $modificationContent = ''; |
||
| 193 | foreach ($downloadScreenshots as $key => $value) { |
||
|
0 ignored issues
–
show
Comprehensibility
Bug
introduced
by
Loading history...
|
|||
| 194 | $downloadScreenshot = $downloadScreenshots[$key]; |
||
| 195 | $modificationScreenshot = $modificationScreenshots[$key]; |
||
| 196 | if ('' != $downloadScreenshot) { |
||
| 197 | $downloadContent += "<img src='" . XOOPS_URL . "/{$helper->getConfig('screenshots')}/{$downloadScreenshot}' width='{$helper->getConfig( |
||
| 198 | 'shotwidth' |
||
| 199 | )}' alt='' title=''>"; |
||
| 200 | } |
||
| 201 | |||
| 202 | if ('' != $modificationContent) { |
||
| 203 | $modificationContent += "<img src='" . XOOPS_URL . "/{$helper->getConfig('screenshots')}/{$modificationScreenshot}' width='{$helper->getConfig( |
||
| 204 | 'shotwidth' |
||
| 205 | )}' alt='' title=''>"; |
||
| 206 | } |
||
| 207 | } |
||
| 208 | break; |
||
| 209 | case 'publisher': |
||
| 210 | $downloadContent = XoopsUserUtility::getUnameFromId($downloadContent); |
||
| 211 | |||
| 212 | $modificationContent = XoopsUserUtility::getUnameFromId($modificationContent); |
||
| 213 | break; |
||
| 214 | case 'features': |
||
| 215 | case 'requirements': |
||
| 216 | if ('' != $downloadContent) { |
||
| 217 | $downrequirements = explode('|', trim($downloadContent)); |
||
| 218 | $downloadContent = '<ul>'; |
||
| 219 | foreach ($downrequirements as $bi) { |
||
| 220 | $downloadContent .= "<li>{$bi}</li>"; |
||
| 221 | } |
||
| 222 | $downloadContent .= '</ul>'; |
||
| 223 | } |
||
| 224 | |||
| 225 | if ('' != $modificationContent) { |
||
| 226 | $downrequirements = explode('|', trim($modificationContent)); |
||
| 227 | $modificationContent = '<ul>'; |
||
| 228 | foreach ($downrequirements as $bi) { |
||
| 229 | $modificationContent .= "<li>{$bi}</li>"; |
||
| 230 | } |
||
| 231 | $modificationContent .= '</ul>'; |
||
| 232 | } |
||
| 233 | break; |
||
| 234 | case 'dhistory': |
||
| 235 | $downloadContent = &$myts->displayTarea($downloadContent, true, false, false, false, true); |
||
| 236 | |||
| 237 | $modificationContent = &$myts->displayTarea($modificationContent, true, false, false, false, true); |
||
| 238 | break; |
||
| 239 | case 'summary': |
||
| 240 | case 'description': |
||
| 241 | $downloadContent = $downloadContent; //The left and the right parts of assignment are equal |
||
| 242 | //IN PROGRESS? |
||
| 243 | $modificationContent = $modificationContent; //The left and the right parts of assignment are equal |
||
| 244 | break; |
||
| 245 | case 'offline': |
||
| 246 | case 'dohtml': |
||
| 247 | case 'dosmiley': |
||
| 248 | case 'doxcode': |
||
| 249 | case 'doimage': |
||
| 250 | case 'dobr': |
||
| 251 | $downloadContent = $downloadContent ? _YES : _NO; |
||
| 252 | |||
| 253 | $modificationContent = $modificationContent ? _YES : _NO; |
||
| 254 | } |
||
| 255 | $mcform->addElement($caption, false, $i, 0); |
||
| 256 | if ($downloadContent != $modificationContent) { |
||
| 257 | $modificationContent = "<span style='color:red;'>" . $modificationContent . '</span>'; |
||
| 258 | } |
||
| 259 | $downloadFormElement = new XoopsFormLabel('', $downloadContent); |
||
| 260 | $modificationFormElement = new XoopsFormLabel('', $modificationContent); |
||
| 261 | $mcform->addElement($downloadFormElement, false, $i, 1); |
||
| 262 | $mcform->addElement($modificationFormElement, false, $i, 2); |
||
| 263 | ++$i; |
||
| 264 | } |
||
| 265 | |||
| 266 | $buttonTray = new XoopsFormElementTray('', ''); |
||
| 267 | $buttonTray->addElement(new XoopsFormHidden('requestid', $requestid)); |
||
| 268 | $buttonTray->addElement(new XoopsFormHidden('lid', (int)$modificationObj->getVar('lid'))); |
||
| 269 | $hidden = new XoopsFormHidden('op', 'modification.change'); |
||
| 270 | $buttonTray->addElement($hidden); |
||
| 271 | if (!$modificationObj->isNew()) { |
||
| 272 | $approveButton = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BAPPROVE, 'submit'); |
||
| 273 | $approveButton->setExtra('onclick="this.form.elements.op.value=\'modification.change\'"'); |
||
| 274 | $buttonTray->addElement($approveButton); |
||
| 275 | } |
||
| 276 | $ignoreButton = new XoopsFormButton('', '', _AM_WFDOWNLOADS_BIGNORE, 'submit'); |
||
| 277 | $ignoreButton->setExtra('onclick="this.form.elements.op.value=\'modification.ignore\'"'); |
||
| 278 | $buttonTray->addElement($ignoreButton); |
||
| 279 | $buttonCancel = new XoopsFormButton('', '', _CANCEL, 'button'); |
||
| 280 | $buttonCancel->setExtra('onclick="history.go(-1)"'); |
||
| 281 | $buttonTray->addElement($buttonCancel); |
||
| 282 | $mcform->addElement($buttonTray, false, $i, 2); |
||
| 283 | |||
| 284 | $mcform->display(); |
||
| 285 | |||
| 286 | xoops_cp_footer(); |
||
| 287 | exit(); |
||
| 288 | break; |
||
| 289 | case 'modification.change': |
||
| 290 | /* Added by Lankford on 2007/3/21 */ |
||
| 291 | // Get a pointer to the download record and the modification record, then compare their 'versions' to see if they are different. If they are, then raise filemodify events. |
||
| 292 | $requestid = Request::getInt('requestid', 0, 'POST'); |
||
| 293 | |||
| 294 | $modificationObj = $helper->getHandler('Modification')->get($requestid); |
||
| 295 | $downloadObj = $helper->getHandler('Download')->get($modificationObj->getVar('lid')); |
||
| 296 | |||
| 297 | $raiseModifyEvents = true; |
||
| 298 | if ($modificationObj->getVar('version') == $downloadObj->getVar('version')) { |
||
| 299 | $raiseModifyEvents = false; |
||
| 300 | } |
||
| 301 | /* end add block */ |
||
| 302 | $helper->getHandler('Modification')->approveModification($_POST['requestid']); |
||
| 303 | |||
| 304 | $cid = $downloadObj->getVar('cid'); |
||
| 305 | $lid = $downloadObj->getVar('lid'); |
||
| 306 | |||
| 307 | /* Added by lankford on 2007/3/21 */ |
||
| 308 | if ($raiseModifyEvents) { |
||
| 309 | // Trigger the three events related to modified files (one for the file, category, and global event categories respectively) |
||
| 310 | $tags = []; |
||
| 311 | $tags['FILE_NAME'] = $downloadObj->getVar('title'); |
||
| 312 | $tags['FILE_URL'] = WFDOWNLOADS_URL . '/singlefile.php?cid=' . $cid . '&lid=' . $lid; |
||
|
0 ignored issues
–
show
|
|||
| 313 | $category = $helper->getHandler('Category')->get($cid); |
||
| 314 | $tags['FILE_VERSION'] = $downloadObj->getVar('version'); |
||
| 315 | $tags['CATEGORY_NAME'] = $category->getVar('title'); |
||
| 316 | $tags['CATEGORY_URL'] = WFDOWNLOADS_URL . '/viewcat.php?cid=' . $cid; |
||
| 317 | |||
| 318 | $notificationHandler->triggerEvent('global', 0, 'filemodified', $tags); |
||
| 319 | $notificationHandler->triggerEvent('category', $cid, 'filemodified', $tags); |
||
| 320 | $notificationHandler->triggerEvent('file', $lid, 'filemodified', $tags); |
||
| 321 | } |
||
| 322 | /* end add block */ |
||
| 323 | |||
| 324 | redirect_header($currentFile, 1, _AM_WFDOWNLOADS_MOD_REQUPDATED); |
||
| 325 | break; |
||
| 326 | case 'modification.ignore': |
||
| 327 | case 'modification.delete': |
||
| 328 | $requestid = Request::getInt('requestid', 0); |
||
| 329 | $ok = Request::getBool('ok', false, 'POST'); |
||
| 330 | if (!$modificationObj = $helper->getHandler('Modification')->get($requestid)) { |
||
| 331 | redirect_header($currentFile, 4, _AM_WFDOWNLOADS_MOD_NOTFOUND); |
||
| 332 | } |
||
| 333 | $title = $modificationObj->getVar('title'); |
||
| 334 | if (true === $ok) { |
||
| 335 | /* |
||
| 336 | IN PROGRESS |
||
| 337 | IN PROGRESS |
||
| 338 | IN PROGRESS |
||
| 339 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 340 | redirect_header($currentFile, 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 341 | } |
||
| 342 | */ |
||
| 343 | if ($helper->getHandler('Modification')->deleteAll(new Criteria('requestid', $requestid), true)) { |
||
| 344 | redirect_header(WFDOWNLOADS_URL . '/admin/index.php', 1, _AM_WFDOWNLOADS_MOD_REQDELETED); |
||
| 345 | } else { |
||
| 346 | echo $modificationObj->getHtmlErrors(); |
||
| 347 | } |
||
| 348 | } else { |
||
| 349 | Utility::getCpHeader(); |
||
| 350 | xoops_confirm(['op' => 'modification.ignore', 'requestid' => $requestid, 'ok' => true, 'title' => $title], $currentFile, _AM_WFDOWNLOADS_MOD_REALLYIGNOREDTHIS . '<br><br>' . $title, _DELETE); |
||
| 351 | xoops_cp_footer(); |
||
| 352 | } |
||
| 353 | break; |
||
| 354 | case 'reports.modifications.list': |
||
| 355 | default: |
||
| 356 | $start_report = Request::getInt('start_report', 0); |
||
| 357 | |||
| 358 | $criteria = new CriteriaCompo(); |
||
| 359 | $reports_count = $helper->getHandler('Report')->getCount(); |
||
| 360 | $criteria->setSort('date'); |
||
| 361 | $criteria->setOrder('DESC'); |
||
| 362 | $criteria->setLimit($helper->getConfig('admin_perpage')); |
||
| 363 | $criteria->setStart($start_report); |
||
| 364 | $reportObjs = $helper->getHandler('Report')->getObjects($criteria); |
||
| 365 | |||
| 366 | Utility::getCpHeader(); |
||
| 367 | $adminObject = Admin::getInstance(); |
||
| 368 | $adminObject->displayNavigation($currentFile); |
||
| 369 | |||
| 370 | $GLOBALS['xoopsTpl']->assign('reports_count', $reports_count); |
||
| 371 | |||
| 372 | if ($reports_count > 0) { |
||
| 373 | $lids = []; |
||
| 374 | $uids = []; |
||
| 375 | foreach ($reportObjs as $reportObj) { |
||
| 376 | $lids[] = $reportObj->getVar('lid'); |
||
| 377 | $uids[] = $reportObj->getVar('sender'); |
||
| 378 | } |
||
| 379 | $downloadObjs = $helper->getHandler('Download')->getObjects(new Criteria('lid', '(' . implode(',', array_unique($lids)) . ')', 'IN'), true); |
||
| 380 | foreach (array_keys($downloadObjs) as $i) { |
||
| 381 | $uids[] = $downloadObjs[$i]->getVar('submitter'); |
||
| 382 | } |
||
| 383 | $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_unique($uids)) . ')', 'IN'), true); |
||
| 384 | |||
| 385 | foreach ($reportObjs as $reportObj) { |
||
| 386 | $report_array = $reportObj->toArray(); |
||
| 387 | // Does the download exists ? |
||
| 388 | if (isset($downloadObjs[$reportObj->getVar('lid')])) { |
||
| 389 | $downloadObj = $downloadObjs[$reportObj->getVar('lid')]; |
||
| 390 | $report_array['download_lid'] = $downloadObj->getVar('lid'); |
||
| 391 | $report_array['download_cid'] = $downloadObj->getVar('cid'); |
||
| 392 | $report_array['download_title'] = $downloadObj->getVar('title'); |
||
| 393 | $submitter = $users[$downloadObjs[$reportObj->getVar('lid')]->getVar('submitter')] ?? false; |
||
| 394 | $report_array['submitter_email'] = is_object($submitter) ? $submitter->getVar('email') : ''; |
||
| 395 | $report_array['submitter_uname'] = is_object($submitter) ? $submitter->getVar('uname') : $GLOBALS['xoopsConfig']['anonymous']; |
||
| 396 | } else { |
||
| 397 | $report_array['download_lid'] = false; |
||
| 398 | $download_link = _AM_WFDOWNLOADS_BROKEN_DOWNLOAD_DONT_EXISTS; |
||
| 399 | $report_array['submitter_email'] = ''; |
||
| 400 | $report_array['submitter_uname'] = $GLOBALS['xoopsConfig']['anonymous']; |
||
| 401 | } |
||
| 402 | $sender = $users[$reportObj->getVar('sender')] ?? ''; |
||
| 403 | $report_array['reporter_email'] = isset($users[$reportObj->getVar('sender')]) ? $users[$reportObj->getVar('sender')]->getVar('email') : ''; |
||
| 404 | $report_array['reporter_uname'] = isset($users[$reportObj->getVar('sender')]) ? $users[$reportObj->getVar('sender')]->getVar('uname') : $GLOBALS['xoopsConfig']['anonymous']; |
||
| 405 | $report_array['formatted_date'] = formatTimestamp($reportObj->getVar('date'), 'l'); |
||
| 406 | $GLOBALS['xoopsTpl']->append('reports', $report_array); |
||
| 407 | } |
||
| 408 | //Include page navigation |
||
| 409 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 410 | $pagenav_report = new XoopsPageNav($reports_count, $helper->getConfig('admin_perpage'), $start_report, 'start_report'); |
||
| 411 | $GLOBALS['xoopsTpl']->assign('reports_pagenav', $pagenav_report->renderNav()); |
||
| 412 | } |
||
| 413 | |||
| 414 | $start_modification = Request::getInt('start_modification', 0); |
||
| 415 | |||
| 416 | $modifications_count = $helper->getHandler('Modification')->getCount(); |
||
| 417 | $criteria = new CriteriaCompo(); |
||
| 418 | $criteria->setLimit($helper->getConfig('admin_perpage')); |
||
| 419 | $criteria->setStart($start_modification); |
||
| 420 | $criteria->setSort('requestdate'); |
||
| 421 | $modificationObjs = $helper->getHandler('Modification')->getObjects($criteria); |
||
| 422 | |||
| 423 | $GLOBALS['xoopsTpl']->assign('modifications_count', $modifications_count); |
||
| 424 | |||
| 425 | if ($modifications_count > 0) { |
||
| 426 | foreach ($modificationObjs as $modificationObj) { |
||
| 427 | $modification_array = $modificationObj->toArray(); |
||
| 428 | $modification_array['title'] = $modificationObj->getVar('title'); |
||
| 429 | $modification_array['submitter_uname'] = XoopsUserUtility::getUnameFromId($modificationObj->getVar('submitter')); |
||
| 430 | $modification_array['formatted_date'] = formatTimestamp($modificationObj->getVar('requestdate'), 'l'); |
||
| 431 | $downloadObj = $helper->getHandler('Download')->get($modificationObj->getVar('lid')); |
||
| 432 | $modification_array['download'] = $downloadObj->toArray(); |
||
| 433 | $GLOBALS['xoopsTpl']->append('modifications', $modification_array); |
||
| 434 | } |
||
| 435 | //Include page navigation |
||
| 436 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 437 | $pagenav_modification = new XoopsPageNav($modifications_count, $helper->getConfig('admin_perpage'), $start_modification, 'start_modification'); |
||
| 438 | $GLOBALS['xoopsTpl']->assign('modifications_pagenav', $pagenav_modification->renderNav()); |
||
| 439 | } |
||
| 440 | |||
| 441 | $xoopsTpl->assign('use_mirrors', $helper->getConfig('enable_mirrors')); |
||
| 442 | $xoopsTpl->assign('use_ratings', $helper->getConfig('enable_ratings')); |
||
| 443 | $xoopsTpl->assign('use_reviews', $helper->getConfig('enable_reviews')); |
||
| 444 | $xoopsTpl->assign('use_brokenreports', $helper->getConfig('enable_brokenreports')); |
||
| 445 | |||
| 446 | $GLOBALS['xoopsTpl']->display("db:{$helper->getModule()->dirname()}_am_reportsmodificationslist.tpl"); |
||
| 447 | |||
| 448 | require_once __DIR__ . '/admin_footer.php'; |
||
| 449 | break; |
||
| 450 | } |
||
| 451 |