コード例 #1
0
ファイル: MailHelper.php プロジェクト: nikonehauser/pt
 public static function sendPasswordResetLink(\Member $member)
 {
     $email = $member->getEmail();
     $locale = Localizer::get('mail.password_reset');
     $num = $member->getNum();
     $now = time();
     $email = $member->getEmail();
     $href = Router::toModule('manage', 'do_reset_password', ['num' => $num, 'exp' => time(), 'hash' => Cryption::getPasswordResetToken($num, $now, $email)]);
     return self::send($email, \Tbmt\view\Factory::buildMemberFullNameString($member), $locale['subject'], Localizer::insert($locale['body'], ['link' => $href], false));
 }
コード例 #2
0
ファイル: kickstart.validator.php プロジェクト: dapepe/tymio
 /**
  * Gets the error messages from the language file
  *
  * @param int $intCode
  * @param array $arrOptions
  */
 public function getErrorMessage($intCode, $arrOptions = array())
 {
     if (isset($arrOptions['error'])) {
         return $arrOptions['error'];
     }
     if (isset($arrOptions['message'])) {
         return $this->locale->insert($arrOptions['message'], array('value' => isset($arrOptions['value']) ? $arrOptions['value'] : $arrOptions['field'], 'field' => $arrOptions['field']));
     }
     switch ($intCode) {
         case FILTER_VALIDATE_REQUIRED:
             return $this->locale->insert('error.empty', array('value' => $arrOptions['field']));
         case FILTER_VALIDATE_PASSWORD:
             return $this->locale->get('error.password');
         case FILTER_VALIDATE_USERNAME:
             return $this->locale->insert('error.username', array('value' => '"' . $arrOptions['value'] . '"'));
         case FILTER_VALIDATE_IDENTIFIER:
             return $this->locale->insert('error.identifier', array('value' => '"' . $arrOptions['value'] . '"'));
         case FILTER_VALIDATE_RESOURCE:
             return $this->locale->insert('error.resource', array('value' => '"' . $arrOptions['value'] . '"'));
         case FILTER_VALIDATE_EMAIL:
             return $this->locale->insert('error.not_a_address', array('value' => '"' . $arrOptions['value'] . '"', 'type' => 'E-mail'));
         case FILTER_VALIDATE_IPV4:
             return $this->locale->insert('error.not_a_address', array('value' => '"' . $arrOptions['value'] . '"', 'type' => 'IPv4'));
         case FILTER_VALIDATE_IPV6:
             return $this->locale->insert('error.not_a_address', array('value' => '"' . $arrOptions['value'] . '"', 'type' => 'IPv6'));
         case FILTER_VALIDATE_IP:
             return $this->locale->insert('error.not_a_address', array('value' => '"' . $arrOptions['value'] . '"', 'type' => 'IP'));
         case FILTER_VALIDATE_URL:
             return $this->locale->insert('error.not_a_url', array('value' => $arrOptions['value']));
         case FILTER_VALIDATE_FLOAT:
             return $this->locale->insert('error.not_a_number', array('value' => $arrOptions['field']));
         case FILTER_VALIDATE_INT:
             if (isset($arrOptions['min_range']) && isset($arrOptions['max_range'])) {
                 return $this->locale->insert('error.in_between', array('value' => $arrOptions['field'], 'min' => $arrOptions['min_range'], 'max' => $arrOptions['max_range']));
             } elseif (isset($arrOptions['min_range'])) {
                 return $this->locale->insert('error.greater_than', array('value' => $arrOptions['field'], 'count' => $arrOptions['min_range']));
             } elseif (isset($arrOptions['max_range'])) {
                 return $this->locale->insert('error.less_than', array('value' => $arrOptions['field'], 'count' => $arrOptions['max_range']));
             } else {
                 return $this->locale->insert('error.not_a_int', array('value' => $arrOptions['field']));
             }
         case FILTER_VALIDATE_BOOLEAN:
             break;
         case FILTER_VALIDATE_MIN_LENGTH:
             return $this->locale->insert('error.too_short', array('value' => $arrOptions['field'], 'count' => $arrOptions['len']));
         case FILTER_VALIDATE_MAX_LENGTH:
             return $this->locale->insert('error.too_long', array('value' => $arrOptions['field'], 'count' => $arrOptions['len']));
         case FILTER_VALIDATE_LENGTH:
             return $this->locale->insert('error.wrong_range', array('value' => $arrOptions['field'], 'min' => $arrOptions['min'], 'max' => $arrOptions['max']));
         case FILTER_VALIDATE_DATE_RANGE:
             $arrOptions['format'] = isset($arrOptions['format']) ? $arrOptions['format'] : $this->locale->getDateFormat('date.format.default');
             return $this->locale->insert('error.date_range', array('value' => $arrOptions['field'], 'min' => date($arrOptions['format'], $arrOptions['min']), 'max' => date($arrOptions['format'], $arrOptions['max'])));
         case FILTER_VALIDATE_DATE_START_END:
             $arrOptions['format'] = isset($arrOptions['format']) ? $arrOptions['format'] : $this->locale->getDateFormat('date.format.default');
             return $this->locale->insert('error.date_start_end', array('value' => $arrOptions['field'], 'end' => date($arrOptions['format'], $arrOptions['end'])));
         default:
             // too_long
             // too_short
             // empty (Muss ausgefüllt werden)
             // invalid
             // start_before_end
             // range: Ist keine gültige {model}
             break;
     }
     return $this->locale->insert('error.invalid', array('value' => isset($arrOptions['value']) ? $arrOptions['value'] : $arrOptions['field'], 'field' => $arrOptions['field']));
 }