summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f841966)
This is done by removing unnecessary usage of web_root URL.
closes #127
Signed-off-by: Jerome Jutteau <j.jutteau@gmail.com>
require(JIRAFEAU_ROOT . 'lib/lang.php');
if (!isset($_GET['h']) || empty($_GET['h'])) {
require(JIRAFEAU_ROOT . 'lib/lang.php');
if (!isset($_GET['h']) || empty($_GET['h'])) {
- header('Location: ' . $cfg['web_root']);
+ header('Location: ./');
if (!isset($_POST['key'])) {
require(JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
if (!isset($_POST['key'])) {
require(JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
- '<form action = "';
- echo JIRAFEAU_ABSPREFIX . 'f.php';
- echo '" ' .
- 'method="post" id="submit_post" class="form login">'; ?>
+ '<form action="f.php" method="post" id="submit_post" class="form login">'; ?>
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset>' .
'<legend>' . t('Password protection') .
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset>' .
'<legend>' . t('Password protection') .
'<input type = "password" name = "key" />' .
'</td></tr>' .
'<tr><td>' .
'<input type = "password" name = "key" />' .
'</td></tr>' .
'<tr><td>' .
- t('By using our services, you accept our'). ' <a href="' . JIRAFEAU_ABSPREFIX . 'tos.php' . '">' . t('Terms of Service') . '</a>.' .
+ t('By using our services, you accept our'). ' <a href="tos.php">' . t('Terms of Service') . '</a>.' .
'</td></tr>';
if ($link['onetime'] == 'O') {
'</td></tr>';
if ($link['onetime'] == 'O') {
'</td></tr>';
} ?><tr><td><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit_post').action='<?php
'</td></tr>';
} ?><tr><td><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit_post').action='<?php
- echo JIRAFEAU_ABSPREFIX . 'f.php?h=' . $link_name . '&d=1';
+ echo 'f.php?h=' . $link_name . '&d=1';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if ($cfg['preview'] && jirafeau_is_viewable($link['mime_type'])) {
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit_post').action='<?php
if ($cfg['preview'] && jirafeau_is_viewable($link['mime_type'])) {
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit_post').action='<?php
- echo JIRAFEAU_ABSPREFIX . 'f.php?h=' . $link_name . '&p=1';
+ echo 'f.php?h=' . $link_name . '&p=1';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if (!$password_challenged && !$do_download && !$do_preview) {
require(JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
if (!$password_challenged && !$do_download && !$do_preview) {
require(JIRAFEAU_ROOT.'lib/template/header.php');
echo '<div>' .
- '<form action="';
- echo JIRAFEAU_ABSPREFIX . 'f.php';
- echo '" ' .
- 'method="post" id="submit_post" class="form download">'; ?>
+ '<form action="f.php" method="post" id="submit_post" class="form download">'; ?>
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset><legend>' . htmlspecialchars($link['file_name']) . '</legend><table>' .
'<tr><td>' .
t('You are about to download') . ' "' . htmlspecialchars($link['file_name']) . '" (' . jirafeau_human_size($link['file_size']) . ').' .
'</td></tr>' .
'<tr><td>' .
<input type = "hidden" name = "jirafeau" value = "<?php echo JIRAFEAU_VERSION ?>"/><?php
echo '<fieldset><legend>' . htmlspecialchars($link['file_name']) . '</legend><table>' .
'<tr><td>' .
t('You are about to download') . ' "' . htmlspecialchars($link['file_name']) . '" (' . jirafeau_human_size($link['file_size']) . ').' .
'</td></tr>' .
'<tr><td>' .
- t('By using our services, you accept our'). ' <a href="' . JIRAFEAU_ABSPREFIX . 'tos.php' . '">' . t('Terms of Service') . '</a>.' .
+ t('By using our services, you accept our'). ' <a href="tos.php">' . t('Terms of Service') . '</a>.' .
'</td></tr>';
if ($link['onetime'] == 'O') {
'</td></tr>';
if ($link['onetime'] == 'O') {
} ?>
<tr><td><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit_post').action='<?php
} ?>
<tr><td><input type="submit" id = "submit_download" value="<?php echo t('Download'); ?>"
onclick="document.getElementById('submit_post').action='<?php
- echo JIRAFEAU_ABSPREFIX . 'f.php?h=' . $link_name . '&d=1';
+ echo 'f.php?h=' . $link_name . '&d=1';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if ($cfg['preview'] && jirafeau_is_viewable($link['mime_type'])) {
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit_post').action='<?php
if ($cfg['preview'] && jirafeau_is_viewable($link['mime_type'])) {
?><input type="submit" id = "submit_preview" value="<?php echo t('Preview'); ?>"
onclick="document.getElementById('submit_post').action='<?php
- echo JIRAFEAU_ABSPREFIX . 'f.php?h=' . $link_name . '&p=1';
+ echo 'f.php?h=' . $link_name . '&p=1';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
if (!empty($crypt_key)) {
echo '&k=' . urlencode($crypt_key);
} ?>';
<div id="upload_finished_download_page">
<p>
<div id="upload_finished_download_page">
<p>
- <?php echo t('Download page') ?>
+ <a id="upload_link" href=""><?php echo t('Download page') ?></a>
<a id="upload_link_email" href=""><img id="upload_image_email"/></a>
</p>
<a id="upload_link_email" href=""><img id="upload_image_email"/></a>
</p>
- <p><a id="upload_link" href=""></a></p>
</div>
<?php if ($cfg['preview'] == true) {
?>
<div id="upload_finished_preview">
</div>
<?php if ($cfg['preview'] == true) {
?>
<div id="upload_finished_preview">
- <p><?php echo t('View link') ?>:</p>
- <p><a id="preview_link" href=""></a></p>
+ <p><a id="preview_link" href=""><?php echo t('View link') ?></a></p>
</div>
<?php
} ?>
<div id="upload_direct_download">
</div>
<?php
} ?>
<div id="upload_direct_download">
- <p><?php echo t('Direct download link') ?>:</p>
- <p><a id="direct_link" href=""></a></p>
+ <p><a id="direct_link" href=""><?php echo t('Direct download link') ?></a></p>
</div>
<div id="upload_delete">
</div>
<div id="upload_delete">
- <p><?php echo t('Delete link') ?>:</p>
- <p><a id="delete_link" href=""></a></p>
+ <p><a id="delete_link" href=""><?php echo t('Delete link') ?></a></p>
</div>
<div id="upload_validity">
</div>
<div id="upload_validity">
onclick="
document.getElementById('upload').style.display = 'none';
document.getElementById('uploading').style.display = '';
onclick="
document.getElementById('upload').style.display = 'none';
document.getElementById('uploading').style.display = '';
- upload ('<?php echo $cfg['web_root']; ?>', <?php echo jirafeau_get_max_upload_size_bytes(); ?>);
+ upload (<?php echo jirafeau_get_max_upload_size_bytes(); ?>);
jirafeau_export_cfg($cfg);
echo '<div class="message"><p>' .
t('Jirafeau is now fully operational') . ':' .
jirafeau_export_cfg($cfg);
echo '<div class="message"><p>' .
t('Jirafeau is now fully operational') . ':' .
- '<br /><a href="' . $cfg['web_root'] . '">' .
+ '<br /><a href="./">' .
$cfg['web_root'].'</a></p></div>';
}
break;
$cfg['web_root'].'</a></p></div>';
}
break;
-function show_link (url, reference, delete_code, crypt_key, date)
+function show_link (reference, delete_code, crypt_key, date)
{
// Upload finished
document.getElementById('uploading').style.display = 'none';
{
// Upload finished
document.getElementById('uploading').style.display = 'none';
document.title = 'Jirafeau - 100%';
// Download page
document.title = 'Jirafeau - 100%';
// Download page
- var download_link = url + 'f.php?h=' + reference;
- var download_link_href = url + 'f.php?h=' + reference;
+ var download_link_href = 'f.php?h=' + reference;
if (crypt_key.length > 0)
{
if (crypt_key.length > 0)
{
- download_link += '&k=' + crypt_key;
download_link_href += '&k=' + crypt_key;
}
if (!!document.getElementById('upload_finished_download_page'))
{
download_link_href += '&k=' + crypt_key;
}
if (!!document.getElementById('upload_finished_download_page'))
{
- document.getElementById('upload_link').innerHTML = download_link;
document.getElementById('upload_link').href = download_link_href;
}
// Email link
var filename = document.getElementById('file_select').files[0].name;
var b = encodeURIComponent("Download file \"" + filename + "\":") + "%0D";
document.getElementById('upload_link').href = download_link_href;
}
// Email link
var filename = document.getElementById('file_select').files[0].name;
var b = encodeURIComponent("Download file \"" + filename + "\":") + "%0D";
- b += encodeURIComponent(download_link_href) + "%0D";
+ b += encodeURIComponent("<?php echo $cfg['web_root']; ?>" + download_link_href) + "%0D";
if (false == isEmpty(date))
{
b += "%0D" + encodeURIComponent("This file will be available until " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D";
if (false == isEmpty(date))
{
b += "%0D" + encodeURIComponent("This file will be available until " + date.format('YYYY-MM-DD hh:mm (GMT O)')) + "%0D";
- var delete_link = url + 'f.php?h=' + reference + '&d=' + delete_code;
- var delete_link_href = url + 'f.php?h=' + reference + '&d=' + delete_code;
- document.getElementById('delete_link').innerHTML = delete_link;
+ var delete_link_href = 'f.php?h=' + reference + '&d=' + delete_code;
document.getElementById('delete_link').href = delete_link_href;
// Validity date
document.getElementById('delete_link').href = delete_link_href;
// Validity date
if (!!document.getElementById('preview_link'))
{
document.getElementById('upload_finished_preview').style.display = 'none';
if (!!document.getElementById('preview_link'))
{
document.getElementById('upload_finished_preview').style.display = 'none';
- var preview_link = url + 'f.php?h=' + reference + '&p=1';
- var preview_link_href = url + 'f.php?h=' + reference + '&p=1';
+ var preview_link_href = 'f.php?h=' + reference + '&p=1';
if (crypt_key.length > 0)
{
if (crypt_key.length > 0)
{
- preview_link += '&k=' + crypt_key;
preview_link_href += '&k=' + crypt_key;
}
preview_link_href += '&k=' + crypt_key;
}
type.indexOf("text") > -1 ||
type.indexOf("video") > -1)
{
type.indexOf("text") > -1 ||
type.indexOf("video") > -1)
{
- document.getElementById('preview_link').innerHTML = preview_link;
document.getElementById('preview_link').href = preview_link_href;
document.getElementById('upload_finished_preview').style.display = '';
}
}
// Direct download link
document.getElementById('preview_link').href = preview_link_href;
document.getElementById('upload_finished_preview').style.display = '';
}
}
// Direct download link
- var direct_download_link = url + 'f.php?h=' + reference + '&d=1';
- var direct_download_link_href = url + 'f.php?h=' + reference + '&d=1';
+ var direct_download_link_href = 'f.php?h=' + reference + '&d=1';
if (crypt_key.length > 0)
{
if (crypt_key.length > 0)
{
- direct_download_link += '&k=' + crypt_key;
direct_download_link_href += '&k=' + crypt_key;
}
direct_download_link_href += '&k=' + crypt_key;
}
- document.getElementById('direct_link').innerHTML = direct_download_link;
document.getElementById('direct_link').href = direct_download_link_href;
document.getElementById('direct_link').href = direct_download_link_href;
// Hide preview and direct download link if password is set
if (document.getElementById('input_key').value.length > 0)
{
// Hide preview and direct download link if password is set
if (document.getElementById('input_key').value.length > 0)
{
-function classic_upload (url, file, time, password, one_time, upload_password)
+function classic_upload (file, time, password, one_time, upload_password)
{
// Delay time estimation init as we can't have file size
upload_time_estimation_init(0);
{
// Delay time estimation init as we can't have file size
upload_time_estimation_init(0);
expiryDate = localDatetime;
}
expiryDate = localDatetime;
}
- show_link (url, res[0], res[1], res[2], expiryDate);
+ show_link (res[0], res[1], res[2], expiryDate);
- req.open ("POST", url + 'script.php' , true);
+ req.open ("POST", 'script.php' , true);
var form = new FormData();
form.append ("file", file);
var form = new FormData();
form.append ("file", file);
}
var async_global_transfered = 0;
}
var async_global_transfered = 0;
-var async_global_url = '';
var async_global_file;
var async_global_ref = '';
var async_global_max_size = 0;
var async_global_time;
var async_global_transfering = 0;
var async_global_file;
var async_global_ref = '';
var async_global_max_size = 0;
var async_global_time;
var async_global_transfering = 0;
-function async_upload_start (url, max_size, file, time, password, one_time, upload_password)
+function async_upload_start (max_size, file, time, password, one_time, upload_password)
{
async_global_transfered = 0;
{
async_global_transfered = 0;
- async_global_url = url;
async_global_file = file;
async_global_max_size = max_size;
async_global_time = time;
async_global_file = file;
async_global_max_size = max_size;
async_global_time = time;
async_upload_push (code);
}
}
async_upload_push (code);
}
}
- req.open ("POST", async_global_url + 'script.php?init_async' , true);
+ req.open ("POST", 'script.php?init_async' , true);
var form = new FormData();
form.append ("filename", async_global_file.name);
var form = new FormData();
form.append ("filename", async_global_file.name);
async_upload_push (code);
}
}
async_upload_push (code);
}
}
- req.open ("POST", async_global_url + 'script.php?push_async' , true);
+ req.open ("POST", 'script.php?push_async' , true);
var chunk_size = parseInt (async_global_max_size * 0.50);
var start = async_global_transfered;
var chunk_size = parseInt (async_global_max_size * 0.50);
var start = async_global_transfered;
expiryDate = localDatetime;
}
expiryDate = localDatetime;
}
- show_link (async_global_url, res[0], res[1], res[2], expiryDate);
+ show_link (res[0], res[1], res[2], expiryDate);
- req.open ("POST", async_global_url + 'script.php?end_async' , true);
+ req.open ("POST", 'script.php?end_async' , true);
var form = new FormData();
form.append ("ref", async_global_ref);
var form = new FormData();
form.append ("ref", async_global_ref);
-function upload (url, max_size)
+function upload (max_size)
{
if (check_html5_file_api ()
&& document.getElementById('file_select').files[0].size >= max_size)
{
{
if (check_html5_file_api ()
&& document.getElementById('file_select').files[0].size >= max_size)
{
- async_upload_start (url,
max_size,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
max_size,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
document.getElementById('file_select').files[0],
document.getElementById('select_time').value,
document.getElementById('input_key').value,
/* Print link informations. */
echo '<tr>';
echo '<td>' .
/* Print link informations. */
echo '<tr>';
echo '<td>' .
- '<strong><a id="upload_link" href="' . JIRAFEAU_ABSPREFIX . 'f.php?h='. htmlspecialchars($node) .'" title="' .
+ '<strong><a id="upload_link" href="f.php?h='. htmlspecialchars($node) .'" title="' .
t('Download page') . '">' . htmlspecialchars($l['file_name']) . '</a></strong>';
echo '</td>';
echo '<td>' . $l['mime_type'] . '</td>';
t('Download page') . '">' . htmlspecialchars($l['file_name']) . '</a></strong>';
echo '</td>';
echo '<td>' . $l['mime_type'] . '</td>';
<?php
if (false === empty($cfg['installation_done'])) {
echo ' <span>|</span> ';
<?php
if (false === empty($cfg['installation_done'])) {
echo ' <span>|</span> ';
- echo '<a href="' . JIRAFEAU_ABSPREFIX . 'tos.php">' . t('Terms of Service') . '</a>';
+ echo '<a href="tos.php">' . t('Terms of Service') . '</a>';
<head>
<meta charset="utf-8">
<title><?php echo (true === empty($cfg['title']))? t('Jirafeau, your web file repository') : $cfg['title']; ?></title>
<head>
<meta charset="utf-8">
<title><?php echo (true === empty($cfg['title']))? t('Jirafeau, your web file repository') : $cfg['title']; ?></title>
- <link rel="shortcut icon" href="<?php echo JIRAFEAU_ABSPREFIX . 'media/' . $cfg['style'] . '/favicon.ico'; ?>">
- <link href="<?php echo JIRAFEAU_ABSPREFIX . 'media/' . $cfg['style'] . '/style.css.php'; ?>" rel="stylesheet" type="text/css" />
+ <link rel="shortcut icon" href="<?php echo 'media/' . $cfg['style'] . '/favicon.ico'; ?>">
+ <link href="<?php echo 'media/' . $cfg['style'] . '/style.css.php'; ?>" rel="stylesheet" type="text/css" />
-<script type="text/javascript" src="<?php echo JIRAFEAU_ABSPREFIX . 'lib/functions.js.php'; ?>"></script>
+<script type="text/javascript" src="<?php echo 'lib/functions.js.php'; ?>"></script>
- <a href="<?php echo JIRAFEAU_ABSPREFIX; ?>">
<?php echo (true === empty($cfg['title']))? t('Jirafeau, your web file repository') : $cfg['title']; ?>
</a>
</h1>
<?php echo (true === empty($cfg['title']))? t('Jirafeau, your web file repository') : $cfg['title']; ?>
</a>
</h1>
<h2>Scripting interface</h2>
<p>This interface permits to script your uploads and downloads.</p>
<p>See <a href="https://gitlab.com/mojo42/Jirafeau/blob/master/script.php">source code</a> of this interface to get available calls :)</p>
<h2>Scripting interface</h2>
<p>This interface permits to script your uploads and downloads.</p>
<p>See <a href="https://gitlab.com/mojo42/Jirafeau/blob/master/script.php">source code</a> of this interface to get available calls :)</p>
- <p>You may download a preconfigured <a href="<?php echo JIRAFEAU_ABSPREFIX . 'script.php?lang=bash'; ?>">Bash Script</a> to easily send to and get files from the API via command line.</p>
+ <p>You may download a preconfigured <a href="script.php?lang=bash">Bash Script</a> to easily send to and get files from the API via command line.</p>