2012-12-31 01:22:14 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Jirafeau, your web file repository
|
2020-11-15 21:41:14 +01:00
|
|
|
* Copyright (C) 2015 Jerome Jutteau <jerome@jutteau.fr>
|
2012-12-31 01:22:14 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2018-02-09 23:35:52 +01:00
|
|
|
session_start();
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
define('JIRAFEAU_ROOT', dirname(__FILE__) . '/');
|
2012-12-31 01:22:14 +01:00
|
|
|
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
require(JIRAFEAU_ROOT . 'lib/settings.php');
|
|
|
|
require(JIRAFEAU_ROOT . 'lib/functions.php');
|
|
|
|
require(JIRAFEAU_ROOT . 'lib/lang.php');
|
2012-12-31 01:22:14 +01:00
|
|
|
|
|
|
|
/* Check if installation is OK. */
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
if (file_exists(JIRAFEAU_ROOT . 'install.php')
|
|
|
|
&& !file_exists(JIRAFEAU_ROOT . 'lib/config.local.php')) {
|
2016-05-15 17:08:27 +02:00
|
|
|
header('Location: install.php');
|
2012-12-31 01:22:14 +01:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
/* If called from CLI, no password or graphical interface */
|
|
|
|
if (php_sapi_name() == "cli") {
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
if ((count($argv)>1) && $argv[1]=="clean_expired") {
|
|
|
|
$total = jirafeau_admin_clean();
|
|
|
|
echo "$total expired files deleted.";
|
|
|
|
} elseif ((count($argv)>1) && $argv[1]=="clean_async") {
|
|
|
|
$total = jirafeau_admin_clean_async();
|
|
|
|
echo "$total old unfinished transfers deleted.";
|
|
|
|
} else {
|
|
|
|
die("No command found. Should be admin.php <clean_expired|clean_async>.");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Disable admin interface if we have a empty admin password. */
|
|
|
|
if (empty($cfg['admin_password']) && empty($cfg['admin_http_auth_user'])) {
|
|
|
|
require(JIRAFEAU_ROOT . 'lib/template/header.php');
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '<div class="error"><p>'.
|
2018-02-08 23:16:23 +01:00
|
|
|
t('NO_ADMIN') .
|
2016-05-15 17:08:27 +02:00
|
|
|
'</p></div>';
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
require(JIRAFEAU_ROOT.'lib/template/footer.php');
|
2016-05-15 17:08:27 +02:00
|
|
|
exit;
|
|
|
|
}
|
2012-12-31 01:22:14 +01:00
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
/* Unlog if asked. */
|
2018-05-01 12:17:22 +02:00
|
|
|
if (jirafeau_admin_session_logged() && isset($_POST['action']) && (strcmp($_POST['action'], 'logout') == 0)) {
|
|
|
|
jirafeau_admin_session_end();
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
}
|
2015-03-10 17:38:34 +01:00
|
|
|
|
2018-05-01 12:17:22 +02:00
|
|
|
if (!jirafeau_admin_session_logged()) {
|
|
|
|
/* Test HTTP authentification. */
|
|
|
|
if (!empty($cfg['admin_http_auth_user']) &&
|
|
|
|
$cfg['admin_http_auth_user'] == $_SERVER['PHP_AUTH_USER']) {
|
|
|
|
jirafeau_admin_session_start();
|
|
|
|
}
|
|
|
|
/* Test web password authentification. */
|
|
|
|
else if (!empty($cfg['admin_password']) && isset($_POST['admin_password'])) {
|
2019-09-12 11:02:40 +02:00
|
|
|
if ($cfg['admin_password'] === hash('sha256', $_POST['admin_password'])) {
|
2018-05-01 12:17:22 +02:00
|
|
|
jirafeau_admin_session_start();
|
|
|
|
} else {
|
|
|
|
require(JIRAFEAU_ROOT . 'lib/template/header.php');
|
|
|
|
echo '<div class="error"><p>'. t('BAD_PSW') . '</p></div>';
|
|
|
|
require(JIRAFEAU_ROOT.'lib/template/footer.php');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Admin password prompt form. */
|
|
|
|
else {
|
|
|
|
require(JIRAFEAU_ROOT . 'lib/template/header.php'); ?>
|
|
|
|
<form method="post" class="form login">
|
|
|
|
<fieldset>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<td class = "label"><label for = "enter_password">
|
|
|
|
<?php echo t('ADMIN_PSW') . ':'; ?></label>
|
|
|
|
</td>
|
2018-05-11 17:58:29 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-05-01 12:17:22 +02:00
|
|
|
<td class = "field"><input type = "password"
|
|
|
|
name = "admin_password" id = "admin_password"
|
|
|
|
size = "40" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class = "nav">
|
|
|
|
<td class = "nav next">
|
|
|
|
<input type = "submit" name = "key" value =
|
|
|
|
"<?php echo t('LOGIN'); ?>" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
<?php
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
require(JIRAFEAU_ROOT.'lib/template/footer.php');
|
2016-05-15 17:08:27 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
2013-02-14 13:44:32 +00:00
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
/* Operations may take a long time.
|
|
|
|
* Be sure PHP's safe mode is off.
|
|
|
|
*/
|
|
|
|
@set_time_limit(0);
|
|
|
|
/* Remove errors. */
|
|
|
|
@error_reporting(0);
|
2015-03-13 18:15:15 +01:00
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
/* Show admin interface if not downloading a file. */
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
if (!(isset($_POST['action']) && strcmp($_POST['action'], 'download') == 0)) {
|
2018-02-08 23:16:23 +01:00
|
|
|
require(JIRAFEAU_ROOT . 'lib/template/header.php'); ?><h2><?php echo t('ADMIN_INTERFACE'); ?></h2><?php
|
2016-05-15 17:08:27 +02:00
|
|
|
?><h2>(version <?php echo JIRAFEAU_VERSION ?>)</h2><?php
|
2012-12-31 01:22:14 +01:00
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
?><div id = "admin">
|
2018-02-08 23:16:23 +01:00
|
|
|
<fieldset><legend><?php echo t('ACTIONS'); ?></legend>
|
2016-05-15 17:08:27 +02:00
|
|
|
<table>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "clean"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-02-08 23:16:23 +01:00
|
|
|
<?php echo t('CLEAN_EXPIRED'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('CLEAN'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "clean_async"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-02-08 23:16:23 +01:00
|
|
|
<?php echo t('CLEAN_INCOMPLETE'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('CLEAN'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "list"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-02-08 23:16:23 +01:00
|
|
|
<?php echo t('LS_FILES'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('LIST'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2020-04-07 22:45:39 +02:00
|
|
|
<form method="post">
|
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "size"/>
|
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
|
|
|
<td class = "info">
|
|
|
|
<?php echo t('SIZE_DATA'); ?>
|
|
|
|
</td>
|
|
|
|
<td></td>
|
|
|
|
<td>
|
|
|
|
<input type = "submit" value = "<?php echo t('SIZE'); ?>" />
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "search_by_name"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-02-08 23:16:23 +01:00
|
|
|
<?php echo t('SEARCH_NAME'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type = "text" name = "name" id = "name"/>
|
|
|
|
</td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('SEARCH'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "search_by_file_hash"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-02-08 23:16:23 +01:00
|
|
|
<?php echo t('SEARH_BY_HASH'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type = "text" name = "hash" id = "hash"/>
|
|
|
|
</td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('SEARCH'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<tr>
|
|
|
|
<input type = "hidden" name = "action" value = "search_link"/>
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
<td class = "info">
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo t('SEARCH_LINK'); ?>
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<input type = "text" name = "link" id = "link"/>
|
|
|
|
</td>
|
|
|
|
<td>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('SEARCH'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</form>
|
|
|
|
</table>
|
2017-02-20 16:15:17 +01:00
|
|
|
<form method="post">
|
2016-05-15 17:08:27 +02:00
|
|
|
<input type = "hidden" name = "action" value = "logout" />
|
2018-05-01 12:17:22 +02:00
|
|
|
<?php echo jirafeau_admin_csrf_field() ?>
|
2018-02-08 23:16:23 +01:00
|
|
|
<input type = "submit" value = "<?php echo t('LOGOUT'); ?>" />
|
2016-05-15 17:08:27 +02:00
|
|
|
</form>
|
|
|
|
</fieldset></div><?php
|
|
|
|
}
|
2012-12-31 01:22:14 +01:00
|
|
|
|
2016-05-15 17:08:27 +02:00
|
|
|
/* Check for actions */
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
if (isset($_POST['action'])) {
|
|
|
|
if (strcmp($_POST['action'], 'clean') == 0) {
|
|
|
|
$total = jirafeau_admin_clean();
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '<div class="message">' . NL;
|
|
|
|
echo '<p>';
|
2018-02-08 23:16:23 +01:00
|
|
|
echo t('CLEANED_FILES_CNT') . ' : ' . $total;
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '</p></div>';
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
} elseif (strcmp($_POST['action'], 'clean_async') == 0) {
|
|
|
|
$total = jirafeau_admin_clean_async();
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '<div class="message">' . NL;
|
|
|
|
echo '<p>';
|
2018-02-08 23:16:23 +01:00
|
|
|
echo t('CLEANED_FILES_CNT') . ' : ' . $total;
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '</p></div>';
|
2020-04-07 22:45:39 +02:00
|
|
|
} elseif (strcmp($_POST['action'], 'size') == 0) {
|
|
|
|
$size = jirafeau_dir_size($cfg['var_root']);
|
|
|
|
$human_size = jirafeau_human_size($size);
|
|
|
|
echo '<div class="message">' . NL;
|
|
|
|
echo '<p>' . t('SIZE_DATA') . ': ' . $human_size .'</p>';
|
|
|
|
echo '</div>';
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
} elseif (strcmp($_POST['action'], 'list') == 0) {
|
|
|
|
jirafeau_admin_list("", "", "");
|
|
|
|
} elseif (strcmp($_POST['action'], 'search_by_name') == 0) {
|
|
|
|
jirafeau_admin_list($_POST['name'], "", "");
|
|
|
|
} elseif (strcmp($_POST['action'], 'search_by_file_hash') == 0) {
|
|
|
|
jirafeau_admin_list("", $_POST['hash'], "");
|
|
|
|
} elseif (strcmp($_POST['action'], 'search_link') == 0) {
|
|
|
|
jirafeau_admin_list("", "", $_POST['link']);
|
|
|
|
} elseif (strcmp($_POST['action'], 'delete_link') == 0) {
|
|
|
|
jirafeau_delete_link($_POST['link']);
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '<div class="message">' . NL;
|
2018-02-08 23:16:23 +01:00
|
|
|
echo '<p>' . t('LINK_DELETED') . '</p></div>';
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
} elseif (strcmp($_POST['action'], 'delete_file') == 0) {
|
2019-12-04 21:33:01 +01:00
|
|
|
$count = jirafeau_delete_file($_POST['hash']);
|
2016-05-15 17:08:27 +02:00
|
|
|
echo '<div class="message">' . NL;
|
2018-02-08 23:16:23 +01:00
|
|
|
echo '<p>' . t('DELETED_LINKS') . ' : ' . $count . '</p></div>';
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
} elseif (strcmp($_POST['action'], 'download') == 0) {
|
|
|
|
$l = jirafeau_get_link($_POST['link']);
|
|
|
|
if (!count($l)) {
|
2016-05-15 17:08:27 +02:00
|
|
|
return;
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
}
|
2019-12-04 21:33:01 +01:00
|
|
|
$p = s2p($l['hash']);
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
header('Content-Length: ' . $l['file_size']);
|
|
|
|
header('Content-Type: ' . $l['mime_type']);
|
|
|
|
header('Content-Disposition: attachment; filename="' .
|
2016-05-15 17:08:27 +02:00
|
|
|
$l['file_name'] . '"');
|
2019-12-04 21:33:01 +01:00
|
|
|
if (file_exists(VAR_FILES . $p . $l['hash'])) {
|
|
|
|
$r = fopen(VAR_FILES . $p . $l['hash'], 'r');
|
2018-09-18 21:59:31 +02:00
|
|
|
while (!feof($r)) {
|
|
|
|
print fread($r, 1024);
|
|
|
|
ob_flush();
|
|
|
|
}
|
|
|
|
fclose($r);
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
}
|
2016-05-15 17:08:27 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
2012-12-31 01:22:14 +01:00
|
|
|
|
[FEATURE] Switch to PSR-2
Convert all PHP files to PSR-2, which defined
a basic Coding Style Guide for PHP projects.
Using the awesome friendsofphp/php-cs-fixer tool,
running with the @PSR2 ruleset.
1) script.php (no_spaces_after_function_name, braces)
2) f.php (indentation_type, no_spaces_after_function_name, braces)
3) install.php (indentation_type, function_declaration, elseif, no_spaces_after_function_name, braces)
4) lib/functions.php (no_spaces_inside_parenthesis, method_argument_space, function_declaration, elseif, no_spaces_after_function_name, lowercase_constants, lowercase_keywords, braces, single_blank_line_at_eof)
5) lib/functions.js.php (no_spaces_after_function_name)
6) lib/lang.php (function_declaration, no_spaces_after_function_name, lowercase_constants, no_closing_tag, braces, single_blank_line_at_eof)
7) lib/template/footer.php (braces)
8) lib/config.local.bak.php (method_argument_space, no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
9) lib/config.original.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
0) lib/settings.php (indentation_type, no_spaces_after_function_name, braces)
1) lib/config.local.php (no_spaces_after_function_name, single_blank_line_at_eof)
2) index.php (indentation_type, no_spaces_after_function_name, braces)
3) admin.php (no_spaces_after_function_name, braces)
4) tos.php (no_spaces_after_function_name, no_closing_tag, single_blank_line_at_eof)
Refs #103
2017-01-24 13:08:59 +01:00
|
|
|
require(JIRAFEAU_ROOT.'lib/template/footer.php');
|
2016-05-15 17:08:27 +02:00
|
|
|
}
|
2013-02-14 13:44:32 +00:00
|
|
|
?>
|