]>
git.p6c8.net - jirafeau_mojo42.git/blob - index.php
4a8402509777033b4491eaf7c6a678d6b9c60f95
3 * Jirafeau, your web file repository
4 * Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
5 * Copyright (C) 2012 Jerome Jutteau <j.jutteau@gmail.com>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 define ('JIRAFEAU_ROOT', dirname (__FILE__
) . '/');
21 define ('DEBUG', true);
23 require (JIRAFEAU_ROOT
. 'lib/config.php');
24 require (JIRAFEAU_ROOT
. 'lib/settings.php');
25 require (JIRAFEAU_ROOT
. 'lib/functions.php');
27 /* check if the destination dirs are writable */
28 $writable = is_writable (VAR_FILES
) && is_writable (VAR_LINKS
);
31 if ($writable && isset ($_POST['jirafeau']))
37 switch ($_POST['time'])
40 $time +
= JIRAFEAU_MINUTE
;
43 $time +
= JIRAFEAU_HOUR
;
46 $time +
= JIRAFEAU_DAY
;
49 $time +
= JIRAFEAU_WEEK
;
52 $time +
= JIRAFEAU_MONTH
;
55 $time = JIRAFEAU_INFINITY
;
60 jirafeau_upload ($_FILES['file'], isset ($_POST['one_time_download']),
61 $key, $time, $cfg, $_SERVER['REMOTE_ADDR']);
64 require (JIRAFEAU_ROOT
.'lib/template/header.php');
66 /* Checking for errors. */
67 if (!is_writable (VAR_FILES
))
68 add_error (_('The file directory is not writable!'), VAR_FILES
);
70 if (!is_writable (VAR_LINKS
))
71 add_error (_('The link directory is not writable!'), VAR_LINKS
);
73 /* Check if the install.php script is still in the directory. */
74 if (file_exists (JIRAFEAU_ROOT
. 'install.php'))
75 add_error (_('Installer script still present'),
76 _('Please make sure to delete the installer script ' .
77 '"install.php" before continuing.'));
79 if (!has_error () && !empty ($res))
81 if ($res['error']['has_error'])
82 add_error (_('An error occurred.'), $res['error']['why']);
85 $link = $cfg['web_root'];
86 $delete_link = $cfg['web_root'];
90 $link .= 'file-'.$res['link'];
92 'file-'.$res['link'].'-delete-'.$res['delete_link'];
96 /* h because 'h' looks like a jirafeau ;) */
97 $link .= 'file.php?h='.$res['link'];
99 'file.php?h='.$res['link'].'&d='.$res['delete_link'];
102 echo '<div class="message">'.NL
;
103 echo '<p>'._('File uploaded! Copy the following URL to get it:').
105 echo '<a href="'.$link.'">'.$link.'</a>' . NL
;
107 if ($time != JIRAFEAU_INFINITY
)
109 echo '<br />'._('This file is valid until the following date:') .
110 '<br /><strong>' . strftime ('%c', $time) . '</strong>';
115 echo '<div class="message">' . NL
;
116 echo '<p>' . _('Keep the following URL to delete it:') . '<br />' . NL
;
117 echo '<a href="' . $delete_link . '">' . $delete_link . '</a>' . NL
;
125 if (!has_error () && $writable)
127 ?
><div id
= "upload">
128 <form enctype
= "multipart/form-data" action
= "
129 <?php echo $cfg['web_root']; ?>" method
=
130 "post"> <div
><input type
= "hidden" name
= "jirafeau" value
= "
131 <?php echo JIRAFEAU_VERSION; ?>" /></div
> <fieldset
>
132 <legend
><?php
echo _('Upload a file');
133 ?
></legend
> <p
><input type
= "file" name
= "file" size
=
134 "30" /></p
> <p
class =
135 "config"><?php
printf (_('Maximum file size: %dMB'),
136 jirafeau_get_max_upload_size () / (1024 *
138 ?
></p
> <p
><input type
= "submit" value
=
139 "<?php echo _('Send'); ?>" /></p
>
140 <hr
/><div id
= "moreoptions"> <p
><label
><input type
=
142 "one_time_download" /><?php
echo _('One time download');
143 ?
></label
></p
> <p
><label
for = "input_key"
144 ><?php
echo _('File key:');
145 ?
></label
> <input type
= "text" name
= "key" id
= "input_key" /></p
>
146 <p
><label
for = "select_time"
147 ><?php
echo _('Time limit:');
149 <select name
= "time" id
= "select_time">
150 <option value
= "none"><?php
echo _('None');
151 ?
></option
> <option value
= "minute"><?php
echo _('One minute');
152 ?
></option
> <option value
= "hour"><?php
echo _('One hour');
153 ?
></option
> <option value
= "day"><?php
echo _('One day');
154 ?
></option
> <option value
= "week"><?php
echo _('One week');
155 ?
></option
> <option value
= "month"><?php
echo _('One month');
157 </select
> </p
> </div
> </fieldset
> </form
> </div
> <?php
160 require (JIRAFEAU_ROOT
.'lib/template/footer.php');
patrick-canterino.de