Issues (279)

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.

classes/Kohana/Jam/Timezone.php (3 issues)

Labels
Severity

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 defined('SYSPATH') OR die('No direct script access.');
2
/**
3
 * Core class that all fields must extend
4
 *
5
 * @package    Jam
6
 * @category   Fields
7
 * @author     Ivan Kerin
8
 * @copyright  (c) 2011-2012 Despark Ltd.
9
 * @license    http://www.opensource.org/licenses/isc-license.txt
10
 */
11
abstract class Kohana_Jam_Timezone {
12
13
	const DEFAULT_TIMEZONE = 'default_timezone';
14
	const MASTER_TIMEZONE = 'master_timezone';
15
	const USER_TIMEZONE = 'user_timezone';
16
17
	protected static $_instance;
18
19 6
	public static function instance()
20
	{
21 6
		if ( ! Jam_Timezone::$_instance)
0 ignored issues
show
The property _instance cannot be accessed from this context as it is declared protected in class Kohana_Jam_Timezone.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
22
		{
23
			Jam_Timezone::$_instance = new Jam_Timezone();
0 ignored issues
show
The property _instance cannot be accessed from this context as it is declared protected in class Kohana_Jam_Timezone.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
24
		}
25 6
		return Jam_Timezone::$_instance;
0 ignored issues
show
The property _instance cannot be accessed from this context as it is declared protected in class Kohana_Jam_Timezone.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
26
	}
27
28 5
	public static function shift($value, DateTimeZone $timezone_from, DateTimeZone $timezone_to)
29
	{
30 5
		$time = new DateTime();
31 5
		$time->setTimestamp($value);
32
33 5
		return $value + $timezone_to->getOffset($time) - $timezone_from->getOffset($time);
34
	}
35
36
	protected $_user_timezone = NULL;
37
	protected $_master_timezone = NULL;
38
	protected $_default_timezone = NULL;
39
40 3
	public function master_timezone($timezone = NULL)
41
	{
42 3
		if ($timezone !== NULL)
43
		{
44
			$this->_master_timezone = new DateTimeZone($timezone);
45
			return $this;
46
		}
47
48 3
		if ( ! $this->_master_timezone)
49
		{
50 3
			$this->_master_timezone = new DateTimeZone('UTC');
51
		}
52
53 3
		return $this->_master_timezone;
54
	}
55
56 7
	public function default_timezone($timezone = NULL)
57
	{
58 7
		if ($timezone !== NULL)
59
		{
60 7
			$this->_default_timezone = new DateTimeZone($timezone);
61 7
			return $this;
62
		}
63
64 2
		if ( ! $this->_default_timezone)
65
		{
66 1
			$this->_default_timezone = new DateTimeZone(date_default_timezone_get());
67
		}
68
69 2
		return $this->_default_timezone;
70
	}
71
72 7
	public function user_timezone($timezone = NULL)
73
	{
74 7
		if ($timezone !== NULL)
75
		{
76 7
			$this->_user_timezone = new DateTimeZone($timezone);
77 7
			return $this;
78
		}
79
80 1
		return $this->_user_timezone;
81
	}
82
83 8
	public function is_active()
84
	{
85 8
		return $this->_user_timezone !== NULL;
86
	}
87
88 1
	public function date($format, $time = NULL)
89
	{
90 1
		if ( ! $this->is_active())
91 1
			return ($time !== NULL) ? date($format, $time) : date($format);
92
93 1
		$time = ($time !== NULL) ? $time : time();
94 1
		$time = Jam_Timezone::shift($time, $this->default_timezone(), $this->master_timezone());
95
96 1
		return date($format, $time);
97
	}
98
99 3
	public function time()
100
	{
101 3
		if ( ! $this->is_active())
102 3
			return time();
103
104
		return Jam_Timezone::shift(time(), $this->default_timezone(), $this->master_timezone());
105
	}
106
107
	public function strtotime($time_string)
108
	{
109
		if ( ! $this->is_active())
110
			return strtotime($time_string);
111
112
		return Jam_Timezone::shift(strtotime($time_string), $this->default_timezone(), $this->master_timezone());
113
	}
114
115 6
	public function convert($value, $from, $to)
116
	{
117 6
		if ( ! $this->is_active())
118 5
			return $value;
119
120 1
		return Jam_Timezone::shift($value, $this->$from(), $this->$to());
121
	}
122
123
	public function to_db($value, $from = 'user_timezone')
124
	{
125
		if ( ! $this->is_active())
126
			return $value;
127
128
		if ( ! is_numeric($value))
129
		{
130
			$value = strtotime($value);
131
		}
132
133
		$value = $this->convert($value, $from, Jam_Timezone::MASTER_TIMEZONE);
134
		return date('Y-m-d H:i:s', $value);
135
	}
136
137
} // End Kohana_Jam_Field
138