* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
* Copyright (C) 2015 Jerome Jutteau <j.jutteau@gmail.com>
* Jirafeau, your web file repository
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
* Copyright (C) 2015 Jerome Jutteau <j.jutteau@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
{
$modifier = substr ($value, -1);
$bytes = substr ($value, 0, -1);
{
$modifier = substr ($value, -1);
$bytes = substr ($value, 0, -1);
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
return t('Your file exceeds the maximum authorized file size. ');
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
return t('Your file exceeds the maximum authorized file size. ');
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
return t('Internal error. You may not succeed in retrying. ');
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
return t('Internal error. You may not succeed in retrying. ');
'error' =>
array ('has_error' => true,
'why' => t('Internal error during file creation. ')),
'link' =>'',
'error' =>
array ('has_error' => true,
'why' => t('Internal error during file creation. ')),
'link' =>'',
$out['upload_date'] = trim ($c[7]);
$out['ip'] = trim ($c[8]);
$out['link_code'] = trim ($c[9]);
$out['upload_date'] = trim ($c[7]);
$out['ip'] = trim ($c[8]);
$out['link_code'] = trim ($c[9]);
* @param $key eventual password (or blank)
* @param $time time limit
* @param $ip ip address of the client
* @param $key eventual password (or blank)
* @param $time time limit
* @param $ip ip address of the client
*/
function
jirafeau_async_init ($filename, $type, $one_time, $key, $time, $ip)
*/
function
jirafeau_async_init ($filename, $type, $one_time, $key, $time, $ip)
* @param $file piece of data
* @param $code client code for this operation
* @param $max_file_size maximum allowed file size
* @param $file piece of data
* @param $code client code for this operation
* @param $max_file_size maximum allowed file size
*/
function
jirafeau_async_push ($ref, $data, $code, $max_file_size)
*/
function
jirafeau_async_push ($ref, $data, $code, $max_file_size)
|| $a['next_code'] != "$code"
|| empty ($data['tmp_name'])
|| !is_uploaded_file ($data['tmp_name']))
|| $a['next_code'] != "$code"
|| empty ($data['tmp_name'])
|| !is_uploaded_file ($data['tmp_name']))
filesize ($r_path) + filesize ($w_path) > $max_file_size * 1024 * 1024)
{
jirafeau_async_delete ($ref);
filesize ($r_path) + filesize ($w_path) > $max_file_size * 1024 * 1024)
{
jirafeau_async_delete ($ref);
* @param $code client code for this operation
* @param $crypt boolean asking to crypt or not
* @param $link_name_length link name length
* @param $code client code for this operation
* @param $crypt boolean asking to crypt or not
* @param $link_name_length link name length
*/
function
jirafeau_async_end ($ref, $code, $crypt, $link_name_length)
*/
function
jirafeau_async_end ($ref, $code, $crypt, $link_name_length)
jirafeau_decrypt_file ($fp_src, $fp_dst, $k)
{
$fs = filesize ($fp_src);
jirafeau_decrypt_file ($fp_src, $fp_dst, $k)
{
$fs = filesize ($fp_src);
* Check if Jirafeau is password protected for visitors.
* @return true if Jirafeau is password protected, false otherwise.
*/
* Check if Jirafeau is password protected for visitors.
* @return true if Jirafeau is password protected, false otherwise.
*/
* @param $password password to be challenged
* @return true if password is valid, false otherwise.
*/
* @param $password password to be challenged
* @return true if password is valid, false otherwise.
*/
* @param $ip IP to be challenged
* @return true if IP is authorized, false otherwise.
*/
* @param $ip IP to be challenged
* @return true if IP is authorized, false otherwise.
*/
-function jirafeau_alias_create ($alias, $destination, $password, $ip)
+function
+jirafeau_alias_create ($alias, $destination, $password, $ip)
{
/* Check that alias and password are long enough. */
if (strlen ($alias) < 8 ||
strlen ($alias) > 32 ||
strlen ($password) < 8 ||
strlen ($password) > 32)
{
/* Check that alias and password are long enough. */
if (strlen ($alias) < 8 ||
strlen ($alias) > 32 ||
strlen ($password) < 8 ||
strlen ($password) > 32)
-function jirafeau_alias_update ($alias, $destination, $password,
- $new_password, $ip)
+function
+jirafeau_alias_update ($alias, $destination, $password,
+ $new_password, $ip)
if (strlen ($new_password) >= 8 &&
strlen ($new_password) <= 32)
$p = md5 ($new_password);
else if (strlen ($new_password) > 0)
if (strlen ($new_password) >= 8 &&
strlen ($new_password) <= 32)
$p = md5 ($new_password);
else if (strlen ($new_password) > 0)