HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/webmin/nginx/save_location.cgi
#!/usr/bin/perl
# Create, update or delete a location block

use strict;
use warnings;
require './nginx-lib.pl';
our (%text, %in, %config, %access);
&error_setup($text{'location_err'});
&ReadParse();

# Get the current location
&lock_all_config_files();
my $server = &find_server($in{'id'});
$server || &error($text{'server_egone'});
&can_edit_server($server) || &error($text{'server_ecannot'});
my $conf = &get_config();
my @locations = &find("location", $server);
my $location;
my $old_name;
my @words = ( $in{'path'} );
unshift(@words, $in{'match'}) if ($in{'match'});
if ($in{'new'}) {
	$location = { 'name' => 'location',
		      'type' => 1,
		      'words' => \@words,
		      'members' => [ ] };
	}
else {
	$location = &find_location($server, $in{'oldpath'});
        $location || &error($text{'location_egone'});
        }

# Check for clash
if ($in{'new'} || $in{'oldpath'} ne $in{'path'}) {
	foreach my $l (@locations) {
		&location_path($l) eq $in{'path'} &&
			&error($text{'location_eclash'});
		}
	}

my $action;
my $name;
if ($in{'delete'}) {
	if ($in{'confirm'}) {
		# Got confirmation, delete it
		&save_directive($server, [ $location ], [ ]);
		$action = 'delete';
		}
	else {
		# Ask for confirmation first
		&ui_print_header(&location_desc($server, $location),
				 $text{'location_edit'}, "");

		print &ui_confirmation_form("save_location.cgi",
			&text('location_rusure',
			      "<tt>".&html_escape(&location_path($location))."</tt>"),
			[ [ 'id', $in{'id'} ],
			  [ 'oldpath', $in{'oldpath'} ],
			  [ 'delete', 1 ] ],
			[ [ 'confirm', $text{'server_confirm'} ] ],
			);

		&ui_print_footer("edit_location.cgi?id=".&urlize($in{'id'}).
				   "&path=".&urlize($in{'oldpath'}),
				 $text{'server_return'});
		}
	}
else {
	# Validate path
	$in{'path'} =~ /^\S+$/ || &error($text{'location_epath'});

	if ($in{'new'}) {
		# Create a new location object
		&save_directive($server, [ ], [ $location ]);
		$action = 'create';
		}
	else {
		# Update path in existing one
		$location->{'words'} = \@words;
		&save_directive($server, [ $location ], [ $location ]);
		$action = 'modify';
		}

	# Update root directory
	&nginx_text_parse("root", $location, undef, '^\/\S+$');
	&can_directory($in{'root'}) ||
		&error(&text('location_ecannot',
			     "<tt>".&html_escape($in{'root'})."</tt>",
			     "<tt>".&html_escape($access{'root'})."</tt>"));
	}

&flush_config_file_lines();
&unlock_all_config_files();
if ($action) {
	my $name = &find_value("server_name", $server);
	&webmin_log($action, 'location', &location_path($location),
		    { 'server' => $name });
	&redirect("edit_server.cgi?id=".&urlize($in{'id'}));
	}