|
|
@ -109,12 +109,19 @@ class TorrentController extends AbstractController |
|
|
|
// Poster |
|
|
|
// Poster |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$poster = $request->getScheme() . '://' . |
|
|
|
$torrentPoster = $torrentService->getTorrentPoster( |
|
|
|
|
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$poster = [ |
|
|
|
|
|
|
|
'position' => $torrentPoster->getPosition(), |
|
|
|
|
|
|
|
'url' => $request->getScheme() . '://' . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getBasePath() . |
|
|
|
$request->getBasePath() . |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
$torrentPoster->getId() |
|
|
|
); |
|
|
|
) |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
@ -304,12 +311,19 @@ class TorrentController extends AbstractController |
|
|
|
// Poster |
|
|
|
// Poster |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$poster = $request->getScheme() . '://' . |
|
|
|
$torrentPoster = $torrentService->getTorrentPoster( |
|
|
|
|
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$poster = [ |
|
|
|
|
|
|
|
'position' => $torrentPoster->getPosition(), |
|
|
|
|
|
|
|
'url' => $request->getScheme() . '://' . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getBasePath() . |
|
|
|
$request->getBasePath() . |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
$torrentPoster->getId() |
|
|
|
); |
|
|
|
) |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
@ -484,12 +498,19 @@ class TorrentController extends AbstractController |
|
|
|
// Poster |
|
|
|
// Poster |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
if ($user->isPosters() && $torrent->getTorrentPosterId()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$poster = $request->getScheme() . '://' . |
|
|
|
$torrentPoster = $torrentService->getTorrentPoster( |
|
|
|
|
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$poster = [ |
|
|
|
|
|
|
|
'position' => $torrentPoster->getPosition(), |
|
|
|
|
|
|
|
'url' => $request->getScheme() . '://' . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getHttpHost() . |
|
|
|
$request->getBasePath() . |
|
|
|
$request->getBasePath() . |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrentService->getImageUriByTorrentPosterId( |
|
|
|
$torrent->getTorrentPosterId() |
|
|
|
$torrentPoster->getId() |
|
|
|
); |
|
|
|
) |
|
|
|
|
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
@ -1905,6 +1926,16 @@ class TorrentController extends AbstractController |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Init position |
|
|
|
|
|
|
|
$position = in_array( |
|
|
|
|
|
|
|
$request->get('position'), |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'center', |
|
|
|
|
|
|
|
'top', |
|
|
|
|
|
|
|
'bottom' |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) ? $request->get('position') : 'center'; |
|
|
|
|
|
|
|
|
|
|
|
// Init edition history |
|
|
|
// Init edition history |
|
|
|
$editions = []; |
|
|
|
$editions = []; |
|
|
|
foreach ($torrentService->findTorrentPosterByTorrentId($torrent->getId()) as $torrentPosterEdition) |
|
|
|
foreach ($torrentService->findTorrentPosterByTorrentId($torrent->getId()) as $torrentPosterEdition) |
|
|
@ -1913,6 +1944,7 @@ class TorrentController extends AbstractController |
|
|
|
[ |
|
|
|
[ |
|
|
|
'id' => $torrentPosterEdition->getId(), |
|
|
|
'id' => $torrentPosterEdition->getId(), |
|
|
|
'added' => $torrentPosterEdition->getAdded(), |
|
|
|
'added' => $torrentPosterEdition->getAdded(), |
|
|
|
|
|
|
|
'position' => $torrentPosterEdition->getPosition(), |
|
|
|
'approved' => $torrentPosterEdition->isApproved(), |
|
|
|
'approved' => $torrentPosterEdition->isApproved(), |
|
|
|
'active' => $torrentPosterEdition->getId() == $torrentPosterCurrent['id'], |
|
|
|
'active' => $torrentPosterEdition->getId() == $torrentPosterCurrent['id'], |
|
|
|
'user' => |
|
|
|
'user' => |
|
|
@ -1940,13 +1972,28 @@ class TorrentController extends AbstractController |
|
|
|
'poster' => |
|
|
|
'poster' => |
|
|
|
[ |
|
|
|
[ |
|
|
|
'error' => [] |
|
|
|
'error' => [] |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
'position' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'error' => [], |
|
|
|
|
|
|
|
'attribute' => |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'value' => $position |
|
|
|
|
|
|
|
] |
|
|
|
] |
|
|
|
] |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
// Process request |
|
|
|
// Process request |
|
|
|
if ($request->isMethod('post')) |
|
|
|
if ($request->isMethod('post')) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($file = $request->files->get('poster')) |
|
|
|
if ($request->get('id') && $torrentService->getTorrentPoster($request->get('id'))) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$filename = $torrentService->getStorageFilepathByTorrentPosterId( |
|
|
|
|
|
|
|
$request->get('id') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if ($file = $request->files->get('poster')) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//// Validate poster file |
|
|
|
//// Validate poster file |
|
|
|
if (filesize($file->getPathName()) > $this->getParameter('app.torrent.poster.size.max')) |
|
|
|
if (filesize($file->getPathName()) > $this->getParameter('app.torrent.poster.size.max')) |
|
|
@ -1959,11 +2006,15 @@ class TorrentController extends AbstractController |
|
|
|
{ |
|
|
|
{ |
|
|
|
$form['poster']['error'][] = $translator->trans('Image file not supported'); |
|
|
|
$form['poster']['error'][] = $translator->trans('Image file not supported'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$filename = $file->getPathName(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
$form['poster']['error'][] = $translator->trans('Poster file required'); |
|
|
|
$form['poster']['error'][] = $translator->trans('Poster file required'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$filename = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Request is valid |
|
|
|
// Request is valid |
|
|
@ -1971,7 +2022,8 @@ class TorrentController extends AbstractController |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Save data |
|
|
|
// Save data |
|
|
|
$torrentPoster = $torrentService->addTorrentPoster( |
|
|
|
$torrentPoster = $torrentService->addTorrentPoster( |
|
|
|
$file->getPathName(), |
|
|
|
$filename, |
|
|
|
|
|
|
|
$position, |
|
|
|
$torrent->getId(), |
|
|
|
$torrent->getId(), |
|
|
|
$user->getId(), |
|
|
|
$user->getId(), |
|
|
|
time(), |
|
|
|
time(), |
|
|
|