|
|
|
@ -37,22 +37,11 @@ class TorrentController extends AbstractController
@@ -37,22 +37,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
@ -198,22 +187,11 @@ class TorrentController extends AbstractController
@@ -198,22 +187,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
@ -372,22 +350,11 @@ class TorrentController extends AbstractController
@@ -372,22 +350,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
@ -578,22 +545,11 @@ class TorrentController extends AbstractController
@@ -578,22 +545,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
@ -675,23 +631,12 @@ class TorrentController extends AbstractController
@@ -675,23 +631,12 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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') |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
$user->getId(), |
|
|
|
|
time() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
|
{ |
|
|
|
@ -765,23 +710,12 @@ class TorrentController extends AbstractController
@@ -765,23 +710,12 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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') |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
$user->getId(), |
|
|
|
|
time() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
|
// @TODO |
|
|
|
@ -941,22 +875,11 @@ class TorrentController extends AbstractController
@@ -941,22 +875,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
@ -1038,23 +961,12 @@ class TorrentController extends AbstractController
@@ -1038,23 +961,12 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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') |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
$user->getId(), |
|
|
|
|
time() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
if (!$torrent = $torrentService->getTorrent($request->get('torrentId'))) |
|
|
|
|
{ |
|
|
|
@ -1122,23 +1034,12 @@ class TorrentController extends AbstractController
@@ -1122,23 +1034,12 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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') |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Add user join event |
|
|
|
|
$activityService->addEventUserAdd( |
|
|
|
|
$user->getId(), |
|
|
|
|
time() |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
|
// @TODO |
|
|
|
@ -1211,22 +1112,11 @@ class TorrentController extends AbstractController
@@ -1211,22 +1112,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
@ -1327,22 +1217,11 @@ class TorrentController extends AbstractController
@@ -1327,22 +1217,11 @@ class TorrentController extends AbstractController
|
|
|
|
|
): Response |
|
|
|
|
{ |
|
|
|
|
// 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() |
|
|
|
|
$user = $this->initUser( |
|
|
|
|
$request, |
|
|
|
|
$userService, |
|
|
|
|
$activityService |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$user->isStatus()) |
|
|
|
|
{ |
|
|
|
@ -1414,4 +1293,31 @@ class TorrentController extends AbstractController
@@ -1414,4 +1293,31 @@ class TorrentController extends AbstractController
|
|
|
|
|
// Render response |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|