public.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /** @var \OCP\IL10N $l */
  3. /** @var array $_ */
  4. ?>
  5. <div id="app-content" tabindex="0">
  6. <?php if ($_['previewSupported']): /* This enables preview images for links (e.g. on Facebook, Google+, ...)*/?>
  7. <link rel="image_src" href="<?php p($_['previewImage']); ?>" />
  8. <?php endif; ?>
  9. <input type="hidden" id="sharingUserId" value="<?php p($_['owner']) ?>">
  10. <input type="hidden" id="filesApp" name="filesApp" value="1">
  11. <input type="hidden" id="isPublic" name="isPublic" value="1">
  12. <?php if (!$_['hideDownload']): ?>
  13. <input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
  14. <?php endif; ?>
  15. <input type="hidden" name="previewURL" value="<?php p($_['previewURL']) ?>" id="previewURL">
  16. <input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken">
  17. <input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename">
  18. <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype">
  19. <input type="hidden" name="previewSupported" value="<?php p($_['previewSupported'] ? 'true' : 'false'); ?>" id="previewSupported">
  20. <input type="hidden" name="mimetypeIcon" value="<?php p(\OC::$server->getMimeTypeDetector()->mimeTypeIcon($_['mimetype'])); ?>" id="mimetypeIcon">
  21. <input type="hidden" name="hideDownload" value="<?php p($_['hideDownload'] ? 'true' : 'false'); ?>" id="hideDownload">
  22. <input type="hidden" id="disclaimerText" value="<?php p($_['disclaimer']) ?>">
  23. <?php
  24. $upload_max_filesize = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('upload_max_filesize');
  25. $post_max_size = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('post_max_size');
  26. $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
  27. ?>
  28. <input type="hidden" name="maxFilesizeUpload" value="<?php p($maxUploadFilesize); ?>" id="maxFilesizeUpload">
  29. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)): ?>
  30. <input type="hidden" name="filesize" value="<?php p($_['nonHumanFileSize']); ?>" id="filesize">
  31. <?php endif; ?>
  32. <input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif">
  33. <?php if (isset($_['note']) && $_['note'] !== '') : ?>
  34. <div id="notemenu" class="hidden">
  35. <div class="icon-comment-white menutoggle" tabindex="0" role="button" aria-haspopup="true" aria-controls="note-content" aria-expanded="false">
  36. <span class="hidden-visually"><?php p($l->t('Share note'))?></span>
  37. </div>
  38. <div id="note-content" class="menu" aria-label="Note content">
  39. <div class="content">
  40. <?php p($_['note']); ?>
  41. </div>
  42. </div>
  43. </div>
  44. <?php endif; ?>
  45. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
  46. <!-- ONLY if this is a folder, we show the grid toggle button -->
  47. <?php if (empty($_['dir']) === false) { ?>
  48. <input type="checkbox" class="hidden-visually" id="showgridview"
  49. <?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
  50. <label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
  51. title="<?php p($_['showgridview'] ? $l->t('Show list view') : $l->t('Show grid view'))?>"></label>
  52. <?php } ?>
  53. <!-- files listing -->
  54. <div id="files-public-content">
  55. <div id="preview">
  56. <?php if (isset($_['folder'])): ?>
  57. <?php print_unescaped($_['folder']); ?>
  58. <?php else: ?>
  59. <!-- preview frame to open file in with viewer -->
  60. <div id="imgframe"></div>
  61. <?php if (isset($_['mimetype']) && strpos($_['mimetype'], 'image') === 0): ?>
  62. <div class="directDownload">
  63. <div>
  64. <?php p($_['filename'])?> (<?php p($_['fileSize']) ?>)
  65. </div>
  66. <?php if (!$_['hideDownload']) { ?>
  67. <a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
  68. <span class="icon icon-download"></span>
  69. <?php p($l->t('Download'))?>
  70. </a>
  71. <?php } ?>
  72. </div>
  73. <?php elseif ($_['previewURL'] === $_['downloadURL'] && !$_['hideDownload']): ?>
  74. <div class="directDownload">
  75. <div>
  76. <?php p($_['filename'])?>&nbsp;(<?php p($_['fileSize']) ?>)
  77. </div>
  78. <a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
  79. <span class="icon icon-download"></span>
  80. <?php p($l->t('Download'))?>
  81. </a>
  82. </div>
  83. <?php endif; ?>
  84. <?php endif; ?>
  85. </div>
  86. </div>
  87. <?php } else { ?>
  88. <input type="hidden" id="upload-only-interface" value="1"/>
  89. <div id="public-upload">
  90. <div
  91. id="emptycontent"
  92. class="emptycontent <?php if (!empty($_['note'])) { ?>has-note<?php } ?>">
  93. <?php if ($_['shareOwner']) { ?>
  94. <div id="displayavatar"><div class="avatardiv"></div></div>
  95. <h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
  96. <p><span class="icon-folder"></span> <?php p($_['filename']) ?></p>
  97. <?php } else { ?>
  98. <div id="displayavatar"><span class="icon-folder"></span></div>
  99. <h2><?php p($l->t('Upload files to %s', [$_['filename']])) ?></h2>
  100. <?php } ?>
  101. <?php if (empty($_['note']) === false) { ?>
  102. <h3><?php p($l->t('Note')); ?></h3>
  103. <p class="note"><?php p($_['note']); ?></p>
  104. <?php } ?>
  105. <input type="file" name="files[]" class="hidden" multiple>
  106. <a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a>
  107. <div id="drop-upload-progress-indicator" style="padding-top: 25px;" class="hidden"><span class="icon-loading-small"></span><?php p($l->t('Uploading files')) ?></div>
  108. <div id="drop-upload-done-indicator" style="padding-top: 25px;" class="hidden"><?php p($l->t('Uploaded files:')) ?></div>
  109. <ul id="drop-uploaded-files"></ul>
  110. <?php if (!empty($_['disclaimer'])) { ?>
  111. <div>
  112. <?php
  113. echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
  114. '<span id="show-terms-dialog">', '</span>'
  115. ]);
  116. ?>
  117. </div>
  118. <?php } ?>
  119. </div>
  120. </div>
  121. <?php } ?>
  122. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] !== true)): ?>
  123. <div class="hiddenuploadfield">
  124. <input type="file" id="file_upload_start" class="hiddenuploadfield" name="files[]"
  125. data-url="<?php p(\OC::$server->getURLGenerator()->linkTo('files', 'ajax/upload.php')); ?>" />
  126. </div>
  127. <?php endif; ?>
  128. </div>