Issues (557)

Security Analysis    no request data  

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.

settings.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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 11 and the first side effect is on line 178.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * RE Pro Settings
4
 *
5
 * @package re-pro
6
 */
7
8
/**
9
 * REProSettings.
10
 */
11
class REProSettings {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
12
13
	/**
14
	 * General settings.
15
	 *
16
	 * @var [Array]
17
	 */
18
	private $general_settings;
19
20
	/**
21
	 * Settings constructor.
22
	 */
23
	public function __construct() {
24
		if ( is_admin() ) {
25
			$this->general_settings = get_option( 'repro_settings' );
26
27
			add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
28
			add_action( 'admin_init', array( $this, 'settings_init' ) );
29
		}
30
	}
31
32
	/**
33
	 * Add admin menu.
34
	 */
35
	public function add_admin_menu() {
36
		add_options_page( __( 'Real Estate Pro' ), __( 'Real Estate Pro' ), 'manage_options', 're-pro-settings', array( $this, 'render_settings' ) );
37
	}
38
39
	/**
40
	 * Initialize settings fields and sections.
41
	 */
42
	public function settings_init() {
43
		register_setting( 'repro_settings', 'repro_settings' );
44
45
		// General Settings.
46
		add_settings_section(
47
			'repro_settings',
48
			__( 'General Settings', 're-pro' ),
49
			array( $this, 'general_callback' ),
50
			'repro_general_settings'
51
		);
52
53
		add_settings_field(
54
			'google_maps',
55
			__( 'Google Maps Module', 're-pro' ),
56
			array( $this, 'google_maps' ),
57
			'repro_general_settings',
58
			'repro_settings'
59
		);
60
61
		add_settings_field(
62
			'greatschools_apikey',
63
			__( 'Great Schools API Key', 're-pro' ),
64
			array( $this, 'greatschools_module' ),
65
			'repro_general_settings',
66
			'repro_settings'
67
		);
68
69
		add_settings_field(
70
			'zillow_apikey',
71
			__( 'Zillow API Key', 're-pro' ),
72
			array( $this, 'zillow_module' ),
73
			'repro_general_settings',
74
			'repro_settings'
75
		);
76
77
		add_settings_field(
78
			'sa_apikey',
79
			__( 'Street Advisor API Key', 're-pro' ),
80
			array( $this, 'street_advisor' ),
81
			'repro_general_settings',
82
			'repro_settings'
83
		);
84
85
	}
86
87
	/**
88
	 * Feed section callback.
89
	 */
90
	public function general_callback() {
91
		echo esc_attr( 'Activate the modules you would like to use.', 're-pro' );
92
	}
93
94
	/**
95
	 * Render Christies field.
96
	 */
97
	public function google_maps() {
98
		$gmaps_active = isset( $this->general_settings['gmaps_active'] ) ? $this->general_settings['gmaps_active'] : '0';
99
		$gmaps_key = isset( $this->general_settings['gmaps_key'] ) ? $this->general_settings['gmaps_key'] : '';
100
		$gmaps_style = isset( $this->general_settings['gmaps_style'] ) ? $this->general_settings['gmaps_style'] : '';
101
		$gmaps_zoom = isset( $this->general_settings['gmaps_zoom'] ) ? $this->general_settings['gmaps_zoom'] : '';
102
103
		$checked = checked( '1', $gmaps_active, false );
104
		$is_active = ( '1' === $gmaps_active ) ? 'Deactivate Google maps module?' : 'Activate Google maps module?';
105
		$disable_zoom = checked( '1', $gmaps_zoom, false );
106
107
		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_active]"' . esc_attr( $checked ) . ' value="1"> ';
108
		echo '<div style="display: inline-block;">';
109
		esc_attr_e( $is_active );
110
		echo '</div><br><br>';
111
112
		echo '<input class="widefat" type="password" name="repro_settings[gmaps_key]" placeholder="Google maps API key" value="' . $gmaps_key . '">';
113
		echo '<span class="description"> Enter your google maps javascript api key</span><br><br>';
114
115
		echo '<textarea style="width:500px;" rows="10" cols="50" name="repro_settings[gmaps_style]">';
116
		esc_attr_e( $gmaps_style );
117
		echo '</textarea>';
118
		echo '<br /><span class="description">Insert valid json to add custom style to maps. Json styles can be generated using <a target="_blank" href="https://snazzymaps.com/">Snazzy&nbsp;Maps</a> or the <a target="_blank" href="https://mapstyle.withgoogle.com/">Google&nbsp;Maps&nbsp;Styling&nbsp;Wizard</a></span><br><br>';
119
120
		echo '<input style="vertical-align: top;" type="checkbox" name="repro_settings[gmaps_zoom]"' . esc_attr( $disable_zoom ) . ' value="1"> ';
121
		echo '<div style="display: inline-block;">';
122
		echo 'Disable scroll zoom in Google Maps';
123
		echo '</div>';
124
	}
125
126
127
	public function zillow_module() {
128
129
		$zillow_apikey = isset( $this->general_settings['zillow_apikey'] ) ? $this->general_settings['zillow_apikey'] : '';
130
131
		echo '<input class="widefat" type="text" name="repro_settings[zillow_apikey]" placeholder="Zillow API Key" value="' . $zillow_apikey . '">';
132
133
	}
134
135
	public function street_advisor() {
136
137
		$sa_apikey = isset( $this->general_settings['sa_apikey'] ) ? $this->general_settings['sa_apikey'] : '';
138
139
		echo '<input class="widefat" type="text" name="repro_settings[sa_apikey]" placeholder="Street Advisor API Key" value="' . $sa_apikey . '">';
140
141
	}
142
143
	/**
144
	 * greatschools_module function.
145
	 *
146
	 * @access public
147
	 * @return void
148
	 */
149
	public function greatschools_module() {
150
151
		$greatschools_apikey = isset( $this->general_settings['greatschools_apikey'] ) ? $this->general_settings['greatschools_apikey'] : '';
152
153
		echo '<input class="widefat" type="text" name="repro_settings[greatschools_apikey]" placeholder="Great Schools API Key" value="' . $greatschools_apikey . '">';
154
155
	}
156
157
	/**
158
	 * Render full settings page.
159
	 */
160
	public function render_settings() {
161
		if ( ! current_user_can( 'manage_options' ) ) {
162
			wp_die( esc_attr( "You don't have access to this page", 're-pro' ) );
163
		}
164
165
		echo '<div class="wrap">';
166
		echo '<form method="post" action="options.php">';
167
		echo '<h1>' . esc_attr( 'Real Estate Pro', 're-pro' ) . '</h1>';
168
169
		settings_fields( 'repro_settings' );
170
		do_settings_sections( 'repro_general_settings' );
171
		submit_button();
172
173
		echo '</form>';
174
		echo '</div>';
175
	}
176
}
177
178
new REProSettings();
179