]>
git.p6c8.net - jirafeau.git/blob - pub/index.php
80a5230fdad081057d1c023278f9a63dba5fe411
3 * Jyraphe, your web file repository
4 * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 define('JYRAPHE_ROOT', dirname(__FILE__
) . '/');
21 define('DEBUG', true);
23 require(JYRAPHE_ROOT
. 'lib/config.php');
24 require(JYRAPHE_ROOT
. 'lib/settings.php');
25 require(JYRAPHE_ROOT
. 'lib/functions.php');
27 /* check if the destination dirs are writable */
28 $writable = is_writable(VAR_FILES
) && is_writable(VAR_LINKS
) && is_writable(VAR_TRASH
);
31 if($writable && isset($_POST['jyraphe'])) {
36 switch($_POST['time']) {
38 $time +
= JYRAPHE_MINUTE
;
41 $time +
= JYRAPHE_HOUR
;
47 $time +
= JYRAPHE_WEEK
;
50 $time +
= JYRAPHE_MONTH
;
53 $time = JYRAPHE_INFINITY
;
57 $res = jyraphe_upload($_FILES['file'], isset($_POST['one_time_download']), $key, $time, $cfg);
60 require(JYRAPHE_ROOT
. 'lib/template/header.php');
62 /* Checking for errors. */
63 if(!is_writable(VAR_FILES
)) {
64 add_error (_('The file directory is not writable!'), VAR_FILES
);
67 if(!is_writable(VAR_LINKS
)) {
68 add_error (_('The link directory is not writable!'), VAR_LINKS
);
71 if(!is_writable(VAR_TRASH
)) {
72 add_error (_('The trash directory is not writable!'), VAR_TRASH
);
75 /* Check if the install.php script is still in the directory. */
76 if (file_exists(JYRAPHE_ROOT
. 'install.php')) {
77 add_error (_('Installer script still present'),
78 _('Please make sure to delete the installer script "install.php" before continuing.'));
81 if(!has_error() && !empty($res)) {
82 if($res['error']['has_error']) {
83 add_error (_('An error occurred.'), $res['error']['why']);
85 $link = $cfg['web_root'];
87 $link .= 'file-' . $res['link'];
89 $link .= 'file.php?h=' . $res['link']; // h because 'h' looks like a jyraphe ;)
91 echo '<div class="message">' . NL
;
92 echo '<p>' . _('File uploaded! Copy the following URL to get it:') . '<br />' . NL
;
93 echo '<a href="' . $link . '">' . $link . '</a>' . NL
;
95 if($time != JYRAPHE_INFINITY
) {
96 echo '<br />' . _('This file is valid until the following date:') . '<br /><strong>' . strftime('%c' ,$time) . '</strong>';
107 if(!has_error () && $writable) {
111 <form enctype
="multipart/form-data" action
="<?php echo $cfg['web_root']; ?>" method
="post">
112 <div
><input type
="hidden" name
="jyraphe" value
="<?php echo JYRAPHE_VERSION; ?>" /></div
>
114 <legend
><?php
echo _('Upload a file'); ?
></legend
>
115 <p
><input type
="file" name
="file" size
="30" /></p
>
116 <p
class="config"><?php
printf(_('Maximum file size: %dMB'), jyraphe_get_max_upload_size()/(1024*1024)); ?
></p
>
117 <p
><input type
="submit" value
="<?php echo _('Send in the binary chaos'); ?>" /></p
>
121 <div id
="moreoptions">
122 <p
><label
><input type
="checkbox" name
="one_time_download" /> <?php
echo _('One time download'); ?
></label
></p
>
123 <p
><label
for="input_key"><?php
echo _('File key:'); ?
></label
> <input type
="text" name
="key" id
="input_key" /></p
>
124 <p
><label
for="select_time"><?php
echo _('Time limit:'); ?
></label
>
125 <select name
="time" id
="select_time">
126 <option value
="none"><?php
echo _('None'); ?
></option
>
127 <option value
="minute"><?php
echo _('One minute'); ?
></option
>
128 <option value
="hour"><?php
echo _('One hour'); ?
></option
>
129 <option value
="day"><?php
echo _('One day'); ?
></option
>
130 <option value
="week"><?php
echo _('One week'); ?
></option
>
131 <option value
="month"><?php
echo _('One month'); ?
></option
>
142 require(JYRAPHE_ROOT
. 'lib/template/footer.php');
patrick-canterino.de