Issues (18)

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.

src/tab/Rights.php (3 issues)

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
2
/**
3
 * Created by PhpStorm.
4
 * User: onysko
5
 * Date: 10.06.2015
6
 * Time: 16:43
7
 */
8
namespace samsoncms\app\security\tab;
9
10
use samson\cms\Navigation;
11
use samsoncms\form\tab\Generic;
12
use samsonframework\core\RenderInterface;
13
use samsonframework\orm\QueryInterface;
14
use samsonframework\orm\Record;
15
16
/**
17
 * SamsonCMS application form tab for group security rights selection
18
 * @package samsoncms\app\security\tab
19
 */
20
class Rights extends Generic
21
{
22
    /** @var string Tab name or identifier */
23
    protected $name = 'Доступные права';
24
25
    /** @var \samsoncms\app\security\Controller */
26
    protected $renderer;
27
28
    /**
29
     * Render checkboxes selection list
30
     * @param array $availableValues Collection of available entities for selection
31
     * @param array $selectedValueIDs Collection of selected entity identifiers
32
     * @param string $controller Select/Un-select controller action route
33
     * @param string $showField Entity field name for showing
34
     * @return string HTML rendered checkboxes list
35
     */
36
    public function renderList(array $availableValues, array $selectedValueIDs, $controller, $showField = 'Description')
37
    {
38
        // Iterate all available values
39
        $html = '';
40
        foreach ($availableValues as $availableValue) {
41
            // Define if this value is selected
42
            $checked = in_array($availableValue->id, $selectedValueIDs) ? 'checked' : '';
43
44
            // Translate all fields
45
            $finishTranslateParts = $this->translateCustomFields($availableValue->$showField);
46
47
            $html .= '<div class="input-container select-checkboxes-list-item">';
48
            // Render checkbox with label
49
            $html .= '<label><input type="checkbox" ' . $checked . ' href="' . url_build($controller, $availableValue->id) . '" value="' . $availableValue->id . '">' . $finishTranslateParts . '</label>';
50
            $html .= '</div>';
51
        }
52
53
        return $html;
54
    }
55
56
    /**
57
     * Function which translated custom fields for application "Rights"
58
     * @param array $inputData
59
     * @return string
60
     */
61
    public function translateCustomFields($inputData)
62
    {
63
        // Search all part this text block
64
        $allTranslateParts = explode("\"", $inputData);
65
        // Remove empty elements
66
        $allTranslateParts = array_filter($allTranslateParts);
67
68
        // First value empty
69
        $finishTranslateParts = '';
70
        // Counter elements in this array
71
        $count = 0;
72
        foreach ($allTranslateParts as $oneTranslateParts) {
73
            // First part (not have quotes)
74
            if ($count == 0) {
75
                $finishTranslateParts .= t($oneTranslateParts, true);
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

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

Loading history...
76
                // Last part with quotes
77
            } else {
78
                $finishTranslateParts .= ' "' . t($oneTranslateParts, true) . '"';
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

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

Loading history...
79
            }
80
            // Increment count
81
            $count++;
82
        }
83
84
        return $finishTranslateParts;
85
    }
86
87
    /** @inheritdoc */
88
    public function content()
89
    {
90
        // Translate header
91
        $this->name = t($this->name, true);
0 ignored issues
show
Deprecated Code introduced by
The function t() has been deprecated with message: Should be used as $this->system->getContainer()->geti18n()->translate()|plural()

This function has been deprecated. The supplier of the file has supplied an explanatory message.

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

Loading history...
92
93
        // Access to the application
94
95
        // Render tab content
96
        $content = $this->renderer
97
            ->view('form/tab_item')
98
            ->set($this->renderList(
99
                $this->query->className('right')->exec(),
100
                $this->query->className('groupright')->cond('GroupID', $this->entity->id)->fields('RightID'),
101
                $this->renderer->id() . '/change/' . $this->entity->id
102
            ), 'chbView')
103
            ->output();
104
105
        return $this->renderer
106
            ->view($this->contentView)
107
            ->set($content, 'content')
108
            ->output();
109
    }
110
}
111