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/upgrade/entry_elem.php (1 issue)

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
require_once dirname(__FILE__).'/../utilit/entry.class.php';
26
27
/**
28
 * add dates to entry_elem
29
 */
30
class absences_upgradeEntryElemDates
31
{
32
    private $totalCount = 0;
33
    private $currentUpdate = 1;
34
    
35
    private $progress;
36
    
37
    public function select()
38
    {
39
        global $babDB;
40
        
41
        $res = $babDB->db_query("SELECT ee.id_entry, ee.id, ee.quantity, e.date_begin, e.date_end, e.id_user, r.quantity_unit FROM
42
        	    absences_entries e,
43
        	    absences_entries_elem ee,
44
    	        absences_rights r,
45
    	        absences_types t
46
    	    WHERE
47
    	       ee.id_entry = e.id
48
    	       AND ee.date_begin = '0000-00-00 00:00:00' 
49
    	       AND r.id = ee.id_right
50
    	       AND t.id = r.id_type
51
    	    ORDER BY e.id, r.sortkey, t.name
52
    	");
53
        
54
        $this->totalCount = $babDB->db_num_rows($res);
55
        
56
        if ($this->totalCount > 0) {
57
            $this->progress = new bab_installProgressBar;
58
            $this->progress->setTitle(sprintf(absences_translate('Update existing vacation requests (%d)'), $this->totalCount));
59
        }
60
        
61
        $entry_stack = array();
62
    	while ($entry_elem = $babDB->db_fetch_assoc($res)) {
63
    	    
64
    	    $id_entry = (int) $entry_elem['id_entry'];
65
    	    
66
    	    if ('0000-00-00 00:00:00' === $entry_elem['date_begin'] || '0000-00-00 00:00:00' === $entry_elem['date_end']) {
67
    	        absences_Entry::getById($entry_elem['id_entry'])->delete();
68
    	        continue;
69
    	    }
70
    	    
71
    	    if (!isset($entry_stack[$id_entry])) {
72
    	        
73
    	        if (!empty($entry_stack)) {
74
    	            // process previous stack
75
    	           $this->updateEntry(reset($entry_stack));
76
    	           $entry_stack = array();
77
    	        }
78
    	        
79
    	        $entry_stack[$id_entry] = array();
80
    	    }
81
    	    
82
    	    $entry_stack[$id_entry][] = $entry_elem;
83
    	}
84
    	
85
    	// process last stack entry if exists
86
    	if ($entry_stack) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $entry_stack of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
87
    	   $this->updateEntry(reset($entry_stack));
88
    	}
89
    	
90
    	if (isset($this->progress)) {
91
    	    $this->progress->setProgression(100);
92
    	}
93
    }
94
    
95
    /**
96
     * @param array $arrentry      Elements of one entry
97
     */
98
    protected function updateEntry(Array $arrentry)
99
    {
100
        require_once dirname(__FILE__).'/../utilit/vacincl.php';
101
        require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php';
102
        
103
        if (1 === count($arrentry)) {
104
            // one elem per entry
105
            
106
            return $this->updateOneElem($arrentry);
107
        }
108
109
        $row = reset($arrentry);
110
        $entry = absences_Entry::getById($row['id_entry']);
111
        
112
        $entry->loadElements();
113
        
114
        try {
115
            $entry->setElementsDates();
116
            $entry->saveElements();
117
        } catch (absences_EntryException $e) {
118
            bab_installWindow::message(bab_toHtml($e->getMessage()));
119
        }
120
        
121
        $percent = ($this->currentUpdate * 100) / $this->totalCount;
122
        $this->progress->setProgression(round($percent));
123
        
124
        $this->currentUpdate++;
125
    }
126
    
127
    /**
128
     * Copy entry dates to elem date
129
     */
130
    protected function updateOneElem(Array $arrentry)
131
    {
132
        global $babDB;
133
        
134
        $elem = reset($arrentry);
135
        
136
        $babDB->db_query('
137
            UPDATE absences_entries_elem 
138
            SET 
139
                date_begin='.$babDB->quote($elem['date_begin']).', 
140
                date_end='.$babDB->quote($elem['date_end']).' 
141
            WHERE id='.$babDB->quote($elem['id'])
142
        );
143
    }
144
    
145
    
146
    
147
    public static function onUpgrade()
148
    {
149
        $obj = new absences_upgradeEntryElemDates();
150
        $obj->select();   
151
    }
152
}
153
154