Issues (733)

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 (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
3
/**
4
 *
5
 * Module: SmartPartner
6
 * Author: The SmartFactory <www.smartfactory.ca>
7
 * Licence: GNU
8
 */
9
10
/**
11
 *Ceci nous produira un tableau de forme:
12
 *
13
 *PartnersArray[] =
14
 *     PartnersArray[TopCat1][info] = (nom, description)
15
 *     PartnersArray[TopCat1][partners] = array de partner (via fct get_partners_array())
16
 *      PartnersArray[TopCat1][subcats][0][info] = (nom, description)
17
 *      PartnersArray[TopCat1][subcats][0][partners] = array de partner
18
 *      PartnersArray[TopCat1][subcats][0][subcats]....
19
 *    Ainsi de suite
20
 *
21
 *ex: PartnersArray[TopCat1][partners][0][nom] contiendra le nom du 1er partenaire de TopCat1
22
 *
23
 */
24
25
/**
26
 *Loop inside the array of all partners to match with current category
27
 *
28
 *param $categoryid - id of the current category
29
 *return array of partners for the current category
30
 * @param $categoryid
31
 * @return array
32
 */
33
function get_partners_array($categoryid)
34
{
35
    global $every_partners_array, $count, $xoopsModuleConfig, $view_category_id;
36
    $partners = array();
37
    foreach ($every_partners_array as $partnerObj) {
38
        if (in_array($categoryid, explode('|', $partnerObj->categoryid())) && ($view_category_id || (!$view_category_id && count($partners) < $xoopsModuleConfig['percat_user']))) {
39
            $partner    = $partnerObj->toArray('index');
40
            $partners[] = $partner;
41
        }
42
    }
43
44
    return $partners;
45
}
46
47
/**
48
 *Loop inside the array of all categories to find subcats for current category
49
 *recusrive function: for each subcat found, call to function getcontent to
50
 *get partners and subcats within it
51
 *
52
 *param $categoryid - id of the current category
53
 *return array of subcats for the current category
54
 * @param $every_categories_array
55
 * @param $categoryid
56
 * @param $level
57
 * @return array
58
 */
59
function get_subcats($every_categories_array, $categoryid, $level)
60
{
61
62
    //global $every_categories_array;
63
    $subcatArray = array();
64
    ++$level;
65
66
    foreach ($every_categories_array as $subcatObj) {
67
        if ($subcatObj->parentid() == $categoryid) {
68
            $subcatArray[] = get_cat_content($every_categories_array, $subcatObj, $level);
69
        }
70
    }
71
72
    return $subcatArray;
73
}
74
75
/**
76
 *Retrieve content for the current category
77
 *
78
 *param $categoryid - id of the current category
79
 *return array of content for the current category
80
 * @param $every_categories_array
81
 * @param $categoryObj
82
 * @param $level
83
 * @return array
84
 */
85
function get_cat_content($every_categories_array, $categoryObj, $level)
86
{
87
    $category = array();
88
    $decalage = '';
89
    /*for ($i=0;$i<$level;++$i) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
90
         $decalage .= '--';
91
     }*/
92
    $decalage .= ' ';
93
    $category['title']       = $decalage . '' . $categoryObj->name();
94
    $category['categoryid']  = $categoryObj->categoryid();
95
    $category['description'] = $categoryObj->description();
96
    $category['link_view']   = $categoryObj->getCategoryUrl();
97
    $category['partners']    = get_partners_array($categoryObj->categoryid());
98
    $category['image_url']   = $categoryObj->getImageUrl(true);
99
    $category['subcats']     = get_subcats($every_categories_array, $categoryObj->categoryid(), $level);
100
101
    return $category;
102
}
103
104
include __DIR__ . '/header.php';
105
$xoopsOption['template_main'] = 'smartpartner_index.tpl';
106
include XOOPS_ROOT_PATH . '/header.php';
107
include __DIR__ . '/footer.php';
108
109
// At which record shall we start
110
$start = isset($_GET['start']) ? (int)$_GET['start'] : 0;
111
112
$view_category_id = isset($_GET['view_category_id']) ? (int)$_GET['view_category_id'] : 0;
113
114
$partners_total = $smartPartnerPartnerHandler->getPartnerCount();
115
116
if ($xoopsModuleConfig['index_sortby'] === 'title' || $xoopsModuleConfig['index_sortby'] === 'weight') {
117
    $order = 'ASC';
118
} else {
119
    $order = 'DESC';
120
}
121
//Retreive all records from database
122
$every_categories_array = $smartPartnerCategoryHandler->getCategories(0, 0, -1, 'weight', 'ASC', true);
123
$every_partners_array   = $smartPartnerPartnerHandler->getPartnersForIndex(-1, _SPARTNER_STATUS_ACTIVE, $xoopsModuleConfig['index_sortby'], $order);
124
125
$partnersArray = array();
126
127
//display All categories and partners
128
if (!$view_category_id) {
129
    //get orphan first if preference says so
130
    if ($xoopsModuleConfig['orphan_first']) {
131
        $partnersArray['orphan']['partners'] = get_partners_array(0);
132
    }
133
134
    //get all categories and content
135
    foreach ($every_categories_array as $categoryObj) {
136
        if ($categoryObj->parentid() == 0) {
137
            $partnersArray[] = get_cat_content($every_categories_array, $categoryObj, 0);
138
        }
139
    }
140
141
    //get orphan last if preference says so
142
    if (!$xoopsModuleConfig['orphan_first']) {
143
        $partnersArray['orphan']['partners'] = get_partners_array(0);
144
    }
145
146
    $categoryPath = '';
147
} //viewing a specific category
148
else {
149
    $currentCategoryObj = $every_categories_array[$view_category_id];
150
    $partnersArray[]    = get_cat_content($every_categories_array, $currentCategoryObj, 0);
151
152
    if (!$partnersArray[0]['partners'] && !$partnersArray[0]['subcats']) {
153
        redirect_header(SMARTPARTNER_URL, 3, _MD_SPARTNER_CATEGORY_EMPTY);
154
    }
155
    // Retreiving the category path
156
    $categoryPath = $currentCategoryObj->getCategoryPath();
157
}
158
159
//$partners_total_onpage = $count;.partners
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
160
$xoopsTpl->assign('partners', $partnersArray);
161
162
//end new code to implement categories
163
164
// Partners Navigation Bar
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
165
//$pagenav = new XoopsPageNav($partners_total_onpage, $xoopsModuleConfig['perpage_user'], $start, 'start', '');
166
//$xoopsTpl->assign('pagenav', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
167
$xoopsTpl->assign('view_deteils_cat', _MD_SPARTNER_DETAIL_CAT);
168
$xoopsTpl->assign('on_index_page', $view_category_id == 0);
169
$xoopsTpl->assign('sitename', $xoopsConfig['sitename']);
170
$xoopsTpl->assign('displayjoin', $xoopsModuleConfig['allowsubmit'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost']));
171
$xoopsTpl->assign('img_max_width', $xoopsModuleConfig['img_max_width']);
172
$xoopsTpl->assign('module_home', '<a href="' . SMARTPARTNER_URL . '">' . $smartPartnerModuleName . '</a>');
173
$xoopsTpl->assign('categoryPath', $categoryPath);
174
$xoopsTpl->assign('lang_intro_text', $myts->displayTarea($xoopsModuleConfig['welcomemsg']));
175
$xoopsTpl->assign('lang_partner', _MD_SPARTNER_PARTNER);
176
$xoopsTpl->assign('lang_desc', _MD_SPARTNER_DESCRIPTION);
177
$xoopsTpl->assign('lang_edit', _MD_SPARTNER_EDIT);
178
$xoopsTpl->assign('lang_delete', _MD_SPARTNER_DELETE);
179
$xoopsTpl->assign('lang_hits', _MD_SPARTNER_HITS);
180
$xoopsTpl->assign('lang_join', _MD_SPARTNER_JOIN);
181
$xoopsTpl->assign('lang_no_partners', _MD_SPARTNER_NOPART);
182
$xoopsTpl->assign('lang_main_partner', _MD_SPARTNER_PARTNERS);
183
$xoopsTpl->assign('lang_readmore', _MD_SPARTNER_READMORE);
184
$xoopsTpl->assign('partview_msg', $xoopsModuleConfig['partview_msg']);
185
if (!$xoopsModuleConfig['hide_module_name']) {
186
    $xoopsTpl->assign('lang_partnerstitle', $myts->displayTarea($xoopsModule->getVar('name')));
187
}
188
include_once XOOPS_ROOT_PATH . '/footer.php';
189