Passed
Push — developer ( 918c9d...b46760 )
by Radosław
15:04
created
modules/OpenStreetMap/files/TileLayer.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -12,88 +12,88 @@
 block discarded – undo
12 12
  */
13 13
 class OpenStreetMap_TileLayer_File extends Vtiger_Basic_File
14 14
 {
15
-    /** {@inheritdoc} */
16
-    public function getCheckPermission(App\Request $request)
17
-    {
18
-        if (!\App\Privilege::isPermitted('OpenStreetMap')) {
19
-            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
20
-        }
21
-        return true;
22
-    }
15
+	/** {@inheritdoc} */
16
+	public function getCheckPermission(App\Request $request)
17
+	{
18
+		if (!\App\Privilege::isPermitted('OpenStreetMap')) {
19
+			throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
20
+		}
21
+		return true;
22
+	}
23 23
 
24
-    /**
25
-     * Download layer and show.
26
-     *
27
-     * @param \App\Request $request
28
-     *
29
-     * @return bool
30
-     */
31
-    public function get(App\Request $request)
32
-    {
33
-        if (!\App\RequestUtil::isNetConnection()) {
34
-            $this->error();
35
-            return false;
36
-        }
37
-        $product = \App\YetiForce\Register::getProduct('YetiForceMap');
38
-        if ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token'])) {
39
-            $this->error('map_server_not_purchased');
40
-            return false;
41
-        }
42
-        $url = str_replace(['{z}', '{x}', '{y}'], [
43
-            $request->getByType('z', 'Integer'),
44
-            $request->getByType('x', 'Integer'),
45
-            $request->getByType('y', 'Integer'),
46
-        ], 'https://osm-tile.yetiforce.eu/tile/{z}/{x}/{y}.png');
47
-        $options = [
48
-            'timeout' => 60,
49
-            'headers' => [
50
-                'InsKey' => \App\YetiForce\Register::getInstanceKey()
51
-            ]
52
-        ];
53
-        if (isset($product['params']['token'])) {
54
-            $url += '?yf_token=' . $product['params']['token'];
55
-        } else {
56
-            $options['auth'] = [$product['params']['login'], $product['params']['pass']];
57
-        }
58
-        try {
59
-            \App\Log::beginProfile("GET|TileLayer::get|{$url}", __NAMESPACE__);
60
-            $response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, $options);
61
-            \App\Log::endProfile("GET|TileLayer::get|{$url}", __NAMESPACE__);
62
-            if (200 !== $response->getStatusCode()) {
63
-                \App\Log::error($url . ' | Error: ' . $response->getReasonPhrase(), __CLASS__);
64
-                $this->error();
65
-                return false;
66
-            }
67
-            $body = $response->getBody();
68
-            header('pragma: public');
69
-            header('cache-control: max-age=86400, public');
70
-            header('expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
71
-            header('content-type: image/png');
72
-            header('content-transfer-encoding: binary');
73
-            header('content-length: ' . $body->getSize());
74
-            echo $body->getContents();
75
-        } catch (\Throwable $ex) {
76
-            \App\Log::error($url . ' | Error: ' . $ex->getMessage(), __CLASS__);
77
-            $this->error();
78
-        }
79
-    }
24
+	/**
25
+	 * Download layer and show.
26
+	 *
27
+	 * @param \App\Request $request
28
+	 *
29
+	 * @return bool
30
+	 */
31
+	public function get(App\Request $request)
32
+	{
33
+		if (!\App\RequestUtil::isNetConnection()) {
34
+			$this->error();
35
+			return false;
36
+		}
37
+		$product = \App\YetiForce\Register::getProduct('YetiForceMap');
38
+		if ((empty($product['params']['login']) || empty($product['params']['pass'])) && empty($product['params']['token'])) {
39
+			$this->error('map_server_not_purchased');
40
+			return false;
41
+		}
42
+		$url = str_replace(['{z}', '{x}', '{y}'], [
43
+			$request->getByType('z', 'Integer'),
44
+			$request->getByType('x', 'Integer'),
45
+			$request->getByType('y', 'Integer'),
46
+		], 'https://osm-tile.yetiforce.eu/tile/{z}/{x}/{y}.png');
47
+		$options = [
48
+			'timeout' => 60,
49
+			'headers' => [
50
+				'InsKey' => \App\YetiForce\Register::getInstanceKey()
51
+			]
52
+		];
53
+		if (isset($product['params']['token'])) {
54
+			$url += '?yf_token=' . $product['params']['token'];
55
+		} else {
56
+			$options['auth'] = [$product['params']['login'], $product['params']['pass']];
57
+		}
58
+		try {
59
+			\App\Log::beginProfile("GET|TileLayer::get|{$url}", __NAMESPACE__);
60
+			$response = (new \GuzzleHttp\Client(\App\RequestHttp::getOptions()))->request('GET', $url, $options);
61
+			\App\Log::endProfile("GET|TileLayer::get|{$url}", __NAMESPACE__);
62
+			if (200 !== $response->getStatusCode()) {
63
+				\App\Log::error($url . ' | Error: ' . $response->getReasonPhrase(), __CLASS__);
64
+				$this->error();
65
+				return false;
66
+			}
67
+			$body = $response->getBody();
68
+			header('pragma: public');
69
+			header('cache-control: max-age=86400, public');
70
+			header('expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
71
+			header('content-type: image/png');
72
+			header('content-transfer-encoding: binary');
73
+			header('content-length: ' . $body->getSize());
74
+			echo $body->getContents();
75
+		} catch (\Throwable $ex) {
76
+			\App\Log::error($url . ' | Error: ' . $ex->getMessage(), __CLASS__);
77
+			$this->error();
78
+		}
79
+	}
80 80
 
81
-    /**
82
-     * Error function.
83
-     *
84
-     * @param string $type
85
-     *
86
-     * @return void
87
-     */
88
-    public function error(string $type = 'map_server_unavailable'): void
89
-    {
90
-        $fileName = ROOT_DIRECTORY . "/public_html/layouts/basic/images/{$type}.png";
91
-        header('pragma: public');
92
-        header('cache-control: max-age=86400, public');
93
-        header('expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
94
-        header('content-type: ' . \App\Fields\File::getMimeContentType($fileName));
95
-        header('content-transfer-encoding: binary');
96
-        header('content-length: ' . filesize($fileName));
97
-        readfile($fileName);
98
-    }
81
+	/**
82
+	 * Error function.
83
+	 *
84
+	 * @param string $type
85
+	 *
86
+	 * @return void
87
+	 */
88
+	public function error(string $type = 'map_server_unavailable'): void
89
+	{
90
+		$fileName = ROOT_DIRECTORY . "/public_html/layouts/basic/images/{$type}.png";
91
+		header('pragma: public');
92
+		header('cache-control: max-age=86400, public');
93
+		header('expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
94
+		header('content-type: ' . \App\Fields\File::getMimeContentType($fileName));
95
+		header('content-transfer-encoding: binary');
96
+		header('content-length: ' . filesize($fileName));
97
+		readfile($fileName);
98
+	}
99 99
 }
Please login to merge, or discard this patch.
app/YetiForce/Register.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		$products = $data['subscriptions'] ?? [];
352 352
 		foreach ($products as $product) {
353 353
 			$children = $product['children'] ?? [];
354
-			['product' => $product,'expiresAt' => $date] = $product;
354
+			['product' => $product, 'expiresAt' => $date] = $product;
355 355
 			foreach ($children as $child) {
356 356
 				$products[] = ['product' => $child['product'], 'expiresAt' => $date];
357 357
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
 		try {
397 397
 			$data = file_get_contents(self::REGISTRATION_FILE);
398
-			[, ,$registyData] = explode("\n", $data);
398
+			[,, $registyData] = explode("\n", $data);
399 399
 			self::$config = (new Encryption())->decrypt($registyData);
400 400
 		} catch (\Throwable $e) {
401 401
 			\App\Log::error($e->__toString());
Please login to merge, or discard this patch.
tests/App/Purifier.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,9 +152,9 @@
 block discarded – undo
152 152
 			['Text', 'NotSame', 'ę€ółśążźćń23{}":?>><>?:"{}+_)(*&^%$#@!) &lt;svg/onabort=alert(3)//  <svg/onload=alert(1) onfocus=alert(2)//', 'ę€ółśążźćń23{}":?>><>?:"{}+_)(*&^%$#@!) &lt;svg/onabort=alert(3)//  <svg/onload=alert(1) onfocus=alert(2)//', 'Sample number should be purified', \App\Exceptions\IllegalValue::class],
153 153
 			['Default', 'Same', 'Test-text-string-for-purifier', 'Test-text-string-for-purifier', 'Sample number should be unchanged', null],
154 154
 			['Default', 'NotSame', 'ę€ółśążźćń23{}":?>><>?:"{}+_)(*&^%$#@!) &lt;svg/onabort=alert(3)//  <svg/onload=alert(1) onfocus=alert(2)//', 'ę€ółśążźćń23{}":?>><>?:"{}+_)(*&^%$#@!) &lt;svg/onabort=alert(3)//  <svg/onload=alert(1) onfocus=alert(2)//', 'Sample number should be purified', \App\Exceptions\IllegalValue::class],
155
-			['MailId', 'Same',  '[email protected]> (added by [email protected])', '<[email protected]> (added by [email protected])', 'Sample text should be unchanged', null],
156
-			['MailId', 'Same',  '30.123.12.JavaMail."admin.azure"@A-PROXY01', '<30.123.12.JavaMail."admin.azure"@A-PROXY01>', 'Sample text should be unchanged', null],
157
-			['MailId', 'Same',  '[email protected]', '<[email protected]>', 'Sample text should be unchanged', null],
155
+			['MailId', 'Same', '[email protected]> (added by [email protected])', '<[email protected]> (added by [email protected])', 'Sample text should be unchanged', null],
156
+			['MailId', 'Same', '30.123.12.JavaMail."admin.azure"@A-PROXY01', '<30.123.12.JavaMail."admin.azure"@A-PROXY01>', 'Sample text should be unchanged', null],
157
+			['MailId', 'Same', '[email protected]', '<[email protected]>', 'Sample text should be unchanged', null],
158 158
 			[\App\Purifier::PATH, 'NotSame', '../Test', '../Test', 'Path should be discarded', \App\Exceptions\IllegalValue::class],
159 159
 			[\App\Purifier::PATH, 'Same', '/Test/test', '/Test/test', 'Path should be unchanged', null],
160 160
 		];
Please login to merge, or discard this patch.