XoopsModules25x /
lexikon
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 | * Module: Lexikon - glossary module |
||
| 4 | * Version: v 1.00 |
||
| 5 | * Release Date: 8 May 2004 |
||
| 6 | * Author: hsalazar |
||
| 7 | * Licence: GNU |
||
| 8 | */ |
||
| 9 | |||
| 10 | use Xmf\Request; |
||
| 11 | use XoopsModules\Lexikon\{ |
||
| 12 | Helper, |
||
| 13 | Utility |
||
| 14 | }; |
||
| 15 | /** @var Helper $helper */ |
||
| 16 | /** @var Utility $utility */ |
||
| 17 | |||
| 18 | $GLOBALS['xoopsOption']['template_main'] = 'lx_letter.tpl'; |
||
| 19 | require __DIR__ . '/header.php'; |
||
| 20 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 21 | require_once XOOPS_ROOT_PATH . '/modules/lexikon/include/common.inc.php'; |
||
| 22 | |||
| 23 | $helper = Helper::getInstance(); |
||
| 24 | |||
| 25 | |||
| 26 | global $xoTheme, $xoopsUser; |
||
| 27 | $myts = \MyTextSanitizer::getInstance(); |
||
| 28 | |||
| 29 | $init = Request::getString('init', 0, 'GET'); |
||
| 30 | $xoopsTpl->assign('firstletter', $init); |
||
| 31 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
| 32 | $start = Request::getInt('start', 0, 'GET'); |
||
| 33 | |||
| 34 | $publishedwords = $utility::countWords(); |
||
| 35 | $xoopsTpl->assign('publishedwords', $publishedwords); |
||
| 36 | |||
| 37 | //permissions |
||
| 38 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
| 39 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 40 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 41 | $module_id = $xoopsModule->getVar('mid'); |
||
| 42 | $allowed_cats = $grouppermHandler->getItemIds('lexikon_view', $groups, $module_id); |
||
| 43 | $catids = implode(',', $allowed_cats); |
||
| 44 | $catperms = " AND categoryID IN ($catids) "; |
||
| 45 | |||
| 46 | $xoopsTpl->assign('multicats', (int)$helper->getConfig('multicats')); |
||
| 47 | |||
| 48 | if (!function_exists('mb_ucfirst') && function_exists('mb_substr')) { |
||
| 49 | /** |
||
| 50 | * @param $string |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | function mb_ucfirst($string) |
||
| 54 | { |
||
| 55 | $string = mb_ereg_replace('^[\ ]+', '', $string); |
||
| 56 | $string = mb_strtoupper(mb_substr($string, 0, 1, 'UTF-8'), 'UTF-8') . mb_substr($string, 1, mb_strlen($string), 'UTF-8'); |
||
| 57 | |||
| 58 | return $string; |
||
| 59 | } |
||
| 60 | } |
||
| 61 | // To display the linked letter list |
||
| 62 | $alpha = $utility::getAlphaArray(); |
||
| 63 | $xoopsTpl->assign('alpha', $alpha); |
||
| 64 | |||
| 65 | [$howmanyother] = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '#' AND offline ='0' " . $catperms . ' ')); |
||
| 66 | $xoopsTpl->assign('totalother', $howmanyother); |
||
| 67 | |||
| 68 | // To display the list of categories |
||
| 69 | if (1 == $helper->getConfig('multicats')) { |
||
| 70 | $xoopsTpl->assign('block0', $utility::getCategoryArray()); |
||
| 71 | $xoopsTpl->assign('layout', CONFIG_CATEGORY_LAYOUT_PLAIN); |
||
| 72 | if ($utility::getModuleOption('useshots')) { |
||
| 73 | $xoopsTpl->assign('show_screenshot', true); |
||
| 74 | $xoopsTpl->assign('logo_maximgwidth', $helper->getConfig('logo_maximgwidth')); |
||
| 75 | $xoopsTpl->assign('lang_noscreenshot', _MD_LEXIKON_NOSHOTS); |
||
| 76 | } else { |
||
| 77 | $xoopsTpl->assign('show_screenshot', false); |
||
| 78 | } |
||
| 79 | } |
||
| 80 | |||
| 81 | // No initial: we need to see all letters |
||
| 82 | if (!$init) { |
||
| 83 | $entriesarray = []; |
||
| 84 | $pagetype = 0; |
||
| 85 | |||
| 86 | // How many entries will we show in this page? |
||
| 87 | //$queryA = "SELECT w. * , c.name AS catname FROM ".$xoopsDB -> prefix( 'lxentries' )." w LEFT JOIN ".$xoopsDB -> prefix( 'lxcategories' )." c ON w.categoryID = c.categoryID WHERE w.submit = '0' AND w.offline = '0' ORDER BY w.term ASC"; |
||
| 88 | //$resultA = $xoopsDB -> query ($queryA, $helper->getConfig('indexperpage'), $start ); |
||
| 89 | $queryA = 'SELECT * FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline = '0' AND submit = '0' " . $catperms . ' ORDER BY term ASC'; |
||
| 90 | $resultA = $xoopsDB->query($queryA, $helper->getConfig('indexperpage'), $start); |
||
| 91 | |||
| 92 | $allentries = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' " . $catperms . ' ORDER BY term ASC '); |
||
| 93 | $totalentries = $xoopsDB->getRowsNum($allentries); |
||
| 94 | $xoopsTpl->assign('totalentries', $totalentries); |
||
| 95 | |||
| 96 | while (list($entryID, $categoryID, $term, $init, $definition, $ref, $url, $uid, $submit, $datesub, $counter, $html, $smiley, $xcodes, $breaks, $block, $offline, $comments) = $xoopsDB->fetchRow($resultA)) { |
||
| 97 | $eachentry = []; |
||
| 98 | $xoopsModule = XoopsModule::getByDirname('lexikon'); |
||
| 99 | $eachentry['dir'] = $xoopsModule->dirname(); |
||
| 100 | |||
| 101 | if (1 == $helper->getConfig('multicats')) { |
||
| 102 | $eachentry['catid'] = (int)$categoryID; |
||
| 103 | $resultF = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC"); |
||
| 104 | while (list($name) = $xoopsDB->fetchRow($resultF)) { |
||
| 105 | $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5); |
||
| 106 | } |
||
| 107 | } |
||
| 108 | |||
| 109 | $eachentry['id'] = (int)$entryID; |
||
| 110 | $eachentry['term'] = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5)); |
||
| 111 | |||
| 112 | if ((0 !== $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) { |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 113 | if (0 != $comments) { |
||
| 114 | $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . ' ' . _COMMENTS . '</a>'; |
||
| 115 | } else { |
||
| 116 | $eachentry['comments'] = ''; |
||
| 117 | } |
||
| 118 | } |
||
| 119 | |||
| 120 | if (!XOOPS_USE_MULTIBYTES) { |
||
| 121 | $eachentry['definition'] = $myts->displayTarea($definition, $html, $smiley, $xcodes, 1, $breaks); |
||
| 122 | } |
||
| 123 | |||
| 124 | // Functional links |
||
| 125 | $microlinks = $utility::getServiceLinks($eachentry); |
||
| 126 | $eachentry['microlinks'] = $microlinks; |
||
| 127 | |||
| 128 | $entriesarray['single'][] = $eachentry; |
||
| 129 | } |
||
| 130 | $pagenav = new \XoopsPageNav($totalentries, $helper->getConfig('indexperpage'), $start, 'start'); |
||
| 131 | $entriesarray['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav(6) . '</div>'; |
||
| 132 | |||
| 133 | $xoopsTpl->assign('entriesarray', $entriesarray); |
||
| 134 | $xoopsTpl->assign('pagetype', '0'); |
||
| 135 | $xoopsTpl->assign('pageinitial', _MD_LEXIKON_ALL); |
||
| 136 | |||
| 137 | $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . ' - ' . _MD_LEXIKON_ALL, ENT_QUOTES | ENT_HTML5)); |
||
| 138 | } else { // $init does exist |
||
| 139 | $pagetype = 1; |
||
| 140 | // There IS an initial letter, so we want to show just that letter's terms |
||
| 141 | $entriesarray2 = []; |
||
| 142 | |||
| 143 | // How many entries will we show in this page? |
||
| 144 | if (_MD_LEXIKON_OTHER == $init) { |
||
| 145 | $queryB = 'SELECT entryID, categoryID, term, definition, uid, html, smiley, xcodes, breaks, comments FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' AND init = '#' " . $catperms . ' ORDER BY term ASC'; |
||
| 146 | $resultB = $xoopsDB->query($queryB, $helper->getConfig('indexperpage'), $start); |
||
| 147 | } else { |
||
| 148 | $queryB = 'SELECT entryID, categoryID, term, definition, uid, html, smiley, xcodes, breaks, comments FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' AND init = '$init' AND init != '#' " . $catperms . ' ORDER BY term ASC'; |
||
| 149 | $resultB = $xoopsDB->query($queryB, $helper->getConfig('indexperpage'), $start); |
||
| 150 | } |
||
| 151 | |||
| 152 | $entrieshere = $xoopsDB->getRowsNum($resultB); |
||
| 153 | if (0 == $entrieshere) { |
||
| 154 | redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_LEXIKON_NOTERMSINLETTER); |
||
| 155 | } |
||
| 156 | |||
| 157 | if (_MD_LEXIKON_OTHER == $init) { |
||
| 158 | $allentries = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '#' AND submit ='0' AND offline = '0' " . $catperms . ' ORDER BY term ASC '); |
||
| 159 | } else { |
||
| 160 | $allentries = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$init' AND init != '#' AND submit ='0' AND offline = '0' " . $catperms . ' ORDER BY term ASC '); |
||
| 161 | } |
||
| 162 | $totalentries = $xoopsDB->getRowsNum($allentries); |
||
| 163 | $xoopsTpl->assign('totalentries', $totalentries); |
||
| 164 | $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . (isset($init['init']) ? (' - ' . $init['init']) : ''), ENT_QUOTES | ENT_HTML5)); |
||
| 165 | |||
| 166 | while (list($entryID, $categoryID, $term, $definition, $uid, $html, $smiley, $xcodes, $breaks, $comments) = $xoopsDB->fetchRow($resultB)) { |
||
| 167 | $eachentry = []; |
||
| 168 | $xoopsModule = XoopsModule::getByDirname('lexikon'); |
||
| 169 | $eachentry['dir'] = $xoopsModule->dirname(); |
||
| 170 | |||
| 171 | if (1 == $helper->getConfig('multicats')) { |
||
| 172 | $eachentry['catid'] = (int)$categoryID; |
||
| 173 | $resultF = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC"); |
||
| 174 | while (list($name) = $xoopsDB->fetchRow($resultF)) { |
||
| 175 | $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5); |
||
| 176 | } |
||
| 177 | } |
||
| 178 | $eachentry['id'] = (int)$entryID; |
||
| 179 | $eachentry['term'] = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5)); |
||
| 180 | if ('#' === $init) { |
||
| 181 | $eachentry['init'] = _MD_LEXIKON_OTHER; |
||
| 182 | } else { |
||
| 183 | $eachentry['init'] = $init; |
||
| 184 | } |
||
| 185 | |||
| 186 | if ((0 !== $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) { |
||
|
0 ignored issues
–
show
|
|||
| 187 | if (0 != $comments) { |
||
| 188 | $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . ' ' . _COMMENTS . '</a>'; |
||
| 189 | } else { |
||
| 190 | $eachentry['comments'] = ''; |
||
| 191 | } |
||
| 192 | } |
||
| 193 | if (!XOOPS_USE_MULTIBYTES) { |
||
| 194 | $eachentry['definition'] = $myts->displayTarea($definition, $html, $smiley, $xcodes, 1, $breaks); |
||
| 195 | } |
||
| 196 | |||
| 197 | // Functional links |
||
| 198 | $microlinks = $utility::getServiceLinks($eachentry); |
||
| 199 | $eachentry['microlinks'] = $microlinks; |
||
| 200 | |||
| 201 | $entriesarray2['single'][] = $eachentry; |
||
| 202 | } |
||
| 203 | $pagenav = new \XoopsPageNav($totalentries, $helper->getConfig('indexperpage'), $start, 'init=' . $eachentry['init'] . '&start'); |
||
| 204 | $entriesarray2['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav(6) . '</div>'; |
||
| 205 | |||
| 206 | $xoopsTpl->assign('entriesarray2', $entriesarray2); |
||
| 207 | $xoopsTpl->assign('pagetype', '1'); |
||
| 208 | if ('#' === $eachentry['init']) { |
||
| 209 | $xoopsTpl->assign('pageinitial', _MD_LEXIKON_OTHER); |
||
| 210 | $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . ' - ' . _MD_LEXIKON_OTHER, ENT_QUOTES | ENT_HTML5)); |
||
| 211 | } else { |
||
| 212 | $xoopsTpl->assign('pageinitial', mb_ucfirst($eachentry['init'])); |
||
| 213 | } |
||
| 214 | } |
||
| 215 | |||
| 216 | $xoopsTpl->assign('lang_modulename', $xoopsModule->name()); |
||
| 217 | $xoopsTpl->assign('lang_moduledirname', $xoopsModule->getVar('dirname')); |
||
| 218 | $xoopsTpl->assign('alpha', $alpha); |
||
| 219 | if (1 == $helper->getConfig('syndication')) { |
||
| 220 | $xoopsTpl->assign('syndication', true); |
||
| 221 | } |
||
| 222 | if ($xoopsUser) { |
||
| 223 | $xoopsTpl->assign('syndication', true); |
||
| 224 | } |
||
| 225 | // Meta data |
||
| 226 | $publishedwords = 0; |
||
| 227 | if ($publishedwords) { |
||
| 228 | $meta_description = xoops_substr($utility::convertHtml2text($eachentry['definition']), 0, 150); |
||
| 229 | if (1 == $helper->getConfig('multicats')) { |
||
| 230 | $utility::extractKeywords($xoopsModule->name() . ' ,' . $eachentry['term'] . ', ' . $meta_description); |
||
| 231 | $utility::getMetaDescription(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ' ' . $eachentry['catname'] . ' ' . $eachentry['term']); |
||
| 232 | } else { |
||
| 233 | $utility::extractKeywords(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ', ' . $eachentry['term'] . ', ' . $meta_description); |
||
| 234 | $utility::getMetaDescription(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ' ' . $eachentry['term'] . ' ' . $meta_description); |
||
| 235 | } |
||
| 236 | } |
||
| 237 | |||
| 238 | $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="assets/css/style.css">'); |
||
| 239 | |||
| 240 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
| 241 |