/**
  * @param array $input
  */
 public function update($input)
 {
     $this->checkEntity();
     $this->requireSingle();
     $input = e_array($input);
     if ($input != null) {
         $this->entity->name = $this->arrayOrEntity('name', $input);
         $this->entity->keyName = $this->arrayOrEntity('keyName', $input);
         $this->entity->description = $this->arrayOrEntity('description', $input);
         $this->entity->value = $this->arrayOrEntity('value', $input);
         $this->entity->default = $this->arrayOrEntity('default', $input);
         $this->entity->display = $this->arrayOrEntity('display', $input);
         $this->entity->hiddenFlag = $this->arrayOrEntity('hiddenFlag', $input);
         $this->save();
     }
 }
Beispiel #2
0
 public function updatePassword($input)
 {
     $this->checkEntity();
     $this->requireSingle();
     $input = e_array($input);
     try {
         $this->entity->verifyPassword($input);
     } catch (\Exception $e) {
         $this->ajax->setStatus('error');
         $this->ajax->addError('password', $e->getMessage());
         return false;
     }
     // Save the new password
     $this->entity->password = $input['new_password'];
     $this->save();
 }
Beispiel #3
0
 /**
  * Convert HTML characters to entities.
  *
  * The encoding specified in the application configuration file will be used.
  *
  * @param string[] $array
  *
  * @return string[]
  */
 function e_array($array)
 {
     foreach ($array as $key => $value) {
         if (is_array($value)) {
             $array[$key] = e_array($value);
         } else {
             $array[$key] = HTML::entities($value);
         }
     }
     return $array;
 }