]>
git.p6c8.net - jirafeau_project.git/blob - index.php
5c3ffce0ddc82ae5e9bf35133adeb779aa3a4df7
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 <https://www.gnu.org/licenses/>.
22 define('JIRAFEAU_ROOT', dirname(__FILE__
) . '/');
24 require(JIRAFEAU_ROOT
. 'lib/settings.php');
25 require(JIRAFEAU_ROOT
. 'lib/functions.php');
26 require(JIRAFEAU_ROOT
. 'lib/lang.php');
31 require(JIRAFEAU_ROOT
. 'lib/template/footer.php');
35 require(JIRAFEAU_ROOT
. 'lib/template/header.php');
37 /* Check if user is allowed to upload. */
38 // First check: Challenge by IP NO PASSWORD
39 if (true === jirafeau_challenge_upload_ip($cfg['upload_ip_nopassword'], get_ip_address($cfg))) {
41 // Second check: Challenge by IP
42 elseif (true === jirafeau_challenge_upload_ip($cfg['upload_ip'], get_ip_address($cfg))) {
43 // Is an upload password required?
44 if (jirafeau_has_upload_password($cfg)) {
46 if (isset($_POST['action']) && (strcmp($_POST['action'], 'logout') == 0)) {
50 // Challenge by password
51 // …save successful logins in session
52 if (isset($_POST['upload_password'])) {
53 if (jirafeau_challenge_upload_password($cfg, $_POST['upload_password'])) {
54 $_SESSION['upload_auth'] = true;
55 $_SESSION['user_upload_password'] = $_POST['upload_password'];
57 $_SESSION['admin_auth'] = false;
58 jirafeau_fatal_error(t('BAD_PSW'), $cfg);
62 // Show login form if user session is not authorized yet
63 if (true === empty($_SESSION['upload_auth'])) {
65 <form method
="post" class="form login">
69 <td
class = "label"><label
for = "enter_password">
70 <?php
echo t('UP_PSW') . ':'; ?
></label
>
73 <td
class = "field"><input type
= "password"
74 name
= "upload_password" id
= "upload_password"
79 <td
class = "nav next">
80 <input type
= "submit" name
= "key" value
=
81 "<?php echo t('LOGIN'); ?>" />
88 require(JIRAFEAU_ROOT
.'lib/template/footer.php');
94 jirafeau_fatal_error(t('ACCESS_KO'), $cfg);
98 <div id
="upload_finished">
99 <p
><?php
echo t('FILE_UP') ?
></p
>
101 <div id
="upload_finished_download_page">
103 <a id
="upload_link" href
=""><?php
echo t('DL_PAGE') ?
></a
>
104 <a id
="upload_link_email" href
=""><img id
="upload_image_email"/></a
>
106 <code id
=upload_link_text
></code
>
107 <button id
="upload_link_button">⎘
</button
>
111 <?php
if ($cfg['preview'] == true) {
113 <div id
="upload_finished_preview">
115 <a id
="preview_link" href
=""><?php
echo t('VIEW_LINK') ?
></a
>
117 <code id
=preview_link_text
></code
>
118 <button id
="preview_link_button">⎘
</button
>
124 <div id
="upload_direct_download">
126 <a id
="direct_link" href
=""><?php
echo t('DIRECT_DL') ?
></a
>
128 <code id
=direct_link_text
></code
>
129 <button id
="direct_link_button">⎘
</button
>
133 <div id
="upload_delete">
135 <a id
="delete_link" href
=""><?php
echo t('DELETE_LINK') ?
></a
>
137 <code id
=delete_link_text
></code
>
138 <button id
="delete_link_button">⎘
</button
>
142 <div id
="upload_validity">
143 <p
><?php
echo t('VALID_UNTIL'); ?
>:</p
>
150 <?php
echo t('UP'); ?
>
151 <div id
="uploaded_percentage"></div
>
152 <div id
="uploaded_speed"></div
>
153 <div id
="uploaded_time"></div
>
157 <div id
="error_pop" class="error">
163 <?php
echo t('SEL_FILE'); ?
>
166 <input type
="file" id
="file_select" size
="30"
167 onchange
="control_selected_file_size(<?php echo $cfg['maximal_upload_size'] ?>, '<?php echo t('2_BIG') . ', ' . t('FILE_LIM') . " " . $cfg['maximal_upload_size'] . " MB
"; ?>')"/>
171 <table id
="option_table">
173 <td
><?php
echo t('ONE_TIME_DL'); ?
>:</td
>
174 <td
><input type
="checkbox" id
="one_time_download" /></td
>
177 <td
><label
for="input_key"><?php
echo t('PSW') . ':'; ?
></label
></td
>
178 <td
><input type
="text" name
="key" id
="input_key" /></td
>
181 <td
><label
for="select_time"><?php
echo t('TIME_LIM') . ':'; ?
></label
></td
>
182 <td
><select name
="time" id
="select_time">
184 $expirationTimeOptions = array(
206 'value' => 'quarter',
218 foreach ($expirationTimeOptions as $expirationTimeOption) {
219 $selected = ($expirationTimeOption['value'] === $cfg['availability_default'])?
'selected="selected"' : '';
220 if (true === $cfg['availabilities'][$expirationTimeOption['value']]) {
221 echo '<option value="' . $expirationTimeOption['value'] . '" ' .
222 $selected . '>' . t($expirationTimeOption['label']) . '</option>';
230 if ($cfg['maximal_upload_size'] > 0) {
231 echo '<p class="config">' . t('FILE_LIM');
232 echo " " . $cfg['maximal_upload_size'] . " MB</p>";
236 <p id
="max_file_size" class="config"></p
>
239 if (jirafeau_has_upload_password($cfg) && $_SESSION['upload_auth']) {
241 <input type
="hidden" id
="upload_password" name
="upload_password" value
="<?php echo $_SESSION['user_upload_password'] ?>"/>
246 <input type
="hidden" id
="upload_password" name
="upload_password" value
=""/>
251 <input type
="submit" id
="send" value
="<?php echo t('SEND'); ?>"
253 document.getElementById('upload').style.display = 'none';
254 document.getElementById('uploading').style.display = '';
255 upload (<?php echo jirafeau_get_max_upload_size_bytes(); ?>);
262 if (jirafeau_has_upload_password($cfg)) {
264 <form method
="post" class="form logout">
265 <input type
= "hidden" name
= "action" value
= "logout"/>
266 <input type
= "submit" value
= "<?php echo t('LOGOUT'); ?>" />
275 <script type
="text/javascript" lang
="Javascript">
276 // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
277 document
.getElementById('error_pop').style
.display
= 'none';
278 document
.getElementById('uploading').style
.display
= 'none';
279 document
.getElementById('upload_finished').style
.display
= 'none';
280 document
.getElementById('options').style
.display
= 'none';
281 document
.getElementById('send').style
.display
= 'none';
282 if (!check_html5_file_api ())
283 document
.getElementById('max_file_size').innerHTML
= '<?php
284 echo t('NO_BROWSER_SUPPORT
') . jirafeau_get_max_upload_size();
287 addCopyListener('upload_link_button', 'upload_link');
288 addCopyListener('preview_link_button', 'preview_link');
289 addCopyListener('direct_link_button', 'direct_link');
290 addCopyListener('delete_link_button', 'delete_link');
293 <?php
require(JIRAFEAU_ROOT
. 'lib/template/footer.php'); ?
>
patrick-canterino.de