/** * Initialize this Request. * * @param AgaviContext An AgaviContext instance. * @param array An associative array of initialization parameters. * * @throws <b>AgaviInitializationException</b> If an error occurs while * initializing this Request. * * @author David Zülke <*****@*****.**> * @since 0.11.0 */ public function initialize(AgaviContext $context, array $parameters = array()) { // empty $_POST just to be sure $_POST = array(); // grab the POST body $this->input = file_get_contents('php://input'); parent::initialize($context, $parameters); }
/** * Do any necessary startup work after initialization. * * This method is not called directly after initialize(). * * @author David Zülke <*****@*****.**> * @since 0.11.0 */ public function startup() { parent::startup(); if ($this->getParameter('unset_input', true)) { $rla = ini_get('register_long_arrays'); $_GET = $_POST = $_COOKIE = $_REQUEST = $_FILES = array(); if ($rla) { // clean long arrays, too! $GLOBALS['HTTP_GET_VARS'] = $GLOBALS['HTTP_POST_VARS'] = $GLOBALS['HTTP_COOKIE_VARS'] = $GLOBALS['HTTP_POST_FILES'] = array(); } foreach ($_SERVER as $key => $value) { if (substr($key, 0, 5) == 'HTTP_' || $key == 'CONTENT_TYPE' || $key == 'CONTENT_LENGTH') { unset($_SERVER[$key]); unset($_ENV[$key]); if ($rla) { unset($GLOBALS['HTTP_SERVER_VARS'][$key]); unset($GLOBALS['HTTP_ENV_VARS'][$key]); } } } } }
/** * Do any necessary startup work after initialization. * * This method is not called directly after initialize(). * * @author David Zülke <*****@*****.**> * @since 1.0.0 */ public function startup() { parent::startup(); if ($this->getParameter('unset_input', true)) { $_SERVER['argv'] = $_ENV['argv'] = $GLOBALS['argv'] = array(); $_SERVER['argc'] = $_ENV['argc'] = $GLOBALS['argc'] = 0; } }
protected function log(AgaviExecutionContainer $container) { //keep this simple for now $this->rq->appendAttribute('actions', array('name' => $container->getActionName(), 'module' => $container->getModuleName(), 'request_data' => array('request_parameters' => $container->getRequestData()->getParameters(), 'cookies' => $container->getRequestData()->getCookies(), 'headers' => $container->getRequestData()->getHeaders()), 'validation' => $this->getValidationInfo($container), 'view' => $this->getViewInfo($container)), self::NS_DATA); }
/** * Adds the validation report to the current request to retain error messages * when forwarding (like <code>return $this->createForwardContainer('Foo', 'Bar');</code>). * * Background: The \AgaviFormPopulationFilter gets the validation report * from the AgaviExecutionContainer of the initial request (the main agavi * action called) and uses that report to fill forms with data taken from * the request (form fields and values). * * If your forms are not populated automatically, check that you have an * id and an action attribute on the form element and call this method in * the view of the action that was being forwarded to internally. * * @return void */ protected function addValidationReportToRequestForFpf() { $this->request->setAttribute('validation_report', $this->getContainer()->getValidationManager()->getReport(), 'org.agavi.filter.FormPopulationFilter'); }