Beispiel #1
0
 /**
  *
  *
  * @param $_string
  *
  * @return string
  */
 protected function _preserveSpecialStrings($_string)
 {
     preg_match_all(self::IOS_STRINGS_REGEXP, $_string, $matches);
     $matches = $matches[0];
     $placeholders = array();
     for ($i = 0; $i < count($matches); $i++) {
         $placeholders[] = CatUtils::generate_password();
     }
     $this->_patterns_found = array_combine($matches, $placeholders);
     foreach ($this->_patterns_found as $str => $placeholder) {
         $_string = str_replace($str, $placeholder, $_string);
     }
     return $_string;
 }
 public function doAction()
 {
     if (!$this->userIsLogged) {
         throw new Exception('User not Logged');
     }
     if ($this->undo) {
         $new_pwd = $this->old_password;
         $actual_pwd = $this->password;
     } else {
         $new_pwd = CatUtils::generate_password();
         $actual_pwd = $this->password;
     }
     changePassword($this->res_type, $this->res_id, $actual_pwd, $new_pwd);
     $this->result['password'] = $new_pwd;
     $this->result['undo'] = $this->password;
 }
 protected function _generatePassword($length = 12)
 {
     return CatUtils::generate_password($length);
 }