From f007395c509c3e66d39f53eb6e84b631cb2aa490 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 17 Dec 2005 20:07:08 +0000 Subject: [PATCH] POD for 3 macros, and internationalized error messages for two macros. --- lib/WebGUI/Macro/Execute.pm | 21 ++++++++++++++++++- lib/WebGUI/Macro/Extras.pm | 14 +++++++++++++ lib/WebGUI/Macro/FetchMimeType.pm | 20 ++++++++++++++++++ .../i18n/English/Macro_EditableToggle.pm | 4 ++-- lib/WebGUI/i18n/English/Macro_Execute.pm | 5 +++++ 5 files changed, 61 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/Macro/Execute.pm b/lib/WebGUI/Macro/Execute.pm index 5e8716261..19557d6e1 100644 --- a/lib/WebGUI/Macro/Execute.pm +++ b/lib/WebGUI/Macro/Execute.pm @@ -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]`; } diff --git a/lib/WebGUI/Macro/Extras.pm b/lib/WebGUI/Macro/Extras.pm index a46edd043..6960e8220 100644 --- a/lib/WebGUI/Macro/Extras.pm +++ b/lib/WebGUI/Macro/Extras.pm @@ -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}."/"; diff --git a/lib/WebGUI/Macro/FetchMimeType.pm b/lib/WebGUI/Macro/FetchMimeType.pm index 590b0c7ec..0d26d6e32 100644 --- a/lib/WebGUI/Macro/FetchMimeType.pm +++ b/lib/WebGUI/Macro/FetchMimeType.pm @@ -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; diff --git a/lib/WebGUI/i18n/English/Macro_EditableToggle.pm b/lib/WebGUI/i18n/English/Macro_EditableToggle.pm index dc525496c..baf5d085f 100644 --- a/lib/WebGUI/i18n/English/Macro_EditableToggle.pm +++ b/lib/WebGUI/i18n/English/Macro_EditableToggle.pm @@ -16,7 +16,7 @@ our $I18N = { message => q| ^EditableToggle; or ^EditableToggle();
-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.

The following variables are available in the template:

@@ -28,7 +28,7 @@ The Internationalized label for turning on or off Admin (depending on the state

|, - lastUpdated => 1112466919, + lastUpdated => 1134799755, }, '516' => { diff --git a/lib/WebGUI/i18n/English/Macro_Execute.pm b/lib/WebGUI/i18n/English/Macro_Execute.pm index 67add315e..96803199c 100644 --- a/lib/WebGUI/i18n/English/Macro_Execute.pm +++ b/lib/WebGUI/i18n/English/Macro_Execute.pm @@ -7,6 +7,11 @@ our $I18N = { lastUpdated => 1128838230, }, + 'execute error' => { + message => q|SECURITY VIOLATION|, + lastUpdated => 1134850023, + }, + 'execute title' => { message => q|Execute Macro|, lastUpdated => 1112466408,