diff --git a/README-EN.md b/README-EN.md
index 711f7c2c..e92fa62a 100644
--- a/README-EN.md
+++ b/README-EN.md
@@ -21,7 +21,7 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E
- ....
## System Requirements
-- PHP: 8.0, must have extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis
+- PHP: 8.0, must have extensions: bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis, pcntl, sockets
- Mysql: 5.7 latest version or above
- Redis:1.0.0 or above
diff --git a/README.md b/README.md
index fbc6be8f..a923b4f1 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
- ....
## 系统要求
-- PHP: 8.0,必须扩展:bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis
+- PHP: 8.0,必须扩展:bcmath, ctype, fileinfo, json, mbstring, openssl, pdo_mysql, tokenizer, xml, mysqli, gd, redis, pcntl, sockets
- Mysql: 5.7最新版或以上版本
- Redis:1.0.0或以上版本
diff --git a/app/Repositories/TrackerRepository.php b/app/Repositories/TrackerRepository.php
index 02a7f3cc..0d416db2 100644
--- a/app/Repositories/TrackerRepository.php
+++ b/app/Repositories/TrackerRepository.php
@@ -262,7 +262,7 @@ class TrackerRepository extends BaseRepository
}
// Part.4 Get User Ip Address
- $queries['ip'] = $request->getClientIp();
+ $queries['ip'] = nexus()->getRequestIp();
// Part.5 Get Users Agent
$queries['user_agent'] = $request->headers->get('user-agent');
diff --git a/include/globalfunctions.php b/include/globalfunctions.php
index 919d3efc..c03704cb 100644
--- a/include/globalfunctions.php
+++ b/include/globalfunctions.php
@@ -443,15 +443,10 @@ function arr_set(&$array, $key, $value)
return $array;
}
-function isHttps()
+function isHttps(): bool
{
- if (RUNNING_IN_OCTANE) {
- $https = request()->server('HTTPS');
- $result = !empty($https) && (strtolower($https) !== 'off');
- } else {
- $result = !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) !== 'off');
- }
- return $result;
+ $schema = nexus()->getRequestSchema();
+ return $schema == 'https';
}
diff --git a/lang/chs/lang_functions.php b/lang/chs/lang_functions.php
index feed7f62..826a927d 100644
--- a/lang/chs/lang_functions.php
+++ b/lang/chs/lang_functions.php
@@ -317,7 +317,7 @@ $lang_functions = array
'text_required' => '不能为空',
'text_invalid' => '非法',
'text_technical_info' => 'MediaInfo',
- 'text_technical_info_help_text' => '文件 MediaInfo 来自软件 MediaInfo,用该软件打开文件,点击菜单视图(View)->文件(Text),在框中右键->全选,再右键->复制,粘贴到这里来。',
+ 'text_technical_info_help_text' => 'MediaInfo 来自软件 MediaInfo,用该软件打开文件,点击菜单视图(View)->文件(Text),在框中右键->全选,再右键->复制,粘贴到这里来。',
'text_management_system' => '管理系统',
'text_seed_points' => '做种积分',
);
diff --git a/lang/cht/lang_functions.php b/lang/cht/lang_functions.php
index 3b5fb11f..4194b49b 100644
--- a/lang/cht/lang_functions.php
+++ b/lang/cht/lang_functions.php
@@ -318,7 +318,7 @@ $lang_functions = array
'text_required' => '不能為空',
'text_invalid' => '非法',
'text_technical_info' => 'MediaInfo',
- 'text_technical_info_help_text' => '文件 MediaInfo 來自軟件 MediaInfo,用該軟件打開文件,點擊菜單視圖(View)->文件(Text),在框中右鍵->全選,再右鍵->復制,粘貼到這裏來。',
+ 'text_technical_info_help_text' => 'MediaInfo 來自軟件 MediaInfo,用該軟件打開文件,點擊菜單視圖(View)->文件(Text),在框中右鍵->全選,再右鍵->復制,粘貼到這裏來。',
'text_management_system' => '管理系統',
'text_seed_points' => '做種積分',
);
diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php
index fd8727ea..7c9394e1 100644
--- a/nexus/Install/Install.php
+++ b/nexus/Install/Install.php
@@ -128,7 +128,7 @@ class Install
public function listRequirementTableRows()
{
$gdInfo = function_exists('gd_info') ? gd_info() : [];
- $extensions = ['ctype', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'pcntl'];
+ $extensions = ['ctype', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'pcntl', 'sockets'];
$tableRows = [];
$tableRows[] = [
'label' => 'PHP version',
diff --git a/nexus/Nexus.php b/nexus/Nexus.php
index e4a229b1..39525add 100644
--- a/nexus/Nexus.php
+++ b/nexus/Nexus.php
@@ -92,6 +92,42 @@ final class Nexus
$this->logSequence++;
}
+ public function getRequestSchema()
+ {
+ $schema = $this->retrieveFromServer(['HTTP_X_FORWARDED_PROTO', 'REQUEST_SCHEME', 'HTTP_SCHEME']);
+ if (empty($schema)) {
+ $tmp = $this->retrieveFromServer(['HTTPS']);
+ if ($tmp == 'on') {
+ $schema = 'https';
+ }
+ }
+ return $schema;
+ }
+
+ public function getRequestIp()
+ {
+ $ip = $this->retrieveFromServer(['HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_REMOTE_ADDR']);
+ if (empty($ip)) {
+ $ip = request()->getClientIp();
+ }
+ return $ip;
+ }
+
+ private function retrieveFromServer(array $fields)
+ {
+ if ($this->runningInOctane()) {
+ $servers = request()->server();
+ } else {
+ $servers = $_SERVER;
+ }
+ foreach ($fields as $field) {
+ if (!empty($servers[$field])) {
+ do_log("got from $field");
+ return $servers[$field];
+ }
+ }
+ }
+
private function runningInOctane(): bool
{
if (defined('RUNNING_IN_OCTANE') && RUNNING_IN_OCTANE) {