|
|
@ -37,22 +37,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
// Init torrent |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
@ -198,22 +187,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -372,22 +350,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -578,22 +545,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
// Init torrent |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
@ -675,22 +631,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
// Init torrent |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
@ -765,22 +710,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -941,22 +875,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
// Init torrent |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
@ -1038,22 +961,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
// Init torrent |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
@ -1122,22 +1034,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1211,22 +1112,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1327,22 +1217,11 @@ class TorrentController extends AbstractController |
|
|
|
): Response |
|
|
|
): Response |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Init user |
|
|
|
// Init user |
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
$user = $this->initUser( |
|
|
|
{ |
|
|
|
$request, |
|
|
|
$user = $userService->addUser( |
|
|
|
$userService, |
|
|
|
$request->getClientIp(), |
|
|
|
$activityService |
|
|
|
time(), |
|
|
|
); |
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
if (!$user->isStatus()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1414,4 +1293,31 @@ class TorrentController extends AbstractController |
|
|
|
// Render response |
|
|
|
// Render response |
|
|
|
return new Response(); // @TODO |
|
|
|
return new Response(); // @TODO |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function initUser( |
|
|
|
|
|
|
|
Request $request, |
|
|
|
|
|
|
|
UserService $userService, |
|
|
|
|
|
|
|
ActivityService $activityService |
|
|
|
|
|
|
|
): ?\App\Entity\User |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Init user |
|
|
|
|
|
|
|
if (!$user = $userService->findUserByAddress($request->getClientIp())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$user = $userService->addUser( |
|
|
|
|
|
|
|
$request->getClientIp(), |
|
|
|
|
|
|
|
time(), |
|
|
|
|
|
|
|
$this->getParameter('app.locale'), |
|
|
|
|
|
|
|
explode('|', $this->getParameter('app.locales')), |
|
|
|
|
|
|
|
$this->getParameter('app.theme') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
|
|
|
$user->getId(), |
|
|
|
|
|
|
|
time() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $user; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|