diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 73a2aa53..6c6adacc 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -67,7 +67,7 @@ class Install public function getLogFile() { - return sprintf('%s/nexus_install_%s.log', sys_get_temp_dir(), date('Ymd')); + return sprintf('%s/nexus-install-%s.log', sys_get_temp_dir(), date('YmdHis')); } public function getInsallDirectory() diff --git a/nexus/Install/Update.php b/nexus/Install/Update.php index 8ce91e16..a5f6fb18 100644 --- a/nexus/Install/Update.php +++ b/nexus/Install/Update.php @@ -12,7 +12,7 @@ class Update extends Install public function getLogFile() { - return sprintf('%s/nexus_update_%s.log', sys_get_temp_dir(), date('Ymd')); + return sprintf('%s/nexus-update-%s.log', sys_get_temp_dir(), date('YmdHis')); } public function getUpdateDirectory() @@ -64,4 +64,4 @@ class Update extends Install } } -} \ No newline at end of file +} diff --git a/nexus/Install/settings.default.php b/nexus/Install/settings.default.php index 0cab93c0..9cd2000a 100644 --- a/nexus/Install/settings.default.php +++ b/nexus/Install/settings.default.php @@ -355,7 +355,7 @@ array ( 'mainversion' => 'NexusPHP', 'subversion' => 'v1.6.0-beta5', - 'releasedate' => '2021-04-30', + 'releasedate' => '2021-05-01', 'website' => 'https://nexusphp.org', ), ); diff --git a/nexus/Install/update/update.php b/nexus/Install/update/update.php index 15563d33..af4f9bff 100644 --- a/nexus/Install/update/update.php +++ b/nexus/Install/update/update.php @@ -25,7 +25,8 @@ if ($currentStep == 1) { } if ($currentStep == 2) { - $envExampleFile = "$rootpath.env.example"; + $envExampleFile = $rootpath . ".env.example"; + $dbstructureFile = $rootpath . "_db/dbstructure_v1.6.sql"; $envExampleData = readEnvFile($envExampleFile); $envFormControls = $update->listEnvFormControls(); $newData = array_column($envFormControls, 'value', 'name'); @@ -41,11 +42,17 @@ if ($currentStep == 2) { } $tableRows = [ [ - 'label' => '.env.example', + 'label' => basename($envExampleFile), 'required' => 'exists && readable', 'current' => $envExampleFile, 'result' => $update->yesOrNo(file_exists($envExampleFile) && is_readable($envExampleFile)), ], + [ + 'label' => basename($dbstructureFile), + 'required' => 'exists && readable', + 'current' => $dbstructureFile, + 'result' => $update->yesOrNo(file_exists($dbstructureFile) && is_readable($dbstructureFile)), + ], ]; $fails = array_filter($tableRows, function ($value) {return $value['result'] == 'NO';}); $pass = empty($fails); diff --git a/public/announce.php b/public/announce.php index d21a8e6e..7fa5b0ec 100644 --- a/public/announce.php +++ b/public/announce.php @@ -114,6 +114,7 @@ $real_annnounce_interval = $annintertwo; $resp = "d" . benc_str("interval") . "i" . $real_annnounce_interval . "e" . benc_str("min interval") . "i" . $announce_wait . "e". benc_str("complete") . "i" . $torrent["seeders"] . "e" . benc_str("incomplete") . "i" . $torrent["leechers"] . "e" . benc_str("peers"); $peer_list = ""; +$peer6_list = ""; unset($self); // bencoding the peers info get for this announce while ($row = mysql_fetch_assoc($res)) @@ -126,27 +127,38 @@ while ($row = mysql_fetch_assoc($res)) $self = $row; continue; } -if ($compact == 1){ - $longip = ip2long($row['ip']); - if ($longip) //Ignore ipv6 address - $peer_list .= pack("Nn", sprintf("%d",$longip), $row['port']); -} -elseif ($no_peer_id == 1) - $peer_list .= "d" . - benc_str("ip") . benc_str($row["ip"]) . - benc_str("port") . "i" . $row["port"] . "e" . - "e"; -else - $peer_list .= "d" . - benc_str("ip") . benc_str($row["ip"]) . - benc_str("peer id") . benc_str($row["peer_id"]) . - benc_str("port") . "i" . $row["port"] . "e" . - "e"; + if ($compact == 1){ + $longip = ip2long($row['ip']); + if ($longip) //Ignore ipv6 address + $peer_list .= pack("Nn", sprintf("%d",$longip), $row['port']); + else + { + $ipv6_packed = inet_pton($row['ip']); + if ($ipv6_packed) + $peer6_list .= $ipv6_packed . pack("n", $row['port']); + } + } + elseif ($no_peer_id == 1) + $peer_list .= "d" . + benc_str("ip") . benc_str($row["ip"]) . + benc_str("port") . "i" . $row["port"] . "e" . + "e"; + else + $peer_list .= "d" . + benc_str("ip") . benc_str($row["ip"]) . + benc_str("peer id") . benc_str($row["peer_id"]) . + benc_str("port") . "i" . $row["port"] . "e" . + "e"; } if ($compact == 1) -$resp .= benc_str($peer_list); + $resp .= benc_str($peer_list); else -$resp .= "l".$peer_list."e"; + $resp .= "l".$peer_list."e"; + +if ($compact == 1 && strlen($peer6_list) > 0) +{ + $resp .= benc_str("peers6").benc_str($peer6_list); +} $resp .= "e"; $selfwhere = "torrent = $torrentid AND " . hash_where("peer_id", $peer_id); @@ -381,7 +393,11 @@ elseif(isset($self)) } else { - $sockres = @pfsockopen($ip, $port, $errno, $errstr, 5); + if (strlen($ip) > 15) { + $sockres = @pfsockopen("tcp://[".$ip."]",$port,$errno,$errstr,5); + } else { + $sockres = @pfsockopen($ip, $port, $errno, $errstr, 5); + } if (!$sockres) { $connectable = "no";