Issues (150)

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.

formats/calendar/SRFC_HistoricalDate.php (2 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
/**
4
 * SRFC_HistoricalDate.php
5
 *
6
 * This code is lifted from Terry Hurlbut's 'SMW_DV_HxDate.php' class;
7
 * that code was itself adapted from the Fourmilab Calendar Converter
8
 * Javascripts by John Walker, who wrote them in 1999 and released them
9
 * to the public domain.
10
 *
11
 * The internal value, unlike that of the standard SMW Date type, is a
12
 * 64-bit PHP float. The characteristic gives the days since
13
 * the epoch.
14
 *
15
 * Technically, the Julian calendar is valid only beginning January 1, 45 BC,
16
 * when Julius Caesar established it as per a formal Senatus consultum. But
17
 * currently this is the only calendar currently projectible to earlier times;
18
 * therefore Julian dates are valid for any year in the Julian Period.
19
 *
20
 * @author Terry A. Hurlbut
21
 * @author Yaron Koren
22
 */
23
class SRFCHistoricalDate {
24
25
	const GREGORIAN_EPOCH = 1721425.5; // equivalent to 1 AD
26
27
	protected $m_date; // the Julian day
28
29
	function create( $year, $month, $day ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
30
		if ( $year < 1582 ||
31
			( $year == 1582 && ( $month < 10 || ( $month == 10 && $day < 15 ) ) ) ) {
32
			$this->createFromJulian( $year, $month, $day );
33
		} else {
34
			$this->createFromGregorian( $year, $month, $day );
35
		}
36
	}
37
38
	static protected function leap_gregorian( $year ) {
39
		return ( ( $year % 4 ) == 0 ) && ( !( ( ( $year % 100 ) == 0 ) && ( ( $year % 400 ) != 0 ) ) );
40
	}
41
42
	static protected function leap_julian( $year ) {
43
		return ( ( $year % 4 ) == ( ( $year > 0 ) ? 0 : 3 ) );
44
	}
45
46
	static protected function leap_jul_greg( $year ) {
47
		return ( ( $year < 1582 ) ? SRFCHistoricalDate::leap_julian( $year ) : SRFCHistoricalDate::leap_gregorian(
48
			$year
49
		) );
50
	}
51
52
	protected function createFromGregorian( $year, $month, $day ) {
53
		$this->m_date = ( self::GREGORIAN_EPOCH - 1 ) +
54
			( 365 * ( $year - 1 ) ) +
55
			floor( ( $year - 1 ) / 4 ) +
56
			( -floor( ( $year - 1 ) / 100 ) ) +
57
			floor( ( $year - 1 ) / 400 ) +
58
			floor(
59
				( ( ( 367 * $month ) - 362 ) / 12 ) +
60
				( ( $month <= 2 ) ? 0 :
61
					( SRFCHistoricalDate::leap_gregorian( $year ) ? -1 : -2 )
62
				) + $day
63
			);
64
	}
65
66
	protected function createFromJulian( $year, $month, $day ) {
67
68
		/* Adjust negative common era years to the zero-based notation we use.  */
69
		if ( $year < 1 ) {
70
			$year++;
71
		}
72
73
		/* Algorithm as given in Meeus, Astronomical Algorithms, Chapter 7, page 61 */
74
		if ( $month <= 2 ) {
75
			$year--;
76
			$month += 12;
77
		}
78
79
		$this->m_date = ( ( floor( ( 365.25 * ( $year + 4716 ) ) ) +
80
				floor( ( 30.6001 * ( $month + 1 ) ) ) +
81
				$day ) - 1524.5 );
82
	}
83
84
	public function getDayOfWeek() {
85
		return ( floor( $this->m_date + 1.5 ) % 7 );
86
	}
87
88
	static function daysInMonth( $year, $month ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
89
		if ( $month == 4 || $month == 6 || $month == 9 || $month == 11 ) {
90
			return 30;
91
		}
92
		if ( $month == 2 ) {
93
			return ( SRFCHistoricalDate::leap_jul_greg( $year ) ) ? 29 : 28;
94
		}
95
		return 31;
96
	}
97
98
}
99