Issues (36)

Security Analysis    no request data  

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.

src/shims.php (18 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
 * If ext/calendar is not installed, then provide the necessary shims.
4
 *
5
 * @author    Greg Roach <[email protected]>
6
 * @copyright (c) 2014-2020 Greg Roach
7
 * @license   This program is free software: you can redistribute it and/or modify
8
 *            it under the terms of the GNU General Public License as published by
9
 *            the Free Software Foundation, either version 3 of the License, or
10
 *            (at your option) any later version.
11
 *
12
 *            This program is distributed in the hope that it will be useful,
13
 *            but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *            GNU General Public License for more details.
16
 *
17
 *            You should have received a copy of the GNU General Public License
18
 *            along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
use Fisharebest\ExtCalendar\Shim;
22
23
if (!defined('CAL_GREGORIAN')) {
24
    Shim::create();
25
26
    define('CAL_GREGORIAN', 0);
27
    define('CAL_JULIAN', 1);
28
    define('CAL_JEWISH', 2);
29
    define('CAL_FRENCH', 3);
30
    define('CAL_NUM_CALS', 4);
31
    define('CAL_DOW_DAYNO', 0);
32
    define('CAL_DOW_SHORT', Shim::shouldEmulateBug67960() ? 1 : 2);
33
    define('CAL_DOW_LONG', Shim::shouldEmulateBug67960() ? 2 : 1);
34
    define('CAL_MONTH_GREGORIAN_SHORT', 0);
35
    define('CAL_MONTH_GREGORIAN_LONG', 1);
36
    define('CAL_MONTH_JULIAN_SHORT', 2);
37
    define('CAL_MONTH_JULIAN_LONG', 3);
38
    define('CAL_MONTH_JEWISH', 4);
39
    define('CAL_MONTH_FRENCH', 5);
40
    define('CAL_EASTER_DEFAULT', 0);
41
    define('CAL_EASTER_ROMAN', 1);
42
    define('CAL_EASTER_ALWAYS_GREGORIAN', 2);
43
    define('CAL_EASTER_ALWAYS_JULIAN', 3);
44
    define('CAL_JEWISH_ADD_ALAFIM_GERESH', 2);
45
    define('CAL_JEWISH_ADD_ALAFIM', 4);
46
    define('CAL_JEWISH_ADD_GERESHAYIM', 8);
47
48
    /**
49
     * @param int $calendar_id
50
     * @param int $month
51
     * @param int $year
52
     *
53
     * @return int|bool
54
     */
55
56
    function cal_days_in_month($calendar_id, $month, $year)
0 ignored issues
show
function cal_days_in_month() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
57
    {
58
        return Shim::calDaysInMonth($calendar_id, $month, $year);
59
    }
60
61
    /**
62
     * @param int $julian_day
63
     * @param int $calendar_id
64
     *
65
     * @return array|bool
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array|boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
66
     */
67
    function cal_from_jd($julian_day, $calendar_id)
0 ignored issues
show
function cal_from_jd() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
68
    {
69
        return Shim::calFromJd($julian_day, $calendar_id);
70
    }
71
72
    /**
73
     * @param int $calendar_id
74
     *
75
     * @return array|bool
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,string[]|in...olean>|boolean>|boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
76
     */
77
    function cal_info($calendar_id = -1)
0 ignored issues
show
function cal_info() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
78
    {
79
        return Shim::calInfo($calendar_id);
80
    }
81
82
    /**
83
     * @param int $calendar_id
84
     * @param int $month
85
     * @param int $day
86
     * @param int $year
87
     *
88
     * @return int|bool
89
     */
90
    function cal_to_jd($calendar_id, $month, $day, $year)
0 ignored issues
show
function cal_to_jd() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
91
    {
92
        return Shim::calToJd($calendar_id, $month, $day, $year);
93
    }
94
95
    /**
96
     * @param int|null $year
97
     *
98
     * @return int|bool
0 ignored issues
show
Should the return type not be boolean|integer|double?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
99
     */
100
    function easter_date($year = null)
0 ignored issues
show
function easter_date() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
101
    {
102
        return Shim::easterDate($year ? $year : (int)date('Y'));
103
    }
104
105
    /**
106
     * @param int|null $year
107
     * @param int      $method
108
     *
109
     * @return int
110
     */
111
    function easter_days($year = null, $method = CAL_EASTER_DEFAULT)
0 ignored issues
show
function easter_days() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
112
    {
113
        return Shim::easterDays($year ? $year : (int)date('Y'), $method);
114
    }
115
116
    /**
117
     * @param int $month
118
     * @param int $day
119
     * @param int $year
120
     *
121
     * @return int
122
     */
123
    function FrenchToJD($month, $day, $year)
0 ignored issues
show
function FrenchToJD() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
124
    {
125
        return Shim::frenchToJd($month, $day, $year);
126
    }
127
128
    /**
129
     * @param int $month
130
     * @param int $day
131
     * @param int $year
132
     *
133
     * @return int
134
     */
135
    function GregorianToJD($month, $day, $year)
0 ignored issues
show
function GregorianToJD() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
136
    {
137
        return Shim::gregorianToJd($month, $day, $year);
138
    }
139
140
    /**
141
     * @param int $julian_day
142
     * @param int $mode
143
     *
144
     * @return int|string
145
     */
146
    function JDDayOfWeek($julian_day, $mode = CAL_DOW_DAYNO)
0 ignored issues
show
function JDDayOfWeek() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
147
    {
148
        return Shim::jdDayOfWeek($julian_day, $mode);
149
    }
150
151
    /**
152
     * @param int $julian_day
153
     * @param int $mode
154
     *
155
     * @return string
156
     */
157
    function JDMonthName($julian_day, $mode)
0 ignored issues
show
function JDMonthName() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
158
    {
159
        return Shim::jdMonthName($julian_day, $mode);
160
    }
161
162
    /**
163
     * @param int $julian_day
164
     *
165
     * @return string
166
     */
167
    function JDToFrench($julian_day)
0 ignored issues
show
function JDToFrench() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
168
    {
169
        return Shim::jdToFrench($julian_day);
170
    }
171
172
    /**
173
     * @param int $julian_day
174
     *
175
     * @return string
176
     */
177
    function JDToGregorian($julian_day)
0 ignored issues
show
function JDToGregorian() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
178
    {
179
        return Shim::jdToGregorian($julian_day);
180
    }
181
182
    /**
183
     * @param int $julian_day
184
     * @param bool $hebrew
185
     * @param int $flags
186
     *
187
     * @return string|bool
188
     */
189
    function jdtojewish($julian_day, $hebrew = false, $flags = 0)
190
    {
191
        return Shim::jdToJewish($julian_day, $hebrew, $flags);
192
    }
193
194
    /**
195
     * @param int $julian_day
196
     *
197
     * @return string
198
     */
199
    function JDToJulian($julian_day)
0 ignored issues
show
function JDToJulian() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
200
    {
201
        return Shim::jdToJulian($julian_day);
202
    }
203
204
    /**
205
     * @param int $julian_day
206
     *
207
     * @return int|false
208
     */
209
    function jdtounix($julian_day)
210
    {
211
        return Shim::jdToUnix($julian_day);
212
    }
213
214
    /**
215
     * @param int $month
216
     * @param int $day
217
     * @param int $year
218
     *
219
     * @return int
220
     */
221
    function JewishToJD($month, $day, $year)
0 ignored issues
show
function JewishToJD() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
222
    {
223
        return Shim::jewishToJd($month, $day, $year);
224
    }
225
226
    /**
227
     * @param int $month
228
     * @param int $day
229
     * @param int $year
230
     *
231
     * @return int
232
     */
233
    function JulianToJD($month, $day, $year)
0 ignored issues
show
function JulianToJD() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
234
    {
235
        return Shim::julianToJd($month, $day, $year);
236
    }
237
238
    /**
239
     * @param int|null $timestamp
240
     *
241
     * @return false|int
242
     */
243
    function unixtojd($timestamp = null)
244
    {
245
        return Shim::unixToJd($timestamp ? $timestamp : time());
246
    }
247
}
248