Issues (661)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

topten.php (3 issues)

Upgrade to new PHP Analysis Engine

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
'sort' is of type string, but the function expects a object<unknown_type>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
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>&nbsp;:&nbsp;';
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) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
109
                $ancestorObj = $myCatTree->getByKey($myParent);
110
                $path        = "<a href='" . XOOPSMYLINKURL . '/viewcat.php?cid=' . $ancestorObj->getVar('cid') . "'>" . $ancestorObj->getVar('title') . "</a>&nbsp;:&nbsp;{$path}";
111
                $myParent    = $ancestorObj->getVar('pid');
112
            }
113
            $path = "{$path}{$itemPath}";
114
            $path = str_replace('&nbsp;:&nbsp;', " <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) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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