112 $Settings->load_package_settings(
'user::user_controller' ,
'last' ,
'cf_user' );
113 $this->EnableRegistration = intval( $Settings->get_setting(
'enable_registration' , 1 ) );
114 $this->RegistrationConfirm = intval( $Settings->get_setting(
'registration_confirm' , 1 ) );
115 $this->EmailAsLogin = intval( $Settings->get_setting(
'email_as_login' , 0 ) );
117 catch( Exception $e )
141 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
142 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
143 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
144 $this->UserAccess =
get_package(
'user::user_access' ,
'last' , __FILE__ );
145 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
149 catch( Exception $e )
177 $PageJS =
get_package(
'page::page_js' ,
'last' , __FILE__ );
181 $PageJS->add_javascript(
"{http_host}/$PackagePath/include/js/user_view.js" );
184 $Lang->include_strings_js(
'user::user_view' );
186 catch( Exception $e )
214 $this->Output = $this->CachedMultyFS->get_template(
215 __FILE__ , $this->EmailAsLogin ?
'email_as_login_form.tpl' :
'login_form.tpl'
218 if( $this->EnableRegistration === 1 )
220 $Code =
' {href:page=registration.html;text=registration}';
221 $this->Output = str_replace(
'{registration_link}' , $Code , $this->Output );
224 catch( Exception $e )
244 private function show_registration_confirm_form()
248 if( $this->RegistrationConfirm )
250 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'confirm_registration.tpl' );
254 $this->Output =
'{lang:registration_complete}';
257 catch( Exception $e )
277 private function compile_registration_form()
281 $Template = $this->CachedMultyFS->get_template(
282 __FILE__ , $this->EmailAsLogin ?
'email_as_login_registration_form.tpl' :
'registration_form.tpl'
285 $Template = $this->String->print_record( $Template , $_POST );
287 $this->Output = $Template;
289 catch( Exception $e )
317 $PermitAlgorithms =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
318 $HasUserManagerPermit = $PermitAlgorithms->object_has_permit(
false ,
'user' ,
'user_manager' );
319 if( $this->EnableRegistration != 1 && $HasUserManagerPermit ==
false )
321 $this->Output =
'{lang:registration_is_disabled}';
325 $UserController =
get_package(
'user::user_controller' ,
'last' , __FILE__ );
326 if( $this->Security->get_gp(
'user_action' ) && $UserController->RegistrationWasPassed )
328 $this->show_registration_confirm_form();
332 $this->compile_registration_form();
335 catch( Exception $e )
363 $UserId = $Options->get_setting(
'user_id' ,
false );
365 $User = $this->UserAlgorithms->get_by_id( $UserId );
367 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'short_profile.tpl' );
369 $this->Output = $this->String->print_record( $this->Output , $User );
371 catch( Exception $e )
399 if( $this->Security->get_gp(
'login' ,
'set' ) )
401 $UserLogin = $this->Security->get_gp(
'login' ,
'string' );
402 $User = $this->UserAccess->get_user( $UserLogin );
406 $UserId = $this->Security->get_gp(
'user_id' ,
'integer' , 0 );
409 $UserId = $this->UserAlgorithms->get_id();
412 $User = $this->UserAlgorithms->get_by_id( $UserId );
415 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'full_profile.tpl' );
416 $this->Output = $this->String->print_record( $this->Output , $User );
418 catch( Exception $e )
438 private function compile_update_user_form()
443 $this->Output = $this->String->hide_block(
444 $this->Output ,
'permit:user_manager' ,
'permit:~user_manager' , $Changed
447 $User = $this->UserAlgorithms->get_user();
448 $ContextSetUtilities =
get_package(
'gui::context_set::context_set_utilities' ,
'last' , __FILE__ );
449 $this->Output = $ContextSetUtilities->set_form_data( $this->Output , $User );
451 catch( Exception $e )
480 $Template = $this->CachedMultyFS->get_template(
"$Path/unexisting.php" ,
'update_user_form.tpl' );
482 $User = $this->UserAlgorithms->get_user();
483 $this->Output = $this->String->print_record( $Template , $User );
484 $this->Output = str_replace(
'{prefix}' ,
'user' , $this->Output );
486 $this->compile_update_user_form();
488 catch( Exception $e )
533 $Order =
false , $Condition =
'1 = 1' )
537 $Condition =
'( NOT ( '.$this->UserAccess->NativeTable.
".id IN ( 1 , 2 , 3 ) ) ) AND $Condition";
538 return( $this->UserAccess->select( $Start , $Limit , $Field , $Order , $Condition ) );
540 catch( Exception $e )
564 private function get_contexts()
570 'cfcxs_user_line' ,
'cfcx_login_form' ,
'cfcx_logout_form' ,
'cfcx_auto_open_login_dialog' ,
571 'cfcx_switch_user_form' ,
'cfcx_registration_form' ,
'cfcx_update_user_form' ,
572 'cfcx_short_profile' ,
'cfcx_full_profile' ,
'cfcx_activate_user_form' ,
573 'cfcx_restore_password_form' ,
'cfcx_login_button' ,
'cfcx_logout_button' ,
574 'cfcx_logout_img_button' ,
'cfcx_switch_user_button' ,
'cfcx_update_profile_button'
578 catch( Exception $e )
610 if( $this->ContextSet ===
false )
612 $this->ContextSet =
get_package(
'gui::context_set' ,
'last' , __FILE__ );
615 $this->ContextSet->add_contexts( $Options , dirname( __FILE__ ) , $this->get_contexts() );
617 $this->ContextSet->execute( $Options , $this , __FILE__ );
619 return( $this->Output );
621 catch( Exception $e )