require(JIRAFEAU_ROOT . 'lib/functions.php');
require(JIRAFEAU_ROOT . 'lib/lang.php');
- global $script_langages;
- $script_langages = array('bash' => 'Bash');
+global $script_langages;
+$script_langages = array('bash' => 'Bash');
/* Operations may take a long time.
* Be sure PHP's safe mode is off.
<div class="info">
<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>See <a href="<?php echo JIRAFEAU_WEBSITE ?>/blob/master/script.php">source code</a> of this interface to get available calls :)</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>
</div>
<br />
$key = '';
if (isset($_POST['key'])) {
$key = $_POST['key'];
+ if ($cfg['download_password_requirement'] !== 'generated' && $cfg['download_password_policy'] === 'regex'){
+ if (!preg_match($cfg['download_password_policy_regex'], $key)){
+ echo 'Error 14: The download password is not complying to the security standards.';
+ exit;
+ }
+ }
+ }elseif ($cfg['download_password_requirement'] !== 'optional'){
+ echo 'Error 13: The parameter password is required.';
+ exit;
}
$time = time();
case 'year':
$time += JIRAFEAU_YEAR;
break;
- default:
+ default:
$time = JIRAFEAU_INFINITY;
break;
}
$key = '';
if (isset($_POST['key'])) {
$key = $_POST['key'];
+ if ($cfg['download_password_requirement'] !== 'generated' && $cfg['download_password_policy'] === 'regex'){
+ if (!preg_match($cfg['download_password_policy_regex'], $key)){
+ echo 'Error 14: The download password is not complying to the security standards.';
+ exit;
+ }
+ }
+ }elseif ($cfg['download_password_requirement'] !== 'optional'){
+ echo 'Error 13: The parameter password is required.';
+ exit;
}
$d = '';
if (isset($_GET['d'])) {
}
/* Initialize an asynchronous upload. */
elseif (isset($_GET['init_async'])) {
- if (jirafeau_user_session_logged()) {}
- elseif (isset($_POST['upload_password'])) {
+ if (jirafeau_user_session_logged()) {
+ } elseif (isset($_POST['upload_password'])) {
if (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
echo 'Error 20: Invalid password';
exit;
$key = '';
if (isset($_POST['key'])) {
$key = $_POST['key'];
+ if ($cfg['download_password_requirement'] !== 'generated' && $cfg['download_password_policy'] === 'regex'){
+ if (!preg_match($cfg['download_password_policy_regex'], $key)){
+ echo 'Error 14: The download password is not complying to the security standards.';
+ exit;
+ }
+ }
+ }elseif ($cfg['download_password_requirement'] !== 'optional'){
+ echo 'Error 13: The parameter password is required.';
+ exit;
}
// Check if one time download is enabled