upload_interface_min.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <?php
  2. include_once '../auth.php';
  3. ?>
  4. <!DOCTYPE HTML>
  5. <html>
  6. <head>
  7. <script src="../script/jquery.min.js"></script>
  8. <script src="../script/dropzone/dropzone.js"></script>
  9. <link rel="stylesheet" href="../script/dropzone/min/dropzone.min.css">
  10. <link rel="stylesheet" href="../script/tocas/tocas.css">
  11. <script src="../script/tocas/tocas.js"></script>
  12. <title>ArOZ Onlineβ</title>
  13. <style type="text/css">
  14. body {
  15. //padding-top: 4em;
  16. background-color: rgb(250, 250, 250);
  17. }
  18. .ts.segmented.list {
  19. //height: 100vh;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <?php
  25. $embeddMode = false;
  26. if (isset($_GET['embedded']) && $_GET['embedded'] == "true"){
  27. $embeddMode = true;
  28. }
  29. ?>
  30. <br>
  31. <style>
  32. .dropzone-previews {
  33. height: 200px;
  34. width: 500px;
  35. border: dashed 1px red;
  36. background-color: lightblue;
  37. }
  38. </style>
  39. <?php
  40. $upload2module = "";
  41. //Check if the target module directory has been provided
  42. if (isset($_GET['target']) && $_GET['target'] != ""){
  43. $upload2module = $_GET['target'];
  44. }else{
  45. $errmsg = "The upload target directory is undefined.";
  46. $thisfile = basename($_SERVER['PHP_SELF']);
  47. header("Location: index.php?errmsg=" . $errmsg ."&source=" . $thisfile );
  48. die();
  49. }
  50. //Check if the target module support upload or notice
  51. if (!file_exists("../" . $upload2module . "/uploads/")){
  52. $errmsg = "The 'uploads' directory in the target directory were not found. Are you sure you have created an 'uploads' folder under your module's root directory?";
  53. $thisfile = basename($_SERVER['PHP_SELF']);
  54. header("Location: index.php?errmsg=" . $errmsg ."&source=" . $thisfile );
  55. die();
  56. }
  57. $reminder = '<dialog id="reminder" class="ts basic fullscreen modal" style="position:fixed;
  58. margin:0 auto;
  59. clear:left;
  60. height:auto;
  61. z-index: 1000;
  62. display:none;
  63. background:rgba(0,0,0,0.5);
  64. text-align:center;" open>
  65. <div class="ts icon header">
  66. <i class="notice circle icon"></i> Reminder from %MODULE_NAME% Module
  67. </div>
  68. <div class="content">
  69. <p>%REMINDER_TEXT%<br>
  70. %SYSTEMINFO%</p>
  71. </div>
  72. <div class="actions">
  73. <button class="ts inverted basic button" onClick="NSA()">
  74. Never shown again
  75. </button>
  76. <button class="ts inverted basic button" onClick="HideReminder()">
  77. OK
  78. </button>
  79. </div>
  80. </dialog>';
  81. if (isset($_GET['reminder']) && $_GET['reminder'] != ""){
  82. $rbox = str_replace("%MODULE_NAME%",$upload2module,$reminder);
  83. $rbox = str_replace("%REMINDER_TEXT%",$_GET['reminder'],$rbox);
  84. $systeminfo = "ArOZ Online BETA [Developmental Build] Upload Manager UI";
  85. $rbox = str_replace("%SYSTEMINFO%",$systeminfo,$rbox);
  86. echo $rbox;
  87. }
  88. $finishing = "";
  89. if (isset($_GET['finishing']) && $_GET['finishing'] != ""){
  90. $finishing = "../" . $upload2module . "/" . $_GET['finishing'];
  91. }else{
  92. $finishing = "../". $upload2module . "/";
  93. }
  94. ?>
  95. <script>
  96. //Transfering variables from PHP to Javascript
  97. var modulename = "<?php echo $upload2module;?>";
  98. var finishingStep = "<?php echo $finishing;?>";
  99. </script>
  100. <div class="ts narrow container">
  101. <div class="ts breadcrumb">
  102. <div href="#!" class="section">Upload Manager UI</div>
  103. <div class="divider">/</div>
  104. <div href="" class="section"><i class="folder icon"></i> <?php echo $upload2module;?></div>
  105. <div class="divider">/</div>
  106. <div class="active section">
  107. <?php
  108. if (isset($_GET['ext']) && $_GET['ext'] != ""){
  109. if (strpos($_GET['ext'],"/media/") === 0){
  110. echo '<i class="usb icon"></i>'.$_GET['ext'];
  111. }else{
  112. die("ERROR. Invalid external upload path.");
  113. }
  114. }else{
  115. echo '<i class="folder icon"></i>Uploads';
  116. }
  117. ?>
  118. </div>
  119. </div>
  120. <div class="active section" style="display:inline;position:absolute;right: 0;">
  121. <?php
  122. //Echo the internal storage path
  123. echo '<a class="ts label" onClick="changeUploadTarget(this);">
  124. <i class="folder icon"></i> ' . "Uploads" .'
  125. </a>';
  126. include("../SystemAOB/functions/system_statistic/listMountedStorage.php");
  127. foreach ($mountInfo as $usabledrive){
  128. echo '<a class="ts label" onClick="changeUploadTarget(this);">
  129. <i class="usb icon"></i> ' . $usabledrive[1] .'
  130. </a>';
  131. }
  132. ?>
  133. </div>
  134. <!-- END OF TOP BAR-->
  135. <br><br>
  136. <form action="upload_handler.php"
  137. class="dropzone"
  138. id="fileDropzone">
  139. <input type="text" style="display:none;" name="targetModule" value="<?php echo $upload2module;?>">
  140. <input type="text" style="display:none;" name="filetype" value="<?php
  141. if (isset($_GET['filetype']) && $_GET['filetype'] != ""){
  142. echo $_GET['filetype'];
  143. }else{
  144. echo '';
  145. }
  146. ?>">
  147. <input type="text" style="display:none;" name="extmode" value="<?php
  148. if (isset($_GET['ext']) && $_GET['ext'] != ""){
  149. echo $_GET['ext'];
  150. }else{
  151. echo '';
  152. }
  153. ?>">
  154. </form>
  155. <p><i class="notice circle icon"></i>Supported Format:
  156. <?php
  157. if (isset($_GET['filetype']) && $_GET['filetype'] != ""){
  158. echo $_GET['filetype'];
  159. }else{
  160. echo 'ALL';
  161. }
  162. ?></p>
  163. <script>
  164. var ao_module_virtualDesktop = !(!parent.isFunctionBar);
  165. if (ao_module_virtualDesktop){
  166. $("#topMenu").hide();
  167. $("body").css("padding-bottom","50px");
  168. }
  169. function cancelOperation(){
  170. if (ao_module_virtualDesktop){
  171. if (ao_module_virtualDesktop)ao_module_windowID = $(window.frameElement).parent().attr("id");
  172. parent.closeWindow(ao_module_windowID);
  173. }else{
  174. window.location = '../';
  175. }
  176. }
  177. $( document ).ready(function() {
  178. //Check if reminder should be shown
  179. var show_reminder = localStorage.getItem(modulename.toLowerCase() + "-reminder");
  180. console.log(show_reminder);
  181. if (show_reminder == '0'){
  182. $('#reminder').hide();
  183. }else{
  184. $('#reminder').show();
  185. }
  186. });
  187. function traditional(){
  188. var uri = 'upload_interface_traditional.php';
  189. uri = uri + document.location.search;
  190. window.location.href=uri;
  191. }
  192. function DoneUpload(){
  193. window.location = finishingStep;
  194. }
  195. function HideReminder(){
  196. $('#reminder').fadeOut('slow');
  197. }
  198. function NSA(){
  199. //Never shown again for this module
  200. localStorage.setItem(modulename.toLowerCase() + "-reminder", 0);
  201. $('#reminder').fadeOut('slow');
  202. }
  203. function changeUploadTarget(object){
  204. var target = ($(object).text().trim());
  205. var newurl = window.location.href;
  206. if (target == "Uploads"){
  207. newurl = removeParam("ext",newurl);
  208. }else{
  209. newurl = removeParam("ext",newurl);
  210. newurl = newurl + "&ext=" + target;
  211. }
  212. window.location.href = newurl;
  213. }
  214. function removeParam(key, sourceURL) {
  215. var rtn = sourceURL.split("?")[0],
  216. param,
  217. params_arr = [],
  218. queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
  219. if (queryString !== "") {
  220. params_arr = queryString.split("&");
  221. for (var i = params_arr.length - 1; i >= 0; i -= 1) {
  222. param = params_arr[i].split("=")[0];
  223. if (param === key) {
  224. params_arr.splice(i, 1);
  225. }
  226. }
  227. rtn = rtn + "?" + params_arr.join("&");
  228. }
  229. return rtn;
  230. }
  231. </script>
  232. </body>
  233. </html>