- /* create link file */
- $link_tmp_name = VAR_LINKS . $md5 . rand(0, 10000) . '.tmp';
- $handle = fopen($link_tmp_name, 'w');
- fwrite($handle, $name . NL . $mime_type . NL . $size . NL . $password . NL . $time . NL . $md5 . NL . ($one_time_download ? 'O' : 'R') . NL . date('U') . NL . $ip . NL . $delete_link_code . NL);
- fclose($handle);
- $md5_link = md5_file($link_tmp_name);
- if(!rename($link_tmp_name, VAR_LINKS . $md5_link)) {
- unlink($link_tmp_name);
- $counter--;
- if ($counter >= 1) {
- $handle = fopen(VAR_FILES . $md5 . '_count', 'w');
- fwrite($handle, $counter);
- fclose($handle);
- }
- else {
- unlink(VAR_FILES . $md5 . '_count');
- unlink(VAR_FILES . $md5);
+ /* create link file */
+ $link_tmp_name = VAR_LINKS . $md5.rand (0, 10000) . ' .tmp';
+ $handle = fopen ($link_tmp_name, 'w');
+ fwrite ($handle,
+ $name . NL. $mime_type . NL. $size . NL. $password . NL. $time . NL . $md5.
+ NL.($one_time_download ? 'O' : 'R') . NL.date ('U') . NL. $ip . NL.
+ $delete_link_code . NL);
+ fclose ($handle);
+ $md5_link = md5_file ($link_tmp_name);
+ if (!rename ($link_tmp_name, VAR_LINKS . $md5_link))
+ {
+ unlink ($link_tmp_name);
+ $counter--;
+ if ($counter >= 1)
+ {
+ $handle = fopen ( VAR_FILES . $md5. '_count', 'w');
+ fwrite ($handle, $counter);
+ fclose ($handle);
+ }
+ else
+ {
+ unlink ( VAR_FILES . $md5. '_count');
+ unlink ( VAR_FILES . $md5);
+ }
+ return (array(
+ 'error' =>
+ array ('has_error' => true,
+ 'why' => _('Internal error during file creation. ')),
+ 'link' =>'',
+ 'delete_link' => ''));