00001 <?php
00002
00003 lt_include( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
00004 lt_include( PLOG_CLASS_PATH."class/view/templateview.class.php" );
00005 lt_include( PLOG_CLASS_PATH."class/data/validator/templatenamevalidator.class.php" );
00006 lt_include( PLOG_CLASS_PATH."class/view/errorview.class.php" );
00007
00030 class TemplateAction extends BlogAction
00031 {
00032
00039 function TemplateAction( $actionInfo, $request )
00040 {
00041 $this->BlogAction( $actionInfo, $request );
00042
00043 $this->registerFieldValidator( "show", new TemplateNameValidator());
00044
00045 $view = new ErrorView( $this->_blogInfo );
00046 $view->setErrorMessage( "Bad characters in the template name." );
00047 $this->setValidationErrorView( $view );
00048 }
00049
00058 function perform()
00059 {
00060
00061 $templateFile = $this->_request->getValue( "show" );
00062
00063 if( !$templateFile || strstr( $templateFile, ".." )) {
00064 lt_include( PLOG_CLASS_PATH."class/view/errorview.class.php" );
00065
00066 $view = new ErrorView( $this->_blogInfo, "error_parameter_missing" );
00067 $this->setValidationErrorView( $view );
00068
00069 $this->_view = new ErrorView( $this->_blogInfo );
00070 $this->_view->setValue( "message", "error_incorrect_parameter" );
00071 $this->setCommonData();
00072
00073 return false;
00074 }
00075
00076 $this->_view = new TemplateView( $this->_blogInfo, $templateFile);
00077
00078
00079
00080 $this->_view->setValue( "request", $this->_request );
00081
00082 $this->setCommonData();
00083
00084 return true;
00085 }
00086 }
00087 ?>