function __construct($handler, $method = 'execute') { parent::__construct(); //store even description $this->eventHandler = $handler; $this->eventMethod = $method; //Build security field $securityField = KeyStorage::newKey(array($this, 'Execute')); //Event details $this->hidden(self::EVENT_HANDLER, $securityField->Store(@serialize($handler))); $this->hidden(self::EVENT_METHOD, base64_encode($securityField->Encrypt($this->eventMethod))); //Security event $this->Add($this->getSecurityFieldElement($securityField)); //Ensure its post, security fields only work on post requests currently. $this->method('post'); if (isset($_SERVER['QUERY_STRING'])) { $this->action('?' . $_SERVER['QUERY_STRING']); } }
private function data($query_params = array()) { //Build security field if ($this->securityField === null) { $this->securityField = KeyStorage::newKey(array($this, 'Execute')); $this->eHandler = $this->securityField->Store(serialize($this->object)); $this->eMethod = base64_encode($this->securityField->Encrypt($this->method)); } $g = $_GET; if (isset($g['error'])) { unset($g['error']); } if (isset($g['eid'])) { unset($g['eid']); } //Event details $qs = array_merge($g, $query_params); $qs[self::EVENT_HANDLER] = $this->eHandler; $qs[self::EVENT_METHOD] = $this->eMethod; $qs[Key::FIELD_NAME] = $this->securityField->getId(); $str_qs = '?' . http_build_query($qs); return $str_qs; }