Created
August 30, 2012 10:26
-
-
Save fetus-hina/3525780 to your computer and use it in GitHub Desktop.
Yii Framework と Smarty を使う時の CSRF トークン埋め込み用プラグイン(環境が限定的すぎる)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function smarty_function_csrf_token(array $params, Smarty_Internal_TemplateBase $smarty) { | |
$req = Yii::app()->getRequest(); | |
return | |
$req->enableCsrfValidation | |
? CHtml::hiddenField($req->csrfTokenName, $req->getCsrfToken()) | |
: ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment