use Cubist\Util\CommandLine;
use Cubist\Util\Files\Files;
use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Artisan;
class Migration extends Command
{
// Sync S3
`rclone sync olds3:prescription-sante s3:presquot`;
`rclone sync olds3:prescription-sante/flowpaper/ /application/storage/app/flowpaper/`;
+
+ Artisan::call('psq:fluidbook:archives');
}
}
--- /dev/null
+<?php
+
+namespace App\Console\Commands;
+
+use A17\Twill\Repositories\SettingRepository;
+use App\PdfFile;
+use Fluidbook\ToolboxApiClient\Client;
+use Illuminate\Console\Command;
+
+class UpdateDemoFluidbook extends Command
+{
+ protected $signature = 'psq:fluidbook:updatedemo';
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+
+ public function handle()
+ {
+ $client = new Client(config('fluidbook.api_token'));
+ foreach (PdfFile::where('created_at', '<', now()->subDays(30))->orderBy('created_at', 'desc')->get() as $pdf) {
+ $fluidbook = $client->getFluidbookByReference($pdf->slug);
+ if ($fluidbook->pages <= 3) {
+ continue;
+ }
+
+ /** @var SettingRepository $sr */
+ $sr = app(SettingRepository::class);
+ dd($sr->where('key', 'fluidbook_demo_ref')->with('translations')->first()->forceFill(['value'=> $pdf->slug])->save());
+ break;
+ }
+ }
+}
return $this->index('strings');
}
- public function podcasts()
- {
- return $this->index('podcasts');
- }
-
-
}
class FluidbookController extends Controller
{
-
-
/**
* @param PdfFile $file
* @param Request $request
*/
public function view(PdfFile $file, string $path = '')
{
+ $this->authorize('view', $file);
// Add trailing slash if needed
$request = request();
if ($request->getPathInfo() === '/view/' . $file->slug) {
}
return $file->view();
}
-
- /**
- * @param PdfFile $file
- * @param Request $request
- * @return \Symfony\Component\HttpFoundation\StreamedResponse
- */
- public function download(PdfFile $file, Request $request)
- {
- if (!$request->hasValidSignature()) {
- abort(401);
- }
- return $file->getFinalVersion()->downloadFile();
- }
-
-
}
public function register()
{
- $this->app->singleton(Mailgun::class, function ($app) {
- return Mailgun::create(config('mail.mailgun.api_key'), 'https://api.eu.mailgun.net');
- });
-
- $this->app->singleton(Client::class, function ($app) {
- return Client::prepare(
- env('TIKA_HOST', 'localhost'),
- env('TIKA_PORT', 9998)
- );
- });
-
$this->app->bind(HtmlConverter::class, function ($app) {
return new HtmlConverter(['header_style' => 'atx']);
});
Stripe::setApiKey(config('cashier.secret'));
Paginator::useBootstrap();
-
-
}
PdfFile::observe(PdfFileObserver::class);
User::observe(UserObserver::class);
- Blade::if('fuckIE', function () {
- if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
- return true;
- }
-
- $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
-
- return preg_match('~MSIE|Internet Explorer~i', $HTTP_USER_AGENT) ||
- preg_match('~Trident/7.0(.*)?; rv:11.0~', $HTTP_USER_AGENT);
- });
-
\View::share('theme', 'logo-blue');
}
'required' => true,
])
+ @formField('input',[
+ 'label'=>'Fluidbook de démo',
+ 'name'=>'fluidbook_demo_ref',
+ 'maxlength'=>30,
+ 'required'=>true,
+ ])
+
<h2>Mentions légales</h2>
@formField('wysiwyg', [
</div>
</header>
- @fuckIE
- <div class="container">
-
- <div class="alert alert-danger" style="font-size: larger;">
- Attention ! Nous avons remarqué que vous utilisez un navigateur obsolète. Pour une expérience optimale,
- merci d'utiliser un navigateur récent tel que Chrome, Edge, Firefox ou Safari.
- </div>
- </div>
-
- @endif
-
<main class="{{ in_array(Route::currentRouteName(), ["login","register","account.index","password.request"]) ? 'bg-white-to-blue' : '' }} pill-box-theme-{{$theme ?? 'logo-blue'}}">
@yield('content')
</main>