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/organization.ui.php (11 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
bab_Widgets()->includePhpClass('Widget_Form');
25
26
/**
27
 * Template class for organization list
28
 * 
29
 */
30
class absences_OrganizationList
31
{
32
    public $altbg = true;
33
    
34
    private $res;
35
    
36
    public function __construct()
37
    {
38
        global $babDB;
39
        
40
        $this->t_edit = absences_translate('Edit');
0 ignored issues
show
The property t_edit 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...
41
        $this->t_name = absences_translate('Name');
0 ignored issues
show
The property t_name 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...
42
        $this->t_agents = absences_translate('Personnel members');
0 ignored issues
show
The property t_agents 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...
43
        $sync = (bool) absences_getVacationOption('organization_sync');
44
        $this->allowedit = !$sync;
0 ignored issues
show
The property allowedit 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...
45
        $this->res = $babDB->db_query('SELECT 
46
            
47
            o.id, o.name, COUNT(p.id) agents FROM absences_organization o 
48
                LEFT JOIN absences_personnel p ON p.id_organization=o.id 
49
            
50
            GROUP BY o.id 
51
            ORDER BY o.name');
52
    }
53
    
54
    public function getnext()
55
    {
56
        global $babDB;
57
        
58
        if ($arr = $babDB->db_fetch_assoc($this->res)) {
59
            $this->altbg = !$this->altbg;
60
            $this->name = bab_toHtml($arr['name']);
0 ignored issues
show
The property name 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...
61
            
62
            $url = bab_url::get_request('tg');
63
            $url->idx = 'edit';
64
            $url->id_organization = $arr['id'];
65
            
66
            $this->editurl = bab_toHtml($url->toString());
0 ignored issues
show
The property editurl 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...
67
            
68
            $this->agents = bab_toHtml($arr['agents']);
0 ignored issues
show
The property agents does not seem to exist. Did you mean t_agents?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
69
            
70
            $url = new bab_url(absences_Addon()->getUrl().'vacadm');
71
            $url->idx = 'lper';
72
            $url->filter = array('organization' => $arr['id']);
73
            $this->agentsurl = bab_toHtml($url->toString());
0 ignored issues
show
The property agentsurl 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...
74
            return true;
75
        }
76
        
77
        return false;
78
    }
79
80
}
81
82
83
84
85
/**
86
 * Get a html menu to create an organization
87
 * @return string
88
 */
89
function absences_organizationMenu()
90
{
91
    $toolbar = absences_getToolbar();
92
93
    $addon = bab_getAddonInfosInstance('absences');
94
    $sImgPath = $GLOBALS['babInstallPath'] . 'skins/ovidentia/images/Puces/';
95
96
    $sync = (int) absences_getVacationOption('organization_sync');
97 View Code Duplication
    if (!$sync)
0 ignored issues
show
This code seems to be duplicated across 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...
98
    {
99
    
100
        $toolbar->addToolbarItem(
101
            new BAB_ToolbarItem(
102
                absences_translate('Add organization'), 
103
                $addon->getUrl().'organizations&idx=edit',
104
                $sImgPath . 'edit_add.png', '', '', '')
105
        );
106
    
107
    }
108
109
    return $toolbar->printTemplate();
110
}
111
112
113
114
115
116
class absences_OrganizationEditor extends Widget_Form
117
{
118
119
    /**
120
     * @var absences_Organization
121
     */
122
    protected $organization;
123
    
124
    
125 View Code Duplication
    public function __construct(absences_Organization $organization)
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...
126
    {
127
        $W = bab_Widgets();
128
129
        parent::__construct(null, $W->VBoxLayout()->setVerticalSpacing(2,'em'));
130
131
        $this->organization = $organization;
132
133
        $this->setName('organization');
134
        $this->addClass('widget-bordered');
135
        $this->addClass('BabLoginMenuBackground');
136
        $this->addClass('widget-centered');
137
        $this->addClass(Func_Icons::ICON_LEFT_16);
138
        
139
        $this->colon();
140
141
        $this->setCanvasOptions($this->Options()->width(70,'em'));
0 ignored issues
show
It seems like $this->Options()->width(70, 'em') targeting Widget_CanvasOptions::width() can also be of type double; however, Widget_Item::setCanvasOptions() does only seem to accept object<Widget_CanvasOptions>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
142
143
        $this->addFields();
144
        $this->setValues($organization->getRow(), array('organization'));
145
146
        $this->addButtons();
147
        $this->setSelfPageHiddenFields();
148
    }
149
    
150
    
151
    
152
    protected function addFields()
153
    {
154
        $W = bab_Widgets();
155
156
        $this->addItem($W->LabelledWidget(
157
            absences_translate('Name'),
158
            $W->LineEdit()->setSize(70)->setMaxSize(255),
159
            'name'
160
        ));
161
    }
162
    
163
    
164
165
    protected function addButtons()
166
    {
167
        $W = bab_Widgets();
168
    
169
        $button = $W->FlowItems(
170
            $W->SubmitButton()->setName('save')->setLabel(absences_translate('Save'))
171
        )->setSpacing(2,'em')->setVerticalAlign('middle');
172
        
173
        $url = bab_url::get_request('tg');
174
        $url->idx = 'delete';
175
        $url->id_organization = $this->organization->id;
176
        
177
        $agents = $this->organization->getAgentInterator();
178
        
179
        if ($agents) {
180
        
181
            if ($agents->count()) {
182
                
183
                $button->addItem(
184
                    $W->Link(
185
                        $W->Icon(absences_translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), 
186
                        $url->toString()
187
                    )->setConfirmationMessage(sprintf(absences_translate('This organization is linked to %d users, do you really whant to delete it?'), $agents->count()))
188
                );
189
            } else {
190
                
191
                $button->addItem(
192
                    $W->Link($W->Icon(absences_translate('Delete'), Func_Icons::ACTIONS_EDIT_DELETE), $url->toString())
193
                        ->setConfirmationMessage(absences_translate('Do you really whant to delete this organization?'))
194
                );
195
            }
196
        }
197
        
198
        
199
        $this->addItem($button);
200
    }
201
}
202