1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Members;
13
14 class Model extends \Icybee\Modules\Users\Model
15 {
16 public function save(array $properties, $key=null, array $options=array())
17 {
18 global $core;
19
20 $photo = null;
21 $photo_path = null;
22
23 if (isset($properties['photo']) && is_object($properties['photo']))
24 {
25 $photo = $properties['photo'];
26
27
28
29 $filename = \ICanBoogie\normalize($properties['username']) . $photo->extension;
30 $photo_path = $core->config['repository'] . '/files/members/' . $filename;
31 $properties['photo'] = $photo_path;
32 }
33
34 $rc = parent::save($properties, $key, $options);
35
36
37
38 if ($rc && $photo)
39 {
40 $photo->move($_SERVER['DOCUMENT_ROOT'] . $photo_path, true);
41 }
42
43 return $rc;
44 }
45 }