chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:12:17 +08:00
commit cf8edb9f21
44281 changed files with 1655134 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
---- Changes since 1.140 ----
Added an option to have environment variable substitution done on edited filenames.
---- Changes since 1.150 ----
Added an option to clear Webmin-related environment variables before running a command.
---- Changes since 1.210 ----
File editors can how have parameters, which are substituted into the filename before editing.
---- Changes since 1.220 ----
Added a new type of command - an SQL query or update that will be performed against a database for which a Perl DBI driver is installed.
---- Changes since 1.230 ----
If other servers are defined in the Webmin Servers Index module, custom commands can be configured to run on one or more other Webmin hosts in a cluster.
---- Changes since 1.250 ----
The output from a command is now shown as it is generated, for commands run locally.
Added a Module Config parameter to change the number of columns used to display command buttons in.
---- Changes since 1.270 ----
The contents of uploaded files are no longer logged.
---- Changes since 1.340 ----
Removed the Module Config option to control if a shell is used when executing a command as a user, since we can now work this out automatically.
---- Changes since 1.390 ----
Re-designed the user interface somewhat, and converted all code to use the new Webmin UI library.
When commands are shown in a table and no parameters are needed, the names now link directly to run the command.
---- Changes since 1.400 ----
Added a popup progress tracker to commands with file upload fields.
---- Changes since 1.410 ----
All links to commands are via an ID number rather than an index, which makes them easier to link to from other web pages.
---- Changes since 1.450 ----
Added a parameter-level option to make the parameter mandatory.
---- Changes since 1.500 ----
Added a button to clone an existing command when editing.
The sort order of commands can now be set on the Module Config page, and is respected in the Webmin Users module.
---- Changes since 1.510 ----
Fixed a bug that broke remote command execution with parameters.
Added a new parameter type for selecting multiple items from a menu.
---- Changes since 1.530 ----
Added an option for custom commands to have their output displayed without any Webmin UI, in a selectable MIME type.
---- Changes since 1.550 ----
A default value for each custom command parameter can now be entered on the Edit Command form. Defaults can also be read from a file or shell command, if this behavior is enabled on the Module Config page. Thanks to Sart Cole for suggesting this feature.
A command can now be configured to not display any output at all, and instead return to the module index after being run.
---- Changes since 1.560 ----
Added an option to the file editor to run a command before the file is displayed, thanks to a suggestion from Sart Cole.
Added new date and left-right menu parameter types.
---- Changes since 1.570 ----
Added a new parameter type which is a submit button.
+42
View File
@@ -0,0 +1,42 @@
require 'custom-lib.pl';
# acl_security_form(&options)
# Output HTML for editing security options for the custom module
sub acl_security_form
{
my ($o) = @_;
my $mode = $o->{'cmds'} eq '*' ? 1 :
$o->{'cmds'} =~ /^\!/ ? 2 : 0;
my @cmds = &sort_commands(&list_commands());
print &ui_table_row($text{'acl_cmds'},
&ui_radio("cmds_def", $mode,
[ [ 1, $text{'acl_call'} ],
[ 0, $text{'acl_csel'} ],
[ 2, $text{'acl_cexcept'} ] ])."<br>\n".
&ui_select("cmds",
[ split(/\s+/, $o->{'cmds'}) ],
[ map { [ $_->{'id'}, $_->{'desc'} ] } @cmds ],
10, 1), 3);
print &ui_table_row($text{'acl_edit'},
&ui_yesno_radio("edit", $_[0]->{'edit'}));
}
# acl_security_save(&options, &in)
# Parse the form for security options for the custom module
sub acl_security_save
{
my ($o, $in) = @_;
if ($in->{'cmds_def'} == 1) {
$o->{'cmds'} = "*";
}
elsif ($in->{'cmds_def'} == 0) {
$o->{'cmds'} = join(" ", split(/\0/, $in->{'cmds'}));
}
else {
$o->{'cmds'} = join(" ", "!", split(/\0/, $in->{'cmds'}));
}
$o->{'edit'} = $in->{'edit'};
}
+44
View File
@@ -0,0 +1,44 @@
do 'custom-lib.pl';
# backup_config_files()
# Returns files and directories that can be backed up
sub backup_config_files
{
my @rv;
foreach my $e ("cmd", "edit", "sql", "html", "hosts") {
push(@rv, glob("$module_config_directory/*.$e"));
}
return @rv;
}
# pre_backup(&files)
# Called before the files are actually read
sub pre_backup
{
return undef;
}
# post_backup(&files)
# Called after the files are actually read
sub post_backup
{
return undef;
}
# pre_restore(&files)
# Called before the files are restored from a backup
sub pre_restore
{
return undef;
}
# post_restore(&files)
# Called after the files are restored from a backup
sub post_restore
{
return undef;
}
1;
+42
View File
@@ -0,0 +1,42 @@
do 'custom-lib.pl';
sub cgi_args
{
my ($cgi) = @_;
my @cust = grep { &can_run_command($_) } &list_commands();
if ($cgi eq 'edit_cmd.cgi') {
# Custom command editor
my ($cmd) = grep { !$_->{'edit'} && !$_->{'sql'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) :
$access{'edit'} ? 'new=1' : 'none';
}
elsif ($cgi eq 'form.cgi') {
# Custom command form
my ($cmd) = grep { !$_->{'edit'} && !$_->{'sql'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) : 'none';
}
elsif ($cgi eq 'edit_file.cgi') {
# File editor editor
my ($cmd) = grep { $_->{'edit'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) :
$access{'edit'} ? 'new=1' : 'none';
}
elsif ($cgi eq 'view.cgi') {
# Custom command form
my ($cmd) = grep { $_->{'edit'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) : 'none';
}
elsif ($cgi eq 'edit_sql.cgi') {
# SQL query
my ($cmd) = grep { $_->{'sql'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) :
$access{'edit'} ? 'new=1' : 'none';
}
elsif ($cgi eq 'sqlform.cgi') {
# SQL query form
my ($cmd) = grep { $_->{'sql'} } @cust;
return $cmd ? 'id='.&urlize($cmd->{'id'}) : 'none';
}
return undef;
}
+3
View File
@@ -0,0 +1,3 @@
display_mode=0
params_file=0
params_cmd=0
+3
View File
@@ -0,0 +1,3 @@
display_mode=0
params_file=0
params_cmd=0
+7
View File
@@ -0,0 +1,7 @@
display_mode=Main page shows,1,0-All commands and parameters,1-Links to commands
width=Width of file editor window,3,Default (80 chars)
height=Height of file editor window,3,Default (20 chars)
wrap=File editor wrap mode,1,-Default (Soft),hard-Hard,off-Off
sort=Sort commands by,1,desc-Command name,html-Description,-Command ordering
params_file=Treat default values starting with / as file to read?,1,1-Yes,0-No
params_cmd=Treat default values ending with | as command to run?,1,1-Yes,0-No
+6
View File
@@ -0,0 +1,6 @@
display_mode=La pàgina principal mostra,1,0-Totes les ordres i paràmetres,1-Enllaços a les ordres
width=Amplada de la finestra de l'editor,3,Defecte (80 caràcters)
height=Alçada de la finestra de l'editor,3,Defecte (20 caràcters)
wrap=Mode wrap de l'editor,1,-Defecte (Soft),hard-Hard,off-Desactivat
params_file=Tracta els valors per defecte que comencin amb / com un fitxer per llegir,1,1-Sí,0-No
params_cmd=Tracta els valors per defecte que acabin amb | com a ordres a executar,1,1-Sí,0-No
+4
View File
@@ -0,0 +1,4 @@
display_mode=Hlavní stránka zobrazuje,1,0-Všechny příkazy a parametry,1-Linky k příkazům
width=šířka pro okno editoru souboru,3,Výchozí (80 znaků)
height=Výška pro okno editoru souboru,3,Výchozí (20 znaků)
wrap=Mód pro zalamování řádku v editoru souboru,1,-Výchozí (Lehké),hard-Těžké,off-Vypnuto
+7
View File
@@ -0,0 +1,7 @@
display_mode=Hauptseite zeigt,1,0-Alle Befehle und Parameter,1-Verknüpfungen zu Befehlen
width=Breite des Dateieditor&#45;Fensters,3,Standard (80 Zeichen)
height=Höhe des Dateieditor-Fensters,3,Standard (20 Zeichen)
wrap=Zeilenumbruch im Dateieditor,1,-Standard (Weich),hard-Hart,off-Ausschalten
sort=Sortiere Befehle nach,1,desc-Command-Name,html-Beschreibung,-Befehlsabarbeitung
params_file=Behandlung von Standardwerten&#44; beginnend mit / als Datei lesen?,1,1-Ja,0-Nein
params_cmd=Behandlung von Standardwerten&#44; die mit | enden als Befehl ausführen,1,1-Ja,0-Nein
+4
View File
@@ -0,0 +1,4 @@
display_mode=La página principal muestra,1,0-Todos los comandos y parámetros,1-Enlaces a los comandos
width=Anchura de la ventana del editor de archivos,3,Defecto (80 caracteres)
height=Altura de la ventana del editor de archivos,3,Defecto (20 caracteres)
wrap=Modo de palabra del editor de archivos,1,-Defecto (Soft),hard-Hard,off-Off
+7
View File
@@ -0,0 +1,7 @@
display_mode=Afficher la page principale,1,0-Toutes les commandes et paramètres,1-Liens vers les commandes
width=Largeur de la fenêtre de l'éditeur de fichiers,3,Par défaut (80 caractères)
height=Hauteur de la fenêtre de l'éditeur de fichiers,3,Par défaut (20 caractères)
wrap=Mode wrap de l'éditeur de fichiers,1,-Par défaut (Soft),hard-Dur,off-Désactivé
sort=Trier les commandes par,1,desc-Nom de la commande,html-Description,-Ordre des commandes
params_file=Traiter les valeurs par défaut commençant par / comme un fichier à lire?,1,1-Oui,0-Non
params_cmd=Traitez les valeurs par défaut se terminant par | comme commande à exécuter?,1,1-Oui,0-Non
View File
+5
View File
@@ -0,0 +1,5 @@
display_mode=La pagina principale visualizza,1,0-Tutti i comandi e i parametri,1-Collegamenti ai comandi
width=Larghezza della finestra del file editor,3,Predefinita (80 caratteri)
height=Altezza della finestra del file editor,3,Predefinita (20 caratteri)
wrap=Modalità di ritorno a capo del file editor,1,-Predefinita (Soft),hard-Hard,off-Disabilitata
sort=Elenca comandi in ordine di,1,desc-Nome comando,html-Descrizione,-Comando di ordinamento
+4
View File
@@ -0,0 +1,4 @@
display_mode=메인 페이지 보기,1,0-모든 명령과 파라미터,1-명령 링크
width=파일 편집기 창 넓이,3,기본 (80 글자)
height=파일 편집창의 높이,3,기본 (20 글자)
wrap=파일 편집기 wrap 모드,1,-기본 (Soft),hard-Hard,off-Off
+7
View File
@@ -0,0 +1,7 @@
display_mode=Laman utama menunjukkan,1,0-Semua arahan dan parameter,1-Pautan kepada arahan
width=Lebar fail tetingkap editor,3,Lalai (80 aksara)
height=Ketinggian fail tetingkap editor,3,Lalai (20 aksara)
wrap=Fail mod kawalan editor, 1,-lalai (Lembut),keras-Hard,off-Off
sort=Sisih arahan dengan,1,desc-Nama arahan,html-Penerangan,-Urutan arahan
params_file=Anggap nilai lalai bermula dengan / sebagai fail untuk dibaca?,1,1-Ya,0-Tidak
params_cmd=Anggap nilai lalai berakhir dengan | sebagai arahan untuk menjalankan?,1,1-Ya,0-Tidak
+7
View File
@@ -0,0 +1,7 @@
display_mode=Hoofdpagina toont,1,0-Alle opdrachten en parameters,1-Links naar opdrachten
width=Breedte van bestand bewerking venster,3,Standaard (80 karakters)
height=Hoogte van bestands editor venster,3,Standaard (20 karakters)
wrap=File editor terugloop modus,1,-Standaard (Zacht),hard-Hard,off-Uit
sort=Sorteer opdrachten met,1,desc-Opdracht naam,html-Omschrijving,-Opdracht volgorde
params_file=Behandel standaard waardes die starten met / als een file om te lezen?,1,1-Ja,0-Nee
params_cmd=Behandel standaard waardes die eindigen op | als uit te voeren opdracht?,1,1-Ja,0-Nee
+7
View File
@@ -0,0 +1,7 @@
display_mode=Hovedsiden viser,1,0-Alle kommandoer og parametere,1-Lenker til kommandoer
width=Bredde på fileditor-vindu,3,Standard (80 tegn)
height=Høyde på fileditor-vindu,3,Standard (20 tegn)
wrap=Orddelingsmodus for fileditor,1,-Standard (Myk),hard-Hard,off-Av
sort=Sorter kommandoer etter,1,desc-Kommando&#45;navn,html-Beskrivelse,-Kommandosortering
params_file=Behandle standardverdier som starter med / som filer som skal leses,1,1-Ja,0-Nei
params_cmd=Behandle standardverdier som slutter med | som kommando som skal kjøres?,1,1-Ja,0-Nei
+7
View File
@@ -0,0 +1,7 @@
display_mode=Na głównej stronie ukazują się,1,0-Wszystkie polecenia i parametry,1-Dowiązania do poleceń
width=Szerokość okna edytora pliku,3,Domyślnie (80 znaków)
height=Wysokość okna edytora pliku,3,Domyślnie (20 znaków)
wrap=Tryb wrap edytora plików,1,-Domyślnie (miękki),hard-Twardy,off-Wyłączone
sort=Sortuj polecenia według,1,desc-Nazwy,html-Opisu,-kolejności polecenia
params_file=Traktuj domyślne wartości zaczynające się znakiem / jako plik do odczytania,1,1-Tak,0-Nie
params_cmd=Traktuj domyślne wartości kończące się znakiem | jako polecenie do uruchomienia,1,1-Tak,0-Nie
+1
View File
@@ -0,0 +1 @@
display_mode=На главной странице показываются,1,0-Все команды и параметры,1-Ссылки на команды
View File
+3
View File
@@ -0,0 +1,3 @@
display_mode=Ana sayfada neler gösterilsin,1,0-Bütün komutlar ve parametreleri,1-Komutların linkleri
width=Dosya düzenleyicisi penceresinin genişliği,3,Öntanımlı (80 karakter)
height=Dosya düzenleyicisi penceresinin yüksekliği,3,Öntanımlı (20 karakter)
+1
View File
@@ -0,0 +1 @@
display_mode=На головній сторінці показуються,1,0-всі команди і параметри,1-посилання на команди
+650
View File
@@ -0,0 +1,650 @@
# custom-lib.pl
# Functions for storing custom commands
BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();
# list_commands()
# Returns a list of all custom commands
sub list_commands
{
local (@rv, $f);
local $mcd = $module_info{'usermin'} ? $config{'webmin_config'}
: $module_config_directory;
opendir(DIR, $mcd);
while($f = readdir(DIR)) {
local %cmd;
if ($f =~ /^(\d+)\.cmd$/) {
# Read custom-command file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, "<".$cmd{'file'});
chop($cmd{'cmd'} = <FILE>);
chop($cmd{'desc'} = <FILE>);
local @o = split(/\s+/, <FILE>);
$cmd{'user'} = $o[0];
$cmd{'raw'} = int($o[1]);
$cmd{'su'} = int($o[2]);
$cmd{'order'} = int($o[3]);
$cmd{'noshow'} = int($o[4]);
$cmd{'usermin'} = int($o[5]);
$cmd{'timeout'} = int($o[6]);
$cmd{'clear'} = int($o[7]);
$cmd{'format'} = $o[8] eq '-' ? undef : $o[8];
}
elsif ($f =~ /^(\d+)\.edit$/) {
# Read file-editor file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, "<".$cmd{'file'});
chop($cmd{'edit'} = <FILE>);
chop($cmd{'desc'} = <FILE>);
chop($cmd{'user'} = <FILE>);
chop($cmd{'group'} = <FILE>);
chop($cmd{'perms'} = <FILE>);
chop($cmd{'before'} = <FILE>);
chop($cmd{'after'} = <FILE>);
chop($cmd{'order'} = <FILE>);
$cmd{'order'} = int($cmd{'order'});
chop($cmd{'usermin'} = <FILE>);
chop($cmd{'envs'} = <FILE>);
chop($cmd{'beforeedit'} = <FILE>);
}
elsif ($f =~ /^(\d+)\.sql$/) {
# Read SQL file
$cmd{'file'} = "$mcd/$f";
$cmd{'id'} = $1;
open(FILE, "<".$cmd{'file'});
chop($cmd{'desc'} = <FILE>);
chop($cmd{'type'} = <FILE>);
chop($cmd{'db'} = <FILE>);
chop($cmd{'user'} = <FILE>);
chop($cmd{'pass'} = <FILE>);
chop($cmd{'host'} = <FILE>);
chop($cmd{'sql'} = <FILE>);
$cmd{'sql'} =~ s/\t/\n/g;
chop($cmd{'order'} = <FILE>);
}
if (%cmd) {
# Read common stuff
while(<FILE>) {
s/\r|\n//g;
local @a = split(/:/, $_, 5);
local ($quote, $must) = split(/,/, $a[3]);
push(@{$cmd{'args'}}, { 'name' => $a[0],
'type' => $a[1],
'opts' => $a[2],
'quote' => int($quote),
'must' => int($must),
'desc' => $a[4] });
}
close(FILE);
$cmd{'index'} = scalar(@rv);
open(HTML, "<$mcd/$cmd{'id'}.html");
while(<HTML>) {
$cmd{'html'} .= $_;
}
close(HTML);
# Read cluster hosts file
open(CLUSTER, "<$mcd/$cmd{'id'}.hosts");
while(<CLUSTER>) {
s/\r|\n//g;
push(@{$cmd{'hosts'}}, $_);
}
close(CLUSTER);
push(@rv, \%cmd);
}
}
closedir(DIR);
return @rv;
}
# sort_commands(&command, ...)
# Sorts a list of custom commands by the user-defined order
sub sort_commands
{
local @cust = @_;
if ($config{'sort'}) {
@cust = sort { lc($a->{$config{'sort'}}) cmp
lc($b->{$config{'sort'}}) } @cust;
}
else {
@cust = sort { local $o = $b->{'order'} <=> $a->{'order'};
$o ? $o : $a->{'id'} <=> $b->{'id'} } @cust;
}
return @cust;
}
# get_command(id)
# Returns the command with some ID
sub get_command
{
local ($id, $idx) = @_;
local @cmds = &list_commands();
local $cmd;
if ($id) {
($cmd) = grep { $_->{'id'} eq $id } &list_commands();
}
else {
$cmd = $cmds[$idx];
}
return $cmd;
}
# save_command(&command)
sub save_command
{
local $c = $_[0];
if ($c->{'edit'}) {
# Save a file editor
&open_lock_tempfile(FILE, ">$module_config_directory/$c->{'id'}.edit");
&print_tempfile(FILE, $c->{'edit'},"\n");
&print_tempfile(FILE, $c->{'desc'},"\n");
&print_tempfile(FILE, $c->{'user'},"\n");
&print_tempfile(FILE, $c->{'group'},"\n");
&print_tempfile(FILE, $c->{'perms'},"\n");
&print_tempfile(FILE, $c->{'before'},"\n");
&print_tempfile(FILE, $c->{'after'},"\n");
&print_tempfile(FILE, $c->{'order'},"\n");
&print_tempfile(FILE, $c->{'usermin'},"\n");
&print_tempfile(FILE, $c->{'envs'},"\n");
&print_tempfile(FILE, $c->{'beforeedit'},"\n");
}
elsif ($c->{'sql'}) {
# Save an SQL command
&open_lock_tempfile(FILE, ">$module_config_directory/$c->{'id'}.sql");
&print_tempfile(FILE, $c->{'desc'},"\n");
&print_tempfile(FILE, $c->{'type'},"\n");
&print_tempfile(FILE, $c->{'db'},"\n");
&print_tempfile(FILE, $c->{'user'},"\n");
&print_tempfile(FILE, $c->{'pass'},"\n");
&print_tempfile(FILE, $c->{'host'},"\n");
local $sql = $c->{'sql'};
$sql =~ s/\n/\t/g;
&print_tempfile(FILE, $sql,"\n");
&print_tempfile(FILE, $c->{'order'},"\n");
}
else {
# Save a custom command
&open_lock_tempfile(FILE, ">$module_config_directory/$c->{'id'}.cmd");
&print_tempfile(FILE, $c->{'cmd'},"\n");
&print_tempfile(FILE, $c->{'desc'},"\n");
&print_tempfile(FILE,
$c->{'user'}," ",int($c->{'raw'})," ",int($c->{'su'})," ",
int($c->{'order'})," ",int($c->{'noshow'})," ",
int($c->{'usermin'})," ",int($c->{'timeout'})," ",
int($c->{'clear'})," ",($c->{'format'} || "-"),"\n");
}
# Save parameters
foreach $a (@{$c->{'args'}}) {
&print_tempfile(FILE, $a->{'name'},":",$a->{'type'},":",
$a->{'opts'},":",int($a->{'quote'}),",",int($a->{'must'}),":",
$a->{'desc'},"\n");
}
&close_tempfile(FILE);
# Save HTML description file
&lock_file("$module_config_directory/$c->{'id'}.html");
if ($cmd->{'html'}) {
&open_tempfile(HTML, ">$module_config_directory/$c->{'id'}.html");
&print_tempfile(HTML, $cmd->{'html'});
&close_tempfile(HTML);
}
else {
unlink("$module_config_directory/$c->{'id'}.html");
}
&unlock_file("$module_config_directory/$c->{'id'}.html");
# Save cluster hosts
&lock_file("$module_config_directory/$c->{'id'}.hosts");
if (@{$cmd->{'hosts'}}) {
&open_tempfile(CLUSTER, ">$module_config_directory/$c->{'id'}.hosts");
foreach my $h (@{$cmd->{'hosts'}}) {
&print_tempfile(CLUSTER, "$h\n");
}
&close_tempfile(CLUSTER);
}
else {
unlink("$module_config_directory/$c->{'id'}.hosts");
}
&unlock_file("$module_config_directory/$c->{'id'}.hosts");
}
# delete_command(&command)
sub delete_command
{
local $f = "$module_config_directory/$_[0]->{'id'}".
($_[0]->{'edit'} ? ".edit" : $_[0]->{'sql'} ? ".sql" : ".cmd");
&lock_file($f);
unlink($f);
&unlock_file($f);
# Delete HTML file
local $hf = "$module_config_directory/$_[0]->{'id'}.html";
if (-r $hf) {
&lock_file($hf);
unlink($hf);
&unlock_file($hf);
}
# Delete cluster file
local $cf = "$module_config_directory/$_[0]->{'id'}.hosts";
if (-r $cf) {
&lock_file($cf);
unlink($cf);
&unlock_file($cf);
}
}
sub can_run_command
{
if ($module_info{'usermin'}) {
# Only modules marked as for Usermin are considered
return 0 if (!$_[0]->{'usermin'});
# Check detailed access control list (if any)
return 1 if (!$config{'access'});
local @uinfo = @remote_user_info;
@uinfo = getpwnam($remote_user) if (!@uinfo);
local $l;
foreach $l (split(/\t/, $config{'access'})) {
if ($l =~ /^(\S+):\s*(.*)$/) {
local ($user, $ids) = ($1, $2);
local $applies;
if ($user =~ /^\@(.*)$/) {
# Check if user is in group
local @ginfo = getgrnam($1);
$applies++
if (@ginfo && ($ginfo[2] == $uinfo[3] ||
&indexof($remote_user,
split(/\s+/, $ginfo[3])) >= 0));
}
elsif ($user eq $remote_user || $user eq "*") {
$applies++;
}
if ($applies) {
# Rule is for this user - check list
local @ids = split(/\s+/, $ids);
local $d;
foreach $d (@ids) {
return 1 if ($d eq '*' ||
$_[0]->{'id'} eq $d);
return 0 if ("!".$_[0]->{'id'} eq $d);
}
return 0;
}
}
}
return 0;
}
else {
# Just use Webmin user's list of databases
local $c;
local $found;
return 1 if ($access{'cmds'} eq '*');
local @cmds = split(/\s+/, $access{'cmds'});
foreach $c (@cmds) {
$found++ if ($c eq $_[0]->{'id'});
}
return $cmds[0] eq '!' ? !$found : $found;
}
}
# read_opts_file(file)
# Read the file containing possible menu options for a command
sub read_opts_file
{
local @rv;
local $file = $_[0];
if ($file !~ /^\// && $file !~ /\|\s*$/) {
local @uinfo = getpwnam($remote_user);
if (@uinfo) {
$file = "$uinfo[7]/$file";
}
}
my $h;
$h = "<" if ($file =~ /^\// && $file !~ /\|\s*$/);
open(FILE, "$h".$file);
while(<FILE>) {
s/\r|\n//g;
next if (/^#/);
if (/^"([^"]*)"\s+"([^"]*)"$/) {
push(@rv, [ $1, $2 ]);
}
elsif (/^"([^"]*)"$/) {
push(@rv, [ $1, $1 ]);
}
elsif (/^(\S+)\s+(\S.*)/) {
push(@rv, [ $1, $2 ]);
}
else {
push(@rv, [ $_, $_ ]);
}
}
close(FILE);
return @rv;
}
# show_params_inputs(&command, no-quote, editor-mode)
sub show_params_inputs
{
local ($cmd, $noquote, $editor) = @_;
local $ptable = &ui_columns_start([
$text{'edit_name'}, $text{'edit_desc'}, $text{'edit_type'},
$noquote ? ( ) : ( $text{'edit_quote'} ),
$text{'edit_must'},
], 100, 0, undef, undef);
local @a = (@{$cmd->{'args'}}, { 'quote' => 1 });
for(my $i=0; $i<@a; $i++) {
local @cols;
push(@cols, &ui_textbox("name_$i", $a[$i]->{'name'}, 10));
push(@cols, &ui_textbox("desc_$i", $a[$i]->{'desc'}, 40));
local @opts;
for(my $j=0; $text{"edit_type$j"}; $j++) {
next if ($editor &&
($j == 7 || $j == 8 || $j == 10 || $j == 11));
push(@opts, [ $j, $text{"edit_type$j"} ]);
}
push(@cols, &ui_select("type_$i", $a[$i]->{'type'}, \@opts)." ".
&ui_textbox("opts_$i", $a[$i]->{'opts'}, 40));
if (!$noquote) {
push(@cols, &ui_yesno_radio("quote_$i",
int($a[$i]->{'quote'})));
}
push(@cols, &ui_yesno_radio("must_$i",
int($a[$i]->{'must'})));
$ptable .= &ui_columns_row(\@cols);
}
$ptable .= &ui_columns_end();
print $ptable;
}
# parse_params_inputs(&command)
sub parse_params_inputs
{
local ($cmd) = @_;
$cmd->{'args'} = [ ];
my ($i, $name);
for($i=0; defined($name = $in{"name_$i"}); $i++) {
if ($name) {
if ($in{"type_$i"} == 9 || $in{"type_$i"} == 12 ||
$in{"type_$i"} == 13 || $in{"type_$i"} == 14) {
$in{"opts_$i"} =~ /\|$/ || -r $in{"opts_$i"} ||
&error(&text('save_eopts', $i+1));
}
$in{"opts_$i"} =~ /:/ && &error(&text('save_eopts2', $i+1));
push(@{$cmd->{'args'}}, { 'name' => $name,
'desc' => $in{"desc_$i"},
'type' => $in{"type_$i"},
'quote' => int($in{"quote_$i"}),
'must' => int($in{"must_$i"}),
'opts' => $in{"opts_$i"} });
}
}
}
# set_parameter_envs(&command, command-str, &uinfo, [set-in], [skip-menu-check])
# Sets $ENV variables based on parameter inputs, and returns the list of
# environment variable commands, the export commands, the command string,
# and the command string to display.
sub set_parameter_envs
{
local ($cmd, $str, $uinfo, $setin, $skipfound) = @_;
$setin ||= \%in;
local $displaystr = $str;
local ($env, $export, @vals);
foreach my $a (@{$cmd->{'args'}}) {
my $n = $a->{'name'};
my $rv;
if ($a->{'type'} == 0 || $a->{'type'} == 5 ||
$a->{'type'} == 6 || $a->{'type'} == 8) {
$rv = $setin->{$n};
}
elsif ($a->{'type'} == 11) {
$rv = $setin->{$n};
$rv =~ s/\r//g;
$rv =~ s/\n/ /g;
}
elsif ($a->{'type'} == 1 || $a->{'type'} == 2) {
(@u = getpwnam($setin->{$n})) || &error($text{'run_euser'});
$rv = $a->{'type'} == 1 ? $setin->{$n} : $u[2];
}
elsif ($a->{'type'} == 3 || $a->{'type'} == 4) {
(@g = getgrnam($setin->{$n})) || &error($text{'run_egroup'});
$rv = $a->{'type'} == 3 ? $setin->{$n} : $g[2];
}
elsif ($a->{'type'} == 7) {
$rv = $setin->{$n} ? $a->{'opts'} : "";
}
elsif ($a->{'type'} == 9) {
local $found;
foreach my $l (&read_opts_file($a->{'opts'})) {
$found++ if ($l->[0] eq $setin->{$n});
}
$found || $skipfound || &error($text{'run_eopt'});
$rv = $setin->{$n};
}
elsif ($a->{'type'} == 10) {
if ($setin->{$n}) {
if ($setin->{$n."_filename"} =~ /([^\/\\]+$)/ && $1) {
$rv = &transname("$1");
}
else {
$rv = &transname();
}
&open_tempfile(TEMP, ">$rv");
&print_tempfile(TEMP, $setin->{$n});
&close_tempfile(TEMP);
chown($uinfo->[2], $uinfo->[3], $rv);
push(@unlink, $rv);
}
else {
$a->{'must'} && &error($text{'run_eupload'});
$rv = undef;
}
}
elsif ($a->{'type'} == 12 || $a->{'type'} == 13 || $a->{'type'} == 14) {
local @vals;
if ($a->{'type'} == 14) {
@vals = split(/\r?\n/, $setin->{$n});
}
else {
@vals = split(/\0/, $setin->{$n});
}
local @opts = &read_opts_file($a->{'opts'});
foreach my $v (@vals) {
local $found;
foreach my $l (@opts) {
$found++ if ($l->[0] eq $v);
}
$found || $skipfound || &error($text{'run_eopt'});
}
$rv = join(" ", @vals);
}
elsif ($a->{'type'} == 15) {
$rv = $setin->{$n."_year"}."-".
$setin->{$n."_month"}."-".
$setin->{$n."_day"};
}
elsif ($a->{'type'} == 16) {
$rv = $setin->{$n} ? 1 : 0;
}
if ($rv eq '' && $a->{'must'} && $a->{'type'} != 7) {
&error(&text('run_emust', $a->{'desc'}));
}
$ENV{$n} = $rv;
$env .= "$n='$rv'\n";
$export .= " $n";
if ($a->{'quote'}) {
$str =~ s/\$$n/"\$$n"/g;
$displaystr =~ s/\$$n/"$rv"/g;
}
else {
$displaystr =~ s/\$$n/$rv/g;
}
push(@vals, $rv);
}
return ($env, $export, $str, $displaystr, \@vals);
}
# list_dbi_drivers()
# Returns a list of DBI driver details, which are actually installed
sub list_dbi_drivers
{
local @rv = ( { 'name' => 'MySQL',
'driver' => 'mysql',
'dbparam' => 'database' },
{ 'name' => 'PostgreSQL',
'driver' => 'Pg',
'dbparam' => 'dbname' },
);
@rv = grep { eval "use DBD::$_->{'driver'}"; !$@ } @rv;
return @rv;
}
# list_servers()
# Returns a list of servers that a command can run on
sub list_servers
{
if (&foreign_installed("servers")) {
&foreign_require("servers", "servers-lib.pl");
@servers = grep { $_->{'user'} } &servers::list_servers();
if (@servers) {
return ( { 'id' => 0, 'desc' => $text{'edit_this'} }, @servers);
}
}
return ( { 'id' => 0, 'desc' => $text{'edit_this'} } );
}
# execute_custom_command(&command, environment, exports, string, print-output)
# Runs some command, and returns the bytes, output and timeout flag
sub execute_custom_command
{
local ($cmd, $env, $export, $str, $print) = @_;
&foreign_require("proc", "proc-lib.pl");
&clean_environment() if ($cmd->{'clear'});
local $got;
local $outtemp = &transname();
open(OUTTEMP, ">$outtemp");
local $fh = $print ? STDOUT : *OUTTEMP;
if ($cmd->{'su'}) {
local $temp = &transname();
&open_tempfile(TEMP, ">$temp");
&print_tempfile(TEMP, "#!/bin/sh\n");
&print_tempfile(TEMP, $env);
&print_tempfile(TEMP, "export $export\n") if ($export);
&print_tempfile(TEMP, "$str\n");
&close_tempfile(TEMP);
chmod(0755, $temp);
$got = &proc::safe_process_exec(
&command_as_user($user, 1, $temp), 0, 0,
$fh, undef, !$cmd->{'raw'} && !$cmd->{'format'}, 0,
$cmd->{'timeout'});
unlink($temp);
}
else {
$got = &proc::safe_process_exec(
$str, $user_info[2], undef, $fh, undef,
!$cmd->{'raw'} && !$cmd->{'format'}, 0,
$cmd->{'timeout'});
}
local $ex = $?;
&reset_environment() if ($cmd->{'clear'});
close(OUTTEMP);
local $rv = &read_file_contents($outtemp);
unlink($outtemp);
return ($got, $rv, $proc::safe_process_exec_timeout ? 1 : 0, $ex);
}
# show_parameter_input(&arg, formno)
# Returns HTML for a parameter input
sub show_parameter_input
{
local ($a, $form) = @_;
local $n = $a->{'name'};
local $v = $a->{'opts'};
if ($a->{'type'} != 9 && $a->{'type'} != 12 &&
$a->{'type'} != 13 && $a->{'type'} != 14) {
if ($v =~ /^"(.*)"$/ || $v =~ /^'(.*)'$/) {
# Quoted default
$v = $1;
}
elsif ($v =~ /^(.*)\s*\|$/ && $config{'params_cmd'}) {
# Command to run
$v = &backquote_command("$1 2>/dev/null </dev/null");
if ($a->{'type'} != 11) {
$v =~ s/[\r\n]+$//;
}
}
elsif ($v =~ /^\// && $config{'params_file'}) {
# File to read
$v = &read_file_contents($v);
if ($a->{'type'} != 11) {
$v =~ s/[\r\n]+$//;
}
}
}
if ($a->{'type'} == 0) {
return &ui_textbox($n, $v, 30);
}
elsif ($a->{'type'} == 1 || $a->{'type'} == 2) {
return &ui_user_textbox($n, $v, $form);
}
elsif ($a->{'type'} == 3 || $a->{'type'} == 4) {
return &ui_group_textbox($n, $v, $form);
}
elsif ($a->{'type'} == 5 || $a->{'type'} == 6) {
return &ui_textbox($n, $v, 30)." ".
&file_chooser_button($n, $a->{'type'}-5, $form);
}
elsif ($a->{'type'} == 7) {
return &ui_yesno_radio($n, $v =~ /true|yes|1/ ? 1 : 0);
}
elsif ($a->{'type'} == 8) {
return &ui_password($n, $v, 30);
}
elsif ($a->{'type'} == 9) {
return &ui_select($n, undef, [ &read_opts_file($a->{'opts'}) ]);
}
elsif ($a->{'type'} == 10) {
return &ui_upload($n, 30);
}
elsif ($a->{'type'} == 11) {
return &ui_textarea($n, $v, 4, 30);
}
elsif ($a->{'type'} == 12) {
return &ui_select($n, undef, [ &read_opts_file($a->{'opts'}) ],
5, 1);
}
elsif ($a->{'type'} == 13) {
my @opts = &read_opts_file($a->{'opts'});
return &ui_select($n, undef, \@opts, scalar(@opts), 1);
}
elsif ($a->{'type'} == 14) {
my @opts = &read_opts_file($a->{'opts'});
return &ui_multi_select($n, [ ], \@opts, 5);
}
elsif ($a->{'type'} == 15) {
my ($year, $month, $day) = split(/\-/, $v);
return &ui_date_input($day, $month, $year,
$n."_day", $n."_month", $n."_year")."&nbsp;".
&date_chooser_button($n."_day", $n."_month", $n."_year");
}
elsif ($a->{'type'} == 16) {
return &ui_submit($v || $a->{'name'}, $a->{'name'});
}
else {
return "Unknown parameter type $a->{'type'}";
}
}
1;
+3
View File
@@ -0,0 +1,3 @@
noconfig=0
edit=1
cmds=*
+127
View File
@@ -0,0 +1,127 @@
#!/usr/local/bin/perl
# edit_cmd.cgi
# Display a custom command and its parameters
require './custom-lib.pl';
&ReadParse();
$access{'edit'} || &error($text{'edit_ecannot'});
if ($in{'new'}) {
&ui_print_header(undef, $text{'create_title'}, "", "create");
if ($in{'clone'}) {
$cmd = &get_command($in{'id'}, $in{'idx'});
}
}
else {
&ui_print_header(undef, $text{'edit_title'}, "", "edit");
$cmd = &get_command($in{'id'}, $in{'idx'});
}
# Form header
print &ui_form_start("save_cmd.cgi", "post");
print &ui_hidden("new", $in{'new'});
print &ui_hidden("id", $cmd->{'id'});
print &ui_table_start($text{'edit_details'}, "width=100%", 4);
# Command ID
if (!$in{'new'}) {
print &ui_table_row(&hlink($text{'edit_id'}, "id"),
"<tt>$cmd->{'id'}</tt>", 3);
}
# Description, text and HTML
print &ui_table_row(&hlink($text{'edit_desc'}, "desc"),
&ui_textbox("desc", $cmd->{'desc'}, 60), 3);
print &ui_table_row(&hlink($text{'edit_desc2'}, "desc2"),
&ui_textarea("html", $cmd->{'html'}, 2, 60), 3);
# Command to run
if ($cmd->{'cmd'} =~ s/^\s*cd\s+(\S+)\s*;\s*//) {
$dir = $1;
}
print &ui_table_row(&hlink($text{'edit_cmd'},"command"),
&ui_textarea("cmd", $cmd->{'cmd'}, 5, 60, "soft"), 3);
# Directory to run in
print &ui_table_row(&hlink($text{'edit_dir'},"dir"),
&ui_opt_textbox("dir", $dir, 40, $text{'default'})." ".
&file_chooser_button("dir", 1), 3);
# User to run as
if (&supports_users()) {
print &ui_table_row(&hlink($text{'edit_user'},"user"),
&ui_opt_textbox("user", $cmd->{'user'} eq '*' ? undef
: $cmd->{'user'}, 13, $text{'edit_user_def'})." ".
&user_chooser_button("user", 0)." ".
&ui_checkbox("su", 1, $text{'edit_su'}, $cmd->{'su'}), 3);
}
# Show raw output
print &ui_table_row(&hlink($text{'edit_raw'},"raw"),
&ui_yesno_radio("raw", $cmd->{'raw'} ? 1 : 0));
# Command ordering on main page
print &ui_table_row(&hlink($text{'edit_order'},"order"),
&ui_opt_textbox("order", $cmd->{'order'} || "", 6, $text{'default'}));
# Hide from main page?
print &ui_table_row(&hlink($text{'edit_noshow'},"noshow"),
&ui_yesno_radio("noshow", $cmd->{'noshow'}));
# Visible in Usermin?
print &ui_table_row(&hlink($text{'edit_usermin'},"usermin"),
&ui_yesno_radio("usermin", $cmd->{'usermin'}));
# Command timeout
print &ui_table_row(&hlink($text{'edit_timeout'},"timeout"),
&ui_opt_textbox("timeout", $cmd->{'timeout'} || undef, 6,
$text{'default'})." ".$text{'edit_secs'});
# Clear environment?
print &ui_table_row(&hlink($text{'edit_clear'},"clear"),
&ui_yesno_radio("clear", $cmd->{'clear'}));
# Output format
$fmode = $cmd->{'format'} eq 'redirect' ? 2 :
$cmd->{'format'} eq 'form' ? 3 :
$cmd->{'format'} ? 1 : 0;
print &ui_table_row(&hlink($text{'edit_format'}, "format"),
&ui_radio("format_def", $fmode,
[ [ 0, $text{'edit_format0'} ],
[ 2, $text{'edit_format2'} ],
[ 3, $text{'edit_format3'} ],
[ 1, $text{'edit_format1'}." ".
&ui_textbox("format",
$fmode == 1 ? $cmd->{'format'} : "", 20) ] ]), 3);
# Show Webmin servers to run on
@servers = &list_servers();
if (@servers > 1) {
@hosts = @{$cmd->{'hosts'}};
@hosts = ( 0 ) if (!@hosts);
print &ui_table_row(&hlink($text{'edit_servers'}, "servers"),
&ui_select("hosts", \@hosts,
[ map { [ $_->{'id'},
!$_->{'host'} ? $_->{'desc'} :
$_->{'host'}.
($_->{'desc'} ? ' ('.$_->{'desc'}.')' : '') ] }
sort { lc($a->{'host'}) cmp lc($b->{'host'}) } @servers],
5, 1), 3);
}
print &ui_table_end();
# Show parameters
&show_params_inputs($cmd);
if ($in{'new'}) {
print &ui_form_end([ [ undef, $text{'create'} ] ]);
}
else {
print &ui_form_end([ [ undef, $text{'save'} ],
[ 'clone', $text{'edit_clone'} ],
[ 'delete', $text{'delete'} ] ]);
}
&ui_print_footer("", $text{'index_return'});
+87
View File
@@ -0,0 +1,87 @@
#!/usr/local/bin/perl
# edit_file.cgi
# Display a file editor and its options
require './custom-lib.pl';
&ReadParse();
$access{'edit'} || &error($text{'file_ecannot'});
if ($in{'new'}) {
&ui_print_header(undef, $text{'fcreate_title'}, "", "fcreate");
if ($in{'clone'}) {
$edit = &get_command($in{'id'}, $in{'idx'});
}
}
else {
&ui_print_header(undef, $text{'fedit_title'}, "", "fedit");
$edit = &get_command($in{'id'}, $in{'idx'});
}
print &ui_form_start("save_file.cgi", "post");
print &ui_hidden("new", $in{'new'});
print &ui_hidden("id", $edit->{'id'});
print &ui_table_start($text{'file_details'}, "width=100%", 2);
if (!$in{'new'}) {
print &ui_table_row(&hlink($text{'file_id'}, "fileid"),
"<tt>$edit->{'id'}</tt>");
}
# Description, text and HTML
print &ui_table_row(&hlink($text{'edit_desc'}, "desc"),
&ui_textbox("desc", $edit->{'desc'}, 60));
print &ui_table_row(&hlink($text{'edit_desc2'}, "desc2"),
&ui_textarea("html", $edit->{'html'}, 2, 60));
# File to edit, and environment checkbox
print &ui_table_row(&hlink($text{'file_edit'}, "file"),
&ui_textbox("edit", $edit->{'edit'}, 60)." ".
&file_chooser_button("edit", 0)."<br>".
&ui_checkbox("envs", 1, $text{'file_envs'}, $edit->{'envs'}));
# File owner and group
print &ui_table_row(&hlink($text{'file_owner'}, "owner"),
&ui_radio("owner_def", $edit->{'user'} ? 0 : 1,
[ [ 1, $text{'file_leave'} ],
[ 0, $text{'file_user'}." ".
&ui_textbox("user", $edit->{'user'}, 13)." ".
$text{'file_group'}." ".
&ui_textbox("group", $edit->{'group'}, 13) ] ]));
# File permissions
print &ui_table_row(&hlink($text{'file_perms'}, "perms"),
&ui_opt_textbox("perms", $edit->{'perms'}, 3, $text{'file_leave'},
$text{'file_set'}));
# Commands to run before and after
print &ui_table_row(&hlink($text{'file_beforeedit'}, "beforeedit"),
&ui_textbox("beforeedit", $edit->{'beforeedit'}, 60));
print &ui_table_row(&hlink($text{'file_before'}, "before"),
&ui_textbox("before", $edit->{'before'}, 60));
print &ui_table_row(&hlink($text{'file_after'}, "after"),
&ui_textbox("after", $edit->{'after'}, 60));
# Command ordering on main page
print &ui_table_row(&hlink($text{'edit_order'},"order"),
&ui_opt_textbox("order", $edit->{'order'} || "", 6, $text{'default'}));
# Visible in Usermin?
print &ui_table_row(&hlink($text{'edit_usermin'},"usermin"),
&ui_yesno_radio("usermin", $edit->{'usermin'}));
print &ui_table_end();
# Show parameters
&show_params_inputs($edit, 1, 1);
if ($in{'new'}) {
print &ui_form_end([ [ undef, $text{'create'} ] ]);
}
else {
print &ui_form_end([ [ undef, $text{'save'} ],
[ 'clone', $text{'edit_clone'} ],
[ 'delete', $text{'delete'} ] ]);
}
&ui_print_footer("", $text{'index_return'});
+91
View File
@@ -0,0 +1,91 @@
#!/usr/local/bin/perl
# Display an SQL command
require './custom-lib.pl';
&ReadParse();
# Work out which DBI drivers we have
@drivers = &list_dbi_drivers();
if (!@drivers) {
# None! Offer to install
&ui_print_header(undef, $text{'sql_title1'}, "");
eval "use DBI";
if ($@) {
@need = ( "DBI" );
}
$myneed = &urlize(join(" ", @need, "DBD::mysql"));
$pgneed = &urlize(join(" ", @need, "DBD::Pg"));
print &text('sql_edrivers',
"../cpan/download.cgi?source=3&cpan=$myneed&return=/$module_name/&returndesc=".&urlize($text{'index_return'}),
"../cpan/download.cgi?source=3&cpan=$pgneed&return=/$module_name/&returndesc=".&urlize($text{'index_return'})),"<p>\n";
}
$access{'edit'} || &error($text{'edit_ecannot'});
if ($in{'new'}) {
&ui_print_header(undef, $text{'sql_title1'}, "");
if ($in{'clone'}) {
$cmd = &get_command($in{'id'}, $in{'idx'});
}
}
else {
&ui_print_header(undef, $text{'sql_title2'}, "");
$cmd = &get_command($in{'id'}, $in{'idx'});
}
print &ui_form_start("save_sql.cgi", "post");
print &ui_hidden("new", $in{'new'}),"\n";
print &ui_hidden("id", $cmd->{'id'}),"\n";
print &ui_table_start($text{'sql_header'}, "width=100%", 2);
# Show command info
if (!$in{'new'}) {
print &ui_table_row($text{'edit_id'}, "<tt>$cmd->{'id'}</tt>");
}
print &ui_table_row($text{'edit_desc'},
&ui_textbox("desc", $cmd->{'desc'}, 50));
print &ui_table_row($text{'edit_desc2'},
&ui_textarea("html", $cmd->{'html'}, 2, 50));
# Show databse type and name
print &ui_table_row($text{'sql_type'},
&ui_select("type", $cmd->{'type'},
[ map { [ $_->{'driver'}, $_->{'name'} ] } @drivers ]));
print &ui_table_row($text{'sql_db'},
&ui_textbox("db", $cmd->{'db'}, 20));
# Show command to run
print &ui_table_row($text{'sql_cmd'},
&ui_textarea("sql", $cmd->{'sql'}, 10, 70));
# Show login and password
print &ui_table_row($text{'sql_user'},
&ui_textbox("dbuser", $cmd->{'user'}, 20));
print &ui_table_row($text{'sql_pass'},
&ui_password("dbpass", $cmd->{'pass'}, 20));
# Show host to connect to
print &ui_table_row($text{'sql_host'},
&ui_opt_textbox("host", $cmd->{'host'}, 20,
$text{'sql_local'}));
# Command ordering on main page
print &ui_table_row(&hlink($text{'edit_order'},"order"),
&ui_opt_textbox("order", $cmd->{'order'} || "", 6, $text{'default'}));
print &ui_table_end(),"<p>\n";
# Show section for parameters
&show_params_inputs($cmd);
# End of form
if ($in{'new'}) {
print &ui_form_end([ [ "create", $text{'create'} ] ]);
}
else {
print &ui_form_end([ [ "save", $text{'save'} ],
[ 'clone', $text{'edit_clone'} ],
[ "delete", $text{'delete'} ] ]);
}
&ui_print_footer("", $text{'index_return'});
+14
View File
@@ -0,0 +1,14 @@
do 'custom-lib.pl';
sub feedback_files
{
opendir(DIR, $module_config_directory);
local @rv = map { "$module_config_directory/$_" }
grep { /\.(cmd|edit)$/ } readdir(DIR);
closedir(DIR);
return @rv;
}
1;
+47
View File
@@ -0,0 +1,47 @@
#!/usr/local/bin/perl
# form.cgi
# Display the form for one custom command on a page
require './custom-lib.pl';
&ReadParse();
$cmd = &get_command($in{'id'}, $in{'idx'});
&can_run_command($cmd) || &error($text{'form_ecannot'});
# Display form for command parameters
&ui_print_header(undef, $text{'form_title'}, "");
@a = @{$cmd->{'args'}};
@up = grep { $_->{'type'} == 10 } @a;
if ($cmd->{'edit'}) {
print &ui_form_start("view.cgi");
}
elsif (@up) {
# Has upload fields
@ufn = map { $_->{'name'} } @up;
$upid = time().$$;
print &ui_form_start("run.cgi?id=$upid",
"form-data", undef,
&read_parse_mime_javascript($upid, \@ufn));
}
elsif (@a) {
print &ui_form_start("run.cgi", "post");
}
else {
print &ui_form_start("run.cgi");
}
print &ui_hidden("id", $cmd->{'id'});
print &ui_table_start($cmd->{'html'} || $cmd->{'desc'}, "width=100%", 4,
[ "width=20%", "width=30%", "width=20%", "width=30%" ]);
foreach $a (@{$cmd->{'args'}}) {
print &ui_table_row(&html_escape($a->{'desc'}),
&show_parameter_input($a, 0), 2,
[ "valign=top", "valign=top" ]);
$got_submit++ if ($a->{'type'} == 16);
}
$txt = $cmd->{'edit'} ? $text{'form_edit'} : $text{'form_exec'};
print &ui_table_end();
print &ui_form_end($got_submit ? [ ] : [ [ undef, $txt ] ]);
&ui_print_footer("", $text{'index_return'});
+1
View File
@@ -0,0 +1 @@
<header> الأمر للتشغيل بعد الحفظ </header> سيتم تشغيل أي أمر يتم إدخاله هنا <tt>كجذر</tt> بعد حفظ الملف. قد يكون هذا مفيدًا لنسخ الملف إلى خادم آخر على سبيل المثال. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда да работи след запазване </header> Каквото и команда да бъде въведена тук, ще се стартира като <tt>root</tt> след като файлът бъде запазен. Това може да бъде полезно за копирането на файла например на друг сървър. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Ordre a executar després de desar</header>
L'ordre introduïda aquí s'executarà com a <tt>root</tt> després de
desar el fitxer. Això pot ser útil, per exemple, per copiar el fitxer
a un altre servidor.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Příkaz ke spuštění po uložení </header> Jakýkoli příkaz zadaný zde bude spuštěn jako <tt>root</tt> po uložení souboru. To by mohlo být užitečné například pro kopírování souboru na jiný server. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando til at køre efter gemning </header> Uanset hvilken kommando, der indtastes her, vil blive kørt som <tt>root,</tt> når filen er gemt. Dette kan f.eks. Være nyttigt til at kopiere filen til en anden server. <hr>
+1
View File
@@ -0,0 +1 @@
<header>Befehl nach dem Speichern ausführen</header>Der hier eingegebene Befehl wird nach dem Speichern der Datei als <tt>root</tt> ausgeführt. Dies kann beispielsweise nützlich sein, um die Datei auf einen anderen Server zu kopieren.<hr>
+1
View File
@@ -0,0 +1 @@
<header> Εντολή για εκτέλεση μετά την αποθήκευση </header> Όποια εντολή εισαχθεί εδώ θα εκτελεστεί ως <tt>root</tt> μετά την αποθήκευση του αρχείου. Αυτό θα μπορούσε να είναι χρήσιμο για την αντιγραφή του αρχείου σε άλλον διακομιστή, για παράδειγμα. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Comando que ejecutar después de guardar</header>
Cualquier comando que se introduzca aquí se ejecutará como <tt>root</tt>
después de guardar el fichero. Esto podría ser útil para copiar el fichero
a otro servidor, por ejemplo.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Gorde ondoren exekutatzeko agindua </header> Hemen agertzen den edozein komando fitxategia gorde ondoren <tt>root</tt> gisa exekutatuko da. Adibidez, fitxategia beste zerbitzari batean kopiatzeko erabilgarria izan daiteke. <hr>
+1
View File
@@ -0,0 +1 @@
<header> دستور اجرا پس از صرفه جویی </header> هرچه در اینجا وارد شود ، پس از ذخیره پرونده ، به عنوان <tt>root</tt> اجرا می شود. به عنوان مثال می تواند برای کپی کردن پرونده در سرور دیگر مفید باشد. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Komento suorittaa tallentamisen jälkeen </header> Mikä tahansa komento tähän kirjoitetaan, ajetaan <tt>pääkäyttäjänä</tt> tiedoston tallentamisen jälkeen. Tästä voi olla hyötyä kopioitaessa tiedostoa esimerkiksi toiselle palvelimelle. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Commande à exécuter après l&#39;enregistrement </header> Quelle que soit la commande entrée ici, elle sera exécutée en tant que <tt>root</tt> après l&#39;enregistrement du fichier. Cela peut être utile pour copier le fichier sur un autre serveur par exemple. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Naredba za pokretanje nakon spremanja </header> Što god naredba ovdje unesena, bit će pokrenuta kao <tt>root</tt> nakon što je datoteka spremljena. Na primjer, ovo bi moglo biti korisno za kopiranje datoteke na drugi poslužitelj. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Command to run after saving</header>
Whatever command is entered here will be run as <tt>root</tt> after
the file is saved. This could be useful for copying the file to another
server for example.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Futtatás parancs mentés után </header> Bármelyik parancs, amely itt be van írva, a fájl mentése után <tt>gyökérként</tt> lesz futtatva. Ez hasznos lehet például a fájl másolásához egy másik szerverre. <hr>
+4
View File
@@ -0,0 +1,4 @@
<header>Comando da eseguire dopo il salvataggio</header>
Qualunque comando inserito qui sarà eseguito con i privilegio di <tt>root</tt> dopo il salvataggio del file. Questo può essere utile, ad esempio, per copiare il file su un altro server.
<hr>
+1
View File
@@ -0,0 +1 @@
<header>保存後に実行するコマンド</header>ここに入力したコマンドはすべて、ファイルの保存後に<tt>root</tt>として実行されます。これは、ファイルを別のサーバーにコピーする場合などに役立ちます。 <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>저장 후에 실행할 명령</header>
파일이 저장된 후에 <tt>root</tt> 권한으로 실행되어야 할 명령을 입력
합니다. 예를 들어 다른 서버에 파일을 복사하는 경우와 같이 유용하게
사용할 수 있습니다.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Perintah untuk dijalankan setelah menyimpan </header> Apa sahaja arahan yang dimasukkan di sini akan dijalankan sebagai <tt>root</tt> setelah fail disimpan. Ini mungkin berguna untuk menyalin fail ke pelayan lain misalnya. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Opdracht uitvoeren ná opslaan</header>
Elke hier opgegeven opdracht zal worden uitgevoerd als <tt>root</tt>
nadat het bestand is opgeslagen. Dit kan nuttig zijn bijvoorbeeld voor het
maken van een kopie naar een andere server.
<hr>
+6
View File
@@ -0,0 +1,6 @@
<header>Kommando som skal kjøres etetr lagring</header>
Den kommandoen som angis her vil bli kjørt som <tt>root</tt> etter at
filen er lagret. Dette kan f.eks. brukes til å kopiere filen til en annen
tjener.
<hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Polecenie uruchamiane po zachowaniu</header>
Dowolne podane tu polecenie zostanie uruchomione jako <tt>root</tt> po
zachowaniu pliku. Może to zostać wykorzystane na przykład do kopiowania
pliku na inny serwer.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Comando para executar após salvar </header> Qualquer comando digitado aqui será executado como <tt>root</tt> depois que o arquivo for salvo. Isso pode ser útil para copiar o arquivo para outro servidor, por exemplo. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Comando para executar após salvar </header> Qualquer comando digitado aqui será executado como <tt>root</tt> depois que o arquivo for salvo. Isso pode ser útil para copiar o arquivo para outro servidor, por exemplo. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда для запуска после сохранения </header> Какая бы команда здесь ни была введена, она будет запущена от имени <tt>root</tt> после сохранения файла. Это может быть полезно, например, для копирования файла на другой сервер. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Príkaz na spustenie po uložení </header> Akýkoľvek príkaz zadaný tu sa po uložení súboru spustí ako <tt>root</tt> . Môže to byť užitočné napríklad pri kopírovaní súboru na iný server. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando att köras efter att du har sparat </header> Oavsett kommando som anges här kommer att köras som <tt>root</tt> efter att filen har sparats. Detta kan till exempel vara användbart för att kopiera filen till en annan server. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kaydettikten sonra çalıştırma komutu </header> Buraya girilen komut ne olursa olsun, dosya kaydedildikten sonra <tt>root</tt> olarak çalıştırılır. Bu, örneğin dosyayı başka bir sunucuya kopyalamak için yararlı olabilir. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда для запуску після збереження </header> Яка б команда тут не була введена, після запуску файлу буде запущено як <tt>root</tt> . Це може бути корисно, наприклад, для копіювання файлу на інший сервер. <hr>
+1
View File
@@ -0,0 +1 @@
<header>保存后运行的命令</header>保存文件后,此处输入的任何命令都将以<tt>root</tt>身份运行。例如,这对于将文件复制到另一台服务器可能很有用。 <hr>
+1
View File
@@ -0,0 +1 @@
<header>保存後運行的命令</header>保存文件後,此處輸入的任何命令都將以<tt>root</tt>身份運行。例如,這對於將文件複製到另一台服務器可能很有用。 <hr>
+1
View File
@@ -0,0 +1 @@
<header> الأمر للتشغيل قبل الحفظ </header> سيتم تشغيل أي أمر يتم إدخاله هنا <tt>كجذر</tt> قبل حفظ الملف. قد يكون هذا مفيدًا لعمل نسخة احتياطية من الملف على سبيل المثال. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда да се стартира преди запазване </header> Каквото и команда да бъде въведена тук, ще се стартира като <tt>root</tt> преди файла да бъде запазен. Това може да бъде полезно например за създаване на резервно копие на файла. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Ordre a executar abans de desar</header>
L'ordre introduïda aquí s'executarà com a <tt>root</tt> abans de
desar el fitxer. Això pot ser útil, per exemple, per fer una còpia
de seguretat del fitxer.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Příkaz ke spuštění před uložením </header> Jakýkoli příkaz zadaný zde bude spuštěn jako <tt>root</tt> před uložením souboru. To by mohlo být užitečné například pro vytvoření zálohy souboru. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando til at køre, før du gemmer </header> Uanset hvilken kommando, der indtastes her, vil blive kørt som <tt>root,</tt> før filen gemmes. Dette kan være nyttigt til f.eks. At tage en sikkerhedskopi af filen. <hr>
+1
View File
@@ -0,0 +1 @@
<header>Befehl vor dem Speichern ausführen</header>Der hier eingegebene Befehl wird vor dem Speichern der Datei als <tt>root</tt> ausgeführt. Dies kann beispielsweise nützlich sein, um eine Sicherungskopie der Datei zu erstellen.<hr>
+1
View File
@@ -0,0 +1 @@
<header> Εντολή για εκτέλεση πριν από την αποθήκευση </header> Όποια εντολή εισαχθεί εδώ θα εκτελεστεί ως <tt>root</tt> πριν αποθηκευτεί το αρχείο. Αυτό θα μπορούσε να είναι χρήσιμο για την δημιουργία αντιγράφου ασφαλείας του αρχείου, για παράδειγμα. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Comando que ejecutar antes de guardar</header>
Cualquier comando que introduzca aquí se ejecutará como <tt>root</tt> antes
de guardar el fichero. Esto podría ser útil para hacer una copia de
seguridad del fichero, por ejemplo.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Gorde aurretik exekutatzeko agindua </header> Hemen agertzen den edozein komando <tt>erro</tt> gisa gordeko da fitxategia gorde aurretik. Adibidez, fitxategiaren segurtasun kopia bat egiteko erabilgarria izan daiteke. <hr>
+1
View File
@@ -0,0 +1 @@
<header> دستور اجرا قبل از صرفه جویی </header> هرچه در اینجا وارد شود ، قبل از ذخیره فایل ، به عنوان <tt>root</tt> اجرا می شود. به عنوان مثال ، این می تواند برای تهیه نسخه پشتیبان از فایل مفید باشد. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Komento suorittaa ennen tallentamista </header> Mikä tahansa komento tähän kirjoitetaan, ajetaan <tt>pääkäyttäjänä</tt> ennen tiedoston tallentamista. Tämä voi olla hyödyllinen esimerkiksi varmuuskopion tekemiselle tiedostosta. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Commande à exécuter avant l&#39;enregistrement </header> Quelle que soit la commande entrée ici, elle sera exécutée en tant que <tt>root</tt> avant l&#39;enregistrement du fichier. Cela pourrait être utile pour faire une sauvegarde du fichier par exemple. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Naredba za pokretanje prije spremanja </header> Što god naredba ovdje unesena, pokrenut će se kao <tt>root</tt> prije nego što je datoteka spremljena. Ovo bi moglo biti korisno za primjerice izradu sigurnosne kopije datoteke. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Command to run before saving</header>
Whatever command is entered here will be run as <tt>root</tt> before
the file is saved. This could be useful for making a backup of the
file for example.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Futtatás parancs mentés előtt </header> Bármelyik parancs, amely itt be van írva, a fájl mentése előtt <tt>gyökérként</tt> fut. Ez hasznos lehet például a fájl biztonsági másolatának készítéséhez. <hr>
+4
View File
@@ -0,0 +1,4 @@
<header>Comando da eseguire prima del salvataggio</header>
Qualunque comando inserito qui sarà eseguito con i privilegi di <tt>root</tt> prima del salvataggio del file. Questo può essere utile, ad esempio, per fare copie di backup del file.
<hr>
+1
View File
@@ -0,0 +1 @@
<header>保存する前に実行するコマンド</header>ここに入力されたコマンドはすべて、ファイルが保存される前に<tt>root</tt>として実行されます。これは、たとえばファイルのバックアップを作成する場合に役立ちます。 <hr>
+6
View File
@@ -0,0 +1,6 @@
<header>저장 전 실행할 명령</header>
파일을 저장되기 전에 <tt>root</tt> 권한으로 실행 되어져야 하는 명령을
여기에 입력합니다. 예를 들어 파일의 백업을 만들어야 할 경우 유용하게
사용할 수 있습니다.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Perintah untuk dijalankan sebelum menyimpan </header> Apa sahaja arahan yang dimasukkan di sini akan dijalankan sebagai <tt>root</tt> sebelum fail disimpan. Ini mungkin berguna untuk membuat sandaran fail misalnya. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Opdracht uitvoeren vóór opslaan</header>
Elke hier opgegeven opdracht zal worden uitgevoerd als <tt>root</tt>
voordat het bestand is opgeslagen. Dit kan nuttig zijn bijvoorbeeld voor het
maken beveiligingskopie van het bestand.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando å kjøre før du lagrer </header> Uansett hvilken kommando som legges inn her vil bli kjørt som <tt>root</tt> før filen er lagret. Dette kan være nyttig for å lage en sikkerhetskopi av filen for eksempel. <hr>
+7
View File
@@ -0,0 +1,7 @@
<header>Polecenie uruchamiane przed zachowaniem</header>
Dowolne podane tu polecenie zostanie uruchomione jako <tt>root</tt> zanim
plik zostanie zachowany. Może to być przydatne na przykład do stworzenia
kopii zapasowej pliku.
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Comando para executar antes de salvar </header> Qualquer comando digitado aqui será executado como <tt>root</tt> antes que o arquivo seja salvo. Isso pode ser útil para fazer um backup do arquivo, por exemplo. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Comando para executar antes de salvar </header> Qualquer comando digitado aqui será executado como <tt>root</tt> antes que o arquivo seja salvo. Isso pode ser útil para fazer um backup do arquivo, por exemplo. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда для запуска перед сохранением </header> Какая бы команда здесь ни была введена, она будет запущена от имени пользователя <tt>root</tt> перед сохранением файла. Это может быть полезно для создания резервной копии файла, например. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Príkaz na spustenie pred uložením </header> Čokoľvek zadáte tento príkaz, pred uložením súboru sa spustí ako <tt>root</tt> . Môže to byť užitočné napríklad pri vytváraní zálohy súboru. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando att köras innan du sparar </header> Vilket kommando som anges här kommer att köras som <tt>root</tt> innan filen sparas. Detta kan till exempel vara användbart för att göra en säkerhetskopia av filen. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Kaydetmeden önce çalıştırma komutu </header> Buraya girilen komut ne olursa olsun, dosya kaydedilmeden önce <tt>root</tt> olarak çalıştırılacaktır. Bu, örneğin dosyanın yedeğini almak için yararlı olabilir. <hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда для запуску перед збереженням </header> Яка б команда тут не була введена, вона буде запущена як <tt>root</tt> перед збереженням файлу. Це може бути корисно, наприклад, для створення резервної копії файлу. <hr>
+1
View File
@@ -0,0 +1 @@
<header>保存前运行命令</header>保存文件之前,在此处输入的任何命令都将以<tt>root</tt>身份运行。例如,这对于备份文件很有用。 <hr>
+1
View File
@@ -0,0 +1 @@
<header>保存前運行命令</header>保存文件之前,在此輸入的任何命令都將以<tt>root</tt>身份運行。例如,這對於備份文件很有用。 <hr>
+1
View File
@@ -0,0 +1 @@
<header> الأمر للتشغيل قبل التحرير </header> سيتم تشغيل أي أمر يتم إدخاله هنا <tt>كجذر</tt> قبل عرض محتويات الملف للتحرير. يمكن استخدام هذا على سبيل المثال لنسخ الملف من نظام آخر ، ويمكن استخدام <b>الأمر الذي سيتم تشغيله بعد الحفظ</b> لنسخه مرة أخرى. <p style=";text-align:right;direction:rtl"><hr>
+1
View File
@@ -0,0 +1 @@
<header> Команда да се стартира преди редактиране </header> Каквото и команда да бъде въведена тук, ще се стартира като <tt>root</tt> преди съдържанието на файла да се покаже за редактиране. Това може да се използва например за копиране на файла от друга система, а <b>командата, която да се стартира след запис,</b> може да се използва за копирането му обратно. <p><hr>
+9
View File
@@ -0,0 +1,9 @@
<header>Ordre a executar abans d'editar</header>
L'ordre que s'introdueixi aquí s'executarà com a <tt>root</tt> abans de
mostrar el contingut del fitxer per editar-lo. Això es pot utilitzar, per
exemple, per copiar el fitxer des d'un altre sistema, i l'<b>Ordre a
executar després de desar</b> per recopiar-lo. <p>
<hr>
+1
View File
@@ -0,0 +1 @@
<header> Příkaz ke spuštění před úpravami </header> Jakýkoli příkaz zde zadaný bude spuštěn jako <tt>root</tt> před zobrazením obsahu souboru pro úpravy. To by mohlo být použito například pro zkopírování souboru z jiného systému a <b>příkaz ke spuštění po uložení</b> by mohl být použit pro jeho zkopírování zpět. <p><hr>
+1
View File
@@ -0,0 +1 @@
<header> Kommando, der skal køres før redigering </header> Uanset hvilken kommando, der indtastes her, vil blive kørt som <tt>root,</tt> før filens indhold vises til redigering. Dette kan f.eks. Bruges til at kopiere filen fra et andet system, og <b>kommandoen, der skal køres efter gemning,</b> kunne bruges til at kopiere den tilbage. <p><hr>
+1
View File
@@ -0,0 +1 @@
<header>Befehl vor dem Bearbeiten ausführen</header>Der hier eingegebene Befehl wird vor der Anzeige der Datei zur Bearbeitung als <tt>root</tt> ausgeführt. Dies kann beispielsweise genutzt werden, um die Datei von einem anderen System zu kopieren. Der <b>Befehl nach dem Speichern ausführen</b> kann dann verwendet werden, um die Datei zurückzukopieren.<p><hr>
+1
View File
@@ -0,0 +1 @@
<header> Εντολή για εκτέλεση πριν από την επεξεργασία </header> Όποια εντολή εισαχθεί εδώ θα εκτελεστεί ως <tt>root</tt> πριν εμφανιστούν τα περιεχόμενα του αρχείου για επεξεργασία. Αυτό θα μπορούσε να χρησιμοποιηθεί για παράδειγμα για την αντιγραφή του αρχείου από άλλο σύστημα και η <b>εντολή για εκτέλεση μετά την αποθήκευση</b> θα μπορούσε να χρησιμοποιηθεί για την αντιγραφή του. <p><hr>
+1
View File
@@ -0,0 +1 @@
<header> Comando para ejecutar antes de editar </header> Cualquier comando que se ingrese aquí se ejecutará como <tt>root</tt> antes de que el contenido del archivo se muestre para su edición. Esto podría usarse, por ejemplo, para copiar el archivo desde otro sistema, y el <b>Comando para ejecutar después de guardar</b> podría usarse para copiarlo nuevamente. <p><hr>

Some files were not shown because too many files have changed in this diff Show More