Issues (1210)

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.

admin/events.php (5 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
 * @copyright   {@link http://xoops.org/ XOOPS Project}
14
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team,
18
 * @author       GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/)
19
 */
20
21
require_once __DIR__ . '/admin_header.php';
22
//require_once __DIR__ . '/../../../include/cp_header.php';
23
require_once __DIR__ . '/../class/APCal.php';
24
require_once __DIR__ . '/../class/APCal_xoops.php';
25
require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
26
27
// for "Duplicatable"
28
$moduleDirName = basename(dirname(__DIR__));
29
if (!preg_match('/^(\D+)(\d*)$/', $moduleDirName, $regs)) {
30
    echo('invalid dirname: ' . htmlspecialchars($moduleDirName));
31
}
32
$mydirnumber = $regs[2] === '' ? '' : (int)$regs[2];
33
34
require_once XOOPS_ROOT_PATH . "/modules/$moduleDirName/include/gtickets.php";
35
36
// SERVER, GET �ѿ��μ���
37
$tz   = isset($_GET['tz']) ? preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['tz']) : 'y';
38
$pos  = isset($_GET['pos']) ? (int)$_GET['pos'] : 0;
39
$num  = isset($_GET['num']) ? (int)$_GET['num'] : 20;
40
$cid  = isset($_GET['cid']) ? (int)$_GET['cid'] : 0;
41
$txt  = isset($_GET['txt']) ? trim($_GET['txt']) : '';
42
$done = isset($_GET['done']) ? $_GET['done'] : '';
43
44
// MySQL�ؤ���³
45
$conn = $GLOBALS['xoopsDB']->conn;
46
47
// setting physical & virtual paths
48
$mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
49
$mod_url  = XOOPS_URL . "/modules/$moduleDirName";
50
51
// creating an instance of APCal
52
$cal = new APCal_xoops('', $xoopsConfig['language'], true);
53
54
// setting properties of APCal
55
$cal->conn = $conn;
56
include __DIR__ . '/../include/read_configs.php';
57
$cal->base_url    = $mod_url;
58
$cal->base_path   = $mod_path;
59
$cal->images_url  = "$mod_url/assets/images/$skin_folder";
60
$cal->images_path = "$mod_path/assets/images/$skin_folder";
61
62
// ��̤��ˤ��ʤ���ߡʥǥե���Ȥ�̤���
63
$pf_options = "
64
    <option value='future'>" . _AM_APCAL_OPT_FUTURE . "</option>
65
    <option value='past'>" . _AM_APCAL_OPT_PAST . "</option>
66
    <option value='pandf'>" . _AM_APCAL_OPT_PASTANDFUTURE . "</option>\n";
67
$pf         = empty($_GET['pf']) ? 'future' : preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['pf']);
68
switch ($pf) {
69 View Code Duplication
    case 'past':
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...
70
        $pf_options = str_replace("'past'>", "'past' selected>", $pf_options);
71
        $whr_pf     = "start<'" . time() . "'";
72
        break;
73
    case 'pandf':
74
        $pf_options = str_replace("'pandf'>", "'pandf' selected>", $pf_options);
75
        $whr_pf     = '1';
76
        break;
77
    default:
78
        $pf = 'future';
79 View Code Duplication
    case 'future':
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...
80
        $pf_options = str_replace("'future'>", "'future' selected>", $pf_options);
81
        $whr_pf     = "end>'" . time() . "'";
82
        break;
83
}
84
85
// ���ƥ��꡼�����ν���
86
$cattree = new XoopsTree($cal->cat_table, 'cid', 'pid');
87
ob_start();
88
$cattree->makeMySelBox('cat_title', 'weight', $cid, true, 'cid', '');
89
$cat_selbox = ob_get_contents();
90
ob_end_clean();
91
$cat_selbox4extract = str_replace("<option value='0'>", "<option value='0'>" . _ALL . "</option>\n<option value='-1'" . ($cid == -1 ? 'selected' : '') . '>', $cat_selbox);
92
93
// Timezone ���
94
$serverTZ  = $cal->server_TZ;
95
$userTZ    = $xoopsUser->timezone();
96
$tzoptions = "
97
    <option value='s'>" . _AM_APCAL_TZOPT_SERVER . "</option>
98
    <option value='g'>" . _AM_APCAL_TZOPT_GMT . "</option>
99
    <option value='y'>" . _AM_APCAL_TZOPT_USER . "</option>\n";
100 View Code Duplication
switch ($tz) {
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...
101
    case 's':
102
        $tzoffset  = 0;
103
        $tzdisp    = ($serverTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($serverTZ), abs($serverTZ) * 60 % 60);
104
        $tzoptions = str_replace("'s'>", "'s' selected>", $tzoptions);
105
        break;
106
    case 'g':
107
        $tzoffset  = -$serverTZ * 3600;
108
        $tzdisp    = 'GMT';
109
        $tzoptions = str_replace("'g'>", "'g' selected>", $tzoptions);
110
        break;
111
    default:
112
    case 'y':
113
        $tzoffset  = ($userTZ - $serverTZ) * 3600;
114
        $tzdisp    = ($userTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($userTZ), abs($userTZ) * 60 % 60);
115
        $tzoptions = str_replace("'y'>", "'y' selected>", $tzoptions);
116
        break;
117
}
118
119
// �ǡ����١��������ʤɤ���������
120
if (isset($_POST['delete'])) {
121
122
    // Ticket Check
123
    if (!$xoopsGTicket->check()) {
124
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
125
    }
126
127
    // �쥳���ɤκ��
128
    if (isset($_POST['ids']) && is_array($_POST['ids'])) {
129
        $whr = '';
130
        foreach ($_POST['ids'] as $id) {
131
            $whr .= "id=$id OR rrule_pid=$id OR ";
132
            xoops_comment_delete($xoopsModule->mid(), $id);
133
        }
134
        $sql = "DELETE FROM $cal->table WHERE ($whr 0) AND (rrule_pid=0 OR rrule_pid=id)";
135
        $GLOBALS['xoopsDB']->query($sql);
136
        $records = $GLOBALS['xoopsDB']->getAffectedRows($conn);
137
        $sql     = "DELETE FROM $cal->table WHERE $whr 0 ";
138
        if (!$GLOBALS['xoopsDB']->query($sql)) {
139
            echo $GLOBALS['xoopsDB']->error();
140
        } else {
141
            $mes = urlencode("$records " . _AM_APCAL_MES_DELETED);
142
        }
143
    } else {
144
        $mes = '';
145
    }
146
    $cal->redirect("cid=$cid&num=$num&tz=$tz&done=deleted&mes=$mes");
147
    exit;
148
} elseif (isset($_POST['addlink']) && isset($_POST['ids']) && is_array($_POST['ids']) && $_POST['cid'] > 0) {
149
150
    // Ticket Check
151
    if (!$xoopsGTicket->check()) {
152
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
153
    }
154
155
    // ���ƥ��꡼�ؤΥ���ɲ�
156
    $cid     = (int)$_POST['cid'];
157
    $cid4sql = sprintf('%05d,', $cid);
158
    $whr     = '';
159
    foreach ($_POST['ids'] as $id) {
160
        $whr .= "id=$id OR rrule_pid=$id OR ";
161
    }
162
    $sql = "UPDATE $cal->table SET categories=CONCAT(categories,'$cid4sql') WHERE ($whr 0) AND categories NOT LIKE '%$cid4sql%'";
163
    if (!$GLOBALS['xoopsDB']->query($sql)) {
164
        echo $GLOBALS['xoopsDB']->error();
165
    }
166
    $records = $GLOBALS['xoopsDB']->getAffectedRows($conn);
167
    $mes     = urlencode("$records " . _AM_APCAL_MES_EVENTLINKTOCAT);
168
    $cal->redirect("cid=$cid&num=$num&tz=$tz&done=copied&mes=$mes");
169
    exit;
170
} elseif (isset($_POST['movelink']) && isset($_POST['ids']) && is_array($_POST['ids']) && isset($_POST['cid'])
171
          && $_POST['old_cid'] > 0
172
) {
173
174
    // Ticket Check
175
    if (!$xoopsGTicket->check()) {
176
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
177
    }
178
179
    // ���ƥ��꡼�ؤΥ�󥯰�ư�ޤ��Ϻ��
180
    $cid         = (int)$_POST['cid'];
181
    $cid4sql     = $cid > 0 ? sprintf('%05d,', $cid) : '';
182
    $old_cid     = (int)$_POST['old_cid'];
183
    $old_cid4sql = sprintf('%05d,', $old_cid);
184
    $whr         = '';
185
    foreach ($_POST['ids'] as $id) {
186
        $whr .= "id=$id OR rrule_pid=$id OR ";
187
    }
188
    $sql = "UPDATE $cal->table SET categories=REPLACE(categories,'$old_cid4sql','$cid4sql') WHERE ($whr 0)";
189
    if (!$GLOBALS['xoopsDB']->query($sql)) {
190
        echo $GLOBALS['xoopsDB']->error();
191
    }
192
    $records = $GLOBALS['xoopsDB']->getAffectedRows($conn);
193
    if ($cid > 0) {
194
        $mes = urlencode("$records " . _AM_APCAL_MES_EVENTLINKTOCAT);
195
    } else {
196
        $mes = urlencode("$records " . _AM_APCAL_MES_EVENTUNLINKED);
197
    }
198
    $cal->redirect("cid=$old_cid&num=$num&tz=$tz&done=moved&mes=$mes");
199
    exit;
200
} elseif (isset($_POST['output_ics_confirm']) && !empty($_POST['ids']) && is_array($_POST['ids'])) {
201
202
    // Ticket Check
203
    if (!$xoopsGTicket->check()) {
204
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
205
    }
206
207
    // iCalendar�Хå����ϥץ�åȥե������ǧ
208
    xoops_cp_header();
209
    $adminObject->displayNavigation(basename(__FILE__));
210
    echo $cal->output_ics_confirm("$mod_url/", '_blank');
211
    xoops_cp_footer();
212
    exit;
213
}
214
215
// ���ƥ��꡼����
216
if ($cid > 0) {
217
    $cid4sql = sprintf('%05d,', $cid);
218
    $whr_cid = "categories like '%$cid4sql%'";
219
} elseif ($cid == -1) {
220
    $whr_cid = "categories=''";
221
} else {
222
    $whr_cid = '1';
223
}
224
225
// �ե꡼��ɸ���
226
if ($txt !== '') {
227
    $whr_txt = '';
228
    if (get_magic_quotes_gpc()) {
229
        $txt = stripslashes($txt);
230
    }
231
    $keywords = explode(' ', $cal->mb_convert_kana($txt, 's'));
232
    foreach ($keywords as $keyword) {
233
        $whr_txt .= "(CONCAT( summary , description , location , contact ) LIKE '%" . addslashes($keyword) . "%') AND ";
234
    }
235
    $whr_txt = substr($whr_txt, 0, -4);
236
} else {
237
    $whr_txt = '1';
238
}
239
240
$whr = "$whr_cid AND $whr_txt AND $whr_pf AND rrule_pid=0 OR $whr_cid AND $whr_txt AND rrule_pid=id";
241
242
// Main query
243
//$rs      = $xoopsDB->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
244
//$numrows = mysql_result($rs, 0, 0);
245
//$rs      = $xoopsDB->query("SELECT * FROM $cal->table WHERE $whr ORDER BY start,end LIMIT $pos,$num");
246
247
$rs        = $GLOBALS['xoopsDB']->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
248
$numrows   = 0;
249
$resultRow = $GLOBALS['xoopsDB']->fetchRow($rs);
250
if (false !== $resultRow && isset($resultRow[0])) {
251
    $numrows = $resultRow[0];
252
}
253
$rs = $GLOBALS['xoopsDB']->query("SELECT * FROM $cal->table WHERE $whr ORDER BY start,end LIMIT $pos,$num");
254
255
// Page Navigation
256
include XOOPS_ROOT_PATH . '/class/pagenav.php';
257
$nav      = new XoopsPageNav($numrows, $num, $pos, 'pos', "cid=$cid&amp;tz=$tz&amp;num=$num&amp;pf=$pf&amp;txt=" . urlencode($txt));
258
$nav_html = $nav->renderNav(10);
259 View Code Duplication
if ($numrows <= 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...
260
    $nav_num_info = _NONE;
261
} elseif ($pos + $num > $numrows) {
262
    $nav_num_info = ($pos + 1) . "-$numrows/$numrows";
263
} else {
264
    $nav_num_info = ($pos + 1) . '-' . ($pos + $num) . '/' . $numrows;
265
}
266
267
// メイン出力部
268
xoops_cp_header();
269
$adminObject->displayNavigation(basename(__FILE__));
270
271
echo '
272
<h4 xmlns="http://www.w3.org/1999/html">' . _AM_APCAL_MENU_EVENTS . "</h4>
273
<p><style='color: blue; '>" . (isset($_GET['mes']) ? htmlspecialchars($_GET['mes'], ENT_QUOTES) : '') . "</style></p>\n" . (isset($confirm_html) ? $confirm_html : '') . "
274
<form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:left'>
275
  <select name='tz' onChange='submit();'>$tzoptions</select>
276
  <input type='hidden' name='cid' value='$cid' />
277
  <input type='hidden' name='num' value='$num' />
278
  <input type='hidden' name='txt' value='" . htmlspecialchars($txt, ENT_QUOTES) . "' />
279
</form>
280
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
281
  <tr>
282
    <td align='left'>
283
      $nav_num_info
284
    </td>
285
    <td>
286
      <form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:right'>
287
        <select name='pf'>
288
          $pf_options
289
        </select>
290
        $cat_selbox4extract
291
        <input type='text' name='txt' value='" . htmlspecialchars($txt, ENT_QUOTES) . "' />
292
        <input type='submit' value='" . _AM_APCAL_BUTTON_EXTRACT . "' /> &nbsp;
293
        $nav_html &nbsp;
294
        <input type='hidden' name='num' value='$num' />
295
        <input type='hidden' name='tz' value='$tz' />
296
      </form>
297
    </td>
298
  </tr>
299
</table>
300
<form class='apcalForm' id='MainForm' name='MainForm' action='?tz=$tz&amp;num=$num&amp;cid=$cid' method='post' style='margin-top:0px;'>
301
" . $xoopsGTicket->getTicketHtml(__LINE__) . "
302
<table width='100%' class='outer' cellpadding='4' cellspacing='1'>
303
  <tr valign='middle'>
304
    <th>" . _AM_APCAL_IO_TH0 . '</th>
305
    <th>' . _AM_APCAL_IO_TH1 . "<br>($tzdisp)</th>
306
    <th>" . _AM_APCAL_IO_TH2 . "<br>($tzdisp)</th>
307
    <th>" . _AM_APCAL_IO_TH3 . '</th>
308
    <th>' . _AM_APCAL_IO_TH4 . '</th>
309
    <th>' . _AM_APCAL_IO_TH5 . "</th>
310
    <th></th>
311
    <th><input type='checkbox' name='dummy' onclick=\"with(document.MainForm){for (i=0;i<length;i++) {if (elements[i].type=='checkbox') {elements[i].checked=this.checked;}}}\" /></th>
312
  </tr>
313
";
314
315
// �ꥹ�Ƚ�����
316
$myts    = MyTextSanitizer::getInstance();
317
$oddeven = 'odd';
318
while ($event = $GLOBALS['xoopsDB']->fetchObject($rs)) {
319
    $oddeven = ($oddeven === 'odd' ? 'even' : 'odd');
320 View Code Duplication
    if ($event->allday) {
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...
321
        $start_desc = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->start) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
322
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->end - 300) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
323
    } else {
324
        $start_desc = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->start + $tzoffset);
325
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->end + $tzoffset);
326
    }
327
    $summary4disp = $myts->htmlSpecialChars($event->summary);
328
    echo "
329
  <tr>
330
    <td class='$oddeven'>" . XoopsUser::getUnameFromId($event->uid) . "</td>
331
    <td class='$oddeven' nowrap='nowrap'>$start_desc</td>
332
    <td class='$oddeven' nowrap='nowrap'>$end_desc</td>
333
    <td class='$oddeven'><a href='$mod_url/index.php?action=View&amp;event_id=$event->id'>$summary4disp</a></td>
334
    <td class='$oddeven'>" . $cal->rrule_to_human_language($event->rrule) . "</td>
335
    <td class='$oddeven'>" . ($event->admission ? _YES : _NO) . "</td>
336
    <td class='$oddeven' align='right'><a href='$mod_url/index.php?action=Edit&amp;event_id=$event->id' target='_blank'><img src='$cal->images_url/addevent.gif' border='0' width='14' height='12' /></a></td>
337
    <td class='$oddeven' align='right'><input type='checkbox' name='ids[]' value='$event->id' /></td>
338
  </tr>\n";
339
}
340
341
echo "
342
  <tr>
343
    <td colspan='8' align='right' class='head'>
344
      "
345
     . _AM_APCAL_LABEL_IO_CHECKEDITEMS
346
     . ' &nbsp; '
347
     . _AM_APCAL_LABEL_IO_OUTPUT
348
     . "<input type='submit' name='output_ics_confirm' value='"
349
     . _APCAL_BTN_EXPORT
350
     . "' /> &nbsp; "
351
     . _AM_APCAL_LABEL_IO_DELETE
352
     . "<input type='submit' name='delete' value='"
353
     . _DELETE
354
     . "' onclick='return confirm(\""
355
     . _AM_APCAL_CONFIRM_DELETE
356
     . "\")' /><br>
357
      <br>
358
      $cat_selbox <input type='submit' name='movelink' value='"
359
     . _AM_APCAL_BUTTON_MOVE
360
     . "' onclick='return confirm(\""
361
     . _AM_APCAL_CONFIRM_MOVE
362
     . "\")' "
363
     . ($cid <= 0 ? "disabled='disabled'" : '')
364
     . " /> <input type='submit' name='addlink' value='"
365
     . _AM_APCAL_BUTTON_COPY
366
     . "' onclick='return confirm(\""
367
     . _AM_APCAL_CONFIRM_COPY
368
     . "\")' />
369
      <input type='hidden' name='old_cid' value='$cid' />
370
    </td>
371
  </tr>
372
  <tr>
373
    <td colspan='8' align='right' valign='bottom' height='50'>"
374
     . _AM_APCAL_COPYRIGHT
375
     . '</td>
376
  </tr>
377
</table>
378
</form>
379
';
380
381
require_once __DIR__ . '/admin_footer.php';
382