From 657061e16a18239cf50b0b4ac6d3d505f1c36826 Mon Sep 17 00:00:00 2001 From: ovclas Date: Thu, 16 Jun 2011 01:48:33 +0000 Subject: [PATCH] issue 46 apply server side validator in comment module git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8494 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/comment/comment.admin.controller.php | 13 ++++++++++--- modules/comment/conf/module.xml | 4 ++-- modules/comment/ruleset/deleteChecked.xml | 8 ++++++++ .../comment/ruleset/insertCommentModuleConfig.xml | 8 ++++++++ modules/comment/tpl/comment_list.html | 8 +++++--- modules/comment/tpl/comment_module_config.html | 6 +++--- modules/comment/tpl/declared_list.html | 6 ++++-- 7 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 modules/comment/ruleset/deleteChecked.xml create mode 100644 modules/comment/ruleset/insertCommentModuleConfig.xml diff --git a/modules/comment/comment.admin.controller.php b/modules/comment/comment.admin.controller.php index 22f710673..36df34c28 100644 --- a/modules/comment/comment.admin.controller.php +++ b/modules/comment/comment.admin.controller.php @@ -22,7 +22,8 @@ // Error display if none is selected $cart = Context::get('cart'); if(!$cart) return $this->stop('msg_cart_is_null'); - $comment_srl_list= explode('|@|', $cart); + if(!is_array($cart)) $comment_srl_list= explode('|@|', $cart); + else $comment_srl_list = $cart; $comment_count = count($comment_srl_list); if(!$comment_count) return $this->stop('msg_cart_is_null'); @@ -52,6 +53,12 @@ $oDB->commit(); $this->setMessage( sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count) ); + + if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList'); + header('location:'.$returnUrl); + return; + } } function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB) @@ -63,7 +70,7 @@ $logged_info = Context::get('logged_info'); $oCommentModel = &getModel('comment'); $commentItemList = $oCommentModel->getComments($commentSrlList); - $oTrashController = &getController('trash'); + $oTrashAdminController = &getAdminController('trash'); foreach($commentItemList AS $key=>$oComment) { @@ -76,7 +83,7 @@ $oTrashVO->setRemoverSrl($logged_info->member_srl); $oTrashVO->setRegdate(date('YmdHis')); - $output = $oTrashController->insertTrash($oTrashVO); + $output = $oTrashAdminController->insertTrash($oTrashVO); if (!$output->toBool()) { $oDB->rollback(); return $output; diff --git a/modules/comment/conf/module.xml b/modules/comment/conf/module.xml index f17582a90..de3a21fc0 100644 --- a/modules/comment/conf/module.xml +++ b/modules/comment/conf/module.xml @@ -10,8 +10,8 @@ - - + + diff --git a/modules/comment/ruleset/deleteChecked.xml b/modules/comment/ruleset/deleteChecked.xml new file mode 100644 index 000000000..28789da2a --- /dev/null +++ b/modules/comment/ruleset/deleteChecked.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/modules/comment/ruleset/insertCommentModuleConfig.xml b/modules/comment/ruleset/insertCommentModuleConfig.xml new file mode 100644 index 000000000..bdd21ae8d --- /dev/null +++ b/modules/comment/ruleset/insertCommentModuleConfig.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/modules/comment/tpl/comment_list.html b/modules/comment/tpl/comment_list.html index 55cc4c0d6..c1feeacf4 100644 --- a/modules/comment/tpl/comment_list.html +++ b/modules/comment/tpl/comment_list.html @@ -1,4 +1,3 @@ - @@ -21,7 +20,10 @@ -
+ +

{$XE_VALIDATOR_ERROR}

+ + @@ -50,7 +52,7 @@ {@ $comment = cut_str(trim(htmlspecialchars(strip_tags($val->content))), 200, '...')} {$no} - + {$comment}{$lang->no_text_comment} {htmlspecialchars($val->nick_name)} {(zdate($val->regdate,"Y-m-d\nH:i:s"))} diff --git a/modules/comment/tpl/comment_module_config.html b/modules/comment/tpl/comment_module_config.html index 9dea33f29..3ed11980b 100644 --- a/modules/comment/tpl/comment_module_config.html +++ b/modules/comment/tpl/comment_module_config.html @@ -1,6 +1,6 @@ - - - +

{$XE_VALIDATOR_ERROR}

+ +

{$lang->comment}

diff --git a/modules/comment/tpl/declared_list.html b/modules/comment/tpl/declared_list.html index b6dc0d3e1..a9a9b6016 100644 --- a/modules/comment/tpl/declared_list.html +++ b/modules/comment/tpl/declared_list.html @@ -1,7 +1,9 @@ - - +

{$XE_VALIDATOR_ERROR}

+ + +