]>
git.p6c8.net - jirafeau_mojo42.git/blob - index.php
8a3166541bd34a3ee060da5981355fe7525e82f2
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/lang.php');
24 require (JIRAFEAU_ROOT
. 'lib/config.php');
25 require (JIRAFEAU_ROOT
. 'lib/settings.php');
26 require (JIRAFEAU_ROOT
. 'lib/functions.php');
28 /* check if the destination dirs are writable */
29 $writable = is_writable (VAR_FILES
) && is_writable (VAR_LINKS
);
32 if ($writable && isset ($_POST['jirafeau']))
38 switch ($_POST['time'])
41 $time +
= JIRAFEAU_MINUTE
;
44 $time +
= JIRAFEAU_HOUR
;
47 $time +
= JIRAFEAU_DAY
;
50 $time +
= JIRAFEAU_WEEK
;
53 $time +
= JIRAFEAU_MONTH
;
56 $time = JIRAFEAU_INFINITY
;
61 jirafeau_upload ($_FILES['file'], isset ($_POST['one_time_download']),
62 $key, $time, $cfg, $_SERVER['REMOTE_ADDR']);
65 if (file_exists (JIRAFEAU_ROOT
. 'install.php')
66 && !file_exists (JIRAFEAU_ROOT
.'lib/config.local.php'))
68 header('Location: install.php');
72 require (JIRAFEAU_ROOT
.'lib/template/header.php');
74 /* Checking for errors. */
75 if (!is_writable (VAR_FILES
))
76 add_error (_('The file directory is not writable!'), VAR_FILES
);
78 if (!is_writable (VAR_LINKS
))
79 add_error (_('The link directory is not writable!'), VAR_LINKS
);
81 /* Check if the install.php script is still in the directory. */
82 if (file_exists (JIRAFEAU_ROOT
. 'install.php'))
83 add_error (_('Installer script still present'),
84 _('Please make sure to delete the installer script ' .
85 '"install.php" before continuing.'));
87 if (!has_error () && !empty ($res))
89 if ($res['error']['has_error'])
90 add_error (_('An error occurred.'), $res['error']['why']);
93 $link = $cfg['web_root'];
94 $delete_link = $cfg['web_root'];
98 $link .= 'file-'.$res['link'];
100 'file-'.$res['link'].'-delete-'.$res['delete_link'];
104 /* h because 'h' looks like a jirafeau ;) */
105 $link .= 'file.php?h='.$res['link'];
107 'file.php?h='.$res['link'].'&d='.$res['delete_link'];
110 echo '<div class="message">'.NL
;
111 echo '<p>'._('File uploaded! Copy the following URL to get it:').
113 echo '<a href="'.$link.'">'.$link.'</a>' . NL
;
115 if ($time != JIRAFEAU_INFINITY
)
117 echo '<br />'._('This file is valid until the following date:') .
118 '<br /><strong>' . strftime ('%c', $time) . '</strong>';
123 echo '<div class="message">' . NL
;
124 echo '<p>' . _('Keep the following URL to delete it:') . '<br />' . NL
;
125 echo '<a href="' . $delete_link . '">' . $delete_link . '</a>' . NL
;
133 if (!has_error () && $writable)
135 ?
><div id
= "upload">
136 <form enctype
= "multipart/form-data" action
= "
137 <?php echo $cfg['web_root']; ?>" method
=
138 "post"> <div
><input type
= "hidden" name
= "jirafeau" value
= "
139 <?php echo JIRAFEAU_VERSION; ?>" /></div
> <fieldset
>
140 <legend
><?php
echo _('Upload a file');
141 ?
></legend
> <p
><input type
= "file" name
= "file" size
=
142 "30" /></p
> <p
class =
143 "config"><?php
printf (_('Maximum file size: %dMB'),
144 jirafeau_get_max_upload_size () / (1024 *
146 ?
></p
> <p
><input type
= "submit" value
=
147 "<?php echo _('Send'); ?>" /></p
>
148 <hr
/><div id
= "moreoptions"> <p
><label
><input type
=
150 "one_time_download" /><?php
echo _('One time download');
151 ?
></label
></p
> <p
><label
for = "input_key"
152 ><?php
echo _('Password:');
153 ?
></label
> <input type
= "text" name
= "key" id
= "input_key" /></p
>
154 <p
><label
for = "select_time"
155 ><?php
echo _('Time limit:');
157 <select name
= "time" id
= "select_time">
158 <option value
= "none"><?php
echo _('None');
159 ?
></option
> <option value
= "minute"><?php
echo _('One minute');
160 ?
></option
> <option value
= "hour"><?php
echo _('One hour');
161 ?
></option
> <option value
= "day"><?php
echo _('One day');
162 ?
></option
> <option value
= "week"><?php
echo _('One week');
163 ?
></option
> <option value
= "month"><?php
echo _('One month');
165 </select
> </p
> </div
> </fieldset
> </form
> </div
> <?php
168 require (JIRAFEAU_ROOT
.'lib/template/footer.php');
patrick-canterino.de