|
|
@ -43,6 +43,9 @@ class ActivityController extends AbstractController |
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/list.html.twig', |
|
|
|
'default/activity/list.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
|
|
|
|
|
'session' => [ |
|
|
|
|
|
|
|
'user' => $user |
|
|
|
|
|
|
|
], |
|
|
|
'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters |
|
|
|
'activities' => $activityService->findLastActivities( // @TODO locale/sensitive filters |
|
|
|
$user->getEvents(), |
|
|
|
$user->getEvents(), |
|
|
|
$this->getParameter('app.pagination'), |
|
|
|
$this->getParameter('app.pagination'), |
|
|
@ -59,7 +62,8 @@ class ActivityController extends AbstractController |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function event( |
|
|
|
public function event( |
|
|
|
$activity, |
|
|
|
\App\Entity\User $user, |
|
|
|
|
|
|
|
\App\Entity\Activity $activity, |
|
|
|
ActivityService $activityService, |
|
|
|
ActivityService $activityService, |
|
|
|
UserService $userService, |
|
|
|
UserService $userService, |
|
|
|
TorrentService $torrentService, |
|
|
|
TorrentService $torrentService, |
|
|
@ -347,6 +351,12 @@ class ActivityController extends AbstractController |
|
|
|
// Torrent |
|
|
|
// Torrent |
|
|
|
case $activity::EVENT_TORRENT_ADD: |
|
|
|
case $activity::EVENT_TORRENT_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/add.html.twig', |
|
|
|
'default/activity/event/torrent/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -362,10 +372,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -374,6 +396,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_APPROVE_ADD: |
|
|
|
case $activity::EVENT_TORRENT_APPROVE_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/approve/add.html.twig', |
|
|
|
'default/activity/event/torrent/approve/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -389,10 +417,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -401,6 +441,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_APPROVE_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_APPROVE_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/approve/delete.html.twig', |
|
|
|
'default/activity/event/torrent/approve/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -416,10 +462,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -429,6 +487,12 @@ class ActivityController extends AbstractController |
|
|
|
// Torrent Download |
|
|
|
// Torrent Download |
|
|
|
case $activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD: |
|
|
|
case $activity::EVENT_TORRENT_DOWNLOAD_FILE_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/download/file/add.html.twig', |
|
|
|
'default/activity/event/torrent/download/file/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -444,10 +508,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -456,6 +532,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD: |
|
|
|
case $activity::EVENT_TORRENT_DOWNLOAD_MAGNET_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/download/magnet/add.html.twig', |
|
|
|
'default/activity/event/torrent/download/magnet/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -471,10 +553,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -484,6 +578,12 @@ class ActivityController extends AbstractController |
|
|
|
/// Torrent Locales |
|
|
|
/// Torrent Locales |
|
|
|
case $activity::EVENT_TORRENT_LOCALES_ADD: |
|
|
|
case $activity::EVENT_TORRENT_LOCALES_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/locales/add.html.twig', |
|
|
|
'default/activity/event/torrent/locales/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -499,16 +599,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'locales' => [ |
|
|
|
'locales' => [ |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -517,6 +629,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_LOCALES_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_LOCALES_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/locales/delete.html.twig', |
|
|
|
'default/activity/event/torrent/locales/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -532,16 +650,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'locales' => [ |
|
|
|
'locales' => [ |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -550,6 +680,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_LOCALES_APPROVE_ADD: |
|
|
|
case $activity::EVENT_TORRENT_LOCALES_APPROVE_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/locales/approve/add.html.twig', |
|
|
|
'default/activity/event/torrent/locales/approve/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -565,16 +701,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'locales' => [ |
|
|
|
'locales' => [ |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -583,6 +731,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_LOCALES_APPROVE_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_LOCALES_APPROVE_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/locales/approve/delete.html.twig', |
|
|
|
'default/activity/event/torrent/locales/approve/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -598,16 +752,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'locales' => [ |
|
|
|
'locales' => [ |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'id' => $activity->getData()['torrentLocalesId'], |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
'exist' => $torrentService->getTorrentLocales( |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentLocalesId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -617,6 +783,12 @@ class ActivityController extends AbstractController |
|
|
|
/// Torrent Sensitive |
|
|
|
/// Torrent Sensitive |
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_ADD: |
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/sensitive/add.html.twig', |
|
|
|
'default/activity/event/torrent/sensitive/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -632,16 +804,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'sensitive' => [ |
|
|
|
'sensitive' => [ |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -650,6 +834,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/sensitive/delete.html.twig', |
|
|
|
'default/activity/event/torrent/sensitive/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -665,16 +855,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'sensitive' => [ |
|
|
|
'sensitive' => [ |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -683,6 +885,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_ADD: |
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/sensitive/approve/add.html.twig', |
|
|
|
'default/activity/event/torrent/sensitive/approve/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -698,16 +906,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'sensitive' => [ |
|
|
|
'sensitive' => [ |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -716,6 +936,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_SENSITIVE_APPROVE_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/sensitive/approve/delete.html.twig', |
|
|
|
'default/activity/event/torrent/sensitive/approve/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -731,16 +957,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName(), |
|
|
|
)->getName(), |
|
|
|
'sensitive' => [ |
|
|
|
'sensitive' => [ |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'id' => $activity->getData()['torrentSensitiveId'], |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
'exist' => $torrentService->getTorrentSensitive( |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
$activity->getData()['torrentSensitiveId'] // could be deleted by moderator, remove links |
|
|
|
) |
|
|
|
) |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -750,6 +988,12 @@ class ActivityController extends AbstractController |
|
|
|
/// Torrent star |
|
|
|
/// Torrent star |
|
|
|
case $activity::EVENT_TORRENT_STAR_ADD: |
|
|
|
case $activity::EVENT_TORRENT_STAR_ADD: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/star/add.html.twig', |
|
|
|
'default/activity/event/torrent/star/add.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -765,10 +1009,22 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
@ -777,6 +1033,12 @@ class ActivityController extends AbstractController |
|
|
|
|
|
|
|
|
|
|
|
case $activity::EVENT_TORRENT_STAR_DELETE: |
|
|
|
case $activity::EVENT_TORRENT_STAR_DELETE: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init torrent |
|
|
|
|
|
|
|
if (!$torrent = $torrentService->getTorrent($activity->getTorrentId())) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
throw $this->createNotFoundException(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|
'default/activity/event/torrent/star/delete.html.twig', |
|
|
|
'default/activity/event/torrent/star/delete.html.twig', |
|
|
|
[ |
|
|
|
[ |
|
|
@ -792,18 +1054,28 @@ class ActivityController extends AbstractController |
|
|
|
], |
|
|
|
], |
|
|
|
'torrent' => |
|
|
|
'torrent' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $activity->getTorrentId(), |
|
|
|
'id' => $torrent->getId(), |
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
'sensitive' => $torrent->isSensitive(), |
|
|
|
$activity->getTorrentId() |
|
|
|
'approved' => $torrent->isApproved(), |
|
|
|
|
|
|
|
'name' => $torrentService->readTorrentFileByTorrentId( |
|
|
|
|
|
|
|
$torrent->getId() |
|
|
|
)->getName() |
|
|
|
)->getName() |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'session' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'user' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'id' => $user->getId(), |
|
|
|
|
|
|
|
'sensitive' => $user->isSensitive(), |
|
|
|
|
|
|
|
'moderator' => $user->isModerator(), |
|
|
|
|
|
|
|
'owner' => $user->getId() === $torrent->getUserId(), |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// @TODO Page |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
|
|
|
|
|
|
|
|
return $this->render( |
|
|
|
return $this->render( |
|
|
|