]> git.p6c8.net - jirafeau_project.git/blob - index.php
Fix async uploads with encryption
[jirafeau_project.git] / index.php
1 <?php
2 /*
3 * Jirafeau, your web file repository
4 * Copyright (C) 2013
5 * Jerome Jutteau <j.jutteau@gmail.com>
6 * Jimmy Beauvois <jimmy.beauvois@gmail.com>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
22
23 require (JIRAFEAU_ROOT . 'lib/config.original.php');
24 require (JIRAFEAU_ROOT . 'lib/settings.php');
25 require (JIRAFEAU_ROOT . 'lib/functions.php');
26 require (JIRAFEAU_ROOT . 'lib/lang.php');
27 require (JIRAFEAU_ROOT . 'lib/template/header.php');
28
29 check_errors ();
30 if (has_error ())
31 {
32 show_errors ();
33 require (JIRAFEAU_ROOT . 'lib/template/footer.php');
34 exit;
35 }
36 ?>
37 <div id="upload_finished">
38 <p>
39 <?php echo t('File uploaded! Copy the following URL to get it') ?>:
40 <br />
41 <a id="upload_link" href=""></a>
42 <br />
43 </p>
44
45 <p>
46 <?php echo t('Keep the following URL to delete it at any moment'); ?>:
47 <br />
48 <a id="delete_link" href=""></a>
49 </p>
50
51 <p id="validity">
52 <?php echo t('This file is valid until the following date'); ?>:
53 <br /><strong><div id="date"></div></strong>
54 </p>
55 </div>
56
57 <div id="uploading">
58 <p>
59 <?php echo t ('Uploading ...'); ?><div id="uploaded_percentage"></div>
60 </p>
61 </div>
62
63 <div id="upload">
64 <fieldset>
65 <legend>
66 <?php echo t('Select a file'); ?>
67 </legend>
68 <p>
69 <input type="file" id="file_select" size="30"
70 onchange="
71 document.getElementById('options').style.display = '';
72 document.getElementById('send').style.display = '';
73 "/>
74 </p>
75
76 <div id="options">
77 <table id="option_table">
78 <tr>
79 <td><?php echo t('One time download'); ?>:</td>
80 <td><input type="checkbox" id="one_time_download" /></td>
81 </tr>
82 <tr>
83 <td><label for="input_key"><?php echo t('Password') . ':'; ?></label></td>
84 <td><input type="text" name="key" id="input_key" /></td>
85 </tr>
86 <tr>
87 <td><label for="select_time"><?php echo t('Time limit') . ':'; ?></label></td>
88 <td><select name="time" id="select_time">
89 <option value="none"><?php echo t('None'); ?></option>
90 <option value = "minute"><?php echo t('One minute'); ?></option>
91 <option value = "hour"><?php echo t('One hour'); ?></option>
92 <option value = "day"><?php echo t('One day'); ?></option>
93 <option value = "week"><?php echo t('One week'); ?></option>
94 <option value = "month"><?php echo t('One month');?></option>
95 </select></td>
96 </tr>
97 <p id="max_file_size" class="config"></p>
98 <p>
99 <input type="submit" id="send" value="<?php echo t('Send'); ?>"
100 onclick="
101 document.getElementById('upload').style.display = 'none';
102 document.getElementById('uploading').style.display = '';
103 upload ('<?php echo $cfg['web_root']; ?>', <?php echo jirafeau_get_max_upload_size_bytes (); ?>);
104 "/>
105 </p>
106 </table>
107 </div> </fieldset>
108 </div>
109
110 <script lang="Javascript">
111 document.getElementById('uploading').style.display = 'none';
112 document.getElementById('upload_finished').style.display = 'none';
113 document.getElementById('options').style.display = 'none';
114 document.getElementById('send').style.display = 'none';
115 if (!check_html5_file_api ())
116 document.getElementById('max_file_size').innerHTML = '<?php
117 echo t('You browser may not support HTML5 so the maximum file size is ') . jirafeau_get_max_upload_size ();
118 ?>';
119 </script>
120 <?php require (JIRAFEAU_ROOT . 'lib/template/footer.php'); ?>

patrick-canterino.de