@@ -13,8 +13,7 @@ |
||
13 | 13 | if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) { |
14 | 14 | $mode = 'a'; |
15 | 15 | $write = false; |
16 | - } |
|
17 | - else { |
|
16 | + } else { |
|
18 | 17 | $mode = 'w'; |
19 | 18 | $write = true; |
20 | 19 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | private static $handler; |
11 | 11 | |
12 | 12 | |
13 | - public static function init (int $log_size = 10) { |
|
13 | + public static function init(int $log_size = 10) { |
|
14 | 14 | self::$log_size = $log_size; |
15 | 15 | if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) { |
16 | 16 | $mode = 'a'; |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | self::$handler = fopen('BPT.log', $mode); |
25 | 25 | |
26 | 26 | if ($write) { |
27 | - fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
27 | + fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | public static function write(string $data, string $type = loggerTypes::NONE) { |
32 | 32 | if (!is_null(self::$handler)) { |
33 | - $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" ); |
|
33 | + $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n"); |
|
34 | 34 | fwrite(self::$handler, $text); |
35 | 35 | } |
36 | 36 | } |
@@ -11,16 +11,16 @@ |
||
11 | 11 | return touch("$name.lock"); |
12 | 12 | } |
13 | 13 | |
14 | - public static function save(string $name, string $data): bool|int { |
|
14 | + public static function save(string $name, string $data): bool | int { |
|
15 | 15 | return file_put_contents("$name.lock", $data); |
16 | 16 | |
17 | 17 | } |
18 | 18 | |
19 | - public static function read(string $name): bool|string { |
|
19 | + public static function read(string $name): bool | string { |
|
20 | 20 | return file_get_contents("$name.lock"); |
21 | 21 | } |
22 | 22 | |
23 | - public static function mtime(string $name): bool|int { |
|
23 | + public static function mtime(string $name): bool | int { |
|
24 | 24 | return filemtime("$name.lock"); |
25 | 25 | } |
26 | 26 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | if (lock::exist('BPT-MULTI-EXEC')) { |
14 | 14 | self::setUpdate(exec::init()); |
15 | 15 | } |
16 | - elseif(lock::exist('BPT-MULTI-CURL')) { |
|
16 | + elseif (lock::exist('BPT-MULTI-CURL')) { |
|
17 | 17 | self::setUpdate(curl::init()); |
18 | 18 | } |
19 | 19 | else { |
@@ -12,11 +12,9 @@ |
||
12 | 12 | public static function init() { |
13 | 13 | if (lock::exist('BPT-MULTI-EXEC')) { |
14 | 14 | self::setUpdate(exec::init()); |
15 | - } |
|
16 | - elseif(lock::exist('BPT-MULTI-CURL')) { |
|
15 | + } elseif(lock::exist('BPT-MULTI-CURL')) { |
|
17 | 16 | self::setUpdate(curl::init()); |
18 | - } |
|
19 | - else { |
|
17 | + } else { |
|
20 | 18 | self::deleteOldLocks(); |
21 | 19 | self::checkURL(); |
22 | 20 | self::setCertificate(); |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | $curl_handler = curl_init(settings::$base_url."$token/"); |
37 | 37 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
38 | 38 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
39 | - } |
|
40 | - else{ |
|
39 | + } else{ |
|
41 | 40 | $token = settings::$token; |
42 | 41 | if (!isset(self::$curl_handler)){ |
43 | 42 | self::$curl_handler = curl_init(settings::$base_url."$token/"); |
@@ -59,11 +58,9 @@ discard block |
||
59 | 58 | if (isset($data['forgot'])) { |
60 | 59 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
61 | 60 | unset($data['forgot']); |
62 | - } |
|
63 | - elseif ($method === 'getUpdates'){ |
|
61 | + } elseif ($method === 'getUpdates'){ |
|
64 | 62 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
65 | - } |
|
66 | - else{ |
|
63 | + } else{ |
|
67 | 64 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
68 | 65 | } |
69 | 66 | } |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | class curl { |
11 | 11 | private static CurlHandle $curl_handler; |
12 | 12 | |
13 | - public static function init(string $method,array $data) { |
|
13 | + public static function init(string $method, array $data) { |
|
14 | 14 | $info = self::getInfo($data); |
15 | 15 | $data = $info['data']; |
16 | 16 | $handler = $info['handler']; |
17 | - self::setTimeout($data,$handler,$method); |
|
17 | + self::setTimeout($data, $handler, $method); |
|
18 | 18 | self::setData($data); |
19 | 19 | $data['method'] = $method; |
20 | 20 | curl_setopt($handler, CURLOPT_POSTFIELDS, $data); |
21 | 21 | $result = curl_exec($handler); |
22 | 22 | if (curl_errno($handler)) { |
23 | - logger::write(curl_error($handler),loggerTypes::WARNING); |
|
23 | + logger::write(curl_error($handler), loggerTypes::WARNING); |
|
24 | 24 | } |
25 | 25 | if ($info['token'] != settings::$token) { |
26 | 26 | curl_close($handler); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true); |
37 | 37 | curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
38 | 38 | } |
39 | - else{ |
|
39 | + else { |
|
40 | 40 | $token = settings::$token; |
41 | - if (!isset(self::$curl_handler)){ |
|
41 | + if (!isset(self::$curl_handler)) { |
|
42 | 42 | self::$curl_handler = curl_init(settings::$base_url."$token/"); |
43 | 43 | curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true); |
44 | 44 | curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false); |
@@ -54,22 +54,22 @@ discard block |
||
54 | 54 | ]; |
55 | 55 | } |
56 | 56 | |
57 | - private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method) { |
|
57 | + private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method) { |
|
58 | 58 | if (isset($data['forgot'])) { |
59 | 59 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time); |
60 | 60 | unset($data['forgot']); |
61 | 61 | } |
62 | - elseif ($method === 'getUpdates'){ |
|
62 | + elseif ($method === 'getUpdates') { |
|
63 | 63 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000); |
64 | 64 | } |
65 | - else{ |
|
65 | + else { |
|
66 | 66 | curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 300); |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | 70 | private static function setData(array &$data) { |
71 | - foreach ($data as &$value){ |
|
72 | - if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){ |
|
71 | + foreach ($data as &$value) { |
|
72 | + if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) { |
|
73 | 73 | $value = json_encode($value); |
74 | 74 | } |
75 | 75 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | use BPT\settings; |
11 | 11 | |
12 | 12 | class curl extends webhook { |
13 | - public static function init (): string|null { |
|
13 | + public static function init(): string | null { |
|
14 | 14 | if (self::checkIP()) { |
15 | 15 | return self::getUpdate(); |
16 | 16 | } |
17 | 17 | else { |
18 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
18 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
19 | 19 | BPT::exit(); |
20 | 20 | } |
21 | 21 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | return $_SERVER['REMOTE_ADDR'] === $_SERVER['SERVER_ADDR']; |
25 | 25 | } |
26 | 26 | |
27 | - private static function getUpdate (): string { |
|
27 | + private static function getUpdate(): string { |
|
28 | 28 | $input = json_decode(file_get_contents("php://input"), true); |
29 | 29 | webhook::telegramVerify($input['ip']); |
30 | 30 | return $input['update']; |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | $urls = self::setURLS(); |
35 | 35 | $file = $urls['file']; |
36 | 36 | $timeout = self::getTimeout($file); |
37 | - self::create($file,$timeout); |
|
37 | + self::create($file, $timeout); |
|
38 | 38 | self::setWebhook($urls['url']); |
39 | 39 | lock::set('BPT-MULTI-CURL'); |
40 | 40 | } |
41 | 41 | |
42 | - private static function getTimeout($url): float|int { |
|
42 | + private static function getTimeout($url): float | int { |
|
43 | 43 | $times = []; |
44 | - for ($i = 0; $i < 10; $i ++) { |
|
44 | + for ($i = 0; $i < 10; $i++) { |
|
45 | 45 | $ch = curl_init($url); |
46 | 46 | curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([]), CURLOPT_TIMEOUT_MS => 100, CURLOPT_NOBODY => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => 100, CURLOPT_HTTPHEADER => ['accept: application/json', 'content-type: application/json']]); |
47 | 47 | $start = microtime(true); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | return $timeout > 50 ? $timeout + 10 : 50; |
53 | 53 | } |
54 | 54 | |
55 | - private static function create($file,$timeout) { |
|
56 | - file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\'' . $file . '\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => ' . $timeout . ', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => ' . $timeout . ', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
55 | + private static function create($file, $timeout) { |
|
56 | + file_put_contents('receiver.php', '<?php http_response_code(200);ignore_user_abort();$ch = curl_init(\''.$file.'\');curl_setopt_array($ch, [CURLOPT_POSTFIELDS => json_encode([\'update\'=>file_get_contents(\'php://input\'),\'ip\'=>$_SERVER[\'REMOTE_ADDR\']]), CURLOPT_TIMEOUT_MS => '.$timeout.', CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_CONNECTTIMEOUT_MS => '.$timeout.', CURLOPT_HTTPHEADER => [\'accept: application/json\', \'content-type: application/json\']]);curl_exec($ch);curl_close($ch);?>'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | private static function setURLS(): array { |
60 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
60 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
61 | 61 | $file = basename($_SERVER['REQUEST_URI']); |
62 | 62 | return [ |
63 | 63 | 'url'=>str_replace($file, 'receiver.php', $base_url), |
@@ -13,8 +13,7 @@ |
||
13 | 13 | public static function init (): string|null { |
14 | 14 | if (self::checkIP()) { |
15 | 15 | return self::getUpdate(); |
16 | - } |
|
17 | - else { |
|
16 | + } else { |
|
18 | 17 | logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
19 | 18 | BPT::exit(); |
20 | 19 | } |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | use BPT\settings; |
11 | 11 | |
12 | 12 | class exec extends webhook { |
13 | - public static function init(): string|null { |
|
13 | + public static function init(): string | null { |
|
14 | 14 | return self::getUpdate(); |
15 | 15 | } |
16 | 16 | |
17 | - private static function getUpdate (): string|null { |
|
17 | + private static function getUpdate(): string | null { |
|
18 | 18 | $up = glob('*.update'); |
19 | 19 | if (isset($up[0])) { |
20 | 20 | $up = end($up); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | return $update; |
26 | 26 | } |
27 | 27 | else { |
28 | - logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
|
28 | + logger::write('not authorized access denied. IP : '.$_SERVER['REMOTE_ADDR'] ?? 'unknown', loggerTypes::WARNING); |
|
29 | 29 | BPT::exit(); |
30 | 30 | } |
31 | 31 | } |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | private static function create($file) { |
48 | - file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php ' . $file . ' > /dev/null &");'); |
|
48 | + file_put_contents('receiver.php', '<?php $BPT = file_get_contents("php://input");$id = json_decode($BPT, true)[\'update_id\'];file_put_contents("{$_SERVER[\'REMOTE_ADDR\']}-$id.update",$BPT);exec("php '.$file.' > /dev/null &");'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | private static function setURLS(): array { |
52 | - $base_url = (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; |
|
52 | + $base_url = (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
|
53 | 53 | return [ |
54 | 54 | 'url'=>str_replace(basename($_SERVER['REQUEST_URI']), 'receiver.php', $base_url), |
55 | 55 | 'file'=>basename($_SERVER['SCRIPT_NAME']) |
@@ -23,8 +23,7 @@ |
||
23 | 23 | $update = file_get_contents($up); |
24 | 24 | unlink($up); |
25 | 25 | return $update; |
26 | - } |
|
27 | - else { |
|
26 | + } else { |
|
28 | 27 | logger::write('not authorized access denied. IP : '. $_SERVER['REMOTE_ADDR'] ?? 'unknown',loggerTypes::WARNING); |
29 | 28 | BPT::exit(); |
30 | 29 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace BPT\api; |
4 | 4 | |
5 | 5 | class telegram extends request { |
6 | - public function __call (string $name, array $arguments) { |
|
6 | + public function __call(string $name, array $arguments) { |
|
7 | 7 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
8 | 8 | return request::$name(...$arguments[0]); |
9 | 9 | } |
@@ -233,8 +233,7 @@ |
||
233 | 233 | public function __call (string $name, array $arguments) { |
234 | 234 | if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) { |
235 | 235 | return request::$name(...$arguments[0]); |
236 | - } |
|
237 | - else { |
|
236 | + } else { |
|
238 | 237 | return request::$name(...$arguments); |
239 | 238 | } |
240 | 239 | } |
@@ -4,4 +4,4 @@ |
||
4 | 4 | |
5 | 5 | use Exception; |
6 | 6 | |
7 | -class telegramException extends Exception{} |
|
8 | 7 | \ No newline at end of file |
8 | +class telegramException extends Exception {} |
|
9 | 9 | \ No newline at end of file |
@@ -66,11 +66,9 @@ discard block |
||
66 | 66 | foreach ($settings as $setting => $value) { |
67 | 67 | try{ |
68 | 68 | self::$$setting = $value; |
69 | - } |
|
70 | - catch (TypeError){ |
|
69 | + } catch (TypeError){ |
|
71 | 70 | logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
72 | - } |
|
73 | - catch (Error){ |
|
71 | + } catch (Error){ |
|
74 | 72 | logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
75 | 73 | } |
76 | 74 | } |
@@ -81,13 +79,11 @@ discard block |
||
81 | 79 | self::secureFolder(); |
82 | 80 | self::db(); |
83 | 81 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
84 | - } |
|
85 | - else { |
|
82 | + } else { |
|
86 | 83 | logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
87 | 84 | throw new bptException('TOKEN_NOT_TRUE'); |
88 | 85 | } |
89 | - } |
|
90 | - else { |
|
86 | + } else { |
|
91 | 87 | logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
92 | 88 | throw new bptException('TOKEN_NOT_FOUND'); |
93 | 89 | } |
@@ -129,8 +125,7 @@ discard block |
||
129 | 125 | private static function getUpdates() { |
130 | 126 | if (self::$handler) { |
131 | 127 | getUpdates::init(); |
132 | - } |
|
133 | - else { |
|
128 | + } else { |
|
134 | 129 | logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR); |
135 | 130 | throw new bptException('GETUPDATE_NEED_HANDLER'); |
136 | 131 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public static int $log_size = 10; |
25 | 25 | |
26 | - public static string|CURLFile|null $certificate = null; |
|
26 | + public static string | CURLFile | null $certificate = null; |
|
27 | 27 | |
28 | 28 | public static bool $handler = true; |
29 | 29 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | |
54 | 54 | public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query']; |
55 | 55 | |
56 | - public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
56 | + public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json']; |
|
57 | 57 | |
58 | 58 | |
59 | - public static function init (array|stdClass $settings) { |
|
59 | + public static function init(array | stdClass $settings) { |
|
60 | 60 | $settings = (array) $settings; |
61 | 61 | |
62 | 62 | if (!(isset($settings['logger']) && $settings['logger'] == false)) { |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | foreach ($settings as $setting => $value) { |
67 | - try{ |
|
67 | + try { |
|
68 | 68 | self::$$setting = $value; |
69 | 69 | } |
70 | - catch (TypeError){ |
|
71 | - logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING); |
|
70 | + catch (TypeError) { |
|
71 | + logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING); |
|
72 | 72 | } |
73 | - catch (Error){ |
|
74 | - logger::write("$setting setting is not one of library settings",loggerTypes::WARNING); |
|
73 | + catch (Error) { |
|
74 | + logger::write("$setting setting is not one of library settings", loggerTypes::WARNING); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates(); |
84 | 84 | } |
85 | 85 | else { |
86 | - logger::write('token format is not right, check it and try again',loggerTypes::ERROR); |
|
86 | + logger::write('token format is not right, check it and try again', loggerTypes::ERROR); |
|
87 | 87 | throw new bptException('TOKEN_NOT_TRUE'); |
88 | 88 | } |
89 | 89 | } |
90 | 90 | else { |
91 | - logger::write('You must specify token parameter in settings',loggerTypes::ERROR); |
|
91 | + logger::write('You must specify token parameter in settings', loggerTypes::ERROR); |
|
92 | 92 | throw new bptException('TOKEN_NOT_FOUND'); |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | 96 | public static function done() { |
97 | 97 | if (self::$logger) { |
98 | - $estimated = round((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'])*1000,2); |
|
98 | + $estimated = round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2); |
|
99 | 99 | $status_message = match (true) { |
100 | 100 | $estimated < 100 => 'Excellent', |
101 | 101 | $estimated < 500 => 'Very good', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | if (self::$secure_folder) { |
128 | 128 | $address = explode('/', $_SERVER['REQUEST_URI']); |
129 | 129 | unset($address[count($address) - 1]); |
130 | - $address = implode('/', $address) . '/BPT.php'; |
|
130 | + $address = implode('/', $address).'/BPT.php'; |
|
131 | 131 | $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n Order Allow,Deny\n Allow from all\n</Files>"; |
132 | 132 | if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) { |
133 | 133 | file_put_contents('.htaccess', $text); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | getUpdates::init(); |
147 | 147 | } |
148 | 148 | else { |
149 | - logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR); |
|
149 | + logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR); |
|
150 | 150 | throw new bptException('GETUPDATE_NEED_HANDLER'); |
151 | 151 | } |
152 | 152 | } |