Issues (81)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

controller/field_controller.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 *
4
 * @package sitemaker
5
 * @copyright (c) 2017 Daniel A. (blitze)
6
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
7
 *
8
 */
9
10
namespace blitze\content\controller;
11
12
use Symfony\Component\HttpFoundation\JsonResponse;
13
14
class field_controller
15
{
16
	/** @var \phpbb\event\dispatcher_interface */
17
	protected $phpbb_dispatcher;
18
19
	/** @var \phpbb\request\request_interface */
20
	protected $request;
21
22
	/** @var \phpbb\template\template */
23
	protected $template;
24
25
	/** @var \blitze\sitemaker\services\auto_lang */
0 ignored issues
show
The type blitze\sitemaker\services\auto_lang was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
	protected $auto_lang;
27
28
	/** @var \blitze\content\services\form\fields_factory */
29
	protected $fields_factory;
30
31
	/** @var string */
32
	protected $phpbb_admin_path;
33
34
	/**
35
	 * Constructor
36
	 *
37
	 * @param \phpbb\event\dispatcher_interface				$phpbb_dispatcher	Event dispatcher object
38
	 * @param \phpbb\request\request_interface				$request			Request object
39
	 * @param \phpbb\template\template						$template			Template object
40
	 * @param \blitze\sitemaker\services\auto_lang			$auto_lang			Auto add lang file
41
	 * @param \blitze\content\services\form\fields_factory	$fields_factory		Fields factory  object
42
	 */
43
	public function __construct(\phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\request\request_interface $request, \phpbb\template\template $template, \blitze\sitemaker\services\auto_lang $auto_lang, \blitze\content\services\form\fields_factory $fields_factory)
44
	{
45
		$this->phpbb_dispatcher = $phpbb_dispatcher;
46
		$this->request = $request;
47
		$this->template = $template;
48
		$this->auto_lang = $auto_lang;
49
		$this->fields_factory = $fields_factory;
50
	}
51
52
	/**
53
	 * @return \Symfony\Component\HttpFoundation\Response
54
	 */
55
	public function handle()
56
	{
57
		if ($this->request->is_ajax() === false)
58
		{
59
			redirect(generate_board_url());
60
		}
61
62
		$this->auto_lang->add('form_fields');
63
64
		$this->template->set_custom_style(array(
65
			array(
66
				'name' 		=> 'adm',
67
				'ext_path' 	=> 'adm/style/',
68
			)),
69
			array('ext/blitze/content/adm/style')
70
		);
71
72
		$this->template->assign_vars(array(
73
			'CONTENT_FIELDS' => array(array_change_key_case($this->get_field_data(), CASE_UPPER)),
74
		));
75
76
		$this->template->set_filenames(array(
77
			'field'	=> 'content_fields.html'
78
		));
79
80
		return new JsonResponse($this->template->assign_display('field'));
81
	}
82
83
	/**
84
	 * @return array
85
	 */
86
	protected function get_field_data()
87
	{
88
		$field_type = $this->request->variable('type', '');
89
		$fields_data = $this->request->variable('field_data', array('' => array('' => '')), true);
90
		$field_props = $this->request->variable('field_props', array('' => array('' => '')), true);
91
92
		$field_data = (array) array_pop($fields_data);
93
94
		// set defaults if adding new field
95
		$field_data += array(
96
			'field_detail_ldisp'	=> 1,
97
			'field_summary_ldisp'	=> 1,
98
			'field_detail_show'		=> 'body',
99
			'field_summary_show'	=> 'body',
100
		);
101
102
		/** @var \blitze\content\services\form\field\field_interface $field_instance */
103
		$field_instance = $this->fields_factory->get($field_type);
104
		$default_props = $field_instance->get_default_props();
105
106
		$field_data['field_type'] = $field_type;
107
		$field_data['type_label'] = $field_instance->get_langname();
108
		$field_data['field_props'] = array_replace_recursive($default_props,
109
			array_intersect_key((array) array_pop($field_props), $default_props)
110
		);
111
112
		$this->set_prop('options', $field_data);
113
		$this->set_prop('defaults', $field_data);
114
		$this->force_prop($field_type, $field_data);
115
116
		/**
117
		 * Event to modify field data
118
		 *
119
		 * @event blitze.content.field_controller.modify_data
120
		 * @var	array													field_data		Array containing field data
121
		 * @var	\blitze\content\services\form\field\field_interface		field_instance	Field instance
122
		 */
123
		$vars = array('field_data', 'field_instance');
124
		extract($this->phpbb_dispatcher->trigger_event('blitze.content.field_controller.modify_data', compact($vars)));
125
126
		return $field_data;
127
	}
128
129
	/**
130
	 * @param string $prop	options|defaults
131
	 * @param array $data
132
	 * @return void
133
	 */
134
	protected function set_prop($prop, array &$data)
135
	{
136
		$field_prop = $this->request->variable('field_' . $prop, array('' => array(0 => '')), true);
137
138
		if (null !== ($array = array_pop($field_prop)))
139
		{
140
			$data['field_props'][$prop] = $array;
141
		}
142
	}
143
144
	/**
145
	 * @param string $field_type
146
	 * @param array $data
147
	 * @return void
148
	 */
149
	protected function force_prop($field_type, array &$data)
150
	{
151
		switch ($field_type)
152
		{
153
			case 'checkbox':
154
				$data['field_props']['multi_select'] = true;
155
			break;
156
			case 'radio':
157
				$data['field_props']['multi_select'] = false;
158
			break;
159
		}
160
	}
161
}
162