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;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ our $I18N = {
|
|||
message => q|
|
||||
|
||||
<b>^EditableToggle; or ^EditableToggle();</b><br>
|
||||
Exactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current page. This macro takes up to three parameters. The first is a label for "Turn Admin On", the second is a label for "Turn Admin Off", and the third is the name of a template in the Macro/EditableToggle namespace to replace the default template.
|
||||
Exactly the same as AdminToggle, except that the toggle is only displayed if the user has the rights to edit the current Asset. This macro takes up to three parameters. The first is a label for "Turn Admin On", the second is a label for "Turn Admin Off", and the third is the name of a template in the Macro/EditableToggle namespace to replace the default template.
|
||||
<p>
|
||||
The following variables are available in the template:
|
||||
<p/>
|
||||
|
|
@ -28,7 +28,7 @@ The Internationalized label for turning on or off Admin (depending on the state
|
|||
<p/>
|
||||
|
||||
|,
|
||||
lastUpdated => 1112466919,
|
||||
lastUpdated => 1134799755,
|
||||
},
|
||||
|
||||
'516' => {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ our $I18N = {
|
|||
lastUpdated => 1128838230,
|
||||
},
|
||||
|
||||
'execute error' => {
|
||||
message => q|SECURITY VIOLATION|,
|
||||
lastUpdated => 1134850023,
|
||||
},
|
||||
|
||||
'execute title' => {
|
||||
message => q|Execute Macro|,
|
||||
lastUpdated => 1112466408,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue