Am I right in thinking that restore_xid was added after Expression Engine 2.4.0 and if so is there a 2.4 way of refreshing it?
I have created a form using $this->EE->functions->form_declaration(), and then using jQuery serialized the form and made an ajax call to a module I have created.
In the modules called function I have the line…
if (!$this->EE->security->secure_forms_check($this->EE->input->post(‘XID’)))
{
exit();
}
... to validate the form and this seems to work.
The problem is that I know that the XID is one time only and as this ajax call may be made multiple times (it updates part of the screen) that I need to call restore_xid but if I extend the above with ...
else
{
$this->EE->security->refresh_xid();
}
... I get the error ... Fatal error: Call to undefined method EE_Security::refresh_xid(). According to the 2.7.0 documentation this function exists, hence II am assuming this is a later add on.
If it is, is there another way that I can refresh the XID - perhaps by creating a new one and passing it via ajax to jQuery where I can replace the ID in the form?