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.

index.php (6 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: index.php 11819 2013-07-09 18:21:40Z 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
29
$myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object
30
31
include_once XOOPS_ROOT_PATH . '/class/tree.php';
32
$mylinksCatHandler = xoops_getModuleHandler('category', $xoopsModule->getVar('dirname'));
33
$catObjs           = $mylinksCatHandler->getAll();
34
$myCatTree         = new XoopsObjectTree($catObjs, 'cid', 'pid');
35
36
$xoopsOption['template_main'] = 'mylinks_index.tpl';
37
include XOOPS_ROOT_PATH . '/header.php';
38
39
//wanikoo
40
$xoTheme->addStylesheet('browse.php?' . mylinksGetStylePath('mylinks.css', 'include'));
41
$xoTheme->addScript('browse.php?' . mylinksGetStylePath('mylinks.js', 'include'));
42
// get all top level categories (pid=0)
43
//$mylinksCatHandler = xoops_getModuleHandler('category', $xoopsModule->getVar('dirname'));
44
$criteria = new CriteriaCompo();
45
$criteria->add(new Criteria('pid', 0, '='));
46
$criteria->setSort('title');
47
$catObjs = $mylinksCatHandler->getAll($criteria);
48
49
$subcatLimit = 5;
50
$count       = 1;
51
foreach ($catObjs as $catObj) {
52
    $catImgUrl = '';
53 View Code Duplication
    if ($catObj->getVar('imgurl') && (($catObj->getVar('imgurl') != 'http://') && ($catObj->getVar('imgurl') != ''))) {
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...
54
        //    if ( $catObj->getVar('imgurl') && ($catObj->getVar('imgurl') != "http://") ) {
55
        $catImgUrl = $myts->htmlSpecialChars($catObj->getVar('imgurl', 'n'));
56
    }
57
    // get the total number of subcats for this category
58
    $criteria = new CriteriaCompo();
59
    $criteria->add(new Criteria('pid', $catObj->getVar('cid'), '='));
60
    $childCount = (int)$mylinksCatHandler->getCount($criteria);
61
62
    //now retrieve the info for the first 'subcatLimit' categories
63
    $criteria->setLimit($subcatLimit);
64
    $criteria->setSort('title');
65
    $childFields     = array('pid', 'title');
66
    $childTitleArray = $mylinksCatHandler->getAll($criteria, $childFields, false, false);
67
    $lpLimit         = min(array($subcatLimit, count($childTitleArray)));
68
    $subcategories   = '';
69
    for ($i = 0; $i < $lpLimit; $i++) {
70
        $chtitle = $myts->htmlSpecialChars($childTitleArray[$i]['title']);
71
        $subcategories .= ($i > 0) ? ', ' : '';
72
        $subcategories .= "<a href='" . XOOPSMYLINKURL . '/viewcat.php?cid=' . $childTitleArray[$i]['cid'] . "'>{$chtitle}</a>";
73
    }
74
    $subcategories = ($childCount > $subcatLimit) ? $subcategories . '...' : $subcategories;
75
76
    // get number of links in each subcategory
77
    $totalLink = getTotalItems($catObj->getVar('cid'), 0, '>');
78
    $xoopsTpl->append('categories', array(
79
        'image'         => $catImgUrl,
80
        'id'            => $catObj->getVar('cid'),
81
        'title'         => $myts->htmlSpecialChars($catObj->getVar('title')),
82
        'subcategories' => $subcategories,
83
        'totallink'     => $totalLink,
84
        'count'         => $count
85
    ));
86
    $count++;
87
}
88
89
$sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . ' WHERE status>0';
90
list($numActiveLinks) = $xoopsDB->fetchRow($xoopsDB->query($sql));
91
$xoopsTpl->assign('lang_thereare', sprintf(_MD_MYLINKS_THEREARE, $numActiveLinks));
92
93
$xoopsTpl->assign('anontellafriend', $GLOBALS['xoopsModuleConfig']['anontellafriend']);
94
$useShots = $xoopsModuleConfig['useshots'];
95 View Code Duplication
if (1 == $useShots) {
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...
96
    $shotWidth = $xoopsModuleConfig['shotwidth'];
97
    $xoopsTpl->assign(array(
98
                          'shotwidth'         => $shotWidth . 'px',
99
                          //                            'tablewidth'        => ($shotWidth + 10) . "px",
100
                          'show_screenshot'   => true,
101
                          'lang_noscreenshot' => _MD_MYLINKS_NOSHOTS
102
                      ));
103
} else {
104
    $xoopsTpl->assign('show_screenshot', false);
105
}
106
107
$xoopsTpl->assign(array(
108
                      'lang_description'    => _MD_MYLINKS_DESCRIPTIONC,
109
                      'lang_lastupdate'     => _MD_MYLINKS_LASTUPDATEC,
110
                      'lang_hits'           => _MD_MYLINKS_HITSC,
111
                      'lang_rating'         => _MD_MYLINKS_RATINGC,
112
                      'lang_ratethissite'   => _MD_MYLINKS_RATETHISSITE,
113
                      'lang_reportbroken'   => _MD_MYLINKS_REPORTBROKEN,
114
                      'lang_tellafriend'    => _MD_MYLINKS_TELLAFRIEND,
115
                      'lang_modify'         => _MD_MYLINKS_MODIFY,
116
                      'lang_latestlistings' => _MD_MYLINKS_LATESTLIST,
117
                      'lang_category'       => _MD_MYLINKS_CATEGORYC,
118
                      'lang_visit'          => _MD_MYLINKS_VISIT,
119
                      'lang_comments'       => _COMMENTS
120
                  ));
121
122
$shotAttribution = '';
123
$result          = $xoopsDB->query('SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text')
124
                                   . ' t where l.status>0 and l.lid=t.lid ORDER BY date DESC', $xoopsModuleConfig['newlinks'], 0);
125
while (list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result)) {
126 View Code Duplication
    if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) {
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...
127
        $isadmin   = true;
128
        $adminlink = "<a href='" . XOOPSMYLINKURL . "/admin/main.php?op=modLink&amp;&fct=mylinks&amp;lid={$lid}'><img src='" . mylinksGetIconURL('edit.png') . "' style='border-width: 0px;' alt='" . _MD_MYLINKS_EDITTHISLINK . "'></a>";
129
    } else {
130
        $isadmin   = false;
131
        $adminlink = '';
132
    }
133
134
    $votestring = (1 == $votes) ? _MD_MYLINKS_ONEVOTE : sprintf(_MD_MYLINKS_NUMVOTES, $votes);
135
    $ltitle     = $myts->htmlSpecialChars($ltitle);
136
    $thisCatObj = $mylinksCatHandler->get($cid);
137
    $homePath   = _MD_MYLINKS_MAIN . '&nbsp;:&nbsp;';
138
    $itemPath   = "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid={$cid}'>" . $thisCatObj->getVar('title') . '</a>';
139
    $path       = '';
140
    $myParentID = $thisCatObj->getVar('pid');
141 View Code Duplication
    while ($myParentID != 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...
142
        $ancestorObj = $myCatTree->getByKey($myParentID);
143
        $path        = "<a href='" . XOOPSMYLINKURL . '/viewcat.php?cid=' . $ancestorObj->getVar('cid') . "'>" . $ancestorObj->getVar('title') . "</a>&nbsp;:&nbsp;{$path}";
144
        $myParentID  = $ancestorObj->getVar('pid');
145
    }
146
147
    $path = "{$homePath}{$path}{$itemPath}";
148
    $path = str_replace('&nbsp;:&nbsp;', " <img src='" . mylinksGetIconURL('arrow.gif') . "' style='border-width: 0px;' alt=''> ", $path);
149
    $new  = newlinkgraphic($time, $status);
150
    $pop  = popgraphic($hits);
151
    //by wanikoo
152
    /* setup shot provider information */
153
    $shotImgSrc = $shotImgHref = $shotAttribution = '';
154 View Code Duplication
    if ($useShots) {
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...
155
        $shotProvider = mb_strtolower($xoopsModuleConfig['shotprovider']);
156
        $shotImgHref  = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/visit.php?cid={$cid}&amp;lid={$lid}";
157
        $logourl      = trim($logourl);
158
        if (!empty($logourl)) {
159
            if (file_exists(XOOPSMYLINKIMGPATH . "/{$mylinks_theme}")) {
160
                $shotImgSrc = XOOPSMYLINKIMGURL . "/{$mylinks_theme}/shots/" . $myts->htmlSpecialChars($logourl);
161
            } else {
162
                $shotImgSrc = XOOPSMYLINKIMGURL . '/shots/' . $myts->htmlSpecialChars($logourl);
163
            }
164
        } elseif (_NONE != $shotProvider) {
165
            if (file_exists(XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php')) {
166
                include_once XOOPS_ROOT_PATH . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $xoopsModule->getVar('dirname') . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'providers' . DIRECTORY_SEPARATOR . mb_strtolower($shotProvider) . '.php';
167
                $shotClass = ucfirst($xoopsModule->getVar('dirname')) . ucfirst($shotProvider);
168
                $shotObj   = new $shotClass;
169
                $shotObj->setProviderPublicKey($xoopsModuleConfig['shotpubkey']);
170
                $shotObj->setProviderPrivateKey($xoopsModuleConfig['shotprivkey']);
171
                $shotObj->setShotSize(array('width' => $xoopsModuleConfig['shotwidth']));
172
                $shotObj->setSiteUrl($myts->htmlSpecialChars($url));
173
                $shotImgSrc = $shotObj->getProviderUrl();
174
                if ($xoopsModuleConfig['shotattribution']) {
175
                    $shotAttribution = $shotObj->getAttribution(true);
176
                } else {
177
                    $shotAttribution = '';
178
                }
179
            }
180
        }
181
    }
182
    $xoopsTpl->assign('shot_attribution', $shotAttribution);
183
    $xoopsTpl->append('links', array(
184
        'url'           => $myts->htmlSpecialChars($url),
185
        'id'            => $lid,
186
        'cid'           => $cid,
187
        'rating'        => number_format($rating, 2),
188
        'ltitle'        => $ltitle,
189
        'title'         => $myts->htmlSpecialChars($myts->stripSlashesGPC($ltitle)) . $new . $pop,
190
        'category'      => $path,
191
        'logourl'       => $myts->htmlSpecialChars(trim($logourl)),
192
        'updated'       => formatTimestamp($time, 'm'),
193
        'description'   => $myts->displayTarea($myts->stripSlashesGPC($description), 0),
194
        'adminlink'     => $adminlink,
195
        'hits'          => $hits,
196
        'votes'         => $votestring,
197
        'comments'      => $comments,
198
        'mail_subject'  => rawurlencode(sprintf(_MD_MYLINKS_INTRESTLINK, $xoopsConfig['sitename'])),
199
        'mail_body'     => rawurlencode(sprintf(_MD_MYLINKS_INTLINKFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPSMYLINKURL . "/singlelink.php?cid={$cid}&amp;lid={$lid}"),
200
        'shot_img_src'  => $shotImgSrc,
201
        'shot_img_href' => $shotImgHref
202
    ));
203
}
204
//wanikoo
205
$xoopsTpl->assign('lang_feed', _MD_MYLINKS_FEED);
206
//wanikoo theme changer
207
$xoopsTpl->assign('lang_themechanger', _MD_MYLINKS_THEMECHANGER);
208
$mymylinkstheme_options = '';
209
210 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...
211
    $mymylinkstheme_options .= "<option value='{$mymylinkstheme}'";
212
    if ($mymylinkstheme == $GLOBALS['mylinks_theme']) {
213
        $mymylinkstheme_options .= " selected='selected'";
214
    }
215
    $mymylinkstheme_options .= ">{$mymylinkstheme}</option>";
216
}
217
218
$mylinkstheme_select = "<select name='mylinks_theme_select' onchange='submit();' size='1'>{$mymylinkstheme_options}</select>";
219
220
$xoopsTpl->assign('mylinksthemeoption', $mylinkstheme_select);
221
222
//wanikoo search
223
if (file_exists(XOOPS_ROOT_PATH . "/language/{$xoopsConfig['language']}/search.php")) {
224
    include_once XOOPS_ROOT_PATH . "/language/{$xoopsConfig['language']}/search.php";
225
} else {
226
    include_once XOOPS_ROOT_PATH . '/language/english/search.php';
227
}
228
$xoopsTpl->assign('lang_all', _SR_ALL);
229
$xoopsTpl->assign('lang_any', _SR_ANY);
230
$xoopsTpl->assign('lang_exact', _SR_EXACT);
231
$xoopsTpl->assign('lang_search', _SR_SEARCH);
232
$xoopsTpl->assign('module_id', $xoopsModule->getVar('mid'));
233
234
//category head
235
$catarray = array();
236
if ($mylinks_show_letters) {
237
    $catarray['letters'] = ml_wfd_letters();
238
}
239
if ($mylinks_show_toolbar) {
240
    $catarray['toolbar'] = ml_wfd_toolbar();
241
}
242
$xoopsTpl->assign('catarray', $catarray);
243
244
include_once XOOPSMYLINKPATH . '/footer.php';
245