fork download
  1. <?php
  2. use \FileHosting\Models;
  3. use \FileHosting\Helpers\Helper;
  4.  
  5. $app->get('/[upload]', function ($request, $response, $args) {
  6. $this->logger->info("Главная страница");
  7. $args['project_folder']=$this->settings['project_folder'];
  8.  
  9. return $this->view->render($response, 'upload.html', $args);
  10. })->setName('main');
  11.  
  12.  
  13. $app->post('/upload', function ($request, $response, $args) {
  14. $this->logger->info("Кнопка: отправить файл");
  15. $args['project_folder']=$this->settings['project_folder'];
  16.  
  17. //Создаём объект FileModel
  18. $file=new Models\FileModel();
  19.  
  20. $file->setName($_FILES['file_to_upload']['name']);
  21. $file->size=$_FILES['file_to_upload']['size'];
  22. $file->comment=$_POST['comment'];
  23.  
  24. //Копируем файл на сервер
  25. $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);
  26. //Записываем в БД
  27. if ($args['status']) {
  28. $this->filesGW->addFile($file);
  29. }
  30.  
  31. //Представление
  32. return $this->view->render($response, 'upload.html', $args);
  33. });
  34.  
  35.  
  36. $app->get('/files_list', function ($request, $response, $args){
  37. $this->logger->info("Страница последних загрузок");
  38. $args['project_folder']=$this->settings['project_folder'];
  39.  
  40. $args['upload_folder']=$this->settings['upload_folder'];
  41. $args['files']=$this->filesGW->getLastFiles(100);
  42.  
  43. return $this->view->render($response, 'files_list.html', $args);
  44. })->setName('files_list');
  45.  
  46.  
  47.  
  48. $app->get('/show_file/{id}', function ($request, $response, $args){
  49. $this->logger->info("Просмотр файла");
  50. $args['project_folder']=$this->settings['project_folder'];
  51.  
  52. $args['upload_folder']=$this->settings['upload_folder'];
  53. $args['file']=$this->filesGW->getFile($args['id']);
  54.  
  55. return $this->view->render($response, 'show_file.html', $args);
  56. })->setName('show_file');
  57.  
  58.  
  59.  
  60.  
  61.  
  62. $app->get('/download/{id}', function ($request, $response, $args) {
  63. $this->logger->info("Загрузка файла");
  64. $args['project_folder']=$this->settings['project_folder'];
  65.  
  66. $file=$this->filesGW->getFile($args['id']);
  67.  
  68. $url=$this->settings['upload_folder'];
  69. $url.=$file->path;
  70. $url.=$file->name;
  71.  
  72. $response = $response->withHeader('Content-Disposition', 'attachment');
  73. $response = $response->withHeader('Location', $url);
  74. return $this->view->render($response, 'download.html', $args);
  75. })->setName('download');
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
<?php
^
Main.java:1: error: class, interface, or enum expected
<?php
 ^
Main.java:1: error: class, interface, or enum expected
<?php
  ^
Main.java:2: error: illegal character: '\'
use \FileHosting\Models;
    ^
Main.java:2: error: illegal character: '\'
use \FileHosting\Models;
                ^
Main.java:3: error: illegal character: '\'
use \FileHosting\Helpers\Helper;
    ^
Main.java:3: error: illegal character: '\'
use \FileHosting\Helpers\Helper;
                ^
Main.java:3: error: illegal character: '\'
use \FileHosting\Helpers\Helper;
                        ^
Main.java:5: error: class, interface, or enum expected
$app->get('/[upload]', function ($request, $response, $args) {
^
Main.java:5: error: unclosed character literal
$app->get('/[upload]', function ($request, $response, $args) {
          ^
Main.java:5: error: unclosed character literal
$app->get('/[upload]', function ($request, $response, $args) {
                    ^
Main.java:7: error: class, interface, or enum expected
    $args['project_folder']=$this->settings['project_folder'];
    ^
Main.java:7: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
          ^
Main.java:7: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                         ^
Main.java:7: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                            ^
Main.java:7: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                                           ^
Main.java:9: error: class, interface, or enum expected
    return $this->view->render($response, 'upload.html', $args);
    ^
Main.java:9: error: unclosed character literal
    return $this->view->render($response, 'upload.html', $args);
                                          ^
Main.java:9: error: unclosed character literal
    return $this->view->render($response, 'upload.html', $args);
                                                      ^
Main.java:10: error: class, interface, or enum expected
})->setName('main');
^
Main.java:10: error: unclosed character literal
})->setName('main');
            ^
Main.java:10: error: unclosed character literal
})->setName('main');
                 ^
Main.java:13: error: class, interface, or enum expected
$app->post('/upload', function ($request, $response, $args) {
^
Main.java:13: error: unclosed character literal
$app->post('/upload', function ($request, $response, $args) {
           ^
Main.java:13: error: unclosed character literal
$app->post('/upload', function ($request, $response, $args) {
                   ^
Main.java:15: error: class, interface, or enum expected
    $args['project_folder']=$this->settings['project_folder'];
    ^
Main.java:15: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
          ^
Main.java:15: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                         ^
Main.java:15: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                            ^
Main.java:15: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                                           ^
Main.java:18: error: class, interface, or enum expected
    $file=new Models\FileModel();
    ^
Main.java:18: error: illegal character: '\'
    $file=new Models\FileModel();
                    ^
Main.java:20: error: class, interface, or enum expected
    $file->setName($_FILES['file_to_upload']['name']);
    ^
Main.java:20: error: unclosed character literal
    $file->setName($_FILES['file_to_upload']['name']);
                           ^
Main.java:20: error: unclosed character literal
    $file->setName($_FILES['file_to_upload']['name']);
                                          ^
Main.java:20: error: unclosed character literal
    $file->setName($_FILES['file_to_upload']['name']);
                                             ^
Main.java:20: error: unclosed character literal
    $file->setName($_FILES['file_to_upload']['name']);
                                                  ^
Main.java:21: error: class, interface, or enum expected
    $file->size=$_FILES['file_to_upload']['size'];
    ^
Main.java:21: error: unclosed character literal
    $file->size=$_FILES['file_to_upload']['size'];
                        ^
Main.java:21: error: unclosed character literal
    $file->size=$_FILES['file_to_upload']['size'];
                                       ^
Main.java:21: error: unclosed character literal
    $file->size=$_FILES['file_to_upload']['size'];
                                          ^
Main.java:21: error: unclosed character literal
    $file->size=$_FILES['file_to_upload']['size'];
                                               ^
Main.java:22: error: class, interface, or enum expected
    $file->comment=$_POST['comment'];
    ^
Main.java:22: error: unclosed character literal
    $file->comment=$_POST['comment'];
                          ^
Main.java:22: error: unclosed character literal
    $file->comment=$_POST['comment'];
                                  ^
Main.java:25: error: class, interface, or enum expected
    $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);  
    ^
Main.java:25: error: unclosed character literal
    $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);  
          ^
Main.java:25: error: unclosed character literal
    $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);  
                 ^
Main.java:25: error: unclosed character literal
    $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);  
                                                                  ^
Main.java:25: error: unclosed character literal
    $args['status']=$this->filesFM->addFile($file,$this->settings['upload_folder']);  
                                                                                ^
Main.java:27: error: class, interface, or enum expected
    if ($args['status']) {
    ^
Main.java:27: error: unclosed character literal
    if ($args['status']) {
              ^
Main.java:27: error: unclosed character literal
    if ($args['status']) {
                     ^
Main.java:29: error: class, interface, or enum expected
    }
    ^
Main.java:32: error: unclosed character literal
    return $this->view->render($response, 'upload.html', $args);
                                          ^
Main.java:32: error: unclosed character literal
    return $this->view->render($response, 'upload.html', $args);
                                                      ^
Main.java:33: error: class, interface, or enum expected
});
^
Main.java:36: error: class, interface, or enum expected
$app->get('/files_list', function ($request, $response, $args){
^
Main.java:36: error: unclosed character literal
$app->get('/files_list', function ($request, $response, $args){
          ^
Main.java:36: error: unclosed character literal
$app->get('/files_list', function ($request, $response, $args){
                      ^
Main.java:38: error: class, interface, or enum expected
    $args['project_folder']=$this->settings['project_folder'];
    ^
Main.java:38: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
          ^
Main.java:38: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                         ^
Main.java:38: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                            ^
Main.java:38: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                                           ^
Main.java:40: error: class, interface, or enum expected
    $args['upload_folder']=$this->settings['upload_folder'];
    ^
Main.java:40: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
          ^
Main.java:40: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                        ^
Main.java:40: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                                           ^
Main.java:40: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                                                         ^
Main.java:41: error: class, interface, or enum expected
    $args['files']=$this->filesGW->getLastFiles(100);
    ^
Main.java:41: error: unclosed character literal
    $args['files']=$this->filesGW->getLastFiles(100);
          ^
Main.java:41: error: unclosed character literal
    $args['files']=$this->filesGW->getLastFiles(100);
                ^
Main.java:43: error: class, interface, or enum expected
    return $this->view->render($response, 'files_list.html', $args);
    ^
Main.java:43: error: unclosed character literal
    return $this->view->render($response, 'files_list.html', $args);
                                          ^
Main.java:43: error: unclosed character literal
    return $this->view->render($response, 'files_list.html', $args);
                                                          ^
Main.java:44: error: class, interface, or enum expected
})->setName('files_list');
^
Main.java:44: error: unclosed character literal
})->setName('files_list');
            ^
Main.java:44: error: unclosed character literal
})->setName('files_list');
                       ^
Main.java:48: error: class, interface, or enum expected
$app->get('/show_file/{id}', function ($request, $response, $args){
^
Main.java:48: error: unclosed character literal
$app->get('/show_file/{id}', function ($request, $response, $args){
          ^
Main.java:48: error: unclosed character literal
$app->get('/show_file/{id}', function ($request, $response, $args){
                          ^
Main.java:50: error: class, interface, or enum expected
    $args['project_folder']=$this->settings['project_folder'];
    ^
Main.java:50: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
          ^
Main.java:50: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                         ^
Main.java:50: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                            ^
Main.java:50: error: unclosed character literal
    $args['project_folder']=$this->settings['project_folder'];
                                                           ^
Main.java:52: error: class, interface, or enum expected
    $args['upload_folder']=$this->settings['upload_folder'];
    ^
Main.java:52: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
          ^
Main.java:52: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                        ^
Main.java:52: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                                           ^
Main.java:52: error: unclosed character literal
    $args['upload_folder']=$this->settings['upload_folder'];
                                                         ^
Main.java:53: error: class, interface, or enum expected
    $args['file']=$this->filesGW->getFile($args['id']);
    ^
Main.java:53: error: unclosed character literal
    $args['file']=$this->filesGW->getFile($args['id']);
          ^
Main.java:53: error: unclosed character literal
    $args['file']=$this->filesGW->getFile($args['id']);
               ^
Main.java:53: error: unclosed character literal
    $args['file']=$this->filesGW->getFile($args['id']);
                                                ^
Main.java:53: error: unclosed character literal
    $args['file']=$this->filesGW->getFile($args['id']);
                                                   ^
Main.java:55: error: class, interface, or enum expected
    return $this->view->render($response, 'show_file.html', $args);
    ^
Main.java:55: error: unclosed character literal
    return $this->view->render($response, 'show_file.html', $args);
                                          ^
Main.java:55: error: unclosed character literal
    return $this->view->render($response, 'show_file.html', $args);
                                                         ^
100 errors
stdout
Standard output is empty