XoopsModules25x /
mylinks
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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | // $Id: topten.php 11158 2013-03-05 14:10:36Z zyspec $ |
||
| 3 | // ------------------------------------------------------------------------ // |
||
| 4 | // XOOPS - PHP Content Management System // |
||
| 5 | // Copyright (c) 2000 XOOPS.org // |
||
| 6 | // <http://www.xoops.org/> // |
||
| 7 | // ------------------------------------------------------------------------- // |
||
| 8 | // This program is free software; you can redistribute it and/or modify // |
||
| 9 | // it under the terms of the GNU General Public License as published by // |
||
| 10 | // the Free Software Foundation; either version 2 of the License, or // |
||
| 11 | // (at your option) any later version. // |
||
| 12 | // // |
||
| 13 | // You may not change or alter any portion of this comment or credits // |
||
| 14 | // of supporting developers from this source code or any supporting // |
||
| 15 | // source code which is considered copyrighted (c) material of the // |
||
| 16 | // original comment or credit authors. // |
||
| 17 | // // |
||
| 18 | // This program is distributed in the hope that it will be useful, // |
||
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // |
||
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
||
| 21 | // GNU General Public License for more details. // |
||
| 22 | // // |
||
| 23 | // You should have received a copy of the GNU General Public License // |
||
| 24 | // along with this program; if not, write to the Free Software // |
||
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
||
| 26 | // ------------------------------------------------------------------------ // |
||
| 27 | include __DIR__ . '/header.php'; |
||
| 28 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
||
| 29 | |||
| 30 | $mylinksCatHandler = xoops_getModuleHandler('category', $xoopsModule->getVar('dirname')); |
||
| 31 | $catObjs = $mylinksCatHandler->getAll(); |
||
| 32 | $myCatTree = new XoopsObjectTree($catObjs, 'cid', 'pid'); |
||
| 33 | |||
| 34 | $xoopsOption['template_main'] = 'mylinks_topten.tpl'; |
||
| 35 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 36 | //wanikoo |
||
| 37 | $xoTheme->addStylesheet('browse.php?' . mylinksGetStylePath('mylinks.css', 'include')); |
||
| 38 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||
| 39 | $xoTheme->addScript('browse.php?' . mylinksGetStylePath('mylinks.js', 'include')); |
||
| 40 | // |
||
| 41 | |||
| 42 | //generates top 10 charts by rating and hits for each main category |
||
| 43 | include_once __DIR__ . '/class/utility.php'; |
||
| 44 | //xoops_load('utility', $xoopsModule->getVar('dirname')); |
||
| 45 | $sort = MylinksUtility::mylinks_cleanVars($_GET, 'sort', 2, 'int', $limit = array(1, 3)); |
||
|
0 ignored issues
–
show
|
|||
| 46 | switch ($sort) { |
||
| 47 | case '1': // Popular |
||
| 48 | $sort = _MD_MYLINKS_RATING; |
||
| 49 | $sortDB = 'rating'; |
||
| 50 | break; |
||
| 51 | case '3': // Most Recent |
||
| 52 | $sort = _MD_MYLINKS_RECENT; |
||
| 53 | $sortDB = 'date'; |
||
| 54 | break; |
||
| 55 | case '2': // Rating |
||
| 56 | default: |
||
| 57 | $sort = _MD_MYLINKS_HITS; |
||
| 58 | $sortDB = 'hits'; |
||
| 59 | break; |
||
| 60 | } |
||
| 61 | /* |
||
| 62 | if(!empty($_GET['rate'])){ |
||
| 63 | $sort = _MD_MYLINKS_RATING; |
||
| 64 | $sortDB = "rating"; |
||
| 65 | }else{ |
||
| 66 | $sort = _MD_MYLINKS_HITS; |
||
| 67 | $sortDB = "hits"; |
||
| 68 | } |
||
| 69 | */ |
||
| 70 | $xoopsTpl->assign('lang_sortby', $sort); |
||
| 71 | $xoopsTpl->assign('lang_rank', _MD_MYLINKS_RANK); |
||
| 72 | $xoopsTpl->assign('lang_title', _MD_MYLINKS_TITLE); |
||
| 73 | $xoopsTpl->assign('lang_category', _MD_MYLINKS_CATEGORY); |
||
| 74 | $xoopsTpl->assign('lang_hits', _MD_MYLINKS_HITS); |
||
| 75 | $xoopsTpl->assign('lang_rating', _MD_MYLINKS_RATING); |
||
| 76 | $xoopsTpl->assign('lang_vote', _MD_MYLINKS_VOTE); |
||
| 77 | |||
| 78 | // get main category titles |
||
| 79 | $criteria = new CriteriaCompo(); |
||
| 80 | $criteria->add(new Criteria('pid', 0, '=')); |
||
| 81 | $catElements = array('title'); |
||
| 82 | $mainCatTitleArray = $mylinksCatHandler->getAll($criteria, $catElements, false, true); |
||
| 83 | $mainCatIdArray = array_keys($mainCatTitleArray); |
||
| 84 | $catCount = count($mainCatIdArray); |
||
| 85 | $mainCatIds = $catCount ? '(' . implode(',', $mainCatIdArray) . ')' : ''; |
||
| 86 | $rankings = array(); |
||
| 87 | |||
| 88 | foreach ($mainCatIdArray as $catKey) { |
||
| 89 | $treeIds = array(); |
||
| 90 | $thisCatTree = $myCatTree->getAllChild($catKey); |
||
| 91 | if (!empty($thisCatTree)) { |
||
| 92 | $treeIds = array_keys($thisCatTree); |
||
| 93 | } |
||
| 94 | array_push($treeIds, $catKey); |
||
| 95 | $subcatIds = '(' . implode(',', $treeIds) . ')'; |
||
| 96 | $sql = 'SELECT lid, cid, title, hits, rating, votes FROM ' . '' . $xoopsDB->prefix('mylinks_links') . '' . " WHERE status>0 AND {$sortDB}>0 AND cid IN {$subcatIds} ORDER BY {$sortDB} DESC LIMIT 0,10"; |
||
| 97 | $result = $xoopsDB->query($sql); |
||
| 98 | if ($result) { |
||
| 99 | $catTitle = $myts->htmlSpecialChars($mainCatTitleArray[$catKey]['title']); |
||
| 100 | $rankings[$catKey]['title'] = sprintf(_MD_MYLINKS_TOP10, $catTitle); |
||
| 101 | $rank = 1; |
||
| 102 | while (list($lid, $lcid, $ltitle, $hits, $rating, $votes) = $xoopsDB->fetchRow($result)) { |
||
| 103 | $thisCatObj = $mylinksCatHandler->get($lcid); |
||
| 104 | // $homePath = "<a href='" . XOOPSMYLINKURL . "/index.php'>" . _MD_MYLINKS_MAIN . '</a> : '; |
||
| 105 | $itemPath = "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid={$lcid}'>" . $thisCatObj->getVar('title') . '</a>'; |
||
| 106 | $path = ''; |
||
| 107 | $myParent = $thisCatObj->getVar('pid'); |
||
| 108 | View Code Duplication | while ($myParent != 0) { |
|
| 109 | $ancestorObj = $myCatTree->getByKey($myParent); |
||
| 110 | $path = "<a href='" . XOOPSMYLINKURL . '/viewcat.php?cid=' . $ancestorObj->getVar('cid') . "'>" . $ancestorObj->getVar('title') . "</a> : {$path}"; |
||
| 111 | $myParent = $ancestorObj->getVar('pid'); |
||
| 112 | } |
||
| 113 | $path = "{$path}{$itemPath}"; |
||
| 114 | $path = str_replace(' : ', " <img src='" . mylinksGetIconURL('arrow.gif') . "' style='border-width: 0px;' alt=''> ", $path); |
||
| 115 | |||
| 116 | $thisRanking = array( |
||
| 117 | 'id' => $lid, |
||
| 118 | 'cid' => $catKey, |
||
| 119 | 'rank' => $rank, |
||
| 120 | 'title' => $myts->htmlSpecialChars($myts->stripSlashesGPC($ltitle)), |
||
| 121 | 'category' => $path, |
||
| 122 | 'hits' => $hits, |
||
| 123 | 'rating' => number_format($rating, 2), |
||
| 124 | 'votes' => $votes |
||
| 125 | ); |
||
| 126 | $rankings[$catKey]['links'][$rank] = $thisRanking; |
||
| 127 | $rank++; |
||
| 128 | } |
||
| 129 | } |
||
| 130 | if (!array_key_exists('links', $rankings[$catKey])) { |
||
| 131 | unset($rankings[$catKey]); |
||
| 132 | } |
||
| 133 | } |
||
| 134 | $rankings = empty($rankings) ? '' : $rankings; |
||
| 135 | $xoopsTpl->assign('rankings', $rankings); |
||
| 136 | unset($rankings); |
||
| 137 | //wanikoo theme changer |
||
| 138 | $xoopsTpl->assign('lang_themechanger', _MD_MYLINKS_THEMECHANGER); |
||
| 139 | $mymylinkstheme_options = ''; |
||
| 140 | |||
| 141 | View Code Duplication | foreach ($GLOBALS['mylinks_allowed_theme'] as $mymylinkstheme) { |
|
| 142 | $mymylinkstheme_options .= "<option value='{$mymylinkstheme}'"; |
||
| 143 | if ($mymylinkstheme == $GLOBALS['mylinks_theme']) { |
||
| 144 | $mymylinkstheme_options .= " selected='selected'"; |
||
| 145 | } |
||
| 146 | $mymylinkstheme_options .= ">{$mymylinkstheme}</option>"; |
||
| 147 | } |
||
| 148 | |||
| 149 | $mylinkstheme_select = '<select name="mylinks_theme_select" onchange="submit();" size="1">' . $mymylinkstheme_options . '</select>'; |
||
| 150 | |||
| 151 | $xoopsTpl->assign('mylinksthemeoption', $mylinkstheme_select); |
||
| 152 | |||
| 153 | //wanikoo search |
||
| 154 | xoops_loadLanguage('search'); |
||
| 155 | /* |
||
| 156 | if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/search.php") ) { |
||
| 157 | include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/search.php"; |
||
| 158 | } else { |
||
| 159 | include_once XOOPS_ROOT_PATH."/language/english/search.php"; |
||
| 160 | } |
||
| 161 | */ |
||
| 162 | $xoopsTpl->assign('lang_all', _SR_ALL); |
||
| 163 | $xoopsTpl->assign('lang_any', _SR_ANY); |
||
| 164 | $xoopsTpl->assign('lang_exact', _SR_EXACT); |
||
| 165 | $xoopsTpl->assign('lang_search', _SR_SEARCH); |
||
| 166 | $xoopsTpl->assign('module_id', $xoopsModule->getVar('mid')); |
||
| 167 | |||
| 168 | //category head |
||
| 169 | $catarray = array(); |
||
| 170 | /* removed, not used |
||
| 171 | if ( $mylinks_show_letters ) { |
||
| 172 | $catarray['letters'] = ml_wfd_letters(); |
||
| 173 | } |
||
| 174 | */ |
||
| 175 | if ($mylinks_show_toolbar) { |
||
| 176 | $catarray['toolbar'] = ml_wfd_toolbar(); |
||
| 177 | } |
||
| 178 | $xoopsTpl->assign('catarray', $catarray); |
||
| 179 | |||
| 180 | include_once XOOPSMYLINKPATH . '/footer.php'; |
||
| 181 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: