sintonia/legacy/application/common/SecurityHelper.php

23 lines
694 B
PHP
Raw Normal View History

2015-06-12 19:11:28 +02:00
<?php
class SecurityHelper {
2015-06-12 19:48:54 +02:00
public static function htmlescape_recursive(&$arr) {
foreach ($arr as $key => $val) {
if (is_array($val)) {
self::htmlescape_recursive($arr[$key]);
} else if (is_string($val)) {
$arr[$key] = htmlspecialchars($val, ENT_QUOTES);
}
}
return $arr;
}
2015-09-24 00:21:30 +02:00
public static function verifyCSRFToken($observedToken) {
2015-09-24 00:21:30 +02:00
$current_namespace = new Zend_Session_Namespace('csrf_namespace');
$observed_csrf_token = $observedToken;
$expected_csrf_token = $current_namespace->authtoken;
return ($observed_csrf_token == $expected_csrf_token);
2015-09-24 00:21:30 +02:00
}
2015-06-12 19:11:28 +02:00
}