В Joomla 1.0.x были функции
josSpoofCheck i josSpoofValue.
Здесь нашел, что
josSpoofValue в Joomla 1.5.x заменяется конструкцией JUtility::getToken()
а
josSpoofCheck() - deprecated, solution now included in JSession.
Не нашел в JSession решения. Покопался в плагине легаси_моде нашел функцию
function josSpoofCheck( $header=false, $alternate=null )
{
// Lets make sure they saw the html form
$check = true;
$hash = josSpoofValue($alternate);
$valid = JRequest::getBool( $hash, 0, 'post' );
if (!$valid) {
$check = false;
}
// Make sure request came from a client with a user agent string.
if (!isset( $_SERVER['HTTP_USER_AGENT'] )) {
$check = false;
}
// Check to make sure that the request was posted as well.
$requestMethod = JArrayHelper::getValue( $_SERVER, 'REQUEST_METHOD' );
if ($requestMethod != 'POST') {
$check = false;
}
if (!$check)
{
header( 'HTTP/1.0 403 Forbidden' );
jexit( JText::_('E_SESSION_TIMEOUT') );
}
}
Изменил строку
$hash = josSpoofValue($alternate);
на строку
работает, но как то не красиво - в код вставлять такую большой кусок (15 строк) с тела функции, неужели нет статического метода, который проверяет это.
В классе JSession подходящего метода не нашел.