POD for 3 macros, and internationalized error messages for two macros.
This commit is contained in:
parent
eb98d68777
commit
f007395c50
5 changed files with 61 additions and 3 deletions
|
|
@ -12,11 +12,30 @@ package WebGUI::Macro::Execute;
|
|||
|
||||
use strict;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Execute
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Allows a content manager or administrator to execute an external program.
|
||||
|
||||
=head2 process ( system_call )
|
||||
|
||||
=head3 system_call
|
||||
|
||||
The system call to execute. STDOUT from the call will be captured and
|
||||
returned. Calls containing the words passwd, shadow or .conf will
|
||||
be blocked and an error message returned instead.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my @param = @_;
|
||||
if ($param[0] =~ /passwd/ || $param[0] =~ /shadow/ || $param[0] =~ /\.conf/) {
|
||||
return "SECURITY VIOLATION";
|
||||
return WebGUI::International::get('execute error', 'Macro_Execute');
|
||||
} else {
|
||||
return `$param[0]`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,20 @@ package WebGUI::Macro::Extras;
|
|||
use strict;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::Extras
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for returning the extrasURL set up in the site's WebGUI.conf
|
||||
file.
|
||||
=head2 process
|
||||
|
||||
Returns the extrasURL. A trailing slash '/' is appended to the URL.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
return $session{config}{extrasURL}."/";
|
||||
|
|
|
|||
|
|
@ -14,6 +14,26 @@ use strict;
|
|||
use WebGUI::Session;
|
||||
use LWP::MediaTypes qw(guess_media_type);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Macro::FetchMimeType
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Macro for determining the MIME type for a file.
|
||||
|
||||
=head2 process ( filepath )
|
||||
|
||||
Returns the MIME type for a file, as determined by
|
||||
LWP::MediaTypes::guess_media_type.
|
||||
|
||||
=head3 filepath
|
||||
|
||||
A path to a file
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub process {
|
||||
my $path = shift;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue