Remove unwanted whitespace
if (isset ($_POST['admin_password']) && empty($cfg['admin_http_auth_user']))
{
if ($cfg['admin_password'] === $_POST['admin_password'] ||
if (isset ($_POST['admin_password']) && empty($cfg['admin_http_auth_user']))
{
if ($cfg['admin_password'] === $_POST['admin_password'] ||
- $cfg['admin_password'] === hash('sha256', $_POST['admin_password']))
+ $cfg['admin_password'] === hash('sha256', $_POST['admin_password']))
$_SESSION['admin_auth'] = true;
else
{
$_SESSION['admin_auth'] = true;
else
{
<div id="upload_finished_download_page">
<p>
<div id="upload_finished_download_page">
<p>
- <?php echo t('Download page') ?>
+ <?php echo t('Download page') ?>
<a id="upload_link_email" href=""><img id="upload_image_email"/></a>
</p>
<p><a id="upload_link" href=""></a></p>
<a id="upload_link_email" href=""><img id="upload_image_email"/></a>
</p>
<p><a id="upload_link" href=""></a></p>
<div id="upload">
<fieldset>
<legend>
<div id="upload">
<fieldset>
<legend>
- <?php echo t('Select a file'); ?>
+ <?php echo t('Select a file'); ?>
</legend>
<p>
<input type="file" id="file_select" size="30"
</legend>
<p>
<input type="file" id="file_select" size="30"
"<?php echo t('Next step'); ?>" /></td> </tr> </table>
</fieldset> </form> </div> <?php
break;
"<?php echo t('Next step'); ?>" /></td> </tr> </table>
</fieldset> </form> </div> <?php
break;
case 2:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 2, 4);
case 2:
?><h2><?php printf (t('Installation of Jirafeau') . ' - ' . t('step') .
' %d ' . t('out of') . ' %d', 2, 4);
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* default configuration
* if you want to change this, overwrite in a config.local.php file
*/
global $cfg;
/*
* default configuration
* if you want to change this, overwrite in a config.local.php file
*/
global $cfg;
/* Don't forget the ending '/' */
$cfg['web_root'] = '';
$cfg['var_root'] = '';
/* Don't forget the ending '/' */
$cfg['web_root'] = '';
$cfg['var_root'] = '';
if (time == 'minute')
{
d.setSeconds (d.getSeconds() + 60);
if (time == 'minute')
{
d.setSeconds (d.getSeconds() + 60);
'1101', # d
'1110', # e
'1111'); # f
'1101', # d
'1110', # e
'1111'); # f
$b = '';
$i = 0;
# Convert long hex string to bin.
$b = '';
$i = 0;
# Convert long hex string to bin.
$p = min (floor (($o ? log ($o) : 0) / log (1024)), count ($u) - 1);
$o /= pow (1024, $p);
return round ($o, 1) . $u[$p];
$p = min (floor (($o ? log ($o) : 0) / log (1024)), count ($u) - 1);
$o /= pow (1024, $p);
return round ($o, 1) . $u[$p];
function
jirafeau_clean_rm_link ($link)
function
jirafeau_clean_rm_link ($link)
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
- && basename ($parse) != basename (VAR_LINKS))
+ && basename ($parse) != basename (VAR_LINKS))
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
- && basename ($parse) != basename (VAR_FILES))
+ && basename ($parse) != basename (VAR_FILES))
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (is_dir ($d . $node))
{
/* Push new found directory. */
if (is_dir ($d . $node))
{
/* Push new found directory. */
{
$count++;
jirafeau_delete_link ($node);
{
$count++;
jirafeau_delete_link ($node);
{
if (file_exists ($link_tmp_name))
unlink ($link_tmp_name);
{
if (file_exists ($link_tmp_name))
unlink ($link_tmp_name);
$counter--;
if ($counter >= 1)
{
$counter--;
if ($counter >= 1)
{
if (file_exists (JIRAFEAU_ROOT . 'install.php')
&& !($cfg['installation_done'] === true))
{
if (file_exists (JIRAFEAU_ROOT . 'install.php')
&& !($cfg['installation_done'] === true))
{
- header('Location: install.php');
+ header('Location: install.php');
if (!is_writable (VAR_LINKS))
add_error (t('The link directory is not writable!'), VAR_LINKS);
if (!is_writable (VAR_LINKS))
add_error (t('The link directory is not writable!'), VAR_LINKS);
if (!is_writable (VAR_ASYNC))
add_error (t('The async directory is not writable!'), VAR_ASYNC);
}
if (!is_writable (VAR_ASYNC))
add_error (t('The async directory is not writable!'), VAR_ASYNC);
}
if (!file_exists ($link))
return $out;
if (!file_exists ($link))
return $out;
$c = file ($link);
$out['file_name'] = trim ($c[0]);
$out['mime_type'] = trim ($c[1]);
$c = file ($link);
$out['file_name'] = trim ($c[0]);
$out['mime_type'] = trim ($c[1]);
$out['ip'] = trim ($c[8]);
$out['link_code'] = trim ($c[9]);
$out['crypted'] = trim ($c[10]) == 'C';
$out['ip'] = trim ($c[8]);
$out['link_code'] = trim ($c[9]);
$out['crypted'] = trim ($c[10]) == 'C';
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (is_dir ($d . $node))
{
/* Push new found directory. */
if (is_dir ($d . $node))
{
/* Push new found directory. */
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (strcmp ($node, '.') == 0 || strcmp ($node, '..') == 0 ||
preg_match ('/\.tmp/i', "$node"))
continue;
if (is_dir ($d . $node))
{
/* Push new found directory. */
if (is_dir ($d . $node))
{
/* Push new found directory. */
if (!file_exists ($refinfos))
return $out;
if (!file_exists ($refinfos))
return $out;
$c = file ($refinfos);
$out['file_name'] = trim ($c[0]);
$out['mime_type'] = trim ($c[1]);
$c = file ($refinfos);
$out['file_name'] = trim ($c[0]);
$out['mime_type'] = trim ($c[1]);
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
- && basename ($parse) != basename (VAR_ASYNC))
+ && basename ($parse) != basename (VAR_ASYNC))
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
/* md5 password or empty */
$password = '';
if (!empty ($key))
/* md5 password or empty */
$password = '';
if (!empty ($key))
{
/* Get async infos. */
$a = jirafeau_get_async_ref ($ref);
{
/* Get async infos. */
$a = jirafeau_get_async_ref ($ref);
/* Check some errors. */
if (count ($a) == 0
|| $a['next_code'] != "$code"
|| empty ($data['tmp_name'])
|| !is_uploaded_file ($data['tmp_name']))
return 'Error';
/* Check some errors. */
if (count ($a) == 0
|| $a['next_code'] != "$code"
|| empty ($data['tmp_name'])
|| !is_uploaded_file ($data['tmp_name']))
return 'Error';
$p = s2p ($ref);
/* File path. */
$p = s2p ($ref);
/* File path. */
fclose ($r);
fclose ($w);
unlink ($r_path);
fclose ($r);
fclose ($w);
unlink ($r_path);
/* Update async file. */
$code = jirafeau_gen_random (4);
$handle = fopen (VAR_ASYNC . $p . $ref, 'w');
/* Update async file. */
$code = jirafeau_gen_random (4);
$handle = fopen (VAR_ASYNC . $p . $ref, 'w');
if (count ($a) == 0
|| $a['next_code'] != "$code")
return "Error";
if (count ($a) == 0
|| $a['next_code'] != "$code")
return "Error";
/* Generate link infos. */
$p = VAR_ASYNC . s2p ($ref) . $ref . "_data";
if (!file_exists($p))
/* Generate link infos. */
$p = VAR_ASYNC . s2p ($ref) . $ref . "_data";
if (!file_exists($p))
$size = filesize($p);
$np = s2p ($md5);
$delete_link_code = jirafeau_gen_random (5);
$size = filesize($p);
$np = s2p ($md5);
$delete_link_code = jirafeau_gen_random (5);
-
- /* File already exist ? */
+
+ /* File already exist ? */
if (!file_exists (VAR_FILES . $np))
@mkdir (VAR_FILES . $np, 0755, true);
if (!file_exists (VAR_FILES . $np . $md5))
rename ($p, VAR_FILES . $np . $md5);
if (!file_exists (VAR_FILES . $np))
@mkdir (VAR_FILES . $np, 0755, true);
if (!file_exists (VAR_FILES . $np . $md5))
rename ($p, VAR_FILES . $np . $md5);
/* Increment or create count file. */
$counter = 0;
if (file_exists (VAR_FILES . $np . $md5 . '_count'))
/* Increment or create count file. */
$counter = 0;
if (file_exists (VAR_FILES . $np . $md5 . '_count'))
$handle = fopen (VAR_FILES . $np . $md5. '_count', 'w');
fwrite ($handle, $counter);
fclose ($handle);
$handle = fopen (VAR_FILES . $np . $md5. '_count', 'w');
fwrite ($handle, $counter);
fclose ($handle);
/* Create link. */
$link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . '.tmp';
$handle = fopen ($link_tmp_name, 'w');
/* Create link. */
$link_tmp_name = VAR_LINKS . $md5 . rand (0, 10000) . '.tmp';
$handle = fopen ($link_tmp_name, 'w');
if (!@mkdir (VAR_LINKS . $l, 0755, true) ||
!rename ($link_tmp_name, VAR_LINKS . $l . $md5_link))
echo "Error";
if (!@mkdir (VAR_LINKS . $l, 0755, true) ||
!rename ($link_tmp_name, VAR_LINKS . $l . $md5_link))
echo "Error";
/* Clean async upload. */
jirafeau_async_delete ($ref);
return $md5_link . NL . $delete_link_code . NL . urlencode($crypt_key);
/* Clean async upload. */
jirafeau_async_delete ($ref);
return $md5_link . NL . $delete_link_code . NL . urlencode($crypt_key);
if (!file_exists ($link))
return $out;
if (!file_exists ($link))
return $out;
$c = file ($link);
$out['md5_password'] = trim ($c[0]);
$out['ip'] = trim ($c[1]);
$out['update_date'] = trim ($c[2]);
$out['destination'] = trim ($c[3], NL);
$c = file ($link);
$out['md5_password'] = trim ($c[0]);
$out['ip'] = trim ($c[1]);
$out['update_date'] = trim ($c[2]);
$out['destination'] = trim ($c[3], NL);
$p = VAR_ALIAS . s2p ($alias);
if (file_exists ($p))
return 'Error';
$p = VAR_ALIAS . s2p ($alias);
if (file_exists ($p))
return 'Error';
/* Create alias folder. */
@mkdir ($p, 0755, true);
if (!file_exists ($p))
return 'Error';
/* Create alias folder. */
@mkdir ($p, 0755, true);
if (!file_exists ($p))
return 'Error';
/* Generate password. */
$md5_password = md5 ($password);
/* Generate password. */
$md5_password = md5 ($password);
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
while (file_exists ($parse)
&& ($scan = scandir ($parse))
&& count ($scan) == 2 // '.' and '..' folders => empty.
- && basename ($parse) != basename (VAR_ALIAS))
+ && basename ($parse) != basename (VAR_ALIAS))
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
{
rmdir ($parse);
$parse = substr ($parse, 0, strlen($parse) - strlen(basename ($parse)) - 1);
\r
/* Open translation file. */\r
$trans_j = file_get_contents (JIRAFEAU_ROOT . "lib/locales/$l.json");\r
\r
/* Open translation file. */\r
$trans_j = file_get_contents (JIRAFEAU_ROOT . "lib/locales/$l.json");\r