
日本語のタグを使うには前節での日本語対応に加えタグのurlencode/decodeの作業が必要です。
Index: frontend/modules/tag/actions/actions.class.php =================================================================== — frontend/modules/tag/actions/actions.class.php (revision 61) +++ frontend/modules/tag/actions/actions.class.php (working copy) @@ -12,9 +12,9 @@ { public function executeShow() { - $this->questionpager = QuestionPeer::getPopularByTag($this->getRequestParameter(’tag’), $this->getRequestParameter(’page’, 1)); + $this->questionpager = QuestionPeer::getPopularByTag(urldecode($this->getRequestParameter(’tag’)), $this->getRequestParameter(’page’, 1)); - $this->setTitle(’askeet! » question tagged ‘.Tag::normalize($this->getRequestParameter(’tag’))); + $this->setTitle(’askeet! » question tagged ‘.Tag::normalize(urldecode($this->getRequestParameter(’tag’)))); } public function executeAutocomplete() @@ -56,7 +56,7 @@ // remove tag for this user and question $user = $this->getUser()->getSubscriber(); - $tag = $this->getRequestParameter(’tag’); + $tag = urldecode($this->getRequestParameter(’tag’)); $user->removeTag($this->question, $tag); Index: frontend/modules/tag/templates/showSuccess.php =================================================================== — frontend/modules/tag/templates/showSuccess.php (revision 61) +++ frontend/modules/tag/templates/showSuccess.php (working copy) @@ -1,4 +1,4 @@ -<h1>popular questions for tag ‘< ?php echo $request->getParameter(’tag’) ?>’</h1> +<h1>popular questions for tag ‘< ?php echo urldecode($request->getParameter(’tag’)) ?>’</h1> < ?php echo includepartial(’question/questionlist’, array(’questionpager’ => $questionpager)) ?> < ?php echo pagernavigation($questionpager, ‘@tag?tag=’.$request->getParameter(’tag’)) ?> Index: lib/model/Question.php =================================================================== — lib/model/Question.php (revision 61) +++ lib/model/Question.php (working copy) @@ -123,6 +123,7 @@ // add tags foreach ($tags as $tag) { + if(pregmatch("/[<>&]/",$tag)){ continue; } $questionTag = new QuestionTag(); $questionTag->setQuestionId($this->getId()); $questionTag->setUserId($userId); Index: lib/Tag.class.php =================================================================== — lib/Tag.class.php (revision 61) +++ lib/Tag.class.php (working copy) @@ -7,7 +7,8 @@ $ntag = strtolower($tag); // remove all unwanted chars - $ntag = pregreplace(’/[^a-zA-Z0-9]/’, ‘’, $ntag); + // $ntag = pregreplace(’/[^a-zA-Z0-9]/’, ‘’, $ntag); + $ntag = pregreplace(’/[<>&]/’, ‘’, $ntag); return trim($ntag); }
POSTED BY tumf ON 12 月 22nd, 2005. PERMALINK

