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/icalendar_import.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
/*
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
26
// for "Duplicatable"
27
$moduleDirName = basename(dirname(__DIR__));
28
if (!preg_match('/^(\D+)(\d*)$/', $moduleDirName, $regs)) {
29
    echo('invalid dirname: ' . htmlspecialchars($moduleDirName));
30
}
31
$mydirnumber = $regs[2] === '' ? '' : (int)$regs[2];
32
33
require_once XOOPS_ROOT_PATH . "/modules/$moduleDirName/include/gtickets.php";
34
35
// SERVER, GET �ѿ��μ���
36
$tz   = isset($_GET['tz']) ? preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['tz']) : 'y';
37
$pos  = isset($_GET['pos']) ? (int)$_GET['pos'] : 0;
38
$num  = isset($_GET['num']) ? (int)$_GET['num'] : 20;
39
$done = isset($_GET['done']) ? $_GET['done'] : '';
40
41
// MySQL�ؤ���³
42
$conn = $GLOBALS['xoopsDB']->conn;
43
44
// setting physical & virtual paths
45
$mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
46
$mod_url  = XOOPS_URL . "/modules/$moduleDirName";
47
48
// creating an instance of APCal
49
$cal = new APCal_xoops('', $xoopsConfig['language'], true);
50
51
// setting properties of APCal
52
$cal->conn = $conn;
53
include __DIR__ . '/../include/read_configs.php';
54
$cal->base_url    = $mod_url;
55
$cal->base_path   = $mod_path;
56
$cal->images_url  = "$mod_url/assets/images/$skin_folder";
57
$cal->images_path = "$mod_path/assets/images/$skin_folder";
58
59
// Timezone ���
60
$serverTZ  = $cal->server_TZ;
61
$userTZ    = $xoopsUser->timezone();
62
$tzoptions = "
63
    <option value='s'>" . _AM_APCAL_TZOPT_SERVER . "</option>
64
    <option value='g'>" . _AM_APCAL_TZOPT_GMT . "</option>
65
    <option value='y'>" . _AM_APCAL_TZOPT_USER . "</option>\n";
66 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...
67
    case 's':
68
        $tzoffset  = 0;
69
        $tzdisp    = ($serverTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($serverTZ), abs($serverTZ) * 60 % 60);
70
        $tzoptions = str_replace("'s'>", "'s' selected>", $tzoptions);
71
        break;
72
    case 'g':
73
        $tzoffset  = -$serverTZ * 3600;
74
        $tzdisp    = 'GMT';
75
        $tzoptions = str_replace("'g'>", "'g' selected>", $tzoptions);
76
        break;
77
    default:
78
    case 'y':
79
        $tzoffset  = ($userTZ - $serverTZ) * 3600;
80
        $tzdisp    = ($userTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($userTZ), abs($userTZ) * 60 % 60);
81
        $tzoptions = str_replace("'y'>", "'y' selected>", $tzoptions);
82
        break;
83
}
84
85
// �ǡ����١��������ʤɤ���������
86
if (isset($_POST['http_import']) && !empty($_POST['import_uri'])) {
87
88
    // Ticket Check
89
    if (!$xoopsGTicket->check()) {
90
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
91
    }
92
93
    // http���ͥ�������ͳ�ޤ��ϥ?����ե������iCalendar����ݡ���
94
    list($records, $calname, $tmpname) = explode(':', $cal->import_ics_via_fopen($_POST['import_uri'], false), 3);
95 View Code Duplication
    if ($records <= 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...
96
        $mes = urlencode("$calname : $tmpname");
97
        $cal->redirect("done=error&mes=$mes");
98
        exit;
99
    } else {
100
        $mes = urlencode(sprintf("$records " . _AM_APCAL_FMT_IMPORTED, $calname));
101
        $cal->redirect("done=imported&mes=$mes");
102
        exit;
103
    }
104
} elseif (isset($_POST['local_import']) && isset($_FILES['user_ics']['tmp_name'])
105
          && is_readable($_FILES['user_ics']['tmp_name'])
106
) {
107
108
    // Ticket Check
109
    if (!$xoopsGTicket->check()) {
110
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
111
    }
112
113
    // �ե����륢�åץ?�ɤˤ��iCalendar����ݡ���
114
    list($records, $calname, $tmpname) = explode(':', $cal->import_ics_via_upload('user_ics'), 3);
115 View Code Duplication
    if ($records <= 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...
116
        $mes = urlencode("$calname : " . $_FILES['user_ics']['name']);
117
        $cal->redirect("done=error&mes=$mes");
118
        exit;
119
    } else {
120
        $mes = urlencode(sprintf("$records " . _AM_APCAL_FMT_IMPORTED, $calname));
121
        $cal->redirect("done=imported&mes=$mes");
122
        exit;
123
    }
124 View Code Duplication
} elseif (isset($_POST['delete'])) {
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...
125
126
    // Ticket Check
127
    if (!$xoopsGTicket->check()) {
128
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
129
    }
130
131
    // �쥳���ɤκ��
132
    if (isset($_POST['ids']) && is_array($_POST['ids'])) {
133
        $whr = '';
134
        foreach ($_POST['ids'] as $id) {
135
            $whr .= "id=$id OR rrule_pid=$id OR ";
136
            xoops_comment_delete($xoopsModule->mid(), $id);
137
        }
138
        $sql = "DELETE FROM $cal->table WHERE ($whr 0) AND (rrule_pid=0 OR rrule_pid=id)";
139
        $GLOBALS['xoopsDB']->query($sql);
140
        $records = $GLOBALS['xoopsDB']->getAffectedRows($conn);
141
        $sql     = "DELETE FROM $cal->table WHERE $whr 0 ";
142
        if (!$GLOBALS['xoopsDB']->query($sql)) {
143
            echo $GLOBALS['xoopsDB']->error();
144
        } else {
145
            $mes = urlencode("$records " . _AM_APCAL_MES_DELETED);
146
        }
147
    } else {
148
        $mes = '';
149
    }
150
    $cal->redirect("done=deleted&mes=$mes");
151
    exit;
152
}
153
154
// ����ݡ��Ȥ���ľ��Υ쥳���ɿ���$mes��������
155
if ($done === 'imported' && isset($_GET['mes'])) {
156
    $new_imported = (int)$_GET['mes'];
157
} else {
158
    $new_imported = 0;
159
}
160
161
// クエリ(1時間以内のレコードだけを表示)
162
$older_limit = time() - 3600;
163
$whr         = "UNIX_TIMESTAMP(dtstamp) > $older_limit AND (rrule_pid=0 OR rrule_pid=id)";
164
165
//$rs          = $xoopsDB->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
166
//$numrows     = mysql_result($rs, 0, 0);
167
//$rs          = $xoopsDB->query("SELECT * FROM $cal->table WHERE $whr ORDER BY dtstamp DESC LIMIT $pos,$num");
168
169
$rs        = $GLOBALS['xoopsDB']->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
170
$numrows   = 0;
171
$resultRow = $GLOBALS['xoopsDB']->fetchRow($rs);
172
if (false !== $resultRow && isset($resultRow[0])) {
173
    $numrows = $resultRow[0];
174
}
175
$rs = $GLOBALS['xoopsDB']->query("SELECT * FROM $cal->table WHERE $whr ORDER BY  dtstamp DESC LIMIT $pos,$num");
176
177
// ページ分割処理
178
include XOOPS_ROOT_PATH . '/class/pagenav.php';
179
$nav      = new XoopsPageNav($numrows, $num, $pos, 'pos', "tz=$tz&amp;num=$num");
180
$nav_html = $nav->renderNav(10);
181 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...
182
    $nav_num_info = _NONE;
183
} elseif ($pos + $num > $numrows) {
184
    $nav_num_info = ($pos + 1) . "-$numrows/$numrows";
185
} else {
186
    $nav_num_info = ($pos + 1) . '-' . ($pos + $num) . '/' . $numrows;
187
}
188
189
// �ᥤ�������
190
xoops_cp_header();
191
$adminObject->displayNavigation(basename(__FILE__));
192
193
// 3�Ĥ�ɽ�������Τǥ��ꥢ���Ƥ���
194
$xoopsGTicket->clear();
195
196
echo '
197
<h4>' . _AM_APCAL_ICALENDAR_IMPORT . "</h4>
198
<p><style='color: blue; '>" . (isset($_GET['mes']) ? htmlspecialchars($_GET['mes'], ENT_QUOTES) : '') . "</style></p>
199
<form class='apcalForm' action='?tz=$tz&amp;num=$num' method='post'>
200
  " . _AM_APCAL_LABEL_IMPORTFROMWEB . "<br>
201
  <input type='text' name='import_uri' size='80'>
202
  <input type='submit' name='http_import' value='" . _APCAL_BTN_IMPORT . "'>
203
  " . $xoopsGTicket->getTicketHtml(__LINE__) . "
204
</form>
205
<form class='apcalForm' action='?tz=$tz&amp;num=$num' method='post' enctype='multipart/form-data'>
206
  " . _AM_APCAL_LABEL_UPLOADFROMFILE . "<br>
207
  <input type='hidden' name='MAX_FILE_SIZE' value='65536'>
208
  <input type='file' name='user_ics' size='72'>
209
  <input type='submit' name='local_import' value='" . _APCAL_BTN_UPLOAD . "'>
210
  " . $xoopsGTicket->getTicketHtml(__LINE__) . "
211
</form>
212
<form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:left'>
213
  <select name='tz' onChange='submit();'>$tzoptions</select>
214
  <input type='hidden' name='num' value='$num' />
215
</form>
216
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
217
  <tr>
218
    <td align='left'>
219
      $nav_num_info
220
    </td>
221
    <td>
222
      <form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:right'>
223
        $nav_html &nbsp;
224
        <input type='hidden' name='num' value='$num' />
225
        <input type='hidden' name='tz' value='$tz' />
226
      </form>
227
    </td>
228
  </tr>
229
</table>
230
<form class='apcalForm' id='MainForm' name='MainForm' action='?tz=$tz&amp;num=$num' method='post' style='margin-top:0px;'>
231
" . $xoopsGTicket->getTicketHtml(__LINE__) . "
232
<table width='100%' class='outer' cellpadding='4' cellspacing='1'>
233
  <tr valign='middle'>
234
    <th>" . _AM_APCAL_IO_TH0 . '</th>
235
    <th>' . _AM_APCAL_IO_TH1 . "<br>($tzdisp)</th>
236
    <th>" . _AM_APCAL_IO_TH2 . "<br>($tzdisp)</th>
237
    <th>" . _AM_APCAL_IO_TH3 . '</th>
238
    <th>' . _AM_APCAL_IO_TH4 . '</th>
239
    <th>' . _AM_APCAL_IO_TH5 . "</th>
240
    <th></th>
241
    <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>
242
  </tr>
243
";
244
245
// �ꥹ�Ƚ�����
246
$myts    = MyTextSanitizer::getInstance();
247
$oddeven = 'odd';
248
$count   = 0;
249
while ($event = $GLOBALS['xoopsDB']->fetchObject($rs)) {
250
    $oddeven = ($oddeven === 'odd' ? 'even' : 'odd');
251
    if (++$count < $new_imported) {
252
        $newer_style = "style='background-color:#FFFFCC;'";
253
    } else {
254
        $newer_style = '';
255
    }
256 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...
257
        $start_desc = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->start) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
258
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->end - 300) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
259
    } else {
260
        $start_desc = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->start + $tzoffset);
261
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->end + $tzoffset);
262
    }
263
    $summary4disp = $myts->htmlSpecialChars($event->summary);
264
    echo "
265
  <tr>
266
    <td class='$oddeven' $newer_style>" . $xoopsUser->getUnameFromId($event->uid) . "</td>
267
    <td class='$oddeven' nowrap='nowrap' $newer_style>$start_desc</td>
268
    <td class='$oddeven' nowrap='nowrap' $newer_style>$end_desc</td>
269
    <td class='$oddeven' $newer_style><a href='$mod_url/index.php?action=View&amp;event_id=$event->id'>$summary4disp</a></td>
270
    <td class='$oddeven' $newer_style>" . $cal->rrule_to_human_language($event->rrule) . "</td>
271
    <td class='$oddeven' $newer_style>" . ($event->admission ? _YES : _NO) . "</td>
272
    <td class='$oddeven' align='right' $newer_style><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>
273
    <td class='$oddeven' align='right' $newer_style><input type='checkbox' name='ids[]' value='$event->id' /></td>
274
  </tr>\n";
275
}
276
277
echo "
278
  <tr>
279
    <td colspan='8' align='right' class='head'>"
280
     . _AM_APCAL_LABEL_IO_CHECKEDITEMS
281
     . ' &nbsp; '
282
     . _AM_APCAL_LABEL_IO_DELETE
283
     . "<input type='submit' name='delete' value='"
284
     . _DELETE
285
     . "' onclick='return confirm(\""
286
     . _AM_APCAL_CONFIRM_DELETE
287
     . "\")' /></td>
288
  </tr>
289
  <tr>
290
    <td colspan='8' align='right' valign='bottom' height='50'>"
291
     . _AM_APCAL_COPYRIGHT
292
     . '</td>
293
  </tr>
294
</table>
295
</form>
296
';
297
298
require_once __DIR__ . '/admin_footer.php';
299