X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/fd3aaad433fe7e041f85752a727bb14b8865dc31..1651878a5681bb9017a27e1f2c2d280378da25af:/f.php?ds=inline diff --git a/f.php b/f.php index 0f40638..8f7aa37 100644 --- a/f.php +++ b/f.php @@ -2,7 +2,7 @@ /* * Jirafeau, your web file repository * Copyright (C) 2008 Julien "axolotl" BERNARD - * Copyright (C) 2015 Jerome Jutteau + * Copyright (C) 2015 Jerome Jutteau * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,7 +24,7 @@ require(JIRAFEAU_ROOT . 'lib/functions.php'); require(JIRAFEAU_ROOT . 'lib/lang.php'); if (!isset($_GET['h']) || empty($_GET['h'])) { - header('Location: ' . $cfg['web_root']); + header('Location: ./'); exit; } @@ -39,22 +39,15 @@ $link_name = $_GET['h']; if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) { require(JIRAFEAU_ROOT.'lib/template/header.php'); - echo '

' . t('Sorry, the requested file is not found') . '

'; + echo '

' . t('FILE_404') . '

'; require(JIRAFEAU_ROOT.'lib/template/footer.php'); exit; } $link = jirafeau_get_link($link_name); -if (count($link) == 0) { - /* Try alias. */ - $alias = jirafeau_get_alias(md5($link_name)); - if (count($alias) > 0) { - $link = jirafeau_get_link($alias["destination"]); - } -} if (count($link) == 0) { require(JIRAFEAU_ROOT.'lib/template/header.php'); - echo '

' . t('Sorry, the requested file is not found') . + echo '

' . t('FILE_404') . '

'; require(JIRAFEAU_ROOT.'lib/template/footer.php'); exit; @@ -80,21 +73,43 @@ if (isset($_GET['p']) && !empty($_GET['p'])) { $do_preview = true; } -$p = s2p($link['md5']); -if (!file_exists(VAR_FILES . $p . $link['md5'])) { +$p = s2p($link['hash']); +if (!file_exists(VAR_FILES . $p . $link['hash'])) { jirafeau_delete_link($link_name); require(JIRAFEAU_ROOT.'lib/template/header.php'); - echo '

'.t('File not available.'). + echo '

'.t('FILE_NOT_AVAIL'). '

'; require(JIRAFEAU_ROOT.'lib/template/footer.php'); exit; } if (!empty($delete_code) && $delete_code == $link['link_code']) { - jirafeau_delete_link($link_name); require(JIRAFEAU_ROOT.'lib/template/header.php'); - echo '

'.t('File has been deleted.'). - '

'; + if (isset($_POST['do_delete'])) { + jirafeau_delete_link($link_name); + echo '

'.t('FILE_DELETED'). + '

'; + } else { ?> +
+
$link['time']) { jirafeau_delete_link($link_name); require(JIRAFEAU_ROOT.'lib/template/header.php'); echo '

'. - t('The time limit of this file has expired.') . ' ' . - t('File has been deleted.') . + t('FILE_EXPIRED') . ' ' . + t('FILE_DELETED') . '

'; require(JIRAFEAU_ROOT . 'lib/template/footer.php'); exit; @@ -112,7 +127,7 @@ if ($link['time'] != JIRAFEAU_INFINITY && time() > $link['time']) { if (empty($crypt_key) && $link['crypted']) { require(JIRAFEAU_ROOT.'lib/template/header.php'); - echo '

' . t('Sorry, the requested file is not found') . + echo '

' . t('FILE_404') . '

'; require(JIRAFEAU_ROOT.'lib/template/footer.php'); exit; @@ -123,36 +138,33 @@ if (!empty($link['key'])) { if (!isset($_POST['key'])) { require(JIRAFEAU_ROOT.'lib/template/header.php'); echo '
' . - '