This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 Antiques Promotion (http://www.antiquespromotion.ca) |
||
19 | * @author GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/) |
||
20 | */ |
||
21 | |||
22 | if (!defined('APCAL_BLOCK_MINI_CALENDAR_INCLUDED')) { |
||
23 | define('APCAL_BLOCK_MINI_CALENDAR_INCLUDED', 1); |
||
24 | |||
25 | /** |
||
26 | * @param $options |
||
27 | * @return array |
||
28 | */ |
||
29 | function apcal_mini_calendar_show($options) |
||
30 | { |
||
31 | global $xoopsConfig, $xoopsDB, $xoopsUser; |
||
32 | |||
33 | $moduleDirName = empty($options[0]) ? basename(dirname(__DIR__)) : $options[0]; |
||
34 | |||
35 | // caldate ¤äÆüÉÕ¥¸¥ã¥ó¥×¤Î»ØÄ̵꤬¤¯¡ÊÅö·î¤Î¥Ç¥Õ¥©¥ë¥È¥ß¥Ë¥«¥ì¥ó¥À¡¼É½¼¨¡Ë |
||
36 | // ¤«¤Ä¡¢¥æ¡¼¥¶¤ÎTimezone¤¬defaultTZ¤È°ì½ï¡Ê°ìÈÖ¿¤½¤¦¤Ê¥·¥Á¥å¥¨¡¼¥·¥ç¥ó¡Ë¤Î |
||
37 | // ¾ì¹ç¤Ë¤Ï¡¢¥¥ã¥Ã¥·¥å¤ò»È¤¦ |
||
38 | if (empty($_GET['caldate']) && empty($_POST['apcal_jumpcaldate']) |
||
39 | && (!is_object($xoopsUser) |
||
40 | || $xoopsUser->timezone() == $xoopsConfig['default_TZ']) |
||
41 | ) { |
||
42 | $use_cache = true; |
||
43 | $cachefile = XOOPS_CACHE_PATH . "/{$moduleDirName }_minical_cache_{$xoopsConfig['language']}.html"; |
||
44 | // 5 minutes |
||
45 | if (file_exists($cachefile) && filemtime($cachefile) > time() - 300) { |
||
46 | if (false !== $fp = fopen($cachefile, 'r')) { |
||
47 | $block['content'] = ''; |
||
0 ignored issues
–
show
|
|||
48 | while (!feof($fp)) { |
||
49 | $block['content'] .= fgets($fp, 4096); |
||
50 | } |
||
51 | fclose($fp); |
||
52 | |||
53 | return $block; |
||
54 | } |
||
55 | } |
||
56 | } else { |
||
57 | $use_cache = false; |
||
58 | } |
||
59 | |||
60 | // setting physical & virtual paths |
||
61 | $mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName"; |
||
62 | $mod_url = XOOPS_URL . "/modules/$moduleDirName"; |
||
63 | |||
64 | // defining class of APCal |
||
65 | if (!class_exists('APCal_xoops')) { |
||
66 | require_once "$mod_path/class/APCal.php"; |
||
67 | require_once "$mod_path/class/APCal_xoops.php"; |
||
68 | } |
||
69 | |||
70 | // creating an instance of APCal |
||
71 | $cal = new APCal_xoops('', $xoopsConfig['language'], true); |
||
72 | |||
73 | // ignoring cid from GET |
||
74 | $cal->now_cid = 0; |
||
75 | |||
76 | // setting properties of APCal |
||
77 | $cal->conn = $GLOBALS['xoopsDB']->conn; |
||
78 | include "$mod_path/include/read_configs.php"; |
||
79 | $cal->base_url = $mod_url; |
||
80 | $cal->base_path = $mod_path; |
||
81 | $cal->images_url = "$mod_url/assets/images/$skin_folder"; |
||
0 ignored issues
–
show
The variable
$skin_folder does not exist. Did you forget to declare it?
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug. ![]() |
|||
82 | $cal->images_path = "$mod_path/assets/images/$skin_folder"; |
||
83 | |||
84 | switch ($mini_calendar_target) { |
||
0 ignored issues
–
show
The variable
$mini_calendar_target does not exist. Did you forget to declare it?
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug. ![]() |
|||
85 | case 'MONTHLY': |
||
86 | $get_target = "$mod_url/index.php"; |
||
87 | $query_string = 'smode=Monthly'; |
||
88 | break; |
||
89 | case 'WEEKLY': |
||
90 | $get_target = "$mod_url/index.php"; |
||
91 | $query_string = 'smode=Weekly'; |
||
92 | break; |
||
93 | case 'DAILY': |
||
94 | $get_target = "$mod_url/index.php"; |
||
95 | $query_string = 'smode=Daily'; |
||
96 | break; |
||
97 | case 'LIST': |
||
98 | $get_target = "$mod_url/index.php"; |
||
99 | $query_string = 'smode=List'; |
||
100 | break; |
||
101 | default: |
||
102 | case 'PHP_SELF': |
||
0 ignored issues
–
show
case 'PHP_SELF': $ge...string = ''; break; does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() |
|||
103 | $get_target = ''; |
||
104 | $query_string = ''; |
||
105 | break; |
||
106 | } |
||
107 | |||
108 | $block = array(); |
||
109 | $block['content'] = $cal->get_mini_calendar_html($get_target, $query_string); |
||
110 | |||
111 | // ¥¥ã¥Ã¥·¥å¤Î½ñ¤½Ð¤· |
||
112 | if ($use_cache && $mini_calendar_target !== 'PHP_SELF') { |
||
113 | if (false !== $fp = fopen($cachefile, 'w')) { |
||
0 ignored issues
–
show
The variable
$cachefile does not seem to be defined for all execution paths leading up to this point.
If you define a variable conditionally, it can happen that it is not defined for all execution paths. Let’s take a look at an example: function myFunction($a) {
switch ($a) {
case 'foo':
$x = 1;
break;
case 'bar':
$x = 2;
break;
}
// $x is potentially undefined here.
echo $x;
}
In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined. Available Fixes
![]() |
|||
114 | fwrite($fp, $block['content']); |
||
115 | fclose($fp); |
||
116 | } |
||
117 | } |
||
118 | |||
119 | return $block; |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * @param $options |
||
124 | * @return string |
||
125 | */ |
||
126 | function apcal_mini_calendar_edit($options) |
||
0 ignored issues
–
show
|
|||
127 | { |
||
128 | return ''; |
||
129 | } |
||
130 | } |
||
131 |
Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.
Let’s take a look at an example:
As you can see in this example, the array
$myArray
is initialized the first time when the foreach loop is entered. You can also see that the value of thebar
key is only written conditionally; thus, its value might result from a previous iteration.This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.