3 * Jirafeau, your web file repository
5 * Jerome Jutteau <j.jutteau@gmail.com>
6 * Jimmy Beauvois <jimmy.beauvois@gmail.com>
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.
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.
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/>.
21 define ('JIRAFEAU_ROOT', dirname (__FILE__
) . '/');
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');
32 require (JIRAFEAU_ROOT
. 'lib/template/footer.php');
36 require (JIRAFEAU_ROOT
. 'lib/template/header.php');
38 /* Check if user is allowed to upload. */
39 if (!jirafeau_challenge_upload_ip ($cfg, get_ip_address($cfg)))
41 echo '<div class="error"><p>' . t('Access denied') . '</p></div>';
42 require (JIRAFEAU_ROOT
.'lib/template/footer.php');
46 /* Ask password if upload password is set. */
47 if (jirafeau_has_upload_password ($cfg))
52 if (isset ($_POST['action']) && (strcmp ($_POST['action'], 'logout') == 0))
56 if (isset ($_POST['upload_password']))
58 if (jirafeau_challenge_upload_password ($cfg, $_POST['upload_password']))
60 $_SESSION['upload_auth'] = true;
61 $_SESSION['user_upload_password'] = $_POST['upload_password'];
65 $_SESSION['admin_auth'] = false;
66 echo '<div class="error"><p>' . t('Wrong password.') . '</p></div>';
67 require (JIRAFEAU_ROOT
.'lib/template/footer.php');
73 if (!isset ($_SESSION['upload_auth']) ||
$_SESSION['upload_auth'] != true)
76 <form action
= "<?php echo basename(__FILE__); ?>" method
= "post">
80 <td
class = "label"><label
for = "enter_password">
81 <?php
echo t('Upload password') . ':';?
></label
>
83 <td
class = "field"><input type
= "password"
84 name
= "upload_password" id
= "upload_password"
90 <td
class = "nav next">
91 <input type
= "submit" name
= "key" value
=
92 "<?php echo t('Login'); ?>" />
99 require (JIRAFEAU_ROOT
.'lib/template/footer.php');
105 <div id
="upload_finished">
106 <p
><?php
echo t('File uploaded !') ?
></p
>
108 <div id
="upload_finished_download_page">
110 <?php
echo t('Download page') ?
>
111 <a id
="upload_link_email" href
=""><img id
="upload_image_email"/></a
>
113 <p
><a id
="upload_link" href
=""></a
></p
>
116 <?php
if ($cfg['preview'] == true) { ?
>
117 <div id
="upload_finished_preview">
118 <p
><?php
echo t('View link') ?
>:</p
>
119 <p
><a id
="preview_link" href
=""></a
></p
>
123 <div id
="upload_direct_download">
124 <p
><?php
echo t('Direct download link') ?
>:</p
>
125 <p
><a id
="direct_link" href
=""></a
></p
>
129 <p
><?php
echo t('Delete link') ?
>:</p
>
130 <p
><a id
="delete_link" href
=""></a
></p
>
134 <p
><?php
echo t('This file is valid until the following date'); ?
>:</p
>
141 <?php
echo t ('Uploading ...'); ?
>
142 <div id
="uploaded_percentage"></div
>
143 <div id
="uploaded_speed"></div
>
144 <div id
="uploaded_time"></div
>
148 <div id
="error_pop" class="error">
154 <?php
echo t('Select a file'); ?
>
157 <input type
="file" id
="file_select" size
="30"
158 onchange
="control_selected_file_size(<?php echo $cfg['maximal_upload_size'] ?>, '<?php echo t ('File is too big') . ', ' . t ('File size is limited to') . " " . $cfg['maximal_upload_size'] . " MB
"; ?>')"/>
162 <table id
="option_table">
164 <td
><?php
echo t('One time download'); ?
>:</td
>
165 <td
><input type
="checkbox" id
="one_time_download" /></td
>
168 <td
><label
for="input_key"><?php
echo t('Password') . ':'; ?
></label
></td
>
169 <td
><input type
="text" name
="key" id
="input_key" /></td
>
172 <td
><label
for="select_time"><?php
echo t('Time limit') . ':'; ?
></label
></td
>
173 <td
><select name
="time" id
="select_time">
174 <?php
if ($cfg['availabilities']['none']) { ?
>
175 <option value
="none"><?php
echo t('None'); ?
></option
>
177 <?php
if ($cfg['availabilities']['year']) { ?
>
178 <option value
= "year"><?php
echo t('One year');?
></option
>
180 <?php
if ($cfg['availabilities']['month']) { ?
>
181 <option value
= "month"><?php
echo t('One month');?
></option
>
183 <?php
if ($cfg['availabilities']['week']) { ?
>
184 <option value
= "week"><?php
echo t('One week'); ?
></option
>
186 <?php
if ($cfg['availabilities']['day']) { ?
>
187 <option value
= "day"><?php
echo t('One day'); ?
></option
>
189 <?php
if ($cfg['availabilities']['hour']) { ?
>
190 <option value
= "hour"><?php
echo t('One hour'); ?
></option
>
192 <?php
if ($cfg['availabilities']['minute']) { ?
>
193 <option value
= "minute"><?php
echo t('One minute'); ?
></option
>
199 if ($cfg['maximal_upload_size'] > 0)
201 echo '<p class="config">' . t ('File size is limited to');
202 echo " " . $cfg['maximal_upload_size'] . " MB</p>";
206 <p id
="max_file_size" class="config"></p
>
209 if (jirafeau_has_upload_password ($cfg) && $_SESSION['upload_auth'])
212 <input type
="hidden" id
="upload_password" name
="upload_password" value
="<?php echo $_SESSION['user_upload_password'] ?>"/>
218 <input type
="hidden" id
="upload_password" name
="upload_password" value
=""/>
222 <input type
="submit" id
="send" value
="<?php echo t('Send'); ?>"
224 document.getElementById('upload').style.display = 'none';
225 document.getElementById('uploading').style.display = '';
226 upload ('<?php echo $cfg['web_root']; ?>', <?php echo jirafeau_get_max_upload_size_bytes (); ?>);
233 if (jirafeau_has_upload_password ($cfg))
236 <form action
= "<?php echo basename(__FILE__); ?>" method
= "post">
237 <input type
= "hidden" name
= "action" value
= "logout"/>
238 <input type
= "submit" value
= "<?php echo t('Logout'); ?>" />
246 <script lang
="Javascript">
247 document
.getElementById('error_pop').style
.display
= 'none';
248 document
.getElementById('uploading').style
.display
= 'none';
249 document
.getElementById('upload_finished').style
.display
= 'none';
250 document
.getElementById('options').style
.display
= 'none';
251 document
.getElementById('send').style
.display
= 'none';
252 if (!check_html5_file_api ())
253 document
.getElementById('max_file_size').innerHTML
= '<?php
254 echo t('You browser may not support HTML5 so the maximum file size is
') . jirafeau_get_max_upload_size ();
257 <?php
require (JIRAFEAU_ROOT
. 'lib/template/footer.php'); ?
>