public.php 6.4 KB

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