XoopsModules25x /
lexikon
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Module: Lexikon - glossary module |
||||
| 4 | * changes: Yerres |
||||
| 5 | * Licence: GNU |
||||
| 6 | */ |
||||
| 7 | |||||
| 8 | use Xmf\Request; |
||||
| 9 | use XoopsModules\Lexikon\{ |
||||
| 10 | Helper, |
||||
| 11 | Utility |
||||
| 12 | }; |
||||
| 13 | /** @var Helper $helper */ |
||||
| 14 | |||||
| 15 | $GLOBALS['xoopsOption']['template_main'] = 'lx_profile.tpl'; |
||||
| 16 | require __DIR__ . '/header.php'; |
||||
| 17 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||
| 18 | global $xoopsModule, $xoopsUser; |
||||
| 19 | |||||
| 20 | |||||
| 21 | $helper = Helper::getInstance(); |
||||
| 22 | |||||
| 23 | $myts = \MyTextSanitizer::getInstance(); |
||||
| 24 | |||||
| 25 | if (empty($xoopsUser) && !$helper->getConfig('authorprofile')) { |
||||
| 26 | redirect_header(XOOPS_URL . '/user.php', 3, _MD_LEXIKON_MUSTREGFIRST); |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | // User & Perm validation |
||||
| 30 | $uid = Request::getInt('uid', 0, 'GET'); |
||||
| 31 | if (empty($uid)) { |
||||
| 32 | redirect_header('index.php', 2, _ERRORS); |
||||
| 33 | } |
||||
| 34 | $data = $utility::getUserData($uid); |
||||
| 35 | if (!$data) { |
||||
| 36 | redirect_header('index.php', 2, _MD_LEXIKON_UNKNOWNERROR); |
||||
| 37 | } |
||||
| 38 | //permissions |
||||
| 39 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
| 40 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
| 41 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||||
| 42 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
| 43 | $moduleHandler = xoops_getHandler('module'); |
||||
| 44 | $module = $moduleHandler->getByDirname('lexikon'); |
||||
| 45 | $module_id = $module->getVar('mid'); |
||||
| 46 | $allowed_cats = $grouppermHandler->getItemIds('lexikon_view', $groups, $module_id); |
||||
| 47 | $catids = implode(',', $allowed_cats); |
||||
| 48 | $catperms = " AND categoryID IN ($catids) "; |
||||
| 49 | |||||
| 50 | // basic functions_navi and get user data |
||||
| 51 | $thisuser = new \XoopsUser($uid); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 52 | $authname = $thisuser->getVar('uname'); |
||||
| 53 | |||||
| 54 | // get usertotals |
||||
| 55 | [$num] = $xoopsDB->fetchRow( |
||||
| 56 | $xoopsDB->query( |
||||
| 57 | 'SELECT COUNT(*) |
||||
| 58 | FROM ' . $xoopsDB->prefix('lxentries') . " |
||||
| 59 | WHERE uid='" . $uid . "' " . $catperms . " |
||||
| 60 | AND submit = '0' AND request = '0' |
||||
| 61 | AND offline = '0' |
||||
| 62 | " |
||||
| 63 | ) |
||||
| 64 | ); |
||||
| 65 | |||||
| 66 | // total results |
||||
| 67 | $authortermstotal = $num; |
||||
| 68 | |||||
| 69 | if ($authortermstotal >= $helper->getConfig('indexperpage')) { |
||||
| 70 | $xoopsTpl->assign('navi', true); |
||||
| 71 | } else { |
||||
| 72 | $xoopsTpl->assign('navi', false); |
||||
| 73 | } |
||||
| 74 | if (0 == $authortermstotal) { |
||||
| 75 | $xoopsTpl->assign('nothing', sprintf(_MD_LEXIKON_AUTHORPROFILENOTERM, $authname)); |
||||
|
0 ignored issues
–
show
It seems like
$authname can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 76 | } else { |
||||
| 77 | $xoopsTpl->assign('nothing', false); |
||||
| 78 | } |
||||
| 79 | // get infotext |
||||
| 80 | $result2 = $xoopsDB->query( |
||||
| 81 | 'SELECT COUNT(*) |
||||
| 82 | FROM ' . $xoopsDB->prefix('lxentries') . " |
||||
| 83 | WHERE uid='" . $uid . "' " . $catperms . " |
||||
| 84 | AND offline = '1' " |
||||
| 85 | ); |
||||
| 86 | [$totalwaiting] = $xoopsDB->fetchRow($result2); |
||||
| 87 | if (!$totalwaiting) { |
||||
| 88 | $xoopsTpl->assign('waiting', constant('_MD_LEXIKON_NOWAITINGTERMS')); |
||||
| 89 | } else { |
||||
| 90 | $xoopsTpl->assign('waiting', sprintf(_MD_LEXIKON_AUTHORWAITING, $totalwaiting)); |
||||
| 91 | } |
||||
| 92 | |||||
| 93 | // Get all terms of this author |
||||
| 94 | $utility::getAuthorProfile($uid); |
||||
| 95 | |||||
| 96 | // various strings |
||||
| 97 | $xoopsTpl->assign('lang_modulename', $xoopsModule->name()); |
||||
| 98 | $xoopsTpl->assign('lang_moduledirname', $xoopsModule->getVar('dirname')); |
||||
| 99 | $xoopsTpl->assign('submitted', sprintf(_MD_LEXIKON_AUTHORTERMS, $authname, $authortermstotal)); |
||||
| 100 | $xoopsTpl->assign('author_id', $uid); |
||||
| 101 | $xoopsTpl->assign('author_name', $authname); |
||||
| 102 | $xoopsTpl->assign('user_avatarurl', XOOPS_URL . '/uploads/' . $thisuser->getVar('user_avatar')); |
||||
| 103 | $xoopsTpl->assign('lang_authorprofile', _MD_LEXIKON_AUTHORPROFILE); |
||||
| 104 | $xoopsTpl->assign('author_name_with_link', sprintf("<a href='%s'>%s</a>", XOOPS_URL . '/userinfo.php?uid=' . $uid, $authname)); |
||||
| 105 | |||||
| 106 | $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="assets/css/style.css" >'); |
||||
| 107 | $xoopsTpl->assign('xoops_pagetitle', _MD_LEXIKON_AUTHORPROFILE . ' - ' . $authname . ' - ' . htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5)); |
||||
| 108 | |||||
| 109 | // Meta data |
||||
| 110 | $meta_description = _MD_LEXIKON_AUTHORPROFILE . ' - ' . $authname . ' - ' . htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5); |
||||
| 111 | if (isset($xoTheme) && is_object($xoTheme)) { |
||||
| 112 | $xoTheme->addMeta('meta', 'description', $meta_description); |
||||
| 113 | } else { |
||||
| 114 | $xoopsTpl->assign('xoops_meta_description', $meta_description); |
||||
| 115 | } |
||||
| 116 | |||||
| 117 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 118 |