Beispiel #1
0
 /**
  * Loads HTTP data.
  * @return void
  */
 public function loadHttpData()
 {
     $path = $this->getHtmlName();
     // img_x or img['x']
     $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
     $this->setValue(ArrayTools::get($this->getForm()->getHttpData(), $path) !== NULL);
 }
 /**
  * Returns uploaded file.
  * @param  string key (or more keys)
  * @return HttpUploadedFile
  */
 public final function getFile($key)
 {
     if ($this->files === NULL) {
         $this->initialize();
     }
     $args = func_get_args();
     return ArrayTools::get($this->files, $args);
 }
 /**
  * Generates link. If links points to @secure annotated signal handler method, additonal
  * parameter preventing changing parameters will be added.
  *
  * @param string  $destination
  * @param array|mixed $args
  * @return string
  */
 public function link($destination, $args = array())
 {
     if (!is_array($args)) {
         $args = func_get_args();
         array_shift($args);
     }
     $link = parent::link($destination, $args);
     $lastrequest = $this->presenter->lastCreatedRequest;
     /* --- Bad link --- */
     if ($lastrequest === NULL) {
         return $link;
     }
     /* --- Not a signal --- */
     if (substr($destination, -1) !== '!') {
         return $link;
     }
     /* --- Exclude Form submits --- */
     if (substr($destination, -8) === '-submit!') {
         return $link;
     }
     /* --- Only on same presenter --- */
     if ($this->getPresenter()->getName() !== $lastrequest->getPresenterName()) {
         return $link;
     }
     $signal = trim($destination, '!');
     $rc = $this->getReflection()->getMethod($this->formatSignalMethod($signal));
     //        if (Annotations::has($rc, 'secured') === FALSE) {
     if ($rc->hasAnnotation('secured') === FALSE) {
         return $link;
     }
     $origParams = $lastrequest->getParams();
     $protectedParams = array();
     foreach ($rc->getParameters() as $param) {
         $protectedParams[$param->name] = ArrayTools::get($origParams, $this->getParamId($param->name));
     }
     $args['__secu'] = $this->createSecureHash($protectedParams);
     return parent::link($destination, $args);
 }
Beispiel #4
0
 /**
  * Loads HTTP data.
  * @return void
  */
 public function loadHttpData()
 {
     $path = explode('[', strtr(str_replace(array('[]', ']'), '', $this->getHtmlName()), '.', '_'));
     $this->setValue(ArrayTools::get($this->getForm()->getHttpData(), $path));
 }