Răsfoiți Sursa

perf: use fully-qualified function call

Replaced following method with fully-qualified function call:
in_array
is_array
json_decode
json_encode
time
hash
password_hash
Cat 3 ani în urmă
părinte
comite
f310ba2719
70 a modificat fișierele cu 337 adăugiri și 343 ștergeri
  1. 7 7
      src/Command/ClientDownload.php
  2. 2 2
      src/Command/DetectBan.php
  3. 3 3
      src/Command/DetectGFW.php
  4. 3 3
      src/Command/FinanceMail.php
  5. 24 24
      src/Command/Job.php
  6. 3 3
      src/Command/PortAutoChange.php
  7. 3 3
      src/Command/Tool.php
  8. 4 4
      src/Command/User.php
  9. 1 1
      src/Controllers/Admin/AnnController.php
  10. 1 1
      src/Controllers/Admin/CodeController.php
  11. 1 1
      src/Controllers/Admin/DetectBanLogController.php
  12. 4 4
      src/Controllers/Admin/DetectController.php
  13. 11 11
      src/Controllers/Admin/IpController.php
  14. 2 2
      src/Controllers/Admin/NodeController.php
  15. 3 3
      src/Controllers/Admin/SettingController.php
  16. 4 4
      src/Controllers/Admin/ShopController.php
  17. 1 1
      src/Controllers/Admin/SubscribeLogController.php
  18. 4 4
      src/Controllers/Admin/TicketController.php
  19. 5 5
      src/Controllers/Admin/UserController.php
  20. 3 3
      src/Controllers/Admin/UserLog/BoughtLogController.php
  21. 2 2
      src/Controllers/Admin/UserLog/DetectLogController.php
  22. 1 1
      src/Controllers/Admin/UserLog/LoginLogController.php
  23. 1 1
      src/Controllers/Admin/UserLog/SubLogController.php
  24. 2 2
      src/Controllers/AdminController.php
  25. 10 10
      src/Controllers/AuthController.php
  26. 9 9
      src/Controllers/LinkController.php
  27. 3 3
      src/Controllers/Node/FuncController.php
  28. 8 8
      src/Controllers/Node/NodeController.php
  29. 15 21
      src/Controllers/Node/UserController.php
  30. 3 3
      src/Controllers/PasswordController.php
  31. 7 7
      src/Controllers/SubController.php
  32. 1 1
      src/Controllers/User/NodeController.php
  33. 4 4
      src/Controllers/User/ShopController.php
  34. 2 2
      src/Controllers/User/TicketController.php
  35. 16 16
      src/Controllers/UserController.php
  36. 1 1
      src/Middleware/Auth.php
  37. 1 1
      src/Middleware/NodeToken.php
  38. 4 4
      src/Models/Bought.php
  39. 12 12
      src/Models/Node.php
  40. 2 2
      src/Models/Payback.php
  41. 5 5
      src/Models/Shop.php
  42. 7 7
      src/Models/User.php
  43. 2 2
      src/Services/Analytics.php
  44. 3 3
      src/Services/Auth/Cookie.php
  45. 2 2
      src/Services/Captcha.php
  46. 3 3
      src/Services/Gateway/AbstractPayment.php
  47. 1 1
      src/Services/Gateway/Epay.php
  48. 1 1
      src/Services/Gateway/Epay/EpayTool.php
  49. 4 4
      src/Services/Gateway/PAYJS.php
  50. 1 1
      src/Services/Gateway/StripeCard.php
  51. 3 3
      src/Services/Gateway/THeadPaySDK.php
  52. 1 1
      src/Services/Gateway/Vmqpay.php
  53. 2 2
      src/Services/Password.php
  54. 15 15
      src/Utils/AppURI.php
  55. 2 2
      src/Utils/Check.php
  56. 14 14
      src/Utils/ConfGenerate.php
  57. 5 5
      src/Utils/GA.php
  58. 1 1
      src/Utils/Geetest.php
  59. 2 2
      src/Utils/GeetestLib.php
  60. 6 6
      src/Utils/Hash.php
  61. 30 30
      src/Utils/Telegram/Callbacks/Callback.php
  62. 1 1
      src/Utils/Telegram/Commands/InfoCommand.php
  63. 1 1
      src/Utils/Telegram/Commands/MenuCommand.php
  64. 1 1
      src/Utils/Telegram/Commands/MyCommand.php
  65. 1 1
      src/Utils/Telegram/Commands/SetuserCommand.php
  66. 2 2
      src/Utils/Telegram/Message.php
  67. 5 5
      src/Utils/Telegram/TelegramTools.php
  68. 8 8
      src/Utils/TelegramSessionManager.php
  69. 5 5
      src/Utils/Tools.php
  70. 10 10
      src/Utils/URL.php

+ 7 - 7
src/Command/ClientDownload.php

@@ -253,7 +253,7 @@ final class ClientDownload extends Command
     {
         $url = 'https://api.github.com/repos/' . $repo . '/releases/latest' . ($_ENV['github_access_token'] !== '' ? '?access_token=' . $_ENV['github_access_token'] : '');
         $request = $this->client->get($url);
-        return (string) json_decode(
+        return (string) \json_decode(
             $request->getBody()->getContents(),
             true
         )['tag_name'];
@@ -266,7 +266,7 @@ final class ClientDownload extends Command
     {
         $url = 'https://api.github.com/repos/' . $repo . '/releases' . ($_ENV['github_access_token'] !== '' ? '?access_token=' . $_ENV['github_access_token'] : '');
         $request = $this->client->get($url);
-        $latest = json_decode(
+        $latest = \json_decode(
             $request->getBody()->getContents(),
             true
         )[0];
@@ -289,7 +289,7 @@ final class ClientDownload extends Command
      */
     private function isJson(string $string): bool
     {
-        return json_decode($string, true) !== false;
+        return \json_decode($string, true) !== false;
     }
 
     /**
@@ -305,9 +305,9 @@ final class ClientDownload extends Command
             echo '本地软体版本库 ClientDownloadVersion.json 不存在,创建文件中...' . PHP_EOL;
             $result = file_put_contents(
                 $filePath,
-                json_encode(
+                \json_encode(
                     [
-                        'createTime' => time(),
+                        'createTime' => \time(),
                     ]
                 )
             );
@@ -321,7 +321,7 @@ final class ClientDownload extends Command
             echo 'ClientDownloadVersion.json 文件格式异常,脚本中止.' . PHP_EOL;
             exit(0);
         }
-        return json_decode($fileContent, true);
+        return \json_decode($fileContent, true);
     }
 
     /**
@@ -333,7 +333,7 @@ final class ClientDownload extends Command
         $filePath = BASE_PATH . '/config/' . $fileName;
         return (bool) file_put_contents(
             $filePath,
-            json_encode(
+            \json_encode(
                 $versions
             )
         );

+ 2 - 2
src/Command/DetectBan.php

@@ -26,7 +26,7 @@ final class DetectBan extends Command
             $user_logs = [];
             foreach ($new_logs as $log) {
                 // 分类各个用户的记录数量
-                if (! in_array($log->user_id, array_keys($user_logs))) {
+                if (! \in_array($log->user_id, array_keys($user_logs))) {
                     $user_logs[$log->user_id] = 0;
                 }
                 $user_logs[$log->user_id]++;
@@ -43,7 +43,7 @@ final class DetectBan extends Command
                 $user->all_detect_number += $value;
                 $user->save();
 
-                if ($user->enable === 0 || ($user->is_admin && $_ENV['auto_detect_ban_allow_admin'] === true) || in_array($user->id, $_ENV['auto_detect_ban_allow_users'])) {
+                if ($user->enable === 0 || ($user->is_admin && $_ENV['auto_detect_ban_allow_admin'] === true) || \in_array($user->id, $_ENV['auto_detect_ban_allow_users'])) {
                     // 如果用户已被封禁
                     // 如果用户是管理员
                     // 如果属于钦定用户

+ 3 - 3
src/Command/DetectGFW.php

@@ -18,9 +18,9 @@ final class DetectGFW extends Command
         //节点被墙检测
         $last_time = file_get_contents(BASE_PATH . '/storage/last_detect_gfw_time');
         for ($count = 1; $count <= 12; $count++) {
-            if (time() - $last_time >= $_ENV['detect_gfw_interval']) {
+            if (\time() - $last_time >= $_ENV['detect_gfw_interval']) {
                 $file_interval = fopen(BASE_PATH . '/storage/last_detect_gfw_time', 'wb');
-                fwrite($file_interval, time());
+                fwrite($file_interval, \time());
                 fclose($file_interval);
                 $nodes = Node::all();
                 $adminUser = User::where('is_admin', '=', '1')->get();
@@ -42,7 +42,7 @@ final class DetectGFW extends Command
                     $result_tcping = false;
                     $detect_time = $_ENV['detect_gfw_count'];
                     for ($i = 1; $i <= $detect_time; $i++) {
-                        $json_tcping = json_decode(file_get_contents($api_url), true);
+                        $json_tcping = \json_decode(file_get_contents($api_url), true);
                         if ($_ENV['detect_gfw_judge']($json_tcping)) {
                             $result_tcping = true;
                             break;

+ 3 - 3
src/Command/FinanceMail.php

@@ -40,7 +40,7 @@ EOL;
 		where TO_DAYS(NOW()) - TO_DAYS(code.usedatetime) = 1 and code.type = -1 and code.isused= 1'
         );
         $text_json = $datatables->generate();
-        $text_array = json_decode($text_json, true);
+        $text_array = \json_decode($text_json, true);
         $codes = $text_array['data'];
         $text_html = '<table border=1><tr><td>金额</td><td>用户ID</td><td>用户名</td><td>充值时间</td>';
         $income_count = 0;
@@ -93,7 +93,7 @@ EOL;
         );
         //每周的第一天是周日,因此统计周日~周六的七天
         $text_json = $datatables->generate();
-        $text_array = json_decode($text_json, true);
+        $text_array = \json_decode($text_json, true);
         $codes = $text_array['data'];
         $text_html = '';
         $income_count = 0;
@@ -137,7 +137,7 @@ EOL;
 		where date_format(code.usedatetime,\'%Y-%m\')=date_format(date_sub(curdate(), interval 1 month),\'%Y-%m\') and code.type = -1 and code.isused= 1'
         );
         $text_json = $datatables->generate();
-        $text_array = json_decode($text_json, true);
+        $text_array = \json_decode($text_json, true);
         $codes = $text_array['data'];
         $text_html = '';
         $income_count = 0;

+ 24 - 24
src/Command/Job.php

@@ -72,7 +72,7 @@ EOL;
         EmailQueue::chunkById(1000, static function ($email_queues): void {
             foreach ($email_queues as $email_queue) {
                 try {
-                    Mail::send($email_queue->to_email, $email_queue->subject, $email_queue->template, json_decode($email_queue->array), []);
+                    Mail::send($email_queue->to_email, $email_queue->subject, $email_queue->template, \json_decode($email_queue->array), []);
                 } catch (Exception $e) {
                     echo $e->getMessage();
                 }
@@ -94,18 +94,18 @@ EOL;
         Node::where('bandwidthlimit_resetday', date('d'))->update(['node_bandwidth' => 0]);
 
         // ------- 清理各表记录
-        UserSubscribeLog::where('request_time', '<', date('Y-m-d H:i:s', time() - 86400 * (int) $_ENV['subscribeLog_keep_days']))->delete();
-        Token::where('expire_time', '<', time())->delete();
-        NodeInfoLog::where('log_time', '<', time() - 86400 * 3)->delete();
-        NodeOnlineLog::where('log_time', '<', time() - 86400 * 3)->delete();
-        DetectLog::where('datetime', '<', time() - 86400 * 3)->delete();
-        EmailVerify::where('expire_in', '<', time() - 86400 * 3)->delete();
-        PasswordReset::where('expire_time', '<', time() - 86400 * 3)->delete();
-        Ip::where('datetime', '<', time() - 300)->delete();
-        UnblockIp::where('datetime', '<', time() - 300)->delete();
-        BlockIp::where('datetime', '<', time() - 86400)->delete();
-        StreamMedia::where('created_at', '<', time() - 86400 * 24)->delete();
-        TelegramSession::where('datetime', '<', time() - 900)->delete();
+        UserSubscribeLog::where('request_time', '<', date('Y-m-d H:i:s', \time() - 86400 * (int) $_ENV['subscribeLog_keep_days']))->delete();
+        Token::where('expire_time', '<', \time())->delete();
+        NodeInfoLog::where('log_time', '<', \time() - 86400 * 3)->delete();
+        NodeOnlineLog::where('log_time', '<', \time() - 86400 * 3)->delete();
+        DetectLog::where('datetime', '<', \time() - 86400 * 3)->delete();
+        EmailVerify::where('expire_in', '<', \time() - 86400 * 3)->delete();
+        PasswordReset::where('expire_time', '<', \time() - 86400 * 3)->delete();
+        Ip::where('datetime', '<', \time() - 300)->delete();
+        UnblockIp::where('datetime', '<', \time() - 300)->delete();
+        BlockIp::where('datetime', '<', \time() - 86400)->delete();
+        StreamMedia::where('created_at', '<', \time() - 86400 * 24)->delete();
+        TelegramSession::where('datetime', '<', \time() - 900)->delete();
         // ------- 清理各表记录
 
         // ------- 重置自增 ID
@@ -157,7 +157,7 @@ EOL;
                 /** @var User $user */
                 $user->last_day_t = $user->u + $user->d;
                 $user->save();
-                if (in_array($user->id, $bought_users)) {
+                if (\in_array($user->id, $bought_users)) {
                     continue;
                 }
                 if (date('d') === $user->auto_reset_day) {
@@ -314,7 +314,7 @@ EOL;
     {
         $users = User::all();
         foreach ($users as $user) {
-            if (strtotime($user->expire_in) < time() && $user->expire_notified === false) {
+            if (strtotime($user->expire_in) < \time() && $user->expire_notified === false) {
                 $user->transfer_enable = 0;
                 $user->u = 0;
                 $user->d = 0;
@@ -330,7 +330,7 @@ EOL;
                 );
                 $user->expire_notified = true;
                 $user->save();
-            } elseif (strtotime($user->expire_in) > time() && $user->expire_notified === true) {
+            } elseif (strtotime($user->expire_in) > \time() && $user->expire_notified === true) {
                 $user->expire_notified = false;
                 $user->save();
             }
@@ -378,7 +378,7 @@ EOL;
 
             if (
                 $_ENV['account_expire_delete_days'] >= 0 &&
-                strtotime($user->expire_in) + $_ENV['account_expire_delete_days'] * 86400 < time() &&
+                strtotime($user->expire_in) + $_ENV['account_expire_delete_days'] * 86400 < \time() &&
                 $user->money <= $_ENV['auto_clean_min_money']
             ) {
                 $user->sendMail(
@@ -399,7 +399,7 @@ EOL;
                 max(
                     $user->last_check_in_time,
                     strtotime($user->reg_date)
-                ) + ($_ENV['auto_clean_uncheck_days'] * 86400) < time() &&
+                ) + ($_ENV['auto_clean_uncheck_days'] * 86400) < \time() &&
                 $user->class === 0 &&
                 $user->money <= $_ENV['auto_clean_min_money']
             ) {
@@ -418,7 +418,7 @@ EOL;
 
             if (
                 $_ENV['auto_clean_unused_days'] > 0 &&
-                max($user->t, strtotime($user->reg_date)) + ($_ENV['auto_clean_unused_days'] * 86400) < time() &&
+                max($user->t, strtotime($user->reg_date)) + ($_ENV['auto_clean_unused_days'] * 86400) < \time() &&
                 $user->class === 0 &&
                 $user->money <= $_ENV['auto_clean_min_money']
             ) {
@@ -437,7 +437,7 @@ EOL;
 
             if (
                 $user->class !== 0 &&
-                strtotime($user->class_expire) < time() &&
+                strtotime($user->class_expire) < \time() &&
                 strtotime($user->class_expire) > 1420041600
             ) {
                 $text = '您好,系统发现您的账号等级已经过期了。';
@@ -465,7 +465,7 @@ EOL;
             if ($user->enable === 0) {
                 $logs = DetectBanLog::where('user_id', $user->id)->orderBy('id', 'desc')->first();
                 if ($logs !== null) {
-                    if (($logs->end_time + $logs->ban_time * 60) <= time()) {
+                    if (($logs->end_time + $logs->ban_time * 60) <= \time()) {
                         $user->enable = 1;
                     }
                 }
@@ -475,7 +475,7 @@ EOL;
         }
 
         //自动续费
-        $boughts = Bought::where('renew', '<', time() + 60)->where('renew', '<>', 0)->get();
+        $boughts = Bought::where('renew', '<', \time() + 60)->where('renew', '<>', 0)->get();
         foreach ($boughts as $bought) {
             /** @var Bought $bought */
             $user = $bought->user();
@@ -509,8 +509,8 @@ EOL;
                 $bought_new = new Bought();
                 $bought_new->userid = $user->id;
                 $bought_new->shopid = $shop->id;
-                $bought_new->datetime = time();
-                $bought_new->renew = time() + $shop->auto_renew * 86400;
+                $bought_new->datetime = \time();
+                $bought_new->renew = \time() + $shop->auto_renew * 86400;
                 $bought_new->price = $shop->price;
                 $bought_new->coupon = '';
                 $bought_new->save();

+ 3 - 3
src/Command/PortAutoChange.php

@@ -123,7 +123,7 @@ final class PortAutoChange extends Command
                 $mu_user->save();
                 foreach ($mu_port_nodes as $mu_port_node) {
                     $node_port = $this->outPort($mu_port_node, $port);
-                    if (in_array($mu_port_node->id, $array) && ! in_array($mu_port_node->id, $this->Config['exception_node_id'])) {
+                    if (\in_array($mu_port_node->id, $array) && ! \in_array($mu_port_node->id, $this->Config['exception_node_id'])) {
                         if ($node_port !== $port) {
                             if ($node_port === $new_port) {
                                 if (strpos($mu_port_node->server, $port . '#') !== false) {
@@ -167,7 +167,7 @@ final class PortAutoChange extends Command
                 }
             } else {
                 foreach ($array as $node_id) {
-                    if (in_array($node_id, $this->Config['exception_node_id'])) {
+                    if (\in_array($node_id, $this->Config['exception_node_id'])) {
                         continue;
                     }
                     $node = Node::find($node_id);
@@ -227,7 +227,7 @@ final class PortAutoChange extends Command
         $result_tcping = false;
         $detect_time = $_ENV['detect_gfw_count'];
         for ($i = 1; $i <= $detect_time; $i++) {
-            $json_tcping = json_decode(file_get_contents($api_url), true);
+            $json_tcping = \json_decode(file_get_contents($api_url), true);
             if ($_ENV['detect_gfw_judge']($json_tcping)) {
                 $result_tcping = true;
                 break;

+ 3 - 3
src/Command/Tool.php

@@ -103,7 +103,7 @@ EOL;
             $setting->value = $setting->default;
         }
 
-        $json_settings = json_encode($settings, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
+        $json_settings = \json_encode($settings, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
         file_put_contents('./config/settings.json', $json_settings);
 
         echo '已导出所有设置.' . PHP_EOL;
@@ -112,7 +112,7 @@ EOL;
     public function importAllSettings(): void
     {
         $json_settings = file_get_contents('./config/settings.json');
-        $settings = json_decode($json_settings, true);
+        $settings = \json_decode($json_settings, true);
         $config = [];
         $add_counter = 0;
         $del_counter = 0;
@@ -142,7 +142,7 @@ EOL;
         // 检查移除
         $db_settings = Setting::all();
         foreach ($db_settings as $db_setting) {
-            if (! in_array($db_setting->item, $config)) {
+            if (! \in_array($db_setting->item, $config)) {
                 $db_setting->delete();
                 $del_counter += 1;
             }

+ 4 - 4
src/Command/User.php

@@ -93,7 +93,7 @@ EOL;
     public function generateUUID(): void
     {
         $users = ModelsUser::all();
-        $current_timestamp = time();
+        $current_timestamp = \time();
         foreach ($users as $user) {
             /** @var ModelsUser $user */
             $user->generateUUID($current_timestamp);
@@ -146,7 +146,7 @@ EOL;
         }
 
         if (strtolower($y) === 'y') {
-            $current_timestamp = time();
+            $current_timestamp = \time();
             // create admin user
             $configs = Setting::getClass('register');
             // do reg user
@@ -165,7 +165,7 @@ EOL;
             $user->invite_num = $configs['sign_up_for_invitation_codes'];
             $user->ref_by = 0;
             $user->is_admin = 1;
-            $user->expire_in = date('Y-m-d H:i:s', time() + $configs['sign_up_for_free_time'] * 86400);
+            $user->expire_in = date('Y-m-d H:i:s', \time() + $configs['sign_up_for_free_time'] * 86400);
             $user->reg_date = date('Y-m-d H:i:s');
             $user->money = 0;
             $user->im_type = 1;
@@ -196,7 +196,7 @@ EOL;
     {
         if (count($this->argv) === 4) {
             $user = ModelsUser::find($this->argv[3]);
-            $expire_in = 86400 + time();
+            $expire_in = 86400 + \time();
             echo Hash::cookieHash($user->pass, $expire_in) . ' ' . $expire_in;
         }
     }

+ 1 - 1
src/Controllers/Admin/AnnController.php

@@ -43,7 +43,7 @@ final class AnnController extends BaseController
         $query = Ann::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op'])) {
+                if (\in_array($order_field, ['op'])) {
                     $order_field = 'id';
                 }
             }

+ 1 - 1
src/Controllers/Admin/CodeController.php

@@ -47,7 +47,7 @@ final class CodeController extends BaseController
         $query = Code::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
             }

+ 1 - 1
src/Controllers/Admin/DetectBanLogController.php

@@ -44,7 +44,7 @@ final class DetectBanLogController extends BaseController
         $query = DetectBanLog::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['ban_end_time'])) {
+                if (\in_array($order_field, ['ban_end_time'])) {
                     $order_field = 'end_time';
                 }
             }

+ 4 - 4
src/Controllers/Admin/DetectController.php

@@ -41,7 +41,7 @@ final class DetectController extends BaseController
         $query = DetectRule::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op'])) {
+                if (\in_array($order_field, ['op'])) {
                     $order_field = 'id';
                 }
             }
@@ -197,13 +197,13 @@ final class DetectController extends BaseController
         $query = DetectLog::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['node_name'])) {
+                if (\in_array($order_field, ['node_name'])) {
                     $order_field = 'node_id';
                 }
-                if (in_array($order_field, ['rule_name', 'rule_text', 'rule_regex', 'rule_type'])) {
+                if (\in_array($order_field, ['rule_name', 'rule_text', 'rule_regex', 'rule_type'])) {
                     $order_field = 'list_id';
                 }
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'user_id';
                 }
             }

+ 11 - 11
src/Controllers/Admin/IpController.php

@@ -49,10 +49,10 @@ final class IpController extends BaseController
         $query = LoginIp::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'ip';
                 }
             }
@@ -121,18 +121,18 @@ final class IpController extends BaseController
         $query = Ip::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
-                if (in_array($order_field, ['node_name', 'is_node'])) {
+                if (\in_array($order_field, ['node_name', 'is_node'])) {
                     $order_field = 'nodeid';
                 }
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'ip';
                 }
             },
             static function ($query): void {
-                $query->where('datetime', '>=', time() - 60);
+                $query->where('datetime', '>=', \time() - 60);
             }
         );
 
@@ -193,10 +193,10 @@ final class IpController extends BaseController
         $query = BlockIp::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['node_name'])) {
+                if (\in_array($order_field, ['node_name'])) {
                     $order_field = 'nodeid';
                 }
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'ip';
                 }
             }
@@ -237,7 +237,7 @@ final class IpController extends BaseController
         $UIP = new UnblockIp();
         $UIP->userid = $this->user->id;
         $UIP->ip = $ip;
-        $UIP->datetime = time();
+        $UIP->datetime = \time();
         $UIP->save();
 
         return $response->withJson([
@@ -277,10 +277,10 @@ final class IpController extends BaseController
         $query = UnblockIp::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'ip';
                 }
             }

+ 2 - 2
src/Controllers/Admin/NodeController.php

@@ -307,10 +307,10 @@ final class NodeController extends BaseController
         $query = Node::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op'])) {
+                if (\in_array($order_field, ['op'])) {
                     $order_field = 'id';
                 }
-                if (in_array($order_field, ['outaddress'])) {
+                if (\in_array($order_field, ['outaddress'])) {
                     $order_field = 'server';
                 }
             }

+ 3 - 3
src/Controllers/Admin/SettingController.php

@@ -122,7 +122,7 @@ final class SettingController extends BaseController
             $setting = Setting::where('item', '=', $item)->first();
 
             if ($setting->type === 'array') {
-                $setting->value = json_encode($request->getParam("${item}"));
+                $setting->value = \json_encode($request->getParam("${item}"));
             } else {
                 $setting->value = $request->getParam("${item}");
             }
@@ -179,7 +179,7 @@ final class SettingController extends BaseController
     public function returnActiveGateways()
     {
         $payment_gateways = Setting::where('item', '=', 'payment_gateway')->first();
-        return json_decode($payment_gateways->value);
+        return \json_decode($payment_gateways->value);
     }
 
     public function payment($request, $response, $args)
@@ -193,7 +193,7 @@ final class SettingController extends BaseController
         }
 
         $gateway = Setting::where('item', '=', 'payment_gateway')->first();
-        $gateway->value = json_encode($gateway_in_use);
+        $gateway->value = \json_encode($gateway_in_use);
         $gateway->save();
 
         return $response->withJson([

+ 4 - 4
src/Controllers/Admin/ShopController.php

@@ -288,7 +288,7 @@ final class ShopController extends BaseController
         $query = Shop::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op', 'period_sales'])) {
+                if (\in_array($order_field, ['op', 'period_sales'])) {
                     $order_field = 'id';
                 }
             }
@@ -330,13 +330,13 @@ final class ShopController extends BaseController
         $query = Bought::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op'])) {
+                if (\in_array($order_field, ['op'])) {
                     $order_field = 'id';
                 }
-                if (in_array($order_field, ['content', 'auto_reset_bandwidth'])) {
+                if (\in_array($order_field, ['content', 'auto_reset_bandwidth'])) {
                     $order_field = 'shopid';
                 }
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
             }

+ 1 - 1
src/Controllers/Admin/SubscribeLogController.php

@@ -51,7 +51,7 @@ final class SubscribeLogController extends BaseController
         $query = UserSubscribeLog::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'request_ip';
                 }
             }

+ 4 - 4
src/Controllers/Admin/TicketController.php

@@ -66,7 +66,7 @@ final class TicketController extends BaseController
         $ticket->content = $antiXss->xss_clean($content);
         $ticket->rootid = 0;
         $ticket->userid = $userid;
-        $ticket->datetime = time();
+        $ticket->datetime = \time();
         $ticket->save();
 
         $user = User::find($userid);
@@ -124,7 +124,7 @@ final class TicketController extends BaseController
         $ticket->content = $antiXss->xss_clean($content);
         $ticket->rootid = $main->id;
         $ticket->userid = $this->user->id;
-        $ticket->datetime = time();
+        $ticket->datetime = \time();
         $ticket->save();
         $main->status = $status;
         $main->save();
@@ -171,10 +171,10 @@ final class TicketController extends BaseController
         $query = Ticket::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op'])) {
+                if (\in_array($order_field, ['op'])) {
                     $order_field = 'id';
                 }
-                if (in_array($order_field, ['user_name'])) {
+                if (\in_array($order_field, ['user_name'])) {
                     $order_field = 'userid';
                 }
             },

+ 5 - 5
src/Controllers/Admin/UserController.php

@@ -101,7 +101,7 @@ final class UserController extends BaseController
         $configs = Setting::getClass('register');
         // do reg user
         $user = new User();
-        $current_timestamp = time();
+        $current_timestamp = \time();
         $pass = Tools::genRandomChar();
         $user->user_name = $email;
         $user->email = $email;
@@ -127,11 +127,11 @@ final class UserController extends BaseController
         $user->auto_reset_day = Setting::obtain('free_user_reset_day');
         $user->auto_reset_bandwidth = Setting::obtain('free_user_reset_bandwidth');
         $user->money = ($money !== -1 ? $money : 0);
-        $user->class_expire = date('Y-m-d H:i:s', time() + $configs['sign_up_for_class_time'] * 86400);
+        $user->class_expire = date('Y-m-d H:i:s', \time() + $configs['sign_up_for_class_time'] * 86400);
         $user->class = $configs['sign_up_for_class'];
         $user->node_connector = $configs['connection_device_limit'];
         $user->node_speedlimit = $configs['connection_rate_limit'];
-        $user->expire_in = date('Y-m-d H:i:s', time() + $configs['sign_up_for_free_time'] * 86400);
+        $user->expire_in = date('Y-m-d H:i:s', \time() + $configs['sign_up_for_free_time'] * 86400);
         $user->reg_date = date('Y-m-d H:i:s');
         $user->reg_ip = $_SERVER['REMOTE_ADDR'];
         $user->theme = $_ENV['theme'];
@@ -156,7 +156,7 @@ final class UserController extends BaseController
                     $bought = new Bought();
                     $bought->userid = $user->id;
                     $bought->shopid = $shop->id;
-                    $bought->datetime = time();
+                    $bought->datetime = \time();
                     $bought->renew = 0;
                     $bought->coupon = '';
                     $bought->price = $shop->price;
@@ -302,7 +302,7 @@ final class UserController extends BaseController
         $adminid = $request->getParam('adminid');
         $user = User::find($userid);
         $admin = User::find($adminid);
-        $expire_in = time() + 60 * 60;
+        $expire_in = \time() + 60 * 60;
 
         if (! $admin->is_admin || ! $user || ! Auth::getUser()->isLogin) {
             return $response->withJson([

+ 3 - 3
src/Controllers/Admin/UserLog/BoughtLogController.php

@@ -55,10 +55,10 @@ final class BoughtLogController extends BaseController
         $query = Bought::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['op', 'reset_time', 'valid', 'exp_time'])) {
+                if (\in_array($order_field, ['op', 'reset_time', 'valid', 'exp_time'])) {
                     $order_field = 'id';
                 }
-                if (in_array($order_field, ['content', 'name'])) {
+                if (\in_array($order_field, ['content', 'name'])) {
                     $order_field = 'shopid';
                 }
             },
@@ -160,7 +160,7 @@ final class BoughtLogController extends BaseController
         $bought = new Bought();
         $bought->userid = $user->id;
         $bought->shopid = $shop->id;
-        $bought->datetime = time();
+        $bought->datetime = \time();
         $bought->renew = 0;
         $bought->coupon = '';
         $bought->price = $shop->price;

+ 2 - 2
src/Controllers/Admin/UserLog/DetectLogController.php

@@ -49,10 +49,10 @@ final class DetectLogController extends BaseController
         $query = DetectLog::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['node_name'])) {
+                if (\in_array($order_field, ['node_name'])) {
                     $order_field = 'node_id';
                 }
-                if (in_array($order_field, ['rule_name', 'rule_text', 'rule_regex', 'rule_type'])) {
+                if (\in_array($order_field, ['rule_name', 'rule_text', 'rule_regex', 'rule_type'])) {
                     $order_field = 'list_id';
                 }
             },

+ 1 - 1
src/Controllers/Admin/UserLog/LoginLogController.php

@@ -45,7 +45,7 @@ final class LoginLogController extends BaseController
         $query = LoginIp::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'ip';
                 }
             },

+ 1 - 1
src/Controllers/Admin/UserLog/SubLogController.php

@@ -47,7 +47,7 @@ final class SubLogController extends BaseController
         $query = UserSubscribeLog::getTableDataFromAdmin(
             $request,
             static function (&$order_field): void {
-                if (in_array($order_field, ['location'])) {
+                if (\in_array($order_field, ['location'])) {
                     $order_field = 'request_ip';
                 }
             },

+ 2 - 2
src/Controllers/AdminController.php

@@ -204,7 +204,7 @@ final class AdminController extends BaseController
     {
         $generate_type = (int) $request->getParam('generate_type');
         $final_code = $request->getParam('prefix');
-        if (! isset($final_code) && in_array($generate_type, [1, 3])) {
+        if (! isset($final_code) && \in_array($generate_type, [1, 3])) {
             return $response->withJson([
                 'ret' => 0,
                 'msg' => '优惠码不能为空',
@@ -233,7 +233,7 @@ final class AdminController extends BaseController
         $code = new Coupon();
         $code->onetime = $request->getParam('onetime');
         $code->code = $final_code;
-        $code->expire = time() + $request->getParam('expire') * 3600;
+        $code->expire = \time() + $request->getParam('expire') * 3600;
         $code->shop = $request->getParam('shop');
         $code->credit = $request->getParam('credit');
         $code->save();

+ 10 - 10
src/Controllers/AuthController.php

@@ -221,20 +221,20 @@ final class AuthController extends BaseController
                 return ResponseHelper::error($response, '此邮箱已经注册');
             }
             $ipcount = EmailVerify::where('ip', '=', $_SERVER['REMOTE_ADDR'])
-                ->where('expire_in', '>', time())
+                ->where('expire_in', '>', \time())
                 ->count();
             if ($ipcount >= Setting::obtain('email_verify_ip_limit')) {
                 return ResponseHelper::error($response, '此IP请求次数过多');
             }
             $mailcount = EmailVerify::where('email', '=', $email)
-                ->where('expire_in', '>', time())
+                ->where('expire_in', '>', \time())
                 ->count();
             if ($mailcount >= 3) {
                 return ResponseHelper::error($response, '此邮箱请求次数过多');
             }
             $code = Tools::genRandomChar(6);
             $ev = new EmailVerify();
-            $ev->expire_in = time() + Setting::obtain('email_verify_ttl');
+            $ev->expire_in = \time() + Setting::obtain('email_verify_ttl');
             $ev->ip = $_SERVER['REMOTE_ADDR'];
             $ev->email = $email;
             $ev->code = $code;
@@ -246,7 +246,7 @@ final class AuthController extends BaseController
                     'auth/verify.tpl',
                     [
                         'code' => $code,
-                        'expire' => date('Y-m-d H:i:s', time() + Setting::obtain('email_verify_ttl')),
+                        'expire' => date('Y-m-d H:i:s', \time() + Setting::obtain('email_verify_ttl')),
                     ],
                     []
                 );
@@ -293,7 +293,7 @@ final class AuthController extends BaseController
         // do reg user
         $user = new User();
         $antiXss = new AntiXSS();
-        $current_timestamp = time();
+        $current_timestamp = \time();
 
         $user->user_name = $antiXss->xss_clean($name);
         $user->email = $email;
@@ -346,11 +346,11 @@ final class AuthController extends BaseController
         $secret = $ga->createSecret();
         $user->ga_token = $secret;
         $user->ga_enable = 0;
-        $user->class_expire = date('Y-m-d H:i:s', time() + $configs['sign_up_for_class_time'] * 86400);
+        $user->class_expire = date('Y-m-d H:i:s', \time() + $configs['sign_up_for_class_time'] * 86400);
         $user->class = $configs['sign_up_for_class'];
         $user->node_connector = $configs['connection_device_limit'];
         $user->node_speedlimit = $configs['connection_rate_limit'];
-        $user->expire_in = date('Y-m-d H:i:s', time() + $configs['sign_up_for_free_time'] * 86400);
+        $user->expire_in = date('Y-m-d H:i:s', \time() + $configs['sign_up_for_free_time'] * 86400);
         $user->reg_date = date('Y-m-d H:i:s');
         $user->reg_ip = $_SERVER['REMOTE_ADDR'];
         $user->theme = $_ENV['theme'];
@@ -425,7 +425,7 @@ final class AuthController extends BaseController
             $email_code = trim($request->getParam('emailcode'));
             $mailcount = EmailVerify::where('email', '=', $email)
                 ->where('code', '=', $email_code)
-                ->where('expire_in', '>', time())
+                ->where('expire_in', '>', \time())
                 ->first();
             if ($mailcount === null) {
                 return ResponseHelper::error($response, '您的邮箱验证码不正确');
@@ -530,12 +530,12 @@ final class AuthController extends BaseController
         }
         sort($data_check_arr);
         $data_check_string = implode("\n", $data_check_arr);
-        $secret_key = hash('sha256', $bot_token, true);
+        $secret_key = \hash('sha256', $bot_token, true);
         $hash = hash_hmac('sha256', $data_check_string, $secret_key);
         if (strcmp($hash, $check_hash) !== 0) {
             return false; // Bad Data :(
         }
-        if (time() - $auth_data['auth_date'] > 300) { // Expire @ 5mins
+        if (\time() - $auth_data['auth_date'] > 300) { // Expire @ 5mins
             return false;
         }
         return true; // Good to Go

+ 9 - 9
src/Controllers/LinkController.php

@@ -156,7 +156,7 @@ final class LinkController extends BaseController
                     } else {
                         $SubscribeExtend = self::getSubscribeExtend($key, $query_value);
                     }
-                    $filename = $SubscribeExtend['filename'] . '_' . time() . '.' . $SubscribeExtend['suffix'];
+                    $filename = $SubscribeExtend['filename'] . '_' . \time() . '.' . $SubscribeExtend['suffix'];
                     $subscribe_type = $SubscribeExtend['filename'];
 
                     $class = 'get' . $SubscribeExtend['class'];
@@ -220,7 +220,7 @@ final class LinkController extends BaseController
                     3 => 'v2rayn',
                     4 => 'trojan',
                 ];
-                $str = (! in_array($value, $strArray) ? $strArray[$value] : $strArray[1]);
+                $str = (! \in_array($value, $strArray) ? $strArray[$value] : $strArray[1]);
                 $return = self::getSubscribeExtend($str);
                 break;
             case 'clash':
@@ -505,7 +505,7 @@ final class LinkController extends BaseController
         }
         switch ($list) {
             case 'ssa':
-                return json_encode($return, 320);
+                return \json_encode($return, 320);
                 break;
             case 'clash':
                 return \Symfony\Component\Yaml\Yaml::dump(['proxies' => $return], 4, 2);
@@ -522,7 +522,7 @@ final class LinkController extends BaseController
     {
         $return = [];
         $info_array = (count($_ENV['sub_message']) !== 0 ? (array) $_ENV['sub_message'] : []);
-        if (strtotime($user->expire_in) > time()) {
+        if (strtotime($user->expire_in) > \time()) {
             if ($user->transfer_enable === 0) {
                 $unusedTraffic = '剩余流量:0';
             } else {
@@ -539,7 +539,7 @@ final class LinkController extends BaseController
             $unusedTraffic = '账户已过期,请续费后使用';
             $expire_in = '账户已过期,请续费后使用';
         }
-        if (! in_array($list, ['quantumult', 'quantumultx', 'shadowrocket'])) {
+        if (! \in_array($list, ['quantumult', 'quantumultx', 'shadowrocket'])) {
             $info_array[] = $unusedTraffic;
             $info_array[] = $expire_in;
         }
@@ -571,7 +571,7 @@ final class LinkController extends BaseController
         }
         foreach ($info_array as $remark) {
             $Extend['remark'] = $remark;
-            if (in_array($list, ['kitsunebi', 'quantumult', 'v2rayn'])) {
+            if (\in_array($list, ['kitsunebi', 'quantumult', 'v2rayn'])) {
                 $Extend['type'] = 'vmess';
                 $out = self::getListItem($Extend, $list);
             } elseif ($list === 'trojan') {
@@ -615,7 +615,7 @@ final class LinkController extends BaseController
             }
         }
         $variable = ($surge === 2 ? 'Surge2_Profiles' : 'Surge_Profiles');
-        if (isset($opts['profiles']) && in_array($opts['profiles'], array_keys($_ENV[$variable]))) {
+        if (isset($opts['profiles']) && \in_array($opts['profiles'], array_keys($_ENV[$variable]))) {
             $Profiles = $opts['profiles'];
         } else {
             $Profiles = ($surge === 2 ? $_ENV['Surge2_DefaultProfiles'] : $_ENV['Surge_DefaultProfiles']);
@@ -721,7 +721,7 @@ final class LinkController extends BaseController
                 $All_Proxy .= $out . PHP_EOL;
             }
         }
-        if (isset($opts['profiles']) && in_array($opts['profiles'], array_keys($_ENV['Surfboard_Profiles']))) {
+        if (isset($opts['profiles']) && \in_array($opts['profiles'], array_keys($_ENV['Surfboard_Profiles']))) {
             $Profiles = $opts['profiles'];
         } else {
             $Profiles = $_ENV['Surfboard_DefaultProfiles']; // 默认策略组
@@ -748,7 +748,7 @@ final class LinkController extends BaseController
                 $Proxys[] = $Proxy;
             }
         }
-        if (isset($opts['profiles']) && in_array($opts['profiles'], array_keys($_ENV['Clash_Profiles']))) {
+        if (isset($opts['profiles']) && \in_array($opts['profiles'], array_keys($_ENV['Clash_Profiles']))) {
             $Profiles = $opts['profiles'];
         } else {
             $Profiles = $_ENV['Clash_DefaultProfiles']; // 默认策略组

+ 3 - 3
src/Controllers/Node/FuncController.php

@@ -54,7 +54,7 @@ final class FuncController extends BaseController
      */
     public function getBlockip(Request $request, Response $response, array $args): ResponseInterface
     {
-        $block_ips = BlockIp::Where('datetime', '>', time() - 60)->get();
+        $block_ips = BlockIp::Where('datetime', '>', \time() - 60)->get();
 
         $res = [
             'ret' => 1,
@@ -75,7 +75,7 @@ final class FuncController extends BaseController
      */
     public function getUnblockip(Request $request, Response $response, array $args): ResponseInterface
     {
-        $unblock_ips = UnblockIp::Where('datetime', '>', time() - 60)->get();
+        $unblock_ips = UnblockIp::Where('datetime', '>', \time() - 60)->get();
 
         $res = [
             'ret' => 1,
@@ -125,7 +125,7 @@ final class FuncController extends BaseController
                 $ip_block = new BlockIp();
                 $ip_block->ip = $ip;
                 $ip_block->nodeid = $node_id;
-                $ip_block->datetime = time();
+                $ip_block->datetime = \time();
                 $ip_block->save();
             }
         }

+ 8 - 8
src/Controllers/Node/NodeController.php

@@ -24,22 +24,22 @@ final class NodeController extends BaseController
         // $request_ip = $_SERVER["REMOTE_ADDR"];
         $node_id = $request->getParam('node_id');
         $content = $request->getParam('content');
-        $result = json_decode(base64_decode($content), true);
+        $result = \json_decode(base64_decode($content), true);
 
         /* $node = Node::where('node_ip', $request_ip)->first();
         if ($node != null) {
             $report = new StreamMedia;
             $report->node_id = $node->id;
-            $report->result = json_encode($result);
-            $report->created_at = time();
+            $report->result = \json_encode($result);
+            $report->created_at = \time();
             $report->save();
             die('ok');
         } */
 
         $report = new StreamMedia();
         $report->node_id = $node_id;
-        $report->result = json_encode($result);
-        $report->created_at = time();
+        $report->result = \json_encode($result);
+        $report->created_at = \time();
         $report->save();
         die('ok');
     }
@@ -60,7 +60,7 @@ final class NodeController extends BaseController
         $log->node_id = $node_id;
         $log->load = $load;
         $log->uptime = $uptime;
-        $log->log_time = time();
+        $log->log_time = \time();
         if (! $log->save()) {
             $res = [
                 'ret' => 0,
@@ -92,7 +92,7 @@ final class NodeController extends BaseController
             ];
             return $response->withJson($res);
         }
-        if (in_array($node->sort, [0])) {
+        if (\in_array($node->sort, [0])) {
             $node_explode = explode(';', $node->server);
             $node_server = $node_explode[0];
         } else {
@@ -106,7 +106,7 @@ final class NodeController extends BaseController
             'mu_only' => $node->mu_only,
             'sort' => $node->sort,
             'server' => $node_server,
-            'custom_config' => json_decode($node->custom_config, true, JSON_UNESCAPED_SLASHES),
+            'custom_config' => \json_decode($node->custom_config, true, JSON_UNESCAPED_SLASHES),
             'type' => 'SSPanel-UIM',
             'version' => VERSION,
         ];

+ 15 - 21
src/Controllers/Node/UserController.php

@@ -17,12 +17,6 @@ use Psr\Http\Message\ResponseInterface;
 use Slim\Http\Request;
 use Slim\Http\Response;
 
-use function in_array;
-use function is_array;
-use function json_decode;
-use function json_encode;
-use function time;
-
 final class UserController extends BaseController
 {
     /**
@@ -48,7 +42,7 @@ final class UserController extends BaseController
                 ]);
             }
         }
-        $node->update(['node_heartbeat' => time()]);
+        $node->update(['node_heartbeat' => \time()]);
 
         if (($node->node_bandwidth_limit !== 0) && $node->node_bandwidth_limit < $node->node_bandwidth) {
             return $response->withJson([
@@ -57,7 +51,7 @@ final class UserController extends BaseController
             ]);
         }
 
-        if (in_array($node->sort, [0, 10]) && $node->mu_only !== -1) {
+        if (\in_array($node->sort, [0, 10]) && $node->mu_only !== -1) {
             $mu_port_migration = $_ENV['mu_port_migration'];
             $muPort = Tools::getMutilUserOutPortArray($node);
         } else {
@@ -74,7 +68,7 @@ final class UserController extends BaseController
             })
             ->get();
 
-        if (in_array($node->sort, [11, 14])) {
+        if (\in_array($node->sort, [11, 14])) {
             $key_list = ['node_speedlimit', 'id', 'node_connector', 'uuid', 'alive_ip'];
         } else {
             $key_list = [
@@ -100,7 +94,7 @@ final class UserController extends BaseController
             if ($mu_port_migration === true && $user_raw->is_multi_user !== 0) {
                 // 下发偏移后端口
                 if ($muPort['type'] === 0) {
-                    if (in_array($user_raw->port, array_keys($muPort['port']))) {
+                    if (\in_array($user_raw->port, array_keys($muPort['port']))) {
                         $user_raw->port = $muPort['port'][$user_raw->port]['backend'];
                     }
                 } else {
@@ -111,7 +105,7 @@ final class UserController extends BaseController
             $users[] = $user_raw;
         }
 
-        $body = json_encode([
+        $body = \json_encode([
             'ret' => 1,
             'data' => $users,
         ]);
@@ -137,8 +131,8 @@ final class UserController extends BaseController
      */
     public function addTraffic($request, $response, $args)
     {
-        $data = json_decode($request->getBody()->__toString());
-        if (!$data || !is_array($data?->data)) {
+        $data = \json_decode($request->getBody()->__toString());
+        if (!$data || !\is_array($data?->data)) {
             return $response->withJson([
                 'ret' => 1,
                 'data' => 'ok',
@@ -166,7 +160,7 @@ final class UserController extends BaseController
             $user_id = (int) $log?->user_id;
             if ($user_id) {
                 User::where('id', $user_id)->update([
-                    't' => time(),
+                    't' => \time(),
                     'u' => DB::raw("u + ${u}"),
                     'd' => DB::raw("d + ${d}"),
                 ]);
@@ -178,7 +172,7 @@ final class UserController extends BaseController
         NodeOnlineLog::insert([
             'node_id' => $node_id,
             'online_user' => count($data),
-            'log_time' => time(),
+            'log_time' => \time(),
         ]);
 
         return $response->withJson([
@@ -198,8 +192,8 @@ final class UserController extends BaseController
      */
     public function addAliveIp($request, $response, $args)
     {
-        $data = json_decode($request->getBody()->__toString());
-        if (!$data || !is_array($data?->data)) {
+        $data = \json_decode($request->getBody()->__toString());
+        if (!$data || !\is_array($data?->data)) {
             return $response->withJson([
                 'ret' => 1,
                 'data' => 'ok',
@@ -228,7 +222,7 @@ final class UserController extends BaseController
                 'userid' => $userid,
                 'nodeid' => $node_id,
                 'ip' => $ip,
-                'datetime' => time(),
+                'datetime' => \time(),
             ]);
         }
 
@@ -249,8 +243,8 @@ final class UserController extends BaseController
      */
     public function addDetectLog($request, $response, $args)
     {
-        $data = json_decode($request->getBody()->__toString());
-        if (!$data || !is_array($data?->data)) {
+        $data = \json_decode($request->getBody()->__toString());
+        if (!$data || !\is_array($data?->data)) {
             return $response->withJson([
                 'ret' => 1,
                 'data' => 'ok',
@@ -279,7 +273,7 @@ final class UserController extends BaseController
                 'user_id' => $user_id,
                 'list_id' => $list_id,
                 'node_id' => $node_id,
-                'datetime' => time(),
+                'datetime' => \time(),
             ]);
         }
 

+ 3 - 3
src/Controllers/PasswordController.php

@@ -53,7 +53,7 @@ final class PasswordController extends BaseController
      */
     public function token(Request $request, Response $response, array $args)
     {
-        $token = PasswordReset::where('token', $args['token'])->where('expire_time', '>', time())->orderBy('id', 'desc')->first();
+        $token = PasswordReset::where('token', $args['token'])->where('expire_time', '>', \time())->orderBy('id', 'desc')->first();
         if ($token === null) {
             return $response->withStatus(302)->withHeader('Location', '/password/reset');
         }
@@ -80,7 +80,7 @@ final class PasswordController extends BaseController
         }
 
         /** @var PasswordReset $token */
-        $token = PasswordReset::where('token', $tokenStr)->where('expire_time', '>', time())->orderBy('id', 'desc')->first();
+        $token = PasswordReset::where('token', $tokenStr)->where('expire_time', '>', \time())->orderBy('id', 'desc')->first();
         if ($token === null) {
             return ResponseHelper::error($response, '链接已经失效,请重新获取');
         }
@@ -104,7 +104,7 @@ final class PasswordController extends BaseController
         }
 
         // 禁止链接多次使用
-        $token->expire_time = time();
+        $token->expire_time = \time();
         $token->save();
 
         return ResponseHelper::successfully($response, '重置成功');

+ 7 - 7
src/Controllers/SubController.php

@@ -41,7 +41,7 @@ final class SubController extends BaseController
         }
 
         $subtype_list = ['all', 'ss', 'ssr', 'v2ray', 'trojan'];
-        if (! in_array($subtype, $subtype_list)) {
+        if (! \in_array($subtype, $subtype_list)) {
             return $response->withJson([
                 'ret' => 0,
             ]);
@@ -58,7 +58,7 @@ final class SubController extends BaseController
             ->get();
 
         foreach ($nodes_raw as $node_raw) {
-            $node_custom_config = json_decode($node_raw->custom_config, true);
+            $node_custom_config = \json_decode($node_raw->custom_config, true);
             //檢查是否配置“前端/订阅中下发的服务器地址”
             if (! array_key_exists('server_user', $node_custom_config)) {
                 $server = $node_raw->server;
@@ -68,7 +68,7 @@ final class SubController extends BaseController
             switch ($node_raw->sort) {
                 case '0':
                     //只給下發正確類型的節點
-                    if (! in_array($subtype, ['ss', 'all'])) {
+                    if (! \in_array($subtype, ['ss', 'all'])) {
                         $node = null;
                         break;
                     }
@@ -90,7 +90,7 @@ final class SubController extends BaseController
                     break;
                     //單獨加了一種SSR節點類型用來同時處理多端口和單端口SSR的訂閲下發
                 case '1':
-                    if (! in_array($subtype, ['ssr', 'all'])) {
+                    if (! \in_array($subtype, ['ssr', 'all'])) {
                         $node = null;
                         break;
                     }
@@ -137,7 +137,7 @@ final class SubController extends BaseController
                     }
                     break;
                 case '11':
-                    if (! in_array($subtype, ['v2ray', 'all'])) {
+                    if (! \in_array($subtype, ['v2ray', 'all'])) {
                         $node = null;
                         break;
                     }
@@ -153,7 +153,7 @@ final class SubController extends BaseController
                     $host = $node_custom_config['host'] ?? '';
                     $servicename = $node_custom_config['servicename'] ?? '';
                     $path = $node_custom_config['path'] ?? '/';
-                    $tls = in_array($security, ['tls', 'xtls']) ? '1' : '0';
+                    $tls = \in_array($security, ['tls', 'xtls']) ? '1' : '0';
                     $enable_vless = $node_custom_config['enable_vless'] ?? '0';
                     $node = [
                         'name' => $node_raw->name,
@@ -178,7 +178,7 @@ final class SubController extends BaseController
                     ];
                     break;
                 case '14':
-                    if (! in_array($subtype, ['trojan', 'all'])) {
+                    if (! \in_array($subtype, ['trojan', 'all'])) {
                         $node = null;
                         break;
                     }

+ 1 - 1
src/Controllers/User/NodeController.php

@@ -52,7 +52,7 @@ final class NodeController extends BaseController
             $array_node['bandwidth'] = $node->getNodeSpeedlimit();
 
             $all_connect = [];
-            if (in_array($node->sort, [0])) {
+            if (\in_array($node->sort, [0])) {
                 if ($node->mu_only !== 1) {
                     $all_connect[] = 0;
                 }

+ 4 - 4
src/Controllers/User/ShopController.php

@@ -117,7 +117,7 @@ final class ShopController extends BaseController
             if ($coupon->order($shop->id) === false) {
                 return ResponseHelper::error($response, '此优惠码不适用于此商品');
             }
-            if ($coupon->expire < time()) {
+            if ($coupon->expire < \time()) {
                 return ResponseHelper::error($response, '此优惠码已过期');
             }
             if ($coupon->onetime > 0) {
@@ -148,11 +148,11 @@ final class ShopController extends BaseController
         $bought = new Bought();
         $bought->userid = $user->id;
         $bought->shopid = $shop->id;
-        $bought->datetime = time();
+        $bought->datetime = \time();
         if ($autorenew === 0 || $shop->auto_renew === 0) {
             $bought->renew = 0;
         } else {
-            $bought->renew = time() + $shop->auto_renew * 86400;
+            $bought->renew = \time() + $shop->auto_renew * 86400;
         }
         $bought->coupon = $coupon_code;
         $bought->price = $price;
@@ -200,7 +200,7 @@ final class ShopController extends BaseController
         $bought = new Bought();
         $bought->userid = $user->id;
         $bought->shopid = $shop->id;
-        $bought->datetime = time();
+        $bought->datetime = \time();
         $bought->renew = 0;
         $bought->coupon = 0;
         $bought->price = $price;

+ 2 - 2
src/Controllers/User/TicketController.php

@@ -77,7 +77,7 @@ final class TicketController extends BaseController
         $ticket->content = $antiXss->xss_clean($content);
         $ticket->rootid = 0;
         $ticket->userid = $this->user->id;
-        $ticket->datetime = time();
+        $ticket->datetime = \time();
         $ticket->save();
 
         if ($_ENV['mail_ticket'] === true && $markdown !== '') {
@@ -203,7 +203,7 @@ final class TicketController extends BaseController
         $ticket->content = $antiXss->xss_clean($content);
         $ticket->rootid = $ticket_main->id;
         $ticket->userid = $this->user->id;
-        $ticket->datetime = time();
+        $ticket->datetime = \time();
         $ticket_main->status = $status;
 
         $ticket_main->save();

+ 16 - 16
src/Controllers/UserController.php

@@ -63,8 +63,8 @@ final class UserController extends BaseController
                 }
             }
             $getClient->user_id = $this->user->id;
-            $getClient->create_time = time();
-            $getClient->expire_time = time() + 10 * 60;
+            $getClient->create_time = \time();
+            $getClient->expire_time = \time() + 10 * 60;
             $getClient->save();
         } else {
             $token = '';
@@ -249,8 +249,8 @@ final class UserController extends BaseController
         }
 
         if ($codeq->type === 10002) {
-            if (time() > strtotime($user->expire_in)) {
-                $user->expire_in = date('Y-m-d H:i:s', time() + $codeq->number * 86400);
+            if (\time() > strtotime($user->expire_in)) {
+                $user->expire_in = date('Y-m-d H:i:s', \time() + $codeq->number * 86400);
             } else {
                 $user->expire_in = date('Y-m-d H:i:s', strtotime($user->expire_in) + $codeq->number * 86400);
             }
@@ -259,7 +259,7 @@ final class UserController extends BaseController
 
         if ($codeq->type >= 1 && $codeq->type <= 10000) {
             if ($user->class === 0 || $user->class !== $codeq->type) {
-                $user->class_expire = date('Y-m-d H:i:s', time());
+                $user->class_expire = date('Y-m-d H:i:s', \time());
                 $user->save();
             }
             $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $codeq->number * 86400);
@@ -374,7 +374,7 @@ final class UserController extends BaseController
         // 使用IP
         $userip = [];
         $iplocation = new QQWry();
-        $total = Ip::where('datetime', '>=', time() - 300)->where('userid', '=', $this->user->id)->get();
+        $total = Ip::where('datetime', '>=', \time() - 300)->where('userid', '=', $this->user->id)->get();
         foreach ($total as $single) {
             $single->ip = Tools::getRealIp($single->ip);
             $is_node = Node::where('node_ip', $single->ip)->first();
@@ -444,11 +444,11 @@ final class UserController extends BaseController
 
             $unlock = StreamMedia::where('node_id', $node_id)
                 ->orderBy('id', 'desc')
-                ->where('created_at', '>', time() - 86460) // 只获取最近一天零一分钟内上报的数据
+                ->where('created_at', '>', \time() - 86460) // 只获取最近一天零一分钟内上报的数据
                 ->first();
 
             if ($unlock !== null && $node !== null) {
-                $details = json_decode($unlock->result, true);
+                $details = \json_decode($unlock->result, true);
                 $details = str_replace('Originals Only', '仅限自制', $details);
                 $details = str_replace('Oversea Only', '仅限海外', $details);
 
@@ -469,11 +469,11 @@ final class UserController extends BaseController
                 $key_node = Node::where('id', $key)->first();
                 $value_node = StreamMedia::where('node_id', $value)
                     ->orderBy('id', 'desc')
-                    ->where('created_at', '>', time() - 86460) // 只获取最近一天零一分钟内上报的数据
+                    ->where('created_at', '>', \time() - 86460) // 只获取最近一天零一分钟内上报的数据
                     ->first();
 
                 if ($value_node !== null) {
-                    $details = json_decode($value_node->result, true);
+                    $details = \json_decode($value_node->result, true);
                     $details = str_replace('Originals Only', '仅限自制', $details);
                     $details = str_replace('Oversea Only', '仅限海外', $details);
 
@@ -685,7 +685,7 @@ final class UserController extends BaseController
 
         if (Setting::obtain('reg_email_verify')) {
             $emailcode = $request->getParam('emailcode');
-            $mailcount = EmailVerify::where('email', '=', $newemail)->where('code', '=', $emailcode)->where('expire_in', '>', time())->first();
+            $mailcount = EmailVerify::where('email', '=', $newemail)->where('code', '=', $emailcode)->where('expire_in', '>', \time())->first();
             if ($mailcount === null) {
                 return ResponseHelper::error($response, '您的邮箱验证码不正确');
             }
@@ -756,7 +756,7 @@ final class UserController extends BaseController
         $UIP = new UnblockIp();
         $UIP->userid = $user->id;
         $UIP->ip = $_SERVER['REMOTE_ADDR'];
-        $UIP->datetime = time();
+        $UIP->datetime = \time();
         $UIP->save();
 
         return ResponseHelper::successfully($response, $_SERVER['REMOTE_ADDR']);
@@ -934,7 +934,7 @@ final class UserController extends BaseController
     public function updateMail(Request $request, Response $response, array $args)
     {
         $value = (int) $request->getParam('mail');
-        if (in_array($value, [0, 1, 2])) {
+        if (\in_array($value, [0, 1, 2])) {
             $user = $this->user;
             if ($value === 2 && $_ENV['enable_telegram'] === false) {
                 return ResponseHelper::error(
@@ -956,7 +956,7 @@ final class UserController extends BaseController
     {
         $user = $this->user;
         $pwd = Tools::genRandomChar(16);
-        $current_timestamp = time();
+        $current_timestamp = \time();
         $new_uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, $user->email . '|' . $current_timestamp);
         $existing_uuid = User::where('uuid', $new_uuid)->first();
 
@@ -1008,7 +1008,7 @@ final class UserController extends BaseController
             }
         }
 
-        if (strtotime($this->user->expire_in) < time()) {
+        if (strtotime($this->user->expire_in) < \time()) {
             return ResponseHelper::error($response, '没有过期的账户才可以签到');
         }
 
@@ -1122,7 +1122,7 @@ final class UserController extends BaseController
                 'old_ip' => null,
                 'old_expire_in' => null,
                 'old_local' => null,
-            ], time() - 1000);
+            ], \time() - 1000);
         }
         $expire_in = Cookie::get('old_expire_in');
         $local = Cookie::get('old_local');

+ 1 - 1
src/Middleware/Auth.php

@@ -15,7 +15,7 @@ final class Auth
             return $response->withStatus(302)->withHeader('Location', '/auth/login');
         }
         $enablePages = ['/user/disable', '/user/backtoadmin', '/user/logout'];
-        if ($user->enable === 0 && ! in_array($_SERVER['REQUEST_URI'], $enablePages)) {
+        if ($user->enable === 0 && ! \in_array($_SERVER['REQUEST_URI'], $enablePages)) {
             return $response->withStatus(302)->withHeader('Location', '/user/disable');
         }
         return $next($request, $response);

+ 1 - 1
src/Middleware/NodeToken.php

@@ -32,7 +32,7 @@ final class NodeToken
             ]);
         }
 
-        if (!in_array($key, Config::getMuKey())) {
+        if (!\in_array($key, Config::getMuKey())) {
             // key 不存在
             return $response->withJson([
                 'ret' => 0,

+ 4 - 4
src/Models/Bought.php

@@ -112,7 +112,7 @@ final class Bought extends Model
      */
     public function usedDays(): int
     {
-        return (int) ((time() - $this->datetime) / 86400);
+        return (int) ((\time() - $this->datetime) / 86400);
     }
 
     /*
@@ -122,7 +122,7 @@ final class Bought extends Model
     {
         $shop = $this->shop();
         if ($shop->useLoop()) {
-            return time() - $shop->resetExp() * 86400 < $this->datetime;
+            return \time() - $shop->resetExp() * 86400 < $this->datetime;
         }
         return false;
     }
@@ -135,9 +135,9 @@ final class Bought extends Model
         $shop = $this->shop();
         if ($shop->useLoop()) {
             $day = 24 * 60 * 60;
-            $resetIndex = 1 + (int) ((time() - $this->datetime - $day) / ($shop->reset() * $day));
+            $resetIndex = 1 + (int) ((\time() - $this->datetime - $day) / ($shop->reset() * $day));
             $restTime = $resetIndex * $shop->reset() * $day + $this->datetime;
-            $time = time() + ($day * 86400);
+            $time = \time() + ($day * 86400);
             return ! $unix ? date('Y-m-d', strtotime('+1 day', strtotime(date('Y-m-d', $restTime)))) : $time;
         }
         return ! $unix ? '-' : 0;

+ 12 - 12
src/Models/Node.php

@@ -141,7 +141,7 @@ final class Node extends Model
 
     public function getNodeUpRate()
     {
-        $log = NodeOnlineLog::where('node_id', $this->id)->where('log_time', '>=', time() - 86400)->count();
+        $log = NodeOnlineLog::where('node_id', $this->id)->where('log_time', '>=', \time() - 86400)->count();
         return $log / 1440;
     }
 
@@ -160,10 +160,10 @@ final class Node extends Model
      */
     public function getNodeOnlineUserCount(): int
     {
-        if (in_array($this->sort, [9])) {
+        if (\in_array($this->sort, [9])) {
             return -1;
         }
-        $log = NodeOnlineLog::where('node_id', $this->id)->where('log_time', '>', time() - 300)->orderBy('id', 'desc')->first();
+        $log = NodeOnlineLog::where('node_id', $this->id)->where('log_time', '>', \time() - 300)->orderBy('id', 'desc')->first();
         if ($log === null) {
             return 0;
         }
@@ -178,10 +178,10 @@ final class Node extends Model
     public function getNodeOnlineStatus(): int
     {
         // 类型 9 或者心跳为 0
-        if ($this->node_heartbeat === 0 || in_array($this->sort, [9])) {
+        if ($this->node_heartbeat === 0 || \in_array($this->sort, [9])) {
             return 0;
         }
-        return $this->node_heartbeat + 300 > time() ? 1 : -1;
+        return $this->node_heartbeat + 300 > \time() ? 1 : -1;
     }
 
     /**
@@ -189,7 +189,7 @@ final class Node extends Model
      */
     public function getNodeLatestLoad(): int
     {
-        $log = NodeInfoLog::where('node_id', $this->id)->where('log_time', '>', time() - 300)->orderBy('id', 'desc')->first();
+        $log = NodeInfoLog::where('node_id', $this->id)->where('log_time', '>', \time() - 300)->orderBy('id', 'desc')->first();
         if ($log === null) {
             return -1;
         }
@@ -227,7 +227,7 @@ final class Node extends Model
         if ($this->node_heartbeat === 0) {
             return false;
         }
-        return $this->node_heartbeat > time() - 300;
+        return $this->node_heartbeat > \time() - 300;
     }
 
     /**
@@ -283,14 +283,14 @@ final class Node extends Model
 
     public function getArgs(): array
     {
-        return json_decode($this->custom_config, true);
+        return \json_decode($this->custom_config, true);
     }
 
     public function setArgs(string $key, mixed $value): void
     {
-        $current = json_decode($this->custom_config);
+        $current = \json_decode($this->custom_config);
         $current[$key] = $value;
-        $this->custom_config = json_encode($current);
+        $this->custom_config = \json_encode($current);
         $this->save();
     }
 
@@ -307,7 +307,7 @@ final class Node extends Model
         $explode = explode(';', $this->server);
         $values = $this->getArgs();
 
-        if (in_array($this->sort, [0]) && isset($values['server'])) {
+        if (\in_array($this->sort, [0]) && isset($values['server'])) {
             return $values['server'];
         }
         return $explode[0];
@@ -405,7 +405,7 @@ final class Node extends Model
     {
         $return_array = Tools::ssv2Array($this);
         // 非 AEAD 加密无法使用
-        if ($return_array['net'] !== 'obfs' && ! in_array($user->method, Config::getSupportParam('ss_aead_method'))) {
+        if ($return_array['net'] !== 'obfs' && ! \in_array($user->method, Config::getSupportParam('ss_aead_method'))) {
             return null;
         }
         $return_array['remark'] = $this->name;

+ 2 - 2
src/Models/Payback.php

@@ -54,7 +54,7 @@ final class Payback extends Model
                 self::executeRebate($user_id, $gift_user_id, $order_amount);
             }
         } elseif ($invite_rebate_mode === 'limit_time_range') {
-            if (strtotime($user->reg_date) + $configs['rebate_time_range_limit'] * 86400 > time()) {
+            if (strtotime($user->reg_date) + $configs['rebate_time_range_limit'] * 86400 > \time()) {
                 self::executeRebate($user_id, $gift_user_id, $order_amount);
             }
         }
@@ -74,7 +74,7 @@ final class Payback extends Model
             $Payback->userid = $user_id;
             $Payback->ref_by = $gift_user_id;
             $Payback->ref_get = $adjust_rebate ?? $rebate_amount;
-            $Payback->datetime = time();
+            $Payback->datetime = \time();
             $Payback->save();
         }
     }

+ 5 - 5
src/Models/Shop.php

@@ -160,8 +160,8 @@ final class Shop extends Model
                     }
                     break;
                 case 'expire':
-                    if (time() > strtotime($user->expire_in)) {
-                        $user->expire_in = date('Y-m-d H:i:s', time() + $value * 86400);
+                    if (\time() > strtotime($user->expire_in)) {
+                        $user->expire_in = date('Y-m-d H:i:s', \time() + $value * 86400);
                     } else {
                         $user->expire_in = date('Y-m-d H:i:s', strtotime($user->expire_in) + $value * 86400);
                     }
@@ -171,12 +171,12 @@ final class Shop extends Model
                         if ($user->class === $value) {
                             $user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $this->content['class_expire'] * 86400);
                         } else {
-                            $user->class_expire = date('Y-m-d H:i:s', time() + $this->content['class_expire'] * 86400);
+                            $user->class_expire = date('Y-m-d H:i:s', \time() + $this->content['class_expire'] * 86400);
                         }
                         $user->class = $value;
                     } else {
                         $user->class = $value;
-                        $user->class_expire = date('Y-m-d H:i:s', time() + $this->content['class_expire'] * 86400);
+                        $user->class_expire = date('Y-m-d H:i:s', \time() + $this->content['class_expire'] * 86400);
                         break;
                     }
                     // no break
@@ -210,7 +210,7 @@ final class Shop extends Model
         if ($period === 'expire') {
             $period = $this->content['class_expire'];
         }
-        return Bought::where('shopid', $this->id)->where('datetime', '>', time() - $period * 86400)->count();
+        return Bought::where('shopid', $this->id)->where('datetime', '>', \time() - $period * 86400)->count();
     }
 
     /*

+ 7 - 7
src/Models/User.php

@@ -414,7 +414,7 @@ final class User extends Model
     public function onlineIpCount(): int
     {
         // 根据 IP 分组去重
-        $total = Ip::where('datetime', '>=', time() - 90)->where('userid', $this->id)->orderBy('userid', 'desc')->groupBy('ip')->get();
+        $total = Ip::where('datetime', '>=', \time() - 90)->where('userid', $this->id)->orderBy('userid', 'desc')->groupBy('ip')->get();
         $ip_list = [];
         foreach ($total as $single_record) {
             $ip = Tools::getRealIp($single_record->ip);
@@ -562,7 +562,7 @@ final class User extends Model
         } else {
             $traffic = random_int((int) $_ENV['checkinMin'], (int) $_ENV['checkinMax']);
             $this->transfer_enable += Tools::toMB($traffic);
-            $this->last_check_in_time = time();
+            $this->last_check_in_time = \time();
             $this->save();
             $return['msg'] = '获得了 ' . $traffic . 'MB 流量.';
         }
@@ -694,7 +694,7 @@ final class User extends Model
     public function setPort(int $Port): array
     {
         $PortOccupied = User::pluck('port')->toArray();
-        if (in_array($Port, $PortOccupied) === true) {
+        if (\in_array($Port, $PortOccupied) === true) {
             return [
                 'ok' => false,
                 'msg' => '端口已被占用',
@@ -749,7 +749,7 @@ final class User extends Model
             ];
         }
         $PortOccupied = User::pluck('port')->toArray();
-        if (in_array($Port, $PortOccupied) === true) {
+        if (\in_array($Port, $PortOccupied) === true) {
             return [
                 'ok' => false,
                 'msg' => '端口已被占用',
@@ -819,9 +819,9 @@ final class User extends Model
             $new_emailqueue->to_email = $this->email;
             $new_emailqueue->subject = $subject;
             $new_emailqueue->template = $template;
-            $new_emailqueue->time = time();
+            $new_emailqueue->time = \time();
             $ary = array_merge(['user' => $this], $ary);
-            $new_emailqueue->array = json_encode($ary);
+            $new_emailqueue->array = \json_encode($ary);
             $new_emailqueue->save();
             return true;
         }
@@ -913,7 +913,7 @@ final class User extends Model
         $loginip = new LoginIp();
         $loginip->ip = $ip;
         $loginip->userid = $this->id;
-        $loginip->datetime = time();
+        $loginip->datetime = \time();
         $loginip->type = $type;
 
         return $loginip->save();

+ 2 - 2
src/Services/Analytics.php

@@ -77,7 +77,7 @@ final class Analytics
 
     public function getOnlineUser($time)
     {
-        $time = time() - $time;
+        $time = \time() - $time;
         return User::where('t', '>', $time)->count();
     }
 
@@ -116,6 +116,6 @@ final class Analytics
                     ->orWhere('sort', '=', 13)
                     ->orWhere('sort', '=', 14);
             }
-        )->where('node_heartbeat', '>', time() - 90)->count();
+        )->where('node_heartbeat', '>', \time() - 90)->count();
     }
 }

+ 3 - 3
src/Services/Auth/Cookie.php

@@ -14,7 +14,7 @@ final class Cookie extends Base
     public function login($uid, $time): void
     {
         $user = User::find($uid);
-        $expire_in = $time + time();
+        $expire_in = $time + \time();
         $key = Hash::cookieHash($user->pass, $expire_in);
         Utils\Cookie::set([
             'uid' => strval($uid),
@@ -40,7 +40,7 @@ final class Cookie extends Base
             return $user;
         }
 
-        if ($expire_in < time()) {
+        if ($expire_in < \time()) {
             return $user;
         }
 
@@ -75,7 +75,7 @@ final class Cookie extends Base
 
     public function logout(): void
     {
-        $time = time() - 1000;
+        $time = \time() - 1000;
         Utils\Cookie::set([
             'uid' => '',
             'email' => '',

+ 2 - 2
src/Services/Captcha.php

@@ -19,7 +19,7 @@ final class Captcha
                 $recaptcha = Setting::obtain('recaptcha_sitekey');
                 break;
             case 'geetest':
-                $geetest = Geetest::get(time() . random_int(1, 10000));
+                $geetest = Geetest::get(\time() . random_int(1, 10000));
                 break;
         }
 
@@ -41,7 +41,7 @@ final class Captcha
                 if (isset($param['recaptcha'])) {
                     if ($param['recaptcha'] !== '') {
                         $json = file_get_contents('https://recaptcha.net/recaptcha/api/siteverify?secret=' . Setting::obtain('recaptcha_secret') . '&response=' . $param['recaptcha']);
-                        $result = json_decode($json)->success;
+                        $result = \json_decode($json)->success;
                     }
                 }
                 break;

+ 3 - 3
src/Services/Gateway/AbstractPayment.php

@@ -78,7 +78,7 @@ abstract class AbstractPayment
         $p = Paylist::where('tradeno', $pid)->first();
 
         if ($p->status === 1) {
-            return json_encode(['errcode' => 0]);
+            return \json_encode(['errcode' => 0]);
         }
 
         $p->status = 1;
@@ -128,8 +128,8 @@ abstract class AbstractPayment
     protected static function getActiveGateway($key)
     {
         $payment_gateways = Setting::where('item', '=', 'payment_gateway')->first();
-        $active_gateways = json_decode($payment_gateways->value);
-        if (in_array($key, $active_gateways)) {
+        $active_gateways = \json_decode($payment_gateways->value);
+        if (\in_array($key, $active_gateways)) {
             return true;
         }
         return false;

+ 1 - 1
src/Services/Gateway/Epay.php

@@ -55,7 +55,7 @@ final class Epay extends AbstractPayment
         $type = $request->getParam('type');
         $price = $request->getParam('price');
         if ($price <= 0) {
-            return json_encode(['errcode' => -1, 'errmsg' => '非法的金额.']);
+            return \json_encode(['errcode' => -1, 'errmsg' => '非法的金额.']);
         }
         $user = Auth::getUser();
         $pl = new Paylist();

+ 1 - 1
src/Services/Gateway/Epay/EpayTool.php

@@ -128,7 +128,7 @@ final class EpayTool
     {
         $fp = fopen('/storage/epaylog.txt', 'a');
         flock($fp, LOCK_EX);
-        fwrite($fp, '执行日期:'.date('Y-m-d H:i:s', time())."\n".$word."\n");
+        fwrite($fp, '执行日期:'.date('Y-m-d H:i:s', \time())."\n".$word."\n");
         flock($fp, LOCK_UN);
         fclose($fp);
     }

+ 4 - 4
src/Services/Gateway/PAYJS.php

@@ -95,7 +95,7 @@ final class PAYJS extends AbstractPayment
     {
         $price = $request->getParam('price');
         if ($price <= 0) {
-            return json_encode(['code' => -1, 'errmsg' => '非法的金额.']);
+            return \json_encode(['code' => -1, 'errmsg' => '非法的金额.']);
         }
         $user = Auth::getUser();
         $pl = new Paylist();
@@ -118,9 +118,9 @@ final class PAYJS extends AbstractPayment
         //$url = 'https://payjs.cn/api/cashier?' . http_build_query($data);
         $url = Setting::obtain('payjs_url') . '/cashier?' . http_build_query($data);
         return $response->withJson(['code' => 0, 'url' => $url, 'pid' => $data['out_trade_no']]);
-        //$result = json_decode($this->post($data), true);
+        //$result = \json_decode($this->post($data), true);
         //$result['pid'] = $pl->tradeno;
-        //return json_encode($result);
+        //return \json_encode($result);
     }
     public function query($tradeNo)
     {
@@ -128,7 +128,7 @@ final class PAYJS extends AbstractPayment
         $data['payjs_order_id'] = $tradeNo;
         $params = $this->prepareSign($data);
         $data['sign'] = $this->sign($params);
-        return json_decode($this->post($data, $type = 'query'), true);
+        return \json_decode($this->post($data, $type = 'query'), true);
     }
     public function notify($request, $response, $args): ResponseInterface
     {

+ 1 - 1
src/Services/Gateway/StripeCard.php

@@ -113,7 +113,7 @@ final class StripeCard extends AbstractPayment
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_HEADER, 0);
-        $currency = json_decode(curl_exec($ch));
+        $currency = \json_decode(curl_exec($ch));
         curl_close($ch);
 
         return $currency->rates->CNY;

+ 3 - 3
src/Services/Gateway/THeadPaySDK.php

@@ -21,7 +21,7 @@ final class THeadPaySDK
             'return_url' => $order['return_url'],
         ];
         $params['sign'] = $this->sign($params);
-        $data = json_encode($params);
+        $data = \json_encode($params);
 
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, $this->config['theadpay_url'] . "/{$this->config['theadpay_mchid']}");
@@ -34,8 +34,8 @@ final class THeadPaySDK
         $data = curl_exec($curl);
         curl_close($curl);
 
-        $result = json_decode((string) $data, true);
-        if (! is_array($result) || ! isset($result['status'])) {
+        $result = \json_decode((string) $data, true);
+        if (! \is_array($result) || ! isset($result['status'])) {
             throw new \Exception('网络连接异常: 无法连接支付网关');
         }
         if ($result['status'] !== 'success') {

+ 1 - 1
src/Services/Gateway/Vmqpay.php

@@ -30,7 +30,7 @@ final class Vmqpay extends AbstractPayment
 
     public function purchase(Request $request, Response $response, array $args): ResponseInterface
     {
-        $trade_no = time();
+        $trade_no = \time();
         $user = Auth::getUser();
         $configs = Setting::getClass('vmq');
 

+ 2 - 2
src/Services/Password.php

@@ -24,8 +24,8 @@ final class Password
     {
         $pwdRst = new PasswordReset();
         $pwdRst->email = $email;
-        $pwdRst->init_time = time();
-        $pwdRst->expire_time = time() + 3600 * 24;
+        $pwdRst->init_time = \time();
+        $pwdRst->expire_time = \time() + 3600 * 24;
         $pwdRst->token = Tools::genRandomChar(64);
         if (! $pwdRst->save()) {
             return false;

+ 15 - 15
src/Utils/AppURI.php

@@ -31,7 +31,7 @@ final class AppURI
             $personal_info = $item['method'] . ':' . $item['passwd'];
             $ssurl = 'ss://' . Tools::base64UrlEncode($personal_info) . '@' . $item['address'] . ':' . $item['port'];
             $plugin = '';
-            if ($item['obfs'] === 'v2ray' || in_array($item['obfs'], $ss_obfs_list)) {
+            if ($item['obfs'] === 'v2ray' || \in_array($item['obfs'], $ss_obfs_list)) {
                 if (strpos($item['obfs'], 'http') !== false) {
                     $plugin .= 'obfs-local;obfs=http';
                 } elseif (strpos($item['obfs'], 'tls') !== false) {
@@ -74,7 +74,7 @@ final class AppURI
                         'sni' => $item['sni'],
                     ];
                     $return = 'vmess://' . base64_encode(
-                        json_encode($node, 320)
+                        \json_encode($node, 320)
                     );
                 } else {
                     $return = 'vless://' . $item['id'] . '@' . (string) $item['add'] . ':' . $item['port'] . '?encryption=none';
@@ -131,7 +131,7 @@ final class AppURI
                         $return = $item['remark'] . ' = ss, ' . $item['address'] . ', ' . $item['port'] . ', encrypt-method=' . $item['method'] . ', password=' . $item['passwd'] . URL::getSurgeObfs($item) . ', udp-relay=true';
                         break;
                     case 'vmess':
-                        if (! in_array($item['net'], ['ws', 'tcp'])) {
+                        if (! \in_array($item['net'], ['ws', 'tcp'])) {
                             break;
                         }
                         if ($item['tls'] === 'tls') {
@@ -166,7 +166,7 @@ final class AppURI
                 $return = $item['remark'] . ' = shadowsocksr, ' . $item['address'] . ', ' . $item['port'] . ', ' . $item['method'] . ', "' . $item['passwd'] . '", protocol=' . $item['protocol'] . ', protocol_param=' . $item['protocol_param'] . ', obfs=' . $item['obfs'] . ', obfs_param="' . $item['obfs_param'] . '", group=' . $_ENV['appName'];
                 break;
             case 'vmess':
-                if (! in_array($item['net'], ['ws', 'tcp', 'http'])) {
+                if (! \in_array($item['net'], ['ws', 'tcp', 'http'])) {
                     break;
                 }
                 $tls = ', over-tls=false, certificate=1';
@@ -179,7 +179,7 @@ final class AppURI
                     }
                 }
                 $obfs = '';
-                if (in_array($item['net'], ['ws', 'http'])) {
+                if (\in_array($item['net'], ['ws', 'http'])) {
                     $obfs = ', obfs=' . $item['net'] . ', obfs-path="' . $item['path'] . '", obfs-header="Host: ' . $item['host'] . '[Rr][Nn]User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 18_0_0 like Mac OS X) AppleWebKit/888.8.88 (KHTML, like Gecko) Mobile/6666666"';
                 }
                 $return = $item['remark'] . ' = vmess, ' . $item['add'] . ', ' . $item['port'] . ', chacha20-ietf-poly1305, "' . $item['id'] . '", group=' . $_ENV['appName'] . '_VMess' . $tls . $obfs;
@@ -235,7 +235,7 @@ final class AppURI
                 // ;vmess=example.com:443, method=none, password=23ad6b10-8d1a-40f7-8ad0-e3e35cd32291, obfs=over-tls, fast-open=false, udp-relay=false, tag=vmess-tls
                 // ;vmess=example.com:80, method=chacha20-poly1305, password=23ad6b10-8d1a-40f7-8ad0-e3e35cd32291, obfs=ws, obfs-uri=/ws, fast-open=false, udp-relay=false, tag=vmess-ws
                 // ;vmess=example.com:443, method=chacha20-poly1305, password=23ad6b10-8d1a-40f7-8ad0-e3e35cd32291, obfs=wss, obfs-uri=/ws, fast-open=false, udp-relay=false, tag=vmess-ws-tls
-                if (! in_array($item['net'], ['ws', 'tcp'])) {
+                if (! \in_array($item['net'], ['ws', 'tcp'])) {
                     break;
                 }
                 $return = 'vmess=' . $item['add'] . ':' . $item['port'] . ', method=chacha20-poly1305, password=' . $item['id'];
@@ -271,7 +271,7 @@ final class AppURI
                 $return = $item['remark'] . ' = custom, ' . $item['address'] . ', ' . $item['port'] . ', ' . $item['method'] . ', ' . $item['passwd'] . ', https://raw.githubusercontent.com/lhie1/Rules/master/SSEncrypt.module' . URL::getSurgeObfs($item);
                 break;
             case 'vmess':
-                if (! in_array($item['net'], ['ws', 'tcp'])) {
+                if (! \in_array($item['net'], ['ws', 'tcp'])) {
                     break;
                 }
                 $tls = ($item['tls'] === 'tls'
@@ -292,7 +292,7 @@ final class AppURI
         switch ($item['type']) {
             case 'ss':
                 $method = ['rc4-md5-6', 'camellia-128-cfb', 'camellia-192-cfb', 'camellia-256-cfb', 'bf-cfb', 'cast5-cfb', 'des-cfb', 'des-ede3-cfb', 'idea-cfb', 'rc2-cfb', 'seed-cfb', 'salsa20', 'chacha20', 'xsalsa20', 'none'];
-                if (in_array($item['method'], $method)) {
+                if (\in_array($item['method'], $method)) {
                     // 不支持的
                     break;
                 }
@@ -339,9 +339,9 @@ final class AppURI
                 break;
             case 'ssr':
                 if (
-                    in_array($item['method'], ['chacha20', 'camellia-128-cfb', 'camellia-192-cfb', 'camellia-256-cfb', 'rc4-md5-6', 'bf-cfb', 'cast5-cfb', 'des-cfb', 'des-ede3-cfb', 'idea-cfb', 'rc2-cfb', 'seed-cfb', 'salsa20', 'xsalsa20', 'none'])
+                    \in_array($item['method'], ['chacha20', 'camellia-128-cfb', 'camellia-192-cfb', 'camellia-256-cfb', 'rc4-md5-6', 'bf-cfb', 'cast5-cfb', 'des-cfb', 'des-ede3-cfb', 'idea-cfb', 'rc2-cfb', 'seed-cfb', 'salsa20', 'xsalsa20', 'none'])
                     ||
-                    in_array($item['protocol'], ['auth_chain_c', 'auth_chain_d', 'auth_chain_e', 'auth_chain_f', 'verify_deflate'])
+                    \in_array($item['protocol'], ['auth_chain_c', 'auth_chain_d', 'auth_chain_e', 'auth_chain_f', 'verify_deflate'])
                 ) {
                     // 不支持的
                     break;
@@ -360,7 +360,7 @@ final class AppURI
                 ];
                 break;
             case 'vmess':
-                if (! in_array($item['net'], ['ws', 'tcp', 'grpc'])) {
+                if (! \in_array($item['net'], ['ws', 'tcp', 'grpc'])) {
                     break;
                 }
                 $return = [
@@ -419,7 +419,7 @@ final class AppURI
         $return = null;
         switch ($item['type']) {
             case 'ss':
-                if (in_array($item['obfs'], Config::getSupportParam('ss_obfs'))) {
+                if (\in_array($item['obfs'], Config::getSupportParam('ss_obfs'))) {
                     $return = self::getItemUrl($item, 1);
                 } else {
                     if ($item['obfs'] === 'v2ray') {
@@ -431,7 +431,7 @@ final class AppURI
                             'mode' => 'websocket',
                         ];
                         $v2rayplugin['tls'] = $item['tls'] === 'tls' ? true : false;
-                        $return = 'ss://' . Tools::base64UrlEncode($item['method'] . ':' . $item['passwd'] . '@' . $item['address'] . ':' . $item['port']) . '?v2ray-plugin=' . base64_encode(json_encode($v2rayplugin)) . '#' . rawurlencode($item['remark']);
+                        $return = 'ss://' . Tools::base64UrlEncode($item['method'] . ':' . $item['passwd'] . '@' . $item['address'] . ':' . $item['port']) . '?v2ray-plugin=' . base64_encode(\json_encode($v2rayplugin)) . '#' . rawurlencode($item['remark']);
                     }
                     if ($item['obfs'] === 'plain') {
                         $return = self::getItemUrl($item, 2);
@@ -442,7 +442,7 @@ final class AppURI
                 $return = self::getItemUrl($item, 0);
                 break;
             case 'vmess':
-                if (! in_array($item['net'], ['tcp', 'ws', 'http', 'h2'])) {
+                if (! \in_array($item['net'], ['tcp', 'ws', 'http', 'h2'])) {
                     break;
                 }
                 $obfs = '';
@@ -492,7 +492,7 @@ final class AppURI
         $return = null;
         switch ($item['type']) {
             case 'ss':
-                if (in_array($item['obfs'], ['v2ray', 'simple_obfs_http', 'simple_obfs_tls'])) {
+                if (\in_array($item['obfs'], ['v2ray', 'simple_obfs_http', 'simple_obfs_tls'])) {
                     break;
                 }
                 $return = self::getItemUrl($item, 2);

+ 2 - 2
src/Utils/Check.php

@@ -27,13 +27,13 @@ final class Check
                 return $res;
             case 1:
                 // 白名单
-                if (in_array($mail_suffix, $mail_filter_list)) {
+                if (\in_array($mail_suffix, $mail_filter_list)) {
                     $res['ret'] = 1;
                 }
                 return $res;
             case 2:
                 // 黑名单
-                if (! in_array($mail_suffix, $mail_filter_list)) {
+                if (! \in_array($mail_suffix, $mail_filter_list)) {
                     $res['ret'] = 1;
                 }
                 return $res;

+ 14 - 14
src/Utils/ConfGenerate.php

@@ -35,7 +35,7 @@ final class ConfGenerate
         $return = null;
         switch (true) {
             case isset($Rule['content']['class']):
-                if (in_array($Proxy['class'], $Rule['content']['class'])) {
+                if (\in_array($Proxy['class'], $Rule['content']['class'])) {
                     if (isset($Rule['content']['regex'])) {
                         if (preg_match('/' . $Rule['content']['regex'] . '/i', $Proxy['remark'])) {
                             $return = $Proxy;
@@ -46,7 +46,7 @@ final class ConfGenerate
                 }
                 break;
             case isset($Rule['content']['noclass']):
-                if (! in_array($Proxy['class'], $Rule['content']['noclass'])) {
+                if (! \in_array($Proxy['class'], $Rule['content']['noclass'])) {
                     if (isset($Rule['content']['regex'])) {
                         if (preg_match('/' . $Rule['content']['regex'] . '/i', $Proxy['remark'])) {
                             $return = $Proxy;
@@ -180,7 +180,7 @@ final class ConfGenerate
     {
         $return = [];
         foreach ($ProxyGroups as $ProxyGroup) {
-            if (in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
+            if (\in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
                 $proxies = [];
                 if (
                     isset($ProxyGroup['content']['left-proxies'])
@@ -190,7 +190,7 @@ final class ConfGenerate
                 }
                 foreach ($Nodes as $item) {
                     $item = self::getMatchProxy($item, $ProxyGroup);
-                    if ($item !== null && ! in_array($item['remark'], $proxies)) {
+                    if ($item !== null && ! \in_array($item['remark'], $proxies)) {
                         $proxies[] = $item['remark'];
                     }
                 }
@@ -221,7 +221,7 @@ final class ConfGenerate
         $clean_names = [];
         $newProxyGroups = [];
         foreach ($ProxyGroups as $ProxyGroup) {
-            if (in_array($ProxyGroup['name'], $checks) && count($ProxyGroup['proxies']) === 0) {
+            if (\in_array($ProxyGroup['name'], $checks) && count($ProxyGroup['proxies']) === 0) {
                 $clean_names[] = $ProxyGroup['name'];
                 continue;
             }
@@ -231,10 +231,10 @@ final class ConfGenerate
             $ProxyGroups = $newProxyGroups;
             $newProxyGroups = [];
             foreach ($ProxyGroups as $ProxyGroup) {
-                if (! in_array($ProxyGroup['name'], $checks) && $ProxyGroup['type'] !== 'ssid') {
+                if (! \in_array($ProxyGroup['name'], $checks) && $ProxyGroup['type'] !== 'ssid') {
                     $newProxies = [];
                     foreach ($ProxyGroup['proxies'] as $proxie) {
-                        if (! in_array($proxie, $clean_names)) {
+                        if (! \in_array($proxie, $clean_names)) {
                             $newProxies[] = $proxie;
                         }
                     }
@@ -257,9 +257,9 @@ final class ConfGenerate
         $return = '';
         foreach ($ProxyGroups as $ProxyGroup) {
             $str = '';
-            if (in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
+            if (\in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
                 $proxies = implode(', ', $ProxyGroup['proxies']);
-                if (in_array($ProxyGroup['type'], ['url-test', 'fallback', 'load-balance'])) {
+                if (\in_array($ProxyGroup['type'], ['url-test', 'fallback', 'load-balance'])) {
                     $str .= ($ProxyGroup['name']
                         . ' = '
                         . $ProxyGroup['type']
@@ -357,7 +357,7 @@ final class ConfGenerate
         $return = [];
         foreach ($ProxyGroups as $ProxyGroup) {
             $tmp = [];
-            if (in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
+            if (\in_array($ProxyGroup['type'], ['select', 'url-test', 'fallback', 'load-balance'])) {
                 $proxies = [];
                 if (
                     isset($ProxyGroup['content']['left-proxies'])
@@ -368,7 +368,7 @@ final class ConfGenerate
                 foreach ($Nodes as $item) {
                     $item['remark'] = $item['name'];
                     $item = self::getMatchProxy($item, $ProxyGroup);
-                    if ($item !== null && ! in_array($item['name'], $proxies)) {
+                    if ($item !== null && ! \in_array($item['name'], $proxies)) {
                         $proxies[] = $item['name'];
                     }
                 }
@@ -406,7 +406,7 @@ final class ConfGenerate
         $clean_names = [];
         $newProxyGroups = [];
         foreach ($ProxyGroups as $ProxyGroup) {
-            if (in_array($ProxyGroup['name'], $checks) && count($ProxyGroup['proxies']) === 0) {
+            if (\in_array($ProxyGroup['name'], $checks) && count($ProxyGroup['proxies']) === 0) {
                 $clean_names[] = $ProxyGroup['name'];
                 continue;
             }
@@ -416,10 +416,10 @@ final class ConfGenerate
             $ProxyGroups = $newProxyGroups;
             $newProxyGroups = [];
             foreach ($ProxyGroups as $ProxyGroup) {
-                if (! in_array($ProxyGroup['name'], $checks)) {
+                if (! \in_array($ProxyGroup['name'], $checks)) {
                     $newProxies = [];
                     foreach ($ProxyGroup['proxies'] as $proxie) {
-                        if (! in_array($proxie, $clean_names)) {
+                        if (! \in_array($proxie, $clean_names)) {
                             $newProxies[] = $proxie;
                         }
                     }

+ 5 - 5
src/Utils/GA.php

@@ -41,7 +41,7 @@ final class GA
     public function getCode(string $secret, ?int $timeSlice = null): string
     {
         if ($timeSlice === null) {
-            $timeSlice = floor(time() / 30);
+            $timeSlice = floor(\time() / 30);
         }
 
         $secretkey = $this->_base32Decode($secret);
@@ -90,12 +90,12 @@ final class GA
      * Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now
      *
      * @param int $discrepancy This is the allowed time drift in 30 second units (8 means 4 minutes before or after)
-     * @param int|null $currentTimeSlice time slice if we want use other that time()
+     * @param int|null $currentTimeSlice time slice if we want use other that \time()
      */
     public function verifyCode(string $secret, string $code, int $discrepancy = 1, ?int $currentTimeSlice = null): bool
     {
         if ($currentTimeSlice === null) {
-            $currentTimeSlice = floor(time() / 30);
+            $currentTimeSlice = floor(\time() / 30);
         }
 
         for ($i = -$discrepancy; $i <= $discrepancy; $i++) {
@@ -137,7 +137,7 @@ final class GA
 
         $paddingCharCount = substr_count($secret, $base32chars[32]);
         $allowedValues = [6, 4, 3, 1, 0];
-        if (! in_array($paddingCharCount, $allowedValues)) {
+        if (! \in_array($paddingCharCount, $allowedValues)) {
             return false;
         }
         for ($i = 0; $i < 4; $i++) {
@@ -151,7 +151,7 @@ final class GA
         $binaryString = '';
         for ($i = 0, $iMax = count($secret); $i < $iMax; $i += 8) {
             $x = '';
-            if (! in_array($secret[$i], $base32chars)) {
+            if (! \in_array($secret[$i], $base32chars)) {
                 return false;
             }
             for ($j = 0; $j < 8; $j++) {

+ 1 - 1
src/Utils/Geetest.php

@@ -18,7 +18,7 @@ final class Geetest
         $configs = Setting::getClass('geetest');
         $GtSdk = new GeetestLib($configs['geetest_id'], $configs['geetest_key']);
         $status = $GtSdk->preProcess($user_id);
-        $ret = json_decode($GtSdk->getResponseStr());
+        $ret = \json_decode($GtSdk->getResponseStr());
         session_start();
         $_SESSION['gtserver'] = $status;
         $_SESSION['user_id'] = $user_id;

+ 2 - 2
src/Utils/GeetestLib.php

@@ -52,7 +52,7 @@ final class GeetestLib
      */
     public function getResponseStr()
     {
-        return json_encode($this->response);
+        return \json_encode($this->response);
     }
 
     /**
@@ -269,7 +269,7 @@ final class GeetestLib
         $array_value = str_split($string);
         for ($i = 0, $iMax = strlen($challenge); $i < $iMax; $i++) {
             $item = $array_challenge[$i];
-            if (in_array($item, $chongfu)) {
+            if (\in_array($item, $chongfu)) {
                 continue;
             }
 

+ 6 - 6
src/Utils/Hash.php

@@ -17,13 +17,13 @@ final class Hash
                 return self::sha256WithSalt($pass);
                 break;
             case 'bcrypt':
-                return password_hash($pass, PASSWORD_BCRYPT);
+                return \password_hash($pass, PASSWORD_BCRYPT);
                 break;
             case 'argon2i':
-                return password_hash($pass, PASSWORD_ARGON2I);
+                return \password_hash($pass, PASSWORD_ARGON2I);
                 break;
             case 'argon2id':
-                return password_hash($pass, PASSWORD_ARGON2ID);
+                return \password_hash($pass, PASSWORD_ARGON2ID);
                 break;
 
             default:
@@ -33,7 +33,7 @@ final class Hash
 
     public static function cookieHash($passHash, $expire_in)
     {
-        return substr(hash('sha256', $passHash . $_ENV['key'] . $expire_in), 5, 45);
+        return substr(\hash('sha256', $passHash . $_ENV['key'] . $expire_in), 5, 45);
     }
 
     public static function md5WithSalt($pwd)
@@ -45,12 +45,12 @@ final class Hash
     public static function sha256WithSalt($pwd)
     {
         $salt = $_ENV['salt'];
-        return hash('sha256', $pwd . $salt);
+        return \hash('sha256', $pwd . $salt);
     }
 
     public static function checkPassword($hashedPassword, $password)
     {
-        if (in_array($_ENV['pwdMethod'], ['bcrypt', 'argon2i', 'argon2id'])) {
+        if (\in_array($_ENV['pwdMethod'], ['bcrypt', 'argon2i', 'argon2id'])) {
             return password_verify($password, $hashedPassword);
         }
         return $hashedPassword === self::passwordHash($password);

+ 30 - 30
src/Utils/Telegram/Callbacks/Callback.php

@@ -73,7 +73,7 @@ final class Callback
         $this->Callback = $Callback;
         $this->MessageID = $Callback->getMessage()->getMessageId();
         $this->CallbackData = $Callback->getData();
-        $this->AllowEditMessage = time() < $Callback->getMessage()->getDate() + 172800;
+        $this->AllowEditMessage = \time() < $Callback->getMessage()->getDate() + 172800;
 
         if ($this->ChatID < 0 && $_ENV['telegram_group_quiet'] === true) {
             // 群组中不回应
@@ -175,7 +175,7 @@ final class Callback
                     'text' => $_ENV['telegram_general_pricing'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => self::getGuestIndexKeyboard()['keyboard'],
                         ]
@@ -188,7 +188,7 @@ final class Callback
                     'text' => $_ENV['telegram_general_terms'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => self::getGuestIndexKeyboard()['keyboard'],
                         ]
@@ -202,7 +202,7 @@ final class Callback
                     'text' => $temp['text'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -317,7 +317,7 @@ final class Callback
                     'parse_mode' => 'HTML',
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -395,7 +395,7 @@ final class Callback
                 foreach ($totallogin as $single) {
                     $location = $iplocation->getlocation($single->ip);
                     $loginiplocation = iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
-                    if (!in_array($loginiplocation, $userloginip)) {
+                    if (!\in_array($loginiplocation, $userloginip)) {
                         $userloginip[] = $loginiplocation;
                     }
                 }
@@ -407,7 +407,7 @@ final class Callback
                     'disable_web_page_preview' => false,
                     'parse_mode' => 'HTML',
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $back,
                         ]
@@ -417,7 +417,7 @@ final class Callback
             case 'usage_log':
                 // 使用记录
                 $iplocation = new QQWry();
-                $total = Ip::where('datetime', '>=', time() - 300)->where('userid', '=', $this->User->id)->get();
+                $total = Ip::where('datetime', '>=', \time() - 300)->where('userid', '=', $this->User->id)->get();
                 $userip = [];
                 foreach ($total as $single) {
                     $single->ip = Tools::getRealIp($single->ip);
@@ -436,7 +436,7 @@ final class Callback
                     'disable_web_page_preview' => false,
                     'parse_mode' => 'HTML',
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $back,
                         ]
@@ -458,7 +458,7 @@ final class Callback
                     'disable_web_page_preview' => false,
                     'parse_mode' => 'HTML',
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $back,
                         ]
@@ -482,7 +482,7 @@ final class Callback
                     'disable_web_page_preview' => false,
                     'parse_mode' => 'HTML',
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $back,
                         ]
@@ -495,7 +495,7 @@ final class Callback
                     'text' => $temp['text'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -603,7 +603,7 @@ final class Callback
                     'text' => $temp['text'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -628,7 +628,7 @@ final class Callback
                     'text' => $temp['text'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -639,7 +639,7 @@ final class Callback
                 // 加密方式更改
                 $keyboard = $back;
                 if (isset($CallbackDataExplode[1])) {
-                    if (in_array($CallbackDataExplode[1], Config::getSupportParam('method'))) {
+                    if (\in_array($CallbackDataExplode[1], Config::getSupportParam('method'))) {
                         $temp = $this->User->setMethod($CallbackDataExplode[1]);
                         if ($temp['ok'] === true) {
                             $text = '您当前的加密方式为:' . $this->User->method . PHP_EOL . PHP_EOL . $temp['msg'];
@@ -669,7 +669,7 @@ final class Callback
                     'text' => $text,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $keyboard,
                         ]
@@ -680,7 +680,7 @@ final class Callback
                 // 协议更改
                 $keyboard = $back;
                 if (isset($CallbackDataExplode[1])) {
-                    if (in_array($CallbackDataExplode[1], Config::getSupportParam('protocol'))) {
+                    if (\in_array($CallbackDataExplode[1], Config::getSupportParam('protocol'))) {
                         $temp = $this->User->setProtocol($CallbackDataExplode[1]);
                         if ($temp['ok'] === true) {
                             $text = '您当前的协议为:' . $this->User->protocol . PHP_EOL . PHP_EOL . $temp['msg'];
@@ -710,7 +710,7 @@ final class Callback
                     'text' => $text,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $keyboard,
                         ]
@@ -721,7 +721,7 @@ final class Callback
                 // 混淆更改
                 $keyboard = $back;
                 if (isset($CallbackDataExplode[1])) {
-                    if (in_array($CallbackDataExplode[1], Config::getSupportParam('obfs'))) {
+                    if (\in_array($CallbackDataExplode[1], Config::getSupportParam('obfs'))) {
                         $temp = $this->User->setObfs($CallbackDataExplode[1]);
                         if ($temp['ok'] === true) {
                             $text = '您当前的协议为:' . $this->User->obfs . PHP_EOL . PHP_EOL . $temp['msg'];
@@ -751,7 +751,7 @@ final class Callback
                     'text' => $text,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $keyboard,
                         ]
@@ -793,7 +793,7 @@ final class Callback
                     'text' => $text,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $keyboard,
                         ]
@@ -821,7 +821,7 @@ final class Callback
                     'text' => '如果您已经身处用户群,请勿随意点击解封,否则会导致您被移除出群组.',
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => [
                                 [
@@ -862,7 +862,7 @@ final class Callback
                     'text' => $text,
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -1001,7 +1001,7 @@ final class Callback
             switch ($CallbackDataExplode[1]) {
                 case '?clash=1':
                     $temp['text'] = '您的 Clash 配置文件.' . PHP_EOL . '同时,您也可使用该订阅链接:' . $UserApiUrl . $CallbackDataExplode[1];
-                    $filename = 'Clash_' . $token . '_' . time() . '.yaml';
+                    $filename = 'Clash_' . $token . '_' . \time() . '.yaml';
                     $filepath = BASE_PATH . '/storage/SendTelegram/' . $filename;
                     $fh = fopen($filepath, 'w+');
                     $opts = [
@@ -1026,7 +1026,7 @@ final class Callback
                     break;
                 case '?quantumult=3':
                     $temp['text'] = '点击打开配置文件,选择分享 拷贝到 Quantumult,选择更新配置.';
-                    $filename = 'Quantumult_' . $token . '_' . time() . '.conf';
+                    $filename = 'Quantumult_' . $token . '_' . \time() . '.conf';
                     $filepath = BASE_PATH . '/storage/SendTelegram/' . $filename;
                     $fh = fopen($filepath, 'w+');
                     $opts = [
@@ -1051,7 +1051,7 @@ final class Callback
                     break;
                 case '?surge=2':
                     $temp['text'] = '点击打开配置文件,选择分享 拷贝到 Surge,点击启动.';
-                    $filename = 'Surge_' . $token . '_' . time() . '.conf';
+                    $filename = 'Surge_' . $token . '_' . \time() . '.conf';
                     $filepath = BASE_PATH . '/storage/SendTelegram/' . $filename;
                     $fh = fopen($filepath, 'w+');
                     $opts = [
@@ -1076,7 +1076,7 @@ final class Callback
                     break;
                 case '?surge=3':
                     $temp['text'] = '点击打开配置文件,选择分享 拷贝到 Surge,点击启动.';
-                    $filename = 'Surge_' . $token . '_' . time() . '.conf';
+                    $filename = 'Surge_' . $token . '_' . \time() . '.conf';
                     $filepath = BASE_PATH . '/storage/SendTelegram/' . $filename;
                     $fh = fopen($filepath, 'w+');
                     $opts = [
@@ -1110,7 +1110,7 @@ final class Callback
             'text' => $temp['text'],
             'disable_web_page_preview' => false,
             'reply_to_message_id' => null,
-            'reply_markup' => json_encode(
+            'reply_markup' => \json_encode(
                 [
                     'inline_keyboard' => $temp['keyboard'],
                 ]
@@ -1194,7 +1194,7 @@ final class Callback
                     'text' => $temp['text'],
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $temp['keyboard'],
                         ]
@@ -1244,7 +1244,7 @@ final class Callback
             'text' => $temp['text'] . PHP_EOL . PHP_EOL . $checkin['msg'],
             'reply_to_message_id' => $this->MessageID,
             'parse_mode' => 'Markdown',
-            'reply_markup' => json_encode(
+            'reply_markup' => \json_encode(
                 [
                     'inline_keyboard' => $temp['keyboard'],
                 ]

+ 1 - 1
src/Utils/Telegram/Commands/InfoCommand.php

@@ -45,7 +45,7 @@ final class InfoCommand extends Command
                 'name' => $Message->getFrom()->getFirstName() . ' ' . $Message->getFrom()->getLastName(),
                 'username' => $Message->getFrom()->getUsername(),
             ];
-            if (! in_array($SendUser['id'], $_ENV['telegram_admins'])) {
+            if (! \in_array($SendUser['id'], $_ENV['telegram_admins'])) {
                 $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
                 if ($AdminUser === null) {
                     // 非管理员回复消息

+ 1 - 1
src/Utils/Telegram/Commands/MenuCommand.php

@@ -61,7 +61,7 @@ final class MenuCommand extends Command
                     'parse_mode' => 'Markdown',
                     'disable_web_page_preview' => false,
                     'reply_to_message_id' => null,
-                    'reply_markup' => json_encode(
+                    'reply_markup' => \json_encode(
                         [
                             'inline_keyboard' => $reply['keyboard'],
                         ]

+ 1 - 1
src/Utils/Telegram/Commands/MyCommand.php

@@ -95,7 +95,7 @@ final class MyCommand extends Command
                 'text' => $text,
                 'parse_mode' => 'Markdown',
                 'reply_to_message_id' => $MessageID,
-                'reply_markup' => json_encode(
+                'reply_markup' => \json_encode(
                     [
                         'inline_keyboard' => [
                             [

+ 1 - 1
src/Utils/Telegram/Commands/SetuserCommand.php

@@ -46,7 +46,7 @@ final class SetuserCommand extends Command
             'username' => $Message->getFrom()->getUsername(),
         ];
 
-        if (! in_array($SendUser['id'], $_ENV['telegram_admins'])) {
+        if (! \in_array($SendUser['id'], $_ENV['telegram_admins'])) {
             $AdminUser = User::where('is_admin', 1)->where('telegram_id', $SendUser['id'])->first();
             if ($AdminUser === null) {
                 // 非管理员回复消息

+ 2 - 2
src/Utils/Telegram/Message.php

@@ -142,7 +142,7 @@ final class Message
         ];
         if ($NewChatMember->getUsername() === $_ENV['telegram_bot']) {
             // 机器人加入新群组
-            if ($_ENV['allow_to_join_new_groups'] !== true && ! in_array($this->ChatID, $_ENV['group_id_allowed_to_join'])) {
+            if ($_ENV['allow_to_join_new_groups'] !== true && ! \in_array($this->ChatID, $_ENV['group_id_allowed_to_join'])) {
                 // 退群
                 $this->replyWithMessage(
                     [
@@ -176,7 +176,7 @@ final class Message
         } else {
             // 新成员加入群组
             $NewUser = TelegramTools::getUser($Member['id']);
-            $deNewChatMember = json_decode($NewChatMember, true);
+            $deNewChatMember = \json_decode($NewChatMember, true);
             if (
                 Setting::obtain('telegram_group_bound_user') === true
                 &&

+ 5 - 5
src/Utils/Telegram/TelegramTools.php

@@ -29,7 +29,7 @@ final class TelegramTools
     public static function sendPost($Method, $Params): void
     {
         $URL = 'https://api.telegram.org/bot' . $_ENV['telegram_token'] . '/' . $Method;
-        $POSTData = json_encode($Params);
+        $POSTData = \json_encode($Params);
         $C = curl_init();
         curl_setopt($C, CURLOPT_URL, $URL);
         curl_setopt($C, CURLOPT_POST, 1);
@@ -108,10 +108,10 @@ final class TelegramTools
                         'msg' => '处理出错,不支持的写法.' . PHP_EOL . PHP_EOL . self::strArrayToCode($strArray),
                     ];
                 }
-                if (in_array($value, ['启用', '是'])) {
+                if (\in_array($value, ['启用', '是'])) {
                     $User->$useOptionMethod = 1;
                     $new = '启用';
-                } elseif (in_array($value, ['禁用', '否'])) {
+                } elseif (\in_array($value, ['禁用', '否'])) {
                     $User->$useOptionMethod = 0;
                     $new = '禁用';
                 } else {
@@ -218,7 +218,7 @@ final class TelegramTools
                     $number = $value;
                     if (is_numeric($value)) {
                         $number *= 86400;
-                        $new = time() + $number;
+                        $new = \time() + $number;
                         $new = date('Y-m-d H:i:s', $new);
                     } else {
                         if (strtotime($value) === false) {
@@ -474,7 +474,7 @@ final class TelegramTools
             strpos($Value, '/') === 0
         ) {
             $operator = substr($Value, 0, 1);
-            if (! in_array($operator, ['*', '/'])) {
+            if (! \in_array($operator, ['*', '/'])) {
                 $number = Tools::flowAutoShowZ(substr($Value, 1));
             } else {
                 $number = substr($Value, 1, strlen($Value) - 1);

+ 8 - 8
src/Utils/TelegramSessionManager.php

@@ -41,7 +41,7 @@ final class TelegramSessionManager
     {
         $Elink = TelegramSession::where('type', '=', 0)->where('user_id', '=', $user->id)->first();
         if ($Elink !== null) {
-            $Elink->datetime = time();
+            $Elink->datetime = \time();
             $Elink->session_content = self::generateRandomLink();
             $Elink->save();
             return $Elink->session_content;
@@ -50,7 +50,7 @@ final class TelegramSessionManager
         $NLink = new TelegramSession();
         $NLink->type = 0;
         $NLink->user_id = $user->id;
-        $NLink->datetime = time();
+        $NLink->datetime = \time();
         $NLink->session_content = self::generateRandomLink();
         $NLink->save();
 
@@ -59,7 +59,7 @@ final class TelegramSessionManager
 
     public static function verifyBindSession($token)
     {
-        $Elink = TelegramSession::where('type', '=', 0)->where('session_content', $token)->where('datetime', '>', time() - 600)->orderBy('datetime', 'desc')->first();
+        $Elink = TelegramSession::where('type', '=', 0)->where('session_content', $token)->where('datetime', '>', \time() - 600)->orderBy('datetime', 'desc')->first();
         if ($Elink !== null) {
             $uid = $Elink->user_id;
             $Elink->delete();
@@ -73,7 +73,7 @@ final class TelegramSessionManager
         $NLink = new TelegramSession();
         $NLink->type = 1;
         $NLink->user_id = 0;
-        $NLink->datetime = time();
+        $NLink->datetime = \time();
         $NLink->session_content = self::generateLoginRandomLink();
         $NLink->save();
 
@@ -82,7 +82,7 @@ final class TelegramSessionManager
 
     public static function verifyLoginSession($token, $uid)
     {
-        $Elink = TelegramSession::where('type', '=', 1)->where('user_id', 0)->where('session_content', 'LIKE', $token . '|%')->where('datetime', '>', time() - 90)->orderBy('datetime', 'desc')->first();
+        $Elink = TelegramSession::where('type', '=', 1)->where('user_id', 0)->where('session_content', 'LIKE', $token . '|%')->where('datetime', '>', \time() - 90)->orderBy('datetime', 'desc')->first();
         if ($Elink !== null) {
             $Elink->user_id = $uid;
             $Elink->save();
@@ -93,7 +93,7 @@ final class TelegramSessionManager
 
     public static function verifyLoginNumber($token, $uid)
     {
-        $Elink = TelegramSession::where('type', '=', 1)->where('user_id', 0)->where('session_content', 'LIKE', '%|' . $token)->where('datetime', '>', time() - 90)->orderBy('datetime', 'desc')->first();
+        $Elink = TelegramSession::where('type', '=', 1)->where('user_id', 0)->where('session_content', 'LIKE', '%|' . $token)->where('datetime', '>', \time() - 90)->orderBy('datetime', 'desc')->first();
         if ($Elink !== null) {
             $Elink->user_id = $uid;
             $Elink->save();
@@ -104,7 +104,7 @@ final class TelegramSessionManager
 
     public static function step2VerifyLoginSession($token, $number)
     {
-        $Elink = TelegramSession::where('type', '=', 1)->where('session_content', $token . '|' . $number)->where('datetime', '>', time() - 90)->orderBy('datetime', 'desc')->first();
+        $Elink = TelegramSession::where('type', '=', 1)->where('session_content', $token . '|' . $number)->where('datetime', '>', \time() - 90)->orderBy('datetime', 'desc')->first();
         if ($Elink !== null) {
             $uid = $Elink->user_id;
             $Elink->delete();
@@ -117,7 +117,7 @@ final class TelegramSessionManager
     {
         $Elink = TelegramSession::where('type', '=', 1)->where('session_content', $token . '|' . $number)->orderBy('datetime', 'desc')->first();
         if ($Elink !== null) {
-            if ($Elink->datetime < time() - 90) {
+            if ($Elink->datetime < \time() - 90) {
                 return -1;
             }
             return $Elink->user_id;

+ 5 - 5
src/Utils/Tools.php

@@ -215,7 +215,7 @@ final class Tools
     public static function isParamValidate($type, $str)
     {
         $list = Config::getSupportParam($type);
-        if (in_array($str, $list)) {
+        if (\in_array($str, $list)) {
             return true;
         }
         return false;
@@ -229,7 +229,7 @@ final class Tools
     public static function keyFilter(Model $object, array $filter_array): Model
     {
         foreach ($object->toArray() as $key => $value) {
-            if (! in_array($key, $filter_array)) {
+            if (! \in_array($key, $filter_array)) {
                 unset($object->$key);
             }
         }
@@ -238,7 +238,7 @@ final class Tools
 
     public static function checkNoneProtocol($user)
     {
-        return ! ($user->method === 'none' && ! in_array($user->protocol, Config::getSupportParam('allow_none_protocol')));
+        return ! ($user->method === 'none' && ! \in_array($user->protocol, Config::getSupportParam('allow_none_protocol')));
     }
 
     public static function getRealIp($rawIp)
@@ -308,7 +308,7 @@ final class Tools
             }
         }
         if (count($server) >= 5) {
-            if (in_array($item['net'], ['kcp', 'http', 'mkcp'])) {
+            if (\in_array($item['net'], ['kcp', 'http', 'mkcp'])) {
                 $item['headerType'] = $server[4];
             } else {
                 switch ($server[4]) {
@@ -660,7 +660,7 @@ final class Tools
 
     public static function etag($data)
     {
-        return hash('crc32c', $data);
+        return \hash('crc32c', $data);
     }
 
     public static function genSubToken()

+ 10 - 10
src/Utils/URL.php

@@ -19,7 +19,7 @@ final class URL
     public static function canMethodConnect($method)
     {
         $ss_aead_method_list = Config::getSupportParam('ss_aead_method');
-        if (in_array($method, $ss_aead_method_list)) {
+        if (\in_array($method, $ss_aead_method_list)) {
             return 2;
         }
         return 3;
@@ -54,7 +54,7 @@ final class URL
         if ($obfs !== 'plain') {
             //SS obfs only
             $ss_obfs = Config::getSupportParam('ss_obfs');
-            if (in_array($obfs, $ss_obfs)) {
+            if (\in_array($obfs, $ss_obfs)) {
                 if (strpos($obfs, '_compatible') === false) {
                     return 2;
                 }
@@ -160,7 +160,7 @@ final class URL
         array $rules = []
     ): \Illuminate\Database\Eloquent\Collection {
         $query = Node::query();
-        if (is_array($sort)) {
+        if (\is_array($sort)) {
             $query->whereIn('sort', $sort);
         } else {
             $query->where('sort', $sort);
@@ -231,7 +231,7 @@ final class URL
 
         // 单端口 sort = 9
         $mu_nodes = [];
-        if ($is_mu !== 0 && in_array($Rule['type'], ['all', 'ss', 'ssr'])) {
+        if ($is_mu !== 0 && \in_array($Rule['type'], ['all', 'ss', 'ssr'])) {
             $mu_node_query = Node::query();
             $mu_node_query->where('sort', 9)->where('type', '1');
             if ($is_mu !== 1) {
@@ -267,7 +267,7 @@ final class URL
             // 筛选 End
 
             // 其他类型单端口节点
-            if (in_array($node->sort, [11, 13, 14])) {
+            if (\in_array($node->sort, [11, 13, 14])) {
                 $node_class = [
                     11 => 'getV2RayItem',           // V2Ray
                     13 => 'getV2RayPluginItem',     // Rico SS (V2RayPlugin && obfs)
@@ -283,7 +283,7 @@ final class URL
             // 其他类型单端口节点 End
 
             // SS 节点
-            if (in_array($node->sort, [0])) {
+            if (\in_array($node->sort, [0])) {
                 // 节点非只启用单端口 && 只获取普通端口
                 if ($node->mu_only !== 1 &&
                     ($is_mu === 0 || ($is_mu !== 0 && $_ENV['mergeSub'] === true))) {
@@ -336,7 +336,7 @@ final class URL
     public static function getNewAllUrl(User $user, array $Rule): string
     {
         $return_url = '';
-        if (strtotime($user->expire_in) < time()) {
+        if (strtotime($user->expire_in) < \time()) {
             return $return_url;
         }
         $items = URL::getNewAllItems($user, $Rule);
@@ -410,7 +410,7 @@ final class URL
         $item['class'] = $node->node_class;
         if (! $arrout) {
             return 'vmess://' . base64_encode(
-                json_encode($item, 320)
+                \json_encode($item, 320)
             );
         }
         return $item;
@@ -483,7 +483,7 @@ final class URL
     {
         $ss_obfs_list = Config::getSupportParam('ss_obfs');
         $plugin = '';
-        if (in_array($item['obfs'], $ss_obfs_list)) {
+        if (\in_array($item['obfs'], $ss_obfs_list)) {
             if (strpos($item['obfs'], 'http') !== false) {
                 $plugin .= 'obfs-local --obfs http';
             } else {
@@ -500,7 +500,7 @@ final class URL
     {
         $ss_obfs_list = Config::getSupportParam('ss_obfs');
         $plugin = '';
-        if (in_array($item['obfs'], $ss_obfs_list)) {
+        if (\in_array($item['obfs'], $ss_obfs_list)) {
             if (strpos($item['obfs'], 'http') !== false) {
                 $plugin .= ', obfs=http';
             } else {