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/csv.class.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
 * 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
class absences_Csv
27
{
28
    
29
    /**
30
     * @var string
31
     */
32
    protected $separator;
33
    
34
    /**
35
     * @var string
36
     */
37
    protected $sepdec;
38
39
40
    protected function csvEncode($str)
41
    {
42
        $str = str_replace("\n"," ",$str);
43
        return '"'.str_replace('"','""',$str).'"';
44
    }
45
    
46
    
47
    /**
48
     * output an array on raw values
49
     * @param array $arr
50
     *
51
     */
52
    protected function outputArr(Array $arr)
53
    {
54
        $arr = $this->encodeFloats($arr);
55
    
56
        foreach ($arr as &$v) {
57
            $v = $this->csvEncode($v);
58
        }
59
        echo implode($this->separator, $arr)."\n";
60
    }
61
    
62
    
63
    /**
64
     *
65
     * @return boolean
66
     */
67
    protected function isRowEmpty(Array $currentRow)
68
    {
69
        foreach($currentRow as &$val)
70
        {
71
            if (is_float($val))
72
            {
73
                if ($val > 0) {
74
                    return false;
75
                }
76
            }
77
        }
78
    
79
        return true;
80
    }
81
    
82
    
83
    protected function encodeFloats(Array $currentRow)
84
    {
85
        // encode float
86
        foreach($currentRow as &$val) {
87
            if (is_float($val)) {
88
                $val = number_format($val, 1 , $this->sepdec , '' );
89
            }
90
        }
91
    
92
        return $currentRow;
93
    }
94
    
95
    
96
    /**
97
     * @return string
98
     */
99 View Code Duplication
    protected function getAgentDirValue(absences_Agent $agent, $fieldname)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
100
    {
101
        $direntry = $agent->getDirEntry();
102
    
103
        if (isset($direntry[$fieldname]))
104
        {
105
            return $direntry[$fieldname]['value'];
106
        }
107
    
108
        return '';
109
    }
110
    
111
    
112
113
    /**
114
     *
115
     * @param string $quantity_unit
116
     * @return string
117
     */
118 View Code Duplication
    protected function getUnit($quantity_unit)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
119
    {
120
        switch($quantity_unit)
121
        {
122
            case 'D': return absences_translate('days');
123
            case 'H': return absences_translate('hours');
124
        }
125
         
126
        return '';
127
    }
128
    
129
    
130
    protected function setHeaders($filename)
131
    {
132
        header("Content-Disposition: attachment; filename=\"".$filename.".csv\""."\n");
133
        header("Content-Type: text/csv"."\n");
134
        header("Content-transfert-encoding: binary"."\n");
135
    }
136
    
137
    
138
    
139
    protected function date($strDate) {
140
        return bab_shortDate(bab_mktime($strDate), false);
141
    }
142
}