Beispiel #1
0
 /**
  * @return string
  */
 public function getDetails()
 {
     if ($this->details === null) {
         $pageTitle = $this->stringFormatter->makeStringUrlSafe($this->title->getPageTitle());
         $this->details = $this->request->getModule() . '-' . $this->request->getController() . '-' . $pageTitle;
     }
     return $this->details;
 }
Beispiel #2
0
 /**
  * @return JsonResponse
  */
 public function execute()
 {
     $response = [];
     if ($this->request->getPost()->count() > 0) {
         $formData = $this->request->getPost()->all();
         if (!empty($formData['title'])) {
             $alias = $this->stringFormatter->makeStringUrlSafe($formData['title']);
             if (!empty($formData['prefix'])) {
                 $alias = $this->stringFormatter->makeStringUrlSafe($formData['prefix']) . '/' . $alias;
             }
             $response = ['alias' => $alias];
         }
     }
     return new JsonResponse($response);
 }
Beispiel #3
0
 /**
  * @param int $id
  * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  * @throws Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id)
 {
     if ($this->filesRepository->resultExists($id, $this->date->getCurrentDateTime()) === true) {
         $file = $this->filesCache->getCache($id);
         $path = $this->appPath->getUploadsDir() . 'files/';
         if (is_file($path . $file['file'])) {
             $ext = strrchr($file['file'], '.');
             $filename = $this->stringFormatter->makeStringUrlSafe($file['title']) . $ext;
             $response = new BinaryFileResponse($path . $file['file']);
             $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename);
             return $response;
         } elseif (preg_match('/^([a-z]+):\\/\\//', $file['file'])) {
             // External file
             return $this->redirect()->toNewPage($file['file']);
         }
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }