Forráskód Böngészése

fixed Notify validate user login

Piotr Labudda 8 éve
szülő
commit
2f5119807c
2 módosított fájl, 3 hozzáadás és 1 törlés
  1. 1 1
      SE/se-lib/Route/Notify.php
  2. 2 0
      SE/se-lib/V.php

+ 1 - 1
SE/se-lib/Route/Notify.php

@@ -582,7 +582,7 @@ class Route_Notify extends RouteBase {
 
 	public function removeUserTableReminder($args) {
 		$usrLogin = User::getLogin();
-		$who  = V::validate('who',  $args, array('type'=>'word', 'equal'=>$usrLogin, 'error_msg_equal'=>"Brak uprawnień do wprowadzania zmian w powiadomieniach innych użytwkoników"));
+		$who  = V::validate('who',  $args, array('type'=>'login', 'equal'=>$usrLogin, 'error_msg_equal'=>"Brak uprawnień do wprowadzania zmian w powiadomieniach innych użytwkoników"));
 		$what = V::validate('what', $args, array('type'=>'word', 'not_empty'=>true, 'max_length'=>'255', 'values'=>$this->getFieldValues('what')));
 		$when = V::validate('when', $args, array('type'=>'word', 'not_empty'=>true, 'max_length'=>'255', 'values'=>$this->getFieldValues('when')));
 

+ 2 - 0
SE/se-lib/V.php

@@ -384,6 +384,8 @@ class V {
 		if ($type != null) {
 			if ('word' == $type) {
 				if (!is_scalar($value) || !preg_match('/^[a-zA-Z_-]*$/', $value)) throw new Exception("required type '{$type}' ({$fldLabel})");
+			} else if ('login' == $type) {
+				if (!is_scalar($value) || !preg_match('/^[a-zA-Z\._-]*$/', $value)) throw new Exception("required type '{$type}' ({$fldLabel})");
 			} else {
 				throw new Exception("Unimplemented type to validate: '{$type}'");
 			}