first commit
This commit is contained in:
180
autoload/front/controls/class.GlobelusUser.php
Normal file
180
autoload/front/controls/class.GlobelusUser.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
namespace front\controls;
|
||||
class GlobelusUser
|
||||
{
|
||||
public static function confirm_account_delete()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\GlobelusUser::confirm_account_delete( \S::get( 'hash' ) ) )
|
||||
{
|
||||
\S::set_alert_prompt( 'Informacja', $lang[ 'konto-zostalo-usuniete' ] );
|
||||
unset( $_SESSION['g_user'] );
|
||||
unset( $g_user );
|
||||
}
|
||||
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function delete_account()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( !\front\factory\Globelus::permissions_check( $g_user = \S::get_session( 'g_user' ), __CLASS__ . "\\" . __FUNCTION__ ) )
|
||||
return false;
|
||||
|
||||
if ( \front\factory\GlobelusUser::delete_account( $g_user['id'] ) )
|
||||
\S::set_alert_prompt( 'Informacja', $lang[ 'usuwanie-konta-email' ] );
|
||||
|
||||
header( 'Location: /panel-kandydata/profil' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function new_password()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\GlobelusUser::new_password( \S::get( 'hash' ) ) )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['nowe-haslo-zostalo-wyslane-na-twoj-adres-email'] );
|
||||
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function send_email_password_recovery()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\GlobelusUser::send_email_password_recovery( \S::get( 'email' ) ) )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['odzyskiwanie-hasla-link-komunikat'] );
|
||||
else
|
||||
\S::set_alert_prompt( 'Informacja', $lang['odzyskiwanie-hasla-blad'] );
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function recover_password()
|
||||
{
|
||||
return \front\view\GlobelusUser::recover_password();
|
||||
}
|
||||
|
||||
public static function confirm()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\GlobelusUser::register_confirm( \S::get( 'hash' ) ) )
|
||||
{
|
||||
\S::set_alert_prompt( 'Informacja', $lang['rejestracja-potwierdzenie'] );
|
||||
|
||||
\front\factory\GlobelusUser::signin( null, null, null, null, \S::get( 'hash' ) );
|
||||
|
||||
$g_user = \S::get_session( 'g_user' );
|
||||
|
||||
if ( $g_user['type'] and !$g_user['profile_completed'] )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['pracodawca-niewypelniony-profil-komunikat'] );
|
||||
|
||||
if ( !$g_user['type'] )
|
||||
header( 'Location: /panel-kandydata/profil' );
|
||||
else
|
||||
header( 'Location: /panel-pracodawcy/profil' );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function resend_activation_mail()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( \front\factory\GlobelusUser::resend_activation_mail( \S::get( 'hash' ) ) )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['wyslano-link-do-aktywacji-konta'] );
|
||||
|
||||
header( 'Location: /logowanie' );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function login_as()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
|
||||
if ( !\front\factory\GlobelusUser::signin( null, null, null, null, \S::get( 'hash' ) ) )
|
||||
header( 'Location: /logowanie' );
|
||||
else
|
||||
{
|
||||
$g_user = \S::get_session( 'g_user' );
|
||||
|
||||
if ( $g_user['type'] and !$g_user['profile_completed'] )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['pracodawca-niewypelniony-profil-komunikat'] );
|
||||
|
||||
if ( \S::get( 'return_url' ) )
|
||||
{
|
||||
header( 'Location: ' . \S::get( 'return_url' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( !$g_user['type'] )
|
||||
header( 'Location: /panel-kandydata/profil' );
|
||||
else
|
||||
header( 'Location: /panel-pracodawcy/profil' );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function signin()
|
||||
{
|
||||
global $lang;
|
||||
|
||||
if ( !\front\factory\GlobelusUser::signin( \S::get( 'email' ), \S::get( 'password' ) ) )
|
||||
header( 'Location: /logowanie' );
|
||||
else
|
||||
{
|
||||
$g_user = \S::get_session( 'g_user' );
|
||||
|
||||
if ( $g_user['type'] and !$g_user['profile_completed'] )
|
||||
\S::set_alert_prompt( 'Informacja', $lang['pracodawca-niewypelniony-profil-komunikat'] );
|
||||
|
||||
if ( !$g_user['type'] )
|
||||
header( 'Location: /panel-kandydata/profil' );
|
||||
else
|
||||
{
|
||||
if ( !$g_user['profile_completed'] )
|
||||
header( 'Location: /panel-pracodawcy/profil' );
|
||||
else
|
||||
header( 'Location: /panel-pracodawcy/ogloszenia' );
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function signup()
|
||||
{
|
||||
$result = \front\factory\GlobelusUser::signup( \S::get( 'email' ), \S::get( 'password' ), \S::get( 'type' ), \S::get( 'agremment_profile' ), \S::get( 'agremment_marketing' ) );
|
||||
echo json_encode( $result );
|
||||
exit;
|
||||
}
|
||||
|
||||
public static function register()
|
||||
{
|
||||
if ( $g_user = \S::get_session( 'g_user' ) ) {
|
||||
if ( $g_user['type'] == '1' ) {
|
||||
header( 'Location: /panel-pracodawcy/profil' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
return \front\view\GlobelusUser::register();
|
||||
}
|
||||
|
||||
public static function login()
|
||||
{
|
||||
return \front\view\GlobelusUser::login();
|
||||
}
|
||||
|
||||
public static function logout()
|
||||
{
|
||||
session_destroy();
|
||||
header( 'Location: /' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user