@@ -29,8 +29,8 @@ public function __construct()
29
29
'password ' => array ('type ' => MIDAS_DATA ),
30
30
'creation ' => array ('type ' => MIDAS_DATA ),
31
31
'folder_id ' => array ('type ' => MIDAS_DATA ),
32
- 'admin ' => array ('type ' => MIDAS_DATA ),
33
- 'privacy ' => array ('type ' => MIDAS_DATA ),
32
+ 'admin ' => array ('type ' => MIDAS_DATA ),
33
+ 'privacy ' => array ('type ' => MIDAS_DATA ),
34
34
'publicfolder_id ' => array ('type ' => MIDAS_DATA ),
35
35
'privatefolder_id ' => array ('type ' => MIDAS_DATA ),
36
36
'view ' => array ('type ' => MIDAS_DATA ),
@@ -46,10 +46,10 @@ public function __construct()
46
46
'invitations ' => array ('type ' => MIDAS_ONE_TO_MANY , 'model ' => 'CommunityInvitation ' , 'parent_column ' => 'user_id ' , 'child_column ' => 'user_id ' ),
47
47
'folderpolicyuser ' => array ('type ' => MIDAS_ONE_TO_MANY , 'model ' => 'Folderpolicyuser ' , 'parent_column ' => 'user_id ' , 'child_column ' => 'user_id ' ),
48
48
'feeds ' => array ('type ' => MIDAS_ONE_TO_MANY , 'model ' => 'Feed ' , 'parent_column ' => 'user_id ' , 'child_column ' => 'user_id ' ),
49
- );
49
+ );
50
50
$ this ->initialize (); // required
51
51
} // end __construct()
52
-
52
+
53
53
/** Abstract functions */
54
54
abstract function getByEmail ($ email );
55
55
abstract function getByUser_id ($ userid );
@@ -59,7 +59,7 @@ abstract function getByUuid($uuid);
59
59
abstract function getByFolder ($ folder );
60
60
/** Returns all the users */
61
61
abstract function getAll ($ onlyPublic = false , $ limit = 20 , $ order = 'lastname ' , $ offset = null );
62
-
62
+
63
63
/** save */
64
64
public function save ($ dao )
65
65
{
@@ -68,23 +68,23 @@ public function save($dao)
68
68
$ dao ->setUuid (uniqid () . md5 (mt_rand ()));
69
69
}
70
70
parent ::save ($ dao );
71
- }
72
-
71
+ }
72
+
73
73
/** delete*/
74
74
public function delete ($ dao )
75
75
{
76
76
//TODO
77
- $ modelLoad = new MIDAS_ModelLoader ();
77
+ $ modelLoad = new MIDAS_ModelLoader ();
78
78
$ ciModel = $ modelLoad ->loadModel ('CommunityInvitation ' );
79
79
$ invitations = $ dao ->getInvitations ();
80
80
foreach ($ invitations as $ invitation )
81
81
{
82
82
$ ciModel ->delete ($ invitation );
83
83
}
84
-
84
+
85
85
parent ::delete ($ dao );
86
86
}// delete
87
-
87
+
88
88
/** plus one view*/
89
89
function incrementViewCount ($ userDao )
90
90
{
@@ -107,10 +107,10 @@ function incrementViewCount($userDao)
107
107
$ userDao ->view ++;
108
108
$ this ->save ($ userDao );
109
109
}//end incrementViewCount
110
-
110
+
111
111
/** create user */
112
112
public function createUser ($ email , $ password , $ firstname , $ lastname , $ admin = 0 )
113
- {
113
+ {
114
114
if (!is_string ($ email ) || empty ($ email ) || !is_string ($ password ) || empty ($ password ) || !is_string ($ firstname )
115
115
|| empty ($ firstname ) || !is_string ($ lastname ) || empty ($ lastname ) || !is_numeric ($ admin ))
116
116
{
@@ -122,7 +122,7 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0)
122
122
{
123
123
throw new Zend_Exception ("User already exists. " );
124
124
}
125
-
125
+
126
126
Zend_Loader::loadClass ('UserDao ' , BASE_PATH .'/core/models/dao ' );
127
127
$ passwordPrefix = Zend_Registry::get ('configGlobal ' )->password ->prefix ;
128
128
if (isset ($ passwordPrefix ) && !empty ($ passwordPrefix ))
@@ -136,14 +136,14 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0)
136
136
$ userDao ->setCreation (date ('c ' ));
137
137
$ userDao ->setPassword (md5 ($ password ));
138
138
$ userDao ->setAdmin ($ admin );
139
-
139
+
140
140
// check gravatar
141
141
$ gravatarUrl = $ this ->getGravatarUrl ($ email );
142
142
if ($ gravatarUrl != false )
143
143
{
144
144
$ userDao ->setThumbnail ($ gravatarUrl );
145
145
}
146
-
146
+
147
147
parent ::save ($ userDao );
148
148
149
149
$ this ->ModelLoader = new MIDAS_ModelLoader ();
@@ -155,13 +155,13 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0)
155
155
$ feedpolicygroupModel = $ this ->ModelLoader ->loadModel ('Feedpolicygroup ' );
156
156
$ feedpolicyuserModel = $ this ->ModelLoader ->loadModel ('Feedpolicyuser ' );
157
157
$ anonymousGroup = $ groupModel ->load (MIDAS_GROUP_ANONYMOUS_KEY );
158
-
158
+
159
159
$ folderGlobal = $ folderModel ->createFolder ('user_ ' . $ userDao ->getKey (), '' , MIDAS_FOLDER_USERPARENT );
160
160
$ folderPrivate = $ folderModel ->createFolder ('Private ' , '' , $ folderGlobal );
161
161
$ folderPublic = $ folderModel ->createFolder ('Public ' , '' , $ folderGlobal );
162
162
163
163
$ folderpolicygroupModel ->createPolicy ($ anonymousGroup , $ folderPublic , MIDAS_POLICY_READ );
164
-
164
+
165
165
$ folderpolicyuserModel ->createPolicy ($ userDao , $ folderPrivate , MIDAS_POLICY_ADMIN );
166
166
$ folderpolicyuserModel ->createPolicy ($ userDao , $ folderGlobal , MIDAS_POLICY_ADMIN );
167
167
$ folderpolicyuserModel ->createPolicy ($ userDao , $ folderPublic , MIDAS_POLICY_ADMIN );
@@ -175,12 +175,14 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0)
175
175
176
176
$ feed = $ feedModel ->createFeed ($ userDao , MIDAS_FEED_CREATE_USER , $ userDao );
177
177
$ feedpolicygroupModel ->createPolicy ($ anonymousGroup , $ feed , MIDAS_POLICY_READ );
178
- $ feedpolicyuserModel ->createPolicy ($ userDao , $ feed , MIDAS_POLICY_ADMIN );
178
+ $ feedpolicyuserModel ->createPolicy ($ userDao , $ feed , MIDAS_POLICY_ADMIN );
179
+
180
+ Zend_Registry::get ('notifier ' )->callback ('CALLBACK_CORE_NEW_USER_ADDED ' , array ('userDao ' => $ userDao ));
179
181
180
182
return $ userDao ;
181
183
}
182
-
183
-
184
+
185
+
184
186
/**
185
187
* Get either a Gravatar URL or complete image tag for a specified email address.
186
188
*
@@ -198,7 +200,7 @@ public function getGravatarUrl($email, $s = 32, $d = '404', $r = 'g', $img = fal
198
200
$ url = 'http://www.gravatar.com/avatar/ ' ;
199
201
$ url .= md5 (strtolower (trim ($ email )));
200
202
$ url .= "?s= " .$ s ."&d= " .$ d ."&r= " .$ r ;
201
- if ($ img )
203
+ if ($ img )
202
204
{
203
205
$ url = '<img src=" ' . $ url . '" ' ;
204
206
foreach ($ atts as $ key => $ val )
@@ -207,7 +209,7 @@ public function getGravatarUrl($email, $s = 32, $d = '404', $r = 'g', $img = fal
207
209
}
208
210
$ url .= ' /> ' ;
209
211
}
210
-
212
+
211
213
$ header = get_headers ($ url , 1 );
212
214
if (strpos ($ header [0 ], '404 Not Found ' ) != false )
213
215
{
0 commit comments