/** * @preserveGlobalState disabled * @runInSeparateProcess */ public function test_key_validate() { $this->assertTrue(Hm_Request_Key::validate('fakefingerprint')); }
/** * Validate a form key. If this is a non-empty POST form from an * HTTP request or AJAX update, it will take the user to the home * page if the page_key value is either not present or not valid * @return void */ public function process_key() { if (empty($this->request->post)) { return false; } $key = array_key_exists('hm_page_key', $this->request->post) ? $this->request->post['hm_page_key'] : false; $valid = Hm_Request_Key::validate($key); if (!$valid) { if ($this->request->type == 'AJAX') { if (DEBUG_MODE) { Hm_Debug::add('REQUEST KEY check failed'); Hm_Debug::load_page_stats(); Hm_Debug::show('log'); } Hm_Functions::cease(json_encode(array('status' => 'not callable'))); return 'exit'; } else { if ($this->session->loaded) { $this->session->destroy($this->request); } Hm_Debug::add('REQUEST KEY check failed'); Hm_Dispatch::page_redirect('?page=home'); return 'redirect'; } } return false; }