Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 1 Ответов
  • 2598 Просмотров
*

yAnTar

  • Захожу иногда
  • 296
  • 81 / 3
josSpoofCheck - Для джумлы 1.5.x
« : 19.09.2008, 12:08:50 »
В 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);
на строку
Код
JUtility::getToken()
работает, но как то не красиво - в код вставлять такую большой кусок (15 строк) с тела функции, неужели нет статического метода, который проверяет это.
В классе JSession подходящего метода не нашел.
Firefox the best, Google the best, jQuery the best.
yAnTar блог
*

yAnTar

  • Захожу иногда
  • 296
  • 81 / 3
Re: josSpoofCheck - Для джумлы 1.5.x
« Ответ #1 : 02.10.2008, 19:25:55 »
Случайно нашел здесь
Код
JRequest::checkToken();
Firefox the best, Google the best, jQuery the best.
yAnTar блог
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться