Issues (58)

Security Analysis    not enabled

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

blocks/partners.php (1 issue)

Severity
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 * This program is distributed in the hope that it will be useful,
7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
 *
10
 *-----------------------------------
11
 * Author: Raul Recio (AKA UNFOR)
12
 * Project: The XOOPS Project
13
 *-----------------------------------
14
 */
15
16
/**
17
 * Module: XoopsPartners - a partner affiliation links module
18
 *
19
 * @param mixed $options
20
 * @author       Raul Recio (aka UNFOR)
21
 * @author       XOOPS Module Development Team
22
 * @copyright    {@link https://xoops.org 2001-2016 XOOPS Project}
23
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
24
 * @link         https://xoops.org XOOPS
25
 * @package      module\Xoopspartners\blocks
26
 */
27
28
use XoopsModules\Xoopspartners\Helper;
29
30
/**
31
 * Show partners in block
32
 * @param array $options from block preferences
33
 *
34
 *  $options:  0  - Put spaces between partners
35
 *             1  - Fade partners in/out
36
 *             2  - Randomize which partners to display in block
37
 *             3  - Number of partners to display
38
 *             4  - show images|text|both
39
 *             5  - display order id|hits|title|weight
40
 *             6  - order ASC|DESC
41
 *             7  - max title length (0 for unlimited)
42
 *
43
 * @return array block settings
44
 */
45
function b_xoopspartners_show($options)
46
{
47
    $myts = \MyTextSanitizer::getInstance();
0 ignored issues
show
The assignment to $myts is dead and can be removed.
Loading history...
48
49
    $moduleDirName = basename(dirname(__DIR__));
50
    /** @var \XoopsModules\Xoopspartners\Helper $helper */
51
    $helper            = Helper::getInstance();
52
    $partnersHandler = $helper->getHandler('Partners');
53
54
    $block = ['xpDir' => $moduleDirName];
55
56
    $pFields  = ['id', 'url', 'image', 'title', 'description'];
57
    $criteria = new \CriteriaCompo(new \Criteria('status', 1, '='));
58
    $criteria->setLimit($options[3]);
59
    if ($options[2]) {
60
        $criteria->setSort('RAND()');
61
    } else {
62
        $criteria->setSort($options[5]);
63
        $criteria->setOrder($options[6]);
64
    }
65
    $pObjs = $partnersHandler->getAll($criteria, $pFields);
66
    foreach ($pObjs as $pObj) {
67
        $partners    = [];
68
        $url         = $pObj->getVar('url');
69
        $origtitle   = $pObj->getVar('title');
70
        $title       = $origtitle;
71
        $description = $pObj->getVar('description');
72
        $image       = $pObj->getVar('image');
73
        //@TODO:  make display string length a config option
74
        if (!empty($options[7])) {
75
            $title = xoops_substr($origtitle, 0, (int)$options[7]);
76
        }
77
78
        //        $title = (mb_strlen($origtitle) > 19) ? xoops_substr($title, 0, 19) : $title;
79
        $partners['id']          = $pObj->getVar('id');
80
        $partners['url']         = $url;
81
        $partners['description'] = $description;
82
83
        if (!empty($image) && (1 == $options[4] || 3 == $options[4])) {
84
            $partners['image']     = $image;
85
            $partners['image_ttl'] = $title;
86
        }
87
        if (empty($image) || (2 == $options[4]) || (3 == $options[4])) {
88
            $partners['title'] = $title;
89
        } else {
90
            $partners['title'] = '';
91
        }
92
        $block['partners'][] = $partners;
93
    }
94
    $block['insertBr']  = (1 == $options[0]);
95
    $block['fadeImage'] = (1 == $options[1]);
96
97
    //now load the stylesheet & jquery
98
    $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/style.css'));
99
    $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
100
    $GLOBALS['xoTheme']->renderMetas(null, true);
101
102
    return $block;
103
}
104
105
/**
106
 * Edit Random Partners block preferences
107
 *
108
 * @param array $options from block preferences
109
 *
110
 * @return string HTML to display for edit form
111
 */
112
function b_xoopspartners_edit($options)
113
{
114
    if (0 == $options[0]) { //put spaces between partners
115
        $chk0no  = ' checked';
116
        $chk0yes = '';
117
    } else {
118
        $chk0no  = '';
119
        $chk0yes = ' checked';
120
    }
121
    if (0 == $options[1]) { //fade partners in/out
122
        $chk1no  = ' checked';
123
        $chk1yes = '';
124
    } else {
125
        $chk1no  = '';
126
        $chk1yes = ' checked';
127
    }
128
    if (0 == $options[2]) {  //randomize partners in block
129
        $chk2no  = ' checked';
130
        $chk2yes = '';
131
    } else {
132
        $chk2no  = '';
133
        $chk2yes = ' checked';
134
    }
135
    $form = "<table class='bnone'>\n"
136
            . "  <tr>\n"
137
            . '    <td>'
138
            . _MB_XOOPSPARTNERS_PSPACE
139
            . "</td>\n"
140
            . '    <td>'
141
            . "<input type='radio' name='options[0]' id ='options0_0' value='0'{$chk0no}>"
142
            . "<label for='options0_0'>"
143
            . _NO
144
            . '</label>&nbsp;'
145
            . "<input type='radio' name='options[0]' id ='options0_1' value='1'{$chk0yes}>"
146
            . "<label for='options0_1'>"
147
            . _YES
148
            . '</label>'
149
            . "</td>\n"
150
            . "  </tr>\n"
151
            . "  <tr>\n"
152
            . '    <td>'
153
            . _MB_XOOPSPARTNERS_FADE
154
            . "</td>\n"
155
            . '    <td>'
156
            . "<input type='radio' name='options[1]' id='options1_0' value='0'{$chk1no}>"
157
            . _NO
158
            . "<label for='options1_0'>"
159
            . _NO
160
            . '</label>&nbsp;'
161
            . "<input type='radio' name='options[1]' id='options1_1' value='1'{$chk1yes}>"
162
            . _YES
163
            . "<label for='options1_1'>"
164
            . _YES
165
            . '</label>'
166
            . "</td>\n"
167
            . "  </tr>\n"
168
            . "  <tr>\n"
169
            . '    <td>'
170
            . _MB_XOOPSPARTNERS_BRAND
171
            . "</td>\n"
172
            . '     <td>'
173
            . "<input type='radio' name='options[2]' id='option2_0' value='0'{$chk2no}>"
174
            . _NO
175
            . "<label for='options2_0'>"
176
            . _NO
177
            . '</label>'
178
            . "<input type='radio' name='options[2]' id='options2_1' value='1'{$chk2yes}>"
179
            . _YES
180
            . "<label for='options2_1'>"
181
            . _YES
182
            . '</label>'
183
            . "</td>\n"
184
            . "  </tr>\n"
185
            . "  <tr>\n"
186
            . '    <td>'
187
            . _MB_XOOPSPARTNERS_BLIMIT
188
            . "</td>\n"
189
            . "    <td><input class='right' type='number' name='options[3]' size='5' value='{$options[3]}' min='0'></td>\n"
190
            . "  </tr>\n"
191
            . "  <tr>\n"
192
            . '    <td>'
193
            . _MB_XOOPSPARTNERS_BSHOW
194
            . "</td>\n"
195
            . "    <td>\n"
196
            . "      <select size='1' name='options[4]'>\n";
197
    $sel  = (1 == $options[4]) ? ' selected' : '';
198
    $form .= "        <option value='1'{$sel}>" . _MB_XOOPSPARTNERS_IMAGES . "</option>\n";
199
200
    $sel  = (2 == $options[4]) ? ' selected' : '';
201
    $form .= "        <option value='2'{$sel}>" . _MB_XOOPSPARTNERS_TEXT . "</option>\n";
202
203
    $sel  = (3 == $options[4]) ? ' selected' : '';
204
    $form .= "        <option value='3'{$sel}>" . _MB_XOOPSPARTNERS_BOTH . "</option>\n" . "      </select>\n" . "    </td>\n" . "  </tr>\n" . "  <tr>\n" . '    <td>' . _MB_XOOPSPARTNERS_BSORT . "</td>\n" . "    <td>\n" . "      <select size='1' name='options[5]'>\n";
205
206
    $sel  = ('id' === $options[5]) ? ' selected' : '';
207
    $form .= "        <option value='id'{$sel}>" . _MB_XOOPSPARTNERS_ID . "</option>\n";
208
209
    $sel  = ('hits' === $options[5]) ? ' selected' : '';
210
    $form .= "        <option value='hits'{$sel}>" . _MB_XOOPSPARTNERS_HITS . "</option>\n";
211
212
    $sel  = ('title' === $options[5]) ? ' selected' : '';
213
    $form .= "        <option value='title'{$sel}>" . _MB_XOOPSPARTNERS_TITLE . "</option>\n";
214
215
    $sel  = ('weight' === $options[5]) ? ' selected' : '';
216
    $form .= "        <option value='weight'{$sel}>" . _MB_XOOPSPARTNERS_WEIGHT . "</option>\n" . "      </select>\n" . "      <select size='1' name='options[6]'>\n";
217
218
    $sel  = ('ASC' === $options[6]) ? ' selected' : '';
219
    $form .= "        <option value='ASC'{$sel}>" . _MB_XOOPSPARTNERS_ASC . "</option>\n";
220
221
    $sel  = ('DESC' === $options[6]) ? ' selected' : '';
222
    $form .= "        <option value='DESC'{$sel}>"
223
             . _MB_XOOPSPARTNERS_DESC
224
             . "</option>\n"
225
             . "      </select>\n"
226
             . "    </td>\n"
227
             . "  </tr>\n"
228
             . "  <tr>\n"
229
             . '    <td>'
230
             . _MB_XOOPSPARTNERS_TTL_LENGTH
231
             . "</td>\n"
232
             . '    <td>'
233
             . "<input type='number' class='right' name='options[7]' size='5' value='{$options[7]}' min='0'>"
234
             . "</td>\n"
235
             . "  </tr>\n"
236
             . "  <tr>\n"
237
             . "</table>\n";
238
239
    return $form;
240
}
241