Файл: EasyHost v2.0/system/htdocs/manager/files/file/rename.pl
Строк: 48
<?php
$system->error('File name contains invalid characters') if ($system->param('new_file') =~ /[\/]+|^.+$/);
my $extension = $system->db->selectrow_array('SELECT name FROM extensions WHERE (package_id = ? OR package_id = ?) AND name = ?',undef,'0',$login->user->package->id,lc(($system->param('new_file') =~ /([^.]+)$/)[0]));
$system->error('File name contains a banned extension') if ($file->type ne 'directory' && ($system->service->config('extensions_method') eq 'allow' && length($extension) > 0 || $system->service->config('extensions_method') eq 'deny' && length($extension) == 0));
rename($file->real->path,$login->directory->real->path.$system->param('new_file')) || $system->error('Could not rename file '.$file->name.' to '.$system->param('new_file').': '.$!);
my $file2 = $login->directory->file($system->param('new_file'));
$file2->write($file2->read) if ($file2->type eq 'html' || $file2->type ne 'html' && $file->type eq 'html');
$system->redirect('/manager/files/directory'.($file2->type eq 'directory' ? '&dir_reload=on' : ''));
?>