Issues (621)

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.

editprofile.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
 * 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
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * SmallWorld
14
 *
15
 * @copyright    The XOOPS Project (https://xoops.org)
16
 * @copyright    2011 Culex
17
 * @license      GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/)
18
 * @package      SmallWorld
19
 * @since        1.0
20
 * @author       Michael Albertsen (http://culex.dk) <[email protected]>
21
 */
22
23
use Xmf\Request;
24
use XoopsModules\Smallworld;
25
require_once __DIR__ . '/header.php';
26
27
require_once __DIR__ . '/../../mainfile.php';
28
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_userprofile_edittemplate.tpl';
29
require_once XOOPS_ROOT_PATH . '/header.php';
30
require_once XOOPS_ROOT_PATH . '/modules/smallworld/include/functions.php';
31
require_once XOOPS_ROOT_PATH . '/modules/smallworld/include/arrays.php';
32
//require_once XOOPS_ROOT_PATH . '/modules/smallworld/class/class_collector.php';
33
global $xoopsUser, $xoopsTpl, $xoopsDB, $xoTheme;
34
35
if ($xoopsUser) {
36
    $id      = $xoopsUser->getVar('uid');
37
    $check   = new smallworld\user;
38
    $profile = $check->CheckIfProfile($id);
39
40
    // Check if inspected userid -> redirect to userprofile and show admin countdown
41
    $inspect = Smallworld_isInspected($id);
42
    if ('yes' === $inspect['inspect']) {
43
        redirect_header('userprofile.php?username=' . $xoopsUser->getVar('uname'), 1);
44
    }
45
46
    if (2 == $profile) {
47
        $xoopsTpl->assign('check', $profile);
48
        $item = new smallworld\Form;
49
        $db   = new Smallworld\SwDatabase();
50
51
        $cdb    = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . $id . "'";
52
        $result = $xoopsDB->queryF($cdb);
53
        $cnt    = $xoopsDB->getRowsNum($result);
54
        while ($r = $xoopsDB->fetchArray($result)) {
55
            // ------------ PERSONAL INFO ------------ //
56
57
            // Real name
58
            if (0 != smallworldGetValfromArray('realname', 'smallworldusethesefields')) {
59
                $realname = $item->input('realname', 'realname', 'realname', $size = 30, $preset = $r['realname']);
60
                $xoopsTpl->append('realname', $realname);
61
            } else {
62
                $xoopsTpl->assign('show_realname', 'no');
63
            }
64
65
            // Dropdown for gender
66
            if (0 != smallworldGetValfromArray('gender', 'smallworldusethesefields')) {
67
                $gender = $item->dropdown('gender', $arr0, $r['gender']);
68
                $xoopsTpl->append('gender', $gender);
69
            } else {
70
                $xoopsTpl->assign('show_gender', 'no');
71
            }
72
73
            // Selectbox for "interested in gender(s)"
74 View Code Duplication
            if (0 != smallworldGetValfromArray('interestedin', 'smallworldusethesefields')) {
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...
75
                $nr          = unserialize($r['intingender']);
76
                $intInGender = $item->RetrieveRadio('intingender', $arr01, $nr, $selected = null);
77
                $xoopsTpl->append('intingender', $intInGender);
78
            } else {
79
                $xoopsTpl->assign('show_interestedin', 'no');
80
            }
81
82
            // Dropdown for marital status
83
            if (0 != smallworldGetValfromArray('relationshipstatus', 'smallworldusethesefields')) {
84
                $relationshipstatus = $item->dropdown('relationship', $arr02, 0);
85
                $xoopsTpl->append('relationshipstatus', $relationshipstatus);
86
87
                // Partner. Only shown if marital status is married, it's complicated, engaged)
88
                $partner = $item->input('partner', 'partner', 'partner', $size = '30', stripslashes($r['partner']));
89
                $xoopsTpl->append('partner', $partner);
90
            } else {
91
                $xoopsTpl->assign('show_relationshipstatus', 'no');
92
            }
93
94 View Code Duplication
            if (0 != smallworldGetValfromArray('lookingfor', 'smallworldusethesefields')) {
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...
95
                $nr1         = unserialize($r['searchrelat']);
96
                $searchrelat = $item->RetrieveRadio('searchrelat', $arr03, $nr1, $selected = null);
97
                $xoopsTpl->append('searchrelat', $searchrelat);
98
            } else {
99
                $xoopsTpl->assign('show_lookingfor', 'no');
100
            }
101
102
            if (0 != smallworldGetValfromArray('birthday', 'smallworldusethesefields')) {
103
                // Select Birthday dd-mm-Y
104
                $birthday = $item->input('birthday', 'birthday', 'birthday', $size = '12', $preset = stripslashes(Smallworld_UsToEuroDate($r['birthday'])));
105
                $xoopsTpl->append('birthdaydate', $birthday);
106
            } else {
107
                $xoopsTpl->assign('show_birthday', 'no');
108
            }
109
110
            // Select Hometown or Enter new
111
            if (0 != smallworldGetValfromArray('birthplace', 'smallworldusethesefields')) {
112
                $birthplace = $item->input('birthplace', 'birthplace', 'birthplace', $size = '50', $preset = stripslashes($r['birthplace']));
113
                $xoopsTpl->append('birthplace', $birthplace);
114
            } else {
115
                $xoopsTpl->assign('show_birthplace', 'no');
116
            }
117
118
            // Dropdown politics
119
            if (0 != smallworldGetValfromArray('politicalview', 'smallworldusethesefields')) {
120
                $politic = $item->dropdown('politic', $arr04, 0);
121
                $xoopsTpl->append('politic', $politic);
122
            } else {
123
                $xoopsTpl->assign('show_political', 'no');
124
            }
125
126
            // Dropdown Religion
127
            if (0 != smallworldGetValfromArray('religiousview', 'smallworldusethesefields')) {
128
                $religion = $item->dropdown('religion', $arr05, 0);
129
                $xoopsTpl->append('religion', $religion);
130
            } else {
131
                $xoopsTpl->assign('show_religion', 'no');
132
            }
133
134
            // ------------ CONTACT INFO ------------ //
135
            // Add email test
136
            if (0 != smallworldGetValfromArray('emails', 'smallworldusethesefields')) {
137
                $nr2       = unserialize($r['emailtype']);
138
                $emailtext = '';
139
                foreach ($nr2 as $k => $v) {
140
                    $nr2id     = 'email-' . $k;
141
                    $emailtext .= $item->input_add('smallworld_add2', 'email', 'emailtype', '.smallworld_clone2', 20, $addmore = null, $preset = stripslashes($v), $nr2id);
142
                    // $emailtext .= $item->input_add('smallworld_add2','email','emailtype','.smallworld_clone2',20,$addmore=null,$preset=stripslashes($v));
143
                    $emailtext .= "<span class='smallworld_remove' id='emailremove'><a href='javascript:void(0);' id='emailremovelnk'>" . _SMALLWORLD_REMOVE . '</a><br></span>';
144
                }
145
                $emailtext .= "<a class='smallworld_addemail' href='javascript:void(0);' id='emailAdd'>" . _SMALLWORLD_ADDMORE . '</a><br><br>';
146
                $xoopsTpl->append('emailtext', $emailtext);
147
            } else {
148
                $xoopsTpl->assign('show_emails', 'no');
149
            }
150
151
            //Add screen names (usernames for facebook etc etc)
152
            if (0 != smallworldGetValfromArray('screennames', 'smallworldusethesefields')) {
153
                $nr3    = unserialize($r['screenname_type']);
154
                $nr4    = unserialize($r['screenname']);
155
                $count1 = count($nr3);
156
                $cnt1   = 0;
157
158
                // Drop down for screen names
159
                $screenname = '';
160
                foreach ($nr3 as $k => $v) {
161
                    if ($cnt1 < $count1 - 1) {
162
                        $addmore1 = '';
163
                    } else {
164
                        $addmore1 = _SMALLWORLD_ADDMORE;
165
                    }
166
                    $screenname .= $item->dropdown_add('smallworld_add', 'screenname', 'screenname_type', '.smallworld_clone', $arr06, $addmore1, $selected = stripslashes($nr4[$k]), $preset = stripslashes($v));
167
                    $screenname .= "<span class='smallworld_remove' id='screennameremove'>";
168
                    $screenname .= "<a href='javascript:void(0);' id='screennameremovelnk'>" . _SMALLWORLD_REMOVE . '</a><br></span>';
169
                    ++$cnt1;
170
                }
171
                $screenname .= "<a class='smallworld_addscreenname' href='javascript:void(0);' id='screennameAdd'>" . _SMALLWORLD_ADDMORE . '</a><br><br>';
172
                $xoopsTpl->append('screenname', $screenname);
173
            } else {
174
                $xoopsTpl->assign('show_screennames', 'no');
175
            }
176
177
            // Mobilephone
178
            if (0 != smallworldGetValfromArray('mobile', 'smallworldusethesefields')) {
179
                $mobile = $item->input('mobile', 'mobile', 'mobile', 12, $preset = stripslashes($r['mobile']));
180
                $xoopsTpl->append('mobile', $mobile);
181
            } else {
182
                $xoopsTpl->assign('show_mobile', 'no');
183
            }
184
185
            // Landphone
186
            if (0 != smallworldGetValfromArray('landphone', 'smallworldusethesefields')) {
187
                $phone = $item->input('phone', 'phone', 'phone', 12, $preset = stripslashes($r['phone']));
188
                $xoopsTpl->append('phone', $phone);
189
            } else {
190
                $xoopsTpl->assign('show_landphone', 'no');
191
            }
192
193
            // Adress
194
            if (0 != smallworldGetValfromArray('streetadress', 'smallworldusethesefields')) {
195
                $adress = $item->input('adress', 'adress', 'adress', $size = '50', $preset = stripslashes($r['adress']));
196
                $xoopsTpl->append('adress', $adress);
197
            } else {
198
                $xoopsTpl->assign('show_adress', 'no');
199
            }
200
201
            if (0 != smallworldGetValfromArray('presentcity', 'smallworldusethesefields')) {
202
                $present_city = $item->input('present_city', 'present_city', 'present_city', 50, $preset = stripslashes($r['present_city']));
203
                $xoopsTpl->append('present_city', $present_city);
204
205
                $present_country = $item->input('present_country', 'present_country', 'present_country', $size = '50', $preset = stripslashes($r['present_country']));
206
                $xoopsTpl->append('present_country', $present_country);
207
            } else {
208
                $xoopsTpl->assign('show_city', 'no');
209
            }
210
211
            if (0 == smallworldGetValfromArray('website', 'smallworldusethesefields')) {
212
                $xoopsTpl->assign('show_website', 'no');
213
            }
214
215
            // ------------ INTERESTS ------------ //
216
217
            // Textarea for interests
218
            //textarea($name, $id, $title, $rows, $cols, $class)
219
            if (0 != smallworldGetValfromArray('interests', 'smallworldusethesefields')) {
220
                $interests = $item->textarea('interests', 'interests', _SMALLWORLD_INTERESTS, 1, 20, 'favourites', $preset = stripslashes($r['interests']));
221
                $xoopsTpl->append('interests', $interests);
222
            } else {
223
                $xoopsTpl->assign('show_interests', 'no');
224
            }
225
226
            // Textarea for Music
227 View Code Duplication
            if (0 != smallworldGetValfromArray('favouritemusic', 'smallworldusethesefields')) {
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...
228
                $music = $item->textarea('music', 'music', _SMALLWORLD_MUSIC, 1, 20, 'favourites', $preset = stripslashes($r['music']));
229
                $xoopsTpl->append('music', $music);
230
            } else {
231
                $xoopsTpl->assign('show_music', 'no');
232
            }
233
234
            // Textarea for Tvshow
235
            if (0 != smallworldGetValfromArray('favouritetvshows', 'smallworldusethesefields')) {
236
                $tvshow = $item->textarea('tvshow', 'tvshow', _SMALLWORLD_TVSHOW, 1, 20, 'favourites', $preset = stripslashes($r['tvshow']));
237
                $xoopsTpl->append('tvshow', $tvshow);
238
            } else {
239
                $xoopsTpl->assign('show_tv', 'no');
240
            }
241
242
            // Textarea for Movie
243
            if (0 != smallworldGetValfromArray('favouritemovies', 'smallworldusethesefields')) {
244
                $movie = $item->textarea('movie', 'movie', _SMALLWORLD_MOVIE, 1, 20, 'favourites', $preset = stripslashes($r['movie']));
245
                $xoopsTpl->append('movie', $movie);
246
            } else {
247
                $xoopsTpl->assign('show_movies', 'no');
248
            }
249
250
            // Textarea for Books
251
            if (0 != smallworldGetValfromArray('favouritebooks', 'smallworldusethesefields')) {
252
                $books = $item->textarea('books', 'books', _SMALLWORLD_BOOKS, 1, 20, 'favourites', $preset = stripslashes($r['books']));
253
                $xoopsTpl->append('books', $books);
254
            } else {
255
                $xoopsTpl->assign('show_books', 'no');
256
            }
257
258
            // Textarea for About me
259
            if (0 != smallworldGetValfromArray('aboutme', 'smallworldusethesefields')) {
260
                $aboutme = $item->textarea('aboutme', 'aboutme', _SMALLWORLD_ABOUTME, 2, 20, 'favourites', $preset = stripslashes($r['aboutme']));
261
                $xoopsTpl->append('aboutme', $aboutme);
262
            } else {
263
                $xoopsTpl->assign('show_aboutme', 'no');
264
            }
265
266
            // ------------ SCHOOL ------------ //
267
268
            //School name
269
            if (0 != smallworldGetValfromArray('education', 'smallworldusethesefields')) {
270
                $nr5    = unserialize($r['school_type']);
271
                $nr6    = unserialize($r['school']);
272
                $nr7    = unserialize($r['schoolstart']);
273
                $nr8    = unserialize($r['schoolstop']);
274
                $school = '';
275
                foreach ($nr5 as $k => $v) {
276
                    $school .= $item->school_add('smallworld_add3', 'school', 'school_type', '.smallworld_clone3', $arr7, _SMALLWORLD_ADDMORE, $selected = stripslashes($nr6[$k]), $preset = $v, $selectedstart = $nr7[$k], $selectedstop = $nr8[$k]);
277
                    $school .= "<span class='smallworld_remove2' id='schoolremove'>";
278
                    $school .= "<a href='javascript:void(0);' id='schoolremovelnk'>" . _SMALLWORLD_REMOVE . '</a><br></span>';
279
                }
280
                $school .= "<a class='smallworld_addschool' href='javascript:void(0);' id='schoolAdd'>" . _SMALLWORLD_ADDMORE . '</a><br><br>';
281
                $xoopsTpl->append('school', $school);
282
            } else {
283
                $xoopsTpl->assign('show_school', 'no');
284
            }
285
286
            //Jobs
287
            if (0 != smallworldGetValfromArray('employment', 'smallworldusethesefields')) {
288
                $nr9  = unserialize($r['employer']);
289
                $nr10 = unserialize($r['position']);
290
                $nr11 = unserialize($r['jobstart']);
291
                $nr12 = unserialize($r['jobstop']);
292
                $nr13 = unserialize(stripslashes($r['description']));
293
                $job  = '';
294
                foreach ($nr9 as $k => $v) {
295
                    $job .= $item->job(
296
                        'smallworld_add4',
297
                        'job',
298
                        'job_type',
299
                        '.smallworld_clone4',
300
                        _SMALLWORLD_ADDMORE,
301
                        $employer = stripslashes($v),
302
                        $position = stripslashes($nr10[$k]),
303
                        $selectedstart = ('' != $nr11[$k]) ? date('Y', $nr11[$k]) : '',
304
                                       $selectedstop = ('' != $nr12[$k]) ? date('Y', $nr12[$k]) : '',
305
                        $description = $nr13[$k]
306
                    );
307
                    $job .= "<span class='smallworld_remove3' id='jobremove'>";
308
                    $job .= "<a href='javascript:void(0);' id='jobremovelnk'>" . _SMALLWORLD_REMOVE . '</a><br></span>';
309
                }
310
                $job .= "<a class='smallworld_addjob' href='javascript:void(0);' id='jobAdd'>" . _SMALLWORLD_ADDMORE . '</a><br><br>';
311
                $xoopsTpl->append('job', $job);
312
            } else {
313
                $xoopsTpl->assign('show_jobs', 'no');
314
            }
315
316
            // Create hidden forms for birthcity
317
            $birthplace_lat     = $item->hidden('birthplace_lat', 'birthplace_lat', $preset = stripslashes($r['birthplace_lat']));
318
            $birthplace_lng     = $item->hidden('birthplace_lng', 'birthplace_lng', $preset = stripslashes($r['birthplace_lng']));
319
            $birthplace_country = $item->hidden('birthplace_country', 'birthplace_country', $preset = stripslashes($r['birthplace_country']));
320
            $xoopsTpl->append('birthplace_lat', $birthplace_lat);
321
            $xoopsTpl->append('birthplace_lng', $birthplace_lng);
322
            $xoopsTpl->append('birthplace_country', $birthplace_country);
323
324
            // Create hidden forms for present city
325
            $present_lat = $item->hidden('present_lat', 'present_lat', $preset = stripslashes($r['present_lat']));
326
            $present_lng = $item->hidden('present_lng', 'present_lng', $preset = stripslashes($r['present_lng']));
327
            $xoopsTpl->append('present_lat', $present_lat);
328
            $xoopsTpl->append('present_lng', $present_lng);
329
330
            $xoopsTpl->append('smallworld_register_title', _SMALLWORLD_REGRISTATION_TITLE);
331
            $xoopsTpl->assign('smallworld_beforesubmit', _SMALLWORLD_TEXTBEFORESUBMIT);
332
            $xoopsTpl->assign('smallworld_save', _SMALLWORLD_SUBMIT);
333
            $xoopsTpl->assign('smallworld_user_website', $r['website']);
334
        }
335
    } elseif ($profile < 2) {
336
        redirect_header(XOOPS_URL . '/modules/smallworld/register.php');
337
    }
338
} else {
339
    redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM);
340
}
341
require_once XOOPS_ROOT_PATH . '/footer.php';
342