1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Members;
13
14 use ICanBoogie\Debug;
15 use ICanBoogie\HTTP\Request;
16 use ICanBoogie\I18n\FormattedString;
17 use ICanBoogie\Uploaded;
18 use ICanBoogie\Operation;
19
20 use Icybee\Modules\Users\User;
21
22 class SaveOperation extends \Icybee\Modules\Users\SaveOperation
23 {
24 protected $accept = array
25 (
26 'image/gif',
27 'image/jpeg',
28 'image/png'
29 );
30
31 protected function validate(\ICanboogie\Errors $errors)
32 {
33 $file = new Uploaded('photo', $this->accept, false);
34
35 if ($file)
36 {
37 if ($file->er)
38 {
39 $errors['photo'] = new FormattedString('Unable to upload file %file: :message.', array
40 (
41 '%file' => $file->name,
42 ':message' => $file->er_message
43 ));
44
45 return false;
46 }
47
48 if ($file->location)
49 {
50 $this->request['photo'] = $file;
51 }
52 }
53
54
55
56
57
58 if (!$this->key && isset($this->properties['email-verify']) && $this->request['email-verify'] != $this->properties['email'])
59 {
60 $errors['email-verify'] = new FormattedString("E-mail and E-mail confirm don't match");
61
62 return false;
63 }
64
65 return parent::validate($errors);
66 }
67 }