public.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. /** @var \OCP\IL10N $l */
  3. /** @var array $_ */
  4. ?>
  5. <div id="app-content">
  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. <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
  13. <?php if (!$_['hideDownload']): ?>
  14. <input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
  15. <?php endif; ?>
  16. <input type="hidden" name="previewURL" value="<?php p($_['previewURL']) ?>" id="previewURL">
  17. <input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken">
  18. <input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename">
  19. <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype">
  20. <input type="hidden" name="previewSupported" value="<?php p($_['previewSupported'] ? 'true' : 'false'); ?>" id="previewSupported">
  21. <input type="hidden" name="mimetypeIcon" value="<?php p(\OC::$server->getMimeTypeDetector()->mimeTypeIcon($_['mimetype'])); ?>" id="mimetypeIcon">
  22. <input type="hidden" name="hideDownload" value="<?php p($_['hideDownload'] ? 'true' : 'false'); ?>" id="hideDownload">
  23. <input type="hidden" id="disclaimerText" value="<?php p($_['disclaimer']) ?>">
  24. <?php
  25. $upload_max_filesize = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('upload_max_filesize');
  26. $post_max_size = OC::$server->get(\bantu\IniGetWrapper\IniGetWrapper::class)->getBytes('post_max_size');
  27. $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
  28. ?>
  29. <input type="hidden" name="maxFilesizeUpload" value="<?php p($maxUploadFilesize); ?>" id="maxFilesizeUpload">
  30. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)): ?>
  31. <input type="hidden" name="filesize" value="<?php p($_['nonHumanFileSize']); ?>" id="filesize">
  32. <?php endif; ?>
  33. <input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif">
  34. <?php if (isset($_['note']) && $_['note'] !== '') : ?>
  35. <div id="notemenu" class="hidden">
  36. <div class="icon-comment-white menutoggle" tabindex="0" role="button" aria-haspopup="true" aria-controls="note-content" aria-expanded="false">
  37. <span class="hidden-visually"><?php p($l->t('Share note'))?></span>
  38. </div>
  39. <div id="note-content" class="menu" aria-label="Note content">
  40. <div class="content">
  41. <?php p($_['note']); ?>
  42. </div>
  43. </div>
  44. </div>
  45. <?php endif; ?>
  46. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
  47. <!-- ONLY if this is a folder, we show the grid toggle button -->
  48. <?php if (empty($_['dir']) === false) { ?>
  49. <input type="checkbox" class="hidden-visually" id="showgridview"
  50. <?php if ($_['showgridview']) { ?>checked="checked" <?php } ?>/>
  51. <label id="view-toggle" for="showgridview" class="button <?php p($_['showgridview'] ? 'icon-toggle-filelist' : 'icon-toggle-pictures') ?>"
  52. title="<?php p($l->t('Toggle grid view'))?>"></label>
  53. <?php } ?>
  54. <!-- files listing -->
  55. <div id="files-public-content">
  56. <div id="preview">
  57. <?php if (isset($_['folder'])): ?>
  58. <?php print_unescaped($_['folder']); ?>
  59. <?php else: ?>
  60. <?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'audio'): ?>
  61. <div id="imgframe">
  62. <audio tabindex="0" controls="" preload="none" style="width: 100%; max-width: <?php p($_['previewMaxX']); ?>px; max-height: <?php p($_['previewMaxY']); ?>px"
  63. <?php // See https://github.com/nextcloud/server/pull/27674?>
  64. <?php if ($_['hideDownload']) { ?>controlsList="nodownload" <?php } ?>>
  65. <source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
  66. </audio>
  67. </div>
  68. <?php else: ?>
  69. <!-- Preview frame is filled via JS to support SVG images for modern browsers -->
  70. <div id="imgframe"></div>
  71. <?php if (isset($_['mimetype']) && strpos($_['mimetype'], 'image') === 0) { ?>
  72. <div class="directDownload">
  73. <div>
  74. <?php p($_['filename'])?> (<?php p($_['fileSize']) ?>)
  75. </div>
  76. <?php if (!$_['hideDownload']) { ?>
  77. <a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
  78. <span class="icon icon-download"></span>
  79. <?php p($l->t('Download'))?>
  80. </a>
  81. <?php } ?>
  82. </div>
  83. <?php } ?>
  84. <?php endif; ?>
  85. <?php if ($_['previewURL'] === $_['downloadURL'] && !$_['hideDownload']): ?>
  86. <div class="directDownload">
  87. <div>
  88. <?php p($_['filename'])?>&nbsp;(<?php p($_['fileSize']) ?>)
  89. </div>
  90. <a href="<?php p($_['downloadURL']); ?>" id="downloadFile" class="button">
  91. <span class="icon icon-download"></span>
  92. <?php p($l->t('Download'))?>
  93. </a>
  94. </div>
  95. <?php endif; ?>
  96. <?php endif; ?>
  97. </div>
  98. </div>
  99. <?php } else { ?>
  100. <input type="hidden" id="upload-only-interface" value="1"/>
  101. <div id="public-upload">
  102. <div
  103. id="emptycontent"
  104. class="<?php if (!empty($_['note'])) { ?>has-note<?php } ?>">
  105. <?php if ($_['shareOwner']) { ?>
  106. <div id="displayavatar"><div class="avatardiv"></div></div>
  107. <h2><?php p($l->t('Upload files to %s', [$_['shareOwner']])) ?></h2>
  108. <p><span class="icon-folder"></span> <?php p($_['filename']) ?></p>
  109. <?php } else { ?>
  110. <div id="displayavatar"><span class="icon-folder"></span></div>
  111. <h2><?php p($l->t('Upload files to %s', [$_['filename']])) ?></h2>
  112. <?php } ?>
  113. <?php if (empty($_['note']) === false) { ?>
  114. <h3><?php p($l->t('Note')); ?></h3>
  115. <p class="note"><?php p($_['note']); ?></p>
  116. <?php } ?>
  117. <input type="file" name="files[]" class="hidden" multiple>
  118. <a href="#" class="button icon-upload"><?php p($l->t('Select or drop files')) ?></a>
  119. <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>
  120. <div id="drop-upload-done-indicator" style="padding-top: 25px;" class="hidden"><?php p($l->t('Uploaded files:')) ?></div>
  121. <ul id="drop-uploaded-files"></ul>
  122. <?php if (!empty($_['disclaimer'])) { ?>
  123. <div>
  124. <?php
  125. echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
  126. '<span id="show-terms-dialog">', '</span>'
  127. ]);
  128. ?>
  129. </div>
  130. <?php } ?>
  131. </div>
  132. </div>
  133. <?php } ?>
  134. <?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] !== true)): ?>
  135. <input type="hidden" name="dir" id="dir" value="" />
  136. <div class="hiddenuploadfield">
  137. <input type="file" id="file_upload_start" class="hiddenuploadfield" name="files[]"
  138. data-url="<?php p(\OC::$server->getURLGenerator()->linkTo('files', 'ajax/upload.php')); ?>" />
  139. </div>
  140. <?php endif; ?>
  141. </div>