Issues (1940)

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.

programs/utilit/agent_export.class.php (32 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
 * OVIDENTIA http://www.ovidentia.org                                   *
4
 ************************************************************************
5
 * Copyright (c) 2003 by CANTICO ( http://www.cantico.fr )              *
6
 *                                                                      *
7
 * This file is part of Ovidentia.                                      *
8
 *                                                                      *
9
 * Ovidentia is free software; you can redistribute it and/or modify    *
10
 * it under the terms of the GNU General Public License as published by *
11
 * the Free Software Foundation; either version 2, or (at your option)  *
12
 * any later version.													*
13
 *																		*
14
 * This program is distributed in the hope that it will be useful, but  *
15
 * WITHOUT ANY WARRANTY; without even the implied warranty of			*
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.					*
17
 * See the  GNU General Public License for more details.				*
18
 *																		*
19
 * You should have received a copy of the GNU General Public License	*
20
 * along with this program; if not, write to the Free Software			*
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,*
22
 * USA.																	*
23
************************************************************************/
24
25
26
require_once dirname(__FILE__).'/xls.class.php';
27
28
29
30
31
32
33
class absences_AgentXls extends absences_Xls
34
{
35
	/**
36
	 * 
37
	 * @var absences_Agent
38
	 */
39
	protected $agent;
40
	
41
	public function __construct(absences_Agent $agent)
42
	{
43
		parent::__construct($agent->getName());
44
		$this->agent = $agent;
45
		
46
		$this->addRightsWorksheet();
47
		$this->addRequestsWorksheet();
48
		
49
		$this->workbook->close();
50
	}
51
	
52
	
53
	/**
54
	 * 
55
	 */
56
	protected function addRightsWorksheet()
57
	{
58
		$ee = bab_functionality::get('ExcelExport');
59
		/* @var $ee Func_ExcelExport */
60
		
61
		$worksheet = $this->workbook->addWorksheet(absences_translate('Vacation rights'));
0 ignored issues
show
Deprecated Code introduced by
The method Workbook::addworksheet() has been deprecated with message: Use add_worksheet instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
62
		
63
		$col = 0;
64
		$worksheet->setColumn($col, $col++, 30);	// description
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
65
		$worksheet->setColumn($col, $col++, 25);	// type
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
66
		$worksheet->setColumn($col, $col++, 15);	// quantity
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
67
		$worksheet->setColumn($col, $col++, 15);	// consumed
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
		$worksheet->setColumn($col, $col++, 15);	// waiting
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
69
		$worksheet->setColumn($col, $col++, 15);	// balance
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
70
		$worksheet->setColumn($col, $col++, 15);	// begin
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
71
		$worksheet->setColumn($col, $col++, 15);	// end
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
		$worksheet->setColumn($col, $col++, 10);	// Accessible
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
73
		
74
		$header = $this->header;
0 ignored issues
show
The property header does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
75
		
76
		
77
		$row =0;
78
		$col =0;
79
		$worksheet->write($row, $col++, $this->agent->getName());
80
		$row++;
81
		
82
		$col =0;
83
		$worksheet->write($row, $col++, absences_translate('Description')		, $header);
84
		$worksheet->write($row, $col++, absences_translate('Type')				, $header);	
85
		$worksheet->write($row, $col++, absences_translate('Initial quantity')	, $header);
86
		$worksheet->write($row, $col++, absences_translate('Consumed')			, $header);
87
		$worksheet->write($row, $col++, absences_translate('Waiting approval')	, $header);
88
		$worksheet->write($row, $col++, absences_translate('Balance')			, $header);
89
		$worksheet->write($row, $col++, absences_translate('Begin date')		, $header);
90
		$worksheet->write($row, $col++, absences_translate('End date')			, $header);
91
		$worksheet->write($row, $col++, absences_translate('Accessible')        , $header);
92
		
93
		$row++;
94
		foreach($this->agent->getAgentRightManagerIterator() as $agentRight) {
95
			$col =0;
96
			
97
			/*@var $agentRight absences_AgentRight */
98
		
99
			$right = $agentRight->getRight();
100
			
101
			$accessible = $agentRight->isAccessibleByValidityPeriod()
102
			&& $agentRight->isAccessibleOnPeriod(time(), time())
103
			&& $agentRight->isAcessibleByDirectoryEntry()
104
			&& $right->isAccessibleIfFixed();
105
106
			$worksheet->writeString($row, $col++, $right->description);
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
107
			$worksheet->writeString($row, $col++, $right->getType()->name);
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
108
			$worksheet->writeNumber($row, $col++, $agentRight->getQuantity(), $this->quantity);
0 ignored issues
show
The property quantity does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
The method writeNumber() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
109
			$worksheet->writeNumber($row, $col++, $agentRight->getConfirmedQuantity(), $this->quantity);
0 ignored issues
show
The method writeNumber() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
110
			$worksheet->writeNumber($row, $col++, $agentRight->getWaitingQuantity(), $this->quantity);
0 ignored issues
show
The method writeNumber() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
111
			$worksheet->writeNumber($row, $col++, $agentRight->getBalance(), $this->quantity);
0 ignored issues
show
The method writeNumber() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
112
			$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($right->date_begin)), $this->date);
0 ignored issues
show
The property date does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
113
			$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($right->date_end)), $this->date);
114
            $worksheet->write($row, $col++, $accessible ? '1':'0');
115
116
			$row++;
117
		}
118
		
119
		
120
	}
121
	
122
	protected function addRequestsWorksheet()
123
	{
124
		$ee = bab_functionality::get('ExcelExport');
125
		/*@var $ee Func_ExcelExport */
126
		
127
		$worksheet = $this->workbook->addWorksheet(absences_translate('User requests'));
0 ignored issues
show
Deprecated Code introduced by
The method Workbook::addworksheet() has been deprecated with message: Use add_worksheet instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
128
		
129
		$row =0;
130
		$col =0;
131
		$worksheet->write($row, $col++, $this->agent->getName());
132
		$row++;
133
		
134
		$col = 0;
135
		$worksheet->setColumn($col, $col++, 20);	// createdOn
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
136
		$worksheet->setColumn($col, $col++, 40);	// type
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
		$worksheet->setColumn($col, $col++, 20);	// begin
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
138
		$worksheet->setColumn($col, $col++, 20);	// end
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
139
		$worksheet->setColumn($col, $col++, 50);	// status
0 ignored issues
show
The method setColumn() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
140
		
141
		
142
		$header = $this->header;
143
		
144
		
145
		$col =0;
146
		$worksheet->write($row, $col++, absences_translate('Created on')		, $header);
147
		$worksheet->write($row, $col++, absences_translate('Type')				, $header);
148
		$worksheet->write($row, $col++, absences_translate('Start date')		, $header);
149
		$worksheet->write($row, $col++, absences_translate('End date')			, $header);
150
		$worksheet->write($row, $col++, absences_translate('Status')			, $header);
151
		
152
		$row++;
153
		foreach($this->agent->getRequestIterator() as $request) {
154
			$col =0;
155
		
156
			/*@var $request absences_Request */
157
		
158
			$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->createdOn())), $this->datetime);
0 ignored issues
show
The property datetime does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
159
			$worksheet->writeString($row, $col++, $request->getRequestType());
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
160
			
161
			if ($request instanceof absences_CetDepositRequest)
162
			{
163
				$worksheet->writeString($row, $col++, '');
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
164
				$worksheet->writeString($row, $col++, '');
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
165
				
166
			} else {
167
				$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->date_begin)), $this->datetime);
0 ignored issues
show
The property date_begin does not exist on object<absences_Request>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
168
				$worksheet->write($row, $col++, $ee->getExcelDate(bab_mktime($request->date_end)), $this->datetime);
0 ignored issues
show
The property date_end does not exist on object<absences_Request>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
169
			}
170
			
171
			
172
			$worksheet->writeString($row, $col++, $request->getStatusStr());
0 ignored issues
show
The method writeString() does not seem to exist on object<Worksheet>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
173
174
			$row++;
175
		}
176
		
177
	}
178
}
179