mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
login notify + bonus log
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-29');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-01-31');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -5831,6 +5831,8 @@ function get_ip_location_from_geoip($ip): bool|array
|
||||
'version' => '',
|
||||
'country' => '',
|
||||
'city' => '',
|
||||
'country_en' => '',
|
||||
'city_en' => '',
|
||||
];
|
||||
try {
|
||||
$record = $reader->city($ip);
|
||||
@@ -5842,7 +5844,10 @@ function get_ip_location_from_geoip($ip): bool|array
|
||||
$info['version'] = 6;
|
||||
}
|
||||
$info['country'] = $countryName;
|
||||
$info['country_en'] = $record->country->names['en'] ?? '';
|
||||
$info['city'] = $cityName;
|
||||
$info['city_en'] = $record->city->names['en'] ?? '';
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
do_log($exception->getMessage() . $exception->getTraceAsString(), 'error');
|
||||
}
|
||||
@@ -5857,6 +5862,9 @@ function get_ip_location_from_geoip($ip): bool|array
|
||||
'flagpic' => '',
|
||||
'start_ip' => $ip,
|
||||
'end_ip' => $ip,
|
||||
'ip_version' => $locationInfo['version'],
|
||||
'country_en' => $locationInfo['country_en'],
|
||||
'city_en' => $locationInfo['city_en'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,18 +1113,24 @@ function get_passkey_by_authkey($authkey)
|
||||
});
|
||||
}
|
||||
|
||||
function executeCommand($command, $format = 'string'): string|array
|
||||
function executeCommand($command, $format = 'string', $artisan = false, $exception = true): string|array
|
||||
{
|
||||
$append = " 2>&1";
|
||||
if (!str_ends_with($command, $append)) {
|
||||
$command .= $append;
|
||||
}
|
||||
if ($artisan) {
|
||||
$phpPath = nexus_env('PHP_PATH', 'php');
|
||||
$webRoot = rtrim(ROOT_PATH, '/');
|
||||
$command = "$phpPath $webRoot/artisan $command";
|
||||
}
|
||||
do_log("command: $command");
|
||||
$result = exec($command, $output, $result_code);
|
||||
$outputString = implode("\n", $output);
|
||||
do_log(sprintf('result_code: %s, result: %s, output: %s', $result_code, $result, $outputString));
|
||||
if ($result_code != 0) {
|
||||
if ($exception && $result_code != 0) {
|
||||
throw new \RuntimeException($outputString);
|
||||
}
|
||||
return $format == 'string' ? $outputString : $output;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user