HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //proc/1991220/root/usr/local/usermin-1.750/authentic-theme/extensions/file-manager/rename.cgi
#!/usr/bin/perl

#
# Authentic Theme (https://github.com/authentic-theme/authentic-theme)
# Copyright Ilia Rostovtsev <programming@rostovtsev.io>
# Copyright Alexandr Bezenkov (https://github.com/real-gecko/filemin)
# Licensed under MIT (https://github.com/authentic-theme/authentic-theme/blob/master/LICENSE)
#
use strict;

use File::Basename;

our (%in, %text, $cwd, $path);

require(dirname(__FILE__) . '/file-manager-lib.pm');

if (!$in{'name'}) {
    redirect('list.cgi?path=' . urlize($path) . '&module=' . $in{'module'});
}

my $type;
if (-d "$cwd/$in{'name'}") {
    $type = 'directory';
} else {
    $type = 'file';
}

if (-e "$cwd/$in{'name'}") {
    print_error(
                (
                 text('filemanager_rename_exists', html_escape($in{'name'}),
                      html_escape($path),          $text{ 'theme_xhred_global_' . $type . '' }
                 )
                ));
} else {
    if (&rename_file($cwd . '/' . $in{'file'}, $cwd . '/' . $in{'name'})) {
        redirect('list.cgi?path=' . urlize($path) . '&module=' . $in{'module'});
    } else {
        print_error(
                    (
                     text('filemanager_rename_denied', html_escape($in{'name'}),
                          html_escape($path),          lc($text{ 'theme_xhred_global_' . $type . '' })
                     )
                    ));
    }
}