@@ -22,7 +22,7 @@ define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/');
2222
2323require INSTALL_PATH . 'program/include/clisetup.php ' ;
2424
25- $ options = rcube_utils::get_opt ([
25+ $ options = \ rcube_utils::get_opt ([
2626 'u ' => 'username ' ,
2727 'e ' => 'email ' ,
2828 'n ' => 'name ' ,
@@ -80,15 +80,15 @@ function get_identity_attr($options)
8080 $ identity = $ user ->get_identity ($ identity_id );
8181
8282 if (empty ($ identity )) {
83- rcube::raise_error ('Invalid identity ID. ' , false , true );
83+ \ rcube::raise_error ('Invalid identity ID. ' , false , true );
8484 }
8585
8686 if (isset ($ identity [$ attribute ])) {
8787 $ attrValue = $ identity [$ attribute ];
8888
8989 echo "{$ attrValue }\n" ;
9090 } else {
91- rcube::raise_error ('Invalid attribute name. Available attributes: identity_id, user_id, changed, del, standard, name, '
91+ \ rcube::raise_error ('Invalid attribute name. Available attributes: identity_id, user_id, changed, del, standard, name, '
9292 . 'organization, email, reply-to, bcc, signature, html_signature. ' , false , true );
9393 }
9494}
@@ -114,7 +114,7 @@ function delete_identity($options)
114114 $ identities_level = get_identities_level ();
115115
116116 if ($ identities_level > 1 ) {
117- rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
117+ \ rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
118118 }
119119
120120 if (count ($ options ) === 1 ) {
@@ -133,7 +133,7 @@ function delete_identity($options)
133133 $ identity = $ user ->delete_identity ($ identity_id );
134134
135135 if (!$ identity ) {
136- rcube::raise_error ('Invalid identity ID. ' );
136+ \ rcube::raise_error ('Invalid identity ID. ' );
137137 exit ;
138138 }
139139
@@ -145,7 +145,7 @@ function add_identity($options)
145145 $ identities_level = get_identities_level ();
146146
147147 if ($ identities_level > 1 ) {
148- rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
148+ \ rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
149149 }
150150
151151 if (count ($ options ) === 1 ) {
@@ -207,7 +207,7 @@ function update_identity($options)
207207 $ identities_level = get_identities_level ();
208208
209209 if ($ identities_level > 1 ) {
210- rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
210+ \ rcube::raise_error ("Identities level doesn't allow this action. " , false , true );
211211 }
212212
213213 if (count ($ options ) === 1 ) {
@@ -260,7 +260,7 @@ function update_identity($options)
260260
261261 if ($ email !== null ) {
262262 if ($ identities_level > 0 ) {
263- rcube::raise_error ("Identities level doesn't allow setting email. " , false , true );
263+ \ rcube::raise_error ("Identities level doesn't allow setting email. " , false , true );
264264 }
265265
266266 $ updated_identity ['email ' ] = $ email ;
@@ -279,15 +279,15 @@ function update_identity($options)
279279 }
280280
281281 if (count ($ updated_identity ) === 0 ) {
282- rcube::raise_error ('No attributes changed. Set some new values. ' , false , true );
282+ \ rcube::raise_error ('No attributes changed. Set some new values. ' , false , true );
283283 }
284284
285285 $ user = get_user ($ options );
286286
287287 $ identity = $ user ->update_identity ($ identity_id , $ updated_identity );
288288
289289 if (!$ identity ) {
290- rcube::raise_error ('Identity not updated. Either the identity id is incorrect or provided values are invalid. ' , false , true );
290+ \ rcube::raise_error ('Identity not updated. Either the identity id is incorrect or provided values are invalid. ' , false , true );
291291 }
292292
293293 if ($ setAsDefault ) {
@@ -314,7 +314,7 @@ function get_option_value($options, $key, $fallback, $isBoolean, $isMandatory, $
314314 }
315315
316316 if ($ isMandatory ) {
317- rcube::raise_error ($ message , false , true );
317+ \ rcube::raise_error ($ message , false , true );
318318 }
319319
320320 return $ fallback ;
@@ -323,14 +323,14 @@ function get_option_value($options, $key, $fallback, $isBoolean, $isMandatory, $
323323function validate_email ($ email , $ fieldName )
324324{
325325 if (!filter_var ($ email , \FILTER_VALIDATE_EMAIL )) {
326- rcube::raise_error ("invalid {$ fieldName } format " , false , true );
326+ \ rcube::raise_error ("invalid {$ fieldName } format " , false , true );
327327 }
328328}
329329
330330function validate_boolean ($ value , $ fieldName )
331331{
332332 if (!is_bool ($ value ) && $ value !== '0 ' && $ value !== '1 ' ) {
333- rcube::raise_error ("{$ fieldName } can either be set to 1 (true), 0 (false) or without a value (true) " , false , true );
333+ \ rcube::raise_error ("{$ fieldName } can either be set to 1 (true), 0 (false) or without a value (true) " , false , true );
334334 }
335335}
336336
@@ -363,26 +363,26 @@ function echo_shared_options()
363363
364364function get_user ($ options )
365365{
366- $ rcmail = rcube::get_instance ();
366+ $ rcmail = \ rcube::get_instance ();
367367
368368 $ db = $ rcmail ->get_dbh ();
369369
370370 $ username = get_option_value ($ options , 'username ' , '' , false , true , 'Enter the username e.g. -u user@example.com ' );
371- $ host = rcmail_utils::get_host ($ options );
371+ $ host = \ rcmail_utils::get_host ($ options );
372372
373373 // find user in local database
374- $ user = rcube_user::query ($ username , $ host );
374+ $ user = \ rcube_user::query ($ username , $ host );
375375
376376 if (empty ($ user )) {
377- rcube::raise_error ("User does not exist: {$ username }" , false , true );
377+ \ rcube::raise_error ("User does not exist: {$ username }" , false , true );
378378 }
379379
380380 return $ user ;
381381}
382382
383383function get_identities_level ()
384384{
385- $ rcmail = rcube::get_instance ();
385+ $ rcmail = \ rcube::get_instance ();
386386 $ identities_level = intval ($ rcmail ->config ->get ('identities_level ' , 0 ));
387387
388388 return $ identities_level ;
0 commit comments