index.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. if(isset($_GET["sharingid"])){
  3. header("Location: access.php?sharingid=".$_GET["sharingid"]);
  4. }
  5. ?>
  6. <!DOCTYPE html>
  7. <meta name="apple-mobile-web-app-capable" content="yes" />
  8. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  9. <html>
  10. <head>
  11. <script type='text/javascript' charset='utf-8'>
  12. // Hides mobile browser's address bar when page is done loading.
  13. window.addEventListener('load', function(e) {
  14. setTimeout(function() { window.scrollTo(0, 1); }, 1);
  15. }, false);
  16. </script>
  17. <meta charset="UTF-8">
  18. <title>Quick Send</title>
  19. <link rel="stylesheet" href="../script/tocas/tocas.css">
  20. </head>
  21. <body>
  22. <br>
  23. <div class="ts container">
  24. <div class="ts menu">
  25. <a class="item">Functions</a>
  26. <a class="item" onclick="ts('#modal').modal('show')">Vaildity Period</a>
  27. <a class="item">QR-Code</a>
  28. </div>
  29. <div class="ts text segment">
  30. <div class="ts segment">
  31. <div class="ts horizontal form">
  32. <div class="field">
  33. <label>File path</label>
  34. <input type="text" id="path">
  35. </div>
  36. <div class="field">
  37. <label>Shared Link</label>
  38. <input type="text" id="link">
  39. </div>
  40. <div class="field">
  41. <div class="ts checkbox">
  42. <input id="secure_sharing" type="checkbox" id="secure_sharing">
  43. <label for="secure_sharing">Enable secure sharing</label>
  44. </div>
  45. </div>
  46. <div class="field">
  47. <label>Share with</label>
  48. <div class="ts checkboxes" style="width:100%">
  49. <div class="ts disabled radio checkbox" id="cuser">
  50. <input id="onlineuser" type="radio" name="method">
  51. <label for="onlineuser">ArOZ Online Users</label>
  52. </div>
  53. <select id="userList" disabled>
  54. </select>
  55. <br><br>
  56. <div class="ts disabled radio checkbox" id="cpwdm">
  57. <input id="pwdm" type="radio" name="method">
  58. <label for="pwdm">Password</label>
  59. </div>
  60. <input type="password" id="pwd" disabled>
  61. </div>
  62. </div>
  63. </div>
  64. <br>
  65. <div class="ts container" align="right">
  66. <button class="ts tiny basic button" onclick="senddata()">Save</button>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="ts modals dimmer">
  73. <dialog id="modal" class="ts fullscreen modal">
  74. <div class="header">
  75. Customize Validity Period
  76. </div>
  77. <div class="content">
  78. <form class="ts form">
  79. <div class="field">
  80. <div class="ts checkbox" id="cstart">
  81. <input id="startt" type="checkbox">
  82. <label for="startt">Setup start time</label>
  83. </div>
  84. </div>
  85. <div class="inline field">
  86. <div class="eight wide field">
  87. <input id="startt1" type="text" placeholder="Start date (YYYY-mm-dd)" disabled>
  88. </div>
  89. <div class="eight wide field">
  90. <input id="startt2" type="text" placeholder="Start time (HH:mm)" disabled>
  91. </div>
  92. </div>
  93. <div class="field">
  94. <div class="ts checkbox" id="cstop">
  95. <input id="stopt" type="checkbox">
  96. <label for="stopt">Setup stop time</label>
  97. </div>
  98. </div>
  99. <div class="inline field">
  100. <div class="eight wide field">
  101. <input id="stoptt1" type="text" placeholder="Stop date (YYYY-mm-dd)" disabled>
  102. </div>
  103. <div class="eight wide field">
  104. <input id="stoptt2" type="text" placeholder="Stop time (HH:mm)" disabled>
  105. </div>
  106. </div>
  107. <div class="field">
  108. <div class="ts checkbox" id="cnumall">
  109. <input id="numalla" type="checkbox">
  110. <label for="numalla">Number of allowed access</label>
  111. </div>
  112. </div>
  113. <div class="field">
  114. <input id="numallt" type="text" placeholder="Remaining access times" disabled>
  115. </div>
  116. </form>
  117. </div>
  118. <div class="actions">
  119. <button class="ts positive button">
  120. Save
  121. </button>
  122. </div>
  123. </dialog>
  124. </div>
  125. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
  126. <script src="../script/tocas/tocas.js"></script>
  127. <script src="../script/ao_module.js"></script>
  128. <?php
  129. include "include.php";
  130. $a = new QS();
  131. ?>
  132. <script>
  133. if(ao_module_virtualDesktop){
  134. ao_module_setWindowSize(810,540);
  135. }
  136. var usernameList = <?php echo $a->arr2jsarr($a->getUsernameList()); ?>;
  137. var filepath = <?php echo $a->filepath($_GET["share"]); ?>;
  138. var file_exist = <?php echo $a->checkfileexist($_GET["share"]); ?>;
  139. //https://stackoverflow.com/questions/38620152/pick-a-random-letter-from-string-in-javascript
  140. var randomID = "";
  141. var alphabet = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ123456789";
  142. while (randomID.length < 9) {
  143. randomID += alphabet[Math.floor(Math.random() * alphabet.length)];
  144. }
  145. $("#path").val(filepath.replace("../","/AOR/"));
  146. $("#link").val(window.location["href"].replace(/\?share=.*/,"?sharingid=" + randomID));
  147. for(i=0;i<usernameList.length;i++){
  148. $('#userList').append(new Option(usernameList, usernameList))
  149. }
  150. $("#onlineuser").attr("checked",true);
  151. var securetype = "nil";
  152. var vstart = "no";
  153. var vstop = "no";
  154. var vaccess = "no";
  155. $("#secure_sharing").change(function() {
  156. if($("#secure_sharing").attr("checked")){
  157. $(".ts.disabled.radio.checkbox").attr("class","ts radio checkbox");
  158. if($("#pwdm").attr("checked")){
  159. $("#pwd").removeAttr("disabled");
  160. securetype = "pwd";
  161. }else{
  162. $("#userList").removeAttr("disabled");
  163. securetype = "user";
  164. }
  165. }else{
  166. $(".ts.radio.checkbox").attr("class","ts disabled radio checkbox");
  167. $("#userList").attr("disabled","disabled");
  168. $("#pwd").attr("disabled","disabled");
  169. securetype = "nil"
  170. }
  171. });
  172. $("#cuser").change(function() {
  173. if($("#onlineuser").attr("checked")){
  174. $("#userList").removeAttr("disabled");
  175. $("#pwd").attr("disabled","disabled");
  176. securetype = "user";
  177. }
  178. });
  179. $("#cpwdm").change(function() {
  180. if($("#pwdm").attr("checked")){
  181. $("#userList").attr("disabled","disabled");
  182. $("#pwd").removeAttr("disabled");
  183. securetype = "pwd";
  184. }
  185. });
  186. $("#cstart").change(function() {
  187. if($("#startt").attr("checked")){
  188. $("#startt1").removeAttr("disabled");
  189. $("#startt2").removeAttr("disabled");
  190. vstart = "yes";
  191. }else{
  192. $("#startt1").attr("disabled","disabled");
  193. $("#startt2").attr("disabled","disabled");
  194. vstart = "no";
  195. }
  196. });
  197. $("#cstop").change(function() {
  198. if($("#stopt").attr("checked")){
  199. $("#stoptt1").removeAttr("disabled");
  200. $("#stoptt2").removeAttr("disabled");
  201. vstop = "yes";
  202. }else{
  203. $("#stoptt1").attr("disabled","disabled");
  204. $("#stoptt2").attr("disabled","disabled");
  205. vstop = "no";
  206. }
  207. });
  208. $("#cnumall").change(function() {
  209. if($("#numalla").attr("checked")){
  210. $("#numallt").removeAttr("disabled");
  211. vaccess = "yes";
  212. }else{
  213. $("#numallt").attr("disabled","disabled");
  214. vaccess = "no";
  215. }
  216. });
  217. function senddata(){
  218. $.post( "opr.php", { path: ".." + $("#path").val().substring(4), id: randomID, secure_sharing: securetype, userList: $("#userList").val(), pwd: $("#pwd").val(), isstart: vstart, isstop: vstop, is_access: vaccess, startd: $("#startt1").val(), startt: $("#startt2").val(), stopd: $("#stoptt1").val(), stopt: $("#stoptt2").val(), numaccess: $("#numallt").val() }, function( data ) {
  219. console.log("OKAY!");
  220. }, "json");
  221. }
  222. var lan = JSON.parse('{"zh-TW":{"File path":"檔案路徑","Shared Link":"分享連結","Enable secure sharing":"啟動安全分享","ArOZ Online Users":"ArOZ Online使用者","Password":"密碼","Share with": "分享給其他人","QR-Code":"取得QR碼","Functions": "功能","Vaildity Period":"有效期間","Customize Validity Period":"自訂有效期間","Setup start time":"設定開始時間","Start date":"開始日期","Start time":"開始時間","Setup stop time":"設定結束時間","Stop date":"結束日期","Stop time":"結束時間","Number of allowed access":"可存取次數","Remaining access times":"剩餘存取次數","Start date (YYYY-mm-dd)": "開始日期 (YYYY-mm-dd)","Start time (HH:mm)": "開始時間 (HH:mm)","Stop date (YYYY-mm-dd)": "停止日期 (YYYY-mm-dd)","Stop time (HH:mm)": "停止時間 (HH:mm)","Save": "儲存"},"zh-HK":{},"en-US":{}}');
  223. </script>
  224. <script src="i18n.js"></script>
  225. </body>
  226. </html>