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/admission.php (4 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
43
// MySQL
44
$conn = $GLOBALS['xoopsDB']->conn;
45
46
// setting physical & virtual paths
47
$mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName";
48
$mod_url  = XOOPS_URL . "/modules/$moduleDirName";
49
50
// creating an instance of APCal
51
$cal = new APCal_xoops('', $xoopsConfig['language'], true);
52
53
// setting properties of APCal
54
$cal->conn = $conn;
55
include __DIR__ . '/../include/read_configs.php';
56
$cal->base_url    = $mod_url;
57
$cal->base_path   = $mod_path;
58
$cal->images_url  = "$mod_url/assets/images/$skin_folder";
59
$cal->images_path = "$mod_path/assets/images/$skin_folder";
60
61
$cattree = new XoopsTree($cal->cat_table, 'cid', 'pid');
62
ob_start();
63
$cattree->makeMySelBox('cat_title', 'weight', $cid, 1, 'cid', '');
64
$cat_selbox = ob_get_contents();
65
ob_end_clean();
66
$cat_selbox4extract = str_replace("<option value='0'>", "<option value='0'>" . _ALL . "</option>\n<option value='-1'" . ($cid == -1 ? 'selected' : '') . '>', $cat_selbox);
67
68
// Timezone
69
$serverTZ  = $cal->server_TZ;
70
$userTZ    = $xoopsUser->timezone();
71
$tzoptions = "
72
    <option value='s'>" . _AM_APCAL_TZOPT_SERVER . "</option>
73
    <option value='g'>" . _AM_APCAL_TZOPT_GMT . "</option>
74
    <option value='y'>" . _AM_APCAL_TZOPT_USER . "</option>\n";
75 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...
76
    case 's':
77
        $tzoffset  = 0;
78
        $tzdisp    = ($serverTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($serverTZ), abs($serverTZ) * 60 % 60);
79
        $tzoptions = str_replace("'s'>", "'s' selected>", $tzoptions);
80
        break;
81
    case 'g':
82
        $tzoffset  = -$serverTZ * 3600;
83
        $tzdisp    = 'GMT';
84
        $tzoptions = str_replace("'g'>", "'g' selected>", $tzoptions);
85
        break;
86
    default:
87
    case 'y':
88
        $tzoffset  = ($userTZ - $serverTZ) * 3600;
89
        $tzdisp    = ($userTZ >= 0 ? '+' : '-') . sprintf('%02d:%02d', abs($userTZ), abs($userTZ) * 60 % 60);
90
        $tzoptions = str_replace("'y'>", "'y' selected>", $tzoptions);
91
        break;
92
}
93
94
if (isset($_POST['admit']) && isset($_POST['ids']) && is_array($_POST['ids'])) {
95
96
    // Ticket Check
97
    if (!$xoopsGTicket->check()) {
98
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
99
    }
100
101
    $whr = '';
102
    foreach ($_POST['ids'] as $id) {
103
        $whr .= "id=$id OR rrule_pid=$id OR ";
104
    }
105
    $sql = "UPDATE $cal->table SET admission=1 WHERE $whr 0";
106
    if (!$GLOBALS['xoopsDB']->query($sql)) {
107
        echo $GLOBALS['xoopsDB']->error();
108
    } else {
109
        $mes = urlencode(_AM_APCAL_MES_ADMITTED);
110
    }
111
    foreach ($_POST['ids'] as $id) {
112
        $cal->notify_new_event($id);
113
    }
114
    $cal->redirect("cid=$cid&num=$num&tz=$tz&done=admitted&mes=$mes");
115
    exit;
116 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...
117
118
    // Ticket Check
119
    if (!$xoopsGTicket->check()) {
120
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
121
    }
122
123
    if (isset($_POST['ids']) && is_array($_POST['ids'])) {
124
        $whr = '';
125
        foreach ($_POST['ids'] as $id) {
126
            $whr .= "id=$id OR rrule_pid=$id OR ";
127
            xoops_comment_delete($xoopsModule->mid(), $id);
128
        }
129
        $sql = "DELETE FROM $cal->table WHERE ($whr 0) && (rrule_pid=0 OR rrule_pid=id)";
130
        $GLOBALS['xoopsDB']->query($sql);
131
        $records = $GLOBALS['xoopsDB']->getAffectedRows($conn);
132
        $sql     = "DELETE FROM $cal->table WHERE $whr 0 ";
133
        if (!$GLOBALS['xoopsDB']->query($sql)) {
134
            echo $GLOBALS['xoopsDB']->error();
135
        } else {
136
            $mes = urlencode("$records " . _AM_APCAL_MES_DELETED);
137
        }
138
    } else {
139
        $mes = '';
140
    }
141
    $cal->redirect("cid=$cid&num=$num&tz=$tz&done=deleted&mes=$mes");
142
    exit;
143
}
144
145
$whr = 'admission<1 AND (rrule_pid=0 OR rrule_pid=id) ';
146
147
if ($cid > 0) {
148
    $cid4sql = sprintf('%05d,', $cid);
149
    $whr     .= "AND categories like '%$cid4sql%'";
150
} elseif ($cid == -1) {
151
    $whr .= "AND categories=''";
152
}
153
154
if ($txt !== '') {
155
    $keywords = explode(' ', $cal->mb_convert_kana($txt, 's'));
156
    foreach ($keywords as $keyword) {
157
        $whr .= "AND (CONCAT( summary , description , location , contact ) LIKE '%" . addslashes($keyword) . "%') ";
158
    }
159
}
160
161
// クエリ
162
//$rs     = $xoopsDB->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
163
//$numrows = mysql_result($rs, 0, 0);
164
//$rs     = $xoopsDB->query("SELECT * FROM $cal->table WHERE $whr ORDER BY start,end LIMIT $pos,$num");
165
166
$rs        = $GLOBALS['xoopsDB']->query("SELECT COUNT(id) FROM $cal->table WHERE $whr");
167
$numrows   = 0;
168
$resultRow = $GLOBALS['xoopsDB']->fetchRow($rs);
169
if (false !== $resultRow && isset($resultRow[0])) {
170
    $numrows = $resultRow[0];
171
}
172
$rs = $GLOBALS['xoopsDB']->query("SELECT * FROM $cal->table WHERE $whr ORDER BY start,end LIMIT $pos,$num");
173
174
// ページ分割処理
175
include XOOPS_ROOT_PATH . '/class/pagenav.php';
176
$nav      = new XoopsPageNav($numrows, $num, $pos, 'pos', "cid=$cid&amp;tz=$tz&amp;num=$num&amp;txt=" . urlencode($txt));
177
$nav_html = $nav->renderNav(10);
178 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...
179
    $nav_num_info = _NONE;
180
} elseif ($pos + $num > $numrows) {
181
    $nav_num_info = ($pos + 1) . "-$numrows/$numrows";
182
} else {
183
    $nav_num_info = ($pos + 1) . '-' . ($pos + $num) . '/' . $numrows;
184
}
185
186
// �ᥤ�������
187
xoops_cp_header();
188
$adminObject->displayNavigation(basename(__FILE__));
189
echo '<h4 xmlns="http://www.w3.org/1999/html">' . _AM_APCAL_ADMISSION . "</h4>
190
<p><style='color: blue; '>" . (isset($_GET['mes']) ? htmlspecialchars($_GET['mes'], ENT_QUOTES) : '') . "</style></p>
191
<form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:left'>
192
  <select name='tz' onChange='submit();'>$tzoptions</select>
193
  <input type='hidden' name='cid' value='$cid' />
194
  <input type='hidden' name='num' value='$num' />
195
  <input type='hidden' name='txt' value='" . htmlspecialchars($txt, ENT_QUOTES) . "' />
196
</form>
197
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
198
  <tr>
199
    <td align='left'>
200
      $nav_num_info
201
    </td>
202
    <td align='left'>
203
      <form class='apcalForm' action='' method='get' style='margin-bottom:0px;text-align:right'>
204
        $cat_selbox4extract
205
        <input type='text' name='txt' value='" . htmlspecialchars($txt, ENT_QUOTES) . "' />
206
        <input type='submit' value='" . _AM_APCAL_BUTTON_EXTRACT . "' /> &nbsp;
207
        $nav_html &nbsp;
208
        <input type='hidden' name='num' value='$num' />
209
        <input type='hidden' name='tz' value='$tz' />
210
      </form>
211
    </td>
212
  </tr>
213
</table>
214
<form class='apcalForm' id='MainForm' name='MainForm' action='?tz=$tz&amp;num=$num&amp;cid=$cid' method='post' style='margin-top:0px;'>
215
<table width='100%' class='outer' cellpadding='4' cellspacing='1'>
216
  <tr valign='middle'>
217
    <th>" . _AM_APCAL_ADMIT_TH0 . '</th>
218
    <th>' . _AM_APCAL_ADMIT_TH1 . "<br>($tzdisp)</th>
219
    <th>" . _AM_APCAL_ADMIT_TH2 . "<br>($tzdisp)</th>
220
    <th>" . _AM_APCAL_ADMIT_TH3 . '</th>
221
    <th>' . _AM_APCAL_ADMIT_TH4 . "</th>
222
    <th></th>
223
    <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>
224
  </tr>
225
";
226
227
// �ꥹ�Ƚ�����
228
$myts    = MyTextSanitizer::getInstance();
229
$oddeven = 'odd';
230
while ($event = $GLOBALS['xoopsDB']->fetchObject($rs)) {
231
    $oddeven = ($oddeven === 'odd' ? 'even' : 'odd');
232 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...
233
        $start_desc = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->start) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
234
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_ALLDAY, $event->end - 300) . '<br>(' . _APCAL_MB_ALLDAY_EVENT . ')';
235
    } else {
236
        $start_desc = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->start + $tzoffset);
237
        $end_desc   = date(_AM_APCAL_DTFMT_LIST_NORMAL, $event->end + $tzoffset);
238
    }
239
    $summary4disp = $myts->htmlSpecialChars($event->summary);
240
    echo "
241
  <tr>
242
    <td class='$oddeven'>" . XoopsUser::getUnameFromId($event->uid) . "</td>
243
    <td class='$oddeven' nowrap='nowrap'>$start_desc</td>
244
    <td class='$oddeven' nowrap='nowrap'>$end_desc</td>
245
    <td class='$oddeven'><a href='$mod_url/index.php?action=View&amp;event_id=$event->id'>$summary4disp</a></td>
246
    <td class='$oddeven'>" . $cal->rrule_to_human_language($event->rrule) . "</td>
247
    <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>
248
    <td class='$oddeven' align='right'><input type='checkbox' name='ids[]' value='$event->id' /></td>
249
  </tr>\n";
250
}
251
252
echo "
253
  <tr>
254
    <td colspan='8' align='right' class='head'>"
255
     . _AM_APCAL_LABEL_ADMIT
256
     . "<input type='submit' name='admit' value='"
257
     . _AM_APCAL_BUTTON_ADMIT
258
     . "' /> &nbsp; "
259
     . _AM_APCAL_LABEL_IO_DELETE
260
     . "<input type='submit' name='delete' value='"
261
     . _DELETE
262
     . "' onclick='return confirm(\""
263
     . _AM_APCAL_CONFIRM_DELETE
264
     . "\")' /></td>
265
  </tr>
266
  <tr>
267
    <td colspan='8' align='right' valign='bottom' height='50'>"
268
     . _AM_APCAL_COPYRIGHT
269
     . '</td>
270
  </tr>
271
</table>
272
'
273
     . $xoopsGTicket->getTicketHtml(__LINE__)
274
     . '
275
</form>
276
';
277
278
require_once __DIR__ . '/admin_footer.php';
279