namespace App\Http\Controllers\Admin\Operations\FluidbookPublication;
use App\Fluidbook\Packager\Download;
+use App\Http\Middleware\CheckIfAdmin;
use App\Models\FluidbookPublication;
use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
use Illuminate\Support\Facades\Route;
{
Route::match(['get'], $segment . '/{id}/delivery', $controller . '@delivery');
Route::match(['get'], $segment . '/{id}/package/{action}/{version}', $controller . '@package');
- Route::match(['get'], $segment . '/{id}/download/{file}', $controller . '@download');
+ Route::match(['get'], $segment . '/{id}_{hash}/download/{file}', $controller . '@download')->withoutMiddleware([CheckIfAdmin::class]);;
}
protected function setupDownloadDefaults()
}
}
- protected function download($id, $file)
+ protected function download($id, $hash, $file)
{
$e = explode('-', $file);
if ($e[1] != $id) {
abort(404, __('Erreur de correspondance du fichier'));
}
- if (!FluidbookPublication::hasPermission($id)) {
- abort(401, __('Ce fichier ne peut pas être téléchargée'));
+ $fluidbook = FluidbookPublication::where('id', $id)->where('hash', $hash)->first();
+ if (null === $fluidbook) {
+ abort(404, __('Ce fichier est indisponible'));
}
$path = protected_path('fluidbookpublication/packager/download/' . $file);
if (!file_exists($path)) {
}
}
if(can('fluibook-publication:download:install-hosting') && ($entry->install_online || $entry->scorm_enable)){
- $actions['sep_install']='---------';
- if($entry->install_online && $entry->install_online->server){
+
+ $installActions['sep_install']='---------';
+ if($entry->install_online && $entry->install_online->server && isset($servers[$entry->install_online->server])){
+
$server=$servers[$entry->install_online->server];
if($entry->install_online->path || $server['allows_root']){
- $actions['install_online']=[
+ $installActions['install_online']=[
'label'=>__('Installer sur le serveur :server',['server'=>'<strong>'.$server['name'].'</strong>']).' <span class="small"><span class="grey">'.$server['base_url'].'</span>'.$entry->install_online->path.'</span>',
'url'=> $basePackage.'/install/online',
];
}
if($entry->scorm_enable){
- $actions['scormcloud']=['label'=>__('Tester sur SCORM Cloud'),
+ $installActions['scormcloud']=['label'=>__('Tester sur SCORM Cloud'),
'url'=> $basePackage.'/scormcloud/scorm'
];
}
+ if(count($installActions)>1){
+ $actions=array_merge($actions,$installActions);
+ }
}
@endphp