X-Git-Url: https://git.p6c8.net/jirafeau_project.git/blobdiff_plain/0d601dd942a8b709adf5812045afcdc5873706c8..53517d3b939f85007001beb3a01a32b032a9070b:/lib/functions.php?ds=inline diff --git a/lib/functions.php b/lib/functions.php index 10e9868..7b63148 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -67,26 +67,26 @@ jirafeau_upload_errstr ($code) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: - return _('Your file exceeds the maximum authorized file size. '); + return t('Your file exceeds the maximum authorized file size. '); break; case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_NO_FILE: return - _ + t ('Your file was not uploaded correctly. You may succeed in retrying. '); break; case UPLOAD_ERR_NO_TMP_DIR: case UPLOAD_ERR_CANT_WRITE: case UPLOAD_ERR_EXTENSION: - return _('Internal error. You may not succeed in retrying. '); + return t('Internal error. You may not succeed in retrying. '); break; default: break; } - return _('Unknown error. '); + return t('Unknown error. '); } /** Remove link and it's file @@ -118,9 +118,11 @@ jirafeau_delete ($link) fclose ($handle); } - if ($counter == 0 && file_exists ( VAR_FILES . $md5)) + if ($counter == 0) { - unlink ( VAR_FILES . $md5); + if (file_exists (VAR_FILES . $md5)) + unlink ( VAR_FILES . $md5); + if (file_exists (VAR_FILES . $md5 . '_count')) unlink ( VAR_FILES . $md5. '_count'); } } @@ -136,7 +138,8 @@ jirafeau_delete_file ($md5) foreach ($links_dir as $link) { - if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0) + if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 || + preg_match ('/\.tmp/i', "$link")) continue; /* Read link informations. */ $l = jirafeau_get_link ($link); @@ -205,7 +208,7 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $cfg, $ip) return (array( 'error' => array ('has_error' => true, - 'why' => _('Internal error during file creation. ')), + 'why' => t('Internal error during file creation. ')), 'link' =>'', 'delete_link' => '')); } @@ -259,7 +262,7 @@ jirafeau_upload ($file, $one_time_download, $key, $time, $cfg, $ip) return (array( 'error' => array ('has_error' => true, - 'why' => _('Internal error during file creation. ')), + 'why' => t('Internal error during file creation. ')), 'link' =>'', 'delete_link' => '')); } @@ -385,22 +388,23 @@ jirafeau_admin_list ($name, $file_hash, $link_hash) if (!empty ($link_hash)) echo $link_hash . ' '; if (empty ($name) && empty ($file_hash) && empty ($link_hash)) - echo _('List all files'); + echo t('List all files'); echo ''; echo ''; echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; echo ''; foreach ($links_dir as $link) { - if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0) + if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 || + preg_match ('/\.tmp/i', "$link")) continue; /* Read link informations. */ $l = jirafeau_get_link ($link); @@ -427,12 +431,12 @@ jirafeau_admin_list ($name, $file_hash, $link_hash) '' . '' . '' . - '' . + '' . '' . '' . '' . '' . - '' . + '' . '' . ''; echo ''; @@ -452,13 +456,15 @@ jirafeau_admin_clean () foreach ($links_dir as $link) { - if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0) + if (strcmp ($link, '.') == 0 || strcmp ($link, '..') == 0 || + preg_match ('/\.tmp/i', "$link")) continue; /* Read link informations. */ $l = jirafeau_get_link ($link); - if ($l['time'] > 0 && $l['time'] < time ()) + if ($l['time'] > 0 && $l['time'] < time () || // expired + !file_exists (VAR_FILES . $l['md5']) || // invalid + !file_exists (VAR_FILES . $l['md5'] . '_count')) // invalid { - echo 'HAAAA' . $l['time'] . '-->' . time (); jirafeau_delete ($link); $c++; }
' . _('Filename') . '' . _('Type') . '' . _('Size') . '' . _('Expire') . '' . _('Onetime') . '' . _('Upload date') . '' . _('Origin') . '' . _('Action') . '' . t('Filename') . '' . t('Type') . '' . t('Size') . '' . t('Expire') . '' . t('Onetime') . '' . t('Upload date') . '' . t('Origin') . '' . t('Action') . '