mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
merge 1.9
This commit is contained in:
@@ -17,7 +17,7 @@ class CommentResource extends JsonResource
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'text' => $this->text,
|
'text' => bbcode_attach_to_img($this->text),
|
||||||
'updated_at' => format_datetime($this->editdate),
|
'updated_at' => format_datetime($this->editdate),
|
||||||
'created_at' => format_datetime($this->added),
|
'created_at' => format_datetime($this->added),
|
||||||
'create_user' => new UserResource($this->whenLoaded('create_user')),
|
'create_user' => new UserResource($this->whenLoaded('create_user')),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class CommentRepository extends BaseRepository
|
|||||||
if (!empty($request->request_id)) {
|
if (!empty($request->request_id)) {
|
||||||
$query->where('request', $request->request_id);
|
$query->where('request', $request->request_id);
|
||||||
}
|
}
|
||||||
$query->orderBy('id', 'desc');
|
$query->orderBy('id', 'asc');
|
||||||
return $query->paginate($this->getPerPageFromRequest($request));
|
return $query->paginate($this->getPerPageFromRequest($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'expiration' => 129600,
|
'expiration' => 5256000,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.13');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.9.14');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2025-12-28');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2026-01-23');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
@@ -3195,6 +3195,7 @@ function deletetorrent($id, $notify = false) {
|
|||||||
$idStr = implode(', ', $idArr ?: [0]);
|
$idStr = implode(', ', $idArr ?: [0]);
|
||||||
$torrent_dir = get_setting('main.torrent_dir');
|
$torrent_dir = get_setting('main.torrent_dir');
|
||||||
\Nexus\Database\NexusDB::statement("DELETE FROM torrents WHERE id in ($idStr)");
|
\Nexus\Database\NexusDB::statement("DELETE FROM torrents WHERE id in ($idStr)");
|
||||||
|
\Nexus\Database\NexusDB::statement("DELETE FROM torrent_extras WHERE torrent_id in ($idStr)");
|
||||||
//delete by torrent, make sure user is deleted
|
//delete by torrent, make sure user is deleted
|
||||||
\Nexus\Database\NexusDB::statement("DELETE FROM snatched WHERE torrentid in ($idStr) and not exists (select 1 from users where id = snatched.userid)");
|
\Nexus\Database\NexusDB::statement("DELETE FROM snatched WHERE torrentid in ($idStr) and not exists (select 1 from users where id = snatched.userid)");
|
||||||
foreach(array("peers", "files", "comments") as $x) {
|
foreach(array("peers", "files", "comments") as $x) {
|
||||||
@@ -3214,13 +3215,11 @@ function deletetorrent($id, $notify = false) {
|
|||||||
'action_type' => \App\Models\TorrentOperationLog::ACTION_TYPE_DELETE,
|
'action_type' => \App\Models\TorrentOperationLog::ACTION_TYPE_DELETE,
|
||||||
'comment' => '',
|
'comment' => '',
|
||||||
], $notify);
|
], $notify);
|
||||||
|
do_action("torrent_delete", $_id);
|
||||||
|
fire_event("torrent_deleted", $torrentInfo->get($_id));
|
||||||
}
|
}
|
||||||
$meiliSearchRep = new \App\Repositories\MeiliSearchRepository();
|
$meiliSearchRep = new \App\Repositories\MeiliSearchRepository();
|
||||||
$meiliSearchRep->deleteDocuments($idArr);
|
$meiliSearchRep->deleteDocuments($idArr);
|
||||||
if (is_int($id)) {
|
|
||||||
do_action("torrent_delete", $id);
|
|
||||||
fire_event("torrent_deleted", $torrentInfo->get($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pager($rpp, $count, $href, $opts = array(), $pagename = "page") {
|
function pager($rpp, $count, $href, $opts = array(), $pagename = "page") {
|
||||||
@@ -5943,6 +5942,7 @@ function get_ip_location_from_geoip($ip): bool|array
|
|||||||
'city' => '',
|
'city' => '',
|
||||||
'country_en' => '',
|
'country_en' => '',
|
||||||
'city_en' => '',
|
'city_en' => '',
|
||||||
|
'continent_en' => '',
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
$database = nexus_env('GEOIP2_DATABASE');
|
$database = nexus_env('GEOIP2_DATABASE');
|
||||||
@@ -5971,7 +5971,7 @@ function get_ip_location_from_geoip($ip): bool|array
|
|||||||
$info['continent'] = $continentName;
|
$info['continent'] = $continentName;
|
||||||
$info['continent_en'] = $record->continent->names['en'] ?? '';
|
$info['continent_en'] = $record->continent->names['en'] ?? '';
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
do_log($exception->getMessage());
|
do_log($exception->getMessage() . ", trace: " . $exception->getTraceAsString(), 'error');
|
||||||
}
|
}
|
||||||
return $info;
|
return $info;
|
||||||
});
|
});
|
||||||
@@ -6620,4 +6620,35 @@ function make_content_disposition(string $filename, string $disposition = 'attac
|
|||||||
return \Symfony\Component\HttpFoundation\HeaderUtils::makeDisposition($disposition, $filename, $filenameFallback);
|
return \Symfony\Component\HttpFoundation\HeaderUtils::makeDisposition($disposition, $filename, $filenameFallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bbcode_attach_to_img(string $text) {
|
||||||
|
$pattern = "/\[attach\]([0-9a-zA-z][0-9a-zA-z]*)\[\/attach\]/is";
|
||||||
|
return preg_replace_callback($pattern, function ($matches) {
|
||||||
|
$dlkey = $matches[1];
|
||||||
|
$httpdirectory_attachment = get_setting('attachment.httpdirectory');
|
||||||
|
$row = \Nexus\Database\NexusDB::remember('attachment_'.$dlkey.'_content', 86400, function() use ($dlkey) {
|
||||||
|
$record = \App\Models\Attachment::query()->where("dlkey", $dlkey)->first();
|
||||||
|
if ($record) {
|
||||||
|
return $record->toArray();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
if (empty($row) || $row['isimage'] != 1) {
|
||||||
|
do_log(sprintf("dlkey: %s get attachment %s not exists or not image", $dlkey, json_encode($row)));
|
||||||
|
return $matches[0];
|
||||||
|
}
|
||||||
|
$driver = $row['driver'] ?? 'local';
|
||||||
|
if ($driver == "local") {
|
||||||
|
if ($row['thumb'] == 1){
|
||||||
|
$url = $httpdirectory_attachment."/".$row['location'].".thumb.jpg";
|
||||||
|
} else {
|
||||||
|
$url = $httpdirectory_attachment."/".$row['location'];
|
||||||
|
}
|
||||||
|
$url = sprintf("%s/%s", getSchemeAndHttpHost(true), trim($url, "/"));
|
||||||
|
} else {
|
||||||
|
$url = \Nexus\Attachment\Storage::getDriver($driver)->getImageUrl($row['location']);
|
||||||
|
}
|
||||||
|
return "[img]" . $url . "[/img]";
|
||||||
|
}, $text, 20);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user