You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
735 B
29 lines
735 B
<?php
|
|
|
|
/* For license terms, see /license.txt */
|
|
|
|
use Chamilo\PluginBundle\Entity\TopLinks\TopLink;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
|
|
require_once __DIR__.'/../../main/inc/global.inc.php';
|
|
|
|
api_protect_course_script(true);
|
|
api_block_anonymous_users();
|
|
|
|
$plugin = TopLinksPlugin::create();
|
|
$httpRequest = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
|
|
|
|
$em = Database::getManager();
|
|
|
|
$link = $em->find(TopLink::class, $httpRequest->query->getInt('link'));
|
|
|
|
if (null === $link) {
|
|
Display::addFlash(
|
|
Display::return_message(get_lang('NotFound'), 'error')
|
|
);
|
|
|
|
RedirectResponse::create(api_get_course_url())->send();
|
|
exit;
|
|
}
|
|
|
|
RedirectResponse::create($link->getUrl())->send();
|
|
|